nolo-cli 0.211.0 → 0.213.0

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 (173) hide show
  1. package/{_executeModel-VVQEOY3D.js → _executeModel-CUJLCFWR.js} +57 -54
  2. package/{action-U235TV4P.js → action-DF5UYSJF.js} +4 -4
  3. package/{addContentAction-7C76J7ST.js → addContentAction-WERAONNY.js} +9 -9
  4. package/{addDialogAgentAction-KTYANUEC.js → addDialogAgentAction-7VI7YRML.js} +16 -13
  5. package/{agentDeleteCommand-WHRU6VDJ.js → agentDeleteCommand-XJORXPGU.js} +80 -76
  6. package/{agentEmailCommands-ALLHXPW3.js → agentEmailCommands-XTYYFR6Z.js} +85 -80
  7. package/{agentListCommands-POKMEKMS.js → agentListCommands-OBLRBLHS.js} +237 -115
  8. package/{agentMachineCommands-WJLZLBPI.js → agentMachineCommands-5FMT3OT5.js} +33 -31
  9. package/{agentProviderCommands-MN3ABDME.js → agentProviderCommands-Q5O33MED.js} +33 -4
  10. package/{agentRecordCommands-OULZW3KM.js → agentRecordCommands-ZQ7SVYGG.js} +75 -70
  11. package/{agentRunCommand-ZNG4LGNQ.js → agentRunCommand-WS7IGO2W.js} +77 -73
  12. package/{agentRunControl-AF7BMR22.js → agentRunControl-TAMHJQSR.js} +8 -7
  13. package/{agentRuntimeLocal-YMUHFV5M.js → agentRuntimeLocal-SOO2OPJG.js} +30 -27
  14. package/{agentSlice-WNGUIMQZ.js → agentSlice-CHR6KOZN.js} +13 -13
  15. package/{appDeleteCommands-6MXPLAVF.js → appDeleteCommands-GUP6P5YE.js} +34 -32
  16. package/{appDeployCommands-ERRSVASW.js → appDeployCommands-MH2FX4O5.js} +34 -32
  17. package/{appDeployStatusCommands-ULICISLI.js → appDeployStatusCommands-SUHN3HPJ.js} +34 -32
  18. package/{appGetCommands-WYYYWROF.js → appGetCommands-YWDEX6Z4.js} +34 -32
  19. package/{appListCommands-DFCUCRCV.js → appListCommands-ZQVMLPAY.js} +34 -32
  20. package/{authCommand-ZJMWXFMA.js → authCommand-PWX2ZNUP.js} +15 -15
  21. package/{authCommands-WK6E42L2.js → authCommands-HV3EAU3V.js} +2 -2
  22. package/{builtinSkillRegistry-HH75G5J3.js → builtinSkillRegistry-2QETTQPM.js} +5 -4
  23. package/{chromeOpsCommands-HEN5AX2J.js → chromeOpsCommands-DIVM2K3T.js} +1 -1
  24. package/{chunk-TRZP7JZ7.js → chunk-2QHFH3DR.js} +1 -0
  25. package/{chunk-XE4Q46FF.js → chunk-3CGG2PAL.js} +1 -1
  26. package/{chunk-YUXQAVRD.js → chunk-3UKL3HPD.js} +251 -14
  27. package/{chunk-BSISWVB4.js → chunk-4I7ERB7F.js} +1 -1
  28. package/{chunk-5ORJGHTL.js → chunk-4T2WNOY7.js} +6 -6
  29. package/{chunk-W5VC7F7V.js → chunk-5MQRBSMW.js} +84 -91
  30. package/{chunk-YLTLB5A7.js → chunk-6DWMYIUY.js} +7 -6
  31. package/chunk-6VLJ6YA7.js +11751 -0
  32. package/{chunk-KSTEXKL6.js → chunk-75XIDFBW.js} +4 -3
  33. package/{chunk-BTYQAODF.js → chunk-7BT37FK3.js} +196 -308
  34. package/{chunk-27E2CBBY.js → chunk-7OCO4TDT.js} +1 -1
  35. package/{chunk-V3M6IXQI.js → chunk-7QTZCMKL.js} +335 -131
  36. package/chunk-7RFNTILS.js +2213 -0
  37. package/{chunk-NHQKWPLP.js → chunk-7Y4YTDQF.js} +25 -23
  38. package/{chunk-CKAHAVMK.js → chunk-A7TFUNZO.js} +35 -25
  39. package/{chunk-PJNFNEJE.js → chunk-ALQ3657A.js} +28 -2
  40. package/{chunk-NV572QM3.js → chunk-BBJ22CLB.js} +15 -15
  41. package/chunk-CJEIOP3E.js +0 -0
  42. package/{chunk-4WCEC56C.js → chunk-COFEN36Z.js} +2 -2
  43. package/{chunk-25OB36GU.js → chunk-CRHOO2ZR.js} +4 -4
  44. package/{chunk-NTSRCTUX.js → chunk-CTPXME7U.js} +2 -2
  45. package/{chunk-TPCDYNJK.js → chunk-EHGEOAHI.js} +3 -3
  46. package/{chunk-Y2WUYX4I.js → chunk-EHSZD5OI.js} +1 -1
  47. package/{chunk-SU3QL7YG.js → chunk-FUGMREBO.js} +2 -2
  48. package/{chunk-UMEGDH6A.js → chunk-FW6YHHLI.js} +8 -8
  49. package/chunk-FY7F4Q6X.js +127 -0
  50. package/{chunk-25M2K6OA.js → chunk-G2BQWAVT.js} +3 -3
  51. package/chunk-G7MLNNEX.js +84 -0
  52. package/{chunk-DQLB4NQ3.js → chunk-GPVRUGGY.js} +2 -2
  53. package/{chunk-RQ22OZD7.js → chunk-H2TJUNCH.js} +1 -1
  54. package/{chunk-XPHZK3PJ.js → chunk-H4UOTUOX.js} +165 -51
  55. package/{chunk-CVCRAO6Q.js → chunk-H5HF7TJA.js} +9 -7
  56. package/{chunk-OP7PTBAJ.js → chunk-H7PPIYWP.js} +9 -9
  57. package/{chunk-QQM464AL.js → chunk-HPFCI4SK.js} +3 -3
  58. package/chunk-HRMJUN5J.js +26 -0
  59. package/{chunk-WI6OGHXJ.js → chunk-HSVBJRF4.js} +5 -5
  60. package/{chunk-RYWO5AKN.js → chunk-HUBHAQK2.js} +10 -10
  61. package/{chunk-LKDF3ATR.js → chunk-INUFILG6.js} +1 -1
  62. package/{chunk-NXCGNS4N.js → chunk-IXNGOHV5.js} +2 -2
  63. package/{chunk-ET2CWLIJ.js → chunk-J2NHJ7WX.js} +4 -4
  64. package/{chunk-ECX3NKRD.js → chunk-JY5NGFFH.js} +11 -0
  65. package/chunk-KC4XDTT3.js +227 -0
  66. package/{chunk-ADBWFYJD.js → chunk-KFLT5KAD.js} +9 -9
  67. package/{chunk-PLYWH7XM.js → chunk-KIM6CLW5.js} +7 -7
  68. package/{chunk-7IYBN7IA.js → chunk-LLRPJECG.js} +22 -13
  69. package/{chunk-3J3U3KXB.js → chunk-MDB67IWP.js} +5 -5
  70. package/chunk-MMA3LZ3W.js +105 -0
  71. package/{chunk-XDMGY5IU.js → chunk-MOIJOHA5.js} +227 -11
  72. package/{chunk-NLT32XBZ.js → chunk-NJLL224W.js} +2 -2
  73. package/{chunk-JBOUVTZX.js → chunk-NOKUNJON.js} +15 -4
  74. package/{chunk-C2XZM3K4.js → chunk-NSAPDIN2.js} +12 -27
  75. package/{chunk-PAFTGNWA.js → chunk-O2TZF4AI.js} +2 -2
  76. package/{chunk-UIOEHFF6.js → chunk-OQHIVPG4.js} +1 -0
  77. package/{chunk-TCTSYFDM.js → chunk-OQPKUBPB.js} +19 -6
  78. package/{chunk-X4F26D5K.js → chunk-P5L7CXOC.js} +58 -33
  79. package/{chunk-OXME3PEE.js → chunk-PCLE46CE.js} +1 -1
  80. package/{chunk-UCPAVEQB.js → chunk-PYRUW7XN.js} +1 -1
  81. package/{chunk-YXOBCDNW.js → chunk-QG4AOSON.js} +12 -49
  82. package/{chunk-RXCCWVA2.js → chunk-QHPRUL4O.js} +3 -3
  83. package/{chunk-I5PBXF7O.js → chunk-R5O4QAWG.js} +1 -1
  84. package/{chunk-HD3WR3TD.js → chunk-RLBNLZVC.js} +1 -1
  85. package/{chunk-SN5XE6GQ.js → chunk-RPQXPZZF.js} +4 -4
  86. package/{chunk-ZOO3WJIE.js → chunk-RSHTSUEG.js} +948 -108
  87. package/{chunk-6HVBI6TI.js → chunk-RZOV7OMV.js} +12 -229
  88. package/{chunk-D2MDMY2M.js → chunk-SVYO6AO7.js} +7 -1
  89. package/{chunk-IIHY4ZAI.js → chunk-TAKB25RM.js} +8 -4
  90. package/{chunk-ZN5AH4BY.js → chunk-TX5EYMGT.js} +6 -6
  91. package/{chunk-CKOO42G5.js → chunk-UHJGXRJ4.js} +4 -4
  92. package/{chunk-M4NTDZG3.js → chunk-UYD5HQ6T.js} +857 -295
  93. package/{chunk-WTKYP6QO.js → chunk-V5Y3R6BT.js} +114 -6
  94. package/{chunk-3RQVYR4B.js → chunk-VNYYOX3V.js} +59 -20
  95. package/{chunk-4LEGTOSR.js → chunk-VO4WSAVP.js} +3 -3
  96. package/{chunk-LNYHAKBP.js → chunk-W4S457LU.js} +1 -1
  97. package/{chunk-RIALQUSF.js → chunk-WMTBPBMP.js} +6 -6
  98. package/chunk-WPORQFYN.js +74 -0
  99. package/{chunk-Y6M7KJOA.js → chunk-WRYQ35LQ.js} +5 -5
  100. package/{chunk-YKFP6UGT.js → chunk-WYDI6TGM.js} +17 -17
  101. package/{chunk-SCYQJPGA.js → chunk-X7SDOJUM.js} +147 -20
  102. package/chunk-XFYFMTOM.js +92 -0
  103. package/{chunk-LT3EAHJY.js → chunk-XHQC4PXX.js} +65 -49
  104. package/{chunk-2WZXXAQD.js → chunk-YB3YZK56.js} +67 -1
  105. package/{chunk-JKW6LERJ.js → chunk-YJAFKXMU.js} +14 -14
  106. package/{chunk-GSQNH63I.js → chunk-YTF4WH7J.js} +3 -19
  107. package/{chunk-DA7CTWT4.js → chunk-YWSEPJ7C.js} +5 -5
  108. package/{chunk-3V2QMRNN.js → chunk-ZL5RAEEB.js} +3 -3
  109. package/{chunk-NEZGPBL7.js → chunk-ZNWI6OVT.js} +2 -2
  110. package/{chunk-MBS6CTZB.js → chunk-ZXOUUDCG.js} +266 -2014
  111. package/cliAgentConfigHelpers-WJBZQTLW.js +41 -0
  112. package/{commandRegistry-FI2IOQ3U.js → commandRegistry-W63CYRZJ.js} +91 -87
  113. package/{contentThunks-5LKNNDGY.js → contentThunks-U7PL5MQD.js} +27 -26
  114. package/{cooldownCommands-YXLWOXWR.js → cooldownCommands-TIGUHXTD.js} +3 -3
  115. package/{createAgentAutomationAction-TI4QG4CY.js → createAgentAutomationAction-OLBQDD6R.js} +27 -26
  116. package/{createDialogAction-TJ3JKLO4.js → createDialogAction-SVH6B3SB.js} +29 -28
  117. package/{createPageAction-GKXT6WEH.js → createPageAction-F4DIWZ2Z.js} +29 -28
  118. package/{dbSlice-LPMZ2DGJ.js → dbSlice-BVH2YZPQ.js} +8 -8
  119. package/{deleteFile-EPUQHKPA.js → deleteFile-5YOEKV4U.js} +4 -4
  120. package/{dialogCommands-IWPXIZ5P.js → dialogCommands-KHIEPY3M.js} +38 -36
  121. package/{dialogSlice-ZWNNS7GZ.js → dialogSlice-ZCTDV2PZ.js} +25 -24
  122. package/{dialogUsageCommand-ZCPPHPJ5.js → dialogUsageCommand-7KCPYGHG.js} +1 -1
  123. package/{docCreateCommands-HFSPKJSI.js → docCreateCommands-DPMZI7G5.js} +32 -30
  124. package/{docDeleteCommands-CRL62POH.js → docDeleteCommands-IRQQLUBT.js} +34 -33
  125. package/{docReadCommands-QOTOX3XW.js → docReadCommands-LK37XH6L.js} +32 -30
  126. package/{docStore-WYLRB7ED.js → docStore-V2KECILA.js} +11 -11
  127. package/{docUpdateCommands-7BMH4MCA.js → docUpdateCommands-O6T3HJHH.js} +32 -30
  128. package/{fetchMessages-YY4SATNR.js → fetchMessages-NR4KNQLO.js} +3 -3
  129. package/{getPricing-OQXBJ6VZ.js → getPricing-2MNMXEVG.js} +3 -3
  130. package/{handleSendMessageAction-P27YP2DQ.js → handleSendMessageAction-2PE25WM3.js} +49 -47
  131. package/hostCredentialCreate-S233UMAP.js +357 -0
  132. package/index.js +7 -7
  133. package/{keys-P4ZDOVJW.js → keys-BEGDOTRL.js} +3 -1
  134. package/{localDialogRead-5VCMQQZF.js → localDialogRead-7NNDVVF7.js} +1 -1
  135. package/{localRuntimeAdapter-GP6ZSSO3.js → localRuntimeAdapter-KY6WXNBR.js} +82 -75
  136. package/{machineCommands-6Z6H4BFX.js → machineCommands-Q6HA3IXF.js} +74 -69
  137. package/{machineWsRunDispatch-F2ZIXMYM.js → machineWsRunDispatch-WWJQ6WR3.js} +74 -69
  138. package/{memberThunks-YSEFJF47.js → memberThunks-7EDJADWU.js} +9 -9
  139. package/package.json +1 -1
  140. package/{projectArchive-PIGEOX3D.js → projectArchive-DRTDIMEV.js} +29 -28
  141. package/{providerPresetApply-ZYMLQA46.js → providerPresetApply-YXGV6NXB.js} +4 -4
  142. package/{providerRegistry-E34XWDLJ.js → providerRegistry-S6UL6UNA.js} +4 -4
  143. package/{read-DIIQBOOO.js → read-4V2RMG7N.js} +4 -4
  144. package/{readDocTool-HXYGOEA7.js → readDocTool-BH6ATGQO.js} +1 -1
  145. package/{readlineWorkspace-UG25G7KC.js → readlineWorkspace-2W4WRCOU.js} +437 -217
  146. package/{removeDialogAgentAction-ALJDUJ2E.js → removeDialogAgentAction-LYAZGNKW.js} +18 -15
  147. package/{runAgentClientLoop-IO5F7TCZ.js → runAgentClientLoop-J2VQBS2Z.js} +55 -52
  148. package/{runtimeDoctorCommands-PGAA47G5.js → runtimeDoctorCommands-QAI3MBKQ.js} +6 -6
  149. package/{secretCommands-ZCZ4KVET.js → secretCommands-LXDWOLZ6.js} +4 -4
  150. package/{setDialogExtraReferencesAction-O3SVMD5A.js → setDialogExtraReferencesAction-OCRPGPYH.js} +11 -11
  151. package/{setPrimaryDialogAgentAction-HE7RVFFF.js → setPrimaryDialogAgentAction-HFJDQIBU.js} +19 -16
  152. package/{settingThunks-BWWJQG4L.js → settingThunks-RAMHMTGM.js} +13 -12
  153. package/{spaceCommands-UAELIFEI.js → spaceCommands-KVJZVKVO.js} +32 -31
  154. package/{streamAgentChatTurn-VUKZQYJR.js → streamAgentChatTurn-GHBMJJ6S.js} +63 -60
  155. package/{switchDialogAgentAction-3VZS7SOS.js → switchDialogAgentAction-EBRMW3RA.js} +16 -13
  156. package/{tools-VRXJAVYI.js → tools-EWKCPKMS.js} +49 -46
  157. package/{tuiSummaryLlmCaller-TGCHZLSW.js → tuiSummaryLlmCaller-ALQYUUWB.js} +48 -19
  158. package/{updateCommands-Q6CYAEYJ.js → updateCommands-ZQYU6SCI.js} +5 -3
  159. package/{updateDialogTitleAction-MULWCJCW.js → updateDialogTitleAction-5GGMBTDF.js} +40 -72
  160. package/usageCommand-F4IPVMIZ.js +32 -0
  161. package/usageRebuildCommand-HAW2AD5N.js +626 -0
  162. package/{windowsSelfUpdate-XSQVF2GK.js → windowsSelfUpdate-257DV2T6.js} +2 -2
  163. package/{workloadLifecycle-4BEQHMSD.js → workloadLifecycle-4C42SVBD.js} +1 -0
  164. package/chunk-4LCOCOR5.js +0 -50
  165. package/chunk-7AUQ3WCW.js +0 -51
  166. package/chunk-ZRAU6T47.js +0 -56
  167. package/{agentFavoriteCommands-GAFEXKKP.js → agentFavoriteCommands-EDK743YA.js} +1 -1
  168. package/{agentGrantCommands-V5FOQKFD.js → agentGrantCommands-RQWK2TEV.js} +1 -1
  169. package/{agentPullCommand-2JMJP5BS.js → agentPullCommand-6EM3URVK.js} +1 -1
  170. package/{chunk-A2ZMIRLN.js → chunk-INN4LTAJ.js} +5 -5
  171. package/{chunk-PV6JJAUB.js → chunk-TCZHTTUU.js} +8 -8
  172. package/{chunk-AKE53VMW.js → chunk-ZCWRMUWT.js} +0 -0
  173. package/{tableCommands-D7WR4QSM.js → tableCommands-MP6VFSVT.js} +3 -3
@@ -1,6 +1,10 @@
1
1
  import {
2
2
  LOCAL_USER_ID
3
3
  } from "./chunk-TZXPT53C.js";
4
+ import {
5
+ applyTokenUsageToDayStats,
6
+ require_format
7
+ } from "./chunk-7RFNTILS.js";
4
8
  import {
5
9
  buildDialogAttachmentPlan,
6
10
  extractFileContentIds
@@ -11,30 +15,24 @@ import {
11
15
  } from "./chunk-523DITKR.js";
12
16
  import {
13
17
  runLlm
14
- } from "./chunk-ADBWFYJD.js";
18
+ } from "./chunk-KFLT5KAD.js";
15
19
  import {
16
20
  isMediaToolConfirmation
17
21
  } from "./chunk-QYPE3TS3.js";
18
22
  import {
19
23
  cleanupCliSessionForDialog
20
- } from "./chunk-NLT32XBZ.js";
24
+ } from "./chunk-NJLL224W.js";
21
25
  import {
22
26
  getApproxPricePerImage
23
27
  } from "./chunk-4JH2UMJR.js";
24
28
  import {
25
29
  addContentAction
26
- } from "./chunk-DQLB4NQ3.js";
30
+ } from "./chunk-GPVRUGGY.js";
27
31
  import {
28
32
  getActiveDialogAgentId,
29
33
  getDialogAgentIds,
30
34
  getPrimaryDialogAgentId
31
35
  } from "./chunk-5RGU3J7P.js";
