commit d94749731a56c05740f3976341c1272af36cb40b Author: pioneer Date: Wed Nov 9 16:11:20 2022 +0800 open diff --git a/README.md b/README.md new file mode 100644 index 0000000..bdf1d91 --- /dev/null +++ b/README.md @@ -0,0 +1,6 @@ +# open-JSD-9943 + +JSD-9943 私有版本飞书集成\ +免责说明:该源码为第三方爱好者提供,不保证源码和方案的可靠性,也不提供任何形式的源码教学指导和协助!\ +仅作为开发者学习参考使用!禁止用于任何商业用途!\ +为保护开发者隐私,开发者信息已隐去!若原开发者希望公开自己的信息,可联系【pioneer】处理。 \ No newline at end of file diff --git a/lib/finekit-10.0.jar b/lib/finekit-10.0.jar new file mode 100644 index 0000000..861ee4a Binary files /dev/null and b/lib/finekit-10.0.jar differ diff --git a/lib/gson-2.8.6.jar b/lib/gson-2.8.6.jar new file mode 100644 index 0000000..4765c4a Binary files /dev/null and b/lib/gson-2.8.6.jar differ diff --git a/plugin.xml b/plugin.xml new file mode 100644 index 0000000..3078f39 --- /dev/null +++ b/plugin.xml @@ -0,0 +1,28 @@ + + + com.fr.plugin.third.party.jsdjjed + + yes + 1.0.37 + 10.0 + 2019-01-01 + fr.open + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/FeishuManagerComponent.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/FeishuManagerComponent.java new file mode 100644 index 0000000..094f5c0 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/FeishuManagerComponent.java @@ -0,0 +1,25 @@ +package com.fr.plugin.third.party.jsdjjed; + +import com.fr.web.struct.Component; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.category.StylePath; + + +public class FeishuManagerComponent extends Component { + + public static FeishuManagerComponent KEY = new FeishuManagerComponent(); + + private FeishuManagerComponent(){ + + } + + @Override + public ScriptPath script() { + return ScriptPath.build("/com/fr/plugin/third/party/jsdjjed/feishu.js"); + } + + @Override + public StylePath style() { + return StylePath.build("/com/fr/plugin/third/party/jsdjjed/feishu.css"); + } +} \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/FeishuManagerSystemOption.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/FeishuManagerSystemOption.java new file mode 100644 index 0000000..d4e7f7c --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/FeishuManagerSystemOption.java @@ -0,0 +1,33 @@ +package com.fr.plugin.third.party.jsdjjed; + +import com.fr.decision.fun.impl.AbstractSystemOptionProvider; +import com.fr.decision.web.MainComponent; +import com.fr.web.struct.Atom; + +public class FeishuManagerSystemOption extends AbstractSystemOptionProvider { + + @Override + public String id() { + return "decision-jsdjjed-feishu-manager"; + } + + @Override + public String displayName() { + return "飞书管理"; + } + + @Override + public int sortIndex() { + return 2; + } + + @Override + public Atom attach() { + return MainComponent.KEY; + } + + @Override + public Atom client() { + return FeishuManagerComponent.KEY; + } +} \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/OutputPluginLifecycleMonitor.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/OutputPluginLifecycleMonitor.java new file mode 100644 index 0000000..2544902 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/OutputPluginLifecycleMonitor.java @@ -0,0 +1,41 @@ +package com.fr.plugin.third.party.jsdjjed; + +import com.fr.intelli.record.Focus; +import com.fr.intelli.record.Original; +import com.fr.plugin.context.PluginContext; +import com.fr.plugin.observer.inner.AbstractPluginLifecycleMonitor; +import com.fr.plugin.third.party.jsdjjed.config.AppDataConfig; +import com.fr.plugin.third.party.jsdjjed.handle.ImageOutputFormat; +import com.fr.plugin.third.party.jsdjjed.schedule.AppMessagePushHandler; +import com.fr.plugin.third.party.jsdjjed.schedule.bean.OutputAppMessagePush; +import com.fr.plugin.third.party.jsdjjed.schedule.entity.AppMessagePushEntity; +import com.fr.record.analyzer.EnableMetrics; +import com.fr.schedule.extension.report.job.output.BaseOutputFormat; +import com.fr.schedule.feature.ScheduleOutputActionEntityRegister; +import com.fr.schedule.feature.output.OutputActionHandler; +import com.fr.stable.fun.Authorize; + + + +/** + * 配置信息初始化 + */ +@EnableMetrics +public class OutputPluginLifecycleMonitor extends AbstractPluginLifecycleMonitor { + @Override + @Focus(id = "com.fr.plugin.third.party.jsdjjed", text = "plugin-jsdjjed", source = Original.PLUGIN) + public void afterRun(PluginContext pluginContext) { + BaseOutputFormat.registerOutputFormat(new ImageOutputFormat()); + AppDataConfig.getInstance(); + OutputActionHandler.registerHandler(new AppMessagePushHandler(), OutputAppMessagePush.class.getName()); + ScheduleOutputActionEntityRegister.getInstance().addClass(AppMessagePushEntity.class); + + } + + @Override + public void beforeStop(PluginContext pluginContext) { + BaseOutputFormat.removeOutputFormat(ImageOutputFormat.FORMAT_IMAGE); + OutputActionHandler.removeOutputHandler(OutputAppMessagePush.class.getName()); + ScheduleOutputActionEntityRegister.getInstance().removeClass(AppMessagePushEntity.class); + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/Utils.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/Utils.java new file mode 100644 index 0000000..de1e0f8 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/Utils.java @@ -0,0 +1,386 @@ +package com.fr.plugin.third.party.jsdjjed; + +import com.fanruan.api.log.LogKit; +import com.fanruan.api.util.StringKit; +import com.fr.decision.authority.data.User; +import com.fr.decision.webservice.bean.user.UserBean; +import com.fr.decision.webservice.bean.user.UserUpdateBean; +import com.fr.decision.webservice.v10.user.UserService; +import com.fr.json.JSONObject; +import com.fr.stable.StringUtils; +import com.fr.third.org.apache.http.HttpEntity; +import com.fr.third.org.apache.http.HttpStatus; +import com.fr.third.org.apache.http.client.config.RequestConfig; +import com.fr.third.org.apache.http.client.methods.CloseableHttpResponse; +import com.fr.third.org.apache.http.client.methods.HttpGet; +import com.fr.third.org.apache.http.client.methods.HttpPost; +import com.fr.third.org.apache.http.conn.ssl.NoopHostnameVerifier; +import com.fr.third.org.apache.http.conn.ssl.SSLConnectionSocketFactory; +import com.fr.third.org.apache.http.entity.StringEntity; +import com.fr.third.org.apache.http.entity.mime.MultipartEntityBuilder; +import com.fr.third.org.apache.http.impl.client.CloseableHttpClient; +import com.fr.third.org.apache.http.impl.client.HttpClients; +import com.fr.third.org.apache.http.ssl.SSLContextBuilder; +import com.fr.third.org.apache.http.ssl.TrustStrategy; +import com.fr.third.org.apache.http.util.EntityUtils; +import com.fr.third.springframework.web.util.UriUtils; + +import javax.net.ssl.HostnameVerifier; +import javax.net.ssl.SSLContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.List; +import java.util.UUID; + +public class Utils { + public static String DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"; + public static RequestConfig REQUEST_CONFIG = RequestConfig.custom() + .setConnectionRequestTimeout(30000) + .setSocketTimeout(30000) // 服务端相应超时 + .setConnectTimeout(30000) // 建立socket链接超时时间 + .build(); + + public static CloseableHttpClient createSslHttpClient() { + try { + SSLContext sslContext = new SSLContextBuilder().loadTrustMaterial(null, new TrustStrategy() { + + @Override + public boolean isTrusted(X509Certificate[] chain, String authType) throws CertificateException { + return true; + } + }).build(); + HostnameVerifier hostnameVerifier = NoopHostnameVerifier.INSTANCE; + SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, hostnameVerifier); + return HttpClients.custom() + .setSSLSocketFactory(sslsf) + .build(); + } catch (Exception e) { + LogKit.error(e.getMessage(), e); + } + return HttpClients.createDefault(); + } + + public static CloseableHttpClient createDefaultHttpClient() { + CloseableHttpClient httpClient = HttpClients.custom() + .build(); + return httpClient; + } + + public static synchronized CloseableHttpClient createHttpClient(String url) { + CloseableHttpClient httpClient = null; + if (StringKit.isEmpty(url)) { + httpClient = createDefaultHttpClient(); + return httpClient; + } + + if (url.startsWith("https://")) { + httpClient = createSslHttpClient(); + return httpClient; + } + httpClient = createDefaultHttpClient(); + return httpClient; + } + + /** + * 获取响应内容 + * + * @param response + * @return + * @throws IOException + */ + public static String getResponseBodyContent(CloseableHttpResponse response) throws IOException { + if (response == null) { + return ""; + } + HttpEntity httpEntity = response.getEntity(); + if (httpEntity == null) { + return ""; + } + String content = EntityUtils.toString(httpEntity, "UTF-8"); + return content; + } + + public static synchronized String createHttpGetContent(CloseableHttpClient httpClient, String url, String basicAuth, String contentType) throws IOException { + if ((httpClient == null) || (StringKit.isEmpty(url))) { + return ""; + } + + LogKit.info("http请求链接:" + url); + HttpGet httpGet = new HttpGet(url); + httpGet.addHeader("User-Agent", Utils.DEFAULT_USER_AGENT); + if (StringKit.isNotEmpty(basicAuth)) { + httpGet.addHeader("Authorization", basicAuth); + } + if (StringKit.isNotEmpty(contentType)) { + httpGet.addHeader("Content-Type", contentType); + } + + httpGet.setConfig(Utils.REQUEST_CONFIG); + CloseableHttpResponse response = httpClient.execute(httpGet); + int statusCode = response.getStatusLine().getStatusCode(); + String responseContent = getResponseBodyContent(response); + LogKit.info("http响应内容:\n" + responseContent); + if (statusCode != HttpStatus.SC_OK) { + response.close(); + LogKit.error("http请求出错,http status:" + statusCode); + return ""; + } + response.close(); + if (StringKit.isEmpty(responseContent)) { + LogKit.error("http请求出错,http响应内容为空"); + return ""; + } + return responseContent; + } + + public static String createHttpPostContent(CloseableHttpClient httpClient, String url, String bodyContent, String basicAuth, String contentType) throws IOException { + return createHttpPostContent(httpClient, url, bodyContent, null, basicAuth, contentType); + } + + public static String createHttpPostContent(CloseableHttpClient httpClient, String url, MultipartEntityBuilder multipartEntityBuilder, String basicAuth, String contentType) throws IOException { + return createHttpPostContent(httpClient, url, "", multipartEntityBuilder, basicAuth, contentType); + } + + public static synchronized String createHttpPostContent(CloseableHttpClient httpClient, String url, String bodyContent, MultipartEntityBuilder multipartEntityBuilder, String basicAuth, String contentType) throws IOException { + if ((httpClient == null) || (StringKit.isEmpty(url))) { + return ""; + } + + LogKit.info("http请求链接:" + url); + HttpPost httpPost = new HttpPost(url); + httpPost.addHeader("User-Agent", Utils.DEFAULT_USER_AGENT); + httpPost.setConfig(Utils.REQUEST_CONFIG); + if (StringKit.isNotEmpty(basicAuth)) { + httpPost.addHeader("Authorization", basicAuth); + } + if (StringKit.isNotEmpty(contentType)) { + httpPost.addHeader("Content-Type", contentType); + } + if (StringKit.isNotEmpty(bodyContent)) { + LogKit.info("http请求内容:\n" + bodyContent); + StringEntity bodyEntity = new StringEntity(bodyContent, "UTF-8"); + httpPost.setEntity(bodyEntity); + } + + if (multipartEntityBuilder != null) { + httpPost.setEntity(multipartEntityBuilder.build()); + } + + CloseableHttpResponse response = httpClient.execute(httpPost); + String responseContent = getResponseBodyContent(response); + LogKit.info("http响应内容:\n" + responseContent); + int statusCode = response.getStatusLine().getStatusCode(); + if (statusCode != HttpStatus.SC_OK) { + response.close(); + LogKit.error("http请求出错,http status:" + statusCode); + return ""; + } + response.close(); + if (StringKit.isEmpty(responseContent)) { + LogKit.error("http请求出错,http响应内容为空"); + return ""; + } + return responseContent; + } + + + public static String createHttpGetContent(CloseableHttpClient httpClient, String url, String contentType) throws IOException { + return createHttpGetContent(httpClient, url, "", contentType); + } + + public static String createHttpGetContentWithHttpClient(String url, String basicAuth, String contentType) throws IOException { + CloseableHttpClient httpClient = Utils.createHttpClient(url); + String content = createHttpGetContent(httpClient, url, basicAuth, contentType); + httpClient.close(); + return content; + } + + public static String createHttpGetContentWithHttpClient(String url) throws IOException { + return createHttpGetContentWithHttpClient(url, "", ""); + } + + public static String createHttpPostContentWithHttpClient(String url, String bodyContent, String contentType) throws IOException { + return createHttpPostContentWithHttpClient(url, bodyContent, "", contentType); + } + + public static String createHttpPostContentWithHttpClient(String url, String bodyContent, String basicAuth, String contentType) throws IOException { + CloseableHttpClient httpClient = Utils.createHttpClient(url); + String content = createHttpPostContent(httpClient, url, bodyContent, basicAuth, contentType); + httpClient.close(); + return content; + } + + + public static String createHttpPostContentWithHttpClient(String url, MultipartEntityBuilder multipartEntityBuilder, String contentType) throws IOException { + return createHttpPostContentWithHttpClient(url, multipartEntityBuilder, "", contentType); + } + + public static String createHttpPostContentWithHttpClient(String url, MultipartEntityBuilder multipartEntityBuilder, String basicAuth, String contentType) throws IOException { + CloseableHttpClient httpClient = Utils.createHttpClient(url); + String content = createHttpPostContent(httpClient, url, multipartEntityBuilder, basicAuth, contentType); + httpClient.close(); + return content; + } + + public static synchronized String createHttpPostContent(CloseableHttpClient httpClient, String url, String bodyContent, String contentType) throws IOException { + return createHttpPostContent(httpClient, url, bodyContent, "", contentType); + } + + + public static String getRequestUrl(HttpServletRequest req) { + if (req == null) { + return ""; + } + String url = req.getRequestURL().toString(); + return url; + } + + /** + * 获取完整请求链接 + * + * @param req 请求 + * @return + */ + public static String getFullRequestUrl(HttpServletRequest req) { + if (req == null) { + return ""; + } + String url = req.getRequestURL().toString(); + String queryUrl = req.getQueryString(); + if ((queryUrl == null) || "null".equalsIgnoreCase(queryUrl)) { + queryUrl = ""; + } else { + queryUrl = "?" + queryUrl; + } + String fullUrl = url + queryUrl; + return fullUrl; + } + + + public static boolean isDecisionLoginRequest(HttpServletRequest req) { + if (req == null) { + return false; + } + if (!"GET".equalsIgnoreCase(req.getMethod())) { + return false; + } + String url = req.getRequestURL().toString(); + if (url.endsWith("/decision/login") || url.endsWith("/decision/login/")) { + return true; + } + return false; + } + + /** + * 重定向 + * + * @param res + * @param url + */ + public static void sendRedirect(HttpServletResponse res, String url) { + if ((res == null) || (StringKit.isEmpty(url))) { + return; + } + res.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); + res.setHeader("Location", url); + } + + + public static synchronized String getUuid() { + String uuid = UUID.randomUUID().toString().replace("-", ""); + return uuid; + } + + + /** + * 通过用户名删除用户,管理员用户无法删除 + * + * @param username 用户名 + * @return + * @throws Exception + */ + public static int deleteUsersByUsername(String username) throws Exception { + if (StringUtils.isEmpty(username)) { + return 0; + } + User user = UserService.getInstance().getUserByUserName(username); + if (user == null) { + return 0; + } + String userId = user.getId(); + List adminUserIds = UserService.getInstance().getAdminUserIdList(); + if ((adminUserIds != null) && (adminUserIds.size() >= 1) && (adminUserIds.contains(userId))) { + return 0; + } + UserUpdateBean userUpdateBean = new UserUpdateBean(); + userUpdateBean.setRemoveUserIds(new String[]{userId}); + return UserService.getInstance().deleteUsers(userUpdateBean); + } + + public static int deleteUsersByUsernames(List usernames) throws Exception { + if ((usernames == null) || (usernames.size() <= 0)) { + return 0; + } + String username; + int totalCount = 0, count; + for (int i = 0, max = usernames.size() - 1; i <= max; i++) { + username = usernames.get(i); + count = deleteUsersByUsername(username); + totalCount = totalCount + count; + } + return totalCount; + } + + public static void editRealNameByUsername(String username, String realName) throws Exception { + if (StringUtils.isEmpty(username) || StringUtils.isEmpty(realName)) { + return; + } + User user = UserService.getInstance().getUserByUserName(username); + if (user == null) { + return; + } + UserBean userBean = new UserBean(user.getEmail(), user.isEnable(), user.getMobile(), realName, user.getUserName(), user.getId()); + UserService.getInstance().editAccount(username, userBean); + } + + public static JSONObject getSuccessResultJson() { + return getResultJson("success", ""); + } + + public static JSONObject getFailuresResultJson() { + return getResultJson("failure", ""); + } + + public static JSONObject getFailuresResultJson(String msg) { + return getResultJson("failure", msg); + } + + public static JSONObject getResultJson(String status, String msg) { + JSONObject json = new JSONObject(); + json.put("status", status); + json.put("msg", msg); + return json; + } + + public static String encodeUrlWithUtf8(String value) { + if ((value == null) || (value.length() <= 0)) { + return ""; + } + /*String path = "/" + value; + URI uri = new URI("http", "a", path, null); + String tempValue = uri.toASCIIString(); + String encodedValue = tempValue.substring(9);*/ + String tempValue = ""; + try { + tempValue = UriUtils.encodeQueryParam(value, "UTF-8"); + return tempValue; + } catch (Exception e) { + LogKit.error("Utils.encodeUrlWithUtf8:" + e.getMessage(), e); + tempValue = value; + } + return tempValue; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/app/config/AppConfigAccessBridge.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/app/config/AppConfigAccessBridge.java new file mode 100644 index 0000000..c3a1dac --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/app/config/AppConfigAccessBridge.java @@ -0,0 +1,40 @@ +package com.fr.plugin.third.party.jsdjjed.app.config; + +import com.fr.db.fun.impl.AbstractDBAccessProvider; +import com.fr.stable.db.accessor.DBAccessor; +import com.fr.stable.db.dao.BaseDAO; +import com.fr.stable.db.dao.DAOProvider; +import com.fr.stable.fun.Authorize; + + +@Authorize(callSignKey = "com.fr.plugin.third.party.jsdjjed") +public class AppConfigAccessBridge extends AbstractDBAccessProvider { + + private static DBAccessor dbAccessor = null; + + public static DBAccessor getDbAccessor() { + return dbAccessor; + } + + @Override + public DAOProvider[] registerDAO() { + return new DAOProvider[]{ + new DAOProvider() { + @Override + public Class getEntityClass() { + return AppConfigEntity.class; + } + + @Override + public Class getDAOClass() { + return AppConfigDao.class; + } + } + }; + } + + @Override + public void onDBAvailable(DBAccessor dbAccessor) { + AppConfigAccessBridge.dbAccessor = dbAccessor; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/app/config/AppConfigDao.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/app/config/AppConfigDao.java new file mode 100644 index 0000000..1cb7f16 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/app/config/AppConfigDao.java @@ -0,0 +1,16 @@ +package com.fr.plugin.third.party.jsdjjed.app.config; + +import com.fr.stable.db.dao.BaseDAO; +import com.fr.stable.db.session.DAOSession; + +public class AppConfigDao extends BaseDAO { + + public AppConfigDao(DAOSession daoSession) { + super(daoSession); + } + + @Override + protected Class getEntityClass() { + return AppConfigEntity.class; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/app/config/AppConfigData.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/app/config/AppConfigData.java new file mode 100644 index 0000000..796a716 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/app/config/AppConfigData.java @@ -0,0 +1,138 @@ +package com.fr.plugin.third.party.jsdjjed.app.config; + +import com.fanruan.api.query.QueryConditionKit; +import com.fanruan.api.query.RestrictionKit; +import com.fanruan.api.util.StringKit; +import com.fr.stable.db.action.DBAction; +import com.fr.stable.db.dao.DAOContext; +import com.fr.third.org.apache.commons.collections4.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +public class AppConfigData { + public static synchronized List queryAllAppConfigData() throws Exception { + List entities = AppConfigAccessBridge.getDbAccessor().runQueryAction(new DBAction>() { + @Override + public List run(DAOContext daoContext) throws Exception { + return daoContext.getDAO(AppConfigDao.class).find(QueryConditionKit.newQueryCondition()); + } + }); + if (CollectionUtils.isEmpty(entities)) { + return new ArrayList<>(); + } + return entities; + } + + public static synchronized AppConfigEntity queryAppConfigDataWithId(String id) throws Exception { + AppConfigEntity entity = AppConfigAccessBridge.getDbAccessor().runQueryAction(new DBAction() { + @Override + public AppConfigEntity run(DAOContext daoContext) throws Exception { + return daoContext.getDAO(AppConfigDao.class).getById(id); + } + }); + return entity; + } + + public static synchronized List queryAppConfigDataWithConfigId(String configId) throws Exception { + List entities = AppConfigAccessBridge.getDbAccessor().runQueryAction(new DBAction>() { + @Override + public List run(DAOContext daoContext) throws Exception { + return daoContext.getDAO(AppConfigDao.class).find(QueryConditionKit.newQueryCondition().addRestriction(RestrictionKit.eq("configId", configId))); + } + }); + return entities; + } + + public static synchronized AppConfigEntity queryAppConfigDataWithLogin() throws Exception { + List entities = queryAppConfigDatasWithLogin(); + if (CollectionUtils.isEmpty(entities)) { + return null; + } + return entities.get(0); + } + + public static synchronized List queryAppConfigDatasWithLogin() throws Exception { + List entities = AppConfigAccessBridge.getDbAccessor().runQueryAction(new DBAction>() { + @Override + public List run(DAOContext daoContext) throws Exception { + return daoContext.getDAO(AppConfigDao.class).find(QueryConditionKit.newQueryCondition().addRestriction(RestrictionKit.eq("login", 1))); + } + }); + return entities; + } + + + public static AppConfigEntity queryAppConfigDataWithConfigIdAndOnlyOne(String id) throws Exception { + List entities = queryAppConfigDataWithConfigId(id); + if (CollectionUtils.isEmpty(entities)) { + return null; + } + AppConfigEntity entity = entities.get(0); + return entity; + } + + public static boolean isAppConfigDataExistsWithConfigId(String configId) throws Exception { + return isAppConfigDataExistsWithConfigId(configId,""); + } + + + public static boolean isAppConfigDataExistsWithConfigId(String configId, String id) throws Exception { + AppConfigEntity entity = queryAppConfigDataWithConfigIdAndOnlyOne(configId); + if (entity == null) { + return false; + } + if (StringKit.isNotEmpty(id) && StringKit.equals(id, entity.getId())) { + return false; + } + return true; + } + + + public static synchronized AppConfigEntity addAppConfigData(AppConfigEntity appConfigEntity) throws Exception { + AppConfigEntity resultEntity = AppConfigAccessBridge.getDbAccessor().runDMLAction(new DBAction() { + @Override + public AppConfigEntity run(DAOContext daoContext) throws Exception { + AppConfigEntity entity = appConfigEntity; + entity.setId(UUID.randomUUID().toString()); + daoContext.getDAO(AppConfigDao.class).add(entity); + return entity; + } + }); + return resultEntity; + } + + public static synchronized void updateAppConfigData(AppConfigEntity appConfigEntity) throws Exception { + AppConfigAccessBridge.getDbAccessor().runDMLAction(new DBAction() { + @Override + public Boolean run(DAOContext daoContext) throws Exception { + daoContext.getDAO(AppConfigDao.class).update(appConfigEntity); + return true; + } + }); + } + + public static synchronized AppConfigEntity deleteAppConfigDataWithId(String id) throws Exception { + AppConfigEntity appConfigEntity = queryAppConfigDataWithId(id); + if (appConfigEntity == null) { + return null; + } + AppConfigEntity resultEntity = AppConfigAccessBridge.getDbAccessor().runDMLAction(new DBAction() { + @Override + public AppConfigEntity run(DAOContext daoContext) throws Exception { + daoContext.getDAO(AppConfigDao.class).remove(appConfigEntity.getId()); + return appConfigEntity; + } + }); + return resultEntity; + } + + public static synchronized AppConfigEntity deleteAppConfigDataWithConfigId(String configId) throws Exception { + AppConfigEntity appConfigEntity = queryAppConfigDataWithConfigIdAndOnlyOne(configId); + if (appConfigEntity == null) { + return null; + } + return deleteAppConfigDataWithId(appConfigEntity.getId()); + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/app/config/AppConfigEntity.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/app/config/AppConfigEntity.java new file mode 100644 index 0000000..4c62767 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/app/config/AppConfigEntity.java @@ -0,0 +1,87 @@ +package com.fr.plugin.third.party.jsdjjed.app.config; + +import com.fr.stable.AssistUtils; +import com.fr.stable.db.entity.BaseEntity; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.Table; + +@Entity +@Table(name = "jsdjjed_feishu_config") +public class AppConfigEntity extends BaseEntity { + @Column(name = "config_id") + private String configId; + + @Column(name = "notes") + private String notes; + + @Column(name = "app_id") + private String appId; + + @Column(name = "app_secret") + private String appSecret; + + @Column(name = "login_map") + private String loginMap; + + @Column(name = "login") + private int login; + + + public AppConfigEntity() { + + } + + public String getConfigId() { + return configId; + } + + public void setConfigId(String configId) { + this.configId = configId; + } + + public String getNotes() { + return notes; + } + + public void setNotes(String notes) { + this.notes = notes; + } + + public String getAppId() { + return appId; + } + + public void setAppId(String appId) { + this.appId = appId; + } + + public String getAppSecret() { + return appSecret; + } + + public void setAppSecret(String appSecret) { + this.appSecret = appSecret; + } + + public int getLogin() { + return login; + } + + public void setLogin(int login) { + this.login = login; + } + + public String getLoginMap() { + return loginMap; + } + + public void setLoginMap(String loginMap) { + this.loginMap = loginMap; + } + + @Override + public String toString() { + return AssistUtils.toString(this); + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/config/AppDataConfig.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/config/AppDataConfig.java new file mode 100644 index 0000000..8b2a5fb --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/config/AppDataConfig.java @@ -0,0 +1,498 @@ +package com.fr.plugin.third.party.jsdjjed.config; + +import com.fr.config.*; +import com.fr.config.holder.Conf; +import com.fr.config.holder.factory.Holders; + +import java.util.HashMap; +import java.util.Map; + + +public class AppDataConfig extends DefaultConfiguration { + public String getNameSpace() { + return this.getClass().getName(); + } + + private static volatile AppDataConfig config = null; + + public static AppDataConfig getInstance() { + if (config == null) { + config = ConfigContext.getConfigInstance(AppDataConfig.class); + } + return config; + } + + + private static volatile Map URL_MAP = new HashMap<>(); + + public synchronized static void addMapUrl(String key, String url) { + URL_MAP.put(key, url); + } + + public synchronized static String getMapUrl(String key) { + if (!URL_MAP.containsKey(key)) { + return ""; + } + String url = URL_MAP.get(key); + URL_MAP.remove(key); + return url; + } + + private Conf frUrl = Holders.simple(""); + private Conf accessTokenUrl = Holders.simple("https://xxx/open-apis/auth/v3/app_access_token/internal"); + private Conf codeUserUrl = Holders.simple("https://xxx/open-apis/authen/v1/access_token"); + private Conf chatGroupsUrl = Holders.simple("https://xxx/open-apis/im/v1/chats"); + private Conf usersUrl = Holders.simple("https://xxx/open-apis/user/v1/batch_get_id"); + private Conf sendMessageUrl = Holders.simple("https://xxx/open-apis/im/v1/messages"); + private Conf sendBatchMessageUrl = Holders.simple("https://xxx/open-apis/message/v4/batch_send"); + private Conf uploadImageUrl = Holders.simple("https://xxx/open-apis/im/v1/images"); + private Conf uploadFileUrl = Holders.simple("https://xxx/open-apis/im/v1/files"); + private Conf authorizeUrl = Holders.simple("https://xxx/open-apis/authen/v1/index"); + + private Conf accessTokenUrlEscbOption = Holders.simple(true); + private Conf codeUserUrlEscbOption = Holders.simple(true); + private Conf chatGroupsUrlEscbOption = Holders.simple(true); + private Conf usersUrlEscbOption = Holders.simple(true); + private Conf sendMessageUrlEscbOption = Holders.simple(true); + private Conf sendBatchMessageUrlEscbOption = Holders.simple(true); + private Conf uploadImageUrlEscbOption = Holders.simple(false); + private Conf uploadFileUrlEscbOption = Holders.simple(false); + private Conf authorizeUrlEscbOption = Holders.simple(false); + + private Conf accessTokenUrlEscbCode = Holders.simple("xxx.app.app_access_token"); + private Conf codeUserUrlEscbCode = Holders.simple("xxx.app.get_user_accessToken"); + private Conf chatGroupsUrlEscbCode = Holders.simple("xxx.app.get_chat_v4_list"); + private Conf usersUrlEscbCode = Holders.simple("xxx.app.lark_batch_get_id"); + private Conf sendMessageUrlEscbCode = Holders.simple("xxx.app.feishu_send_message"); + private Conf sendBatchMessageUrlEscbCode = Holders.simple("xxx.app.feishu_batch_send"); + private Conf uploadImageUrlEscbCode = Holders.simple(""); + private Conf uploadFileUrlEscbCode = Holders.simple(""); + private Conf authorizeUrlEscbCode = Holders.simple(""); + + private Conf accessTokenUrlEscbVersion = Holders.simple("1.0"); + private Conf codeUserUrlEscbVersion = Holders.simple("1.0"); + private Conf chatGroupsUrlEscbVersion = Holders.simple("1.0"); + private Conf usersUrlEscbVersion = Holders.simple("1.0"); + private Conf sendMessageUrlEscbVersion = Holders.simple("2.0"); + private Conf sendBatchMessageUrlEscbVersion = Holders.simple("1.0"); + private Conf uploadImageUrlEscbVersion = Holders.simple(""); + private Conf uploadFileUrlEscbVersion = Holders.simple(""); + private Conf authorizeUrlEscbVersion = Holders.simple(""); + + private Conf escbUrl = Holders.simple("http://xxxxxx/ecsb/gw/cls/rf"); + private Conf escbAppCode = Holders.simple("xx"); + private Conf escbAppToken = Holders.simple("xxx"); + private Conf escbOrgCode = Holders.simple("xxx"); + private Conf escbSysCode = Holders.simple("xxx"); + + + + @Identifier(value = "loginTypeNameParameter", name = "登录类型参数名称", description = "", status = Status.HIDE) + private Conf loginTypeNameParameter = Holders.simple("loginType"); + + @Identifier(value = "loginTypeValue", name = "登录类型值", description = "", status = Status.HIDE) + private Conf loginTypeValue = Holders.simple("oauth"); + + public String getLoginTypeNameParameter() { + return loginTypeNameParameter.get(); + } + + public void setLoginTypeNameParameter(String loginTypeNameParameter) { + this.loginTypeNameParameter.set(loginTypeNameParameter); + } + + public String getLoginTypeValue() { + return loginTypeValue.get(); + } + + public void setLoginTypeValue(String loginTypeValue) { + this.loginTypeValue.set(loginTypeValue); + } + + public String getFrUrl() { + return frUrl.get(); + } + + public void setFrUrl(String frUrl) { + this.frUrl.set(frUrl); + } + + public String getAccessTokenUrl() { + return accessTokenUrl.get(); + } + + public void setAccessTokenUrl(String accessTokenUrl) { + this.accessTokenUrl.set(accessTokenUrl); + } + + public String getCodeUserUrl() { + return codeUserUrl.get(); + } + + public void setCodeUserUrl(String codeUserUrl) { + this.codeUserUrl.set(codeUserUrl); + } + + public String getChatGroupsUrl() { + return chatGroupsUrl.get(); + } + + public void setChatGroupsUrl(String chatGroupsUrl) { + this.chatGroupsUrl.set(chatGroupsUrl); + } + + public String getUsersUrl() { + return usersUrl.get(); + } + + public void setUsersUrl(String usersUrl) { + this.usersUrl.set(usersUrl); + } + + public String getSendMessageUrl() { + return sendMessageUrl.get(); + } + + public void setSendMessageUrl(String sendMessageUrl) { + this.sendMessageUrl.set(sendMessageUrl); + } + + public String getSendBatchMessageUrl() { + return sendBatchMessageUrl.get(); + } + + public void setSendBatchMessageUrl(String sendBatchMessageUrl) { + this.sendBatchMessageUrl.set(sendBatchMessageUrl); + } + + public String getUploadImageUrl() { + return uploadImageUrl.get(); + } + + public void setUploadImageUrl(String uploadImageUrl) { + this.uploadImageUrl.set(uploadImageUrl); + } + + public String getUploadFileUrl() { + return uploadFileUrl.get(); + } + + public void setUploadFileUrl(String uploadFileUrl) { + this.uploadFileUrl.set(uploadFileUrl); + } + + public String getAuthorizeUrl() { + return authorizeUrl.get(); + } + + public void setAuthorizeUrl(String authorizeUrl) { + this.authorizeUrl.set(authorizeUrl); + } + + public Boolean isAccessTokenUrlEscbOption() { + return accessTokenUrlEscbOption.get(); + } + + public void setAccessTokenUrlEscbOption(Boolean accessTokenUrlEscbOption) { + this.accessTokenUrlEscbOption.set(accessTokenUrlEscbOption); + } + + public Boolean isCodeUserUrlEscbOption() { + return codeUserUrlEscbOption.get(); + } + + public void setCodeUserUrlEscbOption(Boolean codeUserUrlEscbOption) { + this.codeUserUrlEscbOption.set(codeUserUrlEscbOption); + } + + public Boolean isChatGroupsUrlEscbOption() { + return chatGroupsUrlEscbOption.get(); + } + + public void setChatGroupsUrlEscbOption(Boolean chatGroupsUrlEscbOption) { + this.chatGroupsUrlEscbOption.set(chatGroupsUrlEscbOption); + } + + public Boolean isUsersUrlEscbOption() { + return usersUrlEscbOption.get(); + } + + public void setUsersUrlEscbOption(Boolean usersUrlEscbOption) { + this.usersUrlEscbOption.set(usersUrlEscbOption); + } + + public Boolean isSendMessageUrlEscbOption() { + return sendMessageUrlEscbOption.get(); + } + + public void setSendMessageUrlEscbOption(Boolean sendMessageUrlEscbOption) { + this.sendMessageUrlEscbOption.set(sendMessageUrlEscbOption); + } + + public Boolean isSendBatchMessageUrlEscbOption() { + return sendBatchMessageUrlEscbOption.get(); + } + + public void setSendBatchMessageUrlEscbOption(Boolean sendBatchMessageUrlEscbOption) { + this.sendBatchMessageUrlEscbOption.set(sendBatchMessageUrlEscbOption); + } + + public Boolean isUploadImageUrlEscbOption() { + return uploadImageUrlEscbOption.get(); + } + + public void setUploadImageUrlEscbOption(Boolean uploadImageUrlEscbOption) { + this.uploadImageUrlEscbOption.set(uploadImageUrlEscbOption); + } + + public Boolean isUploadFileUrlEscbOption() { + return uploadFileUrlEscbOption.get(); + } + + public void setUploadFileUrlEscbOption(Boolean uploadFileUrlEscbOption) { + this.uploadFileUrlEscbOption.set(uploadFileUrlEscbOption); + } + + public Boolean isAuthorizeUrlEscbOption() { + return authorizeUrlEscbOption.get(); + } + + public void setAuthorizeUrlEscbOption(Boolean authorizeUrlEscbOption) { + this.authorizeUrlEscbOption.set(authorizeUrlEscbOption); + } + + public String getAccessTokenUrlEscbCode() { + return accessTokenUrlEscbCode.get(); + } + + public void setAccessTokenUrlEscbCode(String accessTokenUrlEscbCode) { + this.accessTokenUrlEscbCode.set(accessTokenUrlEscbCode); + } + + public String getCodeUserUrlEscbCode() { + return codeUserUrlEscbCode.get(); + } + + public void setCodeUserUrlEscbCode(String codeUserUrlEscbCode) { + this.codeUserUrlEscbCode.set(codeUserUrlEscbCode); + } + + public String getChatGroupsUrlEscbCode() { + return chatGroupsUrlEscbCode.get(); + } + + public void setChatGroupsUrlEscbCode(String chatGroupsUrlEscbCode) { + this.chatGroupsUrlEscbCode.set(chatGroupsUrlEscbCode); + } + + public String getUsersUrlEscbCode() { + return usersUrlEscbCode.get(); + } + + public void setUsersUrlEscbCode(String usersUrlEscbCode) { + this.usersUrlEscbCode.set(usersUrlEscbCode); + } + + public String getSendMessageUrlEscbCode() { + return sendMessageUrlEscbCode.get(); + } + + public void setSendMessageUrlEscbCode(String sendMessageUrlEscbCode) { + this.sendMessageUrlEscbCode.set(sendMessageUrlEscbCode); + } + + public String getSendBatchMessageUrlEscbCode() { + return sendBatchMessageUrlEscbCode.get(); + } + + public void setSendBatchMessageUrlEscbCode(String sendBatchMessageUrlEscbCode) { + this.sendBatchMessageUrlEscbCode.set(sendBatchMessageUrlEscbCode); + } + + public String getUploadImageUrlEscbCode() { + return uploadImageUrlEscbCode.get(); + } + + public void setUploadImageUrlEscbCode(String uploadImageUrlEscbCode) { + this.uploadImageUrlEscbCode.set(uploadImageUrlEscbCode); + } + + public String getUploadFileUrlEscbCode() { + return uploadFileUrlEscbCode.get(); + } + + public void setUploadFileUrlEscbCode(String uploadFileUrlEscbCode) { + this.uploadFileUrlEscbCode.set(uploadFileUrlEscbCode); + } + + public String getAuthorizeUrlEscbCode() { + return authorizeUrlEscbCode.get(); + } + + public void setAuthorizeUrlEscbCode(String authorizeUrlEscbCode) { + this.authorizeUrlEscbCode.set(authorizeUrlEscbCode); + } + + public String getAccessTokenUrlEscbVersion() { + return accessTokenUrlEscbVersion.get(); + } + + public void setAccessTokenUrlEscbVersion(String accessTokenUrlEscbVersion) { + this.accessTokenUrlEscbVersion.set(accessTokenUrlEscbVersion); + } + + public String getCodeUserUrlEscbVersion() { + return codeUserUrlEscbVersion.get(); + } + + public void setCodeUserUrlEscbVersion(String codeUserUrlEscbVersion) { + this.codeUserUrlEscbVersion.set(codeUserUrlEscbVersion); + } + + public String getChatGroupsUrlEscbVersion() { + return chatGroupsUrlEscbVersion.get(); + } + + public void setChatGroupsUrlEscbVersion(String chatGroupsUrlEscbVersion) { + this.chatGroupsUrlEscbVersion.set(chatGroupsUrlEscbVersion); + } + + public String getUsersUrlEscbVersion() { + return usersUrlEscbVersion.get(); + } + + public void setUsersUrlEscbVersion(String usersUrlEscbVersion) { + this.usersUrlEscbVersion.set(usersUrlEscbVersion); + } + + public String getSendMessageUrlEscbVersion() { + return sendMessageUrlEscbVersion.get(); + } + + public void setSendMessageUrlEscbVersion(String sendMessageUrlEscbVersion) { + this.sendMessageUrlEscbVersion.set(sendMessageUrlEscbVersion); + } + + public String getSendBatchMessageUrlEscbVersion() { + return sendBatchMessageUrlEscbVersion.get(); + } + + public void setSendBatchMessageUrlEscbVersion(String sendBatchMessageUrlEscbVersion) { + this.sendBatchMessageUrlEscbVersion.set(sendBatchMessageUrlEscbVersion); + } + + public String getUploadImageUrlEscbVersion() { + return uploadImageUrlEscbVersion.get(); + } + + public void setUploadImageUrlEscbVersion(String uploadImageUrlEscbVersion) { + this.uploadImageUrlEscbVersion.set(uploadImageUrlEscbVersion); + } + + public String getUploadFileUrlEscbVersion() { + return uploadFileUrlEscbVersion.get(); + } + + public void setUploadFileUrlEscbVersion(String uploadFileUrlEscbVersion) { + this.uploadFileUrlEscbVersion.set(uploadFileUrlEscbVersion); + } + + public String getAuthorizeUrlEscbVersion() { + return authorizeUrlEscbVersion.get(); + } + + public void setAuthorizeUrlEscbVersion(String authorizeUrlEscbVersion) { + this.authorizeUrlEscbVersion.set(authorizeUrlEscbVersion); + } + + public String getEscbUrl() { + return escbUrl.get(); + } + + public void setEscbUrl(String escbUrl) { + this.escbUrl.set(escbUrl); + } + + public String getEscbAppCode() { + return escbAppCode.get(); + } + + public void setEscbAppCode(String escbAppCode) { + this.escbAppCode.set(escbAppCode); + } + + public String getEscbAppToken() { + return escbAppToken.get(); + } + + public void setEscbAppToken(String escbAppToken) { + this.escbAppToken.set(escbAppToken); + } + + public String getEscbOrgCode() { + return escbOrgCode.get(); + } + + public void setEscbOrgCode(String escbOrgCode) { + this.escbOrgCode.set(escbOrgCode); + } + + public String getEscbSysCode() { + return escbSysCode.get(); + } + + public void setEscbSysCode(String escbSysCode) { + this.escbSysCode.set(escbSysCode); + } + + @Override + public Object clone() throws CloneNotSupportedException { + AppDataConfig cloned = (AppDataConfig) super.clone(); + cloned.loginTypeNameParameter = (Conf) loginTypeNameParameter.clone(); + cloned.loginTypeValue = (Conf) loginTypeValue.clone(); + cloned.accessTokenUrl = (Conf) accessTokenUrl.clone(); + cloned.frUrl = (Conf) frUrl.clone(); + cloned.codeUserUrl = (Conf) codeUserUrl.clone(); + cloned.chatGroupsUrl = (Conf) chatGroupsUrl.clone(); + cloned.sendMessageUrl = (Conf) sendMessageUrl.clone(); + cloned.uploadImageUrl = (Conf) uploadImageUrl.clone(); + cloned.uploadFileUrl = (Conf) uploadFileUrl.clone(); + cloned.usersUrl = (Conf) usersUrl.clone(); + cloned.sendBatchMessageUrl = (Conf) sendBatchMessageUrl.clone(); + cloned.authorizeUrl = (Conf) authorizeUrl.clone(); + + cloned.accessTokenUrlEscbOption = (Conf) accessTokenUrlEscbOption.clone(); + cloned.codeUserUrlEscbOption = (Conf) codeUserUrlEscbOption.clone(); + cloned.chatGroupsUrlEscbOption = (Conf) chatGroupsUrlEscbOption.clone(); + cloned.usersUrlEscbOption = (Conf) usersUrlEscbOption.clone(); + cloned.sendMessageUrlEscbOption = (Conf) sendMessageUrlEscbOption.clone(); + cloned.sendBatchMessageUrlEscbOption = (Conf) sendBatchMessageUrlEscbOption.clone(); + cloned.uploadImageUrlEscbOption = (Conf) uploadImageUrlEscbOption.clone(); + cloned.uploadFileUrlEscbOption = (Conf) uploadFileUrlEscbOption.clone(); + cloned.authorizeUrlEscbOption = (Conf) authorizeUrlEscbOption.clone(); + cloned.accessTokenUrlEscbCode = (Conf) accessTokenUrlEscbCode.clone(); + cloned.codeUserUrlEscbCode = (Conf) codeUserUrlEscbCode.clone(); + cloned.chatGroupsUrlEscbCode = (Conf) chatGroupsUrlEscbCode.clone(); + cloned.usersUrlEscbCode = (Conf) usersUrlEscbCode.clone(); + cloned.sendMessageUrlEscbCode = (Conf) sendMessageUrlEscbCode.clone(); + cloned.sendBatchMessageUrlEscbCode = (Conf) sendBatchMessageUrlEscbCode.clone(); + cloned.uploadImageUrlEscbCode = (Conf) uploadImageUrlEscbCode.clone(); + cloned.uploadFileUrlEscbCode = (Conf) uploadFileUrlEscbCode.clone(); + cloned.authorizeUrlEscbCode = (Conf) authorizeUrlEscbCode.clone(); + cloned.accessTokenUrlEscbVersion = (Conf) accessTokenUrlEscbVersion.clone(); + cloned.codeUserUrlEscbVersion = (Conf) codeUserUrlEscbVersion.clone(); + cloned.chatGroupsUrlEscbVersion = (Conf) chatGroupsUrlEscbVersion.clone(); + cloned.usersUrlEscbVersion = (Conf) usersUrlEscbVersion.clone(); + cloned.sendMessageUrlEscbVersion = (Conf) sendMessageUrlEscbVersion.clone(); + cloned.sendBatchMessageUrlEscbVersion = (Conf) sendBatchMessageUrlEscbVersion.clone(); + cloned.uploadImageUrlEscbVersion = (Conf) uploadImageUrlEscbVersion.clone(); + cloned.uploadFileUrlEscbVersion = (Conf) uploadFileUrlEscbVersion.clone(); + cloned.authorizeUrlEscbVersion = (Conf) authorizeUrlEscbVersion.clone(); + cloned.escbUrl = (Conf) escbUrl.clone(); + cloned.escbAppCode = (Conf) escbAppCode.clone(); + cloned.escbAppToken = (Conf) escbAppToken.clone(); + cloned.escbOrgCode = (Conf) escbOrgCode.clone(); + cloned.escbSysCode = (Conf) escbSysCode.clone(); + return cloned; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/feishu/FeishuApp.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/feishu/FeishuApp.java new file mode 100644 index 0000000..5bfe236 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/feishu/FeishuApp.java @@ -0,0 +1,687 @@ +package com.fr.plugin.third.party.jsdjjed.feishu; + +import com.fanruan.api.log.LogKit; +import com.fanruan.api.util.StringKit; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.third.party.jsdjjed.Utils; +import com.fr.plugin.third.party.jsdjjed.config.AppDataConfig; +import com.fr.third.org.apache.commons.collections4.CollectionUtils; +import com.fr.third.org.apache.commons.lang3.time.DateFormatUtils; +import com.fr.third.org.apache.http.entity.ContentType; +import com.fr.third.org.apache.http.entity.mime.HttpMultipartMode; +import com.fr.third.org.apache.http.entity.mime.MultipartEntityBuilder; +import com.fr.third.org.apache.http.entity.mime.content.FileBody; +import com.fr.third.org.apache.http.entity.mime.content.InputStreamBody; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.charset.Charset; +import java.util.*; + +public class FeishuApp { + + + /** + * 获取消息类型 + * + * @param type + * @return + */ + public static String getMsgType(String type) { + if ("post".equalsIgnoreCase(type)) { + return "post"; + } + return "text"; + } + + public static String getMsgTypeNotes(String type) { + if ("post".equalsIgnoreCase(type)) { + return "富文本"; + } + return "文本"; + } + + + + /** + * 获取发送类型 + * + * @param type + * @return + */ + public static String getSendType(String type) { + if ("file".equalsIgnoreCase(type)) { + return "file"; + } + if ("message_file".equalsIgnoreCase(type)) { + return "message_file"; + } + return "message"; + } + + public static String getSendTypeNotes(String type) { + if ("file".equalsIgnoreCase(type)) { + return "文件"; + } + if ("message_file".equalsIgnoreCase(type)) { + return "消息与文件"; + } + return "消息"; + } + + public static boolean isSendMessage(String type) { + if ("message".equalsIgnoreCase(type)) { + return true; + } + if ("message_file".equalsIgnoreCase(type)) { + return true; + } + return false; + } + + + public static boolean isSendFile(String type) { + if ("file".equalsIgnoreCase(type)) { + return true; + } + if ("message_file".equalsIgnoreCase(type)) { + return true; + } + return false; + } + + + /** + * 获取 app_access_token(企业自建应用) + * + * @param appId + * @param appSecret + * @return + */ + public synchronized static String createAppAccessToken(String appId, String appSecret) throws IOException { + if (StringKit.isEmpty(appId) || StringKit.isEmpty(appSecret)) { + return ""; + } + + JSONObject bodyJson = new JSONObject(); + bodyJson.put("app_id", appId); + bodyJson.put("app_secret", appSecret); + + String url = "https://open.feishu.cn/open-apis/auth/v3/app_access_token/internal"; + String configUrl = AppDataConfig.getInstance().getAccessTokenUrl(); + url = getRealValue(url, configUrl); + url = getEscbUrl("accessTokenUrl", url); + String content = Utils.createHttpPostContentWithHttpClient(url, bodyJson.toString(), "application/json; charset=utf-8"); + if (StringKit.isEmpty(content)) { + return ""; + } + JSONObject contentJson = new JSONObject(content); + int code = contentJson.getInt("code"); + if (code != 0) { + return ""; + } + String token = contentJson.getString("app_access_token"); + return token; + } + + + /** + * 获取登录用户身份 + * + * @param codeValue + * @param accessToken + * @return + * @throws IOException + */ + public synchronized static FeishuLoginUserBean getLoginUserInfo(String codeValue, String accessToken) throws IOException { + if (StringKit.isEmpty(codeValue) || StringKit.isEmpty(accessToken)) { + return null; + } + + JSONObject bodyJson = new JSONObject(); + bodyJson.put("grant_type", "authorization_code"); + bodyJson.put("code", codeValue); + + String authorizationValue = "Bearer " + accessToken; + String url = "https://open.feishu.cn/open-apis/authen/v1/access_token"; + String configUrl = AppDataConfig.getInstance().getCodeUserUrl(); + url = getRealValue(url, configUrl); + String content = Utils.createHttpPostContentWithHttpClient(url, bodyJson.toString(), authorizationValue, "application/json; charset=utf-8"); + if (StringKit.isEmpty(content)) { + return null; + } + JSONObject contentJson = new JSONObject(content); + int code = contentJson.getInt("code"); + if (code != 0) { + return null; + } + JSONObject dataJson = contentJson.getJSONObject("data"); + FeishuLoginUserBean userBean = new FeishuLoginUserBean(); + userBean.setUserId(dataJson.getString("user_id", "")); + userBean.setName(dataJson.getString("name", "")); + userBean.setEnName(dataJson.getString("en_name", "")); + userBean.setMobile(dataJson.getString("mobile", "")); + return userBean; + } + + + /** + * 获取用户或机器人所在的群列表 + * + * @param accessToken + * @return + * @throws IOException + */ + public synchronized static List getChatGroups(String accessToken) throws IOException { + List chatGroups = new ArrayList<>(); + if (StringKit.isEmpty(accessToken)) { + return chatGroups; + } + + String authorizationValue = "Bearer " + accessToken; + String url = "https://open.feishu.cn/open-apis/im/v1/chats"; + String configUrl = AppDataConfig.getInstance().getChatGroupsUrl(); + url = getRealValue(url, configUrl) + "?page_size=100"; + url = getEscbUrl("chatGroupsUrl", url) + "&page_size=100"; + String content = Utils.createHttpGetContentWithHttpClient(url, authorizationValue, "application/json; charset=utf-8"); + if (StringKit.isEmpty(content)) { + return chatGroups; + } + JSONObject contentJson = new JSONObject(content); + int code = contentJson.getInt("code"); + if (code != 0) { + return chatGroups; + } + JSONObject dataJson = contentJson.getJSONObject("data"); + if (!contentJson.containsKey("data")) { + return chatGroups; + } + if (dataJson == null) { + return chatGroups; + } + + if ((!dataJson.containsKey("items")) && (!dataJson.containsKey("groups"))) { + return chatGroups; + } + + JSONArray itemJsons = null; + if (dataJson.containsKey("items")) { + itemJsons = dataJson.getJSONArray("items"); + } + if (dataJson.containsKey("groups")) { + itemJsons = dataJson.getJSONArray("groups"); + } + + if ((dataJson == null) || (itemJsons.size() <= 0)) { + return chatGroups; + } + + JSONObject itemJson; + FeishuChatGroupBean chatGroupBean; + for (int i = 0, max = itemJsons.size() - 1; i <= max; i++) { + itemJson = itemJsons.getJSONObject(i); + chatGroupBean = new FeishuChatGroupBean(); + chatGroupBean.setChatId(itemJson.getString("chat_id", "")); + chatGroupBean.setName(itemJson.getString("name", "")); + chatGroupBean.setDescription(itemJson.getString("description", "")); + chatGroupBean.setTenantKey(itemJson.getString("tenant_key", "")); + chatGroups.add(chatGroupBean); + } + return chatGroups; + } + + + /** + * 使用手机号或邮箱获取用户 ID + * + * @param emailSet + * @param mobileSet + * @param accessToken + * @return + * @throws IOException + */ + public synchronized static List getFeishuUserId(Set emailSet, Set mobileSet, String accessToken) throws IOException { + List feishuUserIds = new ArrayList<>(); + if (StringKit.isEmpty(accessToken)) { + return feishuUserIds; + } + + if (CollectionUtils.isEmpty(emailSet) && CollectionUtils.isEmpty(mobileSet)) { + return feishuUserIds; + } + String emailsContent = getUrlParams("emails", emailSet); + String mobilesContent = getUrlParams("mobiles", mobileSet); + + String authorizationValue = "Bearer " + accessToken; + String url = "https://open.feishu.cn/open-apis/user/v1/batch_get_id"; + String configUrl = AppDataConfig.getInstance().getUsersUrl(); + url = getRealValue(url, configUrl); + url = getEscbUrl("usersUrl", url); + int flag = 0; + if (StringKit.isNotEmpty(emailsContent)) { + if (url.indexOf("?") > 0) { + url = url + "&" + emailsContent; + } else { + url = url + "?" + emailsContent; + } + flag++; + } + + if (StringKit.isNotEmpty(mobilesContent)) { + if (url.indexOf("?") > 0) { + url = url + "&" + mobilesContent; + } else { + url = url + "?" + mobilesContent; + } + flag++; + } + if (flag == 0) { + return feishuUserIds; + } + String content = Utils.createHttpGetContentWithHttpClient(url, authorizationValue, "application/json; charset=utf-8"); + if (StringKit.isEmpty(content)) { + return feishuUserIds; + } + JSONObject contentJson = new JSONObject(content); + int code = contentJson.getInt("code"); + if (code != 0) { + return feishuUserIds; + } + + JSONObject dataJson = contentJson.getJSONObject("data"); + if (dataJson == null) { + return feishuUserIds; + } + + Set userIdSet = new HashSet<>(); + if (dataJson.containsKey("email_users")) { + JSONObject emailUsersJson = dataJson.getJSONObject("email_users"); + userIdSet.addAll(getUserIdsByJson(emailUsersJson)); + } + + if (dataJson.containsKey("mobile_users")) { + JSONObject mobileUsersJson = dataJson.getJSONObject("mobile_users"); + userIdSet.addAll(getUserIdsByJson(mobileUsersJson)); + } + + feishuUserIds.addAll(userIdSet); + return feishuUserIds; + } + + /** + * 上传图片 + * + * @param imageInputStream + * @param accessToken + * @return + * @throws IOException + */ + public synchronized static JSONObject uploadImage(InputStream imageInputStream, String accessToken) throws IOException { + JSONObject fileJson = new JSONObject(); + if (StringKit.isEmpty(accessToken) || (imageInputStream == null)) { + return fileJson; + } + String authorizationValue = "Bearer " + accessToken; + String url = "https://open.feishu.cn/open-apis/open-apis/im/v1/images"; + String configUrl = AppDataConfig.getInstance().getUploadImageUrl(); + url = getRealValue(url, configUrl); + url = getEscbUrl("uploadImageUrl", url); + MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create(); + multipartEntityBuilder.addTextBody("image_type", "message"); + multipartEntityBuilder.addPart("image", new InputStreamBody(imageInputStream, "image.png")); + String content = Utils.createHttpPostContentWithHttpClient(url, multipartEntityBuilder, authorizationValue, ""); + if (StringKit.isEmpty(content)) { + return fileJson; + } + JSONObject contentJson = new JSONObject(content); + int code = contentJson.getInt("code"); + if (code != 0) { + return fileJson; + } + JSONObject dataJson = contentJson.getJSONObject("data"); + if (dataJson == null) { + return fileJson; + } + return dataJson; + } + + /** + * 上传文件 + * + * @param fileType + * @param fileName + * @param fileInputStream + * @param accessToken + * @return + * @throws IOException + */ + public synchronized static JSONObject uploadFile(String fileType, String fileName, InputStream fileInputStream, String accessToken) throws IOException { + JSONObject fileJson = new JSONObject(); + if (StringKit.isEmpty(accessToken) || StringKit.isEmpty(fileName) || (fileInputStream == null)) { + return fileJson; + } + String fileTypeValue = StringKit.trim(fileType); + if (StringKit.isEmpty(fileTypeValue)) { + fileTypeValue = "stream"; + } else { + fileTypeValue = fileTypeValue.toLowerCase(); + String[] defaultFileTypes = {"opus", "mp4", "pdf", "doc", "xls", "ppt", "stream"}; + int flag = 0; + for (int i = 0, max = defaultFileTypes.length - 1; i <= max; i++) { + if (StringKit.equals(fileTypeValue, defaultFileTypes[i])) { + flag++; + break; + } + } + if (flag == 0) { + fileTypeValue = "stream"; + } + } + + String authorizationValue = "Bearer " + accessToken; + String url = "https://open.feishu.cn/open-apis/open-apis/im/v1/files"; + String configUrl = AppDataConfig.getInstance().getUploadFileUrl(); + url = getRealValue(url, configUrl); + url = getEscbUrl("uploadFileUrl", url); + MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder.create(); + multipartEntityBuilder.addTextBody("file_type", fileTypeValue,ContentType.create("text/plain",Charset.forName("UTF-8"))); + multipartEntityBuilder.addTextBody("file_name", fileName,ContentType.create("text/plain",Charset.forName("UTF-8"))); + multipartEntityBuilder.addBinaryBody("file", fileInputStream); + String content = Utils.createHttpPostContentWithHttpClient(url, multipartEntityBuilder, authorizationValue, ""); + if (StringKit.isEmpty(content)) { + return fileJson; + } + JSONObject contentJson = new JSONObject(content); + int code = contentJson.getInt("code"); + if (code != 0) { + return fileJson; + } + JSONObject dataJson = contentJson.getJSONObject("data"); + if (dataJson == null) { + return fileJson; + } + return dataJson; + } + + public static boolean isValidFileJson(JSONObject fileJson) { + if (fileJson == null) { + return false; + } + + if (fileJson.containsKey("file_key")) { + return true; + } + return false; + } + + public static boolean isValidImageJson(JSONObject fileJson) { + if (fileJson == null) { + return false; + } + + if (fileJson.containsKey("image_key")) { + return true; + } + return false; + } + + /** + * 发送消息 + * + * @param receiveIdType + * @param receiveId + * @param msgContent + * @param msgType + * @param accessToken + * @throws IOException + */ + public synchronized static void sendMessage(String receiveIdType, String receiveId, String msgContent, String msgType, String accessToken) throws IOException { + if (StringKit.isEmpty(receiveIdType) || StringKit.isEmpty(receiveId) || StringKit.isEmpty(msgContent) || StringKit.isEmpty(msgType) || StringKit.isEmpty(accessToken)) { + return; + } + + JSONObject bodyJson = new JSONObject(); + //bodyJson.put("receive_id_type", receiveIdType); + bodyJson.put("receive_id", receiveId); + bodyJson.put("content", msgContent); + bodyJson.put("msg_type", msgType); + + String authorizationValue = "Bearer " + accessToken; + String url = "https://open.feishu.cn/open-apis/im/v1/messages"; + String configUrl = AppDataConfig.getInstance().getSendMessageUrl(); + url = getRealValue(url, configUrl) + "?receive_id_type=" + receiveIdType; + url = getEscbUrl("sendMessageUrl", url) + "&receive_id_type=" + receiveIdType; + String content = Utils.createHttpPostContentWithHttpClient(url, bodyJson.toString(), authorizationValue, "application/json; charset=utf-8"); + } + + /** + * 发送文本消息 + * + * @param receiveIdType + * @param receiveId + * @param textContent + * @param accessToken + * @throws IOException + */ + public static void sendMessageWithText(String receiveIdType, String receiveId, String textContent, String accessToken) throws IOException { + JSONObject textJson = new JSONObject(); + textJson.put("text", textContent); + sendMessage(receiveIdType, receiveId, textJson.toString(), "text", accessToken); + } + + /** + * 发送群文本消息 + * + * @param chatId + * @param textContent + * @param accessToken + * @throws IOException + */ + public static void sendGroupMessageWithText(String chatId, String textContent, String accessToken) throws IOException { + sendMessageWithText("chat_id", chatId, textContent, accessToken); + } + + public static void sendMessageWithImage(String receiveIdType, String receiveId, String imageContent, String accessToken) throws IOException { + sendMessage(receiveIdType, receiveId, imageContent, "image", accessToken); + } + + public static void sendGroupMessageWithImage(String chatId, String imageContent, String accessToken) throws IOException { + sendMessageWithImage("chat_id", chatId, imageContent, accessToken); + } + + public static void sendMessageWithFile(String receiveIdType, String receiveId, String fileContent, String accessToken) throws IOException { + sendMessage(receiveIdType, receiveId, fileContent, "file", accessToken); + } + + public static void sendMessageWithFileByUserId(String receiveId, String fileContent, String accessToken) throws IOException { + sendMessage("user_id", receiveId, fileContent, "file", accessToken); + } + + public static void sendGroupMessageWithFile(String chatId, String fileContent, String accessToken) throws IOException { + sendMessageWithFile("chat_id", chatId, fileContent, accessToken); + } + + + public synchronized static void sendBatchMessage(List userIds, String msgContent, String msgType, String accessToken) throws IOException { + if (CollectionUtils.isEmpty(userIds) || StringKit.isEmpty(msgContent) || StringKit.isEmpty(msgType) || StringKit.isEmpty(accessToken)) { + return; + } + + JSONArray userIdJsons = new JSONArray(); + for (int i = 0, max = userIds.size() - 1; i <= max; i++) { + userIdJsons.add(userIds.get(i)); + } + JSONObject bodyJson = new JSONObject(); + bodyJson.put("content", new JSONObject(msgContent)); + bodyJson.put("msg_type", msgType); + bodyJson.put("user_ids", userIdJsons); + + String authorizationValue = "Bearer " + accessToken; + String url = "https://open.feishu.cn/open-apis/message/v4/batch_send"; + String configUrl = AppDataConfig.getInstance().getSendBatchMessageUrl(); + url = getRealValue(url, configUrl); + url = getEscbUrl("sendBatchMessageUrl", url); + String content = Utils.createHttpPostContentWithHttpClient(url, bodyJson.toString(), authorizationValue, "application/json; charset=utf-8"); + } + + + private static String getEscbUrl(String type, String originalUrl) { + boolean escbOption = false; + String escbCode = ""; + String escbVersion = ""; + + if ("accessTokenUrl".equals(type)) { + escbOption = AppDataConfig.getInstance().isAccessTokenUrlEscbOption(); + escbCode = AppDataConfig.getInstance().getAccessTokenUrlEscbCode(); + escbVersion = AppDataConfig.getInstance().getAccessTokenUrlEscbVersion(); + } else if ("codeUserUrl".equals(type)) { + escbOption = AppDataConfig.getInstance().isCodeUserUrlEscbOption(); + escbCode = AppDataConfig.getInstance().getCodeUserUrlEscbCode(); + escbVersion = AppDataConfig.getInstance().getCodeUserUrlEscbVersion(); + } else if ("chatGroupsUrl".equals(type)) { + escbOption = AppDataConfig.getInstance().isChatGroupsUrlEscbOption(); + escbCode = AppDataConfig.getInstance().getChatGroupsUrlEscbCode(); + escbVersion = AppDataConfig.getInstance().getChatGroupsUrlEscbVersion(); + } else if ("usersUrl".equals(type)) { + escbOption = AppDataConfig.getInstance().isUsersUrlEscbOption(); + escbCode = AppDataConfig.getInstance().getUsersUrlEscbCode(); + escbVersion = AppDataConfig.getInstance().getUsersUrlEscbVersion(); + } else if ("sendMessageUrl".equals(type)) { + escbOption = AppDataConfig.getInstance().isSendMessageUrlEscbOption(); + escbCode = AppDataConfig.getInstance().getSendMessageUrlEscbCode(); + escbVersion = AppDataConfig.getInstance().getSendMessageUrlEscbVersion(); + } else if ("sendBatchMessageUrl".equals(type)) { + escbOption = AppDataConfig.getInstance().isSendBatchMessageUrlEscbOption(); + escbCode = AppDataConfig.getInstance().getSendBatchMessageUrlEscbCode(); + escbVersion = AppDataConfig.getInstance().getSendBatchMessageUrlEscbVersion(); + } else if ("uploadImageUrl".equals(type)) { + escbOption = AppDataConfig.getInstance().isUploadImageUrlEscbOption(); + escbCode = AppDataConfig.getInstance().getUploadImageUrlEscbCode(); + escbVersion = AppDataConfig.getInstance().getUploadImageUrlEscbVersion(); + } else if ("uploadFileUrl".equals(type)) { + escbOption = AppDataConfig.getInstance().isUploadFileUrlEscbOption(); + escbCode = AppDataConfig.getInstance().getUploadFileUrlEscbCode(); + escbVersion = AppDataConfig.getInstance().getUploadFileUrlEscbVersion(); + } else if ("authorizeUrl".equals(type)) { + escbOption = AppDataConfig.getInstance().isAuthorizeUrlEscbOption(); + escbCode = AppDataConfig.getInstance().getAuthorizeUrlEscbCode(); + escbVersion = AppDataConfig.getInstance().getAuthorizeUrlEscbVersion(); + } else { + return originalUrl; + } + + if ((!escbOption) || StringKit.isEmpty(escbCode)) { + return originalUrl; + } + + if (StringKit.isEmpty(escbVersion)) { + escbVersion = "1.0"; + } + + String ssdpValue = "Api_ID=" + escbCode + + "&Api_Version=" + escbVersion + + "&App_Sub_ID=" + AppDataConfig.getInstance().getEscbAppCode() + + "&App_Token=" + AppDataConfig.getInstance().getEscbAppToken() + + "&Partner_ID=" + AppDataConfig.getInstance().getEscbOrgCode() + + "&Sign=NO_SIGN" + + "&Sys_ID=" + AppDataConfig.getInstance().getEscbSysCode() + + "&Time_Stamp=" + DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss:SSS") + + "&User_Token="; + LogKit.info("飞书集成," + type + ",ssdp:" + ssdpValue); + + Base64.Encoder encoder = Base64.getEncoder(); + String url = AppDataConfig.getInstance().getEscbUrl() + "?ssdp=" + new String(encoder.encode(ssdpValue.getBytes())); + LogKit.info("飞书集成,ssdp url:" + url); + return url; + } + + + public static void sendBatchMessageWithText(List userIds, String textContent, String accessToken) throws IOException { + JSONObject textJson = new JSONObject(); + textJson.put("text", textContent); + sendBatchMessage(userIds, textJson.toString(), "text", accessToken); + } + + public static void sendBatchMessageWithRichText(List userIds, String textContent, String accessToken) throws IOException { + JSONObject textJson = new JSONObject(); + textJson.put("post", new JSONObject(textContent)); + sendBatchMessage(userIds, textJson.toString(), "post", accessToken); + } + + + public static void sendBatchMessageWithImage(List userIds, String imageContent, String accessToken) throws IOException { + sendBatchMessage(userIds, imageContent, "image", accessToken); + } + + public static void sendBatchMessageWithFile(List userIds, String fileContent, String accessToken) throws IOException { + //sendBatchMessage(userIds, fileContent, "file", accessToken); + //批量发送不支持发送文件 + if (CollectionUtils.isEmpty(userIds)) { + return; + } + for (int i = 0, max = userIds.size() - 1; i <= max; i++) { + sendMessageWithFileByUserId(userIds.get(i), fileContent, accessToken); + } + } + + + private static List getUserIdsByJson(JSONObject dataJson) { + List userIds = new ArrayList<>(); + if (dataJson == null) { + return userIds; + } + + Set fieldNames = dataJson.fieldNames(); + if (CollectionUtils.isEmpty(fieldNames)) { + return userIds; + } + + JSONArray tempJsons; + JSONObject tempJson; + for (String fieldName : fieldNames) { + tempJsons = dataJson.getJSONArray(fieldName); + if ((tempJsons == null) || (tempJsons.size() <= 0)) { + continue; + } + for (int i = 0, max = tempJsons.size() - 1; i <= max; i++) { + tempJson = tempJsons.getJSONObject(i); + userIds.add(tempJson.getString("user_id")); + } + } + return userIds; + } + + + private static String getUrlParams(String paramName, Set valueSet) { + if (StringKit.isEmpty(paramName) || CollectionUtils.isEmpty(valueSet)) { + return ""; + } + List values = new ArrayList<>(); + values.addAll(valueSet); + String paramsContent = ""; + String value; + int count = 0; + for (int i = 0, max = values.size() - 1; i <= max; i++) { + if (count >= 1) { + paramsContent = paramsContent + "&"; + } + value = values.get(i); + if (StringKit.isEmpty(value)) { + continue; + } + paramsContent = paramsContent + paramName + "=" + value; + count++; + } + return paramsContent; + } + + + private static String getRealValue(String value, String value1) { + String tempValue = StringKit.trim(value1); + if (StringKit.isEmpty(tempValue)) { + return value; + } + return tempValue; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/feishu/FeishuChatGroupBean.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/feishu/FeishuChatGroupBean.java new file mode 100644 index 0000000..d0c2e29 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/feishu/FeishuChatGroupBean.java @@ -0,0 +1,55 @@ +package com.fr.plugin.third.party.jsdjjed.feishu; + +import java.io.Serializable; + +public class FeishuChatGroupBean implements Serializable { + /** + * 群组 ID chat_id + */ + private String chatId; + /** + * 群名称 + */ + private String name; + /** + * 群描述 + */ + private String description; + /** + * tenant_key + */ + private String tenantKey; + + + public String getChatId() { + return chatId; + } + + public void setChatId(String chatId) { + this.chatId = chatId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getTenantKey() { + return tenantKey; + } + + public void setTenantKey(String tenantKey) { + this.tenantKey = tenantKey; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/feishu/FeishuLoginUserBean.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/feishu/FeishuLoginUserBean.java new file mode 100644 index 0000000..0fde8ae --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/feishu/FeishuLoginUserBean.java @@ -0,0 +1,63 @@ +package com.fr.plugin.third.party.jsdjjed.feishu; + +import com.fanruan.api.util.StringKit; + +import java.io.Serializable; + +public class FeishuLoginUserBean implements Serializable { + /** + * 用户 user_id + */ + private String userId; + /** + * 用户姓名 + */ + private String name; + /** + * 用户英文名称 + */ + private String enName; + /** + * 用户手机号 + */ + private String mobile; + + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getEnName() { + return enName; + } + + public void setEnName(String enName) { + this.enName = enName; + } + + public String getMobile() { + return mobile; + } + + public void setMobile(String value) { + if (StringKit.isEmpty(value)) { + this.mobile = ""; + } + if (value.startsWith("+86")) { + value = value.substring(3); + } + this.mobile = value; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/handle/ImageOutputFormat.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/handle/ImageOutputFormat.java new file mode 100644 index 0000000..e617504 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/handle/ImageOutputFormat.java @@ -0,0 +1,29 @@ +package com.fr.plugin.third.party.jsdjjed.handle; + +import com.fr.general.ReportDeclareRecordType; +import com.fr.io.exporter.ScaledImageExporter; +import com.fr.main.workbook.ResultWorkBook; +import com.fr.schedule.extension.report.job.output.BaseOutputFormat; + +import java.io.OutputStream; + +public class ImageOutputFormat extends BaseOutputFormat { + public static final int FORMAT_IMAGE = 4096; + + public int getFormat() { + return FORMAT_IMAGE; + } + + public String getFileSuffix() { + return ".png"; + } + + + public void flush(OutputStream outputStream, ResultWorkBook resultWorkBook) throws Exception { + + ScaledImageExporter exporter = new ScaledImageExporter(ReportDeclareRecordType.EXPORT_TYPE_IMAGE_PNG.getTypeString(), 96); + exporter.export(outputStream, resultWorkBook); + } + + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/http/CustomHttpHandlerProvider.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/CustomHttpHandlerProvider.java new file mode 100644 index 0000000..6e95bd8 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/CustomHttpHandlerProvider.java @@ -0,0 +1,23 @@ +package com.fr.plugin.third.party.jsdjjed.http; + +import com.fr.decision.fun.impl.AbstractHttpHandlerProvider; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.plugin.third.party.jsdjjed.http.app.*; + + +public class CustomHttpHandlerProvider extends AbstractHttpHandlerProvider { + @Override + public BaseHttpHandler[] registerHandlers() { + return new BaseHttpHandler[]{ + new AddAppHttpHandler(), + new DeleteAppHttpHandler(), + new EditAppHttpHandler(), + new QueryAppHttpHandler(), + new ForbidAppHttpHandler(), + new QueryAppConfigHttpHandler(), + new SaveAppConfigHttpHandler(), + new QueryChatGroupsHttpHandler(), + new SynchronizeSourceHttpHandler() + }; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/http/CustomURLAliasProvider.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/CustomURLAliasProvider.java new file mode 100644 index 0000000..fcb0ff4 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/CustomURLAliasProvider.java @@ -0,0 +1,22 @@ +package com.fr.plugin.third.party.jsdjjed.http; + +import com.fr.decision.fun.impl.AbstractURLAliasProvider; +import com.fr.decision.webservice.url.alias.URLAlias; +import com.fr.decision.webservice.url.alias.URLAliasFactory; + +public class CustomURLAliasProvider extends AbstractURLAliasProvider { + @Override + public URLAlias[] registerAlias() { + return new URLAlias[]{ + URLAliasFactory.createPluginAlias("/jsdjjed/add/app", "/jsdjjed/add/app", true), + URLAliasFactory.createPluginAlias("/jsdjjed/delete/app", "/jsdjjed/delete/app", true), + URLAliasFactory.createPluginAlias("/jsdjjed/edit/app", "/jsdjjed/edit/app", true), + URLAliasFactory.createPluginAlias("/jsdjjed/query/app", "/jsdjjed/query/app", true), + URLAliasFactory.createPluginAlias("/jsdjjed/forbid/app", "/jsdjjed/forbid/app", true), + URLAliasFactory.createPluginAlias("/jsdjjed/query/config/app", "/jsdjjed/query/config/app", true), + URLAliasFactory.createPluginAlias("/jsdjjed/save/config/app", "/jsdjjed/save/config/app", true), + URLAliasFactory.createPluginAlias("/jsdjjed/query/chat/group", "/jsdjjed/query/chat/group", true), + URLAliasFactory.createPluginAlias("/jsdjjed/synchronize/source", "/jsdjjed/synchronize/source", true), + }; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/http/SessionGlobalRequestFilterProvider.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/SessionGlobalRequestFilterProvider.java new file mode 100644 index 0000000..249ead3 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/SessionGlobalRequestFilterProvider.java @@ -0,0 +1,566 @@ +package com.fr.plugin.third.party.jsdjjed.http; + +import com.fanruan.api.log.LogKit; +import com.fanruan.api.query.QueryConditionKit; +import com.fanruan.api.query.RestrictionKit; +import com.fanruan.api.util.StringKit; +import com.fr.decision.authority.AuthorityContext; +import com.fr.decision.authority.data.User; +import com.fr.decision.fun.impl.AbstractGlobalRequestFilterProvider; +import com.fr.decision.webservice.v10.login.LoginService; +import com.fr.decision.webservice.v10.user.UserService; +import com.fr.general.ComparatorUtils; +import com.fr.plugin.context.PluginContexts; +import com.fr.plugin.third.party.jsdjjed.Utils; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigData; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigEntity; +import com.fr.plugin.third.party.jsdjjed.config.AppDataConfig; +import com.fr.plugin.third.party.jsdjjed.feishu.FeishuApp; +import com.fr.plugin.third.party.jsdjjed.feishu.FeishuLoginUserBean; +import com.fr.stable.query.condition.QueryCondition; +import com.fr.web.utils.WebUtils; + +import javax.servlet.FilterChain; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.text.SimpleDateFormat; +import java.util.*; + + +public class SessionGlobalRequestFilterProvider extends AbstractGlobalRequestFilterProvider { + private static String DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36"; + + @Override + public String filterName() { + return "ttt.com.fr.plugin.third.party.jsdjjed"; + } + + @Override + public String[] urlPatterns() { + return new String[]{"/decision", "/decision/*"}; + } + + @Override + public void doFilter(HttpServletRequest req, HttpServletResponse res, FilterChain filterChain) { + try { + + String fullUrl = Utils.getFullRequestUrl(req); + String method = req.getMethod(); + LogKit.info("飞书登录集成,记录访问地址:" + method + " " + fullUrl); + if (!"GET".equalsIgnoreCase(method)) { + filterChain.doFilter(req, res); + return; + } + + String reqUrl = Utils.getRequestUrl(req); + + if (Utils.isDecisionLoginRequest(req)) { + filterChain.doFilter(req, res); + return; + } + + if (reqUrl.indexOf("/remote/") >= 0) { + filterChain.doFilter(req, res); + return; + } + + if (reqUrl.indexOf("terminal=H5") >= 0) { + filterChain.doFilter(req, res); + return; + } + + if (reqUrl.indexOf("__device__=") >= 0) { + filterChain.doFilter(req, res); + return; + } + + if (reqUrl.indexOf("/weixin/") >= 0) { + filterChain.doFilter(req, res); + return; + } + + if (reqUrl.indexOf("/dingtalk/") >= 0) { + filterChain.doFilter(req, res); + return; + } + + String state; + if (isAllowLoginWithParameter(req)) { + reqUrl = getRequestUrl(req); + state = UUID.randomUUID().toString(); + AppDataConfig.getInstance().addMapUrl(state, reqUrl); + String tempUrl = getFullAuthorizeUrl(state); + LogKit.info("飞书登录集成,请求认证地址:" + tempUrl); + sendRedirect(res, tempUrl); + return; + } + + if (isAllowLoginWithLightApp(req)) { + reqUrl = getRequestUrl(req); + state = UUID.randomUUID().toString(); + AppDataConfig.getInstance().addMapUrl(state, reqUrl); + LogKit.info("飞书登录集成,报表轻应用跳转"); + AppConfigEntity appConfigEntity = AppConfigData.queryAppConfigDataWithLogin(); + if (appConfigEntity == null) { + LogKit.info("飞书登录集成,报表轻应用跳转,没有获取到登录飞书凭证"); + filterChain.doFilter(req, res); + return; + } + String loginContent = "\n" + + "\n" + + "\n" + + " \n" + + " \n" + + " 数据决策系统\n" + + " \n" + + " \n" + + " \n" + + "\n" + + "\n" + + "

轻应用跳转中,请稍等...

\n" + + //""+ + "\n" + + "\n" + + "\n"; + res.setContentType("text/html;charset=UTF-8"); + WebUtils.printAsString(res, loginContent); + res.setStatus(200); + return; + } + + String loginUsername = getOauthLoginUsername(req); + if (StringKit.isEmpty(loginUsername)) { + filterChain.doFilter(req, res); + return; + } + LogKit.info("飞书登录集成,用户名:" + loginUsername); + + User user = UserService.getInstance().getUserByUserName(loginUsername); + boolean tipsOption = false; + String tipsContent = ""; + if (user == null) { + tipsOption = true; + LogKit.info("飞书登录集成,用户名:" + loginUsername + "在报表平台不存在"); + tipsContent = "在报表服务器上不存在"; + } else if (!user.isEnable()) { + tipsOption = true; + LogKit.info("飞书登录集成,用户名:" + loginUsername + "在报表平台上被禁用"); + tipsContent = "在报表平台上被禁用"; + } + + //添加认证 + if (!PluginContexts.currentContext().isAvailable()) { + tipsOption = true; + LogKit.error("飞书登录集成插件试用过期, 请购买许可证"); + tipsContent = "飞书登录集成插件试用过期, 请购买许可证"; + } + + if (tipsOption) { + String jumpContent = "\n" + + "\n" + + " \n" + + " 提示\n" + + "\t\n" + + "\t\n" + + "\n" + + "\n" + + "
\n" + + " \n" + + "
\n" + + "\n" + + ""; + res.setContentType("text/html;charset=UTF-8"); + WebUtils.printAsString(res, jumpContent); + res.setStatus(200); + return; + } + + loginUsername = user.getUserName(); + LogKit.info("飞书登录集成,报表平台用户名:" + loginUsername); + + + String loginToken = LoginService.getInstance().login(req, res, loginUsername); + req.setAttribute("fine_auth_token", loginToken); + + String reqUrl1 = getRealUrl(req); + if (StringKit.isNotEmpty(reqUrl1) && (!StringKit.equals(reqUrl1, fullUrl))) { + sendRedirect(res, reqUrl1); + return; + } + filterChain.doFilter(req, res); + } catch (Exception e) { + LogKit.error("飞书登录集成出错," + e.getMessage(), e); + } + } + + private String getRealUrl(HttpServletRequest req) { + if (req == null) { + return ""; + } + String state = WebUtils.getHTTPRequestParameter(req, "state"); + if (StringKit.isEmpty(state)) { + return ""; + } + String url = AppDataConfig.getInstance().getMapUrl(state); + url = addLoginPara(url); + return url; + } + + private String addLoginPara(String url) { + if (StringKit.isEmpty(url)) { + return ""; + } + if ((url.indexOf("&login=feishu") >= 0) || (url.indexOf("?login=feishu") >= 0)) { + return url; + } + if (url.indexOf("?") >= 0) { + url = url + "&login=feishu"; + return url; + } + url = url + "?login=feishu"; + return url; + } + + + private String getFullAuthorizeUrl(String state) throws Exception { + + AppConfigEntity configEntity = AppConfigData.queryAppConfigDataWithLogin(); + if (configEntity == null) { + LogKit.error("飞书登录集成,没有登录验证的应用凭证信息0"); + return ""; + } + AppDataConfig config = AppDataConfig.getInstance(); + String tempUrl = config.getFrUrl(); + String url = config.getAuthorizeUrl() + "?app_id=" + configEntity.getAppId() + "&redirect_uri=" + tempUrl + "&state=" + state; + LogKit.info("飞书登录集成,请求用户授权地址:" + url); + return url; + } + + + private String getOauthLoginUsername(HttpServletRequest req) throws Exception { + if (req == null) { + return ""; + } + String lightAppId = StringKit.trim(WebUtils.getHTTPRequestParameter(req, "light_app_id")); + if (StringKit.isNotEmpty(lightAppId)) { + lightAppId = lightAppId.toUpperCase(); + return lightAppId; + } + + String oAuthCode = WebUtils.getHTTPRequestParameter(req, "code"); + if (StringKit.isEmpty(oAuthCode)) { + return ""; + } + LogKit.info("飞书登录集成,OAuth Code:" + oAuthCode); + + + AppConfigEntity configEntity = AppConfigData.queryAppConfigDataWithLogin(); + if (configEntity == null) { + LogKit.error("飞书登录集成,没有登录验证的应用凭证信息1"); + return ""; + } + String accessToken = FeishuApp.createAppAccessToken(configEntity.getAppId(), configEntity.getAppSecret()); + if (StringKit.isEmpty(accessToken)) { + LogKit.error("飞书登录集成,获取app_access_token为空"); + return ""; + } + FeishuLoginUserBean loginUserBean = FeishuApp.getLoginUserInfo(oAuthCode, accessToken); + if (loginUserBean == null) { + LogKit.error("飞书登录集成,获取登录信息为空"); + return ""; + } + + String loginMap = configEntity.getLoginMap(); + QueryCondition queryCondition = getUserQueryCondition(loginMap, loginUserBean); + if (queryCondition == null) { + LogKit.error("飞书登录集成,用户信息没有有效的映射匹配"); + return ""; + } + List perfectMatchUsers = AuthorityContext.getInstance().getUserController().find(queryCondition); + if ((perfectMatchUsers == null) || (perfectMatchUsers.size() <= 0)) { + LogKit.error("飞书登录集成,没有匹配到用户信息"); + return ""; + } + if (perfectMatchUsers.size() >= 2) { + LogKit.error("飞书登录集成,匹配到多个用户信息"); + return ""; + } + User user = perfectMatchUsers.get(0); + String username = user.getUserName(); + return username; + } + + + private QueryCondition getUserQueryCondition(String loginMap, FeishuLoginUserBean loginUserBean) { + if (StringKit.isEmpty(loginMap)) { + loginMap = "name"; + } + Set usernameValues = new HashSet<>(); + String[] loginNames = loginMap.split(","); + String loginName; + String mobile = ""; + for (int i = 0, max = loginNames.length - 1; i <= max; i++) { + loginName = StringKit.trim(loginNames[i]); + if (StringKit.isEmpty(loginName)) { + continue; + } + if (StringKit.equalsIgnoreCase("name", loginName) && StringKit.isNotEmpty(loginUserBean.getName())) { + usernameValues.add(loginUserBean.getName()); + } else if (StringKit.equalsIgnoreCase("en_name", loginName) && StringKit.isNotEmpty(loginUserBean.getEnName())) { + usernameValues.add(loginUserBean.getEnName()); + } else if (StringKit.equalsIgnoreCase("user_id", loginName) && StringKit.isNotEmpty(loginUserBean.getUserId())) { + usernameValues.add(loginUserBean.getUserId()); + usernameValues.add(loginUserBean.getUserId().toUpperCase()); + } else if (StringKit.equalsIgnoreCase("mobile", loginName) && StringKit.isNotEmpty(loginUserBean.getMobile())) { + mobile = loginUserBean.getMobile(); + } + } + + int queryCount = 0; + QueryCondition queryCondition = QueryConditionKit.newQueryCondition(); + if (usernameValues.size() >= 1) { + queryCount++; + queryCondition.addRestriction(RestrictionKit.in("userName", usernameValues)); + } + if (StringKit.isNotEmpty(mobile)) { + queryCount++; + queryCondition.addRestriction(RestrictionKit.eq("mobile", mobile)); + } + if (queryCount <= 0) { + return null; + } + return queryCondition; + } + + + public synchronized static String getSysTime() { + SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); + Date date = new Date(); + String nowData = format.format(date); + return nowData; + } + + private void sendRedirect(HttpServletResponse res, String url) { + res.setStatus(HttpServletResponse.SC_MOVED_TEMPORARILY); + res.setHeader("Location", url); + } + + private String getRequestUrl(HttpServletRequest req) { + String fullUrl = req.getRequestURL().toString(); + fullUrl = getRealUrl(fullUrl); + Map paraMap = req.getParameterMap(); + String paraName; + String[] paraValues; + String loginTypeParaName = AppDataConfig.getInstance().getLoginTypeNameParameter(); + String queryStr = ""; + for (Map.Entry entry : paraMap.entrySet()) { + paraName = entry.getKey(); + if (ComparatorUtils.equals(paraName, loginTypeParaName)) { + continue; + } + if (ComparatorUtils.equals(paraName, "code")) { + continue; + } + if (ComparatorUtils.equals(paraName, "state")) { + continue; + } + if (ComparatorUtils.equals(paraName, "login_type")) { + continue; + } + if (ComparatorUtils.equals(paraName, "light_app")) { + continue; + } + paraValues = entry.getValue(); + queryStr = addParaToQuery(queryStr, paraName, paraValues); + } + if (StringKit.isEmpty(queryStr)) { + return fullUrl; + } + fullUrl = fullUrl + "?" + queryStr; + return fullUrl; + } + + private String getRealUrl(String url) { + if (StringKit.isEmpty(url)) { + return url; + } + int index = url.indexOf("/decision"); + if (index < 0) { + return url; + } + String tempUrl = AppDataConfig.getInstance().getFrUrl() + url.substring(index + "/decision".length()); + return tempUrl; + } + + + private String addParaToQuery(String query, String paraName, String[] paraValues) { + if (StringKit.isEmpty(paraName)) { + return query; + } + String fullQuery = query; + if ((paraValues == null) || (paraValues.length <= 0)) { + if (StringKit.isNotEmpty(fullQuery)) { + fullQuery = fullQuery + "&"; + } + fullQuery = fullQuery + paraName + "="; + return fullQuery; + } + for (int i = 0, max = paraValues.length - 1; i <= max; i++) { + if (StringKit.isNotEmpty(fullQuery)) { + fullQuery = fullQuery + "&"; + } + fullQuery = fullQuery + paraName + "=" + Utils.encodeUrlWithUtf8(paraValues[i]); + } + return fullQuery; + } + + + private boolean isAllowLoginWithParameter(HttpServletRequest req) { + if (req == null) { + return false; + } + String loginTypeNameParameter = "login_type"; + String loginTypeConfigValue = "feishu"; + if (StringKit.isEmpty(loginTypeNameParameter) || StringKit.isEmpty(loginTypeConfigValue)) { + return false; + } + String loginTypeValue = WebUtils.getHTTPRequestParameter(req, loginTypeNameParameter); + return ComparatorUtils.equalsIgnoreCase(loginTypeConfigValue, loginTypeValue); + } + + + private boolean isAllowLoginWithLightApp(HttpServletRequest req) { + if (req == null) { + return false; + } + String loginTypeNameParameter = "light_app"; + String loginTypeConfigValue = "feishu"; + if (StringKit.isEmpty(loginTypeNameParameter) || StringKit.isEmpty(loginTypeConfigValue)) { + return false; + } + String loginTypeValue = WebUtils.getHTTPRequestParameter(req, loginTypeNameParameter); + return ComparatorUtils.equalsIgnoreCase(loginTypeConfigValue, loginTypeValue); + } + + + private boolean isReportRequest(HttpServletRequest req) { + if (req == null) { + return false; + } + if (!"GET".equalsIgnoreCase(req.getMethod())) { + return false; + } + String url = req.getRequestURL().toString(); + if (url.endsWith("/decision") || url.endsWith("/decision/")) { + return true; + } + if ((url.indexOf("/decision/") >= 0) && (url.indexOf("/entry/access/") >= 0)) { + return true; + } + String viewlet = WebUtils.getHTTPRequestParameter(req, "viewlet"); + if ((url.indexOf("/decision/view/report") >= 0) && (StringKit.isNotEmpty(viewlet))) { + return true; + } + if ((url.indexOf("/decision/view/form") >= 0) && (StringKit.isNotEmpty(viewlet))) { + return true; + } + return false; + } + + private boolean isOauthCodeRequest(HttpServletRequest req) throws IOException { + if (req == null) { + return false; + } + if (!"GET".equalsIgnoreCase(req.getMethod())) { + return false; + } + String oAuthCode = WebUtils.getHTTPRequestParameter(req, "code"); + if (StringKit.isNotEmpty(oAuthCode)) { + return true; + } + return false; + } + + + private boolean isNoAuthRequest(HttpServletRequest req) throws IOException { + if (req == null) { + return false; + } + if (!"GET".equalsIgnoreCase(req.getMethod())) { + return false; + } + String oAuthCode = WebUtils.getHTTPRequestParameter(req, "loginType"); + if (StringKit.equalsIgnoreCase("noauth", oAuthCode)) { + return true; + } + return false; + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/AddAppHttpHandler.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/AddAppHttpHandler.java new file mode 100644 index 0000000..e615a8b --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/AddAppHttpHandler.java @@ -0,0 +1,62 @@ +package com.fr.plugin.third.party.jsdjjed.http.app; + +import com.fanruan.api.util.StringKit; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.general.IOUtils; +import com.fr.json.JSONObject; +import com.fr.plugin.third.party.jsdjjed.Utils; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigData; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigEntity; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + */ +public class AddAppHttpHandler extends BaseHttpHandler { + + @Override + public RequestMethod getMethod() { + return RequestMethod.POST; + } + + @Override + public String getPath() { + return "/jsdjjed/add/app"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { + res.setContentType("application/json; charset=utf-8"); + String repBody = IOUtils.inputStream2String(req.getInputStream(), "UTF-8"); + if (StringKit.isEmpty(repBody)) { + WebUtils.printAsJSON(res, Utils.getFailuresResultJson("请求内容为空")); + return; + } + JSONObject reqJson = new JSONObject(repBody); + AppConfigEntity appConfigEntity = reqJson.mapTo(AppConfigEntity.class); + appConfigEntity.setConfigId(toLowerCase(appConfigEntity.getConfigId())); + if (AppConfigData.isAppConfigDataExistsWithConfigId(appConfigEntity.getConfigId())) { + WebUtils.printAsJSON(res, Utils.getFailuresResultJson("应用唯一标识已存在")); + return; + } + AppConfigData.addAppConfigData(appConfigEntity); + WebUtils.printAsJSON(res, Utils.getSuccessResultJson()); + } + + private String toLowerCase(String value) { + if (StringKit.isEmpty(value)) { + return ""; + } + return value.toLowerCase(); + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/DeleteAppHttpHandler.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/DeleteAppHttpHandler.java new file mode 100644 index 0000000..322b543 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/DeleteAppHttpHandler.java @@ -0,0 +1,62 @@ +package com.fr.plugin.third.party.jsdjjed.http.app; + +import com.fanruan.api.util.StringKit; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.general.IOUtils; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.third.party.jsdjjed.Utils; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigData; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + */ +public class DeleteAppHttpHandler extends BaseHttpHandler { + + @Override + public RequestMethod getMethod() { + return RequestMethod.DELETE; + } + + @Override + public String getPath() { + return "/jsdjjed/delete/app"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { + res.setContentType("application/json; charset=utf-8"); + String repBody = IOUtils.inputStream2String(req.getInputStream(), "UTF-8"); + if (StringKit.isEmpty(repBody)) { + WebUtils.printAsJSON(res, Utils.getFailuresResultJson("请求内容为空")); + return; + } + + JSONObject removeJson = new JSONObject(repBody); + JSONArray idJsons = removeJson.getJSONArray("removeUserIds"); + if ((idJsons == null) || (idJsons.size() <= 0)) { + WebUtils.printAsJSON(res, Utils.getSuccessResultJson()); + return; + } + String id; + int size = idJsons.size(); + for (int i = 0, max = size - 1; i <= max; i++) { + id = idJsons.getString(i); + AppConfigData.deleteAppConfigDataWithId(id); + } + String resultContent = "{\"data\":{\"count\":" + size + "},\"stauts\":\"success\"}"; + WebUtils.printAsString(res, resultContent); + } + + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/EditAppHttpHandler.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/EditAppHttpHandler.java new file mode 100644 index 0000000..4bdd8d7 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/EditAppHttpHandler.java @@ -0,0 +1,60 @@ +package com.fr.plugin.third.party.jsdjjed.http.app; + +import com.fanruan.api.util.StringKit; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.general.IOUtils; +import com.fr.json.JSONObject; +import com.fr.plugin.third.party.jsdjjed.Utils; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigData; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigEntity; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + + +public class EditAppHttpHandler extends BaseHttpHandler { + + @Override + public RequestMethod getMethod() { + return RequestMethod.PUT; + } + + @Override + public String getPath() { + return "/jsdjjed/edit/app"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { + res.setContentType("application/json; charset=utf-8"); + String repBody = IOUtils.inputStream2String(req.getInputStream(), "UTF-8"); + if (StringKit.isEmpty(repBody)) { + WebUtils.printAsJSON(res, Utils.getFailuresResultJson("请求内容为空")); + return; + } + JSONObject reqJson = new JSONObject(repBody); + AppConfigEntity appConfigEntity = reqJson.mapTo(AppConfigEntity.class); + if (AppConfigData.isAppConfigDataExistsWithConfigId(appConfigEntity.getConfigId(), appConfigEntity.getId())) { + WebUtils.printAsJSON(res, Utils.getFailuresResultJson("应用唯一标识已存在")); + return; + } + + AppConfigEntity entity = AppConfigData.queryAppConfigDataWithConfigIdAndOnlyOne(appConfigEntity.getConfigId()); + if (entity == null) { + WebUtils.printAsJSON(res, Utils.getFailuresResultJson("应用唯一标识不存在")); + return; + } + appConfigEntity.setLogin(entity.getLogin()); + AppConfigData.updateAppConfigData(appConfigEntity); + WebUtils.printAsJSON(res, Utils.getSuccessResultJson()); + } + + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/ForbidAppHttpHandler.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/ForbidAppHttpHandler.java new file mode 100644 index 0000000..bd0c1f0 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/ForbidAppHttpHandler.java @@ -0,0 +1,64 @@ +package com.fr.plugin.third.party.jsdjjed.http.app; + +import com.fanruan.api.util.StringKit; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.general.IOUtils; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.third.party.jsdjjed.Utils; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigData; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigEntity; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + */ +public class ForbidAppHttpHandler extends BaseHttpHandler { + + @Override + public RequestMethod getMethod() { + return RequestMethod.PUT; + } + + @Override + public String getPath() { + return "/jsdjjed/forbid/app"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { + res.setContentType("application/json; charset=utf-8"); + String repBody = IOUtils.inputStream2String(req.getInputStream(), "UTF-8"); + if (StringKit.isEmpty(repBody)) { + WebUtils.printAsJSON(res, Utils.getFailuresResultJson("请求内容为空")); + return; + } + + JSONObject forbidJson = new JSONObject(repBody); + boolean enable = forbidJson.getBoolean("enable"); + String id = forbidJson.getString("id"); + + int login = 0; + if (enable) { + login = 1; + } + AppConfigEntity entity = AppConfigData.queryAppConfigDataWithId(id); + if (entity == null) { + WebUtils.printAsJSON(res, Utils.getSuccessResultJson()); + return; + } + + entity.setLogin(login); + AppConfigData.updateAppConfigData(entity); + WebUtils.printAsJSON(res, Utils.getSuccessResultJson()); + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/QueryAppConfigHttpHandler.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/QueryAppConfigHttpHandler.java new file mode 100644 index 0000000..a84c1c6 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/QueryAppConfigHttpHandler.java @@ -0,0 +1,97 @@ +package com.fr.plugin.third.party.jsdjjed.http.app; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.third.party.jsdjjed.Utils; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigData; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigEntity; +import com.fr.plugin.third.party.jsdjjed.config.AppDataConfig; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * + */ +public class QueryAppConfigHttpHandler extends BaseHttpHandler { + + @Override + public RequestMethod getMethod() { + return RequestMethod.GET; + } + + @Override + public String getPath() { + return "/jsdjjed/query/config/app"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { + res.setContentType("application/json; charset=utf-8"); + JSONObject dataJson = getConfigJsonData(); + WebUtils.printAsJSON(res, dataJson); + } + + private JSONObject getConfigJsonData() { + JSONObject dataJson = new JSONObject(); + dataJson.put("frUrl", AppDataConfig.getInstance().getFrUrl()); + dataJson.put("accessTokenUrl", AppDataConfig.getInstance().getAccessTokenUrl()); + dataJson.put("codeUserUrl", AppDataConfig.getInstance().getCodeUserUrl()); + dataJson.put("chatGroupsUrl", AppDataConfig.getInstance().getChatGroupsUrl()); + dataJson.put("usersUrl", AppDataConfig.getInstance().getUsersUrl()); + dataJson.put("sendMessageUrl", AppDataConfig.getInstance().getSendMessageUrl()); + dataJson.put("sendBatchMessageUrl", AppDataConfig.getInstance().getSendBatchMessageUrl()); + dataJson.put("uploadImageUrl", AppDataConfig.getInstance().getUploadImageUrl()); + dataJson.put("uploadFileUrl", AppDataConfig.getInstance().getUploadFileUrl()); + dataJson.put("authorizeUrl", AppDataConfig.getInstance().getAuthorizeUrl()); + + dataJson.put("accessTokenUrlEscbOption", AppDataConfig.getInstance().isAccessTokenUrlEscbOption()); + dataJson.put("codeUserUrlEscbOption", AppDataConfig.getInstance().isCodeUserUrlEscbOption()); + dataJson.put("chatGroupsUrlEscbOption", AppDataConfig.getInstance().isChatGroupsUrlEscbOption()); + dataJson.put("usersUrlEscbOption", AppDataConfig.getInstance().isUsersUrlEscbOption()); + dataJson.put("sendMessageUrlEscbOption", AppDataConfig.getInstance().isSendMessageUrlEscbOption()); + dataJson.put("sendBatchMessageUrlEscbOption", AppDataConfig.getInstance().isSendBatchMessageUrlEscbOption()); + dataJson.put("uploadImageUrlEscbOption", AppDataConfig.getInstance().isUploadImageUrlEscbOption()); + dataJson.put("uploadFileUrlEscbOption", AppDataConfig.getInstance().isUploadFileUrlEscbOption()); + dataJson.put("authorizeUrlEscbOption", AppDataConfig.getInstance().isAuthorizeUrlEscbOption()); + dataJson.put("accessTokenUrlEscbCode", AppDataConfig.getInstance().getAccessTokenUrlEscbCode()); + dataJson.put("codeUserUrlEscbCode", AppDataConfig.getInstance().getCodeUserUrlEscbCode()); + dataJson.put("chatGroupsUrlEscbCode", AppDataConfig.getInstance().getChatGroupsUrlEscbCode()); + dataJson.put("usersUrlEscbCode", AppDataConfig.getInstance().getUsersUrlEscbCode()); + dataJson.put("sendMessageUrlEscbCode", AppDataConfig.getInstance().getSendMessageUrlEscbCode()); + dataJson.put("sendBatchMessageUrlEscbCode", AppDataConfig.getInstance().getSendBatchMessageUrlEscbCode()); + dataJson.put("uploadImageUrlEscbCode", AppDataConfig.getInstance().getUploadImageUrlEscbCode()); + dataJson.put("uploadFileUrlEscbCode", AppDataConfig.getInstance().getUploadFileUrlEscbCode()); + dataJson.put("authorizeUrlEscbCode", AppDataConfig.getInstance().getAuthorizeUrlEscbCode()); + dataJson.put("accessTokenUrlEscbVersion", AppDataConfig.getInstance().getAccessTokenUrlEscbVersion()); + dataJson.put("codeUserUrlEscbVersion", AppDataConfig.getInstance().getCodeUserUrlEscbVersion()); + dataJson.put("chatGroupsUrlEscbVersion", AppDataConfig.getInstance().getChatGroupsUrlEscbVersion()); + dataJson.put("usersUrlEscbVersion", AppDataConfig.getInstance().getUsersUrlEscbVersion()); + dataJson.put("sendMessageUrlEscbVersion", AppDataConfig.getInstance().getSendMessageUrlEscbVersion()); + dataJson.put("sendBatchMessageUrlEscbVersion", AppDataConfig.getInstance().getSendBatchMessageUrlEscbVersion()); + dataJson.put("uploadImageUrlEscbVersion", AppDataConfig.getInstance().getUploadImageUrlEscbVersion()); + dataJson.put("uploadFileUrlEscbVersion", AppDataConfig.getInstance().getUploadFileUrlEscbVersion()); + dataJson.put("authorizeUrlEscbVersion", AppDataConfig.getInstance().getAuthorizeUrlEscbVersion()); + dataJson.put("escbUrl", AppDataConfig.getInstance().getEscbUrl()); + dataJson.put("escbAppCode", AppDataConfig.getInstance().getEscbAppCode()); + dataJson.put("escbAppToken", AppDataConfig.getInstance().getEscbAppToken()); + dataJson.put("escbOrgCode", AppDataConfig.getInstance().getEscbOrgCode()); + dataJson.put("escbSysCode", AppDataConfig.getInstance().getEscbSysCode()); + + dataJson.put("page", 1); + JSONObject json = Utils.getSuccessResultJson(); + json.put("data", dataJson); + return json; + } + + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/QueryAppHttpHandler.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/QueryAppHttpHandler.java new file mode 100644 index 0000000..3c4aafb --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/QueryAppHttpHandler.java @@ -0,0 +1,71 @@ +package com.fr.plugin.third.party.jsdjjed.http.app; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigData; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigEntity; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * + */ +public class QueryAppHttpHandler extends BaseHttpHandler { + + @Override + public RequestMethod getMethod() { + return RequestMethod.GET; + } + + @Override + public String getPath() { + return "/jsdjjed/query/app"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { + res.setContentType("application/json; charset=utf-8"); + List entities = AppConfigData.queryAllAppConfigData(); + JSONObject dataJson = createJsonData(entities); + WebUtils.printAsJSON(res, dataJson); + } + + private JSONObject createJsonData(List entities) { + int total = entities.size(); + JSONArray itemsJsons = new JSONArray(); + AppConfigEntity entity; + JSONObject itemsJson; + for (int i = 0, max = total - 1; i <= max; i++) { + entity = entities.get(i); + itemsJson = JSONObject.mapFrom(entity); + if (entity.getLogin() == 1) { + itemsJson.put("enable", true); + } else { + itemsJson.put("enable", false); + } + itemsJson.put("show", entity.getConfigId() + "_" + entity.getNotes()); + itemsJsons.add(itemsJson); + } + + JSONObject dataJson = new JSONObject(); + dataJson.put("total", total); + dataJson.put("page", 1); + dataJson.put("items", itemsJsons); + + JSONObject json = new JSONObject(); + json.put("data", dataJson); + return json; + } + + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/QueryChatGroupsHttpHandler.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/QueryChatGroupsHttpHandler.java new file mode 100644 index 0000000..96ffd95 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/QueryChatGroupsHttpHandler.java @@ -0,0 +1,91 @@ +package com.fr.plugin.third.party.jsdjjed.http.app; + +import com.fanruan.api.util.StringKit; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONArray; +import com.fr.json.JSONObject; +import com.fr.plugin.third.party.jsdjjed.Utils; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigData; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigEntity; +import com.fr.plugin.third.party.jsdjjed.feishu.FeishuApp; +import com.fr.plugin.third.party.jsdjjed.feishu.FeishuChatGroupBean; +import com.fr.third.org.apache.commons.collections4.CollectionUtils; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.util.List; + +/** + * + */ +public class QueryChatGroupsHttpHandler extends BaseHttpHandler { + + @Override + public RequestMethod getMethod() { + return RequestMethod.GET; + } + + @Override + public String getPath() { + return "/jsdjjed/query/chat/group"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { + res.setContentType("application/json; charset=utf-8"); + String configId = WebUtils.getHTTPRequestParameter(req, "config_id"); + if (StringKit.isEmpty(configId)) { + WebUtils.printAsJSON(res, Utils.getFailuresResultJson("应用唯一标识为空")); + return; + } + JSONObject dataJson = createJsonData(configId); + WebUtils.printAsJSON(res, dataJson); + } + + private JSONObject createJsonData(String configId) throws Exception { + AppConfigEntity configEntity = AppConfigData.queryAppConfigDataWithConfigIdAndOnlyOne(configId); + if (configEntity == null) { + return Utils.getFailuresResultJson("应用唯一标识无效,没有对应配置信息"); + } + + String appId = configEntity.getAppId(); + String appSecret = configEntity.getAppSecret(); + String accessToken = FeishuApp.createAppAccessToken(appId, appSecret); + if (StringKit.isEmpty(accessToken)) { + return Utils.getFailuresResultJson("获取app_access_token为空"); + } + List chatGroupBeans = FeishuApp.getChatGroups(accessToken); + if (CollectionUtils.isEmpty(chatGroupBeans)) { + return Utils.getFailuresResultJson("获取群列表为空"); + } + + int total = chatGroupBeans.size(); + JSONArray itemsJsons = new JSONArray(); + FeishuChatGroupBean entity; + JSONObject itemsJson; + String show; + for (int i = 0, max = total - 1; i <= max; i++) { + entity = chatGroupBeans.get(i); + itemsJson = JSONObject.mapFrom(entity); + show = entity.getName() + "_" + entity.getChatId(); + itemsJson.put("show", show); + itemsJsons.add(itemsJson); + } + + JSONObject dataJson = new JSONObject(); + dataJson.put("total", total); + dataJson.put("page", 1); + dataJson.put("items", itemsJsons); + + JSONObject json = Utils.getSuccessResultJson(); + json.put("data", dataJson); + return json; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/SaveAppConfigHttpHandler.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/SaveAppConfigHttpHandler.java new file mode 100644 index 0000000..bbab885 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/SaveAppConfigHttpHandler.java @@ -0,0 +1,105 @@ +package com.fr.plugin.third.party.jsdjjed.http.app; + +import com.fanruan.api.util.StringKit; +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.general.IOUtils; +import com.fr.json.JSONObject; +import com.fr.plugin.third.party.jsdjjed.Utils; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigData; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigEntity; +import com.fr.plugin.third.party.jsdjjed.config.AppDataConfig; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + + +public class SaveAppConfigHttpHandler extends BaseHttpHandler { + + @Override + public RequestMethod getMethod() { + return RequestMethod.PUT; + } + + @Override + public String getPath() { + return "/jsdjjed/save/config/app"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { + res.setContentType("application/json; charset=utf-8"); + String repBody = IOUtils.inputStream2String(req.getInputStream(), "UTF-8"); + if (StringKit.isEmpty(repBody)) { + WebUtils.printAsJSON(res, Utils.getFailuresResultJson("请求内容为空")); + return; + } + JSONObject reqJson = new JSONObject(repBody); + String frUrl = reqJson.getString("frUrl", ""); + String accessTokenUrl = reqJson.getString("accessTokenUrl", ""); + String codeUserUrl = reqJson.getString("codeUserUrl", ""); + String chatGroupsUrl = reqJson.getString("chatGroupsUrl", ""); + String usersUrl = reqJson.getString("usersUrl", ""); + String sendMessageUrl = reqJson.getString("sendMessageUrl", ""); + String sendBatchMessageUrl = reqJson.getString("sendBatchMessageUrl", ""); + String uploadImageUrl = reqJson.getString("uploadImageUrl", ""); + String uploadFileUrl = reqJson.getString("uploadFileUrl", ""); + String authorizeUrl = reqJson.getString("authorizeUrl", ""); + + AppDataConfig.getInstance().setFrUrl(frUrl); + AppDataConfig.getInstance().setAccessTokenUrl(accessTokenUrl); + AppDataConfig.getInstance().setCodeUserUrl(codeUserUrl); + AppDataConfig.getInstance().setChatGroupsUrl(chatGroupsUrl); + AppDataConfig.getInstance().setUsersUrl(usersUrl); + AppDataConfig.getInstance().setSendMessageUrl(sendMessageUrl); + AppDataConfig.getInstance().setSendBatchMessageUrl(sendBatchMessageUrl); + AppDataConfig.getInstance().setUploadImageUrl(uploadImageUrl); + AppDataConfig.getInstance().setUploadFileUrl(uploadFileUrl); + AppDataConfig.getInstance().setAuthorizeUrl(authorizeUrl); + + AppDataConfig.getInstance().setAccessTokenUrlEscbOption(reqJson.getBoolean("accessTokenUrlEscbOption")); + AppDataConfig.getInstance().setCodeUserUrlEscbOption(reqJson.getBoolean("codeUserUrlEscbOption")); + AppDataConfig.getInstance().setChatGroupsUrlEscbOption(reqJson.getBoolean("chatGroupsUrlEscbOption")); + AppDataConfig.getInstance().setUsersUrlEscbOption(reqJson.getBoolean("usersUrlEscbOption")); + AppDataConfig.getInstance().setSendMessageUrlEscbOption(reqJson.getBoolean("sendMessageUrlEscbOption")); + AppDataConfig.getInstance().setSendBatchMessageUrlEscbOption(reqJson.getBoolean("sendBatchMessageUrlEscbOption")); + AppDataConfig.getInstance().setUploadImageUrlEscbOption(reqJson.getBoolean("uploadImageUrlEscbOption")); + AppDataConfig.getInstance().setUploadFileUrlEscbOption(reqJson.getBoolean("uploadFileUrlEscbOption")); + AppDataConfig.getInstance().setAuthorizeUrlEscbOption(reqJson.getBoolean("authorizeUrlEscbOption")); + + + AppDataConfig.getInstance().setAccessTokenUrlEscbCode(reqJson.getString("accessTokenUrlEscbCode","")); + AppDataConfig.getInstance().setCodeUserUrlEscbCode(reqJson.getString("codeUserUrlEscbCode","")); + AppDataConfig.getInstance().setChatGroupsUrlEscbCode(reqJson.getString("chatGroupsUrlEscbCode","")); + AppDataConfig.getInstance().setUsersUrlEscbCode(reqJson.getString("usersUrlEscbCode","")); + AppDataConfig.getInstance().setSendMessageUrlEscbCode(reqJson.getString("sendMessageUrlEscbCode","")); + AppDataConfig.getInstance().setSendBatchMessageUrlEscbCode(reqJson.getString("sendBatchMessageUrlEscbCode","")); + AppDataConfig.getInstance().setUploadImageUrlEscbCode(reqJson.getString("uploadImageUrlEscbCode","")); + AppDataConfig.getInstance().setUploadFileUrlEscbCode(reqJson.getString("uploadFileUrlEscbCode","")); + AppDataConfig.getInstance().setAuthorizeUrlEscbCode(reqJson.getString("authorizeUrlEscbCode","")); + AppDataConfig.getInstance().setAccessTokenUrlEscbVersion(reqJson.getString("accessTokenUrlEscbVersion","")); + AppDataConfig.getInstance().setCodeUserUrlEscbVersion(reqJson.getString("codeUserUrlEscbVersion","")); + AppDataConfig.getInstance().setChatGroupsUrlEscbVersion(reqJson.getString("chatGroupsUrlEscbVersion","")); + AppDataConfig.getInstance().setUsersUrlEscbVersion(reqJson.getString("usersUrlEscbVersion","")); + AppDataConfig.getInstance().setSendMessageUrlEscbVersion(reqJson.getString("sendMessageUrlEscbVersion","")); + AppDataConfig.getInstance().setSendBatchMessageUrlEscbVersion(reqJson.getString("sendBatchMessageUrlEscbVersion","")); + AppDataConfig.getInstance().setUploadImageUrlEscbVersion(reqJson.getString("uploadImageUrlEscbVersion","")); + AppDataConfig.getInstance().setUploadFileUrlEscbVersion(reqJson.getString("uploadFileUrlEscbVersion","")); + AppDataConfig.getInstance().setAuthorizeUrlEscbVersion(reqJson.getString("authorizeUrlEscbVersion","")); + AppDataConfig.getInstance().setEscbUrl(reqJson.getString("escbUrl","")); + AppDataConfig.getInstance().setEscbAppCode(reqJson.getString("escbAppCode","")); + AppDataConfig.getInstance().setEscbAppToken(reqJson.getString("escbAppToken","")); + AppDataConfig.getInstance().setEscbOrgCode(reqJson.getString("escbOrgCode","")); + AppDataConfig.getInstance().setEscbSysCode(reqJson.getString("escbSysCode","")); + + WebUtils.printAsJSON(res, Utils.getSuccessResultJson()); + } + + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/SynchronizeSourceHttpHandler.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/SynchronizeSourceHttpHandler.java new file mode 100644 index 0000000..9b55b65 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/http/app/SynchronizeSourceHttpHandler.java @@ -0,0 +1,46 @@ +package com.fr.plugin.third.party.jsdjjed.http.app; + +import com.fr.decision.fun.impl.BaseHttpHandler; +import com.fr.json.JSONObject; +import com.fr.plugin.third.party.jsdjjed.Utils; +import com.fr.plugin.third.party.jsdjjed.config.AppDataConfig; +import com.fr.third.springframework.web.bind.annotation.RequestMethod; +import com.fr.web.utils.WebUtils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +/** + * + */ +public class SynchronizeSourceHttpHandler extends BaseHttpHandler { + + @Override + public RequestMethod getMethod() { + return RequestMethod.GET; + } + + @Override + public String getPath() { + return "/jsdjjed/synchronize/source"; + } + + @Override + public boolean isPublic() { + return true; + } + + @Override + public void handle(HttpServletRequest req, HttpServletResponse res) throws Exception { + res.setContentType("application/json; charset=utf-8"); + JSONObject dataJson = getConfigJsonData(); + WebUtils.printAsJSON(res, dataJson); + } + + private JSONObject getConfigJsonData() { + JSONObject dataJson = new JSONObject("{\"data\":{\"type\":0}}"); + return dataJson; + } + + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/AppMessagePushHandler.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/AppMessagePushHandler.java new file mode 100644 index 0000000..70093fb --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/AppMessagePushHandler.java @@ -0,0 +1,410 @@ +package com.fr.plugin.third.party.jsdjjed.schedule; + +import com.fanruan.api.log.LogKit; +import com.fanruan.api.util.StringKit; +import com.fr.base.DataSetFunctionParameterMapNameSpace; +import com.fr.base.TemplateUtils; +import com.fr.decision.authority.AuthorityContext; +import com.fr.decision.authority.data.User; +import com.fr.io.utils.ResourceIOUtils; +import com.fr.json.JSONObject; +import com.fr.plugin.context.PluginContexts; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigData; +import com.fr.plugin.third.party.jsdjjed.app.config.AppConfigEntity; +import com.fr.plugin.third.party.jsdjjed.feishu.FeishuApp; +import com.fr.plugin.third.party.jsdjjed.schedule.bean.OutputAppMessagePush; +import com.fr.schedule.base.constant.ScheduleConstants; +import com.fr.schedule.extension.report.job.output.BaseOutputFormat; +import com.fr.schedule.feature.output.OutputActionHandler; +import com.fr.script.Calculator; +import com.fr.stable.StringUtils; +import com.fr.stable.query.QueryFactory; +import com.fr.stable.query.restriction.RestrictionFactory; +import com.fr.third.org.apache.commons.collections4.CollectionUtils; + +import java.io.IOException; +import java.io.InputStream; +import java.util.*; + +public class AppMessagePushHandler extends OutputActionHandler { + + + @Override + public void doAction(OutputAppMessagePush action, Map map) throws Exception { + LogKit.info("飞书发送消息,开发发送任务........"); + String configId = action.getConfigId(); + if (StringKit.isEmpty(configId)) { + return; + } + + //添加认证 + if (!PluginContexts.currentContext().isAvailable()) { + LogKit.error("飞书登录集成插件试用过期,飞书发送消息, 请购买许可证"); + } + + + AppConfigEntity configEntity = AppConfigData.queryAppConfigDataWithConfigIdAndOnlyOne(configId); + if (configEntity == null) { + return; + } + + LogKit.info("飞书发送消息,获取token........"); + String appAccessToken = FeishuApp.createAppAccessToken(configEntity.getAppId(), configEntity.getAppSecret()); + if (StringKit.isEmpty(appAccessToken)) { + LogKit.error("飞书发送消息,获取app_access_token为空"); + return; + } + + LogKit.info("飞书发送消息,获取飞书用户和群........"); + List feishuUserIds = getFeishuUserIds(map); + String chatGroupId = action.getChatGroupId(); + if ("empty_group".equalsIgnoreCase(chatGroupId)) { + chatGroupId = ""; + } + + if (CollectionUtils.isEmpty(feishuUserIds) && StringKit.isEmpty(chatGroupId)) { + LogKit.error("飞书发送消息,飞书用户ID和群ID都为空"); + return; + } + + String msgType = FeishuApp.getMsgType(action.getFeishuMsgType()); + String sendType = FeishuApp.getSendType(action.getFeishuSendType()); + LogKit.info("飞书发送消息,消息类型:" + FeishuApp.getMsgTypeNotes(msgType)); + LogKit.info("飞书发送消息,发送类型:" + FeishuApp.getSendTypeNotes(sendType)); + if (FeishuApp.isSendMessage(sendType)) { + LogKit.info("飞书发送消息,生成发送文本........"); + Calculator cal = Calculator.createCalculator(); + String content = action.getContent(); + String msgContent = TemplateUtils.renderTpl(cal, content); + LogKit.info("飞书发送消息,发送文本:" + msgContent); + + LogKit.info("飞书发送消息,发送文本消息........"); + if (StringKit.isNotEmpty(chatGroupId) && StringKit.isNotEmpty(msgContent)) { + LogKit.info("飞书发送消息,发送群文本消息........"); + if ("text".equals(msgType)) { + FeishuApp.sendGroupMessageWithText(chatGroupId, msgContent, appAccessToken); + } else { + FeishuApp.sendMessage("chat_id", chatGroupId, msgContent, "post", appAccessToken); + } + } + + if (CollectionUtils.isNotEmpty(feishuUserIds) && StringKit.isNotEmpty(msgContent)) { + LogKit.info("飞书发送消息,发送个人文本消息........"); + if ("text".equals(msgType)) { + FeishuApp.sendBatchMessageWithText(feishuUserIds, msgContent, appAccessToken); + } else { + FeishuApp.sendBatchMessageWithRichText(feishuUserIds, msgContent, appAccessToken); + } + } + } + + if (FeishuApp.isSendFile(sendType)) { + LogKit.info("飞书发送消息,发送文件消息........"); + JSONObject commonUploadJson = getUploadFileJson(action, map, appAccessToken); + if (FeishuApp.isValidFileJson(commonUploadJson)) { + if (StringKit.isNotEmpty(chatGroupId)) { + LogKit.info("飞书发送消息,发送群文件消息........"); + FeishuApp.sendGroupMessageWithFile(chatGroupId, commonUploadJson.toString(), appAccessToken); + } + } else if (FeishuApp.isValidImageJson(commonUploadJson)) { + if (StringKit.isNotEmpty(chatGroupId)) { + LogKit.info("飞书发送消息,发送群图片消息........"); + FeishuApp.sendGroupMessageWithImage(chatGroupId, commonUploadJson.toString(), appAccessToken); + } + } + + if (CollectionUtils.isNotEmpty(feishuUserIds)) { + List userIds = getTaskUserIds(map); + String feishuUserId, userId; + List sendUserIds = new ArrayList<>(); + JSONObject uploadJson; + List tempFeishuUserIds = new ArrayList<>(); + for (int i = 0, max = userIds.size() - 1; i <= max; i++) { + userId = userIds.get(i); + feishuUserId = toLower(userId); + if (sendUserIds.contains(feishuUserId)) { + continue; + } + tempFeishuUserIds.clear(); + tempFeishuUserIds.add(feishuUserId); + uploadJson = getUserUploadFileJson(action, map, appAccessToken, userId); + if ((!FeishuApp.isValidFileJson(uploadJson)) && (!FeishuApp.isValidImageJson(uploadJson))) { + uploadJson = commonUploadJson; + } + if (FeishuApp.isValidFileJson(uploadJson)) { + if (CollectionUtils.isNotEmpty(tempFeishuUserIds)) { + LogKit.info("飞书发送消息,发送个人文件消息........"); + FeishuApp.sendBatchMessageWithFile(tempFeishuUserIds, uploadJson.toString(), appAccessToken); + } + } else if (FeishuApp.isValidImageJson(uploadJson)) { + if (CollectionUtils.isNotEmpty(tempFeishuUserIds)) { + LogKit.info("飞书发送消息,发送个人图片消息........"); + FeishuApp.sendBatchMessageWithImage(tempFeishuUserIds, uploadJson.toString(), appAccessToken); + } + } + sendUserIds.add(feishuUserId); + } + } + } + LogKit.info("飞书发送消息,结束发送任务........"); + } + + + private JSONObject getUserUploadFileJson(OutputAppMessagePush action, Map map, String appAccessToken, String userId) throws IOException { + JSONObject fileJson = new JSONObject(); + String fileType = getFileType(action); + if (StringKit.isEmpty(fileType)) { + return fileJson; + } + + String filePath = getUploadFilePath(action, map); + String fileName = getUploadFileName(filePath); + + String userFilePath = getUserUploadFilePath(action, map, userId, fileName); + if (StringKit.isEmpty(userFilePath)) { + return fileJson; + } + + InputStream fileInputStream = getUploadFileInputStream(userFilePath); + if (fileInputStream == null) { + return fileJson; + } + + if ("png".equals(fileType)) { + fileJson = FeishuApp.uploadImage(fileInputStream, appAccessToken); + return fileJson; + } + + fileJson = FeishuApp.uploadFile(fileType, fileName, fileInputStream, appAccessToken); + return fileJson; + } + + private String getUserUploadFilePath(OutputAppMessagePush action, Map map, String userId, String fileName) { + String fileType = getFileType(action); + if (StringKit.isEmpty(fileType)) { + return ""; + } + + String fileSuffix = "." + fileType; + if (StringKit.isEmpty(fileSuffix)) { + return ""; + } + String tempFilePath = String.valueOf(map.get(ScheduleConstants.SAVE_DIRECTORY_WITHOUT_USERNAME)); + if (StringKit.isEmpty(tempFilePath)) { + return ""; + } + String filePath = tempFilePath.substring(0, tempFilePath.lastIndexOf("/")) + "/" + userId + "/" + fileName; + if (StringKit.isNotEmpty(filePath) && ResourceIOUtils.exist(filePath)) { + return filePath; + } + return ""; + } + + private JSONObject getUploadFileJson(OutputAppMessagePush action, Map map, String appAccessToken) throws IOException { + JSONObject fileJson = new JSONObject(); + String fileType = getFileType(action); + if (StringKit.isEmpty(fileType)) { + return fileJson; + } + + String filePath = getUploadFilePath(action, map); + InputStream fileInputStream = getUploadFileInputStream(filePath); + if (fileInputStream == null) { + return fileJson; + } + + if ("png".equals(fileType)) { + fileJson = FeishuApp.uploadImage(fileInputStream, appAccessToken); + return fileJson; + } + + String fileName = getUploadFileName(filePath); + fileJson = FeishuApp.uploadFile(fileType, fileName, fileInputStream, appAccessToken); + return fileJson; + } + + + private String getFileType(OutputAppMessagePush action) { + if (action == null) { + return ""; + } + + if (action.getType() != 3) { + return ""; + } + BaseOutputFormat outputFormat = BaseOutputFormat.fromInteger(action.getMediaId()); + if (outputFormat == null) { + return ""; + } + String fileSuffix = StringKit.trim(outputFormat.getFileSuffix()); + if (StringKit.isEmpty(fileSuffix)) { + return ""; + } + String type = ""; + if (fileSuffix.startsWith(".")) { + type = fileSuffix.substring(1); + } + type = StringKit.trim(type); + return type; + } + + private String getUploadFilePath(OutputAppMessagePush action, Map map) { + String fileType = getFileType(action); + if (StringKit.isEmpty(fileType)) { + return ""; + } + + String fileSuffix = "." + fileType; + if (StringKit.isEmpty(fileSuffix)) { + return ""; + } + String[] filePaths = (String[]) map.get(ScheduleConstants.OUTPUT_FILES); + if ((filePaths == null) || (filePaths.length <= 0)) { + return ""; + } + String filePath; + for (int i = 0, max = filePaths.length - 1; i <= max; i++) { + filePath = filePaths[i]; + if (StringKit.isNotEmpty(filePath) && filePath.endsWith(fileSuffix) && ResourceIOUtils.exist(filePath)) { + return filePath; + } + } + return ""; + } + + private String getUploadFileName(String filePath) { + if (StringKit.isEmpty(filePath)) { + return ""; + } + String name = ResourceIOUtils.getName(filePath); + return name; + } + + private InputStream getUploadFileInputStream(String filePath) { + if (StringKit.isEmpty(filePath)) { + return null; + } + if (ResourceIOUtils.exist(filePath)) { + InputStream in = ResourceIOUtils.read(filePath); + return in; + } + return null; + } + + + private List getTaskUserIds(Map map) throws Exception { + if ((map == null) || (map.size() <= 0)) { + return new ArrayList<>(); + } + String[] scheduleUserNames = (String[]) map.get(ScheduleConstants.USERNAMES); + String scheduleUserName = (String) map.get(ScheduleConstants.USERNAME); + Set userSet = new HashSet(); + String tempUserName = StringKit.trim(scheduleUserName); + if (StringKit.isNotEmpty(tempUserName)) { + userSet.add(tempUserName); + } + + if ((scheduleUserNames != null) && (scheduleUserNames.length >= 1)) { + for (int i = 0, max = scheduleUserNames.length - 1; i <= max; i++) { + tempUserName = StringKit.trim(scheduleUserNames[i]); + if (StringKit.isNotEmpty(tempUserName)) { + userSet.add(tempUserName); + } + } + } + if (userSet.size() <= 0) { + return new ArrayList<>(); + } + List userId = new ArrayList<>(); + userId.addAll(userSet); + return userId; + } + + private List getFeishuUserIds(Map map) throws Exception { + if ((map == null) || (map.size() <= 0)) { + return new ArrayList<>(); + } + String[] scheduleUserNames = (String[]) map.get(ScheduleConstants.USERNAMES); + String scheduleUserName = (String) map.get(ScheduleConstants.USERNAME); + Set userSet = new HashSet(); + String tempUserName = toLower(scheduleUserName); + if (StringKit.isNotEmpty(tempUserName)) { + userSet.add(tempUserName); + } + + if ((scheduleUserNames != null) && (scheduleUserNames.length >= 1)) { + for (int i = 0, max = scheduleUserNames.length - 1; i <= max; i++) { + tempUserName = toLower(scheduleUserNames[i]); + if (StringKit.isNotEmpty(tempUserName)) { + userSet.add(tempUserName); + } + } + } + if (userSet.size() <= 0) { + return new ArrayList<>(); + } + List userId = new ArrayList<>(); + userId.addAll(userSet); + return userId; + } + + private String toLower(String value) { + if (StringKit.isEmpty(value)) { + return ""; + } + String tempValue = StringKit.trim(value.toLowerCase()); + if (StringKit.isEmpty(tempValue)) { + return ""; + } + return tempValue; + } + + + private List getFeishuUserId(String appAccessToken, Map map) throws Exception { + if (StringKit.isEmpty(appAccessToken)) { + return new ArrayList<>(); + } + + if ((map == null) || (map.size() <= 0)) { + return new ArrayList<>(); + } + String[] scheduleUserNames = (String[]) map.get(ScheduleConstants.USERNAMES); + String scheduleUserName = (String) map.get(ScheduleConstants.USERNAME); + Set userSet = new HashSet(); + if (StringUtils.isNotBlank(scheduleUserName)) { + userSet.add(scheduleUserName); + } + if ((scheduleUserNames != null) && (scheduleUserNames.length >= 1)) { + userSet.addAll(Arrays.asList(scheduleUserNames)); + } + + List userList = AuthorityContext.getInstance().getUserController().find(QueryFactory.create().addRestriction(RestrictionFactory.in("userName", userSet))); + if ((userList == null) || (userList.size() <= 0)) { + return new ArrayList<>(); + } + + Set emailSet = new HashSet(); + Set mobileSet = new HashSet(); + + User user; + String email, mobile; + for (int i = 0, max = userList.size() - 1; i <= max; i++) { + user = userList.get(i); + email = StringKit.trim(user.getEmail()); + if (StringKit.isNotEmpty(email)) { + emailSet.add(email); + } + mobile = StringKit.trim(user.getMobile()); + if (StringKit.isNotEmpty(mobile)) { + mobileSet.add(mobile); + } + } + + if ((emailSet.size() <= 0) && (mobileSet.size() <= 0)) { + return new ArrayList<>(); + } + + List feishuUserIds = FeishuApp.getFeishuUserId(emailSet, mobileSet, appAccessToken); + return feishuUserIds; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/bean/OutputAppMessagePush.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/bean/OutputAppMessagePush.java new file mode 100644 index 0000000..a216d9e --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/bean/OutputAppMessagePush.java @@ -0,0 +1,154 @@ +package com.fr.plugin.third.party.jsdjjed.schedule.bean; + + +import com.fr.plugin.third.party.jsdjjed.schedule.entity.AppMessagePushEntity; +import com.fr.schedule.base.bean.output.BaseOutputAction; +import com.fr.schedule.base.entity.AbstractScheduleEntity; +import com.fr.schedule.base.type.RunType; +import com.fr.third.fasterxml.jackson.annotation.JsonSubTypes; + + +@JsonSubTypes.Type(value = OutputAppMessagePush.class, name = "OutputAppMessagePush") +public class OutputAppMessagePush extends BaseOutputAction { + private int terminal = 64; + + private String subject; + + private String content; + + /** + * 客户端通知 消息类型
+ * 1:链接消息;2:图文消息;3:文件消息 + */ + private int type; + + private String configId; + + private String chatGroupId; + + private String feishuMsgType; + + private String feishuSendType; + + + /** + * 客户端通知 定时结果附件 + */ + private int mediaId; + + private int runType = RunType.CLIENT_NOTIFICATION.getValue(); + + //是否受不同用户生成不同附件影响 + @Override + public boolean willExecuteByUser() { + return false; + } + + //推送类型 + @Override + public RunType runType() { + return RunType.CLIENT_NOTIFICATION; + } + + @Override + public Class outputActionEntityClass() { + return AppMessagePushEntity.class; + } + + @Override + public AbstractScheduleEntity createOutputActionEntity() { + AppMessagePushEntity entity = new AppMessagePushEntity(); + entity.setId(this.getId()); + entity.setContent(this.getContent()); + entity.setSubject(this.getSubject()); + entity.setTerminal(this.getTerminal()); + entity.setType(this.getType()); + entity.setConfigId(this.getConfigId()); + entity.setChatGroupId(this.getChatGroupId()); + entity.setMediaId(this.getMediaId()); + entity.setFeishuMsgType(this.getFeishuMsgType()); + entity.setFeishuSendType(this.getFeishuSendType()); + return entity; + } + + + public int getTerminal() { + return terminal; + } + + public void setTerminal(int terminal) { + this.terminal = terminal; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public int getRunType() { + return runType; + } + + public void setRunType(int runType) { + this.runType = runType; + } + + public String getConfigId() { + return configId; + } + + public void setConfigId(String configId) { + this.configId = configId; + } + + public String getChatGroupId() { + return chatGroupId; + } + + public void setChatGroupId(String chatGroupId) { + this.chatGroupId = chatGroupId; + } + + public int getMediaId() { + return mediaId; + } + + public void setMediaId(int mediaId) { + this.mediaId = mediaId; + } + + public String getFeishuMsgType() { + return feishuMsgType; + } + + public void setFeishuMsgType(String feishuMsgType) { + this.feishuMsgType = feishuMsgType; + } + + public String getFeishuSendType() { + return feishuSendType; + } + + public void setFeishuSendType(String feishuSendType) { + this.feishuSendType = feishuSendType; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/components/FileDef.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/components/FileDef.java new file mode 100644 index 0000000..f572caa --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/components/FileDef.java @@ -0,0 +1,47 @@ +package com.fr.plugin.third.party.jsdjjed.schedule.components; + +import com.fr.web.struct.Component; +import com.fr.web.struct.Filter; +import com.fr.web.struct.browser.RequestClient; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.category.StylePath; + + +public class FileDef extends Component { + + public static final FileDef KEY = new FileDef(); + private FileDef(){} + + /** + * 返回需要引入的JS脚本路径 + * @param client 请求客户端描述 + * @return JS脚本路径 + */ + @Override + public ScriptPath script(RequestClient client) { + return ScriptPath.build("com/fr/plugin/third/party/jsdjjed/message.js"); + } + + /** + * 返回需要引入的CSS样式路径 + * @param client 请求客户端描述 + * @return CSS样式路径 + */ + @Override + public StylePath style(RequestClient client) { +// //如果不需要就直接返回 StylePath.EMPTY; +// return StylePath.build("com/fr/plugin/publiclinksecurty/componet/demo.css"); + return StylePath.EMPTY; + } + + + @Override + public Filter filter() { + return new Filter(){ + public boolean accept() { + //任何情况下我们都在平台组件加载时加载我们的组件 + return true; + } + }; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/components/JsAndCssBridge.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/components/JsAndCssBridge.java new file mode 100644 index 0000000..d65fbfa --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/components/JsAndCssBridge.java @@ -0,0 +1,19 @@ +package com.fr.plugin.third.party.jsdjjed.schedule.components; + +import com.fr.decision.fun.impl.AbstractWebResourceProvider; +import com.fr.decision.web.MainComponent; +import com.fr.plugin.transform.FunctionRecorder; +import com.fr.web.struct.Atom; + +@FunctionRecorder +public class JsAndCssBridge extends AbstractWebResourceProvider { + @Override + public Atom attach() { + return MainComponent.KEY; + } + + @Override + public Atom client() { + return FileDef.KEY; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/entity/AppMessagePushEntity.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/entity/AppMessagePushEntity.java new file mode 100644 index 0000000..817f2b0 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/entity/AppMessagePushEntity.java @@ -0,0 +1,131 @@ +package com.fr.plugin.third.party.jsdjjed.schedule.entity; + + +import com.fr.plugin.third.party.jsdjjed.schedule.bean.OutputAppMessagePush; +import com.fr.schedule.base.bean.BaseBean; +import com.fr.schedule.base.entity.AbstractScheduleEntity; +import com.fr.stable.db.constant.EntityConstant; +import com.fr.third.javax.persistence.Column; +import com.fr.third.javax.persistence.Entity; +import com.fr.third.javax.persistence.Table; + +@Entity +@Table(name = "jsdjjed_feishu_message_push") +public class AppMessagePushEntity extends AbstractScheduleEntity { + @Column(name = "terminal") + private int terminal = 64; + + @Column(name = "media_id") + private int mediaId = -1; + + @Column(name = "subject", length = EntityConstant.STRING_LONG_SIZE) + private String subject; + + @Column(name = "content", length = EntityConstant.STRING_LONG_SIZE) + private String content; + + @Column(name = "type") + private int type; + + @Column(name = "config_id") + private String configId; + + @Column(name = "chat_group_id", length = EntityConstant.STRING_LONG_SIZE) + private String chatGroupId; + + @Column(name = "feishu_msg_type") + private String feishuMsgType; + + @Column(name = "feishu_send_type") + private String feishuSendType; + + + @Override + public BaseBean createBean() { + OutputAppMessagePush outputAppMessagePush = new OutputAppMessagePush(); + outputAppMessagePush.setId(this.getId()); + outputAppMessagePush.setContent(this.getContent()); + outputAppMessagePush.setSubject(this.getSubject()); + outputAppMessagePush.setTerminal(this.getTerminal()); + outputAppMessagePush.setType(this.getType()); + outputAppMessagePush.setConfigId(this.getConfigId()); + outputAppMessagePush.setChatGroupId(this.getChatGroupId()); + outputAppMessagePush.setMediaId(this.getMediaId()); + outputAppMessagePush.setFeishuMsgType(this.getFeishuMsgType()); + outputAppMessagePush.setFeishuSendType(this.getFeishuSendType()); + return outputAppMessagePush; + } + + + public int getTerminal() { + return terminal; + } + + public void setTerminal(int terminal) { + this.terminal = terminal; + } + + public String getSubject() { + return subject; + } + + public void setSubject(String subject) { + this.subject = subject; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getConfigId() { + return configId; + } + + public void setConfigId(String configId) { + this.configId = configId; + } + + public String getChatGroupId() { + return chatGroupId; + } + + public void setChatGroupId(String chatGroupId) { + this.chatGroupId = chatGroupId; + } + + public int getMediaId() { + return mediaId; + } + + public void setMediaId(int mediaId) { + this.mediaId = mediaId; + } + + public String getFeishuMsgType() { + return feishuMsgType; + } + + public void setFeishuMsgType(String feishuMsgType) { + this.feishuMsgType = feishuMsgType; + } + + public String getFeishuSendType() { + return feishuSendType; + } + + public void setFeishuSendType(String feishuSendType) { + this.feishuSendType = feishuSendType; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/formula/FeishuOutputFormula.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/formula/FeishuOutputFormula.java new file mode 100644 index 0000000..7d4bfba --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/formula/FeishuOutputFormula.java @@ -0,0 +1,24 @@ +package com.fr.plugin.third.party.jsdjjed.schedule.formula; + +import com.fr.main.workbook.ResultWorkBook; +import com.fr.plugin.third.party.jsdjjed.schedule.bean.OutputAppMessagePush; +import com.fr.schedule.base.provider.impl.AbstractOutputFormulaProvider; +import com.fr.schedule.extension.report.util.ScheduleParameterUtils; + +import java.util.List; +import java.util.Map; + +public class FeishuOutputFormula extends AbstractOutputFormulaProvider { + + @Override + public void dealWithFormulaParam(OutputAppMessagePush bean, ResultWorkBook workBook, List> param) throws Exception { + Map map = param.get(0); + bean.setSubject(ScheduleParameterUtils.dealWithParameter(bean.getSubject(), map, workBook)); + bean.setContent(ScheduleParameterUtils.dealWithParameter(bean.getContent(), map, workBook)); + } + + @Override + public String getActionClassName() { + return OutputAppMessagePush.class.getName(); + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/formula/FormulaCalculator.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/formula/FormulaCalculator.java new file mode 100644 index 0000000..f592cea --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/formula/FormulaCalculator.java @@ -0,0 +1,22 @@ +package com.fr.plugin.third.party.jsdjjed.schedule.formula; + +import com.fr.plugin.third.party.jsdjjed.schedule.bean.OutputAppMessagePush; +import com.fr.schedule.extension.report.job.output.formula.extract.impl.AbstractOutputFormulaExtractorProvider; +import com.fr.schedule.extension.report.util.ScheduleParameterUtils; + +import java.util.Map; +import java.util.regex.Pattern; + +public class FormulaCalculator extends AbstractOutputFormulaExtractorProvider { + + @Override + public String getActionClassName() { + return OutputAppMessagePush.class.getName(); + } + + @Override + public void addFormulaToMap(OutputAppMessagePush bean, Pattern pattern, Map map) { + ScheduleParameterUtils.addFormulaToMap(bean.getSubject(),pattern, map); + ScheduleParameterUtils.addFormulaToMap(bean.getContent(),pattern, map); + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/provider/AppMessagePushDao.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/provider/AppMessagePushDao.java new file mode 100644 index 0000000..c95177a --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/provider/AppMessagePushDao.java @@ -0,0 +1,16 @@ +package com.fr.plugin.third.party.jsdjjed.schedule.provider; + + +import com.fr.plugin.third.party.jsdjjed.schedule.entity.AppMessagePushEntity; +import com.fr.stable.db.dao.BaseDAO; +import com.fr.stable.db.session.DAOSession; + +public class AppMessagePushDao extends BaseDAO { + public AppMessagePushDao(DAOSession daoSession) { + super(daoSession); + } + // 反回实体类class + protected Class getEntityClass(){ + return AppMessagePushEntity.class; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/provider/DBAccessProvider.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/provider/DBAccessProvider.java new file mode 100644 index 0000000..bc354a3 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/provider/DBAccessProvider.java @@ -0,0 +1,40 @@ +package com.fr.plugin.third.party.jsdjjed.schedule.provider; + +import com.fr.decision.plugin.db.AbstractDecisionDBAccessProvider; + + +import com.fr.plugin.third.party.jsdjjed.schedule.entity.AppMessagePushEntity; +import com.fr.stable.db.accessor.DBAccessor; +import com.fr.stable.db.dao.BaseDAO; +import com.fr.stable.db.dao.DAOProvider; + + +public class DBAccessProvider extends AbstractDecisionDBAccessProvider { + private static DBAccessor dbAccessor = null; + + public static DBAccessor getDbAccessor() { + return dbAccessor; + } + + @Override + public DAOProvider[] registerDAO() { + return new DAOProvider[]{ + new DAOProvider() { + @Override + public Class getEntityClass() { + return AppMessagePushEntity.class; + } + + @Override + public Class getDAOClass() { + return AppMessagePushDao.class; + } + } + }; + } + + @Override + public void onDBAvailable(DBAccessor dbAccessor) { + DBAccessProvider.dbAccessor = dbAccessor; + } +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/utils/PlaceholderResolver.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/utils/PlaceholderResolver.java new file mode 100644 index 0000000..8753ec8 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/utils/PlaceholderResolver.java @@ -0,0 +1,111 @@ +package com.fr.plugin.third.party.jsdjjed.schedule.utils; + +import com.fr.log.FineLoggerFactory; +import com.fr.script.Calculator; +import com.fr.stable.StringUtils; +import com.fr.stable.UtilEvalError; + +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * @Author: xx + * @Date: 2020/9/13 11:44 + */ +public class PlaceholderResolver { + + public static final String TEXT = "这是一个包含日期:${today()}和当前时间:${now()} 的两个公式文本"; + + /** + * 默认前缀占位符 + */ + public static final String DEFAULT_PLACEHOLDER_PREFIX = "${"; + + /** + * 默认后缀占位符 + */ + public static final String DEFAULT_PLACEHOLDER_SUFFIX = "}"; + + /** + * 默认单例解析器 + */ + private static PlaceholderResolver defaultResolver = new PlaceholderResolver(); + + /** + * 占位符前缀 + */ + private String placeholderPrefix = DEFAULT_PLACEHOLDER_PREFIX; + + /** + * 占位符后缀 + */ + private String placeholderSuffix = DEFAULT_PLACEHOLDER_SUFFIX; + + + private PlaceholderResolver() { + } + + private PlaceholderResolver(String placeholderPrefix, String placeholderSuffix) { + this.placeholderPrefix = placeholderPrefix; + this.placeholderSuffix = placeholderSuffix; + } + + /** + * 获取默认的占位符解析器,即占位符前缀为"${", 后缀为"}" + * + * @return + */ + public static PlaceholderResolver getDefaultResolver() { + return defaultResolver; + } + + public static PlaceholderResolver getResolver(String placeholderPrefix, String placeholderSuffix) { + return new PlaceholderResolver(placeholderPrefix, placeholderSuffix); + } + + /** + * 解析带有指定占位符的模板字符串,默认占位符为前缀:${ 后缀:} + * 如:"这是一个包含日期:${today()}和当前时间:${sum(1,2)} 的两个公式文本" + * + * @param content 要解析的带有占位符的模板字符串 + * @return + */ + public String resolve(String content) { + int start = content.indexOf(this.placeholderPrefix); + if (start == -1) { + return content; + } + + int valueIndex = 0; + StringBuilder resultContent = new StringBuilder(content); + while (start != -1) { + int end = resultContent.indexOf(this.placeholderSuffix); + String place = content.substring(start, end + this.placeholderSuffix.length()); + String formula = place.replace(this.placeholderPrefix, "").replace(this.placeholderSuffix, ""); + Calculator calculator = Calculator.createCalculator(); + String value = StringUtils.EMPTY; + try { + Object o = calculator.evalValue(formula); + + if (o!=null){ + if (o instanceof Date){ + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + value = format.format(o); + }else { + value =o.toString(); + } + } + + } catch (UtilEvalError utilEvalError) { + FineLoggerFactory.getLogger().error(utilEvalError,"JSD:>>calculator formula in text error!",utilEvalError.getMessage()); + } + resultContent.replace(start, end + this.placeholderSuffix.length(), value); + start = resultContent.indexOf(this.placeholderPrefix, start + value.length()); + } + return resultContent.toString(); + } + + + + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/utils/PropertiesUtils.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/utils/PropertiesUtils.java new file mode 100644 index 0000000..5db6f1f --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/schedule/utils/PropertiesUtils.java @@ -0,0 +1,35 @@ +package com.fr.plugin.third.party.jsdjjed.schedule.utils; + +import com.fr.io.utils.ResourceIOUtils; +import com.fr.log.FineLoggerFactory; +import com.fr.stable.StringUtils; + +import java.io.IOException; +import java.io.InputStream; +import java.util.Properties; + +public class PropertiesUtils { + //获取配置文件 + private static Properties getProperties() { + InputStream is = ResourceIOUtils.read("/resources/minxing_push_message.properties"); + Properties properties = new Properties(); + try { + properties.load(is); + } catch (IOException e) { + FineLoggerFactory.getLogger().error("JSD:>>get properties error! ",e.getMessage()); + } + return properties; + } + + public static String getPro(String key) { + Properties properties = PropertiesUtils.getProperties(); + String value = properties.get(key)==null?"":properties.get(key).toString(); + if ( StringUtils.isEmpty(value)) { + FineLoggerFactory.getLogger().error("JSD:>>[{}] is null or empty!",key); + } + return value; + } + + + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/AES.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/AES.java new file mode 100644 index 0000000..8afa499 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/AES.java @@ -0,0 +1,140 @@ +package com.fr.plugin.third.party.jsdjjed.util; + +import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class AES { + + public final static String ALGORITHM_AEPP = "AES/ECB/PKCS5Padding"; + + /** + * AES加密 + * + * @param content + * 内容 + * @param password + * 密钥 + * @param algorithm + * 算法 + * @return 加密后数据 + */ + public static byte[] encrypt(byte[] content, byte[] password, String algorithm) { + if (content == null || password == null) + return null; + try { + Cipher cipher = null; + if (algorithm.endsWith("PKCS7Padding")) { + cipher = Cipher.getInstance(algorithm, "BC"); + } else { + cipher = Cipher.getInstance(algorithm); + } + cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(password, "AES")); + return cipher.doFinal(content); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * AES解密 + * + * @param content + * 加密内容 + * @param password + * 密钥 + * @param algorithm + * 算法 + * @return 解密后数据 + */ + public static byte[] decrypt(byte[] content, byte[] password, String algorithm) { + if (content == null || password == null) + return null; + try { + Cipher cipher = null; + if (algorithm.endsWith("PKCS7Padding")) { + cipher = Cipher.getInstance(algorithm, "BC"); + } else { + cipher = Cipher.getInstance(algorithm); + } + cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(password, "AES")); + byte[] bytes = cipher.doFinal(content); + return bytes; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * AES加密 + * + * @param content + * 内容 + * @param password + * 密钥 + * @param algorithm + * 算法 + * @param ivStr + * 向量 + * @return 加密后数据 + */ + public static byte[] encrypt(byte[] content, byte[] password, byte[] ivStr, String algorithm) { + if (content == null || password == null) + return null; + try { + Cipher cipher = null; + if (algorithm.endsWith("PKCS7Padding")) { + cipher = Cipher.getInstance(algorithm, "BC"); + } else { + cipher = Cipher.getInstance(algorithm); + } + IvParameterSpec iv = new IvParameterSpec(ivStr); + cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(password, "AES"), iv); + return cipher.doFinal(content); + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + + /** + * AES解密 + * + * @param content + * 加密内容 + * @param password + * 密钥 + * @param algorithm + * 算法 + * @param ivStr + * 向量 + * @return 解密后数据 + */ + public static byte[] decrypt(byte[] content, byte[] password, byte[] ivStr, String algorithm) { + if (content == null || password == null) + return null; + try { + Cipher cipher = null; + if (algorithm.endsWith("PKCS7Padding")) { + cipher = Cipher.getInstance(algorithm, "BC"); + } else { + cipher = Cipher.getInstance(algorithm); + } + IvParameterSpec iv = new IvParameterSpec(ivStr); + cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(password, "AES"), iv); + byte[] bytes = cipher.doFinal(content); + return bytes; + } catch (Exception e) { + e.printStackTrace(); + return null; + } + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/DateUtil.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/DateUtil.java new file mode 100644 index 0000000..fe8e784 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/DateUtil.java @@ -0,0 +1,129 @@ +package com.fr.plugin.third.party.jsdjjed.util; + +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class DateUtil { + + public static final long ONE_HOUR_TIME_LONG = 3600000; + + public static String toString(Date date, String format) { + String dateStr = null; + try { + SimpleDateFormat sdf = new SimpleDateFormat(format); + dateStr = sdf.format(date); + } catch (Exception e) { + } + return dateStr; + } + + public static Date parseDate(String dateStr, String format) { + Date date = null; + try { + SimpleDateFormat sdf = new SimpleDateFormat(format); + date = sdf.parse(dateStr); + } catch (Exception e) { + } + return date; + } + + /** + * 获取日期当天的最小时间日期,0点 + */ + public static Date getMinTimeDateByDate(Date date) { + if (date == null) + return null; + String datestr = toString(date, "yyyyMMdd"); + return parseDate(datestr, "yyyyMMdd"); + } + + /** + * 获取日期当天的最大时间日期,12点整 + */ + public static Date getMaxTimeDateByDate(Date date) { + if (date == null) + return null; + String datestr = toString(date, "yyyyMMdd"); + Date d = parseDate(datestr, "yyyyMMdd"); + return new Date(d.getTime() + 24l * 60l * 60l * 1000l - 1l); + } + + public static long subTime(Date startDate, Date endDate) { + return endDate.getTime() - startDate.getTime(); + } + + /** + * 获取上月第一天最早时间 + * @return Date + */ + public static Date getLastMonthFirstDay() { + Calendar cal_1 = Calendar.getInstance();// 获取当前日期 + cal_1.setTime(getMinTimeDateByDate(new Date())); + cal_1.add(Calendar.MONTH, -1); + cal_1.set(Calendar.DAY_OF_MONTH, 1); + return cal_1.getTime(); + } + + /** + * 获取上月最后一天最晚时间 + * @return Date + */ + public static Date getLastMonthLastDay() { + Calendar cale = Calendar.getInstance(); + cale.setTime(getMinTimeDateByDate(new Date())); + cale.add(Calendar.MONTH, -1); + cale.set(Calendar.DAY_OF_MONTH, cale.getActualMaximum(Calendar.DAY_OF_MONTH)); + return new Date(cale.getTime().getTime() + 1000l * 60l * 60l * 24l - 1l); + } + + /** + * 获取本月第一天最早时间 + * @return Date + */ + public static Date getNowMonthFirstDay() { + Calendar cal_1 = Calendar.getInstance();// 获取当前日期 + cal_1.setTime(getMinTimeDateByDate(new Date())); + cal_1.add(Calendar.MONTH, 0); + cal_1.set(Calendar.DAY_OF_MONTH, 1); + return cal_1.getTime(); + } + + /** + * 获取本月最后一天最晚时间 + * @return Date + */ + public static Date getNowMonthLastDay() { + Calendar cale = Calendar.getInstance(); + cale.setTime(getMinTimeDateByDate(new Date())); + cale.set(Calendar.DAY_OF_MONTH, cale.getActualMaximum(Calendar.DAY_OF_MONTH)); + return new Date(cale.getTime().getTime() + 1000l * 60l * 60l * 24l - 1l); + } + + /** + * 获取本月最后一天 + * @return Date + */ + public static Date getTheMonthLastDay(Date date) { + if(date == null){ + return null; + } + Calendar cale = Calendar.getInstance(); + cale.setTime(date); + cale.set(Calendar.DAY_OF_MONTH, cale.getActualMaximum(Calendar.DAY_OF_MONTH)); + cale.set(Calendar.HOUR, 0); + cale.set(Calendar.HOUR_OF_DAY, 0); + cale.set(Calendar.MINUTE, 0); + cale.set(Calendar.SECOND, 0); + cale.set(Calendar.MILLISECOND, 0); + return cale.getTime(); + } + + + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/GZIPUtils.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/GZIPUtils.java new file mode 100644 index 0000000..6c2d4b0 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/GZIPUtils.java @@ -0,0 +1,88 @@ +package com.fr.plugin.third.party.jsdjjed.util; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class GZIPUtils { + + + /** + * 数据压缩传输 + * + * @param is + * @param os + * @throws Exception + */ + public static void compressTransfe(byte[] bytes, OutputStream out) throws IOException { + GZIPOutputStream gos = null; + try { + gos = new GZIPOutputStream(out); + gos.write(bytes); + gos.finish(); + gos.flush(); + } finally{ + if(gos != null){ + gos.close(); + } + } + } + + /** + * 数据压缩 + * + * @param is + * @param os + * @throws Exception + */ + public static byte[] compress(byte[] bytes) throws IOException { + ByteArrayOutputStream out = null; + GZIPOutputStream gos = null; + try { + out = new ByteArrayOutputStream(); + gos = new GZIPOutputStream(out); + gos.write(bytes); + gos.finish(); + gos.flush(); + } finally{ + if(gos != null){ + gos.close(); + } + if(out != null){ + out.close(); + } + } + return out.toByteArray(); + } + + /** + * 数据解压 + * + * @param in + * @return + * @throws IOException + */ + public static byte[] decompress(byte[] bytes) throws IOException { + ByteArrayInputStream in = new ByteArrayInputStream(bytes); + GZIPInputStream gin = new GZIPInputStream(in); + ByteArrayOutputStream out = new ByteArrayOutputStream(); + int count; + byte data[] = new byte[1024]; + while ((count = gin.read(data, 0, 1024)) != -1) { + out.write(data, 0, count); + } + out.flush(); + out.close(); + gin.close(); + return out.toByteArray(); + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/JsonHelper.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/JsonHelper.java new file mode 100644 index 0000000..043a6be --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/JsonHelper.java @@ -0,0 +1,129 @@ +package com.fr.plugin.third.party.jsdjjed.util; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; + +import java.util.HashMap; +import java.util.Map; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class JsonHelper { + + private static Map gsons = new HashMap(); + + private static String DEFAULT_DATE_PATTERN = "yyyy-MM-dd HH:mm:ss"; + + static { + gsons.put(DEFAULT_DATE_PATTERN, createGson(DEFAULT_DATE_PATTERN)); + } + + private static Gson createGson(String datePattern){ + return new GsonBuilder().setDateFormat(datePattern).disableHtmlEscaping().serializeNulls().create(); + } + + public static Gson getGson() { + return gsons.get(DEFAULT_DATE_PATTERN); + } + + public static Gson getGson(String datePattern) { + Gson gson = gsons.get(datePattern); + if(gson == null){ + gson = createGson(datePattern); + gsons.put(datePattern, gson); + } + return gson; + } + + public static GsonBuilder newGsonBuilder() { + return new GsonBuilder(); + } + + /** + * 将对象转换为json串 + * + * @param obj + * @return + */ + public static String toJsonString(Object obj) { + if (obj == null) { + return null; + } + return getGson().toJson(obj); + } + + /** + * 将对象转换为json串,自定义日期转换规则 + * + * @param obj + * @param datePattern + * @return + */ + public static String toJsonString(Object obj, String datePattern) { + if (obj == null) { + return null; + } + return getGson(datePattern).toJson(obj); + } + + /** + * 将json串转换为对象 + * + * @param clazz + * @param jsonString + * @return + */ + public static T fromJson(Class clazz, String jsonString) { + if (jsonString == null) { + return null; + } + return getGson().fromJson(jsonString, clazz); + } + + /** + * 将json串转换为对象 + * + * @Type type + * @param jsonString + * @return + */ + public static T fromJson(TypeToken token, String jsonString) { + if (jsonString == null) { + return null; + } + return getGson().fromJson(jsonString, token.getType()); + } + + /** + * 将json串转换为对象 + * + * @Type type + * @param jsonString + * @return + */ + public static T fromJson(TypeToken token, String jsonString, String datePattern) { + if (jsonString == null) { + return null; + } + return getGson(datePattern).fromJson(jsonString, token.getType()); + } + + /** + * 将json串转换为对象 + * + * @param clazz + * @param jsonString + * @return + */ + public static T fromJson(Class clazz, String jsonString, String datePattern) { + if (jsonString == null) { + return null; + } + return getGson(datePattern).fromJson(jsonString, clazz); + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/Md5.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/Md5.java new file mode 100644 index 0000000..95ee23d --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/Md5.java @@ -0,0 +1,51 @@ +package com.fr.plugin.third.party.jsdjjed.util; + +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class Md5 { + + /** + * MD5 + * @param bytes + * @return + */ + public static String md5(byte[] bytes) { + if (bytes == null || bytes.length == 0) + return null; + String s = null; + char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(bytes); + byte tmp[] = md.digest(); + char str[] = new char[16 * 2]; + int k = 0; + for (int i = 0; i < 16; i++) { + byte byte0 = tmp[i]; + str[k++] = hexDigits[byte0 >>> 4 & 0xf]; + str[k++] = hexDigits[byte0 & 0xf]; + } + s = new String(str); + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + return s; + } + + /** + * MD5[16位] + * + * @param bytes + * @return + */ + public static String md5For16(byte[] bytes) { + return md5(bytes).substring(8,24); + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpClient.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpClient.java new file mode 100644 index 0000000..b7b9fa7 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpClient.java @@ -0,0 +1,451 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +import javax.net.ssl.*; +import java.io.*; +import java.net.*; +import java.security.*; +import java.security.cert.CertificateException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpClient { + + /** + * 链接超时时间(s) + */ + private int httpConnectionTimeOut = 30; + + /** + * 数据传输超时时间(s) + */ + private int httpReadTimeOut = 30; + + public HttpClient() { + + } + + /** + * + * @param httpConnectionTimeOut + * 链接超时时间(s) + * @param httpReadTimeOut + * 数据传输超时时间(s) + */ + public HttpClient(int httpConnectionTimeOut, int httpReadTimeOut) { + this.httpConnectionTimeOut = httpConnectionTimeOut; + this.httpReadTimeOut = httpReadTimeOut; + } + + /** + * 发送HTTP请求 + * + * @param request + * 请求 + * @param praser + * 响应解析器 + * @return T 响应 + */ + public T service(HttpRequest request, HttpResponsePraser praser) { + HttpResultCode code = HttpResultCode.SUCCESS; + if (request.getHttpParams().getUrl() == null || request.getHttpParams().getUrl().length() == 0) { + code = HttpResultCode.ERROR_URL_NULL; + return praser.prase(code, 0, null, null, request.getHttpParams().getCharSet(), null); + } + HttpURLConnection conn = null; + int httpCode = 0; + Map headers = null; + List cookies = null; + ByteArrayOutputStream outputStream = null; + try { + String realUrl = this.genUrl(request); + conn = this.createConnection(request, realUrl); + this.fillConnection(conn, request); + this.request(conn, request); + httpCode = conn.getResponseCode(); + headers = this.getHeaders(conn, request.getHttpParams().getCharSet()); + cookies = this.getCookies(conn, request.getHttpParams().getCharSet()); + outputStream = this.getResultOutputStream(conn); + } catch (SocketTimeoutException e) { + code = HttpResultCode.ERROR_TIMEOUT; + e.printStackTrace(); + } catch (KeyManagementException e) { + code = HttpResultCode.ERROR_HTTPS_SSL; + e.printStackTrace(); + } catch (NoSuchAlgorithmException e) { + code = HttpResultCode.ERROR_HTTPS_SSL; + e.printStackTrace(); + } catch (ProtocolException e) { + code = HttpResultCode.ERROR_METHOD; + e.printStackTrace(); + } catch (UnsupportedEncodingException e) { + code = HttpResultCode.ERROR_CHARSET; + e.printStackTrace(); + } catch (MalformedURLException e) { + code = HttpResultCode.ERROR_URL; + httpCode = 500; + e.printStackTrace(); + } catch (IOException e) { + code = HttpResultCode.ERROR_CONNECT; + e.printStackTrace(); + } catch (UnrecoverableKeyException e) { + code = HttpResultCode.ERROR_HTTPS_SSL; + e.printStackTrace(); + } catch (KeyStoreException e) { + code = HttpResultCode.ERROR_HTTPS_SSL; + e.printStackTrace(); + } catch (CertificateException e) { + code = HttpResultCode.ERROR_HTTPS_SSL; + e.printStackTrace(); + } finally { + if (conn != null) { + conn.disconnect(); + } + } + T t = null; + try { + t = praser.prase(code, httpCode, headers, cookies, request.getHttpParams().getCharSet(), outputStream); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (outputStream != null) { + try { + outputStream.flush(); + outputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + return t; + } + + private String genUrl(HttpRequest request) { + if (request.getHttpParams().getMethod().equalsIgnoreCase("GET")) { + String getprams = request.getContentPraser().praseRqeuestContentToString(request.getHttpParams()); + if (getprams != null) { + String url = null; + if (request.getHttpParams().getUrl().indexOf("?") > 0) { + url = request.getHttpParams().getUrl() + "&" + getprams; + } else { + url = request.getHttpParams().getUrl() + "?" + getprams; + } + return url; + } else { + return request.getHttpParams().getUrl(); + } + } else { + return request.getHttpParams().getUrl(); + } + } + + /** + * 获取HTTP响应头 + * + * @param conn + * @param charSet + * @return + * @throws UnsupportedEncodingException + */ + private Map getHeaders(HttpURLConnection conn, String charSet) throws UnsupportedEncodingException { + Map resultHeaders = new HashMap(); + Map> header = conn.getHeaderFields(); + if (header != null && header.size() > 0) { + for (Entry> entry : header.entrySet()) { + if (!"Set-Cookie".equalsIgnoreCase(entry.getKey())) { + String valuer = ""; + if (entry.getValue() != null && entry.getValue().size() > 0) { + for (String value : entry.getValue()) { + valuer += new String(value.getBytes("ISO-8859-1"), charSet) + ","; + } + valuer = valuer.substring(0, valuer.length() - 1); + } + resultHeaders.put(entry.getKey(), valuer); + } + } + } + return resultHeaders; + } + + /** + * 获取HTTP响应Cookies + * + * @param conn + * @param charSet + * @return + * @throws UnsupportedEncodingException + */ + private List getCookies(HttpURLConnection conn, String charSet) throws UnsupportedEncodingException { + List resultC = new ArrayList(); + List cookies = null; + Map> header = conn.getHeaderFields(); + if (header != null && header.size() > 0) { + cookies = header.get("Set-Cookie"); + } + if (cookies != null) { + for (String cookie : cookies) { + resultC.add(new String(cookie.getBytes("ISO-8859-1"), charSet)); + } + } + return cookies; + } + + /** + * 获取HTTP响应数据流 + * + * @param conn + * @return + * @throws IOException + */ + private ByteArrayOutputStream getResultOutputStream(HttpURLConnection conn) throws IOException { + ByteArrayOutputStream outStream = new ByteArrayOutputStream(); + InputStream is = conn.getInputStream(); + try { + if (is != null) { + byte[] buffer = new byte[1024]; + int len = 0; + while ((len = is.read(buffer)) != -1) { + outStream.write(buffer, 0, len); + } + } + } catch (IOException e) { + throw e; + } finally { + if (is != null) { + is.close(); + } + } + return outStream; + } + + /** + * 发送Http请求 + * + * @param conn + * @param request + * @throws IOException + */ + private void request(HttpURLConnection conn, HttpRequest request) throws IOException { + if (request.getHttpParams().getMethod().equalsIgnoreCase("POST")) { + conn.setDoOutput(true); + // conn.connect(); + if (request.getHttpParams().getParams() != null) { + byte[] content = request.getContentPraser().praseRqeuestContentToBytes(request.getHttpParams()); + fillHeader(conn, "Content-Length", String.valueOf(request.getContentPraser().praseRqeuestContentLength(request.getHttpParams()))); + DataOutputStream out = new DataOutputStream(conn.getOutputStream()); + out.write(content); + out.flush(); + out.close(); + } + } else { + conn.connect(); + } + } + + /** + * 添加请求信息 + * + * @param conn + * @param request + * @throws ProtocolException + */ + private void fillConnection(HttpURLConnection conn, HttpRequest request) throws ProtocolException { + this.fillTimeout(conn); + this.filleMethod(conn, request); + this.fillHeaders(conn, request); + this.fillCookies(conn, request); + } + + /** + * 添加超时时间 + * + * @param conn + */ + private void fillTimeout(HttpURLConnection conn) { + if (httpConnectionTimeOut != 0) { + conn.setConnectTimeout(httpConnectionTimeOut * 1000); + } + if (httpReadTimeOut != 0) { + conn.setReadTimeout(httpReadTimeOut * 1000); + } + } + + /** + * 指定HTTP方法 + * + * @param conn + * @param request + * @throws ProtocolException + */ + private void filleMethod(HttpURLConnection conn, HttpRequest request) throws ProtocolException { + conn.setRequestMethod(request.getHttpParams().getMethod().toUpperCase()); + } + + /** + * 添加头信息 + * + * @param conn + * @param request + */ + private void fillHeaders(HttpURLConnection conn, HttpRequest request) { + if (request.getHttpParams().getHeaders() != null) { + for (Entry entry : request.getHttpParams().getHeaders().entrySet()) { + fillHeader(conn, entry.getKey(), entry.getValue()); + } + } + } + + /** + * 添加头信息 + * + * @param conn + * @param request + */ + private void fillHeader(HttpURLConnection conn, String key, String value) { + conn.setRequestProperty(key, value); + } + + /** + * 添加Cookies + * + * @param conn + * @param request + */ + private void fillCookies(HttpURLConnection conn, HttpRequest request) { + if (request.getHttpParams().getCookies() != null) { + conn.setRequestProperty("Cookie", request.getHttpParams().getCookies()); + } + } + + /** + * 创建Http链接 + * + * @param request + * @return + * @throws NoSuchAlgorithmException + * @throws KeyManagementException + * @throws MalformedURLException + * @throws IOException + * @throws CertificateException + * @throws KeyStoreException + * @throws UnrecoverableKeyException + */ + private HttpURLConnection createConnection(HttpRequest request, String realUrl) + throws NoSuchAlgorithmException, KeyManagementException, MalformedURLException, IOException, UnrecoverableKeyException, KeyStoreException, CertificateException { + URL console = new URL(realUrl); + HttpURLConnection conn; + if (request.isHttps()) { + conn = genHttpsConn(console, request); + } else { + conn = (HttpURLConnection) console.openConnection(); + } + return conn; + } + + private HttpURLConnection genHttpsConn(URL console, HttpRequest request) + throws UnrecoverableKeyException, KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException { + SSLContext ctx = getSSLContext(request.getHttpsParams()); + HttpsURLConnection sconn = (HttpsURLConnection) console.openConnection(); + sconn.setSSLSocketFactory(ctx.getSocketFactory()); + sconn.setHostnameVerifier(new HostnameVerifier() { + public boolean verify(String hostname, SSLSession session) { + return true; + } + }); + return sconn; + } + + /** + * 获得KeyStore. + * + * @param keyStorePath + * 密钥库路径 + * @param password + * 密码 + * @return 密钥库 + * @throws KeyStoreException + * @throws IOException + * @throws CertificateException + * @throws NoSuchAlgorithmException + * @throws Exception + */ + private KeyStore getKeyStore(HttpsParams params) throws KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { + // 实例化密钥库 KeyStore用于存放证书,创建对象时 指定交换数字证书的加密标准 + // 指定交换数字证书的加密标准 + KeyStore ks = KeyStore.getInstance(params.getAlgorithm()); + // 获得密钥库文件流 + FileInputStream is = new FileInputStream(params.getKeyStorePath()); + // 加载密钥库 + ks.load(is, params.getPassword().toCharArray()); + // 关闭密钥库文件流 + is.close(); + return ks; + } + + /** + * 获得SSLSocketFactory. + * + * @param password + * 密码 + * @param keyStorePath + * 密钥库路径 + * @param trustStorePath + * 信任库路径 + * @return SSLSocketFactory + * @throws NoSuchAlgorithmException + * @throws IOException + * @throws CertificateException + * @throws KeyStoreException + * @throws UnrecoverableKeyException + * @throws KeyManagementException + * @throws Exception + */ + private SSLContext getSSLContext(HttpsParams params) throws NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException, UnrecoverableKeyException, KeyManagementException { + // 实例化SSL上下文 + SSLContext ctx = SSLContext.getInstance("TLS"); + if (params != null) { + // 实例化密钥库 KeyManager选择证书证明自己的身份 + KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()); + // 实例化信任库 TrustManager决定是否信任对方的证书 + TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm()); + // 获得密钥库 + KeyStore keyStore = getKeyStore(params); + // 初始化密钥工厂 + keyManagerFactory.init(keyStore, params.getPassword().toCharArray()); + // 获得信任库 + KeyStore trustStore = getKeyStore(params); + // 初始化信任库 + trustManagerFactory.init(trustStore); + // 初始化SSL上下文 + ctx.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), new SecureRandom()); + } else { + ctx.init(null, new TrustManager[] { myX509TrustManager }, new SecureRandom()); + } + return ctx; + } + + private TrustManager myX509TrustManager = new X509TrustManager() { + + @Override + public X509Certificate[] getAcceptedIssuers() { + return null; + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { + } + }; + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequest.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequest.java new file mode 100644 index 0000000..f6d6fc5 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequest.java @@ -0,0 +1,94 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpRequest { + + /** + * http参数 + */ + private HttpRequestParams httpParams; + + /** + * https参数 + */ + private HttpsParams httpsParams; + + /** + * 内容解析器 + */ + private HttpRequestPraser contentPraser; + + /** + * 是否https请求 + */ + private boolean isHttps; + + /** + * + */ + protected HttpRequest() { + + } + + /** + * + * @param httpParams + * http参数 + * @param contentPraser + * 内容解析器 + */ + protected HttpRequest(HttpRequestParams httpParams, HttpRequestPraser contentPraser) { + this.httpParams = httpParams; + this.contentPraser = contentPraser; + this.isHttps = false; + } + + /** + * + * @param httpParams + * http参数 + * @param httpsParams + * https参数 + * @param contentPraser + * 内容解析器 + */ + protected HttpRequest(HttpRequestParams httpParams, HttpsParams httpsParams, HttpRequestPraser contentPraser) { + this.httpParams = httpParams; + this.httpsParams = httpsParams; + this.contentPraser = contentPraser; + this.isHttps = true; + } + + public boolean isHttps() { + return isHttps; + } + + public HttpRequestParams getHttpParams() { + return httpParams; + } + + public void setHttpParams(HttpRequestParams httpParams) { + this.httpParams = httpParams; + } + + public HttpsParams getHttpsParams() { + return httpsParams; + } + + public void setHttpsParams(HttpsParams httpsParams) { + this.httpsParams = httpsParams; + } + + public HttpRequestPraser getContentPraser() { + return contentPraser; + } + + public void setContentPraser(HttpRequestPraser contentPraser) { + this.contentPraser = contentPraser; + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestBytes.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestBytes.java new file mode 100644 index 0000000..9cacdd8 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestBytes.java @@ -0,0 +1,19 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpRequestBytes extends HttpRequest { + + /** + * + * @param httpParams + * 请求参数 + */ + public HttpRequestBytes(HttpRequestParams httpParams) { + super(httpParams, new HttpRequestPraserBytes()); + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestKV.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestKV.java new file mode 100644 index 0000000..e32eb08 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestKV.java @@ -0,0 +1,22 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +import java.util.Map; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpRequestKV extends HttpRequest> { + + /** + * + * @param httpParams + * 请求参数 + */ + public HttpRequestKV(HttpRequestParams> httpParams) { + super(httpParams, new HttpRequestPraserKV()); + } + + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestParams.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestParams.java new file mode 100644 index 0000000..0a935e9 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestParams.java @@ -0,0 +1,67 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +import java.util.Map; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpRequestParams { + + private String url;// URL + private String charSet = "UTF-8";// 编码 + private String method = "GET";// Http方法 + private Map headers;// 头信息 + private String cookies;// cookie信息 + private T params;// 传输数据 + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getCharSet() { + return charSet; + } + + public void setCharSet(String charSet) { + this.charSet = charSet; + } + + public String getMethod() { + return method; + } + + public void setMethod(String method) { + this.method = method; + } + + public Map getHeaders() { + return headers; + } + + public void setHeaders(Map headers) { + this.headers = headers; + } + + public String getCookies() { + return cookies; + } + + public void setCookies(String cookies) { + this.cookies = cookies; + } + + public T getParams() { + return params; + } + + public void setParams(T params) { + this.params = params; + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestPraser.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestPraser.java new file mode 100644 index 0000000..2042e2a --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestPraser.java @@ -0,0 +1,40 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public interface HttpRequestPraser { + + /** + * 将请求参数转换为String
+ * 主要用于get方法传输 + * + * @param httpParams + * 请求参数 + * @return + */ + public String praseRqeuestContentToString(HttpRequestParams httpParams); + + /** + * 将请求参数转换为byte[]
+ * 主要用于post方法传输 + * + * @param httpParams + * 请求参数 + * @return + */ + public byte[] praseRqeuestContentToBytes(HttpRequestParams httpParams); + + /** + * 获取请求参数大小
+ * 主要用于post方法传输 + * + * @param httpParams + * 请求参数 + * @return + */ + public int praseRqeuestContentLength(HttpRequestParams httpParams); + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestPraserBytes.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestPraserBytes.java new file mode 100644 index 0000000..34fe741 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestPraserBytes.java @@ -0,0 +1,44 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +import java.io.UnsupportedEncodingException; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpRequestPraserBytes implements HttpRequestPraser { + + /** + * 请求内容字符串 + */ + private String contentString; + + @Override + public String praseRqeuestContentToString(HttpRequestParams httpParams) { + if (contentString != null) { + return contentString; + } + try { + contentString = new String(httpParams.getParams(), httpParams.getCharSet()); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return contentString; + } + + @Override + public byte[] praseRqeuestContentToBytes(HttpRequestParams httpParams) { + return httpParams.getParams(); + } + + @Override + public int praseRqeuestContentLength(HttpRequestParams httpParams) { + if (httpParams.getParams() != null) { + return httpParams.getParams().length; + } else { + return 0; + } + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestPraserKV.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestPraserKV.java new file mode 100644 index 0000000..eb48c09 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestPraserKV.java @@ -0,0 +1,71 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +import java.io.UnsupportedEncodingException; +import java.util.Map; +import java.util.Map.Entry; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpRequestPraserKV implements HttpRequestPraser> { + + /** + * 请求内容byte数组 + */ + private byte[] contentBytes; + + /** + * 请求内容字符串 + */ + private String contentString; + + @Override + public String praseRqeuestContentToString(HttpRequestParams> httpParams) { + if (contentString != null) { + return contentString; + } + Map params = httpParams.getParams(); + if (params == null || params.size() == 0) { + return null; + } + StringBuffer buffer = new StringBuffer(); + for (Entry entry : params.entrySet()) { + if (entry.getValue() != null) { + buffer.append(entry.getKey()).append("=").append(entry.getValue()).append("&"); + } + } + String param = buffer.toString(); + contentString = param.substring(0, param.length() - 1); + return contentString; + } + + @Override + public byte[] praseRqeuestContentToBytes(HttpRequestParams> httpParams) { + if (contentBytes != null) { + return contentBytes; + } + String paramStr = praseRqeuestContentToString(httpParams); + if (paramStr == null) { + return null; + } + try { + contentBytes = paramStr.getBytes(httpParams.getCharSet()); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return contentBytes; + } + + @Override + public int praseRqeuestContentLength(HttpRequestParams> httpParams) { + praseRqeuestContentToBytes(httpParams); + if (contentBytes != null) { + return contentBytes.length; + } else { + return 0; + } + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestPraserString.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestPraserString.java new file mode 100644 index 0000000..4055084 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestPraserString.java @@ -0,0 +1,46 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +import java.io.UnsupportedEncodingException; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpRequestPraserString implements HttpRequestPraser { + + /** + * 请求内容byte数组 + */ + private byte[] contentBytes; + + @Override + public String praseRqeuestContentToString(HttpRequestParams httpParams) { + return httpParams.getParams(); + } + + @Override + public byte[] praseRqeuestContentToBytes(HttpRequestParams httpParams) { + if (contentBytes != null) { + return contentBytes; + } + try { + contentBytes = httpParams.getParams().getBytes(httpParams.getCharSet()); + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + contentBytes = null; + } + return contentBytes; + } + + @Override + public int praseRqeuestContentLength(HttpRequestParams httpParams) { + praseRqeuestContentToBytes(httpParams); + if (contentBytes != null) { + return contentBytes.length; + } else { + return 0; + } + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestString.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestString.java new file mode 100644 index 0000000..0a0bf2a --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpRequestString.java @@ -0,0 +1,19 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpRequestString extends HttpRequest { + + /** + * + * @param httpParams + * 请求参数 + */ + public HttpRequestString(HttpRequestParams httpParams) { + super(httpParams, new HttpRequestPraserString()); + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponse.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponse.java new file mode 100644 index 0000000..09f4853 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponse.java @@ -0,0 +1,113 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +import java.util.List; +import java.util.Map; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpResponse { + + /** + * Http 结果代码 + */ + private HttpResultCode resultCode; + + /** + * Http链接Code + */ + private int httpCode; + + /** + * Http响应头 + */ + private Map headers; + + /** + * http响应Cookies + */ + private List cookies; + /** + * http字符集 + */ + private String charSet; + /** + * http响应数据 + */ + private T result; + + /** + * + * @param resultCode + * Http 结果代码 + * @param httpCode + * Http链接Code + * @param headers + * Http响应头 + * @param cookies + * http响应Cookies + * @param charSet + * http字符集 + * @param result + * http响应数据 + */ + public HttpResponse(HttpResultCode resultCode, int httpCode, Map headers, List cookies, String charSet, T result) { + this.resultCode = resultCode; + this.httpCode = httpCode; + this.headers = headers; + this.cookies = cookies; + this.charSet = charSet; + this.result = result; + } + + public HttpResultCode getResultCode() { + return resultCode; + } + + public void setResultCode(HttpResultCode resultCode) { + this.resultCode = resultCode; + } + + public int getHttpCode() { + return httpCode; + } + + public void setHttpCode(int httpCode) { + this.httpCode = httpCode; + } + + public Map getHeaders() { + return headers; + } + + public void setHeaders(Map headers) { + this.headers = headers; + } + + public List getCookies() { + return cookies; + } + + public void setCookies(List cookies) { + this.cookies = cookies; + } + + public String getCharSet() { + return charSet; + } + + public void setCharSet(String charSet) { + this.charSet = charSet; + } + + public T getResult() { + return result; + } + + public void setResult(T result) { + this.result = result; + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponseBytes.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponseBytes.java new file mode 100644 index 0000000..81a1e06 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponseBytes.java @@ -0,0 +1,32 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +import java.util.List; +import java.util.Map; + +/** + * @Author hujian + * @Date 2020/9/15 + * @Description + **/ +public class HttpResponseBytes extends HttpResponse { + + /** + * + * @param resultCode + * Http 结果代码 + * @param httpCode + * Http链接Code + * @param headers + * Http响应头 + * @param cookies + * http响应Cookies + * @param charSet + * http字符集 + * @param result + * http响应数据 + */ + public HttpResponseBytes(HttpResultCode resultCode, int httpCode, Map headers, List cookies, String charSet, byte[] result) { + super(resultCode, httpCode, headers, cookies, charSet, result); + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponseBytesPraser.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponseBytesPraser.java new file mode 100644 index 0000000..66a5187 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponseBytesPraser.java @@ -0,0 +1,19 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +import java.io.ByteArrayOutputStream; +import java.util.List; +import java.util.Map; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpResponseBytesPraser implements HttpResponsePraser { + + @Override + public HttpResponseBytes prase(HttpResultCode resultCode, int httpCode, Map headers, List cookies, String charSet, ByteArrayOutputStream outputStream) { + return new HttpResponseBytes(resultCode, httpCode, headers, cookies, charSet, outputStream == null ? null : outputStream.toByteArray()); + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponsePraser.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponsePraser.java new file mode 100644 index 0000000..1c96fc8 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponsePraser.java @@ -0,0 +1,32 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +import java.io.ByteArrayOutputStream; +import java.util.List; +import java.util.Map; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public interface HttpResponsePraser { + + /** + * 解析 + * + * @param resultCode + * Http 结果代码 + * @param httpCode + * Http链接Code + * @param headers + * Http响应头 + * @param cookies + * http响应Cookies + * @param charSet + * http字符集 + * @param result + * http响应数据 + */ + public T prase(HttpResultCode resultCode, int httpCode, Map headers, List cookies, String charSet, ByteArrayOutputStream outputStream); + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponseString.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponseString.java new file mode 100644 index 0000000..fd38e4a --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponseString.java @@ -0,0 +1,33 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +import java.util.List; +import java.util.Map; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpResponseString extends HttpResponse { + + /** + * + * @param resultCode + * Http 结果代码 + * @param httpCode + * Http链接Code + * @param headers + * Http响应头 + * @param cookies + * http响应Cookies + * @param charSet + * http字符集 + * @param result + * http响应数据 + */ + public HttpResponseString(HttpResultCode resultCode, int httpCode, Map headers, List cookies, String charSet, String result) { + super(resultCode, httpCode, headers, cookies, charSet, result); + } + + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponseStringPraser.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponseStringPraser.java new file mode 100644 index 0000000..08d6808 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResponseStringPraser.java @@ -0,0 +1,30 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +import java.io.ByteArrayOutputStream; +import java.io.UnsupportedEncodingException; +import java.util.List; +import java.util.Map; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpResponseStringPraser implements HttpResponsePraser { + + @Override + public HttpResponseString prase(HttpResultCode resultCode, int httpCode, Map headers, List cookies, String charSet, ByteArrayOutputStream outputStream) { + String st = null; + try { + if(outputStream != null){ + byte[] resultBytes = outputStream.toByteArray(); + st = new String(resultBytes, charSet); + } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); + } + return new HttpResponseString(resultCode, httpCode, headers, cookies, charSet, st); + } + + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResultCode.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResultCode.java new file mode 100644 index 0000000..9bd5740 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpResultCode.java @@ -0,0 +1,69 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public enum HttpResultCode { + + SUCCESS("成功", "SUCCESS"), // + ERROR_URL_NULL("URL为空", "ERROR-URL-NULL"), // + ERROR_URL("URL访问失败", "ERROR-URL"), // + ERROR_HTTPS_SSL("HTTPS异常", "ERROR-HTTPS-SSL"), // + ERROR_METHOD("HTTP方法无法识别", "ERROR-METHOD"), // + ERROR_CHARSET("编码错误", "ERROR-CHARSET"), // + ERROR_CONNECT("访问失败", "ERROR-CONNECT"), // + ERROR_TIMEOUT("访问超时", "ERROR-TIMEOUT"), // + + ; + + /** + * 名称 + */ + private String name; + /** + * 编码 + */ + private String code; + + private HttpResultCode(String name, String code) { + this.name = name; + this.code = code; + } + + public static String findNameByCode(String code) { + for (HttpResultCode oc : HttpResultCode.values()) { + if (oc.getCode().equals(code)) { + return oc.getName(); + } + } + return null; + } + + public static String findCodeByName(String name) { + for (HttpResultCode oc : HttpResultCode.values()) { + if (oc.getName().equals(name)) { + return oc.getCode(); + } + } + return null; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpsParams.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpsParams.java new file mode 100644 index 0000000..d64adea --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpsParams.java @@ -0,0 +1,47 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpsParams { + + private String password;// 密钥库密钥 + private String keyStorePath;// 密钥库文件地址 + private String trustStorePath;// 信任库文件地址 + private String algorithm;// 指定交换数字证书的加密标准:JKS + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getKeyStorePath() { + return keyStorePath; + } + + public void setKeyStorePath(String keyStorePath) { + this.keyStorePath = keyStorePath; + } + + public String getTrustStorePath() { + return trustStorePath; + } + + public void setTrustStorePath(String trustStorePath) { + this.trustStorePath = trustStorePath; + } + + public String getAlgorithm() { + return algorithm; + } + + public void setAlgorithm(String algorithm) { + this.algorithm = algorithm; + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpsRequestBytes.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpsRequestBytes.java new file mode 100644 index 0000000..7eb4a95 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpsRequestBytes.java @@ -0,0 +1,21 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpsRequestBytes extends HttpRequest { + + /** + * + * @param httpParams + * http请求参数 + * @param httpsParams + * https参数 + */ + public HttpsRequestBytes(HttpRequestParams httpParams, HttpsParams httpsParams) { + super(httpParams, httpsParams, new HttpRequestPraserBytes()); + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpsRequestKV.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpsRequestKV.java new file mode 100644 index 0000000..c15b786 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpsRequestKV.java @@ -0,0 +1,23 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +import java.util.Map; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpsRequestKV extends HttpRequest> { + + /** + * + * @param httpParams + * http请求参数 + * @param httpsParams + * https参数 + */ + public HttpsRequestKV(HttpRequestParams> httpParams, HttpsParams httpsParams) { + super(httpParams, httpsParams, new HttpRequestPraserKV()); + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpsRequestString.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpsRequestString.java new file mode 100644 index 0000000..f9b7ac8 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/util/http/HttpsRequestString.java @@ -0,0 +1,21 @@ +package com.fr.plugin.third.party.jsdjjed.util.http; + +/** + * @Author xx + * @Date 2020/9/15 + * @Description + **/ +public class HttpsRequestString extends HttpRequest { + + /** + * + * @param httpParams + * http请求参数 + * @param httpsParams + * https参数 + */ + public HttpsRequestString(HttpRequestParams httpParams, HttpsParams httpsParams) { + super(httpParams, httpsParams, new HttpRequestPraserString()); + } + +} diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/web/MainFilesComponent.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/web/MainFilesComponent.java new file mode 100644 index 0000000..25552ca --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/web/MainFilesComponent.java @@ -0,0 +1,46 @@ +package com.fr.plugin.third.party.jsdjjed.web; + +import com.fr.web.struct.Component; +import com.fr.web.struct.Filter; +import com.fr.web.struct.browser.RequestClient; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.category.StylePath; + +public class MainFilesComponent extends Component { + public static final MainFilesComponent KEY = new MainFilesComponent(); + private MainFilesComponent(){} + /** + * 返回需要引入的JS脚本路径 + * @param client 请求客户端描述 + * @return JS脚本路径 + */ + public ScriptPath script(RequestClient client ) { + //如果不需要就直接返回 ScriptPath.EMPTY + return ScriptPath.build("com/fr/plugin/third/party/jsdjadh/main.js"); + } + + /** + * 返回需要引入的CSS样式路径 + * @param client 请求客户端描述 + * @return CSS样式路径 + */ + public StylePath style(RequestClient client ) { + //如果不需要就直接返回 StylePath.EMPTY; + //return StylePath.build("com/fr/plugin/jscssinput/demo/demo.css"); + return StylePath.EMPTY; + } + + /** + * 通过给定的资源过滤器控制是否加载这个资源 + * @return 资源过滤器 + */ + public Filter filter() { + return new Filter(){ + @Override + public boolean accept() { + //任何情况下我们都在平台组件加载时加载我们的组件 + return true; + } + }; + } +} \ No newline at end of file diff --git a/src/main/java/com/fr/plugin/third/party/jsdjjed/web/MainWebResourceProvider.java b/src/main/java/com/fr/plugin/third/party/jsdjjed/web/MainWebResourceProvider.java new file mode 100644 index 0000000..dbce071 --- /dev/null +++ b/src/main/java/com/fr/plugin/third/party/jsdjjed/web/MainWebResourceProvider.java @@ -0,0 +1,19 @@ +package com.fr.plugin.third.party.jsdjjed.web; + +import com.fr.decision.fun.impl.AbstractWebResourceProvider; +import com.fr.decision.web.MainComponent; +import com.fr.web.struct.Atom; + +public class MainWebResourceProvider extends AbstractWebResourceProvider { + @Override + public Atom attach() { + //在平台主组件加载时添加我们自己的组件 + return MainComponent.KEY; + } + + @Override + public Atom client() { + //我们自己要引入的组件 + return MainFilesComponent.KEY; + } +} diff --git a/src/main/resources/com/fr/plugin/third/party/jsdjjed/feishu.js b/src/main/resources/com/fr/plugin/third/party/jsdjjed/feishu.js new file mode 100644 index 0000000..920581a --- /dev/null +++ b/src/main/resources/com/fr/plugin/third/party/jsdjjed/feishu.js @@ -0,0 +1,2464 @@ +!(function () { + Dec.jsdjjed = Dec.jsdjjed || {}; + BI.extend(Dec.jsdjjed, { + reqAddApp: function (e, t) { + Dec.reqPost("/url/jsdjjed/add/app", e, t) + }, + reqAppsByPage: function (e, t, i) { + return Dec.reqGet("/url/jsdjjed/query/app?" + Dec.Utils.transformObject2URLParam(e, null, !1), {}, t, i) + }, + reqEditApp: function (e, t) { + Dec.reqPut("/url/jsdjjed/edit/app", e, t) + }, + deleteAppsByIds: function (e, t) { + Dec.reqDelete("/url/jsdjjed/delete/app", { + removeUserIds: e + }, t) + }, + forbidApp: function (e, t) { + Dec.reqPut("/url/jsdjjed/forbid/app", e, t) + }, + getAppConfig: function (e) { + Dec.reqGetHandle("/url/jsdjjed/query/config/app", "", e) + }, + + saveAppConfig: function (e, t) { + Dec.reqPut("/url/jsdjjed/save/config/app", e, t) + }, + reqChatGroup: function (e, t, i) { + return Dec.reqGet("/url/jsdjjed/query/chat/group?" + Dec.Utils.transformObject2URLParam(e, null, !1), {}, t, i) + }, + isStatusSuccess: function (e) { + if (e.status && e.status == "success") { + return true; + } + return false; + }, + getValidItemsData: function (e) { + if (e.data && e.data.items) { + return e.data.items; + } + return []; + }, + getSyncSource: function (e, t) { + return Dec.reqGet("/url/jsdjjed/synchronize/source", "", t) + } + + }); + + var feishuAppModelAllRow = BI.inherit(Fix.Model, { + context: ["rows", "currentPage", "isAllChecked", "filter", "syncConfigs", "selectedValues", "userManagementConfigs"], + computed: { + keywordMap: function () { + var e = {}; + return BI.isEmptyString(this.model.filter.searchBy) ? e = { + username: this.model.filter.keyword, + realName: this.model.filter.keyword + } : (e[this.model.filter.searchBy] = this.model.filter.keyword, + e) + }, + selected: function () { + return BI.some(this.model.selectedValues, function (e, t) { + return t === this.options.id + }, this) + } + }, + actions: { + disableUser: function (i, n) { + var t = this; + Dec.jsdjjed.forbidApp({ + enable: i, + id: n + }, function (e) { + BI.some(t.model.rows, function (e, t) { + if (t.id === n) + return t.enable = i, + !0 + }), + t.model.rows.splice(0, 0) + }) + }, + changeSelected: function (i) { + var n = this; + i ? this.model.selectedValues.push(this.options.id) : BI.remove(this.model.selectedValues, this.options.id), + BI.some(n.model.rows, function (e, t) { + if (t.id === n.options.id) + return t.selected = i, + !0 + }), + this.model.isAllChecked = BI.every(this.model.rows, function (e, t) { + return BI.contains(n.model.selectedValues, t.id) || !t.enableCheck + }) + } + } + }); + //BI.model("dec.model.user.all.row", feishuAppModelAllRow); + BI.model("dec.model.jsdjjed.feishu.app.all.row", feishuAppModelAllRow); + + var feishuAppEditItemConfigId = BI.inherit(BI.Widget, { + props: { + editControll: {}, + userInfo: {} + }, + render: function () { + var e = this.options + , t = e.userInfo; + e.editControll; + return { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + width: 90, + textAlign: "left", + text: "应用唯一标识" + }, { + el: { + type: "bi.label", + cls: "bi-border bi-border-radius", + width: 420, + height: 22, + value: t.configId, + textAlign: "left", + disabled: !0, + lgap: 4 + } + }] + } + }, + getValue: function () { + return {} + } + }); + BI.shortcut("dec.jsdjjed.feishu.app.edit_app.item.configId", feishuAppEditItemConfigId); + + var feishuAppEditItemNotes = BI.inherit(BI.Widget, { + props: { + editControll: {}, + userInfo: {} + }, + render: function () { + var t = this + , e = this.options + , i = e.userInfo + , e = e.editControll; + return { + type: "dec.form.editor", + $value: "real-name", + textWidth: 90, + editorWidth: 420, + invisible: !e.enableEditInfo, + text: "应用说明", + watermark: "应用说明", + value: i.notes, + el: { + disabled: e.userInfoReadOnly + }, + name: "notes", + rules: { + max: DecCst.STRING_SHORT_TEXT_LENGTH + }, + ref: function (e) { + t.notes = e + } + } + }, + getValidations: function () { + return this.notes.getValidations() + }, + showError: function (e) { + this.notes.showError(e) + }, + hideError: function () { + this.notes.hideError() + }, + getValue: function () { + return { + notes: this.notes.getValue() + } + } + }); + BI.shortcut("dec.jsdjjed.feishu.app.edit_user.item.notes", feishuAppEditItemNotes); + var feishuAppEditItemloginMap = BI.inherit(BI.Widget, { + props: { + editControll: {}, + userInfo: {} + }, + render: function () { + var t = this + , e = this.options + , i = e.userInfo + , e = e.editControll; + return { + type: "dec.form.editor", + $value: "real-name", + textWidth: 90, + editorWidth: 420, + invisible: !e.enableEditInfo, + text: "单点映射字段", + watermark: "单点映射字段", + value: i.loginMap, + el: { + disabled: e.userInfoReadOnly + }, + name: "loginMap", + rules: { + max: DecCst.STRING_SHORT_TEXT_LENGTH + }, + ref: function (e) { + t.loginMap = e + } + } + }, + getValidations: function () { + return this.loginMap.getValidations() + }, + showError: function (e) { + this.loginMap.showError(e) + }, + hideError: function () { + this.loginMap.hideError() + }, + getValue: function () { + return { + loginMap: this.loginMap.getValue() + } + } + }); + BI.shortcut("dec.jsdjjed.feishu.app.edit_user.item.loginMap", feishuAppEditItemloginMap); + + var feishuAppEditItemAppId = BI.inherit(BI.Widget, { + props: { + editControll: {}, + userInfo: {} + }, + render: function () { + var t = this + , e = this.options + , i = e.userInfo + , e = e.editControll; + return { + type: "dec.form.editor", + $value: "real-name", + textWidth: 90, + editorWidth: 420, + invisible: !e.enableEditInfo, + text: "APP ID", + watermark: "APP ID", + value: i.appId, + el: { + disabled: e.userInfoReadOnly + }, + name: "appId", + rules: { + required: { + message: "APP ID不能为空" + }, + max: DecCst.STRING_SHORT_TEXT_LENGTH + }, + ref: function (e) { + t.appId = e + } + } + }, + getValidations: function () { + return this.appId.getValidations() + }, + showError: function (e) { + this.appId.showError(e) + }, + hideError: function () { + this.appId.hideError() + }, + getValue: function () { + return { + appId: this.appId.getValue() + } + } + }); + BI.shortcut("dec.jsdjjed.feishu.app.edit_user.item.appid", feishuAppEditItemAppId); + + var feishuAppEditItemAppSecret = BI.inherit(BI.Widget, { + props: { + editControll: {}, + userInfo: {} + }, + render: function () { + var t = this + , e = this.options + , i = e.userInfo + , e = e.editControll; + return { + type: "dec.form.editor", + $value: "real-name", + textWidth: 90, + editorWidth: 420, + invisible: !e.enableEditInfo, + text: "APP Secret", + watermark: "APP Secret", + value: i.appSecret, + el: { + disabled: e.userInfoReadOnly + }, + name: "appSecret", + rules: { + required: { + message: "APP Secret不能为空" + }, + max: DecCst.STRING_SHORT_TEXT_LENGTH + }, + ref: function (e) { + t.appSecret = e + } + } + }, + getValidations: function () { + return this.appSecret.getValidations() + }, + showError: function (e) { + this.appSecret.showError(e) + }, + hideError: function () { + this.appSecret.hideError() + }, + getValue: function () { + return { + appSecret: this.appSecret.getValue() + } + } + }); + BI.shortcut("dec.jsdjjed.feishu.app.edit_user.item.appSecret", feishuAppEditItemAppSecret); + + var feishuAppEditPopupModel = BI.inherit(Fix.Model, { + state: function () { + return {} + }, + computed: {}, + actions: { + editUser: function (t, i) { + var n = this + , e = this.options + , o = e.editControll + , s = e.info.id + , e = (t.id = e.info.id, t.configId = e.info.configId, + this._updateBaseUserInfo(o, t)); + Dec.jsdjjed.reqEditApp(e, function (e) { + if (BI.isNotNull(e.errorCode)) + return e.errorCode === DecCst.ErrorCode.HISTORY_PASSWORD_LIMIT ? BI.Msg.toast(BI.i18nText("Dec-Error_Reset_Password"), { + level: "error" + }) : BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Fail"), { + level: "error" + }), + void i(!0); + t.id === Dec.personal.userId && BI.set(Dec, ["UserInfo", "displayName"], t.realName), + BI.Msg.toast(BI.i18nText("Dec-Basic_Success_Save"), { + level: "success" + }), + n.options.onEdit(t, s), + i(!0) + }) + } + }, + _updateBaseUserInfo: function (e, t, i) { + return e.enableEditInfo ? t : BI.extend(t, { + notes: null, + appId: null, + appSecret: null, + loginMap: null + }) + }, + _updateRoleInfo: function (e, t, i) { + return e.roleEditable ? t : BI.extend(t, { + roleIds: null + }) + }, + _updateDepostInfo: function (e, t, i) { + return e.depostEditable ? t : BI.extend(t, { + departmentPostIds: null + }) + }, + _resetPasswordInfo: function (e, t, i) { + return e.passwordEditable && t.resetPassword ? BI.extend(t, { + resetPassword: !0, + password: t.password + }) : BI.extend(t, { + resetPassword: !1 + }) + } + }); + BI.model("dec.model.jsdjjed.feishu.app.edit.popup", feishuAppEditPopupModel); + + + var feishuAppEditPopup = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-edit-user-popup", + onClickConfirm: BI.emptyFn, + info: {}, + onEdit: BI.emptyFn, + editControll: { + roleEditable: !0, + depostEditable: !0, + passwordEditable: !0, + enableEditInfo: !0, + userInfoReadOnly: !1 + } + }, + _store: function () { + return BI.Models.getModel("dec.model.jsdjjed.feishu.app.edit.popup", this.options) + }, + watch: {}, + render: function () { + var e = this; + return { + type: "bi.vtape", + items: [{ + el: this._rebuildCenter() + }, { + type: "bi.right_vertical_adapt", + lgap: 10, + height: 44, + items: [{ + type: "bi.button", + text: BI.i18nText("Dec-Basic_Cancel"), + level: "ignore", + handler: function () { + e._close() + } + }, { + type: "bi.button", + text: BI.i18nText("Dec-Basic_Sure"), + handler: function () { + e._end() + } + }] + }] + } + }, + _rebuildCenter: function () { + var t = this + , i = this.options.editControll + , n = this.options.info + , e = [{ + type: "dec.jsdjjed.feishu.app.edit_app.item.configId" + }]; + return e.push({ + type: "dec.jsdjjed.feishu.app.edit_user.item.notes" + }), + e.push({ + type: "dec.jsdjjed.feishu.app.edit_user.item.appid" + }), + e.push({ + type: "dec.jsdjjed.feishu.app.edit_user.item.appSecret" + }), + e.push({ + type: "dec.jsdjjed.feishu.app.edit_user.item.loginMap" + }), + BI.each(e, function (e, t) { + BI.extend(t, { + editControll: i, + userInfo: n + }) + }), + { + type: "bi.vertical", + items: [{ + el: { + type: "bi.htape", + cls: "bi-tips", + height: 36, + items: [{ + type: "bi.vertical", + items: [{ + type: "bi.label", + textAlign: "left", + text: BI.i18nText("Dec-Basic_Tip") + ":" + }], + width: 40 + }, { + type: "bi.vertical", + items: [{ + type: "bi.label", + whiteSpace: "normal", + textAlign: "left", + text: "请输入有效的App ID和App Secret" + }] + }] + }, + bgap: 15 + }, { + el: { + type: "bi.form", + cls: "dec-add-user-popup", + layouts: [{ + type: "bi.vertical", + bgap: 15 + }], + ref: function (e) { + t.form = e + }, + items: e + } + }] + } + }, + getValue: function () { + var i = {}; + return BI.each(this.form.getValue(), function (e, t) { + BI.extend(i, t) + }), + i + }, + _close: function () { + this.fireEvent("EVENT_CLOSE") + }, + _end: function () { + var t = this; + this.options; + this.form.submit(function () { + t.store.editUser(t.getValue(), function (e) { + e && t._close() + }) + }) + }, + _generatePassword: function () { + return Dec.Utils.generateRandomString(6) + } + }); + feishuAppEditPopup.EVENT_CLICK_CONFIRM = "EVENT_CONFIRM"; + //BI.shortcut("dec.user.edit.popup", e); + BI.shortcut("dec.jsdjjed.feishu.app.edit.popup", feishuAppEditPopup); + + + var feishuAppRowTools = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-user-row-tools", + enable: !0, + info: {}, + enableEdit: !1, + limited: !1, + enableDelete: !1, + enableDisable: !0, + editControll: {} + }, + render: function () { + var t = this + , i = this.options + , n = i.editControll; + return { + type: "bi.grid", + columns: 3, + rows: 1, + items: [{ + column: 0, + row: 0, + el: { + type: "bi.icon_button", + $value: "edit-user", + cls: "normal-edit-font dec-user-row-tools-button", + title: BI.i18nText("Dec-Basic_Edit"), + stopPropagation: !0, + invisible: !n.enableEdit, + handler: function () { + var e = { + type: "dec.jsdjjed.feishu.app.edit.popup", + onClickConfirm: function (e, t) { + i.onEdit(e, t) + }, + onEdit: i.onEdit, + info: i.infoGetter(), + editControll: n, + listeners: [{ + eventName: "EVENT_CLOSE", + action: function () { + BI.Popovers.remove(t.getName() + "edit") + } + }] + }; + BI.Popovers.create(t.getName() + "edit", { + type: "bi.popover", + header: "编辑飞书应用", + body: e, + width: 550, + height: 500, + listeners: [{ + eventName: "EVENT_CLOSE", + action: function () { + BI.Popovers.remove(t.getName() + "edit") + } + }] + }).open(t.getName() + "edit") + } + } + }, { + column: 1, + row: 0, + el: { + type: "bi.center_adapt", + invisible: !n.enableDisable, + items: [{ + type: "dec.bubble.combo", + disabled: i.limited, + el: { + type: "bi.icon_change_button", + $testId: "dec-icon-button", + $value: i.enable ? "disable-user" : "enable-user", + iconCls: "dec-user-row-tools-button " + (i.enable ? "disable-user-font" : "enable-user-font"), + ref: function (e) { + t.iconChangeButton = e + }, + title: function () { + return i.enable ? "禁用登录验证" : "启用登录验证" + }, + selected: !!i.enable + }, + text: function () { + return i.enable ? "确认禁用该登录验证?" : "确认启用该登录验证?" + }, + onClickConfirm: function () { + i.enable = !i.enable; + t.iconChangeButton.setIcon(i.enable ? "disable-user-font" : "enable-user-font"); + i.onDisable(i.enable); + this.hideView(); + } + }] + } + }, { + column: 2, + row: 0, + el: { + type: "bi.center_adapt", + invisible: !n.enableDelete, + items: [{ + type: "dec.bubble.combo", + disabled: i.limited, + el: { + type: "bi.icon_button", + $value: "delete-user", + cls: "delete-user-font dec-user-row-tools-button", + title: BI.i18nText("Dec-Basic_Delete") + }, + text: "确认删除该应用?", + onClickConfirm: function () { + this.hideView(), + i.onDelete() + } + }] + } + }] + } + } + }); + feishuAppRowTools.EVENT_DELETE = "EVENT_DELETE"; + //BI.shortcut("dec.user.row.tools", e) + BI.shortcut("dec.jsdjjed.feishu.app.row.tools", feishuAppRowTools); + + var feishuAppTableRow = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-user-table-row bi-border-bottom", + columnSize: [50, "fill", 100], + userInfo: {}, + value: BI.UUID() + }, + _store: function () { + return BI.Models.getModel("dec.model.jsdjjed.feishu.app.all.row", this.options) + }, + watch: { + selected: function (e) { + this.setSelected(e) + } + }, + render: function () { + var e = this.options; + return { + type: "bi.htape", + $testId: "dec-user-table-row", + $value: e.userInfo.username, + columnSize: e.columnSize, + items: this._formatItem(e.userInfo) + } + }, + _formatItem: function (e) { + var t = this + , i = this.options + , n = [] + , o = this.model.keywordMap; + return n.push({ + type: "bi.center_adapt", + width: 50, + height: i.height, + items: [{ + type: "bi.checkbox", + $testId: "dec-user-row-checkbox", + $value: e.username, + ref: function (e) { + t.checkbox = e + }, + disabled: !e.enableCheck, + selected: e.selected, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + t.store.changeSelected(this.isSelected()) + } + }] + }] + }), + n.push({ + el: { + type: "bi.htape", + height: i.height, + scrollable: !1, + disabled: !e.enable, + items: [{ + el: { + type: "bi.label", + ref: function (e) { + t.configId = e + }, + scrollable: !1, + textAlign: "left", + text: e.configId, + $testId: "dec-user-row-username", + $value: e.configId, + keyword: o.configId, + title: function () { + return e.configId + }, + rgap: 10, + height: i.height + }, + width: .15 + }, { + el: { + type: "bi.label", + ref: function (e) { + t.notes = e + }, + scrollable: !1, + textAlign: "left", + text: e.notes, + $testId: "dec-user-row-real-name", + $value: e.notes, + keyword: o.notes, + title: function () { + return e.notes + }, + rgap: 10, + height: i.height + }, + width: .2 + }, { + el: { + type: "bi.label", + ref: function (e) { + t.appId = e + }, + textAlign: "left", + text: e.appId, + $testId: "dec-user-row-depost-names", + $value: e.appId, + title: function () { + return e.appId + }, + rgap: 10, + height: i.height + }, + width: .15 + }, { + el: { + type: "bi.label", + ref: function (e) { + t.appSecret = e + }, + textAlign: "left", + text: e.appSecret, + $testId: "dec-user-row-role-names", + $value: e.appSecret, + title: function () { + return e.appSecret + }, + rgap: 10, + height: i.height + }, + width: .15 + }, { + el: { + type: "bi.label", + ref: function (e) { + t.loginMap = e + }, + scrollable: !1, + textAlign: "left", + text: e.loginMap, + $testId: "dec-user-row-real-name", + $value: e.loginMap, + keyword: o.loginMap, + title: function () { + return e.loginMap + }, + rgap: 10, + height: i.height + }, + width: .15 + }, + { + el: { + type: "bi.label", + ref: function (e) { + t.enable = e + }, + textAlign: "left", + text: e.enable ? BI.i18nText("Dec-User_Enabled") : BI.i18nText("Dec-User_Disabled"), + $testId: "dec-user-row-enable", + $value: e.enable, + rgap: 10, + height: i.height + }, + width: .07 + }] + } + }), + (n = BI.concat(n, this._createExtraItems(e))).push(BI.extend({}, e, { + type: "dec.jsdjjed.feishu.app.row.tools", + width: 100, + $scope: e.username, + infoGetter: function () { + return e + }, + onDelete: function () { + t.options.onDelete([e.id]) + }, + onEdit: i.onEdit, + onDisable: function (e) { + t.store.disableUser(e, t.getValue()) + } + })), + n + }, + _createExtraItems: function (i) { + var n = [] + , e = BI.Providers.getProvider("dec.provider.all_user").getExtraAttributes(); + return BI.each(e, function (e, t) { + BI.isKey(t.column) ? n.push(BI.extend({ + type: t.column, + width: t.width + }, i)) : BI.isFunction(t.column) ? n.push(BI.extend({ + width: t.width + }, t.column(i))) : n.push({ + type: "bi.layout", + width: t.width + }) + }), + n + }, + isSelected: function () { + return this.checkbox.isSelected() + }, + getValue: function () { + return this.options.userInfo.id + }, + setSelected: function (e) { + this.options.userInfo.enableCheck && this.checkbox.setSelected(e) + } + }); + feishuAppTableRow.EVENT_DELETE = "EVENT_DELETE"; + //BI.shortcut("dec.user.table.row", feishuAppTableRow); + BI.shortcut("dec.jsdjjed.feishu.app.table.row", feishuAppTableRow); + + + var feishuAppAddPopupModel = BI.inherit(Fix.Model, { + state: function () { + return {} + }, + computed: { + passwordValue: function () { + return this.options.passwordEditable ? "" : "123456" + } + }, + actions: { + addApp: function (e, t) { + function i() { + Dec.jsdjjed.reqAddApp(e, function (e) { + t(e) + }) + } + + BI.isFunction(this.options.beforeAddUser) ? this.options.beforeAddUser(i) : i() + } + } + }); + //BI.model("dec.model.user.add.popup", e); + BI.model("dec.model.jsdjjed.feishu.app.add.popup", feishuAppAddPopupModel); + + + var feishuAppAddPopup = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-add-user-popup", + passwordEditable: !0, + cleanDataSet: !1 + }, + _store: function () { + return BI.Models.getModel("dec.model.jsdjjed.feishu.app.add.popup", this.options) + }, + watch: {}, + render: function () { + var e = this; + return { + type: "bi.vtape", + items: [{ + el: this.rebuildCenter() + }, { + type: "bi.right_vertical_adapt", + height: 44, + lgap: 10, + items: [{ + type: "bi.button", + text: BI.i18nText("Dec-Basic_Cancel"), + level: "ignore", + handler: function () { + e.close() + } + }, { + type: "bi.button", + text: BI.i18nText("Dec-Basic_Sure"), + handler: function () { + e.end() + } + }] + }] + } + }, + rebuildCenter: function () { + var t = this + , e = this.options + , i = { + type: "dec.form.editor", + $value: "configId", + textWidth: 90, + text: "应用唯一标识", + watermark: BI.i18nText("Dec-Please_Input"), + editorWidth: 420, + rules: { + required: { + message: "应用唯一标识不能为空" + }, + max: DecCst.STRING_SHORT_TEXT_LENGTH + }, + ref: function (e) { + t.configId = e + } + } + , n = { + type: "dec.form.editor", + $value: "notes", + textWidth: 90, + text: "应用说明", + watermark: BI.i18nText("Dec-Please_Input"), + editorWidth: 420, + rules: { + max: DecCst.STRING_SHORT_TEXT_LENGTH + }, + ref: function (e) { + t.notes = e + } + } + , e = { + type: "dec.form.editor", + $value: "appId", + textWidth: 90, + text: "App ID", + watermark: BI.i18nText("Dec-Please_Input"), + editorWidth: 420, + rules: { + required: { + message: "App ID不能为空" + }, + max: DecCst.STRING_SHORT_TEXT_LENGTH + }, + ref: function (e) { + t.appId = e + } + } + , o = { + type: "dec.form.editor", + $value: "appSecret", + textWidth: 90, + text: "App Secret", + watermark: BI.i18nText("Dec-Please_Input"), + editorWidth: 420, + rules: { + required: { + message: "App Secret不能为空" + }, + max: DecCst.STRING_SHORT_TEXT_LENGTH + }, + ref: function (e) { + t.appSecret = e + } + }, + + n1 = { + type: "dec.form.editor", + $value: "loginMap", + textWidth: 90, + text: "单点映射字段", + watermark: BI.i18nText("Dec-Please_Input"), + editorWidth: 420, + rules: { + max: DecCst.STRING_SHORT_TEXT_LENGTH + }, + ref: function (e) { + t.loginMap = e + } + } + ; + return { + type: "bi.form", + cls: "dec-add-user-popup", + layouts: [{ + type: "bi.vertical", + bgap: 15 + }], + ref: function (e) { + t.form = e + }, + items: [{ + type: "bi.htape", + cls: "bi-tips", + height: 36, + items: [{ + type: "bi.vertical", + items: [{ + type: "bi.label", + textAlign: "left", + text: BI.i18nText("Dec-Basic_Tip") + ":" + }], + width: 40 + }, { + type: "bi.vertical", + items: [{ + type: "bi.label", + whiteSpace: "normal", + textAlign: "left", + text: "请输入有效的App ID和App Secret" + }] + }] + }, i, n, e, o, n1] + } + }, + getValue: function () { + return BI.extend({ + configId: this.configId.getValue(), + notes: this.notes.getValue(), + appId: this.appId.getValue(), + appSecret: this.appSecret.getValue(), + loginMap: this.loginMap.getValue() + }) + }, + close: function () { + this.fireEvent(i.EVENT_CLOSE) + }, + end: function () { + var t = this; + this.form.submit(function () { + t.store.addApp(t.getValue(), function (e) { + if (e.status && e.status === "success") { + t.fireEvent(feishuAppAddPopup.EVENT_CLICK_CONFIRM); + return; + } + var msg = e.msg; + if (e.errorCode && e.errorMsg) { + msg = "内部错误,请核实日志"; + } + BI.Msg.toast(msg, {level: "error"}); + }) + }) + } + }); + feishuAppAddPopup.EVENT_CLICK_CONFIRM = "EVENT_CONFIRM"; + feishuAppAddPopup.EVENT_CLOSE = "EVENT_CLOSE"; + BI.shortcut("dec.jsdjjed.feishu.app.add.popup", feishuAppAddPopup); + + + var feishuAppAdd = BI.inherit(BI.Widget, { + props: { + baseCls: "" + }, + _store: function () { + return BI.Models.getModel("dec.model.users.operations.add") + }, + watch: { + addButtonVisible: function (e) { + this.addBtn.setVisible(e) + } + }, + render: function () { + var t = this; + return { + type: "bi.icon_text_item", + value: "add", + logic: { + dynamic: !0 + }, + $point: "dec-users-operations-add", + text: "添加飞书应用", + height: 24, + cls: "add-user-font operation-item", + invisible: !this.model.addButtonVisible, + handler: function () { + t._createAddLayer() + }, + ref: function (e) { + t.addBtn = e + } + } + }, + _createAddLayer: function (e) { + var t = this + , e = { + type: "dec.jsdjjed.feishu.app.add.popup", + passwordEditable: this.model.passwordEditable, + beforeAddUser: e, + listeners: [{ + eventName: "EVENT_CLOSE", + action: function () { + BI.Popovers.remove(t.getName() + "add") + } + }, { + eventName: "EVENT_CONFIRM", + action: function () { + t.fireEvent("EVENT_CHANGE"), + BI.Popovers.remove(t.getName() + "add") + } + }] + }; + BI.Popovers.create(t.getName() + "add", { + type: "bi.popover", + header: "添加飞书应用", + body: e, + width: 550, + height: 500, + listeners: [{ + eventName: "EVENT_CLOSE", + action: function () { + BI.Popovers.remove(t.getName() + "add") + } + }] + }).open(t.getName() + "add") + } + }); + BI.shortcut("dec.jsdjjed.feishu.app.operations.add", feishuAppAdd); + + var feishuAppTableHeaders = [{ + type: "bi.label", + text: "应用唯一标识", + fieldName: "userAlias", + width: .15 + }, { + type: "bi.label", + text: "应用说明", + fieldName: "realAlias", + width: .2 + }, { + type: "bi.label", + text: "App ID", + width: .15 + }, { + type: "bi.label", + text: "App Secret", + width: .15 + }, { + type: "bi.label", + text: "单点映射字段", + width: .15 + }, { + type: "dec.user.table.header.enable", + text: "登录验证", + width: .07 + }]; + //BI.constant("dec.constant.user.table.headers", e); + BI.constant("dec.constant.jsdjjed.feishu.app.table.headers", feishuAppTableHeaders); + + var feishuAppTable = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-user-table", + $testId: "dec-user-table", + columnSize: [50, "fill", 100], + headerRowSize: 32, + rowSize: 36, + pager: {}, + perPage: 10, + header: [], + items: [] + }, + _store: function () { + return BI.Models.getModel("dec.model.user.all.table") + }, + watch: { + isAllChecked: function () { + this.header.setSelected(this.model.isAllChecked) + } + }, + render: function () { + var i = this + , t = this.options; + return { + type: "bi.vertical", + items: [{ + type: "dec.user.table.header", + ref: function (e) { + i.header = e + }, + columnSize: t.columnSize, + items: BI.Constants.getConstant("dec.constant.jsdjjed.feishu.app.table.headers"), + height: t.headerRowSize, + onSortChange: function (e, t) { + i.store.onSortChange(e, t) + }, + listeners: [{ + eventName: BI.Controller.EVENT_CHANGE, + action: function (e, t) { + i.store.handleCheckAll(t) + } + }] + }, { + type: "bi.button_group", + ref: function (e) { + i.table = e + }, + chooseType: 1, + layouts: [{ + type: "bi.vertical" + }], + items: [] + }, { + el: { + type: "dec.pager", + ref: function (e) { + i.pager = e + }, + height: 30, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + var e = this.getCurrentPage && this.getCurrentPage(); + t.itemsCreator({ + page: e + }, function (e) { + i.populate(e) + }) + } + }] + }, + vgap: 10 + }] + } + }, + _formatItems: function (e) { + var i = this + , n = this.options; + return BI.map(e, function (e, t) { + return { + type: "dec.jsdjjed.feishu.app.table.row", + id: t.id, + cls: BI.isOdd(e) ? "odd" : "even", + userInfo: t, + columnSize: n.columnSize, + height: n.rowSize, + onDelete: function (e) { + i.fireEvent(feishuAppTable.EVENT_DELETE, e) + }, + onEdit: n.onEdit + } + }) + }, + setCount: function (e) { + this.pager.setCount(e), + this.setAllPages(Math.ceil(e / this.options.perPage)) + }, + setAllPages: function (e) { + this.pager.setAllPages(e) + }, + setPage: function (e) { + this.pager.setPage(e) + }, + getValue: function () { + return this.table.getValue() + }, + empty: function () { + this.header.setSelected(!1) + }, + populate: function (e) { + this.table.populate(this._formatItems(e)) + } + }); + feishuAppTable.EVENT_DELETE = "EVENT_DELETE"; + BI.shortcut("dec.jsdjjed.feishu.app.table", feishuAppTable); + + + var feishuAppModel = BI.inherit(Fix.Model, { + state: function () { + return { + rows: [], + allCount: 0, + currentPage: 0, + isAllChecked: !1, + sortBy: "userAlias", + asc: !0, + filter: { + searchBy: "", + keyword: "" + }, + enable: DecCst.User.Available.ALL, + syncSourceType: 0, + syncConfigs: { + turnOn: !1, + strategy: DecCst.User.SyncUserStrategy.FULL_COVER + }, + perPage: 1e3, + selectedValues: [], + creationType: DecCst.User.CreationType.ALL + } + }, + childContext: ["rows", "currentPage", "allCount", "isAllChecked", "sortBy", "asc", "filter", "enable", "syncSourceType", "syncConfigs", "perPage", "selectedValues", "creationType"], + context: ["userManagementConfigs"], + computed: { + allPages: function () { + return Math.ceil(this.model.allCount / this.model.perPage) + }, + searching: function () { + return BI.isKey(this.model.filter.keyword) + } + }, + watch: { + "sortBy || asc": function () { + this.initData() + }, + "filter.keyword || creationType": function () { + this.initData() + }, + enable: function () { + this.initData() + }, + perPage: function () { + this.initData() + } + }, + created: function () { + this._bindEvents() + }, + destroyed: function () { + this._releaseEvents() + }, + actions: { + initConfigs: function (e) { + var t = this, + i = BI.after(2, function () { + BI.isFunction(e) && e() + }); + + t.model.syncSourceType = 0; + var tempData = '{"data":{"turnOn":false,"rate":43200,"schedule":{"type":"2","cron":"","rate":43200,"unit":1},"dataSetName":"","usernameColumn":-1,"userIdColumn":-1,"realNameColumn":-1,"passwordColumn":-1,"encryption":0,"customEncrypt":"","departmentColumn":-1,"departmentIdColumn":-1,"postColumn":-1,"postIdColumn":-1,"roleColumn":-1,"roleIdColumn":-1,"emailColumn":-1,"mobileColumn":-1,"keepOtherSourceSameData":true,"strategy":0,"sourceConflictStrategy":1,"syncSource":{"@class":"com.fr.decision.sync.source.impl.DefaultSyncSource","type":0}}}'; + var tempJson = JSON.parse(tempData); + BI.extend(t.model.syncConfigs, tempJson.data); + i(); + + /*Dec.jsdjjed.getSyncSource(null, function (e) { + e = e.data.type; + t.model.syncSourceType = e; + //e = BI.Services.getService("dec.service.users.sync").getSyncSourceInfo(e, !0); + //e && e.service.getSyncConfigs(function (e) { + BI.extend(t.model.syncConfigs, e.data), + i() + }) + }),*/ + BI.Services.getService("dec.service.global").initUsebleModules(i); + }, + initData: function () { + var t = this; + this.resetState(), + Dec.jsdjjed.reqAppsByPage({ + page: 1, + sortBy: this.model.sortBy, + asc: this.model.asc, + count: this.model.perPage, + keyword: this.model.filter.keyword, + searchBy: this.model.filter.searchBy, + enable: this.model.enable, + creationType: this.model.creationType + }, function (e) { + t._injectUserAttributes(e.data.items, function () { + t.model.allCount = e.data.total, + t.model.currentPage = e.data.page, + t.model.rows = t._packageRows(e.data.items) + }) + }) + } + + , + getUsersByPage: function (e) { + var t = this; + this.resetState(), + Dec.jsdjjed.reqAppsByPage({ + page: e, + sortBy: this.model.sortBy, + count: this.model.perPage, + asc: this.model.asc, + keyword: this.model.filter.keyword, + searchBy: this.model.filter.searchBy, + enable: this.model.enable, + creationType: this.model.creationType + }, function (e) { + t._injectUserAttributes(e.data.items, function () { + t.model.rows = t._packageRows(e.data.items), + t.model.allCount = e.data.total, + t.model.currentPage = e.data.page + }) + }) + } + , + deleteUsers: function (e) { + var t = this; + Dec.jsdjjed.deleteAppsByIds(e, function (e) { + t.onDeleteUsers(e) + }) + } + , + onEditUser: function (e, t) { + this.initData() + } + , + onDeleteUsers: function (e) { + e.data.count === this.model.rows.length ? this.getUsersByPage(1 === this.model.currentPage ? 1 : this.model.currentPage - 1) : this.getUsersByPage(this.model.currentPage) + } + , + onClearUsers: function () { + this.model.isAllChecked = !1, + this.model.selectedValues = [], + this.model.allCount = 0, + this.model.rows = [], + this.model.currentPage = 1, + this.initData() + } + , + updateUserListHeight: function (e) { + this.model.perPage = BI.max([2, Math.floor(e / 36)]) + } + , + resetState: function () { + this.model.isAllChecked = !1, + this.model.selectedValues = [] + } + , + changeUserSource: function (e) { + this.model.creationType = e + } + }, + _packageRows: function (e) { + var o = this + , s = BI.Services.getService("dec.service.global"); + return BI.each(e, function (e, t) { + var i = t.creationType === DecCst.User.CreationType.SYNC + , n = {}; + t.keyword = o.model.filter.keyword, + t.limited = BI.Services.getService("dec.service.user.management").isLimitedUser(t), + t.enableCheck = !i && !t.limited, + n.enableEdit = s.checkModulesUseable("decision-management-user-edit"), + n.enableEditInfo = s.checkModulesUseable("decision-management-user-edit-edit-info"), + n.userInfoReadOnly = i && o.model.syncConfigs.strategy === DecCst.User.SyncUserStrategy.FULL_COVER, + n.enableDelete = s.checkModulesUseable("decision-management-user-delete") && !i, + n.enableDisable = s.checkModulesUseable("decision-management-user-forbidden"), + n.roleEditable = n.depostEditable = s.checkModulesUseable("decision-management-user-edit-dep-role"), + n.passwordEditable = s.checkModulesUseable("decision-management-user-edit-reset-password") && (i ? o.model.userManagementConfigs.syncOperationType.type === DecCst.System.Info.AuthenticType.DEFAULT && o.model.syncConfigs.strategy === DecCst.User.SyncUserStrategy.INCREMENTAL_UPDATE : o.model.userManagementConfigs.manualOperationType.type === DecCst.System.Info.AuthenticType.DEFAULT), + t.editControll = n + }), + BI.remove(e, function (e, t) { + return BI.Services.getService("dec.service.user.management").checkAdmin(t) + }), + e + } + , + _injectUserAttributes: function (i, e) { + var n, t = BI.Providers.getProvider("dec.provider.all_user").getExtraAttributes(); + BI.isEmptyArray(t) ? e() : (n = BI.after(t.length, e), + BI.each(t, function (e, t) { + t.attributeGetter(i, n) + })) + } + , + _bindEvents: function () { + var e = this; + this.unListen = BI.Services.getService("dec.service.user.all_users").on("EVENT_REFRESH", function () { + e.initData() + }) + } + , + _releaseEvents: function () { + this.unListen && this.unListen() + } + }) + ; + BI.model("dec.model.jsdjjed.feishu.app", feishuAppModel); + + var feishuApp = BI.inherit(BI.Pane, { + props: { + baseCls: "dec-user-all bi-card" + }, + _store: function () { + return BI.Models.getModel("dec.model.jsdjjed.feishu.app") + }, + watch: { + rows: function (e) { + this.populate(e) + }, + allPages: function () { + this.table.setAllPages(this.model.allPages) + }, + currentPage: function (e) { + this.table.setPage(e) + }, + searching: function (e) { + this.userSourceRow.setVisible(!e) + }, + creationType: function (e) { + this.userSourceCombo.setValue(e) + } + }, + beforeRender: function (e) { + var t = this; + this.loading(), + this.store.initConfigs(function () { + t.loaded(), + e() + }) + }, + mounted: function () { + var e = this; + this.store.updateUserListHeight(this._calculateUserListHeight()), + BI.Resizers.add(this.getName(), function () { + e.store.updateUserListHeight(e._calculateUserListHeight()) + }) + }, + render: function () { + var i = this + , e = { + type: "bi.button_group", + ref: function (e) { + i.toolbar = e + }, + layouts: [{ + type: "bi.vertical_adapt", + rgap: 15 + }], + items: this._createOperations() + } + , t = { + type: "dec.jsdjjed.feishu.app.table", + ref: function (e) { + i.table = e + }, + itemsCreator: function (e, t) { + i.store.getUsersByPage(e.page, t) + }, + perPage: this.model.perPage, + listeners: [{ + eventName: "EVENT_DELETE", + action: function (e) { + i.store.deleteUsers(e) + } + }], + onEdit: BI.bind(this.store.onEditUser, this.store) + }; + return { + type: "bi.vtape", + hgap: 10, + items: [{ + type: "bi.absolute", + height: 40, + items: [{ + el: e, + top: 0, + left: 0, + bottom: 0 + }] + }, { + el: t + }] + } + }, + _createOperations: function () { + var n = this; + return BI.map( + //BI.Constants.getConstant("dec.constant.user.all.operations") + [{ + value: "add", + type: "dec.jsdjjed.feishu.app.operations.add", + actions: ["initConfigs", "initData"] + }] + + , function (e, t) { + return BI.extend({ + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + var i = arguments; + BI.each(t.actions, function (e, t) { + n.store[t].apply(n.store, i) + }) + } + }], + rgap: 20 + }, t) + }) + }, + _calculateUserListHeight: function () { + return this.element.height() - 40 - 82 + }, + beforeDestroy: function () { + BI.Resizers.remove(this.getName()) + }, + populate: function (e) { + this.table.populate(e) + }, + initData: function () { + this.store.initData() + } + }); + BI.shortcut("dec.jsdjjed.feishu.app", feishuApp); + + + var feishuAppConfigModel = BI.inherit(Fix.Model, { + state: function () { + return { + normalConfig: {}, + beforeConfig: {} + } + }, + childContext: ["normalConfig"], + computed: { + encodingArray: function () { + return this.model.normalConfig.encodingArray + } + }, + actions: { + initPage: function (t) { + var i = this; + Dec.jsdjjed.getAppConfig(function (e) { + i.model.normalConfig = e, + i.model.beforeConfig = BI.deepClone(e), + t() + }) + }, + saveNormal: function (e, i) { + var n = this; + BI.isDeepMatch(n.model.beforeConfig, e) || Dec.jsdjjed.saveAppConfig(e, function (t) { + Dec.jsdjjed.getAppConfig(function (e) { + i(t, BI.deepClone(e), n.model.beforeConfig), + n.model.beforeConfig = e + }) + }) + }, + configExternalDatabase: function () { + BI.history.navigate("management/system/migration", { + trigger: !0 + }) + }, + switchingEncryptionAlgorithm: function () { + BI.history.navigate("management/system/encryption", { + trigger: !0 + }) + } + } + }); + BI.model("dec.model.jsdjjed.feishu.app.config", feishuAppConfigModel); + var feishuAppConfig = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-system-normal-decision bi-card" + }, + _store: function () { + return BI.Models.getModel("dec.model.jsdjjed.feishu.app.config") + }, + beforeInit: function (e) { + this.store.initPage(e) + }, + watch: {}, + render: function () { + var n = this; + var e = this.model.normalConfig; + var editorConfig = {textWidth: 160, editorWidth: 200, codeWidth: 150, codeHeight: 24, versionWidth: 50}; + return { + type: "bi.vertical", + hgap: 10, + items: [{ + type: "dec.card.vertical", + text: "常规参数                          启用ECSB     服务编码     版本号", + content: { + type: "bi.horizontal", + items: [{ + el: { + type: "bi.vertical", + width: 700, + vgap: 10, + items: [{ + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "报表地址:", + value: e.frUrl, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.frUrlItem = e + } + }, + { + type: "bi.vertical_adapt", + items: [{ + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "获取app_access_token地址:", + value: e.accessTokenUrl, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.accessTokenUrlItem = e + } + }, { + type: "dec.switch_button", + value: e.accessTokenUrlEscbOption, + hgap: 10, + ref: function (e) { + n.accessTokenUrlEscbOptionSwitcher = e + } + }, + { + type: "bi.editor", + cls: "bi-border", + ref: function (e) { + n.accessTokenUrlEscbCodeEditor = e + }, + value: e.accessTokenUrlEscbCode, + allowBlank: !0, + width: editorConfig.codeWidth, + height: editorConfig.codeHeight, + }, { + type: "bi.editor", + cls: "bi-border", + hgap: 10, + ref: function (e) { + n.accessTokenUrlEscbVersionEditor = e + }, + value: e.accessTokenUrlEscbVersion, + allowBlank: !0, + width: editorConfig.versionWidth, + height: editorConfig.codeHeight, + } + ] + }, + { + type: "bi.vertical_adapt", + items: [{ + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "根据code获取用户信息地址:", + value: e.codeUserUrl, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.codeUserUrlItem = e + } + }, { + type: "dec.switch_button", + value: e.codeUserUrlEscbOption, + hgap: 10, + ref: function (e) { + n.codeUserUrlEscbOptionSwitcher = e + } + }, + { + type: "bi.editor", + cls: "bi-border", + ref: function (e) { + n.codeUserUrlEscbCodeEditor = e + }, + value: e.codeUserUrlEscbCode, + allowBlank: !0, + width: editorConfig.codeWidth, + height: editorConfig.codeHeight, + }, { + type: "bi.editor", + cls: "bi-border", + hgap: 10, + ref: function (e) { + n.codeUserUrlEscbVersionEditor = e + }, + value: e.codeUserUrlEscbVersion, + allowBlank: !0, + width: editorConfig.versionWidth, + height: editorConfig.codeHeight, + } + ] + } + , + { + type: "bi.vertical_adapt", + items: [{ + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "获取群列表地址:", + value: e.chatGroupsUrl, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.chatGroupsUrlItem = e + } + }, { + type: "dec.switch_button", + value: e.chatGroupsUrlEscbOption, + hgap: 10, + ref: function (e) { + n.chatGroupsUrlEscbOptionSwitcher = e + } + }, + { + type: "bi.editor", + cls: "bi-border", + ref: function (e) { + n.chatGroupsUrlEscbCodeEditor = e + }, + value: e.chatGroupsUrlEscbCode, + allowBlank: !0, + width: editorConfig.codeWidth, + height: editorConfig.codeHeight, + }, { + type: "bi.editor", + cls: "bi-border", + hgap: 10, + ref: function (e) { + n.chatGroupsUrlEscbVersionEditor = e + }, + value: e.chatGroupsUrlEscbVersion, + allowBlank: !0, + width: editorConfig.versionWidth, + height: editorConfig.codeHeight, + } + ] + }, + { + type: "bi.vertical_adapt", + items: [{ + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "获取用户ID:", + title: "使用手机号或邮箱获取用户ID", + value: e.usersUrl, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.usersUrlItem = e + } + }, { + type: "dec.switch_button", + value: e.usersUrlEscbOption, + hgap: 10, + ref: function (e) { + n.usersUrlEscbOptionSwitcher = e + } + }, + { + type: "bi.editor", + cls: "bi-border", + ref: function (e) { + n.usersUrlEscbCodeEditor = e + }, + value: e.usersUrlEscbCode, + allowBlank: !0, + width: editorConfig.codeWidth, + height: editorConfig.codeHeight, + }, { + type: "bi.editor", + cls: "bi-border", + hgap: 10, + ref: function (e) { + n.usersUrlEscbVersionEditor = e + }, + value: e.usersUrlEscbVersion, + allowBlank: !0, + width: editorConfig.versionWidth, + height: editorConfig.codeHeight, + } + ] + }, + { + type: "bi.vertical_adapt", + items: [{ + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "发送消息地址:", + value: e.sendMessageUrl, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.sendMessageUrlItem = e + } + }, { + type: "dec.switch_button", + value: e.sendMessageUrlEscbOption, + hgap: 10, + ref: function (e) { + n.sendMessageUrlEscbOptionSwitcher = e + } + }, + { + type: "bi.editor", + cls: "bi-border", + ref: function (e) { + n.sendMessageUrlEscbCodeEditor = e + }, + value: e.sendMessageUrlEscbCode, + allowBlank: !0, + width: editorConfig.codeWidth, + height: editorConfig.codeHeight, + }, { + type: "bi.editor", + cls: "bi-border", + hgap: 10, + ref: function (e) { + n.sendMessageUrlEscbVersionEditor = e + }, + value: e.sendMessageUrlEscbVersion, + allowBlank: !0, + width: editorConfig.versionWidth, + height: editorConfig.codeHeight, + } + ] + }, + { + type: "bi.vertical_adapt", + items: [{ + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "批量发送消息地址:", + value: e.sendBatchMessageUrl, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.sendBatchMessageUrlItem = e + } + }, { + type: "dec.switch_button", + value: e.sendBatchMessageUrlEscbOption, + hgap: 10, + ref: function (e) { + n.sendBatchMessageUrlEscbOptionSwitcher = e + } + }, + { + type: "bi.editor", + cls: "bi-border", + ref: function (e) { + n.sendBatchMessageUrlEscbCodeEditor = e + }, + value: e.sendBatchMessageUrlEscbCode, + allowBlank: !0, + width: editorConfig.codeWidth, + height: editorConfig.codeHeight, + }, { + type: "bi.editor", + cls: "bi-border", + hgap: 10, + ref: function (e) { + n.sendBatchMessageUrlEscbVersionEditor = e + }, + value: e.sendBatchMessageUrlEscbVersion, + allowBlank: !0, + width: editorConfig.versionWidth, + height: editorConfig.codeHeight, + } + ] + }, + { + type: "bi.vertical_adapt", + items: [{ + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "上传图片地址:", + title: "上传图片地址", + value: e.uploadImageUrl, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.uploadImageUrlItem = e + } + }, { + type: "dec.switch_button", + value: e.uploadImageUrlEscbOption, + hgap: 10, + ref: function (e) { + n.uploadImageUrlEscbOptionSwitcher = e + } + }, + { + type: "bi.editor", + cls: "bi-border", + ref: function (e) { + n.uploadImageUrlEscbCodeEditor = e + }, + value: e.uploadImageUrlEscbCode, + allowBlank: !0, + width: editorConfig.codeWidth, + height: editorConfig.codeHeight, + }, { + type: "bi.editor", + cls: "bi-border", + hgap: 10, + ref: function (e) { + n.uploadImageUrlEscbVersionEditor = e + }, + value: e.uploadImageUrlEscbVersion, + allowBlank: !0, + width: editorConfig.versionWidth, + height: editorConfig.codeHeight, + } + ] + }, + { + type: "bi.vertical_adapt", + items: [{ + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "上传文件地址:", + title: "上传文件地址", + value: e.uploadFileUrl, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.uploadFileUrlItem = e + } + }, { + type: "dec.switch_button", + value: e.uploadFileUrlEscbOption, + hgap: 10, + ref: function (e) { + n.uploadFileUrlEscbOptionSwitcher = e + } + }, + { + type: "bi.editor", + cls: "bi-border", + ref: function (e) { + n.uploadFileUrlEscbCodeEditor = e + }, + value: e.uploadFileUrlEscbCode, + allowBlank: !0, + width: editorConfig.codeWidth, + height: editorConfig.codeHeight, + }, { + type: "bi.editor", + cls: "bi-border", + hgap: 10, + ref: function (e) { + n.uploadFileUrlEscbVersionEditor = e + }, + value: e.uploadFileUrlEscbVersion, + allowBlank: !0, + width: editorConfig.versionWidth, + height: editorConfig.codeHeight, + } + ] + }, + { + type: "bi.vertical_adapt", + items: [{ + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "请求用户身份验证地址:", + title: "请求用户身份验证地址", + value: e.authorizeUrl, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.authorizeUrlItem = e + } + }, { + type: "dec.switch_button", + value: e.authorizeUrlEscbOption, + hgap: 10, + ref: function (e) { + n.authorizeUrlEscbOptionSwitcher = e + } + }, + { + type: "bi.editor", + cls: "bi-border", + ref: function (e) { + n.authorizeUrlEscbCodeEditor = e + }, + value: e.authorizeUrlEscbCode, + allowBlank: !0, + width: editorConfig.codeWidth, + height: editorConfig.codeHeight, + }, { + type: "bi.editor", + cls: "bi-border", + hgap: 10, + ref: function (e) { + n.authorizeUrlEscbVersionEditor = e + }, + value: e.authorizeUrlEscbVersion, + allowBlank: !0, + width: editorConfig.versionWidth, + height: editorConfig.codeHeight, + } + ] + }, + { + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "ESCB接口地址:", + title: "ESCB接口地址", + value: e.escbUrl, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.escbUrlItem = e + } + }, { + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "ESCB应用编码:", + title: "ESCB应用编码", + value: e.escbAppCode, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.escbAppCodeItem = e + } + }, + { + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "ESCB应用授权令牌:", + title: "ESCB应用授权令牌", + value: e.escbAppToken, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.escbAppTokenItem = e + } + }, + { + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "ESCB组织编码:", + title: "ESCB组织编码", + value: e.escbOrgCode, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.escbOrgCodeItem = e + } + }, + { + type: "dec.label.editor.item", + textWidth: editorConfig.textWidth, + cls: "dec-font-weight-bold", + text: "ESCB系统编码:", + title: "ESCB系统编码", + value: e.escbSysCode, + editorWidth: editorConfig.editorWidth, + ref: function (e) { + n.escbSysCodeItem = e + } + } + + ] + } + }] + }, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + var e; + n._validation() && (e = n.getValue(), + n.store.saveNormal(e, function (e, t, i) { + if (e.status && ("success" == e.status)) { + BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Success"), {level: "success"}); + return; + } + BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Fail"), {level: "error"}); + })) + } + }] + }] + } + }, + getValue: function () { + return BI.extend({ + frUrl: this.frUrlItem.getValue(), + accessTokenUrl: this.accessTokenUrlItem.getValue(), + accessTokenUrlEscbOption: this.accessTokenUrlEscbOptionSwitcher.getValue(), + accessTokenUrlEscbCode: this.accessTokenUrlEscbCodeEditor.getValue(), + accessTokenUrlEscbVersion: this.accessTokenUrlEscbVersionEditor.getValue(), + + codeUserUrl: this.codeUserUrlItem.getValue(), + codeUserUrlEscbOption: this.codeUserUrlEscbOptionSwitcher.getValue(), + codeUserUrlEscbCode: this.codeUserUrlEscbCodeEditor.getValue(), + codeUserUrlEscbVersion: this.codeUserUrlEscbVersionEditor.getValue(), + + chatGroupsUrl: this.chatGroupsUrlItem.getValue(), + chatGroupsUrlEscbOption: this.chatGroupsUrlEscbOptionSwitcher.getValue(), + chatGroupsUrlEscbCode: this.chatGroupsUrlEscbCodeEditor.getValue(), + chatGroupsUrlEscbVersion: this.chatGroupsUrlEscbVersionEditor.getValue(), + + usersUrl: this.usersUrlItem.getValue(), + usersUrlEscbOption: this.usersUrlEscbOptionSwitcher.getValue(), + usersUrlEscbCode: this.usersUrlEscbCodeEditor.getValue(), + usersUrlEscbVersion: this.usersUrlEscbVersionEditor.getValue(), + + sendMessageUrl: this.sendMessageUrlItem.getValue(), + sendMessageUrlEscbOption: this.sendMessageUrlEscbOptionSwitcher.getValue(), + sendMessageUrlEscbCode: this.sendMessageUrlEscbCodeEditor.getValue(), + sendMessageUrlEscbVersion: this.sendMessageUrlEscbVersionEditor.getValue(), + + sendBatchMessageUrl: this.sendBatchMessageUrlItem.getValue(), + sendBatchMessageUrlEscbOption: this.sendBatchMessageUrlEscbOptionSwitcher.getValue(), + sendBatchMessageUrlEscbCode: this.sendBatchMessageUrlEscbCodeEditor.getValue(), + sendBatchMessageUrlEscbVersion: this.sendBatchMessageUrlEscbVersionEditor.getValue(), + + uploadImageUrl: this.uploadImageUrlItem.getValue(), + uploadImageUrlEscbOption: this.uploadImageUrlEscbOptionSwitcher.getValue(), + uploadImageUrlEscbCode: this.uploadImageUrlEscbCodeEditor.getValue(), + uploadImageUrlEscbVersion: this.uploadImageUrlEscbVersionEditor.getValue(), + + uploadFileUrl: this.uploadFileUrlItem.getValue(), + uploadFileUrlEscbOption: this.uploadFileUrlEscbOptionSwitcher.getValue(), + uploadFileUrlEscbCode: this.uploadFileUrlEscbCodeEditor.getValue(), + uploadFileUrlEscbVersion: this.uploadFileUrlEscbVersionEditor.getValue(), + + authorizeUrl: this.authorizeUrlItem.getValue(), + authorizeUrlEscbOption: this.authorizeUrlEscbOptionSwitcher.getValue(), + authorizeUrlEscbCode: this.authorizeUrlEscbCodeEditor.getValue(), + authorizeUrlEscbVersion: this.authorizeUrlEscbVersionEditor.getValue(), + + escbUrl: this.escbUrlItem.getValue(), + escbAppCode: this.escbAppCodeItem.getValue(), + escbAppToken: this.escbAppTokenItem.getValue(), + escbOrgCode: this.escbOrgCodeItem.getValue(), + escbSysCode: this.escbSysCodeItem.getValue() + }) + }, + _validation: function () { + var e = !0 + return e; + }, + _showSuccess: function (e, t) { + var i = BI.UUID(); + delete e.cloudCenter, + BI.isDeepMatch(t, e) ? BI.Msg.toast(BI.i18nText("Dec-Basic_Save_Success"), { + level: "success" + }) : BI.Popovers.create(i, { + width: 450, + height: 220, + header: BI.i18nText("BI-Basic_Prompt"), + body: { + type: "dec.component.icon_text.alert", + text: BI.i18nText("Dec-System_Normal_Save_Tip"), + listeners: [{ + eventName: BI.Popover.EVENT_CLOSE, + action: function () { + BI.Popovers.remove(i) + } + }] + } + }).open(i) + } + }); + BI.shortcut("dec.jsdjjed.feishu.app.config", feishuAppConfig); + + BI.constant("dec.constant.jsdjjed.feishu.tabs", [{ + value: "allApp", + text: "飞书应用", + cardType: "dec.jsdjjed.feishu.app" + }, { + value: "appConfig", + text: "配置", + cardType: "dec.jsdjjed.feishu.app.config" + }]); + + var fsManagerModel = BI.inherit(Fix.Model, { + state: function () { + var e = BI.Constants.getConstant("dec.constant.jsdjjed.feishu.tabs"); + return { + activeTab: BI.isNotEmptyArray(e) ? e[0].value : "allUser", + userManagementConfigs: { + syncOperationType: { + type: DecCst.System.Info.AuthenticType.DEFAULT + }, + manualOperationType: { + type: DecCst.System.Info.AuthenticType.DEFAULT + } + } + } + }, + childContext: ["userManagementConfigs"], + computed: { + tabs: function () { + return BI.map(BI.Constants.getConstant("dec.constant.jsdjjed.feishu.tabs"), function (e, t) { + return { + text: t.text, + value: t.value, + selected: 0 === e + } + }) + }, + isAdmin: function () { + //return BI.Services.getService("dec.service.user.management").isAdmin(); + return true; + } + }, + actions: { + getUserConfig: function (e) { + this.getManagementConfig(e), + BI.Services.getService("dec.service.user.management").initUserOrganization() + }, + getManagementConfig: function (t) { + var i = this; + Dec.Utils.getUserManagementConfig(function (e) { + i.model.userManagementConfigs = e.data, + t && t() + }) + }, + openTab: function (e) { + this.model.activeTab = e + }, + createCard: function (i) { + var e = BI.find(BI.Constants.getConstant("dec.constant.jsdjjed.feishu.tabs"), function (e, t) { + return t.value === i + }); + return e ? BI.extend({ + type: e.cardType + }, e) : { + type: "bi.label", + text: i + } + } + } + }); + BI.model("dec.model.jsdjjed.feishu.manager", fsManagerModel); + + var fsManager = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-user-management" + }, + _store: function () { + return BI.Models.getModel("dec.model.jsdjjed.feishu.manager") + }, + watch: { + activeTab: function (e) { + this.tab.setSelect(e) + } + }, + beforeInit: function (e) { + this.store.getUserConfig(e) + }, + render: function () { + var t = this + , e = { + type: "dec.line_segment", + cls: "dec-font-weight-bold", + ref: function (e) { + t.tabs = e + }, + height: 40, + items: BI.createItems(this.model.tabs, { + hgap: 15 + }), + layouts: [{ + type: "bi.vertical_adapt" + }], + listeners: [{ + eventName: "EVENT_CHANGE", + action: function (e) { + t.store.openTab(e) + } + }] + }; + return { + type: "bi.absolute", + cls: "bi-background", + items: [{ + el: { + type: "bi.vtape", + items: [{ + type: "bi.vertical_adapt", + cls: "bi-card bi-border-bottom", + items: [e], + height: 40 + }, { + type: "bi.absolute", + items: [{ + el: { + type: "bi.tab", + cardCreator: BI.bind(this.store.createCard, this), + single: !0, + ref: function (e) { + t.tab = e + }, + showIndex: this.model.activeTab + }, + top: 10, + left: 10, + right: 10, + bottom: 10 + }] + }] + }, + left: 0, + right: 0, + top: 0, + bottom: 0 + }] + } + }, + _createSettingLayer: function () { + var e = this + , t = BI.UUID(); + BI.Layers.create(t, null, { + container: this, + render: { + type: "dec.user.setting", + listeners: [{ + eventName: "EVENT_SAVE", + action: function () { + e.store.getManagementConfig(function () { + BI.Layers.remove(t) + }) + } + }, { + eventName: "EVENT_CHANGE", + action: function () { + BI.Layers.remove(t) + } + }] + } + }), + BI.Layers.show(t) + } + }); + BI.shortcut("dec.management.jsdjjed.feishu.manager", fsManager); + + +// 特别注意,此配置需要配合服务端SystemOptionProvider接口使用,不然会因无权限而不显示节点. + BI.config("dec.constant.management.navigation", function (items) { + items.push({ + value: "jsdjjed-feishu", // 地址栏显示的hash值 + id: "decision-jsdjjed-feishu-manager", // id + text: "飞书管理", // 文字 + cardType: "dec.management.jsdjjed.feishu.manager", // 组件的shortcut,适用于用fineui开发的页面. + cls: "icon-manager-font" // 图标类名 + }); + return items; + }); + } + () +) +; \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/third/party/jsdjjed/message.js b/src/main/resources/com/fr/plugin/third/party/jsdjjed/message.js new file mode 100644 index 0000000..618ec2e --- /dev/null +++ b/src/main/resources/com/fr/plugin/third/party/jsdjjed/message.js @@ -0,0 +1,263 @@ +!(function () { + console.log("123"); + BI.config("dec.constant.schedule.task.accessory", function (items) { + items.push({ + value: 4096, + text: "图片" + }) + return items; + }); + + + var jsdjjedTextValueCombo = BI.inherit(BI.Widget, { + props: { + baseCls: "dec-system-extensible-parameter", + labelWidth: 210, + editorWidth: 180, + value: {} + }, + render: function () { + var t = this + , e = this.options + , i = e.value; + return { + type: "bi.vertical_adapt", + items: [{ + type: "bi.label", + textAlign: "left", + cls: "dec-font-weight-bold", + text: BI.i18nText(i.name), + title: BI.i18nText(i.name), + width: e.labelWidth + }, { + type: "bi.text_value_combo", + $testId: "dec-system-normal-extensible-text-value-combo", + width: e.editorWidth, + value: i.value, + items: this._createItems(i), + ref: function (e) { + t.textValueCombo = e + }, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + t.fireEvent("EVENT_CHANGE", arguments) + } + }] + }, { + type: "dec.text.bubble.combo", + cls: "help-area", + invisible: !i.description, + text: i.description ? BI.i18nText(i.description) : "", + el: { + type: "bi.icon_button", + $point: "dec-system-normal-extensible", + cls: "detail-font", + width: 35, + height: 24 + } + }] + } + }, + _createItems: function (e) { + return BI.map(e.items || e.alternatives, function (e, t) { + return BI.extend(t, { + text: BI.isKey(t.text) ? t.text : BI.i18nText(t.key) + }) + }) + }, + getValue: function () { + var e = this.textValueCombo.getValue(); + return BI.isNotEmptyArray(e) ? e[0] : ""; + }, + setValue: function (e) { + this.textValueCombo.setValue(e); + }, + populate: function (e) { + this.textValueCombo.populate(e); + } + }); + jsdjjedTextValueCombo.EVENT_CHANGE = "EVENT_CHANGE"; + BI.shortcut("jsdjjed.text.value.combo", jsdjjedTextValueCombo); + + + var appMessagePushTerminalType = 64; + //debugger; + Dec.Plugin.OutPutActionProvider.items.push({ + version: 1.0, + terminalType: appMessagePushTerminalType, + terminalText: BI.i18nText("飞书推送通知"), + getItem: function () { + var self = this; + return { + type: "bi.vertical", + //width: 540, + height: 100, + vgap: 0, + items: [{ + type: "jsdjjed.text.value.combo", + labelWidth: 80, + value: { + name: "应用凭证", + value: "", + //description: BI.i18nText("Dec-System_Week_Begins_Tips"), + //items: BI.Constants.getConstant("dec.constant.system.normal.week.begins") + }, + ref: function (e) { + self.appConfigIds = e + }, + listeners: [{ + eventName: "EVENT_CHANGE", + action: function () { + var configId = this.getValue(); + //console.log(configId); + self._setChatGroupValue(configId); + } + }] + }, + { + type: "jsdjjed.text.value.combo", + labelWidth: 80, + value: { + name: "飞书群", + value: "", + //description: BI.i18nText("Dec-System_Week_Begins_Tips"), + //items: BI.Constants.getConstant("dec.constant.system.normal.week.begins") + }, + ref: function (e) { + self.chatGroup = e + } + }, + { + type: "jsdjjed.text.value.combo", + labelWidth: 80, + value: { + name: "消息类型", + value: "text", + //description: BI.i18nText("Dec-System_Week_Begins_Tips"), + items: [{text: "文本", value: "text"}, {text: "富文本", value: "post"}] + }, + ref: function (e) { + self.feishuMsgType = e + } + }, + { + type: "jsdjjed.text.value.combo", + labelWidth: 80, + value: { + name: "发送类型", + value: "message", + //description: BI.i18nText("Dec-System_Week_Begins_Tips"), + items: [{text: "消息", value: "message"}, {text: "文件", value: "file"}, { + text: "消息与文件", + value: "message_file" + }] + }, + ref: function (e) { + self.feishuSendType = e + } + } + ] + } + }, + _setChatGroupValue: function (configId) { + var self = this; + var id = configId || ""; + Dec.jsdjjed.reqChatGroup({config_id: id}, function (e) { + var items = BI.map(Dec.jsdjjed.getValidItemsData(e), function (e, t) { + return {text: t.show, value: t.chatId}; + }); + items.unshift({text: "空", value: "empty_group"}); + if (BI.isNotEmptyArray(items)) { + var currentChatGroupId = self._getCurrentChatGroupId(); + var chatId = self._getItemContainValue(currentChatGroupId, items); + self.chatGroup.populate(items); + self.chatGroup.setValue(chatId); + } + }) + }, + setValue: function (v) { + //debugger; + if (v.terminal && v.terminal === appMessagePushTerminalType) { + if ((v.feishuMsgType == undefined) || (v.feishuMsgType == null) || (v.feishuMsgType.length <= 0)) { + v.feishuMsgType = "text"; + } + + if ((v.feishuSendType == undefined) || (v.feishuSendType == null) || (v.feishuSendType.length <= 0)) { + v.feishuSendType = "message"; + } + + this.value = v; + this.appConfigIds.setValue(v.configId); + this.chatGroup.setValue(v.chatGroupId); + this.feishuMsgType.setValue(v.feishuMsgType); + this.feishuSendType.setValue(v.feishuSendType); + } + }, + + getValue: function () { + var self = this; + // actionName最后一个点后面的类名要和这个return的json的字段名一致 + + return { + OutputAppMessagePush: BI.extend(self.value, { + "@class": "com.fr.plugin.third.party.jsdjjed.schedule.bean.OutputAppMessagePush", + actionName: "com.fr.plugin.third.party.jsdjjed.schedule.bean.OutputAppMessagePush", + terminal: appMessagePushTerminalType, + configId: self.appConfigIds.getValue(), + chatGroupId: self.chatGroup.getValue(), + feishuMsgType: self.feishuMsgType.getValue(), + feishuSendType: self.feishuSendType.getValue() + }) + } + }, + + checkValid: function () { + return this.getValue() ? true : false; + }, + + fireEvent: function (v) { + var self = this; + if (v && v == true) { + Dec.jsdjjed.reqAppsByPage({page: 1}, function (e) { + var items = BI.map(Dec.jsdjjed.getValidItemsData(e), function (e, t) { + return {text: t.show, value: t.configId}; + }); + if (BI.isNotEmptyArray(items)) { + var currentConfigId = self._getCurrentConfigId(); + var configId = self._getItemContainValue(currentConfigId, items); + self.appConfigIds.populate(items); + self.appConfigIds.setValue(configId); + self.appConfigIds.fireEvent("EVENT_CHANGE"); + } + }) + } + }, + _getItemContainValue: function (currentValue, items) { + var tempValue = items[0].value; + if (BI.isEmpty(currentValue)) { + return tempValue; + } + for (var i = 0, max = items.length - 1; i <= max; i++) { + if (currentValue == items[i].value) { + return currentValue; + } + } + return tempValue; + }, + _getCurrentConfigId() { + var self = this; + if (self.value && self.value.configId) { + return self.value.configId; + } + return ""; + }, + _getCurrentChatGroupId() { + var self = this; + if (self.value && self.value.chatGroupId) { + return self.value.chatGroupId; + } + return ""; + } + }); +})(); \ No newline at end of file diff --git a/src/main/resources/com/fr/plugin/third/party/jsdjjed/sdk/h5-js-sdk-1.5.12.js b/src/main/resources/com/fr/plugin/third/party/jsdjjed/sdk/h5-js-sdk-1.5.12.js new file mode 100644 index 0000000..b790a65 --- /dev/null +++ b/src/main/resources/com/fr/plugin/third/party/jsdjjed/sdk/h5-js-sdk-1.5.12.js @@ -0,0 +1 @@ +!function(e){"function"==typeof define&&define.amd?define(e):e()}((function(){"use strict";window.__JSSDK_VERSION__={SDKVersion:"3.0.0",SDKUpdateVersion:"3.0.0",CommitHash:""};var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function n(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var i,r,o,a=t(n((function(e){function t(e,t,n,i,r,o,a){try{var s=e[o](a),c=s.value}catch(e){return void n(e)}s.done?t(c):Promise.resolve(c).then(i,r)}e.exports=function(e){return function(){var n=this,i=arguments;return new Promise((function(r,o){var a=e.apply(n,i);function s(e){t(a,r,o,s,c,"next",e)}function c(e){t(a,r,o,s,c,"throw",e)}s(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0}))),s=n((function(e){var t=function(e){var t,n=Object.prototype,i=n.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",s=r.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function u(e,t,n,i){var r=t&&t.prototype instanceof v?t:v,o=Object.create(r.prototype),a=new I(i||[]);return o._invoke=function(e,t,n){var i=f;return function(r,o){if(i===p)throw new Error("Generator is already running");if(i===h){if("throw"===r)throw o;return A()}for(n.method=r,n.arg=o;;){var a=n.delegate;if(a){var s=E(a,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===f)throw i=h,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=p;var c=l(e,t,n);if("normal"===c.type){if(i=n.done?h:d,c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=h,n.method="throw",n.arg=c.arg)}}}(e,n,a),o}function l(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var f="suspendedStart",d="suspendedYield",p="executing",h="completed",g={};function v(){}function m(){}function _(){}var y={};y[o]=function(){return this};var w=Object.getPrototypeOf,b=w&&w(w(x([])));b&&b!==n&&i.call(b,o)&&(y=b);var k=_.prototype=v.prototype=Object.create(y);function S(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function C(e,t){function n(r,o,a,s){var c=l(e[r],e,o);if("throw"!==c.type){var u=c.arg,f=u.value;return f&&"object"==typeof f&&i.call(f,"__await")?t.resolve(f.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(f).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,s)}))}s(c.arg)}var r;this._invoke=function(e,i){function o(){return new t((function(t,r){n(e,i,t,r)}))}return r=r?r.then(o,o):o()}}function E(e,n){var i=e.iterator[n.method];if(i===t){if(n.delegate=null,"throw"===n.method){if(e.iterator.return&&(n.method="return",n.arg=t,E(e,n),"throw"===n.method))return g;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return g}var r=l(i,e.iterator,n.arg);if("throw"===r.type)return n.method="throw",n.arg=r.arg,n.delegate=null,g;var o=r.arg;return o?o.done?(n[e.resultName]=o.value,n.next=e.nextLoc,"return"!==n.method&&(n.method="next",n.arg=t),n.delegate=null,g):o:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,g)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function z(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function x(e){if(e){var n=e[o];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function n(){for(;++r=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var c=i.call(a,"catchLoc"),u=i.call(a,"finallyLoc");if(c&&u){if(this.prev=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),z(n),g}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var i=n.completion;if("throw"===i.type){var r=i.arg;z(n)}return r}}throw new Error("illegal catch attempt")},delegateYield:function(e,n,i){return this.delegate={iterator:x(e),resultName:n,nextLoc:i},"next"===this.method&&(this.arg=t),g}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}})),c=n((function(e){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0}))),f=t(n((function(e){e.exports=function(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i=0||(r[n]=e[n]);return r},e.exports.default=e.exports,e.exports.__esModule=!0})));!function(e){e.userCaptureScreenObserved="userCaptureScreenObserved",e.onWatermarkChangeObserved="onWatermarkChange",e.onDownloadTaskStateChange="onDownloadTaskStateChange",e.nfcFoundDevice="nfcFoundDevice"}(i||(i={})),function(e){e.IOS="ios",e.ANDROID="android",e.MAC="mac",e.WINDOWS="windows"}(r||(r={})),function(e){e.CDN="cdn",e.NPM="npm",e.DEV="dev"}(o||(o={}));var d=function(e){var t;if(e.includes("Lark")||e.includes("Feishu"))return null==(t=e.match(/(lark|feishu|lark-staging|feishu-staging|lark-prerelease|feishu-prerelease|lark-oversea)\/([\d.]+)/i))?void 0:t[2]},p={versions:function(){var e=navigator.userAgent,t=navigator.platform,n=/(Android|iPhone|iPad|iPod|iOS)/i.test(e),i=d(e),r=e.includes("Lark")||e.includes("Feishu"),o=i&&m(i,"3.46.0")<0,a=i&&m(i,"3.46.0")>=0&&e.includes("WebApp");return{trident:e.includes("Trident"),presto:e.includes("Presto"),webKit:e.includes("AppleWebKit"),gecko:e.includes("Gecko")&&!e.includes("KHTML"),mobile:!!e.match(/AppleWebKit.*Mobile.*/)||!!e.match(/AppleWebKit/),ios:!!e.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/),android:e.includes("Android")||e.includes("Linux"),iPhone:e.includes("iPhone")||e.includes("Mac"),iPad:e.includes("iPad"),webApp:!e.includes("Safari"),PCFeishu:!n&&r&&(o||a),mobileFeishu:n&&r,larkVersion:d(e),mac:t.includes("Mac"),win:t.includes("Win")}}()};function h(){return new Promise((function(e){var t=0;!function n(){var i,r;(null==(i=window.webkit)||null==(r=i.messageHandlers)?void 0:r.invoke)||window.WebViewJavascriptBridge||t>100?e(0):(setTimeout(n,10+t),t++)}()}))}function g(e){return Object.prototype.toString.call(e).slice(8,-1)}function v(e,t){t?console.warn("【H5-JS-SDK】: "+e):console.error("【H5-JS-SDK】: "+e)}function m(e,t){for(var n=e.replace(/-\d*$/,"").split(".").map((function(e){return+e})),i=t.replace(/-\d*$/,"").split(".").map((function(e){return+e})),r=0;ri[r])return 1;if(n[r]255||(i=e.charCodeAt(a++))>255||(r=e.charCodeAt(a++))>255)throw new TypeError('Failed to execute "btoa" on "Window": The string '+e+" to be encoded contains characters outside of the Latin1 range.");o+=C.charAt((t=n<<16|i<<8|r)>>18&63)+C.charAt(t>>12&63)+C.charAt(t>>6&63)+C.charAt(63&t)}return s?o.slice(0,s-3)+"===".substring(s):o},I=T.atob||function(e){if(e=String(e).replace(/[\t\n\f\r ]+/g,""),!E.test(e))throw new TypeError('Failed to execute "atob" on "Window": The string '+e+" to be decoded is not correctly encoded.");var t;e+="==".slice(2-(3&e.length));for(var n,i,r="",o=0;o>16&255):64===i?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return r};function x(e){for(var t="",n=new Uint8Array(e),i=n.byteLength,r=0;r0){for(var o=0;o{};function Y(e){return void 0===e}const Z={string:function(e){return"string"==typeof e||"String"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)},undefined:Y,void:function(e){return Y(e)||null===e},object:function(e){return null!==e&&"object"==typeof e},number:function(e){return"number"==typeof e&&!Number.isNaN(e)},function:function(e){return"function"==typeof e}};function ee(e,t){return Object.entries(e).filter((([e,n])=>!t(n,e))).reduce(((e,[t,n])=>Object.assign(e,{[t]:n})),{})}function te(e,t,n){Object.defineProperty(e,t,{get:()=>n,set(){}})}let ne;function ie(){return ne||(ne=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}())}var re=function(){function e(e){var t=e.priority,n=e.sampleRate,i=e.filters;this.priority=0,this.filters=[],this.priority=t,this.sampleRate=n,this.filters=i}return e.prototype.match=function(e){return this.filters.every((function(t){return t.match(e)}))},e}(),oe=function(){function e(e){var t=e.key,n=e.values;this.key="",this.values=[],this.key=t,this.values=n}return e.prototype.match=function(e){var t=""+e[this.key];return this.values.includes(t)},e}(),ae=function(){function e(){this._defaultSampleRate=1,this._traceSampleRate=0,this._normalSampleRate=1,this._warnSampleRate=1,this._errorSampleRate=1,this._fatalSampleRate=1,this._orderedRules=[]}var t=e.prototype;return t.buildConfig=function(e){void 0===e&&(e={});var t=e,n=t[$.sampleRate],i=t[$.traceSampleRate],r=t[$.normalSampleRate],o=t[$.warnSampleRate],a=t[$.errorSampleRate],s=t[$.fatalSampleRate],c=t[$.rules];Z.number(n)&&(this._defaultSampleRate=n),Z.number(i)&&(this._traceSampleRate=i),Z.number(r)&&(this._normalSampleRate=r),Z.number(o)&&(this._warnSampleRate=o),Z.number(a)&&(this._errorSampleRate=a),Z.number(s)&&(this._fatalSampleRate=s);var u=this._parseRules(c);this._orderedRules=u.sort((function(e,t){return t.priority-e.priority}))},t.getSampleRate=function(e){var t=this._getMatchedRuleInOrderedRules(e),n=this._defaultSampleRate;switch(e[N.monitorLevel]){case j.trace:n=this._traceSampleRate;break;case j.normal:n=this._normalSampleRate;break;case j.warn:n=this._warnSampleRate;break;case j.error:n=this._errorSampleRate;break;case j.fatal:n=this._fatalSampleRate}return t&&!Z.undefined(t.sampleRate)&&(n=t.sampleRate),n>=1?1:0},t._getMatchedRuleInOrderedRules=function(e){return this._orderedRules.find((function(t){return t.match(e)}))},t._parseRules=function(e){return Array.isArray(e)?e=e.map((function(e){if(Z.object(e)){var t=e[$.priority],n=e[$.sampleRate],i=e[$.filters];return Z.number(t)||(t=0),Z.number(n)||(n=void 0),i=Array.isArray(i)?i.map((function(e){if(Z.object(e)){var t=e,n=t[$.key],i=t[$.values];return Z.string(n)&&Array.isArray(i)?e=new oe({key:n,values:i}):void 0}})).filter((function(e){return e})):[],new re({priority:t,sampleRate:n,filters:i})}})).filter((function(e){return e})):[]},e}(),se=function(){function e(t){var n=this;if(this._domainToNameRegistry=new Map,this._domainToParamInjectorRegistry=new Map,this._domainToNameCache=new Map,t instanceof e)return t;var i=t||{},r=i.defaultName,o=void 0===r?J:r,a=i.log,s=i.report,c=void 0===s?X:s,u=i.commonMetrics,l=void 0===u?{}:u,f=i.commonCategories,d=void 0===f?{}:f,p=i.commonTags,h=void 0===p?[]:p,g=i.defaultPlatform,v=void 0===g?"Slardar":g,m=i.domainToNameMap,_=i.domainToParamInjectorMap;this.defaultName=String(o),this.defaultPlatform=v,this._log=a,this._report=c,this.commonMetrics=l,this.commonCategories=d,this.commonTags=new Set(h),m&&Object.entries(m).forEach((function(e){var t=e[0],i=e[1];n.registerEvent(i,t)})),_&&Object.entries(_).forEach((function(e){var t=e[0],i=e[1];n.registerParamInjector(t,i)}))}var t=e.prototype;return t.setRemoteConfig=function(e){this._remoteConfig=e},t.getRemoteConfig=function(){return this._remoteConfig?this._remoteConfig:this.constructor.globalRemoteConfig},t.log=function(e){Z.function(this._log)&&this._log(e)},t.report=function(e){var t,n=this.getRemoteConfig(),i=e.name,r=e.metrics,o=e.categories,a=Object.assign(Object.assign(((t={})[G]=i,t),r),o);n.getSampleRate(a)<1||this._report(e)},t.registerEvent=function(e,t){if(this._domainToNameRegistry.get(t)!==e){this._domainToNameRegistry.set(t,e);for(var n,i=l(this._domainToNameCache.keys());!(n=i()).done;){var r=n.value;r.startsWith(t)&&this._domainToNameCache.delete(r)}}},t.getNameByDomain=function(e){return this._findName(e)||this.defaultName},t.registerParamInjector=function(e,t){this._domainToParamInjectorRegistry.set(e,t)},t.applyParamInjectorByDomain=function(e,t){for(var n=e.split("."),i=n.length,r=1;r<=i;r++){var o=n.slice(0,r).join("."),a=this._domainToParamInjectorRegistry.get(o);Z.function(a)&&a(t)}},t._findName=function(e){if(this._domainToNameCache.has(e))return this._domainToNameCache.get(e);for(var t,n=e.split("."),i=n.length,r=0;r=20||c&&c>=j.error?s():this.waitingForReport||(this.waitingForReport=!0,r=ie().setTimeout((function(){s()}),2e3))}},t.invokeLog=function(e){Z.function(this.config.log)&&this.config.log(e)},t.invokeReport=function(e){Z.function(this.config.report)&&this.config.report(e)},t._setConfig=function(e){this.config=new se(e)},t._getName=function(e){var t=e.getValue(N.monitorDomain);return e.getName()||t&&this.config.getNameByDomain(String(t))||this.config.defaultName},t._getPlatform=function(e){return e.platform||this.config.defaultPlatform},e}();ce.default=new ce;var ue,le,fe=function(){function e(t){if(t instanceof e)return t;var n=t||{},i=n.domain,r=n.code,o=n.level,a=n.message;te(this,"version",1),te(this,"domain",String(i)),te(this,"code",Number(r)),te(this,"ID",String(this.generateID())),te(this,"level",o),te(this,"message",String(a))}var t=e.prototype;return t.equals=function(t){return t instanceof e&&t.ID===this.ID},t.toJSON=function(){return{domain:this.domain,code:this.code,level:this.level,message:this.message}},t.generateID=function(){return this.version+"-"+this.domain+"-"+this.code},e}(),de=function(){function e(e){this.metrics={},this.categories={},this.internalData={},this.tags=new Set,this._time=0,this._startTime=0,this._endTime=0,this._flushed=!1;var t=e||{},n=t.service,i=t.name,r=void 0===i?J:i,o=t.code,a=t.platform,s=t.metrics,c=t.categories,u=t.internalData;this.service=n?new ce(n):ce.default,this.name=r,this._platform=a,o&&(this.code=new fe(o)),this.categories=Object.assign(Object.assign({},this.service.getConfig().commonCategories),c),this.metrics=Object.assign(Object.assign({},this.service.getConfig().commonMetrics),s),this.tags=new Set(this.service.getConfig().commonTags),this.internalData=Object.assign({},u)}var t=e.prototype;return t.addMetricValue=function(e,t){return Z.undefined(t)||(this.metrics[e]=t),this},t.addCategoryValue=function(e,t){return Z.undefined(t)||(this.categories[e]=t),this},t.addTag=function(e){return Z.undefined(e)||this.tags.add(e),this},t.addMap=function(e){var t=this;return void 0===e&&(e={}),Object.entries(e).forEach((function(e){var n=e[0],i=e[1];Z.undefined(i)||(Z.number(i)?t.metrics[n]=i:t.categories[n]=i)})),this},t.tracing=function(e){return Z.undefined(e)||this.addCategoryValue(N.traceId,e),this},t.flush=function(e){if(!this._flushed){this._flushed=!0;var t=this.getInternalData(),n=t.logEnabled,i=void 0===n||n,r=t.reportEnabled,o=void 0===r||r,a=this.code||(this.hasErrorInfo()?this.codeIfError:void 0);Z.undefined(this.level)&&a&&a.level&&this.setLevel(a.level),a&&(this.addCategoryValue(N.monitorDomain,a.domain),this.addMetricValue(N.monitorCode,a.code),this.addCategoryValue(N.monitorID,a.ID),this.addCategoryValue(N.monitorMessage,a.message)),this.tags&&this.addCategoryValue(N.monitorTags,this.tagsInline()),this.time<=0&&this.setTime(Date.now()),o&&(e||this.service).reportTo(this),i&&this.service.log(this)}},t.flushWithThrottle=function(){this._flushed||(this._flushed=!0,this.service.flushWithThrottle(this))},t.setMonitorCode=function(e){return Z.undefined(e)||(this.code=new fe(e)),this},t.setMonitorCodeIfError=function(e){return Z.undefined(e)||(this.codeIfError=new fe(e)),this},t.setLevel=function(e){return Z.undefined(e)||(this.level=e,this.addMetricValue(N.monitorLevel,e)),this},t.setErrorCode=function(e){return Z.undefined(e)||this.addCategoryValue(N.errorCode,String(e)),this},t.setErrorMessage=function(e){return Z.undefined(e)||this.addCategoryValue(N.errorMsg,String(e)),this},t.setError=function(e){if(Z.undefined(e))return this;var t=e.message,n=e.fileName,i=e.lineNumber,r=e.columnNumber,o=e.stack,a=e.code,s=e.monitorCode;return Z.string(t)&&this.addCategoryValue(N.errorMsg,t),Z.string(n)&&this.addCategoryValue(N.monitorFile,n),Z.string(o)&&this.addCategoryValue(N.monitorStack,o),Z.number(a)&&this.addMetricValue(N.errorCode,a),Z.number(i)&&this.addMetricValue(N.monitorLine,i),Z.number(r)&&this.addMetricValue(N.monitorColumn,r),s&&this.setMonitorCode(s),this},t.setTime=function(e){return Z.undefined(e)||(this._time=e,this.addMetricValue(N.time,e)),this},t.setPlatform=function(e){return e&&(this._platform=e),this},t.timing=function(e){var t=Date.now();return this._startTime>0?(this._endTime=t,this.addMetricValue(e||N.duration,this._endTime-this._startTime)):this._startTime=t,this},t.setDuration=function(e){return Z.undefined(e)||this.addMetricValue(N.duration,e),this},t.getCode=function(){return this.code},t.getName=function(){return this.name},t.getMetrics=function(){return Object.assign({},this.metrics)},t.getCategories=function(){return Object.assign({},this.categories)},t.getInternalData=function(){return this.internalData},t.getData=function(){return Object.assign(Object.assign({},this.metrics),this.categories)},t.getValue=function(e){return this.metrics[e]||this.categories[e]},t.setResultType=function(e){return this.addCategoryValue(N.resultType,e),this},t.setResultTypeSuccess=function(){return this.setResultType(R.success),this},t.setResultTypeFail=function(){return this.setResultType(R.fail),this},t.setResultTypeCancel=function(){return this.setResultType(R.cancel),this},t.setResultTypeTimeout=function(){return this.setResultType(R.timeout),this},t.getLevel=function(){return this.level},t.getMonitorId=function(){return this.code&&this.code.ID},t.getMonitorDomain=function(){return this.code&&this.code.domain},t.toJSON=function(){return{name:this.name,categories:this.getCategories(),metrics:this.getMetrics()}},t.addInternalData=function(e){return Object.assign(this.internalData,e),this},t.hasErrorInfo=function(){return!Z.undefined(this.getValue(N.errorCode))||!Z.undefined(this.getValue(N.errorMsg))},t.tagsInline=function(){return 0===this.tags.size?"":Array.from(this.tags).reduce((function(e,t){return""+e+(t?H+t:"")}))},q(e,[{key:"time",get:function(){return this._time}},{key:"platform",get:function(){return this._platform}}]),e}();!function(e){e.getSdkConfigTimeout="h5jssdk_get_sdk_config_timeout",e.getSdkConfigError="h5jssdk_get_sdk_config_error",e.authenticationFailure="h5jssdk_authentication_failure"}(ue||(ue={})),function(e){e.success="success",e.fail="fail",e.cancel="cancel",e.timeout="timeout"}(le||(le={}));var pe,he="js.open_platform.web",ge=((pe={})[ue.getSdkConfigTimeout]={domain:he+".op_web_js_script_error",code:10001,level:j.error,message:"h5jssdk_get_sdk_config_timeout"},pe[ue.getSdkConfigError]={domain:he+".op_web_js_script_error",code:10002,level:j.error,message:"h5jssdk_get_sdk_config_error"},pe[ue.authenticationFailure]={domain:he+".op_web_js_script_error",code:10003,level:j.error,message:"h5jssdk_authentication_failure"},pe[le.success]={domain:he+".api",code:1e4,level:j.normal,message:"api_success"},pe[le.fail]={domain:he+".api",code:10002,level:j.error,message:"api_fail"},pe[le.cancel]={domain:he+".api",code:10001,level:j.warn,message:"api_cancel"},pe[le.timeout]={domain:he+".api",code:10003,level:j.error,message:"api_timeout"},pe.DEFAULT={domain:he,code:1e4,level:j.warn,message:"undefined_default_code"},pe),ve="op_web_js_script_error",me="op_web_api_invoke_result",_e=[],ye=function(e,t){return void 0===e&&(e=""),void 0===t&&(t=ge.DEFAULT),new de(e?{name:e,code:new fe(t)}:{name:"undefined_default_code",code:new fe(ge.DEFAULT)})},we=function(){return(we=Object.assign||function(e){for(var t,n=1,i=arguments.length;n0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return a}function ke(){for(var e=[],t=0;t>e/4).toString(10):([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g,He)}var Je=function(){return He().replace(/-/g,"").slice(0,19)},Ke=function(e){return function(e,t,n){if("string"==typeof e&&"number"==typeof n){var i,r=[];n=n<=25?n:n%25;var o=String.fromCharCode(n+97);i=e.split(o);for(var a=0;a7344e6)return void this._requestWebId();if(r>432e7)return void this._updateWebId(e)}this._complete(e,t,n)},e.prototype._complete=function(e,t,n){this.cfg.envInfo.user.ssid=n,this.cfg.envInfo.user.web_id=e,this.cfg.envInfo.user.user_unique_id=t,this.tokenReady=!0},e.prototype._requestWebId=function(){this.isNoWebid?this._setTokenId(Je(),"","",!0):this._fetchWebId(this.fetchUrl,!1)},e.prototype._updateWebId=function(e){var t=""+this.domain+Ae+"/"+e+"/update";this._fetchWebId(t,!0)},e.prototype._fetchWebId=function(e,t){var n=this;this.isGetWebId=!0,qe(e,5e3,{app_key:this.config.app_key,app_id:this.config.app_id,url:location.href,user_agent:window.navigator.userAgent,referer:document.referrer,user_unique_id:""},this.config.app_key,(function(e){n.isGetWebId=!1,e&&0===e.e?(n.web_id=e.web_id,n.uuidQueue.length?n._requestSsId(n.uuidQueue[0]):n._setTokenId(e.web_id,"",t?n.ssid:e.ssid,!0)):(n.hook.emit("token-error"),console.warn("[]appid: "+n.config.app_id+", get webid error, init error~"))}),(function(){n.isGetWebId=!1,n.hook.emit("token-error"),console.warn("[]appid: "+n.config.app_id+", get webid error, init error~")}),!0)},e.prototype._setTokenId=function(e,t,n,i){var r=this.cfg.envInfo.user.web_id||e,o={web_id:r,ssid:n,user_unique_id:t||r,timestamp:Date.now()};this.enableCookie&&this.storage.setCookie(this.cookieKey,encodeURIComponent(JSON.stringify(o)),this.expiresTime,this.cookieDomain),this.storage.setItem(this.tokensKey,o),this.cfg.envInfo.user.ssid=n,this.cfg.envInfo.user.web_id=r,this.cfg.envInfo.user.user_unique_id=t||r,this.uuid=t||r,this.web_id=r,this.ssid=n,i&&(this.tokenReady=!0,this.hook.emit("token-ready"))},e.prototype._getSsid=function(e){e&&-1===["0","Null","None","","undefined"].indexOf(e)&&this.uuid!==e&&(this.uuidQueue.push(e),this.uuid=e,this.cfg.envInfo.user.user_unique_id=e,-1===this.uuidQueue.indexOf(e)&&this.uuidQueue.push(e),this.isNoSsid||this.isGetWebId||(this.tokenReady=!1,this._requestSsId(e),this.sendQueue.push(e)),this.session._resetSessionId())},e.prototype._requestSsId=function(e){var t=this;if(!this.sendQueue.length){var n=this.domain+"/v1/user/ssid";qe(n,5e3,{app_key:this.config.app_key,app_id:this.config.app_id,web_id:this.web_id,user_unique_id:e},this.config.app_key,(function(n){t.sendQueue=[],t.uuidQueue.length&&t.uuidQueue.splice(t.uuidQueue.indexOf(e),1),n&&0===n.e?(t._setTokenId(t.web_id,e,n.ssid,0===t.uuidQueue.length),t.uuidQueue.length&&t._requestSsId(t.uuidQueue[0])):(t.tokenReady=!0,t.hook.emit("token-ready"),console.warn("[]appid: "+t.config.app_id+", get ssid error"))}),(function(){t.tokenReady=!0,t.hook.emit("token-ready")}),!0)}},e.prototype.isTokenReady=function(){return this.tokenReady},e}(),Qe=function(e){navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)?window.addEventListener("pagehide",e,!1):window.addEventListener("beforeunload",e,!1)},$e=function(e,t,n){void 0===e&&(e=[]),void 0===t&&(t=function(e){return e}),void 0===n&&(n=20);var i,r=[],o=0;return e.forEach((function(e){var a=t(e);void 0===i?i=a:(a!==i||r[o].length>=n)&&(o+=1,i=a),r[o]=r[o]||[],r[o].push(e)})),r},Xe=function(){function e(e,t,n,i,r,o,a){this.collect=e,this.cfg=n,this.config=t,this._token=i,this.appInfo=t.app_id||t.app_key,this.debugMode=!!t.log,this.evtDataKey=Fe(this.appInfo,!1);var s=t.channel_domain||Ke(xe[t.channel]);if(this.reportUrl=t.report_url?t.report_url:""+s+Oe,this.storage=new Ie(!0),this.EventStorage=new Ie(!1),this.maxStorage=t.max_storage_num||-1,this.maxReport=t.max_report||10,this.reportTime=t.reportTime||30,this.timeout=t.timeout||1e5,this.closeStorage=!0,this.plugin=r,this.session=o,this.filter=a,this.plugin){var c=t.enable_storage,u=t.disable_storage;(c||!1===u)&&(this.closeStorage=!1)}this.addListener()}return e.prototype.addListener=function(){var e=this;window.addEventListener("unload",(function(){e.report(!0)}),!1),Qe((function(){e.report(!0)})),document.addEventListener("visibilitychange",(function(){"hidden"===document.visibilityState&&e.report(!0)}),!1)},e.prototype.setReady=function(){this.isReady=!0,this.closeStorage||this.checkStorageEvent(),this.report()},e.prototype.event=function(e){var t=this;void 0===e&&(e=[]);try{var n=ke(e,this.storage.getItem(this.evtDataKey)||[]);this.storage.setItem(this.evtDataKey,n),this.reportTimer&&clearTimeout(this.reportTimer),n.length>=this.maxReport?this.report(!1):this.reportTimer=setTimeout((function(){t.report(!1),t.reportTimer=null}),this.reportTime)}catch(e){}},e.prototype.beconEvent=function(e){void 0===e&&(e=[]);var t=this._mergeEvents(e);this._dealData(t,!0)},e.prototype.report=function(e){if(void 0===e&&(e=!1),!this.collect.destroyInstance&&this._token.isTokenReady()&&this.isReady){var t=this.storage.getItem(this.evtDataKey)||[],n=this._mergeEvents(t);this.storage.removeItem(this.evtDataKey),this._dealData(n,e)}},e.prototype._mergeEvents=function(e){var t=this;if(!e.length)return e;var n=this.cfg.get();return n.header.custom=JSON.stringify(n.header.custom),$e(e,(function(e){return!t.closeStorage&&!!e.params.__disable_storage__}),this.maxReport).map((function(e){return we({events:e.map((function(e){try{if(e.event&&"applog_trace"!==e.event){var n=we({},t.cfg.get("evtParams"),e.params);delete n.__disable_storage__;var i=[];return t.plugin&&t.plugin.ab&&t.plugin.ab.versions&&t.plugin.ab.extVersions&&(i=[],i=t.config.enable_multilink||-1!==window.location.href.indexOf("multilink=true")?t.plugin.ab.mulilinkVersions.concat(t.plugin.ab.extVersions):t.plugin.ab.versions.concat(t.plugin.ab.extVersions)),we({},e,{params:JSON.stringify(n),ab_sdk_version:i.join(","),session_id:t.session._getSessionId()})}return we({},e,{params:JSON.stringify(e.params)})}catch(t){return we({},e,{params:JSON.stringify(e.params)})}})),user:n.user,header:n.header},t.closeStorage?{}:{__disable_storage__:e[0].params.__disable_storage__},{verbose:t.debugMode?1:void 0,local_time:parseInt(""+(new Date).getTime()/1e3)})}))},e.prototype._dealData=function(e,t){var n=this;if(!e.length)return e;var i=[];i=$e(e,(function(e){return!!e.__disable_storage__}),this.maxReport),!this.closeStorage&&this.plugin.maxStorage&&this.plugin.maxStorage(i,this.maxStorage,this.evtDataKey,this.storage);var r={};i.forEach((function(e){var i=Je(),o=e;try{n.filter&&(o=n.filter(e))}catch(e){}if(!n.closeStorage&&!e[0].__disable_storage__){var a=JSON.parse(JSON.stringify(e));a&&a[0]&&(a[0].header.__storage_index__=Date.now()),r[i]=a,n.EventStorage.setItem(n.evtDataKey,r)}n._send(i,o,t)}))},e.prototype._send=function(e,t,n){var i=this;this.isSending=!0;var r=function(){i.isSending=!1};if(!this.closeStorage)try{t&&t[0]&&t[0].header.__storage_index__&&delete(t=JSON.parse(JSON.stringify(t)))[0].header.__storage_index__}catch(e){}this.plugin&&this.plugin.et_test&&this.plugin.et_test.send(t),qe(this.reportUrl,this.timeout,t,this.config.app_key,(function(t,n){if(r(),i.plugin&&!i.closeStorage){var o=i.EventStorage.getItem(i.evtDataKey)||{};Object.keys(o).length?(delete o[e],i.EventStorage.setItem(i.evtDataKey,o)):i.EventStorage.removeItem(i.evtDataKey)}t&&0!==t.e&&i.collect&&i.collect.tracer&&1!==i.cfg.staging&&i.collect.tracer.addErrorCount(n,"f_data",t.e,t)}),(function(e,t){r(),i.cfg.get("reportErrorCallback")(e,t),i.collect&&i.collect.tracer&&1!==i.cfg.staging&&i.collect.tracer.addErrorCount(e,"f_net",t),i.plugin&&i.plugin.monitor&&i.plugin.monitor.sdkError(i.config.app_key,i.reportUrl,e,t)}),!1,n,r),this.plugin&&this.plugin.monitor&&this.plugin.monitor.sdkOnload(this.config.app_key,this.reportUrl,t)},e.prototype.checkStorageEvent=function(){var e=this;try{var t=this.EventStorage.getItem(this.evtDataKey)||{},n=Object.keys(t);n.length>0&&setTimeout((function i(){for(var r=[],o=0;o0&&r.push(n.shift());r.length>0&&r.forEach((function(n){e._send(n,t[n],!1)})),setTimeout(i,5)}),5)}catch(e){}},e}(),Ye=void 0,Ze=(new Date).getTimezoneOffset(),et=parseInt(""+-Ze/60,10),nt=60*Ze,it=function(){function e(e,t,n){this.cookieDomain=t.cookie_domain||"",this.initConfig=t;var i=function(e,t){var n,i,r=function(e){var t=document.createElement("a");return t.href=e,t},o=window.screen.width,a=window.screen.height,s=window.navigator.appVersion,c=window.navigator.userAgent,u=window.navigator.language,l=document.referrer,f=l?r(l).hostname:"",d=function(e){var t=r(e).search;t=t.slice(1);var n={};return t.split("&").forEach((function(e){var t,i,r=e.split("=");r.length&&(t=r[0],i=r[1]);try{n[t]=decodeURIComponent(void 0===i?"":i)}catch(e){n[t]=i}})),n}(window.location.href),p="",h="",g="",v=""+parseFloat(s);-1!==(n=c.indexOf("Opera"))&&(g="Opera",v=c.substring(n+6),-1!==(n=c.indexOf("Version"))&&(v=c.substring(n+8))),-1!==(n=c.indexOf("Edge"))?(g="Microsoft Edge",v=c.substring(n+5)):-1!==(n=c.indexOf("MSIE"))?(g="Microsoft Internet Explorer",v=c.substring(n+5)):-1!==(n=c.indexOf("Lark"))?(g="Lark",v=c.substring(n+5,n+11)):-1!==c.indexOf("Chrome")?-1!==(n=c.indexOf("MicroMessenger"))?(g="weixin",v=c.substring(n+15,n+20)):-1!==(n=c.indexOf("MQQBrowser"))?(g="qqbrowser",v=c.substring(n+11,n+15)):-1!==(n=c.indexOf("360"))?(g="360browser",v=c.substring(c.indexOf("Chrome")+7)):-1!==c.indexOf("baidubrowser")||-1!==c.indexOf("BIDUBrowser")?(-1!==c.indexOf("baidubrowser")?(n=c.indexOf("baidubrowser"),v=c.substring(n+13,n+16)):-1!==c.indexOf("BIDUBrowser")&&(n=c.indexOf("BIDUBrowser"),v=c.substring(n+12,n+15)),g="baidubrowser"):-1!==(n=c.indexOf("xiaomi"))?-1!==c.indexOf("openlanguagexiaomi")?(g="openlanguage xiaomi",v=c.substring(n+7,n+13)):(g="xiaomi",v=c.substring(n-7,n-1)):-1!==(n=c.indexOf("TTWebView"))?(g="TTWebView",v=c.substring(n+10,n+23)):-1!==(n=c.indexOf("Chrome"))&&(g="Chrome",v=c.substring(n+7)):-1!==c.indexOf("Safari")?-1!==(n=c.indexOf("QQ"))?(g="qqbrowser",v=c.substring(n+10,n+16)):-1!==(n=c.indexOf("Safari"))&&(g="Safari",v=c.substring(n+7),-1!==(n=c.indexOf("Version"))&&(v=c.substring(n+8))):-1!==(n=c.indexOf("Firefox"))?(g="Firefox",v=c.substring(n+8)):-1!==(n=c.indexOf("MicroMessenger"))?(g="weixin",v=c.substring(n+15,n+20)):-1!==(n=c.indexOf("QQ"))&&(g="qqbrowser",v=c.substring(n+3,n+8)),-1!==(i=v.indexOf(";"))&&(v=v.substring(0,i)),-1!==(i=v.indexOf(" "))&&(v=v.substring(0,i)),-1!==(i=v.indexOf(")"))&&(v=v.substring(0,i));for(var m,_,y=/Mobile|htc|mini|Android|iP(ad|od|hone)/.test(s)?"wap":"web",w=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0|Windows NT 10.1)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Android",r:/Android/},{s:"Sun OS",r:/SunOS/},{s:"Linux",r:/(Linux|X11)/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(MacPPC|MacIntel|Mac_PowerPC|Macintosh)/}],b=0;b-1&&(t=e.slice(0,e.indexOf("Build/")))}));else if("ios"===e||"mac"===e||"windows"===e){var n=navigator.userAgent.replace("Mozilla/5.0 (",""),i=n.indexOf(";");t=n.slice(0,i)}}catch(e){}return t.trim()}(p),language:u,referrer:l,referrer_host:f,utm_source:C.utm_source,utm_medium:C.utm_medium,utm_campaign:C.utm_campaign,utm_term:C.utm_term,utm_content:C.utm_content,tracer_data:C.tracer_data}}(e,this.cookieDomain);this.configKey=function(e){return"__tea_cache_config_"+e}(""+e),this.sessionStorage=new Ie(!1,"session"),this.localStorage=new Ie(!1,"local"),n&&(this.storage=1===n?this.sessionStorage:this.localStorage),this.envInfo={user:{user_unique_id:Ye,user_type:Ye,user_id:Ye,user_is_auth:Ye,user_is_login:Ye,device_id:Ye,web_id:Ye,ip_addr_id:Ye,ssid:Ye},header:{app_id:Ye,app_name:Ye,app_install_id:Ye,install_id:Ye,app_package:Ye,app_channel:Ye,app_version:Ye,os_name:i.os_name,os_version:i.os_version,device_model:i.device_model,ab_client:Ye,ab_version:Ye,ab_sdk_version:Ye,traffic_type:Ye,client_ip:Ye,device_brand:Ye,os_api:Ye,access:Ye,language:i.language,region:Ye,app_language:Ye,app_region:Ye,creative_id:Ye,ad_id:Ye,campaign_id:Ye,log_type:Ye,rnd:Ye,platform:i.platform,sdk_version:Le,sdk_lib:"js",province:Ye,city:Ye,timezone:et,tz_offset:nt,tz_name:Ye,sim_region:Ye,carrier:Ye,resolution:i.screen_width+"x"+i.screen_height,browser:i.browser,browser_version:i.browser_version,referrer:i.referrer,referrer_host:i.referrer_host,width:i.screen_width,height:i.screen_height,screen_width:i.screen_width,screen_height:i.screen_height,utm_term:i.utm_term,utm_content:i.utm_content,utm_source:i.utm_source,utm_medium:i.utm_medium,utm_campaign:i.utm_campaign,tracer_data:JSON.stringify(i.tracer_data),custom:{}}},this.evtParams={},this.reportErrorCallback=function(){}}return e.prototype.set=function(e,t){var n=this;if(null==t&&(this.delete(e),t=void 0),"evtParams"===e||"_staging_flag"===e){var i;i="evtParams"===e?t:{_staging_flag:Number(t)};var r=we({},i);Object.keys(r).forEach((function(e){n.evtParams[e]=r[e]}))}else if("reportErrorCallback"===e&&"function"==typeof t)this.reportErrorCallback=t;else{var o="";if(e.indexOf(".")>-1){var a=e.split(".");o=a[0],e=a[1]}if("user_unique_id"===e){if(!t)return;if(-1!==["0","Null","None","","undefined"].indexOf(t))return}if("os_version"===e&&(e=""+t),"web_id"===e){if(!t)return;(!this.envInfo.user.user_unique_id||this.envInfo.user.user_unique_id&&this.envInfo.user.user_unique_id===this.envInfo.user.web_id)&&(this.envInfo.user.user_unique_id=t)}o?"user"===o||"header"===o?this.envInfo[o][e]=t:this.envInfo.header.custom[e]=t:this.envInfo.user.hasOwnProperty(e)?["user_type","ip_addr_id"].indexOf(e)>-1?this.envInfo.user[e]=t?Number(t):t:["user_id","web_id","user_unique_id","ssid"].indexOf(e)>-1?this.envInfo.user[e]=t?String(t):t:["user_is_auth","user_is_login"].indexOf(e)>-1?this.envInfo.user[e]=Boolean(t):"device_id"===e&&(this.envInfo.user[e]=t):this.envInfo.header.hasOwnProperty(e)?this.envInfo.header[e]=t:this.envInfo.header.custom[e]=t}},e.prototype.get=function(e){try{return e?"evtParams"===e?this.evtParams:"reportErrorCallback"===e?this[e]:JSON.parse(JSON.stringify(this.envInfo[e])):JSON.parse(JSON.stringify(this.envInfo))}catch(e){console.log("get config stringify error ")}},e.prototype.setStore=function(e){try{var t=this.storage.getItem(this.configKey);if(Object.keys(e).length){var n=Object.assign(e,t);this.storage.setItem(this.configKey,n)}}catch(e){}},e.prototype.getStore=function(){try{var e=this.storage.getItem(this.configKey);return Object.keys(e).length?e:null}catch(e){return null}},e.prototype.delete=function(e){try{var t=this.storage.getItem(this.configKey);t&&t.hasOwnProperty(e)&&(delete t[e],this.storage.setItem(this.configKey,t))}catch(e){}},e}(),rt=function(){function e(e,t){this.isLog=t||!1,this.name=e||""}var t=e.prototype;return t.info=function(e){this.isLog&&console.log("["+this.name+"] "+e)},t.warn=function(e){this.isLog&&console.warn("["+this.name+"] "+e)},t.error=function(e){this.isLog&&console.error("["+this.name+"] "+e)},t.throw=function(e){throw this.error(this.name),new Error(e)},e}(),ot=function(){function e(){this._hooks={}}return e.prototype.on=function(e,t){e&&t&&"function"==typeof t&&(this._hooks[e]||(this._hooks[e]=[]),this._hooks[e].push(t))},e.prototype.once=function(e,t){var n=this;e&&t&&"function"==typeof t&&this.on(e,(function i(r){t(r),n.off(e,i)}))},e.prototype.off=function(e,t){if(e&&this._hooks[e]&&this._hooks[e].length)if(t){var n=this._hooks[e].indexOf(t);-1!==n&&this._hooks[e].splice(n,1)}else this._hooks[e]=[]},e.prototype.emit=function(e,t){e&&this._hooks[e]&&this._hooks[e].length&&ke(this._hooks[e]).forEach((function(e){try{e(t)}catch(e){}}))},e}(),at=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},st=function(){function e(e,t){this.storage=new Ie(!1,"session"),this.sessionKey=function(e){return"__tea_session_id_"+e}(e),this.expireTime=t.expireTime||18e5,this.disableSession=t.disable_session,this.disableSession||this._setSessionId()}return e.prototype._updateSessionId=function(){var e=this.storage.getItem(this.sessionKey);if(e&&e.sessionId){var t=e.timestamp;Date.now()-t>this.expireTime?e={sessionId:at(),timestamp:Date.now()}:e.timestamp=Date.now(),this.storage.setItem(this.sessionKey,e),this._resetExpTime()}},e.prototype._setSessionId=function(){var e=this,t=this.storage.getItem(this.sessionKey);t&&t.sessionId?t.timestamp=Date.now():t={sessionId:at(),timestamp:Date.now()},this.storage.setItem(this.sessionKey,t),this.sessionExp=setInterval((function(){e._checkEXp()}),this.expireTime)},e.prototype._getSessionId=function(){var e=this.storage.getItem(this.sessionKey);return this.disableSession?"":e&&e.sessionId?e.sessionId:""},e.prototype._resetExpTime=function(){var e=this;this.sessionExp&&(clearInterval(this.sessionExp),this.sessionExp=setInterval((function(){e._checkEXp()}),this.expireTime))},e.prototype._resetSessionId=function(){var e={sessionId:at(),timestamp:Date.now()};this.storage.setItem(this.sessionKey,e)},e.prototype._checkEXp=function(){var e=this.storage.getItem(this.sessionKey);e&&e.sessionId&&Date.now()-e.timestamp+30>=this.expireTime&&(e={sessionId:at(),timestamp:Date.now()},this.storage.setItem(this.sessionKey,e))},e}(),ct={pv:["predefine_pageview"],sdk:["_be_active","predefine_page_alive","predefine_page_close","__profile_set","__profile_set_once","__profile_increment","__profile_unset","__profile_append"],autotrack:["bav2b_click","bav2b_page","bav2b_beat","bav2b_page_statistics","__bav_click","__bav_page","__bav_beat","__bav_page_statistics"]},ut=function(){function e(e,t,n,i){this.count={pv:0,sdk:0,autotrack:0,log:0},this.limit={pv:1,sdk:10,autotrack:10,log:3},this.errorCode={f_net:0,f_data:0},this.errorInfo={pv:{f_net:0,f_data:0},sdk:{f_net:0,f_data:0},autotrack:{f_net:0,f_data:0},log:{f_net:0,f_data:0}},this.collect=e,this.disable_tracer=t.disable_tracer||t.channel_domain,this.ready=!(!t.app_id||this.disable_tracer),this.appid=t.app_id,this.process=n,this.event=i;var r=t.channel_domain||Ke(xe[t.channel]);this.reportUrl=t.report_url?t.report_url:""+r+Oe,this.listener()}return e.prototype.addCount=function(e){try{if(!this.ready)return;if(this.count[e]++,this.count[e]>=this.limit[e]){var t=[];for(var n in t=ke(t,this.processTracer(this.count[e],e,"net")),this.errorInfo[e])this.errorInfo[n]&&(t=ke(t,this.processTracer(this.errorInfo[e][n],e,n)));t.length&&this.sendTracer(t,!0,e,!1)}}catch(e){}},e.prototype.addErrorCount=function(e,t,n,i){var r=this;try{if(!this.ready)return;if(e&&e.length){var o=e[0].events;o&&o.length&&("f_data"===t?(i&&i.hasOwnProperty("sc")?this.errorInfo.log.f_data=o.length-i.sc:this.errorInfo.log.f_data=o.length,this.errorCode.f_data=n):o.forEach((function(e){var t="log";for(var i in ct)if(-1!==ct[i].indexOf(e.event)){t=i;break}r.errorInfo[t].f_net++,r.errorCode.f_net=n})))}}catch(e){}},e.prototype.clearCount=function(e){try{e?(this.count[e]=0,this.errorInfo[e]={f_net:0,f_data:0}):(this.count={pv:0,sdk:0,autotrack:0,log:0},this.errorInfo={pv:{f_net:0,f_data:0},sdk:{f_net:0,f_data:0},autotrack:{f_net:0,f_data:0},log:{f_net:0,f_data:0}})}catch(e){}},e.prototype.sendTracer=function(e,t,n,i){try{if(!this.ready)return;if(this.collect.staging)return;var r=this.event._mergeEvents(e);i&&window.navigator.sendBeacon?window.navigator.sendBeacon(this.reportUrl,JSON.stringify(r)):qe(this.reportUrl,3e5,r,""),t?this.clearCount(n):this.clearCount()}catch(e){}},e.prototype.processTracer=function(e,t,n){try{var i={count:e,state:n,key:t,params_for_special:"applog_trace",aid:this.appid,platform:"web",_staging_flag:1,sdk_version:Le};"f_net"!==n&&"f_data"!==n||(i.errorCode=this.errorCode[n]);var r=[];if(r.push(this.process("applog_trace",i,!0)),r&&r.length)return delete r[0].is_bav,r}catch(e){}},e.prototype.listener=function(){var e=this;this.ready&&(document.addEventListener("visibilitychange",(function(){e.leavePage()})),Qe((function(){e.leavePage()})))},e.prototype.leavePage=function(){if(this.ready)try{var e=[];for(var t in this.count)if(this.count[t]){var n=this.errorInfo[t];for(var i in e=ke(e,this.processTracer(this.count[t],t,"net")),n)n[i]&&(e=ke(e,this.processTracer(n[i],t,i)))}e&&e.length&&this.sendTracer(e,!1,"",!0)}catch(e){}},e}(),lt=function(){function e(e){this.logger=e}var t=e.prototype;return t.bridgeInject=function(){try{return AppLogBridge?(this.logger.info("AppLogBridge is injected"),!0):(this.logger.info("AppLogBridge is not inject"),!1)}catch(e){return this.logger.info("AppLogBridge is not inject"),!1}},t.hasStarted=function(e){var t=this;try{this.bridgeInject()?AppLogBridge.hasStarted((function(n){t.logger.info("AppLogBridge is started? : "+n),e(n)})):e(0)}catch(t){this.logger.info("AppLogBridge, error:"+JSON.stringify(t.stack)),e(0)}},t.setUserUniqueId=function(e){try{AppLogBridge.setUserUniqueId(e)}catch(e){this.logger.error("setUserUniqueId error")}},t.addHeaderInfo=function(e,t){try{AppLogBridge.addHeaderInfo(e,t)}catch(e){this.logger.error("addHeaderInfo error")}},t.setHeaderInfo=function(e){try{AppLogBridge.setHeaderInfo(JSON.stringify(e))}catch(e){this.logger.error("setHeaderInfo error")}},t.removeHeaderInfo=function(e){try{AppLogBridge.removeHeaderInfo(e)}catch(e){this.logger.error("removeHeaderInfo error")}},t.onEventV3=function(e,t){try{AppLogBridge.onEventV3(e,t)}catch(e){this.logger.error("onEventV3 error")}},t.profileSet=function(e){try{AppLogBridge.profileSet(e)}catch(e){this.logger.error("profileSet error")}},t.profileSetOnce=function(e){try{AppLogBridge.profileSetOnce(e)}catch(e){this.logger.error("profileSetOnce error")}},t.profileIncrement=function(e){try{AppLogBridge.profileIncrement(e)}catch(e){this.logger.error("profileIncrement error")}},t.profileUnset=function(e){try{AppLogBridge.profileUnset(e)}catch(e){this.logger.error("profileUnset error")}},t.profileAppend=function(e){try{AppLogBridge.profileAppend(e)}catch(e){this.logger.error("profileAppend error")}},e}(),ft=function(){function e(e,t,n){this.processEvent=e,this._event=t,this.cache={},this.duration=6e4,this.profileReady=!1,this.reportUrl=(n.channel_domain||Ke(xe[n.channel]))+"/profile/list"}return e.prototype.start=function(){this.profileReady=!0},e.prototype.report=function(e,t){void 0===t&&(t={});try{var n=[];n.push(this.processEvent(e,t));var i=this._event._mergeEvents(n);qe(this.reportUrl,3e5,i)}catch(e){}},e.prototype.setProfile=function(e){var t=this._formatParams(e);t&&Object.keys(t).length&&(this._pushCache(t),this.report("__profile_set",we({},t,{profile:!0})))},e.prototype.setOnceProfile=function(e){var t=this._formatParams(e,!0);t&&Object.keys(t).length&&(this._pushCache(t),this.report("__profile_set_once",we({},t,{profile:!0})))},e.prototype.incrementProfile=function(e){e?this.report("__profile_increment",we({},e,{profile:!0})):console.warn("please check the params, must be object!!!")},e.prototype.unsetProfile=function(e){if(e){var t={};t[e]="1",this.report("__profile_unset",we({},t,{profile:!0}))}else console.warn("please check the key, must be string!!!")},e.prototype.appendProfile=function(e){if(e){var t={};for(var n in e)"string"==typeof e[n]||"Array"===Object.prototype.toString.call(e[n]).slice(8,-1)?t[n]=e[n]:console.warn("please check the value of param: "+n+", must be string or array !!!");Object.keys(t).length&&this.report("__profile_append",we({},t,{profile:!0}))}else console.warn("please check the params, must be object!!!")},e.prototype._pushCache=function(e){var t=this;Object.keys(e).forEach((function(n){t.cache[n]={val:t._clone(e[n]),timestamp:Date.now()}}))},e.prototype._formatParams=function(e,t){var n=this;void 0===t&&(t=!1);try{if(!e||"[object Object]"!==Object.prototype.toString.call(e))return void console.warn("please check the params type, must be object !!!");var i={};for(var r in e)"string"==typeof e[r]||"number"==typeof e[r]||"Array"===Object.prototype.toString.call(e[r]).slice(8,-1)?i[r]=e[r]:console.warn("please check the value of params:"+r+", must be string,number,Array !!!");var o=Object.keys(i);if(!o.length)return;var a=Date.now();return o.filter((function(i){var r=n.cache[i];return t?!r:!(r&&n._compare(r.val,e[i])&&a-r.timestampn.options.maxDuration||(n.event("predefine_page_alive",we({},dt(n.url_path,n.title,n.url),{duration:t,is_support_visibility_change:n.options.sup_vis_change?1:0,startTime:n.sessionStartTime}),"sdk"),n.sessionStartTime=pt())},this._setUpTimer=function(){return n.timerHandler&&clearInterval(n.timerHandler),setInterval((function(){pt()-n.sessionStartTime>n.options.aliveDTime&&n._sendEvent(!0)}),1e3)},this._visibilitychange=function(){"hidden"===document.visibilityState?n.timerHandler&&(clearInterval(n.timerHandler),n._sendEvent()):"visible"===document.visibilityState&&(n.sessionStartTime=pt(),n.timerHandler=n._setUpTimer())},this._beforeunload=function(){document.hidden||n._sendEvent()},this._wtest=function(){document.getElementById("wtest").innerHTML="visibilitychange"},this._dtest=function(){document.getElementById("dtest").innerHTML="dvisibilitychange"},this.event=e,this.config=t,this.isSupVisChange=gt(),this.options={maxDuration:432e5,aliveDTime:6e4,sup_vis_change:gt()},this.pageStartTime=ht(),this.sessionStartTime=this.pageStartTime,this.timerHandler=null,this.disableCallback=function(){}}return e.prototype.enable=function(e,t,n){this.url_path=e,this.url=n,this.title=t,this.disableCallback=this._enablePageAlive()},e.prototype.disable=function(){this.disableCallback(),this.pageStartTime=Date.now()},e.prototype._enablePageAlive=function(){var e=this;return this.timerHandler=this._setUpTimer(),document.addEventListener("visibilitychange",this._visibilitychange),Qe(this._beforeunload),function(){e._beforeunload(),document.removeEventListener("visibilitychange",e._visibilitychange),window.removeEventListener("beforeunload",e._beforeunload),window.removeEventListener("pagehide",e._beforeunload)}},e}(),mt=function(){function e(e,t){var n=this;this._visibilitychange=function(){"hidden"===document.visibilityState?n.activeEndTime=pt():"visible"===document.visibilityState&&(n.activeEndTime&&(n.totalTime+=n.activeEndTime-n.activeStartTime,n.activeTimes+=1),n.activeEndTime=void 0,n.activeStartTime=pt())},this._beforeunload=function(){if(n.totalTime+=(n.activeEndTime||pt())-n.activeStartTime,n.config.autotrack)try{window.sessionStorage.setItem("_tea_cache_duration",JSON.stringify({duration:n.totalTime,page_title:document.title||location.pathname}))}catch(e){}n._sendEventPageClose()},this.event=e,this.config=t,this.isSupVisChange=gt(),this.options={sup_vis_change:this.isSupVisChange},this.maxDuration=t.maxDuration||864e5,this.disableCallback=function(){},this.pageStartTime=ht(),this._resetData()}return e.prototype.enable=function(e,t,n){this.url_path=e,this.url=n,this.title=t,this.disableCallback=this._enablePageClose()},e.prototype.disable=function(){this.disableCallback()},e.prototype._resetData=function(){this.activeStartTime=void 0===this.activeStartTime?ht():Date.now(),this.activeEndTime=void 0,this.activeTimes=1,this.totalTime=0},e.prototype._sendEventPageClose=function(){var e=pt()-this.pageStartTime;this.totalTime<0||e<0||this.totalTime>=this.maxDuration||(this.event("predefine_page_close",we({},dt(this.url_path,this.title,this.url),{active_times:this.activeTimes,duration:this.totalTime,total_duration:e,is_support_visibility_change:this.options.sup_vis_change?1:0}),"sdk"),this.pageStartTime=Date.now(),this._resetData())},e.prototype._enablePageClose=function(){var e=this;return document.addEventListener("visibilitychange",this._visibilitychange),Qe(this._beforeunload),function(){e._beforeunload(),document.removeEventListener("visibilitychange",e._visibilitychange),window.removeEventListener("beforeunload",e._beforeunload),window.removeEventListener("pagehide",e._beforeunload)}},e}(),_t=function(){function e(e,t){this.pageAlive=new vt(e,t),this.pageClose=new mt(e,t),this.title=document.title||location.pathname,this.url=location.href,this.url_path=location.pathname,this._enable(this.url_path,this.title,this.url)}return e.prototype._enable=function(e,t,n){this.pageAlive.enable(e,t,n),this.pageClose.enable(e,t,n)},e.prototype._disable=function(){this.pageAlive.disable(),this.pageClose.disable()},e.prototype.reset=function(e,t,n){this._disable(),this._enable(e,t,n)},e}(),yt=function(){function e(e){var t=this;this._setInterval=function(){t._clearIntervalFunc=function(e,t){void 0===e&&(e=function(){}),void 0===t&&(t=1e3);var n,i=Date.now()+t;return n=window.setTimeout((function r(){var o=Date.now()-i;e(),i+=t,n=window.setTimeout(r,Math.max(0,t-o))}),t),function(){window.clearTimeout(n)}}((function(){t._isSessionhasEvent&&t._endCurrentSession()}),t.sessionInterval)},this._clearInterval=function(){t._clearIntervalFunc&&t._clearIntervalFunc()},this.sessionInterval=6e4,this._eventSenderFunc=e,this._startTime=0,this._lastTime=0,this._setInterval()}return e.prototype._endCurrentSession=function(){this._eventSenderFunc("_be_active",{start_time:this._startTime,end_time:this._lastTime,url:window.location.href,referrer:window.document.referrer},"sdk"),this._isSessionhasEvent=!1,this._startTime=0},e.prototype.process=function(){this._isSessionhasEvent||(this._isSessionhasEvent=!0,this._startTime=+new Date);var e=this._lastTime||+new Date;this._lastTime=+new Date,this._lastTime-e>this.sessionInterval&&(this._clearInterval(),this._endCurrentSession(),this._setInterval())},e}(),wt=function(){function e(){}return e.prototype.sdkOnload=function(e,t,n){if(!this.sdkReady){this.sdkReady=!0;try{if(0===n.length)return;var i=n[0],r=i.header,o=i.user,a=r.app_id,s=r.app_name,c=r.sdk_version,u=o.web_id,l={events:[{event:"onload",params:JSON.stringify({app_key:e,app_id:a,app_name:s||"",sdk_version:c}),local_time_ms:Date.now()}],user:{user_unique_id:u},header:{}};setTimeout((function(){qe(t,3e4,[l],"566f58151b0ed37e")}),16)}catch(e){}}},e.prototype.sdkError=function(e,t,n,i){try{var r=n[0],o=r.user,a=r.header,s=[];n.forEach((function(e){e.events.forEach((function(e){s.push(e)}))}));var c={events:s.map((function(t){return{event:"on_error",params:JSON.stringify({error_code:i,app_key:e,app_id:a.app_id,app_name:a.app_name||"",error_event:t.event,sdk_version:a.sdk_version,local_time_ms:t.local_time_ms,tea_event_index:Date.now(),params:t.params,header:JSON.stringify(a),user:JSON.stringify(o)}),local_time_ms:Date.now()}})),user:{user_unique_id:o.user_unique_id},header:{}};setTimeout((function(){qe(t,3e4,[c],"566f58151b0ed37e")}),16)}catch(e){}},e}(),bt=new Ie(!1),kt=function(e){return"__tea_sdk_ab_version_"+e},St=function(e){var t={ab_version:[],ab_ext_version:[],ab_version_multilink:[],data:null,timestamp:+new Date};try{t=bt.getItem(kt(e))||t}catch(e){}return t},Ct=function(e,t){try{var n=St(e);bt.setItem(kt(e),we({},n,t))}catch(e){}},Et=function(e,t,n){void 0===n&&(n=!1);var i=n?{ab_ext_version:t,timestamp:Date.now()}:{ab_version:t,timestamp:Date.now()};Ct(e,i)},Tt={},zt=[],It=function(e){e.length&&e.forEach((function(e){zt.push(e)}))};function xt(e,t,n,i){var r=e&&e.source||window.opener||window.parent,o=e&&e.origin||i||"*",a={type:t,payload:n};r.postMessage(JSON.stringify(a),o)}function At(e,t){Tt[e]=Tt[e]||[],Tt[e].push(t)}function Ot(e){if(zt.some((function(e){return"*"===e}))||zt.some((function(t){return e.origin.indexOf(t)>-1}))){var t=e.data;if("string"==typeof e.data)try{t=JSON.parse(e.data)}catch(e){t=void 0}if(!t)return;var n=t.type,i=t.payload;Tt[n]&&Tt[n].forEach((function(t){"function"==typeof t&&t(e,i)}))}}function Lt(e,t){(window.opener||window.parent).postMessage("[tea-sdk]ready","*"),(window.opener||window.parent).postMessage({type:"tea:sdk:info",config:e,version:t},"*"),window.addEventListener("message",Ot,!1)}function Pt(e,t,n){var i=document.createElement("script");i.src=e,i.onerror=function(){n(e)},i.onload=function(){t()},document.getElementsByTagName("head")[0].appendChild(i)}window.TEAVisualEditor=window.TEAVisualEditor||{};var Dt="",Mt=!1;function Bt(e){var t=e.event,n=e.editorUrl;e.collectInstance,e.fromSession,Mt||(Mt=!0,Pt(n,(function(){xt(t,"abEditorScriptloadSuccess")}),(function(){t&&xt(t,"abEditorScriptloadError"),Mt=!1})))}var jt,Nt,Ft=Ke("1fz22z22z1nz21z4mz4bz4bz1jz1dz49z1az1bz1lz49z22z1mz21z4az19z27z22z1cz21z1az1kz4az1az1mz1kz4bz1mz19z1hz4bz21z22z18z22z1gz1az4bz1jz1mz1ez49z21z1bz1iz4bz1az1mz1jz1jz1cz1az22z4bz24z1gz21z23z18z1jz49z18z19z49z1jz1mz18z1bz1cz20z4az1hz21")+"?query="+Date.now();!function(e){e[e.No=0]="No",e[e.Ing=1]="Ing",e[e.Complete=2]="Complete"}(jt||(jt={})),function(e){e[e.Var=0]="Var",e[e.All=1]="All"}(Nt||(Nt={}));var Rt=function(){function e(e,t,n){this.appId=0,this.user={},this.header={},this.domain="",this.protocal=location.protocol,this.fetchStatus=jt.No,this.callbacks=[],this.data=null,this.versions=[],this.extVersions=[],this.mulilinkVersions=[],this.collector=e;var i=this.collector._initConfig,r=i.app_id,o=i.channel,a=i.enable_multilink,s=i.multilink_timeout_ms,c=i.ab_channel_domain,u=i.channel_domain,l=i.enable_ab_visual,f=i.ab_timeout;if(this.appId=r,this.timeout=f||3e3,this.domain=c||Ke(Re[o||"cn"]),this.domain){this.needOverlay=a||l||!1,this.enable_ab_visual=l,this.enable_multilink=a,this.closeTime=s||500,this.Hook=t;var d=u||Ke(xe[o]);if(this.reportUrl=""+d+Oe,l){!function(e,t,n,i){It(["*"]);var r,o="";Lt(i,Le);var a="";try{var s=window.performance.getEntriesByType("resource");if(s&&s.length&&(s.forEach((function(e){"script"===e.initiatorType&&e.name&&-1!==e.name.indexOf("collect")&&(a=e.name)})),a||document.currentScript&&(a=document.currentScript.src),a&&(r=a.split("/"))&&r.length)){o="https:/";for(var c=2;c=2592e6){try{bt.removeItem("__tea_sdk_ab_version")}catch(e){}return null}return t}(this.appId);if(t){var n=t.ab_version,i=t.data,r=t.ab_ext_version,o=t.ab_version_multilink;this.mulilinkVersions=o||[],this.extVersions=r,n&&n.length&&(this.versions=n,this.data=i,setTimeout((function(){e._configVersions()})))}},e.prototype.wait=function(){var e=this;this.needOverlay&&(this.isWait||(this.openOverlayer(),this.isWait=!0),setTimeout((function(){e.closeOverlayer()}),this.closeTime))},e.prototype.getAllVars=function(e){if("function"!=typeof e)throw new Error("callback must be a function");var t={callback:e,type:Nt.All};this.fetchStatus===jt.Complete?this._getAllVars(t):this.callbacks.push(t)},e.prototype._getAllVars=function(e){(0,e.callback)(this.data?JSON.parse(JSON.stringify(this.data)):{})},e.prototype.getVids=function(){try{var e=St(this.appId).ab_version,t="";return e&&e.length&&(t=e.join(",")),t}catch(e){return""}},e.prototype.getAbSdkVersion=function(e){e(this.getVids())},e.prototype.getVar=function(e,t,n){if(!e)throw new Error("variable must not be empty");if(void 0===t)throw new Error("variable no default value");if("function"!=typeof n)throw new Error("callback must be a function");var i={name:e,defaultValue:t,callback:n,type:Nt.Var};if(this.fetchStatus===jt.Complete){this._getVar(i,e);try{this.Hook.emit("onAbSdkVersionChange",this.getVids())}catch(e){}}else this.callbacks.push(i)},e.prototype._getVar=function(e,t){var n=e.name,i=e.defaultValue,r=e.callback,o=this.data;if(o){if("object"==typeof o[n]&&void 0!==o[n].val){var a=o[n].vid;return"$ab_url"===t?(-1===this.mulilinkVersions.indexOf(a)&&this.mulilinkVersions.push(a),this._updateMultilinkVersions()):(-1===this.versions.indexOf(a)&&this.versions.push(a),this._updateVersions()),this._abEvent(a,t,i),void r(o[n].val)}r(i)}else r(i)},e.prototype._abEvent=function(e,t,n){var i=this;try{if(e){var r={event:"abtest_exposure",ab_sdk_version:""+e,params:JSON.stringify({app_id:this.appId,ab_url:"$ab_url"===t?n:window.location.href}),local_time_ms:Date.now()},o=this.collector._config.get(),a=o.header,s=o.user;a.ab_sdk_version=""+e,a.custom=JSON.stringify(a.custom);var c={events:[r],user:s,header:a};"$ab_url"===t?window.navigator.sendBeacon?window.navigator.sendBeacon(this.reportUrl,JSON.stringify([c])):qe(this.reportUrl,2e4,[c],""):setTimeout((function(){qe(i.reportUrl,2e4,[c],"")}),16)}}catch(e){}},e.prototype.openOverlayer=function(){!function(){if(!document.getElementById(Ve)){var e="body { opacity: 0 !important; }",t=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.id=Ve,n.type="text/css",n.styleSheet?n.styleSheet.cssText=e:n.appendChild(document.createTextNode(e)),t.appendChild(n)}}()},e.prototype.closeOverlayer=function(){var e;(e=document.getElementById(Ve))&&e.parentElement.removeChild(e)},e.prototype._setAbVersion=function(e){this.extVersions=[e],Et(this.appId,this.extVersions,!0)},e.prototype._updateVersions=function(){Et(this.appId,this.versions),this._configVersions()},e.prototype._updateMultilinkVersions=function(){var e,t;e=this.appId,t={ab_version_multilink:this.mulilinkVersions,timestamp:Date.now()},Ct(e,t)},e.prototype._configVersions=function(){var e=this.versions.join(",");e&&this.collector.config({ab_sdk_version:e})},e.prototype._getABconfig=function(e,t){var n=Object.keys(e);n&&n.length&&this.collector.config(e),this.init(this.collector._config.get(),t)},e.prototype._fetchComplete=function(e){var t=this;if(e){!function(e,t){Ct(e,{data:t})}(this.appId,e),this.data=e;var n=[];Object.keys(e).forEach((function(t){var i=e[t].vid;i&&n.push(i)})),-1!==window.location.href.indexOf("multilink=true")||(this.versions=this.versions.filter((function(e){return-1!==n.indexOf(e)})));var i=e.$ab_url,r=e.$ab_modification;if(r&&r.val&&this.enable_ab_visual){if(this.collector.destroyInstance)return;this.getVar("$ab_modification",window.location.href,(function(){var e;e=r.val,window.TEAVisualEditor.__ab_config=e,Pt(Ft,(function(){console.log("load visual render success")}),(function(){console.log("load visual render fail")}))}))}else if(i&&this.enable_multilink){var o=i.val,a=i.vid;o&&a&&this.getVar("$ab_url",o,(function(){var e=window.location.href;-1!==e.indexOf("multilink=true")&&(e=t.filterUrl(e)),o!==e?setTimeout((function(){if(!t.collector.destroyInstance){var e=""+o;-1!==(e=-1===e.indexOf("http")?"https://"+e:e).indexOf("?")?e+="&multilink=true":e+="?multilink=true",window.location.href=e}}),50):t.closeOverlayer()}))}else this.closeOverlayer()}this.callbacks.forEach((function(e){t[e.type===Nt.Var?"_getVar":"_getAllVars"](e,"")})),this.callbacks=[],this._updateVersions();try{this.Hook.emit("onAbSdkVersionChange",this.getVids())}catch(e){}this.isWait||this.closeOverlayer()},e.prototype._fetch=function(e,t){var n=this,i=void 0===t?{}:t,r=i.success,o=void 0===r?function(){}:r,a=i.fail,s=void 0===a?function(){}:a;this.fetchStatus=jt.Ing;var c=this.domain+"/service/2/abtest_config/",u=window.location.href,l=!1;-1!==u.indexOf("multilink=true")&&(u=this.filterUrl(u),l=!0);var f=l?this.mulilinkVersions:this.versions;We(c,{header:we({aid:this.appId},this.user||{},e||{},{ab_sdk_version:f.join(","),ab_url:u})},(function(e){n.fetchStatus=jt.Complete;var t=e.data;"success"===e.message?(n._fetchComplete(t),o(t)):(n._fetchComplete(null),s())}),(function(){n.fetchStatus=jt.Complete,s(),n._fetchComplete(null)}),"",this.timeout)},e.prototype.filterUrl=function(e){try{var t="";-1!==e.indexOf("&multilink=true")?t="&multilink=true":-1!==e.indexOf("?multilink=true")&&(t="\\?multilink=true");var n=new RegExp(t,"g");e=e.replace(n,"")}catch(e){}return e},e}(),Vt=function(e,t,n,i){if(t){var r=e.filter((function(e){return!e[0].__disable_storage__})).length;if(r>0)try{var o=i.getItem(n);if(o){var a=Object.keys(o),s=a.length+r-t;if(s>0){for(var c=a.map((function(e){var t=o[e];return{id:e,index:t&&t[0]?t[0].header.__storage_index__:+new Date}})).sort((function(e,t){return e.index-t.index})),u=0;u0?i+"?"+r:i}function $t(){var e="";try{e=document.referrer?document.referrer:Gt.getItem("__tea_cache_refer_key")===location.href?"":Gt.getItem("__tea_cache_refer_key")}catch(e){}return{is_html:1,page_key:location.href,refer_page_key:e,page_manual_key:"",refer_page_manual_key:""}}function Xt(e,t){var n=$t();return n.is_back=0,n}function Yt(e,t){void 0===t&&(t=!1),function(e){var t,n;t=window.history,n=t.pushState,t.pushState=function(i){"function"==typeof t.onpushstate&&t.onpushstate({state:i}),e("pushState",i,c);for(var r=arguments.length,o=new Array(r>1?r-1:0),a=1;a1?r-1:0),a=1;a0}))}return!0}(t))})(e.target)&&n.eventHandel({eventType:"dom",eventName:"click"},e)},this.changeEvent=function(e){n.eventHandel({eventType:"dom",eventName:"change"},e)},this.submitEvent=function(e){n.eventHandel({eventType:"dom",eventName:"submit"},e)},this.getPageViewEvent=function(e,t,i){"pushState"===e?n.eventHandel({eventType:"dom",eventName:"beat"},{beat_type:0}):n.eventHandel({eventType:"dom",eventName:"page_view"},i)},this.getPageLoadEvent=function(e){n.eventHandel({eventType:"dom",eventName:"page_statistics"},{lcp:e})},this.config=t.getConfig().eventConfig,this.options=e,this.beatTime=e.beat,this.statistics=!1}return e.prototype.init=function(e){this.eventHandel=e;var t=this.config.mode;this.addListener(t)},e.prototype.addListener=function(e){var t=this;if("proxy-capturing"===e&&(this.config.click&&window.document.addEventListener("click",this.clickEvent,!0),this.config.change&&window.document.addEventListener("change",this.changeEvent,!0),this.config.submit&&window.document.addEventListener("submit",this.submitEvent,!0),this.config.pv&&("complete"===document.readyState?Yt(this.getPageViewEvent,this.options.hashTag||this.config.hashTag):window.addEventListener("DOMContentLoaded",(function(){Yt(t.getPageViewEvent,t.options.hashTag||t.config.hashTag)}))),this.config.beat)){try{"complete"===document.readyState?this.beatEvent(this.beatTime):window.addEventListener("load",(function(){t.beatEvent(t.beatTime)}));var n=0,i=null;window.addEventListener("scroll",(function(){clearTimeout(i),i=setTimeout(r,500),n=document.documentElement.scrollTop||document.body.scrollTop}));var r=function(){(document.documentElement.scrollTop||document.body.scrollTop)==n&&t.eventHandel({eventType:"dom",eventName:"beat"},{beat_type:1})}}catch(e){}try{var o=window.performance&&window.performance.getEntriesByType("paint");o&&o.length?(new PerformanceObserver((function(e){var n=e.getEntries(),i=n[n.length-1],r=i.renderTime||i.loadTime;t.statistics||(t.getPageLoadEvent(r),t.statistics=!0)})).observe({entryTypes:["largest-contentful-paint"]}),setTimeout((function(){t.statistics||(t.getPageLoadEvent(o[0].startTime||0),t.statistics=!0)}),2e3)):this.getPageLoadEvent(0)}catch(e){this.getPageLoadEvent(0)}}},e.prototype.removeListener=function(){window.document.removeEventListener("click",this.clickEvent,!0),window.document.removeEventListener("change",this.changeEvent,!0),window.document.removeEventListener("submit",this.submitEvent,!0)},e.prototype.beatEvent=function(e){var t=this;try{var n;this.eventHandel({eventType:"dom",eventName:"beat"},{beat_type:3}),this.beatTime&&(n=setInterval((function(){t.eventHandel({eventType:"dom",eventName:"beat"},{beat_type:2})}),e)),Qe((function(){t.eventHandel({eventType:"dom",eventName:"beat",eventSend:"becon"},{beat_type:0}),t.beatTime&&clearInterval(n)}))}catch(e){}},e}(),en={eventConfig:{mode:"proxy-capturing",submit:!1,click:!0,change:!1,pv:!0,beat:!0,hashTag:!1,impr:!1},scoutConfig:{mode:"xpath"}},tn=function(){function e(e){this.config=e}return e.prototype.getConfig=function(){return this.config},e.prototype.setConfig=function(e){return this.config=e},e}();function nn(e,t){var n={element_path:"",positions:[],texts:[]},i=function(e){if(e){var t=e.getBoundingClientRect(),n=t.width,i=t.height;return{left:t.left,top:t.top,element_width:n,element_height:i}}}(t),r=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});var n=e.clientX,i=e.clientY,r=t.left,o=t.top;return{touch_x:Math.floor(n-r),touch_y:Math.floor(i-o)}}(e,i),o=i.element_width,a=i.element_height,s=r.touch_x,c=r.touch_y,u=function(e){for(var t=[];null!==e.parentElement;)t.push(e),e=e.parentElement;var n=[],i=[];return t.forEach((function(e){var t=function(e){if(null===e)return{str:"",index:0};var t=0,n=e.parentElement;if(n)for(var i=n.children,r=0;r0)for(var r=t.childNodes,o=0;o0)for(var r=t.childNodes,o=0;o0?r:0)),t.page_start_ms=i.navigationStart}catch(e){console.log("page_statistics event error "+JSON.stringify(e))}return t},e.prototype.handleBeadtEvent=function(e){e.event=this.eventName.beat,e.page_key=window.location.href,e.is_html=1,e.page_title=document.title,e.page_manual_key="";try{e.page_total_width=document.documentElement.scrollWidth,e.page_total_height=document.documentElement.scrollHeight,e.scroll_width=document.documentElement.scrollLeft+window.innerWidth,e.scroll_height=document.documentElement.scrollTop+window.innerHeight,e.since_page_start_ms=Date.now()-window.performance.timing.navigationStart,e.page_start_ms=window.performance.timing.navigationStart}catch(e){console.log("beat event error "+JSON.stringify(e))}return e},e}(),an=function(){function e(e,t){this.logFunc=e,this.logFuncBecon=t,this.eventNameList=["report_click_event","report_change_event","report_submit_event","report_exposure_event","report_page_view_event","report_page_statistics_event","report_beat_event"]}return e.prototype.send=function(e,t){e.eventName;var n=e.eventSend,i=t.event;delete t.event,n&&"becon"===n?this.logFuncBecon(i,t,"autotrack"):this.logFunc(i,t,"autotrack")},e.prototype.get=function(e,t){var n=Object.assign({headers:{"content-type":"application/json"},method:"GET"},t);fetch(e,n)},e.prototype.post=function(e,t){var n=Object.assign({headers:{"content-type":"application/json"},method:"POST"},t);fetch(e,n)},e}(),sn="_TEA_VE_OPEN",cn="_TEA_VE_APIHOST",un="lang",ln="_VISUAL_EDITOR_V",fn="_VISUAL_EDITOR_U";function dn(){try{var e=window.TEAVisualEditor.lang=window.TEAVisualEditor.lang||Ce.get(un),t=window.TEAVisualEditor.__editor_ajax_domain=window.TEAVisualEditor.__editor_ajax_domain||Ce.get(cn),n=window.TEAVisualEditor.__editor_verison=window.TEAVisualEditor.__editor_verison||Ce.get(ln),i=window.TEAVisualEditor.__editor_url=window.TEAVisualEditor.__editor_url||Ce.get(fn),r=+new Date,o=new Date(r+18e5);Ce.set(sn,"1",{expires:o}),Ce.set(cn,t,{expires:o}),Ce.set(fn,i,{expires:o}),Ce.set(un,e,{expires:o}),Ce.set(ln,n||"",{expires:o})}catch(e){console.log("set cookie err")}}window.TEAVisualEditor=window.TEAVisualEditor||{};var pn="",hn=window.TEAVisualEditor.__editor_url||Ke("1fz22z22z1nz21z4mz4bz4bz21z4fz4az1nz21z22z18z22z1nz4az1az1mz1kz4bz1nz1ez1az4bz22z1cz1az1fz4bz1az1mz1jz1jz1cz1az22z4bz24z1gz21z23z18z1jz49z1cz1bz1gz22z1mz20z4az1hz21");hn=hn+"?query="+Date.now();var gn=Ke("1fz22z22z1nz21z4mz4bz4bz1jz1dz49z1az1bz1lz49z22z1mz21z4az19z27z22z1cz21z1az1kz4az1az1mz1kz4bz1mz19z1hz4bz21z22z18z22z1gz1az4bz1jz1mz1ez49z21z1bz1iz4bz1az1mz1jz1jz1cz1az22z4bz24z1gz21z23z18z1jz49z1cz1bz1gz22z1mz20z49z20z18z1lz1ez1cz20z21z4az1hz21")+"?query="+Date.now(),vn=!1;function mn(e){var t=e.event,n=e.editorUrl,i=e.autoTrackInstance;e.fromSession,vn||(vn=!0,Pt(n,(function(){xt(t,"editorScriptloadSuccess"),i.destroy()}),(function(){t&&xt(t,"editorScriptloadError"),vn=!1})))}function _n(e,t){window.TEAVisualEditor.appId=t.app_id;var n=t.channel_domain,i="";if(It(["*"]),n){var r,o="";try{var a=window.performance.getEntriesByType("resource");if(a&&a.length&&(a.forEach((function(e){"script"===e.initiatorType&&e.name&&-1!==e.name.indexOf("collect")&&(o=e.name)})),o||document.currentScript&&(o=document.currentScript.src),o&&(r=o.split("/"))&&r.length)){i="https:/";for(var s=2;s-1?(r=t.colloctor)[a].apply(r,n.slice(1)):(o=t.colloctor).event.apply(o,n)})),this.cmdQueue=[],this.name=e,this.colloctor=new Cn(e),this._isProcess=!1,this._alias={},this._processCmd(),kn.forEach((function(e){t._exportCollect[e]=t._exportCollect.bind(t,e)})),this._exportCollect},zn={},In={},xn=function(e){return In[e]||(In[e]=[]),In[e]},An=function(e){try{var t=be(e),n=t[0],i=t.slice(1);if(!n)return void console.error("the eventName is: "+n+", error, stop report, please check");var r=n.split(".");if(1===r.length)xn("default").push(ke([n],i));else if(2===r.length)"event"===r[0]?xn("default").push(ke([n],i)):xn(r[0]).push(ke([r[1]],i));else{var o=r[0],a=[r[1],r[2]].join(".");xn(o).push(ke([a],i))}}catch(e){console.log(e)}},On=function(){Ln.q.forEach((function(e){var t=[].slice.call(e);"Array"===Object.prototype.toString.call(t[0]).slice(8,-1)?t.forEach((function(e){An(e)})):An(t)})),Object.keys(In).forEach((function(e){In[e].forEach((function(t){(function(e){return zn[e]||(zn[e]=new Tn(e)),zn[e]})(e).apply(void 0,ke(t))})),In[e]=[]})),Ln.q=[]},Ln=function e(){for(var t=[],n=0;n=0&&(null!=(Wn=window)&&Wn.Lark_Bridge||null!=(Un=window)&&null!=(qn=Un.webkit)&&null!=(Hn=qn.messageHandlers)&&Hn.invokeNative)?(window.isNewBridge=!0,Yn=new U):Yn=$n.getBridge():Yn=window.__LarkPCSDK__?window.__LarkPCSDK__.bridge:{invoke:function(){},config:function(){}};var Zn={__v2__:!0},ei=0,ti=function(e,t){return function(){return e(t.apply(void 0,arguments))}},ni=function(){};var ii={},ri={},oi=function(e,t,n,i){var r={api_name:e};return t===le.success?(_e.includes(e)&&"monitorReport"!==e&&ye(me,ge[le.success]).addMap(r).setResultType(le.success).flush(),ui(n,e,le.success,"")):t===le.fail?("monitorReport"!==e&&ye(me,ge[le.fail]).addMap(r).setError(_(i)).setResultType(le.fail).flush(),ui(n,e,le.fail,i)):("monitorReport"!==e&&ye(me,ge[t]).addMap(r).setResultType(t).flush(),ui(n,e,t,i)),i};Yn.on=function(e,t,n){if("function"==typeof n)if(ri[e]=ri[e]||[],0===ri[e].length){var i={keep:!0,onSuccess:function(){for(var t=arguments.length,n=new Array(t),i=0;i0?ri[e].push(n):ri[e]=[n],window.isNewBridge){var i={success:n};Object.assign(i,{isListener:!0,eventName:e,progress:n}),ci.invoke(t,i)}},unsubscribe:function(e,t,n){var i=ri[e]||[];ri[e]=i.filter((function(e){return e!==n})),0===ri[e].length&&delete ii[e],window.isNewBridge&&si.removeListener(e,n)},subscribeHandler:function(e,t){var n=ri[e]||[];t=M(t),n.length&&n.forEach((function(e){"function"==typeof e&&e(t)}))}};function ui(e,t,n,i){var r,o,a,s;Vn("h5jssdk_call_api",{api_name:t,begin_time:e,timecost:+new Date-e,result:n,error:_(i),url:null==(r=window)||null==(o=r.location)?void 0:o.href,host:null==(a=window)||null==(s=a.location)?void 0:s.host,client:b(p),larkVersion:p.versions.larkVersion,platform:navigator.platform,browser:navigator.userAgent,app_id:w()})}var li=16e4;function fi(e){if("string"==typeof e){if(e.length<814)throw new Error("非法的base64String");return~~((e.length-814)/1.37)}return 0}var di,pi={navigation:new(function(){function e(){}var t=e.prototype;return t.setTitle=function(e){si.invoke("biz.navigation.setTitle",e)},t.setLeft=function(e){si.invoke("biz.navigation.setLeft",{control:e.control,text:e.text,isShowIcon:e.isShowIcon},{onSuccess:e.onSuccess,keep:!0})},t.setRight=function(e){si.invoke("biz.navigation.setRight",e)},t.setMenu=function(e){(function(e){for(var t,n=l(e);!(t=n()).done;){var i=t.value;if(i.imageBase64&&fi(i.imageBase64)>li)throw new Error("imageSize超过160000");if(i.imageBase64&&i.text)throw new Error("text和imageBase64只能传一个")}return!0})(e.items)&&(si.off("biz.navigation.setMenu"),si.invoke("biz.navigation.setMenu",{items:e.items},{onSuccess:e.onSuccess,keep:!0}))},t.goBack=function(e){si.invoke("biz.navigation.goBack",{},{onSuccess:e.onSuccess})},t.close=function(e){si.invoke("biz.navigation.close",{},{onSuccess:e.onSuccess})},e}()),util:new(function(){function e(){}var t=e.prototype;return t.uploadImage=function(e){si.invoke("biz.util.uploadImage",{multiple:e.multiple,max:e.max},{onSuccess:e.onSuccess})},t.copyText=function(e){si.invoke("biz.util.copyText",e)},t.share=function(e){var t=e.url,n=e.title,i=e.content,r=e.image,o=e.onSuccess;si.invoke("biz.util.share",{url:t,title:n,content:i,image:r},{onSuccess:o})},t.getCookies=function(e){si.invoke("biz.util.getCookies",{},{onSuccess:e.onSuccess})},t.scan=function(e){void 0===e&&(e={});var t={};e.type&&(t.type="string"==typeof e.type?[e.type]:e.type),void 0!==e.barCodeInput&&(t.barCodeInput=e.barCodeInput),si.invoke("biz.util.scan",t,{onSuccess:e.onSuccess})},t.datePicker=function(e){si.invoke("biz.util.datePicker",{format:e.format,value:e.value},{onSuccess:e.onSuccess})},t.timePicker=function(e){si.invoke("biz.util.timePicker",{format:e.format,value:e.value},{onSuccess:e.onSuccess})},t.dateTimePicker=function(e){si.invoke("biz.util.dateTimePicker",{format:e.format,value:e.value},{onSuccess:e.onSuccess})},t.chosen=function(e){si.invoke("biz.util.chosen",{source:e.source,selectedKey:e.selectedKey},{onSuccess:e.onSuccess})},t.multiSelect=function(e){si.invoke("biz.util.multiSelect",{options:e.options,selectOption:e.selectOption},{onSuccess:e.onSuccess})},t.getAppLanguage=function(e){si.invoke("biz.util.getAppLanguage",{},{onSuccess:e.onSuccess})},t.setAuthenticationInfo=function(e){si.invoke("biz.util.setAuthenticationInfo",JSON.parse(JSON.stringify(e)),{onSuccess:e.onSuccess,onFail:e.onFail})},t.startBiometrics=function(e){si.invoke("biz.util.startBiometrics",JSON.parse(JSON.stringify(e)),{onSuccess:e.onSuccess,onFail:e.onFail})},t.savePageSnapshot=function(e){si.invoke("biz.util.savePageSnapshot",{},{onSuccess:e.onSuccess,onFail:e.onFail})},t.sharePageSnapshot=function(e){si.invoke("biz.util.sharePageSnapshot",{},{onSuccess:e.onSuccess,onFail:e.onFail})},t.downloadFile=function(e){var t="downloadFile"+Date.now()+"_"+Math.floor(1e4*Math.random());return si.invoke("biz.util.downloadFile",{url:e.url,taskId:t},{onSuccess:e.onSuccess,onFail:e.onFail,onProgress:e.onProgress}),{abort:function(){si.invoke("biz.util.cancelDownloadFile",{taskId:t})}}},e}()),reporter:new(function(){function e(){}return e.prototype.sendEvent=function(e,t,n){si.invoke("biz.reporter.sendEvent",{category:e,action:t,params:n})},e}()),chat:new(function(){function e(){}var t=e.prototype;return t.openSingleChat=function(e){si.invoke("biz.chat.openSingleChat",{chatterId:e.chatterId},{onSuccess:e.onSuccess})},t.toConversation=function(e){si.invoke("biz.chat.toConversation",{chatId:e.chatId},{onSuccess:e.onSuccess})},e}()),contact:new(function(){function e(){}return e.prototype.choose=function(e){si.invoke("biz.contact.choose",JSON.parse(JSON.stringify(e)),{onSuccess:e.onSuccess})},e}())},hi=new(function(){function e(){}var t=e.prototype;return t.showPreloader=function(e){si.invoke("device.notification.showPreloader",e)},t.hidePreloader=function(){si.invoke("device.notification.hidePreloader",{})},t.confirm=function(e){si.invoke("device.notification.confirm",{message:e.message,title:e.title,buttonLabels:e.buttonLabels},{onSuccess:e.onSuccess})},t.alert=function(e){si.invoke("device.notification.alert",e)},t.toast=function(e){si.invoke("device.notification.toast",Object.assign({},e,{duration:2}))},t.prompt=function(e){si.invoke("device.notification.prompt",{message:e.message,title:e.title,buttonLabels:e.buttonLabels},{onSuccess:e.onSuccess})},t.vibrate=function(e){si.invoke("device.notification.vibrate",{duration:e.duration},{onSuccess:e.onSuccess})},t.actionSheet=function(e){si.invoke("device.notification.actionSheet",{title:e.title,cancelButton:e.cancelButton,otherButtons:e.otherButtons},{onSuccess:e.onSuccess})},e}());!function(e){e.wifi="wifi",e.lbs="lbs",e.gps="gps"}(di||(di={}));var gi,vi=new(function(){function e(){}var t=e.prototype;return t.get=function(e){si.invoke("device.geolocation.get",{useCache:e.useCache},{onSuccess:e.onSuccess,onFail:e.onFail})},t.start=function(e){var t=e.useCache,n=e.interval,i=e.sceneId,r=e.onSuccess,o=e.onFail;si.invoke("device.geolocation.start",{useCache:t,interval:n,sceneId:i},{onSuccess:r,onFail:o,keep:!0})},t.stop=function(e){si.invoke("device.geolocation.stop",{sceneId:e.sceneId},{onSuccess:e.onSuccess,onFail:e.onFail})},e}()),mi=new(function(){function e(){}var t=e.prototype;return t.getNetworkType=function(e){si.invoke("device.connection.getNetworkType",{},{onSuccess:e.onSuccess,onFail:e.onFail})},t.scanBluetoothDevice=function(e){si.invoke("device.connection.scanBluetoothDevice",{scanTimeout:e.scanTimeout},{onSuccess:e.onSuccess})},t.getBluetoothDeviceState=function(e){si.invoke("device.connection.getBluetoothDeviceState",{},{onSuccess:e.onSuccess})},t.connectBluetoothDevice=function(e){si.invoke("device.connection.connectBluetoothDevice",{id:e.id,uuid:e.uuid},{onSuccess:e.onSuccess})},e}());!function(e){e.captureScreen="event.user.captureScreen",e.networkStatusChange="event.connection.networkStatusChange"}(gi||(gi={}));var _i={notification:hi,geolocation:vi,connection:mi,base:new(function(){function e(){}var t=e.prototype;return t.getInterface=function(e){si.invoke("device.base.getInterface",{},{onSuccess:e.onSuccess})},t.getWifiStatus=function(e){si.invoke("device.base.getWifiStatus",{},{onSuccess:e.onSuccess})},t.getWifiList=function(e){si.invoke("device.base.getWifiList",{},{onSuccess:e.onSuccess})},t.getDeviceInfo=function(e){si.invoke("device.base.getDeviceInfo",{},{onSuccess:e.onSuccess})},t.onUserCaptureScreen=function(e){si.on(gi.captureScreen,"device.base.onUserCaptureScreen",e)},t.offUserCaptureScreen=function(e){si.off(gi.captureScreen,"device.base.offUserCaptureScreen",e)},e}()),screen:new(function(){function e(){}var t=e.prototype;return t.lockViewOrientation=function(e){si.invoke("device.screen.lockViewOrientation",{toHorizontal:e.toHorizontal,clockwise:e.clockwise},{onSuccess:e.onSuccess,onFail:e.onFail})},t.unlockViewOrientation=function(e){si.invoke("device.screen.unlockViewOrientation",{},{onSuccess:e.onSuccess,onFail:e.onFail})},e}())};var yi,wi=Object.freeze({__proto__:null,getRecentApplications:function(e){si.invoke("appCenter.getAppList",{},{onSuccess:e.onSuccess,keep:!0})},putRecentApplication:function(e){var t=e.appId,n=e.appType;si.invoke("appCenter.putAppRecent",{appId:t,appType:n},{onSuccess:e.onSuccess,keep:!0})}}),bi=document.createElement("iframe");bi.style.display="none",null==(yi=document.body)||yi.appendChild(bi);var ki,Si=function(e,t){return new Promise((function(n,i){var r=setTimeout((function(){i(new Error("h5jssdk_getSDKConfig_timeout")),Vn("h5jssdk_getSDKConfig_timeout"),ye(ve,ge[ue.getSdkConfigTimeout]).flush()}),3e3);si.invoke("getSDKConfig",{param:JSON.stringify({build:t})},{onSuccess:function(t){r&&clearTimeout(r);try{"android"===e&&t.apiInfoList?n(t.apiInfoList.map((function(e){return e.name}))):0===t.code?n(t.data.apiInfoList.map((function(e){return e.name}))):n(!0)}catch(e){i(e),Vn("h5jssdk_getSDKConfigErr",e),ye(ve,ge[ue.getSdkConfigError]).setError(_(e)).flush()}},onFail:function(e){r&&clearTimeout(r),i(e),Vn("h5jssdk_getSDKConfigErr",e),ye(ve,ge[ue.getSdkConfigError]).setError(_(e)).flush()}})}))},Ci=function(){var e=a(s.mark((function e(t,n,i){var r,o,a,c,u,l,f;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},e.prev=1,e.next=4,Si(t,i);case 4:(o=e.sent)&&(r={openList:o,byteList:[]}),e.next=10;break;case 8:e.prev=8,e.t0=e.catch(1);case 10:if(c=(a=r).openList,u=void 0===c?[]:c,l=a.byteList,f=void 0===l?[]:l,"cdn"!==i){e.next=13;break}return e.abrupt("return",u);case 13:return e.abrupt("return",u.concat(f));case 14:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,n,i){return e.apply(this,arguments)}}(),Ei=function(e){var t=e.api,n=e.browser,i=e.SDK,r=e.build;return ki=ki||new Promise((function(e,o){if(n.versions.mobileFeishu||n.versions.PCFeishu){var a=b(n),s=n.versions.larkVersion;if(!a||!s)return o(new Error("please use h5-js-sdk in Feishu or Lark APP"));Ci(a,s,r).then((function(n){void 0===n&&(n=[]),n.length?function(e,t,n){e.map((function(e){return e.split(".")})).forEach((function(e){e.reduce((function(t,n,i){if(null===t)return t;var r=t.feishu,o=t.api;return void 0===o[n]?null:e.length===i+1?(r[n]=o[n],null):(void 0===r[n]&&(r[n]={}),{feishu:r[n],api:o[n]})}),{feishu:t,api:n})}))}(n,i,t):Object.keys(t).forEach((function(e){i[e]=t[e]})),e()})).catch((function(e){Object.keys(t).forEach((function(e){i[e]=t[e]})),o(e)}))}else o(new Error("please use h5-js-sdk in Feishu or Lark APP"))}))},Ti={onSuccess:{type:"Function"},onFail:{type:"Function"}},zi=[{name:"device.base.getSystemInfo",args:Ti},{name:"biz.util.getClipboardInfo",args:Ti},{name:"biz.util.openDocument",args:Object.assign({url:{type:"String",required:!0},method:{type:"String"},fileType:{type:"String"},header:{type:"Object"},body:{type:"String"},onProgress:{type:"Function"}},Ti)},{name:"biz.contact.open",args:Object.assign({mode:{type:"String",default:"look",required:!0}},Ti)},{name:"biz.user.getUserInfo",args:Ti},{name:"biz.user.openDetail",args:Object.assign({openId:{type:"String",required:!0},position:{type:"Object"}},Ti)},{name:"biz.user.getUserInfoEx",args:Ti},{name:"device.health.getStepCount",args:Ti},{name:"device.connection.getConnectedWifi",args:Ti},{name:"device.connection.getGatewayIP",args:Ti},{name:"biz.util.previewImage",args:Object.assign({urls:{type:"Array"},current:{type:"String"},requests:{type:"Array"}},Ti)},{name:"biz.util.openLink",args:Object.assign({url:{type:"String",required:!0},title:{type:"String"},newTab:{type:"Boolean"}},Ti)}];function Ii(e,t){return t.forEach((function(t){var n=t.name,i=t.service,r=t.eventName,o=void 0===r?"":r,a=n.split("."),s=e;a.forEach((function(e,r){if(r===a.length-1){if(s[e])return v("the API ["+n+"] has exist, please check and modify");var c=e.match(/^(on|off)[A-Z]/),u=c?si[c[1]]:si.invoke,l=[null!=i?i:n];c&&l.unshift(o),s[e]=function(e){if(!t.args||(i=e,r=t.args,o=n,a=!0,s="",f=g(i),d=r.type||g(r),"Undefined"===f?"Object"===d?i={}:r.required&&(s="【"+o+"】:the argument expect a "+d+" but received a "+f,a=!1):f!==d&&(s="【"+o+"】:the argument expect a "+d+" but received a "+f,a=!1),a&&"Object"===d&&Object.keys(r).forEach((function(e){var t=r[e];t.default&&void 0===i[e]&&(i[e]=t.default),t.alias&&(i[t.alias]=i[e]);var n=g(i[e]);"Undefined"===n?t.required&&(s="【"+o+"】:the param ["+e+"] is required and must be "+t.type,a=!1):t.type!==n&&(s="【"+o+"】:the param ["+e+"] expect "+t.type+" but received "+n,a=!1)})),a||(i&&"function"==typeof i.onFail?i.onFail({errorCode:1015,errorMessage:s}):v(s)),a)){var i,r,o,a,s,f,d;if(c)return u.call.apply(u,[si].concat(l,[e]));var p=function(e){var t={},n={};return Object.keys(e).forEach((function(i){"function"==typeof e[i]?n[i]=e[i]:t[i]=e[i]})),{normal:t,callbacks:n}}(e||{}),h=p.normal,m=p.callbacks;return u.call.apply(u,[si].concat(l,[h,m]))}}}else s=s[e]||(s[e]={})}))})),e}var xi=t(n((function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.default=e.exports,e.exports.__esModule=!0}))),Ai=n((function(e){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0})),Oi=n((function(e){e.exports=function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)},e.exports.default=e.exports,e.exports.__esModule=!0})),Li=n((function(e){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0})),Pi=n((function(e){e.exports=function(e){return Ai(e)||Oi(e)||u(e)||Li()},e.exports.default=e.exports,e.exports.__esModule=!0})),Di=n((function(e){function t(n){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=t=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=t=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),t(n)}e.exports=t,e.exports.default=e.exports,e.exports.__esModule=!0})),Mi=n((function(e){var t=Di.default;e.exports=function(e,n){if("object"!==t(e)||null===e)return e;var i=e[Symbol.toPrimitive];if(void 0!==i){var r=i.call(e,n||"default");if("object"!==t(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)},e.exports.default=e.exports,e.exports.__esModule=!0})),Bi=n((function(e){var t=Di.default;e.exports=function(e){var n=Mi(e,"string");return"symbol"===t(n)?n:String(n)},e.exports.default=e.exports,e.exports.__esModule=!0})),ji=t(n((function(e){function t(){t=function(){return e};var e={elementsDefinitionOrder:[["method"],["field"]],initializeInstanceElements:function(e,t){["method","field"].forEach((function(n){t.forEach((function(t){t.kind===n&&"own"===t.placement&&this.defineClassElement(e,t)}),this)}),this)},initializeClassElements:function(e,t){var n=e.prototype;["method","field"].forEach((function(i){t.forEach((function(t){var r=t.placement;if(t.kind===i&&("static"===r||"prototype"===r)){var o="static"===r?e:n;this.defineClassElement(o,t)}}),this)}),this)},defineClassElement:function(e,t){var n=t.descriptor;if("field"===t.kind){var i=t.initializer;n={enumerable:n.enumerable,writable:n.writable,configurable:n.configurable,value:void 0===i?void 0:i.call(e)}}Object.defineProperty(e,t.key,n)},decorateClass:function(e,t){var n=[],i=[],o={static:[],prototype:[],own:[]};if(e.forEach((function(e){this.addElementPlacement(e,o)}),this),e.forEach((function(e){if(!r(e))return n.push(e);var t=this.decorateElement(e,o);n.push(t.element),n.push.apply(n,t.extras),i.push.apply(i,t.finishers)}),this),!t)return{elements:n,finishers:i};var a=this.decorateConstructor(n,t);return i.push.apply(i,a.finishers),a.finishers=i,a},addElementPlacement:function(e,t,n){var i=t[e.placement];if(!n&&-1!==i.indexOf(e.key))throw new TypeError("Duplicated element ("+e.key+")");i.push(e.key)},decorateElement:function(e,t){for(var n=[],i=[],r=e.decorators,o=r.length-1;o>=0;o--){var a=t[e.placement];a.splice(a.indexOf(e.key),1);var s=this.fromElementDescriptor(e),c=this.toElementFinisherExtras((0,r[o])(s)||s);e=c.element,this.addElementPlacement(e,t),c.finisher&&i.push(c.finisher);var u=c.extras;if(u){for(var l=0;l=0;i--){var r=this.fromClassDescriptor(e),o=this.toClassDescriptor((0,t[i])(r)||r);if(void 0!==o.finisher&&n.push(o.finisher),void 0!==o.elements){e=o.elements;for(var a=0;a>16&255):64===i?String.fromCharCode(t>>16&255,t>>8&255):String.fromCharCode(t>>16&255,t>>8&255,255&t);return r};function Gi(e){for(var t=Ki(e),n=t.length,i=new Uint8Array(n),r=0;r0;)if(o===e[a])return i;r(t)}}Object.assign(h.prototype,{subscribe:function(e,t,n){var i=this,r=this._target,o=this._emitter,a=this._listeners,s=function(){var i=d.apply(null,arguments),a={data:i,name:t,original:e};if(n){var s=n.call(r,a);!1!==s&&o.emit.apply(o,[a.name].concat(i))}else o.emit.apply(o,[t].concat(i))};if(a[e])throw Error("Event '"+e+"' is already listening");this._listenersCount++,o._newListener&&o._removeListener&&!i._onNewListener?(this._onNewListener=function(n){n===t&&null===a[e]&&(a[e]=s,i._on.call(r,e,s))},o.on("newListener",this._onNewListener),this._onRemoveListener=function(n){n===t&&!o.hasListeners(n)&&a[e]&&(a[e]=null,i._off.call(r,e,s))},a[e]=null,o.on("removeListener",this._onRemoveListener)):(a[e]=s,i._on.call(r,e,s))},unsubscribe:function(e){var t,n,i,r=this,o=this._listeners,a=this._emitter,s=this._off,u=this._target;if(e&&"string"!=typeof e)throw TypeError("event must be a string");function l(){r._onNewListener&&(a.off("newListener",r._onNewListener),a.off("removeListener",r._onRemoveListener),r._onNewListener=null,r._onRemoveListener=null);var e=b.call(a,r);a._observers.splice(e,1)}if(e){if(!(t=o[e]))return;s.call(u,e,t),delete o[e],--this._listenersCount||l()}else{for(i=(n=c(o)).length;i-- >0;)e=n[i],s.call(u,e,o[e]);this._listeners={},this._listenersCount=0,l()}}});var _=m(["function"]),y=m(["object","function"]);function w(e,t,n){var i,r,o,a=0,s=new e((function(c,u,l){function f(){r&&(r=null),a&&(clearTimeout(a),a=0)}n=g(n,{timeout:0,overload:!1},{timeout:function(e,t){return("number"!=typeof(e*=1)||e<0||!Number.isFinite(e))&&t("timeout must be a positive number"),e}}),i=!n.overload&&"function"==typeof e.prototype.cancel&&"function"==typeof l;var d=function(e){f(),c(e)},p=function(e){f(),u(e)};i?t(d,p,l):(r=[function(e){p(e||Error("canceled"))}],t(d,p,(function(e){if(o)throw Error("Unable to subscribe on cancel event asynchronously");if("function"!=typeof e)throw TypeError("onCancel callback must be a function");r.push(e)})),o=!0),n.timeout>0&&(a=setTimeout((function(){var e=Error("timeout");e.code="ETIMEDOUT",a=0,s.cancel(e),u(e)}),n.timeout))}));return i||(s.cancel=function(e){if(r){for(var t=r.length,n=1;n0;)"_listeners"!==(p=_[s])&&(y=k(e,t,n[p],i+1,r))&&(w?w.push.apply(w,y):w=y);return w}if("**"===b){for((m=i+1===r||i+2===r&&"*"===S)&&n._listeners&&(w=k(e,t,n,r,r)),s=(_=c(n)).length;s-- >0;)"_listeners"!==(p=_[s])&&("*"===p||"**"===p?(n[p]._listeners&&!m&&(y=k(e,t,n[p],r,r))&&(w?w.push.apply(w,y):w=y),y=k(e,t,n[p],i,r)):y=k(e,t,n[p],p===S?i+2:i,r),y&&(w?w.push.apply(w,y):w=y));return w}if(n[b]&&(w=k(e,t,n[b],i+1,r)),(h=n["*"])&&k(e,t,h,i+1,r),g=n["**"])if(i0;)"_listeners"!==(p=_[s])&&(p===S?k(e,t,g[p],i+2,r):p===b?k(e,t,g[p],i+1,r):((v={})[p]=g[p],k(e,t,{"**":v},i+1,r)));else g._listeners?k(e,t,g,r,r):g["*"]&&g["*"]._listeners&&k(e,t,g["*"],r,r);return w}function S(e,t,n){var i,r,o=0,a=0,s=this.delimiter,c=s.length;if("string"==typeof e)if(-1!==(i=e.indexOf(s))){r=new Array(5);do{r[o++]=e.slice(a,i),a=i+c}while(-1!==(i=e.indexOf(s,a)));r[o++]=e.slice(a)}else r=[e],o=1;else r=e,o=e.length;if(o>1)for(i=0;i+10&&l._listeners.length>this._maxListeners&&(l._listeners.warned=!0,f.call(this,l._listeners.length,u))):l._listeners=t,!0;return!0}function C(e,t,n,i){for(var r,o,a,s,u=c(e),l=u.length,f=e._listeners;l-- >0;)r=e[o=u[l]],a="_listeners"===o?n:n?n.concat(o):[o],s=i||"symbol"==typeof o,f&&t.push(s?a:a.join(this.delimiter)),"object"==typeof r&&C.call(this,r,t,a,s);return t}function E(e){for(var t,n,i,r=c(e),o=r.length;o-- >0;)(t=e[n=r[o]])&&(i=!0,"_listeners"===n||E(t)||delete e[n]);return i}function T(e,t,n){this.emitter=e,this.event=t,this.listener=n}function z(e,n,i){if(!0===i)a=!0;else if(!1===i)o=!0;else{if(!i||"object"!=typeof i)throw TypeError("options should be an object or true");var o=i.async,a=i.promisify,c=i.nextTick,u=i.objectify}if(o||c||a){var l=n,f=n._origin||n;if(c&&!r)throw Error("process.nextTick is not supported");a===t&&(a="AsyncFunction"===n.constructor.name),(n=function(){var e=arguments,t=this,n=this.event;return a?c?Promise.resolve():new Promise((function(e){s(e)})).then((function(){return t.event=n,l.apply(t,e)})):(c?process.nextTick:s)((function(){t.event=n,l.apply(t,e)}))})._async=!0,n._origin=f}return[n,u?new T(this,e,n):this]}function I(e){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,l.call(this,e)}T.prototype.off=function(){return this.emitter.off(this.event,this.listener),this},I.EventEmitter2=I,I.prototype.listenTo=function(e,n,r){if("object"!=typeof e)throw TypeError("target musts be an object");var o=this;function a(t){if("object"!=typeof t)throw TypeError("events must be an object");var n,i=r.reducers,a=b.call(o,e);n=-1===a?new h(o,e,r):o._observers[a];for(var s,u=c(t),l=u.length,f="function"==typeof i,d=0;d0;)i=n[r],e&&i._target!==e||(i.unsubscribe(t),o=!0);return o},I.prototype.delimiter=".",I.prototype.setMaxListeners=function(e){e!==t&&(this._maxListeners=e,this._conf||(this._conf={}),this._conf.maxListeners=e)},I.prototype.getMaxListeners=function(){return this._maxListeners},I.prototype.event="",I.prototype.once=function(e,t,n){return this._once(e,t,!1,n)},I.prototype.prependOnceListener=function(e,t,n){return this._once(e,t,!0,n)},I.prototype._once=function(e,t,n,i){return this._many(e,1,t,n,i)},I.prototype.many=function(e,t,n,i){return this._many(e,t,n,!1,i)},I.prototype.prependMany=function(e,t,n,i){return this._many(e,t,n,!0,i)},I.prototype._many=function(e,t,n,i,r){var o=this;if("function"!=typeof n)throw new Error("many only accepts instances of Function");function a(){return 0==--t&&o.off(e,a),n.apply(this,arguments)}return a._origin=n,this._on(e,a,i,r)},I.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||u.call(this);var e,t,n,i,r,a,s=arguments[0],c=this.wildcard;if("newListener"===s&&!this._newListener&&!this._events.newListener)return!1;if(c&&(e=s,"newListener"!==s&&"removeListener"!==s&&"object"==typeof s)){if(n=s.length,o)for(i=0;i3)for(t=new Array(f-1),r=1;r3)for(n=new Array(d-1),a=1;a0&&this._events[e].length>this._maxListeners&&(this._events[e].warned=!0,f.call(this,this._events[e].length,e))):this._events[e]=n,a)},I.prototype.off=function(e,t){if("function"!=typeof t)throw new Error("removeListener only takes instances of Function");var n,r=[];if(this.wildcard){var o="string"==typeof e?e.split(this.delimiter):e.slice();if(!(r=k.call(this,null,o,this.listenerTree,0)))return this}else{if(!this._events[e])return this;n=this._events[e],r.push({_listeners:n})}for(var a=0;a0){for(n=0,i=(t=this._all).length;n0;)"function"==typeof(i=s[n[o]])?r.push(i):r.push.apply(r,i);return r}if(this.wildcard){if(!(a=this.listenerTree))return[];var u=[],l="string"==typeof e?e.split(this.delimiter):e.slice();return k.call(this,u,l,a,0),u}return s&&(i=s[e])?"function"==typeof i?[i]:i:[]},I.prototype.eventNames=function(e){var t=this._events;return this.wildcard?C.call(this,this.listenerTree,[],null,e):t?c(t):[]},I.prototype.listenerCount=function(e){return this.listeners(e).length},I.prototype.hasListeners=function(e){if(this.wildcard){var n=[],i="string"==typeof e?e.split(this.delimiter):e.slice();return k.call(this,n,i,this.listenerTree,0),n.length>0}var r=this._events,o=this._all;return!!(o&&o.length||r&&(e===t?c(r).length:r[e]))},I.prototype.listenersAny=function(){return this._all?this._all:[]},I.prototype.waitFor=function(e,n){var i=this,r=typeof n;return"number"===r?n={timeout:n}:"function"===r&&(n={filter:n}),w((n=g(n,{timeout:0,filter:t,handleError:!1,Promise:Promise,overload:!1},{filter:_,Promise:v})).Promise,(function(t,r,o){function a(){var o=n.filter;if(!o||o.apply(i,arguments))if(i.off(e,a),n.handleError){var s=arguments[0];s?r(s):t(d.apply(null,arguments).slice(1))}else t(d.apply(null,arguments))}o((function(){i.off(e,a)})),i._on(e,a,!1)}),{timeout:n.timeout,overload:n.overload})};var x=I.prototype;Object.defineProperties(I,{defaultMaxListeners:{get:function(){return x._maxListeners},set:function(e){if("number"!=typeof e||e<0||Number.isNaN(e))throw TypeError("n must be a non-negative number");x._maxListeners=e},enumerable:!0},once:{value:function(e,t,n){return w((n=g(n,{Promise:Promise,timeout:0,overload:!1},{Promise:v})).Promise,(function(n,i,r){var o;if("function"==typeof e.addEventListener)return o=function(){n(d.apply(null,arguments))},r((function(){e.removeEventListener(t,o)})),void e.addEventListener(t,o,{once:!0});var a,s=function(){a&&e.removeListener("error",a),n(d.apply(null,arguments))};"error"!==t&&(a=function(n){e.removeListener(t,s),i(n)},e.once("error",a)),r((function(){a&&e.removeListener("error",a),e.removeListener(t,s)})),e.once(t,s)}),{timeout:n.timeout,overload:n.overload})},writable:!0,configurable:!0}}),Object.defineProperties(x,{_maxListeners:{value:10,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),e.exports=I}()})),ar="mp_app_onlaunch_beigin",sr="mp_app_onlaunch_end",cr="mp_app_onshow_begin",ur="mp_app_onshow_end",lr="mp_page_first_set_data",fr="appservice_create_page_start",dr="appservice_create_page_end",pr="appservice_on_app_route",hr="mp_block_first_set_data",gr="appservice_create_block_start",vr="appservice_create_block_end",mr="pageFrame_first_get_data",_r="pageFrame_get_screen_cache_data",yr="pageFrame_cache_dirty_data",wr="webview_evaluateJavascript_begin",br="webview_evaluateJavascript_end",kr="pageFrame_receive_render_snapshot_message",Sr="pageFrame_func_ready",Cr="pageFrame_snapshot_frame_show",Er="pageFrame_cache_re_render_end",Tr="pageFrame_first_render_begin",zr="pageFrame_first_render_end",Ir="pageFrame_create_virtual_tree_begin",xr="pageFrame_create_virtual_tree_end",Ar="pageFrame_create_element_tree_begin",Or="pageFrame_create_element_tree_end",Lr="pageFrame_apply_child_to_body_begin",Pr="pageFrame_apply_child_to_body_end",Dr="pageFrame_first_frame_show",Mr="pageFrame_cache_create_virtual_tree_begin",Br="pageFrame_cache_diff_virtual_tree_begin",jr="pageFrame_cache_virtual_patch_begin",Nr="pageFrame_cache_virtual_patch_end",Fr="pageFrame_cache_dirty_path",Rr="pageFrame_cache_re_render_begin",Vr="pageFrame_cache_json_diff_end",Wr="pageFrame_app_fmp",Ur="js.open_platform.gadget",qr="js.open_platform.blockit",Hr=Ur,Jr=((ir={appServiceSDKScriptError:{domain:Hr+".js_runtime_error",code:10001,level:j.error,message:"app_service_sdk_script_error"},webviewSDKScriptError:{domain:Hr+".js_runtime_error",code:10002,level:j.error,message:"webview_sdk_script_error"},jsEngineScriptError:{domain:Hr+".js_runtime_error",code:100003,level:j.error,message:"js_engine_script_error"},thirdScriptError:{domain:Hr+".js_runtime_error",code:100004,level:j.warn,message:"third_script_error"},webviewScriptError:{domain:Hr+".js_runtime_error",code:100005,level:j.error,message:"webview_script_error"},parserScriptError:{domain:Hr+".js_runtime_error",code:100006,level:j.error,message:"parser_script_error"},loadScriptError:{domain:Hr+".js_runtime_error",code:10007,level:j.error,message:"load_script_error"},commentWarn:{domain:Hr+".js_runtime_error",code:10008,level:j.warn,message:"comment_warn"}})[ar]={domain:Hr,code:1e4,level:j.normal,message:"mp_app_onlaunch_begin"},ir[sr]={domain:Hr,code:10001,level:j.normal,message:"mp_app_onlaunch_end"},ir[cr]={domain:Hr,code:10002,level:j.normal,message:"mp_app_onshow_begin"},ir[ur]={domain:Hr,code:10003,level:j.normal,message:"mp_app_onshow_end"},ir[lr]={domain:Hr,code:10004,level:j.normal,message:"mp_page_first_set_data"},ir[fr]={domain:Hr,code:10005,level:j.normal,message:"appservice_create_page_start"},ir[dr]={domain:Hr,code:10006,level:j.normal,message:"appservice_create_page_end"},ir[pr]={domain:Hr,code:10007,level:j.normal,message:"appservice_on_app_route"},ir[mr]={domain:Hr,code:10008,level:j.normal,message:"pageframe_first_get_data"},ir[_r]={domain:Hr,code:10009,level:j.normal,message:"pageframe_get_screen_cache_data"},ir[yr]={domain:Hr,code:10010,level:j.normal,message:"pageframe_cache_dirty_data"},ir[wr]={domain:Hr,code:10011,level:j.normal,message:"webview_evaluateJavascript_begin"},ir[br]={domain:Hr,code:10012,level:j.normal,message:"webview_evaluateJavascript_end"},ir[kr]={domain:Hr,code:10013,level:j.normal,message:"pageframe_receive_render_snapshot_message"},ir[Sr]={domain:Hr,code:10014,level:j.normal,message:"pageframe_func_ready"},ir[Cr]={domain:Hr,code:10015,level:j.normal,message:"pageframe_snapshot_frame_show"},ir[Er]={domain:Hr,code:10016,level:j.normal,message:"pageframe_cache_re_render_end"},ir[Tr]={domain:Hr,code:10017,level:j.normal,message:"pageframe_first_render_begin"},ir[zr]={domain:Hr,code:10018,level:j.normal,message:"pageFrame_first_render_end"},ir[Ir]={domain:Hr,code:10019,level:j.normal,message:"pageframe_create_virtual_tree_begin"},ir[xr]={domain:Hr,code:10020,level:j.normal,message:"pageframe_create_virtual_tree_end"},ir[Ar]={domain:Hr,code:10021,level:j.normal,message:"pageframe_create_element_tree_begin"},ir[Or]={domain:Hr,code:10022,level:j.normal,message:"pageframe_create_element_tree_end"},ir[Lr]={domain:Hr,code:10023,level:j.normal,message:"pageframe_apply_child_to_body_begin"},ir[Pr]={domain:Hr,code:10024,level:j.normal,message:"pageframe_apply_child_to_body_end"},ir[Dr]={domain:Hr,code:10025,level:j.normal,message:"pageframe_first_frame_show"},ir[Mr]={domain:Hr,code:10026,level:j.normal,message:"pageframe_cache_create_virtual_tree_begin"},ir[Br]={domain:Hr,code:10027,level:j.normal,message:"pageframe_cache_diff_virtual_tree_begin"},ir[jr]={domain:Hr,code:10028,level:j.normal,message:"pageframe_cache_virtual_patch_begin"},ir[Nr]={domain:Hr,code:10029,level:j.normal,message:"pageframe_cache_virtual_patch_end"},ir[Fr]={domain:Hr,code:10030,level:j.normal,message:"pageframe_cache_dirty_path"},ir[Rr]={domain:Hr,code:10031,level:j.normal,message:"pageframe_cache_re_render_begin"},ir[Vr]={domain:Hr,code:10032,level:j.normal,message:"pageframe_cache_json_diff_end"},ir[Wr]={domain:Hr,code:10033,level:j.normal,message:"pageFrame_app_fmp"},ir.webview_longest_pubsub={domain:Ur+".jssdk_performance",code:10033,level:j.normal,message:"webview_longest_pubsub"},ir.webview_slowest_pubsub={domain:Ur+".jssdk_performance",code:10034,level:j.normal,message:"webview_slowest_pubsub"},ir.webview_pubsub_length_statistic={domain:Ur+".jssdk_performance",code:10035,level:j.normal,message:"webview_pubsub_lenth_statistic"},ir.webview_pubsub_timecost_statistic={domain:Ur+".jssdk_performance",code:10036,level:j.normal,message:"webview_pubsub_timecost_statistic"},ir.appservice_longest_pubsub={domain:Ur+".jssdk_performance",code:10037,level:j.normal,message:"appservice_longest_pubsub"},ir.appservice_slowest_pubsub={domain:Ur+".jssdk_performance",code:10038,level:j.normal,message:"appservice_slowest_pubsub"},ir.appservice_pubsub_length_statistic={domain:Ur+".jssdk_performance",code:10039,level:j.normal,message:"appservice_pubsub_lenth_statistic"},ir.appservice_pubsub_timecost_statistic={domain:Ur+".jssdk_performance",code:10040,level:j.normal,message:"appservice_pubsub_timecost_statistic"},ir.webview_work_time_ratio={domain:Ur+".jssdk_performance",code:10041,level:j.normal,message:"webview_work_time_ratio"},ir.appservice_work_time_ratio={domain:Ur+".jssdk_performance",code:10042,level:j.normal,message:"appservice_work_time_ratio"},ir.appservice_reported_tti={domain:Ur+".jssdk_performance",code:10043,level:j.normal,message:"appservice_reported_tti"},ir.webview_detected_tti={domain:Ur+".jssdk_performance",code:10044,level:j.normal,message:"webview_detected_tti"},ir.appservice_using_v8_port={domain:Ur+".jssdk_performance",code:10045,level:j.normal,message:"appservice_using_v8_port"},ir.undefined_default_code={domain:Hr,code:1e4,level:j.warn,message:"undefined_default_code"},ir.api_success={domain:Hr+".api",code:1e4,level:j.normal,message:"api_success"},ir.api_cancel={domain:Hr+".api",code:10001,level:j.warn,message:"api_cancel"},ir.api_fail={domain:Hr+".api",code:10002,level:j.error,message:"api_fail"},ir.api_timeout={domain:Hr+".api",code:10003,level:j.error,message:"api_timeout"},ir.api_queue_timeout={domain:Hr+".api",code:10004,level:j.warn,message:"api_queue_timeout"},ir.api_invoke={domain:"client.open_platform.api.common",code:1e4,level:j.normal,message:"api_jssdk_invoke"},ir.api_callback={domain:"client.open_platform.api.common",code:10001,level:j.normal,message:"api_jssdk_callback"},ir.customComponent_performance={domain:Hr,code:1e4,level:j.normal,message:"customComponent_performance"},ir.request_result={domain:Hr+".network",code:1e4,level:j.normal,message:"request_result"},ir.abort_request={domain:Hr+".network",code:10001,level:j.normal,message:"abort_request"},ir.upload_result={domain:Hr+".network",code:10002,level:j.normal,message:"upload_result"},ir.abort_upload={domain:Hr+".network",code:10003,level:j.normal,message:"abort_upload"},ir.download_result={domain:Hr+".network",code:10004,level:j.normal,message:"download_result"},ir.abort_download={domain:Hr+".network",code:10005,level:j.normal,message:"abort_download"},ir.request_waiting={domain:Hr+".network",code:10006,level:j.normal,message:"request_enter_waiting_queue"},ir.request_long_waiting={domain:Hr+".network",code:10007,level:j.warn,message:"request_waiting_queue_long_time_stopped"},ir.editorInit={domain:Hr+".editor",code:10001,level:j.normal,message:"editor_start"},ir.editorPublish={domain:Hr+".editor",code:10002,level:j.normal,message:"editor_publish"},ir.editorSubscribe={domain:Hr+".editor",code:10003,level:j.normal,message:"editor_subscribe"},ir.canvasDrawTime={domain:Hr+".canvas",code:1e4,level:j.normal,message:"canvas_draw_time"},ir.webviewRenderTime={domain:Hr+".webview_render",code:1e4,level:j.normal,message:"webview_render_time"},ir.webviewSeriesRenderTime={domain:Hr+".webview_render",code:10001,level:j.normal,message:"webview_series_render_time"},ir.onUpdateReady={domain:Hr+".mp_trigger_on_event",code:1e4,level:j.normal,message:"trigger onUpdateReady"},ir.mpPageView={domain:Hr+".mp_page_view",code:1e4,level:j.normal,message:"mp page view"},ir);(rr={user_click:{domain:qr+".event_tracking",code:1e4,level:j.normal,message:"user_click"},block_display:{domain:qr+".event_tracking",code:10001,level:j.normal,message:"block_display"}})[hr]={domain:Hr,code:10046,level:j.normal,message:"mp_block_first_set_data"},rr[gr]={domain:Hr,code:10047,level:j.normal,message:"appservice_create_block_start"},rr[vr]={domain:Hr,code:10048,level:j.normal,message:"appservice_create_block_end"};var Kr,Gr={jsError:"mp_js_runtime_error",executeProcess:"mp_execute_process",api:"mp_api_invoke_result",onCallback:"mp_trigger_on_event",analysis:"op_js_analysis",network:"op_js_network",editorAnalysis:"editor",canvas:"op_api_canvas",api_invoke:"op_api_invoke",detectedTTI:"mp_js_sdk_detected_tti",reportedTTI:"mp_js_sdk_reported_tti",webviewSlowPubsub:"mp_js_sdk_slow_pubsub_webview",serviceSlowPubsub:"mp_js_sdk_slow_pubsub_service",webviewPubsubTimeStat:"mp_js_sdk_pubsub_stat_webview",servicePubsubTimeStat:"mp_js_sdk_pubsub_stat_service",webviewRender:"op_js_webview_render",openplatformMpPageView:"openplatform_mp_page_view"},Qr=["info","warn","error","debug","log"],$r=["error","warn"],Xr=["group","groupEnd"],Yr=new(function(){function e(){var e=this;this.prefix="[TMA]",this.type="",this.deprecated=function(){for(var t=arguments.length,n=new Array(t),i=0;i1?i-1:0),o=1;o= "+t.sdkVersion+" 后移除):"].concat(r))};for(var t,n=l(Qr);!(t=n()).done;){var i=t.value;this[i]=this.createLogMethod(i)}for(var r,o=l(Xr);!(r=o()).done;){var a=r.value;this[a]=this.createControlMethod(a)}}var t=e.prototype;return t.setPrefix=function(e){this.prefix=e},t.createLogMethod=function(e){var t=this;if(!$r.includes(e))return function(){};var n=e.toUpperCase();return function(){for(var i,r=arguments.length,o=new Array(r),a=0;a1e3&&(null==u||u.slowReport({key:r,cost:f,extend:o}))}else i=e.apply(s,t)}catch(e){if(c){if("[object Error]"===Object.prototype.toString.apply(e)){if("AppServiceEngineKnownError"===e.type||"AppServiceSdkKnownError"===e.type||"WebviewSdkKnownError"===e.type)throw e;"ThirdScriptError"===e.type?null==u||u.thirdErrorReport({error:e,extend:o}):null==u||u.errorReport({key:c,error:e,extend:o})}}else null==u||u.thirdErrorReport({error:e,extend:o})}return i}function io(e){return[function(t,n,i){return no(t,n,Object.assign({},e,i))},function(t,n){var i=Object.assign({},e,n);return function(){for(var e=arguments.length,n=new Array(e),r=0;r0?e.split("/"):[],o=0,a=i.length;o=t)return e.substring(0,i);return e}(e.title,14),this.invokeMethod("showToast",e,{beforeAll:function(e){e.errMsg=e.errMsg.replace("showToast","showLoading")}}))}},{kind:"method",decorators:[Wo()],key:"hideLoading",value:function(e){void 0===e&&(e={}),this.invokeMethod("hideToast",e,{beforeAll:function(e){e.errMsg=e.errMsg.replace("hideToast","hideLoading")}})}}]}}),Uo);var ra=ji(null,(function(e,t){return{F:function(t){function n(){for(var n,i=arguments.length,r=new Array(i),o=0;o6?this.beforeInvokeFail("showActionSheet",e,"param.itemList should has at most 6 items"):this.invokeMethod("showActionSheet",e))}}]}}),Uo),oa=ji(null,(function(e,t){return{F:function(t){function n(){for(var n,i=arguments.length,r=new Array(i),o=0;o8?this.beforeInvokeFail("showModal",e,"confirmText length should not larger than 4 Chinese characters"):ta(e.cancelText)>8?this.beforeInvokeFail("showModal",e,"cancelText length should not larger than 4 Chinese characters"):this.invokeMethod("showModal",e))}}]}}),Uo);var aa=function(e){return"string"==typeof e?e.replace(/[^\u0000-\u00ff]/g,"aa").length:0},sa=ji(null,(function(e,t){var n=function(t){function n(){for(var n,i=arguments.length,r=new Array(i),o=0;o0)this.continueShowCount++;else Date.now()-this.lastCloseTime<500?this.continueShowCount++:this.reset();this.continueShowCount>=3?this.tryShowTipModal(e):this.showNormalModal(e)}}},{kind:"field",key:"getShowModalTipInfo",value:function(){return this.createInvokeMethodApi("getShowModalTipInfo")}},{kind:"method",key:"tryShowTipModal",value:function(e){var t=this;void 0===e&&(e={}),this.getShowModalTipInfo({success:function(e){t.showTipModal(e)},fail:function(n){t.showNormalModal(e)}})}},{kind:"method",key:"showNormalModal",value:function(e){var t=this;void 0===e&&(e={});var n=(e=Object.assign({},e)).success,i=e.fail;e.success=function(e){t.lastCloseTime=Date.now(),t.currentShowCount--,n&&n(e)},e.fail=function(e){t.currentShowCount--,i&&i(e)},this.currentShowCount++,this.original.showModal(e)}},{kind:"method",key:"showTipModal",value:function(e){var t=this;this.isTipShowed=!0,this.original.showModal({title:e.title,cancelText:e.cancelText,confirmText:e.confirmText,success:function(e){var n,i=e.confirm,r=e.cancel;if(t.isTipShowed=!1,i){t.reset();var o=t.currentShowCount;t.currentShowCount=0,void 0===(n={fail:function(){t.reset(),t.currentShowCount=o}})&&(n={}),Io("exitMiniProgram",n)}r&&t.reset()},fail:function(e){t.isTipShowed=!1}})}},{kind:"method",key:"reset",value:function(){this.continueShowCount=0,this.lastCloseTime=0,this.isTipShowed=!1}}]}}),Uo),ca=ji(null,(function(e,t){return{F:function(t){function n(){for(var n,i=arguments.length,r=new Array(i),o=0;o30?e.beforeInvokeFail("showPrompt",t,"title length should not larger than 15 Chinese characters"):aa(t.confirmText)>8?e.beforeInvokeFail("showPrompt",t,"confirmText length should not larger than 4 Chinese characters"):aa(t.cancelText)>8?e.beforeInvokeFail("showPrompt",t,"cancelText length should not larger than 4 Chinese characters"):(t.maxLength=function(e){return"number"!=typeof e||isNaN(e)?140:e>=-1?e:140}(t.maxLength),e.invokeMethod("showPrompt",t))}}}]}}),Uo),ua=[],la=!1;function fa(e){0!=ua.length||la||(Io("onUserCaptureScreen",{}),la=!0),ua.push(e)}function da(e){0==(ua=ua.filter((function(t){return t!=e}))).length&&la&&(Io("offUserCaptureScreen",{}),la=!1)}function pa(e){void 0===e&&(e={}),Io("getClipboardData",e)}xo("userCaptureScreenObserved",(function(e){void 0===e&&(e={}),ua.forEach((function(t){var n=So(t,"onUserCaptureScreen");"function"==typeof n&&n(e)}))}));var ha={data:"String"};function ga(e){void 0===e&&(e={}),Po("setClipboardData",e,ha)&&Io("setClipboardData",e)}function va(e){void 0===e&&(e={});Po("startDeviceCredential",e,{authContent:"String"})&&Io("startDeviceCredential",e)}function ma(e){void 0===e&&(e={}),Io("mailto",e)}function _a(e){void 0===e&&(e={}),Io("checkWatermark",e)}var ya=new or,wa="_onWatermarkChange";function ba(e){var t,n,i;if(e)if("function"==typeof e?t=e:"object"==typeof e&&("function"==typeof e.callback&&(t=e.callback),"function"==typeof e.success&&(n=e.success),"function"==typeof e.fail&&(i=e.fail)),t)if(0===ya.listenerCount(wa)){Io("onWatermarkChange",{success:function(e){ya.on(wa,t),n&&n(e)},fail:i})}else ya.on(wa,t),n&&n();else i&&i("have no callback")}function ka(e){var t,n,i;if(e)if("function"==typeof e?t=e:"object"==typeof e&&("function"==typeof e.callback&&(t=e.callback),"function"==typeof e.success&&(n=e.success),"function"==typeof e.fail&&(i=e.fail)),t){n&&n();var r=ya.listenerCount(wa);ya.off(wa,t),1===r&&0===ya.listenerCount(wa)&&Io("offWatermarkChange",{})}else i&&i("have no callback")}function Sa(e){void 0===e&&(e={});Po("setAuthenticationInfo",e,{mobile:"String",identifyCode:"String",identifyName:"String"})&&Io("setAuthenticationInfo",e)}function Ca(e){void 0===e&&(e={}),Io("startFaceIdentify",e)}function Ea(e){void 0===e&&(e={});Po("startFaceVerify",e,{userId:"String"})&&Io("startFaceVerify",e)}xo("onWatermarkChange",(function(e){void 0===e&&(e={}),ya.emit(wa,e)}));var Ta=0,za=[],Ia=Ro("getLocation",{beforeAll:function(){Ta=0},afterAll:function(e){za.forEach((function(t){"function"==typeof t.complete&&So(t.complete,"at getLocation complete callback function")(e)})),za=[]},afterSuccess:function(e){za.forEach((function(t){"function"==typeof t.success&&So(t.success,"at getLocation success callback function")(e)}))},afterFail:function(e){za.forEach((function(t){"function"==typeof t.fail&&So(t.fail,"at getLocation fail callback function")(e)}))}}),xa=function(e){var t;Ta?(za.push(e),Date.now()-Ta>=1e4&&(t=Date.now()-Ta,to(Gr.api,Jr.api_queue_timeout).addMap({api_name:"getLocation",api_queue_length:za.length,api_timeout:t}).flush())):(Ta=Date.now(),Ia(e))},Aa=Ro("openLocation",{checkParams:{latitude:0,longitude:0}}),Oa=Ro("chooseLocation"),La=Ro("getLocationStatus"),Pa=new or.EventEmitter2,Da="onLocationChange";xo("onLocationChange",(function(e){void 0===e&&(e={}),Pa.emit(Da,e)}));var Ma=Ro("startLocationUpdate"),Ba=Ro("stopLocationUpdate"),ja=Co(Pa,Da,(function(e){return So(e)})),Na=ja.on,Fa=ja.off;var Ra=["ascii","base64","binary","hex","ucs2","ucs-2","utf16le","utf-16le","utf-8","utf8","latin1"],Va=function(){function e(e){var t=e.mode,n=void 0===t?0:t,i=e.size,r=void 0===i?0:i,o=e.lastAccessedTime,a=void 0===o?"":o,s=e.lastModifiedTime,c=void 0===s?"":s;this.mode=n,this.size=r,this.lastAccessedTime=a,this.lastModifiedTime=c}var t=e.prototype;return t._checkModeProperty=function(e){return(61440&this.mode)===e},t.isFile=function(){return this._checkModeProperty(32768)},t.isDirectory=function(){return this._checkModeProperty(16384)},e}(),Wa=new(function(){function e(){}var t=e.prototype;return t.getFileInfo=function(e){void 0===e&&(e={}),Po("getFileInfo",e,{filePath:""})&&Io("getFileInfo",e)},t.getSavedFileList=function(e){void 0===e&&(e={}),Io("getSavedFileList",e)},t.removeSavedFile=function(e){void 0===e&&(e={}),Po("removeSavedFile",e,{filePath:""})&&Io("removeSavedFile",e)},t.getSavedFileInfo=function(e){void 0===e&&(e={}),Po("getSavedFileInfo",e,{filePath:""})&&Io("getSavedFileInfo",e)},t.saveFile=function(e){void 0===e&&(e={}),Po("saveFile",e,{tempFilePath:""})&&Io("saveFile",e)},t.saveFileSync=function(e,t){if(!e||"string"!=typeof e)throw new TypeError("tempFilePath must be a string");var n,i;if(Io("saveFileSync",{tempFilePath:e,filePath:t,success:function(e){i=e.savedFilePath},fail:function(e){n=e.errMsg}}),n)throw new Error(n);return i},t.readFile=function(e){void 0===e&&(e={}),Po("readFile",e,{filePath:""})&&Io("readFile",e)},t.readFileSync=function(e,t){if(!e||"string"!=typeof e)throw new TypeError("filePath must be a string");if(t&&"string"!=typeof t)throw new TypeError("encoding must be a string");var n,i,r={filePath:e};if(t&&(r.encoding=t),Io("readFileSync",Object.assign({},r,{success:function(e){i=e.data},fail:function(e){n=e.errMsg}})),n)throw new Error(n);return i},t.writeFile=function(e){void 0===e&&(e={}),Po("writeFile",e,{filePath:""})&&(e.encoding&&-1===Ra.indexOf(e.encoding)?Do("writeFile",e,'invalid encoding "'+e.encoding+'"'):Io("writeFile",e,{}))},t.writeFileSync=function(e,t,n){if(!e||"string"!=typeof e)throw new TypeError("filePath must be a string");if(n&&-1===Ra.indexOf(n))throw new Error('invalid encoding "'+n+'"');var i;if(Io("writeFileSync",{filePath:e,data:t,encoding:n,fail:function(e){i=e.errMsg}}),i)throw new Error(i)},t.mkdir=function(e){void 0===e&&(e={}),Po("mkdir",e,{dirPath:""})&&Io("mkdir",e)},t.mkdirSync=function(e,t){if(void 0===t&&(t=!1),!e||"string"!=typeof e)throw new TypeError("dirPath must be a string");var n;if(Io("mkdirSync",{dirPath:e,recursive:t,fail:function(e){n=e.errMsg}}),n)throw new Error(n)},t.readdir=function(e){void 0===e&&(e={}),Po("readdir",e,{dirPath:""})&&Io("readdir",e)},t.readdirSync=function(e){if(!e||"string"!=typeof e)throw new TypeError("dirPath must be a string");var t,n;if(Io("readdirSync",{dirPath:e,success:function(e){n=e.files},fail:function(e){t=e.errMsg}}),t)throw new Error(t);return n},t.rmdir=function(e){void 0===e&&(e={recursive:!1}),Po("rmdir",e,{dirPath:""})&&Io("rmdir",e)},t.rmdirSync=function(e,t){if(void 0===t&&(t=!1),!e||"string"!=typeof e)throw new TypeError("dirPath must be a string");var n;if(Io("rmdirSync",{dirPath:e,recursive:t,fail:function(e){n=e.errMsg}}),n)throw new Error(n)},t.access=function(e){void 0===e&&(e={});/^(ttfile|http):\/\/(user|temp)$/.test(e.path)&&(e.path+="/"),Po("access",e,{path:""})&&Io("access",e)},t.accessSync=function(e){if(!e||"string"!=typeof e)throw new TypeError("path must be a string");var t;if(/^(ttfile|http):\/\/(user|temp)$/.test(e)&&(e+="/"),Io("accessSync",{path:e,fail:function(e){t=e.errMsg}}),t)throw new Error(t)},t.unlink=function(e){void 0===e&&(e={}),Po("unlink",e,{filePath:""})&&Io("unlink",e)},t.unlinkSync=function(e){if(!e||"string"!=typeof e)throw new TypeError("filePath must be a string");var t;if(Io("unlinkSync",{filePath:e,fail:function(e){t=e.errMsg}}),t)throw new Error(t)},t.stat=function(e){void 0===e&&(e={}),Po("stat",e,{path:""})&&Io("stat",e,{beforeSuccess:function(e){e.stats=e.stat=new Va(e.stat)}})},t.statSync=function(e){if(!e||"string"!=typeof e)throw new TypeError("path must be a string");var t,n;if(Io("statSync",{path:e,success:function(e){n=new Va(e.stat)},fail:function(e){t=e.errMsg}}),t)throw new Error(t);return n},t.rename=function(e){void 0===e&&(e={}),Po("rename",e,{oldPath:"",newPath:""})&&Io("rename",e)},t.renameSync=function(e,t){if(!e||"string"!=typeof e)throw new TypeError("oldPath must be a string");if(!t||"string"!=typeof t)throw new TypeError("newPath must be a string");var n;if(Io("renameSync",{oldPath:e,newPath:t,fail:function(e){n=e.errMsg}}),n)throw new Error(n)},t.copyFile=function(e){void 0===e&&(e={}),Po("copyFile",e,{srcPath:"",destPath:""})&&Io("copyFile",e)},t.copyFileSync=function(e,t){if(!e||"string"!=typeof e)throw new TypeError("srcPath must be a string");if(!t||"string"!=typeof t)throw new TypeError("destPath must be a string");var n;if(Io("copyFileSync",{srcPath:e,destPath:t,fail:function(e){n=e.errMsg}}),n)throw new Error(n)},t.unzip=function(e){void 0===e&&(e={}),Po("unzip",e,{zipFilePath:"",targetPath:""})&&Io("unzip",e,{})},e}());function Ua(){return Wa}var qa=Wa.saveFile;Wa.getFileInfo;var Ha=Wa.getSavedFileList,Ja=Wa.removeSavedFile,Ka="waiting",Ga="sending",Qa="done",$a="aborted",Xa="created",Ya="in_queue",Za=0,es=0;function ts(){var e=ss.get(this);as.set(this,Ga),ps.set(this,Date.now());var t,n=this,i=(new Date).valueOf()%1e6;es===i?Za++:(es=i,Za=0);var r=+(""+i+(Za<10?"0"+Za:Za));Za>=99&&(Za=0),os.set(n,r||i),Io("createDownloadTask",{url:e.url,header:e.header,data:e.data,method:e.method,filePath:e.filePath,taskId:r,success:function(e){us.set(n,e.trace),os.set(n,e.downloadTaskId),gs+=1,ms[e.downloadTaskId]=n},fail:function(e){us.set(n,e.trace),t=e.errMsg,ys(n,"fail",t)},complete:function(){as.set(n,Qa)}}),t?setTimeout((function(){var n={errMsg:t.replace("createDownloadTask","downloadFile")};"function"==typeof e.fail&&e.fail(n),"function"==typeof e.complete&&e.complete(n)}),0):(Yr.log("taskID",this,os.get(this)),_s.on(os.get(this)+"success",(function(t){t.errMsg="downloadFile:ok",t.statusCode=parseInt(t.statusCode,10),-1===[200,304].indexOf(t.statusCode)&&delete t.tempPath,delete t.timeInterval,"function"==typeof e.success&&e.success(t),"function"==typeof e.complete&&e.complete(t)})),_s.on(os.get(this)+"fail",(function(t){t.errMsg="downloadFile:fail "+t.errMsg,"function"==typeof e.fail&&e.fail(t),"function"==typeof e.complete&&e.complete(t)})))}var ns=0,is=new WeakMap,rs=new WeakMap,os=new WeakMap,as=new WeakMap,ss=new WeakMap,cs=new WeakMap,us=new WeakMap,ls=new WeakMap,fs=new WeakMap,ds=new WeakMap,ps=new WeakMap,hs=new WeakMap,gs=0,vs=[],ms={},_s=new or.EventEmitter2;function ys(e,t,n){var i=hs.get(e),r=as.get(e)===$a,o=r?Jr.abort_download:Jr.download_result,a=r?"cancel":t,s=ss.get(e),c=cs.get(e),u=Date.now()-c,l={request_trace:us.get(e)||"",request_url:s.url.split("?")[0],request_method:s.method||"GET",request_biz_invoke_time:cs.get(e),request_push_queue_time:ls.get(e)||0,request_shift_queue_time:ds.get(e)||0,request_queue_length:fs.get(e)||0,request_abort_type:i||"",error_msg:n||"",duration:u,result_type:a};to(Gr.network,o).addMap(l).flush()}xo("onDownloadTaskStateChange",(function(e){void 0===e&&(e={}),"string"==typeof e&&(e=JSON.parse(e));var t=e.state,n=e.downloadTaskId;if(delete e.state,delete e.downloadTaskId,_s.emit(""+n+t,e),"success"===t||"fail"===t){if(gs=Math.max(gs-1,0),vs.length>0){var i=vs.shift();ds.set(i.item,Date.now()),ts.call(i.item)}var r=ms[n];if(r){try{ys(r,t,e.errMsg)}catch(e){}delete ms[n],_s.removeAllListeners(n+"success"),_s.removeAllListeners(n+"fail"),_s.removeAllListeners(n+"progressUpdate")}}}));var ws,bs=function(){function e(e){cs.set(this,Date.now());var t=ns++;rs.set(this,t),is.set(this,t),as.set(this,Ka),["success","fail","complete"].forEach((function(t){var n=e[t];"function"==typeof n&&(e[t]=So(n,"at api downloadFile "+t+" callback function"))})),ss.set(this,e),gs>=5?(ls.set(this,Date.now()),fs.set(this,vs.length),vs.push({id:t,item:this}),function(e){var t=ss.get(e),n={request_trace:us.get(e)||"",request_url:t.url.split("?")[0],request_method:t.method||"GET",request_queue_length:5+vs.length,request_type:"downloadFile"};to(Gr.network,Jr.request_waiting).addMap(n).flush()}(this)):ts.call(this)}var t=e.prototype;return t.abort=function(){var e=this,t=as.get(this),n=ss.get(this);if(as.set(this,$a),t===Ka){var i=vs.findIndex((function(t){return t.id===is.get(e)}));i>-1&&vs.splice(i,1),hs.set(this,Ya),setTimeout((function(){var t="downloadFile:fail abort";"function"==typeof n.fail&&n.fail({errMsg:t}),ys(e,"cancel",t),"function"==typeof n.complete&&n.complete({errMsg:t})}),0)}else t!==$a&&(hs.set(this,Xa),Io("operateDownloadTask",{downloadTaskId:os.get(this),operationType:"abort"}))},t.onProgressUpdate=function(e){_s.on(os.get(this)+"progressUpdate",(function(t){"function"==typeof e&&So(e,"at DownloadTask.onProgressUpdate callback function")(t)}))},e}();function ks(e){if(void 0===e&&(e={}),Po("downloadFile",e,{url:""}))try{return new bs(e)}catch(t){Do("downloadFile",e,t.message)}}function Ss(e){void 0===e&&(e={}),Io("getBlockActionSourceDetail",e)}var Cs={NDEF:"NDEF",A:"NFC-A",B:"NFC-B",F:"NFC-F",V:"NFC-V",MIFARE_CLASSIC:"MIFARE-Classic",MIFARE_ULTRALIGHT:"MIFARE-Ultralight",ISO_DEP:"ISO-DEP"},Es=new or,Ts=new WeakMap,zs="discovered";xo("nfcFoundDevice",(function(e){Es.emit(zs,e)}));var Is=function(){function e(e){this.tech=e}var t=e.prototype;return t.connect=function(e){Io("nfcConnect",Object.assign({tech:this.tech},e))},t.close=function(e){Io("nfcClose",Object.assign({tech:this.tech},e))},t.setTimeout=function(e){Io("nfcSetTimeout",Object.assign({tech:this.tech},e))},t.transceive=function(e){Io("nfcTransceive",Object.assign({tech:this.tech},e))},t.getMaxTransceiveLength=function(e){Io("nfcMaxTransceiveLength",Object.assign({tech:this.tech},e))},e}(),xs=function(e){function t(){return e.call(this,Cs.A)||this}S(t,e);var n=t.prototype;return n.getAtqa=function(e){Io("nfcGetAtqa",e)},n.getSak=function(e){Io("nfcGetSak",e)},t}(Is),As=function(e){function t(){return e.call(this,Cs.MIFARE_CLASSIC)||this}return S(t,e),t}(Is),Os=((ws={})[Cs.A]=xs,ws[Cs.MIFARE_CLASSIC]=As,ws),Ls={};function Ps(e){return function(){return function(e){return Ls[e]||(Ls[e]=new Os[e]),Ls[e]}(e)}}var Ds={tech:Cs,getNfcA:Ps(Cs.A),getMifareClassic:Ps(Cs.MIFARE_CLASSIC),onDiscovered:function(e){var t=Ts.get(e)||So(e,"NFCAdapter.Discovered");Ts.set(e,t),Es.on(zs,t)},offDiscovered:function(e){var t=Ts.get(e);t&&Es.off(zs,t)},startDiscovery:function(e){Io("nfcStartDiscovery",e)},stopDiscovery:function(e){Io("nfcStopDiscovery",e)}};function Ms(){return Ds}var Bs=!1,js=[];function Ns(e){void 0===e&&(e={}),Bs=!0,Io("enableAccelerometer",Object.assign({},e,{enable:Bs}),{beforeAll:function(e){e.errMsg=e.errMsg.replace("enableAccelerometer","startAccelerometer")}})}function Fs(e){void 0===e&&(e={}),Bs=!1,Io("enableAccelerometer",Object.assign({},e,{enable:Bs}),Object.assign({},e,{beforeAll:function(e){e.errMsg=e.errMsg.replace("enableAccelerometer","stopAccelerometer")}}))}function Rs(e){"function"==typeof e&&(Bs||Io("enableAccelerometer",{enable:Bs=!0}),js.push(So(e,"onAccelerometerChange")))}xo("onAccelerometerChange",(function(e){void 0===e&&(e={});for(var t=0;tTu[t.sampleRate][1]||t.encodeBitRate6e5||t.duration<0)&&(t.duration=6e4),Iu(t)},pause:function(){Iu({operationType:"pause",fail:function(e){Eu.emit("onRecorderStateChange_error",e)}})},resume:function(){Iu({operationType:"resume",fail:function(e){Eu.emit("onRecorderStateChange_error",e)}})},stop:function(){Iu({operationType:"stop",fail:function(e){Eu.emit("onRecorderStateChange_error",e)}})},onStart:function(e){Eu.removeAllListeners("onRecorderStateChange_start"),Eu.on("onRecorderStateChange_start",(function(t){"function"==typeof e&&So(e,"at recorderManager.onStart callback function")(t)}))},onResume:function(e){Eu.removeAllListeners("onRecorderStateChange_resume"),Eu.on("onRecorderStateChange_resume",(function(t){"function"==typeof e&&So(e,"at recorderManager.onResume callback function")(t)}))},onPause:function(e){Eu.removeAllListeners("onRecorderStateChange_pause"),Eu.on("onRecorderStateChange_pause",(function(t){"function"==typeof e&&So(e,"at recorderManager.onPause callback function")(t)}))},onStop:function(e){Eu.removeAllListeners("onRecorderStateChange_stop"),Eu.on("onRecorderStateChange_stop",(function(t){"function"==typeof e&&So(e,"at recorderManager.onStop callback function")(t)}))},onFrameRecorded:function(e){Eu.removeAllListeners("onRecorderStateChange_frameRecorded"),Eu.on("onRecorderStateChange_frameRecorded",(function(t){if("function"==typeof e){var n=t.frameBuffer;"string"==typeof n&&(t.frameBuffer=Gi(n)),So(e,"at recorderManager.onFrameRecorded callback function")(t)}}))},onError:function(e){Eu.removeAllListeners("onRecorderStateChange_error"),Eu.on("onRecorderStateChange_error",(function(t){"function"==typeof e&&So(e,"at recorderManager.onError callback function")(t)}))}};function Au(){return xu}var Ou=new or.EventEmitter2,Lu=Symbol("beacon_service_change"),Pu=Symbol("beacon_update");xo("beaconServiceChange",(function(){for(var e=arguments.length,t=new Array(e),n=0;n0?Io("docsPicker",e):Do("docsPicker",e,"no valid maxNum")},filePicker:function(e){void 0===e&&(e={}),Io("filePicker",e)},getLocation:xa,openLocation:Aa,chooseLocation:Oa,getLocationStatus:La,startLocationUpdate:Ma,stopLocationUpdate:Ba,onLocationChange:Na,offLocationChange:Fa,openDocument:function(e){void 0===e&&(e={});var t="";e.hasOwnProperty("fileType")&&(t=yo(e.fileType,"","param.fileType")),t?Do("openDocument",e,t):Po("openDocument",e,{filePath:"String"})&&(/^(tt)?file:\/\//.test(e.filePath)||(e.filePath=wo("",e.filePath)),Io("openDocument",e))},saveFile:qa,removeSavedFile:Ja,getSavedFileList:Ha,downloadFile:ks,getBlockActionSourceDetail:Ss,getNFCAdapter:Ms,startAccelerometer:Ns,stopAccelerometer:Fs,onAccelerometerChange:Rs,startCompass:qs,stopCompass:Hs,onCompassChange:Us,makePhoneCall:Js,vibrateLong:Gs,vibrateShort:Ks,getWifiStatus:Qs,getNetworkType:Xs,getConnectedWifi:Zs,getWifiList:ec,onGetWifiList:tc,offGetWifiList:nc,getNetworkQualityType:rc,onNetworkQualityChange:sc,offNetworkQualityChange:cc,getChatInfo:dc,onChatBadgeChange:lc,offChatBadgeChange:fc,chooseChat:hc,chooseContact:pc,getTriggerContext:gc,sendMessageCard:vc,chooseImage:mc,compressImage:bc,previewImage:_c,saveImageToPhotosAlbum:wc,getImageInfo:yc,chooseVideo:Sc,saveVideoToPhotosAlbum:Cc,getSetting:Ec,openSetting:Tc,getExtConfig:zc,getHostLaunchQuery:function(e){Io("getHostLaunchQuery",e)},setKeepScreenOn:Pc,getDeviceID:gu,getEnvVariable:vu,getUserInfoEx:mu,scanCode:_u,getTenantAppScopes:yu,applyTenantAppScope:wu,checkLocalFaceVerify:bu,prepareLocalFaceVerify:ku,startLocalFaceVerify:Su,share:Cu,getRecorderManager:Au,startBeaconDiscovery:Mu,stopBeaconDiscovery:Bu,onBeaconServiceChange:Fu,onBeaconUpdate:ju,offBeaconServiceChange:Ru,offBeaconUpdate:Nu,getBeacons:Du,getStepCount:Vu,chooseMedia:Wu,reportBadge:Uu,updateBadge:qu,requestAuthCode:Hu,getFileSystemManager:Ua,opmonitor:Ac,getScreenBrightness:Lc,setScreenBrightness:Oc,openBluetoothAdapter:jc,closeBluetoothAdapter:Nc,getBluetoothAdapterState:Fc,startBluetoothDevicesDiscovery:Rc,stopBluetoothDevicesDiscovery:Vc,onBluetoothAdapterStateChange:Uc,offBluetoothAdapterStateChange:qc,onBluetoothDeviceFound:Gc,offBluetoothDeviceFound:Qc,getConnectedBluetoothDevices:$c,getBluetoothDevices:Xc,connectBLEDevice:tu,disconnectBLEDevice:nu,getBLEDeviceCharacteristics:iu,getBLEDeviceServices:ru,notifyBLECharacteristicValueChange:ou,onBLECharacteristicValueChange:su,offBLECharacteristicValueChange:cu,onBLEConnectionStateChange:lu,offBLEConnectionStateChange:fu,readBLECharacteristicValue:du,writeBLECharacteristicValue:pu,setBLEMTU:hu});var Gu=Object.freeze({__proto__:null,filePicker:function(e){void 0===e&&(e={}),Io("filePicker",e)},docsPicker:function(e){void 0===e&&(e={});var t=e.maxNum;void 0===t||t>0?Io("docsPicker",e):Do("docsPicker",e,"no valid maxNum")},openDocument:function(e){void 0===e&&(e={}),Po("openDocument",e,{filePath:"String"})&&Io("openDocument",e)},saveFileAs:function(e){void 0===e&&(e={}),Po("saveFileAs",e,{filePath:"String"})&&Io("saveFileAs",e)},enterChat:function(e){void 0===e&&(e={}),Io("enterChat",e)},enterProfile:function(e){void 0===e&&(e={}),void 0===e.left&&(e.left=0),void 0===e.top&&(e.top=0),Po("enterProfile",e,{openid:"String",left:0,top:0})&&Io("enterProfile",e)},enterBot:function(e){void 0===e&&(e={}),Io("enterBot",e)},toggleChat:function(e){void 0===e&&(e={}),Po("toggleChat",e,{openChatId:""})&&Io("toggleChat",e)},startPasswordVerify:function(e){void 0===e&&(e={}),Io("startPasswordVerify",e)},print:function(e){void 0===e&&(e={}),Po("print",e,{url:""})&&Io("print",e)},getHostLaunchQuery:function(e){void 0===e&&(e={});var t=tt.getHostLaunchQuerySync(e);e.success&&e.success(Object.assign(t,{errMsg:"getHostLaunchQuery:ok"})),e.complete&&e.complete(Object.assign(t,{errMsg:"getHostLaunchQuery:ok"}))},onUserCaptureScreen:fa,offUserCaptureScreen:da,getClipboardData:pa,setClipboardData:ga,startDeviceCredential:va,mailto:ma,checkWatermark:_a,onWatermarkChange:ba,offWatermarkChange:ka,setAuthenticationInfo:Sa,startFaceIdentify:Ca,startFaceVerify:Ea,getLocation:xa,openLocation:Aa,chooseLocation:Oa,getLocationStatus:La,startLocationUpdate:Ma,stopLocationUpdate:Ba,onLocationChange:Na,offLocationChange:Fa,saveFile:qa,removeSavedFile:Ja,getSavedFileList:Ha,downloadFile:ks,getBlockActionSourceDetail:Ss,getNFCAdapter:Ms,startAccelerometer:Ns,stopAccelerometer:Fs,onAccelerometerChange:Rs,startCompass:qs,stopCompass:Hs,onCompassChange:Us,makePhoneCall:Js,vibrateLong:Gs,vibrateShort:Ks,getWifiStatus:Qs,getNetworkType:Xs,getConnectedWifi:Zs,getWifiList:ec,onGetWifiList:tc,offGetWifiList:nc,getNetworkQualityType:rc,onNetworkQualityChange:sc,offNetworkQualityChange:cc,getChatInfo:dc,onChatBadgeChange:lc,offChatBadgeChange:fc,chooseChat:hc,chooseContact:pc,getTriggerContext:gc,sendMessageCard:vc,chooseImage:mc,compressImage:bc,previewImage:_c,saveImageToPhotosAlbum:wc,getImageInfo:yc,chooseVideo:Sc,saveVideoToPhotosAlbum:Cc,getSetting:Ec,openSetting:Tc,getExtConfig:zc,setKeepScreenOn:Pc,getDeviceID:gu,getEnvVariable:vu,getUserInfoEx:mu,scanCode:_u,getTenantAppScopes:yu,applyTenantAppScope:wu,checkLocalFaceVerify:bu,prepareLocalFaceVerify:ku,startLocalFaceVerify:Su,share:Cu,getRecorderManager:Au,startBeaconDiscovery:Mu,stopBeaconDiscovery:Bu,onBeaconServiceChange:Fu,onBeaconUpdate:ju,offBeaconServiceChange:Ru,offBeaconUpdate:Nu,getBeacons:Du,getStepCount:Vu,chooseMedia:Wu,reportBadge:Uu,updateBadge:qu,requestAuthCode:Hu,getFileSystemManager:Ua,opmonitor:Ac,getScreenBrightness:Lc,setScreenBrightness:Oc,openBluetoothAdapter:jc,closeBluetoothAdapter:Nc,getBluetoothAdapterState:Fc,startBluetoothDevicesDiscovery:Rc,stopBluetoothDevicesDiscovery:Vc,onBluetoothAdapterStateChange:Uc,offBluetoothAdapterStateChange:qc,onBluetoothDeviceFound:Gc,offBluetoothDeviceFound:Qc,getConnectedBluetoothDevices:$c,getBluetoothDevices:Xc,connectBLEDevice:tu,disconnectBLEDevice:nu,getBLEDeviceCharacteristics:iu,getBLEDeviceServices:ru,notifyBLECharacteristicValueChange:ou,onBLECharacteristicValueChange:su,offBLECharacteristicValueChange:cu,onBLEConnectionStateChange:lu,offBLEConnectionStateChange:fu,readBLECharacteristicValue:du,writeBLECharacteristicValue:pu,setBLEMTU:hu,apis:Ju}),Qu=/(Android|iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)?Ku:Gu,$u={};for(var Xu in Qu)if("apis"===Xu){var Yu=new Ho({bridge:jo},Qu[Xu]);eo(Yu),Object.assign($u,Yu.exports)}else $u[Xu]=Qu[Xu];!function(){var e=[],t=null,n=function(){ci.invoke("monitorReport",{monitorEvents:e}),e=[],clearTimeout(t),t=null},i=new se({report:function(i){var r=i.name,o=i.metrics,a=void 0===o?{}:o,s=i.categories,c=void 0===s?{}:s,u=c.monitor_level;e.push({name:r,metrics:a,categories:c}),e.length>=20||u>=j.error?n():t||(t=setTimeout((function(){n()}),4e3))},log:function(e){}});ce.setup(i)}();var Zu=function(e){var t,n,i,r;Vn("h5jssdk_enter",{url:null==(t=window)||null==(n=t.location)?void 0:n.href,host:null==(i=window)||null==(r=i.location)?void 0:r.host,eventType:e,client:b(p),larkVersion:p.versions.larkVersion,platform:navigator.platform,browser:navigator.userAgent,time:+new Date,app_id:w()})};Zu(Pn.START_LOAD_SDK),window.dispatchEvent(new CustomEvent("WebViewJSBridgeReady"));var el={biz:pi,device:_i,appCenter:wi};Ii(el,zi);var tl,nl,il=null,rl=[];if(window.ttJSBridge=null,p.versions.mobileFeishu||p.versions.PCFeishu){var ol={setConfig:function(e){Object.assign(Bn,e)},config:function(e){var t={appId:e.appId,timestamp:e.timestamp,nonceStr:e.nonceStr,signature:e.signature,jsApiList:e.jsApiList};return function(e){y=e}(e.appId),il=new Promise(function(){var n=a(s.mark((function n(i,r){return s.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:"string"==typeof p.versions.larkVersion&&m(p.versions.larkVersion,"3.9.0")>=0?si.invoke("config",t,{onSuccess:function(t){i(t),"function"==typeof e.onSuccess&&e.onSuccess(t)},onFail:function(t){r(t),"function"==typeof e.onFail&&rl.push(e.onFail),rl.forEach((function(e){"function"==typeof e&&e(t)})),Vn("h5jssdk_authentication_failure",{error:JSON.stringify(t)}),ye(ve,ge[ue.authenticationFailure]).setError(_(t)).flush()}}):i();case 1:case"end":return n.stop()}}),n)})));return function(e,t){return n.apply(this,arguments)}}())},ready:(nl=a(s.mark((function e(t){return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Rn(),e.prev=1,e.next=4,Ei({api:el,browser:p,build:"cdn",SDK:ol});case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),v(null==e.t0?void 0:e.t0.message,!0);case 9:if(!il){e.next=19;break}return e.prev=10,e.next=13,il;case 13:e.next=17;break;case 15:e.prev=15,e.t1=e.catch(10);case 17:e.next=20;break;case 19:v("please invoke h5sdk.config before invoke h5sdk.ready,otherwise the interface call may fail",!0);case 20:Zu(Pn.SDK_READY),t();case 22:case"end":return e.stop()}}),e,null,[[1,6],[10,15]])}))),function(e){return nl.apply(this,arguments)}),error:(tl=a(s.mark((function e(t){return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:rl.push(t);case 1:case"end":return e.stop()}}),e)}))),function(e){return tl.apply(this,arguments)})};Ei({api:el,browser:p,build:"cdn",SDK:ol}),window.lark?Object.assign(window.lark,ol):window.lark=ol,window.h5sdk?Object.assign(window.h5sdk,ol):window.h5sdk=ol,window.tt?Object.assign(window.tt,$u):window.tt=$u,window.ttJSBridge=ci}})); diff --git a/src/main/resources/com/fr/plugin/third/party/jsdjjed/sdk/login.html b/src/main/resources/com/fr/plugin/third/party/jsdjjed/sdk/login.html new file mode 100644 index 0000000..a29a07a --- /dev/null +++ b/src/main/resources/com/fr/plugin/third/party/jsdjjed/sdk/login.html @@ -0,0 +1,36 @@ + + + + + + 数据决策系统 + + + + +

报表轻应用跳转

+ + + + + + diff --git a/src/main/resources/com/fr/plugin/third/party/jsdjjed/sdk/runworkhelp.js b/src/main/resources/com/fr/plugin/third/party/jsdjjed/sdk/runworkhelp.js new file mode 100644 index 0000000..033789c --- /dev/null +++ b/src/main/resources/com/fr/plugin/third/party/jsdjjed/sdk/runworkhelp.js @@ -0,0 +1,24 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).runworkHelp={})}(this,(function(exports){"use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(e,t){return e(t={exports:{}},t.exports),t.exports}var check=function(e){return e&&e.Math==Math&&e},global_1=check("object"==typeof globalThis&&globalThis)||check("object"==typeof window&&window)||check("object"==typeof self&&self)||check("object"==typeof commonjsGlobal&&commonjsGlobal)||function(){return this}()||Function("return this")(),fails=function(e){try{return!!e()}catch(e){return!0}},descriptors=!fails((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),functionBindNative=!fails((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),call=Function.prototype.call,functionCall=functionBindNative?call.bind(call):function(){return call.apply(call,arguments)},$propertyIsEnumerable={}.propertyIsEnumerable,getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,NASHORN_BUG=getOwnPropertyDescriptor&&!$propertyIsEnumerable.call({1:2},1),f=NASHORN_BUG?function(e){var t=getOwnPropertyDescriptor(this,e);return!!t&&t.enumerable}:$propertyIsEnumerable,objectPropertyIsEnumerable={f:f},createPropertyDescriptor=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},FunctionPrototype=Function.prototype,bind=FunctionPrototype.bind,call$1=FunctionPrototype.call,uncurryThis=functionBindNative&&bind.bind(call$1,call$1),functionUncurryThis=functionBindNative?function(e){return e&&uncurryThis(e)}:function(e){return e&&function(){return call$1.apply(e,arguments)}},toString=functionUncurryThis({}.toString),stringSlice=functionUncurryThis("".slice),classofRaw=function(e){return stringSlice(toString(e),8,-1)},Object$1=global_1.Object,split=functionUncurryThis("".split),indexedObject=fails((function(){return!Object$1("z").propertyIsEnumerable(0)}))?function(e){return"String"==classofRaw(e)?split(e,""):Object$1(e)}:Object$1,TypeError$1=global_1.TypeError,requireObjectCoercible=function(e){if(null==e)throw TypeError$1("Can't call method on "+e);return e},toIndexedObject=function(e){return indexedObject(requireObjectCoercible(e))},isCallable=function(e){return"function"==typeof e},isObject=function(e){return"object"==typeof e?null!==e:isCallable(e)},aFunction=function(e){return isCallable(e)?e:void 0},getBuiltIn=function(e,t){return arguments.length<2?aFunction(global_1[e]):global_1[e]&&global_1[e][t]},objectIsPrototypeOf=functionUncurryThis({}.isPrototypeOf),engineUserAgent=getBuiltIn("navigator","userAgent")||"",process$1=global_1.process,Deno$1=global_1.Deno,versions=process$1&&process$1.versions||Deno$1&&Deno$1.version,v8=versions&&versions.v8,match,version;v8&&(match=v8.split("."),version=match[0]>0&&match[0]<4?1:+(match[0]+match[1])),!version&&engineUserAgent&&(match=engineUserAgent.match(/Edge\/(\d+)/),(!match||match[1]>=74)&&(match=engineUserAgent.match(/Chrome\/(\d+)/),match&&(version=+match[1])));var engineV8Version=version,nativeSymbol=!!Object.getOwnPropertySymbols&&!fails((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&engineV8Version&&engineV8Version<41})),useSymbolAsUid=nativeSymbol&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Object$2=global_1.Object,isSymbol=useSymbolAsUid?function(e){return"symbol"==typeof e}:function(e){var t=getBuiltIn("Symbol");return isCallable(t)&&objectIsPrototypeOf(t.prototype,Object$2(e))},String$1=global_1.String,tryToString=function(e){try{return String$1(e)}catch(e){return"Object"}},TypeError$2=global_1.TypeError,aCallable=function(e){if(isCallable(e))return e;throw TypeError$2(tryToString(e)+" is not a function")},getMethod=function(e,t){var r=e[t];return null==r?void 0:aCallable(r)},TypeError$3=global_1.TypeError,ordinaryToPrimitive=function(e,t){var r,n;if("string"===t&&isCallable(r=e.toString)&&!isObject(n=functionCall(r,e)))return n;if(isCallable(r=e.valueOf)&&!isObject(n=functionCall(r,e)))return n;if("string"!==t&&isCallable(r=e.toString)&&!isObject(n=functionCall(r,e)))return n;throw TypeError$3("Can't convert object to primitive value")},defineProperty=Object.defineProperty,setGlobal=function(e,t){try{defineProperty(global_1,e,{value:t,configurable:!0,writable:!0})}catch(r){global_1[e]=t}return t},SHARED="__core-js_shared__",store=global_1[SHARED]||setGlobal(SHARED,{}),sharedStore=store,shared=createCommonjsModule((function(e){(e.exports=function(e,t){return sharedStore[e]||(sharedStore[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.22.2",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.22.2/LICENSE",source:"https://github.com/zloirock/core-js"})})),Object$3=global_1.Object,toObject=function(e){return Object$3(requireObjectCoercible(e))},hasOwnProperty=functionUncurryThis({}.hasOwnProperty),hasOwnProperty_1=Object.hasOwn||function(e,t){return hasOwnProperty(toObject(e),t)},id=0,postfix=Math.random(),toString$1=functionUncurryThis(1..toString),uid=function(e){return"Symbol("+(void 0===e?"":e)+")_"+toString$1(++id+postfix,36)},WellKnownSymbolsStore=shared("wks"),Symbol$1=global_1.Symbol,symbolFor=Symbol$1&&Symbol$1.for,createWellKnownSymbol=useSymbolAsUid?Symbol$1:Symbol$1&&Symbol$1.withoutSetter||uid,wellKnownSymbol=function(e){if(!hasOwnProperty_1(WellKnownSymbolsStore,e)||!nativeSymbol&&"string"!=typeof WellKnownSymbolsStore[e]){var t="Symbol."+e;nativeSymbol&&hasOwnProperty_1(Symbol$1,e)?WellKnownSymbolsStore[e]=Symbol$1[e]:WellKnownSymbolsStore[e]=useSymbolAsUid&&symbolFor?symbolFor(t):createWellKnownSymbol(t)}return WellKnownSymbolsStore[e]},TypeError$4=global_1.TypeError,TO_PRIMITIVE=wellKnownSymbol("toPrimitive"),toPrimitive=function(e,t){if(!isObject(e)||isSymbol(e))return e;var r,n=getMethod(e,TO_PRIMITIVE);if(n){if(void 0===t&&(t="default"),r=functionCall(n,e,t),!isObject(r)||isSymbol(r))return r;throw TypeError$4("Can't convert object to primitive value")}return void 0===t&&(t="number"),ordinaryToPrimitive(e,t)},toPropertyKey=function(e){var t=toPrimitive(e,"string");return isSymbol(t)?t:t+""},document$1=global_1.document,EXISTS=isObject(document$1)&&isObject(document$1.createElement),documentCreateElement=function(e){return EXISTS?document$1.createElement(e):{}},ie8DomDefine=!descriptors&&!fails((function(){return 7!=Object.defineProperty(documentCreateElement("div"),"a",{get:function(){return 7}}).a})),$getOwnPropertyDescriptor=Object.getOwnPropertyDescriptor,f$1=descriptors?$getOwnPropertyDescriptor:function(e,t){if(e=toIndexedObject(e),t=toPropertyKey(t),ie8DomDefine)try{return $getOwnPropertyDescriptor(e,t)}catch(e){}if(hasOwnProperty_1(e,t))return createPropertyDescriptor(!functionCall(objectPropertyIsEnumerable.f,e,t),e[t])},objectGetOwnPropertyDescriptor={f:f$1},v8PrototypeDefineBug=descriptors&&fails((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),String$2=global_1.String,TypeError$5=global_1.TypeError,anObject=function(e){if(isObject(e))return e;throw TypeError$5(String$2(e)+" is not an object")},TypeError$6=global_1.TypeError,$defineProperty=Object.defineProperty,$getOwnPropertyDescriptor$1=Object.getOwnPropertyDescriptor,ENUMERABLE="enumerable",CONFIGURABLE="configurable",WRITABLE="writable",f$2=descriptors?v8PrototypeDefineBug?function(e,t,r){if(anObject(e),t=toPropertyKey(t),anObject(r),"function"==typeof e&&"prototype"===t&&"value"in r&&WRITABLE in r&&!r[WRITABLE]){var n=$getOwnPropertyDescriptor$1(e,t);n&&n[WRITABLE]&&(e[t]=r.value,r={configurable:CONFIGURABLE in r?r[CONFIGURABLE]:n[CONFIGURABLE],enumerable:ENUMERABLE in r?r[ENUMERABLE]:n[ENUMERABLE],writable:!1})}return $defineProperty(e,t,r)}:$defineProperty:function(e,t,r){if(anObject(e),t=toPropertyKey(t),anObject(r),ie8DomDefine)try{return $defineProperty(e,t,r)}catch(e){}if("get"in r||"set"in r)throw TypeError$6("Accessors not supported");return"value"in r&&(e[t]=r.value),e},objectDefineProperty={f:f$2},createNonEnumerableProperty=descriptors?function(e,t,r){return objectDefineProperty.f(e,t,createPropertyDescriptor(1,r))}:function(e,t,r){return e[t]=r,e},functionToString=functionUncurryThis(Function.toString);isCallable(sharedStore.inspectSource)||(sharedStore.inspectSource=function(e){return functionToString(e)});var inspectSource=sharedStore.inspectSource,WeakMap=global_1.WeakMap,nativeWeakMap=isCallable(WeakMap)&&/native code/.test(inspectSource(WeakMap)),keys=shared("keys"),sharedKey=function(e){return keys[e]||(keys[e]=uid(e))},hiddenKeys={},OBJECT_ALREADY_INITIALIZED="Object already initialized",TypeError$7=global_1.TypeError,WeakMap$1=global_1.WeakMap,set,get,has,enforce=function(e){return has(e)?get(e):set(e,{})},getterFor=function(e){return function(t){var r;if(!isObject(t)||(r=get(t)).type!==e)throw TypeError$7("Incompatible receiver, "+e+" required");return r}};if(nativeWeakMap||sharedStore.state){var store$1=sharedStore.state||(sharedStore.state=new WeakMap$1),wmget=functionUncurryThis(store$1.get),wmhas=functionUncurryThis(store$1.has),wmset=functionUncurryThis(store$1.set);set=function(e,t){if(wmhas(store$1,e))throw new TypeError$7(OBJECT_ALREADY_INITIALIZED);return t.facade=e,wmset(store$1,e,t),t},get=function(e){return wmget(store$1,e)||{}},has=function(e){return wmhas(store$1,e)}}else{var STATE=sharedKey("state");hiddenKeys[STATE]=!0,set=function(e,t){if(hasOwnProperty_1(e,STATE))throw new TypeError$7(OBJECT_ALREADY_INITIALIZED);return t.facade=e,createNonEnumerableProperty(e,STATE,t),t},get=function(e){return hasOwnProperty_1(e,STATE)?e[STATE]:{}},has=function(e){return hasOwnProperty_1(e,STATE)}}var internalState={set:set,get:get,has:has,enforce:enforce,getterFor:getterFor},FunctionPrototype$1=Function.prototype,getDescriptor=descriptors&&Object.getOwnPropertyDescriptor,EXISTS$1=hasOwnProperty_1(FunctionPrototype$1,"name"),PROPER=EXISTS$1&&"something"===function(){}.name,CONFIGURABLE$1=EXISTS$1&&(!descriptors||descriptors&&getDescriptor(FunctionPrototype$1,"name").configurable),functionName={EXISTS:EXISTS$1,PROPER:PROPER,CONFIGURABLE:CONFIGURABLE$1},redefine=createCommonjsModule((function(e){var t=functionName.CONFIGURABLE,r=internalState.get,n=internalState.enforce,o=String(String).split("String");(e.exports=function(e,r,i,a){var s,c=!!a&&!!a.unsafe,u=!!a&&!!a.enumerable,l=!!a&&!!a.noTargetGet,p=a&&void 0!==a.name?a.name:r;isCallable(i)&&("Symbol("===String(p).slice(0,7)&&(p="["+String(p).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!hasOwnProperty_1(i,"name")||t&&i.name!==p)&&createNonEnumerableProperty(i,"name",p),(s=n(i)).source||(s.source=o.join("string"==typeof p?p:""))),e!==global_1?(c?!l&&e[r]&&(u=!0):delete e[r],u?e[r]=i:createNonEnumerableProperty(e,r,i)):u?e[r]=i:setGlobal(r,i)})(Function.prototype,"toString",(function(){return isCallable(this)&&r(this).source||inspectSource(this)}))})),ceil=Math.ceil,floor=Math.floor,toIntegerOrInfinity=function(e){var t=+e;return t!=t||0===t?0:(t>0?floor:ceil)(t)},max=Math.max,min=Math.min,toAbsoluteIndex=function(e,t){var r=toIntegerOrInfinity(e);return r<0?max(r+t,0):min(r,t)},min$1=Math.min,toLength=function(e){return e>0?min$1(toIntegerOrInfinity(e),9007199254740991):0},lengthOfArrayLike=function(e){return toLength(e.length)},createMethod=function(e){return function(t,r,n){var o,i=toIndexedObject(t),a=lengthOfArrayLike(i),s=toAbsoluteIndex(n,a);if(e&&r!=r){for(;a>s;)if((o=i[s++])!=o)return!0}else for(;a>s;s++)if((e||s in i)&&i[s]===r)return e||s||0;return!e&&-1}},arrayIncludes={includes:createMethod(!0),indexOf:createMethod(!1)},indexOf=arrayIncludes.indexOf,push=functionUncurryThis([].push),objectKeysInternal=function(e,t){var r,n=toIndexedObject(e),o=0,i=[];for(r in n)!hasOwnProperty_1(hiddenKeys,r)&&hasOwnProperty_1(n,r)&&push(i,r);for(;t.length>o;)hasOwnProperty_1(n,r=t[o++])&&(~indexOf(i,r)||push(i,r));return i},enumBugKeys=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],hiddenKeys$1=enumBugKeys.concat("length","prototype"),f$3=Object.getOwnPropertyNames||function(e){return objectKeysInternal(e,hiddenKeys$1)},objectGetOwnPropertyNames={f:f$3},f$4=Object.getOwnPropertySymbols,objectGetOwnPropertySymbols={f:f$4},concat=functionUncurryThis([].concat),ownKeys=getBuiltIn("Reflect","ownKeys")||function(e){var t=objectGetOwnPropertyNames.f(anObject(e)),r=objectGetOwnPropertySymbols.f;return r?concat(t,r(e)):t},copyConstructorProperties=function(e,t,r){for(var n=ownKeys(t),o=objectDefineProperty.f,i=objectGetOwnPropertyDescriptor.f,a=0;ao;)for(var s,c=indexedObject(arguments[o++]),u=i?concat$1(objectKeys(c),i(c)):objectKeys(c),l=u.length,p=0;l>p;)s=u[p++],descriptors&&!functionCall(a,c,s)||(r[s]=c[s]);return r}:$assign;_export({target:"Object",stat:!0,forced:Object.assign!==objectAssign},{assign:objectAssign});var isArray=Array.isArray||function(e){return"Array"==classofRaw(e)},createProperty=function(e,t,r){var n=toPropertyKey(t);n in e?objectDefineProperty.f(e,n,createPropertyDescriptor(0,r)):e[n]=r},TO_STRING_TAG=wellKnownSymbol("toStringTag"),test={};test[TO_STRING_TAG]="z";var toStringTagSupport="[object z]"===String(test),TO_STRING_TAG$1=wellKnownSymbol("toStringTag"),Object$4=global_1.Object,CORRECT_ARGUMENTS="Arguments"==classofRaw(function(){return arguments}()),tryGet=function(e,t){try{return e[t]}catch(e){}},classof=toStringTagSupport?classofRaw:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=tryGet(t=Object$4(e),TO_STRING_TAG$1))?r:CORRECT_ARGUMENTS?classofRaw(t):"Object"==(n=classofRaw(t))&&isCallable(t.callee)?"Arguments":n},noop=function(){},empty=[],construct=getBuiltIn("Reflect","construct"),constructorRegExp=/^\s*(?:class|function)\b/,exec=functionUncurryThis(constructorRegExp.exec),INCORRECT_TO_STRING=!constructorRegExp.exec(noop),isConstructorModern=function(e){if(!isCallable(e))return!1;try{return construct(noop,empty,e),!0}catch(e){return!1}},isConstructorLegacy=function(e){if(!isCallable(e))return!1;switch(classof(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return INCORRECT_TO_STRING||!!exec(constructorRegExp,inspectSource(e))}catch(e){return!0}};isConstructorLegacy.sham=!0;var isConstructor=!construct||fails((function(){var e;return isConstructorModern(isConstructorModern.call)||!isConstructorModern(Object)||!isConstructorModern((function(){e=!0}))||e}))?isConstructorLegacy:isConstructorModern,SPECIES=wellKnownSymbol("species"),Array$1=global_1.Array,arraySpeciesConstructor=function(e){var t;return isArray(e)&&(t=e.constructor,(isConstructor(t)&&(t===Array$1||isArray(t.prototype))||isObject(t)&&null===(t=t[SPECIES]))&&(t=void 0)),void 0===t?Array$1:t},arraySpeciesCreate=function(e,t){return new(arraySpeciesConstructor(e))(0===t?0:t)},SPECIES$1=wellKnownSymbol("species"),arrayMethodHasSpeciesSupport=function(e){return engineV8Version>=51||!fails((function(){var t=[];return(t.constructor={})[SPECIES$1]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},IS_CONCAT_SPREADABLE=wellKnownSymbol("isConcatSpreadable"),MAX_SAFE_INTEGER=9007199254740991,MAXIMUM_ALLOWED_INDEX_EXCEEDED="Maximum allowed index exceeded",TypeError$8=global_1.TypeError,IS_CONCAT_SPREADABLE_SUPPORT=engineV8Version>=51||!fails((function(){var e=[];return e[IS_CONCAT_SPREADABLE]=!1,e.concat()[0]!==e})),SPECIES_SUPPORT=arrayMethodHasSpeciesSupport("concat"),isConcatSpreadable=function(e){if(!isObject(e))return!1;var t=e[IS_CONCAT_SPREADABLE];return void 0!==t?!!t:isArray(e)},FORCED=!IS_CONCAT_SPREADABLE_SUPPORT||!SPECIES_SUPPORT;_export({target:"Array",proto:!0,forced:FORCED},{concat:function(e){var t,r,n,o,i,a=toObject(this),s=arraySpeciesCreate(a,0),c=0;for(t=-1,n=arguments.length;tMAX_SAFE_INTEGER)throw TypeError$8(MAXIMUM_ALLOWED_INDEX_EXCEEDED);for(r=0;r=MAX_SAFE_INTEGER)throw TypeError$8(MAXIMUM_ALLOWED_INDEX_EXCEEDED);createProperty(s,c++,i)}return s.length=c,s}});var String$3=global_1.String,toString_1=function(e){if("Symbol"===classof(e))throw TypeError("Cannot convert a Symbol value to a string");return String$3(e)},regexpFlags=function(){var e=anObject(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},$RegExp=global_1.RegExp,UNSUPPORTED_Y=fails((function(){var e=$RegExp("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),MISSED_STICKY=UNSUPPORTED_Y||fails((function(){return!$RegExp("a","y").sticky})),BROKEN_CARET=UNSUPPORTED_Y||fails((function(){var e=$RegExp("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),regexpStickyHelpers={BROKEN_CARET:BROKEN_CARET,MISSED_STICKY:MISSED_STICKY,UNSUPPORTED_Y:UNSUPPORTED_Y},f$5=descriptors&&!v8PrototypeDefineBug?Object.defineProperties:function(e,t){anObject(e);for(var r,n=toIndexedObject(t),o=objectKeys(t),i=o.length,a=0;i>a;)objectDefineProperty.f(e,r=o[a++],n[r]);return e},objectDefineProperties={f:f$5},html=getBuiltIn("document","documentElement"),GT=">",LT="<",PROTOTYPE="prototype",SCRIPT="script",IE_PROTO=sharedKey("IE_PROTO"),EmptyConstructor=function(){},scriptTag=function(e){return LT+SCRIPT+GT+e+LT+"/"+SCRIPT+GT},NullProtoObjectViaActiveX=function(e){e.write(scriptTag("")),e.close();var t=e.parentWindow.Object;return e=null,t},NullProtoObjectViaIFrame=function(){var e,t=documentCreateElement("iframe"),r="java"+SCRIPT+":";return t.style.display="none",html.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(scriptTag("document.F=Object")),e.close(),e.F},activeXDocument,NullProtoObject=function(){try{activeXDocument=new ActiveXObject("htmlfile")}catch(e){}NullProtoObject="undefined"!=typeof document?document.domain&&activeXDocument?NullProtoObjectViaActiveX(activeXDocument):NullProtoObjectViaIFrame():NullProtoObjectViaActiveX(activeXDocument);for(var e=enumBugKeys.length;e--;)delete NullProtoObject[PROTOTYPE][enumBugKeys[e]];return NullProtoObject()};hiddenKeys[IE_PROTO]=!0;var objectCreate=Object.create||function(e,t){var r;return null!==e?(EmptyConstructor[PROTOTYPE]=anObject(e),r=new EmptyConstructor,EmptyConstructor[PROTOTYPE]=null,r[IE_PROTO]=e):r=NullProtoObject(),void 0===t?r:objectDefineProperties.f(r,t)},$RegExp$1=global_1.RegExp,regexpUnsupportedDotAll=fails((function(){var e=$RegExp$1(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),$RegExp$2=global_1.RegExp,regexpUnsupportedNcg=fails((function(){var e=$RegExp$2("(?b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$c")})),getInternalState=internalState.get,nativeReplace=shared("native-string-replace",String.prototype.replace),nativeExec=RegExp.prototype.exec,patchedExec=nativeExec,charAt=functionUncurryThis("".charAt),indexOf$1=functionUncurryThis("".indexOf),replace=functionUncurryThis("".replace),stringSlice$1=functionUncurryThis("".slice),UPDATES_LAST_INDEX_WRONG=function(){var e=/a/,t=/b*/g;return functionCall(nativeExec,e,"a"),functionCall(nativeExec,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),UNSUPPORTED_Y$1=regexpStickyHelpers.BROKEN_CARET,NPCG_INCLUDED=void 0!==/()??/.exec("")[1],PATCH=UPDATES_LAST_INDEX_WRONG||NPCG_INCLUDED||UNSUPPORTED_Y$1||regexpUnsupportedDotAll||regexpUnsupportedNcg;PATCH&&(patchedExec=function(e){var t,r,n,o,i,a,s,c=this,u=getInternalState(c),l=toString_1(e),p=u.raw;if(p)return p.lastIndex=c.lastIndex,t=functionCall(patchedExec,p,l),c.lastIndex=p.lastIndex,t;var f=u.groups,d=UNSUPPORTED_Y$1&&c.sticky,h=functionCall(regexpFlags,c),g=c.source,y=0,v=l;if(d&&(h=replace(h,"y",""),-1===indexOf$1(h,"g")&&(h+="g"),v=stringSlice$1(l,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==charAt(l,c.lastIndex-1))&&(g="(?: "+g+")",v=" "+v,y++),r=new RegExp("^(?:"+g+")",h)),NPCG_INCLUDED&&(r=new RegExp("^"+g+"$(?!\\s)",h)),UPDATES_LAST_INDEX_WRONG&&(n=c.lastIndex),o=functionCall(nativeExec,d?r:c,v),d?o?(o.input=stringSlice$1(o.input,y),o[0]=stringSlice$1(o[0],y),o.index=c.lastIndex,c.lastIndex+=o[0].length):c.lastIndex=0:UPDATES_LAST_INDEX_WRONG&&o&&(c.lastIndex=c.global?o.index+o[0].length:n),NPCG_INCLUDED&&o&&o.length>1&&functionCall(nativeReplace,o[0],r,(function(){for(i=1;i=s?e?"":void 0:(n=charCodeAt(i,a))<55296||n>56319||a+1===s||(o=charCodeAt(i,a+1))<56320||o>57343?e?charAt$1(i,a):n:e?stringSlice$2(i,a,a+2):o-56320+(n-55296<<10)+65536}},stringMultibyte={codeAt:createMethod$1(!1),charAt:createMethod$1(!0)},charAt$2=stringMultibyte.charAt,advanceStringIndex=function(e,t,r){return t+(r?charAt$2(e,t).length:1)},floor$1=Math.floor,charAt$3=functionUncurryThis("".charAt),replace$1=functionUncurryThis("".replace),stringSlice$3=functionUncurryThis("".slice),SUBSTITUTION_SYMBOLS=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,SUBSTITUTION_SYMBOLS_NO_NAMED=/\$([$&'`]|\d{1,2})/g,getSubstitution=function(e,t,r,n,o,i){var a=r+e.length,s=n.length,c=SUBSTITUTION_SYMBOLS_NO_NAMED;return void 0!==o&&(o=toObject(o),c=SUBSTITUTION_SYMBOLS),replace$1(i,c,(function(i,c){var u;switch(charAt$3(c,0)){case"$":return"$";case"&":return e;case"`":return stringSlice$3(t,0,r);case"'":return stringSlice$3(t,a);case"<":u=o[stringSlice$3(c,1,-1)];break;default:var l=+c;if(0===l)return i;if(l>s){var p=floor$1(l/10);return 0===p?i:p<=s?void 0===n[p-1]?charAt$3(c,1):n[p-1]+charAt$3(c,1):i}u=n[l-1]}return void 0===u?"":u}))},TypeError$9=global_1.TypeError,regexpExecAbstract=function(e,t){var r=e.exec;if(isCallable(r)){var n=functionCall(r,e,t);return null!==n&&anObject(n),n}if("RegExp"===classofRaw(e))return functionCall(regexpExec,e,t);throw TypeError$9("RegExp#exec called on incompatible receiver")},REPLACE=wellKnownSymbol("replace"),max$1=Math.max,min$2=Math.min,concat$2=functionUncurryThis([].concat),push$1=functionUncurryThis([].push),stringIndexOf=functionUncurryThis("".indexOf),stringSlice$4=functionUncurryThis("".slice),maybeToString=function(e){return void 0===e?e:String(e)},REPLACE_KEEPS_$0="$0"==="a".replace(/./,"$0"),REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE=!!/./[REPLACE]&&""===/./[REPLACE]("a","$0"),REPLACE_SUPPORTS_NAMED_GROUPS=!fails((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$")}));fixRegexpWellKnownSymbolLogic("replace",(function(e,t,r){var n=REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE?"$":"$0";return[function(e,r){var n=requireObjectCoercible(this),o=null==e?void 0:getMethod(e,REPLACE);return o?functionCall(o,e,n,r):functionCall(t,toString_1(n),e,r)},function(e,o){var i=anObject(this),a=toString_1(e);if("string"==typeof o&&-1===stringIndexOf(o,n)&&-1===stringIndexOf(o,"$<")){var s=r(t,i,a,o);if(s.done)return s.value}var c=isCallable(o);c||(o=toString_1(o));var u=i.global;if(u){var l=i.unicode;i.lastIndex=0}for(var p=[];;){var f=regexpExecAbstract(i,a);if(null===f)break;if(push$1(p,f),!u)break;""===toString_1(f[0])&&(i.lastIndex=advanceStringIndex(a,toLength(i.lastIndex),l))}for(var d="",h=0,g=0;g=h&&(d+=stringSlice$4(a,h,v)+_,h=v+y.length)}return d+stringSlice$4(a,h)}]}),!REPLACE_SUPPORTS_NAMED_GROUPS||!REPLACE_KEEPS_$0||REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);var UNSCOPABLES=wellKnownSymbol("unscopables"),ArrayPrototype=Array.prototype;null==ArrayPrototype[UNSCOPABLES]&&objectDefineProperty.f(ArrayPrototype,UNSCOPABLES,{configurable:!0,value:objectCreate(null)});var addToUnscopables=function(e){ArrayPrototype[UNSCOPABLES][e]=!0},$includes=arrayIncludes.includes;_export({target:"Array",proto:!0},{includes:function(e){return $includes(this,e,arguments.length>1?arguments[1]:void 0)}}),addToUnscopables("includes");var arrayMethodIsStrict=function(e,t){var r=[][e];return!!r&&fails((function(){r.call(null,t||function(){return 1},1)}))},$IndexOf=arrayIncludes.indexOf,un$IndexOf=functionUncurryThis([].indexOf),NEGATIVE_ZERO=!!un$IndexOf&&1/un$IndexOf([1],1,-0)<0,STRICT_METHOD=arrayMethodIsStrict("indexOf");_export({target:"Array",proto:!0,forced:NEGATIVE_ZERO||!STRICT_METHOD},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return NEGATIVE_ZERO?un$IndexOf(this,e,t)||0:$IndexOf(this,e,t)}});var un$Join=functionUncurryThis([].join),ES3_STRINGS=indexedObject!=Object,STRICT_METHOD$1=arrayMethodIsStrict("join",",");_export({target:"Array",proto:!0,forced:ES3_STRINGS||!STRICT_METHOD$1},{join:function(e){return un$Join(toIndexedObject(this),void 0===e?",":e)}});var objectToString=toStringTagSupport?{}.toString:function(){return"[object "+classof(this)+"]"};toStringTagSupport||redefine(Object.prototype,"toString",objectToString,{unsafe:!0});var engineIsNode="process"==classofRaw(global_1.process),redefineAll=function(e,t,r){for(var n in t)redefine(e,n,t[n],r);return e},String$4=global_1.String,TypeError$a=global_1.TypeError,aPossiblePrototype=function(e){if("object"==typeof e||isCallable(e))return e;throw TypeError$a("Can't set "+String$4(e)+" as a prototype")},objectSetPrototypeOf=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=functionUncurryThis(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return anObject(r),aPossiblePrototype(n),t?e(r,n):r.__proto__=n,r}}():void 0),defineProperty$2=objectDefineProperty.f,TO_STRING_TAG$2=wellKnownSymbol("toStringTag"),setToStringTag=function(e,t,r){e&&!r&&(e=e.prototype),e&&!hasOwnProperty_1(e,TO_STRING_TAG$2)&&defineProperty$2(e,TO_STRING_TAG$2,{configurable:!0,value:t})},SPECIES$3=wellKnownSymbol("species"),setSpecies=function(e){var t=getBuiltIn(e),r=objectDefineProperty.f;descriptors&&t&&!t[SPECIES$3]&&r(t,SPECIES$3,{configurable:!0,get:function(){return this}})},TypeError$b=global_1.TypeError,anInstance=function(e,t){if(objectIsPrototypeOf(t,e))return e;throw TypeError$b("Incorrect invocation")},TypeError$c=global_1.TypeError,aConstructor=function(e){if(isConstructor(e))return e;throw TypeError$c(tryToString(e)+" is not a constructor")},SPECIES$4=wellKnownSymbol("species"),speciesConstructor=function(e,t){var r,n=anObject(e).constructor;return void 0===n||null==(r=anObject(n)[SPECIES$4])?t:aConstructor(r)},bind$1=functionUncurryThis(functionUncurryThis.bind),functionBindContext=function(e,t){return aCallable(e),void 0===t?e:functionBindNative?bind$1(e,t):function(){return e.apply(t,arguments)}},arraySlice=functionUncurryThis([].slice),TypeError$d=global_1.TypeError,validateArgumentsLength=function(e,t){if(e=51&&/native code/.test(e))return!1;var r=new promiseNativeConstructor((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};return(r.constructor={})[SPECIES$5]=n,!(SUBCLASSING=r.then((function(){}))instanceof n)||!t&&engineIsBrowser&&!NATIVE_PROMISE_REJECTION_EVENT})),promiseConstructorDetection={CONSTRUCTOR:FORCED_PROMISE_CONSTRUCTOR,REJECTION_EVENT:NATIVE_PROMISE_REJECTION_EVENT,SUBCLASSING:SUBCLASSING},PromiseCapability=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=aCallable(t),this.reject=aCallable(r)},f$6=function(e){return new PromiseCapability(e)},newPromiseCapability={f:f$6},task$1=task.set,PROMISE="Promise",FORCED_PROMISE_CONSTRUCTOR$1=promiseConstructorDetection.CONSTRUCTOR,NATIVE_PROMISE_REJECTION_EVENT$1=promiseConstructorDetection.REJECTION_EVENT,NATIVE_PROMISE_SUBCLASSING=promiseConstructorDetection.SUBCLASSING,getInternalPromiseState=internalState.getterFor(PROMISE),setInternalState=internalState.set,NativePromisePrototype$1=promiseNativeConstructor&&promiseNativeConstructor.prototype,PromiseConstructor=promiseNativeConstructor,PromisePrototype=NativePromisePrototype$1,TypeError$e=global_1.TypeError,document$3=global_1.document,process$4=global_1.process,newPromiseCapability$1=newPromiseCapability.f,newGenericPromiseCapability=newPromiseCapability$1,DISPATCH_EVENT=!!(document$3&&document$3.createEvent&&global_1.dispatchEvent),UNHANDLED_REJECTION="unhandledrejection",REJECTION_HANDLED="rejectionhandled",PENDING=0,FULFILLED=1,REJECTED=2,HANDLED=1,UNHANDLED=2,Internal,OwnPromiseCapability,PromiseWrapper,nativeThen,isThenable=function(e){var t;return!(!isObject(e)||!isCallable(t=e.then))&&t},callReaction=function(e,t){var r,n,o,i=t.value,a=t.state==FULFILLED,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,l=e.domain;try{s?(a||(t.rejection===UNHANDLED&&onHandleUnhandled(t),t.rejection=HANDLED),!0===s?r=i:(l&&l.enter(),r=s(i),l&&(l.exit(),o=!0)),r===e.promise?u(TypeError$e("Promise-chain cycle")):(n=isThenable(r))?functionCall(n,r,c,u):c(r)):u(i)}catch(e){l&&!o&&l.exit(),u(e)}},notify$1=function(e,t){e.notified||(e.notified=!0,microtask((function(){for(var r,n=e.reactions;r=n.get();)callReaction(r,e);e.notified=!1,t&&!e.rejection&&onUnhandled(e)})))},dispatchEvent=function(e,t,r){var n,o;DISPATCH_EVENT?((n=document$3.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),global_1.dispatchEvent(n)):n={promise:t,reason:r},!NATIVE_PROMISE_REJECTION_EVENT$1&&(o=global_1["on"+e])?o(n):e===UNHANDLED_REJECTION&&hostReportErrors("Unhandled promise rejection",r)},onUnhandled=function(e){functionCall(task$1,global_1,(function(){var t,r=e.facade,n=e.value;if(isUnhandled(e)&&(t=perform((function(){engineIsNode?process$4.emit("unhandledRejection",n,r):dispatchEvent(UNHANDLED_REJECTION,r,n)})),e.rejection=engineIsNode||isUnhandled(e)?UNHANDLED:HANDLED,t.error))throw t.value}))},isUnhandled=function(e){return e.rejection!==HANDLED&&!e.parent},onHandleUnhandled=function(e){functionCall(task$1,global_1,(function(){var t=e.facade;engineIsNode?process$4.emit("rejectionHandled",t):dispatchEvent(REJECTION_HANDLED,t,e.value)}))},bind$2=function(e,t,r){return function(n){e(t,n,r)}},internalReject=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=REJECTED,notify$1(e,!0))},internalResolve=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw TypeError$e("Promise can't be resolved itself");var n=isThenable(t);n?microtask((function(){var r={done:!1};try{functionCall(n,t,bind$2(internalResolve,r,e),bind$2(internalReject,r,e))}catch(t){internalReject(r,t,e)}})):(e.value=t,e.state=FULFILLED,notify$1(e,!1))}catch(t){internalReject({done:!1},t,e)}}};if(FORCED_PROMISE_CONSTRUCTOR$1&&(PromiseConstructor=function(e){anInstance(this,PromisePrototype),aCallable(e),functionCall(Internal,this);var t=getInternalPromiseState(this);try{e(bind$2(internalResolve,t),bind$2(internalReject,t))}catch(e){internalReject(t,e)}},PromisePrototype=PromiseConstructor.prototype,Internal=function(e){setInternalState(this,{type:PROMISE,done:!1,notified:!1,parent:!1,reactions:new queue$1,rejection:!1,state:PENDING,value:void 0})},Internal.prototype=redefineAll(PromisePrototype,{then:function(e,t){var r=getInternalPromiseState(this),n=newPromiseCapability$1(speciesConstructor(this,PromiseConstructor));return r.parent=!0,n.ok=!isCallable(e)||e,n.fail=isCallable(t)&&t,n.domain=engineIsNode?process$4.domain:void 0,r.state==PENDING?r.reactions.add(n):microtask((function(){callReaction(n,r)})),n.promise}}),OwnPromiseCapability=function(){var e=new Internal,t=getInternalPromiseState(e);this.promise=e,this.resolve=bind$2(internalResolve,t),this.reject=bind$2(internalReject,t)},newPromiseCapability.f=newPromiseCapability$1=function(e){return e===PromiseConstructor||e===PromiseWrapper?new OwnPromiseCapability(e):newGenericPromiseCapability(e)},isCallable(promiseNativeConstructor)&&NativePromisePrototype$1!==Object.prototype)){nativeThen=NativePromisePrototype$1.then,NATIVE_PROMISE_SUBCLASSING||redefine(NativePromisePrototype$1,"then",(function(e,t){var r=this;return new PromiseConstructor((function(e,t){functionCall(nativeThen,r,e,t)})).then(e,t)}),{unsafe:!0});try{delete NativePromisePrototype$1.constructor}catch(e){}objectSetPrototypeOf&&objectSetPrototypeOf(NativePromisePrototype$1,PromisePrototype)}_export({global:!0,wrap:!0,forced:FORCED_PROMISE_CONSTRUCTOR$1},{Promise:PromiseConstructor}),setToStringTag(PromiseConstructor,PROMISE,!1),setSpecies(PROMISE);var iterators={},ITERATOR=wellKnownSymbol("iterator"),ArrayPrototype$1=Array.prototype,isArrayIteratorMethod=function(e){return void 0!==e&&(iterators.Array===e||ArrayPrototype$1[ITERATOR]===e)},ITERATOR$1=wellKnownSymbol("iterator"),getIteratorMethod=function(e){if(null!=e)return getMethod(e,ITERATOR$1)||getMethod(e,"@@iterator")||iterators[classof(e)]},TypeError$f=global_1.TypeError,getIterator=function(e,t){var r=arguments.length<2?getIteratorMethod(e):t;if(aCallable(r))return anObject(functionCall(r,e));throw TypeError$f(tryToString(e)+" is not iterable")},iteratorClose=function(e,t,r){var n,o;anObject(e);try{if(!(n=getMethod(e,"return"))){if("throw"===t)throw r;return r}n=functionCall(n,e)}catch(e){o=!0,n=e}if("throw"===t)throw r;if(o)throw n;return anObject(n),r},TypeError$g=global_1.TypeError,Result=function(e,t){this.stopped=e,this.result=t},ResultPrototype=Result.prototype,iterate=function(e,t,r){var n,o,i,a,s,c,u,l=r&&r.that,p=!(!r||!r.AS_ENTRIES),f=!(!r||!r.IS_ITERATOR),d=!(!r||!r.INTERRUPTED),h=functionBindContext(t,l),g=function(e){return n&&iteratorClose(n,"normal",e),new Result(!0,e)},y=function(e){return p?(anObject(e),d?h(e[0],e[1],g):h(e[0],e[1])):d?h(e,g):h(e)};if(f)n=e;else{if(!(o=getIteratorMethod(e)))throw TypeError$g(tryToString(e)+" is not iterable");if(isArrayIteratorMethod(o)){for(i=0,a=lengthOfArrayLike(e);a>i;i++)if((s=y(e[i]))&&objectIsPrototypeOf(ResultPrototype,s))return s;return new Result(!1)}n=getIterator(e,o)}for(c=n.next;!(u=functionCall(c,n)).done;){try{s=y(u.value)}catch(e){iteratorClose(n,"throw",e)}if("object"==typeof s&&s&&objectIsPrototypeOf(ResultPrototype,s))return s}return new Result(!1)},ITERATOR$2=wellKnownSymbol("iterator"),SAFE_CLOSING=!1;try{var called=0,iteratorWithReturn={next:function(){return{done:!!called++}},return:function(){SAFE_CLOSING=!0}};iteratorWithReturn[ITERATOR$2]=function(){return this},Array.from(iteratorWithReturn,(function(){throw 2}))}catch(e){}var checkCorrectnessOfIteration=function(e,t){if(!t&&!SAFE_CLOSING)return!1;var r=!1;try{var n={};n[ITERATOR$2]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},FORCED_PROMISE_CONSTRUCTOR$2=promiseConstructorDetection.CONSTRUCTOR,promiseStaticsIncorrectIteration=FORCED_PROMISE_CONSTRUCTOR$2||!checkCorrectnessOfIteration((function(e){promiseNativeConstructor.all(e).then(void 0,(function(){}))}));_export({target:"Promise",stat:!0,forced:promiseStaticsIncorrectIteration},{all:function(e){var t=this,r=newPromiseCapability.f(t),n=r.resolve,o=r.reject,i=perform((function(){var r=aCallable(t.resolve),i=[],a=0,s=1;iterate(e,(function(e){var c=a++,u=!1;s++,functionCall(r,t,e).then((function(e){u||(u=!0,i[c]=e,--s||n(i))}),o)})),--s||n(i)}));return i.error&&o(i.value),r.promise}});var FORCED_PROMISE_CONSTRUCTOR$3=promiseConstructorDetection.CONSTRUCTOR,NativePromisePrototype$2=promiseNativeConstructor&&promiseNativeConstructor.prototype;if(_export({target:"Promise",proto:!0,forced:FORCED_PROMISE_CONSTRUCTOR$3,real:!0},{catch:function(e){return this.then(void 0,e)}}),isCallable(promiseNativeConstructor)){var method=getBuiltIn("Promise").prototype.catch;NativePromisePrototype$2.catch!==method&&redefine(NativePromisePrototype$2,"catch",method,{unsafe:!0})}_export({target:"Promise",stat:!0,forced:promiseStaticsIncorrectIteration},{race:function(e){var t=this,r=newPromiseCapability.f(t),n=r.reject,o=perform((function(){var o=aCallable(t.resolve);iterate(e,(function(e){functionCall(o,t,e).then(r.resolve,n)}))}));return o.error&&n(o.value),r.promise}});var FORCED_PROMISE_CONSTRUCTOR$4=promiseConstructorDetection.CONSTRUCTOR;_export({target:"Promise",stat:!0,forced:FORCED_PROMISE_CONSTRUCTOR$4},{reject:function(e){var t=newPromiseCapability.f(this);return functionCall(t.reject,void 0,e),t.promise}});var promiseResolve=function(e,t){if(anObject(e),isObject(t)&&t.constructor===e)return t;var r=newPromiseCapability.f(e);return(0,r.resolve)(t),r.promise},FORCED_PROMISE_CONSTRUCTOR$5=promiseConstructorDetection.CONSTRUCTOR,PromiseConstructorWrapper=getBuiltIn("Promise");_export({target:"Promise",stat:!0,forced:FORCED_PROMISE_CONSTRUCTOR$5},{resolve:function(e){return promiseResolve(this,e)}});var DatePrototype=Date.prototype,INVALID_DATE="Invalid Date",TO_STRING="toString",un$DateToString=functionUncurryThis(DatePrototype[TO_STRING]),getTime=functionUncurryThis(DatePrototype.getTime);String(new Date(NaN))!=INVALID_DATE&&redefine(DatePrototype,TO_STRING,(function(){var e=getTime(this);return e==e?un$DateToString(this):INVALID_DATE}));var runtime=createCommonjsModule((function(e){!function(t){var r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",s=o.toStringTag||"@@toStringTag",c=t.regeneratorRuntime;if(c)e.exports=c;else{(c=t.regeneratorRuntime=e.exports).wrap=h;var u={},l={};l[i]=function(){return this};var p=Object.getPrototypeOf,f=p&&p(p(O([])));f&&f!==r&&n.call(f,i)&&(l=f);var d=m.prototype=y.prototype=Object.create(l);v.prototype=d.constructor=m,m.constructor=v,m[s]=v.displayName="GeneratorFunction",c.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},c.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(d),e},c.awrap=function(e){return{__await:e}},b(S.prototype),S.prototype[a]=function(){return this},c.AsyncIterator=S,c.async=function(e,t,r,n){var o=new S(h(e,t,r,n));return c.isGeneratorFunction(t)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},b(d),d[s]="Generator",d[i]=function(){return this},d.toString=function(){return"[object Generator]"},c.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},c.values=O,I.prototype={constructor:I,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&n.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),c=n.call(i,"finallyLoc");if(s&&c){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),u}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:O(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),u}}}function h(e,t,r,n){var o=t&&t.prototype instanceof y?t:y,i=Object.create(o.prototype),a=new I(n||[]);return i._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return R()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var s=E(a,r);if(s){if(s===u)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=g(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===u)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(e,r,a),i}function g(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}function y(){}function v(){}function m(){}function b(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function S(e){var t;this._invoke=function(r,o){function i(){return new Promise((function(t,i){!function t(r,o,i,a){var s=g(e[r],e,o);if("throw"!==s.type){var c=s.arg,u=c.value;return u&&"object"==typeof u&&n.call(u,"__await")?Promise.resolve(u.__await).then((function(e){t("next",e,i,a)}),(function(e){t("throw",e,i,a)})):Promise.resolve(u).then((function(e){c.value=e,i(c)}),a)}a(s.arg)}(r,o,t,i)}))}return t=t?t.then(i,i):i()}}function E(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,E(e,t),"throw"===t.method))return u;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return u}var n=g(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,u;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,u):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,u)}function _(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(_,this),this.reset(!0)}function O(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r=0)return;o[t]="set-cookie"===t?(o[t]?o[t]:[]).concat([r]):o[t]?o[t]+", "+r:r}})),o):o},isURLSameOrigin=utils.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function n(e){var n=e;return t&&(r.setAttribute("href",n),n=r.href),r.setAttribute("href",n),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=n(window.location.href),function(t){var r=utils.isString(t)?n(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0},cookies=utils.isStandardBrowserEnv()?{write:function(e,t,r,n,o,i){var a=[];a.push(e+"="+encodeURIComponent(t)),utils.isNumber(r)&&a.push("expires="+new Date(r).toGMTString()),utils.isString(n)&&a.push("path="+n),utils.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},xhr=function(e){return new Promise((function(t,r){var n=e.data,o=e.headers;utils.isFormData(n)&&delete o["Content-Type"];var i=new XMLHttpRequest;if(e.auth){var a=e.auth.username||"",s=e.auth.password||"";o.Authorization="Basic "+btoa(a+":"+s)}var c=buildFullPath(e.baseURL,e.url);if(i.open(e.method.toUpperCase(),buildURL(c,e.params,e.paramsSerializer),!0),i.timeout=e.timeout,i.onreadystatechange=function(){if(i&&4===i.readyState&&(0!==i.status||i.responseURL&&0===i.responseURL.indexOf("file:"))){var n="getAllResponseHeaders"in i?parseHeaders(i.getAllResponseHeaders()):null,o={data:e.responseType&&"text"!==e.responseType?i.response:i.responseText,status:i.status,statusText:i.statusText,headers:n,config:e,request:i};settle(t,r,o),i=null}},i.onabort=function(){i&&(r(createError("Request aborted",e,"ECONNABORTED",i)),i=null)},i.onerror=function(){r(createError("Network Error",e,null,i)),i=null},i.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(createError(t,e,"ECONNABORTED",i)),i=null},utils.isStandardBrowserEnv()){var u=cookies,l=(e.withCredentials||isURLSameOrigin(c))&&e.xsrfCookieName?u.read(e.xsrfCookieName):void 0;l&&(o[e.xsrfHeaderName]=l)}if("setRequestHeader"in i&&utils.forEach(o,(function(e,t){void 0===n&&"content-type"===t.toLowerCase()?delete o[t]:i.setRequestHeader(t,e)})),utils.isUndefined(e.withCredentials)||(i.withCredentials=!!e.withCredentials),e.responseType)try{i.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&i.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){i&&(i.abort(),r(e),i=null)})),void 0===n&&(n=null),i.send(n)}))},DEFAULT_CONTENT_TYPE={"Content-Type":"application/x-www-form-urlencoded"};function setContentTypeIfUnset(e,t){!utils.isUndefined(e)&&utils.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}function getDefaultAdapter(){var e;return("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(e=xhr),e}var defaults={adapter:getDefaultAdapter(),transformRequest:[function(e,t){return normalizeHeaderName(t,"Accept"),normalizeHeaderName(t,"Content-Type"),utils.isFormData(e)||utils.isArrayBuffer(e)||utils.isBuffer(e)||utils.isStream(e)||utils.isFile(e)||utils.isBlob(e)?e:utils.isArrayBufferView(e)?e.buffer:utils.isURLSearchParams(e)?(setContentTypeIfUnset(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):utils.isObject(e)?(setContentTypeIfUnset(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};utils.forEach(["delete","get","head"],(function(e){defaults.headers[e]={}})),utils.forEach(["post","put","patch"],(function(e){defaults.headers[e]=utils.merge(DEFAULT_CONTENT_TYPE)}));var defaults_1=defaults;function throwIfCancellationRequested(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var dispatchRequest=function(e){return throwIfCancellationRequested(e),e.headers=e.headers||{},e.data=transformData(e.data,e.headers,e.transformRequest),e.headers=utils.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),utils.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||defaults_1.adapter)(e).then((function(t){return throwIfCancellationRequested(e),t.data=transformData(t.data,t.headers,e.transformResponse),t}),(function(t){return isCancel(t)||(throwIfCancellationRequested(e),t&&t.response&&(t.response.data=transformData(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},mergeConfig=function(e,t){t=t||{};var r={},n=["url","method","params","data"],o=["headers","auth","proxy"],i=["baseURL","url","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"];utils.forEach(n,(function(e){void 0!==t[e]&&(r[e]=t[e])})),utils.forEach(o,(function(n){utils.isObject(t[n])?r[n]=utils.deepMerge(e[n],t[n]):void 0!==t[n]?r[n]=t[n]:utils.isObject(e[n])?r[n]=utils.deepMerge(e[n]):void 0!==e[n]&&(r[n]=e[n])})),utils.forEach(i,(function(n){void 0!==t[n]?r[n]=t[n]:void 0!==e[n]&&(r[n]=e[n])}));var a=n.concat(o).concat(i),s=Object.keys(t).filter((function(e){return-1===a.indexOf(e)}));return utils.forEach(s,(function(n){void 0!==t[n]?r[n]=t[n]:void 0!==e[n]&&(r[n]=e[n])})),r};function Axios(e){this.defaults=e,this.interceptors={request:new InterceptorManager_1,response:new InterceptorManager_1}}Axios.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=mergeConfig(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[dispatchRequest,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},Axios.prototype.getUri=function(e){return e=mergeConfig(this.defaults,e),buildURL(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},utils.forEach(["delete","get","head","options"],(function(e){Axios.prototype[e]=function(t,r){return this.request(utils.merge(r||{},{method:e,url:t}))}})),utils.forEach(["post","put","patch"],(function(e){Axios.prototype[e]=function(t,r,n){return this.request(utils.merge(n||{},{method:e,url:t,data:r}))}}));var Axios_1=Axios;function Cancel(e){this.message=e}Cancel.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Cancel.prototype.__CANCEL__=!0;var Cancel_1=Cancel;function CancelToken(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new Cancel_1(e),t(r.reason))}))}CancelToken.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},CancelToken.source=function(){var e;return{token:new CancelToken((function(t){e=t})),cancel:e}};var CancelToken_1=CancelToken,spread=function(e){return function(t){return e.apply(null,t)}};function createInstance(e){var t=new Axios_1(e),r=bind$3(Axios_1.prototype.request,t);return utils.extend(r,Axios_1.prototype,t),utils.extend(r,t),r}var axios=createInstance(defaults_1);axios.Axios=Axios_1,axios.create=function(e){return createInstance(mergeConfig(axios.defaults,e))},axios.Cancel=Cancel_1,axios.CancelToken=CancelToken_1,axios.isCancel=isCancel,axios.all=function(e){return Promise.all(e)},axios.spread=spread;var axios_1=axios,default_1=axios;axios_1.default=default_1;var axios$1=axios_1;function request(e){var t=e.url,r=e.headers,n=void 0===r?{}:r,o=e.data,i=void 0===o?"":o,a=e.responseType,s=void 0===a?"json":a,c=e.timeout,u=void 0===c?3e4:c,l=e.method,p=void 0===l?"POST":l,f=e.params,d=void 0===f?{}:f;return axios$1(Object.assign(Object.assign({},e),{url:t,headers:Object.assign({"content-type":"application/json;charset=UTF-8"},n),data:i,responseType:s,timeout:u,method:p,params:d}))}var MATCH=wellKnownSymbol("match"),isRegexp=function(e){var t;return isObject(e)&&(void 0!==(t=e[MATCH])?!!t:"RegExp"==classofRaw(e))},Array$2=global_1.Array,max$2=Math.max,arraySliceSimple=function(e,t,r){for(var n=lengthOfArrayLike(e),o=toAbsoluteIndex(t,n),i=toAbsoluteIndex(void 0===r?n:r,n),a=Array$2(max$2(i-o,0)),s=0;o1||"".split(/.?/).length?function(e,r){var n=toString_1(requireObjectCoercible(this)),o=void 0===r?MAX_UINT32:r>>>0;if(0===o)return[];if(void 0===e)return[n];if(!isRegexp(e))return functionCall(t,n,e,o);for(var i,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),l=0,p=new RegExp(e.source,u+"g");(i=functionCall(regexpExec,p,n))&&!((a=p.lastIndex)>l&&(push$2(c,stringSlice$5(n,l,i.index)),i.length>1&&i.index=o));)p.lastIndex===i.index&&p.lastIndex++;return l===n.length?!s&&exec$1(p,"")||push$2(c,""):push$2(c,stringSlice$5(n,l)),c.length>o?arraySliceSimple(c,0,o):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:functionCall(t,this,e,r)}:t,[function(t,r){var o=requireObjectCoercible(this),i=null==t?void 0:getMethod(t,e);return i?functionCall(i,t,o,r):functionCall(n,toString_1(o),t,r)},function(e,o){var i=anObject(this),a=toString_1(e),s=r(n,i,a,o,n!==t);if(s.done)return s.value;var c=speciesConstructor(i,RegExp),u=i.unicode,l=(i.ignoreCase?"i":"")+(i.multiline?"m":"")+(i.unicode?"u":"")+(UNSUPPORTED_Y$2?"g":"y"),p=new c(UNSUPPORTED_Y$2?"^(?:"+i.source+")":i,l),f=void 0===o?MAX_UINT32:o>>>0;if(0===f)return[];if(0===a.length)return null===regexpExecAbstract(p,a)?[a]:[];for(var d=0,h=0,g=[];h=0:s>c;c+=u)c in a&&(o=r(o,a[c],c,i));return o}},arrayReduce={left:createMethod$2(!1),right:createMethod$2(!0)},$reduce=arrayReduce.left,STRICT_METHOD$2=arrayMethodIsStrict("reduce"),CHROME_BUG=!engineIsNode&&engineV8Version>79&&engineV8Version<83;_export({target:"Array",proto:!0,forced:!STRICT_METHOD$2||CHROME_BUG},{reduce:function(e){var t=arguments.length;return $reduce(this,e,t,t>1?arguments[1]:void 0)}});var ssdp={app:{test:"https://ecsb-uat.crcloud.com:8443/ecsb/gw/app//",production:"https://ssdp.crc.com.cn/ssdp/app//"},cls:{test:"https://ecsb-uat.crcloud.com:8443/ecsb/gw/cls/rf/",production:"https://ssdp.crc.com.cn/ssdp/cls/rf/",runwork:{sit:{App_Sub_ID:"0000000303DM",App_Token:"6debaf0da23340daaac8659144ebed7a",Partner_ID:"00000000",Sys_ID:"00000003"},uat:{App_Sub_ID:"0000000309OK",App_Token:"5643f1d9d86c43c9ae72069c243dbf86",Partner_ID:"00000000",Sys_ID:"00000003"},pre:{App_Sub_ID:"0000000311VF",App_Token:"9472173cc8d5463fb6311db361c8a72f",Partner_ID:"00000000",Sys_ID:"00000003"},production:{App_Sub_ID:"0000000401RH",App_Token:"2bbc84f3bde54df488b4b0133989956c",Partner_ID:"00000000",Sys_ID:"00000004"}}},dtgw:{test:"https://dtgw-uat.crcloud.com/dtgw/api/",production:"https://dtgw-ps.crcloud.com/dtgw/api/",runwork:{sit:{"s-crc-app-id":"10012","s-crc-token":"0ed1fe39709f4c9f9e7fe8071fb8f4f1","s-crc-tpl-code":"EMAP_FILE_DOWN"},uat:{"s-crc-app-id":"10013","s-crc-token":"616451486c7c4b46b21c24d35f1f6f9b","s-crc-tpl-code":"EMAP_FILE_DOWN"},production:{"s-crc-app-id":"10012","s-crc-token":"e893a9d21a2a4fe5a50833de3b99f8e1","s-crc-tpl-code":"EMAP_FILE_DOWN"}}},api:{sit:{hrInfo:{api:"crc.rgz.lark0sit.getUserInfoJWT",version:"1.0"},avatar:{api:"crc.rgz.lark0sit.getEmpImage",version:"1.0"},avatarAuth:{api:"crc.rgz.lark0sit.getEmpImageWithNoLadpAuth",version:"1.0"},gettoken:{api:"crc.rgz.lark0sit.lark.gettoken",version:"1.0"},ticket:{api:"crc.rgz.lark0sit.getJsapiTicketByAppid",version:"1.0"},run3track:{api:"crc.rgz.run3uat.run3_track",version:"1.0"},users:{api:"crc.rgz.lark0sit.feishu.users",version:"1.0"}},uat:{hrInfo:{api:"crc.rgz.run3uat.getUserInfoJWT",version:"1.0"},avatar:{api:"crc.rgz.run3uat.getEmpImage",version:"1.0"},avatarAuth:{api:"crc.rgz.run3uat.getEmpImageWithNoLadpAuth",version:"1.0"},gettoken:{api:"crc.rgz.run3uat.lark.gettoken",version:"1.0"},ticket:{api:"crc.rgz.run3uat.getJsapiTicketByAppid",version:"1.0"},run3track:{api:"crc.rgz.run3uat.run3_track",version:"1.0"},users:{api:"crc.rgz.lark0sit.feishu.users",version:"1.0"}},pre:{hrInfo:{api:"crc.rgz.run3uat.getUserInfoJWT",version:"1.0"},avatar:{api:"crc.rgz.run3uat.getEmpImage",version:"1.0"},avatarAuth:{api:"crc.rgz.run3uat.getEmpImageWithNoLadpAuth",version:"1.0"},gettoken:{api:"crc.rgz.run3uat.lark.gettoken",version:"1.0"},ticket:{api:"crc.rgz.run3pre.getJsapiTicketByAppid",version:"1.0"}},test:{gettoken:{api:"crc.rgz.lark0sit.lark.gettoken",version:"1.0"},ticket:{api:"crc.rgz.lark0sit.getJsapiTicketByAppid",version:"1.0"}},production:{ssdpPostToken:{api:"crc.ssdp.public.apptoken",version:"1.0"},gettoken:{api:"crc.rgz.app.lark.gettoken",version:"1.0"},ticket:{api:"crc.rgz.app.getClsJsapiTicket",version:"1.0"},hrInfo:{api:"crc.rgz.app.getUserInfoJWT",version:"1.0"},avatar:{api:"crc.rgz.app.getEmpImage",version:"1.0"},avatarAuth:{api:"crc.rgz.app.getEmpImageWithNoLadpAuth",version:"1.0"},run3track:{api:"crc.rgz.app.run3_track",version:"1.0"},users:{api:"crc.rgz.app.feishu.users",version:"1.0"}}}},h5DB=[{name:"ssdpPostToken",store:{keyPath:"id",autoIncrement:!1},index:["token","expires"]},{name:"sys",store:{keyPath:"id",autoIncrement:!1},index:["appVersion","deviceID","system","platform"]},{name:"user",store:{keyPath:"id",autoIncrement:!1},index:["App_Sub_ID","App_Token","App_key","Partner_ID","external_token","open_id"]},{name:"hrInfo",store:{keyPath:"id",autoIncrement:!1},index:["jobCodeDescr","fullPath","businessUnit","gender","avatarUrl","fullDescPath","deptId","employeeId","birthDate","nameFormal","join_time","nameAc","deptDesc","userType","email","seniorityPayDtMap","businessUnitDesc","expires","mobilePhoneNumber","businessUnitDescShort"]},{name:"avatar",store:{keyPath:"id",autoIncrement:!1},index:["imageUrl","expires"]}],cacheKeys={localStorage:{feishu:{tenantAccessToken:"FS_TenantAccessToken",ticket:"FS_Ticket"}},indexeddb:{name:"runworkH5",version:3,store:{sys:"sys",user:"user",hrInfo:"hrInfo",avatar:"avatar",postToken:"ssdpPostToken",network:"network",track:"track"}}},feishu={redirectUrl:{production:"https://runworkauth.crc.com.cn/runworksso/sso/auth",sit:"https://runwork-h5-sit.test.crdigital.com.cn/runworksso/sso/auth",uat:"https://runwork-h5-uat.test.crdigital.com.cn/runworksso/sso/auth"}},apis={getSSOUserInfo:{production:"https://runworkauth.crc.com.cn/runworksso/sso/getSSOUserInfo",sit:"https://runwork-h5-sit.test.crdigital.com.cn/runworksso/sso/getSSOUserInfo",uat:"https://runwork-h5-uat.test.crdigital.com.cn/runworksso/sso/getSSOUserInfo"},createDebugJwttoken:{production:"https://runworkauth.crc.com.cn/runworksso/sso/createDebugJwttoken",sit:"https://runwork-h5-sit.test.crdigital.com.cn/runworksso/sso/createDebugJwttoken",uat:"https://runwork-h5-uat.test.crdigital.com.cn/runworksso/sso/createDebugJwttoken"}},constant={ssdp:ssdp,h5DB:h5DB,cacheKeys:cacheKeys,feishu:feishu,apis:apis};function getConstant(e){return e.split(".").reduce((function(e,t){return e[t]}),constant)}var inheritIfRequired=function(e,t,r){var n,o;return objectSetPrototypeOf&&isCallable(n=t.constructor)&&n!==r&&isObject(o=n.prototype)&&o!==r.prototype&&objectSetPrototypeOf(e,o),e},RegExpPrototype$1=RegExp.prototype,regexpGetFlags=function(e){var t=e.flags;return void 0!==t||"flags"in RegExpPrototype$1||hasOwnProperty_1(e,"flags")||!objectIsPrototypeOf(RegExpPrototype$1,e)?t:functionCall(regexpFlags,e)},defineProperty$3=objectDefineProperty.f,proxyAccessor=function(e,t,r){r in e||defineProperty$3(e,r,{configurable:!0,get:function(){return t[r]},set:function(e){t[r]=e}})},getOwnPropertyNames=objectGetOwnPropertyNames.f,enforceInternalState=internalState.enforce,MATCH$1=wellKnownSymbol("match"),NativeRegExp=global_1.RegExp,RegExpPrototype$2=NativeRegExp.prototype,SyntaxError=global_1.SyntaxError,exec$2=functionUncurryThis(RegExpPrototype$2.exec),charAt$4=functionUncurryThis("".charAt),replace$2=functionUncurryThis("".replace),stringIndexOf$1=functionUncurryThis("".indexOf),stringSlice$6=functionUncurryThis("".slice),IS_NCG=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,re1=/a/g,re2=/a/g,CORRECT_NEW=new NativeRegExp(re1)!==re1,MISSED_STICKY$1=regexpStickyHelpers.MISSED_STICKY,UNSUPPORTED_Y$3=regexpStickyHelpers.UNSUPPORTED_Y,BASE_FORCED=descriptors&&(!CORRECT_NEW||MISSED_STICKY$1||regexpUnsupportedDotAll||regexpUnsupportedNcg||fails((function(){return re2[MATCH$1]=!1,NativeRegExp(re1)!=re1||NativeRegExp(re2)==re2||"/a/i"!=NativeRegExp(re1,"i")}))),handleDotAll=function(e){for(var t,r=e.length,n=0,o="",i=!1;n<=r;n++)"\\"!==(t=charAt$4(e,n))?i||"."!==t?("["===t?i=!0:"]"===t&&(i=!1),o+=t):o+="[\\s\\S]":o+=t+charAt$4(e,++n);return o},handleNCG=function(e){for(var t,r=e.length,n=0,o="",i=[],a={},s=!1,c=!1,u=0,l="";n<=r;n++){if("\\"===(t=charAt$4(e,n)))t+=charAt$4(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:exec$2(IS_NCG,stringSlice$6(e,n+1))&&(n+=2,c=!0),o+=t,u++;continue;case">"===t&&c:if(""===l||hasOwnProperty_1(a,l))throw new SyntaxError("Invalid capture group name");a[l]=!0,i[i.length]=[l,u],c=!1,l="";continue}c?l+=t:o+=t}return[o,i]};if(isForced_1("RegExp",BASE_FORCED)){for(var RegExpWrapper=function(e,t){var r,n,o,i,a,s,c=objectIsPrototypeOf(RegExpPrototype$2,this),u=isRegexp(e),l=void 0===t,p=[],f=e;if(!c&&u&&l&&e.constructor===RegExpWrapper)return e;if((u||objectIsPrototypeOf(RegExpPrototype$2,e))&&(e=e.source,l&&(t=regexpGetFlags(f))),e=void 0===e?"":toString_1(e),t=void 0===t?"":toString_1(t),f=e,regexpUnsupportedDotAll&&"dotAll"in re1&&(n=!!t&&stringIndexOf$1(t,"s")>-1)&&(t=replace$2(t,/s/g,"")),r=t,MISSED_STICKY$1&&"sticky"in re1&&(o=!!t&&stringIndexOf$1(t,"y")>-1)&&UNSUPPORTED_Y$3&&(t=replace$2(t,/y/g,"")),regexpUnsupportedNcg&&(e=(i=handleNCG(e))[0],p=i[1]),a=inheritIfRequired(NativeRegExp(e,t),c?this:RegExpPrototype$2,RegExpWrapper),(n||o||p.length)&&(s=enforceInternalState(a),n&&(s.dotAll=!0,s.raw=RegExpWrapper(handleDotAll(e),r)),o&&(s.sticky=!0),p.length&&(s.groups=p)),e!==f)try{createNonEnumerableProperty(a,"source",""===f?"(?:)":f)}catch(e){}return a},keys$1=getOwnPropertyNames(NativeRegExp),index=0;keys$1.length>index;)proxyAccessor(RegExpWrapper,NativeRegExp,keys$1[index++]);RegExpPrototype$2.constructor=RegExpWrapper,RegExpWrapper.prototype=RegExpPrototype$2,redefine(global_1,"RegExp",RegExpWrapper)}setSpecies("RegExp");var PROPER_FUNCTION_NAME=functionName.PROPER,TO_STRING$1="toString",RegExpPrototype$3=RegExp.prototype,n$ToString=RegExpPrototype$3[TO_STRING$1],NOT_GENERIC=fails((function(){return"/a/b"!=n$ToString.call({source:"a",flags:"b"})})),INCORRECT_NAME=PROPER_FUNCTION_NAME&&n$ToString.name!=TO_STRING$1;function getTimeStamp(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"yyyy-MM-dd hh:mm:ss:S",r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n={"M+":e.getMonth()+1,"d+":e.getDate(),"h+":e.getHours(),"m+":e.getMinutes(),"s+":e.getSeconds(),"q+":Math.floor((e.getMonth()+3)/3),S:e.getMilliseconds()};for(var o in/(y+)/.test(t)&&(t=t.replace(RegExp.$1,(e.getFullYear()+"").substr(4-RegExp.$1.length))),n)new RegExp("("+o+")").test(t)&&(t=t.replace(RegExp.$1,1==RegExp.$1.length?n[o]:("00"+n[o]).substr((""+n[o]).length)));var i=-e.getTimezoneOffset()/60,a=i>=0?"+":"-";i=Math.abs(i);var s="".concat(a).concat(i<10?"0".concat(i):i,"00");return"".concat(t).concat(r?s:"")}(NOT_GENERIC||INCORRECT_NAME)&&redefine(RegExp.prototype,TO_STRING$1,(function(){var e=anObject(this);return"/"+toString_1(e.source)+"/"+toString_1(regexpGetFlags(e))}),{unsafe:!0});var base64encodechars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",base64decodechars=new Array(-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,-1,-1,-1,-1,-1),base64encode=function(){var e,t,r,n,o,i,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";for(r=a.length,t=0,e="";t>2),e+=base64encodechars.charAt((3&n)<<4),e+="==";break}if(o=a.charCodeAt(t++),t==r){e+=base64encodechars.charAt(n>>2),e+=base64encodechars.charAt((3&n)<<4|(240&o)>>4),e+=base64encodechars.charAt((15&o)<<2),e+="=";break}i=a.charCodeAt(t++),e+=base64encodechars.charAt(n>>2),e+=base64encodechars.charAt((3&n)<<4|(240&o)>>4),e+=base64encodechars.charAt((15&o)<<2|(192&i)>>6),e+=base64encodechars.charAt(63&i)}return e},base64decode=function(){var e,t,r,n,o,i,a,s=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";for(i=s.length,o=0,a="";o>4);do{if(61==(r=255&s.charCodeAt(o++)))return a;r=base64decodechars[r]}while(o>2);do{if(61==(n=255&s.charCodeAt(o++)))return a;n=base64decodechars[n]}while(o0&&void 0!==arguments[0]?arguments[0]:"";for(e="",r=o.length,t=0;t=1&&n<=127?e+=o.charAt(t):n>2047?(e+=String.fromCharCode(224|n>>12&15),e+=String.fromCharCode(128|n>>6&63),e+=String.fromCharCode(128|n>>0&63)):(e+=String.fromCharCode(192|n>>6&31),e+=String.fromCharCode(128|n>>0&63));return e},utf8to16=function(){var e,t,r,n,o,i,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";for(e="",r=a.length,t=0;t>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:e+=a.charAt(t-1);break;case 12:case 13:o=a.charCodeAt(t++),e+=String.fromCharCode((31&n)<<6|63&o);break;case 14:o=a.charCodeAt(t++),i=a.charCodeAt(t++),e+=String.fromCharCode((15&n)<<12|(63&o)<<6|(63&i)<<0)}return e},base64={encode:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return base64encode(utf16to8(e))},decode:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return utf8to16(base64decode(e))}};function jssdk(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return console.log("jssdk",e),new Promise((function(r,n){window.h5sdk.ready((function(){var o=e.split(".").reduce((function(e,t){return e[t]||{}}),window.h5sdk);"function"!=typeof o&&n(),o.call(window.h5sdk,Object.assign({onSuccess:function(e){r(e)},onFail:function(t){errorHandle(e),console.error("调用原生方法失败:"+e,t),n(t)}},t))})).catch((function(e){return console.error("h5sdk.ready error",e),Promise.reject(e)}))}))}function errorHandle(e){switch(e){case"biz.user.getUserInfoEx":navigator.userAgent.match(/android/i)?alert("认证信息失效,请重新登录"):jssdk("device.notification.confirm",{title:"温馨提示",message:"认证信息失效,请重新登录",buttonLabels:["好的"]}).then((function(){jssdk("biz.navigation.close")}))}}fixRegexpWellKnownSymbolLogic("match",(function(e,t,r){return[function(t){var r=requireObjectCoercible(this),n=null==t?void 0:getMethod(t,e);return n?functionCall(n,t,r):new RegExp(t)[e](toString_1(r))},function(e){var n=anObject(this),o=toString_1(e),i=r(t,n,o);if(i.done)return i.value;if(!n.global)return regexpExecAbstract(n,o);var a=n.unicode;n.lastIndex=0;for(var s,c=[],u=0;null!==(s=regexpExecAbstract(n,o));){var l=toString_1(s[0]);c[u]=l,""===l&&(n.lastIndex=advanceStringIndex(o,toLength(n.lastIndex),a)),u++}return 0===u?null:c}]}));var isIphonex=function(){return/iphone/gi.test(window.navigator.userAgent)};function logger(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info";"[object Array]"!==Object.prototype.toString.call(e)&&(e=[e]),(t=console)[r].apply(t,["runwork-help2.0"].concat(_toConsumableArray(e)))}var MSIE=/MSIE .\./.test(engineUserAgent),Function$2=global_1.Function,wrap=function(e){return MSIE?function(t,r){var n=validateArgumentsLength(arguments.length,1)>2,o=isCallable(t)?t:Function$2(t),i=n?arraySlice(arguments,2):void 0;return e(n?function(){functionApply(o,this,i)}:o,r)}:e},schedulersFix={setTimeout:wrap(global_1.setTimeout),setInterval:wrap(global_1.setInterval)},setInterval$1=schedulersFix.setInterval;_export({global:!0,bind:!0,forced:global_1.setInterval!==setInterval$1},{setInterval:setInterval$1});var setTimeout$1=schedulersFix.setTimeout;function sleep(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e3;return new Promise((function(t){setTimeout((function(){t()}),e)}))}_export({global:!0,bind:!0,forced:global_1.setTimeout!==setTimeout$1},{setTimeout:setTimeout$1});var whitespaces="\t\n\v\f\r                 \u2028\u2029\ufeff",replace$3=functionUncurryThis("".replace),whitespace="["+whitespaces+"]",ltrim=RegExp("^"+whitespace+whitespace+"*"),rtrim=RegExp(whitespace+whitespace+"*$"),createMethod$3=function(e){return function(t){var r=toString_1(requireObjectCoercible(t));return 1&e&&(r=replace$3(r,ltrim,"")),2&e&&(r=replace$3(r,rtrim,"")),r}},stringTrim={start:createMethod$3(1),end:createMethod$3(2),trim:createMethod$3(3)},trim$1=stringTrim.trim,charAt$5=functionUncurryThis("".charAt),n$ParseFloat=global_1.parseFloat,Symbol$2=global_1.Symbol,ITERATOR$3=Symbol$2&&Symbol$2.iterator,FORCED$1=1/n$ParseFloat(whitespaces+"-0")!=-1/0||ITERATOR$3&&!fails((function(){n$ParseFloat(Object(ITERATOR$3))})),numberParseFloat=FORCED$1?function(e){var t=trim$1(toString_1(e)),r=n$ParseFloat(t);return 0===r&&"-"==charAt$5(t,0)?-0:r}:n$ParseFloat;function isBroswer(){var e={},t=navigator.userAgent,r=t.indexOf("Opera")>-1;if(r){if("Opera"==navigator.appName)e.version=parseFloat(navigator.appVersion);else new RegExp("Opera (\\d+.\\d+)").test(t),e.version=parseFloat(RegExp.$1);e.name="opera"}var n=t.indexOf("Chrome")>-1;n&&(new RegExp("Chrome/(\\d+\\.\\d+(?:\\.\\d+\\.\\d+))?").test(t),e.version=parseFloat(RegExp.$1),e.name="chrome");var o=(t.indexOf("KHTML")>-1||t.indexOf("Konqueror")>-1||t.indexOf("AppleWebKit")>-1)&&!n;if(o){var i=t.indexOf("AppleWebKit")>-1,a=t.indexOf("Konqueror")>-1;if(i)new RegExp("Version/(\\d+(?:\\.\\d*)?)").test(t),e.version=parseFloat(RegExp.$1),e.safari=!0,e.name="safari";else if(a){new RegExp("Konqueror/(\\d+(?:\\.\\d+(?\\.\\d)?)?)").test(t),e.version=parseFloat(RegExp.$1),e.name="konqueror"}}t.indexOf("compatible")>-1&&t.indexOf("MSIE")>-1&&!r&&(new RegExp("MSIE (\\d+\\.\\d+);").test(t),e.version=parseFloat(RegExp.$1),e.name="msie");t.indexOf("Gecko")>-1&&!n&&!o&&(new RegExp("rv:(\\d+\\.\\d+(?:\\.\\d+)?)").test(t),e.version=parseFloat(RegExp.$1),e.name="mozilla");return e}_export({global:!0,forced:parseFloat!=numberParseFloat},{parseFloat:numberParseFloat});var floor$2=Math.floor,mergeSort=function(e,t){var r=e.length,n=floor$2(r/2);return r<8?insertionSort(e,t):merge$1(e,mergeSort(arraySliceSimple(e,0,n),t),mergeSort(arraySliceSimple(e,n),t),t)},insertionSort=function(e,t){for(var r,n,o=e.length,i=1;i0;)e[n]=e[--n];n!==i++&&(e[n]=r)}return e},merge$1=function(e,t,r,n){for(var o=t.length,i=r.length,a=0,s=0;a3)){if(engineIsIeOrEdge)return!0;if(engineWebkitVersion)return engineWebkitVersion<603;var e,t,r,n,o="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)test$1.push({k:t+n,v:r})}for(test$1.sort((function(e,t){return t.v-e.v})),n=0;ntoString_1(r)?1:-1}};_export({target:"Array",proto:!0,forced:FORCED$2},{sort:function(e){void 0!==e&&aCallable(e);var t=toObject(this);if(STABLE_SORT)return void 0===e?un$Sort(t):un$Sort(t,e);var r,n,o=[],i=lengthOfArrayLike(t);for(n=0;nm;m++)if((s||m in g)&&(d=y(f=g[m],m,h),e))if(t)S[m]=d;else if(d)switch(e){case 3:return!0;case 5:return f;case 6:return m;case 2:push$4(S,f)}else switch(e){case 4:return!1;case 7:push$4(S,f)}return i?-1:n||o?o:S}},arrayIteration={forEach:createMethod$4(0),map:createMethod$4(1),filter:createMethod$4(2),some:createMethod$4(3),every:createMethod$4(4),find:createMethod$4(5),findIndex:createMethod$4(6),filterReject:createMethod$4(7)},$map=arrayIteration.map,HAS_SPECIES_SUPPORT=arrayMethodHasSpeciesSupport("map");_export({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT},{map:function(e){return $map(this,e,arguments.length>1?arguments[1]:void 0)}});var md5=createCommonjsModule((function(e){!function(t){function r(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function n(e,t,n,o,i,a){return r((s=r(r(t,e),r(o,a)))<<(c=i)|s>>>32-c,n);var s,c}function o(e,t,r,o,i,a,s){return n(t&r|~t&o,e,t,i,a,s)}function i(e,t,r,o,i,a,s){return n(t&o|r&~o,e,t,i,a,s)}function a(e,t,r,o,i,a,s){return n(t^r^o,e,t,i,a,s)}function s(e,t,r,o,i,a,s){return n(r^(t|~o),e,t,i,a,s)}function c(e,t){var n,c,u,l,p;e[t>>5]|=128<>>9<<4)]=t;var f=1732584193,d=-271733879,h=-1732584194,g=271733878;for(n=0;n>5]>>>t%32&255);return r}function l(e){var t,r=[];for(r[(e.length>>2)-1]=void 0,t=0;t>5]|=(255&e.charCodeAt(t/8))<>>4&15)+"0123456789abcdef".charAt(15&t);return n}function f(e){return unescape(encodeURIComponent(e))}function d(e){return function(e){return u(c(l(e),8*e.length))}(f(e))}function h(e,t){return function(e,t){var r,n,o=l(e),i=[],a=[];for(i[15]=a[15]=void 0,o.length>16&&(o=c(o,8*e.length)),r=0;r<16;r+=1)i[r]=909522486^o[r],a[r]=1549556828^o[r];return n=c(i.concat(l(t)),512+8*t.length),u(c(a.concat(n),640))}(f(e),f(t))}function g(e,t,r){return t?r?h(t,e):p(h(t,e)):r?d(e):p(d(e))}e.exports?e.exports=g:t.md5=g}(commonjsGlobal)}));function generateSysSign(e){var t=e.App_Sub_ID,r=e.App_Token,n=e.User_Token,o=void 0===n?"":n,i=e.Api_ID,a=e.Api_Version,s=e.Time_Stamp,c=e.Partner_ID,u=e.REQUEST_DATA,l=e.App_ID,p=e.App_Version,f=e.Divice_ID,d=e.Divice_Version,h=e.OS_Version,g=e.App_key,y=[["App_Sub_ID",t],["App_Token",r],["User_Token",o],["Api_ID",i],["Api_Version",a],["Time_Stamp",s],["Partner_ID",c],["REQUEST_DATA","string"==typeof u?u:JSON.stringify(u)],["App_ID",l],["App_Version",p],["Divice_ID",f],["Divice_Version",d],["OS_Version",h]];return y.sort(),console.log("SSDP签名参数","".concat(y.map((function(e){return e.join("=")})).join("&"),"&").concat(g)),md5("".concat(y.map((function(e){return e.join("=")})).join("&"),"&").concat(g)).toUpperCase()}var SSDPConfigMode=_createClass((function e(t){var r=t.App_Sub_ID,n=t.App_Token,o=t.App_ID,i=t.App_key,a=t.App_Version,s=t.Divice_ID,c=t.Divice_Version,u=t.OS_Version,l=t.Partner_ID,p=t.User_Token;_classCallCheck(this,e),this.App_Sub_ID=r,this.App_Token=n,this.App_ID=o,this.App_key=i,this.App_Version=a,this.Divice_ID=s,this.Divice_Version=c,this.OS_Version=u,this.Partner_ID=l,this.User_Token=p||""})),SSDPApp=function(){function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"test",n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];_classCallCheck(this,e),this.CacheDBKey=getConstant("cacheKeys.indexeddb.store.postToken"),this.isLogin=!1,this.config=new SSDPConfigMode(t),this.isLogin=n,this.url=getConstant("ssdp.app.".concat(r)),this.env=r,this.CacheStoreKey="PostToken_".concat(this.env)}return _createClass(e,[{key:"init",value:function(){return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAccessToken();case 2:this.postToken=e.sent;case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getPostToken",value:function(){return this.postToken}},{key:"request",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function r(){var n,o,i,a,s,c,u,l,p,f,d,h,g,y,v,m,b,S,E,_,T,I;return regeneratorRuntime.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return n=e.api,o=void 0===n?"":n,i=e.version,a=void 0===i?"1.0":i,s=e.data,c=void 0===s?"":s,u=e.params,l=void 0===u?{}:u,p=e.headers,f=void 0===p?{}:p,e.isFormatData,d=e.type,h=void 0===d?"rs":d,g=e.method,y=void 0===g?"POST":g,v=e.uri,m=this.getApiAttrs(o,a),r.next=4,request(Object.assign(Object.assign({},e),{url:"".concat(this.url.replace("",h)).concat(v||"","?ssdp=").concat(this.generateUrlParam("post"===y.toLowerCase()&&"rs"==h?{Api_ID:o,Api_Version:a,App_Sub_ID:this.config.App_Sub_ID,Time_Stamp:m.Time_Stamp}:Object.assign(Object.assign({},m),{Sign:generateSysSign(Object.assign(Object.assign({},m),{REQUEST_DATA:c}))}))),params:l,method:y,headers:Object.assign({},f),data:"rs"==h?this.generateCommonParam(o,a,c):c}));case 4:b=r.sent,S=void 0,E=void 0;try{_=b.data.RESPONSE,T=_.RETURN_CODE,I=_.RETURN_DESC,S=T,E=I}catch(e){logger(["非标准响应报文格式",b.data],"warn")}if(void 0!==S){r.next=10;break}return r.abrupt("return",b);case 10:if(!((["E0MI0006","E0MI0003"].includes(S)||"string"==typeof E&&~E.toLocaleLowerCase().indexOf("app_token"))&&t<=3)){r.next=15;break}return r.next=13,this.getAccessTokenByPost();case 13:return this.postToken=r.sent,r.abrupt("return",this.request({api:o,version:a,data:c,headers:f},++t));case 15:return r.abrupt("return",b);case 16:case"end":return r.stop()}}),r,this)})))}},{key:"generateCommonParam",value:function(e,t,r,n){var o=this.getApiAttrs(e,t,n);if(o=Object.assign(Object.assign({},o),{Sign:generateSysSign(Object.assign(Object.assign({},o),{REQUEST_DATA:r,App_key:this.config.App_key}))}),this.isLogin&&"crc.ssdp.public.apptoken"!==o.Api_ID){var i=r.BUS_DATA;(i=JSON.parse(base64.decode(i))).appToken=o.App_Token,r={BUS_DATA:base64.encode(JSON.stringify(i))}}return{REQUEST:{REQUEST_DATA:r,API_ATTRS:o}}}},{key:"getApiAttrs",value:function(e,t,r){return Object.assign(Object.assign({},this.config),{App_key:void 0,App_Token:r||this.postToken,Time_Stamp:getTimeStamp(),Api_ID:e,Api_Version:t})}},{key:"generateUrlParam",value:function(e){var t=[];for(var r in e){var n=e[r];n&&t.push("".concat(r,"=").concat(n))}return base64.encode(t.join("&"))}},{key:"getAccessToken",value:function(){return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAccessTokenByCache();case 2:if(!(t=e.sent)){e.next=5;break}return e.abrupt("return",Promise.resolve(t));case 5:return e.abrupt("return",this.getAccessTokenByPost());case 6:case"end":return e.stop()}}),e,this)})))}},{key:"getAccessTokenByPost",value:function(){return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,r,n,o,i,a,s;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,request({url:this.generateUrlByAccessToken(),data:this.generateCommonParam("crc.ssdp.public.apptoken","1.0",{App_Type:"",App_key:this.config.App_key,Remarks:"",Scope:""},this.config.App_Token)});case 2:if(t=e.sent,r=t.data,n=r.RESPONSE,o=n.RETURN_DATA,"S"===(i=n.RETURN_CODE).charAt(0)||"MS000A000"===i){e.next=7;break}return e.abrupt("return",Promise.reject(r.RESPONSE));case 7:if(a=o.App_Token,s=o.Token_Expires,!this.isLogin){e.next=10;break}return e.abrupt("return",a);case 10:return this.setPostTokenCache({token:a,expires:(new Date).getTime()+1e3*s}),e.abrupt("return",a);case 12:case"end":return e.stop()}}),e,this)})))}},{key:"getAccessTokenByCache",value:function(){if(this.isLogin)return Promise.resolve();var e=localStorage.getItem(this.CacheDBKey),t="string"==typeof e?JSON.parse(e):void 0;return e&&this.checkPostTokenExpires(t.expires)?t.value:void 0}},{key:"setPostTokenCache",value:function(e){var t=e.expires,r=e.token;localStorage.setItem(this.CacheDBKey,JSON.stringify({expires:t,value:r}))}},{key:"checkPostTokenExpires",value:function(e){return e-(new Date).getTime()>3e5}},{key:"generateUrlByAccessToken",value:function(){var e=getConstant("ssdp.api.production.ssdpPostToken"),t=e.api,r=e.version;return"".concat(this.url.replace("","rs"),"?ssdp=").concat(this.generateUrlParam({Api_ID:t,Api_Version:r,App_Sub_ID:this.config.App_Sub_ID}))}},{key:"setUserToken",value:function(e){this.config.User_Token=e}}]),e}();SSDPApp.isIndexedDB="indexedDB"in window;var FAILS_ON_PRIMITIVES=fails((function(){objectKeys(1)}));_export({target:"Object",stat:!0,forced:FAILS_ON_PRIMITIVES},{keys:function(e){return objectKeys(toObject(e))}});var Function$3=global_1.Function,concat$3=functionUncurryThis([].concat),join=functionUncurryThis([].join),factories={},construct$1=function(e,t,r){if(!hasOwnProperty_1(factories,t)){for(var n=[],o=0;o1?arguments[1]:void 0)}});var HAS_SPECIES_SUPPORT$1=arrayMethodHasSpeciesSupport("slice"),SPECIES$6=wellKnownSymbol("species"),Array$3=global_1.Array,max$3=Math.max;_export({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$1},{slice:function(e,t){var r,n,o,i=toIndexedObject(this),a=lengthOfArrayLike(i),s=toAbsoluteIndex(e,a),c=toAbsoluteIndex(void 0===t?a:t,a);if(isArray(i)&&(r=i.constructor,(isConstructor(r)&&(r===Array$3||isArray(r.prototype))||isObject(r)&&null===(r=r[SPECIES$6]))&&(r=void 0),r===Array$3||void 0===r))return arraySlice(i,s,c);for(n=new(void 0===r?Array$3:r)(max$3(c-s,0)),o=0;s=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values"),values=iterators.Arguments=iterators.Array;if(addToUnscopables("keys"),addToUnscopables("values"),addToUnscopables("entries"),descriptors&&"values"!==values.name)try{defineProperty$5(values,"name",{value:"values"})}catch(e){}var charAt$6=stringMultibyte.charAt,STRING_ITERATOR="String Iterator",setInternalState$2=internalState.set,getInternalState$2=internalState.getterFor(STRING_ITERATOR);defineIterator(String,"String",(function(e){setInternalState$2(this,{type:STRING_ITERATOR,string:toString_1(e),index:0})}),(function(){var e,t=getInternalState$2(this),r=t.string,n=t.index;return n>=r.length?{value:void 0,done:!0}:(e=charAt$6(r,n),t.index+=e.length,{value:e,done:!1})}));var domIterables={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},classList=documentCreateElement("span").classList,DOMTokenListPrototype=classList&&classList.constructor&&classList.constructor.prototype,domTokenListPrototype=DOMTokenListPrototype===Object.prototype?void 0:DOMTokenListPrototype,ITERATOR$6=wellKnownSymbol("iterator"),TO_STRING_TAG$3=wellKnownSymbol("toStringTag"),ArrayValues=es_array_iterator.values,handlePrototype=function(e,t){if(e){if(e[ITERATOR$6]!==ArrayValues)try{createNonEnumerableProperty(e,ITERATOR$6,ArrayValues)}catch(t){e[ITERATOR$6]=ArrayValues}if(e[TO_STRING_TAG$3]||createNonEnumerableProperty(e,TO_STRING_TAG$3,t),domIterables[t])for(var r in es_array_iterator)if(e[r]!==es_array_iterator[r])try{createNonEnumerableProperty(e,r,es_array_iterator[r])}catch(t){e[r]=es_array_iterator[r]}}};for(var COLLECTION_NAME in domIterables)handlePrototype(global_1[COLLECTION_NAME]&&global_1[COLLECTION_NAME].prototype,COLLECTION_NAME);handlePrototype(domTokenListPrototype,"DOMTokenList");var $findIndex=arrayIteration.findIndex,FIND_INDEX="findIndex",SKIPS_HOLES=!0;FIND_INDEX in[]&&Array(1)[FIND_INDEX]((function(){SKIPS_HOLES=!1})),_export({target:"Array",proto:!0,forced:SKIPS_HOLES},{findIndex:function(e){return $findIndex(this,e,arguments.length>1?arguments[1]:void 0)}}),addToUnscopables(FIND_INDEX);var $filter=arrayIteration.filter,HAS_SPECIES_SUPPORT$2=arrayMethodHasSpeciesSupport("filter");_export({target:"Array",proto:!0,forced:!HAS_SPECIES_SUPPORT$2},{filter:function(e){return $filter(this,e,arguments.length>1?arguments[1]:void 0)}});var PROPER_FUNCTION_NAME$2=functionName.PROPER,non="​…᠎",stringTrimForced=function(e){return fails((function(){return!!whitespaces[e]()||non[e]()!==non||PROPER_FUNCTION_NAME$2&&whitespaces[e].name!==e}))},$trim=stringTrim.trim;_export({target:"String",proto:!0,forced:stringTrimForced("trim")},{trim:function(){return $trim(this)}});var RunworkH5Mode=_createClass((function e(t){var r=t.isLocal,n=void 0!==r&&r,o=t.devUser,i=t.env,a=void 0===i?"sit":i,s=t.jsApiList,c=void 0===s?[]:s,u=t.log,l=void 0!==u&&u,p=t.appId,f=t.appSecret,d=t.isLogin,h=void 0!==d&&d,g=t.isHrInfo,y=void 0!==g&&g,v=t.isAvatar,m=void 0!==v&&v,b=t.isPrivate,S=void 0!==b&&b,E=t.isHrInfoCache,_=void 0===E||E,T=t.isVue3,I=void 0!==T&&T,O=t.larkexpires,R=void 0!==O&&O,A=t.isJssdkAuth,P=void 0===A||A,C=t.SSDPConfig,w=void 0===C?{}:C,x=t.isCross,k=void 0!==x&&x;_classCallCheck(this,e),this.env="sit",this.jsApiList=[],this.domain=["https://runwork-h5.crc.com.cn","https://runwork-h5-uat.crc.com.cn"],this.isLocal=n,this.devUser=o,this.env=a,RunWorkH5.env=this.env,this.log=l,this.appId=p,this.appSecret=f,this.isLogin=h,this.isHrInfo=y,this.isAvatar=m,this.isPrivate=S,this.isHrInfoCache=_,this.isVue3=I,this.larkexpires=R,this.isJssdkAuth=P,this.SSDPConfig=w,this.isCross=k,this.jsApiList=["device.base.getSystemInfo","biz.user.getUserInfoEx","biz.util.openDocument","biz.user.getUserInfo"].concat(c)}));function getTicket(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function o(){var i,a,s,c,u,l,p,f,d,h,g,y,v,m;return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(i="".concat(getConstant("cacheKeys.localStorage.feishu.ticket"),"_").concat(e),!0===r&&(logger("清空【Ticket】缓存"),localStorage.setItem(i,"")),a=localStorage.getItem(i),s=a?JSON.parse(a):void 0,!((c="object"===_typeof(s)?s.expire-(new Date).getTime():-1)>9e4)){o.next=8;break}return logger(["从缓存获取【Ticket】",c,s.value]),o.abrupt("return",s.value);case 8:return logger(["从远端获取【Ticket】",JSON.stringify({appId:e,appSecret:t,refresh:1==n?"true":void 0})]),u=getConstant("ssdp.api.".concat(RunWorkH5.env,".ticket")),l=u.api,u.version,o.next=12,RunWorkH5.ssdpCls.request({method:"POST",api:l,version:"1.0",data:{Biz_Data:base64.encode(JSON.stringify({appId:e,appSecret:t,refresh:1==n?"true":void 0}))}});case 12:if(p=o.sent,f=p.data,d=f.RESPONSE.RETURN_DATA,h=d.data,g=d.code,y=d.msg,0==g){o.next=17;break}return o.abrupt("return",Promise.reject("get ticket error "+y));case 17:return v=h.ticket,m=h.expire_in,localStorage.setItem(i,JSON.stringify({expire:(new Date).getTime()+1e3*m,value:v})),o.abrupt("return",v);case 20:case"end":return o.stop()}}),o)})))}var sameValue=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t};fixRegexpWellKnownSymbolLogic("search",(function(e,t,r){return[function(t){var r=requireObjectCoercible(this),n=null==t?void 0:getMethod(t,e);return n?functionCall(n,t,r):new RegExp(t)[e](toString_1(r))},function(e){var n=anObject(this),o=toString_1(e),i=r(t,n,o);if(i.done)return i.value;var a=n.lastIndex;sameValue(a,0)||(n.lastIndex=0);var s=regexpExecAbstract(n,o);return sameValue(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var sha1=createCommonjsModule((function(module){ +/* + * [js-sha1]{@link https://github.com/emn178/js-sha1} + * + * @version 0.6.0 + * @author Chen, Yi-Cyuan [emn178@gmail.com] + * @copyright Chen, Yi-Cyuan 2014-2017 + * @license MIT + */ +!function(){var root="object"==typeof window?window:{},NODE_JS=!root.JS_SHA1_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS&&(root=commonjsGlobal);var COMMON_JS=!root.JS_SHA1_NO_COMMON_JS&&module.exports,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[-2147483648,8388608,32768,128],SHIFT=[24,16,8,0],OUTPUT_TYPES=["hex","array","digest","arrayBuffer"],blocks=[],createOutputMethod=function(e){return function(t){return new Sha1(!0).update(t)[e]()}},createMethod=function(){var e=createOutputMethod("hex");NODE_JS&&(e=nodeWrap(e)),e.create=function(){return new Sha1},e.update=function(t){return e.create().update(t)};for(var t=0;t>2]|=e[o]<>2]|=r<>2]|=(192|r>>6)<>2]|=(128|63&r)<=57344?(a[n>>2]|=(224|r>>12)<>2]|=(128|r>>6&63)<>2]|=(128|63&r)<>2]|=(240|r>>18)<>2]|=(128|r>>12&63)<>2]|=(128|r>>6&63)<>2]|=(128|63&r)<=64?(this.block=a[16],this.start=n-64,this.hash(),this.hashed=!0):this.start=n}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Sha1.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>2]|=EXTRA[3&t],this.block=e[16],t>=56&&(this.hashed||this.hash(),e[0]=this.block,e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},Sha1.prototype.hash=function(){var e,t,r=this.h0,n=this.h1,o=this.h2,i=this.h3,a=this.h4,s=this.blocks;for(e=16;e<80;++e)t=s[e-3]^s[e-8]^s[e-14]^s[e-16],s[e]=t<<1|t>>>31;for(e=0;e<20;e+=5)r=(t=(n=(t=(o=(t=(i=(t=(a=(t=r<<5|r>>>27)+(n&o|~n&i)+a+1518500249+s[e]<<0)<<5|a>>>27)+(r&(n=n<<30|n>>>2)|~r&o)+i+1518500249+s[e+1]<<0)<<5|i>>>27)+(a&(r=r<<30|r>>>2)|~a&n)+o+1518500249+s[e+2]<<0)<<5|o>>>27)+(i&(a=a<<30|a>>>2)|~i&r)+n+1518500249+s[e+3]<<0)<<5|n>>>27)+(o&(i=i<<30|i>>>2)|~o&a)+r+1518500249+s[e+4]<<0,o=o<<30|o>>>2;for(;e<40;e+=5)r=(t=(n=(t=(o=(t=(i=(t=(a=(t=r<<5|r>>>27)+(n^o^i)+a+1859775393+s[e]<<0)<<5|a>>>27)+(r^(n=n<<30|n>>>2)^o)+i+1859775393+s[e+1]<<0)<<5|i>>>27)+(a^(r=r<<30|r>>>2)^n)+o+1859775393+s[e+2]<<0)<<5|o>>>27)+(i^(a=a<<30|a>>>2)^r)+n+1859775393+s[e+3]<<0)<<5|n>>>27)+(o^(i=i<<30|i>>>2)^a)+r+1859775393+s[e+4]<<0,o=o<<30|o>>>2;for(;e<60;e+=5)r=(t=(n=(t=(o=(t=(i=(t=(a=(t=r<<5|r>>>27)+(n&o|n&i|o&i)+a-1894007588+s[e]<<0)<<5|a>>>27)+(r&(n=n<<30|n>>>2)|r&o|n&o)+i-1894007588+s[e+1]<<0)<<5|i>>>27)+(a&(r=r<<30|r>>>2)|a&n|r&n)+o-1894007588+s[e+2]<<0)<<5|o>>>27)+(i&(a=a<<30|a>>>2)|i&r|a&r)+n-1894007588+s[e+3]<<0)<<5|n>>>27)+(o&(i=i<<30|i>>>2)|o&a|i&a)+r-1894007588+s[e+4]<<0,o=o<<30|o>>>2;for(;e<80;e+=5)r=(t=(n=(t=(o=(t=(i=(t=(a=(t=r<<5|r>>>27)+(n^o^i)+a-899497514+s[e]<<0)<<5|a>>>27)+(r^(n=n<<30|n>>>2)^o)+i-899497514+s[e+1]<<0)<<5|i>>>27)+(a^(r=r<<30|r>>>2)^n)+o-899497514+s[e+2]<<0)<<5|o>>>27)+(i^(a=a<<30|a>>>2)^r)+n-899497514+s[e+3]<<0)<<5|n>>>27)+(o^(i=i<<30|i>>>2)^a)+r-899497514+s[e+4]<<0,o=o<<30|o>>>2;this.h0=this.h0+r<<0,this.h1=this.h1+n<<0,this.h2=this.h2+o<<0,this.h3=this.h3+i<<0,this.h4=this.h4+a<<0},Sha1.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,n=this.h3,o=this.h4;return HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[o>>28&15]+HEX_CHARS[o>>24&15]+HEX_CHARS[o>>20&15]+HEX_CHARS[o>>16&15]+HEX_CHARS[o>>12&15]+HEX_CHARS[o>>8&15]+HEX_CHARS[o>>4&15]+HEX_CHARS[15&o]},Sha1.prototype.toString=Sha1.prototype.hex,Sha1.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,r=this.h2,n=this.h3,o=this.h4;return[e>>24&255,e>>16&255,e>>8&255,255&e,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24&255,r>>16&255,r>>8&255,255&r,n>>24&255,n>>16&255,n>>8&255,255&n,o>>24&255,o>>16&255,o>>8&255,255&o]},Sha1.prototype.array=Sha1.prototype.digest,Sha1.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(20),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),e};var exports=createMethod();COMMON_JS?module.exports=exports:root.sha1=exports}()}));function generateFeishuSignature(e,t,r,n){var o={jsapi_ticket:e,noncestr:t,timestamp:r,url:n||"".concat(location.origin).concat(location.pathname).concat(location.search)},i=Object.keys(o).map((function(e){return"".concat(e,"=").concat(o[e])})).join("&");return logger(["飞书签名参数",i]),sha1(i)}function callFeishuIdentity(e){return new Promise((function(t,r){var n=setTimeout((function(){r("config timeout")}),5e3);window.h5sdk.error((function(e){console.error("config error",e),r(e)})),window.h5sdk.config(e).then((function(){clearTimeout(n),console.info("jssdk identity success",e.jsApiList),t(!0)})).catch((function(e){clearTimeout(n),console.error("identity error",e),r(e)}))}))}function identity(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"",a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0,s=arguments.length>7&&void 0!==arguments[7]&&arguments[7];return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function c(){var u,l,p,f;return regeneratorRuntime.wrap((function(c){for(;;)switch(c.prev=c.next){case 0:return c.prev=0,c.next=3,getTicket(e,t,a>0,o,s);case 3:return u=c.sent,l=(new Date).getTime(),p=base64.encode("".concat(e).concat(l)),f=generateFeishuSignature(u,p,l,i),logger(["callFeishuIdentity"]),c.next=10,callFeishuIdentity({appId:e,timestamp:l,nonceStr:p,signature:f,jsApiList:r});case 10:return"function"==typeof n&&n({success:!0}),c.abrupt("return",!0);case 14:if(c.prev=14,c.t0=c.catch(0),333449!=c.t0.errorCode){c.next=18;break}return c.abrupt("return",Promise.reject("当前用户无此应用权限【".concat(c.t0.errorMessage,"】")));case 18:if(!(a<=3)){c.next=21;break}return logger(["重新调用【config】",a,c.t0],"warn"),c.abrupt("return",identity(e,t,r,n,o,i,++a,a>1));case 21:return"function"==typeof n&&n({success:!1,error:c.t0}),c.abrupt("return",Promise.reject(c.t0));case 23:case"end":return c.stop()}}),c,null,[[0,14]])})))}var trim$2=stringTrim.trim,$parseInt=global_1.parseInt,Symbol$3=global_1.Symbol,ITERATOR$7=Symbol$3&&Symbol$3.iterator,hex=/^[+-]?0x/i,exec$3=functionUncurryThis(hex.exec),FORCED$3=8!==$parseInt(whitespaces+"08")||22!==$parseInt(whitespaces+"0x16")||ITERATOR$7&&!fails((function(){$parseInt(Object(ITERATOR$7))})),numberParseInt=FORCED$3?function(e,t){var r=trim$2(toString_1(e));return $parseInt(r,t>>>0||(exec$3(hex,r)?16:10))}:$parseInt;function browseFile(e){var t=e.fileType,r=void 0===t?"":t,n=e.data,o=void 0===n?{}:n,i=e.headers,a=void 0===i?{}:i,s=e.code,c=void 0===s?"":s,u=e.onProgress,l=e.method,p=void 0===l?"POST":l,f=e.isNewMethod,d=void 0===f||f,h=e.showMenu,g=void 0===h||h,y=e.native,v=void 0===y||y;if(a=Object.assign(Object.assign({"content-type":"application/json;charset=UTF-8",run3token:RunWorkH5.runWorkToken,"s-crc-ds-codes":c},RunWorkH5.ssdpDtgw.getRunworkStaticKeys()),a),["jpg","jpeg","png","gif"].includes(r.toLowerCase())||!1===v)return RunWorkH5.ssdpDtgw.request({code:c,headers:a,responseType:"blob",onDownloadProgress:u,data:o}).then((function(e){return e})).catch((function(e){return console.error(e),Promise.reject(e)}));var m=parseInt(RunWorkH5.appVersion.split(".").slice(0,2).join(""));return logger(["判断下载方式",RunWorkH5.appVersion,m]),openDocument({fileType:r,data:o,headers:a,onDownloadProgress:u,isNewMethod:!0===d&&m>=335,method:p,showMenu:g})}function openDocument(e){return e.isNewMethod?openDocumentBy335(e):openDocumentBy322(e)}function openDocumentBy335(e){var t=e.fileType,r=e.data,n=void 0===r?{}:r,o=e.headers,i=e.method,a=void 0===i?"POST":i,s=e.showMenu,c=void 0===s||s,u=e.onDownloadProgress;return clearFile(),new Promise((function(e,r){logger(["tt.downloadFile",a,o]),window.tt.downloadFile({url:RunWorkH5.ssdpDtgw.url,method:a,data:"object"===_typeof(n)?JSON.stringify(n):n,header:o,success:function(n){logger(["下载附件成功",n]),RunWorkH5.filePath.push(n.tempFilePath),window.tt.openDocument({filePath:n.tempFilePath,fileType:t,showMenu:c,success:function(t){e(),logger(["附件预览完成",t])},fail:function(e){r(e),logger(["附件预览失败",e],"error")}})},fail:function(e){r(e),logger(["下载附件失败",e],"error")}}).onProgressUpdate((function(e){"function"==typeof u&&u(e)}))}))}function openDocumentBy322(e){var t=e.fileType,r=e.data,n=void 0===r?{}:r,o=e.headers,i=e.method,a=void 0===i?"POST":i,s=e.onDownloadProgress;return jssdk("biz.util.openDocument",{method:a,fileType:t,body:"object"===_typeof(n)?JSON.stringify(n):n,header:o,url:RunWorkH5.ssdpDtgw.url,onProgress:s}).then((function(){return!0})).catch((function(e){return console.error(e),Promise.reject(e)}))}function clearFile(){if(0!==RunWorkH5.filePath.length)for(var e=function(){var e=RunWorkH5.filePath.pop();window.tt.removeSavedFile({filePath:e,success:function(){logger(["删除附件成功",e])},fail:function(t){logger(["删除附件失败:".concat(e),t],"error")}})};RunWorkH5.filePath.length>0;)e()}_export({global:!0,forced:parseInt!=numberParseInt},{parseInt:numberParseInt});var sitMockData={user:{open_id:"",external_token:"local",App_Sub_ID:"0000000303DM",App_Token:"6debaf0da23340daaac8659144ebed7a",App_key:"a59eacd0661d4ebb8a2b86aa02d2335f",Partner_ID:"00000000"},sys:{appVersion:"0.0.1",deviceID:"1A283E7B-F167-41E3-8974-493D57B74581",system:"local",platform:"local"}},uatMockData={user:{open_id:"",external_token:"local",App_Sub_ID:"0000000309OK",App_Token:"5643f1d9d86c43c9ae72069c243dbf86",App_key:"52e219166c7c41a68b490ac4efc22fa2",Partner_ID:"00000000"},sys:{appVersion:"1.0.0",deviceID:"1A283E7B-F167-41E3-8974-493D57B74581",system:"local",platform:"local"},network:{networkType:"local"}},preMockData={user:{open_id:"",external_token:void 0,App_Sub_ID:"0000000311VF",App_Token:"9472173cc8d5463fb6311db361c8a72f",App_key:"a48b2cb558de4093a2651d5da2c4c5fb",Partner_ID:"00000000"},sys:{appVersion:"0.0.1",deviceID:"1A283E7B-F167-41E3-8974-493D57B74581",system:"local",platform:"local"}},productionMockData={user:{open_id:"",external_token:void 0,App_Sub_ID:"0000000401RH",App_Token:"2bbc84f3bde54df488b4b0133989956c",App_key:"8c33a5babafd4f1197a6880a960ab91b",Partner_ID:"00000000"},sys:{appVersion:"0.0.1",deviceID:"1A283E7B-F167-41E3-8974-493D57B74581",system:"local",platform:"local"}};function mock(e){switch(e){case"sit":return sitMockData;case"uat":return uatMockData;case"pre":return preMockData;case"production":return productionMockData;default:return{}}}var HrInfoMode=_createClass((function e(t){var r=t.jobCodeDescr,n=t.fullPath,o=t.businessUnit,i=t.gender,a=t.avatarUrl,s=t.fullDescPath,c=t.deptId,u=t.employeeId,l=t.birthDate,p=t.nameFormal,f=t.join_time,d=t.nameAc,h=t.deptDesc,g=t.userType,y=t.email,v=t.seniorityPayDtMap,m=t.businessUnitDesc,b=t.mobilePhoneNumber,S=t.businessUnitDescShort;_classCallCheck(this,e),this.jobCodeDescr=r,this.fullPath=n,this.businessUnit=o,this.gender=i,this.avatarUrl=a,this.fullDescPath=s,this.deptId=c,this.employeeId=u,this.birthDate=l,this.nameFormal=p,this.join_time=f,this.nameAc=d,this.deptDesc=h,this.userType=g,this.email=y,this.seniorityPayDtMap=v,this.businessUnitDesc=m,this.mobilePhoneNumber=b,this.businessUnitDescShort=S})),IndexedDB=function(){function e(t){var r=t.dbname,n=void 0===r?"":r,o=t.onupgradeneeded,i=void 0===o?void 0:o,a=t.version,s=void 0===a?1:a;_classCallCheck(this,e),this.dbname=n,this.version=s,this.onupgradeneeded=i,this.init()}return _createClass(e,[{key:"init",value:function(){var e=this;if(!("indexedDB"in window))throw this.error="当前环境不支持 indexedDB",Error(this.error);return new Promise((function(t,r){e.DBRequestLink=window.indexedDB.open(e.dbname,e.version),e.DBRequestLink.onsuccess=function(r){e.DBInstance=r.target.result,e.isReady=!0,t(r)},e.DBRequestLink.onerror=function(t){console.error("indexedDB open error",t),e.error=t,r(t)},e.DBRequestLink.onupgradeneeded=e.onupgradeneeded}))}},{key:"initReady",value:function(){var e=this;return this.isReady?Promise.resolve(this.DBInstance):this.error?Promise.reject(this.error):new Promise((function(t,r){var n=0,o=setInterval((function(){e.isReady||n>=6?(clearInterval(o),e.isReady?t(e.DBInstance):r("IndexedDB init time out")):e.error&&(r(e.error),clearInterval(o)),n++}),100)}))}}]),e}();function get$1(e,t){return new Promise((function(r,n){var o=e[t?"get":"getAll"](t);o.onsuccess=function(e){r(e.target.result)},o.onerror=function(e){n(e)}}))}function put(e,t){return new Promise((function(r,n){var o=e.put(t);o.onsuccess=function(e){r(e)},o.onerror=function(e){n(e)}}))}var SSDPDtgw=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"test";_classCallCheck(this,e),this.env=t,this.url=getConstant("ssdp.dtgw.".concat(this.getEnv()))}return _createClass(e,[{key:"request",value:function(e){var t=e.code,r=e.data,n=e.headers,o=e.responseType,i=void 0===o?"json":o,a=e.timeout,s=e.method,c=void 0===s?"post":s,u=e.params,l=e.onUploadProgress,p=e.onDownloadProgress;return request({url:this.url,data:r,method:c,params:u,headers:Object.assign(Object.assign({"s-crc-ds-codes":t,run3token:RunWorkH5.runWorkToken},this.getRunworkStaticKeys()),n),timeout:a,onUploadProgress:l,onDownloadProgress:p,responseType:i})}},{key:"getRunworkStaticKeys",value:function(){return getConstant("ssdp.dtgw.runwork.".concat(this.env))}},{key:"getEnv",value:function(){switch(this.env){case"production":return"production";default:return"test"}}},{key:"generateUrlParam",value:function(e){return""}}]),e}(),Factory=_createClass((function e(){_classCallCheck(this,e)}));function getIndexedDB(){return Factory.indexedDB||(console.info("实例化 indexedDB"),Factory.indexedDB=new IndexedDB({dbname:getConstant("cacheKeys.indexeddb.name"),version:getConstant("cacheKeys.indexeddb.version"),onupgradeneeded:function(e){console.info("indexedDB onupgradeneeded");var t,r=e.target.result,n=_createForOfIteratorHelper(getConstant("h5DB"));try{for(n.s();!(t=n.n()).done;){var o=t.value,i=o.name,a=o.store,s=o.index;r.objectStoreNames.contains(i)&&r.deleteObjectStore(i);var c,u=r.createObjectStore(i,a),l=_createForOfIteratorHelper(s);try{for(l.s();!(c=l.n()).done;){var p=c.value;u.createIndex(p,p)}}catch(e){l.e(e)}finally{l.f()}}}catch(e){n.e(e)}finally{n.f()}}})),Factory.indexedDB}function getSsdpCls(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"sit";return Factory.ssdpCls||(Factory.ssdpCls=new SSDPCls(e)),Factory.ssdpCls}function getSsdpDtgw(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"test";return Factory.ssdpDtgw||(Factory.ssdpDtgw=new SSDPDtgw(e)),Factory.ssdpDtgw}function getTenantAccessToken(e,t){var r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function o(){var i,a,s,c,u,l,p,f,d,h,g;return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:if(i="".concat(getConstant("cacheKeys.localStorage.feishu.tenantAccessToken"),"_").concat(e),!0===r&&(logger("清空【TenantAccessToken】缓存"),localStorage.setItem(i,"")),a=localStorage.getItem(i),s=a?JSON.parse(a):void 0,!((c="object"===_typeof(s)?s.expire-(new Date).getTime():-1)>9e4)){o.next=8;break}return logger(["从缓存获取【TenantAccessToken】",c]),o.abrupt("return",s.value);case 8:return u=getConstant("ssdp.api.".concat(RunWorkH5.env,".gettoken")),l=u.api,p=u.version,console.info("TenantAccessToken",n,n||(RunWorkH5.isPrivate?"2.0":p)),o.next=12,RunWorkH5.ssdpCls.request({method:"POST",api:l,version:n||(RunWorkH5.isPrivate?"2.0":p),headers:{"Access-Control-Expose-Headers":"RETURN_CODE"},data:JSON.stringify({app_id:e,app_secret:t})});case 12:return f=o.sent,d=f.data,f.headers,h=d.tenant_access_token,d.code,d.msg,g=d.expire,localStorage.setItem(i,JSON.stringify({expire:(new Date).getTime()+1e3*g,value:h})),o.abrupt("return",h);case 18:case"end":return o.stop()}}),o)})))}Factory.getIndexedDB=getIndexedDB,Factory.getSsdpCls=getSsdpCls,Factory.getSsdpDtgw=getSsdpDtgw;var RunWorkH5=function(e){_inherits(r,e);var t=_createSuper(r);function r(e){var n;_classCallCheck(this,r),(n=t.call(this,e)).ready=!1,n.isJssdkReady=!1,n.browseFile=browseFile,r.ssdpCls=Factory.getSsdpCls(r.env),r.ssdpDtgw=Factory.getSsdpDtgw(r.env),r.isPrivate=e.isPrivate,n.ssdpRequestCls=r.ssdpCls.request.bind(r.ssdpCls),n.ssdpRequestDtgw=r.ssdpDtgw.request.bind(r.ssdpDtgw);var o=(new Date).getTime();return n.init().then((function(e){if(!1!==e){localStorage.removeItem("RELOAD_SSO_COUNT");var t=e.ldap,r=e.hrInfo;logger(["初始化完成",t]),n.ready=!0,n.ldap=t,r&&(n.hrInfo=new HrInfoMode(r)),!0===n.isJssdkAuth&&(n.run3track({category:"runwork-single-loign",action:"init",value:(new Date).getTime()-o}),n.onNetworkQualityChange()),n.callCacheTrackFail()}})).catch((function(e){n.ready=!1,n.error=e,logger(n.error,"error"),e="object"===_typeof(e)?JSON.stringify(e):e,n.setCacheTrackFail({type:"error",category:"runwork-help init error",action:"request",data:{errorInfo:e},networkResend:1})})),n}return _createClass(r,[{key:"init",value:function(){return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,o,i,a,s,c,u,l,p,f,d,h,g,y,v,m,b,S,E,_,T,I;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.checkOption()){e.next=2;break}return e.abrupt("return",Promise.reject(this.error));case 2:if(this.runWorkToken=this.getRunWorkToken(),this.runWorkToken||1!=this.isLocal){e.next=10;break}return e.next=6,this.createDebugJwttoken(this.devUser);case 6:t=e.sent,this.runWorkToken=t,e.next=13;break;case 10:if(this.runWorkToken){e.next=13;break}return e.next=13,this.redirectFeishu();case 13:return r.runWorkToken=this.runWorkToken,n={},e.prev=15,e.next=18,this.getSSOUserInfo();case 18:n=e.sent,e.next=26;break;case 21:return e.prev=21,e.t0=e.catch(15),console.error(e.t0),e.next=26,this.redirectFeishu(e.t0);case 26:if(i=(o=n).access_token,a=o.avatar_thumb,s=o.avatar_url,c=o.avatar_big,u=o.user_id,l=o.name,p=o.en_name,f=o.open_id,d=o.App_Sub_ID,h=o.Partner_ID,g=o.App_key,y=o.App_Token,d){e.next=29;break}return e.abrupt("return",Promise.reject({error:"App_Sub_ID is undefined",message:JSON.stringify(n)}));case 29:if(this.user={access_token:i,avatar_thumb:a,avatar_url:s,avatar_big:c,user_id:u,name:l,en_name:p,open_id:f},!0!==this.isJssdkAuth){e.next=34;break}return e.next=33,this.getBaseInfoByNative();case 33:v=e.sent;case 34:return logger(["getBaseInfoByNative",v],"info"),b=(m=v||{}).appVersion,S=m.deviceID,E=m.system,_=m.platform,T=m.model,r.sysInfo={deviceID:S,platform:_,model:T,system:E},r.appVersion=b,this.ssdpApp=new SSDPApp(Object.assign({App_ID:"002601",App_Sub_ID:d,App_Token:y,App_key:g,App_Version:b,Partner_ID:h,Divice_ID:S,Divice_Version:E,OS_Version:_,User_Token:"-"},this.SSDPConfig),r.getEnv(),this.isLogin),e.next=41,this.ssdpApp.init();case 41:if(logger(["ssdpApp 初始化完成"]),!this.isHrInfo||this.isLogin){e.next=47;break}return logger(["获取用户Hr信息"]),e.next=46,this.getHrInfo(u);case 46:I=e.sent;case 47:return e.abrupt("return",{ldap:u,hrInfo:I});case 48:case"end":return e.stop()}}),e,this,[[15,21]])})))}},{key:"initReady",value:function(){var e=this;return this.ready?Promise.resolve():this.error?Promise.reject(this.error):new Promise((function(t,r){var n=0,o=setInterval((function(){e.error&&(logger(["初始化失败",e.error],"error"),clearInterval(o),r(e.error)),(e.ready||n>=300)&&(logger(["初始化结束",e.ready,e.error]),clearInterval(o),!e.ready&&logger("初始化超时","error"),e.ready?t():r("初始化超时,请稍后重试")),n++}),100)}))}},{key:"jssdkReady",value:function(){return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isJssdkReady){e.next=4;break}return e.abrupt("return",!0);case 4:if(!this.jssdkIdentityError){e.next=7;break}return logger(["jssdk鉴权失败",this.jssdkIdentityError],"error"),e.abrupt("return",Promise.reject(this.jssdkIdentityError));case 7:return e.abrupt("return",new Promise((function(e,r){var n=0,o=setInterval((function(){t.jssdkIdentityError&&(clearInterval(o),r(t.jssdkIdentityError)),(t.isJssdkReady||n>=50)&&(clearInterval(o),logger(["jssdk鉴权结束",t.isJssdkReady]),t.isJssdkReady?e():r("jssdk鉴权超时")),n++}),300)})));case 8:case"end":return e.stop()}}),e,this)})))}},{key:"ssdpRequestApp",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function n(){var o,i,a,s,c,u,l,p,f,d,h,g,y,v,m,b,S,E,_,T,I=this;return regeneratorRuntime.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return o=e.api,i=e.version,a=e.data,s=void 0===a?{}:a,c=e.headers,u=void 0===c?{}:c,l=e.isFormatData,p=void 0===l||l,f=e.type,d=void 0===f?"rs":f,h=e.method,g=void 0===h?"POST":h,y=e.params,v=void 0===y?{}:y,n.next=3,this.ssdpApp.request(Object.assign(Object.assign({},e),{api:o,version:i,data:s,headers:Object.assign({run3token:this.runWorkToken},u),isFormatData:p,method:g,type:d,params:v})).catch((function(t){var r;return!1===(null===(r=e.api)||void 0===r?void 0:r.includes("run3_track"))&&I.run3track({type:"error",category:"runwork-request-ecsb",action:"request",data:{pageOverTime:o,errorInfo:"object"===_typeof(t)?JSON.stringify(t):t}}),Promise.reject(t)}));case 3:if(m=n.sent,b=m.data,!1!==p){n.next=7;break}return n.abrupt("return",m);case 7:if(S=b.RESPONSE,E=S.RETURN_CODE,_=S.RETURN_DESC,T=S.RETURN_DATA,("E0MI0007"===E||"string"==typeof _&&~_.indexOf("User_Token"))&&r<=3&&logger(["请关闭ecsb服务用户身份校验"],"warn"),"resolve"!==("S"===E.charAt(0)||"MS000A000"===E?"resolve":"reject")){n.next=14;break}return n.abrupt("return",Promise.resolve({RETURN_CODE:E,RETURN_DESC:_,RETURN_DATA:T}));case 14:return!1===(null===(t=e.api)||void 0===t?void 0:t.includes("run3_track"))&&(logger(["请求ecsb服务异常",b.RESPONSE],"error"),this.run3track({type:"error",category:"runwork-request-ecsb",action:"request",data:{pageOverTime:o,errorInfo:JSON.stringify(b.RESPONSE)}})),n.abrupt("return",Promise.reject({RETURN_CODE:E,RETURN_DESC:_,RETURN_DATA:T,api:o,common:this.ssdpApp.config}));case 16:case"end":return n.stop()}}),n,this)})))}},{key:"getBaseInfoByNative",value:function(){return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,o,i,a=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isLocal){e.next=3;break}return t=mock(r.env),n=t.sys,e.abrupt("return",Promise.resolve(n));case 3:return e.next=5,this.getBaseInfoByCache();case 5:if(o=e.sent,i=null==o.appVersion,logger(["从缓存中获取系统信息",o]),logger(["是否启用异步鉴权",!i]),!i){e.next=21;break}return e.prev=10,e.next=13,identity(this.appId,this.appSecret,this.jsApiList);case 13:this.isJssdkReady=!0,e.next=19;break;case 16:return e.prev=16,e.t0=e.catch(10),e.abrupt("return",Promise.reject(e.t0));case 19:e.next=22;break;case 21:identity(this.appId,this.appSecret,this.jsApiList,(function(e){var t=e.success,r=e.error;a.isJssdkReady=t,a.jssdkIdentityError=r}));case 22:return e.abrupt("return",1==i?this.getSystemInfo():Promise.resolve(o));case 23:case"end":return e.stop()}}),e,this,[[10,16]])})))}},{key:"getSystemInfo",value:function(){return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=0,jssdk("device.base.getSystemInfo").then((function(e){n=e})),o=(new Date).getTime(),e.abrupt("return",new Promise((function(e,i){var a=setInterval((function(){(new Date).getTime()-o>1e3&&null==n?(++t,o=(new Date).getTime(),logger(["重新调用【getSystemInfo】",t],"warn"),jssdk("device.base.getSystemInfo").then((function(e){n=e})).catch((function(e){clearInterval(a),i(e)}))):t>3&&!n?(clearInterval(a),i("device.base.getSystemInfo timeout")):n&&(clearInterval(a),r.isIndexedDB&&Factory.getIndexedDB().initReady().then((function(e){var t=getConstant("cacheKeys.indexeddb.store.sys"),r=e.transaction(t,"readwrite").objectStore(t);logger(["getSystemInfo",n]),put(r,Object.assign(Object.assign({},n),{id:t}))})).catch((function(e){logger(["更新IndexedDB【sys】失败",e],"warn")})),e(n))}),50)})));case 4:case"end":return e.stop()}}),e)})))}},{key:"getUserInfoEx",value:function(){return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,o;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=0,jssdk("biz.user.getUserInfoEx").then((function(e){n=e})),o=(new Date).getTime(),e.abrupt("return",new Promise((function(e,i){var a=setInterval((function(){(new Date).getTime()-o>1e3&&null==n?(++t,o=(new Date).getTime(),logger(["重新调用【getUserInfoEx】",t],"warn"),jssdk("biz.user.getUserInfoEx").then((function(e){n=e})).catch((function(e){clearInterval(a),i(e)}))):t>3&&!n?(clearInterval(a),i("biz.user.getUserInfoEx timeout")):n&&(clearInterval(a),r.isIndexedDB&&Factory.getIndexedDB().initReady().then((function(e){var t=getConstant("cacheKeys.indexeddb.store.user"),r=e.transaction(t,"readwrite").objectStore(t);logger(["getUserInfoEx",n]),put(r,Object.assign(Object.assign({},n),{id:t}))})).catch((function(e){logger(["更新IndexedDB【UserInfoEx】失败",e],"warn")})),e(n))}),50)})));case 4:case"end":return e.stop()}}),e)})))}},{key:"getBaseInfoByCache",value:function(){return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,o,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r.isIndexedDB){e.next=3;break}return logger(["不启用缓存获取系统信息(不支持 IndexedDB)"],"warn"),e.abrupt("return",Promise.resolve());case 3:return e.prev=3,t=getConstant("cacheKeys.indexeddb.store.sys"),e.next=7,Factory.getIndexedDB().initReady();case 7:return n=e.sent,o=n.transaction([t],"readwrite"),i=o.objectStore(t),e.next=12,get$1(i,t);case 12:return a=e.sent,e.abrupt("return",a||{});case 16:return e.prev=16,e.t0=e.catch(3),e.abrupt("return",Promise.resolve({}));case 19:case"end":return e.stop()}}),e,null,[[3,16]])})))}},{key:"getHrInfo",value:function(e){return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,o,i,a,s,c,u,l;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.getHrInfoByCache(e);case 2:if(logger(["getHrInfoByCache",n=t.sent]),!n){t.next=6;break}return t.abrupt("return",new HrInfoMode(n));case 6:return t.next=8,this.ssdpRequestApp(Object.assign(Object.assign({},getConstant("ssdp.api.".concat(r.env,".hrInfo"))),{headers:{appid:this.appId},data:{BUS_DATA:base64.encode(JSON.stringify({ldap:e,isRequireAvatar:!0===this.isAvatar?"1":"0"}))}}));case 8:if(o=t.sent,i=o.RETURN_DATA,(a=new HrInfoMode(JSON.parse(base64.decode(i)))).employeeId){t.next=13;break}return t.abrupt("return",a);case 13:return t.prev=13,t.next=16,Factory.getIndexedDB().initReady();case 16:s=t.sent,c=getConstant("cacheKeys.indexeddb.store.hrInfo"),u=s.transaction(c,"readwrite"),l=u.objectStore(c),e&&(logger(["更新 HrInfo",a]),put(l,Object.assign(Object.assign({},a),{id:e,expires:(new Date).getTime()+864e5}))),t.next=26;break;case 23:t.prev=23,t.t0=t.catch(13),logger(["更新IndexedDB【hrInfo】失败",t.t0],"warn");case 26:return t.abrupt("return",a);case 27:case"end":return t.stop()}}),t,this,[[13,23]])})))}},{key:"getHrInfoByCache",value:function(e){if(logger(["从缓存中获取Hr信息"]),!r.isIndexedDB||!1===this.isHrInfoCache||!this.domain.includes(location.origin))return Promise.resolve();var t=getConstant("cacheKeys.indexeddb.store.hrInfo");return logger(["从缓存中获取Hr信息 storeKey",t]),Factory.getIndexedDB().initReady().then((function(r){logger(["从缓存中获取Hr信息 db",r]);var n=r.transaction(t,"readwrite");logger(["从缓存中获取Hr信息 transaction",n]);var o=n.objectStore(t);return logger(["从缓存中获取Hr信息 store",o]),get$1(o,e)})).then((function(e){if(logger(["从缓存中获取Hr信息 res",e]),!e)return Promise.resolve();var t=e.expires-(new Date).getTime();return logger(["HrInfo 缓存有效期",t/1e3/60/60]),Promise.resolve(t>0?e:void 0)})).catch((function(e){return logger(["获取IndexedDB【getHrInfoByCache】失败",e],"warn"),Promise.resolve()}))}},{key:"getAvatarAuthByUserId",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"ldap";return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function o(){return regeneratorRuntime.wrap((function(o){for(;;)switch(o.prev=o.next){case 0:return o.abrupt("return",this.getAvatarByUserId(e,t,r,n,!0));case 1:case"end":return o.stop()}}),o,this)})))}},{key:"getAvatarByUserId",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"ldap",i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function a(){var s,c,u,l,p,f,d,h,g,y,v;return regeneratorRuntime.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,this.getAvatarByCache(e,n);case 2:if(s=a.sent,c=s.includes,0!==s.exclusion.length){a.next=7;break}return a.abrupt("return",c);case 7:for(u=Math.ceil(e.length/t),l=[],p=1;p<=u;p++)f=(p-1)*t,l.push(this.ssdpRequestApp(Object.assign(Object.assign({},getConstant("ssdp.api.".concat(r.env,".").concat(!0===i?"avatarAuth":"avatar"))),{data:{BUS_DATA:base64.encode(JSON.stringify(_defineProperty({},o,e.slice(f,f+t))))}})));return a.next=12,Promise.all(l);case 12:d=a.sent,h=[],g=_createForOfIteratorHelper(d);try{for(g.s();!(y=g.n()).done;)v=y.value,h=h.concat(JSON.parse(base64.decode(v.RETURN_DATA)))}catch(e){g.e(e)}finally{g.f()}return this.addAvatarCache(h),a.abrupt("return",c.concat(h));case 18:case"end":return a.stop()}}),a,this)})))}},{key:"getAvatarByEmail",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,r=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.getAvatarByUserId(e,t,r,"emailList")}},{key:"addAvatarCache",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=getConstant("cacheKeys.indexeddb.store.avatar");Factory.getIndexedDB().initReady().then((function(r){for(var n=r.transaction(t,"readwrite").objectStore(t),o=0;o0&&void 0!==arguments[0]?arguments[0]:[],t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!1===t)return Promise.resolve({includes:[],exclusion:e});var r=getConstant("cacheKeys.indexeddb.store.avatar");return Factory.getIndexedDB().initReady().then((function(e){return get$1(e.transaction(r,"readwrite").objectStore(r))})).then((function(t){if(!t)return Promise.resolve({exclusion:[]});for(var r=[],n=[],o=function(o){var i=e[o],a=t.findIndex((function(e){return e.id===i})),s=~a?t[a]:void 0;s&&s.expires-(new Date).getTime()>0?r.push(Object.assign(Object.assign({},s),{account:s.id})):n.push(i)},i=0;i=3)){t.next=3;break}return t.abrupt("return",Promise.reject("超过最大重试次数 - ".concat("object"===_typeof(e)?JSON.stringify(e):e)));case 3:return localStorage.setItem("RELOAD_SSO_COUNT",JSON.stringify({count:++n,time:(new Date).getTime()})),o=location.href,location.replace("https://open.rwork.crc.com.cn/open-apis/authen/v1/index?redirect_uri=".concat(encodeURIComponent(getConstant("feishu.redirectUrl.".concat(r.env))),"&app_id=").concat(this.appId,"&state=").concat(base64.encode(JSON.stringify({url:o,appCode:this.appId,larkexpires:this.larkexpires,isCross:this.isCross})))),t.next=8,sleep(6e4);case 8:case"end":return t.stop()}}),t,this)})))}},{key:"getReloadSSOCount",value:function(){try{var e=JSON.parse(localStorage.getItem("RELOAD_SSO_COUNT")||"{}"),t=e.count,r=e.time,n=void 0===r?0:r;return(new Date).getTime()-n>15e3?(localStorage.removeItem("RELOAD_SSO_COUNT"),0):t}catch(e){return localStorage.removeItem("RELOAD_SSO_COUNT"),0}}},{key:"getSSOUserInfo",value:function(){return request({url:getConstant("apis.getSSOUserInfo.".concat(r.env)),method:"GET",headers:{run3token:this.runWorkToken,appCode:this.appId}}).then((function(e){var t=e.data,r=t.RESPONSE,n=r.RETURN_CODE,o=(r.RETURN_DESC,r.RETURN_DATA);return"S0A00000"!==n?Promise.reject(t):Promise.resolve(o)})).catch((function(e){return Promise.reject(e)}))}},{key:"createDebugJwttoken",value:function(e){return request({url:getConstant("apis.createDebugJwttoken.".concat(r.env)),method:"GET",headers:{ldap:e,appCode:this.appId}}).then((function(e){var t=e.data,r=t.RESPONSE,n=r.RETURN_CODE,o=r.RETURN_DATA;return"S0A00000"!==n?Promise.reject(t):Promise.resolve(o.run3token)}))}},{key:"getNetworkType",value:function(){return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function e(){var t,n,o,i,a;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=0,!this.isLocal){e.next=4;break}return o=mock(r.env),i=o.network,e.abrupt("return",Promise.resolve(i));case 4:return jssdk("device.connection.getNetworkType").then((function(e){n=e})),a=(new Date).getTime(),e.abrupt("return",new Promise((function(e,o){var i=setInterval((function(){(new Date).getTime()-a>1e3&&null==n?(++t,a=(new Date).getTime(),logger(["重新调用【getNetworkType】",t],"warn"),jssdk("device.connection.getNetworkType").then((function(e){n=e})).catch((function(e){clearInterval(i),o(e)}))):t>3&&!n?(clearInterval(i),o("device.connection.getNetworkType timeout")):n&&(clearInterval(i),r.isIndexedDB&&Factory.getIndexedDB().initReady().then((function(e){var t=getConstant("cacheKeys.indexeddb.store.network"),r=e.transaction(t,"readwrite").objectStore(t);logger(["getNetworkType",n]),put(r,Object.assign(Object.assign({},n),{id:t}))})).catch((function(e){logger(["更新IndexedDB【sys】失败",e],"warn")})),e(n))}),50)})));case 7:case"end":return e.stop()}}),e,this)})))}},{key:"run3track",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return __awaiter(this,void 0,void 0,regeneratorRuntime.mark((function t(){var n,o,i,a,s,c,u,l,p,f,d,h,g,y,v=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(logger(["调用埋点",e.type]),"sit"!==r.env){t.next=3;break}return t.abrupt("return");case 3:if(n={},1===e.networkResend)n=e;else{o=navigator&&navigator.userAgent?isBroswer():{},i=e.type,a=void 0===i?"log":i,s=e.namespace,c=void 0===s?"runwork":s,u=this.appId,l=this.ldap,p=this.hrInfo,f=r.sysInfo||{},d=f.deviceID,h=f.platform,g=f.system;try{y=navigator.connection.effectiveType,o=navigator&&navigator.userAgent?isBroswer():{}}catch(e){y="",o={}}n=Object.assign({type:a||"log",namespace:c||"runwork",appId:u,userId:l,url:location.href,orgId:p?p.deptId:"",buName:p?p.businessUnitDesc:"",deviceType:h,deviceId:d,deviceVersion:g,clientVersion:r.appVersion,ipAddress:"",activityTime:getTimeStamp(new Date,"yyyy-MM-dd hh:mm:ss",!1),browser:o.name,browserVersion:o.version,networkType:y},e)}return logger(["run3track埋点参数",n]),t.abrupt("return",this.ssdpRequestApp(Object.assign(Object.assign({},getConstant("ssdp.api.".concat(r.env,".run3track"))),{data:n})).then((function(e){return Promise.resolve(e)})).catch((function(t){return logger(["埋点 fail",t],"error"),"object"===_typeof(t)&&"string"==typeof t.message&&(t=t.message),v.setCacheTrackFail(Object.assign(Object.assign({},n),{type:"error",category:"runwork-request-ecsb",action:"request",data:{pageOverTime:e.api,errorInfo:"object"===_typeof(t)?JSON.stringify(t):t},networkResend:1})),Promise.reject(t)})));case 7:case"end":return t.stop()}}),t,this)})))}},{key:"setCacheTrackFail",value:function(e){var t=[];try{t=JSON.parse(localStorage.getItem("RUNWORK_TRACK_FAIL")||"[]")}catch(e){t=[]}t.push(e),localStorage.setItem("RUNWORK_TRACK_FAIL",JSON.stringify(t))}},{key:"callCacheTrackFail",value:function(){var e;try{e=JSON.parse(localStorage.getItem("RUNWORK_TRACK_FAIL")||"[]")}catch(t){e=[]}if(e.length>0)for(var t=0;t0&&void 0!==arguments[0]?arguments[0]:"sit",r=arguments.length>1?arguments[1]:void 0;_classCallCheck(this,e),this.url=getConstant("ssdp.cls.".concat("production"===t?"production":"test")),this.env=t,this.commonParam=r?Object.assign({},r):Object.assign({},getConstant("ssdp.cls.runwork.".concat(this.env)))}return _createClass(e,[{key:"request",value:function(e){var t=e.api,r=void 0===t?"":t,n=e.version,o=void 0===n?"":n,i=e.data,a=void 0===i?"":i,s=e.params,c=void 0===s?{}:s,u=e.headers,l=void 0===u?{}:u,p=e.method,f=void 0===p?"GET":p;return request({url:"".concat(this.url,"?ssdp=").concat(this.generateUrlParam(Object.assign({Api_ID:r,Api_Version:o,Sign:"NO_SIGN",User_Token:"null",Time_Stamp:getTimeStamp()},this.commonParam))),method:f,params:c,headers:Object.assign({run3token:RunWorkH5.runWorkToken},l),data:a})}},{key:"generateUrlParam",value:function(e){return base64.encode(Object.keys(e).map((function(t){return"".concat(t,"=").concat(e[t])})).join("&"))}},{key:"setSysOption",value:function(e){var t=e.App_Sub_ID,r=e.App_Token,n=e.Partner_ID,o=e.Sys_ID;this.App_Sub_ID=t,this.App_Token=r,this.Partner_ID=n,this.Sys_ID=o}}]),e}();exports.RunWorkH5=RunWorkH5,exports.SSDPApp=SSDPApp,exports.SSDPCls=SSDPCls,exports.SSDPDtgw=SSDPDtgw,exports.base64=base64,exports.identity=identity,exports.isIphonex=isIphonex,exports.jssdk=jssdk,Object.defineProperty(exports,"__esModule",{value:!0})})); diff --git a/src/main/resources/com/fr/plugin/third/party/jsdjjed/sdk/vconsole.min.js b/src/main/resources/com/fr/plugin/third/party/jsdjjed/sdk/vconsole.min.js new file mode 100644 index 0000000..a0d85a5 --- /dev/null +++ b/src/main/resources/com/fr/plugin/third/party/jsdjjed/sdk/vconsole.min.js @@ -0,0 +1,10 @@ +/*! + * vConsole v3.14.6 (https://github.com/Tencent/vConsole) + * + * Tencent is pleased to support the open source community by making vConsole available. + * Copyright (C) 2017 THL A29 Limited, a Tencent company. All rights reserved. + * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at + * http://opensource.org/licenses/MIT + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + */ +!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("VConsole",[],n):"object"==typeof exports?exports.VConsole=n():t.VConsole=n()}(this||self,(function(){return function(){var __webpack_modules__={4264:function(t,n,e){t.exports=e(7588)},5036:function(t,n,e){e(1719),e(5677),e(6394),e(5334),e(6969),e(2021),e(8328),e(2129);var r=e(1287);t.exports=r.Promise},2582:function(t,n,e){e(1646),e(6394),e(2004),e(462),e(8407),e(2429),e(1172),e(8288),e(1274),e(8201),e(6626),e(3211),e(9952),e(15),e(9831),e(7521),e(2972),e(6956),e(5222),e(2257);var r=e(1287);t.exports=r.Symbol},8257:function(t,n,e){var r=e(7583),o=e(9212),i=e(5637),a=r.TypeError;t.exports=function(t){if(o(t))return t;throw a(i(t)+" is not a function")}},1186:function(t,n,e){var r=e(7583),o=e(2097),i=e(5637),a=r.TypeError;t.exports=function(t){if(o(t))return t;throw a(i(t)+" is not a constructor")}},9882:function(t,n,e){var r=e(7583),o=e(9212),i=r.String,a=r.TypeError;t.exports=function(t){if("object"==typeof t||o(t))return t;throw a("Can't set "+i(t)+" as a prototype")}},6288:function(t,n,e){var r=e(3649),o=e(3590),i=e(4615),a=r("unscopables"),c=Array.prototype;null==c[a]&&i.f(c,a,{configurable:!0,value:o(null)}),t.exports=function(t){c[a][t]=!0}},4761:function(t,n,e){var r=e(7583),o=e(2447),i=r.TypeError;t.exports=function(t,n){if(o(n,t))return t;throw i("Incorrect invocation")}},2569:function(t,n,e){var r=e(7583),o=e(794),i=r.String,a=r.TypeError;t.exports=function(t){if(o(t))return t;throw a(i(t)+" is not an object")}},5766:function(t,n,e){var r=e(2977),o=e(6782),i=e(1825),a=function(t){return function(n,e,a){var c,u=r(n),s=i(u),l=o(a,s);if(t&&e!=e){for(;s>l;)if((c=u[l++])!=c)return!0}else for(;s>l;l++)if((t||l in u)&&u[l]===e)return t||l||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},4805:function(t,n,e){var r=e(2938),o=e(7386),i=e(5044),a=e(1324),c=e(1825),u=e(4822),s=o([].push),l=function(t){var n=1==t,e=2==t,o=3==t,l=4==t,f=6==t,d=7==t,v=5==t||f;return function(p,h,g,m){for(var _,b,y=a(p),w=i(y),E=r(h,g),L=c(w),T=0,O=m||u,C=n?O(p,L):e||d?O(p,0):void 0;L>T;T++)if((v||T in w)&&(b=E(_=w[T],T,y),t))if(n)C[T]=b;else if(b)switch(t){case 3:return!0;case 5:return _;case 6:return T;case 2:s(C,_)}else switch(t){case 4:return!1;case 7:s(C,_)}return f?-1:o||l?l:C}};t.exports={forEach:l(0),map:l(1),filter:l(2),some:l(3),every:l(4),find:l(5),findIndex:l(6),filterReject:l(7)}},9269:function(t,n,e){var r=e(6544),o=e(3649),i=e(4061),a=o("species");t.exports=function(t){return i>=51||!r((function(){var n=[];return(n.constructor={})[a]=function(){return{foo:1}},1!==n[t](Boolean).foo}))}},4546:function(t,n,e){var r=e(7583),o=e(6782),i=e(1825),a=e(5999),c=r.Array,u=Math.max;t.exports=function(t,n,e){for(var r=i(t),s=o(n,r),l=o(void 0===e?r:e,r),f=c(u(l-s,0)),d=0;s0&&r[0]<4?1:+(r[0]+r[1])),!o&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(o=+r[1]),t.exports=o},5690:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},1178:function(t,n,e){var r=e(6544),o=e(4677);t.exports=!r((function(){var t=Error("a");return!("stack"in t)||(Object.defineProperty(t,"stack",o(1,7)),7!==t.stack)}))},7263:function(t,n,e){var r=e(7583),o=e(6683).f,i=e(57),a=e(1270),c=e(460),u=e(3478),s=e(4451);t.exports=function(t,n){var e,l,f,d,v,p=t.target,h=t.global,g=t.stat;if(e=h?r:g?r[p]||c(p,{}):(r[p]||{}).prototype)for(l in n){if(d=n[l],f=t.noTargetGet?(v=o(e,l))&&v.value:e[l],!s(h?l:p+(g?".":"#")+l,t.forced)&&void 0!==f){if(typeof d==typeof f)continue;u(d,f)}(t.sham||f&&f.sham)&&i(d,"sham",!0),a(e,l,d,t)}}},6544:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},1611:function(t,n,e){var r=e(8987),o=Function.prototype,i=o.apply,a=o.call;t.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(i):function(){return a.apply(i,arguments)})},2938:function(t,n,e){var r=e(7386),o=e(8257),i=e(8987),a=r(r.bind);t.exports=function(t,n){return o(t),void 0===n?t:i?a(t,n):function(){return t.apply(n,arguments)}}},8987:function(t,n,e){var r=e(6544);t.exports=!r((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},8262:function(t,n,e){var r=e(8987),o=Function.prototype.call;t.exports=r?o.bind(o):function(){return o.apply(o,arguments)}},4340:function(t,n,e){var r=e(8494),o=e(2870),i=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,c=o(i,"name"),u=c&&"something"===function(){}.name,s=c&&(!r||r&&a(i,"name").configurable);t.exports={EXISTS:c,PROPER:u,CONFIGURABLE:s}},7386:function(t,n,e){var r=e(8987),o=Function.prototype,i=o.bind,a=o.call,c=r&&i.bind(a,a);t.exports=r?function(t){return t&&c(t)}:function(t){return t&&function(){return a.apply(t,arguments)}}},5897:function(t,n,e){var r=e(7583),o=e(9212),i=function(t){return o(t)?t:void 0};t.exports=function(t,n){return arguments.length<2?i(r[t]):r[t]&&r[t][n]}},8272:function(t,n,e){var r=e(3058),o=e(911),i=e(339),a=e(3649)("iterator");t.exports=function(t){if(null!=t)return o(t,a)||o(t,"@@iterator")||i[r(t)]}},6307:function(t,n,e){var r=e(7583),o=e(8262),i=e(8257),a=e(2569),c=e(5637),u=e(8272),s=r.TypeError;t.exports=function(t,n){var e=arguments.length<2?u(t):n;if(i(e))return a(o(e,t));throw s(c(t)+" is not iterable")}},911:function(t,n,e){var r=e(8257);t.exports=function(t,n){var e=t[n];return null==e?void 0:r(e)}},7583:function(t,n,e){var r=function(t){return t&&t.Math==Math&&t};t.exports=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof e.g&&e.g)||function(){return this}()||Function("return this")()},2870:function(t,n,e){var r=e(7386),o=e(1324),i=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,n){return i(o(t),n)}},4639:function(t){t.exports={}},2716:function(t,n,e){var r=e(7583);t.exports=function(t,n){var e=r.console;e&&e.error&&(1==arguments.length?e.error(t):e.error(t,n))}},482:function(t,n,e){var r=e(5897);t.exports=r("document","documentElement")},275:function(t,n,e){var r=e(8494),o=e(6544),i=e(6668);t.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},5044:function(t,n,e){var r=e(7583),o=e(7386),i=e(6544),a=e(9624),c=r.Object,u=o("".split);t.exports=i((function(){return!c("z").propertyIsEnumerable(0)}))?function(t){return"String"==a(t)?u(t,""):c(t)}:c},9734:function(t,n,e){var r=e(7386),o=e(9212),i=e(1314),a=r(Function.toString);o(i.inspectSource)||(i.inspectSource=function(t){return a(t)}),t.exports=i.inspectSource},4402:function(t,n,e){var r=e(794),o=e(57);t.exports=function(t,n){r(n)&&"cause"in n&&o(t,"cause",n.cause)}},2743:function(t,n,e){var r,o,i,a=e(9491),c=e(7583),u=e(7386),s=e(794),l=e(57),f=e(2870),d=e(1314),v=e(9137),p=e(4639),h="Object already initialized",g=c.TypeError,m=c.WeakMap;if(a||d.state){var _=d.state||(d.state=new m),b=u(_.get),y=u(_.has),w=u(_.set);r=function(t,n){if(y(_,t))throw new g(h);return n.facade=t,w(_,t,n),n},o=function(t){return b(_,t)||{}},i=function(t){return y(_,t)}}else{var E=v("state");p[E]=!0,r=function(t,n){if(f(t,E))throw new g(h);return n.facade=t,l(t,E,n),n},o=function(t){return f(t,E)?t[E]:{}},i=function(t){return f(t,E)}}t.exports={set:r,get:o,has:i,enforce:function(t){return i(t)?o(t):r(t,{})},getterFor:function(t){return function(n){var e;if(!s(n)||(e=o(n)).type!==t)throw g("Incompatible receiver, "+t+" required");return e}}}},114:function(t,n,e){var r=e(3649),o=e(339),i=r("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(o.Array===t||a[i]===t)}},4521:function(t,n,e){var r=e(9624);t.exports=Array.isArray||function(t){return"Array"==r(t)}},9212:function(t){t.exports=function(t){return"function"==typeof t}},2097:function(t,n,e){var r=e(7386),o=e(6544),i=e(9212),a=e(3058),c=e(5897),u=e(9734),s=function(){},l=[],f=c("Reflect","construct"),d=/^\s*(?:class|function)\b/,v=r(d.exec),p=!d.exec(s),h=function(t){if(!i(t))return!1;try{return f(s,l,t),!0}catch(t){return!1}},g=function(t){if(!i(t))return!1;switch(a(t)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return p||!!v(d,u(t))}catch(t){return!0}};g.sham=!0,t.exports=!f||o((function(){var t;return h(h.call)||!h(Object)||!h((function(){t=!0}))||t}))?g:h},4451:function(t,n,e){var r=e(6544),o=e(9212),i=/#|\.prototype\./,a=function(t,n){var e=u[c(t)];return e==l||e!=s&&(o(n)?r(n):!!n)},c=a.normalize=function(t){return String(t).replace(i,".").toLowerCase()},u=a.data={},s=a.NATIVE="N",l=a.POLYFILL="P";t.exports=a},794:function(t,n,e){var r=e(9212);t.exports=function(t){return"object"==typeof t?null!==t:r(t)}},6268:function(t){t.exports=!1},5871:function(t,n,e){var r=e(7583),o=e(5897),i=e(9212),a=e(2447),c=e(7786),u=r.Object;t.exports=c?function(t){return"symbol"==typeof t}:function(t){var n=o("Symbol");return i(n)&&a(n.prototype,u(t))}},4026:function(t,n,e){var r=e(7583),o=e(2938),i=e(8262),a=e(2569),c=e(5637),u=e(114),s=e(1825),l=e(2447),f=e(6307),d=e(8272),v=e(7093),p=r.TypeError,h=function(t,n){this.stopped=t,this.result=n},g=h.prototype;t.exports=function(t,n,e){var r,m,_,b,y,w,E,L=e&&e.that,T=!(!e||!e.AS_ENTRIES),O=!(!e||!e.IS_ITERATOR),C=!(!e||!e.INTERRUPTED),x=o(n,L),I=function(t){return r&&v(r,"normal",t),new h(!0,t)},D=function(t){return T?(a(t),C?x(t[0],t[1],I):x(t[0],t[1])):C?x(t,I):x(t)};if(O)r=t;else{if(!(m=d(t)))throw p(c(t)+" is not iterable");if(u(m)){for(_=0,b=s(t);b>_;_++)if((y=D(t[_]))&&l(g,y))return y;return new h(!1)}r=f(t,m)}for(w=r.next;!(E=i(w,r)).done;){try{y=D(E.value)}catch(t){v(r,"throw",t)}if("object"==typeof y&&y&&l(g,y))return y}return new h(!1)}},7093:function(t,n,e){var r=e(8262),o=e(2569),i=e(911);t.exports=function(t,n,e){var a,c;o(t);try{if(!(a=i(t,"return"))){if("throw"===n)throw e;return e}a=r(a,t)}catch(t){c=!0,a=t}if("throw"===n)throw e;if(c)throw a;return o(a),e}},2365:function(t,n,e){"use strict";var r,o,i,a=e(6544),c=e(9212),u=e(3590),s=e(729),l=e(1270),f=e(3649),d=e(6268),v=f("iterator"),p=!1;[].keys&&("next"in(i=[].keys())?(o=s(s(i)))!==Object.prototype&&(r=o):p=!0),null==r||a((function(){var t={};return r[v].call(t)!==t}))?r={}:d&&(r=u(r)),c(r[v])||l(r,v,(function(){return this})),t.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:p}},339:function(t){t.exports={}},1825:function(t,n,e){var r=e(97);t.exports=function(t){return r(t.length)}},2095:function(t,n,e){var r,o,i,a,c,u,s,l,f=e(7583),d=e(2938),v=e(6683).f,p=e(8117).set,h=e(7020),g=e(3256),m=e(6846),_=e(5354),b=f.MutationObserver||f.WebKitMutationObserver,y=f.document,w=f.process,E=f.Promise,L=v(f,"queueMicrotask"),T=L&&L.value;T||(r=function(){var t,n;for(_&&(t=w.domain)&&t.exit();o;){n=o.fn,o=o.next;try{n()}catch(t){throw o?a():i=void 0,t}}i=void 0,t&&t.enter()},h||_||m||!b||!y?!g&&E&&E.resolve?((s=E.resolve(void 0)).constructor=E,l=d(s.then,s),a=function(){l(r)}):_?a=function(){w.nextTick(r)}:(p=d(p,f),a=function(){p(r)}):(c=!0,u=y.createTextNode(""),new b(r).observe(u,{characterData:!0}),a=function(){u.data=c=!c})),t.exports=T||function(t){var n={fn:t,next:void 0};i&&(i.next=n),o||(o=n,a()),i=n}},783:function(t,n,e){var r=e(7583);t.exports=r.Promise},8640:function(t,n,e){var r=e(4061),o=e(6544);t.exports=!!Object.getOwnPropertySymbols&&!o((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))},9491:function(t,n,e){var r=e(7583),o=e(9212),i=e(9734),a=r.WeakMap;t.exports=o(a)&&/native code/.test(i(a))},5084:function(t,n,e){"use strict";var r=e(8257),o=function(t){var n,e;this.promise=new t((function(t,r){if(void 0!==n||void 0!==e)throw TypeError("Bad Promise constructor");n=t,e=r})),this.resolve=r(n),this.reject=r(e)};t.exports.f=function(t){return new o(t)}},2764:function(t,n,e){var r=e(8320);t.exports=function(t,n){return void 0===t?arguments.length<2?"":n:r(t)}},3590:function(t,n,e){var r,o=e(2569),i=e(8728),a=e(5690),c=e(4639),u=e(482),s=e(6668),l=e(9137),f=l("IE_PROTO"),d=function(){},v=function(t){return"