PageSourceSearch

https://resourcewatch.org/_next/static/chunks/5666-bfc1e54c6fc0b597.js

js resourcewatch.org collected 2026-10-01 10:26:51 UTC 13,262 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5666],{58494:function(e,n,t){var o=t(92777),r=t(82262),i=t(10748),s=t(45959),u=t(63553),a=t(37247),l=t(59499),c=t(67294),d=t(17187),f=t.n(d);function h(e){var n=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var t,o=(0,a.Z)(e);if(n){var r=(0,a.Z)(this).constructor;t=Reflect.construct(o,arguments,r)}else t=o.apply(this,arguments);return(0,u.Z)(this,t)}}var p=function(e){(0,s.Z)(t,e);var n=h(t);function t(){var e;(0,o.Z)(this,t);for(var r=arguments.length,s=new Array(r),u=0;u<r;u++)s[u]=arguments[u];return e=n.call.apply(n,[this].concat(s)),(0,l.Z)((0,i.Z)(e),"_init",(function(){var n=e.props.options.swiper,t=(e._horizontal?e._bounds.height:e._bounds.width)/2;if(e._setPosition(t),e._rightRef.on("resize",e._onResize),e.options&&e.options.mousemove&&(e._leftRef.getContainer().addEventListener("mousemove",e._onMove),e._rightRef.getContainer().addEventListener("mousemove",e._onMove)),e._swiper.addEventListener("mousedown",e._onDown),e._swiper.addEventListener("touchstart",e._onDown),n){var o=n.offset;e._swiper.style.height="calc(100% - ".concat(o,"px)")}})),(0,l.Z)((0,i.Z)(e),"_setPointerEvents",(function(n){e._swiper.style.pointerEvents=n})),(0,l.Z)((0,i.Z)(e),"_onDown",(function(n){n.touches?(document.addEventListener("touchmove",e._onMove),document.addEventListener("touchend",e._onTouchEnd)):(document.addEventListener("mousemove",e._onMove),document.addEventListener("mouseup",e._onMouseUp))})),(0,l.Z)((0,i.Z)(e),"_setPosition",(function(n){var t=Math.min(n,e._horizontal?e._bounds.height:e._bounds.width),o=e._horizontal?"translate(0, ".concat(n,"px)"):"translate(".concat(n,"px, 0)");e._swiper.style.transform=o,e._swiper.style.left=0;var r=e._horizontal?"rect(".concat(n,"px, 999em, ").concat(e._bounds.width,"px, 0)"):"rect(0, 999em, ".concat(e._bounds.height,"px, ").concat(n,"px)");e._rightRef.getContainer().style.clip=r,e.currentPosition=t})),(0,l.Z)((0,i.Z)(e),"_onMove",(function(n){e.options&&e.options.mousemove&&e._setPointerEvents(n.touches?"auto":"none"),e._horizontal?e._setPosition(e._getY(n)):e._setPosition(e._getX(n))})),(0,l.Z)((0,i.Z)(e),"_onMouseUp",(function(){document.removeEventListener("mousemove",e._onMove),document.removeEventListener("mouseup",e._onMouseUp),e.fire("slideend",{currentPosition:e.currentPosition})})),(0,l.Z)((0,i.Z)(e),"_onTouchEnd",(function(){document.removeEventListener("touchmove",e._onMove),document.removeEventListener("touchend",e._onTouchEnd)})),(0,l.Z)((0,i.Z)(e),"_onResize",(function(){e._bounds=e._rightRef.getContainer().getBoundingClientRect(),e.currentPosition&&e._setPosition(e.currentPosition)})),(0,l.Z)((0,i.Z)(e),"_getX",(function(n){var t=(n.touches?n.touches[0]:n).clientX-e._bounds.left;return t<0&&(t=0),t>e._bounds.width&&(t=e._bounds.width),t})),(0,l.Z)((0,i.Z)(e),"_getY",(function(n){var t=(n.touches?n.touches[0]:n).clientY-e._bounds.top;return t<0&&(t=0),t>e._bounds.height&&(t=e._bounds.height),t})),(0,l.Z)((0,i.Z)(e),"on",(function(n,t){return e._ev.on(n,t),(0,i.Z)(e)})),(0,l.Z)((0,i.Z)(e),"fire",(function(n,t){return e._ev.emit(n,t),(0,i.Z)(e)})),(0,l.Z)((0,i.Z)(e),"off",(function(n,t){return e._ev.removeListener(n,t),(0,i.Z)(e)})),e}return(0,r.Z)(t,[{key:"componentDidMount",value:function(){this._swiper=this.props.swiper?this.props.swiper.current:null,this._leftRef=this.props.leftRef?this.props.leftRef:null,this._rightRef=this.props.rightRef?this.props.rightRef:null,this._options=this.props.options||{},this._isHorizontal="horizontal"===this._options.orientation,this._ev=new(f()),this._bounds=this._rightRef?this._rightRef.getContainer().getBoundingClientRect():{},this._swiper&&this._init()}},{key:"componentWillUnmount",value:function(){this._rightRef.off("resize",this._onResize),this._options&&this._options.mousemove&&(this._leftRef.getContainer().removeEventListener("mousemove",this._onMove),this._rightRef.getContainer().removeEventListener("mousemove",this._onMove)),this._swiper.removeEventListener("mousedown",this._onDown),this._swiper.removeEventListener("touchstart",this._onDown)}},{key:"render",value:function(){return null}}]),t}(c.PureComponent);(0,l.Z)(p,"defaultProps",{options:{},swiper:null,leftRef:null,rightRef:null}),n.Z=p},65666:function(e,n,t){t.d(n,{Z:function(){return B}});var o=t(59499),r=t(67294),i=t(88767),s=t(35800),u=t(77913),a=t(95760),l=t(24740),c=t(86224),d=t(7301),f=t(89508),h=t(6192),p=t(55585),v=t(27812),m=t
1(94184),g=t.n(m),b=t(19302),_=t(58350),y=t(39693),w=t.n(y),Z=t(4114),x=t(52202),j=t(29775),C=t(90900),O=t(58494),L=t(65900),R=t(3278),E=t(43653),P=t(78538),M=t(93295),k=t(85893);function S(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function D(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?S(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):S(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var I=function(e){var n=e.layerGroupsBySide,t=e.aoiLayer,o=void 0===t?null:t,i=e.maskLayer,s=void 0===i?null:i,u=e.params,a=e.bounds,l=e.widget,c=e.style,d=void 0===c?{}:c,h=e.isEmbed,p=void 0!==h&&h,m=e.isWebshot,y=void 0!==m&&m,S=e.isInACollection,I=void 0!==S&&S,z=e.isFetching,N=void 0!==z&&z,F=e.isError,B=void 0!==F&&F,T=e.onToggleShare,W=e.onFitBoundsChange,A=(0,r.useState)({left:null,right:null}),q=A[0],Y=A[1],G=(0,r.useState)(!1),U=G[0],X=G[1],H=(0,r.useState)(Z.Ps),K=H[0],Q=H[1],V=(0,r.createRef)(),J=(0,r.useRef)(null),$=(0,r.useCallback)((function(){X((function(e){return!e}))}),[]),ee=(0,r.useCallback)((function(){T(l)}),[T,l]),ne=(0,r.useCallback)((function(e){Y(D(D({},q),e))}),[q]),te=(0,r.useCallback)((function(e){W&&W(e)}),[W]),oe=(0,b.Z)((function(e){Q(e)}),1),re=(0,r.useCallback)((function(e){Q((function(n){return D(D({},n),{},{zoom:e,transitionDuration:250})}))}),[]),ie=(0,r.useMemo)((function(){var e,n,t=(null===l||void 0===l||null===(e=l.widgetConfig)||void 0===e||null===(n=e.basemapLayers)||void 0===n?void 0:n.basemap)||"dark";return Z.Yq[t].value}),[l]),se=(0,r.useMemo)((function(){var e,n,t=(null===l||void 0===l||null===(e=l.widgetConfig)||void 0===e||null===(n=e.basemapLayers)||void 0===n?void 0:n.labels)||"light";return Z.wS[t].value}),[l]),ue=(0,r.useMemo)((function(){return{left:[].concat((0,v.Z)(null!==o?[o]:[]),(0,v.Z)(null!==s?[s]:[]),(0,v.Z)(w()(n.left.map((function(e){return(e.layers||[]).find((function(e){return e.active}))}))))),right:[].concat((0,v.Z)(null!==o?[o]:[]),(0,v.Z)(null!==s?[s]:[]),(0,v.Z)(w()(n.right.map((function(e){return(e.layers||[]).find((function(e){return e.active}))})))))}}),[n,o,s]),ae=(0,r.useMemo)((function(){var e,n;return Boolean(null===l||void 0===l||null===(e=l.widgetConfig)||void 0===e||null===(n=e.basemapLayers)||void 0===n?void 0:n.boundaries)}),[l]),le=(0,r.useMemo)((function(){var e,n,t;return null===l||void 0===l||null===(e=l.metadata)||void 0===e||null===(n=e[0])||void 0===n||null===(t=n.info)||void 0===t?void 0:t.caption}),[l]),ce=(0,r.useMemo)((function(){return(0,f.MY)([].concat((0,v.Z)(ue.left),(0,v.Z)(ue.right)))}),[ue]);return(0,k.jsxs)("div",{className:g()("c-widget",{"-is-embed":p}),style:D({},d),children:[!N&&!B&&!y&&(0,k.jsx)("div",{className:"p-4 border border-b-0 rounded-tl rounded-tr widget-header-container border-gray-light",children:(0,k.jsx)(E.Z,{widget:l,params:u,onToggleInfo:$,onToggleShare:ee,isInACollection:I,isInfoVisible:U})}),(0,k.jsxs)("div",{className:g()("relative flex h-full overflow-x-auto overflow-y-hidden widget-container grow rounded",{"border-0":!U,"rounded-none":le}),style:D({},!p&&{height:400}),children:[N&&(0,k.jsx)(x.Z,{isLoading:!0,className:"-transparent"}),(0,k.jsxs)("div",{className:"relative w-full h-full overflow-hidden c-map-comparison",children:[(0,k.jsx)("div",{className:"compare-container",children:!N&&!B&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(j.Z,{interactiveLayerIds:[],mapStyle:Z.yO,basemap:ie,labels:se,boundaries:ae,scrollZoom:!1,viewport:K,bounds:a,onFitBoundsChange:te,onMapLoad:function(e){var n=e.map;return ne({left:n})},children:function(e){return(0,k.jsx)(C.Z,{map:e,layers:ue.left})}}),ue.left.length>0&&(0,k.jsx)("div",{className:"c-legend-map",style:{left:16},children:(0,k.jsx)(_.Legend,{maxHeight:140,sortable:!1,expanded:!1,children:n.left.map((function(e,n){return(0,k.jsx)(_.LegendListItem,{index:n,layerGroup:e,children:(0,k.jsx)(_.LegendItemTypes,{})},e.id)}))})})]})}),(0,k.jsxs)("div",{className:"compare-container",children:[!N&&!B&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)("div",{ref:V,className:"swiper-container mapboxgl-compare",children:(0,k.jsx)("div",{className:"compare-swiper"})}),(0,k.jsx)(j.Z,{interactiveLayerIds:[],mapStyle:Z.yO,basemap:ie,labels:se,boundaries:ae,scrollZoom:!1,viewport:K,attributions:ce,bounds:a,onMapViewportChange:oe,onMapLoad:function(e){var n=e.map;return ne({right:n})},children:function(e){return(0,k.jsx)(C.Z,{map:e,layers:ue.right})}}),(0,k.jsx)(L.Z,{customClass:"c-map-controls -embed",children:(0,k.jsx)(R.Z,{viewport:K,onClick:re})}),ue.right.length>0&&(0,k.jsx)("div",{className:"c-legend-map",style:{right:16},children:(0,k.jsx)(_.Legend,{maxHeight:140,sortable:!1,expanded:!1,children:n.right.map((function(e,n){return(0,k.jsx)(_.LegendListItem,{index:n,layerGroup:e,children:(0,k.jsx)(_.LegendItemTypes,{})},e.id)}))})})]}),q.left&&q.right&&(0,k.jsx)(O.Z,{leftRef:q.left,rightRef:q.right,swiper:V,options:{swiper:{offset:J.current?J.current.getBoundingClientRect().height:0}}})]})]}),U&&l&&!N&&(0,k.jsx)(P.Z,{widget:l,className:"p-4"})]}),le&&(0,k.jsx)(M.Z,{text:le})]})};function z(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);n&&(o=o.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,o)}return t}function N(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};
1n%2?z(Object(t),!0).forEach((function(n){(0,o.Z)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):z(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var F=function(e){return(0,k.jsx)(p.Z,N(N({},e),{},{title:"Something went wrong loading the widget"}))},B=function(e){var n,t,o,p,v=e.widgetId,m=e.params,g=void 0===m?{}:m,b=e.style,_=void 0===b?{}:b,y=e.isEmbed,w=void 0!==y&&y,Z=e.isWebshot,x=void 0!==Z&&Z,j=e.areaOfInterest,C=void 0===j?null:j,O=e.onToggleShare,L=(0,r.useState)(null),R=L[0],E=L[1],P=(0,d.P)().data,M=(0,l.Z)(v,null===P||void 0===P?void 0:P.token).isInACollection,S=(0,r.useCallback)((function(e){var n=e.zoom;E(n)}),[]),D=(0,a.I)(v,{includes:"metadata"},{enabled:!!v,refetchOnWindowFocus:!1,select:function(e){return(0,h.tA)(e,g,!1)}}),z=D.data,B=D.isFetching,T=D.isError,W=D.refetch,A=(0,c.W)(C,{},{enabled:!!C,refetchOnWindowFocus:!1}),q=A.data,Y=A.isError,G=A.refetch,U=(0,i.useQueries)(((null===z||void 0===z||null===(n=z.widgetConfig)||void 0===n||null===(t=n.paramsConfig)||void 0===t?void 0:t.layersLeft)||[]).map((function(e){return{queryKey:["fetch-layer",e],queryFn:function(){return(0,u.tR)(e)},placeholderData:null,select:function(e){return N(N({},e),{},{params:g})}}}))),X=(0,i.useQueries)(((null===z||void 0===z||null===(o=z.widgetConfig)||void 0===o||null===(p=o.paramsConfig)||void 0===p?void 0:p.layersRight)||[]).map((function(e){return{queryKey:["fetch-layer",e],queryFn:function(){return(0,u.tR)(e)},placeholderData:null,select:function(e){return N(N({},e),{},{params:g})}}}))),H=(0,r.useMemo)((function(){return{left:U.filter((function(e){var n=e.data;return!!n&&(null===n||void 0===n?void 0:n.id)})).map((function(e){return e.data})),right:X.filter((function(e){var n=e.data;return!!n&&(null===n||void 0===n?void 0:n.id)})).map((function(e){return e.data}))}}),[U,X]),K=(0,r.useMemo)((function(){return(0,f.Xh)(z,q,{minZoom:R})}),[q,z,R]),Q=(0,r.useMemo)((function(){return(0,f.fT)(z,g)}),[z,g]),V=(0,r.useMemo)((function(){var e,n=((null===z||void 0===z||null===(e=z.widgetConfig)||void 0===e?void 0:e.paramsConfig)||{}).layerParams;return{left:(0,f.n)(H.left,n,!0),right:(0,f.n)(H.right,n,!0)}}),[H,z]),J=(0,r.useMemo)((function(){var e;return null!==q&&void 0!==q&&q.bbox?{bbox:q.bbox,options:{padding:50}}:null!==z&&void 0!==z&&null!==(e=z.widgetConfig)&&void 0!==e&&e.bounds?{bbox:z.widgetConfig.bbox}:null}),[z,q]),$=(0,r.useMemo)((function(){return T||Y}),[T,Y]),ee=(0,r.useMemo)((function(){return N(N({},g),g.geostore_id&&{aoi:g.geostore_id})}),[g]);return(0,k.jsx)(s.ErrorBoundary,{FallbackComponent:F,onReset:function(){W(),C&&G()},children:(0,k.jsx)(I,{layerGroupsBySide:V,aoiLayer:K,maskLayer:Q,bounds:J,widget:z,params:ee,style:_,isEmbed:w,isWebshot:x,isFetching:B,isError:$,isInACollection:M,onToggleShare:O,onFitBoundsChange:S})})}}}]);

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.