Local modifications to ClusterLabs/Anvil by Alteeve
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
61 KiB

"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[310],{93362:function(e,t,o){o.d(t,{D:function(){return createFilterOptions},o:function(){return useAutocomplete}});var n=o(87462),r=o(67294),a=o(92996),i=o(19032),l=o(2097),s=o(59948),c=o(7960);function stripDiacritics(e){return void 0!==e.normalize?e.normalize("NFD").replace(/[\u0300-\u036f]/g,""):e}function createFilterOptions(e={}){let{ignoreAccents:t=!0,ignoreCase:o=!0,limit:n,matchFrom:r="any",stringify:a,trim:i=!1}=e;return(e,{inputValue:l,getOptionLabel:s})=>{let c=i?l.trim():l;o&&(c=c.toLowerCase()),t&&(c=stripDiacritics(c));let p=c?e.filter(e=>{let n=(a||s)(e);return o&&(n=n.toLowerCase()),t&&(n=stripDiacritics(n)),"start"===r?0===n.indexOf(c):n.indexOf(c)>-1}):e;return"number"==typeof n?p.slice(0,n):p}}function findIndex(e,t){for(let o=0;o<e.length;o+=1)if(t(e[o]))return o;return -1}let p=createFilterOptions(),defaultIsActiveElementInListbox=e=>{var t;return null!==e.current&&(null==(t=e.current.parentElement)?void 0:t.contains(document.activeElement))};function useAutocomplete(e){let{unstable_isActiveElementInListbox:t=defaultIsActiveElementInListbox,unstable_classNamePrefix:o="Mui",autoComplete:d=!1,autoHighlight:u=!1,autoSelect:f=!1,blurOnSelect:g=!1,clearOnBlur:m=!e.freeSolo,clearOnEscape:h=!1,componentName:v="useAutocomplete",defaultValue:b=e.multiple?[]:null,disableClearable:y=!1,disableCloseOnSelect:x=!1,disabled:w,disabledItemsFocusable:O=!1,disableListWrap:Z=!1,filterOptions:C=p,filterSelectedOptions:P=!1,freeSolo:S=!1,getOptionDisabled:$,getOptionKey:k,getOptionLabel:I=e=>{var t;return null!=(t=e.label)?t:e},groupBy:R,handleHomeEndKeys:E=!e.freeSolo,id:L,includeInputInList:T=!1,inputValue:M,isOptionEqualToValue:D=(e,t)=>e===t,multiple:A=!1,onChange:N,onClose:j,onHighlightChange:V,onInputChange:W,onOpen:F,open:B,openOnFocus:H=!1,options:z,readOnly:U=!1,selectOnFocus:q=!e.freeSolo,value:K}=e,_=(0,a.Z)(L),G=I;G=e=>{let t=I(e);return"string"!=typeof t?String(t):t};let X=r.useRef(!1),Y=r.useRef(!0),J=r.useRef(null),Q=r.useRef(null),[ee,et]=r.useState(null),[eo,en]=r.useState(-1),er=u?0:-1,ea=r.useRef(er),[ei,el]=(0,i.Z)({controlled:K,default:b,name:v}),[es,ec]=(0,i.Z)({controlled:M,default:"",name:v,state:"inputValue"}),[ep,ed]=r.useState(!1),eu=r.useCallback((e,t)=>{let o;let n=A?ei.length<t.length:null!==t;if(n||m){if(A)o="";else if(null==t)o="";else{let e=G(t);o="string"==typeof e?e:""}es!==o&&(ec(o),W&&W(e,o,"reset"))}},[G,es,A,W,ec,m,ei]),[ef,eg]=(0,i.Z)({controlled:B,default:!1,name:v,state:"open"}),[em,eh]=r.useState(!0),ev=!A&&null!=ei&&es===G(ei),eb=ef&&!U,ey=eb?C(z.filter(e=>!(P&&(A?ei:[ei]).some(t=>null!==t&&D(e,t)))),{inputValue:ev&&em?"":es,getOptionLabel:G}):[],ex=(0,l.Z)({filteredOptions:ey,value:ei,inputValue:es});r.useEffect(()=>{let e=ei!==ex.value;(!ep||e)&&(!S||e)&&eu(null,ei)},[ei,eu,ep,ex.value,S]);let ew=ef&&ey.length>0&&!U,eO=(0,s.Z)(e=>{-1===e?J.current.focus():ee.querySelector(`[data-tag-index="${e}"]`).focus()});r.useEffect(()=>{A&&eo>ei.length-1&&(en(-1),eO(-1))},[ei,A,eo,eO]);let eZ=(0,s.Z)(({event:e,index:t,reason:n="auto"})=>{if(ea.current=t,-1===t?J.current.removeAttribute("aria-activedescendant"):J.current.setAttribute("aria-activedescendant",`${_}-option-${t}`),V&&V(e,-1===t?null:ey[t],n),!Q.current)return;let r=Q.current.querySelector(`[role="option"].${o}-focused`);r&&(r.classList.remove(`${o}-focused`),r.classList.remove(`${o}-focusVisible`));let a=Q.current;if("listbox"!==Q.current.getAttribute("role")&&(a=Q.current.parentElement.querySelector('[role="listbox"]')),!a)return;if(-1===t){a.scrollTop=0;return}let i=Q.current.querySelector(`[data-option-index="${t}"]`);if(i&&(i.classList.add(`${o}-focused`),"keyboard"===n&&i.classList.add(`${o}-focusVisible`),a.scrollHeight>a.clientHeight&&"mouse"!==n&&"touch"!==n)){let e=a.clientHeight+a.scrollTop,t=i.offsetTop+i.offsetHeight;t>e?a.scrollTop=t-a.clientHeight:i.offsetTop-i.offsetHeight*(R?1.3:0)<a.scrollTop&&(a.scrollTop=i.offsetTop-i.offsetHeight*(R?1.3:0))}}),eC=(0,s.Z)(({event:e,diff:t,direction:o="next",reason:n="auto"})=>{if(!eb)return;let r=functio