32
- import {
33
- _typeof,
34
- addLeadingZeros,
35
- requiredArgs,
36
- toDate
37
- } from "./chunk-4LCOCOR5.js";
38
36
  import {
39
37
  abortActiveControllers,
40
38
  addPageReferenceToRuntime,
@@ -61,19 +59,19 @@ import {
61
59
  selectById,
62
60
  upload,
63
61
  write
64
- } from "./chunk-UMEGDH6A.js";
62
+ } from "./chunk-FW6YHHLI.js";
65
63
  import {
66
64
  getRuntimeServerContext,
67
65
  parseOwnerUserIdFromDbKey,
68
66
  scheduleDeleteReplication
69
- } from "./chunk-UCPAVEQB.js";
67
+ } from "./chunk-PYRUW7XN.js";
70
68
  import {
71
69
  asyncThunkCreator,
72
70
  buildCreateSlice,
73
71
  createAsyncThunk,
74
72
  createEntityAdapter,
75
73
  createSelector
76
- } from "./chunk-X4F26D5K.js";
74
+ } from "./chunk-P5L7CXOC.js";
77
75
  import {
78
76
  createClientLogger
79
77
  } from "./chunk-QQ56R7KS.js";
@@ -84,13 +82,13 @@ import {
84
82
  } from "./chunk-PXYBUFDB.js";
85
83
  import {
86
84
  fetchMessages
87
- } from "./chunk-Y2WUYX4I.js";
85
+ } from "./chunk-EHSZD5OI.js";
88
86
  import {
89
87
  getRecordTimestamp,
90
88
  getTombstoneTimestamp,
91
89
  isTombstoneRecord,
92
90
  shouldReplaceWithNextRecord
93
- } from "./chunk-D2MDMY2M.js";
91
+ } from "./chunk-SVYO6AO7.js";
94
92
  import {
95
93
  nolotusId
96
94
  } from "./chunk-Y6ORVLSS.js";
@@ -102,28 +100,28 @@ import {
102
100
  STAGNANT_TOOL_CALLS_FALLBACK_MESSAGE,
103
101
  STREAM_TRUNCATED_FALLBACK_MESSAGE,
104
102
  asOptionalJsonRecord,
103
+ codexOAuthCatalogWindow,
105
104
  devinChannelContextWindow,
106
105
  extractReferenceKeysFromMessage,
106
+ isCodexOAuthAgent,
107
107
  normalizeUsage,
108
108
  resolveAutoExecutionProfile
109
- } from "./chunk-WTKYP6QO.js";
110
- import {
111
- isDevinOAuthAgent
112
- } from "./chunk-5ZUL4CUO.js";
109
+ } from "./chunk-V5Y3R6BT.js";
113
110
  import {
114
111
  COMPACTION_SUMMARY_SYSTEM_PROMPT,
115
112
  DEFAULT_CONTEXT_WINDOW,
113
+ buildBoundedCompactionRequest,
116
114
  buildCompactionMetricsFromPlan,
117
- buildCompactionUserContent,
118
115
  computeSummarySourceMetadata,
119
116
  findModelContextWindow,
120
117
  formatCompactionMetricsLog,
121
- formatFileOperationsFromMessages,
122
- formatMessagesForSummaryWithTruncation,
123
118
  getModelInfo,
124
119
  planCompression,
125
120
  serializeMessageContent
126
- } from "./chunk-BTYQAODF.js";
121
+ } from "./chunk-7BT37FK3.js";
122
+ import {
123
+ isDevinOAuthAgent
124
+ } from "./chunk-5ZUL4CUO.js";
127
125
  import {
128
126
  isOAuthApiKeyRef
129
127
  } from "./chunk-UKZX3NHN.js";
