// @license magnet:?xt=urn:btih:0b31508aeb0634b347b8270c7bee4d411b5d4109&dn=agpl-3.0.txt AGPL-3.0-or-later // @source: https://gitlab.com/soapbox-pub/ditto/-/tree/f0a3877c const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/EmojiPicker-DIvGQUn_.js","assets/rolldown-runtime-QTnfLwEv.js","assets/lucide-icons-BdRF0moN.js","assets/jsx-runtime-By8HlURe.js","assets/useTheme-B8n3R7ig.js","assets/useQuery-rCAlChE8.js","assets/useAppContext-Ughdk2-Z.js","assets/useEncryptedSettings-DPGHcvzd.js","assets/dist-DQ82bf9M.js","assets/esm-CRVqHnq2.js","assets/sha256-Cx9u8cje.js","assets/useMutation-CgsR0O-3.js","assets/fetchFreshEvent-Kkz3MzZN.js","assets/useCurrentUser-C6OJJlWo.js","assets/preload-helper-CZgWQFsJ.js","assets/dist-DQ_zK-Nr.js","assets/fontLoader-C8ZADbrS.js","assets/sanitizeUrl-Bk5f35GN.js","assets/useNostrPublish-CrMjnYm4.js","assets/useIsMobile-B6g4lnSy.js","assets/native-GDBYL4Zp.js","assets/webxdcMeta-BE41E4P0.js","assets/browser-C1AyMpfR.js"])))=>i.map(i=>d[i]); import{n as e,r as t}from"./rolldown-runtime-QTnfLwEv.js";import{$ as n,Ar as r,At as i,C as a,D as o,Fn as s,Fr as c,Ft as l,Hn as u,Ii as d,It as f,Kn as p,Li as m,Mn as h,N as g,Oi as _,Ot as v,S as y,Sr as b,Tr as x,Vi as S,Wr as C,Wt as w,Y as ee,_n as T,a as E,an as te,bt as ne,c as re,dn as ie,ht as ae,li as oe,ln as se,q as ce,qi as le,si as ue,u as de,ui as fe,wi as pe,wn as D}from"./lucide-icons-BdRF0moN.js";import{t as O}from"./react-dom-YCZzGcHh.js";import{t as k}from"./jsx-runtime-By8HlURe.js";import{t as me}from"./preload-helper-CZgWQFsJ.js";import{O as A,T as he,b as ge,f as j,t as _e,w as M}from"./dist-DQ82bf9M.js";import{u as ve}from"./esm-CRVqHnq2.js";import{h as ye,t as N}from"./useQuery-rCAlChE8.js";import{t as be}from"./useMutation-CgsR0O-3.js";import{$ as xe,B as P,E as Se,G as Ce,H as we,J as Te,K as F,U as Ee,V as I,W as De,_ as Oe,b as ke,d as Ae,f as je,l as Me,p as Ne,t as Pe,v as Fe,x as Ie,y as Le}from"./EmbeddedNote-BKfkvcrg.js";import{t as Re}from"./useLocalStorage-DLDvi0Ge.js";import{t as ze}from"./useAppContext-Ughdk2-Z.js";import{r as Be}from"./sanitizeUrl-Bk5f35GN.js";import{t as Ve}from"./useLanguage-yd3vEXqu.js";import"./encryptedFile-DKFYUsvG.js";import{l as He,s as Ue,t as We}from"./useCurrentUser-C6OJJlWo.js";import{t as L}from"./utils-BFSTDHdM.js";import{n as R}from"./dist-BI-be9Ir.js";import{t as Ge}from"./dist-DEYuuXMO.js";import{t as Ke}from"./button-Cs26nq0r.js";import{t as qe}from"./useNostrPublish-CrMjnYm4.js";import{t as z}from"./nostrId-DuqQCAdJ.js";import{n as Je}from"./appRelays-Clm5NPIe.js";import{n as Ye,o as Xe,r as Ze,t as Qe}from"./avatar--oX_CTF4.js";import{n as B}from"./chunk-62JRHF6Z-yJW_vgm4.js";import{r as $e}from"./customEmoji-kpim4Htm.js";import{n as et}from"./hashtag-DjDKS0mr.js";import{n as tt,r as nt,t as V}from"./CustomEmoji-DRcU63lJ.js";import{n as rt,t as it}from"./useProfileUrl-DoFhqUUR.js";import{b as at}from"./BioContent-BjUPDB1O.js";import{r as ot,t as st}from"./dist-Bz2abD7M.js";import{t as ct}from"./dist-BMrfXngQ.js";import{t as H}from"./dist-D9YQw-T8.js";import{t as lt}from"./dist-DTSySAaw.js";import{t as ut}from"./FallbackImage-Dlnc8809.js";import{t as dt}from"./ExternalFavicon-BWUhHW7H.js";import{i as ft,n as U,r as pt}from"./haptics-Cp_uF-bV.js";import{t as mt}from"./parseAddr-BmO3JZWT.js";import{t as ht}from"./input-CM5Fnyvy.js";import{t as W}from"./dist-CxcvWxxD.js";import{n as G,t as K}from"./dist-CpRh64jj.js";import{t as gt}from"./dist-CX38Lmo0.js";import{t as _t}from"./usePortalContainer-mvErHojv.js";import{i as vt,r as yt,t as bt}from"./popover-Dw5E1auH.js";import{t as q}from"./skeleton-CVls4GW9.js";import{t as xt}from"./useUploadFile-BpPXwoE0.js";import{n as St}from"./safeNip19-CtQLwPmS.js";import{o as Ct}from"./useEventInteractions-Buyvdv_T.js";import{d as wt,t as J}from"./ComposeDialogContent-YxhSZA-Y.js";import{t as Tt}from"./WikipediaIcon-Dvm9f9D4.js";import{t as Et}from"./BlueskyIcon-BZ9o1lYL.js";import{i as Dt,n as Ot,t as kt}from"./tooltip-Ba63GpbC.js";import{c as At,t as jt}from"./dialog-C3CFmras.js";import{t as Mt}from"./dist-D7z3WTXi.js";import{n as Nt,t as Y}from"./useLinkPreview-CqNF97jn.js";import{g as Pt,i as X,l as Ft,m as It,n as Lt,o as Rt,u as Z}from"./bitcoinMoney-CQsGrYK3.js";import{n as zt,r as Bt}from"./countries-Du6BjHuX.js";import"./extraKinds-BydAXtVV.js";import{b as Vt}from"./sidebarItems-BFr7FKBa.js";import{t as Ht}from"./formatNumber-D1ols1S-.js";import"./imeta-83Lqxs5-.js";import{t as Ut}from"./formatTime-CT4ZmnVr.js";import{t as Wt}from"./useCustomEmojis-BRL1hilD.js";import{t as Gt}from"./useSearchProfiles-uU0NOVhy.js";import{t as Kt}from"./useIsMobile-B6g4lnSy.js";import{t as qt}from"./useShareOrigin-04gGNDPW.js";import{t as Jt}from"./useFeedSettings-DkFDaYIY.js";import{n as Yt,r as Xt}from"./birthday-DHyHAOFk.js";import{t as Zt}from"./resizeImage-LOlp-rx5.js";import"./DecryptedImage-DLbW5kmn.js";import{t as Qt}from"./wikimedia-CCPyM-j2.js";var Q=t(le(),1),$=k(),$t=`DismissableLayer`,en=`dismissableLayer.update`,tn=`dismissableLayer.pointerDownOutside`,nn=`dismissableLayer.focusOutside`,rn,an=Q.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),on=Q.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:i,onFocusOutside:a,onInteractOutside:o,onDismiss:s,...c}=e,l=Q.useContext(an),[u,d]=Q.useState(null),f=u?.ownerDocument??globalThis?.document,[,p]=Q.useState({}),m=R(t,e=>d(e)),h=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),_=h.indexOf(g),v=u?h.indexOf(u):-1,y=l.layersWithOutsidePointerEventsDisabled.size>0,b=v>=_,x=ln(e=>{let t=e.target,n=[...l.branches].some(e=>e.contains(t));!b||n||(i?.(e),o?.(e),e.defaultPrevented||s?.())},f),S=un(e=>{let t=e.target;[...l.branches].some(e=>e.contains(t))||(a?.(e),o?.(e),e.defaultPrevented||s?.())},f);return lt(e=>{v===l.layers.size-1&&(r?.(e),!e.defaultPrevented&&s&&(e.preventDefault(),s()))},f),Q.useEffect(()=>{if(u)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(rn=f.body.style.pointerEvents,f.body.style.pointerEvents=`none`),l.layersWithOutsidePointerEventsDisabled.add(u)),l.layers.add(u),dn(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=rn)}},[u,f,n,l]),Q.useEffect(()=>()=>{u&&(l.layers.delete(u),l.layersWithOutsidePointerEventsDisabled.delete(u),dn())},[u,l]),Q.useEffect(()=>{let e=()=>p({});return document.addEventListener(en,e),()=>document.removeEventListener(en,e)},[]),(0,$.jsx)(K.div,{...c,ref:m,style:{pointerEvents:y?b?`auto`:`none`:void 0,...e.style},onFocusCapture:W(e.onFocusCapture,S.onFocusCapture),onBlurCapture:W(e.onBlurCapture,S.onBlurCapture),onPointerDownCapture:W(e.onPointerDownCapture,x.onPointerDownCapture)})});on.displayName=$t;var sn=`DismissableLayerBranch`,cn=Q.forwardRef((e,t)=>{let n=Q.useContext(an),r=Q.useRef(null),i=R(t,r);return Q.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,$.jsx)(K.div,{...e,ref:i})});cn.displayName=sn;function ln(e,t=globalThis?.document){let n=H(e),r=Q.useRef(!1),i=Q.useRef(()=>{});return Q.useEffect(()=>{let e=e=>{if(e.target&&!r.current){let r=function(){fn(tn,n,a,{discrete:!0})},a={originalEvent:e};e.pointerType===`touch`?(t.removeEventListener(`click`,i.current),i.current=r,t.addEventListener(`click`,i.current,{once:!0})):r()}else t.removeEventListener(`click`,i.current);r.current=!1},a=window.setTimeout(()=>{t.addEventListener(`pointerdown`,e)},0);return()=>{window.clearTimeout(a),t.removeEventListener(`pointerdown`,e),t.removeEventListener(`click`,i.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function un(e,t=globalThis?.document){let n=H(e),r=Q.useRef(!1);return Q.useEffect(()=>{let e=e=>{e.target&&!r.current&&fn(nn,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function dn(){let e=new CustomEvent(en);document.dispatchEvent(e)}function fn(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?G(i,a):i.dispatchEvent(a)}var pn=on,mn=cn,hn=t(O(),1),gn=`Portal`,_n=Q.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=Q.useState(!1);st(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?hn.createPortal((0,$.jsx)(K.div,{...r,ref:t}),o):null});_n.displayName=gn;var vn=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),yn=`VisuallyHidden`,bn=Q.forwardRef((e,t)=>(0,$.jsx)(K.span,{...e,ref:t,style:{...vn,...e.style}}));bn.displayName=yn;var xn=`ToastProvider`,[Sn,Cn,wn]=Mt(`Toast`),[Tn,En]=ot(`Toast`,[wn]),[Dn,On]=Tn(xn),kn=e=>{let{__scopeToast:t,label:n=`Notification`,duration:r=5e3,swipeDirection:i=`right`,swipeThreshold:a=50,children:o}=e,[s,c]=Q.useState(null),[l,u]=Q.useState(0),d=Q.useRef(!1),f=Q.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${xn}\`. Expected non-empty \`string\`.`),(0,$.jsx)(Sn.Provider,{scope:t,children:(0,$.jsx)(Dn,{scope:t,label:n,duration:r,swipeDirection:i,swipeThreshold:a,toastCount:l,viewport:s,onViewportChange:c,onToastAdd:Q.useCallback(()=>u(e=>e+1),[]),onToastRemove:Q.useCallback(()=>u(e=>e-1),[]),isFocusedToastEscapeKeyDownRef:d,isClosePausedRef:f,children:o})})};kn.displayName=xn;var An=`ToastViewport`,jn=[`F8`],Mn=`toast.viewportPause`,Nn=`toast.viewportResume`,Pn=Q.forwardRef((e,t)=>{let{__scopeToast:n,hotkey:r=jn,label:i=`Notifications ({hotkey})`,...a}=e,o=On(An,n),s=Cn(n),c=Q.useRef(null),l=Q.useRef(null),u=Q.useRef(null),d=Q.useRef(null),f=R(t,d,o.onViewportChange),p=r.join(`+`).replace(/Key/g,``).replace(/Digit/g,``),m=o.toastCount>0;Q.useEffect(()=>{let e=e=>{r.length!==0&&r.every(t=>e[t]||e.code===t)&&d.current?.focus()};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[r]),Q.useEffect(()=>{let e=c.current,t=d.current;if(m&&e&&t){let n=()=>{if(!o.isClosePausedRef.current){let e=new CustomEvent(Mn);t.dispatchEvent(e),o.isClosePausedRef.current=!0}},r=()=>{if(o.isClosePausedRef.current){let e=new CustomEvent(Nn);t.dispatchEvent(e),o.isClosePausedRef.current=!1}},i=t=>{e.contains(t.relatedTarget)||r()},a=()=>{e.contains(document.activeElement)||r()};return e.addEventListener(`focusin`,n),e.addEventListener(`focusout`,i),e.addEventListener(`pointermove`,n),e.addEventListener(`pointerleave`,a),window.addEventListener(`blur`,n),window.addEventListener(`focus`,r),()=>{e.removeEventListener(`focusin`,n),e.removeEventListener(`focusout`,i),e.removeEventListener(`pointermove`,n),e.removeEventListener(`pointerleave`,a),window.removeEventListener(`blur`,n),window.removeEventListener(`focus`,r)}}},[m,o.isClosePausedRef]);let h=Q.useCallback(({tabbingDirection:e})=>{let t=s().map(t=>{let n=t.ref.current,r=[n,...sr(n)];return e===`forwards`?r:r.reverse()});return(e===`forwards`?t.reverse():t).flat()},[s]);return Q.useEffect(()=>{let e=d.current;if(e){let t=t=>{let n=t.altKey||t.ctrlKey||t.metaKey;if(t.key===`Tab`&&!n){let n=document.activeElement,r=t.shiftKey;if(t.target===e&&r){l.current?.focus();return}let i=h({tabbingDirection:r?`backwards`:`forwards`}),a=i.findIndex(e=>e===n);cr(i.slice(a+1))?t.preventDefault():r?l.current?.focus():u.current?.focus()}};return e.addEventListener(`keydown`,t),()=>e.removeEventListener(`keydown`,t)}},[s,h]),(0,$.jsxs)(mn,{ref:c,role:`region`,"aria-label":i.replace(`{hotkey}`,p),tabIndex:-1,style:{pointerEvents:m?void 0:`none`},children:[m&&(0,$.jsx)(In,{ref:l,onFocusFromOutsideViewport:()=>{cr(h({tabbingDirection:`forwards`}))}}),(0,$.jsx)(Sn.Slot,{scope:n,children:(0,$.jsx)(K.ol,{tabIndex:-1,...a,ref:f})}),m&&(0,$.jsx)(In,{ref:u,onFocusFromOutsideViewport:()=>{cr(h({tabbingDirection:`backwards`}))}})]})});Pn.displayName=An;var Fn=`ToastFocusProxy`,In=Q.forwardRef((e,t)=>{let{__scopeToast:n,onFocusFromOutsideViewport:r,...i}=e,a=On(Fn,n);return(0,$.jsx)(bn,{"aria-hidden":!0,tabIndex:0,...i,ref:t,style:{position:`fixed`},onFocus:e=>{let t=e.relatedTarget;a.viewport?.contains(t)||r()}})});In.displayName=Fn;var Ln=`Toast`,Rn=`toast.swipeStart`,zn=`toast.swipeMove`,Bn=`toast.swipeCancel`,Vn=`toast.swipeEnd`,Hn=Q.forwardRef((e,t)=>{let{forceMount:n,open:r,defaultOpen:i,onOpenChange:a,...o}=e,[s,c]=ct({prop:r,defaultProp:i??!0,onChange:a,caller:Ln});return(0,$.jsx)(gt,{present:n||s,children:(0,$.jsx)(Gn,{open:s,...o,ref:t,onClose:()=>c(!1),onPause:H(e.onPause),onResume:H(e.onResume),onSwipeStart:W(e.onSwipeStart,e=>{e.currentTarget.setAttribute(`data-swipe`,`start`)}),onSwipeMove:W(e.onSwipeMove,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`move`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-move-y`,`${n}px`)}),onSwipeCancel:W(e.onSwipeCancel,e=>{e.currentTarget.setAttribute(`data-swipe`,`cancel`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-end-y`)}),onSwipeEnd:W(e.onSwipeEnd,e=>{let{x:t,y:n}=e.detail.delta;e.currentTarget.setAttribute(`data-swipe`,`end`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-x`),e.currentTarget.style.removeProperty(`--radix-toast-swipe-move-y`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-x`,`${t}px`),e.currentTarget.style.setProperty(`--radix-toast-swipe-end-y`,`${n}px`),c(!1)})})})});Hn.displayName=Ln;var[Un,Wn]=Tn(Ln,{onClose(){}}),Gn=Q.forwardRef((e,t)=>{let{__scopeToast:n,type:r=`foreground`,duration:i,open:a,onClose:o,onEscapeKeyDown:s,onPause:c,onResume:l,onSwipeStart:u,onSwipeMove:d,onSwipeCancel:f,onSwipeEnd:p,...m}=e,h=On(Ln,n),[g,_]=Q.useState(null),v=R(t,e=>_(e)),y=Q.useRef(null),b=Q.useRef(null),x=i||h.duration,S=Q.useRef(0),C=Q.useRef(x),w=Q.useRef(0),{onToastAdd:ee,onToastRemove:T}=h,E=H(()=>{g?.contains(document.activeElement)&&h.viewport?.focus(),o()}),te=Q.useCallback(e=>{!e||e===1/0||(window.clearTimeout(w.current),S.current=new Date().getTime(),w.current=window.setTimeout(E,e))},[E]);Q.useEffect(()=>{let e=h.viewport;if(e){let t=()=>{te(C.current),l?.()},n=()=>{let e=new Date().getTime()-S.current;C.current-=e,window.clearTimeout(w.current),c?.()};return e.addEventListener(Mn,n),e.addEventListener(Nn,t),()=>{e.removeEventListener(Mn,n),e.removeEventListener(Nn,t)}}},[h.viewport,x,c,l,te]),Q.useEffect(()=>{a&&!h.isClosePausedRef.current&&te(x)},[a,x,h.isClosePausedRef,te]),Q.useEffect(()=>(ee(),()=>T()),[ee,T]);let ne=Q.useMemo(()=>g?nr(g):null,[g]);return h.viewport?(0,$.jsxs)($.Fragment,{children:[ne&&(0,$.jsx)(Kn,{__scopeToast:n,role:`status`,"aria-live":r===`foreground`?`assertive`:`polite`,"aria-atomic":!0,children:ne}),(0,$.jsx)(Un,{scope:n,onClose:E,children:hn.createPortal((0,$.jsx)(Sn.ItemSlot,{scope:n,children:(0,$.jsx)(pn,{asChild:!0,onEscapeKeyDown:W(s,()=>{h.isFocusedToastEscapeKeyDownRef.current||E(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:(0,$.jsx)(K.li,{role:`status`,"aria-live":`off`,"aria-atomic":!0,tabIndex:0,"data-state":a?`open`:`closed`,"data-swipe-direction":h.swipeDirection,...m,ref:v,style:{userSelect:`none`,touchAction:`none`,...e.style},onKeyDown:W(e.onKeyDown,e=>{e.key===`Escape`&&(s?.(e.nativeEvent),e.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,E()))}),onPointerDown:W(e.onPointerDown,e=>{e.button===0&&(y.current={x:e.clientX,y:e.clientY})}),onPointerMove:W(e.onPointerMove,e=>{if(!y.current)return;let t=e.clientX-y.current.x,n=e.clientY-y.current.y,r=!!b.current,i=[`left`,`right`].includes(h.swipeDirection),a=[`left`,`up`].includes(h.swipeDirection)?Math.min:Math.max,o=i?a(0,t):0,s=i?0:a(0,n),c=e.pointerType===`touch`?10:2,l={x:o,y:s},f={originalEvent:e,delta:l};r?(b.current=l,rr(zn,d,f,{discrete:!1})):ir(l,h.swipeDirection,c)?(b.current=l,rr(Rn,u,f,{discrete:!1}),e.target.setPointerCapture(e.pointerId)):(Math.abs(t)>c||Math.abs(n)>c)&&(y.current=null)}),onPointerUp:W(e.onPointerUp,e=>{let t=b.current,n=e.target;if(n.hasPointerCapture(e.pointerId)&&n.releasePointerCapture(e.pointerId),b.current=null,y.current=null,t){let n=e.currentTarget,r={originalEvent:e,delta:t};ir(t,h.swipeDirection,h.swipeThreshold)?rr(Vn,p,r,{discrete:!0}):rr(Bn,f,r,{discrete:!0}),n.addEventListener(`click`,e=>e.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),Kn=e=>{let{__scopeToast:t,children:n,...r}=e,i=On(Ln,t),[a,o]=Q.useState(!1),[s,c]=Q.useState(!1);return ar(()=>o(!0)),Q.useEffect(()=>{let e=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(e)},[]),s?null:(0,$.jsx)(_n,{asChild:!0,children:(0,$.jsx)(bn,{...r,children:a&&(0,$.jsxs)($.Fragment,{children:[i.label,` `,n]})})})},qn=`ToastTitle`,Jn=Q.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,$.jsx)(K.div,{...r,ref:t})});Jn.displayName=qn;var Yn=`ToastDescription`,Xn=Q.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e;return(0,$.jsx)(K.div,{...r,ref:t})});Xn.displayName=Yn;var Zn=`ToastAction`,Qn=Q.forwardRef((e,t)=>{let{altText:n,...r}=e;return n.trim()?(0,$.jsx)(tr,{altText:n,asChild:!0,children:(0,$.jsx)(er,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Zn}\`. Expected non-empty \`string\`.`),null)});Qn.displayName=Zn;var $n=`ToastClose`,er=Q.forwardRef((e,t)=>{let{__scopeToast:n,...r}=e,i=Wn($n,n);return(0,$.jsx)(tr,{asChild:!0,children:(0,$.jsx)(K.button,{type:`button`,...r,ref:t,onClick:W(e.onClick,i.onClose)})})});er.displayName=$n;var tr=Q.forwardRef((e,t)=>{let{__scopeToast:n,altText:r,...i}=e;return(0,$.jsx)(K.div,{"data-radix-toast-announce-exclude":``,"data-radix-toast-announce-alt":r||void 0,...i,ref:t})});function nr(e){let t=[];return Array.from(e.childNodes).forEach(e=>{if(e.nodeType===e.TEXT_NODE&&e.textContent&&t.push(e.textContent),or(e)){let n=e.ariaHidden||e.hidden||e.style.display===`none`,r=e.dataset.radixToastAnnounceExclude===``;if(!n)if(r){let n=e.dataset.radixToastAnnounceAlt;n&&t.push(n)}else t.push(...nr(e))}}),t}function rr(e,t,n,{discrete:r}){let i=n.originalEvent.currentTarget,a=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?G(i,a):i.dispatchEvent(a)}var ir=(e,t,n=0)=>{let r=Math.abs(e.x),i=Math.abs(e.y),a=r>i;return t===`left`||t===`right`?a&&r>n:!a&&i>n};function ar(e=()=>{}){let t=H(e);st(()=>{let e=0,n=0;return e=window.requestAnimationFrame(()=>n=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(e),window.cancelAnimationFrame(n)}},[t])}function or(e){return e.nodeType===e.ELEMENT_NODE}function sr(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function cr(e){let t=document.activeElement;return e.some(e=>e===t?!0:(e.focus(),document.activeElement!==t))}var lr=kn,ur=Pn,dr=Hn,fr=Jn,pr=Xn,mr=Qn,hr=er,gr=lr,_r=Q.forwardRef(({className:e,...t},n)=>(0,$.jsx)(ur,{ref:n,className:L(`fixed top-0 z-[300] flex max-h-screen w-full flex-col-reverse p-4 pt-[max(1rem,var(--safe-area-inset-top,env(safe-area-inset-top)))] md:bottom-0 md:right-0 md:top-auto md:flex-col md:pt-4 md:max-w-[420px]`,e),...t}));_r.displayName=ur.displayName;var vr=Ge(`group pointer-events-auto relative flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 max-md:data-[swipe=cancel]:translate-y-0 max-md:data-[swipe=end]:translate-y-[var(--radix-toast-swipe-end-y)] max-md:data-[swipe=move]:translate-y-[var(--radix-toast-swipe-move-y)] max-md:data-[state=open]:slide-in-from-top-full max-md:data-[state=closed]:slide-out-to-top-full md:data-[swipe=cancel]:translate-x-0 md:data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] md:data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] md:data-[state=open]:slide-in-from-bottom-full md:data-[state=closed]:slide-out-to-right-full`,{variants:{variant:{default:`border bg-background text-foreground`,destructive:`destructive group border-destructive bg-destructive text-destructive-foreground`,success:`success group border-success bg-success text-success-foreground`}},defaultVariants:{variant:`default`}}),yr=Q.forwardRef(({className:e,variant:t,...n},r)=>(0,$.jsx)(dr,{ref:r,className:L(vr({variant:t}),e),...n}));yr.displayName=dr.displayName;var br=Q.forwardRef(({className:e,...t},n)=>(0,$.jsx)(mr,{ref:n,className:L(`inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors hover:bg-secondary focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive`,e),...t}));br.displayName=mr.displayName;var xr=Q.forwardRef(({className:e,...t},n)=>(0,$.jsx)(hr,{ref:n,className:L(`absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-2 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600 group-[.success]:text-success-foreground/70 group-[.success]:hover:text-success-foreground`,e),"toast-close":``,...t,children:(0,$.jsx)(E,{className:`h-4 w-4`})}));xr.displayName=hr.displayName;var Sr=Q.forwardRef(({className:e,...t},n)=>(0,$.jsx)(fr,{ref:n,className:L(`text-sm font-semibold`,e),...t}));Sr.displayName=fr.displayName;var Cr=Q.forwardRef(({className:e,...t},n)=>(0,$.jsx)(pr,{ref:n,className:L(`text-sm opacity-90`,e),...t}));Cr.displayName=pr.displayName;function wr(e){if(e.startsWith(`isbn:`))return{type:`isbn`,value:e};if(e.startsWith(`iso3166:`))return{type:`iso3166`,value:e,code:e.slice(8)};let t=e.match(/^bitcoin:tx:([0-9a-f]{64})$/i);if(t)return{type:`bitcoin-tx`,value:e,txid:t[1].toLowerCase()};let n=e.match(/^bitcoin:address:(.+)$/);return n?{type:`bitcoin-address`,value:e,address:n[1]}:e.startsWith(`http://`)||e.startsWith(`https://`)?{type:`url`,value:e}:{type:`unknown`,value:e}}function Tr(e){let t=e.replace(/\D/g,``);return t.length===13?`${t.slice(0,3)}-${t.slice(3,4)}-${t.slice(4,9)}-${t.slice(9,12)}-${t.slice(12)}`:t.length===10?`${t.slice(0,1)}-${t.slice(1,5)}-${t.slice(5,9)}-${t.slice(9)}`:e}function Er(e){try{let{pathname:t}=new URL(e),n=t.split(`/`).filter(Boolean);for(let e=n.length-1;e>=0;e--){let t=decodeURIComponent(n[e]);if(!(t.length<4)&&!(/^[A-Za-z0-9_-]{6,14}$/.test(t)&&!/[- ]/.test(t))&&/[-_]/.test(t))return t.replace(/[-_]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase()).trim()}}catch{}return null}function Dr(e){switch(e.type){case`url`:{let t=Er(e.value);if(t)return t;let n=I(e.value);if(n)return n;try{return new URL(e.value).hostname.replace(/^www\./,``)}catch{return`Web Page`}}case`isbn`:return`Books`;case`iso3166`:{let t=zt(e.code);return t?.subdivisionName??t?.name??`Country`}case`bitcoin-tx`:return`Bitcoin Transaction`;case`bitcoin-address`:return`Bitcoin Address`;default:return`External Content`}}function Or(e,t){switch(e.type){case`url`:try{return`${new URL(e.value).hostname.replace(/^www\./,``)} | ${t}`}catch{return`Web Page | ${t}`}case`isbn`:return`Book (ISBN ${e.value.replace(`isbn:`,``)}) | ${t}`;case`iso3166`:{let n=zt(e.code),r=n?.subdivisionName??n?.name;return r?`${r} | ${t}`:`Country | ${t}`}case`bitcoin-tx`:return`Bitcoin TX ${`${e.txid.slice(0,8)}...${e.txid.slice(-8)}`} | ${t}`;case`bitcoin-address`:return`Bitcoin Address ${`${e.address.slice(0,8)}...${e.address.slice(-6)}`} | ${t}`;default:return`External Content | ${t}`}}he({title:A(),authors:ge(he({name:A()})).optional(),number_of_pages:M().optional(),publish_date:A().optional(),publishers:ge(he({name:A()})).optional(),subjects:ge(he({name:A()})).optional(),cover:he({small:A().optional(),medium:A().optional(),large:A().optional()}).optional(),excerpts:ge(he({text:A()})).optional()});async function kr(e,t){try{let n=await fetch(`https://openlibrary.org/isbn/${e}.json`,{signal:t,headers:{Accept:`application/json`}});if(!n.ok)return null;let r=await n.json(),i;if(r.authors&&Array.isArray(r.authors)){let e=r.authors;e.some(e=>e.key&&!e.name)&&(i=await Promise.all(e.map(async e=>{if(e.name)return{name:e.name};if(e.key)try{let n=await fetch(`https://openlibrary.org${e.key}.json`,{signal:t});if(n.ok)return{name:(await n.json()).name??`Unknown Author`}}catch{}return{name:`Unknown Author`}})))}let a;if(r.covers&&Array.isArray(r.covers)&&r.covers.length>0){let e=r.covers[0];a={small:`https://covers.openlibrary.org/b/id/${e}-S.jpg`,medium:`https://covers.openlibrary.org/b/id/${e}-M.jpg`,large:`https://covers.openlibrary.org/b/id/${e}-L.jpg`}}return{title:r.title??`Unknown Title`,authors:i??r.authors,number_of_pages:r.number_of_pages,publish_date:r.publish_date,publishers:r.publishers,subjects:r.subjects?.slice(0,5),cover:a??r.cover,excerpts:r.excerpts}}catch{return null}}function Ar(e){return N({queryKey:[`book-info`,e],queryFn:({signal:t})=>kr(e,t),enabled:!!e,staleTime:1e3*60*60*24,gcTime:1e3*60*60*24*7,retry:1})}var jr=[`#a78bfa`,`#f472b6`,`#fbbf24`,`#38bdf8`,`#34d399`,`#fb7185`],Mr=45,Nr=24,Pr=140,Fr=4,Ir=50,Lr=95,Rr=38,zr=55;function Br(){return{confetti:Array.from({length:Pr},(e,t)=>({kind:`confetti`,left:2+Math.random()*96,speed:Ir+Math.random()*(Lr-Ir),phase:Math.random(),size:7+Math.random()*5,color:jr[t%jr.length],sway:(Math.random()-.5)*60,spin:270+Math.random()*360,round:t%3==0})),balloons:Array.from({length:Fr},()=>({kind:`balloon`,left:5+Math.random()*90,speed:Rr+Math.random()*(zr-Rr),phase:Math.random(),size:44+Math.random()*20,color:``,sway:(Math.random()-.5)*50,spin:(Math.random()-.5)*40,round:!1}))}}function Vr(){let e=(0,Q.useRef)(null),[t,n]=(0,Q.useState)();(0,Q.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=()=>n(t.offsetHeight+32);r();let i=new ResizeObserver(r);return i.observe(t),()=>i.disconnect()},[]);let{confetti:r,balloons:i}=(0,Q.useMemo)(Br,[]),a=t===void 0?0:Math.min(Math.max(Math.round(t/1e3*Mr),Nr),Pr),o=t===void 0?0:Fr;return(0,$.jsxs)(`div`,{ref:e,"aria-hidden":!0,className:`pointer-events-none absolute inset-0 overflow-hidden motion-reduce:hidden`,style:{"--rain-distance":`${t??0}px`},children:[t!==void 0&&r.slice(0,a).map((e,n)=>{let r=t/e.speed;return(0,$.jsx)(`span`,{className:`absolute animate-birthday-rain`,style:{top:-28,left:`${e.left}%`,width:e.size,height:e.round?e.size:e.size*.45,backgroundColor:e.color,borderRadius:e.round?`9999px`:`1px`,opacity:0,animationDelay:`${-e.phase*r}s`,"--rain-duration":`${r}s`,"--rain-sway":`${e.sway}px`,"--rain-spin":`${e.spin}deg`}},`c-${n}`)}),t!==void 0&&i.slice(0,o).map((e,n)=>{let r=t/e.speed;return(0,$.jsx)(`span`,{className:`absolute animate-birthday-float select-none`,style:{bottom:-72,left:`${e.left}%`,fontSize:e.size,lineHeight:1,opacity:0,animationDelay:`${-e.phase*r}s`,"--rain-duration":`${r}s`,"--rain-sway":`${e.sway}px`,"--rain-spin":`${e.spin}deg`},children:`🎈`},`b-${n}`)})]})}function Hr({className:e,pomScale:t=1}){let n=(0,Q.useId)(),r=5.5*t,i=Math.max(7,r+1.5);return(0,$.jsxs)(`svg`,{viewBox:`0 0 64 64`,className:e,"aria-hidden":`true`,children:[(0,$.jsx)(`defs`,{children:(0,$.jsx)(`clipPath`,{id:n,children:(0,$.jsx)(`path`,{d:`M32 7 L53 55 L11 55 Z`})})}),(0,$.jsxs)(`g`,{clipPath:`url(#${n})`,children:[(0,$.jsx)(`rect`,{x:`0`,y:`0`,width:`64`,height:`64`,fill:`#a78bfa`}),(0,$.jsx)(`path`,{d:`M2 45 Q32 36 62 45 L62 58 Q32 49 2 58 Z`,fill:`#f472b6`}),(0,$.jsx)(`path`,{d:`M8 28 Q32 21 56 28 L56 37 Q32 30 8 37 Z`,fill:`#fbbf24`}),(0,$.jsx)(`path`,{d:`M20 12 Q32 9 44 12 L44 19 Q32 16 20 19 Z`,fill:`#38bdf8`})]}),(0,$.jsx)(`path`,{d:`M11 55 Q32 48 53 55 Q32 62 11 55 Z`,fill:`#8b5cf6`}),(0,$.jsx)(`circle`,{cx:`32`,cy:i,r,fill:`#fbbf24`}),(0,$.jsx)(`circle`,{cx:32-1.8*t,cy:i-1.6*t,r:1.8*t,fill:`#fde68a`})]})}var Ur=`https://gifverse.net/api/v1`,Wr=`https://gifverse.net/media`,Gr=30;function Kr(e){let t=`${Wr}/${e.i}/original.gif`;return{id:e.i,title:e.ti||e.de||``,url:t,previewUrl:t,width:e.w||220,height:e.h||160}}function qr(e){return e.results.filter(e=>!e.nsfw).map(Kr)}async function Jr(e){let t=new URLSearchParams({q:e,limit:String(Gr),offset:`0`,sort:`relevant`}),n=await fetch(`${Ur}/search?${t}`);if(!n.ok)throw Error(`GIFverse search failed: ${n.status}`);return{results:qr(await n.json())}}async function Yr(){let e=new URLSearchParams({limit:String(Gr),offset:`0`,sort:`popular`}),t=await fetch(`${Ur}/trending?${e}`);if(!t.ok)throw Error(`GIFverse trending failed: ${t.status}`);return{results:qr(await t.json())}}function Xr(){let[e,t]=(0,Q.useState)(``),[n,r]=(0,Q.useState)(``),i=(0,Q.useRef)(void 0),a=(0,Q.useCallback)(e=>{t(e),clearTimeout(i.current),i.current=setTimeout(()=>{r(e.trim())},300)},[]),o=(0,Q.useCallback)(()=>{t(``),r(``),clearTimeout(i.current)},[]),s=n.length>0,c=N({queryKey:[`gifverse`,`trending`],queryFn:()=>Yr(),staleTime:300*1e3,enabled:!s}),l=N({queryKey:[`gifverse`,`search`,n],queryFn:()=>Jr(n),staleTime:120*1e3,enabled:s}),u=s?l:c;return{query:e,setQuery:a,clearQuery:o,results:u.data?.results??[],isLoading:u.isLoading,isError:u.isError,isSearching:s}}function Zr({gif:e,onClick:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(!1),o=(0,Q.useRef)(null),s=e.width&&e.height?e.width/e.height:1,c=Math.round(150/s);return(0,$.jsxs)(`button`,{type:`button`,onClick:()=>t(e),className:L(`relative w-full rounded-lg overflow-hidden cursor-pointer`,`transition-shadow duration-200 hover:ring-2 hover:ring-primary/60`,`focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary`,`group`),style:{height:c},title:e.title,children:[!n&&!i&&(0,$.jsx)(q,{className:`absolute inset-0 rounded-lg`}),i&&(0,$.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center bg-muted rounded-lg`,children:(0,$.jsx)(h,{className:`size-5 text-muted-foreground/40`})}),(0,$.jsx)(`img`,{ref:o,src:e.previewUrl,alt:e.title,loading:`lazy`,className:L(`w-full h-full object-cover rounded-lg transition-opacity duration-200`,n?`opacity-100`:`opacity-0`),onLoad:()=>r(!0),onError:()=>a(!0),decoding:`async`}),(0,$.jsx)(`div`,{className:L(`absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/60 to-transparent`,`px-2 py-1.5 opacity-0 group-hover:opacity-100 transition-opacity duration-150`),children:(0,$.jsx)(`span`,{className:`text-[10px] text-white line-clamp-1 font-medium`,children:e.title})})]})}function Qr({results:e,onSelect:t}){let n=[[],[]],r=[0,0];for(let t of e){let e=t.width&&t.height?t.width/t.height:1,i=Math.round(150/e),a=r[0]<=r[1]?0:1;n[a].push(t),r[a]+=i+8}return(0,$.jsx)(`div`,{className:`flex gap-2 px-2 pb-2`,children:n.map((e,n)=>(0,$.jsx)(`div`,{className:`flex-1 flex flex-col gap-2`,children:e.map(e=>(0,$.jsx)(Zr,{gif:e,onClick:t},e.id))},n))})}function $r({onSelect:e,autoFocus:t=!0,onSearchActiveChange:n}){let{query:r,setQuery:i,clearQuery:a,results:o,isLoading:s,isError:c,isSearching:l}=Xr(),u=(0,Q.useRef)(null),[d,f]=(0,Q.useState)(!1),p=d||r.trim().length>0;(0,Q.useEffect)(()=>{n?.(p)},[p,n]),(0,Q.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>{u.current?.focus()},100);return()=>clearTimeout(e)},[t]);let m=(0,Q.useCallback)(t=>{e(t)},[e]);return(0,$.jsxs)(`div`,{className:`flex flex-col w-full h-full overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`px-3 pt-3 pb-2`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ne,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground pointer-events-none`}),(0,$.jsx)(ht,{ref:u,value:r,onChange:e=>i(e.target.value),onFocus:()=>f(!0),onBlur:()=>f(!1),placeholder:`Search GIFs...`,className:`pl-8 pr-20 h-9 text-base md:text-sm bg-muted/50 border-0 rounded-lg`}),r?(0,$.jsx)(`button`,{type:`button`,onClick:a,className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors`,children:(0,$.jsx)(E,{className:`size-3.5`})}):(0,$.jsx)(`span`,{className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-[10px] text-muted-foreground/50 pointer-events-none select-none`,children:`Powered by GIFverse`})]})}),(0,$.jsx)(`div`,{className:`px-3 pb-1.5`,children:(0,$.jsx)(`span`,{className:`text-[11px] font-medium text-muted-foreground uppercase tracking-wider`,children:l?`Results`:`Trending`})}),(0,$.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto overscroll-contain`,children:s?(0,$.jsx)(`div`,{className:`px-2 pb-2`,children:(0,$.jsx)(`div`,{className:`flex gap-2`,children:[0,1].map(e=>(0,$.jsx)(`div`,{className:`flex-1 flex flex-col gap-2`,children:Array.from({length:4}).map((e,t)=>(0,$.jsx)(q,{className:`w-full rounded-lg`,style:{height:80+Math.random()*60}},t))},e))})}):c?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,$.jsx)(h,{className:`size-8 mb-2 opacity-40`}),(0,$.jsx)(`p`,{className:`text-sm`,children:`Failed to load GIFs`}),(0,$.jsx)(`p`,{className:`text-xs mt-1`,children:`Please try again`})]}):o.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-48 text-muted-foreground`,children:[(0,$.jsx)(`p`,{className:`text-sm`,children:`No GIFs found`}),(0,$.jsx)(`p`,{className:`text-xs mt-1`,children:`Try a different search term`})]}):(0,$.jsx)(Qr,{results:o,onSelect:m})})]})}function ei({textareaRef:e,isOpen:t,onClose:n,dropdownHeight:r,dropdownWidth:i=280}){let a=(0,Q.useCallback)(t=>{let n=e.current;if(!n)return{top:0,left:0};let a=parseFloat(window.getComputedStyle(n).lineHeight)||20,o=n.getBoundingClientRect(),s=o.top+t.top-n.scrollTop+a+4,c=o.left+Math.max(0,Math.min(t.left,n.clientWidth-i)),l=o.top+t.top-n.scrollTop-r-4;return{top:s+r>window.innerHeight&&l>0?l:s,left:Math.max(8,Math.min(c,window.innerWidth-i-8))}},[e,r,i]);return(0,Q.useEffect)(()=>{if(!t)return;let e=e=>{let t=e.target;t instanceof Element&&t.closest(`[data-autocomplete-dropdown]`)||n()},r=()=>n();return window.addEventListener(`scroll`,e,!0),window.addEventListener(`resize`,r),()=>{window.removeEventListener(`scroll`,e,!0),window.removeEventListener(`resize`,r)}},[t,n]),{computePosition:a,renderPortal:hn.createPortal}}var ti=`direction.boxSizing.width.height.overflowX.overflowY.borderTopWidth.borderRightWidth.borderBottomWidth.borderLeftWidth.borderStyle.paddingTop.paddingRight.paddingBottom.paddingLeft.fontStyle.fontVariant.fontWeight.fontStretch.fontSize.fontSizeAdjust.lineHeight.fontFamily.textAlign.textTransform.textIndent.textDecoration.letterSpacing.wordSpacing.tabSize.MozTabSize.whiteSpace.wordWrap.wordBreak`.split(`.`);function ni(e,t){let n=document.createElement(`div`);n.id=`mention-mirror`;let r=window.getComputedStyle(e);for(let e of ti)n.style[e]=r.getPropertyValue(e.replace(/([A-Z])/g,`-$1`).toLowerCase());n.style.position=`absolute`,n.style.visibility=`hidden`,n.style.whiteSpace=`pre-wrap`,n.style.wordWrap=`break-word`,n.style.overflow=`hidden`,document.body.appendChild(n),n.textContent=e.value.substring(0,t);let i=document.createElement(`span`);i.textContent=`​`,n.appendChild(i);let a=n.getBoundingClientRect(),o=i.getBoundingClientRect(),s={top:o.top-a.top-e.scrollTop,left:o.left-a.left-e.scrollLeft};return document.body.removeChild(n),s}function ri({textareaRef:e,content:t,onInsertMention:n}){let[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(-1),[s,c]=(0,Q.useState)(0),[l,u]=(0,Q.useState)(!1),[d,f]=(0,Q.useState)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(null),{computePosition:h,renderPortal:g}=ei({textareaRef:e,isOpen:l,onClose:(0,Q.useCallback)(()=>u(!1),[]),dropdownHeight:240}),{data:_,followedPubkeys:v}=Gt(l?r:``),y=(0,Q.useCallback)((t,n)=>{let r=e.current;if(!r)return;let a=n??r.selectionStart,s=t??r.value,l=-1;for(let e=a-1;e>=0;e--){let t=s[e];if(t===` `||t===` `||t===` `)break;if(t===`@`){(e===0||/\s/.test(s[e-1]))&&(l=e);break}}if(l===-1){u(!1),i(``),o(-1);return}let d=s.slice(l+1,a);if(d.length===0||d.length>50){u(!1),i(``),o(-1);return}i(d),o(l),u(!0),c(0);let p=ni(r,l);f(h(p))},[e,h]);(0,Q.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{y(t.value,t.selectionStart)},r=()=>y(),i=e=>{[`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key)&&y()};return t.addEventListener(`input`,n),t.addEventListener(`click`,r),t.addEventListener(`keyup`,i),()=>{t.removeEventListener(`input`,n),t.removeEventListener(`click`,r),t.removeEventListener(`keyup`,i)}},[e,y,t]),(0,Q.useEffect)(()=>{let n=e.current;n&&y(t,n.selectionStart)},[t,y,e]),(0,Q.useEffect)(()=>{if(!l||!_||_.length===0)return;let t=e.current;if(!t)return;let n=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),c(e=>e<(_?.length??1)-1?e+1:0);break;case`ArrowUp`:e.preventDefault(),c(e=>e>0?e-1:(_?.length??1)-1);break;case`Enter`:case`Tab`:_&&_.length>0&&(e.preventDefault(),e.stopImmediatePropagation(),b(_[s]));break;case`Escape`:e.preventDefault(),u(!1);break}};return t.addEventListener(`keydown`,n),()=>t.removeEventListener(`keydown`,n)},[l,_,s,e]),(0,Q.useEffect)(()=>{s>=0&&m.current&&m.current.querySelectorAll(`[data-mention-item]`)[s]?.scrollIntoView({block:`nearest`})},[s]);let b=(0,Q.useCallback)(t=>{let s=`nostr:${ve.npubEncode(t.pubkey)} `,c=e.current?.selectionStart??a+r.length+1;n({start:a,end:c,replacement:s}),u(!1),i(``),o(-1)},[a,r,e,n]);return!l||!d||!_||_.length===0?null:g((0,$.jsx)(`div`,{ref:p,"data-autocomplete-dropdown":!0,className:`fixed z-[300] w-[280px] rounded-xl border border-border bg-popover shadow-lg overflow-hidden animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-150 pointer-events-auto`,style:{top:d.top,left:d.left},children:(0,$.jsx)(`div`,{ref:m,className:`max-h-[240px] overflow-y-auto py-1`,children:_.map((e,t)=>(0,$.jsx)(ii,{profile:e,isSelected:t===s,isFollowed:v.has(e.pubkey),onSelect:()=>b(e)},e.pubkey))})}),document.body)}function ii({profile:e,isSelected:t,isFollowed:n,onSelect:r}){let{metadata:i,pubkey:a}=e,s=i.name||i.display_name||`Anonymous`,c=i.nip05,{data:l}=rt(c,a),u=l&&c?c.startsWith(`_@`)?c.slice(2):c:void 0,d=u||ve.npubEncode(a);return(0,$.jsxs)(`button`,{"data-mention-item":!0,className:L(`w-full flex items-center gap-3 px-3 py-2 text-left transition-colors cursor-pointer`,t?`bg-accent text-accent-foreground`:`hover:bg-secondary/60`),onPointerDown:e=>{e.preventDefault(),r()},children:[(0,$.jsxs)(`div`,{className:`relative shrink-0`,children:[(0,$.jsxs)(Qe,{shape:Xe(i),className:`size-8`,children:[(0,$.jsx)(Ze,{src:i.picture,alt:s}),(0,$.jsx)(Ye,{className:`bg-primary/20 text-primary text-xs`,children:s[0]?.toUpperCase()||`?`})]}),n&&(0,$.jsx)(`span`,{className:`absolute -bottom-0.5 -right-0.5 size-3.5 rounded-full bg-primary flex items-center justify-center ring-2 ring-popover`,title:`Following`,children:(0,$.jsx)(o,{className:`size-2 text-primary-foreground`,strokeWidth:3})})]}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsx)(`div`,{className:`flex items-center gap-1.5`,children:(0,$.jsx)(`span`,{className:`font-semibold text-sm truncate`,children:(0,$.jsx)(tt,{tags:e.event.tags,children:s})})}),(0,$.jsx)(`div`,{className:`text-xs text-muted-foreground truncate`,children:u?(0,$.jsx)(`span`,{className:`truncate`,children:d}):(0,$.jsx)(`span`,{className:`truncate font-mono text-[11px]`,children:d})})]})]})}var ai=`direction.boxSizing.width.height.overflowX.overflowY.borderTopWidth.borderRightWidth.borderBottomWidth.borderLeftWidth.borderStyle.paddingTop.paddingRight.paddingBottom.paddingLeft.fontStyle.fontVariant.fontWeight.fontStretch.fontSize.fontSizeAdjust.lineHeight.fontFamily.textAlign.textTransform.textIndent.textDecoration.letterSpacing.wordSpacing.tabSize.MozTabSize.whiteSpace.wordWrap.wordBreak`.split(`.`);function oi(e,t){let n=document.createElement(`div`);n.id=`emoji-mirror`;let r=window.getComputedStyle(e);for(let e of ai)n.style[e]=r.getPropertyValue(e.replace(/([A-Z])/g,`-$1`).toLowerCase());n.style.position=`absolute`,n.style.visibility=`hidden`,n.style.whiteSpace=`pre-wrap`,n.style.wordWrap=`break-word`,n.style.overflow=`hidden`,document.body.appendChild(n),n.textContent=e.value.substring(0,t);let i=document.createElement(`span`);i.textContent=`​`,n.appendChild(i);let a=n.getBoundingClientRect(),o=i.getBoundingClientRect(),s={top:o.top-a.top-e.scrollTop,left:o.left-a.left-e.scrollLeft};return document.body.removeChild(n),s}var si=8;function ci(e){let t=e.emojis,n=e.aliases,r=[];for(let[e,i]of Object.entries(t)){let t=i.skins?.[0]?.native;if(!t)continue;let a=[];for(let[t,r]of Object.entries(n))r===e&&a.push(t);r.push({id:e,name:i.name,native:t,keywords:[...i.keywords||[],...a]})}return r}var li=null,ui=null;function di(){return ui??=me(()=>import(`./native-GDBYL4Zp.js`).then(e=>{li=ci(e.default)}),[]),ui}function fi(e,t){if(!e)return[];let n=e.toLowerCase(),r=[];for(let e of t){let t=e.shortcode.toLowerCase();t===n?r.push({id:`custom:${e.shortcode}`,name:e.shortcode,customUrl:e.url,score:-1}):t.startsWith(n)?r.push({id:`custom:${e.shortcode}`,name:e.shortcode,customUrl:e.url,score:0}):t.includes(n)&&r.push({id:`custom:${e.shortcode}`,name:e.shortcode,customUrl:e.url,score:1})}let i=li??[];for(let e of i)e.id===n?r.push({id:e.id,name:e.name,native:e.native,score:2}):e.id.startsWith(n)?r.push({id:e.id,name:e.name,native:e.native,score:3}):e.id.includes(n)?r.push({id:e.id,name:e.name,native:e.native,score:4}):e.name.toLowerCase().startsWith(n)?r.push({id:e.id,name:e.name,native:e.native,score:5}):e.name.toLowerCase().includes(n)?r.push({id:e.id,name:e.name,native:e.native,score:6}):e.keywords?.some(e=>e.startsWith(n)||e.includes(n))&&r.push({id:e.id,name:e.name,native:e.native,score:7});return r.sort((e,t)=>e.score-t.score),r.slice(0,si)}function pi({textareaRef:e,content:t,onInsertEmoji:n,onCustomEmojiInsert:r}){let{emojis:i}=Wt(),[a,o]=(0,Q.useState)(``),[s,c]=(0,Q.useState)(-1),[l,u]=(0,Q.useState)(0),[d,f]=(0,Q.useState)(!1),[p,m]=(0,Q.useState)(null),h=(0,Q.useRef)(null),g=(0,Q.useRef)(null),{computePosition:_,renderPortal:v}=ei({textareaRef:e,isOpen:d,onClose:(0,Q.useCallback)(()=>f(!1),[]),dropdownHeight:280}),[y,b]=(0,Q.useState)(()=>li!==null);(0,Q.useEffect)(()=>{if(!a||y)return;let e=!1;return di().then(()=>{e||b(!0)}),()=>{e=!0}},[a,y]);let x=(0,Q.useMemo)(()=>fi(a,i),[a,i,y]),S=(0,Q.useCallback)((t,n)=>{let r=e.current;if(!r)return;let i=n??r.selectionStart,a=t??r.value,s=-1;for(let e=i-1;e>=0;e--){let t=a[e];if(t===` `||t===` `||t===` `)break;if(t===`:`&&e32){f(!1),o(``),c(-1);return}if(l.includes(`:`)){f(!1),o(``),c(-1);return}o(l),c(s),f(!0),u(0);let d=oi(r,s);m(_(d))},[e,_]);(0,Q.useEffect)(()=>{let t=e.current;if(!t)return;let n=()=>{S(t.value,t.selectionStart)},r=()=>S(),i=e=>{[`ArrowLeft`,`ArrowRight`,`Home`,`End`].includes(e.key)&&S()};return t.addEventListener(`input`,n),t.addEventListener(`click`,r),t.addEventListener(`keyup`,i),()=>{t.removeEventListener(`input`,n),t.removeEventListener(`click`,r),t.removeEventListener(`keyup`,i)}},[e,S,t]),(0,Q.useEffect)(()=>{let n=e.current;n&&S(t,n.selectionStart)},[t,S,e]),(0,Q.useEffect)(()=>{if(!d||x.length===0)return;let t=e.current;if(!t)return;let n=e=>{switch(e.key){case`ArrowDown`:e.preventDefault(),u(e=>ee>0?e-1:x.length-1);break;case`Enter`:case`Tab`:x.length>0&&(e.preventDefault(),e.stopImmediatePropagation(),C(x[l]));break;case`Escape`:e.preventDefault(),f(!1);break}};return t.addEventListener(`keydown`,n),()=>t.removeEventListener(`keydown`,n)},[d,x,l,e]),(0,Q.useEffect)(()=>{l>=0&&g.current&&g.current.querySelectorAll(`[data-emoji-item]`)[l]?.scrollIntoView({block:`nearest`})},[l]);let C=(0,Q.useCallback)(t=>{let l=e.current?.selectionStart??s+a.length+1;if(t.customUrl){let e=t.name;n({start:s,end:l,replacement:`:${e}: `});let a=i.find(t=>t.shortcode===e);a&&r&&r(a)}else t.native&&n({start:s,end:l,replacement:t.native});f(!1),o(``),c(-1)},[s,a,e,n,r,i]);return!d||!p||x.length===0?null:v((0,$.jsx)(`div`,{ref:h,"data-autocomplete-dropdown":!0,className:`fixed z-[300] w-[280px] rounded-xl border border-border bg-popover shadow-lg overflow-hidden animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-150 pointer-events-auto`,style:{top:p.top,left:p.left},children:(0,$.jsx)(`div`,{ref:g,className:`max-h-[280px] overflow-y-auto py-1`,children:x.map((e,t)=>(0,$.jsxs)(`button`,{"data-emoji-item":!0,className:L(`w-full flex items-center gap-3 px-3 py-1.5 text-left text-popover-foreground transition-colors cursor-pointer`,t===l?`bg-secondary/60`:`hover:bg-secondary/60`),onPointerDown:t=>{t.preventDefault(),C(e)},children:[e.customUrl?(0,$.jsx)(V,{name:e.name,url:e.customUrl,className:`size-5 object-contain shrink-0`}):(0,$.jsx)(`span`,{className:`text-xl leading-none shrink-0 font-emoji`,children:e.native}),(0,$.jsxs)(`span`,{className:`text-sm truncate`,children:[`:`,e.id.replace(`custom:`,``),`:`]})]},e.id))})}),document.body)}function mi({customEmojis:e,onSelect:t,height:n=350,autoFocus:r=!0,onSearchActiveChange:i}){let[a,o]=(0,Q.useState)(``),s=(0,Q.useRef)(null),[c,l]=(0,Q.useState)(!1),u=c||a.trim().length>0;(0,Q.useEffect)(()=>{i?.(u)},[u,i]),(0,Q.useEffect)(()=>{if(r){let e=setTimeout(()=>s.current?.focus(),100);return()=>clearTimeout(e)}},[r]);let d=(0,Q.useMemo)(()=>{if(!a.trim())return e;let t=a.toLowerCase();return e.filter(e=>e.shortcode.toLowerCase().includes(t))},[e,a]);return e.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center text-muted-foreground gap-2`,style:{height:n},children:[(0,$.jsx)(ce,{className:`size-8 opacity-40`}),(0,$.jsx)(`p`,{className:`text-sm`,children:`No sticker packs yet`}),(0,$.jsx)(`p`,{className:`text-xs`,children:`Add emoji packs to your profile to use stickers`})]}):(0,$.jsxs)(`div`,{className:`flex flex-col`,style:{height:n},children:[(0,$.jsx)(`div`,{className:`px-3 pt-3 pb-2 shrink-0`,children:(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(ne,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 size-4 text-muted-foreground pointer-events-none`}),(0,$.jsx)(ht,{ref:s,value:a,onChange:e=>o(e.target.value),onFocus:()=>l(!0),onBlur:()=>l(!1),placeholder:`Search stickers...`,className:`pl-8 pr-8 h-9 text-base md:text-sm bg-muted/50 border-0 rounded-lg`}),a&&(0,$.jsx)(`button`,{type:`button`,onClick:()=>o(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground transition-colors`,children:(0,$.jsx)(E,{className:`size-3.5`})})]})}),(0,$.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto overscroll-contain`,children:d.length===0?(0,$.jsxs)(`div`,{className:`flex flex-col items-center justify-center py-12 text-muted-foreground`,children:[(0,$.jsx)(`p`,{className:`text-sm`,children:`No stickers found`}),(0,$.jsx)(`p`,{className:`text-xs mt-1`,children:`Try a different search term`})]}):(0,$.jsx)(`div`,{className:`grid grid-cols-4 gap-1.5 p-2`,children:d.map(e=>(0,$.jsx)(`button`,{type:`button`,title:e.shortcode,onClick:()=>t(e),className:`aspect-square rounded-lg overflow-hidden hover:bg-muted transition-colors p-1 group`,children:(0,$.jsx)(V,{name:e.shortcode,url:e.url,className:`w-full h-full object-contain group-hover:scale-110 transition-transform duration-150`})},e.shortcode))})})]})}function hi(e,t){!t.id||!t.sig||e.event(t,{signal:AbortSignal.timeout(5e3)}).catch(()=>{})}var gi=new Set([`e`,`E`,`a`,`A`,`i`,`I`]),_i=[{prefix:[`replies`],rootIndex:1,order:`asc`},{prefix:[`nostr`,`comments`],rootIndex:2,order:`asc`},{prefix:[`event-comments`],rootIndex:1,order:`desc`}];function vi(e){let t=new Set;for(let[n,r]of e.tags)r&&gi.has(n)&&t.add(r);return t}function yi(e){let t=new Set;if(!e)return t;if(typeof e==`string`)return t.add(e);if(e instanceof URL)return t.add(e.toString());if(e.id&&t.add(e.id),j.addressable(e.kind)||j.replaceable(e.kind)){let n=j.addressable(e.kind)?e.tags.find(([e])=>e===`d`)?.[1]??``:``;t.add(`${e.kind}:${e.pubkey}:${n}`)}return t}function bi(e,t,n){let r=vi(t),i=yi(n);for(let{prefix:n,rootIndex:a,order:o}of _i){for(let s of e.getQueryCache().findAll({queryKey:n,type:`active`})){let n=s.queryKey[a];typeof n!=`string`||!n||e.setQueryData(s.queryKey,e=>!e||e.some(e=>e.id===t.id)||!(i.has(n)||r.has(n)||e.some(e=>r.has(e.id)))?e:[...e,t].sort((e,t)=>o===`asc`?e.created_at-t.created_at:t.created_at-e.created_at))}e.invalidateQueries({queryKey:n,refetchType:`none`})}}var xi=new Set([1111,1244]),Si=new Set([1,1222]);function Ci(e){return xi.has(e.kind)||e.tags.filter(([e])=>e===`e`).some(([,,,e])=>e!==`mention`)?!0:e.tags.some(([e,,,t])=>e===`a`&&(t===`root`||t===`reply`))}function wi(e){return Ei(e)?.[1]}function Ti(e){let t=Ei(e);if(!t)return;let n=(xi.has(e.kind)?t[3]:t[4])||e.tags.find(([e])=>e===`p`)?.[1]||void 0;return{id:t[1],relayHint:t[2]||void 0,authorHint:n}}function Ei(e){if(e.kind===7)return e.tags.findLast(([e])=>e===`e`);let t=e.tags.filter(([e,,,t])=>e===`e`&&t!==`mention`);return t.length===0?void 0:t.find(([,,,e])=>e===`reply`)||t.find(([,,,e])=>e===`root`)||t[t.length-1]}function Di(e){if(!Si.has(e.kind))return;let t=e.tags.find(([e,,,t])=>e===`a`&&t===`root`),n=mt(t?.[1]);if(t&&n)return{type:`addr`,addr:t[1],kind:n.kind,pubkey:n.pubkey,relayHint:t[2]||void 0};let r=e.tags.filter(([e,,,t])=>e===`e`&&t!==`mention`),i=r.find(([,,,e])=>e===`root`)??r[0];if(!(!i||!z(i[1])))return{type:`event`,id:i[1],kind:e.kind,pubkey:z(i[4])?i[4]:void 0,relayHint:i[2]||void 0}}function Oi(e,t,n,r){let i=[e,t,n??``,r??``];for(;i.length>2&&!i[i.length-1];)i.pop();return i}function ki(){let{nostr:e}=_e(),{mutateAsync:t}=qe(),n=ye();return be({mutationFn:async({root:n,reply:r,content:i,tags:a,rootTags:o,kind:s=1111})=>{let c=ji(r),l=[];if(o?.length?l.push(...o):l.push(...Ai(`root`,n,c)),r?l.push(...Ai(`reply`,r,c)):l.push(...Ai(`reply`,n,c)),a){let e=new Set(l.filter(([e])=>e===`p`).map(([,e])=>e));for(let t of a)t[0]===`p`&&e.has(t[1])||l.push(t)}let u=await t({kind:s,content:i,tags:l});return r&&typeof r!=`string`&&!(r instanceof URL)&&hi(e,r),typeof n!=`string`&&!(n instanceof URL)&&hi(e,n),u},onSuccess:(e,{root:t})=>{bi(n,e,t)}})}function Ai(e,t,n){let r=[],{aHints:i,eHints:a,pHints:o}=n;if(typeof t==`string`)r.push([`I`,t]);else if(t instanceof URL)r.push([`I`,t.toString()]);else if((j.replaceable(t.kind)||j.addressable(t.kind))&&z(t.pubkey)){let e=t.tags.find(([e])=>e===`d`)?.[1]??``,n=`${t.kind}:${t.pubkey}:${j.addressable(t.kind)?e:``}`;r.push(Oi(`A`,n,i.get(n)?.[0]))}else{let[e,n]=a.get(t.id)??[],i=z(t.pubkey)?t.pubkey:n;r.push(Oi(`E`,t.id,e,i))}if(typeof t==`string`)r.push([`K`,`#`]);else if(t instanceof URL)switch(t.protocol){case`http:`:case`https:`:r.push([`K`,`web`]);break;default:r.push([`K`,t.protocol.replace(/:$/,``)]);break}else r.push([`K`,t.kind.toString()]),z(t.pubkey)&&r.push([`P`,t.pubkey,...o.get(t.pubkey)??[]]);return e===`reply`?r.map(([e,...t])=>[e.toLowerCase(),...t]):r}function ji(e){let t=new Map,n=new Map,r=new Map;if(!Mi(e))return{pHints:t,eHints:n,aHints:r};for(let[i,a,...o]of e.tags){let e=i?.toLowerCase();if(e===`p`)try{let e=new URL(o[0]);t.set(a,[e.href])}catch{}else if(e===`a`)try{let e=new URL(o[0]);r.set(a,[e.href])}catch{}else if(e===`e`){let e=z(o[1])?o[1]:void 0;try{let t=new URL(o[0]);n.set(a,[t.href,...e?[e]:[]])}catch{e&&n.set(a,[``,e])}}}return{pHints:t,eHints:n,aHints:r}}function Mi(e){return!!e&&typeof e!=`string`&&!(e instanceof URL)}function Ni(e,t){return{insertAtCursor:(0,Q.useCallback)(({start:n,end:r,replacement:i})=>{let a=e.current?.value??``;t(a.slice(0,n)+i+a.slice(r)),requestAnimationFrame(()=>{let t=e.current;if(t){t.focus();let e=n+i.length;t.setSelectionRange(e,e)}})},[t,e]),insertEmoji:(0,Q.useCallback)(n=>{let r=e.current;if(r){let e=r.value,i=r.selectionStart,a=r.selectionEnd;t(e.slice(0,i)+n+e.slice(a)),requestAnimationFrame(()=>{r.focus();let e=i+n.length;r.setSelectionRange(e,e)})}else t(e=>e+n)},[t,e])}}var Pi=60,Fi=100,Ii=100;function Li(){if(typeof MediaRecorder>`u`)return`audio/webm`;for(let e of[`audio/mp4`,`audio/mp4;codecs=aac`,`audio/aac`,`audio/webm;codecs=opus`,`audio/webm`,`audio/ogg;codecs=opus`])if(MediaRecorder.isTypeSupported(e))return e;return`audio/webm`}function Ri(){let[e,t]=(0,Q.useState)(!1),[n,r]=(0,Q.useState)(0),[i,a]=(0,Q.useState)([]),o=(0,Q.useRef)(null),s=(0,Q.useRef)(null),c=(0,Q.useRef)(null),l=(0,Q.useRef)(null),u=(0,Q.useRef)([]),d=(0,Q.useRef)([]),f=(0,Q.useRef)(null),p=(0,Q.useRef)(null),m=(0,Q.useRef)(0),h=(0,Q.useRef)(null),g=typeof navigator<`u`&&!!navigator.mediaDevices&&!!navigator.mediaDevices.getUserMedia&&typeof MediaRecorder<`u`;(0,Q.useEffect)(()=>()=>{_()},[]);let _=(0,Q.useCallback)(()=>{f.current&&=(clearInterval(f.current),null),p.current&&=(clearInterval(p.current),null),l.current&&=(l.current.getTracks().forEach(e=>e.stop()),null),s.current&&=(s.current.close().catch(()=>{}),null),c.current=null,o.current=null,u.current=[]},[]);return{isSupported:g,isRecording:e,recordingDuration:n,liveWaveform:i,startRecording:(0,Q.useCallback)(async()=>{if(e||!g)return;let n=await navigator.mediaDevices.getUserMedia({audio:!0});l.current=n;let i=new AudioContext;s.current=i;let v=i.createMediaStreamSource(n),y=i.createAnalyser();y.fftSize=256,v.connect(y),c.current=y;let b=Li(),x=new MediaRecorder(n,{mimeType:b});o.current=x,u.current=[],d.current=[],x.ondataavailable=e=>{e.data.size>0&&u.current.push(e.data)},x.onstop=()=>{let e=new Blob(u.current,{type:b}),n=(Date.now()-m.current)/1e3,i=d.current,o=zi(i,Fi),s={blob:e,mimeType:b,duration:n,waveform:o};h.current&&=(h.current(s),null),_(),t(!1),r(0),a([])},x.start(250),m.current=Date.now(),t(!0),r(0),a([]),f.current=setInterval(()=>{let e=(Date.now()-m.current)/1e3;r(e),e>=Pi&&o.current?.state===`recording`&&o.current.stop()},100),p.current=setInterval(()=>{if(!c.current)return;let e=new Uint8Array(c.current.frequencyBinCount);c.current.getByteTimeDomainData(e);let t=0;for(let n=0;n[...e,r])},Ii)},[e,g,_]),stopRecording:(0,Q.useCallback)(async()=>{let e=o.current;return!e||e.state!==`recording`?null:new Promise(t=>{h.current=t,e.stop()})},[]),cancelRecording:(0,Q.useCallback)(()=>{let e=o.current;e&&e.state===`recording`?(e.onstop=()=>{_(),t(!1),r(0),a([])},e.stop()):(_(),t(!1),r(0),a([])),h.current&&=(h.current(null),null)},[_])}}function zi(e,t){if(e.length===0)return[];if(e.length<=t)return e;let n=[],r=e.length/t;for(let i=0;io&&(o=e[n]);n.push(o)}return n}var Bi=(0,Q.lazy)(()=>me(()=>import(`./EmojiPicker-DIvGQUn_.js`).then(e=>({default:e.EmojiPicker})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]))),Vi=5e3;function Hi(){return Math.random().toString(36).slice(2,8)}async function Ui(e){if(!e.type.startsWith(`image/`))return{};try{let t=URL.createObjectURL(e);try{let e=await new Promise((e,n)=>{let r=new Image;r.onload=()=>e(r),r.onerror=n,r.src=t}),n=e.naturalWidth,r=e.naturalHeight;if(!n||!r)return{};let i=`${n}x${r}`,a=64/n,o=Math.max(1,Math.round(r*a)),s=document.createElement(`canvas`);s.width=64,s.height=o;let c=s.getContext(`2d`);if(!c)return{dim:i};c.drawImage(e,0,0,64,o);let{data:l}=c.getImageData(0,0,64,o);return{dim:i,blurhash:Ct(l,64,o,4,3)}}finally{URL.revokeObjectURL(t)}}catch{return{}}}function Wi(e){return e instanceof URL||typeof e==`string`}function Gi(e){let t=[],n=!1;for(let r of e.tags){let[e,i]=r;switch(e){case`I`:i&&(t.push([...r]),n=!0);break;case`A`:mt(i)&&(t.push([...r]),n=!0);break;case`E`:i&&z(i)&&(t.push([...r]),n=!0);break;case`K`:i&&t.push([...r]);break;case`P`:i&&z(i)&&t.push([...r]);break}}return n?t:null}var Ki=new Set([1111,1244]);function qi(e){let t=[e.type===`addr`?Oi(`A`,e.addr,e.relayHint):Oi(`E`,e.id,e.relayHint,e.pubkey),[`K`,e.kind.toString()]];return e.pubkey&&t.push([`P`,e.pubkey]),t}function Ji(e){if(Wi(e))return{root:e};if(Ki.has(e.kind))return{root:e,reply:e,rootTags:Gi(e)??void 0};let t=Di(e);return t?{root:e,reply:e,rootTags:qi(t)}:{root:e}}function Yi({count:e,max:t}){let n=2*Math.PI*10,r=n*(1-Math.min(e/t,1)),i=e>t,a=e>t*.9;return(0,$.jsx)(`div`,{className:`relative flex items-center justify-center size-7`,children:(0,$.jsxs)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 28 28`,className:`-rotate-90`,children:[(0,$.jsx)(`circle`,{cx:`14`,cy:`14`,r:10,fill:`none`,strokeWidth:`2.5`,className:`stroke-secondary`}),(0,$.jsx)(`circle`,{cx:`14`,cy:`14`,r:10,fill:`none`,strokeWidth:`2.5`,strokeDasharray:n,strokeDashoffset:r,strokeLinecap:`round`,className:L(`transition-all duration-150`,i?`stroke-destructive`:a?`stroke-amber-500`:`stroke-primary`)})]})})}function Xi({onSuccess:e,placeholder:t=`What's on your mind?`,compact:r=!1,replyTo:i,quotedEvent:a,forceExpanded:o=!1,hideAvatar:s=!1,hideBorder:c=!1,previewMode:u,onHasPreviewableContentChange:d,initialContent:f=``,initialMode:p=`post`}){let{user:m,metadata:h,event:_,isLoading:v}=We(),y=Xe(h),b=it(m?.pubkey??``,h),x=(0,Q.useMemo)(()=>Yt(Xt(_?.content)),[_?.content]),{nostr:S}=_e(),{mutateAsync:C,isPending:ne,isPending:re}=qe(),{mutateAsync:ie,isPending:ae}=ki(),{mutateAsync:oe,isPending:se}=xt(),{feedSettings:le}=Jt(),de=le.showCustomEmojis!==!1,{emojis:pe}=Wt(),D=(0,Q.useMemo)(()=>de?pe:[],[de,pe]),O=ye(),{toast:k}=Ue(),{config:A}=ze(),he=A.imageQuality,ge=Kt(),j=(0,Q.useMemo)(()=>i instanceof URL?`compose-draft:url:${i.href}`:typeof i==`string`?`compose-draft:ext:${i}`:i?`compose-draft:reply:${i.id}`:a?`compose-draft:quote:${a.id}`:`compose-draft:new`,[i,a]),[M,N]=(0,Q.useState)(()=>{if(f)return f;try{return localStorage.getItem(j)??``}catch{return``}}),[be,P]=(0,Q.useState)(!1),[Se,Ce]=(0,Q.useState)(!1),[we,Te]=(0,Q.useState)(``),[F,Ee]=(0,Q.useState)(!1),[I,De]=(0,Q.useState)(`emoji`),[Re,Be]=(0,Q.useState)(!1),[Ve,He]=(0,Q.useState)(!1),[R,Ge]=(0,Q.useState)(!1),[z,$e]=(0,Q.useState)(!1),[tt,nt]=(0,Q.useState)(p),[V,rt]=(0,Q.useState)([{id:Hi(),label:``},{id:Hi(),label:``}]),[at,ot]=(0,Q.useState)(`singlechoice`),[st,ct]=(0,Q.useState)(7),[H,lt]=(0,Q.useState)(new Set),[ut,dt]=(0,Q.useState)(new Map),[U,pt]=(0,Q.useState)(new Map),[mt,W]=(0,Q.useState)(new Map),G=(0,Q.useRef)(null),K=(0,Q.useRef)(null),{insertAtCursor:gt,insertEmoji:_t}=Ni(G,N),Ct=(0,Q.useRef)(null),J=Ri(),[Tt,Et]=(0,Q.useState)(!1),At=(0,Q.useCallback)(()=>{N(``),Ce(!1),Te(``),P(!1),Ee(!1),Ge(!1),$e(!1),nt(p),rt([{id:Hi(),label:``},{id:Hi(),label:``}]),ot(`singlechoice`),ct(7),lt(new Set),dt(new Map),pt(new Map),W(new Map);try{localStorage.removeItem(j)}catch{}},[p,j]),jt=u===void 0?z:u;(0,Q.useEffect)(()=>{(a||M)&&P(!0)},[a]),(0,Q.useEffect)(()=>{let e=G.current;if(!e)return;let t=K.current,n=t?.scrollTop??0;if(e.style.height=`auto`,e.style.height=`${e.scrollHeight}px`,o&&t&&(t.scrollTop=n,e.selectionStart===e.selectionEnd&&e.selectionStart===e.value.length)){let n=t.getBoundingClientRect(),r=e.getBoundingClientRect().bottom-n.top+t.scrollTop-t.clientHeight;r>t.scrollTop&&(t.scrollTop=r)}},[M,jt,o]),(0,Q.useEffect)(()=>{if(f)return;let e=setTimeout(()=>{try{M.trim()?localStorage.setItem(j,M):localStorage.removeItem(j)}catch{}},300);return()=>clearTimeout(e)},[M,j,f]),(0,Q.useEffect)(()=>{ge&&F&&G.current?.blur()},[F,ge]);let Mt=M.length,Nt=Vi-Mt,Y=(0,Q.useCallback)(()=>{be||P(!0)},[be]),Pt=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{be&&!Pt.current&&G.current?.focus(),Pt.current=be},[be]);let X=(0,Q.useMemo)(()=>{let e=[],t=M.matchAll(/nostr:(nevent1|note1|naddr1)[023456789acdefghjklmnpqrstuvwxyz]+/g);for(let n of t){let t=n[0].slice(6);try{let r=ve.decode(t);r.type===`nevent`?e.push({type:`nevent`,value:n[0],index:n.index,eventId:r.data.id}):r.type===`note`?e.push({type:`note`,value:n[0],index:n.index,eventId:r.data}):r.type===`naddr`&&e.push({type:`naddr`,value:n[0],index:n.index,addr:{kind:r.data.kind,pubkey:r.data.pubkey,identifier:r.data.identifier}})}catch{}}let n=M.matchAll(/\b(nevent1|note1|naddr1)[023456789acdefghjklmnpqrstuvwxyz]+\b/g);for(let t of n){let n=t[0],r=t.index-6;if(!M.substring(Math.max(0,r),t.index).endsWith(`nostr:`))try{let r=ve.decode(n);r.type===`nevent`?e.push({type:`nevent`,value:t[0],index:t.index,eventId:r.data.id}):r.type===`note`?e.push({type:`note`,value:t[0],index:t.index,eventId:r.data}):r.type===`naddr`&&e.push({type:`naddr`,value:t[0],index:t.index,addr:{kind:r.data.kind,pubkey:r.data.pubkey,identifier:r.data.identifier}})}catch{}}let r=M.matchAll(/https?:\/\/[^\s]+/g);for(let t of r){let n=t[0];Fe.test(n)||e.push({type:`link`,value:n,index:t.index})}return e.sort((e,t)=>e.index-t.index)},[M]),Ft=(0,Q.useMemo)(()=>X.filter(e=>!H.has(e.value)),[X,H]),It=(0,Q.useMemo)(()=>M?ke(M):[],[M]),Lt=(0,Q.useMemo)(()=>M?Le(M):[],[M]),Rt=(0,Q.useMemo)(()=>M?/https?:\/\/[^\s]+\.(jpg|jpeg|png|gif|webp|svg|avif)(\?[^\s]*)?/i.test(M):!1,[M]),Z=(0,Q.useMemo)(()=>/nostr:(npub1|nprofile1)[023456789acdefghjklmnpqrstuvwxyz]+/.test(M),[M]),zt=(0,Q.useMemo)(()=>{if(D.length===0||!M)return!1;let e=new Set(D.map(e=>e.shortcode)),t=M.matchAll(/:([a-zA-Z0-9_-]+):/g);for(let n of t)if(e.has(n[1]))return!0;return!1},[M,D]),Bt=(0,Q.useMemo)(()=>U.size>0,[U]),Vt=(0,Q.useMemo)(()=>M?Ne(M).some(({uri:e})=>{let t=Ie(e.ext);return t.startsWith(`image/`)||t.startsWith(`video/`)||t.startsWith(`audio/`)}):!1,[M]),Ht=(0,Q.useMemo)(()=>Ft.length>0||Rt||It.length>0||Lt.length>0||Bt||Z||zt||Vt,[Ft,Rt,It,Lt,Bt,Z,zt,Vt]);(0,Q.useEffect)(()=>{d&&d(Ht)},[Ht,d]);let Gt=(0,Q.useMemo)(()=>{if(!a)return null;if(a.kind>=3e4&&a.kind<4e4){let e=a.tags.find(([e])=>e===`d`)?.[1]??``;return ve.naddrEncode({kind:a.kind,pubkey:a.pubkey,identifier:e,relays:[Je]})}return ve.neventEncode({id:a.id,author:a.pubkey,relays:[Je]})},[a]),qt=Gt?`nostr:${Gt}`:null,Qt=a&&qt&&!H.has(qt),$t=(0,Q.useMemo)(()=>{if(!m||!M)return null;let e=et(M).map(e=>[`t`,e]);if(D.length>0){let t=new Map(D.map(e=>[e.shortcode,e.url])),n=/:([a-zA-Z0-9_-]+):/g,r=new Set,i;for(;(i=n.exec(M))!==null;){let n=i[1];t.has(n)&&!r.has(n)&&(r.add(n),e.push([`emoji`,n,t.get(n)]))}}let t=M.matchAll(new RegExp(Oe.source,`gi`)),n=new Set;for(let r of t){let t=r[0];if(n.has(t))continue;n.add(t);let i=r[1].toLowerCase(),a=i===`xdc`,o=ut.get(t);if(o){let n=o.map(e=>`${e[0]} ${e[1]}`);if(a){let r=n.filter(e=>!e.startsWith(`m `));r.push(`m application/x-webxdc`);let i=U.get(t);i&&r.push(`webxdc ${i}`);let a=mt.get(t);a?.name&&r.push(`summary ${a.name}`),a?.iconUrl&&r.push(`image ${a.iconUrl}`),e.push([`imeta`,...r])}else e.push([`imeta`,...n])}else{let n=Ie(i),r=[`imeta`,`url ${t}`,`m ${n}`];if(a){let e=U.get(t);e&&r.push(`webxdc ${e}`);let n=mt.get(t);n?.name&&r.push(`summary ${n.name}`),n?.iconUrl&&r.push(`image ${n.iconUrl}`)}e.push(r)}}for(let{uri:t,raw:r}of Ne(M))n.has(r)||(n.add(r),e.push(je(t,r)));return{id:`preview`,pubkey:m.pubkey,content:M.trim(),created_at:Math.floor(Date.now()/1e3),kind:1,tags:e,sig:``}},[m,M,D,ut,U,mt]),en=(0,Q.useCallback)(e=>{_t(e),Y()},[_t,Y]),tn=gt,nn=gt,rn=(0,Q.useCallback)(async e=>{try{let t=e.name.endsWith(`.xdc`),n=e.type.startsWith(`image/`),r,i;if(t&&!e.type)r=new File([e],e.name,{type:`application/x-webxdc`});else if(n&&he===`compressed`){let t=await Zt(e);r=t.file,i=t.dimensions}else r=e;let a=await oe(r),[[,o]]=a;if(t&&!o.endsWith(`.xdc`)){o+=`.xdc`;let e=a.find(e=>e[0]===`url`);e&&(e[1]=o)}if(!t&&n){let e=e=>a.some(t=>t[0]===e);if(i&&!e(`dim`)&&a.push([`dim`,i]),!e(`blurhash`)){let{blurhash:e}=await Ui(r);e&&a.push([`blurhash`,e])}}if(dt(e=>new Map(e).set(o,a)),N(e=>e?e+` `+o:o),t){let t=crypto.randomUUID();pt(e=>new Map(e).set(o,t));try{let{extractWebxdcMeta:t}=await me(async()=>{let{extractWebxdcMeta:e}=await import(`./webxdcMeta-BE41E4P0.js`).then(e=>e.n);return{extractWebxdcMeta:e}},__vite__mapDeps([21,1,22])),n=await t(e),r={name:n.name};if(n.iconFile)try{let[[,e]]=await oe(n.iconFile);r.iconUrl=e}catch{}W(e=>new Map(e).set(o,r))}catch{}}Y()}catch{k({title:`Upload failed`,description:`Could not upload file.`,variant:`destructive`})}},[oe,Y,k,he]),an=(0,Q.useCallback)(async e=>{let t=e.clipboardData?.items;if(t)for(let n=0;n{try{await J.startRecording(),Y()}catch{k({title:`Microphone access denied`,description:`Please allow microphone access to record voice messages.`,variant:`destructive`})}},[J,Y,k]),sn=(0,Q.useCallback)(async()=>{if(m){Et(!0);try{let t=await J.stopRecording();if(!t)return;let n={"audio/mp4":`.m4a`,"audio/mp4;codecs=aac":`.m4a`,"audio/aac":`.aac`,"audio/webm;codecs=opus":`.webm`,"audio/webm":`.webm`,"audio/ogg;codecs=opus":`.ogg`}[t.mimeType]??`.webm`,r=`voice-message-${Date.now()}${n}`,a=new File([t.blob],r,{type:t.mimeType}),[[,o]]=await oe(a),s=[`imeta`,`url ${o}`,`m ${t.mimeType}`,`waveform ${t.waveform.join(` `)}`,`duration ${Math.round(t.duration)}`];if(i)await ie({...Ji(i),content:o,tags:[s],kind:1244}),O.invalidateQueries({queryKey:[`feed`],refetchType:`none`});else{let e=await C({kind:1222,content:o,tags:[s]});wt(O,e)}ft(),k({title:`Voice message sent!`,description:`Your voice message has been published.`}),e?.()}catch{k({title:`Error`,description:`Failed to send voice message.`,variant:`destructive`})}finally{Et(!1)}}},[m,J,oe,C,ie,i,O,k,e]),cn=(0,Q.useCallback)(e=>A.stripTrackingParams===!1?e:Ae(e,new Set(ut.keys())),[A.stripTrackingParams,ut]),ln=async()=>{if(!(!M.trim()||!m||Mt>Vi))try{let t=et(M).map(e=>[`t`,e]),n=M.matchAll(/nostr:((?:npub1|nprofile1)[023456789acdefghjklmnpqrstuvwxyz]+)/g),r=new Set;for(let e of n)try{let t=ve.decode(e[1]);t.type===`npub`?r.add(t.data):t.type===`nprofile`&&r.add(t.data.pubkey)}catch{}r.delete(m.pubkey);for(let e of r)t.push([`p`,e]);let o=cn(M.trim());if(Qt&&a&&Gt){if(a.kind>=3e4&&a.kind<4e4){let e=a.tags.find(([e])=>e===`d`)?.[1]??``;t.push([`q`,`${a.kind}:${a.pubkey}:${e}`,Je])}else t.push([`q`,a.id,Je,a.pubkey]);let e=`nostr:${Gt}`;o.includes(e)||(o=o+` `+e)}if(Se&&(t.push([`content-warning`,we||``]),t.push([`L`,`content-warning`]),we&&t.push([`l`,we,`content-warning`])),D.length>0){let e=new Map(D.map(e=>[e.shortcode,e.url])),n=/:([a-zA-Z0-9_-]+):/g,r=new Set,i;for(;(i=n.exec(o))!==null;){let n=i[1];e.has(n)&&!r.has(n)&&(r.add(n),t.push([`emoji`,n,e.get(n)]))}}let s=o.matchAll(new RegExp(Oe.source,`gi`)),c=new Set;for(let e of s){let n=e[0];if(c.has(n))continue;c.add(n);let r=e[1].toLowerCase(),i=r===`xdc`,a=ut.get(n);if(a){let e=a.map(e=>`${e[0]} ${e[1]}`);if(i){let r=e.filter(e=>!e.startsWith(`m `));r.push(`m application/x-webxdc`);let i=U.get(n);i&&r.push(`webxdc ${i}`);let a=mt.get(n);a?.name&&r.push(`summary ${a.name}`),a?.iconUrl&&r.push(`image ${a.iconUrl}`),t.push([`imeta`,...r])}else t.push([`imeta`,...e])}else{let e=Ie(r),a=[`imeta`,`url ${n}`,`m ${e}`];if(i){let e=U.get(n);e&&a.push(`webxdc ${e}`);let t=mt.get(n);t?.name&&a.push(`summary ${t.name}`),t?.iconUrl&&a.push(`image ${t.iconUrl}`)}t.push(a)}}for(let{uri:e,raw:n}of Ne(o))c.has(n)||(c.add(n),t.push(je(e,n)));let l,u;if(i){let e=Ji(i);u=e.root,l=await ie({...e,content:o,tags:t})}else l=await C({kind:1,content:o,tags:t,created_at:Math.floor(Date.now()/1e3)});At(),Qt&&a&&hi(S,a),i&&!Wi(i)&&O.setQueryData([`event-stats`,i.id],e=>e&&{...e,replies:e.replies+1}),i?O.invalidateQueries({queryKey:[`feed`],refetchType:`none`}):wt(O,l),i&&bi(O,l,u??i),a&&(O.invalidateQueries({queryKey:[`event-stats`,a.id]}),O.invalidateQueries({queryKey:[`event-interactions`,a.id]})),ft();let d=St({id:l.id,author:l.pubkey,kind:l.kind});k({title:`Posted!`,description:i?`Your reply has been published.`:a?`Your quote has been published.`:`Your note has been published.`,action:d?(0,$.jsx)(br,{altText:`View post`,asChild:!0,children:(0,$.jsx)(B,{to:`/${d}`,children:`View`})}):void 0}),e?.()}catch{k({title:`Error`,description:`Failed to publish note.`,variant:`destructive`})}},un=async()=>{let t=V.filter(e=>e.label.trim()),n=cn(M.trim());if(!n||t.length<2||!m||re)return;let r=[];for(let e of t)r.push([`option`,e.id,e.label.trim()]);r.push([`polltype`,at]),st>0&&r.push([`endsAt`,String(Math.floor(Date.now()/1e3)+st*86400)]);let i=n.matchAll(new RegExp(Oe.source,`gi`)),a=new Set;for(let e of i){let t=e[0];if(a.has(t))continue;a.add(t);let n=ut.get(t);if(n)r.push([`imeta`,...n.map(e=>`${e[0]} ${e[1]}`)]);else{let n=e[1].toLowerCase();r.push([`imeta`,`url ${t}`,`m ${Ie(n)}`])}}for(let{uri:e,raw:t}of Ne(n))a.has(t)||(a.add(t),r.push(je(e,t)));r.push([`alt`,`Poll: ${n}`]);try{let t=await C({kind:1068,content:n,tags:r});At(),wt(O,t),ft(),k({title:`Poll published!`}),e?.()}catch{k({title:`Error`,description:`Failed to publish poll.`,variant:`destructive`})}},dn=V.filter(e=>e.label.trim()).length,fn=M.trim().length>0&&dn>=2,pn=o||be||M.length>0||!r,mn=F&&(I===`gif`&&Re||I===`stickers`&&Ve);return!m&&r?null:(0,$.jsxs)(`div`,{className:L(`px-4 pt-3 bg-background/85 flex flex-col`,o?`flex-1 min-h-0 rounded-2xl`:``,F?`pb-0`:`pb-3`,!o&&!c&&`border-b border-border`),children:[Ht&&u===void 0&&(0,$.jsx)(`div`,{className:`flex items-center justify-end mb-3`,children:(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-0.5 p-1 bg-muted/50 rounded-lg`,children:[(0,$.jsx)(`button`,{onClick:()=>$e(!1),className:L(`px-3.5 py-1.5 text-xs font-medium rounded-md transition-all`,jt?`text-muted-foreground hover:text-foreground`:`bg-background text-foreground shadow-sm`),children:`Edit`}),(0,$.jsx)(`button`,{onClick:()=>$e(!0),className:L(`px-3.5 py-1.5 text-xs font-medium rounded-md transition-all`,jt?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:`Preview`})]})}),(0,$.jsxs)(`div`,{className:L(`flex gap-3`,o&&`flex-1 min-h-0`),children:[!s&&m&&(v?(0,$.jsx)(q,{className:`size-12 shrink-0 mt-0.5 rounded-full`}):(0,$.jsxs)(B,{to:b,className:`relative shrink-0 mt-0.5`,children:[(0,$.jsxs)(Qe,{shape:y,className:`size-12`,children:[(0,$.jsx)(Ze,{src:h?.picture,alt:h?.name}),(0,$.jsx)(Ye,{className:`bg-primary/20 text-primary text-sm`,children:(h?.name||h?.display_name||`Anonymous`)[0]?.toUpperCase()??`?`})]}),x&&(0,$.jsx)(`div`,{className:`pointer-events-none absolute -top-3 -right-1.5 z-10 rotate-[18deg]`,children:(0,$.jsx)(Hr,{className:`size-8 drop-shadow-sm`,pomScale:1.15})})]})),(0,$.jsx)(`div`,{className:L(`flex-1 min-w-0`,o&&`flex flex-col min-h-0`),children:(0,$.jsxs)(`div`,{ref:K,className:L(o&&`flex-1 min-h-0 overflow-y-auto`),children:[jt?$t&&(0,$.jsx)(`div`,{className:`pt-2.5 pb-2 min-h-[100px] overflow-hidden motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-200`,children:(0,$.jsx)(`div`,{className:`text-lg opacity-85`,children:(0,$.jsx)(Me,{event:$t,className:`text-foreground`})})}):(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`textarea`,{ref:G,dir:`auto`,value:M,onChange:e=>N(e.target.value),onPointerDown:Y,onFocus:Y,onPaste:an,placeholder:tt===`poll`?`Ask a question…`:t,className:L(`w-full bg-transparent text-foreground placeholder:text-muted-foreground resize-none outline-none text-lg pt-2.5 pb-2 opacity-85 break-words overflow-hidden transition-[min-height] duration-200 ease-in-out`,pn?`min-h-[100px]`:`min-h-[44px]`),rows:1,disabled:!m,autoFocus:o,onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&ln()}}),(0,$.jsx)(ri,{textareaRef:G,content:M,onInsertMention:tn}),(0,$.jsx)(pi,{textareaRef:G,content:M,onInsertEmoji:nn})]}),tt===`poll`&&(0,$.jsxs)(`div`,{className:`space-y-3 pt-1 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-2 motion-safe:duration-200`,children:[p!==`poll`&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>nt(`post`),className:`flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(ue,{className:`size-3.5`}),`Back to post`]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[V.map((e,t)=>(0,$.jsxs)(`div`,{className:`flex items-center gap-2 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-1 motion-safe:duration-150`,children:[(0,$.jsx)(`input`,{type:`text`,value:e.label,onChange:t=>rt(n=>n.map(n=>n.id===e.id?{...n,label:t.target.value}:n)),placeholder:`Option ${t+1}`,maxLength:100,className:`flex-1 bg-secondary/40 rounded-lg px-3 py-1.5 text-sm outline-none focus:ring-1 focus:ring-primary/40 placeholder:text-muted-foreground`}),(0,$.jsx)(`button`,{type:`button`,onClick:()=>{V.length>2&&rt(t=>t.filter(t=>t.id!==e.id))},disabled:V.length<=2,className:`p-1 rounded-full text-muted-foreground hover:text-destructive transition-colors disabled:opacity-20`,children:(0,$.jsx)(E,{className:`size-3.5`})})]},e.id)),V.length<8&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>rt(e=>[...e,{id:Hi(),label:``}]),className:`flex items-center gap-1.5 text-xs text-primary hover:text-primary/80 transition-colors pt-0.5`,children:[(0,$.jsx)(l,{className:`size-3`}),`Add option`]})]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap gap-2 pt-0.5`,children:[[`singlechoice`,`multiplechoice`].map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>ot(e),className:L(`text-xs px-2.5 py-1 rounded-full border transition-colors`,at===e?`border-primary bg-primary/10 text-primary font-medium`:`border-border text-muted-foreground hover:text-foreground hover:border-foreground/30`),children:e===`singlechoice`?`Single choice`:`Multiple choice`},e)),(0,$.jsx)(`div`,{className:`w-px bg-border self-stretch mx-0.5`}),[1,3,7,0].map(e=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>ct(e),className:L(`text-xs px-2.5 py-1 rounded-full border transition-colors`,st===e?`border-primary bg-primary/10 text-primary font-medium`:`border-border text-muted-foreground hover:text-foreground hover:border-foreground/30`),children:e===0?(0,$.jsx)(`span`,{style:{fontSize:`15px`,lineHeight:1,position:`relative`,top:`-1px`},children:`∞`}):`${e}d`},e))]})]}),Se&&(0,$.jsxs)(`div`,{className:`flex items-center gap-2 mb-2 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-top-1 motion-safe:duration-200`,children:[(0,$.jsx)(g,{className:`size-4 text-amber-500 shrink-0`}),(0,$.jsx)(ht,{value:we,onChange:e=>Te(e.target.value),placeholder:`Content warning reason (optional)`,className:`h-8 text-base md:text-sm bg-secondary/50 border-0 rounded-lg`}),(0,$.jsx)(`button`,{onClick:()=>{Ce(!1),Te(``)},className:`p-1 rounded-full text-muted-foreground hover:text-foreground transition-colors shrink-0`,children:(0,$.jsx)(E,{className:`size-4`})})]}),Qt&&a&&qt&&(0,$.jsx)(`div`,{className:`mt-4 mb-3 overflow-hidden`,children:a.kind>=3e4&&a.kind<4e4?(0,$.jsx)(xe,{addr:{kind:a.kind,pubkey:a.pubkey,identifier:a.tags.find(([e])=>e===`d`)?.[1]??``}}):(0,$.jsx)(Pe,{eventId:a.id,authorHint:a.pubkey})})]})})]}),pn&&(J.isRecording||Tt?(0,$.jsxs)(`div`,{className:`flex items-center gap-3 mt-3 rounded-xl bg-destructive/5 border border-destructive/20 px-3 py-2.5 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-1 motion-safe:duration-200`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,$.jsx)(`div`,{className:`size-2.5 rounded-full bg-destructive animate-pulse shrink-0`}),(0,$.jsx)(`span`,{className:`text-sm font-medium tabular-nums text-destructive`,children:Ut(J.recordingDuration)})]}),(0,$.jsx)(`div`,{className:`flex-1 flex items-center gap-[2px] h-6 overflow-hidden`,children:J.liveWaveform.slice(-60).map((e,t)=>(0,$.jsx)(`div`,{className:`w-[3px] shrink-0 rounded-full bg-destructive/60`,style:{height:`${3+e/100*21}px`}},t))}),(0,$.jsxs)(kt,{children:[(0,$.jsx)(Dt,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:J.cancelRecording,disabled:Tt,className:`p-2 rounded-full text-muted-foreground hover:text-destructive hover:bg-destructive/10 transition-all motion-safe:active:scale-90 disabled:opacity-40`,children:(0,$.jsx)(E,{className:`size-[18px]`})})}),(0,$.jsx)(Ot,{children:`Cancel`})]}),(0,$.jsxs)(Ke,{onClick:sn,disabled:Tt||J.recordingDuration<.5,className:`rounded-full px-4 font-bold`,size:`sm`,children:[Tt?(0,$.jsx)(T,{className:`size-4 animate-spin mr-1.5`}):(0,$.jsx)(ee,{className:`size-3.5 mr-1.5`,fill:`currentColor`}),Tt?`Sending...`:`Send`]})]}):(0,$.jsxs)(`div`,{className:L(`flex items-center justify-between mt-3 motion-safe:animate-in motion-safe:fade-in-0 motion-safe:duration-150`,o&&`shrink-0`),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,$.jsxs)(kt,{children:[(0,$.jsx)(Dt,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:()=>Ct.current?.click(),disabled:se||!m,className:`p-2 rounded-full text-muted-foreground hover:text-primary hover:bg-primary/10 transition-all motion-safe:active:scale-90 disabled:opacity-40`,children:se?(0,$.jsx)(T,{className:`size-[18px] animate-spin`}):(0,$.jsx)(w,{className:`size-[18px]`})})}),(0,$.jsx)(Ot,{children:`Attach file`})]}),(0,$.jsx)(`input`,{ref:Ct,type:`file`,accept:`image/*,video/*,audio/*,.xdc`,multiple:!0,className:`hidden`,onChange:e=>{let t=e.target.files;t&&Array.from(t).forEach(e=>rn(e)),e.target.value=``}}),J.isSupported&&(0,$.jsxs)(kt,{children:[(0,$.jsx)(Dt,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,onClick:on,disabled:!m,className:`p-2 rounded-full text-muted-foreground hover:text-primary hover:bg-primary/10 transition-all motion-safe:active:scale-90 disabled:opacity-40`,children:(0,$.jsx)(te,{className:`size-[18px]`})})}),(0,$.jsx)(Ot,{children:`Voice message`})]}),(0,$.jsxs)(kt,{children:[(0,$.jsx)(Dt,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:!m,onClick:()=>{F&&G.current?.focus(),Ee(!F)},className:L(`p-2 rounded-full transition-all motion-safe:active:scale-90 disabled:opacity-40`,F?`text-primary bg-primary/10`:`text-muted-foreground hover:text-primary hover:bg-primary/10`),children:(0,$.jsx)(n,{className:`size-[18px]`})})}),!F&&(0,$.jsx)(Ot,{children:`Emoji / GIF`})]}),(0,$.jsxs)(bt,{open:R,onOpenChange:Ge,children:[(0,$.jsxs)(kt,{children:[(0,$.jsx)(Dt,{asChild:!0,children:(0,$.jsx)(vt,{asChild:!0,children:(0,$.jsx)(`button`,{type:`button`,disabled:!m,className:L(`p-2 rounded-full transition-all motion-safe:active:scale-90 disabled:opacity-40`,R&&`motion-safe:rotate-45`,R||tt===`poll`||Se?`text-primary bg-primary/10`:`text-muted-foreground hover:text-primary hover:bg-primary/10`),children:(0,$.jsx)(l,{className:`size-[18px]`,strokeWidth:2.5})})})}),!R&&(0,$.jsx)(Ot,{children:`More`})]}),(0,$.jsx)(yt,{side:`top`,align:`start`,sideOffset:6,className:`w-44 p-1.5 rounded-xl border-border shadow-lg`,children:(0,$.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[!i&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{nt(e=>e===`poll`?`post`:`poll`),Ge(!1),Y()},className:L(`flex items-center gap-2.5 w-full px-3 py-2 rounded-lg text-sm transition-colors`,tt===`poll`?`text-primary bg-primary/10`:`text-muted-foreground hover:text-foreground hover:bg-secondary/60`),children:[(0,$.jsx)(fe,{className:`size-4`}),(0,$.jsx)(`span`,{className:`font-medium`,children:`Poll`})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>{Ce(e=>!e),Ge(!1),Y()},className:L(`flex items-center gap-2.5 w-full px-3 py-2 rounded-lg text-sm transition-colors`,Se?`text-amber-500 bg-amber-500/10`:`text-muted-foreground hover:text-foreground hover:bg-secondary/60`),children:[(0,$.jsx)(g,{className:`size-4`}),(0,$.jsx)(`span`,{className:`font-medium`,children:`Spoiler`})]})]})})]})]}),(0,$.jsx)(`div`,{className:`flex-1`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[tt===`post`&&Mt>0&&(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Yi,{count:Mt,max:Vi}),(0,$.jsx)(`span`,{className:L(`text-xs tabular-nums`,Nt<0?`text-destructive font-semibold`:Nt<500?`text-amber-500`:`text-muted-foreground`),children:Nt})]}),tt===`poll`?(0,$.jsx)(Ke,{onClick:un,disabled:!fn||re||!m,className:`rounded-full px-5 font-bold transition-all motion-safe:active:scale-95`,size:`sm`,children:re?`Publishing...`:`Publish poll`}):(0,$.jsx)(Ke,{onClick:ln,disabled:!M.trim()||ne||ae||!m||Mt>Vi,className:`rounded-full px-5 font-bold transition-all motion-safe:active:scale-95`,size:`sm`,children:ne||ae?`Posting...`:`Post!`})]})]})),F&&(0,$.jsxs)(`div`,{className:L(`-mx-4 mt-2 shrink-0 overflow-hidden rounded-t-2xl bg-popover motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-2 motion-safe:duration-200`,o&&`rounded-b-2xl`,mn&&o&&`flex flex-col grow-[999] shrink basis-0 min-h-0 sm:grow-0 sm:shrink-0 sm:basis-auto`),children:[(0,$.jsxs)(`div`,{className:`flex gap-1 px-3 pt-2 shrink-0`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:()=>De(`emoji`),className:L(`flex items-center justify-center gap-1.5 px-4 py-1.5 rounded-full text-sm font-medium transition-all motion-safe:active:scale-95`,I===`emoji`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:[(0,$.jsx)(n,{className:`size-3.5`}),`Emoji`]}),(0,$.jsxs)(`button`,{type:`button`,onClick:()=>De(`gif`),className:L(`flex items-center justify-center gap-1.5 px-4 py-1.5 rounded-full text-sm font-medium transition-all motion-safe:active:scale-95`,I===`gif`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:[(0,$.jsxs)(`svg`,{className:`block size-3.5 shrink-0`,viewBox:`0 0 18 18`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,children:[(0,$.jsx)(`rect`,{x:`1`,y:`1`,width:`16`,height:`16`,rx:`3`,stroke:`currentColor`,strokeWidth:`1.5`,fill:`none`}),(0,$.jsx)(`text`,{x:`9`,y:`9`,textAnchor:`middle`,dominantBaseline:`central`,fontSize:`7`,fontWeight:`700`,fontFamily:`system-ui,sans-serif`,fill:`currentColor`,letterSpacing:`0.5`,children:`GIF`})]}),`GIF`]}),de&&(0,$.jsxs)(`button`,{type:`button`,onClick:()=>De(`stickers`),className:L(`flex items-center justify-center gap-1.5 px-4 py-1.5 rounded-full text-sm font-medium transition-all motion-safe:active:scale-95`,I===`stickers`?`bg-primary/15 text-primary`:`text-muted-foreground hover:text-foreground hover:bg-muted`),children:[(0,$.jsx)(ce,{className:`size-3.5`}),`Stickers`]})]}),(0,$.jsx)(`div`,{className:L(`min-h-[160px]`,mn?o?`flex-1 sm:flex-none sm:h-[min(420px,50dvh)]`:`h-[min(420px,50dvh)]`:`h-[min(280px,calc(var(--visual-viewport-height,100dvh)*0.4))]`),children:(0,$.jsx)(`div`,{className:`h-full motion-safe:animate-in motion-safe:fade-in-0 motion-safe:slide-in-from-bottom-1 motion-safe:duration-150`,children:I===`emoji`?(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,children:(0,$.jsx)(T,{className:`size-6 animate-spin text-muted-foreground`})}),children:(0,$.jsx)(Bi,{customEmojis:D,height:`100%`,onSelect:e=>{e.type===`native`?en(e.emoji):en(`:${e.shortcode}:`)}})}):I===`stickers`?(0,$.jsx)(mi,{customEmojis:D,height:`100%`,autoFocus:!ge,onSearchActiveChange:He,onSelect:e=>{N(t=>t?t+` `+e.url:e.url),Ee(!1),Y(),G.current?.focus()}}):(0,$.jsx)($r,{autoFocus:!ge,onSearchActiveChange:Be,onSelect:e=>{N(t=>t?t+` `+e.url:e.url),Ee(!1),Y(),G.current?.focus()}})},I)})]})]})}function Zi(e){let{config:t}=ze(),{esploraApis:n}=t,{data:r,isLoading:i,error:a}=N({queryKey:[`bitcoin-tx-detail`,n,e],queryFn:({signal:t})=>Pt(e,n,t),enabled:!!e,staleTime:6e4}),{data:o}=N({queryKey:[`btc-price`,n],queryFn:({signal:e})=>Lt(n,e),refetchInterval:6e4,staleTime:3e4});return{tx:r,btcPrice:o,isLoading:i,error:a}}function Qi(e){let{config:t}=ze(),{esploraApis:n}=t,{data:r,isLoading:i,error:a,refetch:o}=N({queryKey:[`bitcoin-address-detail`,n,e],queryFn:({signal:t})=>It(e,n,t),enabled:!!e,refetchInterval:3e4}),{data:s}=N({queryKey:[`btc-price`,n],queryFn:({signal:e})=>Lt(n,e),refetchInterval:6e4,staleTime:3e4});return{addressDetail:r,btcPrice:s,isLoading:i,error:a,refetch:o}}function $i(e,t=8,n=8){return e.length<=t+n+3?e:`${e.slice(0,t)}...${e.slice(-n)}`}function ea({text:e}){let[t,n]=(0,Q.useState)(!1);return(0,$.jsx)(`button`,{onClick:async()=>{try{await navigator.clipboard.writeText(e),n(!0),setTimeout(()=>n(!1),2e3)}catch{}},className:`p-1 rounded hover:bg-muted/50 transition-colors text-muted-foreground hover:text-foreground cursor-pointer`,title:`Copy`,children:t?(0,$.jsx)(oe,{className:`size-3.5 text-green-500`}):(0,$.jsx)(c,{className:`size-3.5`})})}function ta(e){return new Date(e*1e3).toLocaleString(`en-US`,{year:`numeric`,month:`short`,day:`numeric`,hour:`2-digit`,minute:`2-digit`,hour12:!0})}function na(e){return e.toLocaleString()}function ra({txid:e}){let{tx:t,btcPrice:n,isLoading:r,error:i}=Zi(e);return r?(0,$.jsx)(ca,{}):i||!t?(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border p-6 text-center space-y-3`,children:[(0,$.jsx)(_,{className:`size-10 mx-auto text-muted-foreground/40`}),(0,$.jsx)(`p`,{className:`text-sm text-destructive`,children:`Failed to load transaction`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground font-mono break-all`,children:e})]}):(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`p-5 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`flex items-center justify-center size-10 rounded-full ${t.confirmed?`bg-green-500/10 text-green-600 dark:text-green-400`:`bg-orange-500/10 text-orange-600 dark:text-orange-400`}`,children:t.confirmed?(0,$.jsx)(oe,{className:`size-5`}):(0,$.jsx)(C,{className:`size-5`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-lg font-bold`,children:t.confirmed?`Confirmed`:`Unconfirmed`}),t.blockTime&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:ta(t.blockTime)})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Transaction ID`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-mono text-foreground break-all`,children:t.txid}),(0,$.jsx)(ea,{text:t.txid})]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[t.confirmed&&t.blockHeight!==void 0&&(0,$.jsx)(ia,{icon:(0,$.jsx)(D,{className:`size-3.5`}),label:`Block`,value:na(t.blockHeight)}),(0,$.jsx)(ia,{icon:(0,$.jsx)(de,{className:`size-3.5`}),label:`Size`,value:`${na(t.weight/4)} vB`}),(0,$.jsx)(ia,{icon:(0,$.jsx)(_,{className:`size-3.5`}),label:`Fee`,value:`${Rt(t.fee)} sat`,subtitle:`${(t.fee/(t.weight/4)).toFixed(1)} sat/vB`}),(0,$.jsx)(ia,{icon:(0,$.jsx)(u,{className:`size-3.5`}),label:`Amount`,value:`${X(t.totalOutput)} BTC`,subtitle:n?Z(t.totalOutput,n):void 0})]})]}),(0,$.jsx)(`div`,{className:`border-t border-border`,children:(0,$.jsx)(aa,{tx:t,btcPrice:n})}),(0,$.jsx)(`div`,{className:`border-t border-border px-5 py-2.5`,children:(0,$.jsxs)(`a`,{href:`https://mempool.space/tx/${e}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(_,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`View on mempool.space`}),(0,$.jsx)(b,{className:`size-3`})]})})]})}function ia({icon:e,label:t,value:n,subtitle:r}){return(0,$.jsxs)(`div`,{className:`rounded-xl bg-secondary/40 px-3.5 py-2.5 space-y-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[e,(0,$.jsx)(`span`,{children:t})]}),(0,$.jsx)(`p`,{className:`text-sm font-semibold`,children:n}),r&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:r})]})}function aa({tx:e,btcPrice:t}){return(0,$.jsxs)(`div`,{className:`p-4 space-y-3`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-medium text-muted-foreground uppercase tracking-wider px-1`,children:[(0,$.jsxs)(`span`,{children:[e.inputs.length,` Input`,e.inputs.length===1?``:`s`]}),(0,$.jsx)(m,{className:`size-3`}),(0,$.jsxs)(`span`,{children:[e.outputs.length,` Output`,e.outputs.length===1?``:`s`]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[e.inputs.slice(0,10).map((e,n)=>(0,$.jsx)(oa,{input:e,btcPrice:t},`${e.txid}-${e.vout}-${n}`)),e.inputs.length>10&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center py-1`,children:[`+`,e.inputs.length-10,` more input`,e.inputs.length-10==1?``:`s`]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[e.outputs.slice(0,10).map((e,n)=>(0,$.jsx)(sa,{output:e,btcPrice:t},`${e.address??`op_return`}-${n}`)),e.outputs.length>10&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground text-center py-1`,children:[`+`,e.outputs.length-10,` more output`,e.outputs.length-10==1?``:`s`]})]})]})]})}function oa({input:e,btcPrice:t}){return e.isCoinbase?(0,$.jsx)(`div`,{className:`rounded-lg bg-amber-500/5 border border-amber-500/20 px-3 py-2`,children:(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,$.jsx)(`span`,{className:`text-xs font-medium text-amber-600 dark:text-amber-400`,children:`Coinbase`}),(0,$.jsxs)(`span`,{className:`text-xs font-mono`,children:[X(e.value),` BTC`]})]})}):(0,$.jsxs)(`div`,{className:`rounded-lg bg-red-500/5 border border-red-500/10 px-3 py-2 space-y-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[e.address?(0,$.jsx)(B,{to:`/i/bitcoin:address:${e.address}`,className:`text-xs font-mono text-red-600 dark:text-red-400 hover:underline truncate`,children:$i(e.address,10,6)}):(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Unknown`}),(0,$.jsxs)(`span`,{className:`text-xs font-mono shrink-0`,children:[X(e.value),` BTC`]})]}),t!==void 0&&(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground text-right`,children:Z(e.value,t)})]})}function sa({output:e,btcPrice:t}){return e.scriptpubkeyType===`op_return`?(0,$.jsx)(`div`,{className:`rounded-lg bg-secondary/60 border border-border/50 px-3 py-2`,children:(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`OP_RETURN`})}):(0,$.jsxs)(`div`,{className:`rounded-lg bg-green-500/5 border border-green-500/10 px-3 py-2 space-y-0.5`,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[e.address?(0,$.jsx)(B,{to:`/i/bitcoin:address:${e.address}`,className:`text-xs font-mono text-green-600 dark:text-green-400 hover:underline truncate`,children:$i(e.address,10,6)}):(0,$.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Unknown`}),(0,$.jsxs)(`span`,{className:`text-xs font-mono shrink-0`,children:[X(e.value),` BTC`]})]}),t!==void 0&&(0,$.jsx)(`p`,{className:`text-[10px] text-muted-foreground text-right`,children:Z(e.value,t)})]})}function ca(){return(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`p-5 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`size-10 rounded-full`}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-5 w-28`}),(0,$.jsx)(q,{className:`h-3.5 w-40`})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-24`}),(0,$.jsx)(q,{className:`h-4 w-full`})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(q,{className:`h-16 rounded-xl`}),(0,$.jsx)(q,{className:`h-16 rounded-xl`}),(0,$.jsx)(q,{className:`h-16 rounded-xl`}),(0,$.jsx)(q,{className:`h-16 rounded-xl`})]})]}),(0,$.jsxs)(`div`,{className:`border-t border-border p-4 space-y-3`,children:[(0,$.jsx)(q,{className:`h-3 w-32`}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-12 rounded-lg`}),(0,$.jsx)(q,{className:`h-12 rounded-lg`})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-12 rounded-lg`}),(0,$.jsx)(q,{className:`h-12 rounded-lg`})]})]})]})]})}function la({address:e}){let{addressDetail:t,btcPrice:n,isLoading:r,error:a,refetch:o}=Qi(e);return r?(0,$.jsx)(da,{}):a||!t?(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border p-6 text-center space-y-3`,children:[(0,$.jsx)(_,{className:`size-10 mx-auto text-muted-foreground/40`}),(0,$.jsx)(`p`,{className:`text-sm text-destructive`,children:`Failed to load address`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground font-mono break-all`,children:e}),(0,$.jsxs)(Ke,{variant:`outline`,size:`sm`,onClick:()=>o(),children:[(0,$.jsx)(i,{className:`size-3.5 mr-1.5`}),`Retry`]})]}):(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[(0,$.jsxs)(`div`,{className:`p-5 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`flex items-center justify-center size-10 rounded-full bg-primary/10 text-primary`,children:(0,$.jsx)(_,{className:`size-5`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`h2`,{className:`text-lg font-bold`,children:`Bitcoin Address`}),(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t.txCount+t.pendingTxCount,` transaction`,t.txCount+t.pendingTxCount===1?``:`s`]})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Address`}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`p`,{className:`text-sm font-mono text-foreground break-all`,children:e}),(0,$.jsx)(ea,{text:e})]})]}),(0,$.jsxs)(`div`,{className:`rounded-xl bg-secondary/40 p-4 text-center space-y-1`,children:[(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground uppercase tracking-wider`,children:`Balance`}),(0,$.jsx)(`p`,{className:`text-3xl font-bold tracking-tight`,children:n?Z(t.totalBalance,n):`${X(t.totalBalance)} BTC`}),(0,$.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[X(t.totalBalance),` BTC`]}),t.pendingBalance!==0&&(0,$.jsxs)(`p`,{className:`flex items-center justify-center gap-1 text-xs text-orange-500 dark:text-orange-400 pt-1`,children:[(0,$.jsx)(i,{className:`size-3 animate-spin`}),n?`${Z(t.pendingBalance,n)} pending`:`${X(t.pendingBalance)} BTC pending`]})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(ia,{icon:(0,$.jsx)(S,{className:`size-3.5`}),label:`Total Received`,value:`${X(t.totalReceived)} BTC`,subtitle:n?Z(t.totalReceived,n):void 0}),(0,$.jsx)(ia,{icon:(0,$.jsx)(d,{className:`size-3.5`}),label:`Total Sent`,value:`${X(t.totalSent)} BTC`,subtitle:n?Z(t.totalSent,n):void 0})]})]}),t.recentTxs.length>0&&(0,$.jsxs)(`div`,{className:`border-t border-border`,children:[(0,$.jsx)(`div`,{className:`px-5 py-3`,children:(0,$.jsx)(`p`,{className:`text-xs font-medium text-muted-foreground uppercase tracking-wider`,children:`Recent Transactions`})}),(0,$.jsx)(`div`,{className:`divide-y divide-border`,children:t.recentTxs.slice(0,10).map(e=>(0,$.jsx)(ua,{tx:e,btcPrice:n},e.txid))}),t.recentTxs.length>10&&(0,$.jsx)(`div`,{className:`px-5 py-3 text-center`,children:(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[t.txCount-10,` more transaction`,t.txCount-10==1?``:`s`]})})]}),(0,$.jsx)(`div`,{className:`border-t border-border px-5 py-2.5`,children:(0,$.jsxs)(`a`,{href:`https://mempool.space/address/${e}`,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(_,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`View on mempool.space`}),(0,$.jsx)(b,{className:`size-3`})]})})]})}function ua({tx:e,btcPrice:t}){let n=e.type===`receive`;return(0,$.jsxs)(B,{to:`/i/bitcoin:tx:${e.txid}`,className:`flex items-center justify-between py-3 px-5 hover:bg-muted/50 transition-colors`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`div`,{className:`flex items-center justify-center size-8 rounded-full ${n?`bg-green-500/10 text-green-600 dark:text-green-400`:`bg-red-500/10 text-red-600 dark:text-red-400`}`,children:n?(0,$.jsx)(S,{className:`size-4`}):(0,$.jsx)(d,{className:`size-4`})}),(0,$.jsxs)(`div`,{children:[(0,$.jsx)(`p`,{className:`text-sm font-medium`,children:n?`Received`:`Sent`}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground font-mono`,children:$i(e.txid,8,8)})]})]}),(0,$.jsxs)(`div`,{className:`text-right`,children:[(0,$.jsxs)(`p`,{className:`text-sm font-medium ${n?`text-green-600 dark:text-green-400`:`text-red-600 dark:text-red-400`}`,children:[n?`+`:`-`,X(e.amount),` BTC`]}),t&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:Z(e.amount,t)})]})]})}function da(){return(0,$.jsx)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`p-5 space-y-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`size-10 rounded-full`}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-5 w-32`}),(0,$.jsx)(q,{className:`h-3.5 w-24`})]})]}),(0,$.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-16`}),(0,$.jsx)(q,{className:`h-4 w-full`})]}),(0,$.jsxs)(`div`,{className:`rounded-xl bg-secondary/40 p-4 space-y-2 flex flex-col items-center`,children:[(0,$.jsx)(q,{className:`h-3 w-12`}),(0,$.jsx)(q,{className:`h-9 w-40`}),(0,$.jsx)(q,{className:`h-4 w-28`})]}),(0,$.jsxs)(`div`,{className:`grid grid-cols-2 gap-3`,children:[(0,$.jsx)(q,{className:`h-16 rounded-xl`}),(0,$.jsx)(q,{className:`h-16 rounded-xl`})]})]})})}function fa({txid:e,link:t}){let{tx:n,btcPrice:r,isLoading:i}=Zi(e);if(i)return(0,$.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`size-12 rounded-lg shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-32`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]})]})});let a=n?n.totalOutput:0,o=n?.fee??0;return(0,$.jsxs)(B,{to:t,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[(0,$.jsx)(`div`,{className:`size-12 rounded-lg bg-orange-500/10 flex items-center justify-center shrink-0`,children:(0,$.jsx)(_,{className:`size-5 text-orange-600 dark:text-orange-400`})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(_,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{children:`Bitcoin Transaction`}),n&&(0,$.jsx)(`span`,{className:n.confirmed?`text-green-600 dark:text-green-400`:`text-yellow-600 dark:text-yellow-400`,children:n.confirmed?`Confirmed`:`Unconfirmed`})]}),(0,$.jsxs)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:[n?`${Ft(a)} BTC`:$i(e,12,8),n&&r?(0,$.jsxs)(`span`,{className:`text-muted-foreground font-normal`,children:[` (`,Z(a,r),`)`]}):null]}),n&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground truncate`,children:[`Fee `,Rt(o),` sats`,n.blockHeight?` · Block ${n.blockHeight.toLocaleString()}`:``]})]}),(0,$.jsx)(b,{className:`size-4 text-muted-foreground shrink-0`})]})}function pa({address:e,link:t}){let{addressDetail:n,btcPrice:r,isLoading:i}=Qi(e);if(i)return(0,$.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`size-12 rounded-lg shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-28`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]})]})});let a=n?.totalBalance??0,o=n?n.txCount+n.pendingTxCount:0;return(0,$.jsxs)(B,{to:t,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[(0,$.jsx)(`div`,{className:`size-12 rounded-lg bg-orange-500/10 flex items-center justify-center shrink-0`,children:(0,$.jsx)(_,{className:`size-5 text-orange-600 dark:text-orange-400`})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(_,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{children:`Bitcoin Address`})]}),(0,$.jsxs)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:[n?`${Ft(a)} BTC`:$i(e,12,8),n&&r?(0,$.jsxs)(`span`,{className:`text-muted-foreground font-normal`,children:[` (`,Z(a,r),`)`]}):null]}),n&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground truncate`,children:[o.toLocaleString(),` transaction`,o===1?``:`s`,` · `,(0,$.jsx)(`span`,{className:`font-mono`,children:$i(e,8,6)})]})]}),(0,$.jsx)(b,{className:`size-4 text-muted-foreground shrink-0`})]})}function ma(e,t=`normal`){return e.setId&&e.artId?`https://api.scryfall.com/cards/${encodeURIComponent(e.setId.toLowerCase())}/${encodeURIComponent(e.artId)}?format=image&version=${t}`:`https://api.scryfall.com/cards/named?exact=${encodeURIComponent(e.name??``)}&format=image&version=${t}`}function ha(e){switch(e.kind){case`multiverse`:return`https://api.scryfall.com/cards/multiverse/${encodeURIComponent(e.multiverseId)}`;case`set`:{let t=`https://api.scryfall.com/cards/${encodeURIComponent(e.set.toLowerCase())}/${encodeURIComponent(e.number)}`;return e.lang&&e.lang.toLowerCase()!==`en`&&e.lang.toLowerCase()!==`en-us`?`${t}/${encodeURIComponent(e.lang.toLowerCase())}`:t}}}async function ga(e,t){let n=ha(e),r=await fetch(n,{signal:t,headers:{Accept:`application/json`}});if(!r.ok)return null;let i=await r.json();return!i||i.id==null?null:i}function _a(e,t=`large`){return e.image_uris?.[t]??e.card_faces?.[0]?.image_uris?.[t]}function va(e){return N({queryKey:[`scryfall-card`,e],queryFn:({signal:t})=>ga(e,t),enabled:!!e,staleTime:1e3*60*60*24,gcTime:1e3*60*60*24*7,retry:1})}async function ya(e,t){let n=`https://en.wikipedia.org/api/rest_v1/page/media-list/${encodeURIComponent(e.replace(/\s+/g,`_`))}`,r=await fetch(n,{signal:t,headers:{accept:`application/json`}});if(!r.ok)return null;let i=await r.json();for(let e of i.items??[])if(e.type===`audio`&&e.audio_type!==`spoken`)return e.title;return null}async function ba(e,t){let n=new URL(`https://en.wikipedia.org/w/api.php`);n.searchParams.set(`action`,`query`),n.searchParams.set(`format`,`json`),n.searchParams.set(`prop`,`videoinfo`),n.searchParams.set(`viprop`,`url|mime|derivatives|extmetadata`),n.searchParams.set(`titles`,e),n.searchParams.set(`origin`,`*`);let r=await fetch(n.toString(),{signal:t,headers:{accept:`application/json`}});if(!r.ok)return null;let i=(await r.json()).query?.pages;if(!i)return null;let a=Object.values(i)[0]?.videoinfo?.[0];if(!a)return null;let o=Be(a.derivatives?.find(e=>e.type.startsWith(`audio/mpeg`))?.src??a.url);return o?{audioUrl:o,descriptionUrl:Be(a.descriptionurl)??`https://commons.wikimedia.org/wiki/${encodeURIComponent(e)}`,attribution:Sa(xa(a.extmetadata?.Artist?.value),xa(a.extmetadata?.LicenseShortName?.value),xa(a.extmetadata?.Credit?.value))}:null}function xa(e){return e?typeof DOMParser>`u`?e.replace(/<[^>]*>/g,``).trim()||null:(new DOMParser().parseFromString(e,`text/html`).body.textContent??``).trim()||null:null}function Sa(e,t,n){return e&&t?`© ${e}, ${t}`:e?`© ${e}`:t||n||`Wikimedia Commons`}async function Ca(e,t){let n=await ya(e,t);return n?ba(n,t):null}function wa(e){return N({queryKey:[`bird-song`,e],enabled:!!e,staleTime:1e3*60*60*24,gcTime:1e3*60*60*24,retry:1,queryFn:({signal:t})=>Ca(e,t)})}function Ta({title:e,className:t,ariaLabel:n}){let{data:r,isLoading:i}=wa(e);return i?(0,$.jsx)(q,{className:L(`size-10 shrink-0 rounded-full`,t),"aria-hidden":!0}):r?(0,$.jsx)(Ea,{song:r,className:t,ariaLabel:n}):null}function Ea({song:e,className:t,ariaLabel:n}){let r=(0,Q.useRef)(null),[i,a]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{a(!1)},[e.audioUrl]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`button`,{type:`button`,onClick:()=>{let e=r.current;e&&(i?(e.pause(),a(!1)):e.play().then(()=>a(!0),()=>a(!1)))},"aria-label":i?`Pause ${n??`reference recording`}`:`Play ${n??`reference recording`}`,"aria-pressed":i,title:e.attribution,className:L(`group inline-flex size-10 shrink-0 items-center justify-center rounded-full`,`bg-emerald-500 text-white shadow-md ring-1 ring-emerald-400/40`,`transition-[transform,background-color,box-shadow] duration-200`,`hover:bg-emerald-600 hover:shadow-lg active:scale-95`,`focus:outline-none focus-visible:ring-2 focus-visible:ring-emerald-500/60 focus-visible:ring-offset-2`,`focus-visible:ring-offset-background`,`dark:bg-emerald-400 dark:text-emerald-950 dark:hover:bg-emerald-300`,t),children:i?(0,$.jsx)(Da,{}):(0,$.jsx)(f,{className:`size-4 translate-x-px fill-current`,"aria-hidden":!0})}),(0,$.jsx)(`audio`,{ref:r,src:e.audioUrl,preload:`none`,loop:!0,onPause:()=>a(!1),onPlay:()=>a(!0),className:`hidden`,children:`Your browser does not support embedded audio.`})]})}function Da(){return(0,$.jsx)(`span`,{className:`flex h-4 items-end gap-[2px]`,"aria-hidden":!0,children:[`0ms`,`120ms`,`60ms`,`180ms`].map((e,t)=>(0,$.jsx)(`span`,{className:L(`block w-[2px] rounded-full bg-current`,`h-full origin-bottom motion-safe:animate-equaliser-bar`,`motion-reduce:scale-y-75`),style:{animationDelay:e}},t))})}async function Oa(e,t,n){try{let r=t===`en`?[`enwiki`]:[`${t}wiki`,`enwiki`],i=new URL(`https://www.wikidata.org/w/api.php`);i.searchParams.set(`action`,`wbgetentities`),i.searchParams.set(`ids`,e),i.searchParams.set(`props`,`sitelinks/urls`),i.searchParams.set(`sitefilter`,r.join(`|`)),i.searchParams.set(`format`,`json`),i.searchParams.set(`origin`,`*`);let a=await fetch(i.toString(),{signal:n,headers:{Accept:`application/json`}});if(!a.ok)return null;let o=(await a.json())?.entities?.[e];if(!o||o.missing!==void 0)return null;let s=o.sitelinks?.[`${t}wiki`]??o.sitelinks?.enwiki;return{id:e,wikipediaTitle:typeof s?.title==`string`?s.title:null,wikipediaUrl:typeof s?.url==`string`?s.url:null}}catch{return null}}function ka(e){let{locale:t}=Ve();return N({queryKey:[`wikidata-entity`,t,e],queryFn:({signal:n})=>Oa(e,t,n),enabled:!!e,staleTime:1e3*60*60*24,gcTime:1e3*60*60*24*7,retry:1})}async function Aa(e,t,n){try{let r=encodeURIComponent(e.replace(/ /g,`_`)),i=await fetch(`https://${t}.wikipedia.org/api/rest_v1/page/summary/${r}`,{signal:n,headers:{Accept:`application/json`}});if(!i.ok)return null;let a=await i.json();return a.type===`disambiguation`||a.type===`no-extract`?null:{title:a.title??e,extract:a.extract??``,extractHtml:a.extract_html??``,description:a.description,thumbnail:a.thumbnail?{source:a.thumbnail.source,width:a.thumbnail.width,height:a.thumbnail.height}:void 0,originalImage:a.originalimage?{source:a.originalimage.source,width:a.originalimage.width,height:a.originalimage.height}:void 0,articleUrl:a.content_urls?.desktop?.page??`https://${t}.wikipedia.org/wiki/${r}`}}catch{return null}}function ja(e){let{locale:t}=Ve();return N({queryKey:[`wikipedia-summary`,t,e],queryFn:({signal:n})=>Aa(e,t,n),enabled:!!e,staleTime:1e3*60*60*24,gcTime:1e3*60*60*24*7,retry:1})}var Ma=[`❤️`,`👍`,`👎`,`😂`,`😮`,`😢`];function Na(){let{user:e}=We(),[t,n]=Re(e?`emoji-usage-${e.pubkey}`:`emoji-usage`,{});return{trackEmojiUsage:(0,Q.useCallback)(e=>{n(t=>({...t,[e]:(t[e]||0)+1}))},[n]),getTopEmojis:(0,Q.useCallback)((e=6)=>{let n=Object.entries(t).sort(([,e],[,t])=>t-e).map(([e])=>e).slice(0,e),r=e-n.length;if(r>0){let e=new Set(n),t=Ma.filter(t=>!e.has(t)).slice(0,r);return[...n,...t]}return n},[t])}}var Pa=(0,Q.lazy)(()=>me(()=>import(`./EmojiPicker-DIvGQUn_.js`).then(e=>({default:e.EmojiPicker})),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20])));function Fa({eventId:e,eventPubkey:t,eventKind:n,reactedEvent:r,onClose:i,onReacted:a,onExpandChange:o,onReact:s,className:c}){let{user:l}=We(),{nostr:u}=_e(),{mutate:d}=qe(),f=ye(),{trackEmojiUsage:p,getTopEmojis:m}=Na(),{feedSettings:h}=Jt(),{emojis:g}=Wt(),_=h.showCustomEmojis!==!1,v=(0,Q.useMemo)(()=>_?g:[],[_,g]),[y,b]=(0,Q.useState)(!1),[S,C]=(0,Q.useState)(null),w=(0,Q.useMemo)(()=>{let e=new Map;for(let t of v)e.set(t.shortcode,t.url);return e},[v]),ee=(0,Q.useMemo)(()=>m(8).filter(e=>{if(!$e(e))return!0;let t=e.slice(1,-1);return w.has(t)}).slice(0,6),[m,w]),T=(0,Q.useCallback)((o,c)=>{if(!l)return;if(pt(),i?.(),a?.(o===`+`||o===``?`👍`:o),C(o),p(o),s){s(o,c);return}let m=o===`+`||o===``?`👍`:o,h=c?{content:m,url:c[2],name:c[1]}:{content:m},g=f.getQueryData([`event-stats`,e]);g&&f.setQueryData([`event-stats`,e],{...g,reactions:g.reactions+1,reactionEmojis:g.reactionEmojis.some(e=>e.content===m)?g.reactionEmojis:[...g.reactionEmojis,h]}),f.setQueryData([`user-reaction`,e],h);let _=[[`e`,e],[`p`,t],[`k`,String(n)]];c&&_.push(c),d({kind:7,content:o,created_at:Math.floor(Date.now()/1e3),tags:_},{onSuccess:()=>{r&&hi(u,r),setTimeout(()=>{f.invalidateQueries({queryKey:[`event-stats`,e]}),f.invalidateQueries({queryKey:[`event-interactions`,e]})},3e3)},onError:()=>{C(null),g&&f.setQueryData([`event-stats`,e],g),f.removeQueries({queryKey:[`user-reaction`,e]})}})},[l,e,t,n,r,u,s,d,f,p,i,a]),E=(0,Q.useCallback)(e=>{if($e(e)){let t=e.slice(1,-1),n=w.get(t);if(n){T(e,[`emoji`,t,n]);return}}T(e)},[T,w]),te=(0,Q.useCallback)(e=>{e.type===`native`?T(e.emoji):T(`:${e.shortcode}:`,[`emoji`,e.shortcode,e.url])},[T]);return l?y?(0,$.jsx)(`div`,{className:L(`rounded-xl shadow-xl overflow-hidden bg-popover border border-border`,c),onClick:e=>e.stopPropagation(),children:(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(`div`,{className:`w-[352px] max-w-[90vw] h-[400px] flex items-center justify-center text-sm text-muted-foreground`,children:`Loading…`}),children:(0,$.jsx)(Pa,{customEmojis:v,onSelect:te})})}):(0,$.jsxs)(`div`,{className:L(`inline-flex items-center gap-1 p-1.5 rounded-full bg-popover border border-border shadow-lg`,c),onClick:e=>e.stopPropagation(),children:[ee.map(e=>{let t=$e(e),n=t?e.slice(1,-1):void 0,r=n?w.get(n):void 0;return(0,$.jsx)(`button`,{onClick:()=>E(e),className:L(`flex items-center justify-center size-9 rounded-full text-xl transition-all focus:outline-none hover:bg-secondary hover:scale-110 active:scale-95`,S===e&&`bg-secondary scale-110`),title:`React with ${t?n:e}`,children:r?(0,$.jsx)(V,{name:n??e,url:r,className:`size-6 object-contain`}):e},e)}),(0,$.jsx)(`button`,{onClick:()=>{b(!0),o?.(!0)},className:`flex items-center justify-center size-9 rounded-full text-muted-foreground transition-all focus:outline-none hover:bg-secondary hover:text-foreground hover:scale-110 active:scale-95`,title:`More reactions`,children:(0,$.jsx)(x,{className:`size-5`})})]}):null}function Ia(e){let{nostr:t}=_e(),{user:n}=We(),r=ye(),i=e?.value??``,a=r.getQueryData([`external-user-reaction`,i]),{data:o}=N({queryKey:[`external-user-reaction`,i],queryFn:async({signal:e})=>{if(!i||!n)return null;let r=await t.query([{kinds:[17],authors:[n.pubkey],"#i":[i],limit:1}],{signal:e});if(r.length===0)return null;let a=r[0].content.trim();return a===`-`?null:{emoji:a||`+`,tags:r[0].tags}},enabled:!!i&&!!n&&a===void 0,staleTime:300*1e3,gcTime:600*1e3});return a===void 0?o:a}function La(e){let{nostr:t}=_e(),n=e?.value??``,{data:r}=N({queryKey:[`external-reaction-count`,n],queryFn:async({signal:e})=>n?(await t.query([{kinds:[17],"#i":[n],limit:500}],{signal:e})).filter(e=>e.content.trim()!==`-`).length:0,enabled:!!n,staleTime:120*1e3,gcTime:600*1e3});return r??0}function Ra(e){switch(e.type){case`url`:return`web`;case`isbn`:return`isbn`;case`iso3166`:return`iso3166`;default:return`web`}}function za({content:e,iconSize:t=`size-5`,count:n,className:r}){let{user:i}=We(),{mutate:a}=qe(),o=ye(),{toast:c}=Ue(),l=e.value,u=Ia(e),d=La(e),f=!!u,p=u?.emoji,m=u?.tags,[h,g]=(0,Q.useState)(!1),_=(0,Q.useRef)(null),v=(0,Q.useRef)(!1),y=(0,Q.useRef)(!1),b=(0,Q.useCallback)(()=>{i&&(v.current||(_.current&&=(clearTimeout(_.current),null),g(!0)))},[i]),x=(0,Q.useCallback)(()=>{y.current||(_.current=setTimeout(()=>g(!1),150))},[]),S=(0,Q.useCallback)((t,n)=>{if(!i)return;U();let r=[[`k`,Ra(e)],[`i`,l]];n&&r.push(n),o.setQueryData([`external-user-reaction`,l],{emoji:t||`+`,tags:r}),o.setQueryData([`external-reaction-count`,l],e=>(e??0)+1),a({kind:17,content:t,created_at:Math.floor(Date.now()/1e3),tags:r},{onSuccess:()=>{setTimeout(()=>{o.invalidateQueries({queryKey:[`external-user-reaction`,l]}),o.invalidateQueries({queryKey:[`external-reaction-count`,l]})},3e3)},onError:()=>{c({title:`Failed to react`,variant:`destructive`}),o.setQueryData([`external-user-reaction`,l],null),o.setQueryData([`external-reaction-count`,l],e=>Math.max(0,(e??1)-1))}})},[i,e,l,a,o,c]);return(0,$.jsxs)(bt,{open:h,onOpenChange:e=>{e&&v.current||(e||(y.current=!1),g(e))},children:[(0,$.jsx)(vt,{asChild:!0,children:(0,$.jsxs)(`button`,{className:L(`flex items-center gap-1.5 p-2 rounded-full transition-colors`,f?`text-pink-500`:`text-muted-foreground hover:text-pink-500 hover:bg-pink-500/10`,r),title:`React`,onClick:e=>{e.stopPropagation(),i&&(v.current||g(e=>!e))},onMouseEnter:b,onMouseLeave:x,children:[f&&p?(0,$.jsx)(`span`,{className:L(t,`flex items-center justify-center text-base leading-none`),children:(0,$.jsx)(nt,{content:p,tags:m,className:t})}):(0,$.jsx)(s,{className:t}),(n??d)>0&&(0,$.jsx)(`span`,{className:`text-sm tabular-nums`,children:Ht(n??d)})]})}),(0,$.jsx)(yt,{className:`w-auto p-0 border-0 bg-transparent shadow-none`,side:`top`,align:`start`,onClick:e=>e.stopPropagation(),onOpenAutoFocus:e=>e.preventDefault(),onMouseEnter:b,onMouseLeave:x,children:(0,$.jsx)(Fa,{eventId:l,eventPubkey:``,eventKind:17,onExpandChange:e=>{y.current=e},onClose:()=>{y.current=!1,v.current=!0,g(!1),setTimeout(()=>{v.current=!1},300)},onReact:S})})]})}var Ba=e({ReplyComposeModal:()=>Va});function Va({event:e,quotedEvent:t,open:n,onOpenChange:r,onSuccess:i,initialContent:a,initialMode:o,title:s,placeholder:c}){let l=e instanceof URL,u=typeof e==`string`,d=l||u,f=!!e,p=!!t,[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(!1),[v,y]=(0,Q.useState)(void 0),b=!d&&e instanceof Object&&`kind`in e&&e.kind===0,x=s??(o===`poll`?`New poll`:d?`New comment`:b?`Comment on profile`:f?`Reply to post`:p?`Quote post`:`New post`),S=c??(d?`Write a comment...`:p&&!f?`Add a comment...`:`What's on your mind?`);return(0,$.jsx)(jt,{open:n,onOpenChange:r,children:(0,$.jsx)(J,{ref:(0,Q.useCallback)(e=>{y(e??void 0)},[]),onOpenAutoFocus:e=>{e.preventDefault();let t=e.currentTarget.querySelector(`textarea`);t&&t.focus()},onInteractOutside:(0,Q.useCallback)(e=>{e.preventDefault()},[]),children:(0,$.jsxs)(_t,{value:v,children:[(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-4 h-12 shrink-0`,children:[(0,$.jsx)(At,{className:`text-base font-semibold`,children:x}),(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[g&&(0,$.jsxs)(`div`,{className:`inline-flex items-center gap-0.5 p-1 bg-muted/50 rounded-lg`,children:[(0,$.jsx)(`button`,{onClick:()=>h(!1),className:L(`px-3.5 py-1.5 text-xs font-medium rounded-md transition-all motion-safe:active:scale-95`,m?`text-muted-foreground hover:text-foreground`:`bg-background text-foreground shadow-sm`),children:`Edit`}),(0,$.jsx)(`button`,{onClick:()=>h(!0),className:L(`px-3.5 py-1.5 text-xs font-medium rounded-md transition-all motion-safe:active:scale-95`,m?`bg-background text-foreground shadow-sm`:`text-muted-foreground hover:text-foreground`),children:`Preview`})]}),(0,$.jsx)(`button`,{onClick:()=>r(!1),className:`p-1.5 -mr-1.5 rounded-full text-muted-foreground hover:text-foreground hover:bg-secondary/60 transition-all motion-safe:active:scale-90`,children:(0,$.jsx)(E,{className:`size-5`})})]})]}),e&&!p&&(0,$.jsx)(`div`,{className:`overflow-y-auto max-h-[calc(var(--visual-viewport-height,100dvh)*0.2)] shrink-0`,children:l?(0,$.jsx)(`div`,{className:`mx-4 mb-2`,children:(0,$.jsx)(P,{url:e.href,showActions:!1,hideImage:!0})}):u?null:(0,$.jsx)(So,{event:e,className:`mx-4 mb-2`,disableHoverCards:!0})}),l&&/bsky\.(app|social)/.test(e.href)&&(0,$.jsxs)(`div`,{className:`mx-4 mb-2 rounded-lg border border-amber-500/30 bg-amber-500/5 px-3 py-2 flex items-start gap-2 shrink-0`,children:[(0,$.jsx)(`span`,{className:`text-sm leading-relaxed shrink-0`,"aria-hidden":!0,children:`⚠️`}),(0,$.jsx)(`p`,{className:`text-xs text-amber-700 dark:text-amber-400 leading-relaxed`,children:`People on Bluesky can't see you because they're not actually decentralized.`})]}),(0,$.jsx)(`div`,{className:`min-h-0 flex-1 flex flex-col overflow-hidden`,children:(0,$.jsx)(Xi,{replyTo:p?void 0:e??void 0,quotedEvent:t??void 0,onSuccess:()=>{r(!1),i?.()},placeholder:S,forceExpanded:!0,hideAvatar:!0,previewMode:m,onHasPreviewableContentChange:_,initialContent:a,initialMode:o})})]})})})}var Ha=280,Ua=`rounded-[4.75%]`;function Wa({card:e,url:t}){let{data:n,isLoading:r,isError:i}=va((0,Q.useMemo)(()=>e.kind===`multiverse`?{kind:`multiverse`,multiverseId:e.multiverseId}:{kind:`set`,set:e.set,number:e.number,lang:e.lang},[e]));return r?(0,$.jsx)(`div`,{className:`flex flex-col items-center py-4`,children:(0,$.jsx)(q,{className:L(`w-full aspect-[5/7]`,Ua),style:{maxWidth:Ha}})}):i||!n?(0,$.jsx)(P,{url:t,showActions:!1}):(0,$.jsx)(Ga,{card:n,url:t})}function Ga({card:e,url:t}){let[n,r]=(0,Q.useState)(!1),[i,a]=(0,Q.useState)(0),o=(0,Q.useMemo)(()=>{if(e.card_faces&&e.card_faces[0]?.image_uris)return e.card_faces.map(e=>e.image_uris?.large).filter(e=>!!e);let t=_a(e,`large`);return t?[t]:[]},[e]),s=(0,Q.useMemo)(()=>e.card_faces&&e.card_faces.length>0?e.card_faces:[e],[e]),c=s[i]??s[0],l=o[i]??o[0],u=s.length>1;return(0,$.jsxs)(`div`,{className:`flex flex-col items-center py-4`,children:[(0,$.jsx)(`div`,{className:`w-full`,style:{maxWidth:Ha},children:l?(0,$.jsx)(Ka,{src:l,name:c.name,onClick:()=>r(!0)}):(0,$.jsx)(`div`,{className:L(`w-full aspect-[5/7] bg-secondary flex items-center justify-center`,Ua),children:(0,$.jsx)(Vt,{className:`size-12 text-muted-foreground/40`})})}),u&&(0,$.jsx)(`div`,{className:`flex gap-1.5 mt-4`,children:s.map((e,t)=>(0,$.jsx)(`button`,{type:`button`,onClick:()=>a(t),className:L(`text-xs px-2.5 py-1 rounded-full transition-colors`,t===i?`bg-primary text-primary-foreground`:`bg-secondary text-secondary-foreground hover:bg-secondary/80`),children:e.name},t))}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-center gap-x-4 gap-y-1.5 mt-4`,children:[(0,$.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(Vt,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`View on Gatherer`}),(0,$.jsx)(b,{className:`size-3`})]}),(0,$.jsxs)(`a`,{href:e.scryfall_uri,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(`span`,{children:`View on Scryfall`}),(0,$.jsx)(b,{className:`size-3`})]})]}),n&&o.length>0&&(0,$.jsx)(Se,{images:o,currentIndex:i,onClose:()=>r(!1),onNext:()=>a(e=>(e+1)%o.length),onPrev:()=>a(e=>(e-1+o.length)%o.length),showDownload:!1,maxDotIndicators:10})]})}function Ka({src:e,name:t,onClick:n}){let r=at(18,1.04),i=(0,Q.useRef)(null),a=(0,Q.useRef)(void 0),o=(0,Q.useCallback)((e,t)=>{let n=r.ref.current,a=i.current;if(!n||!a)return;let o=n.getBoundingClientRect(),s=(e-o.left)/o.width*100,c=(t-o.top)/o.height*100;a.style.background=`radial-gradient(circle at ${s}% ${c}%, rgba(255,255,255,0.35) 0%, rgba(255,255,255,0.08) 35%, transparent 65%)`,a.style.opacity=`1`},[r.ref]),s=(0,Q.useCallback)(()=>{let e=i.current;e&&(e.style.opacity=`0`)},[]),c=(0,Q.useCallback)(e=>{r.onPointerDown(e),e.pointerType===`touch`&&(clearTimeout(a.current),o(e.clientX,e.clientY))},[r,o]),l=(0,Q.useCallback)(e=>{r.onPointerMove(e),!(e.pointerType===`touch`&&!r.isTouchActive)&&o(e.clientX,e.clientY)},[r,o]),u=(0,Q.useCallback)(e=>{r.onPointerUp(e),e.pointerType===`touch`&&(clearTimeout(a.current),a.current=setTimeout(s,600))},[r,s]),d=(0,Q.useCallback)(e=>{r.onPointerLeave(e),e.pointerType===`touch`?(clearTimeout(a.current),a.current=setTimeout(s,600)):s()},[r,s]),f={...r.style,touchAction:`pan-y`,transformStyle:`preserve-3d`};return(0,$.jsxs)(`div`,{ref:r.ref,style:f,onPointerDown:c,onPointerMove:l,onPointerUp:u,onPointerLeave:d,className:`relative select-none`,children:[(0,$.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`View ${t} full size`,className:L(`block w-full focus:outline-none focus-visible:ring-2 focus-visible:ring-primary`,Ua),children:(0,$.jsx)(`img`,{src:e,alt:t,loading:`eager`,draggable:!1,className:L(`w-full aspect-[5/7] object-cover shadow-[0_14px_40px_-12px_rgba(0,0,0,0.45)]`,Ua),decoding:`async`})}),(0,$.jsx)(`div`,{ref:i,"aria-hidden":`true`,className:L(`absolute inset-0 pointer-events-none`,Ua),style:{opacity:0,transition:`opacity 0.4s ease-out`,mixBlendMode:`overlay`}})]})}async function qa(e,t){if(navigator.share)try{return await navigator.share({url:e,title:t}),`shared`}catch(e){if(e instanceof Error&&e.name===`AbortError`)return`cancelled`}return await navigator.clipboard.writeText(e),`copied`}var Ja={AF:[34.53,69.17],AL:[41.33,19.82],DZ:[36.75,3.04],AD:[42.51,1.52],AO:[-8.84,13.23],AG:[17.12,-61.85],AR:[-34.6,-58.38],AM:[40.18,44.51],AU:[-35.28,149.13],AT:[48.21,16.37],AZ:[40.41,49.87],BS:[25.06,-77.35],BH:[26.23,50.58],BD:[23.81,90.41],BB:[13.1,-59.61],BY:[53.9,27.57],BE:[50.85,4.35],BZ:[17.25,-88.77],BJ:[6.5,2.6],BT:[27.47,89.64],BO:[-16.5,-68.15],BA:[43.86,18.41],BW:[-24.65,25.91],BR:[-15.79,-47.88],BN:[4.94,114.95],BG:[42.7,23.32],BF:[12.37,-1.52],BI:[-3.38,29.36],CV:[14.93,-23.51],KH:[11.56,104.92],CM:[3.87,11.52],CA:[45.42,-75.7],CF:[4.36,18.56],TD:[12.13,15.05],CL:[-33.45,-70.67],CN:[39.9,116.4],CO:[4.71,-74.07],KM:[-11.7,43.26],CG:[-4.27,15.28],CD:[-4.32,15.31],CR:[9.93,-84.08],CI:[6.85,-5.3],HR:[45.81,15.98],CU:[23.11,-82.37],CY:[35.17,33.37],CZ:[50.08,14.44],DK:[55.68,12.57],DJ:[11.59,43.15],DM:[15.3,-61.39],DO:[18.49,-69.9],EC:[-.18,-78.47],EG:[30.04,31.24],SV:[13.69,-89.19],GQ:[3.75,8.78],ER:[15.34,38.93],EE:[59.44,24.75],SZ:[-26.32,31.13],ET:[9.02,38.75],FJ:[-18.14,178.44],FI:[60.17,24.94],FR:[48.86,2.35],GA:[.39,9.45],GM:[13.45,-16.58],GE:[41.72,44.79],DE:[52.52,13.41],GH:[5.56,-.19],GR:[37.98,23.73],GD:[12.05,-61.75],GT:[14.63,-90.51],GN:[9.64,-13.58],GW:[11.86,-15.6],GY:[6.8,-58.16],HT:[18.54,-72.34],HN:[14.07,-87.19],HU:[47.5,19.04],IS:[64.15,-21.94],IN:[28.61,77.21],ID:[-6.21,106.85],IR:[35.69,51.42],IQ:[33.31,44.37],IE:[53.35,-6.26],IL:[31.77,35.23],IT:[41.9,12.5],JM:[18,-76.79],JP:[35.68,139.69],JO:[31.95,35.93],KZ:[51.17,71.43],KE:[-1.29,36.82],KI:[1.33,172.98],KP:[39.02,125.75],KR:[37.57,126.98],KW:[29.38,47.99],KG:[42.87,74.59],LA:[17.97,102.63],LV:[56.95,24.11],LB:[33.89,35.5],LS:[-29.31,27.48],LR:[6.3,-10.8],LY:[32.9,13.18],LI:[47.14,9.52],LT:[54.69,25.28],LU:[49.61,6.13],MG:[-18.91,47.52],MW:[-13.97,33.79],MY:[3.14,101.69],MV:[4.18,73.51],ML:[12.64,-8],MT:[35.9,14.51],MH:[7.09,171.38],MR:[18.09,-15.98],MU:[-20.16,57.5],MX:[19.43,-99.13],FM:[6.92,158.16],MD:[47.01,28.86],MC:[43.73,7.42],MN:[47.91,106.91],ME:[42.44,19.26],MA:[33.97,-6.85],MZ:[-25.97,32.57],MM:[19.76,96.07],NA:[-22.56,17.08],NR:[-.55,166.92],NP:[27.72,85.32],NL:[52.37,4.89],NZ:[-41.29,174.78],NI:[12.15,-86.27],NE:[13.51,2.11],NG:[9.06,7.49],MK:[42,21.43],NO:[59.91,10.75],OM:[23.61,58.59],PK:[33.69,73.04],PW:[7.5,134.62],PA:[8.98,-79.52],PG:[-6.31,147.18],PY:[-25.26,-57.58],PE:[-12.05,-77.04],PH:[14.6,120.98],PL:[52.23,21.01],PT:[38.72,-9.14],QA:[25.29,51.53],RO:[44.43,26.1],RU:[55.76,37.62],RW:[-1.94,29.87],KN:[17.3,-62.72],LC:[14.01,-60.99],VC:[13.16,-61.23],WS:[-13.83,-171.76],SM:[43.94,12.45],ST:[.34,6.73],SA:[24.69,46.72],SN:[14.69,-17.44],RS:[44.79,20.47],SC:[-4.62,55.45],SL:[8.48,-13.23],SG:[1.35,103.82],SK:[48.15,17.11],SI:[46.06,14.51],SB:[-9.43,160.03],SO:[2.05,45.32],ZA:[-25.75,28.19],SS:[4.85,31.61],ES:[40.42,-3.7],LK:[6.93,79.84],SD:[15.59,32.53],SR:[5.87,-55.17],SE:[59.33,18.07],CH:[46.95,7.45],SY:[33.51,36.29],TW:[25.03,121.57],TJ:[38.56,68.77],TZ:[-6.16,35.74],TH:[13.76,100.5],TL:[-8.56,125.57],TG:[6.14,1.21],TO:[-21.21,-175.2],TT:[10.66,-61.51],TN:[36.81,10.18],TR:[39.93,32.85],TM:[37.95,58.38],TV:[-8.52,179.2],UG:[.35,32.58],UA:[50.45,30.52],AE:[24.45,54.65],GB:[51.51,-.13],US:[38.9,-77.04],UY:[-34.88,-56.17],UZ:[41.3,69.28],VU:[-17.73,168.32],VA:[41.9,12.45],VE:[10.49,-66.88],VN:[21.03,105.85],YE:[15.35,44.21],ZM:[-15.39,28.32],ZW:[-17.83,31.05]},Ya={"US-AL":[32.38,-86.3],"US-AK":[64.84,-147.72],"US-AZ":[33.45,-112.07],"US-AR":[34.75,-92.29],"US-CA":[34.05,-118.24],"US-CO":[39.74,-104.98],"US-CT":[41.76,-72.68],"US-DE":[39.16,-75.52],"US-FL":[25.76,-80.19],"US-GA":[33.75,-84.39],"US-HI":[21.31,-157.86],"US-ID":[43.62,-116.2],"US-IL":[41.88,-87.63],"US-IN":[39.77,-86.16],"US-IA":[41.59,-93.6],"US-KS":[39.05,-95.68],"US-KY":[38.25,-85.76],"US-LA":[29.95,-90.07],"US-ME":[43.66,-70.26],"US-MD":[39.29,-76.61],"US-MA":[42.36,-71.06],"US-MI":[42.33,-83.05],"US-MN":[44.98,-93.27],"US-MS":[32.3,-90.18],"US-MO":[38.63,-90.2],"US-MT":[46.87,-114],"US-NE":[41.26,-95.94],"US-NV":[36.17,-115.14],"US-NH":[43.21,-71.54],"US-NJ":[40.74,-74.18],"US-NM":[35.08,-106.65],"US-NY":[40.71,-74.01],"US-NC":[35.78,-78.64],"US-ND":[46.88,-96.79],"US-OH":[39.96,-82.99],"US-OK":[35.47,-97.52],"US-OR":[45.52,-122.68],"US-PA":[39.95,-75.17],"US-RI":[41.82,-71.41],"US-SC":[34,-81.03],"US-SD":[43.55,-96.73],"US-TN":[36.16,-86.78],"US-TX":[30.27,-97.74],"US-UT":[40.76,-111.89],"US-VT":[44.26,-72.58],"US-VA":[37.54,-77.43],"US-WA":[47.61,-122.33],"US-WV":[38.35,-81.63],"US-WI":[43.07,-89.4],"US-WY":[41.14,-104.82],"US-DC":[38.9,-77.04],"US-PR":[18.47,-66.11],"US-GU":[13.44,144.79],"CA-AB":[51.05,-114.07],"CA-BC":[49.28,-123.12],"CA-MB":[49.9,-97.14],"CA-NB":[45.96,-66.65],"CA-NL":[47.56,-52.71],"CA-NS":[44.65,-63.57],"CA-NT":[62.45,-114.37],"CA-NU":[63.75,-68.52],"CA-ON":[43.65,-79.38],"CA-PE":[46.24,-63.13],"CA-QC":[45.5,-73.57],"CA-SK":[50.45,-104.62],"CA-YT":[60.72,-135.06],"AU-ACT":[-35.28,149.13],"AU-NSW":[-33.87,151.21],"AU-NT":[-12.46,130.84],"AU-QLD":[-27.47,153.03],"AU-SA":[-34.93,138.6],"AU-TAS":[-42.88,147.33],"AU-VIC":[-37.81,144.96],"AU-WA":[-31.95,115.86],"GB-ENG":[51.51,-.13],"GB-SCT":[55.95,-3.19],"GB-WLS":[51.48,-3.18],"GB-NIR":[54.6,-5.93],"DE-BW":[48.78,9.18],"DE-BY":[48.14,11.58],"DE-BE":[52.52,13.41],"DE-BB":[52.39,13.07],"DE-HB":[53.08,8.8],"DE-HH":[53.55,9.99],"DE-HE":[50.11,8.68],"DE-MV":[53.63,11.42],"DE-NI":[52.37,9.74],"DE-NW":[51.23,6.78],"DE-RP":[50,8.27],"DE-SL":[49.23,7],"DE-SN":[51.05,13.74],"DE-ST":[51.48,11.97],"DE-SH":[54.32,10.14],"DE-TH":[50.98,11.03],"FR-ARA":[45.76,4.84],"FR-BFC":[47.32,5.04],"FR-BRE":[48.11,-1.68],"FR-CVL":[47.39,.69],"FR-COR":[42.15,9.1],"FR-GES":[48.57,7.75],"FR-HDF":[50.63,3.06],"FR-IDF":[48.86,2.35],"FR-NAQ":[44.84,-.58],"FR-NOR":[49.44,1.1],"FR-OCC":[43.6,1.44],"FR-PDL":[47.22,-1.55],"FR-PAC":[43.3,5.37],"BR-SP":[-23.55,-46.63],"BR-RJ":[-22.91,-43.17],"BR-MG":[-19.92,-43.94],"BR-BA":[-12.97,-38.51],"BR-DF":[-15.79,-47.88],"BR-RS":[-30.03,-51.23],"BR-PR":[-25.43,-49.27],"BR-PE":[-8.05,-34.87],"BR-CE":[-3.72,-38.53],"BR-PA":[-1.46,-48.5],"BR-AM":[-3.12,-60.02],"BR-GO":[-16.68,-49.26],"IN-DL":[28.61,77.21],"IN-MH":[19.08,72.88],"IN-KA":[12.97,77.59],"IN-TN":[13.08,80.27],"IN-WB":[22.57,88.36],"IN-GJ":[23.02,72.57],"IN-RJ":[26.91,75.79],"IN-UP":[26.85,80.95],"IN-KL":[8.52,76.94],"IN-AP":[17.39,78.49],"IN-TG":[17.39,78.49],"IN-PB":[30.73,76.78],"JP-13":[35.68,139.69],"JP-27":[34.69,135.5],"JP-14":[35.44,139.64],"JP-23":[35.18,136.91],"JP-01":[43.06,141.35],"JP-26":[35.01,135.77],"JP-40":[33.59,130.4],"JP-34":[34.4,132.46],"MX-CMX":[19.43,-99.13],"MX-JAL":[20.67,-103.35],"MX-NLE":[25.67,-100.31],"MX-BCN":[32.53,-117.02],"MX-YUC":[20.97,-89.62],"CN-BJ":[39.9,116.4],"CN-SH":[31.23,121.47],"CN-GD":[23.13,113.26],"CN-HK":[22.32,114.17],"CN-TW":[25.03,121.57],"CN-MO":[22.2,113.55],"CN-SC":[30.57,104.07],"CN-ZJ":[30.27,120.15],"ES-MD":[40.42,-3.7],"ES-CT":[41.39,2.17],"ES-AN":[37.39,-5.98],"ES-PV":[43.26,-2.93],"ES-VC":[39.47,-.38],"IT-62":[41.9,12.5],"IT-25":[45.46,9.19],"IT-21":[45.07,7.69],"IT-34":[45.44,12.32],"IT-72":[40.85,14.27],"IT-82":[38.12,13.36]},Xa={AF:`Kabul`,AL:`Tirana`,DZ:`Algiers`,AD:`Andorra la Vella`,AO:`Luanda`,AG:`St. John's`,AR:`Buenos Aires`,AM:`Yerevan`,AU:`Canberra`,AT:`Vienna`,AZ:`Baku`,BS:`Nassau`,BH:`Manama`,BD:`Dhaka`,BB:`Bridgetown`,BY:`Minsk`,BE:`Brussels`,BZ:`Belmopan`,BJ:`Porto-Novo`,BT:`Thimphu`,BO:`La Paz`,BA:`Sarajevo`,BW:`Gaborone`,BR:`Brasília`,BN:`Bandar Seri Begawan`,BG:`Sofia`,BF:`Ouagadougou`,BI:`Gitega`,CV:`Praia`,KH:`Phnom Penh`,CM:`Yaoundé`,CA:`Ottawa`,CF:`Bangui`,TD:`N'Djamena`,CL:`Santiago`,CN:`Beijing`,CO:`Bogotá`,KM:`Moroni`,CG:`Brazzaville`,CD:`Kinshasa`,CR:`San José`,CI:`Yamoussoukro`,HR:`Zagreb`,CU:`Havana`,CY:`Nicosia`,CZ:`Prague`,DK:`Copenhagen`,DJ:`Djibouti`,DM:`Roseau`,DO:`Santo Domingo`,EC:`Quito`,EG:`Cairo`,SV:`San Salvador`,GQ:`Malabo`,ER:`Asmara`,EE:`Tallinn`,SZ:`Mbabane`,ET:`Addis Ababa`,FJ:`Suva`,FI:`Helsinki`,FR:`Paris`,GA:`Libreville`,GM:`Banjul`,GE:`Tbilisi`,DE:`Berlin`,GH:`Accra`,GR:`Athens`,GD:`St. George's`,GT:`Guatemala City`,GN:`Conakry`,GW:`Bissau`,GY:`Georgetown`,HT:`Port-au-Prince`,HN:`Tegucigalpa`,HU:`Budapest`,IS:`Reykjavik`,IN:`New Delhi`,ID:`Jakarta`,IR:`Tehran`,IQ:`Baghdad`,IE:`Dublin`,IL:`Jerusalem`,IT:`Rome`,JM:`Kingston`,JP:`Tokyo`,JO:`Amman`,KZ:`Astana`,KE:`Nairobi`,KI:`Tarawa`,KP:`Pyongyang`,KR:`Seoul`,KW:`Kuwait City`,KG:`Bishkek`,LA:`Vientiane`,LV:`Riga`,LB:`Beirut`,LS:`Maseru`,LR:`Monrovia`,LY:`Tripoli`,LI:`Vaduz`,LT:`Vilnius`,LU:`Luxembourg`,MG:`Antananarivo`,MW:`Lilongwe`,MY:`Kuala Lumpur`,MV:`Malé`,ML:`Bamako`,MT:`Valletta`,MH:`Majuro`,MR:`Nouakchott`,MU:`Port Louis`,MX:`Mexico City`,FM:`Palikir`,MD:`Chișinău`,MC:`Monaco`,MN:`Ulaanbaatar`,ME:`Podgorica`,MA:`Rabat`,MZ:`Maputo`,MM:`Naypyidaw`,NA:`Windhoek`,NR:`Yaren`,NP:`Kathmandu`,NL:`Amsterdam`,NZ:`Wellington`,NI:`Managua`,NE:`Niamey`,NG:`Abuja`,MK:`Skopje`,NO:`Oslo`,OM:`Muscat`,PK:`Islamabad`,PW:`Ngerulmud`,PA:`Panama City`,PG:`Port Moresby`,PY:`Asunción`,PE:`Lima`,PH:`Manila`,PL:`Warsaw`,PT:`Lisbon`,QA:`Doha`,RO:`Bucharest`,RU:`Moscow`,RW:`Kigali`,KN:`Basseterre`,LC:`Castries`,VC:`Kingstown`,WS:`Apia`,SM:`San Marino`,ST:`São Tomé`,SA:`Riyadh`,SN:`Dakar`,RS:`Belgrade`,SC:`Victoria`,SL:`Freetown`,SG:`Singapore`,SK:`Bratislava`,SI:`Ljubljana`,SB:`Honiara`,SO:`Mogadishu`,ZA:`Pretoria`,SS:`Juba`,ES:`Madrid`,LK:`Colombo`,SD:`Khartoum`,SR:`Paramaribo`,SE:`Stockholm`,CH:`Bern`,SY:`Damascus`,TW:`Taipei`,TJ:`Dushanbe`,TZ:`Dodoma`,TH:`Bangkok`,TL:`Dili`,TG:`Lomé`,TO:`Nukuʻalofa`,TT:`Port of Spain`,TN:`Tunis`,TR:`Ankara`,TM:`Ashgabat`,TV:`Funafuti`,UG:`Kampala`,UA:`Kyiv`,AE:`Abu Dhabi`,GB:`London`,US:`Washington, D.C.`,UY:`Montevideo`,UZ:`Tashkent`,VU:`Port Vila`,VA:`Vatican City`,VE:`Caracas`,VN:`Hanoi`,YE:`Sana'a`,ZM:`Lusaka`,ZW:`Harare`};function Za(e){let t=e.toUpperCase();if(t.includes(`-`)){let e=Ya[t];if(e)return{latitude:e[0],longitude:e[1],city:``};let n=t.split(`-`)[0],r=Ja[n];return r?{latitude:r[0],longitude:r[1],city:Xa[n]??``}:null}let n=Ja[t];return n?{latitude:n[0],longitude:n[1],city:Xa[t]??``}:null}var Qa={0:{description:`Clear sky`,icon:`☀️`},1:{description:`Mainly clear`,icon:`🌤️`},2:{description:`Partly cloudy`,icon:`⛅`},3:{description:`Overcast`,icon:`☁️`},45:{description:`Foggy`,icon:`🌫️`},48:{description:`Depositing rime fog`,icon:`🌫️`},51:{description:`Light drizzle`,icon:`🌦️`},53:{description:`Moderate drizzle`,icon:`🌦️`},55:{description:`Dense drizzle`,icon:`🌧️`},56:{description:`Light freezing drizzle`,icon:`🌧️`},57:{description:`Dense freezing drizzle`,icon:`🌧️`},61:{description:`Slight rain`,icon:`🌦️`},63:{description:`Moderate rain`,icon:`🌧️`},65:{description:`Heavy rain`,icon:`🌧️`},66:{description:`Light freezing rain`,icon:`🌧️`},67:{description:`Heavy freezing rain`,icon:`🌧️`},71:{description:`Slight snowfall`,icon:`🌨️`},73:{description:`Moderate snowfall`,icon:`🌨️`},75:{description:`Heavy snowfall`,icon:`❄️`},77:{description:`Snow grains`,icon:`❄️`},80:{description:`Slight rain showers`,icon:`🌦️`},81:{description:`Moderate rain showers`,icon:`🌧️`},82:{description:`Violent rain showers`,icon:`🌧️`},85:{description:`Slight snow showers`,icon:`🌨️`},86:{description:`Heavy snow showers`,icon:`❄️`},95:{description:`Thunderstorm`,icon:`⛈️`},96:{description:`Thunderstorm with slight hail`,icon:`⛈️`},99:{description:`Thunderstorm with heavy hail`,icon:`⛈️`}};function $a(e){return[71,85].includes(e)?{type:`snow`,intensity:`light`}:[73].includes(e)?{type:`snow`,intensity:`moderate`}:[75,77,86].includes(e)?{type:`snow`,intensity:`heavy`}:[51,56,61,80].includes(e)?{type:`rain`,intensity:`light`}:[53,63,66,81,95].includes(e)?{type:`rain`,intensity:`moderate`}:[55,57,65,67,82,96,99].includes(e)?{type:`rain`,intensity:`heavy`}:{type:null,intensity:`light`}}async function eo(e,t,n){try{let r=new URLSearchParams({latitude:e.toString(),longitude:t.toString(),current:`temperature_2m,relative_humidity_2m,apparent_temperature,weather_code,wind_speed_10m,is_day`,timezone:`auto`}),i=await fetch(`https://api.open-meteo.com/v1/forecast?${r}`,{signal:n,headers:{Accept:`application/json`}});if(!i.ok)return null;let a=(await i.json()).current;if(!a)return null;let o=a.weather_code??0,s=Qa[o]??{description:`Unknown`,icon:`🌡️`};return{temperature:Math.round(a.temperature_2m),apparentTemperature:Math.round(a.apparent_temperature),humidity:Math.round(a.relative_humidity_2m),windSpeed:Math.round(a.wind_speed_10m),weatherCode:o,description:s.description,icon:s.icon,isDay:a.is_day===1}}catch{return null}}function to(e){let t=e?Za(e):null;return N({queryKey:[`weather`,e],queryFn:async({signal:e})=>{if(!t)return null;let n=await eo(t.latitude,t.longitude,e);return n?{...n,city:t.city}:null},enabled:!!t,staleTime:1e3*60*15,gcTime:1e3*60*60,retry:1})}function no({url:e}){let t=(0,Q.useMemo)(()=>Ce(e),[e]),n=(0,Q.useMemo)(()=>De(e),[e]),r=(0,Q.useMemo)(()=>we(e),[e]),i=(0,Q.useMemo)(()=>Ee(e),[e]);return t?(0,$.jsx)(co,{title:t,url:e}):n?(0,$.jsx)(ro,{id:n,url:e}):r?(0,$.jsx)(oo,{author:r.author,rkey:r.rkey,url:e}):i?(0,$.jsx)(Wa,{card:i,url:e}):(0,$.jsx)(P,{url:e,showActions:!1})}function ro({id:e,url:t}){let{data:n,isLoading:r}=ka(e);return r?(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[(0,$.jsx)(q,{className:`w-full aspect-[16/9]`}),(0,$.jsxs)(`div`,{className:`p-5 space-y-3`,children:[(0,$.jsx)(q,{className:`h-3 w-24`}),(0,$.jsx)(q,{className:`h-7 w-3/4`}),(0,$.jsx)(q,{className:`h-4 w-1/2`}),(0,$.jsxs)(`div`,{className:`space-y-2 pt-2`,children:[(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]})]})]}):n?.wikipediaTitle&&n.wikipediaUrl?(0,$.jsx)(co,{title:n.wikipediaTitle,url:n.wikipediaUrl}):(0,$.jsx)(P,{url:t,showActions:!1})}function io(e){return e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}K`:String(e)}function ao(e){let t=Date.now()-new Date(e).getTime(),n=Math.floor(t/6e4);if(n<1)return`just now`;if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r<24)return`${r}h`;let i=Math.floor(r/24);return i<30?`${i}d`:`${Math.floor(i/30)}mo`}function oo({author:e,rkey:t,url:n}){let{data:r,isLoading:i,isError:a}=Te(e,t),{toast:o}=Ue(),s=qt(),c=`/i/${encodeURIComponent(`https://bsky.app/profile/${r?.handle??e}`)}`,l=(0,Q.useMemo)(()=>wr(n),[n]),[u,d]=(0,Q.useState)(!1),[f,p]=(0,Q.useState)(!1),m=(0,Q.useCallback)(e=>{e.stopPropagation(),p(!0)},[]),h=(0,Q.useCallback)(e=>{e.stopPropagation(),d(!0)},[]),g=(0,Q.useCallback)(async e=>{e.stopPropagation(),await qa(`${s}/i/${encodeURIComponent(n)}`)===`copied`&&o({title:`Link copied`})},[n,o,s]);return i?(0,$.jsx)(`div`,{className:`py-3`,children:(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsx)(q,{className:`size-11 rounded-full shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(q,{className:`h-4 w-28`}),(0,$.jsx)(q,{className:`h-3.5 w-20`})]}),(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-4/5`}),(0,$.jsxs)(`div`,{className:`flex gap-6 pt-1`,children:[(0,$.jsx)(q,{className:`h-4 w-10`}),(0,$.jsx)(q,{className:`h-4 w-10`}),(0,$.jsx)(q,{className:`h-4 w-10`})]})]})]})}):a||!r?(0,$.jsx)(P,{url:n,showActions:!1}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`article`,{className:`py-1`,children:[(0,$.jsxs)(`div`,{className:`flex gap-3`,children:[(0,$.jsx)(B,{to:c,className:`shrink-0`,children:r.avatar?(0,$.jsx)(`img`,{src:r.avatar,alt:``,className:`size-11 rounded-full object-cover`,loading:`lazy`,onError:e=>{e.currentTarget.style.display=`none`},decoding:`async`}):(0,$.jsx)(`div`,{className:`size-11 rounded-full bg-gradient-to-br from-sky-400 to-blue-500 flex items-center justify-center text-white text-sm font-bold`,children:(r.displayName??r.handle).charAt(0).toUpperCase()})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 min-w-0`,children:[(0,$.jsx)(B,{to:c,className:`font-semibold text-[15px] truncate leading-tight hover:underline`,children:r.displayName??r.handle}),(0,$.jsxs)(B,{to:c,className:`text-muted-foreground text-sm truncate leading-tight hover:underline`,children:[`@`,r.handle]}),(0,$.jsx)(`span`,{className:`text-muted-foreground text-sm shrink-0`,children:`·`}),(0,$.jsx)(`span`,{className:`text-muted-foreground text-sm shrink-0`,children:ao(r.createdAt)})]}),r.text&&(0,$.jsx)(`p`,{className:`mt-1 text-[15px] leading-relaxed whitespace-pre-wrap break-words`,children:r.text}),r.images&&r.images.length>0&&(0,$.jsx)(`div`,{className:L(`mt-3 rounded-xl overflow-hidden border border-border`,r.images.length===1&&`grid grid-cols-1`,r.images.length===2&&`grid grid-cols-2 gap-0.5`,r.images.length===3&&`grid grid-cols-2 gap-0.5`,r.images.length>=4&&`grid grid-cols-2 gap-0.5`),children:r.images.slice(0,4).map((e,t)=>(0,$.jsx)(`div`,{className:L(`relative overflow-hidden bg-secondary`,r.images.length===1?`aspect-video`:`aspect-square`,r.images.length===3&&t===0&&`row-span-2 aspect-auto`),children:(0,$.jsx)(`img`,{src:e.thumb,alt:e.alt||``,loading:`lazy`,className:`absolute inset-0 w-full h-full object-cover`,onError:e=>{e.currentTarget.style.display=`none`},decoding:`async`})},t))}),r.external&&r.external.thumb&&(0,$.jsxs)(`div`,{className:`mt-3 rounded-xl border border-border overflow-hidden bg-secondary/30`,children:[(0,$.jsx)(`div`,{className:`aspect-[2/1] overflow-hidden bg-secondary`,children:(0,$.jsx)(`img`,{src:r.external.thumb,alt:``,loading:`lazy`,className:`w-full h-full object-cover`,onError:e=>{e.currentTarget.style.display=`none`},decoding:`async`})}),r.external.title&&(0,$.jsx)(`div`,{className:`px-3 py-2.5`,children:(0,$.jsx)(`p`,{className:`text-sm font-semibold leading-tight line-clamp-2`,children:r.external.title})})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-5 mt-3 -ml-2`,children:[(0,$.jsxs)(`button`,{type:`button`,onClick:m,className:`inline-flex items-center gap-1.5 p-2 rounded-full text-muted-foreground hover:text-sky-500 hover:bg-sky-500/10 transition-colors`,title:`Comment`,children:[(0,$.jsx)(se,{className:`size-[18px]`}),r.replyCount>0&&(0,$.jsx)(`span`,{className:`text-sm tabular-nums`,children:io(r.replyCount)})]}),(0,$.jsxs)(`button`,{type:`button`,onClick:h,className:`inline-flex items-center gap-1.5 p-2 rounded-full text-muted-foreground hover:text-green-500 hover:bg-green-500/10 transition-colors`,title:`Share to feed`,children:[(0,$.jsx)(v,{className:`size-[18px]`}),r.repostCount>0&&(0,$.jsx)(`span`,{className:`text-sm tabular-nums`,children:io(r.repostCount)})]}),(0,$.jsx)(za,{content:l,iconSize:`size-[18px]`,count:r.likeCount}),(0,$.jsx)(`button`,{type:`button`,onClick:g,className:`inline-flex items-center p-2 rounded-full text-muted-foreground hover:text-primary hover:bg-primary/10 transition-colors`,title:`Share link`,children:(0,$.jsx)(ae,{className:`size-[18px]`})})]})]})]}),(0,$.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(Et,{className:`size-3.5 text-sky-500`}),(0,$.jsx)(`a`,{href:n,target:`_blank`,rel:`noopener noreferrer`,className:`hover:text-foreground transition-colors hover:underline`,children:`View on Bluesky`}),(0,$.jsx)(b,{className:`size-3`})]})]}),f&&(0,$.jsx)(Va,{open:f,onOpenChange:p,event:new URL(n)}),u&&(0,$.jsx)(Va,{open:u,onOpenChange:d,initialContent:n,title:`Share to feed`})]})}var so=160;function co({title:e,url:t}){let{data:n,isLoading:r}=ja(e),{data:i}=wa(e),a=(0,Q.useRef)(null),[o,s]=(0,Q.useState)(!1),[c,l]=(0,Q.useState)(!1),u=(0,Q.useCallback)(()=>{let e=a.current;e&&s(e.scrollHeight>so)},[]);if((0,Q.useEffect)(()=>(u(),window.addEventListener(`resize`,u),()=>window.removeEventListener(`resize`,u)),[u]),r)return(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[(0,$.jsx)(q,{className:`w-full aspect-[16/9]`}),(0,$.jsxs)(`div`,{className:`p-5 space-y-3`,children:[(0,$.jsx)(q,{className:`h-3 w-24`}),(0,$.jsx)(q,{className:`h-7 w-3/4`}),(0,$.jsx)(q,{className:`h-4 w-1/2`}),(0,$.jsxs)(`div`,{className:`space-y-2 pt-2`,children:[(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]})]})]});if(!n)return(0,$.jsx)(P,{url:t,showActions:!1});let d=Qt(n.thumbnail?.source,960,n.originalImage?.width);return(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[d&&(0,$.jsx)(`div`,{className:`relative w-full overflow-hidden bg-gradient-to-br from-blue-500/10 to-indigo-500/10`,children:(0,$.jsx)(`img`,{src:d,alt:n.title,className:`w-full max-h-[320px] object-cover`,loading:`eager`,decoding:`async`,onError:e=>{e.currentTarget.parentElement.style.display=`none`}})}),(0,$.jsxs)(`div`,{className:`p-5 sm:p-6`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground mb-2`,children:[(0,$.jsx)(Tt,{className:`size-3.5 shrink-0`}),(0,$.jsx)(`span`,{children:`Wikipedia`})]}),(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,$.jsx)(`h2`,{className:`text-2xl sm:text-3xl font-bold leading-snug mb-1 min-w-0 flex-1`,children:n.title}),(0,$.jsx)(Ta,{title:e,className:`mt-1`,ariaLabel:`recording for ${n.title}`})]}),n.description&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground capitalize mb-4`,children:n.description}),n.extract&&(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`p`,{ref:a,style:!c&&o?{maxHeight:so,overflow:`hidden`}:void 0,className:`text-sm leading-relaxed text-muted-foreground`,children:n.extract}),!c&&o&&(0,$.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 h-12 bg-gradient-to-t from-background to-transparent pointer-events-none`})]}),o&&(0,$.jsx)(`button`,{className:`text-sm text-primary hover:underline`,onClick:()=>l(e=>!e),children:c?`Show less`:`Read more`})]})]}),(0,$.jsxs)(`div`,{className:`border-t border-border px-5 py-2.5 flex flex-wrap items-center gap-x-4 gap-y-1.5`,children:[(0,$.jsxs)(`a`,{href:n.articleUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(Tt,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Read on Wikipedia`}),(0,$.jsx)(b,{className:`size-3`})]}),i&&(0,$.jsxs)(`a`,{href:i.descriptionUrl,target:`_blank`,rel:`noopener noreferrer`,title:i.attribution,className:`inline-flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(f,{className:`size-3 fill-current`,"aria-hidden":!0}),(0,$.jsxs)(`span`,{className:`truncate`,children:[`Recording: `,i.attribution]}),(0,$.jsx)(b,{className:`size-3 shrink-0`})]})]})]})}function lo({isbn:e}){let t=e.replace(`isbn:`,``),{data:n,isLoading:r}=Ar(t),i=Tr(t);if(r)return(0,$.jsx)(`div`,{className:`rounded-2xl border border-border overflow-hidden p-5`,children:(0,$.jsxs)(`div`,{className:`flex gap-5`,children:[(0,$.jsx)(q,{className:`w-[120px] h-[180px] rounded-lg shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-3`,children:[(0,$.jsx)(q,{className:`h-3 w-24`}),(0,$.jsx)(q,{className:`h-6 w-3/4`}),(0,$.jsx)(q,{className:`h-4 w-1/2`}),(0,$.jsx)(q,{className:`h-4 w-1/3`}),(0,$.jsxs)(`div`,{className:`flex gap-2 pt-2`,children:[(0,$.jsx)(q,{className:`h-6 w-16 rounded-full`}),(0,$.jsx)(q,{className:`h-6 w-20 rounded-full`})]})]})]})});let a=n?.cover?.large||n?.cover?.medium,o=n?.authors?.map(e=>e.name).join(`, `),s=n?.publishers?.map(e=>e.name).join(`, `);return(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:[(0,$.jsx)(`div`,{className:`p-5`,children:(0,$.jsxs)(`div`,{className:`flex gap-5`,children:[a?(0,$.jsx)(`div`,{className:`shrink-0`,children:(0,$.jsx)(`img`,{src:a,alt:n?.title||`Book cover`,className:`w-[120px] sm:w-[140px] rounded-lg shadow-md object-cover`,loading:`lazy`,onError:e=>{e.currentTarget.style.display=`none`},decoding:`async`})}):(0,$.jsx)(`div`,{className:`shrink-0 w-[120px] sm:w-[140px] h-[180px] sm:h-[210px] rounded-lg bg-secondary flex items-center justify-center`,children:(0,$.jsx)(pe,{className:`size-10 text-muted-foreground/40`})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-2`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(pe,{className:`size-3.5 shrink-0`}),(0,$.jsxs)(`span`,{children:[`ISBN `,i]})]}),(0,$.jsx)(`h2`,{className:`text-xl font-bold leading-snug line-clamp-3`,children:n?.title||`Unknown Book`}),o&&(0,$.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[`by `,o]}),(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground pt-1`,children:[n?.publish_date&&(0,$.jsx)(`span`,{children:n.publish_date}),s&&(0,$.jsx)(`span`,{children:s}),n?.number_of_pages&&(0,$.jsxs)(`span`,{children:[n.number_of_pages,` pages`]})]}),n?.subjects&&n.subjects.length>0&&(0,$.jsx)(`div`,{className:`flex flex-wrap gap-1.5 pt-2`,children:n.subjects.map(e=>(0,$.jsx)(`span`,{className:`text-xs px-2.5 py-0.5 rounded-full bg-secondary text-muted-foreground`,children:e.name},e.name))})]})]})}),(0,$.jsx)(`div`,{className:`border-t border-border px-5 py-2.5`,children:(0,$.jsxs)(`a`,{href:`https://openlibrary.org/isbn/${t}`,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(p,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`View on OpenLibrary`}),(0,$.jsx)(b,{className:`size-3`})]})})]})}var uo=100;function fo({extract:e,articleUrl:t}){let n=(0,Q.useRef)(null),[r,i]=(0,Q.useState)(!1),[a,o]=(0,Q.useState)(!1),s=(0,Q.useCallback)(()=>{let e=n.current;e&&i(e.scrollHeight>uo)},[]);return(0,Q.useEffect)(()=>(s(),window.addEventListener(`resize`,s),()=>window.removeEventListener(`resize`,s)),[s]),(0,$.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(`p`,{ref:n,style:!a&&r?{maxHeight:uo,overflow:`hidden`}:void 0,className:`text-sm leading-relaxed text-muted-foreground`,children:e}),!a&&r&&(0,$.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 h-12 bg-gradient-to-t from-background to-transparent pointer-events-none`})]}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[r&&(0,$.jsx)(`button`,{className:`text-sm text-primary hover:underline`,onClick:()=>o(e=>!e),children:a?`Show less`:`Read more`}),(0,$.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors`,children:[(0,$.jsx)(p,{className:`size-3.5`}),(0,$.jsx)(`span`,{children:`Wikipedia`}),(0,$.jsx)(b,{className:`size-3`})]})]})]})}function po({code:e}){let{data:t,isLoading:n}=to(e);return n?(0,$.jsx)(`div`,{className:`mt-5 rounded-xl bg-secondary/50 p-4`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,$.jsx)(q,{className:`size-12 rounded-lg`}),(0,$.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,$.jsx)(q,{className:`h-5 w-24`}),(0,$.jsx)(q,{className:`h-3 w-32`})]}),(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(q,{className:`h-3 w-16`}),(0,$.jsx)(q,{className:`h-3 w-16`})]})]})}):t?(0,$.jsx)(`div`,{className:`mt-5 rounded-xl bg-gradient-to-br from-secondary/60 to-secondary/30 border border-border/50 p-4 transition-all hover:border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(`span`,{className:`text-4xl leading-none`,role:`img`,"aria-label":t.description,children:t.icon}),(0,$.jsxs)(`div`,{children:[(0,$.jsxs)(`p`,{className:`text-2xl font-bold tabular-nums leading-tight`,children:[t.temperature,`°C`]}),(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:t.description})]})]}),(0,$.jsx)(`div`,{className:`h-10 w-px bg-border/60 mx-1`}),(0,$.jsxs)(`div`,{className:`flex-1 grid grid-cols-2 gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`text-foreground/60`,children:`Feels like`}),(0,$.jsxs)(`span`,{className:`font-medium text-foreground tabular-nums`,children:[t.apparentTemperature,`°`]})]}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(r,{className:`size-3 shrink-0`}),(0,$.jsxs)(`span`,{className:`font-medium text-foreground tabular-nums`,children:[t.humidity,`%`]})]}),(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(re,{className:`size-3 shrink-0`}),(0,$.jsxs)(`span`,{className:`font-medium text-foreground tabular-nums`,children:[t.windSpeed,` km/h`]})]}),t.city&&(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(ie,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:t.city})]})]})]})}):null}function mo({code:e}){let t=zt(e),{data:n,isLoading:r}=ja(Bt(e));return t?(0,$.jsx)(`div`,{className:`rounded-2xl border border-border overflow-hidden`,children:(0,$.jsxs)(`div`,{className:`p-6 sm:p-8`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-4`,children:[t.subdivision&&n?.thumbnail?(0,$.jsx)(`img`,{src:n.thumbnail.source,alt:t.subdivisionName??t.subdivision,className:`size-16 sm:size-20 rounded-md object-cover shadow-sm border border-border`,decoding:`async`}):(0,$.jsx)(`span`,{className:`text-6xl sm:text-7xl leading-none`,role:`img`,"aria-label":`Flag of ${t.name}`,children:t.flag}),(0,$.jsxs)(`div`,{className:`space-y-1`,children:[(0,$.jsx)(`h2`,{className:`text-2xl sm:text-3xl font-bold leading-snug`,children:t.subdivisionName??t.name}),t.subdivision&&(0,$.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[t.name,t.subdivisionName?``:` · ${t.subdivision}`]}),n?.description&&(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground capitalize`,children:n.description})]})]}),(0,$.jsx)(po,{code:e}),r?(0,$.jsxs)(`div`,{className:`mt-5 space-y-2`,children:[(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-full`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]}):n?.extract?(0,$.jsx)(fo,{extract:n.extract,articleUrl:n.articleUrl}):null]})}):(0,$.jsxs)(`div`,{className:`rounded-2xl border border-border p-5 text-center`,children:[(0,$.jsx)(ie,{className:`size-8 mx-auto mb-2 text-muted-foreground/40`}),(0,$.jsxs)(`p`,{className:`text-muted-foreground`,children:[`Unknown country code: `,e]})]})}function ho({identifier:e}){let t=(0,Q.useMemo)(()=>wr(e),[e]),n=`/i/${encodeURIComponent(e)}`;switch(t.type){case`url`:{let e=Ee(t.value);return e?(0,$.jsx)(vo,{card:e,url:t.value,link:n}):(0,$.jsx)(go,{url:t.value,link:n})}case`isbn`:return(0,$.jsx)(_o,{isbn:t.value,link:n});case`iso3166`:return(0,$.jsx)(yo,{code:t.code,link:n});case`bitcoin-tx`:return(0,$.jsx)(fa,{txid:t.txid,link:n});case`bitcoin-address`:return(0,$.jsx)(pa,{address:t.address,link:n});default:return(0,$.jsx)(B,{to:n,className:`block px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(p,{className:`size-5 text-muted-foreground shrink-0`}),(0,$.jsx)(`span`,{className:`text-sm text-muted-foreground truncate`,children:e})]})})}}function go({url:e,link:t}){let n=(0,Q.useMemo)(()=>F(e),[e]),{data:r,isLoading:i}=Y(e),a=(0,Q.useMemo)(()=>{try{return new URL(e).hostname.replace(/^www\./,``)}catch{return e}},[e]),o=r?.title,s=r?.thumbnail_url,c=r?.provider_name||a;if(i)return(0,$.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`size-12 rounded-lg shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-24`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]})]})});let l=n?`https://img.youtube.com/vi/${n}/mqdefault.jpg`:s;return(0,$.jsxs)(B,{to:t,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[l?(0,$.jsx)(`img`,{src:l,alt:``,className:`size-12 rounded-lg object-cover shrink-0`,loading:`lazy`,onError:e=>{e.currentTarget.style.display=`none`},decoding:`async`}):(0,$.jsx)(`div`,{className:`size-12 rounded-lg bg-secondary flex items-center justify-center shrink-0`,children:(0,$.jsx)(dt,{url:e,size:20})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(dt,{url:e,size:12,className:`shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:c})]}),(0,$.jsx)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:o||e})]}),(0,$.jsx)(b,{className:`size-4 text-muted-foreground shrink-0`})]})}function _o({isbn:e,link:t}){let n=e.replace(`isbn:`,``),{data:r,isLoading:i}=Ar(n);if(i)return(0,$.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`w-9 h-12 rounded shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-16`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]})]})});let a=r?.cover?.medium||r?.cover?.large,o=r?.authors?.map(e=>e.name).join(`, `);return(0,$.jsxs)(B,{to:t,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[a?(0,$.jsx)(`img`,{src:a,alt:r?.title||`Book cover`,className:`w-9 h-12 rounded object-cover shrink-0`,loading:`lazy`,decoding:`async`}):(0,$.jsx)(`div`,{className:`w-9 h-12 rounded bg-secondary flex items-center justify-center shrink-0`,children:(0,$.jsx)(pe,{className:`size-4 text-muted-foreground/40`})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(pe,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{children:`Book`})]}),(0,$.jsx)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:r?.title||`ISBN ${n}`}),o&&(0,$.jsxs)(`p`,{className:`text-xs text-muted-foreground truncate`,children:[`by `,o]})]}),(0,$.jsx)(b,{className:`size-4 text-muted-foreground shrink-0`})]})}function vo({card:e,url:t,link:n}){let{data:r,isLoading:i}=va((0,Q.useMemo)(()=>e.kind===`multiverse`?{kind:`multiverse`,multiverseId:e.multiverseId}:{kind:`set`,set:e.set,number:e.number,lang:e.lang},[e]));if(i)return(0,$.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`w-9 h-12 rounded-md shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-20`}),(0,$.jsx)(q,{className:`h-4 w-3/4`})]})]})});let a=r?_a(r,`small`):void 0,o;try{o=new URL(t).hostname.replace(/^www\./,``)}catch{o=t}return(0,$.jsxs)(B,{to:n,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[a?(0,$.jsx)(`img`,{src:a,alt:r?.name??`Magic card`,className:`w-9 h-12 rounded-md object-cover shrink-0 shadow-sm`,loading:`lazy`,decoding:`async`}):(0,$.jsx)(`div`,{className:`w-9 h-12 rounded-md bg-secondary flex items-center justify-center shrink-0`,children:(0,$.jsx)(Vt,{className:`size-4 text-muted-foreground/40`})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(Vt,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{children:`Magic Card`})]}),(0,$.jsx)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:r?.name??o}),r?.set_name&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:r.set_name})]}),(0,$.jsx)(b,{className:`size-4 text-muted-foreground shrink-0`})]})}function yo({code:e,link:t}){let n=zt(e);return(0,$.jsxs)(B,{to:t,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[(0,$.jsx)(`span`,{className:`text-2xl leading-none shrink-0`,role:`img`,"aria-label":n?`Flag of ${n.name}`:e,children:n?.flag??`🌍`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(ie,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{children:`Country`})]}),(0,$.jsx)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:n?.name??e})]}),(0,$.jsx)(b,{className:`size-4 text-muted-foreground shrink-0`})]})}function bo({addr:e}){let{data:t,isLoading:n}=Nt(e),r=t?.tags.find(([e])=>e===`name`)?.[1]||t?.tags.find(([e])=>e===`d`)?.[1]||`Community`,i=t?.tags.find(([e])=>e===`image`)?.[1],a=t?.tags.find(([e])=>e===`description`)?.[1],o=t?.tags.filter(([e,,,t])=>e===`p`&&t===`moderator`).length??0,s=(0,Q.useMemo)(()=>`/${ve.naddrEncode({kind:e.kind,pubkey:e.pubkey,identifier:e.identifier})}`,[e]);return n?(0,$.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`size-12 rounded-lg shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-16`}),(0,$.jsx)(q,{className:`h-4 w-32`})]})]})}):(0,$.jsxs)(B,{to:s,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[(0,$.jsx)(ut,{src:i,alt:r,className:`size-12 rounded-lg object-cover shrink-0`,loading:`lazy`,decoding:`async`,fallback:(0,$.jsx)(`div`,{className:`size-12 rounded-lg bg-primary/10 flex items-center justify-center shrink-0`,children:(0,$.jsx)(y,{className:`size-5 text-primary/50`})})}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(y,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{children:`Community`}),o>0&&(0,$.jsxs)(`span`,{className:`text-muted-foreground/60`,children:[`· `,o,` mod`,o===1?``:`s`]})]}),(0,$.jsx)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:r}),a&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:a})]})]})}function xo({pubkey:e}){let t=He(e),n=t.data?.metadata,r=Xe(n),i=n?.name??n?.display_name??`Anonymous`,o=it(e,n);return t.isLoading?(0,$.jsx)(`div`,{className:`px-4 py-3 border-b border-border`,children:(0,$.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,$.jsx)(q,{className:`size-12 rounded-full shrink-0`}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0 space-y-1.5`,children:[(0,$.jsx)(q,{className:`h-3 w-16`}),(0,$.jsx)(q,{className:`h-4 w-32`})]})]})}):(0,$.jsxs)(B,{to:o,className:`flex items-center gap-3 px-4 py-3 border-b border-border hover:bg-secondary/30 transition-colors`,children:[(0,$.jsxs)(Qe,{shape:r,className:`size-12 shrink-0`,children:[(0,$.jsx)(Ze,{src:n?.picture,alt:i}),(0,$.jsx)(Ye,{className:`bg-primary/20 text-primary`,children:(0,$.jsx)(a,{className:`size-5`})})]}),(0,$.jsxs)(`div`,{className:`flex-1 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5 text-xs text-muted-foreground`,children:[(0,$.jsx)(a,{className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{children:`Profile`})]}),(0,$.jsx)(`p`,{className:`text-sm font-medium truncate mt-0.5`,children:i}),n?.nip05&&(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground truncate`,children:n.nip05})]})]})}function So({event:e,className:t,disableHoverCards:n}){if(e.kind===0)return(0,$.jsx)(`div`,{className:L(`rounded-xl border border-border bg-secondary/30 overflow-hidden`,t),children:(0,$.jsx)(xo,{pubkey:e.pubkey})});if(e.kind>=3e4&&e.kind<4e4){let r=e.tags.find(([e])=>e===`d`)?.[1]??``;return(0,$.jsx)(xe,{addr:{kind:e.kind,pubkey:e.pubkey,identifier:r},className:t,disableHoverCards:n})}return(0,$.jsx)(Pe,{eventId:e.id,authorHint:e.pubkey,className:t,disableHoverCards:n})}export{hi as A,Cr as B,pa as C,Ti as D,Xi as E,wr as F,Sr as H,Or as I,yr as L,Hr as M,Ar as N,wi as O,Dr as P,br as R,la as S,fa as T,_r as U,gr as V,Ta as _,ho as a,_a as b,$a as c,Va as d,Ba as f,ka as g,ja as h,mo as i,Vr as j,Ci as k,to as l,Fa as m,lo as n,xo as o,za as p,bo as r,no as s,So as t,qa as u,wa as v,ra as w,ma as x,va as y,xr as z}; // @license-end