create-fullstack-scaffold 0.4.2 → 0.4.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/dist/cli/index.js +513 -122
  2. package/dist/cli/index.js.map +1 -1
  3. package/package.json +1 -1
  4. package/template/dist/cli/index.js +237 -94
  5. package/template/dist/cli/index.js.map +1 -1
  6. package/template/dist/client/admin.html +15 -10
  7. package/template/dist/client/assets/App-BpFUIC-5.js +114 -0
  8. package/template/dist/client/assets/{CartPage-DESSHkaG.js → CartPage-DgDZP-R5.js} +2 -2
  9. package/template/dist/client/assets/{CategoriesPage-DqLZ_Mom.js → CategoriesPage-fuYNiSmE.js} +2 -2
  10. package/template/dist/client/assets/ContentDetailPage-BvvFU1Mr.js +1 -0
  11. package/template/dist/client/assets/ContentListPage-ShPxo6WG.js +1 -0
  12. package/template/dist/client/assets/DashboardPage-C1rZzZo4.js +11 -0
  13. package/template/dist/client/assets/{DeveloperDashboardPage-Cum7zFwO.js → DeveloperDashboardPage-_WtmbVoA.js} +2 -2
  14. package/template/dist/client/assets/{EmptyState-BK7ttK8D.js → EmptyState-DEyOQjbY.js} +1 -1
  15. package/template/dist/client/assets/LoadingSpinner-BcHjaM1m.js +6 -0
  16. package/template/dist/client/assets/LoginPage-CjeQqDdO.js +1 -0
  17. package/template/dist/client/assets/LogoutOutlined-ColFAHdd.js +1 -0
  18. package/template/dist/client/assets/NotificationPage-DRkEv02s.js +1 -0
  19. package/template/dist/client/assets/OrdersPage-7I3vPWLP.js +11 -0
  20. package/template/dist/client/assets/{PluginDetailPage-Br24YS4P.js → PluginDetailPage-CWyxdVCg.js} +3 -13
  21. package/template/dist/client/assets/PluginsPage-DRgWLeJT.js +6 -0
  22. package/template/dist/client/assets/ProfilePage-2FFkaii8.js +16 -0
  23. package/template/dist/client/assets/PublishPage-DW7yvROx.js +1 -0
  24. package/template/dist/client/assets/{RegisterPage-rPFG4Sry.js → RegisterPage-Dvaf9b0e.js} +2 -2
  25. package/template/dist/client/assets/SaveOutlined-CLQ2tsSY.js +2 -0
  26. package/template/dist/client/assets/{SearchPage-DQl1U5Uy.js → SearchPage-DvnEyswS.js} +2 -2
  27. package/template/dist/client/assets/{SettingsPage-DaYE80wj.js → SettingsPage-IrU-L9Zr.js} +2 -2
  28. package/template/dist/client/assets/{StatusBadge-BJ3W2Zc7.js → StatusBadge-CG7wVqpu.js} +1 -1
  29. package/template/dist/client/assets/{TodoPage-zC5wWNBa.js → TodoPage-B7D-bl65.js} +3 -3
  30. package/template/dist/client/assets/TopicsPage-CYCNr-mn.js +6 -0
  31. package/template/dist/client/assets/{WebSocketPage-B4NLdz1w.js → WebSocketPage-CGEg6QJE.js} +2 -2
  32. package/template/dist/client/assets/{activity-B94BUAsD.js → activity-CgTz9Mrd.js} +1 -1
  33. package/template/dist/client/assets/admin-D2iHWNOg.js +1 -0
  34. package/template/dist/client/assets/api-request-DIJocPxr.js +356 -0
  35. package/template/dist/client/assets/{arrow-left-H5JH0iU1.js → arrow-left-DtLQ3tTk.js} +1 -1
  36. package/template/dist/client/assets/{chevron-down-DwRh_wjD.js → chevron-down-CpIAV_yr.js} +1 -1
  37. package/template/dist/client/assets/{chevron-right-CpIWaqAL.js → chevron-right-CnU7oPQs.js} +1 -1
  38. package/template/dist/client/assets/{circle-check-big-CSElLscG.js → circle-check-big-CrZdwS75.js} +1 -1
  39. package/template/dist/client/assets/{circle-x-CYxr4RAw.js → circle-x-CvN9r3fW.js} +1 -1
  40. package/template/dist/client/assets/{clock-BseUJ7ex.js → clock-CTeSZBiH.js} +1 -1
  41. package/template/dist/client/assets/{download-BsGC_Xhq.js → download-OSVfVuNV.js} +1 -1
  42. package/template/dist/client/assets/{external-link-UTDzdjq8.js → external-link-fBsuHMby.js} +1 -1
  43. package/template/dist/client/assets/{eye-nR10ui7i.js → eye-CwlZZEsj.js} +1 -1
  44. package/template/dist/client/assets/index-09IqiOaE.css +1 -0
  45. package/template/dist/client/assets/index-B3CRby6r.js +51 -0
  46. package/template/dist/client/assets/index-CC_zy73y.js +17 -0
  47. package/template/dist/client/assets/main-Cn4IDo2I.js +92 -0
  48. package/template/dist/client/assets/merchant-DDDN9bMu.js +40 -0
  49. package/template/dist/client/assets/{message-square-CwWGL-Bh.js → message-square-BRaZfgbJ.js} +1 -1
  50. package/template/dist/client/assets/pluginStore-DDsWJPe6.js +1 -0
  51. package/template/dist/client/assets/{plus-pZld_nUL.js → plus-DDZfPiDJ.js} +1 -1
  52. package/template/dist/client/assets/sse-client-DGQ072hl.js +64 -0
  53. package/template/dist/client/assets/star-C7tO6w4H.js +11 -0
  54. package/template/dist/client/assets/{tag-DsiUPF90.js → tag-DBfpQDuJ.js} +1 -1
  55. package/template/dist/client/assets/tenant-CizbLaLJ.js +1 -0
  56. package/template/dist/client/assets/{trash-2-DRblNbnA.js → trash-2-BP7fkd5b.js} +1 -1
  57. package/template/dist/client/assets/{triangle-alert-D1CLh-Vd.js → triangle-alert-CrOQEdJ2.js} +1 -1
  58. package/template/dist/client/assets/{wifi-BwXjnCqI.js → wifi-CwYSE0J4.js} +1 -1
  59. package/template/dist/client/assets/{x-BH2rJdFq.js → x-t615pnNR.js} +1 -1
  60. package/template/dist/client/content/index.html +5 -4
  61. package/template/dist/client/index.html +4 -3
  62. package/template/dist/client/merchant.html +18 -0
  63. package/template/dist/client/notifications/index.html +6 -5
  64. package/template/dist/client/tenant.html +18 -0
  65. package/template/dist/client/todos/index.html +6 -5
  66. package/template/dist/client/websocket/index.html +6 -5
  67. package/template/dist/cloudflare/chunk-HX7DVRDX.js +1 -0
  68. package/template/dist/cloudflare/{chunk-QBHAPWIA.js → chunk-IXJL2LE4.js} +1 -1
  69. package/template/dist/cloudflare/chunk-Q34AN3RF.js +14 -0
  70. package/template/dist/cloudflare/{chunk-BHPTQ4K2.js → chunk-ZAMVL4EG.js} +2 -2
  71. package/template/dist/cloudflare/cloudflare.js +35 -29
  72. package/template/dist/cloudflare/db-4AQOSFAX.js +1 -0
  73. package/template/dist/cloudflare/{migrator-2ZYYKNI5.js → migrator-TEPBVUFO.js} +1 -1
  74. package/template/dist/cloudflare/permission-service-impl-RE7NPW3Q.js +1 -0
  75. package/template/dist/cloudflare/schema-DVEMT3X2.js +1 -0
  76. package/template/dist/cloudflare/test-setup-Z2RYE5B4.js +265 -0
  77. package/template/dist/server/chunk-27SIJSPF.js +1 -0
  78. package/template/dist/server/chunk-37QNGBQU.js +1 -0
  79. package/template/dist/server/chunk-FIY4CGJJ.js +1 -0
  80. package/template/dist/server/chunk-HZUDBIT4.js +1 -0
  81. package/template/dist/server/chunk-I6OBDFDU.js +1 -0
  82. package/template/dist/server/chunk-JHNYLNG7.js +1 -0
  83. package/template/dist/server/chunk-MDOVVKKD.js +1 -0
  84. package/template/dist/server/chunk-NSOCT7E5.js +1 -0
  85. package/template/dist/server/chunk-OU5IGVVO.js +1 -0
  86. package/template/dist/server/chunk-OYCBNRMK.js +1 -0
  87. package/template/dist/server/chunk-P2RJNNGD.js +1 -0
  88. package/template/dist/server/chunk-UMAQLNPE.js +1 -0
  89. package/template/dist/server/chunk-XZZTSRSN.js +1 -0
  90. package/template/dist/server/content-service-5QVHDR5X.js +1 -0
  91. package/template/dist/server/db-FLI5L5DD.js +1 -0
  92. package/template/dist/server/dispute-service-E2FCYUEM.js +1 -0
  93. package/template/dist/server/init-72JXJV3I.js +46 -0
  94. package/template/dist/server/init-FWYXSKPX.js +46 -0
  95. package/template/dist/server/node.js +34 -28
  96. package/template/dist/server/order-service-TKGG5S5K.js +1 -0
  97. package/template/dist/server/permission-service-impl-M3AKEYNY.js +1 -0
  98. package/template/dist/server/schema-V4UG7HMU.js +1 -0
  99. package/template/dist/server/tenant-service-JG6UUWXQ.js +1 -0
  100. package/template/dist/server/tenant-service-XJWZSEDX.js +1 -0
  101. package/template/dist/{cloudflare/test-setup-NMZJZLRV.js → server/test-setup-VFOPBGYM.js} +83 -2
  102. package/template/dist/server/ticket-service-3RSW7V2Z.js +1 -0
  103. package/template/dist/server/todo-service-S6BGIO7D.js +1 -0
  104. package/template/package.json +1 -1
  105. package/template/src/client/App.tsx +3 -1
  106. package/template/src/client/pages/ContentListPage.tsx +36 -4
  107. package/template/src/client/pages/PluginsPage.tsx +112 -20
  108. package/template/src/client/pages/TodoPage.tsx +9 -1
  109. package/template/src/client/preset-ui-config.ts +79 -2
  110. package/template/src/merchant/pages/DisputesPage.tsx +11 -11
  111. package/template/src/merchant/pages/OrdersPage.tsx +4 -3
  112. package/template/src/merchant/pages/ProductsPage.tsx +2 -2
  113. package/template/src/merchant/stores/merchantStore.ts +11 -6
  114. package/template/src/server/db/init.ts +5 -253
  115. package/template/src/server/module-content/routes/topics-routes.ts +250 -0
  116. package/template/src/server/module-content/services/content-service.ts +1 -1
  117. package/template/src/server/module-plugin/services/plugin-seed-service.ts +623 -0
  118. package/template/src/server/module-tenant/routes/tenant-routes.ts +2 -2
  119. package/template/src/server/module-tenant/services/tenant-service.ts +63 -17
  120. package/template/src/server/module-todos/services/todo-service.ts +1 -1
  121. package/template/src/shared/modules/merchant/index.ts +9 -0
  122. package/template/src/shared/modules/merchant/schemas.ts +37 -0
  123. package/template/src/shared/modules/tenant/index.ts +2 -0
  124. package/template/src/shared/schemas/index.ts +27 -0
  125. package/template/src/tenant/layouts/Header.tsx +1 -1
  126. package/template/src/tenant/layouts/Sidebar.tsx +1 -1
  127. package/template/src/tenant/pages/SettingsPage.tsx +4 -8
  128. package/template/src/tenant/stores/tenantStore.ts +41 -302
  129. package/template/tsconfig.json +1 -0
  130. package/template/tsup.config.ts +11 -3
  131. package/template/dist/client/assets/ContentDetailPage-DdltMANL.js +0 -1
  132. package/template/dist/client/assets/ContentListPage-B63sUB6N.js +0 -1
  133. package/template/dist/client/assets/DashboardPage-tUMilc7Z.js +0 -11
  134. package/template/dist/client/assets/LoadingSpinner-DVYOLSRM.js +0 -6
  135. package/template/dist/client/assets/LoginPage-g9mSLIMC.js +0 -6
  136. package/template/dist/client/assets/NotificationPage-COTzp-HD.js +0 -1
  137. package/template/dist/client/assets/OrdersPage-BsPh4oEI.js +0 -11
  138. package/template/dist/client/assets/PluginsPage-BNtAe_yo.js +0 -6
  139. package/template/dist/client/assets/ProfilePage-dL_iSuZN.js +0 -16
  140. package/template/dist/client/assets/PublishPage-D96FnbLA.js +0 -1
  141. package/template/dist/client/assets/TopicsPage-DyLjZa4D.js +0 -6
  142. package/template/dist/client/assets/admin-Bh1vfz_L.js +0 -486
  143. package/template/dist/client/assets/index-1bA-ixFv.js +0 -114
  144. package/template/dist/client/assets/index-CWh3vXC_.css +0 -1
  145. package/template/dist/client/assets/main-DHnArIp_.js +0 -82
  146. package/template/dist/client/assets/pluginStore-XQfsm3iR.js +0 -1
  147. package/template/dist/client/content/content-1/index.html +0 -18
  148. package/template/dist/client/content/content-13/index.html +0 -18
  149. package/template/dist/client/content/content-14/index.html +0 -18
  150. package/template/dist/client/content/content-15/index.html +0 -18
  151. package/template/dist/client/content/content-19/index.html +0 -18
  152. package/template/dist/client/content/content-2/index.html +0 -18
  153. package/template/dist/client/content/content-20/index.html +0 -18
  154. package/template/dist/cloudflare/chunk-YY6FRMAQ.js +0 -14
  155. package/template/dist/cloudflare/db-7J42RQ3T.js +0 -1
  156. package/template/dist/cloudflare/permission-service-impl-TGXVSSSA.js +0 -1
