1import{h as u,j as e,R as v}from"./codemirror-core-vkcnXJgD.js";import{b as j,k as w,u as T,a as S,P as _,s as D}from"./index-BfMm4PRv.js";import{c as F,b as q,a as K}from"./chunk-B75B6XQK-ByC2I748.js";import{x as R,E as I,u as k,G as z,c as h,A as M,C as y,O as G}from"./react-dom-CwaHFgt6.js";import{M as H,a as U,b as J,c as V,d as W}from"./index-B-95QZyk.js";import{I as X}from"./index-j3cnden5.js";import{u as Q}from"./use-dialog-vw3O4HMu.js";import{i as Y}from"./chunk-MLPFQTYO-D2IrbQQp.js";import{s as Z,P as $,w as ee}from"./process_utils-C0V7b5T-.js";import{Q as B}from"./qq_manager-ej7_xugh.js";import"./chunk-FGM523TA-BJSiCD_V.js";import"./iconBase-DqQMrcxU.js";import"./index-ckqvMWAF.js";import"./index-CejnNse1.js";const te=u.createContext(null),E={didCatch:!1,error:null};class re extends u.Component{constructor(r){super(r),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=E}static getDerivedStateFromError(r){return{didCatch:!0,error:r}}resetErrorBoundary(){const{error:r}=this.state;if(r!==null){for(var t,a,s=arguments.length,l=new Array(s),n=0;n<s;n++)l[n]=arguments[n];(t=(a=this.props).onReset)===null||t===void 0||t.call(a,{args:l,reason:"imperative-api"}),this.setState(E)}}componentDidCatch(r,t){var a,s;(a=(s=this.props).onError)===null||a===void 0||a.call(s,r,t)}componentDidUpdate(r,t){const{didCatch:a}=this.state,{resetKeys:s}=this.props;if(a&&t.error!==null&&ae(r.resetKeys,s)){var l,n;(l=(n=this.props).onReset)===null||l===void 0||l.call(n,{next:s,prev:r.resetKeys,reason:"keys"}),this.setState(E)}}render(){const{children:r,fallbackRender:t,FallbackComponent:a,fallback:s}=this.props,{didCatch:l,error:n}=this.state;let c=r;if(l){const f={error:n,resetErrorBoundary:this.resetErrorBoundary};if(typeof t=="function")c=t(f);else if(a)c=u.createElement(a,f);else if(s!==void 0)c=s;else throw n}return u.createElement(te.Provider,{value:{didCatch:l,error:n,resetErrorBoundary:this.resetErrorBoundary}},c)}}function ae(){let o=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return o.length!==r.length||o.some((t,a)=>!Object.is(t,r[a]))}function se({error:o,resetErrorBoundary:r}){return e.jsxs("div",{className:"pt-32 flex flex-col justify-center items-center",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx(H,{className:"mr-2",color:"red",size:30}),e.jsx("h1",{className:"text-2xl",children:"åºéäº"})]}),e.jsxs("div",{className:"my-6 flex flex-col justify-center items-center",children:[e.jsx("p",{className:"mb-2",children:"é误信æ¯"}),e.jsx(F,{children:o.message})]}),e.jsx(j,{color:"primary",size:"md",onPress:r,children:"éè¯"})]})}const A=(o,r=!1)=>o==null?void 0:o.map(t=>{var N;const a=R(),s=I(),[l,n]=v.useState(!!t.autoOpen),c=v.useMemo(()=>t.items&&t.items.length>0,[t.items]),[f]=k(w.backgroundImage,""),[m]=k(w.customIcons,{}),d=v.useMemo(()=>t.href?!!z(t.href,s.pathname):!1,[t.href,s.pathname]),C=b=>{a(b)};v.useEffect(()=>{t.items&&t.items.some(i=>(i==null?void 0:i.href)&&!!z(i.href,s.pathname))&&n(!0)},[t.items,s.pathname]);const x=v.useRef(null);return e.jsxs("div",{children:[e.jsx(j,{className:h("flex items-center w-full text-left justify-start dark:text-white transition-all duration-300",d?"bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-400 shadow-none font-semibold translate-x-1":"hover:bg-default-100 hover:translate-x-1",f&&"backdrop-blur-md text-white dark:text-white"),color:d?"primary":"default",endContent:c?e.jsx("div",{className:h("ml-auto relative w-3 h-3 transition-transform",l&&"transform rotate-180",d?"text-primary-500":"text-primary-200 dark:text-white","before:rounded-full",'before:content-[""]',"before:block","before:absolute","before:w-3","before:h-[4.5px]","before:bg-current","before:top-1/2","before:-left-[3px]","before:transform","before:-translate-y-1/2","before:rotate-45","after:rounded-full",'after:content-[""]',"after:block","after:absolute","after:w-3","after:h-[4.5px]","after:bg-current","after:top-1/2","after:left-[3px]","after:transform","after:-translate-y-1/2","after:-rotate-45")}):e.jsx("div",{className:h("w-3 h-1.5 rounded-full ml-auto",d?"bg-primary-500 animate-nav-spin":"bg-primary-200 dark:bg-white shadow-lg"),"aria-hidden":"true"}),startContent:m[t.label]?e.jsx(Y,{radius:"none",src:m[t.label],alt:t.label,className:"w-5 h-5"}):t.icon,variant:d?r?"solid":"shadow":"light",onPress:()=>{t.href?d||C(t.href):c&&n(!l)},children:t.label}),e.jsx("div",{ref:x,className:"ml-4 overflow-hidden transition-all duration-300",style:{height:l?(N=x.current)==null?void 0:N.scrollHeight:0},children:t.items&&A(t.items,!0)})]},t.href+t.label)}),ne=o=>{const{items:r}=o;return e.jsx("div",{className:"flex flex-col justify-content-center flex-1 gap-2",children:A(r)})},oe=o=>{const{open:r,items:t,onClose:a}=o,{toggleTheme:s,isDark:l}=T(),{revokeAuth:n}=S(),c=Q(),[f]=k(w.backgroundImage,""),m=!!f,d=()=>{c.confirm({title:"éåºç»å½",content:"ç¡®å®è¦éåºç»å½åï¼",onConfirm:n})};return e.jsxs(e.Fragment,{children:[e.jsx(M,{initial:!1,children:r&&e.jsx(y.div,{className:"fixed inset-y-0 left-64 right-0 bg-black/20 backdrop-blur-[1px] z-40 md:hidden","aria-hidden":"true",onClick:a,initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0,transition:{duration:.15}},transition:{duration:.2,delay:.15}})}),e.jsx(y.div,{className:h("overflow-hidden fixed top-0 left-0 h-full z-50 md:static md:shadow-none rounded-r-2xl md:rounded-none",m?"bg-transparent backdrop-blur-md":"bg-content1/70 backdrop-blur-xl backdrop-saturate-150 shadow-xl","md:bg-transparent md:backdrop-blur-none md:backdrop-saturate-100 md:shadow-none"),initial:{width:0},animate:{width:r?"16rem":0},transition:{type:r?"spring":"tween",stiffness:150,damping:r?15:10},style:{overflow:"hidden"},children:e.jsxs(y.div,{className:"w-64 flex flex-col items-stretch h-full transition-transform duration-300 ease-in-out z-30 relative float-right p-4",children:[e.jsxs("div",{className:"flex items-center justify-start gap-3 px-2 my-8 ml-2",children:[e.jsx("div",{className:"h-5 w-1 bg-primary rounded-full shadow-sm"}),e.jsx("div",{className:h("text-xl font-bold tracking-wide select-none",m?"text-white":"text-default-900 dark:text-white"),children:"NapCat"})]}),e.jsxs("div",{className:"overflow-y-auto flex flex-col flex-1 px-2",children:[e.jsx(ne,{items:t}),e.jsxs("div",{className:"mt-auto mb-10 md:mb-0 space-y-3 px-2",children:[e.jsx(j,{className:"w-full bg-primary-50/50 hover:bg-primary-100/80 text-primary-600 font-medium shadow-sm hover:shadow-md transition-all duration-300 backdrop-blur-sm",radius:"full",variant:"flat",onPress:s,startContent:l?e.jsx(J,{size:18}):e.jsx(U,{size:18}),children:"忢䏻é¢"}),e.jsx(j,{className:"w-full mb-2 bg-danger-50/50 hover:bg-danger-100/80 text-danger-500 font-medium shadow-sm hover:shadow-md transition-all duration-300 backdrop-blur-sm",radius:"full",variant:"flat",onPress:d,startContent:e.jsx(X,{size:18}),children:"éåºç»å½"})]})]})]})})]})},P=Z.navItems,L=(o,r)=>{const t=[];if(r){for(const a of o)if(a.href===r)t.push(a.label);else if(a.items){const s=L(a.items,r);s.length>0&&(t.push(a.label),t.push(...s))}}return t},ie=({children:o})=>{const r=I(),t=u.useRef(null),[a,s]=k(w.sideBarOpen,!0),[l]=k(w.backgroundImage,""),n=R(),{isAuth:c,revokeAuth:f}=S(),m=Q(),d=u.useRef(!0),[C,x]=u.useState(!1);u.useEffect(()=>{if(!c)return;const i=async()=>{const O=r.pathname;if(!(O==="/qq_login"||O==="/web_login"))try{const p=await B.getQQLoginInfo();(p==null?void 0:p.online)===!1&&d.current===!0?(d.current=!1,m.confirm({title:"è´¦å·å·²ç¦»çº¿",content:"æ¨ç QQ è´¦å·å·²æçº¿ï¼æ¯å¦éå¯è¿ç¨ä»¥éæ°ç»å½ï¼",confirmText:"éå¯è¿ç¨",cancelText:"éåºè´¦æ·",onConfirm:async()=>{x(!0);try{await $.restartProcess()}catch{}await ee(15e3,()=>{x(!1),window.location.reload()},()=>{x(!1),m.alert({title:"å¯å¨è¶
æ¶",content:"åç«¯å¨ 15 ç§å
æªååºï¼è¯·æ£æ¥ NapCat è¿è¡æ¥å¿ææå¨éå¯ã"})})},onCancel:()=>{f(),n("/web_login")}})):(p==null?void 0:p.online)===!0&&(d.current=!0)}catch{}},g=setInterval(i,5e3);return i(),()=>clearInterval(g)},[c,r.pathname]);const N=async()=>{try{const i=await B.checkQQLoginStatus();i.isOffline?d.current=!1:i.isLogin||(c?n("/qq_login",{replace:!0}):n("/web_login",{replace:!0}))}catch{n("/web_login",{replace:!0})}};u.useEffect(()=>{var i,g;(g=(i=t==null?void 0:t.current)==null?void 0:i.scrollTo)==null||g.call(i,{top:0,behavior:"smooth"})},[r.pathname]),u.useEffect(()=>{c&&N()},[c]);const b=u.useMemo(()=>L(P,r.pathname),[r.pathname]);return e.jsxs("div",{className:"h-screen relative flex items-stretch overflow-hidden",style:{backgroundImage:l?`url(${l})`:void 0,backgroundSize:"cover",backgroundPosition:"center"},children:[e.jsx(_,{loading:C}),e.jsx(oe,{items:P,open:a,onClose:()=>s(!1)}),e.jsxs(y.div,{layout:!0,ref:t,initial:{opacity:0,scale:.98},animate:{opacity:1,scale:1},transition:{duration:.4},className:h("flex-1 overflow-y-auto","transition-all duration-300 ease-in-out","ml-0","pb-10 md:pb-0"),children:[e.jsxs("div",{className:h("h-10 flex items-center font-bold text-xl backdrop-blur-lg rounded-full","dark:bg-background dark:shadow-primary-100","bg-background !bg-opacity-50","shadow-sm shadow-primary-50","z-30 m-2 mb-0 sticky top-2 left-0"),children:[e.jsx("div",{className:h("mr-1 ease-in-out ml-0 md:relative z-50 md:z-auto",a&&"pl-2","md:!ml-0 md:pl-0"),children:e.jsx(j,{isIconOnly:!0,radius:"full",variant:"light",onPress:()=>s(!a),children:a?e.jsx(V,{size:24}):e.jsx(W,{size:24})})}),e.jsx(q,{isDisabled:!0,size:"lg",children:b==null?void 0:b.map((i,g)=>e.jsx(K,{children:e.jsx(M,{mode:"wait",children:e.jsx(y.div,{initial:{opacity:0,y:-10}
1,animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.3},children:i},i)})},g))})]}),e.jsx(re,{fallbackRender:se,children:o})]})]})};function ke(){const o=I();return e.jsx(ie,{children:e.jsx(u.Suspense,{fallback:e.jsx("div",{className:"flex justify-center px-10",children:e.jsx(D,{})}),children:e.jsx(M,{mode:"wait",children:e.jsx(y.div,{initial:{opacity:0,y:20},animate:{opacity:1,y:0},transition:{type:"tween",ease:"easeInOut"},children:e.jsx(G,{})},o.pathname)})})})}export{ke as default};
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.