import{d as e}from"./objectSpread2-DtFdQpqy.js";import{a as t,n}from"./preload-helper-EQ20WQt-.js";import{F as r,c as i,l as a,o}from"./prop-types-DdDwMzX7.js";import{ct as s,pt as c}from"./poll-BqfIhRzt.js";import{Eo as l,di as u,ei as d}from"./time-BE5vfriQ.js";import{c as f}from"./react-router-OpaHPRhD.js";import{a as p,un as m}from"./status_quoted-BBEee1ee.js";import{D as h,O as g,k as _}from"./compose_form_container-1C-FOHvv.js";import{s as v}from"./form_fields-TsXsMi17.js";var y=e(t()),b={heading:`_collections_components_share_modal__heading`,preview:`_collections_components_share_modal__preview`,actions:`_collections_components_share_modal__actions`,shareButtonWrapper:`_collections_components_share_modal__shareButtonWrapper`,closeButtonDesktop:`_collections_components_share_modal__closeButtonDesktop`,closeButtonMobile:`_collections_components_share_modal__closeButtonMobile`},x=n(),S=i({shareTextOwn:{id:`collection.share_template_own`,defaultMessage:`Check out my new collection: {link}`},shareTextOther:{id:`collection.share_template_other`,defaultMessage:`Check out this cool collection: {link}`}}),C=({collection:e,onClose:t})=>{var n;let i=a(),C=l(),w=!!((n=f().state)!=null&&n.newCollection),T=e.account_id===r,E=e.url,D=(0,y.useCallback)(()=>{navigator.share({url:E})},[E]),O=(0,y.useCallback)(()=>{let e=T?i.formatMessage(S.shareTextOwn,{link:E}):i.formatMessage(S.shareTextOther,{link:E});t(),C(d(e)),C(u())},[t,E,C,i,T]);return(0,x.jsxs)(h,{children:[(0,x.jsxs)(_,{children:[(0,x.jsx)(`h1`,{className:b.heading,children:w?(0,x.jsx)(o,{id:`collection.share_modal.title_new`,defaultMessage:`Share your new collection!`}):(0,x.jsx)(o,{id:`collection.share_modal.title`,defaultMessage:`Share collection`})}),(0,x.jsx)(s,{title:i.formatMessage({id:`lightbox.close`,defaultMessage:`Close`}),iconComponent:c,icon:`close`,className:b.closeButtonDesktop,onClick:t}),(0,x.jsx)(`div`,{className:b.preview,children:(0,x.jsx)(p,{collection:e})}),(0,x.jsx)(v,{label:i.formatMessage({id:`collection.share_modal.share_link_label`,defaultMessage:`Share link`}),value:E})]}),(0,x.jsxs)(g,{className:b.actions,children:[(0,x.jsxs)(`div`,{className:b.shareButtonWrapper,children:[(0,x.jsx)(m,{secondary:!0,onClick:O,children:(0,x.jsx)(o,{id:`collection.share_modal.share_via_post`,defaultMessage:`Post on Mastodon`})}),`share`in navigator&&(0,x.jsx)(m,{secondary:!0,onClick:D,children:(0,x.jsx)(o,{id:`collection.share_modal.share_via_system`,defaultMessage:`Share to…`})})]}),(0,x.jsx)(m,{plain:!0,onClick:t,className:b.closeButtonMobile,children:(0,x.jsx)(o,{id:`lightbox.close`,defaultMessage:`Close`})})]})]})};export{C as CollectionShareModal};
//# sourceMappingURL=share_modal-kmNUMPYi.js.map