@readmagic/workmate 0.0.25 → 0.0.26

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 (355) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-Y5S_lMjD.js → AddWorkspaceDirectory-mS8iUoWY.js} +1 -1
  2. package/dist/chunks/{AgentsMdExternalIncludesDialog-DVbU-BaD.js → AgentsMdExternalIncludesDialog-BHBkysy0.js} +1 -1
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-DuStmCjj.js +1 -0
  4. package/dist/chunks/App-D--vtCyq.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-mcDuiNGs.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-DjqGAL4C.js → BypassPermissionsModeDialog-DyqI98d2.js} +1 -1
  7. package/dist/chunks/CustomSelect-CpMbxYbt.js +1 -0
  8. package/dist/chunks/DiffDialog-BQAU2pJx.js +6 -0
  9. package/dist/chunks/Doctor-BU69VQzw.js +1 -0
  10. package/dist/chunks/Doctor-DJOMbSDE.js +3 -0
  11. package/dist/chunks/{ExitFlow-Dh9QdaYK.js → ExitFlow-xBOnvhiW.js} +2 -2
  12. package/dist/chunks/{InvalidConfigDialog-C9boykQn.js → InvalidConfigDialog-NiuhcaG5.js} +1 -1
  13. package/dist/chunks/{InvalidSettingsDialog-UN5mleCK.js → InvalidSettingsDialog-DrromC1I.js} +1 -1
  14. package/dist/chunks/KeybindingProviderSetup-CSUkJHTT.js +1 -0
  15. package/dist/chunks/MCPConnectionManager-Bn1PDn3R.js +1 -0
  16. package/dist/chunks/MCPToolListView-BRxjOaOL.js +1 -0
  17. package/dist/chunks/{McpParsingWarnings-zkM_lGd0.js → McpParsingWarnings-BYG2yqjO.js} +1 -1
  18. package/dist/chunks/MessageSelector-B7xAQqZI.js +3 -0
  19. package/dist/chunks/Messages-CxMsfjOa.js +10 -0
  20. package/dist/chunks/{Onboarding-BT90cFkn.js → Onboarding-CkATe87e.js} +1 -1
  21. package/dist/chunks/{PermissionDialog-BaibiQae.js → PermissionDialog-tEMMa5-a.js} +1 -1
  22. package/dist/chunks/{PressEnterToContinue-DZc_s_pE.js → PressEnterToContinue-CPOaYnym.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-CCTZYbWI.js → PromptInputFooterSuggestions-CwqAsTI2.js} +1 -1
  24. package/dist/chunks/PromptInputHelpMenu-krq-hiFO.js +1 -0
  25. package/dist/chunks/{ProviderSetup-yIj8YOKF.js → ProviderSetup-J6Ty-Wj8.js} +1 -1
  26. package/dist/chunks/QueryEngine-Mdi_kUaL.js +1 -0
  27. package/dist/chunks/REPL-BgzQtSFF.js +1 -0
  28. package/dist/chunks/REPL-rirm6s_7.js +124 -0
  29. package/dist/chunks/ResumeConversation-Cmsbo5m7.js +1 -0
  30. package/dist/chunks/{SearchBox-C9xxQzh1.js → SearchBox-DQBLKyzJ.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-D1-7C04z.js +1 -0
  32. package/dist/chunks/{SelectMulti-BW7Ffk1G.js → SelectMulti-BpAjjhsn.js} +1 -1
  33. package/dist/chunks/Settings-B6DImvca.js +2 -0
  34. package/dist/chunks/Spinner-DhhSOFcN.js +1 -0
  35. package/dist/chunks/{SpinnerGlyph-CqrOK3Mx.js → SpinnerGlyph-CmVXC-_9.js} +1 -1
  36. package/dist/chunks/{TextInput-Cev5Awdd.js → TextInput-BboKIug2.js} +11 -11
  37. package/dist/chunks/ThemePicker-DTpXbEY0.js +1 -0
  38. package/dist/chunks/{TrustDialog-8Sjmuu0e.js → TrustDialog-CZ8JpySm.js} +1 -1
  39. package/dist/chunks/{ValidationErrorsList-INwwoerV.js → ValidationErrorsList-C_gDQfm1.js} +1 -1
  40. package/dist/chunks/{_baseEach-DrPH_FGo.js → _baseEach-DGbaIpJA.js} +1 -1
  41. package/dist/chunks/_baseSlice-D67_NpZ1.js +1 -0
  42. package/dist/chunks/{add-dir-D3RMaYxy.js → add-dir-B576wzi9.js} +1 -1
  43. package/dist/chunks/{agentDisplay-B3npXoCS.js → agentDisplay-ZuFoBZYu.js} +1 -1
  44. package/dist/chunks/{agents-2mPGmeq6.js → agents-Dy4_hDic.js} +1 -1
  45. package/dist/chunks/agents-HIOBiw4w.js +101 -0
  46. package/dist/chunks/allErrors-CxPNR2WN.js +1 -0
  47. package/dist/chunks/appleTerminalBackup-C9kjzdM9.js +1 -0
  48. package/dist/chunks/{backgroundHousekeeping-BkFxfjOf.js → backgroundHousekeeping-PyLNnGdw.js} +1 -1
  49. package/dist/chunks/backgroundHousekeeping-ZCMPmQuU.js +1 -0
  50. package/dist/chunks/{banner-DHpTmEO7.js → banner-DqFectPg.js} +2 -2
  51. package/dist/chunks/{branch-Be_yDFU8.js → branch-B_BL5N9N.js} +2 -2
  52. package/dist/chunks/{break-cache-UUt6Dkf2.js → break-cache-DL95nKZl.js} +2 -2
  53. package/dist/chunks/{btw-DUml5L1w.js → btw-Y44ctueB.js} +1 -1
  54. package/dist/chunks/bundledMode-BxyD5cqq.js +1 -0
  55. package/dist/chunks/caches-5xZ4dSXt.js +1 -0
  56. package/dist/chunks/caches-Be9saXxV.js +1 -0
  57. package/dist/chunks/{claudeDesktop-mBGFDbI6.js → claudeDesktop-g8eUUY2E.js} +1 -1
  58. package/dist/chunks/{clear-CrGjNe6E.js → clear-DtTkA707.js} +1 -1
  59. package/dist/chunks/{client-BDuhbzLD.js → client-Bw_L3lSc.js} +1 -1
  60. package/dist/chunks/{client-BYFVVMcf.js → client-aJ2Nr_sh.js} +1 -1
  61. package/dist/chunks/client-mnUISv_N.js +1 -0
  62. package/dist/chunks/client-wPqIdEVm.js +1 -0
  63. package/dist/chunks/commands-wfE12a4L.js +1 -0
  64. package/dist/chunks/compact-CvNOtu7J.js +2 -0
  65. package/dist/chunks/config-D3K87Mm1.js +3 -0
  66. package/dist/chunks/config-DTga6Ku8.js +1 -0
  67. package/dist/chunks/config-DtmqWusU.js +1 -0
  68. package/dist/chunks/{context-mV5zjqmc.js → context-Opu4E8dL.js} +1 -1
  69. package/dist/chunks/{context-noninteractive-DvfVvmSE.js → context-noninteractive-B1V2Mp26.js} +5 -5
  70. package/dist/chunks/context-noninteractive-eIlneYiL.js +1 -0
  71. package/dist/chunks/conversation-CG_z7TLE.js +1 -0
  72. package/dist/chunks/conversation-CHesBfFZ.js +1 -0
  73. package/dist/chunks/conversationRecovery-OhitW-7g.js +1 -0
  74. package/dist/chunks/crossProjectResume-mmYx8PrZ.js +40 -0
  75. package/dist/chunks/cwd-BH2f3u0o.js +1 -0
  76. package/dist/chunks/{cwd-BvNt_018.js → cwd-DrEEb4f5.js} +1 -1
  77. package/dist/chunks/{debug-CRnGsZOV.js → debug-kBjDaVkQ.js} +3 -3
  78. package/dist/chunks/{detectRepository-CsJLbVEe.js → detectRepository-M6K2wc7h.js} +1 -1
  79. package/dist/chunks/{diff-DUEoNCnJ.js → diff-Cv7tX2-P.js} +1 -1
  80. package/dist/chunks/{directoryCompletion-Bgi8DBT5.js → directoryCompletion-BHyjyKAM.js} +1 -1
  81. package/dist/chunks/doctor-DeBG5SL5.js +1 -0
  82. package/dist/chunks/{entry-D1iD76SW.js → entry-CbhyIWgj.js} +5 -5
  83. package/dist/chunks/envUtils-DZ_SvEVz.js +1 -0
  84. package/dist/chunks/execFileNoThrow-BfZFnCGa.js +1 -0
  85. package/dist/chunks/execa-CBhG1doD.js +34 -0
  86. package/dist/chunks/exit-OKEV_ddw.js +1 -0
  87. package/dist/chunks/{extraUsage-BtHE-SBX.js → extraUsage-BlRL3yeb.js} +1 -1
  88. package/dist/chunks/extractMemories-jnsv-_n_.js +1 -0
  89. package/dist/chunks/fast-4I_qPJCd.js +1 -0
  90. package/dist/chunks/fast-DiolM1M7.js +1 -0
  91. package/dist/chunks/{fetchModelList-Cjow_QGy.js → fetchModelList-BRFTQim4.js} +1 -1
  92. package/dist/chunks/fetchModelList-qPKAuu4m.js +1 -0
  93. package/dist/chunks/{fileSuggestions-C96V9-Ne.js → fileSuggestions-iWVXvvLB.js} +3 -3
  94. package/dist/chunks/{fpsMetrics-wxj9GAsd.js → fpsMetrics-Ixd0J4CH.js} +1 -1
  95. package/dist/chunks/{gemini-4YGElN3H.js → gemini-BfVyavwQ.js} +2 -2
  96. package/dist/chunks/{generateSessionName-BHIKyXpz.js → generateSessionName-CGaTTXCA.js} +1 -1
  97. package/dist/chunks/genericProcessUtils-CVtQOTO2.js +12 -0
  98. package/dist/chunks/{goal-ePK_jLo3.js → goal-BidR-GFa.js} +1 -1
  99. package/dist/chunks/grok-DLcuI-U7.js +1 -0
  100. package/dist/chunks/{help-B7xRle-V.js → help-CZuvYhXj.js} +1 -1
  101. package/dist/chunks/history-BxPGftQw.js +1 -0
  102. package/dist/chunks/hooks-Bg9WIjZQ.js +1 -0
  103. package/dist/chunks/{hooks-BN5f58HY.js → hooks-ehqfAM5F.js} +2 -2
  104. package/dist/chunks/install-ACGY0vhM.js +1 -0
  105. package/dist/chunks/{instrumentation-Oj5xagJG.js → instrumentation-B9bfF2mA.js} +5 -5
  106. package/dist/chunks/{job-D9ypO0cd.js → job-Coztdn6A.js} +1 -1
  107. package/dist/chunks/keybindings-DwSdLpaE.js +1 -0
  108. package/dist/chunks/{launchLocalMemory-DliLezJw.js → launchLocalMemory-DRzfpIOB.js} +1 -1
  109. package/dist/chunks/{launchOnboarding-A-kk-7ID.js → launchOnboarding-D2zFCJf-.js} +1 -1
  110. package/dist/chunks/{loadAgentsDir-DGozQu_6.js → loadAgentsDir-DR5PVAc3.js} +557 -561
  111. package/dist/chunks/loadAgentsDir-DqAbnpB-.js +1 -0
  112. package/dist/chunks/{loadPluginHooks-BiHPKDaY.js → loadPluginHooks-BiQgGfUJ.js} +1 -1
  113. package/dist/chunks/{loader-CtoR-vO-.js → loader-6MqzNGmV.js} +1 -1
  114. package/dist/chunks/{localSearch-BU02Qsv9.js → localSearch-CzkxDuOR.js} +1 -1
  115. package/dist/chunks/localSearch-DW3JT2MA.js +1 -0
  116. package/dist/chunks/lockfile-D_9vif6E.js +1 -0
  117. package/dist/chunks/{log-DoSpAwRP.js → log-DWZny1vM.js} +1 -1
  118. package/dist/chunks/{logoUtils-DLd6JKqW.js → logoUtils-DR5T0pr3.js} +1 -1
  119. package/dist/chunks/{magicDocs-Bj8LYrN2.js → magicDocs-BwBxjfLo.js} +2 -2
  120. package/dist/chunks/main-Ryi27wYq.js +345 -0
  121. package/dist/chunks/managedEnv-DCEJh3z3.js +1 -0
  122. package/dist/chunks/managedEnv-Do9fgLpk.js +1 -0
  123. package/dist/chunks/managedEnvConstants-CWcT7nYr.js +1 -0
  124. package/dist/chunks/mcp-BCpnF6wD.js +1 -0
  125. package/dist/chunks/mcp-CJ6SDJEK.js +6 -0
  126. package/dist/chunks/mcp-CZBTxbhu.js +2 -0
  127. package/dist/chunks/memory-BQO6Y0ak.js +1 -0
  128. package/dist/chunks/{modalContext-DDZdU1J8.js → modalContext-CBE8xuck.js} +1 -1
  129. package/dist/chunks/{mode-CBKawxnD.js → mode-wq70cR44.js} +1 -1
  130. package/dist/chunks/model-D42epddJ.js +1 -0
  131. package/dist/chunks/{model-DwbqvCY2.js → model-DVk9-2dk.js} +1 -1
  132. package/dist/chunks/{modelOptions-CXBfKFXA.js → modelOptions-beLgXORr.js} +1 -1
  133. package/dist/chunks/nativeInstaller-ChGSz1lb.js +1 -0
  134. package/dist/chunks/{notifications-ql0eSo0Y.js → notifications-dGBuNvFj.js} +1 -1
  135. package/dist/chunks/{onChangeAppState-D85b33R5.js → onChangeAppState-B4K-rSaF.js} +1 -1
  136. package/dist/chunks/openai-DAwnAV9K.js +2 -0
  137. package/dist/chunks/{overlayContext-CLjlCFBl.js → overlayContext-B6i_6y_0.js} +1 -1
  138. package/dist/chunks/{panel-DMZkOEiU.js → panel-C0CF3noE.js} +1 -1
  139. package/dist/chunks/parser-BZt0VFd_.js +1 -0
  140. package/dist/chunks/{parser-UqADrvxF.js → parser-DThLwgdM.js} +1 -1
  141. package/dist/chunks/{partition-CwxTlmMd.js → partition-BRQHofxD.js} +1 -1
  142. package/dist/chunks/{pasteStore-ovtxMVR5.js → pasteStore-BmehVo5j.js} +1 -1
  143. package/dist/chunks/{permissions-CgsvWOk_.js → permissions-DkfWKN-B.js} +3 -3
  144. package/dist/chunks/pidLock-YvAaIrIY.js +3 -0
  145. package/dist/chunks/plan-B6U3ioer.js +1 -0
  146. package/dist/chunks/{platform-DsMIk3eq.js → platform-Vl9IynC3.js} +1 -1
  147. package/dist/chunks/plugin-CTA2_-F7.js +17 -0
  148. package/dist/chunks/{pluginAutoupdate-DQqYDPVg.js → pluginAutoupdate-Dy5W3HWE.js} +1 -1
  149. package/dist/chunks/{pluginBlocklist-BAr9WTup.js → pluginBlocklist-DAoUENwc.js} +1 -1
  150. package/dist/chunks/pluginCliCommands-CaHnj0C_.js +1 -0
  151. package/dist/chunks/{pluginFlagging-BO_3qjfs.js → pluginFlagging-BCj9LJP3.js} +1 -1
  152. package/dist/chunks/pluginOperations-ClXNOOG6.js +2 -0
  153. package/dist/chunks/pluginStartupCheck-CiwMKGjx.js +1 -0
  154. package/dist/chunks/{pluginStartupCheck-BX6cv-vs.js → pluginStartupCheck-U8_xk25t.js} +1 -1
  155. package/dist/chunks/{plugins-9crasx2V.js → plugins-D7zyI9c4.js} +4 -4
  156. package/dist/chunks/{poller-CpLBoB-N.js → poller-BeyVwHAf.js} +1 -1
  157. package/dist/chunks/poorMode-DtzWNhsY.js +1 -0
  158. package/dist/chunks/poorMode-Ocff_UT1.js +1 -0
  159. package/dist/chunks/print-BzljdXem.js +13 -0
  160. package/dist/chunks/processBashCommand-RUkmyAl4.js +1 -0
  161. package/dist/chunks/processSlashCommand-DRLO-jNV.js +5 -0
  162. package/dist/chunks/{projectContext-5fmRr6Sd.js → projectContext-COeHKDrk.js} +1 -1
  163. package/dist/chunks/{projectContext-DhtjLv3k.js → projectContext-QN5U3Ggr.js} +1 -1
  164. package/dist/chunks/{projectOnboardingState--L3BKjOE.js → projectOnboardingState-KqcpRXls.js} +1 -1
  165. package/dist/chunks/{prompt-DzO1um1h.js → prompt-CTByhpUI.js} +20 -20
  166. package/dist/chunks/prompt-DTpfW6yP.js +1 -0
  167. package/dist/chunks/prompt-D__eHY_5.js +1 -0
  168. package/dist/chunks/promptEditor-CpUFgGzc.js +4 -0
  169. package/dist/chunks/{protocolHandler-BWgH1jaF.js → protocolHandler-BQSLVGnG.js} +2 -2
  170. package/dist/chunks/{proxy-BjkGlmBu.js → proxy-BtWuysHM.js} +2 -2
  171. package/dist/chunks/{reconciler-CVMmAaCy.js → reconciler-D6BUq8WB.js} +1 -1
  172. package/dist/chunks/refresh-B4pqFp12.js +1 -0
  173. package/dist/chunks/reject-C6IvUvBt.js +1 -0
  174. package/dist/chunks/{reload-plugins-DeyJTx4s.js → reload-plugins-DXQqk7q6.js} +1 -1
  175. package/dist/chunks/rename-D4XBmTBI.js +1 -0
  176. package/dist/chunks/{renderOptions-DRS2EslG.js → renderOptions-DkP98P_d.js} +1 -1
  177. package/dist/chunks/{resume-N4O5YI-S.js → resume-DzIev0JI.js} +2 -2
  178. package/dist/chunks/ripgrep-CYP26Fhg.js +1 -0
  179. package/dist/chunks/ripgrep-D1f1pbCz.js +5 -0
  180. package/dist/chunks/{runtimeObserver-DMSzdFWt.js → runtimeObserver-BPqlbu0B.js} +4 -4
  181. package/dist/chunks/{runtimeObserver-C0CJvA3q.js → runtimeObserver-BUHs3qjs.js} +1 -1
  182. package/dist/chunks/sandbox-adapter-CumL75tU.js +1 -0
  183. package/dist/chunks/{sandbox-toggle-Tbbaw18C.js → sandbox-toggle-CTtET6Xq.js} +1 -1
  184. package/dist/chunks/searchExtraTools-BMCU2zEf.js +1 -0
  185. package/dist/chunks/{select-Fq6g2Ejk.js → select-FrwoTzuc.js} +1 -1
  186. package/dist/chunks/sessionFileAccessHooks-WO8WTdT9.js +1 -0
  187. package/dist/chunks/{sessionObserver-CRie77tp.js → sessionObserver-B6xzxckA.js} +2 -2
  188. package/dist/chunks/sessionObserver-CBrM4opL.js +1 -0
  189. package/dist/chunks/sessionStorage-C1EAxDWG.js +1 -0
  190. package/dist/chunks/sessionTracing-UFK96PxT.js +11 -0
  191. package/dist/chunks/settings-BK6gCko-.js +1 -0
  192. package/dist/chunks/settings-YIDksG5Z.js +24 -0
  193. package/dist/chunks/setup-BBvZyrfz.js +3 -0
  194. package/dist/chunks/{shadowedRuleDetection-CTnYVrmP.js → shadowedRuleDetection-D6R2OeoH.js} +1 -1
  195. package/dist/chunks/{sideQuestion-Cl8m2qYx.js → sideQuestion-5jcbOMsR.js} +3 -3
  196. package/dist/chunks/{sinks-CiupmfTg.js → sinks-B-kFqjjd.js} +1 -1
  197. package/dist/chunks/sinks-DB_D4lmu.js +1 -0
  198. package/dist/chunks/skillChangeDetector-103-nEle.js +1 -0
  199. package/dist/chunks/{skillGapStore-es3K-aYe.js → skillGapStore-DOz1KCqo.js} +2 -2
  200. package/dist/chunks/{skillLifecycle-BcgoOQBk.js → skillLifecycle-D9NkIwFQ.js} +2 -2
  201. package/dist/chunks/{skillSearchPanel-CuDDb1L-.js → skillSearchPanel-DFiSZaJ4.js} +2 -2
  202. package/dist/chunks/skills-DgeLr52a.js +1 -0
  203. package/dist/chunks/sleep-BbWr_FL1.js +1 -0
  204. package/dist/chunks/{src-9vmGsuSI.js → src-Cy5_qH26.js} +1 -1
  205. package/dist/chunks/{src-DL3w8VPk.js → src-WZ94ZKI3.js} +4 -4
  206. package/dist/chunks/{startupProfiler-DF0AjiDf.js → startupProfiler-DIM_Ihyp.js} +2 -2
  207. package/dist/chunks/startupProfiler-FpGsKWYk.js +1 -0
  208. package/dist/chunks/{state-BQ4BEGin.js → state-CXY-q5gr.js} +1 -1
  209. package/dist/chunks/state-DXt6rahM.js +1 -0
  210. package/dist/chunks/{staticRender-BVWx0IM1.js → staticRender-RHUIg5ln.js} +1 -1
  211. package/dist/chunks/status-CKLecQZV.js +1 -0
  212. package/dist/chunks/{statusNoticeHelpers-BfmIub5L.js → statusNoticeHelpers-DI45AH-c.js} +1 -1
  213. package/dist/chunks/stringUtils-D_xPrwGQ.js +4 -0
  214. package/dist/chunks/switcher-D2Z2ZNQ0.js +1 -0
  215. package/dist/chunks/switcher-DhZCaAun.js +1 -0
  216. package/dist/chunks/{tasks-B6gYXxOx.js → tasks-6suPhqsK.js} +1 -1
  217. package/dist/chunks/{templateJobs-BW6TaqEC.js → templateJobs-BKVEWCsb.js} +1 -1
  218. package/dist/chunks/{terminalSetup-C-g9Xvj3.js → terminalSetup-7PUR4hfo.js} +1 -1
  219. package/dist/chunks/{terminalSetup-BgIXFBpd.js → terminalSetup-Cqy5_PhJ.js} +4 -4
  220. package/dist/chunks/{theme-9AZceq_m.js → theme-B-HG2PUs.js} +1 -1
  221. package/dist/chunks/tipRegistry-BR_lSGRw.js +2 -0
  222. package/dist/chunks/{toolEventObserver-DTuJcREC.js → toolEventObserver-BY3QVnr6.js} +1 -1
  223. package/dist/chunks/toolPool-BcwIF8Q_.js +1 -0
  224. package/dist/chunks/{types-97nL3naE.js → types-CD25a50S.js} +1 -1
  225. package/dist/chunks/udsClient-CCxgLiZy.js +1 -0
  226. package/dist/chunks/urlHandler-BNsQKqba.js +1 -0
  227. package/dist/chunks/{use-select-navigation-BStVRvcX.js → use-select-navigation-CW5alA9r.js} +1 -1
  228. package/dist/chunks/{useDoublePress-C9xxQzh1.js → useDoublePress-DQBLKyzJ.js} +1 -1
  229. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-DWRFdFoU.js → useExitOnCtrlCDWithKeybindings-BgJrnuDl.js} +1 -1
  230. package/dist/chunks/useMainLoopModel-BVgJo4hN.js +1 -0
  231. package/dist/chunks/useManagePlugins-CrWjzESW.js +1 -0
  232. package/dist/chunks/useMergedTools-r6GQq5mI.js +1 -0
  233. package/dist/chunks/{useSearchInput-B_mY9wBq.js → useSearchInput-BITV_Txn.js} +1 -1
  234. package/dist/chunks/{useSettingsErrors-CM7tThcp.js → useSettingsErrors-CO0fTNzn.js} +1 -1
  235. package/dist/chunks/{util-Bb2S6g9N.js → util-_zo3I1y8.js} +1 -1
  236. package/dist/chunks/validatePlugin-DFGdRhA-.js +1 -0
  237. package/dist/chunks/{vim-Dpnhgoz_.js → vim-qgMS88ss.js} +1 -1
  238. package/dist/chunks/worktree-CR_M6Qfy.js +1 -0
  239. package/dist/cli.js +1 -1
  240. package/package.json +1 -1
  241. package/scripts/postinstall.cjs +16 -16
  242. package/dist/chunks/AgentsMdExternalIncludesDialog-Bnb1jWcg.js +0 -1
  243. package/dist/chunks/App-B8q8PV77.js +0 -1
  244. package/dist/chunks/BackgroundTasksDialog-i0TkZgQp.js +0 -2
  245. package/dist/chunks/CustomSelect-BvTftqEH.js +0 -1
  246. package/dist/chunks/DiffDialog-v5r8cBKW.js +0 -6
  247. package/dist/chunks/Doctor-DKpBnbuI.js +0 -1
  248. package/dist/chunks/Doctor-uvO6NM5m.js +0 -3
  249. package/dist/chunks/KeybindingProviderSetup-DsJqfEt-.js +0 -1
  250. package/dist/chunks/MCPConnectionManager-DkZVxLEj.js +0 -1
  251. package/dist/chunks/MCPToolListView-De1W4jpj.js +0 -1
  252. package/dist/chunks/MessageSelector-DW_itlX-.js +0 -3
  253. package/dist/chunks/Messages-BFsCpACq.js +0 -10
  254. package/dist/chunks/PromptInputHelpMenu-Bm5KY0Ma.js +0 -1
  255. package/dist/chunks/QueryEngine-egz5mbaW.js +0 -1
  256. package/dist/chunks/REPL-D27CE4WN.js +0 -124
  257. package/dist/chunks/REPL-e8wAT1wN.js +0 -1
  258. package/dist/chunks/ResumeConversation-CWA27Lke.js +0 -1
  259. package/dist/chunks/SearchExtraToolsTool-BRchtZ9Q.js +0 -1
  260. package/dist/chunks/Settings-axHLvYIy.js +0 -3
  261. package/dist/chunks/Spinner-VjwI7m_g.js +0 -1
  262. package/dist/chunks/ThemePicker-CtQYHmOr.js +0 -1
  263. package/dist/chunks/agents-DEnmg8Xo.js +0 -101
  264. package/dist/chunks/allErrors-C9kx6lnk.js +0 -1
  265. package/dist/chunks/appleTerminalBackup-CT7g8yOs.js +0 -1
  266. package/dist/chunks/backgroundHousekeeping-CvWfd99M.js +0 -1
  267. package/dist/chunks/caches-DWjwe-DN.js +0 -1
  268. package/dist/chunks/caches-VLs1tQkZ.js +0 -1
  269. package/dist/chunks/client-CO_6v4yl.js +0 -1
  270. package/dist/chunks/client-DO-O441l.js +0 -1
  271. package/dist/chunks/commands-Cn1P7Tms.js +0 -1
  272. package/dist/chunks/compact-DGUhdXcc.js +0 -2
  273. package/dist/chunks/config-C7GTF4iI.js +0 -1
  274. package/dist/chunks/config-CWPHVTic.js +0 -3
  275. package/dist/chunks/config-Cox0TM2Z.js +0 -1
  276. package/dist/chunks/context-noninteractive--OuiZUzL.js +0 -1
  277. package/dist/chunks/conversation--y8PD2Lk.js +0 -1
  278. package/dist/chunks/conversation-BIPJEOwO.js +0 -1
  279. package/dist/chunks/conversationRecovery-BBJzrA0g.js +0 -1
  280. package/dist/chunks/crossProjectResume-CwZb3cEU.js +0 -40
  281. package/dist/chunks/cwd-BZMp3CZ8.js +0 -1
  282. package/dist/chunks/doctor-4NiE46ZG.js +0 -1
  283. package/dist/chunks/envUtils-DfkgIdYf.js +0 -1
  284. package/dist/chunks/execFileNoThrow-BgRsj_SW.js +0 -34
  285. package/dist/chunks/exit-CrsQsjbx.js +0 -1
  286. package/dist/chunks/extractMemories-kogJzpit.js +0 -1
  287. package/dist/chunks/fast-CuNVwVTr.js +0 -1
  288. package/dist/chunks/fast-RlFnwGRV.js +0 -1
  289. package/dist/chunks/fetchModelList-uiCPVqbJ.js +0 -1
  290. package/dist/chunks/genericProcessUtils-BNlr-QxM.js +0 -23
  291. package/dist/chunks/grok-DnmklTrm.js +0 -1
  292. package/dist/chunks/history-kOw3CcLT.js +0 -1
  293. package/dist/chunks/hooks-BDY1jMbS.js +0 -1
  294. package/dist/chunks/install-DrMiHa2Q.js +0 -1
  295. package/dist/chunks/keybindings-BRRN_eap.js +0 -1
  296. package/dist/chunks/loadAgentsDir-CJAK4kif.js +0 -1
  297. package/dist/chunks/localSearch-DyaB2Rm-.js +0 -1
  298. package/dist/chunks/main-B_09WbaG.js +0 -345
  299. package/dist/chunks/managedEnv-BJGfe3m7.js +0 -1
  300. package/dist/chunks/managedEnv-CIWJsuty.js +0 -1
  301. package/dist/chunks/managedEnvConstants-BPwL2aWI.js +0 -1
  302. package/dist/chunks/mcp-1nBvcNxw.js +0 -1
  303. package/dist/chunks/mcp-7DXpXMdT.js +0 -2
  304. package/dist/chunks/mcp-kw99WVi2.js +0 -6
  305. package/dist/chunks/memory-CjWvzR_9.js +0 -1
  306. package/dist/chunks/model-DpZaKZMb.js +0 -1
  307. package/dist/chunks/nativeInstaller-SmPeEisk.js +0 -1
  308. package/dist/chunks/openai-D_j7-KW6.js +0 -2
  309. package/dist/chunks/parser-2usBI4G-.js +0 -1
  310. package/dist/chunks/pidLock-B-SW3Nhx.js +0 -3
  311. package/dist/chunks/plan-BJrWtXEh.js +0 -1
  312. package/dist/chunks/plugin-D97VJAxW.js +0 -17
  313. package/dist/chunks/pluginCliCommands-CUGPc853.js +0 -1
  314. package/dist/chunks/pluginOperations-rTrzu6Vg.js +0 -2
  315. package/dist/chunks/pluginStartupCheck-BRHnXlym.js +0 -1
  316. package/dist/chunks/poorMode-BaS0DBUO.js +0 -1
  317. package/dist/chunks/poorMode-DmvzFAz_.js +0 -1
  318. package/dist/chunks/print-Bi3xVdB3.js +0 -13
  319. package/dist/chunks/processBashCommand-BBtnCx-7.js +0 -1
  320. package/dist/chunks/processSlashCommand-jzF0GmLO.js +0 -5
  321. package/dist/chunks/prompt-CmijKW7G.js +0 -1
  322. package/dist/chunks/prompt-DYBx_D0H.js +0 -1
  323. package/dist/chunks/promptEditor-B6S_Rzcu.js +0 -4
  324. package/dist/chunks/refresh-CAGv8BJY.js +0 -1
  325. package/dist/chunks/reject-CEUkoI2G.js +0 -1
  326. package/dist/chunks/rename-DPFis9g_.js +0 -1
  327. package/dist/chunks/ripgrep-3omwGI-l.js +0 -1
  328. package/dist/chunks/ripgrep-CgQrN3XX.js +0 -5
  329. package/dist/chunks/sandbox-adapter-D15jjHJR.js +0 -1
  330. package/dist/chunks/searchExtraTools-BoFc__Eg.js +0 -1
  331. package/dist/chunks/sessionFileAccessHooks-Rgsp4_Ex.js +0 -1
  332. package/dist/chunks/sessionObserver-PcaVCVkX.js +0 -1
  333. package/dist/chunks/sessionStorage-Dkf7FRgA.js +0 -1
  334. package/dist/chunks/sessionTracing-D7rekMdW.js +0 -11
  335. package/dist/chunks/settings-8fwIkMDV.js +0 -1
  336. package/dist/chunks/settings-CodSADx8.js +0 -24
  337. package/dist/chunks/setup-DBiIrXrh.js +0 -3
  338. package/dist/chunks/sinks-DH83d_kd.js +0 -1
  339. package/dist/chunks/skillChangeDetector-BrrZaFkT.js +0 -1
  340. package/dist/chunks/skills-BRtgqnLz.js +0 -1
  341. package/dist/chunks/startupProfiler-D1NRu2nj.js +0 -1
  342. package/dist/chunks/state-D3gvDiu8.js +0 -1
  343. package/dist/chunks/status-WXA16wIM.js +0 -1
  344. package/dist/chunks/stringUtils-Bu_lJH5c.js +0 -4
  345. package/dist/chunks/switcher-5gilU5_R.js +0 -1
  346. package/dist/chunks/switcher-DMfuKuw_.js +0 -1
  347. package/dist/chunks/tipRegistry-DtO1H_Wo.js +0 -2
  348. package/dist/chunks/toolPool-DHS8jWaL.js +0 -1
  349. package/dist/chunks/udsClient-CmYHFiBD.js +0 -1
  350. package/dist/chunks/urlHandler-DLz3FZm1.js +0 -1
  351. package/dist/chunks/useMainLoopModel-DSN5HjV1.js +0 -1
  352. package/dist/chunks/useManagePlugins-ntnOf5OU.js +0 -1
  353. package/dist/chunks/useMergedTools-C5Yns9Ij.js +0 -1
  354. package/dist/chunks/validatePlugin-D8WQ5z4W.js +0 -1
  355. package/dist/chunks/worktree-a5oOPSYl.js +0 -1
