38 lines
30 KiB
JavaScript
38 lines
30 KiB
JavaScript
import{n as I,r as L,aC as bt,aD as xt,a as y,k as F,aE as Ct,aF as At,f as Mt,e as Ut,N as kt,s as It,aG as Nt}from"./index-BMeBqg0T.chunk.mjs";import{a as X,N as Lt}from"./NcActionButton-CuVNJJtW-78GF8FR5.chunk.mjs";import{H as Dt,ae as ut,I as Bt,_ as lt,$ as R,an as Pt,b as D,c as dt,k as Tt,m as Et,p as Ot,A as zt,ao as $t,w as V,q as Ht,f as Wt,g as W,u as P,s as T}from"./vue.runtime.esm-Ct3_M7aQ.chunk.mjs";import{e as ht}from"./index-XmYygNaN.chunk.mjs";import"./video-rmrjCz0n.chunk.mjs";const jt=Dt().detectUser().setApp("@f7cloud/vue").build(),Gt={name:"NcActionLink",mixins:[X],inject:{isInSemanticMenu:{from:"NcActions:isSemanticMenu",default:!1}},props:{href:{type:String,default:"#",required:!0,validator:t=>{try{return new URL(t)}catch{return t.startsWith("#")||t.startsWith("/")}}},download:{type:String,default:null},target:{type:String,default:"_self",validator:t=>t&&(!t.startsWith("_")||["_blank","_self","_parent","_top"].indexOf(t)>-1)},title:{type:String,default:null},ariaHidden:{type:Boolean,default:null}}};var Ft=function(){var t=this,e=t._self._c;return e("li",{staticClass:"action",attrs:{role:t.isInSemanticMenu&&"presentation"}},[e("a",{staticClass:"action-link focusable",attrs:{download:t.download,href:t.href,"aria-label":t.ariaLabel,target:t.target,title:t.title,rel:"nofollow noreferrer noopener",role:t.isInSemanticMenu&&"menuitem"},on:{click:t.onClick}},[t._t("icon",function(){return[e("span",{staticClass:"action-link__icon",class:[t.isIconUrl?"action-link__icon--url":t.icon],style:{backgroundImage:t.isIconUrl?`url(${t.icon})`:null},attrs:{"aria-hidden":"true"}})]}),t.name?e("span",{staticClass:"action-link__longtext-wrapper"},[e("strong",{staticClass:"action-link__name"},[t._v(" "+t._s(t.name)+" ")]),e("br"),e("span",{staticClass:"action-link__longtext",domProps:{textContent:t._s(t.text)}})]):t.isLongText?e("span",{staticClass:"action-link__longtext",domProps:{textContent:t._s(t.text)}}):e("span",{staticClass:"action-link__text"},[t._v(t._s(t.text))]),t._e()],2)])},Xt=[],Vt=I(Gt,Ft,Xt,!1,null,"30c015f0");const Rt=Vt.exports,qt={name:"NcActionRouter",mixins:[X],inject:{isInSemanticMenu:{from:"NcActions:isSemanticMenu",default:!1}},props:{to:{type:[String,Object],default:"",required:!0},exact:{type:Boolean,default:!1}}};var Yt=function(){var t=this,e=t._self._c;return e("li",{staticClass:"action",attrs:{role:t.isInSemanticMenu&&"presentation"}},[e("RouterLink",{staticClass:"action-router focusable",attrs:{to:t.to,"aria-label":t.ariaLabel,exact:t.exact,title:t.title,rel:"nofollow noreferrer noopener",role:t.isInSemanticMenu&&"menuitem"},nativeOn:{click:function(s){return t.onClick.apply(null,arguments)}}},[t._t("icon",function(){return[e("span",{staticClass:"action-router__icon",class:[t.isIconUrl?"action-router__icon--url":t.icon],style:{backgroundImage:t.isIconUrl?`url(${t.icon})`:null},attrs:{"aria-hidden":"true"}})]}),t.name?e("span",{staticClass:"action-router__longtext-wrapper"},[e("strong",{staticClass:"action-router__name"},[t._v(" "+t._s(t.name)+" ")]),e("br"),e("span",{staticClass:"action-router__longtext",domProps:{textContent:t._s(t.text)}})]):t.isLongText?e("span",{staticClass:"action-router__longtext",domProps:{textContent:t._s(t.text)}}):e("span",{staticClass:"action-router__text"},[t._v(t._s(t.text))]),t._e()],2)],1)},Zt=[],Jt=I(qt,Yt,Zt,!1,null,"579c6b4d");const Kt=Jt.exports,Qt={name:"NcActionText",mixins:[X],inject:{isInSemanticMenu:{from:"NcActions:isSemanticMenu",default:!1}}};var te=function(){var t=this,e=t._self._c;return e("li",{staticClass:"action",attrs:{role:t.isInSemanticMenu&&"presentation"}},[e("span",{staticClass:"action-text",on:{click:t.onClick}},[t._t("icon",function(){return[t.icon!==""?e("span",{staticClass:"action-text__icon",class:[t.isIconUrl?"action-text__icon--url":t.icon],style:{backgroundImage:t.isIconUrl?`url(${t.icon})`:null},attrs:{"aria-hidden":"true"}}):t._e()]}),t.name?e("span",{staticClass:"action-text__longtext-wrapper"},[e("strong",{staticClass:"action-text__name"},[t._v(" "+t._s(t.name)+" ")]),e("br"),e("span",{staticClass:"action-text__longtext",domProps:{textContent:t._s(t.text)}})]):t.isLongText?e("span",{staticClass:"action-text__longtext",domProps:{textContent:t._s(t.text)}}):e("span",{staticClass:"action-text__text"},[t._v(t._s(t.text))]),t._e()],2)])},ee=[],se=I(Qt,te,ee,!1,null,"824615f4");const ne=se.exports,ae=`<!--
|
|
- SPDX-FileCopyrightText: 2020 Google Inc.
|
|
- SPDX-License-Identifier: Apache-2.0
|
|
-->
|
|
<svg viewBox="0 0 16 16" width="16" height="16" xmlns="http://www.w3.org/2000/svg">
|
|
<path fill="var(--color-success)" d="M4.8 11.2h6.4V4.8H4.8v6.4zM8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8z" />
|
|
</svg>
|
|
`,q=`<!--
|
|
- SPDX-FileCopyrightText: 2020 Google Inc.
|
|
- SPDX-License-Identifier: Apache-2.0
|
|
-->
|
|
<svg viewBox="0 0 16 16" width="16" height="16" xmlns="http://www.w3.org/2000/svg">
|
|
<path fill="none" d="M-4-4h24v24H-4z" />
|
|
<path fill="var(--color-warning)" d="M6.9.1C3 .6-.1 4-.1 8c0 4.4 3.6 8 8 8 4 0 7.4-3 8-6.9-1.2 1.3-2.9 2.1-4.7 2.1-3.5 0-6.4-2.9-6.4-6.4 0-1.9.8-3.6 2.1-4.7z" />
|
|
</svg>
|
|
`,re=`<!--
|
|
- SPDX-FileCopyrightText: 2020 Google Inc.
|
|
- SPDX-License-Identifier: Apache-2.0
|
|
-->
|
|
<svg viewBox="0 0 16 16" width="16" height="16" xmlns="http://www.w3.org/2000/svg">
|
|
<path fill="none" d="M-4-4h24v24H-4V-4z" />
|
|
<path fill="var(--color-error)" d="M8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8z" />
|
|
<path fill="#fdffff" d="M5 6.5h6c.8 0 1.5.7 1.5 1.5s-.7 1.5-1.5 1.5H5c-.8 0-1.5-.7-1.5-1.5S4.2 6.5 5 6.5z" />
|
|
</svg>
|
|
`,Y=`<!--
|
|
- SPDX-FileCopyrightText: 2020 Google Inc.
|
|
- SPDX-License-Identifier: Apache-2.0
|
|
-->
|
|
<svg viewBox="0 0 16 16" width="16" height="16" xmlns="http://www.w3.org/2000/svg">
|
|
<path fill="none" d="M-4-4h24v24H-4V-4z" />
|
|
<path d="M8 0C3.6 0 0 3.6 0 8s3.6 8 8 8 8-3.6 8-8-3.6-8-8-8zm0 3.2c2.7 0 4.8 2.1 4.8 4.8s-2.1 4.8-4.8 4.8S3.2 10.7 3.2 8 5.3 3.2 8 3.2z" />
|
|
</svg>
|
|
`;L(bt);const ft=t=>{switch(t){case"away":return y("away");case"busy":return y("busy");case"dnd":return y("do not disturb");case"online":return y("online");case"invisible":return y("invisible");case"offline":return y("offline");default:return t}};L(xt);const ie={name:"NcUserStatusIcon",props:{user:{type:String,default:null},status:{type:String,default:null,validator:t=>["online","away","busy","dnd","invisible","offline"].includes(t)},ariaHidden:{type:String,default:null,validator:t=>["true","false"].includes(t)}},data(){return{fetchedUserStatus:null}},computed:{activeStatus(){return this.status??this.fetchedUserStatus},activeSvg(){return{online:ae,away:q,busy:q,dnd:re,invisible:Y,offline:Y}[this.activeStatus]??null},ariaLabel(){return this.ariaHidden==="true"?null:y("User status: {status}",{status:ft(this.activeStatus)})}},watch:{user:{immediate:!0,async handler(t,e){if(!t||!ht()?.user_status?.enabled){this.fetchedUserStatus=null;return}try{const{data:s}=await F.get(ut("/apps/user_status/api/v1/statuses/{user}",{user:t}));this.fetchedUserStatus=s.ocs?.data?.status}catch{this.fetchedUserStatus=null}}}}};var oe=function(){var t=this,e=t._self._c;return t.activeStatus?e("span",{staticClass:"user-status-icon",class:{"user-status-icon--invisible":["invisible","offline"].includes(t.status)},attrs:{role:"img","aria-hidden":t.ariaHidden,"aria-label":t.ariaLabel},domProps:{innerHTML:t._s(t.activeSvg)}}):t._e()},ce=[],ue=I(ie,oe,ce,!1,null,"0555d8d0");const le=ue.exports;L(Ct);class w{constructor(e,s,r,l){this.r=e,this.g=s,this.b=r,l&&(this.name=l)}get color(){const e=s=>`00${s.toString(16)}`.slice(-2);return`#${e(this.r)}${e(this.g)}${e(this.b)}`}}function de(t,e){const s=new Array(3);return s[0]=(e[1].r-e[0].r)/t,s[1]=(e[1].g-e[0].g)/t,s[2]=(e[1].b-e[0].b)/t,s}function E(t,e,s){const r=[];r.push(e);const l=de(t,[e,s]);for(let f=1;f<t;f++){const p=Math.floor(e.r+l[0]*f),i=Math.floor(e.g+l[1]*f),v=Math.floor(e.b+l[2]*f);r.push(new w(p,i,v))}return r}new w(182,70,157,y("Purple")),new w(191,103,139,y("Rosy brown")),new w(201,136,121,y("Feldspar")),new w(211,169,103,y("Whiskey")),new w(221,203,85,y("Gold")),new w(165,184,114,y("Olivine")),new w(110,166,143,y("Acapulco")),new w(55,148,172,y("Boston Blue")),new w(0,130,201,y("Nextcloud blue")),new w(45,115,190,y("Mariner")),new w(91,100,179,y("Blue Violet")),new w(136,85,168,y("Deluge"));function he(t){const e=new w(182,70,157,y("Purple")),s=new w(221,203,85,y("Gold")),r=new w(0,130,201,y("Nextcloud blue")),l=E(t,e,s),f=E(t,s,r),p=E(t,r,e);return l.concat(f).concat(p)}var Z={exports:{}},J={exports:{}},K;function fe(){return K||(K=1,function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(s,r){return s<<r|s>>>32-r},rotr:function(s,r){return s<<32-r|s>>>r},endian:function(s){if(s.constructor==Number)return e.rotl(s,8)&16711935|e.rotl(s,24)&4278255360;for(var r=0;r<s.length;r++)s[r]=e.endian(s[r]);return s},randomBytes:function(s){for(var r=[];s>0;s--)r.push(Math.floor(Math.random()*256));return r},bytesToWords:function(s){for(var r=[],l=0,f=0;l<s.length;l++,f+=8)r[f>>>5]|=s[l]<<24-f%32;return r},wordsToBytes:function(s){for(var r=[],l=0;l<s.length*32;l+=8)r.push(s[l>>>5]>>>24-l%32&255);return r},bytesToHex:function(s){for(var r=[],l=0;l<s.length;l++)r.push((s[l]>>>4).toString(16)),r.push((s[l]&15).toString(16));return r.join("")},hexToBytes:function(s){for(var r=[],l=0;l<s.length;l+=2)r.push(parseInt(s.substr(l,2),16));return r},bytesToBase64:function(s){for(var r=[],l=0;l<s.length;l+=3)for(var f=s[l]<<16|s[l+1]<<8|s[l+2],p=0;p<4;p++)l*8+p*6<=s.length*8?r.push(t.charAt(f>>>6*(3-p)&63)):r.push("=");return r.join("")},base64ToBytes:function(s){s=s.replace(/[^A-Z0-9+\/]/ig,"");for(var r=[],l=0,f=0;l<s.length;f=++l%4)f!=0&&r.push((t.indexOf(s.charAt(l-1))&Math.pow(2,-2*f+8)-1)<<f*2|t.indexOf(s.charAt(l))>>>6-f*2);return r}};J.exports=e}()),J.exports}var O,Q;function tt(){if(Q)return O;Q=1;var t={utf8:{stringToBytes:function(e){return t.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(t.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var s=[],r=0;r<e.length;r++)s.push(e.charCodeAt(r)&255);return s},bytesToString:function(e){for(var s=[],r=0;r<e.length;r++)s.push(String.fromCharCode(e[r]));return s.join("")}}};return O=t,O}var z,et;function pe(){if(et)return z;et=1,z=function(s){return s!=null&&(t(s)||e(s)||!!s._isBuffer)};function t(s){return!!s.constructor&&typeof s.constructor.isBuffer=="function"&&s.constructor.isBuffer(s)}function e(s){return typeof s.readFloatLE=="function"&&typeof s.slice=="function"&&t(s.slice(0,0))}return z}var st;function ge(){return st||(st=1,function(){var t=fe(),e=tt().utf8,s=pe(),r=tt().bin,l=function(f,p){f.constructor==String?p&&p.encoding==="binary"?f=r.stringToBytes(f):f=e.stringToBytes(f):s(f)?f=Array.prototype.slice.call(f,0):!Array.isArray(f)&&f.constructor!==Uint8Array&&(f=f.toString());for(var i=t.bytesToWords(f),v=f.length*8,n=1732584193,a=-271733879,o=-1732584194,c=271733878,u=0;u<i.length;u++)i[u]=(i[u]<<8|i[u]>>>24)&16711935|(i[u]<<24|i[u]>>>8)&4278255360;i[v>>>5]|=128<<v%32,i[(v+64>>>9<<4)+14]=v;for(var d=l._ff,h=l._gg,g=l._hh,m=l._ii,u=0;u<i.length;u+=16){var _=n,S=a,A=o,x=c;n=d(n,a,o,c,i[u+0],7,-680876936),c=d(c,n,a,o,i[u+1],12,-389564586),o=d(o,c,n,a,i[u+2],17,606105819),a=d(a,o,c,n,i[u+3],22,-1044525330),n=d(n,a,o,c,i[u+4],7,-176418897),c=d(c,n,a,o,i[u+5],12,1200080426),o=d(o,c,n,a,i[u+6],17,-1473231341),a=d(a,o,c,n,i[u+7],22,-45705983),n=d(n,a,o,c,i[u+8],7,1770035416),c=d(c,n,a,o,i[u+9],12,-1958414417),o=d(o,c,n,a,i[u+10],17,-42063),a=d(a,o,c,n,i[u+11],22,-1990404162),n=d(n,a,o,c,i[u+12],7,1804603682),c=d(c,n,a,o,i[u+13],12,-40341101),o=d(o,c,n,a,i[u+14],17,-1502002290),a=d(a,o,c,n,i[u+15],22,1236535329),n=h(n,a,o,c,i[u+1],5,-165796510),c=h(c,n,a,o,i[u+6],9,-1069501632),o=h(o,c,n,a,i[u+11],14,643717713),a=h(a,o,c,n,i[u+0],20,-373897302),n=h(n,a,o,c,i[u+5],5,-701558691),c=h(c,n,a,o,i[u+10],9,38016083),o=h(o,c,n,a,i[u+15],14,-660478335),a=h(a,o,c,n,i[u+4],20,-405537848),n=h(n,a,o,c,i[u+9],5,568446438),c=h(c,n,a,o,i[u+14],9,-1019803690),o=h(o,c,n,a,i[u+3],14,-187363961),a=h(a,o,c,n,i[u+8],20,1163531501),n=h(n,a,o,c,i[u+13],5,-1444681467),c=h(c,n,a,o,i[u+2],9,-51403784),o=h(o,c,n,a,i[u+7],14,1735328473),a=h(a,o,c,n,i[u+12],20,-1926607734),n=g(n,a,o,c,i[u+5],4,-378558),c=g(c,n,a,o,i[u+8],11,-2022574463),o=g(o,c,n,a,i[u+11],16,1839030562),a=g(a,o,c,n,i[u+14],23,-35309556),n=g(n,a,o,c,i[u+1],4,-1530992060),c=g(c,n,a,o,i[u+4],11,1272893353),o=g(o,c,n,a,i[u+7],16,-155497632),a=g(a,o,c,n,i[u+10],23,-1094730640),n=g(n,a,o,c,i[u+13],4,681279174),c=g(c,n,a,o,i[u+0],11,-358537222),o=g(o,c,n,a,i[u+3],16,-722521979),a=g(a,o,c,n,i[u+6],23,76029189),n=g(n,a,o,c,i[u+9],4,-640364487),c=g(c,n,a,o,i[u+12],11,-421815835),o=g(o,c,n,a,i[u+15],16,530742520),a=g(a,o,c,n,i[u+2],23,-995338651),n=m(n,a,o,c,i[u+0],6,-198630844),c=m(c,n,a,o,i[u+7],10,1126891415),o=m(o,c,n,a,i[u+14],15,-1416354905),a=m(a,o,c,n,i[u+5],21,-57434055),n=m(n,a,o,c,i[u+12],6,1700485571),c=m(c,n,a,o,i[u+3],10,-1894986606),o=m(o,c,n,a,i[u+10],15,-1051523),a=m(a,o,c,n,i[u+1],21,-2054922799),n=m(n,a,o,c,i[u+8],6,1873313359),c=m(c,n,a,o,i[u+15],10,-30611744),o=m(o,c,n,a,i[u+6],15,-1560198380),a=m(a,o,c,n,i[u+13],21,1309151649),n=m(n,a,o,c,i[u+4],6,-145523070),c=m(c,n,a,o,i[u+11],10,-1120210379),o=m(o,c,n,a,i[u+2],15,718787259),a=m(a,o,c,n,i[u+9],21,-343485551),n=n+_>>>0,a=a+S>>>0,o=o+A>>>0,c=c+x>>>0}return t.endian([n,a,o,c])};l._ff=function(f,p,i,v,n,a,o){var c=f+(p&i|~p&v)+(n>>>0)+o;return(c<<a|c>>>32-a)+p},l._gg=function(f,p,i,v,n,a,o){var c=f+(p&v|i&~v)+(n>>>0)+o;return(c<<a|c>>>32-a)+p},l._hh=function(f,p,i,v,n,a,o){var c=f+(p^i^v)+(n>>>0)+o;return(c<<a|c>>>32-a)+p},l._ii=function(f,p,i,v,n,a,o){var c=f+(i^(p|~v))+(n>>>0)+o;return(c<<a|c>>>32-a)+p},l._blocksize=16,l._digestsize=16,Z.exports=function(f,p){if(f==null)throw new Error("Illegal argument "+f);var i=t.wordsToBytes(l(f,p));return p&&p.asBytes?i:p&&p.asString?r.bytesToString(i):t.bytesToHex(i)}}()),Z.exports}var ve=ge();const me=Bt(ve),nt=function(t){let e=t.toLowerCase();e.match(/^([0-9a-f]{4}-?){8}$/)===null&&(e=me(e)),e=e.replace(/[^0-9a-f]/g,"");const s=6,r=he(s);function l(f,p){let i=0;const v=[];for(let n=0;n<f.length;n++)v.push(parseInt(f.charAt(n),16)%16);for(const n in v)i+=v[n];return parseInt(parseInt(i,10)%p,10)}return r[l(e,s*3)]},ye=(t,e,s)=>{const r=window.getComputedStyle(document.body).getPropertyValue("--background-invert-if-dark")==="invert(100%)";return lt("/avatar"+(s?"/guest":"")+"/{user}/{size}"+(r?"/dark":""),{user:t,size:e})};function Se(t){return window._nc_contacts_menu_hooks?Object.values(window._nc_contacts_menu_hooks).filter(e=>e.enabled(t)):[]}const we=(t,e)=>{const s=(a,o)=>a.startsWith(o)?a.slice(o.length):a,r=(a,...o)=>o.reduce((c,u)=>s(c,u),a);if(!t)return null;const l=/^https?:\/\//.test(e),f=/^[a-z][a-z0-9+.-]*:.+/.test(e);if(!l&&f||l&&!e.startsWith(R())||!l&&!e.startsWith("/"))return null;const p=l?r(e,R(),"/index.php"):e,i=r(t.history.base,Pt(),"/index.php"),v=r(p,i)||"/",n=t.resolve(v).route;return n.matched.length?n.fullPath:null},pt=D(gt());window.addEventListener("resize",()=>{pt.value=gt()});function gt(){return window.outerHeight===window.screen.height}dt(pt);var j={exports:{}},_e=j.exports,at;function be(){return at||(at=1,function(t){(function(e){if(typeof s!="function"){var s=function(d){return d};s.nonNative=!0}const r=s("plaintext"),l=s("html"),f=s("comment"),p=/<(\w*)>/g,i=/<\/?([^\s\/>]+)/;function v(d,h,g){d=d||"",h=h||[],g=g||"";let m=a(h,g);return o(d,m)}function n(d,h){d=d||[],h=h||"";let g=a(d,h);return function(m){return o(m||"",g)}}v.init_streaming_mode=n;function a(d,h){return d=c(d),{allowable_tags:d,tag_replacement:h,state:r,tag_buffer:"",depth:0,in_quote_char:""}}function o(d,h){if(typeof d!="string")throw new TypeError("'html' parameter must be a string");let g=h.allowable_tags,m=h.tag_replacement,_=h.state,S=h.tag_buffer,A=h.depth,x=h.in_quote_char,M="";for(let B=0,_t=d.length;B<_t;B++){let b=d[B];if(_===r)switch(b){case"<":_=l,S+=b;break;default:M+=b;break}else if(_===l)switch(b){case"<":if(x)break;A++;break;case">":if(x)break;if(A){A--;break}x="",_=r,S+=">",g.has(u(S))?M+=S:M+=m,S="";break;case'"':case"'":b===x?x="":x=x||b,S+=b;break;case"-":S==="<!-"&&(_=f),S+=b;break;case" ":case`
|
|
`:if(S==="<"){_=r,M+="< ",S="";break}S+=b;break;default:S+=b;break}else if(_===f)switch(b){case">":S.slice(-2)=="--"&&(_=r),S="";break;default:S+=b;break}}return h.state=_,h.tag_buffer=S,h.depth=A,h.in_quote_char=x,M}function c(d){let h=new Set;if(typeof d=="string"){let g;for(;g=p.exec(d);)h.add(g[1])}else!s.nonNative&&typeof d[s.iterator]=="function"?h=new Set(d):typeof d.forEach=="function"&&d.forEach(h.add,h);return h}function u(d){let h=i.exec(d);return h?h[1].toLowerCase():null}t.exports?t.exports=v:e.striptags=v})(_e)}(j)),j.exports}be();function vt(t){return Et()?(Ot(t),!0):!1}function C(t){return typeof t=="function"?t():Tt(t)}const rt={mounted:"inserted",unmounted:"unbind"},mt=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const xe=Object.prototype.toString,Ce=t=>xe.call(t)==="[object Object]",k=()=>{},G=Ae();function Ae(){var t,e;return mt&&((t=window?.navigator)==null?void 0:t.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window?.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window?.navigator.userAgent))}function Me(...t){if(t.length!==1)return zt(...t);const e=t[0];return typeof e=="function"?dt($t(()=>({get:e,set:k}))):D(e)}const yt=mt?window:void 0;function U(t){var e;const s=C(t);return(e=s?.$el)!=null?e:s}function N(...t){let e,s,r,l;if(typeof t[0]=="string"||Array.isArray(t[0])?([s,r,l]=t,e=yt):[e,s,r,l]=t,!e)return k;Array.isArray(s)||(s=[s]),Array.isArray(r)||(r=[r]);const f=[],p=()=>{f.forEach(a=>a()),f.length=0},i=(a,o,c,u)=>(a.addEventListener(o,c,u),()=>a.removeEventListener(o,c,u)),v=V(()=>[U(e),C(l)],([a,o])=>{if(p(),!a)return;const c=Ce(o)?{...o}:o;f.push(...s.flatMap(u=>r.map(d=>i(a,u,d,c))))},{immediate:!0,flush:"post"}),n=()=>{v(),p()};return vt(n),n}let it=!1;function ot(t,e,s={}){const{window:r=yt,ignore:l=[],capture:f=!0,detectIframe:p=!1}=s;if(!r)return k;G&&!it&&(it=!0,Array.from(r.document.body.children).forEach(d=>d.addEventListener("click",k)),r.document.documentElement.addEventListener("click",k));let i=!0;const v=d=>C(l).some(h=>{if(typeof h=="string")return Array.from(r.document.querySelectorAll(h)).some(g=>g===d.target||d.composedPath().includes(g));{const g=U(h);return g&&(d.target===g||d.composedPath().includes(g))}});function n(d){const h=C(d);return h&&h.$.subTree.shapeFlag===16}function a(d,h){const g=C(d),m=g.$.subTree&&g.$.subTree.children;return m==null||!Array.isArray(m)?!1:m.some(_=>_.el===h.target||h.composedPath().includes(_.el))}const o=d=>{const h=U(t);if(d.target!=null&&!(!(h instanceof Element)&&n(t)&&a(t,d))&&!(!h||h===d.target||d.composedPath().includes(h))){if(d.detail===0&&(i=!v(d)),!i){i=!0;return}e(d)}};let c=!1;const u=[N(r,"click",d=>{c||(c=!0,setTimeout(()=>{c=!1},0),o(d))},{passive:!0,capture:f}),N(r,"pointerdown",d=>{const h=U(t);i=!v(d)&&!!(h&&!d.composedPath().includes(h))},{passive:!0}),p&&N(r,"blur",d=>{setTimeout(()=>{var h;const g=U(t);((h=r.document.activeElement)==null?void 0:h.tagName)==="IFRAME"&&!g?.contains(r.document.activeElement)&&e(d)},0)})].filter(Boolean);return()=>u.forEach(d=>d())}const Ue={[rt.mounted](t,e){const s=!e.modifiers.bubble;if(typeof e.value=="function")t.__onClickOutside_stop=ot(t,e.value,{capture:s});else{const[r,l]=e.value;t.__onClickOutside_stop=ot(t,r,Object.assign({capture:s},l))}},[rt.unmounted](t){t.__onClickOutside_stop()}};function $(t){return typeof Window<"u"&&t instanceof Window?t.document.documentElement:typeof Document<"u"&&t instanceof Document?t.documentElement:t}function St(t){const e=window.getComputedStyle(t);if(e.overflowX==="scroll"||e.overflowY==="scroll"||e.overflowX==="auto"&&t.clientWidth<t.scrollWidth||e.overflowY==="auto"&&t.clientHeight<t.scrollHeight)return!0;{const s=t.parentNode;return!s||s.tagName==="BODY"?!1:St(s)}}function ke(t){const e=t||window.event,s=e.target;return St(s)?!1:e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)}const H=new WeakMap;function Ie(t,e=!1){const s=D(e);let r=null,l="";V(Me(t),i=>{const v=$(C(i));if(v){const n=v;if(H.get(n)||H.set(n,n.style.overflow),n.style.overflow!=="hidden"&&(l=n.style.overflow),n.style.overflow==="hidden")return s.value=!0;if(s.value)return n.style.overflow="hidden"}},{immediate:!0});const f=()=>{const i=$(C(t));!i||s.value||(G&&(r=N(i,"touchmove",v=>{ke(v)},{passive:!1})),i.style.overflow="hidden",s.value=!0)},p=()=>{const i=$(C(t));!i||!s.value||(G&&r?.(),i.style.overflow=l,H.delete(i),s.value=!1)};return vt(p),Ht({get(){return s.value},set(i){i?f():p()}})}function Ne(){let t=!1;const e=D(!1);return(s,r)=>{if(e.value=r.value,t)return;t=!0;const l=Ie(s,r.value);V(e,f=>l.value=f)}}Ne(),L(At);const Le={data(){return{hasStatus:!1,userStatus:{status:null,message:null,icon:null}}},methods:{async fetchUserStatus(t){if(!t)return;const e=ht();if(!(!Object.prototype.hasOwnProperty.call(e,"user_status")||!e.user_status.enabled)&&W())try{const{data:s}=await F.get(ut("apps/user_status/api/v1/statuses/{userId}",{userId:t})),{status:r,message:l,icon:f}=s.ocs.data;this.userStatus.status=r,this.userStatus.message=l||"",this.userStatus.icon=f||"",this.hasStatus=!0}catch(s){if(s.response.status===404&&s.response.data.ocs?.data?.length===0)return;console.error(s)}}}},wt=Wt.getBuilder("nextcloud").persist().build();function De(t){const e=wt.getItem("user-has-avatar."+t);return typeof e=="string"?!!e:null}function ct(t,e){t&&wt.setItem("user-has-avatar."+t,e)}const Be={name:"NcAvatar",directives:{ClickOutside:Ue},components:{DotsHorizontal:Nt,NcActions:It,NcButton:kt,NcIconSvgWrapper:Ut,NcLoadingIcon:Mt,NcUserStatusIcon:le},mixins:[Le],props:{url:{type:String,default:void 0},iconClass:{type:String,default:void 0},user:{type:String,default:void 0},hideStatus:{type:Boolean,default:!1},showUserStatus:{type:Boolean,default:!0},verboseStatus:{type:Boolean,default:!1},showUserStatusCompact:{type:Boolean,default:!0},preloadedUserStatus:{type:Object,default:void 0},isGuest:{type:Boolean,default:!1},displayName:{type:String,default:void 0},size:{type:Number,default:32},noPlaceholder:{type:Boolean,default:!1},allowPlaceholder:{type:Boolean,default:!0},disableTooltip:{type:Boolean,default:!1},disableMenu:{type:Boolean,default:!1},tooltipMessage:{type:String,default:null},isNoUser:{type:Boolean,default:!1},menuContainer:{type:[String,Object,Element,Boolean],default:"body"}},data(){return{avatarUrlLoaded:null,avatarSrcSetLoaded:null,userDoesNotExist:!1,isAvatarLoaded:!1,isMenuLoaded:!1,contactsMenuLoading:!1,contactsMenuData:{},contactsMenuActions:[],contactsMenuOpenState:!1}},computed:{avatarAriaLabel(){if(this.hasMenu)return this.canDisplayUserStatus||this.showUserStatusIconOnAvatar?y("Avatar of {displayName}, {status}",{displayName:this.displayName??this.user,status:ft(this.userStatus.status)}):y("Avatar of {displayName}",{displayName:this.displayName??this.user})},canDisplayUserStatus(){return!this.hideStatus&&this.showUserStatus&&this.hasStatus&&["online","away","busy","dnd"].includes(this.userStatus.status)},showUserStatusIconOnAvatar(){return!this.hideStatus&&this.showUserStatus&&!this.verboseStatus&&this.showUserStatusCompact&&this.hasStatus&&this.userStatus.status!=="dnd"&&this.userStatus.icon},userIdentifier(){return this.isDisplayNameDefined?this.displayName:this.isUserDefined?this.user:""},isUserDefined(){return typeof this.user<"u"},isDisplayNameDefined(){return typeof this.displayName<"u"},isUrlDefined(){return typeof this.url<"u"},hasMenu(){return this.disableMenu?!1:this.isMenuLoaded?this.menu.length>0:!(this.user===W()?.uid||this.userDoesNotExist||this.url)},showInitials(){return!this.noPlaceholder&&this.allowPlaceholder&&this.userDoesNotExist&&!(this.iconClass||this.$slots.icon)},avatarStyle(){return{"--size":this.size+"px",lineHeight:this.showInitials?this.size+"px":0,fontSize:Math.round(this.size*.45)+"px"}},initialsWrapperStyle(){const{r:t,g:e,b:s}=nt(this.userIdentifier);return{backgroundColor:`rgba(${t}, ${e}, ${s}, 0.1)`}},initialsStyle(){const{r:t,g:e,b:s}=nt(this.userIdentifier);return{color:`rgb(${t}, ${e}, ${s})`}},tooltip(){return this.disableTooltip?!1:this.tooltipMessage?this.tooltipMessage:this.displayName},initials(){let t="?";if(this.showInitials){const e=this.userIdentifier.trim();if(e==="")return t;const s=e.match(/[\p{L}\p{N}\s]/gu);if(s==null)return t;const r=s.join(""),l=r.lastIndexOf(" ");t=String.fromCodePoint(r.codePointAt(0)),l!==-1&&(t=t.concat(String.fromCodePoint(r.codePointAt(l+1))))}return t.toLocaleUpperCase()},menu(){const t=this.contactsMenuActions.map(s=>{const r=we(this.$router,s.hyperlink);return{ncActionComponent:r?Kt:Rt,ncActionComponentProps:r?{to:r,icon:s.icon}:{href:s.hyperlink,icon:s.icon},text:s.title}});for(const s of Se(this.contactsMenuData))try{t.push({ncActionComponent:Lt,ncActionComponentProps:{},ncActionComponentHandlers:{click:()=>s.callback(this.contactsMenuData)},text:s.displayName(this.contactsMenuData),iconSvg:s.iconSvg(this.contactsMenuData)})}catch(r){jt.error(`Failed to render ContactsMenu action ${s.id}`,{error:r,action:s})}function e(s){const r=document.createTextNode(s),l=document.createElement("p");return l.appendChild(r),l.innerHTML}if(!this.hideStatus&&this.showUserStatus&&(this.userStatus.icon||this.userStatus.message)){const s=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
|
|
<text x="50%" y="50%" text-anchor="middle" style="dominant-baseline: central; font-size: 85%">${e(this.userStatus.icon)}</text>
|
|
</svg>`;return[{ncActionComponent:ne,ncActionComponentProps:{},iconSvg:this.userStatus.icon?s:void 0,text:`${this.userStatus.message}`}].concat(t)}return t}},watch:{url(){this.userDoesNotExist=!1,this.loadAvatarUrl()},user(){this.userDoesNotExist=!1,this.isMenuLoaded=!1,this.loadAvatarUrl()}},mounted(){this.loadAvatarUrl(),T("settings:avatar:updated",this.loadAvatarUrl),T("settings:display-name:updated",this.loadAvatarUrl),!this.hideStatus&&this.showUserStatus&&this.user&&!this.isNoUser&&(this.preloadedUserStatus?(this.userStatus.status=this.preloadedUserStatus.status||"",this.userStatus.message=this.preloadedUserStatus.message||"",this.userStatus.icon=this.preloadedUserStatus.icon||"",this.hasStatus=this.preloadedUserStatus.status!==null):this.fetchUserStatus(this.user),T("user_status:status.updated",this.handleUserStatusUpdated))},beforeDestroy(){P("settings:avatar:updated",this.loadAvatarUrl),P("settings:display-name:updated",this.loadAvatarUrl),P("user_status:status.updated",this.handleUserStatusUpdated)},methods:{t:y,handleUserStatusUpdated(t){this.user===t.userId&&(this.userStatus={status:t.status,icon:t.icon,message:t.message})},async toggleMenu(t){t.type==="keydown"&&t.key!=="Enter"||(this.contactsMenuOpenState||await this.fetchContactsMenu(),this.contactsMenuOpenState=!this.contactsMenuOpenState)},closeMenu(){this.contactsMenuOpenState=!1},async fetchContactsMenu(){this.contactsMenuLoading=!0;try{const t=encodeURIComponent(this.user),{data:e}=await F.post(lt("contactsmenu/findOne"),`shareType=0&shareWith=${t}`);this.contactsMenuData=e,this.contactsMenuActions=e.topAction?[e.topAction].concat(e.actions):e.actions}catch{this.contactsMenuOpenState=!1}this.contactsMenuLoading=!1,this.isMenuLoaded=!0},loadAvatarUrl(){if(this.isAvatarLoaded=!1,!this.isUrlDefined&&(!this.isUserDefined||this.isNoUser||this.iconClass)){this.isAvatarLoaded=!0,this.userDoesNotExist=!0;return}if(this.isUrlDefined){this.updateImageIfValid(this.url);return}if(this.size<=64){const t=this.avatarUrlGenerator(this.user,64),e=[t+" 1x",this.avatarUrlGenerator(this.user,512)+" 8x"].join(", ");this.updateImageIfValid(t,e)}else{const t=this.avatarUrlGenerator(this.user,512);this.updateImageIfValid(t)}},avatarUrlGenerator(t,e){let s=ye(t,e,this.isGuest);return t===W()?.uid&&typeof oc_userconfig<"u"&&(s+="?v="+oc_userconfig.avatar.version),s},updateImageIfValid(t,e=null){const s=De(this.user);if(this.isUserDefined&&typeof s=="boolean"){this.isAvatarLoaded=!0,this.avatarUrlLoaded=t,e&&(this.avatarSrcSetLoaded=e),s===!1&&(this.userDoesNotExist=!0);return}const r=new Image;r.onload=()=>{this.avatarUrlLoaded=t,e&&(this.avatarSrcSetLoaded=e),this.isAvatarLoaded=!0,ct(this.user,!0)},r.onerror=()=>{console.debug("Invalid avatar url",t),this.avatarUrlLoaded=null,this.avatarSrcSetLoaded=null,this.userDoesNotExist=!0,this.isAvatarLoaded=!1,ct(this.user,!1)},e&&(r.srcset=e),r.src=t}}};var Pe=function(){var t=this,e=t._self._c;return e("span",{directives:[{name:"click-outside",rawName:"v-click-outside",value:t.closeMenu,expression:"closeMenu"}],ref:"main",staticClass:"avatardiv popovermenu-wrapper",class:{"avatardiv--unknown":t.userDoesNotExist,"avatardiv--with-menu":t.hasMenu,"avatardiv--with-menu-loading":t.contactsMenuLoading},style:t.avatarStyle,attrs:{title:t.tooltip}},[t._t("icon",function(){return[t.iconClass?e("span",{staticClass:"avatar-class-icon",class:t.iconClass}):t.isAvatarLoaded&&!t.userDoesNotExist?e("img",{attrs:{src:t.avatarUrlLoaded,srcset:t.avatarSrcSetLoaded,alt:""}}):t._e()]}),t.hasMenu&&t.menu.length===0?e("NcButton",{staticClass:"action-item action-item__menutoggle",attrs:{"aria-label":t.avatarAriaLabel,variant:"tertiary-no-background"},on:{click:t.toggleMenu},scopedSlots:t._u([{key:"icon",fn:function(){return[t.contactsMenuLoading?e("NcLoadingIcon"):e("DotsHorizontal",{attrs:{size:20}})]},proxy:!0}],null,!1,2617833509)}):t.hasMenu?e("NcActions",{attrs:{"aria-label":t.avatarAriaLabel,container:t.menuContainer,"force-menu":"","manual-open":"",open:t.contactsMenuOpenState,variant:"tertiary-no-background"},on:{"update:open":function(s){t.contactsMenuOpenState=s},click:t.toggleMenu},scopedSlots:t._u([t.contactsMenuLoading?{key:"icon",fn:function(){return[e("NcLoadingIcon")]},proxy:!0}:null],null,!0)},t._l(t.menu,function(s,r){return e(s.ncActionComponent,t._g(t._b({key:r,tag:"component",scopedSlots:t._u([s.iconSvg?{key:"icon",fn:function(){return[e("NcIconSvgWrapper",{attrs:{svg:s.iconSvg}})]},proxy:!0}:null],null,!0)},"component",s.ncActionComponentProps,!1),s.ncActionComponentHandlers),[t._v(" "+t._s(s.text)+" ")])}),1):t._e(),t.showUserStatusIconOnAvatar?e("span",{staticClass:"avatardiv__user-status avatardiv__user-status--icon"},[t._v(" "+t._s(t.userStatus.icon)+" ")]):t.canDisplayUserStatus?e("NcUserStatusIcon",{staticClass:"avatardiv__user-status",attrs:{status:t.userStatus.status,"aria-hidden":String(t.hasMenu)}}):t._e(),t.showInitials?e("span",{staticClass:"avatardiv__initials-wrapper",style:t.initialsWrapperStyle},[e("span",{staticClass:"avatardiv__initials",style:t.initialsStyle},[t._v(" "+t._s(t.initials)+" ")])]):t._e()],2)},Te=[],Ee=I(Be,Pe,Te,!1,null,"f132fa9c");const je=Ee.exports;export{w as C,je as N,Rt as a,Kt as b,jt as l,Le as u};
|
|
//# sourceMappingURL=NcAvatar-YSp2ORHc-k3rtAvRh.chunk.mjs.map
|