Module 364643

4,805 characters · in 68925.4de164704c201108.js
Dependencies
Required by (2)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,r){"use strict";r.d(t,{p:()=>v});var n=r(869795),i=r(132716),o=r(985620),a=r(2799),s=r(318473),l=r(260431),u=r(805447),c=r(775133),f=r(114099),d=r(297987),p=r(401705),h=r(807177),m=r(64700),g=r(862836);function v(e){let{id:t,selectionManager:r,key:v,ref:w,shouldSelectOnPressUp:_,shouldUseVirtualFocus:x,focus:E,isDisabled:S,onAction:k,allowsDifferentPressOrigin:T,linkBehavior:C="action"}=e,P=(0,i.rd)();t=(0,o.Bi)(t);let A=e=>{if("keyboard"===e.pointerType&&(0,n.N9)(e))r.toggleSelection(v);else{if("none"===r.selectionMode)return;if(r.isLink(v)){if("selection"===C&&w.current){let t=r.getItemProps(v);P.open(w.current,e,t.href,t.routerOptions),r.setSelectedKeys(r.selectedKeys);return}else if("override"===C||"none"===C)return}"single"===r.selectionMode?r.isSelected(v)&&!r.disallowEmptySelection?r.toggleSelection(v):r.replaceSelection(v):e&&e.shiftKey?r.extendSelection(v):"toggle"===r.selectionBehavior||e&&((0,a.B)(e)||"touch"===e.pointerType||"virtual"===e.pointerType)?r.toggleSelection(v):r.replaceSelection(v)}};(0,m.useEffect)(()=>{v===r.focusedKey&&r.isFocused&&(x?(0,g.vX)(w.current):E?E():document.activeElement!==w.current&&w.current&&(0,u.l)(w.current))},[w,v,r.focusedKey,r.childFocusStrategy,r.isFocused,x]),S=S||r.isDisabled(v);let O={};x||S?S&&(O.onMouseDown=e=>{e.preventDefault()}):O={tabIndex:v===r.focusedKey?0:-1,onFocus(e){e.target===w.current&&r.setFocusedKey(v)}};let M=r.isLink(v)&&"override"===C,I=k&&"action"===e.UNSTABLE_itemBehavior,R=r.isLink(v)&&"selection"!==C&&"none"!==C,D=!S&&r.canSelectItem(v)&&!M&&!I,L=(k||R)&&!S,F=L&&("replace"===r.selectionBehavior?!D:!D||r.isEmpty),N=L&&D&&"replace"===r.selectionBehavior,j=F||N,V=(0,m.useRef)(null),B=j&&D,U=(0,m.useRef)(!1),K=(0,m.useRef)(!1),$=r.getItemProps(v),z=e=>{if(k){var t;k(),null==(t=w.current)||t.dispatchEvent(new CustomEvent("react-aria-item-action",{bubbles:!0}))}R&&w.current&&P.open(w.current,e,$.href,$.routerOptions)},W={ref:w};if(_?(W.onPressStart=e=>{V.current=e.pointerType,U.current=B,"keyboard"===e.pointerType&&(!j||b())&&A(e)},T?(W.onPressUp=F?void 0:e=>{"mouse"===e.pointerType&&D&&A(e)},W.onPress=F?z:e=>{"keyboard"!==e.pointerType&&"mouse"!==e.pointerType&&D&&A(e)}):W.onPress=e=>{F||N&&"mouse"!==e.pointerType?("keyboard"!==e.pointerType||y())&&z(e):"keyboard"!==e.pointerType&&D&&A(e)}):(W.onPressStart=e=>{V.current=e.pointerType,U.current=B,K.current=F,D&&("mouse"===e.pointerType&&!F||"keyboard"===e.pointerType&&(!L||b()))&&A(e)},W.onPress=e=>{("touch"===e.pointerType||"pen"===e.pointerType||"virtual"===e.pointerType||"keyboard"===e.pointerType&&j&&y()||"mouse"===e.pointerType&&K.current)&&(j?z(e):D&&A(e))}),O["data-collection"]=(0,n.EG)(r.collection),O["data-key"]=v,W.preventFocusOnPress=x,x&&(W=(0,s.v)(W,{onPressStart(e){"touch"!==e.pointerType&&(r.setFocused(!0),r.setFocusedKey(v))},onPress(e){"touch"===e.pointerType&&(r.setFocused(!0),r.setFocusedKey(v))}})),$)for(let e of["onPressStart","onPressEnd","onPressChange","onPress","onPressUp","onClick"])$[e]&&(W[e]=(0,l.c)(W[e],$[e]));let{pressProps:H,isPressed:G}=(0,c.d)(W),q=N?e=>{"mouse"===V.current&&(e.stopPropagation(),e.preventDefault(),z(e))}:void 0,{longPressProps:Y}=function(e){let{isDisabled:t,onLongPressStart:r,onLongPressEnd:n,onLongPress:i,threshold:o=500,accessibilityDescription:a}=e,l=(0,m.useRef)(void 0),{addGlobalListener:u,removeGlobalListener:g}=(0,f.A)(),{pressProps:v}=(0,c.d)({isDisabled:t,onPressStart(e){if(e.continuePropagation(),("mouse"===e.pointerType||"touch"===e.pointerType)&&(r&&r({...e,type:"longpressstart"}),l.current=setTimeout(()=>{e.target.dispatchEvent(new PointerEvent("pointercancel",{bubbles:!0})),(0,d.TW)(e.target).activeElement!==e.target&&(0,p.e)(e.target),i&&i({...e,type:"longpress"}),l.current=void 0},o),"touch"===e.pointerType)){let t=e=>{e.preventDefault()};u(e.target,"contextmenu",t,{once:!0}),u(window,"pointerup",()=>{setTimeout(()=>{g(e.target,"contextmenu",t)},30)},{once:!0})}},onPressEnd(e){l.current&&clearTimeout(l.current),n&&("mouse"===e.pointerType||"touch"===e.pointerType)&&n({...e,type:"longpressend"})}}),y=(0,h.I)(i&&!t?a:void 0);return{longPressProps:(0,s.v)(v,y)}}({isDisabled:!B,onLongPress(e){"touch"===e.pointerType&&(A(e),r.setSelectionBehavior("toggle"))}}),X="none"!==C&&r.isLink(v)?e=>{i.Fe.isOpening||e.preventDefault()}:void 0;return{itemProps:(0,s.v)(O,D||F||x&&!S?H:{},B?Y:{},{onDoubleClick:q,onDragStartCapture:e=>{"touch"===V.current&&U.current&&e.preventDefault()},onClick:X,id:t},x?{onMouseDown:e=>e.preventDefault()}:void 0),isPressed:G,isSelected:r.isSelected(v),isFocused:r.isFocused&&r.focusedKey===v,isDisabled:S,allowsSelection:D,hasAction:j}}function y(){let e=window.event;return(null==e?void 0:e.key)==="Enter"}function b(){let e=window.event;return(null==e?void 0:e.key)===" "||(null==e?void 0:e.code)==="Space"}}