element-web-synapse01pim.gr.jp

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

9806.js (9671B)


      1 "use strict";(self.webpackChunkelement_web=self.webpackChunkelement_web||[]).push([[9024,9806,9867],{"./src/components/views/location/LocationViewDialog.tsx"(e,o,t){t.r(o),t.d(o,{default:()=>m});var n=t("../../node_modules/.pnpm/@babel+runtime@7.29.7/node_modules/@babel/runtime/helpers/esm/defineProperty.js"),r=t("../../node_modules/.pnpm/react@19.2.7/node_modules/react/index.js"),s=t("./src/components/views/dialogs/BaseDialog.tsx"),a=t("./src/utils/location/index.ts"),i=t("./src/components/views/location/Map.tsx"),l=t("./src/components/views/location/SmartMarker.tsx"),c=t("./src/components/views/location/ZoomButtons.tsx");class m extends r.Component{constructor(e){super(e),(0,n.A)(this,"getBodyId",()=>`mx_LocationViewDialog_${this.props.mxEvent.getId()}`),(0,n.A)(this,"onError",e=>{this.setState({error:e})}),this.state={error:void 0}}render(){const{mxEvent:e}=this.props,o=(0,a.qy)(e.getContent())&&e.sender||void 0,t=(0,a.jm)(e);return r.createElement(s.A,{className:"mx_LocationViewDialog",onFinished:this.props.onFinished,fixedWidth:!1},r.createElement(i.default,{id:this.getBodyId(),centerGeoUri:t,onError:this.onError,interactive:!0,className:"mx_LocationViewDialog_map",allowGeolocate:!0},({map:e})=>r.createElement(r.Fragment,null,r.createElement(l.default,{map:e,id:`${this.getBodyId()}-marker`,geoUri:t,roomMember:o}),r.createElement(c.A,{map:e}))))}}},"./src/components/views/location/Map.tsx"(e,o,t){t.r(o),t.d(o,{default:()=>b});var n=t("../../node_modules/.pnpm/react@19.2.7/node_modules/react/index.js"),r=t("../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"),s=t.n(r),a=t("../../node_modules/.pnpm/maplibre-gl@5.24.0/node_modules/maplibre-gl/dist/maplibre-gl.js"),i=t("../../node_modules/.pnpm/matrix-js-sdk@41.9.0/node_modules/matrix-js-sdk/src/matrix.ts"),l=t("../../node_modules/.pnpm/matrix-js-sdk@41.9.0/node_modules/matrix-js-sdk/src/logger.ts"),c=t("./src/contexts/MatrixClientContext.tsx"),m=t("./src/hooks/useEventEmitter.ts"),d=t("./src/utils/location/index.ts"),u=t("./src/utils/WellKnownUtils.ts"),p=t("./src/utils/location/map.ts");var _=t("./src/Modal.tsx"),g=t("./src/components/views/dialogs/ErrorDialog.tsx"),v=t("./src/languageHandler.tsx");const x=({id:e,centerGeoUri:o,onError:t,interactive:r,bounds:s,allowGeolocate:_})=>{const g=`mx_Map_${e}`,v=(0,n.useContext)(c.Ay),x=(0,m.dF)(v,i.ClientEvent.ClientWellKnown,e=>{var o;return null===(o=(0,u.XP)(e))||void 0===o?void 0:o.map_style_url}),b=(({interactive:e,bodyId:o,onError:t})=>{const r=(0,c.nH)(),[s,a]=(0,n.useState)();return(0,n.useEffect)(()=>{let n;try{n=(0,p.p)(r,!!e,o,t),a(n)}catch(e){console.error("Error encountered in useMap",e),e instanceof Error&&(null==t||t(e))}return()=>{n&&(n.remove(),a(void 0))}},[r,e,o,t]),s})({interactive:r,bodyId:g,onError:t});(0,n.useEffect)(()=>{x&&b&&b.setStyle(x)},[x,b]),(0,n.useEffect)(()=>{if(b&&o)try{const e=(0,d.XB)(o);if(!e)throw new Error("Invalid geo URI");b.setCenter({lon:e.longitude,lat:e.latitude})}catch(e){l.vF.error("Could not set map center",e)}},[b,o]),(0,n.useEffect)(()=>{if(b&&s)try{const e=new a.LngLatBounds([s.west,s.south],[s.east,s.north]);b.fitBounds(e,{padding:100,maxZoom:15})}catch(e){l.vF.error("Invalid map bounds",e)}},[b,s]);const[h,E]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(b){if(_&&!h){const e=new a.GeolocateControl({positionOptions:{enableHighAccuracy:!0},trackUserLocation:!1});E(e),b.addControl(e)}!_&&h&&(b.removeControl(h),E(null))}},[b,h,_]),(0,n.useEffect)(()=>{if(h)return h.on("error",f),()=>{h.off("error",f)}},[h]),{map:b,bodyId:g}},f=e=>{var o;l.vF.error("Could not fetch location",e),_.Ay.createDialog(g.A,{title:(0,v._t)("location_sharing|error_fetch_location"),description:null!==(o=(0,d.Ff)(e.code))&&void 0!==o?o:""})},b=({bounds:e,centerGeoUri:o,children:t,className:r,allowGeolocate:a,id:i,interactive:l,onError:c,onClick:m})=>{const{map:d,bodyId:u}=x({centerGeoUri:o,onError:c,id:i,interactive:l,bounds:e,allowGeolocate:a});return n.createElement("div",{className:s()("mx_Map",r),id:u,onClick:e=>{e.target.classList.contains("maplibregl-ctrl-attrib-button")||null==m||m()}},!!t&&!!d&&t({map:d}))}},"./src/components/views/location/Marker.tsx"(e,o,t){t.d(o,{A:()=>m});var n=t("../../node_modules/.pnpm/react@19.2.7/node_modules/react/index.js"),r=t("../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.js"),s=t.n(r),a=t("../../node_modules/.pnpm/@vector-im+compound-design-tokens@10.2.1_@types+react@19.2.14_react@19.2.7/node_modules/@vector-im/compound-design-tokens/assets/web/icons/location-pin-solid.js"),i=t("./src/utils/FormattingUtils.ts"),l=t("./src/components/views/avatars/MemberAvatar.tsx");const c=({tooltip:e,children:o})=>{const[t,r]=(0,n.useState)(!1);if(!e)return n.createElement(n.Fragment,null,o);return n.createElement("div",{onMouseEnter:()=>r(!0),onClick:e=>{e.stopPropagation(),r(!t)},onMouseLeave:()=>r(!1)},o,t&&e)},m=({id:e,roomMember:o,useMemberColor:t,tooltip:r,ref:m})=>{const d=t&&o?(0,i.yJ)(o.userId):"";return n.createElement("div",{ref:m,id:e,className:s()("mx_Marker",d,{mx_Marker_defaultColor:!d})},n.createElement(c,{tooltip:r},n.createElement("div",{className:"mx_Marker_border"},o?n.createElement(l.A,{member:o,size:"36px",viewUserOnClick:!1,hideTitle:!!r}):n.createElement(a.A,{className:"mx_Marker_icon"}))))}},"./src/components/views/location/SmartMarker.tsx"(e,o,t){t.r(o),t.d(o,{default:()=>i});var n=t("../../node_modules/.pnpm/react@19.2.7/node_modules/react/index.js"),r=t("./src/utils/location/index.ts"),s=t("./src/utils/location/map.ts"),a=t("./src/components/views/location/Marker.tsx");const i=({id:e,map:o,geoUri:t,roomMember:i,useMemberColor:l,tooltip:c})=>{const{onElementRef:m}=((e,o)=>{const[t,a]=(0,n.useState)(),i=(0,n.useCallback)(n=>{if(t||!n)return;const i=(0,r.XB)(o);if(i){const o=(0,s.h)(i,n);o.addTo(e),a(o)}},[t,o,e]);return(0,n.useEffect)(()=>{if(t){const e=(0,r.XB)(o);e&&t.setLngLat({lon:e.longitude,lat:e.latitude})}},[t,o]),(0,n.useEffect)(()=>()=>{t&&t.remove()},[t]),{marker:t,onElementRef:i}})(o,t);return n.createElement("span",null,n.createElement(a.A,{ref:m,id:e,roomMember:i,useMemberColor:l,tooltip:c}))}},"./src/components/views/location/ZoomButtons.tsx"(e,o,t){t.d(o,{A:()=>l});var n=t("../../node_modules/.pnpm/react@19.2.7/node_modules/react/index.js"),r=t("../../node_modules/.pnpm/@vector-im+compound-design-tokens@10.2.1_@types+react@19.2.14_react@19.2.7/node_modules/@vector-im/compound-design-tokens/assets/web/icons/minus.js"),s=t("../../node_modules/.pnpm/@vector-im+compound-design-tokens@10.2.1_@types+react@19.2.14_react@19.2.7/node_modules/@vector-im/compound-design-tokens/assets/web/icons/plus.js"),a=t("./src/languageHandler.tsx"),i=t("./src/components/views/elements/AccessibleButton.tsx");const l=({map:e})=>n.createElement("div",{className:"mx_ZoomButtons"},n.createElement(i.A,{onClick:()=>{e.zoomIn()},title:(0,a._t)("action|zoom_in"),className:"mx_ZoomButtons_button"},n.createElement(s.A,{className:"mx_ZoomButtons_icon"})),n.createElement(i.A,{onClick:()=>{e.zoomOut()},title:(0,a._t)("action|zoom_out"),className:"mx_ZoomButtons_button"},n.createElement(r.A,{className:"mx_ZoomButtons_icon"})))},"./src/utils/location/map.ts"(e,o,t){t.d(o,{h:()=>c,p:()=>l});var n=t("../../node_modules/.pnpm/maplibre-gl@5.24.0/node_modules/maplibre-gl/dist/maplibre-gl.js"),r=t("../../node_modules/.pnpm/matrix-js-sdk@41.9.0/node_modules/matrix-js-sdk/src/logger.ts"),s=t("./src/languageHandler.tsx"),a=t("./src/utils/location/findMapStyleUrl.ts"),i=t("./src/utils/location/LocationShareErrors.ts");const l=(e,o,t,l)=>{try{const c=(0,a.M)(e),m=new n.Map({container:t,style:c,zoom:15,interactive:o,attributionControl:!1,locale:{"AttributionControl.ToggleAttribution":(0,s._t)("location_sharing|toggle_attribution"),"AttributionControl.MapFeedback":(0,s._t)("location_sharing|map_feedback"),"FullscreenControl.Enter":(0,s._t)("action|enter_fullscreen"),"FullscreenControl.Exit":(0,s._t)("action|exit_fullscreeen"),"GeolocateControl.FindMyLocation":(0,s._t)("location_sharing|find_my_location"),"GeolocateControl.LocationNotAvailable":(0,s._t)("location_sharing|location_not_available"),"LogoControl.Title":(0,s._t)("location_sharing|mapbox_logo"),"NavigationControl.ResetBearing":(0,s._t)("location_sharing|reset_bearing"),"NavigationControl.ZoomIn":(0,s._t)("action|zoom_in"),"NavigationControl.ZoomOut":(0,s._t)("action|zoom_out")}});return m.addControl(new n.AttributionControl,"top-right"),m.on("error",e=>{r.vF.error("Failed to load map: check map_style_url in config.json has a valid URL and API key",e.error),null==l||l(new Error(i.$.MapStyleUrlNotReachable))}),m}catch(e){r.vF.error("Failed to render map",e);if((null==e?void 0:e.message).includes("Failed to initialize WebGL"))throw new Error(i.$.WebGLNotEnabled);throw e}},c=(e,o)=>new n.Marker({element:o,anchor:"bottom",offset:[0,-1]}).setLngLat({lon:e.longitude,lat:e.latitude})},"../../node_modules/.pnpm/@vector-im+compound-design-tokens@10.2.1_@types+react@19.2.14_react@19.2.7/node_modules/@vector-im/compound-design-tokens/assets/web/icons/minus.js"(e,o,t){t.d(o,{A:()=>a});var n=t("../../node_modules/.pnpm/react@19.2.7/node_modules/react/index.js"),r=t("../../node_modules/.pnpm/react@19.2.7/node_modules/react/jsx-runtime.js");function s(e,o){return(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",fill:"currentColor",viewBox:"0 0 24 24",ref:o,...e,children:(0,r.jsx)("path",{d:"M6 13a.97.97 0 0 1-.713-.287A.97.97 0 0 1 5 12q0-.424.287-.713A.97.97 0 0 1 6 11h12q.424 0 .712.287.288.288.288.713 0 .424-.288.713A.97.97 0 0 1 18 13z"})})}s.displayName="MinusIcon";const a=(0,n.forwardRef)(s)}}]);
      2 //# sourceMappingURL=9806.js.map