PageSourceSearch

https://mastodon.f-si.org/packs/media_modal-CgNxzhMb.js

js f-si.org collected 2026-10-02 03:21:43 UTC 24,295 bytes, 14 lines download raw bytes

1import{o as e}from"./chunk-CMxvf4Kt.js";import{n as t,t as n}from"./jsx-runtime-SsSjplwM.js";import{c as r,s as i}from"./react-intl-Cop388b4.js";import{$ as a,C as o,J as s,Q as c,S as l,at as u,ct as d,d as f,nt as p,ot as m,r as h,rt as g,st as _,w as v,x as y}from"./poll-DJxDglHc.js";import{Fi as b,J as x,ei as S,qt as C}from"./render-BfCN-2W_.js";import{m as w,s as T}from"./react-router-BzQH59UT.js";import{t as E}from"./defineProperty-ClgyJMzY.js";import{o as D,s as O}from"./typed_functions-BF3sY3ZH.js";import{t as k}from"./classnames-CYxIelk8.js";import{t as A}from"./video-C00GqEw4.js";import{a as j,d as M,f as N,o as P}from"./card-CE3O92Qc.js";import{i as F,n as ee,r as I,t as L}from"./use-gesture-react.esm-CkIoXYZ6.js";import{t as te}from"./chevron_left-CiGtVExw.js";var R=e(k()),z=e(t()),B=n(),V=i({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`}}),H=({statusId:e,withOpenButton:t,onClose:n})=>{let{signedIn:i}=s(),a=r(),u=T(),d=D(),p=(0,z.useMemo)(()=>f(),[]),m=O(t=>p(t,{id:e})),h=m?.get(`account`),g=O(e=>e.compose.get(`text`).trim().length!==0),_=(0,z.useCallback)(()=>{m&&(i?(n(!0),d(g?b({modalType:`CONFIRM_REPLY`,modalProps:{status:m}}):S(m))):d(b({modalType:`INTERACTION`,modalProps:{intent:`reply`,accountId:m.getIn([`account`,`id`]),url:m.get(`uri`)}})))},[d,m,i,g,n]),v=(0,z.useCallback)(()=>{m&&d(i?x(m.get(`id`)):b({modalType:`INTERACTION`,modalProps:{intent:`favourite`,accountId:m.getIn([`account`,`id`]),url:m.get(`uri`)}}))},[d,m,i]),C=(0,z.useCallback)(e=>{e.button!==0||!m||(n(),u.push(`/@${h?.acct}/${m.get(`id`)}`))},[u,m,h,n]);if(!m)return null;let w,E,k;m.get(`in_reply_to_id`,null)===null?(w=`reply`,E=o,k=a.formatMessage(V.reply)):(w=`reply-all`,E=M,k=a.formatMessage(V.replyAll));let A=a.formatMessage(m.get(`favourited`)?V.removeFavourite:V.favourite);return(0,B.jsxs)(`div`,{className:`picture-in-picture__footer`,children:[(0,B.jsx)(c,{className:`status__action-bar-button`,title:k,icon:m.get(`in_reply_to_account_id`)===m.getIn([`account`,`id`])?`reply`:w,iconComponent:m.get(`in_reply_to_account_id`)===m.getIn([`account`,`id`])?o:E,onClick:_,counter:m.get(`replies_count`)}),(0,B.jsx)(P,{counters:!0,status:m}),(0,B.jsx)(c,{className:`status__action-bar-button star-icon`,animate:!0,active:m.get(`favourited`),title:A,icon:`star`,iconComponent:m.get(`favourited`)?l:y,onClick:v,counter:m.get(`favourites_count`)}),t&&(0,B.jsx)(c,{className:`status__action-bar-button`,title:a.formatMessage(V.open),icon:`external-link`,iconComponent:N,onClick:C,href:`/@${h?.acct}/${m.get(`id`)}`})]})},U=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 W(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){W(this,r),this._inertManager=t,this._rootElement=e,this._managedNodes=new Set,this._rootElement.hasAttribute(`aria-hidden`)?this._savedAriaHidden=this._rootElement.getAttribute(`aria-hidden`):this._savedAriaHidden=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 U(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){W(this,e),this._node=t,this._overrodeFocusMethod=!1,this._inertRoots=new Set([n]),this._savedTabIndex=null,this._destroyed=!1,this.ensureUntabbable()}return U(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(W(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 U(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);break}},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 G(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 ne(e,t){return e*t}function K(e,t,n){return Math.min(Math.max(e||0,t),n)}function q(e){return{r:K(e.r,0,255),g:K(e.g,0,255),b:K(e.b,0,255),a:K(e.a,0,1)}}function J(e){return{r:255*e.r,g:255*e.g,b:255*e.b,a:e.a}}function re(e){return{r:e.r/255,g:e.g/255,b:e.b/255,a:e.a}}function Y(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 X(e,t,n,r,i,a){return(1-t/n)*r+t/n*Math.round((1-e)*i+e*a)}function ie(e,t,n,r,i){i===void 0&&(i={unitInput:!1,unitOutput:!1,roundOutput:!0}),i.unitInput&&(e=J(e),t=J(t)),e=q(e);var a=(t=q(t)).a+e.a-t.a*e.a,o=n(e,t,r),s=q({r:X(e.a,t.a,a,e.r,t.r,o.r),g:X(e.a,t.a,a,e.g,t.g,o.g),b:X(e.a,t.a,a,e.b,t.b,o.b),a});return s=i.unitOutput?re(s):i.roundOutput?Y(s):function(e){return Y(e,9)}(s),s}function ae(e,t){return ie(e,t,G,ne)}var oe=j(class extends z.PureComponent{constructor(...e){super(...e),E(this,`activeElement`,this.props.children?document.activeElement:null),E(this,`handleKeyUp`,e=>{(e.key===`Escape`||e.key===`Esc`||e.keyCode===27)&&this.props.children&&this.props.onClose()}),E(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())}}),E(this,`getSiblings`,()=>Array(...this.node.parentElement.childNodes).filter(e=>e!==this.node)),E(this,`setRef`,e=>{this.node=e})}componentDidMount(){window.addEventListener(`keyup`,this.handleKeyUp,!1),window.addEventListener(`keydown`,this.handleKeyDown,!1),this.history=this.props.history||w()}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!==C,mastodonModalKey:this._modalHistoryKey})}render(){let{children:e,onClose:t}=this.props,n=!!e;if(!n)return(0,B.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=ae({...this.props.backgroundColor,a:1},{r:0,g:0,b:0,a:.7});r=`rgb(${e.r}, ${e.g}, ${e.b})`}return(0,B.jsx)(`div`,{className:`modal-root`,ref:this.setRef,children:(0,B.jsxs)(`div`,{style:{pointerEvents:n?`auto`:`none`},children:[(0,B.jsx)(`div`,{role:`presentation`,className:`modal-root__overlay`,onClick:t,style:{backgroundColor:r}}),(0,B.jsx)(`div`,{role:`dialog`,className:`modal-root__container`,children:e})]})})}}),Z=(0,z.forwardRef)(({src:e,alt:t,lang:n,width:r,height:i,onClick:a,onMouseDown:o,onTouchStart:s},c)=>{let[l,u]=(0,z.useState)(!0),d=(0,z.useCallback)(()=>{u(!1)},[u]),f=(0,z.useCallback)(e=>{e.stopPropagation(),a?.(e)},[a]);return(0,B.jsxs)(`div`,{className:`gifv`,children:[l&&(0,B.jsx)(`canvas`,{role:`button`,tabIndex:0,"aria-label":t,lang:n,onClick:f}),(0,B.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})]})});Z.displayName=`GIFV`;var se=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz#$%*+,-.:;=?@[]^_{|}~`.split(``),ce=e=>{let t=0,n;for(let r of e)n=se.indexOf(r),t=t*83+n;return t},le=e=>({r:Math.max(0,e>>16),g:Math.max(0,e>>8&255),b:Math.max(0,e&255)}),ue=e=>e?le(ce(e.slice(2,6))):null,Q=1,de=4,fe=250,pe=(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}},me=L([I,F]),he=(e,t)=>{if(!e||t===Q)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}},ge=({alt:e=``,lang:t=``,src:n,width:r,height:i,onClick:a,onDoubleClick:o,onClose:s,onZoomChange:c,zoomedIn:l,blurhash:f})=>{(0,z.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,z.useState)(!1),[y,b]=(0,z.useState)(!1),[x,S]=(0,z.useState)(!1),C=(0,z.useRef)(null),w=(0,z.useRef)(null),T=(0,z.useRef)(),E=(0,z.useRef)(null),[D,O]=d(()=>({x:0,y:0,scale:1,onRest:{scale({value:e}){c&&c(e!==Q)}}}));me({onDrag({pinching:e,cancel:t,active:n,last:r,offset:[i,c],velocity:[,u],direction:[,d],tap:f}){if(f){T.current?(clearTimeout(T.current),T.current=null,o?.()):T.current=setTimeout(()=>{a?.(),T.current=null},fe);return}if(!l){if(r){(u>.5&&d!==0||Math.abs(c)>150)&&s?.(),O.start({y:0,config:m.wobbly});return}else if(d!==0){O.start({y:c,immediate:!0});return}t();return}if(e){t();return}g(!!n),O.start({x:i,y:c})},onPinch({origin:[e,t],first:n,movement:[r],offset:[i],memo:a}
13){if(!w.current)return;if(n){let{width:n,height:r,x:i,y:o}=w.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:w,drag:{from:()=>[D.x.get(),D.y.get()],filterTaps:!0,bounds:()=>he(E.current,D.scale.get()),rubberband:!0},pinch:{scaleBounds:{min:Q,max:de},rubberband:!0}}),(0,z.useEffect)(()=>{!y||!C.current||!w.current||(E.current=pe(C.current,w.current,r,i),l?D.scale.get()===Q&&O.start({scale:E.current.initialScale,x:0,y:0}):O.start({scale:Q,x:0,y:0}))},[O,D.scale,l,r,i,y]);let k=(0,z.useCallback)(e=>{e.preventDefault(),e.stopPropagation()},[]),A=(0,z.useCallback)(()=>{b(!0)},[b]),j=(0,z.useCallback)(()=>{S(!0)},[S]),M=_([D.scale,D.x,D.y],(e,t,n)=>`matrix(${e}, 0, 0, ${e}, ${t}, ${n})`);return(0,B.jsxs)(`div`,{className:(0,R.default)(`zoomable-image`,{"zoomable-image--zoomed-in":l,"zoomable-image--error":x,"zoomable-image--dragging":h}),ref:C,children:[!y&&f&&(0,B.jsx)(`div`,{className:`zoomable-image__preview`,style:{aspectRatio:`${r}/${i}`,height:`min(${i}px, 100%)`},children:(0,B.jsx)(v,{hash:f})}),(0,B.jsx)(u.img,{style:{transform:M},ref:w,alt:e,lang:t,src:n,width:r,height:i,draggable:!1,onLoad:A,onError:j,onClickCapture:k}),!y&&!x&&(0,B.jsx)(p,{})]})},_e=e=>(0,B.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:24,viewBox:`0 -960 960 960`,width:24,...e,children:(0,B.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`})}),ve=e=>(0,B.jsxs)(`svg`,{width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,...e,children:[(0,B.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,B.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`})]}),$=i({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`}}),ye=400,be=(0,z.forwardRef)(({media:e,onClose:t,index:n,lang:i,currentTime:o,autoPlay:s,volume:l,statusId:f,onChangeBackgroundColor:p},m)=>{let[_,v]=(0,z.useState)(n),[y,b]=(0,z.useState)(!1),x=e.get(_),[S,C]=d(()=>({x:`-${_*100}%`})),w=(0,z.useCallback)((t,n=!1)=>{t<0?t=e.size+t:t>=e.size&&(t%=e.size),v(t),b(!1),n&&C.start({x:`calc(-${t*100}% + 0px)`})},[C,e.size]),T=(0,z.useCallback)(()=>{w(_-1,!0)},[w,_]),E=(0,z.useCallback)(()=>{w(_+1,!0)},[w,_]),D=(0,z.useCallback)(e=>{e.key===`ArrowLeft`?(T(),e.preventDefault(),e.stopPropagation()):e.key===`ArrowRight`&&(E(),e.preventDefault(),e.stopPropagation())},[E,T]),O=ee(({active:e,movement:[t],direction:[n],cancel:r})=>{if(y)return;e&&Math.abs(t)>Math.min(window.innerWidth/4,ye)&&(w(_-n),r());let i=e?t:0;C.start({x:`calc(-${_*100}% + ${i}px)`})},{pointer:{capture:!1}});(0,z.useEffect)(()=>(window.addEventListener(`keydown`,D,!1),()=>{window.removeEventListener(`keydown`,D)}),[D]),(0,z.useEffect)(()=>{let e=x?.get(`blurhash`);if(e){let t=ue(e);t&&p(t)}return()=>{p(null)}},[x,p]);let[k,j]=(0,z.useState)({width:0,height:0}),M=(0,z.useCallback)(e=>{e?.clientWidth&&e.clientHeight&&j({width:e.clientWidth,height:e.clientHeight})},[]),N=x?.get(`type`)===`image`&&(x.getIn([`meta`,`original`,`width`])>k.width||x.getIn([`meta`,`original`,`height`])>k.height),P=(0,z.useCallback)(()=>{b(e=>!e)},[]),[F,I]=(0,z.useState)(!1),L=(0,z.useCallback)(()=>{I(e=>!e)},[]),V=(0,z.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,B.jsx)(ge,{src:r,blurhash:a,width:c,height:u,alt:d,lang:i,onClick:L,onDoubleClick:P,onClose:t,onZoomChange:b,zoomedIn:y&&n===_},r):e.get(`type`)===`video`?(0,B.jsx)(A,{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,B.jsx)(Z,{src:r,alt:d,lang:i,onClick:L},r):null}),[s,o,L,P,_,i,e,t,l,y]),U=r(),W=e.size>1&&(0,B.jsx)(`button`,{tabIndex:0,className:`media-modal__nav media-modal__nav--prev`,onClick:T,"aria-label":U.formatMessage($.previous),type:`button`,children:(0,B.jsx)(a,{id:`chevron-left`,icon:te})}),G=e.size>1&&(0,B.jsx)(`button`,{tabIndex:0,className:`media-modal__nav  media-modal__nav--next`,onClick:E,"aria-label":U.formatMessage($.next),type:`button`,children:(0,B.jsx)(a,{id:`chevron-right`,icon:h})});return(0,B.jsxs)(`div`,{...O(),className:`modal-root__modal media-modal`,ref:M,children:[(0,B.jsx)(u.div,{style:S,className:`media-modal__closer`,role:`presentation`,onClick:t,children:V}),(0,B.jsxs)(`div`,{className:(0,R.default)(`media-modal__navigation`,{"media-modal__navigation--hidden":F}),children:[(0,B.jsxs)(`div`,{className:`media-modal__buttons`,children:[N&&(0,B.jsx)(c,{title:U.formatMessage(y?$.zoomOut:$.zoomIn),icon:``,iconComponent:y?_e:ve,onClick:P}),(0,B.jsx)(c,{title:U.formatMessage($.close),icon:`times`,iconComponent:g,onClick:t})]}),W,G,(0,B.jsxs)(`div`,{className:`media-modal__overlay`,children:[(0,B.jsx)(xe,{itemsCount:e.size,index:_,onChangeIndex:w}),f&&(0,B.jsx)(H,{statusId:f,withOpenButton:!0,onClose:t})]})]})]})});be.displayName=`MediaModal`;var xe=({itemsCount:e,index:t,onChangeIndex:n})=>{let r=(0,z.useCallback)(e=>()=>{n(e)},[n]);return e<=1?null:(0,B.jsx)(`ul`,{className:`media-modal__pagination`,children:Array.from({length:e}).map((e,n)=>(0,B.jsx)(`button`,{className:(0,R.default)(`media-modal__page-dot`,{active:n===t}),onClick:r(n),type:`button`,children:n+1},n))})};export{oe as a,Z as i,ge as n,H as o,ue as r,be as t};
14//# sourceMappingURL=media_modal-CgNxzhMb.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.