1import{o as e}from"./chunk-CMxvf4Kt.js";import{n as t,t as n}from"./jsx-runtime-SsSjplwM.js";import{a as r,c as i,s as a}from"./react-intl-Cop388b4.js";import{Q as o,nt as s,rt as c}from"./poll-GhgBJIBe.js";import"./render-iwa9xCPR.js";import{D as l,E as u,L as d}from"./accounts_typed-Bx70RYtH.js";import{o as f,s as p}from"./typed_functions-CyAHd4bl.js";import{f as m,mn as h,o as g,s as _,u as v}from"./status_quoted-D8K2gmDl.js";import{n as y}from"./bundle_column_error-H0oiaHiJ.js";import"./form_fields-BcGAtnOm.js";import{t as b}from"./toggle_field-C4785iUx.js";import{n as x}from"./useAccountId-DgjPO0Nn.js";import{c as S,s as C}from"./collection_list_item-C0g7kCDx.js";var w=e(t()),T={wrapper:`_feat_collection_adder_collection_toggle__wrapper`},E=n(),D=({collection:e,checked:t,disabled:n,subtitle:r,onChange:i})=>{let a=(0,w.useId)(),o=`${a}-toggle`,s=`${a}-info`;return(0,E.jsx)(m,{className:T.wrapper,icon:(0,E.jsx)(g,{accountIds:e.items.map(e=>e.account_id),sensitive:e.sensitive}),sideContent:(0,E.jsx)(b,{id:o,checked:t,disabled:n,onChange:i,"aria-describedby":s}),children:(0,E.jsx)(v,{as:`label`,htmlFor:o,subtitle:r??(0,E.jsx)(_,{collection:e,withTimestamp:!1,withAuthorHandle:!1}),children:e.name})})},O={newCollection:`_feat_collection_adder__newCollection`},k=a({close:{id:`lightbox.close`,defaultMessage:`Close`}}),A=({collection:e,account:t})=>{let n=f(),[i,a]=(0,w.useState)(!1),o=e.items.find(e=>e.account_id===t.id),s=!!o,c=(0,w.useCallback)(async r=>{a(!0),r?await n(u({collectionId:e.id,accountId:t.id})):o&&await n(d({collectionId:e.id,itemId:o.id})),a(!1)},[t.id,e.id,o,n]),l=(0,w.useCallback)(e=>{c(e.target.checked)},[c]),p=!s&&e.item_count>=25;return(0,E.jsx)(D,{collection:e,disabled:i||p,subtitle:p?(0,E.jsx)(r,{id:`collections.search_accounts_max_reached`,defaultMessage:`You have added the maximum number of accounts`}):null,checked:s,onChange:l},e.id)},j=({accountId:e,onClose:t})=>{let n=i(),a=(0,w.useId)(),u=p(t=>t.accounts.get(e)),{collections:d,status:m}=S(x()),g=f(),_=(0,w.useCallback)(()=>{u&&g(l.reset({account_id:u.id,state:u.feature_approval.current_user===`manual`?`pending`:`accepted`})),t()},[u,g,t]);return(0,E.jsxs)(`div`,{className:`modal-root__modal dialog-modal`,children:[(0,E.jsxs)(`div`,{className:`dialog-modal__header`,children:[(0,E.jsx)(o,{className:`dialog-modal__header__close`,title:n.formatMessage(k.close),icon:`times`,iconComponent:c,onClick:t}),(0,E.jsx)(h,{as:`h1`,id:a,className:`dialog-modal__header__title`,children:(0,E.jsx)(r,{id:`collections.add_to_collection`,defaultMessage:`Add {name} to collections`,values:{name:(0,E.jsxs)(`strong`,{children:[`@`,u?.acct]})}})})]}),(0,E.jsx)(`div`,{className:`dialog-modal__content`,children:(0,E.jsx)(`div`,{className:`lists-scrollable`,role:`group`,"aria-labelledby":a,children:m===`loading`||!u?(0,E.jsx)(s,{}):d.length===0?(0,E.jsx)(y,{title:(0,E.jsx)(r,{id:`empty_column.collections_self`,defaultMessage:`You have not created any collections yet.`}),message:(0,E.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,E.jsx)(C,{compact:!0,onClick:_})}):(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(`div`,{className:O.newCollection,children:(0,E.jsx)(C,{secondary:!0,onClick:_,children:(0,E.jsx)(r,{id:`collections.create_new_collection`,defaultMessage:`Create new collection`})})}),d.map(e=>(0,E.jsx)(A,{collection:e,account:u},e.id))]})})})]})};export{j as CollectionAdder}; 2//# sourceMappingURL=collection_adder-BDATPuro.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.