gc_i18n 1.7.3 → 1.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lang/index.json +4 -0
- package/lib/gc_i18n.es.js +74 -64
- package/lib/gc_i18n.umd.js +16 -16
- package/package.json +1 -1
- package/packages/index.js +95 -69
package/lang/index.json
CHANGED
package/lib/gc_i18n.es.js
CHANGED
|
@@ -3977,67 +3977,74 @@ class X {
|
|
|
3977
3977
|
appCode: o,
|
|
3978
3978
|
orgCode: r || "",
|
|
3979
3979
|
userCode: l || ""
|
|
3980
|
-
}, this.getRequestToken = this.getRequestToken.bind(this), this.requestAuthIdentity = null, this.tokenResolveVersion = 0, this.manualAuthScope = Je(this.authInfo) || (i ? ot(i) : ""), this.authUnsubscribe = null, this.authVersion = 0, this.languageVersion = 0, this.activeCacheScope = this.manualAuthScope || "guest", this.loadI18n = !0, this.appCode = o, this.router = n, this.locale = this.resolveInitialLocale(u), this._isRTL = Ee(this.locale), this.persistI18nConfig(), this.name = "", this.messages = Jn(s || {}), this.translationKeys = [], this.translationKeySet = /* @__PURE__ */ new Set(), this.loginRouteName = a || "login", this.login = d, this.loginTranslationKeys = [], this.keyboard = g || "ctrl+shift+l", this.vueInstances = /* @__PURE__ */ new Set(), this.vueApps = /* @__PURE__ */ new Set(), this.editKeyboard = e.editKeyboard || "ctrl+shift+e", this.applyAuthState(this.resolveAuthState(), { silent: !0 }), this.initI18n(e), this.router && this.initRouterGuards(), kt.bind(this.keyboard, (B) => {
|
|
3981
|
-
if (B.preventDefault(), this.name === this.loginRouteName)
|
|
3982
|
-
return;
|
|
3983
|
-
const x = Array.from(this.translationKeySet);
|
|
3984
|
-
this.translationKeys = Array.from(
|
|
3985
|
-
/* @__PURE__ */ new Set([...this.translationKeys || [], ...x])
|
|
3986
|
-
), this.swalInstance = M.fire({
|
|
3987
|
-
titleText: "多语言管理",
|
|
3988
|
-
padding: "0px",
|
|
3989
|
-
backdrop: !1,
|
|
3990
|
-
allowOutsideClick: !1,
|
|
3991
|
-
heightAuto: !1,
|
|
3992
|
-
showCloseButton: !0,
|
|
3993
|
-
showConfirmButton: !1,
|
|
3994
|
-
width: "1000px",
|
|
3995
|
-
customClass: {
|
|
3996
|
-
container: "gc_i18n_container",
|
|
3997
|
-
title: "gc_i18n_title",
|
|
3998
|
-
closeButton: "gc_i18n_close_button",
|
|
3999
|
-
htmlContainer: "gc_i18n_html_container"
|
|
4000
|
-
},
|
|
4001
|
-
html: '<div id="gc_i18n_config_modal_root"></div>',
|
|
4002
|
-
didOpen: () => {
|
|
4003
|
-
const w = document.getElementById("gc_i18n_config_modal_root");
|
|
4004
|
-
if (!w)
|
|
4005
|
-
return;
|
|
4006
|
-
const C = Co({
|
|
4007
|
-
name: this.name,
|
|
4008
|
-
token: this.token,
|
|
4009
|
-
appCode: this.appCode,
|
|
4010
|
-
baseUrl: this.baseUrl,
|
|
4011
|
-
getRequestToken: this.getRequestToken,
|
|
4012
|
-
translationKeys: this.translationKeys,
|
|
4013
|
-
loginRouteName: this.loginRouteName,
|
|
4014
|
-
loginTranslationKeys: this.loginTranslationKeys,
|
|
4015
|
-
login: this.login,
|
|
4016
|
-
onSaveSuccess: async ({ close: v, message: _ } = {}) => {
|
|
4017
|
-
await this.handleUpdateLanguageSuccess({
|
|
4018
|
-
close: v,
|
|
4019
|
-
message: _
|
|
4020
|
-
});
|
|
4021
|
-
},
|
|
4022
|
-
onError: ({ message: v } = {}) => {
|
|
4023
|
-
this.showConfigToast({
|
|
4024
|
-
message: v,
|
|
4025
|
-
icon: "error"
|
|
4026
|
-
});
|
|
4027
|
-
},
|
|
4028
|
-
onClose: () => {
|
|
4029
|
-
M.close();
|
|
4030
|
-
}
|
|
4031
|
-
});
|
|
4032
|
-
this.configInstance = C, C.mount(w);
|
|
4033
|
-
},
|
|
4034
|
-
willClose: () => {
|
|
4035
|
-
this.configInstance && (this.configInstance.destroy(), this.configInstance = null);
|
|
4036
|
-
}
|
|
4037
|
-
});
|
|
4038
|
-
}), kt.bind(this.editKeyboard, (B) => {
|
|
3980
|
+
}, this.getRequestToken = this.getRequestToken.bind(this), this.requestAuthIdentity = null, this.tokenResolveVersion = 0, this.manualAuthScope = Je(this.authInfo) || (i ? ot(i) : ""), this.authUnsubscribe = null, this.authVersion = 0, this.languageVersion = 0, this.activeCacheScope = this.manualAuthScope || "guest", this.loadI18n = !0, this.appCode = o, this.router = n, this.locale = this.resolveInitialLocale(u), this._isRTL = Ee(this.locale), this.persistI18nConfig(), this.name = "", this.messages = Jn(s || {}), this.translationKeys = [], this.translationKeySet = /* @__PURE__ */ new Set(), this.loginRouteName = a || "login", this.login = d, this.loginTranslationKeys = [], this.keyboard = g || "ctrl+shift+l", this.openConfig = this.openConfig.bind(this), this.vueInstances = /* @__PURE__ */ new Set(), this.vueApps = /* @__PURE__ */ new Set(), this.editKeyboard = e.editKeyboard || "ctrl+shift+e", this.applyAuthState(this.resolveAuthState(), { silent: !0 }), this.initI18n(e), this.router && this.initRouterGuards(), kt.bind(this.keyboard, this.openConfig), kt.bind(this.editKeyboard, (B) => {
|
|
4039
3981
|
B.preventDefault(), hr.toggle();
|
|
4040
|
-
}), this.setupLanguageChangeListener(), this.setupAuthListener(), this.setupMessageListener();
|
|
3982
|
+
}), this.setupLanguageChangeListener(), this.setupAuthListener(), this.setupMessageListener(), this.setupConfigRequestListener();
|
|
3983
|
+
}
|
|
3984
|
+
/**
|
|
3985
|
+
* 打开多语言配置弹窗,供快捷键、实例方法和 Vue 全局方法复用。
|
|
3986
|
+
* @param {Event} [event] - 快捷键或配置请求事件
|
|
3987
|
+
* @returns {Promise|undefined} SweetAlert 弹窗结果
|
|
3988
|
+
*/
|
|
3989
|
+
openConfig(e) {
|
|
3990
|
+
var o;
|
|
3991
|
+
if ((o = e == null ? void 0 : e.preventDefault) == null || o.call(e), this.name === this.loginRouteName)
|
|
3992
|
+
return;
|
|
3993
|
+
const n = Array.from(this.translationKeySet);
|
|
3994
|
+
return this.translationKeys = Array.from(
|
|
3995
|
+
/* @__PURE__ */ new Set([...this.translationKeys || [], ...n])
|
|
3996
|
+
), this.swalInstance = M.fire({
|
|
3997
|
+
titleText: "多语言管理",
|
|
3998
|
+
padding: "0px",
|
|
3999
|
+
backdrop: !1,
|
|
4000
|
+
allowOutsideClick: !1,
|
|
4001
|
+
heightAuto: !1,
|
|
4002
|
+
showCloseButton: !0,
|
|
4003
|
+
showConfirmButton: !1,
|
|
4004
|
+
width: "1000px",
|
|
4005
|
+
customClass: {
|
|
4006
|
+
container: "gc_i18n_container",
|
|
4007
|
+
title: "gc_i18n_title",
|
|
4008
|
+
closeButton: "gc_i18n_close_button",
|
|
4009
|
+
htmlContainer: "gc_i18n_html_container"
|
|
4010
|
+
},
|
|
4011
|
+
html: '<div id="gc_i18n_config_modal_root"></div>',
|
|
4012
|
+
didOpen: () => {
|
|
4013
|
+
const s = document.getElementById("gc_i18n_config_modal_root");
|
|
4014
|
+
if (!s)
|
|
4015
|
+
return;
|
|
4016
|
+
const i = Co({
|
|
4017
|
+
name: this.name,
|
|
4018
|
+
token: this.token,
|
|
4019
|
+
appCode: this.appCode,
|
|
4020
|
+
baseUrl: this.baseUrl,
|
|
4021
|
+
getRequestToken: this.getRequestToken,
|
|
4022
|
+
translationKeys: this.translationKeys,
|
|
4023
|
+
loginRouteName: this.loginRouteName,
|
|
4024
|
+
loginTranslationKeys: this.loginTranslationKeys,
|
|
4025
|
+
login: this.login,
|
|
4026
|
+
onSaveSuccess: async ({ close: r, message: l } = {}) => {
|
|
4027
|
+
await this.handleUpdateLanguageSuccess({
|
|
4028
|
+
close: r,
|
|
4029
|
+
message: l
|
|
4030
|
+
});
|
|
4031
|
+
},
|
|
4032
|
+
onError: ({ message: r } = {}) => {
|
|
4033
|
+
this.showConfigToast({
|
|
4034
|
+
message: r,
|
|
4035
|
+
icon: "error"
|
|
4036
|
+
});
|
|
4037
|
+
},
|
|
4038
|
+
onClose: () => {
|
|
4039
|
+
M.close();
|
|
4040
|
+
}
|
|
4041
|
+
});
|
|
4042
|
+
this.configInstance = i, i.mount(s);
|
|
4043
|
+
},
|
|
4044
|
+
willClose: () => {
|
|
4045
|
+
this.configInstance && (this.configInstance.destroy(), this.configInstance = null);
|
|
4046
|
+
}
|
|
4047
|
+
}), this.swalInstance;
|
|
4041
4048
|
}
|
|
4042
4049
|
/**
|
|
4043
4050
|
* 严格校验语言代码,不支持的值统一回退到简体中文
|
|
@@ -4217,6 +4224,9 @@ class X {
|
|
|
4217
4224
|
}
|
|
4218
4225
|
}
|
|
4219
4226
|
}
|
|
4227
|
+
setupConfigRequestListener() {
|
|
4228
|
+
this.configRequestListenerRegistered || typeof window > "u" || typeof window.addEventListener != "function" || (this.configRequestListenerRegistered = !0, window.addEventListener("gc-i18n-config-request", this.openConfig));
|
|
4229
|
+
}
|
|
4220
4230
|
showConfigToast({ message: e, icon: n = "success" } = {}) {
|
|
4221
4231
|
setTimeout(() => {
|
|
4222
4232
|
M.fire({
|
|
@@ -4329,7 +4339,7 @@ class X {
|
|
|
4329
4339
|
} else
|
|
4330
4340
|
u = g();
|
|
4331
4341
|
return u === o && typeof s == "string" && s && (u = s), u = ge(u, i), typeof o == "string" && typeof u == "string" && (n.keyValueMap[u] = o, globalThis.__I18N_KEY_VALUE_MAP__ || (globalThis.__I18N_KEY_VALUE_MAP__ = {}), globalThis.__I18N_KEY_VALUE_MAP__[u] = o), u;
|
|
4332
|
-
}, this.t = globalThis.$t, globalThis.$deepScan = function(o) {
|
|
4342
|
+
}, this.t = globalThis.$t, globalThis.$openI18nConfig = this.openConfig, globalThis.$deepScan = function(o) {
|
|
4333
4343
|
return o;
|
|
4334
4344
|
}, globalThis.__GC_I18N_GET_REQUEST_TOKEN__ = this.getRequestToken, globalThis.$clearI18n = this.clearI18n = () => {
|
|
4335
4345
|
At({
|
|
@@ -4512,7 +4522,7 @@ class X {
|
|
|
4512
4522
|
install(e, n = {}) {
|
|
4513
4523
|
if (eo(e)) {
|
|
4514
4524
|
const o = Ct(e);
|
|
4515
|
-
if (o.prototype.$t = this.t || globalThis.$t, o.prototype.$i18n = this.i18n, !X._vue2UpdateMixinRegistered && o.mixin) {
|
|
4525
|
+
if (o.prototype.$t = this.t || globalThis.$t, o.prototype.$i18n = this.i18n, o.prototype.$openI18nConfig = this.openConfig, !X._vue2UpdateMixinRegistered && o.mixin) {
|
|
4516
4526
|
X._vue2UpdateMixinRegistered = !0;
|
|
4517
4527
|
const s = this;
|
|
4518
4528
|
o.mixin({
|
|
@@ -4524,7 +4534,7 @@ class X {
|
|
|
4524
4534
|
}
|
|
4525
4535
|
});
|
|
4526
4536
|
}
|
|
4527
|
-
} else if (this.vueApps.add(e), e.config.globalProperties.$t = this.t || globalThis.$t, e.config.globalProperties.$i18n = this.i18n, e.mixin) {
|
|
4537
|
+
} else if (this.vueApps.add(e), e.config.globalProperties.$t = this.t || globalThis.$t, e.config.globalProperties.$i18n = this.i18n, e.config.globalProperties.$openI18nConfig = this.openConfig, e.mixin) {
|
|
4528
4538
|
const o = this;
|
|
4529
4539
|
e.mixin({
|
|
4530
4540
|
beforeCreate() {
|
|
@@ -4544,7 +4554,7 @@ class X {
|
|
|
4544
4554
|
default: this.baseUrl
|
|
4545
4555
|
}
|
|
4546
4556
|
}
|
|
4547
|
-
}), this.setupMessageListener();
|
|
4557
|
+
}), this.setupMessageListener(), this.setupConfigRequestListener();
|
|
4548
4558
|
}
|
|
4549
4559
|
}
|
|
4550
4560
|
export {
|
package/lib/gc_i18n.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(j,ie){typeof exports=="object"&&typeof module<"u"?ie(exports,require("keyboardjs"),require("vue-demi"),require("axios"),require("store2"),require("lodash-es"),require("jsrsasign")):typeof define=="function"&&define.amd?define(["exports","keyboardjs","vue-demi","axios","store2","lodash-es","jsrsasign"],ie):(j=typeof globalThis<"u"?globalThis:j||self,ie(j.gc_i18n={},j.keyboardJS,j.Vue,j.Axios,j.store2,j._,j.jsrsasign))})(this,(function(j,ie,B,He,
|
|
1
|
+
(function(j,ie){typeof exports=="object"&&typeof module<"u"?ie(exports,require("keyboardjs"),require("vue-demi"),require("axios"),require("store2"),require("lodash-es"),require("jsrsasign")):typeof define=="function"&&define.amd?define(["exports","keyboardjs","vue-demi","axios","store2","lodash-es","jsrsasign"],ie):(j=typeof globalThis<"u"?globalThis:j||self,ie(j.gc_i18n={},j.keyboardJS,j.Vue,j.Axios,j.store2,j._,j.jsrsasign))})(this,(function(j,ie,B,He,x,w,Qn){"use strict";const eo=["ar-SA","ar-EG","fa-IR"],Ee=t=>{if(!t||typeof t!="string")return!1;if(eo.includes(t))return!0;const e=t.split("-")[0].toLowerCase();return["ar","fa"].includes(e)},to=t=>{const e={};for(const n of t)e[n.key]=n.value;return e},no=(t,e,n)=>(e.forEach(o=>{const s=o.key.split(".");s[0]==="common"&&w.find(t,{key:`${n}.${s[1]}`})&&w.remove(t,{key:`${n}.${s[1]}`});const i=w.find(t,{key:o.key});i?w.merge(i,o):t.push(o)}),t),re=He.create({timeout:8e3}),Te=new Map,oo="https://extendapi.ihotel.cn",so="https://test.ihotel.cn",io=/^https?:\/\//i,Fe=t=>String(t||"guest").replace(/[^\w-]/g,"_"),we=async(t,e)=>typeof e!="function"?t:await e(t)||t,kt=({env:t,dev:e}={})=>{const n=typeof t=="string"?t.trim():t;return typeof n=="string"&&io.test(n)?n.replace(/\/+$/,""):n==="dev"||e===!0?so:!n||n==="local"?"":oo},_t=async({baseUrl:t,token:e,appCode:n,isRemote:o=!1,getRequestToken:s})=>{const i=x.get("I18N_LANGUAGES");if(i&&Array.isArray(i)&&i.length>0&&!o)return i.map(r=>({langCode:r.language||r.langCode||r,langName:r.langName||r.language||r}));if(!n)return[];try{const r=await we(e,s),l=await re.get(`${t}/i18n-web//app/getsupportedlangs`,{headers:{appCode:n,Authorization:r}});if(l.data&&l.data.result===0){const a=w.get(l.data,"retVal",[]),d=a.map(g=>({langCode:g.language||g.langCode||g,langName:g.langName||g.language||g}));return x.set("I18N_LANGUAGES",a),d}}catch(r){console.error("获取语言列表失败:",r)}return[]},xt=async({baseUrl:t,token:e,appCode:n,getRequestToken:o})=>{const s=await we(e,o);return re.get(t+"/i18n-web/app/getsupportedlangs?appCode="+n,{headers:{Authorization:s}})},Et=async({appCode:t,language:e="zh-CN",lastPullDate:n,baseUrl:o,token:s,getRequestToken:i})=>{try{const r=await we(s,i),l=o+"/i18n-web/kv_translate/kv_translates",a=n?l+"?lastPullDate="+n:l,d=await re({url:a,method:"GET",headers:{appCode:t,language:e,Authorization:r}});return d.data&&d.data.result==0?d.data.retVal:d}catch(r){return console.error("获取翻译数据失败:",r),null}},Tt=async({data:t,token:e,baseUrl:n,getRequestToken:o})=>{const s=await we(e,o);return re({url:n+"/i18n-web/kv_translate/userDicts",method:"POST",headers:{Authorization:s},data:t})},At=async({data:t,token:e,baseUrl:n,getRequestToken:o})=>{const s=await we(e,o);return re({url:n+"/i18n-web/kv_translate/batch",method:"POST",data:t,headers:{Authorization:s}})},St=t=>{if(typeof t=="string"){const e=t.trim();return!e||/^<!doctype/i.test(e)||/^<html/i.test(e)?(console.warn("i18n_token 接口未返回有效 token,请检查业务项目接口"),""):e}return w.get(t,"retVal.i18n_token")||w.get(t,"retVal.token")||w.get(t,"i18n_token")||w.get(t,"token")||""},ro=async({request:t,appCode:e,orgCode:n,userCode:o,token:s})=>{if(typeof t=="function"){const r=await t({appCode:e,orgCode:n,userCode:o,token:s});return St((r==null?void 0:r.data)??r)}const i=await re({url:"/i18n_token",method:"GET",headers:s?{Accept:"application/json",Authorization:s}:{Accept:"application/json"},params:{appCode:e,orgCode:n,userCode:o}});return St(i==null?void 0:i.data)},ao=async({baseUrl:t,appCode:e,language:n="zh-CN",token:o,routerName:s,cacheScope:i="guest",getRequestToken:r})=>{try{const l=Fe(i),a=`I18N_${w.toUpper(e)}_${l}`,d=x.namespace(a),g={baseUrl:t,appCode:e,language:n,token:o,getRequestToken:r},u=d.get(n),h=[t||"",e||"",n||"",l,o||"",w.get(u,"lastPullDate","")].join("|");if(Te.has(h))return Te.get(h);const _=(async()=>{if(!u||!u.lastPullDate){const E=await Et(g);return E?(d.set(n,E),w.get(E,"translatesDTOs",[])):w.get(u,"translatesDTOs",[])}const{lastPullDate:L}=u,S=await Et({...g,lastPullDate:L});if(!S)return w.get(u,"translatesDTOs",[]);const O=w.get(u,"translatesDTOs",[]);if(!w.isEmpty(S.translatesDTOs)){const E=no(O,S.translatesDTOs,s),m={lastPullDate:S.lastPullDate,translatesDTOs:E};return d.set(n,m,":"),E}return O})();return Te.set(h,_),_.finally(()=>{Te.delete(h)}),_}catch(l){console.error("处理翻译数据失败:",l);const a=Fe(i),d=x.namespace(`I18N_${w.toUpper(e)}_${a}`);return w.get(d.get(n),"translatesDTOs",[])}},Lt=({appCode:t,cacheScope:e}={})=>{if(t){if(e){x.namespace(`I18N_${w.toUpper(t)}_${Fe(e)}`).clearAll();return}x.namespace(`I18N_${w.toUpper(t)}`).clearAll()}};function $t(t){const e=t||"",n=lo(e);return Nt(n?[{type:"locked",value:e.slice(0,n.questionIndex+1)},...It(e.slice(n.questionIndex+1,n.colonIndex)),{type:"locked",value:":"},...It(e.slice(n.colonIndex+1,n.endIndex)),{type:"locked",value:e.slice(n.endIndex)}]:Pt(e))}function lo(t){let e=0,n="",o=-1,s=-1;for(let i=0;i<t.length;i++){const r=t[i],l=t[i-1];if(n){r===n&&l!=="\\"&&(n="");continue}if(r==="'"||r==='"'){n=r;continue}if(r==="{"||r==="("||r==="["){e++;continue}if(r==="}"||r===")"||r==="]"){e=Math.max(e-1,0);continue}if(r==="?"&&o===-1){o=i,s=e;continue}if(r===":"&&o>-1&&e===s)return{questionIndex:o,colonIndex:i,endIndex:co(t,i+1,s)}}return null}function co(t,e,n){let o=n,s="";for(let i=e;i<t.length;i++){const r=t[i],l=t[i-1];if(s){r===s&&l!=="\\"&&(s="");continue}if(r==="'"||r==='"'){s=r;continue}if(r==="{"||r==="("||r==="["){o++;continue}if(r==="}"||r===")"||r==="]"){if(o===n)return i;o=Math.max(o-1,n)}}return t.length}function It(t){const e=[],n=t.match(/^\s*/)[0],o=t.match(/\s*$/)[0],s=n.length,i=t.length-o.length;let r=t.slice(s,i);n&&e.push({type:"locked",value:n});const l=r[0],a=(l==="'"||l==='"')&&r.length>1&&r[r.length-1]===l;return a&&(e.push({type:"locked",value:l}),r=r.slice(1,-1)),e.push(...Pt(r)),a&&e.push({type:"locked",value:l}),o&&e.push({type:"locked",value:o}),e}function Pt(t){const e=/(\$\{[^}]*\}|\{\{[^}]*\}\}|\{[^{}]*\})/g,n=[];let o=0,s;for(;s=e.exec(t);)s.index>o&&n.push({type:"text",value:t.slice(o,s.index)}),n.push({type:"locked",value:s[0]}),o=s.index+s[0].length;return o<t.length&&n.push({type:"text",value:t.slice(o)}),n.length?n:[{type:"text",value:t}]}function Nt(t){return w.reduce(t,(e,n)=>{const o=e[e.length-1];return!n.value&&n.type==="locked"||(o&&o.type===n.type?o.value+=n.value:e.push({...n})),e},[])}const I=t=>String(t??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),Ke=t=>(t==null?void 0:t.data)??t,uo=t=>String(t||"").trim(),ho=t=>({...t,langCode:t.language||t.langCode||t,langName:t.langName||t.language||t.langCode||t,langNameNative:t.langNameNative||t.nativeName||""}),fo=t=>({[t]:!0}),go=["GREENCLOUD","GCBZG"],po=t=>{const n=String(t||"").replace(/^Bearer\s+/i,"").split(".")[1];if(!n)return{};try{const o=n.replace(/-/g,"+").replace(/_/g,"/"),s=o.padEnd(o.length+(4-o.length%4)%4,"="),i=typeof atob=="function"?decodeURIComponent(Array.from(atob(s),r=>`%${r.charCodeAt(0).toString(16).padStart(2,"0")}`).join("")):Buffer.from(s,"base64").toString("utf8");return JSON.parse(i)}catch{return{}}},Ge=t=>{window.postMessage(t,"*");try{window.parent&&window.parent!==window&&window.parent.postMessage(t,"*")}catch{}try{window.top&&window.top!==window&&window.top!==window.parent&&window.top.postMessage(t,"*")}catch{}window.opener&&window.opener.postMessage(t,"*")};class wo{constructor(e={}){this.name=e.name||"",this.appCode=e.appCode||"",this.token=e.token||"",this.getRequestToken=e.getRequestToken,this.baseUrl=e.baseUrl||"",this.translationKeys=e.translationKeys||[],this.loginRouteName=e.loginRouteName||"login",this.loginTranslationKeys=e.loginTranslationKeys||[],this.login=e.login===!0,this.onSaveSuccess=e.onSaveSuccess,this.onError=e.onError,this.onClose=e.onClose,this.orgCode=po(this.token).orgCode||"",this.root=null,this.loading=!1,this.languageSettingVisible=!1,this.searchText="",this.type="pageData",this.languages=[],this.mySaveData=[],this.data=[],this.page={pageSize:10,firstResult:0,totalRows:0},this.status={type:"",text:""},this.toast=null,this.toastTimer=null,this.editor=null,this.handleRootClick=this.handleRootClick.bind(this),this.handleRootInput=this.handleRootInput.bind(this),this.handleRootKeydown=this.handleRootKeydown.bind(this),this.handleDocumentClick=this.handleDocumentClick.bind(this)}async mount(e){this.root=e,this.root.classList.add("gc_i18n_config_modal"),this.root.addEventListener("click",this.handleRootClick),this.root.addEventListener("input",this.handleRootInput),this.root.addEventListener("keydown",this.handleRootKeydown),document.addEventListener("click",this.handleDocumentClick,!0),this.render(),await this.init()}destroy(){this.root&&(this.clearSystemDefaultNoticeFromTitle(),this.root.removeEventListener("click",this.handleRootClick),this.root.removeEventListener("input",this.handleRootInput),this.root.removeEventListener("keydown",this.handleRootKeydown),document.removeEventListener("click",this.handleDocumentClick,!0),this.toastTimer&&(clearTimeout(this.toastTimer),this.toastTimer=null),this.root.innerHTML="",this.root=null)}getCurrentPageName(){return this.type==="loginData"?this.loginRouteName:this.type==="pageData"?this.name:"common"}get isSystemDefaultEditor(){return go.includes(String(this.orgCode).toUpperCase())}renderSystemDefaultNotice(){return this.isSystemDefaultEditor?`
|
|
2
2
|
<span class="gc_i18n_config_system_notice" role="status">
|
|
3
3
|
<span aria-hidden="true">⚠</span>
|
|
4
4
|
<span>当前账号正在维护系统默认翻译,修改可能影响使用默认配置的单位。</span>
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<span><i class="gc_i18n_config_legend_bar gc_i18n_config_legend_bar_application"></i>继承本应用通用</span>
|
|
14
14
|
<span><i class="gc_i18n_config_legend_bar gc_i18n_config_legend_bar_system"></i>继承系统默认</span>
|
|
15
15
|
</div>
|
|
16
|
-
`}getSourcePresentation(e){const n=this.type==="loginData"?"登录页面":"当前页面",o=e==="SYSTEM_PAGE"||e==="SYSTEM_COMMON",s=this.isSystemDefaultEditor&&o?e==="SYSTEM_PAGE"?"UNIT_PAGE":"UNIT_COMMON":e,r={UNIT_PAGE:{className:"current",detail:`当前值来源:${n}专属配置`},UNIT_COMMON:{className:"application",detail:`当前值来源:本应用通用配置。修改后将保存为${n}专属配置`},SYSTEM_PAGE:{className:"system",detail:`当前值来源:系统默认的${n}配置`},SYSTEM_COMMON:{className:"system",detail:"当前值来源:系统默认的本应用通用配置"}}[s];return r&&o&&this.isSystemDefaultEditor&&(r.detail=e==="SYSTEM_PAGE"?`当前值来源:系统默认的${n}配置`:"当前值来源:系统默认的本应用通用配置"),!r||this.type==="data"&&s==="UNIT_COMMON"?null:r}setStatus(e,n){this.status={type:e,text:n},this.renderStatus()}showToast(e,n="success"){this.toastTimer&&clearTimeout(this.toastTimer),this.toast={text:e,type:n},this.renderToast(),this.toastTimer=setTimeout(()=>{this.toast=null,this.toastTimer=null,this.renderToast()},1800)}showError(e){const n=e||"操作失败";if(typeof this.onError=="function"){this.onError({message:n});return}Ge({type:"configError",message:n})}async init(){this.loading=!0,this.render();try{let e=
|
|
16
|
+
`}getSourcePresentation(e){const n=this.type==="loginData"?"登录页面":"当前页面",o=e==="SYSTEM_PAGE"||e==="SYSTEM_COMMON",s=this.isSystemDefaultEditor&&o?e==="SYSTEM_PAGE"?"UNIT_PAGE":"UNIT_COMMON":e,r={UNIT_PAGE:{className:"current",detail:`当前值来源:${n}专属配置`},UNIT_COMMON:{className:"application",detail:`当前值来源:本应用通用配置。修改后将保存为${n}专属配置`},SYSTEM_PAGE:{className:"system",detail:`当前值来源:系统默认的${n}配置`},SYSTEM_COMMON:{className:"system",detail:"当前值来源:系统默认的本应用通用配置"}}[s];return r&&o&&this.isSystemDefaultEditor&&(r.detail=e==="SYSTEM_PAGE"?`当前值来源:系统默认的${n}配置`:"当前值来源:系统默认的本应用通用配置"),!r||this.type==="data"&&s==="UNIT_COMMON"?null:r}setStatus(e,n){this.status={type:e,text:n},this.renderStatus()}showToast(e,n="success"){this.toastTimer&&clearTimeout(this.toastTimer),this.toast={text:e,type:n},this.renderToast(),this.toastTimer=setTimeout(()=>{this.toast=null,this.toastTimer=null,this.renderToast()},1800)}showError(e){const n=e||"操作失败";if(typeof this.onError=="function"){this.onError({message:n});return}Ge({type:"configError",message:n})}async init(){this.loading=!0,this.render();try{let e=x.get("I18N_LANGUAGE_SETTING");const n=await xt({token:this.token,getRequestToken:this.getRequestToken,baseUrl:this.baseUrl,appCode:this.appCode}),o=Ke(n);o&&o.result===0?(w.isEmpty(e)&&(e=["zh-CN","en-US","zh-TW"]),this.languages=w.map(o.retVal||[],s=>{const i=ho(s);return{...i,checked:w.includes(e,i.langCode)}}),await this.getPageData()):(this.loading=!1,this.showError("获取语言失败,出错了"),this.render())}catch(e){console.error("获取语言失败:",e),this.loading=!1,this.showError("获取语言失败,出错了"),this.render()}}saveLanguageSetting(){const e=w.map(w.filter(this.languages,n=>n.checked),"langCode");x.set("I18N_LANGUAGE_SETTING",e)}async inputSearch(){this.type==="pageData"?await this.getPageData():await this.search()}closeModal(){if(this.searchText="",this.type="pageData",typeof this.onClose=="function"){this.onClose();return}Ge({type:"closeModal"})}updateTranslationValue(e,n,o){const{dictKey:s}=e,i=w.findIndex(this.mySaveData,{dictKey:s});e[n]=o,e[`${n}_fromAi`]="F",i>-1?(this.mySaveData[i][n]=o,this.mySaveData[i][`${n}_fromAi`]="F",this.mySaveData[i].changedLangs={...this.mySaveData[i].changedLangs,[n]:!0}):this.mySaveData.push({dictKey:s,[n]:o,[`${n}_fromAi`]:"F",page:this.getCurrentPageName(),changedLangs:fo(n)})}isProtectedValue(e){return w.some($t(e),{type:"locked"})}isProtectedEditor(){var e;return w.some(((e=this.editor)==null?void 0:e.parts)||[],{type:"locked"})}openEditor(e,n){const o=this.data[e];if(!o)return;const s=uo(o[n]);this.editor={rowIndex:e,key:n,value:s,parts:$t(s)},this.render()}syncEditorPartsFromDom(){var n;const e=(n=this.root)==null?void 0:n.querySelector(".gc_i18n_config_protected_editor");!e||!this.editor||w.forEach(e.querySelectorAll("[data-editor-index]"),o=>{const s=Number(o.dataset.editorIndex),i=this.editor.parts[s];i&&i.type==="text"&&(i.value=o.innerText)})}getEditorSubmitValue(){return this.editor?this.isProtectedEditor()?(this.syncEditorPartsFromDom(),w.map(this.editor.parts,"value").join("")):this.editor.value:""}confirmEditor(){if(!this.editor)return;const e=this.data[this.editor.rowIndex];e&&this.updateTranslationValue(e,this.editor.key,this.getEditorSubmitValue()),this.editor=null,this.render()}cancelEditor(){this.editor=null,this.render()}getSubmitData(){const e=[];return w.map(this.mySaveData,n=>{w.map(w.keys(n.changedLangs||{}),o=>{e.push({key:n.dictKey,page:n.page,lang:o,value:n[o],fromAi:n[`${o}_fromAi`]})})}),e}async saveData({msg:e="保存成功"}={},n=!0){const o=this.getSubmitData();if(w.isEmpty(o)){this.showError("没有需要保存的数据");return}try{const s=await At({baseUrl:this.baseUrl,data:{appCode:this.appCode,isLocal:"F",data:o},token:this.token,getRequestToken:this.getRequestToken}),i=Ke(s);if(i&&i.result===0){this.mySaveData=[];const r=e||i.msg||"保存成功";typeof this.onSaveSuccess=="function"?await this.onSaveSuccess({data:o,close:n,message:r}):Ge({type:"updateLanguage",data:o,close:n,message:r})}else{const r=(i==null?void 0:i.msg)||"保存失败";this.showError(r)}}catch(s){console.error("保存失败:",s),this.showError("保存失败")}}async saveNoEqual(){w.isEmpty(this.mySaveData)||await this.saveData({msg:"已为您自动保存"},!1)}async changePage(e){await this.saveNoEqual();const n=(e-1)*this.page.pageSize;this.type==="pageData"?await this.getPageData({firstResult:n}):await this.search({firstResult:n})}async getPageData(e){var n;await this.search({...e,commaSeparatedKeys:(n=this.translationKeys)==null?void 0:n.toString()},"pageData")}async getLoginData(e){await this.search({...e,page:this.loginRouteName,commaSeparatedKeys:this.loginTranslationKeys.toString()},"pageData")}async search(e,n){this.loading=!0,this.render();try{const o=await Tt({baseUrl:this.baseUrl,data:{appCode:this.appCode,searchBlur:this.searchText,commaSeparatedLangs:w.map(this.languages,"langCode").toString(),page:n==="loginData"?this.loginRouteName:n==="pageData"?this.name:"common",pageSize:10,...e},token:this.token,getRequestToken:this.getRequestToken}),s=Ke(o);if(s&&s.result===0){const i=s.retVal||{};this.data=w.cloneDeep(i.datas||[]),this.page={firstResult:i.firstResult||0,pageSize:i.pageSize||10,totalRows:i.totalRows||0},this.setStatus("","")}else this.data=[],this.setStatus("",""),this.showError((s==null?void 0:s.msg)||"查询失败")}catch(o){console.error("查询翻译失败:",o),this.data=[],this.setStatus("",""),this.showError("查询失败")}finally{this.loading=!1,this.render()}}async changeTab(e){this.type=e,this.mySaveData=[],e==="data"?await this.search():e==="pageData"?await this.getPageData():e==="loginData"&&await this.getLoginData()}handleRootClick(e){var i;const o=e.target.closest("[data-action]");if(!o||!((i=this.root)!=null&&i.contains(o)))return;const s=o.dataset.action;s==="tab"?this.changeTab(o.dataset.tab):s==="toggle-languages"?(this.languageSettingVisible=!this.languageSettingVisible,this.render()):s==="search"?this.inputSearch():s==="prev-page"?this.changePage(this.currentPage-1):s==="next-page"?this.changePage(this.currentPage+1):s==="save"?this.saveData():s==="expand"?this.openEditor(Number(o.dataset.rowIndex),o.dataset.lang):s==="editor-ok"?this.confirmEditor():s==="editor-cancel"&&this.cancelEditor()}handleRootInput(e){const n=e.target;if(n.matches("[data-action='search-input']")){this.searchText=n.value;return}if(n.matches("[data-action='language-check']")){const o=this.languages[Number(n.dataset.index)];o&&(o.checked=n.checked,this.saveLanguageSetting(),this.render());return}if(n.matches("[data-action='translation-input']")){const o=this.data[Number(n.dataset.rowIndex)],s=n.dataset.lang;o&&s&&!this.isProtectedValue(o[s])&&this.updateTranslationValue(o,s,n.value);return}n.matches("[data-action='editor-textarea']")&&this.editor&&(this.editor.value=n.value)}handleRootKeydown(e){e.target.matches("[data-action='search-input']")&&e.key==="Enter"&&(e.preventDefault(),this.inputSearch())}handleDocumentClick(e){var n;!this.languageSettingVisible||(n=this.root)!=null&&n.contains(e.target)||(this.languageSettingVisible=!1,this.render())}preventRichTextPaste(e){var o;e.preventDefault();const n=((o=e.clipboardData)==null?void 0:o.getData("text/plain"))||"";document.execCommand("insertText",!1,n)}get currentPage(){return Math.floor(this.page.firstResult/this.page.pageSize)+1}get totalPages(){return Math.max(1,Math.ceil((this.page.totalRows||0)/this.page.pageSize))}get checkedLanguages(){return w.filter(this.languages,e=>e.checked)}renderStatus(){var n;const e=(n=this.root)==null?void 0:n.querySelector(".gc_i18n_config_status");e&&(e.className=`gc_i18n_config_status${this.status.type?` gc_i18n_config_status_${this.status.type}`:""}`,e.textContent=this.status.text||"")}renderToast(){var o;const e=(o=this.root)==null?void 0:o.querySelector(".gc_i18n_config_toast");if(e&&e.remove(),!this.root||!this.toast)return;const n=document.createElement("div");n.className=`gc_i18n_config_toast${this.toast.type==="error"?" gc_i18n_config_toast_error":""}`,n.textContent=this.toast.text,this.root.appendChild(n)}render(){if(!this.root)return;this.root.innerHTML=`
|
|
17
17
|
${this.renderTabs()}
|
|
18
18
|
<div class="gc_i18n_config_body">
|
|
19
19
|
${this.loading?this.renderLoading():this.renderTable()}
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
`).join("")}
|
|
83
83
|
</div>`:""}
|
|
84
84
|
</div>
|
|
85
|
-
`}renderLoading(){return'<div class="gc_i18n_config_loading">加载中...</div>'}renderTable(){return
|
|
85
|
+
`}renderLoading(){return'<div class="gc_i18n_config_loading">加载中...</div>'}renderTable(){return w.isEmpty(this.data)?`
|
|
86
86
|
<div class="gc_i18n_config_table_wrap">
|
|
87
87
|
<div class="gc_i18n_config_empty">暂无数据</div>
|
|
88
88
|
</div>
|
|
@@ -192,7 +192,7 @@
|
|
|
192
192
|
`}renderProtectedEditor(){return`<div class="gc_i18n_config_protected_editor">${this.editor.parts.map((n,o)=>n.type==="text"?`<span class="gc_i18n_config_editor_text" contenteditable="true" spellcheck="false" data-editor-index="${o}">${I(n.value)}</span>`:`<span class="gc_i18n_config_editor_locked" contenteditable="false">${I(n.value)}</span>`).join("")}</div>`}}function mo(t){return new wo(t)}/*!
|
|
193
193
|
* sweetalert2 v11.26.18
|
|
194
194
|
* Released under the MIT License.
|
|
195
|
-
*/function Bt(t,e,n){if(typeof t=="function"?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function bo(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Mt(t,e){return t.get(Bt(t,e))}function yo(t,e,n){bo(t,e),e.set(t,n)}function vo(t,e,n){return t.set(Bt(t,e),n),n}const Co=100,p={},ko=()=>{p.previousActiveElement instanceof HTMLElement?(p.previousActiveElement.focus(),p.previousActiveElement=null):document.body&&document.body.focus()},_o=t=>new Promise(e=>{if(!t)return e();const n=window.scrollX,o=window.scrollY;p.restoreFocusTimeout=setTimeout(()=>{ko(),e()},Co),window.scrollTo(n,o)}),Rt="swal2-",c=["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","show","hide","close","title","html-container","actions","confirm","deny","cancel","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","input-label","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loader","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error","draggable","dragging"].reduce((t,e)=>(t[e]=Rt+e,t),{}),Ae=["success","warning","info","question","error"].reduce((t,e)=>(t[e]=Rt+e,t),{}),Ot="SweetAlert2:",We=t=>t.charAt(0).toUpperCase()+t.slice(1),
|
|
195
|
+
*/function Bt(t,e,n){if(typeof t=="function"?t===e:t.has(e))return arguments.length<3?e:n;throw new TypeError("Private element is not present on this object")}function bo(t,e){if(e.has(t))throw new TypeError("Cannot initialize the same private elements twice on an object")}function Mt(t,e){return t.get(Bt(t,e))}function yo(t,e,n){bo(t,e),e.set(t,n)}function vo(t,e,n){return t.set(Bt(t,e),n),n}const Co=100,p={},ko=()=>{p.previousActiveElement instanceof HTMLElement?(p.previousActiveElement.focus(),p.previousActiveElement=null):document.body&&document.body.focus()},_o=t=>new Promise(e=>{if(!t)return e();const n=window.scrollX,o=window.scrollY;p.restoreFocusTimeout=setTimeout(()=>{ko(),e()},Co),window.scrollTo(n,o)}),Rt="swal2-",c=["container","shown","height-auto","iosfix","popup","modal","no-backdrop","no-transition","toast","toast-shown","show","hide","close","title","html-container","actions","confirm","deny","cancel","footer","icon","icon-content","image","input","file","range","select","radio","checkbox","label","textarea","inputerror","input-label","validation-message","progress-steps","active-progress-step","progress-step","progress-step-line","loader","loading","styled","top","top-start","top-end","top-left","top-right","center","center-start","center-end","center-left","center-right","bottom","bottom-start","bottom-end","bottom-left","bottom-right","grow-row","grow-column","grow-fullscreen","rtl","timer-progress-bar","timer-progress-bar-container","scrollbar-measure","icon-success","icon-warning","icon-info","icon-question","icon-error","draggable","dragging"].reduce((t,e)=>(t[e]=Rt+e,t),{}),Ae=["success","warning","info","question","error"].reduce((t,e)=>(t[e]=Rt+e,t),{}),Ot="SweetAlert2:",We=t=>t.charAt(0).toUpperCase()+t.slice(1),q=t=>{console.warn(`${Ot} ${typeof t=="object"?t.join(" "):t}`)},ee=t=>{console.error(`${Ot} ${t}`)},Dt=[],xo=t=>{Dt.includes(t)||(Dt.push(t),q(t))},qt=(t,e=null)=>{xo(`"${t}" is deprecated and will be removed in the next major release.${e?` Use "${e}" instead.`:""}`)},Se=t=>typeof t=="function"?t():t,Ye=t=>t&&typeof t.toPromise=="function",me=t=>Ye(t)?t.toPromise():Promise.resolve(t),Ze=t=>t&&Promise.resolve(t)===t,U=()=>document.body.querySelector(`.${c.container}`),be=t=>{const e=U();return e?e.querySelector(t):null},V=t=>be(`.${t}`),T=()=>V(c.popup),ae=()=>V(c.icon),Eo=()=>V(c["icon-content"]),Ut=()=>V(c.title),Xe=()=>V(c["html-container"]),zt=()=>V(c.image),Je=()=>V(c["progress-steps"]),Le=()=>V(c["validation-message"]),G=()=>be(`.${c.actions} .${c.confirm}`),le=()=>be(`.${c.actions} .${c.cancel}`),te=()=>be(`.${c.actions} .${c.deny}`),To=()=>V(c["input-label"]),ce=()=>be(`.${c.loader}`),ye=()=>V(c.actions),jt=()=>V(c.footer),$e=()=>V(c["timer-progress-bar"]),Qe=()=>V(c.close),Ao=`
|
|
196
196
|
a[href],
|
|
197
197
|
area[href],
|
|
198
198
|
input:not([disabled]),
|
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
audio[controls],
|
|
208
208
|
video[controls],
|
|
209
209
|
summary
|
|
210
|
-
`,et=()=>{const t=T();if(!t)return[];const e=t.querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])'),n=Array.from(e).sort((i,r)=>{const l=parseInt(i.getAttribute("tabindex")||"0"),a=parseInt(r.getAttribute("tabindex")||"0");return l>a?1:l<a?-1:0}),o=t.querySelectorAll(Ao),s=Array.from(o).filter(i=>i.getAttribute("tabindex")!=="-1");return[...new Set(n.concat(s))].filter(i=>
|
|
210
|
+
`,et=()=>{const t=T();if(!t)return[];const e=t.querySelectorAll('[tabindex]:not([tabindex="-1"]):not([tabindex="0"])'),n=Array.from(e).sort((i,r)=>{const l=parseInt(i.getAttribute("tabindex")||"0"),a=parseInt(r.getAttribute("tabindex")||"0");return l>a?1:l<a?-1:0}),o=t.querySelectorAll(Ao),s=Array.from(o).filter(i=>i.getAttribute("tabindex")!=="-1");return[...new Set(n.concat(s))].filter(i=>z(i))},tt=()=>Y(document.body,c.shown)&&!Y(document.body,c["toast-shown"])&&!Y(document.body,c["no-backdrop"]),Ie=()=>{const t=T();return t?Y(t,c.toast):!1},So=()=>{const t=T();return t?t.hasAttribute("data-loading"):!1},H=(t,e)=>{if(t.textContent="",e){const o=new DOMParser().parseFromString(e,"text/html"),s=o.querySelector("head");s&&Array.from(s.childNodes).forEach(r=>{t.appendChild(r)});const i=o.querySelector("body");i&&Array.from(i.childNodes).forEach(r=>{r instanceof HTMLVideoElement||r instanceof HTMLAudioElement?t.appendChild(r.cloneNode(!0)):t.appendChild(r)})}},Y=(t,e)=>{if(!e)return!1;const n=e.split(/\s+/);for(let o=0;o<n.length;o++)if(!t.classList.contains(n[o]))return!1;return!0},Lo=(t,e)=>{Array.from(t.classList).forEach(n=>{!Object.values(c).includes(n)&&!Object.values(Ae).includes(n)&&!Object.values(e.showClass||{}).includes(n)&&t.classList.remove(n)})},F=(t,e,n)=>{if(Lo(t,e),!e.customClass)return;const o=e.customClass[n];if(o){if(typeof o!="string"&&!o.forEach){q(`Invalid type of customClass.${n}! Expected string or iterable object, got "${typeof o}"`);return}A(t,o)}},Pe=(t,e)=>{if(!e)return null;switch(e){case"select":case"textarea":case"file":return t.querySelector(`.${c.popup} > .${c[e]}`);case"checkbox":return t.querySelector(`.${c.popup} > .${c.checkbox} input`);case"radio":return t.querySelector(`.${c.popup} > .${c.radio} input:checked`)||t.querySelector(`.${c.popup} > .${c.radio} input:first-child`);case"range":return t.querySelector(`.${c.popup} > .${c.range} input`);default:return t.querySelector(`.${c.popup} > .${c.input}`)}},Vt=t=>{if(t.focus(),t.type!=="file"){const e=t.value;t.value="",t.value=e}},Ht=(t,e,n)=>{!t||!e||(typeof e=="string"&&(e=e.split(/\s+/).filter(Boolean)),e.forEach(o=>{Array.isArray(t)?t.forEach(s=>{n?s.classList.add(o):s.classList.remove(o)}):n?t.classList.add(o):t.classList.remove(o)}))},A=(t,e)=>{Ht(t,e,!0)},K=(t,e)=>{Ht(t,e,!1)},X=(t,e)=>{const n=Array.from(t.children);for(let o=0;o<n.length;o++){const s=n[o];if(s instanceof HTMLElement&&Y(s,e))return s}},ne=(t,e,n)=>{n===`${parseInt(`${n}`)}`&&(n=parseInt(n)),n||parseInt(`${n}`)===0?t.style.setProperty(e,typeof n=="number"?`${n}px`:n):t.style.removeProperty(e)},M=(t,e="flex")=>{t&&(t.style.display=e)},D=t=>{t&&(t.style.display="none")},nt=(t,e="block")=>{t&&new MutationObserver(()=>{ve(t,t.innerHTML,e)}).observe(t,{childList:!0,subtree:!0})},Ft=(t,e,n,o)=>{const s=t.querySelector(e);s&&s.style.setProperty(n,o)},ve=(t,e,n="flex")=>{e?M(t,n):D(t)},z=t=>!!(t&&(t.offsetWidth||t.offsetHeight||t.getClientRects().length)),$o=()=>!z(G())&&!z(te())&&!z(le()),ot=t=>t.scrollHeight>t.clientHeight,Io=(t,e)=>{let n=t;for(;n&&n!==e;){if(ot(n))return!0;n=n.parentElement}return!1},Kt=t=>{const e=window.getComputedStyle(t),n=parseFloat(e.getPropertyValue("animation-duration")||"0"),o=parseFloat(e.getPropertyValue("transition-duration")||"0");return n>0||o>0},st=(t,e=!1)=>{const n=$e();n&&z(n)&&(e&&(n.style.transition="none",n.style.width="100%"),setTimeout(()=>{n.style.transition=`width ${t/1e3}s linear`,n.style.width="0%"},10))},Po=()=>{const t=$e();if(!t)return;const e=parseInt(window.getComputedStyle(t).width);t.style.removeProperty("transition"),t.style.width="100%";const n=parseInt(window.getComputedStyle(t).width),o=e/n*100;t.style.width=`${o}%`},No=()=>typeof window>"u"||typeof document>"u",Bo=`
|
|
211
211
|
<div aria-labelledby="${c.title}" aria-describedby="${c["html-container"]}" class="${c.popup}" tabindex="-1">
|
|
212
212
|
<button type="button" class="${c.close}"></button>
|
|
213
213
|
<ul class="${c["progress-steps"]}"></ul>
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
<div class="${c["timer-progress-bar"]}"></div>
|
|
241
241
|
</div>
|
|
242
242
|
</div>
|
|
243
|
-
`.replace(/(^|\n)\s*/g,""),Mo=()=>{const t=
|
|
243
|
+
`.replace(/(^|\n)\s*/g,""),Mo=()=>{const t=U();return t?(t.remove(),K([document.documentElement,document.body],[c["no-backdrop"],c["toast-shown"],c["has-column"]]),!0):!1},oe=()=>{p.currentInstance&&p.currentInstance.resetValidationMessage()},Ro=()=>{const t=T();if(!t)return;const e=X(t,c.input),n=X(t,c.file),o=t.querySelector(`.${c.range} input`),s=t.querySelector(`.${c.range} output`),i=X(t,c.select),r=t.querySelector(`.${c.checkbox} input`),l=X(t,c.textarea);e&&(e.oninput=oe),n&&(n.onchange=oe),i&&(i.onchange=oe),r&&(r.onchange=oe),l&&(l.oninput=oe),o&&s&&(o.oninput=()=>{oe(),s.value=o.value},o.onchange=()=>{oe(),s.value=o.value})},Oo=t=>{if(typeof t=="string"){const e=document.querySelector(t);if(!e)throw new Error(`Target element "${t}" not found`);return e}return t},Do=t=>{const e=T();e&&(e.setAttribute("role",t.toast?"alert":"dialog"),e.setAttribute("aria-live",t.toast?"polite":"assertive"),t.toast||e.setAttribute("aria-modal","true"))},qo=t=>{window.getComputedStyle(t).direction==="rtl"&&(A(U(),c.rtl),p.isRTL=!0)},Uo=t=>{const e=Mo();if(No()){ee("SweetAlert2 requires document to initialize");return}const n=document.createElement("div");n.className=c.container,e&&A(n,c["no-transition"]),H(n,Bo),n.dataset.swal2Theme=t.theme;const o=Oo(t.target||"body");o.appendChild(n),t.topLayer&&(n.setAttribute("popover",""),n.showPopover()),Do(t),qo(o),Ro()},it=(t,e)=>{t instanceof HTMLElement?e.appendChild(t):typeof t=="object"?zo(t,e):t&&H(e,t)},zo=(t,e)=>{"jquery"in t?jo(e,t):H(e,t.toString())},jo=(t,e)=>{if(t.textContent="",0 in e)for(let n=0;n in e;n++)t.appendChild(e[n].cloneNode(!0));else t.appendChild(e.cloneNode(!0))},Vo=(t,e)=>{const n=ye(),o=ce();!n||!o||(!e.showConfirmButton&&!e.showDenyButton&&!e.showCancelButton?D(n):M(n),F(n,e,"actions"),Ho(n,o,e),H(o,e.loaderHtml||""),F(o,e,"loader"))};function Ho(t,e,n){const o=G(),s=te(),i=le();!o||!s||!i||(at(o,"confirm",n),at(s,"deny",n),at(i,"cancel",n),Fo(o,s,i,n),n.reverseButtons&&(n.toast?(t.insertBefore(i,o),t.insertBefore(s,o)):(t.insertBefore(i,e),t.insertBefore(s,e),t.insertBefore(o,e))))}function Fo(t,e,n,o){if(!o.buttonsStyling){K([t,e,n],c.styled);return}A([t,e,n],c.styled),o.confirmButtonColor&&t.style.setProperty("--swal2-confirm-button-background-color",o.confirmButtonColor),o.denyButtonColor&&e.style.setProperty("--swal2-deny-button-background-color",o.denyButtonColor),o.cancelButtonColor&&n.style.setProperty("--swal2-cancel-button-background-color",o.cancelButtonColor),rt(t),rt(e),rt(n)}function rt(t){const e=window.getComputedStyle(t);if(e.getPropertyValue("--swal2-action-button-focus-box-shadow"))return;const n=e.backgroundColor.replace(/rgba?\((\d+), (\d+), (\d+).*/,"rgba($1, $2, $3, 0.5)");t.style.setProperty("--swal2-action-button-focus-box-shadow",e.getPropertyValue("--swal2-outline").replace(/ rgba\(.*/,` ${n}`))}function at(t,e,n){const o=We(e);ve(t,n[`show${o}Button`],"inline-block"),H(t,n[`${e}ButtonText`]||""),t.setAttribute("aria-label",n[`${e}ButtonAriaLabel`]||""),t.className=c[e],F(t,n,`${e}Button`)}const Ko=(t,e)=>{const n=Qe();n&&(H(n,e.closeButtonHtml||""),F(n,e,"closeButton"),ve(n,e.showCloseButton),n.setAttribute("aria-label",e.closeButtonAriaLabel||""))},Go=(t,e)=>{const n=U();n&&(Wo(n,e.backdrop),Yo(n,e.position),Zo(n,e.grow),F(n,e,"container"))};function Wo(t,e){typeof e=="string"?t.style.background=e:e||A([document.documentElement,document.body],c["no-backdrop"])}function Yo(t,e){e&&(e in c?A(t,c[e]):(q('The "position" parameter is not valid, defaulting to "center"'),A(t,c.center)))}function Zo(t,e){e&&A(t,c[`grow-${e}`])}var $={innerParams:new WeakMap,domCache:new WeakMap};const Xo=["input","file","range","select","radio","checkbox","textarea"],Jo=(t,e)=>{const n=T();if(!n)return;const o=$.innerParams.get(t),s=!o||e.input!==o.input;Xo.forEach(i=>{const r=X(n,c[i]);r&&(ts(i,e.inputAttributes),r.className=c[i],s&&D(r))}),e.input&&(s&&Qo(e),ns(e))},Qo=t=>{if(!t.input)return;if(!P[t.input]){ee(`Unexpected type of input! Expected ${Object.keys(P).join(" | ")}, got "${t.input}"`);return}const e=Gt(t.input);if(!e)return;const n=P[t.input](e,t);M(e),t.inputAutoFocus&&setTimeout(()=>{Vt(n)})},es=t=>{for(let e=0;e<t.attributes.length;e++){const n=t.attributes[e].name;["id","type","value","style"].includes(n)||t.removeAttribute(n)}},ts=(t,e)=>{const n=T();if(!n)return;const o=Pe(n,t);if(o){es(o);for(const s in e)o.setAttribute(s,e[s])}},ns=t=>{if(!t.input)return;const e=Gt(t.input);e&&F(e,t,"input")},lt=(t,e)=>{!t.placeholder&&e.inputPlaceholder&&(t.placeholder=e.inputPlaceholder)},Ce=(t,e,n)=>{if(n.inputLabel){const o=document.createElement("label"),s=c["input-label"];o.setAttribute("for",t.id),o.className=s,typeof n.customClass=="object"&&A(o,n.customClass.inputLabel),o.innerText=n.inputLabel,e.insertAdjacentElement("beforebegin",o)}},Gt=t=>{const e=T();if(e)return X(e,c[t]||c.input)},Ne=(t,e)=>{["string","number"].includes(typeof e)?t.value=`${e}`:Ze(e)||q(`Unexpected type of inputValue! Expected "string", "number" or "Promise", got "${typeof e}"`)},P={};P.text=P.email=P.password=P.number=P.tel=P.url=P.search=P.date=P["datetime-local"]=P.time=P.week=P.month=(t,e)=>{const n=t;return Ne(n,e.inputValue),Ce(n,n,e),lt(n,e),n.type=e.input,n},P.file=(t,e)=>{const n=t;return Ce(n,n,e),lt(n,e),n},P.range=(t,e)=>{const n=t,o=n.querySelector("input"),s=n.querySelector("output");return o&&(Ne(o,e.inputValue),o.type=e.input,Ce(o,t,e)),s&&Ne(s,e.inputValue),t},P.select=(t,e)=>{const n=t;if(n.textContent="",e.inputPlaceholder){const o=document.createElement("option");H(o,e.inputPlaceholder),o.value="",o.disabled=!0,o.selected=!0,n.appendChild(o)}return Ce(n,n,e),n},P.radio=t=>{const e=t;return e.textContent="",t},P.checkbox=(t,e)=>{const n=T();if(!n)throw new Error("Popup not found");const o=Pe(n,"checkbox");if(!o)throw new Error("Checkbox input not found");o.value="1",o.checked=!!e.inputValue;const i=t.querySelector("span");if(i){const r=e.inputPlaceholder||e.inputLabel;r&&H(i,r)}return o},P.textarea=(t,e)=>{const n=t;Ne(n,e.inputValue),lt(n,e),Ce(n,n,e);const o=s=>parseInt(window.getComputedStyle(s).marginLeft)+parseInt(window.getComputedStyle(s).marginRight);return setTimeout(()=>{if("MutationObserver"in window){const s=T();if(!s)return;const i=parseInt(window.getComputedStyle(s).width),r=()=>{if(!document.body.contains(n))return;const l=n.offsetWidth+o(n),a=T();a&&(l>i?a.style.width=`${l}px`:ne(a,"width",e.width))};new MutationObserver(r).observe(n,{attributes:!0,attributeFilter:["style"]})}}),n};const os=(t,e)=>{const n=Xe();n&&(nt(n),F(n,e,"htmlContainer"),e.html?(it(e.html,n),M(n,"block")):e.text?(n.textContent=e.text,M(n,"block")):D(n),Jo(t,e))},ss=(t,e)=>{const n=jt();n&&(nt(n),ve(n,!!e.footer,"block"),e.footer&&it(e.footer,n),F(n,e,"footer"))},is=(t,e)=>{const n=$.innerParams.get(t),o=ae();if(!o)return;if(n&&e.icon===n.icon){Zt(o,e),Wt(o,e);return}if(!e.icon&&!e.iconHtml){D(o);return}if(e.icon&&Object.keys(Ae).indexOf(e.icon)===-1){ee(`Unknown icon! Expected "success", "error", "warning", "info" or "question", got "${e.icon}"`),D(o);return}M(o),Zt(o,e),Wt(o,e),A(o,e.showClass&&e.showClass.icon),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",Yt)},Wt=(t,e)=>{for(const[n,o]of Object.entries(Ae))e.icon!==n&&K(t,o);A(t,e.icon&&Ae[e.icon]),ls(t,e),Yt(),F(t,e,"icon")},Yt=()=>{const t=T();if(!t)return;const e=window.getComputedStyle(t).getPropertyValue("background-color"),n=t.querySelectorAll("[class^=swal2-success-circular-line], .swal2-success-fix");for(let o=0;o<n.length;o++)n[o].style.backgroundColor=e},rs=t=>`
|
|
244
244
|
${t.animation?'<div class="swal2-success-circular-line-left"></div>':""}
|
|
245
245
|
<span class="swal2-success-line-tip"></span> <span class="swal2-success-line-long"></span>
|
|
246
246
|
<div class="swal2-success-ring"></div>
|
|
@@ -251,26 +251,26 @@
|
|
|
251
251
|
<span class="swal2-x-mark-line-left"></span>
|
|
252
252
|
<span class="swal2-x-mark-line-right"></span>
|
|
253
253
|
</span>
|
|
254
|
-
`,Zt=(t,e)=>{if(!e.icon&&!e.iconHtml)return;let n=t.innerHTML,o="";e.iconHtml?o=Xt(e.iconHtml):e.icon==="success"?(o=rs(e),n=n.replace(/ style=".*?"/g,"")):e.icon==="error"?o=as:e.icon&&(o=Xt({question:"?",warning:"!",info:"i"}[e.icon])),n.trim()!==o.trim()&&H(t,o)},ls=(t,e)=>{if(e.iconColor){t.style.color=e.iconColor,t.style.borderColor=e.iconColor;for(const n of[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"])Ft(t,n,"background-color",e.iconColor);Ft(t,".swal2-success-ring","border-color",e.iconColor)}},Xt=t=>`<div class="${c["icon-content"]}">${t}</div>`,cs=(t,e)=>{const n=qt();if(n){if(!e.imageUrl){D(n);return}R(n,""),n.setAttribute("src",e.imageUrl),n.setAttribute("alt",e.imageAlt||""),ne(n,"width",e.imageWidth),ne(n,"height",e.imageHeight),n.className=c.image,F(n,e,"image")}};let ct=!1,Jt=0,Qt=0,en=0,tn=0;const ds=t=>{t.addEventListener("mousedown",Be),document.body.addEventListener("mousemove",Me),t.addEventListener("mouseup",Re),t.addEventListener("touchstart",Be),document.body.addEventListener("touchmove",Me),t.addEventListener("touchend",Re)},us=t=>{t.removeEventListener("mousedown",Be),document.body.removeEventListener("mousemove",Me),t.removeEventListener("mouseup",Re),t.removeEventListener("touchstart",Be),document.body.removeEventListener("touchmove",Me),t.removeEventListener("touchend",Re)},Be=t=>{const e=T();if(!e)return;const n=ae();if(t.target===e||n&&n.contains(t.target)){ct=!0;const o=nn(t);Jt=o.clientX,Qt=o.clientY,en=parseInt(e.style.insetInlineStart)||0,tn=parseInt(e.style.insetBlockStart)||0,A(e,"swal2-dragging")}},Me=t=>{const e=T();if(e&&ct){let{clientX:n,clientY:o}=nn(t);const s=n-Jt;e.style.insetInlineStart=`${en+(p.isRTL?-s:s)}px`,e.style.insetBlockStart=`${tn+(o-Qt)}px`}},Re=()=>{const t=T();ct=!1,K(t,"swal2-dragging")},nn=t=>{let e=0,n=0;return t.type.startsWith("mouse")?(e=t.clientX,n=t.clientY):t.type.startsWith("touch")&&(e=t.touches[0].clientX,n=t.touches[0].clientY),{clientX:e,clientY:n}},hs=(t,e)=>{const n=z(),o=T();if(!(!n||!o)){if(e.toast){ne(n,"width",e.width),o.style.width="100%";const s=ce();s&&o.insertBefore(s,ae())}else ne(o,"width",e.width);ne(o,"padding",e.padding),e.color&&(o.style.color=e.color),e.background&&(o.style.background=e.background),D(Le()),fs(o,e),e.draggable&&!e.toast?(A(o,c.draggable),ds(o)):(K(o,c.draggable),us(o))}},fs=(t,e)=>{const n=e.showClass||{};t.className=`${c.popup} ${q(t)?n.popup:""}`,e.toast?(A([document.documentElement,document.body],c["toast-shown"]),A(t,c.toast)):A(t,c.modal),F(t,e,"popup"),typeof e.customClass=="string"&&A(t,e.customClass),e.icon&&A(t,c[`icon-${e.icon}`])},gs=(t,e)=>{const n=Je();if(!n)return;const{progressSteps:o,currentProgressStep:s}=e;if(!o||o.length===0||s===void 0){D(n);return}R(n),n.textContent="",s>=o.length&&U("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),o.forEach((i,r)=>{const l=ps(i);if(n.appendChild(l),r===s&&A(l,c["active-progress-step"]),r!==o.length-1){const a=ws(e);n.appendChild(a)}})},ps=t=>{const e=document.createElement("li");return A(e,c["progress-step"]),H(e,t),e},ws=t=>{const e=document.createElement("li");return A(e,c["progress-step-line"]),t.progressStepsDistance&&ne(e,"width",t.progressStepsDistance),e},ms=(t,e)=>{const n=zt();n&&(nt(n),ve(n,!!(e.title||e.titleText),"block"),e.title&&it(e.title,n),e.titleText&&(n.innerText=e.titleText),F(n,e,"title"))},on=(t,e)=>{var n;hs(t,e),Go(t,e),gs(t,e),is(t,e),cs(t,e),ms(t,e),Ko(t,e),os(t,e),Vo(t,e),ss(t,e);const o=T();typeof e.didRender=="function"&&o&&e.didRender(o),(n=p.eventEmitter)===null||n===void 0||n.emit("didRender",o)},bs=()=>q(T()),sn=()=>{var t;return(t=G())===null||t===void 0?void 0:t.click()},ys=()=>{var t;return(t=te())===null||t===void 0?void 0:t.click()},vs=()=>{var t;return(t=le())===null||t===void 0?void 0:t.click()},de=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),rn=t=>{if(t.keydownTarget&&t.keydownHandlerAdded&&t.keydownHandler){const e=t.keydownHandler;t.keydownTarget.removeEventListener("keydown",e,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!1}},Cs=(t,e,n)=>{if(rn(t),!e.toast){const o=i=>_s(e,i,n);t.keydownHandler=o;const s=e.keydownListenerCapture?window:T();if(s){t.keydownTarget=s,t.keydownListenerCapture=e.keydownListenerCapture;const i=o;t.keydownTarget.addEventListener("keydown",i,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0}}},dt=(t,e)=>{var n;const o=et();if(o.length){t=t+e,t===-2&&(t=o.length-1),t===o.length?t=0:t===-1&&(t=o.length-1),o[t].focus();return}(n=T())===null||n===void 0||n.focus()},an=["ArrowRight","ArrowDown"],ks=["ArrowLeft","ArrowUp"],_s=(t,e,n)=>{t&&(e.isComposing||e.keyCode===229||(t.stopKeydownPropagation&&e.stopPropagation(),e.key==="Enter"?xs(e,t):e.key==="Tab"?Es(e):[...an,...ks].includes(e.key)?Ts(e.key):e.key==="Escape"&&As(e,t,n)))},xs=(t,e)=>{if(!Se(e.allowEnterKey))return;const n=T();if(!n||!e.input)return;const o=Pe(n,e.input);if(t.target&&o&&t.target instanceof HTMLElement&&t.target.outerHTML===o.outerHTML){if(["textarea","file"].includes(e.input))return;sn(),t.preventDefault()}},Es=t=>{const e=t.target,n=et();let o=-1;for(let s=0;s<n.length;s++)if(e===n[s]){o=s;break}t.shiftKey?dt(o,-1):dt(o,1),t.stopPropagation(),t.preventDefault()},Ts=t=>{const e=ye(),n=G(),o=te(),s=le();if(!e||!n||!o||!s)return;const i=[n,o,s];if(document.activeElement instanceof HTMLElement&&!i.includes(document.activeElement))return;const r=an.includes(t)?"nextElementSibling":"previousElementSibling";let l=document.activeElement;if(l){for(let a=0;a<e.children.length;a++){if(l=l[r],!l)return;if(l instanceof HTMLButtonElement&&q(l))break}l instanceof HTMLButtonElement&&l.focus()}},As=(t,e,n)=>{t.preventDefault(),Se(e.allowEscapeKey)&&n(de.esc)};var ue={swalPromiseResolve:new WeakMap,swalPromiseReject:new WeakMap};const Ss=()=>{const t=z();Array.from(document.body.children).forEach(n=>{n.contains(t)||(n.hasAttribute("aria-hidden")&&n.setAttribute("data-previous-aria-hidden",n.getAttribute("aria-hidden")||""),n.setAttribute("aria-hidden","true"))})},ln=()=>{Array.from(document.body.children).forEach(e=>{e.hasAttribute("data-previous-aria-hidden")?(e.setAttribute("aria-hidden",e.getAttribute("data-previous-aria-hidden")||""),e.removeAttribute("data-previous-aria-hidden")):e.removeAttribute("aria-hidden")})},cn=typeof window<"u"&&!!window.GestureEvent,Ls=()=>{if(cn&&!Y(document.body,c.iosfix)){const t=document.body.scrollTop;document.body.style.top=`${t*-1}px`,A(document.body,c.iosfix),$s()}},$s=()=>{const t=z();if(!t)return;let e;t.ontouchstart=n=>{e=Is(n)},t.ontouchmove=n=>{e&&(n.preventDefault(),n.stopPropagation())}},Is=t=>{const e=t.target,n=z(),o=Xe();return!n||!o||Ps(t)||Ns(t)?!1:e===n||!ot(n)&&e instanceof HTMLElement&&!Io(e,o)&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"&&!(ot(o)&&o.contains(e))},Ps=t=>!!(t.touches&&t.touches.length&&t.touches[0].touchType==="stylus"),Ns=t=>t.touches&&t.touches.length>1,Bs=()=>{if(Y(document.body,c.iosfix)){const t=parseInt(document.body.style.top,10);K(document.body,c.iosfix),document.body.style.top="",document.body.scrollTop=t*-1}},Ms=()=>{const t=document.createElement("div");t.className=c["scrollbar-measure"],document.body.appendChild(t);const e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e};let he=null;const Rs=t=>{he===null&&(document.body.scrollHeight>window.innerHeight||t==="scroll")&&(he=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight=`${he+Ms()}px`)},Os=()=>{he!==null&&(document.body.style.paddingRight=`${he}px`,he=null)};function dn(t,e,n,o){Ie()?hn(t,o):(_o(n).then(()=>hn(t,o)),rn(p)),cn?(e.setAttribute("style","display:none !important"),e.removeAttribute("class"),e.innerHTML=""):e.remove(),tt()&&(Os(),Bs(),ln()),Ds()}function Ds(){K([document.documentElement,document.body],[c.shown,c["height-auto"],c["no-backdrop"],c["toast-shown"]])}function J(t){t=zs(t);const e=ue.swalPromiseResolve.get(this),n=Us(this);this.isAwaitingPromise?t.isDismissed||(ke(this),e(t)):n&&e(t)}const Us=t=>{const e=T();if(!e)return!1;const n=$.innerParams.get(t);if(!n||Y(e,n.hideClass.popup))return!1;K(e,n.showClass.popup),A(e,n.hideClass.popup);const o=z();return K(o,n.showClass.backdrop),A(o,n.hideClass.backdrop),qs(t,e,n),!0};function un(t){const e=ue.swalPromiseReject.get(this);ke(this),e&&e(t)}const ke=t=>{t.isAwaitingPromise&&(delete t.isAwaitingPromise,$.innerParams.get(t)||t._destroy())},zs=t=>typeof t>"u"?{isConfirmed:!1,isDenied:!1,isDismissed:!0}:Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},t),qs=(t,e,n)=>{var o;const s=z(),i=Kt(e);typeof n.willClose=="function"&&n.willClose(e),(o=p.eventEmitter)===null||o===void 0||o.emit("willClose",e),i&&s?js(t,e,s,!!n.returnFocus,n.didClose):s&&dn(t,s,!!n.returnFocus,n.didClose)},js=(t,e,n,o,s)=>{p.swalCloseEventFinishedCallback=dn.bind(null,t,n,o,s);const i=function(r){if(r.target===e){var l;(l=p.swalCloseEventFinishedCallback)===null||l===void 0||l.call(p),delete p.swalCloseEventFinishedCallback,e.removeEventListener("animationend",i),e.removeEventListener("transitionend",i)}};e.addEventListener("animationend",i),e.addEventListener("transitionend",i)},hn=(t,e)=>{setTimeout(()=>{var n;typeof e=="function"&&e.bind(t.params)(),(n=p.eventEmitter)===null||n===void 0||n.emit("didClose"),t._destroy&&t._destroy()})},fe=t=>{let e=T();if(e||new O,e=T(),!e)return;const n=ce();Ie()?D(ae()):Vs(e,t),R(n),e.setAttribute("data-loading","true"),e.setAttribute("aria-busy","true"),e.focus()},Vs=(t,e)=>{const n=ye(),o=ce();!n||!o||(!e&&q(G())&&(e=G()),R(n),e&&(D(e),o.setAttribute("data-button-to-replace",e.className),n.insertBefore(o,e)),A([t,n],c.loading))},Hs=(t,e)=>{e.input==="select"||e.input==="radio"?Ys(t,e):["text","email","number","tel","textarea"].some(n=>n===e.input)&&(Ye(e.inputValue)||Ze(e.inputValue))&&(fe(G()),Zs(t,e))},Fs=(t,e)=>{const n=t.getInput();if(!n)return null;switch(e.input){case"checkbox":return Ks(n);case"radio":return Gs(n);case"file":return Ws(n);default:return e.inputAutoTrim?n.value.trim():n.value}},Ks=t=>t.checked?1:0,Gs=t=>t.checked?t.value:null,Ws=t=>t.files&&t.files.length?t.getAttribute("multiple")!==null?t.files:t.files[0]:null,Ys=(t,e)=>{const n=T();if(!n)return;const o=s=>{e.input==="select"?Xs(n,Oe(s),e):e.input==="radio"&&Js(n,Oe(s),e)};Ye(e.inputOptions)||Ze(e.inputOptions)?(fe(G()),me(e.inputOptions).then(s=>{t.hideLoading(),o(s)})):typeof e.inputOptions=="object"?o(e.inputOptions):ee(`Unexpected type of inputOptions! Expected object, Map or Promise, got ${typeof e.inputOptions}`)},Zs=(t,e)=>{const n=t.getInput();n&&(D(n),me(e.inputValue).then(o=>{n.value=e.input==="number"?`${parseFloat(o)||0}`:`${o}`,R(n),n.focus(),t.hideLoading()}).catch(o=>{ee(`Error in inputValue promise: ${o}`),n.value="",R(n),n.focus(),t.hideLoading()}))};function Xs(t,e,n){const o=X(t,c.select);if(!o)return;const s=(i,r,l)=>{const a=document.createElement("option");a.value=l,H(a,r),a.selected=fn(l,n.inputValue),i.appendChild(a)};e.forEach(i=>{const r=i[0],l=i[1];if(Array.isArray(l)){const a=document.createElement("optgroup");a.label=r,a.disabled=!1,o.appendChild(a),l.forEach(d=>s(a,d[1],d[0]))}else s(o,l,r)}),o.focus()}function Js(t,e,n){const o=X(t,c.radio);if(!o)return;e.forEach(i=>{const r=i[0],l=i[1],a=document.createElement("input"),d=document.createElement("label");a.type="radio",a.name=c.radio,a.value=r,fn(r,n.inputValue)&&(a.checked=!0);const g=document.createElement("span");H(g,l),g.className=c.label,d.appendChild(a),d.appendChild(g),o.appendChild(d)});const s=o.querySelectorAll("input");s.length&&s[0].focus()}const Oe=t=>{const e=[];return t instanceof Map?t.forEach((n,o)=>{let s=n;typeof s=="object"&&(s=Oe(s)),e.push([o,s])}):Object.keys(t).forEach(n=>{let o=t[n];typeof o=="object"&&(o=Oe(o)),e.push([n,o])}),e},fn=(t,e)=>!!e&&e!==null&&e!==void 0&&e.toString()===t.toString(),Qs=t=>{const e=$.innerParams.get(t);t.disableButtons(),e.input?gn(t,"confirm"):ht(t,!0)},ei=t=>{const e=$.innerParams.get(t);t.disableButtons(),e.returnInputValueOnDeny?gn(t,"deny"):ut(t,!1)},ti=(t,e)=>{t.disableButtons(),e(de.cancel)},gn=(t,e)=>{const n=$.innerParams.get(t);if(!n.input){ee(`The "input" parameter is needed to be set when using returnInputValueOn${We(e)}`);return}const o=t.getInput(),s=Fs(t,n);n.inputValidator?ni(t,s,e):o&&!o.checkValidity()?(t.enableButtons(),t.showValidationMessage(n.validationMessage||o.validationMessage)):e==="deny"?ut(t,s):ht(t,s)},ni=(t,e,n)=>{const o=$.innerParams.get(t);t.disableInput(),Promise.resolve().then(()=>me(o.inputValidator(e,o.validationMessage))).then(i=>{t.enableButtons(),t.enableInput(),i?t.showValidationMessage(i):n==="deny"?ut(t,e):ht(t,e)})},ut=(t,e)=>{const n=$.innerParams.get(t);n.showLoaderOnDeny&&fe(te()),n.preDeny?(t.isAwaitingPromise=!0,Promise.resolve().then(()=>me(n.preDeny(e,n.validationMessage))).then(s=>{s===!1?(t.hideLoading(),ke(t)):t.close({isDenied:!0,value:typeof s>"u"?e:s})}).catch(s=>wn(t,s))):t.close({isDenied:!0,value:e})},pn=(t,e)=>{t.close({isConfirmed:!0,value:e})},wn=(t,e)=>{t.rejectPromise(e)},ht=(t,e)=>{const n=$.innerParams.get(t);n.showLoaderOnConfirm&&fe(),n.preConfirm?(t.resetValidationMessage(),t.isAwaitingPromise=!0,Promise.resolve().then(()=>me(n.preConfirm(e,n.validationMessage))).then(s=>{q(Le())||s===!1?(t.hideLoading(),ke(t)):pn(t,typeof s>"u"?e:s)}).catch(s=>wn(t,s))):pn(t,e)};function De(){const t=$.innerParams.get(this);if(!t)return;const e=$.domCache.get(this);D(e.loader),Ie()?t.icon&&R(ae()):oi(e),K([e.popup,e.actions],c.loading),e.popup.removeAttribute("aria-busy"),e.popup.removeAttribute("data-loading"),e.confirmButton.disabled=!1,e.denyButton.disabled=!1,e.cancelButton.disabled=!1}const oi=t=>{const e=t.loader.getAttribute("data-button-to-replace"),n=e?t.popup.getElementsByClassName(e):[];n.length?R(n[0],"inline-block"):$o()&&D(t.actions)};function mn(){const t=$.innerParams.get(this),e=$.domCache.get(this);return e?Pe(e.popup,t.input):null}function bn(t,e,n){const o=$.domCache.get(t);e.forEach(s=>{o[s].disabled=n})}function yn(t,e){const n=T();if(!(!n||!t))if(t.type==="radio"){const o=n.querySelectorAll(`[name="${c.radio}"]`);for(let s=0;s<o.length;s++)o[s].disabled=e}else t.disabled=e}function vn(){bn(this,["confirmButton","denyButton","cancelButton"],!1)}function Cn(){bn(this,["confirmButton","denyButton","cancelButton"],!0)}function kn(){yn(this.getInput(),!1)}function _n(){yn(this.getInput(),!0)}function xn(t){const e=$.domCache.get(this),n=$.innerParams.get(this);H(e.validationMessage,t),e.validationMessage.className=c["validation-message"],n.customClass&&n.customClass.validationMessage&&A(e.validationMessage,n.customClass.validationMessage),R(e.validationMessage);const o=this.getInput();o&&(o.setAttribute("aria-invalid","true"),o.setAttribute("aria-describedby",c["validation-message"]),Vt(o),A(o,c.inputerror))}function En(){const t=$.domCache.get(this);t.validationMessage&&D(t.validationMessage);const e=this.getInput();e&&(e.removeAttribute("aria-invalid"),e.removeAttribute("aria-describedby"),K(e,c.inputerror))}const Q={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconColor:void 0,iconHtml:void 0,template:void 0,toast:!1,draggable:!1,animation:!0,theme:"light",showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:{},target:"body",color:void 0,backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showDenyButton:!1,showCancelButton:!1,preConfirm:void 0,preDeny:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,denyButtonText:"No",denyButtonAriaLabel:"",denyButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusDeny:!1,focusCancel:!1,returnFocus:!0,showCloseButton:!1,closeButtonHtml:"×",closeButtonAriaLabel:"Close this dialog",loaderHtml:"",showLoaderOnConfirm:!1,showLoaderOnDeny:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputLabel:"",inputValue:"",inputOptions:{},inputAutoFocus:!0,inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,returnInputValueOnDeny:!1,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,willOpen:void 0,didOpen:void 0,didRender:void 0,willClose:void 0,didClose:void 0,didDestroy:void 0,scrollbarPadding:!0,topLayer:!1},si=["allowEscapeKey","allowOutsideClick","background","buttonsStyling","cancelButtonAriaLabel","cancelButtonColor","cancelButtonText","closeButtonAriaLabel","closeButtonHtml","color","confirmButtonAriaLabel","confirmButtonColor","confirmButtonText","currentProgressStep","customClass","denyButtonAriaLabel","denyButtonColor","denyButtonText","didClose","didDestroy","draggable","footer","hideClass","html","icon","iconColor","iconHtml","imageAlt","imageHeight","imageUrl","imageWidth","preConfirm","preDeny","progressSteps","returnFocus","reverseButtons","showCancelButton","showCloseButton","showConfirmButton","showDenyButton","text","title","titleText","theme","willClose"],ii={allowEnterKey:void 0},ri=["allowOutsideClick","allowEnterKey","backdrop","draggable","focusConfirm","focusDeny","focusCancel","returnFocus","heightAuto","keydownListenerCapture"],Tn=t=>Object.prototype.hasOwnProperty.call(Q,t),An=t=>si.indexOf(t)!==-1,Sn=t=>ii[t],ai=t=>{Tn(t)||U(`Unknown parameter "${t}"`)},li=t=>{ri.includes(t)&&U(`The parameter "${t}" is incompatible with toasts`)},ci=t=>{const e=Sn(t);e&&Ut(t,e)},Ln=t=>{t.backdrop===!1&&t.allowOutsideClick&&U('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'),t.theme&&!["light","dark","auto","minimal","borderless","bootstrap-4","bootstrap-4-light","bootstrap-4-dark","bootstrap-5","bootstrap-5-light","bootstrap-5-dark","material-ui","material-ui-light","material-ui-dark","embed-iframe","bulma","bulma-light","bulma-dark"].includes(t.theme)&&U(`Invalid theme "${t.theme}"`);for(const e in t)ai(e),t.toast&&li(e),ci(e)};function $n(t){const e=z(),n=T(),o=$.innerParams.get(this);if(!n||Y(n,o.hideClass.popup)){U("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");return}const s=di(t),i=Object.assign({},o,s);Ln(i),e&&(e.dataset.swal2Theme=i.theme),on(this,i),$.innerParams.set(this,i),Object.defineProperties(this,{params:{value:Object.assign({},this.params,t),writable:!1,enumerable:!0}})}const di=t=>{const e={};return Object.keys(t).forEach(n=>{if(An(n)){const o=t;e[n]=o[n]}else U(`Invalid parameter to update: ${n}`)}),e};function In(){var t;const e=$.domCache.get(this),n=$.innerParams.get(this);if(!n){Pn(this);return}e.popup&&p.swalCloseEventFinishedCallback&&(p.swalCloseEventFinishedCallback(),delete p.swalCloseEventFinishedCallback),typeof n.didDestroy=="function"&&n.didDestroy(),(t=p.eventEmitter)===null||t===void 0||t.emit("didDestroy"),ui(this)}const ui=t=>{Pn(t),delete t.params,delete p.keydownHandler,delete p.keydownTarget,delete p.currentInstance},Pn=t=>{t.isAwaitingPromise?(ft($,t),t.isAwaitingPromise=!0):(ft(ue,t),ft($,t),delete t.isAwaitingPromise,delete t.disableButtons,delete t.enableButtons,delete t.getInput,delete t.disableInput,delete t.enableInput,delete t.hideLoading,delete t.disableLoading,delete t.showValidationMessage,delete t.resetValidationMessage,delete t.close,delete t.closePopup,delete t.closeModal,delete t.closeToast,delete t.rejectPromise,delete t.update,delete t._destroy)},ft=(t,e)=>{for(const n in t)t[n].delete(e)};var hi=Object.freeze({__proto__:null,_destroy:In,close:J,closeModal:J,closePopup:J,closeToast:J,disableButtons:Cn,disableInput:_n,disableLoading:De,enableButtons:vn,enableInput:kn,getInput:mn,handleAwaitingPromise:ke,hideLoading:De,rejectPromise:un,resetValidationMessage:En,showValidationMessage:xn,update:$n});const fi=(t,e,n)=>{t.toast?gi(t,e,n):(wi(e),mi(e),bi(t,e,n))},gi=(t,e,n)=>{e.popup.onclick=()=>{t&&(pi(t)||t.timer||t.input)||n(de.close)}},pi=t=>!!(t.showConfirmButton||t.showDenyButton||t.showCancelButton||t.showCloseButton);let Ue=!1;const wi=t=>{t.popup.onmousedown=()=>{t.container.onmouseup=function(e){t.container.onmouseup=()=>{},e.target===t.container&&(Ue=!0)}}},mi=t=>{t.container.onmousedown=e=>{e.target===t.container&&e.preventDefault(),t.popup.onmouseup=function(n){t.popup.onmouseup=()=>{},(n.target===t.popup||n.target instanceof HTMLElement&&t.popup.contains(n.target))&&(Ue=!0)}}},bi=(t,e,n)=>{e.container.onclick=o=>{if(Ue){Ue=!1;return}o.target===e.container&&Se(t.allowOutsideClick)&&n(de.backdrop)}},yi=t=>typeof t=="object"&&t!==null&&"jquery"in t,Nn=t=>t instanceof Element||yi(t),vi=t=>{const e={};return typeof t[0]=="object"&&!Nn(t[0])?Object.assign(e,t[0]):["title","html","icon"].forEach((n,o)=>{const s=t[o];typeof s=="string"||Nn(s)?e[n]=s:s!==void 0&&ee(`Unexpected type of ${n}! Expected "string" or "Element", got ${typeof s}`)}),e};function Ci(...t){return new this(...t)}function ki(t){class e extends this{_main(o,s){return super._main(o,Object.assign({},t,s))}}return e}const _i=()=>p.timeout&&p.timeout.getTimerLeft(),Bn=()=>{if(p.timeout)return Po(),p.timeout.stop()},Mn=()=>{if(p.timeout){const t=p.timeout.start();return st(t),t}},xi=()=>{const t=p.timeout;return t&&(t.running?Bn():Mn())},Ei=t=>{if(p.timeout){const e=p.timeout.increase(t);return st(e,!0),e}},Ti=()=>!!(p.timeout&&p.timeout.isRunning());let Rn=!1;const gt={};function Ai(t="data-swal-template"){gt[t]=this,Rn||(document.body.addEventListener("click",Si),Rn=!0)}const Si=t=>{for(let e=t.target;e&&e!==document;e=e.parentNode)for(const n in gt){const o=e.getAttribute&&e.getAttribute(n);if(o){gt[n].fire({template:o});return}}};class Li{constructor(){this.events={}}_getHandlersByEventName(e){return typeof this.events[e]>"u"&&(this.events[e]=[]),this.events[e]}on(e,n){const o=this._getHandlersByEventName(e);o.includes(n)||o.push(n)}once(e,n){const o=(...s)=>{this.removeListener(e,o),n.apply(this,s)};this.on(e,o)}emit(e,...n){this._getHandlersByEventName(e).forEach(o=>{try{o.apply(this,n)}catch(s){console.error(s)}})}removeListener(e,n){const o=this._getHandlersByEventName(e),s=o.indexOf(n);s>-1&&o.splice(s,1)}removeAllListeners(e){this.events[e]!==void 0&&(this.events[e].length=0)}reset(){this.events={}}}p.eventEmitter=new Li;var $i=Object.freeze({__proto__:null,argsToParams:vi,bindClickHandler:Ai,clickCancel:vs,clickConfirm:sn,clickDeny:ys,enableLoading:fe,fire:Ci,getActions:ye,getCancelButton:le,getCloseButton:Qe,getConfirmButton:G,getContainer:z,getDenyButton:te,getFocusableElements:et,getFooter:jt,getHtmlContainer:Xe,getIcon:ae,getIconContent:Eo,getImage:qt,getInputLabel:To,getLoader:ce,getPopup:T,getProgressSteps:Je,getTimerLeft:_i,getTimerProgressBar:$e,getTitle:zt,getValidationMessage:Le,increaseTimer:Ei,isDeprecatedParameter:Sn,isLoading:So,isTimerRunning:Ti,isUpdatableParameter:An,isValidParameter:Tn,isVisible:bs,mixin:ki,off:(t,e)=>{if(p.eventEmitter){if(!t){p.eventEmitter.reset();return}e?p.eventEmitter.removeListener(t,e):p.eventEmitter.removeAllListeners(t)}},on:(t,e)=>{p.eventEmitter&&p.eventEmitter.on(t,e)},once:(t,e)=>{p.eventEmitter&&p.eventEmitter.once(t,e)},resumeTimer:Mn,showLoading:fe,stopTimer:Bn,toggleTimer:xi});class Ii{constructor(e,n){this.callback=e,this.remaining=n,this.running=!1,this.start()}start(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}stop(){return this.started&&this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=new Date().getTime()-this.started.getTime()),this.remaining}increase(e){const n=this.running;return n&&this.stop(),this.remaining+=e,n&&this.start(),this.remaining}getTimerLeft(){return this.running&&(this.stop(),this.start()),this.remaining}isRunning(){return this.running}}const On=["swal-title","swal-html","swal-footer"],Pi=t=>{const e=typeof t.template=="string"?document.querySelector(t.template):t.template;if(!e)return{};const n=e.content;return zi(n),Object.assign(Ni(n),Bi(n),Mi(n),Ri(n),Oi(n),Di(n),Ui(n,On))},Ni=t=>{const e={};return Array.from(t.querySelectorAll("swal-param")).forEach(o=>{se(o,["name","value"]);const s=o.getAttribute("name"),i=o.getAttribute("value");!s||!i||(s in Q&&typeof Q[s]=="boolean"?e[s]=i!=="false":s in Q&&typeof Q[s]=="object"?e[s]=JSON.parse(i):e[s]=i)}),e},Bi=t=>{const e={};return Array.from(t.querySelectorAll("swal-function-param")).forEach(o=>{const s=o.getAttribute("name"),i=o.getAttribute("value");!s||!i||(e[s]=new Function(`return ${i}`)())}),e},Mi=t=>{const e={};return Array.from(t.querySelectorAll("swal-button")).forEach(o=>{se(o,["type","color","aria-label"]);const s=o.getAttribute("type");if(!(!s||!["confirm","cancel","deny"].includes(s))){if(e[`${s}ButtonText`]=o.innerHTML,e[`show${We(s)}Button`]=!0,o.hasAttribute("color")){const i=o.getAttribute("color");i!==null&&(e[`${s}ButtonColor`]=i)}if(o.hasAttribute("aria-label")){const i=o.getAttribute("aria-label");i!==null&&(e[`${s}ButtonAriaLabel`]=i)}}}),e},Ri=t=>{const e={},n=t.querySelector("swal-image");return n&&(se(n,["src","width","height","alt"]),n.hasAttribute("src")&&(e.imageUrl=n.getAttribute("src")||void 0),n.hasAttribute("width")&&(e.imageWidth=n.getAttribute("width")||void 0),n.hasAttribute("height")&&(e.imageHeight=n.getAttribute("height")||void 0),n.hasAttribute("alt")&&(e.imageAlt=n.getAttribute("alt")||void 0)),e},Oi=t=>{const e={},n=t.querySelector("swal-icon");return n&&(se(n,["type","color"]),n.hasAttribute("type")&&(e.icon=n.getAttribute("type")),n.hasAttribute("color")&&(e.iconColor=n.getAttribute("color")),e.iconHtml=n.innerHTML),e},Di=t=>{const e={},n=t.querySelector("swal-input");n&&(se(n,["type","label","placeholder","value"]),e.input=n.getAttribute("type")||"text",n.hasAttribute("label")&&(e.inputLabel=n.getAttribute("label")),n.hasAttribute("placeholder")&&(e.inputPlaceholder=n.getAttribute("placeholder")),n.hasAttribute("value")&&(e.inputValue=n.getAttribute("value")));const o=Array.from(t.querySelectorAll("swal-input-option"));return o.length&&(e.inputOptions={},o.forEach(s=>{se(s,["value"]);const i=s.getAttribute("value");if(!i)return;const r=s.innerHTML;e.inputOptions[i]=r})),e},Ui=(t,e)=>{const n={};for(const o in e){const s=e[o],i=t.querySelector(s);i&&(se(i,[]),n[s.replace(/^swal-/,"")]=i.innerHTML.trim())}return n},zi=t=>{const e=On.concat(["swal-param","swal-function-param","swal-button","swal-image","swal-icon","swal-input","swal-input-option"]);Array.from(t.children).forEach(n=>{const o=n.tagName.toLowerCase();e.includes(o)||U(`Unrecognized element <${o}>`)})},se=(t,e)=>{Array.from(t.attributes).forEach(n=>{e.indexOf(n.name)===-1&&U([`Unrecognized attribute "${n.name}" on <${t.tagName.toLowerCase()}>.`,`${e.length?`Allowed attributes are: ${e.join(", ")}`:"To set the value, use HTML within the element."}`])})},Dn=10,qi=t=>{var e,n;const o=z(),s=T();if(!o||!s)return;typeof t.willOpen=="function"&&t.willOpen(s),(e=p.eventEmitter)===null||e===void 0||e.emit("willOpen",s);const r=window.getComputedStyle(document.body).overflowY;if(Hi(o,s,t),setTimeout(()=>{ji(o,s)},Dn),tt()&&(Vi(o,t.scrollbarPadding!==void 0?t.scrollbarPadding:!1,r),Ss()),!Ie()&&!p.previousActiveElement&&(p.previousActiveElement=document.activeElement),typeof t.didOpen=="function"){const l=t.didOpen;setTimeout(()=>l(s))}(n=p.eventEmitter)===null||n===void 0||n.emit("didOpen",s)},ze=t=>{const e=T();if(!e||t.target!==e)return;const n=z();n&&(e.removeEventListener("animationend",ze),e.removeEventListener("transitionend",ze),n.style.overflowY="auto",K(n,c["no-transition"]))},ji=(t,e)=>{Kt(e)?(t.style.overflowY="hidden",e.addEventListener("animationend",ze),e.addEventListener("transitionend",ze)):t.style.overflowY="auto"},Vi=(t,e,n)=>{Ls(),e&&n!=="hidden"&&Rs(n),setTimeout(()=>{t.scrollTop=0})},Hi=(t,e,n)=>{var o;(o=n.showClass)!==null&&o!==void 0&&o.backdrop&&A(t,n.showClass.backdrop),n.animation?(e.style.setProperty("opacity","0","important"),R(e,"grid"),setTimeout(()=>{var s;(s=n.showClass)!==null&&s!==void 0&&s.popup&&A(e,n.showClass.popup),e.style.removeProperty("opacity")},Dn)):R(e,"grid"),A([document.documentElement,document.body],c.shown),n.heightAuto&&n.backdrop&&!n.toast&&A([document.documentElement,document.body],c["height-auto"])};var Un={email:(t,e)=>/^[a-zA-Z0-9.+_'-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]+$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid email address"),url:(t,e)=>/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid URL")};function Fi(t){t.inputValidator||(t.input==="email"&&(t.inputValidator=Un.email),t.input==="url"&&(t.inputValidator=Un.url))}function Ki(t){(!t.target||typeof t.target=="string"&&!document.querySelector(t.target)||typeof t.target!="string"&&!t.target.appendChild)&&(U('Target parameter is not valid, defaulting to "body"'),t.target="body")}function Gi(t){Fi(t),t.showLoaderOnConfirm&&!t.preConfirm&&U(`showLoaderOnConfirm is set to true, but preConfirm is not defined.
|
|
254
|
+
`,Zt=(t,e)=>{if(!e.icon&&!e.iconHtml)return;let n=t.innerHTML,o="";e.iconHtml?o=Xt(e.iconHtml):e.icon==="success"?(o=rs(e),n=n.replace(/ style=".*?"/g,"")):e.icon==="error"?o=as:e.icon&&(o=Xt({question:"?",warning:"!",info:"i"}[e.icon])),n.trim()!==o.trim()&&H(t,o)},ls=(t,e)=>{if(e.iconColor){t.style.color=e.iconColor,t.style.borderColor=e.iconColor;for(const n of[".swal2-success-line-tip",".swal2-success-line-long",".swal2-x-mark-line-left",".swal2-x-mark-line-right"])Ft(t,n,"background-color",e.iconColor);Ft(t,".swal2-success-ring","border-color",e.iconColor)}},Xt=t=>`<div class="${c["icon-content"]}">${t}</div>`,cs=(t,e)=>{const n=zt();if(n){if(!e.imageUrl){D(n);return}M(n,""),n.setAttribute("src",e.imageUrl),n.setAttribute("alt",e.imageAlt||""),ne(n,"width",e.imageWidth),ne(n,"height",e.imageHeight),n.className=c.image,F(n,e,"image")}};let ct=!1,Jt=0,Qt=0,en=0,tn=0;const ds=t=>{t.addEventListener("mousedown",Be),document.body.addEventListener("mousemove",Me),t.addEventListener("mouseup",Re),t.addEventListener("touchstart",Be),document.body.addEventListener("touchmove",Me),t.addEventListener("touchend",Re)},us=t=>{t.removeEventListener("mousedown",Be),document.body.removeEventListener("mousemove",Me),t.removeEventListener("mouseup",Re),t.removeEventListener("touchstart",Be),document.body.removeEventListener("touchmove",Me),t.removeEventListener("touchend",Re)},Be=t=>{const e=T();if(!e)return;const n=ae();if(t.target===e||n&&n.contains(t.target)){ct=!0;const o=nn(t);Jt=o.clientX,Qt=o.clientY,en=parseInt(e.style.insetInlineStart)||0,tn=parseInt(e.style.insetBlockStart)||0,A(e,"swal2-dragging")}},Me=t=>{const e=T();if(e&&ct){let{clientX:n,clientY:o}=nn(t);const s=n-Jt;e.style.insetInlineStart=`${en+(p.isRTL?-s:s)}px`,e.style.insetBlockStart=`${tn+(o-Qt)}px`}},Re=()=>{const t=T();ct=!1,K(t,"swal2-dragging")},nn=t=>{let e=0,n=0;return t.type.startsWith("mouse")?(e=t.clientX,n=t.clientY):t.type.startsWith("touch")&&(e=t.touches[0].clientX,n=t.touches[0].clientY),{clientX:e,clientY:n}},hs=(t,e)=>{const n=U(),o=T();if(!(!n||!o)){if(e.toast){ne(n,"width",e.width),o.style.width="100%";const s=ce();s&&o.insertBefore(s,ae())}else ne(o,"width",e.width);ne(o,"padding",e.padding),e.color&&(o.style.color=e.color),e.background&&(o.style.background=e.background),D(Le()),fs(o,e),e.draggable&&!e.toast?(A(o,c.draggable),ds(o)):(K(o,c.draggable),us(o))}},fs=(t,e)=>{const n=e.showClass||{};t.className=`${c.popup} ${z(t)?n.popup:""}`,e.toast?(A([document.documentElement,document.body],c["toast-shown"]),A(t,c.toast)):A(t,c.modal),F(t,e,"popup"),typeof e.customClass=="string"&&A(t,e.customClass),e.icon&&A(t,c[`icon-${e.icon}`])},gs=(t,e)=>{const n=Je();if(!n)return;const{progressSteps:o,currentProgressStep:s}=e;if(!o||o.length===0||s===void 0){D(n);return}M(n),n.textContent="",s>=o.length&&q("Invalid currentProgressStep parameter, it should be less than progressSteps.length (currentProgressStep like JS arrays starts from 0)"),o.forEach((i,r)=>{const l=ps(i);if(n.appendChild(l),r===s&&A(l,c["active-progress-step"]),r!==o.length-1){const a=ws(e);n.appendChild(a)}})},ps=t=>{const e=document.createElement("li");return A(e,c["progress-step"]),H(e,t),e},ws=t=>{const e=document.createElement("li");return A(e,c["progress-step-line"]),t.progressStepsDistance&&ne(e,"width",t.progressStepsDistance),e},ms=(t,e)=>{const n=Ut();n&&(nt(n),ve(n,!!(e.title||e.titleText),"block"),e.title&&it(e.title,n),e.titleText&&(n.innerText=e.titleText),F(n,e,"title"))},on=(t,e)=>{var n;hs(t,e),Go(t,e),gs(t,e),is(t,e),cs(t,e),ms(t,e),Ko(t,e),os(t,e),Vo(t,e),ss(t,e);const o=T();typeof e.didRender=="function"&&o&&e.didRender(o),(n=p.eventEmitter)===null||n===void 0||n.emit("didRender",o)},bs=()=>z(T()),sn=()=>{var t;return(t=G())===null||t===void 0?void 0:t.click()},ys=()=>{var t;return(t=te())===null||t===void 0?void 0:t.click()},vs=()=>{var t;return(t=le())===null||t===void 0?void 0:t.click()},de=Object.freeze({cancel:"cancel",backdrop:"backdrop",close:"close",esc:"esc",timer:"timer"}),rn=t=>{if(t.keydownTarget&&t.keydownHandlerAdded&&t.keydownHandler){const e=t.keydownHandler;t.keydownTarget.removeEventListener("keydown",e,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!1}},Cs=(t,e,n)=>{if(rn(t),!e.toast){const o=i=>_s(e,i,n);t.keydownHandler=o;const s=e.keydownListenerCapture?window:T();if(s){t.keydownTarget=s,t.keydownListenerCapture=e.keydownListenerCapture;const i=o;t.keydownTarget.addEventListener("keydown",i,{capture:t.keydownListenerCapture}),t.keydownHandlerAdded=!0}}},dt=(t,e)=>{var n;const o=et();if(o.length){t=t+e,t===-2&&(t=o.length-1),t===o.length?t=0:t===-1&&(t=o.length-1),o[t].focus();return}(n=T())===null||n===void 0||n.focus()},an=["ArrowRight","ArrowDown"],ks=["ArrowLeft","ArrowUp"],_s=(t,e,n)=>{t&&(e.isComposing||e.keyCode===229||(t.stopKeydownPropagation&&e.stopPropagation(),e.key==="Enter"?xs(e,t):e.key==="Tab"?Es(e):[...an,...ks].includes(e.key)?Ts(e.key):e.key==="Escape"&&As(e,t,n)))},xs=(t,e)=>{if(!Se(e.allowEnterKey))return;const n=T();if(!n||!e.input)return;const o=Pe(n,e.input);if(t.target&&o&&t.target instanceof HTMLElement&&t.target.outerHTML===o.outerHTML){if(["textarea","file"].includes(e.input))return;sn(),t.preventDefault()}},Es=t=>{const e=t.target,n=et();let o=-1;for(let s=0;s<n.length;s++)if(e===n[s]){o=s;break}t.shiftKey?dt(o,-1):dt(o,1),t.stopPropagation(),t.preventDefault()},Ts=t=>{const e=ye(),n=G(),o=te(),s=le();if(!e||!n||!o||!s)return;const i=[n,o,s];if(document.activeElement instanceof HTMLElement&&!i.includes(document.activeElement))return;const r=an.includes(t)?"nextElementSibling":"previousElementSibling";let l=document.activeElement;if(l){for(let a=0;a<e.children.length;a++){if(l=l[r],!l)return;if(l instanceof HTMLButtonElement&&z(l))break}l instanceof HTMLButtonElement&&l.focus()}},As=(t,e,n)=>{t.preventDefault(),Se(e.allowEscapeKey)&&n(de.esc)};var ue={swalPromiseResolve:new WeakMap,swalPromiseReject:new WeakMap};const Ss=()=>{const t=U();Array.from(document.body.children).forEach(n=>{n.contains(t)||(n.hasAttribute("aria-hidden")&&n.setAttribute("data-previous-aria-hidden",n.getAttribute("aria-hidden")||""),n.setAttribute("aria-hidden","true"))})},ln=()=>{Array.from(document.body.children).forEach(e=>{e.hasAttribute("data-previous-aria-hidden")?(e.setAttribute("aria-hidden",e.getAttribute("data-previous-aria-hidden")||""),e.removeAttribute("data-previous-aria-hidden")):e.removeAttribute("aria-hidden")})},cn=typeof window<"u"&&!!window.GestureEvent,Ls=()=>{if(cn&&!Y(document.body,c.iosfix)){const t=document.body.scrollTop;document.body.style.top=`${t*-1}px`,A(document.body,c.iosfix),$s()}},$s=()=>{const t=U();if(!t)return;let e;t.ontouchstart=n=>{e=Is(n)},t.ontouchmove=n=>{e&&(n.preventDefault(),n.stopPropagation())}},Is=t=>{const e=t.target,n=U(),o=Xe();return!n||!o||Ps(t)||Ns(t)?!1:e===n||!ot(n)&&e instanceof HTMLElement&&!Io(e,o)&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"&&!(ot(o)&&o.contains(e))},Ps=t=>!!(t.touches&&t.touches.length&&t.touches[0].touchType==="stylus"),Ns=t=>t.touches&&t.touches.length>1,Bs=()=>{if(Y(document.body,c.iosfix)){const t=parseInt(document.body.style.top,10);K(document.body,c.iosfix),document.body.style.top="",document.body.scrollTop=t*-1}},Ms=()=>{const t=document.createElement("div");t.className=c["scrollbar-measure"],document.body.appendChild(t);const e=t.getBoundingClientRect().width-t.clientWidth;return document.body.removeChild(t),e};let he=null;const Rs=t=>{he===null&&(document.body.scrollHeight>window.innerHeight||t==="scroll")&&(he=parseInt(window.getComputedStyle(document.body).getPropertyValue("padding-right")),document.body.style.paddingRight=`${he+Ms()}px`)},Os=()=>{he!==null&&(document.body.style.paddingRight=`${he}px`,he=null)};function dn(t,e,n,o){Ie()?hn(t,o):(_o(n).then(()=>hn(t,o)),rn(p)),cn?(e.setAttribute("style","display:none !important"),e.removeAttribute("class"),e.innerHTML=""):e.remove(),tt()&&(Os(),Bs(),ln()),Ds()}function Ds(){K([document.documentElement,document.body],[c.shown,c["height-auto"],c["no-backdrop"],c["toast-shown"]])}function J(t){t=Us(t);const e=ue.swalPromiseResolve.get(this),n=qs(this);this.isAwaitingPromise?t.isDismissed||(ke(this),e(t)):n&&e(t)}const qs=t=>{const e=T();if(!e)return!1;const n=$.innerParams.get(t);if(!n||Y(e,n.hideClass.popup))return!1;K(e,n.showClass.popup),A(e,n.hideClass.popup);const o=U();return K(o,n.showClass.backdrop),A(o,n.hideClass.backdrop),zs(t,e,n),!0};function un(t){const e=ue.swalPromiseReject.get(this);ke(this),e&&e(t)}const ke=t=>{t.isAwaitingPromise&&(delete t.isAwaitingPromise,$.innerParams.get(t)||t._destroy())},Us=t=>typeof t>"u"?{isConfirmed:!1,isDenied:!1,isDismissed:!0}:Object.assign({isConfirmed:!1,isDenied:!1,isDismissed:!1},t),zs=(t,e,n)=>{var o;const s=U(),i=Kt(e);typeof n.willClose=="function"&&n.willClose(e),(o=p.eventEmitter)===null||o===void 0||o.emit("willClose",e),i&&s?js(t,e,s,!!n.returnFocus,n.didClose):s&&dn(t,s,!!n.returnFocus,n.didClose)},js=(t,e,n,o,s)=>{p.swalCloseEventFinishedCallback=dn.bind(null,t,n,o,s);const i=function(r){if(r.target===e){var l;(l=p.swalCloseEventFinishedCallback)===null||l===void 0||l.call(p),delete p.swalCloseEventFinishedCallback,e.removeEventListener("animationend",i),e.removeEventListener("transitionend",i)}};e.addEventListener("animationend",i),e.addEventListener("transitionend",i)},hn=(t,e)=>{setTimeout(()=>{var n;typeof e=="function"&&e.bind(t.params)(),(n=p.eventEmitter)===null||n===void 0||n.emit("didClose"),t._destroy&&t._destroy()})},fe=t=>{let e=T();if(e||new R,e=T(),!e)return;const n=ce();Ie()?D(ae()):Vs(e,t),M(n),e.setAttribute("data-loading","true"),e.setAttribute("aria-busy","true"),e.focus()},Vs=(t,e)=>{const n=ye(),o=ce();!n||!o||(!e&&z(G())&&(e=G()),M(n),e&&(D(e),o.setAttribute("data-button-to-replace",e.className),n.insertBefore(o,e)),A([t,n],c.loading))},Hs=(t,e)=>{e.input==="select"||e.input==="radio"?Ys(t,e):["text","email","number","tel","textarea"].some(n=>n===e.input)&&(Ye(e.inputValue)||Ze(e.inputValue))&&(fe(G()),Zs(t,e))},Fs=(t,e)=>{const n=t.getInput();if(!n)return null;switch(e.input){case"checkbox":return Ks(n);case"radio":return Gs(n);case"file":return Ws(n);default:return e.inputAutoTrim?n.value.trim():n.value}},Ks=t=>t.checked?1:0,Gs=t=>t.checked?t.value:null,Ws=t=>t.files&&t.files.length?t.getAttribute("multiple")!==null?t.files:t.files[0]:null,Ys=(t,e)=>{const n=T();if(!n)return;const o=s=>{e.input==="select"?Xs(n,Oe(s),e):e.input==="radio"&&Js(n,Oe(s),e)};Ye(e.inputOptions)||Ze(e.inputOptions)?(fe(G()),me(e.inputOptions).then(s=>{t.hideLoading(),o(s)})):typeof e.inputOptions=="object"?o(e.inputOptions):ee(`Unexpected type of inputOptions! Expected object, Map or Promise, got ${typeof e.inputOptions}`)},Zs=(t,e)=>{const n=t.getInput();n&&(D(n),me(e.inputValue).then(o=>{n.value=e.input==="number"?`${parseFloat(o)||0}`:`${o}`,M(n),n.focus(),t.hideLoading()}).catch(o=>{ee(`Error in inputValue promise: ${o}`),n.value="",M(n),n.focus(),t.hideLoading()}))};function Xs(t,e,n){const o=X(t,c.select);if(!o)return;const s=(i,r,l)=>{const a=document.createElement("option");a.value=l,H(a,r),a.selected=fn(l,n.inputValue),i.appendChild(a)};e.forEach(i=>{const r=i[0],l=i[1];if(Array.isArray(l)){const a=document.createElement("optgroup");a.label=r,a.disabled=!1,o.appendChild(a),l.forEach(d=>s(a,d[1],d[0]))}else s(o,l,r)}),o.focus()}function Js(t,e,n){const o=X(t,c.radio);if(!o)return;e.forEach(i=>{const r=i[0],l=i[1],a=document.createElement("input"),d=document.createElement("label");a.type="radio",a.name=c.radio,a.value=r,fn(r,n.inputValue)&&(a.checked=!0);const g=document.createElement("span");H(g,l),g.className=c.label,d.appendChild(a),d.appendChild(g),o.appendChild(d)});const s=o.querySelectorAll("input");s.length&&s[0].focus()}const Oe=t=>{const e=[];return t instanceof Map?t.forEach((n,o)=>{let s=n;typeof s=="object"&&(s=Oe(s)),e.push([o,s])}):Object.keys(t).forEach(n=>{let o=t[n];typeof o=="object"&&(o=Oe(o)),e.push([n,o])}),e},fn=(t,e)=>!!e&&e!==null&&e!==void 0&&e.toString()===t.toString(),Qs=t=>{const e=$.innerParams.get(t);t.disableButtons(),e.input?gn(t,"confirm"):ht(t,!0)},ei=t=>{const e=$.innerParams.get(t);t.disableButtons(),e.returnInputValueOnDeny?gn(t,"deny"):ut(t,!1)},ti=(t,e)=>{t.disableButtons(),e(de.cancel)},gn=(t,e)=>{const n=$.innerParams.get(t);if(!n.input){ee(`The "input" parameter is needed to be set when using returnInputValueOn${We(e)}`);return}const o=t.getInput(),s=Fs(t,n);n.inputValidator?ni(t,s,e):o&&!o.checkValidity()?(t.enableButtons(),t.showValidationMessage(n.validationMessage||o.validationMessage)):e==="deny"?ut(t,s):ht(t,s)},ni=(t,e,n)=>{const o=$.innerParams.get(t);t.disableInput(),Promise.resolve().then(()=>me(o.inputValidator(e,o.validationMessage))).then(i=>{t.enableButtons(),t.enableInput(),i?t.showValidationMessage(i):n==="deny"?ut(t,e):ht(t,e)})},ut=(t,e)=>{const n=$.innerParams.get(t);n.showLoaderOnDeny&&fe(te()),n.preDeny?(t.isAwaitingPromise=!0,Promise.resolve().then(()=>me(n.preDeny(e,n.validationMessage))).then(s=>{s===!1?(t.hideLoading(),ke(t)):t.close({isDenied:!0,value:typeof s>"u"?e:s})}).catch(s=>wn(t,s))):t.close({isDenied:!0,value:e})},pn=(t,e)=>{t.close({isConfirmed:!0,value:e})},wn=(t,e)=>{t.rejectPromise(e)},ht=(t,e)=>{const n=$.innerParams.get(t);n.showLoaderOnConfirm&&fe(),n.preConfirm?(t.resetValidationMessage(),t.isAwaitingPromise=!0,Promise.resolve().then(()=>me(n.preConfirm(e,n.validationMessage))).then(s=>{z(Le())||s===!1?(t.hideLoading(),ke(t)):pn(t,typeof s>"u"?e:s)}).catch(s=>wn(t,s))):pn(t,e)};function De(){const t=$.innerParams.get(this);if(!t)return;const e=$.domCache.get(this);D(e.loader),Ie()?t.icon&&M(ae()):oi(e),K([e.popup,e.actions],c.loading),e.popup.removeAttribute("aria-busy"),e.popup.removeAttribute("data-loading"),e.confirmButton.disabled=!1,e.denyButton.disabled=!1,e.cancelButton.disabled=!1}const oi=t=>{const e=t.loader.getAttribute("data-button-to-replace"),n=e?t.popup.getElementsByClassName(e):[];n.length?M(n[0],"inline-block"):$o()&&D(t.actions)};function mn(){const t=$.innerParams.get(this),e=$.domCache.get(this);return e?Pe(e.popup,t.input):null}function bn(t,e,n){const o=$.domCache.get(t);e.forEach(s=>{o[s].disabled=n})}function yn(t,e){const n=T();if(!(!n||!t))if(t.type==="radio"){const o=n.querySelectorAll(`[name="${c.radio}"]`);for(let s=0;s<o.length;s++)o[s].disabled=e}else t.disabled=e}function vn(){bn(this,["confirmButton","denyButton","cancelButton"],!1)}function Cn(){bn(this,["confirmButton","denyButton","cancelButton"],!0)}function kn(){yn(this.getInput(),!1)}function _n(){yn(this.getInput(),!0)}function xn(t){const e=$.domCache.get(this),n=$.innerParams.get(this);H(e.validationMessage,t),e.validationMessage.className=c["validation-message"],n.customClass&&n.customClass.validationMessage&&A(e.validationMessage,n.customClass.validationMessage),M(e.validationMessage);const o=this.getInput();o&&(o.setAttribute("aria-invalid","true"),o.setAttribute("aria-describedby",c["validation-message"]),Vt(o),A(o,c.inputerror))}function En(){const t=$.domCache.get(this);t.validationMessage&&D(t.validationMessage);const e=this.getInput();e&&(e.removeAttribute("aria-invalid"),e.removeAttribute("aria-describedby"),K(e,c.inputerror))}const Q={title:"",titleText:"",text:"",html:"",footer:"",icon:void 0,iconColor:void 0,iconHtml:void 0,template:void 0,toast:!1,draggable:!1,animation:!0,theme:"light",showClass:{popup:"swal2-show",backdrop:"swal2-backdrop-show",icon:"swal2-icon-show"},hideClass:{popup:"swal2-hide",backdrop:"swal2-backdrop-hide",icon:"swal2-icon-hide"},customClass:{},target:"body",color:void 0,backdrop:!0,heightAuto:!0,allowOutsideClick:!0,allowEscapeKey:!0,allowEnterKey:!0,stopKeydownPropagation:!0,keydownListenerCapture:!1,showConfirmButton:!0,showDenyButton:!1,showCancelButton:!1,preConfirm:void 0,preDeny:void 0,confirmButtonText:"OK",confirmButtonAriaLabel:"",confirmButtonColor:void 0,denyButtonText:"No",denyButtonAriaLabel:"",denyButtonColor:void 0,cancelButtonText:"Cancel",cancelButtonAriaLabel:"",cancelButtonColor:void 0,buttonsStyling:!0,reverseButtons:!1,focusConfirm:!0,focusDeny:!1,focusCancel:!1,returnFocus:!0,showCloseButton:!1,closeButtonHtml:"×",closeButtonAriaLabel:"Close this dialog",loaderHtml:"",showLoaderOnConfirm:!1,showLoaderOnDeny:!1,imageUrl:void 0,imageWidth:void 0,imageHeight:void 0,imageAlt:"",timer:void 0,timerProgressBar:!1,width:void 0,padding:void 0,background:void 0,input:void 0,inputPlaceholder:"",inputLabel:"",inputValue:"",inputOptions:{},inputAutoFocus:!0,inputAutoTrim:!0,inputAttributes:{},inputValidator:void 0,returnInputValueOnDeny:!1,validationMessage:void 0,grow:!1,position:"center",progressSteps:[],currentProgressStep:void 0,progressStepsDistance:void 0,willOpen:void 0,didOpen:void 0,didRender:void 0,willClose:void 0,didClose:void 0,didDestroy:void 0,scrollbarPadding:!0,topLayer:!1},si=["allowEscapeKey","allowOutsideClick","background","buttonsStyling","cancelButtonAriaLabel","cancelButtonColor","cancelButtonText","closeButtonAriaLabel","closeButtonHtml","color","confirmButtonAriaLabel","confirmButtonColor","confirmButtonText","currentProgressStep","customClass","denyButtonAriaLabel","denyButtonColor","denyButtonText","didClose","didDestroy","draggable","footer","hideClass","html","icon","iconColor","iconHtml","imageAlt","imageHeight","imageUrl","imageWidth","preConfirm","preDeny","progressSteps","returnFocus","reverseButtons","showCancelButton","showCloseButton","showConfirmButton","showDenyButton","text","title","titleText","theme","willClose"],ii={allowEnterKey:void 0},ri=["allowOutsideClick","allowEnterKey","backdrop","draggable","focusConfirm","focusDeny","focusCancel","returnFocus","heightAuto","keydownListenerCapture"],Tn=t=>Object.prototype.hasOwnProperty.call(Q,t),An=t=>si.indexOf(t)!==-1,Sn=t=>ii[t],ai=t=>{Tn(t)||q(`Unknown parameter "${t}"`)},li=t=>{ri.includes(t)&&q(`The parameter "${t}" is incompatible with toasts`)},ci=t=>{const e=Sn(t);e&&qt(t,e)},Ln=t=>{t.backdrop===!1&&t.allowOutsideClick&&q('"allowOutsideClick" parameter requires `backdrop` parameter to be set to `true`'),t.theme&&!["light","dark","auto","minimal","borderless","bootstrap-4","bootstrap-4-light","bootstrap-4-dark","bootstrap-5","bootstrap-5-light","bootstrap-5-dark","material-ui","material-ui-light","material-ui-dark","embed-iframe","bulma","bulma-light","bulma-dark"].includes(t.theme)&&q(`Invalid theme "${t.theme}"`);for(const e in t)ai(e),t.toast&&li(e),ci(e)};function $n(t){const e=U(),n=T(),o=$.innerParams.get(this);if(!n||Y(n,o.hideClass.popup)){q("You're trying to update the closed or closing popup, that won't work. Use the update() method in preConfirm parameter or show a new popup.");return}const s=di(t),i=Object.assign({},o,s);Ln(i),e&&(e.dataset.swal2Theme=i.theme),on(this,i),$.innerParams.set(this,i),Object.defineProperties(this,{params:{value:Object.assign({},this.params,t),writable:!1,enumerable:!0}})}const di=t=>{const e={};return Object.keys(t).forEach(n=>{if(An(n)){const o=t;e[n]=o[n]}else q(`Invalid parameter to update: ${n}`)}),e};function In(){var t;const e=$.domCache.get(this),n=$.innerParams.get(this);if(!n){Pn(this);return}e.popup&&p.swalCloseEventFinishedCallback&&(p.swalCloseEventFinishedCallback(),delete p.swalCloseEventFinishedCallback),typeof n.didDestroy=="function"&&n.didDestroy(),(t=p.eventEmitter)===null||t===void 0||t.emit("didDestroy"),ui(this)}const ui=t=>{Pn(t),delete t.params,delete p.keydownHandler,delete p.keydownTarget,delete p.currentInstance},Pn=t=>{t.isAwaitingPromise?(ft($,t),t.isAwaitingPromise=!0):(ft(ue,t),ft($,t),delete t.isAwaitingPromise,delete t.disableButtons,delete t.enableButtons,delete t.getInput,delete t.disableInput,delete t.enableInput,delete t.hideLoading,delete t.disableLoading,delete t.showValidationMessage,delete t.resetValidationMessage,delete t.close,delete t.closePopup,delete t.closeModal,delete t.closeToast,delete t.rejectPromise,delete t.update,delete t._destroy)},ft=(t,e)=>{for(const n in t)t[n].delete(e)};var hi=Object.freeze({__proto__:null,_destroy:In,close:J,closeModal:J,closePopup:J,closeToast:J,disableButtons:Cn,disableInput:_n,disableLoading:De,enableButtons:vn,enableInput:kn,getInput:mn,handleAwaitingPromise:ke,hideLoading:De,rejectPromise:un,resetValidationMessage:En,showValidationMessage:xn,update:$n});const fi=(t,e,n)=>{t.toast?gi(t,e,n):(wi(e),mi(e),bi(t,e,n))},gi=(t,e,n)=>{e.popup.onclick=()=>{t&&(pi(t)||t.timer||t.input)||n(de.close)}},pi=t=>!!(t.showConfirmButton||t.showDenyButton||t.showCancelButton||t.showCloseButton);let qe=!1;const wi=t=>{t.popup.onmousedown=()=>{t.container.onmouseup=function(e){t.container.onmouseup=()=>{},e.target===t.container&&(qe=!0)}}},mi=t=>{t.container.onmousedown=e=>{e.target===t.container&&e.preventDefault(),t.popup.onmouseup=function(n){t.popup.onmouseup=()=>{},(n.target===t.popup||n.target instanceof HTMLElement&&t.popup.contains(n.target))&&(qe=!0)}}},bi=(t,e,n)=>{e.container.onclick=o=>{if(qe){qe=!1;return}o.target===e.container&&Se(t.allowOutsideClick)&&n(de.backdrop)}},yi=t=>typeof t=="object"&&t!==null&&"jquery"in t,Nn=t=>t instanceof Element||yi(t),vi=t=>{const e={};return typeof t[0]=="object"&&!Nn(t[0])?Object.assign(e,t[0]):["title","html","icon"].forEach((n,o)=>{const s=t[o];typeof s=="string"||Nn(s)?e[n]=s:s!==void 0&&ee(`Unexpected type of ${n}! Expected "string" or "Element", got ${typeof s}`)}),e};function Ci(...t){return new this(...t)}function ki(t){class e extends this{_main(o,s){return super._main(o,Object.assign({},t,s))}}return e}const _i=()=>p.timeout&&p.timeout.getTimerLeft(),Bn=()=>{if(p.timeout)return Po(),p.timeout.stop()},Mn=()=>{if(p.timeout){const t=p.timeout.start();return st(t),t}},xi=()=>{const t=p.timeout;return t&&(t.running?Bn():Mn())},Ei=t=>{if(p.timeout){const e=p.timeout.increase(t);return st(e,!0),e}},Ti=()=>!!(p.timeout&&p.timeout.isRunning());let Rn=!1;const gt={};function Ai(t="data-swal-template"){gt[t]=this,Rn||(document.body.addEventListener("click",Si),Rn=!0)}const Si=t=>{for(let e=t.target;e&&e!==document;e=e.parentNode)for(const n in gt){const o=e.getAttribute&&e.getAttribute(n);if(o){gt[n].fire({template:o});return}}};class Li{constructor(){this.events={}}_getHandlersByEventName(e){return typeof this.events[e]>"u"&&(this.events[e]=[]),this.events[e]}on(e,n){const o=this._getHandlersByEventName(e);o.includes(n)||o.push(n)}once(e,n){const o=(...s)=>{this.removeListener(e,o),n.apply(this,s)};this.on(e,o)}emit(e,...n){this._getHandlersByEventName(e).forEach(o=>{try{o.apply(this,n)}catch(s){console.error(s)}})}removeListener(e,n){const o=this._getHandlersByEventName(e),s=o.indexOf(n);s>-1&&o.splice(s,1)}removeAllListeners(e){this.events[e]!==void 0&&(this.events[e].length=0)}reset(){this.events={}}}p.eventEmitter=new Li;var $i=Object.freeze({__proto__:null,argsToParams:vi,bindClickHandler:Ai,clickCancel:vs,clickConfirm:sn,clickDeny:ys,enableLoading:fe,fire:Ci,getActions:ye,getCancelButton:le,getCloseButton:Qe,getConfirmButton:G,getContainer:U,getDenyButton:te,getFocusableElements:et,getFooter:jt,getHtmlContainer:Xe,getIcon:ae,getIconContent:Eo,getImage:zt,getInputLabel:To,getLoader:ce,getPopup:T,getProgressSteps:Je,getTimerLeft:_i,getTimerProgressBar:$e,getTitle:Ut,getValidationMessage:Le,increaseTimer:Ei,isDeprecatedParameter:Sn,isLoading:So,isTimerRunning:Ti,isUpdatableParameter:An,isValidParameter:Tn,isVisible:bs,mixin:ki,off:(t,e)=>{if(p.eventEmitter){if(!t){p.eventEmitter.reset();return}e?p.eventEmitter.removeListener(t,e):p.eventEmitter.removeAllListeners(t)}},on:(t,e)=>{p.eventEmitter&&p.eventEmitter.on(t,e)},once:(t,e)=>{p.eventEmitter&&p.eventEmitter.once(t,e)},resumeTimer:Mn,showLoading:fe,stopTimer:Bn,toggleTimer:xi});class Ii{constructor(e,n){this.callback=e,this.remaining=n,this.running=!1,this.start()}start(){return this.running||(this.running=!0,this.started=new Date,this.id=setTimeout(this.callback,this.remaining)),this.remaining}stop(){return this.started&&this.running&&(this.running=!1,clearTimeout(this.id),this.remaining-=new Date().getTime()-this.started.getTime()),this.remaining}increase(e){const n=this.running;return n&&this.stop(),this.remaining+=e,n&&this.start(),this.remaining}getTimerLeft(){return this.running&&(this.stop(),this.start()),this.remaining}isRunning(){return this.running}}const On=["swal-title","swal-html","swal-footer"],Pi=t=>{const e=typeof t.template=="string"?document.querySelector(t.template):t.template;if(!e)return{};const n=e.content;return Ui(n),Object.assign(Ni(n),Bi(n),Mi(n),Ri(n),Oi(n),Di(n),qi(n,On))},Ni=t=>{const e={};return Array.from(t.querySelectorAll("swal-param")).forEach(o=>{se(o,["name","value"]);const s=o.getAttribute("name"),i=o.getAttribute("value");!s||!i||(s in Q&&typeof Q[s]=="boolean"?e[s]=i!=="false":s in Q&&typeof Q[s]=="object"?e[s]=JSON.parse(i):e[s]=i)}),e},Bi=t=>{const e={};return Array.from(t.querySelectorAll("swal-function-param")).forEach(o=>{const s=o.getAttribute("name"),i=o.getAttribute("value");!s||!i||(e[s]=new Function(`return ${i}`)())}),e},Mi=t=>{const e={};return Array.from(t.querySelectorAll("swal-button")).forEach(o=>{se(o,["type","color","aria-label"]);const s=o.getAttribute("type");if(!(!s||!["confirm","cancel","deny"].includes(s))){if(e[`${s}ButtonText`]=o.innerHTML,e[`show${We(s)}Button`]=!0,o.hasAttribute("color")){const i=o.getAttribute("color");i!==null&&(e[`${s}ButtonColor`]=i)}if(o.hasAttribute("aria-label")){const i=o.getAttribute("aria-label");i!==null&&(e[`${s}ButtonAriaLabel`]=i)}}}),e},Ri=t=>{const e={},n=t.querySelector("swal-image");return n&&(se(n,["src","width","height","alt"]),n.hasAttribute("src")&&(e.imageUrl=n.getAttribute("src")||void 0),n.hasAttribute("width")&&(e.imageWidth=n.getAttribute("width")||void 0),n.hasAttribute("height")&&(e.imageHeight=n.getAttribute("height")||void 0),n.hasAttribute("alt")&&(e.imageAlt=n.getAttribute("alt")||void 0)),e},Oi=t=>{const e={},n=t.querySelector("swal-icon");return n&&(se(n,["type","color"]),n.hasAttribute("type")&&(e.icon=n.getAttribute("type")),n.hasAttribute("color")&&(e.iconColor=n.getAttribute("color")),e.iconHtml=n.innerHTML),e},Di=t=>{const e={},n=t.querySelector("swal-input");n&&(se(n,["type","label","placeholder","value"]),e.input=n.getAttribute("type")||"text",n.hasAttribute("label")&&(e.inputLabel=n.getAttribute("label")),n.hasAttribute("placeholder")&&(e.inputPlaceholder=n.getAttribute("placeholder")),n.hasAttribute("value")&&(e.inputValue=n.getAttribute("value")));const o=Array.from(t.querySelectorAll("swal-input-option"));return o.length&&(e.inputOptions={},o.forEach(s=>{se(s,["value"]);const i=s.getAttribute("value");if(!i)return;const r=s.innerHTML;e.inputOptions[i]=r})),e},qi=(t,e)=>{const n={};for(const o in e){const s=e[o],i=t.querySelector(s);i&&(se(i,[]),n[s.replace(/^swal-/,"")]=i.innerHTML.trim())}return n},Ui=t=>{const e=On.concat(["swal-param","swal-function-param","swal-button","swal-image","swal-icon","swal-input","swal-input-option"]);Array.from(t.children).forEach(n=>{const o=n.tagName.toLowerCase();e.includes(o)||q(`Unrecognized element <${o}>`)})},se=(t,e)=>{Array.from(t.attributes).forEach(n=>{e.indexOf(n.name)===-1&&q([`Unrecognized attribute "${n.name}" on <${t.tagName.toLowerCase()}>.`,`${e.length?`Allowed attributes are: ${e.join(", ")}`:"To set the value, use HTML within the element."}`])})},Dn=10,zi=t=>{var e,n;const o=U(),s=T();if(!o||!s)return;typeof t.willOpen=="function"&&t.willOpen(s),(e=p.eventEmitter)===null||e===void 0||e.emit("willOpen",s);const r=window.getComputedStyle(document.body).overflowY;if(Hi(o,s,t),setTimeout(()=>{ji(o,s)},Dn),tt()&&(Vi(o,t.scrollbarPadding!==void 0?t.scrollbarPadding:!1,r),Ss()),!Ie()&&!p.previousActiveElement&&(p.previousActiveElement=document.activeElement),typeof t.didOpen=="function"){const l=t.didOpen;setTimeout(()=>l(s))}(n=p.eventEmitter)===null||n===void 0||n.emit("didOpen",s)},Ue=t=>{const e=T();if(!e||t.target!==e)return;const n=U();n&&(e.removeEventListener("animationend",Ue),e.removeEventListener("transitionend",Ue),n.style.overflowY="auto",K(n,c["no-transition"]))},ji=(t,e)=>{Kt(e)?(t.style.overflowY="hidden",e.addEventListener("animationend",Ue),e.addEventListener("transitionend",Ue)):t.style.overflowY="auto"},Vi=(t,e,n)=>{Ls(),e&&n!=="hidden"&&Rs(n),setTimeout(()=>{t.scrollTop=0})},Hi=(t,e,n)=>{var o;(o=n.showClass)!==null&&o!==void 0&&o.backdrop&&A(t,n.showClass.backdrop),n.animation?(e.style.setProperty("opacity","0","important"),M(e,"grid"),setTimeout(()=>{var s;(s=n.showClass)!==null&&s!==void 0&&s.popup&&A(e,n.showClass.popup),e.style.removeProperty("opacity")},Dn)):M(e,"grid"),A([document.documentElement,document.body],c.shown),n.heightAuto&&n.backdrop&&!n.toast&&A([document.documentElement,document.body],c["height-auto"])};var qn={email:(t,e)=>/^[a-zA-Z0-9.+_'-]+@[a-zA-Z0-9.-]+\.[a-zA-Z0-9-]+$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid email address"),url:(t,e)=>/^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-z]{2,63}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(t)?Promise.resolve():Promise.resolve(e||"Invalid URL")};function Fi(t){t.inputValidator||(t.input==="email"&&(t.inputValidator=qn.email),t.input==="url"&&(t.inputValidator=qn.url))}function Ki(t){(!t.target||typeof t.target=="string"&&!document.querySelector(t.target)||typeof t.target!="string"&&!t.target.appendChild)&&(q('Target parameter is not valid, defaulting to "body"'),t.target="body")}function Gi(t){Fi(t),t.showLoaderOnConfirm&&!t.preConfirm&&q(`showLoaderOnConfirm is set to true, but preConfirm is not defined.
|
|
255
255
|
showLoaderOnConfirm should be used together with preConfirm, see usage example:
|
|
256
256
|
https://sweetalert2.github.io/#ajax-request`),Ki(t),typeof t.title=="string"&&(t.title=t.title.split(`
|
|
257
|
-
`).join("<br />")),zo(t)}let W;var qe=new WeakMap;class N{constructor(...e){if(yo(this,qe,Promise.resolve({isConfirmed:!1,isDenied:!1,isDismissed:!0})),typeof window>"u")return;W=this;const n=Object.freeze(this.constructor.argsToParams(e));this.params=n,this.isAwaitingPromise=!1,vo(qe,this,this._main(W.params))}_main(e,n={}){if(Ln(Object.assign({},n,e)),p.currentInstance){const i=ue.swalPromiseResolve.get(p.currentInstance),{isAwaitingPromise:r}=p.currentInstance;p.currentInstance._destroy(),r||i({isDismissed:!0}),tt()&&ln()}p.currentInstance=W;const o=Yi(e,n);Gi(o),Object.freeze(o),p.timeout&&(p.timeout.stop(),delete p.timeout),clearTimeout(p.restoreFocusTimeout);const s=Zi(W);return on(W,o),$.innerParams.set(W,o),Wi(W,s,o)}then(e){return Mt(qe,this).then(e)}finally(e){return Mt(qe,this).finally(e)}}const Wi=(t,e,n)=>new Promise((o,s)=>{const i=r=>{t.close({isDismissed:!0,dismiss:r,isConfirmed:!1,isDenied:!1})};ue.swalPromiseResolve.set(t,o),ue.swalPromiseReject.set(t,s),e.confirmButton.onclick=()=>{Qs(t)},e.denyButton.onclick=()=>{ei(t)},e.cancelButton.onclick=()=>{ti(t,i)},e.closeButton.onclick=()=>{i(de.close)},fi(n,e,i),Cs(p,n,i),Hs(t,n),qi(n),Xi(p,n,i),Ji(e,n),setTimeout(()=>{e.container.scrollTop=0})}),Yi=(t,e)=>{const n=Pi(t),o=Object.assign({},Q,e,n,t);return o.showClass=Object.assign({},Q.showClass,o.showClass),o.hideClass=Object.assign({},Q.hideClass,o.hideClass),o.animation===!1&&(o.showClass={backdrop:"swal2-noanimation"},o.hideClass={}),o},Zi=t=>{const e={popup:T(),container:z(),actions:ye(),confirmButton:G(),denyButton:te(),cancelButton:le(),loader:ce(),closeButton:Qe(),validationMessage:Le(),progressSteps:Je()};return $.domCache.set(t,e),e},Xi=(t,e,n)=>{const o=$e();D(o),e.timer&&(t.timeout=new Ii(()=>{n("timer"),delete t.timeout},e.timer),e.timerProgressBar&&o&&(R(o),F(o,e,"timerProgressBar"),setTimeout(()=>{t.timeout&&t.timeout.running&&st(e.timer)})))},Ji=(t,e)=>{if(!e.toast){if(!Se(e.allowEnterKey)){Ut("allowEnterKey"),tr();return}Qi(t)||er(t,e)||dt(-1,1)}},Qi=t=>{const e=Array.from(t.popup.querySelectorAll("[autofocus]"));for(const n of e)if(n instanceof HTMLElement&&q(n))return n.focus(),!0;return!1},er=(t,e)=>e.focusDeny&&q(t.denyButton)?(t.denyButton.focus(),!0):e.focusCancel&&q(t.cancelButton)?(t.cancelButton.focus(),!0):e.focusConfirm&&q(t.confirmButton)?(t.confirmButton.focus(),!0):!1,tr=()=>{document.activeElement instanceof HTMLElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur()};N.prototype.disableButtons=Cn,N.prototype.enableButtons=vn,N.prototype.getInput=mn,N.prototype.disableInput=_n,N.prototype.enableInput=kn,N.prototype.hideLoading=De,N.prototype.disableLoading=De,N.prototype.showValidationMessage=xn,N.prototype.resetValidationMessage=En,N.prototype.close=J,N.prototype.closePopup=J,N.prototype.closeModal=J,N.prototype.closeToast=J,N.prototype.rejectPromise=un,N.prototype.update=$n,N.prototype._destroy=In,Object.assign(N,$i),Object.keys(hi).forEach(t=>{N[t]=function(...e){if(W&&W[t])return W[t](...e)}}),N.DismissReason=de,N.version="11.26.18";const O=N;O.default=O,typeof document<"u"&&(function(t,e){var n=t.createElement("style");if(t.getElementsByTagName("head")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=e);else try{n.innerHTML=e}catch{n.innerText=e}})(document,':root{--swal2-outline: 0 0 0 3px rgba(100, 150, 200, 0.5);--swal2-container-padding: 0.625em;--swal2-backdrop: rgba(0, 0, 0, 0.4);--swal2-backdrop-transition: background-color 0.15s;--swal2-width: 32em;--swal2-padding: 0 0 1.25em;--swal2-border: none;--swal2-border-radius: 0.3125rem;--swal2-background: white;--swal2-color: #545454;--swal2-show-animation: swal2-show 0.3s;--swal2-hide-animation: swal2-hide 0.15s forwards;--swal2-icon-zoom: 1;--swal2-icon-animations: true;--swal2-title-padding: 0.8em 1em 0;--swal2-html-container-padding: 1em 1.6em 0.3em;--swal2-input-border: 1px solid #d9d9d9;--swal2-input-border-radius: 0.1875em;--swal2-input-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent;--swal2-input-background: transparent;--swal2-input-transition: border-color 0.2s, box-shadow 0.2s;--swal2-input-hover-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent;--swal2-input-focus-border: 1px solid #b4dbed;--swal2-input-focus-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(100, 150, 200, 0.5);--swal2-progress-step-background: #add8e6;--swal2-validation-message-background: #f0f0f0;--swal2-validation-message-color: #666;--swal2-footer-border-color: #eee;--swal2-footer-background: transparent;--swal2-footer-color: inherit;--swal2-timer-progress-bar-background: rgba(0, 0, 0, 0.3);--swal2-close-button-position: initial;--swal2-close-button-inset: auto;--swal2-close-button-font-size: 2.5em;--swal2-close-button-color: #ccc;--swal2-close-button-transition: color 0.2s, box-shadow 0.2s;--swal2-close-button-outline: initial;--swal2-close-button-box-shadow: inset 0 0 0 3px transparent;--swal2-close-button-focus-box-shadow: inset var(--swal2-outline);--swal2-close-button-hover-transform: none;--swal2-actions-justify-content: center;--swal2-actions-width: auto;--swal2-actions-margin: 1.25em auto 0;--swal2-actions-padding: 0;--swal2-actions-border-radius: 0;--swal2-actions-background: transparent;--swal2-action-button-transition: background-color 0.2s, box-shadow 0.2s;--swal2-action-button-hover: black 10%;--swal2-action-button-active: black 10%;--swal2-confirm-button-box-shadow: none;--swal2-confirm-button-border-radius: 0.25em;--swal2-confirm-button-background-color: #7066e0;--swal2-confirm-button-color: #fff;--swal2-deny-button-box-shadow: none;--swal2-deny-button-border-radius: 0.25em;--swal2-deny-button-background-color: #dc3741;--swal2-deny-button-color: #fff;--swal2-cancel-button-box-shadow: none;--swal2-cancel-button-border-radius: 0.25em;--swal2-cancel-button-background-color: #6e7881;--swal2-cancel-button-color: #fff;--swal2-toast-show-animation: swal2-toast-show 0.5s;--swal2-toast-hide-animation: swal2-toast-hide 0.1s forwards;--swal2-toast-border: none;--swal2-toast-box-shadow: 0 0 1px hsl(0deg 0% 0% / 0.075), 0 1px 2px hsl(0deg 0% 0% / 0.075), 1px 2px 4px hsl(0deg 0% 0% / 0.075), 1px 3px 8px hsl(0deg 0% 0% / 0.075), 2px 4px 16px hsl(0deg 0% 0% / 0.075)}[data-swal2-theme=dark]{--swal2-dark-theme-black: #19191a;--swal2-dark-theme-white: #e1e1e1;--swal2-background: var(--swal2-dark-theme-black);--swal2-color: var(--swal2-dark-theme-white);--swal2-footer-border-color: #555;--swal2-input-background: color-mix(in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10%);--swal2-validation-message-background: color-mix( in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10% );--swal2-validation-message-color: var(--swal2-dark-theme-white);--swal2-timer-progress-bar-background: rgba(255, 255, 255, 0.7)}@media(prefers-color-scheme: dark){[data-swal2-theme=auto]{--swal2-dark-theme-black: #19191a;--swal2-dark-theme-white: #e1e1e1;--swal2-background: var(--swal2-dark-theme-black);--swal2-color: var(--swal2-dark-theme-white);--swal2-footer-border-color: #555;--swal2-input-background: color-mix(in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10%);--swal2-validation-message-background: color-mix( in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10% );--swal2-validation-message-color: var(--swal2-dark-theme-white);--swal2-timer-progress-bar-background: rgba(255, 255, 255, 0.7)}}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px var(--swal2-backdrop)}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}@media print{body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown) .swal2-container{position:static !important}}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:"top-start top top-end" "center-start center center-end" "bottom-start bottom-center bottom-end";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:var(--swal2-container-padding);overflow-x:hidden;transition:var(--swal2-backdrop-transition);-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:var(--swal2-backdrop)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container)[popover]{width:auto;border:0}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:var(--swal2-width);max-width:100%;padding:var(--swal2-padding);border:var(--swal2-border);border-radius:var(--swal2-border-radius);background:var(--swal2-background);color:var(--swal2-color);font-family:inherit;font-size:1rem;container-name:swal2-popup}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) div:where(.swal2-popup).swal2-draggable{cursor:grab}div:where(.swal2-container) div:where(.swal2-popup).swal2-draggable div:where(.swal2-icon){cursor:grab}div:where(.swal2-container) div:where(.swal2-popup).swal2-dragging{cursor:grabbing}div:where(.swal2-container) div:where(.swal2-popup).swal2-dragging div:where(.swal2-icon){cursor:grabbing}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:var(--swal2-title-padding);color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;overflow-wrap:break-word;cursor:initial}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:var(--swal2-actions-justify-content);width:var(--swal2-actions-width);margin:var(--swal2-actions-margin);padding:var(--swal2-actions-padding);border-radius:var(--swal2-actions-border-radius);background:var(--swal2-actions-background)}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:var(--swal2-action-button-transition);border:none;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm){border-radius:var(--swal2-confirm-button-border-radius);background:initial;background-color:var(--swal2-confirm-button-background-color);box-shadow:var(--swal2-confirm-button-box-shadow);color:var(--swal2-confirm-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):hover{background-color:color-mix(in srgb, var(--swal2-confirm-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):active{background-color:color-mix(in srgb, var(--swal2-confirm-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny){border-radius:var(--swal2-deny-button-border-radius);background:initial;background-color:var(--swal2-deny-button-background-color);box-shadow:var(--swal2-deny-button-box-shadow);color:var(--swal2-deny-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):hover{background-color:color-mix(in srgb, var(--swal2-deny-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):active{background-color:color-mix(in srgb, var(--swal2-deny-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel){border-radius:var(--swal2-cancel-button-border-radius);background:initial;background-color:var(--swal2-cancel-button-background-color);box-shadow:var(--swal2-cancel-button-box-shadow);color:var(--swal2-cancel-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):hover{background-color:color-mix(in srgb, var(--swal2-cancel-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):active{background-color:color-mix(in srgb, var(--swal2-cancel-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):focus-visible{outline:none;box-shadow:var(--swal2-action-button-focus-box-shadow)}div:where(.swal2-container) button:where(.swal2-styled)[disabled]:not(.swal2-loading){opacity:.4}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid var(--swal2-footer-border-color);background:var(--swal2-footer-background);color:var(--swal2-footer-color);font-size:1em;text-align:center;cursor:initial}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:var(--swal2-border-radius);border-bottom-left-radius:var(--swal2-border-radius)}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:var(--swal2-timer-progress-bar-background)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em;cursor:initial}div:where(.swal2-container) button:where(.swal2-close){position:var(--swal2-close-button-position);inset:var(--swal2-close-button-inset);z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:var(--swal2-close-button-transition);border:none;border-radius:var(--swal2-border-radius);outline:var(--swal2-close-button-outline);background:rgba(0,0,0,0);color:var(--swal2-close-button-color);font-family:monospace;font-size:var(--swal2-close-button-font-size);cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:var(--swal2-close-button-hover-transform);background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus-visible{outline:none;box-shadow:var(--swal2-close-button-focus-box-shadow)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-html-container){z-index:1;justify-content:center;margin:0;padding:var(--swal2-html-container-padding);overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;overflow-wrap:break-word;word-break:break-word;cursor:initial}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:var(--swal2-input-transition);border:var(--swal2-input-border);border-radius:var(--swal2-input-border-radius);background:var(--swal2-input-background);box-shadow:var(--swal2-input-box-shadow);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):hover,div:where(.swal2-container) input:where(.swal2-file):hover,div:where(.swal2-container) textarea:where(.swal2-textarea):hover{box-shadow:var(--swal2-input-hover-box-shadow)}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:var(--swal2-input-focus-border);outline:none;box-shadow:var(--swal2-input-focus-box-shadow)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:var(--swal2-background)}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:var(--swal2-input-background);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:var(--swal2-input-background);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:var(--swal2-background);color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:var(--swal2-validation-message-background);color:var(--swal2-validation-message-color);font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:var(--swal2-progress-step-background);color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:var(--swal2-progress-step-background)}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;zoom:var(--swal2-icon-zoom);border:.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}}div:where(.swal2-icon).swal2-warning{border-color:#f8bb86;color:#f8bb86}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}}div:where(.swal2-icon).swal2-info{border-color:#3fc3ee;color:#3fc3ee}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}}div:where(.swal2-icon).swal2-question{border-color:#87adbd;color:#87adbd}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:var(--swal2-show-animation)}.swal2-hide{animation:var(--swal2-hide-animation)}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;border:var(--swal2-toast-border);background:var(--swal2-background);box-shadow:var(--swal2-toast-box-shadow);pointer-events:all}.swal2-toast>*{grid-column:2}.swal2-toast h2:where(.swal2-title){margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-toast .swal2-loading{justify-content:center}.swal2-toast input:where(.swal2-input){height:2em;margin:.5em;font-size:1em}.swal2-toast .swal2-validation-message{font-size:1em}.swal2-toast div:where(.swal2-footer){margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-toast button:where(.swal2-close){grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-toast div:where(.swal2-html-container){margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-toast div:where(.swal2-html-container):empty{padding:0}.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-toast div:where(.swal2-actions){justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-toast button:where(.swal2-styled){margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;border-radius:50%}.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}@container swal2-popup style(--swal2-icon-animations:true){.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}}.swal2-toast.swal2-show{animation:var(--swal2-toast-show-animation)}.swal2-toast.swal2-hide{animation:var(--swal2-toast-hide-animation)}@keyframes swal2-show{0%{transform:translate3d(0, -50px, 0) scale(0.9);opacity:0}100%{transform:translate3d(0, 0, 0) scale(1);opacity:1}}@keyframes swal2-hide{0%{transform:translate3d(0, 0, 0) scale(1);opacity:1}100%{transform:translate3d(0, -50px, 0) scale(0.9);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}'),He.create();class nr{constructor(){this.isActive=!1,this.baseUrl="",this.appCode="",this.token="",this.getRequestToken=null,this.currentLocale="zh-CN",this.languages=[],this.wrappedElements=new Set,this.clickHandler=this.handleElementClick.bind(this)}async initConfig(){const e=E.get("I18N_CONFIG")||{},n=e.env||"local";this.baseUrl=kt({env:n}),console.log("baseUrl:",this.baseUrl),this.appCode=e.appCode||"",this.unitCode=e.unitCode||"GREENCLOUD",this.token=e.token||(E.get("I18N_CONFIG")||{}).token||"",this.getRequestToken=globalThis.__GC_I18N_GET_REQUEST_TOKEN__||null,this.currentLocale=e.locale||E.get("I18N_LANGUAGE")||"zh-CN",await this.loadLanguages()}async loadLanguages(){const e=E.get("I18N_LANGUAGES");if(e&&Array.isArray(e)&&e.length>0){this.languages=e;return}if(!this.appCode){this.languages=[];return}try{const n=await xt({baseUrl:this.baseUrl,appCode:this.appCode,token:this.token,getRequestToken:this.getRequestToken});if(n.data&&n.data.result===0){const o=m.get(n.data,"retVal",[]);this.languages=o.map(s=>({langCode:s.language||s.langCode||s,langName:s.langName||s.language||s})),E.set("I18N_LANGUAGES",this.languages)}}catch(n){console.error("获取语言列表失败:",n),this.languages=[]}}async toggle(){await this.initConfig(),this.isActive=!this.isActive,this.isActive?this.enableEditMode():this.disableEditMode()}enableEditMode(){document.body.classList.add("i18n-edit-mode-active"),this.scanAndWrapTextElements(),document.addEventListener("click",this.clickHandler,!0),O.fire({title:"文本编辑模式已开启",text:"点击带外框的文本即可编辑翻译内容,按 Ctrl+Shift+E 退出",icon:"info",timer:2e3,showConfirmButton:!1,position:"top-end",toast:!0})}disableEditMode(){document.body.classList.remove("i18n-edit-mode-active"),this.unwrapTextElements(),document.removeEventListener("click",this.clickHandler,!0)}scanAndWrapTextElements(){this.scanTextNodes(document.body)}scanTextNodes(e){const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),o=[];let s;for(;s=n.nextNode();)o.push(s);o.forEach(i=>{const r=i.textContent;if(!r||!r.trim())return;const l=this.findKeyByValue(r.trim());l?this.wrapTextNode(i,l):this.wrapPartialTextNode(i)})}wrapPartialTextNode(e){const n=e.textContent;if(!n)return;const o=[];if(globalThis.__I18N_KEY_VALUE_MAP__)for(const[s,i]of Object.entries(globalThis.__I18N_KEY_VALUE_MAP__))n.includes(s)&&o.push({translatedValue:s,key:i,index:n.indexOf(s)});o.sort((s,i)=>s.index-i.index),o.length>0&&this.wrapMultipleTextParts(e,o)}wrapMultipleTextParts(e,n){const o=e.parentElement;if(!o||o.tagName==="SCRIPT"||o.tagName==="STYLE"||o.tagName==="IFRAME"||o.classList.contains("i18n-editable-text")||o.classList.contains("i18n-text-overlay")||o.closest(".swal2-container"))return;const s=e.textContent,i=document.createDocumentFragment();let r=0;if(n.forEach(l=>{const{translatedValue:a,key:d,index:g}=l;if(g>r){const h=s.substring(r,g);i.appendChild(document.createTextNode(h))}const u=document.createElement("span");u.className="i18n-editable-text i18n-text-overlay",u.setAttribute("data-i18n-key",d),u.textContent=a,i.appendChild(u),this.wrappedElements.add(u),r=g+a.length}),r<s.length){const l=s.substring(r);i.appendChild(document.createTextNode(l))}o.replaceChild(i,e)}findKeyByValue(e){if(!e)return null;if(globalThis.__I18N_KEY_VALUE_MAP__&&globalThis.__I18N_KEY_VALUE_MAP__[e])return globalThis.__I18N_KEY_VALUE_MAP__[e];const s=`I18N_MESSAGES_COMMON_${(E.get("I18N_CONFIG")||{}).locale||"zh-CN"}`,i=E.get(s)||{};for(const[a,d]of Object.entries(i))if(d===e)return a;const r=`I18N_MESSAGES_${this.currentLocale}`,l=E.get(r)||{};for(const[a,d]of Object.entries(l))if(d===e)return a;return null}wrapTextNode(e,n){const o=e.parentElement;if(!o||o.tagName==="SCRIPT"||o.tagName==="STYLE"||o.tagName==="IFRAME"||o.classList.contains("i18n-editable-text")||o.classList.contains("i18n-text-overlay")||o.closest(".swal2-container"))return;const s=document.createElement("span");s.className="i18n-editable-text i18n-text-overlay",s.setAttribute("data-i18n-key",n),s.textContent=e.textContent,o.replaceChild(s,e),this.wrappedElements.add(s)}unwrapTextElements(){this.wrappedElements.forEach(e=>{if(e.classList.remove("i18n-editable-text"),e.classList.contains("i18n-text-overlay")){const n=e.parentNode;if(n){const o=document.createTextNode(e.textContent);n.replaceChild(o,e)}}}),this.wrappedElements.clear()}handleElementClick(e){const n=e.target.closest("[data-i18n-key]");if(n&&this.isActive){e.preventDefault(),e.stopPropagation();const o=n.getAttribute("data-i18n-key");o&&this.openEditModal(o)}}async openEditModal(e){try{if(e.startsWith("i.")||e.startsWith("pro.")){O.fire({text:"系统字段不支持修改",icon:"info",timer:2e3,showConfirmButton:!1,position:"top",toast:!0});return}const n=await this.fetchTranslations(e);console.log("translations",n);const o=n[0]||"";if(!o){O.fire({text:"暂无翻译数据",icon:"info",timer:2e3,showConfirmButton:!1,position:"top",toast:!0});return}const s=this.languages.map(l=>`
|
|
257
|
+
`).join("<br />")),Uo(t)}let W;var ze=new WeakMap;class N{constructor(...e){if(yo(this,ze,Promise.resolve({isConfirmed:!1,isDenied:!1,isDismissed:!0})),typeof window>"u")return;W=this;const n=Object.freeze(this.constructor.argsToParams(e));this.params=n,this.isAwaitingPromise=!1,vo(ze,this,this._main(W.params))}_main(e,n={}){if(Ln(Object.assign({},n,e)),p.currentInstance){const i=ue.swalPromiseResolve.get(p.currentInstance),{isAwaitingPromise:r}=p.currentInstance;p.currentInstance._destroy(),r||i({isDismissed:!0}),tt()&&ln()}p.currentInstance=W;const o=Yi(e,n);Gi(o),Object.freeze(o),p.timeout&&(p.timeout.stop(),delete p.timeout),clearTimeout(p.restoreFocusTimeout);const s=Zi(W);return on(W,o),$.innerParams.set(W,o),Wi(W,s,o)}then(e){return Mt(ze,this).then(e)}finally(e){return Mt(ze,this).finally(e)}}const Wi=(t,e,n)=>new Promise((o,s)=>{const i=r=>{t.close({isDismissed:!0,dismiss:r,isConfirmed:!1,isDenied:!1})};ue.swalPromiseResolve.set(t,o),ue.swalPromiseReject.set(t,s),e.confirmButton.onclick=()=>{Qs(t)},e.denyButton.onclick=()=>{ei(t)},e.cancelButton.onclick=()=>{ti(t,i)},e.closeButton.onclick=()=>{i(de.close)},fi(n,e,i),Cs(p,n,i),Hs(t,n),zi(n),Xi(p,n,i),Ji(e,n),setTimeout(()=>{e.container.scrollTop=0})}),Yi=(t,e)=>{const n=Pi(t),o=Object.assign({},Q,e,n,t);return o.showClass=Object.assign({},Q.showClass,o.showClass),o.hideClass=Object.assign({},Q.hideClass,o.hideClass),o.animation===!1&&(o.showClass={backdrop:"swal2-noanimation"},o.hideClass={}),o},Zi=t=>{const e={popup:T(),container:U(),actions:ye(),confirmButton:G(),denyButton:te(),cancelButton:le(),loader:ce(),closeButton:Qe(),validationMessage:Le(),progressSteps:Je()};return $.domCache.set(t,e),e},Xi=(t,e,n)=>{const o=$e();D(o),e.timer&&(t.timeout=new Ii(()=>{n("timer"),delete t.timeout},e.timer),e.timerProgressBar&&o&&(M(o),F(o,e,"timerProgressBar"),setTimeout(()=>{t.timeout&&t.timeout.running&&st(e.timer)})))},Ji=(t,e)=>{if(!e.toast){if(!Se(e.allowEnterKey)){qt("allowEnterKey"),tr();return}Qi(t)||er(t,e)||dt(-1,1)}},Qi=t=>{const e=Array.from(t.popup.querySelectorAll("[autofocus]"));for(const n of e)if(n instanceof HTMLElement&&z(n))return n.focus(),!0;return!1},er=(t,e)=>e.focusDeny&&z(t.denyButton)?(t.denyButton.focus(),!0):e.focusCancel&&z(t.cancelButton)?(t.cancelButton.focus(),!0):e.focusConfirm&&z(t.confirmButton)?(t.confirmButton.focus(),!0):!1,tr=()=>{document.activeElement instanceof HTMLElement&&typeof document.activeElement.blur=="function"&&document.activeElement.blur()};N.prototype.disableButtons=Cn,N.prototype.enableButtons=vn,N.prototype.getInput=mn,N.prototype.disableInput=_n,N.prototype.enableInput=kn,N.prototype.hideLoading=De,N.prototype.disableLoading=De,N.prototype.showValidationMessage=xn,N.prototype.resetValidationMessage=En,N.prototype.close=J,N.prototype.closePopup=J,N.prototype.closeModal=J,N.prototype.closeToast=J,N.prototype.rejectPromise=un,N.prototype.update=$n,N.prototype._destroy=In,Object.assign(N,$i),Object.keys(hi).forEach(t=>{N[t]=function(...e){if(W&&W[t])return W[t](...e)}}),N.DismissReason=de,N.version="11.26.18";const R=N;R.default=R,typeof document<"u"&&(function(t,e){var n=t.createElement("style");if(t.getElementsByTagName("head")[0].appendChild(n),n.styleSheet)n.styleSheet.disabled||(n.styleSheet.cssText=e);else try{n.innerHTML=e}catch{n.innerText=e}})(document,':root{--swal2-outline: 0 0 0 3px rgba(100, 150, 200, 0.5);--swal2-container-padding: 0.625em;--swal2-backdrop: rgba(0, 0, 0, 0.4);--swal2-backdrop-transition: background-color 0.15s;--swal2-width: 32em;--swal2-padding: 0 0 1.25em;--swal2-border: none;--swal2-border-radius: 0.3125rem;--swal2-background: white;--swal2-color: #545454;--swal2-show-animation: swal2-show 0.3s;--swal2-hide-animation: swal2-hide 0.15s forwards;--swal2-icon-zoom: 1;--swal2-icon-animations: true;--swal2-title-padding: 0.8em 1em 0;--swal2-html-container-padding: 1em 1.6em 0.3em;--swal2-input-border: 1px solid #d9d9d9;--swal2-input-border-radius: 0.1875em;--swal2-input-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent;--swal2-input-background: transparent;--swal2-input-transition: border-color 0.2s, box-shadow 0.2s;--swal2-input-hover-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px transparent;--swal2-input-focus-border: 1px solid #b4dbed;--swal2-input-focus-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.06), 0 0 0 3px rgba(100, 150, 200, 0.5);--swal2-progress-step-background: #add8e6;--swal2-validation-message-background: #f0f0f0;--swal2-validation-message-color: #666;--swal2-footer-border-color: #eee;--swal2-footer-background: transparent;--swal2-footer-color: inherit;--swal2-timer-progress-bar-background: rgba(0, 0, 0, 0.3);--swal2-close-button-position: initial;--swal2-close-button-inset: auto;--swal2-close-button-font-size: 2.5em;--swal2-close-button-color: #ccc;--swal2-close-button-transition: color 0.2s, box-shadow 0.2s;--swal2-close-button-outline: initial;--swal2-close-button-box-shadow: inset 0 0 0 3px transparent;--swal2-close-button-focus-box-shadow: inset var(--swal2-outline);--swal2-close-button-hover-transform: none;--swal2-actions-justify-content: center;--swal2-actions-width: auto;--swal2-actions-margin: 1.25em auto 0;--swal2-actions-padding: 0;--swal2-actions-border-radius: 0;--swal2-actions-background: transparent;--swal2-action-button-transition: background-color 0.2s, box-shadow 0.2s;--swal2-action-button-hover: black 10%;--swal2-action-button-active: black 10%;--swal2-confirm-button-box-shadow: none;--swal2-confirm-button-border-radius: 0.25em;--swal2-confirm-button-background-color: #7066e0;--swal2-confirm-button-color: #fff;--swal2-deny-button-box-shadow: none;--swal2-deny-button-border-radius: 0.25em;--swal2-deny-button-background-color: #dc3741;--swal2-deny-button-color: #fff;--swal2-cancel-button-box-shadow: none;--swal2-cancel-button-border-radius: 0.25em;--swal2-cancel-button-background-color: #6e7881;--swal2-cancel-button-color: #fff;--swal2-toast-show-animation: swal2-toast-show 0.5s;--swal2-toast-hide-animation: swal2-toast-hide 0.1s forwards;--swal2-toast-border: none;--swal2-toast-box-shadow: 0 0 1px hsl(0deg 0% 0% / 0.075), 0 1px 2px hsl(0deg 0% 0% / 0.075), 1px 2px 4px hsl(0deg 0% 0% / 0.075), 1px 3px 8px hsl(0deg 0% 0% / 0.075), 2px 4px 16px hsl(0deg 0% 0% / 0.075)}[data-swal2-theme=dark]{--swal2-dark-theme-black: #19191a;--swal2-dark-theme-white: #e1e1e1;--swal2-background: var(--swal2-dark-theme-black);--swal2-color: var(--swal2-dark-theme-white);--swal2-footer-border-color: #555;--swal2-input-background: color-mix(in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10%);--swal2-validation-message-background: color-mix( in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10% );--swal2-validation-message-color: var(--swal2-dark-theme-white);--swal2-timer-progress-bar-background: rgba(255, 255, 255, 0.7)}@media(prefers-color-scheme: dark){[data-swal2-theme=auto]{--swal2-dark-theme-black: #19191a;--swal2-dark-theme-white: #e1e1e1;--swal2-background: var(--swal2-dark-theme-black);--swal2-color: var(--swal2-dark-theme-white);--swal2-footer-border-color: #555;--swal2-input-background: color-mix(in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10%);--swal2-validation-message-background: color-mix( in srgb, var(--swal2-dark-theme-black), var(--swal2-dark-theme-white) 10% );--swal2-validation-message-color: var(--swal2-dark-theme-white);--swal2-timer-progress-bar-background: rgba(255, 255, 255, 0.7)}}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow:hidden}body.swal2-height-auto{height:auto !important}body.swal2-no-backdrop .swal2-container{background-color:rgba(0,0,0,0) !important;pointer-events:none}body.swal2-no-backdrop .swal2-container .swal2-popup{pointer-events:all}body.swal2-no-backdrop .swal2-container .swal2-modal{box-shadow:0 0 10px var(--swal2-backdrop)}body.swal2-toast-shown .swal2-container{box-sizing:border-box;width:360px;max-width:100%;background-color:rgba(0,0,0,0);pointer-events:none}body.swal2-toast-shown .swal2-container.swal2-top{inset:0 auto auto 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-top-end,body.swal2-toast-shown .swal2-container.swal2-top-right{inset:0 0 auto auto}body.swal2-toast-shown .swal2-container.swal2-top-start,body.swal2-toast-shown .swal2-container.swal2-top-left{inset:0 auto auto 0}body.swal2-toast-shown .swal2-container.swal2-center-start,body.swal2-toast-shown .swal2-container.swal2-center-left{inset:50% auto auto 0;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-center{inset:50% auto auto 50%;transform:translate(-50%, -50%)}body.swal2-toast-shown .swal2-container.swal2-center-end,body.swal2-toast-shown .swal2-container.swal2-center-right{inset:50% 0 auto auto;transform:translateY(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-start,body.swal2-toast-shown .swal2-container.swal2-bottom-left{inset:auto auto 0 0}body.swal2-toast-shown .swal2-container.swal2-bottom{inset:auto auto 0 50%;transform:translateX(-50%)}body.swal2-toast-shown .swal2-container.swal2-bottom-end,body.swal2-toast-shown .swal2-container.swal2-bottom-right{inset:auto 0 0 auto}@media print{body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown){overflow-y:scroll !important}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown)>[aria-hidden=true]{display:none}body.swal2-shown:not(.swal2-no-backdrop,.swal2-toast-shown) .swal2-container{position:static !important}}div:where(.swal2-container){display:grid;position:fixed;z-index:1060;inset:0;box-sizing:border-box;grid-template-areas:"top-start top top-end" "center-start center center-end" "bottom-start bottom-center bottom-end";grid-template-rows:minmax(min-content, auto) minmax(min-content, auto) minmax(min-content, auto);height:100%;padding:var(--swal2-container-padding);overflow-x:hidden;transition:var(--swal2-backdrop-transition);-webkit-overflow-scrolling:touch}div:where(.swal2-container).swal2-backdrop-show,div:where(.swal2-container).swal2-noanimation{background:var(--swal2-backdrop)}div:where(.swal2-container).swal2-backdrop-hide{background:rgba(0,0,0,0) !important}div:where(.swal2-container).swal2-top-start,div:where(.swal2-container).swal2-center-start,div:where(.swal2-container).swal2-bottom-start{grid-template-columns:minmax(0, 1fr) auto auto}div:where(.swal2-container).swal2-top,div:where(.swal2-container).swal2-center,div:where(.swal2-container).swal2-bottom{grid-template-columns:auto minmax(0, 1fr) auto}div:where(.swal2-container).swal2-top-end,div:where(.swal2-container).swal2-center-end,div:where(.swal2-container).swal2-bottom-end{grid-template-columns:auto auto minmax(0, 1fr)}div:where(.swal2-container).swal2-top-start>.swal2-popup{align-self:start}div:where(.swal2-container).swal2-top>.swal2-popup{grid-column:2;place-self:start center}div:where(.swal2-container).swal2-top-end>.swal2-popup,div:where(.swal2-container).swal2-top-right>.swal2-popup{grid-column:3;place-self:start end}div:where(.swal2-container).swal2-center-start>.swal2-popup,div:where(.swal2-container).swal2-center-left>.swal2-popup{grid-row:2;align-self:center}div:where(.swal2-container).swal2-center>.swal2-popup{grid-column:2;grid-row:2;place-self:center center}div:where(.swal2-container).swal2-center-end>.swal2-popup,div:where(.swal2-container).swal2-center-right>.swal2-popup{grid-column:3;grid-row:2;place-self:center end}div:where(.swal2-container).swal2-bottom-start>.swal2-popup,div:where(.swal2-container).swal2-bottom-left>.swal2-popup{grid-column:1;grid-row:3;align-self:end}div:where(.swal2-container).swal2-bottom>.swal2-popup{grid-column:2;grid-row:3;place-self:end center}div:where(.swal2-container).swal2-bottom-end>.swal2-popup,div:where(.swal2-container).swal2-bottom-right>.swal2-popup{grid-column:3;grid-row:3;place-self:end end}div:where(.swal2-container).swal2-grow-row>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-column:1/4;width:100%}div:where(.swal2-container).swal2-grow-column>.swal2-popup,div:where(.swal2-container).swal2-grow-fullscreen>.swal2-popup{grid-row:1/4;align-self:stretch}div:where(.swal2-container).swal2-no-transition{transition:none !important}div:where(.swal2-container)[popover]{width:auto;border:0}div:where(.swal2-container) div:where(.swal2-popup){display:none;position:relative;box-sizing:border-box;grid-template-columns:minmax(0, 100%);width:var(--swal2-width);max-width:100%;padding:var(--swal2-padding);border:var(--swal2-border);border-radius:var(--swal2-border-radius);background:var(--swal2-background);color:var(--swal2-color);font-family:inherit;font-size:1rem;container-name:swal2-popup}div:where(.swal2-container) div:where(.swal2-popup):focus{outline:none}div:where(.swal2-container) div:where(.swal2-popup).swal2-loading{overflow-y:hidden}div:where(.swal2-container) div:where(.swal2-popup).swal2-draggable{cursor:grab}div:where(.swal2-container) div:where(.swal2-popup).swal2-draggable div:where(.swal2-icon){cursor:grab}div:where(.swal2-container) div:where(.swal2-popup).swal2-dragging{cursor:grabbing}div:where(.swal2-container) div:where(.swal2-popup).swal2-dragging div:where(.swal2-icon){cursor:grabbing}div:where(.swal2-container) h2:where(.swal2-title){position:relative;max-width:100%;margin:0;padding:var(--swal2-title-padding);color:inherit;font-size:1.875em;font-weight:600;text-align:center;text-transform:none;overflow-wrap:break-word;cursor:initial}div:where(.swal2-container) div:where(.swal2-actions){display:flex;z-index:1;box-sizing:border-box;flex-wrap:wrap;align-items:center;justify-content:var(--swal2-actions-justify-content);width:var(--swal2-actions-width);margin:var(--swal2-actions-margin);padding:var(--swal2-actions-padding);border-radius:var(--swal2-actions-border-radius);background:var(--swal2-actions-background)}div:where(.swal2-container) div:where(.swal2-loader){display:none;align-items:center;justify-content:center;width:2.2em;height:2.2em;margin:0 1.875em;animation:swal2-rotate-loading 1.5s linear 0s infinite normal;border-width:.25em;border-style:solid;border-radius:100%;border-color:#2778c4 rgba(0,0,0,0) #2778c4 rgba(0,0,0,0)}div:where(.swal2-container) button:where(.swal2-styled){margin:.3125em;padding:.625em 1.1em;transition:var(--swal2-action-button-transition);border:none;box-shadow:0 0 0 3px rgba(0,0,0,0);font-weight:500}div:where(.swal2-container) button:where(.swal2-styled):not([disabled]){cursor:pointer}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm){border-radius:var(--swal2-confirm-button-border-radius);background:initial;background-color:var(--swal2-confirm-button-background-color);box-shadow:var(--swal2-confirm-button-box-shadow);color:var(--swal2-confirm-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):hover{background-color:color-mix(in srgb, var(--swal2-confirm-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm):active{background-color:color-mix(in srgb, var(--swal2-confirm-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny){border-radius:var(--swal2-deny-button-border-radius);background:initial;background-color:var(--swal2-deny-button-background-color);box-shadow:var(--swal2-deny-button-box-shadow);color:var(--swal2-deny-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):hover{background-color:color-mix(in srgb, var(--swal2-deny-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-deny):active{background-color:color-mix(in srgb, var(--swal2-deny-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel){border-radius:var(--swal2-cancel-button-border-radius);background:initial;background-color:var(--swal2-cancel-button-background-color);box-shadow:var(--swal2-cancel-button-box-shadow);color:var(--swal2-cancel-button-color);font-size:1em}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):hover{background-color:color-mix(in srgb, var(--swal2-cancel-button-background-color), var(--swal2-action-button-hover))}div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-cancel):active{background-color:color-mix(in srgb, var(--swal2-cancel-button-background-color), var(--swal2-action-button-active))}div:where(.swal2-container) button:where(.swal2-styled):focus-visible{outline:none;box-shadow:var(--swal2-action-button-focus-box-shadow)}div:where(.swal2-container) button:where(.swal2-styled)[disabled]:not(.swal2-loading){opacity:.4}div:where(.swal2-container) button:where(.swal2-styled)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-footer){margin:1em 0 0;padding:1em 1em 0;border-top:1px solid var(--swal2-footer-border-color);background:var(--swal2-footer-background);color:var(--swal2-footer-color);font-size:1em;text-align:center;cursor:initial}div:where(.swal2-container) .swal2-timer-progress-bar-container{position:absolute;right:0;bottom:0;left:0;grid-column:auto !important;overflow:hidden;border-bottom-right-radius:var(--swal2-border-radius);border-bottom-left-radius:var(--swal2-border-radius)}div:where(.swal2-container) div:where(.swal2-timer-progress-bar){width:100%;height:.25em;background:var(--swal2-timer-progress-bar-background)}div:where(.swal2-container) img:where(.swal2-image){max-width:100%;margin:2em auto 1em;cursor:initial}div:where(.swal2-container) button:where(.swal2-close){position:var(--swal2-close-button-position);inset:var(--swal2-close-button-inset);z-index:2;align-items:center;justify-content:center;width:1.2em;height:1.2em;margin-top:0;margin-right:0;margin-bottom:-1.2em;padding:0;overflow:hidden;transition:var(--swal2-close-button-transition);border:none;border-radius:var(--swal2-border-radius);outline:var(--swal2-close-button-outline);background:rgba(0,0,0,0);color:var(--swal2-close-button-color);font-family:monospace;font-size:var(--swal2-close-button-font-size);cursor:pointer;justify-self:end}div:where(.swal2-container) button:where(.swal2-close):hover{transform:var(--swal2-close-button-hover-transform);background:rgba(0,0,0,0);color:#f27474}div:where(.swal2-container) button:where(.swal2-close):focus-visible{outline:none;box-shadow:var(--swal2-close-button-focus-box-shadow)}div:where(.swal2-container) button:where(.swal2-close)::-moz-focus-inner{border:0}div:where(.swal2-container) div:where(.swal2-html-container){z-index:1;justify-content:center;margin:0;padding:var(--swal2-html-container-padding);overflow:auto;color:inherit;font-size:1.125em;font-weight:normal;line-height:normal;text-align:center;overflow-wrap:break-word;word-break:break-word;cursor:initial}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea),div:where(.swal2-container) select:where(.swal2-select),div:where(.swal2-container) div:where(.swal2-radio),div:where(.swal2-container) label:where(.swal2-checkbox){margin:1em 2em 3px}div:where(.swal2-container) input:where(.swal2-input),div:where(.swal2-container) input:where(.swal2-file),div:where(.swal2-container) textarea:where(.swal2-textarea){box-sizing:border-box;width:auto;transition:var(--swal2-input-transition);border:var(--swal2-input-border);border-radius:var(--swal2-input-border-radius);background:var(--swal2-input-background);box-shadow:var(--swal2-input-box-shadow);color:inherit;font-size:1.125em}div:where(.swal2-container) input:where(.swal2-input).swal2-inputerror,div:where(.swal2-container) input:where(.swal2-file).swal2-inputerror,div:where(.swal2-container) textarea:where(.swal2-textarea).swal2-inputerror{border-color:#f27474 !important;box-shadow:0 0 2px #f27474 !important}div:where(.swal2-container) input:where(.swal2-input):hover,div:where(.swal2-container) input:where(.swal2-file):hover,div:where(.swal2-container) textarea:where(.swal2-textarea):hover{box-shadow:var(--swal2-input-hover-box-shadow)}div:where(.swal2-container) input:where(.swal2-input):focus,div:where(.swal2-container) input:where(.swal2-file):focus,div:where(.swal2-container) textarea:where(.swal2-textarea):focus{border:var(--swal2-input-focus-border);outline:none;box-shadow:var(--swal2-input-focus-box-shadow)}div:where(.swal2-container) input:where(.swal2-input)::placeholder,div:where(.swal2-container) input:where(.swal2-file)::placeholder,div:where(.swal2-container) textarea:where(.swal2-textarea)::placeholder{color:#ccc}div:where(.swal2-container) .swal2-range{margin:1em 2em 3px;background:var(--swal2-background)}div:where(.swal2-container) .swal2-range input{width:80%}div:where(.swal2-container) .swal2-range output{width:20%;color:inherit;font-weight:600;text-align:center}div:where(.swal2-container) .swal2-range input,div:where(.swal2-container) .swal2-range output{height:2.625em;padding:0;font-size:1.125em;line-height:2.625em}div:where(.swal2-container) .swal2-input{height:2.625em;padding:0 .75em}div:where(.swal2-container) .swal2-file{width:75%;margin-right:auto;margin-left:auto;background:var(--swal2-input-background);font-size:1.125em}div:where(.swal2-container) .swal2-textarea{height:6.75em;padding:.75em}div:where(.swal2-container) .swal2-select{min-width:50%;max-width:100%;padding:.375em .625em;background:var(--swal2-input-background);color:inherit;font-size:1.125em}div:where(.swal2-container) .swal2-radio,div:where(.swal2-container) .swal2-checkbox{align-items:center;justify-content:center;background:var(--swal2-background);color:inherit}div:where(.swal2-container) .swal2-radio label,div:where(.swal2-container) .swal2-checkbox label{margin:0 .6em;font-size:1.125em}div:where(.swal2-container) .swal2-radio input,div:where(.swal2-container) .swal2-checkbox input{flex-shrink:0;margin:0 .4em}div:where(.swal2-container) label:where(.swal2-input-label){display:flex;justify-content:center;margin:1em auto 0}div:where(.swal2-container) div:where(.swal2-validation-message){align-items:center;justify-content:center;margin:1em 0 0;padding:.625em;overflow:hidden;background:var(--swal2-validation-message-background);color:var(--swal2-validation-message-color);font-size:1em;font-weight:300}div:where(.swal2-container) div:where(.swal2-validation-message)::before{content:"!";display:inline-block;width:1.5em;min-width:1.5em;height:1.5em;margin:0 .625em;border-radius:50%;background-color:#f27474;color:#fff;font-weight:600;line-height:1.5em;text-align:center}div:where(.swal2-container) .swal2-progress-steps{flex-wrap:wrap;align-items:center;max-width:100%;margin:1.25em auto;padding:0;background:rgba(0,0,0,0);font-weight:600}div:where(.swal2-container) .swal2-progress-steps li{display:inline-block;position:relative}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step{z-index:20;flex-shrink:0;width:2em;height:2em;border-radius:2em;background:#2778c4;color:#fff;line-height:2em;text-align:center}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step{background:#2778c4}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step{background:var(--swal2-progress-step-background);color:#fff}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step.swal2-active-progress-step~.swal2-progress-step-line{background:var(--swal2-progress-step-background)}div:where(.swal2-container) .swal2-progress-steps .swal2-progress-step-line{z-index:10;flex-shrink:0;width:2.5em;height:.4em;margin:0 -1px;background:#2778c4}div:where(.swal2-icon){position:relative;box-sizing:content-box;justify-content:center;width:5em;height:5em;margin:2.5em auto .6em;zoom:var(--swal2-icon-zoom);border:.25em solid rgba(0,0,0,0);border-radius:50%;border-color:#000;font-family:inherit;line-height:5em;cursor:default;user-select:none}div:where(.swal2-icon) .swal2-icon-content{display:flex;align-items:center;font-size:3.75em}div:where(.swal2-icon).swal2-error{border-color:#f27474;color:#f27474}div:where(.swal2-icon).swal2-error .swal2-x-mark{position:relative;flex-grow:1}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line]{display:block;position:absolute;top:2.3125em;width:2.9375em;height:.3125em;border-radius:.125em;background-color:#f27474}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=left]{left:1.0625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-error [class^=swal2-x-mark-line][class$=right]{right:1em;transform:rotate(-45deg)}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-error.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-error.swal2-icon-show .swal2-x-mark{animation:swal2-animate-error-x-mark .5s}}div:where(.swal2-icon).swal2-warning{border-color:#f8bb86;color:#f8bb86}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-warning.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-warning.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .5s}}div:where(.swal2-icon).swal2-info{border-color:#3fc3ee;color:#3fc3ee}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-info.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-info.swal2-icon-show .swal2-icon-content{animation:swal2-animate-i-mark .8s}}div:where(.swal2-icon).swal2-question{border-color:#87adbd;color:#87adbd}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-question.swal2-icon-show{animation:swal2-animate-error-icon .5s}div:where(.swal2-icon).swal2-question.swal2-icon-show .swal2-icon-content{animation:swal2-animate-question-mark .8s}}div:where(.swal2-icon).swal2-success{border-color:#a5dc86;color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line]{position:absolute;width:3.75em;height:7.5em;border-radius:50%}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.4375em;left:-2.0635em;transform:rotate(-45deg);transform-origin:3.75em 3.75em;border-radius:7.5em 0 0 7.5em}div:where(.swal2-icon).swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.6875em;left:1.875em;transform:rotate(-45deg);transform-origin:0 3.75em;border-radius:0 7.5em 7.5em 0}div:where(.swal2-icon).swal2-success .swal2-success-ring{position:absolute;z-index:2;top:-0.25em;left:-0.25em;box-sizing:content-box;width:100%;height:100%;border:.25em solid rgba(165,220,134,.3);border-radius:50%}div:where(.swal2-icon).swal2-success .swal2-success-fix{position:absolute;z-index:1;top:.5em;left:1.625em;width:.4375em;height:5.625em;transform:rotate(-45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line]{display:block;position:absolute;z-index:2;height:.3125em;border-radius:.125em;background-color:#a5dc86}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=tip]{top:2.875em;left:.8125em;width:1.5625em;transform:rotate(45deg)}div:where(.swal2-icon).swal2-success [class^=swal2-success-line][class$=long]{top:2.375em;right:.5em;width:2.9375em;transform:rotate(-45deg)}@container swal2-popup style(--swal2-icon-animations:true){div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-animate-success-line-tip .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-animate-success-line-long .75s}div:where(.swal2-icon).swal2-success.swal2-icon-show .swal2-success-circular-line-right{animation:swal2-rotate-success-circular-line 4.25s ease-in}}[class^=swal2]{-webkit-tap-highlight-color:rgba(0,0,0,0)}.swal2-show{animation:var(--swal2-show-animation)}.swal2-hide{animation:var(--swal2-hide-animation)}.swal2-noanimation{transition:none}.swal2-scrollbar-measure{position:absolute;top:-9999px;width:50px;height:50px;overflow:scroll}.swal2-rtl .swal2-close{margin-right:initial;margin-left:0}.swal2-rtl .swal2-timer-progress-bar{right:0;left:auto}.swal2-toast{box-sizing:border-box;grid-column:1/4 !important;grid-row:1/4 !important;grid-template-columns:min-content auto min-content;padding:1em;overflow-y:hidden;border:var(--swal2-toast-border);background:var(--swal2-background);box-shadow:var(--swal2-toast-box-shadow);pointer-events:all}.swal2-toast>*{grid-column:2}.swal2-toast h2:where(.swal2-title){margin:.5em 1em;padding:0;font-size:1em;text-align:initial}.swal2-toast .swal2-loading{justify-content:center}.swal2-toast input:where(.swal2-input){height:2em;margin:.5em;font-size:1em}.swal2-toast .swal2-validation-message{font-size:1em}.swal2-toast div:where(.swal2-footer){margin:.5em 0 0;padding:.5em 0 0;font-size:.8em}.swal2-toast button:where(.swal2-close){grid-column:3/3;grid-row:1/99;align-self:center;width:.8em;height:.8em;margin:0;font-size:2em}.swal2-toast div:where(.swal2-html-container){margin:.5em 1em;padding:0;overflow:initial;font-size:1em;text-align:initial}.swal2-toast div:where(.swal2-html-container):empty{padding:0}.swal2-toast .swal2-loader{grid-column:1;grid-row:1/99;align-self:center;width:2em;height:2em;margin:.25em}.swal2-toast .swal2-icon{grid-column:1;grid-row:1/99;align-self:center;width:2em;min-width:2em;height:2em;margin:0 .5em 0 0}.swal2-toast .swal2-icon .swal2-icon-content{display:flex;align-items:center;font-size:1.8em;font-weight:bold}.swal2-toast .swal2-icon.swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line]{top:.875em;width:1.375em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=left]{left:.3125em}.swal2-toast .swal2-icon.swal2-error [class^=swal2-x-mark-line][class$=right]{right:.3125em}.swal2-toast div:where(.swal2-actions){justify-content:flex-start;height:auto;margin:0;margin-top:.5em;padding:0 .5em}.swal2-toast button:where(.swal2-styled){margin:.25em .5em;padding:.4em .6em;font-size:1em}.swal2-toast .swal2-success{border-color:#a5dc86}.swal2-toast .swal2-success [class^=swal2-success-circular-line]{position:absolute;width:1.6em;height:3em;border-radius:50%}.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=left]{top:-0.8em;left:-0.5em;transform:rotate(-45deg);transform-origin:2em 2em;border-radius:4em 0 0 4em}.swal2-toast .swal2-success [class^=swal2-success-circular-line][class$=right]{top:-0.25em;left:.9375em;transform-origin:0 1.5em;border-radius:0 4em 4em 0}.swal2-toast .swal2-success .swal2-success-ring{width:2em;height:2em}.swal2-toast .swal2-success .swal2-success-fix{top:0;left:.4375em;width:.4375em;height:2.6875em}.swal2-toast .swal2-success [class^=swal2-success-line]{height:.3125em}.swal2-toast .swal2-success [class^=swal2-success-line][class$=tip]{top:1.125em;left:.1875em;width:.75em}.swal2-toast .swal2-success [class^=swal2-success-line][class$=long]{top:.9375em;right:.1875em;width:1.375em}@container swal2-popup style(--swal2-icon-animations:true){.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-tip{animation:swal2-toast-animate-success-line-tip .75s}.swal2-toast .swal2-success.swal2-icon-show .swal2-success-line-long{animation:swal2-toast-animate-success-line-long .75s}}.swal2-toast.swal2-show{animation:var(--swal2-toast-show-animation)}.swal2-toast.swal2-hide{animation:var(--swal2-toast-hide-animation)}@keyframes swal2-show{0%{transform:translate3d(0, -50px, 0) scale(0.9);opacity:0}100%{transform:translate3d(0, 0, 0) scale(1);opacity:1}}@keyframes swal2-hide{0%{transform:translate3d(0, 0, 0) scale(1);opacity:1}100%{transform:translate3d(0, -50px, 0) scale(0.9);opacity:0}}@keyframes swal2-animate-success-line-tip{0%{top:1.1875em;left:.0625em;width:0}54%{top:1.0625em;left:.125em;width:0}70%{top:2.1875em;left:-0.375em;width:3.125em}84%{top:3em;left:1.3125em;width:1.0625em}100%{top:2.8125em;left:.8125em;width:1.5625em}}@keyframes swal2-animate-success-line-long{0%{top:3.375em;right:2.875em;width:0}65%{top:3.375em;right:2.875em;width:0}84%{top:2.1875em;right:0;width:3.4375em}100%{top:2.375em;right:.5em;width:2.9375em}}@keyframes swal2-rotate-success-circular-line{0%{transform:rotate(-45deg)}5%{transform:rotate(-45deg)}12%{transform:rotate(-405deg)}100%{transform:rotate(-405deg)}}@keyframes swal2-animate-error-x-mark{0%{margin-top:1.625em;transform:scale(0.4);opacity:0}50%{margin-top:1.625em;transform:scale(0.4);opacity:0}80%{margin-top:-0.375em;transform:scale(1.15)}100%{margin-top:0;transform:scale(1);opacity:1}}@keyframes swal2-animate-error-icon{0%{transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);opacity:1}}@keyframes swal2-rotate-loading{0%{transform:rotate(0deg)}100%{transform:rotate(360deg)}}@keyframes swal2-animate-question-mark{0%{transform:rotateY(-360deg)}100%{transform:rotateY(0)}}@keyframes swal2-animate-i-mark{0%{transform:rotateZ(45deg);opacity:0}25%{transform:rotateZ(-25deg);opacity:.4}50%{transform:rotateZ(15deg);opacity:.8}75%{transform:rotateZ(-5deg);opacity:1}100%{transform:rotateX(0);opacity:1}}@keyframes swal2-toast-show{0%{transform:translateY(-0.625em) rotateZ(2deg)}33%{transform:translateY(0) rotateZ(-2deg)}66%{transform:translateY(0.3125em) rotateZ(2deg)}100%{transform:translateY(0) rotateZ(0deg)}}@keyframes swal2-toast-hide{100%{transform:rotateZ(1deg);opacity:0}}@keyframes swal2-toast-animate-success-line-tip{0%{top:.5625em;left:.0625em;width:0}54%{top:.125em;left:.125em;width:0}70%{top:.625em;left:-0.25em;width:1.625em}84%{top:1.0625em;left:.75em;width:.5em}100%{top:1.125em;left:.1875em;width:.75em}}@keyframes swal2-toast-animate-success-line-long{0%{top:1.625em;right:1.375em;width:0}65%{top:1.25em;right:.9375em;width:0}84%{top:.9375em;right:0;width:1.125em}100%{top:.9375em;right:.1875em;width:1.375em}}'),He.create();class nr{constructor(){this.isActive=!1,this.baseUrl="",this.appCode="",this.token="",this.getRequestToken=null,this.currentLocale="zh-CN",this.languages=[],this.wrappedElements=new Set,this.clickHandler=this.handleElementClick.bind(this)}async initConfig(){const e=x.get("I18N_CONFIG")||{},n=e.env||"local";this.baseUrl=kt({env:n}),console.log("baseUrl:",this.baseUrl),this.appCode=e.appCode||"",this.unitCode=e.unitCode||"GREENCLOUD",this.token=e.token||(x.get("I18N_CONFIG")||{}).token||"",this.getRequestToken=globalThis.__GC_I18N_GET_REQUEST_TOKEN__||null,this.currentLocale=e.locale||x.get("I18N_LANGUAGE")||"zh-CN",await this.loadLanguages()}async loadLanguages(){const e=x.get("I18N_LANGUAGES");if(e&&Array.isArray(e)&&e.length>0){this.languages=e;return}if(!this.appCode){this.languages=[];return}try{const n=await xt({baseUrl:this.baseUrl,appCode:this.appCode,token:this.token,getRequestToken:this.getRequestToken});if(n.data&&n.data.result===0){const o=w.get(n.data,"retVal",[]);this.languages=o.map(s=>({langCode:s.language||s.langCode||s,langName:s.langName||s.language||s})),x.set("I18N_LANGUAGES",this.languages)}}catch(n){console.error("获取语言列表失败:",n),this.languages=[]}}async toggle(){await this.initConfig(),this.isActive=!this.isActive,this.isActive?this.enableEditMode():this.disableEditMode()}enableEditMode(){document.body.classList.add("i18n-edit-mode-active"),this.scanAndWrapTextElements(),document.addEventListener("click",this.clickHandler,!0),R.fire({title:"文本编辑模式已开启",text:"点击带外框的文本即可编辑翻译内容,按 Ctrl+Shift+E 退出",icon:"info",timer:2e3,showConfirmButton:!1,position:"top-end",toast:!0})}disableEditMode(){document.body.classList.remove("i18n-edit-mode-active"),this.unwrapTextElements(),document.removeEventListener("click",this.clickHandler,!0)}scanAndWrapTextElements(){this.scanTextNodes(document.body)}scanTextNodes(e){const n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),o=[];let s;for(;s=n.nextNode();)o.push(s);o.forEach(i=>{const r=i.textContent;if(!r||!r.trim())return;const l=this.findKeyByValue(r.trim());l?this.wrapTextNode(i,l):this.wrapPartialTextNode(i)})}wrapPartialTextNode(e){const n=e.textContent;if(!n)return;const o=[];if(globalThis.__I18N_KEY_VALUE_MAP__)for(const[s,i]of Object.entries(globalThis.__I18N_KEY_VALUE_MAP__))n.includes(s)&&o.push({translatedValue:s,key:i,index:n.indexOf(s)});o.sort((s,i)=>s.index-i.index),o.length>0&&this.wrapMultipleTextParts(e,o)}wrapMultipleTextParts(e,n){const o=e.parentElement;if(!o||o.tagName==="SCRIPT"||o.tagName==="STYLE"||o.tagName==="IFRAME"||o.classList.contains("i18n-editable-text")||o.classList.contains("i18n-text-overlay")||o.closest(".swal2-container"))return;const s=e.textContent,i=document.createDocumentFragment();let r=0;if(n.forEach(l=>{const{translatedValue:a,key:d,index:g}=l;if(g>r){const h=s.substring(r,g);i.appendChild(document.createTextNode(h))}const u=document.createElement("span");u.className="i18n-editable-text i18n-text-overlay",u.setAttribute("data-i18n-key",d),u.textContent=a,i.appendChild(u),this.wrappedElements.add(u),r=g+a.length}),r<s.length){const l=s.substring(r);i.appendChild(document.createTextNode(l))}o.replaceChild(i,e)}findKeyByValue(e){if(!e)return null;if(globalThis.__I18N_KEY_VALUE_MAP__&&globalThis.__I18N_KEY_VALUE_MAP__[e])return globalThis.__I18N_KEY_VALUE_MAP__[e];const s=`I18N_MESSAGES_COMMON_${(x.get("I18N_CONFIG")||{}).locale||"zh-CN"}`,i=x.get(s)||{};for(const[a,d]of Object.entries(i))if(d===e)return a;const r=`I18N_MESSAGES_${this.currentLocale}`,l=x.get(r)||{};for(const[a,d]of Object.entries(l))if(d===e)return a;return null}wrapTextNode(e,n){const o=e.parentElement;if(!o||o.tagName==="SCRIPT"||o.tagName==="STYLE"||o.tagName==="IFRAME"||o.classList.contains("i18n-editable-text")||o.classList.contains("i18n-text-overlay")||o.closest(".swal2-container"))return;const s=document.createElement("span");s.className="i18n-editable-text i18n-text-overlay",s.setAttribute("data-i18n-key",n),s.textContent=e.textContent,o.replaceChild(s,e),this.wrappedElements.add(s)}unwrapTextElements(){this.wrappedElements.forEach(e=>{if(e.classList.remove("i18n-editable-text"),e.classList.contains("i18n-text-overlay")){const n=e.parentNode;if(n){const o=document.createTextNode(e.textContent);n.replaceChild(o,e)}}}),this.wrappedElements.clear()}handleElementClick(e){const n=e.target.closest("[data-i18n-key]");if(n&&this.isActive){e.preventDefault(),e.stopPropagation();const o=n.getAttribute("data-i18n-key");o&&this.openEditModal(o)}}async openEditModal(e){try{if(e.startsWith("i.")||e.startsWith("pro.")){R.fire({text:"系统字段不支持修改",icon:"info",timer:2e3,showConfirmButton:!1,position:"top",toast:!0});return}const n=await this.fetchTranslations(e);console.log("translations",n);const o=n[0]||"";if(!o){R.fire({text:"暂无翻译数据",icon:"info",timer:2e3,showConfirmButton:!1,position:"top",toast:!0});return}const s=this.languages.map(l=>`
|
|
258
258
|
<div class="i18n-edit-field">
|
|
259
259
|
<label class="i18n-edit-label">${l.langName}:</label>
|
|
260
260
|
<input
|
|
261
261
|
type="text"
|
|
262
262
|
class="i18n-edit-input"
|
|
263
263
|
data-lang="${l.langCode}"
|
|
264
|
-
value="${this.escapeHtml(
|
|
264
|
+
value="${this.escapeHtml(w.get(o,l.langCode)||"")}"
|
|
265
265
|
placeholder="请输入${l.langName}翻译"
|
|
266
266
|
/>
|
|
267
267
|
</div>
|
|
268
|
-
`).join(""),{value:i,isConfirmed:r}=await
|
|
268
|
+
`).join(""),{value:i,isConfirmed:r}=await R.fire({title:`原值参考:${o["zh-CN_raw"]}`,html:`
|
|
269
269
|
<div class="i18n-edit-form">
|
|
270
270
|
<div id="i18n-save-error" style="display: none; margin-bottom: 15px; padding: 10px 15px; background: #fff1f0; border: 1px solid #ffa39e; border-radius: 4px; color: #cf1322; font-size: 13px;"></div>
|
|
271
271
|
${s}
|
|
272
272
|
</div>
|
|
273
|
-
`,showCancelButton:!0,confirmButtonText:"保存",cancelButtonText:"取消",width:"600px",customClass:{container:"i18n-edit-modal-container",popup:"i18n-edit-modal-popup",title:"i18n-edit-modal-title",htmlContainer:"i18n-edit-modal-content"},preConfirm:async()=>{const l=document.querySelectorAll(".i18n-edit-input"),a={};l.forEach(g=>{a[g.getAttribute("data-lang")]=g.value});const d=document.getElementById("i18n-save-error");d&&(d.style.display="none",d.textContent="");try{return await this.saveTranslations(e,a,n),a}catch(g){return d&&(d.textContent=g.message||"保存失败,请检查网络连接或权限",d.style.display="block"),!1}}});r&&i&&(this.notifyLanguageUpdate(),O.fire({text:"保存成功",icon:"success",timer:1500,showConfirmButton:!1,position:"top",toast:!0}))}catch(n){console.error("打开编辑弹窗失败:",n),O.fire({title:"错误",text:"获取翻译数据失败",icon:"error"})}}async fetchTranslations(e){if(!this.appCode)return[];try{const o=(E.get("I18N_CONFIG")||{}).routerName||"",s=await Tt({baseUrl:this.baseUrl,data:{appCode:this.appCode,commaSeparatedKeys:e,commaSeparatedLangs:m.map(this.languages,"langCode").toString(),searchBlur:"",page:o,pageSize:10},token:this.token,getRequestToken:this.getRequestToken});if(s.data&&s.data.result===0)return m.get(s.data,"retVal.datas",[])}catch(n){console.error("获取翻译数据失败:",n)}return[]}getChangedTranslationData(e,n,o){const s=o[0],i=(s==null?void 0:s.page)||"",r=[];return m.map(n,(l,a)=>{l!==m.get(s,a)&&r.push({appCode:this.appCode,page:i,key:e,unitCode:this.unitCode,lang:a,value:l,fromAi:"F"})}),r}async saveTranslations(e,n,o){var r;const s=this.getChangedTranslationData(e,n,o);if(m.isEmpty(s))return!0;const i=await At({data:{data:s,isLocal:"F"},token:this.token,getRequestToken:this.getRequestToken,baseUrl:this.baseUrl});if(i.data&&i.data.result===0)return!0;throw new Error(((r=i.data)==null?void 0:r.message)||"保存失败")}escapeHtml(e){if(!e)return"";const n=document.createElement("div");return n.textContent=e,n.innerHTML}notifyLanguageUpdate(){if(typeof window>"u")return;const e={type:"updateLanguage"},n=window.location.origin,o=[window];try{window.parent&&window.parent!==window&&o.push(window.parent)}catch{}try{window.top&&window.top!==window&&window.top!==window.parent&&o.push(window.top)}catch{}Array.from(new Set(o)).forEach(s=>{s.postMessage(e,n)})}}const or=new nr;function sr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var pt={exports:{}},zn;function ir(){return zn||(zn=1,(function(t){var e=(function(){var n=String.fromCharCode,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",i={};function r(a,d){if(!i[a]){i[a]={};for(var g=0;g<a.length;g++)i[a][a.charAt(g)]=g}return i[a][d]}var l={compressToBase64:function(a){if(a==null)return"";var d=l._compress(a,6,function(g){return o.charAt(g)});switch(d.length%4){default:case 0:return d;case 1:return d+"===";case 2:return d+"==";case 3:return d+"="}},decompressFromBase64:function(a){return a==null?"":a==""?null:l._decompress(a.length,32,function(d){return r(o,a.charAt(d))})},compressToUTF16:function(a){return a==null?"":l._compress(a,15,function(d){return n(d+32)})+" "},decompressFromUTF16:function(a){return a==null?"":a==""?null:l._decompress(a.length,16384,function(d){return a.charCodeAt(d)-32})},compressToUint8Array:function(a){for(var d=l.compress(a),g=new Uint8Array(d.length*2),u=0,h=d.length;u<h;u++){var _=d.charCodeAt(u);g[u*2]=_>>>8,g[u*2+1]=_%256}return g},decompressFromUint8Array:function(a){if(a==null)return l.decompress(a);for(var d=new Array(a.length/2),g=0,u=d.length;g<u;g++)d[g]=a[g*2]*256+a[g*2+1];var h=[];return d.forEach(function(_){h.push(n(_))}),l.decompress(h.join(""))},compressToEncodedURIComponent:function(a){return a==null?"":l._compress(a,6,function(d){return s.charAt(d)})},decompressFromEncodedURIComponent:function(a){return a==null?"":a==""?null:(a=a.replace(/ /g,"+"),l._decompress(a.length,32,function(d){return r(s,a.charAt(d))}))},compress:function(a){return l._compress(a,16,function(d){return n(d)})},_compress:function(a,d,g){if(a==null)return"";var u,h,_={},L={},S="",M="",x="",w=2,C=3,v=2,k=[],f=0,b=0,y;for(y=0;y<a.length;y+=1)if(S=a.charAt(y),Object.prototype.hasOwnProperty.call(_,S)||(_[S]=C++,L[S]=!0),M=x+S,Object.prototype.hasOwnProperty.call(_,M))x=M;else{if(Object.prototype.hasOwnProperty.call(L,x)){if(x.charCodeAt(0)<256){for(u=0;u<v;u++)f=f<<1,b==d-1?(b=0,k.push(g(f)),f=0):b++;for(h=x.charCodeAt(0),u=0;u<8;u++)f=f<<1|h&1,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=h>>1}else{for(h=1,u=0;u<v;u++)f=f<<1|h,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=0;for(h=x.charCodeAt(0),u=0;u<16;u++)f=f<<1|h&1,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=h>>1}w--,w==0&&(w=Math.pow(2,v),v++),delete L[x]}else for(h=_[x],u=0;u<v;u++)f=f<<1|h&1,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=h>>1;w--,w==0&&(w=Math.pow(2,v),v++),_[M]=C++,x=String(S)}if(x!==""){if(Object.prototype.hasOwnProperty.call(L,x)){if(x.charCodeAt(0)<256){for(u=0;u<v;u++)f=f<<1,b==d-1?(b=0,k.push(g(f)),f=0):b++;for(h=x.charCodeAt(0),u=0;u<8;u++)f=f<<1|h&1,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=h>>1}else{for(h=1,u=0;u<v;u++)f=f<<1|h,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=0;for(h=x.charCodeAt(0),u=0;u<16;u++)f=f<<1|h&1,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=h>>1}w--,w==0&&(w=Math.pow(2,v),v++),delete L[x]}else for(h=_[x],u=0;u<v;u++)f=f<<1|h&1,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=h>>1;w--,w==0&&(w=Math.pow(2,v),v++)}for(h=2,u=0;u<v;u++)f=f<<1|h&1,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=h>>1;for(;;)if(f=f<<1,b==d-1){k.push(g(f));break}else b++;return k.join("")},decompress:function(a){return a==null?"":a==""?null:l._decompress(a.length,32768,function(d){return a.charCodeAt(d)})},_decompress:function(a,d,g){var u=[],h=4,_=4,L=3,S="",M=[],x,w,C,v,k,f,b,y={val:g(0),position:d,index:1};for(x=0;x<3;x+=1)u[x]=x;for(C=0,k=Math.pow(2,2),f=1;f!=k;)v=y.val&y.position,y.position>>=1,y.position==0&&(y.position=d,y.val=g(y.index++)),C|=(v>0?1:0)*f,f<<=1;switch(C){case 0:for(C=0,k=Math.pow(2,8),f=1;f!=k;)v=y.val&y.position,y.position>>=1,y.position==0&&(y.position=d,y.val=g(y.index++)),C|=(v>0?1:0)*f,f<<=1;b=n(C);break;case 1:for(C=0,k=Math.pow(2,16),f=1;f!=k;)v=y.val&y.position,y.position>>=1,y.position==0&&(y.position=d,y.val=g(y.index++)),C|=(v>0?1:0)*f,f<<=1;b=n(C);break;case 2:return""}for(u[3]=b,w=b,M.push(b);;){if(y.index>a)return"";for(C=0,k=Math.pow(2,L),f=1;f!=k;)v=y.val&y.position,y.position>>=1,y.position==0&&(y.position=d,y.val=g(y.index++)),C|=(v>0?1:0)*f,f<<=1;switch(b=C){case 0:for(C=0,k=Math.pow(2,8),f=1;f!=k;)v=y.val&y.position,y.position>>=1,y.position==0&&(y.position=d,y.val=g(y.index++)),C|=(v>0?1:0)*f,f<<=1;u[_++]=n(C),b=_-1,h--;break;case 1:for(C=0,k=Math.pow(2,16),f=1;f!=k;)v=y.val&y.position,y.position>>=1,y.position==0&&(y.position=d,y.val=g(y.index++)),C|=(v>0?1:0)*f,f<<=1;u[_++]=n(C),b=_-1,h--;break;case 2:return M.join("")}if(h==0&&(h=Math.pow(2,L),L++),u[b])S=u[b];else if(b===_)S=w+w.charAt(0);else return null;M.push(S),u[_++]=w+S.charAt(0),h--,w=S,h==0&&(h=Math.pow(2,L),L++)}}};return l})();t!=null?t.exports=e:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return e})})(pt)),pt.exports}var rr=ir();const je=sr(rr);function qn(t){const e=new Set,n=new WeakSet,o=r=>{ar(r).forEach(l=>e.add(l))},s=r=>{if(!(!r||typeof r!="object"))for(const l in r){const a=r[l];typeof a=="function"&&o(a.toString())}},i=r=>{if(!r||typeof r!="object"&&typeof r!="function"||n.has(r))return;n.add(r);const l=[r,r.options,r.__vccOpts].filter(Boolean);for(const a of l)if(!(!a||typeof a!="object")&&(a.template&&o(a.template),typeof a.render=="function"&&o(a.render.toString()),typeof a.setup=="function"&&o(a.setup.toString()),s(a.methods),a.components))for(const d in a.components)i(a.components[d])};return i(t),[...e]}function ar(t){const e=[],n=/(?:\$t|(?:this|_vm|_ctx|\$setup|ctx|globalThis)\.\$t)\s*\(/g;for(;n.exec(t)!==null;){const o=n.lastIndex-1,s=jn(t,o);if(s===-1)continue;const i=t.slice(o+1,s),r=lr(i);e.push(...wt(r)),n.lastIndex=s+1}return e}function wt(t){const e=ur(t.trim()),n=hr(e);if(n!==null)return[n];const o=cr(e);return o?[...wt(o.consequent),...wt(o.alternate)]:[]}function lr(t){const e=Vn(t,",");return e===-1?t:t.slice(0,e)}function cr(t){const e=Vn(t,"?");if(e===-1)return null;const n=dr(t,e+1);return n===-1?null:{consequent:t.slice(e+1,n),alternate:t.slice(n+1)}}function jn(t,e){let n=0;for(let o=e;o<t.length;o++){const s=t[o];if(Ve(s)){o=mt(t,o);continue}if(s==="("&&n++,s===")"&&(n--,n===0))return o}return-1}function Vn(t,e){let n=0,o=0,s=0;for(let i=0;i<t.length;i++){const r=t[i];if(Ve(r)){i=mt(t,i);continue}if(r==="(")n++;else if(r===")")n--;else if(r==="[")o++;else if(r==="]")o--;else if(r==="{")s++;else if(r==="}")s--;else if(r===e&&!Hn(t,i,e)&&n===0&&o===0&&s===0)return i}return-1}function dr(t,e){let n=0,o=0,s=0,i=0;for(let r=e;r<t.length;r++){const l=t[r];if(Ve(l)){r=mt(t,r);continue}if(l==="(")o++;else if(l===")")o--;else if(l==="[")s++;else if(l==="]")s--;else if(l==="{")i++;else if(l==="}")i--;else if(o===0&&s===0&&i===0&&(l==="?"&&!Hn(t,r,"?")&&n++,l===":")){if(n===0)return r;n--}}return-1}function ur(t){let e=t;for(;e.startsWith("(")&&jn(e,0)===e.length-1;)e=e.slice(1,-1).trim();return e}function hr(t){if(!t||!Ve(t[0]))return null;const e=t[0];let n="";for(let o=1;o<t.length;o++){const s=t[o];if(s==="\\"){n+=t[o+1]||"",o++;continue}if(s===e)return e==="`"&&n.includes("${")||t.slice(o+1).trim()?null:n;n+=s}return null}function mt(t,e){const n=t[e];for(let o=e+1;o<t.length;o++){if(t[o]==="\\"){o++;continue}if(t[o]===n)return o}return t.length-1}function Ve(t){return t==="'"||t==='"'||t==="`"}function Hn(t,e,n){return n==="?"&&(t[e+1]==="."||t[e+1]==="?")}const Fn={name:"Earth",props:{editable:{type:Boolean,default:!1},modelValue:{type:Array,default:()=>[]},request:{type:Function,default:null},languages:{type:Array,default:()=>[]},width:{type:Number,default:null},className:{type:String,default:""},baseUrl:{type:String,default:"https://extendapi.ihotel.cn"}},emits:["update:modelValue"],setup(t,{emit:e}){const n=B.ref("zh-CN"),o=B.ref(""),s=B.ref(""),i=B.ref([]),r=()=>{const w=E.get("I18N_CONFIG")||{};o.value=w.appCode||"",s.value=w.token||(E.get("I18N_CONFIG")||{}).token||"",n.value=E.get("I18N_LANGUAGE")||w.locale||"zh-CN"},l=async()=>{if(t.languages&&t.languages.length>0){i.value=t.languages;return}const w=await _t({baseUrl:t.baseUrl,token:s.value,appCode:o.value,getRequestToken:globalThis.__GC_I18N_GET_REQUEST_TOKEN__});i.value=w},a=B.computed(()=>{const w={};return!t.modelValue||!Array.isArray(t.modelValue)||t.modelValue.forEach(C=>{C&&typeof C=="object"&&Object.keys(C).forEach(v=>{w[v]=C[v]})}),w}),d=B.computed(()=>a.value[n.value]||""),g=B.computed(()=>Object.keys(a.value).filter(C=>C!==n.value).map(C=>({lang:C,value:a.value[C]}))),u=w=>{if(!w)return"";const C=document.createElement("div");return C.textContent=w,C.innerHTML},h=w=>{w.data&&w.data.type==="updateLanguage"&&(n.value=E.get("I18N_LANGUAGE")||"zh-CN")},_=()=>{if(typeof window>"u")return;const w={type:"updateLanguage"},C=window.location.origin,v=[window];try{window.parent&&window.parent!==window&&v.push(window.parent)}catch{}try{window.top&&window.top!==window&&window.top!==window.parent&&v.push(window.top)}catch{}Array.from(new Set(v)).forEach(k=>{k.postMessage(w,C)})},L=()=>{window.addEventListener("storage",w=>{w.key==="I18N_LANGUAGE"&&(n.value=w.newValue||"zh-CN")})},S=async()=>{i.value.length===0&&await l();const w=i.value.map(k=>`
|
|
273
|
+
`,showCancelButton:!0,confirmButtonText:"保存",cancelButtonText:"取消",width:"600px",customClass:{container:"i18n-edit-modal-container",popup:"i18n-edit-modal-popup",title:"i18n-edit-modal-title",htmlContainer:"i18n-edit-modal-content"},preConfirm:async()=>{const l=document.querySelectorAll(".i18n-edit-input"),a={};l.forEach(g=>{a[g.getAttribute("data-lang")]=g.value});const d=document.getElementById("i18n-save-error");d&&(d.style.display="none",d.textContent="");try{return await this.saveTranslations(e,a,n),a}catch(g){return d&&(d.textContent=g.message||"保存失败,请检查网络连接或权限",d.style.display="block"),!1}}});r&&i&&(this.notifyLanguageUpdate(),R.fire({text:"保存成功",icon:"success",timer:1500,showConfirmButton:!1,position:"top",toast:!0}))}catch(n){console.error("打开编辑弹窗失败:",n),R.fire({title:"错误",text:"获取翻译数据失败",icon:"error"})}}async fetchTranslations(e){if(!this.appCode)return[];try{const o=(x.get("I18N_CONFIG")||{}).routerName||"",s=await Tt({baseUrl:this.baseUrl,data:{appCode:this.appCode,commaSeparatedKeys:e,commaSeparatedLangs:w.map(this.languages,"langCode").toString(),searchBlur:"",page:o,pageSize:10},token:this.token,getRequestToken:this.getRequestToken});if(s.data&&s.data.result===0)return w.get(s.data,"retVal.datas",[])}catch(n){console.error("获取翻译数据失败:",n)}return[]}getChangedTranslationData(e,n,o){const s=o[0],i=(s==null?void 0:s.page)||"",r=[];return w.map(n,(l,a)=>{l!==w.get(s,a)&&r.push({appCode:this.appCode,page:i,key:e,unitCode:this.unitCode,lang:a,value:l,fromAi:"F"})}),r}async saveTranslations(e,n,o){var r;const s=this.getChangedTranslationData(e,n,o);if(w.isEmpty(s))return!0;const i=await At({data:{data:s,isLocal:"F"},token:this.token,getRequestToken:this.getRequestToken,baseUrl:this.baseUrl});if(i.data&&i.data.result===0)return!0;throw new Error(((r=i.data)==null?void 0:r.message)||"保存失败")}escapeHtml(e){if(!e)return"";const n=document.createElement("div");return n.textContent=e,n.innerHTML}notifyLanguageUpdate(){if(typeof window>"u")return;const e={type:"updateLanguage"},n=window.location.origin,o=[window];try{window.parent&&window.parent!==window&&o.push(window.parent)}catch{}try{window.top&&window.top!==window&&window.top!==window.parent&&o.push(window.top)}catch{}Array.from(new Set(o)).forEach(s=>{s.postMessage(e,n)})}}const or=new nr;function sr(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var pt={exports:{}},Un;function ir(){return Un||(Un=1,(function(t){var e=(function(){var n=String.fromCharCode,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",i={};function r(a,d){if(!i[a]){i[a]={};for(var g=0;g<a.length;g++)i[a][a.charAt(g)]=g}return i[a][d]}var l={compressToBase64:function(a){if(a==null)return"";var d=l._compress(a,6,function(g){return o.charAt(g)});switch(d.length%4){default:case 0:return d;case 1:return d+"===";case 2:return d+"==";case 3:return d+"="}},decompressFromBase64:function(a){return a==null?"":a==""?null:l._decompress(a.length,32,function(d){return r(o,a.charAt(d))})},compressToUTF16:function(a){return a==null?"":l._compress(a,15,function(d){return n(d+32)})+" "},decompressFromUTF16:function(a){return a==null?"":a==""?null:l._decompress(a.length,16384,function(d){return a.charCodeAt(d)-32})},compressToUint8Array:function(a){for(var d=l.compress(a),g=new Uint8Array(d.length*2),u=0,h=d.length;u<h;u++){var _=d.charCodeAt(u);g[u*2]=_>>>8,g[u*2+1]=_%256}return g},decompressFromUint8Array:function(a){if(a==null)return l.decompress(a);for(var d=new Array(a.length/2),g=0,u=d.length;g<u;g++)d[g]=a[g*2]*256+a[g*2+1];var h=[];return d.forEach(function(_){h.push(n(_))}),l.decompress(h.join(""))},compressToEncodedURIComponent:function(a){return a==null?"":l._compress(a,6,function(d){return s.charAt(d)})},decompressFromEncodedURIComponent:function(a){return a==null?"":a==""?null:(a=a.replace(/ /g,"+"),l._decompress(a.length,32,function(d){return r(s,a.charAt(d))}))},compress:function(a){return l._compress(a,16,function(d){return n(d)})},_compress:function(a,d,g){if(a==null)return"";var u,h,_={},L={},S="",O="",E="",m=2,C=3,v=2,k=[],f=0,b=0,y;for(y=0;y<a.length;y+=1)if(S=a.charAt(y),Object.prototype.hasOwnProperty.call(_,S)||(_[S]=C++,L[S]=!0),O=E+S,Object.prototype.hasOwnProperty.call(_,O))E=O;else{if(Object.prototype.hasOwnProperty.call(L,E)){if(E.charCodeAt(0)<256){for(u=0;u<v;u++)f=f<<1,b==d-1?(b=0,k.push(g(f)),f=0):b++;for(h=E.charCodeAt(0),u=0;u<8;u++)f=f<<1|h&1,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=h>>1}else{for(h=1,u=0;u<v;u++)f=f<<1|h,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=0;for(h=E.charCodeAt(0),u=0;u<16;u++)f=f<<1|h&1,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=h>>1}m--,m==0&&(m=Math.pow(2,v),v++),delete L[E]}else for(h=_[E],u=0;u<v;u++)f=f<<1|h&1,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=h>>1;m--,m==0&&(m=Math.pow(2,v),v++),_[O]=C++,E=String(S)}if(E!==""){if(Object.prototype.hasOwnProperty.call(L,E)){if(E.charCodeAt(0)<256){for(u=0;u<v;u++)f=f<<1,b==d-1?(b=0,k.push(g(f)),f=0):b++;for(h=E.charCodeAt(0),u=0;u<8;u++)f=f<<1|h&1,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=h>>1}else{for(h=1,u=0;u<v;u++)f=f<<1|h,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=0;for(h=E.charCodeAt(0),u=0;u<16;u++)f=f<<1|h&1,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=h>>1}m--,m==0&&(m=Math.pow(2,v),v++),delete L[E]}else for(h=_[E],u=0;u<v;u++)f=f<<1|h&1,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=h>>1;m--,m==0&&(m=Math.pow(2,v),v++)}for(h=2,u=0;u<v;u++)f=f<<1|h&1,b==d-1?(b=0,k.push(g(f)),f=0):b++,h=h>>1;for(;;)if(f=f<<1,b==d-1){k.push(g(f));break}else b++;return k.join("")},decompress:function(a){return a==null?"":a==""?null:l._decompress(a.length,32768,function(d){return a.charCodeAt(d)})},_decompress:function(a,d,g){var u=[],h=4,_=4,L=3,S="",O=[],E,m,C,v,k,f,b,y={val:g(0),position:d,index:1};for(E=0;E<3;E+=1)u[E]=E;for(C=0,k=Math.pow(2,2),f=1;f!=k;)v=y.val&y.position,y.position>>=1,y.position==0&&(y.position=d,y.val=g(y.index++)),C|=(v>0?1:0)*f,f<<=1;switch(C){case 0:for(C=0,k=Math.pow(2,8),f=1;f!=k;)v=y.val&y.position,y.position>>=1,y.position==0&&(y.position=d,y.val=g(y.index++)),C|=(v>0?1:0)*f,f<<=1;b=n(C);break;case 1:for(C=0,k=Math.pow(2,16),f=1;f!=k;)v=y.val&y.position,y.position>>=1,y.position==0&&(y.position=d,y.val=g(y.index++)),C|=(v>0?1:0)*f,f<<=1;b=n(C);break;case 2:return""}for(u[3]=b,m=b,O.push(b);;){if(y.index>a)return"";for(C=0,k=Math.pow(2,L),f=1;f!=k;)v=y.val&y.position,y.position>>=1,y.position==0&&(y.position=d,y.val=g(y.index++)),C|=(v>0?1:0)*f,f<<=1;switch(b=C){case 0:for(C=0,k=Math.pow(2,8),f=1;f!=k;)v=y.val&y.position,y.position>>=1,y.position==0&&(y.position=d,y.val=g(y.index++)),C|=(v>0?1:0)*f,f<<=1;u[_++]=n(C),b=_-1,h--;break;case 1:for(C=0,k=Math.pow(2,16),f=1;f!=k;)v=y.val&y.position,y.position>>=1,y.position==0&&(y.position=d,y.val=g(y.index++)),C|=(v>0?1:0)*f,f<<=1;u[_++]=n(C),b=_-1,h--;break;case 2:return O.join("")}if(h==0&&(h=Math.pow(2,L),L++),u[b])S=u[b];else if(b===_)S=m+m.charAt(0);else return null;O.push(S),u[_++]=m+S.charAt(0),h--,m=S,h==0&&(h=Math.pow(2,L),L++)}}};return l})();t!=null?t.exports=e:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return e})})(pt)),pt.exports}var rr=ir();const je=sr(rr);function zn(t){const e=new Set,n=new WeakSet,o=r=>{ar(r).forEach(l=>e.add(l))},s=r=>{if(!(!r||typeof r!="object"))for(const l in r){const a=r[l];typeof a=="function"&&o(a.toString())}},i=r=>{if(!r||typeof r!="object"&&typeof r!="function"||n.has(r))return;n.add(r);const l=[r,r.options,r.__vccOpts].filter(Boolean);for(const a of l)if(!(!a||typeof a!="object")&&(a.template&&o(a.template),typeof a.render=="function"&&o(a.render.toString()),typeof a.setup=="function"&&o(a.setup.toString()),s(a.methods),a.components))for(const d in a.components)i(a.components[d])};return i(t),[...e]}function ar(t){const e=[],n=/(?:\$t|(?:this|_vm|_ctx|\$setup|ctx|globalThis)\.\$t)\s*\(/g;for(;n.exec(t)!==null;){const o=n.lastIndex-1,s=jn(t,o);if(s===-1)continue;const i=t.slice(o+1,s),r=lr(i);e.push(...wt(r)),n.lastIndex=s+1}return e}function wt(t){const e=ur(t.trim()),n=hr(e);if(n!==null)return[n];const o=cr(e);return o?[...wt(o.consequent),...wt(o.alternate)]:[]}function lr(t){const e=Vn(t,",");return e===-1?t:t.slice(0,e)}function cr(t){const e=Vn(t,"?");if(e===-1)return null;const n=dr(t,e+1);return n===-1?null:{consequent:t.slice(e+1,n),alternate:t.slice(n+1)}}function jn(t,e){let n=0;for(let o=e;o<t.length;o++){const s=t[o];if(Ve(s)){o=mt(t,o);continue}if(s==="("&&n++,s===")"&&(n--,n===0))return o}return-1}function Vn(t,e){let n=0,o=0,s=0;for(let i=0;i<t.length;i++){const r=t[i];if(Ve(r)){i=mt(t,i);continue}if(r==="(")n++;else if(r===")")n--;else if(r==="[")o++;else if(r==="]")o--;else if(r==="{")s++;else if(r==="}")s--;else if(r===e&&!Hn(t,i,e)&&n===0&&o===0&&s===0)return i}return-1}function dr(t,e){let n=0,o=0,s=0,i=0;for(let r=e;r<t.length;r++){const l=t[r];if(Ve(l)){r=mt(t,r);continue}if(l==="(")o++;else if(l===")")o--;else if(l==="[")s++;else if(l==="]")s--;else if(l==="{")i++;else if(l==="}")i--;else if(o===0&&s===0&&i===0&&(l==="?"&&!Hn(t,r,"?")&&n++,l===":")){if(n===0)return r;n--}}return-1}function ur(t){let e=t;for(;e.startsWith("(")&&jn(e,0)===e.length-1;)e=e.slice(1,-1).trim();return e}function hr(t){if(!t||!Ve(t[0]))return null;const e=t[0];let n="";for(let o=1;o<t.length;o++){const s=t[o];if(s==="\\"){n+=t[o+1]||"",o++;continue}if(s===e)return e==="`"&&n.includes("${")||t.slice(o+1).trim()?null:n;n+=s}return null}function mt(t,e){const n=t[e];for(let o=e+1;o<t.length;o++){if(t[o]==="\\"){o++;continue}if(t[o]===n)return o}return t.length-1}function Ve(t){return t==="'"||t==='"'||t==="`"}function Hn(t,e,n){return n==="?"&&(t[e+1]==="."||t[e+1]==="?")}const Fn={name:"Earth",props:{editable:{type:Boolean,default:!1},modelValue:{type:Array,default:()=>[]},request:{type:Function,default:null},languages:{type:Array,default:()=>[]},width:{type:Number,default:null},className:{type:String,default:""},baseUrl:{type:String,default:"https://extendapi.ihotel.cn"}},emits:["update:modelValue"],setup(t,{emit:e}){const n=B.ref("zh-CN"),o=B.ref(""),s=B.ref(""),i=B.ref([]),r=()=>{const m=x.get("I18N_CONFIG")||{};o.value=m.appCode||"",s.value=m.token||(x.get("I18N_CONFIG")||{}).token||"",n.value=x.get("I18N_LANGUAGE")||m.locale||"zh-CN"},l=async()=>{if(t.languages&&t.languages.length>0){i.value=t.languages;return}const m=await _t({baseUrl:t.baseUrl,token:s.value,appCode:o.value,getRequestToken:globalThis.__GC_I18N_GET_REQUEST_TOKEN__});i.value=m},a=B.computed(()=>{const m={};return!t.modelValue||!Array.isArray(t.modelValue)||t.modelValue.forEach(C=>{C&&typeof C=="object"&&Object.keys(C).forEach(v=>{m[v]=C[v]})}),m}),d=B.computed(()=>a.value[n.value]||""),g=B.computed(()=>Object.keys(a.value).filter(C=>C!==n.value).map(C=>({lang:C,value:a.value[C]}))),u=m=>{if(!m)return"";const C=document.createElement("div");return C.textContent=m,C.innerHTML},h=m=>{m.data&&m.data.type==="updateLanguage"&&(n.value=x.get("I18N_LANGUAGE")||"zh-CN")},_=()=>{if(typeof window>"u")return;const m={type:"updateLanguage"},C=window.location.origin,v=[window];try{window.parent&&window.parent!==window&&v.push(window.parent)}catch{}try{window.top&&window.top!==window&&window.top!==window.parent&&v.push(window.top)}catch{}Array.from(new Set(v)).forEach(k=>{k.postMessage(m,C)})},L=()=>{window.addEventListener("storage",m=>{m.key==="I18N_LANGUAGE"&&(n.value=m.newValue||"zh-CN")})},S=async()=>{i.value.length===0&&await l();const m=i.value.map(k=>`
|
|
274
274
|
<div class="i18n-edit-field">
|
|
275
275
|
<label class="i18n-edit-label">${k.langName}:</label>
|
|
276
276
|
<input
|
|
@@ -281,17 +281,17 @@ https://sweetalert2.github.io/#ajax-request`),Ki(t),typeof t.title=="string"&&(t
|
|
|
281
281
|
placeholder="请输入${k.langName}"
|
|
282
282
|
/>
|
|
283
283
|
</div>
|
|
284
|
-
`).join(""),{value:C,isConfirmed:v}=await
|
|
284
|
+
`).join(""),{value:C,isConfirmed:v}=await R.fire({title:"编辑多语言",html:`
|
|
285
285
|
<div class="i18n-edit-form">
|
|
286
286
|
<div id="i18n-save-error" style="display: none; margin-bottom: 15px; padding: 10px 15px; background: #fff1f0; border: 1px solid #ffa39e; border-radius: 4px; color: #cf1322; font-size: 13px;"></div>
|
|
287
|
-
${
|
|
287
|
+
${m}
|
|
288
288
|
</div>
|
|
289
|
-
`,showCancelButton:!0,confirmButtonText:"保存",cancelButtonText:"取消",width:"600px",customClass:{container:"i18n-earth-modal-container",popup:"i18n-earth-modal-popup i18n-earth-edit-popup",title:"i18n-earth-modal-title",htmlContainer:"i18n-earth-modal-content"},preConfirm:async()=>{const k=document.querySelectorAll(".i18n-edit-input"),f={};k.forEach(y=>{f[y.getAttribute("data-lang")]=y.value});const b=document.getElementById("i18n-save-error");if(b&&(b.style.display="none",b.textContent=""),t.request&&typeof t.request=="function")try{return await t.request(f),f}catch(y){return b&&(b.textContent=y.message||"保存失败",b.style.display="block"),!1}return f}});if(v&&C){const k=Object.keys(C).map(f=>({[f]:C[f]}));e("update:modelValue",k),_(),
|
|
289
|
+
`,showCancelButton:!0,confirmButtonText:"保存",cancelButtonText:"取消",width:"600px",customClass:{container:"i18n-earth-modal-container",popup:"i18n-earth-modal-popup i18n-earth-edit-popup",title:"i18n-earth-modal-title",htmlContainer:"i18n-earth-modal-content"},preConfirm:async()=>{const k=document.querySelectorAll(".i18n-edit-input"),f={};k.forEach(y=>{f[y.getAttribute("data-lang")]=y.value});const b=document.getElementById("i18n-save-error");if(b&&(b.style.display="none",b.textContent=""),t.request&&typeof t.request=="function")try{return await t.request(f),f}catch(y){return b&&(b.textContent=y.message||"保存失败",b.style.display="block"),!1}return f}});if(v&&C){const k=Object.keys(C).map(f=>({[f]:C[f]}));e("update:modelValue",k),_(),R.fire({text:"保存成功",icon:"success",timer:1500,showConfirmButton:!1,position:"top",toast:!0})}},O=()=>{const m=g.value;if(m.length===0){R.fire({title:"多语言翻译",text:"暂无其他语言数据"});return}const C=m.map(v=>`
|
|
290
290
|
<div class="i18n-lang-item">
|
|
291
291
|
<span class="i18n-lang-code">${v.lang}:</span>
|
|
292
292
|
<span class="i18n-lang-value">${v.value||"-"}</span>
|
|
293
293
|
</div>
|
|
294
|
-
`).join("");
|
|
294
|
+
`).join("");R.fire({title:"多语言翻译",html:`
|
|
295
295
|
<div class="i18n-modal-content">
|
|
296
296
|
<div class="i18n-current-lang">
|
|
297
297
|
<strong>当前语言 (${n.value}):</strong>
|
|
@@ -302,4 +302,4 @@ https://sweetalert2.github.io/#ajax-request`),Ki(t),typeof t.title=="string"&&(t
|
|
|
302
302
|
${C}
|
|
303
303
|
</div>
|
|
304
304
|
</div>
|
|
305
|
-
`,showCloseButton:!0,showConfirmButton:!1,width:"500px",customClass:{container:"i18n-earth-modal-container",popup:"i18n-earth-modal-popup",title:"i18n-earth-modal-title",htmlContainer:"i18n-earth-modal-content"}})},x=()=>{t.request&&typeof t.request=="function"?S():M()};return B.onMounted(()=>{r(),l(),window.addEventListener("message",h),L()}),{currentValue:d,openModal:x}},render(){const{editable:t,width:e,className:n}=this,o=e!==null?{width:e+"px"}:{},s=n?`earth ${n}`:"earth";return B.h("div",{class:s},[B.h("input",{class:"input",type:"text",value:this.currentValue,readonly:!t,disabled:!t,placeholder:"",style:o}),B.h("svg",{class:"icon earth-icon",viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor",onClick:this.openModal},[B.h("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"})])])}};function _e(t){if(!t||typeof t!="string")return t;const e=t.toLowerCase();return{"zh-cn":"zh-CN","zh-tw":"zh-TW","zh-hk":"zh-HK","zh-mo":"zh-MO","en-us":"en-US"}[e]||t}function Kn(t={}){const e=Object.entries(t||{});return e.some(([,o])=>o&&typeof o=="object"&&!Array.isArray(o)&&Object.keys(o).some(s=>s.includes("-")))?e.reduce((o,[s,i])=>(!i||typeof i!="object"||Array.isArray(i)||Object.entries(i).forEach(([r,l])=>{const a=_e(r);o[a]=o[a]||{},o[a][s]=l}),o),{}):e.reduce((o,[s,i])=>(o[_e(s)]=i,o),{})}function Gn(t,e){return t[e]||t[_e(e)]||t[String(e||"").toLowerCase()]||{}}function xe(t,e){if(typeof t!="string"||!e||typeof e!="object"||Array.isArray(e))return t;const n=Object.entries(e);return t.replace(/\\?\$\{\s*([^}]+?)\s*\}/g,(o,s)=>{const i=String(s||"").trim(),r=n.find(([a])=>a===i||i==="this."+a||i==="_vm."+a||i==="_ctx."+a||i==="$setup."+a||a===i.replace(/^(?:this|_vm|_ctx|\$setup)\./,""));if(!r)return o;const l=r[1];return l!=null?String(l):o})}function Wn(t,e){return e===void 0&&t&&typeof t=="object"&&!Array.isArray(t)?{defaultValue:void 0,values:t}:{defaultValue:t,values:e}}function fr(t){const{locale:e="zh-CN",messages:n={}}=t,o=Kn(n),s=B.ref(e),i=B.ref(0),r=vt(),l=Xn()&&r&&typeof r.observable=="function"?r.observable({locale:e,messageVersion:0}):null,a=()=>l?l.locale:s.value,d=h=>{s.value=h,l&&(l.locale=h)},g=()=>{i.value+=1,l&&(l.messageVersion+=1)},u={locale:{get value(){return a()},set value(h){d(h)}},t(h,_,L){const S=Wn(_,L);_=S.defaultValue,L=S.values,i.value,l&&l.messageVersion;const M=a();if(M==="zh-CN"&&!h.startsWith("i.")&&!h.startsWith("pro."))return xe(_||h,L);const x=Gn(o,M);let w=x[h];return w===void 0&&h.includes(".")&&(w=h.split(".").reduce((v,k)=>v&&typeof v=="object"?v[k]:void 0,x)),w!=null&&w!==h?xe(w,L):xe(_||h,L)},setLocaleMessage(h,_){return o[_e(h)]={..._},g(),o[_e(h)]},getLocaleMessage(h){return Gn(o,h)}};return u.global=u,u}const Yn=He.create({timeout:8e3}),Zn="zh-CN",gr=/^(?:"([a-z]{2}-[A-Z]{2})"|([a-z]{2}-[A-Z]{2}))$/,pr=new Set(["zh-CN","zh-TW","zh-UG","en-US","tr-TR","es-ES","ja-JP","ru-RU","fr-FR","de-DE","pt-BR","pt-PT","ko-KR","vi-VN","sv-SE","id-ID","uk-UA","it-IT","th-TH","hi-IN","fa-IR","ro-RO","el-GR","nl-NL","cs-CZ","mn-MN","mn-TR","fi-FI","ar-SA","ar-EG","da-DK","pl-PL","nb-NO","si-LK"]);Yn.interceptors.request.use(t=>{const n=(E.get("I18N_CONFIG")||{}).token;return n&&(t.headers.Authorization=`Bearer ${n}`),t});function wr(t={}){const n=JSON.stringify({alg:"HS512"}),o=JSON.stringify(t);return Qn.jws.JWS.sign("HS512",n,o,"")}function mr(t){if(!t||typeof t!="string")return"";const e=t.replace(/-/g,"+").replace(/_/g,"/"),n=e.padEnd(e.length+(4-e.length%4)%4,"=");try{if(typeof atob=="function")return decodeURIComponent(Array.from(atob(n),o=>`%${o.charCodeAt(0).toString(16).padStart(2,"0")}`).join(""))}catch{}return""}function br(t){if(!t||typeof t!="string")return null;const e=t.split(".");if(e.length!==3)return null;try{return JSON.parse(mr(e[1]))}catch{return null}}function yr(t){const e=br(t);return!!(e&&(e.mainAppCode&&e.userCode&&e.deviceType||e.appCode&&e.orgCode&&e.userCode&&e.i18n_token))}function bt(t){if(!t)return"";const e=String(t);let n=0;for(let o=0;o<e.length;o++)n=(n<<5)-n+e.charCodeAt(o),n|=0;return`user_${Math.abs(n)}`}function yt({appCode:t,orgCode:e,userCode:n}={}){return!t||!e||!n?"":bt([t,e,n].join("|"))}function ge(t,...e){if(typeof t=="function")return t(...e)}function vt(t){return t&&(t.version||t.prototype||t.config)?t:(B.Vue&&B.Vue.version,B.Vue)}function Xn(t){if(t&&t.config&&t.config.globalProperties)return!1;const e=vt(t),n=e&&e.version;return typeof n=="string"?n.split(".")[0]==="2":!!(e&&e.prototype)}function vr(t){[t.$,t._].filter(Boolean).forEach(n=>{Array.isArray(n.renderCache)&&(n.renderCache.length=0)})}function Ct(t,e){if(!t||e.has(t))return;e.add(t),Array.isArray(t.renderCache)&&(t.renderCache.length=0);const n=t.proxy;n&&typeof n.$forceUpdate=="function"?n.$forceUpdate():typeof t.update=="function"&&t.update(),pe(t.subTree,e)}function pe(t,e){if(t){if(Array.isArray(t)){t.forEach(n=>pe(n,e));return}t.component&&Ct(t.component,e),Array.isArray(t.children)&&t.children.forEach(n=>pe(n,e)),Array.isArray(t.dynamicChildren)&&t.dynamicChildren.forEach(n=>pe(n,e)),t.ssContent&&pe(t.ssContent,e),t.ssFallback&&pe(t.ssFallback,e)}}function Jn(t,e=new Set){if(!t||e.has(t))return;e.add(t),vr(t),[t.$,t._].filter(Boolean).forEach(o=>{Ct(o,e)}),typeof t.$forceUpdate=="function"&&t.$forceUpdate(),(t.$children||[]).forEach(o=>Jn(o,e))}class Z{constructor(e={}){const{router:n,appCode:o,messages:s,token:i,orgCode:r,userCode:l,loginRouteName:a,login:d,keyboard:g,locale:u,env:h,dev:_,i18nTokenRequest:L,auth:S}=e;this.env=h||"local",this.baseUrl=kt({env:h,dev:_}),this.i18nTokenRequest=L||null,this.baseToken=i||(E.get("I18N_CONFIG")||{}).token||E.get("token"),this.token=this.baseToken,this.auth=S||null,this.authInfo={appCode:o,orgCode:r||"",userCode:l||""},this.getRequestToken=this.getRequestToken.bind(this),this.requestAuthIdentity=null,this.tokenResolveVersion=0,this.manualAuthScope=yt(this.authInfo)||(i?bt(i):""),this.authUnsubscribe=null,this.authVersion=0,this.languageVersion=0,this.activeCacheScope=this.manualAuthScope||"guest",this.loadI18n=!0,this.appCode=o,this.router=n,this.locale=this.resolveInitialLocale(u),this._isRTL=Ee(this.locale),this.persistI18nConfig(),this.name="",this.messages=Kn(s||{}),this.translationKeys=[],this.translationKeySet=new Set,this.loginRouteName=a||"login",this.login=d,this.loginTranslationKeys=[],this.keyboard=g||"ctrl+shift+l",this.vueInstances=new Set,this.vueApps=new Set,this.editKeyboard=e.editKeyboard||"ctrl+shift+e",this.applyAuthState(this.resolveAuthState(),{silent:!0}),this.initI18n(e),this.router&&this.initRouterGuards(),ie.bind(this.keyboard,M=>{if(M.preventDefault(),this.name===this.loginRouteName)return;const x=Array.from(this.translationKeySet);this.translationKeys=Array.from(new Set([...this.translationKeys||[],...x])),this.swalInstance=O.fire({titleText:"多语言管理",padding:"0px",backdrop:!1,allowOutsideClick:!1,heightAuto:!1,showCloseButton:!0,showConfirmButton:!1,width:"1000px",customClass:{container:"gc_i18n_container",title:"gc_i18n_title",closeButton:"gc_i18n_close_button",htmlContainer:"gc_i18n_html_container"},html:'<div id="gc_i18n_config_modal_root"></div>',didOpen:()=>{const w=document.getElementById("gc_i18n_config_modal_root");if(!w)return;const C=mo({name:this.name,token:this.token,appCode:this.appCode,baseUrl:this.baseUrl,getRequestToken:this.getRequestToken,translationKeys:this.translationKeys,loginRouteName:this.loginRouteName,loginTranslationKeys:this.loginTranslationKeys,login:this.login,onSaveSuccess:async({close:v,message:k}={})=>{await this.handleUpdateLanguageSuccess({close:v,message:k})},onError:({message:v}={})=>{this.showConfigToast({message:v,icon:"error"})},onClose:()=>{O.close()}});this.configInstance=C,C.mount(w)},willClose:()=>{this.configInstance&&(this.configInstance.destroy(),this.configInstance=null)}})}),ie.bind(this.editKeyboard,M=>{M.preventDefault(),or.toggle()}),this.setupLanguageChangeListener(),this.setupAuthListener(),this.setupMessageListener()}normalizeLocale(e){if(typeof e!="string")return Zn;const n=e.match(gr),o=n?n[1]||n[2]:"";return pr.has(o)?o:Zn}getUrlLanguage(){if(typeof window>"u"||!window.location)return"";try{return new URLSearchParams(window.location.search||"").get("language")||""}catch{return""}}resolveInitialLocale(e){const n=typeof navigator<"u"?navigator.language:"";return this.normalizeLocale(this.getUrlLanguage()||e||E.get("I18N_LANGUAGE")||n||"zh-CN")}setupLanguageChangeListener(){"onlanguagechange"in window&&window.addEventListener("languagechange",()=>{const e=this.normalizeLocale(navigator.language);e!==this.locale&&this.setLanguage(e)})}resolveAuthState(){var g,u,h;const e=this.auth||{},n=ge(e.getToken)??"",o=ge(e.getScope)??ge(e.getUserScope)??"",s=ge(e.getAppCode)??((g=this.authInfo)==null?void 0:g.appCode)??this.appCode,i=ge(e.getOrgCode)??((u=this.authInfo)==null?void 0:u.orgCode)??"",r=ge(e.getUserCode)??((h=this.authInfo)==null?void 0:h.userCode)??"",l=yt({appCode:s,orgCode:i,userCode:r}),a=typeof e.isAuthenticated=="function"?!!e.isAuthenticated():!!n||!!(this.i18nTokenRequest&&l),d=a?String(o||bt(n)||l||this.manualAuthScope||"user"):"guest";return{token:n,scope:d,appCode:s,orgCode:i,userCode:r,isAuthenticated:a}}normalizeAuthInfo(e={}){const n={appCode:e.appCode||this.appCode,orgCode:e.orgCode||"",userCode:e.userCode||""};return this.authInfo=n,n}updateRequestAuthIdentity(e={},{clear:n=!0}={}){const o=this.normalizeAuthInfo(e),s={appCode:o.appCode||this.appCode||"",orgCode:o.orgCode||"",userCode:o.userCode||""},i=this.requestAuthIdentity,r=!!i&&(i.appCode!==s.appCode||i.orgCode!==s.orgCode||i.userCode!==s.userCode);return this.requestAuthIdentity=s,r&&n&&this.clearLanguageCacheForAuthChange(i,s),r}clearLanguageCacheForAuthChange(e={},n={}){E.remove("I18N_LANGUAGES"),[e.appCode,n.appCode,this.appCode].filter(Boolean).forEach(o=>{Lt({appCode:o,cacheScope:this.activeCacheScope})})}persistI18nConfig(e={}){E.set("I18N_CONFIG",{...E.get("I18N_CONFIG")||{},baseUrl:this.baseUrl,appCode:this.appCode,token:this.token,locale:this.locale,env:this.env,cacheScope:this.activeCacheScope,...e})}async createRequestToken(e,n={}){if(!this.i18nTokenRequest)return e||"";if(e&&yr(e))return e;const o={appCode:n.appCode||this.appCode,orgCode:n.orgCode||"",userCode:n.userCode||""};if(!o.orgCode||!o.userCode)return console.warn("临时 token 模式需要提供 appCode、orgCode、userCode 三元身份"),"";try{const s=await ro({request:this.i18nTokenRequest,appCode:o.appCode||this.appCode,orgCode:o.orgCode,userCode:o.userCode,token:e});return s?wr({appCode:o.appCode||this.appCode,orgCode:o.orgCode,userCode:o.userCode,i18n_token:s}):(console.warn("获取 i18n_token 失败"),"")}catch(s){return console.warn("获取 i18n_token 失败",s),""}}async getRequestToken(){const e=this.tokenResolveVersion,n=this.token||this.baseToken||this.userToken||"",o=await this.createRequestToken(n,this.authInfo);return e!==this.tokenResolveVersion?"":o}applyAuthState(e={},{silent:n=!1}={}){const o=this.token,s=this.activeCacheScope,i=e.token??"",r=e.isAuthenticated?e.scope||"user":"guest";this.userToken=i,this.token=e.isAuthenticated?i||this.baseToken:this.baseToken,this.activeCacheScope=r;const l=this.updateRequestAuthIdentity({appCode:e.appCode||this.appCode,orgCode:e.orgCode||"",userCode:e.userCode||""},{clear:!n});return this.persistI18nConfig(),n?!1:o!==this.token||s!==this.activeCacheScope||l}async refreshLanguageForCurrentAuth(){const e=++this.authVersion,n=this.locale,o=this.activeCacheScope||"guest";return await this.setLanguage(n,{cacheScope:o,authVersion:e})}setupAuthListener(){!this.auth||this.authUnsubscribe||typeof this.auth.subscribe=="function"&&(this.authUnsubscribe=this.auth.subscribe(e=>{const n={token:(e==null?void 0:e.token)??this.resolveAuthState().token,scope:(e==null?void 0:e.scope)??(e==null?void 0:e.userScope)??(e==null?void 0:e.orgCode)??"",orgCode:(e==null?void 0:e.orgCode)??"",userCode:(e==null?void 0:e.userCode)??"",appCode:(e==null?void 0:e.appCode)??this.appCode,isAuthenticated:typeof(e==null?void 0:e.isAuthenticated)=="boolean"?e.isAuthenticated:!!((e==null?void 0:e.token)??this.resolveAuthState().token)||!!(this.i18nTokenRequest&&(e!=null&&e.appCode)&&(e!=null&&e.orgCode)&&(e!=null&&e.userCode))};this.applyAuthState(n)&&this.refreshLanguageForCurrentAuth()}))}setupMessageListener(){if(!(this.messageListenerRegistered||typeof window>"u")){this.messageListenerRegistered=!0;try{const e=o=>{!o.origin||o.origin==="null"||(o.data&&o.data.type==="updateLanguage"?this.handleUpdateLanguageSuccess(o.data):o.data&&o.data.type==="configError"?this.showConfigToast({message:o.data.message,icon:"error"}):o.data&&o.data.type==="closeModal"&&O.close())},n=[window];try{window.parent&&window.parent!==window&&n.push(window.parent)}catch{}try{window.top&&window.top!==window&&window.top!==window.parent&&n.push(window.top)}catch{}this._messageTargets=n,Array.from(new Set(n)).forEach(o=>{o.addEventListener("message",e)})}catch{}}}showConfigToast({message:e,icon:n="success"}={}){setTimeout(()=>{O.fire({title:e||(n==="error"?"操作失败":"保存成功"),icon:n,toast:!0,timer:1800,position:"top",showConfirmButton:!1})},0)}async handleUpdateLanguageSuccess({close:e,message:n}={}){await this.setLanguage(this.locale,{cacheScope:this.activeCacheScope,authVersion:this.authVersion}),e!==!1&&(O.close(),this.showConfigToast({message:n||"保存成功",icon:"success"}))}setRouter(e){return this.router=e,this.initRouterGuards(),this}initRouterGuards(){this.router&&(Z._routerGuardRegistered||(Z._routerGuardRegistered=!0,this.router.beforeEach(async(e,n,o)=>{var l,a;const{language:s,token:i}=e.query;if(this.configInstance&&this.configInstance.closeModal(),this.name=e.name,this.translationKeySet=new Set,i&&await this.setToken(i),this.loadI18n)try{await this.setLanguage(s||this.locale,{cacheScope:this.activeCacheScope})}catch(d){console.error("初始化语言失败,已跳过阻塞:",d)}this.loadI18n=!1;const r=this.router.getRoutes().find(d=>d.name===this.loginRouteName||d.path===`/${this.loginRouteName}`);if(r&&r.components){let d=(l=r.components)==null?void 0:l.default;if(typeof d=="function"&&d.toString().includes("import("))try{d=await d(),d=d.default}catch(u){console.error("加载异步组件时出错:",u),o();return}const g=qn(d);this.loginTranslationKeys=g}if(e.matched.length>0)try{const d=[];for(const g of e.matched){let u=(a=g.components)==null?void 0:a.default;if(typeof u=="function"&&u.toString().includes("import(")&&(u=await u(),u=u.default),u){const h=qn(u);d.push(...h)}}this.translationKeys=d}catch(d){console.error("加载异步组件时出错:",d),o();return}o()}),Z._afterEachGuardRegistered||(Z._afterEachGuardRegistered=!0,this.router.afterEach(async()=>{var i,r;await B.nextTick();const e=Array.from(this.translationKeySet),n=Array.from(new Set([...this.translationKeys||[],...e]));this.translationKeys=n;const o=(i=this.router)==null?void 0:i.currentRoute,s=(r=(o==null?void 0:o.value)??o)==null?void 0:r.name;if(s===this.loginRouteName&&(this.loginTranslationKeys=n),s){this.name=s;const l=E.get("I18N_CONFIG")||{};E.set("I18N_CONFIG",{...l,routerName:s})}}))))}initI18n(e){this.i18n=fr({locale:this.locale,messages:e.messages||{}}),this.keyValueMap={},globalThis.__I18N_ALL_KEYS__=new Set;const n=this;globalThis.$t=(o,s,i)=>{var h,_;const r=Wn(s,i);if(s=r.defaultValue,i=r.values,typeof o=="string"&&(n.translationKeySet.add(o),globalThis.__I18N_ALL_KEYS__&&globalThis.__I18N_ALL_KEYS__.add(o)),n.i18n.global.locale.value==="zh-CN"&&typeof o=="string"&&!o.startsWith("i.")&&!o.startsWith("pro."))return xe(s||o,i);const a=(h=n.router)==null?void 0:h.currentRoute,d=(_=(a==null?void 0:a.value)??a)==null?void 0:_.name,g=()=>{const L=`common.${o}`,S=n.i18n.t(L,void 0,i);return S!==L?S:n.i18n.t(o,void 0,i)};let u;if(d){const L=`${d}.${o}`,S=n.i18n.t(L,void 0,i);S!==L?u=S:u=g()}else u=g();return u===o&&typeof s=="string"&&s&&(u=s),u=xe(u,i),typeof o=="string"&&typeof u=="string"&&(n.keyValueMap[u]=o,globalThis.__I18N_KEY_VALUE_MAP__||(globalThis.__I18N_KEY_VALUE_MAP__={}),globalThis.__I18N_KEY_VALUE_MAP__[u]=o),u},this.t=globalThis.$t,globalThis.$deepScan=function(o){return o},globalThis.__GC_I18N_GET_REQUEST_TOKEN__=this.getRequestToken,globalThis.$clearI18n=this.clearI18n=()=>{Lt({appCode:this.appCode,cacheScope:this.activeCacheScope})},globalThis.$changeLocale=this.changeLocale=this.i18n.global.changeLocale=async o=>{await this.setLanguage(o||this.locale,{cacheScope:this.activeCacheScope})},globalThis.$isRTL=()=>this._isRTL,this.i18n.global.isRTL=()=>this._isRTL,this.updateDocumentDir()}isRTL(){return this._isRTL}static checkRTL(e){return Ee(e)}encodeTranslationKeys(e){if(!e||e.length===0)return"";const n=JSON.stringify(e);return je.compressToEncodedURIComponent(n)}encodeQueryParams(e){if(!e)return"";const n=JSON.stringify(e);return je.compressToEncodedURIComponent(n)}static decodeTranslationKeys(e){if(!e)return[];try{const n=je.decompressFromEncodedURIComponent(e);return n?JSON.parse(n):[]}catch(n){return console.error("解码 translationKeys 失败:",n),[]}}static decodeQueryParams(e){if(!e)return{};try{const n=je.decompressFromEncodedURIComponent(e);return n?JSON.parse(n):{}}catch(n){return console.error("解码 query 参数失败:",n),{}}}updateDocumentDir(){typeof document<"u"&&(document.documentElement.dir=this._isRTL?"rtl":"ltr",document.documentElement.lang=this.locale)}notifyLanguageChanged(e,n){(this.vueApps&&this.vueApps.size>0||this.vueInstances&&this.vueInstances.size>0)&&B.nextTick(()=>{const o=new Set;this.vueApps&&this.vueApps.forEach(s=>{s&&s._instance&&Ct(s._instance,o)}),this.vueInstances&&this.vueInstances.forEach(s=>{Jn(s,o)})}),typeof window<"u"&&typeof CustomEvent=="function"&&window.dispatchEvent(new CustomEvent("gc-i18n-language-changed",{detail:{language:e,changed:n}}))}setToken(e,n={}){const o=this.token,s=this.activeCacheScope,i={appCode:n.appCode||this.appCode,orgCode:n.orgCode||"",userCode:n.userCode||""};if(this.i18nTokenRequest&&(!i.appCode||!i.orgCode||!i.userCode))return console.warn("临时 token 模式调用 setToken 时必须提供 appCode、orgCode、userCode 三元身份"),Promise.resolve(!1);const r=this.updateRequestAuthIdentity(n);return this.tokenResolveVersion++,this.baseToken=e||"",this.token=this.baseToken,this.i18nTokenRequest&&(this.activeCacheScope=n.cacheScope||n.scope||yt(i)||"user"),this.persistI18nConfig(),o!==this.token||s!==this.activeCacheScope||r?this.refreshLanguageForCurrentAuth():Promise.resolve(!1)}async getLanguages(e=!1){return await _t({baseUrl:this.baseUrl,token:this.token,appCode:this.appCode,isRemote:e,getRequestToken:this.getRequestToken})}async setLanguage(e="zh-CN",n={}){e=this.normalizeLocale(e);const o=n.cacheScope||this.activeCacheScope||"guest",s=n.authVersion||this.authVersion,i=++this.languageVersion,r="I18N_MESSAGES_COMMON_"+e;let l=E.get(r);if(m.isEmpty(l))try{const a=await Yn.get(`https://cdn.ihotel.cn/i18n_messages/${e}.json`);if(a){const{data:d}=a;l=d,E.set(r,d)}}catch(a){console.warn(`公共语言包 ${e} 加载失败,继续使用业务语言数据`,a),l={}}try{const a=await ao({baseUrl:this.baseUrl,appCode:this.appCode,language:e||this.locale,token:this.token,routerName:this.name,cacheScope:o,getRequestToken:this.getRequestToken});if(s!==this.authVersion||i!==this.languageVersion)return!1;if(a&&Array.isArray(a)){const d=to(a),g=m.assign({},l,m.get(this.messages,e),d);this.i18n.global.setLocaleMessage(e,g)}else{const d=m.assign({},l,m.get(this.messages,e));this.i18n.global.setLocaleMessage(e,d)}return this.locale=e,this._isRTL=Ee(e),this.i18n.global.locale.value=e,E.set("I18N_LANGUAGE",e),this.persistI18nConfig(),this.updateDocumentDir(),this.notifyLanguageChanged(e,!0),!0}catch(a){if(console.error(`设置语言 ${e} 失败,使用本地消息继续运行:`,a),s!==this.authVersion||i!==this.languageVersion)return!1;const d=m.assign({},l,m.get(this.messages,e));return this.i18n.global.setLocaleMessage(e,d),this.locale=e,this._isRTL=Ee(e),this.i18n.global.locale.value=e,E.set("I18N_LANGUAGE",e),this.persistI18nConfig(),this.updateDocumentDir(),this.notifyLanguageChanged(e,!1),!1}}install(e,n={}){if(Xn(e)){const o=vt(e);if(o.prototype.$t=this.t||globalThis.$t,o.prototype.$i18n=this.i18n,!Z._vue2UpdateMixinRegistered&&o.mixin){Z._vue2UpdateMixinRegistered=!0;const s=this;o.mixin({beforeCreate(){s.vueInstances.add(this)},beforeDestroy(){s.vueInstances.delete(this)}})}}else if(this.vueApps.add(e),e.config.globalProperties.$t=this.t||globalThis.$t,e.config.globalProperties.$i18n=this.i18n,e.mixin){const o=this;e.mixin({beforeCreate(){o.vueInstances.add(this)},unmounted(){o.vueInstances.delete(this)}})}e.component("i18n-earth",{...Fn,props:{...Fn.props,baseUrl:{type:String,default:this.baseUrl}}}),this.setupMessageListener()}}j.I18n=Z,j.default=Z,Object.defineProperties(j,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
305
|
+
`,showCloseButton:!0,showConfirmButton:!1,width:"500px",customClass:{container:"i18n-earth-modal-container",popup:"i18n-earth-modal-popup",title:"i18n-earth-modal-title",htmlContainer:"i18n-earth-modal-content"}})},E=()=>{t.request&&typeof t.request=="function"?S():O()};return B.onMounted(()=>{r(),l(),window.addEventListener("message",h),L()}),{currentValue:d,openModal:E}},render(){const{editable:t,width:e,className:n}=this,o=e!==null?{width:e+"px"}:{},s=n?`earth ${n}`:"earth";return B.h("div",{class:s},[B.h("input",{class:"input",type:"text",value:this.currentValue,readonly:!t,disabled:!t,placeholder:"",style:o}),B.h("svg",{class:"icon earth-icon",viewBox:"0 0 24 24",width:"20",height:"20",fill:"currentColor",onClick:this.openModal},[B.h("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"})])])}};function _e(t){if(!t||typeof t!="string")return t;const e=t.toLowerCase();return{"zh-cn":"zh-CN","zh-tw":"zh-TW","zh-hk":"zh-HK","zh-mo":"zh-MO","en-us":"en-US"}[e]||t}function Kn(t={}){const e=Object.entries(t||{});return e.some(([,o])=>o&&typeof o=="object"&&!Array.isArray(o)&&Object.keys(o).some(s=>s.includes("-")))?e.reduce((o,[s,i])=>(!i||typeof i!="object"||Array.isArray(i)||Object.entries(i).forEach(([r,l])=>{const a=_e(r);o[a]=o[a]||{},o[a][s]=l}),o),{}):e.reduce((o,[s,i])=>(o[_e(s)]=i,o),{})}function Gn(t,e){return t[e]||t[_e(e)]||t[String(e||"").toLowerCase()]||{}}function xe(t,e){if(typeof t!="string"||!e||typeof e!="object"||Array.isArray(e))return t;const n=Object.entries(e);return t.replace(/\\?\$\{\s*([^}]+?)\s*\}/g,(o,s)=>{const i=String(s||"").trim(),r=n.find(([a])=>a===i||i==="this."+a||i==="_vm."+a||i==="_ctx."+a||i==="$setup."+a||a===i.replace(/^(?:this|_vm|_ctx|\$setup)\./,""));if(!r)return o;const l=r[1];return l!=null?String(l):o})}function Wn(t,e){return e===void 0&&t&&typeof t=="object"&&!Array.isArray(t)?{defaultValue:void 0,values:t}:{defaultValue:t,values:e}}function fr(t){const{locale:e="zh-CN",messages:n={}}=t,o=Kn(n),s=B.ref(e),i=B.ref(0),r=vt(),l=Xn()&&r&&typeof r.observable=="function"?r.observable({locale:e,messageVersion:0}):null,a=()=>l?l.locale:s.value,d=h=>{s.value=h,l&&(l.locale=h)},g=()=>{i.value+=1,l&&(l.messageVersion+=1)},u={locale:{get value(){return a()},set value(h){d(h)}},t(h,_,L){const S=Wn(_,L);_=S.defaultValue,L=S.values,i.value,l&&l.messageVersion;const O=a();if(O==="zh-CN"&&!h.startsWith("i.")&&!h.startsWith("pro."))return xe(_||h,L);const E=Gn(o,O);let m=E[h];return m===void 0&&h.includes(".")&&(m=h.split(".").reduce((v,k)=>v&&typeof v=="object"?v[k]:void 0,E)),m!=null&&m!==h?xe(m,L):xe(_||h,L)},setLocaleMessage(h,_){return o[_e(h)]={..._},g(),o[_e(h)]},getLocaleMessage(h){return Gn(o,h)}};return u.global=u,u}const Yn=He.create({timeout:8e3}),Zn="zh-CN",gr=/^(?:"([a-z]{2}-[A-Z]{2})"|([a-z]{2}-[A-Z]{2}))$/,pr=new Set(["zh-CN","zh-TW","zh-UG","en-US","tr-TR","es-ES","ja-JP","ru-RU","fr-FR","de-DE","pt-BR","pt-PT","ko-KR","vi-VN","sv-SE","id-ID","uk-UA","it-IT","th-TH","hi-IN","fa-IR","ro-RO","el-GR","nl-NL","cs-CZ","mn-MN","mn-TR","fi-FI","ar-SA","ar-EG","da-DK","pl-PL","nb-NO","si-LK"]);Yn.interceptors.request.use(t=>{const n=(x.get("I18N_CONFIG")||{}).token;return n&&(t.headers.Authorization=`Bearer ${n}`),t});function wr(t={}){const n=JSON.stringify({alg:"HS512"}),o=JSON.stringify(t);return Qn.jws.JWS.sign("HS512",n,o,"")}function mr(t){if(!t||typeof t!="string")return"";const e=t.replace(/-/g,"+").replace(/_/g,"/"),n=e.padEnd(e.length+(4-e.length%4)%4,"=");try{if(typeof atob=="function")return decodeURIComponent(Array.from(atob(n),o=>`%${o.charCodeAt(0).toString(16).padStart(2,"0")}`).join(""))}catch{}return""}function br(t){if(!t||typeof t!="string")return null;const e=t.split(".");if(e.length!==3)return null;try{return JSON.parse(mr(e[1]))}catch{return null}}function yr(t){const e=br(t);return!!(e&&(e.mainAppCode&&e.userCode&&e.deviceType||e.appCode&&e.orgCode&&e.userCode&&e.i18n_token))}function bt(t){if(!t)return"";const e=String(t);let n=0;for(let o=0;o<e.length;o++)n=(n<<5)-n+e.charCodeAt(o),n|=0;return`user_${Math.abs(n)}`}function yt({appCode:t,orgCode:e,userCode:n}={}){return!t||!e||!n?"":bt([t,e,n].join("|"))}function ge(t,...e){if(typeof t=="function")return t(...e)}function vt(t){return t&&(t.version||t.prototype||t.config)?t:(B.Vue&&B.Vue.version,B.Vue)}function Xn(t){if(t&&t.config&&t.config.globalProperties)return!1;const e=vt(t),n=e&&e.version;return typeof n=="string"?n.split(".")[0]==="2":!!(e&&e.prototype)}function vr(t){[t.$,t._].filter(Boolean).forEach(n=>{Array.isArray(n.renderCache)&&(n.renderCache.length=0)})}function Ct(t,e){if(!t||e.has(t))return;e.add(t),Array.isArray(t.renderCache)&&(t.renderCache.length=0);const n=t.proxy;n&&typeof n.$forceUpdate=="function"?n.$forceUpdate():typeof t.update=="function"&&t.update(),pe(t.subTree,e)}function pe(t,e){if(t){if(Array.isArray(t)){t.forEach(n=>pe(n,e));return}t.component&&Ct(t.component,e),Array.isArray(t.children)&&t.children.forEach(n=>pe(n,e)),Array.isArray(t.dynamicChildren)&&t.dynamicChildren.forEach(n=>pe(n,e)),t.ssContent&&pe(t.ssContent,e),t.ssFallback&&pe(t.ssFallback,e)}}function Jn(t,e=new Set){if(!t||e.has(t))return;e.add(t),vr(t),[t.$,t._].filter(Boolean).forEach(o=>{Ct(o,e)}),typeof t.$forceUpdate=="function"&&t.$forceUpdate(),(t.$children||[]).forEach(o=>Jn(o,e))}class Z{constructor(e={}){const{router:n,appCode:o,messages:s,token:i,orgCode:r,userCode:l,loginRouteName:a,login:d,keyboard:g,locale:u,env:h,dev:_,i18nTokenRequest:L,auth:S}=e;this.env=h||"local",this.baseUrl=kt({env:h,dev:_}),this.i18nTokenRequest=L||null,this.baseToken=i||(x.get("I18N_CONFIG")||{}).token||x.get("token"),this.token=this.baseToken,this.auth=S||null,this.authInfo={appCode:o,orgCode:r||"",userCode:l||""},this.getRequestToken=this.getRequestToken.bind(this),this.requestAuthIdentity=null,this.tokenResolveVersion=0,this.manualAuthScope=yt(this.authInfo)||(i?bt(i):""),this.authUnsubscribe=null,this.authVersion=0,this.languageVersion=0,this.activeCacheScope=this.manualAuthScope||"guest",this.loadI18n=!0,this.appCode=o,this.router=n,this.locale=this.resolveInitialLocale(u),this._isRTL=Ee(this.locale),this.persistI18nConfig(),this.name="",this.messages=Kn(s||{}),this.translationKeys=[],this.translationKeySet=new Set,this.loginRouteName=a||"login",this.login=d,this.loginTranslationKeys=[],this.keyboard=g||"ctrl+shift+l",this.openConfig=this.openConfig.bind(this),this.vueInstances=new Set,this.vueApps=new Set,this.editKeyboard=e.editKeyboard||"ctrl+shift+e",this.applyAuthState(this.resolveAuthState(),{silent:!0}),this.initI18n(e),this.router&&this.initRouterGuards(),ie.bind(this.keyboard,this.openConfig),ie.bind(this.editKeyboard,O=>{O.preventDefault(),or.toggle()}),this.setupLanguageChangeListener(),this.setupAuthListener(),this.setupMessageListener(),this.setupConfigRequestListener()}openConfig(e){var o;if((o=e==null?void 0:e.preventDefault)==null||o.call(e),this.name===this.loginRouteName)return;const n=Array.from(this.translationKeySet);return this.translationKeys=Array.from(new Set([...this.translationKeys||[],...n])),this.swalInstance=R.fire({titleText:"多语言管理",padding:"0px",backdrop:!1,allowOutsideClick:!1,heightAuto:!1,showCloseButton:!0,showConfirmButton:!1,width:"1000px",customClass:{container:"gc_i18n_container",title:"gc_i18n_title",closeButton:"gc_i18n_close_button",htmlContainer:"gc_i18n_html_container"},html:'<div id="gc_i18n_config_modal_root"></div>',didOpen:()=>{const s=document.getElementById("gc_i18n_config_modal_root");if(!s)return;const i=mo({name:this.name,token:this.token,appCode:this.appCode,baseUrl:this.baseUrl,getRequestToken:this.getRequestToken,translationKeys:this.translationKeys,loginRouteName:this.loginRouteName,loginTranslationKeys:this.loginTranslationKeys,login:this.login,onSaveSuccess:async({close:r,message:l}={})=>{await this.handleUpdateLanguageSuccess({close:r,message:l})},onError:({message:r}={})=>{this.showConfigToast({message:r,icon:"error"})},onClose:()=>{R.close()}});this.configInstance=i,i.mount(s)},willClose:()=>{this.configInstance&&(this.configInstance.destroy(),this.configInstance=null)}}),this.swalInstance}normalizeLocale(e){if(typeof e!="string")return Zn;const n=e.match(gr),o=n?n[1]||n[2]:"";return pr.has(o)?o:Zn}getUrlLanguage(){if(typeof window>"u"||!window.location)return"";try{return new URLSearchParams(window.location.search||"").get("language")||""}catch{return""}}resolveInitialLocale(e){const n=typeof navigator<"u"?navigator.language:"";return this.normalizeLocale(this.getUrlLanguage()||e||x.get("I18N_LANGUAGE")||n||"zh-CN")}setupLanguageChangeListener(){"onlanguagechange"in window&&window.addEventListener("languagechange",()=>{const e=this.normalizeLocale(navigator.language);e!==this.locale&&this.setLanguage(e)})}resolveAuthState(){var g,u,h;const e=this.auth||{},n=ge(e.getToken)??"",o=ge(e.getScope)??ge(e.getUserScope)??"",s=ge(e.getAppCode)??((g=this.authInfo)==null?void 0:g.appCode)??this.appCode,i=ge(e.getOrgCode)??((u=this.authInfo)==null?void 0:u.orgCode)??"",r=ge(e.getUserCode)??((h=this.authInfo)==null?void 0:h.userCode)??"",l=yt({appCode:s,orgCode:i,userCode:r}),a=typeof e.isAuthenticated=="function"?!!e.isAuthenticated():!!n||!!(this.i18nTokenRequest&&l),d=a?String(o||bt(n)||l||this.manualAuthScope||"user"):"guest";return{token:n,scope:d,appCode:s,orgCode:i,userCode:r,isAuthenticated:a}}normalizeAuthInfo(e={}){const n={appCode:e.appCode||this.appCode,orgCode:e.orgCode||"",userCode:e.userCode||""};return this.authInfo=n,n}updateRequestAuthIdentity(e={},{clear:n=!0}={}){const o=this.normalizeAuthInfo(e),s={appCode:o.appCode||this.appCode||"",orgCode:o.orgCode||"",userCode:o.userCode||""},i=this.requestAuthIdentity,r=!!i&&(i.appCode!==s.appCode||i.orgCode!==s.orgCode||i.userCode!==s.userCode);return this.requestAuthIdentity=s,r&&n&&this.clearLanguageCacheForAuthChange(i,s),r}clearLanguageCacheForAuthChange(e={},n={}){x.remove("I18N_LANGUAGES"),[e.appCode,n.appCode,this.appCode].filter(Boolean).forEach(o=>{Lt({appCode:o,cacheScope:this.activeCacheScope})})}persistI18nConfig(e={}){x.set("I18N_CONFIG",{...x.get("I18N_CONFIG")||{},baseUrl:this.baseUrl,appCode:this.appCode,token:this.token,locale:this.locale,env:this.env,cacheScope:this.activeCacheScope,...e})}async createRequestToken(e,n={}){if(!this.i18nTokenRequest)return e||"";if(e&&yr(e))return e;const o={appCode:n.appCode||this.appCode,orgCode:n.orgCode||"",userCode:n.userCode||""};if(!o.orgCode||!o.userCode)return console.warn("临时 token 模式需要提供 appCode、orgCode、userCode 三元身份"),"";try{const s=await ro({request:this.i18nTokenRequest,appCode:o.appCode||this.appCode,orgCode:o.orgCode,userCode:o.userCode,token:e});return s?wr({appCode:o.appCode||this.appCode,orgCode:o.orgCode,userCode:o.userCode,i18n_token:s}):(console.warn("获取 i18n_token 失败"),"")}catch(s){return console.warn("获取 i18n_token 失败",s),""}}async getRequestToken(){const e=this.tokenResolveVersion,n=this.token||this.baseToken||this.userToken||"",o=await this.createRequestToken(n,this.authInfo);return e!==this.tokenResolveVersion?"":o}applyAuthState(e={},{silent:n=!1}={}){const o=this.token,s=this.activeCacheScope,i=e.token??"",r=e.isAuthenticated?e.scope||"user":"guest";this.userToken=i,this.token=e.isAuthenticated?i||this.baseToken:this.baseToken,this.activeCacheScope=r;const l=this.updateRequestAuthIdentity({appCode:e.appCode||this.appCode,orgCode:e.orgCode||"",userCode:e.userCode||""},{clear:!n});return this.persistI18nConfig(),n?!1:o!==this.token||s!==this.activeCacheScope||l}async refreshLanguageForCurrentAuth(){const e=++this.authVersion,n=this.locale,o=this.activeCacheScope||"guest";return await this.setLanguage(n,{cacheScope:o,authVersion:e})}setupAuthListener(){!this.auth||this.authUnsubscribe||typeof this.auth.subscribe=="function"&&(this.authUnsubscribe=this.auth.subscribe(e=>{const n={token:(e==null?void 0:e.token)??this.resolveAuthState().token,scope:(e==null?void 0:e.scope)??(e==null?void 0:e.userScope)??(e==null?void 0:e.orgCode)??"",orgCode:(e==null?void 0:e.orgCode)??"",userCode:(e==null?void 0:e.userCode)??"",appCode:(e==null?void 0:e.appCode)??this.appCode,isAuthenticated:typeof(e==null?void 0:e.isAuthenticated)=="boolean"?e.isAuthenticated:!!((e==null?void 0:e.token)??this.resolveAuthState().token)||!!(this.i18nTokenRequest&&(e!=null&&e.appCode)&&(e!=null&&e.orgCode)&&(e!=null&&e.userCode))};this.applyAuthState(n)&&this.refreshLanguageForCurrentAuth()}))}setupMessageListener(){if(!(this.messageListenerRegistered||typeof window>"u")){this.messageListenerRegistered=!0;try{const e=o=>{!o.origin||o.origin==="null"||(o.data&&o.data.type==="updateLanguage"?this.handleUpdateLanguageSuccess(o.data):o.data&&o.data.type==="configError"?this.showConfigToast({message:o.data.message,icon:"error"}):o.data&&o.data.type==="closeModal"&&R.close())},n=[window];try{window.parent&&window.parent!==window&&n.push(window.parent)}catch{}try{window.top&&window.top!==window&&window.top!==window.parent&&n.push(window.top)}catch{}this._messageTargets=n,Array.from(new Set(n)).forEach(o=>{o.addEventListener("message",e)})}catch{}}}setupConfigRequestListener(){this.configRequestListenerRegistered||typeof window>"u"||typeof window.addEventListener!="function"||(this.configRequestListenerRegistered=!0,window.addEventListener("gc-i18n-config-request",this.openConfig))}showConfigToast({message:e,icon:n="success"}={}){setTimeout(()=>{R.fire({title:e||(n==="error"?"操作失败":"保存成功"),icon:n,toast:!0,timer:1800,position:"top",showConfirmButton:!1})},0)}async handleUpdateLanguageSuccess({close:e,message:n}={}){await this.setLanguage(this.locale,{cacheScope:this.activeCacheScope,authVersion:this.authVersion}),e!==!1&&(R.close(),this.showConfigToast({message:n||"保存成功",icon:"success"}))}setRouter(e){return this.router=e,this.initRouterGuards(),this}initRouterGuards(){this.router&&(Z._routerGuardRegistered||(Z._routerGuardRegistered=!0,this.router.beforeEach(async(e,n,o)=>{var l,a;const{language:s,token:i}=e.query;if(this.configInstance&&this.configInstance.closeModal(),this.name=e.name,this.translationKeySet=new Set,i&&await this.setToken(i),this.loadI18n)try{await this.setLanguage(s||this.locale,{cacheScope:this.activeCacheScope})}catch(d){console.error("初始化语言失败,已跳过阻塞:",d)}this.loadI18n=!1;const r=this.router.getRoutes().find(d=>d.name===this.loginRouteName||d.path===`/${this.loginRouteName}`);if(r&&r.components){let d=(l=r.components)==null?void 0:l.default;if(typeof d=="function"&&d.toString().includes("import("))try{d=await d(),d=d.default}catch(u){console.error("加载异步组件时出错:",u),o();return}const g=zn(d);this.loginTranslationKeys=g}if(e.matched.length>0)try{const d=[];for(const g of e.matched){let u=(a=g.components)==null?void 0:a.default;if(typeof u=="function"&&u.toString().includes("import(")&&(u=await u(),u=u.default),u){const h=zn(u);d.push(...h)}}this.translationKeys=d}catch(d){console.error("加载异步组件时出错:",d),o();return}o()}),Z._afterEachGuardRegistered||(Z._afterEachGuardRegistered=!0,this.router.afterEach(async()=>{var i,r;await B.nextTick();const e=Array.from(this.translationKeySet),n=Array.from(new Set([...this.translationKeys||[],...e]));this.translationKeys=n;const o=(i=this.router)==null?void 0:i.currentRoute,s=(r=(o==null?void 0:o.value)??o)==null?void 0:r.name;if(s===this.loginRouteName&&(this.loginTranslationKeys=n),s){this.name=s;const l=x.get("I18N_CONFIG")||{};x.set("I18N_CONFIG",{...l,routerName:s})}}))))}initI18n(e){this.i18n=fr({locale:this.locale,messages:e.messages||{}}),this.keyValueMap={},globalThis.__I18N_ALL_KEYS__=new Set;const n=this;globalThis.$t=(o,s,i)=>{var h,_;const r=Wn(s,i);if(s=r.defaultValue,i=r.values,typeof o=="string"&&(n.translationKeySet.add(o),globalThis.__I18N_ALL_KEYS__&&globalThis.__I18N_ALL_KEYS__.add(o)),n.i18n.global.locale.value==="zh-CN"&&typeof o=="string"&&!o.startsWith("i.")&&!o.startsWith("pro."))return xe(s||o,i);const a=(h=n.router)==null?void 0:h.currentRoute,d=(_=(a==null?void 0:a.value)??a)==null?void 0:_.name,g=()=>{const L=`common.${o}`,S=n.i18n.t(L,void 0,i);return S!==L?S:n.i18n.t(o,void 0,i)};let u;if(d){const L=`${d}.${o}`,S=n.i18n.t(L,void 0,i);S!==L?u=S:u=g()}else u=g();return u===o&&typeof s=="string"&&s&&(u=s),u=xe(u,i),typeof o=="string"&&typeof u=="string"&&(n.keyValueMap[u]=o,globalThis.__I18N_KEY_VALUE_MAP__||(globalThis.__I18N_KEY_VALUE_MAP__={}),globalThis.__I18N_KEY_VALUE_MAP__[u]=o),u},this.t=globalThis.$t,globalThis.$openI18nConfig=this.openConfig,globalThis.$deepScan=function(o){return o},globalThis.__GC_I18N_GET_REQUEST_TOKEN__=this.getRequestToken,globalThis.$clearI18n=this.clearI18n=()=>{Lt({appCode:this.appCode,cacheScope:this.activeCacheScope})},globalThis.$changeLocale=this.changeLocale=this.i18n.global.changeLocale=async o=>{await this.setLanguage(o||this.locale,{cacheScope:this.activeCacheScope})},globalThis.$isRTL=()=>this._isRTL,this.i18n.global.isRTL=()=>this._isRTL,this.updateDocumentDir()}isRTL(){return this._isRTL}static checkRTL(e){return Ee(e)}encodeTranslationKeys(e){if(!e||e.length===0)return"";const n=JSON.stringify(e);return je.compressToEncodedURIComponent(n)}encodeQueryParams(e){if(!e)return"";const n=JSON.stringify(e);return je.compressToEncodedURIComponent(n)}static decodeTranslationKeys(e){if(!e)return[];try{const n=je.decompressFromEncodedURIComponent(e);return n?JSON.parse(n):[]}catch(n){return console.error("解码 translationKeys 失败:",n),[]}}static decodeQueryParams(e){if(!e)return{};try{const n=je.decompressFromEncodedURIComponent(e);return n?JSON.parse(n):{}}catch(n){return console.error("解码 query 参数失败:",n),{}}}updateDocumentDir(){typeof document<"u"&&(document.documentElement.dir=this._isRTL?"rtl":"ltr",document.documentElement.lang=this.locale)}notifyLanguageChanged(e,n){(this.vueApps&&this.vueApps.size>0||this.vueInstances&&this.vueInstances.size>0)&&B.nextTick(()=>{const o=new Set;this.vueApps&&this.vueApps.forEach(s=>{s&&s._instance&&Ct(s._instance,o)}),this.vueInstances&&this.vueInstances.forEach(s=>{Jn(s,o)})}),typeof window<"u"&&typeof CustomEvent=="function"&&window.dispatchEvent(new CustomEvent("gc-i18n-language-changed",{detail:{language:e,changed:n}}))}setToken(e,n={}){const o=this.token,s=this.activeCacheScope,i={appCode:n.appCode||this.appCode,orgCode:n.orgCode||"",userCode:n.userCode||""};if(this.i18nTokenRequest&&(!i.appCode||!i.orgCode||!i.userCode))return console.warn("临时 token 模式调用 setToken 时必须提供 appCode、orgCode、userCode 三元身份"),Promise.resolve(!1);const r=this.updateRequestAuthIdentity(n);return this.tokenResolveVersion++,this.baseToken=e||"",this.token=this.baseToken,this.i18nTokenRequest&&(this.activeCacheScope=n.cacheScope||n.scope||yt(i)||"user"),this.persistI18nConfig(),o!==this.token||s!==this.activeCacheScope||r?this.refreshLanguageForCurrentAuth():Promise.resolve(!1)}async getLanguages(e=!1){return await _t({baseUrl:this.baseUrl,token:this.token,appCode:this.appCode,isRemote:e,getRequestToken:this.getRequestToken})}async setLanguage(e="zh-CN",n={}){e=this.normalizeLocale(e);const o=n.cacheScope||this.activeCacheScope||"guest",s=n.authVersion||this.authVersion,i=++this.languageVersion,r="I18N_MESSAGES_COMMON_"+e;let l=x.get(r);if(w.isEmpty(l))try{const a=await Yn.get(`https://cdn.ihotel.cn/i18n_messages/${e}.json`);if(a){const{data:d}=a;l=d,x.set(r,d)}}catch(a){console.warn(`公共语言包 ${e} 加载失败,继续使用业务语言数据`,a),l={}}try{const a=await ao({baseUrl:this.baseUrl,appCode:this.appCode,language:e||this.locale,token:this.token,routerName:this.name,cacheScope:o,getRequestToken:this.getRequestToken});if(s!==this.authVersion||i!==this.languageVersion)return!1;if(a&&Array.isArray(a)){const d=to(a),g=w.assign({},l,w.get(this.messages,e),d);this.i18n.global.setLocaleMessage(e,g)}else{const d=w.assign({},l,w.get(this.messages,e));this.i18n.global.setLocaleMessage(e,d)}return this.locale=e,this._isRTL=Ee(e),this.i18n.global.locale.value=e,x.set("I18N_LANGUAGE",e),this.persistI18nConfig(),this.updateDocumentDir(),this.notifyLanguageChanged(e,!0),!0}catch(a){if(console.error(`设置语言 ${e} 失败,使用本地消息继续运行:`,a),s!==this.authVersion||i!==this.languageVersion)return!1;const d=w.assign({},l,w.get(this.messages,e));return this.i18n.global.setLocaleMessage(e,d),this.locale=e,this._isRTL=Ee(e),this.i18n.global.locale.value=e,x.set("I18N_LANGUAGE",e),this.persistI18nConfig(),this.updateDocumentDir(),this.notifyLanguageChanged(e,!1),!1}}install(e,n={}){if(Xn(e)){const o=vt(e);if(o.prototype.$t=this.t||globalThis.$t,o.prototype.$i18n=this.i18n,o.prototype.$openI18nConfig=this.openConfig,!Z._vue2UpdateMixinRegistered&&o.mixin){Z._vue2UpdateMixinRegistered=!0;const s=this;o.mixin({beforeCreate(){s.vueInstances.add(this)},beforeDestroy(){s.vueInstances.delete(this)}})}}else if(this.vueApps.add(e),e.config.globalProperties.$t=this.t||globalThis.$t,e.config.globalProperties.$i18n=this.i18n,e.config.globalProperties.$openI18nConfig=this.openConfig,e.mixin){const o=this;e.mixin({beforeCreate(){o.vueInstances.add(this)},unmounted(){o.vueInstances.delete(this)}})}e.component("i18n-earth",{...Fn,props:{...Fn.props,baseUrl:{type:String,default:this.baseUrl}}}),this.setupMessageListener(),this.setupConfigRequestListener()}}j.I18n=Z,j.default=Z,Object.defineProperties(j,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
package/package.json
CHANGED
package/packages/index.js
CHANGED
|
@@ -522,6 +522,7 @@ class I18n {
|
|
|
522
522
|
this.login = login;
|
|
523
523
|
this.loginTranslationKeys = [];
|
|
524
524
|
this.keyboard = keyboard || "ctrl+shift+l";
|
|
525
|
+
this.openConfig = this.openConfig.bind(this);
|
|
525
526
|
this.vueInstances = new Set();
|
|
526
527
|
this.vueApps = new Set();
|
|
527
528
|
// 文本编辑模式快捷键,默认为 ctrl+shift+e,支持自定义传入
|
|
@@ -536,75 +537,7 @@ class I18n {
|
|
|
536
537
|
this.initRouterGuards();
|
|
537
538
|
}
|
|
538
539
|
|
|
539
|
-
keyboardJS.bind(this.keyboard,
|
|
540
|
-
e.preventDefault();
|
|
541
|
-
if (this.name === this.loginRouteName) {
|
|
542
|
-
return;
|
|
543
|
-
}
|
|
544
|
-
const runtimeKeys = Array.from(this.translationKeySet);
|
|
545
|
-
this.translationKeys = Array.from(
|
|
546
|
-
new Set([...(this.translationKeys || []), ...runtimeKeys])
|
|
547
|
-
);
|
|
548
|
-
this.swalInstance = Swal.fire({
|
|
549
|
-
titleText: "多语言管理",
|
|
550
|
-
padding: "0px",
|
|
551
|
-
backdrop: false,
|
|
552
|
-
allowOutsideClick: false,
|
|
553
|
-
heightAuto: false,
|
|
554
|
-
showCloseButton: true,
|
|
555
|
-
showConfirmButton: false,
|
|
556
|
-
width: "1000px",
|
|
557
|
-
customClass: {
|
|
558
|
-
container: "gc_i18n_container",
|
|
559
|
-
title: "gc_i18n_title",
|
|
560
|
-
closeButton: "gc_i18n_close_button",
|
|
561
|
-
htmlContainer: "gc_i18n_html_container"
|
|
562
|
-
},
|
|
563
|
-
html: '<div id="gc_i18n_config_modal_root"></div>',
|
|
564
|
-
didOpen: () => {
|
|
565
|
-
const root = document.getElementById("gc_i18n_config_modal_root");
|
|
566
|
-
|
|
567
|
-
if (!root) {
|
|
568
|
-
return;
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
const configInstance = createConfigModal({
|
|
572
|
-
name: this.name,
|
|
573
|
-
token: this.token,
|
|
574
|
-
appCode: this.appCode,
|
|
575
|
-
baseUrl: this.baseUrl,
|
|
576
|
-
getRequestToken: this.getRequestToken,
|
|
577
|
-
translationKeys: this.translationKeys,
|
|
578
|
-
loginRouteName: this.loginRouteName,
|
|
579
|
-
loginTranslationKeys: this.loginTranslationKeys,
|
|
580
|
-
login: this.login,
|
|
581
|
-
onSaveSuccess: async ({ close, message } = {}) => {
|
|
582
|
-
await this.handleUpdateLanguageSuccess({
|
|
583
|
-
close,
|
|
584
|
-
message
|
|
585
|
-
});
|
|
586
|
-
},
|
|
587
|
-
onError: ({ message } = {}) => {
|
|
588
|
-
this.showConfigToast({
|
|
589
|
-
message,
|
|
590
|
-
icon: "error"
|
|
591
|
-
});
|
|
592
|
-
},
|
|
593
|
-
onClose: () => {
|
|
594
|
-
Swal.close();
|
|
595
|
-
}
|
|
596
|
-
});
|
|
597
|
-
this.configInstance = configInstance;
|
|
598
|
-
void configInstance.mount(root);
|
|
599
|
-
},
|
|
600
|
-
willClose: () => {
|
|
601
|
-
if (this.configInstance) {
|
|
602
|
-
this.configInstance.destroy();
|
|
603
|
-
this.configInstance = null;
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
});
|
|
607
|
-
});
|
|
540
|
+
keyboardJS.bind(this.keyboard, this.openConfig);
|
|
608
541
|
|
|
609
542
|
// 绑定文本编辑模式快捷键(默认为 shift+e,可通过 editKeyboard 配置传入)
|
|
610
543
|
keyboardJS.bind(this.editKeyboard, (e) => {
|
|
@@ -617,6 +550,83 @@ class I18n {
|
|
|
617
550
|
|
|
618
551
|
this.setupAuthListener();
|
|
619
552
|
this.setupMessageListener();
|
|
553
|
+
this.setupConfigRequestListener();
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* 打开多语言配置弹窗,供快捷键、实例方法和 Vue 全局方法复用。
|
|
558
|
+
* @param {Event} [event] - 快捷键或配置请求事件
|
|
559
|
+
* @returns {Promise|undefined} SweetAlert 弹窗结果
|
|
560
|
+
*/
|
|
561
|
+
openConfig(event) {
|
|
562
|
+
event?.preventDefault?.();
|
|
563
|
+
if (this.name === this.loginRouteName) {
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
const runtimeKeys = Array.from(this.translationKeySet);
|
|
567
|
+
this.translationKeys = Array.from(
|
|
568
|
+
new Set([...(this.translationKeys || []), ...runtimeKeys])
|
|
569
|
+
);
|
|
570
|
+
this.swalInstance = Swal.fire({
|
|
571
|
+
titleText: "多语言管理",
|
|
572
|
+
padding: "0px",
|
|
573
|
+
backdrop: false,
|
|
574
|
+
allowOutsideClick: false,
|
|
575
|
+
heightAuto: false,
|
|
576
|
+
showCloseButton: true,
|
|
577
|
+
showConfirmButton: false,
|
|
578
|
+
width: "1000px",
|
|
579
|
+
customClass: {
|
|
580
|
+
container: "gc_i18n_container",
|
|
581
|
+
title: "gc_i18n_title",
|
|
582
|
+
closeButton: "gc_i18n_close_button",
|
|
583
|
+
htmlContainer: "gc_i18n_html_container"
|
|
584
|
+
},
|
|
585
|
+
html: '<div id="gc_i18n_config_modal_root"></div>',
|
|
586
|
+
didOpen: () => {
|
|
587
|
+
const root = document.getElementById("gc_i18n_config_modal_root");
|
|
588
|
+
|
|
589
|
+
if (!root) {
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
const configInstance = createConfigModal({
|
|
594
|
+
name: this.name,
|
|
595
|
+
token: this.token,
|
|
596
|
+
appCode: this.appCode,
|
|
597
|
+
baseUrl: this.baseUrl,
|
|
598
|
+
getRequestToken: this.getRequestToken,
|
|
599
|
+
translationKeys: this.translationKeys,
|
|
600
|
+
loginRouteName: this.loginRouteName,
|
|
601
|
+
loginTranslationKeys: this.loginTranslationKeys,
|
|
602
|
+
login: this.login,
|
|
603
|
+
onSaveSuccess: async ({ close, message } = {}) => {
|
|
604
|
+
await this.handleUpdateLanguageSuccess({
|
|
605
|
+
close,
|
|
606
|
+
message
|
|
607
|
+
});
|
|
608
|
+
},
|
|
609
|
+
onError: ({ message } = {}) => {
|
|
610
|
+
this.showConfigToast({
|
|
611
|
+
message,
|
|
612
|
+
icon: "error"
|
|
613
|
+
});
|
|
614
|
+
},
|
|
615
|
+
onClose: () => {
|
|
616
|
+
Swal.close();
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
this.configInstance = configInstance;
|
|
620
|
+
void configInstance.mount(root);
|
|
621
|
+
},
|
|
622
|
+
willClose: () => {
|
|
623
|
+
if (this.configInstance) {
|
|
624
|
+
this.configInstance.destroy();
|
|
625
|
+
this.configInstance = null;
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
return this.swalInstance;
|
|
620
630
|
}
|
|
621
631
|
/**
|
|
622
632
|
* 严格校验语言代码,不支持的值统一回退到简体中文
|
|
@@ -935,6 +945,18 @@ class I18n {
|
|
|
935
945
|
} catch (error) {}
|
|
936
946
|
}
|
|
937
947
|
|
|
948
|
+
setupConfigRequestListener() {
|
|
949
|
+
if (
|
|
950
|
+
this.configRequestListenerRegistered ||
|
|
951
|
+
typeof window === "undefined" ||
|
|
952
|
+
typeof window.addEventListener !== "function"
|
|
953
|
+
) {
|
|
954
|
+
return;
|
|
955
|
+
}
|
|
956
|
+
this.configRequestListenerRegistered = true;
|
|
957
|
+
window.addEventListener("gc-i18n-config-request", this.openConfig);
|
|
958
|
+
}
|
|
959
|
+
|
|
938
960
|
showConfigToast({ message, icon = "success" } = {}) {
|
|
939
961
|
setTimeout(() => {
|
|
940
962
|
Swal.fire({
|
|
@@ -1176,6 +1198,7 @@ class I18n {
|
|
|
1176
1198
|
|
|
1177
1199
|
// 暴露实例方法(可选)
|
|
1178
1200
|
this.t = globalThis.$t;
|
|
1201
|
+
globalThis.$openI18nConfig = this.openConfig;
|
|
1179
1202
|
|
|
1180
1203
|
globalThis.$deepScan = function (val) {
|
|
1181
1204
|
return val;
|
|
@@ -1476,6 +1499,7 @@ class I18n {
|
|
|
1476
1499
|
const Vue = getVueRuntime(app);
|
|
1477
1500
|
Vue.prototype.$t = this.t || globalThis.$t;
|
|
1478
1501
|
Vue.prototype.$i18n = this.i18n;
|
|
1502
|
+
Vue.prototype.$openI18nConfig = this.openConfig;
|
|
1479
1503
|
if (!I18n._vue2UpdateMixinRegistered && Vue.mixin) {
|
|
1480
1504
|
I18n._vue2UpdateMixinRegistered = true;
|
|
1481
1505
|
const i18nInstance = this;
|
|
@@ -1493,6 +1517,7 @@ class I18n {
|
|
|
1493
1517
|
this.vueApps.add(app);
|
|
1494
1518
|
app.config.globalProperties.$t = this.t || globalThis.$t;
|
|
1495
1519
|
app.config.globalProperties.$i18n = this.i18n;
|
|
1520
|
+
app.config.globalProperties.$openI18nConfig = this.openConfig;
|
|
1496
1521
|
if (app.mixin) {
|
|
1497
1522
|
const i18nInstance = this;
|
|
1498
1523
|
app.mixin({
|
|
@@ -1518,6 +1543,7 @@ class I18n {
|
|
|
1518
1543
|
}
|
|
1519
1544
|
});
|
|
1520
1545
|
this.setupMessageListener();
|
|
1546
|
+
this.setupConfigRequestListener();
|
|
1521
1547
|
}
|
|
1522
1548
|
}
|
|
1523
1549
|
|