@nocobase/plugin-map 3.0.0-alpha.1 → 3.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/index.js +1 -1
- package/dist/client-v2/641.a12687e7a235574a.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/client-v2/models/components/AMap/Map.d.ts +3 -1
- package/dist/client-v2/models/components/GoogleMaps/Map.d.ts +7 -1
- package/dist/externalVersion.js +7 -7
- package/package.json +2 -2
- package/dist/client-v2/641.ffcfb694badc38ad.js +0 -10
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
(self.webpackChunk_nocobase_plugin_map_client_v2=self.webpackChunk_nocobase_plugin_map_client_v2||[]).push([["641"],{302:function(e){"use strict";e.exports=function(){function e(e){var t,l,a=[];return e.AMapUI&&a.push((t=e.AMapUI,new Promise(function(e,l){var a=[];if(t.plugins)for(var c=0;c<t.plugins.length;c+=1)-1==r.AMapUI.plugins.indexOf(t.plugins[c])&&a.push(t.plugins[c]);if(o.AMapUI===n.failed)l("前次请求 AMapUI 失败");else if(o.AMapUI===n.notload){o.AMapUI=n.loading,r.AMapUI.version=t.version||r.AMapUI.version,c=r.AMapUI.version;var u=document.body||document.head,s=document.createElement("script");s.type="text/javascript",s.src="https://webapi.amap.com/ui/"+c+"/main.js",s.onerror=function(e){o.AMapUI=n.failed,l("请求 AMapUI 失败")},s.onload=function(){if(o.AMapUI=n.loaded,a.length)window.AMapUI.loadUI(a,function(){for(var t=0,n=a.length;t<n;t++){var r=a[t].split("/").slice(-1)[0];window.AMapUI[r]=arguments[t]}for(e();i.AMapUI.length;)i.AMapUI.splice(0,1)[0]()});else for(e();i.AMapUI.length;)i.AMapUI.splice(0,1)[0]()},u.appendChild(s)}else o.AMapUI===n.loaded?t.version&&t.version!==r.AMapUI.version?l("不允许多个版本 AMapUI 混用"):a.length?window.AMapUI.loadUI(a,function(){for(var t=0,n=a.length;t<n;t++){var r=a[t].split("/").slice(-1)[0];window.AMapUI[r]=arguments[t]}e()}):e():t.version&&t.version!==r.AMapUI.version?l("不允许多个版本 AMapUI 混用"):i.AMapUI.push(function(t){t?l(t):a.length?window.AMapUI.loadUI(a,function(){for(var t=0,n=a.length;t<n;t++){var r=a[t].split("/").slice(-1)[0];window.AMapUI[r]=arguments[t]}e()}):e()})}))),e.Loca&&a.push((l=e.Loca,new Promise(function(e,t){if(o.Loca===n.failed)t("前次请求 Loca 失败");else if(o.Loca===n.notload){o.Loca=n.loading,r.Loca.version=l.version||r.Loca.version;var a=r.Loca.version,c=r.AMap.version.startsWith("2"),u=a.startsWith("2");if(c&&!u||!c&&u)t("JSAPI 与 Loca 版本不对应!!");else{c=r.key,u=document.body||document.head;var s=document.createElement("script");s.type="text/javascript",s.src="https://webapi.amap.com/loca?v="+a+"&key="+c,s.onerror=function(e){o.Loca=n.failed,t("请求 AMapUI 失败")},s.onload=function(){for(o.Loca=n.loaded,e();i.Loca.length;)i.Loca.splice(0,1)[0]()},u.appendChild(s)}}else o.Loca===n.loaded?l.version&&l.version!==r.Loca.version?t("不允许多个版本 Loca 混用"):e():l.version&&l.version!==r.Loca.version?t("不允许多个版本 Loca 混用"):i.Loca.push(function(e){e?t(e):t()})}))),Promise.all(a)}if(!window)throw Error("AMap JSAPI can only be used in Browser.");(t=n||(n={})).notload="notload",t.loading="loading",t.loaded="loaded",t.failed="failed";var t,n,r={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},o={AMap:n.notload,AMapUI:n.notload,Loca:n.notload},i={AMap:[],AMapUI:[],Loca:[]},l=[],a=function(e){"function"==typeof e&&(o.AMap===n.loaded?e(window.AMap):l.push(e))};return{load:function(t){return new Promise(function(i,c){if(o.AMap==n.failed)c("");else if(o.AMap==n.notload){var u=t.key,s=t.version,f=t.plugins;u?(window.AMap&&"lbs.amap.com"!==location.host&&c("禁止多种API加载方式混用"),r.key=u,r.AMap.version=s||r.AMap.version,r.AMap.plugins=f||r.AMap.plugins,o.AMap=n.loading,s=document.body||document.head,window.___onAPILoaded=function(r){if(delete window.___onAPILoaded,r)o.AMap=n.failed,c(r);else for(o.AMap=n.loaded,e(t).then(function(){i(window.AMap)}).catch(c);l.length;)l.splice(0,1)[0]()},(f=document.createElement("script")).type="text/javascript",f.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+r.AMap.version+"&key="+u+"&plugin="+r.AMap.plugins.join(","),f.onerror=function(e){o.AMap=n.failed,c(e)},s.appendChild(f)):c("请填写key")}else if(o.AMap==n.loaded)if(t.key&&t.key!==r.key)c("多个不一致的 key");else if(t.version&&t.version!==r.AMap.version)c("不允许多个版本 JSAPI 混用");else{if(u=[],t.plugins)for(s=0;s<t.plugins.length;s+=1)-1==r.AMap.plugins.indexOf(t.plugins[s])&&u.push(t.plugins[s]);u.length?window.AMap.plugin(u,function(){e(t).then(function(){i(window.AMap)}).catch(c)}):e(t).then(function(){i(window.AMap)}).catch(c)}else if(t.key&&t.key!==r.key)c("多个不一致的 key");else if(t.version&&t.version!==r.AMap.version)c("不允许多个版本 JSAPI 混用");else{var p=[];if(t.plugins)for(s=0;s<t.plugins.length;s+=1)-1==r.AMap.plugins.indexOf(t.plugins[s])&&p.push(t.plugins[s]);a(function(){p.length?window.AMap.plugin(p,function(){e(t).then(function(){i(window.AMap)}).catch(c)}):e(t).then(function(){i(window.AMap)}).catch(c)})}})},reset:function(){delete window.AMap,delete window.AMapUI,delete window.Loca,r={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},o={AMap:n.notload,AMapUI:n.notload,Loca:n.notload},i={AMap:[],AMapUI:[],Loca:[]}}}}()},119:function(e){e.exports={}},899:function(e,t,n){"use strict";n.d(t,{K0:function(){return i},S4:function(){return l},cV:function(){return u}});var r=n(694),o=n(155),i="map-configuration",l=function(e){return"NOCOBASE_PLUGIN_MAP_CONFIGURATION_".concat(e)};function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var c=function(e){var t=sessionStorage.getItem(l(e));try{return t?JSON.parse(t):null}catch(e){return null}},u=function(e){var t,n=!(arguments.length>1)||void 0===arguments[1]||arguments[1],u=(0,r.useFlowContext)().api,s=(0,o.useMemo)(function(){return l(e)},[e]),f=function(e){if(Array.isArray(e))return e}(t=(0,o.useState)(function(){return n?c(e):null}))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return a(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return a(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=f[0],d=f[1];return(0,o.useEffect)(function(){n?d(c(e)):d(null)},[e,n]),(0,o.useEffect)(function(){if(!(n&&c(e))){var t=!1;return u.resource(i).get({isRaw:!n,type:e}).then(function(e){if(!t){var r,o=null==(r=e.data)?void 0:r.data;if(n){var i=sessionStorage.getItem(s);i&&i===JSON.stringify(o)||sessionStorage.setItem(s,JSON.stringify(o))}d(o)}}).catch(function(){}),function(){t=!0}}},[u,e,n,s]),p}},285:function(e,t,n){"use strict";n.d(t,{r:function(){return k},h:function(){return L}});var r=n(375),o=n(625),i=n(59),l=n(155),a=n.n(l),c=n(970),u=n(802),s=n(294),f=n(488),p=n(302),d=n.n(p);n(119);var g=n(694),h=n(899),y=n(211);function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var m=function(e){var t,n=e.aMap,r=e.toCenter,c=(0,f.kj)(),u=(0,l.useRef)(),s=function(e){if(Array.isArray(e))return e}(t=(0,l.useState)([]))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return v(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return v(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=s[0],d=s[1];(0,l.useEffect)(function(){null==n||n.plugin("AMap.PlaceSearch",function(){n&&(u.current=new n.PlaceSearch({city:"全国",pageSize:30}))})},[n]);var g=(0,o.useDebounceFn)(function(e){u.current&&u.current.search(e||" ",function(e,t){if("complete"===e)d(t.poiList.pois.map(function(e){var t,n;return t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),n=n={label:"".concat(e.name,"-").concat(e.address),value:e.id},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t}));else{if("no_data"===e)return void d([]);i.message.error(c("Please configure the AMap securityCode or securityHost correctly"))}})},{wait:300}).run;return a().createElement("div",{style:{position:"absolute",top:10,left:10,zIndex:10,width:"calc(100% - 20px)"}},a().createElement(i.Select,{showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:c("Enter keywords to search"),filterOption:!1,onSearch:g,onSelect:function(e){var t=p.find(function(t){return t.value===e});(null==t?void 0:t.location)&&r(t.location)},options:p,popupMatchSelectWidth:!1}))};function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){w(e,t,n[t])})}return e}function A(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function M(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var P={point:{mouseTool:"marker",propertyKey:"position",overlay:"Marker"},polygon:{mouseTool:"polygon",editor:"PolygonEditor",propertyKey:"path",overlay:"Polygon"},lineString:{mouseTool:"polyline",editor:"PolylineEditor",propertyKey:"path",overlay:"Polyline"},circle:{mouseTool:"circle",editor:"CircleEditor",transformOptions:function(e){return{center:e.slice(0,2),radius:e[2]}},overlay:"Circle"}},k=a().forwardRef(function(e,t){var n=(0,h.cV)(e.mapType)||{},c=n.accessKey,p=n.securityJsCode,v=e.value,b=e.onChange,k=e.block,S=void 0!==k&&k,C=e.readonly,E=e.disabled,I=void 0===E?S:E,j=e.zoom,L=e.overlayCommonOptions,x=e.height,D=e.type,U=(0,f.kj)(),_=(0,l.useRef)(U);_.current=U;var z=(0,l.useRef)(),T=(0,l.useRef)(),F=(0,l.useRef)(),R=M((0,l.useState)([]),2),B=R[0],K=R[1],$=M((0,l.useState)(""),2),G=$[0],N=$[1],J="Something went wrong, please refresh the page and try again",Z=(0,g.useFlowContext)(),V=(0,l.useRef)(),W=(0,l.useRef)(null),q=(0,l.useRef)(j);q.current=j;var X=(0,l.useRef)("nocobase-map-".concat(D||"","-").concat(Date.now().toString(32))),H=i.App.useApp().modal,Y=M((0,l.useState)(O({strokeWeight:5,strokeColor:u.A,fillColor:u.A,strokeOpacity:1},L)),1)[0];(0,l.useEffect)(function(){T.current&&!S&&setTimeout(function(){var e;null==(e=T.current)||e.setZoom(j)},500)},[j,S]);var Q=(0,o.useMemoizedFn)(function(){V.current&&V.current.remove()}),ee=(0,o.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D;(!I||S)&&"point"!==e&&W.current&&(W.current.setTarget(V.current),W.current.open())}),et=(0,o.useMemoizedFn)(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:D,r=null;if("point"===n){var o=e.getPosition(),i=o.lat;r=[o.lng,i]}else if("polygon"===n||"lineString"===n){if((r=e.getPath().map(function(e){return[e.lng,e.lat]})).length<2)return}else if("circle"===n){var l=e.getCenter(),a=e.getRadius();r=[l.lng,l.lat,a]}t||(Q(),V.current=e,ee(n)),null==b||b(r)}),en=(0,o.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D,t=P[e];if(t&&"editor"in t&&!W.current)return W.current=new z.current[t.editor](T.current,null,{createOptions:Y,editOptions:Y,controlPoint:A(O({},Y),{strokeWeight:3}),midControlPoint:A(O({},Y),{strokeWeight:2,fillColor:"#fff"})}),W.current.on("adjust",function(t){et(t.target,!0,e)}),W.current.on("move",function(t){et(t.target,!0,e)}),W.current}),er=(0,o.useMemoizedFn)(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D;if(!(!F.current||(null==(e=W.current)?void 0:e.getTarget()))){var n=P[t];n&&F.current[n.mouseTool](O({},Y))}}),eo=(0,o.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D;F.current||(F.current=new z.current.MouseTool(T.current),F.current.on("draw",function(t){et(t.obj,!1,e)}),er(e))}),ei=(0,l.useCallback)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v,n=arguments.length>2?arguments[2]:void 0,r=P[e];if(r){var o=O({},Y,n);return"transformOptions"in r?Object.assign(o,r.transformOptions(t)):"propertyKey"in r&&(o[r.propertyKey]=t),new z.current[r.overlay](o)}},[Y,D,v]),el=(0,o.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v,n=arguments.length>2?arguments[2]:void 0;if(z.current){var r=ei(e,t,n);if(r)return r.setMap(T.current),r}});return((0,l.useEffect)(function(){if(z.current&&v&&(C||!V.current)){var e=el();T.current.setFitView([e]),V.current=e,I||(en(),ee())}},[v,B,D,Y,I,C,en,el,ee]),(0,l.useEffect)(function(){var e,t,n;F.current&&(I?(null==(e=F.current)||e.close(),null==(t=W.current)||t.close()):(er(),null==(n=W.current)||n.open()))},[I,er]),(0,l.useEffect)(function(){z.current&&D&&!I&&(eo(),en())},[en,eo,I,B,D]),(0,l.useEffect)(function(){if(!v&&(F.current||W.current)&&(Q(),W.current&&(W.current.setTarget(),W.current.close()),null==b||b(null)),F.current&&W.current){var e,t;W.current.getTarget()?null==(e=(t=F.current).close)||e.call(t):er()}},[er,b,Q,D,v]),(0,l.useEffect)(function(){if(c&&!T.current){p&&(window._AMapSecurityConfig=w({},p.endsWith("_AMapService")?"serviceHOST":"securityJsCode",p));var e=window.define;return(window.define=void 0,window.AMap)?void(0,s.zd)(function(){try{T.current=new window.AMap.Map(X.current,{resizeEnable:!0,zoom:q.current}),z.current=AMap,N(""),K([])}catch(e){N((0,s.DP)(e,J))}finally{window.define=e}}):(d().load({key:c,version:"2.0",plugins:["AMap.MouseTool","AMap.PolygonEditor","AMap.PolylineEditor","AMap.CircleEditor"]}).then(function(t){if(t)return window.define=e,(0,s.zd)(function(){try{T.current=new t.Map(X.current,{resizeEnable:!0,zoom:q.current}),z.current=t,N(""),K([])}catch(e){N((0,s.DP)(e,J))}})}).catch(function(t){window.define=e;var n=(0,s.DP)(t,J);n.includes("多个不一致的 key")?N(_.current("The AccessKey is incorrect, please check it")):t&&(void 0===t?"undefined":t&&"u">typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)=="object"&&"type"in t&&"error"===t.type?N(J):N(n)}),function(){var e;null==(e=T.current)||e.destroy(),z.current=null,T.current=null,F.current=null,W.current=null,d().reset()})}},[c,p,D]),(0,l.useImperativeHandle)(t,function(){return{setOverlay:el,getOverlay:ei,createMouseTool:eo,createEditor:en,executeMouseTool:er,aMap:z.current,map:T.current,overlay:V.current,mouseTool:function(){return F.current},editor:function(){return W.current},errMessage:G}}),!c||G)?a().createElement(i.Alert,{action:a().createElement(i.Button,{type:"primary",href:(0,y.J)(Z.app,window.location.pathname),target:"_blank",rel:"noopener noreferrer",onClick:function(){var e,t;null==(t=Z.view)||null==(e=t.close)||e.call(t)}},U("Go to the configuration page")),message:G||U("Please configure the AccessKey and SecurityJsCode first"),type:"error"}):a().createElement("div",{style:O({position:"relative",height:x||500},null==e?void 0:e.style),id:X.current},!z.current&&a().createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"}},a().createElement(i.Spin,null)),I?null:a().createElement(a().Fragment,null,a().createElement(m,{toCenter:function(e,t){T.current&&T.current.setZoomAndCenter(18,e,t)},aMap:z.current}),a().createElement("div",{style:{position:"absolute",bottom:80,right:20,zIndex:10}},a().createElement(i.Button,{onClick:function(){V.current&&T.current.setFitView([V.current])},disabled:!V.current,type:"primary",shape:"round",size:"large",icon:a().createElement(r.SyncOutlined,null)})),"point"!==D?a().createElement("div",{style:{position:"absolute",bottom:20,left:10,zIndex:2,pointerEvents:"none"}},a().createElement(i.Alert,{message:U("Click to select the starting point and double-click to end the drawing"),type:"info"})):null,a().createElement("div",{style:{position:"absolute",bottom:20,right:20,zIndex:2}},a().createElement(i.Button,{disabled:!v,style:{height:"40px"},onClick:function(){var e=function(){Q(),W.current&&(W.current.setTarget(),W.current.close()),null==b||b(null)};H.confirm({title:U("Clear the canvas"),content:U("Are you sure to clear the canvas?"),okText:U("Confirm"),cancelText:U("Cancel"),getContainer:function(){return document.getElementById(X.current)},onOk:function(){e()}})},type:"primary",danger:!0},U("Clear")))))});function S(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||j(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e){return function(e){if(Array.isArray(e))return S(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||j(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){if(e){if("string"==typeof e)return S(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(e,t)}}k.displayName="AMapCom";var L=function(e){var t,n,p,d,g,h,y=e.collectionField,v=e.marker,m=e.dataSource,b=e.fixedBlock,w=e.zoom,O=e.setSelectedRecordKeys,A=e.lineSort,M=e.fields,P=e.name,S=e.primaryKey,j=e.mapField,L=e.associationCollectionField,x=e.onOpenView,D=E((0,l.useState)(!1),2),U=D[0],_=D[1],z=(0,l.useRef)(),T=null==(d=z.current)||null==(p=d.aMap)?void 0:p.GeometryUtil,F=E((0,l.useState)(""),2),R=F[0],B=F[1],K=(0,f.kj)(),$=(0,o.useMemoizedFn)(function(e){return(0,s.Gq)(e,K)}),G=(0,l.useRef)(R);G.current=R;var N=null==(g=M.find(function(e){return e.name===v}))?void 0:g.uiSchema,J=y.interface||y.type,Z=function(e,t){if(z.current){var n=e.getExtData(),r=void 0===t?n.selected:!t;n.selected=!r,"setIcon"in e&&e.setIcon(new z.current.aMap.Icon({imageSize:[19,32],image:r?c.X:c.F})),e.setOptions(C({extData:n},r?{strokeColor:u.A,fillColor:u.A}:{strokeColor:u.v,fillColor:u.v}))}},V=function(){var e,t,n;z.current&&(null==(e=z.current)||e.mouseTool().close(!0),null==(t=z.current)||t.editor().setTarget(null),null==(n=z.current)||n.editor().close())};(0,l.useEffect)(function(){var e,t,n,r;if("selection"===R)return(null==(e=z.current)?void 0:e.editor())?null==(r=z.current)||r.executeMouseTool("polygon"):(null==(t=z.current)||t.createEditor("polygon"),null==(n=z.current)||n.createMouseTool("polygon")),function(){V()}},[R]),(0,l.useEffect)(function(){if(R)return function(){if(!G.current){var e;null==(e=z.current)||e.map.getAllOverlays().forEach(function(e){Z(e,!1)})}}},[R]);var W=(0,o.useMemoizedFn)(function(){var e,t,n,r=null==(e=z.current)?void 0:e.editor().getTarget(),o=null==(t=z.current)?void 0:t.map.getAllOverlays(),i=null==o?void 0:o.filter(function(e){if(e!==r&&void 0!==e.getExtData().id)return"getPosition"in e?T.isPointInRing(e.getPosition(),null==r?void 0:r.getPath()):T.doesRingRingIntersect(e.getPath(),null==r?void 0:r.getPath())});O(null==i?void 0:i.map(function(e){return Z(e,!0),e.getExtData().id})),null==r||r.remove(),null==(n=z.current)||n.editor().close()});return(0,l.useEffect)(function(){if(y&&z.current&&m){var e=m.map(function(e){var t,n=null==(t=(0,s.el)(e,j,null==L?void 0:L.interface))?void 0:t.filter(Boolean),r=(0,s.PB)(N,e[v]);return(null==n?void 0:n.length)?n.map(function(t){var n;return null==(n=z.current)?void 0:n.setOverlay(J,t,{bubble:!0,strokeColor:u.A,fillColor:u.A,cursor:"pointer",label:{direction:"bottom",offset:[0,5],content:v?$(r):void 0},extData:{id:e[S]}})}):[]}).flat().filter(Boolean);1===e.length&&"point"===J?(null==(r=z.current)||null==(n=r.map)||n.setFitView(e),null==(i=z.current)||null==(o=i.map)||o.setZoom(w||13)):null==(a=z.current)||null==(l=a.map)||l.setFitView(e);var t=e.map(function(e){var t=function(e){var t=e.target,n=t.getExtData();if(n){if(G.current){"click"===G.current&&(O(function(e){return n.selected?e.filter(function(e){return e!==n.id}):I(e).concat([n.id])}),Z(t));return}var r=m.find(function(e){return n.id===e[S]});r&&x(r)}};return e.on("click",t),function(){return e.off("click",t)}});if("point"===J&&(null==A?void 0:A.length)&&(null==e?void 0:e.length)>1){var n,r,o,i,l,a,c,f=e.map(function(e){return e.getPosition()});e[0].setzIndex(13),e[e.length-1].setzIndex(13);var p=function(){var e,t,n=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(null==(e=z.current)?void 0:e.map)return new AMap.Text({label:{direction:"top",offset:[0,0],content:n?K("Start point"):K("End point")},position:f[n?0:f.length-1],map:null==(t=z.current)?void 0:t.map})};e.push.apply(e,I([null==(c=z.current)?void 0:c.setOverlay("lineString",f,{strokeColor:u.A,fillColor:u.A,strokeWeight:2,cursor:"pointer"}),p(),p(!1)].filter(Boolean)))}return function(){e.forEach(function(e){e.remove()}),t.forEach(function(e){return e()})}}},[null==L?void 0:L.interface,y,$,m,J,!1,U,N,A,j,v,P,x,S,O,K,w]),(0,l.useEffect)(function(){setTimeout(function(){O([])})},[m,O]),a().createElement("div",{style:{position:"relative",height:"100%"}},a().createElement("div",{style:{position:"absolute",left:10,top:10,zIndex:999}},!U||(null==(h=z.current)?void 0:h.errMessage)?null:a().createElement(i.Space,{direction:"vertical"},a().createElement(i.Button,{style:{color:R?void 0:u.v,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),B("")},icon:a().createElement(r.EnvironmentOutlined,null)}),a().createElement(i.Button,{style:{color:"selection"===R?u.v:void 0,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),B("selection")},icon:a().createElement(r.ExpandOutlined,null)}),"selection"===R?a().createElement(i.Button,{type:"primary",icon:a().createElement(r.CheckOutlined,null),title:K("Confirm selection"),onClick:W}):null)),a().createElement(k,(t=C({},e),n=n={ref:function(e){z.current=e,_(!!(null==e?void 0:e.map)&&!e.errMessage)},style:b?{height:"100%"}:void 0,zoom:w,type:J,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:u.v,fillColor:u.v}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)))}},348:function(e,t,n){"use strict";n.d(t,{Y6:function(){return U},G$:function(){return $}});var r,o,i=n(375),l=n(625),a=n(59),c=n(155),u=n.n(c),s=n(970),f=n(802),p=n(294),d=n(488),g=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(o=r;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;0!=o--;){var r,o,i,l=i[o];if(!e(t[l],n[l]))return!1}return!0}return t!=t&&n!=n};let h="__googleMapsScriptId";(r=o||(o={}))[r.INITIALIZED=0]="INITIALIZED",r[r.LOADING=1]="LOADING",r[r.SUCCESS=2]="SUCCESS",r[r.FAILURE=3]="FAILURE";class y{constructor({apiKey:e,authReferrerPolicy:t,channel:n,client:r,id:o=h,language:i,libraries:l=[],mapIds:a,nonce:c,region:u,retries:s=3,url:f="https://maps.googleapis.com/maps/api/js",version:p}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=e,this.authReferrerPolicy=t,this.channel=n,this.client=r,this.id=o||h,this.language=i,this.libraries=l,this.mapIds=a,this.nonce=c,this.region=u,this.retries=s,this.url=f,this.version=p,y.instance){if(!g(this.options,y.instance.options))throw Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(y.instance.options)}`);return y.instance}y.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?o.FAILURE:this.done?o.SUCCESS:this.loading?o.LOADING:o.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let e=this.url;return e+="?callback=__googleMapsCallback",this.apiKey&&(e+=`&key=${this.apiKey}`),this.channel&&(e+=`&channel=${this.channel}`),this.client&&(e+=`&client=${this.client}`),this.libraries.length>0&&(e+=`&libraries=${this.libraries.join(",")}`),this.language&&(e+=`&language=${this.language}`),this.region&&(e+=`®ion=${this.region}`),this.version&&(e+=`&v=${this.version}`),this.mapIds&&(e+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(e+=`&auth_referrer_policy=${this.authReferrerPolicy}`),e}deleteScript(){let e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((e,t)=>{this.loadCallback(n=>{n?t(n.error):e(window.google)})})}importLibrary(e){return this.execute(),google.maps.importLibrary(e)}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){var e,t;let n,r,o,i,l,a,c,u,s,f,p;if(document.getElementById(this.id))return void this.callback();let d={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(d).forEach(e=>!d[e]&&delete d[e]),(null==(t=null==(e=null==window?void 0:window.google)?void 0:e.maps)?void 0:t.importLibrary)||(i="google",l="importLibrary",a=document,u=(c=(c=window)[i]||(c[i]={})).maps||(c.maps={}),s=new Set,f=new URLSearchParams,p=()=>n||(n=new Promise((e,t)=>{var l,c,p,g;return l=this,c=void 0,p=void 0,g=function*(){var l;for(o in yield r=a.createElement("script"),r.id=this.id,f.set("libraries",[...s]+""),d)f.set(o.replace(/[A-Z]/g,e=>"_"+e[0].toLowerCase()),d[o]);f.set("callback",i+".maps.__ib__"),r.src=this.url+"?"+f,u.__ib__=e,r.onerror=()=>n=t(Error("The Google Maps JavaScript API could not load.")),r.nonce=this.nonce||(null==(l=a.querySelector("script[nonce]"))?void 0:l.nonce)||"",a.head.append(r)},new(p||(p=Promise))(function(e,t){function n(e){try{o(g.next(e))}catch(e){t(e)}}function r(e){try{o(g.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):((o=t.value)instanceof p?o:new p(function(e){e(o)})).then(n,r)}o((g=g.apply(l,c||[])).next())})})),u[l]?console.warn("The Google Maps JavaScript API only loads once. Ignoring:",d):u[l]=(e,...t)=>s.add(e)&&p().then(()=>u[l](e,...t)));let g=this.libraries.map(e=>this.importLibrary(e));g.length||g.push(this.importLibrary("core")),Promise.all(g).then(()=>this.callback(),e=>{let t=new ErrorEvent("error",{error:e});this.loadErrorCallback(t)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){let e=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${e} ms.`),setTimeout(()=>{this.deleteScript(),this.setScript()},e)}else this.onerrorEvent=e,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(e=>{e(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading||(this.loading=!0,this.setScript())}}}var v=n(694),m=n(899),b=n(211);function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var O=function(e){var t,n=e.toCenter,r=e.mapRef,o=(0,d.kj)(),i=(0,c.useRef)(),s=function(e){if(Array.isArray(e))return e}(t=(0,c.useState)([]))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return w(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return w(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),f=s[0],p=s[1];(0,c.useEffect)(function(){google.maps.importLibrary("places").then(function(e){i.current=new e.AutocompleteService}).catch(function(){a.message.error("Please configure the Google API Key correctly")})},[r]);var g=(0,l.useDebounceFn)(function(e){i.current&&i.current.getPlacePredictions({input:e||" "},function(e,t){t!==google.maps.places.PlacesServiceStatus.OK?p([]):p(e.map(function(e){var t,n,r=e.structured_formatting;return t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),n=n={label:"".concat(r.main_text).concat(r.secondary_text?" "+r.secondary_text:""),value:e.place_id},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t}))})},{wait:300}).run;return u().createElement("div",{style:{position:"absolute",top:10,left:10,zIndex:10,width:"calc(100% - 20px)"}},u().createElement(a.Select,{id:"google-map-search",showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:o("Enter keywords to search"),filterOption:!1,onSearch:g,onSelect:function(e){var t=f.find(function(t){return t.value===e});new google.maps.places.PlacesService(r.current).getDetails({placeId:t.place_id,fields:["geometry"]},function(e,t){t===google.maps.places.PlacesServiceStatus.OK&&n(e.geometry.location)})},options:f}))},A=function(e){return{url:e,scaledSize:{width:19,height:32},labelOrigin:new google.maps.Point(9.5,42)}};function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function P(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function k(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function C(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){k(e,t,n[t])})}return e}function E(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||L(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e){return function(e){if(Array.isArray(e))return M(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||L(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e,t){if(e){if("string"==typeof e)return M(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return M(e,t)}}var x={point:{propertyKey:"position",overlay:"Marker"},polygon:{propertyKey:"paths",overlay:"Polygon"},lineString:{propertyKey:"path",overlay:"Polyline"},circle:{transformOptions:function(e){return{center:new google.maps.LatLng(e[1],e[0]),radius:e[2]}},overlay:"Circle"}},D=function(){var e;function t(e){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");k(this,"listeners",new Set),k(this,"mapListeners",[]),k(this,"options",void 0),k(this,"drawingMode",null),k(this,"draftOverlay",null),k(this,"draftPath",[]),k(this,"circleCenter",null),k(this,"lastClickPosition",null),this.options=e,this.setDrawingMode(e.drawingMode||null)}return e=[{key:"addListener",value:function(e,t){var n=this;return"overlaycomplete"===e&&this.listeners.add(t),{remove:function(){n.listeners.delete(t)}}}},{key:"setDrawingMode",value:function(e){this.drawingMode=e,this.resetDraft(),this.bindMapEvents()}},{key:"handleClick",value:function(e){e.latLng&&this.handlePositionClick(e.latLng)}},{key:"handleOverlayClick",value:function(e,t){var n=e.latLng||t;n&&this.handlePositionClick(n)}},{key:"handleDoubleClick",value:function(){this.completePathOverlay()}},{key:"unbindAll",value:function(){this.listeners.clear(),this.clearMapEvents(),this.resetDraft(),this.drawingMode=null}},{key:"completeDrawing",value:function(){"polygon"===this.drawingMode||"polyline"===this.drawingMode?this.completePathOverlay():"circle"===this.drawingMode&&this.completeCircleOverlay()}},{key:"bindMapEvents",value:function(){var e=this;this.clearMapEvents(),this.options.map&&this.drawingMode&&(("polygon"===this.drawingMode||"polyline"===this.drawingMode)&&this.options.map.setOptions({draggableCursor:"crosshair",disableDoubleClickZoom:!0}),this.mapListeners.push(this.options.map.addListener("click",function(t){e.handleClick(t)}),this.options.map.addListener("dblclick",function(){e.handleDoubleClick()}),this.options.map.addListener("mousemove",function(t){t.latLng&&e.updatePreview(t.latLng)})))}},{key:"clearMapEvents",value:function(){var e;this.mapListeners.forEach(function(e){var t;return null==e||null==(t=e.remove)?void 0:t.call(e)}),this.mapListeners.length=0,null==(e=this.options.map)||e.setOptions({draggableCursor:void 0,disableDoubleClickZoom:!1})}},{key:"resetDraft",value:function(){var e;null==(e=this.draftOverlay)||e.setMap(null),this.draftOverlay=null,this.draftPath=[],this.circleCenter=null,this.lastClickPosition=null}},{key:"handlePositionClick",value:function(e){if(!this.shouldSkipDuplicateClick(e)){if("marker"===this.drawingMode)return void this.emitComplete("marker",new google.maps.Marker(E(C({},this.options),{icon:A(s.X),position:e})));if("circle"===this.drawingMode)return void this.handleCircleClick(e);("polygon"===this.drawingMode||"polyline"===this.drawingMode)&&this.handlePathClick(e)}}},{key:"shouldSkipDuplicateClick",value:function(e){var t=this.lastClickPosition&&this.lastClickPosition.lat()===e.lat()&&this.lastClickPosition.lng()===e.lng();return this.lastClickPosition=e,t}},{key:"handlePathClick",value:function(e){if("polygon"===this.drawingMode||"polyline"===this.drawingMode){if(this.draftPath.push(e),!this.draftOverlay){this.draftOverlay="polygon"===this.drawingMode?new google.maps.Polygon(E(C({},this.options),{paths:this.draftPath})):new google.maps.Polyline(E(C({},this.options),{path:this.draftPath}));return}this.updatePath(this.draftPath)}}},{key:"handleCircleClick",value:function(e){if(!this.circleCenter){this.circleCenter=e,this.draftOverlay=new google.maps.Circle(E(C({},this.options),{center:e,radius:0}));return}this.updateCircle(e),this.completeCircleOverlay()}},{key:"updatePreview",value:function(e){"circle"===this.drawingMode&&this.circleCenter?this.updateCircle(e):("polygon"===this.drawingMode||"polyline"===this.drawingMode)&&this.draftOverlay&&this.updatePath(j(this.draftPath).concat([e]))}},{key:"updatePath",value:function(e){S(this.draftOverlay,google.maps.Polygon)?this.draftOverlay.setPath(e):S(this.draftOverlay,google.maps.Polyline)&&this.draftOverlay.setPath(e)}},{key:"updateCircle",value:function(e){S(this.draftOverlay,google.maps.Circle)&&this.circleCenter&&this.draftOverlay.setRadius(google.maps.geometry.spherical.computeDistanceBetween(this.circleCenter,e))}},{key:"completePathOverlay",value:function(){if(("polygon"===this.drawingMode||"polyline"===this.drawingMode)&&this.draftOverlay&&("polygon"!==this.drawingMode||!(this.draftPath.length<3))&&("polyline"!==this.drawingMode||!(this.draftPath.length<2))){var e=this.draftOverlay,t=this.drawingMode;this.updatePath(this.draftPath),this.draftOverlay=null,this.draftPath=[],this.emitComplete(t,e)}}},{key:"completeCircleOverlay",value:function(){if(S(this.draftOverlay,google.maps.Circle)){var e=this.draftOverlay;this.draftOverlay=null,this.circleCenter=null,this.emitComplete("circle",e)}}},{key:"emitComplete",value:function(e,t){this.listeners.forEach(function(n){n({type:e,overlay:t})})}}],function(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)}}(t.prototype,e),t}(),U=u().forwardRef(function(e,t){var n=e.value,r=e.onChange,o=e.block,p=void 0!==o&&o,g=e.readonly,h=e.disabled,w=void 0===h?p:h,M=e.zoom,k=void 0===M?13:M,L=e.overlayCommonOptions,U=e.height,_=e.type,z=((0,m.cV)(e.mapType)||{}).accessKey,T=(0,d.kj)(),F=(0,v.useFlowContext)(),R=(0,l.useMemoizedFn)(function(){return T("Load google maps failed, Please check the Api key and refresh the page")}),B=(0,c.useRef)(),K=(0,c.useRef)(),$=(0,c.useRef)(),G=I((0,c.useState)([]),2),N=G[0],J=G[1],Z=I((0,c.useState)(""),2),V=Z[0],W=Z[1],q=a.App.useApp().modal;(0,c.useEffect)(function(){if(K.current&&!p){var e;null==(e=K.current)||e.setZoom(k)}},[k,p]);var X=(0,c.useRef)("point"===_?"marker":"lineString"===_?"polyline":_),H=I((0,c.useState)(C({strokeWeight:5,strokeColor:f.A,fillColor:f.A,strokeOpacity:1,editable:!w,draggable:!w},L)),1)[0],Y=(0,c.useRef)(),Q=(0,c.useRef)(new Set),ee=(0,l.useMemoizedFn)(function(e){if(Q.current.forEach(function(e){Q.current.delete(e)}),"getPath"in e){var t=e.getPath();["insert_at","remove_at","set_at"].forEach(function(n){Q.current.add(t.addListener(n,function(){ei(e,!0)}).remove)})}else S(e,google.maps.Circle)&&["center_changed","radius_changed"].forEach(function(t){Q.current.add(e.addListener(t,function(){ei(e,!0)}).remove)})}),et=(0,l.useMemoizedFn)(function(){if($.current&&($.current.unbindAll(),$.current.setMap(null)),"point"!==_){var e;null==(e=B.current)||e.setDrawingMode(null)}}),en=(0,l.useMemoizedFn)(function(e){if(K.current&&e){var t,n;null==(t=K.current)||t.setCenter(e),null==(n=K.current)||n.setZoom(k)}}),er=(0,l.useMemoizedFn)(function(e){et(),ee(e),$.current=e}),eo=(0,l.useMemoizedFn)(function(e){if(null==e?void 0:e.length){if(1===e.length&&S(e[0],google.maps.Marker)){null==(o=K.current)||null==(r=o.setCenter)||r.call(o,e[0].getPosition()),null==(l=K.current)||null==(i=l.setZoom)||i.call(l,k||13);return}var t,n,r,o,i,l,a=new google.maps.LatLngBounds;e.forEach(function(e){if(S(e,google.maps.Marker))a.extend(e.getPosition());else if(S(e,google.maps.Polyline)||S(e,google.maps.Polygon))for(var t=e.getPath(),n=0;n<t.getLength();n++)a.extend(t.getAt(n));else S(e,google.maps.Circle)&&a.union(e.getBounds())}),null==(n=K.current)||null==(t=n.fitBounds)||t.call(n,a)}}),ei=(0,l.useMemoizedFn)(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=null;if("point"===_){var o=e.getPosition(),i=o.lat;n=[(0,o.lng)(),i()]}else if("polygon"===_||"lineString"===_){if((n=e.getPath().getArray().map(function(e){return[e.lng(),e.lat()]})).length<2)return}else if("circle"===_){var l=e.getCenter(),a=e.getRadius();n=[l.lng(),l.lat(),a]}t||er(e),null==r||r(n)}),el=(0,l.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0,n=E(C({},H,t),{map:K.current});return B.current=new D(E(C({drawingMode:X.current},n),{icon:A(s.X)})),e||B.current.addListener("overlaycomplete",function(e){ei(e.overlay)}),B.current}),ea=(0,l.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=arguments.length>2?arguments[2]:void 0,o=x[e];if(o){var i=C(E(C({},H),{icon:A(s.X)}),r);return"transformOptions"in o?Object.assign(i,o.transformOptions(t)):"propertyKey"in o&&(i[o.propertyKey]=Array.isArray(t[0])?t.map(function(e){return new google.maps.LatLng(e[1],e[0])}):new google.maps.LatLng(t[1],t[0])),new google.maps[o.overlay](i)}}),ec=(0,l.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=arguments.length>2?arguments[2]:void 0;if(K.current)return ea(e,t,E(C({},r),{map:K.current}))});(0,c.useEffect)(function(){if(!n&&K.current){var e,t;et(),null==B||null==(t=B.current)||null==(e=t.setDrawingMode)||e.call(t,X.current),null==r||r(null)}if(K.current&&n&&(g||!$.current)){var o=ec();er(o),eo([o])}},[n,N,_,w,g,ec,eo,er,r,et]),(0,c.useEffect)(function(){if(z&&!K.current&&Y.current){var e,t=!1;try{e=new y({apiKey:z,version:"weekly",language:F.api.auth.getLocale()})}catch(e){W(R());return}var n=console.error;return console.error=function(e){for(var t,r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];(null==e||null==(t=e.includes)?void 0:t.call(e,"InvalidKeyMapError"))&&W(R()),n.apply(void 0,[e].concat(j(o)))},Promise.all([e.importLibrary("maps"),e.importLibrary("marker"),e.importLibrary("core"),e.importLibrary("geometry")]).then(function(e){var n;return(n=function(){var e,n;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var u=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(r){switch(r.label){case 0:return[4,new Promise(function(e){var t=function(){e({lat:37.4224764,lng:-122.0842499})};navigator.geolocation?navigator.geolocation.getCurrentPosition(function(t){var n=t.coords;e({lat:n.latitude,lng:n.longitude})},function(){t()},{timeout:2e3,maximumAge:0}):t()})];case 1:return e=r.sent(),[4,new Promise(function(e){return requestAnimationFrame(e)})];case 2:if(r.sent(),n=Y.current,t||!S(n,HTMLElement))return[2];return K.current=new google.maps.Map(n,{zoom:k,center:e,mapTypeId:google.maps.MapTypeId.ROADMAP,zoomControl:!1,streetViewControl:!1,panControl:!1,mapTypeControl:!1,fullscreenControl:!1}),google.maps.event.trigger(K.current,"resize"),W(""),J([]),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function l(e){P(i,r,o,l,a,"next",e)}function a(e){P(i,r,o,l,a,"throw",e)}l(void 0)})})()}).catch(function(e){if(S(e,Error))return void W(e.message)}),function(){var e,n;t=!0,null==(e=K.current)||e.unbindAll(),K.current=null,null==(n=B.current)||n.unbindAll()}}},[z,F.api.auth,R,k]),(0,c.useEffect)(function(){K.current&&_&&!w&&!B.current&&el()},[el,w,N,_]),(0,c.useImperativeHandle)(t,function(){return{setOverlay:ec,getOverlay:ea,setFitView:eo,createDraw:el,map:K.current,overlay:$.current,drawingManager:B.current,errMessage:V}});var eu=(0,l.useMemoizedFn)(function(){var e=function(){et(),B.current.setDrawingMode(X.current),null==r||r(null)};q.confirm({title:T("Clear the canvas"),content:T("Are you sure to clear the canvas?"),okText:T("Confirm"),cancelText:T("Cancel"),getContainer:function(){return Y.current},onOk:function(){e()}})});return!z||V?u().createElement(a.Alert,{action:u().createElement(a.Button,{type:"primary",href:(0,b.J)(F.app,window.location.pathname,"?tab=google"),target:"_blank",rel:"noopener noreferrer",onClick:function(){var e,t;null==(t=F.view)||null==(e=t.close)||e.call(t)}},T("Go to the configuration page")),message:V||T("Please configure the Api key first"),type:"error"}):u().createElement("div",{style:{position:"relative",height:U||500}},!K.current&&u().createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"}},u().createElement(a.Spin,null)),w?null:u().createElement(u().Fragment,null,K.current&&u().createElement(O,{toCenter:en,mapRef:K}),u().createElement("div",{style:{position:"absolute",bottom:80,right:20,zIndex:10}},u().createElement(a.Button,{onClick:function(){$.current&&eo([$.current])},disabled:!$.current,type:"primary",shape:"round",size:"large",icon:u().createElement(i.SyncOutlined,null)})),"lineString"===_||"polygon"===_?u().createElement("div",{style:{position:"absolute",bottom:20,left:10,zIndex:2,pointerEvents:"none"}},u().createElement(a.Alert,{message:T("Click to select the starting point and double-click to end the drawing"),type:"info"})):null,u().createElement("div",{style:{position:"absolute",bottom:20,right:20,zIndex:2}},u().createElement(a.Button,{disabled:!n,style:{height:"40px"},onClick:eu,type:"primary",danger:!0},T("Clear")))),u().createElement("div",{ref:Y,style:C({width:"100%",height:"100%"},null==e?void 0:e.style)}))});function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function z(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function T(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function F(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||R(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e,t){if(e){if("string"==typeof e)return _(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _(e,t)}}U.displayName="GoogleMapsCom";var B="google-maps-overlay-id",K="google-maps-overlay-selected",$=function(e){var t,n,r,o=e.collectionField,g=e.marker,h=e.dataSource,y=e.fixedBlock,v=e.zoom,m=e.setSelectedRecordKeys,b=e.lineSort,w=e.fields,O=(e.name,e.primaryKey),M=e.mapField,P=e.associationCollectionField,k=e.onOpenView,S=F((0,c.useState)(!1),2),C=S[0],E=S[1],I=(0,c.useRef)(),j=F((0,c.useState)(""),2),L=j[0],x=j[1],D=(0,d.kj)(),$=(0,l.useMemoizedFn)(function(e){return(0,p.Gq)(e,D)}),G=(F((0,c.useState)(null),2)[1],(0,c.useRef)(L)),N=(0,c.useRef)(null),J=(0,c.useRef)([]);G.current=L;var Z=null==(r=w.find(function(e){return e.name===g}))?void 0:r.uiSchema,V=o.interface||o.type,W=function(e,t){var n=void 0!==t?!t:e.get(K);e.set(K,!n),e.setOptions(T({},n?{icon:A(s.X),strokeColor:f.A,fillColor:f.A}:{icon:A(s.F),strokeColor:f.v,fillColor:f.v}))};(0,c.useEffect)(function(){if("selection"===L){!I.current||(null==(e=I.current)?void 0:e.drawingManager)||(I.current.drawingManager=null==(r=I.current)?void 0:r.createDraw(!0,{editable:!0,draggable:!0}));var e,t,n,r,o=new Set;return null==(t=I.current)||t.drawingManager.setDrawingMode("polygon"),null==(n=I.current)||n.drawingManager.addListener("overlaycomplete",function(e){var t,n=e.overlay;null==(t=I.current)||t.drawingManager.setDrawingMode(null),N.current=n;var r=n.getPath();["insert_at","remove_at","set_at"].forEach(function(e){o.add(r.addListener(e,function(){}).remove)})}),function(){var e,t,n,r;o.forEach(function(e){e()}),I.current&&(null==(e=N.current)||e.unbindAll(),null==(t=N.current)||t.setMap(null),N.current=null,null==(n=I.current)||n.drawingManager.setDrawingMode(null),null==(r=I.current)||r.drawingManager.unbindAll())}}},[L]),(0,c.useEffect)(function(){if(L)return function(){G.current||J.current.forEach(function(e){W(e,!1)})}},[L]);var q=(0,l.useMemoizedFn)(function(){null==(t=I.current)||null==(e=t.drawingManager)||e.completeDrawing();var e,t,n,r,o=N.current;if(o){var i=J.current,l=google.maps.geometry.poly,a=i.filter(function(e){if(e!==o&&void 0!==e.get(B))if(z(e,google.maps.Marker)){var t=e.getPosition();return!!t&&l.containsLocation(t,o)}else{if(!z(e,google.maps.Circle))return e.getPath().getArray().some(function(e){return l.containsLocation(e,o)});var n=e.getCenter();return!!n&&l.containsLocation(n,o)}}).map(function(e){return W(e,!0),e.get(B)});m(function(e){return a.concat(e)}),o.unbindAll(),o.setMap(null),N.current=null,null==(r=I.current)||null==(n=r.drawingManager)||n.setDrawingMode("polygon")}});return(0,c.useEffect)(function(){if(o&&(null==h?void 0:h.length)&&(null==(r=I.current)?void 0:r.map)){var e=h.map(function(e){var t,n=null==(t=(0,p.el)(e,M,null==P?void 0:P.interface))?void 0:t.filter(Boolean),r=(0,p.PB)(Z,e[g]);return(null==n?void 0:n.length)?null==n?void 0:n.filter(Boolean).map(function(t){if(n){var o,i=null==(o=I.current)?void 0:o.setOverlay(V,t,{strokeColor:f.A,fillColor:f.A,cursor:"pointer",label:{className:"nb-map-google-label",fontFamily:"inherit",fontSize:"13px",color:"#333",text:g?$(r):void 0}});return null==i||i.set(B,e[O]),i}}):[]}).flat().filter(Boolean);J.current=e;var t=e.map(function(e){return e.addListener("click",function(t){if("selection"===G.current){var n,r,o=z(e,google.maps.Marker)?e.getPosition():void 0;null==(r=I.current)||null==(n=r.drawingManager)||n.handleOverlayClick(t,o);return}var i=e.get(B);if(i){var l=null==h?void 0:h.find(function(e){return i===e[O]});l&&k(l)}}),e.addListener("dblclick",function(){if("selection"===G.current){var e,t;null==(t=I.current)||null==(e=t.drawingManager)||e.handleDoubleClick()}}),function(){return e.unbindAll()}});if("point"===V&&(null==b?void 0:b.length)&&(null==e?void 0:e.length)>1){var n,r,i,l=e.map(function(e){return e.getPosition()});e[0].setZIndex(138),e[e.length-1].setZIndex(138);var a=function(){var e,t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(null==(e=I.current)?void 0:e.map)return new google.maps.Marker({label:{className:"nb-map-google-point-label",fontFamily:"inherit",fontSize:"13px",color:"#333",text:t?D("Start point"):D("End point")},icon:A(s.X),position:t?l[0]:l[l.length-1],map:I.current.map})};e.push.apply(e,function(e){if(Array.isArray(e))return _(e)}(n=[I.current.setOverlay("lineString",l.map(function(e){return[e.lng(),e.lat()]}),{strokeColor:f.A,fillColor:f.A,strokeWeight:2,cursor:"pointer"}),a(),a(!1)].filter(Boolean))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||R(n)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}return null==(i=I.current)||i.setFitView(e),function(){e.forEach(function(e){e.setMap(null),e.unbindAll()}),t.forEach(function(e){return e()})}}},[null==P?void 0:P.interface,o,$,h,V,!1,C,Z,b,M,g,k,O,D]),(0,c.useEffect)(function(){setTimeout(function(){m([])})},[h,m]),u().createElement("div",{style:{position:"relative",height:"100%"}},C&&u().createElement(u().Fragment,null,u().createElement("div",{style:{position:"absolute",left:10,top:10,zIndex:999}},u().createElement(a.Space,{direction:"vertical"},u().createElement(a.Button,{style:{color:L?void 0:f.v,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),x("")},icon:u().createElement(i.EnvironmentOutlined,null)}),u().createElement(a.Button,{style:{color:"selection"===L?f.v:void 0,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),x("selection")},icon:u().createElement(i.ExpandOutlined,null)}),"selection"===L?u().createElement(a.Button,{type:"primary",icon:u().createElement(i.CheckOutlined,null),title:D("Confirm selection"),onClick:q}):null))),u().createElement(U,(t=T({},e),n=n={ref:function(e){I.current=e,E(!!(null==e?void 0:e.map)&&!e.errMessage)},style:y?{height:"100%"}:void 0,zoom:v,type:V,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:f.v,fillColor:f.v}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)))}},211:function(e,t,n){"use strict";n.d(t,{J:function(){return o}});var r=n(485);function o(e,t){var n,o,i,l,a,c,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=e.getPublicPath(),f=(0,r.stripModernClientPrefix)(s).replace(/\/+$/,""),p=(n=e.name,i="/".concat(s).replace(/\/{2,}/g,"/").replace(/\/+$/,""),l="/".concat(t).replace(/\/{2,}/g,"/").split(/[?#]/)[0],a=i&&(l===i||l.startsWith("".concat(i,"/")))?l.slice(i.length)||"/":l,(c=null==(o=/^\/(?:apps|_app)\/[^/]+(?=\/|$)/.exec(a))?void 0:o[0])?c:n&&"main"!==n?"/apps/".concat(n):""),d=e.pluginSettingsManager.getRoutePath("map").replace(/^\/admin\/settings(?=\/|$)/,"/settings"),g=d.replace(/^\/settings(?=\/|$)/,"");return p?"".concat(f,"/settings").concat(p).concat(g).concat(u):"".concat(f).concat(d).concat(u)}},970:function(e,t,n){"use strict";n.d(t,{F:function(){return i},X:function(){return l}});var r=n(802),o=function(e){return"data:image/svg+xml;utf8,".concat(encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="38" height="63" viewBox="0 0 38 63"><path fill="'.concat(e,'" d="M19 0C8.5 0 0 8.5 0 19c0 14.2 19 44 19 44s19-29.8 19-44C38 8.5 29.5 0 19 0Z"/><circle fill="white" cx="19" cy="19" r="8"/></svg>')))},i=o(r.v),l=o(r.A)},802:function(e,t,n){"use strict";n.d(t,{A:function(){return r},v:function(){return o}});var r="#4e9bff",o="#F18b62"},294:function(e,t,n){"use strict";n.d(t,{DP:function(){return i},Gq:function(){return l},PB:function(){return a},el:function(){return r},zd:function(){return o}});var r=function(e,t,n){var r=null==t?void 0:t.reduce(function(e,r,o){return o===t.length-1&&("o2m"===n||"m2m"===n)?null==e?void 0:e.map(function(e){return e[r]}).filter(function(e){return null!=e}):null==e?void 0:e[r]},e);return"o2m"===n||"m2m"===n?r:[r]},o=function(e){window.requestIdleCallback?window.requestIdleCallback(function(){e()}):window.setTimeout(e,1)},i=function(e,t){if("string"==typeof e)return e;if((null!=(n=Error)&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n)&&e.message)return e.message;if(e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&"message"in e){var n,r=e.message;if("string"==typeof r&&r)return r}return t},l=function(e,t){return"string"!=typeof e?e:e.replace(/\{\{\s*t\(['"]([^'"]+)['"](?:,\s*([^}]+))?\)\s*\}\}/g,function(e,n){return t?t(n):n})},a=function(e,t){if(null==t)return t;var n=(null==e?void 0:e.enum)||(null==e||null==(r=e["x-component-props"])?void 0:r.options);if(Array.isArray(n)){var r,o,i,l=n.find(function(e){return(null==e?void 0:e.value)===t});if(l)return null!=(o=null!=(i=l.label)?i:l.title)?o:t}return t}}}]);
|
package/dist/client-v2/index.js
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("@emotion/css"),require("@nocobase/client-v2"),require("antd"),require("react"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-map/client-v2",["ahooks","@emotion/css","@nocobase/client-v2","antd","react","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-map/client-v2"]=t(require("ahooks"),require("@emotion/css"),require("@nocobase/client-v2"),require("antd"),require("react"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-map/client-v2"]=t(e.ahooks,e["@emotion/css"],e["@nocobase/client-v2"],e.antd,e.react,e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,c){return function(){"use strict";var u,a,l,f={488:function(e,t,n){n.d(t,{MZ:function(){return c},kj:function(){return u}});var r=n(694);function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var i="@nocobase/plugin-map";function c(e,t){return(0,r.tExpr)(e,o({ns:[i,"client"]},t))}function u(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,o({ns:[i,"client"]},n))}}},375:function(e){e.exports=i},477:function(e){e.exports=t},485:function(e){e.exports=n},694:function(e){e.exports=c},625:function(t){t.exports=e},59:function(e){e.exports=r},155:function(e){e.exports=o}},p={};function s(e){var t=p[e];if(void 0!==t)return t.exports;var n=p[e]={exports:{}};return f[e].call(n.exports,n,n.exports,s),n.exports}s.m=f,s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce(function(t,n){return s.f[n](e,t),t},[]))},s.u=function(e){return""+e+"."+({577:"e1fcc82fab0ef39b",641:"ffcfb694badc38ad",694:"5f486a695fdeb42a",720:"6ede563c5d95f038",872:"53cbb217b7708463"})[e]+".js"},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},b={},s.l=function(e,t,n,r){if(b[e])return void b[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var a=c[u];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-map/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,s.nc&&o.setAttribute("nonce",s.nc),o.setAttribute("data-rspack","@nocobase/plugin-map/client-v2:"+n),o.src=e),b[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=b[e];if(delete b[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},s.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(y=s.g.location+"");var b,y,d=s.g.document;if(!y&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(y=d.currentScript.src),!y)){var h=d.getElementsByTagName("script");if(h.length)for(var v=h.length-1;v>-1&&(!y||!/^http(s?):/.test(y));)y=h[v--].src}if(!y)throw Error("Automatic publicPath is not supported in this browser");s.p=y.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u={889:0},s.f.j=function(e,t){var n=s.o(u,e)?u[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=u[e]=[t,r]});t.push(n[2]=r);var o=s.p+s.u(e),i=Error();s.l(o,function(t){if(s.o(u,e)&&(0!==(n=u[e])&&(u[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},a=function(e,t){var n,r,o=t[0],i=t[1],c=t[2],a=0;if(o.some(function(e){return 0!==u[e]})){for(n in i)s.o(i,n)&&(s.m[n]=i[n]);c&&c(s)}for(e&&e(t);a<o.length;a++)r=o[a],s.o(u,r)&&u[r]&&u[r][0](),u[r]=0},(l=self.webpackChunk_nocobase_plugin_map_client_v2=self.webpackChunk_nocobase_plugin_map_client_v2||[]).forEach(a.bind(null,0)),l.push=a.bind(null,l.push.bind(l));var m={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-map/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-map/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var c=window.location.pathname||"/",u=c.indexOf(i);e=u>=0?c.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-map/dist/client-v2/"}s.p=e}(),!function(){s.r(m),s.d(m,{default:function(){return D}});var e=s(485),t=s(488),n=[{label:(0,t.MZ)("AMap"),value:"amap"},{label:(0,t.MZ)("Google Maps"),value:"google"}];function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}var u=function(e){var u;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function a(){var e,i,u;if(!(this instanceof a))throw TypeError("Cannot call a class as a function");return i=a,u=arguments,i=o(i),r(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,c()?Reflect.construct(i,u||[],o(this).constructor):i.apply(this,u)),"type","object"),r(e,"group","map"),r(e,"sortable",!0),r(e,"titleUsable",!1),r(e,"availableTypes",["json"]),r(e,"configure",{items:[{name:"uiSchema.x-component-props.mapType",title:(0,t.MZ)("Map type"),component:"Select",required:!0,disabled:function(e){return!e.context.createOnly},defaultValue:"amap",componentProps:{showSearch:!1,allowClear:!1},options:n}]}),e}return a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),e&&i(a,e),u=[{key:"createDefault",value:function(e){return{interface:e,type:e,uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}}}}],function(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)}}(a.prototype,u),a}(e.CollectionFieldInterface);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}var b=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=arguments,r=l(r),a(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,p()?Reflect.construct(r,o||[],l(this).constructor):r.apply(this,o)),"name","circle"),a(e,"order",3),a(e,"title",(0,t.MZ)("Circle")),a(e,"description",(0,t.MZ)("Circle")),a(e,"availableTypes",["circle","json"]),a(e,"default",e.createDefault("circle")),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&f(n,e),n}(u);function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}var g=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=arguments,r=d(r),y(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,v()?Reflect.construct(r,o||[],d(this).constructor):r.apply(this,o)),"name","lineString"),y(e,"order",2),y(e,"title",(0,t.MZ)("Line")),y(e,"description",(0,t.MZ)("Line")),y(e,"availableTypes",["lineString","json"]),y(e,"default",e.createDefault("lineString")),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&h(n,e),n}(u);function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(M=function(){return!!e})()}var E=[function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=arguments,r=w(r),O(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,j()?Reflect.construct(r,o||[],w(this).constructor):r.apply(this,o)),"name","point"),O(e,"order",1),O(e,"title",(0,t.MZ)("Point")),O(e,"description",(0,t.MZ)("Point")),O(e,"availableTypes",["point","json"]),O(e,"default",e.createDefault("point")),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&_(n,e),n}(u),g,b,function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=arguments,r=S(r),P(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,M()?Reflect.construct(r,o||[],S(this).constructor):r.apply(this,o)),"name","polygon"),P(e,"order",4),P(e,"title",(0,t.MZ)("Polygon")),P(e,"description",(0,t.MZ)("Polygon")),P(e,"availableTypes",["polygon","json"]),P(e,"default",e.createDefault("polygon")),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&x(n,e),n}(u)];function k(e,t,n,r,o,i,c){try{var u=e[i](c),a=u.value}catch(e){n(e);return}u.done?t(a):Promise.resolve(a).then(r,o)}var T=(0,s(694).defineAction)({name:"setDefaultZoomLevel",title:(0,t.MZ)("Set default zoom level"),uiSchema:function(e){return"text"===e.model.props.displayStyle?null:{zoom:{title:(0,t.MZ)("Zoom"),"x-component":"NumberPicker","x-decorator":"FormItem","x-component-props":{precision:0}}}},defaultParams:{zoom:13},handler:function(e,t){var n;return(n=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(n){return e.model.setProps("zoom",t.zoom),[2]})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function c(e){k(i,r,o,c,u,"next",e)}function u(e){k(i,r,o,c,u,"throw",e)}c(void 0)})})()}});function R(e,t,n,r,o,i,c){try{var u=e[i](c),a=u.value}catch(e){n(e);return}u.done?t(a):Promise.resolve(a).then(r,o)}function C(e,t,n){return(C=B()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&F(o,n.prototype),o}).apply(null,arguments)}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e,t){return(F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function q(e){var t="function"==typeof Map?new Map:void 0;return(q=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return C(e,arguments,Z(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),F(n,e)})(e)}function B(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(B=function(){return!!e})()}var D=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=Z(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,B()?Reflect.construct(e,t||[],Z(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&F(r,e),n=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.app.addFieldInterfaces(E),this.app.addFieldInterfaceGroups({map:{label:(0,t.MZ)("Map-based geometry"),order:300}}),this.pluginSettingsManager.addMenuItem({key:"map",title:this.t("Map manager"),icon:"EnvironmentOutlined",aclSnippet:"pm.map.configuration"}),this.pluginSettingsManager.addPageTabItem({menuKey:"map",key:"index",title:this.t("Map manager"),componentLoader:function(){return s.e("872").then(s.bind(s,75))}}),this.flowEngine.registerActions({setDefaultZoomLevel:T}),this.flowEngine.registerModelLoaders({CircleFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},DisplayCircleFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},DisplayLineStringFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},DisplayPointFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},DisplayPolygonFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},LineStringFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},MapActionGroupModel:{loader:function(){return s.e("694").then(s.bind(s,709))}},MapBlockModel:{loader:function(){return Promise.all([s.e("641"),s.e("720")]).then(s.bind(s,883))}},MapFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},PointFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},PolygonFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){R(i,r,o,c,u,"next",e)}function u(e){R(i,r,o,c,u,"throw",e)}c(void 0)})}).call(this)}}],function(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)}}(r.prototype,n),r}(q(e.Plugin))}(),m}()});
|
|
10
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("ahooks"),require("@emotion/css"),require("@nocobase/client-v2"),require("antd"),require("react"),require("@ant-design/icons"),require("@nocobase/flow-engine")):"function"==typeof define&&define.amd?define("@nocobase/plugin-map/client-v2",["ahooks","@emotion/css","@nocobase/client-v2","antd","react","@ant-design/icons","@nocobase/flow-engine"],t):"object"==typeof exports?exports["@nocobase/plugin-map/client-v2"]=t(require("ahooks"),require("@emotion/css"),require("@nocobase/client-v2"),require("antd"),require("react"),require("@ant-design/icons"),require("@nocobase/flow-engine")):e["@nocobase/plugin-map/client-v2"]=t(e.ahooks,e["@emotion/css"],e["@nocobase/client-v2"],e.antd,e.react,e["@ant-design/icons"],e["@nocobase/flow-engine"])}(self,function(e,t,n,r,o,i,c){return function(){"use strict";var u,a,l,f={488:function(e,t,n){n.d(t,{MZ:function(){return c},kj:function(){return u}});var r=n(694);function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}var i="@nocobase/plugin-map";function c(e,t){return(0,r.tExpr)(e,o({ns:[i,"client"]},t))}function u(){var e=(0,r.useFlowEngine)();return function(t,n){return e.context.t(t,o({ns:[i,"client"]},n))}}},375:function(e){e.exports=i},477:function(e){e.exports=t},485:function(e){e.exports=n},694:function(e){e.exports=c},625:function(t){t.exports=e},59:function(e){e.exports=r},155:function(e){e.exports=o}},p={};function s(e){var t=p[e];if(void 0!==t)return t.exports;var n=p[e]={exports:{}};return f[e].call(n.exports,n,n.exports,s),n.exports}s.m=f,s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,{a:t}),t},s.d=function(e,t){for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=function(e){return Promise.all(Object.keys(s.f).reduce(function(t,n){return s.f[n](e,t),t},[]))},s.u=function(e){return""+e+"."+({577:"e1fcc82fab0ef39b",641:"a12687e7a235574a",694:"5f486a695fdeb42a",720:"6ede563c5d95f038",872:"53cbb217b7708463"})[e]+".js"},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},b={},s.l=function(e,t,n,r){if(b[e])return void b[e].push(t);if(void 0!==n)for(var o,i,c=document.getElementsByTagName("script"),u=0;u<c.length;u++){var a=c[u];if(a.getAttribute("src")==e||a.getAttribute("data-rspack")=="@nocobase/plugin-map/client-v2:"+n){o=a;break}}o||(i=!0,(o=document.createElement("script")).timeout=120,s.nc&&o.setAttribute("nonce",s.nc),o.setAttribute("data-rspack","@nocobase/plugin-map/client-v2:"+n),o.src=e),b[e]=[t];var l=function(t,n){o.onerror=o.onload=null,clearTimeout(f);var r=b[e];if(delete b[e],o.parentNode&&o.parentNode.removeChild(o),r&&r.forEach(function(e){return e(n)}),t)return t(n)},f=setTimeout(l.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=l.bind(null,o.onerror),o.onload=l.bind(null,o.onload),i&&document.head.appendChild(o)},s.r=function(e){"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(y=s.g.location+"");var b,y,d=s.g.document;if(!y&&d&&(d.currentScript&&"SCRIPT"===d.currentScript.tagName.toUpperCase()&&(y=d.currentScript.src),!y)){var h=d.getElementsByTagName("script");if(h.length)for(var v=h.length-1;v>-1&&(!y||!/^http(s?):/.test(y));)y=h[v--].src}if(!y)throw Error("Automatic publicPath is not supported in this browser");s.p=y.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),u={889:0},s.f.j=function(e,t){var n=s.o(u,e)?u[e]:void 0;if(0!==n)if(n)t.push(n[2]);else{var r=new Promise(function(t,r){n=u[e]=[t,r]});t.push(n[2]=r);var o=s.p+s.u(e),i=Error();s.l(o,function(t){if(s.o(u,e)&&(0!==(n=u[e])&&(u[e]=void 0),n)){var r=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;i.message="Loading chunk "+e+" failed.\n("+r+": "+o+")",i.name="ChunkLoadError",i.type=r,i.request=o,n[1](i)}},"chunk-"+e,e)}},a=function(e,t){var n,r,o=t[0],i=t[1],c=t[2],a=0;if(o.some(function(e){return 0!==u[e]})){for(n in i)s.o(i,n)&&(s.m[n]=i[n]);c&&c(s)}for(e&&e(t);a<o.length;a++)r=o[a],s.o(u,r)&&u[r]&&u[r][0](),u[r]=0},(l=self.webpackChunk_nocobase_plugin_map_client_v2=self.webpackChunk_nocobase_plugin_map_client_v2||[]).forEach(a.bind(null,0)),l.push=a.bind(null,l.push.bind(l));var m={};return!function(){var e="",t="u">typeof document?document.currentScript:null;if(t&&t.src){var n=t.src.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"");n.indexOf("/static/plugins/@nocobase/plugin-map/dist/client-v2/")>=0&&(e=n.replace(/\/[^\/]+$/,"/"))}if(!e){var r=window.__webpack_public_path__||"";r&&("/"!==r.charAt(r.length-1)&&(r+="/"),e=r+"static/plugins/@nocobase/plugin-map/dist/client-v2/")}if(!e){var o=window.__nocobase_modern_client_prefix__||"v",i="/"+(o=String(o).replace(/^\/+|\/+$/g,"")||"v")+"/";if(!(e=window.__nocobase_public_path__||"")&&window.location&&window.location.pathname){var c=window.location.pathname||"/",u=c.indexOf(i);e=u>=0?c.slice(0,u+1):"/"}e&&(e=e.replace(RegExp("/"+o+"/?$"),"/")),e||(e="/"),"/"!==e.charAt(e.length-1)&&(e+="/"),e+="static/plugins/@nocobase/plugin-map/dist/client-v2/"}s.p=e}(),!function(){s.r(m),s.d(m,{default:function(){return D}});var e=s(485),t=s(488),n=[{label:(0,t.MZ)("AMap"),value:"amap"},{label:(0,t.MZ)("Google Maps"),value:"google"}];function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(c=function(){return!!e})()}var u=function(e){var u;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function a(){var e,i,u;if(!(this instanceof a))throw TypeError("Cannot call a class as a function");return i=a,u=arguments,i=o(i),r(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,c()?Reflect.construct(i,u||[],o(this).constructor):i.apply(this,u)),"type","object"),r(e,"group","map"),r(e,"sortable",!0),r(e,"titleUsable",!1),r(e,"availableTypes",["json"]),r(e,"configure",{items:[{name:"uiSchema.x-component-props.mapType",title:(0,t.MZ)("Map type"),component:"Select",required:!0,disabled:function(e){return!e.context.createOnly},defaultValue:"amap",componentProps:{showSearch:!1,allowClear:!1},options:n}]}),e}return a.prototype=Object.create(e&&e.prototype,{constructor:{value:a,writable:!0,configurable:!0}}),e&&i(a,e),u=[{key:"createDefault",value:function(e){return{interface:e,type:e,uiSchema:{type:"void","x-component":"Map","x-component-designer":"Map.Designer","x-component-props":{}}}}}],function(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)}}(a.prototype,u),a}(e.CollectionFieldInterface);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){return(f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(p=function(){return!!e})()}var b=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=arguments,r=l(r),a(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,p()?Reflect.construct(r,o||[],l(this).constructor):r.apply(this,o)),"name","circle"),a(e,"order",3),a(e,"title",(0,t.MZ)("Circle")),a(e,"description",(0,t.MZ)("Circle")),a(e,"availableTypes",["circle","json"]),a(e,"default",e.createDefault("circle")),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&f(n,e),n}(u);function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function v(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(v=function(){return!!e})()}var g=function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=arguments,r=d(r),y(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,v()?Reflect.construct(r,o||[],d(this).constructor):r.apply(this,o)),"name","lineString"),y(e,"order",2),y(e,"title",(0,t.MZ)("Line")),y(e,"description",(0,t.MZ)("Line")),y(e,"availableTypes",["lineString","json"]),y(e,"default",e.createDefault("lineString")),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&h(n,e),n}(u);function O(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function w(e){return(w=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function _(e,t){return(_=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function j(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(j=function(){return!!e})()}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e){return(S=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function x(e,t){return(x=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function M(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(M=function(){return!!e})()}var E=[function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=arguments,r=w(r),O(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,j()?Reflect.construct(r,o||[],w(this).constructor):r.apply(this,o)),"name","point"),O(e,"order",1),O(e,"title",(0,t.MZ)("Point")),O(e,"description",(0,t.MZ)("Point")),O(e,"availableTypes",["point","json"]),O(e,"default",e.createDefault("point")),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&_(n,e),n}(u),g,b,function(e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function n(){var e,r,o;if(!(this instanceof n))throw TypeError("Cannot call a class as a function");return r=n,o=arguments,r=S(r),P(e=function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,M()?Reflect.construct(r,o||[],S(this).constructor):r.apply(this,o)),"name","polygon"),P(e,"order",4),P(e,"title",(0,t.MZ)("Polygon")),P(e,"description",(0,t.MZ)("Polygon")),P(e,"availableTypes",["polygon","json"]),P(e,"default",e.createDefault("polygon")),e}return n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&x(n,e),n}(u)];function k(e,t,n,r,o,i,c){try{var u=e[i](c),a=u.value}catch(e){n(e);return}u.done?t(a):Promise.resolve(a).then(r,o)}var T=(0,s(694).defineAction)({name:"setDefaultZoomLevel",title:(0,t.MZ)("Set default zoom level"),uiSchema:function(e){return"text"===e.model.props.displayStyle?null:{zoom:{title:(0,t.MZ)("Zoom"),"x-component":"NumberPicker","x-decorator":"FormItem","x-component-props":{precision:0}}}},defaultParams:{zoom:13},handler:function(e,t){var n;return(n=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(n){return e.model.setProps("zoom",t.zoom),[2]})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function c(e){k(i,r,o,c,u,"next",e)}function u(e){k(i,r,o,c,u,"throw",e)}c(void 0)})})()}});function R(e,t,n,r,o,i,c){try{var u=e[i](c),a=u.value}catch(e){n(e);return}u.done?t(a):Promise.resolve(a).then(r,o)}function C(e,t,n){return(C=B()?Reflect.construct:function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&F(o,n.prototype),o}).apply(null,arguments)}function Z(e){return(Z=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function F(e,t){return(F=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function q(e){var t="function"==typeof Map?new Map:void 0;return(q=function(e){if(null===e||-1===Function.toString.call(e).indexOf("[native code]"))return e;if("function"!=typeof e)throw TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return C(e,arguments,Z(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),F(n,e)})(e)}function B(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(e){}return(B=function(){return!!e})()}var D=function(e){var n;if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");function r(){var e,t;if(!(this instanceof r))throw TypeError("Cannot call a class as a function");return e=r,t=arguments,e=Z(e),function(e,t){var n;if(t&&("object"==((n=t)&&"u">typeof Symbol&&n.constructor===Symbol?"symbol":typeof n)||"function"==typeof t))return t;if(void 0===e)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(this,B()?Reflect.construct(e,t||[],Z(this).constructor):e.apply(this,t))}return r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&F(r,e),n=[{key:"load",value:function(){var e;return(e=function(){return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},c=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),u=Object.defineProperty;return u(c,"next",{value:a(0)}),u(c,"throw",{value:a(1)}),u(c,"return",{value:a(2)}),"function"==typeof Symbol&&u(c,Symbol.iterator,{value:function(){return this}}),c;function a(u){return function(a){var l=[u,a];if(n)throw TypeError("Generator is already executing.");for(;c&&(c=0,l[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&l[0]?r.return:l[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,l[1])).done)return o;switch(r=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return i.label++,{value:l[1],done:!1};case 5:i.label++,r=l[1],l=[0];continue;case 7:l=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){i=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){i.label=l[1];break}if(6===l[0]&&i.label<o[1]){i.label=o[1],o=l;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(l);break}o[2]&&i.ops.pop(),i.trys.pop();continue}l=t.call(e,i)}catch(e){l=[6,e],r=0}finally{n=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}}(this,function(e){return this.app.addFieldInterfaces(E),this.app.addFieldInterfaceGroups({map:{label:(0,t.MZ)("Map-based geometry"),order:300}}),this.pluginSettingsManager.addMenuItem({key:"map",title:this.t("Map manager"),icon:"EnvironmentOutlined",aclSnippet:"pm.map.configuration"}),this.pluginSettingsManager.addPageTabItem({menuKey:"map",key:"index",title:this.t("Map manager"),componentLoader:function(){return s.e("872").then(s.bind(s,75))}}),this.flowEngine.registerActions({setDefaultZoomLevel:T}),this.flowEngine.registerModelLoaders({CircleFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},DisplayCircleFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},DisplayLineStringFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},DisplayPointFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},DisplayPolygonFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},LineStringFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},MapActionGroupModel:{loader:function(){return s.e("694").then(s.bind(s,709))}},MapBlockModel:{loader:function(){return Promise.all([s.e("641"),s.e("720")]).then(s.bind(s,883))}},MapFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},PointFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}},PolygonFieldModel:{loader:function(){return Promise.all([s.e("641"),s.e("577")]).then(s.bind(s,128))}}}),[2]})},function(){var t=this,n=arguments;return new Promise(function(r,o){var i=e.apply(t,n);function c(e){R(i,r,o,c,u,"next",e)}function u(e){R(i,r,o,c,u,"throw",e)}c(void 0)})}).call(this)}}],function(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)}}(r.prototype,n),r}(q(e.Plugin))}(),m}()});
|
|
@@ -25,6 +25,7 @@ export interface AMapComponentProps {
|
|
|
25
25
|
block?: boolean;
|
|
26
26
|
height?: number;
|
|
27
27
|
}
|
|
28
|
+
type AMapEditableOverlay = AMap.Marker | AMap.Polygon | AMap.Polyline | AMap.Circle;
|
|
28
29
|
export interface AMapForwardedRefProps {
|
|
29
30
|
setOverlay: (t: MapEditorType, v: any, o?: AMap.PolylineOptions & AMap.PolygonOptions & AMap.MarkerOptions) => any;
|
|
30
31
|
getOverlay: (t: MapEditorType, v: any, o?: AMap.PolylineOptions & AMap.PolygonOptions & AMap.MarkerOptions) => any;
|
|
@@ -42,7 +43,8 @@ export interface AMapForwardedRefProps {
|
|
|
42
43
|
mouseTool: () => {
|
|
43
44
|
close: (clear?: boolean) => void;
|
|
44
45
|
};
|
|
45
|
-
overlay:
|
|
46
|
+
overlay: AMapEditableOverlay;
|
|
46
47
|
errMessage?: string;
|
|
47
48
|
}
|
|
48
49
|
export declare const AMapCom: React.ForwardRefExoticComponent<AMapComponentProps & React.RefAttributes<AMapForwardedRefProps>>;
|
|
50
|
+
export {};
|
|
@@ -26,6 +26,7 @@ export declare class GoogleMapsDrawingManager {
|
|
|
26
26
|
private draftOverlay;
|
|
27
27
|
private draftPath;
|
|
28
28
|
private circleCenter;
|
|
29
|
+
private lastClickPosition;
|
|
29
30
|
constructor(options: OverlayOptions & {
|
|
30
31
|
drawingMode?: GoogleMapsDrawingMode;
|
|
31
32
|
map?: google.maps.Map;
|
|
@@ -34,11 +35,16 @@ export declare class GoogleMapsDrawingManager {
|
|
|
34
35
|
remove: () => void;
|
|
35
36
|
};
|
|
36
37
|
setDrawingMode(mode: GoogleMapsDrawingMode): void;
|
|
38
|
+
handleClick(event: google.maps.MapMouseEvent): void;
|
|
39
|
+
handleOverlayClick(event: google.maps.MapMouseEvent, fallbackPosition?: google.maps.LatLng | null): void;
|
|
40
|
+
handleDoubleClick(): void;
|
|
37
41
|
unbindAll(): void;
|
|
42
|
+
completeDrawing(): void;
|
|
38
43
|
private bindMapEvents;
|
|
39
44
|
private clearMapEvents;
|
|
40
45
|
private resetDraft;
|
|
41
|
-
private
|
|
46
|
+
private handlePositionClick;
|
|
47
|
+
private shouldSkipDuplicateClick;
|
|
42
48
|
private handlePathClick;
|
|
43
49
|
private handleCircleClick;
|
|
44
50
|
private updatePreview;
|
package/dist/externalVersion.js
CHANGED
|
@@ -8,12 +8,12 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
module.exports = {
|
|
11
|
-
"@nocobase/client": "3.0.0-alpha.
|
|
11
|
+
"@nocobase/client": "3.0.0-alpha.12",
|
|
12
12
|
"react": "18.2.0",
|
|
13
|
-
"@nocobase/flow-engine": "3.0.0-alpha.
|
|
14
|
-
"@nocobase/client-v2": "3.0.0-alpha.
|
|
15
|
-
"@nocobase/server": "3.0.0-alpha.
|
|
16
|
-
"@nocobase/test": "3.0.0-alpha.
|
|
13
|
+
"@nocobase/flow-engine": "3.0.0-alpha.12",
|
|
14
|
+
"@nocobase/client-v2": "3.0.0-alpha.12",
|
|
15
|
+
"@nocobase/server": "3.0.0-alpha.12",
|
|
16
|
+
"@nocobase/test": "3.0.0-alpha.12",
|
|
17
17
|
"@formily/react": "2.3.7",
|
|
18
18
|
"lodash": "4.18.1",
|
|
19
19
|
"react-i18next": "11.18.6",
|
|
@@ -23,7 +23,7 @@ module.exports = {
|
|
|
23
23
|
"antd": "5.24.2",
|
|
24
24
|
"@formily/shared": "2.3.7",
|
|
25
25
|
"@formily/core": "2.3.7",
|
|
26
|
-
"@nocobase/actions": "3.0.0-alpha.
|
|
27
|
-
"@nocobase/database": "3.0.0-alpha.
|
|
26
|
+
"@nocobase/actions": "3.0.0-alpha.12",
|
|
27
|
+
"@nocobase/database": "3.0.0-alpha.12",
|
|
28
28
|
"ahooks": "3.7.8"
|
|
29
29
|
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"displayName": "Block: Map",
|
|
4
4
|
"displayName.ru-RU": "Блок: Карта",
|
|
5
5
|
"displayName.zh-CN": "区块:地图",
|
|
6
|
-
"version": "3.0.0-alpha.
|
|
6
|
+
"version": "3.0.0-alpha.12",
|
|
7
7
|
"description": "Map block, support Gaode map and Google map, you can also extend more map types.",
|
|
8
8
|
"description.ru-RU": "Блок карты, поддерживает карты Gaode и Google, можно расширить поддержку других типов карт.",
|
|
9
9
|
"description.zh-CN": "地图区块,支持高德地图和 Google 地图,你也可以扩展更多地图类型。",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@nocobase/test": "2.x",
|
|
42
42
|
"@nocobase/utils": "2.x"
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "2ba035885741a9977d76bbabf8f2caf44b199139",
|
|
45
45
|
"keywords": [
|
|
46
46
|
"Blocks"
|
|
47
47
|
]
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file is part of the NocoBase (R) project.
|
|
3
|
-
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
-
* Authors: NocoBase Team.
|
|
5
|
-
*
|
|
6
|
-
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
-
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
(self.webpackChunk_nocobase_plugin_map_client_v2=self.webpackChunk_nocobase_plugin_map_client_v2||[]).push([["641"],{302:function(e){"use strict";e.exports=function(){function e(e){var t,l,a=[];return e.AMapUI&&a.push((t=e.AMapUI,new Promise(function(e,l){var a=[];if(t.plugins)for(var c=0;c<t.plugins.length;c+=1)-1==r.AMapUI.plugins.indexOf(t.plugins[c])&&a.push(t.plugins[c]);if(o.AMapUI===n.failed)l("前次请求 AMapUI 失败");else if(o.AMapUI===n.notload){o.AMapUI=n.loading,r.AMapUI.version=t.version||r.AMapUI.version,c=r.AMapUI.version;var u=document.body||document.head,s=document.createElement("script");s.type="text/javascript",s.src="https://webapi.amap.com/ui/"+c+"/main.js",s.onerror=function(e){o.AMapUI=n.failed,l("请求 AMapUI 失败")},s.onload=function(){if(o.AMapUI=n.loaded,a.length)window.AMapUI.loadUI(a,function(){for(var t=0,n=a.length;t<n;t++){var r=a[t].split("/").slice(-1)[0];window.AMapUI[r]=arguments[t]}for(e();i.AMapUI.length;)i.AMapUI.splice(0,1)[0]()});else for(e();i.AMapUI.length;)i.AMapUI.splice(0,1)[0]()},u.appendChild(s)}else o.AMapUI===n.loaded?t.version&&t.version!==r.AMapUI.version?l("不允许多个版本 AMapUI 混用"):a.length?window.AMapUI.loadUI(a,function(){for(var t=0,n=a.length;t<n;t++){var r=a[t].split("/").slice(-1)[0];window.AMapUI[r]=arguments[t]}e()}):e():t.version&&t.version!==r.AMapUI.version?l("不允许多个版本 AMapUI 混用"):i.AMapUI.push(function(t){t?l(t):a.length?window.AMapUI.loadUI(a,function(){for(var t=0,n=a.length;t<n;t++){var r=a[t].split("/").slice(-1)[0];window.AMapUI[r]=arguments[t]}e()}):e()})}))),e.Loca&&a.push((l=e.Loca,new Promise(function(e,t){if(o.Loca===n.failed)t("前次请求 Loca 失败");else if(o.Loca===n.notload){o.Loca=n.loading,r.Loca.version=l.version||r.Loca.version;var a=r.Loca.version,c=r.AMap.version.startsWith("2"),u=a.startsWith("2");if(c&&!u||!c&&u)t("JSAPI 与 Loca 版本不对应!!");else{c=r.key,u=document.body||document.head;var s=document.createElement("script");s.type="text/javascript",s.src="https://webapi.amap.com/loca?v="+a+"&key="+c,s.onerror=function(e){o.Loca=n.failed,t("请求 AMapUI 失败")},s.onload=function(){for(o.Loca=n.loaded,e();i.Loca.length;)i.Loca.splice(0,1)[0]()},u.appendChild(s)}}else o.Loca===n.loaded?l.version&&l.version!==r.Loca.version?t("不允许多个版本 Loca 混用"):e():l.version&&l.version!==r.Loca.version?t("不允许多个版本 Loca 混用"):i.Loca.push(function(e){e?t(e):t()})}))),Promise.all(a)}if(!window)throw Error("AMap JSAPI can only be used in Browser.");(t=n||(n={})).notload="notload",t.loading="loading",t.loaded="loaded",t.failed="failed";var t,n,r={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},o={AMap:n.notload,AMapUI:n.notload,Loca:n.notload},i={AMap:[],AMapUI:[],Loca:[]},l=[],a=function(e){"function"==typeof e&&(o.AMap===n.loaded?e(window.AMap):l.push(e))};return{load:function(t){return new Promise(function(i,c){if(o.AMap==n.failed)c("");else if(o.AMap==n.notload){var u=t.key,s=t.version,f=t.plugins;u?(window.AMap&&"lbs.amap.com"!==location.host&&c("禁止多种API加载方式混用"),r.key=u,r.AMap.version=s||r.AMap.version,r.AMap.plugins=f||r.AMap.plugins,o.AMap=n.loading,s=document.body||document.head,window.___onAPILoaded=function(r){if(delete window.___onAPILoaded,r)o.AMap=n.failed,c(r);else for(o.AMap=n.loaded,e(t).then(function(){i(window.AMap)}).catch(c);l.length;)l.splice(0,1)[0]()},(f=document.createElement("script")).type="text/javascript",f.src="https://webapi.amap.com/maps?callback=___onAPILoaded&v="+r.AMap.version+"&key="+u+"&plugin="+r.AMap.plugins.join(","),f.onerror=function(e){o.AMap=n.failed,c(e)},s.appendChild(f)):c("请填写key")}else if(o.AMap==n.loaded)if(t.key&&t.key!==r.key)c("多个不一致的 key");else if(t.version&&t.version!==r.AMap.version)c("不允许多个版本 JSAPI 混用");else{if(u=[],t.plugins)for(s=0;s<t.plugins.length;s+=1)-1==r.AMap.plugins.indexOf(t.plugins[s])&&u.push(t.plugins[s]);u.length?window.AMap.plugin(u,function(){e(t).then(function(){i(window.AMap)}).catch(c)}):e(t).then(function(){i(window.AMap)}).catch(c)}else if(t.key&&t.key!==r.key)c("多个不一致的 key");else if(t.version&&t.version!==r.AMap.version)c("不允许多个版本 JSAPI 混用");else{var p=[];if(t.plugins)for(s=0;s<t.plugins.length;s+=1)-1==r.AMap.plugins.indexOf(t.plugins[s])&&p.push(t.plugins[s]);a(function(){p.length?window.AMap.plugin(p,function(){e(t).then(function(){i(window.AMap)}).catch(c)}):e(t).then(function(){i(window.AMap)}).catch(c)})}})},reset:function(){delete window.AMap,delete window.AMapUI,delete window.Loca,r={key:"",AMap:{version:"1.4.15",plugins:[]},AMapUI:{version:"1.1",plugins:[]},Loca:{version:"1.3.2"}},o={AMap:n.notload,AMapUI:n.notload,Loca:n.notload},i={AMap:[],AMapUI:[],Loca:[]}}}}()},119:function(e){e.exports={}},899:function(e,t,n){"use strict";n.d(t,{K0:function(){return i},S4:function(){return l},cV:function(){return u}});var r=n(694),o=n(155),i="map-configuration",l=function(e){return"NOCOBASE_PLUGIN_MAP_CONFIGURATION_".concat(e)};function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var c=function(e){var t=sessionStorage.getItem(l(e));try{return t?JSON.parse(t):null}catch(e){return null}},u=function(e){var t,n=!(arguments.length>1)||void 0===arguments[1]||arguments[1],u=(0,r.useFlowContext)().api,s=(0,o.useMemo)(function(){return l(e)},[e]),f=function(e){if(Array.isArray(e))return e}(t=(0,o.useState)(function(){return n?c(e):null}))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return a(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return a(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=f[0],d=f[1];return(0,o.useEffect)(function(){n?d(c(e)):d(null)},[e,n]),(0,o.useEffect)(function(){if(!(n&&c(e))){var t=!1;return u.resource(i).get({isRaw:!n,type:e}).then(function(e){if(!t){var r,o=null==(r=e.data)?void 0:r.data;if(n){var i=sessionStorage.getItem(s);i&&i===JSON.stringify(o)||sessionStorage.setItem(s,JSON.stringify(o))}d(o)}}).catch(function(){}),function(){t=!0}}},[u,e,n,s]),p}},285:function(e,t,n){"use strict";n.d(t,{r:function(){return S},h:function(){return L}});var r=n(375),o=n(625),i=n(59),l=n(155),a=n.n(l),c=n(970),u=n(802),s=n(294),f=n(488),p=n(302),d=n.n(p);n(119);var g=n(694),h=n(899),y=n(211);function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var m=function(e){var t,n=e.aMap,r=e.toCenter,c=(0,f.kj)(),u=(0,l.useRef)(),s=function(e){if(Array.isArray(e))return e}(t=(0,l.useState)([]))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return v(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return v(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),p=s[0],d=s[1];(0,l.useEffect)(function(){null==n||n.plugin("AMap.PlaceSearch",function(){n&&(u.current=new n.PlaceSearch({city:"全国",pageSize:30}))})},[n]);var g=(0,o.useDebounceFn)(function(e){u.current&&u.current.search(e||" ",function(e,t){if("complete"===e)d(t.poiList.pois.map(function(e){var t,n;return t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),n=n={label:"".concat(e.name,"-").concat(e.address),value:e.id},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t}));else{if("no_data"===e)return void d([]);i.message.error(c("Please configure the AMap securityCode or securityHost correctly"))}})},{wait:300}).run;return a().createElement("div",{style:{position:"absolute",top:10,left:10,zIndex:10,width:"calc(100% - 20px)"}},a().createElement(i.Select,{showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:c("Enter keywords to search"),filterOption:!1,onSearch:g,onSelect:function(e){var t=p.find(function(t){return t.value===e});(null==t?void 0:t.location)&&r(t.location)},options:p,popupMatchSelectWidth:!1}))};function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function O(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){w(e,t,n[t])})}return e}function A(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function M(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var P={point:{mouseTool:"marker",propertyKey:"position",overlay:"Marker"},polygon:{mouseTool:"polygon",editor:"PolygonEditor",propertyKey:"path",overlay:"Polygon"},lineString:{mouseTool:"polyline",editor:"PolylineEditor",propertyKey:"path",overlay:"Polyline"},circle:{mouseTool:"circle",editor:"CircleEditor",transformOptions:function(e){return{center:e.slice(0,2),radius:e[2]}},overlay:"Circle"}},S=a().forwardRef(function(e,t){var n=(0,h.cV)(e.mapType)||{},c=n.accessKey,p=n.securityJsCode,v=e.value,b=e.onChange,S=e.block,E=void 0!==S&&S,k=e.readonly,C=e.disabled,I=void 0===C?E:C,j=e.zoom,L=e.overlayCommonOptions,x=e.height,D=e.type,U=(0,f.kj)(),_=(0,l.useRef)(),T=(0,l.useRef)(),z=(0,l.useRef)(),F=M((0,l.useState)([]),2),R=F[0],B=F[1],K=M((0,l.useState)(""),2),$=K[0],G=K[1],N="Something went wrong, please refresh the page and try again",J=(0,g.useFlowContext)(),Z=(0,l.useRef)(),V=(0,l.useRef)(null),W=(0,l.useRef)("nocobase-map-".concat(D||"","-").concat(Date.now().toString(32))),q=i.App.useApp().modal,X=M((0,l.useState)(O({strokeWeight:5,strokeColor:u.A,fillColor:u.A,strokeOpacity:1},L)),1)[0];(0,l.useEffect)(function(){T.current&&!E&&setTimeout(function(){var e;null==(e=T.current)||e.setZoom(j)},500)},[j,T.current,E]);var H=(0,o.useMemoizedFn)(function(){Z.current&&Z.current.remove()}),Y=(0,o.useMemoizedFn)(function(){(!I||E)&&"point"!==D&&V.current&&(V.current.setTarget(Z.current),V.current.open())}),Q=(0,o.useMemoizedFn)(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=null;if("point"===D){var r=e.getPosition(),o=r.lat;n=[r.lng,o]}else if("polygon"===D||"lineString"===D){if((n=e.getPath().map(function(e){return[e.lng,e.lat]})).length<2)return}else if("circle"===D){var i=e.getCenter(),l=e.getRadius();n=[i.lng,i.lat,l]}t||(H(),Z.current=e,Y()),null==b||b(n)}),ee=(0,o.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D,t=P[e];if(t&&"editor"in t&&!V.current)return V.current=new _.current[t.editor](T.current,null,{createOptions:X,editOptions:X,controlPoint:A(O({},X),{strokeWeight:3}),midControlPoint:A(O({},X),{strokeWeight:2,fillColor:"#fff"})}),V.current.on("adjust",function(e){Q(e.target,!0)}),V.current.on("move",function(e){Q(e.target,!0)}),V.current}),et=(0,o.useMemoizedFn)(function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D;if(!(!z.current||(null==(e=V.current)?void 0:e.getTarget()))){var n=P[t];n&&z.current[n.mouseTool](O({},X))}}),en=(0,o.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D;z.current||(z.current=new _.current.MouseTool(T.current),z.current.on("draw",function(e){Q(e.obj)}),et(e))}),er=(0,l.useCallback)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v,n=arguments.length>2?arguments[2]:void 0,r=P[e];if(r){var o=O({},X,n);return"transformOptions"in r?Object.assign(o,r.transformOptions(t)):"propertyKey"in r&&(o[r.propertyKey]=t),new _.current[r.overlay](o)}},[X]),eo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:D,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v,n=arguments.length>2?arguments[2]:void 0;if(_.current){var r=er(e,t,n);if(r)return r.setMap(T.current),r}};return((0,l.useEffect)(function(){if(_.current&&v&&(k||!Z.current)){var e=eo();T.current.setFitView([e]),Z.current=e,I||(ee(),Y())}},[v,R,D,X,I,k]),(0,l.useEffect)(function(){var e,t,n;z.current&&(I?(null==(e=z.current)||e.close(),null==(t=V.current)||t.close()):(et(),null==(n=V.current)||n.open()))},[I]),(0,l.useEffect)(function(){_.current&&D&&!I&&(en(),ee())},[I,R,D]),(0,l.useEffect)(function(){if(!v&&(z.current||V.current)&&(H(),V.current&&(V.current.setTarget(),V.current.close()),null==b||b(null)),z.current&&V.current){var e,t;V.current.getTarget()?null==(e=(t=z.current).close)||e.call(t):et()}},[D,v]),(0,l.useEffect)(function(){if(c&&!T.current){p&&(window._AMapSecurityConfig=w({},p.endsWith("_AMapService")?"serviceHOST":"securityJsCode",p));var e=window.define;return(window.define=void 0,window.AMap)?void(0,s.zd)(function(){try{T.current=new window.AMap.Map(W.current,{resizeEnable:!0,zoom:j}),_.current=AMap,G(""),B([])}catch(e){G((0,s.DP)(e,N))}finally{window.define=e}}):(d().load({key:c,version:"2.0",plugins:["AMap.MouseTool","AMap.PolygonEditor","AMap.PolylineEditor","AMap.CircleEditor"]}).then(function(t){if(t)return window.define=e,(0,s.zd)(function(){try{T.current=new t.Map(W.current,{resizeEnable:!0,zoom:j}),_.current=t,G(""),B([])}catch(e){G((0,s.DP)(e,N))}})}).catch(function(t){window.define=e;var n=(0,s.DP)(t,N);n.includes("多个不一致的 key")?G(U("The AccessKey is incorrect, please check it")):t&&(void 0===t?"undefined":t&&"u">typeof Symbol&&t.constructor===Symbol?"symbol":typeof t)=="object"&&"type"in t&&"error"===t.type?G(N):G(n)}),function(){var e;null==(e=T.current)||e.destroy(),_.current=null,T.current=null,z.current=null,V.current=null,d().reset()})}},[c,D,p]),(0,l.useImperativeHandle)(t,function(){return{setOverlay:eo,getOverlay:er,createMouseTool:en,createEditor:ee,executeMouseTool:et,aMap:_.current,map:T.current,overlay:Z.current,mouseTool:function(){return z.current},editor:function(){return V.current},errMessage:$}}),!c||$)?a().createElement(i.Alert,{action:a().createElement(i.Button,{type:"primary",href:(0,y.J)(J.app,window.location.pathname),target:"_blank",rel:"noopener noreferrer",onClick:function(){var e,t;null==(t=J.view)||null==(e=t.close)||e.call(t)}},U("Go to the configuration page")),message:$||U("Please configure the AccessKey and SecurityJsCode first"),type:"error"}):a().createElement("div",{style:O({position:"relative",height:x||500},null==e?void 0:e.style),id:W.current},!_.current&&a().createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"}},a().createElement(i.Spin,null)),I?null:a().createElement(a().Fragment,null,a().createElement(m,{toCenter:function(e,t){T.current&&T.current.setZoomAndCenter(18,e,t)},aMap:_.current}),a().createElement("div",{style:{position:"absolute",bottom:80,right:20,zIndex:10}},a().createElement(i.Button,{onClick:function(){Z.current&&T.current.setFitView([Z.current])},disabled:!Z.current,type:"primary",shape:"round",size:"large",icon:a().createElement(r.SyncOutlined,null)})),"point"!==D?a().createElement("div",{style:{position:"absolute",bottom:20,left:10,zIndex:2,pointerEvents:"none"}},a().createElement(i.Alert,{message:U("Click to select the starting point and double-click to end the drawing"),type:"info"})):null,a().createElement("div",{style:{position:"absolute",bottom:20,right:20,zIndex:2}},a().createElement(i.Button,{disabled:!v,style:{height:"40px"},onClick:function(){var e=function(){H(),V.current&&(V.current.setTarget(),V.current.close()),null==b||b(null)};q.confirm({title:U("Clear the canvas"),content:U("Are you sure to clear the canvas?"),okText:U("Confirm"),cancelText:U("Cancel"),getContainer:function(){return document.getElementById(W.current)},onOk:function(){e()}})},type:"primary",danger:!0},U("Clear")))))});function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function C(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||j(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function I(e){return function(e){if(Array.isArray(e))return E(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||j(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e,t){if(e){if("string"==typeof e)return E(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return E(e,t)}}S.displayName="AMapCom";var L=function(e){var t,n,p,d,g,h,y=e.collectionField,v=e.marker,m=e.dataSource,b=e.fixedBlock,w=e.zoom,O=e.setSelectedRecordKeys,A=e.lineSort,M=e.fields,P=e.name,E=e.primaryKey,j=e.mapField,L=e.associationCollectionField,x=e.onOpenView,D=C((0,l.useState)(!1),2),U=D[0],_=D[1],T=(0,l.useRef)(),z=null==(d=T.current)||null==(p=d.aMap)?void 0:p.GeometryUtil,F=C((0,l.useState)(""),2),R=F[0],B=F[1],K=(0,f.kj)(),$=(0,l.useRef)(R);$.current=R;var G=null==(g=M.find(function(e){return e.name===v}))?void 0:g.uiSchema,N=y.interface||y.type,J=function(e,t){var n=e.getExtData(),r=void 0===t?n.selected:!t;n.selected=!r,"setIcon"in e&&e.setIcon(new T.current.aMap.Icon({imageSize:[19,32],image:r?c.X:c.F})),e.setOptions(k({extData:n},r?{strokeColor:u.A,fillColor:u.A}:{strokeColor:u.v,fillColor:u.v}))},Z=function(){var e,t,n;T.current&&(null==(e=T.current)||e.mouseTool().close(!0),null==(t=T.current)||t.editor().setTarget(null),null==(n=T.current)||n.editor().close())};(0,l.useEffect)(function(){var e,t,n,r;if("selection"===R)return(null==(e=T.current)?void 0:e.editor())?null==(r=T.current)||r.executeMouseTool("polygon"):(null==(t=T.current)||t.createEditor("polygon"),null==(n=T.current)||n.createMouseTool("polygon")),function(){Z()}},[R]),(0,l.useEffect)(function(){if(R)return function(){if(!$.current){var e;null==(e=T.current)||e.map.getAllOverlays().forEach(function(e){J(e,!1)})}}},[R]);var V=(0,o.useMemoizedFn)(function(){var e,t,n,r=null==(e=T.current)?void 0:e.editor().getTarget(),o=null==(t=T.current)?void 0:t.map.getAllOverlays(),i=null==o?void 0:o.filter(function(e){if(e!==r&&void 0!==e.getExtData().id)return"getPosition"in e?z.isPointInRing(e.getPosition(),null==r?void 0:r.getPath()):z.doesRingRingIntersect(e.getPath(),null==r?void 0:r.getPath())});O(null==i?void 0:i.map(function(e){return J(e,!0),e.getExtData().id})),null==r||r.remove(),null==(n=T.current)||n.editor().close()});return(0,l.useEffect)(function(){if(y&&T.current&&m){var e=m.map(function(e){var t,n=null==(t=(0,s.el)(e,j,null==L?void 0:L.interface))?void 0:t.filter(Boolean),r=(0,s.PB)(G,e[v]);return(null==n?void 0:n.length)?n.map(function(t){var n;return null==(n=T.current)?void 0:n.setOverlay(N,t,{strokeColor:u.A,fillColor:u.A,cursor:"pointer",label:{direction:"bottom",offset:[0,5],content:v?(0,s.Gq)(r,K):void 0},extData:{id:e[E]}})}):[]}).flat().filter(Boolean);1===e.length&&"point"===N?(null==(r=T.current)||null==(n=r.map)||n.setFitView(e),null==(i=T.current)||null==(o=i.map)||o.setZoom(w||13)):null==(a=T.current)||null==(l=a.map)||l.setFitView(e);var t=e.map(function(e){var t=function(e){var t=e.target,n=t.getExtData();if(n){if($.current){"click"===$.current&&(O(function(e){return n.selected?e.filter(function(e){return e!==n.id}):I(e).concat([n.id])}),J(t));return}var r=m.find(function(e){return n.id===e[E]});r&&x(r)}};return e.on("click",t),function(){return e.off("click",t)}});if("point"===N&&(null==A?void 0:A.length)&&(null==e?void 0:e.length)>1){var n,r,o,i,l,a,c,f=e.map(function(e){return e.getPosition()});e[0].setzIndex(13),e[e.length-1].setzIndex(13);var p=function(){var e,t,n=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(null==(e=T.current)?void 0:e.map)return new AMap.Text({label:{direction:"top",offset:[0,0],content:n?K("Start point"):K("End point")},position:f[n?0:f.length-1],map:null==(t=T.current)?void 0:t.map})};e.push.apply(e,I([null==(c=T.current)?void 0:c.setOverlay("lineString",f,{strokeColor:u.A,fillColor:u.A,strokeWeight:2,cursor:"pointer"}),p(),p(!1)].filter(Boolean)))}return function(){e.forEach(function(e){e.remove()}),t.forEach(function(e){return e()})}}},[m,U,j,v,P,E,N,!1,A]),(0,l.useEffect)(function(){setTimeout(function(){O([])})},[m]),a().createElement("div",{style:{position:"relative",height:"100%"}},a().createElement("div",{style:{position:"absolute",left:10,top:10,zIndex:999}},!U||(null==(h=T.current)?void 0:h.errMessage)?null:a().createElement(i.Space,{direction:"vertical"},a().createElement(i.Button,{style:{color:R?void 0:u.v,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),B("")},icon:a().createElement(r.EnvironmentOutlined,null)}),a().createElement(i.Button,{style:{color:"selection"===R?u.v:void 0,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),B("selection")},icon:a().createElement(r.ExpandOutlined,null)}),"selection"===R?a().createElement(i.Button,{type:"primary",icon:a().createElement(r.CheckOutlined,null),title:K("Confirm selection"),onClick:V}):null)),a().createElement(S,(t=k({},e),n=n={ref:function(e){T.current=e,_(!!(null==e?void 0:e.map)&&!e.errMessage)},style:b?{height:"100%"}:void 0,zoom:w,type:N,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:u.v,fillColor:u.v}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)))}},348:function(e,t,n){"use strict";n.d(t,{Y6:function(){return U},G$:function(){return $}});var r,o,i=n(375),l=n(625),a=n(59),c=n(155),u=n.n(c),s=n(970),f=n(802),p=n(294),d=n(488),g=function e(t,n){if(t===n)return!0;if(t&&n&&"object"==typeof t&&"object"==typeof n){if(t.constructor!==n.constructor)return!1;if(Array.isArray(t)){if((r=t.length)!=n.length)return!1;for(o=r;0!=o--;)if(!e(t[o],n[o]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if((r=(i=Object.keys(t)).length)!==Object.keys(n).length)return!1;for(o=r;0!=o--;)if(!Object.prototype.hasOwnProperty.call(n,i[o]))return!1;for(o=r;0!=o--;){var r,o,i,l=i[o];if(!e(t[l],n[l]))return!1}return!0}return t!=t&&n!=n};let h="__googleMapsScriptId";(r=o||(o={}))[r.INITIALIZED=0]="INITIALIZED",r[r.LOADING=1]="LOADING",r[r.SUCCESS=2]="SUCCESS",r[r.FAILURE=3]="FAILURE";class y{constructor({apiKey:e,authReferrerPolicy:t,channel:n,client:r,id:o=h,language:i,libraries:l=[],mapIds:a,nonce:c,region:u,retries:s=3,url:f="https://maps.googleapis.com/maps/api/js",version:p}){if(this.callbacks=[],this.done=!1,this.loading=!1,this.errors=[],this.apiKey=e,this.authReferrerPolicy=t,this.channel=n,this.client=r,this.id=o||h,this.language=i,this.libraries=l,this.mapIds=a,this.nonce=c,this.region=u,this.retries=s,this.url=f,this.version=p,y.instance){if(!g(this.options,y.instance.options))throw Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(y.instance.options)}`);return y.instance}y.instance=this}get options(){return{version:this.version,apiKey:this.apiKey,channel:this.channel,client:this.client,id:this.id,libraries:this.libraries,language:this.language,region:this.region,mapIds:this.mapIds,nonce:this.nonce,url:this.url,authReferrerPolicy:this.authReferrerPolicy}}get status(){return this.errors.length?o.FAILURE:this.done?o.SUCCESS:this.loading?o.LOADING:o.INITIALIZED}get failed(){return this.done&&!this.loading&&this.errors.length>=this.retries+1}createUrl(){let e=this.url;return e+="?callback=__googleMapsCallback",this.apiKey&&(e+=`&key=${this.apiKey}`),this.channel&&(e+=`&channel=${this.channel}`),this.client&&(e+=`&client=${this.client}`),this.libraries.length>0&&(e+=`&libraries=${this.libraries.join(",")}`),this.language&&(e+=`&language=${this.language}`),this.region&&(e+=`®ion=${this.region}`),this.version&&(e+=`&v=${this.version}`),this.mapIds&&(e+=`&map_ids=${this.mapIds.join(",")}`),this.authReferrerPolicy&&(e+=`&auth_referrer_policy=${this.authReferrerPolicy}`),e}deleteScript(){let e=document.getElementById(this.id);e&&e.remove()}load(){return this.loadPromise()}loadPromise(){return new Promise((e,t)=>{this.loadCallback(n=>{n?t(n.error):e(window.google)})})}importLibrary(e){return this.execute(),google.maps.importLibrary(e)}loadCallback(e){this.callbacks.push(e),this.execute()}setScript(){var e,t;let n,r,o,i,l,a,c,u,s,f,p;if(document.getElementById(this.id))return void this.callback();let d={key:this.apiKey,channel:this.channel,client:this.client,libraries:this.libraries.length&&this.libraries,v:this.version,mapIds:this.mapIds,language:this.language,region:this.region,authReferrerPolicy:this.authReferrerPolicy};Object.keys(d).forEach(e=>!d[e]&&delete d[e]),(null==(t=null==(e=null==window?void 0:window.google)?void 0:e.maps)?void 0:t.importLibrary)||(i="google",l="importLibrary",a=document,u=(c=(c=window)[i]||(c[i]={})).maps||(c.maps={}),s=new Set,f=new URLSearchParams,p=()=>n||(n=new Promise((e,t)=>{var l,c,p,g;return l=this,c=void 0,p=void 0,g=function*(){var l;for(o in yield r=a.createElement("script"),r.id=this.id,f.set("libraries",[...s]+""),d)f.set(o.replace(/[A-Z]/g,e=>"_"+e[0].toLowerCase()),d[o]);f.set("callback",i+".maps.__ib__"),r.src=this.url+"?"+f,u.__ib__=e,r.onerror=()=>n=t(Error("The Google Maps JavaScript API could not load.")),r.nonce=this.nonce||(null==(l=a.querySelector("script[nonce]"))?void 0:l.nonce)||"",a.head.append(r)},new(p||(p=Promise))(function(e,t){function n(e){try{o(g.next(e))}catch(e){t(e)}}function r(e){try{o(g.throw(e))}catch(e){t(e)}}function o(t){var o;t.done?e(t.value):((o=t.value)instanceof p?o:new p(function(e){e(o)})).then(n,r)}o((g=g.apply(l,c||[])).next())})})),u[l]?console.warn("The Google Maps JavaScript API only loads once. Ignoring:",d):u[l]=(e,...t)=>s.add(e)&&p().then(()=>u[l](e,...t)));let g=this.libraries.map(e=>this.importLibrary(e));g.length||g.push(this.importLibrary("core")),Promise.all(g).then(()=>this.callback(),e=>{let t=new ErrorEvent("error",{error:e});this.loadErrorCallback(t)})}reset(){this.deleteScript(),this.done=!1,this.loading=!1,this.errors=[],this.onerrorEvent=null}resetIfRetryingFailed(){this.failed&&this.reset()}loadErrorCallback(e){if(this.errors.push(e),this.errors.length<=this.retries){let e=this.errors.length*Math.pow(2,this.errors.length);console.error(`Failed to load Google Maps script, retrying in ${e} ms.`),setTimeout(()=>{this.deleteScript(),this.setScript()},e)}else this.onerrorEvent=e,this.callback()}callback(){this.done=!0,this.loading=!1,this.callbacks.forEach(e=>{e(this.onerrorEvent)}),this.callbacks=[]}execute(){if(this.resetIfRetryingFailed(),this.done)this.callback();else{if(window.google&&window.google.maps&&window.google.maps.version){console.warn("Google Maps already loaded outside @googlemaps/js-api-loader.This may result in undesirable behavior as options and script parameters may not match."),this.callback();return}this.loading||(this.loading=!0,this.setScript())}}}var v=n(694),m=n(899),b=n(211);function w(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}var O=function(e){var t,n=e.toCenter,r=e.mapRef,o=(0,d.kj)(),i=(0,c.useRef)(),s=function(e){if(Array.isArray(e))return e}(t=(0,c.useState)([]))||function(e){var t,n,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],i=!0,l=!1;try{for(r=r.call(e);!(i=(t=r.next()).done)&&(o.push(t.value),2!==o.length);i=!0);}catch(e){l=!0,n=e}finally{try{i||null==r.return||r.return()}finally{if(l)throw n}}return o}}(t)||function(e){if(e){if("string"==typeof e)return w(e,2);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return w(e,2)}}(t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),f=s[0],p=s[1];(0,c.useEffect)(function(){google.maps.importLibrary("places").then(function(e){i.current=new e.AutocompleteService}).catch(function(){a.message.error("Please configure the Google API Key correctly")})},[r]);var g=(0,l.useDebounceFn)(function(e){i.current&&i.current.getPlacePredictions({input:e||" "},function(e,t){t!==google.maps.places.PlacesServiceStatus.OK?p([]):p(e.map(function(e){var t,n,r=e.structured_formatting;return t=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}({},e),n=n={label:"".concat(r.main_text).concat(r.secondary_text?" "+r.secondary_text:""),value:e.place_id},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t}))})},{wait:300}).run;return u().createElement("div",{style:{position:"absolute",top:10,left:10,zIndex:10,width:"calc(100% - 20px)"}},u().createElement(a.Select,{id:"google-map-search",showSearch:!0,allowClear:!0,style:{background:"rgba(255, 255, 255, 0.8)"},placeholder:o("Enter keywords to search"),filterOption:!1,onSearch:g,onSelect:function(e){var t=f.find(function(t){return t.value===e});new google.maps.places.PlacesService(r.current).getDetails({placeId:t.place_id,fields:["geometry"]},function(e,t){t===google.maps.places.PlacesServiceStatus.OK&&n(e.geometry.location)})},options:f}))},A=function(e){return{url:e,scaledSize:{width:19,height:32},labelOrigin:new google.maps.Point(9.5,42)}};function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function P(e,t,n,r,o,i,l){try{var a=e[i](l),c=a.value}catch(e){n(e);return}a.done?t(c):Promise.resolve(c).then(r,o)}function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){S(e,t,n[t])})}return e}function C(e,t){return t=null!=t?t:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}),e}function I(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||L(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function j(e){return function(e){if(Array.isArray(e))return M(e)}(e)||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||L(e)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e,t){if(e){if("string"==typeof e)return M(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return M(e,t)}}var x={point:{propertyKey:"position",overlay:"Marker"},polygon:{propertyKey:"paths",overlay:"Polygon"},lineString:{propertyKey:"path",overlay:"Polyline"},circle:{transformOptions:function(e){return{center:new google.maps.LatLng(e[1],e[0]),radius:e[2]}},overlay:"Circle"}},D=function(){var e;function t(e){if(!(this instanceof t))throw TypeError("Cannot call a class as a function");S(this,"listeners",new Set),S(this,"mapListeners",[]),S(this,"options",void 0),S(this,"drawingMode",null),S(this,"draftOverlay",null),S(this,"draftPath",[]),S(this,"circleCenter",null),this.options=e,this.setDrawingMode(e.drawingMode||null)}return e=[{key:"addListener",value:function(e,t){var n=this;return"overlaycomplete"===e&&this.listeners.add(t),{remove:function(){n.listeners.delete(t)}}}},{key:"setDrawingMode",value:function(e){this.drawingMode=e,this.resetDraft(),this.bindMapEvents()}},{key:"unbindAll",value:function(){this.listeners.clear(),this.clearMapEvents(),this.resetDraft(),this.drawingMode=null}},{key:"bindMapEvents",value:function(){var e=this;this.clearMapEvents(),this.options.map&&this.drawingMode&&this.mapListeners.push(this.options.map.addListener("click",function(t){t.latLng&&e.handleClick(t.latLng)}),this.options.map.addListener("dblclick",function(){e.completePathOverlay()}),this.options.map.addListener("mousemove",function(t){t.latLng&&e.updatePreview(t.latLng)}))}},{key:"clearMapEvents",value:function(){this.mapListeners.forEach(function(e){var t;return null==e||null==(t=e.remove)?void 0:t.call(e)}),this.mapListeners.length=0}},{key:"resetDraft",value:function(){var e;null==(e=this.draftOverlay)||e.setMap(null),this.draftOverlay=null,this.draftPath=[],this.circleCenter=null}},{key:"handleClick",value:function(e){"marker"===this.drawingMode?this.emitComplete("marker",new google.maps.Marker(C(k({},this.options),{icon:A(s.X),position:e}))):"circle"===this.drawingMode?this.handleCircleClick(e):("polygon"===this.drawingMode||"polyline"===this.drawingMode)&&this.handlePathClick(e)}},{key:"handlePathClick",value:function(e){if("polygon"===this.drawingMode||"polyline"===this.drawingMode){if(this.draftPath.push(e),!this.draftOverlay){this.draftOverlay="polygon"===this.drawingMode?new google.maps.Polygon(C(k({},this.options),{paths:this.draftPath})):new google.maps.Polyline(C(k({},this.options),{path:this.draftPath}));return}this.updatePath(this.draftPath)}}},{key:"handleCircleClick",value:function(e){if(!this.circleCenter){this.circleCenter=e,this.draftOverlay=new google.maps.Circle(C(k({},this.options),{center:e,radius:0}));return}this.updateCircle(e),this.completeCircleOverlay()}},{key:"updatePreview",value:function(e){"circle"===this.drawingMode&&this.circleCenter?this.updateCircle(e):("polygon"===this.drawingMode||"polyline"===this.drawingMode)&&this.draftOverlay&&this.updatePath(j(this.draftPath).concat([e]))}},{key:"updatePath",value:function(e){E(this.draftOverlay,google.maps.Polygon)?this.draftOverlay.setPath(e):E(this.draftOverlay,google.maps.Polyline)&&this.draftOverlay.setPath(e)}},{key:"updateCircle",value:function(e){E(this.draftOverlay,google.maps.Circle)&&this.circleCenter&&this.draftOverlay.setRadius(google.maps.geometry.spherical.computeDistanceBetween(this.circleCenter,e))}},{key:"completePathOverlay",value:function(){if(("polygon"===this.drawingMode||"polyline"===this.drawingMode)&&this.draftOverlay&&("polygon"!==this.drawingMode||!(this.draftPath.length<3))&&("polyline"!==this.drawingMode||!(this.draftPath.length<2))){var e=this.draftOverlay,t=this.drawingMode;this.updatePath(this.draftPath),this.draftOverlay=null,this.draftPath=[],this.emitComplete(t,e)}}},{key:"completeCircleOverlay",value:function(){if(E(this.draftOverlay,google.maps.Circle)){var e=this.draftOverlay;this.draftOverlay=null,this.circleCenter=null,this.emitComplete("circle",e)}}},{key:"emitComplete",value:function(e,t){this.listeners.forEach(function(n){n({type:e,overlay:t})})}}],function(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)}}(t.prototype,e),t}(),U=u().forwardRef(function(e,t){var n=e.value,r=e.onChange,o=e.block,p=void 0!==o&&o,g=e.readonly,h=e.disabled,w=void 0===h?p:h,M=e.zoom,S=void 0===M?13:M,L=e.overlayCommonOptions,U=e.height,_=e.type,T=((0,m.cV)(e.mapType)||{}).accessKey,z=(0,d.kj)(),F=(0,v.useFlowContext)(),R=(0,l.useMemoizedFn)(function(){return z("Load google maps failed, Please check the Api key and refresh the page")}),B=(0,c.useRef)(),K=(0,c.useRef)(),$=(0,c.useRef)(),G=I((0,c.useState)([]),2),N=G[0],J=G[1],Z=I((0,c.useState)(""),2),V=Z[0],W=Z[1],q=a.App.useApp().modal;(0,c.useEffect)(function(){if(K.current&&!p){var e;null==(e=K.current)||e.setZoom(S)}},[S,p]);var X=(0,c.useRef)("point"===_?"marker":"lineString"===_?"polyline":_),H=I((0,c.useState)(k({strokeWeight:5,strokeColor:f.A,fillColor:f.A,strokeOpacity:1,editable:!w,draggable:!w},L)),1)[0],Y=(0,c.useRef)(),Q=(0,c.useRef)(new Set),ee=(0,l.useMemoizedFn)(function(e){if(Q.current.forEach(function(e){Q.current.delete(e)}),"getPath"in e){var t=e.getPath();["insert_at","remove_at","set_at"].forEach(function(n){Q.current.add(t.addListener(n,function(){ei(e,!0)}).remove)})}else E(e,google.maps.Circle)&&["center_changed","radius_changed"].forEach(function(t){Q.current.add(e.addListener(t,function(){ei(e,!0)}).remove)})}),et=(0,l.useMemoizedFn)(function(){if($.current&&($.current.unbindAll(),$.current.setMap(null)),"point"!==_){var e;null==(e=B.current)||e.setDrawingMode(null)}}),en=(0,l.useMemoizedFn)(function(e){if(K.current&&e){var t,n;null==(t=K.current)||t.setCenter(e),null==(n=K.current)||n.setZoom(S)}}),er=(0,l.useMemoizedFn)(function(e){et(),ee(e),$.current=e}),eo=(0,l.useMemoizedFn)(function(e){if(null==e?void 0:e.length){if(1===e.length&&E(e[0],google.maps.Marker)){null==(o=K.current)||null==(r=o.setCenter)||r.call(o,e[0].getPosition()),null==(l=K.current)||null==(i=l.setZoom)||i.call(l,S||13);return}var t,n,r,o,i,l,a=new google.maps.LatLngBounds;e.forEach(function(e){if(E(e,google.maps.Marker))a.extend(e.getPosition());else if(E(e,google.maps.Polyline)||E(e,google.maps.Polygon))for(var t=e.getPath(),n=0;n<t.getLength();n++)a.extend(t.getAt(n));else E(e,google.maps.Circle)&&a.union(e.getBounds())}),null==(n=K.current)||null==(t=n.fitBounds)||t.call(n,a)}}),ei=(0,l.useMemoizedFn)(function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=null;if("point"===_){var o=e.getPosition(),i=o.lat;n=[(0,o.lng)(),i()]}else if("polygon"===_||"lineString"===_){if((n=e.getPath().getArray().map(function(e){return[e.lng(),e.lat()]})).length<2)return}else if("circle"===_){var l=e.getCenter(),a=e.getRadius();n=[l.lng(),l.lat(),a]}t||er(e),null==r||r(n)}),el=(0,l.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0,n=C(k({},H,t),{map:K.current});return B.current=new D(C(k({drawingMode:X.current},n),{icon:A(s.X)})),e||B.current.addListener("overlaycomplete",function(e){ei(e.overlay)}),B.current}),ea=(0,l.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=arguments.length>2?arguments[2]:void 0,o=x[e];if(o){var i=k(C(k({},H),{icon:A(s.X)}),r);return"transformOptions"in o?Object.assign(i,o.transformOptions(t)):"propertyKey"in o&&(i[o.propertyKey]=Array.isArray(t[0])?t.map(function(e){return new google.maps.LatLng(e[1],e[0])}):new google.maps.LatLng(t[1],t[0])),new google.maps[o.overlay](i)}}),ec=(0,l.useMemoizedFn)(function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:_,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:n,r=arguments.length>2?arguments[2]:void 0;if(K.current)return ea(e,t,C(k({},r),{map:K.current}))});(0,c.useEffect)(function(){if(!n&&K.current){var e,t;et(),null==B||null==(t=B.current)||null==(e=t.setDrawingMode)||e.call(t,X.current),null==r||r(null)}if(K.current&&n&&(g||!$.current)){var o=ec();er(o),eo([o])}},[n,N,_,w,g,ec,eo,er,r,et]),(0,c.useEffect)(function(){if(T&&!K.current&&Y.current){var e,t=!1;try{e=new y({apiKey:T,version:"weekly",language:F.api.auth.getLocale()})}catch(e){W(R());return}var n=console.error;return console.error=function(e){for(var t,r=arguments.length,o=Array(r>1?r-1:0),i=1;i<r;i++)o[i-1]=arguments[i];(null==e||null==(t=e.includes)?void 0:t.call(e,"InvalidKeyMapError"))&&W(R()),n.apply(void 0,[e].concat(j(o)))},Promise.all([e.importLibrary("maps"),e.importLibrary("marker"),e.importLibrary("core"),e.importLibrary("geometry")]).then(function(e){var n;return(n=function(){var e,n;return function(e,t){var n,r,o,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),a=Object.defineProperty;return a(l,"next",{value:c(0)}),a(l,"throw",{value:c(1)}),a(l,"return",{value:c(2)}),"function"==typeof Symbol&&a(l,Symbol.iterator,{value:function(){return this}}),l;function c(a){return function(c){var u=[a,c];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(i=0)),i;)try{if(n=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=(o=i.trys).length>0&&o[o.length-1])&&(6===u[0]||2===u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=t.call(e,i)}catch(e){u=[6,e],r=0}finally{n=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}(this,function(r){switch(r.label){case 0:return[4,new Promise(function(e){var t=function(){e({lat:37.4224764,lng:-122.0842499})};navigator.geolocation?navigator.geolocation.getCurrentPosition(function(t){var n=t.coords;e({lat:n.latitude,lng:n.longitude})},function(){t()},{timeout:2e3,maximumAge:0}):t()})];case 1:return e=r.sent(),[4,new Promise(function(e){return requestAnimationFrame(e)})];case 2:if(r.sent(),n=Y.current,t||!E(n,HTMLElement))return[2];return K.current=new google.maps.Map(n,{zoom:S,center:e,mapTypeId:google.maps.MapTypeId.ROADMAP,zoomControl:!1,streetViewControl:!1,panControl:!1,mapTypeControl:!1,fullscreenControl:!1}),google.maps.event.trigger(K.current,"resize"),W(""),J([]),[2]}})},function(){var e=this,t=arguments;return new Promise(function(r,o){var i=n.apply(e,t);function l(e){P(i,r,o,l,a,"next",e)}function a(e){P(i,r,o,l,a,"throw",e)}l(void 0)})})()}).catch(function(e){if(E(e,Error))return void W(e.message)}),function(){var e,n;t=!0,null==(e=K.current)||e.unbindAll(),K.current=null,null==(n=B.current)||n.unbindAll()}}},[T,F.api.auth,R,S]),(0,c.useEffect)(function(){K.current&&_&&!w&&!B.current&&el()},[el,w,N,_]),(0,c.useImperativeHandle)(t,function(){return{setOverlay:ec,getOverlay:ea,setFitView:eo,createDraw:el,map:K.current,overlay:$.current,drawingManager:B.current,errMessage:V}});var eu=(0,l.useMemoizedFn)(function(){var e=function(){et(),B.current.setDrawingMode(X.current),null==r||r(null)};q.confirm({title:z("Clear the canvas"),content:z("Are you sure to clear the canvas?"),okText:z("Confirm"),cancelText:z("Cancel"),getContainer:function(){return Y.current},onOk:function(){e()}})});return!T||V?u().createElement(a.Alert,{action:u().createElement(a.Button,{type:"primary",href:(0,b.J)(F.app,window.location.pathname,"?tab=google"),target:"_blank",rel:"noopener noreferrer",onClick:function(){var e,t;null==(t=F.view)||null==(e=t.close)||e.call(t)}},z("Go to the configuration page")),message:V||z("Please configure the Api key first"),type:"error"}):u().createElement("div",{style:{position:"relative",height:U||500}},!K.current&&u().createElement("div",{style:{position:"absolute",inset:0,display:"flex",alignItems:"center",justifyContent:"center"}},u().createElement(a.Spin,null)),w?null:u().createElement(u().Fragment,null,K.current&&u().createElement(O,{toCenter:en,mapRef:K}),u().createElement("div",{style:{position:"absolute",bottom:80,right:20,zIndex:10}},u().createElement(a.Button,{onClick:function(){$.current&&eo([$.current])},disabled:!$.current,type:"primary",shape:"round",size:"large",icon:u().createElement(i.SyncOutlined,null)})),"lineString"===_||"polygon"===_?u().createElement("div",{style:{position:"absolute",bottom:20,left:10,zIndex:2,pointerEvents:"none"}},u().createElement(a.Alert,{message:z("Click to select the starting point and double-click to end the drawing"),type:"info"})):null,u().createElement("div",{style:{position:"absolute",bottom:20,right:20,zIndex:2}},u().createElement(a.Button,{disabled:!n,style:{height:"40px"},onClick:eu,type:"primary",danger:!0},z("Clear")))),u().createElement("div",{ref:Y,style:k({width:"100%",height:"100%"},null==e?void 0:e.style)}))});function _(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function T(e,t){return null!=t&&"u">typeof Symbol&&t[Symbol.hasInstance]?!!t[Symbol.hasInstance](e):e instanceof t}function z(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{},r=Object.keys(n);"function"==typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(n).filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable}))),r.forEach(function(t){var r;r=n[t],t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r})}return e}function F(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,r,o=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=o){var i=[],l=!0,a=!1;try{for(o=o.call(e);!(l=(n=o.next()).done)&&(i.push(n.value),!t||i.length!==t);l=!0);}catch(e){a=!0,r=e}finally{try{l||null==o.return||o.return()}finally{if(a)throw r}}return i}}(e,t)||R(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function R(e,t){if(e){if("string"==typeof e)return _(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _(e,t)}}U.displayName="GoogleMapsCom";var B="google-maps-overlay-id",K="google-maps-overlay-selected",$=function(e){var t,n,r,o=e.collectionField,g=e.marker,h=e.dataSource,y=e.fixedBlock,v=e.zoom,m=e.setSelectedRecordKeys,b=e.lineSort,w=e.fields,O=(e.name,e.primaryKey),M=e.mapField,P=e.associationCollectionField,S=e.onOpenView,E=F((0,c.useState)(!1),2),k=E[0],C=E[1],I=(0,c.useRef)(),j=F((0,c.useState)(""),2),L=j[0],x=j[1],D=(0,d.kj)(),$=(F((0,c.useState)(null),2)[1],(0,c.useRef)(L)),G=(0,c.useRef)(null),N=(0,c.useRef)([]);$.current=L;var J=null==(r=w.find(function(e){return e.name===g}))?void 0:r.uiSchema,Z=o.interface||o.type,V=function(e,t){var n=void 0!==t?!t:e.get(K);e.set(K,!n),e.setOptions(z({},n?{icon:A(s.X),strokeColor:f.A,fillColor:f.A}:{icon:A(s.F),strokeColor:f.v,fillColor:f.v}))};(0,c.useEffect)(function(){if("selection"===L){!I.current||(null==(e=I.current)?void 0:e.drawingManager)||(I.current.drawingManager=null==(r=I.current)?void 0:r.createDraw(!0,{editable:!0,draggable:!0}));var e,t,n,r,o=new Set;return null==(t=I.current)||t.drawingManager.setDrawingMode("polygon"),null==(n=I.current)||n.drawingManager.addListener("overlaycomplete",function(e){var t,n=e.overlay;null==(t=I.current)||t.drawingManager.setDrawingMode(null),G.current=n;var r=n.getPath();["insert_at","remove_at","set_at"].forEach(function(e){o.add(r.addListener(e,function(){}).remove)})}),function(){var e,t,n,r;o.forEach(function(e){e()}),I.current&&(null==(e=G.current)||e.unbindAll(),null==(t=G.current)||t.setMap(null),G.current=null,null==(n=I.current)||n.drawingManager.setDrawingMode(null),null==(r=I.current)||r.drawingManager.unbindAll())}}},[L]),(0,c.useEffect)(function(){if(L)return function(){$.current||N.current.forEach(function(e){V(e,!1)})}},[L]);var W=(0,l.useMemoizedFn)(function(){var e,t=G.current,n=N.current,r=google.maps.geometry.poly,o=n.filter(function(e){if(e!==t&&void 0!==e.get(B))if(T(e,google.maps.Marker))return r.containsLocation(e.getPosition(),t);else if(T(e,google.maps.Circle))return r.containsLocation(e.getCenter(),t);else return e.getPath().getArray().some(function(e){return r.containsLocation(e,t)})}).map(function(e){return V(e,!0),e.get(B)});m(function(e){return o.concat(e)}),null==t||t.unbindAll(),null==t||t.setMap(null),null==(e=I.current)||e.drawingManager.setDrawingMode("polygon")});return(0,c.useEffect)(function(){if(o&&(null==h?void 0:h.length)&&(null==(r=I.current)?void 0:r.map)){var e=h.map(function(e){var t,n=null==(t=(0,p.el)(e,M,null==P?void 0:P.interface))?void 0:t.filter(Boolean),r=(0,p.PB)(J,e[g]);return(null==n?void 0:n.length)?null==n?void 0:n.filter(Boolean).map(function(t){if(n){var o,i=null==(o=I.current)?void 0:o.setOverlay(Z,t,{strokeColor:f.A,fillColor:f.A,cursor:"pointer",label:{className:"nb-map-google-label",fontFamily:"inherit",fontSize:"13px",color:"#333",text:g?(0,p.Gq)(r,D):void 0}});return null==i||i.set(B,e[O]),i}}):[]}).flat().filter(Boolean);N.current=e;var t=e.map(function(e){return e.addListener("click",function(t){var n=e.get(B);if(n){var r=null==h?void 0:h.find(function(e){return n===e[O]});r&&S(r)}}),function(){return e.unbindAll()}});if("point"===Z&&(null==b?void 0:b.length)&&(null==e?void 0:e.length)>1){var n,r,i,l=e.map(function(e){return e.getPosition()});e[0].setZIndex(138),e[e.length-1].setZIndex(138);var a=function(){var e,t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];if(null==(e=I.current)?void 0:e.map)return new google.maps.Marker({label:{className:"nb-map-google-point-label",fontFamily:"inherit",fontSize:"13px",color:"#333",text:t?D("Start point"):D("End point")},icon:A(s.X),position:t?l[0]:l[l.length-1],map:I.current.map})};e.push.apply(e,function(e){if(Array.isArray(e))return _(e)}(n=[I.current.setOverlay("lineString",l.map(function(e){return[e.lng(),e.lat()]}),{strokeColor:f.A,fillColor:f.A,strokeWeight:2,cursor:"pointer"}),a(),a(!1)].filter(Boolean))||function(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(n)||R(n)||function(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}())}return null==(i=I.current)||i.setFitView(e),function(){e.forEach(function(e){e.setMap(null),e.unbindAll()}),t.forEach(function(e){return e()})}}},[h,k,g,Z,!1]),(0,c.useEffect)(function(){setTimeout(function(){m([])})},[h]),u().createElement("div",{style:{position:"relative",height:"100%"}},k&&u().createElement(u().Fragment,null,u().createElement("div",{style:{position:"absolute",left:10,top:10,zIndex:999}},u().createElement(a.Space,{direction:"vertical"},u().createElement(a.Button,{style:{color:L?void 0:f.v,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),x("")},icon:u().createElement(i.EnvironmentOutlined,null)}),u().createElement(a.Button,{style:{color:"selection"===L?f.v:void 0,borderColor:"currentcolor"},onClick:function(e){e.stopPropagation(),x("selection")},icon:u().createElement(i.ExpandOutlined,null)}),"selection"===L?u().createElement(a.Button,{type:"primary",icon:u().createElement(i.CheckOutlined,null),title:D("Confirm selection"),onClick:W}):null))),u().createElement(U,(t=z({},e),n=n={ref:function(e){I.current=e,C(!!(null==e?void 0:e.map)&&!e.errMessage)},style:y?{height:"100%"}:void 0,zoom:v,type:Z,disabled:!0,block:!0,overlayCommonOptions:{strokeColor:f.v,fillColor:f.v}},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):(function(e){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t.push.apply(t,n)}return t})(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}),t)))}},211:function(e,t,n){"use strict";n.d(t,{J:function(){return o}});var r=n(485);function o(e,t){var n,o,i,l,a,c,u=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=e.getPublicPath(),f=(0,r.stripModernClientPrefix)(s).replace(/\/+$/,""),p=(n=e.name,i="/".concat(s).replace(/\/{2,}/g,"/").replace(/\/+$/,""),l="/".concat(t).replace(/\/{2,}/g,"/").split(/[?#]/)[0],a=i&&(l===i||l.startsWith("".concat(i,"/")))?l.slice(i.length)||"/":l,(c=null==(o=/^\/(?:apps|_app)\/[^/]+(?=\/|$)/.exec(a))?void 0:o[0])?c:n&&"main"!==n?"/apps/".concat(n):""),d=e.pluginSettingsManager.getRoutePath("map").replace(/^\/admin\/settings(?=\/|$)/,"/settings"),g=d.replace(/^\/settings(?=\/|$)/,"");return p?"".concat(f,"/settings").concat(p).concat(g).concat(u):"".concat(f).concat(d).concat(u)}},970:function(e,t,n){"use strict";n.d(t,{F:function(){return i},X:function(){return l}});var r=n(802),o=function(e){return"data:image/svg+xml;utf8,".concat(encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="38" height="63" viewBox="0 0 38 63"><path fill="'.concat(e,'" d="M19 0C8.5 0 0 8.5 0 19c0 14.2 19 44 19 44s19-29.8 19-44C38 8.5 29.5 0 19 0Z"/><circle fill="white" cx="19" cy="19" r="8"/></svg>')))},i=o(r.v),l=o(r.A)},802:function(e,t,n){"use strict";n.d(t,{A:function(){return r},v:function(){return o}});var r="#4e9bff",o="#F18b62"},294:function(e,t,n){"use strict";n.d(t,{DP:function(){return i},Gq:function(){return l},PB:function(){return a},el:function(){return r},zd:function(){return o}});var r=function(e,t,n){var r=null==t?void 0:t.reduce(function(e,r,o){return o===t.length-1&&("o2m"===n||"m2m"===n)?null==e?void 0:e.map(function(e){return e[r]}).filter(function(e){return null!=e}):null==e?void 0:e[r]},e);return"o2m"===n||"m2m"===n?r:[r]},o=function(e){window.requestIdleCallback?window.requestIdleCallback(function(){e()}):window.setTimeout(e,1)},i=function(e,t){if("string"==typeof e)return e;if((null!=(n=Error)&&"u">typeof Symbol&&n[Symbol.hasInstance]?!!n[Symbol.hasInstance](e):e instanceof n)&&e.message)return e.message;if(e&&(void 0===e?"undefined":e&&"u">typeof Symbol&&e.constructor===Symbol?"symbol":typeof e)=="object"&&"message"in e){var n,r=e.message;if("string"==typeof r&&r)return r}return t},l=function(e,t){return"string"!=typeof e?e:e.replace(/\{\{\s*t\(['"]([^'"]+)['"](?:,\s*([^}]+))?\)\s*\}\}/g,function(e,n){return t?t(n):n})},a=function(e,t){if(null==t)return t;var n=(null==e?void 0:e.enum)||(null==e||null==(r=e["x-component-props"])?void 0:r.options);if(Array.isArray(n)){var r,o,i,l=n.find(function(e){return(null==e?void 0:e.value)===t});if(l)return null!=(o=null!=(i=l.label)?i:l.title)?o:t}return t}}}]);
|