markpdfdown 0.3.1 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7096,16 +7096,16 @@ function createHashHistory(options = {}) {
7096
7096
  options
7097
7097
  );
7098
7098
  }
7099
- function invariant(value, message) {
7099
+ function invariant(value, message2) {
7100
7100
  if (value === false || value === null || typeof value === "undefined") {
7101
- throw new Error(message);
7101
+ throw new Error(message2);
7102
7102
  }
7103
7103
  }
7104
- function warning$3(cond, message) {
7104
+ function warning$3(cond, message2) {
7105
7105
  if (!cond) {
7106
- if (typeof console !== "undefined") console.warn(message);
7106
+ if (typeof console !== "undefined") console.warn(message2);
7107
7107
  try {
7108
- throw new Error(message);
7108
+ throw new Error(message2);
7109
7109
  } catch (e2) {
7110
7110
  }
7111
7111
  }
@@ -8000,7 +8000,7 @@ Please change the parent <Route path="${parentPath}"> to <Route path="${parentPa
8000
8000
  }
8001
8001
  function DefaultErrorComponent() {
8002
8002
  let error = useRouteError();
8003
- let message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
8003
+ let message2 = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
8004
8004
  let stack = error instanceof Error ? error.stack : null;
8005
8005
  let lightgrey = "rgba(200,200,200, 0.5)";
8006
8006
  let preStyles = { padding: "0.5rem", backgroundColor: lightgrey };
@@ -8013,7 +8013,7 @@ function DefaultErrorComponent() {
8013
8013
  );
8014
8014
  devInfo = /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement("p", null, "💿 Hey developer 👋"), /* @__PURE__ */ reactExports.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ reactExports.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ reactExports.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route."));
8015
8015
  }
8016
- return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ reactExports.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? /* @__PURE__ */ reactExports.createElement("pre", { style: preStyles }, stack) : null, devInfo);
8016
+ return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, /* @__PURE__ */ reactExports.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ reactExports.createElement("h3", { style: { fontStyle: "italic" } }, message2), stack ? /* @__PURE__ */ reactExports.createElement("pre", { style: preStyles }, stack) : null, devInfo);
8017
8017
  }
8018
8018
  var defaultErrorElement = /* @__PURE__ */ reactExports.createElement(DefaultErrorComponent, null);
