PageSourceSearch

https://mas.to/packs/collection_list_item-CSFDXV-y.js

js mas.to collected 2026-10-03 02:31:17 UTC 29,350 bytes, 2 lines download raw bytes

1import{o as e,r as t}from"./rolldown-runtime-C0FnF6B9.js";import{t as n}from"./react-C21x__mS.js";import{a as r,c as i,s as a}from"./react-intl-DlKP8ATg.js";import{t as o}from"./jsx-runtime-BdxMnOeJ.js";import{c as s,h as c,p as l,y as u}from"./initial_state-DnZ5UeDQ.js";import{l as d}from"./store-BKpYtGn4.js";import{c as f,i as p,l as m,n as h,o as g,s as _,u as v}from"./react-router-BkmJBoOP.js";import{c as y}from"./redux-toolkit.modern-DNDb-du5.js";import{n as b,o as x,s as S}from"./typed_functions-Whap35TF.js";import{B as C,D as w,E as ee,F as te,G as ne,K as T,L as re,M as E,N as D,V as O,k as ie,z as k}from"./accounts_typed-AgBHJ2f3.js";import{Wn as ae}from"./filters-Br4s8K7f.js";import{t as A}from"./helmet-C5cFHKKR.js";import{t as j}from"./react-router-dom-C1dtKQUg.js";import{n as M}from"./modal-CMPL9eyP.js";import{t as oe}from"./classnames-CfLRLWYq.js";import{i as se}from"./skip_links-CmGdRWd6.js";import{t as N}from"./loading_indicator-eceYQNAM.js";import{t as ce}from"./icon_button-DfNtv8BJ.js";import{t as P}from"./icon-BNrUFRb_.js";import{i as le}from"./identity_context-CLXpzjnM.js";import{n as ue,r as de,t as fe}from"./utils-B468qXuV.js";import{t as F}from"./useAccount-DhSMQkpH.js";import{n as pe}from"./relative_timestamp-BOzlsJjy.js";import{i as me,l as he}from"./account-jztc2BSU.js";import{n as ge}from"./default-BJghFIgN.js";import{t as I}from"./display_name-Dl2ASLlM.js";import{t as L}from"./button-BmF3DXsp.js";import{i as _e}from"./logo-CMWuQAdn.js";import{t as ve}from"./dropdown_menu-U6SI6ReI.js";import{n as R}from"./bundle_column_error-Dc3rL_yE.js";import{t as ye}from"./add-B5d0-_pA.js";import{a as be}from"./columns_area-CMZxm2t8.js";import{n as xe,t as Se}from"./keyboard_arrow_up-DMWxQ2V-.js";import{n as Ce}from"./lists-Ty7GvjeB.js";import{a as we,c as z,i as Te,o as Ee}from"./collection_preview_card-BEHkYLQ_.js";import{t as B}from"./callout-B1KuUxns.js";import{n as V,r as De,t as H}from"./components-BM4_xVIg.js";import{t as Oe}from"./formatted_date-BukCBi06.js";import{n as ke}from"./form_field_wrapper-B00MNsQd.js";import{d as Ae,f as je,l as Me,m as Ne,n as Pe,p as Fe,r as Ie,u as Le}from"./form_fields-W-m7nFkb.js";import{n as Re}from"./text_input_field-Ch1_pDG1.js";import{n as ze,t as Be}from"./useAccountId-B-0VumhZ.js";import{t as Ve}from"./useSearchTags-DOXSBkM-.js";import{n as He,t as Ue}from"./help-DEiVT85l.js";import{n as We,t as Ge}from"./account_list_item-DWGXMWqZ.js";import{t as Ke}from"./not_signed_in_indicator-DzYHCJen.js";import{t as qe}from"./useSearchAccounts-ZROkEl7O.js";import{t as Je}from"./useSearchParam-Dy1bZjd7.js";import{t as Ye}from"./visibility_off-DP3wtlEJ.js";import{n as Xe}
1from"./revoke_collection_inclusion_modal-4j69u9Mi.js";var U=e(n()),W=o(),Ze=({visibleItems:e,truncatedItems:t,toggleButton:n,renderListItem:r})=>{let i=(0,U.useId)(),a=`${i}-desc`,[o,s]=(0,U.useState)(!1),c=(0,U.useCallback)(()=>{s(e=>!e)},[]),l=t.length>0,u=e.length+ +!!l,d=u+(o?t.length:0);return(0,W.jsxs)(W.Fragment,{children:[e.map((t,n)=>r({item:t,index:n,totalListLength:d,isLastElement:n===e.length-1&&!l})),l&&(0,W.jsx)(H,{"aria-posinset":u,"aria-setsize":d,"aria-labelledby":i,"aria-describedby":a,children:(0,W.jsx)(z,{icon:n.icon&&(0,W.jsx)(P,{id:`toggle-icon`,icon:n.icon}),sideContent:(0,W.jsx)(P,{id:`open-status`,icon:o?Se:xe}),children:(0,W.jsx)(we,{id:i,subtitleId:a,"aria-expanded":o,onClick:c,subtitle:n.subtitle,children:n.title})})}),o&&t.map((e,n)=>r({item:e,index:u+n+1,totalListLength:d,isLastElement:n===t.length-1}))]})},Qe=e=>(0,W.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:24,viewBox:`0 -960 960 960`,width:24,...e,children:(0,W.jsx)(`path`,{d:`M480-160q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm0-240q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm0-240q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Z`})}),G={header:`_feat_collections__header`,heading:`_feat_collections__heading`,listHeader:`_feat_collections__listHeader`,subHeading:`_feat_collections__subHeading`,maxCollectionsError:`_feat_collections__maxCollectionsError`,error:`_feat_collections__error`},$e=e(oe()),K=({compact:e,secondary:t,onClick:n,children:i})=>(0,W.jsxs)(j,{to:`/collections/new`,className:(0,$e.default)(`button`,e&&`button--compact`,t&&`button-secondary`),onClick:n,children:[(0,W.jsx)(P,{id:`plus`,icon:ye}),i??(0,W.jsx)(r,{...Z.newCollection})]}),et=()=>(0,W.jsx)(R,{image:null,className:G.error,message:(0,W.jsx)(r,{id:`collections.error_loading_collections`,defaultMessage:`There was an error when trying to load these collections.`})});function q(e){let t=x();return(0,U.useEffect)(()=>{e&&t(D({accountId:e}))},[t,e]),S(t=>k(t,e,`createdBy`))}var tt=()=>{let e=ze(),t=Be(),n=F(t),{collections:i,status:a}=q(t),o=i.length<Q,s=t===e,c=s&&a===`idle`&&o;return a===`error`||!t?(0,W.jsx)(et,{}):a===`loading`?(0,W.jsx)(N,{}):i.length===0?s?(0,W.jsx)(R,{title:(0,W.jsx)(r,{id:`empty_column.account_featured_self.showcase_accounts`,defaultMessage:`Showcase your favorite accounts`}),message:(0,W.jsx)(r,{id:`empty_column.account_featured_self.showcase_accounts_desc`,defaultMessage:`Collections are curated lists of accounts to help others discover more of the Fediverse.`}),children:(0,W.jsx)(K,{compact:!0})}):(0,W.jsx)(R,{title:(0,W.jsx)(r,{id:`empty_column.collections`,defaultMessage:`{acct} has not created any collections yet.`,values:{acct:(0,W.jsx)(I,{variant:`simple`,account:n})}})}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:G.listHeader,children:[(0,W.jsx)(`h2`,{className:G.subHeading,children:(0,W.jsx)(r,{id:`collections.list.collections_with_count`,defaultMessage:`{count, plural, one {# Collection} other {# Collections}}`,values:{count:i.length}})}),c&&(0,W.jsx)(K,{compact:!0})]}),(0,W.jsxs)(V,{children:[s&&!o&&(0,W.jsx)(jt,{className:G.maxCollectionsError}),i.map((e,t)=>(0,W.jsx)(Pt,{withTimestamp:!0,withAuthorHandle:!1,collection:e,positionInList:t+1,listSize:i.length},e.id))]})]})},J={header:`_collections_detail__header`,titleWithMenu:`_collections_detail__titleWithMenu`,titleWrapper:`_collections_detail__titleWrapper`,name:`_collections_detail__name`,authorNote:`_collections_detail__authorNote`,description:`_collections_detail__description`,headerButtonWrapper:`_collections_detail__headerButtonWrapper`,iconButton:`_collections_detail__iconButton`,sensitiveScreen:`_collections_detail__sensitiveScreen`,subheadingWithSelect:`_collections_detail__subheadingWithSelect`,selectWrapper:`_collections_detail__selectWrapper`,select:`_collections_detail__select`,columnSubheading:`_collections_detail__columnSubheading`},nt=a({empty:{id:`collections.accounts.empty_title`,defaultMessage:`This collection is empty`}}
1),rt=b([e=>e.accounts,(e,t)=>e.collections.collections[t??``]?.items],(e,t)=>(t??[]).map(t=>({...t,account:t.account_id?e.get(t.account_id):null})));function it(e,t){if(!t||t===`date_added`)return e;let n=[...e];switch(t){case`alphabetical`:return n.sort((e,t)=>{let n=e.account?.display_name??``,r=t.account?.display_name??``;return n.localeCompare(r)});case`last_active`:return n.sort((e,t)=>{let n=e.account?.last_status_at??``,r=t.account?.last_status_at??``;return new Date(r).getTime()-new Date(n).getTime()});case`most_followers`:return n.sort((e,t)=>{let n=e.account?.followers_count??0;return(t.account?.followers_count??0)-n});default:return e}}var at=({collection:e})=>{let t=i(),n=Xe(e),a=(0,U.useRef)(null),o=e.account_id===u,{account_id:s,id:c}=e,l=S(e=>e.relationships),d=S(e=>rt(e,c)),[f,p]=Je(`sort`,`date_added`),m=(0,U.useCallback)(e=>{p(e.target.value)},[p]),h=it(d,f),{visibleAccounts:g,hiddenAccounts:_}=(0,U.useMemo)(()=>{let e=[],t=[];return h.forEach(n=>{let{account:r,account_id:i}=n;if(!o&&!r)return;let a=i?l.get(i):null;a?.blocking||a?.muting?t.push(n):e.push(n)}),{visibleAccounts:e,hiddenAccounts:t}},[h,o,l]),v=(0,U.useCallback)(({relationship:e,accountId:t})=>!u||!e?(0,W.jsx)(We,{accountId:t}):s===u&&(e.following||e.requested)?null:t===u?(0,W.jsx)(L,{secondary:!0,compact:!0,onClick:n,children:(0,W.jsx)(r,{id:`collections.detail.revoke_inclusion`,defaultMessage:`Remove me`})}):(0,W.jsx)(We,{accountId:t}),[s,n]),y=(0,U.useCallback)(({item:e,index:t,totalListLength:n,isLastElement:r})=>(0,W.jsx)(H,{"aria-posinset":t+1,"aria-setsize":n,children:(0,W.jsx)(Ge,{accountId:e.account_id,withBorder:!r,badge:e.state===`pending`?(0,W.jsx)(he,{}):null,renderButton:v})},e.id),[v]);return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:J.subheadingWithSelect,children:[(0,W.jsx)(`h3`,{className:J.columnSubheading,tabIndex:-1,ref:a,children:(0,W.jsx)(r,{id:`collections.account_count`,defaultMessage:`{count, plural, one {# account} other {# accounts}}`,values:{count:e.item_count}})}),(0,W.jsxs)(Pe,{label:(0,W.jsx)(r,{id:`collections.sort_by`,defaultMessage:`Sort by:`}),value:f,onChange:m,inputPlacement:`inline-end`,className:J.select,wrapperClassName:J.selectWrapper,children:[(0,W.jsx)(`option`,{value:`alphabetical`,children:(0,W.jsx)(r,{id:`collections.sort_alphabetical`,defaultMessage:`Alphabetical`})}),(0,W.jsx)(`option`,{value:`last_active`,children:(0,W.jsx)(r,{id:`collections.sort_last_active`,defaultMessage:`Last active`})}),(0,W.jsx)(`option`,{value:`most_followers`,children:(0,W.jsx)(r,{id:`collections.sort_most_followers`,defaultMessage:`Most followers`})}),(0,W.jsx)(`option`,{value:`date_added`,children:(0,W.jsx)(r,{id:`collections.sort_date_added`,defaultMessage:`Date added`})})]})]}),(0,W.jsx)(V,{emptyMessage:t.formatMessage(nt.empty),children:(0,W.jsx)(Ze,{visibleItems:g,truncatedItems:_,toggleButton:{icon:Ye,title:(0,W.jsx)(r,{id:`collections.hidden_accounts_link`,defaultMessage:`{count, plural, one {# hidden account} other {# hidden accounts}}`,values:{count:_.length}}),subtitle:(0,W.jsx)(r,{id:`collections.hidden_accounts_description`,defaultMessage:`You’ve blocked or muted {count, plural, one {this user} other {these users}}`,values:{count:_.length}})},renderListItem:y})})]})},ot=t({AuthorNote:()=>ct,CollectionDetailPage:()=>mt,PendingNote:()=>Y}),st=a({loading:{id:`collections.detail.loading`,defaultMessage:`Loading collection…`},share:{id:`collections.detail.share`,defaultMessage:`Share this collection`}}),ct=({id:e})=>{let t=F(e),n=ge(t,s);if(!t)return null;let i=(0,W.jsx)(j,{to:`/@${t.acct}`,"data-hover-card-account":t.id,children:n});return(0,W.jsx)(`p`,{className:J.authorNote,children:(0,W.jsx)(r,{id:`collections.by_account`,defaultMessage:`by {account_handle}`,values:{account_handle:i}})})},lt=({currentUserCollectionItem:e,collection:t})=>{let n=F(t.account_id),i=Xe(t);return(0,W.jsx)(B,{icon:_e,title:(0,W.jsx)(r,{id:`collections.detail.you_are_in_this_collection`,defaultMessage:`You're featured in this collection`}),primaryLabel:(0,W.jsx)(r,{id:`collections.detail.revoke_inclusion`,defaultMessage:`Remove me`}),onPrimary:i,children:(0,W.jsx)(r,{id:`collections.detail.author_added_you_on_date`,defaultMessage:`{author} added you on {date}`,values:{author:(0,W.jsx)(I,{account:n,variant:`simple`}),date:(0,W.jsx)(Oe,{value:e.created_at,day:`2-digit`,month:`short`,year:`numeric`})}})})},Y=()=>(0,W.jsx)(B,{variant:`subtle`,icon:Ue,title:(0,W.jsx)(r,{id:`collections.pending_accounts.title`,defaultMessage:`Why am I seeing pending accounts?`}),children:(0,W.jsx)(r,{id:`collections.pending_accounts.message`,defaultMessage:`Accounts may appear as pen
1ding when we’re awaiting a response from the user or their server. Only you can see pending accounts.`})}),ut=({onReveal:e})=>(0,W.jsx)(B,{variant:`warning`,title:(0,W.jsx)(r,{id:`collections.detail.sensitive_content`,defaultMessage:`Sensitive content`}),primaryLabel:(0,W.jsx)(r,{id:`content_warning.show_short`,defaultMessage:`Show`}),onPrimary:e,className:J.sensitiveScreen,children:(0,W.jsx)(r,{id:`collections.detail.sensitive_note`,defaultMessage:`The description and accounts may not be suitable for all viewers.`})}),dt=({collection:e,withDescription:t,headingRef:n})=>{let r=i(),{name:a,description:o,tag:s,account_id:c,items:l}=e,d=x(),p=_(),m=c===u,h=l.find(e=>e.account_id===u),g=!m&&!!h,v=(0,U.useCallback)(()=>{d(M({modalType:`SHARE_COLLECTION`,modalProps:{collection:e}}))},[e,d]),y=f(),b=y.state?.newCollection;(0,U.useEffect)(()=>{b&&(p.replace(y.pathname),v())},[p,v,b,y.pathname]);let S=l.some(e=>e.state===`pending`);return(0,W.jsxs)(`header`,{className:J.header,children:[(0,W.jsxs)(`div`,{className:J.titleWithMenu,children:[(0,W.jsxs)(`div`,{className:J.titleWrapper,children:[s&&(0,W.jsx)(me,{label:`#${s.name}`,icon:null}),(0,W.jsx)(`h2`,{className:J.name,ref:n,tabIndex:-1,children:a}),(0,W.jsx)(ct,{id:c})]}),(0,W.jsxs)(`div`,{className:J.headerButtonWrapper,children:[(0,W.jsx)(ce,{iconComponent:He,icon:`share-icon`,title:r.formatMessage(st.share),className:J.iconButton,onClick:v}),(0,W.jsx)(Mt,{context:`collection`,collection:e,className:J.iconButton})]})]}),t&&o&&(0,W.jsx)(`p`,{className:J.description,children:o}),S&&(0,W.jsx)(Y,{}),g&&(0,W.jsx)(lt,{currentUserCollectionItem:h,collection:e})]})};function ft({sensitive:e}){let t=(0,U.useRef)(null),[n,r]=(0,U.useState)(!e);return{isContentVisible:n,revealContent:(0,U.useCallback)(()=>{r(!0),setTimeout(()=>{t.current?.focus()},0)},[t]),postRevealFocusTargetRef:t}}var pt=({collection:e})=>{let{isContentVisible:t,revealContent:n,postRevealFocusTargetRef:r}=ft({sensitive:e.sensitive&&e.account_id!==u});return(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(dt,{collection:e,headingRef:r,withDescription:t}),t?(0,W.jsx)(at,{collection:e}):(0,W.jsx)(ut,{onReveal:n})]})},mt=({multiColumn:e})=>{let t=i(),n=x(),{id:r}=m(),a=S(e=>r?e.collections.collections[r]:void 0);(0,U.useEffect)(()=>{r&&n(E({collectionId:r}))},[n,r]);let o=a?.name??t.formatMessage(st.loading);return(0,W.jsxs)(se,{bindToDocument:!e,label:o,children:[(0,W.jsx)(be,{showBackButton:!0,title:o,icon:`collection-icon`,iconComponent:Ce,multiColumn:e}),(0,W.jsx)(De,{children:a?(0,W.jsx)(pt,{collection:a}):(0,W.jsx)(N,{})}),(0,W.jsxs)(A,{children:[(0,W.jsx)(`title`,{children:o}),(0,W.jsx)(`meta`,{name:`robots`,content:`noindex`})]})]})},X={header:`_collections_editor__header`,step:`_collections_editor__step`,title:`_collections_editor__title`,description:`_collections_editor__description`,listHeading:`_collections_editor__listHeading`,form:`_collections_editor__form`,stickyFooter:`_collections_editor__stickyFooter`,formFieldStack:`_collections_editor__formFieldStack`,accountList:`_collections_editor__accountList`,suggestion:`_collections_editor__suggestion`,suggestionGroup:`_collections_editor__suggestionGroup`,maxCollectionsError:`_collections_editor__maxCollectionsError`},ht=({step:e,title:t})=>(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`p`,{className:X.step,children:(0,W.jsx)(r,{id:`collections.create.steps`,defaultMessage:`Step {step}/{total}`,values:{step:e,total:2}})}),(0,W.jsx)(`h2`,{className:X.title,children:t})]}),gt=({accountId:e,pending:t,onRemove:n})=>{let i=(0,U.useCallback)(()=>{n(e)},[e,n]),a=(0,U.useCallback)(()=>(0,W.jsx)(L,{compact:!0,secondary:!0,onClick:i,children:(0,W.jsx)(r,{id:`collections.remove_account`,defaultMessage:`Remove`})}),[i]);return(0,W.jsx)(Ge,{accountId:e,badge:t&&(0,W.jsx)(he,{}),renderButton:a})},_t=({id:e})=>{let t=F(e),n=ge(t,s),r=Ae();return t?(0,W.jsx)(`li`,{...r,className:X.suggestion,children:(0,W.jsx)(z,{icon:(0,W.jsx)(pe,{account:t,size:40}),children:(0,W.jsx)(Ee,{subtitle:n,children:(0,W.jsx)(I,{account:t,variant:`simple`})})})}):null},vt=e=>(0,W.jsx)(_t,{id:e.id});function yt(e,t){let{available:n,mustFollow:r,disabled:i}=Object.groupBy(e,e=>fe(e)?`available`:ue(e)&&!t.get(e.id)?.following?`mustFollow`:`disabled`);return{available:n,mustFollow:r,disabled:i}}var bt=(e,t)=>{if(e===`available`)return null;let n,i;return e===`mustFollow`?(n=(0,W.jsx)(r,{id:`collections.suggestions.must_follow`,defaultMessage:`Must follow first`}),i=(0,W.jsx)(r,{id:`collections.suggestions.must_follow_desc`,defaultMessage:`These accounts review all follow requests. Followers can add them to collections.`})):(n=(0,W.jsx)(r,{id:`collections.suggestions.can_not_add`,defaultMessage:`Can’t be added`}),i=(0,W.jsx)(r,{id:`collections.suggestions.can_not_add_desc`,defaultMessage:`These accounts may have opted out of discovery, or they might be on a server that doesn’t support collections.`})),(0,W.jsx)(`li`,{role:`presentation`,children:(0,W.jsx)(z,{className:X.suggestionGroup,children:(0,W.jsx)(Ee,{id:t,subtitle:i,children:n})})})},xt=e=>e.id,St=e=>!fe(e),Ct=({collection:e})=>{let t=i(),n=x(),a=_(),{id:o,items:s}=e??{},c=!!o,l=S(e=>e.collections.editor.items),u=(0,U.useMemo)(()=>c?te(s):l,[c,s,l]),d=u.some(e=>e.state===`pending`),[f,p]=(0,U.useState)(``),m=u.length>0,h=u.length===25,g=(0,U.useCallback)(e=>!!u.find(t=>t.account_id===e.id),[u]),{accounts:v,isLoading:y,searchAccounts:b,resetAccounts:C}=qe({withRelationships:!0,withDefaultFollows:f===``,filterResults:e=>!g(e)}
1),w=yt(v,S(e=>e.relationships)),ne=(0,U.useCallback)(e=>{p(e.target.value),b(e.target.value)},[b]),T=(0,U.useCallback)(e=>{e.key===`Enter`&&e.preventDefault()},[]),E=(0,U.useCallback)(e=>{n(O({field:`items`,value:u.filter(t=>t.account_id!==e)}))},[u,n]),D=(0,U.useCallback)(e=>{g(e)||n(O({field:`items`,value:[...u,{account_id:e.id,state:e.feature_approval.current_user===`manual`?`pending`:`accepted`}]}))},[u,g,n]),ie=(0,U.useCallback)(e=>{let r=s?.find(t=>t.account_id===e)?.id;r&&o&&window.confirm(t.formatMessage({id:`collections.confirm_account_removal`,defaultMessage:`Are you sure you want to remove this account from this collection?`}))&&n(re({collectionId:o,itemId:r}))},[s,n,o,t]),k=(0,U.useCallback)(e=>{o&&!g(e)&&n(ee({collectionId:o,accountId:e.id}))},[n,o,g]),ae=(0,U.useCallback)(e=>{c?ie(e):E(e)},[c,ie,E]),A=(0,U.useCallback)(e=>{c?k(e):D(e),p(``),C()},[D,k,c,C]),j=(0,U.useCallback)(e=>{e.preventDefault(),o||a.push(`/collections/new/details`)},[o,a]),M=(0,U.useId)(),oe=o?`h2`:`h3`;return(0,W.jsxs)(`form`,{onSubmit:j,className:X.form,children:[(0,W.jsxs)(Ne,{className:X.formFieldStack,children:[(0,W.jsxs)(`header`,{className:X.header,children:[!o&&(0,W.jsx)(ht,{step:1,title:(0,W.jsx)(r,{id:`collections.create.accounts_title`,defaultMessage:`Who will you feature in this collection?`})}),d&&(0,W.jsx)(Y,{}),(0,W.jsx)(Me,{openOnFocus:!0,id:M,label:t.formatMessage({id:`collections.search_accounts_label`,defaultMessage:`Search for an account to add`}),value:h?``:f,onChange:ne,onKeyDown:T,disabled:h,isLoading:y,items:w,getItemId:xt,getIsItemDisabled:St,renderItem:vt,renderGroupTitle:bt,onSelectItem:A,status:h?{variant:`warning`,message:t.formatMessage({id:`collections.search_accounts_max_reached`,defaultMessage:`You have added the maximum number of accounts`})}:null})]}),(0,W.jsxs)(`div`,{children:[m&&(0,W.jsx)(oe,{className:X.listHeading,children:(0,W.jsx)(r,{id:`collections.hints.accounts_counter`,defaultMessage:`{count}/{max} accounts`,values:{count:u.length,max:25}})}),(0,W.jsx)(V,{className:X.accountList,emptyMessage:(0,W.jsx)(R,{title:(0,W.jsx)(r,{id:`collections.accounts.empty_editor_title`,defaultMessage:`No one is in this collection yet`}),message:(0,W.jsx)(r,{id:`collections.accounts.empty_description`,defaultMessage:`Add up to {count} accounts`,values:{count:25}})}),children:u.map(({account_id:e,state:t},n)=>(0,W.jsx)(H,{"aria-posinset":n,"aria-setsize":u.length,children:(0,W.jsx)(gt,{accountId:e,pending:t===`pending`,onRemove:ae})},e))})]})]}),!c&&m&&(0,W.jsx)(`div`,{className:X.stickyFooter,children:(0,W.jsx)(L,{type:`submit`,children:o?(0,W.jsx)(r,{id:`lists.save`,defaultMessage:`Save`}):(0,W.jsx)(r,{id:`collections.continue`,defaultMessage:`Continue`})})})]})},wt=()=>{let e=x(),t=_(),{id:n,name:i,description:a,topic:o,language:s,discoverable:c,sensitive:l,items:u}=S(e=>e.collections.editor),d=(0,U.useCallback)(t=>{e(O({field:`name`,value:t.target.value}))},[e]),f=(0,U.useCallback)(t=>{e(O({field:`description`,value:t.target.value}))},[e]),p=(0,U.useCallback)(t=>{e(O({field:`discoverable`,value:t.target.value===`public`}))},[e]),m=(0,U.useCallback)(t=>{e(O({field:`sensitive`,value:t.target.checked}))},[e]),h=ze(),{acct:g}=F(h)??{},v=(0,U.useCallback)(r=>{if(r.preventDefault(),n)e(C({payload:{id:n,name:i,description:a,tag_name:o||null,language:s||null,discoverable:c,sensitive:l}})).then(()=>{t.goBack()});else{let n={name:i,description:a,discoverable:c,sensitive:l,account_ids:u.map(e=>e.account_id)};s&&(n.language=s),o&&(n.tag_name=o),e(ie({payload:n})).then(e=>{y(e)&&(t.replace(`/@${g}/collections`),t.push(de(e.payload.collection.id),{newCollection:!0}
1))})}},[n,i,a,o,c,s,l,e,t,u,g]);return(0,W.jsxs)(`form`,{onSubmit:v,className:X.form,children:[(0,W.jsxs)(Ne,{className:X.formFieldStack,children:[!n&&(0,W.jsx)(ht,{step:2,title:(0,W.jsx)(r,{id:`collections.create.basic_details_title`,defaultMessage:`Basic details`})}),(0,W.jsx)(Re,{required:!0,label:(0,W.jsx)(r,{id:`collections.collection_name`,defaultMessage:`Name`}),hint:(0,W.jsx)(r,{id:`collections.name_length_hint`,defaultMessage:`40 characters limit`}),value:i,onChange:d,maxLength:40}),(0,W.jsx)(Fe,{required:!1,label:(0,W.jsx)(r,{id:`collections.collection_description`,defaultMessage:`Description`}),hint:(0,W.jsx)(r,{id:`collections.description_length_hint`,defaultMessage:`100 characters limit`}),value:a,onChange:f,maxLength:100}),(0,W.jsx)(Tt,{}),(0,W.jsx)(Dt,{}),(0,W.jsxs)(ke,{legend:(0,W.jsx)(r,{id:`collections.visibility_title`,defaultMessage:`Visibility`}),children:[(0,W.jsx)(Ie,{label:(0,W.jsx)(r,{id:`collections.visibility_public`,defaultMessage:`Public`}),hint:(0,W.jsx)(r,{id:`collections.visibility_public_hint`,defaultMessage:`Discoverable in search results and other areas where recommendations appear.`}),value:`public`,checked:c,onChange:p}),(0,W.jsx)(Ie,{label:(0,W.jsx)(r,{id:`collections.visibility_unlisted`,defaultMessage:`Unlisted`}),hint:(0,W.jsx)(r,{id:`collections.visibility_unlisted_hint`,defaultMessage:`Visible to anyone with a link. Hidden from search results and recommendations.`}),value:`unlisted`,checked:!c,onChange:p})]}),(0,W.jsx)(ke,{legend:(0,W.jsx)(r,{id:`collections.content_warning`,defaultMessage:`Content warning`}),children:(0,W.jsx)(je,{label:(0,W.jsx)(r,{id:`collections.mark_as_sensitive`,defaultMessage:`Mark as sensitive`}),hint:(0,W.jsx)(r,{id:`collections.mark_as_sensitive_hint`,defaultMessage:`Hides the collection's description and accounts behind a content warning. The collection name will still be visible.`}),checked:l,onChange:m})})]}),(0,W.jsx)(`div`,{className:X.stickyFooter,children:(0,W.jsx)(L,{type:`submit`,children:n?(0,W.jsx)(r,{id:`lists.save`,defaultMessage:`Save`}):(0,W.jsx)(r,{id:`collections.create_collection`,defaultMessage:`Create collection`})})})]})},Tt=()=>{let e=i(),t=x(),{topic:n}=S(e=>e.collections.editor),{tags:a,isLoading:o,searchTags:s}=Ve({query:n}),c=(0,U.useCallback)(e=>{t(O({field:`topic`,value:T(e.target.value)})),s(e.target.value)},[t,s]),l=(0,U.useCallback)(e=>{t(O({field:`topic`,value:T(e.name)}))},[t]),u=(0,U.useMemo)(()=>ne(n),[n]),d=a.length===1&&a[0]?.id===`new`,f=!a.length||d;return(0,W.jsx)(Me,{required:!1,icon:null,label:(0,W.jsx)(r,{id:`collections.collection_topic`,defaultMessage:`Topic`}),hint:(0,W.jsx)(r,{id:`collections.topic_hint`,defaultMessage:`Add a hashtag that helps others understand the main topic of this collection.`}),value:n,items:a,isLoading:o,renderItem:Et,onSelectItem:l,onChange:c,autoCapitalize:`off`,autoCorrect:`off`,spellCheck:`false`,maxLength:40,status:u?{variant:`warning`,message:e.formatMessage({id:`collections.topic_special_chars_hint`,defaultMessage:`Special characters will be removed when saving`})}:void 0,suppressMenu:f})},Et=e=>(0,W.jsx)(Le,{children:e.label??`#${e.name}`}),Dt=()=>{let e=x(),{language:t}=S(e=>e.collections.editor),n=(0,U.useCallback)(t=>{e(O({field:`language`,value:t.target.value}))},[e]);return(0,W.jsxs)(Pe,{label:(0,W.jsx)(r,{id:`collections.collection_language`,defaultMessage:`Language`}),value:t,onChange:n,children:[(0,W.jsx)(`option`,{value:``,children:(0,W.jsx)(r,{id:`collections.collection_language_none`,defaultMessage:`None`})}),c?.map(([e,t,n])=>(0,W.jsxs)(`option`,{value:e,children:[n,` (`,t,`)`]},e))]})},Ot=t({CollectionEditorPage:()=>At,MaxCollectionsCallout:()=>jt,messages:()=>Z,userCollectionLimit:()=>Q}),Z=a({create:{id:`collections.create_collection`,defaultMessage:`Create collection`},newCollection:{id:`collections.new_collection`,defaultMessage:`New collection`},editDetails:{id:`collections.edit_details`,defaultMessage:`Edit details`},manageAccounts:{id:`collections.manage_accounts`,defaultMessage:`Manage accounts`}});function kt(e){let{path:t}=v(),n=f();if(!e)return Z.newCollection;if(g(n.pathname,{path:t,exact:!0}))return Z.manageAccounts;if(g(n.pathname,{path:`${t}/details`}))return Z.editDetails;throw Error(`No page title defined for route`)}var Q=l?.role?.collection_limit??0,At=({multiColumn:e})=>{let t=i(),n=x(),{accountId:r,signedIn:a}=le(),{id:o=null}=m(),{path:s}=v(),c=S(e=>o?e.collections.collections[o]:void 0),l=S(e=>e.collections.editor.id),u=!!o,{collections:d,status:f}=q(u?null:r),g=u&&!c||!u&&f===`loading`,_=a&&(u||d.length<Q);(0,U.useEffect)(()=>{o&&a&&n(E({collectionId:o}))},[n,o,a]),(0,U.useEffect)(()=>{o!==l&&n(w.reset())},[n,l,o]),(0,U.useEffect)(()=>{c&&n(w.init(c))},[n,c]);let y=t.formatMessage(kt(o));return(0,W.jsxs)(se,{bindToDocument:!e,label:y,children:[(0,W.jsx)(be,{title:y,icon:`list-ul`,iconComponent:Ce,multiColumn:e,showBackButton:!0}),(0,W.jsx)(`div`,{className:`scrollable`,children:g?(0,W.jsx)(N,{}):a?_?(0,W.jsxs)(p,{children:[(0,W.jsx)(h,{exact:!0,path:s,render:()=>(0,W.jsx)(Ct,{collection:c})}),(0,W.jsx)(h,{exact:!0,path:`${s}/details`,render:()=>(0,W.jsx)(wt,{})})]}):(0,W.jsx)(jt,{className:X.maxCollectionsError}):(0,W.jsx)(Ke,{})}),(0,W.jsxs)(A,{children:[(0,W.jsx)(`title`,{children:y}),(0,W.jsx)(`meta`,{name:`robots`,content:`noindex`})]})]})},jt=({className:e})=>(0,W.jsx)(B,{className:e,title:(0,W.jsx)(r,{id:`collections.maximum_collection_count_reached`,defaultMessage:`You have created the maximum number of collections`}),children:(0,W.jsx)(r,{id:`collections.maximum_collection_count_description`,defaultMessage:`Your server allows creation of up to {count} collections.`,values:{count:Q}})}),$=a({view:{id:`collections.view_collection`,defaultMessage:`View collection`},share:{id:`collections.share_short`,defaultMessage:`Share`},copyLink:{id:`collections.copy_link`,defaultMessage:`Copy link`},copyLinkConfirmation:{id:`collections.copy_link_confirmation`,defaultMessage:`Copied collection link to clipboard`},delete:{id:`collections.delete_collection`,defaultMessage:`Delete collection`},report:{id:`collections.report_collection`,defaultMessage:`Report this collection`},blockOwner:{id:`collections.block_collection_owner`,defaultMessage:`Block account`},revoke:{id:`collections.revoke_collection_inclusion`,defaultMessage:`Remove myself from this collection`},more:{id:`status.more`,defaultMessage:`More`}}),Mt=({collection:e,context:t,className:n})=>{let r=x(),a=i(),{id:o,name:s,account_id:c,items:l}=e,f=F(c),p=c===u,m=l.find(e=>e.account_id===u),h=(0,U.useCallback)(()=>{r(M({modalType:`SHARE_COLLECTION`,modalProps:{collection:e}}))},[e,r]),g=(0,U.useCallback)(()=>{r(M({modalType:`CONFIRM_DELETE_COLLECTION`,modalProps:{name:s,id:o}}))},[r,o,s]),_=(0,U.useCallback)(()=>{r(M({modalType:`REPORT_COLLECTION`,modalProps:{collection:e}}))},[e,r]),v=(0,U.useCallback)(()=>{r(d(f))},[f,r]),y=(0,U.useCallback)(()=>{r(M({modalType:`REVOKE_COLLECTION_INCLUSION`,modalProps:{collectionId:e.id,collectionItemId:m?.id}}))},[e.id,m?.id,r]),b=(0,U.useMemo)(()=>{let n={text:a.formatMessage($.view),to:de(o)},i=[{text:a.formatMessage($.share),action:h},{text:a.formatMessage($.copyLink),action:()=>{navigator.clipboard.writeText(e.url),r(ae({message:$.copyLinkConfirmation}))}}];if(p){let e=[...i,null,{text:a.formatMessage(Z.manageAccounts),to:`/collections/${o}/edit`},{text:a.formatMessage(Z.editDetails),to:`/collections/${o}/edit/details`},null,{text:a.formatMessage($.delete),action:g,dangerous:!0}];return t===`list`?[n,...e]:e}{let e=[...i,null];return m&&t!==`notifications`&&e.push({text:a.formatMessage($.revoke),action:y}),e.push({text:a.formatMessage($.report),action:_}),m&&e.push({text:a.formatMessage($.blockOwner),action:v}),t===`collection`?e:[n,...e]}},[a,o,h,p,e.url,r,g,t,m,_,y,v]);return(0,W.jsx)(ve,{scrollKey:`collections`,items:b,children:(0,W.jsx)(ce,{icon:`menu-icon`,iconComponent:Qe,title:a.formatMessage($.more),className:n})})},Nt={wrapper:`_collections_components_collection_list_item__wrapper`,wrapperW
1ithoutBorder:`_collections_components_collection_list_item__wrapperWithoutBorder`,menuButton:`_collections_components_collection_list_item__menuButton`},Pt=({collection:e,withoutBorder:t,positionInList:n,listSize:r,className:i,...a})=>{let o=(0,U.useId)(),s=`${o}-title`,c=`${o}-info`;return(0,W.jsx)(H,{focusable:!0,"aria-labelledby":s,"aria-describedby":c,"aria-posinset":n,"aria-setsize":r,children:(0,W.jsx)(Te,{collection:e,className:(0,$e.default)(Nt.wrapper,t&&Nt.wrapperWithoutBorder,i),sideContent:(0,W.jsx)(Mt,{context:`list`,collection:e,className:Nt.menuButton}),titleId:s,subtitleId:c,...a})})};export{et as a,q as c,ot as i,G as l,Mt as n,tt as o,Ot as r,K as s,Pt as t,Ze as u};
2//# sourceMappingURL=collection_list_item-CSFDXV-y.js.map

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