/*! For license information please see theming-personal-theming.js.LICENSE.txt */ !function(){"use strict";var e,n={70559:function(e,n,r){var a=r(20144),o=r(79753),i=r(79954),c=r(4820),s=r(20571),u=r.n(s),l=r(13299),d=r.n(l),g=r(80419),h=r(82675),p=r(20296),m=r.n(p),f=r(69867),b=r.n(f),A=r(1082),v=r.n(A),k=(r(97248),r(26932)),C=r(45994);function _(e,t,n,r,a,o,i){try{var c=e[o](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,a)}function y(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){_(o,r,a,i,c,"next",e)}function c(e){_(o,r,a,i,c,"throw",e)}i(void 0)}))}}function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n.6},calculateLuma:function(e){var t,n,r=(t=this.hexToRGB(e),n=3,function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,o,i,c=[],s=!0,u=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(r=o.call(n)).done)&&(c.push(r.value),c.length!==t);s=!0);}catch(e){u=!0,a=e}finally{try{if(!s&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(u)throw a}}return c}}(t,n)||function(e,t){if(e){if("string"==typeof e)return w(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?w(e,t):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}());return(.2126*r[0]+.7152*r[1]+.0722*r[2])/255},hexToRGB:function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]:null},update:function(e){var t=this;return y(regeneratorRuntime.mark((function n(){return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:t.backgroundImage=e.backgroundImage,t.Theming.color=e.backgroundColor,t.$emit("update:background"),t.loading=!1;case 4:case"end":return n.stop()}}),n)})))()},setDefault:function(){var e=this;return y(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.loading="default",t.next=3,c.default.post((0,o.generateUrl)("/apps/theming/background/default"));case 3:n=t.sent,e.update(n.data);case 5:case"end":return t.stop()}}),t)})))()},setShipped:function(e){var t=this;return y(regeneratorRuntime.mark((function n(){var r;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t.loading=e,n.next=3,c.default.post((0,o.generateUrl)("/apps/theming/background/shipped"),{value:e});case 3:r=n.sent,t.update(r.data);case 5:case"end":return n.stop()}}),n)})))()},setFile:function(e){var t=arguments,n=this;return y(regeneratorRuntime.mark((function r(){var a,i;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=t.length>1&&void 0!==t[1]?t[1]:null,n.loading="custom",r.next=4,c.default.post((0,o.generateUrl)("/apps/theming/background/custom"),{value:e,color:a});case 4:i=r.sent,n.update(i.data);case 6:case"end":return r.stop()}}),r)})))()},removeBackground:function(){var e=this;return y(regeneratorRuntime.mark((function t(){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e.loading="remove",t.next=3,c.default.delete((0,o.generateUrl)("/apps/theming/background/custom"));case 3:n=t.sent,e.update(n.data);case 5:case"end":return t.stop()}}),t)})))()},pickColor:function(e){var t=this;return y(regeneratorRuntime.mark((function n(){var r,a,i,s,u;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return t.loading="color",s=(null==e||null===(r=e.target)||void 0===r||null===(a=r.dataset)||void 0===a?void 0:a.color)||(null===(i=t.Theming)||void 0===i?void 0:i.color)||"#0082c9",n.next=4,c.default.post((0,o.generateUrl)("/apps/theming/background/color"),{color:s});case 4:u=n.sent,t.update(u.data);case 6:case"end":return n.stop()}}),n)})))()},debouncePickColor:m()((function(){this.pickColor.apply(this,arguments)}),200),pickFile:function(){var e=this;return y(regeneratorRuntime.mark((function t(){var n,r,a,i,s,u,l;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,D.pick();case 2:return n=t.sent,e.loading="custom",r=null,a=null,t.prev=6,s=(0,o.generateRemoteUrl)("dav/files/"+(0,C.ts)().uid+n),t.next=10,c.default.get(s,{responseType:"blob"});case 10:return r=t.sent,u=URL.createObjectURL(r.data),t.next=14,e.getColorPaletteFromBlob(u);case 14:l=t.sent,a=null==l||null===(i=l.DarkVibrant)||void 0===i?void 0:i.hex,e.setFile(n,a),console.debug("Extracted colour",a,"from custom image",n,l),t.next=24;break;case 20:t.prev=20,t.t0=t.catch(6),e.setFile(n),console.error("Unable to extract colour from custom image",{error:t.t0,path:n,response:r,color:a});case 24:case"end":return t.stop()}}),t,null,[[6,20]])})))()},getColorPaletteFromBlob:function(e){return new Promise((function(t,n){new(v())(e).getPalette((function(e,r){e&&n(e),t(r)}))}))}}},P=j,E=r(93379),R=r.n(E),O=r(7795),U=r.n(O),G=r(90569),Z=r.n(G),F=r(3565),q=r.n(F),L=r(19216),N=r.n(L),M=r(44589),$=r.n(M),z=r(11504),W={};W.styleTagTransform=$(),W.setAttributes=q(),W.insert=Z().bind(null,"head"),W.domAPI=U(),W.insertStyleElement=N(),R()(z.Z,W),z.Z&&z.Z.locals&&z.Z.locals;var K=r(51900),Y=(0,K.Z)(P,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"background-selector",attrs:{"data-user-theming-background-settings":""}},[t("button",{staticClass:"background background__filepicker",class:{"icon-loading":"custom"===e.loading,"background--active":"custom"===e.backgroundImage},attrs:{"data-color-bright":e.invertTextColor(e.Theming.color),"data-user-theming-background-custom":"",tabindex:"0"},on:{click:e.pickFile}},[e._v("\n\t\t"+e._s(e.t("theming","Custom background"))+"\n\t\t"),t("Check",{attrs:{size:44}})],1),e._v(" "),t("button",{staticClass:"background background__default",class:{"icon-loading":"default"===e.loading,"background--active":"default"===e.backgroundImage},style:{"--border-color":e.Theming.defaultColor},attrs:{"data-color-bright":e.invertTextColor(e.Theming.defaultColor),"data-user-theming-background-default":"",tabindex:"0"},on:{click:e.setDefault}},[e._v("\n\t\t"+e._s(e.t("theming","Default background"))+"\n\t\t"),t("Check",{attrs:{size:44}})],1),e._v(" "),t("NcColorPicker",{on:{input:e.debouncePickColor},model:{value:e.Theming.color,callback:function(t){e.$set(e.Theming,"color",t)},expression:"Theming.color"}},[t("button",{staticClass:"background background__color",style:{backgroundColor:e.Theming.color,"--border-color":e.Theming.color},attrs:{"data-color":e.Theming.color,"data-color-bright":e.invertTextColor(e.Theming.color),"data-user-theming-background-color":"",tabindex:"0"}},[e._v("\n\t\t\t"+e._s(e.t("theming","Change color"))+"\n\t\t")])]),e._v(" "),e._l(e.shippedBackgrounds,(function(n){return t("button",{key:n.name,staticClass:"background background__shipped",class:{"icon-loading":e.loading===n.name,"background--active":e.backgroundImage===n.name},style:{backgroundImage:"url("+n.preview+")","--border-color":n.details.primary_color},attrs:{title:n.details.attribution,"aria-label":n.details.attribution,"data-color-bright":"dark"===n.details.theming,"data-user-theming-background-shipped":n.name,tabindex:"0"},on:{click:function(t){return e.setShipped(n.name)}}},[t("Check",{attrs:{size:44}})],1)})),e._v(" "),t("button",{staticClass:"background background__delete",attrs:{"data-user-theming-background-clear":"",tabindex:"0"},on:{click:e.removeBackground}},[e._v("\n\t\t"+e._s(e.t("theming","Remove background"))+"\n\t\t"),t("Close",{attrs:{size:32}})],1)],2)}),[],!1,null,"191b6201",null).exports,H={name:"ItemPreview",components:{NcCheckboxRadioSwitch:u()},props:{enforced:{type:Boolean,default:!1},selected:{type:Boolean,default:!1},theme:{type:Object,required:!0},type:{type:String,default:""},unique:{type:Boolean,default:!1}},computed:{switchType:function(){return this.unique?"switch":"radio"},name:function(){return this.unique?null:this.type},img:function(){return(0,o.generateFilePath)("theming","img",this.theme.id+".jpg")},checked:{get:function(){return this.selected},set:function(e){console.debug("Changed theme",this.theme.id,e),this.unique?this.$emit("change",{enabled:!0===e,id:this.theme.id}):this.$emit("change",{enabled:!0,id:this.theme.id})}}},methods:{onToggle:function(){"radio"!==this.switchType?this.checked=!this.checked:this.checked=!0}}},V=r(71473),Q={};Q.styleTagTransform=$(),Q.setAttributes=q(),Q.insert=Z().bind(null,"head"),Q.domAPI=U(),Q.insertStyleElement=N(),R()(V.Z,Q),V.Z&&V.Z.locals&&V.Z.locals;var J=(0,K.Z)(H,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"theming__preview",class:"theming__preview--"+e.theme.id},[t("div",{staticClass:"theming__preview-image",style:{backgroundImage:"url("+e.img+")"},on:{click:e.onToggle}}),e._v(" "),t("div",{staticClass:"theming__preview-description"},[t("h3",[e._v(e._s(e.theme.title))]),e._v(" "),t("p",[e._v(e._s(e.theme.description))]),e._v(" "),e.enforced?t("span",{staticClass:"theming__preview-warning",attrs:{role:"note"}},[e._v("\n\t\t\t"+e._s(e.t("theming","Theme selection is enforced"))+"\n\t\t")]):e._e(),e._v(" "),t("NcCheckboxRadioSwitch",{staticClass:"theming__preview-toggle",attrs:{checked:e.checked,disabled:e.enforced,name:e.name,type:e.switchType},on:{"update:checked":function(t){e.checked=t}}},[e._v("\n\t\t\t"+e._s(e.theme.enableLabel)+"\n\t\t")])],1)])}),[],!1,null,"37ca8ab2",null).exports;function X(e,t,n,r,a,o,i){try{var c=e[o](i),s=c.value}catch(e){return void n(e)}c.done?t(s):Promise.resolve(s).then(r,a)}function ee(e){return function(){var t=this,n=arguments;return new Promise((function(r,a){var o=e.apply(t,n);function i(e){X(o,r,a,i,c,"next",e)}function c(e){X(o,r,a,i,c,"throw",e)}i(void 0)}))}}function te(e){return function(e){if(Array.isArray(e))return ne(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return ne(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?ne(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ne(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n")},guidelinesLink:function(){return''},descriptionDetail:function(){return t("theming","If you find any issues, do not hesitate to report them on {issuetracker}our issue tracker{linkend}. And if you want to get involved, come join {designteam}our design team{linkend}!").replace("{issuetracker}",this.issuetrackerLink).replace("{designteam}",this.designteamLink).replace(/\{linkend\}/g,"")},issuetrackerLink:function(){return''},designteamLink:function(){return''}},watch:{shortcutsDisabled:function(e){this.changeShortcutsDisabled(e)}},methods:{refreshGlobalStyles:function(){te(document.head.querySelectorAll("link.theme")).forEach((function(e){var t=new URL(e.href);t.searchParams.set("v",Date.now());var n=e.cloneNode();n.href=t.toString(),n.onload=function(){return e.remove()},document.head.append(n)}))},updateBackground:function(e){this.background="custom"===e.type||"default"===e.type?e.type:e.value,this.refreshGlobalStyles()},changeTheme:function(e){var t=e.enabled,n=e.id;this.themes.forEach((function(e){e.id===n&&t?e.enabled=!0:e.enabled=!1})),this.updateBodyAttributes(),this.selectItem(t,n)},changeFont:function(e){var t=e.enabled,n=e.id;this.fonts.forEach((function(e){e.id===n&&t?e.enabled=!0:e.enabled=!1})),this.updateBodyAttributes(),this.selectItem(t,n)},changeShortcutsDisabled:function(e){return ee(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!e){t.next=5;break}return t.next=3,(0,c.default)({url:(0,o.generateOcsUrl)("apps/provisioning_api/api/v1/config/users/{appId}/{configKey}",{appId:"theming",configKey:"shortcuts_disabled"}),data:{configValue:"yes"},method:"POST"});case 3:t.next=7;break;case 5:return t.next=7,(0,c.default)({url:(0,o.generateOcsUrl)("apps/provisioning_api/api/v1/config/users/{appId}/{configKey}",{appId:"theming",configKey:"shortcuts_disabled"}),method:"DELETE"});case 7:case"end":return t.stop()}}),t)})))()},updateBodyAttributes:function(){var e=this.themes.filter((function(e){return!0===e.enabled})).map((function(e){return e.id})),t=this.fonts.filter((function(e){return!0===e.enabled})).map((function(e){return e.id}));this.themes.forEach((function(e){document.body.toggleAttribute("data-theme-".concat(e.id),e.enabled)})),this.fonts.forEach((function(e){document.body.toggleAttribute("data-theme-".concat(e.id),e.enabled)})),document.body.setAttribute("data-themes",[].concat(te(e),te(t)).join(","))},selectItem:function(e,n){return ee(regeneratorRuntime.mark((function r(){return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,!e){r.next=6;break}return r.next=4,(0,c.default)({url:(0,o.generateOcsUrl)("apps/theming/api/v1/theme/{themeId}/enable",{themeId:n}),method:"PUT"});case 4:r.next=8;break;case 6:return r.next=8,(0,c.default)({url:(0,o.generateOcsUrl)("apps/theming/api/v1/theme/{themeId}",{themeId:n}),method:"DELETE"});case 8:r.next=14;break;case 10:r.prev=10,r.t0=r.catch(0),console.error(r.t0,r.t0.response),OC.Notification.showTemporary(t("theming",r.t0.response.data.ocs.meta.message+". Unable to apply the setting."));case 14:case"end":return r.stop()}}),r,null,[[0,10]])})))()}}},se=r(10959),ue={};ue.styleTagTransform=$(),ue.setAttributes=q(),ue.insert=Z().bind(null,"head"),ue.domAPI=U(),ue.insertStyleElement=N(),R()(se.Z,ue),se.Z&&se.Z.locals&&se.Z.locals;var le=(0,K.Z)(ce,(function(){var e=this,t=e._self._c;return t("section",[t("NcSettingsSection",{staticClass:"theming",attrs:{title:e.t("theming","Appearance and accessibility"),"limit-width":!1}},[t("p",{domProps:{innerHTML:e._s(e.description)}}),e._v(" "),t("p",{domProps:{innerHTML:e._s(e.descriptionDetail)}}),e._v(" "),t("div",{staticClass:"theming__preview-list"},e._l(e.themes,(function(n){return t("ItemPreview",{key:n.id,attrs:{enforced:n.id===e.enforceTheme,selected:e.selectedTheme.id===n.id,theme:n,unique:1===e.themes.length,type:"theme"},on:{change:e.changeTheme}})})),1),e._v(" "),t("div",{staticClass:"theming__preview-list"},e._l(e.fonts,(function(n){return t("ItemPreview",{key:n.id,attrs:{selected:n.enabled,theme:n,unique:1===e.fonts.length,type:"font"},on:{change:e.changeFont}})})),1)]),e._v(" "),t("NcSettingsSection",{attrs:{title:e.t("theming","Keyboard shortcuts")}},[t("p",[e._v(e._s(e.t("theming","In some cases keyboard shortcuts can interfere with accessibility tools. In order to allow focusing on your tool correctly you can disable all keyboard shortcuts here. This will also disable all available shortcuts in apps.")))]),e._v(" "),t("NcCheckboxRadioSwitch",{staticClass:"theming__preview-toggle",attrs:{checked:e.shortcutsDisabled,name:"shortcuts_disabled",type:"switch"},on:{"update:checked":function(t){e.shortcutsDisabled=t},change:e.changeShortcutsDisabled}},[e._v("\n\t\t\t"+e._s(e.t("theming","Disable all keyboard shortcuts"))+"\n\t\t")])],1),e._v(" "),t("NcSettingsSection",{staticClass:"background",attrs:{title:e.t("theming","Background"),"data-user-theming-background-disabled":""}},[e.isUserThemingDisabled?[t("p",[e._v(e._s(e.t("theming","Customization has been disabled by your administrator")))])]:[t("p",[e._v(e._s(e.t("theming","Set a custom background")))]),e._v(" "),t("BackgroundSettings",{staticClass:"background__grid",on:{"update:background":e.refreshGlobalStyles}})]],2)],1)}),[],!1,null,"39686eeb",null).exports;function de(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n=o)&&Object.keys(a.O).every((function(e){return a.O[e](n[s])}))?n.splice(s--,1):(c=!1,o0&&e[l-1][2]>o;l--)e[l]=e[l-1];e[l]=[n,r,o]},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,{a:t}),t},a.d=function(e,t){for(var n in t)a.o(t,n)&&!a.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},a.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),a.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},a.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},a.nmd=function(e){return e.paths=[],e.children||(e.children=[]),e},a.j=1474,function(){a.b=document.baseURI||self.location.href;var e={1474:0};a.O.j=function(t){return 0===e[t]};var t=function(t,n){var r,o,i=n[0],c=n[1],s=n[2],u=0;if(i.some((function(t){return 0!==e[t]}))){for(r in c)a.o(c,r)&&(a.m[r]=c[r]);if(s)var l=s(a)}for(t&&t(n);u