yacd/assets/Connections-2c1d9d67.js

2 lines
68 KiB
JavaScript
Raw Normal View History

2023-02-12 23:03:37 +08:00
import{r as ue,R as Pe,c as Ge,a as ro,M as Tn,j as $,b as ye,p as Rn,m as bn,d as oo,B as Cn,e as io,f as so,g as uo,u as ao,C as lo,F as co,I as fo,h as po,S as go}from"./index-3e6aad90.js";import{u as vo}from"./useRemainingViewPortHeight-175c2a6c.js";import{C as mo}from"./chevron-down-fcc32a65.js";import{f as ho}from"./index-2a3ca6b4.js";import{F as yo,p as wo,A as Ro}from"./Fab-169bb281.js";import{P as bo,a as Co}from"./play-30aef65c.js";function It(y){return F=>!!F.type&&F.type.tabsRole===y}const dt=It("Tab"),Et=It("TabList"),Tt=It("TabPanel");function So(y){return dt(y)||Et(y)||Tt(y)}function Bt(y,F){return ue.Children.map(y,p=>p===null?null:So(p)?F(p):p.props&&p.props.children&&typeof p.props.children=="object"?ue.cloneElement(p,{...p.props,children:Bt(p.props.children,F)}):p)}function Fn(y,F){return ue.Children.forEach(y,p=>{p!==null&&(dt(p)||Tt(p)?F(p):p.props&&p.props.children&&typeof p.props.children=="object"&&(Et(p)&&F(p),Fn(p.props.children,F)))})}function An(y){let F=0;return Fn(y,p=>{dt(p)&&F++}),F}function kn(y){return y&&"getAttribute"in y}function Sn(y){return kn(y)&&y.getAttribute("data-rttab")}function ke(y){return kn(y)&&y.getAttribute("aria-disabled")==="true"}let at;function Po(y){const F=y||(typeof window<"u"?window:void 0);try{at=!!(typeof F<"u"&&F.document&&F.document.activeElement)}catch{at=!1}}const xo={className:"react-tabs",focus:!1},Ft=y=>{let F=ue.useRef([]),p=ue.useRef([]);const g=ue.useRef();function X(x,H){if(x<0||x>=u())return;const{onSelect:Z,selectedIndex:Be}=y;Z(x,Be,H)}function Q(x){const H=u();for(let Z=x+1;Z<H;Z++)if(!ke(K(Z)))return Z;for(let Z=0;Z<x;Z++)if(!ke(K(Z)))return Z;return x}function c(x){let H=x;for(;H--;)if(!ke(K(H)))return H;for(H=u();H-- >x;)if(!ke(K(H)))return H;return x}function V(){const x=u();for(let H=0;H<x;H++)if(!ke(K(H)))return H;return null}function oe(){let x=u();for(;x--;)if(!ke(K(x)))return x;return null}function u(){const{children:x}=y;return An(x)}function K(x){return F.current[`tabs-${x}`]}function ce(){let x=0;const{children:H,disabledTabClassName:Z,focus:Be,forceRenderTabPanel:ae,selectedIndex:de,selectedTabClassName:ve,selectedTabPanelClassName:Ae,environment:Oe}=y;p.current=p.current||[];let gt=p.current.length-u();const vt=ue.useId();for(;gt++<0;)p.current.push(`${vt}${p.current.length}`);return Bt(H,Ie=>{let _e=Ie;if(Et(Ie)){let Se=0,Xe=!1;at==null&&Po(Oe);const Qe=Oe||(typeof window<"u"?window:void 0);at&&Qe&&(Xe=Pe.Children.toArray(Ie.props.children).filter(dt).some((Je,ze)=>Qe.document.activeElement===K(ze))),_e=ue.cloneElement(Ie,{children:Bt(Ie.props.children,Je=>{const ze=`tabs-${Se}`,Ye=de===Se,Me={tabRef:Ze=>{F.current[ze]=Ze},id:p.current[Se],selected:Ye,focus:Ye&&(Be||Xe)};return ve&&(Me.selectedClassName=ve),Z&&(Me.disabledClassName=Z),Se++,ue.cloneElement(Je,Me)})})}else if(Tt(Ie)){const Se={id:p.current[x],selected:de===x};ae&&(Se.forceRender=ae),Ae&&(Se.selectedClassName=Ae),x++,_e=ue.cloneElement(Ie,Se)}return _e})}function Y(x){const{direction:H,disableUpDownKeys:Z,disableLeftRightKeys:Be}=y;if(D(x.target)){let{selectedIndex:ae}=y,de=!1,ve=!1;(x.code==="Space"||x.keyCode===32||x.code==="Enter"||x.keyCode===13)&&(de=!0,ve=!1,ie(x)),!Be&&(x.keyCode===37||x.code==="ArrowLeft")||!Z&&(x.keyCode===38||x.code==="ArrowUp")?(H==="rtl"?ae=Q(ae):ae=c(ae),de=!0,ve=!0):!Be&&(x.keyCode===39||x.code==="ArrowRight")||!Z&&(x.keyCode===40||x.code==="ArrowDown")?(H==="rtl"?ae=c(ae):ae=Q(ae),de=!0,ve=!0):x.keyCode===35||x.code==="End"?(ae=oe(),de=!0,ve=!0):(x.keyCode===36||x.code==="Home")&&(ae=V(),de=!0,ve=!0),de&&x.preventDefault(),ve&&X(ae,x)}}function ie(x){let H=x.target;do if(D(H)){if(ke(H))return;const Z=[].slice.call(H.parentNode.children).filter(Sn).indexOf(H);X(Z,x);return}while((H=H.parentNode)!=null)}function D(x){if(!Sn(x))return!1;let H=x.parentElement;do{if(H===g.current)return!0;if(H.getAttribute("data-rttabs"))break;H=H.parentElement}while(H);return!1}const{children:J,className:me,disabledTabClassName:ge,domRef:le,focus:M,forceRenderTabPanel:Re,onSelect:te,selectedIndex:we,selectedTabClassName:xe,selectedTabPanelClassName:We,envi