import{r as xe,a as He,o as J,w as ne,b as ce,e as de,f as _e,g as le,t as z,h as Se,F as pi,i as Re,j as hi,k as mi,c as fi}from"./style-DK3b3yEc.chunk.mjs";import{t as S,_ as gi,N as vi,a as ki,b as yi,s as Ee,c as Pe,d as xi,v as _i,l as Si}from"./index-Dh8t1o6F-C2aJvLpY.chunk.mjs";import{B as K}from"./BrowserStorage-PqkYeaDj.chunk.mjs";import"./vite-preload-helper-B9rAsR6N.chunk.mjs";var Ei="2.0.8",Ni=500,je="user-agent",Y="",Ge="?",f={FUNCTION:"function",OBJECT:"object",STRING:"string",UNDEFINED:"undefined"},y="browser",D="cpu",I="device",N="engine",_="os",G="result",o="name",i="type",a="vendor",r="version",k="architecture",re="major",t="model",me="console",b="mobile",m="tablet",g="smarttv",C="wearable",be="xr",ae="embedded",H="inapp",Be="brands",B="formFactors",Fe="fullVersionList",W="platform",ze="platformVersion",ke="bitness",L="sec-ch-ua",Ci=L+"-full-version-list",Ii=L+"-arch",Ti=L+"-"+ke,Oi=L+"-form-factors",Di=L+"-"+b,Ui=L+"-"+t,di=L+"-"+W,Vi=di+"-version",li=[Be,Fe,b,t,W,ze,k,B,ke],we="Amazon",R="Apple",We="ASUS",Ye="BlackBerry",A="Google",$e="Huawei",Ne="Lenovo",Xe="Honor",ue="LG",Ce="Microsoft",Ie="Motorola",Je="Nvidia",Ke="OnePlus",Te="OPPO",Z="Samsung",Ze="Sharp",Q="Sony",Oe="Xiaomi",De="Zebra",Qe="Chrome",ei="Chromium",V="Chromecast",fe="Edge",ee="Firefox",P="Opera",Ue="Facebook",ii="Sogou",j="Mobile ",ie=" Browser",Le="Windows",qi=typeof window!==f.UNDEFINED,x=qi&&window.navigator?window.navigator:void 0,F=x&&x.userAgentData?x.userAgentData:void 0,Mi=function(e,s){var n={},d=s;if(!ge(s)){d={};for(var w in s)for(var l in s[w])d[l]=s[w][l].concat(d[l]?d[l]:[])}for(var c in e)n[c]=d[c]&&d[c].length%2===0?d[c].concat(e[c]):e[c];return n},pe=function(e){for(var s={},n=0;n0){for(var n in e)if(M(s)==M(e[n]))return!0;return!1}return se(e)?M(s)==M(e):!1},ge=function(e,s){for(var n in e)return/^(browser|cpu|device|engine|os)$/.test(n)||(s?ge(e[n]):!1)},se=function(e){return typeof e===f.STRING},Ve=function(e){if(e){for(var s=[],n=$(/\\?\"/g,e).split(","),d=0;d-1){var w=ve(n[d]).split(";v=");s[d]={brand:w[0],version:w[1]}}else s[d]=ve(n[d]);return s}},M=function(e){return se(e)?e.toLowerCase():e},qe=function(e){return se(e)?$(/[^\d\.]/g,e).split(".")[0]:void 0},U=function(e){for(var s in e)if(e.hasOwnProperty(s)){var n=e[s];typeof n==f.OBJECT&&n.length==2?this[n[0]]=n[1]:this[n]=void 0}return this},$=function(e,s){return se(s)?s.replace(e,Y):s},te=function(e){return $(/\\?\"/g,e)},ve=function(e,s){return e=$(/^\s\s*/,String(e)),typeof s===f.UNDEFINED?e:e.substring(0,s)},Me=function(e,s){if(!(!e||!s))for(var n=0,d,w,l,c,h,u;n0?c.length===2?typeof c[1]==f.FUNCTION?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:c.length>=3&&(typeof c[1]===f.FUNCTION&&!(c[1].exec&&c[1].test)?c.length>3?this[c[0]]=u?c[1].apply(this,c.slice(2)):void 0:this[c[0]]=u?c[1].call(this,u,c[2]):void 0:c.length==3?this[c[0]]=u?u.replace(c[1],c[2]):void 0:c.length==4?this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):void 0:c.length>4&&(this[c[0]]=u?c[3].apply(this,[u.replace(c[1],c[2])].concat(c.slice(4))):void 0)):this[c]=u||void 0;n+=2}},E=function(e,s){for(var n in s)if(typeof s[n]===f.OBJECT&&s[n].length>0){for(var d=0;d2&&this.set(t,"iPad").set(i,m);break;case _:!this.get(o)&&F&&F[W]&&this.set(o,F[W]);break;case G:var e=this.data,s=function(n){return e[n].getItem().detectFeature().get()};this.set(y,s(y)).set(D,s(D)).set(I,s(I)).set(N,s(N)).set(_,s(_))}return this},q.prototype.parseUA=function(){switch(this.itemType!=G&&Me.call(this.data,this.ua,this.rgxMap),this.itemType){case y:this.set(re,qe(this.get(r)));break;case _:if(this.get(o)=="iOS"&&this.get(r)=="18.6"){var e=/\) Version\/([\d\.]+)/.exec(this.ua);e&&parseInt(e[1].substring(0,2),10)>=26&&this.set(r,e[1])}break}return this},q.prototype.parseCH=function(){var e=this.uaCH,s=this.rgxMap;switch(this.itemType){case y:case N:var n=e[Fe]||e[Be],d;if(n)for(var w=0;w=13?"11":"10"),this.set(o,T).set(r,ye)}this.get(o)==Le&&e[t]=="Xbox"&&this.set(o,"Xbox").set(r,void 0);break;case G:var wi=this.data,X=function(ui){return wi[ui].getItem().setCH(e).parseCH().get()};this.set(y,X(y)).set(D,X(D)).set(I,X(I)).set(N,X(N)).set(_,X(_))}return this};function O(e,s,n){if(typeof e===f.OBJECT?(ge(e,!0)?(typeof s===f.OBJECT&&(n=s),s=e):(n=e,s=void 0),e=void 0):typeof e===f.STRING&&!ge(s,!0)&&(n=s,s=void 0),n)if(typeof n.append===f.FUNCTION){var d={};n.forEach(function(v,T){d[String(T).toLowerCase()]=v}),n=d}else{var w={};for(var l in n)n.hasOwnProperty(l)&&(w[String(l).toLowerCase()]=n[l]);n=w}if(!(this instanceof O))return new O(e,s,n).getResult();var c=typeof e===f.STRING?e:n&&n[je]?n[je]:x&&x.userAgent?x.userAgent:Y,h=new bi(n,!0),u=s?Mi(ai,s):ai,p=function(v){return v==G?function(){return new q(v,c,u,h).set("ua",c).set(y,this.getBrowser()).set(D,this.getCPU()).set(I,this.getDevice()).set(N,this.getEngine()).set(_,this.getOS()).get()}:function(){return new q(v,c,u[v],h).parseUA().get()}};return U.call(this,[["getBrowser",p(y)],["getCPU",p(D)],["getDevice",p(I)],["getEngine",p(N)],["getOS",p(_)],["getResult",p(G)],["getUA",function(){return c}],["setUA",function(v){return se(v)&&(c=ve(v,Ni)),this}]]).setUA(c),this}O.VERSION=Ei,O.BROWSER=pe([o,r,re,i]),O.CPU=pe([k]),O.DEVICE=pe([t,a,i,me,b,g,m,C,ae]),O.ENGINE=O.OS=pe([o,r]);const oe={EMAIL_SEND_OFF:0,EMAIL_SEND_HOURLY:1,EMAIL_SEND_3HOURLY:2,EMAIL_SEND_DAILY:3,EMAIL_SEND_WEEKLY:4},ri=[{label:S("notifications","Never"),value:oe.EMAIL_SEND_OFF},{label:S("notifications","1 hour"),value:oe.EMAIL_SEND_HOURLY},{label:S("notifications","3 hours"),value:oe.EMAIL_SEND_3HOURLY},{label:S("notifications","1 day"),value:oe.EMAIL_SEND_DAILY},{label:S("notifications","1 week"),value:oe.EMAIL_SEND_WEEKLY}],si={id:null,label:S("notifications","None")},Bi=new O,ni=Bi.getBrowser(),ci=ni.name==="Safari"||ni.name==="Mobile Safari",Fi={name:"UserSettings",components:{NcCheckboxRadioSwitch:yi,NcSelect:ki,NcSettingsSection:vi},setup(){var w;const e=Re(Si("notifications","config")),s=Re({secondary_speaker:K.getItem("secondary_speaker")==="true",secondary_speaker_device:(w=JSON.parse(K.getItem("secondary_speaker_device")))!=null?w:si}),n=hi([]),d=mi({get(){return ri.find(({value:l})=>l===e.setting_batchtime)},set({value:l}){e.setting_batchtime=l}});return{BATCHTIME_OPTIONS:ri,isSafari:ci,config:e,currentBatchTime:d,devices:n,storage:s}},methods:{t:S,async updateSettings(){try{const e=new FormData;e.append("batchSetting",this.config.setting_batchtime),e.append("soundNotification",this.config.sound_notification?"yes":"no"),e.append("soundTalk",this.config.sound_talk?"yes":"no"),await xi.post(_i("apps/notifications/api/v2/settings"),e),Pe(S("notifications","Your settings have been updated."))}catch(e){Ee(S("notifications","An error occurred while updating your settings.")),console.error(e)}},updateLocalSettings(){try{K.setItem("secondary_speaker",this.storage.secondary_speaker),this.storage.secondary_speaker&&this.storage.secondary_speaker_device.id?K.setItem("secondary_speaker_device",JSON.stringify(this.storage.secondary_speaker_device)):K.removeItem("secondary_speaker_device"),Pe(S("notifications","Your settings have been updated."))}catch(e){Ee(S("notifications","An error occurred while updating your settings.")),console.error(e)}},async initializeDevices(){var s,n,d;if(!(!ci&&((s=navigator==null?void 0:navigator.mediaDevices)!=null&&s.getUserMedia)&&((n=navigator==null?void 0:navigator.mediaDevices)!=null&&n.enumerateDevices))||this.devices.length>0)return;let e=null;try{e=await navigator.mediaDevices.getUserMedia({audio:!0}),this.devices=((d=await navigator.mediaDevices.enumerateDevices())!=null?d:[]).filter(w=>w.kind==="audiooutput").map(w=>({id:w.deviceId,label:w.label?w.label:w.fallbackLabel})).concat([si])}catch(w){Ee(S("notifications","An error occurred while updating your settings.")),console.error("Error while requesting or initializing audio devices: ",w)}finally{e&&e.getTracks().forEach(w=>w.stop())}}}},zi={class:"notification-frequency__warning"},Hi={key:0},Ri={class:"notification-frequency__wrapper"},Pi={for:"notification_reminder_batchtime",class:"notification-frequency__label"},ji={key:0,class:"notification-frequency__warning"};function Gi(e,s,n,d,w,l){const c=xe("NcSelect"),h=xe("NcCheckboxRadioSwitch"),u=xe("NcSettingsSection");return J(),He(u,{name:l.t("notifications","Notifications")},{default:ne(()=>[ce("div",zi,[d.config.is_email_set?le("",!0):(J(),_e("strong",Hi,z(l.t("notifications","You need to set up your email address before you can receive notification emails.")),1))]),ce("div",Ri,[ce("label",Pi,z(l.t("notifications","Send email reminders about unhandled notifications after:")),1),de(c,{id:"notification_reminder_batchtime",modelValue:d.currentBatchTime,"onUpdate:modelValue":[s[0]||(s[0]=p=>d.currentBatchTime=p),l.updateSettings],class:"notification-frequency__select",clearable:!1,"label-outside":"",options:d.BATCHTIME_OPTIONS},null,8,["modelValue","options","onUpdate:modelValue"])]),de(h,{modelValue:d.config.sound_notification,"onUpdate:modelValue":[s[1]||(s[1]=p=>d.config.sound_notification=p),l.updateSettings]},{default:ne(()=>[Se(z(l.t("notifications","Play sound when a new notification arrives")),1)]),_:1},8,["modelValue","onUpdate:modelValue"]),de(h,{modelValue:d.config.sound_talk,"onUpdate:modelValue":[s[2]||(s[2]=p=>d.config.sound_talk=p),l.updateSettings]},{default:ne(()=>[Se(z(l.t("notifications","Play sound when a call started (requires Nextcloud Talk)")),1)]),_:1},8,["modelValue","onUpdate:modelValue"]),d.config.sound_talk?(J(),_e(pi,{key:0},[de(h,{modelValue:d.storage.secondary_speaker,"onUpdate:modelValue":[s[3]||(s[3]=p=>d.storage.secondary_speaker=p),l.updateLocalSettings],class:"additional-margin-top",disabled:d.isSafari},{default:ne(()=>[Se(z(l.t("notifications","Also repeat sound on a secondary speaker")),1)]),_:1},8,["modelValue","disabled","onUpdate:modelValue"]),d.isSafari?(J(),_e("div",ji,[ce("strong",null,z(l.t("notifications","Selection of the speaker device is currently not supported by Safari")),1)])):le("",!0),!d.isSafari&&d.storage.secondary_speaker?(J(),He(c,{key:1,modelValue:d.storage.secondary_speaker_device,"onUpdate:modelValue":[s[4]||(s[4]=p=>d.storage.secondary_speaker_device=p),l.updateLocalSettings],"input-id":"device-selector-audio-output",options:d.devices,label:"label","aria-label-combobox":l.t("notifications","Select a device"),clearable:!1,placeholder:l.t("notifications","Select a device"),onOpen:l.initializeDevices},null,8,["modelValue","options","aria-label-combobox","placeholder","onOpen","onUpdate:modelValue"])):le("",!0)],64)):le("",!0)]),_:1},8,["name"])}const Wi=gi(Fi,[["render",Gi],["__scopeId","data-v-490e4c78"]]);fi(Wi).mount("#notifications-user-settings"); //# sourceMappingURL=notifications-settings.mjs.map