@@ -1,4 +1,4 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{I as o,Lt as s,P as c,Wt as l,ai as u,t as d,y as f}from"./src-DL3w8VPk.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as m,tt as h}from"./state-BQ4BEGin.js";import{Bp as g,Cb as _,Cd as v,Dc as y,Dd as b,Ec as x,Ed as S,Gp as C,Kp as ee,Sd as w,Td as T,Vp as te,wd as E,xd as D,zp as O}from"./loadAgentsDir-DGozQu_6.js";import{d as k,h as ne,s as A}from"./settings-CodSADx8.js";import{l as j,o as M}from"./stringUtils-Bu_lJH5c.js";import{n as N}from"./analytics-COpjZpvd.js";import{n as P,t as F}from"./select-Fq6g2Ejk.js";function re(e,t){let n={PreToolUse:{},PostToolUse:{},PostToolUseFailure:{},PermissionDenied:{},Notification:{},UserPromptSubmit:{},SessionStart:{},SessionEnd:{},Stop:{},StopFailure:{},SubagentStart:{},SubagentStop:{},PreCompact:{},PostCompact:{},PermissionRequest:{},Setup:{},TeammateIdle:{},TaskCreated:{},TaskCompleted:{},Elicitation:{},ElicitationResult:{},ConfigChange:{},WorktreeCreate:{},WorktreeRemove:{},InstructionsLoaded:{},CwdChanged:{},FileChanged:{}},r=L(t);D(e).forEach(e=>{let t=n[e.event];if(t){let n=r[e.event].matcherMetadata===void 0?``:e.matcher||``;t[n]||(t[n]=[]),t[n].push(e)}});let i=h();if(i)for(let[e,t]of Object.entries(i)){let r=e,i=n[r];if(i)for(let e of t??[]){let t=e.matcher||``;if(`pluginRoot`in e){i[t]??(i[t]=[]);for(let n of e.hooks)i[t].push({event:r,config:n,matcher:e.matcher,source:`pluginHook`,pluginName:e.pluginId})}}}return n}function ie(e,t){return b(Object.keys(e[t]||{}),e,t)}function ae(e,t,n){let r=n??``;return e[t]?.[r]??[]}function I(e,t){return L(t)[e].matcherMetadata}var L,R=e((()=>{r(),m(),S(),L=n(e=>({PreToolUse:{summary:`Before tool execution`,description:`Input to command is JSON of tool call arguments.
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{I as o,Lt as s,P as c,Wt as l,ai as u,t as d,y as f}from"./src-WZ94ZKI3.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{Pt as m,tt as h}from"./state-CXY-q5gr.js";import{Bh as ee,Cd as g,Dc as _,Dd as v,Ec as y,Ed as b,Gh as x,Kh as S,Sd as C,Td as w,Vh as te,tb as T,wd as E,xd as D,zh as O}from"./loadAgentsDir-DR5PVAc3.js";import{d as k,m as ne,s as A}from"./settings-YIDksG5Z.js";import{n as j}from"./analytics-COpjZpvd.js";import{l as M,o as N}from"./stringUtils-D_xPrwGQ.js";import{n as P,t as F}from"./select-FrwoTzuc.js";function re(e,t){let n={PreToolUse:{},PostToolUse:{},PostToolUseFailure:{},PermissionDenied:{},Notification:{},UserPromptSubmit:{},SessionStart:{},SessionEnd:{},Stop:{},StopFailure:{},SubagentStart:{},SubagentStop:{},PreCompact:{},PostCompact:{},PermissionRequest:{},Setup:{},TeammateIdle:{},TaskCreated:{},TaskCompleted:{},Elicitation:{},ElicitationResult:{},ConfigChange:{},WorktreeCreate:{},WorktreeRemove:{},InstructionsLoaded:{},CwdChanged:{},FileChanged:{}},r=L(t);D(e).forEach(e=>{let t=n[e.event];if(t){let n=r[e.event].matcherMetadata===void 0?``:e.matcher||``;t[n]||(t[n]=[]),t[n].push(e)}});let i=h();if(i)for(let[e,t]of Object.entries(i)){let r=e,i=n[r];if(i)for(let e of t??[]){let t=e.matcher||``;if(`pluginRoot`in e){i[t]??(i[t]=[]);for(let n of e.hooks)i[t].push({event:r,config:n,matcher:e.matcher,source:`pluginHook`,pluginName:e.pluginId})}}}return n}function ie(e,t){return v(Object.keys(e[t]||{}),e,t)}function ae(e,t,n){let r=n??``;return e[t]?.[r]??[]}function I(e,t){return L(t)[e].matcherMetadata}var L,R=e((()=>{r(),m(),b(),L=n(e=>({PreToolUse:{summary:`Before tool execution`,description:`Input to command is JSON of tool call arguments.
2
2
  Exit code 0 - stdout/stderr not shown
3
3
  Exit code 2 - show stderr to model and block tool call
4
4
  Other exit codes - show stderr to user only but continue with tool call`,matcherMetadata:{fieldToMatch:`tool_name`,values:e}},PostToolUse:{summary:`After tool execution`,description:`Input to command is JSON with fields "inputs" (tool call arguments) and "response" (tool call response).
@@ -76,4 +76,4 @@ CLAUDE_ENV_FILE is set — write bash exports there to apply env to subsequent B
76
76
  The matcher field specifies filenames to watch in the current directory (e.g. ".envrc|.env").
77
77
  Hook output can include hookSpecificOutput.watchPaths (array of absolute paths) to dynamically update the watch list.
78
78
  Exit code 0 - command completes successfully
