1var De=Object.defineProperty;var $e=(t,s,o)=>s in t?De(t,s,{enumerable:!0,configurable:!0,writable:!0,value:o}):t[s]=o;var S=(t,s,o)=>$e(t,typeof s!="symbol"?s+"":s,o);import{j as e,_ as le}from"./client-By3tlFYA.js";import{u as x,r as n,a as v,m as re}from"./index-TEHZzOO_.js";import{a as j,u as T,a2 as Ue,j as Y,a3 as Be,a4 as Qe,a5 as W,O as xe,a6 as Ve,a7 as He,a8 as We,L as ve,c as Ge,a9 as de,e as ce,V as Me,b as Ce,aa as Ye,ab as Ke,ac as Z,ad as me,ae as Ze,af as ze,ag as Xe,ah as Je,ai as et,aj as ye,ak as tt,al as st,am as je,an as ot,ao as at,ap as ue,aq as G,ar as it,I as we,S as Ne,p as nt,q as ge,N as Te}from"./useSelectableClick-Cq4F1LF_.js";import{A as lt}from"./index-8Z9-EDVU.js";import{H as rt}from"./Helmet-BG0DmkIY.js";import{G as dt,g as ke,F as Ie,Z as ct,M as mt,a as ut}from"./media_modal-CtCARMmF.js";import{c as P}from"./index-DkCxcZFY.js";import{i as gt}from"./react-textarea-autosize.browser.esm-CJKL8aJv.js";import{d as ft,a as pt,P as _t,b as k,m as A,c as ht}from"./compose_form_container-CPATpxpz.js";import{z as bt,I as xt,J as q,U as vt,V as Mt,W as Ct,X as yt,Y as jt,Z as wt,_ as Nt,$ as Tt,a0 as kt,a1 as It,a2 as Et,a3 as Pt,a4 as Rt,a5 as St,a6 as At,a7 as qt,a8 as Ot}from"./status_quoted-BJgM-MqS.js";import{S as z}from"./skeleton-CwYXpOUk.js";import{b as Ft}from"./relative_timestamp-BOUL06oe.js";import{M as u}from"./message-CVkQtbZv.js";import{L as Lt,c as Dt,P as F}from"./short_number-C9zm8Jg6.js";import{E as $t}from"./embedded_status-COTVMusb.js";import{a as Ut}from"./api-BXxZZSWv.js";import{G as Bt}from"./gif-PNfR50S5.js";import{S as Qt}from"./unfold_more-Dg1Ay52N.js";import{D as Vt}from"./dropdown_selector-DDyJwCGB.js";const X=(t,s,o)=>typeof s=="object"?t.formatMessage(s,o):s,Ht=({alert:{key:t,title:s,message:o,values:a,action:i,onClick:l},dismissAfter:c})=>{const r=T(),d=x(),[m,M]=n.useState(!1);return n.useEffect(()=>{const g=setTimeout(()=>{M(!0)},1);return()=>{clearTimeout(g)}},[]),n.useEffect(()=>{const g=setTimeout(()=>{M(!1),setTimeout(()=>{r(Ue({key:t}))},500)},c);return()=>{clearTimeout(g)}},[r,M,t,c]),e.jsx(lt,{isActive:m,title:s?X(d,s,a):void 0,message:X(d,o,a),action:i?X(d,i,a):void 0,onActionClick:l})},co=()=>{const t=j(s=>s.alerts);return t.length===0?null:e.jsx("div",{className:"notification-list",children:t.map((s,o)=>e.jsx(Ht,{alert:s,dismissAfter:5e3+o*1e3},s.key))})},Wt="BUNDLE_FETCH_REQUEST",Gt="BUNDLE_FETCH_SUCCESS",Yt="BUNDLE_FETCH_FAIL";function Kt(t){return{type:Wt,skipLoading:t}}function Zt(t){return{type:Gt,skipLoading:t}}function zt(t,s){return{type:Yt,error:t,skipLoading:s}}const Xt=t=>({onFetch(){t(Kt())},onFetchSuccess(){t(Zt())},onFetchFail(s){t(zt(s))}}),Jt=Y(null,Xt)(bt),es=(t,s)=>({loading:t.get("loadingBar")[s.scope||"default"]}),mo=Y(es)(Be.WrappedComponent),ts=t=>n.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",height:24,viewBox:"0 -960 960 960",width:24,...t},n.createElement("path",{d:"M424-320q0-81 14.5-116.5T500-514q41-36 62.5-62.5T584-637q0-41-27.5-68T480-732q-51 0-77.5 31T365-638l-103-44q21-64 77-111t141-47q105 0 161.5 58.5T698-641q0 50-21.5 85.5T609-475q-49 47-59.5 71.5T539-320H424Zm56 240q-33 0-56.5-23.5T400-160q0-33 23.5-56.5T480-240q33 0 56.5 23.5T560-160q0 33-23.5 56.5T480-80Z"})),ss=v({help:{id:"info_button.label",defaultMessage:"Help"}}),os=()=>{const t=x(),[s,o]=n.useState(!1),a=n.useRef(null),i=n.useId(),l=n.useCallback(()=>{o(!s)},[s,o]),[c,r]=Qe(l);return e.jsxs(e.Fragment,{children:[e.jsx("button",{type:"button",className:P("help-button",{active:s}),ref:a,onClick:l,"aria-expanded":s,"aria-controls":i,"aria-label":t.formatMessage(ss.help),children:e.jsx(W,{id:"",icon:ts})}),e.jsx(xe,{show:s,rootClose:!0,placement:"top",onHide:l,offset:[5,5],target:a,children:({props:d})=>e.jsx("div",{...d,className:"dialog-modal__popout prose dropdown-animation",role:"region",id:i,onMouseDown:c,onMouseUp:r,children:e.jsx(u,{id:"info_button.what_is_alt_text",defaultMessage:"<h1>What is alt text?</h1>\n\n <p>Alt text provides image descriptions for people with vision impairments, low-bandwidth connections, or those seeking extra context.</p>\n\n <p>You can improve accessibility and understanding for everyone by writing clear, concise, and objective alt text.</p>\n\n <ul>\n <li>Capture important elements</li>\n <li>Summarize text in images</li>\n <li>Use regular sentence structure</li>\n <li>Avoid redundant information</li>\n <li>Focus on trends and key findings in complex visuals (like diagrams or maps)</li>\n </ul>",values:{h1:m=>e.jsx("h1",{children:m}),p:m=>e.jsx("p",{children:m}),ul:m=>e.jsx("ul",{children:m}),li:m=>e.jsx("li",{children:m})}})})})]})},B=v({placeholderVisual:{id:"alt_text_modal.describe_for_people_with_visual_impairments",defaultMessage:"Describe this for people with visual impairmentsâ¦"},placeholderHearing:{id:"alt_text_modal.describe_for_people_with_hearing_impairments",defaultMessage:"Describe this for people with hearing impairmentsâ¦"}
1,discardMessage:{id:"confirmations.discard_edit_media.message",defaultMessage:"You have unsaved changes to the media description or preview, discard them anyway?"},discardConfirm:{id:"confirmations.discard_edit_media.confirm",defaultMessage:"Discard"}}),fe=1500,as=({children:t,onSelectFile:s,mimeTypes:o})=>{const a=n.useRef(null),i=n.useCallback(()=>{var c;(c=a.current)==null||c.click()},[]),l=n.useCallback(c=>{var d;const r=(d=c.target.files)==null?void 0:d[0];r&&s(r)},[s]);return e.jsxs("label",{children:[e.jsx(q,{onClick:i,children:t}),e.jsx("input",{id:"upload-modal__thumbnail",ref:a,type:"file",accept:o,onChange:l,style:{display:"none"}})]})},is=({mediaId:t,position:s,onPositionChange:o})=>{var N;const a=n.useRef(!1),i=n.useRef(null),[l,c]=s,r=Ge({to:{left:"".concat(l*100,"%"),top:"".concat(c*100,"%")},immediate:a.current}),d=j(h=>h.compose.get("media_attachments").find(w=>w.get("id")===t)),m=j(h=>re?h.accounts.get(re):void 0),[M,g]=n.useState(!1),b=n.useCallback(h=>{i.current=h},[]),f=n.useCallback(h=>{if(h.button!==0)return;const w=_=>{const{x:y,y:O}=de(i.current,_);a.current=!0,o([y,O])},R=()=>{g(!1),a.current=!1,document.removeEventListener("mouseup",R),document.removeEventListener("mousemove",w)},{x:I,y:E}=de(i.current,h.nativeEvent);g(!0),o([I,E]),document.addEventListener("mouseup",R),document.addEventListener("mousemove",w)},[g,o]);return d?d.get("type")==="image"?e.jsxs("div",{className:P("focal-point",{dragging:M}),children:[e.jsx("img",{ref:b,draggable:!1,src:d.get("url"),alt:"",role:"presentation",onMouseDown:f}),e.jsx(ce.div,{className:"focal-point__reticle",style:r})]}):d.get("type")==="gifv"?e.jsxs("div",{className:P("focal-point",{dragging:M}),children:[e.jsx(dt,{ref:b,src:d.get("url"),alt:"",onMouseDown:f}),e.jsx(ce.div,{className:"focal-point__reticle",style:r})]}):d.get("type")==="video"?e.jsx(Me,{preview:d.get("preview_url"),frameRate:d.getIn(["meta","original","frame_rate"]),aspectRatio:"".concat(d.getIn(["meta","original","width"])," / ").concat(d.getIn(["meta","original","height"])),blurhash:d.get("blurhash"),src:d.get("url"),detailed:!0,editable:!0}):d.get("type")==="audio"?e.jsx(Ce,{src:d.get("url"),poster:(N=d.get("preview_url"))!=null?N:m==null?void 0:m.avatar_static,duration:d.getIn(["meta","original","duration"],0),backgroundColor:d.getIn(["meta","colors","background"]),foregroundColor:d.getIn(["meta","colors","foreground"]),accentColor:d.getIn(["meta","colors","accent"]),editable:!0}):null:null},Ee=n.forwardRef(({mediaId:t,previousDescription:s,previousPosition:o,onClose:a},i)=>{var oe,ae,ie;const l=x(),c=T(),r=j(C=>C.compose.get("media_attachments").find(K=>K.get("id")===t)),d=j(C=>C.compose.get("language")),m=(oe=r==null?void 0:r.getIn(["meta","focus","x"],0))!=null?oe:0,M=(ae=r==null?void 0:r.getIn(["meta","focus","y"],0))!=null?ae:0,[g,b]=n.useState((ie=s!=null?s:r==null?void 0:r.get("description"))!=null?ie:""),[f,N]=n.useState(o!=null?o:[m/2+.5,M/-2+.5]),[h,w]=n.useState(!1),[R,I]=n.useState(!1),E=n.useRef(!!(s||o)),_=r==null?void 0:r.get("type"),y=ft.length(g)<=fe,O=n.useCallback(C=>{b(C.target.value),E.current=!0},[b]),D=n.useCallback(C=>{c(Ve(t,C))},[c,t]),$=n.useCallback(C=>{N(C),E.current=!0},[N]),p=n.useCallback(()=>{I(!0),c(He({id:t,description:g,focus:"".concat(((f[0]-.5)*2).toFixed(2),",").concat(((f[1]-.5)*-2).toFixed(2))})).then(()=>(I(!1),E.current=!1,a(),"")).catch(C=>{I(!1),c(We(C))})},[c,I,t,a,f,g]),U=n.useCallback(C=>{(C.ctrlKey||C.metaKey)&&C.key==="Enter"&&(C.preventDefault(),y&&p())},[p,y]),qe=n.useCallback(()=>{w(!0),xt().then(async({createWorker:C})=>{const[K,Oe]=await Promise.all([le(()=>import("./worker.min-Cr_xUblA.js"),[],import.meta.url),le(()=>import("./tesseract-core.wasm-BWBIb_0i.js"),[],import.meta.url)]),ne=await C("eng",1,{workerPath:K.default,corePath:Oe.default,langPath:"".concat(Ft,"/ocr/lang-data"),cacheMethod:"write"}),Fe=URL.createObjectURL(r==null?void 0:r.get("file")),Le=await ne.recognize(Fe);return b(Le.data.text),w(!1),await ne.terminate(),""}).catch(()=>{w(!1)})},[b,w,r]);return n.useImperativeHandle(i,()=>({getCloseConfirmationMessage:()=>E.current?{message:l.formatMessage(B.discardMessage),confirm:l.formatMessage(B.discardConfirm),props:{previousDescription:g,previousPosition:f}}:null}),[l,g,f]),e.jsxs("div",{className:"modal-root__modal dialog-modal",children:[e.jsxs("div",{className:"dialog-modal__header",children:[e.jsx(q,{onClick:p,disabled:!y,children:R?e.jsx(ve,{}):e.jsx(u,{id:"alt_text_modal.done",defaultMessage:"Done"})}),e.jsx("span",{className:"dialog-modal__header__title",children:e.jsx(u,{id:"alt_text_modal.add_alt_text",defaultMessage:"Add alt text"})}),e.jsx(q,{secondary:!0,onClick:a,children:e.jsx(u,{id:"alt_text_modal.cancel",defaultMessage:"Cancel"})})]}),e.jsxs("div",{className:"dialog-modal__content",children:[e.jsxs("div",{className:"dialog-modal__content__preview",children:[e.jsx(is,{mediaId:t,position:f,onPositionChange:$}),(_==="audio"||_==="video")&&e.jsx(as,{onSelectFile:D,mimeTypes:"image/jpeg,image/png,image/gif,image/heic,image/heif,image/webp,image/avif",children:e.jsx(u,{id:"alt_text_modal.change_thumbnail",defaultMessage:"Change thumbnail"})})]}),e.jsx("form",{className:"dialog-modal__content__form simple_form",onSubmit:p,children:e.jsxs("div",{className:"input",children:[e.jsxs("div",{className:"label_input",children:[e.jsx(gt,{id:"description",value:h?" ":g,onChange:O,onKeyDown:U,lang:d,placeholder:l.formatMessage(_==="audio"?B.placeholderHearing:B.placeholderVisual),minRows:3,disabled:h}),h&&e.jsxs("div",{className:"label_input__loading-indicator",children:[e.jsx(z,{width:"100%"}),e.jsx(z,{width:"100%"}),e.jsx(z,{width:"61%"})]})]}),e.jsxs("div",{className:"input__toolbar",children:[e.jsx(pt,{max:fe,text:h?"":g}),e.jsx("div",{className:"spacer"}),e.jsx("button",{className:"link-button",onClick:qe,disabled:_!=="image"||h,children:e.jsx(u,{id:"alt_text_modal.add_text_from_image",defaultMessage:"Add text from image"})}),e.jsx(os,{})]})]})})]})]})});
1Ee.displayName="AltTextModal";const ns=({actions:t,onClick:s})=>e.jsx("div",{className:"modal-root__modal actions-modal",children:e.jsx("ul",{children:t.map((o,a)=>{var m;if(o===null)return e.jsx("li",{className:"dropdown-menu__separator"},"sep-".concat(a));const{text:i,highlighted:l,disabled:c,dangerous:r}=o;let d;return Ye(o)?d=e.jsx("button",{onClick:s,"data-index":a,disabled:c,children:e.jsx(Z,{item:o})}):Ke(o)?d=e.jsx("a",{href:o.href,target:(m=o.target)!=null?m:"_target","data-method":o.method,rel:"noopener",onClick:s,"data-index":a,children:e.jsx(Z,{item:o})}):d=e.jsx(Lt,{to:o.to,onClick:s,"data-index":a,children:e.jsx(Z,{item:o})}),e.jsx("li",{className:P("dropdown-menu__item",{"dropdown-menu__item--dangerous":r,"dropdown-menu__item--highlighted":l}),children:d},"".concat(i,"-").concat(a))})})}),ls=({media:t,statusId:s,options:o,onClose:a,onChangeBackgroundColor:i})=>{var M,g,b;const l=j(f=>f.statuses.get(s)),c=l==null?void 0:l.get("account"),r=j(f=>{var N;return c?(N=f.accounts.get(c))==null?void 0:N.avatar_static:void 0});n.useEffect(()=>{const f=ke(t.get("blurhash"));return i(f!=null?f:{r:255,g:255,b:255}),()=>{i(null)}},[t,i]);const d=(M=l==null?void 0:l.getIn(["translation","language"]))!=null?M:l==null?void 0:l.get("language"),m=(g=t.getIn(["translation","description"]))!=null?g:t.get("description");return e.jsxs("div",{className:"modal-root__modal audio-modal",children:[e.jsx("div",{className:"audio-modal__container",children:e.jsx(Ce,{src:t.get("url"),alt:m,lang:d,poster:(b=t.get("preview_url"))!=null?b:r,duration:t.getIn(["meta","original","duration"],0),backgroundColor:t.getIn(["meta","colors","background"]),foregroundColor:t.getIn(["meta","colors","foreground"]),accentColor:t.getIn(["meta","colors","accent"]),startPlaying:o.autoPlay})}),e.jsx("div",{className:"media-modal__overlay",children:l&&e.jsx(Ie,{statusId:l.get("id"),withOpenButton:!0,onClose:a})})]})},pe=v({cancel_reblog:{id:"status.cancel_reblog_private",defaultMessage:"Unboost"},reblog:{id:"status.reblog",defaultMessage:"Boost"}}),rs=({status:t,onReblog:s,onClose:o})=>{const a=x(),i=j(f=>f.compose.get("default_privacy")),l=t.get("id"),c=t.get("visibility"),[r,d]=n.useState(c==="private"?"private":i),m=n.useCallback(f=>{d(f)},[]),M=n.useCallback(()=>{s(t,r),o()},[o,s,t,r]),g=n.useCallback(()=>{o()},[o]),b=n.useCallback(()=>document.getElementsByClassName("modal-root__container")[0],[]);return e.jsxs("div",{className:"modal-root__modal safety-action-modal",children:[e.jsxs("div",{className:"safety-action-modal__top",children:[e.jsxs("div",{className:"safety-action-modal__header",children:[e.jsx("div",{className:"safety-action-modal__header__icon",children:e.jsx(W,{icon:me,id:"retweet"})}),e.jsxs("div",{children:[e.jsx("h1",{children:t.get("reblogged")?e.jsx(u,{id:"boost_modal.undo_reblog",defaultMessage:"Unboost post?"}):e.jsx(u,{id:"boost_modal.reblog",defaultMessage:"Boost post?"})}),e.jsx("div",{children:e.jsx(u,{id:"boost_modal.combo",defaultMessage:"You can press {combo} to skip this next time",values:{combo:e.jsxs("span",{className:"hotkey-combination",children:[e.jsx("kbd",{children:"Shift"}),"+",e.jsx(W,{id:"retweet",icon:me})]})}})})]})]}),e.jsx("div",{className:"safety-action-modal__status",children:e.jsx($t,{statusId:l})})]}),e.jsx("div",{className:P("safety-action-modal__bottom"),children:e.jsxs("div",{className:"safety-action-modal__actions",children:[!t.get("reblogged")&&e.jsx(_t,{noDirect:!0,value:r,container:b,onChange:m,disabled:c==="private"}),e.jsx("div",{className:"spacer"}),e.jsx("button",{onClick:g,className:"link-button",children:e.jsx(u,{id:"confirmation_modal.cancel",defaultMessage:"Cancel"})}),e.jsx(q,{onClick:M,text:a.formatMessage(t.get("reblogged")?pe.cancel_reblog:pe.reblog),autoFocus:!0})]})})]})},L=v({deleteAndRedraftTitle:{id:"confirmations.redraft.title",defaultMessage:"Delete & redraft post?"},deleteAndRedraftMessage:{id:"confirmations.redraft.message",defaultMessage:"Are you sure you want to delete this status and re-draft it? Favorites and boosts will be lost, and replies to the original post will be orphaned."},deleteAndRedraftConfirm:{id:"confirmations.redraft.confirm",defaultMessage:"Delete & redraft"},deleteTitle:{id:"confirmations.delete.title",defaultMessage:"Delete post?"}
1,deleteMessage:{id:"confirmations.delete.message",defaultMessage:"Are you sure you want to delete this status?"},deleteConfirm:{id:"confirmations.delete.confirm",defaultMessage:"Delete"}}),ds=({statusId:t,withRedraft:s,onClose:o,onDeleteSuccess:a})=>{const i=x(),l=T(),c=n.useCallback(()=>{l(Ze(t,s)).then(()=>{a==null||a(),o()}).catch(()=>{o()})},[l,t,s,a,o]);return e.jsx(k,{title:i.formatMessage(s?L.deleteAndRedraftTitle:L.deleteTitle),message:i.formatMessage(s?L.deleteAndRedraftMessage:L.deleteMessage),confirm:i.formatMessage(s?L.deleteAndRedraftConfirm:L.deleteConfirm),onConfirm:c,onClose:o})},J=v({deleteListTitle:{id:"confirmations.delete_list.title",defaultMessage:"Delete list?"},deleteListMessage:{id:"confirmations.delete_list.message",defaultMessage:"Are you sure you want to permanently delete this list?"},deleteListConfirm:{id:"confirmations.delete_list.confirm",defaultMessage:"Delete"}}),cs=({listId:t,columnId:s,onClose:o})=>{const a=x(),i=T(),l=Dt(),c=n.useCallback(()=>{i(ze(t)),s?i(Xe(s)):l.push("/lists")},[i,l,s,t]);return e.jsx(k,{title:a.formatMessage(J.deleteListTitle),message:a.formatMessage(J.deleteListMessage),confirm:a.formatMessage(J.deleteListConfirm),onConfirm:c,onClose:o})},ms=v({title:{id:"confirmations.discard_draft.edit.title",defaultMessage:"Discard changes to your post?"},message:{id:"confirmations.discard_draft.edit.message",defaultMessage:"Continuing will discard any changes you have made to the post you are currently editing."},cancel:{id:"confirmations.discard_draft.edit.cancel",defaultMessage:"Resume editing"}}),us=v({title:{id:"confirmations.discard_draft.post.title",defaultMessage:"Discard your draft post?"},message:{id:"confirmations.discard_draft.post.message",defaultMessage:"Continuing will discard the post you are currently composing."},cancel:{id:"confirmations.discard_draft.post.cancel",defaultMessage:"Resume draft"}}),gs=v({confirm:{id:"confirmations.discard_draft.confirm",defaultMessage:"Discard and continue"}}),Pe=({onConfirm:t,onClose:s})=>{const o=x(),i=j(l=>!!l.compose.get("id"))?ms:us;return e.jsx(k,{title:o.formatMessage(i.title),message:o.formatMessage(i.message),cancel:o.formatMessage(i.cancel),confirm:o.formatMessage(gs.confirm),onConfirm:t,onClose:s})},fs=({status:t,onClose:s})=>{const o=T(),a=n.useCallback(()=>{o(et(t))},[o,t]);return e.jsx(Pe,{onConfirm:a,onClose:s})},ps=({statusId:t,onClose:s})=>{const o=T(),a=n.useCallback(()=>{o(Je(t))},[o,t]);return e.jsx(Pe,{onConfirm:a,onClose:s})},_s=v({withdrawConfirm:{id:"confirmations.withdraw_request.confirm",defaultMessage:"Withdraw request"}}),hs=({account:t,onClose:s})=>{const o=x(),a=T(),i=n.useCallback(()=>{a(ye(t.id))},[a,t.id]);return e.jsx(k,{title:e.jsx(u,{id:"confirmations.withdraw_request.title",defaultMessage:"Withdraw request to follow {name}?",values:{name:"@".concat(t.acct)}}
1),confirm:o.formatMessage(_s.withdrawConfirm),onConfirm:i,onClose:s})},bs=v({unfollowConfirm:{id:"confirmations.unfollow.confirm",defaultMessage:"Unfollow"}}),xs=({account:t,onClose:s})=>{const o=x(),a=T(),i=n.useCallback(()=>{a(ye(t.id))},[a,t.id]);return e.jsx(k,{title:e.jsx(u,{id:"confirmations.unfollow.title",defaultMessage:"Unfollow {name}?",values:{name:"@".concat(t.acct)}}),confirm:o.formatMessage(bs.unfollowConfirm),onConfirm:i,onClose:s})},vs=v({unblockConfirm:{id:"confirmations.unblock.confirm",defaultMessage:"Unblock"}}),Ms=({account:t,onClose:s})=>{const o=x(),a=T(),i=n.useCallback(()=>{a(tt(t.id))},[a,t.id]);return e.jsx(k,{title:e.jsx(u,{id:"confirmations.unblock.title",defaultMessage:"Unblock {name}?",values:{name:"@".concat(t.acct)}}),confirm:o.formatMessage(vs.unblockConfirm),onConfirm:i,onClose:s})},ee=v({clearTitle:{id:"notifications.clear_title",defaultMessage:"Clear notifications?"},clearMessage:{id:"notifications.clear_confirmation",defaultMessage:"Are you sure you want to permanently clear all your notifications?"},clearConfirm:{id:"notifications.clear",defaultMessage:"Clear notifications"}}),Cs=({onClose:t})=>{const s=x(),o=T(),a=n.useCallback(()=>{o(st())},[o]);return e.jsx(k,{title:s.formatMessage(ee.clearTitle),message:s.formatMessage(ee.clearMessage),confirm:s.formatMessage(ee.clearConfirm),onConfirm:a,onClose:t})};async function ys(){try{const t=await Ut(!1).delete("/auth/sign_out",{headers:{Accept:"application/json"},withCredentials:!0});t.status===200&&t.data.redirect_to?window.location.href=t.data.redirect_to:console.error("Failed to log out, got an unexpected non-redirect response from the server",t)}catch(t){console.error("Failed to log out, response was an error",t)}}const te=v({logoutTitle:{id:"confirmations.logout.title",defaultMessage:"Log out?"},logoutMessage:{id:"confirmations.logout.message",defaultMessage:"Are you sure you want to log out?"},logoutConfirm:{id:"confirmations.logout.confirm",defaultMessage:"Log out"}}),js=({onClose:t})=>{const s=x(),o=n.useCallback(()=>{ys()},[]);return e.jsx(k,{title:s.formatMessage(te.logoutTitle),message:s.formatMessage(te.logoutMessage),confirm:s.formatMessage(te.logoutConfirm),onConfirm:o,onClose:t})},_e=v({title:{id:"confirmations.follow_to_list.title",defaultMessage:"Follow user?"},confirm:{id:"confirmations.follow_to_list.confirm",defaultMessage:"Follow and add to list"}}),ws=({accountId:t,onConfirm:s,onClose:o})=>{const a=x(),i=j(l=>l.accounts.get(t));return e.jsx(k,{title:a.formatMessage(_e.title),message:e.jsx(u,{id:"confirmations.follow_to_list.message",defaultMessage:"You need to be following {name} to add them to a list.",values:{name:e.jsxs("strong",{children:["@",i==null?void 0:i.acct]})}}),confirm:a.formatMessage(_e.confirm),onConfirm:s,onClose:o})},Q=v({title:{id:"confirmations.missing_alt_text.title",defaultMessage:"Add alt text?"},confirm:{id:"confirmations.missing_alt_text.confirm",defaultMessage:"Add alt text"},message:{id:"confirmations.missing_alt_text.message",defaultMessage:"Your post contains media without alt text. Adding descriptions helps make your content accessible to more people."},secondary:{id:"confirmations.missing_alt_text.secondary",defaultMessage:"Post anyway"}}),Ns=({onClose:t})=>{const s=x(),o=T(),a=j(c=>{var r;return(r=c.compose.get("media_attachments").find(d=>{var m;return["image","gifv"].includes(d.get("type"))&&((m=d.get("description"))!=null?m:"").length===0}))==null?void 0:r.get("id")}),i=n.useCallback(()=>{o(je({modalType:"FOCAL_POINT",modalProps:{mediaId:a}}))},[o,a]),l=n.useCallback(()=>{o(ot())},[o]);return e.jsx(k,{title:s.formatMessage(Q.title),message:s.formatMessage(Q.message),confirm:s.formatMessage(Q.confirm),secondary:s.formatMessage(Q.secondary),onConfirm:i,onSecondary:l,onClose:t})},se=v({revokeQuoteTitle:{id:"confirmations.revoke_quote.title",defaultMessage:"Remove post?"},revokeQuoteMessage:{id:"confirmations.revoke_quote.message",defaultMessage:"This action cannot be undone."},revokeQuoteConfirm:{id:"confirmations.revoke_quote.confirm",defaultMessage:"Remove post"}}),Ts=({statusId:t,quotedStatusId:s,onClose:o})=>{const a=x(),i=T(),l=n.useCallback(()=>{i(at({quotedStatusId:s,statusId:t}))},[i,t,s]);return e.jsx(k,{title:a.formatMessage(se.revokeQuoteTitle),message:a.formatMessage(se.revokeQuoteMessage),confirm:a.formatMessage(se.revokeQuoteConfirm),onConfirm:l,onClose:o})},V=v({title:{id:"confirmations.quiet_post_quote_info.title",defaultMessage:"Quoting quiet public posts"},message:{id:"confirmations.quiet_post_quote_info.message",defaultMessage:"When quoting a quiet public post, your post will be hidden from trending timelines."},got_it:{id:"confirmations.quiet_post_quote_info.got_it",defaultMessage:"Got it"},dismiss:{id:"confirmations.quiet_post_quote_info.dismiss",defaultMessage:"Don't remind me again"}}),ks=({status:t})=>{const s=x(),o=T(),a=n.useCallback(()=>{o(ue(t)),o(G({modalType:"CONFIRM_QUIET_QUOTE",ignoreFocus:!0}))},[o,t]),i=n.useCallback(()=>{o(ue(t)),o(it(["dismissed_banners","quote/quiet_post_hint"],!0)),o(G({modalType:"CONFIRM_QUIET_QUOTE",ignoreFocus:!0}))},[o,t]);return e.jsx(k,{closeWhenConfirm:!1,title:s.formatMessage(V.title),message:s.formatMessage(V.message),confirm:s.formatMessage(V.got_it),cancel:s.formatMessage(V.dismiss),onConfirm:a,onClose:i})},Is=v({close:{id:"lightbox.close",defaultMessage:"Close"}}),Es=({src:t,alt:s,onClose:o})=>{const a=x(),[i,l]=n.useState(!1),c=n.useCallback(()=>
1{l(d=>!d)},[l]),r=P("media-modal__navigation",{"media-modal__navigation--hidden":i});return e.jsxs("div",{className:"modal-root__modal media-modal",children:[e.jsx("div",{className:"media-modal__closer",role:"presentation",onClick:o,children:e.jsx(ct,{src:t,width:400,height:400,alt:s,onClick:c})}),e.jsx("div",{className:r,children:e.jsx("div",{className:"media-modal__buttons",children:e.jsx(we,{className:"media-modal__close",title:a.formatMessage(Is.close),icon:"times",iconComponent:Ne,onClick:o})})})]})},he=({loading:t,onClose:s,onRetry:o})=>{const a=n.useCallback(()=>{s(void 0,!1)},[s]),i=n.useCallback(()=>{o&&o()},[o]);return e.jsx("div",{className:"modal-root__modal modal-placeholder","aria-busy":t,children:t?e.jsx(ve,{}):e.jsxs("div",{className:"modal-placeholder__error",children:[e.jsx(Bt,{src:"/oops.gif",staticSrc:"/oops.png",className:"modal-placeholder__error__image"}),e.jsxs("div",{className:"modal-placeholder__error__message",children:[e.jsx("p",{children:e.jsx(u,{id:"bundle_modal_error.message",defaultMessage:"Something went wrong while loading this screen."})}),e.jsxs("div",{className:"modal-placeholder__error__message__actions",children:[e.jsx(q,{onClick:i,children:e.jsx(u,{id:"bundle_modal_error.retry",defaultMessage:"Try again"})}),e.jsx(q,{onClick:a,className:"button button-tertiary",children:e.jsx(u,{id:"bundle_modal_error.close",defaultMessage:"Close"})})]})]})]})})},Ps=(t,{statusId:s})=>({status:t.getIn(["statuses",s])});class Re extends nt{componentDidMount(){const{media:s,onChangeBackgroundColor:o}=this.props,a=ke(s.get("blurhash"));a&&o(a)}componentWillUnmount(){this.props.onChangeBackgroundColor(null)}render(){const{media:s,status:o,onClose:a}=this.props,i=this.props.options||{},l=o.getIn(["translation","language"])||o.get("language"),c=s.getIn(["translation","description"])||s.get("description");return e.jsxs("div",{className:"modal-root__modal video-modal",children:[e.jsx("div",{className:"video-modal__container",children:e.jsx(Me,{preview:s.get("preview_url"),frameRate:s.getIn(["meta","original","frame_rate"]),aspectRatio:"".concat(s.getIn(["meta","original","width"])," / ").concat(s.getIn(["meta","original","height"])),blurhash:s.get("blurhash"),src:s.get("url"),startTime:i.startTime,startPlaying:i.autoPlay,startVolume:i.defaultVolume,onCloseVideo:a,autoFocus:!0,detailed:!0,alt:c,lang:l})}),e.jsx("div",{className:"media-modal__overlay",children:o&&e.jsx(Ie,{statusId:o.get("id"),withOpenButton:!0,onClose:a})})]})}}S(Re,"propTypes",{media:ge.map.isRequired,statusId:F.string,status:ge.map,options:F.shape({startTime:F.number,autoPlay:F.bool,defaultVolume:F.number}),onClose:F.func.isRequired,onChangeBackgroundColor:F.func.isRequired});const Rs=Y(Ps,null,null,{forwardRef:!0})(Re);function Se(t){return["public","followers","nobody"].includes(t)}function Ss(t){return["public","unlisted","private","direct"].includes(t)}const As={name:"sameWidth",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:({state:t})=>{t.styles.popper&&(t.styles.popper.width="".concat(t.rects.reference.width,"px"))},effect:({state:t})=>{const s=t.elements.reference;t.elements.popper.style.width="".concat(s.offsetWidth,"px")}},be=({disabled:t,items:s,current:o,onChange:a,labelId:i,descriptionId:l,classPrefix:c,className:r,id:d,...m})=>{const M=x(),g=n.useRef(null),b=n.useId(),f=d!=null?d:"".concat(b,"-button"),N="".concat(b,"-listbox"),[h,w]=n.useState(!1),R=n.useCallback(()=>{t||w(_=>{var y;return(y=g.current)==null||y.focus(),!_})},[t]),I=n.useCallback(()=>{var _;w(!1),(_=g.current)==null||_.focus()},[]),E=n.useMemo(()=>{var _,y;return(y=(_=s.find(O=>O.value===o))==null?void 0:_.text)!=null?y:M.formatMessage({id:"dropdown.empty",defaultMessage:"Select an option"})},[o,M,s]);return e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",...m,id:f,"aria-labelledby":"".concat(i," ").concat(f),"aria-describedby":l,"aria-expanded":h,"aria-controls":N,onClick:R,disabled:t,className:P("".concat(c,"__button"),{active:h,disabled:t},r),ref:g,children:[E,e.jsx(W,{id:"unfold-icon",icon:Qt,className:"".concat(c,"__icon")})]}),e.jsx(xe,{show:h,offset:[0,0],placement:"bottom-start",onHide:I,flip:!0,target:g.current,popperConfig:{strategy:"fixed",modifiers:[As]},children:({props:_,placement:y})=>e.jsx("div",{..._,className:"".concat(c,"__overlay"),children:e.jsx("div",{className:P("dropdown-animation","".concat(c,"__dropdown"),y),id:N,children:e.jsx(Vt,{items:s,value:o,onClose:I,onChange:a,classNamePrefix:c})})})})]})},H=v({close:{id:"lightbox.close",defaultMessage:"Close"},buttonTitle:{id:"visibility_modal.button_title",defaultMessage:"Set visibility"},quotePublic:{id:"visibility_modal.quote_public",defaultMessage:"Anyone"},quoteFollowers:{id:"visibility_modal.quote_followers",defaultMessage:"Followers only"},quoteNobody:{id:"visibility_modal.quote_nobody",defaultMessage:"Just me"}}),qs=Te([t=>t.statuses,(t,s)=>s,t=>t.compose.get("quote_policy")],(t,s,o)=>
1{if(!s)return o;const a=t.get(s);if(!a)return"public";const i=a.getIn(["quote_approval","automatic",0])||"nobody",l=a.get("visibility");return l==="private"||l==="direct"?"nobody":Se(i)?i:l==="unlisted"?"followers":"public"}),Os=Te([t=>t.statuses,(t,s)=>!!s,t=>t.compose.get("quoted_status_id")],(t,s,o)=>{if(s||!o)return!1;const a=t.get(o);return a?a.get("visibility")==="private":!1}),Ae=n.forwardRef(({onClose:t,onChange:s,statusId:o},a)=>{const i=x(),l=j(p=>{var U;return o?(U=p.statuses.getIn([o,"visibility"],"public"))!=null?U:"public":p.compose.get("privacy")}),c=j(p=>qs(p,o)),[r,d]=n.useState(l),[m,M]=n.useState(c),g=!!o,b=r==="private"||r==="direct",f=j(Os),N=j(p=>p.compose.get("quoted_status_id")!==null),h=n.useMemo(()=>{const p=[{value:"private",text:i.formatMessage(A.private_short),meta:i.formatMessage(A.private_long),icon:"lock",iconComponent:vt},{value:"direct",text:i.formatMessage(A.direct_short),meta:i.formatMessage(A.direct_long),icon:"at",iconComponent:Mt}];return f||p.unshift({value:"public",text:i.formatMessage(A.public_short),meta:i.formatMessage(A.public_long),icon:"globe",iconComponent:Ct},{value:"unlisted",text:i.formatMessage(A.unlisted_short),meta:i.formatMessage(A.unlisted_long),icon:"unlock",iconComponent:yt}),p},[i,f]),w=n.useMemo(()=>[{value:"public",text:i.formatMessage(H.quotePublic)},{value:"followers",text:i.formatMessage(H.quoteFollowers)},{value:"nobody",text:i.formatMessage(H.quoteNobody)}],[i]),R=n.useCallback(p=>{Ss(p)&&d(p)},[]),I=n.useCallback(p=>{Se(p)&&M(p)},[]),E=n.useCallback(()=>{s(r,m),t()},[s,t,r,m]),_=n.useId(),y="".concat(_,"-visibility-label"),O="".concat(_,"-visibility-desc"),D="".concat(_,"-quote-label"),$="".concat(_,"-quote-desc");return e.jsxs("div",{className:"modal-root__modal dialog-modal visibility-modal",children:[e.jsxs("div",{className:"dialog-modal__header",children:[e.jsx(we,{className:"dialog-modal__header__close",title:i.formatMessage(H.close),icon:"times",iconComponent:Ne,onClick:t}),e.jsx(u,{id:"visibility_modal.header",defaultMessage:"Visibility and interaction",children:p=>e.jsx("span",{className:"dialog-modal__header__title",children:p})})]}),e.jsxs("div",{className:"dialog-modal__content",children:[e.jsx("div",{className:"dialog-modal__content__description",children:e.jsx(u,{id:"visibility_modal.instructions",defaultMessage:"Control who can interact with this post. You can also apply settings to all future posts by navigating to <link>Preferences > Posting defaults</link>.",values:{link:p=>e.jsx("a",{href:"/settings/preferences/posting_defaults",children:p})},tagName:"p"})}),e.jsxs("div",{className:"dialog-modal__content__form",children:[e.jsxs("div",{className:P("visibility-dropdown",{disabled:g}),children:[e.jsx("label",{className:"visibility-dropdown__label",id:y,children:e.jsx(u,{id:"visibility_modal.privacy_label",defaultMessage:"Visibility"})}),e.jsx(be,{items:h,current:r,onChange:R,labelId:y,descriptionId:O,classPrefix:"visibility-dropdown",disabled:g}),!!o&&e.jsx("p",{className:"visibility-dropdown__helper",id:"visibilityDescriptionId",children:e.jsx(u,{id:"visibility_modal.helper.privacy_editing",defaultMessage:"Visibility can't be changed after a post is published."})}),!o&&f&&e.jsx("p",{className:"visibility-dropdown__helper",id:"visibilityDescriptionId",children:e.jsx(u,{id:"visibility_modal.helper.privacy_private_self_quote",defaultMessage:"Self-quotes of private posts cannot be made public."})})]}),e.jsxs("div",{className:P("visibility-dropdown",{disabled:b}),children:[e.jsx("label",{className:"visibility-dropdown__label",id:D,children:e.jsx(u,{id:"visibility_modal.quote_label",defaultMessage:"Who can quote"})}),e.jsx(be,{items:w,current:b?"nobody":m,onChange:I,labelId:D,descriptionId:$,classPrefix:"visibility-dropdown",disabled:b}),e.jsx(Fs,{policy:m,visibility:r,className:"visibility-dropdown__helper",id:$})]}),N&&r==="direct"&&e.jsxs("div",{className:"visibility-modal__quote-warning",children:[e.jsx(u,{id:"visibility_modal.direct_quote_warning.title",defaultMessage:"Quotes can't be embedded in private mentions",tagName:"h3"}),e.jsx(u,{id:"visibility_modal.direct_quote_warning.text",defaultMessage:"If you save the current settings, the embedded quote will be converted to a link.",tagName:"p"})]})]}),e.jsxs("div",{className:"dialog-modal__content__actions",children:[e.jsx(q,{onClick:t,secondary:!0,children:e.jsx(u,{id:"confirmation_modal.cancel",defaultMessage:"Cancel"})}),e.jsx(q,{onClick:E,children:e.jsx(u,{id:"visibility_modal.save",defaultMessage:"Save"})})]})]})]})});Ae.displayName="VisibilityModal";const Fs=({policy:t,visibility:s,...o})=>{let a;return s==="unlisted"&&t!=="nobody"&&(a=e.jsx(u,{id:"visibility_modal.helper.unlisted_quoting",defaultMessage:"When people quote you, their post will also be hidden from trending timelines."})),s==="private"&&(a=e.jsx(u,{id:"visibility_modal.helper.private_quoting",defaultMessage:"Follower
1-only posts authored on Mastodon can't be quoted by others."})),s==="direct"&&(a=e.jsx(u,{id:"visibility_modal.helper.direct_quoting",defaultMessage:"Private mentions authored on Mastodon can't be quoted by others."})),a?e.jsx("p",{...o,children:a}):null},Ls={MEDIA:()=>Promise.resolve({default:ut}),VIDEO:()=>Promise.resolve({default:Rs}),AUDIO:()=>Promise.resolve({default:ls}),IMAGE:()=>Promise.resolve({default:Es}),BOOST:()=>Promise.resolve({default:rs}),CONFIRM:()=>Promise.resolve({default:k}),CONFIRM_DELETE_STATUS:()=>Promise.resolve({default:ds}),CONFIRM_DELETE_LIST:()=>Promise.resolve({default:cs}),CONFIRM_REPLY:()=>Promise.resolve({default:fs}),CONFIRM_EDIT_STATUS:()=>Promise.resolve({default:ps}),CONFIRM_UNBLOCK:()=>Promise.resolve({default:Ms}),CONFIRM_UNFOLLOW:()=>Promise.resolve({default:xs}),CONFIRM_WITHDRAW_REQUEST:()=>Promise.resolve({default:hs}),CONFIRM_CLEAR_NOTIFICATIONS:()=>Promise.resolve({default:Cs}),CONFIRM_LOG_OUT:()=>Promise.resolve({default:js}),CONFIRM_FOLLOW_TO_LIST:()=>Promise.resolve({default:ws}),CONFIRM_MISSING_ALT_TEXT:()=>Promise.resolve({default:Ns}),CONFIRM_PRIVATE_QUOTE_NOTIFY:()=>Promise.resolve({default:ht}),CONFIRM_REVOKE_QUOTE:()=>Promise.resolve({default:Ts}),CONFIRM_QUIET_QUOTE:()=>Promise.resolve({default:ks}),MUTE:Ot,BLOCK:qt,DOMAIN_BLOCK:At,REPORT:St,ACTIONS:()=>Promise.resolve({default:ns}),EMBED:Rt,FOCAL_POINT:()=>Promise.resolve({default:Ee}),LIST_ADDER:Pt,COMPARE_HISTORY:Et,FILTER:It,SUBSCRIBED_LANGUAGES:kt,INTERACTION:Tt,CLOSED_REGISTRATIONS:Nt,IGNORE_NOTIFICATIONS:wt,ANNUAL_REPORT:jt,COMPOSE_PRIVACY:()=>Promise.resolve({default:Ae})};class Ds extends n.PureComponent{constructor(){super(...arguments);S(this,"state",{backgroundColor:null});S(this,"setBackgroundColor",o=>{this.setState({backgroundColor:o})});S(this,"renderLoading",()=>{const{onClose:o}=this.props;return e.jsx(he,{loading:!0,onClose:o})});S(this,"renderError",o=>{const{onClose:a}=this.props;return e.jsx(he,{...o,onClose:a})});S(this,"handleClose",(o=!1)=>{var l,c;const{onClose:a}=this.props,i=(c=(l=this._modal)==null?void 0:l.getCloseConfirmationMessage)==null?void 0:c.call(l);a(i,o)});S(this,"setModalRef",o=>{this._modal=o})}render(){const{type:o,props:a,ignoreFocus:i}=this.props,{backgroundColor:l}=this.state,c=!!o;return e.jsx(mt,{backgroundColor:l,onClose:this.handleClose,ignoreFocus:i,children:c&&e.jsxs(e.Fragment,{children:[e.jsx(Jt,{fetchComponent:Ls[o],loading:this.renderLoading,error:this.renderError,renderDelay:200,children:r=>e.jsx(r,{...a,onChangeBackgroundColor:this.setBackgroundColor,onClose:this.handleClose,ref:this.setModalRef})}),e.jsx(rt,{children:e.jsx("meta",{name:"robots",content:"noindex"})})]})})}}const $s={},Us=t=>({ignoreFocus:t.getIn(["modal","ignoreFocus"]),type:t.getIn(["modal","stack",0,"modalType"],null),props:t.getIn(["modal","stack",0,"modalProps"],$s)}),Bs=t=>({onClose(s,o=!1){t(s?je({previousModalProps:s.props,modalType:"CONFIRM",modalProps:{message:s.message,confirm:s.confirm,onConfirm:()=>t(G({modalType:void 0,ignoreFocus:{ignoreFocus:o}}))}}):G({modalType:void 0,ignoreFocus:{ignoreFocus:o}}))}}),uo=Y(Us,Bs)(Ds);export{co as A,Jt as B,mo as L,uo as M}; 2//# sourceMappingURL=modal_container-CpKvh7vy.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.