mirror of
https://github.com/nextcloud/server.git
synced 2026-10-20 07:19:44 +02:00
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
4 lines
28 KiB
JavaScript
4 lines
28 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('', '', 'dist/SetStatusModal-Ccv1117Z.chunk.mjs'),window.OC.filePath('', '', 'dist/index-UXL_i2di.chunk.mjs'),window.OC.filePath('', '', 'dist/star-outline-BpDZzOb8.chunk.mjs'),window.OC.filePath('', '', 'dist/AlertCircleOutline-jA3ki2Uu.chunk.mjs'),window.OC.filePath('', '', 'dist/TrayArrowDown-vMg8Cl05.chunk.mjs'),window.OC.filePath('', '', 'dist/PencilOutline-C4ZkKkas.chunk.mjs'),window.OC.filePath('', '', 'dist/translations-pLZlvQeM.chunk.mjs'),window.OC.filePath('', '', 'dist/Web-BMG0zIln.chunk.mjs'),window.OC.filePath('', '', 'dist/_l10n-CK24vgHE.chunk.mjs'),window.OC.filePath('', '', 'dist/File-xDTWu8L0.chunk.mjs'),window.OC.filePath('', '', 'dist/Link-CUdpEe-t.chunk.mjs'),window.OC.filePath('', '', 'dist/formatRelative-uuSCBZ1C.chunk.mjs'),window.OC.filePath('', '', 'dist/common-Link-3plNpBrB.chunk.css'),window.OC.filePath('', '', 'dist/ArrowRight-COu6qSN5.chunk.mjs'),window.OC.filePath('', '', 'dist/common-ArrowRight-C_oBIsvc.chunk.css'),window.OC.filePath('', '', 'dist/Check-CEU1oy_I.chunk.mjs'),window.OC.filePath('', '', 'dist/common-Check-BYHcrfvW.chunk.css'),window.OC.filePath('', '', 'dist/NcModal-BxLzaUZK.chunk.mjs'),window.OC.filePath('', '', 'dist/MapMarkerOutline-Ip3bQdll.chunk.mjs'),window.OC.filePath('', '', 'dist/livePhotoUtils-CVUhgL4S.chunk.mjs'),window.OC.filePath('', '', 'dist/index-D6fZh9CR.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcModal-Cclh_O_-.chunk.css'),window.OC.filePath('', '', 'dist/common-AlertCircleOutline-B7Bbzm8f.chunk.css'),window.OC.filePath('', '', 'dist/cancel-DDzvQ-HX.chunk.mjs'),window.OC.filePath('', '', 'dist/common-cancel-BWNFKLbC.chunk.css'),window.OC.filePath('', '', 'dist/index-BJ-wBpMs.chunk.mjs'),window.OC.filePath('', '', 'dist/NcHighlight.vue_vue_type_script_lang-CT7Xx-zK.chunk.mjs'),window.OC.filePath('', '', 'dist/NcInputField-wKF2DDSn.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcInputField-B5YBBomo.chunk.css'),window.OC.filePath('', '', 'dist/common-index-CRfKBhKV.chunk.css'),window.OC.filePath('', '', 'dist/NcEmojiPicker-D7HkUvA6.chunk.mjs'),window.OC.filePath('', '', 'dist/emoji-Cbe4MxhY.chunk.mjs'),window.OC.filePath('', '', 'dist/index-JFK8X6kZ.chunk.mjs'),window.OC.filePath('', '', 'dist/colors-B1T-jIOW.chunk.mjs'),window.OC.filePath('', '', 'dist/common-index-bfXBK-tQ.chunk.css'),window.OC.filePath('', '', 'dist/common-NcEmojiPicker-ChsL0oK6.chunk.css'),window.OC.filePath('', '', 'dist/NcUserStatusIcon-CWV4DI9J.chunk.mjs'),window.OC.filePath('', '', 'dist/index-DHyMMYTN.chunk.mjs'),window.OC.filePath('', '', 'dist/common-NcUserStatusIcon-Bq_6hmXG.chunk.css'),window.OC.filePath('', '', 'dist/statusOptionsService-ChGCgh7H.chunk.mjs'),window.OC.filePath('', '', 'dist/common-statusOptionsService-BEbvWlY3.chunk.css'),window.OC.filePath('', '', 'dist/user_status-SetStatusModal-FTEE4Jmr.chunk.css')])))=>i.map(i=>d[i]);
|
|
import{u as ft,s as K,e as I}from"./index-D6fZh9CR.chunk.mjs";import{ai as ht,V as gt,C as X,i as _t,j as M,o as O,f as F,k as N,w as E,p as C,n as j,y as G,z as yt,t as vt,h as bt,G as St,d as wt,a as Y}from"./PencilOutline-C4ZkKkas.chunk.mjs";import{d as g,c as It,_ as Mt,l as Ot}from"./star-outline-BpDZzOb8.chunk.mjs";import{g as kt,f as At,a as v}from"./livePhotoUtils-CVUhgL4S.chunk.mjs";import{N as Et}from"./Link-CUdpEe-t.chunk.mjs";import{N as Ct}from"./statusOptionsService-ChGCgh7H.chunk.mjs";import{N as jt}from"./NcUserStatusIcon-CWV4DI9J.chunk.mjs";import{b as Tt}from"./index-UXL_i2di.chunk.mjs";import{t as h}from"./translations-pLZlvQeM.chunk.mjs";import{d as Pt}from"./File-xDTWu8L0.chunk.mjs";import{c as _}from"./index-DHyMMYTN.chunk.mjs";import{f as $,g as xt}from"./NcModal-BxLzaUZK.chunk.mjs";import"./formatRelative-uuSCBZ1C.chunk.mjs";import"./_l10n-CK24vgHE.chunk.mjs";import"./MapMarkerOutline-Ip3bQdll.chunk.mjs";import"./AlertCircleOutline-jA3ki2Uu.chunk.mjs";import"./TrayArrowDown-vMg8Cl05.chunk.mjs";import"./Web-BMG0zIln.chunk.mjs";import"./ArrowRight-COu6qSN5.chunk.mjs";import"./Check-CEU1oy_I.chunk.mjs";import"./cancel-DDzvQ-HX.chunk.mjs";const q=kt().detectLogLevel().setApp("user_status").build();function Dt(){return Z().__VUE_DEVTOOLS_GLOBAL_HOOK__}function Z(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const Lt=typeof Proxy=="function",Ut="devtools-plugin:setup",Ft="plugin:settings:set";let w,x;function Nt(){var t;return w!==void 0||(typeof window<"u"&&window.performance?(w=!0,x=window.performance):typeof globalThis<"u"&&!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance?(w=!0,x=globalThis.perf_hooks.performance):w=!1),w}function Gt(){return Nt()?x.now():Date.now()}class $t{constructor(e,s){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=s;const a={};if(e.settings)for(const r in e.settings){const i=e.settings[r];a[r]=i.defaultValue}const n=`__vue-devtools-plugin-settings__${e.id}`;let o=Object.assign({},a);try{const r=localStorage.getItem(n),i=JSON.parse(r);Object.assign(o,i)}catch{}this.fallbacks={getSettings(){return o},setSettings(r){try{localStorage.setItem(n,JSON.stringify(r))}catch{}o=r},now(){return Gt()}},s&&s.on(Ft,(r,i)=>{r===this.plugin.id&&this.fallbacks.setSettings(i)}),this.proxiedOn=new Proxy({},{get:(r,i)=>this.target?this.target.on[i]:(...u)=>{this.onQueue.push({method:i,args:u})}}),this.proxiedTarget=new Proxy({},{get:(r,i)=>this.target?this.target[i]:i==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(i)?(...u)=>(this.targetQueue.push({method:i,args:u,resolve:()=>{}}),this.fallbacks[i](...u)):(...u)=>new Promise(c=>{this.targetQueue.push({method:i,args:u,resolve:c})})})}async setRealTarget(e){this.target=e;for(const s of this.onQueue)this.target.on[s.method](...s.args);for(const s of this.targetQueue)s.resolve(await this.target[s.method](...s.args))}}function Vt(t,e){const s=t,a=Z(),n=Dt(),o=Lt&&s.enableEarlyProxy;if(n&&(a.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!o))n.emit(Ut,t,e);else{const r=o?new $t(s,n):null;(a.__VUE_DEVTOOLS_PLUGINS__=a.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:s,setupFn:e,proxy:r}),r&&e(r.proxiedTarget)}}var Bt="store";function S(t,e){Object.keys(t).forEach(function(s){return e(t[s],s)})}function tt(t){return t!==null&&typeof t=="object"}function Ht(t){return t&&typeof t.then=="function"}function Qt(t,e){return function(){return t(e)}}function V(t,e,s){return e.indexOf(t)<0&&(s&&s.prepend?e.unshift(t):e.push(t)),function(){var a=e.indexOf(t);a>-1&&e.splice(a,1)}}function B(t,e){t._actions=Object.create(null),t._mutations=Object.create(null),t._wrappedGetters=Object.create(null),t._modulesNamespaceMap=Object.create(null);var s=t.state;A(t,s,[],t._modules.root,!0),L(t,s,e)}function L(t,e,s){var a=t._state,n=t._scope;t.getters={},t._makeLocalGettersCache=Object.create(null);var o=t._wrappedGetters,r={},i={},u=ht(!0);u.run(function(){S(o,function(c,l){r[l]=Qt(c,t),i[l]=_t(function(){return r[l]()}),Object.defineProperty(t.getters,l,{get:function(){return i[l].value},enumerable:!0})})}),t._state=gt({data:e}),t._scope=u,t.strict&&Kt(t),a&&s&&t._withCommit(function(){a.data=null}),n&&n.stop()}function A(t,e,s,a,n){var o=!s.length,r=t._modules.getNamespace(s);if(a.namespaced&&(t._modulesNamespaceMap[r],t._modulesNamespaceMap[r]=a),!o&&!n){var i=U(e,s.slice(0,-1)),u=s[s.length-1];t._withCommit(function(){i[u]=a.state})}var c=a.context=Rt(t,r,s);a.forEachMutation(function(l,d){var p=r+d;Wt(t,p,l,c)}),a.forEachAction(function(l,d){var p=l.root?d:r+d,mt=l.handler||l;Jt(t,p,mt,c)}),a.forEachGetter(function(l,d){var p=r+d;zt(t,p,l,c)}),a.forEachChild(function(l,d){A(t,e,s.concat(d),l,n)})}function Rt(t,e,s){var a=e==="",n={dispatch:a?t.dispatch:function(o,r,i){var u=k(o,r,i),c=u.payload,l=u.options,d=u.type;return(!l||!l.root)&&(d=e+d),t.dispatch(d,c)},commit:a?t.commit:function(o,r,i){var u=k(o,r,i),c=u.payload,l=u.options,d=u.type;(!l||!l.root)&&(d=e+d),t.commit(d,c,l)}};return Object.defineProperties(n,{getters:{get:a?function(){return t.getters}:function(){return et(t,e)}},state:{get:function(){return U(t.state,s)}}}),n}function et(t,e){if(!t._makeLocalGettersCache[e]){var s={},a=e.length;Object.keys(t.getters).forEach(function(n){if(n.slice(0,a)===e){var o=n.slice(a);Object.defineProperty(s,o,{get:function(){return t.getters[n]},enumerable:!0})}}),t._makeLocalGettersCache[e]=s}return t._makeLocalGettersCache[e]}function Wt(t,e,s,a){var n=t._mutations[e]||(t._mutations[e]=[]);n.push(function(o){s.call(t,a.state,o)})}function Jt(t,e,s,a){var n=t._actions[e]||(t._actions[e]=[]);n.push(function(o){var r=s.call(t,{dispatch:a.dispatch,commit:a.commit,getters:a.getters,state:a.state,rootGetters:t.getters,rootState:t.state},o);return Ht(r)||(r=Promise.resolve(r)),t._devtoolHook?r.catch(function(i){throw t._devtoolHook.emit("vuex:error",i),i}):r})}function zt(t,e,s,a){t._wrappedGetters[e]||(t._wrappedGetters[e]=function(n){return s(a.state,a.getters,n.state,n.getters)})}function Kt(t){X(function(){return t._state.data},function(){},{deep:!0,flush:"sync"})}function U(t,e){return e.reduce(function(s,a){return s[a]},t)}function k(t,e,s){return tt(t)&&t.type&&(s=e,e=t,t=t.type),{type:t,payload:e,options:s}}var Xt="vuex bindings",H="vuex:mutations",T="vuex:actions",b="vuex",Yt=0;function qt(t,e){Vt({id:"org.vuejs.vuex",app:t,label:"Vuex",homepage:"https://next.vuex.vuejs.org/",logo:"https://vuejs.org/images/icons/favicon-96x96.png",packageName:"vuex",componentStateTypes:[Xt]},function(s){s.addTimelineLayer({id:H,label:"Vuex Mutations",color:Q}),s.addTimelineLayer({id:T,label:"Vuex Actions",color:Q}),s.addInspector({id:b,label:"Vuex",icon:"storage",treeFilterPlaceholder:"Filter stores..."}),s.on.getInspectorTree(function(a){if(a.app===t&&a.inspectorId===b)if(a.filter){var n=[];ot(n,e._modules.root,a.filter,""),a.rootNodes=n}else a.rootNodes=[nt(e._modules.root,"")]}),s.on.getInspectorState(function(a){if(a.app===t&&a.inspectorId===b){var n=a.nodeId;et(e,n),a.state=ee(ae(e._modules,n),n==="root"?e.getters:e._makeLocalGettersCache,n)}}),s.on.editInspectorState(function(a){if(a.app===t&&a.inspectorId===b){var n=a.nodeId,o=a.path;n!=="root"&&(o=n.split("/").filter(Boolean).concat(o)),e._withCommit(function(){a.set(e._state.data,o,a.state.value)})}}),e.subscribe(function(a,n){var o={};a.payload&&(o.payload=a.payload),o.state=n,s.notifyComponentUpdate(),s.sendInspectorTree(b),s.sendInspectorState(b),s.addTimelineEvent({layerId:H,event:{time:Date.now(),title:a.type,data:o}})}),e.subscribeAction({before:function(a,n){var o={};a.payload&&(o.payload=a.payload),a._id=Yt++,a._time=Date.now(),o.state=n,s.addTimelineEvent({layerId:T,event:{time:a._time,title:a.type,groupId:a._id,subtitle:"start",data:o}})},after:function(a,n){var o={},r=Date.now()-a._time;o.duration={_custom:{type:"duration",display:r+"ms",tooltip:"Action duration",value:r}},a.payload&&(o.payload=a.payload),o.state=n,s.addTimelineEvent({layerId:T,event:{time:Date.now(),title:a.type,groupId:a._id,subtitle:"end",data:o}})}})})}var Q=8702998,Zt=6710886,te=16777215,st={label:"namespaced",textColor:te,backgroundColor:Zt};function at(t){return t&&t!=="root"?t.split("/").slice(-2,-1)[0]:"Root"}function nt(t,e){return{id:e||"root",label:at(e),tags:t.namespaced?[st]:[],children:Object.keys(t._children).map(function(s){return nt(t._children[s],e+s+"/")})}}function ot(t,e,s,a){a.includes(s)&&t.push({id:a||"root",label:a.endsWith("/")?a.slice(0,a.length-1):a||"Root",tags:e.namespaced?[st]:[]}),Object.keys(e._children).forEach(function(n){ot(t,e._children[n],s,a+n+"/")})}function ee(t,e,s){e=s==="root"?e:e[s];var a=Object.keys(e),n={state:Object.keys(t.state).map(function(r){return{key:r,editable:!0,value:t.state[r]}})};if(a.length){var o=se(e);n.getters=Object.keys(o).map(function(r){return{key:r.endsWith("/")?at(r):r,editable:!1,value:D(function(){return o[r]})}})}return n}function se(t){var e={};return Object.keys(t).forEach(function(s){var a=s.split("/");if(a.length>1){var n=e,o=a.pop();a.forEach(function(r){n[r]||(n[r]={_custom:{value:{},display:r,tooltip:"Module",abstract:!0}}),n=n[r]._custom.value}),n[o]=D(function(){return t[s]})}else e[s]=D(function(){return t[s]})}),e}function ae(t,e){var s=e.split("/").filter(function(a){return a});return s.reduce(function(a,n,o){var r=a[n];if(!r)throw new Error('Missing module "'+n+'" for path "'+e+'".');return o===s.length-1?r:r._children},e==="root"?t:t.root._children)}function D(t){try{return t()}catch(e){return e}}var f=function(t,e){this.runtime=e,this._children=Object.create(null),this._rawModule=t;var s=t.state;this.state=(typeof s=="function"?s():s)||{}},R={namespaced:{configurable:!0}};R.namespaced.get=function(){return!!this._rawModule.namespaced},f.prototype.addChild=function(t,e){this._children[t]=e},f.prototype.removeChild=function(t){delete this._children[t]},f.prototype.getChild=function(t){return this._children[t]},f.prototype.hasChild=function(t){return t in this._children},f.prototype.update=function(t){this._rawModule.namespaced=t.namespaced,t.actions&&(this._rawModule.actions=t.actions),t.mutations&&(this._rawModule.mutations=t.mutations),t.getters&&(this._rawModule.getters=t.getters)},f.prototype.forEachChild=function(t){S(this._children,t)},f.prototype.forEachGetter=function(t){this._rawModule.getters&&S(this._rawModule.getters,t)},f.prototype.forEachAction=function(t){this._rawModule.actions&&S(this._rawModule.actions,t)},f.prototype.forEachMutation=function(t){this._rawModule.mutations&&S(this._rawModule.mutations,t)},Object.defineProperties(f.prototype,R);var y=function(t){this.register([],t,!1)};y.prototype.get=function(t){return t.reduce(function(e,s){return e.getChild(s)},this.root)},y.prototype.getNamespace=function(t){var e=this.root;return t.reduce(function(s,a){return e=e.getChild(a),s+(e.namespaced?a+"/":"")},"")},y.prototype.update=function(t){rt([],this.root,t)},y.prototype.register=function(t,e,s){var a=this;s===void 0&&(s=!0);var n=new f(e,s);if(t.length===0)this.root=n;else{var o=this.get(t.slice(0,-1));o.addChild(t[t.length-1],n)}e.modules&&S(e.modules,function(r,i){a.register(t.concat(i),r,s)})},y.prototype.unregister=function(t){var e=this.get(t.slice(0,-1)),s=t[t.length-1],a=e.getChild(s);a&&a.runtime&&e.removeChild(s)},y.prototype.isRegistered=function(t){var e=this.get(t.slice(0,-1)),s=t[t.length-1];return e?e.hasChild(s):!1};function rt(t,e,s){if(e.update(s),s.modules)for(var a in s.modules){if(!e.getChild(a))return;rt(t.concat(a),e.getChild(a),s.modules[a])}}function ne(t){return new m(t)}var m=function(t){var e=this;t===void 0&&(t={});var s=t.plugins;s===void 0&&(s=[]);var a=t.strict;a===void 0&&(a=!1);var n=t.devtools;this._committing=!1,this._actions=Object.create(null),this._actionSubscribers=[],this._mutations=Object.create(null),this._wrappedGetters=Object.create(null),this._modules=new y(t),this._modulesNamespaceMap=Object.create(null),this._subscribers=[],this._makeLocalGettersCache=Object.create(null),this._scope=null,this._devtools=n;var o=this,r=this,i=r.dispatch,u=r.commit;this.dispatch=function(l,d){return i.call(o,l,d)},this.commit=function(l,d,p){return u.call(o,l,d,p)},this.strict=a;var c=this._modules.root.state;A(this,c,[],this._modules.root),L(this,c),s.forEach(function(l){return l(e)})},P={state:{configurable:!0}};m.prototype.install=function(t,e){t.provide(e||Bt,this),t.config.globalProperties.$store=this;var s=this._devtools!==void 0?this._devtools:!1;s&&qt(t,this)},P.state.get=function(){return this._state.data},P.state.set=function(t){},m.prototype.commit=function(t,e,s){var a=this,n=k(t,e,s),o=n.type,r=n.payload,i={type:o,payload:r},u=this._mutations[o];u&&(this._withCommit(function(){u.forEach(function(c){c(r)})}),this._subscribers.slice().forEach(function(c){return c(i,a.state)}))},m.prototype.dispatch=function(t,e){var s=this,a=k(t,e),n=a.type,o=a.payload,r={type:n,payload:o},i=this._actions[n];if(i){try{this._actionSubscribers.slice().filter(function(c){return c.before}).forEach(function(c){return c.before(r,s.state)})}catch{}var u=i.length>1?Promise.all(i.map(function(c){return c(o)})):i[0](o);return new Promise(function(c,l){u.then(function(d){try{s._actionSubscribers.filter(function(p){return p.after}).forEach(function(p){return p.after(r,s.state)})}catch{}c(d)},function(d){try{s._actionSubscribers.filter(function(p){return p.error}).forEach(function(p){return p.error(r,s.state,d)})}catch{}l(d)})})}},m.prototype.subscribe=function(t,e){return V(t,this._subscribers,e)},m.prototype.subscribeAction=function(t,e){var s=typeof t=="function"?{before:t}:t;return V(s,this._actionSubscribers,e)},m.prototype.watch=function(t,e,s){var a=this;return X(function(){return t(a.state,a.getters)},e,Object.assign({},s))},m.prototype.replaceState=function(t){var e=this;this._withCommit(function(){e._state.data=t})},m.prototype.registerModule=function(t,e,s){s===void 0&&(s={}),typeof t=="string"&&(t=[t]),this._modules.register(t,e),A(this,this.state,t,this._modules.get(t),s.preserveState),L(this,this.state)},m.prototype.unregisterModule=function(t){var e=this;typeof t=="string"&&(t=[t]),this._modules.unregister(t),this._withCommit(function(){var s=U(e.state,t.slice(0,-1));delete s[t[t.length-1]]}),B(this)},m.prototype.hasModule=function(t){return typeof t=="string"&&(t=[t]),this._modules.isRegistered(t)},m.prototype.hotUpdate=function(t){this._modules.update(t),B(this,!0)},m.prototype._withCommit=function(t){var e=this._committing;this._committing=!0,t(),this._committing=e},Object.defineProperties(m.prototype,P);var oe=ut(function(t,e){var s={};return it(e).forEach(function(a){var n=a.key,o=a.val;s[n]=function(){var r=this.$store.state,i=this.$store.getters;if(t){var u=ct(this.$store,"mapState",t);if(!u)return;r=u.context.state,i=u.context.getters}return typeof o=="function"?o.call(this,r,i):r[o]},s[n].vuex=!0}),s}),fs=ut(function(t,e){var s={};return it(e).forEach(function(a){var n=a.key,o=a.val;o=t+o,s[n]=function(){if(!(t&&!ct(this.$store,"mapGetters",t)))return this.$store.getters[o]},s[n].vuex=!0}),s});function it(t){return re(t)?Array.isArray(t)?t.map(function(e){return{key:e,val:e}}):Object.keys(t).map(function(e){return{key:e,val:t[e]}}):[]}function re(t){return Array.isArray(t)||tt(t)}function ut(t){return function(e,s){return typeof e!="string"?(s=e,e=""):e.charAt(e.length-1)!=="/"&&(e+="/"),t(e,s)}}function ct(t,e,s){var a=t._modulesNamespaceMap[s];return a}const ie={computed:{...oe({statusType:t=>t.userStatus.status,statusIsUserDefined:t=>t.userStatus.statusIsUserDefined,customIcon:t=>t.userStatus.icon,customMessage:t=>t.userStatus.message}),visibleMessage(){if(this.customIcon&&this.customMessage)return`${this.customIcon} ${this.customMessage}`;if(this.customMessage)return this.customMessage;if(this.statusIsUserDefined)switch(this.statusType){case"online":return h("user_status","Online");case"away":return h("user_status","Away");case"busy":return h("user_status","Busy");case"dnd":return h("user_status","Do not disturb");case"invisible":return h("user_status","Invisible");case"offline":return h("user_status","Offline")}return h("user_status","Set status")}},methods:{async changeStatus(t){try{await this.$store.dispatch("setStatus",{statusType:t})}catch(e){Tt(h("user_status","There was an error saving the new status")),q.debug(e)}}}},W=At("user_status").clearOnLogout().persist().build(),ue=300*1e3,ce=120*1e3,le=2*1e3,de=240*1e3;function pe(t){let e=!1,s,a;const n=(i=!1)=>{const u=Date.now()-Number.parseInt(W.getItem("lastHeartbeat")??"",10);!i&&u>=0&&u<de||(W.setItem("lastHeartbeat",String(Date.now())),t(e))},o=Pt(()=>{const i=e;e=!1,clearTimeout(s),s=setTimeout(()=>{e=!0},ce),i&&n(!0)},le,{immediate:!0}),r=setInterval(()=>n(),ue);return window.addEventListener("mousemove",o,{capture:!0,passive:!0}),document.visibilityState==="hidden"?(a=()=>{document.visibilityState!=="hidden"&&(document.removeEventListener("visibilitychange",a),n())},document.addEventListener("visibilitychange",a)):n(),()=>{clearInterval(r),clearTimeout(s),o.clear(),window.removeEventListener("mousemove",o,{capture:!0}),a&&document.removeEventListener("visibilitychange",a)}}async function me(t){const e=g("apps/user_status/api/v1/heartbeat?format=json");return(await _.put(e,{status:t?"away":"online"})).data.ocs.data}const fe="_userStatusMenuItem_1rva6_1",he="_userStatusIcon_1rva6_6",ge={userStatusMenuItem:fe,userStatusIcon:he},_e={name:"UserStatus",components:{NcButton:Et,NcListItem:Ct,NcUserStatusIcon:jt,SetStatusModal:wt(()=>Mt(()=>import("./SetStatusModal-Ccv1117Z.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41]),import.meta.url))},mixins:[ie],props:{inline:{type:Boolean,default:!1}},data(){return{isModalOpen:!1,stopHeartbeat:null}},mounted(){this.$store.dispatch("loadStatusFromInitialState"),OC.config.session_keepalive&&(this.stopHeartbeat=pe(t=>this._backgroundHeartbeat(t))),K("user_status:status.updated",this.handleUserStatusUpdated)},beforeUnmount(){this.stopHeartbeat?.(),ft("user_status:status.updated",this.handleUserStatusUpdated)},methods:{openModal(){this.isModalOpen=!0},closeModal(){this.isModalOpen=!1},async _backgroundHeartbeat(t){try{const e=await me(t);e?.userId?this.$store.dispatch("setStatusFromHeartbeat",e):await this.$store.dispatch("reFetchStatusFromServer")}catch(e){q.debug("Failed sending heartbeat, got: "+e.response?.status)}},handleUserStatusUpdated(t){v()?.uid===t.userId&&this.$store.dispatch("setStatusFromObject",{status:t.status,icon:t.icon,message:t.message})}}},ye={key:1};function ve(t,e,s,a,n,o){const r=M("NcUserStatusIcon"),i=M("NcListItem"),u=M("NcButton"),c=M("SetStatusModal");return O(),F(St,null,[s.inline?(O(),F("div",ye,[C(u,{onClick:G(o.openModal,["stop"])},{icon:E(()=>[C(r,{class:j(t.$style.userStatusIcon),status:t.statusType,"aria-hidden":"true"},null,8,["class","status"])]),default:E(()=>[yt(" "+vt(t.visibleMessage),1)]),_:1},8,["onClick"])])):(O(),N(i,{key:0,class:j(t.$style.userStatusMenuItem),compact:"",name:t.visibleMessage,onClick:G(o.openModal,["stop"])},{icon:E(()=>[C(r,{class:j(t.$style.userStatusIcon),status:t.statusType,"aria-hidden":"true"},null,8,["class","status"])]),_:1},8,["class","name","onClick"])),n.isModalOpen?(O(),N(c,{key:2,inline:s.inline,onClose:o.closeModal},null,8,["inline","onClose"])):bt("",!0)],64)}const be={$style:ge},lt=It(_e,[["render",ve],["__cssModules",be]]);async function Se(){const t=g("apps/user_status/api/v1/predefined_statuses?format=json");return(await _.get(t)).data.ocs.data}const we=()=>({predefinedStatuses:[]}),Ie={addPredefinedStatus(t,e){t.predefinedStatuses=[...t.predefinedStatuses,e]}},Me={statusesHaveLoaded(t){return t.predefinedStatuses.length>0}},Oe={async loadAllPredefinedStatuses({state:t,commit:e}){if(t.predefinedStatuses.length>0)return;const s=await Se();for(const a of s)e("addPredefinedStatus",a)}},ke={state:we,mutations:Ie,getters:Me,actions:Oe};async function Ae(){const t=g("apps/user_status/api/v1/user_status");return(await _.get(t)).data.ocs.data}async function Ee(t){const e=g("apps/user_status/api/v1/statuses/{userId}",{userId:"_"+t});return(await _.get(e)).data.ocs.data}async function Ce(t){const e=g("apps/user_status/api/v1/user_status/status");await _.put(e,{statusType:t})}async function je(t,e=null){const s=g("apps/user_status/api/v1/user_status/message/predefined?format=json");await _.put(s,{messageId:t,clearAt:e})}async function Te(t,e=null,s=null){const a=g("apps/user_status/api/v1/user_status/message/custom?format=json");await _.put(a,{message:t,statusIcon:e,clearAt:s})}async function Pe(){const t=g("apps/user_status/api/v1/user_status/message?format=json");await _.delete(t)}async function xe(t){const e=g("apps/user_status/api/v1/user_status/revert/{messageId}",{messageId:t});return(await _.delete(e)).data.ocs.data}const De=()=>({status:null,statusIsUserDefined:null,message:null,icon:null,clearAt:null,messageIsPredefined:null,messageId:null}),Le={loadBackupStatusFromServer(t,{status:e,statusIsUserDefined:s,message:a,icon:n,clearAt:o,messageIsPredefined:r,messageId:i}){t.status=e,t.message=a,t.icon=n,typeof s<"u"&&(t.statusIsUserDefined=s),typeof o<"u"&&(t.clearAt=o),typeof r<"u"&&(t.messageIsPredefined=r),typeof i<"u"&&(t.messageId=i)}},Ue={},Fe={async fetchBackupFromServer({commit:t}){try{const e=await Ee(v()?.uid);t("loadBackupStatusFromServer",e)}catch{}},async revertBackupFromServer({commit:t},{messageId:e}){const s=await xe(e);s&&(t("loadBackupStatusFromServer",{}),t("loadStatusFromServer",s),I("user_status:status.updated",{status:s.status,message:s.message,icon:s.icon,clearAt:s.clearAt,userId:v()?.uid}))}},Ne={state:De,mutations:Le,getters:Ue,actions:Fe};function Ge(){return new Date}function J(t){if(t===null)return null;const e=Ge();if(t.type==="period")return e.setSeconds(e.getSeconds()+t.time),Math.floor(e.getTime()/1e3);if(t.type==="end-of")switch(t.time){case"day":return Math.floor(dt(e).getTime()/1e3);case"week":return Math.floor($e(e).getTime()/1e3)}return t.type==="_time"?t.time:null}function hs(t){if(t===null)return h("user_status","Don't clear");if(t.type==="end-of")switch(t.time){case"day":return h("user_status","Today");case"week":return h("user_status","This week");default:return null}return t.type==="period"?$(Date.now()+t.time*1e3):t.type==="_time"?$(t.time*1e3):null}function dt(t){const e=new Date(t);return e.setHours(23,59,59,999),e}function $e(t){const e=dt(t);return e.setDate(t.getDate()+(xt()-1-e.getDay()+7)%7),e}const Ve=()=>({status:null,statusIsUserDefined:null,message:null,icon:null,clearAt:null,messageIsPredefined:null,messageId:null}),Be={setStatus(t,{statusType:e}){t.status=e,t.statusIsUserDefined=!0},setPredefinedMessage(t,{messageId:e,clearAt:s,message:a,icon:n}){t.messageId=e,t.messageIsPredefined=!0,t.message=a,t.icon=n,t.clearAt=s},setCustomMessage(t,{message:e,icon:s,clearAt:a}){t.messageId=null,t.messageIsPredefined=!1,t.message=e,t.icon=s,t.clearAt=a},clearMessage(t){t.messageId=null,t.messageIsPredefined=!1,t.message=null,t.icon=null,t.clearAt=null},loadStatusFromServer(t,{status:e,statusIsUserDefined:s,message:a,icon:n,clearAt:o,messageIsPredefined:r,messageId:i}){t.status=e,t.message=a,t.icon=n,typeof s<"u"&&(t.statusIsUserDefined=s),typeof o<"u"&&(t.clearAt=o),typeof r<"u"&&(t.messageIsPredefined=r),typeof i<"u"&&(t.messageId=i)}},He={},Qe={async setStatus({commit:t,state:e},{statusType:s}){await Ce(s),t("setStatus",{statusType:s}),I("user_status:status.updated",{status:e.status,message:e.message,icon:e.icon,clearAt:e.clearAt,userId:v()?.uid})},async setStatusFromObject({commit:t},e){t("loadStatusFromServer",e)},async setPredefinedMessage({commit:t,rootState:e,state:s},{messageId:a,clearAt:n}){const o=J(n);await je(a,o);const r=e.predefinedStatuses.predefinedStatuses.find(c=>c.id===a),{message:i,icon:u}=r;t("setPredefinedMessage",{messageId:a,clearAt:o,message:i,icon:u}),I("user_status:status.updated",{status:s.status,message:s.message,icon:s.icon,clearAt:s.clearAt,userId:v()?.uid})},async setCustomMessage({commit:t,state:e},{message:s,icon:a,clearAt:n}){const o=J(n);await Te(s,a,o),t("setCustomMessage",{message:s,icon:a,clearAt:o}),I("user_status:status.updated",{status:e.status,message:e.message,icon:e.icon,clearAt:e.clearAt,userId:v()?.uid})},async clearMessage({commit:t,state:e}){await Pe(),t("clearMessage"),I("user_status:status.updated",{status:e.status,message:e.message,icon:e.icon,clearAt:e.clearAt,userId:v()?.uid})},async reFetchStatusFromServer({commit:t}){const e=await Ae();t("loadStatusFromServer",e)},async setStatusFromHeartbeat({commit:t},e){t("loadStatusFromServer",e)},loadStatusFromInitialState({commit:t}){const e=Ot("user_status","status");t("loadStatusFromServer",e)}},Re={state:Ve,mutations:Be,getters:He,actions:Qe},pt=ne({modules:{predefinedStatuses:ke,userStatus:Re,userBackupStatus:Ne},strict:!0}),We=document.getElementById("user_status-menu-entry");function z(){const t=document.getElementById("user_status-menu-entry"),e=document.createElement("div");e.style.display="contents",t.replaceWith(e),Y(lt).use(pt).mount(e)}We?z():K("core:user-menu:mounted",z),document.addEventListener("DOMContentLoaded",function(){OCA.Dashboard&&OCA.Dashboard.registerStatus("status",t=>{Y(lt,{inline:!0}).use(pt).mount(t)})});export{ie as O,oe as a,hs as c,q as l,fs as m};
|
|
//# sourceMappingURL=user_status-menu.mjs.map
|