@@ -0,0 +1,114 @@
1
+ var Ri=Object.defineProperty;var Ai=(e,t,n)=>t in e?Ri(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var hn=(e,t,n)=>Ai(e,typeof t!="symbol"?t+"":t,n);import{r as u,R as de,u as qr,j as s,N as Be,c as Et,f as Nn,L as Kr,d as yn,B as Di,a as nr,b as me}from"./index-B3CRby6r.js";import{g as Ge,r as st,u as Z,e as zt,c as T,a3 as yt,aG as Zt,bd as Jr,be as Mi,bf as Yt,aX as Xr,bg as Gr,aY as Yr,aR as Qr,bh as rr,bi as Zi,bj as Li,a$ as Fi,a5 as Bi,a6 as Ui,aW as Ae,m as wt,bk as Hi,bl as Qt,bm as Vi,C as $e,aw as eo,bn as Wi,bo as qi,bp as to,bq as Ki,br as Ji,bs as no,bt as ro,b as En,bu as Xi,bv as Gi,bw as or,f as oo,a4 as so,bx as Yi,k as ue,Z as Qi,U as Lt,Q as Pe,O as Ft,aI as $t,a0 as sr,aH as ea,by as ta,bz as ir,bc as na,bA as ra,aB as oa,aC as sa,bB as ia,aS as ar,bC as aa,K as io,bD as ca,bE as la,az as da,b9 as ua,B as R,bF as fa,X as zn,a7 as ha,I as Me,ab as Pn,ax as ma,bG as pa,b8 as ga,bH as ba,bI as ya,bJ as va,bK as xa,bL as wa,bM as Tn,bN as ja,bO as Sa,bP as ao,bQ as $a,bR as Ca,bS as cr,bT as _a,L as Ct,M as Oa,l as ka,o as Ia,S as Rn,bU as dt,bV as An,p as co,x as Se,T as U,a as N,J as ne,F as D,q as W,w as X,n as lo,v as nt,aV as Na,bb as uo,bW as Ea,t as fo,y as ho,z as mo,A as M,H as za,bX as jt}from"./api-request-DIJocPxr.js";import{u as Pa,A as Ta,R as Ra,a as Aa,b as Da,c as Ma,M as ye}from"./SaveOutlined-CLQ2tsSY.js";import{c as rt,h as Za,W as La,S as Fa,p as Ba,B as po,U as Bt,a as Ua,T as Ha}from"./sse-client-DGQ072hl.js";import{C as Va,T as vn,I as Wa}from"./triangle-alert-CrOQEdJ2.js";import{C as tt}from"./circle-check-big-CrZdwS75.js";import{C as go}from"./circle-x-CvN9r3fW.js";import{g as lr,P as qa,a as Ka,A as Ja,T as Xa}from"./index-CC_zy73y.js";import{C as Ut}from"./clock-CTeSZBiH.js";import{A as Ga}from"./activity-CgTz9Mrd.js";import{E as Dn}from"./eye-CwlZZEsj.js";import{P as Ya}from"./plus-DDZfPiDJ.js";/**
2
+ * @license lucide-react v0.576.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const Qa=[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}],["path",{d:"M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326",key:"11g9vi"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}]],ec=rt("bell-ring",Qa);/**
7
+ * @license lucide-react v0.576.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const tc=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],nc=rt("circle-alert",tc);/**
12
+ * @license lucide-react v0.576.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const rc=[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]],oc=rt("delete",rc);/**
17
+ * @license lucide-react v0.576.0 - ISC
18
+ *
19
+ * This source code is licensed under the ISC license.
20
+ * See the LICENSE file in the root directory of this source tree.
21
+ */const sc=[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]],ic=rt("dollar-sign",sc);/**
22
+ * @license lucide-react v0.576.0 - ISC
23
+ *
24
+ * This source code is licensed under the ISC license.
25
+ * See the LICENSE file in the root directory of this source tree.
26
+ */const ac=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],cc=rt("log-out",ac);/**
27
+ * @license lucide-react v0.576.0 - ISC
28
+ *
29
+ * This source code is licensed under the ISC license.
30
+ * See the LICENSE file in the root directory of this source tree.
31
+ */const lc=[["path",{d:"M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719",key:"1sd12s"}]],dc=rt("message-circle",lc);/**
32
+ * @license lucide-react v0.576.0 - ISC
33
+ *
34
+ * This source code is licensed under the ISC license.
35
+ * See the LICENSE file in the root directory of this source tree.
36
+ */const uc=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],fc=rt("refresh-cw",uc);/**
37
+ * @license lucide-react v0.576.0 - ISC
38
+ *
39
+ * This source code is licensed under the ISC license.
40
+ * See the LICENSE file in the root directory of this source tree.
41
+ */const hc=[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]],mc=rt("square-pen",hc),Tt=(e,t,n,r,o)=>({background:e,border:`${Z(r.lineWidth)} ${r.lineType} ${t}`,[`${o}-icon`]:{color:n}}),pc=e=>{const{componentCls:t,motionDurationSlow:n,marginXS:r,marginSM:o,fontSize:i,fontSizeLG:a,lineHeight:c,borderRadiusLG:l,motionEaseInOutCirc:d,withDescriptionIconSize:f,colorText:h,colorTextHeading:m,withDescriptionPadding:g,defaultPadding:p}=e;return{[t]:Object.assign(Object.assign({},st(e)),{position:"relative",display:"flex",alignItems:"center",padding:p,wordWrap:"break-word",borderRadius:l,[`&${t}-rtl`]:{direction:"rtl"},[`${t}-content`]:{flex:1,minWidth:0},[`${t}-icon`]:{marginInlineEnd:r,lineHeight:0},"&-description":{display:"none",fontSize:i,lineHeight:c},"&-message":{color:m},[`&${t}-motion-leave`]:{overflow:"hidden",opacity:1,transition:`max-height ${n} ${d}, opacity ${n} ${d},
42
+ padding-top ${n} ${d}, padding-bottom ${n} ${d},
43
+ margin-bottom ${n} ${d}`},[`&${t}-motion-leave-active`]:{maxHeight:0,marginBottom:"0 !important",paddingTop:0,paddingBottom:0,opacity:0}}),[`${t}-with-description`]:{alignItems:"flex-start",padding:g,[`${t}-icon`]:{marginInlineEnd:o,fontSize:f,lineHeight:0},[`${t}-message`]:{display:"block",marginBottom:r,color:m,fontSize:a},[`${t}-description`]:{display:"block",color:h}},[`${t}-banner`]:{marginBottom:0,border:"0 !important",borderRadius:0}}},gc=e=>{const{componentCls:t,colorSuccess:n,colorSuccessBorder:r,colorSuccessBg:o,colorWarning:i,colorWarningBorder:a,colorWarningBg:c,colorError:l,colorErrorBorder:d,colorErrorBg:f,colorInfo:h,colorInfoBorder:m,colorInfoBg:g}=e;return{[t]:{"&-success":Tt(o,r,n,e,t),"&-info":Tt(g,m,h,e,t),"&-warning":Tt(c,a,i,e,t),"&-error":Object.assign(Object.assign({},Tt(f,d,l,e,t)),{[`${t}-description > pre`]:{margin:0,padding:0}})}}},bc=e=>{const{componentCls:t,iconCls:n,motionDurationMid:r,marginXS:o,fontSizeIcon:i,colorIcon:a,colorIconHover:c}=e;return{[t]:{"&-action":{marginInlineStart:o},[`${t}-close-icon`]:{marginInlineStart:o,padding:0,overflow:"hidden",fontSize:i,lineHeight:Z(i),backgroundColor:"transparent",border:"none",outline:"none",cursor:"pointer",[`${n}-close`]:{color:a,transition:`color ${r}`,"&:hover":{color:c}}},"&-close-text":{color:a,transition:`color ${r}`,"&:hover":{color:c}}}}},yc=e=>({withDescriptionIconSize:e.fontSizeHeading3,defaultPadding:`${e.paddingContentVerticalSM}px 12px`,withDescriptionPadding:`${e.paddingMD}px ${e.paddingContentHorizontalLG}px`}),vc=Ge("Alert",e=>[pc(e),gc(e),bc(e)],yc);var dr=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const xc={success:Yr,info:Gr,error:Xr,warning:Yt},wc=e=>{const{icon:t,prefixCls:n,type:r}=e,o=xc[r]||null;return t?Mi(t,u.createElement("span",{className:`${n}-icon`},t),()=>({className:T(`${n}-icon`,t.props.className)})):u.createElement(o,{className:`${n}-icon`})},jc=e=>{const{isClosable:t,prefixCls:n,closeIcon:r,handleClose:o,ariaProps:i}=e,a=r===!0||r===void 0?u.createElement(Qr,null):r;return t?u.createElement("button",Object.assign({type:"button",onClick:o,className:`${n}-close-icon`,tabIndex:0},i),a):null},bo=u.forwardRef((e,t)=>{const{description:n,prefixCls:r,message:o,banner:i,className:a,rootClassName:c,style:l,onMouseEnter:d,onMouseLeave:f,onClick:h,afterClose:m,showIcon:g,closable:p,closeText:b,closeIcon:y,action:x,id:v}=e,O=dr(e,["description","prefixCls","message","banner","className","rootClassName","style","onMouseEnter","onMouseLeave","onClick","afterClose","showIcon","closable","closeText","closeIcon","action","id"]),[$,z]=u.useState(!1),j=u.useRef(null);u.useImperativeHandle(t,()=>({nativeElement:j.current}));const{getPrefixCls:C,direction:_,closable:k,closeIcon:S,className:L,style:I}=zt("alert"),E=C("alert",r),[ee,te,fe]=vc(E),F=J=>{var ae;z(!0),(ae=e.onClose)===null||ae===void 0||ae.call(e,J)},B=u.useMemo(()=>e.type!==void 0?e.type:i?"warning":"info",[e.type,i]),ge=u.useMemo(()=>typeof p=="object"&&p.closeIcon||b?!0:typeof p=="boolean"?p:y!==!1&&y!==null&&y!==void 0?!0:!!k,[b,y,p,k]),be=i&&g===void 0?!0:g,V=T(E,`${E}-${B}`,{[`${E}-with-description`]:!!n,[`${E}-no-icon`]:!be,[`${E}-banner`]:!!i,[`${E}-rtl`]:_==="rtl"},L,a,c,fe,te),ce=yt(O,{aria:!0,data:!0}),Q=u.useMemo(()=>typeof p=="object"&&p.closeIcon?p.closeIcon:b||(y!==void 0?y:typeof k=="object"&&k.closeIcon?k.closeIcon:S),[y,p,k,b,S]),le=u.useMemo(()=>{const J=p??k;if(typeof J=="object"){const{closeIcon:ae}=J;return dr(J,["closeIcon"])}return{}},[p,k]);return ee(u.createElement(Zt,{visible:!$,motionName:`${E}-motion`,motionAppear:!1,motionEnter:!1,onLeaveStart:J=>({maxHeight:J.offsetHeight}),onLeaveEnd:m},({className:J,style:ae},Ie)=>u.createElement("div",Object.assign({id:v,ref:Jr(j,Ie),"data-show":!$,className:T(V,J),style:Object.assign(Object.assign(Object.assign({},I),l),ae),onMouseEnter:d,onMouseLeave:f,onClick:h,role:"alert"},ce),be?u.createElement(wc,{description:n,icon:e.icon,prefixCls:E,type:B}):null,u.createElement("div",{className:`${E}-content`},o?u.createElement("div",{className:`${E}-message`},o):null,n?u.createElement("div",{className:`${E}-description`},n):null),x?u.createElement("div",{className:`${E}-action`},x):null,u.createElement(jc,{isClosable:ge,prefixCls:E,closeIcon:Q,handleClose:F,ariaProps:le}))))});function Sc(e,t,n){return t=rr(t),Zi(e,Li()?Reflect.construct(t,n||[],rr(e).constructor):t.apply(e,n))}let $c=(function(e){function t(){var n;return Ui(this,t),n=Sc(this,t,arguments),n.state={error:void 0,info:{componentStack:""}},n}return Fi(t,e),Bi(t,[{key:"componentDidCatch",value:function(r,o){this.setState({error:r,info:o})}},{key:"render",value:function(){const{message:r,description:o,id:i,children:a}=this.props,{error:c,info:l}=this.state,d=(l==null?void 0:l.componentStack)||null,f=typeof r>"u"?(c||"").toString():r,h=typeof o>"u"?d:o;return c?u.createElement(bo,{id:i,type:"error",message:f,description:u.createElement("pre",{style:{fontSize:"0.9em",overflowX:"auto"}},h)}):a}}])})(u.Component);const Dt=bo;Dt.ErrorBoundary=$c;const Cc=e=>{const{componentCls:t,notificationMarginEdge:n,animationMaxHeight:r}=e,o=`${t}-notice`,i=new Ae("antNotificationFadeIn",{"0%":{transform:"translate3d(100%, 0, 0)",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",opacity:1}}),a=new Ae("antNotificationTopFadeIn",{"0%":{top:-r,opacity:0},"100%":{top:0,opacity:1}}),c=new Ae("antNotificationBottomFadeIn",{"0%":{bottom:e.calc(r).mul(-1).equal(),opacity:0},"100%":{bottom:0,opacity:1}}),l=new Ae("antNotificationLeftFadeIn",{"0%":{transform:"translate3d(-100%, 0, 0)",opacity:0},"100%":{transform:"translate3d(0, 0, 0)",opacity:1}});return{[t]:{[`&${t}-top, &${t}-bottom`]:{marginInline:0,[o]:{marginInline:"auto auto"}},[`&${t}-top`]:{[`${t}-fade-enter${t}-fade-enter-active, ${t}-fade-appear${t}-fade-appear-active`]:{animationName:a}},[`&${t}-bottom`]:{[`${t}-fade-enter${t}-fade-enter-active, ${t}-fade-appear${t}-fade-appear-active`]:{animationName:c}},[`&${t}-topRight, &${t}-bottomRight`]:{[`${t}-fade-enter${t}-fade-enter-active, ${t}-fade-appear${t}-fade-appear-active`]:{animationName:i}},[`&${t}-topLeft, &${t}-bottomLeft`]:{marginRight:{value:0,_skip_check_:!0},marginLeft:{value:n,_skip_check_:!0},[o]:{marginInlineEnd:"auto",marginInlineStart:0},[`${t}-fade-enter${t}-fade-enter-active, ${t}-fade-appear${t}-fade-appear-active`]:{animationName:l}}}}},_c=["top","topLeft","topRight","bottom","bottomLeft","bottomRight"],Oc={topLeft:"left",topRight:"right",bottomLeft:"left",bottomRight:"right",top:"left",bottom:"left"},kc=(e,t)=>{const{componentCls:n}=e;return{[`${n}-${t}`]:{[`&${n}-stack > ${n}-notice-wrapper`]:{[t.startsWith("top")?"top":"bottom"]:0,[Oc[t]]:{value:0,_skip_check_:!0}}}}},Ic=e=>{const t={};for(let n=1;n<e.notificationStackLayer;n++)t[`&:nth-last-child(${n+1})`]={overflow:"hidden",[`& > ${e.componentCls}-notice`]:{opacity:0,transition:`opacity ${e.motionDurationMid}`}};return Object.assign({[`&:not(:nth-last-child(-n+${e.notificationStackLayer}))`]:{opacity:0,overflow:"hidden",color:"transparent",pointerEvents:"none"}},t)},Nc=e=>{const t={};for(let n=1;n<e.notificationStackLayer;n++)t[`&:nth-last-child(${n+1})`]={background:e.colorBgBlur,backdropFilter:"blur(10px)","-webkit-backdrop-filter":"blur(10px)"};return Object.assign({},t)},Ec=e=>{const{componentCls:t}=e;return Object.assign({[`${t}-stack`]:{[`& > ${t}-notice-wrapper`]:Object.assign({transition:`transform ${e.motionDurationSlow}, backdrop-filter 0s`,willChange:"transform, opacity",position:"absolute"},Ic(e))},[`${t}-stack:not(${t}-stack-expanded)`]:{[`& > ${t}-notice-wrapper`]:Object.assign({},Nc(e))},[`${t}-stack${t}-stack-expanded`]:{[`& > ${t}-notice-wrapper`]:{"&:not(:nth-last-child(-n + 1))":{opacity:1,overflow:"unset",color:"inherit",pointerEvents:"auto",[`& > ${e.componentCls}-notice`]:{opacity:1}},"&:after":{content:'""',position:"absolute",height:e.margin,width:"100%",insetInline:0,bottom:e.calc(e.margin).mul(-1).equal(),background:"transparent",pointerEvents:"auto"}}}},_c.map(n=>kc(e,n)).reduce((n,r)=>Object.assign(Object.assign({},n),r),{}))},yo=e=>{const{iconCls:t,componentCls:n,boxShadow:r,fontSizeLG:o,notificationMarginBottom:i,borderRadiusLG:a,colorSuccess:c,colorInfo:l,colorWarning:d,colorError:f,colorTextHeading:h,notificationBg:m,notificationPadding:g,notificationMarginEdge:p,notificationProgressBg:b,notificationProgressHeight:y,fontSize:x,lineHeight:v,width:O,notificationIconSize:$,colorText:z,colorSuccessBg:j,colorErrorBg:C,colorInfoBg:_,colorWarningBg:k}=e,S=`${n}-notice`;return{position:"relative",marginBottom:i,marginInlineStart:"auto",background:m,borderRadius:a,boxShadow:r,[S]:{padding:g,width:O,maxWidth:`calc(100vw - ${Z(e.calc(p).mul(2).equal())})`,lineHeight:v,wordWrap:"break-word",borderRadius:a,overflow:"hidden","&-success":j?{background:j}:{},"&-error":C?{background:C}:{},"&-info":_?{background:_}:{},"&-warning":k?{background:k}:{}},[`${S}-message`]:{color:h,fontSize:o,lineHeight:e.lineHeightLG},[`${S}-description`]:{fontSize:x,color:z,marginTop:e.marginXS},[`${S}-closable ${S}-message`]:{paddingInlineEnd:e.paddingLG},[`${S}-with-icon ${S}-message`]:{marginInlineStart:e.calc(e.marginSM).add($).equal(),fontSize:o},[`${S}-with-icon ${S}-description`]:{marginInlineStart:e.calc(e.marginSM).add($).equal(),fontSize:x},[`${S}-icon`]:{position:"absolute",fontSize:$,lineHeight:1,[`&-success${t}`]:{color:c},[`&-info${t}`]:{color:l},[`&-warning${t}`]:{color:d},[`&-error${t}`]:{color:f}},[`${S}-close`]:Object.assign({position:"absolute",top:e.notificationPaddingVertical,insetInlineEnd:e.notificationPaddingHorizontal,color:e.colorIcon,outline:"none",width:e.notificationCloseButtonSize,height:e.notificationCloseButtonSize,borderRadius:e.borderRadiusSM,transition:`background-color ${e.motionDurationMid}, color ${e.motionDurationMid}`,display:"flex",alignItems:"center",justifyContent:"center",background:"none",border:"none","&:hover":{color:e.colorIconHover,backgroundColor:e.colorBgTextHover},"&:active":{backgroundColor:e.colorBgTextActive}},Qt(e)),[`${S}-progress`]:{position:"absolute",display:"block",appearance:"none",inlineSize:`calc(100% - ${Z(a)} * 2)`,left:{_skip_check_:!0,value:a},right:{_skip_check_:!0,value:a},bottom:0,blockSize:y,border:0,"&, &::-webkit-progress-bar":{borderRadius:a,backgroundColor:"rgba(0, 0, 0, 0.04)"},"&::-moz-progress-bar":{background:b},"&::-webkit-progress-value":{borderRadius:a,background:b}},[`${S}-actions`]:{float:"right",marginTop:e.marginSM}}},zc=e=>{const{componentCls:t,notificationMarginBottom:n,notificationMarginEdge:r,motionDurationMid:o,motionEaseInOut:i}=e,a=`${t}-notice`,c=new Ae("antNotificationFadeOut",{"0%":{maxHeight:e.animationMaxHeight,marginBottom:n},"100%":{maxHeight:0,marginBottom:0,paddingTop:0,paddingBottom:0,opacity:0}});return[{[t]:Object.assign(Object.assign({},st(e)),{position:"fixed",zIndex:e.zIndexPopup,marginRight:{value:r,_skip_check_:!0},[`${t}-hook-holder`]:{position:"relative"},[`${t}-fade-appear-prepare`]:{opacity:"0 !important"},[`${t}-fade-enter, ${t}-fade-appear`]:{animationDuration:e.motionDurationMid,animationTimingFunction:i,animationFillMode:"both",opacity:0,animationPlayState:"paused"},[`${t}-fade-leave`]:{animationTimingFunction:i,animationFillMode:"both",animationDuration:o,animationPlayState:"paused"},[`${t}-fade-enter${t}-fade-enter-active, ${t}-fade-appear${t}-fade-appear-active`]:{animationPlayState:"running"},[`${t}-fade-leave${t}-fade-leave-active`]:{animationName:c,animationPlayState:"running"},"&-rtl":{direction:"rtl",[`${a}-actions`]:{float:"left"}}})},{[t]:{[`${a}-wrapper`]:yo(e)}}]},vo=e=>({zIndexPopup:e.zIndexPopupBase+Hi+50,width:384,colorSuccessBg:void 0,colorErrorBg:void 0,colorInfoBg:void 0,colorWarningBg:void 0}),xo=e=>{const t=e.paddingMD,n=e.paddingLG;return wt(e,{notificationBg:e.colorBgElevated,notificationPaddingVertical:t,notificationPaddingHorizontal:n,notificationIconSize:e.calc(e.fontSizeLG).mul(e.lineHeightLG).equal(),notificationCloseButtonSize:e.calc(e.controlHeightLG).mul(.55).equal(),notificationMarginBottom:e.margin,notificationPadding:`${Z(e.paddingMD)} ${Z(e.paddingContentHorizontalLG)}`,notificationMarginEdge:e.marginLG,animationMaxHeight:150,notificationStackLayer:3,notificationProgressHeight:2,notificationProgressBg:`linear-gradient(90deg, ${e.colorPrimaryBorderHover}, ${e.colorPrimary})`})},wo=Ge("Notification",e=>{const t=xo(e);return[zc(t),Cc(t),Ec(t)]},vo),Pc=Vi(["Notification","PurePanel"],e=>{const t=`${e.componentCls}-notice`,n=xo(e);return{[`${t}-pure-panel`]:Object.assign(Object.assign({},yo(n)),{width:n.width,maxWidth:`calc(100vw - ${Z(e.calc(n.notificationMarginEdge).mul(2).equal())})`,margin:0})}},vo);var Tc=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};function Mn(e,t){return t===null||t===!1?null:t||u.createElement(Qr,{className:`${e}-close-icon`})}const Rc={success:Yr,info:Gr,error:Xr,warning:Yt},jo=e=>{const{prefixCls:t,icon:n,type:r,message:o,description:i,actions:a,role:c="alert"}=e;let l=null;return n?l=u.createElement("span",{className:`${t}-icon`},n):r&&(l=u.createElement(Rc[r]||null,{className:T(`${t}-icon`,`${t}-icon-${r}`)})),u.createElement("div",{className:T({[`${t}-with-icon`]:l}),role:c},l,u.createElement("div",{className:`${t}-message`},o),i&&u.createElement("div",{className:`${t}-description`},i),a&&u.createElement("div",{className:`${t}-actions`},a))},Ac=e=>{const{prefixCls:t,className:n,icon:r,type:o,message:i,description:a,btn:c,actions:l,closable:d=!0,closeIcon:f,className:h}=e,m=Tc(e,["prefixCls","className","icon","type","message","description","btn","actions","closable","closeIcon","className"]),{getPrefixCls:g}=u.useContext($e),p=l??c,b=t||g("notification"),y=`${b}-notice`,x=eo(b),[v,O,$]=wo(b,x);return v(u.createElement("div",{className:T(`${y}-pure-panel`,O,n,$,x)},u.createElement(Pc,{prefixCls:b}),u.createElement(Wi,Object.assign({},m,{prefixCls:b,eventKey:"pure",duration:null,closable:d,className:T({notificationClassName:h}),closeIcon:Mn(b,f),content:u.createElement(jo,{prefixCls:y,icon:r,type:o,message:i,description:a,actions:p})}))))};function Dc(e,t,n){let r;switch(e){case"top":r={left:"50%",transform:"translateX(-50%)",right:"auto",top:t,bottom:"auto"};break;case"topLeft":r={left:0,top:t,bottom:"auto"};break;case"topRight":r={right:0,top:t,bottom:"auto"};break;case"bottom":r={left:"50%",transform:"translateX(-50%)",right:"auto",top:"auto",bottom:n};break;case"bottomLeft":r={left:0,top:"auto",bottom:n};break;default:r={right:0,top:"auto",bottom:n};break}return r}function Mc(e){return{motionName:`${e}-fade`}}function Zc(e,t,n){return typeof e<"u"?e:typeof(t==null?void 0:t.closeIcon)<"u"?t.closeIcon:n==null?void 0:n.closeIcon}var Lc=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const ur=24,Fc=4.5,Bc="topRight",Uc=({children:e,prefixCls:t})=>{const n=eo(t),[r,o,i]=wo(t,n);return r(de.createElement(Ji,{classNames:{list:T(o,i,n)}},e))},Hc=(e,{prefixCls:t,key:n})=>de.createElement(Uc,{prefixCls:t,key:n},e),Vc=de.forwardRef((e,t)=>{const{top:n,bottom:r,prefixCls:o,getContainer:i,maxCount:a,rtl:c,onAllRemoved:l,stack:d,duration:f,pauseOnHover:h=!0,showProgress:m}=e,{getPrefixCls:g,getPopupContainer:p,notification:b,direction:y}=u.useContext($e),[,x]=to(),v=o||g("notification"),O=_=>Dc(_,n??ur,r??ur),$=()=>T({[`${v}-rtl`]:c??y==="rtl"}),z=()=>Mc(v),[j,C]=Ki({prefixCls:v,style:O,className:$,motion:z,closable:!0,closeIcon:Mn(v),duration:f??Fc,getContainer:()=>(i==null?void 0:i())||(p==null?void 0:p())||document.body,maxCount:a,pauseOnHover:h,showProgress:m,onAllRemoved:l,renderNotifications:Hc,stack:d===!1?!1:{threshold:typeof d=="object"?d==null?void 0:d.threshold:void 0,offset:8,gap:x.margin}});return de.useImperativeHandle(t,()=>Object.assign(Object.assign({},j),{prefixCls:v,notification:b})),C});function So(e){const t=de.useRef(null);return qi(),[de.useMemo(()=>{const r=c=>{var l;if(!t.current)return;const{open:d,prefixCls:f,notification:h}=t.current,m=`${f}-notice`,{message:g,description:p,icon:b,type:y,btn:x,actions:v,className:O,style:$,role:z="alert",closeIcon:j,closable:C}=c,_=Lc(c,["message","description","icon","type","btn","actions","className","style","role","closeIcon","closable"]),k=v??x,S=Mn(m,Zc(j,e,h));return d(Object.assign(Object.assign({placement:(l=e==null?void 0:e.placement)!==null&&l!==void 0?l:Bc},_),{content:de.createElement(jo,{prefixCls:m,icon:b,type:y,message:g,description:p,actions:k,role:z}),className:T(y&&`${m}-${y}`,O,h==null?void 0:h.className),style:Object.assign(Object.assign({},h==null?void 0:h.style),$),closeIcon:S,closable:C??!!S}))},i={open:r,destroy:c=>{var l,d;c!==void 0?(l=t.current)===null||l===void 0||l.close(c):(d=t.current)===null||d===void 0||d.destroy()}};return["success","info","warning","error"].forEach(c=>{i[c]=l=>r(Object.assign(Object.assign({},l),{type:c}))}),i},[]),de.createElement(Vc,Object.assign({key:"notification-holder"},e,{ref:t}))]}function Wc(e){return So(e)}const qc=new Ae("antStatusProcessing",{"0%":{transform:"scale(0.8)",opacity:.5},"100%":{transform:"scale(2.4)",opacity:0}}),Kc=new Ae("antZoomBadgeIn",{"0%":{transform:"scale(0) translate(50%, -50%)",opacity:0},"100%":{transform:"scale(1) translate(50%, -50%)"}}),Jc=new Ae("antZoomBadgeOut",{"0%":{transform:"scale(1) translate(50%, -50%)"},"100%":{transform:"scale(0) translate(50%, -50%)",opacity:0}}),Xc=new Ae("antNoWrapperZoomBadgeIn",{"0%":{transform:"scale(0)",opacity:0},"100%":{transform:"scale(1)"}}),Gc=new Ae("antNoWrapperZoomBadgeOut",{"0%":{transform:"scale(1)"},"100%":{transform:"scale(0)",opacity:0}}),Yc=new Ae("antBadgeLoadingCircle",{"0%":{transformOrigin:"50%"},"100%":{transform:"translate(50%, -50%) rotate(360deg)",transformOrigin:"50%"}}),Qc=e=>{const{componentCls:t,iconCls:n,antCls:r,badgeShadowSize:o,textFontSize:i,textFontSizeSM:a,statusSize:c,dotSize:l,textFontWeight:d,indicatorHeight:f,indicatorHeightSM:h,marginXS:m,calc:g}=e,p=`${r}-scroll-number`,b=no(e,(y,{darkColor:x})=>({[`&${t} ${t}-color-${y}`]:{background:x,[`&:not(${t}-count)`]:{color:x},"a:hover &":{background:x}}}));return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},st(e)),{position:"relative",display:"inline-block",width:"fit-content",lineHeight:1,[`${t}-count`]:{display:"inline-flex",justifyContent:"center",zIndex:e.indicatorZIndex,minWidth:f,height:f,color:e.badgeTextColor,fontWeight:d,fontSize:i,lineHeight:Z(f),whiteSpace:"nowrap",textAlign:"center",background:e.badgeColor,borderRadius:g(f).div(2).equal(),boxShadow:`0 0 0 ${Z(o)} ${e.badgeShadowColor}`,transition:`background ${e.motionDurationMid}`,a:{color:e.badgeTextColor},"a:hover":{color:e.badgeTextColor},"a:hover &":{background:e.badgeColorHover}},[`${t}-count-sm`]:{minWidth:h,height:h,fontSize:a,lineHeight:Z(h),borderRadius:g(h).div(2).equal()},[`${t}-multiple-words`]:{padding:`0 ${Z(e.paddingXS)}`,bdi:{unicodeBidi:"plaintext"}},[`${t}-dot`]:{zIndex:e.indicatorZIndex,width:l,minWidth:l,height:l,background:e.badgeColor,borderRadius:"100%",boxShadow:`0 0 0 ${Z(o)} ${e.badgeShadowColor}`},[`${t}-count, ${t}-dot, ${p}-custom-component`]:{position:"absolute",top:0,insetInlineEnd:0,transform:"translate(50%, -50%)",transformOrigin:"100% 0%",[`&${n}-spin`]:{animationName:Yc,animationDuration:"1s",animationIterationCount:"infinite",animationTimingFunction:"linear"}},[`&${t}-status`]:{lineHeight:"inherit",verticalAlign:"baseline",[`${t}-status-dot`]:{position:"relative",top:-1,display:"inline-block",width:c,height:c,verticalAlign:"middle",borderRadius:"50%"},[`${t}-status-success`]:{backgroundColor:e.colorSuccess},[`${t}-status-processing`]:{overflow:"visible",color:e.colorInfo,backgroundColor:e.colorInfo,borderColor:"currentcolor","&::after":{position:"absolute",top:0,insetInlineStart:0,width:"100%",height:"100%",borderWidth:o,borderStyle:"solid",borderColor:"inherit",borderRadius:"50%",animationName:qc,animationDuration:e.badgeProcessingDuration,animationIterationCount:"infinite",animationTimingFunction:"ease-in-out",content:'""'}},[`${t}-status-default`]:{backgroundColor:e.colorTextPlaceholder},[`${t}-status-error`]:{backgroundColor:e.colorError},[`${t}-status-warning`]:{backgroundColor:e.colorWarning},[`${t}-status-text`]:{marginInlineStart:m,color:e.colorText,fontSize:e.fontSize}}}),b),{[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:Kc,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},[`${t}-zoom-leave`]:{animationName:Jc,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack,animationFillMode:"both"},[`&${t}-not-a-wrapper`]:{[`${t}-zoom-appear, ${t}-zoom-enter`]:{animationName:Xc,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`${t}-zoom-leave`]:{animationName:Gc,animationDuration:e.motionDurationSlow,animationTimingFunction:e.motionEaseOutBack},[`&:not(${t}-status)`]:{verticalAlign:"middle"},[`${p}-custom-component, ${t}-count`]:{transform:"none"},[`${p}-custom-component, ${p}`]:{position:"relative",top:"auto",display:"block",transformOrigin:"50% 50%"}},[p]:{overflow:"hidden",transition:`all ${e.motionDurationMid} ${e.motionEaseOutBack}`,[`${p}-only`]:{position:"relative",display:"inline-block",height:f,transition:`all ${e.motionDurationSlow} ${e.motionEaseOutBack}`,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden",[`> p${p}-only-unit`]:{height:f,margin:0,WebkitTransformStyle:"preserve-3d",WebkitBackfaceVisibility:"hidden"}},[`${p}-symbol`]:{verticalAlign:"top"}},"&-rtl":{direction:"rtl",[`${t}-count, ${t}-dot, ${p}-custom-component`]:{transform:"translate(-50%, -50%)"}}})}},$o=e=>{const{fontHeight:t,lineWidth:n,marginXS:r,colorBorderBg:o}=e,i=t,a=n,c=e.colorTextLightSolid,l=e.colorError,d=e.colorErrorHover;return wt(e,{badgeFontHeight:i,badgeShadowSize:a,badgeTextColor:c,badgeColor:l,badgeColorHover:d,badgeShadowColor:o,badgeProcessingDuration:"1.2s",badgeRibbonOffset:r,badgeRibbonCornerTransform:"scaleY(0.75)",badgeRibbonCornerFilter:"brightness(75%)"})},Co=e=>{const{fontSize:t,lineHeight:n,fontSizeSM:r,lineWidth:o}=e;return{indicatorZIndex:"auto",indicatorHeight:Math.round(t*n)-2*o,indicatorHeightSM:t,dotSize:r/2,textFontSize:r,textFontSizeSM:r,textFontWeight:"normal",statusSize:r/2}},el=Ge("Badge",e=>{const t=$o(e);return Qc(t)},Co),tl=e=>{const{antCls:t,badgeFontHeight:n,marginXS:r,badgeRibbonOffset:o,calc:i}=e,a=`${t}-ribbon`,c=`${t}-ribbon-wrapper`,l=no(e,(d,{darkColor:f})=>({[`&${a}-color-${d}`]:{background:f,color:f}}));return{[c]:{position:"relative"},[a]:Object.assign(Object.assign(Object.assign(Object.assign({},st(e)),{position:"absolute",top:r,padding:`0 ${Z(e.paddingXS)}`,color:e.colorPrimary,lineHeight:Z(n),whiteSpace:"nowrap",backgroundColor:e.colorPrimary,borderRadius:e.borderRadiusSM,[`${a}-text`]:{color:e.badgeTextColor},[`${a}-corner`]:{position:"absolute",top:"100%",width:o,height:o,color:"currentcolor",border:`${Z(i(o).div(2).equal())} solid`,transform:e.badgeRibbonCornerTransform,transformOrigin:"top",filter:e.badgeRibbonCornerFilter}}),l),{[`&${a}-placement-end`]:{insetInlineEnd:i(o).mul(-1).equal(),borderEndEndRadius:0,[`${a}-corner`]:{insetInlineEnd:0,borderInlineEndColor:"transparent",borderBlockEndColor:"transparent"}},[`&${a}-placement-start`]:{insetInlineStart:i(o).mul(-1).equal(),borderEndStartRadius:0,[`${a}-corner`]:{insetInlineStart:0,borderBlockEndColor:"transparent",borderInlineStartColor:"transparent"}},"&-rtl":{direction:"rtl"}})}},nl=Ge(["Badge","Ribbon"],e=>{const t=$o(e);return tl(t)},Co),rl=e=>{const{className:t,prefixCls:n,style:r,color:o,children:i,text:a,placement:c="end",rootClassName:l}=e,{getPrefixCls:d,direction:f}=u.useContext($e),h=d("ribbon",n),m=`${h}-wrapper`,[g,p,b]=nl(h,m),y=ro(o,!1),x=T(h,`${h}-placement-${c}`,{[`${h}-rtl`]:f==="rtl",[`${h}-color-${o}`]:y},t),v={},O={};return o&&!y&&(v.background=o,O.color=o),g(u.createElement("div",{className:T(m,l,p,b)},i,u.createElement("div",{className:T(x,p),style:Object.assign(Object.assign({},v),r)},u.createElement("span",{className:`${h}-text`},a),u.createElement("div",{className:`${h}-corner`,style:O}))))},fr=e=>{const{prefixCls:t,value:n,current:r,offset:o=0}=e;let i;return o&&(i={position:"absolute",top:`${o}00%`,left:0}),u.createElement("span",{style:i,className:T(`${t}-only-unit`,{current:r})},n)};function ol(e,t,n){let r=e,o=0;for(;(r+10)%10!==t;)r+=n,o+=n;return o}const sl=e=>{const{prefixCls:t,count:n,value:r}=e,o=Number(r),i=Math.abs(n),[a,c]=u.useState(o),[l,d]=u.useState(i),f=()=>{c(o),d(i)};u.useEffect(()=>{const g=setTimeout(f,1e3);return()=>clearTimeout(g)},[o]);let h,m;if(a===o||Number.isNaN(o)||Number.isNaN(a))h=[u.createElement(fr,Object.assign({},e,{key:o,current:!0}))],m={transition:"none"};else{h=[];const g=o+10,p=[];for(let v=o;v<=g;v+=1)p.push(v);const b=l<i?1:-1,y=p.findIndex(v=>v%10===a);h=(b<0?p.slice(0,y+1):p.slice(y)).map((v,O)=>{const $=v%10;return u.createElement(fr,Object.assign({},e,{key:v,value:$,offset:b<0?O-y:O,current:O===y}))}),m={transform:`translateY(${-ol(a,o,b)}00%)`}}return u.createElement("span",{className:`${t}-only`,style:m,onTransitionEnd:f},h)};var il=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const al=u.forwardRef((e,t)=>{const{prefixCls:n,count:r,className:o,motionClassName:i,style:a,title:c,show:l,component:d="sup",children:f}=e,h=il(e,["prefixCls","count","className","motionClassName","style","title","show","component","children"]),{getPrefixCls:m}=u.useContext($e),g=m("scroll-number",n),p=Object.assign(Object.assign({},h),{"data-show":l,style:a,className:T(g,o,i),title:c});let b=r;if(r&&Number(r)%1===0){const y=String(r).split("");b=u.createElement("bdi",null,y.map((x,v)=>u.createElement(sl,{prefixCls:g,count:Number(r),value:x,key:y.length-v})))}return a!=null&&a.borderColor&&(p.style=Object.assign(Object.assign({},a),{boxShadow:`0 0 0 1px ${a.borderColor} inset`})),f?En(f,y=>({className:T(`${g}-custom-component`,y==null?void 0:y.className,i)})):u.createElement(d,Object.assign({},p,{ref:t}),b)});var cl=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const ll=u.forwardRef((e,t)=>{var n,r,o,i,a;const{prefixCls:c,scrollNumberPrefixCls:l,children:d,status:f,text:h,color:m,count:g=null,overflowCount:p=99,dot:b=!1,size:y="default",title:x,offset:v,style:O,className:$,rootClassName:z,classNames:j,styles:C,showZero:_=!1}=e,k=cl(e,["prefixCls","scrollNumberPrefixCls","children","status","text","color","count","overflowCount","dot","size","title","offset","style","className","rootClassName","classNames","styles","showZero"]),{getPrefixCls:S,direction:L,badge:I}=u.useContext($e),E=S("badge",c),[ee,te,fe]=el(E),F=g>p?`${p}+`:g,B=F==="0"||F===0||h==="0"||h===0,ge=g===null||B&&!_,be=(f!=null||m!=null)&&ge,V=f!=null||!B,ce=b&&!B,Q=ce?"":F,le=u.useMemo(()=>((Q==null||Q==="")&&(h==null||h==="")||B&&!_)&&!ce,[Q,B,_,ce,h]),J=u.useRef(g);le||(J.current=g);const ae=J.current,Ie=u.useRef(Q);le||(Ie.current=Q);const qe=Ie.current,Ze=u.useRef(ce);le||(Ze.current=ce);const xe=u.useMemo(()=>{if(!v)return Object.assign(Object.assign({},I==null?void 0:I.style),O);const _e={marginTop:v[1]};return L==="rtl"?_e.left=Number.parseInt(v[0],10):_e.right=-Number.parseInt(v[0],10),Object.assign(Object.assign(Object.assign({},_e),I==null?void 0:I.style),O)},[L,v,O,I==null?void 0:I.style]),q=x??(typeof ae=="string"||typeof ae=="number"?ae:void 0),Le=!le&&(h===0?_:!!h&&h!==!0),Ne=Le?u.createElement("span",{className:`${E}-status-text`},h):null,dn=!ae||typeof ae!="object"?void 0:En(ae,_e=>({style:Object.assign(Object.assign({},xe),_e.style)})),ct=ro(m,!1),un=T(j==null?void 0:j.indicator,(n=I==null?void 0:I.classNames)===null||n===void 0?void 0:n.indicator,{[`${E}-status-dot`]:be,[`${E}-status-${f}`]:!!f,[`${E}-color-${m}`]:ct}),Ee={};m&&!ct&&(Ee.color=m,Ee.background=m);const Pt=T(E,{[`${E}-status`]:be,[`${E}-not-a-wrapper`]:!d,[`${E}-rtl`]:L==="rtl"},$,z,I==null?void 0:I.className,(r=I==null?void 0:I.classNames)===null||r===void 0?void 0:r.root,j==null?void 0:j.root,te,fe);if(!d&&be&&(h||V||!ge)){const _e=xe.color;return ee(u.createElement("span",Object.assign({},k,{className:Pt,style:Object.assign(Object.assign(Object.assign({},C==null?void 0:C.root),(o=I==null?void 0:I.styles)===null||o===void 0?void 0:o.root),xe)}),u.createElement("span",{className:un,style:Object.assign(Object.assign(Object.assign({},C==null?void 0:C.indicator),(i=I==null?void 0:I.styles)===null||i===void 0?void 0:i.indicator),Ee)}),Le&&u.createElement("span",{style:{color:_e},className:`${E}-status-text`},h)))}return ee(u.createElement("span",Object.assign({ref:t},k,{className:Pt,style:Object.assign(Object.assign({},(a=I==null?void 0:I.styles)===null||a===void 0?void 0:a.root),C==null?void 0:C.root)}),d,u.createElement(Zt,{visible:!le,motionName:`${E}-zoom`,motionAppear:!1,motionDeadline:1e3},({className:_e})=>{var lt,K;const he=S("scroll-number",l),Fe=Ze.current,Qe=T(j==null?void 0:j.indicator,(lt=I==null?void 0:I.classNames)===null||lt===void 0?void 0:lt.indicator,{[`${E}-dot`]:Fe,[`${E}-count`]:!Fe,[`${E}-count-sm`]:y==="small",[`${E}-multiple-words`]:!Fe&&qe&&qe.toString().length>1,[`${E}-status-${f}`]:!!f,[`${E}-color-${m}`]:ct});let ze=Object.assign(Object.assign(Object.assign({},C==null?void 0:C.indicator),(K=I==null?void 0:I.styles)===null||K===void 0?void 0:K.indicator),xe);return m&&!ct&&(ze=ze||{},ze.background=m),u.createElement(al,{prefixCls:he,show:!le,motionClassName:_e,className:Qe,count:qe,title:q,style:ze,key:"scrollNumber"},dn)}),Ne))}),_o=ll;_o.Ribbon=rl;const en=({children:e})=>{const{getPrefixCls:t}=u.useContext($e),n=t("breadcrumb");return u.createElement("li",{className:`${n}-separator`,"aria-hidden":"true"},e===""?e:e||"/")};en.__ANT_BREADCRUMB_SEPARATOR=!0;var dl=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};function ul(e,t){if(e.title===void 0||e.title===null)return null;const n=Object.keys(t).join("|");return typeof e.title=="object"?e.title:String(e.title).replace(new RegExp(`:(${n})`,"g"),(r,o)=>t[o]||r)}function Oo(e,t,n,r){if(n==null)return null;const{className:o,onClick:i}=t,a=dl(t,["className","onClick"]),c=Object.assign(Object.assign({},yt(a,{data:!0,aria:!0})),{onClick:i});return r!==void 0?u.createElement("a",Object.assign({},c,{className:T(`${e}-link`,o),href:r}),n):u.createElement("span",Object.assign({},c,{className:T(`${e}-link`,o)}),n)}function fl(e,t){return(r,o,i,a,c)=>{if(t)return t(r,o,i,a);const l=ul(r,o);return Oo(e,r,l,c)}}var xn=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const ko=e=>{const{prefixCls:t,separator:n="/",children:r,menu:o,overlay:i,dropdownProps:a,href:c}=e,d=(f=>{if(o||i){const h=Object.assign({},a);if(o){const m=o||{},{items:g}=m,p=xn(m,["items"]);h.menu=Object.assign(Object.assign({},p),{items:g==null?void 0:g.map((b,y)=>{var{key:x,title:v,label:O,path:$}=b,z=xn(b,["key","title","label","path"]);let j=O??v;return $&&(j=u.createElement("a",{href:`${c}${$}`},j)),Object.assign(Object.assign({},z),{key:x??y,label:j})})})}else i&&(h.overlay=i);return u.createElement(Xi,Object.assign({placement:"bottom"},h),u.createElement("span",{className:`${t}-overlay-link`},f,u.createElement(Gi,null)))}return f})(r);return d!=null?u.createElement(u.Fragment,null,u.createElement("li",{className:`${t}-item`},d),n&&u.createElement(en,null,n)):null},Io=e=>{const{prefixCls:t,children:n,href:r}=e,o=xn(e,["prefixCls","children","href"]),{getPrefixCls:i}=u.useContext($e),a=i("breadcrumb",t);return u.createElement(ko,Object.assign({},o,{prefixCls:a}),Oo(a,o,n,r))};Io.__ANT_BREADCRUMB_ITEM=!0;const hl=e=>{const{componentCls:t,iconCls:n,calc:r}=e;return{[t]:Object.assign(Object.assign({},st(e)),{color:e.itemColor,fontSize:e.fontSize,[n]:{fontSize:e.iconFontSize},ol:{display:"flex",flexWrap:"wrap",margin:0,padding:0,listStyle:"none"},[`${t}-item a`]:Object.assign({color:e.linkColor,transition:`color ${e.motionDurationMid}`,padding:`0 ${Z(e.paddingXXS)}`,borderRadius:e.borderRadiusSM,height:e.fontHeight,display:"inline-block",marginInline:r(e.marginXXS).mul(-1).equal(),"&:hover":{color:e.linkHoverColor,backgroundColor:e.colorBgTextHover}},Qt(e)),[`${t}-item:last-child`]:{color:e.lastItemColor},[`${t}-separator`]:{marginInline:e.separatorMargin,color:e.separatorColor},[`${t}-link`]:{[`
44
+ > ${n} + span,
45
+ > ${n} + a
46
+ `]:{marginInlineStart:e.marginXXS}},[`${t}-overlay-link`]:{borderRadius:e.borderRadiusSM,height:e.fontHeight,display:"inline-block",padding:`0 ${Z(e.paddingXXS)}`,marginInline:r(e.marginXXS).mul(-1).equal(),[`> ${n}`]:{marginInlineStart:e.marginXXS,fontSize:e.fontSizeIcon},"&:hover":{color:e.linkHoverColor,backgroundColor:e.colorBgTextHover,a:{color:e.linkHoverColor}},a:{"&:hover":{backgroundColor:"transparent"}}},[`&${e.componentCls}-rtl`]:{direction:"rtl"}})}},ml=e=>({itemColor:e.colorTextDescription,lastItemColor:e.colorText,iconFontSize:e.fontSize,linkColor:e.colorTextDescription,linkHoverColor:e.colorText,separatorColor:e.colorTextDescription,separatorMargin:e.marginXS}),pl=Ge("Breadcrumb",e=>{const t=wt(e,{});return hl(t)},ml);var hr=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};function gl(e){const{breadcrumbName:t,children:n}=e,r=hr(e,["breadcrumbName","children"]),o=Object.assign({title:t},r);return n&&(o.menu={items:n.map(i=>{var{breadcrumbName:a}=i,c=hr(i,["breadcrumbName"]);return Object.assign(Object.assign({},c),{title:a})})}),o}function bl(e,t){return u.useMemo(()=>e||(t?t.map(gl):null),[e,t])}var yl=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const vl=(e,t)=>{if(t===void 0)return t;let n=(t||"").replace(/^\//,"");return Object.keys(e).forEach(r=>{n=n.replace(`:${r}`,e[r])}),n},Zn=e=>{const{prefixCls:t,separator:n="/",style:r,className:o,rootClassName:i,routes:a,items:c,children:l,itemRender:d,params:f={}}=e,h=yl(e,["prefixCls","separator","style","className","rootClassName","routes","items","children","itemRender","params"]),{getPrefixCls:m,direction:g,breadcrumb:p}=u.useContext($e);let b;const y=m("breadcrumb",t),[x,v,O]=pl(y),$=bl(c,a),z=fl(y,d);if($&&$.length>0){const _=[],k=c||a;b=$.map((S,L)=>{const{path:I,key:E,type:ee,menu:te,overlay:fe,onClick:F,className:B,separator:ge,dropdownProps:be}=S,V=vl(f,I);V!==void 0&&_.push(V);const ce=E??L;if(ee==="separator")return u.createElement(en,{key:ce},ge);const Q={},le=L===$.length-1;te?Q.menu=te:fe&&(Q.overlay=fe);let{href:J}=S;return _.length&&V!==void 0&&(J=`#/${_.join("/")}`),u.createElement(ko,Object.assign({key:ce},Q,yt(S,{data:!0,aria:!0}),{className:B,dropdownProps:be,href:J,separator:le?"":n,onClick:F,prefixCls:y}),z(S,f,k,_,J))})}else if(l){const _=or(l).length;b=or(l).map((k,S)=>{if(!k)return k;const L=S===_-1;return En(k,{separator:L?"":n,key:S})})}const j=T(y,p==null?void 0:p.className,{[`${y}-rtl`]:g==="rtl"},o,i,v,O),C=Object.assign(Object.assign({},p==null?void 0:p.style),r);return x(u.createElement("nav",Object.assign({className:j,style:C},h),u.createElement("ol",null,b)))};Zn.Item=Io;Zn.Separator=en;const xl=e=>{const{componentCls:t}=e;return{[t]:{"&-horizontal":{[`&${t}`]:{"&-sm":{marginBlock:e.marginXS},"&-md":{marginBlock:e.margin}}}}}},wl=e=>{const{componentCls:t,sizePaddingEdgeHorizontal:n,colorSplit:r,lineWidth:o,textPaddingInline:i,orientationMargin:a,verticalMarginInline:c}=e;return{[t]:Object.assign(Object.assign({},st(e)),{borderBlockStart:`${Z(o)} solid ${r}`,"&-vertical":{position:"relative",top:"-0.06em",display:"inline-block",height:"0.9em",marginInline:c,marginBlock:0,verticalAlign:"middle",borderTop:0,borderInlineStart:`${Z(o)} solid ${r}`},"&-horizontal":{display:"flex",clear:"both",width:"100%",minWidth:"100%",margin:`${Z(e.marginLG)} 0`},[`&-horizontal${t}-with-text`]:{display:"flex",alignItems:"center",margin:`${Z(e.dividerHorizontalWithTextGutterMargin)} 0`,color:e.colorTextHeading,fontWeight:500,fontSize:e.fontSizeLG,whiteSpace:"nowrap",textAlign:"center",borderBlockStart:`0 ${r}`,"&::before, &::after":{position:"relative",width:"50%",borderBlockStart:`${Z(o)} solid transparent`,borderBlockStartColor:"inherit",borderBlockEnd:0,transform:"translateY(50%)",content:"''"}},[`&-horizontal${t}-with-text-start`]:{"&::before":{width:`calc(${a} * 100%)`},"&::after":{width:`calc(100% - ${a} * 100%)`}},[`&-horizontal${t}-with-text-end`]:{"&::before":{width:`calc(100% - ${a} * 100%)`},"&::after":{width:`calc(${a} * 100%)`}},[`${t}-inner-text`]:{display:"inline-block",paddingBlock:0,paddingInline:i},"&-dashed":{background:"none",borderColor:r,borderStyle:"dashed",borderWidth:`${Z(o)} 0 0`},[`&-horizontal${t}-with-text${t}-dashed`]:{"&::before, &::after":{borderStyle:"dashed none none"}},[`&-vertical${t}-dashed`]:{borderInlineStartWidth:o,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},"&-dotted":{background:"none",borderColor:r,borderStyle:"dotted",borderWidth:`${Z(o)} 0 0`},[`&-horizontal${t}-with-text${t}-dotted`]:{"&::before, &::after":{borderStyle:"dotted none none"}},[`&-vertical${t}-dotted`]:{borderInlineStartWidth:o,borderInlineEnd:0,borderBlockStart:0,borderBlockEnd:0},[`&-plain${t}-with-text`]:{color:e.colorText,fontWeight:"normal",fontSize:e.fontSize},[`&-horizontal${t}-with-text-start${t}-no-default-orientation-margin-start`]:{"&::before":{width:0},"&::after":{width:"100%"},[`${t}-inner-text`]:{paddingInlineStart:n}},[`&-horizontal${t}-with-text-end${t}-no-default-orientation-margin-end`]:{"&::before":{width:"100%"},"&::after":{width:0},[`${t}-inner-text`]:{paddingInlineEnd:n}}})}},jl=e=>({textPaddingInline:"1em",orientationMargin:.05,verticalMarginInline:e.marginXS}),Sl=Ge("Divider",e=>{const t=wt(e,{dividerHorizontalWithTextGutterMargin:e.margin,sizePaddingEdgeHorizontal:0});return[wl(t),xl(t)]},jl,{unitless:{orientationMargin:!0}});var $l=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const Cl={small:"sm",middle:"md"},No=e=>{const{getPrefixCls:t,direction:n,className:r,style:o}=zt("divider"),{prefixCls:i,type:a="horizontal",orientation:c="center",orientationMargin:l,className:d,rootClassName:f,children:h,dashed:m,variant:g="solid",plain:p,style:b,size:y}=e,x=$l(e,["prefixCls","type","orientation","orientationMargin","className","rootClassName","children","dashed","variant","plain","style","size"]),v=t("divider",i),[O,$,z]=Sl(v),j=oo(y),C=Cl[j],_=!!h,k=u.useMemo(()=>c==="left"?n==="rtl"?"end":"start":c==="right"?n==="rtl"?"start":"end":c,[n,c]),S=k==="start"&&l!=null,L=k==="end"&&l!=null,I=T(v,r,$,z,`${v}-${a}`,{[`${v}-with-text`]:_,[`${v}-with-text-${k}`]:_,[`${v}-dashed`]:!!m,[`${v}-${g}`]:g!=="solid",[`${v}-plain`]:!!p,[`${v}-rtl`]:n==="rtl",[`${v}-no-default-orientation-margin-start`]:S,[`${v}-no-default-orientation-margin-end`]:L,[`${v}-${C}`]:!!C},d,f),E=u.useMemo(()=>typeof l=="number"?l:/^\d+$/.test(l)?Number(l):l,[l]),ee={marginInlineStart:S?E:void 0,marginInlineEnd:L?E:void 0};return O(u.createElement("div",Object.assign({className:I,style:Object.assign(Object.assign({},o),b)},x,{role:"separator"}),h&&a!=="vertical"&&u.createElement("span",{className:`${v}-inner-text`,style:ee},h)))};var mr=u.createContext(null),Eo=u.createContext({}),_l=["prefixCls","className","containerRef"],Ol=function(t){var n=t.prefixCls,r=t.className,o=t.containerRef,i=so(t,_l),a=u.useContext(Eo),c=a.panel,l=Yi(c,o);return u.createElement("div",ue({className:T("".concat(n,"-content"),r),role:"dialog",ref:l},yt(t,{aria:!0}),{"aria-modal":"true"},i))};function pr(e){return typeof e=="string"&&String(Number(e))===e?(Qi(!1,"Invalid value type of `width` or `height` which should be number type instead."),Number(e)):e}var gr={width:0,height:0,overflow:"hidden",outline:"none",position:"absolute"};function kl(e,t){var n,r,o,i=e.prefixCls,a=e.open,c=e.placement,l=e.inline,d=e.push,f=e.forceRender,h=e.autoFocus,m=e.keyboard,g=e.classNames,p=e.rootClassName,b=e.rootStyle,y=e.zIndex,x=e.className,v=e.id,O=e.style,$=e.motion,z=e.width,j=e.height,C=e.children,_=e.mask,k=e.maskClosable,S=e.maskMotion,L=e.maskClassName,I=e.maskStyle,E=e.afterOpenChange,ee=e.onClose,te=e.onMouseEnter,fe=e.onMouseOver,F=e.onMouseLeave,B=e.onClick,ge=e.onKeyDown,be=e.onKeyUp,V=e.styles,ce=e.drawerRender,Q=u.useRef(),le=u.useRef(),J=u.useRef();u.useImperativeHandle(t,function(){return Q.current});var ae=function(he){var Fe=he.keyCode,Qe=he.shiftKey;switch(Fe){case $t.TAB:{if(Fe===$t.TAB){if(!Qe&&document.activeElement===J.current){var ze;(ze=le.current)===null||ze===void 0||ze.focus({preventScroll:!0})}else if(Qe&&document.activeElement===le.current){var fn;(fn=J.current)===null||fn===void 0||fn.focus({preventScroll:!0})}}break}case $t.ESC:{ee&&m&&(he.stopPropagation(),ee(he));break}}};u.useEffect(function(){if(a&&h){var K;(K=Q.current)===null||K===void 0||K.focus({preventScroll:!0})}},[a]);var Ie=u.useState(!1),qe=Lt(Ie,2),Ze=qe[0],xe=qe[1],q=u.useContext(mr),Le;typeof d=="boolean"?Le=d?{}:{distance:0}:Le=d||{};var Ne=(n=(r=(o=Le)===null||o===void 0?void 0:o.distance)!==null&&r!==void 0?r:q==null?void 0:q.pushDistance)!==null&&n!==void 0?n:180,dn=u.useMemo(function(){return{pushDistance:Ne,push:function(){xe(!0)},pull:function(){xe(!1)}}},[Ne]);u.useEffect(function(){if(a){var K;q==null||(K=q.push)===null||K===void 0||K.call(q)}else{var he;q==null||(he=q.pull)===null||he===void 0||he.call(q)}},[a]),u.useEffect(function(){return function(){var K;q==null||(K=q.pull)===null||K===void 0||K.call(q)}},[]);var ct=u.createElement(Zt,ue({key:"mask"},S,{visible:_&&a}),function(K,he){var Fe=K.className,Qe=K.style;return u.createElement("div",{className:T("".concat(i,"-mask"),Fe,g==null?void 0:g.mask,L),style:Pe(Pe(Pe({},Qe),I),V==null?void 0:V.mask),onClick:k&&a?ee:void 0,ref:he})}),un=typeof $=="function"?$(c):$,Ee={};if(Ze&&Ne)switch(c){case"top":Ee.transform="translateY(".concat(Ne,"px)");break;case"bottom":Ee.transform="translateY(".concat(-Ne,"px)");break;case"left":Ee.transform="translateX(".concat(Ne,"px)");break;default:Ee.transform="translateX(".concat(-Ne,"px)");break}c==="left"||c==="right"?Ee.width=pr(z):Ee.height=pr(j);var Pt={onMouseEnter:te,onMouseOver:fe,onMouseLeave:F,onClick:B,onKeyDown:ge,onKeyUp:be},_e=u.createElement(Zt,ue({key:"panel"},un,{visible:a,forceRender:f,onVisibleChanged:function(he){E==null||E(he)},removeOnLeave:!1,leavedClassName:"".concat(i,"-content-wrapper-hidden")}),function(K,he){var Fe=K.className,Qe=K.style,ze=u.createElement(Ol,ue({id:v,containerRef:he,prefixCls:i,className:T(x,g==null?void 0:g.content),style:Pe(Pe({},O),V==null?void 0:V.content)},yt(e,{aria:!0}),Pt),C);return u.createElement("div",ue({className:T("".concat(i,"-content-wrapper"),g==null?void 0:g.wrapper,Fe),style:Pe(Pe(Pe({},Ee),Qe),V==null?void 0:V.wrapper)},yt(e,{data:!0})),ce?ce(ze):ze)}),lt=Pe({},b);return y&&(lt.zIndex=y),u.createElement(mr.Provider,{value:dn},u.createElement("div",{className:T(i,"".concat(i,"-").concat(c),p,Ft(Ft({},"".concat(i,"-open"),a),"".concat(i,"-inline"),l)),style:lt,tabIndex:-1,ref:Q,onKeyDown:ae},ct,u.createElement("div",{tabIndex:0,ref:le,style:gr,"aria-hidden":"true","data-sentinel":"start"}),_e,u.createElement("div",{tabIndex:0,ref:J,style:gr,"aria-hidden":"true","data-sentinel":"end"})))}var Il=u.forwardRef(kl),Nl=function(t){var n=t.open,r=n===void 0?!1:n,o=t.prefixCls,i=o===void 0?"rc-drawer":o,a=t.placement,c=a===void 0?"right":a,l=t.autoFocus,d=l===void 0?!0:l,f=t.keyboard,h=f===void 0?!0:f,m=t.width,g=m===void 0?378:m,p=t.mask,b=p===void 0?!0:p,y=t.maskClosable,x=y===void 0?!0:y,v=t.getContainer,O=t.forceRender,$=t.afterOpenChange,z=t.destroyOnClose,j=t.onMouseEnter,C=t.onMouseOver,_=t.onMouseLeave,k=t.onClick,S=t.onKeyDown,L=t.onKeyUp,I=t.panelRef,E=u.useState(!1),ee=Lt(E,2),te=ee[0],fe=ee[1],F=u.useState(!1),B=Lt(F,2),ge=B[0],be=B[1];sr(function(){be(!0)},[]);var V=ge?r:!1,ce=u.useRef(),Q=u.useRef();sr(function(){V&&(Q.current=document.activeElement)},[V]);var le=function(Ze){var xe;if(fe(Ze),$==null||$(Ze),!Ze&&Q.current&&!((xe=ce.current)!==null&&xe!==void 0&&xe.contains(Q.current))){var q;(q=Q.current)===null||q===void 0||q.focus({preventScroll:!0})}},J=u.useMemo(function(){return{panel:I}},[I]);if(!O&&!te&&!V&&z)return null;var ae={onMouseEnter:j,onMouseOver:C,onMouseLeave:_,onClick:k,onKeyDown:S,onKeyUp:L},Ie=Pe(Pe({},t),{},{open:V,prefixCls:i,placement:c,autoFocus:d,keyboard:h,width:g,mask:b,maskClosable:x,inline:v===!1,afterOpenChange:le,ref:ce},ae);return u.createElement(Eo.Provider,{value:J},u.createElement(ea,{open:V||O||te,autoDestroy:!1,getContainer:v,autoLock:b&&(V||te)},u.createElement(Il,Ie)))};const zo=e=>{var t,n;const{prefixCls:r,ariaId:o,title:i,footer:a,extra:c,closable:l,loading:d,onClose:f,headerStyle:h,bodyStyle:m,footerStyle:g,children:p,classNames:b,styles:y}=e,x=zt("drawer");let v;l===!1?v=void 0:l===void 0||l===!0?v="start":v=(l==null?void 0:l.placement)==="end"?"end":"start";const O=u.useCallback(_=>u.createElement("button",{type:"button",onClick:f,className:T(`${r}-close`,{[`${r}-close-${v}`]:v==="end"})},_),[f,r,v]),[$,z]=ta(ir(e),ir(x),{closable:!0,closeIconRender:O}),j=()=>{var _,k;return!i&&!$?null:u.createElement("div",{style:Object.assign(Object.assign(Object.assign({},(_=x.styles)===null||_===void 0?void 0:_.header),h),y==null?void 0:y.header),className:T(`${r}-header`,{[`${r}-header-close-only`]:$&&!i&&!c},(k=x.classNames)===null||k===void 0?void 0:k.header,b==null?void 0:b.header)},u.createElement("div",{className:`${r}-header-title`},v==="start"&&z,i&&u.createElement("div",{className:`${r}-title`,id:o},i)),c&&u.createElement("div",{className:`${r}-extra`},c),v==="end"&&z)},C=()=>{var _,k;if(!a)return null;const S=`${r}-footer`;return u.createElement("div",{className:T(S,(_=x.classNames)===null||_===void 0?void 0:_.footer,b==null?void 0:b.footer),style:Object.assign(Object.assign(Object.assign({},(k=x.styles)===null||k===void 0?void 0:k.footer),g),y==null?void 0:y.footer)},a)};return u.createElement(u.Fragment,null,j(),u.createElement("div",{className:T(`${r}-body`,b==null?void 0:b.body,(t=x.classNames)===null||t===void 0?void 0:t.body),style:Object.assign(Object.assign(Object.assign({},(n=x.styles)===null||n===void 0?void 0:n.body),m),y==null?void 0:y.body)},d?u.createElement(na,{active:!0,title:!1,paragraph:{rows:5},className:`${r}-body-skeleton`}):p),C())},El=e=>{const t="100%";return{left:`translateX(-${t})`,right:`translateX(${t})`,top:`translateY(-${t})`,bottom:`translateY(${t})`}[e]},Po=(e,t)=>({"&-enter, &-appear":Object.assign(Object.assign({},e),{"&-active":t}),"&-leave":Object.assign(Object.assign({},t),{"&-active":e})}),To=(e,t)=>Object.assign({"&-enter, &-appear, &-leave":{"&-start":{transition:"none"},"&-active":{transition:`all ${t}`}}},Po({opacity:e},{opacity:1})),zl=(e,t)=>[To(.7,t),Po({transform:El(e)},{transform:"none"})],Pl=e=>{const{componentCls:t,motionDurationSlow:n}=e;return{[t]:{[`${t}-mask-motion`]:To(0,n),[`${t}-panel-motion`]:["left","right","top","bottom"].reduce((r,o)=>Object.assign(Object.assign({},r),{[`&-${o}`]:zl(o,n)}),{})}}},Tl=e=>{const{borderRadiusSM:t,componentCls:n,zIndexPopup:r,colorBgMask:o,colorBgElevated:i,motionDurationSlow:a,motionDurationMid:c,paddingXS:l,padding:d,paddingLG:f,fontSizeLG:h,lineHeightLG:m,lineWidth:g,lineType:p,colorSplit:b,marginXS:y,colorIcon:x,colorIconHover:v,colorBgTextHover:O,colorBgTextActive:$,colorText:z,fontWeightStrong:j,footerPaddingBlock:C,footerPaddingInline:_,calc:k}=e,S=`${n}-content-wrapper`;return{[n]:{position:"fixed",inset:0,zIndex:r,pointerEvents:"none",color:z,"&-pure":{position:"relative",background:i,display:"flex",flexDirection:"column",[`&${n}-left`]:{boxShadow:e.boxShadowDrawerLeft},[`&${n}-right`]:{boxShadow:e.boxShadowDrawerRight},[`&${n}-top`]:{boxShadow:e.boxShadowDrawerUp},[`&${n}-bottom`]:{boxShadow:e.boxShadowDrawerDown}},"&-inline":{position:"absolute"},[`${n}-mask`]:{position:"absolute",inset:0,zIndex:r,background:o,pointerEvents:"auto"},[S]:{position:"absolute",zIndex:r,maxWidth:"100vw",transition:`all ${a}`,"&-hidden":{display:"none"}},[`&-left > ${S}`]:{top:0,bottom:0,left:{_skip_check_:!0,value:0},boxShadow:e.boxShadowDrawerLeft},[`&-right > ${S}`]:{top:0,right:{_skip_check_:!0,value:0},bottom:0,boxShadow:e.boxShadowDrawerRight},[`&-top > ${S}`]:{top:0,insetInline:0,boxShadow:e.boxShadowDrawerUp},[`&-bottom > ${S}`]:{bottom:0,insetInline:0,boxShadow:e.boxShadowDrawerDown},[`${n}-content`]:{display:"flex",flexDirection:"column",width:"100%",height:"100%",overflow:"auto",background:i,pointerEvents:"auto"},[`${n}-header`]:{display:"flex",flex:0,alignItems:"center",padding:`${Z(d)} ${Z(f)}`,fontSize:h,lineHeight:m,borderBottom:`${Z(g)} ${p} ${b}`,"&-title":{display:"flex",flex:1,alignItems:"center",minWidth:0,minHeight:0}},[`${n}-extra`]:{flex:"none"},[`${n}-close`]:Object.assign({display:"inline-flex",width:k(h).add(l).equal(),height:k(h).add(l).equal(),borderRadius:t,justifyContent:"center",alignItems:"center",color:x,fontWeight:j,fontSize:h,fontStyle:"normal",lineHeight:1,textAlign:"center",textTransform:"none",textDecoration:"none",background:"transparent",border:0,cursor:"pointer",transition:`all ${c}`,textRendering:"auto",[`&${n}-close-end`]:{marginInlineStart:y},[`&:not(${n}-close-end)`]:{marginInlineEnd:y},"&:hover":{color:v,backgroundColor:O,textDecoration:"none"},"&:active":{backgroundColor:$}},Qt(e)),[`${n}-title`]:{flex:1,margin:0,fontWeight:e.fontWeightStrong,fontSize:h,lineHeight:m},[`${n}-body`]:{flex:1,minWidth:0,minHeight:0,padding:f,overflow:"auto",[`${n}-body-skeleton`]:{width:"100%",height:"100%",display:"flex",justifyContent:"center"}},[`${n}-footer`]:{flexShrink:0,padding:`${Z(C)} ${Z(_)}`,borderTop:`${Z(g)} ${p} ${b}`},"&-rtl":{direction:"rtl"}}}},Rl=e=>({zIndexPopup:e.zIndexPopupBase,footerPaddingBlock:e.paddingXS,footerPaddingInline:e.padding}),Ro=Ge("Drawer",e=>{const t=wt(e,{});return[Tl(t),Pl(t)]},Rl);var Ao=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const Al={distance:180},Do=e=>{const{rootClassName:t,width:n,height:r,size:o="default",mask:i=!0,push:a=Al,open:c,afterOpenChange:l,onClose:d,prefixCls:f,getContainer:h,panelRef:m=null,style:g,className:p,"aria-labelledby":b,visible:y,afterVisibleChange:x,maskStyle:v,drawerStyle:O,contentWrapperStyle:$,destroyOnClose:z,destroyOnHidden:j}=e,C=Ao(e,["rootClassName","width","height","size","mask","push","open","afterOpenChange","onClose","prefixCls","getContainer","panelRef","style","className","aria-labelledby","visible","afterVisibleChange","maskStyle","drawerStyle","contentWrapperStyle","destroyOnClose","destroyOnHidden"]),_=ra(),k=C.title?_:void 0,{getPopupContainer:S,getPrefixCls:L,direction:I,className:E,style:ee,classNames:te,styles:fe}=zt("drawer"),F=L("drawer",f),[B,ge,be]=Ro(F),V=h===void 0&&S?()=>S(document.body):h,ce=T({"no-mask":!i,[`${F}-rtl`]:I==="rtl"},t,ge,be),Q=u.useMemo(()=>n??(o==="large"?736:378),[n,o]),le=u.useMemo(()=>r??(o==="large"?736:378),[r,o]),J={motionName:ar(F,"mask-motion"),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500},ae=Ne=>({motionName:ar(F,`panel-motion-${Ne}`),motionAppear:!0,motionEnter:!0,motionLeave:!0,motionDeadline:500}),Ie=Pa(),qe=Jr(m,Ie),[Ze,xe]=oa("Drawer",C.zIndex),{classNames:q={},styles:Le={}}=C;return B(u.createElement(sa,{form:!0,space:!0},u.createElement(ia.Provider,{value:xe},u.createElement(Nl,Object.assign({prefixCls:F,onClose:d,maskMotion:J,motion:ae},C,{classNames:{mask:T(q.mask,te.mask),content:T(q.content,te.content),wrapper:T(q.wrapper,te.wrapper)},styles:{mask:Object.assign(Object.assign(Object.assign({},Le.mask),v),fe.mask),content:Object.assign(Object.assign(Object.assign({},Le.content),O),fe.content),wrapper:Object.assign(Object.assign(Object.assign({},Le.wrapper),$),fe.wrapper)},open:c??y,mask:i,push:a,width:Q,height:le,style:Object.assign(Object.assign({},ee),g),className:T(E,p),rootClassName:ce,getContainer:V,afterOpenChange:l??x,panelRef:qe,zIndex:Ze,"aria-labelledby":b??k,destroyOnClose:j??z}),u.createElement(zo,Object.assign({prefixCls:F},C,{ariaId:k,onClose:d}))))))},Dl=e=>{const{prefixCls:t,style:n,className:r,placement:o="right"}=e,i=Ao(e,["prefixCls","style","className","placement"]),{getPrefixCls:a}=u.useContext($e),c=a("drawer",t),[l,d,f]=Ro(c),h=T(c,`${c}-pure`,`${c}-${o}`,d,f,r);return l(u.createElement("div",{className:h,style:n},u.createElement(zo,Object.assign({prefixCls:c},i))))};Do._InternalPanelDoNotUseOrYouWillBeFired=Dl;let Te=null,Mt=e=>e(),Ht=[],Ot={};function br(){const{getContainer:e,rtl:t,maxCount:n,top:r,bottom:o,showProgress:i,pauseOnHover:a}=Ot,c=(e==null?void 0:e())||document.body;return{getContainer:()=>c,rtl:t,maxCount:n,top:r,bottom:o,showProgress:i,pauseOnHover:a}}const Ml=de.forwardRef((e,t)=>{const{notificationConfig:n,sync:r}=e,{getPrefixCls:o}=u.useContext($e),i=Ot.prefixCls||o("notification"),a=u.useContext(la),[c,l]=So(Object.assign(Object.assign(Object.assign({},n),{prefixCls:i}),a.notification));return de.useEffect(r,[]),de.useImperativeHandle(t,()=>{const d=Object.assign({},c);return Object.keys(d).forEach(f=>{d[f]=(...h)=>(r(),c[f].apply(c,h))}),{instance:d,sync:r}}),l}),Zl=de.forwardRef((e,t)=>{const[n,r]=de.useState(br),o=()=>{r(br)};de.useEffect(o,[]);const i=ca(),a=i.getRootPrefixCls(),c=i.getIconPrefixCls(),l=i.getTheme(),d=de.createElement(Ml,{ref:t,sync:o,notificationConfig:n});return de.createElement(io,{prefixCls:a,iconPrefixCls:c,theme:l},i.holderRender?i.holderRender(d):d)}),Ln=()=>{if(!Te){const e=document.createDocumentFragment(),t={fragment:e};Te=t,Mt(()=>{aa()(de.createElement(Zl,{ref:r=>{const{instance:o,sync:i}=r||{};Promise.resolve().then(()=>{!t.instance&&o&&(t.instance=o,t.sync=i,Ln())})}}),e)});return}Te.instance&&(Ht.forEach(e=>{switch(e.type){case"open":{Mt(()=>{Te.instance.open(Object.assign(Object.assign({},Ot),e.config))});break}case"destroy":Mt(()=>{var t;(t=Te==null?void 0:Te.instance)===null||t===void 0||t.destroy(e.key)});break}}),Ht=[])};function Ll(e){Ot=Object.assign(Object.assign({},Ot),e),Mt(()=>{var t;(t=Te==null?void 0:Te.sync)===null||t===void 0||t.call(Te)})}function Mo(e){Ht.push({type:"open",config:e}),Ln()}const Fl=e=>{Ht.push({type:"destroy",key:e}),Ln()},Bl=["success","info","warning","error"],Ul={open:Mo,destroy:Fl,config:Ll,useNotification:Wc,_InternalPanelDoNotUseOrYouWillBeFired:Ac},wn=Ul;Bl.forEach(e=>{wn[e]=t=>Mo(Object.assign(Object.assign({},t),{type:e}))});const Hl=e=>{const{componentCls:t,iconCls:n,antCls:r,zIndexPopup:o,colorText:i,colorWarning:a,marginXXS:c,marginXS:l,fontSize:d,fontWeightStrong:f,colorTextHeading:h}=e;return{[t]:{zIndex:o,[`&${r}-popover`]:{fontSize:d},[`${t}-message`]:{marginBottom:l,display:"flex",flexWrap:"nowrap",alignItems:"start",[`> ${t}-message-icon ${n}`]:{color:a,fontSize:d,lineHeight:1,marginInlineEnd:l},[`${t}-title`]:{fontWeight:f,color:h,"&:only-child":{fontWeight:"normal"}},[`${t}-description`]:{marginTop:c,color:i}},[`${t}-buttons`]:{textAlign:"end",whiteSpace:"nowrap",button:{marginInlineStart:l}}}}},Vl=e=>{const{zIndexPopupBase:t}=e;return{zIndexPopup:t+60}},Zo=Ge("Popconfirm",e=>Hl(e),Vl,{resetStyle:!1});var Wl=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const Lo=e=>{const{prefixCls:t,okButtonProps:n,cancelButtonProps:r,title:o,description:i,cancelText:a,okText:c,okType:l="primary",icon:d=u.createElement(Yt,null),showCancel:f=!0,close:h,onConfirm:m,onCancel:g,onPopupClick:p}=e,{getPrefixCls:b}=u.useContext($e),[y]=da("Popconfirm",ua.Popconfirm),x=lr(o),v=lr(i);return u.createElement("div",{className:`${t}-inner-content`,onClick:p},u.createElement("div",{className:`${t}-message`},d&&u.createElement("span",{className:`${t}-message-icon`},d),u.createElement("div",{className:`${t}-message-text`},x&&u.createElement("div",{className:`${t}-title`},x),v&&u.createElement("div",{className:`${t}-description`},v))),u.createElement("div",{className:`${t}-buttons`},f&&u.createElement(R,Object.assign({onClick:g,size:"small"},r),a||(y==null?void 0:y.cancelText)),u.createElement(Ta,{buttonProps:Object.assign(Object.assign({size:"small"},fa(l)),n),actionFn:m,close:h,prefixCls:b("btn"),quitOnNullishReturnValue:!0,emitEvent:!0},c||(y==null?void 0:y.okText))))},ql=e=>{const{prefixCls:t,placement:n,className:r,style:o}=e,i=Wl(e,["prefixCls","placement","className","style"]),{getPrefixCls:a}=u.useContext($e),c=a("popconfirm",t),[l]=Zo(c);return l(u.createElement(qa,{placement:n,className:T(c,r),style:o,content:u.createElement(Lo,Object.assign({prefixCls:c},i))}))};var Kl=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const Jl=u.forwardRef((e,t)=>{var n,r;const{prefixCls:o,placement:i="top",trigger:a="click",okType:c="primary",icon:l=u.createElement(Yt,null),children:d,overlayClassName:f,onOpenChange:h,onVisibleChange:m,overlayStyle:g,styles:p,classNames:b}=e,y=Kl(e,["prefixCls","placement","trigger","okType","icon","children","overlayClassName","onOpenChange","onVisibleChange","overlayStyle","styles","classNames"]),{getPrefixCls:x,className:v,style:O,classNames:$,styles:z}=zt("popconfirm"),[j,C]=zn(!1,{value:(n=e.open)!==null&&n!==void 0?n:e.visible,defaultValue:(r=e.defaultOpen)!==null&&r!==void 0?r:e.defaultVisible}),_=(F,B)=>{C(F,!0),m==null||m(F),h==null||h(F,B)},k=F=>{_(!1,F)},S=F=>{var B;return(B=e.onConfirm)===null||B===void 0?void 0:B.call(void 0,F)},L=F=>{var B;_(!1,F),(B=e.onCancel)===null||B===void 0||B.call(void 0,F)},I=(F,B)=>{const{disabled:ge=!1}=e;ge||_(F,B)},E=x("popconfirm",o),ee=T(E,v,f,$.root,b==null?void 0:b.root),te=T($.body,b==null?void 0:b.body),[fe]=Zo(E);return fe(u.createElement(Ka,Object.assign({},ha(y,["title"]),{trigger:a,placement:i,onOpenChange:I,open:j,ref:t,classNames:{root:ee,body:te},styles:{root:Object.assign(Object.assign(Object.assign(Object.assign({},z.root),O),g),p==null?void 0:p.root),body:Object.assign(Object.assign({},z.body),p==null?void 0:p.body)},content:u.createElement(Lo,Object.assign({okType:c,icon:l},e,{prefixCls:E,close:k,onConfirm:S,onCancel:L})),"data-popover-inject":!0}),d))}),Fn=Jl;Fn._InternalPanelDoNotUseOrYouWillBeFired=ql;var Xl={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M909.1 209.3l-56.4 44.1C775.8 155.1 656.2 92 521.9 92 290 92 102.3 279.5 102 511.5 101.7 743.7 289.8 932 521.9 932c181.3 0 335.8-115 394.6-276.1 1.5-4.2-.7-8.9-4.9-10.3l-56.7-19.5a8 8 0 00-10.1 4.8c-1.8 5-3.8 10-5.9 14.9-17.3 41-42.1 77.8-73.7 109.4A344.77 344.77 0 01655.9 829c-42.3 17.9-87.4 27-133.8 27-46.5 0-91.5-9.1-133.8-27A341.5 341.5 0 01279 755.2a342.16 342.16 0 01-73.7-109.4c-17.9-42.4-27-87.4-27-133.9s9.1-91.5 27-133.9c17.3-41 42.1-77.8 73.7-109.4 31.6-31.6 68.4-56.4 109.3-73.8 42.3-17.9 87.4-27 133.8-27 46.5 0 91.5 9.1 133.8 27a341.5 341.5 0 01109.3 73.8c9.9 9.9 19.2 20.4 27.8 31.4l-60.2 47a8 8 0 003 14.1l175.6 43c5 1.2 9.9-2.6 9.9-7.7l.8-180.9c-.1-6.6-7.8-10.3-13-6.2z"}}]},name:"reload",theme:"outlined"},Gl=function(t,n){return u.createElement(Me,ue({},t,{ref:n,icon:Xl}))},Fo=u.forwardRef(Gl),Yl=["prefixCls","className","checked","defaultChecked","disabled","loadingIcon","checkedChildren","unCheckedChildren","onClick","onChange","onKeyDown"],Bo=u.forwardRef(function(e,t){var n,r=e.prefixCls,o=r===void 0?"rc-switch":r,i=e.className,a=e.checked,c=e.defaultChecked,l=e.disabled,d=e.loadingIcon,f=e.checkedChildren,h=e.unCheckedChildren,m=e.onClick,g=e.onChange,p=e.onKeyDown,b=so(e,Yl),y=zn(!1,{value:a,defaultValue:c}),x=Lt(y,2),v=x[0],O=x[1];function $(_,k){var S=v;return l||(S=_,O(S),g==null||g(S,k)),S}function z(_){_.which===$t.LEFT?$(!1,_):_.which===$t.RIGHT&&$(!0,_),p==null||p(_)}function j(_){var k=$(!v,_);m==null||m(k,_)}var C=T(o,i,(n={},Ft(n,"".concat(o,"-checked"),v),Ft(n,"".concat(o,"-disabled"),l),n));return u.createElement("button",ue({},b,{type:"button",role:"switch","aria-checked":v,disabled:l,className:C,ref:t,onKeyDown:z,onClick:j}),d,u.createElement("span",{className:"".concat(o,"-inner")},u.createElement("span",{className:"".concat(o,"-inner-checked")},f),u.createElement("span",{className:"".concat(o,"-inner-unchecked")},h)))});Bo.displayName="Switch";const Ql=e=>{const{componentCls:t,trackHeightSM:n,trackPadding:r,trackMinWidthSM:o,innerMinMarginSM:i,innerMaxMarginSM:a,handleSizeSM:c,calc:l}=e,d=`${t}-inner`,f=Z(l(c).add(l(r).mul(2)).equal()),h=Z(l(a).mul(2).equal());return{[t]:{[`&${t}-small`]:{minWidth:o,height:n,lineHeight:Z(n),[`${t}-inner`]:{paddingInlineStart:a,paddingInlineEnd:i,[`${d}-checked, ${d}-unchecked`]:{minHeight:n},[`${d}-checked`]:{marginInlineStart:`calc(-100% + ${f} - ${h})`,marginInlineEnd:`calc(100% - ${f} + ${h})`},[`${d}-unchecked`]:{marginTop:l(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`${t}-handle`]:{width:c,height:c},[`${t}-loading-icon`]:{top:l(l(c).sub(e.switchLoadingIconSize)).div(2).equal(),fontSize:e.switchLoadingIconSize},[`&${t}-checked`]:{[`${t}-inner`]:{paddingInlineStart:i,paddingInlineEnd:a,[`${d}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${d}-unchecked`]:{marginInlineStart:`calc(100% - ${f} + ${h})`,marginInlineEnd:`calc(-100% + ${f} - ${h})`}},[`${t}-handle`]:{insetInlineStart:`calc(100% - ${Z(l(c).add(r).equal())})`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${d}`]:{[`${d}-unchecked`]:{marginInlineStart:l(e.marginXXS).div(2).equal(),marginInlineEnd:l(e.marginXXS).mul(-1).div(2).equal()}},[`&${t}-checked ${d}`]:{[`${d}-checked`]:{marginInlineStart:l(e.marginXXS).mul(-1).div(2).equal(),marginInlineEnd:l(e.marginXXS).div(2).equal()}}}}}}},ed=e=>{const{componentCls:t,handleSize:n,calc:r}=e;return{[t]:{[`${t}-loading-icon${e.iconCls}`]:{position:"relative",top:r(r(n).sub(e.fontSize)).div(2).equal(),color:e.switchLoadingIconColor,verticalAlign:"top"},[`&${t}-checked ${t}-loading-icon`]:{color:e.switchColor}}}},td=e=>{const{componentCls:t,trackPadding:n,handleBg:r,handleShadow:o,handleSize:i,calc:a}=e,c=`${t}-handle`;return{[t]:{[c]:{position:"absolute",top:n,insetInlineStart:n,width:i,height:i,transition:`all ${e.switchDuration} ease-in-out`,"&::before":{position:"absolute",top:0,insetInlineEnd:0,bottom:0,insetInlineStart:0,backgroundColor:r,borderRadius:a(i).div(2).equal(),boxShadow:o,transition:`all ${e.switchDuration} ease-in-out`,content:'""'}},[`&${t}-checked ${c}`]:{insetInlineStart:`calc(100% - ${Z(a(i).add(n).equal())})`},[`&:not(${t}-disabled):active`]:{[`${c}::before`]:{insetInlineEnd:e.switchHandleActiveInset,insetInlineStart:0},[`&${t}-checked ${c}::before`]:{insetInlineEnd:0,insetInlineStart:e.switchHandleActiveInset}}}}},nd=e=>{const{componentCls:t,trackHeight:n,trackPadding:r,innerMinMargin:o,innerMaxMargin:i,handleSize:a,calc:c}=e,l=`${t}-inner`,d=Z(c(a).add(c(r).mul(2)).equal()),f=Z(c(i).mul(2).equal());return{[t]:{[l]:{display:"block",overflow:"hidden",borderRadius:100,height:"100%",paddingInlineStart:i,paddingInlineEnd:o,transition:`padding-inline-start ${e.switchDuration} ease-in-out, padding-inline-end ${e.switchDuration} ease-in-out`,[`${l}-checked, ${l}-unchecked`]:{display:"block",color:e.colorTextLightSolid,fontSize:e.fontSizeSM,transition:`margin-inline-start ${e.switchDuration} ease-in-out, margin-inline-end ${e.switchDuration} ease-in-out`,pointerEvents:"none",minHeight:n},[`${l}-checked`]:{marginInlineStart:`calc(-100% + ${d} - ${f})`,marginInlineEnd:`calc(100% - ${d} + ${f})`},[`${l}-unchecked`]:{marginTop:c(n).mul(-1).equal(),marginInlineStart:0,marginInlineEnd:0}},[`&${t}-checked ${l}`]:{paddingInlineStart:o,paddingInlineEnd:i,[`${l}-checked`]:{marginInlineStart:0,marginInlineEnd:0},[`${l}-unchecked`]:{marginInlineStart:`calc(100% - ${d} + ${f})`,marginInlineEnd:`calc(-100% + ${d} - ${f})`}},[`&:not(${t}-disabled):active`]:{[`&:not(${t}-checked) ${l}`]:{[`${l}-unchecked`]:{marginInlineStart:c(r).mul(2).equal(),marginInlineEnd:c(r).mul(-1).mul(2).equal()}},[`&${t}-checked ${l}`]:{[`${l}-checked`]:{marginInlineStart:c(r).mul(-1).mul(2).equal(),marginInlineEnd:c(r).mul(2).equal()}}}}}},rd=e=>{const{componentCls:t,trackHeight:n,trackMinWidth:r}=e;return{[t]:Object.assign(Object.assign(Object.assign(Object.assign({},st(e)),{position:"relative",display:"inline-block",boxSizing:"border-box",minWidth:r,height:n,lineHeight:Z(n),verticalAlign:"middle",background:e.colorTextQuaternary,border:"0",borderRadius:100,cursor:"pointer",transition:`all ${e.motionDurationMid}`,userSelect:"none",[`&:hover:not(${t}-disabled)`]:{background:e.colorTextTertiary}}),Qt(e)),{[`&${t}-checked`]:{background:e.switchColor,[`&:hover:not(${t}-disabled)`]:{background:e.colorPrimaryHover}},[`&${t}-loading, &${t}-disabled`]:{cursor:"not-allowed",opacity:e.switchDisabledOpacity,"*":{boxShadow:"none",cursor:"not-allowed"}},[`&${t}-rtl`]:{direction:"rtl"}})}},od=e=>{const{fontSize:t,lineHeight:n,controlHeight:r,colorWhite:o}=e,i=t*n,a=r/2,c=2,l=i-c*2,d=a-c*2;return{trackHeight:i,trackHeightSM:a,trackMinWidth:l*2+c*4,trackMinWidthSM:d*2+c*2,trackPadding:c,handleBg:o,handleSize:l,handleSizeSM:d,handleShadow:`0 2px 4px 0 ${new Pn("#00230b").setA(.2).toRgbString()}`,innerMinMargin:l/2,innerMaxMargin:l+c+c*2,innerMinMarginSM:d/2,innerMaxMarginSM:d+c+c*2}},sd=Ge("Switch",e=>{const t=wt(e,{switchDuration:e.motionDurationMid,switchColor:e.colorPrimary,switchDisabledOpacity:e.opacityLoading,switchLoadingIconSize:e.calc(e.fontSizeIcon).mul(.75).equal(),switchLoadingIconColor:`rgba(0, 0, 0, ${e.opacityLoading})`,switchHandleActiveInset:"-30%"});return[rd(t),nd(t),td(t),ed(t),Ql(t)]},od);var id=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n};const ad=u.forwardRef((e,t)=>{const{prefixCls:n,size:r,disabled:o,loading:i,className:a,rootClassName:c,style:l,checked:d,value:f,defaultChecked:h,defaultValue:m,onChange:g}=e,p=id(e,["prefixCls","size","disabled","loading","className","rootClassName","style","checked","value","defaultChecked","defaultValue","onChange"]),[b,y]=zn(!1,{value:d??f,defaultValue:h??m}),{getPrefixCls:x,direction:v,switch:O}=u.useContext($e),$=u.useContext(ma),z=(o??$)||i,j=x("switch",n),C=u.createElement("div",{className:`${j}-handle`},i&&u.createElement(ga,{className:`${j}-loading-icon`})),[_,k,S]=sd(j),L=oo(r),I=T(O==null?void 0:O.className,{[`${j}-small`]:L==="small",[`${j}-loading`]:i,[`${j}-rtl`]:v==="rtl"},a,c,k,S),E=Object.assign(Object.assign({},O==null?void 0:O.style),l),ee=(...te)=>{y(te[0]),g==null||g.apply(void 0,te)};return _(u.createElement(pa,{component:"Switch",disabled:z},u.createElement(Bo,Object.assign({},p,{checked:b,onChange:ee,prefixCls:j,className:I,style:E,disabled:z,ref:t,loadingIcon:C}))))}),Vt=ad;Vt.__ANT_SWITCH=!0;const cd=e=>{const t=e!=null&&e.algorithm?ba(e.algorithm):ya,n=Object.assign(Object.assign({},va),e==null?void 0:e.token);return xa(n,{override:e==null?void 0:e.token},t,wa)};function ld(e){const{sizeUnit:t,sizeStep:n}=e,r=n-2;return{sizeXXL:t*(r+10),sizeXL:t*(r+6),sizeLG:t*(r+2),sizeMD:t*(r+2),sizeMS:t*(r+1),size:t*r,sizeSM:t*r,sizeXS:t*(r-1),sizeXXS:t*(r-1)}}const dd=(e,t)=>{const n=t??Tn(e),r=n.fontSizeSM,o=n.controlHeight-4;return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},n),ld(t??e)),ja(r)),{controlHeight:o}),Sa(Object.assign(Object.assign({},n),{controlHeight:o})))},Oe=(e,t)=>new Pn(e).setA(t).toRgbString(),ut=(e,t)=>new Pn(e).lighten(t).toHexString(),ud=e=>{const t=ao(e,{theme:"dark"});return{1:t[0],2:t[1],3:t[2],4:t[3],5:t[6],6:t[5],7:t[4],8:t[6],9:t[5],10:t[4]}},fd=(e,t)=>{const n=e||"#000",r=t||"#fff";return{colorBgBase:n,colorTextBase:r,colorText:Oe(r,.85),colorTextSecondary:Oe(r,.65),colorTextTertiary:Oe(r,.45),colorTextQuaternary:Oe(r,.25),colorFill:Oe(r,.18),colorFillSecondary:Oe(r,.12),colorFillTertiary:Oe(r,.08),colorFillQuaternary:Oe(r,.04),colorBgSolid:Oe(r,.95),colorBgSolidHover:Oe(r,1),colorBgSolidActive:Oe(r,.9),colorBgElevated:ut(n,12),colorBgContainer:ut(n,8),colorBgLayout:ut(n,0),colorBgSpotlight:ut(n,26),colorBgBlur:Oe(r,.04),colorBorder:ut(n,26),colorBorderSecondary:ut(n,19)}},hd=(e,t)=>{const n=Object.keys($a).map(i=>{const a=ao(e[i],{theme:"dark"});return Array.from({length:10},()=>1).reduce((c,l,d)=>(c[`${i}-${d+1}`]=a[d],c[`${i}${d+1}`]=a[d],c),{})}).reduce((i,a)=>(i=Object.assign(Object.assign({},i),a),i),{}),r=t??Tn(e),o=Ca(e,{generateColorPalettes:ud,generateNeutralColorPalettes:fd});return Object.assign(Object.assign(Object.assign(Object.assign({},r),n),o),{colorPrimaryBg:o.colorPrimaryBorder,colorPrimaryBgHover:o.colorPrimaryBorderHover})};function md(){const[e,t,n]=to();return{theme:e,token:t,hashId:n}}const pd={defaultSeed:cr.token,useToken:md,defaultAlgorithm:Tn,darkAlgorithm:hd,compactAlgorithm:dd,getDesignToken:cd,defaultConfig:cr,_internalContext:_a};var gd={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M908 640H804V488c0-4.4-3.6-8-8-8H548v-96h108c8.8 0 16-7.2 16-16V80c0-8.8-7.2-16-16-16H368c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h108v96H228c-4.4 0-8 3.6-8 8v152H116c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16H292v-88h440v88H620c-8.8 0-16 7.2-16 16v288c0 8.8 7.2 16 16 16h288c8.8 0 16-7.2 16-16V656c0-8.8-7.2-16-16-16zm-564 76v168H176V716h168zm84-408V140h168v168H428zm420 576H680V716h168v168z"}}]},name:"apartment",theme:"outlined"},bd=function(t,n){return u.createElement(Me,ue({},t,{ref:n,icon:gd}))},yd=u.forwardRef(bd),vd={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M516 673c0 4.4 3.4 8 7.5 8h185c4.1 0 7.5-3.6 7.5-8v-48c0-4.4-3.4-8-7.5-8h-185c-4.1 0-7.5 3.6-7.5 8v48zm-194.9 6.1l192-161c3.8-3.2 3.8-9.1 0-12.3l-192-160.9A7.95 7.95 0 00308 351v62.7c0 2.4 1 4.6 2.9 6.1L420.7 512l-109.8 92.2a8.1 8.1 0 00-2.9 6.1V673c0 6.8 7.9 10.5 13.1 6.1zM880 112H144c-17.7 0-32 14.3-32 32v736c0 17.7 14.3 32 32 32h736c17.7 0 32-14.3 32-32V144c0-17.7-14.3-32-32-32zm-40 728H184V184h656v656z"}}]},name:"code",theme:"outlined"},xd=function(t,n){return u.createElement(Me,ue({},t,{ref:n,icon:vd}))},Uo=u.forwardRef(xd),wd={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"defs",attrs:{},children:[{tag:"style",attrs:{}}]},{tag:"path",attrs:{d:"M840 192h-56v-72c0-13.3-10.7-24-24-24H168c-13.3 0-24 10.7-24 24v272c0 13.3 10.7 24 24 24h592c13.3 0 24-10.7 24-24V256h32v200H465c-22.1 0-40 17.9-40 40v136h-44c-4.4 0-8 3.6-8 8v228c0 .6.1 1.3.2 1.9A83.99 83.99 0 00457 960c46.4 0 84-37.6 84-84 0-2.1-.1-4.1-.2-6.1.1-.6.2-1.2.2-1.9V640c0-4.4-3.6-8-8-8h-44V520h351c22.1 0 40-17.9 40-40V232c0-22.1-17.9-40-40-40zM720 352H208V160h512v192zM477 876c0 11-9 20-20 20s-20-9-20-20V696h40v180z"}}]},name:"format-painter",theme:"outlined"},jd=function(t,n){return u.createElement(Me,ue({},t,{ref:n,icon:wd}))},Sd=u.forwardRef(jd),$d={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm0 820c-205.4 0-372-166.6-372-372s166.6-372 372-372 372 166.6 372 372-166.6 372-372 372z"}},{tag:"path",attrs:{d:"M464 336a48 48 0 1096 0 48 48 0 10-96 0zm72 112h-48c-4.4 0-8 3.6-8 8v272c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V456c0-4.4-3.6-8-8-8z"}}]},name:"info-circle",theme:"outlined"},Cd=function(t,n){return u.createElement(Me,ue({},t,{ref:n,icon:$d}))},_d=u.forwardRef(Cd),Od={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M608 112c-167.9 0-304 136.1-304 304 0 70.3 23.9 135 63.9 186.5l-41.1 41.1-62.3-62.3a8.15 8.15 0 00-11.4 0l-39.8 39.8a8.15 8.15 0 000 11.4l62.3 62.3-44.9 44.9-62.3-62.3a8.15 8.15 0 00-11.4 0l-39.8 39.8a8.15 8.15 0 000 11.4l62.3 62.3-65.3 65.3a8.03 8.03 0 000 11.3l42.3 42.3c3.1 3.1 8.2 3.1 11.3 0l253.6-253.6A304.06 304.06 0 00608 720c167.9 0 304-136.1 304-304S775.9 112 608 112zm161.2 465.2C726.2 620.3 668.9 644 608 644c-60.9 0-118.2-23.7-161.2-66.8-43.1-43-66.8-100.3-66.8-161.2 0-60.9 23.7-118.2 66.8-161.2 43-43.1 100.3-66.8 161.2-66.8 60.9 0 118.2 23.7 161.2 66.8 43.1 43 66.8 100.3 66.8 161.2 0 60.9-23.7 118.2-66.8 161.2z"}}]},name:"key",theme:"outlined"},kd=function(t,n){return u.createElement(Me,ue({},t,{ref:n,icon:Od}))},Id=u.forwardRef(kd),Nd={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 464h-68V240c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zM332 240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v224H332V240zm460 600H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z"}}]},name:"lock",theme:"outlined"},Ed=function(t,n){return u.createElement(Me,ue({},t,{ref:n,icon:Nd}))},Wt=u.forwardRef(Ed),zd={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M928 160H96c-17.7 0-32 14.3-32 32v640c0 17.7 14.3 32 32 32h832c17.7 0 32-14.3 32-32V192c0-17.7-14.3-32-32-32zm-40 110.8V792H136V270.8l-27.6-21.5 39.3-50.5 42.8 33.3h643.1l42.8-33.3 39.3 50.5-27.7 21.5zM833.6 232L512 482 190.4 232l-42.8-33.3-39.3 50.5 27.6 21.5 341.6 265.6a55.99 55.99 0 0068.7 0L888 270.8l27.6-21.5-39.3-50.5-42.7 33.2z"}}]},name:"mail",theme:"outlined"},Pd=function(t,n){return u.createElement(Me,ue({},t,{ref:n,icon:zd}))},Td=u.forwardRef(Pd),Rd={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M864 736c0-111.6-65.4-208-160-252.9V317.3c0-15.1-5.3-29.7-15.1-41.2L536.5 95.4C530.1 87.8 521 84 512 84s-18.1 3.8-24.5 11.4L335.1 276.1a63.97 63.97 0 00-15.1 41.2v165.8C225.4 528 160 624.4 160 736h156.5c-2.3 7.2-3.5 15-3.5 23.8 0 22.1 7.6 43.7 21.4 60.8a97.2 97.2 0 0043.1 30.6c23.1 54 75.6 88.8 134.5 88.8 29.1 0 57.3-8.6 81.4-24.8 23.6-15.8 41.9-37.9 53-64a97 97 0 0043.1-30.5 97.52 97.52 0 0021.4-60.8c0-8.4-1.1-16.4-3.1-23.8H864zM762.3 621.4c9.4 14.6 17 30.3 22.5 46.6H700V558.7a211.6 211.6 0 0162.3 62.7zM388 483.1V318.8l124-147 124 147V668H388V483.1zM239.2 668c5.5-16.3 13.1-32 22.5-46.6 16.3-25.2 37.5-46.5 62.3-62.7V668h-84.8zm388.9 116.2c-5.2 3-11.2 4.2-17.1 3.4l-19.5-2.4-2.8 19.4c-5.4 37.9-38.4 66.5-76.7 66.5-38.3 0-71.3-28.6-76.7-66.5l-2.8-19.5-19.5 2.5a27.7 27.7 0 01-17.1-3.5c-8.7-5-14.1-14.3-14.1-24.4 0-10.6 5.9-19.4 14.6-23.8h231.3c8.8 4.5 14.6 13.3 14.6 23.8-.1 10.2-5.5 19.6-14.2 24.5zM464 400a48 48 0 1096 0 48 48 0 10-96 0z"}}]},name:"rocket",theme:"outlined"},Ad=function(t,n){return u.createElement(Me,ue({},t,{ref:n,icon:Rd}))},Dd=u.forwardRef(Ad),Md={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M824.2 699.9a301.55 301.55 0 00-86.4-60.4C783.1 602.8 812 546.8 812 484c0-110.8-92.4-201.7-203.2-200-109.1 1.7-197 90.6-197 200 0 62.8 29 118.8 74.2 155.5a300.95 300.95 0 00-86.4 60.4C345 754.6 314 826.8 312 903.8a8 8 0 008 8.2h56c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5A226.62 226.62 0 01612 684c60.9 0 118.2 23.7 161.3 66.8C814.5 792 838 846.3 840 904.3c.1 4.3 3.7 7.7 8 7.7h56a8 8 0 008-8.2c-2-77-33-149.2-87.8-203.9zM612 612c-34.2 0-66.4-13.3-90.5-37.5a126.86 126.86 0 01-37.5-91.8c.3-32.8 13.4-64.5 36.3-88 24-24.6 56.1-38.3 90.4-38.7 33.9-.3 66.8 12.9 91 36.6 24.8 24.3 38.4 56.8 38.4 91.4 0 34.2-13.3 66.3-37.5 90.5A127.3 127.3 0 01612 612zM361.5 510.4c-.9-8.7-1.4-17.5-1.4-26.4 0-15.9 1.5-31.4 4.3-46.5.7-3.6-1.2-7.3-4.5-8.8-13.6-6.1-26.1-14.5-36.9-25.1a127.54 127.54 0 01-38.7-95.4c.9-32.1 13.8-62.6 36.3-85.6 24.7-25.3 57.9-39.1 93.2-38.7 31.9.3 62.7 12.6 86 34.4 7.9 7.4 14.7 15.6 20.4 24.4 2 3.1 5.9 4.4 9.3 3.2 17.6-6.1 36.2-10.4 55.3-12.4 5.6-.6 8.8-6.6 6.3-11.6-32.5-64.3-98.9-108.7-175.7-109.9-110.9-1.7-203.3 89.2-203.3 199.9 0 62.8 28.9 118.8 74.2 155.5-31.8 14.7-61.1 35-86.5 60.4-54.8 54.7-85.8 126.9-87.8 204a8 8 0 008 8.2h56.1c4.3 0 7.9-3.4 8-7.7 1.9-58 25.4-112.3 66.7-153.5 29.4-29.4 65.4-49.8 104.7-59.7 3.9-1 6.5-4.7 6-8.7z"}}]},name:"team",theme:"outlined"},Zd=function(t,n){return u.createElement(Me,ue({},t,{ref:n,icon:Md}))},Ld=u.forwardRef(Zd),Fd={icon:{tag:"svg",attrs:{viewBox:"64 64 896 896",focusable:"false"},children:[{tag:"path",attrs:{d:"M832 464H332V240c0-30.9 25.1-56 56-56h248c30.9 0 56 25.1 56 56v68c0 4.4 3.6 8 8 8h56c4.4 0 8-3.6 8-8v-68c0-70.7-57.3-128-128-128H388c-70.7 0-128 57.3-128 128v224h-68c-17.7 0-32 14.3-32 32v384c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V496c0-17.7-14.3-32-32-32zm-40 376H232V536h560v304zM484 701v53c0 4.4 3.6 8 8 8h40c4.4 0 8-3.6 8-8v-53a48.01 48.01 0 10-56 0z"}}]},name:"unlock",theme:"outlined"},Bd=function(t,n){return u.createElement(Me,ue({},t,{ref:n,icon:Fd}))},Ud=u.forwardRef(Bd);const Hd=[{key:"dashboard",icon:s.jsx(ka,{}),label:s.jsx(Be,{to:"/dashboard",children:"Dashboard"})},{key:"content",icon:s.jsx(Ra,{}),label:"Content Management",children:[{key:"content-list",label:s.jsx(Be,{to:"/content",children:"Content List"})},{key:"categories",label:s.jsx(Be,{to:"/categories",children:"Categories"})}]},{key:"users-orders",icon:s.jsx(Ld,{}),label:"Users & Orders",children:[{key:"users",label:s.jsx(Be,{to:"/users",children:"Users"})},{key:"orders",label:s.jsx(Be,{to:"/orders",children:"Orders"})},{key:"tickets",label:s.jsx(Be,{to:"/tickets",children:"Tickets"})},{key:"disputes",label:s.jsx(Be,{to:"/disputes",children:"Disputes"})}]},{key:"system",icon:s.jsx(Ia,{}),label:"System",children:[{key:"roles",label:s.jsx(Be,{to:"/roles",children:"Roles & Permissions"})},{key:"system-settings",label:s.jsx(Be,{to:"/settings",children:"Settings"})},{key:"logs",label:s.jsx(Be,{to:"/system-logs",children:"System Logs"})}]}],Vd=({collapsed:e,onCollapse:t})=>{const n=qr(),r=()=>{const o=n.pathname;return o==="/dashboard"?"dashboard":o.startsWith("/content")?"content-list":o.startsWith("/categories")?"categories":o.startsWith("/users")?"users":o.startsWith("/orders")?"orders":o.startsWith("/tickets")?"tickets":o.startsWith("/disputes")?"disputes":o.startsWith("/roles")?"roles":o.startsWith("/settings")||o==="/settings"?"system-settings":o.startsWith("/system-logs")?"logs":"dashboard"};return s.jsxs(Ct.Sider,{collapsible:!0,collapsed:e,onCollapse:t,trigger:null,width:256,collapsedWidth:80,className:"!bg-[#001529]","data-testid":"admin-sidebar",children:[s.jsx("div",{className:"h-16 flex items-center justify-center border-b border-gray-700 overflow-hidden transition-all duration-300","data-testid":"admin-sidebar-logo",children:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"w-8 h-8 rounded-lg bg-indigo-500 flex items-center justify-center flex-shrink-0",children:s.jsx(Dd,{className:"text-white text-base"})}),!e&&s.jsx("span",{className:"text-white font-semibold text-base whitespace-nowrap tracking-tight",children:"Biomimic"})]})}),s.jsx(Oa,{mode:"inline",selectedKeys:[r()],defaultOpenKeys:["content","users-orders","system"],inlineCollapsed:!1,items:Hd,className:"!border-r-0 !bg-transparent mt-2",style:{background:"transparent"}})]})};class Wd{constructor(t){hn(this,"pendingRequests",[]);hn(this,"isShowingCaptcha",!1);this.callbacks=t}async intercept(t,n){const r=()=>this.executeRequest(t,n);if(this.isShowingCaptcha)return new Promise((i,a)=>{this.pendingRequests.push({resolve:i,reject:a,request:r})});const o=await r();return this.handleResponseStatus(o,r)}async executeRequest(t,n){const r=this.getStoredToken(),o=new Headers(n.headers);return r&&!o.has("Authorization")&&o.set("Authorization",`Bearer ${r}`),window.fetch(t,{...n,headers:o})}async handleResponseStatus(t,n){if(t.status===401)throw this.callbacks.onShowLogin(),new Error("Unauthorized");return this.shouldShowCaptcha(t)?this.handleCaptcha(n):t}shouldShowCaptcha(t){return t.status===403||t.status===429}async handleCaptcha(t){if(this.isShowingCaptcha)return new Promise((n,r)=>{this.pendingRequests.push({resolve:n,reject:r,request:t})});this.isShowingCaptcha=!0;try{if(await this.callbacks.onShowCaptcha({type:"image",captchaUrl:"/api/captcha"})){const r=await t();return await this.processPendingRequests(),r}else throw new Error("Captcha verification failed")}finally{this.isShowingCaptcha=!1}}async processPendingRequests(){const t=[...this.pendingRequests];this.pendingRequests=[],await Promise.all(t.map(async({resolve:n,reject:r,request:o})=>{try{const i=await o();n(i)}catch(i){r(i)}}))}getStoredToken(){var t;try{const n=localStorage.getItem("admin-storage");if(n)return((t=JSON.parse(n).state)==null?void 0:t.token)||null}catch{return null}return null}}function qd(e){const t=new Wd(e);return(n,r)=>t.intercept(n,r)}const Ho=Et((e,t)=>({isOpen:!1,type:"image",captchaUrl:"/api/captcha",resolveCaptcha:null,show:n=>new Promise(r=>{e({isOpen:!0,type:n.type||"image",captchaUrl:n.captchaUrl||"/api/captcha",resolveCaptcha:r})}),resolve:n=>{const{resolveCaptcha:r}=t();r&&r(n),e({isOpen:!1,resolveCaptcha:null})},close:()=>{const{resolveCaptcha:n}=t();n&&n(!1),e({isOpen:!1,resolveCaptcha:null})}})),Kd=window.location.origin,Vo="admin-storage";function Jd(){localStorage.removeItem(Vo),window.location.pathname!=="/admin/login"&&(window.location.href="/admin/login")}function Xd(){var e;try{const t=localStorage.getItem(Vo);if(t)return((e=JSON.parse(t).state)==null?void 0:e.token)||null}catch{return null}return null}function Gd(){const e=Ho.getState().show;return qd({onShowLogin:Jd,onShowCaptcha:async t=>e({type:t.type,captchaUrl:t.captchaUrl})})}const A=Za(Kd,{fetch:Gd(),webSocket:e=>new La(e),sse:e=>{const t=Xd(),n={};return t&&(n.Authorization=`Bearer ${t}`),new Fa(e,n)}});function gt(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}const Yd={ZodAny:"any",ZodArray:"array",ZodBigInt:"bigint",ZodBoolean:"boolean",ZodDefault:"default",ZodPrefault:"prefault",ZodTransform:"transform",ZodEnum:"enum",ZodIntersection:"intersection",ZodLazy:"lazy",ZodLiteral:"literal",ZodNever:"never",ZodNull:"null",ZodNullable:"nullable",ZodNumber:"number",ZodNonOptional:"nonoptional",ZodObject:"object",ZodOptional:"optional",ZodPipe:"pipe",ZodReadonly:"readonly",ZodRecord:"record",ZodString:"string",ZodTuple:"tuple",ZodType:"type",ZodUnion:"union",ZodDiscriminatedUnion:"union",ZodUnknown:"unknown",ZodVoid:"void",ZodDate:"date",ZodTemplateLiteral:"template_literal"};function Je(e,t){return(Array.isArray(t)?t:[t]).some(r=>{var o;const i=((o=e==null?void 0:e.def)===null||o===void 0?void 0:o.type)===Yd[r];return r==="ZodDiscriminatedUnion"?i&&"discriminator"in e.def:i})}function ft(e){return e&&"def"in e}let Qd=class{constructor(){this._map=new Map,this._idmap=new Map}add(t,...n){const r=n[0];if(this._map.set(t,r),r&&typeof r=="object"&&"id"in r){if(this._idmap.has(r.id))throw new Error(`ID ${r.id} already exists in the registry`);this._idmap.set(r.id,t)}return this}clear(){return this._map=new Map,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};return delete r.id,{...r,...this._map.get(t)}}return this._map.get(t)}has(t){return this._map.has(t)}};function eu(){return new Qd}function mn(e){return e===void 0}function tu(e,t){const n={};return Object.entries(e).forEach(([r,o])=>{t.some(i=>i===r)||(n[r]=o)}),n}function pn(e,t){const n={};return Object.entries(e).forEach(([r,o])=>{t(o,r)||(n[r]=o)}),n}const yr=eu();class et{static collectMetadata(t,n){const r=this.getMetadataFromRegistry(t),o=Object.assign(Object.assign({},r==null?void 0:r._internal),n==null?void 0:n._internal),i=Object.assign(Object.assign({},r==null?void 0:r.param),n==null?void 0:n.param),a=Object.assign(Object.assign(Object.assign(Object.assign({},Object.keys(o).length>0?{_internal:o}:{}),r),n),Object.keys(i).length>0?{param:i}:{});if(Je(t,["ZodOptional","ZodNullable","ZodDefault","ZodPrefault","ZodReadonly","ZodNonOptional"])&&ft(t._zod.def.innerType))return this.collectMetadata(t._zod.def.innerType,a);if(Je(t,"ZodPipe")){const c=t._zod.def.in,l=t._zod.def.out;if(Je(c,"ZodTransform")&&ft(l))return this.collectMetadata(l,a);if(ft(c))return this.collectMetadata(c,a)}return a}static getMetadata(t){return this.collectMetadata(t)}static getOpenApiMetadata(t){const n=this.collectMetadata(t),r=n??{},{_internal:o}=r;return gt(r,["_internal"])}static getInternalMetadata(t){var n;return(n=this.collectMetadata(t))===null||n===void 0?void 0:n._internal}static getParamMetadata(t){const n=this.collectMetadata(t);return Object.assign(Object.assign({},n),{param:Object.assign(Object.assign({},n!=null&&n.description?{description:n.description}:{}),n==null?void 0:n.param)})}static buildSchemaMetadata(t){return pn(tu(t,["param","_internal"]),mn)}static buildParameterMetadata(t){return pn(t,mn)}static applySchemaMetadata(t,n){return pn(Object.assign(Object.assign({},t),this.buildSchemaMetadata(n)),mn)}static getRefId(t){var n;return(n=this.getInternalMetadata(t))===null||n===void 0?void 0:n.refId}static unwrapChained(t){return this.unwrapUntil(t)}static getDefaultValue(t){var n;const r=(n=this.unwrapUntil(t,"ZodDefault"))!==null&&n!==void 0?n:this.unwrapUntil(t,"ZodPrefault");return r==null?void 0:r._zod.def.defaultValue}static unwrapUntil(t,n){if(n&&Je(t,n))return t;if(Je(t,["ZodOptional","ZodNullable","ZodDefault","ZodPrefault","ZodReadonly","ZodNonOptional"])&&ft(t._zod.def.innerType))return this.unwrapUntil(t._zod.def.innerType,n);if(Je(t,"ZodPipe")){const r=t._zod.def.in,o=t._zod.def.out;if(Je(r,"ZodTransform")&&ft(o))return this.unwrapUntil(o,n);if(ft(r))return this.unwrapUntil(r,n)}return n?void 0:t}static getMetadataFromInternalRegistry(t){return yr.get(t)}static getMetadataFromRegistry(t){const n=this.getMetadataFromInternalRegistry(t),r=t.meta();if(!n)return r;const{_internal:o}=n,i=gt(n,["_internal"]),a=r??{},{id:c,title:l}=a,d=gt(a,["id","title"]);return Object.assign(Object.assign(Object.assign({_internal:Object.assign(Object.assign({},c?{refId:c}:{}),o)},i),l?{description:l}:{}),d)}static setMetadataInRegistry(t,n){yr.add(t,n)}}function Ke(e,t){const n=e[t];typeof n=="function"&&(e[t]=function(...r){const o=n.apply(this,r),i=et.getMetadataFromRegistry(this);return i&&et.setMetadataInRegistry(o,i),o})}function nu(e){typeof e.ZodType.prototype.openapi<"u"||(e.ZodType.prototype.openapi=function(...t){const{refId:n,metadata:r,options:o}=ru(...t),i=r??{},{param:a}=i,c=gt(i,["param"]),l=et.getMetadataFromRegistry(this),d=l??{},{_internal:f}=d,h=gt(d,["_internal"]),m=Object.assign(Object.assign(Object.assign({},f),o),n?{refId:n}:void 0),g=Object.assign(Object.assign(Object.assign({},h),c),h!=null&&h.param||a?{param:Object.assign(Object.assign({},h==null?void 0:h.param),a)}:void 0),p=new this.constructor(this._def);function b(x){et.setMetadataInRegistry(x,Object.assign(Object.assign({},Object.keys(m).length>0?{_internal:m}:void 0),g))}if(b(p),Je(p,"ZodLazy")&&b(this),Je(p,"ZodObject")){const x=et.getMetadataFromRegistry(p),v=p.extend;p.extend=function(...O){const $=v.apply(p,O),z=x??{},{_internal:j}=z,C=gt(z,["_internal"]);return et.setMetadataInRegistry($,{_internal:{extendedFrom:j!=null&&j.refId?{refId:j.refId,schema:p}:j==null?void 0:j.extendedFrom}}),$.openapi(C)},Ke(p,"catchall")}Ke(p,"optional"),Ke(p,"nullable"),Ke(p,"default"),Ke(p,"transform"),Ke(p,"refine"),Ke(p,"length"),Ke(p,"min"),Ke(p,"max");const y=p.meta;return p.meta=function(...x){const v=y.apply(this,x);if(x[0]){const O=et.getMetadataFromInternalRegistry(this);O&&et.setMetadataInRegistry(v,Object.assign(Object.assign({},O),x[0]))}return v},p})}function ru(e,t,n){return typeof e=="string"?{refId:e,metadata:t,options:n}:{refId:void 0,metadata:e,options:t}}new Set(".\\+*[^]$()");var vr;function w(e,t,n){function r(c,l){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:l,constr:a,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,l);const d=a.prototype,f=Object.keys(d);for(let h=0;h<f.length;h++){const m=f[h];m in c||(c[m]=d[m].bind(c))}}const o=(n==null?void 0:n.Parent)??Object;class i extends o{}Object.defineProperty(i,"name",{value:e});function a(c){var l;const d=n!=null&&n.Parent?new i:this;r(d,c),(l=d._zod).deferred??(l.deferred=[]);for(const f of d._zod.deferred)f();return d}return Object.defineProperty(a,"init",{value:r}),Object.defineProperty(a,Symbol.hasInstance,{value:c=>{var l,d;return n!=null&&n.Parent&&c instanceof n.Parent?!0:(d=(l=c==null?void 0:c._zod)==null?void 0:l.traits)==null?void 0:d.has(e)}}),Object.defineProperty(a,"name",{value:e}),a}class bt extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}}class Wo extends Error{constructor(t){super(`Encountered unidirectional transform during encode: ${t}`),this.name="ZodEncodeError"}}(vr=globalThis).__zod_globalConfig??(vr.__zod_globalConfig={});const qt=globalThis.__zod_globalConfig;function De(e){return e&&Object.assign(qt,e),qt}function qo(e){const t=Object.values(e).filter(r=>typeof r=="number");return Object.entries(e).filter(([r,o])=>t.indexOf(+r)===-1).map(([r,o])=>o)}function xr(e,t="|"){return e.map(n=>Xo(n)).join(t)}function jn(e,t){return typeof t=="bigint"?t.toString():t}function Bn(e){return{get value(){{const t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function Un(e){return e==null}function Hn(e){const t=e.startsWith("^")?1:0,n=e.endsWith("$")?e.length-1:e.length;return e.slice(t,n)}const wr=Symbol("evaluating");function H(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==wr)return r===void 0&&(r=wr,r=n()),r},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function it(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function ot(...e){const t={};for(const n of e){const r=Object.getOwnPropertyDescriptors(n);Object.assign(t,r)}return Object.defineProperties({},t)}function jr(e){return JSON.stringify(e)}function ou(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}const Ko="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Kt(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const su=Bn(()=>{var e;if(qt.jitless||typeof navigator<"u"&&((e=navigator==null?void 0:navigator.userAgent)!=null&&e.includes("Cloudflare")))return!1;try{const t=Function;return new t(""),!0}catch{return!1}});function vt(e){if(Kt(e)===!1)return!1;const t=e.constructor;if(t===void 0||typeof t!="function")return!0;const n=t.prototype;return!(Kt(n)===!1||Object.prototype.hasOwnProperty.call(n,"isPrototypeOf")===!1)}function Jo(e){return vt(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}const iu=new Set(["string","number","symbol"]);function tn(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ye(e,t,n){const r=new e._zod.constr(t??e._zod.def);return(!t||n!=null&&n.parent)&&(r._zod.parent=e),r}function P(e){const t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if((t==null?void 0:t.message)!==void 0){if((t==null?void 0:t.error)!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function Xo(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function au(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}function cu(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");const i=ot(e._zod.def,{get shape(){const a={};for(const c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&(a[c]=n.shape[c])}return it(this,"shape",a),a},checks:[]});return Ye(e,i)}function lu(e,t){const n=e._zod.def,r=n.checks;if(r&&r.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");const i=ot(e._zod.def,{get shape(){const a={...e._zod.def.shape};for(const c in t){if(!(c in n.shape))throw new Error(`Unrecognized key: "${c}"`);t[c]&&delete a[c]}return it(this,"shape",a),a},checks:[]});return Ye(e,i)}function du(e,t){if(!vt(t))throw new Error("Invalid input to extend: expected a plain object");const n=e._zod.def.checks;if(n&&n.length>0){const i=e._zod.def.shape;for(const a in t)if(Object.getOwnPropertyDescriptor(i,a)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}const o=ot(e._zod.def,{get shape(){const i={...e._zod.def.shape,...t};return it(this,"shape",i),i}});return Ye(e,o)}function uu(e,t){if(!vt(t))throw new Error("Invalid input to safeExtend: expected a plain object");const n=ot(e._zod.def,{get shape(){const r={...e._zod.def.shape,...t};return it(this,"shape",r),r}});return Ye(e,n)}function fu(e,t){var r;if((r=e._zod.def.checks)!=null&&r.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");const n=ot(e._zod.def,{get shape(){const o={...e._zod.def.shape,...t._zod.def.shape};return it(this,"shape",o),o},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return Ye(e,n)}function hu(e,t,n){const o=t._zod.def.checks;if(o&&o.length>0)throw new Error(".partial() cannot be used on object schemas containing refinements");const a=ot(t._zod.def,{get shape(){const c=t._zod.def.shape,l={...c};if(n)for(const d in n){if(!(d in c))throw new Error(`Unrecognized key: "${d}"`);n[d]&&(l[d]=e?new e({type:"optional",innerType:c[d]}):c[d])}else for(const d in c)l[d]=e?new e({type:"optional",innerType:c[d]}):c[d];return it(this,"shape",l),l},checks:[]});return Ye(t,a)}function mu(e,t,n){const r=ot(t._zod.def,{get shape(){const o=t._zod.def.shape,i={...o};if(n)for(const a in n){if(!(a in i))throw new Error(`Unrecognized key: "${a}"`);n[a]&&(i[a]=new e({type:"nonoptional",innerType:o[a]}))}else for(const a in o)i[a]=new e({type:"nonoptional",innerType:o[a]});return it(this,"shape",i),i}});return Ye(t,r)}function ht(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)!==!0)return!0;return!1}function pu(e,t=0){var n;if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(((n=e.issues[r])==null?void 0:n.continue)===!1)return!0;return!1}function mt(e,t){return t.map(n=>{var r;return(r=n).path??(r.path=[]),n.path.unshift(e),n})}function Rt(e){return typeof e=="string"?e:e==null?void 0:e.message}function Xe(e,t,n){var l,d,f,h,m,g;const r=e.message?e.message:Rt((f=(d=(l=e.inst)==null?void 0:l._zod.def)==null?void 0:d.error)==null?void 0:f.call(d,e))??Rt((h=t==null?void 0:t.error)==null?void 0:h.call(t,e))??Rt((m=n.customError)==null?void 0:m.call(n,e))??Rt((g=n.localeError)==null?void 0:g.call(n,e))??"Invalid input",{inst:o,continue:i,input:a,...c}=e;return c.path??(c.path=[]),c.message=r,t!=null&&t.reportInput&&(c.input=a),c}function Vn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function gu(e){const t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";const n=e;if(n&&Object.getPrototypeOf(n)!==Object.prototype&&"constructor"in n&&n.constructor)return n.constructor.name}}return t}function kt(...e){const[t,n,r]=e;return typeof t=="string"?{message:t,code:"custom",input:n,inst:r}:{...t}}const Go=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,jn,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Yo=w("$ZodError",Go),Qo=w("$ZodError",Go,{Parent:Error});function es(e,t=n=>n.message){const n={},r=[];for(const o of e.issues)o.path.length>0?(n[o.path[0]]=n[o.path[0]]||[],n[o.path[0]].push(t(o))):r.push(t(o));return{formErrors:r,fieldErrors:n}}function ts(e,t=n=>n.message){const n={_errors:[]},r=(o,i=[])=>{for(const a of o.issues)if(a.code==="invalid_union"&&a.errors.length)a.errors.map(c=>r({issues:c},[...i,...a.path]));else if(a.code==="invalid_key")r({issues:a.issues},[...i,...a.path]);else if(a.code==="invalid_element")r({issues:a.issues},[...i,...a.path]);else{const c=[...i,...a.path];if(c.length===0)n._errors.push(t(a));else{let l=n,d=0;for(;d<c.length;){const f=c[d];d===c.length-1?(l[f]=l[f]||{_errors:[]},l[f]._errors.push(t(a))):l[f]=l[f]||{_errors:[]},l=l[f],d++}}}};return r(e),n}const Wn=e=>(t,n,r,o)=>{const i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new bt;if(a.issues.length){const c=new((o==null?void 0:o.Err)??e)(a.issues.map(l=>Xe(l,i,De())));throw Ko(c,o==null?void 0:o.callee),c}return a.value},qn=e=>async(t,n,r,o)=>{const i=r?{...r,async:!0}:{async:!0};let a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise&&(a=await a),a.issues.length){const c=new((o==null?void 0:o.Err)??e)(a.issues.map(l=>Xe(l,i,De())));throw Ko(c,o==null?void 0:o.callee),c}return a.value},nn=e=>(t,n,r)=>{const o=r?{...r,async:!1}:{async:!1},i=t._zod.run({value:n,issues:[]},o);if(i instanceof Promise)throw new bt;return i.issues.length?{success:!1,error:new(e??Yo)(i.issues.map(a=>Xe(a,o,De())))}:{success:!0,data:i.value}},bu=nn(Qo),rn=e=>async(t,n,r)=>{const o=r?{...r,async:!0}:{async:!0};let i=t._zod.run({value:n,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?{success:!1,error:new e(i.issues.map(a=>Xe(a,o,De())))}:{success:!0,data:i.value}},yu=rn(Qo),vu=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return Wn(e)(t,n,o)},xu=e=>(t,n,r)=>Wn(e)(t,n,r),wu=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return qn(e)(t,n,o)},ju=e=>async(t,n,r)=>qn(e)(t,n,r),Su=e=>(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return nn(e)(t,n,o)},$u=e=>(t,n,r)=>nn(e)(t,n,r),Cu=e=>async(t,n,r)=>{const o=r?{...r,direction:"backward"}:{direction:"backward"};return rn(e)(t,n,o)},_u=e=>async(t,n,r)=>rn(e)(t,n,r),Ou=/^[cC][0-9a-z]{6,}$/,ku=/^[0-9a-z]+$/,Iu=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,Nu=/^[0-9a-vA-V]{20}$/,Eu=/^[A-Za-z0-9]{27}$/,zu=/^[a-zA-Z0-9_-]{21}$/,Pu=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Tu=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Sr=e=>e?new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,Ru=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,Au="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";function Du(){return new RegExp(Au,"u")}const Mu=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Zu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,Lu=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,Fu=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Bu=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,ns=/^[A-Za-z0-9_-]*$/,Uu=/^https?$/,Hu=/^\+[1-9]\d{6,14}$/,rs="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Vu=new RegExp(`^${rs}$`);function os(e){const t="(?:[01]\\d|2[0-3]):[0-5]\\d";return typeof e.precision=="number"?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function Wu(e){return new RegExp(`^${os(e)}$`)}function qu(e){const t=os({precision:e.precision}),n=["Z"];e.local&&n.push(""),e.offset&&n.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");const r=`${t}(?:${n.join("|")})`;return new RegExp(`^${rs}T(?:${r})$`)}const Ku=e=>{const t=e?`[\\s\\S]{${(e==null?void 0:e.minimum)??0},${(e==null?void 0:e.maximum)??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)},Ju=/^-?\d+(?:\.\d+)?$/,Xu=/^[^A-Z]*$/,Gu=/^[^a-z]*$/,We=w("$ZodCheck",(e,t)=>{var n;e._zod??(e._zod={}),e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Yu=w("$ZodCheckMaxLength",(e,t)=>{var n;We.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Un(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.maximum??Number.POSITIVE_INFINITY;t.maximum<o&&(r._zod.bag.maximum=t.maximum)}),e._zod.check=r=>{const o=r.value;if(o.length<=t.maximum)return;const a=Vn(o);r.issues.push({origin:a,code:"too_big",maximum:t.maximum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),Qu=w("$ZodCheckMinLength",(e,t)=>{var n;We.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Un(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag.minimum??Number.NEGATIVE_INFINITY;t.minimum>o&&(r._zod.bag.minimum=t.minimum)}),e._zod.check=r=>{const o=r.value;if(o.length>=t.minimum)return;const a=Vn(o);r.issues.push({origin:a,code:"too_small",minimum:t.minimum,inclusive:!0,input:o,inst:e,continue:!t.abort})}}),ef=w("$ZodCheckLengthEquals",(e,t)=>{var n;We.init(e,t),(n=e._zod.def).when??(n.when=r=>{const o=r.value;return!Un(o)&&o.length!==void 0}),e._zod.onattach.push(r=>{const o=r._zod.bag;o.minimum=t.length,o.maximum=t.length,o.length=t.length}),e._zod.check=r=>{const o=r.value,i=o.length;if(i===t.length)return;const a=Vn(o),c=i>t.length;r.issues.push({origin:a,...c?{code:"too_big",maximum:t.length}:{code:"too_small",minimum:t.length},inclusive:!0,exact:!0,input:r.value,inst:e,continue:!t.abort})}}),on=w("$ZodCheckStringFormat",(e,t)=>{var n,r;We.init(e,t),e._zod.onattach.push(o=>{const i=o._zod.bag;i.format=t.format,t.pattern&&(i.patterns??(i.patterns=new Set),i.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),tf=w("$ZodCheckRegex",(e,t)=>{on.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:"regex",input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),nf=w("$ZodCheckLowerCase",(e,t)=>{t.pattern??(t.pattern=Xu),on.init(e,t)}),rf=w("$ZodCheckUpperCase",(e,t)=>{t.pattern??(t.pattern=Gu),on.init(e,t)}),of=w("$ZodCheckIncludes",(e,t)=>{We.init(e,t);const n=tn(t.includes),r=new RegExp(typeof t.position=="number"?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(o=>{const i=o._zod.bag;i.patterns??(i.patterns=new Set),i.patterns.add(r)}),e._zod.check=o=>{o.value.includes(t.includes,t.position)||o.issues.push({origin:"string",code:"invalid_format",format:"includes",includes:t.includes,input:o.value,inst:e,continue:!t.abort})}}),sf=w("$ZodCheckStartsWith",(e,t)=>{We.init(e,t);const n=new RegExp(`^${tn(t.prefix)}.*`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.startsWith(t.prefix)||r.issues.push({origin:"string",code:"invalid_format",format:"starts_with",prefix:t.prefix,input:r.value,inst:e,continue:!t.abort})}}),af=w("$ZodCheckEndsWith",(e,t)=>{We.init(e,t);const n=new RegExp(`.*${tn(t.suffix)}$`);t.pattern??(t.pattern=n),e._zod.onattach.push(r=>{const o=r._zod.bag;o.patterns??(o.patterns=new Set),o.patterns.add(n)}),e._zod.check=r=>{r.value.endsWith(t.suffix)||r.issues.push({origin:"string",code:"invalid_format",format:"ends_with",suffix:t.suffix,input:r.value,inst:e,continue:!t.abort})}}),cf=w("$ZodCheckOverwrite",(e,t)=>{We.init(e,t),e._zod.check=n=>{n.value=t.tx(n.value)}});class lf{constructor(t=[]){this.content=[],this.indent=0,this&&(this.args=t)}indented(t){this.indent+=1,t(this),this.indent-=1}write(t){if(typeof t=="function"){t(this,{execution:"sync"}),t(this,{execution:"async"});return}const r=t.split(`
47
+ `).filter(a=>a),o=Math.min(...r.map(a=>a.length-a.trimStart().length)),i=r.map(a=>a.slice(o)).map(a=>" ".repeat(this.indent*2)+a);for(const a of i)this.content.push(a)}compile(){const t=Function,n=this==null?void 0:this.args,o=[...((this==null?void 0:this.content)??[""]).map(i=>` ${i}`)];return new t(...n,o.join(`
48
+ `))}}const df={major:4,minor:4,patch:3},ie=w("$ZodType",(e,t)=>{var o;var n;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=df;const r=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&r.unshift(e);for(const i of r)for(const a of i._zod.onattach)a(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),(o=e._zod.deferred)==null||o.push(()=>{e._zod.run=e._zod.parse});else{const i=(c,l,d)=>{let f=ht(c),h;for(const m of l){if(m._zod.def.when){if(pu(c)||!m._zod.def.when(c))continue}else if(f)continue;const g=c.issues.length,p=m._zod.check(c);if(p instanceof Promise&&(d==null?void 0:d.async)===!1)throw new bt;if(h||p instanceof Promise)h=(h??Promise.resolve()).then(async()=>{await p,c.issues.length!==g&&(f||(f=ht(c,g)))});else{if(c.issues.length===g)continue;f||(f=ht(c,g))}}return h?h.then(()=>c):c},a=(c,l,d)=>{if(ht(c))return c.aborted=!0,c;const f=i(l,r,d);if(f instanceof Promise){if(d.async===!1)throw new bt;return f.then(h=>e._zod.parse(h,d))}return e._zod.parse(f,d)};e._zod.run=(c,l)=>{if(l.skipChecks)return e._zod.parse(c,l);if(l.direction==="backward"){const f=e._zod.parse({value:c.value,issues:[]},{...l,skipChecks:!0});return f instanceof Promise?f.then(h=>a(h,c,l)):a(f,c,l)}const d=e._zod.parse(c,l);if(d instanceof Promise){if(l.async===!1)throw new bt;return d.then(f=>i(f,r,l))}return i(d,r,l)}}H(e,"~standard",()=>({validate:i=>{var a;try{const c=bu(e,i);return c.success?{value:c.data}:{issues:(a=c.error)==null?void 0:a.issues}}catch{return yu(e,i).then(l=>{var d;return l.success?{value:l.data}:{issues:(d=l.error)==null?void 0:d.issues}})}},vendor:"zod",version:1}))}),Kn=w("$ZodString",(e,t)=>{var n;ie.init(e,t),e._zod.pattern=[...((n=e==null?void 0:e._zod.bag)==null?void 0:n.patterns)??[]].pop()??Ku(e._zod.bag),e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}}),G=w("$ZodStringFormat",(e,t)=>{on.init(e,t),Kn.init(e,t)}),uf=w("$ZodGUID",(e,t)=>{t.pattern??(t.pattern=Tu),G.init(e,t)}),ff=w("$ZodUUID",(e,t)=>{if(t.version){const r={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(r===void 0)throw new Error(`Invalid UUID version: "${t.version}"`);t.pattern??(t.pattern=Sr(r))}else t.pattern??(t.pattern=Sr());G.init(e,t)}),hf=w("$ZodEmail",(e,t)=>{t.pattern??(t.pattern=Ru),G.init(e,t)}),mf=w("$ZodURL",(e,t)=>{G.init(e,t),e._zod.check=n=>{var r;try{const o=n.value.trim();if(!t.normalize&&((r=t.protocol)==null?void 0:r.source)===Uu.source&&!/^https?:\/\//i.test(o)){n.issues.push({code:"invalid_format",format:"url",note:"Invalid URL format",input:n.value,inst:e,continue:!t.abort});return}const i=new URL(o);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid hostname",pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(":")?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:"invalid_format",format:"url",note:"Invalid protocol",pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),t.normalize?n.value=i.href:n.value=o;return}catch{n.issues.push({code:"invalid_format",format:"url",input:n.value,inst:e,continue:!t.abort})}}}),pf=w("$ZodEmoji",(e,t)=>{t.pattern??(t.pattern=Du()),G.init(e,t)}),gf=w("$ZodNanoID",(e,t)=>{t.pattern??(t.pattern=zu),G.init(e,t)}),bf=w("$ZodCUID",(e,t)=>{t.pattern??(t.pattern=Ou),G.init(e,t)}),yf=w("$ZodCUID2",(e,t)=>{t.pattern??(t.pattern=ku),G.init(e,t)}),vf=w("$ZodULID",(e,t)=>{t.pattern??(t.pattern=Iu),G.init(e,t)}),xf=w("$ZodXID",(e,t)=>{t.pattern??(t.pattern=Nu),G.init(e,t)}),wf=w("$ZodKSUID",(e,t)=>{t.pattern??(t.pattern=Eu),G.init(e,t)}),jf=w("$ZodISODateTime",(e,t)=>{t.pattern??(t.pattern=qu(t)),G.init(e,t)}),Sf=w("$ZodISODate",(e,t)=>{t.pattern??(t.pattern=Vu),G.init(e,t)}),$f=w("$ZodISOTime",(e,t)=>{t.pattern??(t.pattern=Wu(t)),G.init(e,t)}),Cf=w("$ZodISODuration",(e,t)=>{t.pattern??(t.pattern=Pu),G.init(e,t)}),_f=w("$ZodIPv4",(e,t)=>{t.pattern??(t.pattern=Mu),G.init(e,t),e._zod.bag.format="ipv4"}),Of=w("$ZodIPv6",(e,t)=>{t.pattern??(t.pattern=Zu),G.init(e,t),e._zod.bag.format="ipv6",e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:"invalid_format",format:"ipv6",input:n.value,inst:e,continue:!t.abort})}}}),kf=w("$ZodCIDRv4",(e,t)=>{t.pattern??(t.pattern=Lu),G.init(e,t)}),If=w("$ZodCIDRv6",(e,t)=>{t.pattern??(t.pattern=Fu),G.init(e,t),e._zod.check=n=>{const r=n.value.split("/");try{if(r.length!==2)throw new Error;const[o,i]=r;if(!i)throw new Error;const a=Number(i);if(`${a}`!==i)throw new Error;if(a<0||a>128)throw new Error;new URL(`http://[${o}]`)}catch{n.issues.push({code:"invalid_format",format:"cidrv6",input:n.value,inst:e,continue:!t.abort})}}});function ss(e){if(e==="")return!0;if(/\s/.test(e)||e.length%4!==0)return!1;try{return atob(e),!0}catch{return!1}}const Nf=w("$ZodBase64",(e,t)=>{t.pattern??(t.pattern=Bu),G.init(e,t),e._zod.bag.contentEncoding="base64",e._zod.check=n=>{ss(n.value)||n.issues.push({code:"invalid_format",format:"base64",input:n.value,inst:e,continue:!t.abort})}});function Ef(e){if(!ns.test(e))return!1;const t=e.replace(/[-_]/g,r=>r==="-"?"+":"/"),n=t.padEnd(Math.ceil(t.length/4)*4,"=");return ss(n)}const zf=w("$ZodBase64URL",(e,t)=>{t.pattern??(t.pattern=ns),G.init(e,t),e._zod.bag.contentEncoding="base64url",e._zod.check=n=>{Ef(n.value)||n.issues.push({code:"invalid_format",format:"base64url",input:n.value,inst:e,continue:!t.abort})}}),Pf=w("$ZodE164",(e,t)=>{t.pattern??(t.pattern=Hu),G.init(e,t)});function Tf(e,t=null){try{const n=e.split(".");if(n.length!==3)return!1;const[r]=n;if(!r)return!1;const o=JSON.parse(atob(r));return!("typ"in o&&(o==null?void 0:o.typ)!=="JWT"||!o.alg||t&&(!("alg"in o)||o.alg!==t))}catch{return!1}}const Rf=w("$ZodJWT",(e,t)=>{G.init(e,t),e._zod.check=n=>{Tf(n.value,t.alg)||n.issues.push({code:"invalid_format",format:"jwt",input:n.value,inst:e,continue:!t.abort})}}),Af=w("$ZodUnknown",(e,t)=>{ie.init(e,t),e._zod.parse=n=>n}),Df=w("$ZodNever",(e,t)=>{ie.init(e,t),e._zod.parse=(n,r)=>(n.issues.push({expected:"never",code:"invalid_type",input:n.value,inst:e}),n)});function $r(e,t,n){e.issues.length&&t.issues.push(...mt(n,e.issues)),t.value[n]=e.value}const Mf=w("$ZodArray",(e,t)=>{ie.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!Array.isArray(o))return n.issues.push({expected:"array",code:"invalid_type",input:o,inst:e}),n;n.value=Array(o.length);const i=[];for(let a=0;a<o.length;a++){const c=o[a],l=t.element._zod.run({value:c,issues:[]},r);l instanceof Promise?i.push(l.then(d=>$r(d,n,a))):$r(l,n,a)}return i.length?Promise.all(i).then(()=>n):n}});function Jt(e,t,n,r,o,i){const a=n in r;if(e.issues.length){if(o&&i&&!a)return;t.issues.push(...mt(n,e.issues))}if(!a&&!o){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[n]});return}e.value===void 0?a&&(t.value[n]=void 0):t.value[n]=e.value}function is(e){var r,o,i,a;const t=Object.keys(e.shape);for(const c of t)if(!((a=(i=(o=(r=e.shape)==null?void 0:r[c])==null?void 0:o._zod)==null?void 0:i.traits)!=null&&a.has("$ZodType")))throw new Error(`Invalid element at key "${c}": expected a Zod schema`);const n=au(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function as(e,t,n,r,o,i){const a=[],c=o.keySet,l=o.catchall._zod,d=l.def.type,f=l.optin==="optional",h=l.optout==="optional";for(const m in t){if(m==="__proto__"||c.has(m))continue;if(d==="never"){a.push(m);continue}const g=l.run({value:t[m],issues:[]},r);g instanceof Promise?e.push(g.then(p=>Jt(p,n,m,t,f,h))):Jt(g,n,m,t,f,h)}return a.length&&n.issues.push({code:"unrecognized_keys",keys:a,input:t,inst:i}),e.length?Promise.all(e).then(()=>n):n}const Zf=w("$ZodObject",(e,t)=>{ie.init(e,t);const n=Object.getOwnPropertyDescriptor(t,"shape");if(!(n!=null&&n.get)){const c=t.shape;Object.defineProperty(t,"shape",{get:()=>{const l={...c};return Object.defineProperty(t,"shape",{value:l}),l}})}const r=Bn(()=>is(t));H(e._zod,"propValues",()=>{const c=t.shape,l={};for(const d in c){const f=c[d]._zod;if(f.values){l[d]??(l[d]=new Set);for(const h of f.values)l[d].add(h)}}return l});const o=Kt,i=t.catchall;let a;e._zod.parse=(c,l)=>{a??(a=r.value);const d=c.value;if(!o(d))return c.issues.push({expected:"object",code:"invalid_type",input:d,inst:e}),c;c.value={};const f=[],h=a.shape;for(const m of a.keys){const g=h[m],p=g._zod.optin==="optional",b=g._zod.optout==="optional",y=g._zod.run({value:d[m],issues:[]},l);y instanceof Promise?f.push(y.then(x=>Jt(x,c,m,d,p,b))):Jt(y,c,m,d,p,b)}return i?as(f,d,c,l,r.value,e):f.length?Promise.all(f).then(()=>c):c}}),Lf=w("$ZodObjectJIT",(e,t)=>{Zf.init(e,t);const n=e._zod.parse,r=Bn(()=>is(t)),o=m=>{var O,$;const g=new lf(["shape","payload","ctx"]),p=r.value,b=z=>{const j=jr(z);return`shape[${j}]._zod.run({ value: input[${j}], issues: [] }, ctx)`};g.write("const input = payload.value;");const y=Object.create(null);let x=0;for(const z of p.keys)y[z]=`key_${x++}`;g.write("const newResult = {};");for(const z of p.keys){const j=y[z],C=jr(z),_=m[z],k=((O=_==null?void 0:_._zod)==null?void 0:O.optin)==="optional",S=(($=_==null?void 0:_._zod)==null?void 0:$.optout)==="optional";g.write(`const ${j} = ${b(z)};`),k&&S?g.write(`
49
+ if (${j}.issues.length) {
50
+ if (${C} in input) {
51
+ payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
52
+ ...iss,
53
+ path: iss.path ? [${C}, ...iss.path] : [${C}]
54
+ })));
55
+ }
56
+ }
57
+
58
+ if (${j}.value === undefined) {
59
+ if (${C} in input) {
60
+ newResult[${C}] = undefined;
61
+ }
62
+ } else {
63
+ newResult[${C}] = ${j}.value;
64
+ }
65
+
66
+ `):k?g.write(`
67
+ if (${j}.issues.length) {
68
+ payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
69
+ ...iss,
70
+ path: iss.path ? [${C}, ...iss.path] : [${C}]
71
+ })));
72
+ }
73
+
74
+ if (${j}.value === undefined) {
75
+ if (${C} in input) {
76
+ newResult[${C}] = undefined;
77
+ }
78
+ } else {
79
+ newResult[${C}] = ${j}.value;
80
+ }
81
+
82
+ `):g.write(`
83
+ const ${j}_present = ${C} in input;
84
+ if (${j}.issues.length) {
85
+ payload.issues = payload.issues.concat(${j}.issues.map(iss => ({
86
+ ...iss,
87
+ path: iss.path ? [${C}, ...iss.path] : [${C}]
88
+ })));
89
+ }
90
+ if (!${j}_present && !${j}.issues.length) {
91
+ payload.issues.push({
92
+ code: "invalid_type",
93
+ expected: "nonoptional",
94
+ input: undefined,
95
+ path: [${C}]
96
+ });
97
+ }
98
+
99
+ if (${j}_present) {
100
+ if (${j}.value === undefined) {
101
+ newResult[${C}] = undefined;
102
+ } else {
103
+ newResult[${C}] = ${j}.value;
104
+ }
105
+ }
106
+
107
+ `)}g.write("payload.value = newResult;"),g.write("return payload;");const v=g.compile();return(z,j)=>v(m,z,j)};let i;const a=Kt,c=!qt.jitless,d=c&&su.value,f=t.catchall;let h;e._zod.parse=(m,g)=>{h??(h=r.value);const p=m.value;return a(p)?c&&d&&(g==null?void 0:g.async)===!1&&g.jitless!==!0?(i||(i=o(t.shape)),m=i(m,g),f?as([],p,m,g,h,e):m):n(m,g):(m.issues.push({expected:"object",code:"invalid_type",input:p,inst:e}),m)}});function Cr(e,t,n,r){for(const i of e)if(i.issues.length===0)return t.value=i.value,t;const o=e.filter(i=>!ht(i));return o.length===1?(t.value=o[0].value,o[0]):(t.issues.push({code:"invalid_union",input:t.value,inst:n,errors:e.map(i=>i.issues.map(a=>Xe(a,r,De())))}),t)}const Ff=w("$ZodUnion",(e,t)=>{ie.init(e,t),H(e._zod,"optin",()=>t.options.some(r=>r._zod.optin==="optional")?"optional":void 0),H(e._zod,"optout",()=>t.options.some(r=>r._zod.optout==="optional")?"optional":void 0),H(e._zod,"values",()=>{if(t.options.every(r=>r._zod.values))return new Set(t.options.flatMap(r=>Array.from(r._zod.values)))}),H(e._zod,"pattern",()=>{if(t.options.every(r=>r._zod.pattern)){const r=t.options.map(o=>o._zod.pattern);return new RegExp(`^(${r.map(o=>Hn(o.source)).join("|")})$`)}});const n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,o)=>{if(n)return n(r,o);let i=!1;const a=[];for(const c of t.options){const l=c._zod.run({value:r.value,issues:[]},o);if(l instanceof Promise)a.push(l),i=!0;else{if(l.issues.length===0)return l;a.push(l)}}return i?Promise.all(a).then(c=>Cr(c,r,e,o)):Cr(a,r,e,o)}}),Bf=w("$ZodIntersection",(e,t)=>{ie.init(e,t),e._zod.parse=(n,r)=>{const o=n.value,i=t.left._zod.run({value:o,issues:[]},r),a=t.right._zod.run({value:o,issues:[]},r);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([l,d])=>_r(n,l,d)):_r(n,i,a)}});function Sn(e,t){if(e===t)return{valid:!0,data:e};if(e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(vt(e)&&vt(t)){const n=Object.keys(t),r=Object.keys(e).filter(i=>n.indexOf(i)!==-1),o={...e,...t};for(const i of r){const a=Sn(e[i],t[i]);if(!a.valid)return{valid:!1,mergeErrorPath:[i,...a.mergeErrorPath]};o[i]=a.data}return{valid:!0,data:o}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};const n=[];for(let r=0;r<e.length;r++){const o=e[r],i=t[r],a=Sn(o,i);if(!a.valid)return{valid:!1,mergeErrorPath:[r,...a.mergeErrorPath]};n.push(a.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function _r(e,t,n){const r=new Map;let o;for(const c of t.issues)if(c.code==="unrecognized_keys"){o??(o=c);for(const l of c.keys)r.has(l)||r.set(l,{}),r.get(l).l=!0}else e.issues.push(c);for(const c of n.issues)if(c.code==="unrecognized_keys")for(const l of c.keys)r.has(l)||r.set(l,{}),r.get(l).r=!0;else e.issues.push(c);const i=[...r].filter(([,c])=>c.l&&c.r).map(([c])=>c);if(i.length&&o&&e.issues.push({...o,keys:i}),ht(e))return e;const a=Sn(t.value,n.value);if(!a.valid)throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(a.mergeErrorPath)}`);return e.value=a.data,e}const Uf=w("$ZodRecord",(e,t)=>{ie.init(e,t),e._zod.parse=(n,r)=>{const o=n.value;if(!vt(o))return n.issues.push({expected:"record",code:"invalid_type",input:o,inst:e}),n;const i=[],a=t.keyType._zod.values;if(a){n.value={};const c=new Set;for(const d of a)if(typeof d=="string"||typeof d=="number"||typeof d=="symbol"){c.add(typeof d=="number"?d.toString():d);const f=t.keyType._zod.run({value:d,issues:[]},r);if(f instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(f.issues.length){n.issues.push({code:"invalid_key",origin:"record",issues:f.issues.map(g=>Xe(g,r,De())),input:d,path:[d],inst:e});continue}const h=f.value,m=t.valueType._zod.run({value:o[d],issues:[]},r);m instanceof Promise?i.push(m.then(g=>{g.issues.length&&n.issues.push(...mt(d,g.issues)),n.value[h]=g.value})):(m.issues.length&&n.issues.push(...mt(d,m.issues)),n.value[h]=m.value)}let l;for(const d in o)c.has(d)||(l=l??[],l.push(d));l&&l.length>0&&n.issues.push({code:"unrecognized_keys",input:o,inst:e,keys:l})}else{n.value={};for(const c of Reflect.ownKeys(o)){if(c==="__proto__"||!Object.prototype.propertyIsEnumerable.call(o,c))continue;let l=t.keyType._zod.run({value:c,issues:[]},r);if(l instanceof Promise)throw new Error("Async schemas not supported in object keys currently");if(typeof c=="string"&&Ju.test(c)&&l.issues.length){const h=t.keyType._zod.run({value:Number(c),issues:[]},r);if(h instanceof Promise)throw new Error("Async schemas not supported in object keys currently");h.issues.length===0&&(l=h)}if(l.issues.length){t.mode==="loose"?n.value[c]=o[c]:n.issues.push({code:"invalid_key",origin:"record",issues:l.issues.map(h=>Xe(h,r,De())),input:c,path:[c],inst:e});continue}const f=t.valueType._zod.run({value:o[c],issues:[]},r);f instanceof Promise?i.push(f.then(h=>{h.issues.length&&n.issues.push(...mt(c,h.issues)),n.value[l.value]=h.value})):(f.issues.length&&n.issues.push(...mt(c,f.issues)),n.value[l.value]=f.value)}}return i.length?Promise.all(i).then(()=>n):n}}),Hf=w("$ZodEnum",(e,t)=>{ie.init(e,t);const n=qo(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=new RegExp(`^(${n.filter(o=>iu.has(typeof o)).map(o=>typeof o=="string"?tn(o):o.toString()).join("|")})$`),e._zod.parse=(o,i)=>{const a=o.value;return r.has(a)||o.issues.push({code:"invalid_value",values:n,input:a,inst:e}),o}}),Vf=w("$ZodTransform",(e,t)=>{ie.init(e,t),e._zod.optin="optional",e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Wo(e.constructor.name);const o=t.transform(n.value,n);if(r.async)return(o instanceof Promise?o:Promise.resolve(o)).then(a=>(n.value=a,n.fallback=!0,n));if(o instanceof Promise)throw new bt;return n.value=o,n.fallback=!0,n}});function Or(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const cs=w("$ZodOptional",(e,t)=>{ie.init(e,t),e._zod.optin="optional",e._zod.optout="optional",H(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),H(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Hn(n.source)})?$`):void 0}),e._zod.parse=(n,r)=>{if(t.innerType._zod.optin==="optional"){const o=n.value,i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(a=>Or(a,o)):Or(i,o)}return n.value===void 0?n:t.innerType._zod.run(n,r)}}),Wf=w("$ZodExactOptional",(e,t)=>{cs.init(e,t),H(e._zod,"values",()=>t.innerType._zod.values),H(e._zod,"pattern",()=>t.innerType._zod.pattern),e._zod.parse=(n,r)=>t.innerType._zod.run(n,r)}),qf=w("$ZodNullable",(e,t)=>{ie.init(e,t),H(e._zod,"optin",()=>t.innerType._zod.optin),H(e._zod,"optout",()=>t.innerType._zod.optout),H(e._zod,"pattern",()=>{const n=t.innerType._zod.pattern;return n?new RegExp(`^(${Hn(n.source)}|null)$`):void 0}),H(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(n,r)=>n.value===null?n:t.innerType._zod.run(n,r)}),Kf=w("$ZodDefault",(e,t)=>{ie.init(e,t),e._zod.optin="optional",H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);if(n.value===void 0)return n.value=t.defaultValue,n;const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>kr(i,t)):kr(o,t)}});function kr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const Jf=w("$ZodPrefault",(e,t)=>{ie.init(e,t),e._zod.optin="optional",H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>(r.direction==="backward"||n.value===void 0&&(n.value=t.defaultValue),t.innerType._zod.run(n,r))}),Xf=w("$ZodNonOptional",(e,t)=>{ie.init(e,t),H(e._zod,"values",()=>{const n=t.innerType._zod.values;return n?new Set([...n].filter(r=>r!==void 0)):void 0}),e._zod.parse=(n,r)=>{const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>Ir(i,e)):Ir(o,e)}});function Ir(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:"invalid_type",expected:"nonoptional",input:e.value,inst:t}),e}const Gf=w("$ZodCatch",(e,t)=>{ie.init(e,t),e._zod.optin="optional",H(e._zod,"optout",()=>t.innerType._zod.optout),H(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(i=>(n.value=i.value,i.issues.length&&(n.value=t.catchValue({...n,error:{issues:i.issues.map(a=>Xe(a,r,De()))},input:n.value}),n.issues=[],n.fallback=!0),n)):(n.value=o.value,o.issues.length&&(n.value=t.catchValue({...n,error:{issues:o.issues.map(i=>Xe(i,r,De()))},input:n.value}),n.issues=[],n.fallback=!0),n)}}),Yf=w("$ZodPipe",(e,t)=>{ie.init(e,t),H(e._zod,"values",()=>t.in._zod.values),H(e._zod,"optin",()=>t.in._zod.optin),H(e._zod,"optout",()=>t.out._zod.optout),H(e._zod,"propValues",()=>t.in._zod.propValues),e._zod.parse=(n,r)=>{if(r.direction==="backward"){const i=t.out._zod.run(n,r);return i instanceof Promise?i.then(a=>At(a,t.in,r)):At(i,t.in,r)}const o=t.in._zod.run(n,r);return o instanceof Promise?o.then(i=>At(i,t.out,r)):At(o,t.out,r)}});function At(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const Qf=w("$ZodReadonly",(e,t)=>{ie.init(e,t),H(e._zod,"propValues",()=>t.innerType._zod.propValues),H(e._zod,"values",()=>t.innerType._zod.values),H(e._zod,"optin",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optin}),H(e._zod,"optout",()=>{var n,r;return(r=(n=t.innerType)==null?void 0:n._zod)==null?void 0:r.optout}),e._zod.parse=(n,r)=>{if(r.direction==="backward")return t.innerType._zod.run(n,r);const o=t.innerType._zod.run(n,r);return o instanceof Promise?o.then(Nr):Nr(o)}});function Nr(e){return e.value=Object.freeze(e.value),e}const eh=w("$ZodCustom",(e,t)=>{We.init(e,t),ie.init(e,t),e._zod.parse=(n,r)=>n,e._zod.check=n=>{const r=n.value,o=t.fn(r);if(o instanceof Promise)return o.then(i=>Er(i,n,r,e));Er(o,n,r,e)}});function Er(e,t,n,r){if(!e){const o={code:"custom",input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(o.params=r._zod.def.params),t.issues.push(kt(o))}}const th=()=>{const e={string:{unit:"characters",verb:"to have"},file:{unit:"bytes",verb:"to have"},array:{unit:"items",verb:"to have"},set:{unit:"items",verb:"to have"},map:{unit:"entries",verb:"to have"}};function t(o){return e[o]??null}const n={regex:"input",email:"email address",url:"URL",emoji:"emoji",uuid:"UUID",uuidv4:"UUIDv4",uuidv6:"UUIDv6",nanoid:"nanoid",guid:"GUID",cuid:"cuid",cuid2:"cuid2",ulid:"ULID",xid:"XID",ksuid:"KSUID",datetime:"ISO datetime",date:"ISO date",time:"ISO time",duration:"ISO duration",ipv4:"IPv4 address",ipv6:"IPv6 address",mac:"MAC address",cidrv4:"IPv4 range",cidrv6:"IPv6 range",base64:"base64-encoded string",base64url:"base64url-encoded string",json_string:"JSON string",e164:"E.164 number",jwt:"JWT",template_literal:"input"},r={nan:"NaN"};return o=>{switch(o.code){case"invalid_type":{const i=r[o.expected]??o.expected,a=gu(o.input),c=r[a]??a;return`Invalid input: expected ${i}, received ${c}`}case"invalid_value":return o.values.length===1?`Invalid input: expected ${Xo(o.values[0])}`:`Invalid option: expected one of ${xr(o.values,"|")}`;case"too_big":{const i=o.inclusive?"<=":"<",a=t(o.origin);return a?`Too big: expected ${o.origin??"value"} to have ${i}${o.maximum.toString()} ${a.unit??"elements"}`:`Too big: expected ${o.origin??"value"} to be ${i}${o.maximum.toString()}`}case"too_small":{const i=o.inclusive?">=":">",a=t(o.origin);return a?`Too small: expected ${o.origin} to have ${i}${o.minimum.toString()} ${a.unit}`:`Too small: expected ${o.origin} to be ${i}${o.minimum.toString()}`}case"invalid_format":{const i=o;return i.format==="starts_with"?`Invalid string: must start with "${i.prefix}"`:i.format==="ends_with"?`Invalid string: must end with "${i.suffix}"`:i.format==="includes"?`Invalid string: must include "${i.includes}"`:i.format==="regex"?`Invalid string: must match pattern ${i.pattern}`:`Invalid ${n[i.format]??o.format}`}case"not_multiple_of":return`Invalid number: must be a multiple of ${o.divisor}`;case"unrecognized_keys":return`Unrecognized key${o.keys.length>1?"s":""}: ${xr(o.keys,", ")}`;case"invalid_key":return`Invalid key in ${o.origin}`;case"invalid_union":return o.options&&Array.isArray(o.options)&&o.options.length>0?`Invalid discriminator value. Expected ${o.options.map(a=>`'${a}'`).join(" | ")}`:"Invalid input";case"invalid_element":return`Invalid value in ${o.origin}`;default:return"Invalid input"}}};function nh(){return{localeError:th()}}var zr;class rh{constructor(){this._map=new WeakMap,this._idmap=new Map}add(t,...n){const r=n[0];return this._map.set(t,r),r&&typeof r=="object"&&"id"in r&&this._idmap.set(r.id,t),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(t){const n=this._map.get(t);return n&&typeof n=="object"&&"id"in n&&this._idmap.delete(n.id),this._map.delete(t),this}get(t){const n=t._zod.parent;if(n){const r={...this.get(n)??{}};delete r.id;const o={...r,...this._map.get(t)};return Object.keys(o).length?o:void 0}return this._map.get(t)}has(t){return this._map.has(t)}}function ls(){return new rh}(zr=globalThis).__zod_globalRegistry??(zr.__zod_globalRegistry=ls());const pt=globalThis.__zod_globalRegistry;function oh(e,t){return new e({type:"string",...P(t)})}function sh(e,t){return new e({type:"string",format:"email",check:"string_format",abort:!1,...P(t)})}function Pr(e,t){return new e({type:"string",format:"guid",check:"string_format",abort:!1,...P(t)})}function ih(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,...P(t)})}function ah(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v4",...P(t)})}function ch(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v6",...P(t)})}function lh(e,t){return new e({type:"string",format:"uuid",check:"string_format",abort:!1,version:"v7",...P(t)})}function dh(e,t){return new e({type:"string",format:"url",check:"string_format",abort:!1,...P(t)})}function uh(e,t){return new e({type:"string",format:"emoji",check:"string_format",abort:!1,...P(t)})}function fh(e,t){return new e({type:"string",format:"nanoid",check:"string_format",abort:!1,...P(t)})}function hh(e,t){return new e({type:"string",format:"cuid",check:"string_format",abort:!1,...P(t)})}function mh(e,t){return new e({type:"string",format:"cuid2",check:"string_format",abort:!1,...P(t)})}function ph(e,t){return new e({type:"string",format:"ulid",check:"string_format",abort:!1,...P(t)})}function gh(e,t){return new e({type:"string",format:"xid",check:"string_format",abort:!1,...P(t)})}function bh(e,t){return new e({type:"string",format:"ksuid",check:"string_format",abort:!1,...P(t)})}function yh(e,t){return new e({type:"string",format:"ipv4",check:"string_format",abort:!1,...P(t)})}function vh(e,t){return new e({type:"string",format:"ipv6",check:"string_format",abort:!1,...P(t)})}function xh(e,t){return new e({type:"string",format:"cidrv4",check:"string_format",abort:!1,...P(t)})}function wh(e,t){return new e({type:"string",format:"cidrv6",check:"string_format",abort:!1,...P(t)})}function jh(e,t){return new e({type:"string",format:"base64",check:"string_format",abort:!1,...P(t)})}function Sh(e,t){return new e({type:"string",format:"base64url",check:"string_format",abort:!1,...P(t)})}function $h(e,t){return new e({type:"string",format:"e164",check:"string_format",abort:!1,...P(t)})}function Ch(e,t){return new e({type:"string",format:"jwt",check:"string_format",abort:!1,...P(t)})}function _h(e,t){return new e({type:"string",format:"datetime",check:"string_format",offset:!1,local:!1,precision:null,...P(t)})}function Oh(e,t){return new e({type:"string",format:"date",check:"string_format",...P(t)})}function kh(e,t){return new e({type:"string",format:"time",check:"string_format",precision:null,...P(t)})}function Ih(e,t){return new e({type:"string",format:"duration",check:"string_format",...P(t)})}function Nh(e){return new e({type:"unknown"})}function Eh(e,t){return new e({type:"never",...P(t)})}function Jn(e,t){return new Yu({check:"max_length",...P(t),maximum:e})}function It(e,t){return new Qu({check:"min_length",...P(t),minimum:e})}function Xn(e,t){return new ef({check:"length_equals",...P(t),length:e})}function ds(e,t){return new tf({check:"string_format",format:"regex",...P(t),pattern:e})}function us(e){return new nf({check:"string_format",format:"lowercase",...P(e)})}function fs(e){return new rf({check:"string_format",format:"uppercase",...P(e)})}function hs(e,t){return new of({check:"string_format",format:"includes",...P(t),includes:e})}function ms(e,t){return new sf({check:"string_format",format:"starts_with",...P(t),prefix:e})}function ps(e,t){return new af({check:"string_format",format:"ends_with",...P(t),suffix:e})}function at(e){return new cf({check:"overwrite",tx:e})}function gs(e){return at(t=>t.normalize(e))}function bs(){return at(e=>e.trim())}function ys(){return at(e=>e.toLowerCase())}function vs(){return at(e=>e.toUpperCase())}function xs(){return at(e=>ou(e))}function zh(e,t,n){return new e({type:"array",element:t,...P(n)})}function Ph(e,t,n){return new e({type:"custom",check:"custom",fn:t,...P(n)})}function Th(e,t){const n=Rh(r=>(r.addIssue=o=>{if(typeof o=="string")r.issues.push(kt(o,r.value,n._zod.def));else{const i=o;i.fatal&&(i.continue=!1),i.code??(i.code="custom"),i.input??(i.input=r.value),i.inst??(i.inst=n),i.continue??(i.continue=!n._zod.def.abort),r.issues.push(kt(i))}},e(r.value,r)),t);return n}function Rh(e,t){const n=new We({check:"custom",...P(t)});return n._zod.check=e,n}function ws(e){let t=(e==null?void 0:e.target)??"draft-2020-12";return t==="draft-4"&&(t="draft-04"),t==="draft-7"&&(t="draft-07"),{processors:e.processors??{},metadataRegistry:(e==null?void 0:e.metadata)??pt,target:t,unrepresentable:(e==null?void 0:e.unrepresentable)??"throw",override:(e==null?void 0:e.override)??(()=>{}),io:(e==null?void 0:e.io)??"output",counter:0,seen:new Map,cycles:(e==null?void 0:e.cycles)??"ref",reused:(e==null?void 0:e.reused)??"inline",external:(e==null?void 0:e.external)??void 0}}function se(e,t,n={path:[],schemaPath:[]}){var f,h;var r;const o=e._zod.def,i=t.seen.get(e);if(i)return i.count++,n.schemaPath.includes(e)&&(i.cycle=n.path),i.schema;const a={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,a);const c=(h=(f=e._zod).toJSONSchema)==null?void 0:h.call(f);if(c)a.schema=c;else{const m={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,a.schema,m);else{const p=a.schema,b=t.processors[o.type];if(!b)throw new Error(`[toJSONSchema]: Non-representable type encountered: ${o.type}`);b(e,t,p,m)}const g=e._zod.parent;g&&(a.ref||(a.ref=g),se(g,t,m),t.seen.get(g).isParent=!0)}const l=t.metadataRegistry.get(e);return l&&Object.assign(a.schema,l),t.io==="input"&&pe(e)&&(delete a.schema.examples,delete a.schema.default),t.io==="input"&&"_prefault"in a.schema&&((r=a.schema).default??(r.default=a.schema._prefault)),delete a.schema._prefault,t.seen.get(e).schema}function js(e,t){var a,c,l,d;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=new Map;for(const f of e.seen.entries()){const h=(a=e.metadataRegistry.get(f[0]))==null?void 0:a.id;if(h){const m=r.get(h);if(m&&m!==f[0])throw new Error(`Duplicate schema id "${h}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(h,f[0])}}const o=f=>{var b;const h=e.target==="draft-2020-12"?"$defs":"definitions";if(e.external){const y=(b=e.external.registry.get(f[0]))==null?void 0:b.id,x=e.external.uri??(O=>O);if(y)return{ref:x(y)};const v=f[1].defId??f[1].schema.id??`schema${e.counter++}`;return f[1].defId=v,{defId:v,ref:`${x("__shared")}#/${h}/${v}`}}if(f[1]===n)return{ref:"#"};const g=`#/${h}/`,p=f[1].schema.id??`__schema${e.counter++}`;return{defId:p,ref:g+p}},i=f=>{if(f[1].schema.$ref)return;const h=f[1],{ref:m,defId:g}=o(f);h.def={...h.schema},g&&(h.defId=g);const p=h.schema;for(const b in p)delete p[b];p.$ref=m};if(e.cycles==="throw")for(const f of e.seen.entries()){const h=f[1];if(h.cycle)throw new Error(`Cycle detected: #/${(c=h.cycle)==null?void 0:c.join("/")}/<root>
108
+
109
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(const f of e.seen.entries()){const h=f[1];if(t===f[0]){i(f);continue}if(e.external){const g=(l=e.external.registry.get(f[0]))==null?void 0:l.id;if(t!==f[0]&&g){i(f);continue}}if((d=e.metadataRegistry.get(f[0]))==null?void 0:d.id){i(f);continue}if(h.cycle){i(f);continue}if(h.count>1&&e.reused==="ref"){i(f);continue}}}function Ss(e,t){var c,l,d,f;const n=e.seen.get(t);if(!n)throw new Error("Unprocessed schema. This is a bug in Zod.");const r=h=>{const m=e.seen.get(h);if(m.ref===null)return;const g=m.def??m.schema,p={...g},b=m.ref;if(m.ref=null,b){r(b);const x=e.seen.get(b),v=x.schema;if(v.$ref&&(e.target==="draft-07"||e.target==="draft-04"||e.target==="openapi-3.0")?(g.allOf=g.allOf??[],g.allOf.push(v)):Object.assign(g,v),Object.assign(g,p),h._zod.parent===b)for(const $ in g)$==="$ref"||$==="allOf"||$ in p||delete g[$];if(v.$ref&&x.def)for(const $ in g)$==="$ref"||$==="allOf"||$ in x.def&&JSON.stringify(g[$])===JSON.stringify(x.def[$])&&delete g[$]}const y=h._zod.parent;if(y&&y!==b){r(y);const x=e.seen.get(y);if(x!=null&&x.schema.$ref&&(g.$ref=x.schema.$ref,x.def))for(const v in g)v==="$ref"||v==="allOf"||v in x.def&&JSON.stringify(g[v])===JSON.stringify(x.def[v])&&delete g[v]}e.override({zodSchema:h,jsonSchema:g,path:m.path??[]})};for(const h of[...e.seen.entries()].reverse())r(h[0]);const o={};if(e.target==="draft-2020-12"?o.$schema="https://json-schema.org/draft/2020-12/schema":e.target==="draft-07"?o.$schema="http://json-schema.org/draft-07/schema#":e.target==="draft-04"?o.$schema="http://json-schema.org/draft-04/schema#":e.target,(c=e.external)!=null&&c.uri){const h=(l=e.external.registry.get(t))==null?void 0:l.id;if(!h)throw new Error("Schema is missing an `id` property");o.$id=e.external.uri(h)}Object.assign(o,n.def??n.schema);const i=(d=e.metadataRegistry.get(t))==null?void 0:d.id;i!==void 0&&o.id===i&&delete o.id;const a=((f=e.external)==null?void 0:f.defs)??{};for(const h of e.seen.entries()){const m=h[1];m.def&&m.defId&&(m.def.id===m.defId&&delete m.def.id,a[m.defId]=m.def)}e.external||Object.keys(a).length>0&&(e.target==="draft-2020-12"?o.$defs=a:o.definitions=a);try{const h=JSON.parse(JSON.stringify(o));return Object.defineProperty(h,"~standard",{value:{...t["~standard"],jsonSchema:{input:Xt(t,"input",e.processors),output:Xt(t,"output",e.processors)}},enumerable:!1,writable:!1}),h}catch{throw new Error("Error converting schema to JSON.")}}function pe(e,t){const n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);const r=e._zod.def;if(r.type==="transform")return!0;if(r.type==="array")return pe(r.element,n);if(r.type==="set")return pe(r.valueType,n);if(r.type==="lazy")return pe(r.getter(),n);if(r.type==="promise"||r.type==="optional"||r.type==="nonoptional"||r.type==="nullable"||r.type==="readonly"||r.type==="default"||r.type==="prefault")return pe(r.innerType,n);if(r.type==="intersection")return pe(r.left,n)||pe(r.right,n);if(r.type==="record"||r.type==="map")return pe(r.keyType,n)||pe(r.valueType,n);if(r.type==="pipe")return e._zod.traits.has("$ZodCodec")?!0:pe(r.in,n)||pe(r.out,n);if(r.type==="object"){for(const o in r.shape)if(pe(r.shape[o],n))return!0;return!1}if(r.type==="union"){for(const o of r.options)if(pe(o,n))return!0;return!1}if(r.type==="tuple"){for(const o of r.items)if(pe(o,n))return!0;return!!(r.rest&&pe(r.rest,n))}return!1}const Ah=(e,t={})=>n=>{const r=ws({...n,processors:t});return se(e,r),js(r,e),Ss(r,e)},Xt=(e,t,n={})=>r=>{const{libraryOptions:o,target:i}=r??{},a=ws({...o??{},target:i,io:t,processors:n});return se(e,a),js(a,e),Ss(a,e)},Dh={guid:"uuid",url:"uri",datetime:"date-time",json_string:"json-string",regex:""},Mh=(e,t,n,r)=>{const o=n;o.type="string";const{minimum:i,maximum:a,format:c,patterns:l,contentEncoding:d}=e._zod.bag;if(typeof i=="number"&&(o.minLength=i),typeof a=="number"&&(o.maxLength=a),c&&(o.format=Dh[c]??c,o.format===""&&delete o.format,c==="time"&&delete o.format),d&&(o.contentEncoding=d),l&&l.size>0){const f=[...l];f.length===1?o.pattern=f[0].source:f.length>1&&(o.allOf=[...f.map(h=>({...t.target==="draft-07"||t.target==="draft-04"||t.target==="openapi-3.0"?{type:"string"}:{},pattern:h.source}))])}},Zh=(e,t,n,r)=>{n.not={}},Lh=(e,t,n,r)=>{},Fh=(e,t,n,r)=>{const o=e._zod.def,i=qo(o.entries);i.every(a=>typeof a=="number")&&(n.type="number"),i.every(a=>typeof a=="string")&&(n.type="string"),n.enum=i},Bh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Custom types cannot be represented in JSON Schema")},Uh=(e,t,n,r)=>{if(t.unrepresentable==="throw")throw new Error("Transforms cannot be represented in JSON Schema")},Hh=(e,t,n,r)=>{const o=n,i=e._zod.def,{minimum:a,maximum:c}=e._zod.bag;typeof a=="number"&&(o.minItems=a),typeof c=="number"&&(o.maxItems=c),o.type="array",o.items=se(i.element,t,{...r,path:[...r.path,"items"]})},Vh=(e,t,n,r)=>{var d;const o=n,i=e._zod.def;o.type="object",o.properties={};const a=i.shape;for(const f in a)o.properties[f]=se(a[f],t,{...r,path:[...r.path,"properties",f]});const c=new Set(Object.keys(a)),l=new Set([...c].filter(f=>{const h=i.shape[f]._zod;return t.io==="input"?h.optin===void 0:h.optout===void 0}));l.size>0&&(o.required=Array.from(l)),((d=i.catchall)==null?void 0:d._zod.def.type)==="never"?o.additionalProperties=!1:i.catchall?i.catchall&&(o.additionalProperties=se(i.catchall,t,{...r,path:[...r.path,"additionalProperties"]})):t.io==="output"&&(o.additionalProperties=!1)},Wh=(e,t,n,r)=>{const o=e._zod.def,i=o.inclusive===!1,a=o.options.map((c,l)=>se(c,t,{...r,path:[...r.path,i?"oneOf":"anyOf",l]}));i?n.oneOf=a:n.anyOf=a},qh=(e,t,n,r)=>{const o=e._zod.def,i=se(o.left,t,{...r,path:[...r.path,"allOf",0]}),a=se(o.right,t,{...r,path:[...r.path,"allOf",1]}),c=d=>"allOf"in d&&Object.keys(d).length===1,l=[...c(i)?i.allOf:[i],...c(a)?a.allOf:[a]];n.allOf=l},Kh=(e,t,n,r)=>{const o=n,i=e._zod.def;o.type="object";const a=i.keyType,c=a._zod.bag,l=c==null?void 0:c.patterns;if(i.mode==="loose"&&l&&l.size>0){const f=se(i.valueType,t,{...r,path:[...r.path,"patternProperties","*"]});o.patternProperties={};for(const h of l)o.patternProperties[h.source]=f}else(t.target==="draft-07"||t.target==="draft-2020-12")&&(o.propertyNames=se(i.keyType,t,{...r,path:[...r.path,"propertyNames"]})),o.additionalProperties=se(i.valueType,t,{...r,path:[...r.path,"additionalProperties"]});const d=a._zod.values;if(d){const f=[...d].filter(h=>typeof h=="string"||typeof h=="number");f.length>0&&(o.required=f)}},Jh=(e,t,n,r)=>{const o=e._zod.def,i=se(o.innerType,t,r),a=t.seen.get(e);t.target==="openapi-3.0"?(a.ref=o.innerType,n.nullable=!0):n.anyOf=[i,{type:"null"}]},Xh=(e,t,n,r)=>{const o=e._zod.def;se(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Gh=(e,t,n,r)=>{const o=e._zod.def;se(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.default=JSON.parse(JSON.stringify(o.defaultValue))},Yh=(e,t,n,r)=>{const o=e._zod.def;se(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,t.io==="input"&&(n._prefault=JSON.parse(JSON.stringify(o.defaultValue)))},Qh=(e,t,n,r)=>{const o=e._zod.def;se(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType;let a;try{a=o.catchValue(void 0)}catch{throw new Error("Dynamic catch values are not supported in JSON Schema")}n.default=a},em=(e,t,n,r)=>{const o=e._zod.def,i=o.in._zod.traits.has("$ZodTransform"),a=t.io==="input"?i?o.out:o.in:o.out;se(a,t,r);const c=t.seen.get(e);c.ref=a},tm=(e,t,n,r)=>{const o=e._zod.def;se(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType,n.readOnly=!0},$s=(e,t,n,r)=>{const o=e._zod.def;se(o.innerType,t,r);const i=t.seen.get(e);i.ref=o.innerType},Cs=w("ZodISODateTime",(e,t)=>{jf.init(e,t),Y.init(e,t)});function nm(e){return _h(Cs,e)}const _s=w("ZodISODate",(e,t)=>{Sf.init(e,t),Y.init(e,t)});function rm(e){return Oh(_s,e)}const Os=w("ZodISOTime",(e,t)=>{$f.init(e,t),Y.init(e,t)});function om(e){return kh(Os,e)}const ks=w("ZodISODuration",(e,t)=>{Cf.init(e,t),Y.init(e,t)});function sm(e){return Ih(ks,e)}const im=(e,t)=>{Yo.init(e,t),e.name="ZodError",Object.defineProperties(e,{format:{value:n=>ts(e,n)},flatten:{value:n=>es(e,n)},addIssue:{value:n=>{e.issues.push(n),e.message=JSON.stringify(e.issues,jn,2)}},addIssues:{value:n=>{e.issues.push(...n),e.message=JSON.stringify(e.issues,jn,2)}},isEmpty:{get(){return e.issues.length===0}}})},Ce=w("ZodError",im,{Parent:Error}),Is=Wn(Ce),Ns=qn(Ce),Es=nn(Ce),zs=rn(Ce),Ps=vu(Ce),Ts=xu(Ce),Rs=wu(Ce),As=ju(Ce),Ds=Su(Ce),Ms=$u(Ce),Zs=Cu(Ce),Ls=_u(Ce),Tr=new WeakMap;function sn(e,t,n){const r=Object.getPrototypeOf(e);let o=Tr.get(r);if(o||(o=new Set,Tr.set(r,o)),!o.has(t)){o.add(t);for(const i in n){const a=n[i];Object.defineProperty(r,i,{configurable:!0,enumerable:!1,get(){const c=a.bind(this);return Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c}),c},set(c){Object.defineProperty(this,i,{configurable:!0,writable:!0,enumerable:!0,value:c})}})}}}const re=w("ZodType",(e,t)=>(ie.init(e,t),Object.assign(e["~standard"],{jsonSchema:{input:Xt(e,"input"),output:Xt(e,"output")}}),e.toJSONSchema=Ah(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(n,r)=>Is(e,n,r,{callee:e.parse}),e.safeParse=(n,r)=>Es(e,n,r),e.parseAsync=async(n,r)=>Ns(e,n,r,{callee:e.parseAsync}),e.safeParseAsync=async(n,r)=>zs(e,n,r),e.spa=e.safeParseAsync,e.encode=(n,r)=>Ps(e,n,r),e.decode=(n,r)=>Ts(e,n,r),e.encodeAsync=async(n,r)=>Rs(e,n,r),e.decodeAsync=async(n,r)=>As(e,n,r),e.safeEncode=(n,r)=>Ds(e,n,r),e.safeDecode=(n,r)=>Ms(e,n,r),e.safeEncodeAsync=async(n,r)=>Zs(e,n,r),e.safeDecodeAsync=async(n,r)=>Ls(e,n,r),sn(e,"ZodType",{check(...n){const r=this.def;return this.clone(ot(r,{checks:[...r.checks??[],...n.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]}),{parent:!0})},with(...n){return this.check(...n)},clone(n,r){return Ye(this,n,r)},brand(){return this},register(n,r){return n.add(this,r),this},refine(n,r){return this.check(Ni(n,r))},superRefine(n,r){return this.check(Ei(n,r))},overwrite(n){return this.check(at(n))},optional(){return On(this)},exactOptional(){return bi(this)},nullable(){return kn(this)},nullish(){return On(kn(this))},nonoptional(n){return Si(this,n)},array(){return ve(this)},or(n){return ui([this,n])},and(n){return hi(this,n)},transform(n){return In(this,pi(n))},default(n){return xi(this,n)},prefault(n){return ji(this,n)},catch(n){return Ci(this,n)},pipe(n){return In(this,n)},readonly(){return ki(this)},describe(n){const r=this.clone();return pt.add(r,{description:n}),r},meta(...n){if(n.length===0)return pt.get(this);const r=this.clone();return pt.add(r,n[0]),r},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(n){return n(this)}}),Object.defineProperty(e,"description",{get(){var n;return(n=pt.get(e))==null?void 0:n.description},configurable:!0}),e)),Gn=w("_ZodString",(e,t)=>{Kn.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Mh(e,r,o);const n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,sn(e,"_ZodString",{regex(...r){return this.check(ds(...r))},includes(...r){return this.check(hs(...r))},startsWith(...r){return this.check(ms(...r))},endsWith(...r){return this.check(ps(...r))},min(...r){return this.check(It(...r))},max(...r){return this.check(Jn(...r))},length(...r){return this.check(Xn(...r))},nonempty(...r){return this.check(It(1,...r))},lowercase(r){return this.check(us(r))},uppercase(r){return this.check(fs(r))},trim(){return this.check(bs())},normalize(...r){return this.check(gs(...r))},toLowerCase(){return this.check(ys())},toUpperCase(){return this.check(vs())},slugify(){return this.check(xs())}})}),Fs=w("ZodString",(e,t)=>{Kn.init(e,t),Gn.init(e,t),e.email=n=>e.check(sh(Bs,n)),e.url=n=>e.check(dh(Us,n)),e.jwt=n=>e.check(Ch(oi,n)),e.emoji=n=>e.check(uh(Hs,n)),e.guid=n=>e.check(Pr($n,n)),e.uuid=n=>e.check(ih(St,n)),e.uuidv4=n=>e.check(ah(St,n)),e.uuidv6=n=>e.check(ch(St,n)),e.uuidv7=n=>e.check(lh(St,n)),e.nanoid=n=>e.check(fh(Vs,n)),e.guid=n=>e.check(Pr($n,n)),e.cuid=n=>e.check(hh(Ws,n)),e.cuid2=n=>e.check(mh(qs,n)),e.ulid=n=>e.check(ph(Ks,n)),e.base64=n=>e.check(jh(ti,n)),e.base64url=n=>e.check(Sh(ni,n)),e.xid=n=>e.check(gh(Js,n)),e.ksuid=n=>e.check(bh(Xs,n)),e.ipv4=n=>e.check(yh(Gs,n)),e.ipv6=n=>e.check(vh(Ys,n)),e.cidrv4=n=>e.check(xh(Qs,n)),e.cidrv6=n=>e.check(wh(ei,n)),e.e164=n=>e.check($h(ri,n)),e.datetime=n=>e.check(nm(n)),e.date=n=>e.check(rm(n)),e.time=n=>e.check(om(n)),e.duration=n=>e.check(sm(n))});function oe(e){return oh(Fs,e)}const Y=w("ZodStringFormat",(e,t)=>{G.init(e,t),Gn.init(e,t)}),Bs=w("ZodEmail",(e,t)=>{hf.init(e,t),Y.init(e,t)}),$n=w("ZodGUID",(e,t)=>{uf.init(e,t),Y.init(e,t)}),St=w("ZodUUID",(e,t)=>{ff.init(e,t),Y.init(e,t)}),Us=w("ZodURL",(e,t)=>{mf.init(e,t),Y.init(e,t)}),Hs=w("ZodEmoji",(e,t)=>{pf.init(e,t),Y.init(e,t)}),Vs=w("ZodNanoID",(e,t)=>{gf.init(e,t),Y.init(e,t)}),Ws=w("ZodCUID",(e,t)=>{bf.init(e,t),Y.init(e,t)}),qs=w("ZodCUID2",(e,t)=>{yf.init(e,t),Y.init(e,t)}),Ks=w("ZodULID",(e,t)=>{vf.init(e,t),Y.init(e,t)}),Js=w("ZodXID",(e,t)=>{xf.init(e,t),Y.init(e,t)}),Xs=w("ZodKSUID",(e,t)=>{wf.init(e,t),Y.init(e,t)}),Gs=w("ZodIPv4",(e,t)=>{_f.init(e,t),Y.init(e,t)}),Ys=w("ZodIPv6",(e,t)=>{Of.init(e,t),Y.init(e,t)}),Qs=w("ZodCIDRv4",(e,t)=>{kf.init(e,t),Y.init(e,t)}),ei=w("ZodCIDRv6",(e,t)=>{If.init(e,t),Y.init(e,t)}),ti=w("ZodBase64",(e,t)=>{Nf.init(e,t),Y.init(e,t)}),ni=w("ZodBase64URL",(e,t)=>{zf.init(e,t),Y.init(e,t)}),ri=w("ZodE164",(e,t)=>{Pf.init(e,t),Y.init(e,t)}),oi=w("ZodJWT",(e,t)=>{Rf.init(e,t),Y.init(e,t)}),si=w("ZodUnknown",(e,t)=>{Af.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Lh()});function Cn(){return Nh(si)}const ii=w("ZodNever",(e,t)=>{Df.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Zh(e,n,r)});function ai(e){return Eh(ii,e)}const ci=w("ZodArray",(e,t)=>{Mf.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Hh(e,n,r,o),e.element=t.element,sn(e,"ZodArray",{min(n,r){return this.check(It(n,r))},nonempty(n){return this.check(It(1,n))},max(n,r){return this.check(Jn(n,r))},length(n,r){return this.check(Xn(n,r))},unwrap(){return this.element}})});function ve(e,t){return zh(ci,e,t)}const li=w("ZodObject",(e,t)=>{Lf.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Vh(e,n,r,o),H(e,"shape",()=>t.shape),sn(e,"ZodObject",{keyof(){return Yn(Object.keys(this._zod.def.shape))},catchall(n){return this.clone({...this._zod.def,catchall:n})},passthrough(){return this.clone({...this._zod.def,catchall:Cn()})},loose(){return this.clone({...this._zod.def,catchall:Cn()})},strict(){return this.clone({...this._zod.def,catchall:ai()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(n){return du(this,n)},safeExtend(n){return uu(this,n)},merge(n){return fu(this,n)},pick(n){return cu(this,n)},omit(n){return lu(this,n)},partial(...n){return hu(er,this,n[0])},required(...n){return mu(tr,this,n[0])}})});function He(e,t){const n={type:"object",shape:e??{},...P(t)};return new li(n)}const di=w("ZodUnion",(e,t)=>{Ff.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Wh(e,n,r,o),e.options=t.options});function ui(e,t){return new di({type:"union",options:e,...P(t)})}const fi=w("ZodIntersection",(e,t)=>{Bf.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>qh(e,n,r,o)});function hi(e,t){return new fi({type:"intersection",left:e,right:t})}const _n=w("ZodRecord",(e,t)=>{Uf.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Kh(e,n,r,o),e.keyType=t.keyType,e.valueType=t.valueType});function an(e,t,n){return!t||!t._zod?new _n({type:"record",keyType:oe(),valueType:e,...P(t)}):new _n({type:"record",keyType:e,valueType:t,...P(n)})}const Nt=w("ZodEnum",(e,t)=>{Hf.init(e,t),re.init(e,t),e._zod.processJSONSchema=(r,o,i)=>Fh(e,r,o),e.enum=t.entries,e.options=Object.values(t.entries);const n=new Set(Object.keys(t.entries));e.extract=(r,o)=>{const i={};for(const a of r)if(n.has(a))i[a]=t.entries[a];else throw new Error(`Key ${a} not found in enum`);return new Nt({...t,checks:[],...P(o),entries:i})},e.exclude=(r,o)=>{const i={...t.entries};for(const a of r)if(n.has(a))delete i[a];else throw new Error(`Key ${a} not found in enum`);return new Nt({...t,checks:[],...P(o),entries:i})}});function Yn(e,t){const n=Array.isArray(e)?Object.fromEntries(e.map(r=>[r,r])):e;return new Nt({type:"enum",entries:n,...P(t)})}function Qn(e,t){return new Nt({type:"enum",entries:e,...P(t)})}const mi=w("ZodTransform",(e,t)=>{Vf.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Uh(e,n),e._zod.parse=(n,r)=>{if(r.direction==="backward")throw new Wo(e.constructor.name);n.addIssue=i=>{if(typeof i=="string")n.issues.push(kt(i,n.value,t));else{const a=i;a.fatal&&(a.continue=!1),a.code??(a.code="custom"),a.input??(a.input=n.value),a.inst??(a.inst=e),n.issues.push(kt(a))}};const o=t.transform(n.value,n);return o instanceof Promise?o.then(i=>(n.value=i,n.fallback=!0,n)):(n.value=o,n.fallback=!0,n)}});function pi(e){return new mi({type:"transform",transform:e})}const er=w("ZodOptional",(e,t)=>{cs.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$s(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function On(e){return new er({type:"optional",innerType:e})}const gi=w("ZodExactOptional",(e,t)=>{Wf.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>$s(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function bi(e){return new gi({type:"optional",innerType:e})}const yi=w("ZodNullable",(e,t)=>{qf.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Jh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function kn(e){return new yi({type:"nullable",innerType:e})}const vi=w("ZodDefault",(e,t)=>{Kf.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Gh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function xi(e,t){return new vi({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Jo(t)}})}const wi=w("ZodPrefault",(e,t)=>{Jf.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Yh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ji(e,t){return new wi({type:"prefault",innerType:e,get defaultValue(){return typeof t=="function"?t():Jo(t)}})}const tr=w("ZodNonOptional",(e,t)=>{Xf.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Xh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function Si(e,t){return new tr({type:"nonoptional",innerType:e,...P(t)})}const $i=w("ZodCatch",(e,t)=>{Gf.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Qh(e,n,r,o),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Ci(e,t){return new $i({type:"catch",innerType:e,catchValue:typeof t=="function"?t:()=>t})}const _i=w("ZodPipe",(e,t)=>{Yf.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>em(e,n,r,o),e.in=t.in,e.out=t.out});function In(e,t){return new _i({type:"pipe",in:e,out:t})}const Oi=w("ZodReadonly",(e,t)=>{Qf.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>tm(e,n,r,o),e.unwrap=()=>e._zod.def.innerType});function ki(e){return new Oi({type:"readonly",innerType:e})}const Ii=w("ZodCustom",(e,t)=>{eh.init(e,t),re.init(e,t),e._zod.processJSONSchema=(n,r,o)=>Bh(e,n)});function Ni(e,t={}){return Ph(Ii,e,t)}function Ei(e,t){return Th(e,t)}De(nh());const am=Object.freeze(Object.defineProperty({__proto__:null,ZodArray:ci,ZodBase64:ti,ZodBase64URL:ni,ZodCIDRv4:Qs,ZodCIDRv6:ei,ZodCUID:Ws,ZodCUID2:qs,ZodCatch:$i,ZodCustom:Ii,ZodDefault:vi,ZodE164:ri,ZodEmail:Bs,ZodEmoji:Hs,ZodEnum:Nt,ZodExactOptional:gi,ZodGUID:$n,ZodIPv4:Gs,ZodIPv6:Ys,ZodISODate:_s,ZodISODateTime:Cs,ZodISODuration:ks,ZodISOTime:Os,ZodIntersection:fi,ZodJWT:oi,ZodKSUID:Xs,ZodNanoID:Vs,ZodNever:ii,ZodNonOptional:tr,ZodNullable:yi,ZodObject:li,ZodOptional:er,ZodPipe:_i,ZodPrefault:wi,ZodReadonly:Oi,ZodRealError:Ce,ZodRecord:_n,ZodString:Fs,ZodStringFormat:Y,ZodTransform:mi,ZodType:re,ZodULID:Ks,ZodURL:Us,ZodUUID:St,ZodUnion:di,ZodUnknown:si,ZodXID:Js,_ZodString:Gn,_default:xi,array:ve,catch:Ci,clone:Ye,config:De,decode:Ts,decodeAsync:As,encode:Ps,encodeAsync:Rs,endsWith:ps,enum:Yn,exactOptional:bi,flattenError:es,formatError:ts,globalRegistry:pt,includes:hs,intersection:hi,length:Xn,lowercase:us,maxLength:Jn,minLength:It,nativeEnum:Qn,never:ai,nonoptional:Si,normalize:gs,nullable:kn,object:He,optional:On,overwrite:at,parse:Is,parseAsync:Ns,pipe:In,prefault:ji,readonly:ki,record:an,refine:Ni,regex:ds,registry:ls,safeDecode:Ms,safeDecodeAsync:Ls,safeEncode:Ds,safeEncodeAsync:Zs,safeParse:Es,safeParseAsync:zs,slugify:xs,startsWith:ms,string:oe,superRefine:Ei,toLowerCase:ys,toUpperCase:vs,transform:pi,trim:bs,union:ui,unknown:Cn,uppercase:fs},Symbol.toStringTag,{value:"Module"}));nu(am);var ke=(e=>(e.SUPER_ADMIN="super_admin",e.CUSTOMER_SERVICE="customer_service",e.USER="user",e))(ke||{}),je=(e=>(e.USER_VIEW="user:view",e.USER_CREATE="user:create",e.USER_EDIT="user:edit",e.USER_DELETE="user:delete",e.CONTENT_VIEW="content:view",e.CONTENT_CREATE="content:create",e.CONTENT_EDIT="content:edit",e.CONTENT_DELETE="content:delete",e.SYSTEM_SETTINGS="system:settings",e.SYSTEM_LOGS="system:logs",e.SYSTEM_MONITOR="system:monitor",e.DATA_EXPORT="data:export",e.DATA_IMPORT="data:import",e.ORDER_VIEW="order:view",e.ORDER_CREATE="order:create",e.ORDER_EDIT="order:edit",e.ORDER_DELETE="order:delete",e.ORDER_PROCESS="order:process",e.TICKET_VIEW="ticket:view",e.TICKET_CREATE="ticket:create",e.TICKET_EDIT="ticket:edit",e.TICKET_DELETE="ticket:delete",e.TICKET_REPLY="ticket:reply",e.TICKET_CLOSE="ticket:close",e.DISPUTE_VIEW="dispute:view",e.DISPUTE_CREATE="dispute:create",e.DISPUTE_EDIT="dispute:edit",e.DISPUTE_DELETE="dispute:delete",e.DISPUTE_RESOLVE="dispute:resolve",e.NOTIFICATION_VIEW="notification:view",e.NOTIFICATION_CREATE="notification:create",e.NOTIFICATION_EDIT="notification:edit",e.NOTIFICATION_DELETE="notification:delete",e.TODO_VIEW="todo:view",e.TODO_CREATE="todo:create",e.TODO_EDIT="todo:edit",e.TODO_DELETE="todo:delete",e.TODO_FILE_UPLOAD="todo:file_upload",e.TODO_FILE_DELETE="todo:file_delete",e.CHAT_VIEW="chat:view",e.CHAT_SEND="chat:send",e.ROLE_VIEW="role:view",e.ROLE_CREATE="role:create",e.ROLE_EDIT="role:edit",e.ROLE_DELETE="role:delete",e))(je||{});Object.values(je);function cm(e,t){return e.includes(t)}function lm(e,t){return t.some(n=>e.includes(n))}function dm(e,t){return t.every(n=>e.includes(n))}const cn=Qn(ke),Ve=Qn(je);He({role:cn,label:oe(),permissions:ve(Ve)});He({permission:Ve,label:oe(),category:oe()});He({userId:oe(),role:cn,permissions:ve(Ve)});const um=He({path:oe(),label:oe(),icon:oe(),permissions:ve(Ve),children:ve(He({path:oe(),label:oe(),icon:oe(),permissions:ve(Ve)})).nullish()}),fm=He({key:oe(),label:oe(),permissions:ve(Ve),mode:Yn(["all","any"])}),hm=He({path:oe(),label:oe(),requiredPermissions:ve(Ve),actions:ve(fm)}),mm=He({label:oe(),permissions:ve(Ve)}),pm=ve(um),gm=ve(hm);an(oe(),mm);an(cn,oe());an(Ve,oe());He({permissions:ve(Ve),menuConfig:pm,pagePermissions:gm,role:cn});const Gt=Et(e=>({permissions:[],role:null,roles:[],allPermissions:[],menuConfig:[],pagePermissions:[],loading:!1,initialized:!1,initPermissions:async()=>{const{isAuthenticated:t,user:n}=xt.getState();if(!t||!n){e({permissions:[],role:null,menuConfig:[],pagePermissions:[],initialized:!0});return}try{e({loading:!0});const o=await(await A.api.permissions.init.$get()).json();o.success&&e({permissions:o.data.permissions,role:o.data.role,menuConfig:o.data.menuConfig,pagePermissions:o.data.pagePermissions,loading:!1,initialized:!0})}catch(r){console.error("Failed to fetch user permissions:",r);const{user:o}=xt.getState();e({role:(o==null?void 0:o.role)??null,permissions:[],loading:!1,initialized:!0})}},fetchStaticData:async()=>{try{const[t,n]=await Promise.all([A.api.permissions.roles.$get(),A.api.permissions.$get()]),r=await t.json(),o=await n.json();r.success&&e({roles:r.data}),o.success&&e({allPermissions:o.data})}catch(t){console.error("Failed to fetch static data:",t)}},reset:()=>{e({permissions:[],role:null,menuConfig:[],pagePermissions:[],initialized:!1})}}));function ln(){const e=Gt(),{permissions:t,initPermissions:n}=e;return{...e,refreshPermissions:n,hasPermission:r=>cm(t,r),hasAnyPermission:r=>lm(t,r),hasAllPermissions:r=>dm(t,r)}}const xt=Et()(Ba(e=>({user:null,token:null,isAuthenticated:!1,stats:null,loading:!1,error:null,login:async(t,n)=>{e({loading:!0});try{const o=await(await A.api.admin.login.$post({json:{username:t,password:n}})).json();if(o.success)return e({user:o.data.user,token:o.data.token,isAuthenticated:!0,loading:!1}),Gt.getState().initPermissions(),o.data;throw new Error(o.error||"Login failed")}catch(r){throw e({loading:!1}),r}},logout:()=>{e({user:null,token:null,isAuthenticated:!1,stats:null}),Gt.getState().reset()},fetchStats:async()=>{try{const n=await(await A.api.admin.stats.$get()).json();n.success&&e({stats:n.data})}catch(t){console.error("Failed to fetch stats:",t),e({error:t instanceof Error?t.message:"Failed to fetch stats"})}},setUser:t=>e({user:t}),setToken:t=>e({token:t}),clearError:()=>e({error:null})}),{name:"admin-storage",partialize:e=>({user:e.user,token:e.token,isAuthenticated:e.isAuthenticated})}));function bm(){const[e,t]=u.useState("closed"),[n,r]=u.useState([]),[o,i]=u.useState(0),a=u.useRef(null),c=u.useCallback(p=>{p.type==="error"?wn.error({message:p.title,description:p.message,placement:"topRight",duration:0}):p.type==="warning"&&wn.warning({message:p.title,description:p.message,placement:"topRight",duration:4.5})},[]),l=u.useCallback(async()=>{try{const b=await(await A.api.admin.notifications.$get({query:{limit:"20"}})).json();b.success&&r(b.data)}catch(p){console.error("Failed to fetch notifications:",p)}},[]),d=u.useCallback(async()=>{try{const b=await(await A.api.admin.notifications["unread-count"].$get()).json();b.success&&i(b.data.count)}catch(p){console.error("Failed to fetch unread count:",p)}},[]),f=u.useCallback(async()=>{if(!a.current){t("connecting");try{const p=A.api.admin.notifications.stream.$sse();a.current=p,p.onStatusChange(b=>{t(b)}),p.on("connected",()=>{l(),d()}),p.on("notification",b=>{r(y=>[b,...y]),i(y=>y+1),c(b)}),p.on("unread-count",b=>{i(b.count)}),t(p.status)}catch(p){console.error("Failed to connect SSE:",p),t("closed")}}},[l,d,c]),h=u.useCallback(()=>{a.current&&(a.current.abort(),a.current=null,t("closed"))},[]),m=u.useCallback(async p=>{try{(await(await A.api.admin.notifications[":id"].read.$put({param:{id:p}})).json()).success&&(r(x=>x.map(v=>v.id===p?{...v,read:!0}:v)),i(x=>Math.max(0,x-1)))}catch(b){console.error("Failed to mark notification as read:",b)}},[]),g=u.useCallback(async()=>{try{(await(await A.api.admin.notifications["read-all"].$put()).json()).success&&(r(y=>y.map(x=>({...x,read:!0}))),i(0))}catch(p){console.error("Failed to mark all notifications as read:",p)}},[]);return u.useEffect(()=>()=>{h()},[h]),{status:e,notifications:n,unreadCount:o,connect:f,disconnect:h,markAsRead:m,markAllAsRead:g,fetchNotifications:l}}const ym={info:{color:"#1890ff",bgColor:"#e6f7ff",icon:s.jsx(Wa,{className:"w-4 h-4"})},warning:{color:"#faad14",bgColor:"#fffbe6",icon:s.jsx(vn,{className:"w-4 h-4"})},error:{color:"#ff4d4f",bgColor:"#fff2f0",icon:s.jsx(go,{className:"w-4 h-4"})},success:{color:"#52c41a",bgColor:"#f6ffed",icon:s.jsx(tt,{className:"w-4 h-4"})}};function vm(e){const t=new Date(e),r=new Date().getTime()-t.getTime(),o=Math.floor(r/6e4),i=Math.floor(r/36e5),a=Math.floor(r/864e5);return o<1?"刚刚":o<60?`${o}分钟前`:i<24?`${i}小时前`:a<7?`${a}天前`:t.toLocaleDateString("zh-CN")}const xm=({open:e,onClose:t,notifications:n,unreadCount:r,onMarkAsRead:o,onMarkAllAsRead:i,loading:a})=>{const c=h=>{const m=ym[h.type];return s.jsx("div",{className:`p-4 border-b border-gray-100 hover:bg-gray-50 cursor-pointer transition-colors ${h.read?"":"bg-blue-50/50"}`,onClick:()=>!h.read&&o(h.id),children:s.jsxs("div",{className:"flex items-start gap-3",children:[s.jsx("div",{className:"flex-shrink-0 w-10 h-10 rounded-full flex items-center justify-center",style:{backgroundColor:m.bgColor,color:m.color},children:m.icon}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"font-medium text-gray-900 truncate",children:h.title}),!h.read&&s.jsx("span",{className:"w-2 h-2 rounded-full bg-blue-500 flex-shrink-0"})]}),s.jsx("p",{className:"text-sm text-gray-500 mt-1 line-clamp-2",children:h.message}),s.jsx("span",{className:"text-xs text-gray-400 mt-1 block",children:vm(h.createdAt)})]})]})},h.id)},l=n.filter(h=>!h.read),d=n.filter(h=>h.read),f=[{key:"all",label:`全部 (${n.length})`,children:s.jsx("div",{className:"overflow-y-auto",style:{maxHeight:"calc(100vh - 200px)"},children:a?s.jsx("div",{className:"flex items-center justify-center py-12",children:s.jsx(Rn,{})}):n.length===0?s.jsx(dt,{image:dt.PRESENTED_IMAGE_SIMPLE,description:"暂无通知",className:"py-12"}):n.map(c)})},{key:"unread",label:`未读 (${l.length})`,children:s.jsx("div",{className:"overflow-y-auto",style:{maxHeight:"calc(100vh - 200px)"},children:l.length===0?s.jsx(dt,{image:dt.PRESENTED_IMAGE_SIMPLE,description:"暂无未读通知",className:"py-12"}):l.map(c)})},{key:"read",label:`已读 (${d.length})`,children:s.jsx("div",{className:"overflow-y-auto",style:{maxHeight:"calc(100vh - 200px)"},children:d.length===0?s.jsx(dt,{image:dt.PRESENTED_IMAGE_SIMPLE,description:"暂无已读通知",className:"py-12"}):d.map(c)})}];return s.jsx(Do,{title:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("span",{children:"通知中心"}),r>0&&s.jsx(R,{type:"link",size:"small",icon:s.jsx(Va,{className:"w-4 h-4"}),onClick:i,className:"text-xs",children:"全部已读"})]}),placement:"right",onClose:t,open:e,width:400,styles:{header:{borderBottom:"1px solid #f0f0f0"},body:{padding:0}},children:s.jsx(An,{defaultActiveKey:"all",items:f,className:"px-4"})})},wm=({unreadCount:e,onClick:t})=>s.jsxs("button",{className:"p-2 rounded-lg hover:bg-gray-100 transition-colors relative",onClick:t,children:[s.jsx(po,{className:"w-5 h-5 text-gray-600"}),e>0&&s.jsx(_o,{count:e>99?"99+":e,size:"small",style:{position:"absolute",top:-2,right:-2,minWidth:18,height:18,fontSize:10,lineHeight:"18px"}})]}),Rr=[{username:"superadmin",password:"123456",role:ke.SUPER_ADMIN,label:"超级管理员",color:"red"},{username:"customerservice",password:"123456",role:ke.CUSTOMER_SERVICE,label:"客服人员",color:"blue"},{username:"user1",password:"123456",role:ke.USER,label:"普通用户",color:"green"}],jm=()=>{const[e,t]=u.useState(!1),{user:n,login:r,logout:o}=xt(),{refreshPermissions:i}=ln(),a=async d=>{if((n==null?void 0:n.username)===d.username){N.info("已经是当前账号");return}t(!0);try{await o(),await r(d.username,d.password),await i(),N.success(`已切换到 ${d.label}`),window.location.reload()}catch(f){N.error("切换账号失败"),console.error("Switch account error:",f)}finally{t(!1)}},c=n==null?void 0:n.role,l=Rr.find(d=>d.role===c);return s.jsx(co,{menu:{items:Rr.map(d=>({key:d.username,label:s.jsxs("div",{className:"flex items-center justify-between w-full",children:[s.jsx("span",{children:d.label}),(n==null?void 0:n.username)===d.username&&s.jsx(U,{color:"success",className:"ml-2",children:"当前"})]}),icon:s.jsx(Bt,{className:"w-4 h-4"}),onClick:()=>a(d)}))},trigger:["click"],children:s.jsxs(R,{type:"text",className:"flex items-center gap-2 text-white hover:bg-gray-700",loading:e,children:[s.jsx(Bt,{className:"w-4 h-4"}),s.jsxs(Se,{children:[s.jsx("span",{children:n==null?void 0:n.username}),s.jsx(U,{color:l==null?void 0:l.color,children:(l==null?void 0:l.label)||(n==null?void 0:n.role)})]}),s.jsx(fc,{className:"w-3 h-3"})]})})},Sm=[{label:"Super Admin",value:"super_admin"},{label:"Moderator",value:"moderator"},{label:"Operator",value:"operator"}],$m=({collapsed:e,onToggle:t})=>{const n=Nn(),{user:r,logout:o}=xt(),[i,a]=u.useState(!1),{status:c,notifications:l,unreadCount:d,connect:f,markAsRead:h,markAllAsRead:m}=bm();u.useEffect(()=>{c==="closed"&&f()},[c,f]);const g=()=>{o(),n("/login")},p=[{key:"profile",label:"Profile",icon:s.jsx(Bt,{className:"w-4 h-4"})},{key:"settings",label:"Settings",icon:s.jsx(Ua,{className:"w-4 h-4"}),onClick:()=>n("/settings")},{type:"divider"},{key:"logout",label:"Logout",icon:s.jsx(cc,{className:"w-4 h-4"}),danger:!0,onClick:g}],{token:b}=pd.useToken();return s.jsxs(s.Fragment,{children:[s.jsxs(Ct.Header,{className:"flex items-center justify-between px-6 bg-white border-b border-gray-200",style:{paddingInline:24,height:64,lineHeight:"64px",backgroundColor:b.colorBgContainer,borderBottom:`1px solid ${b.colorBorderSecondary}`},"data-testid":"admin-header",children:[s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx("button",{onClick:t,className:"p-2 rounded-lg hover:bg-gray-100 transition-colors cursor-pointer border-none bg-transparent","data-testid":"toggle-sidebar-button",children:e?s.jsx(Aa,{}):s.jsx(Da,{})}),s.jsx(Zn,{items:[{title:"Home"},{title:"Dashboard"}],style:{fontSize:14}})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsx(ne,{size:"small",defaultValue:"super_admin",options:Sm,style:{width:130},"data-testid":"role-switcher"}),s.jsx(wm,{unreadCount:d,onClick:()=>a(!0)}),s.jsx(jm,{}),s.jsx(co,{menu:{items:p},placement:"bottomRight",trigger:["click"],children:s.jsx("button",{className:"flex items-center gap-2 p-1.5 rounded-lg hover:bg-gray-100 transition-colors cursor-pointer border-none bg-transparent",children:s.jsx(Ja,{size:32,src:r==null?void 0:r.avatar,icon:!(r!=null&&r.avatar)&&s.jsx(Bt,{className:"w-4 h-4"})})})})]})]}),s.jsx(xm,{open:i,onClose:()=>a(!1),notifications:l,unreadCount:d,onMarkAsRead:h,onMarkAllAsRead:m,loading:c==="connecting"})]})},Cm=({children:e})=>{const[t,n]=u.useState(!1);return s.jsxs(Ct,{className:"min-h-screen","data-testid":"admin-layout",children:[s.jsx(Vd,{collapsed:t,onCollapse:n}),s.jsxs(Ct,{children:[s.jsx($m,{collapsed:t,onToggle:()=>n(!t)}),s.jsx(Ct.Content,{className:"m-6 p-6 bg-white rounded-lg shadow-sm",style:{minHeight:"calc(100vh - 64px - 48px)"},"data-testid":"admin-main",children:e})]})]})},_m=()=>{const[e,t]=u.useState(null),[n,r]=u.useState(!0),[o,i]=u.useState(!1),[a,c]=u.useState("info");u.useEffect(()=>{(async()=>{try{const m=await(await A.api.admin.stats.$get()).json();m.success?t(m.data):N.error(m.error||"Failed to load stats")}catch(h){console.error("Failed to fetch stats:",h)}finally{r(!1)}})()},[]);const l=async()=>{i(!0);try{(await(await A.api.admin.notifications.test.$post({json:{type:a}})).json()).success?N.success(`测试通知已发送 (${a})`):N.error("发送失败")}catch(f){console.error("Failed to send test notification:",f),N.error("发送失败")}finally{i(!1)}};if(n)return s.jsx("div",{className:"flex items-center justify-center h-64",children:s.jsx("div",{className:"text-gray-500",children:"Loading..."})});const d=[{title:"Total Todos",value:(e==null?void 0:e.totalTodos)||0,icon:tt,color:"bg-blue-500"},{title:"Pending",value:(e==null?void 0:e.pendingTodos)||0,icon:Ut,color:"bg-yellow-500"},{title:"Completed",value:(e==null?void 0:e.completedTodos)||0,icon:Ha,color:"bg-green-500"},{title:"Last Updated",value:(e==null?void 0:e.lastUpdated)||"-",icon:Ga,color:"bg-purple-500"}];return s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-6",children:"Dashboard"}),s.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8",children:d.map((f,h)=>{const m=f.icon;return s.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[s.jsx("div",{className:"flex items-center justify-between mb-4",children:s.jsx("div",{className:`p-3 rounded-lg ${f.color}`,children:s.jsx(m,{className:"w-6 h-6 text-white"})})}),s.jsx("h3",{className:"text-sm font-medium text-gray-500",children:f.title}),s.jsx("p",{className:"text-2xl font-bold text-gray-900 mt-1",children:f.value})]},h)})}),s.jsxs("div",{className:"bg-white rounded-lg shadow-sm p-6",children:[s.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[s.jsx(ec,{className:"w-5 h-5 text-gray-600"}),s.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"测试通知功能"})]}),s.jsx("p",{className:"text-sm text-gray-500 mb-4",children:"发送测试通知到所有已连接的客户端。error 和 warning 类型的通知会弹出 antd notification,info 和 success 类型只会出现在铃铛列表中。"}),s.jsxs("div",{className:"flex items-center gap-4",children:[s.jsx(ne,{value:a,onChange:c,style:{width:120},options:[{value:"info",label:"ℹ️ Info"},{value:"success",label:"✅ Success"},{value:"warning",label:"⚠️ Warning"},{value:"error",label:"❌ Error"}]}),s.jsx(R,{type:"primary",icon:s.jsx(po,{className:"w-4 h-4"}),loading:o,onClick:l,children:"发送测试通知"})]})]})]})},Om=[{username:"superadmin",password:"123456",role:ke.SUPER_ADMIN,label:"超级管理员",color:"red"},{username:"customerservice",password:"123456",role:ke.CUSTOMER_SERVICE,label:"客服人员",color:"blue"},{username:"user1",password:"123456",role:ke.USER,label:"普通用户",color:"green"}],km=()=>{const e=Nn(),[t]=D.useForm(),{login:n,loading:r}=xt(),o=async a=>{try{await n(a.username,a.password),N.success("登录成功!"),e("/dashboard")}catch(c){N.error(c.message||"登录失败!")}},i=async a=>{try{await n(a.username,a.password),N.success(`已以${a.label}身份登录!`),e("/dashboard")}catch(c){N.error(c.message||"登录失败!")}};return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:s.jsxs(W,{className:"w-full max-w-md",title:"管理后台登录",children:[s.jsx(Rn,{spinning:r,children:s.jsxs(D,{form:t,onFinish:o,layout:"vertical","data-testid":"admin-login-form",children:[s.jsx(D.Item,{name:"username",rules:[{required:!0,message:"请输入用户名!"}],children:s.jsx(X,{prefix:s.jsx(lo,{}),placeholder:"用户名",size:"large","data-testid":"admin-login-username"})}),s.jsx(D.Item,{name:"password",rules:[{required:!0,message:"请输入密码!"}],children:s.jsx(X.Password,{prefix:s.jsx(Wt,{}),placeholder:"密码",size:"large","data-testid":"admin-login-password"})}),s.jsx(D.Item,{children:s.jsx(R,{type:"primary",htmlType:"submit",size:"large",block:!0,loading:r,"data-testid":"admin-login-submit",children:"登录"})}),s.jsxs("div",{className:"text-center",children:[s.jsx("span",{className:"text-gray-500",children:"还没有账号? "}),s.jsx(Kr,{to:"/register",className:"text-blue-500 hover:underline",children:"注册"})]})]})}),s.jsx(No,{children:"快速登录"}),s.jsx("div",{className:"space-y-2",children:Om.map(a=>s.jsxs(R,{block:!0,size:"large",onClick:()=>i(a),loading:r,className:"flex items-center justify-between",children:[s.jsx("span",{children:a.label}),s.jsx("span",{className:"text-gray-400 text-sm",children:a.username})]},a.username))})]})})},Im=()=>{const e=Nn(),[t]=D.useForm(),[n,r]=u.useState(!1),o=async i=>{r(!0);try{const c=await(await A.api.admin.register.$post({json:{username:i.username,email:i.email,password:i.password}})).json();c.success?(N.success("Registration successful! Please login."),e("/login")):N.error(c.error||"Registration failed!")}catch(a){N.error(a.message||"Registration failed!")}finally{r(!1)}};return s.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100",children:s.jsx(W,{className:"w-full max-w-md",title:"Admin Registration",children:s.jsx(Rn,{spinning:n,children:s.jsxs(D,{form:t,onFinish:o,layout:"vertical",children:[s.jsx(D.Item,{name:"username",rules:[{required:!0,message:"Please input username!"}],children:s.jsx(X,{prefix:s.jsx(lo,{}),placeholder:"Username",size:"large"})}),s.jsx(D.Item,{name:"email",rules:[{required:!0,type:"email",message:"Please input valid email!"}],children:s.jsx(X,{prefix:s.jsx(Td,{}),placeholder:"Email",size:"large"})}),s.jsx(D.Item,{name:"password",rules:[{required:!0,min:6,message:"Password must be at least 6 characters!"}],children:s.jsx(X.Password,{prefix:s.jsx(Wt,{}),placeholder:"Password",size:"large"})}),s.jsx(D.Item,{name:"confirmPassword",dependencies:["password"],rules:[{required:!0,message:"Please confirm password!"},({getFieldValue:i})=>({validator(a,c){return!c||i("password")===c?Promise.resolve():Promise.reject(new Error("Passwords do not match!"))}})],children:s.jsx(X.Password,{prefix:s.jsx(Wt,{}),placeholder:"Confirm Password",size:"large"})}),s.jsx(D.Item,{children:s.jsx(R,{type:"primary",htmlType:"submit",size:"large",block:!0,loading:n,children:"Register"})}),s.jsxs("div",{className:"text-center",children:[s.jsx("span",{className:"text-gray-500",children:"Already have an account? "}),s.jsx(Kr,{to:"/login",className:"text-blue-500 hover:underline",children:"Login"})]})]})})})})},Nm=()=>{const[e]=D.useForm(),t=()=>{N.success("Settings saved successfully!")};return s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900 mb-6",children:"Settings"}),s.jsx(W,{title:"General Settings",className:"mb-6",children:s.jsxs(D,{form:e,layout:"vertical",children:[s.jsx(D.Item,{label:"Site Name",name:"siteName",children:s.jsx(X,{placeholder:"Enter site name"})}),s.jsx(D.Item,{label:"Site Description",name:"siteDescription",children:s.jsx(X.TextArea,{rows:4,placeholder:"Enter site description"})})]})}),s.jsx(W,{title:"Notification Settings",className:"mb-6",children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:"Email Notifications"}),s.jsx("p",{className:"text-sm text-gray-500",children:"Receive email notifications for important updates"})]}),s.jsx(Vt,{defaultChecked:!0})]}),s.jsx(No,{}),s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("p",{className:"font-medium",children:"Push Notifications"}),s.jsx("p",{className:"text-sm text-gray-500",children:"Receive push notifications in browser"})]}),s.jsx(Vt,{})]})]})}),s.jsx(W,{title:"Security Settings",children:s.jsxs(D,{form:e,layout:"vertical",children:[s.jsx(D.Item,{label:"Current Password",name:"currentPassword",children:s.jsx(X.Password,{placeholder:"Enter current password"})}),s.jsx(D.Item,{label:"New Password",name:"newPassword",children:s.jsx(X.Password,{placeholder:"Enter new password"})}),s.jsx(D.Item,{label:"Confirm New Password",name:"confirmPassword",children:s.jsx(X.Password,{placeholder:"Confirm new password"})}),s.jsx(R,{type:"primary",onClick:t,children:"Save Changes"})]})})]})};function zi(){const[e,t]=u.useState({}),[n,r]=u.useState(!0);return u.useEffect(()=>{(async()=>{try{r(!0);const a=await(await A.api.permissions.categories.$get()).json();a.success&&t(a.data)}catch(i){console.error("Failed to fetch permission categories:",i)}finally{r(!1)}})()},[]),{categories:e,loading:n}}function Pi(){const[e,t]=u.useState({}),[n,r]=u.useState(!0);return u.useEffect(()=>{(async()=>{try{r(!0);const a=await(await A.api.permissions["role-labels"].$get()).json();a.success&&t(a.data)}catch(i){console.error("Failed to fetch role labels:",i)}finally{r(!1)}})()},[]),{roleLabels:e,loading:n}}function Em(){const[e,t]=u.useState({}),[n,r]=u.useState(!0);return u.useEffect(()=>{(async()=>{try{r(!0);const a=await(await A.api.permissions["permission-labels"].$get()).json();a.success&&t(a.data)}catch(i){console.error("Failed to fetch permission labels:",i)}finally{r(!1)}})()},[]),{permissionLabels:e,loading:n}}function zm(){const[e,t]=u.useState([]),[n,r]=u.useState(!0);return u.useEffect(()=>{(async()=>{try{r(!0);const a=await(await A.api.permissions.$get()).json();a.success&&t(a.data)}catch(i){console.error("Failed to fetch permissions:",i)}finally{r(!1)}})()},[]),{permissions:e,loading:n}}const Pm=()=>{const{allPermissions:e,roles:t,loading:n}=ln(),{categories:r}=zi(),{roleLabels:o}=Pi(),{permissionLabels:i}=Em(),a=e.reduce((l,d)=>{const f=d.category;return l[f]||(l[f]=[]),l[f].push(d),l},{}),c=[{title:"权限",dataIndex:"permission",key:"permission",render:l=>i[l]||l},{title:"超级管理员",key:"superAdmin",render:(l,d)=>{const f=t.find(m=>m.role==="super_admin");return(f==null?void 0:f.permissions.includes(d.permission))?s.jsx(U,{color:"green",children:"✓"}):s.jsx(U,{color:"red",children:"✗"})}},{title:"客服人员",key:"customerService",render:(l,d)=>{const f=t.find(m=>m.role==="customer_service");return(f==null?void 0:f.permissions.includes(d.permission))?s.jsx(U,{color:"green",children:"✓"}):s.jsx(U,{color:"red",children:"✗"})}},{title:"普通用户",key:"user",render:(l,d)=>{const f=t.find(m=>m.role==="user");return(f==null?void 0:f.permissions.includes(d.permission))?s.jsx(U,{color:"green",children:"✓"}):s.jsx(U,{color:"red",children:"✗"})}}];return s.jsxs("div",{className:"p-6",children:[s.jsx("h1",{className:"text-2xl font-bold mb-6",children:"权限管理"}),s.jsx(W,{title:"角色列表",className:"mb-6",children:s.jsx("div",{className:"grid grid-cols-3 gap-4",children:t.map(l=>s.jsxs(W,{size:"small",children:[s.jsx("div",{className:"text-lg font-semibold mb-2",children:o[l.role]||l.role}),s.jsxs("div",{className:"text-sm text-gray-500",children:["权限数量: ",l.permissions.length]})]},l.role))})}),s.jsx(W,{title:"权限矩阵",children:Object.entries(a).map(([l,d])=>{var f;return s.jsxs("div",{className:"mb-6",children:[s.jsx("h3",{className:"text-lg font-semibold mb-3",children:((f=r[l])==null?void 0:f.label)||l}),s.jsx(nt,{columns:c,dataSource:d,rowKey:"permission",pagination:!1,loading:n,size:"small"})]},l)})})]})},Tm=Et((e,t)=>({roles:[],loading:!1,error:null,fetchRoles:async()=>{e({loading:!0,error:null});try{const r=await(await A.api.roles.$get()).json();r.success?e({roles:r.data,loading:!1}):e({error:"Failed to fetch roles",loading:!1})}catch(n){e({error:n.message,loading:!1})}},createRole:async n=>{e({loading:!0,error:null});try{const o=await(await A.api.roles.$post({json:n})).json();return o.success?(await t().fetchRoles(),!0):(e({error:o.error||"Failed to create role",loading:!1}),!1)}catch(r){return e({error:r.message,loading:!1}),!1}},updateRole:async(n,r)=>{e({loading:!0,error:null});try{const i=await(await A.api.roles[":id"].$put({param:{id:n},json:r})).json();return i.success?(await t().fetchRoles(),!0):(e({error:i.error||"Failed to update role",loading:!1}),!1)}catch(o){return e({error:o.message,loading:!1}),!1}},deleteRole:async n=>{e({loading:!0,error:null});try{const o=await(await A.api.roles[":id"].$delete({param:{id:n}})).json();return o.success?(await t().fetchRoles(),!0):(e({error:o.error||"Failed to delete role",loading:!1}),!1)}catch(r){return e({error:r.message,loading:!1}),!1}},updateRolePermissions:async(n,r)=>{e({loading:!0,error:null});try{const i=await(await A.api.roles[":id"].permissions.$put({param:{id:n},json:{permissionIds:r}})).json();return i.success?(e({loading:!1}),!0):(e({error:i.error||"Failed to update role permissions",loading:!1}),!1)}catch(o){return e({error:o.message,loading:!1}),!1}}})),Rm=({visible:e,permissions:t,selectedPermissions:n,onOk:r})=>{const[o,i]=u.useState(""),[a,c]=u.useState(null);u.useEffect(()=>{e&&(i(JSON.stringify(n,null,2)),c(null))},[e,n]);const l=()=>{try{const g=JSON.parse(o);i(JSON.stringify(g,null,2)),c(null),N.success("JSON格式化成功")}catch(g){c(`JSON格式错误: ${g.message}`),N.error("JSON格式错误")}},d=()=>{try{const g=JSON.parse(o);if(!Array.isArray(g))return c("配置必须是数组格式"),!1;const p=t.map(y=>y.permission),b=g.filter(y=>!p.includes(y));return b.length>0?(c(`无效的权限: ${b.join(", ")}`),!1):(c(null),!0)}catch(g){return c(`JSON格式错误: ${g.message}`),!1}},f=()=>{if(!d()){N.error("请修复JSON错误后再保存");return}try{const g=JSON.parse(o);r(g)}catch{N.error("保存失败")}},h=g=>{i(JSON.stringify(g,null,2)),c(null),N.success("模板加载成功")},m=[{name:"超级管理员",permissions:t.map(g=>g.permission)},{name:"客服人员",permissions:["user:view","content:view","order:view","order:process","ticket:view","ticket:reply","ticket:close","data:export","system:logs"]},{name:"普通用户",permissions:["content:view","order:view"]},{name:"内容管理员",permissions:["content:view","content:create","content:edit","content:delete"]},{name:"订单管理员",permissions:["order:view","order:process","data:export"]}];return e?s.jsx("div",{children:s.jsx(An,{defaultActiveKey:"json",items:[{key:"json",label:s.jsxs("span",{children:[s.jsx(Uo,{}),"JSON编辑器"]}),children:s.jsxs("div",{children:[s.jsx(Dt,{message:"JSON格式说明",description:'请输入权限代码数组,例如:["user:view", "user:create"]',type:"info",showIcon:!0,style:{marginBottom:"16px"}}),s.jsx(X.TextArea,{value:o,onChange:g=>{i(g.target.value),c(null)},placeholder:'["permission1", "permission2"]',rows:15,style:{fontFamily:"monospace"}}),a&&s.jsx(Dt,{message:a,type:"error",showIcon:!0,style:{marginTop:"16px"}}),s.jsxs(Se,{style:{marginTop:"16px"},children:[s.jsx(R,{icon:s.jsx(Sd,{}),onClick:l,children:"格式化"}),s.jsx(R,{type:"primary",icon:s.jsx(Ma,{}),onClick:f,children:"保存"})]})]})},{key:"templates",label:"权限模板",children:s.jsxs("div",{children:[s.jsx(Dt,{message:"选择预设模板快速配置权限",description:"点击模板按钮将替换当前配置",type:"info",showIcon:!0,style:{marginBottom:"16px"}}),s.jsx(Se,{direction:"vertical",style:{width:"100%"},children:m.map(g=>s.jsxs(R,{block:!0,onClick:()=>h(g.permissions),style:{textAlign:"left",height:"auto",padding:"12px"},children:[s.jsx("div",{style:{fontWeight:"bold"},children:g.name}),s.jsxs("div",{style:{fontSize:"12px",color:"#666",marginTop:"4px"},children:[g.permissions.length," 个权限:"," ",g.permissions.slice(0,5).join(", "),g.permissions.length>5&&"..."]})]},g.name))})]})},{key:"help",label:"帮助",children:s.jsxs("div",{children:[s.jsx("h3",{children:"权限配置说明"}),s.jsx("h4",{children:"可用权限列表:"}),s.jsx("ul",{children:t.map(g=>s.jsxs("li",{children:[s.jsx("code",{children:g.permission})," - ",g.label]},g.permission))}),s.jsx("h4",{children:"配置示例:"}),s.jsx("pre",{style:{background:"#f5f5f5",padding:"12px",borderRadius:"4px"},children:`[
110
+ "user:view",
111
+ "user:create",
112
+ "user:edit",
113
+ "content:view"
114
+ ]`})]})}]})}):null},_t={"user:create":["user:view"],"user:edit":["user:view"],"user:delete":["user:view"],"content:create":["content:view"],"content:edit":["content:view"],"content:delete":["content:view"],"order:process":["order:view"],"order:cancel":["order:view"],"order:complete":["order:view"],"ticket:reply":["ticket:view"],"ticket:close":["ticket:view"],"data:export":["user:view"],"system:settings":["system:logs"]};function Am(e){const t=[];for(const n of e){const r=_t[n];if(r){const o=r.filter(i=>!e.includes(i));o.length>0&&t.push(`权限 "${n}" 需要以下权限: ${o.join(", ")}`)}}return{valid:t.length===0,errors:t}}function Ti(e){const t=_t[e];if(!t)return[];const n=[...t];for(const r of t){const o=Ti(r);n.push(...o)}return[...new Set(n)]}const Dm=({permissions:e,categories:t,selectedPermissions:n,onSelectionChange:r})=>{const[o,i]=u.useState(""),[a,c]=u.useState([]),l=u.useMemo(()=>{const y=new Map;return e.forEach(x=>{const v=x.category;y.has(v)||y.set(v,[]),y.get(v).push(x)}),Array.from(y.entries()).map(([x,v])=>{var O;return{key:x,title:s.jsxs("span",{children:[s.jsx(U,{color:"blue",children:((O=t[x])==null?void 0:O.label)||x}),s.jsxs("span",{style:{marginLeft:"8px"},children:[v.filter($=>n.includes($.permission)).length," / ",v.length]})]}),children:v.map($=>({key:$.permission,title:s.jsxs("span",{children:[s.jsx(U,{color:n.includes($.permission)?"green":"default",children:$.label}),s.jsx("span",{style:{marginLeft:"8px",color:"#666",fontSize:"12px"},children:$.permission}),_t[$.permission]&&s.jsx(Na,{title:`需要权限: ${_t[$.permission].join(", ")}`,children:s.jsx(_d,{style:{marginLeft:"4px",color:"#1890ff"}})})]})}))}})},[e,t,n]),d=u.useMemo(()=>o?l.map(y=>{var v;const x=(v=y.children)==null?void 0:v.filter(O=>{const $=e.find(z=>z.permission===O.key);return($==null?void 0:$.permission.toLowerCase().includes(o.toLowerCase()))||($==null?void 0:$.label.toLowerCase().includes(o.toLowerCase()))});return x&&x.length>0?{...y,children:x}:null}).filter(Boolean):l,[l,o,e]),f=y=>{const v=(Array.isArray(y)?y:y.checked).filter(C=>e.some(_=>_.permission===C)),O=n,$=v.filter(C=>!O.includes(C)),z=O.filter(C=>!v.includes(C));let j=[...v];for(const C of $){const _=Ti(C);for(const k of _)j.includes(k)||j.push(k)}for(const C of z){const _=Object.entries(_t).filter(([k,S])=>S.includes(C)).map(([k])=>k);for(const k of _)j=j.filter(S=>S!==k)}j=[...new Set(j)],r(j)},h=()=>{r(e.map(y=>y.permission))},m=()=>{r([])},g=()=>{c(Object.keys(t))},p=()=>{c([])},b=y=>{c(y)};return s.jsxs(W,{children:[s.jsxs(Se,{direction:"vertical",style:{width:"100%",marginBottom:"16px"},children:[s.jsx(X,{placeholder:"搜索权限...",prefix:s.jsx(uo,{}),value:o,onChange:y=>i(y.target.value),allowClear:!0}),s.jsxs(Se,{children:[s.jsx(R,{size:"small",onClick:h,children:"全选"}),s.jsx(R,{size:"small",onClick:m,children:"清空"}),s.jsx(R,{size:"small",onClick:g,children:"展开全部"}),s.jsx(R,{size:"small",onClick:p,children:"收起全部"})]})]}),s.jsx(Ea,{checkable:!0,checkedKeys:n,expandedKeys:a,onExpand:b,onCheck:f,treeData:d.filter(Boolean),style:{marginTop:"16px"}}),s.jsxs("div",{style:{marginTop:"16px",color:"#666"},children:["已选择 ",s.jsx(U,{color:"green",children:n.length})," 个权限"]})]})},Mm=()=>{const{roles:e,loading:t,fetchRoles:n,createRole:r,updateRole:o,deleteRole:i,updateRolePermissions:a}=Tm(),{permissions:c}=zm(),{categories:l}=zi(),{refreshPermissions:d}=ln(),[f,h]=u.useState(!1),[m,g]=u.useState(!1),[p,b]=u.useState(null),[y,x]=u.useState([]),[v]=D.useForm();u.useEffect(()=>{n()},[n]);const O=()=>{b(null),v.resetFields(),h(!0)},$=S=>{b(S),v.setFieldsValue({code:S.code,name:S.name,label:S.label,description:S.description,isActive:S.isActive??void 0}),h(!0)},z=async S=>{await i(S)&&N.success("角色删除成功")},j=async S=>{b(S);try{const I=await(await A.api.roles[":id"].$get({param:{id:S.id}})).json();I.success&&I.data.permissions?x(I.data.permissions):x([])}catch(L){console.error("Failed to fetch role permissions:",L),x([])}g(!0)},C=async()=>{try{const S=await v.validateFields();p?await o(p.id,S)&&(N.success("角色更新成功"),h(!1)):await r(S)&&(N.success("角色创建成功"),h(!1))}catch(S){console.error("Form validation failed:",S)}},_=async()=>{if(!p)return;const S=Am(y);if(!S.valid){ye.error({title:"权限依赖校验失败",content:s.jsxs("div",{children:[s.jsx("p",{children:"以下权限配置存在问题:"}),s.jsx("ul",{children:S.errors.map((I,E)=>s.jsx("li",{children:I},E))})]})});return}await a(p.id,y)&&(N.success("权限更新成功"),g(!1),await d())},k=[{title:"角色代码",dataIndex:"code",key:"code"},{title:"角色名称",dataIndex:"name",key:"name"},{title:"显示名称",dataIndex:"label",key:"label"},{title:"描述",dataIndex:"description",key:"description"},{title:"系统角色",dataIndex:"isSystem",key:"isSystem",render:S=>s.jsx(U,{color:S?"blue":"default",children:S?"是":"否"})},{title:"状态",dataIndex:"isActive",key:"isActive",render:S=>s.jsx(U,{color:S?"green":"red",children:S?"启用":"禁用"})},{title:"操作",key:"action",render:(S,L)=>s.jsxs(Se,{children:[L.code!=="super_admin"&&s.jsx(R,{type:"link",icon:s.jsx(Id,{}),onClick:()=>j(L),children:"权限"}),s.jsx(R,{type:"link",icon:s.jsx(ho,{}),onClick:()=>$(L),children:"编辑"}),!L.isSystem&&s.jsx(Fn,{title:"确定要删除这个角色吗?",onConfirm:()=>z(L.id),okText:"确定",cancelText:"取消",children:s.jsx(R,{type:"link",danger:!0,icon:s.jsx(mo,{}),children:"删除"})})]})}];return s.jsxs("div",{style:{padding:"24px"},children:[s.jsxs("div",{style:{marginBottom:"16px",display:"flex",justifyContent:"space-between"},children:[s.jsx("h1",{children:"角色管理"}),s.jsx(R,{type:"primary",icon:s.jsx(fo,{}),onClick:O,children:"创建角色"})]}),s.jsx(nt,{columns:k,dataSource:e,rowKey:"id",loading:t}),s.jsx(ye,{title:p?"编辑角色":"创建角色",open:f,onOk:C,onCancel:()=>h(!1),okText:"确定",cancelText:"取消",children:s.jsxs(D,{form:v,layout:"vertical",children:[s.jsx(D.Item,{name:"code",label:"角色代码",rules:[{required:!0,message:"请输入角色代码"}],children:s.jsx(X,{disabled:!!p,placeholder:"请输入角色代码,如:manager"})}),s.jsx(D.Item,{name:"name",label:"角色名称",rules:[{required:!0,message:"请输入角色名称"}],children:s.jsx(X,{placeholder:"请输入角色名称"})}),s.jsx(D.Item,{name:"label",label:"显示名称",rules:[{required:!0,message:"请输入显示名称"}],children:s.jsx(X,{placeholder:"请输入显示名称"})}),s.jsx(D.Item,{name:"description",label:"描述",children:s.jsx(X.TextArea,{placeholder:"请输入角色描述"})}),p&&s.jsx(D.Item,{name:"isActive",label:"状态",valuePropName:"checked",children:s.jsx(Vt,{checkedChildren:"启用",unCheckedChildren:"禁用"})})]})}),s.jsx(ye,{title:`管理角色权限 - ${(p==null?void 0:p.label)||""}`,open:m,onOk:_,onCancel:()=>g(!1),width:900,okText:"保存",cancelText:"取消",children:s.jsx(An,{defaultActiveKey:"tree",items:[{key:"tree",label:s.jsxs("span",{children:[s.jsx(yd,{}),"树状选择"]}),children:s.jsx(Dm,{permissions:c,categories:l,selectedPermissions:y,onSelectionChange:x})},{key:"json",label:s.jsxs("span",{children:[s.jsx(Uo,{}),"JSON编辑"]}),children:s.jsx(Rm,{visible:!0,title:"",permissions:c,selectedPermissions:y,onCancel:()=>{},onOk:x})}]})})]})},Zm=Et(e=>({logs:[],loading:!1,error:null,fetchLogs:async t=>{e({loading:!0,error:null});try{const n=new URLSearchParams;t!=null&&t.userId&&n.append("userId",t.userId),t!=null&&t.action&&n.append("action",t.action),t!=null&&t.resourceType&&n.append("resourceType",t.resourceType);const o=await(await A.api["audit-logs"].$get({query:Object.fromEntries(n)})).json();o.success?e({logs:o.data,loading:!1}):e({error:"Failed to fetch audit logs",loading:!1})}catch(n){e({error:n.message,loading:!1})}}})),we={USER:"user",ROLE:"role",PERMISSION:"permission",CONTENT:"content",ROUTE:"route",ORDER:"order",TICKET:"ticket",DISPUTE:"dispute",FILE:"file",CHAT:"chat",NOTIFICATION:"notification",CAPTCHA:"captcha"},gn={[we.USER]:"用户",[we.ROLE]:"角色",[we.PERMISSION]:"权限",[we.CONTENT]:"内容",[we.ROUTE]:"路由",[we.ORDER]:"订单",[we.TICKET]:"工单",[we.DISPUTE]:"争议",[we.FILE]:"文件",[we.CHAT]:"聊天",[we.NOTIFICATION]:"通知",[we.CAPTCHA]:"验证码"},Re={CREATE:"create",UPDATE:"update",DELETE:"delete",ASSIGN:"assign",REVOKE:"revoke"},bn={[Re.CREATE]:"创建",[Re.UPDATE]:"更新",[Re.DELETE]:"删除",[Re.ASSIGN]:"分配",[Re.REVOKE]:"撤销"},Ar={[Re.CREATE]:"green",[Re.UPDATE]:"blue",[Re.DELETE]:"red",[Re.ASSIGN]:"cyan",[Re.REVOKE]:"orange"},{Option:Dr}=ne,Lm=()=>{const{logs:e,loading:t,fetchLogs:n}=Zm(),[r,o]=u.useState(null),[i,a]=u.useState(!1),[c,l]=u.useState({userId:"",action:"",resourceType:""}),d=p=>{if(!p)return"-";try{return JSON.stringify(JSON.parse(p),null,2)}catch{return p}};u.useEffect(()=>{n()},[n]);const f=()=>{n({userId:c.userId||void 0,action:c.action||void 0,resourceType:c.resourceType||void 0})},h=()=>{l({userId:"",action:"",resourceType:""}),n()},m=p=>{o(p),a(!0)},g=[{title:"时间",dataIndex:"createdAt",key:"createdAt",width:180,render:p=>new Date(p).toLocaleString("zh-CN")},{title:"用户ID",dataIndex:"userId",key:"userId",width:120},{title:"操作",dataIndex:"action",key:"action",width:100,render:p=>s.jsx(U,{color:Ar[p]||"default",children:bn[p]||p})},{title:"资源类型",dataIndex:"resourceType",key:"resourceType",width:120,render:p=>gn[p]||p},{title:"资源ID",dataIndex:"resourceId",key:"resourceId",width:150,render:p=>p||"-"},{title:"IP地址",dataIndex:"ipAddress",key:"ipAddress",width:140,render:p=>p||"-"},{title:"操作",key:"action",width:100,render:(p,b)=>s.jsx(R,{type:"link",icon:s.jsx(za,{}),onClick:()=>m(b),children:"详情"})}];return s.jsxs("div",{style:{padding:"24px"},children:[s.jsxs(W,{title:"系统日志",extra:s.jsx(R,{icon:s.jsx(Fo,{}),onClick:()=>n(),children:"刷新"}),children:[s.jsxs(Se,{style:{marginBottom:"16px"},wrap:!0,children:[s.jsx(X,{placeholder:"用户ID",value:c.userId,onChange:p=>l({...c,userId:p.target.value}),style:{width:150}}),s.jsx(ne,{placeholder:"操作类型",value:c.action||void 0,onChange:p=>l({...c,action:p||""}),style:{width:120},allowClear:!0,children:Object.entries(Re).map(([p,b])=>s.jsx(Dr,{value:b,children:bn[b]},p))}),s.jsx(ne,{placeholder:"资源类型",value:c.resourceType||void 0,onChange:p=>l({...c,resourceType:p||""}),style:{width:120},allowClear:!0,children:Object.entries(we).map(([p,b])=>s.jsx(Dr,{value:b,children:gn[b]},p))}),s.jsx(R,{type:"primary",icon:s.jsx(uo,{}),onClick:f,children:"搜索"}),s.jsx(R,{onClick:h,children:"重置"})]}),s.jsx(nt,{columns:g,dataSource:e,rowKey:"id",loading:t,pagination:{pageSize:20,showSizeChanger:!0,showTotal:p=>`共 ${p} 条记录`}})]}),s.jsx(ye,{title:"日志详情",open:i,onCancel:()=>a(!1),footer:null,width:700,children:r&&s.jsxs(M,{column:1,bordered:!0,children:[s.jsx(M.Item,{label:"日志ID",children:r.id}),s.jsx(M.Item,{label:"用户ID",children:r.userId}),s.jsx(M.Item,{label:"操作",children:s.jsx(U,{color:Ar[r.action]||"default",children:bn[r.action]||r.action})}),s.jsx(M.Item,{label:"资源类型",children:gn[r.resourceType]||r.resourceType}),s.jsx(M.Item,{label:"资源ID",children:r.resourceId||"-"}),s.jsx(M.Item,{label:"IP地址",children:r.ipAddress||"-"}),s.jsx(M.Item,{label:"User Agent",children:r.userAgent||"-"}),s.jsx(M.Item,{label:"时间",children:new Date(r.createdAt).toLocaleString("zh-CN")}),r.oldValue&&s.jsx(M.Item,{label:"旧值",children:s.jsx("pre",{style:{margin:0,maxHeight:"200px",overflow:"auto"},children:d(r.oldValue)})}),r.newValue&&s.jsx(M.Item,{label:"新值",children:s.jsx("pre",{style:{margin:0,maxHeight:"200px",overflow:"auto"},children:d(r.newValue)})})]})})]})};function Ue({permissions:e,permission:t,mode:n="all",children:r,fallback:o=null}){const{hasPermission:i,hasAnyPermission:a,hasAllPermissions:c}=ln();return t?i(t)?s.jsx(s.Fragment,{children:r}):s.jsx(s.Fragment,{children:o}):e&&e.length>0&&!(n==="any"?a(e):c(e))?s.jsx(s.Fragment,{children:o}):s.jsx(s.Fragment,{children:r})}const Fm=()=>{const[e,t]=u.useState([]),[n,r]=u.useState(!1),[o,i]=u.useState(null),[a]=D.useForm(),{roleLabels:c}=Pi(),l=async()=>{try{const y=await jt(A.api.admin.users.$get()).withLoading("加载用户列表...").json();t(y)}catch{}};u.useEffect(()=>{l()},[]);const d=()=>{i(null),a.resetFields(),r(!0)},f=y=>{i(y),a.setFieldsValue({username:y.username,email:y.email,role:y.role,status:y.status}),r(!0)},h=async y=>{try{o?(await jt(A.api.admin.users[":id"].$put({param:{id:o.id},json:y})).withLoading("更新中...").json(),N.success("用户更新成功"),r(!1),l()):(await jt(A.api.admin.users.$post({json:{username:y.username,email:y.email,password:y.password,role:y.role,status:y.status}})).withLoading("创建中...").json(),N.success("用户创建成功"),r(!1),l())}catch{}},m=async y=>{try{const x=y.status==="locked"?"active":"locked";await jt(A.api.admin.users[":id"].$put({param:{id:y.id},json:{status:x}})).withLoading().json(),N.success(x==="locked"?"用户已锁定":"用户已解锁"),l()}catch{}},g=async y=>{try{await jt(A.api.admin.users[":id"].$delete({param:{id:y}})).withLoading("删除中...").json(),N.success("用户已删除"),l()}catch{}},p=y=>{const v={active:{color:"green",text:"正常"},inactive:{color:"orange",text:"未激活"},locked:{color:"red",text:"已锁定"}}[y];return v?s.jsx(U,{color:v.color,children:v.text}):s.jsx(U,{children:y})},b=[{title:"用户名",dataIndex:"username",key:"username"},{title:"邮箱",dataIndex:"email",key:"email"},{title:"角色",dataIndex:"role",key:"role",render:y=>s.jsx(U,{color:"blue",children:c[y]||y})},{title:"状态",dataIndex:"status",key:"status",render:y=>p(y)},{title:"创建时间",dataIndex:"createdAt",key:"createdAt",render:y=>new Date(y).toLocaleString("zh-CN")},{title:"操作",key:"actions",render:(y,x)=>s.jsxs(Se,{children:[s.jsx(Ue,{permission:je.USER_EDIT,children:s.jsx(R,{type:"link",icon:s.jsx(ho,{}),onClick:()=>f(x),children:"编辑"})}),s.jsx(Ue,{permission:je.USER_EDIT,children:s.jsx(R,{type:"link",icon:x.status==="locked"?s.jsx(Ud,{}):s.jsx(Wt,{}),onClick:()=>m(x),danger:x.status!=="locked",children:x.status==="locked"?"解锁":"锁定"})}),s.jsx(Ue,{permission:je.USER_DELETE,children:s.jsx(Fn,{title:"确定要删除此用户吗?",onConfirm:()=>g(x.id),okText:"确定",cancelText:"取消",children:s.jsx(R,{type:"link",icon:s.jsx(mo,{}),danger:!0,children:"删除"})})})]})}];return s.jsxs("div",{className:"p-6",children:[s.jsx(W,{title:"用户管理",extra:s.jsx(Ue,{permission:je.USER_CREATE,children:s.jsx(R,{type:"primary",icon:s.jsx(fo,{}),onClick:d,children:"创建用户"})}),children:s.jsx(nt,{columns:b,dataSource:e,rowKey:"id"})}),s.jsx(ye,{title:o?"编辑用户":"创建用户",open:n,onCancel:()=>r(!1),onOk:()=>a.submit(),width:600,children:s.jsxs(D,{form:a,layout:"vertical",onFinish:h,children:[s.jsx(D.Item,{name:"username",label:"用户名",rules:[{required:!0,message:"请输入用户名"}],children:s.jsx(X,{placeholder:"请输入用户名"})}),s.jsx(D.Item,{name:"email",label:"邮箱",rules:[{required:!0,message:"请输入邮箱"},{type:"email",message:"请输入有效的邮箱地址"}],children:s.jsx(X,{placeholder:"请输入邮箱"})}),!o&&s.jsx(D.Item,{name:"password",label:"密码",rules:[{required:!0,message:"请输入密码"}],children:s.jsx(X.Password,{placeholder:"请输入密码"})}),s.jsx(D.Item,{name:"role",label:"角色",rules:[{required:!0,message:"请选择角色"}],children:s.jsxs(ne,{placeholder:"请选择角色",children:[s.jsx(ne.Option,{value:ke.SUPER_ADMIN,children:"超级管理员"}),s.jsx(ne.Option,{value:ke.CUSTOMER_SERVICE,children:"客服人员"}),s.jsx(ne.Option,{value:ke.USER,children:"普通用户"})]})}),s.jsx(D.Item,{name:"status",label:"状态",rules:[{required:!0,message:"请选择状态"}],children:s.jsxs(ne,{placeholder:"请选择状态",children:[s.jsx(ne.Option,{value:"active",children:"正常"}),s.jsx(ne.Option,{value:"inactive",children:"未激活"}),s.jsx(ne.Option,{value:"locked",children:"已锁定"})]})})]})})]})},Mr={pending:"orange",processing:"blue",completed:"green",cancelled:"red",disputed:"purple"},Zr={pending:"待处理",processing:"处理中",completed:"已完成",cancelled:"已取消",disputed:"争议中"},Bm=()=>{const[e,t]=u.useState([]),[n,r]=u.useState(!1),[o,i]=u.useState(null),[a,c]=u.useState(!1),[l,d]=u.useState(),f=u.useCallback(async()=>{r(!0);try{const b=new URLSearchParams;l&&b.append("status",l);const x=await(await A.api.orders.$get({query:Object.fromEntries(b)})).json();x.success?t(x.data):N.error(x.error||"Failed to load orders")}catch{N.error("获取订单列表失败")}finally{r(!1)}},[l]);u.useEffect(()=>{f()},[f]);const h=async b=>{try{(await(await A.api.orders[":id"].process.$put({param:{id:b}})).json()).success&&(N.success("订单已开始处理"),f())}catch{N.error("处理订单失败")}},m=async b=>{ye.confirm({title:"确认取消",content:"确定要取消这个订单吗?",onOk:async()=>{try{(await(await A.api.orders[":id"].cancel.$put({param:{id:b}})).json()).success&&(N.success("订单已取消"),f())}catch{N.error("取消订单失败")}}})},g=b=>{i(b),c(!0)},p=[{title:"订单号",dataIndex:"orderNo",key:"orderNo",render:b=>s.jsx("code",{className:"text-sm",children:b})},{title:"客户信息",key:"customer",render:(b,y)=>s.jsxs("div",{children:[s.jsx("div",{className:"font-medium",children:y.customerName}),s.jsx("div",{className:"text-sm text-gray-500",children:y.customerEmail})]})},{title:"商品",dataIndex:"productName",key:"productName"},{title:"金额",dataIndex:"amount",key:"amount",render:b=>s.jsxs("span",{className:"font-medium text-green-600",children:["¥",b.toFixed(2)]})},{title:"状态",dataIndex:"status",key:"status",render:b=>s.jsx(U,{color:Mr[b],children:Zr[b]})},{title:"创建时间",dataIndex:"createdAt",key:"createdAt",render:b=>new Date(b).toLocaleString("zh-CN")},{title:"操作",key:"actions",render:(b,y)=>s.jsxs(Se,{children:[s.jsx(R,{type:"link",size:"small",icon:s.jsx(Dn,{className:"w-4 h-4"}),onClick:()=>g(y),children:"查看"}),s.jsxs(Ue,{permission:je.ORDER_PROCESS,children:[y.status==="pending"&&s.jsx(R,{type:"link",size:"small",icon:s.jsx(tt,{className:"w-4 h-4"}),onClick:()=>h(y.id),children:"处理"}),(y.status==="pending"||y.status==="processing")&&s.jsx(R,{type:"link",size:"small",danger:!0,icon:s.jsx(go,{className:"w-4 h-4"}),onClick:()=>m(y.id),children:"取消"})]})]})}];return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"订单管理"}),s.jsx("p",{className:"text-gray-600 mt-1",children:"管理和处理所有订单"})]}),s.jsxs(Se,{children:[s.jsx(ne,{placeholder:"筛选状态",style:{width:150},allowClear:!0,value:l,onChange:d,options:[{value:"pending",label:"待处理"},{value:"processing",label:"处理中"},{value:"completed",label:"已完成"},{value:"cancelled",label:"已取消"},{value:"disputed",label:"争议中"}]}),s.jsx(R,{onClick:f,children:"刷新"})]})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:[s.jsx(W,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-gray-500",children:"总订单"}),s.jsx("div",{className:"text-2xl font-bold",children:e.length})]}),s.jsx(ic,{className:"w-8 h-8 text-blue-500"})]})}),s.jsx(W,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-gray-500",children:"待处理"}),s.jsx("div",{className:"text-2xl font-bold text-orange-500",children:e.filter(b=>b.status==="pending").length})]}),s.jsx(Ut,{className:"w-8 h-8 text-orange-500"})]})}),s.jsx(W,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-gray-500",children:"处理中"}),s.jsx("div",{className:"text-2xl font-bold text-blue-500",children:e.filter(b=>b.status==="processing").length})]}),s.jsx(Ut,{className:"w-8 h-8 text-blue-500"})]})}),s.jsx(W,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-gray-500",children:"已完成"}),s.jsx("div",{className:"text-2xl font-bold text-green-500",children:e.filter(b=>b.status==="completed").length})]}),s.jsx(tt,{className:"w-8 h-8 text-green-500"})]})})]}),s.jsx(W,{children:s.jsx(nt,{columns:p,dataSource:e,rowKey:"id",loading:n,pagination:{pageSize:10,showTotal:b=>`共 ${b} 条`}})}),s.jsx(ye,{title:"订单详情",open:a,onCancel:()=>c(!1),footer:null,width:600,children:o&&s.jsxs(M,{column:1,bordered:!0,children:[s.jsx(M.Item,{label:"订单号",children:s.jsx("code",{children:o.orderNo})}),s.jsx(M.Item,{label:"客户姓名",children:o.customerName}),s.jsx(M.Item,{label:"客户邮箱",children:o.customerEmail}),s.jsx(M.Item,{label:"商品名称",children:o.productName}),s.jsx(M.Item,{label:"订单金额",children:s.jsxs("span",{className:"text-lg font-bold text-green-600",children:["¥",o.amount.toFixed(2)]})}),s.jsx(M.Item,{label:"订单状态",children:s.jsx(U,{color:Mr[o.status],children:Zr[o.status]})}),s.jsx(M.Item,{label:"创建时间",children:new Date(o.createdAt).toLocaleString("zh-CN")}),s.jsx(M.Item,{label:"更新时间",children:new Date(o.updatedAt).toLocaleString("zh-CN")})]})})]})},Lr={low:"default",medium:"blue",high:"orange",urgent:"red"},Fr={open:"blue",in_progress:"processing",waiting_customer:"orange",resolved:"success",closed:"default"},Br={low:"低",medium:"中",high:"高",urgent:"紧急"},Ur={open:"待处理",in_progress:"处理中",waiting_customer:"等待客户",resolved:"已解决",closed:"已关闭"},Um=()=>{const[e,t]=u.useState([]),[n,r]=u.useState(!1),[o,i]=u.useState(null),[a,c]=u.useState(!1);u.useEffect(()=>{l()},[]);const l=async()=>{r(!0);try{const g=await(await A.api.tickets.$get({query:{}})).json();g.success?t(g.data):N.error(g.error||"Failed to load tickets")}catch{N.error("获取工单列表失败")}finally{r(!1)}},d=async m=>{ye.confirm({title:"确认关闭",content:"确定要关闭这个工单吗?",onOk:async()=>{try{(await(await A.api.tickets[":id"].close.$put({param:{id:m}})).json()).success&&(N.success("工单已关闭"),l())}catch{N.error("关闭工单失败")}}})},f=m=>{i(m),c(!0)},h=[{title:"工单号",dataIndex:"ticketNo",key:"ticketNo",render:m=>s.jsx("code",{className:"text-sm",children:m})},{title:"主题",dataIndex:"subject",key:"subject"},{title:"客户",key:"customer",render:(m,g)=>s.jsxs("div",{children:[s.jsx("div",{className:"font-medium",children:g.customerName}),s.jsx("div",{className:"text-sm text-gray-500",children:g.customerEmail})]})},{title:"优先级",dataIndex:"priority",key:"priority",render:m=>s.jsx(U,{color:Lr[m],children:Br[m]})},{title:"状态",dataIndex:"status",key:"status",render:m=>s.jsx(U,{color:Fr[m],children:Ur[m]})},{title:"创建时间",dataIndex:"createdAt",key:"createdAt",render:m=>new Date(m).toLocaleString("zh-CN")},{title:"操作",key:"actions",render:(m,g)=>s.jsxs(Se,{children:[s.jsx(R,{type:"link",size:"small",icon:s.jsx(Dn,{className:"w-4 h-4"}),onClick:()=>f(g),children:"查看"}),s.jsx(Ue,{permission:je.TICKET_CLOSE,children:g.status!=="closed"&&s.jsx(R,{type:"link",size:"small",icon:s.jsx(tt,{className:"w-4 h-4"}),onClick:()=>d(g.id),children:"关闭"})})]})}];return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"客服中心"}),s.jsx("p",{className:"text-gray-600 mt-1",children:"处理客户工单和咨询"})]}),s.jsx(R,{onClick:l,children:"刷新"})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4 mb-6",children:[s.jsx(W,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-gray-500",children:"总工单"}),s.jsx("div",{className:"text-2xl font-bold",children:e.length})]}),s.jsx(dc,{className:"w-8 h-8 text-blue-500"})]})}),s.jsx(W,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-gray-500",children:"待处理"}),s.jsx("div",{className:"text-2xl font-bold text-blue-500",children:e.filter(m=>m.status==="open").length})]}),s.jsx(Ut,{className:"w-8 h-8 text-blue-500"})]})}),s.jsx(W,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-gray-500",children:"紧急"}),s.jsx("div",{className:"text-2xl font-bold text-red-500",children:e.filter(m=>m.priority==="urgent").length})]}),s.jsx(nc,{className:"w-8 h-8 text-red-500"})]})}),s.jsx(W,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-gray-500",children:"已解决"}),s.jsx("div",{className:"text-2xl font-bold text-green-500",children:e.filter(m=>m.status==="resolved"||m.status==="closed").length})]}),s.jsx(tt,{className:"w-8 h-8 text-green-500"})]})})]}),s.jsx(W,{children:s.jsx(nt,{columns:h,dataSource:e,rowKey:"id",loading:n,pagination:{pageSize:10,showTotal:m=>`共 ${m} 条`}})}),s.jsx(ye,{title:"工单详情",open:a,onCancel:()=>c(!1),footer:null,width:700,children:o&&s.jsxs("div",{children:[s.jsxs(M,{column:2,bordered:!0,className:"mb-4",children:[s.jsx(M.Item,{label:"工单号",children:s.jsx("code",{children:o.ticketNo})}),s.jsx(M.Item,{label:"状态",children:s.jsx(U,{color:Fr[o.status],children:Ur[o.status]})}),s.jsx(M.Item,{label:"客户姓名",children:o.customerName}),s.jsx(M.Item,{label:"客户邮箱",children:o.customerEmail}),s.jsx(M.Item,{label:"优先级",children:s.jsx(U,{color:Lr[o.priority],children:Br[o.priority]})}),s.jsx(M.Item,{label:"负责人",children:o.assignedTo||"未分配"}),s.jsx(M.Item,{label:"主题",span:2,children:o.subject}),s.jsx(M.Item,{label:"描述",span:2,children:o.description})]}),o.replies.length>0&&s.jsxs("div",{className:"mt-4",children:[s.jsx("h4",{className:"font-semibold mb-2",children:"回复记录"}),o.replies.map(m=>s.jsxs("div",{className:`p-3 mb-2 rounded ${m.isCustomer?"bg-gray-50":"bg-blue-50"}`,children:[s.jsxs("div",{className:"flex justify-between items-center mb-1",children:[s.jsx("span",{className:"font-medium",children:m.author}),s.jsx("span",{className:"text-sm text-gray-500",children:new Date(m.createdAt).toLocaleString("zh-CN")})]}),s.jsx("div",{className:"text-gray-700",children:m.content})]},m.id))]})]})})]})},Hr={refund:"退款争议",product_quality:"商品质量",service_quality:"服务质量",delivery:"配送问题",other:"其他"},Vr={pending:"orange",investigating:"blue",resolved:"green",rejected:"red"},Wr={pending:"待处理",investigating:"调查中",resolved:"已解决",rejected:"已驳回"},Hm=()=>{const[e,t]=u.useState([]),[n,r]=u.useState(!1),[o,i]=u.useState(null),[a,c]=u.useState(!1);u.useEffect(()=>{l()},[]);const l=async()=>{r(!0);try{const g=await(await A.api.disputes.$get({query:{}})).json();g.success?t(g.data):N.error(g.error||"Failed to load disputes")}catch{N.error("获取争议列表失败")}finally{r(!1)}},d=m=>{ye.confirm({title:"解决争议",content:s.jsxs("div",{children:[s.jsx("p",{children:"确定要解决这个争议吗?"}),s.jsxs("p",{children:["金额:¥",m.amount.toFixed(2)]})]}),onOk:async()=>{try{(await(await A.api.disputes[":id"].resolve.$put({param:{id:m.id},json:{resolution:"已同意退款,3-5个工作日内到账",resolvedBy:"客服人员"}})).json()).success&&(N.success("争议已解决"),l())}catch{N.error("解决争议失败")}}})},f=m=>{i(m),c(!0)},h=[{title:"争议编号",dataIndex:"disputeNo",key:"disputeNo",render:m=>s.jsx("code",{className:"text-sm",children:m})},{title:"订单号",dataIndex:"orderNo",key:"orderNo"},{title:"客户",key:"customer",render:(m,g)=>s.jsxs("div",{children:[s.jsx("div",{className:"font-medium",children:g.customerName}),s.jsx("div",{className:"text-sm text-gray-500",children:g.customerEmail})]})},{title:"类型",dataIndex:"type",key:"type",render:m=>Hr[m]},{title:"金额",dataIndex:"amount",key:"amount",render:m=>s.jsxs("span",{className:"font-medium text-red-600",children:["¥",m.toFixed(2)]})},{title:"状态",dataIndex:"status",key:"status",render:m=>s.jsx(U,{color:Vr[m],children:Wr[m]})},{title:"创建时间",dataIndex:"createdAt",key:"createdAt",render:m=>new Date(m).toLocaleString("zh-CN")},{title:"操作",key:"actions",render:(m,g)=>s.jsxs(Se,{children:[s.jsx(R,{type:"link",size:"small",icon:s.jsx(Dn,{className:"w-4 h-4"}),onClick:()=>f(g),children:"查看"}),s.jsx(Ue,{permission:je.TICKET_CLOSE,children:(g.status==="pending"||g.status==="investigating")&&s.jsx(R,{type:"link",size:"small",icon:s.jsx(tt,{className:"w-4 h-4"}),onClick:()=>d(g),children:"解决"})})]})}];return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"争议处理"}),s.jsx("p",{className:"text-gray-600 mt-1",children:"处理订单争议和客户投诉"})]}),s.jsx(R,{onClick:l,children:"刷新"})]}),s.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-6",children:[s.jsx(W,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-gray-500",children:"总争议"}),s.jsx("div",{className:"text-2xl font-bold",children:e.length})]}),s.jsx(vn,{className:"w-8 h-8 text-orange-500"})]})}),s.jsx(W,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-gray-500",children:"待处理"}),s.jsx("div",{className:"text-2xl font-bold text-orange-500",children:e.filter(m=>m.status==="pending").length})]}),s.jsx(vn,{className:"w-8 h-8 text-orange-500"})]})}),s.jsx(W,{children:s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsxs("div",{children:[s.jsx("div",{className:"text-sm text-gray-500",children:"已解决"}),s.jsx("div",{className:"text-2xl font-bold text-green-500",children:e.filter(m=>m.status==="resolved").length})]}),s.jsx(tt,{className:"w-8 h-8 text-green-500"})]})})]}),s.jsx(W,{children:s.jsx(nt,{columns:h,dataSource:e,rowKey:"id",loading:n,pagination:{pageSize:10}})}),s.jsx(ye,{title:"争议详情",open:a,onCancel:()=>c(!1),footer:null,width:600,children:o&&s.jsxs(M,{column:1,bordered:!0,children:[s.jsx(M.Item,{label:"争议编号",children:s.jsx("code",{children:o.disputeNo})}),s.jsx(M.Item,{label:"订单号",children:o.orderNo}),s.jsxs(M.Item,{label:"客户",children:[o.customerName," (",o.customerEmail,")"]}),s.jsx(M.Item,{label:"类型",children:Hr[o.type]}),s.jsx(M.Item,{label:"金额",children:s.jsxs("span",{className:"text-lg font-bold text-red-600",children:["¥",o.amount.toFixed(2)]})}),s.jsx(M.Item,{label:"状态",children:s.jsx(U,{color:Vr[o.status],children:Wr[o.status]})}),s.jsx(M.Item,{label:"描述",children:o.description}),o.resolution&&s.jsx(M.Item,{label:"解决方案",children:o.resolution})]})})]})},Vm={article:"文章",announcement:"公告",tutorial:"教程",news:"新闻",policy:"政策"},Wm={draft:"default",published:"success",archived:"warning"},qm={draft:"草稿",published:"已发布",archived:"已归档"},Km=()=>{const[e,t]=u.useState([]),[n,r]=u.useState(!1),[o,i]=u.useState(!1),[a,c]=u.useState(null),[l]=D.useForm();u.useEffect(()=>{d()},[]);const d=async()=>{r(!0);try{const y=await(await A.api.contents.$get({query:{}})).json();y.success?t(y.data):N.error("Failed to load content")}catch{N.error("获取内容列表失败")}finally{r(!1)}},f=()=>{c(null),l.resetFields(),i(!0)},h=b=>{c(b),l.setFieldsValue(b),i(!0)},m=b=>{ye.confirm({title:"确认删除",content:"确定要删除这个内容吗?",onOk:async()=>{try{(await(await A.api.contents[":id"].$delete({param:{id:b}})).json()).success&&(N.success("内容已删除"),d())}catch{N.error("删除失败")}}})},g=async()=>{try{const b=await l.validateFields();a?(await(await A.api.contents[":id"].$put({param:{id:a.id},json:b})).json()).success&&(N.success("内容已更新"),i(!1),d()):(await(await A.api.contents.$post({json:b})).json()).success&&(N.success("内容已创建"),i(!1),d())}catch{N.error("操作失败")}},p=[{title:"标题",dataIndex:"title",key:"title"},{title:"分类",dataIndex:"category",key:"category",render:b=>s.jsx(U,{children:Vm[b]})},{title:"状态",dataIndex:"status",key:"status",render:b=>s.jsx(U,{color:Wm[b],children:qm[b]})},{title:"作者",dataIndex:"author",key:"author"},{title:"浏览/点赞",key:"stats",render:(b,y)=>s.jsxs("span",{children:[y.viewCount," / ",y.likeCount]})},{title:"创建时间",dataIndex:"createdAt",key:"createdAt",render:b=>new Date(b).toLocaleDateString("zh-CN")},{title:"操作",key:"actions",render:(b,y)=>s.jsxs(Se,{children:[s.jsx(Ue,{permission:je.CONTENT_EDIT,children:s.jsx(R,{type:"link",size:"small",icon:s.jsx(mc,{className:"w-4 h-4"}),onClick:()=>h(y),children:"编辑"})}),s.jsx(Ue,{permission:je.CONTENT_DELETE,children:s.jsx(R,{type:"link",size:"small",danger:!0,icon:s.jsx(oc,{className:"w-4 h-4"}),onClick:()=>m(y.id),children:"删除"})})]})}];return s.jsxs("div",{children:[s.jsxs("div",{className:"flex justify-between items-center mb-6",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"内容管理"}),s.jsx("p",{className:"text-gray-600 mt-1",children:"管理文章、公告和教程"})]}),s.jsx(Ue,{permission:je.CONTENT_CREATE,children:s.jsx(R,{type:"primary",icon:s.jsx(Ya,{className:"w-4 h-4"}),onClick:f,children:"创建内容"})})]}),s.jsx(W,{children:s.jsx(nt,{columns:p,dataSource:e,rowKey:"id",loading:n,pagination:{pageSize:10}})}),s.jsx(ye,{title:a?"编辑内容":"创建内容",open:o,onOk:g,onCancel:()=>i(!1),width:600,children:s.jsxs(D,{form:l,layout:"vertical",children:[s.jsx(D.Item,{name:"title",label:"标题",rules:[{required:!0,message:"请输入标题"}],children:s.jsx(X,{placeholder:"请输入标题"})}),s.jsx(D.Item,{name:"category",label:"分类",rules:[{required:!0,message:"请选择分类"}],children:s.jsxs(ne,{placeholder:"请选择分类",children:[s.jsx(ne.Option,{value:"article",children:"文章"}),s.jsx(ne.Option,{value:"announcement",children:"公告"}),s.jsx(ne.Option,{value:"tutorial",children:"教程"}),s.jsx(ne.Option,{value:"news",children:"新闻"}),s.jsx(ne.Option,{value:"policy",children:"政策"})]})}),s.jsx(D.Item,{name:"content",label:"内容",rules:[{required:!0,message:"请输入内容"}],children:s.jsx(X.TextArea,{rows:6,placeholder:"请输入内容"})}),s.jsx(D.Item,{name:"tags",label:"标签",children:s.jsx(ne,{mode:"tags",placeholder:"输入标签后按回车"})})]})})]})},{Title:up}=Xa,Jm=({children:e,requiredRole:t})=>{const n=qr(),{isAuthenticated:r,user:o}=xt(),{initialized:i,initPermissions:a,fetchStaticData:c}=Gt();return u.useEffect(()=>{r&&!i&&(a(),c())},[r,i,a,c]),r?t&&(o==null?void 0:o.role)!==t&&(o==null?void 0:o.role)!==ke.SUPER_ADMIN?s.jsx(yn,{to:"/dashboard",replace:!0}):s.jsx(s.Fragment,{children:e}):s.jsx(yn,{to:"/login",state:{from:n},replace:!0})},Xm=()=>{const{isOpen:e,resolve:t}=Ho(),[n,r]=u.useState(""),[o,i]=u.useState(!1),[a,c]=u.useState(null),[l,d]=u.useState(!1),f=async()=>{d(!0);try{const b=await(await A.api.captcha.$get()).json();b.success&&b.data?c(b.data):N.error("获取验证码失败")}catch{N.error("获取验证码失败")}finally{d(!1)}};u.useEffect(()=>{e&&(f(),r(""))},[e]);const h=()=>{f()},m=async()=>{if(!n.trim()){N.warning("请输入验证码");return}if(!a){N.warning("验证码未加载,请刷新");return}i(!0);try{const b=await(await A.api["verify-captcha"].$post({json:{id:a.id,code:n}})).json();b.success?(N.success("验证成功"),t(!0),r(""),c(null)):(N.error(b.error||"验证失败"),h())}catch{N.error("验证失败,请重试"),h()}finally{i(!1)}},g=()=>{r(""),c(null),t(!1)};return s.jsx(ye,{open:e,title:"请完成安全验证",onCancel:g,footer:null,maskClosable:!1,closable:!0,width:400,children:s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{className:"relative",children:[a!=null&&a.image?s.jsx("img",{src:a.image,alt:"验证码",className:"w-full h-32 object-cover border rounded cursor-pointer",onClick:h}):s.jsx("div",{className:"w-full h-32 border rounded flex items-center justify-center bg-gray-50",children:l?"加载中...":"点击刷新验证码"}),s.jsx(R,{type:"text",icon:s.jsx(Fo,{}),onClick:h,loading:l,className:"absolute top-2 right-2",title:"刷新验证码"})]}),s.jsx(X,{placeholder:"请输入验证码",value:n,onChange:p=>r(p.target.value),onPressEnter:m,size:"large",disabled:!a}),s.jsxs("div",{className:"flex gap-2",children:[s.jsx(R,{onClick:g,className:"flex-1",children:"取消"}),s.jsx(R,{type:"primary",onClick:m,loading:o,disabled:!a,className:"flex-1",children:"提交"})]})]})})},fp=({basePath:e="/admin"})=>s.jsx(io,{theme:{token:{colorPrimary:"#1890ff"}},children:s.jsxs(Di,{basename:e,children:[s.jsxs(nr,{children:[s.jsx(me,{path:"/login",element:s.jsx(km,{})}),s.jsx(me,{path:"/register",element:s.jsx(Im,{})}),s.jsx(me,{path:"/*",element:s.jsx(Jm,{children:s.jsx(Cm,{children:s.jsxs(nr,{children:[s.jsx(me,{path:"/",element:s.jsx(yn,{to:"/dashboard",replace:!0})}),s.jsx(me,{path:"/dashboard",element:s.jsx(_m,{})}),s.jsx(me,{path:"/users",element:s.jsx(Fm,{})}),s.jsx(me,{path:"/orders",element:s.jsx(Bm,{})}),s.jsx(me,{path:"/tickets",element:s.jsx(Um,{})}),s.jsx(me,{path:"/disputes",element:s.jsx(Hm,{})}),s.jsx(me,{path:"/content",element:s.jsx(Km,{})}),s.jsx(me,{path:"/system/settings",element:s.jsx(Nm,{})}),s.jsx(me,{path:"/system/logs",element:s.jsx(Lm,{})}),s.jsx(me,{path:"/system/monitor",element:s.jsx("div",{children:"系统监控页面(待开发)"})}),s.jsx(me,{path:"/system/permissions",element:s.jsx(Pm,{})}),s.jsx(me,{path:"/system/roles",element:s.jsx(Mm,{})})]})})})})]}),s.jsx(Xm,{})]})});export{fp as App};