@@ -158,6 +156,27 @@ import {
158
156
  import {
159
157
  isRecord
160
158
  } from "./chunk-KUG52IAP.js";
159
+ import {
160
+ PLATFORM_HOSTED_CLAUDE_FABLE_5_MODEL,
161
+ PLATFORM_HOSTED_CLAUDE_FABLE_5_PRICE,
162
+ PLATFORM_HOSTED_CLAUDE_OPUS_5_MODEL,
163
+ PLATFORM_HOSTED_CLAUDE_OPUS_5_PRICE,
164
+ PLATFORM_HOSTED_CLAUDE_SONNET_5_MODEL,
165
+ PLATFORM_HOSTED_CLAUDE_SONNET_5_PRICE,
166
+ PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL,
167
+ PLATFORM_HOSTED_DEEPSEEK_PRO_MODEL,
168
+ PLATFORM_HOSTED_GLM_53_FLASH_BASETEN_PRICE,
169
+ getPlatformHostedDeepSeekV4Price,
170
+ isPlatformHostedDeepSeekV4Model,
171
+ isPlatformHostedImageModel,
172
+ isPlatformHostedOpenAIImageModel,
173
+ isPlatformManagedProvider,
174
+ resolvePlatformEffectiveModel,
175
+ resolvePlatformHostedRouting
176
+ } from "./chunk-GOO6G4PY.js";
177
+ import {
178
+ asTrimmedLowercaseString
179
+ } from "./chunk-QSJ3HFEF.js";
161
180
  import {
162
181
  API_ENDPOINTS
163
182
  } from "./chunk-LCBAMY2M.js";
@@ -169,7 +188,7 @@ import {
169
188
  createKey,
170
189
  createTokenKey,
171
190
  createTokenStatsKey
172
- } from "./chunk-ECX3NKRD.js";
191
+ } from "./chunk-JY5NGFFH.js";
173
192
  import {
174
193
  createDialogMessageKeyAndId,
175
194
  dialogMessageKey
@@ -183,27 +202,6 @@ import {
183
202
  import {
184
203
  asOptionalTrimmedString
185
204
  } from "./chunk-G3SUCT4W.js";
186
- import {
187
- PLATFORM_HOSTED_CLAUDE_FABLE_5_MODEL,
188
- PLATFORM_HOSTED_CLAUDE_FABLE_5_PRICE,
189
- PLATFORM_HOSTED_CLAUDE_OPUS_5_MODEL,
190
- PLATFORM_HOSTED_CLAUDE_OPUS_5_PRICE,
191
- PLATFORM_HOSTED_CLAUDE_SONNET_5_MODEL,
192
- PLATFORM_HOSTED_CLAUDE_SONNET_5_PRICE,
193
- PLATFORM_HOSTED_DEEPSEEK_FLASH_MODEL,
194
- PLATFORM_HOSTED_DEEPSEEK_PRO_MODEL,
195
- PLATFORM_HOSTED_GLM_53_FLASH_BASETEN_PRICE,
196
- getPlatformHostedDeepSeekV4Price,
197
- isPlatformHostedDeepSeekV4Model,
198
- isPlatformHostedImageModel,
199
- isPlatformHostedOpenAIImageModel,
200
- isPlatformManagedProvider,
201
- resolvePlatformEffectiveModel,
202
- resolvePlatformHostedRouting
203
- } from "./chunk-GOO6G4PY.js";
204
- import {
205
- asTrimmedLowercaseString
206
- } from "./chunk-QSJ3HFEF.js";
207
205
  import {
208
206
  __toESM
209
207
  } from "./chunk-4VNS5WPM.js";
@@ -234,7 +232,7 @@ var addReferenceKeysAction = createAsyncThunk(
234
232
  const dialogConfig = selectById(state, dialogKey);
235
233
  if (!dialogConfig) return;
236
234
  const existingKeys = new Set(dialogConfig.referenceKeys || []);
237
- const keysToAdd = newKeys.filter((k2) => !existingKeys.has(k2));
235
+ const keysToAdd = newKeys.filter((k) => !existingKeys.has(k));
238
236
  if (keysToAdd.length === 0) return;
239
237
  const updatedKeys = [...Array.from(existingKeys), ...keysToAdd];
240
238
  await dispatch(
@@ -292,7 +290,7 @@ function planDeleteMessageCascade(msg, entities) {
292
290
  const parent = entities[msg.parentMessageId];
293
291
  if (parent && parent.role === "assistant" && isAssistantToolStub(parent)) {
294
292
  const hasOtherToolMsgs = Object.values(entities).some(
295
- (m3) => m3 && m3.role === "tool" && m3.parentMessageId === msg.parentMessageId && m3.dbKey !== msg.dbKey
293
+ (m) => m && m.role === "tool" && m.parentMessageId === msg.parentMessageId && m.dbKey !== msg.dbKey
296
294
  );
297
295
  if (!hasOtherToolMsgs) {
298
296
  extraRemoveId = parent.id;
@@ -536,20 +534,20 @@ function swallowNonAbortError(promise, fallback, signal) {
536
534
  }
537
535
 
538
536
  // packages/chat/messages/fetchAndCacheMessages.ts
539
- var sortByCreatedAtDesc = (a3, b2) => {
540
- const aCreated = a3 && typeof a3 === "object" && "createdAt" in a3 ? a3.createdAt : void 0;
541
- const bCreated = b2 && typeof b2 === "object" && "createdAt" in b2 ? b2.createdAt : void 0;
537
+ var sortByCreatedAtDesc = (a, b) => {
538
+ const aCreated = a && typeof a === "object" && "createdAt" in a ? a.createdAt : void 0;
539
+ const bCreated = b && typeof b === "object" && "createdAt" in b ? b.createdAt : void 0;
542
540
  const tA = new Date(aCreated || 0).getTime();
543
541
  const tB = new Date(bCreated || 0).getTime();
544
542
  return tB - tA;
545
543
  };
546
544
  var mergeVisibleRecords = (seed, incoming) => {
547
545
  const byId = /* @__PURE__ */ new Map();
548
- const put = (m3) => {
549
- if (!m3 || !m3.id) return;
550
- const existing = byId.get(m3.id);
551
- if (existing && !shouldReplaceWithNextRecord(m3, existing)) return;
552
- byId.set(m3.id, m3);
546
+ const put = (m) => {
547
+ if (!m || !m.id) return;
548
+ const existing = byId.get(m.id);
549
+ if (existing && !shouldReplaceWithNextRecord(m, existing)) return;
550
+ byId.set(m.id, m);
553
551
  };
554
552
  seed.forEach(put);
555
553
  incoming.forEach(put);
@@ -636,16 +634,16 @@ var fetchAndCacheMessagesLocalFirst = async ({
636
634
  }).catch(() => []);
637
635
  const uniqueMap = /* @__PURE__ */ new Map();
638
636
  const changedMessagesToCache = /* @__PURE__ */ new Map();
639
- const put = (m3, trackChange = false) => {
640
- if (!m3 || !m3.id) return;
641
- const existing = uniqueMap.get(m3.id);
642
- if (existing && !shouldReplaceWithNextRecord(m3, existing)) return;
643
- uniqueMap.set(m3.id, m3);
644
- if (trackChange) changedMessagesToCache.set(m3.id, m3);
637
+ const put = (m, trackChange = false) => {
638
+ if (!m || !m.id) return;
639
+ const existing = uniqueMap.get(m.id);
640
+ if (existing && !shouldReplaceWithNextRecord(m, existing)) return;
641
+ uniqueMap.set(m.id, m);
642
+ if (trackChange) changedMessagesToCache.set(m.id, m);
645
643
  };
646
- localMsgs.forEach((m3) => put(m3));
647
- freshLocalMsgs.forEach((m3) => put(m3));
648
- remoteMsgs.forEach((m3) => put(m3, true));
644
+ localMsgs.forEach((m) => put(m));
645
+ freshLocalMsgs.forEach((m) => put(m));
646
+ remoteMsgs.forEach((m) => put(m, true));
649
647
  for (const [recordId, record] of uniqueMap) {
650
648
  if (isTombstoneRecord(record)) finalTombstonesById.set(recordId, record);
651
649
  }
@@ -739,6 +737,9 @@ function resolveOccupancyWindow(ref) {
739
737
  if (isDevinOAuthAgent(ref)) {
740
738
  return devinChannelContextWindow(ref.model) ?? findModelContextWindow(ref.model, ref.provider);
741
739
  }
740
+ if (isCodexOAuthAgent(ref)) {
741
+ return codexOAuthCatalogWindow(ref.model) ?? findModelContextWindow(ref.model, ref.provider);
742
+ }
742
743
  return findModelContextWindow(ref.model, ref.provider);
743
744
  }
744
745
 
@@ -782,32 +783,32 @@ function resolveBuiltinAgentRuntimeFields(agentKey) {
782
783
  }
783
784
 
784
785
  // packages/agent-runtime/builtinPlatformAgentConfigs.ts
785
- function buildConfig(e2) {
786
- const key = publicAgentKey(e2.id);
786
+ function buildConfig(e) {
787
+ const key = publicAgentKey(e.id);
787
788
  const rawRecord = {
788
789
  dbKey: key,
789
790
  isPublic: true,
790
- provider: e2.provider,
791
- model: e2.model,
792
- apiSource: e2.apiSource ?? "platform",
793
- useServerProxy: e2.useServerProxy ?? true
791
+ provider: e.provider,
792
+ model: e.model,
793
+ apiSource: e.apiSource ?? "platform",
794
+ useServerProxy: e.useServerProxy ?? true
794
795
  };
795
- if (e2.hasImageOutput) rawRecord.hasImageOutput = true;
796
- if (e2.imageModel) rawRecord.imageModel = e2.imageModel;
797
- if (e2.imageWorkflow) rawRecord.imageWorkflow = e2.imageWorkflow;
798
- if (e2.imageConfig) rawRecord.imageConfig = e2.imageConfig;
796
+ if (e.hasImageOutput) rawRecord.hasImageOutput = true;
797
+ if (e.imageModel) rawRecord.imageModel = e.imageModel;
798
+ if (e.imageWorkflow) rawRecord.imageWorkflow = e.imageWorkflow;
799
+ if (e.imageConfig) rawRecord.imageConfig = e.imageConfig;
799
800
  return {
800
801
  key,
801
- name: e2.name,
802
- provider: e2.provider,
803
- model: e2.model,
804
- apiSource: e2.apiSource ?? "platform",
805
- useServerProxy: e2.useServerProxy ?? true,
802
+ name: e.name,
803
+ provider: e.provider,
804
+ model: e.model,
805
+ apiSource: e.apiSource ?? "platform",
806
+ useServerProxy: e.useServerProxy ?? true,
806
807
  rawRecord
807
808
  };
808
809
  }
809
810
  var BUILTIN_PLATFORM_AGENT_CONFIGS = Object.fromEntries(
810
- builtinRuntimeFallbackEntries().map((e2) => [publicAgentKey(e2.id), buildConfig(e2)])
811
+ builtinRuntimeFallbackEntries().map((e) => [publicAgentKey(e.id), buildConfig(e)])
811
812
  );
812
813
  function resolveBuiltinPlatformAgentConfig(agentRef) {
813
814
  return BUILTIN_PLATFORM_AGENT_CONFIGS[agentRef] ?? null;
@@ -872,14 +873,14 @@ var ToastStore = class {
872
873
  getSnapshot = () => this.toasts;
873
874
  add(item) {
874
875
  const id = item.id ?? `toast-${++this.nextId}`;
875
- const filtered = this.toasts.filter((t3) => t3.id !== id);
876
+ const filtered = this.toasts.filter((t2) => t2.id !== id);
876
877
  const entry = { ...item, id, phase: "entering" };
877
878
  this.toasts = [...filtered, entry];
878
879
  this.notify();
879
880
  raf(
880
881
  () => raf(() => {
881
882
  this.toasts = this.toasts.map(
882
- (t3) => t3.id === id ? { ...t3, phase: "visible" } : t3
883
+ (t2) => t2.id === id ? { ...t2, phase: "visible" } : t2
883
884
  );
884
885
  this.notify();
885
886
  })
@@ -891,16 +892,16 @@ var ToastStore = class {
891
892
  }
892
893
  close(id) {
893
894
  if (id) {
894
- if (!this.toasts.some((t3) => t3.id === id)) return;
895
+ if (!this.toasts.some((t2) => t2.id === id)) return;
895
896
  this.toasts = this.toasts.map(
896
- (t3) => t3.id === id ? { ...t3, phase: "exiting" } : t3
897
+ (t2) => t2.id === id ? { ...t2, phase: "exiting" } : t2
897
898
  );
898
899
  } else {
899
- this.toasts = this.toasts.map((t3) => ({ ...t3, phase: "exiting" }));
900
+ this.toasts = this.toasts.map((t2) => ({ ...t2, phase: "exiting" }));
900
901
  }
901
902
  this.notify();
902
903
  setTimeout(() => {
903
- this.toasts = id ? this.toasts.filter((t3) => t3.id !== id) : [];
904
+ this.toasts = id ? this.toasts.filter((t2) => t2.id !== id) : [];
904
905
  this.notify();
905
906
  }, EXIT_MS);
906
907
  }
@@ -954,9 +955,9 @@ var makeString = (object) => {
954
955
  if (object == null) return "";
955
956
  return "" + object;
956
957
  };
957
- var copy = (a3, s3, t3) => {
958
- a3.forEach((m3) => {
959
- if (s3[m3]) t3[m3] = s3[m3];
958
+ var copy = (a, s, t2) => {
959
+ a.forEach((m) => {
960
+ if (s[m]) t2[m] = s[m];
960
961
  });
961
962
  };
962
963
  var lastOfPathSeparatorRegExp = /###/g;
@@ -985,40 +986,40 @@ var getLastOfPath = (object, path, Empty) => {
985
986
  var setPath = (object, path, newValue) => {
986
987
  const {
987
988
  obj,
988
- k: k2
989
+ k
989
990
  } = getLastOfPath(object, path, Object);
990
991
  if (obj !== void 0 || path.length === 1) {
991
- obj[k2] = newValue;
992
+ obj[k] = newValue;
992
993
  return;
993
994
  }
994
- let e2 = path[path.length - 1];
995
+ let e = path[path.length - 1];
995
996
  let p = path.slice(0, path.length - 1);
996
997
  let last = getLastOfPath(object, p, Object);
997
998
  while (last.obj === void 0 && p.length) {
998
- e2 = `${p[p.length - 1]}.${e2}`;
999
+ e = `${p[p.length - 1]}.${e}`;
999
1000
  p = p.slice(0, p.length - 1);
1000
1001
  last = getLastOfPath(object, p, Object);
1001
- if (last && last.obj && typeof last.obj[`${last.k}.${e2}`] !== "undefined") {
1002
+ if (last && last.obj && typeof last.obj[`${last.k}.${e}`] !== "undefined") {
1002
1003
  last.obj = void 0;
1003
1004
  }
1004
1005
  }
1005
- last.obj[`${last.k}.${e2}`] = newValue;
1006
+ last.obj[`${last.k}.${e}`] = newValue;
1006
1007
  };
1007
1008
  var pushPath = (object, path, newValue, concat) => {
1008
1009
  const {
1009
1010
  obj,
1010
- k: k2
1011
+ k
1011
1012
  } = getLastOfPath(object, path, Object);
1012
- obj[k2] = obj[k2] || [];
1013
- obj[k2].push(newValue);
1013
+ obj[k] = obj[k] || [];
1014
+ obj[k].push(newValue);
1014
1015
  };
1015
1016
  var getPath = (object, path) => {
1016
1017
  const {
1017
1018
  obj,
1018
- k: k2
1019
+ k
1019
1020
  } = getLastOfPath(object, path);
1020
1021
  if (!obj) return void 0;
1021
- return obj[k2];
1022
+ return obj[k];
1022
1023
  };
1023
1024
  var getPathWithDefaults = (data, defaultData, key) => {
1024
1025
  const value = getPath(data, key);
@@ -1054,7 +1055,7 @@ var _entityMap = {
1054
1055
  };
1055
1056
  var escape = (data) => {
1056
1057
  if (isString(data)) {
1057
- return data.replace(/[&<>"'\/]/g, (s3) => _entityMap[s3]);
1058
+ return data.replace(/[&<>"'\/]/g, (s) => _entityMap[s]);
1058
1059
  }
1059
1060
  return data;
1060
1061
  };
@@ -1083,9 +1084,9 @@ var looksLikeObjectPathRegExpCache = new RegExpCache(20);
1083
1084
  var looksLikeObjectPath = (key, nsSeparator, keySeparator) => {
1084
1085
  nsSeparator = nsSeparator || "";
1085
1086
  keySeparator = keySeparator || "";
1086
- const possibleChars = chars.filter((c2) => nsSeparator.indexOf(c2) < 0 && keySeparator.indexOf(c2) < 0);
1087
+ const possibleChars = chars.filter((c) => nsSeparator.indexOf(c) < 0 && keySeparator.indexOf(c) < 0);
1087
1088
  if (possibleChars.length === 0) return true;
1088
- const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map((c2) => c2 === "?" ? "\\?" : c2).join("|")})`);
1089
+ const r = looksLikeObjectPathRegExpCache.getRegExp(`(${possibleChars.map((c) => c === "?" ? "\\?" : c).join("|")})`);
1089
1090
  let matched = !r.test(key);
1090
1091
  if (!matched) {
1091
1092
  const ki = key.indexOf(keySeparator);
@@ -1101,14 +1102,14 @@ var deepFind = function(obj, path) {
1101
1102
  if (obj[path]) return obj[path];
1102
1103
  const tokens = path.split(keySeparator);
1103
1104
  let current = obj;
1104
- for (let i2 = 0; i2 < tokens.length; ) {
1105
+ for (let i = 0; i < tokens.length; ) {
1105
1106
  if (!current || typeof current !== "object") {
1106
1107
  return void 0;
1107
1108
  }
1108
1109
  let next;
1109
1110
  let nextPath = "";
1110
- for (let j = i2; j < tokens.length; ++j) {
1111
- if (j !== i2) {
1111
+ for (let j = i; j < tokens.length; ++j) {
1112
+ if (j !== i) {
1112
1113
  nextPath += keySeparator;
1113
1114
  }
1114
1115
  nextPath += tokens[j];
@@ -1117,7 +1118,7 @@ var deepFind = function(obj, path) {
1117
1118
  if (["string", "number", "boolean"].indexOf(typeof next) > -1 && j < tokens.length - 1) {
1118
1119
  continue;
1119
1120
  }
1120
- i2 += j - i2 + 1;
1121
+ i += j - i + 1;
1121
1122
  break;
1122
1123
  }
1123
1124
  }
@@ -1225,7 +1226,7 @@ var EventEmitter = class {
1225
1226
  const cloned = Array.from(this.observers[event].entries());
1226
1227
  cloned.forEach((_ref) => {
1227
1228
  let [observer, numTimesAdded] = _ref;
1228
- for (let i2 = 0; i2 < numTimesAdded; i2++) {
1229
+ for (let i = 0; i < numTimesAdded; i++) {
1229
1230
  observer(...args);
1230
1231
  }
1231
1232
  });
@@ -1234,7 +1235,7 @@ var EventEmitter = class {
1234
1235
  const cloned = Array.from(this.observers["*"].entries());
1235
1236
  cloned.forEach((_ref2) => {
1236
1237
  let [observer, numTimesAdded] = _ref2;
1237
- for (let i2 = 0; i2 < numTimesAdded; i2++) {
1238
+ for (let i = 0; i < numTimesAdded; i++) {
1238
1239
  observer.apply(observer, [event, ...args]);
1239
1240
  }
1240
1241
  });
@@ -1316,8 +1317,8 @@ var ResourceStore = class extends EventEmitter {
1316
1317
  let options = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {
1317
1318
  silent: false
1318
1319
  };
1319
- for (const m3 in resources) {
1320
- if (isString(resources[m3]) || Array.isArray(resources[m3])) this.addResource(lng, ns, m3, resources[m3], {
1320
+ for (const m in resources) {
1321
+ if (isString(resources[m]) || Array.isArray(resources[m])) this.addResource(lng, ns, m, resources[m], {
1321
1322
  silent: true
1322
1323
  });
1323
1324
  }
@@ -1424,8 +1425,8 @@ var Translator = class _Translator extends EventEmitter {
1424
1425
  const wouldCheckForNsInKey = nsSeparator && key.indexOf(nsSeparator) > -1;
1425
1426
  const seemsNaturalLanguage = !this.options.userDefinedKeySeparator && !options.keySeparator && !this.options.userDefinedNsSeparator && !options.nsSeparator && !looksLikeObjectPath(key, nsSeparator, keySeparator);
1426
1427
  if (wouldCheckForNsInKey && !seemsNaturalLanguage) {
1427
- const m3 = key.match(this.interpolator.nestingRegexp);
1428
- if (m3 && m3.length > 0) {
1428
+ const m = key.match(this.interpolator.nestingRegexp);
1429
+ if (m && m.length > 0) {
1429
1430
  return {
1430
1431
  key,
1431
1432
  namespaces: isString(namespaces) ? [namespaces] : namespaces
@@ -1515,17 +1516,17 @@ var Translator = class _Translator extends EventEmitter {
1515
1516
  const resTypeIsArray = Array.isArray(res);
1516
1517
  const copy2 = resTypeIsArray ? [] : {};
1517
1518
  const newKeyToUse = resTypeIsArray ? resExactUsedKey : resUsedKey;
1518
- for (const m3 in res) {
1519
- if (Object.prototype.hasOwnProperty.call(res, m3)) {
1520
- const deepKey = `${newKeyToUse}${keySeparator}${m3}`;
1521
- copy2[m3] = this.translate(deepKey, {
1519
+ for (const m in res) {
1520
+ if (Object.prototype.hasOwnProperty.call(res, m)) {
1521
+ const deepKey = `${newKeyToUse}${keySeparator}${m}`;
1522
+ copy2[m] = this.translate(deepKey, {
1522
1523
  ...options,
1523
1524
  ...{
1524
1525
  joinArrays: false,
1525
1526
  ns: namespaces
1526
1527
  }
1527
1528
  });
1528
- if (copy2[m3] === deepKey) copy2[m3] = res[m3];
1529
+ if (copy2[m] === deepKey) copy2[m] = res[m];
1529
1530
  }
1530
1531
  }
1531
1532
  res = copy2;
@@ -1567,22 +1568,22 @@ var Translator = class _Translator extends EventEmitter {
1567
1568
  let lngs = [];
1568
1569
  const fallbackLngs = this.languageUtils.getFallbackCodes(this.options.fallbackLng, options.lng || this.language);
1569
1570
  if (this.options.saveMissingTo === "fallback" && fallbackLngs && fallbackLngs[0]) {
1570
- for (let i2 = 0; i2 < fallbackLngs.length; i2++) {
1571
- lngs.push(fallbackLngs[i2]);
1571
+ for (let i = 0; i < fallbackLngs.length; i++) {
1572
+ lngs.push(fallbackLngs[i]);
1572
1573
  }
1573
1574
  } else if (this.options.saveMissingTo === "all") {
1574
1575
  lngs = this.languageUtils.toResolveHierarchy(options.lng || this.language);
1575
1576
  } else {
1576
1577
  lngs.push(options.lng || this.language);
1577
1578
  }
1578
- const send = (l, k2, specificDefaultValue) => {
1579
+ const send = (l, k, specificDefaultValue) => {
1579
1580
  const defaultForMissing = hasDefaultValue && specificDefaultValue !== res ? specificDefaultValue : resForMissing;
1580
1581
  if (this.options.missingKeyHandler) {
1581
- this.options.missingKeyHandler(l, namespace, k2, defaultForMissing, updateMissing, options);
1582
+ this.options.missingKeyHandler(l, namespace, k, defaultForMissing, updateMissing, options);
1582
1583
  } else if (this.backendConnector && this.backendConnector.saveMissing) {
1583
- this.backendConnector.saveMissing(l, namespace, k2, defaultForMissing, updateMissing, options);
1584
+ this.backendConnector.saveMissing(l, namespace, k, defaultForMissing, updateMissing, options);
1584
1585
  }
1585
- this.emit("missingKey", l, namespace, k2, res);
1586
+ this.emit("missingKey", l, namespace, k, res);
1586
1587
  };
1587
1588
  if (this.options.saveMissing) {
1588
1589
  if (this.options.saveMissingPlurals && needsPluralHandling) {
@@ -1687,9 +1688,9 @@ var Translator = class _Translator extends EventEmitter {
1687
1688
  let usedLng;
1688
1689
  let usedNS;
1689
1690
  if (isString(keys)) keys = [keys];
1690
- keys.forEach((k2) => {
1691
+ keys.forEach((k) => {
1691
1692
  if (this.isValidLookup(found)) return;
1692
- const extracted = this.extractFromKey(k2, options);
1693
+ const extracted = this.extractFromKey(k, options);
1693
1694
  const key = extracted.key;
1694
1695
  usedKey = key;
1695
1696
  let namespaces = extracted.namespaces;
@@ -1830,7 +1831,7 @@ var LanguageUtil = class {
1830
1831
  formattedCode = formattedCode.toLowerCase();
1831
1832
  }
1832
1833
  if (formattedCode) return formattedCode;
1833
- } catch (e2) {
1834
+ } catch (e) {
1834
1835
  }
1835
1836
  }
1836
1837
  const specialCases = ["hans", "hant", "latn", "cyrl", "cans", "mong", "arab"];
@@ -1898,12 +1899,12 @@ var LanguageUtil = class {
1898
1899
  toResolveHierarchy(code, fallbackCode) {
1899
1900
  const fallbackCodes = this.getFallbackCodes(fallbackCode || this.options.fallbackLng || [], code);
1900
1901
  const codes = [];
1901
- const addCode = (c2) => {
1902
- if (!c2) return;
1903
- if (this.isSupportedCode(c2)) {
1904
- codes.push(c2);
1902
+ const addCode = (c) => {
1903
+ if (!c) return;
1904
+ if (this.isSupportedCode(c)) {
1905
+ codes.push(c);
1905
1906
  } else {
1906
- this.logger.warn(`rejecting language code not found in supportedLngs: ${c2}`);
1907
+ this.logger.warn(`rejecting language code not found in supportedLngs: ${c}`);
1907
1908
  }
1908
1909
  };
1909
1910
  if (isString(code) && (code.indexOf("-") > -1 || code.indexOf("_") > -1)) {
@@ -2239,7 +2240,7 @@ var Interpolator = class {
2239
2240
  this.nestingRegexp = getOrResetRegExp(this.nestingRegexp, `${this.nestingPrefix}(.+?)${this.nestingSuffix}`);
2240
2241
  }
2241
2242
  interpolate(str, data, lng, options) {
2242
- let match2;
2243
+ let match;
2243
2244
  let value;
2244
2245
  let replaces;
2245
2246
  const defaultData = this.options && this.options.interpolation && this.options.interpolation.defaultVariables || {};
@@ -2253,12 +2254,12 @@ var Interpolator = class {
2253
2254
  }) : path;
2254
2255
  }
2255
2256
  const p = key.split(this.formatSeparator);
2256
- const k2 = p.shift().trim();
2257
+ const k = p.shift().trim();
2257
2258
  const f = p.join(this.formatSeparator).trim();
2258
- return this.format(deepFindWithDefaults(data, defaultData, k2, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {
2259
+ return this.format(deepFindWithDefaults(data, defaultData, k, this.options.keySeparator, this.options.ignoreJSONStructure), f, lng, {
2259
2260
  ...options,
2260
2261
  ...data,
2261
- interpolationkey: k2
2262
+ interpolationkey: k
2262
2263
  });
2263
2264
  };
2264
2265
  this.resetRegExp();
@@ -2273,17 +2274,17 @@ var Interpolator = class {
2273
2274
  }];
2274
2275
  todos.forEach((todo) => {
2275
2276
  replaces = 0;
2276
- while (match2 = todo.regex.exec(str)) {
2277
- const matchedVar = match2[1].trim();
2277
+ while (match = todo.regex.exec(str)) {
2278
+ const matchedVar = match[1].trim();
2278
2279
  value = handleFormat(matchedVar);
2279
2280
  if (value === void 0) {
2280
2281
  if (typeof missingInterpolationHandler === "function") {
2281
- const temp = missingInterpolationHandler(str, match2, options);
2282
+ const temp = missingInterpolationHandler(str, match, options);
2282
2283
  value = isString(temp) ? temp : "";
2283
2284
  } else if (options && Object.prototype.hasOwnProperty.call(options, matchedVar)) {
2284
2285
  value = "";
2285
2286
  } else if (skipOnVariables) {
2286
- value = match2[0];
2287
+ value = match[0];
2287
2288
  continue;
2288
2289
  } else {
2289
2290
  this.logger.warn(`missed to pass in variable ${matchedVar} for interpolating ${str}`);
@@ -2293,10 +2294,10 @@ var Interpolator = class {
2293
2294
  value = makeString(value);
2294
2295
  }
2295
2296
  const safeValue = todo.safeValue(value);
2296
- str = str.replace(match2[0], safeValue);
2297
+ str = str.replace(match[0], safeValue);
2297
2298
  if (skipOnVariables) {
2298
2299
  todo.regex.lastIndex += value.length;
2299
- todo.regex.lastIndex -= match2[0].length;
2300
+ todo.regex.lastIndex -= match[0].length;
2300
2301
  } else {
2301
2302
  todo.regex.lastIndex = 0;
2302
2303
  }
@@ -2310,15 +2311,15 @@ var Interpolator = class {
2310
2311
  }
2311
2312
  nest(str, fc) {
2312
2313
  let options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2313
- let match2;
2314
+ let match;
2314
2315
  let value;
2315
2316
  let clonedOptions;
2316
2317
  const handleHasOptions = (key, inheritedOptions) => {
2317
2318
  const sep = this.nestingOptionsSeparator;
2318
2319
  if (key.indexOf(sep) < 0) return key;
2319
- const c2 = key.split(new RegExp(`${sep}[ ]*{`));
2320
- let optionsString = `{${c2[1]}`;
2321
- key = c2[0];
2320
+ const c = key.split(new RegExp(`${sep}[ ]*{`));
2321
+ let optionsString = `{${c[1]}`;
2322
+ key = c[0];
2322
2323
  optionsString = this.interpolate(optionsString, clonedOptions);
2323
2324
  const matchedSingleQuotes = optionsString.match(/'/g);
2324
2325
  const matchedDoubleQuotes = optionsString.match(/"/g);
@@ -2331,15 +2332,15 @@ var Interpolator = class {
2331
2332
  ...inheritedOptions,
2332
2333
  ...clonedOptions
2333
2334
  };
2334
- } catch (e2) {
2335
- this.logger.warn(`failed parsing options string in nesting for key ${key}`, e2);
2335
+ } catch (e) {
2336
+ this.logger.warn(`failed parsing options string in nesting for key ${key}`, e);
2336
2337
  return `${key}${sep}${optionsString}`;
2337
2338
  }
2338
2339
  if (clonedOptions.defaultValue && clonedOptions.defaultValue.indexOf(this.prefix) > -1) delete clonedOptions.defaultValue;
2339
2340
  return key;
2340
2341
  };
2341
- while (match2 = this.nestingRegexp.exec(str)) {
2342
- let formatters3 = [];
2342
+ while (match = this.nestingRegexp.exec(str)) {
2343
+ let formatters = [];
2343
2344
  clonedOptions = {
2344
2345
  ...options
2345
2346
  };
@@ -2347,26 +2348,26 @@ var Interpolator = class {
2347
2348
  clonedOptions.applyPostProcessor = false;
2348
2349
  delete clonedOptions.defaultValue;
2349
2350
  let doReduce = false;
2350
- if (match2[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match2[1])) {
2351
- const r = match2[1].split(this.formatSeparator).map((elem) => elem.trim());
2352
- match2[1] = r.shift();
2353
- formatters3 = r;
2351
+ if (match[0].indexOf(this.formatSeparator) !== -1 && !/{.*}/.test(match[1])) {
2352
+ const r = match[1].split(this.formatSeparator).map((elem) => elem.trim());
2353
+ match[1] = r.shift();
2354
+ formatters = r;
2354
2355
  doReduce = true;
2355
2356
  }
2356
- value = fc(handleHasOptions.call(this, match2[1].trim(), clonedOptions), clonedOptions);
2357
- if (value && match2[0] === str && !isString(value)) return value;
2357
+ value = fc(handleHasOptions.call(this, match[1].trim(), clonedOptions), clonedOptions);
2358
+ if (value && match[0] === str && !isString(value)) return value;
2358
2359
  if (!isString(value)) value = makeString(value);
2359
2360
  if (!value) {
2360
- this.logger.warn(`missed to resolve ${match2[1]} for nesting ${str}`);
2361
+ this.logger.warn(`missed to resolve ${match[1]} for nesting ${str}`);
2361
2362
  value = "";
2362
2363
  }
2363
2364
  if (doReduce) {
2364
- value = formatters3.reduce((v, f) => this.format(v, f, options.lng, {
2365
+ value = formatters.reduce((v, f) => this.format(v, f, options.lng, {
2365
2366
  ...options,
2366
- interpolationkey: match2[1].trim()
2367
+ interpolationkey: match[1].trim()
2367
2368
  }), value.trim());
2368
2369
  }
2369
- str = str.replace(match2[0], value);
2370
+ str = str.replace(match[0], value);
2370
2371
  this.regexp.lastIndex = 0;
2371
2372
  }
2372
2373
  return str;
@@ -2508,10 +2509,10 @@ var Formatter = class {
2508
2509
  return result;
2509
2510
  }
2510
2511
  };
2511
- var removePending = (q2, name) => {
2512
- if (q2.pending[name] !== void 0) {
2513
- delete q2.pending[name];
2514
- q2.pendingCount--;
2512
+ var removePending = (q, name) => {
2513
+ if (q.pending[name] !== void 0) {
2514
+ delete q.pending[name];
2515
+ q.pendingCount--;
2515
2516
  }
2516
2517
  };
2517
2518
  var Connector = class extends EventEmitter {
@@ -2576,9 +2577,9 @@ var Connector = class extends EventEmitter {
2576
2577
  };
2577
2578
  }
2578
2579
  loaded(name, err, data) {
2579
- const s3 = name.split("|");
2580
- const lng = s3[0];
2581
- const ns = s3[1];
2580
+ const s = name.split("|");
2581
+ const lng = s[0];
2582
+ const ns = s[1];
2582
2583
  if (err) this.emit("failedLoading", lng, ns, err);
2583
2584
  if (!err && data) {
2584
2585
  this.store.addResourceBundle(lng, ns, data, void 0, void 0, {
@@ -2588,30 +2589,30 @@ var Connector = class extends EventEmitter {
2588
2589
  this.state[name] = err ? -1 : 2;
2589
2590
  if (err && data) this.state[name] = 0;
2590
2591
  const loaded = {};
2591
- this.queue.forEach((q2) => {
2592
- pushPath(q2.loaded, [lng], ns);
2593
- removePending(q2, name);
2594
- if (err) q2.errors.push(err);
2595
- if (q2.pendingCount === 0 && !q2.done) {
2596
- Object.keys(q2.loaded).forEach((l) => {
2592
+ this.queue.forEach((q) => {
2593
+ pushPath(q.loaded, [lng], ns);
2594
+ removePending(q, name);
2595
+ if (err) q.errors.push(err);
2596
+ if (q.pendingCount === 0 && !q.done) {
2597
+ Object.keys(q.loaded).forEach((l) => {
2597
2598
  if (!loaded[l]) loaded[l] = {};
2598
- const loadedKeys = q2.loaded[l];
2599
+ const loadedKeys = q.loaded[l];
2599
2600
  if (loadedKeys.length) {
2600
2601
  loadedKeys.forEach((n) => {
2601
2602
  if (loaded[l][n] === void 0) loaded[l][n] = true;
2602
2603
  });
2603
2604
  }
2604
2605
  });
2605
- q2.done = true;
2606
- if (q2.errors.length) {
2607
- q2.callback(q2.errors);
2606
+ q.done = true;
2607
+ if (q.errors.length) {
2608
+ q.callback(q.errors);
2608
2609
  } else {
2609
- q2.callback();
2610
+ q.callback();
2610
2611
  }
2611
2612
  }
2612
2613
  });
2613
2614
  this.emit("loaded", loaded);
2614
- this.queue = this.queue.filter((q2) => !q2.done);
2615
+ this.queue = this.queue.filter((q) => !q.done);
2615
2616
  }
2616
2617
  read(lng, ns, fcName) {
2617
2618
  let tried = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : 0;
@@ -2688,9 +2689,9 @@ var Connector = class extends EventEmitter {
2688
2689
  }
2689
2690
  loadOne(name) {
2690
2691
  let prefix = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
2691
- const s3 = name.split("|");
2692
- const lng = s3[0];
2693
- const ns = s3[1];
2692
+ const s = name.split("|");
2693
+ const lng = s[0];
2694
+ const ns = s[1];
2694
2695
  this.read(lng, ns, "read", void 0, void 0, (err, data) => {
2695
2696
  if (err) this.logger.warn(`${prefix}loading namespace ${ns} for language ${lng} failed`, err);
2696
2697
  if (!err && data) this.logger.log(`${prefix}loaded namespace ${ns} for language ${lng}`, data);
@@ -2890,38 +2891,38 @@ var I18n = class _I18n extends EventEmitter {
2890
2891
  }
2891
2892
  const lu = new LanguageUtil(this.options);
2892
2893
  this.store = new ResourceStore(this.options.resources, this.options);
2893
- const s3 = this.services;
2894
- s3.logger = baseLogger;
2895
- s3.resourceStore = this.store;
2896
- s3.languageUtils = lu;
2897
- s3.pluralResolver = new PluralResolver(lu, {
2894
+ const s = this.services;
2895
+ s.logger = baseLogger;
2896
+ s.resourceStore = this.store;
2897
+ s.languageUtils = lu;
2898
+ s.pluralResolver = new PluralResolver(lu, {
2898
2899
  prepend: this.options.pluralSeparator,
2899
2900
  compatibilityJSON: this.options.compatibilityJSON,
2900
2901
  simplifyPluralSuffix: this.options.simplifyPluralSuffix
2901
2902
  });
2902
2903
  if (formatter && (!this.options.interpolation.format || this.options.interpolation.format === defOpts.interpolation.format)) {
2903
- s3.formatter = createClassOnDemand(formatter);
2904
- s3.formatter.init(s3, this.options);
2905
- this.options.interpolation.format = s3.formatter.format.bind(s3.formatter);
2904
+ s.formatter = createClassOnDemand(formatter);
2905
+ s.formatter.init(s, this.options);
2906
+ this.options.interpolation.format = s.formatter.format.bind(s.formatter);
2906
2907
  }
2907
- s3.interpolator = new Interpolator(this.options);
2908
- s3.utils = {
2908
+ s.interpolator = new Interpolator(this.options);
2909
+ s.utils = {
2909
2910
  hasLoadedNamespace: this.hasLoadedNamespace.bind(this)
2910
2911
  };
2911
- s3.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s3.resourceStore, s3, this.options);
2912
- s3.backendConnector.on("*", function(event) {
2912
+ s.backendConnector = new Connector(createClassOnDemand(this.modules.backend), s.resourceStore, s, this.options);
2913
+ s.backendConnector.on("*", function(event) {
2913
2914
  for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
2914
2915
  args[_key - 1] = arguments[_key];
2915
2916
  }
2916
2917
  _this.emit(event, ...args);
2917
2918
  });
2918
2919
  if (this.modules.languageDetector) {
2919
- s3.languageDetector = createClassOnDemand(this.modules.languageDetector);
2920
- if (s3.languageDetector.init) s3.languageDetector.init(s3, this.options.detection, this.options);
2920
+ s.languageDetector = createClassOnDemand(this.modules.languageDetector);
2921
+ if (s.languageDetector.init) s.languageDetector.init(s, this.options.detection, this.options);
2921
2922
  }
2922
2923
  if (this.modules.i18nFormat) {
2923
- s3.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
2924
- if (s3.i18nFormat.init) s3.i18nFormat.init(this);
2924
+ s.i18nFormat = createClassOnDemand(this.modules.i18nFormat);
2925
+ if (s.i18nFormat.init) s.i18nFormat.init(this);
2925
2926
  }
2926
2927
  this.translator = new Translator(this.services, this.options);
2927
2928
  this.translator.on("*", function(event) {
@@ -2930,8 +2931,8 @@ var I18n = class _I18n extends EventEmitter {
2930
2931
  }
2931
2932
  _this.emit(event, ...args);
2932
2933
  });
2933
- this.modules.external.forEach((m3) => {
2934
- if (m3.init) m3.init(this);
2934
+ this.modules.external.forEach((m) => {
2935
+ if (m.init) m.init(this);
2935
2936
  });
2936
2937
  }
2937
2938
  this.format = this.options.interpolation.format;
@@ -2958,14 +2959,14 @@ var I18n = class _I18n extends EventEmitter {
2958
2959
  });
2959
2960
  const deferred = defer();
2960
2961
  const load = () => {
2961
- const finish = (err, t3) => {
2962
+ const finish = (err, t2) => {
2962
2963
  this.isInitializing = false;
2963
2964
  if (this.isInitialized && !this.initializedStoreOnce) this.logger.warn("init: i18next is already initialized. You should call init just once!");
2964
2965
  this.isInitialized = true;
2965
2966
  if (!this.options.isClone) this.logger.log("initialized", this.options);
2966
2967
  this.emit("initialized", this.options);
2967
- deferred.resolve(t3);
2968
- callback(err, t3);
2968
+ deferred.resolve(t2);
2969
+ callback(err, t2);
2969
2970
  };
2970
2971
  if (this.languages && this.options.compatibilityAPI !== "v1" && !this.isInitialized) return finish(null, this.t.bind(this));
2971
2972
  this.changeLanguage(this.options.lng, finish);
@@ -3003,9 +3004,9 @@ var I18n = class _I18n extends EventEmitter {
3003
3004
  if (this.options.preload) {
3004
3005
  this.options.preload.forEach((l) => append(l));
3005
3006
  }
3006
- this.services.backendConnector.load(toLoad, this.options.ns, (e2) => {
3007
- if (!e2 && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);
3008
- usedCallback(e2);
3007
+ this.services.backendConnector.load(toLoad, this.options.ns, (e) => {
3008
+ if (!e && !this.resolvedLanguage && this.language) this.setResolvedLanguage(this.language);
3009
+ usedCallback(e);
3009
3010
  });
3010
3011
  } else {
3011
3012
  usedCallback(null);
@@ -3144,7 +3145,7 @@ var I18n = class _I18n extends EventEmitter {
3144
3145
  const keySeparator = _this3.options.keySeparator || ".";
3145
3146
  let resultKey;
3146
3147
  if (options.keyPrefix && Array.isArray(key)) {
3147
- resultKey = key.map((k2) => `${options.keyPrefix}${keySeparator}${k2}`);
3148
+ resultKey = key.map((k) => `${options.keyPrefix}${keySeparator}${k}`);
3148
3149
  } else {
3149
3150
  resultKey = options.keyPrefix ? `${options.keyPrefix}${keySeparator}${key}` : key;
3150
3151
  }
@@ -3256,8 +3257,8 @@ var I18n = class _I18n extends EventEmitter {
3256
3257
  clone.logger = clone.logger.clone(options);
3257
3258
  }
3258
3259
  const membersToCopy = ["store", "services", "language"];
3259
- membersToCopy.forEach((m3) => {
3260
- clone[m3] = this[m3];
3260
+ membersToCopy.forEach((m) => {
3261
+ clone[m] = this[m];
3261
3262
  });
3262
3263
  clone.services = {
3263
3264
  ...this.services
@@ -8397,8 +8398,8 @@ var space_locale_default = {
8397
8398
 
8398
8399
  // packages/app/i18n/runtime.ts
8399
8400
  var RUNTIME_SLIM_MARKER = "__noloRuntimeSlimI18n";
8400
- function pick(locale2, lng) {
8401
- return (locale2[lng] ?? locale2["en" /* EN */]).translation;
8401
+ function pick(locale, lng) {
8402
+ return (locale[lng] ?? locale["en" /* EN */]).translation;
8402
8403
  }
8403
8404
  if (!instance.isInitialized) {
8404
8405
  const resources = {};
@@ -8488,31 +8489,34 @@ var updateDialogSummaryAction = async (args, thunkApi) => {
8488
8489
  } : {}
8489
8490
  });
8490
8491
  if (!plan.shouldCompress) return;
8491
- const { msgsToCompress, newSummarizedBeforeId } = plan;
8492
- const extractedKeys = new Set(dialogConfig.referenceKeys || []);
8493
- for (const msg of msgsToCompress) {
8494
- for (const key of extractReferenceKeysFromMessage(msg)) {
8495
- extractedKeys.add(key);
8496
- }
8497
- }
8498
8492
  const previousSummary = dialogConfig.summary || "";
8499
- const messagesText = formatMessagesForSummaryWithTruncation(msgsToCompress);
8500
- const fileOpsText = formatFileOperationsFromMessages(
8501
- msgsToCompress,
8502
- identityCanonicalName
8493
+ const summaryWindow = Math.min(
8494
+ resolveAgentContextWindow({ model: BUILTIN_SUMMARY_LLM_CONFIG.model, provider: BUILTIN_SUMMARY_LLM_CONFIG.provider }) ?? 32768,
8495
+ resolveAgentContextWindow({ model: BUILTIN_DIALOG_LLM_FALLBACK_MODEL, provider: BUILTIN_SUMMARY_LLM_CONFIG.provider }) ?? 32768
8503
8496
  );
8504
- const promptContent = buildCompactionUserContent({
8497
+ const request = buildBoundedCompactionRequest({
8498
+ msgsToCompress: plan.msgsToCompress,
8505
8499
  previousSummary,
8506
- messagesText,
8507
- fileOpsText
8500
+ contextWindow: summaryWindow,
8501
+ canonicalizeToolName: identityCanonicalName
8508
8502
  });
8503
+ if (request.status === "blocked") {
8504
+ notifyCompressionFailure(new Error(`\u6458\u8981\u8BF7\u6C42\u65E0\u6CD5\u5B89\u5168\u6784\u5EFA\uFF08${request.reason}\uFF09\uFF0C\u539F\u5386\u53F2\u4FDD\u6301\u4E0D\u53D8`));
8505
+ return;
8506
+ }
8507
+ const { coveredMessages, summarizedBeforeId: newSummarizedBeforeId, promptContent, outputTokenBudget } = request;
8508
+ const extractedKeys = new Set(dialogConfig.referenceKeys || []);
8509
+ for (const msg of coveredMessages) {
8510
+ for (const key of extractReferenceKeysFromMessage(msg)) extractedKeys.add(key);
8511
+ }
8509
8512
  try {
8510
8513
  const runSummaryLlm = (model) => dispatch(
8511
8514
  runLlm({
8512
8515
  llmConfig: {
8513
8516
  ...BUILTIN_SUMMARY_LLM_CONFIG,
8514
8517
  ...model ? { model } : {},
8515
- prompt: COMPACTION_SUMMARY_SYSTEM_PROMPT
8518
+ prompt: COMPACTION_SUMMARY_SYSTEM_PROMPT,
8519
+ max_tokens: outputTokenBudget
8516
8520
  },
8517
8521
  content: promptContent,
8518
8522
  billingDialogKey: dialogKey
@@ -8561,7 +8565,10 @@ var updateDialogSummaryAction = async (args, thunkApi) => {
8561
8565
  const metrics = buildCompactionMetricsFromPlan({
8562
8566
  reason: args.reason || "context_budget",
8563
8567
  previousSummary: dialogConfig.summary || "",
8564
- plan,
8568
+ plan: {
8569
+ msgsToCompress: coveredMessages,
8570
+ msgsToKeep: [...plan.msgsToCompress.slice(coveredMessages.length), ...plan.msgsToKeep]
8571
+ },
8565
8572
  newSummary: newSummary.trim()
8566
8573
  // web 端 runLlm 只返回摘要字符串,不含 usage。
8567
8574
  // summaryUsage 需要 runLlm 改造才能获取,当前留空。
@@ -8583,8 +8590,8 @@ var updateDialogSummaryAction = async (args, thunkApi) => {
8583
8590
  // packages/ai/context/realContextUsage.ts
8584
8591
  var lastInputTokensFromRecords = (records) => {
8585
8592
  if (!Array.isArray(records) || records.length === 0) return void 0;
8586
- for (let i2 = records.length - 1; i2 >= 0; i2--) {
8587
- const usage = records[i2]?.usage;
8593
+ for (let i = records.length - 1; i >= 0; i--) {
8594
+ const usage = records[i]?.usage;
8588
8595
  if (!usage) continue;
8589
8596
  const inputTokens = normalizeUsage(usage).input_tokens;
8590
8597
  if (typeof inputTokens === "number" && Number.isFinite(inputTokens) && inputTokens > 0) {
@@ -8624,8 +8631,8 @@ function dataURLtoFile(dataUrl, filename) {
8624
8631
  const binaryString = atob(base64);
8625
8632
  const length = binaryString.length;
8626
8633
  const u8arr = new Uint8Array(length);
8627
- for (let i2 = 0; i2 < length; i2++) {
8628
- u8arr[i2] = binaryString.charCodeAt(i2);
8634
+ for (let i = 0; i < length; i++) {
8635
+ u8arr[i] = binaryString.charCodeAt(i);
8629
8636
  }
8630
8637
  return new File([u8arr], filename, { type: mime });
8631
8638
  } catch (error) {
@@ -8835,11 +8842,11 @@ function separateThinkContent(contentBuffer) {
8835
8842
  let thinkContent = "";
8836
8843
  let normalContent = "";
8837
8844
  const combinedText = contentBuffer.flatMap(
8838
- (c2) => c2.type === "text" && "text" in c2 && c2.text ? [c2.text] : []
8845
+ (c) => c.type === "text" && "text" in c && c.text ? [c.text] : []
8839
8846
  ).join("");
8840
8847
  const thinkMatches = combinedText.match(/<think\b[^>]*>(.*?)<\/think>/gis);
8841
8848
  if (thinkMatches) {
8842
- thinkContent = thinkMatches.map((m3) => m3.replace(/<think\b[^>]*>|<\/think>/gi, "")).join("\n\n");
8849
+ thinkContent = thinkMatches.map((m) => m.replace(/<think\b[^>]*>|<\/think>/gi, "")).join("\n\n");
8843
8850
  normalContent = combinedText.replace(/<think\b[^>]*>.*?<\/think>/gis, "").trim();
8844
8851
  } else {
8845
8852
  normalContent = combinedText;
@@ -9069,7 +9076,7 @@ async function uiAskChoiceFunc(args, _thunkApi) {
9069
9076
  blocking,
9070
9077
  questions: args.questions
9071
9078
  },
9072
- displayData: args.questions.map((q2) => q2.question).join(" / ")
9079
+ displayData: args.questions.map((q) => q.question).join(" / ")
9073
9080
  };
9074
9081
  }
9075
9082
  const question = String(args?.question ?? "").trim();
@@ -9452,8 +9459,8 @@ var SHELL_COMMAND_CLASSIFIERS = [
9452
9459
  {
9453
9460
  pattern: /\b(rg|grep)\b/,
9454
9461
  label: (cmd) => {
9455
- const match2 = cmd.match(/(?:rg|grep)\s+(?:-[^\s]*\s+)*['"]?([^\s'"]+)['"]?/);
9456
- return match2 ? `\u641C\u7D22 "${match2[1]}"` : "\u641C\u7D22\u4EE3\u7801";
9462
+ const match = cmd.match(/(?:rg|grep)\s+(?:-[^\s]*\s+)*['"]?([^\s'"]+)['"]?/);
9463
+ return match ? `\u641C\u7D22 "${match[1]}"` : "\u641C\u7D22\u4EE3\u7801";
9457
9464
  }
9458
9465
  },
9459
9466
  {
@@ -9475,8 +9482,8 @@ var SHELL_COMMAND_CLASSIFIERS = [
9475
9482
  {
9476
9483
  pattern: /\bcurl\b/,
9477
9484
  label: (cmd) => {
9478
- const match2 = cmd.match(/curl\s+(?:-[^\s]*\s+)*(https?:\/\/[^\s'"]+)/);
9479
- return match2 ? `\u8BF7\u6C42 ${match2[1]}` : "\u53D1\u9001 HTTP \u8BF7\u6C42";
9485
+ const match = cmd.match(/curl\s+(?:-[^\s]*\s+)*(https?:\/\/[^\s'"]+)/);
9486
+ return match ? `\u8BF7\u6C42 ${match[1]}` : "\u53D1\u9001 HTTP \u8BF7\u6C42";
9480
9487
  }
9481
9488
  },
9482
9489
  {
@@ -10206,7 +10213,7 @@ var createSliceWithThunks = buildCreateSlice({
10206
10213
  });
10207
10214
  var messagesAdapter = createEntityAdapter({
10208
10215
  selectId: (message) => message.id,
10209
- sortComparer: (a3, b2) => a3.id.localeCompare(b2.id)
10216
+ sortComparer: (a, b) => a.id.localeCompare(b.id)
10210
10217
  });
10211
10218
  var createEmptyMessageDialogState = () => ({
10212
10219
  msgs: messagesAdapter.getInitialState()
@@ -10366,7 +10373,7 @@ var messageSlice = createSliceWithThunks({
10366
10373
  getMessageDialogState(state, action2.payload?.dialogId, action2.payload?.dialogKey)
10367
10374
  ]];
10368
10375
  targetStates.forEach(([dialogId, dialogState]) => {
10369
- const updates = Object.values(dialogState.msgs.entities).filter((m3) => m3?.isStreaming).map((m3) => ({ id: m3.id, changes: { isStreaming: false } }));
10376
+ const updates = Object.values(dialogState.msgs.entities).filter((m) => m?.isStreaming).map((m) => ({ id: m.id, changes: { isStreaming: false } }));
10370
10377
  if (updates.length > 0) {
10371
10378
  updateManyMessages(dialogState, updates);
10372
10379
  }
@@ -10986,7 +10993,7 @@ var messageSlice = createSliceWithThunks({
10986
10993
  const dialogId = findDialogIdByMessageDbKey(state.message, dbKey);
10987
10994
  const dialogState = dialogId ? state.message.dialogStateById[dialogId] : void 0;
10988
10995
  const entities = dialogState?.msgs.entities ?? {};
10989
- const msg = Object.values(entities).find((m3) => m3?.dbKey === dbKey);
10996
+ const msg = Object.values(entities).find((m) => m?.dbKey === dbKey);
10990
10997
  const { id: msgId, extraRemoveId, extraRemoveDbKey } = planDeleteMessageCascade(msg, entities);
10991
10998
  await dispatch(remove(dbKey));
10992
10999
  if (extraRemoveDbKey) {
@@ -11068,7 +11075,7 @@ var messageSlice = createSliceWithThunks({
11068
11075
  ).unwrap();
11069
11076
  await Promise.all(
11070
11077
  trailingMessages.map(
11071
- (m3) => m3?.dbKey ? dispatch(remove(m3.dbKey)).unwrap() : Promise.resolve()
11078
+ (m) => m?.dbKey ? dispatch(remove(m.dbKey)).unwrap() : Promise.resolve()
11072
11079
  )
11073
11080
  );
11074
11081
  const { agentKeyToUse, agentConfigToUse, effectiveRuntimeOptions } = resolveHandleSendMessageContext({
@@ -11077,7 +11084,7 @@ var messageSlice = createSliceWithThunks({
11077
11084
  runtimeOptions: args.runtimeOptions
11078
11085
  });
11079
11086
  if (agentKeyToUse) {
11080
- const { streamAgentChatTurn } = await import("./agentSlice-WNGUIMQZ.js");
11087
+ const { streamAgentChatTurn } = await import("./agentSlice-CHR6KOZN.js");
11081
11088
  await dispatch(
11082
11089
  streamAgentChatTurn({
11083
11090
  agentKey: agentKeyToUse,
@@ -11139,1618 +11146,9 @@ var {
11139
11146
  var messageSlice_default = messageSlice.reducer;
11140
11147
 
11141
11148
  // packages/chat/dialog/actions/updateTokensAction.ts
11149
+ var import_format = __toESM(require_format());
11142
11150
  import { ulid } from "ulid";
11143
11151
 
11144
- // node_modules/date-fns/esm/isDate/index.js
11145
- function isDate(value) {
11146
- requiredArgs(1, arguments);
11147
- return value instanceof Date || _typeof(value) === "object" && Object.prototype.toString.call(value) === "[object Date]";
11148
- }
11149
-
11150
- // node_modules/date-fns/esm/isValid/index.js
11151
- function isValid(dirtyDate) {
11152
- requiredArgs(1, arguments);
11153
- if (!isDate(dirtyDate) && typeof dirtyDate !== "number") {
11154
- return false;
11155
- }
11156
- var date = toDate(dirtyDate);
11157
- return !isNaN(Number(date));
11158
- }
11159
-
11160
- // node_modules/date-fns/esm/_lib/toInteger/index.js
11161
- function toInteger(dirtyNumber) {
11162
- if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
11163
- return NaN;
11164
- }
11165
- var number = Number(dirtyNumber);
11166
- if (isNaN(number)) {
11167
- return number;
11168
- }
11169
- return number < 0 ? Math.ceil(number) : Math.floor(number);
11170
- }
11171
-
11172
- // node_modules/date-fns/esm/addMilliseconds/index.js
11173
- function addMilliseconds(dirtyDate, dirtyAmount) {
11174
- requiredArgs(2, arguments);
11175
- var timestamp = toDate(dirtyDate).getTime();
11176
- var amount = toInteger(dirtyAmount);
11177
- return new Date(timestamp + amount);
11178
- }
11179
-
11180
- // node_modules/date-fns/esm/subMilliseconds/index.js
11181
- function subMilliseconds(dirtyDate, dirtyAmount) {
11182
- requiredArgs(2, arguments);
11183
- var amount = toInteger(dirtyAmount);
11184
- return addMilliseconds(dirtyDate, -amount);
11185
- }
11186
-
11187
- // node_modules/date-fns/esm/_lib/getUTCDayOfYear/index.js
11188
- var MILLISECONDS_IN_DAY = 864e5;
11189
- function getUTCDayOfYear(dirtyDate) {
11190
- requiredArgs(1, arguments);
11191
- var date = toDate(dirtyDate);
11192
- var timestamp = date.getTime();
11193
- date.setUTCMonth(0, 1);
11194
- date.setUTCHours(0, 0, 0, 0);
11195
- var startOfYearTimestamp = date.getTime();
11196
- var difference = timestamp - startOfYearTimestamp;
11197
- return Math.floor(difference / MILLISECONDS_IN_DAY) + 1;
11198
- }
11199
-
11200
- // node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js
11201
- function startOfUTCISOWeek(dirtyDate) {
11202
- requiredArgs(1, arguments);
11203
- var weekStartsOn = 1;
11204
- var date = toDate(dirtyDate);
11205
- var day = date.getUTCDay();
11206
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
11207
- date.setUTCDate(date.getUTCDate() - diff);
11208
- date.setUTCHours(0, 0, 0, 0);
11209
- return date;
11210
- }
11211
-
11212
- // node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js
11213
- function getUTCISOWeekYear(dirtyDate) {
11214
- requiredArgs(1, arguments);
11215
- var date = toDate(dirtyDate);
11216
- var year = date.getUTCFullYear();
11217
- var fourthOfJanuaryOfNextYear = /* @__PURE__ */ new Date(0);
11218
- fourthOfJanuaryOfNextYear.setUTCFullYear(year + 1, 0, 4);
11219
- fourthOfJanuaryOfNextYear.setUTCHours(0, 0, 0, 0);
11220
- var startOfNextYear = startOfUTCISOWeek(fourthOfJanuaryOfNextYear);
11221
- var fourthOfJanuaryOfThisYear = /* @__PURE__ */ new Date(0);
11222
- fourthOfJanuaryOfThisYear.setUTCFullYear(year, 0, 4);
11223
- fourthOfJanuaryOfThisYear.setUTCHours(0, 0, 0, 0);
11224
- var startOfThisYear = startOfUTCISOWeek(fourthOfJanuaryOfThisYear);
11225
- if (date.getTime() >= startOfNextYear.getTime()) {
11226
- return year + 1;
11227
- } else if (date.getTime() >= startOfThisYear.getTime()) {
11228
- return year;
11229
- } else {
11230
- return year - 1;
11231
- }
11232
- }
11233
-
11234
- // node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js
11235
- function startOfUTCISOWeekYear(dirtyDate) {
11236
- requiredArgs(1, arguments);
11237
- var year = getUTCISOWeekYear(dirtyDate);
11238
- var fourthOfJanuary = /* @__PURE__ */ new Date(0);
11239
- fourthOfJanuary.setUTCFullYear(year, 0, 4);
11240
- fourthOfJanuary.setUTCHours(0, 0, 0, 0);
11241
- var date = startOfUTCISOWeek(fourthOfJanuary);
11242
- return date;
11243
- }
11244
-
11245
- // node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js
11246
- var MILLISECONDS_IN_WEEK = 6048e5;
11247
- function getUTCISOWeek(dirtyDate) {
11248
- requiredArgs(1, arguments);
11249
- var date = toDate(dirtyDate);
11250
- var diff = startOfUTCISOWeek(date).getTime() - startOfUTCISOWeekYear(date).getTime();
11251
- return Math.round(diff / MILLISECONDS_IN_WEEK) + 1;
11252
- }
11253
-
11254
- // node_modules/date-fns/esm/_lib/defaultOptions/index.js
11255
- var defaultOptions = {};
11256
- function getDefaultOptions() {
11257
- return defaultOptions;
11258
- }
11259
-
11260
- // node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js
11261
- function startOfUTCWeek(dirtyDate, options) {
11262
- var _ref, _ref2, _ref3, _options$weekStartsOn, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11263
- requiredArgs(1, arguments);
11264
- var defaultOptions2 = getDefaultOptions();
11265
- var weekStartsOn = toInteger((_ref = (_ref2 = (_ref3 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions2.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions2.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref !== void 0 ? _ref : 0);
11266
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
11267
- throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
11268
- }
11269
- var date = toDate(dirtyDate);
11270
- var day = date.getUTCDay();
11271
- var diff = (day < weekStartsOn ? 7 : 0) + day - weekStartsOn;
11272
- date.setUTCDate(date.getUTCDate() - diff);
11273
- date.setUTCHours(0, 0, 0, 0);
11274
- return date;
11275
- }
11276
-
11277
- // node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js
11278
- function getUTCWeekYear(dirtyDate, options) {
11279
- var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11280
- requiredArgs(1, arguments);
11281
- var date = toDate(dirtyDate);
11282
- var year = date.getUTCFullYear();
11283
- var defaultOptions2 = getDefaultOptions();
11284
- var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions2.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
11285
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
11286
- throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
11287
- }
11288
- var firstWeekOfNextYear = /* @__PURE__ */ new Date(0);
11289
- firstWeekOfNextYear.setUTCFullYear(year + 1, 0, firstWeekContainsDate);
11290
- firstWeekOfNextYear.setUTCHours(0, 0, 0, 0);
11291
- var startOfNextYear = startOfUTCWeek(firstWeekOfNextYear, options);
11292
- var firstWeekOfThisYear = /* @__PURE__ */ new Date(0);
11293
- firstWeekOfThisYear.setUTCFullYear(year, 0, firstWeekContainsDate);
11294
- firstWeekOfThisYear.setUTCHours(0, 0, 0, 0);
11295
- var startOfThisYear = startOfUTCWeek(firstWeekOfThisYear, options);
11296
- if (date.getTime() >= startOfNextYear.getTime()) {
11297
- return year + 1;
11298
- } else if (date.getTime() >= startOfThisYear.getTime()) {
11299
- return year;
11300
- } else {
11301
- return year - 1;
11302
- }
11303
- }
11304
-
11305
- // node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js
11306
- function startOfUTCWeekYear(dirtyDate, options) {
11307
- var _ref, _ref2, _ref3, _options$firstWeekCon, _options$locale, _options$locale$optio, _defaultOptions$local, _defaultOptions$local2;
11308
- requiredArgs(1, arguments);
11309
- var defaultOptions2 = getDefaultOptions();
11310
- var firstWeekContainsDate = toInteger((_ref = (_ref2 = (_ref3 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale = options.locale) === null || _options$locale === void 0 ? void 0 : (_options$locale$optio = _options$locale.options) === null || _options$locale$optio === void 0 ? void 0 : _options$locale$optio.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : defaultOptions2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : (_defaultOptions$local = defaultOptions2.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref !== void 0 ? _ref : 1);
11311
- var year = getUTCWeekYear(dirtyDate, options);
11312
- var firstWeek = /* @__PURE__ */ new Date(0);
11313
- firstWeek.setUTCFullYear(year, 0, firstWeekContainsDate);
11314
- firstWeek.setUTCHours(0, 0, 0, 0);
11315
- var date = startOfUTCWeek(firstWeek, options);
11316
- return date;
11317
- }
11318
-
11319
- // node_modules/date-fns/esm/_lib/getUTCWeek/index.js
11320
- var MILLISECONDS_IN_WEEK2 = 6048e5;
11321
- function getUTCWeek(dirtyDate, options) {
11322
- requiredArgs(1, arguments);
11323
- var date = toDate(dirtyDate);
11324
- var diff = startOfUTCWeek(date, options).getTime() - startOfUTCWeekYear(date, options).getTime();
11325
- return Math.round(diff / MILLISECONDS_IN_WEEK2) + 1;
11326
- }
11327
-
11328
- // node_modules/date-fns/esm/_lib/format/lightFormatters/index.js
11329
- var formatters = {
11330
- // Year
11331
- y: function y(date, token) {
11332
- var signedYear = date.getUTCFullYear();
11333
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
11334
- return addLeadingZeros(token === "yy" ? year % 100 : year, token.length);
11335
- },
11336
- // Month
11337
- M: function M(date, token) {
11338
- var month = date.getUTCMonth();
11339
- return token === "M" ? String(month + 1) : addLeadingZeros(month + 1, 2);
11340
- },
11341
- // Day of the month
11342
- d: function d(date, token) {
11343
- return addLeadingZeros(date.getUTCDate(), token.length);
11344
- },
11345
- // AM or PM
11346
- a: function a(date, token) {
11347
- var dayPeriodEnumValue = date.getUTCHours() / 12 >= 1 ? "pm" : "am";
11348
- switch (token) {
11349
- case "a":
11350
- case "aa":
11351
- return dayPeriodEnumValue.toUpperCase();
11352
- case "aaa":
11353
- return dayPeriodEnumValue;
11354
- case "aaaaa":
11355
- return dayPeriodEnumValue[0];
11356
- case "aaaa":
11357
- default:
11358
- return dayPeriodEnumValue === "am" ? "a.m." : "p.m.";
11359
- }
11360
- },
11361
- // Hour [1-12]
11362
- h: function h(date, token) {
11363
- return addLeadingZeros(date.getUTCHours() % 12 || 12, token.length);
11364
- },
11365
- // Hour [0-23]
11366
- H: function H(date, token) {
11367
- return addLeadingZeros(date.getUTCHours(), token.length);
11368
- },
11369
- // Minute
11370
- m: function m(date, token) {
11371
- return addLeadingZeros(date.getUTCMinutes(), token.length);
11372
- },
11373
- // Second
11374
- s: function s(date, token) {
11375
- return addLeadingZeros(date.getUTCSeconds(), token.length);
11376
- },
11377
- // Fraction of second
11378
- S: function S(date, token) {
11379
- var numberOfDigits = token.length;
11380
- var milliseconds = date.getUTCMilliseconds();
11381
- var fractionalSeconds = Math.floor(milliseconds * Math.pow(10, numberOfDigits - 3));
11382
- return addLeadingZeros(fractionalSeconds, token.length);
11383
- }
11384
- };
11385
- var lightFormatters_default = formatters;
11386
-
11387
- // node_modules/date-fns/esm/_lib/format/formatters/index.js
11388
- var dayPeriodEnum = {
11389
- am: "am",
11390
- pm: "pm",
11391
- midnight: "midnight",
11392
- noon: "noon",
11393
- morning: "morning",
11394
- afternoon: "afternoon",
11395
- evening: "evening",
11396
- night: "night"
11397
- };
11398
- var formatters2 = {
11399
- // Era
11400
- G: function G(date, token, localize2) {
11401
- var era = date.getUTCFullYear() > 0 ? 1 : 0;
11402
- switch (token) {
11403
- // AD, BC
11404
- case "G":
11405
- case "GG":
11406
- case "GGG":
11407
- return localize2.era(era, {
11408
- width: "abbreviated"
11409
- });
11410
- // A, B
11411
- case "GGGGG":
11412
- return localize2.era(era, {
11413
- width: "narrow"
11414
- });
11415
- // Anno Domini, Before Christ
11416
- case "GGGG":
11417
- default:
11418
- return localize2.era(era, {
11419
- width: "wide"
11420
- });
11421
- }
11422
- },
11423
- // Year
11424
- y: function y2(date, token, localize2) {
11425
- if (token === "yo") {
11426
- var signedYear = date.getUTCFullYear();
11427
- var year = signedYear > 0 ? signedYear : 1 - signedYear;
11428
- return localize2.ordinalNumber(year, {
11429
- unit: "year"
11430
- });
11431
- }
11432
- return lightFormatters_default.y(date, token);
11433
- },
11434
- // Local week-numbering year
11435
- Y: function Y(date, token, localize2, options) {
11436
- var signedWeekYear = getUTCWeekYear(date, options);
11437
- var weekYear = signedWeekYear > 0 ? signedWeekYear : 1 - signedWeekYear;
11438
- if (token === "YY") {
11439
- var twoDigitYear = weekYear % 100;
11440
- return addLeadingZeros(twoDigitYear, 2);
11441
- }
11442
- if (token === "Yo") {
11443
- return localize2.ordinalNumber(weekYear, {
11444
- unit: "year"
11445
- });
11446
- }
11447
- return addLeadingZeros(weekYear, token.length);
11448
- },
11449
- // ISO week-numbering year
11450
- R: function R(date, token) {
11451
- var isoWeekYear = getUTCISOWeekYear(date);
11452
- return addLeadingZeros(isoWeekYear, token.length);
11453
- },
11454
- // Extended year. This is a single number designating the year of this calendar system.
11455
- // The main difference between `y` and `u` localizers are B.C. years:
11456
- // | Year | `y` | `u` |
11457
- // |------|-----|-----|
11458
- // | AC 1 | 1 | 1 |
11459
- // | BC 1 | 1 | 0 |
11460
- // | BC 2 | 2 | -1 |
11461
- // Also `yy` always returns the last two digits of a year,
11462
- // while `uu` pads single digit years to 2 characters and returns other years unchanged.
11463
- u: function u(date, token) {
11464
- var year = date.getUTCFullYear();
11465
- return addLeadingZeros(year, token.length);
11466
- },
11467
- // Quarter
11468
- Q: function Q(date, token, localize2) {
11469
- var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
11470
- switch (token) {
11471
- // 1, 2, 3, 4
11472
- case "Q":
11473
- return String(quarter);
11474
- // 01, 02, 03, 04
11475
- case "QQ":
11476
- return addLeadingZeros(quarter, 2);
11477
- // 1st, 2nd, 3rd, 4th
11478
- case "Qo":
11479
- return localize2.ordinalNumber(quarter, {
11480
- unit: "quarter"
11481
- });
11482
- // Q1, Q2, Q3, Q4
11483
- case "QQQ":
11484
- return localize2.quarter(quarter, {
11485
- width: "abbreviated",
11486
- context: "formatting"
11487
- });
11488
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
11489
- case "QQQQQ":
11490
- return localize2.quarter(quarter, {
11491
- width: "narrow",
11492
- context: "formatting"
11493
- });
11494
- // 1st quarter, 2nd quarter, ...
11495
- case "QQQQ":
11496
- default:
11497
- return localize2.quarter(quarter, {
11498
- width: "wide",
11499
- context: "formatting"
11500
- });
11501
- }
11502
- },
11503
- // Stand-alone quarter
11504
- q: function q(date, token, localize2) {
11505
- var quarter = Math.ceil((date.getUTCMonth() + 1) / 3);
11506
- switch (token) {
11507
- // 1, 2, 3, 4
11508
- case "q":
11509
- return String(quarter);
11510
- // 01, 02, 03, 04
11511
- case "qq":
11512
- return addLeadingZeros(quarter, 2);
11513
- // 1st, 2nd, 3rd, 4th
11514
- case "qo":
11515
- return localize2.ordinalNumber(quarter, {
11516
- unit: "quarter"
11517
- });
11518
- // Q1, Q2, Q3, Q4
11519
- case "qqq":
11520
- return localize2.quarter(quarter, {
11521
- width: "abbreviated",
11522
- context: "standalone"
11523
- });
11524
- // 1, 2, 3, 4 (narrow quarter; could be not numerical)
11525
- case "qqqqq":
11526
- return localize2.quarter(quarter, {
11527
- width: "narrow",
11528
- context: "standalone"
11529
- });
11530
- // 1st quarter, 2nd quarter, ...
11531
- case "qqqq":
11532
- default:
11533
- return localize2.quarter(quarter, {
11534
- width: "wide",
11535
- context: "standalone"
11536
- });
11537
- }
11538
- },
11539
- // Month
11540
- M: function M2(date, token, localize2) {
11541
- var month = date.getUTCMonth();
11542
- switch (token) {
11543
- case "M":
11544
- case "MM":
11545
- return lightFormatters_default.M(date, token);
11546
- // 1st, 2nd, ..., 12th
11547
- case "Mo":
11548
- return localize2.ordinalNumber(month + 1, {
11549
- unit: "month"
11550
- });
11551
- // Jan, Feb, ..., Dec
11552
- case "MMM":
11553
- return localize2.month(month, {
11554
- width: "abbreviated",
11555
- context: "formatting"
11556
- });
11557
- // J, F, ..., D
11558
- case "MMMMM":
11559
- return localize2.month(month, {
11560
- width: "narrow",
11561
- context: "formatting"
11562
- });
11563
- // January, February, ..., December
11564
- case "MMMM":
11565
- default:
11566
- return localize2.month(month, {
11567
- width: "wide",
11568
- context: "formatting"
11569
- });
11570
- }
11571
- },
11572
- // Stand-alone month
11573
- L: function L(date, token, localize2) {
11574
- var month = date.getUTCMonth();
11575
- switch (token) {
11576
- // 1, 2, ..., 12
11577
- case "L":
11578
- return String(month + 1);
11579
- // 01, 02, ..., 12
11580
- case "LL":
11581
- return addLeadingZeros(month + 1, 2);
11582
- // 1st, 2nd, ..., 12th
11583
- case "Lo":
11584
- return localize2.ordinalNumber(month + 1, {
11585
- unit: "month"
11586
- });
11587
- // Jan, Feb, ..., Dec
11588
- case "LLL":
11589
- return localize2.month(month, {
11590
- width: "abbreviated",
11591
- context: "standalone"
11592
- });
11593
- // J, F, ..., D
11594
- case "LLLLL":
11595
- return localize2.month(month, {
11596
- width: "narrow",
11597
- context: "standalone"
11598
- });
11599
- // January, February, ..., December
11600
- case "LLLL":
11601
- default:
11602
- return localize2.month(month, {
11603
- width: "wide",
11604
- context: "standalone"
11605
- });
11606
- }
11607
- },
11608
- // Local week of year
11609
- w: function w(date, token, localize2, options) {
11610
- var week = getUTCWeek(date, options);
11611
- if (token === "wo") {
11612
- return localize2.ordinalNumber(week, {
11613
- unit: "week"
11614
- });
11615
- }
11616
- return addLeadingZeros(week, token.length);
11617
- },
11618
- // ISO week of year
11619
- I: function I(date, token, localize2) {
11620
- var isoWeek = getUTCISOWeek(date);
11621
- if (token === "Io") {
11622
- return localize2.ordinalNumber(isoWeek, {
11623
- unit: "week"
11624
- });
11625
- }
11626
- return addLeadingZeros(isoWeek, token.length);
11627
- },
11628
- // Day of the month
11629
- d: function d2(date, token, localize2) {
11630
- if (token === "do") {
11631
- return localize2.ordinalNumber(date.getUTCDate(), {
11632
- unit: "date"
11633
- });
11634
- }
11635
- return lightFormatters_default.d(date, token);
11636
- },
11637
- // Day of year
11638
- D: function D(date, token, localize2) {
11639
- var dayOfYear = getUTCDayOfYear(date);
11640
- if (token === "Do") {
11641
- return localize2.ordinalNumber(dayOfYear, {
11642
- unit: "dayOfYear"
11643
- });
11644
- }
11645
- return addLeadingZeros(dayOfYear, token.length);
11646
- },
11647
- // Day of week
11648
- E: function E(date, token, localize2) {
11649
- var dayOfWeek = date.getUTCDay();
11650
- switch (token) {
11651
- // Tue
11652
- case "E":
11653
- case "EE":
11654
- case "EEE":
11655
- return localize2.day(dayOfWeek, {
11656
- width: "abbreviated",
11657
- context: "formatting"
11658
- });
11659
- // T
11660
- case "EEEEE":
11661
- return localize2.day(dayOfWeek, {
11662
- width: "narrow",
11663
- context: "formatting"
11664
- });
11665
- // Tu
11666
- case "EEEEEE":
11667
- return localize2.day(dayOfWeek, {
11668
- width: "short",
11669
- context: "formatting"
11670
- });
11671
- // Tuesday
11672
- case "EEEE":
11673
- default:
11674
- return localize2.day(dayOfWeek, {
11675
- width: "wide",
11676
- context: "formatting"
11677
- });
11678
- }
11679
- },
11680
- // Local day of week
11681
- e: function e(date, token, localize2, options) {
11682
- var dayOfWeek = date.getUTCDay();
11683
- var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
11684
- switch (token) {
11685
- // Numerical value (Nth day of week with current locale or weekStartsOn)
11686
- case "e":
11687
- return String(localDayOfWeek);
11688
- // Padded numerical value
11689
- case "ee":
11690
- return addLeadingZeros(localDayOfWeek, 2);
11691
- // 1st, 2nd, ..., 7th
11692
- case "eo":
11693
- return localize2.ordinalNumber(localDayOfWeek, {
11694
- unit: "day"
11695
- });
11696
- case "eee":
11697
- return localize2.day(dayOfWeek, {
11698
- width: "abbreviated",
11699
- context: "formatting"
11700
- });
11701
- // T
11702
- case "eeeee":
11703
- return localize2.day(dayOfWeek, {
11704
- width: "narrow",
11705
- context: "formatting"
11706
- });
11707
- // Tu
11708
- case "eeeeee":
11709
- return localize2.day(dayOfWeek, {
11710
- width: "short",
11711
- context: "formatting"
11712
- });
11713
- // Tuesday
11714
- case "eeee":
11715
- default:
11716
- return localize2.day(dayOfWeek, {
11717
- width: "wide",
11718
- context: "formatting"
11719
- });
11720
- }
11721
- },
11722
- // Stand-alone local day of week
11723
- c: function c(date, token, localize2, options) {
11724
- var dayOfWeek = date.getUTCDay();
11725
- var localDayOfWeek = (dayOfWeek - options.weekStartsOn + 8) % 7 || 7;
11726
- switch (token) {
11727
- // Numerical value (same as in `e`)
11728
- case "c":
11729
- return String(localDayOfWeek);
11730
- // Padded numerical value
11731
- case "cc":
11732
- return addLeadingZeros(localDayOfWeek, token.length);
11733
- // 1st, 2nd, ..., 7th
11734
- case "co":
11735
- return localize2.ordinalNumber(localDayOfWeek, {
11736
- unit: "day"
11737
- });
11738
- case "ccc":
11739
- return localize2.day(dayOfWeek, {
11740
- width: "abbreviated",
11741
- context: "standalone"
11742
- });
11743
- // T
11744
- case "ccccc":
11745
- return localize2.day(dayOfWeek, {
11746
- width: "narrow",
11747
- context: "standalone"
11748
- });
11749
- // Tu
11750
- case "cccccc":
11751
- return localize2.day(dayOfWeek, {
11752
- width: "short",
11753
- context: "standalone"
11754
- });
11755
- // Tuesday
11756
- case "cccc":
11757
- default:
11758
- return localize2.day(dayOfWeek, {
11759
- width: "wide",
11760
- context: "standalone"
11761
- });
11762
- }
11763
- },
11764
- // ISO day of week
11765
- i: function i(date, token, localize2) {
11766
- var dayOfWeek = date.getUTCDay();
11767
- var isoDayOfWeek = dayOfWeek === 0 ? 7 : dayOfWeek;
11768
- switch (token) {
11769
- // 2
11770
- case "i":
11771
- return String(isoDayOfWeek);
11772
- // 02
11773
- case "ii":
11774
- return addLeadingZeros(isoDayOfWeek, token.length);
11775
- // 2nd
11776
- case "io":
11777
- return localize2.ordinalNumber(isoDayOfWeek, {
11778
- unit: "day"
11779
- });
11780
- // Tue
11781
- case "iii":
11782
- return localize2.day(dayOfWeek, {
11783
- width: "abbreviated",
11784
- context: "formatting"
11785
- });
11786
- // T
11787
- case "iiiii":
11788
- return localize2.day(dayOfWeek, {
11789
- width: "narrow",
11790
- context: "formatting"
11791
- });
11792
- // Tu
11793
- case "iiiiii":
11794
- return localize2.day(dayOfWeek, {
11795
- width: "short",
11796
- context: "formatting"
11797
- });
11798
- // Tuesday
11799
- case "iiii":
11800
- default:
11801
- return localize2.day(dayOfWeek, {
11802
- width: "wide",
11803
- context: "formatting"
11804
- });
11805
- }
11806
- },
11807
- // AM or PM
11808
- a: function a2(date, token, localize2) {
11809
- var hours = date.getUTCHours();
11810
- var dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
11811
- switch (token) {
11812
- case "a":
11813
- case "aa":
11814
- return localize2.dayPeriod(dayPeriodEnumValue, {
11815
- width: "abbreviated",
11816
- context: "formatting"
11817
- });
11818
- case "aaa":
11819
- return localize2.dayPeriod(dayPeriodEnumValue, {
11820
- width: "abbreviated",
11821
- context: "formatting"
11822
- }).toLowerCase();
11823
- case "aaaaa":
11824
- return localize2.dayPeriod(dayPeriodEnumValue, {
11825
- width: "narrow",
11826
- context: "formatting"
11827
- });
11828
- case "aaaa":
11829
- default:
11830
- return localize2.dayPeriod(dayPeriodEnumValue, {
11831
- width: "wide",
11832
- context: "formatting"
11833
- });
11834
- }
11835
- },
11836
- // AM, PM, midnight, noon
11837
- b: function b(date, token, localize2) {
11838
- var hours = date.getUTCHours();
11839
- var dayPeriodEnumValue;
11840
- if (hours === 12) {
11841
- dayPeriodEnumValue = dayPeriodEnum.noon;
11842
- } else if (hours === 0) {
11843
- dayPeriodEnumValue = dayPeriodEnum.midnight;
11844
- } else {
11845
- dayPeriodEnumValue = hours / 12 >= 1 ? "pm" : "am";
11846
- }
11847
- switch (token) {
11848
- case "b":
11849
- case "bb":
11850
- return localize2.dayPeriod(dayPeriodEnumValue, {
11851
- width: "abbreviated",
11852
- context: "formatting"
11853
- });
11854
- case "bbb":
11855
- return localize2.dayPeriod(dayPeriodEnumValue, {
11856
- width: "abbreviated",
11857
- context: "formatting"
11858
- }).toLowerCase();
11859
- case "bbbbb":
11860
- return localize2.dayPeriod(dayPeriodEnumValue, {
11861
- width: "narrow",
11862
- context: "formatting"
11863
- });
11864
- case "bbbb":
11865
- default:
11866
- return localize2.dayPeriod(dayPeriodEnumValue, {
11867
- width: "wide",
11868
- context: "formatting"
11869
- });
11870
- }
11871
- },
11872
- // in the morning, in the afternoon, in the evening, at night
11873
- B: function B(date, token, localize2) {
11874
- var hours = date.getUTCHours();
11875
- var dayPeriodEnumValue;
11876
- if (hours >= 17) {
11877
- dayPeriodEnumValue = dayPeriodEnum.evening;
11878
- } else if (hours >= 12) {
11879
- dayPeriodEnumValue = dayPeriodEnum.afternoon;
11880
- } else if (hours >= 4) {
11881
- dayPeriodEnumValue = dayPeriodEnum.morning;
11882
- } else {
11883
- dayPeriodEnumValue = dayPeriodEnum.night;
11884
- }
11885
- switch (token) {
11886
- case "B":
11887
- case "BB":
11888
- case "BBB":
11889
- return localize2.dayPeriod(dayPeriodEnumValue, {
11890
- width: "abbreviated",
11891
- context: "formatting"
11892
- });
11893
- case "BBBBB":
11894
- return localize2.dayPeriod(dayPeriodEnumValue, {
11895
- width: "narrow",
11896
- context: "formatting"
11897
- });
11898
- case "BBBB":
11899
- default:
11900
- return localize2.dayPeriod(dayPeriodEnumValue, {
11901
- width: "wide",
11902
- context: "formatting"
11903
- });
11904
- }
11905
- },
11906
- // Hour [1-12]
11907
- h: function h2(date, token, localize2) {
11908
- if (token === "ho") {
11909
- var hours = date.getUTCHours() % 12;
11910
- if (hours === 0) hours = 12;
11911
- return localize2.ordinalNumber(hours, {
11912
- unit: "hour"
11913
- });
11914
- }
11915
- return lightFormatters_default.h(date, token);
11916
- },
11917
- // Hour [0-23]
11918
- H: function H2(date, token, localize2) {
11919
- if (token === "Ho") {
11920
- return localize2.ordinalNumber(date.getUTCHours(), {
11921
- unit: "hour"
11922
- });
11923
- }
11924
- return lightFormatters_default.H(date, token);
11925
- },
11926
- // Hour [0-11]
11927
- K: function K(date, token, localize2) {
11928
- var hours = date.getUTCHours() % 12;
11929
- if (token === "Ko") {
11930
- return localize2.ordinalNumber(hours, {
11931
- unit: "hour"
11932
- });
11933
- }
11934
- return addLeadingZeros(hours, token.length);
11935
- },
11936
- // Hour [1-24]
11937
- k: function k(date, token, localize2) {
11938
- var hours = date.getUTCHours();
11939
- if (hours === 0) hours = 24;
11940
- if (token === "ko") {
11941
- return localize2.ordinalNumber(hours, {
11942
- unit: "hour"
11943
- });
11944
- }
11945
- return addLeadingZeros(hours, token.length);
11946
- },
11947
- // Minute
11948
- m: function m2(date, token, localize2) {
11949
- if (token === "mo") {
11950
- return localize2.ordinalNumber(date.getUTCMinutes(), {
11951
- unit: "minute"
11952
- });
11953
- }
11954
- return lightFormatters_default.m(date, token);
11955
- },
11956
- // Second
11957
- s: function s2(date, token, localize2) {
11958
- if (token === "so") {
11959
- return localize2.ordinalNumber(date.getUTCSeconds(), {
11960
- unit: "second"
11961
- });
11962
- }
11963
- return lightFormatters_default.s(date, token);
11964
- },
11965
- // Fraction of second
11966
- S: function S2(date, token) {
11967
- return lightFormatters_default.S(date, token);
11968
- },
11969
- // Timezone (ISO-8601. If offset is 0, output is always `'Z'`)
11970
- X: function X(date, token, _localize, options) {
11971
- var originalDate = options._originalDate || date;
11972
- var timezoneOffset = originalDate.getTimezoneOffset();
11973
- if (timezoneOffset === 0) {
11974
- return "Z";
11975
- }
11976
- switch (token) {
11977
- // Hours and optional minutes
11978
- case "X":
11979
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
11980
- // Hours, minutes and optional seconds without `:` delimiter
11981
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
11982
- // so this token always has the same output as `XX`
11983
- case "XXXX":
11984
- case "XX":
11985
- return formatTimezone(timezoneOffset);
11986
- // Hours, minutes and optional seconds with `:` delimiter
11987
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
11988
- // so this token always has the same output as `XXX`
11989
- case "XXXXX":
11990
- case "XXX":
11991
- // Hours and minutes with `:` delimiter
11992
- default:
11993
- return formatTimezone(timezoneOffset, ":");
11994
- }
11995
- },
11996
- // Timezone (ISO-8601. If offset is 0, output is `'+00:00'` or equivalent)
11997
- x: function x(date, token, _localize, options) {
11998
- var originalDate = options._originalDate || date;
11999
- var timezoneOffset = originalDate.getTimezoneOffset();
12000
- switch (token) {
12001
- // Hours and optional minutes
12002
- case "x":
12003
- return formatTimezoneWithOptionalMinutes(timezoneOffset);
12004
- // Hours, minutes and optional seconds without `:` delimiter
12005
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12006
- // so this token always has the same output as `xx`
12007
- case "xxxx":
12008
- case "xx":
12009
- return formatTimezone(timezoneOffset);
12010
- // Hours, minutes and optional seconds with `:` delimiter
12011
- // Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
12012
- // so this token always has the same output as `xxx`
12013
- case "xxxxx":
12014
- case "xxx":
12015
- // Hours and minutes with `:` delimiter
12016
- default:
12017
- return formatTimezone(timezoneOffset, ":");
12018
- }
12019
- },
12020
- // Timezone (GMT)
12021
- O: function O(date, token, _localize, options) {
12022
- var originalDate = options._originalDate || date;
12023
- var timezoneOffset = originalDate.getTimezoneOffset();
12024
- switch (token) {
12025
- // Short
12026
- case "O":
12027
- case "OO":
12028
- case "OOO":
12029
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
12030
- // Long
12031
- case "OOOO":
12032
- default:
12033
- return "GMT" + formatTimezone(timezoneOffset, ":");
12034
- }
12035
- },
12036
- // Timezone (specific non-location)
12037
- z: function z(date, token, _localize, options) {
12038
- var originalDate = options._originalDate || date;
12039
- var timezoneOffset = originalDate.getTimezoneOffset();
12040
- switch (token) {
12041
- // Short
12042
- case "z":
12043
- case "zz":
12044
- case "zzz":
12045
- return "GMT" + formatTimezoneShort(timezoneOffset, ":");
12046
- // Long
12047
- case "zzzz":
12048
- default:
12049
- return "GMT" + formatTimezone(timezoneOffset, ":");
12050
- }
12051
- },
12052
- // Seconds timestamp
12053
- t: function t2(date, token, _localize, options) {
12054
- var originalDate = options._originalDate || date;
12055
- var timestamp = Math.floor(originalDate.getTime() / 1e3);
12056
- return addLeadingZeros(timestamp, token.length);
12057
- },
12058
- // Milliseconds timestamp
12059
- T: function T(date, token, _localize, options) {
12060
- var originalDate = options._originalDate || date;
12061
- var timestamp = originalDate.getTime();
12062
- return addLeadingZeros(timestamp, token.length);
12063
- }
12064
- };
12065
- function formatTimezoneShort(offset, dirtyDelimiter) {
12066
- var sign = offset > 0 ? "-" : "+";
12067
- var absOffset = Math.abs(offset);
12068
- var hours = Math.floor(absOffset / 60);
12069
- var minutes = absOffset % 60;
12070
- if (minutes === 0) {
12071
- return sign + String(hours);
12072
- }
12073
- var delimiter = dirtyDelimiter || "";
12074
- return sign + String(hours) + delimiter + addLeadingZeros(minutes, 2);
12075
- }
12076
- function formatTimezoneWithOptionalMinutes(offset, dirtyDelimiter) {
12077
- if (offset % 60 === 0) {
12078
- var sign = offset > 0 ? "-" : "+";
12079
- return sign + addLeadingZeros(Math.abs(offset) / 60, 2);
12080
- }
12081
- return formatTimezone(offset, dirtyDelimiter);
12082
- }
12083
- function formatTimezone(offset, dirtyDelimiter) {
12084
- var delimiter = dirtyDelimiter || "";
12085
- var sign = offset > 0 ? "-" : "+";
12086
- var absOffset = Math.abs(offset);
12087
- var hours = addLeadingZeros(Math.floor(absOffset / 60), 2);
12088
- var minutes = addLeadingZeros(absOffset % 60, 2);
12089
- return sign + hours + delimiter + minutes;
12090
- }
12091
- var formatters_default = formatters2;
12092
-
12093
- // node_modules/date-fns/esm/_lib/format/longFormatters/index.js
12094
- var dateLongFormatter = function dateLongFormatter2(pattern, formatLong2) {
12095
- switch (pattern) {
12096
- case "P":
12097
- return formatLong2.date({
12098
- width: "short"
12099
- });
12100
- case "PP":
12101
- return formatLong2.date({
12102
- width: "medium"
12103
- });
12104
- case "PPP":
12105
- return formatLong2.date({
12106
- width: "long"
12107
- });
12108
- case "PPPP":
12109
- default:
12110
- return formatLong2.date({
12111
- width: "full"
12112
- });
12113
- }
12114
- };
12115
- var timeLongFormatter = function timeLongFormatter2(pattern, formatLong2) {
12116
- switch (pattern) {
12117
- case "p":
12118
- return formatLong2.time({
12119
- width: "short"
12120
- });
12121
- case "pp":
12122
- return formatLong2.time({
12123
- width: "medium"
12124
- });
12125
- case "ppp":
12126
- return formatLong2.time({
12127
- width: "long"
12128
- });
12129
- case "pppp":
12130
- default:
12131
- return formatLong2.time({
12132
- width: "full"
12133
- });
12134
- }
12135
- };
12136
- var dateTimeLongFormatter = function dateTimeLongFormatter2(pattern, formatLong2) {
12137
- var matchResult = pattern.match(/(P+)(p+)?/) || [];
12138
- var datePattern = matchResult[1];
12139
- var timePattern = matchResult[2];
12140
- if (!timePattern) {
12141
- return dateLongFormatter(pattern, formatLong2);
12142
- }
12143
- var dateTimeFormat;
12144
- switch (datePattern) {
12145
- case "P":
12146
- dateTimeFormat = formatLong2.dateTime({
12147
- width: "short"
12148
- });
12149
- break;
12150
- case "PP":
12151
- dateTimeFormat = formatLong2.dateTime({
12152
- width: "medium"
12153
- });
12154
- break;
12155
- case "PPP":
12156
- dateTimeFormat = formatLong2.dateTime({
12157
- width: "long"
12158
- });
12159
- break;
12160
- case "PPPP":
12161
- default:
12162
- dateTimeFormat = formatLong2.dateTime({
12163
- width: "full"
12164
- });
12165
- break;
12166
- }
12167
- return dateTimeFormat.replace("{{date}}", dateLongFormatter(datePattern, formatLong2)).replace("{{time}}", timeLongFormatter(timePattern, formatLong2));
12168
- };
12169
- var longFormatters = {
12170
- p: timeLongFormatter,
12171
- P: dateTimeLongFormatter
12172
- };
12173
- var longFormatters_default = longFormatters;
12174
-
12175
- // node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js
12176
- function getTimezoneOffsetInMilliseconds(date) {
12177
- var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
12178
- utcDate.setUTCFullYear(date.getFullYear());
12179
- return date.getTime() - utcDate.getTime();
12180
- }
12181
-
12182
- // node_modules/date-fns/esm/_lib/protectedTokens/index.js
12183
- var protectedDayOfYearTokens = ["D", "DD"];
12184
- var protectedWeekYearTokens = ["YY", "YYYY"];
12185
- function isProtectedDayOfYearToken(token) {
12186
- return protectedDayOfYearTokens.indexOf(token) !== -1;
12187
- }
12188
- function isProtectedWeekYearToken(token) {
12189
- return protectedWeekYearTokens.indexOf(token) !== -1;
12190
- }
12191
- function throwProtectedError(token, format2, input) {
12192
- if (token === "YYYY") {
12193
- throw new RangeError("Use `yyyy` instead of `YYYY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
12194
- } else if (token === "YY") {
12195
- throw new RangeError("Use `yy` instead of `YY` (in `".concat(format2, "`) for formatting years to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
12196
- } else if (token === "D") {
12197
- throw new RangeError("Use `d` instead of `D` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
12198
- } else if (token === "DD") {
12199
- throw new RangeError("Use `dd` instead of `DD` (in `".concat(format2, "`) for formatting days of the month to the input `").concat(input, "`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md"));
12200
- }
12201
- }
12202
-
12203
- // node_modules/date-fns/esm/locale/en-US/_lib/formatDistance/index.js
12204
- var formatDistanceLocale = {
12205
- lessThanXSeconds: {
12206
- one: "less than a second",
12207
- other: "less than {{count}} seconds"
12208
- },
12209
- xSeconds: {
12210
- one: "1 second",
12211
- other: "{{count}} seconds"
12212
- },
12213
- halfAMinute: "half a minute",
12214
- lessThanXMinutes: {
12215
- one: "less than a minute",
12216
- other: "less than {{count}} minutes"
12217
- },
12218
- xMinutes: {
12219
- one: "1 minute",
12220
- other: "{{count}} minutes"
12221
- },
12222
- aboutXHours: {
12223
- one: "about 1 hour",
12224
- other: "about {{count}} hours"
12225
- },
12226
- xHours: {
12227
- one: "1 hour",
12228
- other: "{{count}} hours"
12229
- },
12230
- xDays: {
12231
- one: "1 day",
12232
- other: "{{count}} days"
12233
- },
12234
- aboutXWeeks: {
12235
- one: "about 1 week",
12236
- other: "about {{count}} weeks"
12237
- },
12238
- xWeeks: {
12239
- one: "1 week",
12240
- other: "{{count}} weeks"
12241
- },
12242
- aboutXMonths: {
12243
- one: "about 1 month",
12244
- other: "about {{count}} months"
12245
- },
12246
- xMonths: {
12247
- one: "1 month",
12248
- other: "{{count}} months"
12249
- },
12250
- aboutXYears: {
12251
- one: "about 1 year",
12252
- other: "about {{count}} years"
12253
- },
12254
- xYears: {
12255
- one: "1 year",
12256
- other: "{{count}} years"
12257
- },
12258
- overXYears: {
12259
- one: "over 1 year",
12260
- other: "over {{count}} years"
12261
- },
12262
- almostXYears: {
12263
- one: "almost 1 year",
12264
- other: "almost {{count}} years"
12265
- }
12266
- };
12267
- var formatDistance = function formatDistance2(token, count, options) {
12268
- var result;
12269
- var tokenValue = formatDistanceLocale[token];
12270
- if (typeof tokenValue === "string") {
12271
- result = tokenValue;
12272
- } else if (count === 1) {
12273
- result = tokenValue.one;
12274
- } else {
12275
- result = tokenValue.other.replace("{{count}}", count.toString());
12276
- }
12277
- if (options !== null && options !== void 0 && options.addSuffix) {
12278
- if (options.comparison && options.comparison > 0) {
12279
- return "in " + result;
12280
- } else {
12281
- return result + " ago";
12282
- }
12283
- }
12284
- return result;
12285
- };
12286
- var formatDistance_default = formatDistance;
12287
-
12288
- // node_modules/date-fns/esm/locale/_lib/buildFormatLongFn/index.js
12289
- function buildFormatLongFn(args) {
12290
- return function() {
12291
- var options = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
12292
- var width = options.width ? String(options.width) : args.defaultWidth;
12293
- var format2 = args.formats[width] || args.formats[args.defaultWidth];
12294
- return format2;
12295
- };
12296
- }
12297
-
12298
- // node_modules/date-fns/esm/locale/en-US/_lib/formatLong/index.js
12299
- var dateFormats = {
12300
- full: "EEEE, MMMM do, y",
12301
- long: "MMMM do, y",
12302
- medium: "MMM d, y",
12303
- short: "MM/dd/yyyy"
12304
- };
12305
- var timeFormats = {
12306
- full: "h:mm:ss a zzzz",
12307
- long: "h:mm:ss a z",
12308
- medium: "h:mm:ss a",
12309
- short: "h:mm a"
12310
- };
12311
- var dateTimeFormats = {
12312
- full: "{{date}} 'at' {{time}}",
12313
- long: "{{date}} 'at' {{time}}",
12314
- medium: "{{date}}, {{time}}",
12315
- short: "{{date}}, {{time}}"
12316
- };
12317
- var formatLong = {
12318
- date: buildFormatLongFn({
12319
- formats: dateFormats,
12320
- defaultWidth: "full"
12321
- }),
12322
- time: buildFormatLongFn({
12323
- formats: timeFormats,
12324
- defaultWidth: "full"
12325
- }),
12326
- dateTime: buildFormatLongFn({
12327
- formats: dateTimeFormats,
12328
- defaultWidth: "full"
12329
- })
12330
- };
12331
- var formatLong_default = formatLong;
12332
-
12333
- // node_modules/date-fns/esm/locale/en-US/_lib/formatRelative/index.js
12334
- var formatRelativeLocale = {
12335
- lastWeek: "'last' eeee 'at' p",
12336
- yesterday: "'yesterday at' p",
12337
- today: "'today at' p",
12338
- tomorrow: "'tomorrow at' p",
12339
- nextWeek: "eeee 'at' p",
12340
- other: "P"
12341
- };
12342
- var formatRelative = function formatRelative2(token, _date, _baseDate, _options) {
12343
- return formatRelativeLocale[token];
12344
- };
12345
- var formatRelative_default = formatRelative;
12346
-
12347
- // node_modules/date-fns/esm/locale/_lib/buildLocalizeFn/index.js
12348
- function buildLocalizeFn(args) {
12349
- return function(dirtyIndex, options) {
12350
- var context = options !== null && options !== void 0 && options.context ? String(options.context) : "standalone";
12351
- var valuesArray;
12352
- if (context === "formatting" && args.formattingValues) {
12353
- var defaultWidth = args.defaultFormattingWidth || args.defaultWidth;
12354
- var width = options !== null && options !== void 0 && options.width ? String(options.width) : defaultWidth;
12355
- valuesArray = args.formattingValues[width] || args.formattingValues[defaultWidth];
12356
- } else {
12357
- var _defaultWidth = args.defaultWidth;
12358
- var _width = options !== null && options !== void 0 && options.width ? String(options.width) : args.defaultWidth;
12359
- valuesArray = args.values[_width] || args.values[_defaultWidth];
12360
- }
12361
- var index = args.argumentCallback ? args.argumentCallback(dirtyIndex) : dirtyIndex;
12362
- return valuesArray[index];
12363
- };
12364
- }
12365
-
12366
- // node_modules/date-fns/esm/locale/en-US/_lib/localize/index.js
12367
- var eraValues = {
12368
- narrow: ["B", "A"],
12369
- abbreviated: ["BC", "AD"],
12370
- wide: ["Before Christ", "Anno Domini"]
12371
- };
12372
- var quarterValues = {
12373
- narrow: ["1", "2", "3", "4"],
12374
- abbreviated: ["Q1", "Q2", "Q3", "Q4"],
12375
- wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
12376
- };
12377
- var monthValues = {
12378
- narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
12379
- abbreviated: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
12380
- wide: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
12381
- };
12382
- var dayValues = {
12383
- narrow: ["S", "M", "T", "W", "T", "F", "S"],
12384
- short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
12385
- abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
12386
- wide: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
12387
- };
12388
- var dayPeriodValues = {
12389
- narrow: {
12390
- am: "a",
12391
- pm: "p",
12392
- midnight: "mi",
12393
- noon: "n",
12394
- morning: "morning",
12395
- afternoon: "afternoon",
12396
- evening: "evening",
12397
- night: "night"
12398
- },
12399
- abbreviated: {
12400
- am: "AM",
12401
- pm: "PM",
12402
- midnight: "midnight",
12403
- noon: "noon",
12404
- morning: "morning",
12405
- afternoon: "afternoon",
12406
- evening: "evening",
12407
- night: "night"
12408
- },
12409
- wide: {
12410
- am: "a.m.",
12411
- pm: "p.m.",
12412
- midnight: "midnight",
12413
- noon: "noon",
12414
- morning: "morning",
12415
- afternoon: "afternoon",
12416
- evening: "evening",
12417
- night: "night"
12418
- }
12419
- };
12420
- var formattingDayPeriodValues = {
12421
- narrow: {
12422
- am: "a",
12423
- pm: "p",
12424
- midnight: "mi",
12425
- noon: "n",
12426
- morning: "in the morning",
12427
- afternoon: "in the afternoon",
12428
- evening: "in the evening",
12429
- night: "at night"
12430
- },
12431
- abbreviated: {
12432
- am: "AM",
12433
- pm: "PM",
12434
- midnight: "midnight",
12435
- noon: "noon",
12436
- morning: "in the morning",
12437
- afternoon: "in the afternoon",
12438
- evening: "in the evening",
12439
- night: "at night"
12440
- },
12441
- wide: {
12442
- am: "a.m.",
12443
- pm: "p.m.",
12444
- midnight: "midnight",
12445
- noon: "noon",
12446
- morning: "in the morning",
12447
- afternoon: "in the afternoon",
12448
- evening: "in the evening",
12449
- night: "at night"
12450
- }
12451
- };
12452
- var ordinalNumber = function ordinalNumber2(dirtyNumber, _options) {
12453
- var number = Number(dirtyNumber);
12454
- var rem100 = number % 100;
12455
- if (rem100 > 20 || rem100 < 10) {
12456
- switch (rem100 % 10) {
12457
- case 1:
12458
- return number + "st";
12459
- case 2:
12460
- return number + "nd";
12461
- case 3:
12462
- return number + "rd";
12463
- }
12464
- }
12465
- return number + "th";
12466
- };
12467
- var localize = {
12468
- ordinalNumber,
12469
- era: buildLocalizeFn({
12470
- values: eraValues,
12471
- defaultWidth: "wide"
12472
- }),
12473
- quarter: buildLocalizeFn({
12474
- values: quarterValues,
12475
- defaultWidth: "wide",
12476
- argumentCallback: function argumentCallback(quarter) {
12477
- return quarter - 1;
12478
- }
12479
- }),
12480
- month: buildLocalizeFn({
12481
- values: monthValues,
12482
- defaultWidth: "wide"
12483
- }),
12484
- day: buildLocalizeFn({
12485
- values: dayValues,
12486
- defaultWidth: "wide"
12487
- }),
12488
- dayPeriod: buildLocalizeFn({
12489
- values: dayPeriodValues,
12490
- defaultWidth: "wide",
12491
- formattingValues: formattingDayPeriodValues,
12492
- defaultFormattingWidth: "wide"
12493
- })
12494
- };
12495
- var localize_default = localize;
12496
-
12497
- // node_modules/date-fns/esm/locale/_lib/buildMatchFn/index.js
12498
- function buildMatchFn(args) {
12499
- return function(string) {
12500
- var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
12501
- var width = options.width;
12502
- var matchPattern = width && args.matchPatterns[width] || args.matchPatterns[args.defaultMatchWidth];
12503
- var matchResult = string.match(matchPattern);
12504
- if (!matchResult) {
12505
- return null;
12506
- }
12507
- var matchedString = matchResult[0];
12508
- var parsePatterns = width && args.parsePatterns[width] || args.parsePatterns[args.defaultParseWidth];
12509
- var key = Array.isArray(parsePatterns) ? findIndex(parsePatterns, function(pattern) {
12510
- return pattern.test(matchedString);
12511
- }) : findKey(parsePatterns, function(pattern) {
12512
- return pattern.test(matchedString);
12513
- });
12514
- var value;
12515
- value = args.valueCallback ? args.valueCallback(key) : key;
12516
- value = options.valueCallback ? options.valueCallback(value) : value;
12517
- var rest = string.slice(matchedString.length);
12518
- return {
12519
- value,
12520
- rest
12521
- };
12522
- };
12523
- }
12524
- function findKey(object, predicate) {
12525
- for (var key in object) {
12526
- if (object.hasOwnProperty(key) && predicate(object[key])) {
12527
- return key;
12528
- }
12529
- }
12530
- return void 0;
12531
- }
12532
- function findIndex(array, predicate) {
12533
- for (var key = 0; key < array.length; key++) {
12534
- if (predicate(array[key])) {
12535
- return key;
12536
- }
12537
- }
12538
- return void 0;
12539
- }
12540
-
12541
- // node_modules/date-fns/esm/locale/_lib/buildMatchPatternFn/index.js
12542
- function buildMatchPatternFn(args) {
12543
- return function(string) {
12544
- var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
12545
- var matchResult = string.match(args.matchPattern);
12546
- if (!matchResult) return null;
12547
- var matchedString = matchResult[0];
12548
- var parseResult = string.match(args.parsePattern);
12549
- if (!parseResult) return null;
12550
- var value = args.valueCallback ? args.valueCallback(parseResult[0]) : parseResult[0];
12551
- value = options.valueCallback ? options.valueCallback(value) : value;
12552
- var rest = string.slice(matchedString.length);
12553
- return {
12554
- value,
12555
- rest
12556
- };
12557
- };
12558
- }
12559
-
12560
- // node_modules/date-fns/esm/locale/en-US/_lib/match/index.js
12561
- var matchOrdinalNumberPattern = /^(\d+)(th|st|nd|rd)?/i;
12562
- var parseOrdinalNumberPattern = /\d+/i;
12563
- var matchEraPatterns = {
12564
- narrow: /^(b|a)/i,
12565
- abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
12566
- wide: /^(before christ|before common era|anno domini|common era)/i
12567
- };
12568
- var parseEraPatterns = {
12569
- any: [/^b/i, /^(a|c)/i]
12570
- };
12571
- var matchQuarterPatterns = {
12572
- narrow: /^[1234]/i,
12573
- abbreviated: /^q[1234]/i,
12574
- wide: /^[1234](th|st|nd|rd)? quarter/i
12575
- };
12576
- var parseQuarterPatterns = {
12577
- any: [/1/i, /2/i, /3/i, /4/i]
12578
- };
12579
- var matchMonthPatterns = {
12580
- narrow: /^[jfmasond]/i,
12581
- abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
12582
- wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
12583
- };
12584
- var parseMonthPatterns = {
12585
- narrow: [/^j/i, /^f/i, /^m/i, /^a/i, /^m/i, /^j/i, /^j/i, /^a/i, /^s/i, /^o/i, /^n/i, /^d/i],
12586
- any: [/^ja/i, /^f/i, /^mar/i, /^ap/i, /^may/i, /^jun/i, /^jul/i, /^au/i, /^s/i, /^o/i, /^n/i, /^d/i]
12587
- };
12588
- var matchDayPatterns = {
12589
- narrow: /^[smtwf]/i,
12590
- short: /^(su|mo|tu|we|th|fr|sa)/i,
12591
- abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
12592
- wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
12593
- };
12594
- var parseDayPatterns = {
12595
- narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
12596
- any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
12597
- };
12598
- var matchDayPeriodPatterns = {
12599
- narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
12600
- any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
12601
- };
12602
- var parseDayPeriodPatterns = {
12603
- any: {
12604
- am: /^a/i,
12605
- pm: /^p/i,
12606
- midnight: /^mi/i,
12607
- noon: /^no/i,
12608
- morning: /morning/i,
12609
- afternoon: /afternoon/i,
12610
- evening: /evening/i,
12611
- night: /night/i
12612
- }
12613
- };
12614
- var match = {
12615
- ordinalNumber: buildMatchPatternFn({
12616
- matchPattern: matchOrdinalNumberPattern,
12617
- parsePattern: parseOrdinalNumberPattern,
12618
- valueCallback: function valueCallback(value) {
12619
- return parseInt(value, 10);
12620
- }
12621
- }),
12622
- era: buildMatchFn({
12623
- matchPatterns: matchEraPatterns,
12624
- defaultMatchWidth: "wide",
12625
- parsePatterns: parseEraPatterns,
12626
- defaultParseWidth: "any"
12627
- }),
12628
- quarter: buildMatchFn({
12629
- matchPatterns: matchQuarterPatterns,
12630
- defaultMatchWidth: "wide",
12631
- parsePatterns: parseQuarterPatterns,
12632
- defaultParseWidth: "any",
12633
- valueCallback: function valueCallback2(index) {
12634
- return index + 1;
12635
- }
12636
- }),
12637
- month: buildMatchFn({
12638
- matchPatterns: matchMonthPatterns,
12639
- defaultMatchWidth: "wide",
12640
- parsePatterns: parseMonthPatterns,
12641
- defaultParseWidth: "any"
12642
- }),
12643
- day: buildMatchFn({
12644
- matchPatterns: matchDayPatterns,
12645
- defaultMatchWidth: "wide",
12646
- parsePatterns: parseDayPatterns,
12647
- defaultParseWidth: "any"
12648
- }),
12649
- dayPeriod: buildMatchFn({
12650
- matchPatterns: matchDayPeriodPatterns,
12651
- defaultMatchWidth: "any",
12652
- parsePatterns: parseDayPeriodPatterns,
12653
- defaultParseWidth: "any"
12654
- })
12655
- };
12656
- var match_default = match;
12657
-
12658
- // node_modules/date-fns/esm/locale/en-US/index.js
12659
- var locale = {
12660
- code: "en-US",
12661
- formatDistance: formatDistance_default,
12662
- formatLong: formatLong_default,
12663
- formatRelative: formatRelative_default,
12664
- localize: localize_default,
12665
- match: match_default,
12666
- options: {
12667
- weekStartsOn: 0,
12668
- firstWeekContainsDate: 1
12669
- }
12670
- };
12671
- var en_US_default = locale;
12672
-
12673
- // node_modules/date-fns/esm/_lib/defaultLocale/index.js
12674
- var defaultLocale_default = en_US_default;
12675
-
12676
- // node_modules/date-fns/esm/format/index.js
12677
- var formattingTokensRegExp = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g;
12678
- var longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;
12679
- var escapedStringRegExp = /^'([^]*?)'?$/;
12680
- var doubleQuoteRegExp = /''/g;
12681
- var unescapedLatinCharacterRegExp = /[a-zA-Z]/;
12682
- function format(dirtyDate, dirtyFormatStr, options) {
12683
- var _ref, _options$locale, _ref2, _ref3, _ref4, _options$firstWeekCon, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2, _ref5, _ref6, _ref7, _options$weekStartsOn, _options$locale3, _options$locale3$opti, _defaultOptions$local3, _defaultOptions$local4;
12684
- requiredArgs(2, arguments);
12685
- var formatStr = String(dirtyFormatStr);
12686
- var defaultOptions2 = getDefaultOptions();
12687
- var locale2 = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions2.locale) !== null && _ref !== void 0 ? _ref : defaultLocale_default;
12688
- var firstWeekContainsDate = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$firstWeekCon = options === null || options === void 0 ? void 0 : options.firstWeekContainsDate) !== null && _options$firstWeekCon !== void 0 ? _options$firstWeekCon : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.firstWeekContainsDate) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions2.firstWeekContainsDate) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions2.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.firstWeekContainsDate) !== null && _ref2 !== void 0 ? _ref2 : 1);
12689
- if (!(firstWeekContainsDate >= 1 && firstWeekContainsDate <= 7)) {
12690
- throw new RangeError("firstWeekContainsDate must be between 1 and 7 inclusively");
12691
- }
12692
- var weekStartsOn = toInteger((_ref5 = (_ref6 = (_ref7 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale3 = options.locale) === null || _options$locale3 === void 0 ? void 0 : (_options$locale3$opti = _options$locale3.options) === null || _options$locale3$opti === void 0 ? void 0 : _options$locale3$opti.weekStartsOn) !== null && _ref7 !== void 0 ? _ref7 : defaultOptions2.weekStartsOn) !== null && _ref6 !== void 0 ? _ref6 : (_defaultOptions$local3 = defaultOptions2.locale) === null || _defaultOptions$local3 === void 0 ? void 0 : (_defaultOptions$local4 = _defaultOptions$local3.options) === null || _defaultOptions$local4 === void 0 ? void 0 : _defaultOptions$local4.weekStartsOn) !== null && _ref5 !== void 0 ? _ref5 : 0);
12693
- if (!(weekStartsOn >= 0 && weekStartsOn <= 6)) {
12694
- throw new RangeError("weekStartsOn must be between 0 and 6 inclusively");
12695
- }
12696
- if (!locale2.localize) {
12697
- throw new RangeError("locale must contain localize property");
12698
- }
12699
- if (!locale2.formatLong) {
12700
- throw new RangeError("locale must contain formatLong property");
12701
- }
12702
- var originalDate = toDate(dirtyDate);
12703
- if (!isValid(originalDate)) {
12704
- throw new RangeError("Invalid time value");
12705
- }
12706
- var timezoneOffset = getTimezoneOffsetInMilliseconds(originalDate);
12707
- var utcDate = subMilliseconds(originalDate, timezoneOffset);
12708
- var formatterOptions = {
12709
- firstWeekContainsDate,
12710
- weekStartsOn,
12711
- locale: locale2,
12712
- _originalDate: originalDate
12713
- };
12714
- var result = formatStr.match(longFormattingTokensRegExp).map(function(substring) {
12715
- var firstCharacter = substring[0];
12716
- if (firstCharacter === "p" || firstCharacter === "P") {
12717
- var longFormatter = longFormatters_default[firstCharacter];
12718
- return longFormatter(substring, locale2.formatLong);
12719
- }
12720
- return substring;
12721
- }).join("").match(formattingTokensRegExp).map(function(substring) {
12722
- if (substring === "''") {
12723
- return "'";
12724
- }
12725
- var firstCharacter = substring[0];
12726
- if (firstCharacter === "'") {
12727
- return cleanEscapedString(substring);
12728
- }
12729
- var formatter = formatters_default[firstCharacter];
12730
- if (formatter) {
12731
- if (!(options !== null && options !== void 0 && options.useAdditionalWeekYearTokens) && isProtectedWeekYearToken(substring)) {
12732
- throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
12733
- }
12734
- if (!(options !== null && options !== void 0 && options.useAdditionalDayOfYearTokens) && isProtectedDayOfYearToken(substring)) {
12735
- throwProtectedError(substring, dirtyFormatStr, String(dirtyDate));
12736
- }
12737
- return formatter(utcDate, substring, locale2.localize, formatterOptions);
12738
- }
12739
- if (firstCharacter.match(unescapedLatinCharacterRegExp)) {
12740
- throw new RangeError("Format string contains an unescaped latin alphabet character `" + firstCharacter + "`");
12741
- }
12742
- return substring;
12743
- }).join("");
12744
- return result;
12745
- }
12746
- function cleanEscapedString(input) {
12747
- var matched = input.match(escapedStringRegExp);
12748
- if (!matched) {
12749
- return input;
12750
- }
12751
- return matched[1].replace(doubleQuoteRegExp, "'");
12752
- }
12753
-
12754
11152
  // packages/ai/token/saveTokenRecord.ts
12755
11153
  var logger = createClientLogger("token-record");
12756
11154
  var createTokenRecord = (data, { cost, inputPrice, outputPrice } = {}) => ({
@@ -12798,7 +11196,7 @@ var resolveModelPrice = (model, usage) => {
12798
11196
  if (model.pricingStrategy?.type === "tiered_context") {
12799
11197
  const contextSize = usage.input_tokens || 0;
12800
11198
  const tiers = model.pricingStrategy.tiers || [];
12801
- const sortedTiers = [...tiers].sort((a3, b2) => a3.minContext - b2.minContext);
11199
+ const sortedTiers = [...tiers].sort((a, b) => a.minContext - b.minContext);
12802
11200
  for (const tier of sortedTiers) {
12803
11201
  if (contextSize >= tier.minContext) {
12804
11202
  activePrice = { ...tier.price };
@@ -13395,150 +11793,6 @@ var prepareTokenUsageData = ({
13395
11793
  };
13396
11794
  };
13397
11795
 
13398
- // packages/ai/token/applyTokenUsageToDayStats.ts
13399
- var ZERO_STATS = {
13400
- count: 0,
13401
- tokens: { input: 0, output: 0, cacheRead: 0, cacheCreation: 0 },
13402
- cost: 0,
13403
- failedCount: 0
13404
- };
13405
- function normalizeStats(s3) {
13406
- if (!s3) return { ...ZERO_STATS };
13407
- const t3 = s3.tokens;
13408
- return {
13409
- count: s3.count ?? 0,
13410
- tokens: {
13411
- input: t3?.input ?? 0,
13412
- output: t3?.output ?? 0,
13413
- cacheRead: t3?.cacheRead ?? t3?.cache_read ?? 0,
13414
- cacheCreation: t3?.cacheCreation ?? t3?.cache_creation ?? 0
13415
- },
13416
- cost: s3.cost ?? 0,
13417
- failedCount: s3.failedCount ?? 0
13418
- };
13419
- }
13420
- function normalizeDayStats(prev, userId, timeKey) {
13421
- if (!prev) {
13422
- return {
13423
- userId,
13424
- period: "day",
13425
- timeKey,
13426
- total: { ...ZERO_STATS },
13427
- models: {},
13428
- providers: {},
13429
- agents: {},
13430
- entryPaths: {},
13431
- categories: {},
13432
- modelCategories: {}
13433
- };
13434
- }
13435
- const normalizeMap = (m3) => {
13436
- if (!m3) return {};
13437
- const out = {};
13438
- for (const [k2, v] of Object.entries(m3)) out[k2] = normalizeStats(v);
13439
- return out;
13440
- };
13441
- const normalizedTotal = normalizeStats(prev.total);
13442
- const normalizedModels = normalizeMap(prev.models);
13443
- const normalizedProviders = normalizeMap(prev.providers);
13444
- const normalizedAgents = normalizeMap(prev.agents);
13445
- const normalizedEntryPaths = normalizeMap(prev.entryPaths);
13446
- let categories = normalizeMap(prev.categories);
13447
- let modelCategories = normalizeMap(prev.modelCategories);
13448
- const hasCategories = Object.keys(categories).length > 0;
13449
- const hasModelCategories = Object.keys(modelCategories).length > 0;
13450
- if (!hasCategories) {
13451
- const hasActivity = normalizedTotal.count > 0 || normalizedTotal.failedCount > 0 || normalizedTotal.cost > 0 || normalizedTotal.tokens.input > 0 || normalizedTotal.tokens.output > 0;
13452
- if (hasActivity) {
13453
- categories = { platform: { ...normalizedTotal } };
13454
- }
13455
- }
13456
- if (!hasModelCategories && Object.keys(normalizedModels).length > 0) {
13457
- const legacyModelCats = {};
13458
- for (const [modelKey, modelStat] of Object.entries(normalizedModels)) {
13459
- legacyModelCats[`${modelKey}:::platform`] = { ...modelStat };
13460
- }
13461
- modelCategories = legacyModelCats;
13462
- }
13463
- return {
13464
- ...prev,
13465
- total: normalizedTotal,
13466
- models: normalizedModels,
13467
- providers: normalizedProviders,
13468
- agents: normalizedAgents,
13469
- entryPaths: normalizedEntryPaths,
13470
- categories,
13471
- modelCategories
13472
- };
13473
- }
13474
- function applyTokenUsageToDayStats(prev, delta) {
13475
- const base = normalizeDayStats(prev, delta.userId, delta.timeKey);
13476
- const modelName = delta.model || "unknown";
13477
- const providerName = delta.provider || "unknown";
13478
- const cacheRead = delta.cache_read_input_tokens ?? 0;
13479
- const cacheCreation = delta.cache_creation_input_tokens ?? 0;
13480
- const isFailed = delta.status === "failed";
13481
- const category = delta.billingCategory || "platform";
13482
- const modelCategoryKey = `${modelName}:::${category}`;
13483
- const inc = (s3) => {
13484
- const n = normalizeStats(s3);
13485
- if (isFailed) {
13486
- return {
13487
- ...n,
13488
- failedCount: n.failedCount + 1
13489
- };
13490
- }
13491
- return {
13492
- count: n.count + 1,
13493
- tokens: {
13494
- input: n.tokens.input + delta.input_tokens,
13495
- output: n.tokens.output + delta.output_tokens,
13496
- cacheRead: n.tokens.cacheRead + cacheRead,
13497
- cacheCreation: n.tokens.cacheCreation + cacheCreation
13498
- },
13499
- // 非计费记录(订阅/OAuth/CLI,billable=false)不向平台积分统计贡献 cost:
13500
- // 订阅已付费、不按 token 计费,若不归零,图表「成本」视图会把订阅用量误显示为积分消耗。
13501
- cost: Number((n.cost + (category === "subscription" ? 0 : delta.cost)).toFixed(6)),
13502
- failedCount: n.failedCount
13503
- };
13504
- };
13505
- const result = {
13506
- ...base,
13507
- total: inc(base.total),
13508
- models: {
13509
- ...base.models,
13510
- [modelName]: inc(base.models[modelName])
13511
- },
13512
- providers: {
13513
- ...base.providers,
13514
- [providerName]: inc(base.providers[providerName])
13515
- },
13516
- categories: {
13517
- ...base.categories,
13518
- [category]: inc(base.categories?.[category])
13519
- },
13520
- modelCategories: {
13521
- ...base.modelCategories,
13522
- [modelCategoryKey]: inc(base.modelCategories?.[modelCategoryKey])
13523
- }
13524
- };
13525
- if (delta.agentId !== void 0) {
13526
- const agentKey = delta.agentId || "unknown";
13527
- result.agents = {
13528
- ...base.agents,
13529
- [agentKey]: inc(base.agents[agentKey])
13530
- };
13531
- }
13532
- if (delta.entry_path !== void 0) {
13533
- const entryKey = delta.entry_path || "unknown";
13534
- result.entryPaths = {
13535
- ...base.entryPaths,
13536
- [entryKey]: inc(base.entryPaths[entryKey])
13537
- };
13538
- }
13539
- return result;
13540
- }
13541
-
13542
11796
  // packages/core/keyedTaskQueue.ts
13543
11797
  var queues = /* @__PURE__ */ new Map();
13544
11798
  async function runKeyed(key, task) {
@@ -13579,7 +11833,7 @@ var queueDialogTokenPatch = async (dialogKey, task) => {
13579
11833
  };
13580
11834
  var updateStats = async (data, existingStats, key, thunkApi) => {
13581
11835
  try {
13582
- const dateKey = format(data.timestamp ?? Date.now(), "yyyy-MM-dd");
11836
+ const dateKey = (0, import_format.default)(data.timestamp ?? Date.now(), "yyyy-MM-dd");
13583
11837
  const newStats = applyTokenUsageToDayStats(existingStats, {
13584
11838
  userId: data.userId ?? "",
13585
11839
  timeKey: dateKey,
@@ -13612,7 +11866,7 @@ var updateStats = async (data, existingStats, key, thunkApi) => {
13612
11866
  }
13613
11867
  };
13614
11868
  var saveTokenUsage = async (data, thunkApi) => {
13615
- const dateKey = format(data.timestamp ?? Date.now(), "yyyy-MM-dd");
11869
+ const dateKey = (0, import_format.default)(data.timestamp ?? Date.now(), "yyyy-MM-dd");
13616
11870
  const tokenDayStatsKey = createTokenStatsKey(data.userId ?? "", dateKey);
13617
11871
  return runKeyed(tokenDayStatsKey, async () => {
13618
11872
  try {
@@ -13693,7 +11947,7 @@ var updateTokensAction = async ({ dialogId, dialogKey, usage: legacyUsage, usage
13693
11947
  ...tokenData,
13694
11948
  type: "token" /* TOKEN */,
13695
11949
  id: ulid(timestamp),
13696
- dateKey: format(timestamp, "yyyy-MM-dd"),
11950
+ dateKey: (0, import_format.default)(timestamp, "yyyy-MM-dd"),
13697
11951
  // Keep the same clock used for id/dateKey so record keys never see
13698
11952
  // undefined when a prepare helper omits timestamp.
13699
11953
  timestamp
@@ -13829,7 +12083,7 @@ var deleteOwnedDialogAttachments = async (args) => {
13829
12083
  metadataReadFailures
13830
12084
  });
13831
12085
  if (!plan.deleteCandidates.length) return plan;
13832
- const { deleteFileAction } = await import("./deleteFile-EPUQHKPA.js");
12086
+ const { deleteFileAction } = await import("./deleteFile-5YOEKV4U.js");
13833
12087
  for (const candidate of plan.deleteCandidates) {
13834
12088
  if (candidate.fileDbKey) {
13835
12089
  await deleteFileAction(candidate.fileDbKey, args.thunkApi);
@@ -13891,7 +12145,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
13891
12145
  }
13892
12146
  if (isCurrentDialog) {
13893
12147
  await thunkApi.dispatch(resetMsgs());
13894
- const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-ZWNNS7GZ.js");
12148
+ const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-ZCTDV2PZ.js");
13895
12149
  dispatch(clearPendingAttachments2());
13896
12150
  }
13897
12151
  return { dialogKey, isCurrentDialog, attachmentPlan };
@@ -13899,39 +12153,39 @@ var deleteDialogThunk = async (payload, thunkApi) => {
13899
12153
 
13900
12154
  // packages/chat/dialog/dialogSlice.ts
13901
12155
  var runCreateDialogAction = async (args, thunkApi) => {
13902
- const { createDialogAction } = await import("./createDialogAction-TJ3JKLO4.js");
12156
+ const { createDialogAction } = await import("./createDialogAction-SVH6B3SB.js");
13903
12157
  return createDialogAction(args, thunkApi);
13904
12158
  };
13905
12159
  var runCreateAgentAutomationAction = async (args, thunkApi) => {
13906
- const { createAgentAutomationAction } = await import("./createAgentAutomationAction-TI4QG4CY.js");
12160
+ const { createAgentAutomationAction } = await import("./createAgentAutomationAction-OLBQDD6R.js");
13907
12161
  return createAgentAutomationAction(args, thunkApi);
13908
12162
  };
13909
12163
  var runUpdateDialogTitleAction = async (args, thunkApi) => {
13910
- const { updateDialogTitleAction } = await import("./updateDialogTitleAction-MULWCJCW.js");
12164
+ const { updateDialogTitleAction } = await import("./updateDialogTitleAction-5GGMBTDF.js");
13911
12165
  return updateDialogTitleAction(args, thunkApi);
13912
12166
  };
13913
12167
  var runAddDialogAgentAction = async (args, thunkApi) => {
13914
- const { addDialogAgentAction } = await import("./addDialogAgentAction-KTYANUEC.js");
12168
+ const { addDialogAgentAction } = await import("./addDialogAgentAction-7VI7YRML.js");
13915
12169
  return addDialogAgentAction(args, thunkApi);
13916
12170
  };
13917
12171
  var runRemoveDialogAgentAction = async (args, thunkApi) => {
13918
- const { removeDialogAgentAction } = await import("./removeDialogAgentAction-ALJDUJ2E.js");
12172
+ const { removeDialogAgentAction } = await import("./removeDialogAgentAction-LYAZGNKW.js");
13919
12173
  return removeDialogAgentAction(args, thunkApi);
13920
12174
  };
13921
12175
  var runSetPrimaryDialogAgentAction = async (args, thunkApi) => {
13922
- const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-HE7RVFFF.js");
12176
+ const { setPrimaryDialogAgentAction } = await import("./setPrimaryDialogAgentAction-HFJDQIBU.js");
13923
12177
  return setPrimaryDialogAgentAction(args, thunkApi);
13924
12178
  };
13925
12179
  var runSwitchDialogAgentAction = async (args, thunkApi) => {
13926
- const { switchDialogAgentAction } = await import("./switchDialogAgentAction-3VZS7SOS.js");
12180
+ const { switchDialogAgentAction } = await import("./switchDialogAgentAction-EBRMW3RA.js");
13927
12181
  return switchDialogAgentAction(args, thunkApi);
13928
12182
  };
13929
12183
  var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
13930
- const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-O3SVMD5A.js");
12184
+ const { setDialogExtraReferencesAction } = await import("./setDialogExtraReferencesAction-OCRPGPYH.js");
13931
12185
  return setDialogExtraReferencesAction(args, thunkApi);
13932
12186
  };
13933
12187
  var runHandleSendMessageAction = async (args, thunkApi) => {
13934
- const { handleSendMessageAction } = await import("./handleSendMessageAction-P27YP2DQ.js");
12188
+ const { handleSendMessageAction } = await import("./handleSendMessageAction-2PE25WM3.js");
13935
12189
  return handleSendMessageAction(args, thunkApi);
13936
12190
  };
13937
12191
  function clearDialogState() {
@@ -13944,7 +12198,7 @@ var createPageAndAddReference = createAsyncThunk(
13944
12198
  async (payload, { dispatch, getState, rejectWithValue }) => {
13945
12199
  const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
13946
12200
  try {
13947
- const { createDocState } = await import("./docStore-WYLRB7ED.js");
12201
+ const { createDocState } = await import("./docStore-V2KECILA.js");
13948
12202
  const pageKey = await createDocState(
13949
12203
  { slateData, title },
13950
12204
  { dispatch, getState }
@@ -14153,9 +12407,7 @@ export {
14153
12407
  messageStreamEnd,
14154
12408
  addToolMessage,
14155
12409
  updateToolMessage,
14156
- format,
14157
12410
  prepareTokenUsageData,
14158
- applyTokenUsageToDayStats,
14159
12411
  runKeyed,
14160
12412
  updateTokensAction,
14161
12413
  clearDialogState,