element-web-synapse01pim.gr.jp

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

1422.js (25907B)


      1 "use strict";(self.webpackChunkelement_web=self.webpackChunkelement_web||[]).push([[1422],{"./node_modules/@vector-im/compound-design-tokens/assets/web/icons/mic-on.js":(e,t,o)=>{o.d(t,{A:()=>i});var n=o("./node_modules/react/index.js"),s=o("./node_modules/react/jsx-runtime.js");function r(e,t){return(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 24 24",ref:t,...e,children:[(0,s.jsx)("path",{d:"M6 12a1 1 0 1 0-2 0 8 8 0 0 0 7 7.938V21a1 1 0 1 0 2 0v-1.062A8 8 0 0 0 20 12a1 1 0 1 0-2 0 6 6 0 0 1-12 0"}),(0,s.jsx)("path",{fillRule:"evenodd",d:"M14 12V6a2 2 0 1 0-4 0v6a2 2 0 1 0 4 0M12 2a4 4 0 0 0-4 4v6a4 4 0 0 0 8 0V6a4 4 0 0 0-4-4",clipRule:"evenodd"})]})}r.displayName="MicOnIcon";const i=(0,n.forwardRef)(r)},"./node_modules/@vector-im/compound-design-tokens/assets/web/icons/reaction.js":(e,t,o)=>{o.d(t,{A:()=>i});var n=o("./node_modules/react/index.js"),s=o("./node_modules/react/jsx-runtime.js");function r(e,t){return(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 24 24",ref:t,...e,children:[(0,s.jsx)("path",{d:"M15.536 15.536a1 1 0 0 0-1.415-1.415 3 3 0 0 1-2.12.879 3 3 0 0 1-2.122-.879 1 1 0 1 0-1.414 1.415A5 5 0 0 0 12 17c1.38 0 2.632-.56 3.536-1.464M10 10.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m5.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"}),(0,s.jsx)("path",{d:"M22 12c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2s10 4.477 10 10m-2 0a8 8 0 1 0-16 0 8 8 0 0 0 16 0"})]})}r.displayName="ReactionIcon";const i=(0,n.forwardRef)(r)},"./node_modules/@vector-im/compound-design-tokens/assets/web/icons/sticker.js":(e,t,o)=>{o.d(t,{A:()=>i});var n=o("./node_modules/react/index.js"),s=o("./node_modules/react/jsx-runtime.js");function r(e,t){return(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 24 24",ref:t,...e,children:(0,s.jsx)("path",{fillRule:"evenodd",d:"M17 2a5 5 0 0 1 5 4.999v5.335a5 5 0 0 1-1.58 3.647l-4.978 4.667A5 5 0 0 1 12.023 22H7l-.258-.007A5 5 0 0 1 2 17V7a5 5 0 0 1 5-5zM7 4a3 3 0 0 0-3 3v10a3 3 0 0 0 2.999 3H12v-4a4 4 0 0 1 4-4h4V6.999A3 3 0 0 0 17 4zm9 10a2 2 0 0 0-2 2v3.251l.074-.062 4.978-4.666q.252-.238.441-.523z",clipRule:"evenodd"})})}r.displayName="StickerIcon";const i=(0,n.forwardRef)(r)},"./node_modules/@vector-im/compound-design-tokens/assets/web/icons/text-formatting.js":(e,t,o)=>{o.d(t,{A:()=>i});var n=o("./node_modules/react/index.js"),s=o("./node_modules/react/jsx-runtime.js");function r(e,t){return(0,s.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 24 24",ref:t,...e,children:(0,s.jsx)("path",{d:"M6 19a.97.97 0 0 1-.713-.288A.97.97 0 0 1 5 18q0-.424.287-.712A.97.97 0 0 1 6 17h12q.424 0 .712.288.288.287.288.712 0 .424-.288.712A.97.97 0 0 1 18 19zm1.35-5.2 3.425-9.2a.9.9 0 0 1 .338-.437A.93.93 0 0 1 11.65 4h.7q.3 0 .537.162.238.163.338.438l3.425 9.225q.15.425-.1.8a.8.8 0 0 1-.7.375.9.9 0 0 1-.512-.162A.9.9 0 0 1 15 14.4l-.75-2.2H9.8L9 14.425a.84.84 0 0 1-.325.425q-.225.15-.5.15a.84.84 0 0 1-.738-.387.82.82 0 0 1-.087-.813m3-3.2h3.3l-1.6-4.55h-.1z"})})}r.displayName="TextFormattingIcon";const i=(0,n.forwardRef)(r)},"./src/components/views/location/LocationButton.tsx":(e,t,o)=>{o.r(t),o.d(t,{default:()=>me});var n=o("./node_modules/react/index.js"),s=o("./node_modules/classnames/index.js"),r=o.n(s),i=o("./node_modules/react/jsx-runtime.js");function a(e,t){return(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 24 24",ref:t,...e,children:(0,i.jsx)("path",{d:"M12 19.35q3.05-2.8 4.525-5.088Q18 11.976 18 10.2q0-2.725-1.738-4.462Q14.526 4 12 4T7.738 5.737Q6 7.476 6 10.2q0 1.775 1.475 4.063Q8.95 16.549 12 19.35m0 1.975a2.1 2.1 0 0 1-.7-.125 1.8 1.8 0 0 1-.625-.375A39 39 0 0 1 7.8 17.9q-1.25-1.425-2.087-2.762-.838-1.338-1.275-2.575Q4 11.325 4 10.2q0-3.75 2.412-5.975T12 2t5.587 2.225T20 10.2q0 1.125-.437 2.363-.438 1.237-1.275 2.574A22 22 0 0 1 16.2 17.9a39 39 0 0 1-2.875 2.925 1.8 1.8 0 0 1-.625.375 2.1 2.1 0 0 1-.7.125M12 12q.825 0 1.412-.588Q14 10.826 14 10t-.588-1.412A1.93 1.93 0 0 0 12 8q-.825 0-1.412.588A1.93 1.93 0 0 0 10 10q0 .825.588 1.412Q11.175 12 12 12"})})}a.displayName="LocationPinIcon";const l=(0,n.forwardRef)(a);var c=o("./src/languageHandler.tsx"),m=o("./src/components/views/rooms/CollapsibleButton.tsx"),d=o("./src/components/structures/ContextMenu.tsx"),u=o("./src/components/views/rooms/MessageComposerButtons.tsx"),p=o("./node_modules/@babel/runtime/helpers/esm/extends.js"),h=o("./src/contexts/MatrixClientContext.tsx"),_=o("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),v=o("./node_modules/maplibre-gl/dist/maplibre-gl.js"),g=o.n(v),x=o("./node_modules/matrix-js-sdk/src/logger.ts"),k=o("./node_modules/matrix-js-sdk/src/matrix.ts"),b=o("./src/Modal.tsx"),E=o("./src/utils/WellKnownUtils.ts"),w=o("./src/utils/beacon/index.ts"),C=o("./src/utils/location/index.ts"),y=o("./src/components/views/dialogs/ErrorDialog.tsx"),f=o("./src/components/views/elements/AccessibleButton.tsx"),A=o("./src/components/views/location/MapError.tsx"),M=o("./src/DateUtils.ts"),j=o("./src/components/views/elements/Dropdown.tsx");const S={fifteenMins:9e5,oneHour:36e5,eightHours:288e5},L=S.fifteenMins,T=e=>(0,c._t)("location_sharing|live_share_button",{duration:(0,M.a3)(e)}),N=({timeout:e,onChange:t})=>{const o=Object.values(S).map(e=>({key:e.toString(),duration:e,label:T(e)}));Object.values(S).includes(e)||o.push({key:e.toString(),duration:e,label:T(e)});return n.createElement(j.A,{id:"live-duration",label:T(e),value:e.toString(),onOptionChange:e=>{t(+e)},className:"mx_LiveDurationDropdown"},o.map(({key:e,label:t})=>n.createElement("div",{key:e},t)))};var B=o("./src/components/views/dialogs/QuestionDialog.tsx"),P=o("./src/SdkConfig.ts"),R=o("./src/stores/OwnBeaconStore.ts"),I=o("./src/utils/local-room.ts");let F=function(e){return e.Own="Own",e.Pin="Pin",e.Live="Live",e}({});const O=(e,t,o)=>{const{modalParams:n,errorMessage:s}="M_FORBIDDEN"===e.errcode?(e=>{const t=e===F.Live?"Insufficient permissions to start sharing your live location":"Insufficient permissions to send your location";return{modalParams:{title:(0,c._t)("location_sharing|error_no_perms_title"),description:(0,c._t)("location_sharing|error_no_perms_description"),button:(0,c._t)("action|ok"),hasCancelButton:!1,onFinished:()=>{}},errorMessage:t}})(o):((e,t)=>{const o=e===F.Live?"We couldn't start sharing your live location":"We couldn't send your location";return{modalParams:{title:(0,c._t)("location_sharing|error_send_title"),description:(0,c._t)("location_sharing|error_send_description",{brand:P.Ay.get().brand}),button:(0,c._t)("action|try_again"),cancelButton:(0,c._t)("action|cancel"),onFinished:e=>{e&&t()}},errorMessage:o}})(o,t);x.vF.error(s,e),b.Ay.createDialog(B.A,n)};var D=o("./src/components/views/location/Marker.tsx");const U=e=>e===F.Own||e===F.Live;class q extends n.Component{constructor(e){super(e),(0,_.A)(this,"map",void 0),(0,_.A)(this,"geolocate",void 0),(0,_.A)(this,"marker",void 0),(0,_.A)(this,"getMarkerId",()=>"mx_MLocationPicker_marker"),(0,_.A)(this,"addMarkerToMap",()=>{var e;this.marker=new(g().Marker)({element:null!==(e=document.getElementById(this.getMarkerId()))&&void 0!==e?e:void 0,anchor:"bottom",offset:[0,-1]}).setLngLat(new(g().LngLat)(0,0)).addTo(this.map)}),(0,_.A)(this,"updateStyleUrl",e=>{var t;const o=null===(t=(0,E.XP)(e))||void 0===t?void 0:t.map_style_url;var n;o&&(null===(n=this.map)||void 0===n||n.setStyle(o))}),(0,_.A)(this,"onGeolocate",e=>{var t;this.marker||this.addMarkerToMap(),this.setState({position:(0,w.v9)(e)}),null===(t=this.marker)||void 0===t||t.setLngLat(new(g().LngLat)(e.coords.longitude,e.coords.latitude))}),(0,_.A)(this,"onClick",e=>{var t;this.marker||this.addMarkerToMap(),null===(t=this.marker)||void 0===t||t.setLngLat(e.lngLat),this.setState({position:{timestamp:Date.now(),latitude:e.lngLat.lat,longitude:e.lngLat.lng}})}),(0,_.A)(this,"onGeolocateError",e=>{var t;(x.vF.error("Could not fetch location",e),U(this.props.shareType)&&(this.props.onFinished(),b.Ay.createDialog(y.A,{title:(0,c._t)("location_sharing|error_fetch_location"),description:(0,C.Ff)(e.code)})),this.geolocate)&&(null===(t=this.map)||void 0===t||t.removeControl(this.geolocate))}),(0,_.A)(this,"onTimeoutChange",e=>{this.setState({timeout:e})}),(0,_.A)(this,"onOk",()=>{const{timeout:e,position:t}=this.state;this.props.onChoose(t?{uri:(0,w.mt)(t),timestamp:t.timestamp,timeout:e}:{timeout:e}),this.props.onFinished()}),this.state={position:void 0,timeout:L,error:void 0}}componentDidMount(){this.context.on(k.ClientEvent.ClientWellKnown,this.updateStyleUrl);try{if(this.map=new(g().Map)({container:"mx_LocationPicker_map",style:(0,C.M0)(this.context),center:[0,0],zoom:1}),this.geolocate=new(g().GeolocateControl)({positionOptions:{enableHighAccuracy:!0},trackUserLocation:!1}),this.map.addControl(this.geolocate),this.map.on("error",e=>{x.vF.error("Failed to load map: check map_style_url in config.json has a valid URL and API key",e.error),this.setState({error:C.$X.MapStyleUrlNotReachable})}),this.map.on("load",()=>{var e;null===(e=this.geolocate)||void 0===e||e.trigger()}),this.geolocate.on("error",this.onGeolocateError),U(this.props.shareType)&&this.geolocate.on("geolocate",this.onGeolocate),this.props.shareType===F.Pin){const e=new(g().NavigationControl)({showCompass:!1,showZoom:!0});this.map.addControl(e,"bottom-right"),this.map.on("click",this.onClick)}}catch(e){x.vF.error("Failed to render map",e);const t=null==e?void 0:e.message;let o;o=t===C.$X.MapStyleUrlNotConfigured?C.$X.MapStyleUrlNotConfigured:t.includes("Failed to initialize WebGL")?C.$X.WebGLNotEnabled:C.$X.Default,this.setState({error:o})}}componentWillUnmount(){var e,t,o;null===(e=this.geolocate)||void 0===e||e.off("error",this.onGeolocateError),null===(t=this.geolocate)||void 0===t||t.off("geolocate",this.onGeolocate),null===(o=this.map)||void 0===o||o.off("click",this.onClick),this.context.off(k.ClientEvent.ClientWellKnown,this.updateStyleUrl)}render(){return this.state.error?n.createElement("div",{className:"mx_LocationPicker mx_LocationPicker_hasError"},n.createElement(A.p,{error:this.state.error,onFinished:this.props.onFinished})):n.createElement("div",{className:"mx_LocationPicker"},n.createElement("div",{id:"mx_LocationPicker_map"}),this.props.shareType===F.Pin&&n.createElement("div",{className:"mx_LocationPicker_pinText"},n.createElement("span",null,this.state.position?(0,c._t)("location_sharing|click_move_pin"):(0,c._t)("location_sharing|click_drop_pin"))),n.createElement("div",{className:"mx_LocationPicker_footer"},n.createElement("form",{onSubmit:this.onOk},this.props.shareType===F.Live&&n.createElement(N,{onChange:this.onTimeoutChange,timeout:this.state.timeout}),n.createElement(f.A,{type:"submit",element:"button",kind:"primary",className:"mx_LocationPicker_submitButton",disabled:!this.state.position,onClick:this.onOk},(0,c._t)("location_sharing|share_button")))),n.createElement("div",{id:this.getMarkerId()},!!this.marker&&n.createElement(D.A,{roomMember:U(this.props.shareType)?this.props.sender:void 0,useMemberColor:this.props.shareType===F.Live})))}}(0,_.A)(q,"contextType",h.Ay);const H=q;var z=o("./src/settings/SettingsStore.ts"),G=o("./node_modules/@vector-im/compound-design-tokens/assets/web/icons/close.js"),W=o("./node_modules/@vector-im/compound-design-tokens/assets/web/icons/chevron-left.js");const J=({onBack:e,onCancel:t,displayBack:o})=>n.createElement("div",{className:"mx_ShareDialogButtons"},o&&n.createElement(f.A,{className:"mx_ShareDialogButtons_button left","aria-label":(0,c._t)("action|back"),onClick:e,element:"button"},n.createElement(W.A,{className:"mx_ShareDialogButtons_button-icon"})),n.createElement(f.A,{className:"mx_ShareDialogButtons_button right","aria-label":(0,c._t)("action|close"),onClick:t,element:"button"},n.createElement(G.A,{className:"mx_ShareDialogButtons_button-icon"})));var V=o("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),$=o("./node_modules/@vector-im/compound-design-tokens/assets/web/icons/location-pin-solid.js"),Q=o("./src/stores/OwnProfileStore.ts"),X=o("./src/components/views/avatars/BaseAvatar.tsx"),Z=o("./src/components/views/typography/Heading.tsx"),Y=o("./src/components/views/beacon/StyledLiveBeaconIcon.tsx");const K=["onClick","label","shareType"],ee=()=>{var e,t;const o=(0,n.useContext)(h.Ay).getSafeUserId(),s=null!==(e=Q.V.instance.displayName)&&void 0!==e?e:void 0,r="36px",i=null!==(t=Q.V.instance.getHttpAvatarUrl(parseInt(r,10)))&&void 0!==t?t:void 0;return n.createElement("div",{className:`mx_ShareType_option-icon ${F.Own}`},n.createElement(X.A,{idName:o,name:s,url:i,size:r,className:"mx_UserMenu_userAvatar_BaseAvatar"}))},te=e=>{let{onClick:t,label:o,shareType:s}=e,r=(0,V.A)(e,K);return n.createElement(f.A,(0,p.A)({element:"button",className:"mx_ShareType_option",onClick:null!=t?t:null},r),s===F.Own&&n.createElement(ee,null),s===F.Pin&&n.createElement($.A,{className:`mx_ShareType_option-icon ${F.Pin}`}),s===F.Live&&n.createElement(Y.A,{className:`mx_ShareType_option-icon ${F.Live}`}),o)},oe=({setShareType:e,enabledShareTypes:t})=>{const o={[F.Own]:(0,c._t)("location_sharing|share_type_own"),[F.Live]:(0,c._t)("location_sharing|share_type_live"),[F.Pin]:(0,c._t)("location_sharing|share_type_pin")};return n.createElement("div",{className:"mx_ShareType"},n.createElement($.A,{className:"mx_ShareType_badge"}),n.createElement(Z.A,{className:"mx_ShareType_heading",size:"3"},(0,c._t)("location_sharing|share_type_prompt")),n.createElement("div",{className:"mx_ShareType_wrapper_options"},t.map(t=>n.createElement(te,{key:t,onClick:()=>e(t),label:o[t],shareType:t}))))};var ne=o("./node_modules/@vector-im/compound-web/dist/components/Form/Root.js"),se=o("./node_modules/@vector-im/compound-web/dist/components/Form/Controls/SettingsToggle/SettingsToggle.js"),re=o("./node_modules/@vector-im/compound-web/dist/components/Button/Button.js");const ie=({onSubmit:e})=>{const[t,o]=(0,n.useState)(!1),s=(0,n.useCallback)(e=>o(e.target.checked),[o]),r=(0,n.useCallback)(o=>{o.preventDefault(),o.stopPropagation(),t&&e()},[t,e]);return n.createElement("div",{className:"mx_EnableLiveShare"},n.createElement(Y.A,{className:"mx_EnableLiveShare_icon"}),n.createElement(Z.A,{className:"mx_EnableLiveShare_heading",size:"3"},(0,c._t)("location_sharing|live_enable_heading")),n.createElement("p",{className:"mx_EnableLiveShare_description"},(0,c._t)("location_sharing|live_enable_description")),n.createElement(ne.b,{onSubmit:r},n.createElement(se.I,{name:"enable-live-share-toggle",checked:t,onChange:s,label:(0,c._t)("location_sharing|live_toggle_label")}),n.createElement(re.$,{className:"mx_EnableLiveShare_button",kind:"primary",disabled:!t},(0,c._t)("action|ok"))))};var ae=o("./src/hooks/useSettings.ts"),le=o("./src/settings/SettingLevel.ts");const ce=({menuPosition:e,onFinished:t,sender:o,roomId:s,openMenu:r,relation:i})=>{const a=(0,n.useContext)(h.Ay),l=(e=>{const t=[F.Own];return e||t.push(F.Live),t.push(F.Pin),t})(i),m=(0,ae.ny)("feature_location_share_live"),u=l.length>1,[_,v]=(0,n.useState)(u?void 0:F.Own),g=Q.V.instance.displayName,x=a.getSafeUserId(),b=_===F.Live?((e,t,o,n)=>async({timeout:e})=>{const s=(0,c._t)("location_sharing|live_description",{displayName:o});try{await R.g.instance.createLiveBeacon(t,k.ContentHelpers.makeBeaconInfoContent(null!=e?e:3e5,!0,s,k.LocationAssetType.Self))}catch(e){O(e,n,F.Live)}})(0,s,g||x,r):((e,t,o,n,s)=>async({uri:r,timestamp:i})=>{if(r)try{const s=(null==n?void 0:n.rel_type)===k.THREAD_RELATION_TYPE.name&&(null==n?void 0:n.event_id)||null,a=o===F.Pin?k.LocationAssetType.Pin:k.LocationAssetType.Self,l=k.ContentHelpers.makeLocationContent(void 0,r,i,void 0,a);await(0,I.Y)(t,t=>e.sendMessage(t,s,l),e)}catch(e){O(e,s,o)}})(a,s,null!=_?_:F.Own,i,r),E=_===F.Live&&!m;return n.createElement(d.Ay,(0,p.A)({},e,{onFinished:t,managed:!1}),n.createElement("div",{className:"mx_LocationShareMenu"},E&&n.createElement(ie,{onSubmit:()=>{z.A.setValue("feature_location_share_live",null,le.p.DEVICE,!0)}}),!E&&!!_&&n.createElement(H,{sender:o,shareType:_,onChoose:b,onFinished:t}),!_&&n.createElement(oe,{setShareType:v,enabledShareTypes:l}),n.createElement(J,{displayBack:!!_&&u,onBack:()=>v(void 0),onCancel:t})))},me=({roomId:e,sender:t,menuPosition:o,relation:s})=>{const i=(0,n.useContext)(u.ZF),[a,p,h,_]=(0,d.EF)(),v=e=>{_(e),null==i||i()};let g=null;if(a){var x;const r=null!==(x=null!=o?o:p.current&&(0,d.qv)(p.current.getBoundingClientRect()))&&void 0!==x?x:{};g=n.createElement(ce,{menuPosition:r,onFinished:v,sender:t,roomId:e,openMenu:h,relation:s})}const k=r()("mx_MessageComposer_button",{mx_MessageComposer_button_highlight:a});return n.createElement(n.Fragment,null,n.createElement(m.J,{className:k,onClick:h,title:(0,c._t)("common|location"),inputRef:p},n.createElement(l,null)),g)}},"./src/components/views/location/Marker.tsx":(e,t,o)=>{o.d(t,{A:()=>m});var n=o("./node_modules/react/index.js"),s=o("./node_modules/classnames/index.js"),r=o.n(s),i=o("./node_modules/@vector-im/compound-design-tokens/assets/web/icons/location-pin-solid.js"),a=o("./src/utils/FormattingUtils.ts"),l=o("./src/components/views/avatars/MemberAvatar.tsx");const c=({tooltip:e,children:t})=>{const[o,s]=(0,n.useState)(!1);if(!e)return n.createElement(n.Fragment,null,t);return n.createElement("div",{onMouseEnter:()=>s(!0),onClick:e=>{e.stopPropagation(),s(!o)},onMouseLeave:()=>s(!1)},t,o&&e)},m=({id:e,roomMember:t,useMemberColor:o,tooltip:s,ref:m})=>{const d=o&&t?(0,a.yJ)(t.userId):"";return n.createElement("div",{ref:m,id:e,className:r()("mx_Marker",d,{mx_Marker_defaultColor:!d})},n.createElement(c,{tooltip:s},n.createElement("div",{className:"mx_Marker_border"},t?n.createElement(l.A,{member:t,size:"36px",viewUserOnClick:!1,hideTitle:!!s}):n.createElement(i.A,{className:"mx_Marker_icon"}))))}},"./src/components/views/rooms/CollapsibleButton.tsx":(e,t,o)=>{o.d(t,{J:()=>m});var n=o("./node_modules/@babel/runtime/helpers/esm/extends.js"),s=o("./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"),r=o("./node_modules/react/index.js"),i=o("./src/components/views/elements/AccessibleButton.tsx"),a=o("./src/components/views/rooms/MessageComposerButtons.tsx"),l=o("./src/components/views/context_menus/IconizedContextMenu.tsx");const c=["title","children","className","inputRef"],m=e=>{let{title:t,children:o,className:m,inputRef:d}=e,u=(0,s.A)(e,c);return!!(0,r.useContext)(a.ZF)?r.createElement(l.R$,(0,n.A)({},u,{icon:o,label:t,inputRef:d})):r.createElement(i.A,(0,n.A)({},u,{title:t,className:m,ref:d}),o)}},"./src/components/views/rooms/EmojiButton.tsx":(e,t,o)=>{o.d(t,{h:()=>p});var n=o("./node_modules/@babel/runtime/helpers/esm/extends.js"),s=o("./node_modules/classnames/index.js"),r=o.n(s),i=o("./node_modules/react/index.js"),a=o("./node_modules/@vector-im/compound-design-tokens/assets/web/icons/reaction.js"),l=o("./src/languageHandler.tsx"),c=o("./src/components/structures/ContextMenu.tsx"),m=o("./src/components/views/emojipicker/EmojiPicker.tsx"),d=o("./src/components/views/rooms/CollapsibleButton.tsx"),u=o("./src/components/views/rooms/MessageComposerButtons.tsx");function p({addEmoji:e,menuPosition:t,className:o}){const s=(0,i.useContext)(u.ZF),[p,h,_,v]=(0,c.EF)();let g=null;if(p&&h.current){const o=null!=t?t:(0,c.qv)(h.current.getBoundingClientRect()),r=()=>{v(),null==s||s()};g=i.createElement(c.Ay,(0,n.A)({},o,{onFinished:r,managed:!1,focusLock:!0}),i.createElement(m.Ay,{onChoose:e,onFinished:r}))}const x=r()("mx_EmojiButton",o,{mx_EmojiButton_highlight:p});return i.createElement(i.Fragment,null,i.createElement(d.J,{className:x,onClick:_,title:(0,l._t)("common|emoji"),inputRef:h},i.createElement(a.A,null)),g)}},"./src/components/views/rooms/MessageComposerButtons.tsx":(e,t,o)=>{o.d(t,{Ay:()=>W,ZF:()=>B});var n=o("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),s=o("./node_modules/@babel/runtime/helpers/esm/extends.js"),r=o("./node_modules/classnames/index.js"),i=o.n(r),a=o("./node_modules/matrix-js-sdk/src/matrix.ts"),l=o("./node_modules/react/index.js"),c=o("./node_modules/@vector-im/compound-design-tokens/assets/web/icons/attachment.js"),m=o("./node_modules/@vector-im/compound-design-tokens/assets/web/icons/mic-on.js"),d=o("./node_modules/@vector-im/compound-design-tokens/assets/web/icons/overflow-horizontal.js"),u=o("./node_modules/@vector-im/compound-design-tokens/assets/web/icons/polls.js"),p=o("./node_modules/@vector-im/compound-design-tokens/assets/web/icons/sticker.js"),h=o("./node_modules/@vector-im/compound-design-tokens/assets/web/icons/text-formatting.js"),_=o("./src/languageHandler.tsx"),v=o("./src/components/views/rooms/CollapsibleButton.tsx"),g=o("./src/dispatcher/dispatcher.ts"),x=o("./src/components/views/dialogs/ErrorDialog.tsx"),k=o("./src/components/views/location/index.tsx"),b=o("./src/Modal.tsx"),E=o("./src/components/views/elements/PollCreateDialog.tsx"),w=o("./src/MatrixClientPeg.ts"),C=o("./src/ContentMessages.ts"),y=o("./src/contexts/MatrixClientContext.tsx"),f=o("./src/hooks/useDispatcher.ts"),A=o("./src/utils/BrowserWorkarounds.ts"),M=o("./src/components/views/context_menus/IconizedContextMenu.tsx"),j=o("./src/components/views/rooms/EmojiButton.tsx"),S=o("./src/utils/arrays.ts"),L=o("./src/hooks/useSettings.ts"),T=o("./src/components/views/elements/AccessibleButton.tsx"),N=o("./src/contexts/ScopedRoomContext.tsx");const B=(0,l.createContext)(null);function P(e){return l.createElement(j.h,{key:"emoji_button",addEmoji:e.addEmoji,menuPosition:e.menuPosition,className:"mx_MessageComposer_button"})}function R(){return l.createElement(O,{key:"controls_upload"})}const I=(0,l.createContext)(null),F=({roomId:e,relation:t,children:o})=>{const n=(0,l.useContext)(y.Ay),s=(0,N.ME)("timelineRenderingType","replyToEvent"),r=(0,l.useRef)(null),i=()=>{var e;null!=n&&n.isGuest()?g.A.dispatch({action:"require_registration"}):null===(e=r.current)||void 0===e||e.click()};(0,f.F)(g.A,e=>{s.timelineRenderingType===e.context&&"upload_file"===e.action&&i()});return l.createElement(I.Provider,{value:i},o,l.createElement("input",{ref:r,type:"file",style:{display:"none"},multiple:!0,onClick:A.e,onChange:o=>{var r;0!==(null===(r=o.target.files)||void 0===r?void 0:r.length)&&(C.Ay.sharedInstance().sendContentListToRoom(Array.from(o.target.files),e,t,s.replyToEvent,n,s.timelineRenderingType),o.target.value="")}}))},O=()=>{const e=(0,l.useContext)(B),t=(0,l.useContext)(I);return l.createElement(v.J,{className:"mx_MessageComposer_button",onClick:()=>{null==t||t(),null==e||e()},title:(0,_._t)("common|attachment")},l.createElement(c.A,null))};function D(e){return e.showStickersButton?l.createElement(v.J,{id:"stickersButton",key:"controls_stickers",className:"mx_MessageComposer_button",onClick:()=>e.setStickerPickerOpen(!e.isStickerPickerOpen),title:e.isStickerPickerOpen?(0,_._t)("composer|close_sticker_picker"):(0,_._t)("common|sticker")},l.createElement(p.A,null)):null}function U(e,t){return t?null:l.createElement(v.J,{key:"voice_message_send",className:"mx_MessageComposer_button",onClick:e.onRecordStartEndClick,title:(0,_._t)("composer|voice_message_button")},l.createElement(m.A,null))}function q(e,t){return l.createElement(H,{key:"polls",room:e,relation:t})}class H extends l.PureComponent{constructor(...e){super(...e),(0,n.A)(this,"onCreateClick",()=>{var e;null===(e=this.context)||void 0===e||e.call(this);if(this.props.room.currentState.maySendEvent(a.M_POLL_START.name,w.J.safeGet().getSafeUserId())){var t;const e=(null===(t=this.props.relation)||void 0===t?void 0:t.rel_type)===a.THREAD_RELATION_TYPE.name?this.props.relation.event_id:void 0;b.Ay.createDialog(E.A,{room:this.props.room,threadId:e},"mx_CompoundDialog",!1,!0)}else b.Ay.createDialog(x.A,{title:(0,_._t)("composer|poll_button_no_perms_title"),description:(0,_._t)("composer|poll_button_no_perms_description")})})}render(){var e;return(null===(e=this.props.relation)||void 0===e?void 0:e.rel_type)===a.THREAD_RELATION_TYPE.name?null:l.createElement(v.J,{className:"mx_MessageComposer_button",onClick:this.onCreateClick,title:(0,_._t)("composer|poll_button")},l.createElement(u.A,null))}}function z(e,t,o){const n=t.getMember(o.getSafeUserId());return e.showLocationButton&&n?l.createElement(k.Uo,{key:"location",roomId:t.roomId,relation:e.relation,sender:n,menuPosition:e.menuPosition}):null}function G({isRichTextEnabled:e,onClick:t}){const o=e?(0,_._t)("composer|mode_plain"):(0,_._t)("composer|mode_rich_text");return l.createElement(v.J,{className:"mx_MessageComposer_button",onClick:t,title:o},l.createElement(h.A,null))}(0,n.A)(H,"contextType",B);const W=e=>{const t=(0,l.useContext)(y.Ay),{room:o,narrow:n}=(0,N.ME)("room","narrow"),r=(0,L.ti)("feature_wysiwyg_composer");if(!t||!o||e.haveRecording)return null;let a,c;n?(a=[r?l.createElement(G,{key:"composerModeButton",isRichTextEnabled:e.isRichTextEnabled,onClick:e.onComposerModeClick}):P(e)],c=[R(),D(e),U(e,n),e.showPollsButton?q(o,e.relation):null,z(e,o,t)]):(a=[r?l.createElement(G,{key:"composerModeButton",isRichTextEnabled:e.isRichTextEnabled,onClick:e.onComposerModeClick}):P(e),R()],c=[D(e),U(e,n),e.showPollsButton?q(o,e.relation):null,z(e,o,t)]),a=(0,S.Bo)(a),c=(0,S.Bo)(c);const m=i()({mx_MessageComposer_button:!0,mx_MessageComposer_buttonMenu:!0,mx_MessageComposer_closeButtonMenu:e.isMenuOpen});return l.createElement(F,{roomId:o.roomId,relation:e.relation},a,c.length>0&&l.createElement(T.A,{className:m,onClick:e.toggleButtonMenu,title:(0,_._t)("quick_settings|sidebar_settings")},l.createElement(d.A,null)),e.isMenuOpen&&l.createElement(M.Ay,(0,s.A)({onFinished:e.toggleButtonMenu},e.menuPosition,{wrapperClassName:"mx_MessageComposer_Menu",compact:!0}),l.createElement(B.Provider,{value:e.toggleButtonMenu},l.createElement(M.tx,null,c))))}}}]);
      2 //# sourceMappingURL=1422.js.map