From 561c4810be4f3e6a00278327e1f00a4da5cf664f Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Mon, 4 Aug 2025 11:37:53 +0200 Subject: [PATCH 01/30] default Max Age to 360min --- web/assets/js/model/setting.js | 2 +- web/service/setting.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/web/assets/js/model/setting.js b/web/assets/js/model/setting.js index 89ea171f..55fbf635 100644 --- a/web/assets/js/model/setting.js +++ b/web/assets/js/model/setting.js @@ -7,7 +7,7 @@ class AllSetting { this.webCertFile = ""; this.webKeyFile = ""; this.webBasePath = "/"; - this.sessionMaxAge = 60; + this.sessionMaxAge = 360; this.pageSize = 50; this.expireDiff = 0; this.trafficDiff = 0; diff --git a/web/service/setting.go b/web/service/setting.go index 868d55bc..a54eaea7 100644 --- a/web/service/setting.go +++ b/web/service/setting.go @@ -32,7 +32,7 @@ var defaultValueMap = map[string]string{ "webKeyFile": "", "secret": random.Seq(32), "webBasePath": "/", - "sessionMaxAge": "60", + "sessionMaxAge": "360", "pageSize": "50", "expireDiff": "0", "trafficDiff": "0", From 3c1634ca7cb0fbe6897280c7964a833c7c39943b Mon Sep 17 00:00:00 2001 From: elseif Date: Mon, 4 Aug 2025 17:50:39 +0800 Subject: [PATCH 02/30] use musl libc toolchains for build statically linked binaries (#3191) --- .github/workflows/release.yml | 83 ++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 40 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6c6708c8..ba3aac82 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,51 +42,54 @@ jobs: go-version-file: go.mod check-latest: true - - name: Install dependencies - run: | - sudo apt-get update - if [ "${{ matrix.platform }}" == "arm64" ]; then - sudo apt install gcc-aarch64-linux-gnu - elif [ "${{ matrix.platform }}" == "armv7" ]; then - sudo apt install gcc-arm-linux-gnueabihf - elif [ "${{ matrix.platform }}" == "armv6" ]; then - sudo apt install gcc-arm-linux-gnueabihf - elif [ "${{ matrix.platform }}" == "386" ]; then - sudo apt install gcc-i686-linux-gnu - elif [ "${{ matrix.platform }}" == "armv5" ]; then - sudo apt install gcc-arm-linux-gnueabi - elif [ "${{ matrix.platform }}" == "s390x" ]; then - sudo apt install gcc-s390x-linux-gnu - fi - - name: Build 3x-ui run: | export CGO_ENABLED=1 export GOOS=linux export GOARCH=${{ matrix.platform }} - if [ "${{ matrix.platform }}" == "arm64" ]; then - export GOARCH=arm64 - export CC=aarch64-linux-gnu-gcc - elif [ "${{ matrix.platform }}" == "armv7" ]; then - export GOARCH=arm - export GOARM=7 - export CC=arm-linux-gnueabihf-gcc - elif [ "${{ matrix.platform }}" == "armv6" ]; then - export GOARCH=arm - export GOARM=6 - export CC=arm-linux-gnueabihf-gcc - elif [ "${{ matrix.platform }}" == "386" ]; then - export GOARCH=386 - export CC=i686-linux-gnu-gcc - elif [ "${{ matrix.platform }}" == "armv5" ]; then - export GOARCH=arm - export GOARM=5 - export CC=arm-linux-gnueabi-gcc - elif [ "${{ matrix.platform }}" == "s390x" ]; then - export GOARCH=s390x - export CC=s390x-linux-gnu-gcc - fi - go build -ldflags "-w -s" -o xui-release -v main.go + TOOLCHAIN_URL="" + MUSL_CC_HOST="https://github.com/musl-cc/musl.cc/releases/download/v0.0.1" #http://musl.cc + case "${{ matrix.platform }}" in + amd64) + TOOLCHAIN_URL="$MUSL_CC_HOST/x86_64-linux-musl-cross.tgz" + ;; + arm64) + TOOLCHAIN_URL="$MUSL_CC_HOST/aarch64-linux-musl-cross.tgz" + ;; + armv7) + TOOLCHAIN_URL="$MUSL_CC_HOST/armv7l-linux-musleabihf-cross.tgz" + export GOARCH=arm + export GOARM=7 + ;; + armv6) + TOOLCHAIN_URL="$MUSL_CC_HOST/armv6-linux-musleabihf-cross.tgz" + export GOARCH=arm + export GOARM=6 + ;; + armv5) + TOOLCHAIN_URL="$MUSL_CC_HOST/arm-linux-musleabi-cross.tgz" + export GOARCH=arm + export GOARM=5 + ;; + 386) + TOOLCHAIN_URL="$MUSL_CC_HOST/i686-linux-musl-cross.tgz" + ;; + s390x) + TOOLCHAIN_URL="$MUSL_CC_HOST/s390x-linux-musl-cross.tgz" + ;; + esac + echo "Downloading musl toolchain for ${{ matrix.platform }}" + curl -LO "$TOOLCHAIN_URL" + tar -xf *.tgz + TOOLCHAIN_DIR=$(find . -maxdepth 1 -type d -name "*-cross" | head -n1) + TOOLCHAIN_DIR=$(realpath "$TOOLCHAIN_DIR") + export PATH="$TOOLCHAIN_DIR/bin:$PATH" + # Detect compiler + export CC=$(find $TOOLCHAIN_DIR/bin -name '*-gcc' | head -n1) + echo "Using CC=$CC" + go build -ldflags "-w -s -linkmode external -extldflags '-static'" -o xui-release -v main.go + file xui-release + ldd xui-release || echo "Static binary confirmed" mkdir x-ui cp xui-release x-ui/ From 6ff555c8bb7abf2d528363b4937757424a0ae527 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Mon, 4 Aug 2025 14:39:12 +0200 Subject: [PATCH 03/30] runs-on: ubuntu-latest --- .github/workflows/docker.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5313d60a..ce3a94f0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -7,7 +7,7 @@ on: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ba3aac82..222f198a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -31,7 +31,7 @@ jobs: - 386 - armv5 - s390x - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 From e4ba5ba53a27ee256364e7031df3d43afb3b3fe6 Mon Sep 17 00:00:00 2001 From: Sanaei Date: Mon, 4 Aug 2025 16:27:57 +0200 Subject: [PATCH 04/30] add ech support (#3310) Co-authored-by: Alireza Ahmadi --- web/assets/js/model/inbound.js | 23 ++++++++++++++++++++++- web/assets/js/model/outbound.js | 9 +++++++-- web/controller/server.go | 11 +++++++++++ web/html/form/tls_settings.html | 15 +++++++++++++++ web/html/modals/inbound_modal.html | 10 ++++++++++ web/service/server.go | 24 ++++++++++++++++++++++++ 6 files changed, 89 insertions(+), 3 deletions(-) diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index 09073593..da5522a5 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -560,6 +560,8 @@ class TlsStreamSettings extends XrayCommonClass { enableSessionResumption = false, certificates = [new TlsStreamSettings.Cert()], alpn = [ALPN_OPTION.H2, ALPN_OPTION.HTTP1], + echServerKeys = '', + echForceQuery = 'none', settings = new TlsStreamSettings.Settings() ) { super(); @@ -573,6 +575,8 @@ class TlsStreamSettings extends XrayCommonClass { this.enableSessionResumption = enableSessionResumption; this.certs = certificates; this.alpn = alpn; + this.echServerKeys = echServerKeys; + this.echForceQuery = echForceQuery; this.settings = settings; } @@ -592,7 +596,7 @@ class TlsStreamSettings extends XrayCommonClass { } if (!ObjectUtil.isEmpty(json.settings)) { - settings = new TlsStreamSettings.Settings(json.settings.allowInsecure, json.settings.fingerprint, json.settings.serverName, json.settings.domains); + settings = new TlsStreamSettings.Settings(json.settings.allowInsecure, json.settings.fingerprint, json.settings.echConfigList); } return new TlsStreamSettings( json.serverName, @@ -605,6 +609,8 @@ class TlsStreamSettings extends XrayCommonClass { json.enableSessionResumption, certs, json.alpn, + json.echServerKeys, + json.echForceQuery, settings, ); } @@ -621,6 +627,8 @@ class TlsStreamSettings extends XrayCommonClass { enableSessionResumption: this.enableSessionResumption, certificates: TlsStreamSettings.toJsonArray(this.certs), alpn: this.alpn, + echServerKeys: this.echServerKeys, + echForceQuery: this.echForceQuery, settings: this.settings, }; } @@ -701,21 +709,25 @@ TlsStreamSettings.Settings = class extends XrayCommonClass { constructor( allowInsecure = false, fingerprint = UTLS_FINGERPRINT.UTLS_CHROME, + echConfigList = '', ) { super(); this.allowInsecure = allowInsecure; this.fingerprint = fingerprint; + this.echConfigList = echConfigList; } static fromJson(json = {}) { return new TlsStreamSettings.Settings( json.allowInsecure, json.fingerprint, + json.echConfigList, ); } toJson() { return { allowInsecure: this.allowInsecure, fingerprint: this.fingerprint, + echConfigList: this.echConfigList }; } }; @@ -1375,6 +1387,9 @@ class Inbound extends XrayCommonClass { if (!ObjectUtil.isEmpty(this.stream.tls.sni)) { params.set("sni", this.stream.tls.sni); } + if (this.stream.tls.settings.echConfigList?.length > 0) { + params.set("ech", this.stream.tls.settings.echConfigList); + } if (type == "tcp" && !ObjectUtil.isEmpty(flow)) { params.set("flow", flow); } @@ -1474,6 +1489,9 @@ class Inbound extends XrayCommonClass { if (this.stream.tls.settings.allowInsecure) { params.set("allowInsecure", "1"); } + if (this.stream.tls.settings.echConfigList?.length > 0) { + params.set("ech", this.stream.tls.settings.echConfigList); + } if (!ObjectUtil.isEmpty(this.stream.tls.sni)) { params.set("sni", this.stream.tls.sni); } @@ -1552,6 +1570,9 @@ class Inbound extends XrayCommonClass { if (this.stream.tls.settings.allowInsecure) { params.set("allowInsecure", "1"); } + if (this.stream.tls.settings.echConfigList?.length > 0) { + params.set("ech", this.stream.tls.settings.echConfigList); + } if (!ObjectUtil.isEmpty(this.stream.tls.sni)) { params.set("sni", this.stream.tls.sni); } diff --git a/web/assets/js/model/outbound.js b/web/assets/js/model/outbound.js index 03569b00..a42c400d 100644 --- a/web/assets/js/model/outbound.js +++ b/web/assets/js/model/outbound.js @@ -354,13 +354,15 @@ class TlsStreamSettings extends CommonClass { serverName = '', alpn = [], fingerprint = '', - allowInsecure = false + allowInsecure = false, + echConfigList = '', ) { super(); this.serverName = serverName; this.alpn = alpn; this.fingerprint = fingerprint; this.allowInsecure = allowInsecure; + this.echConfigList = echConfigList; } static fromJson(json = {}) { @@ -369,6 +371,7 @@ class TlsStreamSettings extends CommonClass { json.alpn, json.fingerprint, json.allowInsecure, + json.echConfigList, ); } @@ -378,6 +381,7 @@ class TlsStreamSettings extends CommonClass { alpn: this.alpn, fingerprint: this.fingerprint, allowInsecure: this.allowInsecure, + echConfigList: this.echConfigList }; } } @@ -782,7 +786,8 @@ class Outbound extends CommonClass { let alpn = url.searchParams.get('alpn'); let allowInsecure = url.searchParams.get('allowInsecure'); let sni = url.searchParams.get('sni') ?? ''; - stream.tls = new TlsStreamSettings(sni, alpn ? alpn.split(',') : [], fp, allowInsecure == 1); + let ech = url.searchParams.get('ech') ?? ''; + stream.tls = new TlsStreamSettings(sni, alpn ? alpn.split(',') : [], fp, allowInsecure == 1, ech); } if (security == 'reality') { diff --git a/web/controller/server.go b/web/controller/server.go index 22f89f2f..8a7a2198 100644 --- a/web/controller/server.go +++ b/web/controller/server.go @@ -51,6 +51,7 @@ func (a *ServerController) initRouter(g *gin.RouterGroup) { g.POST("/importDB", a.importDB) g.POST("/getNewX25519Cert", a.getNewX25519Cert) g.POST("/getNewmldsa65", a.getNewmldsa65) + g.POST("/getNewEchCert", a.getNewEchCert) } func (a *ServerController) refreshStatus() { @@ -208,3 +209,13 @@ func (a *ServerController) getNewmldsa65(c *gin.Context) { } jsonObj(c, cert, nil) } + +func (a *ServerController) getNewEchCert(c *gin.Context) { + sni := c.PostForm("sni") + cert, err := a.serverService.GetNewEchCert(sni) + if err != nil { + jsonMsg(c, "get ech certificate", err) + return + } + jsonObj(c, cert, nil) +} diff --git a/web/html/form/tls_settings.html b/web/html/form/tls_settings.html index 0de6dae5..3e61b5a2 100644 --- a/web/html/form/tls_settings.html +++ b/web/html/form/tls_settings.html @@ -106,6 +106,21 @@ + + + + + + + + + [[ key ]] + + + + Get New ECH Cert + diff --git a/web/html/modals/inbound_modal.html b/web/html/modals/inbound_modal.html index f11df2e2..b77e74e2 100644 --- a/web/html/modals/inbound_modal.html +++ b/web/html/modals/inbound_modal.html @@ -152,6 +152,16 @@ inModal.inbound.stream.reality.mldsa65Seed = msg.obj.seed; inModal.inbound.stream.reality.settings.mldsa65Verify = msg.obj.verify; }, + async getNewEchCert() { + inModal.loading(true); + const msg = await HttpUtil.post('/server/getNewEchCert', {sni: inModal.inbound.stream.tls.sni}); + inModal.loading(false); + if (!msg.success) { + return; + } + inModal.inbound.stream.tls.echServerKeys = msg.obj.echServerKeys; + inModal.inbound.stream.tls.settings.echConfigList = msg.obj.echConfigList; + }, }, }); diff --git a/web/service/server.go b/web/service/server.go index e75a97b8..f0be46c2 100644 --- a/web/service/server.go +++ b/web/service/server.go @@ -743,3 +743,27 @@ func (s *ServerService) GetNewmldsa65() (any, error) { return keyPair, nil } + +func (s *ServerService) GetNewEchCert(sni string) (interface{}, error) { + // Run the command + cmd := exec.Command(xray.GetBinaryPath(), "tls", "ech", "--serverName", sni) + var out bytes.Buffer + cmd.Stdout = &out + err := cmd.Run() + if err != nil { + return nil, err + } + + lines := strings.Split(out.String(), "\n") + if len(lines) < 4 { + return nil, common.NewError("invalid ech cert") + } + + configList := lines[1] + serverKeys := lines[3] + + return map[string]interface{}{ + "echServerKeys": serverKeys, + "echConfigList": configList, + }, nil +} From 01f984e054fe3c6e06aeb9b947ef009fbfe5db65 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Mon, 4 Aug 2025 16:45:09 +0200 Subject: [PATCH 05/30] add dokodemo port mapping --- web/assets/js/model/inbound.js | 4 ++++ web/html/form/protocol/dokodemo.html | 13 +++++++++++++ web/translation/translate.ar_EG.toml | 1 + web/translation/translate.en_US.toml | 1 + web/translation/translate.es_ES.toml | 1 + web/translation/translate.fa_IR.toml | 1 + web/translation/translate.id_ID.toml | 1 + web/translation/translate.ja_JP.toml | 1 + web/translation/translate.pt_BR.toml | 1 + web/translation/translate.ru_RU.toml | 1 + web/translation/translate.tr_TR.toml | 1 + web/translation/translate.uk_UA.toml | 1 + web/translation/translate.vi_VN.toml | 1 + web/translation/translate.zh_CN.toml | 1 + web/translation/translate.zh_TW.toml | 1 + 15 files changed, 30 insertions(+) diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index da5522a5..a2f85194 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -2312,12 +2312,14 @@ Inbound.DokodemoSettings = class extends Inbound.Settings { protocol, address, port, + portMap = [], network = 'tcp,udp', followRedirect = false ) { super(protocol); this.address = address; this.port = port; + this.portMap = portMap; this.network = network; this.followRedirect = followRedirect; } @@ -2327,6 +2329,7 @@ Inbound.DokodemoSettings = class extends Inbound.Settings { Protocols.DOKODEMO, json.address, json.port, + XrayCommonClass.toHeaders(json.portMap), json.network, json.followRedirect, ); @@ -2336,6 +2339,7 @@ Inbound.DokodemoSettings = class extends Inbound.Settings { return { address: this.address, port: this.port, + portMap: XrayCommonClass.toV2Headers(this.portMap), network: this.network, followRedirect: this.followRedirect, }; diff --git a/web/html/form/protocol/dokodemo.html b/web/html/form/protocol/dokodemo.html index 70ffe7e0..267dcf4e 100644 --- a/web/html/form/protocol/dokodemo.html +++ b/web/html/form/protocol/dokodemo.html @@ -6,6 +6,19 @@ + + + + + + + + + + + - + + + TCP,UDP diff --git a/web/translation/translate.ar_EG.toml b/web/translation/translate.ar_EG.toml index c3748499..3c2fc04f 100644 --- a/web/translation/translate.ar_EG.toml +++ b/web/translation/translate.ar_EG.toml @@ -158,6 +158,7 @@ "remark" = "ملاحظة" "protocol" = "بروتوكول" "port" = "بورت" +"portMap" = "خريطة البورت" "traffic" = "الترافيك" "details" = "تفاصيل" "transportConfig" = "نقل" diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml index eb2389dd..4ddef0da 100644 --- a/web/translation/translate.en_US.toml +++ b/web/translation/translate.en_US.toml @@ -158,6 +158,7 @@ "remark" = "Remark" "protocol" = "Protocol" "port" = "Port" +"portMap" = "Port Mapping" "traffic" = "Traffic" "details" = "Details" "transportConfig" = "Transport" diff --git a/web/translation/translate.es_ES.toml b/web/translation/translate.es_ES.toml index e682bd38..51a5aea8 100644 --- a/web/translation/translate.es_ES.toml +++ b/web/translation/translate.es_ES.toml @@ -158,6 +158,7 @@ "remark" = "Notas" "protocol" = "Protocolo" "port" = "Puerto" +"portMap" = "Puertos de Destino" "traffic" = "Tráfico" "details" = "Detalles" "transportConfig" = "Transporte" diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml index 4d3aa6ae..35100f66 100644 --- a/web/translation/translate.fa_IR.toml +++ b/web/translation/translate.fa_IR.toml @@ -158,6 +158,7 @@ "remark" = "نام" "protocol" = "پروتکل" "port" = "پورت" +"portMap" = "پورت‌های نظیر" "traffic" = "ترافیک" "details" = "توضیحات" "transportConfig" = "نحوه اتصال" diff --git a/web/translation/translate.id_ID.toml b/web/translation/translate.id_ID.toml index bc36f046..21e87dd7 100644 --- a/web/translation/translate.id_ID.toml +++ b/web/translation/translate.id_ID.toml @@ -158,6 +158,7 @@ "remark" = "Catatan" "protocol" = "Protokol" "port" = "Port" +"portMap" = "Port Mapping" "traffic" = "Traffic" "details" = "Rincian" "transportConfig" = "Transport" diff --git a/web/translation/translate.ja_JP.toml b/web/translation/translate.ja_JP.toml index c4461fcf..4bc620c6 100644 --- a/web/translation/translate.ja_JP.toml +++ b/web/translation/translate.ja_JP.toml @@ -158,6 +158,7 @@ "remark" = "備考" "protocol" = "プロトコル" "port" = "ポート" +"portMap" = "ポートマッピング" "traffic" = "トラフィック" "details" = "詳細情報" "transportConfig" = "トランスポート設定" diff --git a/web/translation/translate.pt_BR.toml b/web/translation/translate.pt_BR.toml index a59fb81c..a81f95fb 100644 --- a/web/translation/translate.pt_BR.toml +++ b/web/translation/translate.pt_BR.toml @@ -158,6 +158,7 @@ "remark" = "Observação" "protocol" = "Protocolo" "port" = "Porta" +"portMap" = "Porta Mapeada" "traffic" = "Tráfego" "details" = "Detalhes" "transportConfig" = "Transporte" diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml index 95ea9509..114ada89 100644 --- a/web/translation/translate.ru_RU.toml +++ b/web/translation/translate.ru_RU.toml @@ -158,6 +158,7 @@ "remark" = "Примечание" "protocol" = "Протокол" "port" = "Порт" +"portMap" = "Порт-маппинг" "traffic" = "Трафик" "details" = "Подробнее" "transportConfig" = "Транспорт" diff --git a/web/translation/translate.tr_TR.toml b/web/translation/translate.tr_TR.toml index 95d27f2c..319b2a9e 100644 --- a/web/translation/translate.tr_TR.toml +++ b/web/translation/translate.tr_TR.toml @@ -158,6 +158,7 @@ "remark" = "Açıklama" "protocol" = "Protokol" "port" = "Port" +"portMap" = "Port Atama" "traffic" = "Trafik" "details" = "Detaylar" "transportConfig" = "Taşıma" diff --git a/web/translation/translate.uk_UA.toml b/web/translation/translate.uk_UA.toml index 6847b8a0..46edca82 100644 --- a/web/translation/translate.uk_UA.toml +++ b/web/translation/translate.uk_UA.toml @@ -158,6 +158,7 @@ "remark" = "Примітка" "protocol" = "Протокол" "port" = "Порт" +"portMap" = "Порт-перехід" "traffic" = "Трафік" "details" = "Деталі" "transportConfig" = "Транспорт" diff --git a/web/translation/translate.vi_VN.toml b/web/translation/translate.vi_VN.toml index 4c3bd99e..c73dc383 100644 --- a/web/translation/translate.vi_VN.toml +++ b/web/translation/translate.vi_VN.toml @@ -158,6 +158,7 @@ "remark" = "Chú thích" "protocol" = "Giao thức" "port" = "Cổng" +"portMap" = "Cổng tạo" "traffic" = "Lưu lượng" "details" = "Chi tiết" "transportConfig" = "Giao vận" diff --git a/web/translation/translate.zh_CN.toml b/web/translation/translate.zh_CN.toml index 6172c32c..ebe57f64 100644 --- a/web/translation/translate.zh_CN.toml +++ b/web/translation/translate.zh_CN.toml @@ -158,6 +158,7 @@ "remark" = "备注" "protocol" = "协议" "port" = "端口" +"portMap" = "端口映射" "traffic" = "流量" "details" = "详细信息" "transportConfig" = "传输配置" diff --git a/web/translation/translate.zh_TW.toml b/web/translation/translate.zh_TW.toml index beb0c34d..694cd9f3 100644 --- a/web/translation/translate.zh_TW.toml +++ b/web/translation/translate.zh_TW.toml @@ -158,6 +158,7 @@ "remark" = "備註" "protocol" = "協議" "port" = "埠" +"portMap" = "埠映射" "traffic" = "流量" "details" = "詳細資訊" "transportConfig" = "傳輸配置" From baf6fdd29d47913d4d57813e558f0fa10cc24b68 Mon Sep 17 00:00:00 2001 From: Sanaei Date: Mon, 4 Aug 2025 17:16:11 +0200 Subject: [PATCH 06/30] fix portMap json (#3312) Co-authored-by: Alireza Ahmadi --- web/assets/js/model/inbound.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index a2f85194..6d2a77a4 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -2339,7 +2339,7 @@ Inbound.DokodemoSettings = class extends Inbound.Settings { return { address: this.address, port: this.port, - portMap: XrayCommonClass.toV2Headers(this.portMap), + portMap: XrayCommonClass.toV2Headers(this.portMap, false), network: this.network, followRedirect: this.followRedirect, }; From 5e404581161b976f0a3e8db3fe6347d36bcea3a0 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Mon, 4 Aug 2025 18:01:32 +0200 Subject: [PATCH 07/30] fix: simplify error handling --- web/controller/inbound.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/web/controller/inbound.go b/web/controller/inbound.go index a89f224f..851b4b6f 100644 --- a/web/controller/inbound.go +++ b/web/controller/inbound.go @@ -108,8 +108,8 @@ func (a *InboundController) addInbound(c *gin.Context) { jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err) return } - jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundCreateSuccess"), inbound, err) - if err == nil && needRestart { + jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundCreateSuccess"), inbound, nil) + if needRestart { a.xrayService.SetToNeedRestart() } } @@ -126,8 +126,8 @@ func (a *InboundController) delInbound(c *gin.Context) { jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err) return } - jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundDeleteSuccess"), id, err) - if err == nil && needRestart { + jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundDeleteSuccess"), id, nil) + if needRestart { a.xrayService.SetToNeedRestart() } } @@ -152,8 +152,8 @@ func (a *InboundController) updateInbound(c *gin.Context) { jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err) return } - jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundUpdateSuccess"), inbound, err) - if err == nil && needRestart { + jsonMsgObj(c, I18nWeb(c, "pages.inbounds.toasts.inboundUpdateSuccess"), inbound, nil) + if needRestart { a.xrayService.SetToNeedRestart() } } @@ -342,25 +342,25 @@ func (a *InboundController) onlines(c *gin.Context) { func (a *InboundController) updateClientTraffic(c *gin.Context) { email := c.Param("email") - + // Define the request structure for traffic update type TrafficUpdateRequest struct { Upload int64 `json:"upload"` Download int64 `json:"download"` } - + var request TrafficUpdateRequest err := c.ShouldBindJSON(&request) if err != nil { jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundUpdateSuccess"), err) return } - + err = a.inboundService.UpdateClientTrafficByEmail(email, request.Upload, request.Download) if err != nil { jsonMsg(c, I18nWeb(c, "somethingWentWrong"), err) return } - + jsonMsg(c, I18nWeb(c, "pages.inbounds.toasts.inboundClientUpdateSuccess"), nil) } From 05e60af283e4cb0e7c290b1fafd8f3d54028bda8 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Mon, 4 Aug 2025 18:23:37 +0200 Subject: [PATCH 08/30] fix: IPLimitlog display --- web/html/modals/inbound_info_modal.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/html/modals/inbound_info_modal.html b/web/html/modals/inbound_info_modal.html index c9c36398..3807be34 100644 --- a/web/html/modals/inbound_info_modal.html +++ b/web/html/modals/inbound_info_modal.html @@ -199,7 +199,7 @@ [[ infoModal.clientSettings.limitIp ]] - + {{ i18n "pages.inbounds.IPLimitlog" }} [[ infoModal.clientIps ]] From 957f3dbb5449475f330d863171134b56e37da4ad Mon Sep 17 00:00:00 2001 From: fgsfds <4870330+fgsfds@users.noreply.github.com> Date: Mon, 4 Aug 2025 21:47:48 +0500 Subject: [PATCH 09/30] Added xray access log viewer (#3309) * added xray access log viewer * made modal window width adaptive * hide logs button if xray logs are disabled --- web/controller/server.go | 7 +++ web/html/index.html | 114 ++++++++++++++++++++++++++++++++++++++- web/service/server.go | 32 +++++++++++ 3 files changed, 151 insertions(+), 2 deletions(-) diff --git a/web/controller/server.go b/web/controller/server.go index 8a7a2198..dd001f5e 100644 --- a/web/controller/server.go +++ b/web/controller/server.go @@ -46,6 +46,7 @@ func (a *ServerController) initRouter(g *gin.RouterGroup) { g.POST("/installXray/:version", a.installXray) g.POST("/updateGeofile/:fileName", a.updateGeofile) g.POST("/logs/:count", a.getLogs) + g.POST("/xraylogs/:count", a.getXrayLogs) g.POST("/getConfigJson", a.getConfigJson) g.GET("/getDb", a.getDb) g.POST("/importDB", a.importDB) @@ -134,6 +135,12 @@ func (a *ServerController) getLogs(c *gin.Context) { jsonObj(c, logs, nil) } +func (a *ServerController) getXrayLogs(c *gin.Context) { + count := c.Param("count") + logs := a.serverService.GetXrayLogs(count) + jsonObj(c, logs, nil) +} + func (a *ServerController) getConfigJson(c *gin.Context) { configJson, err := a.serverService.GetConfigJson() if err != nil { diff --git a/web/html/index.html b/web/html/index.html index db678cd6..4089e6a6 100644 --- a/web/html/index.html +++ b/web/html/index.html @@ -167,7 +167,10 @@ {{ i18n "pages.index.xrayErrorPopoverTitle" }} - + + + + @@ -179,6 +182,10 @@ @@ -562,9 +562,9 @@ [[ clientEmail ]] - + @@ -576,9 +576,9 @@ [[ clientEmail ]] - + @@ -811,17 +811,6 @@ loading(spinning = true) { this.loadingStates.spinning = spinning; }, - getClientWithComment(email, inboundId) { - const dbInbound = this.dbInbounds.find(inbound => inbound.id === inboundId); - if (!dbInbound) return { email, comment: '' }; - - const inboundSettings = JSON.parse(dbInbound.settings); - if (inboundSettings.clients) { - const client = inboundSettings.clients.find(c => c.email === email); - return client ? { email: client.email, comment: client.comment || '' } : { email, comment: '' }; - } - return { email, comment: '' }; - }, async getDBInbounds() { this.refreshing = true; const msg = await HttpUtil.post('/panel/inbound/list'); @@ -893,7 +882,7 @@ } }, getClientCounts(dbInbound, inbound) { - let clientCount = 0, active = [], deactive = [], depleted = [], expiring = [], online = []; + let clientCount = 0, active = [], deactive = [], depleted = [], expiring = [], online = [], comments = new Map(); clients = inbound.clients; clientStats = dbInbound.clientStats now = new Date().getTime() @@ -901,6 +890,9 @@ clientCount = clients.length; if (dbInbound.enable) { clients.forEach(client => { + if (client.comment) { + comments.set(client.email, client.comment) + } if (client.enable) { active.push(client.email); if (this.isClientOnline(client.email)) online.push(client.email); @@ -929,6 +921,7 @@ depleted: depleted, expiring: expiring, online: online, + comments: comments, }; }, From 4f25eb230edd29fa7bcf8b9bcd02ec3c38cf0a2b Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Wed, 6 Aug 2025 23:35:20 +0200 Subject: [PATCH 17/30] musl: new version --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 222f198a..62196b86 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,7 +48,7 @@ jobs: export GOOS=linux export GOARCH=${{ matrix.platform }} TOOLCHAIN_URL="" - MUSL_CC_HOST="https://github.com/musl-cc/musl.cc/releases/download/v0.0.1" #http://musl.cc + MUSL_CC_HOST="https://download.wireguard.com/qemu-test/toolchains/20240917/" case "${{ matrix.platform }}" in amd64) TOOLCHAIN_URL="$MUSL_CC_HOST/x86_64-linux-musl-cross.tgz" From ae08a29cde7f4125df0480712dcbff316573e787 Mon Sep 17 00:00:00 2001 From: fgsfds <4870330+fgsfds@users.noreply.github.com> Date: Thu, 7 Aug 2025 23:35:11 +0500 Subject: [PATCH 18/30] fix: Xray restarting after being manually stopped (#2896) (#3329) --- web/html/index.html | 3 --- web/job/check_xray_running_job.go | 2 +- web/service/server.go | 1 - web/service/xray.go | 37 ++++++++++++++++++++++++++----- 4 files changed, 33 insertions(+), 10 deletions(-) diff --git a/web/html/index.html b/web/html/index.html index d3155edd..42b8a032 100644 --- a/web/html/index.html +++ b/web/html/index.html @@ -169,9 +169,6 @@ - - - - - - From d064e85ecd127450e77727b2fcc90efc6190a186 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Fri, 8 Aug 2025 18:56:47 +0200 Subject: [PATCH 20/30] update dependencies --- go.mod | 28 +++++++++++++------------- go.sum | 62 ++++++++++++++++++++++++++-------------------------------- 2 files changed, 42 insertions(+), 48 deletions(-) diff --git a/go.mod b/go.mod index 771f1070..592fb627 100644 --- a/go.mod +++ b/go.mod @@ -19,8 +19,8 @@ require ( github.com/xlzd/gotp v0.1.0 github.com/xtls/xray-core v1.250803.0 go.uber.org/atomic v1.11.0 - golang.org/x/crypto v0.40.0 - golang.org/x/text v0.27.0 + golang.org/x/crypto v0.41.0 + golang.org/x/text v0.28.0 google.golang.org/grpc v1.74.2 gorm.io/driver/sqlite v1.6.0 gorm.io/gorm v1.30.1 @@ -31,7 +31,7 @@ require ( github.com/bytedance/sonic v1.14.0 // indirect github.com/bytedance/sonic/loader v0.3.0 // indirect github.com/cloudflare/circl v1.6.1 // indirect - github.com/cloudwego/base64x v0.1.5 // indirect + github.com/cloudwego/base64x v0.1.6 // indirect github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33 // indirect github.com/ebitengine/purego v0.8.4 // indirect github.com/fasthttp/router v1.5.4 // indirect @@ -68,8 +68,8 @@ require ( github.com/refraction-networking/utls v1.8.0 // indirect github.com/riobard/go-bloom v0.0.0-20200614022211-cdc8013cb5b3 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect - github.com/sagernet/sing v0.6.6 // indirect - github.com/sagernet/sing-shadowsocks v0.2.7 // indirect + github.com/sagernet/sing v0.7.5 // indirect + github.com/sagernet/sing-shadowsocks v0.2.8 // indirect github.com/savsgio/gotils v0.0.0-20250408102913-196191ec6287 // indirect github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 // indirect github.com/tklauser/go-sysconf v0.3.15 // indirect @@ -85,18 +85,18 @@ require ( github.com/yusufpapurcu/wmi v1.2.4 // indirect go.uber.org/mock v0.5.2 // indirect go4.org/netipx v0.0.0-20231129151722-fdeea329fbba // indirect - golang.org/x/arch v0.19.0 // indirect - golang.org/x/mod v0.26.0 // indirect - golang.org/x/net v0.42.0 // indirect + golang.org/x/arch v0.20.0 // indirect + golang.org/x/mod v0.27.0 // indirect + golang.org/x/net v0.43.0 // indirect golang.org/x/sync v0.16.0 // indirect - golang.org/x/sys v0.34.0 // indirect + golang.org/x/sys v0.35.0 // indirect golang.org/x/time v0.12.0 // indirect - golang.org/x/tools v0.35.0 // indirect + golang.org/x/tools v0.36.0 // indirect golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 // indirect - golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0 // indirect - google.golang.org/protobuf v1.36.6 // indirect + golang.zx2c4.com/wireguard v0.0.0-20250521234502-f333402bd9cb // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b // indirect + google.golang.org/protobuf v1.36.7 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - gvisor.dev/gvisor v0.0.0-20250428193742-2d800c3129d5 // indirect + gvisor.dev/gvisor v0.0.0-20250503011706-39ed1f5ac29c // indirect lukechampine.com/blake3 v1.4.1 // indirect ) diff --git a/go.sum b/go.sum index 74eee2b8..ec43caa7 100644 --- a/go.sum +++ b/go.sum @@ -4,14 +4,12 @@ github.com/andybalholm/brotli v1.2.0 h1:ukwgCxwYrmACq68yiUqwIWnGY0cTPox/M94sVwTo github.com/andybalholm/brotli v1.2.0/go.mod h1:rzTDkvFWvIrjDXZHkuS16NPggd91W3kUSvPlQ1pLaKY= github.com/bytedance/sonic v1.14.0 h1:/OfKt8HFw0kh2rj8N0F6C/qPGRESq0BbaNZgcNXXzQQ= github.com/bytedance/sonic v1.14.0/go.mod h1:WoEbx8WTcFJfzCe0hbmyTGrfjt8PzNEBdxlNUO24NhA= -github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA= github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= -github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4= -github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= -github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M= +github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -87,10 +85,8 @@ github.com/juju/ratelimit v1.0.2 h1:sRxmtRiajbvrcLQT7S+JbqU0ntsb9W2yhSdNN8tWfaI= github.com/juju/ratelimit v1.0.2/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y= github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= -github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= @@ -138,10 +134,10 @@ github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= -github.com/sagernet/sing v0.6.6 h1:3JkvJ0vqDj/jJcx0a+ve/6lMOrSzZm30I3wrIuZtmRE= -github.com/sagernet/sing v0.6.6/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak= -github.com/sagernet/sing-shadowsocks v0.2.7 h1:zaopR1tbHEw5Nk6FAkM05wCslV6ahVegEZaKMv9ipx8= -github.com/sagernet/sing-shadowsocks v0.2.7/go.mod h1:0rIKJZBR65Qi0zwdKezt4s57y/Tl1ofkaq6NlkzVuyE= +github.com/sagernet/sing v0.7.5 h1:gNMwZCLPqR+4e0g6dwi0sSsrvOmoMjpZgqxKsuJZatc= +github.com/sagernet/sing v0.7.5/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak= +github.com/sagernet/sing-shadowsocks v0.2.8 h1:PURj5PRoAkqeHh2ZW205RWzN9E9RtKCVCzByXruQWfE= +github.com/sagernet/sing-shadowsocks v0.2.8/go.mod h1:lo7TWEMDcN5/h5B8S0ew+r78ZODn6SwVaFhvB6H+PTI= github.com/savsgio/gotils v0.0.0-20250408102913-196191ec6287 h1:qIQ0tWF9vxGtkJa24bR+2i53WBCz1nW/Pc47oVYauC4= github.com/savsgio/gotils v0.0.0-20250408102913-196191ec6287/go.mod h1:sM7Mt7uEoCeFSCBM+qBrqvEo+/9vdmj19wzp3yzUhmg= github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 h1:emzAzMZ1L9iaKCTxdy3Em8Wv4ChIAGnfiz18Cda70g4= @@ -153,7 +149,6 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= @@ -207,14 +202,14 @@ go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko= go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o= go4.org/netipx v0.0.0-20231129151722-fdeea329fbba h1:0b9z3AuHCjxk0x/opv64kcgZLBseWJUpBw5I82+2U4M= go4.org/netipx v0.0.0-20231129151722-fdeea329fbba/go.mod h1:PLyyIXexvUFg3Owu6p/WfdlivPbZJsZdgWZlrGope/Y= -golang.org/x/arch v0.19.0 h1:LmbDQUodHThXE+htjrnmVD73M//D9GTH6wFZjyDkjyU= -golang.org/x/arch v0.19.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= -golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= -golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= -golang.org/x/mod v0.26.0 h1:EGMPT//Ezu+ylkCijjPc+f4Aih7sZvaAr+O3EHBxvZg= -golang.org/x/mod v0.26.0/go.mod h1:/j6NAhSk8iQ723BGAUyoAcn7SlD7s15Dp9Nd/SfeaFQ= -golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= -golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/arch v0.20.0 h1:dx1zTU0MAE98U+TQ8BLl7XsJbgze2WnNKF/8tGp/Q6c= +golang.org/x/arch v0.20.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= +golang.org/x/crypto v0.41.0 h1:WKYxWedPGCTVVl5+WHSSrOBT0O8lx32+zxmHxijgXp4= +golang.org/x/crypto v0.41.0/go.mod h1:pO5AFd7FA68rFak7rOAGVuygIISepHftHnr8dr6+sUc= +golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= +golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= +golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE= +golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg= golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -223,24 +218,24 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= -golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= -golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= -golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI= +golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng= +golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU= golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= -golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0= -golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2 h1:B82qJJgjvYKsXS9jeunTOisW56dUokqW/FOteYJJ/yg= golang.zx2c4.com/wintun v0.0.0-20230126152724-0fa3db229ce2/go.mod h1:deeaetjYA+DHMHg+sMSMI58GrEteJUUzzw7en6TJQcI= -golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173 h1:/jFs0duh4rdb8uIfPMv78iAJGcPKDeqAFnaLBropIC4= -golang.zx2c4.com/wireguard v0.0.0-20231211153847-12269c276173/go.mod h1:tkCQ4FQXmpAgYVh++1cq16/dH4QJtmvpRv19DWGAHSA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0 h1:MAKi5q709QWfnkkpNQ0M12hYJ1+e8qYVDyowc4U1XZM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250728155136-f173205681a0/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= +golang.zx2c4.com/wireguard v0.0.0-20250521234502-f333402bd9cb h1:whnFRlWMcXI9d+ZbWg+4sHnLp52d5yiIPUxMBSt4X9A= +golang.zx2c4.com/wireguard v0.0.0-20250521234502-f333402bd9cb/go.mod h1:rpwXGsirqLqN2L0JDJQlwOboGHmptD5ZD6T2VmcqhTw= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b h1:zPKJod4w6F1+nRGDI9ubnXYhU9NSWoFAijkHkUXeTK8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250804133106-a7a43d27e69b/go.mod h1:qQ0YXyHHx3XkvlzUtpXDkS29lDSafHMZBAZDc03LQ3A= google.golang.org/grpc v1.74.2 h1:WoosgB65DlWVC9FqI82dGsZhWFNBSLjQ84bjROOpMu4= google.golang.org/grpc v1.74.2/go.mod h1:CtQ+BGjaAIXHs/5YS3i473GqwBBa1zGQNevxdeBEXrM= -google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= -google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= +google.golang.org/protobuf v1.36.7 h1:IgrO7UwFQGJdRNXH/sQux4R1Dj1WAKcLElzeeRaXV2A= +google.golang.org/protobuf v1.36.7/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -254,8 +249,7 @@ gorm.io/driver/sqlite v1.6.0 h1:WHRRrIiulaPiPFmDcod6prc4l2VGVWHz80KspNsxSfQ= gorm.io/driver/sqlite v1.6.0/go.mod h1:AO9V1qIQddBESngQUKWL9yoH93HIeA1X6V633rBwyT8= gorm.io/gorm v1.30.1 h1:lSHg33jJTBxs2mgJRfRZeLDG+WZaHYCk3Wtfl6Ngzo4= gorm.io/gorm v1.30.1/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE= -gvisor.dev/gvisor v0.0.0-20250428193742-2d800c3129d5 h1:sfK5nHuG7lRFZ2FdTT3RimOqWBg8IrVm+/Vko1FVOsk= -gvisor.dev/gvisor v0.0.0-20250428193742-2d800c3129d5/go.mod h1:3r5CMtNQMKIvBlrmM9xWUNamjKBYPOWyXOjmg5Kts3g= +gvisor.dev/gvisor v0.0.0-20250503011706-39ed1f5ac29c h1:m/r7OM+Y2Ty1sgBQ7Qb27VgIMBW8ZZhT4gLnUyDIhzI= +gvisor.dev/gvisor v0.0.0-20250503011706-39ed1f5ac29c/go.mod h1:3r5CMtNQMKIvBlrmM9xWUNamjKBYPOWyXOjmg5Kts3g= lukechampine.com/blake3 v1.4.1 h1:I3Smz7gso8w4/TunLKec6K2fn+kyKtDxr/xcQEN84Wg= lukechampine.com/blake3 v1.4.1/go.mod h1:QFosUxmjB8mnrWFSNwKmvxHpfY72bmD2tQ0kBMM3kwo= -nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= From 5ea6386815725e66fc5f831914a5630afa7bd6b6 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Fri, 8 Aug 2025 19:55:24 +0200 Subject: [PATCH 21/30] better musl libc usage Co-Authored-By: Alireza Ahmadi --- .github/workflows/release.yml | 62 +++++++++++++---------------------- 1 file changed, 23 insertions(+), 39 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 62196b86..358e9029 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,7 @@ on: branches: - main paths: + - '.github/workflows/release.yml' - '**.js' - '**.css' - '**.html' @@ -42,51 +43,34 @@ jobs: go-version-file: go.mod check-latest: true - - name: Build 3x-ui + - name: Build 3X-UI run: | export CGO_ENABLED=1 export GOOS=linux export GOARCH=${{ matrix.platform }} - TOOLCHAIN_URL="" - MUSL_CC_HOST="https://download.wireguard.com/qemu-test/toolchains/20240917/" + # Use Bootlin prebuilt cross-toolchains (musl 1.2.5 in stable series) case "${{ matrix.platform }}" in - amd64) - TOOLCHAIN_URL="$MUSL_CC_HOST/x86_64-linux-musl-cross.tgz" - ;; - arm64) - TOOLCHAIN_URL="$MUSL_CC_HOST/aarch64-linux-musl-cross.tgz" - ;; - armv7) - TOOLCHAIN_URL="$MUSL_CC_HOST/armv7l-linux-musleabihf-cross.tgz" - export GOARCH=arm - export GOARM=7 - ;; - armv6) - TOOLCHAIN_URL="$MUSL_CC_HOST/armv6-linux-musleabihf-cross.tgz" - export GOARCH=arm - export GOARM=6 - ;; - armv5) - TOOLCHAIN_URL="$MUSL_CC_HOST/arm-linux-musleabi-cross.tgz" - export GOARCH=arm - export GOARM=5 - ;; - 386) - TOOLCHAIN_URL="$MUSL_CC_HOST/i686-linux-musl-cross.tgz" - ;; - s390x) - TOOLCHAIN_URL="$MUSL_CC_HOST/s390x-linux-musl-cross.tgz" - ;; + amd64) BOOTLIN_ARCH="x86-64" ;; + arm64) BOOTLIN_ARCH="aarch64" ;; + armv7) BOOTLIN_ARCH="armv7-eabihf"; export GOARCH=arm GOARM=7 ;; + armv6) BOOTLIN_ARCH="armv6-eabihf"; export GOARCH=arm GOARM=6 ;; + armv5) BOOTLIN_ARCH="armv5-eabi"; export GOARCH=arm GOARM=5 ;; + 386) BOOTLIN_ARCH="x86-i686" ;; + s390x) BOOTLIN_ARCH="s390x-z13" ;; esac - echo "Downloading musl toolchain for ${{ matrix.platform }}" - curl -LO "$TOOLCHAIN_URL" - tar -xf *.tgz - TOOLCHAIN_DIR=$(find . -maxdepth 1 -type d -name "*-cross" | head -n1) - TOOLCHAIN_DIR=$(realpath "$TOOLCHAIN_DIR") - export PATH="$TOOLCHAIN_DIR/bin:$PATH" - # Detect compiler - export CC=$(find $TOOLCHAIN_DIR/bin -name '*-gcc' | head -n1) - echo "Using CC=$CC" + echo "Resolving Bootlin musl toolchain for arch=$BOOTLIN_ARCH (platform=${{ matrix.platform }})" + TARBALL_BASE="https://toolchains.bootlin.com/downloads/releases/toolchains/$BOOTLIN_ARCH/tarballs/" + TARBALL_URL=$(curl -fsSL "$TARBALL_BASE" | grep -oE "${BOOTLIN_ARCH}--musl--stable-[^\"]+\\.tar\\.xz" | sort -r | head -n1) + [ -z "$TARBALL_URL" ] && { echo "Failed to locate Bootlin musl toolchain for arch=$BOOTLIN_ARCH" >&2; exit 1; } + echo "Downloading: $TARBALL_URL" + cd /tmp + curl -fL -sS -o "$(basename "$TARBALL_URL")" "$TARBALL_BASE/$TARBALL_URL" + tar -xf "$(basename "$TARBALL_URL")" + TOOLCHAIN_DIR=$(find . -maxdepth 1 -type d -name "${BOOTLIN_ARCH}--musl--stable-*" | head -n1) + export PATH="$(realpath "$TOOLCHAIN_DIR")/bin:$PATH" + export CC=$(realpath "$(find "$TOOLCHAIN_DIR/bin" -name '*-gcc.br_real' -type f -executable | head -n1)") + [ -z "$CC" ] && { echo "No gcc.br_real found in $TOOLCHAIN_DIR/bin" >&2; exit 1; } + cd - go build -ldflags "-w -s -linkmode external -extldflags '-static'" -o xui-release -v main.go file xui-release ldd xui-release || echo "Static binary confirmed" From 825d93d95feae6939b82550a1b6e2dcb46bec614 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Fri, 8 Aug 2025 20:41:06 +0200 Subject: [PATCH 22/30] upgrade telego (#3334) --- go.mod | 4 +-- go.sum | 8 ++---- web/service/tgbot.go | 62 +++++++++++++++++++++++--------------------- 3 files changed, 36 insertions(+), 38 deletions(-) diff --git a/go.mod b/go.mod index 592fb627..32b6856c 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/goccy/go-json v0.10.5 github.com/google/uuid v1.6.0 github.com/joho/godotenv v1.5.1 - github.com/mymmrac/telego v0.32.0 + github.com/mymmrac/telego v1.2.0 github.com/nicksnyder/go-i18n/v2 v2.6.0 github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 github.com/pelletier/go-toml/v2 v2.2.4 @@ -34,7 +34,6 @@ require ( github.com/cloudwego/base64x v0.1.6 // indirect github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33 // indirect github.com/ebitengine/purego v0.8.4 // indirect - github.com/fasthttp/router v1.5.4 // indirect github.com/gabriel-vasile/mimetype v1.4.9 // indirect github.com/gin-contrib/sse v1.1.0 // indirect github.com/go-ole/go-ole v1.3.0 // indirect @@ -70,7 +69,6 @@ require ( github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/sagernet/sing v0.7.5 // indirect github.com/sagernet/sing-shadowsocks v0.2.8 // indirect - github.com/savsgio/gotils v0.0.0-20250408102913-196191ec6287 // indirect github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 // indirect github.com/tklauser/go-sysconf v0.3.15 // indirect github.com/tklauser/numcpus v0.10.0 // indirect diff --git a/go.sum b/go.sum index ec43caa7..f11a3071 100644 --- a/go.sum +++ b/go.sum @@ -19,8 +19,6 @@ github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33 h1:ucRHb6/lvW/+mT github.com/dgryski/go-metro v0.0.0-20250106013310-edb8663e5e33/go.mod h1:c9O8+fpSOX1DM8cPNSkX/qsBWdkD4yd2dpciOWQjpBw= github.com/ebitengine/purego v0.8.4 h1:CF7LEKg5FFOsASUj0+QwaXf8Ht6TlFxg09+S9wz0omw= github.com/ebitengine/purego v0.8.4/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= -github.com/fasthttp/router v1.5.4 h1:oxdThbBwQgsDIYZ3wR1IavsNl6ZS9WdjKukeMikOnC8= -github.com/fasthttp/router v1.5.4/go.mod h1:3/hysWq6cky7dTfzaaEPZGdptwjwx0qzTgFCKEWRjgc= github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY= github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok= github.com/ghodss/yaml v1.0.1-0.20220118164431-d8423dcdf344 h1:Arcl6UOIS/kgO2nW3A65HN+7CMjSDP/gofXL4CZt1V4= @@ -106,8 +104,8 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/mymmrac/telego v0.32.0 h1:4X8C1l3k+opkk86r95+eQE8DxiS2LYlR61L/G7yreDY= -github.com/mymmrac/telego v0.32.0/go.mod h1:qS6NaRhJgcuEEBEMVCV79S2xCAuHq9O+ixwfLuRW31M= +github.com/mymmrac/telego v1.2.0 h1:CHmR9eiugpTiF/ttppmK89E6mcu9d4DmNQS0tMpUs6M= +github.com/mymmrac/telego v1.2.0/go.mod h1:OiCm4QjqB/ZY2E4VAmkVH8EeLLhM4QuFuO1KOCuvGoM= github.com/nicksnyder/go-i18n/v2 v2.6.0 h1:C/m2NNWNiTB6SK4Ao8df5EWm3JETSTIGNXBpMJTxzxQ= github.com/nicksnyder/go-i18n/v2 v2.6.0/go.mod h1:88sRqr0C6OPyJn0/KRNaEz1uWorjxIKP7rUUcvycecE= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7 h1:lDH9UUVJtmYCjyT0CI4q8xvlXPxeZ0gYCVvWbmPlp88= @@ -138,8 +136,6 @@ github.com/sagernet/sing v0.7.5 h1:gNMwZCLPqR+4e0g6dwi0sSsrvOmoMjpZgqxKsuJZatc= github.com/sagernet/sing v0.7.5/go.mod h1:ARkL0gM13/Iv5VCZmci/NuoOlePoIsW0m7BWfln/Hak= github.com/sagernet/sing-shadowsocks v0.2.8 h1:PURj5PRoAkqeHh2ZW205RWzN9E9RtKCVCzByXruQWfE= github.com/sagernet/sing-shadowsocks v0.2.8/go.mod h1:lo7TWEMDcN5/h5B8S0ew+r78ZODn6SwVaFhvB6H+PTI= -github.com/savsgio/gotils v0.0.0-20250408102913-196191ec6287 h1:qIQ0tWF9vxGtkJa24bR+2i53WBCz1nW/Pc47oVYauC4= -github.com/savsgio/gotils v0.0.0-20250408102913-196191ec6287/go.mod h1:sM7Mt7uEoCeFSCBM+qBrqvEo+/9vdmj19wzp3yzUhmg= github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771 h1:emzAzMZ1L9iaKCTxdy3Em8Wv4ChIAGnfiz18Cda70g4= github.com/seiflotfy/cuckoofilter v0.0.0-20240715131351-a2f2c23f1771/go.mod h1:bR6DqgcAl1zTcOX8/pE2Qkj9XO00eCNqmKb7lXP8EAg= github.com/shirou/gopsutil/v4 v4.25.7 h1:bNb2JuqKuAu3tRlPv5piSmBZyMfecwQ+t/ILq+1JqVM= diff --git a/web/service/tgbot.go b/web/service/tgbot.go index ffdb63f9..301f64fd 100644 --- a/web/service/tgbot.go +++ b/web/service/tgbot.go @@ -1,6 +1,7 @@ package service import ( + "context" "crypto/rand" "embed" "encoding/base64" @@ -148,7 +149,7 @@ func (t *Tgbot) Start(i18nFS embed.FS) error { } // After bot initialization, set up bot commands with localized descriptions - err = bot.SetMyCommands(&telego.SetMyCommandsParams{ + err = bot.SetMyCommands(context.Background(), &telego.SetMyCommandsParams{ Commands: []telego.BotCommand{ {Command: "start", Description: t.I18nBot("tgbot.commands.startDesc")}, {Command: "help", Description: t.I18nBot("tgbot.commands.helpDesc")}, @@ -221,8 +222,9 @@ func (t *Tgbot) SetHostname() { } func (t *Tgbot) Stop() { - botHandler.Stop() - bot.StopLongPolling() + if botHandler != nil { + botHandler.Stop() + } logger.Info("Stop Telegram receiver ...") isRunning = false adminIds = nil @@ -255,26 +257,29 @@ func (t *Tgbot) OnReceive() { Timeout: 10, } - updates, _ := bot.UpdatesViaLongPolling(¶ms) + updates, _ := bot.UpdatesViaLongPolling(context.Background(), ¶ms) botHandler, _ = th.NewBotHandler(bot, updates) - botHandler.HandleMessage(func(_ *telego.Bot, message telego.Message) { + botHandler.HandleMessage(func(ctx *th.Context, message telego.Message) error { delete(userStates, message.Chat.ID) t.SendMsgToTgbot(message.Chat.ID, t.I18nBot("tgbot.keyboardClosed"), tu.ReplyKeyboardRemove()) + return nil }, th.TextEqual(t.I18nBot("tgbot.buttons.closeKeyboard"))) - botHandler.HandleMessage(func(_ *telego.Bot, message telego.Message) { + botHandler.HandleMessage(func(ctx *th.Context, message telego.Message) error { delete(userStates, message.Chat.ID) t.answerCommand(&message, message.Chat.ID, checkAdmin(message.From.ID)) + return nil }, th.AnyCommand()) - botHandler.HandleCallbackQuery(func(_ *telego.Bot, query telego.CallbackQuery) { + botHandler.HandleCallbackQuery(func(ctx *th.Context, query telego.CallbackQuery) error { delete(userStates, query.Message.GetChat().ID) t.answerCallback(&query, checkAdmin(query.From.ID)) + return nil }, th.AnyCallbackQueryWithMessage()) - botHandler.HandleMessage(func(_ *telego.Bot, message telego.Message) { + botHandler.HandleMessage(func(ctx *th.Context, message telego.Message) error { if userState, exists := userStates[message.Chat.ID]; exists { switch userState { case "awaiting_id": @@ -284,7 +289,7 @@ func (t *Tgbot) OnReceive() { inbound, _ := t.inboundService.GetInbound(receiver_inbound_ID) message_text, _ := t.BuildInboundClientDataMessage(inbound.Remark, inbound.Protocol) t.addClient(message.Chat.ID, message_text) - return + return nil } client_Id = strings.TrimSpace(message.Text) @@ -309,7 +314,7 @@ func (t *Tgbot) OnReceive() { if client_TrPassword == strings.TrimSpace(message.Text) { t.SendMsgToTgbotDeleteAfter(message.Chat.ID, t.I18nBot("tgbot.messages.using_default_value"), 3, tu.ReplyKeyboardRemove()) delete(userStates, message.Chat.ID) - return + return nil } client_TrPassword = strings.TrimSpace(message.Text) @@ -334,7 +339,7 @@ func (t *Tgbot) OnReceive() { if client_ShPassword == strings.TrimSpace(message.Text) { t.SendMsgToTgbotDeleteAfter(message.Chat.ID, t.I18nBot("tgbot.messages.using_default_value"), 3, tu.ReplyKeyboardRemove()) delete(userStates, message.Chat.ID) - return + return nil } client_ShPassword = strings.TrimSpace(message.Text) @@ -359,7 +364,7 @@ func (t *Tgbot) OnReceive() { if client_Email == strings.TrimSpace(message.Text) { t.SendMsgToTgbotDeleteAfter(message.Chat.ID, t.I18nBot("tgbot.messages.using_default_value"), 3, tu.ReplyKeyboardRemove()) delete(userStates, message.Chat.ID) - return + return nil } client_Email = strings.TrimSpace(message.Text) @@ -384,7 +389,7 @@ func (t *Tgbot) OnReceive() { if client_Comment == strings.TrimSpace(message.Text) { t.SendMsgToTgbotDeleteAfter(message.Chat.ID, t.I18nBot("tgbot.messages.using_default_value"), 3, tu.ReplyKeyboardRemove()) delete(userStates, message.Chat.ID) - return + return nil } client_Comment = strings.TrimSpace(message.Text) @@ -417,6 +422,7 @@ func (t *Tgbot) OnReceive() { } } } + return nil }, th.AnyMessage()) botHandler.Start() @@ -699,7 +705,7 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool } message_text, err := t.BuildInboundClientDataMessage(inbound.Remark, inbound.Protocol) - t.addClient(chatId, message_text, messageId) + t.addClient(callbackQuery.Message.GetChat().ID, message_text, messageId) t.sendCallbackAnswerTgBot(callbackQuery.ID, t.I18nBot("tgbot.answers.successfulOperation")) case "add_client_limit_traffic_in": if len(dataArray) >= 2 { @@ -914,7 +920,7 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool } message_text, err := t.BuildInboundClientDataMessage(inbound.Remark, inbound.Protocol) - t.addClient(chatId, message_text, messageId) + t.addClient(callbackQuery.Message.GetChat().ID, message_text, messageId) t.sendCallbackAnswerTgBot(callbackQuery.ID, t.I18nBot("tgbot.answers.successfulOperation")) case "add_client_reset_exp_in": if len(dataArray) >= 2 { @@ -1096,7 +1102,7 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool } message_text, err := t.BuildInboundClientDataMessage(inbound.Remark, inbound.Protocol) - t.addClient(chatId, message_text, messageId) + t.addClient(callbackQuery.Message.GetChat().ID, message_text, messageId) t.sendCallbackAnswerTgBot(callbackQuery.ID, t.I18nBot("tgbot.answers.successfulOperation")) case "add_client_ip_limit_in": if len(dataArray) >= 2 { @@ -1157,8 +1163,6 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool return } } - t.sendCallbackAnswerTgBot(callbackQuery.ID, t.I18nBot("tgbot.answers.errorOperation")) - t.searchClient(chatId, email, callbackQuery.Message.GetMessageID()) case "clear_ips": inlineKeyboard := tu.InlineKeyboard( tu.InlineKeyboardRow( @@ -1285,7 +1289,7 @@ func (t *Tgbot) answerCallback(callbackQuery *telego.CallbackQuery, isAdmin bool message_text, err := t.BuildInboundClientDataMessage(inbound.Remark, inbound.Protocol) - t.addClient(chatId, message_text) + t.addClient(callbackQuery.Message.GetChat().ID, message_text) } return } else { @@ -1859,7 +1863,7 @@ func (t *Tgbot) SendMsgToTgbot(chatId int64, msg string, replyMarkup ...telego.R if len(replyMarkup) > 0 && n == (len(allMessages)-1) { params.ReplyMarkup = replyMarkup[0] } - _, err := bot.SendMessage(¶ms) + _, err := bot.SendMessage(context.Background(), ¶ms) if err != nil { logger.Warning("Error sending telegram message :", err) } @@ -2765,7 +2769,7 @@ func (t *Tgbot) sendBackup(chatId int64) { tu.ID(chatId), tu.File(file), ) - _, err = bot.SendDocument(document) + _, err = bot.SendDocument(context.Background(), document) if err != nil { logger.Error("Error in uploading backup: ", err) } @@ -2779,7 +2783,7 @@ func (t *Tgbot) sendBackup(chatId int64) { tu.ID(chatId), tu.File(file), ) - _, err = bot.SendDocument(document) + _, err = bot.SendDocument(context.Background(), document) if err != nil { logger.Error("Error in uploading config.json: ", err) } @@ -2803,7 +2807,7 @@ func (t *Tgbot) sendBanLogs(chatId int64, dt bool) { tu.ID(chatId), tu.File(file), ) - _, err = bot.SendDocument(document) + _, err = bot.SendDocument(context.Background(), document) if err != nil { logger.Error("Error in uploading IPLimitBannedPrevLog: ", err) } @@ -2824,7 +2828,7 @@ func (t *Tgbot) sendBanLogs(chatId int64, dt bool) { tu.ID(chatId), tu.File(file), ) - _, err = bot.SendDocument(document) + _, err = bot.SendDocument(context.Background(), document) if err != nil { logger.Error("Error in uploading IPLimitBannedLog: ", err) } @@ -2842,7 +2846,7 @@ func (t *Tgbot) sendCallbackAnswerTgBot(id string, message string) { CallbackQueryID: id, Text: message, } - if err := bot.AnswerCallbackQuery(¶ms); err != nil { + if err := bot.AnswerCallbackQuery(context.Background(), ¶ms); err != nil { logger.Warning(err) } } @@ -2853,7 +2857,7 @@ func (t *Tgbot) editMessageCallbackTgBot(chatId int64, messageID int, inlineKeyb MessageID: messageID, ReplyMarkup: inlineKeyboard, } - if _, err := bot.EditMessageReplyMarkup(¶ms); err != nil { + if _, err := bot.EditMessageReplyMarkup(context.Background(), ¶ms); err != nil { logger.Warning(err) } } @@ -2868,7 +2872,7 @@ func (t *Tgbot) editMessageTgBot(chatId int64, messageID int, text string, inlin if len(inlineKeyboard) > 0 { params.ReplyMarkup = inlineKeyboard[0] } - if _, err := bot.EditMessageText(¶ms); err != nil { + if _, err := bot.EditMessageText(context.Background(), ¶ms); err != nil { logger.Warning(err) } } @@ -2881,7 +2885,7 @@ func (t *Tgbot) SendMsgToTgbotDeleteAfter(chatId int64, msg string, delayInSecon } // Send the message - sentMsg, err := bot.SendMessage(&telego.SendMessageParams{ + sentMsg, err := bot.SendMessage(context.Background(), &telego.SendMessageParams{ ChatID: tu.ID(chatId), Text: msg, ReplyMarkup: replyMarkupParam, // Use the correct replyMarkup value @@ -2904,7 +2908,7 @@ func (t *Tgbot) deleteMessageTgBot(chatId int64, messageID int) { ChatID: tu.ID(chatId), MessageID: messageID, } - if err := bot.DeleteMessage(¶ms); err != nil { + if err := bot.DeleteMessage(context.Background(), ¶ms); err != nil { logger.Warning("Failed to delete message:", err) } else { logger.Info("Message deleted successfully") From 4d02756e1e251bc555263bebfe319139278bfb37 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Fri, 8 Aug 2025 20:52:04 +0200 Subject: [PATCH 23/30] v2.6.6 --- config/version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/version b/config/version index 68167133..952f449f 100644 --- a/config/version +++ b/config/version @@ -1 +1 @@ -2.6.5 \ No newline at end of file +2.6.6 \ No newline at end of file From aa285914fac42c8f4be0971ad6c5ad2fdf31057c Mon Sep 17 00:00:00 2001 From: g0l4 <153604763+g0l4@users.noreply.github.com> Date: Sat, 9 Aug 2025 14:18:56 +0800 Subject: [PATCH 24/30] chore: update polygon token name (#3338) --- README.ar_EG.md | 2 +- README.es_ES.md | 2 +- README.fa_IR.md | 2 +- README.md | 2 +- README.ru_RU.md | 2 +- README.zh_CN.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.ar_EG.md b/README.ar_EG.md index d2f6dcc3..e6a0c69c 100644 --- a/README.ar_EG.md +++ b/README.ar_EG.md @@ -48,7 +48,7 @@ bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.

- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC` -- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A` +- POL (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A` - LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv` ## النجوم عبر الزمن diff --git a/README.es_ES.md b/README.es_ES.md index 52625664..4ce65ca8 100644 --- a/README.es_ES.md +++ b/README.es_ES.md @@ -48,7 +48,7 @@ Para documentación completa, visita la [Wiki del proyecto](https://github.com/M

- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC` -- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A` +- POL (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A` - LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv` ## Estrellas a lo Largo del Tiempo diff --git a/README.fa_IR.md b/README.fa_IR.md index 2b2dc5ec..19790945 100644 --- a/README.fa_IR.md +++ b/README.fa_IR.md @@ -48,7 +48,7 @@ bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.

- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC` -- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A` +- POL (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A` - LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv` ## ستاره‌ها در طول زمان diff --git a/README.md b/README.md index 7cda8370..e73859ec 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ For full documentation, please visit the [project Wiki](https://github.com/MHSan

- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC` -- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A` +- POL (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A` - LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv` ## Stargazers over Time diff --git a/README.ru_RU.md b/README.ru_RU.md index d971f403..48713183 100644 --- a/README.ru_RU.md +++ b/README.ru_RU.md @@ -48,7 +48,7 @@ bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.

- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC` -- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A` +- POL (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A` - LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv` ## Звезды с течением времени diff --git a/README.zh_CN.md b/README.zh_CN.md index 75e75603..322a4b78 100644 --- a/README.zh_CN.md +++ b/README.zh_CN.md @@ -48,7 +48,7 @@ bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.

- USDT (TRC20): `TXncxkvhkDWGts487Pjqq1qT9JmwRUz8CC` -- MATIC (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A` +- POL (polygon): `0x41C9548675D044c6Bfb425786C765bc37427256A` - LTC (Litecoin): `ltc1q2ach7x6d2zq0n4l0t4zl7d7xe2s6fs7a3vspwv` ## 随时间变化的星标数 From ad5f774a1e1c27fb39b2f5c7c2d8fe356bbec530 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Sat, 9 Aug 2025 13:46:28 +0200 Subject: [PATCH 25/30] Axios v1.11.0 --- web/assets/axios/axios.min.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/assets/axios/axios.min.js b/web/assets/axios/axios.min.js index 7cf57dac..dd73df5c 100644 --- a/web/assets/axios/axios.min.js +++ b/web/assets/axios/axios.min.js @@ -1,3 +1,3 @@ -/*! Axios v1.8.2 Copyright (c) 2025 Matt Zabriskie and contributors */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).axios=t()}(this,(function(){"use strict";function e(e){var r,n;function o(r,n){try{var a=e[r](n),s=a.value,u=s instanceof t;Promise.resolve(u?s.v:s).then((function(t){if(u){var n="return"===r?"return":"next";if(!s.k||t.done)return o(n,t);t=e[n](t).value}i(a.done?"return":"normal",t)}),(function(e){o("throw",e)}))}catch(e){i("throw",e)}}function i(e,t){switch(e){case"return":r.resolve({value:t,done:!0});break;case"throw":r.reject(t);break;default:r.resolve({value:t,done:!1})}(r=r.next)?o(r.key,r.arg):n=null}this._invoke=function(e,t){return new Promise((function(i,a){var s={key:e,arg:t,resolve:i,reject:a,next:null};n?n=n.next=s:(r=n=s,o(e,t))}))},"function"!=typeof e.return&&(this.return=void 0)}function t(e,t){this.v=e,this.k=t}function r(e){var r={},n=!1;function o(r,o){return n=!0,o=new Promise((function(t){t(e[r](o))})),{done:!1,value:new t(o,1)}}return r["undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator"]=function(){return this},r.next=function(e){return n?(n=!1,e):o("next",e)},"function"==typeof e.throw&&(r.throw=function(e){if(n)throw n=!1,e;return o("throw",e)}),"function"==typeof e.return&&(r.return=function(e){return n?(n=!1,e):o("return",e)}),r}function n(e){var t,r,n,i=2;for("undefined"!=typeof Symbol&&(r=Symbol.asyncIterator,n=Symbol.iterator);i--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new o(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function o(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return o=function(e){this.s=e,this.n=e.next},o.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?Promise.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Promise.reject(e):t(r.apply(this.s,arguments))}},new o(e)}function i(e){return new t(e,0)}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t=0;--i){var a=this.tryEntries[i],s=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(u&&c){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function l(t){return function(){return new e(t.apply(this,arguments))}}function p(e,t,r,n,o,i,a){try{var s=e[i](a),u=s.value}catch(e){return void r(e)}s.done?t(u):Promise.resolve(u).then(n,o)}function h(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){p(i,n,o,a,s,"next",e)}function s(e){p(i,n,o,a,s,"throw",e)}a(void 0)}))}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&void 0!==arguments[2]?arguments[2]:{},i=o.allOwnKeys,a=void 0!==i&&i;if(null!=e)if("object"!==f(e)&&(e=[e]),N(e))for(r=0,n=e.length;r0;)if(t===(r=n[o]).toLowerCase())return r;return null}var Q="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Z=function(e){return!_(e)&&e!==Q};var ee,te=(ee="undefined"!=typeof Uint8Array&&j(Uint8Array),function(e){return ee&&e instanceof ee}),re=P("HTMLFormElement"),ne=function(e){var t=Object.prototype.hasOwnProperty;return function(e,r){return t.call(e,r)}}(),oe=P("RegExp"),ie=function(e,t){var r=Object.getOwnPropertyDescriptors(e),n={};$(r,(function(r,o){var i;!1!==(i=t(r,o,e))&&(n[o]=i||r)})),Object.defineProperties(e,n)};var ae,se,ue,ce,fe=P("AsyncFunction"),le=(ae="function"==typeof setImmediate,se=F(Q.postMessage),ae?setImmediate:se?(ue="axios@".concat(Math.random()),ce=[],Q.addEventListener("message",(function(e){var t=e.source,r=e.data;t===Q&&r===ue&&ce.length&&ce.shift()()}),!1),function(e){ce.push(e),Q.postMessage(ue,"*")}):function(e){return setTimeout(e)}),pe="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Q):"undefined"!=typeof process&&process.nextTick||le,he={isArray:N,isArrayBuffer:C,isBuffer:function(e){return null!==e&&!_(e)&&null!==e.constructor&&!_(e.constructor)&&F(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:function(e){var t;return e&&("function"==typeof FormData&&e instanceof FormData||F(e.append)&&("formdata"===(t=A(e))||"object"===t&&F(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&C(e.buffer)},isString:U,isNumber:B,isBoolean:function(e){return!0===e||!1===e},isObject:D,isPlainObject:q,isReadableStream:K,isRequest:V,isResponse:G,isHeaders:X,isUndefined:_,isDate:I,isFile:M,isBlob:z,isRegExp:oe,isFunction:F,isStream:function(e){return D(e)&&F(e.pipe)},isURLSearchParams:J,isTypedArray:te,isFileList:H,forEach:$,merge:function e(){for(var t=Z(this)&&this||{},r=t.caseless,n={},o=function(t,o){var i=r&&Y(n,o)||o;q(n[i])&&q(t)?n[i]=e(n[i],t):q(t)?n[i]=e({},t):N(t)?n[i]=t.slice():n[i]=t},i=0,a=arguments.length;i3&&void 0!==arguments[3]?arguments[3]:{},o=n.allOwnKeys;return $(t,(function(t,n){r&&F(t)?e[n]=R(t,r):e[n]=t}),{allOwnKeys:o}),e},trim:function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,r,n){e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:function(e,t,r,n){var o,i,a,s={};if(t=t||{},null==e)return t;do{for(i=(o=Object.getOwnPropertyNames(e)).length;i-- >0;)a=o[i],n&&!n(a,e,t)||s[a]||(t[a]=e[a],s[a]=!0);e=!1!==r&&j(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:A,kindOfTest:P,endsWith:function(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var n=e.indexOf(t,r);return-1!==n&&n===r},toArray:function(e){if(!e)return null;if(N(e))return e;var t=e.length;if(!B(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},forEachEntry:function(e,t){for(var r,n=(e&&e[Symbol.iterator]).call(e);(r=n.next())&&!r.done;){var o=r.value;t.call(e,o[0],o[1])}},matchAll:function(e,t){for(var r,n=[];null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:re,hasOwnProperty:ne,hasOwnProp:ne,reduceDescriptors:ie,freezeMethods:function(e){ie(e,(function(t,r){if(F(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;var n=e[r];F(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=function(){throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:function(e,t){var r={},n=function(e){e.forEach((function(e){r[e]=!0}))};return N(e)?n(e):n(String(e).split(t)),r},toCamelCase:function(e){return e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r}))},noop:function(){},toFiniteNumber:function(e,t){return null!=e&&Number.isFinite(e=+e)?e:t},findKey:Y,global:Q,isContextDefined:Z,isSpecCompliantForm:function(e){return!!(e&&F(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:function(e){var t=new Array(10);return function e(r,n){if(D(r)){if(t.indexOf(r)>=0)return;if(!("toJSON"in r)){t[n]=r;var o=N(r)?[]:{};return $(r,(function(t,r){var i=e(t,n+1);!_(i)&&(o[r]=i)})),t[n]=void 0,o}}return r}(e,0)},isAsyncFn:fe,isThenable:function(e){return e&&(D(e)||F(e))&&F(e.then)&&F(e.catch)},setImmediate:le,asap:pe};function de(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}he.inherits(de,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:he.toJSONObject(this.config),code:this.code,status:this.status}}});var ve=de.prototype,ye={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((function(e){ye[e]={value:e}})),Object.defineProperties(de,ye),Object.defineProperty(ve,"isAxiosError",{value:!0}),de.from=function(e,t,r,n,o,i){var a=Object.create(ve);return he.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(function(e){return"isAxiosError"!==e})),de.call(a,e.message,t,r,n,o),a.cause=e,a.name=e.name,i&&Object.assign(a,i),a};function me(e){return he.isPlainObject(e)||he.isArray(e)}function be(e){return he.endsWith(e,"[]")?e.slice(0,-2):e}function ge(e,t,r){return e?e.concat(t).map((function(e,t){return e=be(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}var we=he.toFlatObject(he,{},null,(function(e){return/^is[A-Z]/.test(e)}));function Ee(e,t,r){if(!he.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;var n=(r=he.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!he.isUndefined(t[e])}))).metaTokens,o=r.visitor||c,i=r.dots,a=r.indexes,s=(r.Blob||"undefined"!=typeof Blob&&Blob)&&he.isSpecCompliantForm(t);if(!he.isFunction(o))throw new TypeError("visitor must be a function");function u(e){if(null===e)return"";if(he.isDate(e))return e.toISOString();if(!s&&he.isBlob(e))throw new de("Blob is not supported. Use a Buffer instead.");return he.isArrayBuffer(e)||he.isTypedArray(e)?s&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,o){var s=e;if(e&&!o&&"object"===f(e))if(he.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(he.isArray(e)&&function(e){return he.isArray(e)&&!e.some(me)}(e)||(he.isFileList(e)||he.endsWith(r,"[]"))&&(s=he.toArray(e)))return r=be(r),s.forEach((function(e,n){!he.isUndefined(e)&&null!==e&&t.append(!0===a?ge([r],n,i):null===a?r:r+"[]",u(e))})),!1;return!!me(e)||(t.append(ge(o,r,i),u(e)),!1)}var l=[],p=Object.assign(we,{defaultVisitor:c,convertValue:u,isVisitable:me});if(!he.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!he.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),he.forEach(r,(function(r,i){!0===(!(he.isUndefined(r)||null===r)&&o.call(t,r,he.isString(i)?i.trim():i,n,p))&&e(r,n?n.concat(i):[i])})),l.pop()}}(e),t}function Oe(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Se(e,t){this._pairs=[],e&&Ee(e,this,t)}var xe=Se.prototype;function Re(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ke(e,t,r){if(!t)return e;var n=r&&r.encode||Re;he.isFunction(r)&&(r={serialize:r});var o,i=r&&r.serialize;if(o=i?i(t,r):he.isURLSearchParams(t)?t.toString():new Se(t,r).toString(n)){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}xe.append=function(e,t){this._pairs.push([e,t])},xe.toString=function(e){var t=e?function(t){return e.call(this,t,Oe)}:Oe;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Te=function(){function e(){d(this,e),this.handlers=[]}return y(e,[{key:"use",value:function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}},{key:"eject",value:function(e){this.handlers[e]&&(this.handlers[e]=null)}},{key:"clear",value:function(){this.handlers&&(this.handlers=[])}},{key:"forEach",value:function(e){he.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}]),e}(),je={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ae={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Se,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},Pe="undefined"!=typeof window&&"undefined"!=typeof document,Le="object"===("undefined"==typeof navigator?"undefined":f(navigator))&&navigator||void 0,Ne=Pe&&(!Le||["ReactNative","NativeScript","NS"].indexOf(Le.product)<0),_e="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Ce=Pe&&window.location.href||"http://localhost",Ue=s(s({},Object.freeze({__proto__:null,hasBrowserEnv:Pe,hasStandardBrowserWebWorkerEnv:_e,hasStandardBrowserEnv:Ne,navigator:Le,origin:Ce})),Ae);function Fe(e){function t(e,r,n,o){var i=e[o++];if("__proto__"===i)return!0;var a=Number.isFinite(+i),s=o>=e.length;return i=!i&&he.isArray(n)?n.length:i,s?(he.hasOwnProp(n,i)?n[i]=[n[i],r]:n[i]=r,!a):(n[i]&&he.isObject(n[i])||(n[i]=[]),t(e,r,n[i],o)&&he.isArray(n[i])&&(n[i]=function(e){var t,r,n={},o=Object.keys(e),i=o.length;for(t=0;t-1,i=he.isObject(e);if(i&&he.isHTMLForm(e)&&(e=new FormData(e)),he.isFormData(e))return o?JSON.stringify(Fe(e)):e;if(he.isArrayBuffer(e)||he.isBuffer(e)||he.isStream(e)||he.isFile(e)||he.isBlob(e)||he.isReadableStream(e))return e;if(he.isArrayBufferView(e))return e.buffer;if(he.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Ee(e,new Ue.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return Ue.isNode&&he.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((r=he.isFileList(e))||n.indexOf("multipart/form-data")>-1){var a=this.env&&this.env.FormData;return Ee(r?{"files[]":e}:e,a&&new a,this.formSerializer)}}return i||o?(t.setContentType("application/json",!1),function(e,t,r){if(he.isString(e))try{return(t||JSON.parse)(e),he.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||Be.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(he.isResponse(e)||he.isReadableStream(e))return e;if(e&&he.isString(e)&&(r&&!this.responseType||n)){var o=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw de.from(e,de.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Ue.classes.FormData,Blob:Ue.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};he.forEach(["delete","get","head","post","put","patch"],(function(e){Be.headers[e]={}}));var De=Be,qe=he.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),Ie=Symbol("internals");function Me(e){return e&&String(e).trim().toLowerCase()}function ze(e){return!1===e||null==e?e:he.isArray(e)?e.map(ze):String(e)}function He(e,t,r,n,o){return he.isFunction(n)?n.call(this,t,r):(o&&(t=r),he.isString(t)?he.isString(n)?-1!==t.indexOf(n):he.isRegExp(n)?n.test(t):void 0:void 0)}var Je=function(e,t){function r(e){d(this,r),e&&this.set(e)}return y(r,[{key:"set",value:function(e,t,r){var n=this;function o(e,t,r){var o=Me(t);if(!o)throw new Error("header name must be a non-empty string");var i=he.findKey(n,o);(!i||void 0===n[i]||!0===r||void 0===r&&!1!==n[i])&&(n[i||t]=ze(e))}var i=function(e,t){return he.forEach(e,(function(e,r){return o(e,r,t)}))};if(he.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(he.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(function(e){var t,r,n,o={};return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),t=e.substring(0,n).trim().toLowerCase(),r=e.substring(n+1).trim(),!t||o[t]&&qe[t]||("set-cookie"===t?o[t]?o[t].push(r):o[t]=[r]:o[t]=o[t]?o[t]+", "+r:r)})),o}(e),t);else if(he.isHeaders(e)){var a,s=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=O(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}(e.entries());try{for(s.s();!(a=s.n()).done;){var u=b(a.value,2),c=u[0];o(u[1],c,r)}}catch(e){s.e(e)}finally{s.f()}}else null!=e&&o(t,e,r);return this}},{key:"get",value:function(e,t){if(e=Me(e)){var r=he.findKey(this,e);if(r){var n=this[r];if(!t)return n;if(!0===t)return function(e){for(var t,r=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;t=n.exec(e);)r[t[1]]=t[2];return r}(n);if(he.isFunction(t))return t.call(this,n,r);if(he.isRegExp(t))return t.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}},{key:"has",value:function(e,t){if(e=Me(e)){var r=he.findKey(this,e);return!(!r||void 0===this[r]||t&&!He(0,this[r],r,t))}return!1}},{key:"delete",value:function(e,t){var r=this,n=!1;function o(e){if(e=Me(e)){var o=he.findKey(r,e);!o||t&&!He(0,r[o],o,t)||(delete r[o],n=!0)}}return he.isArray(e)?e.forEach(o):o(e),n}},{key:"clear",value:function(e){for(var t=Object.keys(this),r=t.length,n=!1;r--;){var o=t[r];e&&!He(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}},{key:"normalize",value:function(e){var t=this,r={};return he.forEach(this,(function(n,o){var i=he.findKey(r,o);if(i)return t[i]=ze(n),void delete t[o];var a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r}))}(o):String(o).trim();a!==o&&delete t[o],t[a]=ze(n),r[a]=!0})),this}},{key:"concat",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n1?r-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:Date.now();o=i,r=null,n&&(clearTimeout(n),n=null),e.apply(null,t)};return[function(){for(var e=Date.now(),t=e-o,s=arguments.length,u=new Array(s),c=0;c=i?a(u,e):(r=u,n||(n=setTimeout((function(){n=null,a(r)}),i-t)))},function(){return r&&a(r)}]}he.inherits(Ge,de,{__CANCEL__:!0});var Qe=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,n=0,o=$e(50,250);return Ye((function(r){var i=r.loaded,a=r.lengthComputable?r.total:void 0,s=i-n,u=o(s);n=i;var c=m({loaded:i,total:a,progress:a?i/a:void 0,bytes:s,rate:u||void 0,estimated:u&&a&&i<=a?(a-i)/u:void 0,event:r,lengthComputable:null!=a},t?"download":"upload",!0);e(c)}),r)},Ze=function(e,t){var r=null!=e;return[function(n){return t[0]({lengthComputable:r,total:e,loaded:n})},t[1]]},et=function(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n1?t-1:0),n=1;n1?"since :\n"+s.map(kt).join("\n"):" "+kt(s[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function At(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ge(null,e)}function Pt(e){return At(e),e.headers=We.from(e.headers),e.data=Ke.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),jt(e.adapter||De.adapter)(e).then((function(t){return At(e),t.data=Ke.call(e,e.transformResponse,t),t.headers=We.from(t.headers),t}),(function(t){return Ve(t)||(At(e),t&&t.response&&(t.response.data=Ke.call(e,e.transformResponse,t.response),t.response.headers=We.from(t.response.headers))),Promise.reject(t)}))}var Lt="1.8.2",Nt={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){Nt[e]=function(r){return f(r)===e||"a"+(t<1?"n ":" ")+e}}));var _t={};Nt.transitional=function(e,t,r){function n(e,t){return"[Axios v1.8.2] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,o,i){if(!1===e)throw new de(n(o," has been removed"+(t?" in "+t:"")),de.ERR_DEPRECATED);return t&&!_t[o]&&(_t[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,i)}},Nt.spelling=function(e){return function(t,r){return console.warn("".concat(r," is likely a misspelling of ").concat(e)),!0}};var Ct={assertOptions:function(e,t,r){if("object"!==f(e))throw new de("options must be an object",de.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(e),o=n.length;o-- >0;){var i=n[o],a=t[i];if(a){var s=e[i],u=void 0===s||a(s,i,e);if(!0!==u)throw new de("option "+i+" must be "+u,de.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new de("Unknown option "+i,de.ERR_BAD_OPTION)}},validators:Nt},Ut=Ct.validators,Ft=function(){function e(t){d(this,e),this.defaults=t,this.interceptors={request:new Te,response:new Te}}var t;return y(e,[{key:"request",value:(t=h(u().mark((function e(t,r){var n,o;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._request(t,r);case 3:return e.abrupt("return",e.sent);case 6:if(e.prev=6,e.t0=e.catch(0),e.t0 instanceof Error){n={},Error.captureStackTrace?Error.captureStackTrace(n):n=new Error,o=n.stack?n.stack.replace(/^.+\n/,""):"";try{e.t0.stack?o&&!String(e.t0.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(e.t0.stack+="\n"+o):e.t0.stack=o}catch(e){}}throw e.t0;case 10:case"end":return e.stop()}}),e,this,[[0,6]])}))),function(e,r){return t.apply(this,arguments)})},{key:"_request",value:function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{};var r=t=it(this.defaults,t),n=r.transitional,o=r.paramsSerializer,i=r.headers;void 0!==n&&Ct.assertOptions(n,{silentJSONParsing:Ut.transitional(Ut.boolean),forcedJSONParsing:Ut.transitional(Ut.boolean),clarifyTimeoutError:Ut.transitional(Ut.boolean)},!1),null!=o&&(he.isFunction(o)?t.paramsSerializer={serialize:o}:Ct.assertOptions(o,{encode:Ut.function,serialize:Ut.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Ct.assertOptions(t,{baseUrl:Ut.spelling("baseURL"),withXsrfToken:Ut.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();var a=i&&he.merge(i.common,i[t.method]);i&&he.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete i[e]})),t.headers=We.concat(a,i);var s=[],u=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(u=u&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));var c,f=[];this.interceptors.response.forEach((function(e){f.push(e.fulfilled,e.rejected)}));var l,p=0;if(!u){var h=[Pt.bind(this),void 0];for(h.unshift.apply(h,s),h.push.apply(h,f),l=h.length,c=Promise.resolve(t);p0;)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},t((function(e,t,o){n.reason||(n.reason=new Ge(e,t,o),r(n.reason))}))}return y(e,[{key:"throwIfRequested",value:function(){if(this.reason)throw this.reason}},{key:"subscribe",value:function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}},{key:"unsubscribe",value:function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}}},{key:"toAbortSignal",value:function(){var e=this,t=new AbortController,r=function(e){t.abort(e)};return this.subscribe(r),t.signal.unsubscribe=function(){return e.unsubscribe(r)},t.signal}}],[{key:"source",value:function(){var t;return{token:new e((function(e){t=e})),cancel:t}}}]),e}(),qt=Dt;var It={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(It).forEach((function(e){var t=b(e,2),r=t[0],n=t[1];It[n]=r}));var Mt=It;var zt=function e(t){var r=new Bt(t),n=R(Bt.prototype.request,r);return he.extend(n,Bt.prototype,r,{allOwnKeys:!0}),he.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(it(t,r))},n}(De);return zt.Axios=Bt,zt.CanceledError=Ge,zt.CancelToken=qt,zt.isCancel=Ve,zt.VERSION=Lt,zt.toFormData=Ee,zt.AxiosError=de,zt.Cancel=zt.CanceledError,zt.all=function(e){return Promise.all(e)},zt.spread=function(e){return function(t){return e.apply(null,t)}},zt.isAxiosError=function(e){return he.isObject(e)&&!0===e.isAxiosError},zt.mergeConfig=it,zt.AxiosHeaders=We,zt.formToJSON=function(e){return Fe(he.isHTMLForm(e)?new FormData(e):e)},zt.getAdapter=jt,zt.HttpStatusCode=Mt,zt.default=zt,zt})); +/*! Axios v1.11.0 Copyright (c) 2025 Matt Zabriskie and contributors */ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).axios=t()}(this,(function(){"use strict";function e(e){var r,n;function o(r,n){try{var a=e[r](n),u=a.value,s=u instanceof t;Promise.resolve(s?u.v:u).then((function(t){if(s){var n="return"===r?"return":"next";if(!u.k||t.done)return o(n,t);t=e[n](t).value}i(a.done?"return":"normal",t)}),(function(e){o("throw",e)}))}catch(e){i("throw",e)}}function i(e,t){switch(e){case"return":r.resolve({value:t,done:!0});break;case"throw":r.reject(t);break;default:r.resolve({value:t,done:!1})}(r=r.next)?o(r.key,r.arg):n=null}this._invoke=function(e,t){return new Promise((function(i,a){var u={key:e,arg:t,resolve:i,reject:a,next:null};n?n=n.next=u:(r=n=u,o(e,t))}))},"function"!=typeof e.return&&(this.return=void 0)}function t(e,t){this.v=e,this.k=t}function r(e){var r={},n=!1;function o(r,o){return n=!0,o=new Promise((function(t){t(e[r](o))})),{done:!1,value:new t(o,1)}}return r["undefined"!=typeof Symbol&&Symbol.iterator||"@@iterator"]=function(){return this},r.next=function(e){return n?(n=!1,e):o("next",e)},"function"==typeof e.throw&&(r.throw=function(e){if(n)throw n=!1,e;return o("throw",e)}),"function"==typeof e.return&&(r.return=function(e){return n?(n=!1,e):o("return",e)}),r}function n(e){var t,r,n,i=2;for("undefined"!=typeof Symbol&&(r=Symbol.asyncIterator,n=Symbol.iterator);i--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new o(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function o(e){function t(e){if(Object(e)!==e)return Promise.reject(new TypeError(e+" is not an object."));var t=e.done;return Promise.resolve(e.value).then((function(e){return{value:e,done:t}}))}return o=function(e){this.s=e,this.n=e.next},o.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?Promise.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?Promise.reject(e):t(r.apply(this.s,arguments))}},new o(e)}function i(e){return new t(e,0)}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function u(e){for(var t=1;t=0;--i){var a=this.tryEntries[i],u=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),c=n.call(a,"finallyLoc");if(s&&c){if(this.prev=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;A(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},t}function c(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function f(e){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f(e)}function l(t){return function(){return new e(t.apply(this,arguments))}}function p(e,t,r,n,o,i,a){try{var u=e[i](a),s=u.value}catch(e){return void r(e)}u.done?t(s):Promise.resolve(s).then(n,o)}function h(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){p(i,n,o,a,u,"next",e)}function u(e){p(i,n,o,a,u,"throw",e)}a(void 0)}))}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function v(e,t){for(var r=0;re.length)&&(t=e.length);for(var r=0,n=new Array(t);r2&&void 0!==arguments[2]?arguments[2]:{},i=o.allOwnKeys,a=void 0!==i&&i;if(null!=e)if("object"!==f(e)&&(e=[e]),C(e))for(r=0,n=e.length;r0;)if(t===(r=n[o]).toLowerCase())return r;return null}var te="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,re=function(e){return!U(e)&&e!==te};var ne,oe=(ne="undefined"!=typeof Uint8Array&&j(Uint8Array),function(e){return ne&&e instanceof ne}),ie=N("HTMLFormElement"),ae=function(e){var t=Object.prototype.hasOwnProperty;return function(e,r){return t.call(e,r)}}(),ue=N("RegExp"),se=function(e,t){var r=Object.getOwnPropertyDescriptors(e),n={};Z(r,(function(r,o){var i;!1!==(i=t(r,o,e))&&(n[o]=i||r)})),Object.defineProperties(e,n)};var ce,fe,le,pe,he=N("AsyncFunction"),de=(ce="function"==typeof setImmediate,fe=q(te.postMessage),ce?setImmediate:fe?(le="axios@".concat(Math.random()),pe=[],te.addEventListener("message",(function(e){var t=e.source,r=e.data;t===te&&r===le&&pe.length&&pe.shift()()}),!1),function(e){pe.push(e),te.postMessage(le,"*")}):function(e){return setTimeout(e)}),ve="undefined"!=typeof queueMicrotask?queueMicrotask.bind(te):"undefined"!=typeof process&&process.nextTick||de,ye={isArray:C,isArrayBuffer:B,isBuffer:F,isFormData:function(e){var t;return e&&("function"==typeof FormData&&e instanceof FormData||q(e.append)&&("formdata"===(t=L(e))||"object"===t&&q(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&B(e.buffer)},isString:D,isNumber:I,isBoolean:function(e){return!0===e||!1===e},isObject:M,isPlainObject:z,isEmptyObject:function(e){if(!M(e)||F(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:X,isRequest:$,isResponse:Y,isHeaders:Q,isUndefined:U,isDate:H,isFile:J,isBlob:W,isRegExp:ue,isFunction:q,isStream:function(e){return M(e)&&q(e.pipe)},isURLSearchParams:V,isTypedArray:oe,isFileList:K,forEach:Z,merge:function e(){for(var t=re(this)&&this||{},r=t.caseless,n={},o=function(t,o){var i=r&&ee(n,o)||o;z(n[i])&&z(t)?n[i]=e(n[i],t):z(t)?n[i]=e({},t):C(t)?n[i]=t.slice():n[i]=t},i=0,a=arguments.length;i3&&void 0!==arguments[3]?arguments[3]:{},o=n.allOwnKeys;return Z(t,(function(t,n){r&&q(t)?e[n]=R(t,r):e[n]=t}),{allOwnKeys:o}),e},trim:function(e){return e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,r,n){e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:function(e,t,r,n){var o,i,a,u={};if(t=t||{},null==e)return t;do{for(i=(o=Object.getOwnPropertyNames(e)).length;i-- >0;)a=o[i],n&&!n(a,e,t)||u[a]||(t[a]=e[a],u[a]=!0);e=!1!==r&&j(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:L,kindOfTest:N,endsWith:function(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var n=e.indexOf(t,r);return-1!==n&&n===r},toArray:function(e){if(!e)return null;if(C(e))return e;var t=e.length;if(!I(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},forEachEntry:function(e,t){for(var r,n=(e&&e[A]).call(e);(r=n.next())&&!r.done;){var o=r.value;t.call(e,o[0],o[1])}},matchAll:function(e,t){for(var r,n=[];null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:ie,hasOwnProperty:ae,hasOwnProp:ae,reduceDescriptors:se,freezeMethods:function(e){se(e,(function(t,r){if(q(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;var n=e[r];q(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=function(){throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:function(e,t){var r={},n=function(e){e.forEach((function(e){r[e]=!0}))};return C(e)?n(e):n(String(e).split(t)),r},toCamelCase:function(e){return e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r}))},noop:function(){},toFiniteNumber:function(e,t){return null!=e&&Number.isFinite(e=+e)?e:t},findKey:ee,global:te,isContextDefined:re,isSpecCompliantForm:function(e){return!!(e&&q(e.append)&&"FormData"===e[P]&&e[A])},toJSONObject:function(e){var t=new Array(10);return function e(r,n){if(M(r)){if(t.indexOf(r)>=0)return;if(F(r))return r;if(!("toJSON"in r)){t[n]=r;var o=C(r)?[]:{};return Z(r,(function(t,r){var i=e(t,n+1);!U(i)&&(o[r]=i)})),t[n]=void 0,o}}return r}(e,0)},isAsyncFn:he,isThenable:function(e){return e&&(M(e)||q(e))&&q(e.then)&&q(e.catch)},setImmediate:de,asap:ve,isIterable:function(e){return null!=e&&q(e[A])}};function me(e,t,r,n,o){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),o&&(this.response=o,this.status=o.status?o.status:null)}ye.inherits(me,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:ye.toJSONObject(this.config),code:this.code,status:this.status}}});var be=me.prototype,ge={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((function(e){ge[e]={value:e}})),Object.defineProperties(me,ge),Object.defineProperty(be,"isAxiosError",{value:!0}),me.from=function(e,t,r,n,o,i){var a=Object.create(be);return ye.toFlatObject(e,a,(function(e){return e!==Error.prototype}),(function(e){return"isAxiosError"!==e})),me.call(a,e.message,t,r,n,o),a.cause=e,a.name=e.name,i&&Object.assign(a,i),a};function we(e){return ye.isPlainObject(e)||ye.isArray(e)}function Ee(e){return ye.endsWith(e,"[]")?e.slice(0,-2):e}function Oe(e,t,r){return e?e.concat(t).map((function(e,t){return e=Ee(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}var Se=ye.toFlatObject(ye,{},null,(function(e){return/^is[A-Z]/.test(e)}));function xe(e,t,r){if(!ye.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;var n=(r=ye.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!ye.isUndefined(t[e])}))).metaTokens,o=r.visitor||c,i=r.dots,a=r.indexes,u=(r.Blob||"undefined"!=typeof Blob&&Blob)&&ye.isSpecCompliantForm(t);if(!ye.isFunction(o))throw new TypeError("visitor must be a function");function s(e){if(null===e)return"";if(ye.isDate(e))return e.toISOString();if(ye.isBoolean(e))return e.toString();if(!u&&ye.isBlob(e))throw new me("Blob is not supported. Use a Buffer instead.");return ye.isArrayBuffer(e)||ye.isTypedArray(e)?u&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function c(e,r,o){var u=e;if(e&&!o&&"object"===f(e))if(ye.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(ye.isArray(e)&&function(e){return ye.isArray(e)&&!e.some(we)}(e)||(ye.isFileList(e)||ye.endsWith(r,"[]"))&&(u=ye.toArray(e)))return r=Ee(r),u.forEach((function(e,n){!ye.isUndefined(e)&&null!==e&&t.append(!0===a?Oe([r],n,i):null===a?r:r+"[]",s(e))})),!1;return!!we(e)||(t.append(Oe(o,r,i),s(e)),!1)}var l=[],p=Object.assign(Se,{defaultVisitor:c,convertValue:s,isVisitable:we});if(!ye.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!ye.isUndefined(r)){if(-1!==l.indexOf(r))throw Error("Circular reference detected in "+n.join("."));l.push(r),ye.forEach(r,(function(r,i){!0===(!(ye.isUndefined(r)||null===r)&&o.call(t,r,ye.isString(i)?i.trim():i,n,p))&&e(r,n?n.concat(i):[i])})),l.pop()}}(e),t}function Re(e){var t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function ke(e,t){this._pairs=[],e&&xe(e,this,t)}var Te=ke.prototype;function je(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Ae(e,t,r){if(!t)return e;var n=r&&r.encode||je;ye.isFunction(r)&&(r={serialize:r});var o,i=r&&r.serialize;if(o=i?i(t,r):ye.isURLSearchParams(t)?t.toString():new ke(t,r).toString(n)){var a=e.indexOf("#");-1!==a&&(e=e.slice(0,a)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}Te.append=function(e,t){this._pairs.push([e,t])},Te.toString=function(e){var t=e?function(t){return e.call(this,t,Re)}:Re;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Pe=function(){function e(){d(this,e),this.handlers=[]}return y(e,[{key:"use",value:function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}},{key:"eject",value:function(e){this.handlers[e]&&(this.handlers[e]=null)}},{key:"clear",value:function(){this.handlers&&(this.handlers=[])}},{key:"forEach",value:function(e){ye.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}]),e}(),Le={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ne={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:ke,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]},_e="undefined"!=typeof window&&"undefined"!=typeof document,Ce="object"===("undefined"==typeof navigator?"undefined":f(navigator))&&navigator||void 0,Ue=_e&&(!Ce||["ReactNative","NativeScript","NS"].indexOf(Ce.product)<0),Fe="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Be=_e&&window.location.href||"http://localhost",De=u(u({},Object.freeze({__proto__:null,hasBrowserEnv:_e,hasStandardBrowserWebWorkerEnv:Fe,hasStandardBrowserEnv:Ue,navigator:Ce,origin:Be})),Ne);function qe(e){function t(e,r,n,o){var i=e[o++];if("__proto__"===i)return!0;var a=Number.isFinite(+i),u=o>=e.length;return i=!i&&ye.isArray(n)?n.length:i,u?(ye.hasOwnProp(n,i)?n[i]=[n[i],r]:n[i]=r,!a):(n[i]&&ye.isObject(n[i])||(n[i]=[]),t(e,r,n[i],o)&&ye.isArray(n[i])&&(n[i]=function(e){var t,r,n={},o=Object.keys(e),i=o.length;for(t=0;t-1,i=ye.isObject(e);if(i&&ye.isHTMLForm(e)&&(e=new FormData(e)),ye.isFormData(e))return o?JSON.stringify(qe(e)):e;if(ye.isArrayBuffer(e)||ye.isBuffer(e)||ye.isStream(e)||ye.isFile(e)||ye.isBlob(e)||ye.isReadableStream(e))return e;if(ye.isArrayBufferView(e))return e.buffer;if(ye.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();if(i){if(n.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return xe(e,new De.classes.URLSearchParams,u({visitor:function(e,t,r,n){return De.isNode&&ye.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((r=ye.isFileList(e))||n.indexOf("multipart/form-data")>-1){var a=this.env&&this.env.FormData;return xe(r?{"files[]":e}:e,a&&new a,this.formSerializer)}}return i||o?(t.setContentType("application/json",!1),function(e,t,r){if(ye.isString(e))try{return(t||JSON.parse)(e),ye.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||Ie.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(ye.isResponse(e)||ye.isReadableStream(e))return e;if(e&&ye.isString(e)&&(r&&!this.responseType||n)){var o=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(o){if("SyntaxError"===e.name)throw me.from(e,me.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:De.classes.FormData,Blob:De.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ye.forEach(["delete","get","head","post","put","patch"],(function(e){Ie.headers[e]={}}));var Me=Ie,ze=ye.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),He=Symbol("internals");function Je(e){return e&&String(e).trim().toLowerCase()}function We(e){return!1===e||null==e?e:ye.isArray(e)?e.map(We):String(e)}function Ke(e,t,r,n,o){return ye.isFunction(n)?n.call(this,t,r):(o&&(t=r),ye.isString(t)?ye.isString(n)?-1!==t.indexOf(n):ye.isRegExp(n)?n.test(t):void 0:void 0)}var Ve=function(e,t){function r(e){d(this,r),e&&this.set(e)}return y(r,[{key:"set",value:function(e,t,r){var n=this;function o(e,t,r){var o=Je(t);if(!o)throw new Error("header name must be a non-empty string");var i=ye.findKey(n,o);(!i||void 0===n[i]||!0===r||void 0===r&&!1!==n[i])&&(n[i||t]=We(e))}var i=function(e,t){return ye.forEach(e,(function(e,r){return o(e,r,t)}))};if(ye.isPlainObject(e)||e instanceof this.constructor)i(e,t);else if(ye.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))i(function(e){var t,r,n,o={};return e&&e.split("\n").forEach((function(e){n=e.indexOf(":"),t=e.substring(0,n).trim().toLowerCase(),r=e.substring(n+1).trim(),!t||o[t]&&ze[t]||("set-cookie"===t?o[t]?o[t].push(r):o[t]=[r]:o[t]=o[t]?o[t]+", "+r:r)})),o}(e),t);else if(ye.isObject(e)&&ye.isIterable(e)){var a,u,s,c={},f=function(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=O(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}(e);try{for(f.s();!(s=f.n()).done;){var l=s.value;if(!ye.isArray(l))throw TypeError("Object iterator must return a key-value pair");c[u=l[0]]=(a=c[u])?ye.isArray(a)?[].concat(g(a),[l[1]]):[a,l[1]]:l[1]}}catch(e){f.e(e)}finally{f.f()}i(c,t)}else null!=e&&o(t,e,r);return this}},{key:"get",value:function(e,t){if(e=Je(e)){var r=ye.findKey(this,e);if(r){var n=this[r];if(!t)return n;if(!0===t)return function(e){for(var t,r=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;t=n.exec(e);)r[t[1]]=t[2];return r}(n);if(ye.isFunction(t))return t.call(this,n,r);if(ye.isRegExp(t))return t.exec(n);throw new TypeError("parser must be boolean|regexp|function")}}}},{key:"has",value:function(e,t){if(e=Je(e)){var r=ye.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ke(0,this[r],r,t))}return!1}},{key:"delete",value:function(e,t){var r=this,n=!1;function o(e){if(e=Je(e)){var o=ye.findKey(r,e);!o||t&&!Ke(0,r[o],o,t)||(delete r[o],n=!0)}}return ye.isArray(e)?e.forEach(o):o(e),n}},{key:"clear",value:function(e){for(var t=Object.keys(this),r=t.length,n=!1;r--;){var o=t[r];e&&!Ke(0,this[o],o,e,!0)||(delete this[o],n=!0)}return n}},{key:"normalize",value:function(e){var t=this,r={};return ye.forEach(this,(function(n,o){var i=ye.findKey(r,o);if(i)return t[i]=We(n),void delete t[o];var a=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r}))}(o):String(o).trim();a!==o&&delete t[o],t[a]=We(n),r[a]=!0})),this}},{key:"concat",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n1?r-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:Date.now();o=i,r=null,n&&(clearTimeout(n),n=null),e.apply(void 0,g(t))};return[function(){for(var e=Date.now(),t=e-o,u=arguments.length,s=new Array(u),c=0;c=i?a(s,e):(r=s,n||(n=setTimeout((function(){n=null,a(r)}),i-t)))},function(){return r&&a(r)}]}ye.inherits(Ye,me,{__CANCEL__:!0});var tt=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3,n=0,o=Ze(50,250);return et((function(r){var i=r.loaded,a=r.lengthComputable?r.total:void 0,u=i-n,s=o(u);n=i;var c=m({loaded:i,total:a,progress:a?i/a:void 0,bytes:u,rate:s||void 0,estimated:s&&a&&i<=a?(a-i)/s:void 0,event:r,lengthComputable:null!=a},t?"download":"upload",!0);e(c)}),r)},rt=function(e,t){var r=null!=e;return[function(n){return t[0]({lengthComputable:r,total:e,loaded:n})},t[1]]},nt=function(e){return function(){for(var t=arguments.length,r=new Array(t),n=0;n1?t-1:0),n=1;n1?"since :\n"+u.map(At).join("\n"):" "+At(u[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return r};function Nt(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ye(null,e)}function _t(e){return Nt(e),e.headers=Ge.from(e.headers),e.data=Xe.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1),Lt(e.adapter||Me.adapter)(e).then((function(t){return Nt(e),t.data=Xe.call(e,e.transformResponse,t),t.headers=Ge.from(t.headers),t}),(function(t){return $e(t)||(Nt(e),t&&t.response&&(t.response.data=Xe.call(e,e.transformResponse,t.response),t.response.headers=Ge.from(t.response.headers))),Promise.reject(t)}))}var Ct="1.11.0",Ut={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){Ut[e]=function(r){return f(r)===e||"a"+(t<1?"n ":" ")+e}}));var Ft={};Ut.transitional=function(e,t,r){function n(e,t){return"[Axios v1.11.0] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,o,i){if(!1===e)throw new me(n(o," has been removed"+(t?" in "+t:"")),me.ERR_DEPRECATED);return t&&!Ft[o]&&(Ft[o]=!0,console.warn(n(o," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,o,i)}},Ut.spelling=function(e){return function(t,r){return console.warn("".concat(r," is likely a misspelling of ").concat(e)),!0}};var Bt={assertOptions:function(e,t,r){if("object"!==f(e))throw new me("options must be an object",me.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(e),o=n.length;o-- >0;){var i=n[o],a=t[i];if(a){var u=e[i],s=void 0===u||a(u,i,e);if(!0!==s)throw new me("option "+i+" must be "+s,me.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new me("Unknown option "+i,me.ERR_BAD_OPTION)}},validators:Ut},Dt=Bt.validators,qt=function(){function e(t){d(this,e),this.defaults=t||{},this.interceptors={request:new Pe,response:new Pe}}var t;return y(e,[{key:"request",value:(t=h(s().mark((function e(t,r){var n,o;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this._request(t,r);case 3:return e.abrupt("return",e.sent);case 6:if(e.prev=6,e.t0=e.catch(0),e.t0 instanceof Error){n={},Error.captureStackTrace?Error.captureStackTrace(n):n=new Error,o=n.stack?n.stack.replace(/^.+\n/,""):"";try{e.t0.stack?o&&!String(e.t0.stack).endsWith(o.replace(/^.+\n.+\n/,""))&&(e.t0.stack+="\n"+o):e.t0.stack=o}catch(e){}}throw e.t0;case 10:case"end":return e.stop()}}),e,this,[[0,6]])}))),function(e,r){return t.apply(this,arguments)})},{key:"_request",value:function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{};var r=t=st(this.defaults,t),n=r.transitional,o=r.paramsSerializer,i=r.headers;void 0!==n&&Bt.assertOptions(n,{silentJSONParsing:Dt.transitional(Dt.boolean),forcedJSONParsing:Dt.transitional(Dt.boolean),clarifyTimeoutError:Dt.transitional(Dt.boolean)},!1),null!=o&&(ye.isFunction(o)?t.paramsSerializer={serialize:o}:Bt.assertOptions(o,{encode:Dt.function,serialize:Dt.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Bt.assertOptions(t,{baseUrl:Dt.spelling("baseURL"),withXsrfToken:Dt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();var a=i&&ye.merge(i.common,i[t.method]);i&&ye.forEach(["delete","get","head","post","put","patch","common"],(function(e){delete i[e]})),t.headers=Ge.concat(a,i);var u=[],s=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(s=s&&e.synchronous,u.unshift(e.fulfilled,e.rejected))}));var c,f=[];this.interceptors.response.forEach((function(e){f.push(e.fulfilled,e.rejected)}));var l,p=0;if(!s){var h=[_t.bind(this),void 0];for(h.unshift.apply(h,u),h.push.apply(h,f),l=h.length,c=Promise.resolve(t);p0;)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},t((function(e,t,o){n.reason||(n.reason=new Ye(e,t,o),r(n.reason))}))}return y(e,[{key:"throwIfRequested",value:function(){if(this.reason)throw this.reason}},{key:"subscribe",value:function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}},{key:"unsubscribe",value:function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}}},{key:"toAbortSignal",value:function(){var e=this,t=new AbortController,r=function(e){t.abort(e)};return this.subscribe(r),t.signal.unsubscribe=function(){return e.unsubscribe(r)},t.signal}}],[{key:"source",value:function(){var t;return{token:new e((function(e){t=e})),cancel:t}}}]),e}(),zt=Mt;var Ht={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Ht).forEach((function(e){var t=b(e,2),r=t[0],n=t[1];Ht[n]=r}));var Jt=Ht;var Wt=function e(t){var r=new It(t),n=R(It.prototype.request,r);return ye.extend(n,It.prototype,r,{allOwnKeys:!0}),ye.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(st(t,r))},n}(Me);return Wt.Axios=It,Wt.CanceledError=Ye,Wt.CancelToken=zt,Wt.isCancel=$e,Wt.VERSION=Ct,Wt.toFormData=xe,Wt.AxiosError=me,Wt.Cancel=Wt.CanceledError,Wt.all=function(e){return Promise.all(e)},Wt.spread=function(e){return function(t){return e.apply(null,t)}},Wt.isAxiosError=function(e){return ye.isObject(e)&&!0===e.isAxiosError},Wt.mergeConfig=st,Wt.AxiosHeaders=Ge,Wt.formToJSON=function(e){return qe(ye.isHTMLForm(e)?new FormData(e):e)},Wt.getAdapter=Lt,Wt.HttpStatusCode=Jt,Wt.default=Wt,Wt})); //# sourceMappingURL=axios.min.js.map From d5c532c64f1b068cb6baa7c34698059c1abcb8d9 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Sat, 9 Aug 2025 16:07:33 +0200 Subject: [PATCH 26/30] fix saving sockopt --- web/assets/js/model/inbound.js | 2 +- web/html/inbounds.html | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index aebf321a..803b5d94 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -1710,7 +1710,7 @@ class Inbound extends XrayCommonClass { toJson() { let streamSettings; - if (this.canEnableStream()) { + if (this.canEnableStream() || this.stream?.sockopt) { streamSettings = this.stream.toJson(); } return { diff --git a/web/html/inbounds.html b/web/html/inbounds.html index e2b98d49..58d2d07a 100644 --- a/web/html/inbounds.html +++ b/web/html/inbounds.html @@ -1119,7 +1119,11 @@ protocol: inbound.protocol, settings: inbound.settings.toString(), }; - if (inbound.canEnableStream()) data.streamSettings = inbound.stream.toString(); + if (inbound.canEnableStream()){ + data.streamSettings = inbound.stream.toString(); + } else if (inbound.stream?.sockopt) { + data.streamSettings = JSON.stringify({ sockopt: inbound.stream.sockopt.toJson() }, null, 2); + } data.sniffing = inbound.sniffing.toString(); data.allocate = inbound.allocate.toString(); @@ -1139,7 +1143,11 @@ protocol: inbound.protocol, settings: inbound.settings.toString(), }; - if (inbound.canEnableStream()) data.streamSettings = inbound.stream.toString(); + if (inbound.canEnableStream()){ + data.streamSettings = inbound.stream.toString(); + } else if (inbound.stream?.sockopt) { + data.streamSettings = JSON.stringify({ sockopt: inbound.stream.sockopt.toJson() }, null, 2); + } data.sniffing = inbound.sniffing.toString(); data.allocate = inbound.allocate.toString(); From 6556884c7f7c0138108aa54333581bcd85cfe115 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Tue, 12 Aug 2025 12:56:49 +0200 Subject: [PATCH 27/30] remove unnecessary vue files --- web/assets/vue/vue.common.dev.js | 11818 ------------------- web/assets/vue/vue.common.js | 5 - web/assets/vue/vue.common.prod.js | 6 - web/assets/vue/vue.esm.browser.js | 11731 ------------------- web/assets/vue/vue.esm.browser.min.js | 6 - web/assets/vue/vue.esm.js | 11918 ------------------- web/assets/vue/vue.js | 11932 -------------------- web/assets/vue/vue.runtime.common.dev.js | 8736 -------------- web/assets/vue/vue.runtime.common.js | 5 - web/assets/vue/vue.runtime.common.prod.js | 6 - web/assets/vue/vue.runtime.esm.js | 8825 --------------- web/assets/vue/vue.runtime.js | 8826 --------------- web/assets/vue/vue.runtime.min.js | 6 - web/assets/vue/vue.runtime.mjs | 76 - 14 files changed, 73896 deletions(-) delete mode 100644 web/assets/vue/vue.common.dev.js delete mode 100644 web/assets/vue/vue.common.js delete mode 100644 web/assets/vue/vue.common.prod.js delete mode 100644 web/assets/vue/vue.esm.browser.js delete mode 100644 web/assets/vue/vue.esm.browser.min.js delete mode 100644 web/assets/vue/vue.esm.js delete mode 100644 web/assets/vue/vue.js delete mode 100644 web/assets/vue/vue.runtime.common.dev.js delete mode 100644 web/assets/vue/vue.runtime.common.js delete mode 100644 web/assets/vue/vue.runtime.common.prod.js delete mode 100644 web/assets/vue/vue.runtime.esm.js delete mode 100644 web/assets/vue/vue.runtime.js delete mode 100644 web/assets/vue/vue.runtime.min.js delete mode 100644 web/assets/vue/vue.runtime.mjs diff --git a/web/assets/vue/vue.common.dev.js b/web/assets/vue/vue.common.dev.js deleted file mode 100644 index 89964050..00000000 --- a/web/assets/vue/vue.common.dev.js +++ /dev/null @@ -1,11818 +0,0 @@ -/*! - * Vue.js v2.7.16 - * (c) 2014-2023 Evan You - * Released under the MIT License. - */ -'use strict'; - -const emptyObject = Object.freeze({}); -const isArray = Array.isArray; -// These helpers produce better VM code in JS engines due to their -// explicitness and function inlining. -function isUndef(v) { - return v === undefined || v === null; -} -function isDef(v) { - return v !== undefined && v !== null; -} -function isTrue(v) { - return v === true; -} -function isFalse(v) { - return v === false; -} -/** - * Check if value is primitive. - */ -function isPrimitive(value) { - return (typeof value === 'string' || - typeof value === 'number' || - // $flow-disable-line - typeof value === 'symbol' || - typeof value === 'boolean'); -} -function isFunction(value) { - return typeof value === 'function'; -} -/** - * Quick object check - this is primarily used to tell - * objects from primitive values when we know the value - * is a JSON-compliant type. - */ -function isObject(obj) { - return obj !== null && typeof obj === 'object'; -} -/** - * Get the raw type string of a value, e.g., [object Object]. - */ -const _toString = Object.prototype.toString; -function toRawType(value) { - return _toString.call(value).slice(8, -1); -} -/** - * Strict object type check. Only returns true - * for plain JavaScript objects. - */ -function isPlainObject(obj) { - return _toString.call(obj) === '[object Object]'; -} -function isRegExp(v) { - return _toString.call(v) === '[object RegExp]'; -} -/** - * Check if val is a valid array index. - */ -function isValidArrayIndex(val) { - const n = parseFloat(String(val)); - return n >= 0 && Math.floor(n) === n && isFinite(val); -} -function isPromise(val) { - return (isDef(val) && - typeof val.then === 'function' && - typeof val.catch === 'function'); -} -/** - * Convert a value to a string that is actually rendered. - */ -function toString(val) { - return val == null - ? '' - : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString) - ? JSON.stringify(val, replacer, 2) - : String(val); -} -function replacer(_key, val) { - // avoid circular deps from v3 - if (val && val.__v_isRef) { - return val.value; - } - return val; -} -/** - * Convert an input value to a number for persistence. - * If the conversion fails, return original string. - */ -function toNumber(val) { - const n = parseFloat(val); - return isNaN(n) ? val : n; -} -/** - * Make a map and return a function for checking if a key - * is in that map. - */ -function makeMap(str, expectsLowerCase) { - const map = Object.create(null); - const list = str.split(','); - for (let i = 0; i < list.length; i++) { - map[list[i]] = true; - } - return expectsLowerCase ? val => map[val.toLowerCase()] : val => map[val]; -} -/** - * Check if a tag is a built-in tag. - */ -const isBuiltInTag = makeMap('slot,component', true); -/** - * Check if an attribute is a reserved attribute. - */ -const isReservedAttribute = makeMap('key,ref,slot,slot-scope,is'); -/** - * Remove an item from an array. - */ -function remove$2(arr, item) { - const len = arr.length; - if (len) { - // fast path for the only / last item - if (item === arr[len - 1]) { - arr.length = len - 1; - return; - } - const index = arr.indexOf(item); - if (index > -1) { - return arr.splice(index, 1); - } - } -} -/** - * Check whether an object has the property. - */ -const hasOwnProperty = Object.prototype.hasOwnProperty; -function hasOwn(obj, key) { - return hasOwnProperty.call(obj, key); -} -/** - * Create a cached version of a pure function. - */ -function cached(fn) { - const cache = Object.create(null); - return function cachedFn(str) { - const hit = cache[str]; - return hit || (cache[str] = fn(str)); - }; -} -/** - * Camelize a hyphen-delimited string. - */ -const camelizeRE = /-(\w)/g; -const camelize = cached((str) => { - return str.replace(camelizeRE, (_, c) => (c ? c.toUpperCase() : '')); -}); -/** - * Capitalize a string. - */ -const capitalize = cached((str) => { - return str.charAt(0).toUpperCase() + str.slice(1); -}); -/** - * Hyphenate a camelCase string. - */ -const hyphenateRE = /\B([A-Z])/g; -const hyphenate = cached((str) => { - return str.replace(hyphenateRE, '-$1').toLowerCase(); -}); -/** - * Simple bind polyfill for environments that do not support it, - * e.g., PhantomJS 1.x. Technically, we don't need this anymore - * since native bind is now performant enough in most browsers. - * But removing it would mean breaking code that was able to run in - * PhantomJS 1.x, so this must be kept for backward compatibility. - */ -/* istanbul ignore next */ -function polyfillBind(fn, ctx) { - function boundFn(a) { - const l = arguments.length; - return l - ? l > 1 - ? fn.apply(ctx, arguments) - : fn.call(ctx, a) - : fn.call(ctx); - } - boundFn._length = fn.length; - return boundFn; -} -function nativeBind(fn, ctx) { - return fn.bind(ctx); -} -// @ts-expect-error bind cannot be `undefined` -const bind$1 = Function.prototype.bind ? nativeBind : polyfillBind; -/** - * Convert an Array-like object to a real Array. - */ -function toArray(list, start) { - start = start || 0; - let i = list.length - start; - const ret = new Array(i); - while (i--) { - ret[i] = list[i + start]; - } - return ret; -} -/** - * Mix properties into target object. - */ -function extend(to, _from) { - for (const key in _from) { - to[key] = _from[key]; - } - return to; -} -/** - * Merge an Array of Objects into a single Object. - */ -function toObject(arr) { - const res = {}; - for (let i = 0; i < arr.length; i++) { - if (arr[i]) { - extend(res, arr[i]); - } - } - return res; -} -/* eslint-disable no-unused-vars */ -/** - * Perform no operation. - * Stubbing args to make Flow happy without leaving useless transpiled code - * with ...rest (https://flow.org/blog/2017/05/07/Strict-Function-Call-Arity/). - */ -function noop(a, b, c) { } -/** - * Always return false. - */ -const no = (a, b, c) => false; -/* eslint-enable no-unused-vars */ -/** - * Return the same value. - */ -const identity = (_) => _; -/** - * Generate a string containing static keys from compiler modules. - */ -function genStaticKeys$1(modules) { - return modules - .reduce((keys, m) => keys.concat(m.staticKeys || []), []) - .join(','); -} -/** - * Check if two values are loosely equal - that is, - * if they are plain objects, do they have the same shape? - */ -function looseEqual(a, b) { - if (a === b) - return true; - const isObjectA = isObject(a); - const isObjectB = isObject(b); - if (isObjectA && isObjectB) { - try { - const isArrayA = Array.isArray(a); - const isArrayB = Array.isArray(b); - if (isArrayA && isArrayB) { - return (a.length === b.length && - a.every((e, i) => { - return looseEqual(e, b[i]); - })); - } - else if (a instanceof Date && b instanceof Date) { - return a.getTime() === b.getTime(); - } - else if (!isArrayA && !isArrayB) { - const keysA = Object.keys(a); - const keysB = Object.keys(b); - return (keysA.length === keysB.length && - keysA.every(key => { - return looseEqual(a[key], b[key]); - })); - } - else { - /* istanbul ignore next */ - return false; - } - } - catch (e) { - /* istanbul ignore next */ - return false; - } - } - else if (!isObjectA && !isObjectB) { - return String(a) === String(b); - } - else { - return false; - } -} -/** - * Return the first index at which a loosely equal value can be - * found in the array (if value is a plain object, the array must - * contain an object of the same shape), or -1 if it is not present. - */ -function looseIndexOf(arr, val) { - for (let i = 0; i < arr.length; i++) { - if (looseEqual(arr[i], val)) - return i; - } - return -1; -} -/** - * Ensure a function is called only once. - */ -function once(fn) { - let called = false; - return function () { - if (!called) { - called = true; - fn.apply(this, arguments); - } - }; -} -// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is#polyfill -function hasChanged(x, y) { - if (x === y) { - return x === 0 && 1 / x !== 1 / y; - } - else { - return x === x || y === y; - } -} - -const SSR_ATTR = 'data-server-rendered'; -const ASSET_TYPES = ['component', 'directive', 'filter']; -const LIFECYCLE_HOOKS = [ - 'beforeCreate', - 'created', - 'beforeMount', - 'mounted', - 'beforeUpdate', - 'updated', - 'beforeDestroy', - 'destroyed', - 'activated', - 'deactivated', - 'errorCaptured', - 'serverPrefetch', - 'renderTracked', - 'renderTriggered' -]; - -var config = { - /** - * Option merge strategies (used in core/util/options) - */ - // $flow-disable-line - optionMergeStrategies: Object.create(null), - /** - * Whether to suppress warnings. - */ - silent: false, - /** - * Show production mode tip message on boot? - */ - productionTip: true, - /** - * Whether to enable devtools - */ - devtools: true, - /** - * Whether to record perf - */ - performance: false, - /** - * Error handler for watcher errors - */ - errorHandler: null, - /** - * Warn handler for watcher warns - */ - warnHandler: null, - /** - * Ignore certain custom elements - */ - ignoredElements: [], - /** - * Custom user key aliases for v-on - */ - // $flow-disable-line - keyCodes: Object.create(null), - /** - * Check if a tag is reserved so that it cannot be registered as a - * component. This is platform-dependent and may be overwritten. - */ - isReservedTag: no, - /** - * Check if an attribute is reserved so that it cannot be used as a component - * prop. This is platform-dependent and may be overwritten. - */ - isReservedAttr: no, - /** - * Check if a tag is an unknown element. - * Platform-dependent. - */ - isUnknownElement: no, - /** - * Get the namespace of an element - */ - getTagNamespace: noop, - /** - * Parse the real tag name for the specific platform. - */ - parsePlatformTagName: identity, - /** - * Check if an attribute must be bound using property, e.g. value - * Platform-dependent. - */ - mustUseProp: no, - /** - * Perform updates asynchronously. Intended to be used by Vue Test Utils - * This will significantly reduce performance if set to false. - */ - async: true, - /** - * Exposed for legacy reasons - */ - _lifecycleHooks: LIFECYCLE_HOOKS -}; - -/** - * unicode letters used for parsing html tags, component names and property paths. - * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname - * skipping \u10000-\uEFFFF due to it freezing up PhantomJS - */ -const unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/; -/** - * Check if a string starts with $ or _ - */ -function isReserved(str) { - const c = (str + '').charCodeAt(0); - return c === 0x24 || c === 0x5f; -} -/** - * Define a property. - */ -function def(obj, key, val, enumerable) { - Object.defineProperty(obj, key, { - value: val, - enumerable: !!enumerable, - writable: true, - configurable: true - }); -} -/** - * Parse simple path. - */ -const bailRE = new RegExp(`[^${unicodeRegExp.source}.$_\\d]`); -function parsePath(path) { - if (bailRE.test(path)) { - return; - } - const segments = path.split('.'); - return function (obj) { - for (let i = 0; i < segments.length; i++) { - if (!obj) - return; - obj = obj[segments[i]]; - } - return obj; - }; -} - -// can we use __proto__? -const hasProto = '__proto__' in {}; -// Browser environment sniffing -const inBrowser = typeof window !== 'undefined'; -const UA = inBrowser && window.navigator.userAgent.toLowerCase(); -const isIE = UA && /msie|trident/.test(UA); -const isIE9 = UA && UA.indexOf('msie 9.0') > 0; -const isEdge = UA && UA.indexOf('edge/') > 0; -UA && UA.indexOf('android') > 0; -const isIOS = UA && /iphone|ipad|ipod|ios/.test(UA); -UA && /chrome\/\d+/.test(UA) && !isEdge; -UA && /phantomjs/.test(UA); -const isFF = UA && UA.match(/firefox\/(\d+)/); -// Firefox has a "watch" function on Object.prototype... -// @ts-expect-error firebox support -const nativeWatch = {}.watch; -let supportsPassive = false; -if (inBrowser) { - try { - const opts = {}; - Object.defineProperty(opts, 'passive', { - get() { - /* istanbul ignore next */ - supportsPassive = true; - } - }); // https://github.com/facebook/flow/issues/285 - window.addEventListener('test-passive', null, opts); - } - catch (e) { } -} -// this needs to be lazy-evaled because vue may be required before -// vue-server-renderer can set VUE_ENV -let _isServer; -const isServerRendering = () => { - if (_isServer === undefined) { - /* istanbul ignore if */ - if (!inBrowser && typeof global !== 'undefined') { - // detect presence of vue-server-renderer and avoid - // Webpack shimming the process - _isServer = - global['process'] && global['process'].env.VUE_ENV === 'server'; - } - else { - _isServer = false; - } - } - return _isServer; -}; -// detect devtools -const devtools = inBrowser && window.__VUE_DEVTOOLS_GLOBAL_HOOK__; -/* istanbul ignore next */ -function isNative(Ctor) { - return typeof Ctor === 'function' && /native code/.test(Ctor.toString()); -} -const hasSymbol = typeof Symbol !== 'undefined' && - isNative(Symbol) && - typeof Reflect !== 'undefined' && - isNative(Reflect.ownKeys); -let _Set; // $flow-disable-line -/* istanbul ignore if */ if (typeof Set !== 'undefined' && isNative(Set)) { - // use native Set when available. - _Set = Set; -} -else { - // a non-standard Set polyfill that only works with primitive keys. - _Set = class Set { - constructor() { - this.set = Object.create(null); - } - has(key) { - return this.set[key] === true; - } - add(key) { - this.set[key] = true; - } - clear() { - this.set = Object.create(null); - } - }; -} - -let currentInstance = null; -/** - * This is exposed for compatibility with v3 (e.g. some functions in VueUse - * relies on it). Do not use this internally, just use `currentInstance`. - * - * @internal this function needs manual type declaration because it relies - * on previously manually authored types from Vue 2 - */ -function getCurrentInstance() { - return currentInstance && { proxy: currentInstance }; -} -/** - * @internal - */ -function setCurrentInstance(vm = null) { - if (!vm) - currentInstance && currentInstance._scope.off(); - currentInstance = vm; - vm && vm._scope.on(); -} - -/** - * @internal - */ -class VNode { - constructor(tag, data, children, text, elm, context, componentOptions, asyncFactory) { - this.tag = tag; - this.data = data; - this.children = children; - this.text = text; - this.elm = elm; - this.ns = undefined; - this.context = context; - this.fnContext = undefined; - this.fnOptions = undefined; - this.fnScopeId = undefined; - this.key = data && data.key; - this.componentOptions = componentOptions; - this.componentInstance = undefined; - this.parent = undefined; - this.raw = false; - this.isStatic = false; - this.isRootInsert = true; - this.isComment = false; - this.isCloned = false; - this.isOnce = false; - this.asyncFactory = asyncFactory; - this.asyncMeta = undefined; - this.isAsyncPlaceholder = false; - } - // DEPRECATED: alias for componentInstance for backwards compat. - /* istanbul ignore next */ - get child() { - return this.componentInstance; - } -} -const createEmptyVNode = (text = '') => { - const node = new VNode(); - node.text = text; - node.isComment = true; - return node; -}; -function createTextVNode(val) { - return new VNode(undefined, undefined, undefined, String(val)); -} -// optimized shallow clone -// used for static nodes and slot nodes because they may be reused across -// multiple renders, cloning them avoids errors when DOM manipulations rely -// on their elm reference. -function cloneVNode(vnode) { - const cloned = new VNode(vnode.tag, vnode.data, - // #7975 - // clone children array to avoid mutating original in case of cloning - // a child. - vnode.children && vnode.children.slice(), vnode.text, vnode.elm, vnode.context, vnode.componentOptions, vnode.asyncFactory); - cloned.ns = vnode.ns; - cloned.isStatic = vnode.isStatic; - cloned.key = vnode.key; - cloned.isComment = vnode.isComment; - cloned.fnContext = vnode.fnContext; - cloned.fnOptions = vnode.fnOptions; - cloned.fnScopeId = vnode.fnScopeId; - cloned.asyncMeta = vnode.asyncMeta; - cloned.isCloned = true; - return cloned; -} - -/* not type checking this file because flow doesn't play well with Proxy */ -let initProxy; -{ - const allowedGlobals = makeMap('Infinity,undefined,NaN,isFinite,isNaN,' + - 'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' + - 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' + - 'require' // for Webpack/Browserify - ); - const warnNonPresent = (target, key) => { - warn$2(`Property or method "${key}" is not defined on the instance but ` + - 'referenced during render. Make sure that this property is reactive, ' + - 'either in the data option, or for class-based components, by ' + - 'initializing the property. ' + - 'See: https://v2.vuejs.org/v2/guide/reactivity.html#Declaring-Reactive-Properties.', target); - }; - const warnReservedPrefix = (target, key) => { - warn$2(`Property "${key}" must be accessed with "$data.${key}" because ` + - 'properties starting with "$" or "_" are not proxied in the Vue instance to ' + - 'prevent conflicts with Vue internals. ' + - 'See: https://v2.vuejs.org/v2/api/#data', target); - }; - const hasProxy = typeof Proxy !== 'undefined' && isNative(Proxy); - if (hasProxy) { - const isBuiltInModifier = makeMap('stop,prevent,self,ctrl,shift,alt,meta,exact'); - config.keyCodes = new Proxy(config.keyCodes, { - set(target, key, value) { - if (isBuiltInModifier(key)) { - warn$2(`Avoid overwriting built-in modifier in config.keyCodes: .${key}`); - return false; - } - else { - target[key] = value; - return true; - } - } - }); - } - const hasHandler = { - has(target, key) { - const has = key in target; - const isAllowed = allowedGlobals(key) || - (typeof key === 'string' && - key.charAt(0) === '_' && - !(key in target.$data)); - if (!has && !isAllowed) { - if (key in target.$data) - warnReservedPrefix(target, key); - else - warnNonPresent(target, key); - } - return has || !isAllowed; - } - }; - const getHandler = { - get(target, key) { - if (typeof key === 'string' && !(key in target)) { - if (key in target.$data) - warnReservedPrefix(target, key); - else - warnNonPresent(target, key); - } - return target[key]; - } - }; - initProxy = function initProxy(vm) { - if (hasProxy) { - // determine which proxy handler to use - const options = vm.$options; - const handlers = options.render && options.render._withStripped ? getHandler : hasHandler; - vm._renderProxy = new Proxy(vm, handlers); - } - else { - vm._renderProxy = vm; - } - }; -} - -let uid$2 = 0; -const pendingCleanupDeps = []; -const cleanupDeps = () => { - for (let i = 0; i < pendingCleanupDeps.length; i++) { - const dep = pendingCleanupDeps[i]; - dep.subs = dep.subs.filter(s => s); - dep._pending = false; - } - pendingCleanupDeps.length = 0; -}; -/** - * A dep is an observable that can have multiple - * directives subscribing to it. - * @internal - */ -class Dep { - constructor() { - // pending subs cleanup - this._pending = false; - this.id = uid$2++; - this.subs = []; - } - addSub(sub) { - this.subs.push(sub); - } - removeSub(sub) { - // #12696 deps with massive amount of subscribers are extremely slow to - // clean up in Chromium - // to workaround this, we unset the sub for now, and clear them on - // next scheduler flush. - this.subs[this.subs.indexOf(sub)] = null; - if (!this._pending) { - this._pending = true; - pendingCleanupDeps.push(this); - } - } - depend(info) { - if (Dep.target) { - Dep.target.addDep(this); - if (info && Dep.target.onTrack) { - Dep.target.onTrack(Object.assign({ effect: Dep.target }, info)); - } - } - } - notify(info) { - // stabilize the subscriber list first - const subs = this.subs.filter(s => s); - if (!config.async) { - // subs aren't sorted in scheduler if not running async - // we need to sort them now to make sure they fire in correct - // order - subs.sort((a, b) => a.id - b.id); - } - for (let i = 0, l = subs.length; i < l; i++) { - const sub = subs[i]; - if (info) { - sub.onTrigger && - sub.onTrigger(Object.assign({ effect: subs[i] }, info)); - } - sub.update(); - } - } -} -// The current target watcher being evaluated. -// This is globally unique because only one watcher -// can be evaluated at a time. -Dep.target = null; -const targetStack = []; -function pushTarget(target) { - targetStack.push(target); - Dep.target = target; -} -function popTarget() { - targetStack.pop(); - Dep.target = targetStack[targetStack.length - 1]; -} - -/* - * not type checking this file because flow doesn't play well with - * dynamically accessing methods on Array prototype - */ -const arrayProto = Array.prototype; -const arrayMethods = Object.create(arrayProto); -const methodsToPatch = [ - 'push', - 'pop', - 'shift', - 'unshift', - 'splice', - 'sort', - 'reverse' -]; -/** - * Intercept mutating methods and emit events - */ -methodsToPatch.forEach(function (method) { - // cache original method - const original = arrayProto[method]; - def(arrayMethods, method, function mutator(...args) { - const result = original.apply(this, args); - const ob = this.__ob__; - let inserted; - switch (method) { - case 'push': - case 'unshift': - inserted = args; - break; - case 'splice': - inserted = args.slice(2); - break; - } - if (inserted) - ob.observeArray(inserted); - // notify change - { - ob.dep.notify({ - type: "array mutation" /* TriggerOpTypes.ARRAY_MUTATION */, - target: this, - key: method - }); - } - return result; - }); -}); - -const arrayKeys = Object.getOwnPropertyNames(arrayMethods); -const NO_INITIAL_VALUE = {}; -/** - * In some cases we may want to disable observation inside a component's - * update computation. - */ -let shouldObserve = true; -function toggleObserving(value) { - shouldObserve = value; -} -// ssr mock dep -const mockDep = { - notify: noop, - depend: noop, - addSub: noop, - removeSub: noop -}; -/** - * Observer class that is attached to each observed - * object. Once attached, the observer converts the target - * object's property keys into getter/setters that - * collect dependencies and dispatch updates. - */ -class Observer { - constructor(value, shallow = false, mock = false) { - this.value = value; - this.shallow = shallow; - this.mock = mock; - // this.value = value - this.dep = mock ? mockDep : new Dep(); - this.vmCount = 0; - def(value, '__ob__', this); - if (isArray(value)) { - if (!mock) { - if (hasProto) { - value.__proto__ = arrayMethods; - /* eslint-enable no-proto */ - } - else { - for (let i = 0, l = arrayKeys.length; i < l; i++) { - const key = arrayKeys[i]; - def(value, key, arrayMethods[key]); - } - } - } - if (!shallow) { - this.observeArray(value); - } - } - else { - /** - * Walk through all properties and convert them into - * getter/setters. This method should only be called when - * value type is Object. - */ - const keys = Object.keys(value); - for (let i = 0; i < keys.length; i++) { - const key = keys[i]; - defineReactive(value, key, NO_INITIAL_VALUE, undefined, shallow, mock); - } - } - } - /** - * Observe a list of Array items. - */ - observeArray(value) { - for (let i = 0, l = value.length; i < l; i++) { - observe(value[i], false, this.mock); - } - } -} -// helpers -/** - * Attempt to create an observer instance for a value, - * returns the new observer if successfully observed, - * or the existing observer if the value already has one. - */ -function observe(value, shallow, ssrMockReactivity) { - if (value && hasOwn(value, '__ob__') && value.__ob__ instanceof Observer) { - return value.__ob__; - } - if (shouldObserve && - (ssrMockReactivity || !isServerRendering()) && - (isArray(value) || isPlainObject(value)) && - Object.isExtensible(value) && - !value.__v_skip /* ReactiveFlags.SKIP */ && - !isRef(value) && - !(value instanceof VNode)) { - return new Observer(value, shallow, ssrMockReactivity); - } -} -/** - * Define a reactive property on an Object. - */ -function defineReactive(obj, key, val, customSetter, shallow, mock, observeEvenIfShallow = false) { - const dep = new Dep(); - const property = Object.getOwnPropertyDescriptor(obj, key); - if (property && property.configurable === false) { - return; - } - // cater for pre-defined getter/setters - const getter = property && property.get; - const setter = property && property.set; - if ((!getter || setter) && - (val === NO_INITIAL_VALUE || arguments.length === 2)) { - val = obj[key]; - } - let childOb = shallow ? val && val.__ob__ : observe(val, false, mock); - Object.defineProperty(obj, key, { - enumerable: true, - configurable: true, - get: function reactiveGetter() { - const value = getter ? getter.call(obj) : val; - if (Dep.target) { - { - dep.depend({ - target: obj, - type: "get" /* TrackOpTypes.GET */, - key - }); - } - if (childOb) { - childOb.dep.depend(); - if (isArray(value)) { - dependArray(value); - } - } - } - return isRef(value) && !shallow ? value.value : value; - }, - set: function reactiveSetter(newVal) { - const value = getter ? getter.call(obj) : val; - if (!hasChanged(value, newVal)) { - return; - } - if (customSetter) { - customSetter(); - } - if (setter) { - setter.call(obj, newVal); - } - else if (getter) { - // #7981: for accessor properties without setter - return; - } - else if (!shallow && isRef(value) && !isRef(newVal)) { - value.value = newVal; - return; - } - else { - val = newVal; - } - childOb = shallow ? newVal && newVal.__ob__ : observe(newVal, false, mock); - { - dep.notify({ - type: "set" /* TriggerOpTypes.SET */, - target: obj, - key, - newValue: newVal, - oldValue: value - }); - } - } - }); - return dep; -} -function set(target, key, val) { - if ((isUndef(target) || isPrimitive(target))) { - warn$2(`Cannot set reactive property on undefined, null, or primitive value: ${target}`); - } - if (isReadonly(target)) { - warn$2(`Set operation on key "${key}" failed: target is readonly.`); - return; - } - const ob = target.__ob__; - if (isArray(target) && isValidArrayIndex(key)) { - target.length = Math.max(target.length, key); - target.splice(key, 1, val); - // when mocking for SSR, array methods are not hijacked - if (ob && !ob.shallow && ob.mock) { - observe(val, false, true); - } - return val; - } - if (key in target && !(key in Object.prototype)) { - target[key] = val; - return val; - } - if (target._isVue || (ob && ob.vmCount)) { - warn$2('Avoid adding reactive properties to a Vue instance or its root $data ' + - 'at runtime - declare it upfront in the data option.'); - return val; - } - if (!ob) { - target[key] = val; - return val; - } - defineReactive(ob.value, key, val, undefined, ob.shallow, ob.mock); - { - ob.dep.notify({ - type: "add" /* TriggerOpTypes.ADD */, - target: target, - key, - newValue: val, - oldValue: undefined - }); - } - return val; -} -function del(target, key) { - if ((isUndef(target) || isPrimitive(target))) { - warn$2(`Cannot delete reactive property on undefined, null, or primitive value: ${target}`); - } - if (isArray(target) && isValidArrayIndex(key)) { - target.splice(key, 1); - return; - } - const ob = target.__ob__; - if (target._isVue || (ob && ob.vmCount)) { - warn$2('Avoid deleting properties on a Vue instance or its root $data ' + - '- just set it to null.'); - return; - } - if (isReadonly(target)) { - warn$2(`Delete operation on key "${key}" failed: target is readonly.`); - return; - } - if (!hasOwn(target, key)) { - return; - } - delete target[key]; - if (!ob) { - return; - } - { - ob.dep.notify({ - type: "delete" /* TriggerOpTypes.DELETE */, - target: target, - key - }); - } -} -/** - * Collect dependencies on array elements when the array is touched, since - * we cannot intercept array element access like property getters. - */ -function dependArray(value) { - for (let e, i = 0, l = value.length; i < l; i++) { - e = value[i]; - if (e && e.__ob__) { - e.__ob__.dep.depend(); - } - if (isArray(e)) { - dependArray(e); - } - } -} - -function reactive(target) { - makeReactive(target, false); - return target; -} -/** - * Return a shallowly-reactive copy of the original object, where only the root - * level properties are reactive. It also does not auto-unwrap refs (even at the - * root level). - */ -function shallowReactive(target) { - makeReactive(target, true); - def(target, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true); - return target; -} -function makeReactive(target, shallow) { - // if trying to observe a readonly proxy, return the readonly version. - if (!isReadonly(target)) { - { - if (isArray(target)) { - warn$2(`Avoid using Array as root value for ${shallow ? `shallowReactive()` : `reactive()`} as it cannot be tracked in watch() or watchEffect(). Use ${shallow ? `shallowRef()` : `ref()`} instead. This is a Vue-2-only limitation.`); - } - const existingOb = target && target.__ob__; - if (existingOb && existingOb.shallow !== shallow) { - warn$2(`Target is already a ${existingOb.shallow ? `` : `non-`}shallow reactive object, and cannot be converted to ${shallow ? `` : `non-`}shallow.`); - } - } - const ob = observe(target, shallow, isServerRendering() /* ssr mock reactivity */); - if (!ob) { - if (target == null || isPrimitive(target)) { - warn$2(`value cannot be made reactive: ${String(target)}`); - } - if (isCollectionType(target)) { - warn$2(`Vue 2 does not support reactive collection types such as Map or Set.`); - } - } - } -} -function isReactive(value) { - if (isReadonly(value)) { - return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]); - } - return !!(value && value.__ob__); -} -function isShallow(value) { - return !!(value && value.__v_isShallow); -} -function isReadonly(value) { - return !!(value && value.__v_isReadonly); -} -function isProxy(value) { - return isReactive(value) || isReadonly(value); -} -function toRaw(observed) { - const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */]; - return raw ? toRaw(raw) : observed; -} -function markRaw(value) { - // non-extensible objects won't be observed anyway - if (Object.isExtensible(value)) { - def(value, "__v_skip" /* ReactiveFlags.SKIP */, true); - } - return value; -} -/** - * @internal - */ -function isCollectionType(value) { - const type = toRawType(value); - return (type === 'Map' || type === 'WeakMap' || type === 'Set' || type === 'WeakSet'); -} - -/** - * @internal - */ -const RefFlag = `__v_isRef`; -function isRef(r) { - return !!(r && r.__v_isRef === true); -} -function ref$1(value) { - return createRef(value, false); -} -function shallowRef(value) { - return createRef(value, true); -} -function createRef(rawValue, shallow) { - if (isRef(rawValue)) { - return rawValue; - } - const ref = {}; - def(ref, RefFlag, true); - def(ref, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, shallow); - def(ref, 'dep', defineReactive(ref, 'value', rawValue, null, shallow, isServerRendering())); - return ref; -} -function triggerRef(ref) { - if (!ref.dep) { - warn$2(`received object is not a triggerable ref.`); - } - { - ref.dep && - ref.dep.notify({ - type: "set" /* TriggerOpTypes.SET */, - target: ref, - key: 'value' - }); - } -} -function unref(ref) { - return isRef(ref) ? ref.value : ref; -} -function proxyRefs(objectWithRefs) { - if (isReactive(objectWithRefs)) { - return objectWithRefs; - } - const proxy = {}; - const keys = Object.keys(objectWithRefs); - for (let i = 0; i < keys.length; i++) { - proxyWithRefUnwrap(proxy, objectWithRefs, keys[i]); - } - return proxy; -} -function proxyWithRefUnwrap(target, source, key) { - Object.defineProperty(target, key, { - enumerable: true, - configurable: true, - get: () => { - const val = source[key]; - if (isRef(val)) { - return val.value; - } - else { - const ob = val && val.__ob__; - if (ob) - ob.dep.depend(); - return val; - } - }, - set: value => { - const oldValue = source[key]; - if (isRef(oldValue) && !isRef(value)) { - oldValue.value = value; - } - else { - source[key] = value; - } - } - }); -} -function customRef(factory) { - const dep = new Dep(); - const { get, set } = factory(() => { - { - dep.depend({ - target: ref, - type: "get" /* TrackOpTypes.GET */, - key: 'value' - }); - } - }, () => { - { - dep.notify({ - target: ref, - type: "set" /* TriggerOpTypes.SET */, - key: 'value' - }); - } - }); - const ref = { - get value() { - return get(); - }, - set value(newVal) { - set(newVal); - } - }; - def(ref, RefFlag, true); - return ref; -} -function toRefs(object) { - if (!isReactive(object)) { - warn$2(`toRefs() expects a reactive object but received a plain one.`); - } - const ret = isArray(object) ? new Array(object.length) : {}; - for (const key in object) { - ret[key] = toRef(object, key); - } - return ret; -} -function toRef(object, key, defaultValue) { - const val = object[key]; - if (isRef(val)) { - return val; - } - const ref = { - get value() { - const val = object[key]; - return val === undefined ? defaultValue : val; - }, - set value(newVal) { - object[key] = newVal; - } - }; - def(ref, RefFlag, true); - return ref; -} - -const rawToReadonlyFlag = `__v_rawToReadonly`; -const rawToShallowReadonlyFlag = `__v_rawToShallowReadonly`; -function readonly(target) { - return createReadonly(target, false); -} -function createReadonly(target, shallow) { - if (!isPlainObject(target)) { - { - if (isArray(target)) { - warn$2(`Vue 2 does not support readonly arrays.`); - } - else if (isCollectionType(target)) { - warn$2(`Vue 2 does not support readonly collection types such as Map or Set.`); - } - else { - warn$2(`value cannot be made readonly: ${typeof target}`); - } - } - return target; - } - if (!Object.isExtensible(target)) { - warn$2(`Vue 2 does not support creating readonly proxy for non-extensible object.`); - } - // already a readonly object - if (isReadonly(target)) { - return target; - } - // already has a readonly proxy - const existingFlag = shallow ? rawToShallowReadonlyFlag : rawToReadonlyFlag; - const existingProxy = target[existingFlag]; - if (existingProxy) { - return existingProxy; - } - const proxy = Object.create(Object.getPrototypeOf(target)); - def(target, existingFlag, proxy); - def(proxy, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, true); - def(proxy, "__v_raw" /* ReactiveFlags.RAW */, target); - if (isRef(target)) { - def(proxy, RefFlag, true); - } - if (shallow || isShallow(target)) { - def(proxy, "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */, true); - } - const keys = Object.keys(target); - for (let i = 0; i < keys.length; i++) { - defineReadonlyProperty(proxy, target, keys[i], shallow); - } - return proxy; -} -function defineReadonlyProperty(proxy, target, key, shallow) { - Object.defineProperty(proxy, key, { - enumerable: true, - configurable: true, - get() { - const val = target[key]; - return shallow || !isPlainObject(val) ? val : readonly(val); - }, - set() { - warn$2(`Set operation on key "${key}" failed: target is readonly.`); - } - }); -} -/** - * Returns a reactive-copy of the original object, where only the root level - * properties are readonly, and does NOT unwrap refs nor recursively convert - * returned properties. - * This is used for creating the props proxy object for stateful components. - */ -function shallowReadonly(target) { - return createReadonly(target, true); -} - -function computed(getterOrOptions, debugOptions) { - let getter; - let setter; - const onlyGetter = isFunction(getterOrOptions); - if (onlyGetter) { - getter = getterOrOptions; - setter = () => { - warn$2('Write operation failed: computed value is readonly'); - } - ; - } - else { - getter = getterOrOptions.get; - setter = getterOrOptions.set; - } - const watcher = isServerRendering() - ? null - : new Watcher(currentInstance, getter, noop, { lazy: true }); - if (watcher && debugOptions) { - watcher.onTrack = debugOptions.onTrack; - watcher.onTrigger = debugOptions.onTrigger; - } - const ref = { - // some libs rely on the presence effect for checking computed refs - // from normal refs, but the implementation doesn't matter - effect: watcher, - get value() { - if (watcher) { - if (watcher.dirty) { - watcher.evaluate(); - } - if (Dep.target) { - if (Dep.target.onTrack) { - Dep.target.onTrack({ - effect: Dep.target, - target: ref, - type: "get" /* TrackOpTypes.GET */, - key: 'value' - }); - } - watcher.depend(); - } - return watcher.value; - } - else { - return getter(); - } - }, - set value(newVal) { - setter(newVal); - } - }; - def(ref, RefFlag, true); - def(ref, "__v_isReadonly" /* ReactiveFlags.IS_READONLY */, onlyGetter); - return ref; -} - -let mark; -let measure; -{ - const perf = inBrowser && window.performance; - /* istanbul ignore if */ - if (perf && - // @ts-ignore - perf.mark && - // @ts-ignore - perf.measure && - // @ts-ignore - perf.clearMarks && - // @ts-ignore - perf.clearMeasures) { - mark = tag => perf.mark(tag); - measure = (name, startTag, endTag) => { - perf.measure(name, startTag, endTag); - perf.clearMarks(startTag); - perf.clearMarks(endTag); - // perf.clearMeasures(name) - }; - } -} - -const normalizeEvent = cached((name) => { - const passive = name.charAt(0) === '&'; - name = passive ? name.slice(1) : name; - const once = name.charAt(0) === '~'; // Prefixed last, checked first - name = once ? name.slice(1) : name; - const capture = name.charAt(0) === '!'; - name = capture ? name.slice(1) : name; - return { - name, - once, - capture, - passive - }; -}); -function createFnInvoker(fns, vm) { - function invoker() { - const fns = invoker.fns; - if (isArray(fns)) { - const cloned = fns.slice(); - for (let i = 0; i < cloned.length; i++) { - invokeWithErrorHandling(cloned[i], null, arguments, vm, `v-on handler`); - } - } - else { - // return handler return value for single handlers - return invokeWithErrorHandling(fns, null, arguments, vm, `v-on handler`); - } - } - invoker.fns = fns; - return invoker; -} -function updateListeners(on, oldOn, add, remove, createOnceHandler, vm) { - let name, cur, old, event; - for (name in on) { - cur = on[name]; - old = oldOn[name]; - event = normalizeEvent(name); - if (isUndef(cur)) { - warn$2(`Invalid handler for event "${event.name}": got ` + String(cur), vm); - } - else if (isUndef(old)) { - if (isUndef(cur.fns)) { - cur = on[name] = createFnInvoker(cur, vm); - } - if (isTrue(event.once)) { - cur = on[name] = createOnceHandler(event.name, cur, event.capture); - } - add(event.name, cur, event.capture, event.passive, event.params); - } - else if (cur !== old) { - old.fns = cur; - on[name] = old; - } - } - for (name in oldOn) { - if (isUndef(on[name])) { - event = normalizeEvent(name); - remove(event.name, oldOn[name], event.capture); - } - } -} - -function mergeVNodeHook(def, hookKey, hook) { - if (def instanceof VNode) { - def = def.data.hook || (def.data.hook = {}); - } - let invoker; - const oldHook = def[hookKey]; - function wrappedHook() { - hook.apply(this, arguments); - // important: remove merged hook to ensure it's called only once - // and prevent memory leak - remove$2(invoker.fns, wrappedHook); - } - if (isUndef(oldHook)) { - // no existing hook - invoker = createFnInvoker([wrappedHook]); - } - else { - /* istanbul ignore if */ - if (isDef(oldHook.fns) && isTrue(oldHook.merged)) { - // already a merged invoker - invoker = oldHook; - invoker.fns.push(wrappedHook); - } - else { - // existing plain hook - invoker = createFnInvoker([oldHook, wrappedHook]); - } - } - invoker.merged = true; - def[hookKey] = invoker; -} - -function extractPropsFromVNodeData(data, Ctor, tag) { - // we are only extracting raw values here. - // validation and default values are handled in the child - // component itself. - const propOptions = Ctor.options.props; - if (isUndef(propOptions)) { - return; - } - const res = {}; - const { attrs, props } = data; - if (isDef(attrs) || isDef(props)) { - for (const key in propOptions) { - const altKey = hyphenate(key); - { - const keyInLowerCase = key.toLowerCase(); - if (key !== keyInLowerCase && attrs && hasOwn(attrs, keyInLowerCase)) { - tip(`Prop "${keyInLowerCase}" is passed to component ` + - `${formatComponentName( - // @ts-expect-error tag is string - tag || Ctor)}, but the declared prop name is` + - ` "${key}". ` + - `Note that HTML attributes are case-insensitive and camelCased ` + - `props need to use their kebab-case equivalents when using in-DOM ` + - `templates. You should probably use "${altKey}" instead of "${key}".`); - } - } - checkProp(res, props, key, altKey, true) || - checkProp(res, attrs, key, altKey, false); - } - } - return res; -} -function checkProp(res, hash, key, altKey, preserve) { - if (isDef(hash)) { - if (hasOwn(hash, key)) { - res[key] = hash[key]; - if (!preserve) { - delete hash[key]; - } - return true; - } - else if (hasOwn(hash, altKey)) { - res[key] = hash[altKey]; - if (!preserve) { - delete hash[altKey]; - } - return true; - } - } - return false; -} - -// The template compiler attempts to minimize the need for normalization by -// statically analyzing the template at compile time. -// -// For plain HTML markup, normalization can be completely skipped because the -// generated render function is guaranteed to return Array. There are -// two cases where extra normalization is needed: -// 1. When the children contains components - because a functional component -// may return an Array instead of a single root. In this case, just a simple -// normalization is needed - if any child is an Array, we flatten the whole -// thing with Array.prototype.concat. It is guaranteed to be only 1-level deep -// because functional components already normalize their own children. -function simpleNormalizeChildren(children) { - for (let i = 0; i < children.length; i++) { - if (isArray(children[i])) { - return Array.prototype.concat.apply([], children); - } - } - return children; -} -// 2. When the children contains constructs that always generated nested Arrays, -// e.g.