PageSourceSearch

https://my.clockodo.com/static/components/assets/usePopper-CC08qfui.js

js clockodo.com collected 2026-09-24 09:30:12 UTC 8,862 bytes, 2 lines download raw bytes

1import{s as e}from"./appType-H4Lk86HF.js";import{Mo as t}from"./common-C5mtuLG2.js";import{$ as n,Ri as r,jr as i,mr as a,or as o,zi as s}from"./vendor-BYBdXKh1.js";import{V as c}from"./ErrorBoxContainer-DHmIt_-p.js";var l=e(s(),1),u=e(o(),1),d=e=>{let[t]=l.useState(()=>document.createElement(`div`)),[n,r]=l.useState(!1);return l.useEffect(()=>{let n=setTimeout(()=>{(e?.()??document.body).appendChild(t),r(!0)},0);return()=>{clearTimeout(n),t.remove()}},[e,t]),{isPortalAttached:n,renderInPortal:e=>u.createPortal(e,t)}},f=(e,{wait:t,...n})=>{let r=(0,l.useRef)(e);(0,l.useLayoutEffect)(()=>{r.current=e});let a=(0,l.useMemo)(()=>{let e={};return`leading`in n&&(e.leading=n.leading),`trailing`in n&&(e.trailing=n.trailing),i((...e)=>{let t=r.current;return t(...e)},t,e)},[t,n.leading,n.trailing]);return(0,l.useLayoutEffect)(()=>()=>{a.cancel()},[a]),a},p=39,m=(e,t)=>!t&&e.showDivider,h=e=>{let t=e.type===void 0;if(e.type===`subchild`)return[];let n=[`subchild`];return t&&n.push(`child`),n},g=e=>e&&e.id!==void 0&&e.label,_=(e,t,n)=>{let r=h(t),i=[];if(r.length>0)for(let t=e+1;t<n.length;t++){let e=n[t];if(e&&g(e)&&r.includes(e.type??``))i.push(e.id+e.label);else break}return i},v=(e,n)=>{let r=n.toLowerCase(),i=new Set;for(let n=0;n<e.length;){let a=t(e[n]);if(a.searchableData?.some(e=>typeof e==`string`&&e.toLowerCase().includes(r))||a.label.toLowerCase().includes(r)||a.subLabel?.toLowerCase().includes(r)){i.add(a.id+a.label);let t=_(n,a,e);t.forEach(e=>{i.add(e)}),n+=Math.max(t.length,1)}else n++}let a=0,o=-1;return{options:e.filter((n,r)=>{if(i.has(n.id+n.label))return n.isDisabled||(o===-1&&(o=a),a++),!0;if(n.type===`category`)return!0;if(n.type===void 0||n.type===`child`)for(let o=r+1;o<e.length;o++){let r=t(e[o]);if(h(n).includes(r.type??``)){if(i.has(r.id+r.label))return n.isDisabled||a++,!0}else break}return!1}).filter((e,t,n)=>{if(e.type===`category`){let e=n[t+1]?.type===`category`,r=t===n.length-1;return!(e||r)}return!0}),firstHighlightedIndex:o===-1?0:o}},y=e=>e.type===`category`,b=(e,n)=>{let r=t(e[n]),i=n===0,a=i||n===e.length-1,o=y(r)?p-(i?8:0):27;return m(r,i)&&(o+=9),a&&(o+=4),o},x=e=>{let t=e.querySelector(`[aria-selected="true"]`);if(!t)return;let n=t.offsetTop;e.scrollTo(0,n-e.offsetHeight/2)},S=100,C=({isOpen:e,searchTerm:t})=>{let n=l.useRef(0),[r,i]=l.useState(0),[a,o]=l.useState(null),[s,c]=l.useState(null);l.useEffect(()=>{i(0),o(null),c(null)},[e,t]);let u=(e,t,r)=>{let a=e.get(t??-1);r!==void 0&&(n.current=r);let o=n.current;if(!a){i(0);return}let s=a.endOffset,c=0;o+27>s&&(c=o+27-a.endOffset),i(c*-1)},d=f(l.useCallback((e,t,n)=>{let r=null,i=null;e.forEach((e,a)=>{let o=a===0,s=e.type===void 0;if(!(s||e.type===`child`))return;let c=t.get(a);if(!c?.hasChildren)return;let{startOffset:l,endOffset:u,optionHeight:d}=c,f=l;m(e,o)&&(f+=9),s?n>=f&&n<=u&&(r=a):n+27>=f+d-27/2&&n<=u&&(i=a)}),o(r),c(i),u(t,r)},[]),{wait:S});return{stickyTop:r,stickyParentIndex:a,stickyChildIndex:s,updateStickyItems:(e,t,n)=>{d(e,t,n),u(t,a,n)}}},w=e=>{let{isOpen:t,showVirtualizedList:n,searchTerm:r,filteredOptions:i,nonVirtualizedListRef:a,virtualizedListRef:o}=e,[s,c]=l.useState(()=>new Map);return l.useEffect(()=>{if(t){if(!n){a.current?.scrollTo(0,0);let e=new Map,t=a.current?.querySelectorAll(`li`);for(let n=0;n<i.length;n++){let r=t?.item(n);if(!r)break;e.set(n,r.clientHeight)}c(e);return}c(new Map),o?.element?.scrollTo(0,0)}},[t,r,n,i.length,a,o]),s},T=({searchTerm:e,filteredOptions:t,itemHeightsMap:n})=>l.useMemo(()=>{let e=new Map;return t.forEach((r,i)=>{let a=n.get(i)??b(t,i);if(m(r,i===0)&&(a-=9),i===0){e.set(i,{optionHeight:a,startOffset:4,endOffset:0,hasChildren:!1});return}let o=(e.get(i-1)?.startOffset??0)+(n.get(i-1)??b(t,i-1));e.set(i,{optionHeight:a,startOffset:o,endOffset:0,hasChildren:!1})}),t.forEach((r,i)=>{if(r.type!==void 0&&r.type!==`child`)return;let a=h(r),o=e.get(i);if(!o)return;o.hasChildren=a.includes(t[i+1]?.type??``);let s=o.startOffset+(n.get(i)??b(t,i));for(let e=i+1;e<t.length;e++){let i=a.includes(t[e]?.type??``),o=r.type===`child`&&t[e+1]?.type===`child`;if(!i||o)break;s+=n.get(e)??b(t,e)}o.endOffset=s}),e},[e,n.size]),E={optionItemWrapper:`_optionItemWrapper_13gno_1`,optionItemWrapperShowDivider:`_optionItemWrapperShowDivider_13gno_12`,optionItem:`_optionItem_13gno_1`,optionItemBold:`_optionItemBold_13gno_33`,optionItemChild:`_optionItemChild_13gno_36`,optionItemSubChild:`_optionItemSubChild_13gno_39`,optionItemHighlighted:`_optionItemHighlighted_13gno_43`,optionItemDisabled:`_optionItemDisabled_13gno_46`,optionItemCategory:`_optionItemCategory_13gno_50`,optionItemSelected:`_optionItemSelected_13gno_64`,optionItemShowDivider:`_optionItemShowDivider_13gno_67`,optionItemWrapLines:`_optionItemWrapLines_13gno_70`,ellipsisWrapper:`_ellipsisWrapper_13gno_74`},D=r(),O=e=>{let{option:t,index:n,isBold:r,isSelected:i,onClick:o,wrapLines:s,style:c,enabledOptions:l,inputRef:u,downshift:{highlightedIndex:d,setHighlightedIndex:f,getItemProps:p}}=e,m=t.isDisabled?-1:l.indexOf(t),h=t.isDisabled?{onMouseEnter:()=>{f(-1)},onClick:()=>{u.current?.focus({preventScroll:!0})}}
1:p({item:t,index:m,onClick:()=>{o(t)}}),g=d>-1&&m===d,_=n===0,v=t.showDivider&&!_;return(0,D.jsx)(`li`,{className:a(E.optionItemWrapper,v&&E.optionItemWrapperShowDivider),...h,style:c,children:(0,D.jsx)(`div`,{className:a(E.optionItem,r&&E.optionItemBold,t.type===`child`&&E.optionItemChild,t.type===`subchild`&&E.optionItemSubChild,t.type===`category`&&E.optionItemCategory,g&&E.optionItemHighlighted,t.isDisabled&&E.optionItemDisabled,i&&E.optionItemSelected,v&&E.optionItemShowDivider,s&&E.optionItemWrapLines),children:s?(0,D.jsxs)(D.Fragment,{children:[t.label,` `,t.subLabel]}):(0,D.jsxs)(`div`,{className:E.ellipsisWrapper,children:[t.label,` `,t.subLabel]})})})},k={root:`_root_1l2cv_1`,ellipsisWrapper:`_ellipsisWrapper_1l2cv_9`,parentBold:`_parentBold_1l2cv_15`,child:`_child_1l2cv_18`,childVisible:`_childVisible_1l2cv_22`},A=({stickyTop:e,stickyParentOption:t,stickyChildOption:n,parentVariant:r})=>{let[i,o]=l.useState(n);(0,l.useEffect)(()=>{n&&o(n)},[n]);let s=!!n,u=i??n;return(0,D.jsx)(`div`,{className:k.root,style:c({"--top":e+`px`}),children:(0,D.jsxs)(`div`,{className:k.ellipsisWrapper,children:[(0,D.jsxs)(`span`,{className:a(r===`bold`&&k.parentBold),children:[t.label,` `,t.subLabel]}),(0,D.jsx)(`span`,{className:a(k.child,s&&k.childVisible),children:u&&(0,D.jsxs)(D.Fragment,{children:[` - `,u.label,` `,u.subLabel]})})]})})},j=e=>{let t=l.useRef({reference:void 0,popover:void 0,popper:void 0,previousOptions:e}),r=()=>{let{reference:r,popover:i,previousOptions:a}=t.current,{popper:o}=t.current;o&&(r!==o.state.elements.reference||i!==o.state.elements.popper?(o.destroy(),o=t.current.popper=void 0):e&&e!==a?o.setOptions(e):o.update()),o||r&&i&&(t.current.popper=n(r,i,e)),t.current.previousOptions=e},i=l.useCallback(e=>{t.current.reference=e??void 0},[]),a=l.useCallback(e=>{t.current.popover=e??void 0},[]);return l.useLayoutEffect(()=>{r()}),{setReferenceRef:i,setPopoverRef:a,getPopperInstance:()=>t.current.popper}},M={transformOrigin:{name:`transformOrigin`,enabled:!0,phase:`write`,fn:({state:e})=>{let t=e.elements.popper.firstElementChild;t instanceof HTMLElement&&(t.style.transformOrigin=N(e))}},betterPreventOverflow:e=>({name:`preventOverflow`,options:e,effect:({state:t})=>{let{padding:n=0,zIndex:r=null}=e;t.elements.popper.style.maxWidth=`calc(100vw - ${n*2}px)`,r!==null&&(t.elements.popper.style.zIndex=r)}}),sameWidthAsParent:()=>({name:`sameWidth`,enabled:!0,phase:`beforeWrite`,requires:[`computeStyles`],fn:({state:e})=>{e.styles.popper&&(e.styles.popper.minWidth=`${e.rects.reference.width}px`,e.styles.popper.maxWidth=`${e.rects.reference.width}px`)},effect:({state:e})=>{let{reference:t}=e.elements;t instanceof HTMLElement&&(e.elements.popper.style.minWidth=`${t.offsetWidth}px`,e.elements.popper.style.maxWidth=`${t.offsetWidth}px`)}}),autoWidthWithMax:e=>({name:`autoWidth`,enabled:!0,phase:`beforeWrite`,fn:({state:t})=>{if(t.styles.popper){let n=typeof e==`function`?e():e;t.styles.popper.minWidth=`${t.rects.reference.width}px`,t.styles.popper.width=`auto`,t.styles.popper.maxWidth=n}},effect:({state:t})=>{let{reference:n}=t.elements;if(n instanceof HTMLElement){let r=typeof e==`function`?e():e;t.elements.popper.style.minWidth=`${n.offsetWidth}px`,t.elements.popper.style.maxWidth=r}}}),onStateChange:e=>({name:`onStateChange`,enabled:!0,phase:`main`,fn:({state:t})=>{e(t)}})},N=e=>{let{placement:t,modifiersData:n}=e,{y:r=0,x:i=0}=n.arrow??{};return t.startsWith(`top`)?`${i}px bottom`:t.startsWith(`bottom`)?`${i}px top`:t.startsWith(`right`)?`left ${r}px`:t.startsWith(`top`)?`right ${r}px`:``},P=()=>{let{scale:e=1}=window.visualViewport??{};return e===1?`fixed`:`absolute`};export{O as a,C as c,x as d,f,A as i,v as l,M as n,T as o,d as p,j as r,w as s,P as t,b as u};
2//# sourceMappingURL=usePopper-CC08qfui.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.