"use strict";(self.webpackChunkcalendar=self.webpackChunkcalendar||[]).push([["node_modules_nextcloud_vue_dist_components_NcColorPicker_index_mjs"],{39894(e,a,l){l.d(a,{N:()=>g});l(68256);var o=l(20641),r=l(50953),i=l(53751),t=l(90033),c=l(90510),n=l(98190),d=l(30826),u=l(39103),s=l(34163),p=l(3168),v=l(20732),k=l(24108),b=l(72386),m=l(52697);(0,d.r)(d.w);const f=["aria-label"],y={key:0,class:"color-picker__simple"},h=["aria-label","name","checked","onClick"],_=["title"],R=["aria-label","name","checked"],C={key:0,class:"color-picker__navigation"},N=(0,o.pM)({__name:"NcColorPicker",props:(0,o.zz)({advancedFields:{type:Boolean},clearable:{type:Boolean},container:{default:"body"},palette:{default:()=>[]},paletteOnly:{type:Boolean}},{modelValue:{required:!0},modelModifiers:{},open:{type:Boolean},openModifiers:{}}),emits:(0,o.zz)(["submit","closed"],["update:modelValue","update:open"]),setup(e,{emit:a}){const l=(0,o.fn)(e,"modelValue"),m=(0,o.fn)(e,"open"),N=e,g=a,F=/^#([a-f0-9]{3}|[a-f0-9]{6})$/i,X=(0,s.c)(),z=(0,r.KR)(!1),w=(0,o.EW)(()=>{let e=N.palette;for(const a of e)if("string"==typeof a&&!a.match(F)||"object"==typeof a&&!a.color?.match(F)){p.l.error("[NcColorPicker] Invalid palette passed",{color:a}),e=[];break}return 0===e.length&&(e=N.clearable?[...u.d,u.a,u.b]:[...u.d]),e.map(e=>({color:"object"==typeof e?e.color:e,name:"object"==typeof e&&e.name?e.name:(0,d.a)("A color with a HEX value {hex}",{hex:"string"==typeof e?e:e.color})}))});function E(e){l.value=e.hex}function W(e){return function(e){const[a,l,o]=function(e){const a=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!a)return[0,0,0];return[parseInt(a[1],16),parseInt(a[2],16),parseInt(a[3],16)]}(e);return(.2126*a+.7152*l+.0722*o)/255}(e)>.5?u.a.color:u.b.color}return(e,a)=>((0,o.uX)(),(0,o.Wv)((0,r.R1)(b.N),{shown:m.value,"onUpdate:shown":a[3]||(a[3]=e=>m.value=e),container:e.container,popupRole:"dialog",onApplyHide:a[4]||(a[4]=e=>g("closed"))},{trigger:(0,o.k6)(a=>[(0,o.RG)(e.$slots,"default",(0,t.normalizeProps)((0,o.Ng)(a)),void 0,!0)]),default:(0,o.k6)(u=>[(0,o.Lk)("div",{role:"dialog",class:(0,t.normalizeClass)(["color-picker",{"color-picker--advanced-fields":z.value&&e.advancedFields,"color-picker--clearable":e.clearable}]),"aria-modal":"true","aria-label":(0,r.R1)(d.a)("Color picker")},[(0,o.bF)(i.Transition,{name:"slide",mode:"out-in"},{default:(0,o.k6)(()=>[z.value?((0,o.uX)(),(0,o.Wv)((0,r.R1)(c.A),{key:1,class:"color-picker__advanced",disableAlpha:"",disableFields:!e.advancedFields,modelValue:l.value??"#000000","onUpdate:modelValue":E},null,8,["disableFields","modelValue"])):((0,o.uX)(),(0,o.CE)("div",y,[((0,o.uX)(!0),(0,o.CE)(o.FK,null,(0,o.pI)(w.value,({color:e,name:a},i)=>((0,o.uX)(),(0,o.CE)("label",{key:i,class:(0,t.normalizeClass)(["color-picker__simple-color-circle",{"color-picker__simple-color-circle--active":e===l.value}]),style:(0,t.normalizeStyle)({backgroundColor:e,color:W(e)})},[e===l.value?((0,o.uX)(),(0,o.Wv)((0,r.R1)(k.N),{key:0,path:(0,r.R1)(n.d)},null,8,["path"])):(0,o.Q3)("",!0),(0,o.Lk)("input",{type:"radio",class:"hidden-visually","aria-label":a,name:`color-picker-${(0,r.R1)(X)}`,checked:e===l.value,onClick:a=>function(e){e="string"==typeof e?e:e.color,N.clearable&&l.value===e?l.value=void 0:l.value=e}(e)},null,8,h)],6))),128)),e.clearable?((0,o.uX)(),(0,o.CE)("label",{key:0,class:"color-picker__clear",title:(0,r.R1)(d.a)("No color")},[(0,o.bF)((0,r.R1)(k.N),{size:l.value?28:34,path:(0,r.R1)(n.u)},null,8,["size","path"]),(0,o.Lk)("input",{type:"radio",class:"hidden-visually","aria-label":(0,r.R1)(d.a)("No color"),name:`color-picker-${(0,r.R1)(X)}`,checked:!l.value,onClick:a[0]||(a[0]=e=>l.value=void 0)},null,8,R)],8,_)):(0,o.Q3)("",!0)]))]),_:1}),e.paletteOnly?(0,o.Q3)("",!0):((0,o.uX)(),(0,o.CE)("div",C,[z.value?((0,o.uX)(),(0,o.Wv)((0,r.R1)(v.N),{key:0,"aria-label":(0,r.R1)(d.a)("Back"),title:(0,r.R1)(d.a)("Back"),variant:"tertiary",onClick:a[1]||(a[1]=e=>z.value=!1)},{icon:(0,o.k6)(()=>[(0,o.bF)((0,r.R1)(k.N),{directional:"",path:(0,r.R1)(n.v)},null,8,["path"])]),_:1},8,["aria-label","title"])):((0,o.uX)(),(0,o.Wv)((0,r.R1)(v.N),{key:1,"aria-label":(0,r.R1)(d.a)("More options"),title:(0,r.R1)(d.a)("More options"),variant:"tertiary",onClick:a[2]||(a[2]=e=>z.value=!0)},{icon:(0,o.k6)(()=>[(0,o.bF)((0,r.R1)(k.N),{path:(0,r.R1)(n.w)},null,8,["path"])]),_:1},8,["aria-label","title"])),(0,o.bF)((0,r.R1)(v.N),{variant:"primary",onClick:e=>{return a=u.hide,g("submit",l.value),a(),void(z.value=!1);var a}},{default:(0,o.k6)(()=>[(0,o.eW)((0,t.toDisplayString)((0,r.R1)(d.a)("Choose")),1)]),_:2},1032,["onClick"])]))],10,f)]),_:3},8,["shown","container"]))}}),g=(0,m._)(N,[["__scopeId","data-v-45e1396f"]])},71415(e,a,l){l.r(a),l.d(a,{default:()=>o.N});var o=l(39894)}}]);
//# sourceMappingURL=calendar-node_modules_nextcloud_vue_dist_components_NcColorPicker_index_mjs.js.map?v=c9a143891078c0ddeac1