nextcloud/dist/theming-settings-personal.mjs
Ferdinand Thiessen b4b5986be9 chore: compile assets
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2026-01-27 23:52:40 +01:00

2 lines
25 KiB
JavaScript

import{b as K,q as Ve,s as Ue,j as S,o as c,n as x,k as h,N as O,p as z,l as j,E as Pe,t as y,u as n,G as xe,e as I,w,g as T,z as oe,r as H,c as _,J as He,F,C as ne,v as Ce,x as we,M as Le,h as Te}from"./runtime-dom.esm-bundler-DSTOTAEf.chunk.mjs";import{c as N,i as Be}from"./index-D9L8KHF3.chunk.mjs";import{a as X,f as qe}from"./index-JpgrUA2Z-D4yQFKNw.chunk.mjs";import{a as D,l as M}from"./index-xFugdZPW.chunk.mjs";import{t as d}from"./translation-DoG5ZELJ-2ffMJaM4.chunk.mjs";import{j as Se,a as E,g as G}from"./createElementId-DhjFt1I9-Bjk2333q.chunk.mjs";import{N as le}from"./NcCheckboxRadioSwitch-BCSKF7Tk-BDM2s1GW.chunk.mjs";import{N as ie}from"./NcNoteCard-CVhtNL04-CdF6Qoal.chunk.mjs";import{N as W}from"./ContentCopy-caJ7vqeg.chunk.mjs";import{c as Ie,N as Z}from"./logger-D3RVzcfQ-iUjwSNGe.chunk.mjs";import{A as ze,l as ee,g as se,r as ue}from"./refreshStyles-f-d6PTSt.chunk.mjs";import{N as Q,j as J,k as De,g as Ee,h as je}from"./mdi-kAZc0JKn.chunk.mjs";import{N as $e}from"./NcColorPicker-Kc0JqRtp-DZI9oazy.chunk.mjs";import{d as Ke}from"./index-6_gsQFyp.chunk.mjs";import"./modulepreload-polyfill-BxzAKjcf.chunk.mjs";import"./string_decoder-BO00msnV.chunk.mjs";import"./index-Dzo4H_NA.chunk.mjs";import"./colors-Go3zmZRD-Bml2X1sg.chunk.mjs";const Fe={class:"theming__preview-description"},Oe={class:"theming__preview-explanation"},Re={key:0,class:"theming__preview-warning",role:"note"},We=K({__name:"ThemePreviewItem",props:Ve({enforced:{type:Boolean},theme:{},type:{},unique:{type:Boolean}},{selected:{type:Boolean,required:!0},selectedModifiers:{}}),emits:["update:selected"],setup(t){const e=Ue(t,"selected"),a=t,r=z(()=>a.unique?"switch":"radio"),i=z(()=>a.unique?null:a.type),s=z(()=>Se("theming","img",a.theme.id+".jpg")),o=z({get(){return e.value},set(g){a.enforced||(e.value=a.unique?g:!0)}});function m(){if(!a.enforced){if(r.value==="radio"){o.value=!0;return}o.value=!o.value}}return(g,$)=>(c(),S("div",{class:x(["theming__preview--"+t.theme.id,"theming__preview"])},[h("div",{class:"theming__preview-image",style:O({backgroundImage:"url("+s.value+")"}),onClick:m},null,4),h("div",Fe,[h("h3",null,y(t.theme.title),1),h("p",Oe,y(t.theme.description),1),t.enforced?(c(),S("span",Re,y(n(d)("theming","Theme selection is enforced")),1)):j("",!0),Pe(I(n(le),{modelValue:o.value,"onUpdate:modelValue":$[0]||($[0]=U=>o.value=U),class:"theming__preview-toggle",disabled:t.enforced,name:i.value,type:r.value},{default:w(()=>[T(y(t.theme.enableLabel),1)]),_:1},8,["modelValue","disabled","name","type"]),[[xe,!t.enforced]])])],2))}}),de=D(We,[["__scopeId","data-v-13bf6aae"]]),Ge={name:"UndoIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Ze=["aria-hidden","aria-label"],Je=["fill","width","height"],Ye={d:"M12.5,8C9.85,8 7.45,9 5.6,10.6L2,7V16H11L7.38,12.38C8.77,11.22 10.54,10.5 12.5,10.5C16.04,10.5 19.05,12.81 20.1,16L22.47,15.22C21.08,11.03 17.15,8 12.5,8Z"},Qe={key:0};function Xe(t,e,a,r,i,s){return c(),S("span",oe(t.$attrs,{"aria-hidden":a.title?null:"true","aria-label":a.title,class:"material-design-icon undo-icon",role:"img",onClick:e[0]||(e[0]=o=>t.$emit("click",o))}),[(c(),S("svg",{fill:a.fillColor,class:"material-design-icon__svg",width:a.size,height:a.size,viewBox:"0 0 24 24"},[h("path",Ye,[a.title?(c(),S("title",Qe,y(a.title),1)):j("",!0)])],8,Je))],16,Ze)}const et=D(Ge,[["render",Xe]]),ce="theming-apporder-changed-infocard",ge="theming-apporder-changed-infocard",tt=K({__name:"UserSectionAppMenu",setup(t){const{userAppOrder:e,enforcedDefaultApp:a}=M("theming","navigationBar"),r=M("core","apps").filter(({type:p})=>p==="link").map(p=>({...p,label:p.name,default:p.default&&p.id===a})),i=H([...r]),s=H(!Array.isArray(e)||Object.values(e).length>0),o=z(()=>r.some(({id:p},v)=>p!==i.value[v]?.id)),m=z(()=>(o.value?`${ce} `:"")+(a?ge:""));async function g(p){const v={};p.forEach(({app:A,id:f},C)=>{v[f]={order:C,app:A}});try{await U("apporder",v),i.value=p,s.value=!0}catch(A){ee.error("Could not set the app order",{error:A}),X(d("theming","Could not set the app order"))}}async function $(){try{await U("apporder",[]),s.value=!1;const{data:p}=await N.get(E("/core/navigation/apps"),{headers:{"OCS-APIRequest":"true"}});i.value=p.ocs.data.map(v=>({...v,label:v.name,default:v.default&&v.app===a}))}catch(p){ee.error("Could not reset the app order",{error:p}),X(d("theming","Could not reset the app order"))}}async function U(p,v){const A=E("apps/provisioning_api/api/v1/config/users/{appId}/{configKey}",{appId:"core",configKey:p});return await N.post(A,{configValue:JSON.stringify(v)})}return(p,v)=>(c(),_(n(W),{name:n(d)("theming","Navigation bar settings")},{default:w(()=>[h("p",null,y(n(d)("theming","You can configure the app order used for the navigation bar. The first entry will be the default app, opened after login or when clicking on the logo.")),1),n(a)?(c(),_(n(ie),{key:0,id:ge,type:"info"},{default:w(()=>[T(y(n(d)("theming","The default app can not be changed because it was configured by the administrator.")),1)]),_:1})):j("",!0),o.value?(c(),_(n(ie),{key:1,id:ce,type:"info"},{default:w(()=>[T(y(n(d)("theming","The app order was changed, to see it in action you have to reload the page.")),1)]),_:1})):j("",!0),I(ze,{class:x(p.$style.userSectionAppMenu__selector),"aria-details":m.value,modelValue:i.value,"onUpdate:modelValue":g},null,8,["class","aria-details","modelValue"]),I(n(Ie),{"data-test-id":"btn-apporder-reset",disabled:!s.value,variant:"tertiary",onClick:$},{icon:w(()=>[I(et,{size:20})]),default:w(()=>[T(" "+y(n(d)("theming","Reset default app order")),1)]),_:1},8,["disabled"])]),_:1},8,["name"]))}}),at="_userSectionAppMenu__selector_1hkl7_2",rt={userSectionAppMenu__selector:at},nt={$style:rt},it=D(tt,[["__cssModules",nt]]),ot={class:"hidden-visually"},lt=["aria-disabled","aria-pressed","aria-label","title"],st=["aria-disabled","aria-pressed","aria-label","title"],ut=["aria-disabled","aria-pressed","aria-label","title"],dt={class:"hidden-visually"},ct=["title","aria-label","aria-pressed","onClick"],gt=K({__name:"UserSectionBackground",emits:["refreshStyles"],setup(t,{emit:e}){He(l=>({cf2ff408:s}));const a=e,r=M("theming","shippedBackgrounds"),i=M("theming","themingDefaults"),s=`url('${i.backgroundImage}')`,o=H(!1),m=H(structuredClone(M("theming","data"))),g=H(M("theming","userBackgroundImage")),$=Object.keys(r).filter(l=>l!==i.defaultShippedBackground||i.backgroundMime!=="").map(l=>({name:l,url:U(l),preview:U("preview/"+l),details:r[l]}));function U(l){return Se("theming","","img/background/")+l}async function p(l){g.value=l.backgroundImage,m.value.backgroundColor=l.backgroundColor,a("refreshStyles"),o.value=!1}async function v(){o.value="default";const l=await N.post(G("/apps/theming/background/default"));p(l.data)}async function A(l){o.value=l;const b=await N.post(G("/apps/theming/background/shipped"),{value:l});p(b.data)}async function f(l){o.value="custom";const b=await N.post(G("/apps/theming/background/custom"),{value:l});p(b.data)}async function C(l){if(!l)return;o.value="color";const{data:b}=await N.post(G("/apps/theming/background/color"),{color:l||"#0082c9"});p(b)}async function B(){await qe(d("theming","Select a background from your files")).allowDirectories(!1).setFilter(l=>l.mime.startsWith("image/")).setMultiSelect(!1).addButton({label:d("theming","Select background"),callback:([l])=>{f(l.path)},variant:"primary"}).build().pick()}return(l,b)=>(c(),_(n(W),{class:"background",name:n(d)("theming","Background and color"),description:n(d)("theming","The background can be set to an image from the default set, a custom uploaded image, or a plain color.")},{default:w(()=>[h("fieldset",null,[h("legend",ot,y(n(d)("theming","Background and color")),1),h("div",{class:x(l.$style.backgroundSelect)},[h("button",{"aria-disabled":o.value==="custom","aria-pressed":g.value==="custom","aria-label":n(d)("theming","Custom background"),title:n(d)("theming","Custom background"),class:x(["button-vue",[l.$style.backgroundSelect__entry,l.$style.backgroundSelect__entryFilePicker]]),onClick:B},[o.value==="custom"?(c(),_(n(Q),{key:0})):(c(),_(n(Z),{key:1,path:g.value==="custom"?n(J):n(De)},null,8,["path"]))],10,lt),I(n($e),{modelValue:m.value.backgroundColor,"onUpdate:modelValue":b[0]||(b[0]=u=>m.value.backgroundColor=u),onSubmit:C},{default:w(()=>[h("button",{class:x(["button-vue",[l.$style.backgroundSelect__entry,l.$style.backgroundSelect__entryColor]]),"aria-disabled":o.value==="color","aria-pressed":g.value==="color","aria-label":n(d)("theming","Plain background"),title:n(d)("theming","Plain background"),style:O({backgroundColor:m.value.backgroundColor,"--color-content":n(se)(m.value.backgroundColor)})},[o.value==="color"?(c(),_(n(Q),{key:0})):(c(),_(n(Z),{key:1,path:g.value==="color"?n(J):n(Ee)},null,8,["path"]))],14,st)]),_:1},8,["modelValue"]),h("button",{class:x(["button-vue",[l.$style.backgroundSelect__entry,l.$style.backgroundSelect__entryDefault]]),"aria-disabled":o.value==="default","aria-pressed":g.value==="default","aria-label":n(d)("theming","Default background"),title:n(d)("theming","Default background"),style:O({"--color-content":n(se)(n(i).backgroundColor)}),onClick:v},[o.value==="default"?(c(),_(n(Q),{key:0})):(c(),_(n(Z),{key:1,path:g.value==="default"?n(J):n(je)},null,8,["path"]))],14,ut)],2),h("fieldset",{class:x(l.$style.backgroundSelect)},[h("label",dt,y(n(d)("theming","Default shipped background images")),1),(c(!0),S(F,null,ne(n($),u=>(c(),S("button",{key:u.name,title:u.details.attribution,"aria-label":u.details.description,"aria-pressed":g.value===u.name,class:x(["button-vue",l.$style.backgroundSelect__entry]),style:O({backgroundImage:"url("+u.preview+")"}),tabindex:"0",onClick:q=>A(u.name)},[g.value===u.name?(c(),_(n(Z),{key:0,class:x(l.$style.backgroundSelect__entryIcon),path:n(J)},null,8,["class","path"])):j("",!0)],14,ct))),128))],2)])]),_:1},8,["name","description"]))}}),pt="_backgroundSelect_l1nhm_2",mt="_backgroundSelect__entry_l1nhm_7",ht="_backgroundSelect__entryColor_l1nhm_38",ft="_backgroundSelect__entryFilePicker_l1nhm_42",bt="_backgroundSelect__entryDefault_l1nhm_52",vt={backgroundSelect:pt,backgroundSelect__entry:mt,backgroundSelect__entryColor:ht,backgroundSelect__entryFilePicker:ft,backgroundSelect__entryDefault:bt},yt={$style:vt},_t=D(gt,[["__cssModules",yt]]),kt=K({__name:"UserSectionHotkeys",setup(t){const e=H(M("theming","shortcutsDisabled",!1));Ce(e,a);async function a(){const r=E("apps/provisioning_api/api/v1/config/users/{appId}/{configKey}",{appId:"theming",configKey:"shortcuts_disabled"});e.value?await N.post(r,{configValue:"yes"}):await N.delete(r)}return(r,i)=>(c(),_(n(W),{name:n(d)("theming","Keyboard shortcuts"),description:n(d)("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.")},{default:w(()=>[I(n(le),{modelValue:e.value,"onUpdate:modelValue":i[0]||(i[0]=s=>e.value=s),class:"theming__preview-toggle",type:"switch"},{default:w(()=>[T(y(n(d)("theming","Disable all keyboard shortcuts")),1)]),_:1},8,["modelValue"])]),_:1},8,["name","description"]))}});var Ct={grad:.9,turn:360,rad:360/(2*Math.PI)},L=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},k=function(t,e,a){return e===void 0&&(e=0),a===void 0&&(a=Math.pow(10,e)),Math.round(a*t)/a+0},V=function(t,e,a){return e===void 0&&(e=0),a===void 0&&(a=1),t>a?a:t>e?t:e},Ae=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},pe=function(t){return{r:V(t.r,0,255),g:V(t.g,0,255),b:V(t.b,0,255),a:V(t.a)}},te=function(t){return{r:k(t.r),g:k(t.g),b:k(t.b),a:k(t.a,3)}},wt=/^#([0-9a-f]{3,8})$/i,Y=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},Ne=function(t){var e=t.r,a=t.g,r=t.b,i=t.a,s=Math.max(e,a,r),o=s-Math.min(e,a,r),m=o?s===e?(a-r)/o:s===a?2+(r-e)/o:4+(e-a)/o:0;return{h:60*(m<0?m+6:m),s:s?o/s*100:0,v:s/255*100,a:i}},Me=function(t){var e=t.h,a=t.s,r=t.v,i=t.a;e=e/360*6,a/=100,r/=100;var s=Math.floor(e),o=r*(1-a),m=r*(1-(e-s)*a),g=r*(1-(1-e+s)*a),$=s%6;return{r:255*[r,m,o,o,g,r][$],g:255*[g,r,r,m,o,o][$],b:255*[o,o,g,r,r,m][$],a:i}},me=function(t){return{h:Ae(t.h),s:V(t.s,0,100),l:V(t.l,0,100),a:V(t.a)}},he=function(t){return{h:k(t.h),s:k(t.s),l:k(t.l),a:k(t.a,3)}},fe=function(t){return Me((a=(e=t).s,{h:e.h,s:(a*=((r=e.l)<50?r:100-r)/100)>0?2*a/(r+a)*100:0,v:r+a,a:e.a}));var e,a,r},R=function(t){return{h:(e=Ne(t)).h,s:(i=(200-(a=e.s))*(r=e.v)/100)>0&&i<200?a*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:e.a};var e,a,r,i},St=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,It=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$t=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,At=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,be={string:[[function(t){var e=wt.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?k(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?k(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=$t.exec(t)||At.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:pe({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=St.exec(t)||It.exec(t);if(!e)return null;var a,r,i=me({h:(a=e[1],r=e[2],r===void 0&&(r="deg"),Number(a)*(Ct[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return fe(i)},"hsl"]],object:[[function(t){var e=t.r,a=t.g,r=t.b,i=t.a,s=i===void 0?1:i;return L(e)&&L(a)&&L(r)?pe({r:Number(e),g:Number(a),b:Number(r),a:Number(s)}):null},"rgb"],[function(t){var e=t.h,a=t.s,r=t.l,i=t.a,s=i===void 0?1:i;if(!L(e)||!L(a)||!L(r))return null;var o=me({h:Number(e),s:Number(a),l:Number(r),a:Number(s)});return fe(o)},"hsl"],[function(t){var e=t.h,a=t.s,r=t.v,i=t.a,s=i===void 0?1:i;if(!L(e)||!L(a)||!L(r))return null;var o=(function(m){return{h:Ae(m.h),s:V(m.s,0,100),v:V(m.v,0,100),a:V(m.a)}})({h:Number(e),s:Number(a),v:Number(r),a:Number(s)});return Me(o)},"hsv"]]},ve=function(t,e){for(var a=0;a<e.length;a++){var r=e[a][0](t);if(r)return[r,e[a][1]]}return[null,void 0]},Nt=function(t){return typeof t=="string"?ve(t.trim(),be.string):typeof t=="object"&&t!==null?ve(t,be.object):[null,void 0]},ae=function(t,e){var a=R(t);return{h:a.h,s:V(a.s+100*e,0,100),l:a.l,a:a.a}},re=function(t){return(299*t.r+587*t.g+114*t.b)/1e3/255},ye=function(t,e){var a=R(t);return{h:a.h,s:a.s,l:V(a.l+100*e,0,100),a:a.a}},_e=(function(){function t(e){this.parsed=Nt(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return t.prototype.isValid=function(){return this.parsed!==null},t.prototype.brightness=function(){return k(re(this.rgba),2)},t.prototype.isDark=function(){return re(this.rgba)<.5},t.prototype.isLight=function(){return re(this.rgba)>=.5},t.prototype.toHex=function(){return e=te(this.rgba),a=e.r,r=e.g,i=e.b,o=(s=e.a)<1?Y(k(255*s)):"","#"+Y(a)+Y(r)+Y(i)+o;var e,a,r,i,s,o},t.prototype.toRgb=function(){return te(this.rgba)},t.prototype.toRgbString=function(){return e=te(this.rgba),a=e.r,r=e.g,i=e.b,(s=e.a)<1?"rgba("+a+", "+r+", "+i+", "+s+")":"rgb("+a+", "+r+", "+i+")";var e,a,r,i,s},t.prototype.toHsl=function(){return he(R(this.rgba))},t.prototype.toHslString=function(){return e=he(R(this.rgba)),a=e.h,r=e.s,i=e.l,(s=e.a)<1?"hsla("+a+", "+r+"%, "+i+"%, "+s+")":"hsl("+a+", "+r+"%, "+i+"%)";var e,a,r,i,s},t.prototype.toHsv=function(){return e=Ne(this.rgba),{h:k(e.h),s:k(e.s),v:k(e.v),a:k(e.a,3)};var e},t.prototype.invert=function(){return P({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),P(ae(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),P(ae(this.rgba,-e))},t.prototype.grayscale=function(){return P(ae(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),P(ye(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),P(ye(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?P({r:(a=this.rgba).r,g:a.g,b:a.b,a:e}):k(this.rgba.a,3);var a},t.prototype.hue=function(e){var a=R(this.rgba);return typeof e=="number"?P({h:e,s:a.s,l:a.l,a:a.a}):k(a.h)},t.prototype.isEqual=function(e){return this.toHex()===P(e).toHex()},t})(),P=function(t){return t instanceof _e?t:new _e(t)};const Mt={name:"PaletteOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Vt=["aria-hidden","aria-label"],Ut=["fill","width","height"],Pt={d:"M12,22A10,10 0 0,1 2,12A10,10 0 0,1 12,2C17.5,2 22,6 22,11A6,6 0 0,1 16,17H14.2C13.9,17 13.7,17.2 13.7,17.5C13.7,17.6 13.8,17.7 13.8,17.8C14.2,18.3 14.4,18.9 14.4,19.5C14.5,20.9 13.4,22 12,22M12,4A8,8 0 0,0 4,12A8,8 0 0,0 12,20C12.3,20 12.5,19.8 12.5,19.5C12.5,19.3 12.4,19.2 12.4,19.1C12,18.6 11.8,18.1 11.8,17.5C11.8,16.1 12.9,15 14.3,15H16A4,4 0 0,0 20,11C20,7.1 16.4,4 12,4M6.5,10C7.3,10 8,10.7 8,11.5C8,12.3 7.3,13 6.5,13C5.7,13 5,12.3 5,11.5C5,10.7 5.7,10 6.5,10M9.5,6C10.3,6 11,6.7 11,7.5C11,8.3 10.3,9 9.5,9C8.7,9 8,8.3 8,7.5C8,6.7 8.7,6 9.5,6M14.5,6C15.3,6 16,6.7 16,7.5C16,8.3 15.3,9 14.5,9C13.7,9 13,8.3 13,7.5C13,6.7 13.7,6 14.5,6M17.5,10C18.3,10 19,10.7 19,11.5C19,12.3 18.3,13 17.5,13C16.7,13 16,12.3 16,11.5C16,10.7 16.7,10 17.5,10Z"},xt={key:0};function Ht(t,e,a,r,i,s){return c(),S("span",oe(t.$attrs,{"aria-hidden":a.title?null:"true","aria-label":a.title,class:"material-design-icon palette-outline-icon",role:"img",onClick:e[0]||(e[0]=o=>t.$emit("click",o))}),[(c(),S("svg",{fill:a.fillColor,class:"material-design-icon__svg",width:a.size,height:a.size,viewBox:"0 0 24 24"},[h("path",Pt,[a.title?(c(),S("title",xt,y(a.title),1)):j("",!0)])],8,Ut))],16,Vt)}const Lt=D(Mt,[["render",Ht]]),Tt={name:"UndoVariantIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}},Bt=["aria-hidden","aria-label"],qt=["fill","width","height"],zt={d:"M13.5,7A6.5,6.5 0 0,1 20,13.5A6.5,6.5 0 0,1 13.5,20H10V18H13.5C16,18 18,16 18,13.5C18,11 16,9 13.5,9H7.83L10.91,12.09L9.5,13.5L4,8L9.5,2.5L10.92,3.91L7.83,7H13.5M6,18H8V20H6V18Z"},Dt={key:0};function Et(t,e,a,r,i,s){return c(),S("span",oe(t.$attrs,{"aria-hidden":a.title?null:"true","aria-label":a.title,class:"material-design-icon undo-variant-icon",role:"img",onClick:e[0]||(e[0]=o=>t.$emit("click",o))}),[(c(),S("svg",{fill:a.fillColor,class:"material-design-icon__svg",width:a.size,height:a.size,viewBox:"0 0 24 24"},[h("path",zt,[a.title?(c(),S("title",Dt,y(a.title),1)):j("",!0)])],8,qt))],16,Bt)}const jt=D(Tt,[["render",Et]]),Kt=K({__name:"UserSectionPrimaryColor",emits:["refreshStyles"],setup(t,{expose:e,emit:a}){const r=a;e({reload:U});const{primaryColor:i,defaultPrimaryColor:s}=M("theming","data",{primaryColor:"#0082c9",defaultPrimaryColor:"#0082c9"}),o=we("trigger"),m=H(!1),g=H(i);Ce(g,Ke(f=>{v(f)},1e3));const $=z(()=>P(g.value).isEqual(P(s)));function U(){let f=window.getComputedStyle(o.value).backgroundColor;const C=f.replaceAll(/\s/g,"").match(/^rgba?\((\d+),(\d+),(\d+)/);C&&(f=`#${A(C[1])}${A(C[2])}${A(C[3])}`),f.toLowerCase()!==g.value.toLowerCase()&&(g.value=f)}function p(){g.value=s,v(null)}async function v(f){m.value=!0;const C=E("apps/provisioning_api/api/v1/config/users/{appId}/{configKey}",{appId:"theming",configKey:"primary_color"});try{f?await N.post(C,{configValue:f}):await N.delete(C),r("refreshStyles")}catch(B){ee.error("Could not update primary color",{error:B}),X(d("theming","Could not set primary color"))}m.value=!1}function A(f){return Number.parseInt(f).toString(16).padStart(2,"0")}return(f,C)=>(c(),_(n(W),{name:n(d)("theming","Primary color"),description:n(d)("theming","Set a primary color to highlight important elements. The color used for elements such as primary buttons might differ a bit as it gets adjusted to fulfill accessibility requirements.")},{default:w(()=>[h("div",{class:x(f.$style.userPrimaryColor)},[I(n($e),{modelValue:g.value,"onUpdate:modelValue":C[0]||(C[0]=B=>g.value=B),"data-user-theming-primary-color":""},{default:w(()=>[h("button",{ref:"trigger",class:x(f.$style.userPrimaryColor__trigger),style:O({"background-color":g.value}),"data-user-theming-primary-color-trigger":""},[T(y(n(d)("theming","Primary color"))+" ",1),m.value?(c(),_(n(Q),{key:0})):(c(),_(Lt,{key:1,size:20}))],6)]),_:1},8,["modelValue"]),I(n(Ie),{variant:"tertiary",disabled:$.value,onClick:p},{icon:w(()=>[I(jt,{size:20})]),default:w(()=>[T(" "+y(n(d)("theming","Reset primary color")),1)]),_:1},8,["disabled"])],2)]),_:1},8,["name","description"]))}}),Ft="_userPrimaryColor_3oh6f_1",Ot="_userPrimaryColor__trigger_3oh6f_8",Rt={userPrimaryColor:Ft,userPrimaryColor__trigger:Ot},Wt={$style:Rt},Gt=D(Kt,[["__cssModules",Wt]]),Zt=["innerHTML"],Jt=["innerHTML"],Yt={class:"theming__preview-list"},Qt={class:"theming__preview-list"},Xt=K({__name:"UserTheming",setup(t){const e=M("theming","enforceTheme",""),a=M("theming","isUserThemingDisabled"),r=H(M("theming","enableBlurFilter","")),i=M("theming","themes",[]),s=H(i.filter(l=>l.type===1)),o=H(i.filter(l=>l.type===2)),m=z(()=>s.value.find(l=>l.enabled)||s.value[0]),g=we("primaryColor"),$=d("theming","Universal access is very important to us. We follow web standards and check to make everything usable also without mouse, and assistive software such as screenreaders. We aim to be compliant with the {linkstart}Web Content Accessibility Guidelines{linkend} 2.1 on AA level, with the high contrast theme even on AAA level.",{linkstart:'<a target="_blank" href="https://www.w3.org/WAI/standards-guidelines/wcag/" rel="noreferrer nofollow">',linkend:"</a>"},{escape:!1}),U=d("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}!",{issuetracker:'<a target="_blank" href="https://github.com/nextcloud/server/issues/" rel="noreferrer nofollow">',designteam:'<a target="_blank" href="https://nextcloud.com/design" rel="noreferrer nofollow">',linkend:"</a>"},{escape:!1});async function p(){await ue(),Le(()=>g.value?.reload())}function v(l,b){s.value.forEach(u=>{if(u.id===l&&b){u.enabled=!0;return}u.enabled=!1}),C(),B(b,l)}function A(l,b){o.value.forEach(u=>{if(u.id===l&&b){u.enabled=!0;return}u.enabled=!1}),C(),B(b,l)}async function f(){r.value=r.value==="no"?"yes":"no",await N({url:E("apps/provisioning_api/api/v1/config/users/{appId}/{configKey}",{appId:"theming",configKey:"force_enable_blur_filter"}),data:{configValue:r.value},method:"POST"}),ue()}function C(){const l=s.value.filter(u=>u.enabled===!0).map(u=>u.id),b=o.value.filter(u=>u.enabled===!0).map(u=>u.id);s.value.forEach(u=>{document.body.toggleAttribute(`data-theme-${u.id}`,u.enabled)}),o.value.forEach(u=>{document.body.toggleAttribute(`data-theme-${u.id}`,u.enabled)}),document.body.setAttribute("data-themes",[...l,...b].join(","))}async function B(l,b){try{l?await N({url:E("apps/theming/api/v1/theme/{themeId}/enable",{themeId:b}),method:"PUT"}):await N({url:E("apps/theming/api/v1/theme/{themeId}",{themeId:b}),method:"DELETE"})}catch(u){ee.error("theming: Unable to apply setting.",{error:u});let q=d("theming","Unable to apply the setting.");Be(u)&&u.response?.data.ocs?.meta?.message&&(q=`${u.response.data.ocs.meta.message}. ${q}`),X(q)}}return(l,b)=>(c(),S(F,null,[I(n(W),{name:n(d)("theming","Appearance and accessibility settings"),class:"theming"},{default:w(()=>[h("p",{innerHTML:n($)},null,8,Zt),h("p",{innerHTML:n(U)},null,8,Jt),h("div",Yt,[(c(!0),S(F,null,ne(s.value,u=>(c(),_(de,{key:u.id,enforced:u.id===n(e),selected:m.value.id===u.id,theme:u,unique:s.value.length===1,type:"theme","onUpdate:selected":q=>v(u.id,q)},null,8,["enforced","selected","theme","unique","onUpdate:selected"]))),128))]),h("div",Qt,[(c(!0),S(F,null,ne(o.value,u=>(c(),_(de,{key:u.id,selected:u.enabled,theme:u,unique:o.value.length===1,type:"font","onUpdate:selected":q=>A(u.id,q)},null,8,["selected","theme","unique","onUpdate:selected"]))),128))]),h("h3",null,y(n(d)("theming","Misc accessibility options")),1),I(n(le),{type:"checkbox",modelValue:r.value==="yes",indeterminate:r.value==="","onUpdate:modelValue":f},{default:w(()=>[T(y(n(d)("theming","Enable blur background filter (may increase GPU load)")),1)]),_:1},8,["modelValue","indeterminate"])]),_:1},8,["name"]),n(a)?(c(),_(n(ie),{key:0,type:"info"},{default:w(()=>[T(y(n(d)("theming","Customization has been disabled by your administrator")),1)]),_:1})):(c(),S(F,{key:1},[I(Gt,{ref:"primaryColor",onRefreshStyles:p},null,512),I(_t,{onRefreshStyles:p})],64)),I(kt),I(it)],64))}}),ea=D(Xt,[["__scopeId","data-v-50195b4f"]]),ke=Te(ea);ke.config.idPrefix="settings",ke.mount("#settings-personal-theming");
//# sourceMappingURL=theming-settings-personal.mjs.map