79
- Other exit codes - show stderr to user only`}}),e=>e.slice().sort().join(`,`))}));function z({hookEventMetadata:e,hooksByEvent:t,totalHooksCount:n,restrictedByPolicy:r,onSelectEvent:i,onCancel:l}){return(0,B.jsx)(f,{title:`Hooks`,subtitle:`${n} ${j(n,`hook`)} configured`,onCancel:l,children:(0,B.jsxs)(o,{flexDirection:`column`,gap:1,children:[r&&(0,B.jsxs)(o,{flexDirection:`column`,children:[(0,B.jsxs)(c,{color:`suggestion`,children:[a.info,` Hooks Restricted by Policy`]}),(0,B.jsx)(c,{dimColor:!0,children:`Only hooks from managed settings can run. User-defined hooks from ~/.workmate/settings.json, .workmate/settings.json, and .workmate/settings.local.json are blocked.`})]}),(0,B.jsx)(o,{flexDirection:`column`,children:(0,B.jsxs)(c,{dimColor:!0,children:[a.info,` This menu is read-only. To add or modify hooks, edit settings.json directly or ask Work Mate.`,` `,(0,B.jsx)(s,{url:`https://code.workmate.com/docs/en/hooks`,children:`Learn more`})]})}),(0,B.jsx)(o,{flexDirection:`column`,children:(0,B.jsx)(F,{onChange:e=>{i(e)},onCancel:l,options:Object.entries(e).map(([e,n])=>{let r=t[e]||0;return{label:r>0?(0,B.jsxs)(c,{children:[e,` `,(0,B.jsxs)(c,{color:`suggestion`,children:[`(`,r,`)`]})]}):e,value:e,description:n.summary}})})})]})})}var B,V=e((()=>{i(),d(),M(),P(),B=p()}));function H({selectedEvent:e,selectedMatcher:t,hooksForSelectedMatcher:n,hookEventMetadata:r,onSelect:i,onCancel:a}){let s=r.matcherMetadata===void 0?e:`${e} - Matcher: ${t||`(all)`}`;return n.length===0?(0,U.jsx)(f,{title:s,subtitle:r.description,onCancel:a,inputGuide:()=>(0,U.jsx)(c,{children:`Esc to go back`}),children:(0,U.jsxs)(o,{flexDirection:`column`,gap:1,children:[(0,U.jsx)(c,{dimColor:!0,children:`No hooks configured for this event.`}),(0,U.jsx)(c,{dimColor:!0,children:`To add hooks, edit settings.json directly or ask Work Mate.`})]})}):(0,U.jsx)(f,{title:s,subtitle:r.description,onCancel:a,children:(0,U.jsx)(o,{flexDirection:`column`,children:(0,U.jsx)(F,{options:n.map((e,t)=>({label:`[${e.config.type}] ${w(e.config)}`,value:t.toString(),description:e.source===`pluginHook`&&e.pluginName?`${E(e.source)} (${e.pluginName})`:E(e.source)})),onChange:e=>{let t=n[parseInt(e,10)];t&&i(t)},onCancel:a})})})}var U,W=e((()=>{d(),S(),P(),U=p()}));function G({selectedEvent:e,matchersForSelectedEvent:t,hooksByEventAndMatcher:n,eventDescription:r,onSelect:i,onCancel:a}){let s=K.useMemo(()=>t.map(t=>{let r=n[e]?.[t]||[];return{matcher:t,sources:Array.from(new Set(r.map(e=>e.source))),hookCount:r.length}}),[t,n,e]);return t.length===0?(0,q.jsx)(f,{title:`${e} - Matchers`,subtitle:r,onCancel:a,inputGuide:()=>(0,q.jsx)(c,{children:`Esc to go back`}),children:(0,q.jsxs)(o,{flexDirection:`column`,gap:1,children:[(0,q.jsx)(c,{dimColor:!0,children:`No hooks configured for this event.`}),(0,q.jsx)(c,{dimColor:!0,children:`To add hooks, edit settings.json directly or ask Work Mate.`})]})}):(0,q.jsx)(f,{title:`${e} - Matchers`,subtitle:r,onCancel:a,children:(0,q.jsx)(o,{flexDirection:`column`,children:(0,q.jsx)(F,{options:s.map(e=>({label:`[${e.sources.map(T).join(`, `)}] ${e.matcher||`(all)`}`,value:e.matcher,description:`${e.hookCount} ${j(e.hookCount,`hook`)}`})),onChange:e=>{i(e)},onCancel:a})})})}var K,q,oe=e((()=>{K=t(u(),1),d(),S(),M(),P(),q=p()}));function se({selectedHook:e,eventSupportsMatcher:t,onCancel:n}){return(0,J.jsx)(f,{title:`Hook details`,onCancel:n,inputGuide:()=>(0,J.jsx)(c,{children:`Esc to go back`}),children:(0,J.jsxs)(o,{flexDirection:`column`,gap:1,children:[(0,J.jsxs)(o,{flexDirection:`column`,children:[(0,J.jsxs)(c,{children:[`Event: `,(0,J.jsx)(c,{bold:!0,children:e.event})]}),t&&(0,J.jsxs)(c,{children:[`Matcher: `,(0,J.jsx)(c,{bold:!0,children:e.matcher||`(all)`})]}),(0,J.jsxs)(c,{children:[`Type: `,(0,J.jsx)(c,{bold:!0,children:e.config.type})]}),(0,J.jsxs)(c,{children:[`Source: `,(0,J.jsx)(c,{dimColor:!0,children:v(e.source)})]}),e.pluginName&&(0,J.jsxs)(c,{children:[`Plugin: `,(0,J.jsx)(c,{dimColor:!0,children:e.pluginName})]})]}),(0,J.jsxs)(o,{flexDirection:`column`,children:[(0,J.jsxs)(c,{dimColor:!0,children:[ce(e.config),`:`]}),(0,J.jsx)(o,{borderStyle:`round`,borderDimColor:!0,paddingLeft:1,paddingRight:1,children:(0,J.jsx)(c,{children:le(e.config)})})]}),`statusMessage`in e.config&&e.config.statusMessage&&(0,J.jsxs)(c,{children:[`Status message: `,(0,J.jsx)(c,{dimColor:!0,children:e.config.statusMessage})]}),(0,J.jsx)(c,{dimColor:!0,children:`To modify or remove this hook, edit settings.json directly or ask Work Mate to help.`})]})})}function ce(e){switch(e.type){case`command`:return`Command`;case`prompt`:return`Prompt`;case`agent`:return`Prompt`;case`http`:return`URL`}}function le(e){switch(e.type){case`command`:return e.command;case`prompt`:return e.prompt;case`agent`:return e.prompt;case`http`:return e.url}}var J,ue=e((()=>{d(),S(),J=p()}));function Y({toolNames:e,onExit:t}){let[n,r]=(0,X.useState)({mode:`select-event`}),[i,a]=(0,X.useState)(()=>k()?.disableAllHooks===!0&&A(`policySettings`)?.disableAllHooks===!0),[s,u]=(0,X.useState)(()=>A(`policySettings`)?.allowManagedHooksOnly===!0);ee(e=>{if(e===`policySettings`){let e=k()?.disableAllHooks===!0;a(e&&A(`policySettings`)?.disableAllHooks===!0),u(A(`policySettings`)?.allowManagedHooksOnly===!0)}});let d=n.mode,p=`event`in n?n.event:`PreToolUse`,m=`matcher`in n?n.matcher:null,h=g(e=>e.mcp),_=te(),v=(0,X.useMemo)(()=>[...e,...h.tools.map(e=>e.name)],[e,h.tools]),y=(0,X.useMemo)(()=>re(_.getState(),v),[v,_]),b=(0,X.useMemo)(()=>ie(y,p),[y,p]),x=(0,X.useMemo)(()=>ae(y,p,m),[y,p,m]),S=(0,X.useCallback)(()=>{t(`Hooks dialog dismissed`,{display:`system`})},[t]);l(`confirm:no`,S,{context:`Confirmation`,isActive:d===`select-event`}),l(`confirm:no`,()=>{r({mode:`select-event`})},{context:`Confirmation`,isActive:d===`select-matcher`}),l(`confirm:no`,()=>{`event`in n&&(I(n.event,v)===void 0?r({mode:`select-event`}):r({mode:`select-matcher`,event:n.event}))},{context:`Confirmation`,isActive:d===`select-hook`}),l(`confirm:no`,()=>{if(n.mode===`view-hook`){let{event:e,hook:t}=n;r({mode:`select-hook`,event:e,matcher:t.matcher||``})}},{context:`Confirmation`,isActive:d===`view-hook`});let C=L(v),w=k()?.disableAllHooks===!0,{hooksByEvent:T,totalHooksCount:E}=(0,X.useMemo)(()=>{let e={},t=0;for(let[n,r]of Object.entries(y)){let i=Object.values(r).reduce((e,t)=>e+t.length,0);e[n]=i,t+=i}return{hooksByEvent:e,totalHooksCount:t}},[y]);if(w)return(0,Z.jsx)(f,{title:`Hook Configuration - Disabled`,onCancel:S,inputGuide:()=>(0,Z.jsx)(c,{children:`Esc to close`}),children:(0,Z.jsxs)(o,{flexDirection:`column`,gap:1,children:[(0,Z.jsxs)(o,{flexDirection:`column`,children:[(0,Z.jsxs)(c,{children:[`All hooks are currently `,(0,Z.jsx)(c,{bold:!0,children:`disabled`}),i&&` by a managed settings file`,`. You have `,(0,Z.jsx)(c,{bold:!0,children:E}),` `,`configured `,j(E,`hook`),` that `,j(E,`is`,`are`),` not running.`]}),(0,Z.jsx)(o,{marginTop:1,children:(0,Z.jsx)(c,{dimColor:!0,children:`When hooks are disabled:`})}),(0,Z.jsx)(c,{dimColor:!0,children:`· No hook commands will execute`}),(0,Z.jsx)(c,{dimColor:!0,children:`· StatusLine will not be displayed`}),(0,Z.jsx)(c,{dimColor:!0,children:`· Tool operations will proceed without hook validation`})]}),!i&&(0,Z.jsx)(c,{dimColor:!0,children:`To re-enable hooks, remove "disableAllHooks" from settings.json or ask Work Mate.`})]})});switch(n.mode){case`select-event`:return(0,Z.jsx)(z,{hookEventMetadata:C,hooksByEvent:T,totalHooksCount:E,restrictedByPolicy:s,onSelectEvent:e=>{I(e,v)===void 0?r({mode:`select-hook`,event:e,matcher:``}):r({mode:`select-matcher`,event:e})},onCancel:S});case`select-matcher`:return(0,Z.jsx)(G,{selectedEvent:n.event,matchersForSelectedEvent:b,hooksByEventAndMatcher:y,eventDescription:C[n.event].description,onSelect:e=>{r({mode:`select-hook`,event:n.event,matcher:e})},onCancel:()=>{r({mode:`select-event`})}});case`select-hook`:return(0,Z.jsx)(H,{selectedEvent:n.event,selectedMatcher:n.matcher,hooksForSelectedMatcher:x,hookEventMetadata:C[n.event],onSelect:e=>{r({mode:`view-hook`,event:n.event,hook:e})},onCancel:()=>{I(n.event,v)===void 0?r({mode:`select-event`}):r({mode:`select-matcher`,event:n.event})}});case`view-hook`:return(0,Z.jsx)(se,{selectedHook:n.hook,eventSupportsMatcher:I(n.event,v)!==void 0,onCancel:()=>{let{event:e,hook:t}=n;r({mode:`select-hook`,event:e,matcher:t.matcher||``})}})}}var X,Z,de=e((()=>{X=t(u(),1),O(),C(),d(),_(),R(),ne(),M(),V(),W(),oe(),ue(),Z=p()})),Q,$;e((()=>{de(),N(),y(),Q=p(),$=async(e,t)=>{let n=t.getAppState().toolPermissionContext;return(0,Q.jsx)(Y,{toolNames:x(n).map(e=>e.name),onExit:e})}}))();export{$ as call};
79
+ Other exit codes - show stderr to user only`}}),e=>e.slice().sort().join(`,`))}));function z({hookEventMetadata:e,hooksByEvent:t,totalHooksCount:n,restrictedByPolicy:r,onSelectEvent:i,onCancel:l}){return(0,B.jsx)(f,{title:`Hooks`,subtitle:`${n} ${M(n,`hook`)} configured`,onCancel:l,children:(0,B.jsxs)(o,{flexDirection:`column`,gap:1,children:[r&&(0,B.jsxs)(o,{flexDirection:`column`,children:[(0,B.jsxs)(c,{color:`suggestion`,children:[a.info,` Hooks Restricted by Policy`]}),(0,B.jsx)(c,{dimColor:!0,children:`Only hooks from managed settings can run. User-defined hooks from ~/.workmate/settings.json, .workmate/settings.json, and .workmate/settings.local.json are blocked.`})]}),(0,B.jsx)(o,{flexDirection:`column`,children:(0,B.jsxs)(c,{dimColor:!0,children:[a.info,` This menu is read-only. To add or modify hooks, edit settings.json directly or ask Work Mate.`,` `,(0,B.jsx)(s,{url:`https://code.workmate.com/docs/en/hooks`,children:`Learn more`})]})}),(0,B.jsx)(o,{flexDirection:`column`,children:(0,B.jsx)(F,{onChange:e=>{i(e)},onCancel:l,options:Object.entries(e).map(([e,n])=>{let r=t[e]||0;return{label:r>0?(0,B.jsxs)(c,{children:[e,` `,(0,B.jsxs)(c,{color:`suggestion`,children:[`(`,r,`)`]})]}):e,value:e,description:n.summary}})})})]})})}var B,V=e((()=>{i(),d(),N(),P(),B=p()}));function H({selectedEvent:e,selectedMatcher:t,hooksForSelectedMatcher:n,hookEventMetadata:r,onSelect:i,onCancel:a}){let s=r.matcherMetadata===void 0?e:`${e} - Matcher: ${t||`(all)`}`;return n.length===0?(0,U.jsx)(f,{title:s,subtitle:r.description,onCancel:a,inputGuide:()=>(0,U.jsx)(c,{children:`Esc to go back`}),children:(0,U.jsxs)(o,{flexDirection:`column`,gap:1,children:[(0,U.jsx)(c,{dimColor:!0,children:`No hooks configured for this event.`}),(0,U.jsx)(c,{dimColor:!0,children:`To add hooks, edit settings.json directly or ask Work Mate.`})]})}):(0,U.jsx)(f,{title:s,subtitle:r.description,onCancel:a,children:(0,U.jsx)(o,{flexDirection:`column`,children:(0,U.jsx)(F,{options:n.map((e,t)=>({label:`[${e.config.type}] ${C(e.config)}`,value:t.toString(),description:e.source===`pluginHook`&&e.pluginName?`${E(e.source)} (${e.pluginName})`:E(e.source)})),onChange:e=>{let t=n[parseInt(e,10)];t&&i(t)},onCancel:a})})})}var U,W=e((()=>{d(),b(),P(),U=p()}));function G({selectedEvent:e,matchersForSelectedEvent:t,hooksByEventAndMatcher:n,eventDescription:r,onSelect:i,onCancel:a}){let s=K.useMemo(()=>t.map(t=>{let r=n[e]?.[t]||[];return{matcher:t,sources:Array.from(new Set(r.map(e=>e.source))),hookCount:r.length}}),[t,n,e]);return t.length===0?(0,q.jsx)(f,{title:`${e} - Matchers`,subtitle:r,onCancel:a,inputGuide:()=>(0,q.jsx)(c,{children:`Esc to go back`}),children:(0,q.jsxs)(o,{flexDirection:`column`,gap:1,children:[(0,q.jsx)(c,{dimColor:!0,children:`No hooks configured for this event.`}),(0,q.jsx)(c,{dimColor:!0,children:`To add hooks, edit settings.json directly or ask Work Mate.`})]})}):(0,q.jsx)(f,{title:`${e} - Matchers`,subtitle:r,onCancel:a,children:(0,q.jsx)(o,{flexDirection:`column`,children:(0,q.jsx)(F,{options:s.map(e=>({label:`[${e.sources.map(w).join(`, `)}] ${e.matcher||`(all)`}`,value:e.matcher,description:`${e.hookCount} ${M(e.hookCount,`hook`)}`})),onChange:e=>{i(e)},onCancel:a})})})}var K,q,oe=e((()=>{K=t(u(),1),d(),b(),N(),P(),q=p()}));function se({selectedHook:e,eventSupportsMatcher:t,onCancel:n}){return(0,J.jsx)(f,{title:`Hook details`,onCancel:n,inputGuide:()=>(0,J.jsx)(c,{children:`Esc to go back`}),children:(0,J.jsxs)(o,{flexDirection:`column`,gap:1,children:[(0,J.jsxs)(o,{flexDirection:`column`,children:[(0,J.jsxs)(c,{children:[`Event: `,(0,J.jsx)(c,{bold:!0,children:e.event})]}),t&&(0,J.jsxs)(c,{children:[`Matcher: `,(0,J.jsx)(c,{bold:!0,children:e.matcher||`(all)`})]}),(0,J.jsxs)(c,{children:[`Type: `,(0,J.jsx)(c,{bold:!0,children:e.config.type})]}),(0,J.jsxs)(c,{children:[`Source: `,(0,J.jsx)(c,{dimColor:!0,children:g(e.source)})]}),e.pluginName&&(0,J.jsxs)(c,{children:[`Plugin: `,(0,J.jsx)(c,{dimColor:!0,children:e.pluginName})]})]}),(0,J.jsxs)(o,{flexDirection:`column`,children:[(0,J.jsxs)(c,{dimColor:!0,children:[ce(e.config),`:`]}),(0,J.jsx)(o,{borderStyle:`round`,borderDimColor:!0,paddingLeft:1,paddingRight:1,children:(0,J.jsx)(c,{children:le(e.config)})})]}),`statusMessage`in e.config&&e.config.statusMessage&&(0,J.jsxs)(c,{children:[`Status message: `,(0,J.jsx)(c,{dimColor:!0,children:e.config.statusMessage})]}),(0,J.jsx)(c,{dimColor:!0,children:`To modify or remove this hook, edit settings.json directly or ask Work Mate to help.`})]})})}function ce(e){switch(e.type){case`command`:return`Command`;case`prompt`:return`Prompt`;case`agent`:return`Prompt`;case`http`:return`URL`}}function le(e){switch(e.type){case`command`:return e.command;case`prompt`:return e.prompt;case`agent`:return e.prompt;case`http`:return e.url}}var J,ue=e((()=>{d(),b(),J=p()}));function Y({toolNames:e,onExit:t}){let[n,r]=(0,X.useState)({mode:`select-event`}),[i,a]=(0,X.useState)(()=>k()?.disableAllHooks===!0&&A(`policySettings`)?.disableAllHooks===!0),[s,u]=(0,X.useState)(()=>A(`policySettings`)?.allowManagedHooksOnly===!0);S(e=>{if(e===`policySettings`){let e=k()?.disableAllHooks===!0;a(e&&A(`policySettings`)?.disableAllHooks===!0),u(A(`policySettings`)?.allowManagedHooksOnly===!0)}});let d=n.mode,p=`event`in n?n.event:`PreToolUse`,m=`matcher`in n?n.matcher:null,h=ee(e=>e.mcp),g=te(),_=(0,X.useMemo)(()=>[...e,...h.tools.map(e=>e.name)],[e,h.tools]),v=(0,X.useMemo)(()=>re(g.getState(),_),[_,g]),y=(0,X.useMemo)(()=>ie(v,p),[v,p]),b=(0,X.useMemo)(()=>ae(v,p,m),[v,p,m]),x=(0,X.useCallback)(()=>{t(`Hooks dialog dismissed`,{display:`system`})},[t]);l(`confirm:no`,x,{context:`Confirmation`,isActive:d===`select-event`}),l(`confirm:no`,()=>{r({mode:`select-event`})},{context:`Confirmation`,isActive:d===`select-matcher`}),l(`confirm:no`,()=>{`event`in n&&(I(n.event,_)===void 0?r({mode:`select-event`}):r({mode:`select-matcher`,event:n.event}))},{context:`Confirmation`,isActive:d===`select-hook`}),l(`confirm:no`,()=>{if(n.mode===`view-hook`){let{event:e,hook:t}=n;r({mode:`select-hook`,event:e,matcher:t.matcher||``})}},{context:`Confirmation`,isActive:d===`view-hook`});let C=L(_),w=k()?.disableAllHooks===!0,{hooksByEvent:T,totalHooksCount:E}=(0,X.useMemo)(()=>{let e={},t=0;for(let[n,r]of Object.entries(v)){let i=Object.values(r).reduce((e,t)=>e+t.length,0);e[n]=i,t+=i}return{hooksByEvent:e,totalHooksCount:t}},[v]);if(w)return(0,Z.jsx)(f,{title:`Hook Configuration - Disabled`,onCancel:x,inputGuide:()=>(0,Z.jsx)(c,{children:`Esc to close`}),children:(0,Z.jsxs)(o,{flexDirection:`column`,gap:1,children:[(0,Z.jsxs)(o,{flexDirection:`column`,children:[(0,Z.jsxs)(c,{children:[`All hooks are currently `,(0,Z.jsx)(c,{bold:!0,children:`disabled`}),i&&` by a managed settings file`,`. You have `,(0,Z.jsx)(c,{bold:!0,children:E}),` `,`configured `,M(E,`hook`),` that `,M(E,`is`,`are`),` not running.`]}),(0,Z.jsx)(o,{marginTop:1,children:(0,Z.jsx)(c,{dimColor:!0,children:`When hooks are disabled:`})}),(0,Z.jsx)(c,{dimColor:!0,children:`· No hook commands will execute`}),(0,Z.jsx)(c,{dimColor:!0,children:`· StatusLine will not be displayed`}),(0,Z.jsx)(c,{dimColor:!0,children:`· Tool operations will proceed without hook validation`})]}),!i&&(0,Z.jsx)(c,{dimColor:!0,children:`To re-enable hooks, remove "disableAllHooks" from settings.json or ask Work Mate.`})]})});switch(n.mode){case`select-event`:return(0,Z.jsx)(z,{hookEventMetadata:C,hooksByEvent:T,totalHooksCount:E,restrictedByPolicy:s,onSelectEvent:e=>{I(e,_)===void 0?r({mode:`select-hook`,event:e,matcher:``}):r({mode:`select-matcher`,event:e})},onCancel:x});case`select-matcher`:return(0,Z.jsx)(G,{selectedEvent:n.event,matchersForSelectedEvent:y,hooksByEventAndMatcher:v,eventDescription:C[n.event].description,onSelect:e=>{r({mode:`select-hook`,event:n.event,matcher:e})},onCancel:()=>{r({mode:`select-event`})}});case`select-hook`:return(0,Z.jsx)(H,{selectedEvent:n.event,selectedMatcher:n.matcher,hooksForSelectedMatcher:b,hookEventMetadata:C[n.event],onSelect:e=>{r({mode:`view-hook`,event:n.event,hook:e})},onCancel:()=>{I(n.event,_)===void 0?r({mode:`select-event`}):r({mode:`select-matcher`,event:n.event})}});case`view-hook`:return(0,Z.jsx)(se,{selectedHook:n.hook,eventSupportsMatcher:I(n.event,_)!==void 0,onCancel:()=>{let{event:e,hook:t}=n;r({mode:`select-hook`,event:e,matcher:t.matcher||``})}})}}var X,Z,de=e((()=>{X=t(u(),1),O(),x(),d(),T(),R(),ne(),N(),V(),W(),oe(),ue(),Z=p()})),Q,$;e((()=>{de(),j(),_(),Q=p(),$=async(e,t)=>{let n=t.getAppState().toolPermissionContext;return(0,Q.jsx)(Y,{toolNames:y(n).map(e=>e.name),onExit:e})}}))();export{$ as call};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,ai as r,kn as i,s as a,t as o}from"./src-WZ94ZKI3.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{I as c,M as l,c as u,i as d}from"./debug-kBjDaVkQ.js";import{Kt as f,Ut as p,m,t as h,y as g}from"./settings-YIDksG5Z.js";import{n as _}from"./analytics-COpjZpvd.js";import{a as v,n as y,r as b,s as x,t as S}from"./nativeInstaller-ChGSz1lb.js";import{join as C}from"node:path";import{homedir as w}from"node:os";var T=e(r(),1);_(),o(),d(),f(),c(),S(),m();var E=s();function D(){let e=p.platform===`win32`,t=w();return e?C(t,`.local`,`bin`,`claude.exe`).replace(/\//g,`\\`):`~/.local/bin/claude`}function O({messages:e}){return e.length===0?null:(0,E.jsxs)(t,{flexDirection:`column`,gap:0,marginBottom:1,children:[(0,E.jsx)(t,{children:(0,E.jsxs)(n,{color:`warning`,children:[(0,E.jsx)(a,{status:`warning`,withSpace:!0}),`Setup notes:`]})}),e.map((e,r)=>(0,E.jsx)(t,{marginLeft:2,children:(0,E.jsxs)(n,{dimColor:!0,children:[`• `,e]})},r))]})}function k({onDone:e,force:r,target:i}){let[o,s]=(0,T.useState)({type:`checking`});return(0,T.useEffect)(()=>{async function e(){try{u(`Install: Starting installation process (force=${r}, target=${i})`);let e=i||h()?.autoUpdatesChannel||`latest`;s({type:`installing`,version:e}),u(`Install: Calling installLatest(channelOrVersion=${e}, forceReinstall=${r})`);let t=await x(e,r);if(u(`Install: installLatest returned version=${t.latestVersion}, wasUpdated=${t.wasUpdated}, lockFailed=${t.lockFailed}`),t.lockFailed)throw Error(`Could not install - another process is currently installing Work Mate. Please try again in a moment.`);t.latestVersion||u(`Install: Failed to retrieve version information during install`,{level:`error`}),t.wasUpdated||u(`Install: Already up to date`),s({type:`setting-up`});let n=await y(!0);u(`Install: Setup launcher completed with ${n.length} messages`),n.length>0&&n.forEach(e=>u(`Install: Setup message: ${e.message}`)),u(`Install: Cleaning up npm installations after successful install`);let{removed:a,errors:o,warnings:c}=await b();a>0&&u(`Cleaned up ${a} npm installation(s)`),o.length>0&&u(`Cleanup errors: ${o.join(`, `)}`);let l=await v();l.length>0&&u(`Shell alias cleanup: ${l.map(e=>e.message).join(`; `)}`),+!!t.latestVersion,(i===`latest`||i===`stable`)&&(g(`userSettings`,{autoUpdatesChannel:i}),u(`Install: Saved autoUpdatesChannel=${i} to user settings`));let d=[...c,...l.map(e=>e.message)];n.length>0?(s({type:`set-up`,messages:n.map(e=>e.message)}),setTimeout(s,2e3,{type:`success`,version:t.latestVersion||`current`,setupMessages:[...n.map(e=>e.message),...d]})):(u(`Install: Shell PATH already configured`),s({type:`success`,version:t.latestVersion||`current`,setupMessages:d.length>0?d:void 0}))}catch(e){u(`Install command failed: ${e}`,{level:`error`}),s({type:`error`,message:l(e)})}}e()},[r,i]),(0,T.useEffect)(()=>{o.type===`success`?setTimeout(e,2e3,`Work Mate installation completed successfully`,{display:`system`}):o.type===`error`&&setTimeout(e,3e3,`Work Mate installation failed`,{display:`system`})},[o,e]),(0,E.jsxs)(t,{flexDirection:`column`,marginTop:1,children:[o.type===`checking`&&(0,E.jsx)(n,{color:`claude`,children:`Checking installation status...`}),o.type===`cleaning-npm`&&(0,E.jsx)(n,{color:`warning`,children:`Cleaning up old npm installations...`}),o.type===`installing`&&(0,E.jsxs)(n,{color:`claude`,children:[`Installing Work Mate native build `,o.version,`...`]}),o.type===`setting-up`&&(0,E.jsx)(n,{color:`claude`,children:`Setting up launcher and shell integration...`}),o.type===`set-up`&&(0,E.jsx)(O,{messages:o.messages}),o.type===`success`&&(0,E.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,E.jsxs)(t,{children:[(0,E.jsx)(a,{status:`success`,withSpace:!0}),(0,E.jsx)(n,{color:`success`,bold:!0,children:`Work Mate successfully installed!`})]}),(0,E.jsxs)(t,{marginLeft:2,flexDirection:`column`,gap:1,children:[o.version!==`current`&&(0,E.jsxs)(t,{children:[(0,E.jsx)(n,{dimColor:!0,children:`Version: `}),(0,E.jsx)(n,{color:`claude`,children:o.version})]}),(0,E.jsxs)(t,{children:[(0,E.jsx)(n,{dimColor:!0,children:`Location: `}),(0,E.jsx)(n,{color:`text`,children:D()})]})]}),(0,E.jsx)(t,{marginLeft:2,flexDirection:`column`,gap:1,children:(0,E.jsxs)(t,{marginTop:1,children:[(0,E.jsx)(n,{dimColor:!0,children:`Next: Run `}),(0,E.jsx)(n,{color:`claude`,bold:!0,children:`claude --help`}),(0,E.jsx)(n,{dimColor:!0,children:` to get started`})]})}),o.setupMessages&&(0,E.jsx)(O,{messages:o.setupMessages})]}),o.type===`error`&&(0,E.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,E.jsxs)(t,{children:[(0,E.jsx)(a,{status:`error`,withSpace:!0}),(0,E.jsx)(n,{color:`error`,children:`Installation failed`})]}),(0,E.jsx)(n,{color:`error`,children:o.message}),(0,E.jsx)(t,{marginTop:1,children:(0,E.jsx)(n,{dimColor:!0,children:`Try running with --force to override checks`})})]})]})}var A={type:`local-jsx`,name:`install`,description:`安装 Work Mate 原生构建`,argumentHint:`[options]`,async call(e,t,n){let r=n.includes(`--force`),a=n.filter(e=>!e.startsWith(`--`))[0],{unmount:o}=await i((0,E.jsx)(k,{onDone:(t,n)=>{o(),e(t,n)},force:r,target:a}))}};export{A as install};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DfkgIdYf.js";import{n as r,t as i}from"./defineProperty-C-QyHrDq.js";import{E as a,M as o,O as s,S as c,b as l,d as u,h as d,i as f,l as p,n as m,p as ee,s as h,v as g,w as _,y as v}from"./esm-lWlUmoUA.js";import{A as te,B as ne,C as y,D as b,E as re,F as ie,O as ae,S as oe,T as se,b as ce,c as le,i as ue,m as de,n as x,o as fe,u as pe,v as S,w as me,x as he,y as ge}from"./esm-BbMeEYcz.js";import{n as _e,t as ve}from"./esm-sVMjGuep.js";import{H as ye,Pt as be,en as xe,gn as Se,wt as Ce,xn as we,zn as Te}from"./state-BQ4BEGin.js";import{$ as Ee,C as De,I as Oe,c as C,et as ke,i as Ae,r as je,x as Me}from"./debug-CRnGsZOV.js";import{o as Ne,s as Pe}from"./log-DoSpAwRP.js";import{i as Fe,n as Ie,r as Le}from"./platform-DsMIk3eq.js";import{n as Re,r as ze}from"./startupProfiler-DF0AjiDf.js";import{_ as Be,a as Ve,c as He,f as Ue,g as We,l as Ge,m as Ke,v as qe,y as Je}from"./proxy-BjkGlmBu.js";import{C as Ye,S as Xe,_ as Ze,c as Qe,g as $e,l as et,r as tt}from"./sessionTracing-D7rekMdW.js";import{arch as nt,hostname as rt,platform as it,release as at}from"os";import{inspect as ot}from"util";import*as st from"process";m();var w;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(w||(w={}));var ct=class{emit(e){}enabled(){return!1}},lt=new ct,ut=Symbol.for(`io.opentelemetry.js.api.logs`),T=globalThis;function dt(e,t,n){return r=>r===e?t:n}var ft=new class{getLogger(e,t,n){return new ct}},pt=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):lt}},mt=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new pt(this,e,t,n)}_getDelegate(){return this._delegate??ft}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}},ht=class e{constructor(){this._proxyLoggerProvider=new mt}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return T[ut]?this.getLoggerProvider():(T[ut]=dt(1,e,ft),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return T[ut]?.call(T,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete T[ut],this._proxyLoggerProvider=new mt}}.getInstance(),gt=s(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function _t(e){return e.setValue(gt,!0)}function vt(e){return e.getValue(gt)===!0}m();function E(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!yt(n)){h.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!bt(r)){h.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function yt(e){return typeof e==`string`&&e!==``}function bt(e){return e==null?!0:Array.isArray(e)?xt(e):St(typeof e)}function xt(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(St(e)){t=e;continue}return!1}return!1}}return!0}function St(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}m();function Ct(){return e=>{h.error(wt(e))}}function wt(e){return typeof e==`string`?e:JSON.stringify(Tt(e))}function Tt(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var Et=Ct();function D(e){try{Et(e)}catch{}}m();function O(e){let t=process.env[e];if(t==null||t.trim()===``)return;let n=Number(t);if(isNaN(n)){h.warn(`Unknown value ${ot(t)} for ${e}, expected a number, using defaults`);return}return n}function Dt(e){let t=process.env[e];if(!(t==null||t.trim()===``))return t}var Ot=`2.9.0`,kt=`process.runtime.name`;S();var At={[re]:`opentelemetry`,[kt]:`node`,[se]:ae,[b]:Ot},k=performance,jt=9,Mt=10**6,Nt=10**jt;function A(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Mt)]}function Pt(e){return zt(A(k.timeOrigin),A(typeof e==`number`?e:k.now()))}function Ft(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=Nt),[n,r]}function j(e){return e[0]*1e6+e[1]/1e3}function It(e){return e[0]+e[1]/Nt}function Lt(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Rt(e){return Lt(e)||typeof e==`number`||e instanceof Date}function zt(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Nt&&(n[1]-=Nt,n[0]+=1),n}var M;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(M||(M={}));var Bt=`[object Object]`,Vt=`[object Null]`,Ht=`[object Undefined]`,Ut=Function.prototype.toString,Wt=Ut.call(Object),Gt=Object.getPrototypeOf,Kt=Object.prototype,qt=Kt.hasOwnProperty,N=Symbol?Symbol.toStringTag:void 0,Jt=Kt.toString;function Yt(e){if(!Xt(e)||Zt(e)!==Bt)return!1;let t=Gt(e);if(t===null)return!0;let n=qt.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Ut.call(n)===Wt}function Xt(e){return typeof e==`object`&&!!e}function Zt(e){return e==null?e===void 0?Ht:Vt:N&&N in Object(e)?Qt(e):$t(e)}function Qt(e){let t=qt.call(e,N),n=e[N],r=!1;try{e[N]=void 0,r=!0}catch{}let i=Jt.call(e);return r&&(t?e[N]=n:delete e[N]),i}function $t(e){return Jt.call(e)}var en=20;function tn(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=rn(t,e.shift(),0,n);return t}function nn(e){return on(e)?e.slice():e}function rn(e,t,n=0,r){let i;if(!(n>en)){if(n++,cn(e)||cn(t)||sn(t))i=nn(t);else if(on(e)){if(i=e.slice(),on(t))for(let e=0,n=t.length;e<n;e++)i.push(nn(t[e]));else if(P(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=nn(t[r]))}}}else if(P(e))if(P(t)){if(!ln(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(cn(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(an(e,s,r)||an(t,s,r))delete i[s];else{if(P(a)&&P(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=rn(i[s],c,n,r)}}}}else i=t;return i}}function an(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function on(e){return Array.isArray(e)}function sn(e){return typeof e==`function`}function P(e){return!cn(e)&&!on(e)&&!sn(e)&&typeof e==`object`}function cn(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function ln(e,t){return!(!Yt(e)||!Yt(t))}r();var un=class{constructor(){i(this,`_promise`,void 0),i(this,`_resolve`,void 0),i(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};r();var dn=class{constructor(e,t){i(this,`_isCalled`,!1),i(this,`_deferred`,new un),i(this,`_callback`,void 0),i(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};m();function fn(e,t){return new Promise(n=>{p.with(_t(p.active()),()=>{e.export(t,n)})})}var pn={_export:fn},mn;function hn(){if(mn===void 0)try{let e=globalThis.process.argv0;mn=e?`unknown_service:${e}`:`unknown_service`}catch{mn=`unknown_service`}return mn}var F=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;m(),S(),r();var gn=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=vn(t),r._asyncAttributesPending=t.filter(([e,t])=>F(t)).length>0,r}constructor(e,t){i(this,`_rawAttributes`,void 0),i(this,`_asyncAttributesPending`,!1),i(this,`_schemaUrl`,void 0),i(this,`_memoizedAttributes`,void 0);let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(F(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=vn(this._rawAttributes),this._schemaUrl=yn(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,F(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&h.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(F(n)){h.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=bn(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function I(e,t){return gn.FromAttributeList(Object.entries(e),t)}function _n(){return I({[y]:hn(),[se]:At[se],[re]:At[re],[b]:At[b]})}function vn(e){return e.map(([e,t])=>F(t)?[e,t.catch(t=>{h.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function yn(e){if(typeof e==`string`||e===void 0)return e;h.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function bn(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;h.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}m(),S(),r();var xn=new class{constructor(){i(this,`_MAX_LENGTH`,255),i(this,`_COMMA_SEPARATOR`,`,`),i(this,`_LABEL_KEY_VALUE_SPLITTER`,`=`)}detect(e){let t={},n=Dt(`OTEL_RESOURCE_ATTRIBUTES`),r=Dt(`OTEL_SERVICE_NAME`);if(n)try{let e=this._parseResourceAttributes(n);Object.assign(t,e)}catch(e){h.debug(`EnvDetector failed: ${e instanceof Error?e.message:e}`)}return r&&(t[y]=r),{attributes:t}}_parseResourceAttributes(e){if(!e)return{};let t={},n=e.split(this._COMMA_SEPARATOR).filter(e=>e.trim()!==``);for(let e of n){let n=e.split(this._LABEL_KEY_VALUE_SPLITTER);if(n.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${e}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[r,i]=n,a=r.trim(),o=i.trim();if(a.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${e}".`);let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch(t){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${e}": ${t instanceof Error?t.message:t}`,{cause:t})}if(s.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${s}".`);if(c.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${s}".`);t[s]=c}return t}},Sn=`host.arch`,Cn=`host.id`,wn=`host.name`,Tn=`os.type`,En=`os.version`,L;async function Dn(){if(!L)switch(st.platform){case`darwin`:L=(await import(`./getMachineId-darwin-DqIFUVvd.js`)).getMachineId;break;case`linux`:L=(await import(`./getMachineId-linux-CnCTmdzd.js`)).getMachineId;break;case`freebsd`:L=(await import(`./getMachineId-bsd-DTYGimUN.js`)).getMachineId;break;case`win32`:L=(await import(`./getMachineId-win-vZhex7KX.js`)).getMachineId;break;default:L=(await import(`./getMachineId-unsupported-Cx21ssu1.js`)).getMachineId;break}return L()}var On=e=>{switch(e){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return e}},kn=e=>{switch(e){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return e}},An=new class{detect(e){return{attributes:{[wn]:rt(),[Sn]:On(nt()),[Cn]:Dn()}}}},jn=new class{detect(e){return{attributes:{[Tn]:kn(it()),[En]:at()}}}};function Mn(e){return Nn(e,new WeakSet)}function Nn(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Nn(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Nn(e,t))}return!1}m(),x(),S(),r();var Pn=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){i(this,`hrTime`,void 0),i(this,`hrTimeObserved`,void 0),i(this,`spanContext`,void 0),i(this,`resource`,void 0),i(this,`instrumentationScope`,void 0),i(this,`attributes`,{}),i(this,`_severityText`,void 0),i(this,`_severityNumber`,void 0),i(this,`_body`,void 0),i(this,`_eventName`,void 0),i(this,`_attributesCount`,0),i(this,`_droppedAttributesCount`,0),i(this,`_isReadonly`,!1),i(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:a,eventName:o,severityNumber:s,severityText:c,body:l,attributes:u={},exception:d,context:p}=n,m=Date.now();if(this.hrTime=de(r??m),this.hrTimeObserved=de(a??m),p){let e=f.getSpanContext(p);e&&g(e)&&(this.spanContext=e)}this.severityNumber=s,this.severityText=c,this.body=l,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=o,this.setAttributes(u),d!=null&&this._setException(d)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return h.warn(`Invalid attribute key: ${e}`),this;if(!Mn(t))return h.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&h.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return h.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(ce,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(oe,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(oe,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(ce,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(he,n.stack),t=!0)}t||h.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&h.warn(`Can not execute the operation on emitted log record`),this._isReadonly}};m(),r();var Fn=class{constructor(e,t){i(this,`instrumentationScope`,void 0),i(this,`_sharedState`,void 0),i(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||p.active(),r=e.severityNumber??w.UNSPECIFIED;if(r!==w.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=f.getSpanContext(n);if(e&&g(e)&&(e.traceFlags&c.SAMPLED)!==c.SAMPLED)return}let i=new Pn(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==w.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||p.active();if(t.traceBased){let e=f.getSpanContext(r);if(e&&g(e)&&(e.traceFlags&c.SAMPLED)!==c.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}},In=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}};x(),r();var Ln=class{constructor(e,t){i(this,`processors`,void 0),i(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>fe(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}};function Rn(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var zn=`otel.sdk.log.created`;r();var Bn=class{constructor(e){i(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(zn,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}},Vn=`0.215.0`;m(),r();var Hn={disabled:!1,minimumSeverity:w.UNSPECIFIED,traceBased:!1},Un=()=>({...Hn}),Wn=class{constructor(e,t,n,r,o,s){i(this,`loggers`,new Map),i(this,`activeProcessor`,void 0),i(this,`registeredLogRecordProcessors`,[]),i(this,`resource`,void 0),i(this,`forceFlushTimeoutMillis`,void 0),i(this,`logRecordLimits`,void 0),i(this,`processors`,void 0),i(this,`loggerMetrics`,void 0),i(this,`_loggerConfigurator`,void 0),i(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new Ln(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new In,this._loggerConfigurator=o??Un;let c=s?s.getMeter(`@opentelemetry/sdk-logs`,Vn):a();this.loggerMetrics=new Bn(c)}getLoggerConfig(e){let t=Rn(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}};m(),ve(),x(),r();var Gn=class{constructor(e={}){i(this,`_shutdownOnce`,void 0),i(this,`_sharedState`,void 0);let t={resource:e.resource??_e(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??Un,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new Wn(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new ue(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return h.warn(`A shutdown LoggerProvider cannot provide a Logger`),lt;e||h.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Fn({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(h.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(h.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};x();var Kn=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:pe(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:le.SUCCESS})}};m(),x(),r();async function qn(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var Jn=class{constructor(e,t,n){i(this,`_exportCompleted`,void 0),i(this,`_exportScheduledPromise`,void 0),i(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await qn(t),await p.with(ne(p.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){ie(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===le.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},Yn=class{constructor(e,t){i(this,`_maxExportBatchSize`,void 0),i(this,`_maxQueueSize`,void 0),i(this,`_scheduledDelayMillis`,void 0),i(this,`_exportTimeoutMillis`,void 0),i(this,`_exporter`,void 0),i(this,`_currentExport`,null),i(this,`_finishedLogRecords`,[]),i(this,`_timer`,void 0),i(this,`_shutdownOnce`,void 0),i(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new ue(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(h.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new Jn(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){ie(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new Jn(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,ie(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},Xn=class extends Yn{onShutdown(){}},Zn;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(Zn||(Zn={}));var R;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(R||(R={}));var z;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(z||(z={}));function Qn(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function $n(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}var er=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function B(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new er(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function tr(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function nr(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function rr(e,t){return e.toLowerCase()===t.toLowerCase()}var V;(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(V||(V={})),r();var ir=class{constructor(){i(this,`kind`,V.DROP)}createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}};r();function ar(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var or=class{constructor(e,t,n=!0,r=ar(t)){i(this,`startTime`,void 0),i(this,`_boundaries`,void 0),i(this,`_recordMinMax`,void 0),i(this,`_current`,void 0),this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=nr(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},sr=class{constructor(e,t){i(this,`kind`,V.HISTOGRAM),i(this,`_boundaries`,void 0),i(this,`_recordMinMax`,void 0),this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new or(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new or(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new or(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:z.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===R.GAUGE||e.type===R.UP_DOWN_COUNTER||e.type===R.OBSERVABLE_GAUGE||e.type===R.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}};r();var cr=class e{constructor(e=new lr,t=0,n=0,r=0){i(this,`backing`,void 0),i(this,`indexBase`,void 0),i(this,`indexStart`,void 0),i(this,`indexEnd`,void 0),this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},lr=class e{constructor(e=[0]){i(this,`_counts`,void 0),this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}},ur=2146435072,dr=1048575,fr=1023,pr=-1022,mr=fr,hr=2**-1022;function gr(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&ur)>>20)-fr}function _r(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let n=t.getUint32(0),r=t.getUint32(4);return(n&dr)*2**32+r}function vr(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}function yr(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var H=class extends Error{};r();var br=class{constructor(e){i(this,`_shift`,void 0),this._shift=-e}mapToIndex(e){return e<hr?this._minNormalLowerBoundaryIndex():gr(e)+this._rightShift(_r(e)-1,52)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new H(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new H(`overflow: ${e} is > maximum lower boundary: ${n}`);return vr(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=pr>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return mr>>this._shift}_rightShift(e,t){return Math.floor(e*2**-t)}};r();var xr=class{constructor(e){i(this,`_scale`,void 0),i(this,`_scaleFactor`,void 0),i(this,`_inverseFactor`,void 0),this._scale=e,this._scaleFactor=vr(Math.LOG2E,e),this._inverseFactor=vr(Math.LN2,-e)}mapToIndex(e){if(e<=hr)return this._minNormalLowerBoundaryIndex()-1;if(_r(e)===0)return(gr(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new H(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return hr;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new H(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return pr<<this._scale}_maxNormalLowerBoundaryIndex(){return(mr+1<<this._scale)-1}},Sr=-10,Cr=20,wr=Array.from({length:31},(e,t)=>t>10?new xr(t-10):new br(t-10));function Tr(e){if(e>Cr||e<Sr)throw new H(`expected scale >= ${Sr} && <= ${Cr}, got: ${e}`);return wr[e+10]}m(),r();var U=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}constructor(e,t){i(this,`low`,void 0),i(this,`high`,void 0),this.low=e,this.high=t}},Er=20,Dr=160,Or=2,kr=class e{constructor(e,t=Dr,n=!0,r=0,a=0,o=0,s=1/0,c=-1/0,l=new cr,u=new cr,d=Tr(Er)){i(this,`startTime`,void 0),i(this,`_maxSize`,void 0),i(this,`_recordMinMax`,void 0),i(this,`_sum`,void 0),i(this,`_count`,void 0),i(this,`_zeroCount`,void 0),i(this,`_min`,void 0),i(this,`_max`,void 0),i(this,`_positive`,void 0),i(this,`_negative`,void 0),i(this,`_mapping`,void 0),this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=a,this._zeroCount=o,this._min=s,this._max=c,this._positive=l,this._negative=u,this._mapping=d,this._maxSize<Or&&(h.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DZ_SvEVz.js";import{n as r,t as i}from"./defineProperty-C-QyHrDq.js";import{E as a,M as o,O as s,S as c,b as l,d as u,h as d,i as f,l as p,n as m,p as ee,s as h,v as g,w as _,y as v}from"./esm-lWlUmoUA.js";import{A as te,B as ne,C as y,D as b,E as re,F as ie,O as ae,S as oe,T as se,b as ce,c as le,i as ue,m as de,n as x,o as fe,u as pe,v as S,w as me,x as he,y as ge}from"./esm-BbMeEYcz.js";import{n as _e,t as ve}from"./esm-sVMjGuep.js";import{H as ye,Pt as be,en as xe,gn as Se,wt as Ce,xn as we,zn as Te}from"./state-CXY-q5gr.js";import{$ as Ee,C as De,I as Oe,c as C,et as ke,i as Ae,r as je,x as Me}from"./debug-kBjDaVkQ.js";import{o as Ne,s as Pe}from"./log-DWZny1vM.js";import{i as Fe,n as Ie,r as Le}from"./platform-Vl9IynC3.js";import{n as Re,r as ze}from"./startupProfiler-DIM_Ihyp.js";import{_ as Be,a as Ve,c as He,f as Ue,g as We,l as Ge,m as Ke,v as qe,y as Je}from"./proxy-BtWuysHM.js";import{C as Ye,S as Xe,_ as Ze,c as Qe,g as $e,l as et,r as tt}from"./sessionTracing-UFK96PxT.js";import{arch as nt,hostname as rt,platform as it,release as at}from"os";import{inspect as ot}from"util";import*as st from"process";m();var w;(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(w||(w={}));var ct=class{emit(e){}enabled(){return!1}},lt=new ct,ut=Symbol.for(`io.opentelemetry.js.api.logs`),T=globalThis;function dt(e,t,n){return r=>r===e?t:n}var ft=new class{getLogger(e,t,n){return new ct}},pt=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):lt}},mt=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new pt(this,e,t,n)}_getDelegate(){return this._delegate??ft}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}},ht=class e{constructor(){this._proxyLoggerProvider=new mt}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return T[ut]?this.getLoggerProvider():(T[ut]=dt(1,e,ft),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return T[ut]?.call(T,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete T[ut],this._proxyLoggerProvider=new mt}}.getInstance(),gt=s(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`);function _t(e){return e.setValue(gt,!0)}function vt(e){return e.getValue(gt)===!0}m();function E(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!yt(n)){h.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!bt(r)){h.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function yt(e){return typeof e==`string`&&e!==``}function bt(e){return e==null?!0:Array.isArray(e)?xt(e):St(typeof e)}function xt(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(St(e)){t=e;continue}return!1}return!1}}return!0}function St(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}m();function Ct(){return e=>{h.error(wt(e))}}function wt(e){return typeof e==`string`?e:JSON.stringify(Tt(e))}function Tt(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var Et=Ct();function D(e){try{Et(e)}catch{}}m();function O(e){let t=process.env[e];if(t==null||t.trim()===``)return;let n=Number(t);if(isNaN(n)){h.warn(`Unknown value ${ot(t)} for ${e}, expected a number, using defaults`);return}return n}function Dt(e){let t=process.env[e];if(!(t==null||t.trim()===``))return t}var Ot=`2.9.0`,kt=`process.runtime.name`;S();var At={[re]:`opentelemetry`,[kt]:`node`,[se]:ae,[b]:Ot},k=performance,jt=9,Mt=10**6,Nt=10**jt;function A(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Mt)]}function Pt(e){return zt(A(k.timeOrigin),A(typeof e==`number`?e:k.now()))}function Ft(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=Nt),[n,r]}function j(e){return e[0]*1e6+e[1]/1e3}function It(e){return e[0]+e[1]/Nt}function Lt(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Rt(e){return Lt(e)||typeof e==`number`||e instanceof Date}function zt(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=Nt&&(n[1]-=Nt,n[0]+=1),n}var M;(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(M||(M={}));var Bt=`[object Object]`,Vt=`[object Null]`,Ht=`[object Undefined]`,Ut=Function.prototype.toString,Wt=Ut.call(Object),Gt=Object.getPrototypeOf,Kt=Object.prototype,qt=Kt.hasOwnProperty,N=Symbol?Symbol.toStringTag:void 0,Jt=Kt.toString;function Yt(e){if(!Xt(e)||Zt(e)!==Bt)return!1;let t=Gt(e);if(t===null)return!0;let n=qt.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&Ut.call(n)===Wt}function Xt(e){return typeof e==`object`&&!!e}function Zt(e){return e==null?e===void 0?Ht:Vt:N&&N in Object(e)?Qt(e):$t(e)}function Qt(e){let t=qt.call(e,N),n=e[N],r=!1;try{e[N]=void 0,r=!0}catch{}let i=Jt.call(e);return r&&(t?e[N]=n:delete e[N]),i}function $t(e){return Jt.call(e)}var en=20;function tn(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=rn(t,e.shift(),0,n);return t}function nn(e){return on(e)?e.slice():e}function rn(e,t,n=0,r){let i;if(!(n>en)){if(n++,cn(e)||cn(t)||sn(t))i=nn(t);else if(on(e)){if(i=e.slice(),on(t))for(let e=0,n=t.length;e<n;e++)i.push(nn(t[e]));else if(P(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=nn(t[r]))}}}else if(P(e))if(P(t)){if(!ln(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(cn(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(an(e,s,r)||an(t,s,r))delete i[s];else{if(P(a)&&P(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=rn(i[s],c,n,r)}}}}else i=t;return i}}function an(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function on(e){return Array.isArray(e)}function sn(e){return typeof e==`function`}function P(e){return!cn(e)&&!on(e)&&!sn(e)&&typeof e==`object`}function cn(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function ln(e,t){return!(!Yt(e)||!Yt(t))}r();var un=class{constructor(){i(this,`_promise`,void 0),i(this,`_resolve`,void 0),i(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}};r();var dn=class{constructor(e,t){i(this,`_isCalled`,!1),i(this,`_deferred`,new un),i(this,`_callback`,void 0),i(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}};m();function fn(e,t){return new Promise(n=>{p.with(_t(p.active()),()=>{e.export(t,n)})})}var pn={_export:fn},mn;function hn(){if(mn===void 0)try{let e=globalThis.process.argv0;mn=e?`unknown_service:${e}`:`unknown_service`}catch{mn=`unknown_service`}return mn}var F=e=>typeof e==`object`&&!!e&&typeof e.then==`function`;m(),S(),r();var gn=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=vn(t),r._asyncAttributesPending=t.filter(([e,t])=>F(t)).length>0,r}constructor(e,t){i(this,`_rawAttributes`,void 0),i(this,`_asyncAttributesPending`,!1),i(this,`_schemaUrl`,void 0),i(this,`_memoizedAttributes`,void 0);let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(F(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=vn(this._rawAttributes),this._schemaUrl=yn(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,F(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&h.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(F(n)){h.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=bn(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}};function I(e,t){return gn.FromAttributeList(Object.entries(e),t)}function _n(){return I({[y]:hn(),[se]:At[se],[re]:At[re],[b]:At[b]})}function vn(e){return e.map(([e,t])=>F(t)?[e,t.catch(t=>{h.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function yn(e){if(typeof e==`string`||e===void 0)return e;h.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function bn(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;h.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}m(),S(),r();var xn=new class{constructor(){i(this,`_MAX_LENGTH`,255),i(this,`_COMMA_SEPARATOR`,`,`),i(this,`_LABEL_KEY_VALUE_SPLITTER`,`=`)}detect(e){let t={},n=Dt(`OTEL_RESOURCE_ATTRIBUTES`),r=Dt(`OTEL_SERVICE_NAME`);if(n)try{let e=this._parseResourceAttributes(n);Object.assign(t,e)}catch(e){h.debug(`EnvDetector failed: ${e instanceof Error?e.message:e}`)}return r&&(t[y]=r),{attributes:t}}_parseResourceAttributes(e){if(!e)return{};let t={},n=e.split(this._COMMA_SEPARATOR).filter(e=>e.trim()!==``);for(let e of n){let n=e.split(this._LABEL_KEY_VALUE_SPLITTER);if(n.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${e}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[r,i]=n,a=r.trim(),o=i.trim();if(a.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${e}".`);let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch(t){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${e}": ${t instanceof Error?t.message:t}`,{cause:t})}if(s.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${s}".`);if(c.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${s}".`);t[s]=c}return t}},Sn=`host.arch`,Cn=`host.id`,wn=`host.name`,Tn=`os.type`,En=`os.version`,L;async function Dn(){if(!L)switch(st.platform){case`darwin`:L=(await import(`./getMachineId-darwin-DqIFUVvd.js`)).getMachineId;break;case`linux`:L=(await import(`./getMachineId-linux-CnCTmdzd.js`)).getMachineId;break;case`freebsd`:L=(await import(`./getMachineId-bsd-DTYGimUN.js`)).getMachineId;break;case`win32`:L=(await import(`./getMachineId-win-vZhex7KX.js`)).getMachineId;break;default:L=(await import(`./getMachineId-unsupported-Cx21ssu1.js`)).getMachineId;break}return L()}var On=e=>{switch(e){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return e}},kn=e=>{switch(e){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return e}},An=new class{detect(e){return{attributes:{[wn]:rt(),[Sn]:On(nt()),[Cn]:Dn()}}}},jn=new class{detect(e){return{attributes:{[Tn]:kn(it()),[En]:at()}}}};function Mn(e){return Nn(e,new WeakSet)}function Nn(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Nn(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Nn(e,t))}return!1}m(),x(),S(),r();var Pn=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){i(this,`hrTime`,void 0),i(this,`hrTimeObserved`,void 0),i(this,`spanContext`,void 0),i(this,`resource`,void 0),i(this,`instrumentationScope`,void 0),i(this,`attributes`,{}),i(this,`_severityText`,void 0),i(this,`_severityNumber`,void 0),i(this,`_body`,void 0),i(this,`_eventName`,void 0),i(this,`_attributesCount`,0),i(this,`_droppedAttributesCount`,0),i(this,`_isReadonly`,!1),i(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:a,eventName:o,severityNumber:s,severityText:c,body:l,attributes:u={},exception:d,context:p}=n,m=Date.now();if(this.hrTime=de(r??m),this.hrTimeObserved=de(a??m),p){let e=f.getSpanContext(p);e&&g(e)&&(this.spanContext=e)}this.severityNumber=s,this.severityText=c,this.body=l,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=o,this.setAttributes(u),d!=null&&this._setException(d)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return h.warn(`Invalid attribute key: ${e}`),this;if(!Mn(t))return h.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&h.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return h.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(ce,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(oe,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(oe,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(ce,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(he,n.stack),t=!0)}t||h.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&h.warn(`Can not execute the operation on emitted log record`),this._isReadonly}};m(),r();var Fn=class{constructor(e,t){i(this,`instrumentationScope`,void 0),i(this,`_sharedState`,void 0),i(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||p.active(),r=e.severityNumber??w.UNSPECIFIED;if(r!==w.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=f.getSpanContext(n);if(e&&g(e)&&(e.traceFlags&c.SAMPLED)!==c.SAMPLED)return}let i=new Pn(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==w.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||p.active();if(t.traceBased){let e=f.getSpanContext(r);if(e&&g(e)&&(e.traceFlags&c.SAMPLED)!==c.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}},In=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}};x(),r();var Ln=class{constructor(e,t){i(this,`processors`,void 0),i(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>fe(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}};function Rn(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var zn=`otel.sdk.log.created`;r();var Bn=class{constructor(e){i(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(zn,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}},Vn=`0.215.0`;m(),r();var Hn={disabled:!1,minimumSeverity:w.UNSPECIFIED,traceBased:!1},Un=()=>({...Hn}),Wn=class{constructor(e,t,n,r,o,s){i(this,`loggers`,new Map),i(this,`activeProcessor`,void 0),i(this,`registeredLogRecordProcessors`,[]),i(this,`resource`,void 0),i(this,`forceFlushTimeoutMillis`,void 0),i(this,`logRecordLimits`,void 0),i(this,`processors`,void 0),i(this,`loggerMetrics`,void 0),i(this,`_loggerConfigurator`,void 0),i(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new Ln(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new In,this._loggerConfigurator=o??Un;let c=s?s.getMeter(`@opentelemetry/sdk-logs`,Vn):a();this.loggerMetrics=new Bn(c)}getLoggerConfig(e){let t=Rn(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}};m(),ve(),x(),r();var Gn=class{constructor(e={}){i(this,`_shutdownOnce`,void 0),i(this,`_sharedState`,void 0);let t={resource:e.resource??_e(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??Un,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new Wn(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new ue(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return h.warn(`A shutdown LoggerProvider cannot provide a Logger`),lt;e||h.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Fn({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(h.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(h.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}};x();var Kn=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:pe(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:le.SUCCESS})}};m(),x(),r();async function qn(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var Jn=class{constructor(e,t,n){i(this,`_exportCompleted`,void 0),i(this,`_exportScheduledPromise`,void 0),i(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await qn(t),await p.with(ne(p.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){ie(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===le.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},Yn=class{constructor(e,t){i(this,`_maxExportBatchSize`,void 0),i(this,`_maxQueueSize`,void 0),i(this,`_scheduledDelayMillis`,void 0),i(this,`_exportTimeoutMillis`,void 0),i(this,`_exporter`,void 0),i(this,`_currentExport`,null),i(this,`_finishedLogRecords`,[]),i(this,`_timer`,void 0),i(this,`_shutdownOnce`,void 0),i(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new ue(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(h.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new Jn(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){ie(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new Jn(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,ie(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},Xn=class extends Yn{onShutdown(){}},Zn;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(Zn||(Zn={}));var R;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(R||(R={}));var z;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(z||(z={}));function Qn(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function $n(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}var er=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function B(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new er(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function tr(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function nr(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function rr(e,t){return e.toLowerCase()===t.toLowerCase()}var V;(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(V||(V={})),r();var ir=class{constructor(){i(this,`kind`,V.DROP)}createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}};r();function ar(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var or=class{constructor(e,t,n=!0,r=ar(t)){i(this,`startTime`,void 0),i(this,`_boundaries`,void 0),i(this,`_recordMinMax`,void 0),i(this,`_current`,void 0),this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=nr(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},sr=class{constructor(e,t){i(this,`kind`,V.HISTOGRAM),i(this,`_boundaries`,void 0),i(this,`_recordMinMax`,void 0),this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new or(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new or(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new or(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:z.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===R.GAUGE||e.type===R.UP_DOWN_COUNTER||e.type===R.OBSERVABLE_GAUGE||e.type===R.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}};r();var cr=class e{constructor(e=new lr,t=0,n=0,r=0){i(this,`backing`,void 0),i(this,`indexBase`,void 0),i(this,`indexStart`,void 0),i(this,`indexEnd`,void 0),this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},lr=class e{constructor(e=[0]){i(this,`_counts`,void 0),this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}},ur=2146435072,dr=1048575,fr=1023,pr=-1022,mr=fr,hr=2**-1022;function gr(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&ur)>>20)-fr}function _r(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let n=t.getUint32(0),r=t.getUint32(4);return(n&dr)*2**32+r}function vr(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}function yr(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var H=class extends Error{};r();var br=class{constructor(e){i(this,`_shift`,void 0),this._shift=-e}mapToIndex(e){return e<hr?this._minNormalLowerBoundaryIndex():gr(e)+this._rightShift(_r(e)-1,52)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new H(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new H(`overflow: ${e} is > maximum lower boundary: ${n}`);return vr(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=pr>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return mr>>this._shift}_rightShift(e,t){return Math.floor(e*2**-t)}};r();var xr=class{constructor(e){i(this,`_scale`,void 0),i(this,`_scaleFactor`,void 0),i(this,`_inverseFactor`,void 0),this._scale=e,this._scaleFactor=vr(Math.LOG2E,e),this._inverseFactor=vr(Math.LN2,-e)}mapToIndex(e){if(e<=hr)return this._minNormalLowerBoundaryIndex()-1;if(_r(e)===0)return(gr(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new H(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return hr;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new H(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return pr<<this._scale}_maxNormalLowerBoundaryIndex(){return(mr+1<<this._scale)-1}},Sr=-10,Cr=20,wr=Array.from({length:31},(e,t)=>t>10?new xr(t-10):new br(t-10));function Tr(e){if(e>Cr||e<Sr)throw new H(`expected scale >= ${Sr} && <= ${Cr}, got: ${e}`);return wr[e+10]}m(),r();var U=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}constructor(e,t){i(this,`low`,void 0),i(this,`high`,void 0),this.low=e,this.high=t}},Er=20,Dr=160,Or=2,kr=class e{constructor(e,t=Dr,n=!0,r=0,a=0,o=0,s=1/0,c=-1/0,l=new cr,u=new cr,d=Tr(Er)){i(this,`startTime`,void 0),i(this,`_maxSize`,void 0),i(this,`_recordMinMax`,void 0),i(this,`_sum`,void 0),i(this,`_count`,void 0),i(this,`_zeroCount`,void 0),i(this,`_min`,void 0),i(this,`_max`,void 0),i(this,`_positive`,void 0),i(this,`_negative`,void 0),i(this,`_mapping`,void 0),this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=a,this._zeroCount=o,this._min=s,this._max=c,this._positive=l,this._negative=u,this._mapping=d,this._maxSize<Or&&(h.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
2
2
  changing to the minimum size of: ${Or}`),this._maxSize=Or)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(!Number.isNaN(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=yr(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=Tr(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=U.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=U.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new U(0,-1);let r=t-n;return new U(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}},Ar=class{constructor(e,t){i(this,`kind`,V.EXPONENTIAL_HISTOGRAM),i(this,`_maxSize`,void 0),i(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new kr(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:z.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===R.GAUGE||e.type===R.UP_DOWN_COUNTER||e.type===R.OBSERVABLE_GAUGE||e.type===R.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,positive:{offset:i.positive.offset,bucketCounts:i.positive.bucketCounts},negative:{offset:i.negative.offset,bucketCounts:i.negative.bucketCounts},count:i.count,scale:i.scale,zeroCount:i.zeroCount}}})}}};r();var jr=class{constructor(e,t=0,n=[0,0]){i(this,`startTime`,void 0),i(this,`_current`,void 0),i(this,`sampleTime`,void 0),this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=A(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},Mr=class{constructor(){i(this,`kind`,V.LAST_VALUE)}createAccumulation(e){return new jr(e)}merge(e,t){let n=j(t.sampleTime)>=j(e.sampleTime)?t:e;return new jr(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=j(t.sampleTime)>=j(e.sampleTime)?t:e;return new jr(t.startTime,n.toPointValue(),n.sampleTime)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:z.GAUGE,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()}))}}};r();var W=class{constructor(e,t,n=0,r=!1){i(this,`startTime`,void 0),i(this,`monotonic`,void 0),i(this,`_current`,void 0),i(this,`reset`,void 0),this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},Nr=class{constructor(e){i(this,`kind`,V.SUM),i(this,`monotonic`,void 0),this.monotonic=e}createAccumulation(e){return new W(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue();return t.reset?new W(t.startTime,this.monotonic,r,t.reset):new W(e.startTime,this.monotonic,n+r)}diff(e,t){let n=e.toPointValue(),r=t.toPointValue();return this.monotonic&&n>r?new W(t.startTime,this.monotonic,r,!0):new W(t.startTime,this.monotonic,r-n)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:z.SUM,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()})),isMonotonic:this.monotonic}}};m(),r();var Pr=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(Pr,`DEFAULT_INSTANCE`,new ir);var Fr=class e{createAggregator(t){switch(t.type){case R.COUNTER:case R.OBSERVABLE_COUNTER:case R.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};i(Fr,`MONOTONIC_INSTANCE`,new Nr(!0)),i(Fr,`NON_MONOTONIC_INSTANCE`,new Nr(!1));var Ir=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(Ir,`DEFAULT_INSTANCE`,new Mr);var Lr=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(Lr,`DEFAULT_INSTANCE`,new sr([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0));var Rr=class{constructor(e,t=!0){if(i(this,`_boundaries`,void 0),i(this,`_recordMinMax`,void 0),e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new sr(this._boundaries,this._recordMinMax)}},zr=class{constructor(e=160,t=!0){i(this,`_maxSize`,void 0),i(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new Ar(this._maxSize,this._recordMinMax)}},Br=class{_resolve(e){switch(e.type){case R.COUNTER:case R.UP_DOWN_COUNTER:case R.OBSERVABLE_COUNTER:case R.OBSERVABLE_UP_DOWN_COUNTER:return Hr;case R.GAUGE:case R.OBSERVABLE_GAUGE:return Ur;case R.HISTOGRAM:return e.advice.explicitBucketBoundaries?new Rr(e.advice.explicitBucketBoundaries):Wr}return h.warn(`Unable to recognize instrument type: ${e.type}`),Vr}createAggregator(e){return this._resolve(e).createAggregator(e)}},Vr=new Pr,Hr=new Fr,Ur=new Ir,Wr=new Lr;new zr;var Gr=new Br,G;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(G||(G={}));function Kr(e){switch(e.type){case G.DEFAULT:return Gr;case G.DROP:return Vr;case G.SUM:return Hr;case G.LAST_VALUE:return Ur;case G.EXPONENTIAL_HISTOGRAM:{let t=e;return new zr(t.options?.maxSize,t.options?.recordMinMax)}case G.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;return t.options==null?Wr:new Rr(t.options?.boundaries,t.options?.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}var qr=e=>({type:G.DEFAULT}),Jr=e=>Zn.CUMULATIVE,Yr=`otel.component.name`,Xr=`otel.component.type`,Zr=`periodic_metric_reader`,Qr=`otel.sdk.metric_reader.collection.duration`,$r=`error.type`;r();var ei=new Map,ti=class{constructor(e,t){i(this,`collectionDuration`,void 0),i(this,`standardAttrs`,void 0);let n=ei.get(e)??0;ei.set(e,n+1),this.standardAttrs={[Xr]:e,[Yr]:`${e}/${n}`},this.collectionDuration=t.createHistogram(Qr,{unit:`s`,description:`The duration of the collect operation of the metric reader.`,advice:{explicitBucketBoundaries:[]}})}recordCollection(e,t){let n=t?{...this.standardAttrs,[$r]:t}:this.standardAttrs;this.collectionDuration.record(e,n)}},ni=`2.9.0`;m(),r();var ri=class{constructor(e){i(this,`_shutdown`,!1),i(this,`_metricProducers`,void 0),i(this,`_sdkMetricProducer`,void 0),i(this,`_selfObsMetrics`,void 0),i(this,`_aggregationTemporalitySelector`,void 0),i(this,`_aggregationSelector`,void 0),i(this,`_cardinalitySelector`,void 0),i(this,`_otelComponentType`,void 0),this._aggregationSelector=e?.aggregationSelector??qr,this._aggregationTemporalitySelector=e?.aggregationTemporalitySelector??Jr,this._metricProducers=e?.metricProducers??[],this._cardinalitySelector=e?.cardinalitySelector,this._otelComponentType=e?.otelComponentType??this.constructor.name,this._selfObsMetrics=new ti(this._otelComponentType,a())}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}_setSelfObsMeterProvider(e){let t=e.getMeter(`@opentelemetry/sdk-metrics`,ni);this._selfObsMetrics=new ti(this._otelComponentType,t)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}async collect(e){if(this._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(this._shutdown)throw Error(`MetricReader is shutdown`);let t=Pt(),[n,...r]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:e?.timeoutMillis}),...this._metricProducers.map(t=>t.collect({timeoutMillis:e?.timeoutMillis}))]),i=Pt(),a=n.errors.concat(r.flatMap(e=>e.errors)),o=It(Ft(t,i));return this._selfObsMetrics.recordCollection(o,a.length>0?a[0].name??`collect_error`:void 0),{resourceMetrics:{resource:n.resourceMetrics.resource,scopeMetrics:n.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:a}}async shutdown(e){if(this._shutdown){h.error(`Cannot call shutdown twice.`);return}e?.timeoutMillis==null?await this.onShutdown():await B(this.onShutdown(),e.timeoutMillis),this._shutdown=!0}async forceFlush(e){if(this._shutdown){h.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if(e?.timeoutMillis==null){await this.onForceFlush();return}await B(this.onForceFlush(),e.timeoutMillis)}};function ii(e,t){if(!Number.isInteger(t)||t<=0)throw Error(`maxExportBatchSize must be a positive integer`);let n=[],r=0,i=[];function a(){i.length>0&&(n.push({resource:e.resource,scopeMetrics:i}),i=[],r=0)}for(let n of e.scopeMetrics){let e=null;for(let o of n.metrics){let s=o.dataPoints;if(s.length===0){e||(e={scope:n.scope,metrics:[]},i.push(e)),e.metrics.push(o);continue}let c=0;for(;c<s.length;){let l=t-r,u=Math.min(l,s.length-c);e||(e={scope:n.scope,metrics:[]},i.push(e));let d={...o,dataPoints:s.slice(c,c+u)};e.metrics.push(d),c+=u,r+=u,r===t&&(a(),e=null)}}}return a(),n}m(),r();var ai=class extends ri{constructor(e){let{exporter:t,exportIntervalMillis:n=6e4,metricProducers:r,cardinalityLimits:a,maxExportBatchSize:o}=e,{exportTimeoutMillis:s=3e4}=e;if(super({aggregationSelector:t.selectAggregation?.bind(t),aggregationTemporalitySelector:t.selectAggregationTemporality?.bind(t),otelComponentType:Zr,metricProducers:r,cardinalitySelector:e=>{let t={default:2e3,...a};switch(e){case R.COUNTER:return t.counter??t.default;case R.GAUGE:return t.gauge??t.default;case R.HISTOGRAM:return t.histogram??t.default;case R.OBSERVABLE_COUNTER:return t.observableCounter??t.default;case R.OBSERVABLE_UP_DOWN_COUNTER:return t.observableUpDownCounter??t.default;case R.OBSERVABLE_GAUGE:return t.observableGauge??t.default;case R.UP_DOWN_COUNTER:return t.upDownCounter??t.default;default:return t.default}}}),i(this,`_interval`,void 0),i(this,`_exporter`,void 0),i(this,`_exportInterval`,void 0),i(this,`_exportTimeout`,void 0),i(this,`_maxExportBatchSize`,void 0),i(this,`_ongoingExportPromise`,null),n<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(s<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(o!==void 0&&(!Number.isInteger(o)||o<=0))throw Error(`maxExportBatchSize must be a positive integer`);if(n<s){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);h.info(`Timeout of ${s} exceeds the interval of ${n}. Clamping timeout to interval duration.`),s=n}this._exportInterval=n,this._exportTimeout=s,this._exporter=t,this._maxExportBatchSize=o}async _runOnce(){try{await this._doRun()}catch(e){D(e)}}async _doRun(){if(this._ongoingExportPromise){h.debug(`PeriodicExportingMetricReader: export already in progress, skipping`);return}let e=async()=>{let{resourceMetrics:e,errors:t}=await this.collect({timeoutMillis:this._exportTimeout});if(t.length>0&&h.error(`PeriodicExportingMetricReader: metrics collection errors`,...t),e.resource.asyncAttributesPending)try{await e.resource.waitForAsyncAttributes?.()}catch(e){h.debug(`Error while resolving async portion of resource: `,e),D(e)}if(e.scopeMetrics.length===0)return;let n=this._maxExportBatchSize?ii(e,this._maxExportBatchSize):[e],r=null;for(let e of n)try{let t=await B(pn._export(this._exporter,e),this._exportTimeout);t.code!==M.SUCCESS&&(r=Error(`PeriodicExportingMetricReader: metrics export failed (error ${t.error})`))}catch(e){if(e instanceof er){h.error(`PeriodicExportingMetricReader: metrics export timed out after ${this._exportTimeout}ms`);break}else h.error(`PeriodicExportingMetricReader: metrics export threw error`,e),r=e instanceof Error?e:Error(String(e))}if(r)throw r};this._ongoingExportPromise=e();try{await this._ongoingExportPromise}finally{this._ongoingExportPromise=null}}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=`number`&&this._interval.unref()}async onForceFlush(){await this._awaitOngoingExport(),this._ongoingExportPromise?await this._awaitOngoingExport():await this._runOnce(),await this._exporter.forceFlush()}async _awaitOngoingExport(){if(this._ongoingExportPromise){h.debug(`PeriodicExportingMetricReader: export already in progress, awaiting ongoing export`);try{await this._ongoingExportPromise}catch{}}}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}};r();var oi=class e{constructor(e){i(this,`_shutdown`,!1),i(this,`_temporalitySelector`,void 0),this._temporalitySelector=e?.temporalitySelector??Jr}export(t,n){if(this._shutdown){n({code:M.FAILED});return}return e._sendMetrics(t,n)}forceFlush(){return Promise.resolve()}selectAggregationTemporality(e){return this._temporalitySelector(e)}shutdown(){return this._shutdown=!0,Promise.resolve()}static _sendMetrics(e,t){for(let t of e.scopeMetrics)for(let e of t.metrics)console.dir({descriptor:e.descriptor,dataPointType:e.dataPointType,dataPoints:e.dataPoints},{depth:null});t({code:M.SUCCESS})}};r();var si=class{constructor(){i(this,`_registeredViews`,[])}addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}};m();function K(e,t,n){return di(e)||h.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:n?.description??``,unit:n?.unit??``,valueType:n?.valueType??_.DOUBLE,advice:n?.advice??{}}}function ci(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function li(e,t){return rr(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var ui=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function di(e){return ui.test(e)}m(),r();var fi=class{constructor(e,t){i(this,`_writableMetricStorage`,void 0),i(this,`_descriptor`,void 0),this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},n){if(typeof e!=`number`){h.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===_.INT&&!Number.isInteger(e)&&(h.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,n,Date.now())}},pi=class extends fi{add(e,t,n){this._record(e,t,n)}},mi=class extends fi{add(e,t,n){if(e<0){h.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},hi=class extends fi{record(e,t,n){this._record(e,t,n)}},gi=class extends fi{record(e,t,n){if(e<0){h.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},_i=class{constructor(e,t,n){i(this,`_metricStorages`,void 0),i(this,`_descriptor`,void 0),i(this,`_observableRegistry`,void 0),this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},vi=class extends _i{},yi=class extends _i{},bi=class extends _i{};function xi(e){return e instanceof _i}r();var Si=class{constructor(e){i(this,`_meterSharedState`,void 0),this._meterSharedState=e}createGauge(e,t){let n=K(e,R.GAUGE,t);return new hi(this._meterSharedState.registerMetricStorage(n),n)}createHistogram(e,t){let n=K(e,R.HISTOGRAM,t);return new gi(this._meterSharedState.registerMetricStorage(n),n)}createCounter(e,t){let n=K(e,R.COUNTER,t);return new mi(this._meterSharedState.registerMetricStorage(n),n)}createUpDownCounter(e,t){let n=K(e,R.UP_DOWN_COUNTER,t);return new pi(this._meterSharedState.registerMetricStorage(n),n)}createObservableGauge(e,t){let n=K(e,R.OBSERVABLE_GAUGE,t);return new yi(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=K(e,R.OBSERVABLE_COUNTER,t);return new vi(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=K(e,R.OBSERVABLE_UP_DOWN_COUNTER,t);return new bi(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}};r();var Ci=class{constructor(e){i(this,`_instrumentDescriptor`,void 0),this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=K(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};r();var wi=class{constructor(e){i(this,`_valueMap`,new Map),i(this,`_keyMap`,new Map),i(this,`_hash`,void 0),this._hash=e}get(e,t){return t??(t=this._hash(e)),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n??(n=this._hash(e)),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t??(t=this._hash(e)),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},q=class extends wi{constructor(){super(Qn)}};r();var Ti=class{constructor(e,t){i(this,`_activeCollectionStorage`,new q),i(this,`_cumulativeMemoStorage`,new q),i(this,`_cardinalityLimit`,void 0),i(this,`_overflowAttributes`,{"otel.metric.overflow":!0}),i(this,`_overflowHashCode`,void 0),i(this,`_aggregator`,void 0),this._aggregator=e,this._cardinalityLimit=(t??2e3)-1,this._overflowHashCode=Qn(this._overflowAttributes)}record(e,t,n){let r=this._activeCollectionStorage.get(t);if(!r){let i=A(n);if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(i))?.record(e);return}r=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(t,r)}r?.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o?.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new q,e}};r();var Ei=class e{constructor(e,t){i(this,`_aggregator`,void 0),i(this,`_unreportedAccumulations`,new Map),i(this,`_reportHistory`,new Map),this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(t,n,r,i){this._stashAccumulations(r);let a=this._getMergedUnreportedAccumulations(t),o=a,s;if(this._reportHistory.has(t)){let n=this._reportHistory.get(t),r=n.collectionTime;s=n.aggregationTemporality,o=s===Zn.CUMULATIVE?e.merge(n.accumulations,a,this._aggregator):e.calibrateStartTime(n.accumulations,a,r)}else s=t.selectAggregationTemporality(n.type);this._reportHistory.set(t,{accumulations:o,collectionTime:i,aggregationTemporality:s});let c=Di(o);if(c.length!==0)return this._aggregator.toMetricData(n,s,c,i)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let n=new q,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return n;for(let t of r)n=e.merge(n,t,this._aggregator);return n}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){for(let[r,i]of e.keys())t.get(r,i)?.setStartTime(n);return t}};function Di(e){return Array.from(e.entries())}r();var Oi=class extends Ci{constructor(e,t,n,r,a){super(e),i(this,`_aggregationCardinalityLimit`,void 0),i(this,`_deltaMetricStorage`,void 0),i(this,`_temporalMetricStorage`,void 0),i(this,`_attributesProcessor`,void 0),this._aggregationCardinalityLimit=a,this._deltaMetricStorage=new Ti(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Ei(t,r),this._attributesProcessor=n}record(e,t){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(e,t);return}let n=new q;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};function ki(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}function Ai(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function ji(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function Mi(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}function Ni(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
3
3
  \t- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${r}
4
4
  \t- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}function Pi(e,t){return e.valueType===t.valueType?e.unit===t.unit?e.type===t.type?e.description===t.description?``:Ni(e,t):Mi(e,t):ji(e,t):Ai(e,t)}m(),r();var Fi=class e{constructor(){i(this,`_sharedRegistry`,new Map),i(this,`_perCollectorRegistry`,new Map)}static create(){return new e}getStorages(e){let t=[];for(let e of this._sharedRegistry.values())t=t.concat(e);let n=this._perCollectorRegistry.get(e);if(n!=null)for(let e of n.values())t=t.concat(e);return t}register(e){this._registerStorage(e,this._sharedRegistry)}registerForCollector(e,t){let n=this._perCollectorRegistry.get(e);n??(n=new Map,this._perCollectorRegistry.set(e,n)),this._registerStorage(t,n)}findOrUpdateCompatibleStorage(e){let t=this._sharedRegistry.get(e.name);return t===void 0?null:this._findOrUpdateCompatibleStorage(e,t)}findOrUpdateCompatibleCollectorStorage(e,t){let n=this._perCollectorRegistry.get(e);if(n===void 0)return null;let r=n.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)}_registerStorage(e,t){let n=e.getInstrumentDescriptor(),r=t.get(n.name);if(r===void 0){t.set(n.name,[e]);return}r.push(e)}_findOrUpdateCompatibleStorage(e,t){let n=null;for(let r of t){let t=r.getInstrumentDescriptor();li(t,e)?(t.description!==e.description&&(e.description.length>t.description.length&&r.updateDescription(e.description),h.warn(`A view or instrument with the name `,e.name,` has already been registered, but has a different description and is incompatible with another registered view.
