@sync-in/server 1.10.0 → 1.10.1
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.
- package/CHANGELOG.md +9 -0
- package/README.md +2 -2
- package/package.json +2 -3
- package/server/app.bootstrap.js +3 -22
- package/server/app.bootstrap.js.map +1 -1
- package/server/applications/comments/services/comments-queries.service.js +5 -9
- package/server/applications/comments/services/comments-queries.service.js.map +1 -1
- package/server/applications/users/users.e2e-spec.js +0 -1
- package/server/applications/users/users.e2e-spec.js.map +1 -1
- package/server/applications/webdav/constants/webdav.js +7 -0
- package/server/applications/webdav/constants/webdav.js.map +1 -1
- package/server/applications/webdav/utils/bootstrap.js +45 -0
- package/server/applications/webdav/utils/bootstrap.js.map +1 -0
- package/server/applications/webdav/webdav.controller.js +1 -1
- package/server/applications/webdav/webdav.controller.js.map +1 -1
- package/server/applications/webdav/webdav.e2e-spec.js +131 -2
- package/server/applications/webdav/webdav.e2e-spec.js.map +1 -1
- package/server/authentication/auth.e2e-spec.js +12 -6
- package/server/authentication/auth.e2e-spec.js.map +1 -1
- package/server/authentication/guards/auth-basic.guard.spec.js +23 -0
- package/server/authentication/guards/auth-basic.guard.spec.js.map +1 -1
- package/server/authentication/guards/auth-basic.strategy.js +3 -3
- package/server/authentication/guards/auth-basic.strategy.js.map +1 -1
- package/server/authentication/guards/auth-digest.strategy.js +32 -11
- package/server/authentication/guards/auth-digest.strategy.js.map +1 -1
- package/server/authentication/guards/implementations/http-basic.strategy.js +76 -0
- package/server/authentication/guards/implementations/http-basic.strategy.js.map +1 -0
- package/server/authentication/guards/implementations/http-digest.strategy.js +155 -0
- package/server/authentication/guards/implementations/http-digest.strategy.js.map +1 -0
- package/server/authentication/services/auth-manager.service.js +1 -2
- package/server/authentication/services/auth-manager.service.js.map +1 -1
- package/static/{chunk-XBKCQCBI.js → chunk-2GXOVGTD.js} +1 -1
- package/static/{chunk-QHJT5H4M.js → chunk-3MVPXC3U.js} +1 -1
- package/static/{chunk-I5SPA4G2.js → chunk-3VRUIWQG.js} +1 -1
- package/static/{chunk-L3BIP4AA.js → chunk-3ZBAQTHJ.js} +1 -1
- package/static/{chunk-D55YR5X7.js → chunk-76M3BMK6.js} +11 -11
- package/static/{chunk-GXWGB7WO.js → chunk-76REYAEA.js} +1 -1
- package/static/{chunk-CCZWPM7Q.js → chunk-7HJFIMNF.js} +1 -1
- package/static/{chunk-NIR4YE2E.js → chunk-7KAYOR3A.js} +1 -1
- package/static/{chunk-O3YLAEVE.js → chunk-AALPWGPB.js} +2 -2
- package/static/{chunk-KWFELZTM.js → chunk-CN5YVRFT.js} +1 -1
- package/static/{chunk-B6HQYQYG.js → chunk-CVXLHSO5.js} +1 -1
- package/static/{chunk-R7PLNX75.js → chunk-D2MLAO5N.js} +1 -1
- package/static/{chunk-HGODIZTV.js → chunk-EKWB5W72.js} +1 -1
- package/static/{chunk-PQZLR4P3.js → chunk-FTFEQDWH.js} +1 -1
- package/static/{chunk-3WZ6F3LC.js → chunk-FWQJ4ZCD.js} +1 -1
- package/static/{chunk-FIUF2JM4.js → chunk-IHS5LSJJ.js} +1 -1
- package/static/{chunk-G3PL6YX3.js → chunk-J7474P3L.js} +1 -1
- package/static/{chunk-LGIVVJDD.js → chunk-JAJ7VXMB.js} +1 -1
- package/static/{chunk-T42BV6TR.js → chunk-KEZNIIFH.js} +1 -1
- package/static/{chunk-OUHCDDT6.js → chunk-LWSCODLD.js} +1 -1
- package/static/{chunk-6WMXMIE4.js → chunk-NIKNG2FX.js} +1 -1
- package/static/{chunk-KPOQLDWF.js → chunk-QGHNJVJ6.js} +1 -1
- package/static/{chunk-GWRAGN3M.js → chunk-QJ22N76V.js} +1 -1
- package/static/{chunk-NJJURHX4.js → chunk-QTPIEEZW.js} +1 -1
- package/static/{chunk-ZHOE5VEY.js → chunk-R4VYKZVJ.js} +1 -1
- package/static/{chunk-7VRYTDX4.js → chunk-RBTLSPYJ.js} +1 -1
- package/static/{chunk-GQHXYX6Z.js → chunk-S44QIK3G.js} +1 -1
- package/static/{chunk-45AZ6ZML.js → chunk-S6H2ELRY.js} +1 -1
- package/static/{chunk-E32J777S.js → chunk-SPQH3ATC.js} +1 -1
- package/static/{chunk-DGCVA6BM.js → chunk-TTWMFWEC.js} +1 -1
- package/static/{chunk-ULSPQ3HP.js → chunk-U5E5H2DD.js} +1 -1
- package/static/{chunk-LNLBIJZD.js → chunk-VBTZDHZ3.js} +1 -1
- package/static/{chunk-I3FR3A45.js → chunk-VZFZUI6D.js} +1 -1
- package/static/{chunk-S3TTWPQA.js → chunk-WFMEUST4.js} +1 -1
- package/static/{chunk-27Z3SYRL.js → chunk-WRK2FTKU.js} +1 -1
- package/static/{chunk-4TPFERL6.js → chunk-WZPF4LS2.js} +1 -1
- package/static/{chunk-POUWUMC4.js → chunk-X7NHX5C7.js} +1 -1
- package/static/{chunk-XTVNHFKX.js → chunk-XSURUW7C.js} +1 -1
- package/static/{chunk-5O66CLTD.js → chunk-XX3JPJUM.js} +1 -1
- package/static/{chunk-3RPUQ22U.js → chunk-XZHWESIY.js} +1 -1
- package/static/{chunk-3JYMJQYT.js → chunk-ZHUBWKA2.js} +1 -1
- package/static/{chunk-XEWLBWFF.js → chunk-ZU5MQTFN.js} +1 -1
- package/static/index.html +1 -1
- package/static/{main-YKDNJ7LK.js → main-5O3KLGIR.js} +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as oe}from"./chunk-
|
|
1
|
+
import{e as oe}from"./chunk-RBTLSPYJ.js";import{b as ne}from"./chunk-NIKNG2FX.js";import{s as d,u as se,v as I}from"./chunk-CVXLHSO5.js";import{$a as te,A as R,C as A,D as W,F as v,fb as ie,ka as E,la as u,ma as K,na as f,oa as Q,pa as a,qa as X,ra as Y,sa as Z,ta as ee,tb as re}from"./chunk-AALPWGPB.js";import{d as H}from"./chunk-3MVPXC3U.js";import{Bb as D,Eb as k,Ed as V,G as w,Gb as g,Jd as q,Kd as z,Oa as S,Qa as O,Tb as U,Vb as L,Yc as F,ab as C,ea as P,ja as c,kc as $,lc as B,mc as j,nb as N,oa as x,pa as T,pb as b,qb as G,rb as y,sb as _,tb as l,v as o}from"./chunk-76M3BMK6.js";import{n as J}from"./chunk-DM4NXKEP.js";var m=class{constructor(i){this.isAdmin=!1,this.newly=0,this.applications=[],this.currentAccessHover=!1,this.setGroups(i),this.setManagers(i),Object.assign(this,i),this.isAdmin=i.role===R.ADMINISTRATOR,this.userRoleText=ie(R[i.role]),this.avatarUrl=re(i.login),this.userIsActiveText=this.isActive?"active":"suspended",this.hTimeAgo=J(this.currentAccess).fromNow(!0),this.newly=te(this.currentAccess),this.permissions&&(this.applications=this.permissions.split(A))}setGroups(i){i?.groups&&(i.groups=i.groups.map(p=>new d(p)))}setManagers(i){i?.managers&&(i.managers=i.managers.map(p=>new d(p)))}};var h=class{constructor(i){Object.assign(this,i),this.permissions&&(this.applications=this.permissions.split(A))}};var Te=(()=>{let i=class i{constructor(){this.http=c(F),this.router=c(H),this.authService=c(ne)}listUsers(e=!1){return this.http.get(e?Q:K).pipe(o(t=>t.map(r=>new m(r))))}getUser(e,t=!1){return this.http.get(`${t?f:u}/${e}`).pipe(o(r=>t?new I(r):new m(r)))}createUser(e,t,r=!1){return this.http.post(r?f:u,e,{headers:t}).pipe(o(n=>r?new I(n):new m(n)))}updateUser(e,t,r,n=!1){return this.http.put(`${n?f:u}/${e}`,t,{headers:r}).pipe(o(M=>n?new I(M):new m(M)))}deleteUser(e,t,r){return this.http.request("delete",`${t.isGuest?f:u}/${e}`,{headers:r,body:t})}browseGroup(e,t=!1){return this.http.get(`${t?Y:X}${e?`/${e}`:""}`).pipe(o(r=>new se(r)))}getGroup(e){return this.http.get(`${a}/${e}`).pipe(o(t=>new h(t)))}createGroup(e){return this.http.post(a,e).pipe(o(t=>new h(t)))}updateGroup(e,t){return this.http.put(`${a}/${e}`,t).pipe(o(r=>new h(r)))}deleteGroup(e){return this.http.delete(`${a}/${e}`)}addUsersToGroup(e,t){return this.http.patch(`${a}/${e}/${E.USERS}`,t)}updateUserFromGroup(e,t,r){return this.http.patch(`${a}/${e}/${E.USERS}/${t}`,r)}removeUserFromGroup(e,t){return this.http.delete(`${a}/${e}/${E.USERS}/${t}`)}searchMembers(e,t=!1){return this.http.request("search",Z,{body:e}).pipe(o(r=>r.map(n=>(t&&delete n.description,new d(n)))),w(()=>[]))}impersonateUser(e,t){return this.http.post(`${ee}/${e}`,null,{headers:t})}initImpersonateUser(e){this.authService.initUserFromResponse(e,!0),this.router.navigate([v.BASE,v.ACCOUNT]).catch(console.error)}};i.\u0275fac=function(t){return new(t||i)},i.\u0275prov=P({token:i,factory:i.\u0275fac,providedIn:"root"});let s=i;return s})();function ae(s,i){if(s&1){let p=D();_(0,"div",3)(1,"label",4)(2,"input",5),k("change",function(t){let r=x(p).$implicit,n=g();return T(n.updatePermissions(r,t))}),l(),U(3),$(4,"translate"),$(5,"capitalize"),l()()}if(s&2){let p=i.$implicit,e=g();S(2),y("checked",e.permissions.indexOf(p)>-1)("value",p),S(),L(" ",B(5,6,j(4,3,p,e.locale.language))," ")}}var Le=(()=>{let i=class i{constructor(){this.permissions=[],this.permissionsChange=new O,this.locale=c(V),this.allApplications=Object.values(W)}updatePermissions(e,t){t.target.checked?this.permissions.push(e):this.permissions.splice(this.permissions.indexOf(e),1),this.permissionsChange.emit(this.permissions)}};i.\u0275fac=function(t){return new(t||i)},i.\u0275cmp=C({type:i,selectors:[["app-admin-permissions"]],inputs:{permissions:"permissions"},outputs:{permissionsChange:"permissionsChange"},decls:6,vars:0,consts:[[1,"d-flex","flex-column","col-12","pb-3"],["for","permissions","l10nTranslate",""],["id","permissions",1,"form-check","form-switch","form-check-inline"],[1,"d-flex"],[1,"form-check-label"],["type","checkbox",1,"form-check-input",3,"change","checked","value"]],template:function(t,r){t&1&&(_(0,"div",0)(1,"label",1),U(2,"Permissions"),l(),_(3,"div",2),b(4,ae,6,8,"div",3,N),l()()),t&2&&(S(4),G(r.allApplications))},dependencies:[z,oe,q],encapsulation:2});let s=i;return s})();export{m as a,Te as b,Le as c};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$a as at,B as Qt,Ba as mi,Cb as z,I as oi,Ma as _i,Mb as Ai,Na as gi,Nb as ct,Pb as bi,Qb as Ti,Ua as yi,W as ci,X as jt,_ as ot,aa as hi,ab as Ei,ba as ui,ca as xt,da as li,ea as pi,fa as Jt,ga as q,ha as fi,ia as di,ja as X,qb as Si,tb as M,ub as wi,vb as Pt}from"./chunk-O3YLAEVE.js";import{Aa as Re,Af as ii,Bb as st,Bd as Je,Cd as Xe,Dd as Rt,Eb as B,Ed as Ot,G as Ae,Gb as D,Gf as ri,Jd as ze,Kb as Pe,Kd as kt,L as be,Lb as Fe,Mb as Ie,Oa as m,Pb as Kt,Qa as Oe,Qb as Le,Rb as bt,Tb as b,Vb as Ue,Vc as $e,W as Te,Xb as Be,Yb as De,Yc as Tt,Yf as si,Zb as Me,ab as At,bb as ke,c as we,cb as xe,ea as wt,fa as ve,fd as vt,ha as Ce,hd as nt,he as Ze,ie as ti,ja as p,jb as Ne,jd as Ct,kc as Ve,kd as qe,lb as k,mb as x,mc as We,oa as W,od as Ge,og as ni,pa as $,pd as He,qg as Nt,rb as C,sb as f,sd as Ye,tb as _,td as Ke,ub as J,v as S,yd as Qe,yf as ei,zd as je}from"./chunk-D55YR5X7.js";import{n as ai}from"./chunk-DM4NXKEP.js";import{a as O,b as ge,d as ye,e as Ee,i as Se}from"./chunk-KAVP6UXH.js";var V=(function(r){return r.USER="user",r.GUEST="guest",r.LINK="link",r.GROUP="group",r.PGROUP="personal group",r})(V||{});function vi(r,t=[]){let e=O({},Object.fromEntries(Object.entries(Ti).filter(([i,s])=>t.indexOf(i)===-1)));if(!r)return e;for(let i of r.split(":"))i in e&&(e[i]=!0);return e}function ts(r,t,e=[]){let i={};if(!r)return i;for(let s of r.split(":"))e.indexOf(s)===-1&&(i[s]=t.indexOf(s)>-1);return i}function es(r,t=[]){let e={};if(!r)return e;for(let i of r.split(":"))t.indexOf(i)===-1&&(e[i]=bi[i]);return e}function is(r){return Object.entries(r).filter(([t,e])=>e).map(([t,e])=>t).join(":")}var T=class{constructor(t,e=[]){this.newly=0,this.linkSettings=null,Object.assign(this,t),this.mid=`${t.type[0]}${t.id}`,this.hPerms=vi(t.permissions,e),t.login&&(this.avatarUrl=M(t.login)),this.isLink=!!this.linkId,this.isGuest=this.type===V.GUEST,this.isUser=this.isGuest||this.type===V.USER&&!this.isLink,this.isGroup=this.type===V.GROUP||this.type===V.PGROUP,this.isPersonalGroup=this.type===V.PGROUP,this.setGroupRole(),this.modifiedAt?this.newly=at(this.modifiedAt):this.createdAt&&(this.newly=at(this.createdAt))}setGroupRole(t){typeof t<"u"&&(this.groupRole=t),this.isGroupManager=this.groupRole===Qt.MANAGER}};function ls(r,t,e){return new T({id:r.id,login:r.login,name:r.fullName,description:r.email,type:V.USER,spaceRole:t||mi.IS_MEMBER,groupRole:e||Qt.MEMBER,permissions:""})}var Ci={NAME_SPACE:"/",EVENTS:{NOTIFICATION:"notification"}};var ht={NAME_SPACE:"/",EVENTS:{ONLINE_STATUS:"onlineStatus",ONLINE_USERS:"onlineUsers",ONLINE_USER:"onlineUser"}};var l=(function(r){return r.BASE="/api/auth",r.LOGIN="login",r.LOGOUT="logout",r.REFRESH="refresh",r.TOKEN="token",r.TOKEN_REFRESH="token/refresh",r.WS="socket.io",r.TWO_FA_BASE="2fa",r.TWO_FA_ENABLE="enable",r.TWO_FA_DISABLE="disable",r.TWO_FA_LOGIN_VERIFY="login/verify",r.TWO_FA_ADMIN_RESET_USER="reset/user",r})(l||{}),ms=`${l.BASE}/${l.LOGIN}`,_s=`${l.BASE}/${l.LOGOUT}`,Ri=`${l.BASE}/${l.REFRESH}`,gs=`${l.BASE}/${l.TOKEN}`,ys=`${l.BASE}/${l.TOKEN_REFRESH}`,Oi=`/${l.WS}`,Xt=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ENABLE}`,ki=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_DISABLE}`,xi=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_LOGIN_VERIFY}`,Ni=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ADMIN_RESET_USER}`;var fe={};Ee(fe,{Fetch:()=>mt,Manager:()=>K,NodeWebSocket:()=>L,NodeXHR:()=>I,Socket:()=>H,WebSocket:()=>L,WebTransport:()=>G,XHR:()=>I,connect:()=>Q,default:()=>Q,io:()=>Q,protocol:()=>le});var v=Object.create(null);v.open="0";v.close="1";v.ping="2";v.pong="3";v.message="4";v.upgrade="5";v.noop="6";var ut=Object.create(null);Object.keys(v).forEach(r=>{ut[v[r]]=r});var lt={type:"error",data:"parser error"};var Ii=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Li=typeof ArrayBuffer=="function",Ui=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,pt=({type:r,data:t},e,i)=>Ii&&t instanceof Blob?e?i(t):Pi(t,i):Li&&(t instanceof ArrayBuffer||Ui(t))?e?i(t):Pi(new Blob([t]),i):i(v[r]+(t||"")),Pi=(r,t)=>{let e=new FileReader;return e.onload=function(){let i=e.result.split(",")[1];t("b"+(i||""))},e.readAsDataURL(r)};function Fi(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var zt;function Bi(r,t){if(Ii&&r.data instanceof Blob)return r.data.arrayBuffer().then(Fi).then(t);if(Li&&(r.data instanceof ArrayBuffer||Ui(r.data)))return t(Fi(r.data));pt(r,!1,e=>{zt||(zt=new TextEncoder),t(zt.encode(e))})}var Di="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ft=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<Di.length;r++)ft[Di.charCodeAt(r)]=r;var Mi=r=>{let t=r.length*.75,e=r.length,i,s=0,n,o,a,h;r[r.length-1]==="="&&(t--,r[r.length-2]==="="&&t--);let R=new ArrayBuffer(t),A=new Uint8Array(R);for(i=0;i<e;i+=4)n=ft[r.charCodeAt(i)],o=ft[r.charCodeAt(i+1)],a=ft[r.charCodeAt(i+2)],h=ft[r.charCodeAt(i+3)],A[s++]=n<<2|o>>4,A[s++]=(o&15)<<4|a>>2,A[s++]=(a&3)<<6|h&63;return R};var mr=typeof ArrayBuffer=="function",dt=(r,t)=>{if(typeof r!="string")return{type:"message",data:Vi(r,t)};let e=r.charAt(0);return e==="b"?{type:"message",data:_r(r.substring(1),t)}:ut[e]?r.length>1?{type:ut[e],data:r.substring(1)}:{type:ut[e]}:lt},_r=(r,t)=>{if(mr){let e=Mi(r);return Vi(e,t)}else return{base64:!0,data:r}},Vi=(r,t)=>{switch(t){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var Wi="",$i=(r,t)=>{let e=r.length,i=new Array(e),s=0;r.forEach((n,o)=>{pt(n,!1,a=>{i[o]=a,++s===e&&t(i.join(Wi))})})},qi=(r,t)=>{let e=r.split(Wi),i=[];for(let s=0;s<e.length;s++){let n=dt(e[s],t);if(i.push(n),n.type==="error")break}return i};function Gi(){return new TransformStream({transform(r,t){Bi(r,e=>{let i=e.length,s;if(i<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,i);else if(i<65536){s=new Uint8Array(3);let n=new DataView(s.buffer);n.setUint8(0,126),n.setUint16(1,i)}else{s=new Uint8Array(9);let n=new DataView(s.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(i))}r.data&&typeof r.data!="string"&&(s[0]|=128),t.enqueue(s),t.enqueue(e)})}})}var Zt;function It(r){return r.reduce((t,e)=>t+e.length,0)}function Lt(r,t){if(r[0].length===t)return r.shift();let e=new Uint8Array(t),i=0;for(let s=0;s<t;s++)e[s]=r[0][i++],i===r[0].length&&(r.shift(),i=0);return r.length&&i<r[0].length&&(r[0]=r[0].slice(i)),e}function Hi(r,t){Zt||(Zt=new TextDecoder);let e=[],i=0,s=-1,n=!1;return new TransformStream({transform(o,a){for(e.push(o);;){if(i===0){if(It(e)<1)break;let h=Lt(e,1);n=(h[0]&128)===128,s=h[0]&127,s<126?i=3:s===126?i=1:i=2}else if(i===1){if(It(e)<2)break;let h=Lt(e,2);s=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),i=3}else if(i===2){if(It(e)<8)break;let h=Lt(e,8),R=new DataView(h.buffer,h.byteOffset,h.length),A=R.getUint32(0);if(A>Math.pow(2,21)-1){a.enqueue(lt);break}s=A*Math.pow(2,32)+R.getUint32(4),i=3}else{if(It(e)<s)break;let h=Lt(e,s);a.enqueue(dt(n?h:Zt.decode(h),t)),i=0}if(s===0||s>r){a.enqueue(lt);break}}}})}var te=4;function u(r){if(r)return gr(r)}function gr(r){for(var t in u.prototype)r[t]=u.prototype[t];return r}u.prototype.on=u.prototype.addEventListener=function(r,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(t),this};u.prototype.once=function(r,t){function e(){this.off(r,e),t.apply(this,arguments)}return e.fn=t,this.on(r,e),this};u.prototype.off=u.prototype.removeListener=u.prototype.removeAllListeners=u.prototype.removeEventListener=function(r,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var e=this._callbacks["$"+r];if(!e)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var i,s=0;s<e.length;s++)if(i=e[s],i===t||i.fn===t){e.splice(s,1);break}return e.length===0&&delete this._callbacks["$"+r],this};u.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),e=this._callbacks["$"+r],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(e){e=e.slice(0);for(var i=0,s=e.length;i<s;++i)e[i].apply(this,t)}return this};u.prototype.emitReserved=u.prototype.emit;u.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};u.prototype.hasListeners=function(r){return!!this.listeners(r).length};var N=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,e)=>e(t,0),g=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Yi="arraybuffer";function Ut(r,...t){return t.reduce((e,i)=>(r.hasOwnProperty(i)&&(e[i]=r[i]),e),{})}var yr=g.setTimeout,Er=g.clearTimeout;function P(r,t){t.useNativeTimers?(r.setTimeoutFn=yr.bind(g),r.clearTimeoutFn=Er.bind(g)):(r.setTimeoutFn=g.setTimeout.bind(g),r.clearTimeoutFn=g.clearTimeout.bind(g))}var Sr=1.33;function Ki(r){return typeof r=="string"?wr(r):Math.ceil((r.byteLength||r.size)*Sr)}function wr(r){let t=0,e=0;for(let i=0,s=r.length;i<s;i++)t=r.charCodeAt(i),t<128?e+=1:t<2048?e+=2:t<55296||t>=57344?e+=3:(i++,e+=4);return e}function Bt(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Qi(r){let t="";for(let e in r)r.hasOwnProperty(e)&&(t.length&&(t+="&"),t+=encodeURIComponent(e)+"="+encodeURIComponent(r[e]));return t}function ji(r){let t={},e=r.split("&");for(let i=0,s=e.length;i<s;i++){let n=e[i].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t}var Dt=class extends Error{constructor(t,e,i){super(t),this.description=e,this.context=i,this.type="TransportError"}},F=class extends u{constructor(t){super(),this.writable=!1,P(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,e,i){return super.emitReserved("error",new Dt(t,e,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){let e=dt(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){let t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){let e=Qi(t);return e.length?"?"+e:""}};var Z=class extends F{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let e=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||e()})),this.writable||(i++,this.once("drain",function(){--i||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){let e=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};qi(t,this.socket.binaryType).forEach(e),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,$i(t,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.opts.secure?"https":"http",e=this.query||{};return this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Bt()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.createUri(t,e)}};var Ji=!1;try{Ji=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Xi=Ji;function Ar(){}var ee=class extends Z{constructor(t){if(super(t),typeof location<"u"){let e=location.protocol==="https:",i=location.port;i||(i=e?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,e){let i=this.request({method:"POST",data:t});i.on("success",e),i.on("error",(s,n)=>{this.onError("xhr post error",s,n)})}doPoll(){let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(e,i)=>{this.onError("xhr poll error",e,i)}),this.pollXhr=t}},Mt=(()=>{class r extends u{constructor(e,i,s){super(),this.createRequest=e,P(this,s),this._opts=s,this._method=s.method||"GET",this._uri=i,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;let i=Ut(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;let s=this._xhr=this.createRequest(i);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&s.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var n;s.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Ar,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return r.requestsCount=0,r.requests={},r})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",zi);else if(typeof addEventListener=="function"){let r="onpagehide"in g?"pagehide":"unload";addEventListener(r,zi,!1)}}function zi(){for(let r in Mt.requests)Mt.requests.hasOwnProperty(r)&&Mt.requests[r].abort()}var br=(function(){let r=Zi({xdomain:!1});return r&&r.responseType!==null})(),I=class extends ee{constructor(t){super(t);let e=t&&t.forceBase64;this.supportsBinary=br&&!e}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Mt(Zi,this.uri(),t)}};function Zi(r){let t=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Xi))return new XMLHttpRequest}catch{}if(!t)try{return new g[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var tr=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",re=class extends F{get name(){return"websocket"}doOpen(){let t=this.uri(),e=this.opts.protocols,i=tr?{}:Ut(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,e,i)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let i=t[e],s=e===t.length-1;pt(i,this.supportsBinary,n=>{try{this.doWrite(i,n)}catch{}s&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let t=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=Bt()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}},ie=g.WebSocket||g.MozWebSocket,L=class extends re{createSocket(t,e,i){return tr?new ie(t,e,i):e?new ie(t,e):new ie(t)}doWrite(t,e){this.ws.send(e)}};var G=class extends F{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{let e=Hi(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(e).getReader(),s=Gi();s.readable.pipeTo(t.writable),this._writer=s.writable.getWriter();let n=()=>{i.read().then(({done:a,value:h})=>{a||(this.onPacket(h),n())}).catch(a=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let i=t[e],s=e===t.length-1;this._writer.write(i).then(()=>{s&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}};var se={websocket:L,webtransport:G,polling:I};var Tr=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function tt(r){if(r.length>8e3)throw"URI too long";let t=r,e=r.indexOf("["),i=r.indexOf("]");e!=-1&&i!=-1&&(r=r.substring(0,e)+r.substring(e,i).replace(/:/g,";")+r.substring(i,r.length));let s=Tr.exec(r||""),n={},o=14;for(;o--;)n[vr[o]]=s[o]||"";return e!=-1&&i!=-1&&(n.source=t,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=Cr(n,n.path),n.queryKey=Rr(n,n.query),n}function Cr(r,t){let e=/\/{2,9}/g,i=t.replace(e,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function Rr(r,t){let e={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,s,n){s&&(e[s]=n)}),e}var ne=typeof addEventListener=="function"&&typeof removeEventListener=="function",Vt=[];ne&&addEventListener("offline",()=>{Vt.forEach(r=>r())},!1);var Wt=(()=>{class r extends u{constructor(e,i){if(super(),this.binaryType=Yi,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(i=e,e=null),e){let s=tt(e);i.hostname=s.host,i.secure=s.protocol==="https"||s.protocol==="wss",i.port=s.port,s.query&&(i.query=s.query)}else i.host&&(i.hostname=tt(i.host).host);P(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(s=>{let n=s.prototype.name;this.transports.push(n),this._transportsByName[n]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ji(this.opts.query)),ne&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Vt.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let i=Object.assign({},this.opts.query);i.EIO=te,i.transport=e,this.id&&(i.sid=this.id);let s=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let i=this.createTransport(e);i.open(),this.setTransport(i)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let i=new Error("server error");i.code=e.data,this._onError(i);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let s=0;s<this.writeBuffer.length;s++){let n=this.writeBuffer[s].data;if(n&&(i+=Ki(n)),s>0&&i>this._maxPayload)return this.writeBuffer.slice(0,s);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,N(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,i,s){return this._sendPacket("message",e,i,s),this}send(e,i,s){return this._sendPacket("message",e,i,s),this}_sendPacket(e,i,s,n){if(typeof i=="function"&&(n=i,i=void 0),typeof s=="function"&&(n=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;let o={type:e,data:i,options:s};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),e()},s=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),ne&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let s=Vt.indexOf(this._offlineEventListener);s!==-1&&Vt.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,i),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=te,r})(),$t=class extends Wt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let e=this.createTransport(t),i=!1;Wt.priorWebsocketSuccess=!1;let s=()=>{i||(e.send([{type:"ping",data:"probe"}]),e.once("packet",U=>{if(!i)if(U.type==="pong"&&U.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;Wt.priorWebsocketSuccess=e.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(A(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{let rt=new Error("probe error");rt.transport=e.name,this.emitReserved("upgradeError",rt)}}))};function n(){i||(i=!0,A(),e.close(),e=null)}let o=U=>{let rt=new Error("probe error: "+U);rt.transport=e.name,n(),this.emitReserved("upgradeError",rt)};function a(){o("transport closed")}function h(){o("socket closed")}function R(U){e&&U.name!==e.name&&n()}let A=()=>{e.removeListener("open",s),e.removeListener("error",o),e.removeListener("close",a),this.off("close",h),this.off("upgrading",R)};e.once("open",s),e.once("error",o),e.once("close",a),this.once("close",h),this.once("upgrading",R),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||e.open()},200):e.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let e=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&e.push(t[i]);return e}},et=class extends $t{constructor(t,e={}){let i=typeof t=="object"?t:e;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(s=>se[s]).filter(s=>!!s)),super(t,i)}};var mt=class extends Z{doPoll(){this._fetch().then(t=>{if(!t.ok)return this.onError("fetch read error",t.status,t);t.text().then(e=>this.onData(e))}).catch(t=>{this.onError("fetch read error",t)})}doWrite(t,e){this._fetch(t).then(i=>{if(!i.ok)return this.onError("fetch write error",i.status,i);e()}).catch(i=>{this.onError("fetch write error",i)})}_fetch(t){var e;let i=t!==void 0,s=new Headers(this.opts.extraHeaders);return i&&s.set("content-type","text/plain;charset=UTF-8"),(e=this.socket._cookieJar)===null||e===void 0||e.appendCookies(s),fetch(this.uri(),{method:i?"POST":"GET",body:i?t:null,headers:s,credentials:this.opts.withCredentials?"include":"omit"}).then(n=>{var o;return(o=this.socket._cookieJar)===null||o===void 0||o.parseCookies(n.headers.getSetCookie()),n})}};var vn=et.protocol;function er(r,t="",e){let i=r;e=e||typeof location<"u"&&location,r==null&&(r=e.protocol+"//"+e.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=e.protocol+r:r=e.host+r),/^(https?|wss?):\/\//.test(r)||(typeof e<"u"?r=e.protocol+"//"+r:r="https://"+r),i=tt(r)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let n=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+t,i.href=i.protocol+"://"+n+(e&&e.port===i.port?"":":"+i.port),i}var pe={};Ee(pe,{Decoder:()=>he,Encoder:()=>ce,PacketType:()=>c,isPacketValid:()=>Ur,protocol:()=>le});var Or=typeof ArrayBuffer=="function",kr=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,ir=Object.prototype.toString,xr=typeof Blob=="function"||typeof Blob<"u"&&ir.call(Blob)==="[object BlobConstructor]",Nr=typeof File=="function"||typeof File<"u"&&ir.call(File)==="[object FileConstructor]";function gt(r){return Or&&(r instanceof ArrayBuffer||kr(r))||xr&&r instanceof Blob||Nr&&r instanceof File}function _t(r,t){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let e=0,i=r.length;e<i;e++)if(_t(r[e]))return!0;return!1}if(gt(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return _t(r.toJSON(),!0);for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e)&&_t(r[e]))return!0;return!1}function rr(r){let t=[],e=r.data,i=r;return i.data=oe(e,t),i.attachments=t.length,{packet:i,buffers:t}}function oe(r,t){if(!r)return r;if(gt(r)){let e={_placeholder:!0,num:t.length};return t.push(r),e}else if(Array.isArray(r)){let e=new Array(r.length);for(let i=0;i<r.length;i++)e[i]=oe(r[i],t);return e}else if(typeof r=="object"&&!(r instanceof Date)){let e={};for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=oe(r[i],t));return e}return r}function sr(r,t){return r.data=ae(r.data,t),delete r.attachments,r}function ae(r,t){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<t.length)return t[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=ae(r[e],t);else if(typeof r=="object")for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=ae(r[e],t));return r}var nr=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],le=5,c=(function(r){return r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK",r})(c||{}),ce=class{constructor(t){this.replacer=t}encode(t){return(t.type===c.EVENT||t.type===c.ACK)&&_t(t)?this.encodeAsBinary({type:t.type===c.EVENT?c.BINARY_EVENT:c.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let e=""+t.type;return(t.type===c.BINARY_EVENT||t.type===c.BINARY_ACK)&&(e+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(e+=t.nsp+","),t.id!=null&&(e+=t.id),t.data!=null&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){let e=rr(t),i=this.encodeAsString(e.packet),s=e.buffers;return s.unshift(i),s}},he=class r extends u{constructor(t){super(),this.reviver=t}add(t){let e;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);let i=e.type===c.BINARY_EVENT;i||e.type===c.BINARY_ACK?(e.type=i?c.EVENT:c.ACK,this.reconstructor=new ue(e),e.attachments===0&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else if(gt(t)||t.base64)if(this.reconstructor)e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let e=0,i={type:Number(t.charAt(0))};if(c[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===c.BINARY_EVENT||i.type===c.BINARY_ACK){let n=e+1;for(;t.charAt(++e)!=="-"&&e!=t.length;);let o=t.substring(n,e);if(o!=Number(o)||t.charAt(e)!=="-")throw new Error("Illegal attachments");i.attachments=Number(o)}if(t.charAt(e+1)==="/"){let n=e+1;for(;++e&&!(t.charAt(e)===","||e===t.length););i.nsp=t.substring(n,e)}else i.nsp="/";let s=t.charAt(e+1);if(s!==""&&Number(s)==s){let n=e+1;for(;++e;){let o=t.charAt(e);if(o==null||Number(o)!=o){--e;break}if(e===t.length)break}i.id=Number(t.substring(n,e+1))}if(t.charAt(++e)){let n=this.tryParse(t.substr(e));if(r.isPayloadValid(i.type,n))i.data=n;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,e){switch(t){case c.CONNECT:return qt(e);case c.DISCONNECT:return e===void 0;case c.CONNECT_ERROR:return typeof e=="string"||qt(e);case c.EVENT:case c.BINARY_EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&nr.indexOf(e[0])===-1);case c.ACK:case c.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},ue=class{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){let e=sr(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function Pr(r){return typeof r=="string"}var Fr=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function Ir(r){return r===void 0||Fr(r)}function qt(r){return Object.prototype.toString.call(r)==="[object Object]"}function Lr(r,t){switch(r){case c.CONNECT:return t===void 0||qt(t);case c.DISCONNECT:return t===void 0;case c.EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&nr.indexOf(t[0])===-1);case c.ACK:return Array.isArray(t);case c.CONNECT_ERROR:return typeof t=="string"||qt(t);default:return!1}}function Ur(r){return Pr(r.nsp)&&Ir(r.id)&&Lr(r.type,r.data)}function w(r,t,e){return r.on(t,e),function(){r.off(t,e)}}var Br=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),H=class extends u{constructor(t,e,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[w(t,"open",this.onopen.bind(this)),w(t,"packet",this.onpacket.bind(this)),w(t,"error",this.onerror.bind(this)),w(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){var i,s,n;if(Br.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;let o={type:c.EVENT,data:e};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof e[e.length-1]=="function"){let A=this.ids++,U=e.pop();this._registerAckCallback(A,U),o.id=A}let a=(s=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||s===void 0?void 0:s.writable,h=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!a||(h?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,e){var i;let s=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(s===void 0){this.acks[t]=e;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);e.call(this,new Error("operation has timed out"))},s),o=(...a)=>{this.io.clearTimeoutFn(n),e.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...e){return new Promise((i,s)=>{let n=(o,a)=>o?s(o):i(a);n.withError=!0,e.push(n),this.emit(t,...e)})}_addToQueue(t){let e;typeof t[t.length-1]=="function"&&(e=t.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((s,...n)=>(this._queue[0],s!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(s)):(this._queue.shift(),e&&e(null,...n)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;let e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:c.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){let i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case c.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case c.EVENT:case c.BINARY_EVENT:this.onevent(t);break;case c.ACK:case c.BINARY_ACK:this.onack(t);break;case c.DISCONNECT:this.ondisconnect();break;case c.CONNECT_ERROR:this.destroy();let i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){let e=t.data||[];t.id!=null&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){let e=this._anyListeners.slice();for(let i of e)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){let e=this,i=!1;return function(...s){i||(i=!0,e.packet({type:c.ACK,id:t,data:s}))}}onack(t){let e=this.acks[t.id];typeof e=="function"&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:c.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){let e=this._anyListeners;for(let i=0;i<e.length;i++)if(t===e[i])return e.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){let e=this._anyOutgoingListeners;for(let i=0;i<e.length;i++)if(t===e[i])return e.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let e=this._anyOutgoingListeners.slice();for(let i of e)i.apply(this,t.data)}}};function Y(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Y.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),e=Math.floor(t*this.jitter*r);r=(Math.floor(t*10)&1)==0?r-e:r+e}return Math.min(r,this.max)|0};Y.prototype.reset=function(){this.attempts=0};Y.prototype.setMin=function(r){this.ms=r};Y.prototype.setMax=function(r){this.max=r};Y.prototype.setJitter=function(r){this.jitter=r};var K=class extends u{constructor(t,e){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.opts=e,P(this,e),this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor((i=e.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Y({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this._readyState="closed",this.uri=t;let s=e.parser||pe;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=e.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(e=this.backoff)===null||e===void 0||e.setMin(t),this)}randomizationFactor(t){var e;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(e=this.backoff)===null||e===void 0||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(e=this.backoff)===null||e===void 0||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new et(this.uri,this.opts);let e=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let s=w(e,"open",function(){i.onopen(),t&&t()}),n=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=w(e,"error",n);if(this._timeout!==!1){let a=this._timeout,h=this.setTimeoutFn(()=>{s(),n(new Error("timeout")),e.close()},a);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(s),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(w(t,"ping",this.onping.bind(this)),w(t,"data",this.ondata.bind(this)),w(t,"error",this.onerror.bind(this)),w(t,"close",this.onclose.bind(this)),w(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(e){this.onclose("parse error",e)}}ondecoded(t){N(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new H(this,t,e),this.nsps[t]=i),i}_destroy(t){let e=Object.keys(this.nsps);for(let i of e)if(this.nsps[i].active)return;this._close()}_packet(t){let e=this.encoder.encode(t);for(let i=0;i<e.length;i++)this.engine.write(e[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,e){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let e=this.backoff.duration();this._reconnecting=!0;let i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(s=>{s?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",s)):t.onreconnect()}))},e);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}};var yt={};function Q(r,t){typeof r=="object"&&(t=r,r=void 0),t=t||{};let e=er(r,t.path||"/socket.io"),i=e.source,s=e.id,n=e.path,o=yt[s]&&n in yt[s].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o,h;return a?h=new K(i,t):(yt[s]||(yt[s]=new K(i,t)),h=yt[s]),e.query&&!t.query&&(t.query=e.queryKey),h.socket(e.path,t)}Object.assign(Q,{Manager:K,Socket:H,io:Q,connect:Q});var it=class r{config;appRef;subscribersCounter={};eventObservables$={};namespaces={};ioSocket;emptyConfig={url:"",options:{}};constructor(t,e){this.config=t,this.appRef=e,t===void 0&&(t=this.emptyConfig);let i=t.url,s=t.options,n=Q?Q:fe;this.ioSocket=n(i,s)}get auth(){return this.ioSocket.auth}set auth(t){this.ioSocket.auth=t}get io(){return this.ioSocket.io}get open(){return this.connect}get close(){return this.disconnect}of(t){if(!t||t==="/")return this;let e=this.namespaces[t];if(e)return e;let a=this.config,{url:i}=a,s=ye(a,["url"]),n=O({url:!i.endsWith("/")&&!t.startsWith("/")?`${i}/${t}`:`${i}${t}`},s),o=new r(n,this.appRef);return this.namespaces[t]=o,o}on(t,e){return this.ioSocket.on(t,e),this}once(t,e){return this.ioSocket.once(t,e),this}connect(){return this.ioSocket.connect(),this}disconnect(){return this.ioSocket.disconnect(),this}emit(t,...e){return this.ioSocket.emit(t,...e),this}send(...t){return this.ioSocket.send.apply(this.ioSocket,arguments),this}emitWithAck(t,...e){return this.ioSocket.emitWithAck(t,...e)}removeListener(t,e){return this.ioSocket.removeListener(t,e),this}removeAllListeners(t){return this.ioSocket.removeAllListeners(t),this}fromEvent(t){return this.subscribersCounter[t]||(this.subscribersCounter[t]=0),this.subscribersCounter[t]++,this.eventObservables$[t]||(this.eventObservables$[t]=new we(e=>{let i=s=>{e.next(s),this.appRef.tick()};return this.ioSocket.on(t,i),()=>{this.subscribersCounter[t]--,this.subscribersCounter[t]===0&&(this.ioSocket.removeListener(t,i),delete this.eventObservables$[t])}}).pipe(Te())),this.eventObservables$[t]}fromOneTimeEvent(t){return new Promise(e=>this.once(t,e))}listeners(t){return this.ioSocket.listeners(t)}hasListeners(t){return this.ioSocket.hasListeners(t)}listenersAny(){return this.ioSocket.listenersAny()}listenersAnyOutgoing(){return this.ioSocket.listenersAnyOutgoing()}off(t,e){return this.ioSocket.off(t,e),this}offAny(t){return this.ioSocket.offAny(t),this}offAnyOutgoing(t){return this.ioSocket.offAnyOutgoing(t),this}onAny(t){return this.ioSocket.onAny(t),this}onAnyOutgoing(t){return this.ioSocket.onAnyOutgoing(t),this}prependAny(t){return this.ioSocket.prependAny(t),this}prependAnyOutgoing(t){return this.ioSocket.prependAnyOutgoing(t),this}timeout(t){return this.ioSocket.timeout(t),this}get volatile(){let t=this.ioSocket.volatile;return this}get active(){return this.ioSocket.active}get connected(){return this.ioSocket.connected}get disconnected(){return this.ioSocket.disconnected}get recovered(){return this.ioSocket.recovered}get id(){return this.ioSocket.id}compress(t){return this.ioSocket.compress(t),this}};function Dr(r,t){return new it(r,t)}var or=new Ce("__SOCKET_IO_CONFIG__"),_o=(()=>{class r{static forRoot(e){return{ngModule:r,providers:[{provide:or,useValue:e},{provide:it,useFactory:Dr,deps:[or,Ne]}]}}static \u0275fac=function(i){return new(i||r)};static \u0275mod=ke({type:r});static \u0275inj=ve({})}return r})();var de={BASE:`${ci}/notifications`,UNREAD:"unread"},Gt=de.BASE;var d=(function(r){return r.ADD="add",r.UPDATE="update",r.DELETE="delete",r.DELETE_PERMANENTLY="deletePermanently",r})(d||{});var y=(function(r){return r.COMMENTS="comments",r.SPACES="spaces",r.SPACE_ROOTS="spaces_roots",r.SHARES="shares",r.LINKS="links",r.SYNC="sync",r.AUTH_LOCKED="auth_locked",r.AUTH_2FA="auth_2fa",r.UNLOCK_REQUEST="unlock_request",r.UPDATE_AVAILABLE="server_update_available",r})(y||{}),bo={COMMENTS:"commented",SPACES:{[d.ADD]:"You now have access to the space",[d.DELETE]:"You no longer have access to the space",[d.DELETE_PERMANENTLY]:"This space has been permanently deleted"},SPACE_ROOTS:{[d.ADD]:"anchored",[d.DELETE]:"unanchored"},SHARES:{[d.ADD]:"shared with you",[d.DELETE]:"no longer share with you"},SHARES_WITHOUT_OWNER:{[d.ADD]:"You now have access to the share",[d.DELETE]:"You no longer have access to the share",[d.DELETE_PERMANENTLY]:"You are no longer a member of the parent share, your child share has been deleted"},LINKS:{[d.ADD]:"shared with you",[d.UPDATE]:"You now have access to the space"},SYNC:{[d.DELETE]:"You are no longer synchronizing"},AUTH_2FA:{[d.ADD]:"Two-factor authentication (2FA) on your account has been enabled",[d.DELETE]:"Two-factor authentication (2FA) on your account has been disabled"},AUTH_LOCKED:{[d.DELETE]:"Your account has been locked after several unsuccessful authentication attempts"},UNLOCK_REQUEST:"sends you a request to unlock the file",UPDATE_AVAILABLE:"A new update is available"};var ar=ii;var cr={[y.COMMENTS]:ar,[y.SPACES]:ct.SPACES,[y.SPACE_ROOTS]:ct.SPACES,[y.SHARES]:ct.SHARES,[y.LINKS]:ct.LINKS,[y.SYNC]:Si.SYNC,[y.UNLOCK_REQUEST]:ei};var Ht=class{constructor(t){this.soonRead=!1,Object.assign(this,t),this.fromUser?this.fromUser.avatarUrl=M(this.fromUser.login):this.fromUser={id:-1,login:null,email:null,fullName:"Info",avatarUrl:null},this.appIcon=cr[this.content.app],this.setMainElement()}setMainElement(){if(!(this.content.app===y.COMMENTS||this.content.app===y.SHARES||this.content.app===y.UPDATE_AVAILABLE||this.content.app===y.SYNC)&&this.content?.url){let t=this.content.url.split("/");t.length>1&&(this.mainElement=t[t.length-1])}}};var hr=(()=>{let t=class t{constructor(){this.http=p(Tt),this.store=p(Pt),this.layout=p(z)}getNotifications(i=!1){return this.http.get(`${Gt}${i?`/${de.UNREAD}`:""}`).pipe(S(s=>s.map(n=>new Ht(n))))}wasReadNotification(i){return this.http.patch(`${Gt}/${i}`,null)}deleteNotification(i){return this.http.delete(`${Gt}${i?`/${i}`:""}`)}checkUnreadNotifications(i=!1){this.getNotifications().subscribe(s=>{let n;if(i&&s.length){let o=s[0];n=this.layout.sendNotification("info",o.fromUser.fullName,this.layout.translateString(`${this.layout.translateString(o.content.event)}: <b>${o.content.element}</b>`),null,{enableHtml:!0})}else{let o=s.filter(a=>!a.wasRead).length;o&&(n=this.layout.sendNotification("info","Notifications",this.layout.translateString(o===1?"one_notification":"nb_notifications",{nb:o})))}n&&n.onTap.pipe(be(1)).subscribe(()=>this.layout.showRSideBarTab(yi.NOTIFICATIONS,!0)),this.store.notifications.set(s)})}};t.\u0275fac=function(s){return new(s||t)},t.\u0275prov=wt({token:t,factory:t.\u0275fac,providedIn:"root"});let r=t;return r})();var E=(function(r){return r.ACCESS="access",r.ACCESS_2FA="access_2fa",r.REFRESH="refresh",r.WS="ws",r.CSRF="csrf",r.CSRF_2FA="csrf_2fa",r})(E||{});var Xo="sync-in-csrf";var me=6;var ur="sync-in-two-fa-code",lr="sync-in-two-fa-password",zo={[E.ACCESS]:"/",[E.REFRESH]:Ri,[E.WS]:Oi,[E.CSRF]:"/",[E.ACCESS_2FA]:xi,[E.CSRF_2FA]:"/"},Zo=[E.REFRESH,E.ACCESS,E.WS,E.CSRF],ta=[E.ACCESS_2FA,E.CSRF_2FA];var Vr=["Password"];function Wr(r,t){r&1&&(f(0,"label",1),b(1,"Password"),_())}function $r(r,t){if(r&1){let e=st();f(0,"div",5),B("click",function(){W(e);let s=D();return $(s.randomPassword())}),f(1,"span"),J(2,"fa-icon",6),_()()}if(r&2){let e=D();m(2),C("icon",e.icons.faDice)}}var pr=(()=>{let t=class t{constructor(){this.passwordChange=new Oe,this.passwordMinLength=8,this.showGenerator=!1,this.showLabel=!1,this.disabled=!1,this.isRequired=!1,this.focus=!1,this.centered=!1,this.locale=p(Ot),this.toggleVisiblePassword=Ei,this.icons={faEye:ti,faEyeSlash:si,faDice:ni}}ngOnInit(){this.focus&&setTimeout(()=>{this.passwordElement.nativeElement.focus(),this.passwordElement.nativeElement.select()},0)}randomPassword(){this.disabled||this.passwordChange.emit(_i(this.passwordMinLength+2))}};t.\u0275fac=function(s){return new(s||t)},t.\u0275cmp=At({type:t,selectors:[["app-input-password"]],viewQuery:function(s,n){if(s&1&&Pe(Vr,7),s&2){let o;Fe(o=Ie())&&(n.passwordElement=o.first)}},inputs:{password:"password",passwordMinLength:"passwordMinLength",placeholder:"placeholder",showGenerator:"showGenerator",showLabel:"showLabel",disabled:"disabled",isRequired:"isRequired",focus:"focus",centered:"centered"},outputs:{passwordChange:"passwordChange"},decls:9,vars:16,consts:[["Password",""],["for","password","l10nTranslate",""],["id","password",1,"input-group","input-group-sm",2,"min-width","150px"],["autocomplete","off","type","password",1,"form-control","form-control-sm","pe-0",3,"ngModelChange","keyup","ngModel","disabled","placeholder","required"],[1,"input-group-text","cursor-pointer"],[1,"input-group-text","cursor-pointer",3,"click"],[3,"icon"]],template:function(s,n){if(s&1){let o=st();k(0,Wr,2,0,"label",1),f(1,"div",2)(2,"input",3,0),Ve(4,"translate"),Me("ngModelChange",function(h){return W(o),De(n.password,h)||(n.password=h),$(h)}),B("keyup",function(){return W(o),$(n.passwordChange.emit(n.password))}),_(),k(5,$r,3,1,"div",4),f(6,"div",5),B("click",function(){W(o);let h=Kt(3);return $(n.toggleVisiblePassword(h))}),f(7,"span"),J(8,"fa-icon",6),_()()()}if(s&2){let o=Kt(3);x(n.showLabel?0:-1),m(2),Le("padding-left",n.centered?"2rem":""),bt("is-invalid",n.isRequired&&(n.password==null?null:n.password.length)<n.passwordMinLength)("text-center",n.centered),Be("ngModel",n.password),C("disabled",n.disabled)("placeholder",We(4,13,n.placeholder,n.locale.language))("required",n.isRequired),m(3),x(n.showGenerator?5:-1),m(3),C("icon",o.type==="text"?n.icons.faEye:n.icons.faEyeSlash)}},dependencies:[Xe,vt,Ct,Qe,Ge,Rt,Nt,kt,ze],encapsulation:2});let r=t;return r})();var fr=(()=>{let t=class t{constructor(){this.autoFocus=!0,this.autoSelect=!0,this.elementRef=p(Re)}ngOnInit(){setTimeout(()=>{this.autoFocus&&this.elementRef.nativeElement.focus(),this.autoSelect&&this.elementRef.nativeElement.select()},0)}};t.\u0275fac=function(s){return new(s||t)},t.\u0275dir=xe({type:t,selectors:[["","appAutofocus",""]],inputs:{autoFocus:"autoFocus",autoSelect:"autoSelect"}});let r=t;return r})();function qr(r,t){r&1&&(f(0,"span",3),b(1,"Two-Factor Authentication"),_())}function Gr(r,t){r&1&&(f(0,"span",3),b(1,"Password Authentication"),_())}function Hr(r,t){if(r&1&&b(0),r&2){let e=D();Ue(" ",e.hasError," ")}}function Yr(r,t){r&1&&b(0," Enter your password ")}function Kr(r,t){r&1&&b(0," Valid with your TOTP code ")}function Qr(r,t){if(r&1){let e=st();f(0,"div",9)(1,"app-input-password",13),B("passwordChange",function(s){W(e);let n=D();return $(n.updatePassword(s))}),_()()}if(r&2){let e=D();m(),C("password",e.twoFaForm.value.password)("focus",!0)("centered",!0)}}function jr(r,t){r&1&&(f(0,"div",14),b(1,"Valid with your TOTP code"),_())}function Jr(r,t){if(r&1&&(k(0,jr,2,0,"div",14),f(1,"div",15),J(2,"input",16),_()),r&2){let e=D();x(e.withPassword?0:-1),m(2),C("autoFocus",!e.withPassword)("autoSelect",!e.withPassword)("maxlength",e.twoFaCodelength)}}var dr=(()=>{let t=class t{constructor(){this.withPassword=!1,this.withTwoFaEnabled=!0,this.submitted=!1,this.hasError=null,this.icons={faKey:Ze,faLock:ri},this.twoFaCodelength=me,this.locale=p(Ot),this.fb=p(Je),this.layout=p(z)}ngOnInit(){this.twoFaForm=this.fb.group({totpCode:this.fb.control("",this.withTwoFaEnabled?[nt.required,nt.pattern(new RegExp(`^\\d{${me}}$`))]:null),password:this.fb.control("",this.withPassword?[nt.required,nt.minLength(8)]:null)})}onClose(i=!1){this.isValid(i),this.layout.closeDialog()}onSubmit(){this.submitted=!0;let i=new $e(O(O({},this.withTwoFaEnabled?{[ur]:this.twoFaForm.value.totpCode}:{}),this.withPassword?{[lr]:this.twoFaForm.value.password}:{}));this.onClose(i)}updatePassword(i){this.twoFaForm.patchValue({password:i})}};t.\u0275fac=function(s){return new(s||t)},t.\u0275cmp=At({type:t,selectors:[["app-user-auth-2fa-verify-dialog"]],inputs:{withPassword:"withPassword",withTwoFaEnabled:"withTwoFaEnabled"},decls:20,vars:9,consts:[[1,"modal-header","align-items-center","justify-content-center"],[1,"modal-title"],[1,"me-2",3,"icon"],["l10nTranslate",""],[1,"modal-body","modal-auth-verify-2fa"],[1,"card","shadow-sm"],[1,"card-body"],["l10nTranslate","",1,"d-flex","justify-content-center","align-items-center","mb-3"],[3,"ngSubmit","formGroup"],[1,"mb-4"],[1,"d-grid","gap-2"],["type","submit","l10nTranslate","",1,"btn","btn-primary",3,"disabled"],["type","button","l10nTranslate","",1,"btn","btn-secondary",3,"click"],["id","password","placeholder","\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",3,"passwordChange","password","focus","centered"],["l10nTranslate","",1,"text-align-center","mb-3"],[1,"mb-3"],["appAutofocus","","type","text","formControlName","totpCode","placeholder","\u2022\u2022\u2022\u2022\u2022\u2022","inputmode","numeric","autocomplete","one-time-code","name","totp",1,"form-control","text-center","fs-4",3,"autoFocus","autoSelect","maxlength"]],template:function(s,n){s&1&&(f(0,"div",0)(1,"h4",1),J(2,"fa-icon",2),k(3,qr,2,0,"span",3)(4,Gr,2,0,"span",3),_()(),f(5,"div",4)(6,"div",5)(7,"div",6)(8,"p",7),k(9,Hr,1,1)(10,Yr,1,0)(11,Kr,1,0),_(),f(12,"form",8),B("ngSubmit",function(){return n.onSubmit()}),k(13,Qr,2,3,"div",9),k(14,Jr,3,4),f(15,"div",10)(16,"button",11),b(17,"Confirm"),_(),f(18,"button",12),B("click",function(){return n.onClose()}),b(19,"Cancel"),_()()()()()()),s&2&&(m(2),C("icon",n.icons.faLock),m(),x(n.withTwoFaEnabled?3:4),m(5),bt("text-danger",n.hasError),m(),x(n.hasError?9:n.withPassword?10:11),m(3),C("formGroup",n.twoFaForm),m(),x(n.withPassword?13:-1),m(),x(n.withTwoFaEnabled?14:-1),m(2),C("disabled",n.twoFaForm.invalid||n.submitted))},dependencies:[Nt,kt,fr,Rt,He,vt,Ct,qe,je,Ye,Ke,pr],encapsulation:2});let r=t;return r})();var Yt=class{constructor(t){this.parentGroup=t.parentGroup,this.members=t.members.map(e=>new T(e))}};var j=class{constructor(t){this.newly=0,this.currentAccessHover=!1,this.setManagers(t),Object.assign(this,t),this.avatarUrl=M(t.login),this.userIsActiveText=this.isActive?"active":"suspended",this.hTimeAgo=ai(this.currentAccess).fromNow(!0),this.newly=at(this.currentAccess)}setManagers(t){t?.managers&&(t.managers=t.managers.map(e=>new T(e)))}};var St=class{constructor(t){this.setOnlineStatus(gi("status",t)),this.avatarUrl=M(t.login),Object.assign(this,t)}setOnlineStatus(t){this.onlineStatus=t,this.onlineTextStatus=oi[t]}};var lc=(()=>{let t=class t{constructor(){this.http=p(Tt),this.layout=p(z),this.store=p(Pt),this.webSocket=p(it),this.notifications=p(hr),this.webSocket.fromEvent("connect").subscribe(()=>this.notifications.checkUnreadNotifications()),this.webSocket.fromEvent("disconnect").subscribe(()=>this.store.onlineUsers.set([])),this.webSocket.fromEvent(Ci.EVENTS.NOTIFICATION).subscribe(()=>this.notifications.checkUnreadNotifications(!0)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_USER).pipe(S(i=>new St(i))).subscribe(i=>this.newOnlineUser(i)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_USERS).pipe(S(i=>i.map(s=>new St(s)))).subscribe(i=>this.setOnlineUsers(i)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_STATUS).subscribe(i=>this.receiveOnlineStatus(i))}get user(){return this.store.user.getValue()}initUser(i,s=!1){this.refreshAvatar(),this.layout.setLanguage(i.language).catch(console.error),this.store.userImpersonate.set(s||i.impersonated),this.store.user.next(i),this.checkQuota(this.store.user.getValue()),s&&this.disconnectWebSocket(),this.connectWebSocket()}connectWebSocket(){this.webSocket.ioSocket.io.opts.query={onlineStatus:this.user.onlineStatus},this.webSocket.connect()}disconnectWebSocket(){this.webSocket.disconnect()}setOnlineUsers(i){this.store.onlineUsers.set(i)}newOnlineUser(i){this.store.onlineUsers().find(s=>s.id===i.id)?this.receiveOnlineStatus({userId:i.id,status:i.onlineStatus}):this.store.onlineUsers.update(s=>[i,...s])}userHavePermission(i){return this.user.isAdmin?!0:this.user?this.user.applications.indexOf(i)!==-1:!1}browseGroup(i){return this.http.get(`${fi}${i?`/${i}`:""}`).pipe(S(s=>new Yt(s)))}createPersonalGroup(i){return this.http.post(q,i).pipe(S(s=>new T(s)))}updatePersonalGroup(i,s){return this.http.put(`${q}/${i}`,s).pipe(S(n=>new T(n)))}leavePersonalGroup(i){return this.http.delete(`${di}/${i}`)}addUsersToGroup(i,s){return this.http.patch(`${q}/${i}/${ot.USERS}`,s)}deletePersonalGroup(i){return this.http.delete(`${q}/${i}`)}updateUserFromPersonalGroup(i,s,n){return this.http.patch(`${q}/${i}/${ot.USERS}/${s}`,n)}removeUserFromGroup(i,s){return this.http.delete(`${q}/${i}/${ot.USERS}/${s}`)}listGuests(){return this.http.get(X).pipe(S(i=>i.map(s=>new j(s))))}getGuest(i){return this.http.get(`${X}/${i}`).pipe(S(s=>new j(s)))}createGuest(i){return this.http.post(X,i).pipe(S(s=>new j(s)))}updateGuest(i,s){return this.http.put(`${X}/${i}`,s).pipe(S(n=>n?new j(n):null))}deleteGuest(i){return this.http.delete(`${X}/${i}`)}genAvatar(){this.http.patch(Jt,null).subscribe({next:()=>this.refreshAvatar(),error:i=>this.layout.sendNotification("error","Configuration","Avatar",i)})}uploadAvatar(i){let s=new FormData;s.append("file",i),this.http.put(Jt,s).subscribe({next:()=>this.refreshAvatar(),error:n=>this.layout.sendNotification("error","Configuration","Avatar",n)})}changePassword(i,s){return this.http.put(ui,i,{headers:s})}changeLanguage(i){return this.http.put(hi,i)}changeNotification(i){return this.http.put(li,i)}changeStorageIndexing(i){return this.http.put(pi,i)}changeOnlineStatus(i,s=!0){this.webSocket.emit(ht.EVENTS.ONLINE_STATUS,{status:i,store:s})}receiveOnlineStatus(i){this.user.id===i.userId?this.user.onlineStatus=i.status:this.store.onlineUsers().length&&this.store.onlineUsers.update(s=>s.map(n=>n.id===i.userId?ge(O({},n),{onlineStatus:i.status}):n))}searchMembers(i,s=[]){return this.http.request("search",ot.BASE,{body:i}).pipe(S(n=>n.map(o=>new T(o,s))),Ae(()=>[]))}setMenusVisibility(i){for(let s of i)if(!(s.id&&(s.hide=!this.userHavePermission(s.id),s.hide))&&(s.checks?.length&&(s.hide=!s.checks.map(n=>n.negate?!this[n.prop][n.value]:this[n.prop][n.value]).every(n=>!!n)),s.submenus?.length&&this.setMenusVisibility(s.submenus),s.title===Ai.FILES)){for(let n of s.submenus)if(!n.hide){s.link=n.link;break}}}refreshAvatar(){this.store.userAvatarUrl.next(wi())}checkAppStoreAvailability(){this.http.get(`${jt.BASE}/${jt.APP_STORE}`).subscribe({next:i=>this.store.appStoreManifest.set(i),error:i=>console.error(i)})}getEditorProviderPreference(){return localStorage.getItem("editorPreference")}setEditorProviderPreference(i){i===null?localStorage.removeItem("editorPreference"):localStorage.setItem("editorPreference",i)}listAppPasswords(i){return this.http.get(xt,{headers:i})}generateAppPassword(i,s){return this.http.post(xt,i,{headers:s})}deleteAppPassword(i){return this.http.delete(`${xt}/${i}`)}init2Fa(){return this.http.get(Xt)}enable2Fa(i){return this.http.post(Xt,i)}disable2Fa(i){return this.http.post(ki,i)}adminResetUser2Fa(i,s){return this.http.post(`${Ni}/${i}`,null,{headers:s})}auth2FaVerifyDialog(i=!1){return Se(this,null,function*(){let s=this.store.server().twoFaEnabled&&this.user.twoFaEnabled;if(i||s)return new Promise(n=>{let o=this.layout.openDialog(dr,"xs",{initialState:{withPassword:i,withTwoFaEnabled:s}},{keyboard:!1});o.content.isValid=a=>{n(a)}})})}checkQuota(i){if(!(i.isGuest||i.isLink)&&i.storageQuota){let s=Math.round(100/i.storageQuota*(i.storageQuota-i.storageUsage));s<=1?this.layout.sendNotification("error","Storage Quota","No more space available",null,{disableTimeOut:!0,closeButton:!0}):s<=5?this.layout.sendNotification("warning","Storage Quota",this.layout.translateString("available_space_is_low",{nb:s}),null,{disableTimeOut:!0,closeButton:!0}):s<=10&&this.layout.sendNotification("info","Storage Quota",this.layout.translateString("available_space_is_low",{nb:s}),null,{disableTimeOut:!0,closeButton:!0})}}};t.\u0275fac=function(s){return new(s||t)},t.\u0275prov=wt({token:t,factory:t.\u0275fac,providedIn:"root"});let r=t;return r})();export{ms as a,_s as b,Ri as c,xi as d,Xo as e,me as f,ur as g,lr as h,_o as i,y as j,hr as k,pr as l,fr as m,V as n,vi as o,ts as p,es as q,is as r,T as s,ls as t,Yt as u,j as v,lc as w};
|
|
1
|
+
import{$a as at,B as Qt,Ba as mi,Cb as z,I as oi,Ma as _i,Mb as Ai,Na as gi,Nb as ct,Pb as bi,Qb as Ti,Ua as yi,W as ci,X as jt,_ as ot,aa as hi,ab as Ei,ba as ui,ca as xt,da as li,ea as pi,fa as Jt,ga as q,ha as fi,ia as di,ja as X,qb as Si,tb as M,ub as wi,vb as Pt}from"./chunk-AALPWGPB.js";import{Aa as Re,Af as ii,Bb as st,Bd as Je,Cd as Xe,Dd as Rt,Eb as B,Ed as Ot,G as Ae,Gb as D,Gf as ri,Jd as ze,Kb as Pe,Kd as kt,L as be,Lb as Fe,Mb as Ie,Oa as m,Pb as Kt,Qa as Oe,Qb as Le,Rb as bt,Tb as b,Vb as Ue,Vc as $e,W as Te,Xb as Be,Yb as De,Yc as Tt,Yf as si,Zb as Me,ab as At,bb as ke,c as we,cb as xe,ea as wt,fa as ve,fd as vt,ha as Ce,hd as nt,he as Ze,ie as ti,ja as p,jb as Ne,jd as Ct,kc as Ve,kd as qe,lb as k,mb as x,mc as We,oa as W,od as Ge,og as ni,pa as $,pd as He,qg as Nt,rb as C,sb as f,sd as Ye,tb as _,td as Ke,ub as J,v as S,yd as Qe,yf as ei,zd as je}from"./chunk-76M3BMK6.js";import{n as ai}from"./chunk-DM4NXKEP.js";import{a as O,b as ge,d as ye,e as Ee,i as Se}from"./chunk-KAVP6UXH.js";var V=(function(r){return r.USER="user",r.GUEST="guest",r.LINK="link",r.GROUP="group",r.PGROUP="personal group",r})(V||{});function vi(r,t=[]){let e=O({},Object.fromEntries(Object.entries(Ti).filter(([i,s])=>t.indexOf(i)===-1)));if(!r)return e;for(let i of r.split(":"))i in e&&(e[i]=!0);return e}function ts(r,t,e=[]){let i={};if(!r)return i;for(let s of r.split(":"))e.indexOf(s)===-1&&(i[s]=t.indexOf(s)>-1);return i}function es(r,t=[]){let e={};if(!r)return e;for(let i of r.split(":"))t.indexOf(i)===-1&&(e[i]=bi[i]);return e}function is(r){return Object.entries(r).filter(([t,e])=>e).map(([t,e])=>t).join(":")}var T=class{constructor(t,e=[]){this.newly=0,this.linkSettings=null,Object.assign(this,t),this.mid=`${t.type[0]}${t.id}`,this.hPerms=vi(t.permissions,e),t.login&&(this.avatarUrl=M(t.login)),this.isLink=!!this.linkId,this.isGuest=this.type===V.GUEST,this.isUser=this.isGuest||this.type===V.USER&&!this.isLink,this.isGroup=this.type===V.GROUP||this.type===V.PGROUP,this.isPersonalGroup=this.type===V.PGROUP,this.setGroupRole(),this.modifiedAt?this.newly=at(this.modifiedAt):this.createdAt&&(this.newly=at(this.createdAt))}setGroupRole(t){typeof t<"u"&&(this.groupRole=t),this.isGroupManager=this.groupRole===Qt.MANAGER}};function ls(r,t,e){return new T({id:r.id,login:r.login,name:r.fullName,description:r.email,type:V.USER,spaceRole:t||mi.IS_MEMBER,groupRole:e||Qt.MEMBER,permissions:""})}var Ci={NAME_SPACE:"/",EVENTS:{NOTIFICATION:"notification"}};var ht={NAME_SPACE:"/",EVENTS:{ONLINE_STATUS:"onlineStatus",ONLINE_USERS:"onlineUsers",ONLINE_USER:"onlineUser"}};var l=(function(r){return r.BASE="/api/auth",r.LOGIN="login",r.LOGOUT="logout",r.REFRESH="refresh",r.TOKEN="token",r.TOKEN_REFRESH="token/refresh",r.WS="socket.io",r.TWO_FA_BASE="2fa",r.TWO_FA_ENABLE="enable",r.TWO_FA_DISABLE="disable",r.TWO_FA_LOGIN_VERIFY="login/verify",r.TWO_FA_ADMIN_RESET_USER="reset/user",r})(l||{}),ms=`${l.BASE}/${l.LOGIN}`,_s=`${l.BASE}/${l.LOGOUT}`,Ri=`${l.BASE}/${l.REFRESH}`,gs=`${l.BASE}/${l.TOKEN}`,ys=`${l.BASE}/${l.TOKEN_REFRESH}`,Oi=`/${l.WS}`,Xt=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ENABLE}`,ki=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_DISABLE}`,xi=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_LOGIN_VERIFY}`,Ni=`${l.BASE}/${l.TWO_FA_BASE}/${l.TWO_FA_ADMIN_RESET_USER}`;var fe={};Ee(fe,{Fetch:()=>mt,Manager:()=>K,NodeWebSocket:()=>L,NodeXHR:()=>I,Socket:()=>H,WebSocket:()=>L,WebTransport:()=>G,XHR:()=>I,connect:()=>Q,default:()=>Q,io:()=>Q,protocol:()=>le});var v=Object.create(null);v.open="0";v.close="1";v.ping="2";v.pong="3";v.message="4";v.upgrade="5";v.noop="6";var ut=Object.create(null);Object.keys(v).forEach(r=>{ut[v[r]]=r});var lt={type:"error",data:"parser error"};var Ii=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Li=typeof ArrayBuffer=="function",Ui=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r&&r.buffer instanceof ArrayBuffer,pt=({type:r,data:t},e,i)=>Ii&&t instanceof Blob?e?i(t):Pi(t,i):Li&&(t instanceof ArrayBuffer||Ui(t))?e?i(t):Pi(new Blob([t]),i):i(v[r]+(t||"")),Pi=(r,t)=>{let e=new FileReader;return e.onload=function(){let i=e.result.split(",")[1];t("b"+(i||""))},e.readAsDataURL(r)};function Fi(r){return r instanceof Uint8Array?r:r instanceof ArrayBuffer?new Uint8Array(r):new Uint8Array(r.buffer,r.byteOffset,r.byteLength)}var zt;function Bi(r,t){if(Ii&&r.data instanceof Blob)return r.data.arrayBuffer().then(Fi).then(t);if(Li&&(r.data instanceof ArrayBuffer||Ui(r.data)))return t(Fi(r.data));pt(r,!1,e=>{zt||(zt=new TextEncoder),t(zt.encode(e))})}var Di="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ft=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let r=0;r<Di.length;r++)ft[Di.charCodeAt(r)]=r;var Mi=r=>{let t=r.length*.75,e=r.length,i,s=0,n,o,a,h;r[r.length-1]==="="&&(t--,r[r.length-2]==="="&&t--);let R=new ArrayBuffer(t),A=new Uint8Array(R);for(i=0;i<e;i+=4)n=ft[r.charCodeAt(i)],o=ft[r.charCodeAt(i+1)],a=ft[r.charCodeAt(i+2)],h=ft[r.charCodeAt(i+3)],A[s++]=n<<2|o>>4,A[s++]=(o&15)<<4|a>>2,A[s++]=(a&3)<<6|h&63;return R};var mr=typeof ArrayBuffer=="function",dt=(r,t)=>{if(typeof r!="string")return{type:"message",data:Vi(r,t)};let e=r.charAt(0);return e==="b"?{type:"message",data:_r(r.substring(1),t)}:ut[e]?r.length>1?{type:ut[e],data:r.substring(1)}:{type:ut[e]}:lt},_r=(r,t)=>{if(mr){let e=Mi(r);return Vi(e,t)}else return{base64:!0,data:r}},Vi=(r,t)=>{switch(t){case"blob":return r instanceof Blob?r:new Blob([r]);case"arraybuffer":default:return r instanceof ArrayBuffer?r:r.buffer}};var Wi="",$i=(r,t)=>{let e=r.length,i=new Array(e),s=0;r.forEach((n,o)=>{pt(n,!1,a=>{i[o]=a,++s===e&&t(i.join(Wi))})})},qi=(r,t)=>{let e=r.split(Wi),i=[];for(let s=0;s<e.length;s++){let n=dt(e[s],t);if(i.push(n),n.type==="error")break}return i};function Gi(){return new TransformStream({transform(r,t){Bi(r,e=>{let i=e.length,s;if(i<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,i);else if(i<65536){s=new Uint8Array(3);let n=new DataView(s.buffer);n.setUint8(0,126),n.setUint16(1,i)}else{s=new Uint8Array(9);let n=new DataView(s.buffer);n.setUint8(0,127),n.setBigUint64(1,BigInt(i))}r.data&&typeof r.data!="string"&&(s[0]|=128),t.enqueue(s),t.enqueue(e)})}})}var Zt;function It(r){return r.reduce((t,e)=>t+e.length,0)}function Lt(r,t){if(r[0].length===t)return r.shift();let e=new Uint8Array(t),i=0;for(let s=0;s<t;s++)e[s]=r[0][i++],i===r[0].length&&(r.shift(),i=0);return r.length&&i<r[0].length&&(r[0]=r[0].slice(i)),e}function Hi(r,t){Zt||(Zt=new TextDecoder);let e=[],i=0,s=-1,n=!1;return new TransformStream({transform(o,a){for(e.push(o);;){if(i===0){if(It(e)<1)break;let h=Lt(e,1);n=(h[0]&128)===128,s=h[0]&127,s<126?i=3:s===126?i=1:i=2}else if(i===1){if(It(e)<2)break;let h=Lt(e,2);s=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),i=3}else if(i===2){if(It(e)<8)break;let h=Lt(e,8),R=new DataView(h.buffer,h.byteOffset,h.length),A=R.getUint32(0);if(A>Math.pow(2,21)-1){a.enqueue(lt);break}s=A*Math.pow(2,32)+R.getUint32(4),i=3}else{if(It(e)<s)break;let h=Lt(e,s);a.enqueue(dt(n?h:Zt.decode(h),t)),i=0}if(s===0||s>r){a.enqueue(lt);break}}}})}var te=4;function u(r){if(r)return gr(r)}function gr(r){for(var t in u.prototype)r[t]=u.prototype[t];return r}u.prototype.on=u.prototype.addEventListener=function(r,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+r]=this._callbacks["$"+r]||[]).push(t),this};u.prototype.once=function(r,t){function e(){this.off(r,e),t.apply(this,arguments)}return e.fn=t,this.on(r,e),this};u.prototype.off=u.prototype.removeListener=u.prototype.removeAllListeners=u.prototype.removeEventListener=function(r,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var e=this._callbacks["$"+r];if(!e)return this;if(arguments.length==1)return delete this._callbacks["$"+r],this;for(var i,s=0;s<e.length;s++)if(i=e[s],i===t||i.fn===t){e.splice(s,1);break}return e.length===0&&delete this._callbacks["$"+r],this};u.prototype.emit=function(r){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),e=this._callbacks["$"+r],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(e){e=e.slice(0);for(var i=0,s=e.length;i<s;++i)e[i].apply(this,t)}return this};u.prototype.emitReserved=u.prototype.emit;u.prototype.listeners=function(r){return this._callbacks=this._callbacks||{},this._callbacks["$"+r]||[]};u.prototype.hasListeners=function(r){return!!this.listeners(r).length};var N=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,e)=>e(t,0),g=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Yi="arraybuffer";function Ut(r,...t){return t.reduce((e,i)=>(r.hasOwnProperty(i)&&(e[i]=r[i]),e),{})}var yr=g.setTimeout,Er=g.clearTimeout;function P(r,t){t.useNativeTimers?(r.setTimeoutFn=yr.bind(g),r.clearTimeoutFn=Er.bind(g)):(r.setTimeoutFn=g.setTimeout.bind(g),r.clearTimeoutFn=g.clearTimeout.bind(g))}var Sr=1.33;function Ki(r){return typeof r=="string"?wr(r):Math.ceil((r.byteLength||r.size)*Sr)}function wr(r){let t=0,e=0;for(let i=0,s=r.length;i<s;i++)t=r.charCodeAt(i),t<128?e+=1:t<2048?e+=2:t<55296||t>=57344?e+=3:(i++,e+=4);return e}function Bt(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Qi(r){let t="";for(let e in r)r.hasOwnProperty(e)&&(t.length&&(t+="&"),t+=encodeURIComponent(e)+"="+encodeURIComponent(r[e]));return t}function ji(r){let t={},e=r.split("&");for(let i=0,s=e.length;i<s;i++){let n=e[i].split("=");t[decodeURIComponent(n[0])]=decodeURIComponent(n[1])}return t}var Dt=class extends Error{constructor(t,e,i){super(t),this.description=e,this.context=i,this.type="TransportError"}},F=class extends u{constructor(t){super(),this.writable=!1,P(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,e,i){return super.emitReserved("error",new Dt(t,e,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){let e=dt(t,this.socket.binaryType);this.onPacket(e)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,e={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){let t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){let e=Qi(t);return e.length?"?"+e:""}};var Z=class extends F{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";let e=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||e()})),this.writable||(i++,this.once("drain",function(){--i||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){let e=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};qi(t,this.socket.binaryType).forEach(e),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){let t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,$i(t,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){let t=this.opts.secure?"https":"http",e=this.query||{};return this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=Bt()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.createUri(t,e)}};var Ji=!1;try{Ji=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}var Xi=Ji;function Ar(){}var ee=class extends Z{constructor(t){if(super(t),typeof location<"u"){let e=location.protocol==="https:",i=location.port;i||(i=e?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,e){let i=this.request({method:"POST",data:t});i.on("success",e),i.on("error",(s,n)=>{this.onError("xhr post error",s,n)})}doPoll(){let t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(e,i)=>{this.onError("xhr poll error",e,i)}),this.pollXhr=t}},Mt=(()=>{class r extends u{constructor(e,i,s){super(),this.createRequest=e,P(this,s),this._opts=s,this._method=s.method||"GET",this._uri=i,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;let i=Ut(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");i.xdomain=!!this._opts.xd;let s=this._xhr=this.createRequest(i);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let n in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(n)&&s.setRequestHeader(n,this._opts.extraHeaders[n])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var n;s.readyState===3&&((n=this._opts.cookieJar)===null||n===void 0||n.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(n){this.setTimeoutFn(()=>{this._onError(n)},0);return}typeof document<"u"&&(this._index=r.requestsCount++,r.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=Ar,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete r.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}return r.requestsCount=0,r.requests={},r})();if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",zi);else if(typeof addEventListener=="function"){let r="onpagehide"in g?"pagehide":"unload";addEventListener(r,zi,!1)}}function zi(){for(let r in Mt.requests)Mt.requests.hasOwnProperty(r)&&Mt.requests[r].abort()}var br=(function(){let r=Zi({xdomain:!1});return r&&r.responseType!==null})(),I=class extends ee{constructor(t){super(t);let e=t&&t.forceBase64;this.supportsBinary=br&&!e}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Mt(Zi,this.uri(),t)}};function Zi(r){let t=r.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||Xi))return new XMLHttpRequest}catch{}if(!t)try{return new g[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}var tr=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative",re=class extends F{get name(){return"websocket"}doOpen(){let t=this.uri(),e=this.opts.protocols,i=tr?{}:Ut(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,e,i)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let i=t[e],s=e===t.length-1;pt(i,this.supportsBinary,n=>{try{this.doWrite(i,n)}catch{}s&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let t=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=Bt()),this.supportsBinary||(e.b64=1),this.createUri(t,e)}},ie=g.WebSocket||g.MozWebSocket,L=class extends re{createSocket(t,e,i){return tr?new ie(t,e,i):e?new ie(t,e):new ie(t)}doWrite(t,e){this.ws.send(e)}};var G=class extends F{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{let e=Hi(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(e).getReader(),s=Gi();s.readable.pipeTo(t.writable),this._writer=s.writable.getWriter();let n=()=>{i.read().then(({done:a,value:h})=>{a||(this.onPacket(h),n())}).catch(a=>{})};n();let o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let e=0;e<t.length;e++){let i=t[e],s=e===t.length-1;this._writer.write(i).then(()=>{s&&N(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}};var se={websocket:L,webtransport:G,polling:I};var Tr=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,vr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function tt(r){if(r.length>8e3)throw"URI too long";let t=r,e=r.indexOf("["),i=r.indexOf("]");e!=-1&&i!=-1&&(r=r.substring(0,e)+r.substring(e,i).replace(/:/g,";")+r.substring(i,r.length));let s=Tr.exec(r||""),n={},o=14;for(;o--;)n[vr[o]]=s[o]||"";return e!=-1&&i!=-1&&(n.source=t,n.host=n.host.substring(1,n.host.length-1).replace(/;/g,":"),n.authority=n.authority.replace("[","").replace("]","").replace(/;/g,":"),n.ipv6uri=!0),n.pathNames=Cr(n,n.path),n.queryKey=Rr(n,n.query),n}function Cr(r,t){let e=/\/{2,9}/g,i=t.replace(e,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function Rr(r,t){let e={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,s,n){s&&(e[s]=n)}),e}var ne=typeof addEventListener=="function"&&typeof removeEventListener=="function",Vt=[];ne&&addEventListener("offline",()=>{Vt.forEach(r=>r())},!1);var Wt=(()=>{class r extends u{constructor(e,i){if(super(),this.binaryType=Yi,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(i=e,e=null),e){let s=tt(e);i.hostname=s.host,i.secure=s.protocol==="https"||s.protocol==="wss",i.port=s.port,s.query&&(i.query=s.query)}else i.host&&(i.hostname=tt(i.host).host);P(this,i),this.secure=i.secure!=null?i.secure:typeof location<"u"&&location.protocol==="https:",i.hostname&&!i.port&&(i.port=this.secure?"443":"80"),this.hostname=i.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=i.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},i.transports.forEach(s=>{let n=s.prototype.name;this.transports.push(n),this._transportsByName[n]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},i),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ji(this.opts.query)),ne&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Vt.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let i=Object.assign({},this.opts.query);i.EIO=te,i.transport=e,this.id&&(i.sid=this.id);let s=Object.assign({},this.opts,{query:i,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}let e=this.opts.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";let i=this.createTransport(e);i.open(),this.setTransport(i)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",i=>this._onClose("transport close",i))}onOpen(){this.readyState="open",r.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":let i=new Error("server error");i.code=e.data,this._onError(i);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let i=1;for(let s=0;s<this.writeBuffer.length;s++){let n=this.writeBuffer[s].data;if(n&&(i+=Ki(n)),s>0&&i>this._maxPayload)return this.writeBuffer.slice(0,s);i+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,N(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,i,s){return this._sendPacket("message",e,i,s),this}send(e,i,s){return this._sendPacket("message",e,i,s),this}_sendPacket(e,i,s,n){if(typeof i=="function"&&(n=i,i=void 0),typeof s=="function"&&(n=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;let o={type:e,data:i,options:s};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),n&&this.once("flush",n),this.flush()}close(){let e=()=>{this._onClose("forced close"),this.transport.close()},i=()=>{this.off("upgrade",i),this.off("upgradeError",i),e()},s=()=>{this.once("upgrade",i),this.once("upgradeError",i)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(r.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,i){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),ne&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){let s=Vt.indexOf(this._offlineEventListener);s!==-1&&Vt.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,i),this.writeBuffer=[],this._prevBufferLen=0}}}return r.protocol=te,r})(),$t=class extends Wt{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let e=this.createTransport(t),i=!1;Wt.priorWebsocketSuccess=!1;let s=()=>{i||(e.send([{type:"ping",data:"probe"}]),e.once("packet",U=>{if(!i)if(U.type==="pong"&&U.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;Wt.priorWebsocketSuccess=e.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(A(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{let rt=new Error("probe error");rt.transport=e.name,this.emitReserved("upgradeError",rt)}}))};function n(){i||(i=!0,A(),e.close(),e=null)}let o=U=>{let rt=new Error("probe error: "+U);rt.transport=e.name,n(),this.emitReserved("upgradeError",rt)};function a(){o("transport closed")}function h(){o("socket closed")}function R(U){e&&U.name!==e.name&&n()}let A=()=>{e.removeListener("open",s),e.removeListener("error",o),e.removeListener("close",a),this.off("close",h),this.off("upgrading",R)};e.once("open",s),e.once("error",o),e.once("close",a),this.once("close",h),this.once("upgrading",R),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||e.open()},200):e.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){let e=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&e.push(t[i]);return e}},et=class extends $t{constructor(t,e={}){let i=typeof t=="object"?t:e;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(s=>se[s]).filter(s=>!!s)),super(t,i)}};var mt=class extends Z{doPoll(){this._fetch().then(t=>{if(!t.ok)return this.onError("fetch read error",t.status,t);t.text().then(e=>this.onData(e))}).catch(t=>{this.onError("fetch read error",t)})}doWrite(t,e){this._fetch(t).then(i=>{if(!i.ok)return this.onError("fetch write error",i.status,i);e()}).catch(i=>{this.onError("fetch write error",i)})}_fetch(t){var e;let i=t!==void 0,s=new Headers(this.opts.extraHeaders);return i&&s.set("content-type","text/plain;charset=UTF-8"),(e=this.socket._cookieJar)===null||e===void 0||e.appendCookies(s),fetch(this.uri(),{method:i?"POST":"GET",body:i?t:null,headers:s,credentials:this.opts.withCredentials?"include":"omit"}).then(n=>{var o;return(o=this.socket._cookieJar)===null||o===void 0||o.parseCookies(n.headers.getSetCookie()),n})}};var vn=et.protocol;function er(r,t="",e){let i=r;e=e||typeof location<"u"&&location,r==null&&(r=e.protocol+"//"+e.host),typeof r=="string"&&(r.charAt(0)==="/"&&(r.charAt(1)==="/"?r=e.protocol+r:r=e.host+r),/^(https?|wss?):\/\//.test(r)||(typeof e<"u"?r=e.protocol+"//"+r:r="https://"+r),i=tt(r)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";let n=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+n+":"+i.port+t,i.href=i.protocol+"://"+n+(e&&e.port===i.port?"":":"+i.port),i}var pe={};Ee(pe,{Decoder:()=>he,Encoder:()=>ce,PacketType:()=>c,isPacketValid:()=>Ur,protocol:()=>le});var Or=typeof ArrayBuffer=="function",kr=r=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(r):r.buffer instanceof ArrayBuffer,ir=Object.prototype.toString,xr=typeof Blob=="function"||typeof Blob<"u"&&ir.call(Blob)==="[object BlobConstructor]",Nr=typeof File=="function"||typeof File<"u"&&ir.call(File)==="[object FileConstructor]";function gt(r){return Or&&(r instanceof ArrayBuffer||kr(r))||xr&&r instanceof Blob||Nr&&r instanceof File}function _t(r,t){if(!r||typeof r!="object")return!1;if(Array.isArray(r)){for(let e=0,i=r.length;e<i;e++)if(_t(r[e]))return!0;return!1}if(gt(r))return!0;if(r.toJSON&&typeof r.toJSON=="function"&&arguments.length===1)return _t(r.toJSON(),!0);for(let e in r)if(Object.prototype.hasOwnProperty.call(r,e)&&_t(r[e]))return!0;return!1}function rr(r){let t=[],e=r.data,i=r;return i.data=oe(e,t),i.attachments=t.length,{packet:i,buffers:t}}function oe(r,t){if(!r)return r;if(gt(r)){let e={_placeholder:!0,num:t.length};return t.push(r),e}else if(Array.isArray(r)){let e=new Array(r.length);for(let i=0;i<r.length;i++)e[i]=oe(r[i],t);return e}else if(typeof r=="object"&&!(r instanceof Date)){let e={};for(let i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=oe(r[i],t));return e}return r}function sr(r,t){return r.data=ae(r.data,t),delete r.attachments,r}function ae(r,t){if(!r)return r;if(r&&r._placeholder===!0){if(typeof r.num=="number"&&r.num>=0&&r.num<t.length)return t[r.num];throw new Error("illegal attachments")}else if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=ae(r[e],t);else if(typeof r=="object")for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=ae(r[e],t));return r}var nr=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],le=5,c=(function(r){return r[r.CONNECT=0]="CONNECT",r[r.DISCONNECT=1]="DISCONNECT",r[r.EVENT=2]="EVENT",r[r.ACK=3]="ACK",r[r.CONNECT_ERROR=4]="CONNECT_ERROR",r[r.BINARY_EVENT=5]="BINARY_EVENT",r[r.BINARY_ACK=6]="BINARY_ACK",r})(c||{}),ce=class{constructor(t){this.replacer=t}encode(t){return(t.type===c.EVENT||t.type===c.ACK)&&_t(t)?this.encodeAsBinary({type:t.type===c.EVENT?c.BINARY_EVENT:c.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let e=""+t.type;return(t.type===c.BINARY_EVENT||t.type===c.BINARY_ACK)&&(e+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(e+=t.nsp+","),t.id!=null&&(e+=t.id),t.data!=null&&(e+=JSON.stringify(t.data,this.replacer)),e}encodeAsBinary(t){let e=rr(t),i=this.encodeAsString(e.packet),s=e.buffers;return s.unshift(i),s}},he=class r extends u{constructor(t){super(),this.reviver=t}add(t){let e;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(t);let i=e.type===c.BINARY_EVENT;i||e.type===c.BINARY_ACK?(e.type=i?c.EVENT:c.ACK,this.reconstructor=new ue(e),e.attachments===0&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else if(gt(t)||t.base64)if(this.reconstructor)e=this.reconstructor.takeBinaryData(t),e&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let e=0,i={type:Number(t.charAt(0))};if(c[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===c.BINARY_EVENT||i.type===c.BINARY_ACK){let n=e+1;for(;t.charAt(++e)!=="-"&&e!=t.length;);let o=t.substring(n,e);if(o!=Number(o)||t.charAt(e)!=="-")throw new Error("Illegal attachments");i.attachments=Number(o)}if(t.charAt(e+1)==="/"){let n=e+1;for(;++e&&!(t.charAt(e)===","||e===t.length););i.nsp=t.substring(n,e)}else i.nsp="/";let s=t.charAt(e+1);if(s!==""&&Number(s)==s){let n=e+1;for(;++e;){let o=t.charAt(e);if(o==null||Number(o)!=o){--e;break}if(e===t.length)break}i.id=Number(t.substring(n,e+1))}if(t.charAt(++e)){let n=this.tryParse(t.substr(e));if(r.isPayloadValid(i.type,n))i.data=n;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,e){switch(t){case c.CONNECT:return qt(e);case c.DISCONNECT:return e===void 0;case c.CONNECT_ERROR:return typeof e=="string"||qt(e);case c.EVENT:case c.BINARY_EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&nr.indexOf(e[0])===-1);case c.ACK:case c.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}},ue=class{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){let e=sr(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function Pr(r){return typeof r=="string"}var Fr=Number.isInteger||function(r){return typeof r=="number"&&isFinite(r)&&Math.floor(r)===r};function Ir(r){return r===void 0||Fr(r)}function qt(r){return Object.prototype.toString.call(r)==="[object Object]"}function Lr(r,t){switch(r){case c.CONNECT:return t===void 0||qt(t);case c.DISCONNECT:return t===void 0;case c.EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&nr.indexOf(t[0])===-1);case c.ACK:return Array.isArray(t);case c.CONNECT_ERROR:return typeof t=="string"||qt(t);default:return!1}}function Ur(r){return Pr(r.nsp)&&Ir(r.id)&&Lr(r.type,r.data)}function w(r,t,e){return r.on(t,e),function(){r.off(t,e)}}var Br=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),H=class extends u{constructor(t,e,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=e,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let t=this.io;this.subs=[w(t,"open",this.onopen.bind(this)),w(t,"packet",this.onpacket.bind(this)),w(t,"error",this.onerror.bind(this)),w(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...e){var i,s,n;if(Br.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(e.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;let o={type:c.EVENT,data:e};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof e[e.length-1]=="function"){let A=this.ids++,U=e.pop();this._registerAckCallback(A,U),o.id=A}let a=(s=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||s===void 0?void 0:s.writable,h=this.connected&&!(!((n=this.io.engine)===null||n===void 0)&&n._hasPingExpired());return this.flags.volatile&&!a||(h?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(t,e){var i;let s=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(s===void 0){this.acks[t]=e;return}let n=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let a=0;a<this.sendBuffer.length;a++)this.sendBuffer[a].id===t&&this.sendBuffer.splice(a,1);e.call(this,new Error("operation has timed out"))},s),o=(...a)=>{this.io.clearTimeoutFn(n),e.apply(this,a)};o.withError=!0,this.acks[t]=o}emitWithAck(t,...e){return new Promise((i,s)=>{let n=(o,a)=>o?s(o):i(a);n.withError=!0,e.push(n),this.emit(t,...e)})}_addToQueue(t){let e;typeof t[t.length-1]=="function"&&(e=t.pop());let i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((s,...n)=>(this._queue[0],s!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(s)):(this._queue.shift(),e&&e(null,...n)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;let e=this._queue[0];e.pending&&!t||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:c.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){let i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case c.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case c.EVENT:case c.BINARY_EVENT:this.onevent(t);break;case c.ACK:case c.BINARY_ACK:this.onack(t);break;case c.DISCONNECT:this.ondisconnect();break;case c.CONNECT_ERROR:this.destroy();let i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){let e=t.data||[];t.id!=null&&e.push(this.ack(t.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){let e=this._anyListeners.slice();for(let i of e)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){let e=this,i=!1;return function(...s){i||(i=!0,e.packet({type:c.ACK,id:t,data:s}))}}onack(t){let e=this.acks[t.id];typeof e=="function"&&(delete this.acks[t.id],e.withError&&t.data.unshift(null),e.apply(this,t.data))}onconnect(t,e){this.id=t,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:c.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){let e=this._anyListeners;for(let i=0;i<e.length;i++)if(t===e[i])return e.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){let e=this._anyOutgoingListeners;for(let i=0;i<e.length;i++)if(t===e[i])return e.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let e=this._anyOutgoingListeners.slice();for(let i of e)i.apply(this,t.data)}}};function Y(r){r=r||{},this.ms=r.min||100,this.max=r.max||1e4,this.factor=r.factor||2,this.jitter=r.jitter>0&&r.jitter<=1?r.jitter:0,this.attempts=0}Y.prototype.duration=function(){var r=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),e=Math.floor(t*this.jitter*r);r=(Math.floor(t*10)&1)==0?r-e:r+e}return Math.min(r,this.max)|0};Y.prototype.reset=function(){this.attempts=0};Y.prototype.setMin=function(r){this.ms=r};Y.prototype.setMax=function(r){this.max=r};Y.prototype.setJitter=function(r){this.jitter=r};var K=class extends u{constructor(t,e){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(e=t,t=void 0),e=e||{},e.path=e.path||"/socket.io",this.opts=e,P(this,e),this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor((i=e.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Y({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this._readyState="closed",this.uri=t;let s=e.parser||pe;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=e.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var e;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(e=this.backoff)===null||e===void 0||e.setMin(t),this)}randomizationFactor(t){var e;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(e=this.backoff)===null||e===void 0||e.setJitter(t),this)}reconnectionDelayMax(t){var e;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(e=this.backoff)===null||e===void 0||e.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new et(this.uri,this.opts);let e=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;let s=w(e,"open",function(){i.onopen(),t&&t()}),n=a=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",a),t?t(a):this.maybeReconnectOnOpen()},o=w(e,"error",n);if(this._timeout!==!1){let a=this._timeout,h=this.setTimeoutFn(()=>{s(),n(new Error("timeout")),e.close()},a);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(s),this.subs.push(o),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");let t=this.engine;this.subs.push(w(t,"ping",this.onping.bind(this)),w(t,"data",this.ondata.bind(this)),w(t,"error",this.onerror.bind(this)),w(t,"close",this.onclose.bind(this)),w(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(e){this.onclose("parse error",e)}}ondecoded(t){N(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,e){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new H(this,t,e),this.nsps[t]=i),i}_destroy(t){let e=Object.keys(this.nsps);for(let i of e)if(this.nsps[i].active)return;this._close()}_packet(t){let e=this.encoder.encode(t);for(let i=0;i<e.length;i++)this.engine.write(e[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,e){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{let e=this.backoff.duration();this._reconnecting=!0;let i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(s=>{s?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",s)):t.onreconnect()}))},e);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){let t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}};var yt={};function Q(r,t){typeof r=="object"&&(t=r,r=void 0),t=t||{};let e=er(r,t.path||"/socket.io"),i=e.source,s=e.id,n=e.path,o=yt[s]&&n in yt[s].nsps,a=t.forceNew||t["force new connection"]||t.multiplex===!1||o,h;return a?h=new K(i,t):(yt[s]||(yt[s]=new K(i,t)),h=yt[s]),e.query&&!t.query&&(t.query=e.queryKey),h.socket(e.path,t)}Object.assign(Q,{Manager:K,Socket:H,io:Q,connect:Q});var it=class r{config;appRef;subscribersCounter={};eventObservables$={};namespaces={};ioSocket;emptyConfig={url:"",options:{}};constructor(t,e){this.config=t,this.appRef=e,t===void 0&&(t=this.emptyConfig);let i=t.url,s=t.options,n=Q?Q:fe;this.ioSocket=n(i,s)}get auth(){return this.ioSocket.auth}set auth(t){this.ioSocket.auth=t}get io(){return this.ioSocket.io}get open(){return this.connect}get close(){return this.disconnect}of(t){if(!t||t==="/")return this;let e=this.namespaces[t];if(e)return e;let a=this.config,{url:i}=a,s=ye(a,["url"]),n=O({url:!i.endsWith("/")&&!t.startsWith("/")?`${i}/${t}`:`${i}${t}`},s),o=new r(n,this.appRef);return this.namespaces[t]=o,o}on(t,e){return this.ioSocket.on(t,e),this}once(t,e){return this.ioSocket.once(t,e),this}connect(){return this.ioSocket.connect(),this}disconnect(){return this.ioSocket.disconnect(),this}emit(t,...e){return this.ioSocket.emit(t,...e),this}send(...t){return this.ioSocket.send.apply(this.ioSocket,arguments),this}emitWithAck(t,...e){return this.ioSocket.emitWithAck(t,...e)}removeListener(t,e){return this.ioSocket.removeListener(t,e),this}removeAllListeners(t){return this.ioSocket.removeAllListeners(t),this}fromEvent(t){return this.subscribersCounter[t]||(this.subscribersCounter[t]=0),this.subscribersCounter[t]++,this.eventObservables$[t]||(this.eventObservables$[t]=new we(e=>{let i=s=>{e.next(s),this.appRef.tick()};return this.ioSocket.on(t,i),()=>{this.subscribersCounter[t]--,this.subscribersCounter[t]===0&&(this.ioSocket.removeListener(t,i),delete this.eventObservables$[t])}}).pipe(Te())),this.eventObservables$[t]}fromOneTimeEvent(t){return new Promise(e=>this.once(t,e))}listeners(t){return this.ioSocket.listeners(t)}hasListeners(t){return this.ioSocket.hasListeners(t)}listenersAny(){return this.ioSocket.listenersAny()}listenersAnyOutgoing(){return this.ioSocket.listenersAnyOutgoing()}off(t,e){return this.ioSocket.off(t,e),this}offAny(t){return this.ioSocket.offAny(t),this}offAnyOutgoing(t){return this.ioSocket.offAnyOutgoing(t),this}onAny(t){return this.ioSocket.onAny(t),this}onAnyOutgoing(t){return this.ioSocket.onAnyOutgoing(t),this}prependAny(t){return this.ioSocket.prependAny(t),this}prependAnyOutgoing(t){return this.ioSocket.prependAnyOutgoing(t),this}timeout(t){return this.ioSocket.timeout(t),this}get volatile(){let t=this.ioSocket.volatile;return this}get active(){return this.ioSocket.active}get connected(){return this.ioSocket.connected}get disconnected(){return this.ioSocket.disconnected}get recovered(){return this.ioSocket.recovered}get id(){return this.ioSocket.id}compress(t){return this.ioSocket.compress(t),this}};function Dr(r,t){return new it(r,t)}var or=new Ce("__SOCKET_IO_CONFIG__"),_o=(()=>{class r{static forRoot(e){return{ngModule:r,providers:[{provide:or,useValue:e},{provide:it,useFactory:Dr,deps:[or,Ne]}]}}static \u0275fac=function(i){return new(i||r)};static \u0275mod=ke({type:r});static \u0275inj=ve({})}return r})();var de={BASE:`${ci}/notifications`,UNREAD:"unread"},Gt=de.BASE;var d=(function(r){return r.ADD="add",r.UPDATE="update",r.DELETE="delete",r.DELETE_PERMANENTLY="deletePermanently",r})(d||{});var y=(function(r){return r.COMMENTS="comments",r.SPACES="spaces",r.SPACE_ROOTS="spaces_roots",r.SHARES="shares",r.LINKS="links",r.SYNC="sync",r.AUTH_LOCKED="auth_locked",r.AUTH_2FA="auth_2fa",r.UNLOCK_REQUEST="unlock_request",r.UPDATE_AVAILABLE="server_update_available",r})(y||{}),bo={COMMENTS:"commented",SPACES:{[d.ADD]:"You now have access to the space",[d.DELETE]:"You no longer have access to the space",[d.DELETE_PERMANENTLY]:"This space has been permanently deleted"},SPACE_ROOTS:{[d.ADD]:"anchored",[d.DELETE]:"unanchored"},SHARES:{[d.ADD]:"shared with you",[d.DELETE]:"no longer share with you"},SHARES_WITHOUT_OWNER:{[d.ADD]:"You now have access to the share",[d.DELETE]:"You no longer have access to the share",[d.DELETE_PERMANENTLY]:"You are no longer a member of the parent share, your child share has been deleted"},LINKS:{[d.ADD]:"shared with you",[d.UPDATE]:"You now have access to the space"},SYNC:{[d.DELETE]:"You are no longer synchronizing"},AUTH_2FA:{[d.ADD]:"Two-factor authentication (2FA) on your account has been enabled",[d.DELETE]:"Two-factor authentication (2FA) on your account has been disabled"},AUTH_LOCKED:{[d.DELETE]:"Your account has been locked after several unsuccessful authentication attempts"},UNLOCK_REQUEST:"sends you a request to unlock the file",UPDATE_AVAILABLE:"A new update is available"};var ar=ii;var cr={[y.COMMENTS]:ar,[y.SPACES]:ct.SPACES,[y.SPACE_ROOTS]:ct.SPACES,[y.SHARES]:ct.SHARES,[y.LINKS]:ct.LINKS,[y.SYNC]:Si.SYNC,[y.UNLOCK_REQUEST]:ei};var Ht=class{constructor(t){this.soonRead=!1,Object.assign(this,t),this.fromUser?this.fromUser.avatarUrl=M(this.fromUser.login):this.fromUser={id:-1,login:null,email:null,fullName:"Info",avatarUrl:null},this.appIcon=cr[this.content.app],this.setMainElement()}setMainElement(){if(!(this.content.app===y.COMMENTS||this.content.app===y.SHARES||this.content.app===y.UPDATE_AVAILABLE||this.content.app===y.SYNC)&&this.content?.url){let t=this.content.url.split("/");t.length>1&&(this.mainElement=t[t.length-1])}}};var hr=(()=>{let t=class t{constructor(){this.http=p(Tt),this.store=p(Pt),this.layout=p(z)}getNotifications(i=!1){return this.http.get(`${Gt}${i?`/${de.UNREAD}`:""}`).pipe(S(s=>s.map(n=>new Ht(n))))}wasReadNotification(i){return this.http.patch(`${Gt}/${i}`,null)}deleteNotification(i){return this.http.delete(`${Gt}${i?`/${i}`:""}`)}checkUnreadNotifications(i=!1){this.getNotifications().subscribe(s=>{let n;if(i&&s.length){let o=s[0];n=this.layout.sendNotification("info",o.fromUser.fullName,this.layout.translateString(`${this.layout.translateString(o.content.event)}: <b>${o.content.element}</b>`),null,{enableHtml:!0})}else{let o=s.filter(a=>!a.wasRead).length;o&&(n=this.layout.sendNotification("info","Notifications",this.layout.translateString(o===1?"one_notification":"nb_notifications",{nb:o})))}n&&n.onTap.pipe(be(1)).subscribe(()=>this.layout.showRSideBarTab(yi.NOTIFICATIONS,!0)),this.store.notifications.set(s)})}};t.\u0275fac=function(s){return new(s||t)},t.\u0275prov=wt({token:t,factory:t.\u0275fac,providedIn:"root"});let r=t;return r})();var E=(function(r){return r.ACCESS="access",r.ACCESS_2FA="access_2fa",r.REFRESH="refresh",r.WS="ws",r.CSRF="csrf",r.CSRF_2FA="csrf_2fa",r})(E||{});var Xo="sync-in-csrf";var me=6;var ur="sync-in-two-fa-code",lr="sync-in-two-fa-password",zo={[E.ACCESS]:"/",[E.REFRESH]:Ri,[E.WS]:Oi,[E.CSRF]:"/",[E.ACCESS_2FA]:xi,[E.CSRF_2FA]:"/"},Zo=[E.REFRESH,E.ACCESS,E.WS,E.CSRF],ta=[E.ACCESS_2FA,E.CSRF_2FA];var Vr=["Password"];function Wr(r,t){r&1&&(f(0,"label",1),b(1,"Password"),_())}function $r(r,t){if(r&1){let e=st();f(0,"div",5),B("click",function(){W(e);let s=D();return $(s.randomPassword())}),f(1,"span"),J(2,"fa-icon",6),_()()}if(r&2){let e=D();m(2),C("icon",e.icons.faDice)}}var pr=(()=>{let t=class t{constructor(){this.passwordChange=new Oe,this.passwordMinLength=8,this.showGenerator=!1,this.showLabel=!1,this.disabled=!1,this.isRequired=!1,this.focus=!1,this.centered=!1,this.locale=p(Ot),this.toggleVisiblePassword=Ei,this.icons={faEye:ti,faEyeSlash:si,faDice:ni}}ngOnInit(){this.focus&&setTimeout(()=>{this.passwordElement.nativeElement.focus(),this.passwordElement.nativeElement.select()},0)}randomPassword(){this.disabled||this.passwordChange.emit(_i(this.passwordMinLength+2))}};t.\u0275fac=function(s){return new(s||t)},t.\u0275cmp=At({type:t,selectors:[["app-input-password"]],viewQuery:function(s,n){if(s&1&&Pe(Vr,7),s&2){let o;Fe(o=Ie())&&(n.passwordElement=o.first)}},inputs:{password:"password",passwordMinLength:"passwordMinLength",placeholder:"placeholder",showGenerator:"showGenerator",showLabel:"showLabel",disabled:"disabled",isRequired:"isRequired",focus:"focus",centered:"centered"},outputs:{passwordChange:"passwordChange"},decls:9,vars:16,consts:[["Password",""],["for","password","l10nTranslate",""],["id","password",1,"input-group","input-group-sm",2,"min-width","150px"],["autocomplete","off","type","password",1,"form-control","form-control-sm","pe-0",3,"ngModelChange","keyup","ngModel","disabled","placeholder","required"],[1,"input-group-text","cursor-pointer"],[1,"input-group-text","cursor-pointer",3,"click"],[3,"icon"]],template:function(s,n){if(s&1){let o=st();k(0,Wr,2,0,"label",1),f(1,"div",2)(2,"input",3,0),Ve(4,"translate"),Me("ngModelChange",function(h){return W(o),De(n.password,h)||(n.password=h),$(h)}),B("keyup",function(){return W(o),$(n.passwordChange.emit(n.password))}),_(),k(5,$r,3,1,"div",4),f(6,"div",5),B("click",function(){W(o);let h=Kt(3);return $(n.toggleVisiblePassword(h))}),f(7,"span"),J(8,"fa-icon",6),_()()()}if(s&2){let o=Kt(3);x(n.showLabel?0:-1),m(2),Le("padding-left",n.centered?"2rem":""),bt("is-invalid",n.isRequired&&(n.password==null?null:n.password.length)<n.passwordMinLength)("text-center",n.centered),Be("ngModel",n.password),C("disabled",n.disabled)("placeholder",We(4,13,n.placeholder,n.locale.language))("required",n.isRequired),m(3),x(n.showGenerator?5:-1),m(3),C("icon",o.type==="text"?n.icons.faEye:n.icons.faEyeSlash)}},dependencies:[Xe,vt,Ct,Qe,Ge,Rt,Nt,kt,ze],encapsulation:2});let r=t;return r})();var fr=(()=>{let t=class t{constructor(){this.autoFocus=!0,this.autoSelect=!0,this.elementRef=p(Re)}ngOnInit(){setTimeout(()=>{this.autoFocus&&this.elementRef.nativeElement.focus(),this.autoSelect&&this.elementRef.nativeElement.select()},0)}};t.\u0275fac=function(s){return new(s||t)},t.\u0275dir=xe({type:t,selectors:[["","appAutofocus",""]],inputs:{autoFocus:"autoFocus",autoSelect:"autoSelect"}});let r=t;return r})();function qr(r,t){r&1&&(f(0,"span",3),b(1,"Two-Factor Authentication"),_())}function Gr(r,t){r&1&&(f(0,"span",3),b(1,"Password Authentication"),_())}function Hr(r,t){if(r&1&&b(0),r&2){let e=D();Ue(" ",e.hasError," ")}}function Yr(r,t){r&1&&b(0," Enter your password ")}function Kr(r,t){r&1&&b(0," Valid with your TOTP code ")}function Qr(r,t){if(r&1){let e=st();f(0,"div",9)(1,"app-input-password",13),B("passwordChange",function(s){W(e);let n=D();return $(n.updatePassword(s))}),_()()}if(r&2){let e=D();m(),C("password",e.twoFaForm.value.password)("focus",!0)("centered",!0)}}function jr(r,t){r&1&&(f(0,"div",14),b(1,"Valid with your TOTP code"),_())}function Jr(r,t){if(r&1&&(k(0,jr,2,0,"div",14),f(1,"div",15),J(2,"input",16),_()),r&2){let e=D();x(e.withPassword?0:-1),m(2),C("autoFocus",!e.withPassword)("autoSelect",!e.withPassword)("maxlength",e.twoFaCodelength)}}var dr=(()=>{let t=class t{constructor(){this.withPassword=!1,this.withTwoFaEnabled=!0,this.submitted=!1,this.hasError=null,this.icons={faKey:Ze,faLock:ri},this.twoFaCodelength=me,this.locale=p(Ot),this.fb=p(Je),this.layout=p(z)}ngOnInit(){this.twoFaForm=this.fb.group({totpCode:this.fb.control("",this.withTwoFaEnabled?[nt.required,nt.pattern(new RegExp(`^\\d{${me}}$`))]:null),password:this.fb.control("",this.withPassword?[nt.required,nt.minLength(8)]:null)})}onClose(i=!1){this.isValid(i),this.layout.closeDialog()}onSubmit(){this.submitted=!0;let i=new $e(O(O({},this.withTwoFaEnabled?{[ur]:this.twoFaForm.value.totpCode}:{}),this.withPassword?{[lr]:this.twoFaForm.value.password}:{}));this.onClose(i)}updatePassword(i){this.twoFaForm.patchValue({password:i})}};t.\u0275fac=function(s){return new(s||t)},t.\u0275cmp=At({type:t,selectors:[["app-user-auth-2fa-verify-dialog"]],inputs:{withPassword:"withPassword",withTwoFaEnabled:"withTwoFaEnabled"},decls:20,vars:9,consts:[[1,"modal-header","align-items-center","justify-content-center"],[1,"modal-title"],[1,"me-2",3,"icon"],["l10nTranslate",""],[1,"modal-body","modal-auth-verify-2fa"],[1,"card","shadow-sm"],[1,"card-body"],["l10nTranslate","",1,"d-flex","justify-content-center","align-items-center","mb-3"],[3,"ngSubmit","formGroup"],[1,"mb-4"],[1,"d-grid","gap-2"],["type","submit","l10nTranslate","",1,"btn","btn-primary",3,"disabled"],["type","button","l10nTranslate","",1,"btn","btn-secondary",3,"click"],["id","password","placeholder","\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",3,"passwordChange","password","focus","centered"],["l10nTranslate","",1,"text-align-center","mb-3"],[1,"mb-3"],["appAutofocus","","type","text","formControlName","totpCode","placeholder","\u2022\u2022\u2022\u2022\u2022\u2022","inputmode","numeric","autocomplete","one-time-code","name","totp",1,"form-control","text-center","fs-4",3,"autoFocus","autoSelect","maxlength"]],template:function(s,n){s&1&&(f(0,"div",0)(1,"h4",1),J(2,"fa-icon",2),k(3,qr,2,0,"span",3)(4,Gr,2,0,"span",3),_()(),f(5,"div",4)(6,"div",5)(7,"div",6)(8,"p",7),k(9,Hr,1,1)(10,Yr,1,0)(11,Kr,1,0),_(),f(12,"form",8),B("ngSubmit",function(){return n.onSubmit()}),k(13,Qr,2,3,"div",9),k(14,Jr,3,4),f(15,"div",10)(16,"button",11),b(17,"Confirm"),_(),f(18,"button",12),B("click",function(){return n.onClose()}),b(19,"Cancel"),_()()()()()()),s&2&&(m(2),C("icon",n.icons.faLock),m(),x(n.withTwoFaEnabled?3:4),m(5),bt("text-danger",n.hasError),m(),x(n.hasError?9:n.withPassword?10:11),m(3),C("formGroup",n.twoFaForm),m(),x(n.withPassword?13:-1),m(),x(n.withTwoFaEnabled?14:-1),m(2),C("disabled",n.twoFaForm.invalid||n.submitted))},dependencies:[Nt,kt,fr,Rt,He,vt,Ct,qe,je,Ye,Ke,pr],encapsulation:2});let r=t;return r})();var Yt=class{constructor(t){this.parentGroup=t.parentGroup,this.members=t.members.map(e=>new T(e))}};var j=class{constructor(t){this.newly=0,this.currentAccessHover=!1,this.setManagers(t),Object.assign(this,t),this.avatarUrl=M(t.login),this.userIsActiveText=this.isActive?"active":"suspended",this.hTimeAgo=ai(this.currentAccess).fromNow(!0),this.newly=at(this.currentAccess)}setManagers(t){t?.managers&&(t.managers=t.managers.map(e=>new T(e)))}};var St=class{constructor(t){this.setOnlineStatus(gi("status",t)),this.avatarUrl=M(t.login),Object.assign(this,t)}setOnlineStatus(t){this.onlineStatus=t,this.onlineTextStatus=oi[t]}};var lc=(()=>{let t=class t{constructor(){this.http=p(Tt),this.layout=p(z),this.store=p(Pt),this.webSocket=p(it),this.notifications=p(hr),this.webSocket.fromEvent("connect").subscribe(()=>this.notifications.checkUnreadNotifications()),this.webSocket.fromEvent("disconnect").subscribe(()=>this.store.onlineUsers.set([])),this.webSocket.fromEvent(Ci.EVENTS.NOTIFICATION).subscribe(()=>this.notifications.checkUnreadNotifications(!0)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_USER).pipe(S(i=>new St(i))).subscribe(i=>this.newOnlineUser(i)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_USERS).pipe(S(i=>i.map(s=>new St(s)))).subscribe(i=>this.setOnlineUsers(i)),this.webSocket.fromEvent(ht.EVENTS.ONLINE_STATUS).subscribe(i=>this.receiveOnlineStatus(i))}get user(){return this.store.user.getValue()}initUser(i,s=!1){this.refreshAvatar(),this.layout.setLanguage(i.language).catch(console.error),this.store.userImpersonate.set(s||i.impersonated),this.store.user.next(i),this.checkQuota(this.store.user.getValue()),s&&this.disconnectWebSocket(),this.connectWebSocket()}connectWebSocket(){this.webSocket.ioSocket.io.opts.query={onlineStatus:this.user.onlineStatus},this.webSocket.connect()}disconnectWebSocket(){this.webSocket.disconnect()}setOnlineUsers(i){this.store.onlineUsers.set(i)}newOnlineUser(i){this.store.onlineUsers().find(s=>s.id===i.id)?this.receiveOnlineStatus({userId:i.id,status:i.onlineStatus}):this.store.onlineUsers.update(s=>[i,...s])}userHavePermission(i){return this.user.isAdmin?!0:this.user?this.user.applications.indexOf(i)!==-1:!1}browseGroup(i){return this.http.get(`${fi}${i?`/${i}`:""}`).pipe(S(s=>new Yt(s)))}createPersonalGroup(i){return this.http.post(q,i).pipe(S(s=>new T(s)))}updatePersonalGroup(i,s){return this.http.put(`${q}/${i}`,s).pipe(S(n=>new T(n)))}leavePersonalGroup(i){return this.http.delete(`${di}/${i}`)}addUsersToGroup(i,s){return this.http.patch(`${q}/${i}/${ot.USERS}`,s)}deletePersonalGroup(i){return this.http.delete(`${q}/${i}`)}updateUserFromPersonalGroup(i,s,n){return this.http.patch(`${q}/${i}/${ot.USERS}/${s}`,n)}removeUserFromGroup(i,s){return this.http.delete(`${q}/${i}/${ot.USERS}/${s}`)}listGuests(){return this.http.get(X).pipe(S(i=>i.map(s=>new j(s))))}getGuest(i){return this.http.get(`${X}/${i}`).pipe(S(s=>new j(s)))}createGuest(i){return this.http.post(X,i).pipe(S(s=>new j(s)))}updateGuest(i,s){return this.http.put(`${X}/${i}`,s).pipe(S(n=>n?new j(n):null))}deleteGuest(i){return this.http.delete(`${X}/${i}`)}genAvatar(){this.http.patch(Jt,null).subscribe({next:()=>this.refreshAvatar(),error:i=>this.layout.sendNotification("error","Configuration","Avatar",i)})}uploadAvatar(i){let s=new FormData;s.append("file",i),this.http.put(Jt,s).subscribe({next:()=>this.refreshAvatar(),error:n=>this.layout.sendNotification("error","Configuration","Avatar",n)})}changePassword(i,s){return this.http.put(ui,i,{headers:s})}changeLanguage(i){return this.http.put(hi,i)}changeNotification(i){return this.http.put(li,i)}changeStorageIndexing(i){return this.http.put(pi,i)}changeOnlineStatus(i,s=!0){this.webSocket.emit(ht.EVENTS.ONLINE_STATUS,{status:i,store:s})}receiveOnlineStatus(i){this.user.id===i.userId?this.user.onlineStatus=i.status:this.store.onlineUsers().length&&this.store.onlineUsers.update(s=>s.map(n=>n.id===i.userId?ge(O({},n),{onlineStatus:i.status}):n))}searchMembers(i,s=[]){return this.http.request("search",ot.BASE,{body:i}).pipe(S(n=>n.map(o=>new T(o,s))),Ae(()=>[]))}setMenusVisibility(i){for(let s of i)if(!(s.id&&(s.hide=!this.userHavePermission(s.id),s.hide))&&(s.checks?.length&&(s.hide=!s.checks.map(n=>n.negate?!this[n.prop][n.value]:this[n.prop][n.value]).every(n=>!!n)),s.submenus?.length&&this.setMenusVisibility(s.submenus),s.title===Ai.FILES)){for(let n of s.submenus)if(!n.hide){s.link=n.link;break}}}refreshAvatar(){this.store.userAvatarUrl.next(wi())}checkAppStoreAvailability(){this.http.get(`${jt.BASE}/${jt.APP_STORE}`).subscribe({next:i=>this.store.appStoreManifest.set(i),error:i=>console.error(i)})}getEditorProviderPreference(){return localStorage.getItem("editorPreference")}setEditorProviderPreference(i){i===null?localStorage.removeItem("editorPreference"):localStorage.setItem("editorPreference",i)}listAppPasswords(i){return this.http.get(xt,{headers:i})}generateAppPassword(i,s){return this.http.post(xt,i,{headers:s})}deleteAppPassword(i){return this.http.delete(`${xt}/${i}`)}init2Fa(){return this.http.get(Xt)}enable2Fa(i){return this.http.post(Xt,i)}disable2Fa(i){return this.http.post(ki,i)}adminResetUser2Fa(i,s){return this.http.post(`${Ni}/${i}`,null,{headers:s})}auth2FaVerifyDialog(i=!1){return Se(this,null,function*(){let s=this.store.server().twoFaEnabled&&this.user.twoFaEnabled;if(i||s)return new Promise(n=>{let o=this.layout.openDialog(dr,"xs",{initialState:{withPassword:i,withTwoFaEnabled:s}},{keyboard:!1});o.content.isValid=a=>{n(a)}})})}checkQuota(i){if(!(i.isGuest||i.isLink)&&i.storageQuota){let s=Math.round(100/i.storageQuota*(i.storageQuota-i.storageUsage));s<=1?this.layout.sendNotification("error","Storage Quota","No more space available",null,{disableTimeOut:!0,closeButton:!0}):s<=5?this.layout.sendNotification("warning","Storage Quota",this.layout.translateString("available_space_is_low",{nb:s}),null,{disableTimeOut:!0,closeButton:!0}):s<=10&&this.layout.sendNotification("info","Storage Quota",this.layout.translateString("available_space_is_low",{nb:s}),null,{disableTimeOut:!0,closeButton:!0})}}};t.\u0275fac=function(s){return new(s||t)},t.\u0275prov=wt({token:t,factory:t.\u0275fac,providedIn:"root"});let r=t;return r})();export{ms as a,_s as b,Ri as c,xi as d,Xo as e,me as f,ur as g,lr as h,_o as i,y as j,hr as k,pr as l,fr as m,V as n,vi as o,ts as p,es as q,is as r,T as s,ls as t,Yt as u,j as v,lc as w};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as ye}from"./chunk-XEWLBWFF.js";import{m as ve,n as xe,s as N,w as Oe}from"./chunk-B6HQYQYG.js";import{Cb as Ce,J as _e}from"./chunk-O3YLAEVE.js";import{Aa as q,Ab as D,Ae as me,Bb as y,Bf as ge,Cd as ce,Dd as le,Eb as h,Gb as p,Gd as pe,Ha as T,J as I,Kd as de,Mc as ie,N as W,Oa as s,Od as ue,Pb as F,Qa as O,Rb as b,Sb as Z,Tb as m,Ub as k,Xb as V,Yb as G,Zb as A,ab as M,bf as he,cb as B,cc as J,cd as ne,da as U,db as Q,dd as oe,ec as Y,fb as w,fd as re,gc as ee,hc as te,ja as C,jd as se,kc as H,lb as f,mb as g,mc as j,nb as $,nf as fe,oa as v,oc as z,od as ae,pa as x,pb as K,qb as X,qg as P,rb as u,sb as c,tb as a,ub as _}from"./chunk-D55YR5X7.js";var ke=(function(i){return i[i.USER=0]="USER",i[i.PERSONAL=1]="PERSONAL",i})(ke||{}),Se=(function(i){return i[i.VISIBLE=0]="VISIBLE",i[i.PRIVATE=1]="PRIVATE",i[i.ISOLATED=2]="ISOLATED",i})(Se||{});var Xe=(()=>{let n=class n{constructor(){this.translate=C(pe)}transform(e,t=[]){let o="";if(!e)return o;for(let[l,d]of Object.entries(e).filter(([E,qe])=>t.indexOf(E)===-1))d&&(o+=`${d} ${this.translate.translate(d===1?l.slice(0,-1):l)}, `);return o.slice(0,-2)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275pipe=Q({name:"joinCounts",type:n,pure:!0});let i=n;return i})();function Me(i,n){if(i&1&&(c(0,"span"),m(1),a()),i&2){let r=p();s(),k(r.group.name)}}function we(i,n){i&1&&(c(0,"span",3),m(1,"New personal group"),a())}function Pe(i,n){if(i&1&&_(0,"fa-icon",4),i&2){let r=p();u("icon",r.icons.faSpinner)}}function Ee(i,n){i&1&&(c(0,"span",3),m(1,"Edit personal group"),a())}function Te(i,n){i&1&&(c(0,"span",3),m(1,"Edit group"),a())}function De(i,n){if(i&1&&(c(0,"h4",5),f(1,Ee,2,0,"span",3)(2,Te,2,0,"span",3),a()),i&2){let r=p();s(),g(r.isPersonalGroup?1:2)}}var mt=(()=>{let n=class n{constructor(){this.groupChange=new O,this.layout=C(Ce),this.icons={GROUPS:_e.GROUPS,faSpinner:fe,faCog:he,faUsers:me,faPen:ge},this.isPersonalGroup=!0,this.submitted=!1,this.loading=!1,this.userService=C(Oe),this.user=this.userService.user}ngOnInit(){this.originalGroup?.id?(this.isPersonalGroup=this.originalGroup.isPersonalGroup,this.group=new N({id:this.originalGroup.id,name:this.originalGroup.name,description:this.originalGroup.description,createdAt:this.originalGroup.createdAt,modifiedAt:this.originalGroup.modifiedAt,type:this.originalGroup.type})):this.group=new N({id:0,name:"",description:"",createdAt:null,modifiedAt:null,type:xe.PGROUP})}onCancel(){this.layout.closeDialog()}onSubmit(){if(this.loading=!0,this.submitted=!0,this.group.id===0)this.userService.createPersonalGroup(this.makeDto(!0)).subscribe({next:e=>{this.loading=!1,this.groupChange.emit(["add",e]),this.layout.sendNotification("success","Group created",e.name),this.layout.closeDialog()},error:e=>this.onError(e)});else{let e=this.makeDto();if(!Object.keys(e).length){this.loading=!1,this.submitted=!1;return}this.userService.updatePersonalGroup(this.originalGroup.id,this.makeDto()).subscribe({next:t=>{this.loading=!1,this.groupChange.emit(["update",t]),this.layout.sendNotification("success","Group updated",t.name),this.layout.closeDialog()},error:t=>this.onError(t)})}}makeDto(e=!1){return{name:e?this.group.name:this.group.name!==this.originalGroup.name?this.group.name:void 0,description:e?this.group.description:this.group.description!==this.originalGroup.description?this.group.description:void 0}}onError(e){this.layout.sendNotification("error","Group error",this.group.name,e),this.submitted=!1,this.loading=!1}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=M({type:n,selectors:[["app-user-group-dialog"]],inputs:{originalGroup:"originalGroup"},outputs:{groupChange:"groupChange"},decls:23,vars:15,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],["l10nTranslate",""],["animation","spin","size","sm",1,"ms-2",3,"icon"],[1,"modal-title","ms-auto"],["aria-label","Close","type","button",3,"click"],[1,"modal-body"],[1,"d-flex","col-12","pb-3"],[1,"flex-fill","col-6","pe-4"],["for","name","l10nTranslate",""],["id","name","appAutofocus","","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"ngModelChange","disabled","autoSelect","ngModel"],[1,"flex-fill","col-6","ps-4"],["for","description","l10nTranslate",""],["id","description","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"ngModelChange","ngModel","disabled"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-primary",3,"click","disabled"]],template:function(t,o){t&1&&(c(0,"div",0)(1,"h4",1),_(2,"fa-icon",2),f(3,Me,2,1,"span")(4,we,2,0,"span",3),f(5,Pe,1,1,"fa-icon",4),a(),f(6,De,3,1,"h4",5),c(7,"button",6),h("click",function(){return o.layout.closeDialog()}),a()(),c(8,"div",7)(9,"div",8)(10,"div",9)(11,"label",10),m(12,"Name"),a(),c(13,"input",11),A("ngModelChange",function(d){return G(o.group.name,d)||(o.group.name=d),d}),a()(),c(14,"div",12)(15,"label",13),m(16,"Description"),a(),c(17,"input",14),A("ngModelChange",function(d){return G(o.group.description,d)||(o.group.description=d),d}),a()()()(),c(18,"div",15)(19,"button",16),h("click",function(){return o.onCancel()}),m(20,"Cancel"),a(),c(21,"button",17),h("click",function(){return o.onSubmit()}),m(22," Confirm "),a()()),t&2&&(s(2),u("icon",o.icons.GROUPS),s(),g(o.group.id?3:4),s(2),g(o.loading?5:-1),s(),g(o.group.id?6:-1),s(),Z(J("btn-close btn-close-white ",o.group.id?"ms-2":"ms-auto"," ms-2")),s(6),b("is-invalid",!o.group.name),u("disabled",!o.isPersonalGroup)("autoSelect",!1),V("ngModel",o.group.name),s(4),V("ngModel",o.group.description),u("disabled",!o.isPersonalGroup),s(4),u("disabled",!o.group.name||o.submitted))},dependencies:[le,re,se,ce,ae,P,de,ve],encapsulation:2});let i=n;return i})();var be=(()=>{let n=class n{onClick(e){e.stopPropagation()}ngOnInit(){setTimeout(()=>{typeof document<"u"&&document.addEventListener("click",this.offClickHandler)},0)}ngOnDestroy(){typeof document<"u"&&document.removeEventListener("click",this.offClickHandler)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275dir=B({type:n,selectors:[["","offClick",""]],hostBindings:function(t,o){t&1&&h("click",function(d){return o.onClick(d)})},inputs:{offClickHandler:[0,"offClick","offClickHandler"]}});let i=n;return i})();var S=class{constructor(n){typeof n=="string"&&(this.id=this.name=n,this.description=""),typeof n=="object"&&(this.id=n.id||n.name,this.name=n.name,this.description=n.description||"")}};var Fe=i=>({active:i}),Ve=(i,n)=>({o:i,i:n});function Ge(i,n){if(i&1){let r=y();c(0,"input",6),h("keydown",function(t){v(r);let o=p();return x(o.inputEvent(t))})("keyup",function(t){v(r);let o=p();return x(o.inputEvent(t,!0))}),a()}if(i&2){let r=p();u("disabled",r.disabled)}}function Ae(i,n){i&1&&D(0)}function He(i,n){if(i&1&&(c(0,"span",12),w(1,Ae,1,0,"ng-container",13),a()),i&2){let r=p(2),e=F(6);b("ui-select-allow-clear",r.allowClear&&r.active),s(),u("ngTemplateOutlet",r.customTemplateSelect||e)("ngTemplateOutletContext",ee(4,Fe,r.active))}}function je(i,n){if(i&1&&(c(0,"span",9),m(1),a()),i&2){let r=p(2);s(),k(r.placeholder)}}function ze(i,n){if(i&1){let r=y();c(0,"button",14),h("click",function(t){v(r);let o=p(2);return x(o.removeClick(o.active,t))}),a()}}function Ne(i,n){if(i&1){let r=y();c(0,"div",4)(1,"span",7),h("click",function(t){v(r);let o=p();return x(o.matchClick(t))}),f(2,He,2,6,"span",8)(3,je,2,1,"span",9),f(4,ze,1,0,"button",10),_(5,"i",11),a()()}if(i&2){let r=p();s(2),g(r.active?2:3),s(2),g(r.allowClear&&r.active?4:-1)}}function Le(i,n){i&1&&D(0)}function Re(i,n){if(i&1){let r=y();c(0,"li",15)(1,"div",16),h("click",function(t){let o=v(r).$implicit,l=p(2);return x(l.selectMatch(o,t))})("mouseenter",function(){let t=v(r).$implicit,o=p(2);return x(o.selectActive(t))}),w(2,Le,1,0,"ng-container",13),a()()}if(i&2){let r=n.$implicit,e=p(2),t=F(8);s(),b("active",e.isActive(r)),s(),u("ngTemplateOutlet",e.customTemplateOptions||t)("ngTemplateOutletContext",te(4,Ve,r,e.inputValue))}}function Ie(i,n){if(i&1&&(c(0,"ul",5),K(1,Re,3,7,"li",15,$),a()),i&2){let r=p();s(),X(r.options)}}function We(i,n){if(i&1&&(c(0,"div",17)(1,"span",18),_(2,"fa-icon",19),a(),c(3,"span"),m(4),a(),c(5,"div",20),m(6),a()()),i&2){let r=n.active,e=p();s(2),u("icon",e.itemIcon)("fixedWidth",!1),s(2),k(r.name),s(2),k(r.description)}}function Ue(i,n){if(i&1&&(c(0,"a",21)(1,"div",17)(2,"span",18),_(3,"fa-icon",19),a(),_(4,"span",22),H(5,"highlight"),_(6,"span",23),H(7,"highlight"),a()()),i&2){let r=n.i,e=n.o,t=p();s(3),u("icon",t.itemIcon)("fixedWidth",!1),s(),u("innerHtml",t.sanitize(j(5,4,e.name,r)),T),s(2),u("innerHtml",t.sanitize(j(7,7,e.description,r)),T)}}var Tt=(()=>{let n=class n{constructor(){this.element=C(q),this.itemIcon=ue,this.allowClear=!0,this.placeholder="",this.idField="id",this.nameField="name",this.descriptionField="description",this.data=new O,this.selected=new O,this.removed=new O,this.typed=new O,this.opened=new O,this.options=[],this.itemObjects=[],this.inputMode=!1,this.inputValue="",this.onChange=Function.prototype,this.onTouched=Function.prototype,this.sanitizer=C(ne),this._items=[],this._optionsOpened=!1,this._disabled=!1,this._active=null,this.clickedOutside=this.clickedOutside.bind(this)}set items(e){if(!e.length){this._items=this.itemObjects=[],this.itemObjects=[];return}this._items=e.filter(t=>{if(typeof t=="string"||typeof t=="object"&&t&&t[this.nameField]&&t[this.idField])return t}),this.itemObjects=this._items.map(t=>typeof t=="string"?new S(t):new S({id:t[this.idField],name:t[this.nameField],description:t[this.descriptionField]}))}get optionsOpened(){return this._optionsOpened}set optionsOpened(e){this._optionsOpened=e,this.opened.emit(e)}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._disabled===!0&&this.hideOptions()}get active(){return this._active}set active(e){e?this._active=typeof e=="string"?e:new S({id:e[this.idField],name:e[this.nameField],description:e[this.descriptionField]}):this._active=null}sanitize(e){return this.sanitizer.bypassSecurityTrustHtml(e)}inputEvent(e,t=!1){if(e.keyCode===9)return;if(t&&(e.keyCode===37||e.keyCode===39||e.keyCode===38||e.keyCode===40||e.keyCode===13)){e.preventDefault();return}if(!t&&e.keyCode===8){let l=this.element.nativeElement.querySelector("div.ui-select-container > input");(!l.value||l.value.length<=0)&&(this.active&&this.remove(this.active),e.preventDefault())}if(!t&&e.keyCode===27){this.hideOptions(),e.preventDefault();return}if(!t&&e.keyCode===46&&(this.active&&this.remove(this.active),e.preventDefault()),!t&&e.keyCode===37&&this._items.length>0){this.behavior.first(),e.preventDefault();return}if(!t&&e.keyCode===39&&this._items.length>0){this.behavior.last(),e.preventDefault();return}if(!t&&e.keyCode===38){this.behavior.prev(),e.preventDefault();return}if(!t&&e.keyCode===40){this.behavior.next(),e.preventDefault();return}if(!t&&e.keyCode===13){(!this.active||this.active.id!==this.activeOption.id)&&(this.selectActiveMatch(),this.behavior.next()),e.preventDefault();return}let o=e.target||e.srcElement;o?(this.inputValue=o.value,this.doEvent("typed",this.inputValue||" ")):this.open()}ngOnInit(){this.subscription=this.typed.asObservable().pipe(I(200),W()).subscribe(e=>this.doSearch(e)),this.behavior=new R(this),this.doEvent("typed"," ")}ngOnDestroy(){this.subscription.unsubscribe()}remove(e){this._disabled!==!0&&(this.active=null,this.data.next(this.active),this.doEvent("removed",e),this.inputValue="",this.doEvent("typed"," "))}doEvent(e,t){this[e]&&t&&this[e].next(t),this.onTouched(),(e==="selected"||e==="removed")&&this.onChange(this.active)}clickedOutside(){this.inputMode=!1,this.optionsOpened=!1}writeValue(e){this.active=e,this.data.emit(this.active)}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}matchClick(e){this._disabled!==!0&&(this.inputMode=!this.inputMode,this.inputMode===!0&&(this.focusToInput(),this.open()))}mainClick(e){if(this.inputMode===!0||this._disabled===!0)return;if(e.keyCode===46){e.preventDefault(),this.inputEvent(e);return}if(e.keyCode===8){e.preventDefault(),this.inputEvent(e,!0);return}if(e.keyCode===9||e.keyCode===13||e.keyCode===27||e.keyCode>=37&&e.keyCode<=40){e.preventDefault();return}this.inputMode=!0;let t=String.fromCharCode(96<=e.keyCode&&e.keyCode<=105?e.keyCode-48:e.keyCode).toLowerCase();this.focusToInput(t),this.open();let o=e.target||e.srcElement;o.value=t,this.inputEvent(e)}selectActive(e){this.activeOption=e}isActive(e){return this.activeOption.id===e.id}removeClick(e,t){t.stopPropagation(),this.remove(e)}focusToInput(e=""){setTimeout(()=>{let t=this.element.nativeElement.querySelector("div.ui-select-container > input");t&&(t.focus(),t.value=e)},0)}selectMatch(e,t=void 0){t&&(t.stopPropagation(),t.preventDefault()),!(this.options.length<=0)&&(this.active=e,this.data.next(this.active),this.doEvent("selected",e),this.hideOptions(),this.focusToInput(e.name),this.element.nativeElement.querySelector(".ui-select-container").focus())}doSearch(e){this.searchFunction(e).subscribe({next:t=>{this.items=t},error:t=>{console.error(t),this.items=[]},complete:()=>this.behavior.filter()})}open(){this.options=this.itemObjects,this.options.length>0&&this.behavior.first(),this.optionsOpened=!0}hideOptions(){this.inputMode=!1,this.optionsOpened=!1}selectActiveMatch(){this.selectMatch(this.activeOption)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=M({type:n,selectors:[["app-select"]],inputs:{searchFunction:"searchFunction",customTemplateOptions:"customTemplateOptions",customTemplateSelect:"customTemplateSelect",itemIcon:"itemIcon",allowClear:"allowClear",placeholder:"placeholder",idField:"idField",nameField:"nameField",descriptionField:"descriptionField",disabled:"disabled",active:"active"},outputs:{data:"data",selected:"selected",removed:"removed",typed:"typed",opened:"opened"},features:[Y([{provide:oe,useExisting:U(()=>n),multi:!0}])],decls:9,vars:5,consts:[["DefaultSelect",""],["DefaultOptions",""],[1,"ui-select-container","dropdown","open",3,"keyup","offClick"],["autocomplete","false","tabindex","-1","type","text",1,"form-control","form-control-sm","ui-select-search",3,"disabled"],[1,"ui-select-match","form-control","form-control-sm"],["role","menu",1,"ui-select-choices","dropdown-menu"],["autocomplete","false","tabindex","-1","type","text",1,"form-control","form-control-sm","ui-select-search",3,"keydown","keyup","disabled"],["tabindex","-1",1,"ui-select-toggle","no-select",2,"outline","0",3,"click"],[1,"ui-select-match-text","w-100",3,"ui-select-allow-clear"],[1,"ui-select-placeholder"],["aria-label","close","type","button",1,"btn-close"],[1,"dropdown-toggle"],[1,"ui-select-match-text","w-100"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["aria-label","close","type","button",1,"btn-close",3,"click"],["role","menuitem"],[1,"ui-select-choices-row",3,"click","mouseenter"],[1,"d-flex","align-items-center"],[1,"ui-icon","circle-primary-icon","me-2"],[3,"icon","fixedWidth"],[1,"d-flex","ms-auto","me-4","fs-xxxs","text-muted"],["href","javascript:void(0)",1,"dropdown-item","cursor-pointer",2,"padding","3px 5px"],[3,"innerHtml"],[1,"d-flex","ms-auto","fs-xxxs","text-muted",3,"innerHtml"]],template:function(t,o){if(t&1){let l=y();c(0,"div",2),h("keyup",function(E){return v(l),x(o.mainClick(E))}),_(1,"div"),f(2,Ge,1,1,"input",3)(3,Ne,6,2,"div",4),f(4,Ie,3,0,"ul",5),a(),w(5,We,7,4,"ng-template",null,0,z)(7,Ue,8,10,"ng-template",null,1,z)}t&2&&(u("offClick",o.clickedOutside),s(),b("ui-disabled",o.disabled),s(),g(o.inputMode?2:3),s(2),g(o.optionsOpened&&o.options&&o.options.length>0?4:-1))},dependencies:[be,P,ie,ye],styles:[`.ui-select-container[_ngcontent-%COMP%]{background-color:transparent;border-radius:4px}.ui-select-container.open[_ngcontent-%COMP%] > .dropdown-menu[_ngcontent-%COMP%]{display:block}.ui-select-container.open[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{outline:none}.ui-select-container[_ngcontent-%COMP%] .ui-icon[_ngcontent-%COMP%]{min-width:26px;min-height:26px;font-size:.85rem}.ui-select-container[_ngcontent-%COMP%] .ui-disabled[_ngcontent-%COMP%]{background-color:#d4dbe8;border-radius:4px;position:absolute;width:100%;height:100%;z-index:5;opacity:.6;top:0;left:0;cursor:not-allowed}.ui-select-container[_ngcontent-%COMP%] .ui-select-search[_ngcontent-%COMP%]{line-height:26px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%]{padding-left:.3rem}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{text-align:start!important}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .caret[_ngcontent-%COMP%]{position:absolute;top:45%;right:15px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .close[_ngcontent-%COMP%]{font-size:1.6em;line-height:.75}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-toggle[_ngcontent-%COMP%]{display:flex;align-items:center}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-toggle[_ngcontent-%COMP%] > .caret[_ngcontent-%COMP%]{position:absolute;height:10px;top:50%;right:10px;margin-top:-2px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-placeholder[_ngcontent-%COMP%]{float:left;line-height:26px;color:#8c8c8c;width:100%}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .dropdown-toggle[_ngcontent-%COMP%]{cursor:pointer}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .dropdown-toggle[_ngcontent-%COMP%]:after{display:inline-block!important}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%]{width:100%;height:auto;max-height:200px;overflow-x:hidden;margin-top:0}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{display:block;padding:3px 5px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] .active[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{text-decoration:none;outline:0}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] .dropdown-item[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{pointer-events:none}
|
|
1
|
+
import{b as ye}from"./chunk-ZU5MQTFN.js";import{m as ve,n as xe,s as N,w as Oe}from"./chunk-CVXLHSO5.js";import{Cb as Ce,J as _e}from"./chunk-AALPWGPB.js";import{Aa as q,Ab as D,Ae as me,Bb as y,Bf as ge,Cd as ce,Dd as le,Eb as h,Gb as p,Gd as pe,Ha as T,J as I,Kd as de,Mc as ie,N as W,Oa as s,Od as ue,Pb as F,Qa as O,Rb as b,Sb as Z,Tb as m,Ub as k,Xb as V,Yb as G,Zb as A,ab as M,bf as he,cb as B,cc as J,cd as ne,da as U,db as Q,dd as oe,ec as Y,fb as w,fd as re,gc as ee,hc as te,ja as C,jd as se,kc as H,lb as f,mb as g,mc as j,nb as $,nf as fe,oa as v,oc as z,od as ae,pa as x,pb as K,qb as X,qg as P,rb as u,sb as c,tb as a,ub as _}from"./chunk-76M3BMK6.js";var ke=(function(i){return i[i.USER=0]="USER",i[i.PERSONAL=1]="PERSONAL",i})(ke||{}),Se=(function(i){return i[i.VISIBLE=0]="VISIBLE",i[i.PRIVATE=1]="PRIVATE",i[i.ISOLATED=2]="ISOLATED",i})(Se||{});var Xe=(()=>{let n=class n{constructor(){this.translate=C(pe)}transform(e,t=[]){let o="";if(!e)return o;for(let[l,d]of Object.entries(e).filter(([E,qe])=>t.indexOf(E)===-1))d&&(o+=`${d} ${this.translate.translate(d===1?l.slice(0,-1):l)}, `);return o.slice(0,-2)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275pipe=Q({name:"joinCounts",type:n,pure:!0});let i=n;return i})();function Me(i,n){if(i&1&&(c(0,"span"),m(1),a()),i&2){let r=p();s(),k(r.group.name)}}function we(i,n){i&1&&(c(0,"span",3),m(1,"New personal group"),a())}function Pe(i,n){if(i&1&&_(0,"fa-icon",4),i&2){let r=p();u("icon",r.icons.faSpinner)}}function Ee(i,n){i&1&&(c(0,"span",3),m(1,"Edit personal group"),a())}function Te(i,n){i&1&&(c(0,"span",3),m(1,"Edit group"),a())}function De(i,n){if(i&1&&(c(0,"h4",5),f(1,Ee,2,0,"span",3)(2,Te,2,0,"span",3),a()),i&2){let r=p();s(),g(r.isPersonalGroup?1:2)}}var mt=(()=>{let n=class n{constructor(){this.groupChange=new O,this.layout=C(Ce),this.icons={GROUPS:_e.GROUPS,faSpinner:fe,faCog:he,faUsers:me,faPen:ge},this.isPersonalGroup=!0,this.submitted=!1,this.loading=!1,this.userService=C(Oe),this.user=this.userService.user}ngOnInit(){this.originalGroup?.id?(this.isPersonalGroup=this.originalGroup.isPersonalGroup,this.group=new N({id:this.originalGroup.id,name:this.originalGroup.name,description:this.originalGroup.description,createdAt:this.originalGroup.createdAt,modifiedAt:this.originalGroup.modifiedAt,type:this.originalGroup.type})):this.group=new N({id:0,name:"",description:"",createdAt:null,modifiedAt:null,type:xe.PGROUP})}onCancel(){this.layout.closeDialog()}onSubmit(){if(this.loading=!0,this.submitted=!0,this.group.id===0)this.userService.createPersonalGroup(this.makeDto(!0)).subscribe({next:e=>{this.loading=!1,this.groupChange.emit(["add",e]),this.layout.sendNotification("success","Group created",e.name),this.layout.closeDialog()},error:e=>this.onError(e)});else{let e=this.makeDto();if(!Object.keys(e).length){this.loading=!1,this.submitted=!1;return}this.userService.updatePersonalGroup(this.originalGroup.id,this.makeDto()).subscribe({next:t=>{this.loading=!1,this.groupChange.emit(["update",t]),this.layout.sendNotification("success","Group updated",t.name),this.layout.closeDialog()},error:t=>this.onError(t)})}}makeDto(e=!1){return{name:e?this.group.name:this.group.name!==this.originalGroup.name?this.group.name:void 0,description:e?this.group.description:this.group.description!==this.originalGroup.description?this.group.description:void 0}}onError(e){this.layout.sendNotification("error","Group error",this.group.name,e),this.submitted=!1,this.loading=!1}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=M({type:n,selectors:[["app-user-group-dialog"]],inputs:{originalGroup:"originalGroup"},outputs:{groupChange:"groupChange"},decls:23,vars:15,consts:[[1,"modal-header","align-items-center"],[1,"modal-title"],[1,"me-2",3,"icon"],["l10nTranslate",""],["animation","spin","size","sm",1,"ms-2",3,"icon"],[1,"modal-title","ms-auto"],["aria-label","Close","type","button",3,"click"],[1,"modal-body"],[1,"d-flex","col-12","pb-3"],[1,"flex-fill","col-6","pe-4"],["for","name","l10nTranslate",""],["id","name","appAutofocus","","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"ngModelChange","disabled","autoSelect","ngModel"],[1,"flex-fill","col-6","ps-4"],["for","description","l10nTranslate",""],["id","description","autocomplete","off","type","text",1,"form-control","form-control-sm",3,"ngModelChange","ngModel","disabled"],[1,"modal-footer"],["data-dismiss","modal","type","button","l10nTranslate","",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click"],["type","button","l10nTranslate","",1,"btn","btn-sm","btn-primary",3,"click","disabled"]],template:function(t,o){t&1&&(c(0,"div",0)(1,"h4",1),_(2,"fa-icon",2),f(3,Me,2,1,"span")(4,we,2,0,"span",3),f(5,Pe,1,1,"fa-icon",4),a(),f(6,De,3,1,"h4",5),c(7,"button",6),h("click",function(){return o.layout.closeDialog()}),a()(),c(8,"div",7)(9,"div",8)(10,"div",9)(11,"label",10),m(12,"Name"),a(),c(13,"input",11),A("ngModelChange",function(d){return G(o.group.name,d)||(o.group.name=d),d}),a()(),c(14,"div",12)(15,"label",13),m(16,"Description"),a(),c(17,"input",14),A("ngModelChange",function(d){return G(o.group.description,d)||(o.group.description=d),d}),a()()()(),c(18,"div",15)(19,"button",16),h("click",function(){return o.onCancel()}),m(20,"Cancel"),a(),c(21,"button",17),h("click",function(){return o.onSubmit()}),m(22," Confirm "),a()()),t&2&&(s(2),u("icon",o.icons.GROUPS),s(),g(o.group.id?3:4),s(2),g(o.loading?5:-1),s(),g(o.group.id?6:-1),s(),Z(J("btn-close btn-close-white ",o.group.id?"ms-2":"ms-auto"," ms-2")),s(6),b("is-invalid",!o.group.name),u("disabled",!o.isPersonalGroup)("autoSelect",!1),V("ngModel",o.group.name),s(4),V("ngModel",o.group.description),u("disabled",!o.isPersonalGroup),s(4),u("disabled",!o.group.name||o.submitted))},dependencies:[le,re,se,ce,ae,P,de,ve],encapsulation:2});let i=n;return i})();var be=(()=>{let n=class n{onClick(e){e.stopPropagation()}ngOnInit(){setTimeout(()=>{typeof document<"u"&&document.addEventListener("click",this.offClickHandler)},0)}ngOnDestroy(){typeof document<"u"&&document.removeEventListener("click",this.offClickHandler)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275dir=B({type:n,selectors:[["","offClick",""]],hostBindings:function(t,o){t&1&&h("click",function(d){return o.onClick(d)})},inputs:{offClickHandler:[0,"offClick","offClickHandler"]}});let i=n;return i})();var S=class{constructor(n){typeof n=="string"&&(this.id=this.name=n,this.description=""),typeof n=="object"&&(this.id=n.id||n.name,this.name=n.name,this.description=n.description||"")}};var Fe=i=>({active:i}),Ve=(i,n)=>({o:i,i:n});function Ge(i,n){if(i&1){let r=y();c(0,"input",6),h("keydown",function(t){v(r);let o=p();return x(o.inputEvent(t))})("keyup",function(t){v(r);let o=p();return x(o.inputEvent(t,!0))}),a()}if(i&2){let r=p();u("disabled",r.disabled)}}function Ae(i,n){i&1&&D(0)}function He(i,n){if(i&1&&(c(0,"span",12),w(1,Ae,1,0,"ng-container",13),a()),i&2){let r=p(2),e=F(6);b("ui-select-allow-clear",r.allowClear&&r.active),s(),u("ngTemplateOutlet",r.customTemplateSelect||e)("ngTemplateOutletContext",ee(4,Fe,r.active))}}function je(i,n){if(i&1&&(c(0,"span",9),m(1),a()),i&2){let r=p(2);s(),k(r.placeholder)}}function ze(i,n){if(i&1){let r=y();c(0,"button",14),h("click",function(t){v(r);let o=p(2);return x(o.removeClick(o.active,t))}),a()}}function Ne(i,n){if(i&1){let r=y();c(0,"div",4)(1,"span",7),h("click",function(t){v(r);let o=p();return x(o.matchClick(t))}),f(2,He,2,6,"span",8)(3,je,2,1,"span",9),f(4,ze,1,0,"button",10),_(5,"i",11),a()()}if(i&2){let r=p();s(2),g(r.active?2:3),s(2),g(r.allowClear&&r.active?4:-1)}}function Le(i,n){i&1&&D(0)}function Re(i,n){if(i&1){let r=y();c(0,"li",15)(1,"div",16),h("click",function(t){let o=v(r).$implicit,l=p(2);return x(l.selectMatch(o,t))})("mouseenter",function(){let t=v(r).$implicit,o=p(2);return x(o.selectActive(t))}),w(2,Le,1,0,"ng-container",13),a()()}if(i&2){let r=n.$implicit,e=p(2),t=F(8);s(),b("active",e.isActive(r)),s(),u("ngTemplateOutlet",e.customTemplateOptions||t)("ngTemplateOutletContext",te(4,Ve,r,e.inputValue))}}function Ie(i,n){if(i&1&&(c(0,"ul",5),K(1,Re,3,7,"li",15,$),a()),i&2){let r=p();s(),X(r.options)}}function We(i,n){if(i&1&&(c(0,"div",17)(1,"span",18),_(2,"fa-icon",19),a(),c(3,"span"),m(4),a(),c(5,"div",20),m(6),a()()),i&2){let r=n.active,e=p();s(2),u("icon",e.itemIcon)("fixedWidth",!1),s(2),k(r.name),s(2),k(r.description)}}function Ue(i,n){if(i&1&&(c(0,"a",21)(1,"div",17)(2,"span",18),_(3,"fa-icon",19),a(),_(4,"span",22),H(5,"highlight"),_(6,"span",23),H(7,"highlight"),a()()),i&2){let r=n.i,e=n.o,t=p();s(3),u("icon",t.itemIcon)("fixedWidth",!1),s(),u("innerHtml",t.sanitize(j(5,4,e.name,r)),T),s(2),u("innerHtml",t.sanitize(j(7,7,e.description,r)),T)}}var Tt=(()=>{let n=class n{constructor(){this.element=C(q),this.itemIcon=ue,this.allowClear=!0,this.placeholder="",this.idField="id",this.nameField="name",this.descriptionField="description",this.data=new O,this.selected=new O,this.removed=new O,this.typed=new O,this.opened=new O,this.options=[],this.itemObjects=[],this.inputMode=!1,this.inputValue="",this.onChange=Function.prototype,this.onTouched=Function.prototype,this.sanitizer=C(ne),this._items=[],this._optionsOpened=!1,this._disabled=!1,this._active=null,this.clickedOutside=this.clickedOutside.bind(this)}set items(e){if(!e.length){this._items=this.itemObjects=[],this.itemObjects=[];return}this._items=e.filter(t=>{if(typeof t=="string"||typeof t=="object"&&t&&t[this.nameField]&&t[this.idField])return t}),this.itemObjects=this._items.map(t=>typeof t=="string"?new S(t):new S({id:t[this.idField],name:t[this.nameField],description:t[this.descriptionField]}))}get optionsOpened(){return this._optionsOpened}set optionsOpened(e){this._optionsOpened=e,this.opened.emit(e)}get disabled(){return this._disabled}set disabled(e){this._disabled=e,this._disabled===!0&&this.hideOptions()}get active(){return this._active}set active(e){e?this._active=typeof e=="string"?e:new S({id:e[this.idField],name:e[this.nameField],description:e[this.descriptionField]}):this._active=null}sanitize(e){return this.sanitizer.bypassSecurityTrustHtml(e)}inputEvent(e,t=!1){if(e.keyCode===9)return;if(t&&(e.keyCode===37||e.keyCode===39||e.keyCode===38||e.keyCode===40||e.keyCode===13)){e.preventDefault();return}if(!t&&e.keyCode===8){let l=this.element.nativeElement.querySelector("div.ui-select-container > input");(!l.value||l.value.length<=0)&&(this.active&&this.remove(this.active),e.preventDefault())}if(!t&&e.keyCode===27){this.hideOptions(),e.preventDefault();return}if(!t&&e.keyCode===46&&(this.active&&this.remove(this.active),e.preventDefault()),!t&&e.keyCode===37&&this._items.length>0){this.behavior.first(),e.preventDefault();return}if(!t&&e.keyCode===39&&this._items.length>0){this.behavior.last(),e.preventDefault();return}if(!t&&e.keyCode===38){this.behavior.prev(),e.preventDefault();return}if(!t&&e.keyCode===40){this.behavior.next(),e.preventDefault();return}if(!t&&e.keyCode===13){(!this.active||this.active.id!==this.activeOption.id)&&(this.selectActiveMatch(),this.behavior.next()),e.preventDefault();return}let o=e.target||e.srcElement;o?(this.inputValue=o.value,this.doEvent("typed",this.inputValue||" ")):this.open()}ngOnInit(){this.subscription=this.typed.asObservable().pipe(I(200),W()).subscribe(e=>this.doSearch(e)),this.behavior=new R(this),this.doEvent("typed"," ")}ngOnDestroy(){this.subscription.unsubscribe()}remove(e){this._disabled!==!0&&(this.active=null,this.data.next(this.active),this.doEvent("removed",e),this.inputValue="",this.doEvent("typed"," "))}doEvent(e,t){this[e]&&t&&this[e].next(t),this.onTouched(),(e==="selected"||e==="removed")&&this.onChange(this.active)}clickedOutside(){this.inputMode=!1,this.optionsOpened=!1}writeValue(e){this.active=e,this.data.emit(this.active)}registerOnChange(e){this.onChange=e}registerOnTouched(e){this.onTouched=e}matchClick(e){this._disabled!==!0&&(this.inputMode=!this.inputMode,this.inputMode===!0&&(this.focusToInput(),this.open()))}mainClick(e){if(this.inputMode===!0||this._disabled===!0)return;if(e.keyCode===46){e.preventDefault(),this.inputEvent(e);return}if(e.keyCode===8){e.preventDefault(),this.inputEvent(e,!0);return}if(e.keyCode===9||e.keyCode===13||e.keyCode===27||e.keyCode>=37&&e.keyCode<=40){e.preventDefault();return}this.inputMode=!0;let t=String.fromCharCode(96<=e.keyCode&&e.keyCode<=105?e.keyCode-48:e.keyCode).toLowerCase();this.focusToInput(t),this.open();let o=e.target||e.srcElement;o.value=t,this.inputEvent(e)}selectActive(e){this.activeOption=e}isActive(e){return this.activeOption.id===e.id}removeClick(e,t){t.stopPropagation(),this.remove(e)}focusToInput(e=""){setTimeout(()=>{let t=this.element.nativeElement.querySelector("div.ui-select-container > input");t&&(t.focus(),t.value=e)},0)}selectMatch(e,t=void 0){t&&(t.stopPropagation(),t.preventDefault()),!(this.options.length<=0)&&(this.active=e,this.data.next(this.active),this.doEvent("selected",e),this.hideOptions(),this.focusToInput(e.name),this.element.nativeElement.querySelector(".ui-select-container").focus())}doSearch(e){this.searchFunction(e).subscribe({next:t=>{this.items=t},error:t=>{console.error(t),this.items=[]},complete:()=>this.behavior.filter()})}open(){this.options=this.itemObjects,this.options.length>0&&this.behavior.first(),this.optionsOpened=!0}hideOptions(){this.inputMode=!1,this.optionsOpened=!1}selectActiveMatch(){this.selectMatch(this.activeOption)}};n.\u0275fac=function(t){return new(t||n)},n.\u0275cmp=M({type:n,selectors:[["app-select"]],inputs:{searchFunction:"searchFunction",customTemplateOptions:"customTemplateOptions",customTemplateSelect:"customTemplateSelect",itemIcon:"itemIcon",allowClear:"allowClear",placeholder:"placeholder",idField:"idField",nameField:"nameField",descriptionField:"descriptionField",disabled:"disabled",active:"active"},outputs:{data:"data",selected:"selected",removed:"removed",typed:"typed",opened:"opened"},features:[Y([{provide:oe,useExisting:U(()=>n),multi:!0}])],decls:9,vars:5,consts:[["DefaultSelect",""],["DefaultOptions",""],[1,"ui-select-container","dropdown","open",3,"keyup","offClick"],["autocomplete","false","tabindex","-1","type","text",1,"form-control","form-control-sm","ui-select-search",3,"disabled"],[1,"ui-select-match","form-control","form-control-sm"],["role","menu",1,"ui-select-choices","dropdown-menu"],["autocomplete","false","tabindex","-1","type","text",1,"form-control","form-control-sm","ui-select-search",3,"keydown","keyup","disabled"],["tabindex","-1",1,"ui-select-toggle","no-select",2,"outline","0",3,"click"],[1,"ui-select-match-text","w-100",3,"ui-select-allow-clear"],[1,"ui-select-placeholder"],["aria-label","close","type","button",1,"btn-close"],[1,"dropdown-toggle"],[1,"ui-select-match-text","w-100"],[4,"ngTemplateOutlet","ngTemplateOutletContext"],["aria-label","close","type","button",1,"btn-close",3,"click"],["role","menuitem"],[1,"ui-select-choices-row",3,"click","mouseenter"],[1,"d-flex","align-items-center"],[1,"ui-icon","circle-primary-icon","me-2"],[3,"icon","fixedWidth"],[1,"d-flex","ms-auto","me-4","fs-xxxs","text-muted"],["href","javascript:void(0)",1,"dropdown-item","cursor-pointer",2,"padding","3px 5px"],[3,"innerHtml"],[1,"d-flex","ms-auto","fs-xxxs","text-muted",3,"innerHtml"]],template:function(t,o){if(t&1){let l=y();c(0,"div",2),h("keyup",function(E){return v(l),x(o.mainClick(E))}),_(1,"div"),f(2,Ge,1,1,"input",3)(3,Ne,6,2,"div",4),f(4,Ie,3,0,"ul",5),a(),w(5,We,7,4,"ng-template",null,0,z)(7,Ue,8,10,"ng-template",null,1,z)}t&2&&(u("offClick",o.clickedOutside),s(),b("ui-disabled",o.disabled),s(),g(o.inputMode?2:3),s(2),g(o.optionsOpened&&o.options&&o.options.length>0?4:-1))},dependencies:[be,P,ie,ye],styles:[`.ui-select-container[_ngcontent-%COMP%]{background-color:transparent;border-radius:4px}.ui-select-container.open[_ngcontent-%COMP%] > .dropdown-menu[_ngcontent-%COMP%]{display:block}.ui-select-container.open[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{outline:none}.ui-select-container[_ngcontent-%COMP%] .ui-icon[_ngcontent-%COMP%]{min-width:26px;min-height:26px;font-size:.85rem}.ui-select-container[_ngcontent-%COMP%] .ui-disabled[_ngcontent-%COMP%]{background-color:#d4dbe8;border-radius:4px;position:absolute;width:100%;height:100%;z-index:5;opacity:.6;top:0;left:0;cursor:not-allowed}.ui-select-container[_ngcontent-%COMP%] .ui-select-search[_ngcontent-%COMP%]{line-height:26px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%]{padding-left:.3rem}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .btn[_ngcontent-%COMP%]{text-align:start!important}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .caret[_ngcontent-%COMP%]{position:absolute;top:45%;right:15px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .close[_ngcontent-%COMP%]{font-size:1.6em;line-height:.75}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-toggle[_ngcontent-%COMP%]{display:flex;align-items:center}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-toggle[_ngcontent-%COMP%] > .caret[_ngcontent-%COMP%]{position:absolute;height:10px;top:50%;right:10px;margin-top:-2px}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .ui-select-placeholder[_ngcontent-%COMP%]{float:left;line-height:26px;color:#8c8c8c;width:100%}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .dropdown-toggle[_ngcontent-%COMP%]{cursor:pointer}.ui-select-container[_ngcontent-%COMP%] .ui-select-match[_ngcontent-%COMP%] .dropdown-toggle[_ngcontent-%COMP%]:after{display:inline-block!important}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%]{width:100%;height:auto;max-height:200px;overflow-x:hidden;margin-top:0}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{display:block;padding:3px 5px;clear:both;font-weight:400;line-height:1.42857143;color:#333;white-space:nowrap}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] .active[_ngcontent-%COMP%] > a[_ngcontent-%COMP%]{text-decoration:none;outline:0}.ui-select-container[_ngcontent-%COMP%] .ui-select-choices[_ngcontent-%COMP%] .ui-select-choices-row[_ngcontent-%COMP%] .dropdown-item[_ngcontent-%COMP%] > div[_ngcontent-%COMP%]{pointer-events:none}
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Oa as n,Qb as s,ab as l,vb as d,wb as h,xa as c,xb as g}from"./chunk-
|
|
1
|
+
import{Oa as n,Qb as s,ab as l,vb as d,wb as h,xa as c,xb as g}from"./chunk-76M3BMK6.js";var M=(()=>{let r=class r{constructor(){this.passwordToCheck="",this.bar0="",this.bar1="",this.bar2="",this.bar3="",this.bar4="",this.colors=["#F00","#F90","#FF0","#7ACC00","#06854B"]}static measureStrength(e){let t=0,o=/[$-/:-?{-~!"^_`[\]]/g,p=/[a-z]+/.test(e),m=/[A-Z]+/.test(e),u=/[0-9]+/.test(e),b=o.test(e),f=[p,m,u,b],a=0;for(let C of f)a+=C===!0?1:0;return t+=2*e.length+(e.length>=10?1:0),t+=a*10,t=e.length<=6?Math.min(t,10):t,t=a===1?Math.min(t,10):t,t=a===2?Math.min(t,20):t,t=a===3?Math.min(t,40):t,t}ngOnChanges(e){let t=e.passwordToCheck.currentValue;if(this.setBarColors(5,"#DDD"),t){let o=this.getColor(r.measureStrength(t));this.setBarColors(o.idx,o.col)}}getColor(e){let t=Math.min(Math.floor((e-1)/10),4);return{idx:t+1,col:this.colors[t]}}setBarColors(e,t){for(let o=0;o<e;o++)this[`bar${o}`]=t}};r.\u0275fac=function(t){return new(t||r)},r.\u0275cmp=l({type:r,selectors:[["app-password-strength-bar"]],inputs:{passwordToCheck:"passwordToCheck"},features:[c],decls:8,vars:10,consts:[["strength",""],["id","strength"],["id","strengthBar"],[1,"point"]],template:function(t,o){t&1&&(d(0,"div",1,0)(2,"ul",2),g(3,"li",3)(4,"li",3)(5,"li",3)(6,"li",3)(7,"li",3),h()()),t&2&&(n(3),s("background-color",o.bar0),n(),s("background-color",o.bar1),n(),s("background-color",o.bar2),n(),s("background-color",o.bar3),n(),s("background-color",o.bar4))},styles:["ul#strengthBar[_ngcontent-%COMP%]{display:flex;list-style:none;padding:0;align-self:center;margin-bottom:-2px}.point[_ngcontent-%COMP%]:last-child{margin:0!important}.point[_ngcontent-%COMP%]{background:#ddd;border-radius:2px;height:6px;margin-right:1px;width:20px}"],changeDetection:0});let i=r;return i})();export{M as a};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as M,b as R}from"./chunk-
|
|
1
|
+
import{a as M,b as R}from"./chunk-2GXOVGTD.js";import"./chunk-3ZBAQTHJ.js";import{f as I,h as W}from"./chunk-XSURUW7C.js";import"./chunk-RTNEBRKJ.js";import{Cb as O,pb as N,qb as y,rb as d,s as b,xb as u,zb as A}from"./chunk-AALPWGPB.js";import{d as w}from"./chunk-3MVPXC3U.js";import{Eb as x,Gb as m,Ia as C,Kd as z,Oa as o,Sb as T,Tb as a,Ub as p,ab as E,cc as g,ja as v,lb as S,mb as h,qg as D,rb as s,sb as i,tb as n,ub as l}from"./chunk-76M3BMK6.js";import"./chunk-DM4NXKEP.js";import"./chunk-ZIJQRARU.js";import{i as P}from"./chunk-KAVP6UXH.js";function L(e,r){if(e&1&&l(0,"fa-icon",24),e&2){let t=m();T(g("circle-",t.syncService.wizard.remotePath.iconClass,"-icon")),s("icon",t.syncService.wizard.remotePath.icon)}}function Y(e,r){if(e&1&&l(0,"img",7),e&2){let t=m();s("src",t.syncService.wizard.remotePath.mimeUrl,C)}}function k(e,r){if(e&1&&(i(0,"div",18),a(1),n()),e&2){let t=m();o(),p(t.error)}}function B(e,r){e&1&&(i(0,"span",26),a(1,"and from"),n())}function F(e,r){e&1&&(i(0,"span",28),a(1,"to"),n())}function Z(e,r){e&1&&(i(0,"span",26),a(1,"(Two-Way)"),n())}function U(e,r){e&1&&(i(0,"span",26),a(1,"(One-Way)"),n())}function V(e,r){e&1&&(i(0,"span",28),a(1,"the most recent files will be kept"),n())}function $(e,r){if(e&1&&(i(0,"span",26),a(1,"the files in"),n(),i(2,"span",29),a(3),n(),i(4,"span",26),a(5,"will be preferred"),n()),e&2){let t=m(3);o(3),p(t.syncPath.settings.conflictMode===t.SYNC_PATH_CONFLICT_MODE.LOCAL?t.syncService.wizard.localPath.name:t.syncService.wizard.remotePath.name)}}function j(e,r){if(e&1&&(i(0,"div")(1,"span",26),a(2,"In case of conflict,"),n(),i(3,"span"),a(4,"\xA0"),n(),S(5,V,2,0,"span",28)(6,$,6,1),n()),e&2){let t=m(2);o(5),h(t.syncPath.settings.conflictMode===t.SYNC_PATH_CONFLICT_MODE.RECENT?5:6)}}function G(e,r){if(e&1&&(i(0,"div")(1,"span",26),a(2,"All files created or modified in"),n(),i(3,"span",30),a(4),n(),i(5,"span",26),a(6,"will be ignored and deleted"),n()()),e&2){let t=m(2);o(4),p(t.syncPath.settings.mode===t.SYNC_PATH_MODE.DOWNLOAD?t.syncService.wizard.localPath.name:t.syncService.wizard.remotePath.name)}}function q(e,r){if(e&1&&(i(0,"div",25)(1,"span",26),a(2,"The data will be synchronized from"),n(),i(3,"span",27),a(4),n(),S(5,B,2,0,"span",26)(6,F,2,0,"span",28),i(7,"span",27),a(8),n(),S(9,Z,2,0,"span",26)(10,U,2,0,"span",26),n(),l(11,"br"),i(12,"div",25),S(13,j,7,1,"div")(14,G,7,1,"div"),n()),e&2){let t=m();o(4),p(t.syncPath.settings.mode===t.SYNC_PATH_MODE.DOWNLOAD?"the server folder":"the client folder"),o(),h(t.syncPath.settings.mode===t.SYNC_PATH_MODE.BOTH?5:6),o(3),p(t.syncPath.settings.mode===t.SYNC_PATH_MODE.DOWNLOAD?"the client folder":"the server folder"),o(),h(t.syncPath.settings.mode===t.SYNC_PATH_MODE.BOTH?9:10),o(4),h(t.syncPath.settings.mode===t.SYNC_PATH_MODE.BOTH?13:14)}}var de=(()=>{let r=class r{constructor(){this.syncService=v(W),this.SYNC_PATH_CONFLICT_MODE=A,this.SYNC_PATH_MODE=u,this.icons={CLIENT:y.CLIENT,SERVER:y.SERVER},this.translatedRemotePath=this.syncService.translateServerPath(this.syncService.wizard.remotePath.serverPath),this.error=null,this.router=v(w),this.layout=v(O),this.syncPath=new I({settings:{name:this.syncService.wizard.localPath.name,localPath:this.syncService.wizard.localPath.path,remotePath:this.syncService.wizard.remotePath.serverPath,enabled:this.syncService.wizard.settings.enabled,mode:this.syncService.wizard.remotePath.isWriteable?this.syncService.wizard.settings.mode:u.DOWNLOAD,conflictMode:this.syncService.wizard.settings.conflictMode,diffMode:this.syncService.wizard.settings.diffMode,scheduler:this.syncService.wizard.settings.scheduler,permissions:this.syncService.wizard.remotePath.permissions}}),this.layout.setBreadcrumbIcon(y.WIZARD),this.layout.setBreadcrumbNav({url:`/${d.BASE}/${d.WIZARD}/${d.WIZARD_SETTINGS}/${N.WIZARD_SETTINGS}`,splicing:3,translating:!0,sameLink:!0})}onPrevious(){this.router.navigate([d.BASE,d.WIZARD,d.WIZARD_SERVER]).catch(console.error)}onSubmit(){return P(this,null,function*(){let _=yield this.syncService.addPath(this.syncPath.settings);typeof _=="string"?this.error=_:(yield this.syncService.refreshPaths(),this.router.navigate([d.BASE,d.PATHS],{state:{id:_.id,withSettings:!1}}).catch(console.error),this.syncService.resetWizard())})}};r.\u0275fac=function(f){return new(f||r)},r.\u0275cmp=E({type:r,selectors:[["app-sync-wizard-settings"]],decls:38,vars:12,consts:[[1,"wizard","fs-sm"],[1,"d-flex","flex-row","justify-content-center","mb-3"],[1,"d-flex","flex-column","align-items-end"],[1,"fw-bold","mb-1","me-1"],[3,"icon"],["l10nTranslate","",1,"ms-2"],["placement","left",1,"cursor-pointer",3,"tooltip"],["alt","","height","35",3,"src"],[1,"position-absolute","text-truncate","pe-2",2,"top","110px"],[1,"d-flex","align-items-end","mb-2","mx-5"],[3,"syncPath"],[1,"d-flex","flex-column","align-items-start"],[1,"fw-bold","mb-1","ms-1"],["placement","right",1,"cursor-pointer",3,"tooltip"],[2,"width","32px","height","32px","font-size","16px",3,"icon","class"],[1,"position-absolute","text-truncate","ps-2",2,"top","110px"],[1,"mt-auto"],[1,"mb-auto"],["l10nTranslate","",1,"text-center","text-warning"],[1,"d-flex","align-items-start"],["translate","","type","button",1,"btn","btn-sm","btn-secondary","me-auto",3,"click"],[1,"fas","fa-arrow-circle-left","fa-fw"],["translate","","type","button",1,"btn","btn-sm","btn-secondary","ms-auto",3,"click","disabled"],[1,"fas","fa-check-circle","fa-fw"],[2,"width","32px","height","32px","font-size","16px",3,"icon"],[1,"text-center"],["l10nTranslate",""],["l10nTranslate","",1,"mx-1"],["l10nTranslate","",1,"fw-bold"],[1,"fw-bold","mx-1"],["l10nTranslate","",1,"fw-bold","mx-1"]],template:function(f,c){f&1&&(i(0,"div",0)(1,"div",1)(2,"div",2)(3,"div",2)(4,"div",3),l(5,"fa-icon",4),i(6,"span",5),a(7,"Client"),n()(),i(8,"div",6),l(9,"img",7),n(),i(10,"div",8),a(11),n()()(),i(12,"div",9),l(13,"app-sync-path-direction-icon",10),n(),i(14,"div",11)(15,"div",11)(16,"div",12),l(17,"fa-icon",4),i(18,"span",5),a(19,"Server"),n()(),i(20,"div",13),S(21,L,1,4,"fa-icon",14)(22,Y,1,1,"img",7),n(),i(23,"div",15),a(24),n()()()(),l(25,"hr",16)(26,"app-sync-path-settings",10)(27,"hr",17),S(28,k,2,1,"div",18)(29,q,15,5),i(30,"div",16)(31,"div",19)(32,"button",20),x("click",function(){return c.onPrevious()}),l(33,"i",21),a(34," Previous "),n(),i(35,"button",22),x("click",function(){return c.onSubmit()}),l(36,"i",23),a(37," Done "),n()()()()),f&2&&(o(5),s("icon",c.icons.CLIENT),o(3),s("tooltip",c.syncService.wizard.localPath.path),o(),s("src",c.syncService.wizard.localPath.mimeUrl,C),o(2),p(c.syncService.wizard.localPath.name),o(2),s("syncPath",c.syncPath),o(4),s("icon",c.icons.SERVER),o(3),s("tooltip",c.translatedRemotePath),o(),h(c.syncService.wizard.remotePath.icon?21:22),o(3),p(c.syncService.wizard.remotePath.name),o(2),s("syncPath",c.syncPath),o(2),h(c.error?28:29),o(7),s("disabled",!c.syncPath.settings.name))},dependencies:[z,D,b,M,R],encapsulation:2});let e=r;return e})();export{de as SyncWizardSettingsComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Cb as h}from"./chunk-
|
|
1
|
+
import{Cb as h}from"./chunk-AALPWGPB.js";import{Aa as o,Wa as n,Y as r,cb as l,ja as t}from"./chunk-76M3BMK6.js";var m=".selected",c="drag-over";var x=(()=>{let e=class e{constructor(){this.overFlowX="hidden",this.resizeOffset=80,this.useMaxHeight=!0,this.elementRef=t(o),this.renderer=t(n),this.layout=t(h),this.renderer.setStyle(this.elementRef.nativeElement,"overflow-y","auto"),this.renderer.setStyle(this.elementRef.nativeElement,"scrollbar-width","thin"),this.resizeSubscription=this.layout.resizeEvent.pipe(r(1)).subscribe(()=>this.onResize())}ngAfterViewInit(){this.renderer.setStyle(this.elementRef.nativeElement,"overflow-x",this.overFlowX),this.onResize()}ngOnDestroy(){this.resizeSubscription.unsubscribe()}scrollTop(){this.renderer.setProperty(this.elementRef.nativeElement,"scrollTop","0")}scrollIntoView(s=0){setTimeout(()=>this.elementRef.nativeElement.scrollTo({left:0,top:s,behavior:"smooth"}),50)}onResize(){this.renderer.setStyle(this.elementRef.nativeElement,this.useMaxHeight?"max-height":"height",`${window.innerHeight-this.resizeOffset-1}px`)}};e.\u0275fac=function(f){return new(f||e)},e.\u0275dir=l({type:e,selectors:[["","appAutoResize",""]],inputs:{overFlowX:"overFlowX",resizeOffset:"resizeOffset",useMaxHeight:"useMaxHeight"}});let i=e;return i})();export{m as a,c as b,x as c};
|