1import{o as e}from"./rolldown-runtime-C0FnF6B9.js";import{t}from"./react-C21x__mS.js";import{c as n,s as r}from"./react-intl-DlKP8ATg.js";import{t as i}from"./jsx-runtime-BdxMnOeJ.js";import{i as a,n as o,r as s,t as c}from"./react-spring_web.modern-C6ohYUSs.js";import{M as l,jt as u}from"./store-BKpYtGn4.js";import{m as d,s as f}from"./react-router-BkmJBoOP.js";import{t as p}from"./defineProperty-BbfpZ9Tg.js";import{o as m,s as h}from"./typed_functions-Whap35TF.js";import{Vt as g}from"./filters-Br4s8K7f.js";import{n as _}from"./modal-CMPL9eyP.js";import{t as v}from"./classnames-CfLRLWYq.js";import{t as y}from"./close-DIPoUQpY.js";import{t as b}from"./loading_indicator-eceYQNAM.js";import{t as x}from"./icon_button-DfNtv8BJ.js";import{t as S}from"./icon-BNrUFRb_.js";import{i as C}from"./identity_context-CLXpzjnM.js";import{t as w}from"./video-B-s0PS3Z.js";import{t as T}from"./blurhash-CM3tW5se.js";import{a as E,d as D,f as O,o as k}from"./card-B8qczahc.js";import{t as A}from"./reply-NI2DkwdJ.js";import{a as j,i as M}from"./logo-CMWuQAdn.js";import{i as N}from"./selectors-Aw-AI9UP.js";import{i as P,n as ee,r as F,t as te}from"./use-gesture-react.esm-DuPMJbBX.js";import{t as ne}from"./chevron_left-Du0bxxM7.js";import{t as re}from"./chevron_right-CyqmmHhV.js";var I=e(v()),L=e(t()),R=i(),z=r({reply:{id:`status.reply`,defaultMessage:`Reply`},replyAll:{id:`status.replyAll`,defaultMessage:`Reply to thread`},reblog:{id:`status.reblog`,defaultMessage:`Boost`},reblog_private:{id:`status.reblog_private`,defaultMessage:`Share again with your followers`},cancel_reblog_private:{id:`status.cancel_reblog_private`,defaultMessage:`Unboost`},cannot_reblog:{id:`status.cannot_reblog`,defaultMessage:`This post cannot be boosted`},favourite:{id:`status.favourite`,defaultMessage:`Favorite`},removeFavourite:{id:`status.remove_favourite`,defaultMessage:`Remove from favorites`},open:{id:`status.open`,defaultMessage:`Expand this status`}}),B=({statusId:e,withOpenButton:t,onClose:r})=>{let{signedIn:i}=C(),a=n(),o=f(),s=m(),c=(0,L.useMemo)(()=>N(),[]),u=h(t=>c(t,{id:e})),d=u?.get(`account`),p=h(e=>e.compose.get(`text`).trim().length!==0),v=(0,L.useCallback)(()=>{u&&(i?(r(!0),s(p?_({modalType:`CONFIRM_REPLY`,modalProps:{status:u}}):g(u))):s(_({modalType:`INTERACTION`,modalProps:{intent:`reply`,accountId:u.getIn([`account`,`id`]),url:u.get(`uri`)}})))},[s,u,i,p,r]),y=(0,L.useCallback)(()=>{u&&s(i?l(u.get(`id`)):_({modalType:`INTERACTION`,modalProps:{intent:`favourite`,accountId:u.getIn([`account`,`id`]),url:u.get(`uri`)}}))},[s,u,i]),b=(0,L.useCallback)(e=>{e.button!==0||!u||(r(),o.push(`/@${d?.acct}/${u.get(`id`)}`))},[o,u,d,r]);if(!u)return null;let S,w,T;u.get(`in_reply_to_id`,null)===null?(S=`reply`,w=A,T=a.formatMessage(z.reply)):(S=`reply-all`,w=D,T=a.formatMessage(z.replyAll));let E=a.formatMessage(u.get(`favourited`)?z.removeFavourite:z.favourite);return(0,R.jsxs)(`div`,{className:`picture-in-picture__footer`,children:[(0,R.jsx)(x,{className:`status__action-bar-button`,title:T,icon:u.get(`in_reply_to_account_id`)===u.getIn([`account`,`id`])?`reply`:S,iconComponent:u.get(`in_reply_to_account_id`)===u.getIn([`account`,`id`])?A:w,onClick:v,counter:u.get(`replies_count`)}),(0,R.jsx)(k,{counters:!0,statusId:e}),(0,R.jsx)(x,{className:`status__action-bar-button star-icon`,animate:!0,active:u.get(`favourited`),title:E,icon:`star`,iconComponent:u.get(`favourited`)?j:M,onClick:y,counter:u.get(`favourites_count`)}),t&&(0,R.jsx)(x,{className:`status__action-bar-button`,title:a.formatMessage(z.open),icon:`external-link`,iconComponent:O,onClick:b,href:`/@${d?.acct}/${u.get(`id`)}`})]})},V=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,`value`in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function H(e,t){if(!(e instanceof t))throw TypeError(`Cannot call a class as a function`)}(function(){if(typeof window>`u`||typeof Element>`u`)return;var e=Array.prototype.slice,t=Element.prototype.matches||Element.prototype.msMatchesSelector,n=[`a[href]`,`area[href]`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`button:not([disabled])`,`details`,`summary`,`iframe`,`object`,`embed`,`video`,`[contenteditable]`].join(`,`),r=function(){function r(e,t){H(this,r),this._inertManager=t,this._rootElement=e,this._managedNodes=new Set,this._savedAriaHidden=this._rootElement.hasAttribute(`aria-hidden`)?this._rootElement.getAttribute(`aria-hidden`):null,this._rootElement.setAttribute(`aria-hidden`,`true`),this._makeSubtreeUnfocusable(this._rootElement),this._observer=new MutationObserver(this._onMutation.bind(this)),this._observer.observe(this._rootElement,{attributes:!0,childList:!0,subtree:!0})}return V(r,[{key:`destructor`,value:function(){this._observer.disconnect(),this._rootElement&&(this._savedAriaHidden===null?this._rootElement.removeAttribute(`aria-hidden`):this._rootElement.setAttribute(`aria-hidden`,this._savedAriaHidden)),this._managedNodes.forEac
1h(function(e){this._unmanageNode(e.node)},this),this._observer=null,this._rootElement=null,this._managedNodes=null,this._inertManager=null}},{key:`_makeSubtreeUnfocusable`,value:function(e){var t=this;o(e,function(e){return t._visitNode(e)});var n=document.activeElement;if(!document.body.contains(e)){for(var r=e,i=void 0;r;){if(r.nodeType===Node.DOCUMENT_FRAGMENT_NODE){i=r;break}r=r.parentNode}i&&(n=i.activeElement)}e.contains(n)&&(n.blur(),n===document.activeElement&&document.body.focus())}},{key:`_visitNode`,value:function(e){if(e.nodeType===Node.ELEMENT_NODE){var r=e;r!==this._rootElement&&r.hasAttribute(`inert`)&&this._adoptInertRoot(r),(t.call(r,n)||r.hasAttribute(`tabindex`))&&this._manageNode(r)}}},{key:`_manageNode`,value:function(e){var t=this._inertManager.register(e,this);this._managedNodes.add(t)}},{key:`_unmanageNode`,value:function(e){var t=this._inertManager.deregister(e,this);t&&this._managedNodes.delete(t)}},{key:`_unmanageSubtree`,value:function(e){var t=this;o(e,function(e){return t._unmanageNode(e)})}},{key:`_adoptInertRoot`,value:function(e){var t=this._inertManager.getInertRoot(e);t||=(this._inertManager.setInert(e,!0),this._inertManager.getInertRoot(e)),t.managedNodes.forEach(function(e){this._manageNode(e.node)},this)}},{key:`_onMutation`,value:function(t,n){t.forEach(function(t){var n=t.target;if(t.type===`childList`)e.call(t.addedNodes).forEach(function(e){this._makeSubtreeUnfocusable(e)},this),e.call(t.removedNodes).forEach(function(e){this._unmanageSubtree(e)},this);else if(t.type===`attributes`){if(t.attributeName===`tabindex`)this._manageNode(n);else if(n!==this._rootElement&&t.attributeName===`inert`&&n.hasAttribute(`inert`)){this._adoptInertRoot(n);var r=this._inertManager.getInertRoot(n);this._managedNodes.forEach(function(e){n.contains(e.node)&&r._manageNode(e.node)})}}},this)}},{key:`managedNodes`,get:function(){return new Set(this._managedNodes)}},{key:`hasSavedAriaHidden`,get:function(){return this._savedAriaHidden!==null}},{key:`savedAriaHidden`,set:function(e){this._savedAriaHidden=e},get:function(){return this._savedAriaHidden}}]),r}(),i=function(){function e(t,n){H(this,e),this._node=t,this._overrodeFocusMethod=!1,this._inertRoots=new Set([n]),this._savedTabIndex=null,this._destroyed=!1,this.ensureUntabbable()}return V(e,[{key:`destructor`,value:function(){if(this._throwIfDestroyed(),this._node&&this._node.nodeType===Node.ELEMENT_NODE){var e=this._node;this._savedTabIndex===null?e.removeAttribute(`tabindex`):e.setAttribute(`tabindex`,this._savedTabIndex),this._overrodeFocusMethod&&delete e.focus}this._node=null,this._inertRoots=null,this._destroyed=!0}},{key:`_throwIfDestroyed`,value:function(){if(this.destroyed)throw Error(`Trying to access destroyed InertNode`)}},{key:`ensureUntabbable`,value:function(){if(this.node.nodeType===Node.ELEMENT_NODE){var e=this.node;if(t.call(e,n)){if(e.tabIndex===-1&&this.hasSavedTabIndex)return;e.hasAttribute(`tabindex`)&&(this._savedTabIndex=e.tabIndex),e.setAttribute(`tabindex`,`-1`),e.nodeType===Node.ELEMENT_NODE&&(e.focus=function(){},this._overrodeFocusMethod=!0)}else e.hasAttribute(`tabindex`)&&(this._savedTabIndex=e.tabIndex,e.removeAttribute(`tabindex`))}}},{key:`addInertRoot`,value:function(e){this._throwIfDestroyed(),this._inertRoots.add(e)}},{key:`removeInertRoot`,value:function(e){this._throwIfDestroyed(),this._inertRoots.delete(e),this._inertRoots.size===0&&this.destructor()}},{key:`destroyed`,get:function(){return this._destroyed}},{key:`hasSavedTabIndex`,get:function(){return this._savedTabIndex!==null}},{key:`node`,get:function(){return this._throwIfDestroyed(),this._node}},{key:`savedTabIndex`,set:function(e){this._throwIfDestroyed(),this._savedTabIndex=e},get:function(){return this._throwIfDestroyed(),this._savedTabIndex}}]),e}(),a=function(){function n(e){if(H(this,n),!e)throw Error(`Missing required argument; InertManager needs to wrap a document.`);this._document=e,this._managedNodes=new Map,this._inertRoots=new Map,this._observer=new MutationObserver(this._watchForInert.bind(this)),s(e.head||e.body||e.documentElement),e.readyState===`loading`?e.addEventListener(`DOMContentLoaded`,this._onDocumentLoaded.bind(this)):this._onDocumentLoaded()}return V(n,[{key:`setInert`,value:function(e,t){if(t){if(this._inertRoots.has(e))return;var n=new r(e,this);if(e.setAttribute(`inert`,``),this._inertRoots.set(e,n),!this._document.body.contains(e))for(var i=e.parentNode;i;)i.nodeType===11&&s(i),i=i.parentNode}else{if(!this._inertRoots.has(e))return;this._inertRoots.get(e).destructor(),this._inertRoots.delete(e),e.removeAttribute(`inert`)}}},{key:`getInertRoot`,value:function(e){return this._inertRoots.get(e)}},{key:`register`,value:function(e,t){var n=this._managedNodes.get(e);return n===void 0?n=new i(e,t):n.addInertRoot(t),this._managedNodes.set(e,n),n}},{key:`deregister`,value:function(e,t){var n=this._managedNodes.get(e);return n?(n.removeInertRoot(t),n.destroyed&&this._managedNodes.delete(e),n):null}},{key:`_onDocumentLoaded`,value:function(){e.call(this._document.querySelectorAll(`[inert]`)).forEac
1h(function(e){this.setInert(e,!0)},this),this._observer.observe(this._document.body||this._document.documentElement,{attributes:!0,subtree:!0,childList:!0})}},{key:`_watchForInert`,value:function(n,r){var i=this;n.forEach(function(n){switch(n.type){case`childList`:e.call(n.addedNodes).forEach(function(n){if(n.nodeType===Node.ELEMENT_NODE){var r=e.call(n.querySelectorAll(`[inert]`));t.call(n,`[inert]`)&&r.unshift(n),r.forEach(function(e){this.setInert(e,!0)},i)}},i);break;case`attributes`:if(n.attributeName!==`inert`)return;var r=n.target,a=r.hasAttribute(`inert`);i.setInert(r,a)}},this)}}]),n}();function o(e,t,n){if(e.nodeType==Node.ELEMENT_NODE){var r=e;t&&t(r);var i=r.shadowRoot;if(i){o(i,t,i);return}if(r.localName==`content`){for(var a=r,s=a.getDistributedNodes?a.getDistributedNodes():[],c=0;c<s.length;c++)o(s[c],t,n);return}if(r.localName==`slot`){for(var l=r,u=l.assignedNodes?l.assignedNodes({flatten:!0}):[],d=0;d<u.length;d++)o(u[d],t,n);return}}for(var f=e.firstChild;f!=null;)o(f,t,n),f=f.nextSibling}function s(e){if(!e.querySelector(`style#inert-style, link#inert-style`)){var t=document.createElement(`style`);t.setAttribute(`id`,`inert-style`),t.textContent=` 2[inert] { 3 pointer-events: none; 4 cursor: default; 5} 6 7[inert], [inert] * { 8 -webkit-user-select: none; 9 -moz-user-select: none; 10 -ms-user-select: none; 11 user-select: none; 12} 13`,e.appendChild(t)}}if(!HTMLElement.prototype.hasOwnProperty(`inert`)){var c=new a(document);Object.defineProperty(HTMLElement.prototype,"inert",{enumerable:!0,get:function(){return this.hasAttribute(`inert`)},set:function(e){c.setInert(this,e)}})}})();function U(e,t,n){return{r:255*n(e.r/255,t.r/255),g:255*n(e.g/255,t.g/255),b:255*n(e.b/255,t.b/255)}}function W(e,t){return e*t}function G(e,t,n){return Math.min(Math.max(e||0,t),n)}function K(e){return{r:G(e.r,0,255),g:G(e.g,0,255),b:G(e.b,0,255),a:G(e.a,0,1)}}function q(e){return{r:255*e.r,g:255*e.g,b:255*e.b,a:e.a}}function ie(e){return{r:e.r/255,g:e.g/255,b:e.b/255,a:e.a}}function J(e,t){t===void 0&&(t=0);var n=10**t;return{r:Math.round(e.r*n)/n,g:Math.round(e.g*n)/n,b:Math.round(e.b*n)/n,a:e.a}}function Y(e,t,n,r,i,a){return(1-t/n)*r+t/n*Math.round((1-e)*i+e*a)}function ae(e,t,n,r,i){i===void 0&&(i={unitInput:!1,unitOutput:!1,roundOutput:!0}),i.unitInput&&(e=q(e),t=q(t)),e=K(e);var a=(t=K(t)).a+e.a-t.a*e.a,o=n(e,t,r),s=K({r:Y(e.a,t.a,a,e.r,t.r,o.r),g:Y(e.a,t.a,a,e.g,t.g,o.g),b:Y(e.a,t.a,a,e.b,t.b,o.b),a});return s=i.unitOutput?ie(s):i.roundOutput?J(s):function(e){return J(e,9)}(s),s}function oe(e,t){return ae(e,t,U,W)}var se=class extends L.PureComponent{constructor(...e){super(...e),p(this,`activeElement`,this.props.children?document.activeElement:null),p(this,`handleKeyUp`,e=>{(e.key===`Escape`||e.key===`Esc`||e.keyCode===27)&&this.props.children&&this.props.onClose()}),p(this,`handleKeyDown`,e=>{if(e.key===`Tab`){let t=Array.from(this.node.querySelectorAll(`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`)).filter(e=>window.getComputedStyle(e).display!==`none`),n=t.indexOf(e.target),r;r=e.shiftKey?t[n-1]||t[t.length-1]:t[n+1]||t[0],r&&(r.focus(),e.stopPropagation(),e.preventDefault())}}),p(this,`getSiblings`,()=>Array(...this.node.parentElement.childNodes).filter(e=>e!==this.node)),p(this,`setRef`,e=>{this.node=e})}componentDidMount(){window.addEventListener(`keyup`,this.handleKeyUp,!1),window.addEventListener(`keydown`,this.handleKeyDown,!1),this.history=this.props.history||d()}componentDidUpdate(e){!this.props.children&&e.children&&(this.getSiblings().forEac
13h(e=>e.removeAttribute(`inert`)),Promise.resolve().then(()=>{this.props.ignoreFocus||this.activeElement.focus({preventScroll:!0}),this.activeElement=null}).catch(console.error),this._handleModalClose()),this.props.children&&!e.children&&(this.activeElement=document.activeElement,this.getSiblings().forEach(e=>e.setAttribute(`inert`,!0)),this._handleModalOpen()),this.props.children&&this._ensureHistoryBuffer()}componentWillUnmount(){window.removeEventListener(`keyup`,this.handleKeyUp),window.removeEventListener(`keydown`,this.handleKeyDown)}_handleModalOpen(){this._modalHistoryKey=Date.now(),this.unlistenHistory=this.history.listen((e,t)=>{t===`POP`&&this.props.onClose()})}_handleModalClose(){this.unlistenHistory&&this.unlistenHistory();let{state:e}=this.history.location;e&&e.mastodonModalKey===this._modalHistoryKey&&this.history.goBack()}_ensureHistoryBuffer(){let{pathname:e,search:t,hash:n,state:r}=this.history.location;(!r||r.mastodonModalKey!==this._modalHistoryKey)&&this.history.push({pathname:e,search:t,hash:n},{...r,focusTarget:this.props.ignoreFocus!==u,mastodonModalKey:this._modalHistoryKey})}render(){let{children:e,onClose:t}=this.props,n=!!e;if(!n)return(0,R.jsx)(`div`,{className:`modal-root`,ref:this.setRef,style:{opacity:0}});let r=null;if(this.props.backgroundColor&&typeof this.props.backgroundColor==`string`)r=this.props.backgroundColor;else if(this.props.backgroundColor){let e=oe({...this.props.backgroundColor,a:1},{r:0,g:0,b:0,a:.7});r=`rgb(${e.r}, ${e.g}, ${e.b})`}return(0,R.jsx)(`div`,{className:`modal-root`,ref:this.setRef,children:(0,R.jsxs)(`div`,{style:{pointerEvents:n?`auto`:`none`},children:[(0,R.jsx)(`div`,{role:`presentation`,className:`modal-root__overlay`,onClick:t,style:{backgroundColor:r}}),(0,R.jsx)(`div`,{role:`dialog`,className:`modal-root__container`,children:e})]})})}},ce=E(se),X=(0,L.forwardRef)(({src:e,alt:t,lang:n,width:r,height:i,onClick:a,onMouseDown:o,onTouchStart:s},c)=>{let[l,u]=(0,L.useState)(!0),d=(0,L.useCallback)(()=>{u(!1)},[u]),f=(0,L.useCallback)(e=>{e.stopPropagation(),a?.(e)},[a]);return(0,R.jsxs)(`div`,{className:`gifv`,children:[l&&(0,R.jsx)(`canvas`,{role:`button`,tabIndex:0,"aria-label":t,lang:n,onClick:f}),(0,R.jsx)(`video`,{ref:c,src:e,role:`button`,tabIndex:0,"aria-label":t,lang:n,width:r,height:i,muted:!0,loop:!0,autoPlay:!0,playsInline:!0,onClick:f,onLoadedData:d,onMouseDown:o,onTouchStart:s})]})});X.displayName=`GIFV`;var le=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~`.split(``),ue=e=>{let t=0,n;for(let r of e)n=le.indexOf(r),t=t*83+n;return t},de=e=>({r:Math.max(0,e>>16),g:Math.max(0,e>>8&255),b:Math.max(0,e&255)}),fe=e=>e?de(ue(e.slice(2,6))):null,Z=1,pe=4,me=250,he=(e,t,n,r)=>{let{clientWidth:i,clientHeight:a}=e,{offsetWidth:o,offsetHeight:s}=t;return{containerWidth:i,containerHeight:a,imageWidth:o,imageHeight:s,initialScale:(n/r<i/a?`width`:`height`)==`width`?Math.min(i,n)/o:Math.min(a,r)/s}},ge=te([F,P]),_e=(e,t)=>{if(!e||t===Z)return{left:-1/0,right:1/0,top:-1/0,bottom:1/0};let{containerWidth:n,containerHeight:r,imageWidth:i,imageHeight:a}=e;return{left:-Math.max(i*t-n,0)/2,right:Math.max(i*t-n,0)/2,top:-Math.max(a*t-r,0)/2,bottom:Math.max(a*t-r,0)/2}},ve=({alt:e=``,lang:t=``,src:n,width:r,height:i,onClick:l,onDoubleClick:u,onClose:d,onZoomChange:f,zoomedIn:p,blurhash:m})=>{(0,L.useEffect)(()=>{let e=e=>{e.preventDefault()};return document.addEventListener(`gesturestart`,e),document.addEventListener(`gesturechange`,e),document.addEventListener(`gestureend`,e),()=>{document.removeEventListener(`gesturestart`,e),document.removeEventListener(`gesturechange`,e),document.removeEventListener(`gestureend`,e)}},[]);let[h,g]=(0,L.useState)(!1),[_,v]=(0,L.useState)(!1),[y,x]=(0,L.use
13State)(!1),S=(0,L.useRef)(null),C=(0,L.useRef)(null),w=(0,L.useRef)(null),E=(0,L.useRef)(null),[D,O]=a(()=>({x:0,y:0,scale:1,onRest:{scale({value:e}){f&&f(e!==Z)}}}));ge({onDrag({pinching:e,cancel:t,active:n,last:r,offset:[i,a],velocity:[,s],direction:[,c],tap:f}){if(f){w.current?(clearTimeout(w.current),w.current=null,u?.()):w.current=setTimeout(()=>{l?.(),w.current=null},me);return}if(!p){if(r){(s>.5&&c!==0||Math.abs(a)>150)&&d?.(),O.start({y:0,config:o.wobbly});return}if(c!==0){O.start({y:a,immediate:!0});return}t();return}if(e){t();return}g(!!n),O.start({x:i,y:a})},onPinch({origin:[e,t],first:n,movement:[r],offset:[i],memo:a}){if(!C.current)return;if(n){let{width:n,height:r,x:i,y:o}=C.current.getBoundingClientRect(),s=e-(i+n/2),c=t-(o+r/2);a=[D.x.get(),D.y.get(),s,c]}let o=a[0]-(r-1)*a[2],s=a[1]-(r-1)*a[3];return O.start({scale:i,x:o,y:s}),a}},{target:C,drag:{from:()=>[D.x.get(),D.y.get()],filterTaps:!0,bounds:()=>_e(E.current,D.scale.get()),rubberband:!0},pinch:{scaleBounds:{min:Z,max:pe},rubberband:!0}}),(0,L.useEffect)(()=>{!_||!S.current||!C.current||(E.current=he(S.current,C.current,r,i),p?D.scale.get()===Z&&O.start({scale:E.current.initialScale,x:0,y:0}):O.start({scale:Z,x:0,y:0}))},[O,D.scale,p,r,i,_]);let k=(0,L.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),A=(0,L.useCallback)(()=>{v(!0)},[v]),j=(0,L.useCallback)(()=>{x(!0)},[x]),M=s([D.scale,D.x,D.y],(e,t,n)=>`matrix(${e}, 0, 0, ${e}, ${t}, ${n})`);return(0,R.jsxs)(`div`,{className:(0,I.default)(`zoomable-image`,{"zoomable-image--zoomed-in":p,"zoomable-image--error":y,"zoomable-image--dragging":h}),ref:S,children:[!_&&m&&(0,R.jsx)(`div`,{className:`zoomable-image__preview`,style:{aspectRatio:`${r}/${i}`,height:`min(${i}px, 100%)`},children:(0,R.jsx)(T,{hash:m})}),(0,R.jsx)(c.img,{style:{transform:M},ref:C,alt:e,lang:t,src:n,width:r,height:i,draggable:!1,onLoad:A,onError:j,onClickCapture:k}),!_&&!y&&(0,R.jsx)(b,{})]})},ye=e=>(0,R.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:24,viewBox:`0 -960 960 960`,width:24,...e,children:(0,R.jsx)(`path`,{d:`M800-600v-120H680v-80h120q33 0 56.5 23.5T880-720v120h-80Zm-720 0v-120q0-33 23.5-56.5T160-800h120v80H160v120H80Zm600 440v-80h120v-120h80v120q0 33-23.5 56.5T800-160H680Zm-520 0q-33 0-56.5-23.5T80-240v-120h80v120h120v80H160Zm80-160v-320h480v320H240Zm80-80h320v-160H320v160Zm0 0v-160 160Z`})}),be=e=>(0,R.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,R.jsx)(`path`,{d:`M3.1002 20.2C2.46686 20.2 1.9252 19.9833 1.4752 19.55C1.04186 19.1 0.825195 18.5583 0.825195 17.925V6.07499C0.825195 5.44165 1.04186 4.90832 1.4752 4.47499C1.9252 4.02499 2.46686 3.79999 3.1002 3.79999H20.9002C21.5335 3.79999 22.0669 4.02499 22.5002 4.47499C22.9502 4.90832 23.1752 5.44165 23.1752 6.07499V17.925C23.1752 18.5583 22.9502 19.1 22.5002 19.55C22.0669 19.9833 21.5335 20.2 20.9002 20.2H3.1002ZM3.1002 17.925H20.9002V6.07499H3.1002V17.925Z`,fill:`black`}),(0,R.jsx)(`path`,{d:`M8.12522 16V9.85782H6.25043V8H10V16H8.12522ZM11.1461 16V14.1422H13.0209V16H11.1461ZM15.1252 16V9.85782H13.2313V8H17V16H15.1252ZM11.1461 12.8578V11H13.0209V12.8578H11.1461Z`,fill:`black`})]}),Q=r({close:{id:`lightbox.close`,defaultMessage:`Close`},previous:{id:`lightbox.previous`,defaultMessage:`Previous`},next:{id:`lightbox.next`,defaultMessage:`Next`},zoomIn:{id:`lightbox.zoom_in`,defaultMessage:`Zoom to actual size`},zoomOut:{id:`lightbox.zoom_out`,defaultMessage:`Zoom to fit`}}),xe=400,$=getComputedStyle(document.body).direction!==`rtl`,Se=(0,L.forwardRef)(({media:e,onClose:t,index:r,lang:i,currentTime:o,autoPlay:s,volume:l,statusId:u,onChangeBackgroundColor:d},f)=>{let[p,m]=(0,L.useState)(r),[h,g]=(0,L.useState)(!1),_=e.get(p),v=$?`-`:``,[b,C]=a(()=>({x:`${v}${p*100}%`})),T=(0,L.useCallback)((t,n=!1)=>{t<0?t=e.size+t:t>=e.size&&(t%=e.size),m(t),g(!1),n&&C.start({x:`calc(${v}${t*100}% + 0px)`})},[C,e.size,v]),E=(0,L.useCallback)(()=>{T(p-1,!0)},[T,p]),D=(0,L.useCallback)(()=>{T(p+1,!0)},[T,p]),O=(0,L.useCallback)(e=>{let t=$?`ArrowLeft`:`ArrowRight`,n=$?`ArrowRight`:`ArrowLeft`;e.key===t?(E(),e.preventDefault(),e.stopPropagation()):e.key===n&&(D(),e.preventDefault(),e.stopPropagation())},[D,E]),k=ee(({active:e,movement:[t],direction:[n],cancel:r})=>{if(h)return;e&&Math.abs(t)>Math.min(window.innerWidth/4,xe)&&(T($?p-n:p+n),r());let i=e?t:0,a=$?`+`:`-`;C.start({x:`calc(${v}${p*100}% ${a} ${i}px)`})},{pointer:{capture:!1}});(0,L.useEffect)(()=>
13(window.addEventListener(`keydown`,O,!1),()=>{window.removeEventListener(`keydown`,O)}),[O]),(0,L.useEffect)(()=>{let e=_?.get(`blurhash`);if(e){let t=fe(e);t&&d(t)}return()=>{d(null)}},[_,d]);let[A,j]=(0,L.useState)({width:0,height:0}),M=(0,L.useCallback)(e=>{typeof f==`function`?f(e):f&&(f.current=e),e?.clientWidth&&e.clientHeight&&j({width:e.clientWidth,height:e.clientHeight})},[f]),N=_?.get(`type`)===`image`&&(_.getIn([`meta`,`original`,`width`])>A.width||_.getIn([`meta`,`original`,`height`])>A.height),P=(0,L.useCallback)(()=>{g(e=>!e)},[]),[F,te]=(0,L.useState)(!1),z=(0,L.useCallback)(()=>{te(e=>!e)},[]),V=(0,L.useMemo)(()=>e.map((e,n)=>{let r=e.get(`url`),a=e.get(`blurhash`),c=e.getIn([`meta`,`original`,`width`],0),u=e.getIn([`meta`,`original`,`height`],0),d=e.getIn([`translation`,`description`],e.get(`description`));return e.get(`type`)===`image`?(0,R.jsx)(ve,{src:r,blurhash:a,width:c,height:u,alt:d,lang:i,onClick:z,onDoubleClick:P,onClose:t,onZoomChange:g,zoomedIn:h&&n===p},r):e.get(`type`)===`video`?(0,R.jsx)(w,{preview:e.get(`preview_url`),blurhash:a,src:r,frameRate:e.getIn([`meta`,`original`,`frame_rate`]),aspectRatio:`${c} / ${u}`,startTime:o??0,startPlaying:s??!1,startVolume:l??1,onCloseVideo:t,detailed:!0,alt:d,lang:i},r):e.get(`type`)===`gifv`?(0,R.jsx)(X,{src:r,alt:d,lang:i,onClick:z},r):null}),[s,o,z,P,p,i,e,t,l,h]),H=n(),U=e.size>1&&(0,R.jsx)(`button`,{className:`media-modal__nav media-modal__nav--prev`,onClick:E,"aria-label":H.formatMessage(Q.previous),type:`button`,children:(0,R.jsx)(S,{id:`chevron-left`,icon:ne})}),W=e.size>1&&(0,R.jsx)(`button`,{className:`media-modal__nav media-modal__nav--next`,onClick:D,"aria-label":H.formatMessage(Q.next),type:`button`,children:(0,R.jsx)(S,{id:`chevron-right`,icon:re})});return(0,R.jsxs)(`div`,{...k(),className:`modal-root__modal media-modal`,ref:M,children:[(0,R.jsx)(c.div,{style:b,className:`media-modal__closer`,role:`presentation`,onClick:t,children:V}),(0,R.jsxs)(`div`,{className:(0,I.default)(`media-modal__navigation`,{"media-modal__navigation--hidden":F}),children:[(0,R.jsxs)(`div`,{className:`media-modal__buttons`,children:[N&&(0,R.jsx)(x,{title:H.formatMessage(h?Q.zoomOut:Q.zoomIn),icon:``,iconComponent:h?ye:be,onClick:P}),(0,R.jsx)(x,{title:H.formatMessage(Q.close),icon:`times`,iconComponent:y,onClick:t})]}),U,W,(0,R.jsxs)(`div`,{className:`media-modal__overlay`,children:[(0,R.jsx)(Ce,{itemsCount:e.size,index:p,onChangeIndex:T}),u&&(0,R.jsx)(B,{statusId:u,withOpenButton:!0,onClose:t})]})]})]})});Se.displayName=`MediaModal`;var Ce=({itemsCount:e,index:t,onChangeIndex:n})=>{let r=(0,L.useCallback)(e=>()=>{n(e)},[n]);return e<=1?null:(0,R.jsx)(`ul`,{className:`media-modal__pagination`,children:Array.from({length:e}).map((e,n)=>(0,R.jsx)(`button`,{className:(0,I.default)(`media-modal__page-dot`,{active:n===t}),onClick:r(n),type:`button`,children:n+1},n))})};export{ce as a,X as i,ve as n,B as o,fe as r,Se as t}; 14//# sourceMappingURL=media_modal-DI6DnQN5.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.