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IAAM,SAAkB,UAAT,EAAmB,IAAgB,QAAT,EAAiB,IAAM,OAExW,CACE,8BACA,mCAAmC,EAAe,EAAY,IAAM,IAAM,EAAY,IAAO,kBAAkB,EAAa,OAAO,EAAa,YAAqB,UAAT,EAAmB,UAAsB,QAAT,EAAiB,UAAY,wBAA+C,UAAtB,EAAa,KAAmB,QAAU,eAAe,KAAK,QAAQ,WAE1T,CACE,yBACA,6BAA6B,EAAa,OAAO,EAAa,SAAS,EAAa,gBAAyB,UAAT,EAAmB,IAAgB,QAAT,EAAiB,IAAM,OAEvJ,CACE,0BACA,0BAA0B,EAAe,EAAY,IAAM,IAAM,EAAY,IAAO,YAAY,EAAa,OAAO,EAAa,sBAA+B,UAAT,EAAmB,UAAsB,QAAT,EAAiB,UAAY,eAI5N,EAOA,QAAA,CAAS,GACP,OAAO,WAAW,CAChB,QAAS,CACP,CACE,yBACA,wCAAwC,KAAK,QAAQ,mBAAmB,EAAa,aAAa,EAAa,WAAW,EAAa,WAAiC,UAAtB,EAAa,KAAmB,IAAM,OAE1L,CACE,yBACA,6CAA6C,EAAa,OAAO,EAAa,+BAAqD,UAAtB,EAAa,KAAmB,QAAU,eAAe,KAAK,QAAQ,YAGvL,IAAK,CACH,CACE,yBACA,oCAAoC,KAAK,QAAQ,mBAAmB,EAAa,aAAa,EAAa,WAAW,EAAa,WAAiC,UAAtB,EAAa,KAAmB,IAAM,OAEtL,CACE,yBACA,gDAAgD,EAAa,OAAO,EAAa,+BAAqD,UAAtB,EAAa,KAAmB,QAAU,eAAe,KAAK,QAAQ,WAExL,CACE,yBACA,6BAA6B,EAAa,IAAM,IAAM,EAAa,SAAS,EAAa,oBAIjG","file":"/npm/react-native-use-external-maps@1.0.0/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/react-native-use-external-maps@1.0.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { Linking, ActionSheetIOS, Alert, Platform } from 'react-native';\n\nfunction openDialog(urls) {\n  if (Platform.OS === 'ios') {\n    urls = urls.ios;\n    return Promise.all(urls.map(element => Linking.canOpenURL(element[1])))\n      .then((results) => {\n        return urls.filter((element, index) => results[index]);\n      }).then(choices => {\n        // if there is no map app on the device, recommend one to download\n        if (choices.length < 1) {\n          return ActionSheetIOS.showActionSheetWithOptions({\n            options: ['Download Gaode Maps', 'Download Baidu Maps', 'Cancel'],\n            cancelButtonIndex: 2,\n            title: 'Choose the map',\n          }, buttonIndex => {\n            if (buttonIndex === 0) {\n              Linking.openURL('https://itunes.apple.com/cn/app/gao-tu-zhuan-ye-shou-ji-tu/id461703208?mt=8');\n            } else if (buttonIndex === 1) {\n              Linking.openURL('https://itunes.apple.com/cn/app/bai-du-tu-shou-ji-tu-lu-xian/id452186370?mt=8');\n            }\n          });\n        }\n\n        return ActionSheetIOS.showActionSheetWithOptions({\n          options: [...(choices.map(element => element[0])), 'Cancel'],\n          cancelButtonIndex: choices.length,\n          title: 'Choose the map',\n        }, buttonIndex => {\n          if (buttonIndex < choices.length) {\n            Linking.openURL(choices[buttonIndex][1]);\n          }\n        });\n      });\n  } else if (Platform.OS === 'android') {\n    urls = urls.android;\n    return Promise.all(urls.map(element => Linking.canOpenURL(element[1])))\n      .then((results) => {\n        return urls.filter((element, index) => results[index]).map(url => ({\n          text: url[0],\n          onPress: () => {\n            Linking.openURL(url[1]);\n          },\n        }));\n      }).then(choices => {\n        // if there is no map app on the device, recommend one to download\n        if (choices.length < 1) {\n          return Alert.alert('Choose the map', 'You have not installed any maps', [\n            { text: 'Download Gaode Maps', onPress: () => Linking.openURL('http://mobile.amap.com') },\n            { text: 'Download Baidu Maps', onPress: () => Linking.openURL('http://map.baidu.com') },\n            { text: 'Cancel' }\n          ]);\n        }\n\n        return Alert.alert('Choose the map', 'Please choose a map to open', [...choices, { text: 'Cancel' }]);\n      });\n  }\n}\n\nexport default {\n  options: { appName: 'MapLinking' },\n\n  setOptions(opts) {\n    this.options = { ...this.options, ...opts };\n  },\n\n  /**\n   * find a specific location on the maps\n   *\n   * @param location {lat:40, lng: 118, type: 'gcj02'}\n   * @param title    \n   * @param content  \n   */\n  markLocation(location, title, content) {\n    return openDialog({\n      android: [\n        [\n          'Open by Gaode Maps',\n          `androidamap://viewMap?sourceApplication=${this.options.appName}&poiname=${title}&lat=${location.lat}&lon=${location.lng}&dev=${location.type === 'gcj02' ? '0' : '1'}`,\n        ],\n        [\n          'Open by Baidu Maps',\n          `bdapp://map/marker?location=${location.lat},${location.lng}&coord_type=${location.type === 'gcj02' ? 'gcj02' : 'wgs84'}&title=${title}&content=${content}&src=${this.options.appName}`,\n        ]\n      ],\n      ios: [\n        [\n          'Open by Gaode Maps',\n          `iosamap://viewMap?sourceApplication=${this.options.appName}&poiname=${title}&lat=${location.lat}&lon=${location.lng}&dev=${location.type === 'gcj02' ? '0' : '1'}`,\n        ],\n        [\n          'Open by Baidu Maps',\n          `baidumap://map/marker?location=${location.lat},${location.lng}&coord_type=${location.type === 'gcj02' ? 'gcj02' : 'wgs84'}&title=${title}&content=${content}&src=${this.options.appName}`,\n        ],\n        [\n          'Open by Apple Maps',\n          `http://maps.apple.com/?ll=${location.lat},${location.lng}&q=${title}`,\n        ],\n      ],\n    });\n  },\n\n  /**\n   * Get the route navigation from source location to destination location\n   *\n   * @param srcLocation  {lat:40, lng: 118, title: 'Starting point'}\n   * @param destLocation {lat:40, lng: 118, type: 'gcj02', title: 'Ending point'}\n   * @param mode         drive, bus, walk\n   */\n  planRoute(srcLocation, distLocation, mode) {\n    return openDialog({\n      android: [\n        [\n          'Get the route by Gaode Maps',\n          `androidamap://route?sourceApplication=${this.options.appName}&slat=${srcLocation && srcLocation.lat}&slon=${srcLocation && srcLocation.lng}&sname=${srcLocation && srcLocation.title}&dlat=${distLocation.lat}&dlon=${distLocation.lng}&dname=${distLocation.title}&dev=${distLocation.type === 'gcj02' ? '0' : '1'}&m=0&t=${mode === 'drive' ? '2' : (mode === 'bus' ? '1' : '4')}`,\n        ],\n        [\n          'Get the route by Baidu Maps',\n          `bdapp://map/direction?origin=${srcLocation ? (srcLocation.lat + ',' + srcLocation.lng) : ''}&destination=${distLocation.lat},${distLocation.lng}&mode=${mode === 'drive' ? 'driving' : (mode === 'bus' ? 'transit' : 'walking')}&coord_type=${distLocation.type === 'gcj02' ? 'gcj02' : 'wgs84'}&src=${this.options.appName}`,\n        ]\n      ],\n      ios: [\n        [\n          'Get the route by Gaode Maps',\n          `iosamap://path?sourceApplication=${this.options.appName}&slat=${srcLocation && srcLocation.lat}&slon=${srcLocation && srcLocation.lng}&sname=${srcLocation && srcLocation.title}&dlat=${distLocation.lat}&dlon=${distLocation.lng}&dname=${distLocation.title}&dev=${distLocation.type === 'gcj02' ? '0' : '1'}&t=${mode === 'drive' ? '0' : (mode === 'bus' ? '1' : '2')}`,\n        ],\n        [\n          'Get the route by Baidu Maps',\n          `baidumap://map/direction?origin=${srcLocation ? (srcLocation.lat + ',' + srcLocation.lng) : ''}&destination=${distLocation.lat},${distLocation.lng}&mode=${mode === 'drive' ? 'driving' : (mode === 'bus' ? 'transit' : 'walking')}&coord_type=${distLocation.type === 'gcj02' ? 'gcj02' : 'wgs84'}&src=${this.options.appName}`,\n        ],\n        [\n          'Navigate by Apple Maps',\n          `http://maps.apple.com/?ll=${distLocation.lat},${distLocation.lng}&q=${distLocation.title}&dirflg=${mode === 'drive' ? 'd' : (mode === 'bus' ? 'r' : 'w')}`,\n        ],\n        [\n          'Navigate by Google Maps',\n          `comgooglemaps://?saddr=${srcLocation ? (srcLocation.lat + ',' + srcLocation.lng) : ''}&daddr=${distLocation.lat},${distLocation.lng}&directionsmode=${mode === 'drive' ? 'driving' : (mode === 'bus' ? 'transit' : 'walking')}`,\n        ]\n      ],\n    });\n  },\n\n  /**\n   * Launch the navigation\n   *\n   * @param destLocation {lat:40, lng: 118, type: 'gcj02', title: '终点'}\n   */\n  navigate(distLocation) {\n    return openDialog({\n      android: [\n        [\n          'Navigate by Gaode Maps',\n          `androidamap://navi?sourceApplication=${this.options.appName}&poiname=${distLocation.title}&lat=${distLocation.lat}&lon=${distLocation.lng}&dev=${distLocation.type === 'gcj02' ? '0' : '1'}`,\n        ],\n        [\n          'Navigate by Baidu Maps',\n          `bdapp://map/direction?origin=&destination=${distLocation.lat},${distLocation.lng}&mode=driving&coord_type=${distLocation.type === 'gcj02' ? 'gcj02' : 'wgs84'}&src=${this.options.appName}`,\n        ]\n      ],\n      ios: [\n        [\n          'Navigate by Gaodu Maps',\n          `iosamap://navi?sourceApplication=${this.options.appName}&poiname=${distLocation.title}&lat=${distLocation.lat}&lon=${distLocation.lng}&dev=${distLocation.type === 'gcj02' ? '0' : '1'}`,\n        ],\n        [\n          'Navigate by Baidu Maps',\n          `baidumap://map/direction?origin=&destination=${distLocation.lat},${distLocation.lng}&mode=driving&coord_type=${distLocation.type === 'gcj02' ? 'gcj02' : 'wgs84'}&src=${this.options.appName}`,\n        ],\n        [\n          'Navigate by Apple Maps',\n          `http://maps.apple.com/?ll=${distLocation.lat + ',' + distLocation.lng}&q=${distLocation.title}&dirflg=d`,\n        ],\n      ],\n    });\n  },\n};\n"]}