8019
8019
  var RenderErrorBoundary = class extends reactExports.Component {
@@ -8319,10 +8319,10 @@ function useNavigateStable() {
8319
8319
  return navigate;
8320
8320
  }
8321
8321
  var alreadyWarned$1 = {};
8322
- function warningOnce$1(key, cond, message) {
8322
+ function warningOnce$1(key, cond, message2) {
8323
8323
  if (!cond && !alreadyWarned$1[key]) {
8324
8324
  alreadyWarned$1[key] = true;
8325
- warning$3(false, message);
8325
+ warning$3(false, message2);
8326
8326
  }
8327
8327
  }
8328
8328
  reactExports.memo(DataRoutes);
@@ -8563,9 +8563,9 @@ function getFormSubmissionInfo(target, basename2) {
8563
8563
  return { action, method: method4.toLowerCase(), encType, formData, body };
8564
8564
  }
8565
8565
  Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
8566
- function invariant2(value, message) {
8566
+ function invariant2(value, message2) {
8567
8567
  if (value === false || value === null || typeof value === "undefined") {
8568
- throw new Error(message);
8568
+ throw new Error(message2);
8569
8569
  }
8570
8570
  }
8571
8571
  function singleFetchUrl(reqUrl, basename2, trailingSlashAware, extension2) {
@@ -9463,24 +9463,24 @@ function toArray$7(children) {
9463
9463
  var warned = {};
9464
9464
  var preMessage = function preMessage2(fn) {
9465
9465
  };
9466
- function warning$2(valid2, message) {
9466
+ function warning$2(valid2, message2) {
9467
9467
  }
9468
- function note(valid2, message) {
9468
+ function note(valid2, message2) {
9469
9469
  }
9470
9470
  function resetWarned() {
9471
9471
  warned = {};
9472
9472
  }
9473
- function call(method4, valid2, message) {
9474
- if (!valid2 && !warned[message]) {
9475
- method4(false, message);
9476
- warned[message] = true;
9473
+ function call(method4, valid2, message2) {
9474
+ if (!valid2 && !warned[message2]) {
9475
+ method4(false, message2);
9476
+ warned[message2] = true;
9477
9477
  }
9478
9478
  }
9479
- function warningOnce(valid2, message) {
9480
- call(warning$2, valid2, message);
9479
+ function warningOnce(valid2, message2) {
9480
+ call(warning$2, valid2, message2);
9481
9481
  }
9482
- function noteOnce(valid2, message) {
9483
- call(note, valid2, message);
9482
+ function noteOnce(valid2, message2) {
9483
+ call(note, valid2, message2);
9484
9484
  }
9485
9485
  warningOnce.preMessage = preMessage;
9486
9486
  warningOnce.resetWarned = resetWarned;
@@ -14271,7 +14271,7 @@ function getAlphaColor$1(frontColor, backgroundColor) {
14271
14271
  a: 1
14272
14272
  }).toRgbString();
14273
14273
  }
14274
- var __rest$1a = function(s2, e2) {
14274
+ var __rest$1b = function(s2, e2) {
14275
14275
  var t2 = {};
14276
14276
  for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2];
14277
14277
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) {
@@ -14282,7 +14282,7 @@ var __rest$1a = function(s2, e2) {
14282
14282
  function formatToken(derivativeToken) {
14283
14283
  const {
14284
14284
  override
14285
- } = derivativeToken, restToken = __rest$1a(derivativeToken, ["override"]);
14285
+ } = derivativeToken, restToken = __rest$1b(derivativeToken, ["override"]);
14286
14286
  const overrideTokens = Object.assign({}, override);
14287
14287
  Object.keys(seedToken).forEach((token2) => {
14288
14288
  delete overrideTokens[token2];
@@ -14436,7 +14436,7 @@ function formatToken(derivativeToken) {
14436
14436
  }), overrideTokens);
14437
14437
  return aliasToken;
14438
14438
  }
14439
- var __rest$19 = function(s2, e2) {
14439
+ var __rest$1a = function(s2, e2) {
14440
14440
  var t2 = {};
14441
14441
  for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2];
14442
14442
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) {
@@ -14486,7 +14486,7 @@ const getComputedToken = (originToken, overrideToken, theme2) => {
14486
14486
  const derivativeToken = theme2.getDerivativeToken(originToken);
14487
14487
  const {
14488
14488
  override
14489
- } = overrideToken, components = __rest$19(overrideToken, ["override"]);
14489
+ } = overrideToken, components = __rest$1a(overrideToken, ["override"]);
14490
14490
  let mergedDerivativeToken = Object.assign(Object.assign({}, derivativeToken), {
14491
14491
  override
14492
14492
  });
@@ -14495,7 +14495,7 @@ const getComputedToken = (originToken, overrideToken, theme2) => {
14495
14495
  Object.entries(components).forEach(([key, value]) => {
14496
14496
  const {
14497
14497
  theme: componentTheme
14498
- } = value, componentTokens = __rest$19(value, ["theme"]);
14498
+ } = value, componentTokens = __rest$1a(value, ["theme"]);
14499
14499
  let mergedComponentToken = componentTokens;
14500
14500
  if (componentTheme) {
14501
14501
  mergedComponentToken = getComputedToken(Object.assign(Object.assign({}, mergedDerivativeToken), componentTokens), {
@@ -15438,7 +15438,7 @@ function MotionWrapper(props) {
15438
15438
  return children;
15439
15439
  }
15440
15440
  const PropWarning = () => null;
15441
- var __rest$18 = function(s2, e2) {
15441
+ var __rest$19 = function(s2, e2) {
15442
15442
  var t2 = {};
15443
15443
  for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2];
15444
15444
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) {
@@ -15557,7 +15557,7 @@ const ProviderChildren = (props) => {
15557
15557
  switch: SWITCH,
15558
15558
  transfer,
15559
15559
  avatar,
15560
- message,
15560
+ message: message2,
15561
15561
  tag,
15562
15562
  table: table2,
15563
15563
  card,
@@ -15649,7 +15649,7 @@ const ProviderChildren = (props) => {
15649
15649
  switch: SWITCH,
15650
15650
  transfer,
15651
15651
  avatar,
15652
- message,
15652
+ message: message2,
15653
15653
  tag,
15654
15654
  table: table2,
15655
15655
  card,
@@ -15741,7 +15741,7 @@ const ProviderChildren = (props) => {
15741
15741
  token: token2,
15742
15742
  components,
15743
15743
  cssVar
15744
- } = _a, rest2 = __rest$18(_a, ["algorithm", "token", "components", "cssVar"]);
15744
+ } = _a, rest2 = __rest$19(_a, ["algorithm", "token", "components", "cssVar"]);
15745
15745
  const themeObj = algorithm && (!Array.isArray(algorithm) || algorithm.length > 0) ? createTheme(algorithm) : defaultTheme;
15746
15746
  const parsedComponents = {};
15747
15747
  Object.entries(components || {}).forEach(([componentName, componentToken]) => {
@@ -15819,8 +15819,8 @@ function camelCase(input) {
15819
15819
  return g.toUpperCase();
15820
15820
  });
15821
15821
  }
15822
- function warning$1(valid2, message) {
15823
- warningOnce(valid2, "[@ant-design/icons] ".concat(message));
15822
+ function warning$1(valid2, message2) {
15823
+ warningOnce(valid2, "[@ant-design/icons] ".concat(message2));
15824
15824
  }
15825
15825
  function isIconDefinition(target) {
15826
15826
  return _typeof$1(target) === "object" && typeof target.name === "string" && typeof target.theme === "string" && (_typeof$1(target.icon) === "object" || typeof target.icon === "function");
@@ -16245,7 +16245,7 @@ const prepareComponentToken$w = (token2) => {
16245
16245
  };
16246
16246
  };
16247
16247
  const useStyle$G = genStyleHooks("Alert", (token2) => [genBaseStyle$b(token2), genTypeStyle(token2), genActionStyle(token2)], prepareComponentToken$w);
16248
- var __rest$17 = function(s2, e2) {
16248
+ var __rest$18 = function(s2, e2) {
16249
16249
  var t2 = {};
16250
16250
  for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2];
16251
16251
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) {
@@ -16297,7 +16297,7 @@ const Alert$1 = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
16297
16297
  const {
16298
16298
  description,
16299
16299
  prefixCls: customizePrefixCls,
16300
- message,
16300
+ message: message2,
16301
16301
  banner,
16302
16302
  className,
16303
16303
  rootClassName,
@@ -16312,7 +16312,7 @@ const Alert$1 = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
16312
16312
  closeIcon,
16313
16313
  action,
16314
16314
  id
16315
- } = props, otherProps = __rest$17(props, ["description", "prefixCls", "message", "banner", "className", "rootClassName", "style", "onMouseEnter", "onMouseLeave", "onClick", "afterClose", "showIcon", "closable", "closeText", "closeIcon", "action", "id"]);
16315
+ } = props, otherProps = __rest$18(props, ["description", "prefixCls", "message", "banner", "className", "rootClassName", "style", "onMouseEnter", "onMouseLeave", "onClick", "afterClose", "showIcon", "closable", "closeText", "closeIcon", "action", "id"]);
16316
16316
  const [closed, setClosed] = reactExports.useState(false);
16317
16317
  const internalRef = reactExports.useRef(null);
16318
16318
  reactExports.useImperativeHandle(ref, () => ({
@@ -16385,7 +16385,7 @@ const Alert$1 = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
16385
16385
  if (typeof merged === "object") {
16386
16386
  const {
16387
16387
  closeIcon: _2
16388
- } = merged, ariaProps = __rest$17(merged, ["closeIcon"]);
16388
+ } = merged, ariaProps = __rest$18(merged, ["closeIcon"]);
16389
16389
  return ariaProps;
16390
16390
  }
16391
16391
  return {};
@@ -16419,9 +16419,9 @@ const Alert$1 = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
16419
16419
  type: type4
16420
16420
  }) : null, /* @__PURE__ */ reactExports.createElement("div", {
16421
16421
  className: `${prefixCls}-content`
16422
- }, message ? /* @__PURE__ */ reactExports.createElement("div", {
16422
+ }, message2 ? /* @__PURE__ */ reactExports.createElement("div", {
16423
16423
  className: `${prefixCls}-message`
16424
- }, message) : null, description ? /* @__PURE__ */ reactExports.createElement("div", {
16424
+ }, message2) : null, description ? /* @__PURE__ */ reactExports.createElement("div", {
16425
16425
  className: `${prefixCls}-description`
16426
16426
  }, description) : null), action ? /* @__PURE__ */ reactExports.createElement("div", {
16427
16427
  className: `${prefixCls}-action`
@@ -16462,7 +16462,7 @@ let ErrorBoundary = /* @__PURE__ */ (function(_React$Component) {
16462
16462
  key: "render",
16463
16463
  value: function render10() {
16464
16464
  const {
16465
- message,
16465
+ message: message2,
16466
16466
  description,
16467
16467
  id,
16468
16468
  children
@@ -16472,7 +16472,7 @@ let ErrorBoundary = /* @__PURE__ */ (function(_React$Component) {
16472
16472
  info
16473
16473
  } = this.state;
16474
16474
  const componentStack = (info === null || info === void 0 ? void 0 : info.componentStack) || null;
16475
- const errorMessage = typeof message === "undefined" ? (error || "").toString() : message;
16475
+ const errorMessage = typeof message2 === "undefined" ? (error || "").toString() : message2;
16476
16476
  const errorDescription = typeof description === "undefined" ? componentStack : description;
16477
16477
  if (error) {
16478
16478
  return /* @__PURE__ */ reactExports.createElement(Alert$1, {
@@ -17060,7 +17060,7 @@ var Notifications = /* @__PURE__ */ reactExports.forwardRef(function(props, ref)
17060
17060
  close: function close2(key) {
17061
17061
  onNoticeClose(key);
17062
17062
  },
17063
- destroy: function destroy() {
17063
+ destroy: function destroy2() {
17064
17064
  setConfigList([]);
17065
17065
  }
17066
17066
  };
@@ -17162,7 +17162,7 @@ function useNotification$1() {
17162
17162
  stack,
17163
17163
  renderNotifications: renderNotifications2
17164
17164
  });
17165
- var _React$useState3 = reactExports.useState([]), _React$useState4 = _slicedToArray(_React$useState3, 2), taskQueue = _React$useState4[0], setTaskQueue = _React$useState4[1];
17165
+ var _React$useState3 = reactExports.useState([]), _React$useState4 = _slicedToArray(_React$useState3, 2), taskQueue2 = _React$useState4[0], setTaskQueue = _React$useState4[1];
17166
17166
  var open2 = useEvent(function(config) {
17167
17167
  var mergedConfig = mergeConfig(shareConfig, config);
17168
17168
  if (mergedConfig.key === null || mergedConfig.key === void 0) {
@@ -17187,7 +17187,7 @@ function useNotification$1() {
17187
17187
  }]);
17188
17188
  });
17189
17189
  },
17190
- destroy: function destroy() {
17190
+ destroy: function destroy2() {
17191
17191
  setTaskQueue(function(queue) {
17192
17192
  return [].concat(_toConsumableArray(queue), [{
17193
17193
  type: "destroy"
@@ -17200,8 +17200,8 @@ function useNotification$1() {
17200
17200
  setContainer(getContainer2());
17201
17201
  });
17202
17202
  reactExports.useEffect(function() {
17203
- if (notificationsRef.current && taskQueue.length) {
17204
- taskQueue.forEach(function(task) {
17203
+ if (notificationsRef.current && taskQueue2.length) {
17204
+ taskQueue2.forEach(function(task) {
17205
17205
  switch (task.type) {
17206
17206
  case "open":
17207
17207
  notificationsRef.current.open(task.config);
@@ -17220,13 +17220,13 @@ function useNotification$1() {
17220
17220
  if (oriTaskQueue !== oriQueue || !tgtTaskQueue) {
17221
17221
  oriTaskQueue = oriQueue;
17222
17222
  tgtTaskQueue = oriQueue.filter(function(task) {
17223
- return !taskQueue.includes(task);
17223
+ return !taskQueue2.includes(task);
17224
17224
  });
17225
17225
  }
17226
17226
  return tgtTaskQueue;
17227
17227
  });
17228
17228
  }
17229
- }, [taskQueue]);
17229
+ }, [taskQueue2]);
17230
17230
  return [api, contextHolder];
17231
17231
  }
17232
17232
  var LoadingOutlined$1 = { "icon": { "tag": "svg", "attrs": { "viewBox": "0 0 1024 1024", "focusable": "false" }, "children": [{ "tag": "path", "attrs": { "d": "M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z" } }] }, "name": "loading", "theme": "outlined" };
@@ -17607,14 +17607,14 @@ const useStyle$F = genStyleHooks("Message", (token2) => {
17607
17607
  });
17608
17608
  return genMessageStyle(combinedToken);
17609
17609
  }, prepareComponentToken$v);
17610
- (function(s2, e2) {
17610
+ var __rest$17 = function(s2, e2) {
17611
17611
  var t2 = {};
17612
17612
  for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2];
17613
17613
  if (s2 != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) {
17614
17614
  if (e2.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i])) t2[p2[i]] = s2[p2[i]];
17615
17615
  }
17616
17616
  return t2;
17617
- });
17617
+ };
17618
17618
  const TypeIcon = {
17619
17619
  info: /* @__PURE__ */ reactExports.createElement(RefIcon$$, null),
17620
17620
  success: /* @__PURE__ */ reactExports.createElement(RefIcon$13, null),
@@ -17630,6 +17630,32 @@ const PureContent$1 = ({
17630
17630
  }) => /* @__PURE__ */ reactExports.createElement("div", {
17631
17631
  className: classNames(`${prefixCls}-custom-content`, `${prefixCls}-${type4}`)
17632
17632
  }, icon2 || TypeIcon[type4], /* @__PURE__ */ reactExports.createElement("span", null, children));
17633
+ const PurePanel$6 = (props) => {
17634
+ const {
17635
+ prefixCls: staticPrefixCls,
17636
+ className,
17637
+ type: type4,
17638
+ icon: icon2,
17639
+ content: content2
17640
+ } = props, restProps = __rest$17(props, ["prefixCls", "className", "type", "icon", "content"]);
17641
+ const {
17642
+ getPrefixCls
17643
+ } = reactExports.useContext(ConfigContext);
17644
+ const prefixCls = staticPrefixCls || getPrefixCls("message");
17645
+ const rootCls = useCSSVarCls(prefixCls);
17646
+ const [wrapCSSVar, hashId, cssVarCls] = useStyle$F(prefixCls, rootCls);
17647
+ return wrapCSSVar(/* @__PURE__ */ reactExports.createElement(Notify, Object.assign({}, restProps, {
17648
+ prefixCls,
17649
+ className: classNames(className, hashId, `${prefixCls}-notice-pure-panel`, cssVarCls, rootCls),
17650
+ eventKey: "pure",
17651
+ duration: null,
17652
+ content: /* @__PURE__ */ reactExports.createElement(PureContent$1, {
17653
+ prefixCls,
17654
+ type: type4,
17655
+ icon: icon2
17656
+ }, content2)
17657
+ })));
17658
+ };
17633
17659
  function getMotion$3(prefixCls, transitionName) {
17634
17660
  return {
17635
17661
  motionName: transitionName !== null && transitionName !== void 0 ? transitionName : `${prefixCls}-move-up`
@@ -17692,7 +17718,7 @@ const Holder$1 = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
17692
17718
  const {
17693
17719
  getPrefixCls,
17694
17720
  getPopupContainer,
17695
- message,
17721
+ message: message2,
17696
17722
  direction
17697
17723
  } = reactExports.useContext(ConfigContext);
17698
17724
  const prefixCls = staticPrefixCls || getPrefixCls("message");
@@ -17725,7 +17751,7 @@ const Holder$1 = /* @__PURE__ */ reactExports.forwardRef((props, ref) => {
17725
17751
  });
17726
17752
  reactExports.useImperativeHandle(ref, () => Object.assign(Object.assign({}, api), {
17727
17753
  prefixCls,
17728
- message
17754
+ message: message2
17729
17755
  }));
17730
17756
  return holder;
17731
17757
  });
@@ -17749,7 +17775,7 @@ function useInternalMessage(messageConfig) {
17749
17775
  const {
17750
17776
  open: originOpen,
17751
17777
  prefixCls,
17752
- message
17778
+ message: message2
17753
17779
  } = holderRef.current;
17754
17780
  const noticePrefixCls = `${prefixCls}-notice`;
17755
17781
  const {
@@ -17775,8 +17801,8 @@ function useInternalMessage(messageConfig) {
17775
17801
  icon: icon2
17776
17802
  }, content2),
17777
17803
  placement: "top",
17778
- className: classNames(type4 && `${noticePrefixCls}-${type4}`, className, message === null || message === void 0 ? void 0 : message.className),
17779
- style: Object.assign(Object.assign({}, message === null || message === void 0 ? void 0 : message.style), style2),
17804
+ className: classNames(type4 && `${noticePrefixCls}-${type4}`, className, message2 === null || message2 === void 0 ? void 0 : message2.className),
17805
+ style: Object.assign(Object.assign({}, message2 === null || message2 === void 0 ? void 0 : message2.style), style2),
17780
17806
  onClose: () => {
17781
17807
  onClose === null || onClose === void 0 ? void 0 : onClose();
17782
17808
  resolve();
@@ -17787,7 +17813,7 @@ function useInternalMessage(messageConfig) {
17787
17813
  };
17788
17814
  });
17789
17815
  };
17790
- const destroy = (key) => {
17816
+ const destroy2 = (key) => {
17791
17817
  var _a;
17792
17818
  if (key !== void 0) {
17793
17819
  close2(key);
@@ -17797,11 +17823,11 @@ function useInternalMessage(messageConfig) {
17797
17823
  };
17798
17824
  const clone = {
17799
17825
  open: open2,
17800
- destroy
17826
+ destroy: destroy2
17801
17827
  };
17802
17828
  const keys2 = ["info", "success", "warning", "error", "loading"];
17803
17829
  keys2.forEach((type4) => {
17804
- const typeOpen = (jointContent, duration, onClose) => {
17830
+ const typeOpen2 = (jointContent, duration, onClose) => {
17805
17831
  let config;
17806
17832
  if (jointContent && typeof jointContent === "object" && "content" in jointContent) {
17807
17833
  config = jointContent;
@@ -17826,7 +17852,7 @@ function useInternalMessage(messageConfig) {
17826
17852
  });
17827
17853
  return open2(mergedConfig);
17828
17854
  };
17829
- clone[type4] = typeOpen;
17855
+ clone[type4] = typeOpen2;
17830
17856
  });
17831
17857
  return clone;
17832
17858
  }, []);
@@ -22420,8 +22446,8 @@ function _validateRule() {
22420
22446
  _context2.t0 = _context2["catch"](10);
22421
22447
  if (_context2.t0.errors) {
22422
22448
  result = _context2.t0.errors.map(function(_ref4, index2) {
22423
- var message = _ref4.message;
22424
- var mergedMessage = message === CODE_LOGIC_ERROR ? messages2.default : message;
22449
+ var message2 = _ref4.message;
22450
+ var mergedMessage = message2 === CODE_LOGIC_ERROR ? messages2.default : message2;
22425
22451
  return /* @__PURE__ */ reactExports.isValidElement(mergedMessage) ? (
22426
22452
  // Wrap ReactNode with `key`
22427
22453
  /* @__PURE__ */ reactExports.cloneElement(mergedMessage, {
@@ -22755,11 +22781,11 @@ var Field = /* @__PURE__ */ (function(_React$Component) {
22755
22781
  });
22756
22782
  });
22757
22783
  _defineProperty(_assertThisInitialized(_this), "metaCache", null);
22758
- _defineProperty(_assertThisInitialized(_this), "triggerMetaEvent", function(destroy) {
22784
+ _defineProperty(_assertThisInitialized(_this), "triggerMetaEvent", function(destroy2) {
22759
22785
  var onMetaChange = _this.props.onMetaChange;
22760
22786
  if (onMetaChange) {
22761
22787
  var _meta = _objectSpread2(_objectSpread2({}, _this.getMeta()), {}, {
22762
- destroy
22788
+ destroy: destroy2
22763
22789
  });
22764
22790
  if (!isEqual(_this.metaCache, _meta)) {
22765
22791
  onMetaChange(_meta);
@@ -26032,7 +26058,7 @@ function confirm(config) {
26032
26058
  });
26033
26059
  let timeoutId;
26034
26060
  let reactUnmount;
26035
- function destroy(...args) {
26061
+ function destroy2(...args) {
26036
26062
  var _a;
26037
26063
  const triggerCancel = args.some((param) => param === null || param === void 0 ? void 0 : param.triggerCancel);
26038
26064
  if (triggerCancel) {
@@ -26071,7 +26097,7 @@ function confirm(config) {
26071
26097
  if (typeof config.afterClose === "function") {
26072
26098
  config.afterClose();
26073
26099
  }
26074
- destroy.apply(this, args);
26100
+ destroy2.apply(this, args);
26075
26101
  }
26076
26102
  });
26077
26103
  if (currentConfig.visible) {
@@ -26747,7 +26773,7 @@ const PureContent = (props) => {
26747
26773
  prefixCls,
26748
26774
  icon: icon2,
26749
26775
  type: type4,
26750
- message,
26776
+ message: message2,
26751
26777
  description,
26752
26778
  actions: actions2,
26753
26779
  role = "alert"
@@ -26769,7 +26795,7 @@ const PureContent = (props) => {
26769
26795
  role
26770
26796
  }, iconNode, /* @__PURE__ */ reactExports.createElement("div", {
26771
26797
  className: `${prefixCls}-message`
26772
- }, message), description && /* @__PURE__ */ reactExports.createElement("div", {
26798
+ }, message2), description && /* @__PURE__ */ reactExports.createElement("div", {
26773
26799
  className: `${prefixCls}-description`
26774
26800
  }, description), actions2 && /* @__PURE__ */ reactExports.createElement("div", {
26775
26801
  className: `${prefixCls}-actions`
@@ -26940,7 +26966,7 @@ function useInternalNotification(notificationConfig) {
26940
26966
  } = holderRef.current;
26941
26967
  const noticePrefixCls = `${prefixCls}-notice`;
26942
26968
  const {
26943
- message,
26969
+ message: message2,
26944
26970
  description,
26945
26971
  icon: icon2,
26946
26972
  type: type4,
@@ -26962,7 +26988,7 @@ function useInternalNotification(notificationConfig) {
26962
26988
  prefixCls: noticePrefixCls,
26963
26989
  icon: icon2,
26964
26990
  type: type4,
26965
- message,
26991
+ message: message2,
26966
26992
  description,
26967
26993
  actions: mergedActions,
26968
26994
  role
@@ -26973,7 +26999,7 @@ function useInternalNotification(notificationConfig) {
26973
26999
  closable: closable !== null && closable !== void 0 ? closable : !!realCloseIcon
26974
27000
  }));
26975
27001
  };
26976
- const destroy = (key) => {
27002
+ const destroy2 = (key) => {
26977
27003
  var _a, _b;
26978
27004
  if (key !== void 0) {
26979
27005
  (_a = holderRef.current) === null || _a === void 0 ? void 0 : _a.close(key);
@@ -26983,7 +27009,7 @@ function useInternalNotification(notificationConfig) {
26983
27009
  };
26984
27010
  const clone = {
26985
27011
  open: open2,
26986
- destroy
27012
+ destroy: destroy2
26987
27013
  };
26988
27014
  const keys2 = ["success", "info", "warning", "error"];
26989
27015
  keys2.forEach((type4) => {
@@ -27036,7 +27062,7 @@ const App$2 = (props) => {
27036
27062
  children,
27037
27063
  className,
27038
27064
  rootClassName,
27039
- message,
27065
+ message: message2,
27040
27066
  notification,
27041
27067
  style: style2,
27042
27068
  component = "div"
@@ -27052,9 +27078,9 @@ const App$2 = (props) => {
27052
27078
  });
27053
27079
  const appConfig = reactExports.useContext(AppConfigContext);
27054
27080
  const mergedAppConfig = React.useMemo(() => ({
27055
- message: Object.assign(Object.assign({}, appConfig.message), message),
27081
+ message: Object.assign(Object.assign({}, appConfig.message), message2),
27056
27082
  notification: Object.assign(Object.assign({}, appConfig.notification), notification)
27057
- }), [message, notification, appConfig.message, appConfig.notification]);
27083
+ }), [message2, notification, appConfig.message, appConfig.notification]);
27058
27084
  const [messageApi, messageContextHolder] = useMessage(mergedAppConfig.message);
27059
27085
  const [notificationApi, notificationContextHolder] = useNotification(mergedAppConfig.notification);
27060
27086
  const [ModalApi, ModalContextHolder] = useModal();
@@ -36875,7 +36901,7 @@ function InlineSubMenuList(_ref) {
36875
36901
  var _React$useContext = reactExports.useContext(MenuContext$1), prefixCls = _React$useContext.prefixCls, forceSubMenuRender = _React$useContext.forceSubMenuRender, motion2 = _React$useContext.motion, defaultMotions = _React$useContext.defaultMotions, mode = _React$useContext.mode;
36876
36902
  var sameModeRef = reactExports.useRef(false);
36877
36903
  sameModeRef.current = mode === fixedMode;
36878
- var _React$useState = reactExports.useState(!sameModeRef.current), _React$useState2 = _slicedToArray(_React$useState, 2), destroy = _React$useState2[0], setDestroy = _React$useState2[1];
36904
+ var _React$useState = reactExports.useState(!sameModeRef.current), _React$useState2 = _slicedToArray(_React$useState, 2), destroy2 = _React$useState2[0], setDestroy = _React$useState2[1];
36879
36905
  var mergedOpen = sameModeRef.current ? open2 : false;
36880
36906
  reactExports.useEffect(function() {
36881
36907
  if (sameModeRef.current) {
@@ -36893,7 +36919,7 @@ function InlineSubMenuList(_ref) {
36893
36919
  }
36894
36920
  return originOnVisibleChanged === null || originOnVisibleChanged === void 0 ? void 0 : originOnVisibleChanged(newVisible);
36895
36921
  };
36896
- if (destroy) {
36922
+ if (destroy2) {
36897
36923
  return null;
36898
36924
  }
36899
36925
  return /* @__PURE__ */ reactExports.createElement(InheritableContextProvider, {
@@ -52099,6 +52125,216 @@ const toList$1 = (candidate, skipEmpty = false) => {
52099
52125
  }
52100
52126
  return Array.isArray(candidate) ? candidate : [candidate];
52101
52127
  };
52128
+ let message = null;
52129
+ let act = (callback) => callback();
52130
+ let taskQueue = [];
52131
+ let defaultGlobalConfig = {};
52132
+ function getGlobalContext() {
52133
+ const {
52134
+ getContainer: getContainer2,
52135
+ duration,
52136
+ rtl,
52137
+ maxCount,
52138
+ top
52139
+ } = defaultGlobalConfig;
52140
+ const mergedContainer = (getContainer2 === null || getContainer2 === void 0 ? void 0 : getContainer2()) || document.body;
52141
+ return {
52142
+ getContainer: () => mergedContainer,
52143
+ duration,
52144
+ rtl,
52145
+ maxCount,
52146
+ top
52147
+ };
52148
+ }
52149
+ const GlobalHolder = /* @__PURE__ */ React.forwardRef((props, ref) => {
52150
+ const {
52151
+ messageConfig,
52152
+ sync
52153
+ } = props;
52154
+ const {
52155
+ getPrefixCls
52156
+ } = reactExports.useContext(ConfigContext);
52157
+ const prefixCls = defaultGlobalConfig.prefixCls || getPrefixCls("message");
52158
+ const appConfig = reactExports.useContext(AppConfigContext);
52159
+ const [api, holder] = useInternalMessage(Object.assign(Object.assign(Object.assign({}, messageConfig), {
52160
+ prefixCls
52161
+ }), appConfig.message));
52162
+ React.useImperativeHandle(ref, () => {
52163
+ const instance2 = Object.assign({}, api);
52164
+ Object.keys(instance2).forEach((method4) => {
52165
+ instance2[method4] = (...args) => {
52166
+ sync();
52167
+ return api[method4].apply(api, args);
52168
+ };
52169
+ });
52170
+ return {
52171
+ instance: instance2,
52172
+ sync
52173
+ };
52174
+ });
52175
+ return holder;
52176
+ });
52177
+ const GlobalHolderWrapper = /* @__PURE__ */ React.forwardRef((_2, ref) => {
52178
+ const [messageConfig, setMessageConfig] = React.useState(getGlobalContext);
52179
+ const sync = () => {
52180
+ setMessageConfig(getGlobalContext);
52181
+ };
52182
+ React.useEffect(sync, []);
52183
+ const global2 = globalConfig();
52184
+ const rootPrefixCls = global2.getRootPrefixCls();
52185
+ const rootIconPrefixCls = global2.getIconPrefixCls();
52186
+ const theme2 = global2.getTheme();
52187
+ const dom = /* @__PURE__ */ React.createElement(GlobalHolder, {
52188
+ ref,
52189
+ sync,
52190
+ messageConfig
52191
+ });
52192
+ return /* @__PURE__ */ React.createElement(ConfigProvider, {
52193
+ prefixCls: rootPrefixCls,
52194
+ iconPrefixCls: rootIconPrefixCls,
52195
+ theme: theme2
52196
+ }, global2.holderRender ? global2.holderRender(dom) : dom);
52197
+ });
52198
+ const flushMessageQueue = () => {
52199
+ if (!message) {
52200
+ const holderFragment = document.createDocumentFragment();
52201
+ const newMessage = {
52202
+ fragment: holderFragment
52203
+ };
52204
+ message = newMessage;
52205
+ act(() => {
52206
+ const reactRender2 = unstableSetRender();
52207
+ reactRender2(/* @__PURE__ */ React.createElement(GlobalHolderWrapper, {
52208
+ ref: (node2) => {
52209
+ const {
52210
+ instance: instance2,
52211
+ sync
52212
+ } = node2 || {};
52213
+ Promise.resolve().then(() => {
52214
+ if (!newMessage.instance && instance2) {
52215
+ newMessage.instance = instance2;
52216
+ newMessage.sync = sync;
52217
+ flushMessageQueue();
52218
+ }
52219
+ });
52220
+ }
52221
+ }), holderFragment);
52222
+ });
52223
+ return;
52224
+ }
52225
+ if (!message.instance) {
52226
+ return;
52227
+ }
52228
+ taskQueue.forEach((task) => {
52229
+ const {
52230
+ type: type4,
52231
+ skipped
52232
+ } = task;
52233
+ if (!skipped) {
52234
+ switch (type4) {
52235
+ case "open": {
52236
+ act(() => {
52237
+ const closeFn = message.instance.open(Object.assign(Object.assign({}, defaultGlobalConfig), task.config));
52238
+ closeFn === null || closeFn === void 0 ? void 0 : closeFn.then(task.resolve);
52239
+ task.setCloseFn(closeFn);
52240
+ });
52241
+ break;
52242
+ }
52243
+ case "destroy":
52244
+ act(() => {
52245
+ message === null || message === void 0 ? void 0 : message.instance.destroy(task.key);
52246
+ });
52247
+ break;
52248
+ // Other type open
52249
+ default: {
52250
+ act(() => {
52251
+ var _message$instance;
52252
+ const closeFn = (_message$instance = message.instance)[type4].apply(_message$instance, _toConsumableArray(task.args));
52253
+ closeFn === null || closeFn === void 0 ? void 0 : closeFn.then(task.resolve);
52254
+ task.setCloseFn(closeFn);
52255
+ });
52256
+ }
52257
+ }
52258
+ }
52259
+ });
52260
+ taskQueue = [];
52261
+ };
52262
+ function setMessageGlobalConfig(config) {
52263
+ defaultGlobalConfig = Object.assign(Object.assign({}, defaultGlobalConfig), config);
52264
+ act(() => {
52265
+ var _a;
52266
+ (_a = message === null || message === void 0 ? void 0 : message.sync) === null || _a === void 0 ? void 0 : _a.call(message);
52267
+ });
52268
+ }
52269
+ function open$1(config) {
52270
+ const result = wrapPromiseFn((resolve) => {
52271
+ let closeFn;
52272
+ const task = {
52273
+ type: "open",
52274
+ config,
52275
+ resolve,
52276
+ setCloseFn: (fn) => {
52277
+ closeFn = fn;
52278
+ }
52279
+ };
52280
+ taskQueue.push(task);
52281
+ return () => {
52282
+ if (closeFn) {
52283
+ act(() => {
52284
+ closeFn();
52285
+ });
52286
+ } else {
52287
+ task.skipped = true;
52288
+ }
52289
+ };
52290
+ });
52291
+ flushMessageQueue();
52292
+ return result;
52293
+ }
52294
+ function typeOpen(type4, args) {
52295
+ const result = wrapPromiseFn((resolve) => {
52296
+ let closeFn;
52297
+ const task = {
52298
+ type: type4,
52299
+ args,
52300
+ resolve,
52301
+ setCloseFn: (fn) => {
52302
+ closeFn = fn;
52303
+ }
52304
+ };
52305
+ taskQueue.push(task);
52306
+ return () => {
52307
+ if (closeFn) {
52308
+ act(() => {
52309
+ closeFn();
52310
+ });
52311
+ } else {
52312
+ task.skipped = true;
52313
+ }
52314
+ };
52315
+ });
52316
+ flushMessageQueue();
52317
+ return result;
52318
+ }
52319
+ const destroy = (key) => {
52320
+ taskQueue.push({
52321
+ type: "destroy",
52322
+ key
52323
+ });
52324
+ flushMessageQueue();
52325
+ };
52326
+ const methods = ["success", "info", "warning", "error", "loading"];
52327
+ const baseStaticMethods = {
52328
+ open: open$1,
52329
+ destroy,
52330
+ config: setMessageGlobalConfig,
52331
+ useMessage,
52332
+ _InternalPanelDoNotUseOrYouWillBeFired: PurePanel$6
52333
+ };
52334
+ const staticMethods = baseStaticMethods;
52335
+ methods.forEach((type4) => {
52336
+ staticMethods[type4] = (...args) => typeOpen(type4, args);
52337
+ });
52102
52338
  var __rest$h = function(s2, e2) {
52103
52339
  var t2 = {};
52104
52340
  for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2];
@@ -64265,12 +64501,12 @@ function requireCopyToClipboard() {
64265
64501
  "default": "Text"
64266
64502
  };
64267
64503
  var defaultMessage = "Copy to clipboard: #{key}, Enter";
64268
- function format2(message) {
64504
+ function format2(message2) {
64269
64505
  var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C";
64270
- return message.replace(/#{\s*key\s*}/g, copyKey);
64506
+ return message2.replace(/#{\s*key\s*}/g, copyKey);
64271
64507
  }
64272
64508
  function copy2(text2, options) {
64273
- var debug, message, reselectPrevious, range3, selection, mark2, success = false;
64509
+ var debug, message2, reselectPrevious, range3, selection, mark2, success = false;
64274
64510
  if (!options) {
64275
64511
  options = {};
64276
64512
  }
@@ -64329,8 +64565,8 @@ function requireCopyToClipboard() {
64329
64565
  } catch (err2) {
64330
64566
  debug && console.error("unable to copy using clipboardData: ", err2);
64331
64567
  debug && console.error("falling back to prompt");
64332
- message = format2("message" in options ? options.message : defaultMessage);
64333
- window.prompt(message, text2);
64568
+ message2 = format2("message" in options ? options.message : defaultMessage);
64569
+ window.prompt(message2, text2);
64334
64570
  }
64335
64571
  } finally {
64336
64572
  if (selection) {
@@ -66684,9 +66920,9 @@ const ListItem = /* @__PURE__ */ reactExports.forwardRef(({
66684
66920
  className: classNames(`${prefixCls}-list-item-progress`, motionClassName)
66685
66921
  }, loadingProgress);
66686
66922
  }));
66687
- const message = file.response && typeof file.response === "string" ? file.response : ((_a = file.error) === null || _a === void 0 ? void 0 : _a.statusText) || ((_b = file.error) === null || _b === void 0 ? void 0 : _b.message) || locale2.uploadError;
66923
+ const message2 = file.response && typeof file.response === "string" ? file.response : ((_a = file.error) === null || _a === void 0 ? void 0 : _a.statusText) || ((_b = file.error) === null || _b === void 0 ? void 0 : _b.message) || locale2.uploadError;
66688
66924
  const item = mergedStatus === "error" ? /* @__PURE__ */ reactExports.createElement(Tooltip2, {
66689
- title: message,
66925
+ title: message2,
66690
66926
  getPopupContainer: (node2) => node2.parentNode
66691
66927
  }, dom) : dom;
66692
66928
  return /* @__PURE__ */ reactExports.createElement("div", {
@@ -70398,7 +70634,7 @@ const getFileCategory = (fileName, fileType) => {
70398
70634
  };
70399
70635
  const UploadPanel = () => {
70400
70636
  const navigate = useNavigate();
70401
- const { message } = App$1.useApp();
70637
+ const { message: message2 } = App$1.useApp();
70402
70638
  const { t: t2 } = useTranslation("upload");
70403
70639
  const cloudContext = reactExports.useContext(CloudContext);
70404
70640
  const [fileList, setFileList] = reactExports.useState([]);
@@ -70423,7 +70659,7 @@ const UploadPanel = () => {
70423
70659
  if (result.success && result.data) {
70424
70660
  groups = result.data;
70425
70661
  } else {
70426
- message.error(result.error || t2("messages.fetch_models_failed"));
70662
+ message2.error(result.error || t2("messages.fetch_models_failed"));
70427
70663
  }
70428
70664
  const cloudGroup = {
70429
70665
  provider: CLOUD_PROVIDER_ID,
@@ -70449,7 +70685,7 @@ const UploadPanel = () => {
70449
70685
  }
70450
70686
  } catch (error) {
70451
70687
  console.error("Failed to fetch model list:", error);
70452
- message.error(
70688
+ message2.error(
70453
70689
  t2("messages.fetch_models_failed") + ": " + (error instanceof Error ? error.message : String(error))
70454
70690
  );
70455
70691
  } finally {
@@ -70457,7 +70693,7 @@ const UploadPanel = () => {
70457
70693
  }
70458
70694
  };
70459
70695
  fetchAllModels();
70460
- }, [message, t2]);
70696
+ }, [message2, t2]);
70461
70697
  const handleModelChange = (value) => {
70462
70698
  setSelectedModel(value);
70463
70699
  localStorage.setItem(SELECTED_MODEL_KEY, value);
@@ -70517,10 +70753,10 @@ const UploadPanel = () => {
70517
70753
  });
70518
70754
  });
70519
70755
  if (rejectedUnsupportedFiles.length > 0) {
70520
- message.error(t2("messages.invalid_file_type", { filename: rejectedUnsupportedFiles.join(", ") }));
70756
+ message2.error(t2("messages.invalid_file_type", { filename: rejectedUnsupportedFiles.join(", ") }));
70521
70757
  }
70522
70758
  if (rejectedOfficeFiles.length > 0) {
70523
- message.error(t2("messages.office_not_supported", { filename: rejectedOfficeFiles.join(", ") }));
70759
+ message2.error(t2("messages.office_not_supported", { filename: rejectedOfficeFiles.join(", ") }));
70524
70760
  }
70525
70761
  if (newFiles.length > 0) {
70526
70762
  setFileList((prevList) => [...prevList, ...newFiles]);
@@ -70528,7 +70764,7 @@ const UploadPanel = () => {
70528
70764
  }
70529
70765
  } catch (error) {
70530
70766
  console.error("Failed to select files:", error);
70531
- message.error(
70767
+ message2.error(
70532
70768
  t2("messages.select_failed") + ": " + (error instanceof Error ? error.message : String(error))
70533
70769
  );
70534
70770
  }
@@ -70545,11 +70781,11 @@ const UploadPanel = () => {
70545
70781
  beforeUpload: (file) => {
70546
70782
  const category = getFileCategory(file.name, file.type);
70547
70783
  if (category === "unsupported") {
70548
- message.error(t2("messages.invalid_file_type", { filename: file.name }));
70784
+ message2.error(t2("messages.invalid_file_type", { filename: file.name }));
70549
70785
  return Upload.LIST_IGNORE;
70550
70786
  }
70551
70787
  if (category === "office" && !canUseOfficeFiles) {
70552
- message.error(t2("messages.office_not_supported", { filename: file.name }));
70788
+ message2.error(t2("messages.office_not_supported", { filename: file.name }));
70553
70789
  return Upload.LIST_IGNORE;
70554
70790
  }
70555
70791
  const newFile = {
@@ -70569,11 +70805,11 @@ const UploadPanel = () => {
70569
70805
  };
70570
70806
  const handleConvert = async () => {
70571
70807
  if (fileList.length === 0) {
70572
- message.error(t2("messages.no_files"));
70808
+ message2.error(t2("messages.no_files"));
70573
70809
  return;
70574
70810
  }
70575
70811
  if (!selectedModel) {
70576
- message.error(t2("messages.no_model"));
70812
+ message2.error(t2("messages.no_model"));
70577
70813
  return;
70578
70814
  }
70579
70815
  try {
@@ -70595,11 +70831,11 @@ const UploadPanel = () => {
70595
70831
  if (result.success) {
70596
70832
  successCount2++;
70597
70833
  } else {
70598
- message.error(t2("cloud.upload_failed", { filename: file.name, error: result.error }));
70834
+ message2.error(t2("cloud.upload_failed", { filename: file.name, error: result.error }));
70599
70835
  }
70600
70836
  }
70601
70837
  if (successCount2 > 0) {
70602
- message.success(t2("cloud.upload_success", { count: successCount2 }));
70838
+ message2.success(t2("cloud.upload_success", { count: successCount2 }));
70603
70839
  setFileList([]);
70604
70840
  navigate("/list", { replace: true });
70605
70841
  }
@@ -70647,7 +70883,7 @@ const UploadPanel = () => {
70647
70883
  fileContent
70648
70884
  );
70649
70885
  } else {
70650
- message.error(t2("messages.invalid_file_path", { filename: file.name }));
70886
+ message2.error(t2("messages.invalid_file_path", { filename: file.name }));
70651
70887
  await window.api.task.delete(task.id);
70652
70888
  continue;
70653
70889
  }
@@ -70658,38 +70894,38 @@ const UploadPanel = () => {
70658
70894
  if (updateResult.success) {
70659
70895
  successCount++;
70660
70896
  } else {
70661
- message.error(t2("messages.update_status_failed", { filename: file.name }));
70897
+ message2.error(t2("messages.update_status_failed", { filename: file.name }));
70662
70898
  await window.api.task.delete(task.id);
70663
70899
  }
70664
70900
  } else {
70665
- message.error(
70901
+ message2.error(
70666
70902
  t2("messages.upload_failed", { filename: file.name }) + `: ${uploadResult.error || "Unknown error"}`
70667
70903
  );
70668
70904
  await window.api.task.delete(task.id);
70669
70905
  }
70670
70906
  } catch (error) {
70671
70907
  console.error(`Failed to upload file ${file.name}:`, error);
70672
- message.error(t2("messages.upload_failed", { filename: file.name }));
70908
+ message2.error(t2("messages.upload_failed", { filename: file.name }));
70673
70909
  await window.api.task.delete(task.id);
70674
70910
  }
70675
70911
  }
70676
70912
  if (successCount > 0) {
70677
- message.success(t2("messages.tasks_created", { count: successCount }));
70913
+ message2.success(t2("messages.tasks_created", { count: successCount }));
70678
70914
  setFileList([]);
70679
70915
  navigate("/list", { replace: true });
70680
70916
  } else {
70681
- message.error(t2("messages.upload_error"));
70917
+ message2.error(t2("messages.upload_error"));
70682
70918
  }
70683
70919
  } catch (error) {
70684
70920
  console.error("Failed to upload files:", error);
70685
- message.error(
70921
+ message2.error(
70686
70922
  t2("messages.upload_error") + ": " + (error instanceof Error ? error.message : String(error))
70687
70923
  );
70688
70924
  } finally {
70689
70925
  setUploading(false);
70690
70926
  }
70691
70927
  };
70692
- return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
70928
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "home-upload-panel", children: [
70693
70929
  /* @__PURE__ */ jsxRuntimeExports.jsx(Row, { style: { display: "block", marginTop: "32px" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: 24, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Dragger2, { ...props, style: { minWidth: "760px" }, children: [
70694
70930
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "ant-upload-drag-icon", children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$c, {}) }),
70695
70931
  /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "ant-upload-text", children: t2("dragger.text") }),
@@ -70848,6 +71084,7 @@ function mapCloudTaskToTask(ct) {
70848
71084
  progress = 100;
70849
71085
  } else if (pageCount > 0) {
70850
71086
  progress = Math.round(pagesCompleted / pageCount * 100);
71087
+ progress = Math.max(0, Math.min(100, progress));
70851
71088
  }
70852
71089
  let type4 = ct.file_type;
70853
71090
  if (ct.file_type === "office") {
@@ -70872,6 +71109,9 @@ function mapCloudTaskToTask(ct) {
70872
71109
  status: ct.status,
70873
71110
  completed_count: pagesCompleted,
70874
71111
  failed_count: ct.pages_failed || 0,
71112
+ error: ct.error_message || ct.description || null,
71113
+ description: ct.description,
71114
+ error_message: ct.error_message,
70875
71115
  isCloud: true,
70876
71116
  sortTimestamp
70877
71117
  };
@@ -70881,7 +71121,7 @@ function mapCloudTasksToTasks(cloudTasks) {
70881
71121
  }
70882
71122
  const { Text: Text$4 } = Typography;
70883
71123
  const List = () => {
70884
- const { message, modal } = App$1.useApp();
71124
+ const { message: message2, modal } = App$1.useApp();
70885
71125
  const { t: t2 } = useTranslation("list");
70886
71126
  const { t: tCommon } = useTranslation("common");
70887
71127
  const cloudContext = reactExports.useContext(CloudContext);
@@ -70916,7 +71156,7 @@ const List = () => {
70916
71156
  combinedList = [...localResult.data.list];
70917
71157
  totalCount += localResult.data.total;
70918
71158
  } else {
70919
- message.error(localResult.error || t2("messages.fetch_failed"));
71159
+ message2.error(localResult.error || t2("messages.fetch_failed"));
70920
71160
  }
70921
71161
  if (cloudResult) {
70922
71162
  if (cloudResult.success && cloudResult.data) {
@@ -70949,11 +71189,11 @@ const List = () => {
70949
71189
  }));
70950
71190
  } catch (error) {
70951
71191
  console.error("Failed to fetch task list:", error);
70952
- message.error(t2("messages.fetch_failed"));
71192
+ message2.error(t2("messages.fetch_failed"));
70953
71193
  } finally {
70954
71194
  setLoading(false);
70955
71195
  }
70956
- }, [message, t2, cloudContext]);
71196
+ }, [message2, t2, cloudContext]);
70957
71197
  const handleTaskEvent = reactExports.useCallback((event) => {
70958
71198
  const { type: type4, taskId, task } = event;
70959
71199
  console.log(`[List] Received task event: ${type4}`, { taskId, task });
@@ -71126,14 +71366,14 @@ const List = () => {
71126
71366
  result = await window.api.task.delete(id);
71127
71367
  }
71128
71368
  if (result.success) {
71129
- message.success(t2("messages.delete_success"));
71369
+ message2.success(t2("messages.delete_success"));
71130
71370
  fetchTasks(pagination.current, pagination.pageSize);
71131
71371
  } else {
71132
- message.error(result.error || t2("messages.delete_failed"));
71372
+ message2.error(result.error || t2("messages.delete_failed"));
71133
71373
  }
71134
71374
  } catch (error) {
71135
71375
  console.error("Failed to delete task:", error);
71136
- message.error(t2("messages.delete_failed"));
71376
+ message2.error(t2("messages.delete_failed"));
71137
71377
  }
71138
71378
  }
71139
71379
  });
@@ -71148,14 +71388,14 @@ const List = () => {
71148
71388
  try {
71149
71389
  const result = await window.api.task.update(id, { status: status2 });
71150
71390
  if (result.success) {
71151
- message.success(t2("messages.action_success", { action: statusText }));
71391
+ message2.success(t2("messages.action_success", { action: statusText }));
71152
71392
  fetchTasks(pagination.current, pagination.pageSize);
71153
71393
  } else {
71154
- message.error(result.error || t2("messages.action_failed", { action: statusText }));
71394
+ message2.error(result.error || t2("messages.action_failed", { action: statusText }));
71155
71395
  }
71156
71396
  } catch (error) {
71157
71397
  console.error(`Failed to ${statusText} task:`, error);
71158
- message.error(t2("messages.action_failed", { action: statusText }));
71398
+ message2.error(t2("messages.action_failed", { action: statusText }));
71159
71399
  }
71160
71400
  }
71161
71401
  });
@@ -71177,13 +71417,13 @@ const List = () => {
71177
71417
  try {
71178
71418
  const result = await cloudContext.cancelTask(id);
71179
71419
  if (result.success) {
71180
- message.success(t2("messages.action_success", { action: t2("actions.cancel") }));
71420
+ message2.success(t2("messages.action_success", { action: t2("actions.cancel") }));
71181
71421
  fetchTasks(pagination.current, pagination.pageSize);
71182
71422
  } else {
71183
- message.error(result.error || t2("messages.action_failed", { action: t2("actions.cancel") }));
71423
+ message2.error(result.error || t2("messages.action_failed", { action: t2("actions.cancel") }));
71184
71424
  }
71185
71425
  } catch {
71186
- message.error(t2("messages.action_failed", { action: t2("actions.cancel") }));
71426
+ message2.error(t2("messages.action_failed", { action: t2("actions.cancel") }));
71187
71427
  }
71188
71428
  }
71189
71429
  });
@@ -71199,13 +71439,13 @@ const List = () => {
71199
71439
  try {
71200
71440
  const result = await cloudContext.retryTask(id);
71201
71441
  if (result.success) {
71202
- message.success(t2("messages.action_success", { action: t2("actions.retry") }));
71442
+ message2.success(t2("messages.action_success", { action: t2("actions.retry") }));
71203
71443
  fetchTasks(pagination.current, pagination.pageSize);
71204
71444
  } else {
71205
- message.error(result.error || t2("messages.action_failed", { action: t2("actions.retry") }));
71445
+ message2.error(result.error || t2("messages.action_failed", { action: t2("actions.retry") }));
71206
71446
  }
71207
71447
  } catch {
71208
- message.error(t2("messages.action_failed", { action: t2("actions.retry") }));
71448
+ message2.error(t2("messages.action_failed", { action: t2("actions.retry") }));
71209
71449
  }
71210
71450
  }
71211
71451
  });
@@ -71300,8 +71540,7 @@ const List = () => {
71300
71540
  } else {
71301
71541
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Text$4, { strong: true, children: text2 });
71302
71542
  }
71303
- })() }),
71304
- record.provider === -1 && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip2, { title: t2("task_type.cloud"), children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$m, { style: { color: "#1890ff" } }) })
71543
+ })() })
71305
71544
  ]
71306
71545
  }
71307
71546
  )
@@ -71310,16 +71549,31 @@ const List = () => {
71310
71549
  title: t2("columns.model"),
71311
71550
  dataIndex: "model_name",
71312
71551
  width: 240,
71313
- render: (text2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
71314
- Text$4,
71552
+ render: (text2, record) => /* @__PURE__ */ jsxRuntimeExports.jsxs(
71553
+ "div",
71315
71554
  {
71316
71555
  style: {
71317
71556
  maxWidth: "240px",
71318
- overflow: "hidden",
71319
- textOverflow: "ellipsis",
71320
- whiteSpace: "nowrap"
71557
+ display: "flex",
71558
+ alignItems: "center",
71559
+ gap: "4px"
71321
71560
  },
71322
- children: text2
71561
+ children: [
71562
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
71563
+ Text$4,
71564
+ {
71565
+ style: {
71566
+ maxWidth: record.provider === -1 ? "216px" : "240px",
71567
+ overflow: "hidden",
71568
+ textOverflow: "ellipsis",
71569
+ whiteSpace: "nowrap",
71570
+ display: "inline-block"
71571
+ },
71572
+ children: text2
71573
+ }
71574
+ ),
71575
+ record.provider === -1 && /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip2, { title: t2("task_type.cloud"), children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { style: { display: "inline-flex", alignItems: "center" }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$m, { style: { color: "#1890ff" } }) }) })
71576
+ ]
71323
71577
  }
71324
71578
  )
71325
71579
  },
@@ -71342,8 +71596,9 @@ const List = () => {
71342
71596
  width: 100,
71343
71597
  render: (status2, record) => {
71344
71598
  const tag = /* @__PURE__ */ jsxRuntimeExports.jsx(Tag, { color: getStatusColor(status2), children: getStatusText(status2) });
71345
- if (status2 === 0 && record.error) {
71346
- return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip2, { title: record.error, children: tag });
71599
+ const failedReason = record.error || ("error_message" in record ? record.error_message : void 0) || ("description" in record ? record.description : void 0);
71600
+ if ((status2 === 0 || status2 === 8) && failedReason) {
71601
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip2, { title: failedReason, children: tag });
71347
71602
  }
71348
71603
  return tag;
71349
71604
  }
@@ -71438,7 +71693,7 @@ const List = () => {
71438
71693
  const AddProvider = ({ onProviderAdded }) => {
71439
71694
  const [form2] = Form2.useForm();
71440
71695
  const [loading, setLoading] = reactExports.useState(false);
71441
- const { message } = App$1.useApp();
71696
+ const { message: message2 } = App$1.useApp();
71442
71697
  const { t: t2 } = useTranslation("provider");
71443
71698
  const handleAddProvider = async () => {
71444
71699
  try {
@@ -71448,16 +71703,16 @@ const AddProvider = ({ onProviderAdded }) => {
71448
71703
  if (!response.success) {
71449
71704
  throw new Error(response.error || t2("add_provider.failed"));
71450
71705
  }
71451
- message.success(t2("add_provider.success"));
71706
+ message2.success(t2("add_provider.success"));
71452
71707
  form2.resetFields();
71453
71708
  if (onProviderAdded && response.data.id) {
71454
71709
  onProviderAdded(response.data.id.toString());
71455
71710
  }
71456
71711
  } catch (error) {
71457
71712
  if (error instanceof Error) {
71458
- message.error(error.message);
71713
+ message2.error(error.message);
71459
71714
  } else {
71460
- message.error(t2("add_provider.failed"));
71715
+ message2.error(t2("add_provider.failed"));
71461
71716
  }
71462
71717
  } finally {
71463
71718
  setLoading(false);
@@ -71498,7 +71753,7 @@ const Provider = ({
71498
71753
  isPreset = false
71499
71754
  }) => {
71500
71755
  const [providerData, setProviderData] = reactExports.useState(null);
71501
- const { modal, message } = App$1.useApp();
71756
+ const { modal, message: message2 } = App$1.useApp();
71502
71757
  const { t: t2 } = useTranslation("provider");
71503
71758
  const { t: tCommon } = useTranslation("common");
71504
71759
  const [apiKey, setApiKey] = reactExports.useState("");
@@ -71575,11 +71830,11 @@ const Provider = ({
71575
71830
  setModels(result.data);
71576
71831
  } catch (error) {
71577
71832
  console.error("Failed to fetch models:", error);
71578
- message.error(
71833
+ message2.error(
71579
71834
  t2("messages.fetch_models_failed") + ": " + (error instanceof Error ? error.message : String(error))
71580
71835
  );
71581
71836
  }
71582
- }, [providerId, message, t2]);
71837
+ }, [providerId, message2, t2]);
71583
71838
  reactExports.useEffect(() => {
71584
71839
  if (providerId) {
71585
71840
  fetchModels();
@@ -71592,18 +71847,18 @@ const Provider = ({
71592
71847
  if (!result.success) {
71593
71848
  throw new Error(result.error || t2("messages.delete_model_failed"));
71594
71849
  }
71595
- message.success(t2("messages.delete_model_success"));
71850
+ message2.success(t2("messages.delete_model_success"));
71596
71851
  fetchModels();
71597
71852
  } catch (error) {
71598
71853
  console.error("Failed to delete model:", error);
71599
- message.error(
71854
+ message2.error(
71600
71855
  t2("messages.delete_model_failed") + ": " + (error instanceof Error ? error.message : String(error))
71601
71856
  );
71602
71857
  }
71603
71858
  };
71604
71859
  const addModel = async () => {
71605
71860
  if (!providerId || !newModelName || !newModelId) {
71606
- message.warning(t2("messages.add_model_warning"));
71861
+ message2.warning(t2("messages.add_model_warning"));
71607
71862
  return;
71608
71863
  }
71609
71864
  try {
@@ -71617,11 +71872,11 @@ const Provider = ({
71617
71872
  }
71618
71873
  setNewModelName("");
71619
71874
  setNewModelId("");
71620
- message.success(t2("messages.add_model_success"));
71875
+ message2.success(t2("messages.add_model_success"));
71621
71876
  fetchModels();
71622
71877
  } catch (error) {
71623
71878
  console.error("Failed to add model:", error);
71624
- message.error(
71879
+ message2.error(
71625
71880
  t2("messages.add_model_failed") + ": " + (error instanceof Error ? error.message : String(error))
71626
71881
  );
71627
71882
  }
@@ -71634,10 +71889,10 @@ const Provider = ({
71634
71889
  throw new Error(result.error || t2("messages.update_failed"));
71635
71890
  }
71636
71891
  setProviderData(result.data);
71637
- message.success(t2("messages.update_success"));
71892
+ message2.success(t2("messages.update_success"));
71638
71893
  } catch (error) {
71639
71894
  console.error("Failed to update provider:", error);
71640
- message.error(
71895
+ message2.error(
71641
71896
  t2("messages.update_failed") + ": " + (error instanceof Error ? error.message : String(error))
71642
71897
  );
71643
71898
  }
@@ -71653,10 +71908,10 @@ const Provider = ({
71653
71908
  if (!result.success) {
71654
71909
  throw new Error(result.error || t2("messages.test_failed"));
71655
71910
  }
71656
- message.success(t2("messages.test_success"));
71911
+ message2.success(t2("messages.test_success"));
71657
71912
  } catch (error) {
71658
71913
  console.error("Failed to test model connection:", error);
71659
- message.error(
71914
+ message2.error(
71660
71915
  t2("messages.test_failed") + ": " + (error instanceof Error ? error.message : String(error))
71661
71916
  );
71662
71917
  } finally {
@@ -71677,7 +71932,7 @@ const Provider = ({
71677
71932
  setFilteredModelList(result.data);
71678
71933
  } catch (error) {
71679
71934
  console.error("Failed to fetch model list:", error);
71680
- message.error(
71935
+ message2.error(
71681
71936
  t2("messages.fetch_model_list_failed") + ": " + (error instanceof Error ? error.message : String(error))
71682
71937
  );
71683
71938
  setModelList([]);
@@ -71710,7 +71965,7 @@ const Provider = ({
71710
71965
  const addModelFromList = async (model) => {
71711
71966
  if (!providerId) return;
71712
71967
  if (isModelExists(model.id)) {
71713
- message.warning(t2("messages.model_already_exists"));
71968
+ message2.warning(t2("messages.model_already_exists"));
71714
71969
  return;
71715
71970
  }
71716
71971
  setAddingModelIds((prev2) => new Set(prev2).add(model.id));
@@ -71723,11 +71978,11 @@ const Provider = ({
71723
71978
  if (!result.success) {
71724
71979
  throw new Error(result.error || t2("messages.add_model_failed"));
71725
71980
  }
71726
- message.success(t2("messages.add_model_success"));
71981
+ message2.success(t2("messages.add_model_success"));
71727
71982
  fetchModels();
71728
71983
  } catch (error) {
71729
71984
  console.error("Failed to add model:", error);
71730
- message.error(
71985
+ message2.error(
71731
71986
  t2("messages.add_model_failed") + ": " + (error instanceof Error ? error.message : String(error))
71732
71987
  );
71733
71988
  } finally {
@@ -71964,13 +72219,13 @@ const Provider = ({
71964
72219
  if (!result.success) {
71965
72220
  throw new Error(result.error || t2("messages.delete_provider_failed"));
71966
72221
  }
71967
- message.success(t2("messages.delete_provider_success"));
72222
+ message2.success(t2("messages.delete_provider_success"));
71968
72223
  if (onProviderDeleted) {
71969
72224
  onProviderDeleted();
71970
72225
  }
71971
72226
  } catch (error) {
71972
72227
  console.error("Failed to delete provider:", error);
71973
- message.error(
72228
+ message2.error(
71974
72229
  t2("messages.delete_provider_failed") + ": " + (error instanceof Error ? error.message : String(error))
71975
72230
  );
71976
72231
  }
@@ -72334,35 +72589,263 @@ const About = () => {
72334
72589
  );
72335
72590
  };
72336
72591
  const { Title, Text: Text$2 } = Typography;
72592
+ const initialPaymentDialogState = {
72593
+ open: false,
72594
+ phase: "idle",
72595
+ sessionId: null
72596
+ };
72337
72597
  const AccountCenter = () => {
72338
72598
  const { t: t2 } = useTranslation("account");
72339
72599
  const context = reactExports.useContext(CloudContext);
72340
- const [history2, setHistory] = reactExports.useState([]);
72341
- const [loadingHistory, setLoadingHistory] = reactExports.useState(false);
72342
- const [pagination, setPagination] = reactExports.useState({ current: 1, pageSize: 5, total: 0 });
72600
+ const [creditHistory, setCreditHistory] = reactExports.useState([]);
72601
+ const [paymentHistory, setPaymentHistory] = reactExports.useState([]);
72602
+ const [loadingCreditHistory, setLoadingCreditHistory] = reactExports.useState(false);
72603
+ const [loadingPaymentHistory, setLoadingPaymentHistory] = reactExports.useState(false);
72604
+ const [creditCurrentPage, setCreditCurrentPage] = reactExports.useState(1);
72605
+ const [paymentCurrentPage, setPaymentCurrentPage] = reactExports.useState(1);
72606
+ const [creditTotal, setCreditTotal] = reactExports.useState(0);
72607
+ const [paymentTotal, setPaymentTotal] = reactExports.useState(0);
72608
+ const [activeHistoryTab, setActiveHistoryTab] = reactExports.useState("credits");
72343
72609
  const [codeCopied, setCodeCopied] = reactExports.useState(false);
72344
- const fetchHistory = async (page = 1) => {
72610
+ const [selectedTopupAmount, setSelectedTopupAmount] = reactExports.useState(20);
72611
+ const [topupLoading, setTopupLoading] = reactExports.useState(false);
72612
+ const [paymentDialog, setPaymentDialog] = reactExports.useState(initialPaymentDialogState);
72613
+ const [reconcileLoading, setReconcileLoading] = reactExports.useState(false);
72614
+ const pollingActiveRef = reactExports.useRef(false);
72615
+ const pollingTimerRef = reactExports.useRef(null);
72616
+ const isAuthenticatedRef = reactExports.useRef(false);
72617
+ const celebrationTimerRef = reactExports.useRef(null);
72618
+ const [showCelebration, setShowCelebration] = reactExports.useState(false);
72619
+ const [celebrationKey, setCelebrationKey] = reactExports.useState(0);
72620
+ const topupOptions = [
72621
+ { amount: 5, credits: 7500 },
72622
+ { amount: 20, credits: 32e3 },
72623
+ { amount: 100, credits: 18e4 }
72624
+ ];
72625
+ const historyPageSize = 5;
72626
+ const fetchCreditHistory = reactExports.useCallback(async (page = 1) => {
72345
72627
  if (!context || !context.isAuthenticated) return;
72346
- setLoadingHistory(true);
72628
+ setLoadingCreditHistory(true);
72347
72629
  try {
72348
- const result = await context.getCreditHistory(page, pagination.pageSize);
72630
+ const result = await context.getCreditHistory(page, historyPageSize);
72349
72631
  if (result.success && result.data) {
72350
- setHistory(result.data);
72351
- setPagination((prev2) => ({ ...prev2, current: page, total: result.pagination?.total || 0 }));
72632
+ setCreditHistory(result.data);
72633
+ setCreditCurrentPage(page);
72634
+ setCreditTotal(result.pagination?.total || 0);
72352
72635
  }
72353
72636
  } catch (error) {
72354
- console.error("Failed to fetch history:", error);
72637
+ console.error("Failed to fetch credit history:", error);
72355
72638
  } finally {
72356
- setLoadingHistory(false);
72639
+ setLoadingCreditHistory(false);
72357
72640
  }
72358
- };
72641
+ }, [context, historyPageSize]);
72642
+ const fetchPaymentHistory = reactExports.useCallback(async (page = 1) => {
72643
+ if (!context || !context.isAuthenticated) return;
72644
+ setLoadingPaymentHistory(true);
72645
+ try {
72646
+ const result = await context.getPaymentHistory(page, historyPageSize);
72647
+ if (result.success && result.data) {
72648
+ setPaymentHistory(result.data);
72649
+ setPaymentCurrentPage(page);
72650
+ setPaymentTotal(result.pagination?.total || 0);
72651
+ }
72652
+ } catch (error) {
72653
+ console.error("Failed to fetch payment history:", error);
72654
+ } finally {
72655
+ setLoadingPaymentHistory(false);
72656
+ }
72657
+ }, [context, historyPageSize]);
72658
+ const stopPolling = reactExports.useCallback(() => {
72659
+ pollingActiveRef.current = false;
72660
+ if (pollingTimerRef.current) {
72661
+ clearTimeout(pollingTimerRef.current);
72662
+ pollingTimerRef.current = null;
72663
+ }
72664
+ }, []);
72665
+ const triggerCelebration = reactExports.useCallback(() => {
72666
+ if (celebrationTimerRef.current) {
72667
+ clearTimeout(celebrationTimerRef.current);
72668
+ }
72669
+ setCelebrationKey((prev2) => prev2 + 1);
72670
+ setShowCelebration(true);
72671
+ celebrationTimerRef.current = setTimeout(() => {
72672
+ setShowCelebration(false);
72673
+ celebrationTimerRef.current = null;
72674
+ }, 2600);
72675
+ }, []);
72676
+ const syncCreditsAndHistory = reactExports.useCallback(async () => {
72677
+ if (!context?.isAuthenticated) return;
72678
+ await context.refreshCredits();
72679
+ await Promise.all([
72680
+ fetchCreditHistory(creditCurrentPage),
72681
+ fetchPaymentHistory(paymentCurrentPage)
72682
+ ]);
72683
+ }, [context, fetchCreditHistory, fetchPaymentHistory, creditCurrentPage, paymentCurrentPage]);
72684
+ const applyFinalCheckoutStatus = reactExports.useCallback(async (statusData) => {
72685
+ const isSuccess = statusData.status === "completed";
72686
+ stopPolling();
72687
+ setPaymentDialog((prev2) => ({
72688
+ ...prev2,
72689
+ phase: isSuccess ? "success" : "failed",
72690
+ orderId: statusData.orderId,
72691
+ status: statusData.status,
72692
+ providerStatus: statusData.providerStatus,
72693
+ amountUsd: statusData.amountUsd,
72694
+ creditsAdded: statusData.creditsAdded,
72695
+ createdAt: statusData.createdAt,
72696
+ lastError: void 0
72697
+ }));
72698
+ await syncCreditsAndHistory();
72699
+ if (isSuccess) {
72700
+ triggerCelebration();
72701
+ staticMethods.success(t2("paid_credits.payment_success"));
72702
+ } else {
72703
+ staticMethods.error(t2("paid_credits.payment_failed"));
72704
+ }
72705
+ }, [stopPolling, syncCreditsAndHistory, t2, triggerCelebration]);
72706
+ const startCheckoutPolling = reactExports.useCallback((sessionId) => {
72707
+ if (!context?.isAuthenticated) return;
72708
+ stopPolling();
72709
+ isAuthenticatedRef.current = true;
72710
+ pollingActiveRef.current = true;
72711
+ const pollOnce = async () => {
72712
+ if (!pollingActiveRef.current || !isAuthenticatedRef.current) {
72713
+ return;
72714
+ }
72715
+ const result = await context.getCheckoutStatus(sessionId, 10);
72716
+ if (!pollingActiveRef.current || !isAuthenticatedRef.current) {
72717
+ return;
72718
+ }
72719
+ if (!result.success || !result.data) {
72720
+ setPaymentDialog((prev2) => prev2.sessionId === sessionId ? { ...prev2, lastError: result.error || t2("paid_credits.polling_failed") } : prev2);
72721
+ if (!pollingActiveRef.current || !isAuthenticatedRef.current) {
72722
+ return;
72723
+ }
72724
+ pollingTimerRef.current = setTimeout(() => {
72725
+ void pollOnce();
72726
+ }, 1500);
72727
+ return;
72728
+ }
72729
+ const statusData = result.data;
72730
+ setPaymentDialog((prev2) => prev2.sessionId === sessionId ? {
72731
+ ...prev2,
72732
+ phase: statusData.isFinal ? statusData.status === "completed" ? "success" : "failed" : "polling",
72733
+ orderId: statusData.orderId,
72734
+ status: statusData.status,
72735
+ providerStatus: statusData.providerStatus,
72736
+ amountUsd: statusData.amountUsd,
72737
+ creditsAdded: statusData.creditsAdded,
72738
+ createdAt: statusData.createdAt,
72739
+ lastError: void 0
72740
+ } : prev2);
72741
+ if (statusData.isFinal) {
72742
+ await applyFinalCheckoutStatus(statusData);
72743
+ return;
72744
+ }
72745
+ if (!pollingActiveRef.current || !isAuthenticatedRef.current) {
72746
+ return;
72747
+ }
72748
+ pollingTimerRef.current = setTimeout(() => {
72749
+ void pollOnce();
72750
+ }, 200);
72751
+ };
72752
+ void pollOnce();
72753
+ }, [applyFinalCheckoutStatus, context, stopPolling, t2]);
72359
72754
  reactExports.useEffect(() => {
72360
72755
  if (context?.isAuthenticated) {
72361
72756
  context.refreshCredits();
72362
- fetchHistory();
72757
+ void fetchCreditHistory();
72758
+ void fetchPaymentHistory();
72363
72759
  }
72364
72760
  }, [context?.isAuthenticated]);
72761
+ reactExports.useEffect(() => {
72762
+ const authed = Boolean(context?.isAuthenticated);
72763
+ isAuthenticatedRef.current = authed;
72764
+ if (!authed) {
72765
+ stopPolling();
72766
+ setReconcileLoading(false);
72767
+ setPaymentDialog((prev2) => prev2.open ? initialPaymentDialogState : prev2);
72768
+ }
72769
+ }, [context?.isAuthenticated, stopPolling]);
72770
+ reactExports.useEffect(() => () => {
72771
+ stopPolling();
72772
+ }, [stopPolling]);
72773
+ reactExports.useEffect(() => () => {
72774
+ if (celebrationTimerRef.current) {
72775
+ clearTimeout(celebrationTimerRef.current);
72776
+ }
72777
+ }, []);
72778
+ const closePaymentDialog = reactExports.useCallback(() => {
72779
+ stopPolling();
72780
+ setReconcileLoading(false);
72781
+ setPaymentDialog(initialPaymentDialogState);
72782
+ }, [stopPolling]);
72365
72783
  if (!context) return null;
72784
+ const handleManualReconcile = async () => {
72785
+ if (!paymentDialog.sessionId) return;
72786
+ setReconcileLoading(true);
72787
+ try {
72788
+ const result = await context.reconcileCheckout(paymentDialog.sessionId);
72789
+ if (!result.success || !result.data) {
72790
+ staticMethods.error(result.error || t2("paid_credits.reconcile_failed"));
72791
+ return;
72792
+ }
72793
+ const statusData = result.data;
72794
+ setPaymentDialog((prev2) => ({
72795
+ ...prev2,
72796
+ orderId: statusData.orderId,
72797
+ status: statusData.status,
72798
+ providerStatus: statusData.providerStatus,
72799
+ amountUsd: statusData.amountUsd,
72800
+ creditsAdded: statusData.creditsAdded,
72801
+ createdAt: statusData.createdAt,
72802
+ lastError: void 0
72803
+ }));
72804
+ if (statusData.isFinal) {
72805
+ await applyFinalCheckoutStatus(statusData);
72806
+ return;
72807
+ }
72808
+ if (!pollingActiveRef.current) {
72809
+ startCheckoutPolling(paymentDialog.sessionId);
72810
+ }
72811
+ staticMethods.info(t2("paid_credits.still_pending"));
72812
+ } catch (error) {
72813
+ console.error("Failed to reconcile checkout:", error);
72814
+ staticMethods.error(t2("paid_credits.reconcile_failed"));
72815
+ } finally {
72816
+ setReconcileLoading(false);
72817
+ }
72818
+ };
72819
+ const handleTopupClick = async () => {
72820
+ setTopupLoading(true);
72821
+ try {
72822
+ const result = await context.createCheckout(selectedTopupAmount);
72823
+ if (!result.success || !result.data) {
72824
+ staticMethods.error(result.error || t2("paid_credits.checkout_failed"));
72825
+ return;
72826
+ }
72827
+ const parsedUrl = new URL(result.data.checkoutUrl);
72828
+ if (parsedUrl.protocol !== "https:") {
72829
+ staticMethods.error(t2("paid_credits.checkout_invalid_url"));
72830
+ return;
72831
+ }
72832
+ window.api.shell.openExternal(parsedUrl.toString());
72833
+ setPaymentDialog({
72834
+ open: true,
72835
+ phase: "polling",
72836
+ sessionId: result.data.sessionId,
72837
+ amountUsd: result.data.amountUsd,
72838
+ creditsAdded: result.data.creditsToAdd
72839
+ });
72840
+ startCheckoutPolling(result.data.sessionId);
72841
+ staticMethods.success(t2("paid_credits.checkout_opened"));
72842
+ } catch (error) {
72843
+ console.error("Failed to create checkout:", error);
72844
+ staticMethods.error(t2("paid_credits.checkout_failed"));
72845
+ } finally {
72846
+ setTopupLoading(false);
72847
+ }
72848
+ };
72366
72849
  const { user, credits, isAuthenticated, login, logout, isLoading, deviceFlowStatus, userCode, authError, cancelLogin } = context;
72367
72850
  if (isLoading) {
72368
72851
  return /* @__PURE__ */ jsxRuntimeExports.jsx(Card, { loading: true, bordered: false });
@@ -72461,16 +72944,31 @@ const AccountCenter = () => {
72461
72944
  }
72462
72945
  return translated !== i18nKey ? translated : type4;
72463
72946
  };
72464
- const columns2 = [
72947
+ const getOrderStatusLabel = (status2) => {
72948
+ if (!status2) return "-";
72949
+ return t2(`paid_credits.order_status_values.${status2}`, { defaultValue: status2 });
72950
+ };
72951
+ const getProviderStatusLabel = (status2) => {
72952
+ if (!status2) return "-";
72953
+ return t2(`paid_credits.provider_status_values.${status2}`, { defaultValue: status2 });
72954
+ };
72955
+ const paymentStatusColorMap = {
72956
+ pending: "gold",
72957
+ completed: "green",
72958
+ failed: "red",
72959
+ refunded: "purple"
72960
+ };
72961
+ const renderDateTime = (text2) => {
72962
+ if (!text2) return "-";
72963
+ const date4 = new Date(text2);
72964
+ return isNaN(date4.getTime()) ? text2 : date4.toLocaleString();
72965
+ };
72966
+ const creditColumns = [
72465
72967
  {
72466
72968
  title: t2("history.columns.time"),
72467
72969
  dataIndex: "createdAt",
72468
72970
  key: "createdAt",
72469
- render: (text2) => {
72470
- if (!text2) return "-";
72471
- const date4 = new Date(text2);
72472
- return isNaN(date4.getTime()) ? text2 : date4.toLocaleString();
72473
- }
72971
+ render: renderDateTime
72474
72972
  },
72475
72973
  {
72476
72974
  title: t2("history.columns.type"),
@@ -72502,7 +73000,67 @@ const AccountCenter = () => {
72502
73000
  }
72503
73001
  }
72504
73002
  ];
73003
+ const paymentColumns = [
73004
+ {
73005
+ title: t2("history.payment_columns.time"),
73006
+ dataIndex: "createdAt",
73007
+ key: "createdAt",
73008
+ render: renderDateTime
73009
+ },
73010
+ {
73011
+ title: t2("history.payment_columns.amount_usd"),
73012
+ dataIndex: "amountUsd",
73013
+ key: "amountUsd",
73014
+ align: "right",
73015
+ render: (amountUsd) => `$${amountUsd.toFixed(2)}`,
73016
+ width: 140
73017
+ },
73018
+ {
73019
+ title: t2("history.payment_columns.credits_added"),
73020
+ dataIndex: "creditsAdded",
73021
+ key: "creditsAdded",
73022
+ align: "right",
73023
+ render: (creditsAdded) => creditsAdded.toLocaleString(),
73024
+ width: 160
73025
+ },
73026
+ {
73027
+ title: t2("history.payment_columns.status"),
73028
+ dataIndex: "status",
73029
+ key: "status",
73030
+ width: 120,
73031
+ render: (status2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Tag, { color: paymentStatusColorMap[status2] || "default", children: getOrderStatusLabel(status2) })
73032
+ },
73033
+ {
73034
+ title: t2("history.payment_columns.provider_status"),
73035
+ dataIndex: "providerStatus",
73036
+ key: "providerStatus",
73037
+ width: 160,
73038
+ render: (providerStatus) => /* @__PURE__ */ jsxRuntimeExports.jsx(Tag, { children: getProviderStatusLabel(providerStatus) })
73039
+ }
73040
+ ];
72505
73041
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { padding: "0 24px 24px" }, children: [
73042
+ showCelebration ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "payment-celebration-overlay", "data-testid": "payment-success-celebration", "aria-hidden": "true", children: Array.from({ length: 90 }).map((_2, index2) => {
73043
+ const angleRad = (index2 * 137.5 + celebrationKey * 21) % 360 * (Math.PI / 180);
73044
+ const distance = 20 + index2 * 9 % 45;
73045
+ const style2 = {
73046
+ left: `${8 + index2 * 11 % 84}%`,
73047
+ top: `${12 + index2 * 17 % 76}%`,
73048
+ "--x": `${Math.cos(angleRad) * distance}vw`,
73049
+ "--y": `${Math.sin(angleRad) * distance + 30}vh`,
73050
+ "--rotate": `${220 + index2 * 37 % 260}deg`,
73051
+ "--delay": `${index2 % 12 * 0.04}s`,
73052
+ "--duration": `${1.1 + index2 * 5 % 8 * 0.14}s`,
73053
+ "--color": `hsl(${(index2 * 31 + celebrationKey * 19) % 360} 92% 60%)`
73054
+ };
73055
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
73056
+ "span",
73057
+ {
73058
+ className: "payment-celebration-particle",
73059
+ style: style2
73060
+ },
73061
+ `${celebrationKey}-${index2}`
73062
+ );
73063
+ }) }) : null,
72506
73064
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex", alignItems: "center", marginBottom: "24px" }, children: [
72507
73065
  /* @__PURE__ */ jsxRuntimeExports.jsx(Avatar, { size: 80, src: user.avatarUrl, icon: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon, {}) }),
72508
73066
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { marginLeft: "24px", flex: 1 }, children: [
@@ -72545,44 +73103,197 @@ const AccountCenter = () => {
72545
73103
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { marginTop: 4 }, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Text$2, { type: "secondary", style: { fontSize: "12px" }, children: t2("monthly_free.description") }) })
72546
73104
  ] }) }),
72547
73105
  /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: 12, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Card, { variant: "borderless", style: { background: "#f9f0ff", position: "relative", height: "100%" }, children: [
72548
- /* @__PURE__ */ jsxRuntimeExports.jsx(
72549
- Statistic,
72550
- {
72551
- title: t2("paid_credits.title"),
72552
- value: credits.paid,
72553
- prefix: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$l, { style: { color: "#722ed1" } }),
72554
- valueStyle: { color: "#722ed1" }
72555
- }
72556
- ),
72557
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "center", marginTop: 4 }, children: [
72558
- /* @__PURE__ */ jsxRuntimeExports.jsx(Text$2, { type: "secondary", style: { fontSize: "12px" }, children: t2("paid_credits.description") }),
72559
- /* @__PURE__ */ jsxRuntimeExports.jsx(Tooltip2, { title: "Coming soon", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
73106
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex", justifyContent: "space-between", alignItems: "flex-start", gap: 12 }, children: [
73107
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
73108
+ Statistic,
73109
+ {
73110
+ title: t2("paid_credits.title"),
73111
+ value: credits.paid,
73112
+ prefix: /* @__PURE__ */ jsxRuntimeExports.jsx(RefIcon$l, { style: { color: "#722ed1" } }),
73113
+ valueStyle: { color: "#722ed1" }
73114
+ }
73115
+ ),
73116
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(
72560
73117
  Button$1,
72561
73118
  {
72562
73119
  type: "primary",
72563
- size: "small",
72564
- style: { backgroundColor: "#722ed1" },
72565
- disabled: true,
72566
- children: t2("paid_credits.recharge")
73120
+ size: "middle",
73121
+ style: { backgroundColor: "#722ed1", marginTop: 4 },
73122
+ onClick: handleTopupClick,
73123
+ loading: topupLoading,
73124
+ children: [
73125
+ t2("paid_credits.recharge"),
73126
+ " $",
73127
+ selectedTopupAmount
73128
+ ]
72567
73129
  }
72568
- ) })
72569
- ] })
73130
+ )
73131
+ ] }),
73132
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Row, { gutter: [8, 8], style: { marginTop: 6 }, children: topupOptions.map((option) => {
73133
+ const selected = selectedTopupAmount === option.amount;
73134
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Col, { span: 8, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
73135
+ Button$1,
73136
+ {
73137
+ block: true,
73138
+ onClick: () => setSelectedTopupAmount(option.amount),
73139
+ style: {
73140
+ height: 68,
73141
+ borderRadius: 10,
73142
+ borderColor: selected ? "#722ed1" : "#d9d9d9",
73143
+ background: selected ? "#f4e8ff" : "#ffffff",
73144
+ boxShadow: selected ? "0 2px 8px rgba(114, 46, 209, 0.16)" : "none",
73145
+ padding: "8px 10px"
73146
+ },
73147
+ children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { textAlign: "left", width: "100%", lineHeight: 1.15 }, children: [
73148
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { strong: true, style: { fontSize: 18, color: selected ? "#531dab" : "rgba(0,0,0,0.88)" }, children: [
73149
+ "$",
73150
+ option.amount
73151
+ ] }),
73152
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { style: { marginTop: 2 }, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", style: { fontSize: 12 }, children: [
73153
+ option.credits.toLocaleString(),
73154
+ " ",
73155
+ t2("history.columns.credits")
73156
+ ] }) })
73157
+ ] })
73158
+ }
73159
+ ) }, option.amount);
73160
+ }) })
72570
73161
  ] }) })
72571
73162
  ] }),
72572
73163
  /* @__PURE__ */ jsxRuntimeExports.jsx(Divider, {}),
72573
73164
  /* @__PURE__ */ jsxRuntimeExports.jsx(Title, { level: 4, style: { marginTop: "24px", marginBottom: "16px" }, children: t2("history.title") }),
72574
73165
  /* @__PURE__ */ jsxRuntimeExports.jsx(
72575
- ForwardTable,
73166
+ Tabs,
72576
73167
  {
72577
- dataSource: history2,
72578
- columns: columns2,
72579
- rowKey: "id",
72580
- loading: loadingHistory,
72581
- pagination: {
72582
- ...pagination,
72583
- onChange: (page) => fetchHistory(page)
72584
- },
72585
- size: "small"
73168
+ activeKey: activeHistoryTab,
73169
+ onChange: (key) => setActiveHistoryTab(key),
73170
+ items: [
73171
+ {
73172
+ key: "credits",
73173
+ label: t2("history.tabs.credits"),
73174
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
73175
+ ForwardTable,
73176
+ {
73177
+ dataSource: creditHistory,
73178
+ columns: creditColumns,
73179
+ rowKey: "id",
73180
+ loading: loadingCreditHistory,
73181
+ pagination: {
73182
+ current: creditCurrentPage,
73183
+ pageSize: historyPageSize,
73184
+ total: creditTotal,
73185
+ onChange: (page) => {
73186
+ void fetchCreditHistory(page);
73187
+ }
73188
+ },
73189
+ size: "small"
73190
+ }
73191
+ )
73192
+ },
73193
+ {
73194
+ key: "payments",
73195
+ label: t2("history.tabs.payments"),
73196
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
73197
+ ForwardTable,
73198
+ {
73199
+ dataSource: paymentHistory,
73200
+ columns: paymentColumns,
73201
+ rowKey: "id",
73202
+ loading: loadingPaymentHistory,
73203
+ pagination: {
73204
+ current: paymentCurrentPage,
73205
+ pageSize: historyPageSize,
73206
+ total: paymentTotal,
73207
+ onChange: (page) => {
73208
+ void fetchPaymentHistory(page);
73209
+ }
73210
+ },
73211
+ size: "small"
73212
+ }
73213
+ )
73214
+ }
73215
+ ]
73216
+ }
73217
+ ),
73218
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
73219
+ Modal,
73220
+ {
73221
+ open: paymentDialog.open,
73222
+ title: paymentDialog.phase === "polling" ? t2("paid_credits.payment_processing") : t2("paid_credits.payment_result"),
73223
+ onCancel: closePaymentDialog,
73224
+ maskClosable: false,
73225
+ closable: paymentDialog.phase !== "polling",
73226
+ footer: paymentDialog.phase === "polling" ? [
73227
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { onClick: closePaymentDialog, children: t2("paid_credits.cancel_waiting") }, "cancel"),
73228
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { type: "primary", loading: reconcileLoading, onClick: handleManualReconcile, children: t2("paid_credits.confirm_paid") }, "confirm")
73229
+ ] : [
73230
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Button$1, { type: "primary", onClick: closePaymentDialog, children: t2("paid_credits.close_dialog") }, "close")
73231
+ ],
73232
+ children: paymentDialog.phase === "polling" ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { direction: "vertical", size: 16, style: { width: "100%" }, children: [
73233
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "flex", alignItems: "center", gap: 12 }, children: [
73234
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Spin, { size: "small" }),
73235
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Text$2, { children: t2("paid_credits.waiting_for_confirmation") })
73236
+ ] }),
73237
+ paymentDialog.lastError ? /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { showIcon: true, type: "warning", message: paymentDialog.lastError }) : null,
73238
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "grid", gap: 4 }, children: [
73239
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73240
+ t2("paid_credits.session_id_label"),
73241
+ ": ",
73242
+ paymentDialog.sessionId || "-"
73243
+ ] }),
73244
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73245
+ t2("paid_credits.order_status_label"),
73246
+ ": ",
73247
+ getOrderStatusLabel(paymentDialog.status)
73248
+ ] }),
73249
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73250
+ t2("paid_credits.provider_status_label"),
73251
+ ": ",
73252
+ getProviderStatusLabel(paymentDialog.providerStatus)
73253
+ ] })
73254
+ ] })
73255
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(Space, { direction: "vertical", size: 16, style: { width: "100%" }, children: [
73256
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
73257
+ Alert,
73258
+ {
73259
+ showIcon: true,
73260
+ type: paymentDialog.phase === "success" ? "success" : "error",
73261
+ message: paymentDialog.phase === "success" ? t2("paid_credits.result_success") : t2("paid_credits.result_failed")
73262
+ }
73263
+ ),
73264
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { style: { display: "grid", gap: 4 }, children: [
73265
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73266
+ t2("paid_credits.session_id_label"),
73267
+ ": ",
73268
+ paymentDialog.sessionId || "-"
73269
+ ] }),
73270
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73271
+ t2("paid_credits.order_id_label"),
73272
+ ": ",
73273
+ paymentDialog.orderId || "-"
73274
+ ] }),
73275
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73276
+ t2("paid_credits.order_status_label"),
73277
+ ": ",
73278
+ getOrderStatusLabel(paymentDialog.status)
73279
+ ] }),
73280
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73281
+ t2("paid_credits.provider_status_label"),
73282
+ ": ",
73283
+ getProviderStatusLabel(paymentDialog.providerStatus)
73284
+ ] }),
73285
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73286
+ t2("paid_credits.amount_label"),
73287
+ ": $",
73288
+ paymentDialog.amountUsd ?? selectedTopupAmount
73289
+ ] }),
73290
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(Text$2, { type: "secondary", children: [
73291
+ t2("paid_credits.credits_added_label"),
73292
+ ": ",
73293
+ paymentDialog.creditsAdded ?? "-"
73294
+ ] })
73295
+ ] })
73296
+ ] })
72586
73297
  }
