Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

2018 lines
61 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: c752730f57bb6028.58d97a81ee.js
* Module id: 373518
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e) => {
"use strict";
var t,
r,
a,
i,
o,
n,
s,
l,
c,
u,
d,
g,
p,
m,
h,
f = e.i(868534);
let y = (0, f.registerPlugin)("App", {
web: () => e.A(53094).then((e) => new e.AppWeb()),
});
var b = f;
((t = c || (c = {})).Prompt = "PROMPT"),
(t.Camera = "CAMERA"),
(t.Photos = "PHOTOS"),
((r = u || (u = {})).Rear = "REAR"),
(r.Front = "FRONT"),
((a = d || (d = {})).Uri = "uri"),
(a.Base64 = "base64"),
(a.DataUrl = "dataUrl");
class w extends b.WebPlugin {
async getPhoto(e) {
return new Promise(async (t, r) => {
if (e.webUseInput || e.source === c.Photos)
this.fileInputExperience(e, t, r);
else if (e.source === c.Prompt) {
let a = document.querySelector("pwa-action-sheet");
a ||
((a = document.createElement("pwa-action-sheet")),
document.body.appendChild(a)),
(a.header = e.promptLabelHeader || "Photo"),
(a.cancelable = !1),
(a.options = [
{ title: e.promptLabelPhoto || "From Photos" },
{ title: e.promptLabelPicture || "Take Picture" },
]),
a.addEventListener("onSelection", async (a) => {
0 === a.detail
? this.fileInputExperience(e, t, r)
: this.cameraExperience(e, t, r);
});
} else this.cameraExperience(e, t, r);
});
}
async pickImages(e) {
return new Promise(async (e, t) => {
this.multipleFileInputExperience(e, t);
});
}
async cameraExperience(e, t, r) {
if (customElements.get("pwa-camera-modal")) {
let a = document.createElement("pwa-camera-modal");
(a.facingMode = e.direction === u.Front ? "user" : "environment"),
document.body.appendChild(a);
try {
await a.componentOnReady(),
a.addEventListener("onPhoto", async (i) => {
let o = i.detail;
null === o
? r(new b.CapacitorException("User cancelled photos app"))
: o instanceof Error
? r(o)
: t(await this._getCameraPhoto(o, e)),
a.dismiss(),
document.body.removeChild(a);
}),
a.present();
} catch (a) {
this.fileInputExperience(e, t, r);
}
} else
console.error(
"Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.",
),
this.fileInputExperience(e, t, r);
}
fileInputExperience(e, t, r) {
let a = document.querySelector("#_capacitor-camera-input"),
i = () => {
var e;
null == (e = a.parentNode) || e.removeChild(a);
};
a ||
(((a = document.createElement("input")).id =
"_capacitor-camera-input"),
(a.type = "file"),
(a.hidden = !0),
document.body.appendChild(a),
a.addEventListener("change", (r) => {
let o = a.files[0],
n = "jpeg";
if (
("image/png" === o.type
? (n = "png")
: "image/gif" === o.type && (n = "gif"),
"dataUrl" === e.resultType || "base64" === e.resultType)
) {
let r = new FileReader();
r.addEventListener("load", () => {
"dataUrl" === e.resultType
? t({ dataUrl: r.result, format: n })
: "base64" === e.resultType &&
t({ base64String: r.result.split(",")[1], format: n }),
i();
}),
r.readAsDataURL(o);
} else t({ webPath: URL.createObjectURL(o), format: n }), i();
}),
a.addEventListener("cancel", (e) => {
r(new b.CapacitorException("User cancelled photos app")), i();
})),
(a.accept = "image/*"),
(a.capture = !0),
e.source === c.Photos || e.source === c.Prompt
? a.removeAttribute("capture")
: e.direction === u.Front
? (a.capture = "user")
: e.direction === u.Rear && (a.capture = "environment"),
a.click();
}
multipleFileInputExperience(e, t) {
let r = document.querySelector("#_capacitor-camera-input-multiple"),
a = () => {
var e;
null == (e = r.parentNode) || e.removeChild(r);
};
r ||
(((r = document.createElement("input")).id =
"_capacitor-camera-input-multiple"),
(r.type = "file"),
(r.hidden = !0),
(r.multiple = !0),
document.body.appendChild(r),
r.addEventListener("change", (t) => {
let i = [];
for (let e = 0; e < r.files.length; e++) {
let t = r.files[e],
a = "jpeg";
"image/png" === t.type
? (a = "png")
: "image/gif" === t.type && (a = "gif"),
i.push({ webPath: URL.createObjectURL(t), format: a });
}
e({ photos: i }), a();
}),
r.addEventListener("cancel", (e) => {
t(new b.CapacitorException("User cancelled photos app")), a();
})),
(r.accept = "image/*"),
r.click();
}
_getCameraPhoto(e, t) {
return new Promise((r, a) => {
let i = new FileReader(),
o = e.type.split("/")[1];
"uri" === t.resultType
? r({ webPath: URL.createObjectURL(e), format: o, saved: !1 })
: (i.readAsDataURL(e),
(i.onloadend = () => {
let e = i.result;
"dataUrl" === t.resultType
? r({ dataUrl: e, format: o, saved: !1 })
: r({ base64String: e.split(",")[1], format: o, saved: !1 });
}),
(i.onerror = (e) => {
a(e);
}));
});
}
async checkPermissions() {
if ("u" < typeof navigator || !navigator.permissions)
throw this.unavailable(
"Permissions API not available in this browser",
);
try {
return {
camera: (
await window.navigator.permissions.query({ name: "camera" })
).state,
photos: "granted",
};
} catch (e) {
throw this.unavailable(
"Camera permissions are not available in this browser",
);
}
}
async requestPermissions() {
throw this.unimplemented("Not implemented on web.");
}
async pickLimitedLibraryPhotos() {
throw this.unavailable("Not implemented on web.");
}
async getLimitedLibraryPhotos() {
throw this.unavailable("Not implemented on web.");
}
}
new w();
let v = (0, f.registerPlugin)("Camera", { web: () => new w() });
var P = f;
class I extends P.WebPlugin {
async write(e) {
if ("u" < typeof navigator || !navigator.clipboard)
throw this.unavailable("Clipboard API not available in this browser");
if (void 0 !== e.string) await this.writeText(e.string);
else if (e.url) await this.writeText(e.url);
else if (e.image)
if ("u" > typeof ClipboardItem)
try {
let t = await (await fetch(e.image)).blob(),
r = new ClipboardItem({ [t.type]: t });
await navigator.clipboard.write([r]);
} catch (e) {
throw Error("Failed to write image");
}
else
throw this.unavailable(
"Writing images to the clipboard is not supported in this browser",
);
else throw Error("Nothing to write");
}
async read() {
if ("u" < typeof navigator || !navigator.clipboard)
throw this.unavailable("Clipboard API not available in this browser");
if (!("u" > typeof ClipboardItem)) return this.readText();
try {
let e = await navigator.clipboard.read(),
t = e[0].types[0],
r = await e[0].getType(t);
return { value: await this._getBlobData(r, t), type: t };
} catch (e) {
return this.readText();
}
}
async readText() {
if (
"u" < typeof navigator ||
!navigator.clipboard ||
!navigator.clipboard.readText
)
throw this.unavailable(
"Reading from clipboard not supported in this browser",
);
return {
value: await navigator.clipboard.readText(),
type: "text/plain",
};
}
async writeText(e) {
if (
"u" < typeof navigator ||
!navigator.clipboard ||
!navigator.clipboard.writeText
)
throw this.unavailable(
"Writting to clipboard not supported in this browser",
);
await navigator.clipboard.writeText(e);
}
_getBlobData(e, t) {
return new Promise((r, a) => {
let i = new FileReader();
t.includes("image") ? i.readAsDataURL(e) : i.readAsText(e),
(i.onloadend = () => {
r(i.result);
}),
(i.onerror = (e) => {
a(e);
});
});
}
}
let E = (0, f.registerPlugin)("Clipboard", { web: () => new I() }),
C = (0, f.registerPlugin)("Device", {
web: () => e.A(349515).then((e) => new e.DeviceWeb()),
});
e.i(422531);
let L = (0, f.registerPlugin)("Haptics", {
web: () => e.A(679018).then((e) => new e.HapticsWeb()),
});
((i = g || (g = {})).Dark = "DARK"),
(i.Light = "LIGHT"),
(i.Default = "DEFAULT"),
((o = p || (p = {})).Body = "body"),
(o.Ionic = "ionic"),
(o.Native = "native"),
(o.None = "none");
let S = (0, f.registerPlugin)("Keyboard"),
T = (0, f.registerPlugin)("Network", {
web: () => e.A(706500).then((e) => new e.NetworkWeb()),
}),
R = (0, f.registerPlugin)("Preferences", {
web: () => e.A(781417).then((e) => new e.PreferencesWeb()),
}),
k = (0, f.registerPlugin)("Share", {
web: () => e.A(688090).then((e) => new e.ShareWeb()),
}),
A = (0, f.registerPlugin)("SplashScreen", {
web: () => e.A(753146).then((e) => new e.SplashScreenWeb()),
});
((n = m || (m = {})).Dark = "DARK"),
(n.Light = "LIGHT"),
(n.Default = "DEFAULT"),
((s = h || (h = {})).None = "NONE"),
(s.Slide = "SLIDE"),
(s.Fade = "FADE");
let B = (0, f.registerPlugin)("StatusBar");
(0, f.registerPlugin)("Media", {
web: () => e.A(220121).then((e) => new e.MediaWeb()),
}),
(0, f.registerPlugin)("PushNotifications", {});
let O = () => {
try {
return f.Capacitor.isNativePlatform();
} catch (e) {
return console.warn("Capacitor.isNativePlatform() failed:", e), !1;
}
},
_ = () => O(),
M = (e) => {
try {
return f.Capacitor.isPluginAvailable(e);
} catch (t) {
return console.warn(`Plugin ${e} availability check failed:`, t), !1;
}
},
F = async (e, t, r, a) => {
try {
if (!M(e)) {
if ((console.warn(`Plugin ${e} is not available`), a))
return await Promise.resolve(a());
throw Error(`Plugin ${e} is not available`);
}
return await r();
} catch (r) {
if ((console.error(`Error calling ${e}.${t}:`, r), a))
try {
return await Promise.resolve(a());
} catch (r) {
throw (
(console.error(`Fallback for ${e}.${t} also failed:`, r), r)
);
}
throw r;
}
},
U = (e, t, r = "Operation timed out") =>
Promise.race([
e,
new Promise((e, a) => {
setTimeout(() => a(Error(r)), t);
}),
]),
D = {
info: (e, ...t) => {
window.__CAPACITOR_BRIDGE_DEBUG__ &&
console.info(`[CapacitorBridge] ${e}`, ...t);
},
warn: (e, ...t) => {
console.warn(`[CapacitorBridge] ${e}`, ...t);
},
error: (e, ...t) => {
console.error(`[CapacitorBridge] ${e}`, ...t);
},
},
$ = _() ? (0, f.registerPlugin)("CustomBridge") : void 0,
K = () =>
_()
? !!$ || (D.warn("CustomBridge: 插件未注入"), !1)
: (D.warn("CustomBridge: 当前不在原生环境,跳过调用"), !1),
x = (e) => ({ initialized: !1, solarEngineInitialized: !1, reason: e }),
N = async () => {
if (!K()) return x("plugin-unavailable");
try {
let e = await $.getStatus();
if (e?.initialized)
return console.log("CustomBridge: 已初始化,直接返回状态"), e;
} catch (e) {
console.warn("CustomBridge: 读取状态失败,将尝试重新初始化", e);
}
try {
let e = await $.initialize();
return (
console.log("CustomBridge: 初始化完成", e),
e ?? { initialized: !0, solarEngineInitialized: !1 }
);
} catch (e) {
return (
console.error("CustomBridge: 初始化失败", e), x("initialize-failed")
);
}
};
(() => {
try {
return "android" === f.Capacitor.getPlatform();
} catch (e) {
return console.warn("Platform detection failed:", e), !1;
}
})() && (0, f.registerPlugin)("MpaasPush"),
e.s(
[
"CustomBridge",
0,
$,
"ensureCustomBridgeInitialized",
0,
N,
"isCapacitor",
0,
O,
"isCustomBridgeAvailable",
0,
K,
"isIOS",
0,
() => {
try {
return "ios" === f.Capacitor.getPlatform();
} catch (e) {
return console.warn("Platform detection failed:", e), !1;
}
},
"isNative",
0,
_,
"isPluginAvailable",
0,
M,
"logger",
0,
D,
"safePluginCall",
0,
F,
"withTimeout",
0,
U,
],
820186,
);
class W {
static instance;
timeout = 1e4;
static getInstance() {
return W.instance || (W.instance = new W()), W.instance;
}
normalizeStatusBarStyle(e) {
if ("string" == typeof e)
switch (e.toUpperCase()) {
case "LIGHT":
case "LIGHT_CONTENT":
return "light-content";
case "DARK":
case "DARK_CONTENT":
return "dark-content";
}
return "default";
}
device = {
getInfo: async () => {
try {
let e = await U(
F(
"Device",
"getInfo",
() => C.getInfo(),
() => ({
platform: "web",
model: navigator.userAgent || "Unknown",
operatingSystem: "web",
osVersion: "Unknown",
manufacturer: "Unknown",
isVirtual: !1,
webViewVersion: "Unknown",
}),
),
this.timeout,
);
return (
D.info("Device info retrieved:", e), { success: !0, data: e }
);
} catch (e) {
return (
D.error("Failed to get device info:", e),
{
success: !1,
error: {
code: "DEVICE_INFO_ERROR",
message: "Failed to get device information",
details: e,
},
}
);
}
},
getId: async () => {
try {
let e = await U(
F(
"Device",
"getId",
() => C.getId(),
() => ({
identifier:
"web-device-" +
Date.now() +
"-" +
Math.random().toString(36).substr(2, 9),
}),
),
this.timeout,
),
t = "string" == typeof e ? e : e.identifier;
return D.info("Device ID retrieved:", t), { success: !0, data: t };
} catch (e) {
return (
D.error("Failed to get device ID:", e),
{
success: !1,
error: {
code: "DEVICE_ID_ERROR",
message: "Failed to get device ID",
details: e,
},
}
);
}
},
};
network = {
getStatus: async () => {
try {
let e = await U(
F(
"Network",
"getStatus",
() => T.getStatus(),
() => ({
connected: navigator.onLine,
connectionType: navigator.onLine ? "unknown" : "none",
}),
),
this.timeout,
),
t = { connected: e.connected, connectionType: e.connectionType };
return (
D.info("Network status retrieved:", t), { success: !0, data: t }
);
} catch (e) {
return (
D.error("Failed to get network status:", e),
{
success: !1,
error: {
code: "NETWORK_STATUS_ERROR",
message: "Failed to get network status",
details: e,
},
}
);
}
},
addListener: (e) => {
try {
if (T && M("Network"))
return T.addListener("networkStatusChange", (t) => {
let r = {
connected: t.connected,
connectionType: t.connectionType,
};
e(r);
});
{
let t = () => e({ connected: !0, connectionType: "unknown" }),
r = () => e({ connected: !1, connectionType: "none" });
return (
window.addEventListener("online", t),
window.addEventListener("offline", r),
{
remove: () => {
window.removeEventListener("online", t),
window.removeEventListener("offline", r);
},
}
);
}
} catch (e) {
return (
D.error("Failed to add network listener:", e),
{ remove: () => {} }
);
}
},
};
app = {
getState: async () => {
try {
let e = await U(
F(
"App",
"getState",
() =>
y?.getState() || Promise.reject("App plugin not available"),
() => ({ isActive: !document.hidden }),
),
this.timeout,
);
return (
D.info("App state retrieved:", e),
{ success: !0, data: { isActive: e.isActive } }
);
} catch (e) {
return (
D.error("Failed to get app state:", e),
{
success: !1,
error: {
code: "APP_STATE_ERROR",
message: "Failed to get app state",
details: e,
},
}
);
}
},
addListener: (e, t) => {
try {
if (y && M("App")) return y.addListener(e, t);
if ("appStateChange" === e) {
let e = () => {
t({ isActive: !document.hidden });
};
return (
document.addEventListener("visibilitychange", e),
{
remove: () =>
document.removeEventListener("visibilitychange", e),
}
);
}
return { remove: () => {} };
} catch (t) {
return (
D.error(`Failed to add ${e} listener:`, t), { remove: () => {} }
);
}
},
exit: async () => {
try {
return (
await U(
F(
"App",
"exitApp",
() =>
y && "function" == typeof y.exitApp
? y.exitApp()
: Promise.reject("App exit not supported"),
async () => {
"u" > typeof navigator && navigator.app?.exitApp
? navigator.app.exitApp()
: window.close();
},
),
this.timeout,
),
D.info("App exit requested"),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to exit app:", e),
{
success: !1,
error: {
code: "APP_EXIT_ERROR",
message: "Failed to exit app",
details: e,
},
}
);
}
},
};
camera = {
getPhoto: async (e = {}) => {
try {
if (!v) throw Error("Camera plugin not available");
let t = {
quality: 90,
allowEditing: !1,
resultType: "uri",
source: "prompt",
...e,
},
r = await U(v.getPhoto(t), this.timeout);
if (!r) throw Error("Camera result is empty");
let a = {
base64String: r.base64String,
dataUrl: r.dataUrl,
path: r.path,
webPath: r.webPath,
format: r.format || "jpeg",
};
return (
D.info("Photo captured successfully"), { success: !0, data: a }
);
} catch (e) {
return (
D.error("Failed to get photo:", e),
{
success: !1,
error: {
code: "CAMERA_ERROR",
message: "Failed to capture photo",
details: e,
},
}
);
}
},
};
storage = {
set: async (e) => {
try {
return (
await U(
F(
"Preferences",
"set",
() =>
R?.set(e) ||
Promise.reject("Preferences plugin not available"),
() => (
void 0 !== e.value && localStorage.setItem(e.key, e.value),
Promise.resolve()
),
),
this.timeout,
),
D.info(`Storage set: ${e.key}`),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to set storage:", e),
{
success: !1,
error: {
code: "STORAGE_SET_ERROR",
message: "Failed to store data",
details: e,
},
}
);
}
},
get: async (e) => {
try {
let t = await U(
F(
"Preferences",
"get",
() =>
R?.get({ key: e }) ||
Promise.reject("Preferences plugin not available"),
() => ({ value: localStorage.getItem(e) }),
),
this.timeout,
);
return (
D.info(`Storage get: ${e} = ${t.value}`),
{ success: !0, data: t.value }
);
} catch (e) {
return (
D.error("Failed to get storage:", e),
{
success: !1,
error: {
code: "STORAGE_GET_ERROR",
message: "Failed to retrieve data",
details: e,
},
}
);
}
},
remove: async (e) => {
try {
return (
await U(
F(
"Preferences",
"remove",
() =>
R?.remove({ key: e }) ||
Promise.reject("Preferences plugin not available"),
() => (localStorage.removeItem(e), Promise.resolve()),
),
this.timeout,
),
D.info(`Storage removed: ${e}`),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to remove storage:", e),
{
success: !1,
error: {
code: "STORAGE_REMOVE_ERROR",
message: "Failed to remove data",
details: e,
},
}
);
}
},
clear: async () => {
try {
return (
await U(
F(
"Preferences",
"clear",
() =>
R?.clear() ||
Promise.reject("Preferences plugin not available"),
() => (localStorage.clear(), Promise.resolve()),
),
this.timeout,
),
D.info("Storage cleared"),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to clear storage:", e),
{
success: !1,
error: {
code: "STORAGE_CLEAR_ERROR",
message: "Failed to clear storage",
details: e,
},
}
);
}
},
};
haptics = {
impact: async (e = {}) => {
try {
let t = e.style || "medium";
return (
await U(
F(
"Haptics",
"impact",
() => {
if (!L) throw Error("Haptics plugin not available");
let e = {
Light: "LIGHT",
Medium: "MEDIUM",
Heavy: "HEAVY",
}[t.charAt(0).toUpperCase() + t.slice(1)];
return L.impact({ style: e });
},
() => {
if ("vibrate" in navigator) {
let e = { light: 10, medium: 20, heavy: 30 }[t];
navigator.vibrate(e);
}
return Promise.resolve();
},
),
this.timeout,
),
D.info(`Haptic feedback triggered: ${t}`),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to trigger haptic feedback:", e),
{
success: !1,
error: {
code: "HAPTICS_ERROR",
message: "Failed to trigger haptic feedback",
details: e,
},
}
);
}
},
vibrate: async (e = 300) => {
try {
return (
await U(
F(
"Haptics",
"vibrate",
() =>
L?.vibrate({ duration: e }) ||
Promise.reject("Haptics plugin not available"),
() => (
"vibrate" in navigator && navigator.vibrate(e),
Promise.resolve()
),
),
this.timeout,
),
D.info(`Vibration triggered: ${e}ms`),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to trigger vibration:", e),
{
success: !1,
error: {
code: "VIBRATION_ERROR",
message: "Failed to trigger vibration",
details: e,
},
}
);
}
},
};
share = {
share: async (e) => {
try {
return (
await U(
F(
"Share",
"share",
() =>
k?.share(e) || Promise.reject("Share plugin not available"),
async () => {
if ("share" in navigator && navigator.share)
await navigator.share({
title: e.title,
text: e.text,
url: e.url,
});
else {
let t = `${e.title || ""}
${e.text || ""}
${e.url || ""}`.trim();
"clipboard" in navigator
? (await navigator.clipboard.writeText(t),
alert("内容已复制到剪贴板"))
: alert("您的浏览器不支持分享功能");
}
return {};
},
),
this.timeout,
),
D.info("Content shared successfully"),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to share content:", e),
{
success: !1,
error: {
code: "SHARE_ERROR",
message: "Failed to share content",
details: e,
},
}
);
}
},
};
clipboard = {
write: async (e) => {
try {
return (
await U(
F(
"Clipboard",
"write",
() =>
E?.write(e) ||
Promise.reject("Clipboard plugin not available"),
() => {
if ("clipboard" in navigator)
return navigator.clipboard.writeText(e.string);
let t = document.createElement("textarea");
(t.value = e.string),
(t.style.position = "fixed"),
(t.style.left = "-999999px"),
(t.style.top = "-999999px"),
document.body.appendChild(t),
t.focus(),
t.select();
let r = document.execCommand("copy");
if ((document.body.removeChild(t), !r))
throw Error("Copy command failed");
return Promise.resolve();
},
),
this.timeout,
),
D.info("Text written to clipboard"),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to write to clipboard:", e),
{
success: !1,
error: {
code: "CLIPBOARD_WRITE_ERROR",
message: "Failed to write to clipboard",
details: e,
},
}
);
}
},
read: async () => {
try {
let e = await U(
F(
"Clipboard",
"read",
() =>
E?.read() || Promise.reject("Clipboard plugin not available"),
async () => {
if ("clipboard" in navigator)
return {
value: await navigator.clipboard.readText(),
type: "text/plain",
};
throw Error("Clipboard read not supported");
},
),
this.timeout,
);
return D.info("Text read from clipboard"), { success: !0, data: e };
} catch (e) {
return (
D.error("Failed to read from clipboard:", e),
{
success: !1,
error: {
code: "CLIPBOARD_READ_ERROR",
message: "Failed to read from clipboard",
details: e,
},
}
);
}
},
};
isNative = () => O();
isPluginAvailable = (e) => M(e);
getPlatform = () => {
try {
return f.Capacitor.getPlatform();
} catch (e) {
return "web";
}
};
statusBar = {
getInfo: async () => {
try {
let e = await U(
F(
"StatusBar",
"getInfo",
async () => {
if (!B) throw Error("StatusBar plugin not available");
try {
return await B.getInfo();
} catch (e) {
return {
visible: !0,
style: "DEFAULT",
height: 20,
overlaysWebView: !1,
};
}
},
() => ({
visible: !0,
style: "DEFAULT",
height: 0,
overlaysWebView: !1,
}),
),
this.timeout,
),
t = {
visible: !1 !== e.visible,
style: this.normalizeStatusBarStyle(e.style),
backgroundColor: e.backgroundColor,
height: e.height || ("ios" === this.getPlatform() ? 20 : 24),
overlaysWebView: e.overlaysWebView || !1,
};
return (
D.info("Status bar info retrieved:", t), { success: !0, data: t }
);
} catch (e) {
return (
D.error("Failed to get status bar info:", e),
{
success: !1,
error: {
code: "STATUSBAR_INFO_ERROR",
message: "Failed to get status bar information",
details: e,
},
}
);
}
},
setStyle: async (e) => {
try {
return (
await U(
F(
"StatusBar",
"setStyle",
() => {
if (!B) throw Error("StatusBar plugin not available");
let t = {
default: "DEFAULT",
"light-content": "LIGHT",
"dark-content": "DARK",
}[e.style || "default"];
return B.setStyle({ style: t });
},
() => Promise.resolve(),
),
this.timeout,
),
D.info(`Status bar style set: ${e.style}`),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to set status bar style:", e),
{
success: !1,
error: {
code: "STATUSBAR_STYLE_ERROR",
message: "Failed to set status bar style",
details: e,
},
}
);
}
},
setBackgroundColor: async (e) => {
try {
return (
await U(
F(
"StatusBar",
"setBackgroundColor",
() =>
B?.setBackgroundColor({ color: e }) ||
Promise.reject("StatusBar plugin not available"),
() => Promise.resolve(),
),
this.timeout,
),
D.info(`Status bar background color set: ${e}`),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to set status bar background color:", e),
{
success: !1,
error: {
code: "STATUSBAR_COLOR_ERROR",
message: "Failed to set status bar background color",
details: e,
},
}
);
}
},
show: async () => {
try {
return (
await U(
F(
"StatusBar",
"show",
() =>
B?.show() ||
Promise.reject("StatusBar plugin not available"),
() => Promise.resolve(),
),
this.timeout,
),
D.info("Status bar shown"),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to show status bar:", e),
{
success: !1,
error: {
code: "STATUSBAR_SHOW_ERROR",
message: "Failed to show status bar",
details: e,
},
}
);
}
},
hide: async () => {
try {
return (
await U(
F(
"StatusBar",
"hide",
() =>
B?.hide() ||
Promise.reject("StatusBar plugin not available"),
() => Promise.resolve(),
),
this.timeout,
),
D.info("Status bar hidden"),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to hide status bar:", e),
{
success: !1,
error: {
code: "STATUSBAR_HIDE_ERROR",
message: "Failed to hide status bar",
details: e,
},
}
);
}
},
};
splashScreen = {
hide: async (e) => {
try {
return (
await U(
F(
"SplashScreen",
"hide",
() => {
if (!A)
return Promise.reject(
"SplashScreen plugin not available",
);
let t = e?.fadeOutDuration
? { fadeOutDuration: e.fadeOutDuration }
: void 0;
return A.hide(t);
},
() => Promise.resolve(),
),
this.timeout,
),
D.info("Splash screen hidden via bridge"),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to hide splash screen:", e),
{
success: !1,
error: {
code: "SPLASHSCREEN_HIDE_ERROR",
message: "Failed to hide splash screen",
details: e,
},
}
);
}
},
};
keyboard = {
show: async () => {
try {
return (
await U(
F(
"Keyboard",
"show",
() =>
S?.show() ||
Promise.reject("Keyboard plugin not available"),
() => Promise.resolve(),
),
this.timeout,
),
D.info("Keyboard shown"),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to show keyboard:", e),
{
success: !1,
error: {
code: "KEYBOARD_SHOW_ERROR",
message: "Failed to show keyboard",
details: e,
},
}
);
}
},
hide: async () => {
try {
return (
await U(
F(
"Keyboard",
"hide",
() =>
S?.hide() ||
Promise.reject("Keyboard plugin not available"),
() => (
document.activeElement &&
"blur" in document.activeElement &&
document.activeElement.blur(),
Promise.resolve()
),
),
this.timeout,
),
D.info("Keyboard hidden"),
{ success: !0 }
);
} catch (e) {
return (
D.error("Failed to hide keyboard:", e),
{
success: !1,
error: {
code: "KEYBOARD_HIDE_ERROR",
message: "Failed to hide keyboard",
details: e,
},
}
);
}
},
addListener: (e, t) => {
try {
if (S && M("Keyboard")) return S.addListener(e, t);
{
let e = () => {
t({ keyboardHeight: 0 });
};
return (
window.addEventListener("resize", e),
{ remove: () => window.removeEventListener("resize", e) }
);
}
} catch (t) {
return (
D.error(`Failed to add ${e} listener:`, t), { remove: () => {} }
);
}
},
};
}
W.getInstance(), e.s([], 977955), e.i(693602);
var j = e.i(995422);
class H {
static isClient() {
return "u" > typeof localStorage;
}
static isEnabled() {
return (
!!this.isClient() &&
"true" === localStorage.getItem(this.MOCK_ENABLED_KEY)
);
}
static setEnabled(e) {
this.isClient() &&
(e
? (localStorage.setItem(this.MOCK_ENABLED_KEY, "true"),
console.log("🧪 [LIBLIB-MOCK] Mock mode enabled"))
: (localStorage.removeItem(this.MOCK_ENABLED_KEY),
console.log("🧪 [LIBLIB-MOCK] Mock mode disabled")));
}
static generateMockKey(e, t, r) {
let a = `${e.toUpperCase()}_${t}`;
if (r && "object" == typeof r && Object.keys(r).length > 0) {
let e = JSON.stringify(
Object.keys(r)
.sort()
.reduce((e, t) => ((e[t] = r[t]), e), {}),
),
t = this.simpleHash(e);
return `${a}_${t}`;
}
return a;
}
static simpleHash(e) {
let t = 0;
for (let r = 0; r < e.length; r++)
(t = (t << 5) - t + e.charCodeAt(r)), (t &= t);
return Math.abs(t).toString(16);
}
static extractUrlPath(e) {
try {
return new URL(e).pathname;
} catch (t) {
return e;
}
}
static findFuzzyMatchKey(e) {
if (!this.isClient()) return null;
let t = `${this.MOCK_PREFIX}${e}`;
if (localStorage.getItem(t)) return e;
let r = e.split("_");
if (r.length < 2) return null;
let a = r[0],
i = r[1],
o = r[2] || "",
n = this.extractUrlPath(i),
s = o ? `${a}_${n}_${o}` : `${a}_${n}`,
l = `${this.MOCK_PREFIX}${s}`;
if (localStorage.getItem(l))
return (
console.log(`🎯 [LIBLIB-MOCK] Fuzzy match found: "${e}" -> "${s}"`),
s
);
for (let t of this.getAllMockKeys()) {
let r = t.split("_");
if (r.length < 2) continue;
let i = r[0],
s = r[1],
l = r[2] || "";
if (i === a && this.extractUrlPath(s) === n && l === o)
return (
console.log(
`🎯 [LIBLIB-MOCK] Fuzzy match found: "${e}" -> "${t}"`,
),
t
);
}
return null;
}
static setMockData(e, t) {
if (!this.isClient()) return;
let r = `${this.MOCK_PREFIX}${e}`,
a = { data: t, timestamp: Date.now(), type: typeof t };
localStorage.setItem(r, JSON.stringify(a)),
console.log(`🧪 [LIBLIB-MOCK] Set mock data for: ${e}`);
}
static getMockData(e) {
if (!this.isClient()) return null;
let t = this.findFuzzyMatchKey(e);
if (!t) return null;
let r = `${this.MOCK_PREFIX}${t}`,
a = localStorage.getItem(r);
if (a)
try {
let e = JSON.parse(a);
return (
console.log(`🧪 [LIBLIB-MOCK] Using mock data for: ${t}`), e.data
);
} catch (e) {
console.warn(
`🧪 [LIBLIB-MOCK] Failed to parse mock data for: ${t}`,
e,
);
}
return null;
}
static hasMockData(e) {
return !!this.isClient() && null !== this.findFuzzyMatchKey(e);
}
static removeMockData(e) {
if (!this.isClient()) return;
let t = `${this.MOCK_PREFIX}${e}`;
localStorage.removeItem(t),
console.log(`🧪 [LIBLIB-MOCK] Removed mock data for: ${e}`);
}
static clearAllMockData() {
if (!this.isClient()) return;
let e = [];
for (let t = 0; t < localStorage.length; t++) {
let r = localStorage.key(t);
r && r.startsWith(this.MOCK_PREFIX) && e.push(r);
}
e.forEach((e) => localStorage.removeItem(e)),
console.log(`🧪 [LIBLIB-MOCK] Cleared ${e.length} mock data entries`);
}
static getAllMockKeys() {
if (!this.isClient()) return [];
let e = [];
for (let t = 0; t < localStorage.length; t++) {
let r = localStorage.key(t);
r &&
r.startsWith(this.MOCK_PREFIX) &&
e.push(r.replace(this.MOCK_PREFIX, ""));
}
return e;
}
static exportMockData() {
if (!this.isClient()) return {};
let e = {};
return (
this.getAllMockKeys().forEach((t) => {
let r = this.getMockData(t);
null !== r && (e[t] = r);
}),
e
);
}
static importMockData(e) {
this.isClient() &&
(Object.entries(e).forEach(([e, t]) => {
this.setMockData(e, t);
}),
console.log(
`🧪 [LIBLIB-MOCK] Imported ${Object.keys(e).length} mock data entries`,
));
}
static getStats() {
let e = this.getAllMockKeys();
return { total: e.length, enabled: this.isEnabled(), keys: e };
}
}
async function V(e, t, r) {
let a = { delay: 100, verbose: !1, ...r };
if (!H.isEnabled())
return (
a.verbose &&
console.log(
`🔍 [LIBLIB-MOCK] Mock mode disabled, making real request: ${e.method} ${e.url}`,
),
await t()
);
let i = a.keyGenerator
? a.keyGenerator(e)
: H.generateMockKey(e.method, e.url, e.params || e.data),
o = H.getMockData(i);
if (null !== o)
return (
a.verbose &&
console.log(
`🧪 [LIBLIB-MOCK] Intercepted ${e.method} ${e.url}:`,
o,
),
a.delay > 0 && (await new Promise((e) => setTimeout(e, a.delay))),
o
);
a.verbose &&
console.log(
`🔍 [LIBLIB-MOCK] No mock data, making real request: ${e.method} ${e.url}`,
),
console.log(`🔑 [LIBLIB-MOCK] Mock key for manual editing: "${i}"`),
console.log(
`📝 [LIBLIB-MOCK] Request details - ${e.method} ${e.url}${e.params || e.data ? ", params: " + JSON.stringify(e.params || e.data) : ""}`,
);
try {
let e = await t();
return (
H.setMockData(i, e),
console.log(`💾 [LIBLIB-MOCK] Auto-saved response data for: "${i}"`),
e
);
} catch (e) {
throw (
(console.warn(
`❌ [LIBLIB-MOCK] Request failed, not saving data for: "${i}"`,
e,
),
e)
);
}
}
(H.MOCK_PREFIX = "__LIBLIB_MOCK_DATA__"),
(H.MOCK_ENABLED_KEY = "__LIBLIB_MOCK_ENABLED__"),
e.s(["checkIfMock", () => V], 432944),
H.setMockData.bind(H),
H.getMockData.bind(H),
H.hasMockData.bind(H),
H.removeMockData.bind(H),
H.clearAllMockData.bind(H),
H.exportMockData.bind(H),
H.importMockData.bind(H),
H.getStats.bind(H),
e.s([], 840715);
var z = e.i(243531),
G = e.i(552119),
q = e.i(694653),
X = e.i(319606);
let Y = (0, G.Logger)("@liblibaix/services");
async function J() {
Y.info("checkTimeLimit");
let e = (0, X.getUrl)(q.default.checkTimeLimit);
return await (0, z.postWithToken)(e, {});
}
async function Q() {
Y.info("getSubscribeList");
let e = (0, X.getUrl)(q.default.subscribeList);
return await (0, z.getWithToken)(e, {});
}
async function Z(e) {
Y.info("effectNewPackage");
let t = (0, X.getUrl)(q.default.effectNewPackage);
return await (0, z.postWithToken)(`${t}?packageId=${e}`, {
packageId: e,
});
}
async function ee(e) {
Y.info("cancelSubscribe");
let t = (0, X.getUrl)(q.default.subscribeCancel);
return await (0, z.postWithToken)(t, e);
}
async function et(e) {
Y.info("receiveTimeLimitDiscount");
let t = (0, X.getUrl)(q.default.startTimeLimitDiscount);
return await V({ method: "POST", url: t, data: e || {} }, () =>
(0, z.postWithToken)(t, e || {}),
);
}
async function er(e) {
Y.info("checkActivityConfig");
let t = (0, X.getUrl)(q.default.acquireActivityConfig);
return await (0, z.getWithToken)(t, { activityEnum: e });
}
async function ea(e = {}) {
Y.info("fetchUserBenefits");
let t = (0, X.getUrl)(q.default.userBenefits);
return await V({ method: "GET", url: t, data: {} }, () =>
(0, z.getWithToken)(t, e),
);
}
async function ei(e) {
let t = (0, X.getUrl)(q.default.pointChargeUrl);
return await (0, z.getWithToken)(t, {
packageType: "TRAIN",
libId: 0,
...e,
});
}
async function eo(e = {}) {
let t = (0, X.getUrl)(q.default.getPurchaseVipList),
{ data: r } = await (0, z.getWithToken)(t, {
packageType: "PRIORITY",
libId: 0,
...e,
});
return r;
}
async function en(e) {
let t = (0, X.getUrl)(q.default.orderList);
return await (0, z.postWithToken)(`${t}?libId=0`, {
libId: 0,
pageSize: 10,
page: e,
});
}
async function es(e) {
let t = (0, X.getUrl)(q.default.benefitRateLimit);
return await (0, z.postWithToken)(t, { rateLimitBenefitStatus: e });
}
async function el(e) {
let t = (0, X.getUrl)(q.default.getRateLimitBenefit);
return await (0, z.getWithToken)(t, {});
}
e.s(
[
"cancelSubscribe",
() => ee,
"checkActivityConfig",
() => er,
"checkTimeLimit",
() => J,
"disableRateLimitBenefit",
() => es,
"effectNewPackage",
() => Z,
"fetchOrderList",
() => en,
"fetchUserBenefits",
() => ea,
"getPointChargeSku",
() => ei,
"getRateLimitBenefit",
() => el,
"getSubscribeList",
() => Q,
"receiveTimeLimitDiscount",
() => et,
"requestAcceleratePurchaseList",
() => eo,
],
409488,
);
var ec = e.i(904472),
eu = e.i(433761);
let ed = (0, G.Logger)("@liblibaix/services-ts/vip"),
eg = new Map(),
ep = new Map();
async function em(e) {
ed.info("getLateMemberAcountInfo");
let t = (0, eu.getUrl)(ec.urls.memberAccount);
return await V({ method: "GET", url: t, data: e }, () =>
(0, z.getWithToken)(t, e),
);
}
async function eh(e) {
ed.info("getMemberPackages");
let t = JSON.stringify({
packageType: e.packageType,
couponCode: e.couponCode ?? null,
shopType: e.shopType ?? null,
isApp: e.isApp ?? null,
isiOS: e.isiOS ?? null,
sourceFrom: e.sourceFrom ?? null,
}),
r = eg.get(t);
if (r) return r;
let a = (0, eu.getUrl)(ec.urls.memberPackages),
i = V({ method: "GET", url: a, data: {} }, () =>
(0, z.getWithToken)(a, e),
).finally(() => {
eg.delete(t);
});
return eg.set(t, i), i;
}
async function ef(e) {
ed.info("getPowerList");
let t = (0, eu.getUrl)(ec.urls.memberPowers);
return await (0, z.getWithToken)(t, e);
}
async function ey() {
ed.info("getModelPointsCardList");
let e = (0, eu.getUrl)(ec.urls.memberModelPointsCardList);
return await (0, z.getWithToken)(e, {});
}
async function eb(e) {
ed.info("changeAccountSource");
let t = (0, eu.getUrl)(ec.urls.memberAccountChangeSource);
return await (0, z.postWithToken)(t, e);
}
async function ew(e) {
ed.info("getMemberPurchaseInfo");
let t = (0, eu.getUrl)(ec.urls.memberPurchase);
return await (0, z.postWithToken)(t, { ...e, isNewAgreement: !0 });
}
async function ev() {
ed.info("claimLibtvFreePower");
let e = (0, eu.getUrl)(ec.urls.libtvFreePower);
return await (0, z.postWithToken)(e, {});
}
async function eP(e) {
ed.info("getTeamMemberPurchaseInfo");
let t = (0, eu.getUrl)(ec.urls.teamsPurchase);
return await (0, z.postWithToken)(t, { ...e, isNewAgreement: !0 });
}
async function eI(e) {
ed.info("payResultInfo");
let t = (0, eu.getUrl)(ec.urls.payResult + e);
return await (0, z.postWithToken)(t, {});
}
async function eE(e) {
ed.info("getPriceNum");
let t = (0, eu.getUrl)(ec.urls.teamsPrice);
return await (0, z.postWithToken)(t, e);
}
async function eC(e) {
ed.info("appendSeatsRequest");
let t = (0, eu.getUrl)(ec.urls.teamsAppend);
return await (0, z.postWithToken)(t, e);
}
async function eL(e) {
ed.info("getPruchase");
let t = (0, eu.getUrl)(ec.urls.teamsPurchase);
return await (0, z.postWithToken)(t, e);
}
async function eS(e) {
ed.info("getTeams");
let t = (0, eu.getUrl)(ec.urls.teamsInfo);
return await (0, z.getWithToken)(t, e);
}
async function eT(e) {
ed.info("exchangeCode");
let t = (0, eu.getUrl)(ec.urls.memberVerification);
return await (0, z.getWithToken)(t, { code: e });
}
async function eR(e) {
ed.info("checkInviteLink");
let t = (0, eu.getUrl)(ec.urls.activityReferralVerify);
return await (0, z.postWithToken)(t, { referralCode: e });
}
async function ek(e) {
ed.info("checkCompensation");
let t = (0, eu.getUrl)(ec.urls.specialBenefitCheckCompensation);
return await (0, z.postWithToken)(t, e);
}
async function eA(e) {
ed.info("acquireCompensation");
let t = (0, eu.getUrl)(ec.urls.specialBenefitAcquireCompensation);
return await (0, z.postWithToken)(t, e);
}
async function eB(e) {
ed.info("getActivityBenefitList");
let t = JSON.stringify(e ?? {}),
r = ep.get(t);
if (r) return r;
let a = (0, eu.getUrl)(ec.urls.activityBenefitList),
i = (0, z.getWithToken)(a, e ?? {}).finally(() => {
ep.delete(t);
});
return ep.set(t, i), i;
}
async function eO(e) {
ed.info("getInviteCode");
let t = (0, eu.getUrl)(ec.urls.inviteFissionCodeGet);
return await (0, z.getWithToken)(t, { batchNo: e });
}
e.s(
[
"TEAM_FISSION_BATCH_NO",
0,
"TEAM_FISSION_2026",
"acquireCompensation",
() => eA,
"appendSeatsRequest",
() => eC,
"changeAccountSource",
() => eb,
"checkCompensation",
() => ek,
"checkInviteLink",
() => eR,
"claimLibtvFreePower",
() => ev,
"exchangeCode",
() => eT,
"getActivityBenefitList",
() => eB,
"getInviteCode",
() => eO,
"getLateMemberAcountInfo",
() => em,
"getMemberPackages",
() => eh,
"getMemberPurchaseInfo",
() => ew,
"getModelPointsCardList",
() => ey,
"getPowerList",
() => ef,
"getPriceNum",
() => eE,
"getPruchase",
() => eL,
"getTeamMemberPurchaseInfo",
() => eP,
"getTeams",
() => eS,
"payResultInfo",
() => eI,
],
373518,
);
var e_ = e.i(780135),
eM = e.i(944119),
eF = (((l = {}).NEW_USER_DISCOUNT = "NEW_USER_DISCOUNT"), l);
let eU = (0, e_.create)()(
(0, eM.devtools)((e, t) => ({
wxPayConfig: void 0,
vipInfo: null,
teamInfo: null,
teamInfoLoadState: "idle",
inTimelimit: { timeLimitedDiscount: !1 },
reportLevel: void 0,
userBenefits: [],
rateLimitBenefitStatus: null,
promptActivityConfig: { visible: !1, activityTips: "" },
Retain: !1,
countDown: 0,
rateLimitBenefitList: [],
setRetain: (t) => {
e({ Retain: t });
},
setCountDown: (t) => {
e({ countDown: t });
},
setInTimelimit: (t) => {
e({ inTimelimit: t });
},
setRateLimitBenefitStatus: (t) => {
e({ rateLimitBenefitStatus: t });
},
setVipInfoState: (t) => {
e({
vipInfo: t,
reportLevel: ((e) => {
if (e)
if (e.effective) return e.accountLevel;
else if (!e.tradeId) return 5;
else if (e?.accountLevel > 1) return 6;
else return 4;
})(t),
}),
console.info("vip state updated", t);
},
updatePromptActivity: (t) => {
e({ promptActivityConfig: t });
},
syncTeamInfo: async () => {
let { vipInfo: r } = t();
if (r?.teamId) {
e({ teamInfoLoadState: "loading" });
let t = await eS({ teamId: r?.teamId });
t && 0 === t.code
? e({ teamInfoLoadState: "success", teamInfo: t.data })
: e({ teamInfoLoadState: "error" });
}
},
syncVipInfo: async () => {
let {
syncTeamInfo: r,
syncUserBenefits: a,
syncRateLimitBenefitList: i,
} = t(),
o = await em({ isApp: _() });
if ((a(), i(), o?.data)) {
try {
o.data.attr.usablePriority;
} catch (e) {}
e({ vipInfo: o.data }),
setTimeout(() => {
r();
}, 0);
}
},
syncUserBenefits: async () => {
let t = j.isTV ? { productTypes: "3" } : { productTypes: "2" },
r = await ea(t);
r?.data?.list &&
e({
userBenefits: r.data.list,
rateLimitBenefitStatus: r.data.rateLimitBenefitStatus,
});
},
syncRateLimitBenefitList: async () => {
let t = await el();
t?.data?.list && e({ rateLimitBenefitList: t.data.list });
},
})),
),
eD = (0, e_.create)()(
(0, eM.devtools)((e) => ({
visible: !1,
createNewTeamModalVisible: !1,
intent: "initial_purchase",
setVisible: (t, r) => {
e({ visible: t, intent: r });
},
setIntent: (t) => {
e({ intent: t });
},
})),
);
e.s(
[
"DISCOUNT_TYPE",
() => eF,
"useTeamVipPurchaseModalStore",
0,
eD,
"useUserVipInfo",
0,
eU,
"vipInfoStore",
0,
eU,
],
185264,
);
};
export default moduleFactory;