@@ -9,13 +9,13 @@ To resolve the conflict:`,Pi(t,e))),n=r):h.warn(`A view or instrument with the n
9
9
  `,ki(t,e),`To resolve the conflict:
10
10
  `,Pi(t,e))}return n}};m(),r();var Ii=class{constructor(e){i(this,`_backingStorages`,void 0),i(this,`hasAttributeProcessor`,void 0),this._backingStorages=e,this.hasAttributeProcessor=e.some(e=>e.hasAttributeProcessor)}record(e,t,n,r){this.hasAttributeProcessor&&n===void 0&&(n=p.active());let i=this._backingStorages;for(let a=0;a<i.length;a++)i[a].record(e,t,n,r)}};m(),r();var Li=class{constructor(e,t){i(this,`_buffer`,new q),i(this,`_instrumentName`,void 0),i(this,`_valueType`,void 0),this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!=`number`){h.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===_.INT&&!Number.isInteger(e)&&(h.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}},Ri=class{constructor(){i(this,`_buffer`,new Map)}observe(e,t,n={}){if(!xi(e))return;let r=this._buffer.get(e);if(r??(r=new q,this._buffer.set(e,r)),typeof t!=`number`){h.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===_.INT&&!Number.isInteger(t)&&(h.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||r.set(n,t)}};m(),r();var zi=class{constructor(){i(this,`_callbacks`,[]),i(this,`_batchCallbacks`,[])}addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let n=new Set(t.filter(xi));if(n.size===0){h.error(`BatchObservableCallback is not associated with valid instruments`,t);return}this._findBatchCallback(e,n)>=0||this._batchCallbacks.push({callback:e,instruments:n})}removeBatchCallback(e,t){let n=new Set(t.filter(xi)),r=this._findBatchCallback(e,n);r<0||this._batchCallbacks.splice(r,1)}async observe(e,t){let n=this._observeCallbacks(e,t),r=this._observeBatchCallbacks(e,t);return(await Promise.allSettled([...n,...r])).filter(e=>e.status===`rejected`).map(e=>e.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:r})=>{let i=new Li(r._descriptor.name,r._descriptor.valueType),a=Promise.resolve(n(i));t!=null&&(a=B(a,t)),await a,r._metricStorages.forEach(t=>{t.record(i._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:r})=>{let i=new Ri,a=Promise.resolve(n(i));t!=null&&(a=B(a,t)),await a,r.forEach(t=>{let n=i._buffer.get(t);n!=null&&t._metricStorages.forEach(t=>{t.record(n,e)})})})}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&tr(n.instruments,t))}};m(),r();var Bi=class extends Ci{constructor(e,t,n,r,a){super(e),i(this,`_aggregationCardinalityLimit`,void 0),i(this,`_deltaMetricStorage`,void 0),i(this,`_temporalMetricStorage`,void 0),i(this,`_attributesProcessor`,void 0),i(this,`hasAttributeProcessor`,void 0),this._aggregationCardinalityLimit=a,this._deltaMetricStorage=new Ti(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Ei(t,r),this._attributesProcessor=n,this.hasAttributeProcessor=n!==void 0}record(e,t,n,r){this._attributesProcessor!==void 0&&(t=this._attributesProcessor.process(t,n??p.active())),this._deltaMetricStorage.record(e,t,r)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};r();var Vi=class{constructor(e,t){i(this,`metricStorageRegistry`,new Fi),i(this,`observableRegistry`,new zi),i(this,`meter`,void 0),i(this,`_meterProviderSharedState`,void 0),i(this,`_instrumentationScope`,void 0),this.meter=new Si(this),this._meterProviderSharedState=e,this._instrumentationScope=t}registerMetricStorage(e){let t=this._registerMetricStorage(e,Bi);return t.length===1?t[0]:new Ii(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,Oi)}async collect(e,t,n){let r=await this.observableRegistry.observe(t,n?.timeoutMillis),i=this.metricStorageRegistry.getStorages(e);if(i.length===0)return null;let a=[];return i.forEach(n=>{let r=n.collect(e,t);r!=null&&a.push(r)}),a.length===0?{errors:r}:{scopeMetrics:{scope:this._instrumentationScope,metrics:a},errors:r}}_registerMetricStorage(e,t){let n=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(n=>{let r=ci(n,e),i=this.metricStorageRegistry.findOrUpdateCompatibleStorage(r);if(i!=null)return i;let a=new t(r,n.aggregation.createAggregator(r),n.attributesProcessor,this._meterProviderSharedState.metricCollectors,n.aggregationCardinalityLimit);return this.metricStorageRegistry.register(a),a});if(n.length===0){let r=this._meterProviderSharedState.selectAggregations(e.type).map(([n,r])=>{let i=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(n,e);if(i!=null)return i;let a=r.createAggregator(e),o=n.selectCardinalityLimit(e.type),s=new t(e,a,void 0,[n],o);return this.metricStorageRegistry.registerForCollector(n,s),s});n=n.concat(r)}return n}};r();var Hi=class{constructor(e){i(this,`viewRegistry`,new si),i(this,`metricCollectors`,[]),i(this,`meterSharedStates`,new Map),i(this,`resource`,void 0),this.resource=e}getMeterSharedState(e){let t=$n(e),n=this.meterSharedStates.get(t);return n??(n=new Vi(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,Kr(n.selectAggregation(e))]);return t}};r();var Ui=class{constructor(e,t){i(this,`_sharedState`,void 0),i(this,`_metricReader`,void 0),this._sharedState=e,this._metricReader=t}async collect(e){let t=A(Date.now()),n=[],r=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(async i=>{let a=await i.collect(this,t,e);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&r.push(...a.errors)});return await Promise.all(i),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:r}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){return this._metricReader.selectCardinalityLimit?.(e)??2e3}};r();var Wi=/[\^$\\.+?()[\]{}|]/g,Gi=class e{constructor(t){i(this,`_matchAll`,void 0),i(this,`_regexp`,void 0),t===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(Wi,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(e){return e.includes(`*`)}},Ki=class{constructor(e){i(this,`_matchAll`,void 0),i(this,`_pattern`,void 0),this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};r();var qi=class{process(e,t){return e}},Ji=class{constructor(e){i(this,`_processors`,void 0),this._processors=e}process(e,t){let n=e;for(let e of this._processors)n=e.process(n,t);return n}};function Yi(){return Zi}function Xi(e){return new Ji(e)}var Zi=new qi;r();var Qi=class{constructor(e){i(this,`_nameFilter`,void 0),i(this,`_type`,void 0),i(this,`_unitFilter`,void 0),this._nameFilter=new Gi(e?.name??`*`),this._type=e?.type,this._unitFilter=new Ki(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};r();var $i=class{constructor(e){i(this,`_nameFilter`,void 0),i(this,`_versionFilter`,void 0),i(this,`_schemaUrlFilter`,void 0),this._nameFilter=new Ki(e?.name),this._versionFilter=new Ki(e?.version),this._schemaUrlFilter=new Ki(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};r();function ea(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function ta(e){if(ea(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&(e?.instrumentName==null||Gi.hasWildcard(e.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}var na=class{constructor(e){i(this,`name`,void 0),i(this,`description`,void 0),i(this,`aggregation`,void 0),i(this,`attributesProcessor`,void 0),i(this,`instrumentSelector`,void 0),i(this,`meterSelector`,void 0),i(this,`aggregationCardinalityLimit`,void 0),ta(e),e.attributesProcessors==null?this.attributesProcessor=Yi():this.attributesProcessor=Xi(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=Kr(e.aggregation??{type:G.DEFAULT}),this.instrumentSelector=new Qi({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new $i({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}};m(),r();var ra=class{constructor(e){if(i(this,`_sharedState`,void 0),i(this,`_shutdown`,!1),this._sharedState=new Hi(e?.resource??_n()),e?.views!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new na(t));if(e?.readers!=null&&e.readers.length>0)for(let t of e.readers){let n=new Ui(this._sharedState,t);t.setMetricProducer(n),this._sharedState.metricCollectors.push(n),e.sdkMetricsEnabled&&t instanceof ri&&t._setSelfObsMeterProvider(this)}}getMeter(e,t=``,n={}){return this._shutdown?(h.warn(`A shutdown MeterProvider cannot provide a Meter`),a()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}async shutdown(e){if(this._shutdown){h.warn(`shutdown may only be called once per MeterProvider`);return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(t=>t.shutdown(e)))}async forceFlush(e){if(this._shutdown){h.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}},ia=`exception`,aa=Symbol.for(`nodejs.util.inspect.custom`);function oa(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??(t[n]=r));return t}function sa(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}m(),S(),r();var ca=class{constructor(e){i(this,`_spanContext`,void 0),i(this,`kind`,void 0),i(this,`parentSpanContext`,void 0),i(this,`attributes`,{}),i(this,`links`,[]),i(this,`events`,[]),i(this,`startTime`,void 0),i(this,`resource`,void 0),i(this,`instrumentationScope`,void 0),i(this,`_droppedAttributesCount`,0),i(this,`_droppedEventsCount`,0),i(this,`_droppedLinksCount`,0),i(this,`_attributesCount`,0),i(this,`name`,void 0),i(this,`status`,{code:u.UNSET}),i(this,`endTime`,[0,0]),i(this,`_ended`,!1),i(this,`_duration`,[-1,-1]),i(this,`_spanProcessor`,void 0),i(this,`_spanLimits`,void 0),i(this,`_attributeValueLengthLimit`,void 0),i(this,`_recordEndMetrics`,void 0),i(this,`_performanceStartTime`,void 0),i(this,`_performanceOffset`,void 0),i(this,`_startTimeProvided`,void 0);let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=k.now(),this._performanceOffset=t-(this._performanceStartTime+k.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return h.warn(`Invalid attribute key: ${e}`),this;if(!bt(t))return h.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return h.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&h.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),Rt(t)&&(Rt(n)||(n=t),t=void 0);let i=E(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&h.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=E(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===u.UNSET||this.status.code===u.OK)return this;let t={code:e.code};return e.code===u.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&h.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){h.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=Ft(this.startTime,this.endTime),this._duration[0]<0&&(h.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&h.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&h.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=k.now())return Pt(e+this._performanceOffset);if(typeof e==`number`)return A(e);if(e instanceof Date)return A(e.getTime());if(Lt(e))return e;if(this._startTimeProvided)return A(Date.now());let t=k.now()-this._performanceStartTime;return zt(this.startTime,A(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[ce]=e:e&&(e.code?n[oe]=e.code.toString():e.name&&(n[oe]=e.name),e.message&&(n[ce]=e.message),e.stack&&(n[he]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(ia,n,t):h.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);h.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(h.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[aa](e,t,n){return sa(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:oa(this.resource)}},e,t,n)}},J;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(J||(J={}));var la=`otel.component.name`,ua=`otel.component.type`,da=`otel.span.parent.origin`,fa=`otel.span.sampling_result`,pa=`otel.sdk.processor.span.processed`,ma=`otel.sdk.processor.span.queue.capacity`,ha=`otel.sdk.processor.span.queue.size`,ga=`otel.sdk.span.live`,_a=`otel.sdk.span.started`,va=`batching_span_processor`;r();var ya=class{constructor(e){i(this,`startedSpans`,void 0),i(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(_a,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(ga,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=xa(t);if(this.startedSpans.add(1,{[da]:ba(e),[fa]:n}),t===J.NOT_RECORD)return()=>{};let r={[fa]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function ba(e){return e?e.isRemote?`remote`:`local`:`none`}function xa(e){switch(e){case J.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case J.RECORD:return`RECORD_ONLY`;case J.NOT_RECORD:return`DROP`}}var Sa=`2.9.0`;m(),r();var Ca=class{constructor(e,t){i(this,`_sampler`,void 0),i(this,`_spanLimits`,void 0),i(this,`_idGenerator`,void 0),i(this,`instrumentationScope`,void 0),i(this,`_resource`,void 0),i(this,`_spanProcessor`,void 0),i(this,`_tracerMetrics`,void 0),this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,Sa);this._tracerMetrics=new ya(n)}startSpan(e,t={},n=p.active()){t.root&&(n=f.deleteSpan(n));let r=f.getSpan(n);if(vt(n))return h.debug(`Instrumentation suppressed, returning Noop Span`),f.wrapSpanContext(l);let i=r?.spanContext(),a=this._idGenerator.generateSpanId(),o,s,u;!i||!f.isSpanContextValid(i)?s=this._idGenerator.generateTraceId():(s=i.traceId,u=i.traceState,o=i);let m=t.kind??ee.INTERNAL,g=(t.links??[]).map(e=>({context:e.context,attributes:E(e.attributes)})),_=E(t.attributes),v=this._sampler.shouldSample(n,s,e,m,_,g),te=this._tracerMetrics.startSpan(i,v.decision);u=v.traceState??u;let ne=v.decision===d.RECORD_AND_SAMPLED?c.SAMPLED:c.NONE,y={traceId:s,spanId:a,traceFlags:ne,traceState:u};if(v.decision===d.NOT_RECORD)return h.debug(`Recording is off, propagating context in a non-recording span`),f.wrapSpanContext(y);let b=E(Object.assign(_,v.attributes));return new ca({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:y,name:e,kind:m,links:g,parentSpanContext:o,attributes:b,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:te})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??p.active(),c=this.startSpan(e,i,s),l=f.setSpan(s,c);return p.with(l,o,void 0,c)}[aa](e,t,n){return sa(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:oa(this._resource)},spanLimits:this._spanLimits},e,t,n)}};r();var wa=class{constructor(e){i(this,`_spanProcessors`,void 0),this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{D(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},Ta=class{shouldSample(){return{decision:J.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},Y=class{shouldSample(){return{decision:J.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};m(),r();var X=class{constructor(e){i(this,`_root`,void 0),i(this,`_remoteParentSampled`,void 0),i(this,`_remoteParentNotSampled`,void 0),i(this,`_localParentSampled`,void 0),i(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(D(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new Y),this._remoteParentSampled=e.remoteParentSampled??new Y,this._remoteParentNotSampled=e.remoteParentNotSampled??new Ta,this._localParentSampled=e.localParentSampled??new Y,this._localParentNotSampled=e.localParentNotSampled??new Ta}shouldSample(e,t,n,r,i,a){let o=f.getSpanContext(e);return!o||!g(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&c.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&c.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};S(),r();var Ea=new Map,Da=class{constructor(e,t,n){i(this,`processedSpans`,void 0),i(this,`queueSize`,void 0),i(this,`queueSizeCallback`,void 0),i(this,`standardAttrs`,void 0),i(this,`droppedAttrs`,void 0);let r=Ea.get(e)??0;if(Ea.set(e,r+1),this.standardAttrs={[ua]:e,[la]:`${e}/${r}`},this.droppedAttrs={...this.standardAttrs,[ge]:`queue_full`},this.processedSpans=t.createCounter(pa,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(ma,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(ha,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n={...this.standardAttrs,[ge]:t.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};m(),r();var Oa=class{constructor(e){i(this,`_maxExportBatchSize`,void 0),i(this,`_maxQueueSize`,void 0),i(this,`_scheduledDelayMillis`,void 0),i(this,`_exportTimeoutMillis`,void 0),i(this,`_exporter`,void 0),i(this,`_metrics`,void 0),i(this,`_isExporting`,!1),i(this,`_finishedSpans`,[]),i(this,`_timer`,void 0),i(this,`_shutdownOnce`,void 0),i(this,`_droppedSpansCount`,0),this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new dn(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(h.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let t=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):a();this._metrics=new Da(va,t,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&c.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&h.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(h.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);p.with(_t(p.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,i=>{clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===M.SUCCESS?e():t(i.error??Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??(a=[]),a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{D(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,D(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},ka=class extends Oa{onShutdown(){}};r();var Aa=8,ja=16,Ma=class{constructor(){i(this,`generateTraceId`,Pa(ja)),i(this,`generateSpanId`,Pa(Aa))}},Na=Buffer.allocUnsafe(ja);function Pa(e){return function(){for(let t=0;t<e/4;t++)Na.writeUInt32BE(Math.random()*2**32>>>0,t*4);for(let t=0;t<e&&!(Na[t]>0);t++)t===e-1&&(Na[e-1]=1);return Na.toString(`hex`,0,e)}}m(),r();var Z;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Z||(Z={}));var Fa=class{constructor(e={}){i(this,`_resource`,void 0),i(this,`_activeSpanProcessor`,void 0),i(this,`_forceFlushTimeoutMillis`,void 0),i(this,`_tracerOptions`,void 0),i(this,`_tracers`,new Map),this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??_n();let t=e.spanProcessors??[];this._activeSpanProcessor=new wa(t),this._tracerOptions={resource:this._resource,sampler:e.sampler??new X({root:new Y}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new Ma,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return a()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new Ca({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(){let e=this._forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=Z.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Z.timeout&&(r=Z.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Z.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Z.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[aa](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return sa(`TracerProvider`,{resource:{attributes:oa(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}},Ia=class{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:j(e.startTime),duration:j(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});if(t)return t({code:M.SUCCESS})}};m(),r();var La=class{constructor(e=0){i(this,`_ratio`,void 0),i(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:v(t)&&this._accumulate(t)<this._upperBound?J.RECORD_AND_SAMPLED:J.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}};m();var Q;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(Q||(Q={}));var $=1;function Ra(){return{sampler:za(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:O(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:O(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:O(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:O(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:O(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:O(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:O(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:O(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function za(){let e=Dt(`OTEL_TRACES_SAMPLER`)??Q.ParentBasedAlwaysOn;switch(e){case Q.AlwaysOn:return new Y;case Q.AlwaysOff:return new Ta;case Q.ParentBasedAlwaysOn:return new X({root:new Y});case Q.ParentBasedAlwaysOff:return new X({root:new Ta});case Q.TraceIdRatio:return new La(Ba());case Q.ParentBasedTraceIdRatio:return new X({root:new La(Ba())});default:return h.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${Q.ParentBasedAlwaysOn}".`),new X({root:new Y})}}function Ba(){let e=O(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(h.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${$}.`),$):e<0||e>1?(h.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${$}.`),$):e}function Va(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??O(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??O(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??O(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??O(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}var Ha=class extends Fa{constructor(e={}){let t=tn({},Ra(),Va(e));delete t.generalLimits,super(t)}},Ua=class extends ka{constructor(e,t){t||(t={});for(let[e,n]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])if(t[e]===void 0){let r=O(n);r!==void 0&&(t[e]=r)}super({exporter:e,...t})}};n(),be(),Ee(),Oe(),Me(),Fe(),Re(),Je(),Be(),Ke(),He(),Xe(),Ae(),Ne();var Wa=class{error(e,...t){Pe(Error(e)),C(`[3P telemetry] OTEL diag error: ${e}`,{level:`error`})}warn(e,...t){Pe(Error(e)),C(`[3P telemetry] OTEL diag warn: ${e}`,{level:`warn`})}info(e,...t){}debug(e,...t){}verbose(e,...t){}};m(),S(),Ae(),$e(),Qe();var Ga=6e4,Ka=5e3,qa=5e3,Ja=class extends Error{};function Ya(e,t){return new Promise((n,r)=>{setTimeout((e,t)=>e(new Ja(t)),e,r,t).unref()})}function Xa(){process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE||(process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=`delta`)}function Za(e){return(e||``).trim().split(`,`).filter(Boolean).map(e=>e.trim()).filter(e=>e!==`none`)}async function Qa(){let t=Za(process.env.OTEL_METRICS_EXPORTER),n=parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL||Ga.toString(),10),r=[];for(let n of t)if(n===`console`){let e=new oi,t=e.export.bind(e);e.export=(e,n)=>(e.resource?.attributes&&(C(`
11
11
  === Resource Attributes ===`),C(De(e.resource.attributes)),C(`===========================
12
- `)),t(e,n)),r.push(e)}else if(n===`otlp`){let e=process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),t=ao();switch(e){case`http/json`:{let{OTLPMetricExporter:e}=await import(`./esm-BadZVa27.js`);r.push(new e(t));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${e}`)}}else if(n===`prometheus`){let{PrometheusExporter:t}=await import(`./src-BacxF9BD.js`).then(t=>e(t.default,1));r.push(new t)}else throw Error(`Unknown exporter type set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${n}`);return r.map(e=>`export`in e?new ai({exporter:e,exportIntervalMillis:n}):e)}async function $a(){let e=Za(process.env.OTEL_LOGS_EXPORTER),t=process.env.OTEL_EXPORTER_OTLP_LOGS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),n=process.env.OTEL_EXPORTER_OTLP_ENDPOINT;C(`[3P telemetry] getOtlpLogExporters: types=${De(e)}, protocol=${t}, endpoint=${n}`);let r=[];for(let n of e)if(n===`console`)r.push(new Kn);else if(n===`otlp`){let e=ao();switch(t){case`http/json`:{let{OTLPLogExporter:t}=await import(`./esm-BCmY8V0C.js`);r.push(new t(e));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_LOGS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${t}`)}}else throw Error(`Unknown exporter type set in OTEL_LOGS_EXPORTER env var: ${n}`);return r}async function eo(){let e=Za(process.env.OTEL_TRACES_EXPORTER),t=[];for(let n of e)if(n===`console`)t.push(new Ia);else if(n===`otlp`){let e=process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),n=ao();switch(e){case`http/json`:{let{OTLPTraceExporter:e}=await import(`./esm-BUJtY-Rb.js`);t.push(new e(n));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_TRACES_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${e}`)}}else throw Error(`Unknown exporter type set in OTEL_TRACES_EXPORTER env var: ${n}`);return t}function to(){return t(process.env.CLAUDE_CODE_ENABLE_TELEMETRY)}async function no(e){let t=process.env.BETA_TRACING_ENDPOINT;if(!t)return;let[{OTLPTraceExporter:n},{OTLPLogExporter:r}]=await Promise.all([import(`./esm-BUJtY-Rb.js`),import(`./esm-BCmY8V0C.js`)]),i={url:`${t}/v1/traces`},a={url:`${t}/v1/logs`},o=new Ha({resource:e,spanProcessors:[new Ua(new n(i),{scheduledDelayMillis:qa})]});f.setGlobalTracerProvider(o),Te(o);let s=new Gn({resource:e,processors:[new Xn(new r(a),{scheduledDelayMillis:Ka})]});ht.setGlobalLoggerProvider(s),Se(s),xe(ht.getLogger(`com.anthropic.claude_code.events`,`0.0.25`)),process.on(`beforeExit`,async()=>{await s?.forceFlush(),await o?.forceFlush()}),process.on(`exit`,()=>{s?.forceFlush(),o?.forceFlush()})}async function ro(){if(ze(`telemetry_init_start`),Xa(),je())for(let e of[`OTEL_METRICS_EXPORTER`,`OTEL_LOGS_EXPORTER`,`OTEL_TRACES_EXPORTER`]){let t=process.env[e];t?.includes(`console`)&&(process.env[e]=t.split(`,`).map(e=>e.trim()).filter(e=>e!==`console`).join(`,`))}h.setLogger(new Wa,o.ERROR),Ze();let e=[],t=to();C(`[3P telemetry] isTelemetryEnabled=${t} (CLAUDE_CODE_ENABLE_TELEMETRY=${process.env.CLAUDE_CODE_ENABLE_TELEMETRY})`),t&&e.push(...await Qa());let n=Ie(),r={[y]:`workmate`,[me]:`0.0.25`};if(n===`wsl`){let e=Le();e&&(r[`wsl.version`]=e)}let i=I(r),a=I(jn.detect().attributes||{}),s=An.detect(),c=I(s.attributes?.[`host.arch`]?{[te]:s.attributes[te]}:{}),l=I(xn.detect().attributes||{}),u=i.merge(a).merge(c).merge(l);if(Ye()){no(u).catch(e=>C(`Beta tracing init failed: ${e}`,{level:`error`}));let t=new ra({resource:u,views:[],readers:e});return we(t),ke(async()=>{let e=parseInt(process.env.CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS||`2000`,10);try{tt();let n=ye(),r=Ce(),i=[t.shutdown()];n&&i.push(n.forceFlush().then(()=>n.shutdown())),r&&i.push(r.forceFlush().then(()=>r.shutdown())),await Promise.race([Promise.all(i),Ya(e,`OpenTelemetry shutdown timeout`)])}catch{}}),t.getMeter(`com.anthropic.claude_code`,`0.0.25`)}let d=new ra({resource:u,views:[],readers:e});if(we(d),t){let e=await $a();if(C(`[3P telemetry] Created ${e.length} log exporter(s)`),e.length>0){let t=new Gn({resource:u,processors:e.map(e=>new Xn(e,{scheduledDelayMillis:parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||Ka.toString(),10)}))});ht.setGlobalLoggerProvider(t),Se(t),xe(ht.getLogger(`com.anthropic.claude_code.events`,`0.0.25`)),C(`[3P telemetry] Event logger set successfully`),process.on(`beforeExit`,async()=>{await t?.forceFlush(),await Ce()?.forceFlush()}),process.on(`exit`,()=>{t?.forceFlush(),Ce()?.forceFlush()})}}if(t&&et()){let e=await eo();if(e.length>0){let t=new Ha({resource:u,spanProcessors:e.map(e=>new Ua(e,{scheduledDelayMillis:parseInt(process.env.OTEL_TRACES_EXPORT_INTERVAL||qa.toString(),10)}))});f.setGlobalTracerProvider(t),Te(t)}}return ke(async()=>{let e=parseInt(process.env.CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS||`2000`,10);try{tt();let t=[d.shutdown()],n=ye();n&&t.push(n.shutdown());let r=Ce();r&&t.push(r.shutdown()),await Promise.race([Promise.all(t),Ya(e,`OpenTelemetry shutdown timeout`)])}catch(t){throw t instanceof Error&&t.message.includes(`timeout`)&&C(`
12
+ `)),t(e,n)),r.push(e)}else if(n===`otlp`){let e=process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),t=ao();switch(e){case`http/json`:{let{OTLPMetricExporter:e}=await import(`./esm-BadZVa27.js`);r.push(new e(t));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${e}`)}}else if(n===`prometheus`){let{PrometheusExporter:t}=await import(`./src-BacxF9BD.js`).then(t=>e(t.default,1));r.push(new t)}else throw Error(`Unknown exporter type set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${n}`);return r.map(e=>`export`in e?new ai({exporter:e,exportIntervalMillis:n}):e)}async function $a(){let e=Za(process.env.OTEL_LOGS_EXPORTER),t=process.env.OTEL_EXPORTER_OTLP_LOGS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),n=process.env.OTEL_EXPORTER_OTLP_ENDPOINT;C(`[3P telemetry] getOtlpLogExporters: types=${De(e)}, protocol=${t}, endpoint=${n}`);let r=[];for(let n of e)if(n===`console`)r.push(new Kn);else if(n===`otlp`){let e=ao();switch(t){case`http/json`:{let{OTLPLogExporter:t}=await import(`./esm-BCmY8V0C.js`);r.push(new t(e));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_LOGS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${t}`)}}else throw Error(`Unknown exporter type set in OTEL_LOGS_EXPORTER env var: ${n}`);return r}async function eo(){let e=Za(process.env.OTEL_TRACES_EXPORTER),t=[];for(let n of e)if(n===`console`)t.push(new Ia);else if(n===`otlp`){let e=process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),n=ao();switch(e){case`http/json`:{let{OTLPTraceExporter:e}=await import(`./esm-BUJtY-Rb.js`);t.push(new e(n));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_TRACES_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${e}`)}}else throw Error(`Unknown exporter type set in OTEL_TRACES_EXPORTER env var: ${n}`);return t}function to(){return t(process.env.WORKMATE_ENABLE_TELEMETRY)}async function no(e){let t=process.env.BETA_TRACING_ENDPOINT;if(!t)return;let[{OTLPTraceExporter:n},{OTLPLogExporter:r}]=await Promise.all([import(`./esm-BUJtY-Rb.js`),import(`./esm-BCmY8V0C.js`)]),i={url:`${t}/v1/traces`},a={url:`${t}/v1/logs`},o=new Ha({resource:e,spanProcessors:[new Ua(new n(i),{scheduledDelayMillis:qa})]});f.setGlobalTracerProvider(o),Te(o);let s=new Gn({resource:e,processors:[new Xn(new r(a),{scheduledDelayMillis:Ka})]});ht.setGlobalLoggerProvider(s),Se(s),xe(ht.getLogger(`com.workmate.events`,`0.0.26`)),process.on(`beforeExit`,async()=>{await s?.forceFlush(),await o?.forceFlush()}),process.on(`exit`,()=>{s?.forceFlush(),o?.forceFlush()})}async function ro(){if(ze(`telemetry_init_start`),Xa(),je())for(let e of[`OTEL_METRICS_EXPORTER`,`OTEL_LOGS_EXPORTER`,`OTEL_TRACES_EXPORTER`]){let t=process.env[e];t?.includes(`console`)&&(process.env[e]=t.split(`,`).map(e=>e.trim()).filter(e=>e!==`console`).join(`,`))}h.setLogger(new Wa,o.ERROR),Ze();let e=[],t=to();C(`[3P telemetry] isTelemetryEnabled=${t} (WORKMATE_ENABLE_TELEMETRY=${process.env.WORKMATE_ENABLE_TELEMETRY})`),t&&e.push(...await Qa());let n=Ie(),r={[y]:`workmate`,[me]:`0.0.26`};if(n===`wsl`){let e=Le();e&&(r[`wsl.version`]=e)}let i=I(r),a=I(jn.detect().attributes||{}),s=An.detect(),c=I(s.attributes?.[`host.arch`]?{[te]:s.attributes[te]}:{}),l=I(xn.detect().attributes||{}),u=i.merge(a).merge(c).merge(l);if(Ye()){no(u).catch(e=>C(`Beta tracing init failed: ${e}`,{level:`error`}));let t=new ra({resource:u,views:[],readers:e});return we(t),ke(async()=>{let e=parseInt(process.env.WORKMATE_OTEL_SHUTDOWN_TIMEOUT_MS||`2000`,10);try{tt();let n=ye(),r=Ce(),i=[t.shutdown()];n&&i.push(n.forceFlush().then(()=>n.shutdown())),r&&i.push(r.forceFlush().then(()=>r.shutdown())),await Promise.race([Promise.all(i),Ya(e,`OpenTelemetry shutdown timeout`)])}catch{}}),t.getMeter(`com.workmate`,`0.0.26`)}let d=new ra({resource:u,views:[],readers:e});if(we(d),t){let e=await $a();if(C(`[3P telemetry] Created ${e.length} log exporter(s)`),e.length>0){let t=new Gn({resource:u,processors:e.map(e=>new Xn(e,{scheduledDelayMillis:parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||Ka.toString(),10)}))});ht.setGlobalLoggerProvider(t),Se(t),xe(ht.getLogger(`com.workmate.events`,`0.0.26`)),C(`[3P telemetry] Event logger set successfully`),process.on(`beforeExit`,async()=>{await t?.forceFlush(),await Ce()?.forceFlush()}),process.on(`exit`,()=>{t?.forceFlush(),Ce()?.forceFlush()})}}if(t&&et()){let e=await eo();if(e.length>0){let t=new Ha({resource:u,spanProcessors:e.map(e=>new Ua(e,{scheduledDelayMillis:parseInt(process.env.OTEL_TRACES_EXPORT_INTERVAL||qa.toString(),10)}))});f.setGlobalTracerProvider(t),Te(t)}}return ke(async()=>{let e=parseInt(process.env.WORKMATE_OTEL_SHUTDOWN_TIMEOUT_MS||`2000`,10);try{tt();let t=[d.shutdown()],n=ye();n&&t.push(n.shutdown());let r=Ce();r&&t.push(r.shutdown()),await Promise.race([Promise.all(t),Ya(e,`OpenTelemetry shutdown timeout`)])}catch(t){throw t instanceof Error&&t.message.includes(`timeout`)&&C(`
13
13
  OpenTelemetry telemetry flush timed out after ${e}ms
14
14
 
15
15
  To resolve this issue, you can:
16
- 1. Increase the timeout by setting CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS env var (e.g., 5000 for 5 seconds)
16
+ 1. Increase the timeout by setting WORKMATE_OTEL_SHUTDOWN_TIMEOUT_MS env var (e.g., 5000 for 5 seconds)
17
17
  2. Check if your OpenTelemetry backend is experiencing scalability issues
18
- 3. Disable OpenTelemetry by unsetting CLAUDE_CODE_ENABLE_TELEMETRY env var
18
+ 3. Disable OpenTelemetry by unsetting WORKMATE_ENABLE_TELEMETRY env var
19
19
 
20
20
  Current timeout: ${e}ms
21
- `,{level:`error`}),t}}),d.getMeter(`com.anthropic.claude_code`,`0.0.25`)}function io(){let e={},t=process.env.OTEL_EXPORTER_OTLP_HEADERS;if(t)for(let n of t.split(`,`)){let[t,...r]=n.split(`=`);t&&r.length>0&&(e[t.trim()]=r.join(`=`).trim())}return e}function ao(){let e=Ve(),t=Ue(),n={},r=io();Object.keys(r).length>0&&(n.headers=async()=>r);let i=process.env.OTEL_EXPORTER_OTLP_ENDPOINT;if(!e||i&&Ge(i)){let e=We();return(t||e)&&(n.httpAgentOptions={...t,...e&&{ca:e}}),n}let a=We();return n.httpAgentOptions=n=>t||a?new qe(e,{...t&&{cert:t.cert,key:t.key,passphrase:t.passphrase},...a&&{ca:a}}):new qe(e),n}export{ro as initializeTelemetry};
21
+ `,{level:`error`}),t}}),d.getMeter(`com.workmate`,`0.0.26`)}function io(){let e={},t=process.env.OTEL_EXPORTER_OTLP_HEADERS;if(t)for(let n of t.split(`,`)){let[t,...r]=n.split(`=`);t&&r.length>0&&(e[t.trim()]=r.join(`=`).trim())}return e}function ao(){let e=Ve(),t=Ue(),n={},r=io();Object.keys(r).length>0&&(n.headers=async()=>r);let i=process.env.OTEL_EXPORTER_OTLP_ENDPOINT;if(!e||i&&Ge(i)){let e=We();return(t||e)&&(n.httpAgentOptions={...t,...e&&{ca:e}}),n}let a=We();return n.httpAgentOptions=n=>t||a?new qe(e,{...t&&{cert:t.cert,key:t.key,passphrase:t.passphrase},...a&&{ca:a}}):new qe(e),n}export{ro as initializeTelemetry};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";async function t(e,t,n){let r=n?n.trim().split(/\s+/):[],i=r[0]||`list`,a=[],o=console.log,s=console.error;console.log=(...e)=>a.push(e.map(String).join(` `)),console.error=(...e)=>a.push(e.map(String).join(` `));try{let{templatesMain:e}=await import(`./templateJobs-BW6TaqEC.js`);await e([i,...r.slice(1)])}finally{console.log=o,console.error=s}return e(a.join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";async function t(e,t,n){let r=n?n.trim().split(/\s+/):[],i=r[0]||`list`,a=[],o=console.log,s=console.error;console.log=(...e)=>a.push(e.map(String).join(` `)),console.error=(...e)=>a.push(e.map(String).join(` `));try{let{templatesMain:e}=await import(`./templateJobs-BKVEWCsb.js`);await e([i,...r.slice(1)])}finally{console.log=o,console.error=s}return e(a.join(`
2
2
  `)||`Done.`,{display:`system`}),null}e((()=>{}))();export{t as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{C as t,I as n,N as r,x as i}from"./debug-kBjDaVkQ.js";import{_ as a,a as o,f as s,g as c,h as l,i as u,m as d,s as f}from"./sleep-BbWr_FL1.js";import{r as p,t as m}from"./promptEditor-CpUFgGzc.js";import{dirname as h}from"path";import{mkdir as g,writeFile as _}from"fs/promises";function v(e){let t=new Set(s.map(e=>l(e.key)));return e.map(e=>{let n={};for(let[r,i]of Object.entries(e.bindings))t.has(l(r))||(n[r]=i);return{context:e.context,bindings:n}}).filter(e=>Object.keys(e.bindings).length>0)}function y(){return`${t({$schema:`https://www.schemastore.org/workmate-keybindings.json`,$docs:`https://code.workmate.com/docs/en/keybindings`,bindings:v(c)},null,2)}\n`}var b=e((()=>{i(),a(),d()}));async function x(){if(!f())return{type:`text`,value:`Keybinding customization is not enabled. This feature is currently in preview.`};let e=u(),t=!1;await g(h(e),{recursive:!0});try{await _(e,y(),{encoding:`utf-8`,flag:`wx`})}catch(e){if(r(e)===`EEXIST`)t=!0;else throw e}let n=await m(e);return n.error?{type:`text`,value:`${t?`Opened`:`Created`} ${e}. Could not open in editor: ${n.error}`}:{type:`text`,value:t?`Opened ${e} in your editor.`:`Created ${e} with template. Opened in your editor.`}}e((()=>{o(),b(),n(),p()}))();export{x as call};
@@ -1,3 +1,3 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,ai as i,hn as a,t as o,y as s}from"./src-DL3w8VPk.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{Gc as l,Hc as u,Jc as d,Kc as f,Uc as p,Wc as m,Xc as h,Yc as g,Zc as _,qc as v}from"./loadAgentsDir-DGozQu_6.js";import{n as y,t as b}from"./TextInput-Cev5Awdd.js";function x(e){return e.mode===`list`?e.stores.length===0?(0,S.jsx)(n,{children:(0,S.jsx)(r,{dimColor:!0,children:`No memory stores found. Use /local-memory create <store> to create one.`})}):(0,S.jsxs)(n,{flexDirection:`column`,children:[(0,S.jsx)(n,{marginBottom:1,children:(0,S.jsxs)(r,{bold:!0,children:[`Local Memory Stores (`,e.stores.length,`)`]})}),e.stores.map(e=>(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{children:` `}),(0,S.jsx)(r,{color:`success`,children:`◆`}),(0,S.jsxs)(r,{children:[` `,e]})]},e))]}):e.mode===`created`?(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{color:`success`,children:`✓`}),(0,S.jsx)(r,{children:` Store created: `}),(0,S.jsx)(r,{bold:!0,children:e.store})]}):e.mode===`stored`?(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{color:`success`,children:`✓`}),(0,S.jsx)(r,{children:` Stored entry `}),(0,S.jsx)(r,{bold:!0,children:e.key}),(0,S.jsx)(r,{children:` in `}),(0,S.jsx)(r,{bold:!0,children:e.store})]}):e.mode===`fetched`?(0,S.jsxs)(n,{flexDirection:`column`,children:[(0,S.jsxs)(n,{marginBottom:1,children:[(0,S.jsx)(r,{bold:!0,children:e.store}),(0,S.jsx)(r,{dimColor:!0,children:`/`}),(0,S.jsx)(r,{bold:!0,children:e.key})]}),(0,S.jsx)(n,{children:(0,S.jsx)(r,{children:e.value})})]}):e.mode===`not-found`?(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{color:`error`,children:`Not found: `}),(0,S.jsx)(r,{bold:!0,children:e.store}),e.key?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(r,{dimColor:!0,children:`/`}),(0,S.jsx)(r,{bold:!0,children:e.key})]}):null]}):e.mode===`entries`?e.keys.length===0?(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{dimColor:!0,children:`No entries in `}),(0,S.jsx)(r,{bold:!0,children:e.store}),(0,S.jsxs)(r,{dimColor:!0,children:[`. Use /local-memory store `,e.store,` <key> <value> to add one.`]})]}):(0,S.jsxs)(n,{flexDirection:`column`,children:[(0,S.jsxs)(n,{marginBottom:1,children:[(0,S.jsx)(r,{bold:!0,children:e.store}),(0,S.jsxs)(r,{dimColor:!0,children:[` (`,e.keys.length,` entries)`]})]}),e.keys.map(e=>(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{children:` `}),(0,S.jsx)(r,{color:`success`,children:`·`}),(0,S.jsxs)(r,{children:[` `,e]})]},e))]}):e.mode===`archived`?(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{color:`success`,children:`✓`}),(0,S.jsx)(r,{children:` Archived store: `}),(0,S.jsx)(r,{bold:!0,children:e.store}),(0,S.jsxs)(r,{dimColor:!0,children:[` (renamed to `,e.store,`.archived)`]})]}):(0,S.jsx)(n,{children:(0,S.jsxs)(r,{color:`error`,children:[`Error: `,e.message]})})}var S,C=e((()=>{o(),S=c()}));function w(e){let t=e.trim();if(t===``||t===`list`)return{action:`list`};let n=t.split(/\s+/),r=n[0];if(r===`list`)return{action:`list`};if(r===`create`){let e=n[1];return e?{action:`create`,store:e}:{action:`invalid`,reason:`create requires a store name. ${T}`}}if(r===`store`){let e=n[1],t=n[2];if(!e)return{action:`invalid`,reason:`store requires a store name. ${T}`};if(!t)return{action:`invalid`,reason:`store requires a key. ${T}`};let r=n.slice(3).join(` `);return r?{action:`store`,store:e,key:t,value:r}:{action:`invalid`,reason:`store requires a value. ${T}`}}if(r===`fetch`){let e=n[1],t=n[2];return e?t?{action:`fetch`,store:e,key:t}:{action:`invalid`,reason:`fetch requires a key. ${T}`}:{action:`invalid`,reason:`fetch requires a store name. ${T}`}}if(r===`entries`){let e=n[1];return e?{action:`entries`,store:e}:{action:`invalid`,reason:`entries requires a store name. ${T}`}}if(r===`archive`){let e=n[1];return e?{action:`archive`,store:e}:{action:`invalid`,reason:`archive requires a store name. ${T}`}}return{action:`invalid`,reason:`Unknown sub-command "${r}". ${T}`}}var T,E=e((()=>{T=`Usage: /local-memory list | create STORE | store STORE KEY VALUE | fetch STORE KEY | entries STORE | archive STORE`}));function D(e){return async(t,n,r)=>{let i=e.parseArgs(r??``);if(O(i))return t(`Invalid args: ${i.reason}`,{display:`system`}),e.errorView(i.reason);try{let r=await e.dispatch(i,t,n);return r===null?null:k.createElement(e.View,r)}catch(n){let r=n instanceof Error?n.message:String(n);return e.onDispatchError?.(n),t(`${e.commandName} failed: ${r}`,{display:`system`}),e.errorView(r)}}}function O(e){return typeof e==`object`&&!!e&&`action`in e&&e.action===`invalid`}var k,A=e((()=>{k=t(i(),1)}));function j(e){return e.length===0?`No memory stores found.`:[`Local Memory Stores`,...e.map(e=>`- ${e}`)].join(`
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,ai as i,hn as a,t as o,y as s}from"./src-WZ94ZKI3.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{Gc as l,Hc as u,Jc as d,Kc as f,Uc as p,Wc as m,Xc as h,Yc as g,Zc as _,qc as v}from"./loadAgentsDir-DR5PVAc3.js";import{n as y,t as b}from"./TextInput-BboKIug2.js";function x(e){return e.mode===`list`?e.stores.length===0?(0,S.jsx)(n,{children:(0,S.jsx)(r,{dimColor:!0,children:`No memory stores found. Use /local-memory create <store> to create one.`})}):(0,S.jsxs)(n,{flexDirection:`column`,children:[(0,S.jsx)(n,{marginBottom:1,children:(0,S.jsxs)(r,{bold:!0,children:[`Local Memory Stores (`,e.stores.length,`)`]})}),e.stores.map(e=>(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{children:` `}),(0,S.jsx)(r,{color:`success`,children:`◆`}),(0,S.jsxs)(r,{children:[` `,e]})]},e))]}):e.mode===`created`?(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{color:`success`,children:`✓`}),(0,S.jsx)(r,{children:` Store created: `}),(0,S.jsx)(r,{bold:!0,children:e.store})]}):e.mode===`stored`?(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{color:`success`,children:`✓`}),(0,S.jsx)(r,{children:` Stored entry `}),(0,S.jsx)(r,{bold:!0,children:e.key}),(0,S.jsx)(r,{children:` in `}),(0,S.jsx)(r,{bold:!0,children:e.store})]}):e.mode===`fetched`?(0,S.jsxs)(n,{flexDirection:`column`,children:[(0,S.jsxs)(n,{marginBottom:1,children:[(0,S.jsx)(r,{bold:!0,children:e.store}),(0,S.jsx)(r,{dimColor:!0,children:`/`}),(0,S.jsx)(r,{bold:!0,children:e.key})]}),(0,S.jsx)(n,{children:(0,S.jsx)(r,{children:e.value})})]}):e.mode===`not-found`?(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{color:`error`,children:`Not found: `}),(0,S.jsx)(r,{bold:!0,children:e.store}),e.key?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(r,{dimColor:!0,children:`/`}),(0,S.jsx)(r,{bold:!0,children:e.key})]}):null]}):e.mode===`entries`?e.keys.length===0?(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{dimColor:!0,children:`No entries in `}),(0,S.jsx)(r,{bold:!0,children:e.store}),(0,S.jsxs)(r,{dimColor:!0,children:[`. Use /local-memory store `,e.store,` <key> <value> to add one.`]})]}):(0,S.jsxs)(n,{flexDirection:`column`,children:[(0,S.jsxs)(n,{marginBottom:1,children:[(0,S.jsx)(r,{bold:!0,children:e.store}),(0,S.jsxs)(r,{dimColor:!0,children:[` (`,e.keys.length,` entries)`]})]}),e.keys.map(e=>(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{children:` `}),(0,S.jsx)(r,{color:`success`,children:`·`}),(0,S.jsxs)(r,{children:[` `,e]})]},e))]}):e.mode===`archived`?(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{color:`success`,children:`✓`}),(0,S.jsx)(r,{children:` Archived store: `}),(0,S.jsx)(r,{bold:!0,children:e.store}),(0,S.jsxs)(r,{dimColor:!0,children:[` (renamed to `,e.store,`.archived)`]})]}):(0,S.jsx)(n,{children:(0,S.jsxs)(r,{color:`error`,children:[`Error: `,e.message]})})}var S,C=e((()=>{o(),S=c()}));function w(e){let t=e.trim();if(t===``||t===`list`)return{action:`list`};let n=t.split(/\s+/),r=n[0];if(r===`list`)return{action:`list`};if(r===`create`){let e=n[1];return e?{action:`create`,store:e}:{action:`invalid`,reason:`create requires a store name. ${T}`}}if(r===`store`){let e=n[1],t=n[2];if(!e)return{action:`invalid`,reason:`store requires a store name. ${T}`};if(!t)return{action:`invalid`,reason:`store requires a key. ${T}`};let r=n.slice(3).join(` `);return r?{action:`store`,store:e,key:t,value:r}:{action:`invalid`,reason:`store requires a value. ${T}`}}if(r===`fetch`){let e=n[1],t=n[2];return e?t?{action:`fetch`,store:e,key:t}:{action:`invalid`,reason:`fetch requires a key. ${T}`}:{action:`invalid`,reason:`fetch requires a store name. ${T}`}}if(r===`entries`){let e=n[1];return e?{action:`entries`,store:e}:{action:`invalid`,reason:`entries requires a store name. ${T}`}}if(r===`archive`){let e=n[1];return e?{action:`archive`,store:e}:{action:`invalid`,reason:`archive requires a store name. ${T}`}}return{action:`invalid`,reason:`Unknown sub-command "${r}". ${T}`}}var T,E=e((()=>{T=`Usage: /local-memory list | create STORE | store STORE KEY VALUE | fetch STORE KEY | entries STORE | archive STORE`}));function D(e){return async(t,n,r)=>{let i=e.parseArgs(r??``);if(O(i))return t(`Invalid args: ${i.reason}`,{display:`system`}),e.errorView(i.reason);try{let r=await e.dispatch(i,t,n);return r===null?null:k.createElement(e.View,r)}catch(n){let r=n instanceof Error?n.message:String(n);return e.onDispatchError?.(n),t(`${e.commandName} failed: ${r}`,{display:`system`}),e.errorView(r)}}}function O(e){return typeof e==`object`&&!!e&&`action`in e&&e.action===`invalid`}var k,A=e((()=>{k=t(i(),1)}));function j(e){return e.length===0?`No memory stores found.`:[`Local Memory Stores`,...e.map(e=>`- ${e}`)].join(`
2
2
  `)}function M(e,t){return t.length===0?`No entries in "${e}".`:[`Entries in "${e}"`,...t.map(e=>`- ${e}`)].join(`
