'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var env_env = require('../env/env.js');
var location_platform_h5GeolocationLocation = require('./platform/h5-geolocation-location.js');
var location_platform_msdkLocation = require('./platform/msdk-location.js');
var location_platform_slugSdkLocation = require('./platform/slug-sdk-location.js');
var location_platform_tencentMapApiLocation = require('./platform/tencent-map-api-location.js');
var location_platform_tencentMapLocation = require('./platform/tencent-map-location.js');
var location_platform_tipSdkLocation = require('./platform/tip-sdk-location.js');
var location_platform_wechatSdkLocation = require('./platform/wechat-sdk-location.js');
require('@babel/runtime/helpers/classCallCheck');
require('@babel/runtime/helpers/createClass');
require('./location-interface.js');
require('../msdk/msdk.js');
require('@babel/runtime/helpers/typeof');
require('../loader/little-loader.js');
require('axios');
require('../city/city.js');
require('../city/data.js');
require('../lodash-mini/get.js');
require('../loader/loader-unity.js');
require('../loader/loader.js');

function locationHandle(options) {
  var _getEnvUAType = env_env.getEnvUAType(),
    isInGame = _getEnvUAType.isInGame,
    isMsdkX = _getEnvUAType.isMsdkX,
    isWeixin = _getEnvUAType.isWeixin,
    isSlugSdk = _getEnvUAType.isSlugSdk,
    isMiniProgram = _getEnvUAType.isMiniProgram;
  var handle;
  if (options.useWxSdk && isWeixin) {
    handle = new location_platform_wechatSdkLocation["default"]();
  } else if (options.useSlugSdk && isSlugSdk) {
    handle = new location_platform_slugSdkLocation["default"]();
  } else if (options.useMsdk && isMsdkX) {
    handle = new location_platform_msdkLocation["default"]();
  } else if (options.useTipSdk && isInGame) {
    handle = new location_platform_tipSdkLocation["default"]();
  } else if (options.useTencentMapApi) {
    handle = new location_platform_tencentMapApiLocation["default"]();
  } else if (options.useH5Geolocation && isMiniProgram) {
    handle = new location_platform_h5GeolocationLocation["default"]();
  } else if (options.useTencentMap) {
    handle = new location_platform_tencentMapLocation["default"]();
  }
  return handle;
}
locationHandle.failHandle = function (options, handle) {
  if (options.useTencentMapIfFail && handle && handle instanceof location_platform_tipSdkLocation["default"]) {
    return new location_platform_tencentMapLocation["default"]();
  }
};

exports["default"] = locationHandle;