72587
73298
  )
72588
73299
  ] });
@@ -74594,15 +75305,15 @@ function parseStyle(state, value) {
74594
75305
  /** @type {Error} */
74595
75306
  error
74596
75307
  );
74597
- const message = new VFileMessage("Cannot parse `style` attribute", {
75308
+ const message2 = new VFileMessage("Cannot parse `style` attribute", {
74598
75309
  ancestors: state.ancestors,
74599
75310
  cause,
74600
75311
  ruleId: "style",
74601
75312
  source: "hast-util-to-jsx-runtime"
74602
75313
  });
74603
- message.file = state.filePath || void 0;
74604
- message.url = docs + "#cannot-parse-style-attribute";
74605
- throw message;
75314
+ message2.file = state.filePath || void 0;
75315
+ message2.url = docs + "#cannot-parse-style-attribute";
75316
+ throw message2;
74606
75317
  }
74607
75318
  }
74608
75319
  function findComponentFromName(state, name$1, allowExpression) {
@@ -74640,7 +75351,7 @@ function findComponentFromName(state, name$1, allowExpression) {
74640
75351
  crashEstree(state);
74641
75352
  }
74642
75353
  function crashEstree(state, place) {
74643
- const message = new VFileMessage(
75354
+ const message2 = new VFileMessage(
74644
75355
  "Cannot handle MDX estrees without `createEvaluater`",
74645
75356
  {
74646
75357
  ancestors: state.ancestors,
@@ -74649,9 +75360,9 @@ function crashEstree(state, place) {
74649
75360
  source: "hast-util-to-jsx-runtime"
74650
75361
  }
74651
75362
  );
74652
- message.file = state.filePath || void 0;
74653
- message.url = docs + "#cannot-handle-mdx-estrees-without-createevaluater";
74654
- throw message;
75363
+ message2.file = state.filePath || void 0;
75364
+ message2.url = docs + "#cannot-handle-mdx-estrees-without-createevaluater";
75365
+ throw message2;
74655
75366
  }
74656
75367
  function transformStylesToCssCasing(domCasing) {
74657
75368
  const cssCasing = {};
@@ -79958,8 +80669,8 @@ const deserializer = ($, _2) => {
79958
80669
  return set2;
79959
80670
  }
79960
80671
  case ERROR: {
79961
- const { name: name2, message } = value;
79962
- return as(new env[name2](message), index2);
80672
+ const { name: name2, message: message2 } = value;
80673
+ return as(new env[name2](message2), index2);
79963
80674
  }
79964
80675
  case BIGINT:
79965
80676
  return as(BigInt(value), index2);
@@ -80099,8 +80810,8 @@ const serializer = (strict, json2, $, _2) => {
80099
80810
  return index2;
80100
80811
  }
80101
80812
  }
80102
- const { message } = value;
80103
- return as([TYPE, { name: type4, message }], value);
80813
+ const { message: message2 } = value;
80814
+ return as([TYPE, { name: type4, message: message2 }], value);
80104
80815
  };
80105
80816
  return pair;
80106
80817
  };
@@ -81299,9 +82010,9 @@ class VFile {
81299
82010
  * Message.
81300
82011
  */
81301
82012
  fail(causeOrReason, optionsOrParentOrPlace, origin) {
81302
- const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
81303
- message.fatal = true;
81304
- throw message;
82013
+ const message2 = this.message(causeOrReason, optionsOrParentOrPlace, origin);
82014
+ message2.fatal = true;
82015
+ throw message2;
81305
82016
  }
81306
82017
  /**
81307
82018
  * Create an info message for `reason` associated with the file.
@@ -81362,9 +82073,9 @@ class VFile {
81362
82073
  * Message.
81363
82074
  */
81364
82075
  info(causeOrReason, optionsOrParentOrPlace, origin) {
81365
- const message = this.message(causeOrReason, optionsOrParentOrPlace, origin);
81366
- message.fatal = void 0;
81367
- return message;
82076
+ const message2 = this.message(causeOrReason, optionsOrParentOrPlace, origin);
82077
+ message2.fatal = void 0;
82078
+ return message2;
81368
82079
  }
81369
82080
  /**
81370
82081
  * Create a message for `reason` associated with the file.
@@ -81425,19 +82136,19 @@ class VFile {
81425
82136
  * Message.
81426
82137
  */
81427
82138
  message(causeOrReason, optionsOrParentOrPlace, origin) {
81428
- const message = new VFileMessage(
82139
+ const message2 = new VFileMessage(
81429
82140
  // @ts-expect-error: the overloads are fine.
81430
82141
  causeOrReason,
81431
82142
  optionsOrParentOrPlace,
81432
82143
  origin
81433
82144
  );
81434
82145
  if (this.path) {
81435
- message.name = this.path + ":" + message.name;
81436
- message.file = this.path;
82146
+ message2.name = this.path + ":" + message2.name;
82147
+ message2.file = this.path;
81437
82148
  }
81438
- message.fatal = false;
81439
- this.messages.push(message);
81440
- return message;
82149
+ message2.fatal = false;
82150
+ this.messages.push(message2);
82151
+ return message2;
81441
82152
  }
81442
82153
  /**
81443
82154
  * Serialize the file.
@@ -82796,12 +83507,12 @@ class ParseError {
82796
83507
  // Error start position based on passed-in Token or ParseNode.
82797
83508
  // Length of affected text based on passed-in Token or ParseNode.
82798
83509
  // The underlying error message without any context added.
82799
- constructor(message, token2) {
83510
+ constructor(message2, token2) {
82800
83511
  this.name = void 0;
82801
83512
  this.position = void 0;
82802
83513
  this.length = void 0;
82803
83514
  this.rawMessage = void 0;
82804
- var error = "KaTeX parse error: " + message;
83515
+ var error = "KaTeX parse error: " + message2;
82805
83516
  var start;
82806
83517
  var end;
82807
83518
  var loc = token2 && token2.loc;
@@ -82836,7 +83547,7 @@ class ParseError {
82836
83547
  if (start != null && end != null) {
82837
83548
  self2.length = end - start;
82838
83549
  }
82839
- self2.rawMessage = message;
83550
+ self2.rawMessage = message2;
82840
83551
  return self2;
82841
83552
  }
82842
83553
  }
@@ -124607,7 +125318,7 @@ const { Text: Text$1 } = Typography;
124607
125318
  const Preview = () => {
124608
125319
  const { id } = useParams();
124609
125320
  const navigate = useNavigate();
124610
- const { message, modal } = App$1.useApp();
125321
+ const { message: message2, modal } = App$1.useApp();
124611
125322
  const { t: t2 } = useTranslation("settings");
124612
125323
  const { t: tCommon } = useTranslation("common");
124613
125324
  const [task, setTask] = reactExports.useState(null);
@@ -124624,15 +125335,15 @@ const Preview = () => {
124624
125335
  if (result.success && result.data) {
124625
125336
  setTask(result.data);
124626
125337
  } else {
124627
- message.error(result.error || t2("preview.fetch_task_failed"));
125338
+ message2.error(result.error || t2("preview.fetch_task_failed"));
124628
125339
  navigate("/list");
124629
125340
  }
124630
125341
  } catch (error) {
124631
125342
  console.error("Failed to fetch task:", error);
124632
- message.error(t2("preview.fetch_task_failed"));
125343
+ message2.error(t2("preview.fetch_task_failed"));
124633
125344
  navigate("/list");
124634
125345
  }
124635
- }, [id, message, navigate, t2]);
125346
+ }, [id, message2, navigate, t2]);
124636
125347
  const fetchPageDetail = reactExports.useCallback(async (page) => {
124637
125348
  if (!id) return;
124638
125349
  setLoading(true);
@@ -124643,17 +125354,17 @@ const Preview = () => {
124643
125354
  setTaskDetail(result.data);
124644
125355
  setImageError(!result.data.imageExists);
124645
125356
  } else {
124646
- message.error(result.error || t2("preview.fetch_page_failed"));
125357
+ message2.error(result.error || t2("preview.fetch_page_failed"));
124647
125358
  setTaskDetail(null);
124648
125359
  }
124649
125360
  } catch (error) {
124650
125361
  console.error("Failed to fetch page detail:", error);
124651
- message.error(t2("preview.fetch_page_failed"));
125362
+ message2.error(t2("preview.fetch_page_failed"));
124652
125363
  setTaskDetail(null);
124653
125364
  } finally {
124654
125365
  setLoading(false);
124655
125366
  }
124656
- }, [id, message, t2]);
125367
+ }, [id, message2, t2]);
124657
125368
  reactExports.useEffect(() => {
124658
125369
  if (!id) return;
124659
125370
  const handleTaskEvent = (event) => {
@@ -124669,7 +125380,7 @@ const Preview = () => {
124669
125380
  }
124670
125381
  break;
124671
125382
  case "task:deleted":
124672
- message.info(t2("preview.task_deleted"));
125383
+ message2.info(t2("preview.task_deleted"));
124673
125384
  navigate("/list");
124674
125385
  break;
124675
125386
  }
@@ -124678,7 +125389,7 @@ const Preview = () => {
124678
125389
  return () => {
124679
125390
  cleanup2();
124680
125391
  };
124681
- }, [id, message, navigate, t2]);
125392
+ }, [id, message2, navigate, t2]);
124682
125393
  reactExports.useEffect(() => {
124683
125394
  if (!id) return;
124684
125395
  const handleTaskDetailEvent = (event) => {
@@ -124704,22 +125415,22 @@ const Preview = () => {
124704
125415
  }, [currentPage, task, fetchPageDetail]);
124705
125416
  reactExports.useEffect(() => {
124706
125417
  if (task && task.status !== void 0 && (task.status === -1 || task.status === 1)) {
124707
- message.warning(t2("preview.task_not_started"));
125418
+ message2.warning(t2("preview.task_not_started"));
124708
125419
  navigate("/list");
124709
125420
  }
124710
- }, [task, message, navigate, t2]);
125421
+ }, [task, message2, navigate, t2]);
124711
125422
  const handleDownload = async () => {
124712
125423
  if (!id) return;
124713
125424
  try {
124714
125425
  const result = await window.api.file.downloadMarkdown(id);
124715
125426
  if (result.success) {
124716
- message.success(t2("preview.download_success"));
125427
+ message2.success(t2("preview.download_success"));
124717
125428
  } else {
124718
- message.error(result.error || t2("preview.download_failed"));
125429
+ message2.error(result.error || t2("preview.download_failed"));
124719
125430
  }
124720
125431
  } catch (error) {
124721
125432
  console.error("Download failed:", error);
124722
- message.error(t2("preview.download_failed"));
125433
+ message2.error(t2("preview.download_failed"));
124723
125434
  }
124724
125435
  };
124725
125436
  const handleDelete2 = async () => {
@@ -124734,14 +125445,14 @@ const Preview = () => {
124734
125445
  try {
124735
125446
  const result = await window.api.task.delete(id);
124736
125447
  if (result.success) {
124737
- message.success(t2("preview.delete_success"));
125448
+ message2.success(t2("preview.delete_success"));
124738
125449
  navigate("/list");
124739
125450
  } else {
124740
- message.error(result.error || t2("preview.delete_failed"));
125451
+ message2.error(result.error || t2("preview.delete_failed"));
124741
125452
  }
124742
125453
  } catch (error) {
124743
125454
  console.error("删除失败:", error);
124744
- message.error(t2("preview.delete_failed"));
125455
+ message2.error(t2("preview.delete_failed"));
124745
125456
  }
124746
125457
  }
124747
125458
  });
@@ -124757,14 +125468,14 @@ const Preview = () => {
124757
125468
  try {
124758
125469
  const result = await window.api.task.update(id, { status: 7 });
124759
125470
  if (result.success) {
124760
- message.success(t2("preview.cancel_success"));
125471
+ message2.success(t2("preview.cancel_success"));
124761
125472
  navigate("/list");
124762
125473
  } else {
124763
- message.error(result.error || t2("preview.cancel_failed"));
125474
+ message2.error(result.error || t2("preview.cancel_failed"));
124764
125475
  }
124765
125476
  } catch (error) {
124766
125477
  console.error("取消失败:", error);
124767
- message.error(t2("preview.cancel_failed"));
125478
+ message2.error(t2("preview.cancel_failed"));
124768
125479
  }
124769
125480
  }
124770
125481
  });
@@ -124780,13 +125491,13 @@ const Preview = () => {
124780
125491
  try {
124781
125492
  const result = await window.api.task.update(id, { status: 1 });
124782
125493
  if (result.success) {
124783
- message.success(t2("preview.retry_success"));
125494
+ message2.success(t2("preview.retry_success"));
124784
125495
  } else {
124785
- message.error(result.error || t2("preview.retry_failed"));
125496
+ message2.error(result.error || t2("preview.retry_failed"));
124786
125497
  }
124787
125498
  } catch (error) {
124788
125499
  console.error("重试失败:", error);
124789
- message.error(t2("preview.retry_failed"));
125500
+ message2.error(t2("preview.retry_failed"));
124790
125501
  }
124791
125502
  }
124792
125503
  });
@@ -124803,13 +125514,13 @@ const Preview = () => {
124803
125514
  try {
124804
125515
  const result = await window.api.taskDetail.retryFailed(id);
124805
125516
  if (result.success) {
124806
- message.success(t2("preview.retry_failed_success", { count: result.data?.retried || 0 }));
125517
+ message2.success(t2("preview.retry_failed_success", { count: result.data?.retried || 0 }));
124807
125518
  } else {
124808
- message.error(result.error || t2("preview.retry_failed"));
125519
+ message2.error(result.error || t2("preview.retry_failed"));
124809
125520
  }
124810
125521
  } catch (error) {
124811
125522
  console.error("重试失败页失败:", error);
124812
- message.error(t2("preview.retry_failed"));
125523
+ message2.error(t2("preview.retry_failed"));
124813
125524
  } finally {
124814
125525
  setRetryingFailed(false);
124815
125526
  }
@@ -124825,14 +125536,14 @@ const Preview = () => {
124825
125536
  try {
124826
125537
  const result = await window.api.taskDetail.retry(taskDetail.id);
124827
125538
  if (result.success) {
124828
- message.success(t2("preview.page_retry_success"));
125539
+ message2.success(t2("preview.page_retry_success"));
124829
125540
  fetchPageDetail(currentPage);
124830
125541
  } else {
124831
- message.error(result.error || t2("preview.page_retry_failed"));
125542
+ message2.error(result.error || t2("preview.page_retry_failed"));
124832
125543
  }
124833
125544
  } catch (error) {
124834
125545
  console.error("Failed to retry page:", error);
124835
- message.error(t2("preview.page_retry_failed"));
125546
+ message2.error(t2("preview.page_retry_failed"));
124836
125547
  } finally {
124837
125548
  setRetrying(false);
124838
125549
  }
@@ -125135,7 +125846,7 @@ const { Text } = Typography;
125135
125846
  const CloudPreview = () => {
125136
125847
  const { id } = useParams();
125137
125848
  const navigate = useNavigate();
125138
- const { message, modal } = App$1.useApp();
125849
+ const { message: message2, modal } = App$1.useApp();
125139
125850
  const { t: t2 } = useTranslation("cloud-preview");
125140
125851
  const { t: tCommon } = useTranslation("common");
125141
125852
  const cloudContext = reactExports.useContext(CloudContext);
@@ -125157,14 +125868,14 @@ const CloudPreview = () => {
125157
125868
  if (result.success && result.data) {
125158
125869
  setTask(result.data);
125159
125870
  } else {
125160
- message.error(result.error || t2("fetch_task_failed"));
125871
+ message2.error(result.error || t2("fetch_task_failed"));
125161
125872
  navigate("/list");
125162
125873
  }
125163
125874
  } catch {
125164
- message.error(t2("fetch_task_failed"));
125875
+ message2.error(t2("fetch_task_failed"));
125165
125876
  navigate("/list");
125166
125877
  }
125167
- }, [id, cloudContext, message, navigate, t2]);
125878
+ }, [id, cloudContext, message2, navigate, t2]);
125168
125879
  const fetchPages = reactExports.useCallback(async () => {
125169
125880
  if (!id || !cloudContext) return;
125170
125881
  setLoading(true);
@@ -125311,12 +126022,12 @@ const CloudPreview = () => {
125311
126022
  a2.download = (task?.file_name?.replace(/\.[^.]+$/, "") || "result") + ".md";
125312
126023
  a2.click();
125313
126024
  URL.revokeObjectURL(url2);
125314
- message.success(t2("download_success"));
126025
+ message2.success(t2("download_success"));
125315
126026
  } else {
125316
- message.error(result.error || t2("download_failed"));
126027
+ message2.error(result.error || t2("download_failed"));
125317
126028
  }
125318
126029
  } catch {
125319
- message.error(t2("download_failed"));
126030
+ message2.error(t2("download_failed"));
125320
126031
  } finally {
125321
126032
  setDownloading(false);
125322
126033
  }
@@ -125331,10 +126042,10 @@ const CloudPreview = () => {
125331
126042
  onOk: async () => {
125332
126043
  const result = await cloudContext.cancelTask(id);
125333
126044
  if (result.success) {
125334
- message.success(t2("cancel_success"));
126045
+ message2.success(t2("cancel_success"));
125335
126046
  navigate("/list");
125336
126047
  } else {
125337
- message.error(result.error || t2("cancel_failed"));
126048
+ message2.error(result.error || t2("cancel_failed"));
125338
126049
  }
125339
126050
  }
125340
126051
  });
@@ -125349,10 +126060,10 @@ const CloudPreview = () => {
125349
126060
  onOk: async () => {
125350
126061
  const result = await cloudContext.retryTask(id);
125351
126062
  if (result.success && result.data) {
125352
- message.success(t2("retry_success"));
126063
+ message2.success(t2("retry_success"));
125353
126064
  navigate(`/list/cloud-preview/${result.data.task_id}`);
125354
126065
  } else {
125355
- message.error(result.error || t2("retry_failed"));
126066
+ message2.error(result.error || t2("retry_failed"));
125356
126067
  }
125357
126068
  }
125358
126069
  });
@@ -125363,7 +126074,7 @@ const CloudPreview = () => {
125363
126074
  try {
125364
126075
  const result = await cloudContext.retryPage(id, currentPage);
125365
126076
  if (result.success) {
125366
- message.success(t2("page_retry_success"));
126077
+ message2.success(t2("page_retry_success"));
125367
126078
  setPages((prev2) => {
125368
126079
  const idx = prev2.findIndex((p2) => p2.page === currentPage);
125369
126080
  if (idx >= 0) {
@@ -125374,10 +126085,10 @@ const CloudPreview = () => {
125374
126085
  return prev2;
125375
126086
  });
125376
126087
  } else {
125377
- message.error(result.error || t2("page_retry_failed"));
126088
+ message2.error(result.error || t2("page_retry_failed"));
125378
126089
  }
125379
126090
  } catch {
125380
- message.error(t2("page_retry_failed"));
126091
+ message2.error(t2("page_retry_failed"));
125381
126092
  } finally {
125382
126093
  setRetrying(false);
125383
126094
  }
@@ -125410,12 +126121,12 @@ const CloudPreview = () => {
125410
126121
  }
125411
126122
  }
125412
126123
  if (retriedCount > 0) {
125413
- message.success(t2("retry_failed_success", { count: retriedCount }));
126124
+ message2.success(t2("retry_failed_success", { count: retriedCount }));
125414
126125
  } else {
125415
- message.error(t2("retry_failed"));
126126
+ message2.error(t2("retry_failed"));
125416
126127
  }
125417
126128
  } catch {
125418
- message.error(t2("retry_failed"));
126129
+ message2.error(t2("retry_failed"));
125419
126130
  } finally {
125420
126131
  setRetryingFailed(false);
125421
126132
  }
@@ -125433,10 +126144,10 @@ const CloudPreview = () => {
125433
126144
  onOk: async () => {
125434
126145
  const result = await cloudContext.deleteTask(id);
125435
126146
  if (result.success) {
125436
- message.success(t2("delete_success"));
126147
+ message2.success(t2("delete_success"));
125437
126148
  navigate("/list");
125438
126149
  } else {
125439
- message.error(result.error || t2("delete_failed"));
126150
+ message2.error(result.error || t2("delete_failed"));
125440
126151
  }
125441
126152
  }
125442
126153
  });
@@ -127737,9 +128448,9 @@ const sign_out_button$5 = "Sign Out";
127737
128448
  const credit_balance$5 = "Credit Balance";
127738
128449
  const credit_usage_hint$5 = "Lite: ~10 credits/page (A4); Pro & Ultra: 2x & 6x";
127739
128450
  const monthly_free$5 = { "title": "Free Credits", "monthly_label": "Monthly", "daily_label": "Today", "description": "3,000 free credits per month, resets on the 1st at 00:00 (UTC+0)", "daily_limit_tooltip": "Daily usage limit: {{limit}}" };
127740
- const paid_credits$5 = { "title": "Paid Credits", "description": "$1 USD = 1,500 credits", "recharge": "Recharge" };
128451
+ const paid_credits$5 = { "title": "Paid Credits", "description": "$1 USD = 1,500 credits", "recharge": "Recharge", "coming_soon": "Top-up will be available soon", "checkout_opened": "Checkout opened in your browser. Please complete payment there.", "checkout_failed": "Failed to create checkout session. Please try again.", "checkout_invalid_url": "Invalid checkout URL returned by server.", "payment_success": "Payment succeeded. Credits have been updated.", "payment_cancelled": "Payment was cancelled.", "payment_failed": "Payment failed. Please try again later.", "payment_callback_received": "Payment callback received. Syncing credits.", "payment_processing": "Waiting For Payment", "payment_result": "Payment Result", "waiting_for_confirmation": "Waiting for payment confirmation from server...", "cancel_waiting": "Cancel", "confirm_paid": "I've Completed Payment", "close_dialog": "Close", "reconcile_failed": "Failed to reconcile payment status. Please try again.", "still_pending": "Payment is still pending. Keep this dialog open.", "polling_failed": "Unable to query payment status. Retrying...", "session_id_label": "Session ID", "order_id_label": "Order ID", "order_status_label": "Order Status", "provider_status_label": "Provider Status", "amount_label": "Amount", "credits_added_label": "Credits To Add", "result_success": "Payment completed successfully.", "result_failed": "Payment failed or was not completed.", "order_status_values": { "pending": "Pending", "completed": "Completed", "failed": "Failed", "refunded": "Refunded" }, "provider_status_values": { "pending": "Pending", "processing": "Processing", "completed": "Completed", "failed": "Failed", "canceled": "Canceled", "expired": "Expired", "refunded": "Refunded", "unknown": "Unknown" } };
127741
128452
  const device_flow$5 = { "browser_opened": "A browser window has been opened for authorization", "enter_code_hint": "Enter the code below in your browser to complete sign in", "cancel": "Cancel", "try_again": "Try Again", "expired": "The authorization code has expired. Please try again.", "waiting": "Waiting for browser authorization..." };
127742
- const history$5 = { "title": "Credit History", "columns": { "time": "Time", "type": "Type", "description": "Description", "credits": "Credits" }, "types": { "consume": "Consumption", "pre_auth": "Pre-authorization", "settle": "Settlement", "pre_auth_release": "Release Frozen", "topup": "Top Up", "refund": "Refund", "bonus_grant": "Bonus", "bonus_expire": "Expired" } };
128453
+ const history$5 = { "title": "Credit History", "tabs": { "credits": "Credit Transactions", "payments": "Payment Orders" }, "columns": { "time": "Time", "type": "Type", "description": "Description", "credits": "Credits" }, "payment_columns": { "time": "Time", "amount_usd": "Amount (USD)", "credits_added": "Credits Added", "status": "Status", "provider_status": "Provider Status" }, "types": { "consume": "Consumption", "pre_auth": "Pre-authorization", "settle": "Settlement", "pre_auth_release": "Release Frozen", "topup": "Top Up", "refund": "Refund", "bonus_grant": "Bonus", "bonus_expire": "Expired" } };
127743
128454
  const enAccount = {
127744
128455
  title: title$a,
127745
128456
  sign_in_hint: sign_in_hint$5,
@@ -127897,9 +128608,9 @@ const sign_out_button$4 = "退出登录";
127897
128608
  const credit_balance$4 = "积分余额";
127898
128609
  const credit_usage_hint$4 = "Lite模型每页约消耗10积分,Pro、Ultra分别为Lite的2倍和6倍";
127899
128610
  const monthly_free$4 = { "title": "免费积分", "monthly_label": "本月剩余", "daily_label": "今日可用", "description": "每月可享3000免费积分,每月1号0点刷新额度(UTC+0)", "daily_limit_tooltip": "每日使用上限: {{limit}}" };
127900
- const paid_credits$4 = { "title": "付费积分", "description": "1美元可兑换1500积分", "recharge": "充值" };
128611
+ const paid_credits$4 = { "title": "付费积分", "description": "1美元可兑换1500积分", "recharge": "充值", "coming_soon": "充值功能即将上线", "checkout_opened": "支付页面已在浏览器打开,请完成支付。", "checkout_failed": "创建支付会话失败,请稍后重试。", "checkout_invalid_url": "服务端返回的支付链接无效。", "payment_success": "支付成功,积分已更新。", "payment_cancelled": "支付已取消。", "payment_failed": "支付失败,请稍后重试。", "payment_callback_received": "已收到支付回调,正在同步积分。", "payment_processing": "等待支付确认", "payment_result": "支付结果", "waiting_for_confirmation": "正在等待服务端确认支付状态...", "cancel_waiting": "取消", "confirm_paid": "我已完成支付", "close_dialog": "关闭", "reconcile_failed": "主动对账失败,请稍后重试。", "still_pending": "订单仍在处理中,请保持此窗口打开。", "polling_failed": "查询支付状态失败,正在重试...", "session_id_label": "会话ID", "order_id_label": "订单ID", "order_status_label": "订单状态", "provider_status_label": "支付通道状态", "amount_label": "金额", "credits_added_label": "预计到账积分", "result_success": "支付已完成。", "result_failed": "支付失败或未完成。", "order_status_values": { "pending": "待处理", "completed": "已完成", "failed": "失败", "refunded": "已退款" }, "provider_status_values": { "pending": "待处理", "processing": "处理中", "completed": "已完成", "failed": "失败", "canceled": "已取消", "expired": "已过期", "refunded": "已退款", "unknown": "未知" } };
127901
128612
  const device_flow$4 = { "browser_opened": "已打开浏览器窗口进行授权", "enter_code_hint": "请在浏览器中输入以下代码以完成登录", "cancel": "取消", "try_again": "重试", "expired": "授权码已过期,请重试。", "waiting": "等待浏览器授权..." };
127902
- const history$4 = { "title": "积分记录", "columns": { "time": "时间", "type": "类型", "description": "描述", "credits": "积分" }, "types": { "consume": "消费", "pre_auth": "预授权冻结", "settle": "逐页结算", "pre_auth_release": "释放冻结", "topup": "充值", "refund": "退款", "bonus_grant": "赠送", "bonus_expire": "过期" } };
128613
+ const history$4 = { "title": "积分记录", "tabs": { "credits": "积分流水", "payments": "支付订单" }, "columns": { "time": "时间", "type": "类型", "description": "描述", "credits": "积分" }, "payment_columns": { "time": "时间", "amount_usd": "金额(USD)", "credits_added": "到账积分", "status": "订单状态", "provider_status": "支付通道状态" }, "types": { "consume": "消费", "pre_auth": "预授权冻结", "settle": "逐页结算", "pre_auth_release": "释放冻结", "topup": "充值", "refund": "退款", "bonus_grant": "赠送", "bonus_expire": "过期" } };
127903
128614
  const zhAccount = {
127904
128615
  title: title$8,
127905
128616
  sign_in_hint: sign_in_hint$4,
@@ -128057,9 +128768,9 @@ const sign_out_button$3 = "ログアウト";
128057
128768
  const credit_balance$3 = "クレジット残高";
128058
128769
  const credit_usage_hint$3 = "Lite: 1ページ約10クレジット(A4)、Pro・UltraはLiteの2倍・6倍";
128059
128770
  const monthly_free$3 = { "title": "無料クレジット", "monthly_label": "月間残高", "daily_label": "本日利用可能", "description": "毎月3,000クレジットが無料、1日0時にリセット(UTC+0)", "daily_limit_tooltip": "1日の使用上限: {{limit}}" };
128060
- const paid_credits$3 = { "title": "有料クレジット", "description": "1ドル = 1,500クレジット", "recharge": "チャージ" };
128771
+ const paid_credits$3 = { "title": "有料クレジット", "description": "1ドル = 1,500クレジット", "recharge": "チャージ", "coming_soon": "チャージ機能は近日公開予定です", "checkout_opened": "決済ページをブラウザで開きました。支払いを完了してください。", "checkout_failed": "決済セッションの作成に失敗しました。後でもう一度お試しください。", "checkout_invalid_url": "サーバーから返された決済URLが無効です。", "payment_success": "決済が完了し、クレジットを更新しました。", "payment_cancelled": "決済はキャンセルされました。", "payment_failed": "決済に失敗しました。しばらくしてから再試行してください。", "payment_callback_received": "決済コールバックを受信しました。クレジットを同期中です。", "payment_processing": "支払い確認待ち", "payment_result": "支払い結果", "waiting_for_confirmation": "サーバーからの支払い確認を待機しています...", "cancel_waiting": "キャンセル", "confirm_paid": "支払い完了", "close_dialog": "閉じる", "reconcile_failed": "支払い照合に失敗しました。もう一度お試しください。", "still_pending": "支払いはまだ保留中です。このダイアログを開いたままにしてください。", "polling_failed": "支払いステータスの取得に失敗しました。再試行します...", "session_id_label": "セッションID", "order_id_label": "注文ID", "order_status_label": "注文ステータス", "provider_status_label": "決済プロバイダーステータス", "amount_label": "金額", "credits_added_label": "追加クレジット", "result_success": "支払いが完了しました。", "result_failed": "支払いに失敗したか、完了していません。", "order_status_values": { "pending": "保留中", "completed": "完了", "failed": "失敗", "refunded": "返金済み" }, "provider_status_values": { "pending": "保留中", "processing": "処理中", "completed": "完了", "failed": "失敗", "canceled": "キャンセル済み", "expired": "期限切れ", "refunded": "返金済み", "unknown": "不明" } };
128061
128772
  const device_flow$3 = { "browser_opened": "認証のためにブラウザウィンドウが開きました", "enter_code_hint": "ブラウザで以下のコードを入力してサインインを完了してください", "cancel": "キャンセル", "try_again": "再試行", "expired": "認証コードの有効期限が切れました。もう一度お試しください。", "waiting": "ブラウザでの認証を待っています..." };
128062
- const history$3 = { "title": "クレジット履歴", "columns": { "time": "日時", "type": "種類", "description": "説明", "credits": "クレジット" }, "types": { "consume": "消費", "pre_auth": "事前承認", "settle": "ページ精算", "pre_auth_release": "凍結解除", "topup": "チャージ", "refund": "返金", "bonus_grant": "ボーナス", "bonus_expire": "期限切れ" } };
128773
+ const history$3 = { "title": "クレジット履歴", "tabs": { "credits": "クレジット取引", "payments": "支払い注文" }, "columns": { "time": "日時", "type": "種類", "description": "説明", "credits": "クレジット" }, "payment_columns": { "time": "日時", "amount_usd": "金額 (USD)", "credits_added": "追加クレジット", "status": "注文ステータス", "provider_status": "決済プロバイダーステータス" }, "types": { "consume": "消費", "pre_auth": "事前承認", "settle": "ページ精算", "pre_auth_release": "凍結解除", "topup": "チャージ", "refund": "返金", "bonus_grant": "ボーナス", "bonus_expire": "期限切れ" } };
128063
128774
  const jaAccount = {
128064
128775
  title: title$6,
128065
128776
  sign_in_hint: sign_in_hint$3,
@@ -128217,9 +128928,9 @@ const sign_out_button$2 = "Выйти";
128217
128928
  const credit_balance$2 = "Баланс кредитов";
128218
128929
  const credit_usage_hint$2 = "Lite: ~10 кредитов/страница (A4); Pro и Ultra: в 2 и 6 раз";
128219
128930
  const monthly_free$2 = { "title": "Бесплатные кредиты", "monthly_label": "За месяц", "daily_label": "Сегодня", "description": "3 000 бесплатных кредитов в месяц, обновляется 1-го числа в 00:00 (UTC+0)", "daily_limit_tooltip": "Дневной лимит: {{limit}}" };
128220
- const paid_credits$2 = { "title": "Платные кредиты", "description": "1 доллар = 1 500 кредитов", "recharge": "Пополнить" };
128931
+ const paid_credits$2 = { "title": "Платные кредиты", "description": "1 доллар = 1 500 кредитов", "recharge": "Пополнить", "coming_soon": "Пополнение скоро будет доступно", "checkout_opened": "Страница оплаты открыта в браузере. Завершите оплату там.", "checkout_failed": "Не удалось создать сессию оплаты. Попробуйте позже.", "checkout_invalid_url": "Сервер вернул некорректную ссылку оплаты.", "payment_success": "Оплата успешна. Баланс кредитов обновлён.", "payment_cancelled": "Оплата отменена.", "payment_failed": "Оплата не удалась. Попробуйте позже.", "payment_callback_received": "Получен callback оплаты. Синхронизируем кредиты.", "payment_processing": "Ожидание подтверждения оплаты", "payment_result": "Результат оплаты", "waiting_for_confirmation": "Ожидание подтверждения статуса оплаты от сервера...", "cancel_waiting": "Отменить", "confirm_paid": "Я уже оплатил", "close_dialog": "Закрыть", "reconcile_failed": "Не удалось выполнить сверку платежа. Попробуйте снова.", "still_pending": "Платеж все еще в ожидании. Оставьте это окно открытым.", "polling_failed": "Не удалось получить статус платежа. Повторяем попытку...", "session_id_label": "ID сессии", "order_id_label": "ID заказа", "order_status_label": "Статус заказа", "provider_status_label": "Статус провайдера", "amount_label": "Сумма", "credits_added_label": "Начисляемые кредиты", "result_success": "Оплата успешно завершена.", "result_failed": "Оплата не выполнена или завершилась ошибкой.", "order_status_values": { "pending": "В ожидании", "completed": "Завершен", "failed": "Ошибка", "refunded": "Возврат" }, "provider_status_values": { "pending": "В ожидании", "processing": "Обработка", "completed": "Завершен", "failed": "Ошибка", "canceled": "Отменен", "expired": "Истек", "refunded": "Возврат", "unknown": "Неизвестно" } };
128221
128932
  const device_flow$2 = { "browser_opened": "Окно браузера открыто для авторизации", "enter_code_hint": "Введите код ниже в браузере для завершения входа", "cancel": "Отмена", "try_again": "Повторить", "expired": "Код авторизации истёк. Пожалуйста, попробуйте снова.", "waiting": "Ожидание авторизации в браузере..." };
128222
- const history$2 = { "title": "История кредитов", "columns": { "time": "Время", "type": "Тип", "description": "Описание", "credits": "Кредиты" }, "types": { "consume": "Расход", "pre_auth": "Предавторизация", "settle": "Постраничный расчёт", "pre_auth_release": "Разморозка", "topup": "Пополнение", "refund": "Возврат", "bonus_grant": "Бонус", "bonus_expire": "Истёк" } };
128933
+ const history$2 = { "title": "История кредитов", "tabs": { "credits": "Транзакции кредитов", "payments": "Платежные заказы" }, "columns": { "time": "Время", "type": "Тип", "description": "Описание", "credits": "Кредиты" }, "payment_columns": { "time": "Время", "amount_usd": "Сумма (USD)", "credits_added": "Начислено кредитов", "status": "Статус заказа", "provider_status": "Статус провайдера" }, "types": { "consume": "Расход", "pre_auth": "Предавторизация", "settle": "Постраничный расчёт", "pre_auth_release": "Разморозка", "topup": "Пополнение", "refund": "Возврат", "bonus_grant": "Бонус", "bonus_expire": "Истёк" } };
128223
128934
  const ruAccount = {
128224
128935
  title: title$4,
128225
128936
  sign_in_hint: sign_in_hint$2,
@@ -128377,9 +129088,9 @@ const sign_out_button$1 = "خروج";
128377
129088
  const credit_balance$1 = "موجودی اعتبار";
128378
129089
  const credit_usage_hint$1 = "Lite: حدود ۱۰ اعتبار/صفحه (A4); Pro و Ultra: ۲ برابر و ۶ برابر";
128379
129090
  const monthly_free$1 = { "title": "اعتبار رایگان", "monthly_label": "ماهانه", "daily_label": "امروز", "description": "۳٬۰۰۰ اعتبار رایگان در ماه، اول هر ماه ساعت ۰۰:۰۰ بازنشانی می‌شود (UTC+0)", "daily_limit_tooltip": "سقف استفاده روزانه: {{limit}}" };
128380
- const paid_credits$1 = { "title": "اعتبار پرداختی", "description": "۱ دلار = ۱٬۵۰۰ اعتبار", "recharge": "شارژ" };
129091
+ const paid_credits$1 = { "title": "اعتبار پرداختی", "description": "۱ دلار = ۱٬۵۰۰ اعتبار", "recharge": "شارژ", "coming_soon": "قابلیت شارژ به‌زودی فعال می‌شود", "checkout_opened": "صفحه پرداخت در مرورگر باز شد. لطفاً پرداخت را تکمیل کنید.", "checkout_failed": "ایجاد نشست پرداخت ناموفق بود. لطفاً دوباره تلاش کنید.", "checkout_invalid_url": "آدرس پرداخت بازگشتی از سرور نامعتبر است.", "payment_success": "پرداخت با موفقیت انجام شد و اعتبار به‌روزرسانی شد.", "payment_cancelled": "پرداخت لغو شد.", "payment_failed": "پرداخت ناموفق بود. لطفاً بعداً دوباره تلاش کنید.", "payment_callback_received": "بازگشت پرداخت دریافت شد. در حال همگام‌سازی اعتبار.", "payment_processing": "در انتظار تایید پرداخت", "payment_result": "نتیجه پرداخت", "waiting_for_confirmation": "در حال انتظار برای تایید وضعیت پرداخت از سرور...", "cancel_waiting": "لغو", "confirm_paid": "پرداخت را انجام دادم", "close_dialog": "بستن", "reconcile_failed": "تطبیق وضعیت پرداخت ناموفق بود. لطفاً دوباره تلاش کنید.", "still_pending": "پرداخت هنوز در حالت انتظار است. این پنجره را باز نگه دارید.", "polling_failed": "دریافت وضعیت پرداخت ناموفق بود. تلاش مجدد...", "session_id_label": "شناسه نشست", "order_id_label": "شناسه سفارش", "order_status_label": "وضعیت سفارش", "provider_status_label": "وضعیت ارائه‌دهنده", "amount_label": "مبلغ", "credits_added_label": "اعتبار افزوده", "result_success": "پرداخت با موفقیت تکمیل شد.", "result_failed": "پرداخت ناموفق بود یا تکمیل نشد.", "order_status_values": { "pending": "در انتظار", "completed": "تکمیل‌شده", "failed": "ناموفق", "refunded": "بازپرداخت‌شده" }, "provider_status_values": { "pending": "در انتظار", "processing": "در حال پردازش", "completed": "تکمیل‌شده", "failed": "ناموفق", "canceled": "لغو شده", "expired": "منقضی شده", "refunded": "بازپرداخت‌شده", "unknown": "نامشخص" } };
128381
129092
  const device_flow$1 = { "browser_opened": "پنجره مرورگر برای احراز هویت باز شد", "enter_code_hint": "کد زیر را در مرورگر خود وارد کنید تا ورود تکمیل شود", "cancel": "لغو", "try_again": "تلاش مجدد", "expired": "کد احراز هویت منقضی شده است. لطفاً دوباره تلاش کنید.", "waiting": "در انتظار احراز هویت از طریق مرورگر..." };
128382
- const history$1 = { "title": "تاریخچه اعتبار", "columns": { "time": "زمان", "type": "نوع", "description": "توضیحات", "credits": "اعتبار" }, "types": { "consume": "مصرف", "pre_auth": "پیش‌مجوز", "settle": "تسویه صفحه", "pre_auth_release": "آزادسازی مسدودی", "topup": "شارژ", "refund": "بازپرداخت", "bonus_grant": "جایزه", "bonus_expire": "منقضی شده" } };
129093
+ const history$1 = { "title": "تاریخچه اعتبار", "tabs": { "credits": "تراکنش‌های اعتبار", "payments": "سفارش‌های پرداخت" }, "columns": { "time": "زمان", "type": "نوع", "description": "توضیحات", "credits": "اعتبار" }, "payment_columns": { "time": "زمان", "amount_usd": "مبلغ (USD)", "credits_added": "اعتبار افزوده", "status": "وضعیت سفارش", "provider_status": "وضعیت ارائه‌دهنده" }, "types": { "consume": "مصرف", "pre_auth": "پیش‌مجوز", "settle": "تسویه صفحه", "pre_auth_release": "آزادسازی مسدودی", "topup": "شارژ", "refund": "بازپرداخت", "bonus_grant": "جایزه", "bonus_expire": "منقضی شده" } };
128383
129094
  const faAccount = {
128384
129095
  title: title$2,
128385
129096
  sign_in_hint: sign_in_hint$1,
@@ -128537,9 +129248,9 @@ const sign_out_button = "تسجيل الخروج";
128537
129248
  const credit_balance = "رصيد الاعتمادات";
128538
129249
  const credit_usage_hint = "Lite: ١٠ اعتمادات/صفحة تقريباً (A4); Pro و Ultra: ضعف و 6 أضعاف";
128539
129250
  const monthly_free = { "title": "الاعتمادات المجانية", "monthly_label": "الشهري", "daily_label": "اليوم", "description": "٣٬٠٠٠ اعتماد مجاني شهرياً، يُعاد تعيينه في الأول من كل شهر الساعة ٠٠:٠٠ (UTC+0)", "daily_limit_tooltip": "الحد اليومي للاستخدام: {{limit}}" };
128540
- const paid_credits = { "title": "الاعتمادات المدفوعة", "description": "١ دولار = ١٬٥٠٠ اعتماد", "recharge": "إعادة الشحن" };
129251
+ const paid_credits = { "title": "الاعتمادات المدفوعة", "description": "١ دولار = ١٬٥٠٠ اعتماد", "recharge": "إعادة الشحن", "coming_soon": "ستتوفر ميزة الشحن قريباً", "checkout_opened": "تم فتح صفحة الدفع في المتصفح. يرجى إكمال الدفع هناك.", "checkout_failed": "فشل إنشاء جلسة الدفع. يرجى المحاولة مرة أخرى لاحقاً.", "checkout_invalid_url": "رابط الدفع المُعاد من الخادم غير صالح.", "payment_success": "تم الدفع بنجاح وتم تحديث الرصيد.", "payment_cancelled": "تم إلغاء الدفع.", "payment_failed": "فشل الدفع. يرجى المحاولة مرة أخرى لاحقاً.", "payment_callback_received": "تم استلام رد الدفع. جارٍ مزامنة الرصيد.", "payment_processing": "بانتظار تأكيد الدفع", "payment_result": "نتيجة الدفع", "waiting_for_confirmation": "بانتظار تأكيد حالة الدفع من الخادم...", "cancel_waiting": "إلغاء", "confirm_paid": "أكملت الدفع", "close_dialog": "إغلاق", "reconcile_failed": "فشلت مطابقة حالة الدفع. يرجى المحاولة مرة أخرى.", "still_pending": "لا يزال الدفع قيد الانتظار. أبقِ هذه النافذة مفتوحة.", "polling_failed": "تعذر الاستعلام عن حالة الدفع. تتم إعادة المحاولة...", "session_id_label": "معرّف الجلسة", "order_id_label": "معرّف الطلب", "order_status_label": "حالة الطلب", "provider_status_label": "حالة المزود", "amount_label": "المبلغ", "credits_added_label": "الاعتمادات المضافة", "result_success": "اكتمل الدفع بنجاح.", "result_failed": "فشل الدفع أو لم يكتمل.", "order_status_values": { "pending": "قيد الانتظار", "completed": "مكتمل", "failed": "فشل", "refunded": "تم الاسترداد" }, "provider_status_values": { "pending": "قيد الانتظار", "processing": "جارٍ المعالجة", "completed": "مكتمل", "failed": "فشل", "canceled": "تم الإلغاء", "expired": "منتهي الصلاحية", "refunded": "تم الاسترداد", "unknown": "غير معروف" } };
128541
129252
  const device_flow = { "browser_opened": "تم فتح نافذة المتصفح للتفويض", "enter_code_hint": "أدخل الرمز أدناه في متصفحك لإتمام تسجيل الدخول", "cancel": "إلغاء", "try_again": "إعادة المحاولة", "expired": "انتهت صلاحية رمز التفويض. يرجى المحاولة مرة أخرى.", "waiting": "في انتظار التفويض عبر المتصفح..." };
128542
- const history = { "title": "سجل الاعتمادات", "columns": { "time": "الوقت", "type": "النوع", "description": "الوصف", "credits": "الاعتمادات" }, "types": { "consume": "استهلاك", "pre_auth": "تفويض مسبق", "settle": "تسوية صفحة", "pre_auth_release": "إلغاء التجميد", "topup": "شحن", "refund": "استرداد", "bonus_grant": "مكافأة", "bonus_expire": "منتهي الصلاحية" } };
129253
+ const history = { "title": "سجل الاعتمادات", "tabs": { "credits": "سجل الاعتمادات", "payments": "طلبات الدفع" }, "columns": { "time": "الوقت", "type": "النوع", "description": "الوصف", "credits": "الاعتمادات" }, "payment_columns": { "time": "الوقت", "amount_usd": "المبلغ (USD)", "credits_added": "الاعتمادات المضافة", "status": "حالة الطلب", "provider_status": "حالة المزود" }, "types": { "consume": "استهلاك", "pre_auth": "تفويض مسبق", "settle": "تسوية صفحة", "pre_auth_release": "إلغاء التجميد", "topup": "شحن", "refund": "استرداد", "bonus_grant": "مكافأة", "bonus_expire": "منتهي الصلاحية" } };
128543
129254
  const arAccount = {
128544
129255
  title,
128545
129256
  sign_in_hint,
@@ -128926,6 +129637,94 @@ const CloudProvider = ({ children }) => {
128926
129637
  return { success: false, error: error instanceof Error ? error.message : String(error) };
128927
129638
  }
128928
129639
  }, [isAuthenticated]);
129640
+ const createCheckout = reactExports.useCallback(async (amountUsd) => {
129641
+ if (!isAuthenticated) {
129642
+ return { success: false, error: "User not signed in" };
129643
+ }
129644
+ try {
129645
+ if (!window.api?.cloud?.createCheckout) {
129646
+ return { success: false, error: "Cloud API not available" };
129647
+ }
129648
+ const result = await window.api.cloud.createCheckout({ amountUsd });
129649
+ if (result.success && result.data) {
129650
+ return {
129651
+ success: true,
129652
+ data: {
129653
+ checkoutUrl: result.data.checkout_url,
129654
+ sessionId: result.data.session_id,
129655
+ amountUsd: result.data.amount_usd,
129656
+ creditsToAdd: result.data.credits_to_add
129657
+ }
129658
+ };
129659
+ }
129660
+ return { success: false, error: result.error || "Failed to create checkout session" };
129661
+ } catch (error) {
129662
+ console.error("Failed to create checkout session:", error);
129663
+ return {
129664
+ success: false,
129665
+ error: error instanceof Error ? error.message : String(error)
129666
+ };
129667
+ }
129668
+ }, [isAuthenticated]);
129669
+ const mapCheckoutStatus = reactExports.useCallback((data) => ({
129670
+ sessionId: data.session_id,
129671
+ orderId: data.order_id,
129672
+ status: data.status,
129673
+ providerStatus: data.provider_status,
129674
+ isFinal: data.is_final,
129675
+ changed: data.changed,
129676
+ amountUsd: data.amount_usd,
129677
+ creditsAdded: data.credits_added,
129678
+ createdAt: data.created_at
129679
+ }), []);
129680
+ const getCheckoutStatus = reactExports.useCallback(async (sessionId, waitSeconds = 10) => {
129681
+ if (!isAuthenticated) {
129682
+ return { success: false, error: "User not signed in" };
129683
+ }
129684
+ try {
129685
+ if (!window.api?.cloud?.getCheckoutStatus) {
129686
+ return { success: false, error: "Cloud API not available" };
129687
+ }
129688
+ const result = await window.api.cloud.getCheckoutStatus({ sessionId, waitSeconds });
129689
+ if (!result.success || !result.data) {
129690
+ return { success: false, error: result.error || "Failed to get checkout status" };
129691
+ }
129692
+ return {
129693
+ success: true,
129694
+ data: mapCheckoutStatus(result.data)
129695
+ };
129696
+ } catch (error) {
129697
+ console.error("Failed to get checkout status:", error);
129698
+ return {
129699
+ success: false,
129700
+ error: error instanceof Error ? error.message : String(error)
129701
+ };
129702
+ }
129703
+ }, [isAuthenticated, mapCheckoutStatus]);
129704
+ const reconcileCheckout = reactExports.useCallback(async (sessionId) => {
129705
+ if (!isAuthenticated) {
129706
+ return { success: false, error: "User not signed in" };
129707
+ }
129708
+ try {
129709
+ if (!window.api?.cloud?.reconcileCheckout) {
129710
+ return { success: false, error: "Cloud API not available" };
129711
+ }
129712
+ const result = await window.api.cloud.reconcileCheckout({ sessionId });
129713
+ if (!result.success || !result.data) {
129714
+ return { success: false, error: result.error || "Failed to reconcile checkout" };
129715
+ }
129716
+ return {
129717
+ success: true,
129718
+ data: mapCheckoutStatus(result.data)
129719
+ };
129720
+ } catch (error) {
129721
+ console.error("Failed to reconcile checkout:", error);
129722
+ return {
129723
+ success: false,
129724
+ error: error instanceof Error ? error.message : String(error)
129725
+ };
129726
+ }
129727
+ }, [isAuthenticated, mapCheckoutStatus]);
128929
129728
  const getCreditHistory = reactExports.useCallback(async (page = 1, pageSize = 10, type4) => {
128930
129729
  if (!isAuthenticated) {
128931
129730
  return { success: false, error: "User not signed in" };
@@ -128967,6 +129766,42 @@ const CloudProvider = ({ children }) => {
128967
129766
  };
128968
129767
  }
128969
129768
  }, [isAuthenticated]);
129769
+ const getPaymentHistory = reactExports.useCallback(async (page = 1, pageSize = 10) => {
129770
+ if (!isAuthenticated) {
129771
+ return { success: false, error: "User not signed in" };
129772
+ }
129773
+ try {
129774
+ if (window.api?.cloud) {
129775
+ const result = await window.api.cloud.getPaymentHistory({ page, pageSize });
129776
+ if (result.success) {
129777
+ const transformedData = (result.data || []).map((item) => ({
129778
+ id: item.id,
129779
+ amountUsd: item.amount_usd,
129780
+ creditsAdded: item.credits_added,
129781
+ status: item.status,
129782
+ providerStatus: item.provider_status,
129783
+ createdAt: item.created_at
129784
+ }));
129785
+ const pagination = result.pagination ? {
129786
+ page: result.pagination.page,
129787
+ pageSize: result.pagination.page_size,
129788
+ total: result.pagination.total,
129789
+ totalPages: result.pagination.total_pages
129790
+ } : void 0;
129791
+ return { success: true, data: transformedData, pagination };
129792
+ }
129793
+ return { success: false, error: result.error };
129794
+ } else {
129795
+ return { success: false, error: "Cloud API not available" };
129796
+ }
129797
+ } catch (error) {
129798
+ console.error("Failed to fetch payment history:", error);
129799
+ return {
129800
+ success: false,
129801
+ error: error instanceof Error ? error.message : String(error)
129802
+ };
129803
+ }
129804
+ }, [isAuthenticated]);
128970
129805
  reactExports.useEffect(() => {
128971
129806
  if (isAuthenticated) {
128972
129807
  refreshCredits();
@@ -128982,6 +129817,16 @@ const CloudProvider = ({ children }) => {
128982
129817
  window.api?.cloud?.sseDisconnect?.();
128983
129818
  };
128984
129819
  }, [isAuthenticated]);
129820
+ reactExports.useEffect(() => {
129821
+ if (!window.api?.events?.onPaymentCallback) return;
129822
+ const cleanup2 = window.api.events.onPaymentCallback((event) => {
129823
+ console.log("[CloudContext] Payment callback received:", event);
129824
+ if (isAuthenticated) {
129825
+ refreshCredits();
129826
+ }
129827
+ });
129828
+ return cleanup2;
129829
+ }, [isAuthenticated, refreshCredits]);
128985
129830
  return /* @__PURE__ */ jsxRuntimeExports.jsx(
128986
129831
  CloudContext.Provider,
128987
129832
  {
@@ -129008,7 +129853,11 @@ const CloudProvider = ({ children }) => {
129008
129853
  retryPage,
129009
129854
  getTaskResult,
129010
129855
  downloadResult,
129011
- getCreditHistory
129856
+ createCheckout,
129857
+ getCheckoutStatus,
129858
+ reconcileCheckout,
129859
+ getCreditHistory,
129860
+ getPaymentHistory
129012
129861
  },
129013
129862
  children
129014
129863
  }