3
3
  `)}function N({onDone:e}){let[t,i]=F.useState({kind:`menu`}),[o,c]=F.useState(0),[l,h]=F.useState(``),[y,x]=F.useState(0),[S,C]=F.useState(null),w=F.useCallback(e=>{i(e),h(``),x(0),C(null)},[]),T=F.useCallback(t=>e(t,{display:`system`}),[e]),E=F.useCallback((e,t,n,r,i={})=>{try{if(e===`list`){T(j(d()));return}if(e===`about`){T(L);return}if(!t){C(`Internal: missing store`);return}if(e===`create`){p(t),T(`Store created: ${t}`);return}if(e===`entries`){let e=v(t);T(M(t,e));return}if(e===`archive`){u(t),T(`Archived store: ${t}`);return}if(e===`fetch`){if(!n){C(`Internal: missing key`);return}let e=m(t,n);if(e===null){T(`Entry not found: ${t}/${n}`);return}T(`Entry fetched: ${t}/${n}\n\n${e}`);return}if(e===`store`){if(!n||r===void 0){C(`Internal: missing key or value`);return}if(!i.confirmedOverwrite&&m(t,n)!==null){w({kind:`confirm-overwrite`,store:t,key:n,value:r});return}g(t,n,r),T(`Stored ${t}/${n} (${r.length} chars)`);return}}catch(e){C(e instanceof Error?e.message:String(e))}},[T,w]);if(a((e,n)=>{if(t.kind!==`menu`)return;if(n.upArrow){c(e=>Math.max(0,e-1));return}if(n.downArrow){c(e=>Math.min(z.length-1,e+1));return}if(n.return){let e=z[o];if(!e)return;if(e.kind===`list`||e.kind===`about`){E(e.kind,void 0,void 0,void 0);return}w({kind:`collect-store`,action:e.kind});return}let r=Number(e);Number.isInteger(r)&&r>=1&&r<=z.length&&c(r-1)},{isActive:t.kind===`menu`}),a((e,n)=>{if(t.kind!==`confirm-archive`&&t.kind!==`confirm-overwrite`)return;if(n.escape){w({kind:`menu`});return}let r=e.toLowerCase();r===`y`||n.return?t.kind===`confirm-archive`?E(`archive`,t.store,void 0,void 0):E(`store`,t.store,t.key,t.value,{confirmedOverwrite:!0}):r===`n`&&w({kind:`menu`})},{isActive:t.kind===`confirm-archive`||t.kind===`confirm-overwrite`}),a((e,n)=>{if(!(t.kind!==`collect-store`&&t.kind!==`collect-key`&&t.kind!==`collect-value`)&&n.escape){if(t.kind===`collect-value`){w({kind:`collect-key`,action:t.action,store:t.store});return}if(t.kind===`collect-key`){w({kind:`collect-store`,action:t.action});return}w({kind:`menu`})}},{isActive:t.kind===`collect-store`||t.kind===`collect-key`||t.kind===`collect-value`}),t.kind===`menu`)return(0,I.jsx)(s,{title:`Local Memory`,subtitle:`${z.length} actions`,onCancel:()=>T(`Local memory panel dismissed`),color:`background`,hideInputGuide:!0,children:(0,I.jsxs)(n,{flexDirection:`column`,children:[z.map((e,t)=>(0,I.jsxs)(n,{flexDirection:`row`,children:[(0,I.jsx)(r,{children:`${t===o?`›`:` `} ${e.label}`.padEnd(R)}),(0,I.jsx)(r,{dimColor:!0,children:e.description})]},e.kind)),(0,I.jsx)(n,{marginTop:1,children:(0,I.jsx)(r,{dimColor:!0,children:`↑/↓ or 1-7 select · Enter run · Esc close`})})]})});if(t.kind===`confirm-archive`)return(0,I.jsx)(s,{title:`Confirm Archive`,onCancel:()=>w({kind:`menu`}),color:`warning`,hideInputGuide:!0,children:(0,I.jsxs)(n,{flexDirection:`column`,children:[(0,I.jsxs)(r,{children:[`Archive store "`,t.store,`"? This renames it to *.archived.`]}),(0,I.jsx)(n,{marginTop:1,children:(0,I.jsx)(r,{dimColor:!0,children:`y/Enter = archive · n/Esc = cancel`})})]})});if(t.kind===`confirm-overwrite`)return(0,I.jsx)(s,{title:`Confirm Overwrite`,onCancel:()=>w({kind:`menu`}),color:`warning`,hideInputGuide:!0,children:(0,I.jsxs)(n,{flexDirection:`column`,children:[(0,I.jsxs)(r,{children:[`Entry "`,t.store,`/`,t.key,`" already exists. Overwrite with new value (`,t.value.length,` chars)?`]}),(0,I.jsx)(n,{marginTop:1,children:(0,I.jsx)(r,{dimColor:!0,children:`y/Enter = overwrite · n/Esc = cancel`})})]})});let D=t.kind===`collect-store`?`STORE NAME`:t.kind===`collect-key`?`KEY NAME`:`VALUE`,O=t.kind===`collect-store`?`e.g. my-notes`:t.kind===`collect-key`?`e.g. todo-2026-05-08`:`free text`;return(0,I.jsx)(s,{title:`Local Memory · ${t.kind.replace(`collect-`,``).toUpperCase()}`,onCancel:()=>w({kind:`menu`}),color:`background`,hideInputGuide:!0,children:(0,I.jsxs)(n,{flexDirection:`column`,children:[(0,I.jsx)(n,{children:(0,I.jsx)(r,{dimColor:!0,children:D})}),(0,I.jsxs)(n,{children:[(0,I.jsx)(r,{children:`> `}),(0,I.jsx)(b,{value:l,onChange:e=>{h(e),C(null)},cursorOffset:y,onChangeCursorOffset:x,onSubmit:e=>{let n=e.trim();if(t.kind===`collect-store`){if(!n){C(`Store name required`);return}if(!f(n)){C(`Invalid store name (no /, \\, :, null byte, or leading dot; max 255 chars)`);return}t.action===`create`||t.action===`entries`||t.action===`archive`?t.action===`archive`?w({kind:`confirm-archive`,store:n}):E(t.action,n,void 0,void 0):w({kind:`collect-key`,action:t.action,store:n});return}if(t.kind===`collect-key`){if(!n){C(`Key required`);return}if(!_(n)){C(`Invalid key (allowed: letters/digits/._- only; no leading dot; not a Windows reserved name)`);return}t.action===`fetch`?E(`fetch`,t.store,n,void 0):w({kind:`collect-value`,action:`store`,store:t.store,key:n});return}t.kind===`collect-value`&&E(`store`,t.store,t.key,e)},placeholder:O,columns:70,showCursor:!0})]}),S!==null&&(0,I.jsx)(n,{marginTop:0,children:(0,I.jsxs)(r,{color:`warning`,children:[`✗ `,S]})}),(0,I.jsx)(n,{marginTop:1,children:(0,I.jsx)(r,{dimColor:!0,children:`Enter = next · Esc = back`})})]})})}async function P(e,t){if(e.action===`list`)return t(j(d()),{display:`system`}),null;if(e.action===`create`){let{store:n}=e;return p(n),t(`Store created: ${n}`,{display:`system`}),null}if(e.action===`store`){let{store:n,key:r,value:i}=e;return g(n,r,i),t(`Stored entry "${r}" in store "${n}".`,{display:`system`}),null}if(e.action===`fetch`){let{store:n,key:r}=e,i=m(n,r);return i===null?(t(`Entry not found: ${n}/${r}`,{display:`system`}),null):(t(`Entry fetched: ${n}/${r}\n${i}`,{display:`system`}),null)}if(e.action===`entries`){let{store:n}=e;return t(M(n,v(n)),{display:`system`}),null}if(e.action===`archive`){let{store:n}=e;return u(n),t(`Archived store: ${n}`,{display:`system`}),null}return t(L,{display:`system`}),null}var F,I,L,R,z,B,V;e((()=>{F=t(i(),1),o(),l(),h(),y(),C(),E(),A(),I=c(),L=`Usage: /local-memory list | create STORE | store STORE KEY VALUE | fetch STORE KEY | entries STORE | archive STORE`,R=26,z=[{kind:`list`,label:`List`,description:`显示所有 store`},{kind:`create`,label:`Create`,description:`创建一个新的记忆 store`},{kind:`store`,label:`Store`,description:`写入条目:store 名 + key + value`},{kind:`fetch`,label:`Fetch`,description:`按 store 名 + key 读取条目`},{kind:`entries`,label:`Entries`,description:`列出某个 store 里的 entry key`},{kind:`archive`,label:`Archive`,description:`归档 store(重命名为 *.archived)`},{kind:`about`,label:`About`,description:`显示命令语法`}],B=D({commandName:`local-memory`,parseArgs:e=>{let t=w(e);return t.action===`invalid`?{action:`invalid`,reason:`${L}\n${t.reason}`}:t},dispatch:P,View:x,errorView:e=>F.createElement(x,{mode:`error`,message:e})}),V=async(e,t,n)=>(n??``).trim()===``?(0,I.jsx)(N,{onDone:e}):B(e,t,n)}))();export{V as callLocalMemory};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{H as t,I as n,P as r,t as i,x as a}from"./src-DL3w8VPk.js";import{t as o}from"./jsx-runtime-Bb4Xn-E0.js";import{d as s,h as c,m as l,o as u}from"./config-CWPHVTic.js";import{n as d}from"./analytics-COpjZpvd.js";import{n as f,t as p}from"./ThemePicker-CtQYHmOr.js";function m(e){let t=e.trim().toLowerCase();return t===``||t===`reset`?{sub:`full`}:v.has(t)?{sub:t}:{sub:`full`,unknownArg:t}}function h({onDone:e}){let[,n]=t();return(0,_.jsx)(a,{color:`permission`,children:(0,_.jsx)(p,{onThemeSelect:t=>{n(t),e(`Theme set to ${t}.`)},onCancel:()=>e(`Theme picker dismissed.`),skipExitHandling:!0})})}function g({theme:e,hasCompletedOnboarding:t,lastOnboardingVersion:i}){return(0,_.jsxs)(n,{flexDirection:`column`,paddingLeft:1,children:[(0,_.jsx)(r,{bold:!0,children:`Onboarding status`}),(0,_.jsxs)(r,{children:[`- Theme: `,(0,_.jsx)(r,{bold:!0,children:e})]}),(0,_.jsxs)(r,{children:[`- Onboarding completed:`,` `,(0,_.jsx)(r,{bold:!0,color:t?`success`:`warning`,children:t?`yes`:`no`})]}),(0,_.jsxs)(r,{children:[`- Last onboarding version: `,(0,_.jsx)(r,{bold:!0,children:i})]}),(0,_.jsx)(r,{dimColor:!0,children:`Run /onboarding (no args) to re-run the full flow, or /onboarding theme | trust | model | mcp for a specific step.`})]})}var _,v,y;e((()=>{i(),d(),f(),s(),_=o(),v=new Set([`full`,`theme`,`trust`,`model`,`mcp`,`status`]),y=async(e,t,n)=>{let{sub:r,unknownArg:i}=m(n);if(`${r}`,i!==void 0)return e(`Unknown /onboarding subcommand: \`${i}\`.\nValid: full | theme | trust | model | mcp | status`,{display:`system`}),null;if(r===`theme`)return(0,_.jsx)(h,{onDone:t=>e(t)});if(r===`trust`)return l(e=>({...e,hasTrustDialogAccepted:!1})),e("Workspace trust cleared for the current project. The trust dialog will appear on the next `claude` launch.",{display:`system`}),null;if(r===`model`)return e("Run `/model` to pick the AI model. Onboarding does not own the model picker; this entry exists for discoverability only.",{display:`system`}),null;if(r===`mcp`)return e("MCP server setup:\n - `/mcp` — list configured MCP servers\n - `claude mcp add <name> <command>` — add a server (in your shell)\n - `claude mcp remove <name>` — remove a server\nServers also load from `.mcp.json` in the workspace and from `~/.workmate.json` globally.",{display:`system`}),null;if(r===`status`){let e=u();return(0,_.jsx)(g,{theme:e.theme??`(unset)`,hasCompletedOnboarding:e.hasCompletedOnboarding===!0,lastOnboardingVersion:e.lastOnboardingVersion??`(unset)`})}return c(e=>({...e,hasCompletedOnboarding:!1})),e(`Onboarding flag cleared. The full first-run setup (theme, OAuth/API key, security notes, terminal-setup) will run on the next \`claude\` launch.
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{H as t,I as n,P as r,t as i,x as a}from"./src-WZ94ZKI3.js";import{t as o}from"./jsx-runtime-Bb4Xn-E0.js";import{d as s,h as c,m as l,o as u}from"./config-D3K87Mm1.js";import{n as d}from"./analytics-COpjZpvd.js";import{n as f,t as p}from"./ThemePicker-DTpXbEY0.js";function m(e){let t=e.trim().toLowerCase();return t===``||t===`reset`?{sub:`full`}:v.has(t)?{sub:t}:{sub:`full`,unknownArg:t}}function h({onDone:e}){let[,n]=t();return(0,_.jsx)(a,{color:`permission`,children:(0,_.jsx)(p,{onThemeSelect:t=>{n(t),e(`Theme set to ${t}.`)},onCancel:()=>e(`Theme picker dismissed.`),skipExitHandling:!0})})}function g({theme:e,hasCompletedOnboarding:t,lastOnboardingVersion:i}){return(0,_.jsxs)(n,{flexDirection:`column`,paddingLeft:1,children:[(0,_.jsx)(r,{bold:!0,children:`Onboarding status`}),(0,_.jsxs)(r,{children:[`- Theme: `,(0,_.jsx)(r,{bold:!0,children:e})]}),(0,_.jsxs)(r,{children:[`- Onboarding completed:`,` `,(0,_.jsx)(r,{bold:!0,color:t?`success`:`warning`,children:t?`yes`:`no`})]}),(0,_.jsxs)(r,{children:[`- Last onboarding version: `,(0,_.jsx)(r,{bold:!0,children:i})]}),(0,_.jsx)(r,{dimColor:!0,children:`Run /onboarding (no args) to re-run the full flow, or /onboarding theme | trust | model | mcp for a specific step.`})]})}var _,v,y;e((()=>{i(),d(),f(),s(),_=o(),v=new Set([`full`,`theme`,`trust`,`model`,`mcp`,`status`]),y=async(e,t,n)=>{let{sub:r,unknownArg:i}=m(n);if(`${r}`,i!==void 0)return e(`Unknown /onboarding subcommand: \`${i}\`.\nValid: full | theme | trust | model | mcp | status`,{display:`system`}),null;if(r===`theme`)return(0,_.jsx)(h,{onDone:t=>e(t)});if(r===`trust`)return l(e=>({...e,hasTrustDialogAccepted:!1})),e("Workspace trust cleared for the current project. The trust dialog will appear on the next `claude` launch.",{display:`system`}),null;if(r===`model`)return e("Run `/model` to pick the AI model. Onboarding does not own the model picker; this entry exists for discoverability only.",{display:`system`}),null;if(r===`mcp`)return e("MCP server setup:\n - `/mcp` — list configured MCP servers\n - `claude mcp add <name> <command>` — add a server (in your shell)\n - `claude mcp remove <name>` — remove a server\nServers also load from `.mcp.json` in the workspace and from `~/.workmate.json` globally.",{display:`system`}),null;if(r===`status`){let e=u();return(0,_.jsx)(g,{theme:e.theme??`(unset)`,hasCompletedOnboarding:e.hasCompletedOnboarding===!0,lastOnboardingVersion:e.lastOnboardingVersion??`(unset)`})}return c(e=>({...e,hasCompletedOnboarding:!1})),e(`Onboarding flag cleared. The full first-run setup (theme, OAuth/API key, security notes, terminal-setup) will run on the next \`claude\` launch.
2
2
 
3
3
  For individual steps in this session, use:
4
4
  /onboarding theme — re-pick theme inline