"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.getENV=exports.getUA=void 0;var sdk_1=require("./sdk"),sdk_2=require("./sdk");Object.defineProperty(exports,"ENV_ENUM",{enumerable:!0,get:function(){return sdk_2.ENV_ENUM}}),Object.defineProperty(exports,"APP_TYPE",{enumerable:!0,get:function(){return sdk_2.APP_TYPE}}),Object.defineProperty(exports,"ENV_ENUM_SUB",{enumerable:!0,get:function(){return sdk_2.ENV_ENUM_SUB}});var dingtalk_javascript_env_1=require("./packages/dingtalk-javascript-env"),EDdWeexEnv;!function(e){e.singlePage="singlePage",e.miniApp="miniApp",e.miniWidget="miniWidget"}(EDdWeexEnv||(EDdWeexEnv={})),exports.getUA=function(){var e="";try{"undefined"!=typeof navigator&&(e=navigator&&(navigator.userAgent||navigator.swuserAgent)||"")}catch(t){e=""}return e},exports.getENV=function(){var e=exports.getUA(),t=/iPhone|iPad|iPod|iOS/i.test(e),i=/Android/i.test(e),n=/Nebula/i.test(e),a=/DingTalk/i.test(e),r=/dd-web/i.test(e),d="object"==typeof nuva,s="object"==typeof dd&&"function"==typeof dd.dtBridge,_=s&&t||d&&t,o=a||dingtalk_javascript_env_1.default.isDingTalk,E=t&&o||dingtalk_javascript_env_1.default.isWeexiOS||_,g=i&&o||dingtalk_javascript_env_1.default.isWeexAndroid,v=n&&o||s,l=r,p=sdk_1.APP_TYPE.WEB;if(l)p=sdk_1.APP_TYPE.WEBVIEW_IN_MINIAPP;else if(v)p=sdk_1.APP_TYPE.MINI_APP;else if(dingtalk_javascript_env_1.default.isWeexiOS||dingtalk_javascript_env_1.default.isWeexAndroid)try{var u=weex.config.ddWeexEnv;p=u===EDdWeexEnv.miniWidget?sdk_1.APP_TYPE.WEEX_WIDGET:sdk_1.APP_TYPE.WEEX}catch(e){p=sdk_1.APP_TYPE.WEEX}var c,P="*",f=e.match(/AliApp\(\w+\/([a-zA-Z0-9.-]+)\)/);null===f&&(f=e.match(/DingTalk\/([a-zA-Z0-9.-]+)/));var k;f&&f[1]&&(k=f[1]);var N="";if("undefined"!=typeof name&&(N=name),N)try{var A=JSON.parse(N);A.hostVersion&&(k=A.hostVersion),P=A.language||navigator.language||"*",c=A.containerId}catch(e){}var x=!!c;x&&!k&&(f=e.match(/DingTalk\(([a-zA-Z0-9\.-]+)\)/))&&f[1]&&(k=f[1]);var U,W=sdk_1.ENV_ENUM_SUB.noSub;if(E)U=sdk_1.ENV_ENUM.ios;else if(g)U=sdk_1.ENV_ENUM.android;else if(x){var m=e.indexOf("Macintosh; Intel Mac OS")>-1;W=m?sdk_1.ENV_ENUM_SUB.mac:sdk_1.ENV_ENUM_SUB.win,U=sdk_1.ENV_ENUM.pc}else U=sdk_1.ENV_ENUM.notInDingTalk;return{platform:U,platformSub:W,version:k,appType:p,language:P}};