omegga 1.9.0 → 1.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import{c as Jc}from"./client-BT1QYH0O.js";import{j as e}from"./jsx-runtime-BX5r4UiA.js";import{r as N,a as Zc}from"./index-CrN8I5Az.js";import{i as eu,u as tr,m as tu,M as ru,a as nu,c as su,f as au,b as xr,d as iu,e as ou,g as ua,h as lu,t as F,j as Qe,T as cu,S as V,N as De,P as Me,k as Ae,D as br,l as zt,n as Xe,o as qa,p as _e,q as ge,r as be,A as Ge,s as sc,I as uu,C as du,U as jr,L as ka,v as da,w as we,x as hu,y as fu,R as pu,z as Mt,B as mu,E as Ta,Q as gu}from"./index-5EkjXNMi.js";import{L as at,u as Ne,a as Je,S as rr,R as ve,b as vu,c as yu}from"./index-2cgXLhrt.js";import{d as xe,i as xu,h as ac,a as La,b as ic,l as bu,r as nr,c as sr,e as ju,f as ar,g as ha,j as ir,k as $e,m as wu}from"./utils-Ds3ldd-U.js";import{useHasScope as te,useRequireScope as Ze,useIsMobile as _u,useMobileInspector as At,useSaved as Su,SavedSpan as Cu,SavedStatus as Ru}from"./shared/@hooks-CiJaUL6_.js";import{a as qt}from"./index-CSV4ZXsq.js";import{$ as fa,a as et,b as oc,c as Nu,d as ra}from"./user-XF1UyJMA.js";import{$ as Pu,b as Eu,L as me,I as ce,a as H,u as Be,F as Ce,D as ct,M as kt,H as Ve,P as it,T as lc}from"./index-B2DCW1zi.js";import{useStore as ye}from"./shared/@nanostores_react-DJPF1Eqx.js";import{_ as Ou,b as za,a as Du,c as na,I as Gt}from"./IconShieldCheck-Bjlm8mX2.js";import{a as Oe}from"./IconX-CvmO0bbE.js";import{I as Ia,a as pa,b as Mu,c as Au,d as Tt,e as ot,f as qu,g as sa,h as ku,i as Tu,j as Lu,k as zu,l as Iu,m as Hu,n as Wu,o as Uu,p as Bu,q as Ha,r as Fu,s as Gu,t as Lt,u as $u,v as cc,w as uc,x as Yu,y as $t,z as dc,A as hc,B as Ku,C as Xu,D as Vu,E as Qu,F as Ju,G as Zu,H as ed,J as td,K as rd,L as fc,M as wr,N as Wa,O as pc,P as mc,Q as nd,R as sd,S as ad}from"./IconWorldPlus-DKSZjbqh.js";import{I as Yt}from"./IconCheck-DOe3u7iH.js";import{I as Fe,a as ma,b as ut,c as dt,d as Kt,e as id,f as Ua,g as gc,h as od}from"./IconWorld-CmdphDgp.js";import{a as ld,g as ga}from"./_commonjsHelpers-CE1G-McA.js";import{r as Pe}from"./index-D0OPOe3j.js";import{r as va}from"./index-CtCtK5BX.js";import"./jsx-runtime-DldvXD6N.js";import"./index-CJ4e7_2M.js";function cd(...t){const n=!Array.isArray(t[0]),r=n?0:-1,s=t[0+r],a=t[1+r],i=t[2+r],o=t[3+r],d=eu(a,i,o);return n?d(s):d}function vc(t){const n=tr(()=>tu(t)),{isStatic:r}=N.useContext(ru);if(r){const[,s]=N.useState(t);N.useEffect(()=>n.on("change",s),[])}return n}function yc(t,n){const r=vc(n()),s=()=>r.set(n());return s(),nu(()=>{const a=()=>au.preRender(s,!1,!0),i=t.map(o=>o.on("change",a));return()=>{i.forEach(o=>o()),su(s)}}),r}function ud(t){xr.current=[],t();const n=yc(xr.current,t);return xr.current=void 0,n}function dd(t,n,r,s){if(typeof t=="function")return ud(t);const i=typeof n=="function"?n:cd(n,r,s),o=Array.isArray(t)?Ba(t,i):Ba([t],([g])=>i(g)),d=Array.isArray(t)?void 0:t.accelerate;return d&&!d.isTransformed&&typeof n!="function"&&Array.isArray(r)&&s?.clamp!==!1&&(o.accelerate={...d,times:n,keyframes:r,isTransformed:!0}),o}function Ba(t,n){const r=tr(()=>[]);return yc(t,()=>{r.length=0;const s=t.length;for(let a=0;a<s;a++)r[a]=t[a].get();return n(r)})}const xc=N.createContext(null);function hd(t,n,r,s){if(!s)return t;const a=t.findIndex(S=>S.value===n);if(a===-1)return t;const i=s>0?1:-1,o=t[a+i];if(!o)return t;const d=t[a],g=o.layout,j=iu(g.min,g.max,.5);return i===1&&d.layout.max+r>j||i===-1&&d.layout.min+r<j?ou(t,a,a+i):t}function fd({children:t,as:n="ul",axis:r="y",onReorder:s,values:a,...i},o){const d=tr(()=>ua[n]),g=[],j=N.useRef(!1),S=N.useRef(null),y={axis:r,groupRef:S,registerItem:(x,p)=>{const l=g.findIndex(c=>x===c.value);l!==-1?g[l].layout=p[r]:g.push({value:x,layout:p[r]}),g.sort(md)},updateOrder:(x,p,l)=>{if(j.current)return;const c=hd(g,x,p,l);if(g!==c){j.current=!0;const u=[...a];for(let h=0;h<c.length;h++)if(g[h].value!==c[h].value){const v=a.indexOf(g[h].value),m=a.indexOf(c[h].value);v!==-1&&m!==-1&&([u[v],u[m]]=[u[m],u[v]]);break}s(u)}}};N.useEffect(()=>{j.current=!1});const _=x=>{S.current=x,typeof o=="function"?o(x):o&&(o.current=x)},P={overflowAnchor:"none",...i.style};return e.jsx(d,{...i,style:P,ref:_,ignoreStrict:!0,children:e.jsx(xc.Provider,{value:y,children:t})})}const pd=N.forwardRef(fd);function md(t,n){return t.layout.min-n.layout.min}const It=50,Fa=25,gd=new Set(["auto","scroll"]),Et=new WeakMap,Ot=new WeakMap;let Ct=null;function vd(){if(Ct){const t=aa(Ct,"y");t&&(Ot.delete(t),Et.delete(t));const n=aa(Ct,"x");n&&n!==t&&(Ot.delete(n),Et.delete(n)),Ct=null}}function yd(t,n){const r=getComputedStyle(t),s=n==="x"?r.overflowX:r.overflowY,a=t===document.body||t===document.documentElement;return gd.has(s)||a}function aa(t,n){let r=t?.parentElement;for(;r;){if(yd(r,n))return r;r=r.parentElement}return null}function xd(t,n,r){const s=n.getBoundingClientRect(),a=r==="x"?Math.max(0,s.left):Math.max(0,s.top),i=r==="x"?Math.min(window.innerWidth,s.right):Math.min(window.innerHeight,s.bottom),o=t-a,d=i-t;if(o<It){const g=1-o/It;return{amount:-Fa*g*g,edge:"start"}}else if(d<It){const g=1-d/It;return{amount:Fa*g*g,edge:"end"}}return{amount:0,edge:null}}function bd(t,n,r,s){if(!t)return;Ct=t;const a=aa(t,r);if(!a)return;const i=n-(r==="x"?window.scrollX:window.scrollY),{amount:o,edge:d}=xd(i,a,r);if(d===null){Ot.delete(a),Et.delete(a);return}const g=Ot.get(a),j=a===document.body||a===document.documentElement;if(g!==d){if(!(d==="start"&&s<0||d==="end"&&s>0))return;Ot.set(a,d);const y=r==="x"?a.scrollWidth-(j?window.innerWidth:a.clientWidth):a.scrollHeight-(j?window.innerHeight:a.clientHeight);Et.set(a,y)}if(o>0){const S=Et.get(a);if((r==="x"?j?window.scrollX:a.scrollLeft:j?window.scrollY:a.scrollTop)>=S)return}r==="x"?j?window.scrollBy({left:o}):a.scrollLeft+=o:j?window.scrollBy({top:o}):a.scrollTop+=o}function Ga(t,n=0){return lu(t)?t:vc(n)}function jd({children:t,style:n={},value:r,as:s="li",onDrag:a,onDragEnd:i,layout:o=!0,...d},g){const j=tr(()=>ua[s]),S=N.useContext(xc),y={x:Ga(n.x),y:Ga(n.y)},_=dd([y.x,y.y],([c,u])=>c||u?1:"unset"),{axis:P,registerItem:x,updateOrder:p,groupRef:l}=S;return e.jsx(j,{drag:P,...d,dragSnapToOrigin:!0,style:{...n,x:y.x,y:y.y,zIndex:_},layout:o,onDrag:(c,u)=>{const{velocity:h,point:v}=u,m=y[P].get();p(r,m,h[P]),bd(l.current,v[P],P,h[P]),a&&a(c,u)},onDragEnd:(c,u)=>{vd(),i&&i(c,u)},onLayoutMeasure:c=>{x(r,c)},ref:g,ignoreStrict:!0,children:t})}const wd=N.forwardRef(jd);let Xt=-1,Vt=-1,Qt=!1,Dt=null,ia,oa,ya=!1,xa=0;const _d=400,Sd=300,Cd=300,Rd=700,Re=document.createElement("div");Object.assign(Re.style,{position:"fixed",left:"-1000px",top:"-1000px",border:"2px solid black",background:"white",fontFamily:"Glacial Indifference",fontWeight:"bold",fontSize:"16px",padding:"8px",maxWidth:"300px",overflowWrap:"anywhere",zIndex:"100000",borderRadius:"8px",pointerEvents:"none",opacity:0,transition:"opacity .2s ease"});Re.innerText="";document.body.appendChild(Re);const pt=8;function la(t,n){const r=document.documentElement.clientWidth,s=document.documentElement.clientHeight;Re.style.maxWidth=Math.min(300,r-pt*2)+"px";const a=Re.clientWidth,i=Re.clientHeight,o=t+(t<r/2?16:-16-a),d=n+(n<s/2?16:-16-i);Object.assign(Re.style,{left:Math.max(pt,Math.min(o,r-a-pt))+"px",top:Math.max(pt,Math.min(d,s-i-pt))+"px"})}function ba(t){if(!t||!t.getAttribute)return;const n=t.getAttribute("data-tooltip");return n||ba(t.parentNode??null)}function bc(t,n,r,s){if(clearTimeout(oa),Qt&&Dt===t){la(n,r);return}Dt!==t&&(clearTimeout(ia),Dt=t,ia=setTimeout(()=>{Re.innerText=t,la(n,r),Re.style.opacity="1",Qt=!0},s))}function or(){clearTimeout(ia),Dt!==null&&(Dt=null,Re.style.opacity="0",clearTimeout(oa),oa=setTimeout(()=>{Qt=!1,Object.assign(Re.style,{left:"-1000px",top:"-1000px"})},Cd))}document.body.addEventListener("mousemove",t=>{Date.now()<xa||(ya=!1,Xt=t.clientX,Vt=t.clientY,Qt&&la(Xt,Vt))});function Nd(){if(ya||Date.now()<xa)return;const t=document.elementFromPoint(Xt,Vt),n=ba(t);n?bc(n,Xt,Vt,_d):or()}document.body.addEventListener("touchstart",t=>{ya=!0;const n=t.touches[0];if(!n)return;const r=document.elementFromPoint(n.clientX,n.clientY),s=ba(r);s?bc(s,n.clientX,n.clientY,Sd):or()},{passive:!0});document.body.addEventListener("touchmove",()=>or(),{passive:!0});function jc(){xa=Date.now()+Rd,or()}document.body.addEventListener("touchend",jc);document.body.addEventListener("touchcancel",jc);setInterval(Nd,100);const $a=document.documentElement,rt=window.visualViewport,Pd=150;function _r(){if(!rt)return;$a.style.setProperty("--vvh",`${Math.round(rt.height)}px`);const t=window.innerHeight-rt.height;$a.classList.toggle("keyboard-open",t>Pd)}rt&&(rt.addEventListener("resize",_r),rt.addEventListener("scroll",_r),_r());const Ya=qt(!1),Ka=qt(!1),Ed=()=>{const{data:t,status:n,error:r}=F.session.info.useQuery(),s=te(V.ServerStatus),{data:a}=F.server.status.useQuery(void 0,{enabled:s}),[i,o]=N.useState(null);F.server.onPlayerCount.useSubscription(void 0,{enabled:s,onError:Qe,onData:o});const d=!!a,g=a?.serverName??null,j=a?.players?.length??null;return N.useEffect(()=>{if(!s||!d){document.title="Omegga";return}const S=i??j,y=g??"Brickadia Server";document.title=S!=null?`${y} - ${S}`:y},[s,d,g,j,i]),N.useEffect(()=>{n==="success"&&t?(fa.set(t),Pu.set(t.version),Eu.set(t.brickadiaVersion),et.set(t.user),oc.set(t.user.resolvedScopes??{}),Nu.set(t.canLogOut),Ya.set(!0),Ka.set(!1)):n==="error"&&(Ya.set(!1),Ka.set(!0),r instanceof cu&&r.data?.code==="UNAUTHORIZED"&&location.reload())},[t,n]),null},Od=()=>e.jsxs(e.Fragment,{children:[e.jsx(De,{title:"Not Found"}),e.jsx(Me,{children:e.jsx(Ae,{})})]}),Sr=({error:t})=>t?e.jsx("div",{className:"mfa-error",children:t}):null,Dd=()=>{const t=F.mfa.status.useQuery(),n=F.mfa.totp.setup.useMutation(),r=F.mfa.totp.enable.useMutation(),s=F.mfa.totp.disable.useMutation(),a=F.mfa.passkey.registerOptions.useMutation(),i=F.mfa.passkey.register.useMutation(),o=F.mfa.passkey.remove.useMutation(),d=F.mfa.recoveryCodes.generate.useMutation(),[g,j]=N.useState(null),[S,y]=N.useState(""),[_,P]=N.useState(""),[x,p]=N.useState(""),[l,c]=N.useState(""),[u,h]=N.useState(""),[v,m]=N.useState(null),[b,f]=N.useState(""),[w,R]=N.useState(""),[D,O]=N.useState(""),[k,q]=N.useState(!1),L=typeof window<"u"&&!!window.PublicKeyCredential&&(location.protocol==="https:"||location.hostname==="localhost"),z=N.useCallback(async()=>{if(!_)return;f(""),q(!0);const Q=await n.mutateAsync({password:_});q(!1),"error"in Q&&Q.error?f(Q.error):"secret"in Q&&(j(Q),y(""),P(""))},[_]),I=N.useCallback(async()=>{if(!g)return;f(""),q(!0);const Q=await r.mutateAsync({code:S});q(!1),Q?f(Q):(j(null),y(""),t.refetch())},[g,S]),M=N.useCallback(async()=>{if(!_)return;f(""),q(!0);const Q=await s.mutateAsync({password:_});q(!1),Q?f(Q):(P(""),t.refetch())},[_]),Y=N.useCallback(async()=>{R(""),q(!0);try{const Q=await a.mutateAsync(),{startRegistration:he}=await Ou(async()=>{const{startRegistration:de}=await import("./index-BDkarAkX.js");return{startRegistration:de}},[]),W=await he({optionsJSON:Q}),ie=await i.mutateAsync({credential:W,name:u||"Passkey"});ie?R(ie):(h(""),t.refetch())}catch(Q){Q?.name!=="NotAllowedError"&&R(Q?.message||"Registration failed")}q(!1)},[u]),G=N.useCallback(async Q=>{if(!x){R("Enter your password to remove a passkey");return}R(""),q(!0);const he=await o.mutateAsync({id:Q,password:x});he?R(he):(p(""),t.refetch()),q(!1)},[x]),X=N.useCallback(async()=>{if(!l)return;O(""),q(!0);const Q=await d.mutateAsync({password:l});"error"in Q&&Q.error?O(Q.error):"codes"in Q&&(m(Q.codes),c(""),t.refetch()),q(!1)},[l]),ne=N.useCallback(()=>{v&&navigator.clipboard.writeText(v.join(`
2
2
  `))},[v]);if(t.isLoading)return e.jsx(me,{active:!0,size:"huge",children:"Loading MFA"});const se=t.data;return e.jsxs("div",{className:"mfa-manager",children:[e.jsx("div",{className:"section-header",children:"Authenticator App"}),e.jsxs("div",{className:"stats",children:[e.jsx(Sr,{error:b}),se?.totpEnabled&&!g&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"stat",children:[e.jsx(za,{size:16})," TOTP is enabled."]}),e.jsxs("div",{className:"mfa-actions",children:[e.jsx(ce,{placeholder:"Password to disable",type:"password",value:_,onChange:P,onSubmit:_&&!k?M:void 0}),e.jsxs(H,{warn:!0,boxy:!0,disabled:!_||k,onClick:M,children:[e.jsx(Oe,{})," Disable"]})]})]}),!se?.totpEnabled&&!g&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"stat",children:"TOTP is not configured."}),e.jsxs("div",{className:"mfa-actions",children:[e.jsx(ce,{placeholder:"Password to set up",type:"password",value:_,onChange:P,onSubmit:_&&!k?z:void 0}),e.jsxs(H,{main:!0,boxy:!0,disabled:!_||k,onClick:z,children:[e.jsx(za,{})," Set Up"]})]})]}),g&&e.jsxs("div",{className:"totp-setup",children:[e.jsx("div",{className:"stat",children:"Scan this QR code with your authenticator app:"}),e.jsx("img",{className:"qr-code",src:g.qrCode,alt:"TOTP QR Code"}),e.jsxs("div",{className:"stat manual-secret",children:[e.jsx("b",{children:"Manual entry:"})," ",e.jsx("code",{children:g.secret}),e.jsx(H,{icon:!0,normal:!0,"data-tooltip":"Copy secret",onClick:()=>navigator.clipboard.writeText(g.secret),children:e.jsx(Ia,{})})]}),e.jsxs("div",{className:"mfa-actions",children:[e.jsx(ce,{placeholder:"6-digit code",type:"text",value:S,onChange:y,onSubmit:S&&!k?I:void 0}),e.jsxs(H,{main:!0,boxy:!0,disabled:!S||k,onClick:I,children:[e.jsx(Yt,{})," Verify"]}),e.jsxs(H,{normal:!0,boxy:!0,onClick:()=>{j(null),f("")},children:[e.jsx(Oe,{})," Cancel"]})]})]})]}),L&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"section-header",children:"Passkeys"}),e.jsxs("div",{className:"stats",children:[e.jsx(Sr,{error:w}),se?.passkeys?.length?e.jsx("div",{className:"passkey-list",children:se.passkeys.map(Q=>e.jsxs("div",{className:"passkey-item",children:[e.jsxs("span",{className:"passkey-name",children:[e.jsx(Du,{size:16})," ",Q.name]}),e.jsxs("span",{className:"passkey-meta",children:["Added ",new Date(Q.created).toLocaleDateString()]}),e.jsx(H,{icon:!0,error:!0,disabled:k,"data-tooltip":"Remove passkey",onClick:()=>G(Q.id),children:e.jsx(pa,{})})]},Q.id))}):e.jsx("div",{className:"stat",children:"No passkeys registered."}),e.jsxs("div",{className:"mfa-actions",children:[e.jsx(ce,{placeholder:"Passkey name",type:"text",value:u,onChange:h}),e.jsxs(H,{main:!0,boxy:!0,disabled:k,onClick:Y,children:[e.jsx(Fe,{})," Add Passkey"]})]}),se?.passkeys?.length?e.jsx("div",{className:"mfa-actions",children:e.jsx(ce,{placeholder:"Password to remove",type:"password",value:x,onChange:p})}):e.jsx("div",{className:"stat note",children:"Passkeys may not work with IP addresses. Use a domain name for reliable passkey support."})]})]}),e.jsx("div",{className:"section-header",children:"Recovery Codes"}),e.jsxs("div",{className:"stats",children:[e.jsx(Sr,{error:D}),v?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"stat",children:"Save these codes. They will not be shown again."}),e.jsx("div",{className:"recovery-grid",children:v.map((Q,he)=>e.jsx("code",{children:Q},he))}),e.jsxs("div",{className:"mfa-actions",children:[e.jsxs(H,{normal:!0,boxy:!0,onClick:ne,children:[e.jsx(Ia,{})," Copy"]}),e.jsxs(H,{normal:!0,boxy:!0,onClick:()=>m(null),children:[e.jsx(Yt,{})," Done"]})]})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"stat",children:se?.hasRecoveryCodes?"Recovery codes are configured.":"No recovery codes generated."}),e.jsxs("div",{className:"mfa-actions",children:[e.jsx(ce,{placeholder:"Password",type:"password",value:l,onChange:c,onSubmit:l&&!k?X:void 0}),e.jsxs(H,{warn:!!se?.hasRecoveryCodes,main:!se?.hasRecoveryCodes,boxy:!0,disabled:!l||k,onClick:X,children:[e.jsx(na,{})," ",se?.hasRecoveryCodes?"Regenerate":"Generate"]})]})]})]})]})};function wc(...t){let n="off";const r={},s={},a={off:0,read:1,all:2},i={none:0,read:1,all:2};for(const o of t){(a[o.root]??0)>(a[n]??0)&&(n=o.root);for(const[d,g]of Object.entries(o.domains??{}))(i[g]??0)>(i[r[d]]??0)&&(r[d]=g);for(const[d,g]of Object.entries(o.scopes??{}))g&&(s[d]=!0)}return{root:n,domains:r,scopes:s}}function ze(t){const n={};for(const[r,s]of Object.entries(Xe)){if(t.root==="all"){n[r]=!0;continue}if(t.root==="read"&&s.readOnly){n[r]=!0;continue}const a=t.domains[s.domain];if(a==="all"){n[r]=!0;continue}if(a==="read"&&s.readOnly){n[r]=!0;continue}n[r]=t.scopes[r]??!1}return n}function Xa(t,n){const r=ze(t),s=ze(n);return Object.keys(r).some(a=>r[a]&&!s[a])}function Va(t,n){const r=ze(t);return Object.keys(r).some(s=>r[s]&&!n[s])}const Md=[{value:"all",label:"All"},{value:"read",label:"Read Only"},{value:"off",label:"Manual"}],Ad=[{value:"all",label:"All"},{value:"read",label:"Read Only"},{value:"none",label:"Manual"}];function Qa({value:t,options:n,onChange:r,disabled:s,disabledOptions:a}){return e.jsx("div",{className:`level-picker ${s?"dimmed":""}`,children:n.map((i,o)=>{const d=s||a?.has(i.value);return e.jsx("button",{className:["level-option",t===i.value?"active":"",`level-${i.value}`,o===0?"first":"",o===n.length-1?"last":""].filter(Boolean).join(" "),onClick:()=>{d||t===i.value||r(i.value)},disabled:!!d,children:i.label},i.value)})})}const Jt=({perms:t,onChange:n,defaultPerms:r,disabled:s,actorScopes:a})=>{const[i,o]=N.useState({}),[d,g]=N.useState(""),j=d.toLowerCase(),S=j.length>0,y=!n,_=t.root!=="off",P=N.useMemo(()=>{if(!a)return;const w=new Set;for(const R of["all","read","off"]){if(R===t.root)continue;const D=R!=="off"?{root:R,domains:{},scopes:{}}:{...t,root:R};(Va(D,a)||Xa(t,D))&&w.add(R)}return w.size>=2&&w.add(t.root),w.size>0?w:void 0},[a,t]),x=N.useMemo(()=>{if(!a)return{};const w={};for(const R of br){const D=t.domains[R]??"none",O=new Set;for(const k of["all","read","none"]){if(k===D)continue;const q={...t.domains},L={...t.scopes};if(k!=="none"){q[R]=k;for(const I of zt[R]??[])delete L[I]}else delete q[R];const z={...t,domains:q,scopes:L};(Va(z,a)||Xa(t,z))&&O.add(k)}O.size>=2&&O.add(D),O.size>0&&(w[R]=O)}return w},[a,t]),p=Object.keys(Xe),l=p.length,c=N.useMemo(()=>{if(t.root==="all")return l;let w=0;for(const R of p){const D=Xe[R];if(!D)continue;if(t.root==="read"&&D.readOnly){w++;continue}const O=t.domains[D.domain];if(O==="all"){w++;continue}if(O==="read"&&D.readOnly){w++;continue}t.scopes[R]&&w++}return w},[t]),u=w=>{n?.(w!=="off"?{...t,root:w,domains:{},scopes:{}}:{...t,root:w})},h=(w,R)=>{const D={...t.domains},O={...t.scopes};if(R!=="none"){D[w]=R;for(const k of zt[w]??[])delete O[k]}else delete D[w];n?.({...t,domains:D,scopes:O})},v=(w,R)=>{const D={...t.scopes};R?D[w]=!0:delete D[w],n?.({...t,scopes:D})},m=w=>o(R=>({...R,[w]:R[w]===!1})),b=w=>{if(!r)return null;const R=Xe[w];if(!R)return null;if(r.root==="all")return!0;if(r.root==="read")return R.readOnly;const D=r.domains[R.domain];return D==="all"?!0:D==="read"?R.readOnly:r.scopes[w]??!1},f=N.useMemo(()=>{if(!S)return null;const w=new RegExp(j.split(/\s+/).filter(Boolean).map(O=>`(?=.*${O.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`).join(""),"i"),R=O=>w.test(O),D={};for(const O of br){const q=(zt[O]??[]).filter(L=>{const z=Xe[L];return R(L)||R(qa[O]??"")||R(z?.description??"")});q.length>0&&(D[O]=q)}return D},[j,S]);return e.jsxs("div",{className:"permission-editor",children:[e.jsx("div",{className:"perm-search",children:e.jsx(ce,{type:"text",placeholder:"Search Permissions...",value:d,onChange:g})}),!S&&e.jsxs("div",{className:"perm-row root-row",children:[e.jsx("span",{className:"perm-label root-label",children:"Everything"}),e.jsxs("span",{className:"scope-count",children:[c,"/",l]}),e.jsx(Qa,{value:t.root,options:Md,onChange:u,disabled:s||y,disabledOptions:P})]}),br.map(w=>{const R=t.domains[w],D=_||R==="all"||R==="read",O=zt[w]??[],k=S?f?.[w]??[]:O;if(S&&k.length===0)return null;const q=S||i[w]!==!1,L=t.root==="all"||R==="all"?O.length:t.root==="read"||R==="read"?O.filter(z=>Xe[z]?.readOnly||t.scopes[z]).length:O.filter(z=>t.scopes[z]).length;return e.jsxs("div",{className:"perm-domain",children:[e.jsxs("div",{className:"perm-row domain-row",children:[e.jsxs("span",{className:"perm-label domain-label",onClick:()=>m(w),children:[q?e.jsx(Mu,{size:16}):e.jsx(Au,{size:16})," ",qa[w]]}),e.jsxs("span",{className:"scope-count",children:[L,"/",O.length]}),e.jsx(Qa,{value:R??"none",options:Ad,onChange:z=>h(w,z),disabled:s||y||_,disabledOptions:x[w]})]}),q&&k.map((z,I)=>{const M=Xe[z],Y=t.scopes[z]??!1,G=b(z);return e.jsxs("div",{className:`perm-row scope-row ${I%2===0?"even":"odd"}`,children:[e.jsxs("div",{className:"scope-info",children:[e.jsxs("span",{className:"scope-name",children:[e.jsx("span",{className:`scope-badge ${M?.readOnly?"read":"write"}`,"data-tooltip":M?.readOnly?"Read-only":"Read/Write",children:M?.readOnly?"R":"W"}),z.split(".").slice(1).join(".")]}),e.jsx("span",{className:"scope-desc",children:M?.description})]}),e.jsxs("div",{className:"scope-controls",children:[G===!0&&e.jsx("span",{className:"inherited on","data-tooltip":"Granted by defaults",children:e.jsx(Yt,{size:14})}),e.jsx(_e,{value:Y,onChange:X=>v(z,X),disabled:s||y||D||a&&(Y||!a[z])})]})]},z)})]},w)})]})},qd=({username:t,isSelf:n,roleIds:r})=>{const s=te(V.UserGrantRole),a=te(V.RoleList),i=F.role.list.useQuery(void 0,{enabled:a}),o=F.user.grantRole.useMutation(),d=F.user.revokeRole.useMutation(),g=F.useUtils(),[j,S]=N.useState(!1),y=N.useRef(null),_=N.useMemo(()=>i.data??[],[i.data]),P=N.useMemo(()=>_.filter(c=>r.includes(c.id)).sort((c,u)=>c.order-u.order),[_,r]),x=N.useMemo(()=>_.filter(c=>!r.includes(c.id)),[_,r]);N.useEffect(()=>{if(!j)return;function c(u){u.target&&!y.current?.contains(u.target)&&S(!1)}return document.addEventListener("click",c),()=>document.removeEventListener("click",c)},[j]);const p=async c=>{await o.mutateAsync({username:t,roleId:c}),n?g.user.self.invalidate():g.user.list.invalidate(),S(!1)},l=async c=>{await d.mutateAsync({username:t,roleId:c}),n?g.user.self.invalidate():g.user.list.invalidate()};return a?e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"section-header",children:"Roles"}),e.jsxs("div",{className:"br-player-list",style:{padding:12,position:"relative",maxWidth:"calc(100% - 32px)",marginRight:16,alignItems:"stretch"},children:[P.map(c=>e.jsxs("div",{className:"br-player-item",children:[e.jsx(at,{href:`/roles/${c.id}`,className:"selected",children:c.name}),s&&!n&&e.jsx(H,{icon:!0,warn:!0,"data-tooltip":"Revoke role",onClick:()=>l(c.id),children:e.jsx(ma,{})})]},c.id)),P.length===0&&e.jsx("div",{className:"br-player-item muted-text",style:{fontWeight:"bold"},children:"No roles assigned"}),s&&!n&&x.length>0&&e.jsxs("div",{className:"player-search",ref:y,children:[e.jsxs(H,{normal:!0,boxy:!0,onClick:()=>S(!j),children:[e.jsx(Fe,{size:16}),"Add Role"]}),j&&e.jsx("div",{className:"options",children:x.map(c=>e.jsx("div",{className:"option",onClick:()=>p(c.id),children:c.name},c.id))})]})]})]}):null},_c=({selfUser:t})=>{const[n,r]=Ne("/users/:id"),[s,a]=Je(),i=ye(et),o=ye(oc),d=te(V.UserPermissions),g=te(V.UserBan),j=te(V.UserDelete),S=te(V.UserPasswd),y=te(V.UserReadMfa),_=te(V.UserResetMfa),P=!!t,x=t??r?.id??"",p=F.user.list.useQuery(void 0,{enabled:!P}),l=F.user.self.useQuery(void 0,{enabled:P}),c=N.useMemo(()=>P?l.data??null:p.data?p.data.users.find(oe=>oe.username===x)??null:null,[P,l.data,p.data,x]),u=P?l.isLoading:p.isLoading,h=F.role.defaultPermissions.get.useQuery(void 0,{enabled:d}),v=F.user.permissions.useMutation(),m=F.user.ban.useMutation(),b=F.user.delete.useMutation(),f=F.user.passwd.useMutation(),w=F.user.resetMfa.useMutation(),R=Be(),D=Be(),O=Be(),[k,q]=N.useState(null),[L,z]=N.useState(!1),[I,M]=N.useState(""),[Y,G]=N.useState(!1),[X,ne]=N.useState(!1),[se,Q]=N.useState(!1),[he,W]=N.useState(""),[ie,de]=N.useState(""),[U,Z]=N.useState("");N.useEffect(()=>{if(c){const oe=c.permissions?.root;q({root:oe==="all"||oe==="read"?oe:"off",domains:c.permissions?.domains??{},scopes:c.permissions?.scopes??{}})}else q(null)},[c?.username,c?.permissions]),N.useEffect(()=>{!P&&!u&&!c&&x&&a("/users")},[P,u,c,x]);const ae=F.useUtils(),C=N.useCallback(async()=>{if(!(!k||!x)){z(!0),M("");try{const oe=await v.mutateAsync({username:x,permissions:k});oe?M(oe):(await ae.user.list.refetch(),P&&await l.refetch())}catch(oe){M(oe?.message||"Failed to save permissions")}z(!1)}},[k,x]),E=N.useMemo(()=>!k||!c?.permissions?!1:JSON.stringify(k)!==JSON.stringify(c.permissions),[k,c?.permissions]),A=async oe=>{const K=oe?"Disable":"Re-enable";if(!await R.prompt(e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:[K," user ",e.jsx("b",{children:x}),"?"]}),e.jsx("p",{children:oe?"Disabled users cannot sign in to the web UI.":"This will allow the user to sign in again."})]})))return;const fe=await m.mutateAsync({username:x,banned:oe});fe?console.error("Failed to ban user:",fe):p.refetch()},T=async()=>{if(!await D.prompt(e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Permanently delete user ",e.jsx("b",{children:x}),"?"]}),e.jsx("p",{children:"This will remove the account and all of its permissions. This action cannot be undone."})]})))return;const oe=await b.mutateAsync({username:x});oe?console.error("Failed to delete user:",oe):(a("/users"),p.refetch(),ra.set(ra.get()+1))},$=async()=>{if(!await O.prompt(e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Reset MFA for ",e.jsx("b",{children:x}),"?"]}),e.jsx("p",{children:"This will clear TOTP, passkeys, and recovery codes."})]})))return;const oe=await w.mutateAsync({username:x});oe?console.error("Failed to reset MFA:",oe):P?l.refetch():p.refetch()},B=async()=>{if(W(""),ie===U){Q(!0);try{const oe=await f.mutateAsync({username:x,password:ie});Q(!1),oe?W(oe):(ne(!1),de(""),Z(""))}catch{Q(!1)}}},ee=(i?.username||"Admin")===(x||"Admin"),J=c&&(c.totpEnabled||(c.passkeyCount??0)>0),re=c&&!c.isOwner&&!ee&&(g||j||S||_&&J),ue=h.data?{root:h.data.root,domains:h.data.domains,scopes:h.data.scopes}:null,je=Date.now();return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"player-inspector-container",children:[e.jsxs(ge,{attached:!0,children:[c?.username||(P?"Account":"SELECT A USER"),e.jsx("span",{style:{flex:1}}),c&&d&&!c.isOwner&&e.jsxs(H,{normal:!0,disabled:L||!E,onClick:C,"data-tooltip":"Save Permissions",children:[e.jsx(Tt,{}),"Save"]})]}),e.jsx("div",{className:"player-inspector",children:e.jsxs("div",{className:"player-view",children:[e.jsx(me,{active:u,size:"huge",children:"Loading User"}),e.jsx("div",{className:"player-info",children:!u&&c&&e.jsxs(be,{children:[e.jsxs("div",{className:"stats",children:[e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Username:"})," ",c.username||"Admin"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Owner:"})," ",c.isOwner?"Yes":"No"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Disabled:"})," ",c.isBanned?"Yes":"No"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Last Active:"})," ",c.lastOnline?xe(je-c.lastOnline)+" ago":"Never"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Created:"})," ",xe(je-c.created)," ago"]}),!ee&&y&&e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"MFA:"})," ",c.totpEnabled||(c.passkeyCount??0)>0?[c.totpEnabled&&"TOTP",(c.passkeyCount??0)>0&&`${c.passkeyCount??0} passkey(s)`].filter(Boolean).join(" + "):"Not configured"]})]}),P&&e.jsx(Dd,{}),!c.isOwner&&e.jsx(qd,{username:x,isSelf:P,roleIds:c.roles??[]}),d&&!c.isOwner&&k&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"section-header",children:"Permissions"}),I&&e.jsx("div",{className:"perm-error",children:I}),e.jsx(Jt,{perms:k,onChange:q,defaultPerms:ue,actorScopes:i?.isOwner?void 0:o})]}),c.isOwner&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"section-header",children:"Permissions"}),e.jsx(Jt,{perms:{root:"all",domains:{},scopes:{}},onChange:()=>{},disabled:!0})]})]})})]})}),re&&e.jsxs(Ce,{attached:!0,children:[e.jsx("span",{style:{flex:1}}),e.jsxs("div",{className:"widgets-container",children:[e.jsxs(H,{normal:!0,boxy:!0,onClick:()=>G(!Y),children:[Y?e.jsx(ut,{}):e.jsx(dt,{}),"Actions"]}),e.jsxs(Ge,{visible:Y,direction:"up",className:"widgets-list widgets-list-up",children:[S&&e.jsxs(H,{info:!0,onClick:()=>{G(!1),ne(!0)},children:[e.jsx(na,{}),"Change Password"]}),g&&e.jsxs(H,{normal:!c.isBanned,warn:!!c.isBanned,onClick:()=>{G(!1),A(!c.isBanned)},children:[e.jsx(ot,{}),c.isBanned?"Re-enable":"Disable"]}),_&&J&&e.jsxs(H,{warn:!0,onClick:()=>{G(!1),$()},children:[e.jsx(qu,{}),"Reset MFA"]}),j&&e.jsxs(H,{error:!0,onClick:()=>{G(!1),T()},children:[e.jsx(pa,{}),"Delete"]})]})]})]})]}),R.children,D.children,O.children,e.jsxs(ct,{visible:X,children:[e.jsx(me,{active:se,size:"huge",children:"Submitting"}),e.jsxs(kt,{visible:!se,children:[e.jsx(Ve,{children:"Change Password"}),e.jsxs(it,{children:[e.jsxs("p",{children:["Set a new password for ",e.jsx("b",{children:x}),"."]}),he&&e.jsxs("p",{style:{color:"red"},children:["Error: ",he]})]}),e.jsxs("div",{className:"popout-inputs",children:[e.jsx(ce,{placeholder:"new password",type:"password",value:ie,onChange:de}),e.jsx(ce,{placeholder:"confirm new password",type:"password",value:U,onChange:Z,onSubmit:ie.length&&U===ie?B:void 0})]}),e.jsxs(Ce,{children:[e.jsxs(H,{main:!0,disabled:!ie.length||U!==ie,onClick:B,children:[e.jsx(na,{}),"Update"]}),e.jsx("div",{style:{flex:1}}),e.jsxs(H,{normal:!0,onClick:()=>{ne(!1),de(""),Z(""),W("")},children:[e.jsx(Oe,{}),"Cancel"]})]})]})]})]})},kd=()=>{const t=ye(et),n=F.user.passwd.useMutation(),[r,s]=N.useState(!1),[a,i]=N.useState(!1),[o,d]=N.useState(!1),[g,j]=N.useState(""),[S,y]=N.useState(""),[_,P]=N.useState(""),[x,p]=N.useState(""),l=t?.username??"",c=()=>{i(!1),j(""),y(""),P(""),p("")},u=async()=>{if(j(""),_===x){d(!0);try{const v=await n.mutateAsync({username:l,password:_,currentPassword:S});if(d(!1),!v){c();return}j(v)}catch(v){console.error("error setting password",v),d(!1)}}},h=N.useMemo(()=>S.length>0&&_.length>0&&x===_,[S,_,x]);return e.jsxs(e.Fragment,{children:[e.jsx(De,{title:"Account",children:e.jsxs("div",{className:"widgets-container",children:[e.jsxs(H,{normal:!0,boxy:!0,onClick:()=>s(!r),children:[r?e.jsx(dt,{}):e.jsx(ut,{}),"Actions"]}),e.jsx(Ge,{visible:r,children:e.jsxs(H,{info:!0,onClick:()=>{s(!1),i(!0)},children:[e.jsx(sa,{}),"Change Password"]})})]})}),e.jsxs(Me,{children:[e.jsx(Ae,{}),e.jsx("div",{className:"generic-container players-container",children:e.jsx(_c,{selfUser:l})}),e.jsxs(ct,{visible:a,children:[e.jsx(me,{active:o,size:"huge",children:"Submitting"}),e.jsxs(kt,{visible:!o,children:[e.jsx(Ve,{children:"Change Password"}),e.jsx(it,{children:g&&e.jsxs("p",{style:{color:"red"},children:["Error: ",g]})}),e.jsxs("div",{className:"popout-inputs",children:[e.jsx(ce,{placeholder:"current password",type:"password",value:S,onChange:y}),e.jsx(ce,{placeholder:"new password",type:"password",value:_,onChange:P}),e.jsx(ce,{placeholder:"confirm new password",type:"password",value:x,onChange:p,onSubmit:h?u:void 0})]}),e.jsxs(Ce,{children:[e.jsxs(H,{main:!0,disabled:!h,onClick:u,children:[e.jsx(sa,{}),"Update"]}),e.jsx("div",{style:{flex:1}}),e.jsxs(H,{normal:!0,onClick:c,children:[e.jsx(Oe,{}),"Cancel"]})]})]})]})]})]})},Sc=["January","February","March","April","May","June","July","August","September","October","November","December"],He=(t,n=!1)=>Object.keys(t).map(Number).sort((r,s)=>n?s-r:r-s),Td=()=>{const t=Ze(V.ChatHistory),n=te(V.ChatCalendar),[r,s]=Ne("/history/:time?"),a=s?.time,[i,o]=N.useState(!0),[d,g]=N.useState(!0),[j,S]=N.useState(!1),[y,_]=N.useState({}),[P,x]=N.useState(0),p=N.useMemo(()=>new Date().getFullYear(),[]),[l,c]=N.useState(p),u=N.useMemo(()=>new Date().getMonth(),[]),[h,v]=N.useState(u),m=N.useMemo(()=>new Date().getDate(),[]),b=N.useRef(null),[f,w]=N.useState(null),[R,D]=N.useState(null),O=N.useRef(null),k=N.useRef(null),q=N.useRef([]),L=F.useUtils(),z=N.useCallback(async()=>{o(!0);const C=await L.chat.calendar.fetch();_(C),o(!1)},[]),I=N.useCallback(C=>{if(!C.length)return;q.current=q.current.concat(C),q.current.sort((T,$)=>T.created-$.created);const E=q.current[0].created,A=q.current[q.current.length-1].created;for(let T=0;T<q.current.length;T++){const $=q.current[T],B=new Date($.created);$.date=B.getDate(),T===0||$.date!==q.current[T-1].date?$.newDay=`${Sc[B.getMonth()]} ${$.date}, ${B.getFullYear()}`:$.newDay=void 0}O.current=E,k.current=A,x(T=>T+1)},[]),M=N.useCallback(async({before:C,after:E},A)=>{o(!0);const T=await L.chat.history.fetch({before:C,after:E});I(T),g(!1),o(!1);const $=A;return $&&q.current.length>200&&requestAnimationFrame(()=>{$==="bottom"?(q.current.splice(0,q.current.length-200),O.current=q.current[0].created,w(null)):$==="top"&&(q.current.splice(200,q.current.length-200),k.current=q.current[q.current.length-1].created,D(null)),x(B=>B+1)}),T},[]),Y=()=>new Promise(C=>{const E=b.current?.querySelector(".scroll-scroller");window.requestAnimationFrame(()=>{E&&(E.scrollTop=E.scrollHeight,C())})});N.useEffect(()=>{const C=a&&new Date(a.match(/^\d+$/)?Number(a):a);(async()=>(d&&n&&await z(),C&&!Number.isNaN(C.getTime())?(q.current=[],await M({before:C.getTime()-1}),await M({after:C.getTime()-1}),requestAnimationFrame(()=>{b.current?.querySelector(".focused")?.scrollIntoView({block:"center"})})):(q.current=[],await M({before:Date.now()}),Y())))()},[a]);const G=async(C,E,A)=>{q.current=[],x($=>$+1);const T=new Date(C,E,A).getTime();await M({after:T})},X=async()=>{if(f&&O.current&&O.current<=f)return;(await M({before:O.current},"top")).length===0&&w(O.current)},ne=async()=>{if(R&&k.current&&k.current>=R)return;(await M({after:k.current},"bottom")).length===0&&D(k.current)},se=N.useMemo(()=>He(y),[y]),Q=N.useMemo(()=>He(y,!0),[y]),he=N.useMemo(()=>{const C=Q.find(E=>E>l)??null;return C?[C,He(y[C])[0]]:null},[y,Q]),W=N.useMemo(()=>{const C=se.find(E=>E<l)??null;return C?[C,He(y[C],!0)[0]]:null},[y,se]),ie=N.useMemo(()=>{if(h!==11&&y[l]){const A=He(y[l]).find(T=>T>h);if(typeof A=="number")return[l,A]}const C=se.find(A=>A>l);if(!C)return null;const E=He(y[C])[0];return typeof E!="number"?null:[C,E]},[l,h,se,y]),de=N.useMemo(()=>{if(h!==0&&y[l]){const A=He(y[l],!0).find(T=>T<h);if(typeof A=="number")return[l,A]}const C=Q.find(A=>A<l);if(!C)return null;const E=He(y[C],!0)[0];return typeof E!="number"?null:[C,E]},[l,h,y]),U=C=>{C&&(c(l),v(h))},Z=new Date(l,h+1,0).getDate(),ae=new Date(l,h,1).getDay();return t?e.jsxs(e.Fragment,{children:[e.jsx(De,{title:"History",children:n&&e.jsxs("div",{className:"calendar-container",children:[e.jsxs(H,{normal:!0,boxy:!0,style:{marginRight:0},"data-tooltip":"Show a calendar previewing days",onClick:()=>S(!j),children:[e.jsx(ku,{})," Calendar"]}),e.jsx(sc,{children:j&&e.jsx(ua.div,{initial:{opacity:0,y:-8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},transition:{duration:.15},children:e.jsx(Ld,{prevYear:W,setDate:U,year:l,nextYear:he,prevMonth:de,month:h,nextMonth:ie,startDay:ae,numDays:Z,nowMonth:u,nowYear:p,nowDay:m,calendar:y,focusDay:G})})})]})}),e.jsxs(Me,{children:[e.jsx(Ae,{}),e.jsx("div",{className:"generic-container history-container",ref:b,children:e.jsxs("div",{className:"chat-history",children:[e.jsx("div",{className:"scroll-container",children:e.jsx(uu,{loading:i,onTop:X,onBottom:ne,onTopScrollsToBottom:!1,offset:500,className:"scroll-scroller",children:q.current.map(C=>e.jsxs(Zc.Fragment,{children:[C.newDay&&e.jsx("div",{className:"chat-new-day",children:C.newDay}),e.jsx(du,{log:C},C._id)]},C._id))})}),e.jsx(me,{active:i&&d,size:"huge",children:"Loading Chat"})]})})]})]}):null},Ld=({prevYear:t,setDate:n,year:r,nextYear:s,prevMonth:a,month:i,nextMonth:o,startDay:d,numDays:g,nowMonth:j,nowYear:S,nowDay:y,calendar:_,focusDay:P})=>e.jsxs("div",{className:"calendar",children:[e.jsxs("div",{className:"year",children:[e.jsx(H,{icon:!0,normal:!0,disabled:!t,onClick:()=>n(t),children:e.jsx(Kt,{})}),r,e.jsx(H,{icon:!0,normal:!0,disabled:!s,onClick:()=>n(s),children:e.jsx(Gt,{})})]}),e.jsxs("div",{className:"month",children:[e.jsx(H,{icon:!0,normal:!0,disabled:!a,onClick:()=>n(a),children:e.jsx(Kt,{})}),Sc[i],e.jsx(H,{icon:!0,normal:!0,disabled:!o,onClick:()=>n(o),children:e.jsx(Gt,{})})]}),e.jsxs("div",{className:"calendar-days",children:[e.jsx("div",{className:"week-header days",children:"S"}),e.jsx("div",{className:"week-header days",children:"M"}),e.jsx("div",{className:"week-header days",children:"T"}),e.jsx("div",{className:"week-header days",children:"W"}),e.jsx("div",{className:"week-header days",children:"T"}),e.jsx("div",{className:"week-header days",children:"F"}),e.jsx("div",{className:"week-header days",children:"S"}),Array.from({length:d}).map((x,p)=>e.jsx("div",{},`empty-${p}`)),Array.from({length:g}).map((x,p)=>e.jsx("div",{className:`days ${j===i&&S===r&&p+1===y?"today":""} ${!(j===i&&S===r&&p+1>y)&&_[r]?.[i]?.[p]?"available":""}`,onClick:()=>P(r,i,p+1),children:p+1},p))]})]});var Cr={exports:{}},mt={},Rt={exports:{}},zd=Rt.exports,Ja;function ja(){return Ja||(Ja=1,(function(t,n){(function(r,s){s(n)})(zd,(function(r){function s(U){return function(ae,C,E,A,T,$,B){return U(ae,C,B)}}function a(U){return function(ae,C,E,A){if(!ae||!C||typeof ae!="object"||typeof C!="object")return U(ae,C,E,A);var T=A.get(ae),$=A.get(C);if(T&&$)return T===C&&$===ae;A.set(ae,C),A.set(C,ae);var B=U(ae,C,E,A);return A.delete(ae),A.delete(C),B}}function i(U,Z){var ae={};for(var C in U)ae[C]=U[C];for(var C in Z)ae[C]=Z[C];return ae}function o(U){return U.constructor===Object||U.constructor==null}function d(U){return typeof U.then=="function"}function g(U,Z){return U===Z||U!==U&&Z!==Z}var j="[object Arguments]",S="[object Boolean]",y="[object Date]",_="[object RegExp]",P="[object Map]",x="[object Number]",p="[object Object]",l="[object Set]",c="[object String]",u=Object.prototype.toString;function h(U){var Z=U.areArraysEqual,ae=U.areDatesEqual,C=U.areMapsEqual,E=U.areObjectsEqual,A=U.areRegExpsEqual,T=U.areSetsEqual,$=U.createIsNestedEqual,B=$(ee);function ee(J,re,ue){if(J===re)return!0;if(!J||!re||typeof J!="object"||typeof re!="object")return J!==J&&re!==re;if(o(J)&&o(re))return E(J,re,B,ue);var je=Array.isArray(J),oe=Array.isArray(re);if(je||oe)return je===oe&&Z(J,re,B,ue);var K=u.call(J);return K!==u.call(re)?!1:K===y?ae(J,re,B,ue):K===_?A(J,re,B,ue):K===P?C(J,re,B,ue):K===l?T(J,re,B,ue):K===p||K===j?d(J)||d(re)?!1:E(J,re,B,ue):K===S||K===x||K===c?g(J.valueOf(),re.valueOf()):!1}return ee}function v(U,Z,ae,C){var E=U.length;if(Z.length!==E)return!1;for(;E-- >0;)if(!ae(U[E],Z[E],E,E,U,Z,C))return!1;return!0}var m=a(v);function b(U,Z){return g(U.valueOf(),Z.valueOf())}function f(U,Z,ae,C){var E=U.size===Z.size;if(!E)return!1;if(!U.size)return!0;var A={},T=0;return U.forEach(function($,B){if(E){var ee=!1,J=0;Z.forEach(function(re,ue){!ee&&!A[J]&&(ee=ae(B,ue,T,J,U,Z,C)&&ae($,re,B,ue,U,Z,C))&&(A[J]=!0),J++}),T++,E=ee}}),E}var w=a(f),R="_owner",D=Object.prototype.hasOwnProperty;function O(U,Z,ae,C){var E=Object.keys(U),A=E.length;if(Object.keys(Z).length!==A)return!1;for(var T;A-- >0;){if(T=E[A],T===R){var $=!!U.$$typeof,B=!!Z.$$typeof;if(($||B)&&$!==B)return!1}if(!D.call(Z,T)||!ae(U[T],Z[T],T,T,U,Z,C))return!1}return!0}var k=a(O);function q(U,Z){return U.source===Z.source&&U.flags===Z.flags}function L(U,Z,ae,C){var E=U.size===Z.size;if(!E)return!1;if(!U.size)return!0;var A={};return U.forEach(function(T,$){if(E){var B=!1,ee=0;Z.forEach(function(J,re){!B&&!A[ee]&&(B=ae(T,J,$,re,U,Z,C))&&(A[ee]=!0),ee++}),E=B}}),E}var z=a(L),I=Object.freeze({areArraysEqual:v,areDatesEqual:b,areMapsEqual:f,areObjectsEqual:O,areRegExpsEqual:q,areSetsEqual:L,createIsNestedEqual:s}),M=Object.freeze({areArraysEqual:m,areDatesEqual:b,areMapsEqual:w,areObjectsEqual:k,areRegExpsEqual:q,areSetsEqual:z,createIsNestedEqual:s}),Y=h(I);function G(U,Z){return Y(U,Z,void 0)}var X=h(i(I,{createIsNestedEqual:function(){return g}}));function ne(U,Z){return X(U,Z,void 0)}var se=h(M);function Q(U,Z){return se(U,Z,new WeakMap)}var he=h(i(M,{createIsNestedEqual:function(){return g}}));function W(U,Z){return he(U,Z,new WeakMap)}function ie(U){return h(i(I,U(I)))}function de(U){var Z=h(i(M,U(M)));return(function(ae,C,E){return E===void 0&&(E=new WeakMap),Z(ae,C,E)})}r.circularDeepEqual=Q,r.circularShallowEqual=W,r.createCustomCircularEqual=de,r.createCustomEqual=ie,r.deepEqual=G,r.sameValueZeroEqual=g,r.shallowEqual=ne,Object.defineProperty(r,"__esModule",{value:!0})}))})(Rt,Rt.exports)),Rt.exports}var Ht={exports:{}},Za;function lr(){if(Za)return Ht.exports;Za=1;function t(r){var s,a,i="";if(typeof r=="string"||typeof r=="number")i+=r;else if(typeof r=="object")if(Array.isArray(r)){var o=r.length;for(s=0;s<o;s++)r[s]&&(a=t(r[s]))&&(i&&(i+=" "),i+=a)}else for(a in r)r[a]&&(i&&(i+=" "),i+=a);return i}function n(){for(var r,s,a=0,i="",o=arguments.length;a<o;a++)(r=arguments[a])&&(s=t(r))&&(i&&(i+=" "),i+=s);return i}return Ht.exports=n,Ht.exports.clsx=n,Ht.exports}var le={},Rr,ei;function Id(){return ei||(ei=1,Rr=function(n,r,s){return n===r?!0:n.className===r.className&&s(n.style,r.style)&&n.width===r.width&&n.autoSize===r.autoSize&&n.cols===r.cols&&n.draggableCancel===r.draggableCancel&&n.draggableHandle===r.draggableHandle&&s(n.verticalCompact,r.verticalCompact)&&s(n.compactType,r.compactType)&&s(n.layout,r.layout)&&s(n.margin,r.margin)&&s(n.containerPadding,r.containerPadding)&&n.rowHeight===r.rowHeight&&n.maxRows===r.maxRows&&n.isBounded===r.isBounded&&n.isDraggable===r.isDraggable&&n.isResizable===r.isResizable&&n.allowOverlap===r.allowOverlap&&n.preventCollision===r.preventCollision&&n.useCSSTransforms===r.useCSSTransforms&&n.transformScale===r.transformScale&&n.isDroppable===r.isDroppable&&s(n.resizeHandles,r.resizeHandles)&&s(n.resizeHandle,r.resizeHandle)&&n.onLayoutChange===r.onLayoutChange&&n.onDragStart===r.onDragStart&&n.onDrag===r.onDrag&&n.onDragStop===r.onDragStop&&n.onResizeStart===r.onResizeStart&&n.onResize===r.onResize&&n.onResizeStop===r.onResizeStop&&n.onDrop===r.onDrop&&s(n.droppingItem,r.droppingItem)&&s(n.innerRef,r.innerRef)}),Rr}var ti;function ht(){if(ti)return le;ti=1,Object.defineProperty(le,"__esModule",{value:!0}),le.bottom=s,le.childrenEqual=g,le.cloneLayout=a,le.cloneLayoutItem=d,le.collides=S,le.compact=y,le.compactItem=x,le.compactType=U,le.correctBounds=p,le.fastPositionEqual=j,le.fastRGLPropsEqual=void 0,le.getAllCollisions=u,le.getFirstCollision=c,le.getLayoutItem=l,le.getStatics=h,le.modifyLayout=i,le.moveElement=v,le.moveElementAwayFromCollision=m,le.noop=void 0,le.perc=b,le.resizeItemInDirection=X,le.setTopLeft=se,le.setTransform=ne,le.sortLayoutItems=Q,le.sortLayoutItemsByColRow=W,le.sortLayoutItemsByRowCol=he,le.synchronizeLayoutWithChildren=ie,le.validateLayout=de,le.withLayoutItem=o;var t=ja(),n=r(Pe());function r(C){return C&&C.__esModule?C:{default:C}}function s(C){let E=0,A;for(let T=0,$=C.length;T<$;T++)A=C[T].y+C[T].h,A>E&&(E=A);return E}function a(C){const E=Array(C.length);for(let A=0,T=C.length;A<T;A++)E[A]=d(C[A]);return E}function i(C,E){const A=Array(C.length);for(let T=0,$=C.length;T<$;T++)E.i===C[T].i?A[T]=E:A[T]=C[T];return A}function o(C,E,A){let T=l(C,E);return T?(T=A(d(T)),C=i(C,T),[C,T]):[C,null]}function d(C){return{w:C.w,h:C.h,x:C.x,y:C.y,i:C.i,minW:C.minW,maxW:C.maxW,minH:C.minH,maxH:C.maxH,moved:!!C.moved,static:!!C.static,isDraggable:C.isDraggable,isResizable:C.isResizable,resizeHandles:C.resizeHandles,isBounded:C.isBounded}}function g(C,E){return(0,t.deepEqual)(n.default.Children.map(C,A=>A?.key),n.default.Children.map(E,A=>A?.key))&&(0,t.deepEqual)(n.default.Children.map(C,A=>A?.props["data-grid"]),n.default.Children.map(E,A=>A?.props["data-grid"]))}le.fastRGLPropsEqual=Id();function j(C,E){return C.left===E.left&&C.top===E.top&&C.width===E.width&&C.height===E.height}function S(C,E){return!(C.i===E.i||C.x+C.w<=E.x||C.x>=E.x+E.w||C.y+C.h<=E.y||C.y>=E.y+E.h)}function y(C,E,A,T){const $=h(C),B=Q(C,E),ee=Array(C.length);for(let J=0,re=B.length;J<re;J++){let ue=d(B[J]);ue.static||(ue=x($,ue,E,A,B,T),$.push(ue)),ee[C.indexOf(B[J])]=ue,ue.moved=!1}return ee}const _={x:"w",y:"h"};function P(C,E,A,T){const $=_[T];E[T]+=1;const B=C.map(ee=>ee.i).indexOf(E.i);for(let ee=B+1;ee<C.length;ee++){const J=C[ee];if(!J.static){if(J.y>E.y+E.h)break;S(E,J)&&P(C,J,A+E[$],T)}}E[T]=A}function x(C,E,A,T,$,B){const ee=A==="vertical",J=A==="horizontal";if(ee)for(E.y=Math.min(s(C),E.y);E.y>0&&!c(C,E);)E.y--;else if(J)for(;E.x>0&&!c(C,E);)E.x--;let re;for(;(re=c(C,E))&&!(A===null&&B);)if(J?P($,E,re.x+re.w,"x"):P($,E,re.y+re.h,"y"),J&&E.x+E.w>T)for(E.x=T-E.w,E.y++;E.x>0&&!c(C,E);)E.x--;return E.y=Math.max(E.y,0),E.x=Math.max(E.x,0),E}function p(C,E){const A=h(C);for(let T=0,$=C.length;T<$;T++){const B=C[T];if(B.x+B.w>E.cols&&(B.x=E.cols-B.w),B.x<0&&(B.x=0,B.w=E.cols),!B.static)A.push(B);else for(;c(A,B);)B.y++}return C}function l(C,E){for(let A=0,T=C.length;A<T;A++)if(C[A].i===E)return C[A]}function c(C,E){for(let A=0,T=C.length;A<T;A++)if(S(C[A],E))return C[A]}function u(C,E){return C.filter(A=>S(A,E))}function h(C){return C.filter(E=>E.static)}function v(C,E,A,T,$,B,ee,J,re){if(E.static&&E.isDraggable!==!0||E.y===T&&E.x===A)return C;`${E.i}${String(A)}${String(T)}${E.x}${E.y}`;const ue=E.x,je=E.y;typeof A=="number"&&(E.x=A),typeof T=="number"&&(E.y=T),E.moved=!0;let oe=Q(C,ee);(ee==="vertical"&&typeof T=="number"?je>=T:ee==="horizontal"&&typeof A=="number"&&ue>=A)&&(oe=oe.reverse());const fe=u(oe,E),Ie=fe.length>0;if(Ie&&re)return a(C);if(Ie&&B)return`${E.i}`,E.x=ue,E.y=je,E.moved=!1,C;for(let ft=0,yr=fe.length;ft<yr;ft++){const ke=fe[ft];`${E.i}${E.x}${E.y}${ke.i}${ke.x}${ke.y}`,!ke.moved&&(ke.static?C=m(C,ke,E,$,ee):C=m(C,E,ke,$,ee))}return C}function m(C,E,A,T,$,B){const ee=$==="horizontal",J=$==="vertical",re=E.static;if(T){T=!1;const oe={x:ee?Math.max(E.x-A.w,0):A.x,y:J?Math.max(E.y-A.h,0):A.y,w:A.w,h:A.h,i:"-1"},K=c(C,oe),fe=K&&K.y+K.h>E.y,Ie=K&&E.x+E.w>K.x;if(K){if(fe&&J)return v(C,A,void 0,E.y+1,T,re,$);if(fe&&$==null)return E.y=A.y,A.y=A.y+A.h,C;if(Ie&&ee)return v(C,E,A.x,void 0,T,re,$)}else return`${A.i}${oe.x}${oe.y}`,v(C,A,ee?oe.x:void 0,J?oe.y:void 0,T,re,$)}const ue=ee?A.x+1:void 0,je=J?A.y+1:void 0;return ue==null&&je==null?C:v(C,A,ee?A.x+1:void 0,J?A.y+1:void 0,T,re,$)}function b(C){return C*100+"%"}const f=(C,E,A,T)=>C+A>T?E:A,w=(C,E,A)=>C<0?E:A,R=C=>Math.max(0,C),D=C=>Math.max(0,C),O=(C,E,A)=>{let{left:T,height:$,width:B}=E;const ee=C.top-($-C.height);return{left:T,width:B,height:w(ee,C.height,$),top:D(ee)}},k=(C,E,A)=>{let{top:T,left:$,height:B,width:ee}=E;return{top:T,height:B,width:f(C.left,C.width,ee,A),left:R($)}},q=(C,E,A)=>{let{top:T,height:$,width:B}=E;const ee=C.left-(B-C.width);return{height:$,width:ee<0?C.width:f(C.left,C.width,B,A),top:D(T),left:R(ee)}},L=(C,E,A)=>{let{top:T,left:$,height:B,width:ee}=E;return{width:ee,left:$,height:w(T,C.height,B),top:D(T)}},G={n:O,ne:function(){return O(arguments.length<=0?void 0:arguments[0],k(...arguments))},e:k,se:function(){return L(arguments.length<=0?void 0:arguments[0],k(...arguments))},s:L,sw:function(){return L(arguments.length<=0?void 0:arguments[0],q(...arguments))},w:q,nw:function(){return O(arguments.length<=0?void 0:arguments[0],q(...arguments))}};function X(C,E,A,T){const $=G[C];return $?$(E,{...E,...A},T):A}function ne(C){let{top:E,left:A,width:T,height:$}=C;const B=`translate(${A}px,${E}px)`;return{transform:B,WebkitTransform:B,MozTransform:B,msTransform:B,OTransform:B,width:`${T}px`,height:`${$}px`,position:"absolute"}}function se(C){let{top:E,left:A,width:T,height:$}=C;return{top:`${E}px`,left:`${A}px`,width:`${T}px`,height:`${$}px`,position:"absolute"}}function Q(C,E){return E==="horizontal"?W(C):E==="vertical"?he(C):C}function he(C){return C.slice(0).sort(function(E,A){return E.y>A.y||E.y===A.y&&E.x>A.x?1:E.y===A.y&&E.x===A.x?0:-1})}function W(C){return C.slice(0).sort(function(E,A){return E.x>A.x||E.x===A.x&&E.y>A.y?1:-1})}function ie(C,E,A,T,$){C=C||[];const B=[];n.default.Children.forEach(E,J=>{if(J?.key==null)return;const re=l(C,String(J.key)),ue=J.props["data-grid"];re&&ue==null?B.push(d(re)):ue?B.push(d({...ue,i:J.key})):B.push(d({w:1,h:1,x:0,y:s(B),i:String(J.key)}))});const ee=p(B,{cols:A});return $?ee:y(ee,T,A)}function de(C){let E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Layout";const A=["x","y","w","h"];if(!Array.isArray(C))throw new Error(E+" must be an array!");for(let T=0,$=C.length;T<$;T++){const B=C[T];for(let ee=0;ee<A.length;ee++){const J=A[ee],re=B[J];if(typeof re!="number"||Number.isNaN(re))throw new Error(`ReactGridLayout: ${E}[${T}].${J} must be a number! Received: ${re} (${typeof re})`)}if(typeof B.i<"u"&&typeof B.i!="string")throw new Error(`ReactGridLayout: ${E}[${T}].i must be a string! Received: ${B.i} (${typeof B.i})`)}}function U(C){const{verticalCompact:E,compactType:A}=C||{};return E===!1?null:A}function Z(){}const ae=()=>{};return le.noop=ae,le}var Te={},ri;function wa(){if(ri)return Te;ri=1,Object.defineProperty(Te,"__esModule",{value:!0}),Te.calcGridColWidth=t,Te.calcGridItemPosition=r,Te.calcGridItemWHPx=n,Te.calcWH=a,Te.calcXY=s,Te.clamp=i;function t(o){const{margin:d,containerPadding:g,containerWidth:j,cols:S}=o;return(j-d[0]*(S-1)-g[0]*2)/S}function n(o,d,g){return Number.isFinite(o)?Math.round(d*o+Math.max(0,o-1)*g):o}function r(o,d,g,j,S,y){const{margin:_,containerPadding:P,rowHeight:x}=o,p=t(o),l={};return y&&y.resizing?(l.width=Math.round(y.resizing.width),l.height=Math.round(y.resizing.height)):(l.width=n(j,p,_[0]),l.height=n(S,x,_[1])),y&&y.dragging?(l.top=Math.round(y.dragging.top),l.left=Math.round(y.dragging.left)):y&&y.resizing&&typeof y.resizing.top=="number"&&typeof y.resizing.left=="number"?(l.top=Math.round(y.resizing.top),l.left=Math.round(y.resizing.left)):(l.top=Math.round((x+_[1])*g+P[1]),l.left=Math.round((p+_[0])*d+P[0])),l}function s(o,d,g,j,S){const{margin:y,containerPadding:_,cols:P,rowHeight:x,maxRows:p}=o,l=t(o);let c=Math.round((g-_[0])/(l+y[0])),u=Math.round((d-_[1])/(x+y[1]));return c=i(c,0,P-j),u=i(u,0,p-S),{x:c,y:u}}function a(o,d,g,j,S,y){const{margin:_,maxRows:P,cols:x,rowHeight:p}=o,l=t(o);let c=Math.round((d+_[0])/(l+_[0])),u=Math.round((g+_[1])/(p+_[1])),h=i(c,0,x-j),v=i(u,0,P-S);return["sw","w","nw"].indexOf(y)!==-1&&(h=i(c,0,x)),["nw","n","ne"].indexOf(y)!==-1&&(v=i(u,0,P)),{w:h,h:v}}function i(o,d,g){return Math.max(Math.min(o,g),d)}return Te}var gt={},Nr={exports:{}},Pr,ni;function Hd(){if(ni)return Pr;ni=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Pr=t,Pr}var Er,si;function Wd(){if(si)return Er;si=1;var t=Hd();function n(){}function r(){}return r.resetWarningCache=n,Er=function(){function s(o,d,g,j,S,y){if(y!==t){var _=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 _.name="Invariant Violation",_}}s.isRequired=s;function a(){return s}var i={array:s,bigint:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:a,element:s,elementType:s,instanceOf:a,node:s,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:r,resetWarningCache:n};return i.PropTypes=i,i},Er}var ai;function Ye(){return ai||(ai=1,Nr.exports=Wd()()),Nr.exports}var vt={exports:{}},Or={},pe={},We={},ii;function cr(){if(ii)return We;ii=1,Object.defineProperty(We,"__esModule",{value:!0}),We.dontSetMe=a,We.findInArray=t,We.int=s,We.isFunction=n,We.isNum=r;function t(i,o){for(let d=0,g=i.length;d<g;d++)if(o.apply(o,[i[d],d,i]))return i[d]}function n(i){return typeof i=="function"||Object.prototype.toString.call(i)==="[object Function]"}function r(i){return typeof i=="number"&&!isNaN(i)}function s(i){return parseInt(i,10)}function a(i,o,d){if(i[o])return new Error(`Invalid prop ${o} passed to ${d} - do not set this, set it on the child.`)}return We}var Ue={},oi;function Ud(){if(oi)return Ue;oi=1,Object.defineProperty(Ue,"__esModule",{value:!0}),Ue.browserPrefixToKey=r,Ue.browserPrefixToStyle=s,Ue.default=void 0,Ue.getPrefix=n;const t=["Moz","Webkit","O","ms"];function n(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"transform";if(typeof window>"u")return"";const o=window.document?.documentElement?.style;if(!o||i in o)return"";for(let d=0;d<t.length;d++)if(r(i,t[d])in o)return t[d];return""}function r(i,o){return o?`${o}${a(i)}`:i}function s(i,o){return o?`-${o.toLowerCase()}-${i}`:i}function a(i){let o="",d=!0;for(let g=0;g<i.length;g++)d?(o+=i[g].toUpperCase(),d=!1):i[g]==="-"?d=!0:o+=i[g];return o}return Ue.default=n(),Ue}var li;function _a(){if(li)return pe;li=1,Object.defineProperty(pe,"__esModule",{value:!0}),pe.addClassName=m,pe.addEvent=o,pe.addUserSelectStyles=u,pe.createCSSTransform=P,pe.createSVGTransform=x,pe.getTouch=l,pe.getTouchIdentifier=c,pe.getTranslation=p,pe.innerHeight=S,pe.innerWidth=y,pe.matchesSelector=a,pe.matchesSelectorAndParentsTo=i,pe.offsetXYFromParent=_,pe.outerHeight=g,pe.outerWidth=j,pe.removeClassName=b,pe.removeEvent=d,pe.scheduleRemoveUserSelectStyles=h;var t=cr(),n=r(Ud());function r(f,w){if(typeof WeakMap=="function")var R=new WeakMap,D=new WeakMap;return(r=function(O,k){if(!k&&O&&O.__esModule)return O;var q,L,z={__proto__:null,default:O};if(O===null||typeof O!="object"&&typeof O!="function")return z;if(q=k?D:R){if(q.has(O))return q.get(O);q.set(O,z)}for(const I in O)I!=="default"&&{}.hasOwnProperty.call(O,I)&&((L=(q=Object.defineProperty)&&Object.getOwnPropertyDescriptor(O,I))&&(L.get||L.set)?q(z,I,L):z[I]=O[I]);return z})(f,w)}let s="";function a(f,w){return s||(s=(0,t.findInArray)(["matches","webkitMatchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector"],function(R){return(0,t.isFunction)(f[R])})),(0,t.isFunction)(f[s])?f[s](w):!1}function i(f,w,R){let D=f;do{if(a(D,w))return!0;if(D===R)return!1;D=D.parentNode}while(D);return!1}function o(f,w,R,D){if(!f)return;const O={capture:!0,...D};f.addEventListener?f.addEventListener(w,R,O):f.attachEvent?f.attachEvent("on"+w,R):f["on"+w]=R}function d(f,w,R,D){if(!f)return;const O={capture:!0,...D};f.removeEventListener?f.removeEventListener(w,R,O):f.detachEvent?f.detachEvent("on"+w,R):f["on"+w]=null}function g(f){let w=f.clientHeight;const R=f.ownerDocument.defaultView.getComputedStyle(f);return w+=(0,t.int)(R.borderTopWidth),w+=(0,t.int)(R.borderBottomWidth),w}function j(f){let w=f.clientWidth;const R=f.ownerDocument.defaultView.getComputedStyle(f);return w+=(0,t.int)(R.borderLeftWidth),w+=(0,t.int)(R.borderRightWidth),w}function S(f){let w=f.clientHeight;const R=f.ownerDocument.defaultView.getComputedStyle(f);return w-=(0,t.int)(R.paddingTop),w-=(0,t.int)(R.paddingBottom),w}function y(f){let w=f.clientWidth;const R=f.ownerDocument.defaultView.getComputedStyle(f);return w-=(0,t.int)(R.paddingLeft),w-=(0,t.int)(R.paddingRight),w}function _(f,w,R){const O=w===w.ownerDocument.body?{left:0,top:0}:w.getBoundingClientRect(),k=(f.clientX+w.scrollLeft-O.left)/R,q=(f.clientY+w.scrollTop-O.top)/R;return{x:k,y:q}}function P(f,w){const R=p(f,w,"px");return{[(0,n.browserPrefixToKey)("transform",n.default)]:R}}function x(f,w){return p(f,w,"")}function p(f,w,R){let{x:D,y:O}=f,k=`translate(${D}${R},${O}${R})`;if(w){const q=`${typeof w.x=="string"?w.x:w.x+R}`,L=`${typeof w.y=="string"?w.y:w.y+R}`;k=`translate(${q}, ${L})`+k}return k}function l(f,w){return f.targetTouches&&(0,t.findInArray)(f.targetTouches,R=>w===R.identifier)||f.changedTouches&&(0,t.findInArray)(f.changedTouches,R=>w===R.identifier)}function c(f){if(f.targetTouches&&f.targetTouches[0])return f.targetTouches[0].identifier;if(f.changedTouches&&f.changedTouches[0])return f.changedTouches[0].identifier}function u(f){if(!f)return;let w=f.getElementById("react-draggable-style-el");w||(w=f.createElement("style"),w.type="text/css",w.id="react-draggable-style-el",w.innerHTML=`.react-draggable-transparent-selection *::-moz-selection {all: inherit;}
3
3
  `,w.innerHTML+=`.react-draggable-transparent-selection *::selection {all: inherit;}
4
- `,f.getElementsByTagName("head")[0].appendChild(w)),f.body&&m(f.body,"react-draggable-transparent-selection")}function h(f){window.requestAnimationFrame?window.requestAnimationFrame(()=>{v(f)}):v(f)}function v(f){if(f)try{if(f.body&&b(f.body,"react-draggable-transparent-selection"),f.selection)f.selection.empty();else{const w=(f.defaultView||window).getSelection();w&&w.type!=="Caret"&&w.removeAllRanges()}}catch{}}function m(f,w){f.classList?f.classList.add(w):f.className.match(new RegExp(`(?:^|\\s)${w}(?!\\S)`))||(f.className+=` ${w}`)}function b(f,w){f.classList?f.classList.remove(w):f.className=f.className.replace(new RegExp(`(?:^|\\s)${w}(?!\\S)`,"g"),"")}return pe}var Ee={},ci;function Cc(){if(ci)return Ee;ci=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.canDragX=a,Ee.canDragY=i,Ee.createCoreData=d,Ee.createDraggableData=g,Ee.getBoundPosition=r,Ee.getControlPosition=o,Ee.snapToGrid=s;var t=cr(),n=_a();function r(y,_,P){if(!y.props.bounds)return[_,P];let{bounds:x}=y.props;x=typeof x=="string"?x:j(x);const p=S(y);if(typeof x=="string"){const{ownerDocument:l}=p,c=l.defaultView;let u;if(x==="parent"?u=p.parentNode:u=p.getRootNode().querySelector(x),!(u instanceof c.HTMLElement))throw new Error('Bounds selector "'+x+'" could not find an element.');const h=u,v=c.getComputedStyle(p),m=c.getComputedStyle(h);x={left:-p.offsetLeft+(0,t.int)(m.paddingLeft)+(0,t.int)(v.marginLeft),top:-p.offsetTop+(0,t.int)(m.paddingTop)+(0,t.int)(v.marginTop),right:(0,n.innerWidth)(h)-(0,n.outerWidth)(p)-p.offsetLeft+(0,t.int)(m.paddingRight)-(0,t.int)(v.marginRight),bottom:(0,n.innerHeight)(h)-(0,n.outerHeight)(p)-p.offsetTop+(0,t.int)(m.paddingBottom)-(0,t.int)(v.marginBottom)}}return(0,t.isNum)(x.right)&&(_=Math.min(_,x.right)),(0,t.isNum)(x.bottom)&&(P=Math.min(P,x.bottom)),(0,t.isNum)(x.left)&&(_=Math.max(_,x.left)),(0,t.isNum)(x.top)&&(P=Math.max(P,x.top)),[_,P]}function s(y,_,P){const x=Math.round(_/y[0])*y[0],p=Math.round(P/y[1])*y[1];return[x,p]}function a(y){return y.props.axis==="both"||y.props.axis==="x"}function i(y){return y.props.axis==="both"||y.props.axis==="y"}function o(y,_,P){const x=typeof _=="number"?(0,n.getTouch)(y,_):null;if(typeof _=="number"&&!x)return null;const p=S(P),l=P.props.offsetParent||p.offsetParent||p.ownerDocument.body;return(0,n.offsetXYFromParent)(x||y,l,P.props.scale)}function d(y,_,P){const x=!(0,t.isNum)(y.lastX),p=S(y);return x?{node:p,deltaX:0,deltaY:0,lastX:_,lastY:P,x:_,y:P}:{node:p,deltaX:_-y.lastX,deltaY:P-y.lastY,lastX:y.lastX,lastY:y.lastY,x:_,y:P}}function g(y,_){const P=y.props.scale;return{node:_.node,x:y.state.x+_.deltaX/P,y:y.state.y+_.deltaY/P,deltaX:_.deltaX/P,deltaY:_.deltaY/P,lastX:y.state.x,lastY:y.state.y}}function j(y){return{left:y.left,top:y.top,right:y.right,bottom:y.bottom}}function S(y){const _=y.findDOMNode();if(!_)throw new Error("<DraggableCore>: Unmounted during event!");return _}return Ee}var yt={},Wt={},ui;function Rc(){if(ui)return Wt;ui=1,Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.default=t;function t(){}return Wt}var di;function Bd(){if(di)return yt;di=1,Object.defineProperty(yt,"__esModule",{value:!0}),yt.default=void 0;var t=g(Pe()),n=d(Ye()),r=d(va()),s=_a(),a=Cc(),i=cr(),o=d(Rc());function d(p){return p&&p.__esModule?p:{default:p}}function g(p,l){if(typeof WeakMap=="function")var c=new WeakMap,u=new WeakMap;return(g=function(h,v){if(!v&&h&&h.__esModule)return h;var m,b,f={__proto__:null,default:h};if(h===null||typeof h!="object"&&typeof h!="function")return f;if(m=v?u:c){if(m.has(h))return m.get(h);m.set(h,f)}for(const w in h)w!=="default"&&{}.hasOwnProperty.call(h,w)&&((b=(m=Object.defineProperty)&&Object.getOwnPropertyDescriptor(h,w))&&(b.get||b.set)?m(f,w,b):f[w]=h[w]);return f})(p,l)}function j(p,l,c){return(l=S(l))in p?Object.defineProperty(p,l,{value:c,enumerable:!0,configurable:!0,writable:!0}):p[l]=c,p}function S(p){var l=y(p,"string");return typeof l=="symbol"?l:l+""}function y(p,l){if(typeof p!="object"||!p)return p;var c=p[Symbol.toPrimitive];if(c!==void 0){var u=c.call(p,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(p)}const _={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let P=_.mouse,x=class extends t.Component{constructor(){super(...arguments),j(this,"dragging",!1),j(this,"lastX",NaN),j(this,"lastY",NaN),j(this,"touchIdentifier",null),j(this,"mounted",!1),j(this,"handleDragStart",l=>{if(this.props.onMouseDown(l),!this.props.allowAnyClick&&typeof l.button=="number"&&l.button!==0)return!1;const c=this.findDOMNode();if(!c||!c.ownerDocument||!c.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:u}=c;if(this.props.disabled||!(l.target instanceof u.defaultView.Node)||this.props.handle&&!(0,s.matchesSelectorAndParentsTo)(l.target,this.props.handle,c)||this.props.cancel&&(0,s.matchesSelectorAndParentsTo)(l.target,this.props.cancel,c))return;l.type==="touchstart"&&!this.props.allowMobileScroll&&l.preventDefault();const h=(0,s.getTouchIdentifier)(l);this.touchIdentifier=h;const v=(0,a.getControlPosition)(l,h,this);if(v==null)return;const{x:m,y:b}=v,f=(0,a.createCoreData)(this,m,b);(0,o.default)("DraggableCore: handleDragStart: %j",f),(0,o.default)("calling",this.props.onStart),!(this.props.onStart(l,f)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,s.addUserSelectStyles)(u),this.dragging=!0,this.lastX=m,this.lastY=b,(0,s.addEvent)(u,P.move,this.handleDrag),(0,s.addEvent)(u,P.stop,this.handleDragStop))}),j(this,"handleDrag",l=>{const c=(0,a.getControlPosition)(l,this.touchIdentifier,this);if(c==null)return;let{x:u,y:h}=c;if(Array.isArray(this.props.grid)){let b=u-this.lastX,f=h-this.lastY;if([b,f]=(0,a.snapToGrid)(this.props.grid,b,f),!b&&!f)return;u=this.lastX+b,h=this.lastY+f}const v=(0,a.createCoreData)(this,u,h);if((0,o.default)("DraggableCore: handleDrag: %j",v),this.props.onDrag(l,v)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const f=document.createEvent("MouseEvents");f.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(f)}return}this.lastX=u,this.lastY=h}),j(this,"handleDragStop",l=>{if(!this.dragging)return;const c=(0,a.getControlPosition)(l,this.touchIdentifier,this);if(c==null)return;let{x:u,y:h}=c;if(Array.isArray(this.props.grid)){let f=u-this.lastX||0,w=h-this.lastY||0;[f,w]=(0,a.snapToGrid)(this.props.grid,f,w),u=this.lastX+f,h=this.lastY+w}const v=(0,a.createCoreData)(this,u,h);if(this.props.onStop(l,v)===!1||this.mounted===!1)return!1;const b=this.findDOMNode();b&&this.props.enableUserSelectHack&&(0,s.scheduleRemoveUserSelectStyles)(b.ownerDocument),(0,o.default)("DraggableCore: handleDragStop: %j",v),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,b&&((0,o.default)("DraggableCore: Removing handlers"),(0,s.removeEvent)(b.ownerDocument,P.move,this.handleDrag),(0,s.removeEvent)(b.ownerDocument,P.stop,this.handleDragStop))}),j(this,"onMouseDown",l=>(P=_.mouse,this.handleDragStart(l))),j(this,"onMouseUp",l=>(P=_.mouse,this.handleDragStop(l))),j(this,"onTouchStart",l=>(P=_.touch,this.handleDragStart(l))),j(this,"onTouchEnd",l=>(P=_.touch,this.handleDragStop(l)))}componentDidMount(){this.mounted=!0;const l=this.findDOMNode();l&&(0,s.addEvent)(l,_.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const l=this.findDOMNode();if(l){const{ownerDocument:c}=l;(0,s.removeEvent)(c,_.mouse.move,this.handleDrag),(0,s.removeEvent)(c,_.touch.move,this.handleDrag),(0,s.removeEvent)(c,_.mouse.stop,this.handleDragStop),(0,s.removeEvent)(c,_.touch.stop,this.handleDragStop),(0,s.removeEvent)(l,_.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,s.scheduleRemoveUserSelectStyles)(c)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:r.default.findDOMNode(this)}render(){return t.cloneElement(t.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return yt.default=x,j(x,"displayName","DraggableCore"),j(x,"propTypes",{allowAnyClick:n.default.bool,allowMobileScroll:n.default.bool,children:n.default.node.isRequired,disabled:n.default.bool,enableUserSelectHack:n.default.bool,offsetParent:function(p,l){if(p[l]&&p[l].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:n.default.arrayOf(n.default.number),handle:n.default.string,cancel:n.default.string,nodeRef:n.default.object,onStart:n.default.func,onDrag:n.default.func,onStop:n.default.func,onMouseDown:n.default.func,scale:n.default.number,className:i.dontSetMe,style:i.dontSetMe,transform:i.dontSetMe}),j(x,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),yt}var hi;function Fd(){return hi||(hi=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return g.default}}),t.default=void 0;var n=y(Pe()),r=S(Ye()),s=S(va()),a=lr(),i=_a(),o=Cc(),d=cr(),g=S(Bd()),j=S(Rc());function S(c){return c&&c.__esModule?c:{default:c}}function y(c,u){if(typeof WeakMap=="function")var h=new WeakMap,v=new WeakMap;return(y=function(m,b){if(!b&&m&&m.__esModule)return m;var f,w,R={__proto__:null,default:m};if(m===null||typeof m!="object"&&typeof m!="function")return R;if(f=b?v:h){if(f.has(m))return f.get(m);f.set(m,R)}for(const D in m)D!=="default"&&{}.hasOwnProperty.call(m,D)&&((w=(f=Object.defineProperty)&&Object.getOwnPropertyDescriptor(m,D))&&(w.get||w.set)?f(R,D,w):R[D]=m[D]);return R})(c,u)}function _(){return _=Object.assign?Object.assign.bind():function(c){for(var u=1;u<arguments.length;u++){var h=arguments[u];for(var v in h)({}).hasOwnProperty.call(h,v)&&(c[v]=h[v])}return c},_.apply(null,arguments)}function P(c,u,h){return(u=x(u))in c?Object.defineProperty(c,u,{value:h,enumerable:!0,configurable:!0,writable:!0}):c[u]=h,c}function x(c){var u=p(c,"string");return typeof u=="symbol"?u:u+""}function p(c,u){if(typeof c!="object"||!c)return c;var h=c[Symbol.toPrimitive];if(h!==void 0){var v=h.call(c,u);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(c)}class l extends n.Component{static getDerivedStateFromProps(u,h){let{position:v}=u,{prevPropsPosition:m}=h;return v&&(!m||v.x!==m.x||v.y!==m.y)?((0,j.default)("Draggable: getDerivedStateFromProps %j",{position:v,prevPropsPosition:m}),{x:v.x,y:v.y,prevPropsPosition:{...v}}):null}constructor(u){super(u),P(this,"onDragStart",(h,v)=>{if((0,j.default)("Draggable: onDragStart: %j",v),this.props.onStart(h,(0,o.createDraggableData)(this,v))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),P(this,"onDrag",(h,v)=>{if(!this.state.dragging)return!1;(0,j.default)("Draggable: onDrag: %j",v);const m=(0,o.createDraggableData)(this,v),b={x:m.x,y:m.y,slackX:0,slackY:0};if(this.props.bounds){const{x:w,y:R}=b;b.x+=this.state.slackX,b.y+=this.state.slackY;const[D,O]=(0,o.getBoundPosition)(this,b.x,b.y);b.x=D,b.y=O,b.slackX=this.state.slackX+(w-b.x),b.slackY=this.state.slackY+(R-b.y),m.x=b.x,m.y=b.y,m.deltaX=b.x-this.state.x,m.deltaY=b.y-this.state.y}if(this.props.onDrag(h,m)===!1)return!1;this.setState(b)}),P(this,"onDragStop",(h,v)=>{if(!this.state.dragging||this.props.onStop(h,(0,o.createDraggableData)(this,v))===!1)return!1;(0,j.default)("Draggable: onDragStop: %j",v);const b={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:w,y:R}=this.props.position;b.x=w,b.y=R}this.setState(b)}),this.state={dragging:!1,dragged:!1,x:u.position?u.position.x:u.defaultPosition.x,y:u.position?u.position.y:u.defaultPosition.y,prevPropsPosition:{...u.position},slackX:0,slackY:0,isElementSVG:!1},u.position&&!(u.onDrag||u.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){return this.props?.nodeRef?.current??s.default.findDOMNode(this)}render(){const{axis:u,bounds:h,children:v,defaultPosition:m,defaultClassName:b,defaultClassNameDragging:f,defaultClassNameDragged:w,position:R,positionOffset:D,scale:O,...k}=this.props;let q={},L=null;const I=!!!R||this.state.dragging,M=R||m,Y={x:(0,o.canDragX)(this)&&I?this.state.x:M.x,y:(0,o.canDragY)(this)&&I?this.state.y:M.y};this.state.isElementSVG?L=(0,i.createSVGTransform)(Y,D):q=(0,i.createCSSTransform)(Y,D);const G=(0,a.clsx)(v.props.className||"",b,{[f]:this.state.dragging,[w]:this.state.dragged});return n.createElement(g.default,_({},k,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),n.cloneElement(n.Children.only(v),{className:G,style:{...v.props.style,...q},transform:L}))}}t.default=l,P(l,"displayName","Draggable"),P(l,"propTypes",{...g.default.propTypes,axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:d.dontSetMe,style:d.dontSetMe,transform:d.dontSetMe}),P(l,"defaultProps",{...g.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(Or)),Or}var fi;function Sa(){if(fi)return vt.exports;fi=1;const{default:t,DraggableCore:n}=Fd();return vt.exports=t,vt.exports.default=t,vt.exports.DraggableCore=n,vt.exports}var xt={exports:{}},bt={},Ut={},pi;function Gd(){if(pi)return Ut;pi=1,Ut.__esModule=!0,Ut.cloneElement=d;var t=n(Pe());function n(g){return g&&g.__esModule?g:{default:g}}function r(g,j){var S=Object.keys(g);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(g);j&&(y=y.filter(function(_){return Object.getOwnPropertyDescriptor(g,_).enumerable})),S.push.apply(S,y)}return S}function s(g){for(var j=1;j<arguments.length;j++){var S=arguments[j]!=null?arguments[j]:{};j%2?r(Object(S),!0).forEach(function(y){a(g,y,S[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(S)):r(Object(S)).forEach(function(y){Object.defineProperty(g,y,Object.getOwnPropertyDescriptor(S,y))})}return g}function a(g,j,S){return j=i(j),j in g?Object.defineProperty(g,j,{value:S,enumerable:!0,configurable:!0,writable:!0}):g[j]=S,g}function i(g){var j=o(g,"string");return typeof j=="symbol"?j:String(j)}function o(g,j){if(typeof g!="object"||g===null)return g;var S=g[Symbol.toPrimitive];if(S!==void 0){var y=S.call(g,j);if(typeof y!="object")return y;throw new TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(g)}function d(g,j){return j.style&&g.props.style&&(j.style=s(s({},g.props.style),j.style)),j.className&&g.props.className&&(j.className=g.props.className+" "+j.className),t.default.cloneElement(g,j)}return Ut}var jt={},mi;function Nc(){if(mi)return jt;mi=1,jt.__esModule=!0,jt.resizableProps=void 0;var t=n(Ye());Sa();function n(s){return s&&s.__esModule?s:{default:s}}var r={axis:t.default.oneOf(["both","x","y","none"]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:t.default.node,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];var d=i[0];if(d.axis==="both"||d.axis==="y"){var g;return(g=t.default.number).isRequired.apply(g,i)}return t.default.number.apply(t.default,i)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:t.default.number,width:function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];var d=i[0];if(d.axis==="both"||d.axis==="x"){var g;return(g=t.default.number).isRequired.apply(g,i)}return t.default.number.apply(t.default,i)}};return jt.resizableProps=r,jt}var gi;function Pc(){if(gi)return bt;gi=1,bt.__esModule=!0,bt.default=void 0;var t=o(Pe()),n=Sa(),r=Gd(),s=Nc(),a=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function i(c){if(typeof WeakMap!="function")return null;var u=new WeakMap,h=new WeakMap;return(i=function(m){return m?h:u})(c)}function o(c,u){if(c&&c.__esModule)return c;if(c===null||typeof c!="object"&&typeof c!="function")return{default:c};var h=i(u);if(h&&h.has(c))return h.get(c);var v={},m=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var b in c)if(b!=="default"&&Object.prototype.hasOwnProperty.call(c,b)){var f=m?Object.getOwnPropertyDescriptor(c,b):null;f&&(f.get||f.set)?Object.defineProperty(v,b,f):v[b]=c[b]}return v.default=c,h&&h.set(c,v),v}function d(){return d=Object.assign?Object.assign.bind():function(c){for(var u=1;u<arguments.length;u++){var h=arguments[u];for(var v in h)Object.prototype.hasOwnProperty.call(h,v)&&(c[v]=h[v])}return c},d.apply(this,arguments)}function g(c,u){if(c==null)return{};var h={},v=Object.keys(c),m,b;for(b=0;b<v.length;b++)m=v[b],!(u.indexOf(m)>=0)&&(h[m]=c[m]);return h}function j(c,u){var h=Object.keys(c);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(c);u&&(v=v.filter(function(m){return Object.getOwnPropertyDescriptor(c,m).enumerable})),h.push.apply(h,v)}return h}function S(c){for(var u=1;u<arguments.length;u++){var h=arguments[u]!=null?arguments[u]:{};u%2?j(Object(h),!0).forEach(function(v){y(c,v,h[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(h)):j(Object(h)).forEach(function(v){Object.defineProperty(c,v,Object.getOwnPropertyDescriptor(h,v))})}return c}function y(c,u,h){return u=_(u),u in c?Object.defineProperty(c,u,{value:h,enumerable:!0,configurable:!0,writable:!0}):c[u]=h,c}function _(c){var u=P(c,"string");return typeof u=="symbol"?u:String(u)}function P(c,u){if(typeof c!="object"||c===null)return c;var h=c[Symbol.toPrimitive];if(h!==void 0){var v=h.call(c,u);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(c)}function x(c,u){c.prototype=Object.create(u.prototype),c.prototype.constructor=c,p(c,u)}function p(c,u){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(v,m){return v.__proto__=m,v},p(c,u)}var l=(function(c){x(u,c);function u(){for(var v,m=arguments.length,b=new Array(m),f=0;f<m;f++)b[f]=arguments[f];return v=c.call.apply(c,[this].concat(b))||this,v.handleRefs={},v.lastHandleRect=null,v.slack=null,v}var h=u.prototype;return h.componentWillUnmount=function(){this.resetData()},h.resetData=function(){this.lastHandleRect=this.slack=null},h.runConstraints=function(m,b){var f=this.props,w=f.minConstraints,R=f.maxConstraints,D=f.lockAspectRatio;if(!w&&!R&&!D)return[m,b];if(D){var O=this.props.width/this.props.height,k=m-this.props.width,q=b-this.props.height;Math.abs(k)>Math.abs(q*O)?b=m/O:m=b*O}var L=m,z=b,I=this.slack||[0,0],M=I[0],Y=I[1];return m+=M,b+=Y,w&&(m=Math.max(w[0],m),b=Math.max(w[1],b)),R&&(m=Math.min(R[0],m),b=Math.min(R[1],b)),this.slack=[M+(L-m),Y+(z-b)],[m,b]},h.resizeHandler=function(m,b){var f=this;return function(w,R){var D=R.node,O=R.deltaX,k=R.deltaY;m==="onResizeStart"&&f.resetData();var q=(f.props.axis==="both"||f.props.axis==="x")&&b!=="n"&&b!=="s",L=(f.props.axis==="both"||f.props.axis==="y")&&b!=="e"&&b!=="w";if(!(!q&&!L)){var z=b[0],I=b[b.length-1],M=D.getBoundingClientRect();if(f.lastHandleRect!=null){if(I==="w"){var Y=M.left-f.lastHandleRect.left;O+=Y}if(z==="n"){var G=M.top-f.lastHandleRect.top;k+=G}}f.lastHandleRect=M,I==="w"&&(O=-O),z==="n"&&(k=-k);var X=f.props.width+(q?O/f.props.transformScale:0),ne=f.props.height+(L?k/f.props.transformScale:0),se=f.runConstraints(X,ne);X=se[0],ne=se[1];var Q=X!==f.props.width||ne!==f.props.height,he=typeof f.props[m]=="function"?f.props[m]:null,W=m==="onResize"&&!Q;he&&!W&&(w.persist==null||w.persist(),he(w,{node:D,size:{width:X,height:ne},handle:b})),m==="onResizeStop"&&f.resetData()}}},h.renderResizeHandle=function(m,b){var f=this.props.handle;if(!f)return t.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+m,ref:b});if(typeof f=="function")return f(m,b);var w=typeof f.type=="string",R=S({ref:b},w?{}:{handleAxis:m});return t.cloneElement(f,R)},h.render=function(){var m=this,b=this.props,f=b.children,w=b.className,R=b.draggableOpts;b.width,b.height,b.handle,b.handleSize,b.lockAspectRatio,b.axis,b.minConstraints,b.maxConstraints,b.onResize,b.onResizeStop,b.onResizeStart;var D=b.resizeHandles;b.transformScale;var O=g(b,a);return(0,r.cloneElement)(f,S(S({},O),{},{className:(w?w+" ":"")+"react-resizable",children:[].concat(f.props.children,D.map(function(k){var q,L=(q=m.handleRefs[k])!=null?q:m.handleRefs[k]=t.createRef();return t.createElement(n.DraggableCore,d({},R,{nodeRef:L,key:"resizableHandle-"+k,onStop:m.resizeHandler("onResizeStop",k),onStart:m.resizeHandler("onResizeStart",k),onDrag:m.resizeHandler("onResize",k)}),m.renderResizeHandle(k,L))}))}))},u})(t.Component);return bt.default=l,l.propTypes=s.resizableProps,l.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1},bt}var wt={},vi;function $d(){if(vi)return wt;vi=1,wt.__esModule=!0,wt.default=void 0;var t=d(Pe()),n=i(Ye()),r=i(Pc()),s=Nc(),a=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function i(u){return u&&u.__esModule?u:{default:u}}function o(u){if(typeof WeakMap!="function")return null;var h=new WeakMap,v=new WeakMap;return(o=function(b){return b?v:h})(u)}function d(u,h){if(u&&u.__esModule)return u;if(u===null||typeof u!="object"&&typeof u!="function")return{default:u};var v=o(h);if(v&&v.has(u))return v.get(u);var m={},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in u)if(f!=="default"&&Object.prototype.hasOwnProperty.call(u,f)){var w=b?Object.getOwnPropertyDescriptor(u,f):null;w&&(w.get||w.set)?Object.defineProperty(m,f,w):m[f]=u[f]}return m.default=u,v&&v.set(u,m),m}function g(){return g=Object.assign?Object.assign.bind():function(u){for(var h=1;h<arguments.length;h++){var v=arguments[h];for(var m in v)Object.prototype.hasOwnProperty.call(v,m)&&(u[m]=v[m])}return u},g.apply(this,arguments)}function j(u,h){var v=Object.keys(u);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(u);h&&(m=m.filter(function(b){return Object.getOwnPropertyDescriptor(u,b).enumerable})),v.push.apply(v,m)}return v}function S(u){for(var h=1;h<arguments.length;h++){var v=arguments[h]!=null?arguments[h]:{};h%2?j(Object(v),!0).forEach(function(m){y(u,m,v[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(v)):j(Object(v)).forEach(function(m){Object.defineProperty(u,m,Object.getOwnPropertyDescriptor(v,m))})}return u}function y(u,h,v){return h=_(h),h in u?Object.defineProperty(u,h,{value:v,enumerable:!0,configurable:!0,writable:!0}):u[h]=v,u}function _(u){var h=P(u,"string");return typeof h=="symbol"?h:String(h)}function P(u,h){if(typeof u!="object"||u===null)return u;var v=u[Symbol.toPrimitive];if(v!==void 0){var m=v.call(u,h);if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(h==="string"?String:Number)(u)}function x(u,h){if(u==null)return{};var v={},m=Object.keys(u),b,f;for(f=0;f<m.length;f++)b=m[f],!(h.indexOf(b)>=0)&&(v[b]=u[b]);return v}function p(u,h){u.prototype=Object.create(h.prototype),u.prototype.constructor=u,l(u,h)}function l(u,h){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(m,b){return m.__proto__=b,m},l(u,h)}var c=(function(u){p(h,u);function h(){for(var m,b=arguments.length,f=new Array(b),w=0;w<b;w++)f[w]=arguments[w];return m=u.call.apply(u,[this].concat(f))||this,m.state={width:m.props.width,height:m.props.height,propsWidth:m.props.width,propsHeight:m.props.height},m.onResize=function(R,D){var O=D.size;m.props.onResize?(R.persist==null||R.persist(),m.setState(O,function(){return m.props.onResize&&m.props.onResize(R,D)})):m.setState(O)},m}h.getDerivedStateFromProps=function(b,f){return f.propsWidth!==b.width||f.propsHeight!==b.height?{width:b.width,height:b.height,propsWidth:b.width,propsHeight:b.height}:null};var v=h.prototype;return v.render=function(){var b=this.props,f=b.handle,w=b.handleSize;b.onResize;var R=b.onResizeStart,D=b.onResizeStop,O=b.draggableOpts,k=b.minConstraints,q=b.maxConstraints,L=b.lockAspectRatio,z=b.axis;b.width,b.height;var I=b.resizeHandles,M=b.style,Y=b.transformScale,G=x(b,a);return t.createElement(r.default,{axis:z,draggableOpts:O,handle:f,handleSize:w,height:this.state.height,lockAspectRatio:L,maxConstraints:q,minConstraints:k,onResizeStart:R,onResize:this.onResize,onResizeStop:D,resizeHandles:I,transformScale:Y,width:this.state.width},t.createElement("div",g({},G,{style:S(S({},M),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},h})(t.Component);return wt.default=c,c.propTypes=S(S({},s.resizableProps),{},{children:n.default.element}),wt}var yi;function Yd(){return yi||(yi=1,xt.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},xt.exports.Resizable=Pc().default,xt.exports.ResizableBox=$d().default),xt.exports}var Le={},xi;function Ec(){if(xi)return Le;xi=1,Object.defineProperty(Le,"__esModule",{value:!0}),Le.resizeHandleType=Le.resizeHandleAxesType=Le.default=void 0;var t=r(Ye()),n=r(Pe());function r(i){return i&&i.__esModule?i:{default:i}}const s=Le.resizeHandleAxesType=t.default.arrayOf(t.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),a=Le.resizeHandleType=t.default.oneOfType([t.default.node,t.default.func]);return Le.default={className:t.default.string,style:t.default.object,width:t.default.number,autoSize:t.default.bool,cols:t.default.number,draggableCancel:t.default.string,draggableHandle:t.default.string,verticalCompact:function(i){i.verticalCompact},compactType:t.default.oneOf(["vertical","horizontal"]),layout:function(i){var o=i.layout;o!==void 0&&ht().validateLayout(o,"layout")},margin:t.default.arrayOf(t.default.number),containerPadding:t.default.arrayOf(t.default.number),rowHeight:t.default.number,maxRows:t.default.number,isBounded:t.default.bool,isDraggable:t.default.bool,isResizable:t.default.bool,allowOverlap:t.default.bool,preventCollision:t.default.bool,useCSSTransforms:t.default.bool,transformScale:t.default.number,isDroppable:t.default.bool,resizeHandles:s,resizeHandle:a,onLayoutChange:t.default.func,onDragStart:t.default.func,onDrag:t.default.func,onDragStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,onResizeStop:t.default.func,onDrop:t.default.func,droppingItem:t.default.shape({i:t.default.string.isRequired,w:t.default.number.isRequired,h:t.default.number.isRequired}),children:function(i,o){const d=i[o],g={};n.default.Children.forEach(d,function(j){if(j?.key!=null){if(g[j.key])throw new Error('Duplicate child key "'+j.key+'" found! This will cause problems in ReactGridLayout.');g[j.key]=!0}})},innerRef:t.default.any},Le}var bi;function Kd(){if(bi)return gt;bi=1,Object.defineProperty(gt,"__esModule",{value:!0}),gt.default=void 0;var t=j(Pe()),n=va(),r=j(Ye()),s=Sa(),a=Yd(),i=ht(),o=wa(),d=Ec(),g=j(lr());function j(x){return x&&x.__esModule?x:{default:x}}function S(x,p,l){return(p=y(p))in x?Object.defineProperty(x,p,{value:l,enumerable:!0,configurable:!0,writable:!0}):x[p]=l,x}function y(x){var p=_(x,"string");return typeof p=="symbol"?p:p+""}function _(x,p){if(typeof x!="object"||!x)return x;var l=x[Symbol.toPrimitive];if(l!==void 0){var c=l.call(x,p);if(typeof c!="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return(p==="string"?String:Number)(x)}let P=class extends t.default.Component{constructor(){super(...arguments),S(this,"state",{resizing:null,dragging:null,className:""}),S(this,"elementRef",t.default.createRef()),S(this,"onDragStart",(p,l)=>{let{node:c}=l;const{onDragStart:u,transformScale:h}=this.props;if(!u)return;const v={top:0,left:0},{offsetParent:m}=c;if(!m)return;const b=m.getBoundingClientRect(),f=c.getBoundingClientRect(),w=f.left/h,R=b.left/h,D=f.top/h,O=b.top/h;v.left=w-R+m.scrollLeft,v.top=D-O+m.scrollTop,this.setState({dragging:v});const{x:k,y:q}=(0,o.calcXY)(this.getPositionParams(),v.top,v.left,this.props.w,this.props.h);return u.call(this,this.props.i,k,q,{e:p,node:c,newPosition:v})}),S(this,"onDrag",(p,l,c)=>{let{node:u,deltaX:h,deltaY:v}=l;const{onDrag:m}=this.props;if(!m)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let b=this.state.dragging.top+v,f=this.state.dragging.left+h;const{isBounded:w,i:R,w:D,h:O,containerWidth:k}=this.props,q=this.getPositionParams();if(w){const{offsetParent:M}=u;if(M){const{margin:Y,rowHeight:G}=this.props,X=M.clientHeight-(0,o.calcGridItemWHPx)(O,G,Y[1]);b=(0,o.clamp)(b,0,X);const ne=(0,o.calcGridColWidth)(q),se=k-(0,o.calcGridItemWHPx)(D,ne,Y[0]);f=(0,o.clamp)(f,0,se)}}const L={top:b,left:f};c?this.setState({dragging:L}):(0,n.flushSync)(()=>{this.setState({dragging:L})});const{x:z,y:I}=(0,o.calcXY)(q,b,f,D,O);return m.call(this,R,z,I,{e:p,node:u,newPosition:L})}),S(this,"onDragStop",(p,l)=>{let{node:c}=l;const{onDragStop:u}=this.props;if(!u)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:h,h:v,i:m}=this.props,{left:b,top:f}=this.state.dragging,w={top:f,left:b};this.setState({dragging:null});const{x:R,y:D}=(0,o.calcXY)(this.getPositionParams(),f,b,h,v);return u.call(this,m,R,D,{e:p,node:c,newPosition:w})}),S(this,"onResizeStop",(p,l,c)=>this.onResizeHandler(p,l,c,"onResizeStop")),S(this,"onResizeStart",(p,l,c)=>this.onResizeHandler(p,l,c,"onResizeStart")),S(this,"onResize",(p,l,c)=>this.onResizeHandler(p,l,c,"onResize"))}shouldComponentUpdate(p,l){if(this.props.children!==p.children||this.props.droppingPosition!==p.droppingPosition)return!0;const c=(0,o.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),u=(0,o.calcGridItemPosition)(this.getPositionParams(p),p.x,p.y,p.w,p.h,l);return!(0,i.fastPositionEqual)(c,u)||this.props.useCSSTransforms!==p.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(p){this.moveDroppingItem(p)}moveDroppingItem(p){const{droppingPosition:l}=this.props;if(!l)return;const c=this.elementRef.current;if(!c)return;const u=p.droppingPosition||{left:0,top:0},{dragging:h}=this.state,v=h&&l.left!==u.left||l.top!==u.top;if(!h)this.onDragStart(l.e,{node:c,deltaX:l.left,deltaY:l.top});else if(v){const m=l.left-h.left,b=l.top-h.top;this.onDrag(l.e,{node:c,deltaX:m,deltaY:b},!0)}}getPositionParams(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:p.cols,containerPadding:p.containerPadding,containerWidth:p.containerWidth,margin:p.margin,maxRows:p.maxRows,rowHeight:p.rowHeight}}createStyle(p){const{usePercentages:l,containerWidth:c,useCSSTransforms:u}=this.props;let h;return u?h=(0,i.setTransform)(p):(h=(0,i.setTopLeft)(p),l&&(h.left=(0,i.perc)(p.left/c),h.width=(0,i.perc)(p.width/c))),h}mixinDraggable(p,l){return t.default.createElement(s.DraggableCore,{disabled:!l,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},p)}curryResizeHandler(p,l){return(c,u)=>l(c,u,p)}mixinResizable(p,l,c){const{cols:u,minW:h,minH:v,maxW:m,maxH:b,transformScale:f,resizeHandles:w,resizeHandle:R}=this.props,D=this.getPositionParams(),O=(0,o.calcGridItemPosition)(D,0,0,u,0).width,k=(0,o.calcGridItemPosition)(D,0,0,h,v),q=(0,o.calcGridItemPosition)(D,0,0,m,b),L=[k.width,k.height],z=[Math.min(q.width,O),Math.min(q.height,1/0)];return t.default.createElement(a.Resizable,{draggableOpts:{disabled:!c},className:c?void 0:"react-resizable-hide",width:l.width,height:l.height,minConstraints:L,maxConstraints:z,onResizeStop:this.curryResizeHandler(l,this.onResizeStop),onResizeStart:this.curryResizeHandler(l,this.onResizeStart),onResize:this.curryResizeHandler(l,this.onResize),transformScale:f,resizeHandles:w,handle:R},p)}onResizeHandler(p,l,c,u){let{node:h,size:v,handle:m}=l;const b=this.props[u];if(!b)return;const{x:f,y:w,i:R,maxH:D,minH:O,containerWidth:k}=this.props,{minW:q,maxW:L}=this.props;let z=v;h&&(z=(0,i.resizeItemInDirection)(m,c,v,k),(0,n.flushSync)(()=>{this.setState({resizing:u==="onResizeStop"?null:z})}));let{w:I,h:M}=(0,o.calcWH)(this.getPositionParams(),z.width,z.height,f,w,m);I=(0,o.clamp)(I,Math.max(q,1),L),M=(0,o.clamp)(M,O,D),b.call(this,R,I,M,{e:p,node:h,size:z,handle:m})}render(){const{x:p,y:l,w:c,h:u,isDraggable:h,isResizable:v,droppingPosition:m,useCSSTransforms:b}=this.props,f=(0,o.calcGridItemPosition)(this.getPositionParams(),p,l,c,u,this.state),w=t.default.Children.only(this.props.children);let R=t.default.cloneElement(w,{ref:this.elementRef,className:(0,g.default)("react-grid-item",w.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":h,"react-draggable-dragging":!!this.state.dragging,dropping:!!m,cssTransforms:b}),style:{...this.props.style,...w.props.style,...this.createStyle(f)}});return R=this.mixinResizable(R,f,v),R=this.mixinDraggable(R,h),R}};return gt.default=P,S(P,"propTypes",{children:r.default.element,cols:r.default.number.isRequired,containerWidth:r.default.number.isRequired,rowHeight:r.default.number.isRequired,margin:r.default.array.isRequired,maxRows:r.default.number.isRequired,containerPadding:r.default.array.isRequired,x:r.default.number.isRequired,y:r.default.number.isRequired,w:r.default.number.isRequired,h:r.default.number.isRequired,minW:function(x,p){const l=x[p];if(typeof l!="number")return new Error("minWidth not Number");if(l>x.w||l>x.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(x,p){const l=x[p];if(typeof l!="number")return new Error("maxWidth not Number");if(l<x.w||l<x.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(x,p){const l=x[p];if(typeof l!="number")return new Error("minHeight not Number");if(l>x.h||l>x.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(x,p){const l=x[p];if(typeof l!="number")return new Error("maxHeight not Number");if(l<x.h||l<x.minH)return new Error("maxHeight smaller than item height/minHeight")},i:r.default.string.isRequired,resizeHandles:d.resizeHandleAxesType,resizeHandle:d.resizeHandleType,onDragStop:r.default.func,onDragStart:r.default.func,onDrag:r.default.func,onResizeStop:r.default.func,onResizeStart:r.default.func,onResize:r.default.func,isDraggable:r.default.bool.isRequired,isResizable:r.default.bool.isRequired,isBounded:r.default.bool.isRequired,static:r.default.bool,useCSSTransforms:r.default.bool.isRequired,transformScale:r.default.number,className:r.default.string,handle:r.default.string,cancel:r.default.string,droppingPosition:r.default.shape({e:r.default.object.isRequired,left:r.default.number.isRequired,top:r.default.number.isRequired})}),S(P,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1}),gt}var ji;function Oc(){if(ji)return mt;ji=1,Object.defineProperty(mt,"__esModule",{value:!0}),mt.default=void 0;var t=g(Pe()),n=ja(),r=d(lr()),s=ht(),a=wa(),i=d(Kd()),o=d(Ec());function d(p){return p&&p.__esModule?p:{default:p}}function g(p,l){if(typeof WeakMap=="function")var c=new WeakMap,u=new WeakMap;return(g=function(h,v){if(!v&&h&&h.__esModule)return h;var m,b,f={__proto__:null,default:h};if(h===null||typeof h!="object"&&typeof h!="function")return f;if(m=v?u:c){if(m.has(h))return m.get(h);m.set(h,f)}for(const w in h)w!=="default"&&{}.hasOwnProperty.call(h,w)&&((b=(m=Object.defineProperty)&&Object.getOwnPropertyDescriptor(h,w))&&(b.get||b.set)?m(f,w,b):f[w]=h[w]);return f})(p,l)}function j(p,l,c){return(l=S(l))in p?Object.defineProperty(p,l,{value:c,enumerable:!0,configurable:!0,writable:!0}):p[l]=c,p}function S(p){var l=y(p,"string");return typeof l=="symbol"?l:l+""}function y(p,l){if(typeof p!="object"||!p)return p;var c=p[Symbol.toPrimitive];if(c!==void 0){var u=c.call(p,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(p)}const _="react-grid-layout";let P=!1;try{P=/firefox/i.test(navigator.userAgent)}catch{}let x=class extends t.Component{constructor(){super(...arguments),j(this,"state",{activeDrag:null,layout:(0,s.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,s.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),j(this,"dragEnterCounter",0),j(this,"onDragStart",(l,c,u,h)=>{let{e:v,node:m}=h;const{layout:b}=this.state,f=(0,s.getLayoutItem)(b,l);if(!f)return;const w={w:f.w,h:f.h,x:f.x,y:f.y,placeholder:!0,i:l};return this.setState({oldDragItem:(0,s.cloneLayoutItem)(f),oldLayout:b,activeDrag:w}),this.props.onDragStart(b,f,f,null,v,m)}),j(this,"onDrag",(l,c,u,h)=>{let{e:v,node:m}=h;const{oldDragItem:b}=this.state;let{layout:f}=this.state;const{cols:w,allowOverlap:R,preventCollision:D}=this.props,O=(0,s.getLayoutItem)(f,l);if(!O)return;const k={w:O.w,h:O.h,x:O.x,y:O.y,placeholder:!0,i:l};f=(0,s.moveElement)(f,O,c,u,!0,D,(0,s.compactType)(this.props),w,R),this.props.onDrag(f,b,O,k,v,m),this.setState({layout:R?f:(0,s.compact)(f,(0,s.compactType)(this.props),w),activeDrag:k})}),j(this,"onDragStop",(l,c,u,h)=>{let{e:v,node:m}=h;if(!this.state.activeDrag)return;const{oldDragItem:b}=this.state;let{layout:f}=this.state;const{cols:w,preventCollision:R,allowOverlap:D}=this.props,O=(0,s.getLayoutItem)(f,l);if(!O)return;f=(0,s.moveElement)(f,O,c,u,!0,R,(0,s.compactType)(this.props),w,D);const q=D?f:(0,s.compact)(f,(0,s.compactType)(this.props),w);this.props.onDragStop(q,b,O,null,v,m);const{oldLayout:L}=this.state;this.setState({activeDrag:null,layout:q,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(q,L)}),j(this,"onResizeStart",(l,c,u,h)=>{let{e:v,node:m}=h;const{layout:b}=this.state,f=(0,s.getLayoutItem)(b,l);f&&(this.setState({oldResizeItem:(0,s.cloneLayoutItem)(f),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(b,f,f,null,v,m))}),j(this,"onResize",(l,c,u,h)=>{let{e:v,node:m,size:b,handle:f}=h;const{oldResizeItem:w}=this.state,{layout:R}=this.state,{cols:D,preventCollision:O,allowOverlap:k}=this.props;let q=!1,L,z,I;const[M,Y]=(0,s.withLayoutItem)(R,l,X=>{let ne;return z=X.x,I=X.y,["sw","w","nw","n","ne"].indexOf(f)!==-1&&(["sw","nw","w"].indexOf(f)!==-1&&(z=X.x+(X.w-c),c=X.x!==z&&z<0?X.w:c,z=z<0?0:z),["ne","n","nw"].indexOf(f)!==-1&&(I=X.y+(X.h-u),u=X.y!==I&&I<0?X.h:u,I=I<0?0:I),q=!0),O&&!k&&(ne=(0,s.getAllCollisions)(R,{...X,w:c,h:u,x:z,y:I}).filter(Q=>Q.i!==X.i).length>0,ne&&(I=X.y,u=X.h,z=X.x,c=X.w,q=!1)),X.w=c,X.h=u,X});if(!Y)return;L=M,q&&(L=(0,s.moveElement)(M,Y,z,I,!0,this.props.preventCollision,(0,s.compactType)(this.props),D,k));const G={w:Y.w,h:Y.h,x:Y.x,y:Y.y,static:!0,i:l};this.props.onResize(L,w,Y,G,v,m),this.setState({layout:k?L:(0,s.compact)(L,(0,s.compactType)(this.props),D),activeDrag:G})}),j(this,"onResizeStop",(l,c,u,h)=>{let{e:v,node:m}=h;const{layout:b,oldResizeItem:f}=this.state,{cols:w,allowOverlap:R}=this.props,D=(0,s.getLayoutItem)(b,l),O=R?b:(0,s.compact)(b,(0,s.compactType)(this.props),w);this.props.onResizeStop(O,f,D,null,v,m);const{oldLayout:k}=this.state;this.setState({activeDrag:null,layout:O,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(O,k)}),j(this,"onDragOver",l=>{if(l.preventDefault(),l.stopPropagation(),P&&!l.nativeEvent.target?.classList.contains(_))return!1;const{droppingItem:c,onDropDragOver:u,margin:h,cols:v,rowHeight:m,maxRows:b,width:f,containerPadding:w,transformScale:R}=this.props,D=u?.(l);if(D===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const O={...c,...D},{layout:k}=this.state,q=l.currentTarget.getBoundingClientRect(),L=l.clientX-q.left,z=l.clientY-q.top,I={left:L/R,top:z/R,e:l};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:M,top:Y}=this.state.droppingPosition;(M!=L||Y!=z)&&this.setState({droppingPosition:I})}}else{const M={cols:v,margin:h,maxRows:b,rowHeight:m,containerWidth:f,containerPadding:w||h},Y=(0,a.calcXY)(M,z,L,O.w,O.h);this.setState({droppingDOMNode:t.createElement("div",{key:O.i}),droppingPosition:I,layout:[...k,{...O,x:Y.x,y:Y.y,static:!1,isDraggable:!0}]})}}),j(this,"removeDroppingPlaceholder",()=>{const{droppingItem:l,cols:c}=this.props,{layout:u}=this.state,h=(0,s.compact)(u.filter(v=>v.i!==l.i),(0,s.compactType)(this.props),c,this.props.allowOverlap);this.setState({layout:h,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),j(this,"onDragLeave",l=>{l.preventDefault(),l.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),j(this,"onDragEnter",l=>{l.preventDefault(),l.stopPropagation(),this.dragEnterCounter++}),j(this,"onDrop",l=>{l.preventDefault(),l.stopPropagation();const{droppingItem:c}=this.props,{layout:u}=this.state,h=u.find(v=>v.i===c.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(u,h,l)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(l,c){let u;return c.activeDrag?null:(!(0,n.deepEqual)(l.layout,c.propsLayout)||l.compactType!==c.compactType?u=l.layout:(0,s.childrenEqual)(l.children,c.children)||(u=c.layout),u?{layout:(0,s.synchronizeLayoutWithChildren)(u,l.children,l.cols,(0,s.compactType)(l),l.allowOverlap),compactType:l.compactType,children:l.children,propsLayout:l.layout}:null)}shouldComponentUpdate(l,c){return this.props.children!==l.children||!(0,s.fastRGLPropsEqual)(this.props,l,n.deepEqual)||this.state.activeDrag!==c.activeDrag||this.state.mounted!==c.mounted||this.state.droppingPosition!==c.droppingPosition}componentDidUpdate(l,c){if(!this.state.activeDrag){const u=this.state.layout,h=c.layout;this.onLayoutMaybeChanged(u,h)}}containerHeight(){if(!this.props.autoSize)return;const l=(0,s.bottom)(this.state.layout),c=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return l*this.props.rowHeight+(l-1)*this.props.margin[1]+c*2+"px"}onLayoutMaybeChanged(l,c){c||(c=this.state.layout),(0,n.deepEqual)(c,l)||this.props.onLayoutChange(l)}placeholder(){const{activeDrag:l}=this.state;if(!l)return null;const{width:c,cols:u,margin:h,containerPadding:v,rowHeight:m,maxRows:b,useCSSTransforms:f,transformScale:w}=this.props;return t.createElement(i.default,{w:l.w,h:l.h,x:l.x,y:l.y,i:l.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:c,cols:u,margin:h,containerPadding:v||h,maxRows:b,rowHeight:m,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:f,transformScale:w},t.createElement("div",null))}processGridItem(l,c){if(!l||!l.key)return;const u=(0,s.getLayoutItem)(this.state.layout,String(l.key));if(!u)return null;const{width:h,cols:v,margin:m,containerPadding:b,rowHeight:f,maxRows:w,isDraggable:R,isResizable:D,isBounded:O,useCSSTransforms:k,transformScale:q,draggableCancel:L,draggableHandle:z,resizeHandles:I,resizeHandle:M}=this.props,{mounted:Y,droppingPosition:G}=this.state,X=typeof u.isDraggable=="boolean"?u.isDraggable:!u.static&&R,ne=typeof u.isResizable=="boolean"?u.isResizable:!u.static&&D,se=u.resizeHandles||I,Q=X&&O&&u.isBounded!==!1;return t.createElement(i.default,{containerWidth:h,cols:v,margin:m,containerPadding:b||m,maxRows:w,rowHeight:f,cancel:L,handle:z,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:X,isResizable:ne,isBounded:Q,useCSSTransforms:k&&Y,usePercentages:!Y,transformScale:q,w:u.w,h:u.h,x:u.x,y:u.y,i:u.i,minH:u.minH,minW:u.minW,maxH:u.maxH,maxW:u.maxW,static:u.static,droppingPosition:c?G:void 0,resizeHandles:se,resizeHandle:M},l)}render(){const{className:l,style:c,isDroppable:u,innerRef:h}=this.props,v=(0,r.default)(_,l),m={height:this.containerHeight(),...c};return t.createElement("div",{ref:h,className:v,style:m,onDrop:u?this.onDrop:s.noop,onDragLeave:u?this.onDragLeave:s.noop,onDragEnter:u?this.onDragEnter:s.noop,onDragOver:u?this.onDragOver:s.noop},t.Children.map(this.props.children,b=>this.processGridItem(b)),u&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}};return mt.default=x,j(x,"displayName","ReactGridLayout"),j(x,"propTypes",o.default),j(x,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:s.noop,onDragStart:s.noop,onDrag:s.noop,onDragStop:s.noop,onResizeStart:s.noop,onResize:s.noop,onResizeStop:s.noop,onDrop:s.noop,onDropDragOver:s.noop}),mt}var _t={},Ke={},wi;function Dc(){if(wi)return Ke;wi=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.findOrGenerateResponsiveLayout=s,Ke.getBreakpointFromWidth=n,Ke.getColsFromBreakpoint=r,Ke.sortBreakpoints=a;var t=ht();function n(i,o){const d=a(i);let g=d[0];for(let j=1,S=d.length;j<S;j++){const y=d[j];o>i[y]&&(g=y)}return g}function r(i,o){if(!o[i])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+i+" is missing!");return o[i]}function s(i,o,d,g,j,S){if(i[d])return(0,t.cloneLayout)(i[d]);let y=i[g];const _=a(o),P=_.slice(_.indexOf(d));for(let x=0,p=P.length;x<p;x++){const l=P[x];if(i[l]){y=i[l];break}}return y=(0,t.cloneLayout)(y||[]),(0,t.compact)((0,t.correctBounds)(y,{cols:j}),S,j)}function a(i){return Object.keys(i).sort(function(d,g){return i[d]-i[g]})}return Ke}var _i;function Xd(){if(_i)return _t;_i=1,Object.defineProperty(_t,"__esModule",{value:!0}),_t.default=void 0;var t=d(Pe()),n=o(Ye()),r=ja(),s=ht(),a=Dc(),i=o(Oc());function o(p){return p&&p.__esModule?p:{default:p}}function d(p,l){if(typeof WeakMap=="function")var c=new WeakMap,u=new WeakMap;return(d=function(h,v){if(!v&&h&&h.__esModule)return h;var m,b,f={__proto__:null,default:h};if(h===null||typeof h!="object"&&typeof h!="function")return f;if(m=v?u:c){if(m.has(h))return m.get(h);m.set(h,f)}for(const w in h)w!=="default"&&{}.hasOwnProperty.call(h,w)&&((b=(m=Object.defineProperty)&&Object.getOwnPropertyDescriptor(h,w))&&(b.get||b.set)?m(f,w,b):f[w]=h[w]);return f})(p,l)}function g(){return g=Object.assign?Object.assign.bind():function(p){for(var l=1;l<arguments.length;l++){var c=arguments[l];for(var u in c)({}).hasOwnProperty.call(c,u)&&(p[u]=c[u])}return p},g.apply(null,arguments)}function j(p,l,c){return(l=S(l))in p?Object.defineProperty(p,l,{value:c,enumerable:!0,configurable:!0,writable:!0}):p[l]=c,p}function S(p){var l=y(p,"string");return typeof l=="symbol"?l:l+""}function y(p,l){if(typeof p!="object"||!p)return p;var c=p[Symbol.toPrimitive];if(c!==void 0){var u=c.call(p,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(p)}const _=p=>Object.prototype.toString.call(p);function P(p,l){return p==null?null:Array.isArray(p)?p:p[l]}let x=class extends t.Component{constructor(){super(...arguments),j(this,"state",this.generateInitialState()),j(this,"onLayoutChange",l=>{this.props.onLayoutChange(l,{...this.props.layouts,[this.state.breakpoint]:l})})}generateInitialState(){const{width:l,breakpoints:c,layouts:u,cols:h}=this.props,v=(0,a.getBreakpointFromWidth)(c,l),m=(0,a.getColsFromBreakpoint)(v,h),b=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,a.findOrGenerateResponsiveLayout)(u,c,v,v,m,b),breakpoint:v,cols:m}}static getDerivedStateFromProps(l,c){if(!(0,r.deepEqual)(l.layouts,c.layouts)){const{breakpoint:u,cols:h}=c;return{layout:(0,a.findOrGenerateResponsiveLayout)(l.layouts,l.breakpoints,u,u,h,l.compactType),layouts:l.layouts}}return null}componentDidUpdate(l){(this.props.width!=l.width||this.props.breakpoint!==l.breakpoint||!(0,r.deepEqual)(this.props.breakpoints,l.breakpoints)||!(0,r.deepEqual)(this.props.cols,l.cols))&&this.onWidthChange(l)}onWidthChange(l){const{breakpoints:c,cols:u,layouts:h,compactType:v}=this.props,m=this.props.breakpoint||(0,a.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),b=this.state.breakpoint,f=(0,a.getColsFromBreakpoint)(m,u),w={...h};if(b!==m||l.breakpoints!==c||l.cols!==u){b in w||(w[b]=(0,s.cloneLayout)(this.state.layout));let O=(0,a.findOrGenerateResponsiveLayout)(w,c,m,b,f,v);O=(0,s.synchronizeLayoutWithChildren)(O,this.props.children,f,v,this.props.allowOverlap),w[m]=O,this.props.onBreakpointChange(m,f),this.props.onLayoutChange(O,w),this.setState({breakpoint:m,layout:O,cols:f})}const R=P(this.props.margin,m),D=P(this.props.containerPadding,m);this.props.onWidthChange(this.props.width,R,f,D)}render(){const{breakpoint:l,breakpoints:c,cols:u,layouts:h,margin:v,containerPadding:m,onBreakpointChange:b,onLayoutChange:f,onWidthChange:w,...R}=this.props;return t.createElement(i.default,g({},R,{margin:P(v,this.state.breakpoint),containerPadding:P(m,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}};return _t.default=x,j(x,"propTypes",{breakpoint:n.default.string,breakpoints:n.default.object,allowOverlap:n.default.bool,cols:n.default.object,margin:n.default.oneOfType([n.default.array,n.default.object]),containerPadding:n.default.oneOfType([n.default.array,n.default.object]),layouts(p,l){if(_(p[l])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+_(p[l]));Object.keys(p[l]).forEach(c=>{if(!(c in p.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,s.validateLayout)(p.layouts[c],"layouts."+c)})},width:n.default.number.isRequired,onBreakpointChange:n.default.func,onLayoutChange:n.default.func,onWidthChange:n.default.func}),j(x,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:s.noop,onLayoutChange:s.noop,onWidthChange:s.noop}),_t}var Bt={},Mc=(function(){if(typeof Map<"u")return Map;function t(n,r){var s=-1;return n.some(function(a,i){return a[0]===r?(s=i,!0):!1}),s}return(function(){function n(){this.__entries__=[]}return Object.defineProperty(n.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),n.prototype.get=function(r){var s=t(this.__entries__,r),a=this.__entries__[s];return a&&a[1]},n.prototype.set=function(r,s){var a=t(this.__entries__,r);~a?this.__entries__[a][1]=s:this.__entries__.push([r,s])},n.prototype.delete=function(r){var s=this.__entries__,a=t(s,r);~a&&s.splice(a,1)},n.prototype.has=function(r){return!!~t(this.__entries__,r)},n.prototype.clear=function(){this.__entries__.splice(0)},n.prototype.forEach=function(r,s){s===void 0&&(s=null);for(var a=0,i=this.__entries__;a<i.length;a++){var o=i[a];r.call(s,o[1],o[0])}},n})()})(),ca=typeof window<"u"&&typeof document<"u"&&window.document===document,Zt=(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")()})(),Vd=(function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Zt):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)}})(),Qd=2;function Jd(t,n){var r=!1,s=!1,a=0;function i(){r&&(r=!1,t()),s&&d()}function o(){Vd(i)}function d(){var g=Date.now();if(r){if(g-a<Qd)return;s=!0}else r=!0,s=!1,setTimeout(o,n);a=g}return d}var Zd=20,eh=["top","right","bottom","left","width","height","size","weight"],th=typeof MutationObserver<"u",rh=(function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Jd(this.refresh.bind(this),Zd)}return t.prototype.addObserver=function(n){~this.observers_.indexOf(n)||this.observers_.push(n),this.connected_||this.connect_()},t.prototype.removeObserver=function(n){var r=this.observers_,s=r.indexOf(n);~s&&r.splice(s,1),!r.length&&this.connected_&&this.disconnect_()},t.prototype.refresh=function(){var n=this.updateObservers_();n&&this.refresh()},t.prototype.updateObservers_=function(){var n=this.observers_.filter(function(r){return r.gatherActive(),r.hasActive()});return n.forEach(function(r){return r.broadcastActive()}),n.length>0},t.prototype.connect_=function(){!ca||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),th?(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(){!ca||!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(n){var r=n.propertyName,s=r===void 0?"":r,a=eh.some(function(i){return!!~s.indexOf(i)});a&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t})(),Ac=(function(t,n){for(var r=0,s=Object.keys(n);r<s.length;r++){var a=s[r];Object.defineProperty(t,a,{value:n[a],enumerable:!1,writable:!1,configurable:!0})}return t}),lt=(function(t){var n=t&&t.ownerDocument&&t.ownerDocument.defaultView;return n||Zt}),qc=ur(0,0,0,0);function er(t){return parseFloat(t)||0}function Si(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return n.reduce(function(s,a){var i=t["border-"+a+"-width"];return s+er(i)},0)}function nh(t){for(var n=["top","right","bottom","left"],r={},s=0,a=n;s<a.length;s++){var i=a[s],o=t["padding-"+i];r[i]=er(o)}return r}function sh(t){var n=t.getBBox();return ur(0,0,n.width,n.height)}function ah(t){var n=t.clientWidth,r=t.clientHeight;if(!n&&!r)return qc;var s=lt(t).getComputedStyle(t),a=nh(s),i=a.left+a.right,o=a.top+a.bottom,d=er(s.width),g=er(s.height);if(s.boxSizing==="border-box"&&(Math.round(d+i)!==n&&(d-=Si(s,"left","right")+i),Math.round(g+o)!==r&&(g-=Si(s,"top","bottom")+o)),!oh(t)){var j=Math.round(d+i)-n,S=Math.round(g+o)-r;Math.abs(j)!==1&&(d-=j),Math.abs(S)!==1&&(g-=S)}return ur(a.left,a.top,d,g)}var ih=(function(){return typeof SVGGraphicsElement<"u"?function(t){return t instanceof lt(t).SVGGraphicsElement}:function(t){return t instanceof lt(t).SVGElement&&typeof t.getBBox=="function"}})();function oh(t){return t===lt(t).document.documentElement}function lh(t){return ca?ih(t)?sh(t):ah(t):qc}function ch(t){var n=t.x,r=t.y,s=t.width,a=t.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,o=Object.create(i.prototype);return Ac(o,{x:n,y:r,width:s,height:a,top:r,right:n+s,bottom:a+r,left:n}),o}function ur(t,n,r,s){return{x:t,y:n,width:r,height:s}}var uh=(function(){function t(n){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=ur(0,0,0,0),this.target=n}return t.prototype.isActive=function(){var n=lh(this.target);return this.contentRect_=n,n.width!==this.broadcastWidth||n.height!==this.broadcastHeight},t.prototype.broadcastRect=function(){var n=this.contentRect_;return this.broadcastWidth=n.width,this.broadcastHeight=n.height,n},t})(),dh=(function(){function t(n,r){var s=ch(r);Ac(this,{target:n,contentRect:s})}return t})(),hh=(function(){function t(n,r,s){if(this.activeObservations_=[],this.observations_=new Mc,typeof n!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=n,this.controller_=r,this.callbackCtx_=s}return t.prototype.observe=function(n){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(n instanceof lt(n).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(n)||(r.set(n,new uh(n)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(n){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(n instanceof lt(n).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(n)&&(r.delete(n),r.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var n=this;this.clearActive(),this.observations_.forEach(function(r){r.isActive()&&n.activeObservations_.push(r)})},t.prototype.broadcastActive=function(){if(this.hasActive()){var n=this.callbackCtx_,r=this.activeObservations_.map(function(s){return new dh(s.target,s.broadcastRect())});this.callback_.call(n,r,n),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return this.activeObservations_.length>0},t})(),kc=typeof WeakMap<"u"?new WeakMap:new Mc,Tc=(function(){function t(n){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 r=rh.getInstance(),s=new hh(n,r,this);kc.set(this,s)}return t})();["observe","unobserve","disconnect"].forEach(function(t){Tc.prototype[t]=function(){var n;return(n=kc.get(this))[t].apply(n,arguments)}});var fh=(function(){return typeof Zt.ResizeObserver<"u"?Zt.ResizeObserver:Tc})();const ph=Object.freeze(Object.defineProperty({__proto__:null,default:fh},Symbol.toStringTag,{value:"Module"})),mh=ld(ph);var Ci;function gh(){if(Ci)return Bt;Ci=1,Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.default=y;var t=i(Pe()),n=a(Ye()),r=a(mh),s=a(lr());function a(_){return _&&_.__esModule?_:{default:_}}function i(_,P){if(typeof WeakMap=="function")var x=new WeakMap,p=new WeakMap;return(i=function(l,c){if(!c&&l&&l.__esModule)return l;var u,h,v={__proto__:null,default:l};if(l===null||typeof l!="object"&&typeof l!="function")return v;if(u=c?p:x){if(u.has(l))return u.get(l);u.set(l,v)}for(const m in l)m!=="default"&&{}.hasOwnProperty.call(l,m)&&((h=(u=Object.defineProperty)&&Object.getOwnPropertyDescriptor(l,m))&&(h.get||h.set)?u(v,m,h):v[m]=l[m]);return v})(_,P)}function o(){return o=Object.assign?Object.assign.bind():function(_){for(var P=1;P<arguments.length;P++){var x=arguments[P];for(var p in x)({}).hasOwnProperty.call(x,p)&&(_[p]=x[p])}return _},o.apply(null,arguments)}function d(_,P,x){return(P=g(P))in _?Object.defineProperty(_,P,{value:x,enumerable:!0,configurable:!0,writable:!0}):_[P]=x,_}function g(_){var P=j(_,"string");return typeof P=="symbol"?P:P+""}function j(_,P){if(typeof _!="object"||!_)return _;var x=_[Symbol.toPrimitive];if(x!==void 0){var p=x.call(_,P);if(typeof p!="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(_)}const S="react-grid-layout";function y(_){var P;return P=class extends t.Component{constructor(){super(...arguments),d(this,"state",{width:1280}),d(this,"elementRef",t.createRef()),d(this,"mounted",!1),d(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new r.default(l=>{if(this.elementRef.current instanceof HTMLElement){const u=l[0].contentRect.width;this.setState({width:u})}});const p=this.elementRef.current;p instanceof HTMLElement&&this.resizeObserver.observe(p)}componentWillUnmount(){this.mounted=!1;const p=this.elementRef.current;p instanceof HTMLElement&&this.resizeObserver.unobserve(p),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:p,...l}=this.props;return p&&!this.mounted?t.createElement("div",{className:(0,s.default)(this.props.className,S),style:this.props.style,ref:this.elementRef}):t.createElement(_,o({innerRef:this.elementRef},l,this.state))}},d(P,"defaultProps",{measureBeforeMount:!1}),d(P,"propTypes",{measureBeforeMount:n.default.bool}),P}return Bt}var Ri;function vh(){return Ri||(Ri=1,(function(t){t.exports=Oc().default,t.exports.utils=ht(),t.exports.calculateUtils=wa(),t.exports.Responsive=Xd().default,t.exports.Responsive.utils=Dc(),t.exports.WidthProvider=gh().default})(Cr)),Cr.exports}var yh=vh();const xh=ga(yh),bh=()=>{const t=te(V.ChatSend),[n,r]=N.useState([]),[s,a]=N.useState(""),i=N.useRef(null),o=F.chat.send.useMutation(),d=()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},g=te(V.ChatRecent),{data:j}=F.chat.recent.useQuery(void 0,{enabled:g});N.useEffect(()=>{j&&r(j.slice().reverse())},[j]),F.chat.onMessage.useSubscription(void 0,{enabled:g,onError:Qe,onData:y=>{r(_=>{const P=[..._,y];return P.length>50?P.slice(P.length-50):P})}}),N.useLayoutEffect(()=>{d()},[n]);const S=y=>{y.preventDefault(),!(s.length>140||s.length===0)&&(o.mutate(s),a(""))};return e.jsxs("div",{className:"chat-widget",children:[e.jsx(be,{className:"messages",ref:i,children:e.jsx("div",{className:"messages-child",children:n.map(y=>e.jsxs("div",{className:"log-entry",children:[y.action==="msg"&&e.jsxs("div",{className:"chat-message",children:[y.user?.web?"[":"",e.jsx(jr,{color:!0,user:y.user}),y.user?.web?"]":"",":"," ",e.jsx(ka,{as:"span",children:y.message})]}),y.action==="leave"&&e.jsxs("div",{className:"join-message",children:[e.jsx(jr,{user:y.user})," left the game."]}),y.action==="join"&&e.jsxs("div",{className:"join-message",children:[e.jsx(jr,{user:y.user})," joined the game",y.user?.isFirst?" for the first time":"","."]}),y.action==="server"&&e.jsx(ka,{as:"div",className:"server-message",children:y.message})]},y._id))})}),t&&e.jsx("form",{onSubmit:S,children:e.jsxs(Ce,{children:[e.jsx(ce,{roboto:!0,type:"text",placeholder:"Message",value:s,onChange:y=>a(y)}),e.jsx(H,{normal:!0,icon:!0,style:{marginLeft:"10px"},onClick:S,children:e.jsx(Tu,{})})]})})]})},jh=()=>{const t=te(V.ServerStatus),n=te(V.PlayerList),[r,s]=N.useState(null),{data:a}=F.server.status.useQuery(void 0,{enabled:t});return N.useEffect(()=>{a&&!r&&s(a)},[a]),F.server.onHeartbeat.useSubscription(void 0,{enabled:t,onError:Qe,onData:s}),e.jsxs("div",{className:"status-widget",children:[r?.players&&e.jsxs("div",{className:"players",children:[e.jsxs("div",{className:"stats",children:[e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Name:"})," ",r.serverName]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Uptime:"})," ",xe(r.time)]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Bricks:"})," ",r.bricks]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Players:"})," ",r.players.length]})]}),e.jsx(be,{className:"player-table",children:e.jsxs("table",{className:"br-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",width:"100%"},children:"Name"}),e.jsx("th",{children:"Time"}),e.jsx("th",{children:"Ping"})]})}),e.jsx("tbody",{children:r.players.map(i=>e.jsxs("tr",{children:[e.jsx("td",{children:n?e.jsx(at,{className:"user",to:"/players/"+i.id,children:i.name}):e.jsx("span",{className:"user",children:i.name})}),e.jsx("td",{style:{textAlign:"right"},children:xe(i.time)}),e.jsx("td",{style:{textAlign:"right"},children:i.ping})]},i.address+i.id))})]})})]}),!r?.players&&e.jsx(me,{blur:!0,size:"huge",children:"Loading Status"})]})},Ni=30;function Ft(t){return t<1024?`${t} B`:t<1024**2?`${(t/1024).toFixed(1)} KB`:t<1024**3?`${(t/1024**2).toFixed(1)} MB`:`${(t/1024**3).toFixed(1)} GB`}function Pi(t){return t<1024?`${Math.round(t)} B/s`:t<1024**2?`${(t/1024).toFixed(1)} KB/s`:`${(t/1024**2).toFixed(1)} MB/s`}function Dr(t){return t.length>=Ni?t:[...new Array(Ni-t.length).fill(t[0]??0),...t]}const Mr=({value:t,color:n})=>{const s=Math.PI*2*36,a=Math.max(0,Math.min(100,t));return e.jsxs("svg",{viewBox:"0 0 100 100",className:"donut-svg",children:[e.jsx("circle",{cx:"50",cy:"50",r:36,fill:"none",stroke:"rgba(255,255,255,0.06)",strokeWidth:"8"}),e.jsx("circle",{cx:"50",cy:"50",r:36,fill:"none",stroke:n,strokeWidth:"8",strokeDasharray:`${a/100*s} ${s}`,strokeLinecap:"round",transform:"rotate(-90 50 50)",style:{transition:"stroke-dasharray 0.5s ease"}}),e.jsx("text",{x:"50",y:"50",textAnchor:"middle",dominantBaseline:"central",className:"donut-pct",children:Math.round(a)===100?"100":`${Math.round(a)}%`})]})},Ar=({data:t,color:n,height:r=32,width:s=120})=>{if(t.length<2)return null;const a=Math.max(...t,1),i=s/(t.length-1),o=t.map((g,j)=>`${j*i},${r-g/a*(r-2)-1}`).join(" "),d=`0,${r} ${o} ${s},${r}`;return e.jsxs("svg",{viewBox:`0 0 ${s} ${r}`,className:"sparkline",preserveAspectRatio:"none",children:[e.jsx("polygon",{points:d,fill:n,fillOpacity:"0.12"}),e.jsx("polyline",{points:o,fill:"none",stroke:n,strokeWidth:"1.5",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"})]})},wh=()=>{const[t,n]=N.useState(null),r=N.useRef([]),s=N.useRef([]),a=N.useRef([]),[,i]=N.useState(0),o=N.useCallback(x=>{n(x),r.current=[...r.current.slice(-29),x.cpu],s.current=[...s.current.slice(-29),x.net.rxSec],a.current=[...a.current.slice(-29),x.net.txSec],i(p=>p+1)},[]),d=te(V.ServerUtilization),{data:g}=F.server.utilization.useQuery(void 0,{enabled:d});if(N.useEffect(()=>{if(!g)return;const x=g.history;x.length>0&&(r.current=x.map(p=>p.cpu),s.current=x.map(p=>p.net.rxSec),a.current=x.map(p=>p.net.txSec)),g.current&&!t&&n(g.current),i(p=>p+1)},[g]),F.server.onUtilization.useSubscription(void 0,{enabled:d,onError:Qe,onData:o}),!t)return e.jsx("div",{className:"utilization-widget",children:e.jsx(me,{blur:!0,size:"huge",children:"Waiting for metrics..."})});const j=t.cpu>80?"#e02d2d":t.cpu>50?"#ffa10b":"#5da93d",S=t.mem.used/t.mem.total*100,y=S>80?"#e02d2d":S>50?"#ffa10b":"#009bee",_=t.disk.used/t.disk.total*100,P=_>90?"#e02d2d":_>70?"#ffa10b":"#009bee";return e.jsxs("div",{className:"utilization-widget",children:[e.jsxs("div",{className:"util-donuts",children:[e.jsxs("div",{className:"donut-row",children:[e.jsx(Mr,{value:t.cpu,color:j}),e.jsx("div",{className:"donut-detail",children:e.jsx("b",{children:"CPU"})})]}),e.jsxs("div",{className:"donut-row",children:[e.jsx(Mr,{value:S,color:y}),e.jsxs("div",{className:"donut-detail",children:[e.jsx("b",{children:"MEMORY"}),e.jsxs("div",{className:"donut-detail-line",children:[e.jsx("span",{children:Ft(t.mem.used)}),e.jsxs("span",{className:"donut-detail-sub",children:["/ ",Ft(t.mem.total)]})]})]})]}),e.jsxs("div",{className:"donut-row",children:[e.jsx(Mr,{value:_,color:P}),e.jsxs("div",{className:"donut-detail",children:[e.jsx("b",{children:"STORAGE"}),e.jsxs("div",{className:"donut-detail-line",children:[e.jsx("span",{children:Ft(t.disk.used)}),e.jsxs("span",{className:"donut-detail-sub",children:["/ ",Ft(t.disk.total)]})]})]})]})]}),e.jsxs("div",{className:"util-sparklines",children:[e.jsxs("div",{className:"spark-row",children:[e.jsxs("span",{className:"spark-label",children:[e.jsx(Lu,{size:14}),"CPU"]}),e.jsx(Ar,{data:Dr(r.current),color:j}),e.jsxs("span",{className:"spark-value",children:[t.cpu,"%"]})]}),e.jsxs("div",{className:"spark-row",children:[e.jsxs("span",{className:"spark-label",children:[e.jsx(zu,{size:14}),"RX"]}),e.jsx(Ar,{data:Dr(s.current),color:"#009bee"}),e.jsx("span",{className:"spark-value",children:Pi(t.net.rxSec)})]}),e.jsxs("div",{className:"spark-row",children:[e.jsxs("span",{className:"spark-label",children:[e.jsx(Iu,{size:14}),"TX"]}),e.jsx(Ar,{data:Dr(a.current),color:"#5da93d"}),e.jsx("span",{className:"spark-value",children:Pi(t.net.txSec)})]})]})]})},Ei={chat:{component:bh,icon:Wu,tooltip:"Chat with online players",scope:V.ChatRecent},status:{component:jh,icon:id,tooltip:"View current online players and server status",scope:V.ServerStatus},utilization:{component:wh,icon:Hu,tooltip:"View CPU, memory, disk, and network usage",scope:V.ServerUtilization}},Oi=[{x:0,y:0,w:4,h:4,i:"chat"},{x:4,y:0,w:4,h:4,i:"status"}],_h=["status","chat","utilization"],Sh={minW:2,maxW:10,minH:2,maxH:10},Ch=[8,8],Rh=()=>{const t=te(V.ChatRecent),n=te(V.ServerStatus),r=te(V.ServerUtilization),s=N.useMemo(()=>{const h={};return t&&(h.chat=!0),n&&(h.status=!0),r&&(h.utilization=!0),h},[t,n,r]),a=t||n||r,i=_u(),o=N.useMemo(()=>{const h={};for(const[v,m]of Object.entries(Ei))s[v]&&(h[v]=m);return h},[s]),[d,g]=N.useState(()=>{if(localStorage.omeggaDashLayout2)try{return JSON.parse(localStorage.omeggaDashLayout2)}catch(h){return console.error("Invalid layout in localStorage, using default layout",h),Oi}return Oi}),j=N.useMemo(()=>d.filter(h=>s[h.i]),[d,s]);N.useEffect(()=>{localStorage.omeggaDashLayout2=JSON.stringify(d)},[d]);const S=h=>{g(d.filter(v=>v.i!==h))},y=h=>{h in o&&g([...d,{x:0,y:0,w:4,h:4,i:h}])},[_,P]=N.useState(!1),x=Object.fromEntries(d.map(h=>[h.i,!0])),p=N.useCallback(h=>{g(h)},[]),l=N.useRef(null),[c,u]=N.useState(null);return N.useEffect(()=>{l.current&&u(l.current.clientWidth);const h=new ResizeObserver(v=>{for(const m of v)m.target===l.current&&u(m.contentRect.width)});return l.current&&h.observe(l.current),()=>{h.disconnect()}},[l.current]),e.jsxs(e.Fragment,{children:[!i&&e.jsx(De,{title:"Dashboard",children:a&&e.jsxs("div",{className:"widgets-container",children:[e.jsxs(H,{normal:!0,boxy:!0,"data-tooltip":"Add more widgets to the dashboard",onClick:()=>P(!_),children:[e.jsx(Uu,{}),"Widgets"]}),e.jsx(Ge,{visible:_,children:Object.entries(o).map(([h,v])=>e.jsxs("div",{className:"widget-item",children:[e.jsxs("div",{className:"name","data-tooltip":v.tooltip,children:[e.jsx(v.icon,{}),h]}),x[h]?e.jsx(H,{warn:!0,icon:!0,"data-tooltip":`Remove ${h} widget`,onClick:()=>S(h),children:e.jsx(ma,{})}):e.jsx(H,{main:!0,icon:!0,"data-tooltip":`Add ${h} widget`,onClick:()=>y(h),children:e.jsx(Fe,{})})]},h))})]})}),e.jsxs(Me,{children:[e.jsx(Ae,{}),i?a?e.jsx("div",{className:"widget-pager",children:_h.filter(h=>s[h]).map(h=>{const v=Ei[h],m=v.component;return e.jsxs("div",{className:"widget-page",children:[e.jsxs(Ve,{className:"widget-page-header",children:[e.jsx(v.icon,{}),h]}),e.jsx("div",{className:"widget-page-contents",children:e.jsx(m,{})})]},h)})}):e.jsx("div",{className:"grid-container",children:e.jsx("div",{className:"no-permissions-message",children:"Contact your admin for support"})}):e.jsxs("div",{className:"grid-container",ref:l,children:[!a&&e.jsx("div",{className:"no-permissions-message",children:"Contact your admin for support"}),a&&c!==null&&e.jsx(xh,{layout:j.map(h=>({...h,...Sh})),width:c,cols:10,autoSize:!0,useCSSTransforms:!0,rowHeight:100,isBounded:!0,isResizable:!0,isDraggable:!0,margin:Ch,onLayoutChange:p,draggableHandle:".drag-handle",draggableCancel:".no-drag",resizeHandles:["se"],resizeHandle:e.jsx(Bu,{style:{cursor:"se-resize"},className:"resize-handle"}),children:j.map(h=>{const v=o[h.i]?.component;return v?e.jsxs("div",{className:"grid-item",children:[e.jsxs(Ve,{className:"drag-handle",children:[e.jsx("span",{style:{flex:1},children:h.i}),e.jsx(H,{icon:!0,error:!0,className:"no-drag","data-tooltip":"Close widget",onClick:()=>S(h.i),children:e.jsx(Oe,{})})]}),e.jsx("div",{className:"drag-contents",children:e.jsx(v,{})})]},h.i):null})})]})]})]})},Di={"Minute(s)":1,"Hour(s)":60,"Day(s)":1440,"Week(s)":1440*7,"Month(s)":1440*30},Nh=["Permanent","Minute(s)","Hour(s)","Day(s)","Week(s)","Month(s)"],Ph=()=>{const[t,n]=Ne("/players/:id"),[r,s]=Je(),[a,i]=N.useState(null),[o,d]=N.useState(!1),[g,j]=N.useState(""),[S,y]=N.useState(10),[_,P]=N.useState("Permanent"),[x,p]=N.useState(!1),l=te(V.PlayerGet),c=te(V.PlayerBan),u=te(V.PlayerKick),h=te(V.PlayerUnban),v=te(V.PlayerClearBricks),{data:m,isLoading:b,refetch:f}=F.player.get.useQuery(n?.id??"",{enabled:!!n?.id&&l});N.useEffect(()=>{!b&&!m&&n?.id&&s("/players")},[b,m,n?.id]);const w=F.player.ban.useMutation(),R=F.player.kick.useMutation(),D=F.player.unban.useMutation(),O=F.player.clearBricks.useMutation(),k=async()=>{if(!m.id)return;p(!0);const M=_==="Permanent"?-1:S*Di[_];try{await w.mutateAsync({id:m.id,duration:M,reason:g})}catch(Y){console.error("Failed to ban player:",Y)}i(null),f(),p(!1)},q=async()=>{if(m.id){p(!0);try{await R.mutateAsync({id:m.id,reason:g})}catch(M){console.error("Failed to kick player:",M)}i(null),f(),p(!1)}},L=async()=>{if(m.id){p(!0);try{await D.mutateAsync({id:m.id})}catch(M){console.error("Failed to unban player:",M)}f(),p(!1)}},z=async()=>{if(m.id){p(!0);try{await O.mutateAsync({id:m.id})}catch(M){console.error("Failed to clear bricks:",M)}p(!1),i(null)}},I=N.useMemo(()=>_==="Permanent"?"Never":xu(Date.now()+Di[_]*60*1e3*S),[_,S]);return e.jsxs("div",{className:"player-inspector-container",children:[e.jsxs(ge,{attached:!0,children:[e.jsx("span",{className:"inspector-title",children:m?.name||"SELECT A PLAYER"}),m&&e.jsxs("div",{className:"widgets-container",children:[e.jsxs(H,{normal:!0,boxy:!0,onClick:()=>d(!o),children:[o?e.jsx(dt,{}):e.jsx(ut,{}),"Actions"]}),e.jsxs(Ge,{visible:o,children:[v&&e.jsxs(H,{boxy:!0,warn:!0,disabled:x,onClick:()=>{i("clear"),d(!1)},children:[e.jsx(Ha,{}),"Clear Bricks"]}),u&&!m.isHost&&m.isOnline&&e.jsxs(H,{boxy:!0,error:!0,disabled:x,onClick:()=>{i("kick"),d(!1)},children:[e.jsx(Ua,{}),"Kick"]}),h&&m.currentBan&&e.jsxs(H,{boxy:!0,warn:!0,disabled:x,onClick:()=>{L(),d(!1)},children:[e.jsx(Fu,{}),"Unban"]}),c&&!m.isHost&&e.jsxs(H,{boxy:!0,error:!0,disabled:x,onClick:()=>{i("ban"),d(!1)},children:[e.jsx(ot,{}),"Ban"]})]})]})]}),e.jsx("div",{className:"player-inspector",children:e.jsxs("div",{className:"player-view",children:[e.jsx(me,{active:b,size:"huge",children:"Loading Player"}),e.jsx("div",{className:"player-info",children:!b&&m&&e.jsxs(be,{children:[e.jsxs("div",{className:"stats",children:[e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Profile:"})," ",e.jsx("a",{href:"https://brickadia.com/users/"+m.id,target:"_blank",children:m.name})]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Display Name:"})," ",m.displayName||"unknown"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Host:"})," ",m.isHost?"Yes":"No"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Banned:"})," ",m.currentBan&&m.currentBan.duration<=0?e.jsx("span",{children:"Permanent"}):m.currentBan?e.jsxs("span",{children:[xe(m.currentBan.remainingTime)," of"," ",xe(m.currentBan.duration)," remaining"]}):e.jsx("span",{children:"No"})]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Number of status heartbeats this player has been part of",children:"Time Played:"})," ",ac(m.heartbeats)]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Date player was last seen",children:"Last Seen:"})," ",e.jsxs("span",{"data-tooltip":new Date(m.lastSeen),children:[xe(m.seenAgo)," ago"]})]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Date player was first seen",children:"First Seen:"})," ",e.jsxs("span",{"data-tooltip":new Date(m.created),children:[xe(m.createdAgo)," ago"]})]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Number of times this player has visited the server (new visits are registered if the player joins 3 hours after last seen)",children:"Visits:"})," ",m.sessions]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Number of server instances this player has joined",children:"Server Visits:"})," ",m.instances]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Bans:"})," ",m.banHistory.length]})]}),e.jsx("div",{className:"section-header","data-tooltip":"Roles this player has",children:"Roles"}),e.jsxs("div",{className:"option-list",children:[m.roles.map(M=>e.jsx("div",{className:"option-item",children:e.jsx("div",{className:"option-name",style:{color:"#"+M.color},children:M.name})},M.name)),e.jsx("div",{className:"option-item",children:e.jsx("div",{className:"option-name",style:{color:"white"},children:"Default"})})]}),e.jsx("div",{className:"section-header","data-tooltip":"Names this player has gone by historically",children:"Name History"}),e.jsxs("table",{className:"br-table name-history",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",width:"100%"},children:e.jsx("span",{children:"Name"})}),e.jsx("th",{children:"First Seen"})]})}),e.jsx("tbody",{children:m.nameHistory.map(M=>e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("div",{"data-tooltip":M.displayName?"Display Name":"Username",children:M.displayName||M.name}),M.displayName&&e.jsx("div",{"data-tooltip":"Username",className:"username",children:M.name})]}),e.jsx("td",{style:{textAlign:"right"},"data-tooltip":new Date(M.date),children:xe(M.ago)})]},M.date+M.name))})]}),e.jsx("div",{className:"section-header","data-tooltip":"Times this player has been banned from the server",children:"Ban History"}),e.jsxs("table",{className:"br-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:"100%",textAlign:"left"},children:"Reason"}),e.jsx("th",{children:"Length"}),e.jsx("th",{children:"Issuer"}),e.jsx("th",{children:"Date"})]})}),e.jsxs("tbody",{children:[m.banHistory.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,children:e.jsx("i",{children:"None"})})}),m.banHistory.map(M=>e.jsxs("tr",{children:[e.jsx("td",{className:"reason",children:M.reason}),e.jsx("td",{style:{textAlign:"right"},"data-tooltip":"Expires "+new Date(M.expires),children:0>=(M.duration??-1)?"Permanent":xe(M.duration)}),e.jsx("td",{children:e.jsx(at,{to:"/players/"+M.bannerId,children:M.bannerName||"missing name"})}),e.jsx("td",{style:{textAlign:"right"},"data-tooltip":new Date(M.created),children:La(M.created)})]},M.created))]})]}),e.jsx("div",{className:"section-header","data-tooltip":"Times this player has been booted from the server",children:"Kick History"}),e.jsxs("table",{className:"br-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:"100%",textAlign:"left"},children:"Reason"}),e.jsx("th",{children:"Issuer"}),e.jsx("th",{children:"Date"})]})}),e.jsxs("tbody",{children:[m.kickHistory.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,children:e.jsx("i",{children:"None"})})}),m.kickHistory.map(M=>e.jsxs("tr",{children:[e.jsx("td",{className:"reason",children:M.reason}),e.jsx("td",{children:e.jsx(at,{to:"/players/"+M.kickerId,children:M.kickerName||"missing name"})}),e.jsx("td",{style:{textAlign:"right"},"data-tooltip":new Date(M.created),children:La(M.created)})]},M.created))]})]})]})})]})}),e.jsxs(ct,{visible:!!a,children:[e.jsx(me,{active:x,size:"huge",children:"Running Action..."}),e.jsxs(kt,{visible:!x,children:[e.jsx(Ve,{children:a==="ban"?"Ban Player":a==="kick"?"Kick Player":"Clear Bricks"}),(a==="kick"||a==="ban")&&e.jsxs("div",{className:`popout-inputs ${a}`,children:[e.jsx(ce,{type:"text",placeholder:"Reason",value:g,onChange:j}),a==="ban"&&e.jsxs("div",{className:"ban-duration",style:{display:"flex"},children:[_!=="Permanent"&&e.jsx(ce,{placeholder:"Duration",type:"number",value:S,onChange:y}),e.jsx(da,{options:Nh,value:_,onChange:M=>P(M)})]})]}),a==="ban"&&e.jsxs(it,{children:["This ban will expire"," ",e.jsx("span",{style:{color:"white"},children:I}),"."]}),a==="clear"&&e.jsx(it,{children:e.jsxs("p",{style:{padding:20},children:["Are you sure you want to clear"," ",e.jsx("span",{style:{color:"white"},children:m?.name??"??"}),"'s bricks?"]})}),e.jsxs(Ce,{attached:!0,children:[a==="ban"&&e.jsxs(H,{error:!0,onClick:k,children:[e.jsx(ot,{}),"Ban"]}),a==="clear"&&e.jsxs(H,{warn:!0,onClick:z,children:[e.jsx(Ha,{}),"Clear Bricks"]}),a==="kick"&&e.jsxs(H,{error:!0,onClick:q,children:[e.jsx(Ua,{}),"Kick"]}),e.jsx("div",{style:{flex:1}}),e.jsxs(H,{normal:!0,onClick:()=>i(null),children:[e.jsx(Oe,{}),"Cancel"]})]})]})]})]})},Eh=()=>{const t=Ze(V.PlayerList);te(V.PlayerGet);const[n,r]=N.useState(!1),[s,a]=Je(),[i,o]=Ne("/players/:id?"),{onBack:d,swipeHandlers:g,inspectorOpen:j}=At(!!o?.id,"/players"),S=N.useRef({page:0,search:"",sort:"lastSeen",direction:-1,filterBanned:!1}),{page:y,search:_,sort:P,direction:x,filterBanned:p}=S.current,[l,c]=N.useState({page:S.current.page,search:S.current.search,sort:S.current.sort,direction:S.current.direction,filter:""}),u=()=>{c({page:S.current.page,search:S.current.search,sort:S.current.sort,direction:S.current.direction,filter:S.current.filterBanned?"banned":""})},[h,v]=N.useState(0),m=M=>{S.current.search=M,z(),v(Y=>Y+1)},b=M=>{typeof M=="function"&&(M=M(S.current.page)),S.current.page=M,u()},f=M=>{typeof M=="function"&&(M=M(S.current.direction)),S.current.direction=M},w=M=>{S.current.filterBanned=M,z()},{data:R,isLoading:D,refetch:O}=F.player.list.useQuery(l,{placeholderData:M=>M}),k=R?.players??[],q=R?.total??0,L=R?.pages??0,z=N.useMemo(()=>ic(()=>{S.current.page=0,u()},500),[]),I=M=>{M==P?f(Y=>Y*-1):(S.current.sort=M,f(M==="name"?1:-1)),u()};return t?e.jsxs(e.Fragment,{children:[e.jsx(De,{title:"Players",className:"players-view",onBack:d,children:e.jsxs("div",{className:"widgets-container",children:[e.jsxs(H,{normal:!0,boxy:!0,"data-tooltip":"Player list filters",onClick:()=>r(M=>!M),children:[e.jsx(Gu,{}),"Filters"]}),e.jsx(Ge,{visible:n,children:e.jsxs("div",{className:"widget-item","data-tooltip":"Filter by banned players",children:[e.jsxs("div",{className:"name",children:[e.jsx(ot,{}),"Banned"]}),e.jsx(_e,{onChange:w,value:p})]})})]})}),e.jsxs(Me,{children:[e.jsx(Ae,{}),e.jsxs("div",{className:`generic-container players-container ${j?"inspector-open":""}`,...g,children:[e.jsxs("div",{className:"player-table-container",children:[e.jsxs(ge,{attached:!0,children:[e.jsx(ce,{type:"text",placeholder:"Search Players...",value:_,onChange:m}),e.jsx("span",{style:{flex:1}}),e.jsx(H,{icon:!0,normal:!0,"data-tooltip":"Refresh player list",onClick:()=>O(),children:e.jsx(Lt,{})})]}),e.jsxs("div",{className:"players-list",children:[e.jsx(be,{children:e.jsxs("table",{className:"br-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",width:"100%"},onClick:()=>I("name"),children:e.jsxs("span",{children:["Name",e.jsx(we,{name:"name",sort:P,direction:x})]})}),e.jsx("th",{onClick:()=>I("heartbeats"),"data-tooltip":"Number of heartbeats the player has been part of (minutely)",children:e.jsxs("span",{children:["Played",e.jsx(we,{name:"heartbeats",sort:P,direction:x})]})}),e.jsx("th",{onClick:()=>I("lastSeen"),"data-tooltip":"When the player was last seen",children:e.jsxs("span",{children:["Seen",e.jsx(we,{name:"lastSeen",sort:P,direction:x})]})}),e.jsx("th",{onClick:()=>I("created"),"data-tooltip":"When the player joined",children:e.jsxs("span",{children:["Joined",e.jsx(we,{name:"created",sort:P,direction:x})]})}),e.jsx("th",{onClick:()=>I("sessions"),"data-tooltip":"Number of Visits",children:e.jsxs("span",{className:"icon-cell",children:[e.jsx($u,{className:"label",size:"30"}),e.jsx(we,{name:"sessions",sort:P,direction:x})]})})]})}),e.jsx("tbody",{children:k.map(M=>e.jsxs("tr",{onClick:()=>a(`/players/${M.id}`),className:M.id===o?.id?"active":"",children:[e.jsx("td",{className:`player-name ${M.ban?"ban":""}`,children:e.jsxs("div",{className:"player-name-container",children:[e.jsxs("div",{children:[e.jsx("div",{"data-tooltip":M.displayName?"Display Name":"Username",children:M.displayName||M.name}),M.displayName&&e.jsx("div",{className:"username","data-tooltip":"Username",children:M.name})]}),M.ban&&e.jsx(ot,{size:"18"})]})}),e.jsx("td",{style:{textAlign:"right"},children:ac(M.heartbeats)}),e.jsx("td",{style:{textAlign:"right"},"data-tooltip":new Date(M.lastSeen),children:xe(M.seenAgo)}),e.jsx("td",{style:{textAlign:"right"},"data-tooltip":new Date(M.created),children:xe(M.createdAgo)}),e.jsx("td",{style:{textAlign:"right"},children:M.sessions})]},M.id))})]})}),e.jsxs(Ce,{className:"pagination-footer",children:[e.jsx(H,{icon:!0,normal:!0,disabled:y===0,onClick:()=>{b(0)},children:e.jsx(cc,{})}),e.jsx(H,{icon:!0,normal:!0,disabled:y===0,onClick:()=>b(M=>Math.max(0,M-1)),children:e.jsx(Kt,{})}),e.jsxs("div",{className:"current-page",children:[e.jsxs("div",{children:["Page ",y+1," of ",L]}),e.jsxs("div",{children:["Showing ",k.length," of ",q]})]}),e.jsx(H,{icon:!0,normal:!0,disabled:y>=L-1,onClick:()=>b(M=>Math.min(k.length-1,M+1)),children:e.jsx(Gt,{})}),e.jsx(H,{icon:!0,normal:!0,disabled:y>=L-1,onClick:()=>b(k.length-1),children:e.jsx(uc,{})})]}),e.jsx(me,{active:D,size:"huge",children:"Loading Players"})]})]}),e.jsxs(rr,{children:[e.jsx(ve,{path:"/players/:id",component:Ph}),e.jsx(ve,{children:e.jsxs("div",{className:"player-inspector-container",children:[e.jsx(ge,{attached:!0,children:"SELECT A PLAYER"}),e.jsx("div",{className:"player-inspector"})]})})]})]})]})]}):null},Oh=(t,n)=>{try{return JSON.stringify(t)===JSON.stringify(n)}catch{return!1}},Dh=()=>{const[t,n]=Ne("/plugins/:id"),[r,s]=N.useState(null),[a,i]=N.useState({}),[o,d]=N.useState(!!r?.path),[g,j]=N.useState(!1),[S,y]=N.useState({}),_=te(V.PluginGet),P=te(V.PluginLoad),x=te(V.PluginUnload),p=te(V.PluginToggle),l=te(V.PluginConfig),c=F.plugin.get.useQuery({shortPath:n?.id??""},{enabled:!!n?.id&&_});N.useEffect(()=>{c.data?(s(c.data),i(c.data.config),d(!1)):c.isError&&d(!1)},[c.data,c.isError]);const u=F.plugin.load.useMutation(),h=F.plugin.unload.useMutation(),v=F.plugin.toggle.useMutation(),m=F.plugin.config.useMutation(),b=async()=>{n?.id&&(j(!0),await u.mutateAsync({shortPath:n.id}),await c.refetch(),j(!1))},f=async()=>{n?.id&&(j(!0),await h.mutateAsync({shortPath:n.id}),await c.refetch(),j(!1))},w=async()=>{if(!n?.id)return;j(!0),await h.mutateAsync({shortPath:n.id})&&await u.mutateAsync({shortPath:n.id}),await c.refetch(),j(!1)},R=async L=>{n?.id&&(j(!0),await v.mutateAsync({shortPath:n.id,enabled:L}),await c.refetch(),j(!1))},D=N.useRef(a);D.current=a;const O=N.useRef(r);O.current=r,F.plugin.onStatus.useSubscription(void 0,{enabled:_,onError:Qe,onData(L){L.shortPath===O.current?.path&&s(z=>({...z,...L}))}});const k=N.useMemo(()=>ic(async()=>{if(!n?.id||!O.current)return;const L={},z=D.current,I=O.current.path;for(const M in O.current?.config??{})O.current?.config[M]!=z[M]&&(L[M]=!0),await m.mutateAsync({shortPath:n?.id,config:z})&&(y(L),setTimeout(()=>{y({}),s(G=>G?.path===I?{...G,config:z}:G)}))},500),[n?.id]),q=(L,z)=>{!r||!a||(i(I=>({...I,[L]:z})),k())};return e.jsxs("div",{className:"plugin-view",children:[e.jsx(me,{active:o,size:"huge",children:"Loading Plugin"}),e.jsx("div",{className:"plugin-info",children:!o&&r&&e.jsxs(be,{children:[e.jsxs("div",{className:"stats",children:[e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Plugin name",children:"Name:"})," ",r.name]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Plugin creator",children:"Author:"})," ",r.documentation?.author??"unknown"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Description:"})," ",r.documentation?.description??"none"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"The folder this plugin runs in",children:"Folder:"})," ",r.path]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"The type of plugin this is",children:"Format:"})," ",r.format]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Number of objects in the plugin's storage",children:"Stored Objects:"})," ",r.objCount]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Plugin can be started",children:"Enabled:"})," ",r.isEnabled?"Yes":"No"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Plugin is running",children:"Loaded:"})," ",r.isLoaded?"Yes":"No"]})]}),e.jsx("div",{className:"section-header","data-tooltip":"Ways to configure the plugin. Changes take place the next time a plugin is loaded.",children:"Configs"}),e.jsxs("div",{className:"option-list",children:[Object.keys(r.documentation.config??{}).length===0&&e.jsx("div",{className:"option-item",children:e.jsx("i",{className:"option-name",children:"None"})}),Object.entries(r.documentation.config??{}).map(([L,z])=>e.jsx("div",{className:"option-item config",children:e.jsxs("div",{className:"option-input",children:[e.jsxs("div",{className:"option-label","data-tooltip":z.description,children:[L,e.jsxs("span",{className:`saved-note ${S[L]?"show":""}`,children:["SAVED ",e.jsx(Yt,{size:"20"})]})]}),e.jsxs("div",{className:"option-value",children:[["string","password","number"].includes(z.type)&&e.jsx(ce,{type:z.type==="string"?"text":z.type,disabled:!l,value:a[L],onChange:I=>q(L,I)}),z.type==="list"&&e.jsx(hu,{options:"options"in z?z.options:void 0,type:z.itemType,disabled:!l,value:a[L],onChange:I=>q(L,I)}),z.type==="players"&&e.jsx(fu,{disabled:!l,value:a[L],onChange:I=>q(L,I)}),z.type==="role"&&e.jsx(pu,{disabled:!l,value:a[L],onChange:I=>q(L,I)}),z.type==="enum"&&e.jsx(da,{options:z.options,disabled:!l,value:a[L],onChange:I=>q(L,I)}),z.type==="boolean"&&e.jsx(_e,{disabled:!l,value:a[L],onChange:I=>q(L,I)}),l&&!Oh(z.default,a[L])&&e.jsx(Yu,{onClick:()=>q(L,z.default),className:"reset-button","data-tooltip":"Reset to default value"})]})]})},L))]}),e.jsx("div",{className:"section-header","data-tooltip":"Ways to control the plugin",children:"Commands"}),e.jsxs("div",{className:"option-list",children:[(r.documentation.commands??[]).length===0&&e.jsx("div",{className:"option-item",children:e.jsx("i",{className:"option-name",children:"None"})}),(r.documentation.commands||[]).map(L=>e.jsxs("div",{className:"option-item",children:[e.jsx("div",{className:"option-name","data-tooltip":L.description,children:L.name}),e.jsx("div",{className:"option-args",children:(L.args||[]).map(z=>e.jsx("div",{className:`option-arg ${z.required?"required":""}`,"data-tooltip":(z.required?"(required) ":"")+z.description,children:z.name},z.name))})]},L.name))]})]})}),e.jsxs(Ce,{attached:!0,children:[P&&r?.isEnabled&&!r.isLoaded&&e.jsxs(H,{main:!0,disabled:g,"data-tooltip":"Start the plugin",onClick:()=>b(),children:[e.jsx($t,{}),"Load"]}),P&&x&&r?.isEnabled&&r.isLoaded&&e.jsxs(H,{warn:!0,"data-tooltip":"Stop, then start the plugin",disabled:g,onClick:()=>w(),children:[e.jsx(dc,{}),"Reload"]}),e.jsx("span",{style:{flex:1}}),x&&r?.isEnabled&&r.isLoaded&&e.jsxs(H,{error:!0,disabled:g,"data-tooltip":"Stop the plugin",onClick:()=>f(),children:[e.jsx(hc,{}),"Unload"]}),p&&r&&!r?.isEnabled&&e.jsxs(H,{main:!0,"data-tooltip":"Allow the plugin to be started",disabled:g,onClick:()=>R(!0),children:[e.jsx(Fe,{}),"Enable"]}),p&&r?.isEnabled&&!r.isLoaded&&e.jsxs(H,{error:!0,"data-tooltip":"Prevent the plugin from being started",disabled:g,onClick:()=>R(!1),children:[e.jsx(ma,{}),"Disable"]})]})]})},Mi=t=>{const n=(t.isLoaded?2:0)+(t.isEnabled?1:0),r=["disabled","broken","bugged","running"][n],s=["Plugin is disabled","Plugin is enabled but not running","Plugin is running but not enabled","Plugin is running"][n],a=[Xu,Vu,Qu,Ju][n];return{...t,state:n,status:r,tooltip:s,icon:a}},Mh=()=>{const t=Ze(V.PluginList);te(V.PluginGet);const[n,r]=N.useState(""),[s,a]=N.useState(!1),[i,o]=N.useState([]),d=te(V.PluginReloadAll),[g,j]=Ne("/plugins/:id?"),{onBack:S,swipeHandlers:y,inspectorOpen:_}=At(!!j?.id,"/plugins"),P=N.useMemo(()=>i.find(v=>v.path===j?.id)?.name??"SELECT A PLUGIN",[i,j?.id]),x=F.plugin.list.useQuery();N.useEffect(()=>{x.data&&o(x.data.map(Mi))},[x.data]);const p=x.isLoading,l=F.plugin.reloadAll.useMutation(),c=()=>{x.refetch()},u=async()=>{a(!0),await l.mutateAsync(),a(!1),c()},h=v=>v.name.toLowerCase().includes(n.toLowerCase());return F.plugin.onStatus.useSubscription(void 0,{enabled:t,onError:Qe,onData(v){const m=Mi(v);o(b=>b.map(f=>f.path===v.shortPath?{...f,...m}:f))}}),t?e.jsxs(e.Fragment,{children:[e.jsxs(De,{title:"Plugins",onBack:S,children:[e.jsx("span",{style:{flex:1}}),d&&e.jsxs(H,{warn:!0,disabled:s,onClick:u,"data-tooltip":"Reload all plugins, this may clear current plugin progress",children:[e.jsx(Ku,{}),"Reload Plugins"]})]}),e.jsxs(Me,{children:[e.jsx(Ae,{}),e.jsxs("div",{className:`generic-container plugins-container ${_?"inspector-open":""}`,...y,children:[e.jsxs("div",{className:"plugins-list-container",children:[e.jsxs(ge,{children:[e.jsx(ce,{type:"text",placeholder:"Search Plugins...",value:n,onChange:v=>r(v)}),e.jsx("span",{style:{flex:1}}),e.jsx(H,{icon:!0,normal:!0,"data-tooltip":"Refresh plugin list",onClick:c,children:e.jsx(Lt,{})})]}),e.jsxs("div",{className:"plugins-list",children:[e.jsx(be,{children:i.map(v=>h(v)&&e.jsxs(at,{href:"/plugins/"+v.path,"data-tooltip":v.documentation?.description,className:`plugin-item ${j?.id===v.path?"selected":""}`,children:[e.jsx(v.icon,{className:v.status,"data-tooltip":v.tooltip}),v.name]},v.path))}),e.jsx(me,{active:p,size:"huge",children:"Loading Plugins"})]})]}),e.jsxs("div",{className:"plugin-inspector-container",children:[e.jsx(ge,{attached:!0,children:P}),e.jsx("div",{className:"plugin-inspector",children:e.jsx(Dh,{})})]})]})]})]}):null},Se=qt({starting:!1,started:!1,stopping:!1,loading:!0}),Lc=()=>{const t=te(V.ServerStatus),{data:n}=F.server.started.useQuery(void 0,{enabled:t});return N.useEffect(()=>{n&&Se.set({started:n.started,starting:n.starting,stopping:n.stopping,loading:!1})},[n]),F.server.onStatus.useSubscription(void 0,{enabled:t,onError:Qe,onData(r){Se.set({started:r.started,starting:r.starting,stopping:r.stopping,loading:!1})}}),ye(Se)},Ah=()=>{Se.set({...Se.get(),loading:!0}),Mt.server.start.mutate()},qh=()=>{Se.set({...Se.get(),loading:!0}),Mt.server.stop.mutate()},kh=()=>{Se.set({...Se.get(),loading:!0}),Mt.server.restart.mutate()},Th=()=>{Se.set({...Se.get(),loading:!0}),Mt.server.update.run.mutate()};function Lh(t){const n=Math.floor((Date.now()-t)/1e3);if(n<60)return"just now";const r=Math.floor(n/60);return r<60?`${r}m ago`:`${Math.floor(r/60)}h ago`}const zh=()=>{const t=Ze(V.ServerStatus),{started:n,stopping:r,starting:s,loading:a}=Lc(),i=Be(),o=te(V.ServerStart),d=te(V.ServerStop),g=te(V.ServerRestart),j=te(V.ServerUpdateRun),S=te(V.ServerAutorestartGet),y=te(V.ServerUpdateCheck),_=te(V.ServerAutorestartSet),P=te(V.WorldSave),[x,p]=N.useState(null),l=ye(fa),[c,u]=N.useState(l?.update?.lastCheck??null);N.useEffect(()=>{u(l?.update?.lastCheck??null)},[l?.update?.lastCheck]);const[h,v]=N.useState(!1),[m,b]=N.useState(null),[f,w]=N.useState(!1),{data:R}=F.server.autoRestart.get.useQuery(void 0,{enabled:S});N.useEffect(()=>{R&&p(R)},[R]);const D=l?.update?.canCheck??!1,O=F.server.update.check.useQuery(void 0,{enabled:!1}),k=N.useCallback(()=>{!D||!y||(v(!0),O.refetch().then(({data:G})=>{u(G??null),b(Date.now()),v(!1)}))},[D,y,O]),q=F.server.autoRestart.set.useMutation(),L=N.useCallback(async()=>{if(!x)return;const G={type:"autoRestartConfig",maxUptime:Math.round(Math.max(1,Math.min(x.maxUptime,168))),maxUptimeEnabled:x.maxUptimeEnabled,emptyUptime:Math.round(Math.max(1,Math.min(x.emptyUptime,168))),emptyUptimeEnabled:x.emptyUptimeEnabled,dailyHour:Math.round(Math.max(0,Math.min(x.dailyHour,23))),dailyHourEnabled:x.dailyHourEnabled,announcementEnabled:x.announcementEnabled,playersEnabled:x.playersEnabled,saveWorld:x.saveWorld,autoUpdateEnabled:x.autoUpdateEnabled??!0,autoUpdateIntervalMins:Math.round(Math.max(10,Math.min(x.autoUpdateIntervalMins??60,1/0))),crashRestartEnabled:x.crashRestartEnabled??!0};q.mutate(G)},[x,q]),z=F.world.save.useMutation(),I=async()=>{w(!0),await z.mutateAsync({}),w(!1)},M=Su(L),Y=G=>X=>{x&&(p(ne=>({...ne,[G]:X})),M.fire())};return t?e.jsxs(e.Fragment,{children:[e.jsx(De,{title:"Server",children:D&&y&&e.jsx(H,{main:!!c,normal:!c,"data-tooltip":"Check for updates",disabled:h,onClick:k,children:h?e.jsxs(e.Fragment,{children:[e.jsx(Zu,{className:"spinning"}),"Checking..."]}):c===!0?e.jsxs(e.Fragment,{children:[e.jsx(ed,{}),"Update Available"]}):e.jsxs(e.Fragment,{children:[e.jsx(td,{}),"Check for Update"]})})}),e.jsxs(Me,{children:[e.jsx(Ae,{}),e.jsxs("div",{className:"generic-container server-container",children:[e.jsxs(ge,{className:"server-status",children:[e.jsx("span",{className:"status-label",children:"Server Status: "}),e.jsx("span",{className:"status-value",children:s?"starting":r?"stopping":n?"started":"stopped"}),D&&y&&c!==null&&e.jsx("span",{className:"status-update",children:c?"Update available":`Up to date${m?` (checked ${Lh(m)})`:""}`})]}),e.jsxs("div",{className:"buttons",children:[o&&e.jsxs(H,{main:!0,"data-tooltip":"Start the server",disabled:s||r||a||n,onClick:()=>i.prompt("start the server").then(G=>G&&Ah()),children:[e.jsx($t,{}),"Start"]}),d&&e.jsxs(H,{error:!0,"data-tooltip":"Stop the server",disabled:s||r||a||!n,onClick:()=>i.prompt("stop the server").then(G=>G&&qh()),children:[e.jsx(hc,{}),"Stop"]}),g&&e.jsxs(H,{warn:!0,"data-tooltip":"Reloads the server's world. Saves minigames/environment/bricks if 'Save World' is enabled below.",disabled:s||r||a,onClick:()=>i.prompt("restart the server").then(G=>G&&kh()),children:[e.jsx(dc,{}),"Restart"]}),P&&e.jsxs(H,{info:!0,"data-tooltip":"Save the current world.",disabled:s||r||a||f,onClick:I,children:[e.jsx(Tt,{}),"Save World"]}),j&&l?.isSteam&&e.jsxs(H,{normal:!c,main:c===!0,"data-tooltip":`Stop and update the server even if there are no updates available.
4
+ `,f.getElementsByTagName("head")[0].appendChild(w)),f.body&&m(f.body,"react-draggable-transparent-selection")}function h(f){window.requestAnimationFrame?window.requestAnimationFrame(()=>{v(f)}):v(f)}function v(f){if(f)try{if(f.body&&b(f.body,"react-draggable-transparent-selection"),f.selection)f.selection.empty();else{const w=(f.defaultView||window).getSelection();w&&w.type!=="Caret"&&w.removeAllRanges()}}catch{}}function m(f,w){f.classList?f.classList.add(w):f.className.match(new RegExp(`(?:^|\\s)${w}(?!\\S)`))||(f.className+=` ${w}`)}function b(f,w){f.classList?f.classList.remove(w):f.className=f.className.replace(new RegExp(`(?:^|\\s)${w}(?!\\S)`,"g"),"")}return pe}var Ee={},ci;function Cc(){if(ci)return Ee;ci=1,Object.defineProperty(Ee,"__esModule",{value:!0}),Ee.canDragX=a,Ee.canDragY=i,Ee.createCoreData=d,Ee.createDraggableData=g,Ee.getBoundPosition=r,Ee.getControlPosition=o,Ee.snapToGrid=s;var t=cr(),n=_a();function r(y,_,P){if(!y.props.bounds)return[_,P];let{bounds:x}=y.props;x=typeof x=="string"?x:j(x);const p=S(y);if(typeof x=="string"){const{ownerDocument:l}=p,c=l.defaultView;let u;if(x==="parent"?u=p.parentNode:u=p.getRootNode().querySelector(x),!(u instanceof c.HTMLElement))throw new Error('Bounds selector "'+x+'" could not find an element.');const h=u,v=c.getComputedStyle(p),m=c.getComputedStyle(h);x={left:-p.offsetLeft+(0,t.int)(m.paddingLeft)+(0,t.int)(v.marginLeft),top:-p.offsetTop+(0,t.int)(m.paddingTop)+(0,t.int)(v.marginTop),right:(0,n.innerWidth)(h)-(0,n.outerWidth)(p)-p.offsetLeft+(0,t.int)(m.paddingRight)-(0,t.int)(v.marginRight),bottom:(0,n.innerHeight)(h)-(0,n.outerHeight)(p)-p.offsetTop+(0,t.int)(m.paddingBottom)-(0,t.int)(v.marginBottom)}}return(0,t.isNum)(x.right)&&(_=Math.min(_,x.right)),(0,t.isNum)(x.bottom)&&(P=Math.min(P,x.bottom)),(0,t.isNum)(x.left)&&(_=Math.max(_,x.left)),(0,t.isNum)(x.top)&&(P=Math.max(P,x.top)),[_,P]}function s(y,_,P){const x=Math.round(_/y[0])*y[0],p=Math.round(P/y[1])*y[1];return[x,p]}function a(y){return y.props.axis==="both"||y.props.axis==="x"}function i(y){return y.props.axis==="both"||y.props.axis==="y"}function o(y,_,P){const x=typeof _=="number"?(0,n.getTouch)(y,_):null;if(typeof _=="number"&&!x)return null;const p=S(P),l=P.props.offsetParent||p.offsetParent||p.ownerDocument.body;return(0,n.offsetXYFromParent)(x||y,l,P.props.scale)}function d(y,_,P){const x=!(0,t.isNum)(y.lastX),p=S(y);return x?{node:p,deltaX:0,deltaY:0,lastX:_,lastY:P,x:_,y:P}:{node:p,deltaX:_-y.lastX,deltaY:P-y.lastY,lastX:y.lastX,lastY:y.lastY,x:_,y:P}}function g(y,_){const P=y.props.scale;return{node:_.node,x:y.state.x+_.deltaX/P,y:y.state.y+_.deltaY/P,deltaX:_.deltaX/P,deltaY:_.deltaY/P,lastX:y.state.x,lastY:y.state.y}}function j(y){return{left:y.left,top:y.top,right:y.right,bottom:y.bottom}}function S(y){const _=y.findDOMNode();if(!_)throw new Error("<DraggableCore>: Unmounted during event!");return _}return Ee}var yt={},Wt={},ui;function Rc(){if(ui)return Wt;ui=1,Object.defineProperty(Wt,"__esModule",{value:!0}),Wt.default=t;function t(){}return Wt}var di;function Bd(){if(di)return yt;di=1,Object.defineProperty(yt,"__esModule",{value:!0}),yt.default=void 0;var t=g(Pe()),n=d(Ye()),r=d(va()),s=_a(),a=Cc(),i=cr(),o=d(Rc());function d(p){return p&&p.__esModule?p:{default:p}}function g(p,l){if(typeof WeakMap=="function")var c=new WeakMap,u=new WeakMap;return(g=function(h,v){if(!v&&h&&h.__esModule)return h;var m,b,f={__proto__:null,default:h};if(h===null||typeof h!="object"&&typeof h!="function")return f;if(m=v?u:c){if(m.has(h))return m.get(h);m.set(h,f)}for(const w in h)w!=="default"&&{}.hasOwnProperty.call(h,w)&&((b=(m=Object.defineProperty)&&Object.getOwnPropertyDescriptor(h,w))&&(b.get||b.set)?m(f,w,b):f[w]=h[w]);return f})(p,l)}function j(p,l,c){return(l=S(l))in p?Object.defineProperty(p,l,{value:c,enumerable:!0,configurable:!0,writable:!0}):p[l]=c,p}function S(p){var l=y(p,"string");return typeof l=="symbol"?l:l+""}function y(p,l){if(typeof p!="object"||!p)return p;var c=p[Symbol.toPrimitive];if(c!==void 0){var u=c.call(p,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(p)}const _={touch:{start:"touchstart",move:"touchmove",stop:"touchend"},mouse:{start:"mousedown",move:"mousemove",stop:"mouseup"}};let P=_.mouse,x=class extends t.Component{constructor(){super(...arguments),j(this,"dragging",!1),j(this,"lastX",NaN),j(this,"lastY",NaN),j(this,"touchIdentifier",null),j(this,"mounted",!1),j(this,"handleDragStart",l=>{if(this.props.onMouseDown(l),!this.props.allowAnyClick&&typeof l.button=="number"&&l.button!==0)return!1;const c=this.findDOMNode();if(!c||!c.ownerDocument||!c.ownerDocument.body)throw new Error("<DraggableCore> not mounted on DragStart!");const{ownerDocument:u}=c;if(this.props.disabled||!(l.target instanceof u.defaultView.Node)||this.props.handle&&!(0,s.matchesSelectorAndParentsTo)(l.target,this.props.handle,c)||this.props.cancel&&(0,s.matchesSelectorAndParentsTo)(l.target,this.props.cancel,c))return;l.type==="touchstart"&&!this.props.allowMobileScroll&&l.preventDefault();const h=(0,s.getTouchIdentifier)(l);this.touchIdentifier=h;const v=(0,a.getControlPosition)(l,h,this);if(v==null)return;const{x:m,y:b}=v,f=(0,a.createCoreData)(this,m,b);(0,o.default)("DraggableCore: handleDragStart: %j",f),(0,o.default)("calling",this.props.onStart),!(this.props.onStart(l,f)===!1||this.mounted===!1)&&(this.props.enableUserSelectHack&&(0,s.addUserSelectStyles)(u),this.dragging=!0,this.lastX=m,this.lastY=b,(0,s.addEvent)(u,P.move,this.handleDrag),(0,s.addEvent)(u,P.stop,this.handleDragStop))}),j(this,"handleDrag",l=>{const c=(0,a.getControlPosition)(l,this.touchIdentifier,this);if(c==null)return;let{x:u,y:h}=c;if(Array.isArray(this.props.grid)){let b=u-this.lastX,f=h-this.lastY;if([b,f]=(0,a.snapToGrid)(this.props.grid,b,f),!b&&!f)return;u=this.lastX+b,h=this.lastY+f}const v=(0,a.createCoreData)(this,u,h);if((0,o.default)("DraggableCore: handleDrag: %j",v),this.props.onDrag(l,v)===!1||this.mounted===!1){try{this.handleDragStop(new MouseEvent("mouseup"))}catch{const f=document.createEvent("MouseEvents");f.initMouseEvent("mouseup",!0,!0,window,0,0,0,0,0,!1,!1,!1,!1,0,null),this.handleDragStop(f)}return}this.lastX=u,this.lastY=h}),j(this,"handleDragStop",l=>{if(!this.dragging)return;const c=(0,a.getControlPosition)(l,this.touchIdentifier,this);if(c==null)return;let{x:u,y:h}=c;if(Array.isArray(this.props.grid)){let f=u-this.lastX||0,w=h-this.lastY||0;[f,w]=(0,a.snapToGrid)(this.props.grid,f,w),u=this.lastX+f,h=this.lastY+w}const v=(0,a.createCoreData)(this,u,h);if(this.props.onStop(l,v)===!1||this.mounted===!1)return!1;const b=this.findDOMNode();b&&this.props.enableUserSelectHack&&(0,s.scheduleRemoveUserSelectStyles)(b.ownerDocument),(0,o.default)("DraggableCore: handleDragStop: %j",v),this.dragging=!1,this.lastX=NaN,this.lastY=NaN,b&&((0,o.default)("DraggableCore: Removing handlers"),(0,s.removeEvent)(b.ownerDocument,P.move,this.handleDrag),(0,s.removeEvent)(b.ownerDocument,P.stop,this.handleDragStop))}),j(this,"onMouseDown",l=>(P=_.mouse,this.handleDragStart(l))),j(this,"onMouseUp",l=>(P=_.mouse,this.handleDragStop(l))),j(this,"onTouchStart",l=>(P=_.touch,this.handleDragStart(l))),j(this,"onTouchEnd",l=>(P=_.touch,this.handleDragStop(l)))}componentDidMount(){this.mounted=!0;const l=this.findDOMNode();l&&(0,s.addEvent)(l,_.touch.start,this.onTouchStart,{passive:!1})}componentWillUnmount(){this.mounted=!1;const l=this.findDOMNode();if(l){const{ownerDocument:c}=l;(0,s.removeEvent)(c,_.mouse.move,this.handleDrag),(0,s.removeEvent)(c,_.touch.move,this.handleDrag),(0,s.removeEvent)(c,_.mouse.stop,this.handleDragStop),(0,s.removeEvent)(c,_.touch.stop,this.handleDragStop),(0,s.removeEvent)(l,_.touch.start,this.onTouchStart,{passive:!1}),this.props.enableUserSelectHack&&(0,s.scheduleRemoveUserSelectStyles)(c)}}findDOMNode(){return this.props?.nodeRef?this.props?.nodeRef?.current:r.default.findDOMNode(this)}render(){return t.cloneElement(t.Children.only(this.props.children),{onMouseDown:this.onMouseDown,onMouseUp:this.onMouseUp,onTouchEnd:this.onTouchEnd})}};return yt.default=x,j(x,"displayName","DraggableCore"),j(x,"propTypes",{allowAnyClick:n.default.bool,allowMobileScroll:n.default.bool,children:n.default.node.isRequired,disabled:n.default.bool,enableUserSelectHack:n.default.bool,offsetParent:function(p,l){if(p[l]&&p[l].nodeType!==1)throw new Error("Draggable's offsetParent must be a DOM Node.")},grid:n.default.arrayOf(n.default.number),handle:n.default.string,cancel:n.default.string,nodeRef:n.default.object,onStart:n.default.func,onDrag:n.default.func,onStop:n.default.func,onMouseDown:n.default.func,scale:n.default.number,className:i.dontSetMe,style:i.dontSetMe,transform:i.dontSetMe}),j(x,"defaultProps",{allowAnyClick:!1,allowMobileScroll:!1,disabled:!1,enableUserSelectHack:!0,onStart:function(){},onDrag:function(){},onStop:function(){},onMouseDown:function(){},scale:1}),yt}var hi;function Fd(){return hi||(hi=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"DraggableCore",{enumerable:!0,get:function(){return g.default}}),t.default=void 0;var n=y(Pe()),r=S(Ye()),s=S(va()),a=lr(),i=_a(),o=Cc(),d=cr(),g=S(Bd()),j=S(Rc());function S(c){return c&&c.__esModule?c:{default:c}}function y(c,u){if(typeof WeakMap=="function")var h=new WeakMap,v=new WeakMap;return(y=function(m,b){if(!b&&m&&m.__esModule)return m;var f,w,R={__proto__:null,default:m};if(m===null||typeof m!="object"&&typeof m!="function")return R;if(f=b?v:h){if(f.has(m))return f.get(m);f.set(m,R)}for(const D in m)D!=="default"&&{}.hasOwnProperty.call(m,D)&&((w=(f=Object.defineProperty)&&Object.getOwnPropertyDescriptor(m,D))&&(w.get||w.set)?f(R,D,w):R[D]=m[D]);return R})(c,u)}function _(){return _=Object.assign?Object.assign.bind():function(c){for(var u=1;u<arguments.length;u++){var h=arguments[u];for(var v in h)({}).hasOwnProperty.call(h,v)&&(c[v]=h[v])}return c},_.apply(null,arguments)}function P(c,u,h){return(u=x(u))in c?Object.defineProperty(c,u,{value:h,enumerable:!0,configurable:!0,writable:!0}):c[u]=h,c}function x(c){var u=p(c,"string");return typeof u=="symbol"?u:u+""}function p(c,u){if(typeof c!="object"||!c)return c;var h=c[Symbol.toPrimitive];if(h!==void 0){var v=h.call(c,u);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(c)}class l extends n.Component{static getDerivedStateFromProps(u,h){let{position:v}=u,{prevPropsPosition:m}=h;return v&&(!m||v.x!==m.x||v.y!==m.y)?((0,j.default)("Draggable: getDerivedStateFromProps %j",{position:v,prevPropsPosition:m}),{x:v.x,y:v.y,prevPropsPosition:{...v}}):null}constructor(u){super(u),P(this,"onDragStart",(h,v)=>{if((0,j.default)("Draggable: onDragStart: %j",v),this.props.onStart(h,(0,o.createDraggableData)(this,v))===!1)return!1;this.setState({dragging:!0,dragged:!0})}),P(this,"onDrag",(h,v)=>{if(!this.state.dragging)return!1;(0,j.default)("Draggable: onDrag: %j",v);const m=(0,o.createDraggableData)(this,v),b={x:m.x,y:m.y,slackX:0,slackY:0};if(this.props.bounds){const{x:w,y:R}=b;b.x+=this.state.slackX,b.y+=this.state.slackY;const[D,O]=(0,o.getBoundPosition)(this,b.x,b.y);b.x=D,b.y=O,b.slackX=this.state.slackX+(w-b.x),b.slackY=this.state.slackY+(R-b.y),m.x=b.x,m.y=b.y,m.deltaX=b.x-this.state.x,m.deltaY=b.y-this.state.y}if(this.props.onDrag(h,m)===!1)return!1;this.setState(b)}),P(this,"onDragStop",(h,v)=>{if(!this.state.dragging||this.props.onStop(h,(0,o.createDraggableData)(this,v))===!1)return!1;(0,j.default)("Draggable: onDragStop: %j",v);const b={dragging:!1,slackX:0,slackY:0};if(!!this.props.position){const{x:w,y:R}=this.props.position;b.x=w,b.y=R}this.setState(b)}),this.state={dragging:!1,dragged:!1,x:u.position?u.position.x:u.defaultPosition.x,y:u.position?u.position.y:u.defaultPosition.y,prevPropsPosition:{...u.position},slackX:0,slackY:0,isElementSVG:!1},u.position&&!(u.onDrag||u.onStop)&&console.warn("A `position` was applied to this <Draggable>, without drag handlers. This will make this component effectively undraggable. Please attach `onDrag` or `onStop` handlers so you can adjust the `position` of this element.")}componentDidMount(){typeof window.SVGElement<"u"&&this.findDOMNode()instanceof window.SVGElement&&this.setState({isElementSVG:!0})}componentWillUnmount(){this.state.dragging&&this.setState({dragging:!1})}findDOMNode(){return this.props?.nodeRef?.current??s.default.findDOMNode(this)}render(){const{axis:u,bounds:h,children:v,defaultPosition:m,defaultClassName:b,defaultClassNameDragging:f,defaultClassNameDragged:w,position:R,positionOffset:D,scale:O,...k}=this.props;let q={},L=null;const I=!!!R||this.state.dragging,M=R||m,Y={x:(0,o.canDragX)(this)&&I?this.state.x:M.x,y:(0,o.canDragY)(this)&&I?this.state.y:M.y};this.state.isElementSVG?L=(0,i.createSVGTransform)(Y,D):q=(0,i.createCSSTransform)(Y,D);const G=(0,a.clsx)(v.props.className||"",b,{[f]:this.state.dragging,[w]:this.state.dragged});return n.createElement(g.default,_({},k,{onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop}),n.cloneElement(n.Children.only(v),{className:G,style:{...v.props.style,...q},transform:L}))}}t.default=l,P(l,"displayName","Draggable"),P(l,"propTypes",{...g.default.propTypes,axis:r.default.oneOf(["both","x","y","none"]),bounds:r.default.oneOfType([r.default.shape({left:r.default.number,right:r.default.number,top:r.default.number,bottom:r.default.number}),r.default.string,r.default.oneOf([!1])]),defaultClassName:r.default.string,defaultClassNameDragging:r.default.string,defaultClassNameDragged:r.default.string,defaultPosition:r.default.shape({x:r.default.number,y:r.default.number}),positionOffset:r.default.shape({x:r.default.oneOfType([r.default.number,r.default.string]),y:r.default.oneOfType([r.default.number,r.default.string])}),position:r.default.shape({x:r.default.number,y:r.default.number}),className:d.dontSetMe,style:d.dontSetMe,transform:d.dontSetMe}),P(l,"defaultProps",{...g.default.defaultProps,axis:"both",bounds:!1,defaultClassName:"react-draggable",defaultClassNameDragging:"react-draggable-dragging",defaultClassNameDragged:"react-draggable-dragged",defaultPosition:{x:0,y:0},scale:1})})(Or)),Or}var fi;function Sa(){if(fi)return vt.exports;fi=1;const{default:t,DraggableCore:n}=Fd();return vt.exports=t,vt.exports.default=t,vt.exports.DraggableCore=n,vt.exports}var xt={exports:{}},bt={},Ut={},pi;function Gd(){if(pi)return Ut;pi=1,Ut.__esModule=!0,Ut.cloneElement=d;var t=n(Pe());function n(g){return g&&g.__esModule?g:{default:g}}function r(g,j){var S=Object.keys(g);if(Object.getOwnPropertySymbols){var y=Object.getOwnPropertySymbols(g);j&&(y=y.filter(function(_){return Object.getOwnPropertyDescriptor(g,_).enumerable})),S.push.apply(S,y)}return S}function s(g){for(var j=1;j<arguments.length;j++){var S=arguments[j]!=null?arguments[j]:{};j%2?r(Object(S),!0).forEach(function(y){a(g,y,S[y])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(S)):r(Object(S)).forEach(function(y){Object.defineProperty(g,y,Object.getOwnPropertyDescriptor(S,y))})}return g}function a(g,j,S){return j=i(j),j in g?Object.defineProperty(g,j,{value:S,enumerable:!0,configurable:!0,writable:!0}):g[j]=S,g}function i(g){var j=o(g,"string");return typeof j=="symbol"?j:String(j)}function o(g,j){if(typeof g!="object"||g===null)return g;var S=g[Symbol.toPrimitive];if(S!==void 0){var y=S.call(g,j);if(typeof y!="object")return y;throw new TypeError("@@toPrimitive must return a primitive value.")}return(j==="string"?String:Number)(g)}function d(g,j){return j.style&&g.props.style&&(j.style=s(s({},g.props.style),j.style)),j.className&&g.props.className&&(j.className=g.props.className+" "+j.className),t.default.cloneElement(g,j)}return Ut}var jt={},mi;function Nc(){if(mi)return jt;mi=1,jt.__esModule=!0,jt.resizableProps=void 0;var t=n(Ye());Sa();function n(s){return s&&s.__esModule?s:{default:s}}var r={axis:t.default.oneOf(["both","x","y","none"]),className:t.default.string,children:t.default.element.isRequired,draggableOpts:t.default.shape({allowAnyClick:t.default.bool,cancel:t.default.string,children:t.default.node,disabled:t.default.bool,enableUserSelectHack:t.default.bool,offsetParent:t.default.node,grid:t.default.arrayOf(t.default.number),handle:t.default.string,nodeRef:t.default.object,onStart:t.default.func,onDrag:t.default.func,onStop:t.default.func,onMouseDown:t.default.func,scale:t.default.number}),height:function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];var d=i[0];if(d.axis==="both"||d.axis==="y"){var g;return(g=t.default.number).isRequired.apply(g,i)}return t.default.number.apply(t.default,i)},handle:t.default.oneOfType([t.default.node,t.default.func]),handleSize:t.default.arrayOf(t.default.number),lockAspectRatio:t.default.bool,maxConstraints:t.default.arrayOf(t.default.number),minConstraints:t.default.arrayOf(t.default.number),onResizeStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,resizeHandles:t.default.arrayOf(t.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),transformScale:t.default.number,width:function(){for(var a=arguments.length,i=new Array(a),o=0;o<a;o++)i[o]=arguments[o];var d=i[0];if(d.axis==="both"||d.axis==="x"){var g;return(g=t.default.number).isRequired.apply(g,i)}return t.default.number.apply(t.default,i)}};return jt.resizableProps=r,jt}var gi;function Pc(){if(gi)return bt;gi=1,bt.__esModule=!0,bt.default=void 0;var t=o(Pe()),n=Sa(),r=Gd(),s=Nc(),a=["children","className","draggableOpts","width","height","handle","handleSize","lockAspectRatio","axis","minConstraints","maxConstraints","onResize","onResizeStop","onResizeStart","resizeHandles","transformScale"];function i(c){if(typeof WeakMap!="function")return null;var u=new WeakMap,h=new WeakMap;return(i=function(m){return m?h:u})(c)}function o(c,u){if(c&&c.__esModule)return c;if(c===null||typeof c!="object"&&typeof c!="function")return{default:c};var h=i(u);if(h&&h.has(c))return h.get(c);var v={},m=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var b in c)if(b!=="default"&&Object.prototype.hasOwnProperty.call(c,b)){var f=m?Object.getOwnPropertyDescriptor(c,b):null;f&&(f.get||f.set)?Object.defineProperty(v,b,f):v[b]=c[b]}return v.default=c,h&&h.set(c,v),v}function d(){return d=Object.assign?Object.assign.bind():function(c){for(var u=1;u<arguments.length;u++){var h=arguments[u];for(var v in h)Object.prototype.hasOwnProperty.call(h,v)&&(c[v]=h[v])}return c},d.apply(this,arguments)}function g(c,u){if(c==null)return{};var h={},v=Object.keys(c),m,b;for(b=0;b<v.length;b++)m=v[b],!(u.indexOf(m)>=0)&&(h[m]=c[m]);return h}function j(c,u){var h=Object.keys(c);if(Object.getOwnPropertySymbols){var v=Object.getOwnPropertySymbols(c);u&&(v=v.filter(function(m){return Object.getOwnPropertyDescriptor(c,m).enumerable})),h.push.apply(h,v)}return h}function S(c){for(var u=1;u<arguments.length;u++){var h=arguments[u]!=null?arguments[u]:{};u%2?j(Object(h),!0).forEach(function(v){y(c,v,h[v])}):Object.getOwnPropertyDescriptors?Object.defineProperties(c,Object.getOwnPropertyDescriptors(h)):j(Object(h)).forEach(function(v){Object.defineProperty(c,v,Object.getOwnPropertyDescriptor(h,v))})}return c}function y(c,u,h){return u=_(u),u in c?Object.defineProperty(c,u,{value:h,enumerable:!0,configurable:!0,writable:!0}):c[u]=h,c}function _(c){var u=P(c,"string");return typeof u=="symbol"?u:String(u)}function P(c,u){if(typeof c!="object"||c===null)return c;var h=c[Symbol.toPrimitive];if(h!==void 0){var v=h.call(c,u);if(typeof v!="object")return v;throw new TypeError("@@toPrimitive must return a primitive value.")}return(u==="string"?String:Number)(c)}function x(c,u){c.prototype=Object.create(u.prototype),c.prototype.constructor=c,p(c,u)}function p(c,u){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(v,m){return v.__proto__=m,v},p(c,u)}var l=(function(c){x(u,c);function u(){for(var v,m=arguments.length,b=new Array(m),f=0;f<m;f++)b[f]=arguments[f];return v=c.call.apply(c,[this].concat(b))||this,v.handleRefs={},v.lastHandleRect=null,v.slack=null,v}var h=u.prototype;return h.componentWillUnmount=function(){this.resetData()},h.resetData=function(){this.lastHandleRect=this.slack=null},h.runConstraints=function(m,b){var f=this.props,w=f.minConstraints,R=f.maxConstraints,D=f.lockAspectRatio;if(!w&&!R&&!D)return[m,b];if(D){var O=this.props.width/this.props.height,k=m-this.props.width,q=b-this.props.height;Math.abs(k)>Math.abs(q*O)?b=m/O:m=b*O}var L=m,z=b,I=this.slack||[0,0],M=I[0],Y=I[1];return m+=M,b+=Y,w&&(m=Math.max(w[0],m),b=Math.max(w[1],b)),R&&(m=Math.min(R[0],m),b=Math.min(R[1],b)),this.slack=[M+(L-m),Y+(z-b)],[m,b]},h.resizeHandler=function(m,b){var f=this;return function(w,R){var D=R.node,O=R.deltaX,k=R.deltaY;m==="onResizeStart"&&f.resetData();var q=(f.props.axis==="both"||f.props.axis==="x")&&b!=="n"&&b!=="s",L=(f.props.axis==="both"||f.props.axis==="y")&&b!=="e"&&b!=="w";if(!(!q&&!L)){var z=b[0],I=b[b.length-1],M=D.getBoundingClientRect();if(f.lastHandleRect!=null){if(I==="w"){var Y=M.left-f.lastHandleRect.left;O+=Y}if(z==="n"){var G=M.top-f.lastHandleRect.top;k+=G}}f.lastHandleRect=M,I==="w"&&(O=-O),z==="n"&&(k=-k);var X=f.props.width+(q?O/f.props.transformScale:0),ne=f.props.height+(L?k/f.props.transformScale:0),se=f.runConstraints(X,ne);X=se[0],ne=se[1];var Q=X!==f.props.width||ne!==f.props.height,he=typeof f.props[m]=="function"?f.props[m]:null,W=m==="onResize"&&!Q;he&&!W&&(w.persist==null||w.persist(),he(w,{node:D,size:{width:X,height:ne},handle:b})),m==="onResizeStop"&&f.resetData()}}},h.renderResizeHandle=function(m,b){var f=this.props.handle;if(!f)return t.createElement("span",{className:"react-resizable-handle react-resizable-handle-"+m,ref:b});if(typeof f=="function")return f(m,b);var w=typeof f.type=="string",R=S({ref:b},w?{}:{handleAxis:m});return t.cloneElement(f,R)},h.render=function(){var m=this,b=this.props,f=b.children,w=b.className,R=b.draggableOpts;b.width,b.height,b.handle,b.handleSize,b.lockAspectRatio,b.axis,b.minConstraints,b.maxConstraints,b.onResize,b.onResizeStop,b.onResizeStart;var D=b.resizeHandles;b.transformScale;var O=g(b,a);return(0,r.cloneElement)(f,S(S({},O),{},{className:(w?w+" ":"")+"react-resizable",children:[].concat(f.props.children,D.map(function(k){var q,L=(q=m.handleRefs[k])!=null?q:m.handleRefs[k]=t.createRef();return t.createElement(n.DraggableCore,d({},R,{nodeRef:L,key:"resizableHandle-"+k,onStop:m.resizeHandler("onResizeStop",k),onStart:m.resizeHandler("onResizeStart",k),onDrag:m.resizeHandler("onResize",k)}),m.renderResizeHandle(k,L))}))}))},u})(t.Component);return bt.default=l,l.propTypes=s.resizableProps,l.defaultProps={axis:"both",handleSize:[20,20],lockAspectRatio:!1,minConstraints:[20,20],maxConstraints:[1/0,1/0],resizeHandles:["se"],transformScale:1},bt}var wt={},vi;function $d(){if(vi)return wt;vi=1,wt.__esModule=!0,wt.default=void 0;var t=d(Pe()),n=i(Ye()),r=i(Pc()),s=Nc(),a=["handle","handleSize","onResize","onResizeStart","onResizeStop","draggableOpts","minConstraints","maxConstraints","lockAspectRatio","axis","width","height","resizeHandles","style","transformScale"];function i(u){return u&&u.__esModule?u:{default:u}}function o(u){if(typeof WeakMap!="function")return null;var h=new WeakMap,v=new WeakMap;return(o=function(b){return b?v:h})(u)}function d(u,h){if(u&&u.__esModule)return u;if(u===null||typeof u!="object"&&typeof u!="function")return{default:u};var v=o(h);if(v&&v.has(u))return v.get(u);var m={},b=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var f in u)if(f!=="default"&&Object.prototype.hasOwnProperty.call(u,f)){var w=b?Object.getOwnPropertyDescriptor(u,f):null;w&&(w.get||w.set)?Object.defineProperty(m,f,w):m[f]=u[f]}return m.default=u,v&&v.set(u,m),m}function g(){return g=Object.assign?Object.assign.bind():function(u){for(var h=1;h<arguments.length;h++){var v=arguments[h];for(var m in v)Object.prototype.hasOwnProperty.call(v,m)&&(u[m]=v[m])}return u},g.apply(this,arguments)}function j(u,h){var v=Object.keys(u);if(Object.getOwnPropertySymbols){var m=Object.getOwnPropertySymbols(u);h&&(m=m.filter(function(b){return Object.getOwnPropertyDescriptor(u,b).enumerable})),v.push.apply(v,m)}return v}function S(u){for(var h=1;h<arguments.length;h++){var v=arguments[h]!=null?arguments[h]:{};h%2?j(Object(v),!0).forEach(function(m){y(u,m,v[m])}):Object.getOwnPropertyDescriptors?Object.defineProperties(u,Object.getOwnPropertyDescriptors(v)):j(Object(v)).forEach(function(m){Object.defineProperty(u,m,Object.getOwnPropertyDescriptor(v,m))})}return u}function y(u,h,v){return h=_(h),h in u?Object.defineProperty(u,h,{value:v,enumerable:!0,configurable:!0,writable:!0}):u[h]=v,u}function _(u){var h=P(u,"string");return typeof h=="symbol"?h:String(h)}function P(u,h){if(typeof u!="object"||u===null)return u;var v=u[Symbol.toPrimitive];if(v!==void 0){var m=v.call(u,h);if(typeof m!="object")return m;throw new TypeError("@@toPrimitive must return a primitive value.")}return(h==="string"?String:Number)(u)}function x(u,h){if(u==null)return{};var v={},m=Object.keys(u),b,f;for(f=0;f<m.length;f++)b=m[f],!(h.indexOf(b)>=0)&&(v[b]=u[b]);return v}function p(u,h){u.prototype=Object.create(h.prototype),u.prototype.constructor=u,l(u,h)}function l(u,h){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(m,b){return m.__proto__=b,m},l(u,h)}var c=(function(u){p(h,u);function h(){for(var m,b=arguments.length,f=new Array(b),w=0;w<b;w++)f[w]=arguments[w];return m=u.call.apply(u,[this].concat(f))||this,m.state={width:m.props.width,height:m.props.height,propsWidth:m.props.width,propsHeight:m.props.height},m.onResize=function(R,D){var O=D.size;m.props.onResize?(R.persist==null||R.persist(),m.setState(O,function(){return m.props.onResize&&m.props.onResize(R,D)})):m.setState(O)},m}h.getDerivedStateFromProps=function(b,f){return f.propsWidth!==b.width||f.propsHeight!==b.height?{width:b.width,height:b.height,propsWidth:b.width,propsHeight:b.height}:null};var v=h.prototype;return v.render=function(){var b=this.props,f=b.handle,w=b.handleSize;b.onResize;var R=b.onResizeStart,D=b.onResizeStop,O=b.draggableOpts,k=b.minConstraints,q=b.maxConstraints,L=b.lockAspectRatio,z=b.axis;b.width,b.height;var I=b.resizeHandles,M=b.style,Y=b.transformScale,G=x(b,a);return t.createElement(r.default,{axis:z,draggableOpts:O,handle:f,handleSize:w,height:this.state.height,lockAspectRatio:L,maxConstraints:q,minConstraints:k,onResizeStart:R,onResize:this.onResize,onResizeStop:D,resizeHandles:I,transformScale:Y,width:this.state.width},t.createElement("div",g({},G,{style:S(S({},M),{},{width:this.state.width+"px",height:this.state.height+"px"})})))},h})(t.Component);return wt.default=c,c.propTypes=S(S({},s.resizableProps),{},{children:n.default.element}),wt}var yi;function Yd(){return yi||(yi=1,xt.exports=function(){throw new Error("Don't instantiate Resizable directly! Use require('react-resizable').Resizable")},xt.exports.Resizable=Pc().default,xt.exports.ResizableBox=$d().default),xt.exports}var Le={},xi;function Ec(){if(xi)return Le;xi=1,Object.defineProperty(Le,"__esModule",{value:!0}),Le.resizeHandleType=Le.resizeHandleAxesType=Le.default=void 0;var t=r(Ye()),n=r(Pe());function r(i){return i&&i.__esModule?i:{default:i}}const s=Le.resizeHandleAxesType=t.default.arrayOf(t.default.oneOf(["s","w","e","n","sw","nw","se","ne"])),a=Le.resizeHandleType=t.default.oneOfType([t.default.node,t.default.func]);return Le.default={className:t.default.string,style:t.default.object,width:t.default.number,autoSize:t.default.bool,cols:t.default.number,draggableCancel:t.default.string,draggableHandle:t.default.string,verticalCompact:function(i){i.verticalCompact},compactType:t.default.oneOf(["vertical","horizontal"]),layout:function(i){var o=i.layout;o!==void 0&&ht().validateLayout(o,"layout")},margin:t.default.arrayOf(t.default.number),containerPadding:t.default.arrayOf(t.default.number),rowHeight:t.default.number,maxRows:t.default.number,isBounded:t.default.bool,isDraggable:t.default.bool,isResizable:t.default.bool,allowOverlap:t.default.bool,preventCollision:t.default.bool,useCSSTransforms:t.default.bool,transformScale:t.default.number,isDroppable:t.default.bool,resizeHandles:s,resizeHandle:a,onLayoutChange:t.default.func,onDragStart:t.default.func,onDrag:t.default.func,onDragStop:t.default.func,onResizeStart:t.default.func,onResize:t.default.func,onResizeStop:t.default.func,onDrop:t.default.func,droppingItem:t.default.shape({i:t.default.string.isRequired,w:t.default.number.isRequired,h:t.default.number.isRequired}),children:function(i,o){const d=i[o],g={};n.default.Children.forEach(d,function(j){if(j?.key!=null){if(g[j.key])throw new Error('Duplicate child key "'+j.key+'" found! This will cause problems in ReactGridLayout.');g[j.key]=!0}})},innerRef:t.default.any},Le}var bi;function Kd(){if(bi)return gt;bi=1,Object.defineProperty(gt,"__esModule",{value:!0}),gt.default=void 0;var t=j(Pe()),n=va(),r=j(Ye()),s=Sa(),a=Yd(),i=ht(),o=wa(),d=Ec(),g=j(lr());function j(x){return x&&x.__esModule?x:{default:x}}function S(x,p,l){return(p=y(p))in x?Object.defineProperty(x,p,{value:l,enumerable:!0,configurable:!0,writable:!0}):x[p]=l,x}function y(x){var p=_(x,"string");return typeof p=="symbol"?p:p+""}function _(x,p){if(typeof x!="object"||!x)return x;var l=x[Symbol.toPrimitive];if(l!==void 0){var c=l.call(x,p);if(typeof c!="object")return c;throw new TypeError("@@toPrimitive must return a primitive value.")}return(p==="string"?String:Number)(x)}let P=class extends t.default.Component{constructor(){super(...arguments),S(this,"state",{resizing:null,dragging:null,className:""}),S(this,"elementRef",t.default.createRef()),S(this,"onDragStart",(p,l)=>{let{node:c}=l;const{onDragStart:u,transformScale:h}=this.props;if(!u)return;const v={top:0,left:0},{offsetParent:m}=c;if(!m)return;const b=m.getBoundingClientRect(),f=c.getBoundingClientRect(),w=f.left/h,R=b.left/h,D=f.top/h,O=b.top/h;v.left=w-R+m.scrollLeft,v.top=D-O+m.scrollTop,this.setState({dragging:v});const{x:k,y:q}=(0,o.calcXY)(this.getPositionParams(),v.top,v.left,this.props.w,this.props.h);return u.call(this,this.props.i,k,q,{e:p,node:c,newPosition:v})}),S(this,"onDrag",(p,l,c)=>{let{node:u,deltaX:h,deltaY:v}=l;const{onDrag:m}=this.props;if(!m)return;if(!this.state.dragging)throw new Error("onDrag called before onDragStart.");let b=this.state.dragging.top+v,f=this.state.dragging.left+h;const{isBounded:w,i:R,w:D,h:O,containerWidth:k}=this.props,q=this.getPositionParams();if(w){const{offsetParent:M}=u;if(M){const{margin:Y,rowHeight:G}=this.props,X=M.clientHeight-(0,o.calcGridItemWHPx)(O,G,Y[1]);b=(0,o.clamp)(b,0,X);const ne=(0,o.calcGridColWidth)(q),se=k-(0,o.calcGridItemWHPx)(D,ne,Y[0]);f=(0,o.clamp)(f,0,se)}}const L={top:b,left:f};c?this.setState({dragging:L}):(0,n.flushSync)(()=>{this.setState({dragging:L})});const{x:z,y:I}=(0,o.calcXY)(q,b,f,D,O);return m.call(this,R,z,I,{e:p,node:u,newPosition:L})}),S(this,"onDragStop",(p,l)=>{let{node:c}=l;const{onDragStop:u}=this.props;if(!u)return;if(!this.state.dragging)throw new Error("onDragEnd called before onDragStart.");const{w:h,h:v,i:m}=this.props,{left:b,top:f}=this.state.dragging,w={top:f,left:b};this.setState({dragging:null});const{x:R,y:D}=(0,o.calcXY)(this.getPositionParams(),f,b,h,v);return u.call(this,m,R,D,{e:p,node:c,newPosition:w})}),S(this,"onResizeStop",(p,l,c)=>this.onResizeHandler(p,l,c,"onResizeStop")),S(this,"onResizeStart",(p,l,c)=>this.onResizeHandler(p,l,c,"onResizeStart")),S(this,"onResize",(p,l,c)=>this.onResizeHandler(p,l,c,"onResize"))}shouldComponentUpdate(p,l){if(this.props.children!==p.children||this.props.droppingPosition!==p.droppingPosition)return!0;const c=(0,o.calcGridItemPosition)(this.getPositionParams(this.props),this.props.x,this.props.y,this.props.w,this.props.h,this.state),u=(0,o.calcGridItemPosition)(this.getPositionParams(p),p.x,p.y,p.w,p.h,l);return!(0,i.fastPositionEqual)(c,u)||this.props.useCSSTransforms!==p.useCSSTransforms}componentDidMount(){this.moveDroppingItem({})}componentDidUpdate(p){this.moveDroppingItem(p)}moveDroppingItem(p){const{droppingPosition:l}=this.props;if(!l)return;const c=this.elementRef.current;if(!c)return;const u=p.droppingPosition||{left:0,top:0},{dragging:h}=this.state,v=h&&l.left!==u.left||l.top!==u.top;if(!h)this.onDragStart(l.e,{node:c,deltaX:l.left,deltaY:l.top});else if(v){const m=l.left-h.left,b=l.top-h.top;this.onDrag(l.e,{node:c,deltaX:m,deltaY:b},!0)}}getPositionParams(){let p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props;return{cols:p.cols,containerPadding:p.containerPadding,containerWidth:p.containerWidth,margin:p.margin,maxRows:p.maxRows,rowHeight:p.rowHeight}}createStyle(p){const{usePercentages:l,containerWidth:c,useCSSTransforms:u}=this.props;let h;return u?h=(0,i.setTransform)(p):(h=(0,i.setTopLeft)(p),l&&(h.left=(0,i.perc)(p.left/c),h.width=(0,i.perc)(p.width/c))),h}mixinDraggable(p,l){return t.default.createElement(s.DraggableCore,{disabled:!l,onStart:this.onDragStart,onDrag:this.onDrag,onStop:this.onDragStop,handle:this.props.handle,cancel:".react-resizable-handle"+(this.props.cancel?","+this.props.cancel:""),scale:this.props.transformScale,nodeRef:this.elementRef},p)}curryResizeHandler(p,l){return(c,u)=>l(c,u,p)}mixinResizable(p,l,c){const{cols:u,minW:h,minH:v,maxW:m,maxH:b,transformScale:f,resizeHandles:w,resizeHandle:R}=this.props,D=this.getPositionParams(),O=(0,o.calcGridItemPosition)(D,0,0,u,0).width,k=(0,o.calcGridItemPosition)(D,0,0,h,v),q=(0,o.calcGridItemPosition)(D,0,0,m,b),L=[k.width,k.height],z=[Math.min(q.width,O),Math.min(q.height,1/0)];return t.default.createElement(a.Resizable,{draggableOpts:{disabled:!c},className:c?void 0:"react-resizable-hide",width:l.width,height:l.height,minConstraints:L,maxConstraints:z,onResizeStop:this.curryResizeHandler(l,this.onResizeStop),onResizeStart:this.curryResizeHandler(l,this.onResizeStart),onResize:this.curryResizeHandler(l,this.onResize),transformScale:f,resizeHandles:w,handle:R},p)}onResizeHandler(p,l,c,u){let{node:h,size:v,handle:m}=l;const b=this.props[u];if(!b)return;const{x:f,y:w,i:R,maxH:D,minH:O,containerWidth:k}=this.props,{minW:q,maxW:L}=this.props;let z=v;h&&(z=(0,i.resizeItemInDirection)(m,c,v,k),(0,n.flushSync)(()=>{this.setState({resizing:u==="onResizeStop"?null:z})}));let{w:I,h:M}=(0,o.calcWH)(this.getPositionParams(),z.width,z.height,f,w,m);I=(0,o.clamp)(I,Math.max(q,1),L),M=(0,o.clamp)(M,O,D),b.call(this,R,I,M,{e:p,node:h,size:z,handle:m})}render(){const{x:p,y:l,w:c,h:u,isDraggable:h,isResizable:v,droppingPosition:m,useCSSTransforms:b}=this.props,f=(0,o.calcGridItemPosition)(this.getPositionParams(),p,l,c,u,this.state),w=t.default.Children.only(this.props.children);let R=t.default.cloneElement(w,{ref:this.elementRef,className:(0,g.default)("react-grid-item",w.props.className,this.props.className,{static:this.props.static,resizing:!!this.state.resizing,"react-draggable":h,"react-draggable-dragging":!!this.state.dragging,dropping:!!m,cssTransforms:b}),style:{...this.props.style,...w.props.style,...this.createStyle(f)}});return R=this.mixinResizable(R,f,v),R=this.mixinDraggable(R,h),R}};return gt.default=P,S(P,"propTypes",{children:r.default.element,cols:r.default.number.isRequired,containerWidth:r.default.number.isRequired,rowHeight:r.default.number.isRequired,margin:r.default.array.isRequired,maxRows:r.default.number.isRequired,containerPadding:r.default.array.isRequired,x:r.default.number.isRequired,y:r.default.number.isRequired,w:r.default.number.isRequired,h:r.default.number.isRequired,minW:function(x,p){const l=x[p];if(typeof l!="number")return new Error("minWidth not Number");if(l>x.w||l>x.maxW)return new Error("minWidth larger than item width/maxWidth")},maxW:function(x,p){const l=x[p];if(typeof l!="number")return new Error("maxWidth not Number");if(l<x.w||l<x.minW)return new Error("maxWidth smaller than item width/minWidth")},minH:function(x,p){const l=x[p];if(typeof l!="number")return new Error("minHeight not Number");if(l>x.h||l>x.maxH)return new Error("minHeight larger than item height/maxHeight")},maxH:function(x,p){const l=x[p];if(typeof l!="number")return new Error("maxHeight not Number");if(l<x.h||l<x.minH)return new Error("maxHeight smaller than item height/minHeight")},i:r.default.string.isRequired,resizeHandles:d.resizeHandleAxesType,resizeHandle:d.resizeHandleType,onDragStop:r.default.func,onDragStart:r.default.func,onDrag:r.default.func,onResizeStop:r.default.func,onResizeStart:r.default.func,onResize:r.default.func,isDraggable:r.default.bool.isRequired,isResizable:r.default.bool.isRequired,isBounded:r.default.bool.isRequired,static:r.default.bool,useCSSTransforms:r.default.bool.isRequired,transformScale:r.default.number,className:r.default.string,handle:r.default.string,cancel:r.default.string,droppingPosition:r.default.shape({e:r.default.object.isRequired,left:r.default.number.isRequired,top:r.default.number.isRequired})}),S(P,"defaultProps",{className:"",cancel:"",handle:"",minH:1,minW:1,maxH:1/0,maxW:1/0,transformScale:1}),gt}var ji;function Oc(){if(ji)return mt;ji=1,Object.defineProperty(mt,"__esModule",{value:!0}),mt.default=void 0;var t=g(Pe()),n=ja(),r=d(lr()),s=ht(),a=wa(),i=d(Kd()),o=d(Ec());function d(p){return p&&p.__esModule?p:{default:p}}function g(p,l){if(typeof WeakMap=="function")var c=new WeakMap,u=new WeakMap;return(g=function(h,v){if(!v&&h&&h.__esModule)return h;var m,b,f={__proto__:null,default:h};if(h===null||typeof h!="object"&&typeof h!="function")return f;if(m=v?u:c){if(m.has(h))return m.get(h);m.set(h,f)}for(const w in h)w!=="default"&&{}.hasOwnProperty.call(h,w)&&((b=(m=Object.defineProperty)&&Object.getOwnPropertyDescriptor(h,w))&&(b.get||b.set)?m(f,w,b):f[w]=h[w]);return f})(p,l)}function j(p,l,c){return(l=S(l))in p?Object.defineProperty(p,l,{value:c,enumerable:!0,configurable:!0,writable:!0}):p[l]=c,p}function S(p){var l=y(p,"string");return typeof l=="symbol"?l:l+""}function y(p,l){if(typeof p!="object"||!p)return p;var c=p[Symbol.toPrimitive];if(c!==void 0){var u=c.call(p,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(p)}const _="react-grid-layout";let P=!1;try{P=/firefox/i.test(navigator.userAgent)}catch{}let x=class extends t.Component{constructor(){super(...arguments),j(this,"state",{activeDrag:null,layout:(0,s.synchronizeLayoutWithChildren)(this.props.layout,this.props.children,this.props.cols,(0,s.compactType)(this.props),this.props.allowOverlap),mounted:!1,oldDragItem:null,oldLayout:null,oldResizeItem:null,resizing:!1,droppingDOMNode:null,children:[]}),j(this,"dragEnterCounter",0),j(this,"onDragStart",(l,c,u,h)=>{let{e:v,node:m}=h;const{layout:b}=this.state,f=(0,s.getLayoutItem)(b,l);if(!f)return;const w={w:f.w,h:f.h,x:f.x,y:f.y,placeholder:!0,i:l};return this.setState({oldDragItem:(0,s.cloneLayoutItem)(f),oldLayout:b,activeDrag:w}),this.props.onDragStart(b,f,f,null,v,m)}),j(this,"onDrag",(l,c,u,h)=>{let{e:v,node:m}=h;const{oldDragItem:b}=this.state;let{layout:f}=this.state;const{cols:w,allowOverlap:R,preventCollision:D}=this.props,O=(0,s.getLayoutItem)(f,l);if(!O)return;const k={w:O.w,h:O.h,x:O.x,y:O.y,placeholder:!0,i:l};f=(0,s.moveElement)(f,O,c,u,!0,D,(0,s.compactType)(this.props),w,R),this.props.onDrag(f,b,O,k,v,m),this.setState({layout:R?f:(0,s.compact)(f,(0,s.compactType)(this.props),w),activeDrag:k})}),j(this,"onDragStop",(l,c,u,h)=>{let{e:v,node:m}=h;if(!this.state.activeDrag)return;const{oldDragItem:b}=this.state;let{layout:f}=this.state;const{cols:w,preventCollision:R,allowOverlap:D}=this.props,O=(0,s.getLayoutItem)(f,l);if(!O)return;f=(0,s.moveElement)(f,O,c,u,!0,R,(0,s.compactType)(this.props),w,D);const q=D?f:(0,s.compact)(f,(0,s.compactType)(this.props),w);this.props.onDragStop(q,b,O,null,v,m);const{oldLayout:L}=this.state;this.setState({activeDrag:null,layout:q,oldDragItem:null,oldLayout:null}),this.onLayoutMaybeChanged(q,L)}),j(this,"onResizeStart",(l,c,u,h)=>{let{e:v,node:m}=h;const{layout:b}=this.state,f=(0,s.getLayoutItem)(b,l);f&&(this.setState({oldResizeItem:(0,s.cloneLayoutItem)(f),oldLayout:this.state.layout,resizing:!0}),this.props.onResizeStart(b,f,f,null,v,m))}),j(this,"onResize",(l,c,u,h)=>{let{e:v,node:m,size:b,handle:f}=h;const{oldResizeItem:w}=this.state,{layout:R}=this.state,{cols:D,preventCollision:O,allowOverlap:k}=this.props;let q=!1,L,z,I;const[M,Y]=(0,s.withLayoutItem)(R,l,X=>{let ne;return z=X.x,I=X.y,["sw","w","nw","n","ne"].indexOf(f)!==-1&&(["sw","nw","w"].indexOf(f)!==-1&&(z=X.x+(X.w-c),c=X.x!==z&&z<0?X.w:c,z=z<0?0:z),["ne","n","nw"].indexOf(f)!==-1&&(I=X.y+(X.h-u),u=X.y!==I&&I<0?X.h:u,I=I<0?0:I),q=!0),O&&!k&&(ne=(0,s.getAllCollisions)(R,{...X,w:c,h:u,x:z,y:I}).filter(Q=>Q.i!==X.i).length>0,ne&&(I=X.y,u=X.h,z=X.x,c=X.w,q=!1)),X.w=c,X.h=u,X});if(!Y)return;L=M,q&&(L=(0,s.moveElement)(M,Y,z,I,!0,this.props.preventCollision,(0,s.compactType)(this.props),D,k));const G={w:Y.w,h:Y.h,x:Y.x,y:Y.y,static:!0,i:l};this.props.onResize(L,w,Y,G,v,m),this.setState({layout:k?L:(0,s.compact)(L,(0,s.compactType)(this.props),D),activeDrag:G})}),j(this,"onResizeStop",(l,c,u,h)=>{let{e:v,node:m}=h;const{layout:b,oldResizeItem:f}=this.state,{cols:w,allowOverlap:R}=this.props,D=(0,s.getLayoutItem)(b,l),O=R?b:(0,s.compact)(b,(0,s.compactType)(this.props),w);this.props.onResizeStop(O,f,D,null,v,m);const{oldLayout:k}=this.state;this.setState({activeDrag:null,layout:O,oldResizeItem:null,oldLayout:null,resizing:!1}),this.onLayoutMaybeChanged(O,k)}),j(this,"onDragOver",l=>{if(l.preventDefault(),l.stopPropagation(),P&&!l.nativeEvent.target?.classList.contains(_))return!1;const{droppingItem:c,onDropDragOver:u,margin:h,cols:v,rowHeight:m,maxRows:b,width:f,containerPadding:w,transformScale:R}=this.props,D=u?.(l);if(D===!1)return this.state.droppingDOMNode&&this.removeDroppingPlaceholder(),!1;const O={...c,...D},{layout:k}=this.state,q=l.currentTarget.getBoundingClientRect(),L=l.clientX-q.left,z=l.clientY-q.top,I={left:L/R,top:z/R,e:l};if(this.state.droppingDOMNode){if(this.state.droppingPosition){const{left:M,top:Y}=this.state.droppingPosition;(M!=L||Y!=z)&&this.setState({droppingPosition:I})}}else{const M={cols:v,margin:h,maxRows:b,rowHeight:m,containerWidth:f,containerPadding:w||h},Y=(0,a.calcXY)(M,z,L,O.w,O.h);this.setState({droppingDOMNode:t.createElement("div",{key:O.i}),droppingPosition:I,layout:[...k,{...O,x:Y.x,y:Y.y,static:!1,isDraggable:!0}]})}}),j(this,"removeDroppingPlaceholder",()=>{const{droppingItem:l,cols:c}=this.props,{layout:u}=this.state,h=(0,s.compact)(u.filter(v=>v.i!==l.i),(0,s.compactType)(this.props),c,this.props.allowOverlap);this.setState({layout:h,droppingDOMNode:null,activeDrag:null,droppingPosition:void 0})}),j(this,"onDragLeave",l=>{l.preventDefault(),l.stopPropagation(),this.dragEnterCounter--,this.dragEnterCounter===0&&this.removeDroppingPlaceholder()}),j(this,"onDragEnter",l=>{l.preventDefault(),l.stopPropagation(),this.dragEnterCounter++}),j(this,"onDrop",l=>{l.preventDefault(),l.stopPropagation();const{droppingItem:c}=this.props,{layout:u}=this.state,h=u.find(v=>v.i===c.i);this.dragEnterCounter=0,this.removeDroppingPlaceholder(),this.props.onDrop(u,h,l)})}componentDidMount(){this.setState({mounted:!0}),this.onLayoutMaybeChanged(this.state.layout,this.props.layout)}static getDerivedStateFromProps(l,c){let u;return c.activeDrag?null:(!(0,n.deepEqual)(l.layout,c.propsLayout)||l.compactType!==c.compactType?u=l.layout:(0,s.childrenEqual)(l.children,c.children)||(u=c.layout),u?{layout:(0,s.synchronizeLayoutWithChildren)(u,l.children,l.cols,(0,s.compactType)(l),l.allowOverlap),compactType:l.compactType,children:l.children,propsLayout:l.layout}:null)}shouldComponentUpdate(l,c){return this.props.children!==l.children||!(0,s.fastRGLPropsEqual)(this.props,l,n.deepEqual)||this.state.activeDrag!==c.activeDrag||this.state.mounted!==c.mounted||this.state.droppingPosition!==c.droppingPosition}componentDidUpdate(l,c){if(!this.state.activeDrag){const u=this.state.layout,h=c.layout;this.onLayoutMaybeChanged(u,h)}}containerHeight(){if(!this.props.autoSize)return;const l=(0,s.bottom)(this.state.layout),c=this.props.containerPadding?this.props.containerPadding[1]:this.props.margin[1];return l*this.props.rowHeight+(l-1)*this.props.margin[1]+c*2+"px"}onLayoutMaybeChanged(l,c){c||(c=this.state.layout),(0,n.deepEqual)(c,l)||this.props.onLayoutChange(l)}placeholder(){const{activeDrag:l}=this.state;if(!l)return null;const{width:c,cols:u,margin:h,containerPadding:v,rowHeight:m,maxRows:b,useCSSTransforms:f,transformScale:w}=this.props;return t.createElement(i.default,{w:l.w,h:l.h,x:l.x,y:l.y,i:l.i,className:`react-grid-placeholder ${this.state.resizing?"placeholder-resizing":""}`,containerWidth:c,cols:u,margin:h,containerPadding:v||h,maxRows:b,rowHeight:m,isDraggable:!1,isResizable:!1,isBounded:!1,useCSSTransforms:f,transformScale:w},t.createElement("div",null))}processGridItem(l,c){if(!l||!l.key)return;const u=(0,s.getLayoutItem)(this.state.layout,String(l.key));if(!u)return null;const{width:h,cols:v,margin:m,containerPadding:b,rowHeight:f,maxRows:w,isDraggable:R,isResizable:D,isBounded:O,useCSSTransforms:k,transformScale:q,draggableCancel:L,draggableHandle:z,resizeHandles:I,resizeHandle:M}=this.props,{mounted:Y,droppingPosition:G}=this.state,X=typeof u.isDraggable=="boolean"?u.isDraggable:!u.static&&R,ne=typeof u.isResizable=="boolean"?u.isResizable:!u.static&&D,se=u.resizeHandles||I,Q=X&&O&&u.isBounded!==!1;return t.createElement(i.default,{containerWidth:h,cols:v,margin:m,containerPadding:b||m,maxRows:w,rowHeight:f,cancel:L,handle:z,onDragStop:this.onDragStop,onDragStart:this.onDragStart,onDrag:this.onDrag,onResizeStart:this.onResizeStart,onResize:this.onResize,onResizeStop:this.onResizeStop,isDraggable:X,isResizable:ne,isBounded:Q,useCSSTransforms:k&&Y,usePercentages:!Y,transformScale:q,w:u.w,h:u.h,x:u.x,y:u.y,i:u.i,minH:u.minH,minW:u.minW,maxH:u.maxH,maxW:u.maxW,static:u.static,droppingPosition:c?G:void 0,resizeHandles:se,resizeHandle:M},l)}render(){const{className:l,style:c,isDroppable:u,innerRef:h}=this.props,v=(0,r.default)(_,l),m={height:this.containerHeight(),...c};return t.createElement("div",{ref:h,className:v,style:m,onDrop:u?this.onDrop:s.noop,onDragLeave:u?this.onDragLeave:s.noop,onDragEnter:u?this.onDragEnter:s.noop,onDragOver:u?this.onDragOver:s.noop},t.Children.map(this.props.children,b=>this.processGridItem(b)),u&&this.state.droppingDOMNode&&this.processGridItem(this.state.droppingDOMNode,!0),this.placeholder())}};return mt.default=x,j(x,"displayName","ReactGridLayout"),j(x,"propTypes",o.default),j(x,"defaultProps",{autoSize:!0,cols:12,className:"",style:{},draggableHandle:"",draggableCancel:"",containerPadding:null,rowHeight:150,maxRows:1/0,layout:[],margin:[10,10],isBounded:!1,isDraggable:!0,isResizable:!0,allowOverlap:!1,isDroppable:!1,useCSSTransforms:!0,transformScale:1,verticalCompact:!0,compactType:"vertical",preventCollision:!1,droppingItem:{i:"__dropping-elem__",h:1,w:1},resizeHandles:["se"],onLayoutChange:s.noop,onDragStart:s.noop,onDrag:s.noop,onDragStop:s.noop,onResizeStart:s.noop,onResize:s.noop,onResizeStop:s.noop,onDrop:s.noop,onDropDragOver:s.noop}),mt}var _t={},Ke={},wi;function Dc(){if(wi)return Ke;wi=1,Object.defineProperty(Ke,"__esModule",{value:!0}),Ke.findOrGenerateResponsiveLayout=s,Ke.getBreakpointFromWidth=n,Ke.getColsFromBreakpoint=r,Ke.sortBreakpoints=a;var t=ht();function n(i,o){const d=a(i);let g=d[0];for(let j=1,S=d.length;j<S;j++){const y=d[j];o>i[y]&&(g=y)}return g}function r(i,o){if(!o[i])throw new Error("ResponsiveReactGridLayout: `cols` entry for breakpoint "+i+" is missing!");return o[i]}function s(i,o,d,g,j,S){if(i[d])return(0,t.cloneLayout)(i[d]);let y=i[g];const _=a(o),P=_.slice(_.indexOf(d));for(let x=0,p=P.length;x<p;x++){const l=P[x];if(i[l]){y=i[l];break}}return y=(0,t.cloneLayout)(y||[]),(0,t.compact)((0,t.correctBounds)(y,{cols:j}),S,j)}function a(i){return Object.keys(i).sort(function(d,g){return i[d]-i[g]})}return Ke}var _i;function Xd(){if(_i)return _t;_i=1,Object.defineProperty(_t,"__esModule",{value:!0}),_t.default=void 0;var t=d(Pe()),n=o(Ye()),r=ja(),s=ht(),a=Dc(),i=o(Oc());function o(p){return p&&p.__esModule?p:{default:p}}function d(p,l){if(typeof WeakMap=="function")var c=new WeakMap,u=new WeakMap;return(d=function(h,v){if(!v&&h&&h.__esModule)return h;var m,b,f={__proto__:null,default:h};if(h===null||typeof h!="object"&&typeof h!="function")return f;if(m=v?u:c){if(m.has(h))return m.get(h);m.set(h,f)}for(const w in h)w!=="default"&&{}.hasOwnProperty.call(h,w)&&((b=(m=Object.defineProperty)&&Object.getOwnPropertyDescriptor(h,w))&&(b.get||b.set)?m(f,w,b):f[w]=h[w]);return f})(p,l)}function g(){return g=Object.assign?Object.assign.bind():function(p){for(var l=1;l<arguments.length;l++){var c=arguments[l];for(var u in c)({}).hasOwnProperty.call(c,u)&&(p[u]=c[u])}return p},g.apply(null,arguments)}function j(p,l,c){return(l=S(l))in p?Object.defineProperty(p,l,{value:c,enumerable:!0,configurable:!0,writable:!0}):p[l]=c,p}function S(p){var l=y(p,"string");return typeof l=="symbol"?l:l+""}function y(p,l){if(typeof p!="object"||!p)return p;var c=p[Symbol.toPrimitive];if(c!==void 0){var u=c.call(p,l);if(typeof u!="object")return u;throw new TypeError("@@toPrimitive must return a primitive value.")}return(l==="string"?String:Number)(p)}const _=p=>Object.prototype.toString.call(p);function P(p,l){return p==null?null:Array.isArray(p)?p:p[l]}let x=class extends t.Component{constructor(){super(...arguments),j(this,"state",this.generateInitialState()),j(this,"onLayoutChange",l=>{this.props.onLayoutChange(l,{...this.props.layouts,[this.state.breakpoint]:l})})}generateInitialState(){const{width:l,breakpoints:c,layouts:u,cols:h}=this.props,v=(0,a.getBreakpointFromWidth)(c,l),m=(0,a.getColsFromBreakpoint)(v,h),b=this.props.verticalCompact===!1?null:this.props.compactType;return{layout:(0,a.findOrGenerateResponsiveLayout)(u,c,v,v,m,b),breakpoint:v,cols:m}}static getDerivedStateFromProps(l,c){if(!(0,r.deepEqual)(l.layouts,c.layouts)){const{breakpoint:u,cols:h}=c;return{layout:(0,a.findOrGenerateResponsiveLayout)(l.layouts,l.breakpoints,u,u,h,l.compactType),layouts:l.layouts}}return null}componentDidUpdate(l){(this.props.width!=l.width||this.props.breakpoint!==l.breakpoint||!(0,r.deepEqual)(this.props.breakpoints,l.breakpoints)||!(0,r.deepEqual)(this.props.cols,l.cols))&&this.onWidthChange(l)}onWidthChange(l){const{breakpoints:c,cols:u,layouts:h,compactType:v}=this.props,m=this.props.breakpoint||(0,a.getBreakpointFromWidth)(this.props.breakpoints,this.props.width),b=this.state.breakpoint,f=(0,a.getColsFromBreakpoint)(m,u),w={...h};if(b!==m||l.breakpoints!==c||l.cols!==u){b in w||(w[b]=(0,s.cloneLayout)(this.state.layout));let O=(0,a.findOrGenerateResponsiveLayout)(w,c,m,b,f,v);O=(0,s.synchronizeLayoutWithChildren)(O,this.props.children,f,v,this.props.allowOverlap),w[m]=O,this.props.onBreakpointChange(m,f),this.props.onLayoutChange(O,w),this.setState({breakpoint:m,layout:O,cols:f})}const R=P(this.props.margin,m),D=P(this.props.containerPadding,m);this.props.onWidthChange(this.props.width,R,f,D)}render(){const{breakpoint:l,breakpoints:c,cols:u,layouts:h,margin:v,containerPadding:m,onBreakpointChange:b,onLayoutChange:f,onWidthChange:w,...R}=this.props;return t.createElement(i.default,g({},R,{margin:P(v,this.state.breakpoint),containerPadding:P(m,this.state.breakpoint),onLayoutChange:this.onLayoutChange,layout:this.state.layout,cols:this.state.cols}))}};return _t.default=x,j(x,"propTypes",{breakpoint:n.default.string,breakpoints:n.default.object,allowOverlap:n.default.bool,cols:n.default.object,margin:n.default.oneOfType([n.default.array,n.default.object]),containerPadding:n.default.oneOfType([n.default.array,n.default.object]),layouts(p,l){if(_(p[l])!=="[object Object]")throw new Error("Layout property must be an object. Received: "+_(p[l]));Object.keys(p[l]).forEach(c=>{if(!(c in p.breakpoints))throw new Error("Each key in layouts must align with a key in breakpoints.");(0,s.validateLayout)(p.layouts[c],"layouts."+c)})},width:n.default.number.isRequired,onBreakpointChange:n.default.func,onLayoutChange:n.default.func,onWidthChange:n.default.func}),j(x,"defaultProps",{breakpoints:{lg:1200,md:996,sm:768,xs:480,xxs:0},cols:{lg:12,md:10,sm:6,xs:4,xxs:2},containerPadding:{lg:null,md:null,sm:null,xs:null,xxs:null},layouts:{},margin:[10,10],allowOverlap:!1,onBreakpointChange:s.noop,onLayoutChange:s.noop,onWidthChange:s.noop}),_t}var Bt={},Mc=(function(){if(typeof Map<"u")return Map;function t(n,r){var s=-1;return n.some(function(a,i){return a[0]===r?(s=i,!0):!1}),s}return(function(){function n(){this.__entries__=[]}return Object.defineProperty(n.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),n.prototype.get=function(r){var s=t(this.__entries__,r),a=this.__entries__[s];return a&&a[1]},n.prototype.set=function(r,s){var a=t(this.__entries__,r);~a?this.__entries__[a][1]=s:this.__entries__.push([r,s])},n.prototype.delete=function(r){var s=this.__entries__,a=t(s,r);~a&&s.splice(a,1)},n.prototype.has=function(r){return!!~t(this.__entries__,r)},n.prototype.clear=function(){this.__entries__.splice(0)},n.prototype.forEach=function(r,s){s===void 0&&(s=null);for(var a=0,i=this.__entries__;a<i.length;a++){var o=i[a];r.call(s,o[1],o[0])}},n})()})(),ca=typeof window<"u"&&typeof document<"u"&&window.document===document,Zt=(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")()})(),Vd=(function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(Zt):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)}})(),Qd=2;function Jd(t,n){var r=!1,s=!1,a=0;function i(){r&&(r=!1,t()),s&&d()}function o(){Vd(i)}function d(){var g=Date.now();if(r){if(g-a<Qd)return;s=!0}else r=!0,s=!1,setTimeout(o,n);a=g}return d}var Zd=20,eh=["top","right","bottom","left","width","height","size","weight"],th=typeof MutationObserver<"u",rh=(function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=Jd(this.refresh.bind(this),Zd)}return t.prototype.addObserver=function(n){~this.observers_.indexOf(n)||this.observers_.push(n),this.connected_||this.connect_()},t.prototype.removeObserver=function(n){var r=this.observers_,s=r.indexOf(n);~s&&r.splice(s,1),!r.length&&this.connected_&&this.disconnect_()},t.prototype.refresh=function(){var n=this.updateObservers_();n&&this.refresh()},t.prototype.updateObservers_=function(){var n=this.observers_.filter(function(r){return r.gatherActive(),r.hasActive()});return n.forEach(function(r){return r.broadcastActive()}),n.length>0},t.prototype.connect_=function(){!ca||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),th?(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(){!ca||!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(n){var r=n.propertyName,s=r===void 0?"":r,a=eh.some(function(i){return!!~s.indexOf(i)});a&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t})(),Ac=(function(t,n){for(var r=0,s=Object.keys(n);r<s.length;r++){var a=s[r];Object.defineProperty(t,a,{value:n[a],enumerable:!1,writable:!1,configurable:!0})}return t}),lt=(function(t){var n=t&&t.ownerDocument&&t.ownerDocument.defaultView;return n||Zt}),qc=ur(0,0,0,0);function er(t){return parseFloat(t)||0}function Si(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return n.reduce(function(s,a){var i=t["border-"+a+"-width"];return s+er(i)},0)}function nh(t){for(var n=["top","right","bottom","left"],r={},s=0,a=n;s<a.length;s++){var i=a[s],o=t["padding-"+i];r[i]=er(o)}return r}function sh(t){var n=t.getBBox();return ur(0,0,n.width,n.height)}function ah(t){var n=t.clientWidth,r=t.clientHeight;if(!n&&!r)return qc;var s=lt(t).getComputedStyle(t),a=nh(s),i=a.left+a.right,o=a.top+a.bottom,d=er(s.width),g=er(s.height);if(s.boxSizing==="border-box"&&(Math.round(d+i)!==n&&(d-=Si(s,"left","right")+i),Math.round(g+o)!==r&&(g-=Si(s,"top","bottom")+o)),!oh(t)){var j=Math.round(d+i)-n,S=Math.round(g+o)-r;Math.abs(j)!==1&&(d-=j),Math.abs(S)!==1&&(g-=S)}return ur(a.left,a.top,d,g)}var ih=(function(){return typeof SVGGraphicsElement<"u"?function(t){return t instanceof lt(t).SVGGraphicsElement}:function(t){return t instanceof lt(t).SVGElement&&typeof t.getBBox=="function"}})();function oh(t){return t===lt(t).document.documentElement}function lh(t){return ca?ih(t)?sh(t):ah(t):qc}function ch(t){var n=t.x,r=t.y,s=t.width,a=t.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,o=Object.create(i.prototype);return Ac(o,{x:n,y:r,width:s,height:a,top:r,right:n+s,bottom:a+r,left:n}),o}function ur(t,n,r,s){return{x:t,y:n,width:r,height:s}}var uh=(function(){function t(n){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=ur(0,0,0,0),this.target=n}return t.prototype.isActive=function(){var n=lh(this.target);return this.contentRect_=n,n.width!==this.broadcastWidth||n.height!==this.broadcastHeight},t.prototype.broadcastRect=function(){var n=this.contentRect_;return this.broadcastWidth=n.width,this.broadcastHeight=n.height,n},t})(),dh=(function(){function t(n,r){var s=ch(r);Ac(this,{target:n,contentRect:s})}return t})(),hh=(function(){function t(n,r,s){if(this.activeObservations_=[],this.observations_=new Mc,typeof n!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=n,this.controller_=r,this.callbackCtx_=s}return t.prototype.observe=function(n){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(n instanceof lt(n).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(n)||(r.set(n,new uh(n)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(n){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(n instanceof lt(n).Element))throw new TypeError('parameter 1 is not of type "Element".');var r=this.observations_;r.has(n)&&(r.delete(n),r.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var n=this;this.clearActive(),this.observations_.forEach(function(r){r.isActive()&&n.activeObservations_.push(r)})},t.prototype.broadcastActive=function(){if(this.hasActive()){var n=this.callbackCtx_,r=this.activeObservations_.map(function(s){return new dh(s.target,s.broadcastRect())});this.callback_.call(n,r,n),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return this.activeObservations_.length>0},t})(),kc=typeof WeakMap<"u"?new WeakMap:new Mc,Tc=(function(){function t(n){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 r=rh.getInstance(),s=new hh(n,r,this);kc.set(this,s)}return t})();["observe","unobserve","disconnect"].forEach(function(t){Tc.prototype[t]=function(){var n;return(n=kc.get(this))[t].apply(n,arguments)}});var fh=(function(){return typeof Zt.ResizeObserver<"u"?Zt.ResizeObserver:Tc})();const ph=Object.freeze(Object.defineProperty({__proto__:null,default:fh},Symbol.toStringTag,{value:"Module"})),mh=ld(ph);var Ci;function gh(){if(Ci)return Bt;Ci=1,Object.defineProperty(Bt,"__esModule",{value:!0}),Bt.default=y;var t=i(Pe()),n=a(Ye()),r=a(mh),s=a(lr());function a(_){return _&&_.__esModule?_:{default:_}}function i(_,P){if(typeof WeakMap=="function")var x=new WeakMap,p=new WeakMap;return(i=function(l,c){if(!c&&l&&l.__esModule)return l;var u,h,v={__proto__:null,default:l};if(l===null||typeof l!="object"&&typeof l!="function")return v;if(u=c?p:x){if(u.has(l))return u.get(l);u.set(l,v)}for(const m in l)m!=="default"&&{}.hasOwnProperty.call(l,m)&&((h=(u=Object.defineProperty)&&Object.getOwnPropertyDescriptor(l,m))&&(h.get||h.set)?u(v,m,h):v[m]=l[m]);return v})(_,P)}function o(){return o=Object.assign?Object.assign.bind():function(_){for(var P=1;P<arguments.length;P++){var x=arguments[P];for(var p in x)({}).hasOwnProperty.call(x,p)&&(_[p]=x[p])}return _},o.apply(null,arguments)}function d(_,P,x){return(P=g(P))in _?Object.defineProperty(_,P,{value:x,enumerable:!0,configurable:!0,writable:!0}):_[P]=x,_}function g(_){var P=j(_,"string");return typeof P=="symbol"?P:P+""}function j(_,P){if(typeof _!="object"||!_)return _;var x=_[Symbol.toPrimitive];if(x!==void 0){var p=x.call(_,P);if(typeof p!="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(P==="string"?String:Number)(_)}const S="react-grid-layout";function y(_){var P;return P=class extends t.Component{constructor(){super(...arguments),d(this,"state",{width:1280}),d(this,"elementRef",t.createRef()),d(this,"mounted",!1),d(this,"resizeObserver",void 0)}componentDidMount(){this.mounted=!0,this.resizeObserver=new r.default(l=>{if(this.elementRef.current instanceof HTMLElement){const u=l[0].contentRect.width;this.setState({width:u})}});const p=this.elementRef.current;p instanceof HTMLElement&&this.resizeObserver.observe(p)}componentWillUnmount(){this.mounted=!1;const p=this.elementRef.current;p instanceof HTMLElement&&this.resizeObserver.unobserve(p),this.resizeObserver.disconnect()}render(){const{measureBeforeMount:p,...l}=this.props;return p&&!this.mounted?t.createElement("div",{className:(0,s.default)(this.props.className,S),style:this.props.style,ref:this.elementRef}):t.createElement(_,o({innerRef:this.elementRef},l,this.state))}},d(P,"defaultProps",{measureBeforeMount:!1}),d(P,"propTypes",{measureBeforeMount:n.default.bool}),P}return Bt}var Ri;function vh(){return Ri||(Ri=1,(function(t){t.exports=Oc().default,t.exports.utils=ht(),t.exports.calculateUtils=wa(),t.exports.Responsive=Xd().default,t.exports.Responsive.utils=Dc(),t.exports.WidthProvider=gh().default})(Cr)),Cr.exports}var yh=vh();const xh=ga(yh),bh=()=>{const t=te(V.ChatSend),[n,r]=N.useState([]),[s,a]=N.useState(""),i=N.useRef(null),o=F.chat.send.useMutation(),d=()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},g=te(V.ChatRecent),{data:j}=F.chat.recent.useQuery(void 0,{enabled:g});N.useEffect(()=>{j&&r(j.slice().reverse())},[j]),F.chat.onMessage.useSubscription(void 0,{enabled:g,onError:Qe,onData:y=>{r(_=>{const P=[..._,y];return P.length>50?P.slice(P.length-50):P})}}),N.useLayoutEffect(()=>{d()},[n]);const S=y=>{y.preventDefault(),!(s.length>140||s.length===0)&&(o.mutate(s),a(""))};return e.jsxs("div",{className:"chat-widget",children:[e.jsx(be,{className:"messages",ref:i,children:e.jsx("div",{className:"messages-child",children:n.map(y=>e.jsxs("div",{className:"log-entry",children:[y.action==="msg"&&e.jsxs("div",{className:"chat-message",children:[y.user?.web?"[":"",e.jsx(jr,{color:!0,user:y.user}),y.user?.web?"]":"",":"," ",e.jsx(ka,{as:"span",children:y.message})]}),y.action==="leave"&&e.jsxs("div",{className:"join-message",children:[e.jsx(jr,{user:y.user})," left the game."]}),y.action==="join"&&e.jsxs("div",{className:"join-message",children:[e.jsx(jr,{user:y.user})," joined the game",y.user?.isFirst?" for the first time":"","."]}),y.action==="server"&&e.jsx(ka,{as:"div",className:"server-message",children:y.message})]},y._id))})}),t&&e.jsx("form",{onSubmit:S,children:e.jsxs(Ce,{children:[e.jsx(ce,{roboto:!0,type:"text",placeholder:"Message",value:s,onChange:y=>a(y)}),e.jsx(H,{normal:!0,icon:!0,style:{marginLeft:"10px"},onClick:S,children:e.jsx(Tu,{})})]})})]})},jh=()=>{const t=te(V.ServerStatus),n=te(V.PlayerList),[r,s]=N.useState(null),{data:a}=F.server.status.useQuery(void 0,{enabled:t});return N.useEffect(()=>{a&&!r&&s(a)},[a]),F.server.onHeartbeat.useSubscription(void 0,{enabled:t,onError:Qe,onData:s}),e.jsxs("div",{className:"status-widget",children:[r?.players&&e.jsxs("div",{className:"players",children:[e.jsxs("div",{className:"stats",children:[e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Name:"})," ",r.serverName]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Uptime:"})," ",xe(r.time)]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Bricks:"})," ",r.bricks]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Players:"})," ",r.players.length]})]}),e.jsx(be,{className:"player-table",children:e.jsxs("table",{className:"br-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",width:"100%"},children:"Name"}),e.jsx("th",{children:"Time"}),e.jsx("th",{children:"Ping"})]})}),e.jsx("tbody",{children:r.players.map(i=>e.jsxs("tr",{children:[e.jsx("td",{children:n?e.jsx(at,{className:"user",to:"/players/"+i.id,children:i.name}):e.jsx("span",{className:"user",children:i.name})}),e.jsx("td",{style:{textAlign:"right"},children:xe(i.time)}),e.jsx("td",{style:{textAlign:"right"},children:i.ping})]},i.address+i.id))})]})})]}),!r?.players&&e.jsx(me,{blur:!0,size:"huge",children:"Loading Status"})]})},Ni=30;function Ft(t){return t<1024?`${t} B`:t<1024**2?`${(t/1024).toFixed(1)} KB`:t<1024**3?`${(t/1024**2).toFixed(1)} MB`:`${(t/1024**3).toFixed(1)} GB`}function Pi(t){return t<1024?`${Math.round(t)} B/s`:t<1024**2?`${(t/1024).toFixed(1)} KB/s`:`${(t/1024**2).toFixed(1)} MB/s`}function Dr(t){return t.length>=Ni?t:[...new Array(Ni-t.length).fill(t[0]??0),...t]}const Mr=({value:t,color:n})=>{const s=Math.PI*2*36,a=Math.max(0,Math.min(100,t));return e.jsxs("svg",{viewBox:"0 0 100 100",className:"donut-svg",children:[e.jsx("circle",{cx:"50",cy:"50",r:36,fill:"none",stroke:"rgba(255,255,255,0.06)",strokeWidth:"8"}),e.jsx("circle",{cx:"50",cy:"50",r:36,fill:"none",stroke:n,strokeWidth:"8",strokeDasharray:`${a/100*s} ${s}`,strokeLinecap:"round",transform:"rotate(-90 50 50)",style:{transition:"stroke-dasharray 0.5s ease"}}),e.jsx("text",{x:"50",y:"50",textAnchor:"middle",dominantBaseline:"central",className:"donut-pct",children:Math.round(a)===100?"100":`${Math.round(a)}%`})]})},Ar=({data:t,color:n,height:r=32,width:s=120})=>{if(t.length<2)return null;const a=Math.max(...t,1),i=s/(t.length-1),o=t.map((g,j)=>`${j*i},${r-g/a*(r-2)-1}`).join(" "),d=`0,${r} ${o} ${s},${r}`;return e.jsxs("svg",{viewBox:`0 0 ${s} ${r}`,className:"sparkline",preserveAspectRatio:"none",children:[e.jsx("polygon",{points:d,fill:n,fillOpacity:"0.12"}),e.jsx("polyline",{points:o,fill:"none",stroke:n,strokeWidth:"1.5",strokeLinejoin:"round",vectorEffect:"non-scaling-stroke"})]})},wh=()=>{const[t,n]=N.useState(null),r=N.useRef([]),s=N.useRef([]),a=N.useRef([]),[,i]=N.useState(0),o=N.useCallback(x=>{n(x),r.current=[...r.current.slice(-29),x.cpu],s.current=[...s.current.slice(-29),x.net.rxSec],a.current=[...a.current.slice(-29),x.net.txSec],i(p=>p+1)},[]),d=te(V.ServerUtilization),{data:g}=F.server.utilization.useQuery(void 0,{enabled:d});if(N.useEffect(()=>{if(!g)return;const x=g.history;x.length>0&&(r.current=x.map(p=>p.cpu),s.current=x.map(p=>p.net.rxSec),a.current=x.map(p=>p.net.txSec)),g.current&&!t&&n(g.current),i(p=>p+1)},[g]),F.server.onUtilization.useSubscription(void 0,{enabled:d,onError:Qe,onData:o}),!t)return e.jsx("div",{className:"utilization-widget",children:e.jsx(me,{blur:!0,size:"huge",children:"Waiting for metrics..."})});const j=t.cpu>80?"#e02d2d":t.cpu>50?"#ffa10b":"#5da93d",S=t.mem.used/t.mem.total*100,y=S>80?"#e02d2d":S>50?"#ffa10b":"#009bee",_=t.disk.used/t.disk.total*100,P=_>90?"#e02d2d":_>70?"#ffa10b":"#009bee";return e.jsxs("div",{className:"utilization-widget",children:[e.jsxs("div",{className:"util-donuts",children:[e.jsxs("div",{className:"donut-row",children:[e.jsx(Mr,{value:t.cpu,color:j}),e.jsx("div",{className:"donut-detail",children:e.jsx("b",{children:"CPU"})})]}),e.jsxs("div",{className:"donut-row",children:[e.jsx(Mr,{value:S,color:y}),e.jsxs("div",{className:"donut-detail",children:[e.jsx("b",{children:"MEMORY"}),e.jsxs("div",{className:"donut-detail-line",children:[e.jsx("span",{children:Ft(t.mem.used)}),e.jsxs("span",{className:"donut-detail-sub",children:["/ ",Ft(t.mem.total)]})]})]})]}),e.jsxs("div",{className:"donut-row",children:[e.jsx(Mr,{value:_,color:P}),e.jsxs("div",{className:"donut-detail",children:[e.jsx("b",{children:"STORAGE"}),e.jsxs("div",{className:"donut-detail-line",children:[e.jsx("span",{children:Ft(t.disk.used)}),e.jsxs("span",{className:"donut-detail-sub",children:["/ ",Ft(t.disk.total)]})]})]})]})]}),e.jsxs("div",{className:"util-sparklines",children:[e.jsxs("div",{className:"spark-row",children:[e.jsxs("span",{className:"spark-label",children:[e.jsx(Lu,{size:14}),"CPU"]}),e.jsx(Ar,{data:Dr(r.current),color:j}),e.jsxs("span",{className:"spark-value",children:[t.cpu,"%"]})]}),e.jsxs("div",{className:"spark-row",children:[e.jsxs("span",{className:"spark-label",children:[e.jsx(zu,{size:14}),"RX"]}),e.jsx(Ar,{data:Dr(s.current),color:"#009bee"}),e.jsx("span",{className:"spark-value",children:Pi(t.net.rxSec)})]}),e.jsxs("div",{className:"spark-row",children:[e.jsxs("span",{className:"spark-label",children:[e.jsx(Iu,{size:14}),"TX"]}),e.jsx(Ar,{data:Dr(a.current),color:"#5da93d"}),e.jsx("span",{className:"spark-value",children:Pi(t.net.txSec)})]})]})]})},Ei={chat:{component:bh,icon:Wu,tooltip:"Chat with online players",scope:V.ChatRecent},status:{component:jh,icon:id,tooltip:"View current online players and server status",scope:V.ServerStatus},utilization:{component:wh,icon:Hu,tooltip:"View CPU, memory, disk, and network usage",scope:V.ServerUtilization}},Oi=[{x:0,y:0,w:4,h:4,i:"chat"},{x:4,y:0,w:4,h:4,i:"status"}],_h=["status","chat","utilization"],Sh={minW:2,maxW:10,minH:2,maxH:10},Ch=[8,8],Rh=()=>{const t=te(V.ChatRecent),n=te(V.ServerStatus),r=te(V.ServerUtilization),s=N.useMemo(()=>{const h={};return t&&(h.chat=!0),n&&(h.status=!0),r&&(h.utilization=!0),h},[t,n,r]),a=t||n||r,i=_u(),o=N.useMemo(()=>{const h={};for(const[v,m]of Object.entries(Ei))s[v]&&(h[v]=m);return h},[s]),[d,g]=N.useState(()=>{if(localStorage.omeggaDashLayout2)try{return JSON.parse(localStorage.omeggaDashLayout2)}catch(h){return console.error("Invalid layout in localStorage, using default layout",h),Oi}return Oi}),j=N.useMemo(()=>d.filter(h=>s[h.i]),[d,s]);N.useEffect(()=>{localStorage.omeggaDashLayout2=JSON.stringify(d)},[d]);const S=h=>{g(d.filter(v=>v.i!==h))},y=h=>{h in o&&g([...d,{x:0,y:0,w:4,h:4,i:h}])},[_,P]=N.useState(!1),x=Object.fromEntries(d.map(h=>[h.i,!0])),p=N.useCallback(h=>{g(h)},[]),l=N.useRef(null),[c,u]=N.useState(null);return N.useEffect(()=>{l.current&&u(l.current.clientWidth);const h=new ResizeObserver(v=>{for(const m of v)m.target===l.current&&u(m.contentRect.width)});return l.current&&h.observe(l.current),()=>{h.disconnect()}},[l.current]),e.jsxs(e.Fragment,{children:[!i&&e.jsx(De,{title:"Dashboard",children:a&&e.jsxs("div",{className:"widgets-container",children:[e.jsxs(H,{normal:!0,boxy:!0,"data-tooltip":"Add more widgets to the dashboard",onClick:()=>P(!_),children:[e.jsx(Uu,{}),"Widgets"]}),e.jsx(Ge,{visible:_,children:Object.entries(o).map(([h,v])=>e.jsxs("div",{className:"widget-item",children:[e.jsxs("div",{className:"name","data-tooltip":v.tooltip,children:[e.jsx(v.icon,{}),h]}),x[h]?e.jsx(H,{warn:!0,icon:!0,"data-tooltip":`Remove ${h} widget`,onClick:()=>S(h),children:e.jsx(ma,{})}):e.jsx(H,{main:!0,icon:!0,"data-tooltip":`Add ${h} widget`,onClick:()=>y(h),children:e.jsx(Fe,{})})]},h))})]})}),e.jsxs(Me,{children:[e.jsx(Ae,{}),i?a?e.jsx("div",{className:"widget-pager",children:_h.filter(h=>s[h]).map(h=>{const v=Ei[h],m=v.component;return e.jsxs("div",{className:"widget-page",children:[e.jsxs(Ve,{className:"widget-page-header",children:[e.jsx(v.icon,{}),h]}),e.jsx("div",{className:"widget-page-contents",children:e.jsx(m,{})})]},h)})}):e.jsx("div",{className:"grid-container",children:e.jsx("div",{className:"no-permissions-message",children:"Contact your admin for support"})}):e.jsxs("div",{className:"grid-container",ref:l,children:[!a&&e.jsx("div",{className:"no-permissions-message",children:"Contact your admin for support"}),a&&c!==null&&e.jsx(xh,{layout:j.map(h=>({...h,...Sh})),width:c,cols:10,autoSize:!0,useCSSTransforms:!0,rowHeight:100,isBounded:!0,isResizable:!0,isDraggable:!0,margin:Ch,onLayoutChange:p,draggableHandle:".drag-handle",draggableCancel:".no-drag",resizeHandles:["se"],resizeHandle:e.jsx(Bu,{style:{cursor:"se-resize"},className:"resize-handle"}),children:j.map(h=>{const v=o[h.i]?.component;return v?e.jsxs("div",{className:"grid-item",children:[e.jsxs(Ve,{className:"drag-handle",children:[e.jsx("span",{style:{flex:1},children:h.i}),e.jsx(H,{icon:!0,error:!0,className:"no-drag","data-tooltip":"Close widget",onClick:()=>S(h.i),children:e.jsx(Oe,{})})]}),e.jsx("div",{className:"drag-contents",children:e.jsx(v,{})})]},h.i):null})})]})]})]})},Di={"Minute(s)":1,"Hour(s)":60,"Day(s)":1440,"Week(s)":1440*7,"Month(s)":1440*30},Nh=["Permanent","Minute(s)","Hour(s)","Day(s)","Week(s)","Month(s)"],Ph=()=>{const[t,n]=Ne("/players/:id"),[r,s]=Je(),[a,i]=N.useState(null),[o,d]=N.useState(!1),[g,j]=N.useState(""),[S,y]=N.useState(10),[_,P]=N.useState("Permanent"),[x,p]=N.useState(!1),l=te(V.PlayerGet),c=te(V.PlayerBan),u=te(V.PlayerKick),h=te(V.PlayerUnban),v=te(V.PlayerClearBricks),{data:m,isLoading:b,refetch:f}=F.player.get.useQuery(n?.id??"",{enabled:!!n?.id&&l});N.useEffect(()=>{!b&&!m&&n?.id&&s("/players")},[b,m,n?.id]);const w=F.player.ban.useMutation(),R=F.player.kick.useMutation(),D=F.player.unban.useMutation(),O=F.player.clearBricks.useMutation(),k=async()=>{if(!m.id)return;p(!0);const M=_==="Permanent"?-1:S*Di[_];try{await w.mutateAsync({id:m.id,duration:M,reason:g})}catch(Y){console.error("Failed to ban player:",Y)}i(null),f(),p(!1)},q=async()=>{if(m.id){p(!0);try{await R.mutateAsync({id:m.id,reason:g})}catch(M){console.error("Failed to kick player:",M)}i(null),f(),p(!1)}},L=async()=>{if(m.id){p(!0);try{await D.mutateAsync({id:m.id})}catch(M){console.error("Failed to unban player:",M)}f(),p(!1)}},z=async()=>{if(m.id){p(!0);try{await O.mutateAsync({id:m.id})}catch(M){console.error("Failed to clear bricks:",M)}p(!1),i(null)}},I=N.useMemo(()=>_==="Permanent"?"Never":xu(Date.now()+Di[_]*60*1e3*S),[_,S]);return e.jsxs("div",{className:"player-inspector-container",children:[e.jsxs(ge,{attached:!0,children:[e.jsx("span",{className:"inspector-title",children:m?.name||"SELECT A PLAYER"}),m&&e.jsxs("div",{className:"widgets-container",children:[e.jsxs(H,{normal:!0,boxy:!0,onClick:()=>d(!o),children:[o?e.jsx(dt,{}):e.jsx(ut,{}),"Actions"]}),e.jsxs(Ge,{visible:o,children:[v&&e.jsxs(H,{boxy:!0,warn:!0,disabled:x,onClick:()=>{i("clear"),d(!1)},children:[e.jsx(Ha,{}),"Clear Bricks"]}),u&&!m.isHost&&m.isOnline&&e.jsxs(H,{boxy:!0,error:!0,disabled:x,onClick:()=>{i("kick"),d(!1)},children:[e.jsx(Ua,{}),"Kick"]}),h&&m.currentBan&&e.jsxs(H,{boxy:!0,warn:!0,disabled:x,onClick:()=>{L(),d(!1)},children:[e.jsx(Fu,{}),"Unban"]}),c&&!m.isHost&&e.jsxs(H,{boxy:!0,error:!0,disabled:x,onClick:()=>{i("ban"),d(!1)},children:[e.jsx(ot,{}),"Ban"]})]})]})]}),e.jsx("div",{className:"player-inspector",children:e.jsxs("div",{className:"player-view",children:[e.jsx(me,{active:b,size:"huge",children:"Loading Player"}),e.jsx("div",{className:"player-info",children:!b&&m&&e.jsxs(be,{children:[e.jsxs("div",{className:"stats",children:[e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Profile:"})," ",e.jsx("a",{href:"https://brickadia.com/users/"+m.id,target:"_blank",children:m.name})]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Display Name:"})," ",m.displayName||"unknown"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Host:"})," ",m.isHost?"Yes":"No"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Banned:"})," ",m.currentBan&&m.currentBan.duration<=0?e.jsx("span",{children:"Permanent"}):m.currentBan?e.jsxs("span",{children:[xe(m.currentBan.remainingTime)," of"," ",xe(m.currentBan.duration)," remaining"]}):e.jsx("span",{children:"No"})]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Number of status heartbeats this player has been part of",children:"Time Played:"})," ",ac(m.heartbeats)]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Date player was last seen",children:"Last Seen:"})," ",e.jsxs("span",{"data-tooltip":new Date(m.lastSeen),children:[xe(m.seenAgo)," ago"]})]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Date player was first seen",children:"First Seen:"})," ",e.jsxs("span",{"data-tooltip":new Date(m.created),children:[xe(m.createdAgo)," ago"]})]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Number of times this player has visited the server (new visits are registered if the player joins 3 hours after last seen)",children:"Visits:"})," ",m.sessions]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Number of server instances this player has joined",children:"Server Visits:"})," ",m.instances]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Bans:"})," ",m.banHistory.length]})]}),e.jsx("div",{className:"section-header","data-tooltip":"Roles this player has",children:"Roles"}),e.jsxs("div",{className:"option-list",children:[m.roles.map(M=>e.jsx("div",{className:"option-item",children:e.jsx("div",{className:"option-name",style:{color:"#"+M.color},children:M.name})},M.name)),e.jsx("div",{className:"option-item",children:e.jsx("div",{className:"option-name",style:{color:"white"},children:"Default"})})]}),e.jsx("div",{className:"section-header","data-tooltip":"Names this player has gone by historically",children:"Name History"}),e.jsxs("table",{className:"br-table name-history",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",width:"100%"},children:e.jsx("span",{children:"Name"})}),e.jsx("th",{children:"First Seen"})]})}),e.jsx("tbody",{children:m.nameHistory.map(M=>e.jsxs("tr",{children:[e.jsxs("td",{children:[e.jsx("div",{"data-tooltip":M.displayName?"Display Name":"Username",children:M.displayName||M.name}),M.displayName&&e.jsx("div",{"data-tooltip":"Username",className:"username",children:M.name})]}),e.jsx("td",{style:{textAlign:"right"},"data-tooltip":new Date(M.date),children:xe(M.ago)})]},M.date+M.name))})]}),e.jsx("div",{className:"section-header","data-tooltip":"Times this player has been banned from the server",children:"Ban History"}),e.jsxs("table",{className:"br-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:"100%",textAlign:"left"},children:"Reason"}),e.jsx("th",{children:"Length"}),e.jsx("th",{children:"Issuer"}),e.jsx("th",{children:"Date"})]})}),e.jsxs("tbody",{children:[m.banHistory.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,children:e.jsx("i",{children:"None"})})}),m.banHistory.map(M=>e.jsxs("tr",{children:[e.jsx("td",{className:"reason",children:M.reason}),e.jsx("td",{style:{textAlign:"right"},"data-tooltip":"Expires "+new Date(M.expires),children:0>=(M.duration??-1)?"Permanent":xe(M.duration)}),e.jsx("td",{children:e.jsx(at,{to:"/players/"+M.bannerId,children:M.bannerName||"missing name"})}),e.jsx("td",{style:{textAlign:"right"},"data-tooltip":new Date(M.created),children:La(M.created)})]},M.created))]})]}),e.jsx("div",{className:"section-header","data-tooltip":"Times this player has been booted from the server",children:"Kick History"}),e.jsxs("table",{className:"br-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{width:"100%",textAlign:"left"},children:"Reason"}),e.jsx("th",{children:"Issuer"}),e.jsx("th",{children:"Date"})]})}),e.jsxs("tbody",{children:[m.kickHistory.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,children:e.jsx("i",{children:"None"})})}),m.kickHistory.map(M=>e.jsxs("tr",{children:[e.jsx("td",{className:"reason",children:M.reason}),e.jsx("td",{children:e.jsx(at,{to:"/players/"+M.kickerId,children:M.kickerName||"missing name"})}),e.jsx("td",{style:{textAlign:"right"},"data-tooltip":new Date(M.created),children:La(M.created)})]},M.created))]})]})]})})]})}),e.jsxs(ct,{visible:!!a,children:[e.jsx(me,{active:x,size:"huge",children:"Running Action..."}),e.jsxs(kt,{visible:!x,children:[e.jsx(Ve,{children:a==="ban"?"Ban Player":a==="kick"?"Kick Player":"Clear Bricks"}),(a==="kick"||a==="ban")&&e.jsxs("div",{className:`popout-inputs ${a}`,children:[e.jsx(ce,{type:"text",placeholder:"Reason",value:g,onChange:j}),a==="ban"&&e.jsxs("div",{className:"ban-duration",style:{display:"flex"},children:[_!=="Permanent"&&e.jsx(ce,{placeholder:"Duration",type:"number",value:S,onChange:y}),e.jsx(da,{options:Nh,value:_,onChange:M=>P(M)})]})]}),a==="ban"&&e.jsxs(it,{children:["This ban will expire"," ",e.jsx("span",{style:{color:"white"},children:I}),"."]}),a==="clear"&&e.jsxs(it,{children:["Are you sure you want to clear"," ",e.jsx("span",{style:{color:"white"},children:m?.name??"??"}),"'s bricks?"]}),e.jsxs(Ce,{attached:!0,children:[a==="ban"&&e.jsxs(H,{error:!0,onClick:k,children:[e.jsx(ot,{}),"Ban"]}),a==="clear"&&e.jsxs(H,{warn:!0,onClick:z,children:[e.jsx(Ha,{}),"Clear Bricks"]}),a==="kick"&&e.jsxs(H,{error:!0,onClick:q,children:[e.jsx(Ua,{}),"Kick"]}),e.jsx("div",{style:{flex:1}}),e.jsxs(H,{normal:!0,onClick:()=>i(null),children:[e.jsx(Oe,{}),"Cancel"]})]})]})]})]})},Eh=()=>{const t=Ze(V.PlayerList);te(V.PlayerGet);const[n,r]=N.useState(!1),[s,a]=Je(),[i,o]=Ne("/players/:id?"),{onBack:d,swipeHandlers:g,inspectorOpen:j}=At(!!o?.id,"/players"),S=N.useRef({page:0,search:"",sort:"lastSeen",direction:-1,filterBanned:!1}),{page:y,search:_,sort:P,direction:x,filterBanned:p}=S.current,[l,c]=N.useState({page:S.current.page,search:S.current.search,sort:S.current.sort,direction:S.current.direction,filter:""}),u=()=>{c({page:S.current.page,search:S.current.search,sort:S.current.sort,direction:S.current.direction,filter:S.current.filterBanned?"banned":""})},[h,v]=N.useState(0),m=M=>{S.current.search=M,z(),v(Y=>Y+1)},b=M=>{typeof M=="function"&&(M=M(S.current.page)),S.current.page=M,u()},f=M=>{typeof M=="function"&&(M=M(S.current.direction)),S.current.direction=M},w=M=>{S.current.filterBanned=M,z()},{data:R,isLoading:D,refetch:O}=F.player.list.useQuery(l,{placeholderData:M=>M}),k=R?.players??[],q=R?.total??0,L=R?.pages??0,z=N.useMemo(()=>ic(()=>{S.current.page=0,u()},500),[]),I=M=>{M==P?f(Y=>Y*-1):(S.current.sort=M,f(M==="name"?1:-1)),u()};return t?e.jsxs(e.Fragment,{children:[e.jsx(De,{title:"Players",className:"players-view",onBack:d,children:e.jsxs("div",{className:"widgets-container",children:[e.jsxs(H,{normal:!0,boxy:!0,"data-tooltip":"Player list filters",onClick:()=>r(M=>!M),children:[e.jsx(Gu,{}),"Filters"]}),e.jsx(Ge,{visible:n,children:e.jsxs("div",{className:"widget-item","data-tooltip":"Filter by banned players",children:[e.jsxs("div",{className:"name",children:[e.jsx(ot,{}),"Banned"]}),e.jsx(_e,{onChange:w,value:p})]})})]})}),e.jsxs(Me,{children:[e.jsx(Ae,{}),e.jsxs("div",{className:`generic-container players-container ${j?"inspector-open":""}`,...g,children:[e.jsxs("div",{className:"player-table-container",children:[e.jsxs(ge,{attached:!0,children:[e.jsx(ce,{type:"text",placeholder:"Search Players...",value:_,onChange:m}),e.jsx("span",{style:{flex:1}}),e.jsx(H,{icon:!0,normal:!0,"data-tooltip":"Refresh player list",onClick:()=>O(),children:e.jsx(Lt,{})})]}),e.jsxs("div",{className:"players-list",children:[e.jsx(be,{children:e.jsxs("table",{className:"br-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",width:"100%"},onClick:()=>I("name"),children:e.jsxs("span",{children:["Name",e.jsx(we,{name:"name",sort:P,direction:x})]})}),e.jsx("th",{onClick:()=>I("heartbeats"),"data-tooltip":"Number of heartbeats the player has been part of (minutely)",children:e.jsxs("span",{children:["Played",e.jsx(we,{name:"heartbeats",sort:P,direction:x})]})}),e.jsx("th",{onClick:()=>I("lastSeen"),"data-tooltip":"When the player was last seen",children:e.jsxs("span",{children:["Seen",e.jsx(we,{name:"lastSeen",sort:P,direction:x})]})}),e.jsx("th",{onClick:()=>I("created"),"data-tooltip":"When the player joined",children:e.jsxs("span",{children:["Joined",e.jsx(we,{name:"created",sort:P,direction:x})]})}),e.jsx("th",{onClick:()=>I("sessions"),"data-tooltip":"Number of Visits",children:e.jsxs("span",{className:"icon-cell",children:[e.jsx($u,{className:"label",size:"30"}),e.jsx(we,{name:"sessions",sort:P,direction:x})]})})]})}),e.jsx("tbody",{children:k.map(M=>e.jsxs("tr",{onClick:()=>a(`/players/${M.id}`),className:M.id===o?.id?"active":"",children:[e.jsx("td",{className:`player-name ${M.ban?"ban":""}`,children:e.jsxs("div",{className:"player-name-container",children:[e.jsxs("div",{children:[e.jsx("div",{"data-tooltip":M.displayName?"Display Name":"Username",children:M.displayName||M.name}),M.displayName&&e.jsx("div",{className:"username","data-tooltip":"Username",children:M.name})]}),M.ban&&e.jsx(ot,{size:"18"})]})}),e.jsx("td",{style:{textAlign:"right"},children:ac(M.heartbeats)}),e.jsx("td",{style:{textAlign:"right"},"data-tooltip":new Date(M.lastSeen),children:xe(M.seenAgo)}),e.jsx("td",{style:{textAlign:"right"},"data-tooltip":new Date(M.created),children:xe(M.createdAgo)}),e.jsx("td",{style:{textAlign:"right"},children:M.sessions})]},M.id))})]})}),e.jsxs(Ce,{className:"pagination-footer",children:[e.jsx(H,{icon:!0,normal:!0,disabled:y===0,onClick:()=>{b(0)},children:e.jsx(cc,{})}),e.jsx(H,{icon:!0,normal:!0,disabled:y===0,onClick:()=>b(M=>Math.max(0,M-1)),children:e.jsx(Kt,{})}),e.jsxs("div",{className:"current-page",children:[e.jsxs("div",{children:["Page ",y+1," of ",L]}),e.jsxs("div",{children:["Showing ",k.length," of ",q]})]}),e.jsx(H,{icon:!0,normal:!0,disabled:y>=L-1,onClick:()=>b(M=>Math.min(k.length-1,M+1)),children:e.jsx(Gt,{})}),e.jsx(H,{icon:!0,normal:!0,disabled:y>=L-1,onClick:()=>b(k.length-1),children:e.jsx(uc,{})})]}),e.jsx(me,{active:D,size:"huge",children:"Loading Players"})]})]}),e.jsxs(rr,{children:[e.jsx(ve,{path:"/players/:id",component:Ph}),e.jsx(ve,{children:e.jsxs("div",{className:"player-inspector-container",children:[e.jsx(ge,{attached:!0,children:"SELECT A PLAYER"}),e.jsx("div",{className:"player-inspector"})]})})]})]})]})]}):null},Oh=(t,n)=>{try{return JSON.stringify(t)===JSON.stringify(n)}catch{return!1}},Dh=()=>{const[t,n]=Ne("/plugins/:id"),[r,s]=N.useState(null),[a,i]=N.useState({}),[o,d]=N.useState(!!r?.path),[g,j]=N.useState(!1),[S,y]=N.useState({}),_=te(V.PluginGet),P=te(V.PluginLoad),x=te(V.PluginUnload),p=te(V.PluginToggle),l=te(V.PluginConfig),c=F.plugin.get.useQuery({shortPath:n?.id??""},{enabled:!!n?.id&&_});N.useEffect(()=>{c.data?(s(c.data),i(c.data.config),d(!1)):c.isError&&d(!1)},[c.data,c.isError]);const u=F.plugin.load.useMutation(),h=F.plugin.unload.useMutation(),v=F.plugin.toggle.useMutation(),m=F.plugin.config.useMutation(),b=async()=>{n?.id&&(j(!0),await u.mutateAsync({shortPath:n.id}),await c.refetch(),j(!1))},f=async()=>{n?.id&&(j(!0),await h.mutateAsync({shortPath:n.id}),await c.refetch(),j(!1))},w=async()=>{if(!n?.id)return;j(!0),await h.mutateAsync({shortPath:n.id})&&await u.mutateAsync({shortPath:n.id}),await c.refetch(),j(!1)},R=async L=>{n?.id&&(j(!0),await v.mutateAsync({shortPath:n.id,enabled:L}),await c.refetch(),j(!1))},D=N.useRef(a);D.current=a;const O=N.useRef(r);O.current=r,F.plugin.onStatus.useSubscription(void 0,{enabled:_,onError:Qe,onData(L){L.shortPath===O.current?.path&&s(z=>({...z,...L}))}});const k=N.useMemo(()=>ic(async()=>{if(!n?.id||!O.current)return;const L={},z=D.current,I=O.current.path;for(const M in O.current?.config??{})O.current?.config[M]!=z[M]&&(L[M]=!0),await m.mutateAsync({shortPath:n?.id,config:z})&&(y(L),setTimeout(()=>{y({}),s(G=>G?.path===I?{...G,config:z}:G)}))},500),[n?.id]),q=(L,z)=>{!r||!a||(i(I=>({...I,[L]:z})),k())};return e.jsxs("div",{className:"plugin-view",children:[e.jsx(me,{active:o,size:"huge",children:"Loading Plugin"}),e.jsx("div",{className:"plugin-info",children:!o&&r&&e.jsxs(be,{children:[e.jsxs("div",{className:"stats",children:[e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Plugin name",children:"Name:"})," ",r.name]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Plugin creator",children:"Author:"})," ",r.documentation?.author??"unknown"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Description:"})," ",r.documentation?.description??"none"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"The folder this plugin runs in",children:"Folder:"})," ",r.path]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"The type of plugin this is",children:"Format:"})," ",r.format]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Number of objects in the plugin's storage",children:"Stored Objects:"})," ",r.objCount]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Plugin can be started",children:"Enabled:"})," ",r.isEnabled?"Yes":"No"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Plugin is running",children:"Loaded:"})," ",r.isLoaded?"Yes":"No"]})]}),e.jsx("div",{className:"section-header","data-tooltip":"Ways to configure the plugin. Changes take place the next time a plugin is loaded.",children:"Configs"}),e.jsxs("div",{className:"option-list",children:[Object.keys(r.documentation.config??{}).length===0&&e.jsx("div",{className:"option-item",children:e.jsx("i",{className:"option-name",children:"None"})}),Object.entries(r.documentation.config??{}).map(([L,z])=>e.jsx("div",{className:"option-item config",children:e.jsxs("div",{className:"option-input",children:[e.jsxs("div",{className:"option-label","data-tooltip":z.description,children:[L,e.jsxs("span",{className:`saved-note ${S[L]?"show":""}`,children:["SAVED ",e.jsx(Yt,{size:"20"})]})]}),e.jsxs("div",{className:"option-value",children:[["string","password","number"].includes(z.type)&&e.jsx(ce,{type:z.type==="string"?"text":z.type,disabled:!l,value:a[L],onChange:I=>q(L,I)}),z.type==="list"&&e.jsx(hu,{options:"options"in z?z.options:void 0,type:z.itemType,disabled:!l,value:a[L],onChange:I=>q(L,I)}),z.type==="players"&&e.jsx(fu,{disabled:!l,value:a[L],onChange:I=>q(L,I)}),z.type==="role"&&e.jsx(pu,{disabled:!l,value:a[L],onChange:I=>q(L,I)}),z.type==="enum"&&e.jsx(da,{options:z.options,disabled:!l,value:a[L],onChange:I=>q(L,I)}),z.type==="boolean"&&e.jsx(_e,{disabled:!l,value:a[L],onChange:I=>q(L,I)}),l&&!Oh(z.default,a[L])&&e.jsx(Yu,{onClick:()=>q(L,z.default),className:"reset-button","data-tooltip":"Reset to default value"})]})]})},L))]}),e.jsx("div",{className:"section-header","data-tooltip":"Ways to control the plugin",children:"Commands"}),e.jsxs("div",{className:"option-list",children:[(r.documentation.commands??[]).length===0&&e.jsx("div",{className:"option-item",children:e.jsx("i",{className:"option-name",children:"None"})}),(r.documentation.commands||[]).map(L=>e.jsxs("div",{className:"option-item",children:[e.jsx("div",{className:"option-name","data-tooltip":L.description,children:L.name}),e.jsx("div",{className:"option-args",children:(L.args||[]).map(z=>e.jsx("div",{className:`option-arg ${z.required?"required":""}`,"data-tooltip":(z.required?"(required) ":"")+z.description,children:z.name},z.name))})]},L.name))]})]})}),e.jsxs(Ce,{attached:!0,children:[P&&r?.isEnabled&&!r.isLoaded&&e.jsxs(H,{main:!0,disabled:g,"data-tooltip":"Start the plugin",onClick:()=>b(),children:[e.jsx($t,{}),"Load"]}),P&&x&&r?.isEnabled&&r.isLoaded&&e.jsxs(H,{warn:!0,"data-tooltip":"Stop, then start the plugin",disabled:g,onClick:()=>w(),children:[e.jsx(dc,{}),"Reload"]}),e.jsx("span",{style:{flex:1}}),x&&r?.isEnabled&&r.isLoaded&&e.jsxs(H,{error:!0,disabled:g,"data-tooltip":"Stop the plugin",onClick:()=>f(),children:[e.jsx(hc,{}),"Unload"]}),p&&r&&!r?.isEnabled&&e.jsxs(H,{main:!0,"data-tooltip":"Allow the plugin to be started",disabled:g,onClick:()=>R(!0),children:[e.jsx(Fe,{}),"Enable"]}),p&&r?.isEnabled&&!r.isLoaded&&e.jsxs(H,{error:!0,"data-tooltip":"Prevent the plugin from being started",disabled:g,onClick:()=>R(!1),children:[e.jsx(ma,{}),"Disable"]})]})]})},Mi=t=>{const n=(t.isLoaded?2:0)+(t.isEnabled?1:0),r=["disabled","broken","bugged","running"][n],s=["Plugin is disabled","Plugin is enabled but not running","Plugin is running but not enabled","Plugin is running"][n],a=[Xu,Vu,Qu,Ju][n];return{...t,state:n,status:r,tooltip:s,icon:a}},Mh=()=>{const t=Ze(V.PluginList);te(V.PluginGet);const[n,r]=N.useState(""),[s,a]=N.useState(!1),[i,o]=N.useState([]),d=te(V.PluginReloadAll),[g,j]=Ne("/plugins/:id?"),{onBack:S,swipeHandlers:y,inspectorOpen:_}=At(!!j?.id,"/plugins"),P=N.useMemo(()=>i.find(v=>v.path===j?.id)?.name??"SELECT A PLUGIN",[i,j?.id]),x=F.plugin.list.useQuery();N.useEffect(()=>{x.data&&o(x.data.map(Mi))},[x.data]);const p=x.isLoading,l=F.plugin.reloadAll.useMutation(),c=()=>{x.refetch()},u=async()=>{a(!0),await l.mutateAsync(),a(!1),c()},h=v=>v.name.toLowerCase().includes(n.toLowerCase());return F.plugin.onStatus.useSubscription(void 0,{enabled:t,onError:Qe,onData(v){const m=Mi(v);o(b=>b.map(f=>f.path===v.shortPath?{...f,...m}:f))}}),t?e.jsxs(e.Fragment,{children:[e.jsxs(De,{title:"Plugins",onBack:S,children:[e.jsx("span",{style:{flex:1}}),d&&e.jsxs(H,{warn:!0,disabled:s,onClick:u,"data-tooltip":"Reload all plugins, this may clear current plugin progress",children:[e.jsx(Ku,{}),"Reload Plugins"]})]}),e.jsxs(Me,{children:[e.jsx(Ae,{}),e.jsxs("div",{className:`generic-container plugins-container ${_?"inspector-open":""}`,...y,children:[e.jsxs("div",{className:"plugins-list-container",children:[e.jsxs(ge,{children:[e.jsx(ce,{type:"text",placeholder:"Search Plugins...",value:n,onChange:v=>r(v)}),e.jsx("span",{style:{flex:1}}),e.jsx(H,{icon:!0,normal:!0,"data-tooltip":"Refresh plugin list",onClick:c,children:e.jsx(Lt,{})})]}),e.jsxs("div",{className:"plugins-list",children:[e.jsx(be,{children:i.map(v=>h(v)&&e.jsxs(at,{href:"/plugins/"+v.path,"data-tooltip":v.documentation?.description,className:`plugin-item ${j?.id===v.path?"selected":""}`,children:[e.jsx(v.icon,{className:v.status,"data-tooltip":v.tooltip}),v.name]},v.path))}),e.jsx(me,{active:p,size:"huge",children:"Loading Plugins"})]})]}),e.jsxs("div",{className:"plugin-inspector-container",children:[e.jsx(ge,{attached:!0,children:P}),e.jsx("div",{className:"plugin-inspector",children:e.jsx(Dh,{})})]})]})]})]}):null},Se=qt({starting:!1,started:!1,stopping:!1,loading:!0}),Lc=()=>{const t=te(V.ServerStatus),{data:n}=F.server.started.useQuery(void 0,{enabled:t});return N.useEffect(()=>{n&&Se.set({started:n.started,starting:n.starting,stopping:n.stopping,loading:!1})},[n]),F.server.onStatus.useSubscription(void 0,{enabled:t,onError:Qe,onData(r){Se.set({started:r.started,starting:r.starting,stopping:r.stopping,loading:!1})}}),ye(Se)},Ah=()=>{Se.set({...Se.get(),loading:!0}),Mt.server.start.mutate()},qh=()=>{Se.set({...Se.get(),loading:!0}),Mt.server.stop.mutate()},kh=()=>{Se.set({...Se.get(),loading:!0}),Mt.server.restart.mutate()},Th=()=>{Se.set({...Se.get(),loading:!0}),Mt.server.update.run.mutate()};function Lh(t){const n=Math.floor((Date.now()-t)/1e3);if(n<60)return"just now";const r=Math.floor(n/60);return r<60?`${r}m ago`:`${Math.floor(r/60)}h ago`}const zh=()=>{const t=Ze(V.ServerStatus),{started:n,stopping:r,starting:s,loading:a}=Lc(),i=Be(),o=te(V.ServerStart),d=te(V.ServerStop),g=te(V.ServerRestart),j=te(V.ServerUpdateRun),S=te(V.ServerAutorestartGet),y=te(V.ServerUpdateCheck),_=te(V.ServerAutorestartSet),P=te(V.WorldSave),[x,p]=N.useState(null),l=ye(fa),[c,u]=N.useState(l?.update?.lastCheck??null);N.useEffect(()=>{u(l?.update?.lastCheck??null)},[l?.update?.lastCheck]);const[h,v]=N.useState(!1),[m,b]=N.useState(null),[f,w]=N.useState(!1),{data:R}=F.server.autoRestart.get.useQuery(void 0,{enabled:S});N.useEffect(()=>{R&&p(R)},[R]);const D=l?.update?.canCheck??!1,O=F.server.update.check.useQuery(void 0,{enabled:!1}),k=N.useCallback(()=>{!D||!y||(v(!0),O.refetch().then(({data:G})=>{u(G??null),b(Date.now()),v(!1)}))},[D,y,O]),q=F.server.autoRestart.set.useMutation(),L=N.useCallback(async()=>{if(!x)return;const G={type:"autoRestartConfig",maxUptime:Math.round(Math.max(1,Math.min(x.maxUptime,168))),maxUptimeEnabled:x.maxUptimeEnabled,emptyUptime:Math.round(Math.max(1,Math.min(x.emptyUptime,168))),emptyUptimeEnabled:x.emptyUptimeEnabled,dailyHour:Math.round(Math.max(0,Math.min(x.dailyHour,23))),dailyHourEnabled:x.dailyHourEnabled,announcementEnabled:x.announcementEnabled,playersEnabled:x.playersEnabled,saveWorld:x.saveWorld,autoUpdateEnabled:x.autoUpdateEnabled??!0,autoUpdateIntervalMins:Math.round(Math.max(10,Math.min(x.autoUpdateIntervalMins??60,1/0))),crashRestartEnabled:x.crashRestartEnabled??!0};q.mutate(G)},[x,q]),z=F.world.save.useMutation(),I=async()=>{w(!0),await z.mutateAsync({}),w(!1)},M=Su(L),Y=G=>X=>{x&&(p(ne=>({...ne,[G]:X})),M.fire())};return t?e.jsxs(e.Fragment,{children:[e.jsx(De,{title:"Server",children:D&&y&&e.jsx(H,{main:!!c,normal:!c,"data-tooltip":"Check for updates",disabled:h,onClick:k,children:h?e.jsxs(e.Fragment,{children:[e.jsx(Zu,{className:"spinning"}),"Checking..."]}):c===!0?e.jsxs(e.Fragment,{children:[e.jsx(ed,{}),"Update Available"]}):e.jsxs(e.Fragment,{children:[e.jsx(td,{}),"Check for Update"]})})}),e.jsxs(Me,{children:[e.jsx(Ae,{}),e.jsxs("div",{className:"generic-container server-container",children:[e.jsxs(ge,{className:"server-status",children:[e.jsx("span",{className:"status-label",children:"Server Status: "}),e.jsx("span",{className:"status-value",children:s?"starting":r?"stopping":n?"started":"stopped"}),D&&y&&c!==null&&e.jsx("span",{className:"status-update",children:c?"Update available":`Up to date${m?` (checked ${Lh(m)})`:""}`})]}),e.jsxs("div",{className:"buttons",children:[o&&e.jsxs(H,{main:!0,"data-tooltip":"Start the server",disabled:s||r||a||n,onClick:()=>i.prompt("start the server").then(G=>G&&Ah()),children:[e.jsx($t,{}),"Start"]}),d&&e.jsxs(H,{error:!0,"data-tooltip":"Stop the server",disabled:s||r||a||!n,onClick:()=>i.prompt("stop the server").then(G=>G&&qh()),children:[e.jsx(hc,{}),"Stop"]}),g&&e.jsxs(H,{warn:!0,"data-tooltip":"Reloads the server's world. Saves minigames/environment/bricks if 'Save World' is enabled below.",disabled:s||r||a,onClick:()=>i.prompt("restart the server").then(G=>G&&kh()),children:[e.jsx(dc,{}),"Restart"]}),P&&e.jsxs(H,{info:!0,"data-tooltip":"Save the current world.",disabled:s||r||a||f,onClick:I,children:[e.jsx(Tt,{}),"Save World"]}),j&&l?.isSteam&&e.jsxs(H,{normal:!c,main:c===!0,"data-tooltip":`Stop and update the server even if there are no updates available.
5
5
 
6
6
  Does not save the world or player locations.`,disabled:s||r||a,onClick:()=>i.prompt("update the server").then(G=>G&&Th()),children:[e.jsx(rd,{}),"Update"]})]}),S&&e.jsxs(ge,{attached:!0,style:{marginTop:8},children:["Auto Restart",e.jsx(Cu,{show:M.status===Ru.Waiting})]}),S&&x&&e.jsxs("div",{className:"inputs-list",children:[e.jsxs("div",{className:"inputs-item","data-tooltip":"When enabled, automatically restarts the server if the game engine crashes",children:[e.jsx("label",{children:"Restart on Crash"}),e.jsx("div",{className:"inputs",children:e.jsx(_e,{disabled:!_,tooltip:"Enabled",value:x.crashRestartEnabled??!0,onChange:Y("crashRestartEnabled")})})]}),e.jsxs("div",{className:"inputs-item","data-tooltip":"When enabled on servers setup with SteamCMD, automatically updates the server when a new version is available",children:[e.jsxs("label",{children:["Auto Update",D?"":" (SteamCMD Only)"]}),e.jsxs("div",{className:"inputs",children:[e.jsx(_e,{disabled:!_,tooltip:"Enabled",value:x.autoUpdateEnabled,onChange:Y("autoUpdateEnabled")}),e.jsx(ce,{disabled:!_,type:"number",placeholder:"Minutes",tooltip:"Interval in minutes to check for updates (min 10)",value:x.autoUpdateIntervalMins,onChange:Y("autoUpdateIntervalMins")})]})]}),e.jsxs("div",{className:"inputs-item","data-tooltip":"How many hours before restarting regardless of online players",children:[e.jsx("label",{children:"Max Server Uptime (Hours)"}),e.jsxs("div",{className:"inputs",children:[e.jsx(_e,{disabled:!_,tooltip:"Enabled",value:x.maxUptimeEnabled,onChange:Y("maxUptimeEnabled")}),e.jsx(ce,{disabled:!_,type:"number",placeholder:"Hours",tooltip:"Uptime Hours",value:x.maxUptime,onChange:Y("maxUptime")})]})]}),e.jsxs("div",{className:"inputs-item","data-tooltip":"How many hours before restarting when no players are online",children:[e.jsx("label",{children:"Empty Server Lifetime (Hours)"}),e.jsxs("div",{className:"inputs",children:[e.jsx(_e,{disabled:!_,tooltip:"Enabled",value:x.emptyUptimeEnabled,onChange:Y("emptyUptimeEnabled")}),e.jsx(ce,{disabled:!_,type:"number",placeholder:"Hours",tooltip:"Uptime Hours",value:x.emptyUptime,onChange:Y("emptyUptime")})]})]}),e.jsxs("div",{className:"inputs-item","data-tooltip":"Restart every day at a certain hour",children:[e.jsx("label",{children:"Daily at a Specific Hour"}),e.jsxs("div",{className:"inputs",children:[e.jsx(_e,{disabled:!_,tooltip:"Enabled",value:x.dailyHourEnabled,onChange:Y("dailyHourEnabled")}),e.jsx(ce,{disabled:!_,type:"number",placeholder:"Hour",tooltip:"Hour (0 = 12am, 13 = 1pm)",value:x.dailyHour,onChange:Y("dailyHour")})]})]}),e.jsxs("div",{className:"inputs-item","data-tooltip":"When enabled, announces auto restart",children:[e.jsx("label",{children:"Restart Announcement"}),e.jsx("div",{className:"inputs",children:e.jsx(_e,{disabled:!_,tooltip:"Enabled",value:x.announcementEnabled,onChange:Y("announcementEnabled")})})]}),e.jsxs("div",{className:"inputs-item","data-tooltip":"When enabled, reconnects players at their previous positions",children:[e.jsx("label",{children:"Reload Players"}),e.jsx("div",{className:"inputs",children:e.jsx(_e,{disabled:!_,tooltip:"Enabled",value:x.playersEnabled,onChange:Y("playersEnabled")})})]}),e.jsxs("div",{className:"inputs-item","data-tooltip":"When enabled, saves the current world. The default world will be loaded on restart",children:[e.jsx("label",{children:"Save World"}),e.jsx("div",{className:"inputs",children:e.jsx(_e,{disabled:!_,tooltip:"Enabled",value:x.saveWorld??!0,onChange:Y("saveWorld")})})]})]}),i.children]})]})]}):null},Ih=()=>{const t=te(V.RoleList),n=te(V.RoleDefaultPermissions),r=ye(et),s=F.role.defaultPermissions.get.useQuery(void 0,{enabled:t}),a=F.role.list.useQuery(void 0,{enabled:n&&!r?.isOwner}),i=F.role.defaultPermissions.set.useMutation(),o=N.useMemo(()=>{if(r?.isOwner)return;if(!a.data)return ze({root:"off",domains:{},scopes:{}});const p=r?.roles??[],l=a.data.filter(c=>p.includes(c.id)).map(c=>c.permissions);return l.length===0?ze({root:"off",domains:{},scopes:{}}):ze(wc(...l))},[r,a.data]),[d,g]=N.useState(null),[j,S]=N.useState(!1),[y,_]=N.useState("");N.useEffect(()=>{s.data&&g({root:s.data.root??"off",domains:s.data.domains??{},scopes:s.data.scopes??{}})},[s.data]);const P=N.useMemo(()=>!d||!s.data?!1:JSON.stringify(d)!==JSON.stringify(s.data),[d,s.data]),x=N.useCallback(async()=>{if(d){S(!0),_("");try{const p=await i.mutateAsync(d);p?_(p):s.refetch()}catch(p){_(p?.message||"Failed to save")}S(!1)}},[d]);return e.jsxs("div",{className:"player-inspector-container",children:[e.jsxs(ge,{attached:!0,children:["Default Permissions",e.jsx("span",{style:{flex:1}}),n&&e.jsxs(H,{normal:!0,disabled:j||!P,onClick:x,children:[e.jsx(Tt,{}),"Save"]})]}),e.jsx("div",{className:"player-inspector",children:e.jsxs("div",{className:"player-view",children:[e.jsx(me,{active:s.isLoading,size:"huge",children:"Loading Defaults"}),e.jsx("div",{className:"player-info",children:d&&e.jsxs(be,{children:[e.jsx("div",{className:"stats",children:e.jsx("div",{className:"stat",children:"These permissions apply to all users who don't have an explicit override set."})}),y&&e.jsx("div",{className:"perm-error",children:y}),e.jsx("div",{className:"section-header",children:"Permissions"}),e.jsx(Jt,{perms:d,onChange:n?g:void 0,actorScopes:o})]})})]})})]})},Hh=()=>{const[t,n]=Ne("/roles/:id"),[r,s]=Je(),a=n?.id??"",i=te(V.RoleEdit),o=te(V.RoleGrantPermission),d=ye(et),g=F.role.list.useQuery(),j=N.useMemo(()=>{if(d?.isOwner)return 1/0;const G=d?.roles??[];let X=-1;for(const ne of g.data??[])if(G.includes(ne.id)){const se=ne.permissions;(se?.root==="all"||se?.domains?.role==="all"||se?.scopes?.["role.edit"]===!0)&&(X=Math.max(X,ne.order))}return X},[d,g.data]),S=F.role.get.useQuery({id:a},{enabled:!!a}),y=F.role.update.useMutation(),_=F.role.delete.useMutation(),P=F.useUtils(),x=S.data,p=x?d?.isOwner||x.order<j:!1,l=i&&p,c=o&&p,u=N.useMemo(()=>{if(d?.isOwner)return;if(!g.data||!x)return ze({root:"off",domains:{},scopes:{}});const G=d?.roles??[],X=g.data.filter(ne=>G.includes(ne.id)&&ne.order>x.order).map(ne=>ne.permissions);return X.length===0?ze({root:"off",domains:{},scopes:{}}):ze(wc(...X))},[d,g.data,x]),[h,v]=N.useState(""),[m,b]=N.useState(""),[f,w]=N.useState(null),[R,D]=N.useState(!1),[O,k]=N.useState(""),[q,L]=N.useState(!1);N.useEffect(()=>{x&&(v(x.name),b(x.description),w(x.permissions),k(""))},[x]);const z=N.useMemo(()=>x?!!(h!==x.name||m!==x.description||f&&JSON.stringify(f)!==JSON.stringify(x.permissions)):!1,[x,h,m,f]),I=N.useCallback(async()=>{if(!(!x||!f)){D(!0),k("");try{const G={id:a};h!==x.name&&(G.name=h),m!==x.description&&(G.description=m),JSON.stringify(f)!==JSON.stringify(x.permissions)&&(G.permissions=f);const X=await y.mutateAsync(G);X?k(X):(S.refetch(),P.role.list.invalidate())}catch{k("Failed to save")}D(!1)}},[x,h,m,f,a]),M=Be({title:"Delete Role"}),Y=async()=>{if(L(!1),!await M.prompt(e.jsxs(e.Fragment,{children:[e.jsxs("p",{children:["Delete role ",e.jsx("b",{children:x?.name}),"?"]}),e.jsx("p",{children:"This will unassign it from all users."})]})))return;const X=await _.mutateAsync({id:a});X?k(X):(P.role.list.invalidate(),s("/roles"))};return a?e.jsxs("div",{className:"player-inspector-container",children:[e.jsxs(ge,{attached:!0,children:[x?.name??"Role",e.jsx("span",{style:{flex:1}}),l&&e.jsxs(H,{normal:!0,disabled:R||!z,onClick:I,children:[e.jsx(Tt,{}),"Save"]})]}),e.jsx("div",{className:`player-inspector ${l?"has-footer":""}`,children:e.jsxs("div",{className:"player-view",children:[e.jsx(me,{active:S.isLoading,size:"huge",children:"Loading Role"}),x&&e.jsx(be,{children:e.jsxs("div",{className:"player-info",children:[O&&e.jsx("div",{className:"perm-error",children:O}),l?e.jsxs("div",{className:"role-inspector-stats",children:[e.jsx("label",{children:"Name"}),e.jsx(ce,{type:"text",value:h,onChange:G=>v(G.slice(0,64))}),e.jsx("label",{children:"Description"}),e.jsx(lc,{value:m,onChange:G=>b(G.slice(0,512)),placeholder:"No description",rows:3}),e.jsx("label",{children:"Order"}),e.jsx("span",{children:x.order})]}):e.jsxs("div",{className:"stats",children:[e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Name:"})," ",x.name]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Description:"})," ",x.description||"No description"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{children:"Order:"})," ",x.order]})]}),e.jsx("div",{className:"section-header",children:"Permissions"}),f&&e.jsx(Jt,{perms:f,onChange:c?w:void 0,actorScopes:u})]})})]})}),l&&x&&e.jsxs(Ce,{attached:!0,children:[e.jsx("span",{style:{flex:1}}),e.jsxs("div",{className:"widgets-container",children:[e.jsxs(H,{normal:!0,boxy:!0,onClick:()=>L(!q),children:[q?e.jsx(ut,{}):e.jsx(dt,{}),"Actions"]}),e.jsx(Ge,{visible:q,direction:"up",className:"widgets-list widgets-list-up",children:e.jsxs(H,{error:!0,onClick:Y,children:[e.jsx(pa,{}),"Delete Role"]})})]})]}),M.children]}):null},Wh=()=>{const t=Ze(V.RoleList),n=te(V.RoleEdit),r=te(V.UserList),s=ye(et),[a,i]=Je(),[o,d]=Ne("/roles/:id?"),{onBack:g,swipeHandlers:j,inspectorOpen:S}=At(!!d?.id,"/roles"),y=F.role.list.useQuery(),_=F.role.create.useMutation(),P=F.role.reorder.useMutation(),x=F.useUtils(),[p,l]=N.useState(!1),[c,u]=N.useState(""),[h,v]=N.useState(""),[m,b]=N.useState(""),[f,w]=N.useState(!1),[R,D]=N.useState(""),[O,k]=N.useState(!1),q=N.useMemo(()=>y.data??[],[y.data]),L=N.useMemo(()=>{if(s?.isOwner)return 1/0;const W=s?.roles??[];let ie=-1;for(const de of q)if(W.includes(de.id)){const U=de.permissions;(U?.root==="all"||U?.domains?.role==="all"||U?.scopes?.["role.edit"]===!0)&&(ie=Math.max(ie,de.order))}return ie},[s,q]),z=n&&L>0,[I,M]=N.useState([]),Y=N.useMemo(()=>{let W=q;if(I.length>0&&(W=I.map(ie=>q.find(de=>de.id===ie)).filter(Boolean)),R){const ie=R.toLowerCase();W=W.filter(de=>de.name.toLowerCase().includes(ie)||de.description.toLowerCase().includes(ie))}return W},[q,I,R]),G=z&&O&&!R,X=W=>{M(W)},ne=async()=>{if(I.length===0)return;const W=I.filter(ie=>{const de=q.find(U=>U.id===ie);return de&&de.order<L});W.length!==0&&(await P.mutateAsync({orderedIds:W}),M([]),x.role.invalidate())},se=()=>{l(!0),u(""),v(""),b("")},Q=()=>{l(!1),u(""),v(""),b("")},he=async()=>{if(b(""),!!c.trim()){w(!0);try{const W=await _.mutateAsync({name:c.trim(),description:h.trim()});if(w(!1),typeof W=="string"){b(W);return}Q(),y.refetch(),W?.id&&i(`/roles/${W.id}`)}catch{w(!1),b("Failed to create role")}}};return t?e.jsxs(e.Fragment,{children:[e.jsx(De,{title:"Roles",onBack:g,children:n&&e.jsxs(H,{main:!0,boxy:!0,onClick:se,children:[e.jsx(Fe,{}),"Create Role"]})}),e.jsxs(Me,{children:[e.jsx(Ae,{}),e.jsxs("div",{className:`generic-container players-container ${S?"inspector-open":""}`,...j,children:[e.jsxs("div",{className:"player-table-container",children:[r&&e.jsxs(ge,{attached:!0,children:[e.jsxs(H,{normal:!0,boxy:!0,className:"tab-button",onClick:()=>i("/users"),children:[e.jsx(fc,{}),"Users"]}),e.jsxs(H,{main:!0,boxy:!0,className:"tab-button active",children:[e.jsx(gc,{}),"Roles"]}),e.jsx("span",{style:{flex:1}})]}),e.jsxs(ge,{attached:!0,children:[e.jsx(ce,{type:"text",placeholder:"Search Roles...",value:R,onChange:W=>D(W)}),e.jsx("span",{style:{flex:1}}),z&&e.jsx(_e,{value:O,onChange:k,disabled:!!R,tooltip:O?"Exit reorder mode":"Reorder roles",icon:e.jsx(wr,{size:16,color:"white"})}),e.jsx(H,{icon:!0,normal:!0,style:{marginLeft:8},"data-tooltip":"Refresh role list",onClick:()=>y.refetch(),children:e.jsx(Lt,{})})]}),e.jsxs("div",{className:"players-list",children:[e.jsx(be,{children:e.jsxs(pd,{axis:"y",values:Y.map(W=>W.id),onReorder:X,as:"table",className:"br-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[G&&e.jsx("th",{className:"no-sort",style:{width:32},children:e.jsx(wr,{size:16})}),e.jsx("th",{className:"no-sort",style:{textAlign:"left",width:"40%"},children:"Name"}),e.jsx("th",{className:"no-sort",style:{textAlign:"left"},children:"Description"})]})}),e.jsx("tbody",{children:Y.map(W=>{const ie=W.order>=L,de=G&&!ie;return e.jsxs(wd,{value:W.id,as:"tr",className:W.id===d?.id?"active":"",onClick:()=>i(`/roles/${W.id}`),onDragEnd:ne,dragListener:de,whileDrag:{zIndex:10,position:"relative"},children:[G&&e.jsx("td",{style:{cursor:de?"grab":"default",width:32},children:e.jsx(wr,{size:16,style:{opacity:ie?.25:1}})}),e.jsx("td",{style:{fontWeight:"bold"},children:W.name}),e.jsx("td",{className:"muted-text",children:W.description})]},W.id)})}),e.jsx("tfoot",{children:e.jsxs("tr",{className:d?.id==="default"?"active":"",onClick:()=>i("/roles/default"),children:[G&&e.jsx("td",{style:{width:32}}),e.jsx("td",{style:{fontWeight:"bold"},children:"Everyone"}),e.jsx("td",{className:"muted-text",children:"Base permissions for all users"})]})})]})}),e.jsx(me,{active:y.isLoading,size:"huge",children:"Loading Roles"})]})]}),e.jsxs(rr,{children:[e.jsx(ve,{path:"/roles/default",component:Ih}),e.jsx(ve,{path:"/roles/:id",component:Hh}),e.jsx(ve,{children:e.jsxs("div",{className:"player-inspector-container",children:[e.jsx(ge,{attached:!0,children:"SELECT A ROLE"}),e.jsx("div",{className:"player-inspector"})]})})]}),e.jsx(sc,{children:p&&e.jsxs(ct,{visible:!0,children:[e.jsx(me,{active:f,size:"huge",children:"Creating"}),e.jsxs(kt,{visible:!f,children:[e.jsx(Ve,{children:"Create New Role"}),e.jsxs(it,{children:[e.jsx("p",{children:"Create a new role with a name and optional description."}),m&&e.jsxs("p",{style:{color:"red"},children:["Error: ",m]})]}),e.jsxs("div",{className:"popout-inputs",children:[e.jsx(ce,{placeholder:"Role name",type:"text",value:c,onChange:W=>u(W.slice(0,64))}),e.jsx(lc,{placeholder:"Description (optional)",value:h,onChange:W=>v(W.slice(0,512)),rows:3}),c.length>=64&&e.jsx("p",{style:{color:"orange",fontSize:13},children:"Name is at the 64 character limit"}),h.length>=512&&e.jsx("p",{style:{color:"orange",fontSize:13},children:"Description is at the 512 character limit"})]}),e.jsxs(Ce,{children:[e.jsxs(H,{main:!0,disabled:!c.trim()||c.trim().length>64||h.length>512,onClick:he,children:[e.jsx(Fe,{}),"Create"]}),e.jsx("div",{style:{flex:1}}),e.jsxs(H,{normal:!0,onClick:Q,children:[e.jsx(Oe,{}),"Cancel"]})]})]})]})})]})]})]}):null},Uh="Enable Users",Bh="Add User",Fh=()=>{const t=Ze(V.UserList),n=ye(fa)?.userless,r=ye(et),s=te(V.UserCreate),a=te(V.RoleList),i=F.role.list.useQuery(void 0,{enabled:a}),o=N.useMemo(()=>{const K={};for(const fe of i.data??[])K[fe.id]=fe;return K},[i.data]),[d,g]=N.useState(0),[j,S]=N.useState(0),[y,_]=N.useState(!0),[P,x]=N.useState([]),[p,l]=N.useState(""),[c,u]=N.useState(""),[h,v]=N.useState(""),[m,b]=N.useState(""),[f,w]=N.useState(""),[R,D]=N.useState(!1),[O,k]=N.useState(!1),[q,L]=N.useState(!1),[z,I]=Je(),[M,Y]=Ne("/users/:id?"),{onBack:G,swipeHandlers:X,inspectorOpen:ne}=At(!!Y?.id,"/users"),se=F.useUtils(),Q=F.user.create.useMutation(),[he,W]=N.useState(!1),ie=()=>{W(!1),k(!0),D(!1),v(""),u("")},de=()=>{W(!1),D(!0),k(!1),v(""),u("")},U=N.useRef({page:0,sort:"lastOnline",direction:-1}),{page:Z,sort:ae,direction:C}=U.current,E=K=>{typeof K=="function"&&(K=K(U.current.page)),U.current.page=K,T()},A=K=>{typeof K=="function"&&(K=K(U.current.direction)),U.current.direction=K},T=async()=>{_(!0);const{page:K,sort:fe,direction:Ie}=U.current,{users:ft,total:yr,pages:ke}=await se.user.list.fetch({page:K,search:"",sort:fe,direction:Ie});g(ke),S(yr),x(ft),_(!1)},$=N.useRef(T);$.current=T;const B=ye(ra);N.useEffect(()=>{t&&T()},[B,t]);const ee=K=>{K==ae?A(fe=>fe*-1):(U.current.sort=K,A(K==="name"?1:-1)),T()},J=N.useMemo(()=>{if(!p)return P;const K=p.toLowerCase();return P.filter(fe=>(fe.username||"Admin").toLowerCase().includes(K))},[P,p]),re=()=>{D(!1),k(!1),v(""),u(""),b(""),w("")},ue=async()=>{if(u(""),m!==f)return;L(!0);let K="";try{if(K=await Q.mutateAsync({username:h,password:m}),L(!1),!K){if(O)bu();else{const fe=h;re(),await T(),I(`/users/${fe}`)}return}}catch(fe){console.error("error setting user credentials",fe)}u(K)},je=N.useMemo(()=>h.match(/^\w{0,32}$/)&&h.length!==0&&m.length!==0,[h,m]);if(!t)return null;const oe=n||!n&&s;return e.jsxs(e.Fragment,{children:[e.jsx(De,{title:"Users",onBack:G,children:oe&&e.jsxs("div",{className:"widgets-container",children:[e.jsxs(H,{normal:!0,boxy:!0,onClick:()=>W(!he),children:[he?e.jsx(dt,{}):e.jsx(ut,{}),"Actions"]}),e.jsxs(Ge,{visible:he,children:[n&&e.jsxs(H,{info:!0,onClick:ie,children:[e.jsx(sa,{}),Uh]}),!n&&s&&e.jsxs(H,{main:!0,onClick:de,children:[e.jsx(Wa,{}),Bh]})]})]})}),e.jsxs(Me,{children:[e.jsx(Ae,{}),e.jsxs("div",{className:`generic-container players-container ${ne?"inspector-open":""}`,...X,children:[e.jsxs("div",{className:"player-table-container",children:[a&&e.jsxs(ge,{attached:!0,children:[e.jsxs(H,{main:!0,boxy:!0,className:"tab-button active",children:[e.jsx(fc,{}),"Users"]}),e.jsxs(H,{normal:!0,boxy:!0,className:"tab-button",onClick:()=>I("/roles"),children:[e.jsx(gc,{}),"Roles"]}),e.jsx("span",{style:{flex:1}})]}),e.jsxs(ge,{attached:!0,children:[e.jsx(ce,{type:"text",placeholder:"Search Users...",value:p,onChange:K=>l(K)}),e.jsx("span",{style:{flex:1}}),e.jsx(H,{icon:!0,normal:!0,"data-tooltip":"Refresh user list",onClick:T,children:e.jsx(Lt,{})})]}),e.jsxs("div",{className:"players-list",children:[e.jsx(be,{children:e.jsxs("table",{className:"br-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",width:"100%"},onClick:()=>ee("username"),children:e.jsxs("span",{children:["Username",e.jsx(we,{name:"username",sort:ae,direction:C})]})}),e.jsx("th",{onClick:()=>ee("lastOnline"),"data-tooltip":"When the user was last active",children:e.jsxs("span",{children:["Active",e.jsx(we,{name:"lastOnline",sort:ae,direction:C})]})}),e.jsx("th",{onClick:()=>ee("created"),"data-tooltip":"When the user joined",children:e.jsxs("span",{children:["Joined",e.jsx(we,{name:"created",sort:ae,direction:C})]})})]})}),e.jsx("tbody",{children:J.map(K=>e.jsxs("tr",{onClick:()=>I(`/users/${K.username}`),className:K.username===Y?.id?"active":"",children:[e.jsxs("td",{children:[e.jsxs("div",{children:[K.isBanned&&e.jsxs("span",{className:"ban",children:[e.jsx(ot,{size:14})," "]}),K.username||"Admin"," ",(K.username||"Admin")===(r?.username||"Admin")&&e.jsx("span",{style:{fontSize:12},children:"(You)"})]}),K.roles?.length>0&&e.jsx("div",{className:"muted-text",style:{fontSize:12},children:K.roles.map(fe=>o[fe]).filter(Boolean).sort((fe,Ie)=>fe.order-Ie.order).map(fe=>fe.name).join(", ")})]}),e.jsx("td",{style:{textAlign:"right"},"data-tooltip":K.lastOnline?new Date(K.lastOnline):"Never",children:K.lastOnline?xe(K.seenAgo):"Never"}),e.jsx("td",{style:{textAlign:"right"},"data-tooltip":new Date(K.created),children:xe(K.createdAgo)})]},K.username))})]})}),e.jsxs(Ce,{className:"pagination-footer",attached:!0,children:[e.jsx(H,{icon:!0,normal:!0,disabled:Z===0,onClick:()=>E(0),children:e.jsx(cc,{})}),e.jsx(H,{icon:!0,normal:!0,disabled:Z===0,onClick:()=>E(K=>Math.max(0,K-1)),children:e.jsx(Kt,{})}),e.jsxs("div",{className:"current-page",children:[e.jsxs("div",{children:["Page ",Z+1," of ",d]}),e.jsxs("div",{children:["Showing ",J.length," of ",j]})]}),e.jsx(H,{icon:!0,normal:!0,disabled:Z>=d-1,onClick:()=>E(K=>Math.min(d-1,K+1)),children:e.jsx(Gt,{})}),e.jsx(H,{icon:!0,normal:!0,disabled:Z>=d-1,onClick:()=>E(d-1),children:e.jsx(uc,{})})]}),e.jsx(me,{active:y,size:"huge",children:"Loading Users"})]})]}),e.jsxs(rr,{children:[e.jsx(ve,{path:"/users/:id",component:_c}),e.jsx(ve,{children:e.jsxs("div",{className:"player-inspector-container",children:[e.jsx(ge,{attached:!0,children:"SELECT A USER"}),e.jsx("div",{className:"player-inspector"})]})})]}),e.jsxs(ct,{visible:R||O,children:[e.jsx(me,{active:q,size:"huge",children:"Submitting"}),e.jsxs(kt,{visible:!q,children:[e.jsx(Ve,{children:O?"Enable Users":"Create New User"}),e.jsxs(it,{children:[O&&e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"This will require you to enter a password when you sign in."}),e.jsx("p",{children:"This action cannot be undone."})]}),R&&e.jsx("p",{children:"Creating a new user. It's recommended to create a temporary password."}),c&&e.jsxs("p",{style:{color:"red"},children:["Error: ",c]})]}),e.jsxs("div",{className:"popout-inputs",children:[e.jsx(ce,{placeholder:"username",type:"text",value:h,onChange:K=>v(K)}),e.jsx(ce,{placeholder:"password",type:"password",value:m,onChange:K=>b(K)}),e.jsx(ce,{placeholder:"confirm password",type:"password",value:f,onChange:K=>w(K),onSubmit:je&&f===m?ue:void 0})]}),e.jsxs(Ce,{children:[e.jsxs(H,{main:!0,disabled:!je||f!==m,onClick:()=>ue(),children:[e.jsx(Wa,{}),O?"Enable":"Add"]}),e.jsx("div",{style:{flex:1}}),e.jsxs(H,{normal:!0,onClick:re,children:[e.jsx(Oe,{}),"Cancel"]})]})]})]})]})]})]})},nt=qt(null),st=qt(null);var qr,Ai;function Gh(){if(Ai)return qr;Ai=1;var t=Math.ceil,n=Math.max;function r(s,a,i,o){for(var d=-1,g=n(t((a-s)/(i||1)),0),j=Array(g);g--;)j[o?g:++d]=s,s+=i;return j}return qr=r,qr}var kr,qi;function Ca(){if(qi)return kr;qi=1;function t(n,r){return n===r||n!==n&&r!==r}return kr=t,kr}var Tr,ki;function zc(){if(ki)return Tr;ki=1;var t=nr(),n=sr(),r="[object AsyncFunction]",s="[object Function]",a="[object GeneratorFunction]",i="[object Proxy]";function o(d){if(!n(d))return!1;var g=t(d);return g==s||g==a||g==r||g==i}return Tr=o,Tr}var Lr,Ti;function Ra(){if(Ti)return Lr;Ti=1;var t=9007199254740991;function n(r){return typeof r=="number"&&r>-1&&r%1==0&&r<=t}return Lr=n,Lr}var zr,Li;function dr(){if(Li)return zr;Li=1;var t=zc(),n=Ra();function r(s){return s!=null&&n(s.length)&&!t(s)}return zr=r,zr}var Ir,zi;function Na(){if(zi)return Ir;zi=1;var t=9007199254740991,n=/^(?:0|[1-9]\d*)$/;function r(s,a){var i=typeof s;return a=a??t,!!a&&(i=="number"||i!="symbol"&&n.test(s))&&s>-1&&s%1==0&&s<a}return Ir=r,Ir}var Hr,Ii;function Ic(){if(Ii)return Hr;Ii=1;var t=Ca(),n=dr(),r=Na(),s=sr();function a(i,o,d){if(!s(d))return!1;var g=typeof o;return(g=="number"?n(d)&&r(o,d.length):g=="string"&&o in d)?t(d[o],i):!1}return Hr=a,Hr}var Wr,Hi;function $h(){if(Hi)return Wr;Hi=1;var t=ju(),n=1/0,r=17976931348623157e292;function s(a){if(!a)return a===0?a:0;if(a=t(a),a===n||a===-n){var i=a<0?-1:1;return i*r}return a===a?a:0}return Wr=s,Wr}var Ur,Wi;function Yh(){if(Wi)return Ur;Wi=1;var t=Gh(),n=Ic(),r=$h();function s(a){return function(i,o,d){return d&&typeof d!="number"&&n(i,o,d)&&(o=d=void 0),i=r(i),o===void 0?(o=i,i=0):o=r(o),d=d===void 0?i<o?1:-1:r(d),t(i,o,d,a)}}return Ur=s,Ur}var Br,Ui;function Kh(){if(Ui)return Br;Ui=1;var t=Yh(),n=t();return Br=n,Br}var Xh=Kh();const Bi=ga(Xh);var Fr,Fi;function Hc(){if(Fi)return Fr;Fi=1;function t(n,r){for(var s=-1,a=r.length,i=n.length;++s<a;)n[i+s]=r[s];return n}return Fr=t,Fr}var Gr,Gi;function Vh(){if(Gi)return Gr;Gi=1;var t=nr(),n=ar(),r="[object Arguments]";function s(a){return n(a)&&t(a)==r}return Gr=s,Gr}var $r,$i;function Pa(){if($i)return $r;$i=1;var t=Vh(),n=ar(),r=Object.prototype,s=r.hasOwnProperty,a=r.propertyIsEnumerable,i=t((function(){return arguments})())?t:function(o){return n(o)&&s.call(o,"callee")&&!a.call(o,"callee")};return $r=i,$r}var Yr,Yi;function qe(){if(Yi)return Yr;Yi=1;var t=Array.isArray;return Yr=t,Yr}var Kr,Ki;function Qh(){if(Ki)return Kr;Ki=1;var t=ha(),n=Pa(),r=qe(),s=t?t.isConcatSpreadable:void 0;function a(i){return r(i)||n(i)||!!(s&&i&&i[s])}return Kr=a,Kr}var Xr,Xi;function Jh(){if(Xi)return Xr;Xi=1;var t=Hc(),n=Qh();function r(s,a,i,o,d){var g=-1,j=s.length;for(i||(i=n),d||(d=[]);++g<j;){var S=s[g];a>0&&i(S)?a>1?r(S,a-1,i,o,d):t(d,S):o||(d[d.length]=S)}return d}return Xr=r,Xr}var Vr,Vi;function Wc(){if(Vi)return Vr;Vi=1;function t(n,r){for(var s=-1,a=n==null?0:n.length,i=Array(a);++s<a;)i[s]=r(n[s],s,n);return i}return Vr=t,Vr}var Qr,Qi;function Ea(){if(Qi)return Qr;Qi=1;var t=qe(),n=ir(),r=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,s=/^\w*$/;function a(i,o){if(t(i))return!1;var d=typeof i;return d=="number"||d=="symbol"||d=="boolean"||i==null||n(i)?!0:s.test(i)||!r.test(i)||o!=null&&i in Object(o)}return Qr=a,Qr}var Jr,Ji;function Zh(){if(Ji)return Jr;Ji=1;var t=$e(),n=t["__core-js_shared__"];return Jr=n,Jr}var Zr,Zi;function ef(){if(Zi)return Zr;Zi=1;var t=Zh(),n=(function(){var s=/[^.]+$/.exec(t&&t.keys&&t.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""})();function r(s){return!!n&&n in s}return Zr=r,Zr}var en,eo;function Uc(){if(eo)return en;eo=1;var t=Function.prototype,n=t.toString;function r(s){if(s!=null){try{return n.call(s)}catch{}try{return s+""}catch{}}return""}return en=r,en}var tn,to;function tf(){if(to)return tn;to=1;var t=zc(),n=ef(),r=sr(),s=Uc(),a=/[\\^$.*+?()[\]{}|]/g,i=/^\[object .+?Constructor\]$/,o=Function.prototype,d=Object.prototype,g=o.toString,j=d.hasOwnProperty,S=RegExp("^"+g.call(j).replace(a,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function y(_){if(!r(_)||n(_))return!1;var P=t(_)?S:i;return P.test(s(_))}return tn=y,tn}var rn,ro;function rf(){if(ro)return rn;ro=1;function t(n,r){return n?.[r]}return rn=t,rn}var nn,no;function tt(){if(no)return nn;no=1;var t=tf(),n=rf();function r(s,a){var i=n(s,a);return t(i)?i:void 0}return nn=r,nn}var sn,so;function hr(){if(so)return sn;so=1;var t=tt(),n=t(Object,"create");return sn=n,sn}var an,ao;function nf(){if(ao)return an;ao=1;var t=hr();function n(){this.__data__=t?t(null):{},this.size=0}return an=n,an}var on,io;function sf(){if(io)return on;io=1;function t(n){var r=this.has(n)&&delete this.__data__[n];return this.size-=r?1:0,r}return on=t,on}var ln,oo;function af(){if(oo)return ln;oo=1;var t=hr(),n="__lodash_hash_undefined__",r=Object.prototype,s=r.hasOwnProperty;function a(i){var o=this.__data__;if(t){var d=o[i];return d===n?void 0:d}return s.call(o,i)?o[i]:void 0}return ln=a,ln}var cn,lo;function of(){if(lo)return cn;lo=1;var t=hr(),n=Object.prototype,r=n.hasOwnProperty;function s(a){var i=this.__data__;return t?i[a]!==void 0:r.call(i,a)}return cn=s,cn}var un,co;function lf(){if(co)return un;co=1;var t=hr(),n="__lodash_hash_undefined__";function r(s,a){var i=this.__data__;return this.size+=this.has(s)?0:1,i[s]=t&&a===void 0?n:a,this}return un=r,un}var dn,uo;function cf(){if(uo)return dn;uo=1;var t=nf(),n=sf(),r=af(),s=of(),a=lf();function i(o){var d=-1,g=o==null?0:o.length;for(this.clear();++d<g;){var j=o[d];this.set(j[0],j[1])}}return i.prototype.clear=t,i.prototype.delete=n,i.prototype.get=r,i.prototype.has=s,i.prototype.set=a,dn=i,dn}var hn,ho;function uf(){if(ho)return hn;ho=1;function t(){this.__data__=[],this.size=0}return hn=t,hn}var fn,fo;function fr(){if(fo)return fn;fo=1;var t=Ca();function n(r,s){for(var a=r.length;a--;)if(t(r[a][0],s))return a;return-1}return fn=n,fn}var pn,po;function df(){if(po)return pn;po=1;var t=fr(),n=Array.prototype,r=n.splice;function s(a){var i=this.__data__,o=t(i,a);if(o<0)return!1;var d=i.length-1;return o==d?i.pop():r.call(i,o,1),--this.size,!0}return pn=s,pn}var mn,mo;function hf(){if(mo)return mn;mo=1;var t=fr();function n(r){var s=this.__data__,a=t(s,r);return a<0?void 0:s[a][1]}return mn=n,mn}var gn,go;function ff(){if(go)return gn;go=1;var t=fr();function n(r){return t(this.__data__,r)>-1}return gn=n,gn}var vn,vo;function pf(){if(vo)return vn;vo=1;var t=fr();function n(r,s){var a=this.__data__,i=t(a,r);return i<0?(++this.size,a.push([r,s])):a[i][1]=s,this}return vn=n,vn}var yn,yo;function pr(){if(yo)return yn;yo=1;var t=uf(),n=df(),r=hf(),s=ff(),a=pf();function i(o){var d=-1,g=o==null?0:o.length;for(this.clear();++d<g;){var j=o[d];this.set(j[0],j[1])}}return i.prototype.clear=t,i.prototype.delete=n,i.prototype.get=r,i.prototype.has=s,i.prototype.set=a,yn=i,yn}var xn,xo;function Oa(){if(xo)return xn;xo=1;var t=tt(),n=$e(),r=t(n,"Map");return xn=r,xn}var bn,bo;function mf(){if(bo)return bn;bo=1;var t=cf(),n=pr(),r=Oa();function s(){this.size=0,this.__data__={hash:new t,map:new(r||n),string:new t}}return bn=s,bn}var jn,jo;function gf(){if(jo)return jn;jo=1;function t(n){var r=typeof n;return r=="string"||r=="number"||r=="symbol"||r=="boolean"?n!=="__proto__":n===null}return jn=t,jn}var wn,wo;function mr(){if(wo)return wn;wo=1;var t=gf();function n(r,s){var a=r.__data__;return t(s)?a[typeof s=="string"?"string":"hash"]:a.map}return wn=n,wn}var _n,_o;function vf(){if(_o)return _n;_o=1;var t=mr();function n(r){var s=t(this,r).delete(r);return this.size-=s?1:0,s}return _n=n,_n}var Sn,So;function yf(){if(So)return Sn;So=1;var t=mr();function n(r){return t(this,r).get(r)}return Sn=n,Sn}var Cn,Co;function xf(){if(Co)return Cn;Co=1;var t=mr();function n(r){return t(this,r).has(r)}return Cn=n,Cn}var Rn,Ro;function bf(){if(Ro)return Rn;Ro=1;var t=mr();function n(r,s){var a=t(this,r),i=a.size;return a.set(r,s),this.size+=a.size==i?0:1,this}return Rn=n,Rn}var Nn,No;function Da(){if(No)return Nn;No=1;var t=mf(),n=vf(),r=yf(),s=xf(),a=bf();function i(o){var d=-1,g=o==null?0:o.length;for(this.clear();++d<g;){var j=o[d];this.set(j[0],j[1])}}return i.prototype.clear=t,i.prototype.delete=n,i.prototype.get=r,i.prototype.has=s,i.prototype.set=a,Nn=i,Nn}var Pn,Po;function jf(){if(Po)return Pn;Po=1;var t=Da(),n="Expected a function";function r(s,a){if(typeof s!="function"||a!=null&&typeof a!="function")throw new TypeError(n);var i=function(){var o=arguments,d=a?a.apply(this,o):o[0],g=i.cache;if(g.has(d))return g.get(d);var j=s.apply(this,o);return i.cache=g.set(d,j)||g,j};return i.cache=new(r.Cache||t),i}return r.Cache=t,Pn=r,Pn}var En,Eo;function wf(){if(Eo)return En;Eo=1;var t=jf(),n=500;function r(s){var a=t(s,function(o){return i.size===n&&i.clear(),o}),i=a.cache;return a}return En=r,En}var On,Oo;function _f(){if(Oo)return On;Oo=1;var t=wf(),n=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,r=/\\(\\)?/g,s=t(function(a){var i=[];return a.charCodeAt(0)===46&&i.push(""),a.replace(n,function(o,d,g,j){i.push(g?j.replace(r,"$1"):d||o)}),i});return On=s,On}var Dn,Do;function Sf(){if(Do)return Dn;Do=1;var t=ha(),n=Wc(),r=qe(),s=ir(),a=t?t.prototype:void 0,i=a?a.toString:void 0;function o(d){if(typeof d=="string")return d;if(r(d))return n(d,o)+"";if(s(d))return i?i.call(d):"";var g=d+"";return g=="0"&&1/d==-1/0?"-0":g}return Dn=o,Dn}var Mn,Mo;function Cf(){if(Mo)return Mn;Mo=1;var t=Sf();function n(r){return r==null?"":t(r)}return Mn=n,Mn}var An,Ao;function Bc(){if(Ao)return An;Ao=1;var t=qe(),n=Ea(),r=_f(),s=Cf();function a(i,o){return t(i)?i:n(i,o)?[i]:r(s(i))}return An=a,An}var qn,qo;function gr(){if(qo)return qn;qo=1;var t=ir();function n(r){if(typeof r=="string"||t(r))return r;var s=r+"";return s=="0"&&1/r==-1/0?"-0":s}return qn=n,qn}var kn,ko;function Ma(){if(ko)return kn;ko=1;var t=Bc(),n=gr();function r(s,a){a=t(a,s);for(var i=0,o=a.length;s!=null&&i<o;)s=s[n(a[i++])];return i&&i==o?s:void 0}return kn=r,kn}var Tn,To;function Rf(){if(To)return Tn;To=1;var t=pr();function n(){this.__data__=new t,this.size=0}return Tn=n,Tn}var Ln,Lo;function Nf(){if(Lo)return Ln;Lo=1;function t(n){var r=this.__data__,s=r.delete(n);return this.size=r.size,s}return Ln=t,Ln}var zn,zo;function Pf(){if(zo)return zn;zo=1;function t(n){return this.__data__.get(n)}return zn=t,zn}var In,Io;function Ef(){if(Io)return In;Io=1;function t(n){return this.__data__.has(n)}return In=t,In}var Hn,Ho;function Of(){if(Ho)return Hn;Ho=1;var t=pr(),n=Oa(),r=Da(),s=200;function a(i,o){var d=this.__data__;if(d instanceof t){var g=d.__data__;if(!n||g.length<s-1)return g.push([i,o]),this.size=++d.size,this;d=this.__data__=new r(g)}return d.set(i,o),this.size=d.size,this}return Hn=a,Hn}var Wn,Wo;function Fc(){if(Wo)return Wn;Wo=1;var t=pr(),n=Rf(),r=Nf(),s=Pf(),a=Ef(),i=Of();function o(d){var g=this.__data__=new t(d);this.size=g.size}return o.prototype.clear=n,o.prototype.delete=r,o.prototype.get=s,o.prototype.has=a,o.prototype.set=i,Wn=o,Wn}var Un,Uo;function Df(){if(Uo)return Un;Uo=1;var t="__lodash_hash_undefined__";function n(r){return this.__data__.set(r,t),this}return Un=n,Un}var Bn,Bo;function Mf(){if(Bo)return Bn;Bo=1;function t(n){return this.__data__.has(n)}return Bn=t,Bn}var Fn,Fo;function Af(){if(Fo)return Fn;Fo=1;var t=Da(),n=Df(),r=Mf();function s(a){var i=-1,o=a==null?0:a.length;for(this.__data__=new t;++i<o;)this.add(a[i])}return s.prototype.add=s.prototype.push=n,s.prototype.has=r,Fn=s,Fn}var Gn,Go;function qf(){if(Go)return Gn;Go=1;function t(n,r){for(var s=-1,a=n==null?0:n.length;++s<a;)if(r(n[s],s,n))return!0;return!1}return Gn=t,Gn}var $n,$o;function kf(){if($o)return $n;$o=1;function t(n,r){return n.has(r)}return $n=t,$n}var Yn,Yo;function Gc(){if(Yo)return Yn;Yo=1;var t=Af(),n=qf(),r=kf(),s=1,a=2;function i(o,d,g,j,S,y){var _=g&s,P=o.length,x=d.length;if(P!=x&&!(_&&x>P))return!1;var p=y.get(o),l=y.get(d);if(p&&l)return p==d&&l==o;var c=-1,u=!0,h=g&a?new t:void 0;for(y.set(o,d),y.set(d,o);++c<P;){var v=o[c],m=d[c];if(j)var b=_?j(m,v,c,d,o,y):j(v,m,c,o,d,y);if(b!==void 0){if(b)continue;u=!1;break}if(h){if(!n(d,function(f,w){if(!r(h,w)&&(v===f||S(v,f,g,j,y)))return h.push(w)})){u=!1;break}}else if(!(v===m||S(v,m,g,j,y))){u=!1;break}}return y.delete(o),y.delete(d),u}return Yn=i,Yn}var Kn,Ko;function Tf(){if(Ko)return Kn;Ko=1;var t=$e(),n=t.Uint8Array;return Kn=n,Kn}var Xn,Xo;function Lf(){if(Xo)return Xn;Xo=1;function t(n){var r=-1,s=Array(n.size);return n.forEach(function(a,i){s[++r]=[i,a]}),s}return Xn=t,Xn}var Vn,Vo;function zf(){if(Vo)return Vn;Vo=1;function t(n){var r=-1,s=Array(n.size);return n.forEach(function(a){s[++r]=a}),s}return Vn=t,Vn}var Qn,Qo;function If(){if(Qo)return Qn;Qo=1;var t=ha(),n=Tf(),r=Ca(),s=Gc(),a=Lf(),i=zf(),o=1,d=2,g="[object Boolean]",j="[object Date]",S="[object Error]",y="[object Map]",_="[object Number]",P="[object RegExp]",x="[object Set]",p="[object String]",l="[object Symbol]",c="[object ArrayBuffer]",u="[object DataView]",h=t?t.prototype:void 0,v=h?h.valueOf:void 0;function m(b,f,w,R,D,O,k){switch(w){case u:if(b.byteLength!=f.byteLength||b.byteOffset!=f.byteOffset)return!1;b=b.buffer,f=f.buffer;case c:return!(b.byteLength!=f.byteLength||!O(new n(b),new n(f)));case g:case j:case _:return r(+b,+f);case S:return b.name==f.name&&b.message==f.message;case P:case p:return b==f+"";case y:var q=a;case x:var L=R&o;if(q||(q=i),b.size!=f.size&&!L)return!1;var z=k.get(b);if(z)return z==f;R|=d,k.set(b,f);var I=s(q(b),q(f),R,D,O,k);return k.delete(b),I;case l:if(v)return v.call(b)==v.call(f)}return!1}return Qn=m,Qn}var Jn,Jo;function Hf(){if(Jo)return Jn;Jo=1;var t=Hc(),n=qe();function r(s,a,i){var o=a(s);return n(s)?o:t(o,i(s))}return Jn=r,Jn}var Zn,Zo;function Wf(){if(Zo)return Zn;Zo=1;function t(n,r){for(var s=-1,a=n==null?0:n.length,i=0,o=[];++s<a;){var d=n[s];r(d,s,n)&&(o[i++]=d)}return o}return Zn=t,Zn}var es,el;function Uf(){if(el)return es;el=1;function t(){return[]}return es=t,es}var ts,tl;function Bf(){if(tl)return ts;tl=1;var t=Wf(),n=Uf(),r=Object.prototype,s=r.propertyIsEnumerable,a=Object.getOwnPropertySymbols,i=a?function(o){return o==null?[]:(o=Object(o),t(a(o),function(d){return s.call(o,d)}))}:n;return ts=i,ts}var rs,rl;function Ff(){if(rl)return rs;rl=1;function t(n,r){for(var s=-1,a=Array(n);++s<n;)a[s]=r(s);return a}return rs=t,rs}var Nt={exports:{}},ns,nl;function Gf(){if(nl)return ns;nl=1;function t(){return!1}return ns=t,ns}Nt.exports;var sl;function $c(){return sl||(sl=1,(function(t,n){var r=$e(),s=Gf(),a=n&&!n.nodeType&&n,i=a&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===a,d=o?r.Buffer:void 0,g=d?d.isBuffer:void 0,j=g||s;t.exports=j})(Nt,Nt.exports)),Nt.exports}var ss,al;function $f(){if(al)return ss;al=1;var t=nr(),n=Ra(),r=ar(),s="[object Arguments]",a="[object Array]",i="[object Boolean]",o="[object Date]",d="[object Error]",g="[object Function]",j="[object Map]",S="[object Number]",y="[object Object]",_="[object RegExp]",P="[object Set]",x="[object String]",p="[object WeakMap]",l="[object ArrayBuffer]",c="[object DataView]",u="[object Float32Array]",h="[object Float64Array]",v="[object Int8Array]",m="[object Int16Array]",b="[object Int32Array]",f="[object Uint8Array]",w="[object Uint8ClampedArray]",R="[object Uint16Array]",D="[object Uint32Array]",O={};O[u]=O[h]=O[v]=O[m]=O[b]=O[f]=O[w]=O[R]=O[D]=!0,O[s]=O[a]=O[l]=O[i]=O[c]=O[o]=O[d]=O[g]=O[j]=O[S]=O[y]=O[_]=O[P]=O[x]=O[p]=!1;function k(q){return r(q)&&n(q.length)&&!!O[t(q)]}return ss=k,ss}var as,il;function Yc(){if(il)return as;il=1;function t(n){return function(r){return n(r)}}return as=t,as}var Pt={exports:{}};Pt.exports;var ol;function Yf(){return ol||(ol=1,(function(t,n){var r=wu(),s=n&&!n.nodeType&&n,a=s&&!0&&t&&!t.nodeType&&t,i=a&&a.exports===s,o=i&&r.process,d=(function(){try{var g=a&&a.require&&a.require("util").types;return g||o&&o.binding&&o.binding("util")}catch{}})();t.exports=d})(Pt,Pt.exports)),Pt.exports}var is,ll;function Kc(){if(ll)return is;ll=1;var t=$f(),n=Yc(),r=Yf(),s=r&&r.isTypedArray,a=s?n(s):t;return is=a,is}var os,cl;function Kf(){if(cl)return os;cl=1;var t=Ff(),n=Pa(),r=qe(),s=$c(),a=Na(),i=Kc(),o=Object.prototype,d=o.hasOwnProperty;function g(j,S){var y=r(j),_=!y&&n(j),P=!y&&!_&&s(j),x=!y&&!_&&!P&&i(j),p=y||_||P||x,l=p?t(j.length,String):[],c=l.length;for(var u in j)(S||d.call(j,u))&&!(p&&(u=="length"||P&&(u=="offset"||u=="parent")||x&&(u=="buffer"||u=="byteLength"||u=="byteOffset")||a(u,c)))&&l.push(u);return l}return os=g,os}var ls,ul;function Xf(){if(ul)return ls;ul=1;var t=Object.prototype;function n(r){var s=r&&r.constructor,a=typeof s=="function"&&s.prototype||t;return r===a}return ls=n,ls}var cs,dl;function Vf(){if(dl)return cs;dl=1;function t(n,r){return function(s){return n(r(s))}}return cs=t,cs}var us,hl;function Qf(){if(hl)return us;hl=1;var t=Vf(),n=t(Object.keys,Object);return us=n,us}var ds,fl;function Jf(){if(fl)return ds;fl=1;var t=Xf(),n=Qf(),r=Object.prototype,s=r.hasOwnProperty;function a(i){if(!t(i))return n(i);var o=[];for(var d in Object(i))s.call(i,d)&&d!="constructor"&&o.push(d);return o}return ds=a,ds}var hs,pl;function Aa(){if(pl)return hs;pl=1;var t=Kf(),n=Jf(),r=dr();function s(a){return r(a)?t(a):n(a)}return hs=s,hs}var fs,ml;function Zf(){if(ml)return fs;ml=1;var t=Hf(),n=Bf(),r=Aa();function s(a){return t(a,r,n)}return fs=s,fs}var ps,gl;function ep(){if(gl)return ps;gl=1;var t=Zf(),n=1,r=Object.prototype,s=r.hasOwnProperty;function a(i,o,d,g,j,S){var y=d&n,_=t(i),P=_.length,x=t(o),p=x.length;if(P!=p&&!y)return!1;for(var l=P;l--;){var c=_[l];if(!(y?c in o:s.call(o,c)))return!1}var u=S.get(i),h=S.get(o);if(u&&h)return u==o&&h==i;var v=!0;S.set(i,o),S.set(o,i);for(var m=y;++l<P;){c=_[l];var b=i[c],f=o[c];if(g)var w=y?g(f,b,c,o,i,S):g(b,f,c,i,o,S);if(!(w===void 0?b===f||j(b,f,d,g,S):w)){v=!1;break}m||(m=c=="constructor")}if(v&&!m){var R=i.constructor,D=o.constructor;R!=D&&"constructor"in i&&"constructor"in o&&!(typeof R=="function"&&R instanceof R&&typeof D=="function"&&D instanceof D)&&(v=!1)}return S.delete(i),S.delete(o),v}return ps=a,ps}var ms,vl;function tp(){if(vl)return ms;vl=1;var t=tt(),n=$e(),r=t(n,"DataView");return ms=r,ms}var gs,yl;function rp(){if(yl)return gs;yl=1;var t=tt(),n=$e(),r=t(n,"Promise");return gs=r,gs}var vs,xl;function np(){if(xl)return vs;xl=1;var t=tt(),n=$e(),r=t(n,"Set");return vs=r,vs}var ys,bl;function sp(){if(bl)return ys;bl=1;var t=tt(),n=$e(),r=t(n,"WeakMap");return ys=r,ys}var xs,jl;function ap(){if(jl)return xs;jl=1;var t=tp(),n=Oa(),r=rp(),s=np(),a=sp(),i=nr(),o=Uc(),d="[object Map]",g="[object Object]",j="[object Promise]",S="[object Set]",y="[object WeakMap]",_="[object DataView]",P=o(t),x=o(n),p=o(r),l=o(s),c=o(a),u=i;return(t&&u(new t(new ArrayBuffer(1)))!=_||n&&u(new n)!=d||r&&u(r.resolve())!=j||s&&u(new s)!=S||a&&u(new a)!=y)&&(u=function(h){var v=i(h),m=v==g?h.constructor:void 0,b=m?o(m):"";if(b)switch(b){case P:return _;case x:return d;case p:return j;case l:return S;case c:return y}return v}),xs=u,xs}var bs,wl;function ip(){if(wl)return bs;wl=1;var t=Fc(),n=Gc(),r=If(),s=ep(),a=ap(),i=qe(),o=$c(),d=Kc(),g=1,j="[object Arguments]",S="[object Array]",y="[object Object]",_=Object.prototype,P=_.hasOwnProperty;function x(p,l,c,u,h,v){var m=i(p),b=i(l),f=m?S:a(p),w=b?S:a(l);f=f==j?y:f,w=w==j?y:w;var R=f==y,D=w==y,O=f==w;if(O&&o(p)){if(!o(l))return!1;m=!0,R=!1}if(O&&!R)return v||(v=new t),m||d(p)?n(p,l,c,u,h,v):r(p,l,f,c,u,h,v);if(!(c&g)){var k=R&&P.call(p,"__wrapped__"),q=D&&P.call(l,"__wrapped__");if(k||q){var L=k?p.value():p,z=q?l.value():l;return v||(v=new t),h(L,z,c,u,v)}}return O?(v||(v=new t),s(p,l,c,u,h,v)):!1}return bs=x,bs}var js,_l;function Xc(){if(_l)return js;_l=1;var t=ip(),n=ar();function r(s,a,i,o,d){return s===a?!0:s==null||a==null||!n(s)&&!n(a)?s!==s&&a!==a:t(s,a,i,o,r,d)}return js=r,js}var ws,Sl;function op(){if(Sl)return ws;Sl=1;var t=Fc(),n=Xc(),r=1,s=2;function a(i,o,d,g){var j=d.length,S=j,y=!g;if(i==null)return!S;for(i=Object(i);j--;){var _=d[j];if(y&&_[2]?_[1]!==i[_[0]]:!(_[0]in i))return!1}for(;++j<S;){_=d[j];var P=_[0],x=i[P],p=_[1];if(y&&_[2]){if(x===void 0&&!(P in i))return!1}else{var l=new t;if(g)var c=g(x,p,P,i,o,l);if(!(c===void 0?n(p,x,r|s,g,l):c))return!1}}return!0}return ws=a,ws}var _s,Cl;function Vc(){if(Cl)return _s;Cl=1;var t=sr();function n(r){return r===r&&!t(r)}return _s=n,_s}var Ss,Rl;function lp(){if(Rl)return Ss;Rl=1;var t=Vc(),n=Aa();function r(s){for(var a=n(s),i=a.length;i--;){var o=a[i],d=s[o];a[i]=[o,d,t(d)]}return a}return Ss=r,Ss}var Cs,Nl;function Qc(){if(Nl)return Cs;Nl=1;function t(n,r){return function(s){return s==null?!1:s[n]===r&&(r!==void 0||n in Object(s))}}return Cs=t,Cs}var Rs,Pl;function cp(){if(Pl)return Rs;Pl=1;var t=op(),n=lp(),r=Qc();function s(a){var i=n(a);return i.length==1&&i[0][2]?r(i[0][0],i[0][1]):function(o){return o===a||t(o,a,i)}}return Rs=s,Rs}var Ns,El;function up(){if(El)return Ns;El=1;var t=Ma();function n(r,s,a){var i=r==null?void 0:t(r,s);return i===void 0?a:i}return Ns=n,Ns}var Ps,Ol;function dp(){if(Ol)return Ps;Ol=1;function t(n,r){return n!=null&&r in Object(n)}return Ps=t,Ps}var Es,Dl;function hp(){if(Dl)return Es;Dl=1;var t=Bc(),n=Pa(),r=qe(),s=Na(),a=Ra(),i=gr();function o(d,g,j){g=t(g,d);for(var S=-1,y=g.length,_=!1;++S<y;){var P=i(g[S]);if(!(_=d!=null&&j(d,P)))break;d=d[P]}return _||++S!=y?_:(y=d==null?0:d.length,!!y&&a(y)&&s(P,y)&&(r(d)||n(d)))}return Es=o,Es}var Os,Ml;function fp(){if(Ml)return Os;Ml=1;var t=dp(),n=hp();function r(s,a){return s!=null&&n(s,a,t)}return Os=r,Os}var Ds,Al;function pp(){if(Al)return Ds;Al=1;var t=Xc(),n=up(),r=fp(),s=Ea(),a=Vc(),i=Qc(),o=gr(),d=1,g=2;function j(S,y){return s(S)&&a(y)?i(o(S),y):function(_){var P=n(_,S);return P===void 0&&P===y?r(_,S):t(y,P,d|g)}}return Ds=j,Ds}var Ms,ql;function vr(){if(ql)return Ms;ql=1;function t(n){return n}return Ms=t,Ms}var As,kl;function mp(){if(kl)return As;kl=1;function t(n){return function(r){return r?.[n]}}return As=t,As}var qs,Tl;function gp(){if(Tl)return qs;Tl=1;var t=Ma();function n(r){return function(s){return t(s,r)}}return qs=n,qs}var ks,Ll;function vp(){if(Ll)return ks;Ll=1;var t=mp(),n=gp(),r=Ea(),s=gr();function a(i){return r(i)?t(s(i)):n(i)}return ks=a,ks}var Ts,zl;function yp(){if(zl)return Ts;zl=1;var t=cp(),n=pp(),r=vr(),s=qe(),a=vp();function i(o){return typeof o=="function"?o:o==null?r:typeof o=="object"?s(o)?n(o[0],o[1]):t(o):a(o)}return Ts=i,Ts}var Ls,Il;function xp(){if(Il)return Ls;Il=1;function t(n){return function(r,s,a){for(var i=-1,o=Object(r),d=a(r),g=d.length;g--;){var j=d[n?g:++i];if(s(o[j],j,o)===!1)break}return r}}return Ls=t,Ls}var zs,Hl;function bp(){if(Hl)return zs;Hl=1;var t=xp(),n=t();return zs=n,zs}var Is,Wl;function jp(){if(Wl)return Is;Wl=1;var t=bp(),n=Aa();function r(s,a){return s&&t(s,a,n)}return Is=r,Is}var Hs,Ul;function wp(){if(Ul)return Hs;Ul=1;var t=dr();function n(r,s){return function(a,i){if(a==null)return a;if(!t(a))return r(a,i);for(var o=a.length,d=s?o:-1,g=Object(a);(s?d--:++d<o)&&i(g[d],d,g)!==!1;);return a}}return Hs=n,Hs}var Ws,Bl;function _p(){if(Bl)return Ws;Bl=1;var t=jp(),n=wp(),r=n(t);return Ws=r,Ws}var Us,Fl;function Sp(){if(Fl)return Us;Fl=1;var t=_p(),n=dr();function r(s,a){var i=-1,o=n(s)?Array(s.length):[];return t(s,function(d,g,j){o[++i]=a(d,g,j)}),o}return Us=r,Us}var Bs,Gl;function Cp(){if(Gl)return Bs;Gl=1;function t(n,r){var s=n.length;for(n.sort(r);s--;)n[s]=n[s].value;return n}return Bs=t,Bs}var Fs,$l;function Rp(){if($l)return Fs;$l=1;var t=ir();function n(r,s){if(r!==s){var a=r!==void 0,i=r===null,o=r===r,d=t(r),g=s!==void 0,j=s===null,S=s===s,y=t(s);if(!j&&!y&&!d&&r>s||d&&g&&S&&!j&&!y||i&&g&&S||!a&&S||!o)return 1;if(!i&&!d&&!y&&r<s||y&&a&&o&&!i&&!d||j&&a&&o||!g&&o||!S)return-1}return 0}return Fs=n,Fs}var Gs,Yl;function Np(){if(Yl)return Gs;Yl=1;var t=Rp();function n(r,s,a){for(var i=-1,o=r.criteria,d=s.criteria,g=o.length,j=a.length;++i<g;){var S=t(o[i],d[i]);if(S){if(i>=j)return S;var y=a[i];return S*(y=="desc"?-1:1)}}return r.index-s.index}return Gs=n,Gs}var $s,Kl;function Pp(){if(Kl)return $s;Kl=1;var t=Wc(),n=Ma(),r=yp(),s=Sp(),a=Cp(),i=Yc(),o=Np(),d=vr(),g=qe();function j(S,y,_){y.length?y=t(y,function(p){return g(p)?function(l){return n(l,p.length===1?p[0]:p)}:p}):y=[d];var P=-1;y=t(y,i(r));var x=s(S,function(p,l,c){var u=t(y,function(h){return h(p)});return{criteria:u,index:++P,value:p}});return a(x,function(p,l){return o(p,l,_)})}return $s=j,$s}var Ys,Xl;function Ep(){if(Xl)return Ys;Xl=1;function t(n,r,s){switch(s.length){case 0:return n.call(r);case 1:return n.call(r,s[0]);case 2:return n.call(r,s[0],s[1]);case 3:return n.call(r,s[0],s[1],s[2])}return n.apply(r,s)}return Ys=t,Ys}var Ks,Vl;function Op(){if(Vl)return Ks;Vl=1;var t=Ep(),n=Math.max;function r(s,a,i){return a=n(a===void 0?s.length-1:a,0),function(){for(var o=arguments,d=-1,g=n(o.length-a,0),j=Array(g);++d<g;)j[d]=o[a+d];d=-1;for(var S=Array(a+1);++d<a;)S[d]=o[d];return S[a]=i(j),t(s,this,S)}}return Ks=r,Ks}var Xs,Ql;function Dp(){if(Ql)return Xs;Ql=1;function t(n){return function(){return n}}return Xs=t,Xs}var Vs,Jl;function Mp(){if(Jl)return Vs;Jl=1;var t=tt(),n=(function(){try{var r=t(Object,"defineProperty");return r({},"",{}),r}catch{}})();return Vs=n,Vs}var Qs,Zl;function Ap(){if(Zl)return Qs;Zl=1;var t=Dp(),n=Mp(),r=vr(),s=n?function(a,i){return n(a,"toString",{configurable:!0,enumerable:!1,value:t(i),writable:!0})}:r;return Qs=s,Qs}var Js,ec;function qp(){if(ec)return Js;ec=1;var t=800,n=16,r=Date.now;function s(a){var i=0,o=0;return function(){var d=r(),g=n-(d-o);if(o=d,g>0){if(++i>=t)return arguments[0]}else i=0;return a.apply(void 0,arguments)}}return Js=s,Js}var Zs,tc;function kp(){if(tc)return Zs;tc=1;var t=Ap(),n=qp(),r=n(t);return Zs=r,Zs}var ea,rc;function Tp(){if(rc)return ea;rc=1;var t=vr(),n=Op(),r=kp();function s(a,i){return r(n(a,i,t),a+"")}return ea=s,ea}var ta,nc;function Lp(){if(nc)return ta;nc=1;var t=Jh(),n=Pp(),r=Tp(),s=Ic(),a=r(function(i,o){if(i==null)return[];var d=o.length;return d>1&&s(i,o[0],o[1])?o=[]:d>2&&s(o[0],o[1],o[2])&&(o=[o[0]]),n(i,t(o,1),[])});return ta=a,ta}var zp=Lp();const St=ga(zp),Ip=()=>{const[t,n]=Ne("/worlds/*"),r=n?.["*"],[s,a]=N.useState(!1),i=ye(nt),o=ye(st),d=ye(Se),g=te(V.WorldRevisions),j=te(V.WorldUse),S=te(V.WorldLoad),[y,_]=N.useState(!1),[P,x]=N.useState(null),[p,l]=N.useState(null),c=N.useRef(r);c.current=r;const u=F.useUtils(),h=F.world.use.useMutation(),v=F.world.load.useMutation(),m=Be();N.useEffect(()=>{!r||!d.started||!g||(_(!0),x(null),Promise.all([u.world.revisions.fetch({world:r}),u.world.meta.fetch({world:r})]).then(([R,D])=>{c.current===r&&(x(R?.reverse()??null),l(D??null),_(!1))}))},[r,d.started]);const b=async()=>{if(!r)return;a(!0),await h.mutateAsync({world:r})&&(st.set(r),nt.set(r)),a(!1)},f=async()=>{if(!r)return;if(a(!0),await h.mutateAsync({})){const D=await u.world.next.fetch(),O=await u.world.active.fetch();st.set(O),nt.set(D)}a(!1)},w=async R=>{if(!r)return;a(!0);const D=await v.mutateAsync({world:r,revision:R??void 0});console.info("world loaded",D),a(!1)};return e.jsxs("div",{className:"world-view",children:[e.jsx("div",{className:"world-info",children:r&&e.jsxs(be,{children:[e.jsxs("div",{className:"stats",children:[e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"World name",children:"Name:"})," ",r]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"World map",children:"Map:"})," ",p?.meta.world.environment??"Unknown"]}),e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"If yes, this world will be loaded on the next server start",children:"Is Default:"})," ",o===r?"Yes":"No"]}),i!==o&&e.jsxs("div",{className:"stat",children:[e.jsx("b",{"data-tooltip":"Whether this world is configured to load next start if no other default is specified",children:"Is Fallback World:"})," ",i===r?"Yes":"No"]})]}),e.jsx("div",{className:"section-header","data-tooltip":"A list of all brick, component, or entity owners in this world.",children:"Owners"}),e.jsx("div",{className:"owners-table",children:e.jsx(Hp,{meta:p})}),e.jsx("div",{className:"section-header","data-tooltip":"A list of all the revisions made to this world. Click the buttons on the right to load a specific revision.",children:"Revisions"}),e.jsxs("div",{className:"revision-list",children:[e.jsx(ct,{visible:y,children:e.jsx(me,{active:y,size:"huge",children:"Loading World"})}),P?.length===0&&e.jsx("div",{className:"revision-item",children:e.jsx("i",{className:"revision-note",children:"Something went wrong listing the revisions"})}),P===null&&!y&&d.started&&e.jsx("div",{className:"revision-item",children:e.jsx("i",{className:"revision-note",children:g?"World might not exist":"Missing permission to view revisions"})}),P?.map(R=>e.jsxs("div",{className:"revision-item config",children:[e.jsx("div",{className:"revision-index",children:R.index}),e.jsxs("div",{className:"revision-note",children:[R.note,e.jsx("div",{className:"revision-date",children:new Date(R.date).toLocaleString()})]}),S&&e.jsx(H,{icon:!0,main:!0,disabled:s||!d.started,onClick:()=>m.prompt(e.jsxs("p",{children:["Are you sure you want to load revision ",R.index," ","of"," ",e.jsx("b",{style:{color:"white"},children:r}),"? Unsaved work will be lost."]})).then(D=>{D&&w(R.index)}),"data-tooltip":`Load revision ${R.index}`,children:e.jsx($t,{})})]},R.index))]})]})}),e.jsxs(Ce,{attached:!0,children:[j&&o!==r&&e.jsxs(H,{normal:!0,disabled:s||!r,"data-tooltip":"Make this the default world for the server (on startup)",onClick:()=>b(),children:[e.jsx(pc,{}),"Make Default"]}),j&&o===r&&e.jsxs(H,{warn:!0,disabled:s||!r,"data-tooltip":"Remove this world as the default world for the server (on startup)",onClick:()=>f(),children:[e.jsx(mc,{}),"Clear Default"]}),e.jsx("span",{style:{flex:1}}),S&&e.jsxs(H,{main:!0,"data-tooltip":"Load this world immediately",disabled:s||!d.started||!r,onClick:()=>m.prompt(e.jsxs("p",{children:["Are you sure you want to load"," ",e.jsx("b",{style:{color:"white"},children:r}),"? Unsaved work will be lost."]})).then(R=>{R&&w()}),children:[e.jsx($t,{}),"Load"]})]}),m.children]})},Hp=({meta:t})=>{const[n,r]=Je(),s=N.useMemo(()=>Object.fromEntries(t?.owners.map(S=>[S.id,S])??[]),[t]),a=N.useMemo(()=>{const S=Object.keys(s),y=St(S,u=>s[u].display_name),_=St(S,u=>s[u].brick_count),P=St(S,u=>s[u].component_count),x=St(S,u=>s[u].entity_count),p=St(S,u=>s[u].wire_count),l=Bi(S.length).reverse(),c=Bi(S.length);return{display_name:y,brick_count:_,component_count:P,entity_count:x,wire_count:p,reverse:l,inorder:c}},[t]),[i,o]=N.useState("brick_count"),[d,g]=N.useState(-1),j=S=>{S==i?g(y=>y*-1):(o(S),g(S==="display_name"?1:-1))};return t?e.jsx(be,{children:e.jsxs("table",{className:"br-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{style:{textAlign:"left",width:"100%"},onClick:()=>j("display_name"),children:e.jsxs("span",{children:["Name",e.jsx(we,{name:"display_name",sort:i,direction:d})]})}),e.jsx("th",{onClick:()=>j("brick_count"),children:e.jsxs("span",{children:["Bricks",e.jsx(we,{name:"brick_count",sort:i,direction:d})]})}),e.jsx("th",{onClick:()=>j("component_count"),children:e.jsxs("span",{children:["Components",e.jsx(we,{name:"component_count",sort:i,direction:d})]})}),e.jsx("th",{onClick:()=>j("entity_count"),children:e.jsxs("span",{children:["Entities",e.jsx(we,{name:"entity_count",sort:i,direction:d})]})}),e.jsx("th",{onClick:()=>j("wire_count"),children:e.jsxs("span",{children:["Wires",e.jsx(we,{name:"wire_count",sort:i,direction:d})]})})]})}),e.jsxs("tbody",{children:[t?.owners.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,style:{textAlign:"center"},children:"No owners found in this world"})}),(d>0?a.inorder:a.reverse).map(S=>{const y=a[i][S],_=s[y];return!_||_.brick_count+_.component_count+_.entity_count+_.wire_count===0?null:e.jsxs("tr",{onClick:()=>r(`/players/${y}`),children:[e.jsx("td",{className:"player-name",children:e.jsx("div",{className:"player-name-container",children:e.jsxs("div",{children:[e.jsx("div",{"data-tooltip":_.display_name?"Display Name":"Username",children:_.display_name||_.name}),_.display_name&&e.jsx("div",{className:"username","data-tooltip":"Username",children:_.name})]})})}),e.jsx("td",{style:{textAlign:"right"},children:_.brick_count.toLocaleString()}),e.jsx("td",{style:{textAlign:"right"},children:_.component_count.toLocaleString()}),e.jsx("td",{style:{textAlign:"right"},children:_.entity_count.toLocaleString()}),e.jsx("td",{style:{textAlign:"right"},children:_.wire_count.toLocaleString()})]},y)})]})]})}):null},Wp=["Plate","Space","Studio","Peaks"],Up=()=>{const t=Ze(V.WorldList),[n,r]=N.useState(""),[s,a]=N.useState(!0),[i,o]=N.useState([]),[d,g]=N.useState(!1),j=ye(nt),S=ye(st),[y,_]=N.useState(!1),P=te(V.WorldSave),x=te(V.WorldCreate),p=te(V.WorldUse),l=te(V.WorldActive),c=te(V.WorldNext),u=Lc(),[h,v]=Ne("/worlds/*?"),m=v?.["*"],{onBack:b,swipeHandlers:f,inspectorOpen:w}=At(!!m,"/worlds"),R=F.useUtils(),D=F.world.use.useMutation(),O=F.world.save.useMutation(),k=F.world.create.useMutation(),q=async()=>{a(!0);const[W,ie,de]=await Promise.all([R.world.list.fetch(),l?R.world.active.fetch():null,c?R.world.next.fetch():null]);o(W),st.set(ie),nt.set(de),a(!1)};N.useEffect(()=>{q()},[]);const L=async()=>{if(g(!0),await D.mutateAsync({})&&(st.set(null),c)){const ie=await R.world.next.fetch();nt.set(ie)}g(!1)},z=async()=>{g(!0),await O.mutateAsync({}),g(!1)},I=async W=>{g(!0),await O.mutateAsync({name:W}),g(!1),q()},M=async(W,ie)=>{g(!0),await k.mutateAsync({name:W,level:ie}),g(!1),q()},Y=W=>W.toLowerCase().includes(n.toLowerCase()),[G,X]=N.useState(null),ne=Be({title:"Save World As",content:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"Enter a name for the new world"}),e.jsx("p",{children:e.jsx(ce,{type:"text",placeholder:"World Name",value:G??"",onChange:W=>X(W)})})]}),leftButton:W=>e.jsxs(H,{normal:!0,onClick:()=>W(null),children:[e.jsx(Oe,{}),"Cancel"]}),rightButton:W=>e.jsxs(H,{disabled:!G,main:!0,onClick:()=>W(G),children:[e.jsx(Fe,{}),"Save As"]})}),[se,Q]=N.useState("Plate"),he=Be({title:"Create New World",content:e.jsxs(e.Fragment,{children:[e.jsx("p",{children:"Select a name and map for the new world"}),e.jsx("p",{children:e.jsx(ce,{type:"text",placeholder:"World Name",value:G??"",onChange:W=>X(W)})}),e.jsx("p",{children:e.jsx(da,{value:se,options:Wp,onChange:W=>Q(W)})})]}),leftButton:W=>e.jsxs(H,{normal:!0,onClick:()=>W(null),children:[e.jsx(Oe,{}),"Cancel"]}),rightButton:W=>e.jsxs(H,{disabled:!G,main:!0,onClick:()=>W({name:G,map:se}),children:[e.jsx(Fe,{}),"Create"]})});return t?e.jsxs(e.Fragment,{children:[e.jsx(De,{title:"Worlds",onBack:b,children:(P||x||p)&&e.jsxs("div",{className:"widgets-container worlds",children:[e.jsxs(H,{normal:!0,boxy:!0,"data-tooltip":"Show more world actions",onClick:()=>_(!y),children:[y?e.jsx(dt,{}):e.jsx(ut,{}),"Actions"]}),e.jsxs(Ge,{visible:y,children:[P&&e.jsxs(H,{info:!0,disabled:d||!u.started,"data-tooltip":"Save the currently loaded world",onClick:()=>{_(!1),z()},children:[e.jsx(Tt,{}),"Save World"]}),P&&e.jsxs(H,{normal:!0,disabled:d||!u.started,"data-tooltip":"Save a copy of the currently loaded world",onClick:()=>{_(!1),X(null),ne.prompt().then(W=>{W&&I(W)})},children:[e.jsx(nd,{}),"Save As"]}),x&&e.jsxs(H,{main:!0,disabled:d||!u.started,"data-tooltip":"Create a new world",onClick:()=>{_(!1),X(null),Q("Plate"),he.prompt().then(W=>{W&&M(W.name,W.map)})},children:[e.jsx(sd,{}),"New World"]}),p&&e.jsxs(H,{normal:S===null,warn:S!==null,disabled:d||!S,"data-tooltip":"Remove the default world for the server (on startup)",onClick:()=>{_(!1),L()},children:[e.jsx(mc,{}),"Clear Default"]})]})]})}),e.jsxs(Me,{children:[e.jsx(Ae,{}),e.jsxs("div",{className:`generic-container worlds-container ${w?"inspector-open":""}`,...f,children:[e.jsxs("div",{className:"worlds-list-container",children:[e.jsxs(ge,{children:[e.jsx(ce,{type:"text",placeholder:"Search Worlds...",value:n,onChange:W=>r(W)}),e.jsx("span",{style:{flex:1}}),e.jsx(H,{icon:!0,normal:!0,"data-tooltip":"Refresh world list",onClick:q,children:e.jsx(Lt,{})})]}),e.jsxs("div",{className:"worlds-list",children:[e.jsx(be,{children:i.map(W=>Y(W)&&e.jsxs(at,{href:"/worlds/"+W,className:`world-item ${W===m?"selected":""} ${W===S?"next":""}`,"data-tooltip":W===S?"This world will load when the server starts":"",children:[W===S?e.jsx(pc,{className:"world-item-active"}):!S&&W===j?e.jsx(ad,{className:"world-item-next"}):e.jsx(od,{}),W]},W))}),e.jsx(me,{active:s,size:"huge",children:"Loading Worlds"})]})]}),e.jsxs("div",{className:"world-inspector-container",children:[e.jsx(ge,{attached:!0,children:m??"SELECT A WORLD"}),e.jsx("div",{className:"world-inspector",children:e.jsx(Ip,{})})]})]})]}),ne.children,he.children]}):null},Bp=({children:t})=>e.jsx(F.Provider,{client:Mt,queryClient:Ta,children:e.jsxs(gu,{client:Ta,children:[e.jsx(Ed,{}),t]})}),Fp=()=>e.jsx(Bp,{children:e.jsx(mu,{children:e.jsx(vu,{hook:yu,children:e.jsxs(rr,{children:[e.jsx(ve,{path:"/",component:Rh}),e.jsx(ve,{path:"/account",component:kd}),e.jsx(ve,{path:"/history/:time?",component:Td}),e.jsx(ve,{path:"/players/:id?",component:Eh}),e.jsx(ve,{path:"/plugins/:id?",component:Mh}),e.jsx(ve,{path:"/server",component:zh}),e.jsx(ve,{path:"/roles/:id?",component:Wh}),e.jsx(ve,{path:"/users/:id?",component:Fh}),e.jsx(ve,{path:"/worlds/*?",component:Up}),e.jsx(ve,{component:Od})]})})})});Jc.createRoot(document.getElementById("root")).render(e.jsx(Fp,{}));
7
- //# sourceMappingURL=app-CHjgCOH4.js.map
7
+ //# sourceMappingURL=app-DvPQUQnE.js.map