nextcloud/dist/user_status-menu.mjs
nextcloud-command b812040314 chore(assets): Recompile assets
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
2026-02-15 12:39:59 +00:00

3 lines
27 KiB
JavaScript

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('', '', 'dist/SetStatusModal-CQMBM7jp.chunk.mjs'),window.OC.filePath('', '', 'dist/index-C1xmmKTZ-B_lLl9Ld.chunk.mjs'),window.OC.filePath('', '', 'dist/index-Ma7sfat2.chunk.mjs'),window.OC.filePath('', '', 'dist/index-DeDXQtUD.chunk.mjs'),window.OC.filePath('', '', 'dist/runtime-dom.esm-bundler-nUg13ekW.chunk.mjs'),window.OC.filePath('', '', 'dist/createElementId-DhjFt1I9-CRJVCjcq.chunk.mjs'),window.OC.filePath('', '', 'dist/translation-DoG5ZELJ-2ffMJaM4.chunk.mjs'),window.OC.filePath('', '', 'dist/index-6_gsQFyp.chunk.mjs'),window.OC.filePath('', '', 'dist/createElementId-DhjFt1I9-C_oBIsvc.chunk.css'),window.OC.filePath('', '', 'dist/logger-D3RVzcfQ-B4GxPQ5t.chunk.mjs'),window.OC.filePath('', '', 'dist/logger-D3RVzcfQ-R3us1MM8.chunk.css'),window.OC.filePath('', '', 'dist/mdi-DK5BPbEO.chunk.mjs'),window.OC.filePath('', '', 'dist/mdi-BYHcrfvW.chunk.css'),window.OC.filePath('', '', 'dist/index-CySLkPBX.chunk.css'),window.OC.filePath('', '', 'dist/NcNoteCard-Cok_4Fld-BLQT242e.chunk.mjs'),window.OC.filePath('', '', 'dist/NcNoteCard-Cok_4Fld-Jq77EThs.chunk.css'),window.OC.filePath('', '', 'dist/NcSelect-DLheQ2yp-CBfrlGlO.chunk.mjs'),window.OC.filePath('', '', 'dist/NcSelect-DLheQ2yp-B9mkBKAR.chunk.css'),window.OC.filePath('', '', 'dist/NcEmojiPicker-Djc9a0gw-BzZP_l-N.chunk.mjs'),window.OC.filePath('', '', 'dist/NcColorPicker-DDHxR-iN-BfqdUpwQ.chunk.mjs'),window.OC.filePath('', '', 'dist/colors-BHGKZFDI-_xZPp21x.chunk.mjs'),window.OC.filePath('', '', 'dist/NcColorPicker-DDHxR-iN-Bwe91UZ7.chunk.css'),window.OC.filePath('', '', 'dist/TrashCanOutline-YYyMK6ia.chunk.mjs'),window.OC.filePath('', '', 'dist/NcInputField-o5OFv3z6-DGXgkff4.chunk.mjs'),window.OC.filePath('', '', 'dist/NcInputField-o5OFv3z6-BYlw6Xsd.chunk.css'),window.OC.filePath('', '', 'dist/NcEmojiPicker-Djc9a0gw-ChsL0oK6.chunk.css'),window.OC.filePath('', '', 'dist/NcUserStatusIcon-XiwrgeCm-BGKwPmPa.chunk.mjs'),window.OC.filePath('', '', 'dist/index-ClUK5nWL.chunk.mjs'),window.OC.filePath('', '', 'dist/index-sH3U_332.chunk.mjs'),window.OC.filePath('', '', 'dist/NcUserStatusIcon-XiwrgeCm-Bq_6hmXG.chunk.css'),window.OC.filePath('', '', 'dist/TrayArrowDown-C2uV7B4C.chunk.mjs'),window.OC.filePath('', '', 'dist/TrayArrowDown-D79n0IQ6.chunk.css'),window.OC.filePath('', '', 'dist/user_status-SetStatusModal-DU3RG3tz.chunk.css')])))=>i.map(i=>d[i]);
import{g as ft,a as v,u as mt,d as ht,s as K,e as I}from"./index-6_gsQFyp.chunk.mjs";import{O as gt,K as _t,v as q,p as yt,a as vt,f as M,j as F,o as O,c as N,l as bt,w as C,e as E,n as T,H as G,g as wt,t as St,F as It,h as z}from"./runtime-dom.esm-bundler-nUg13ekW.chunk.mjs";import{a as Mt,_ as Ot,l as At}from"./index-Ma7sfat2.chunk.mjs";import{N as kt}from"./logger-D3RVzcfQ-B4GxPQ5t.chunk.mjs";import{N as Ct}from"./TrayArrowDown-C2uV7B4C.chunk.mjs";import{N as Et}from"./NcUserStatusIcon-XiwrgeCm-BGKwPmPa.chunk.mjs";import{a as Tt}from"./index-C1xmmKTZ-B_lLl9Ld.chunk.mjs";import{t as h}from"./translation-DoG5ZELJ-2ffMJaM4.chunk.mjs";import{c as g}from"./index-ClUK5nWL.chunk.mjs";import{b as _}from"./createElementId-DhjFt1I9-CRJVCjcq.chunk.mjs";import{f as $,g as jt}from"./index-DeDXQtUD.chunk.mjs";import"./NcNoteCard-Cok_4Fld-BLQT242e.chunk.mjs";import"./index-sH3U_332.chunk.mjs";import"./mdi-DK5BPbEO.chunk.mjs";const X=ft().detectLogLevel().setApp("user_status").build();function Pt(){return Y().__VUE_DEVTOOLS_GLOBAL_HOOK__}function Y(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const xt=typeof Proxy=="function",Lt="devtools-plugin:setup",Dt="plugin:settings:set";let S,x;function Ut(){var t;return S!==void 0||(typeof window<"u"&&window.performance?(S=!0,x=window.performance):typeof globalThis<"u"&&!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance?(S=!0,x=globalThis.perf_hooks.performance):S=!1),S}function Ft(){return Ut()?x.now():Date.now()}class Nt{constructor(e,s){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=s;const a={};if(e.settings)for(const o in e.settings){const i=e.settings[o];a[o]=i.defaultValue}const n=`__vue-devtools-plugin-settings__${e.id}`;let r=Object.assign({},a);try{const o=localStorage.getItem(n),i=JSON.parse(o);Object.assign(r,i)}catch{}this.fallbacks={getSettings(){return r},setSettings(o){try{localStorage.setItem(n,JSON.stringify(o))}catch{}r=o},now(){return Ft()}},s&&s.on(Dt,(o,i)=>{o===this.plugin.id&&this.fallbacks.setSettings(i)}),this.proxiedOn=new Proxy({},{get:(o,i)=>this.target?this.target.on[i]:(...u)=>{this.onQueue.push({method:i,args:u})}}),this.proxiedTarget=new Proxy({},{get:(o,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 Gt(t,e){const s=t,a=Y(),n=Pt(),r=xt&&s.enableEarlyProxy;if(n&&(a.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!r))n.emit(Lt,t,e);else{const o=r?new Nt(s,n):null;(a.__VUE_DEVTOOLS_PLUGINS__=a.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:s,setupFn:e,proxy:o}),o&&e(o.proxiedTarget)}}var $t="store";function w(t,e){Object.keys(t).forEach(function(s){return e(t[s],s)})}function Z(t){return t!==null&&typeof t=="object"}function Bt(t){return t&&typeof t.then=="function"}function Vt(t,e){return function(){return t(e)}}function B(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 V(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;k(t,s,[],t._modules.root,!0),D(t,s,e)}function D(t,e,s){var a=t._state,n=t._scope;t.getters={},t._makeLocalGettersCache=Object.create(null);var r=t._wrappedGetters,o={},i={},u=gt(!0);u.run(function(){w(r,function(c,l){o[l]=Vt(c,t),i[l]=yt(function(){return o[l]()}),Object.defineProperty(t.getters,l,{get:function(){return i[l].value},enumerable:!0})})}),t._state=_t({data:e}),t._scope=u,t.strict&&Jt(t),a&&s&&t._withCommit(function(){a.data=null}),n&&n.stop()}function k(t,e,s,a,n){var r=!s.length,o=t._modules.getNamespace(s);if(a.namespaced&&(t._modulesNamespaceMap[o],t._modulesNamespaceMap[o]=a),!r&&!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=Ht(t,o,s);a.forEachMutation(function(l,d){var p=o+d;Qt(t,p,l,c)}),a.forEachAction(function(l,d){var p=l.root?d:o+d,pt=l.handler||l;Rt(t,p,pt,c)}),a.forEachGetter(function(l,d){var p=o+d;Wt(t,p,l,c)}),a.forEachChild(function(l,d){k(t,e,s.concat(d),l,n)})}function Ht(t,e,s){var a=e==="",n={dispatch:a?t.dispatch:function(r,o,i){var u=A(r,o,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(r,o,i){var u=A(r,o,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 tt(t,e)}},state:{get:function(){return U(t.state,s)}}}),n}function tt(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 r=n.slice(a);Object.defineProperty(s,r,{get:function(){return t.getters[n]},enumerable:!0})}}),t._makeLocalGettersCache[e]=s}return t._makeLocalGettersCache[e]}function Qt(t,e,s,a){var n=t._mutations[e]||(t._mutations[e]=[]);n.push(function(r){s.call(t,a.state,r)})}function Rt(t,e,s,a){var n=t._actions[e]||(t._actions[e]=[]);n.push(function(r){var o=s.call(t,{dispatch:a.dispatch,commit:a.commit,getters:a.getters,state:a.state,rootGetters:t.getters,rootState:t.state},r);return Bt(o)||(o=Promise.resolve(o)),t._devtoolHook?o.catch(function(i){throw t._devtoolHook.emit("vuex:error",i),i}):o})}function Wt(t,e,s,a){t._wrappedGetters[e]||(t._wrappedGetters[e]=function(n){return s(a.state,a.getters,n.state,n.getters)})}function Jt(t){q(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 A(t,e,s){return Z(t)&&t.type&&(s=e,e=t,t=t.type),{type:t,payload:e,options:s}}var Kt="vuex bindings",H="vuex:mutations",j="vuex:actions",b="vuex",qt=0;function zt(t,e){Gt({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:[Kt]},function(s){s.addTimelineLayer({id:H,label:"Vuex Mutations",color:Q}),s.addTimelineLayer({id:j,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=[];nt(n,e._modules.root,a.filter,""),a.rootNodes=n}else a.rootNodes=[at(e._modules.root,"")]}),s.on.getInspectorState(function(a){if(a.app===t&&a.inspectorId===b){var n=a.nodeId;tt(e,n),a.state=Zt(ee(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,r=a.path;n!=="root"&&(r=n.split("/").filter(Boolean).concat(r)),e._withCommit(function(){a.set(e._state.data,r,a.state.value)})}}),e.subscribe(function(a,n){var r={};a.payload&&(r.payload=a.payload),r.state=n,s.notifyComponentUpdate(),s.sendInspectorTree(b),s.sendInspectorState(b),s.addTimelineEvent({layerId:H,event:{time:Date.now(),title:a.type,data:r}})}),e.subscribeAction({before:function(a,n){var r={};a.payload&&(r.payload=a.payload),a._id=qt++,a._time=Date.now(),r.state=n,s.addTimelineEvent({layerId:j,event:{time:a._time,title:a.type,groupId:a._id,subtitle:"start",data:r}})},after:function(a,n){var r={},o=Date.now()-a._time;r.duration={_custom:{type:"duration",display:o+"ms",tooltip:"Action duration",value:o}},a.payload&&(r.payload=a.payload),r.state=n,s.addTimelineEvent({layerId:j,event:{time:Date.now(),title:a.type,groupId:a._id,subtitle:"end",data:r}})}})})}var Q=8702998,Xt=6710886,Yt=16777215,et={label:"namespaced",textColor:Yt,backgroundColor:Xt};function st(t){return t&&t!=="root"?t.split("/").slice(-2,-1)[0]:"Root"}function at(t,e){return{id:e||"root",label:st(e),tags:t.namespaced?[et]:[],children:Object.keys(t._children).map(function(s){return at(t._children[s],e+s+"/")})}}function nt(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?[et]:[]}),Object.keys(e._children).forEach(function(n){nt(t,e._children[n],s,a+n+"/")})}function Zt(t,e,s){e=s==="root"?e:e[s];var a=Object.keys(e),n={state:Object.keys(t.state).map(function(o){return{key:o,editable:!0,value:t.state[o]}})};if(a.length){var r=te(e);n.getters=Object.keys(r).map(function(o){return{key:o.endsWith("/")?st(o):o,editable:!1,value:L(function(){return r[o]})}})}return n}function te(t){var e={};return Object.keys(t).forEach(function(s){var a=s.split("/");if(a.length>1){var n=e,r=a.pop();a.forEach(function(o){n[o]||(n[o]={_custom:{value:{},display:o,tooltip:"Module",abstract:!0}}),n=n[o]._custom.value}),n[r]=L(function(){return t[s]})}else e[s]=L(function(){return t[s]})}),e}function ee(t,e){var s=e.split("/").filter(function(a){return a});return s.reduce(function(a,n,r){var o=a[n];if(!o)throw new Error('Missing module "'+n+'" for path "'+e+'".');return r===s.length-1?o:o._children},e==="root"?t:t.root._children)}function L(t){try{return t()}catch(e){return e}}var m=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},m.prototype.addChild=function(t,e){this._children[t]=e},m.prototype.removeChild=function(t){delete this._children[t]},m.prototype.getChild=function(t){return this._children[t]},m.prototype.hasChild=function(t){return t in this._children},m.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)},m.prototype.forEachChild=function(t){w(this._children,t)},m.prototype.forEachGetter=function(t){this._rawModule.getters&&w(this._rawModule.getters,t)},m.prototype.forEachAction=function(t){this._rawModule.actions&&w(this._rawModule.actions,t)},m.prototype.forEachMutation=function(t){this._rawModule.mutations&&w(this._rawModule.mutations,t)},Object.defineProperties(m.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){ot([],this.root,t)},y.prototype.register=function(t,e,s){var a=this;s===void 0&&(s=!0);var n=new m(e,s);if(t.length===0)this.root=n;else{var r=this.get(t.slice(0,-1));r.addChild(t[t.length-1],n)}e.modules&&w(e.modules,function(o,i){a.register(t.concat(i),o,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 ot(t,e,s){if(e.update(s),s.modules)for(var a in s.modules){if(!e.getChild(a))return;ot(t.concat(a),e.getChild(a),s.modules[a])}}function se(t){return new f(t)}var f=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 r=this,o=this,i=o.dispatch,u=o.commit;this.dispatch=function(l,d){return i.call(r,l,d)},this.commit=function(l,d,p){return u.call(r,l,d,p)},this.strict=a;var c=this._modules.root.state;k(this,c,[],this._modules.root),D(this,c),s.forEach(function(l){return l(e)})},P={state:{configurable:!0}};f.prototype.install=function(t,e){t.provide(e||$t,this),t.config.globalProperties.$store=this;var s=this._devtools!==void 0?this._devtools:!1;s&&zt(t,this)},P.state.get=function(){return this._state.data},P.state.set=function(t){},f.prototype.commit=function(t,e,s){var a=this,n=A(t,e,s),r=n.type,o=n.payload,i={type:r,payload:o},u=this._mutations[r];u&&(this._withCommit(function(){u.forEach(function(c){c(o)})}),this._subscribers.slice().forEach(function(c){return c(i,a.state)}))},f.prototype.dispatch=function(t,e){var s=this,a=A(t,e),n=a.type,r=a.payload,o={type:n,payload:r},i=this._actions[n];if(i){try{this._actionSubscribers.slice().filter(function(c){return c.before}).forEach(function(c){return c.before(o,s.state)})}catch{}var u=i.length>1?Promise.all(i.map(function(c){return c(r)})):i[0](r);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(o,s.state)})}catch{}c(d)},function(d){try{s._actionSubscribers.filter(function(p){return p.error}).forEach(function(p){return p.error(o,s.state,d)})}catch{}l(d)})})}},f.prototype.subscribe=function(t,e){return B(t,this._subscribers,e)},f.prototype.subscribeAction=function(t,e){var s=typeof t=="function"?{before:t}:t;return B(s,this._actionSubscribers,e)},f.prototype.watch=function(t,e,s){var a=this;return q(function(){return t(a.state,a.getters)},e,Object.assign({},s))},f.prototype.replaceState=function(t){var e=this;this._withCommit(function(){e._state.data=t})},f.prototype.registerModule=function(t,e,s){s===void 0&&(s={}),typeof t=="string"&&(t=[t]),this._modules.register(t,e),k(this,this.state,t,this._modules.get(t),s.preserveState),D(this,this.state)},f.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]]}),V(this)},f.prototype.hasModule=function(t){return typeof t=="string"&&(t=[t]),this._modules.isRegistered(t)},f.prototype.hotUpdate=function(t){this._modules.update(t),V(this,!0)},f.prototype._withCommit=function(t){var e=this._committing;this._committing=!0,t(),this._committing=e},Object.defineProperties(f.prototype,P);var ae=it(function(t,e){var s={};return rt(e).forEach(function(a){var n=a.key,r=a.val;s[n]=function(){var o=this.$store.state,i=this.$store.getters;if(t){var u=ut(this.$store,"mapState",t);if(!u)return;o=u.context.state,i=u.context.getters}return typeof r=="function"?r.call(this,o,i):o[r]},s[n].vuex=!0}),s}),ts=it(function(t,e){var s={};return rt(e).forEach(function(a){var n=a.key,r=a.val;r=t+r,s[n]=function(){if(!(t&&!ut(this.$store,"mapGetters",t)))return this.$store.getters[r]},s[n].vuex=!0}),s});function rt(t){return ne(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 ne(t){return Array.isArray(t)||Z(t)}function it(t){return function(e,s){return typeof e!="string"?(s=e,e=""):e.charAt(e.length-1)!=="/"&&(e+="/"),t(e,s)}}function ut(t,e,s){var a=t._modulesNamespaceMap[s];return a}const oe={computed:{...ae({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")),X.debug(e)}}}};async function re(t){const e=_("apps/user_status/api/v1/heartbeat?format=json");return(await g.put(e,{status:t?"away":"online"})).data.ocs.data}const ie="_userStatusMenuItem_1rva6_1",ue="_userStatusIcon_1rva6_6",ce={userStatusMenuItem:ie,userStatusIcon:ue},le={name:"UserStatus",components:{NcButton:kt,NcListItem:Ct,NcUserStatusIcon:Et,SetStatusModal:vt(()=>Ot(()=>import("./SetStatusModal-CQMBM7jp.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]),import.meta.url))},mixins:[oe],props:{inline:{type:Boolean,default:!1}},data(){return{heartbeatInterval:null,isAway:!1,isModalOpen:!1,mouseMoveListener:null,setAwayTimeout:null}},mounted(){this.$store.dispatch("loadStatusFromInitialState"),OC.config.session_keepalive&&(this.heartbeatInterval=setInterval(this._backgroundHeartbeat.bind(this),1e3*60*5),this.setAwayTimeout=()=>{this.isAway=!0},this.mouseMoveListener=ht(()=>{const t=this.isAway;this.isAway=!1,clearTimeout(this.setAwayTimeout),setTimeout(this.setAwayTimeout,1e3*60*2),t&&this._backgroundHeartbeat()},1e3*2,{immediate:!0}),window.addEventListener("mousemove",this.mouseMoveListener,{capture:!0,passive:!0}),this._backgroundHeartbeat()),K("user_status:status.updated",this.handleUserStatusUpdated)},beforeUnmount(){window.removeEventListener("mouseMove",this.mouseMoveListener),clearInterval(this.heartbeatInterval),mt("user_status:status.updated",this.handleUserStatusUpdated)},methods:{openModal(){this.isModalOpen=!0},closeModal(){this.isModalOpen=!1},async _backgroundHeartbeat(){try{const t=await re(this.isAway);t?.userId?this.$store.dispatch("setStatusFromHeartbeat",t):await this.$store.dispatch("reFetchStatusFromServer")}catch(t){X.debug("Failed sending heartbeat, got: "+t.response?.status)}},handleUserStatusUpdated(t){v()?.uid===t.userId&&this.$store.dispatch("setStatusFromObject",{status:t.status,icon:t.icon,message:t.message})}}},de={key:1};function pe(t,e,s,a,n,r){const o=M("NcUserStatusIcon"),i=M("NcListItem"),u=M("NcButton"),c=M("SetStatusModal");return O(),F(It,null,[s.inline?(O(),F("div",de,[E(u,{onClick:G(r.openModal,["stop"])},{icon:C(()=>[E(o,{class:T(t.$style.userStatusIcon),status:t.statusType,"aria-hidden":"true"},null,8,["class","status"])]),default:C(()=>[wt(" "+St(t.visibleMessage),1)]),_:1},8,["onClick"])])):(O(),N(i,{key:0,class:T(t.$style.userStatusMenuItem),compact:"",name:t.visibleMessage,onClick:G(r.openModal,["stop"])},{icon:C(()=>[E(o,{class:T(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:r.closeModal},null,8,["inline","onClose"])):bt("",!0)],64)}const fe={$style:ce},ct=Mt(le,[["render",pe],["__cssModules",fe]]);async function me(){const t=_("apps/user_status/api/v1/predefined_statuses?format=json");return(await g.get(t)).data.ocs.data}const he=()=>({predefinedStatuses:[]}),ge={addPredefinedStatus(t,e){t.predefinedStatuses=[...t.predefinedStatuses,e]}},_e={statusesHaveLoaded(t){return t.predefinedStatuses.length>0}},ye={async loadAllPredefinedStatuses({state:t,commit:e}){if(t.predefinedStatuses.length>0)return;const s=await me();for(const a of s)e("addPredefinedStatus",a)}},ve={state:he,mutations:ge,getters:_e,actions:ye};async function be(){const t=_("apps/user_status/api/v1/user_status");return(await g.get(t)).data.ocs.data}async function we(t){const e=_("apps/user_status/api/v1/statuses/{userId}",{userId:"_"+t});return(await g.get(e)).data.ocs.data}async function Se(t){const e=_("apps/user_status/api/v1/user_status/status");await g.put(e,{statusType:t})}async function Ie(t,e=null){const s=_("apps/user_status/api/v1/user_status/message/predefined?format=json");await g.put(s,{messageId:t,clearAt:e})}async function Me(t,e=null,s=null){const a=_("apps/user_status/api/v1/user_status/message/custom?format=json");await g.put(a,{message:t,statusIcon:e,clearAt:s})}async function Oe(){const t=_("apps/user_status/api/v1/user_status/message?format=json");await g.delete(t)}async function Ae(t){const e=_("apps/user_status/api/v1/user_status/revert/{messageId}",{messageId:t});return(await g.delete(e)).data.ocs.data}const ke=()=>({status:null,statusIsUserDefined:null,message:null,icon:null,clearAt:null,messageIsPredefined:null,messageId:null}),Ce={loadBackupStatusFromServer(t,{status:e,statusIsUserDefined:s,message:a,icon:n,clearAt:r,messageIsPredefined:o,messageId:i}){t.status=e,t.message=a,t.icon=n,typeof s<"u"&&(t.statusIsUserDefined=s),typeof r<"u"&&(t.clearAt=r),typeof o<"u"&&(t.messageIsPredefined=o),typeof i<"u"&&(t.messageId=i)}},Ee={},Te={async fetchBackupFromServer({commit:t}){try{const e=await we(v()?.uid);t("loadBackupStatusFromServer",e)}catch{}},async revertBackupFromServer({commit:t},{messageId:e}){const s=await Ae(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}))}},je={state:ke,mutations:Ce,getters:Ee,actions:Te};function Pe(){return new Date}function W(t){if(t===null)return null;const e=Pe();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(lt(e).getTime()/1e3);case"week":return Math.floor(xe(e).getTime()/1e3)}return t.type==="_time"?t.time:null}function es(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 lt(t){const e=new Date(t);return e.setHours(23,59,59,999),e}function xe(t){const e=lt(t);return e.setDate(t.getDate()+(jt()-1-e.getDay()+7)%7),e}const Le=()=>({status:null,statusIsUserDefined:null,message:null,icon:null,clearAt:null,messageIsPredefined:null,messageId:null}),De={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:r,messageIsPredefined:o,messageId:i}){t.status=e,t.message=a,t.icon=n,typeof s<"u"&&(t.statusIsUserDefined=s),typeof r<"u"&&(t.clearAt=r),typeof o<"u"&&(t.messageIsPredefined=o),typeof i<"u"&&(t.messageId=i)}},Ue={},Fe={async setStatus({commit:t,state:e},{statusType:s}){await Se(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 r=W(n);await Ie(a,r);const o=e.predefinedStatuses.predefinedStatuses.find(c=>c.id===a),{message:i,icon:u}=o;t("setPredefinedMessage",{messageId:a,clearAt:r,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 r=W(n);await Me(s,a,r),t("setCustomMessage",{message:s,icon:a,clearAt:r}),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 Oe(),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 be();t("loadStatusFromServer",e)},async setStatusFromHeartbeat({commit:t},e){t("loadStatusFromServer",e)},loadStatusFromInitialState({commit:t}){const e=At("user_status","status");t("loadStatusFromServer",e)}},Ne={state:Le,mutations:De,getters:Ue,actions:Fe},dt=se({modules:{predefinedStatuses:ve,userStatus:Ne,userBackupStatus:je},strict:!0}),Ge=document.getElementById("user_status-menu-entry");function J(){const t=document.getElementById("user_status-menu-entry"),e=document.createElement("div");e.style.display="contents",t.replaceWith(e),z(ct).use(dt).mount(e)}Ge?J():K("core:user-menu:mounted",J),document.addEventListener("DOMContentLoaded",function(){OCA.Dashboard&&OCA.Dashboard.registerStatus("status",t=>{z(ct,{inline:!0}).use(dt).mount(t)})});export{oe as O,ae as a,es as c,X as l,ts as m};
//# sourceMappingURL=user_status-menu.mjs.map