@coboot/headless 0.2.2-rc.1 → 0.2.2-rc.11

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 (342) hide show
  1. package/README.md +188 -31
  2. package/browser-runtime/playwright-core/LICENSE +202 -0
  3. package/browser-runtime/playwright-core/NOTICE +5 -0
  4. package/browser-runtime/playwright-core/README.md +3 -0
  5. package/browser-runtime/playwright-core/ThirdPartyNotices.txt +4076 -0
  6. package/browser-runtime/playwright-core/bin/install_media_pack.ps1 +5 -0
  7. package/browser-runtime/playwright-core/bin/install_webkit_wsl.ps1 +33 -0
  8. package/browser-runtime/playwright-core/bin/reinstall_chrome_beta_linux.sh +42 -0
  9. package/browser-runtime/playwright-core/bin/reinstall_chrome_beta_mac.sh +13 -0
  10. package/browser-runtime/playwright-core/bin/reinstall_chrome_beta_win.ps1 +24 -0
  11. package/browser-runtime/playwright-core/bin/reinstall_chrome_stable_linux.sh +42 -0
  12. package/browser-runtime/playwright-core/bin/reinstall_chrome_stable_mac.sh +12 -0
  13. package/browser-runtime/playwright-core/bin/reinstall_chrome_stable_win.ps1 +24 -0
  14. package/browser-runtime/playwright-core/bin/reinstall_msedge_beta_linux.sh +48 -0
  15. package/browser-runtime/playwright-core/bin/reinstall_msedge_beta_mac.sh +11 -0
  16. package/browser-runtime/playwright-core/bin/reinstall_msedge_beta_win.ps1 +23 -0
  17. package/browser-runtime/playwright-core/bin/reinstall_msedge_dev_linux.sh +48 -0
  18. package/browser-runtime/playwright-core/bin/reinstall_msedge_dev_mac.sh +11 -0
  19. package/browser-runtime/playwright-core/bin/reinstall_msedge_dev_win.ps1 +23 -0
  20. package/browser-runtime/playwright-core/bin/reinstall_msedge_stable_linux.sh +48 -0
  21. package/browser-runtime/playwright-core/bin/reinstall_msedge_stable_mac.sh +11 -0
  22. package/browser-runtime/playwright-core/bin/reinstall_msedge_stable_win.ps1 +24 -0
  23. package/browser-runtime/playwright-core/browsers.json +79 -0
  24. package/browser-runtime/playwright-core/cli.js +18 -0
  25. package/browser-runtime/playwright-core/index.js +32 -0
  26. package/browser-runtime/playwright-core/index.mjs +28 -0
  27. package/browser-runtime/playwright-core/lib/androidServerImpl.js +65 -0
  28. package/browser-runtime/playwright-core/lib/browserServerImpl.js +120 -0
  29. package/browser-runtime/playwright-core/lib/cli/driver.js +97 -0
  30. package/browser-runtime/playwright-core/lib/cli/program.js +589 -0
  31. package/browser-runtime/playwright-core/lib/cli/programWithTestStub.js +74 -0
  32. package/browser-runtime/playwright-core/lib/client/android.js +361 -0
  33. package/browser-runtime/playwright-core/lib/client/api.js +137 -0
  34. package/browser-runtime/playwright-core/lib/client/artifact.js +79 -0
  35. package/browser-runtime/playwright-core/lib/client/browser.js +161 -0
  36. package/browser-runtime/playwright-core/lib/client/browserContext.js +582 -0
  37. package/browser-runtime/playwright-core/lib/client/browserType.js +185 -0
  38. package/browser-runtime/playwright-core/lib/client/cdpSession.js +51 -0
  39. package/browser-runtime/playwright-core/lib/client/channelOwner.js +194 -0
  40. package/browser-runtime/playwright-core/lib/client/clientHelper.js +64 -0
  41. package/browser-runtime/playwright-core/lib/client/clientInstrumentation.js +55 -0
  42. package/browser-runtime/playwright-core/lib/client/clientStackTrace.js +69 -0
  43. package/browser-runtime/playwright-core/lib/client/clock.js +68 -0
  44. package/browser-runtime/playwright-core/lib/client/connection.js +318 -0
  45. package/browser-runtime/playwright-core/lib/client/consoleMessage.js +58 -0
  46. package/browser-runtime/playwright-core/lib/client/coverage.js +44 -0
  47. package/browser-runtime/playwright-core/lib/client/dialog.js +56 -0
  48. package/browser-runtime/playwright-core/lib/client/download.js +62 -0
  49. package/browser-runtime/playwright-core/lib/client/electron.js +138 -0
  50. package/browser-runtime/playwright-core/lib/client/elementHandle.js +284 -0
  51. package/browser-runtime/playwright-core/lib/client/errors.js +77 -0
  52. package/browser-runtime/playwright-core/lib/client/eventEmitter.js +314 -0
  53. package/browser-runtime/playwright-core/lib/client/events.js +103 -0
  54. package/browser-runtime/playwright-core/lib/client/fetch.js +368 -0
  55. package/browser-runtime/playwright-core/lib/client/fileChooser.js +46 -0
  56. package/browser-runtime/playwright-core/lib/client/fileUtils.js +34 -0
  57. package/browser-runtime/playwright-core/lib/client/frame.js +409 -0
  58. package/browser-runtime/playwright-core/lib/client/harRouter.js +87 -0
  59. package/browser-runtime/playwright-core/lib/client/input.js +84 -0
  60. package/browser-runtime/playwright-core/lib/client/jsHandle.js +109 -0
  61. package/browser-runtime/playwright-core/lib/client/jsonPipe.js +39 -0
  62. package/browser-runtime/playwright-core/lib/client/localUtils.js +60 -0
  63. package/browser-runtime/playwright-core/lib/client/locator.js +369 -0
  64. package/browser-runtime/playwright-core/lib/client/network.js +747 -0
  65. package/browser-runtime/playwright-core/lib/client/page.js +745 -0
  66. package/browser-runtime/playwright-core/lib/client/pageAgent.js +64 -0
  67. package/browser-runtime/playwright-core/lib/client/platform.js +77 -0
  68. package/browser-runtime/playwright-core/lib/client/playwright.js +71 -0
  69. package/browser-runtime/playwright-core/lib/client/selectors.js +55 -0
  70. package/browser-runtime/playwright-core/lib/client/stream.js +39 -0
  71. package/browser-runtime/playwright-core/lib/client/timeoutSettings.js +79 -0
  72. package/browser-runtime/playwright-core/lib/client/tracing.js +119 -0
  73. package/browser-runtime/playwright-core/lib/client/types.js +28 -0
  74. package/browser-runtime/playwright-core/lib/client/video.js +59 -0
  75. package/browser-runtime/playwright-core/lib/client/waiter.js +142 -0
  76. package/browser-runtime/playwright-core/lib/client/webError.js +39 -0
  77. package/browser-runtime/playwright-core/lib/client/webSocket.js +93 -0
  78. package/browser-runtime/playwright-core/lib/client/worker.js +85 -0
  79. package/browser-runtime/playwright-core/lib/client/writableStream.js +39 -0
  80. package/browser-runtime/playwright-core/lib/generated/bindingsControllerSource.js +28 -0
  81. package/browser-runtime/playwright-core/lib/generated/clockSource.js +28 -0
  82. package/browser-runtime/playwright-core/lib/generated/injectedScriptSource.js +28 -0
  83. package/browser-runtime/playwright-core/lib/generated/pollingRecorderSource.js +28 -0
  84. package/browser-runtime/playwright-core/lib/generated/storageScriptSource.js +28 -0
  85. package/browser-runtime/playwright-core/lib/generated/utilityScriptSource.js +28 -0
  86. package/browser-runtime/playwright-core/lib/generated/webSocketMockSource.js +336 -0
  87. package/browser-runtime/playwright-core/lib/inProcessFactory.js +60 -0
  88. package/browser-runtime/playwright-core/lib/inprocess.js +3 -0
  89. package/browser-runtime/playwright-core/lib/mcpBundle.js +84 -0
  90. package/browser-runtime/playwright-core/lib/mcpBundleImpl/index.js +147 -0
  91. package/browser-runtime/playwright-core/lib/outofprocess.js +76 -0
  92. package/browser-runtime/playwright-core/lib/protocol/serializers.js +197 -0
  93. package/browser-runtime/playwright-core/lib/protocol/validator.js +2969 -0
  94. package/browser-runtime/playwright-core/lib/protocol/validatorPrimitives.js +193 -0
  95. package/browser-runtime/playwright-core/lib/remote/playwrightConnection.js +129 -0
  96. package/browser-runtime/playwright-core/lib/remote/playwrightServer.js +334 -0
  97. package/browser-runtime/playwright-core/lib/server/agent/actionRunner.js +335 -0
  98. package/browser-runtime/playwright-core/lib/server/agent/actions.js +128 -0
  99. package/browser-runtime/playwright-core/lib/server/agent/codegen.js +111 -0
  100. package/browser-runtime/playwright-core/lib/server/agent/context.js +150 -0
  101. package/browser-runtime/playwright-core/lib/server/agent/expectTools.js +156 -0
  102. package/browser-runtime/playwright-core/lib/server/agent/pageAgent.js +204 -0
  103. package/browser-runtime/playwright-core/lib/server/agent/performTools.js +262 -0
  104. package/browser-runtime/playwright-core/lib/server/agent/tool.js +109 -0
  105. package/browser-runtime/playwright-core/lib/server/android/android.js +465 -0
  106. package/browser-runtime/playwright-core/lib/server/android/backendAdb.js +177 -0
  107. package/browser-runtime/playwright-core/lib/server/artifact.js +127 -0
  108. package/browser-runtime/playwright-core/lib/server/bidi/bidiBrowser.js +549 -0
  109. package/browser-runtime/playwright-core/lib/server/bidi/bidiChromium.js +149 -0
  110. package/browser-runtime/playwright-core/lib/server/bidi/bidiConnection.js +213 -0
  111. package/browser-runtime/playwright-core/lib/server/bidi/bidiDeserializer.js +116 -0
  112. package/browser-runtime/playwright-core/lib/server/bidi/bidiExecutionContext.js +267 -0
  113. package/browser-runtime/playwright-core/lib/server/bidi/bidiFirefox.js +128 -0
  114. package/browser-runtime/playwright-core/lib/server/bidi/bidiInput.js +146 -0
  115. package/browser-runtime/playwright-core/lib/server/bidi/bidiNetworkManager.js +383 -0
  116. package/browser-runtime/playwright-core/lib/server/bidi/bidiOverCdp.js +102 -0
  117. package/browser-runtime/playwright-core/lib/server/bidi/bidiPage.js +583 -0
  118. package/browser-runtime/playwright-core/lib/server/bidi/bidiPdf.js +106 -0
  119. package/browser-runtime/playwright-core/lib/server/bidi/third_party/bidiCommands.d.js +22 -0
  120. package/browser-runtime/playwright-core/lib/server/bidi/third_party/bidiKeyboard.js +256 -0
  121. package/browser-runtime/playwright-core/lib/server/bidi/third_party/bidiProtocol.js +24 -0
  122. package/browser-runtime/playwright-core/lib/server/bidi/third_party/bidiProtocolCore.js +180 -0
  123. package/browser-runtime/playwright-core/lib/server/bidi/third_party/bidiProtocolPermissions.js +42 -0
  124. package/browser-runtime/playwright-core/lib/server/bidi/third_party/bidiSerializer.js +148 -0
  125. package/browser-runtime/playwright-core/lib/server/bidi/third_party/firefoxPrefs.js +259 -0
  126. package/browser-runtime/playwright-core/lib/server/browser.js +149 -0
  127. package/browser-runtime/playwright-core/lib/server/browserContext.js +702 -0
  128. package/browser-runtime/playwright-core/lib/server/browserType.js +336 -0
  129. package/browser-runtime/playwright-core/lib/server/callLog.js +82 -0
  130. package/browser-runtime/playwright-core/lib/server/chromium/appIcon.png +0 -0
  131. package/browser-runtime/playwright-core/lib/server/chromium/chromium.js +397 -0
  132. package/browser-runtime/playwright-core/lib/server/chromium/chromiumSwitches.js +104 -0
  133. package/browser-runtime/playwright-core/lib/server/chromium/crBrowser.js +520 -0
  134. package/browser-runtime/playwright-core/lib/server/chromium/crConnection.js +197 -0
  135. package/browser-runtime/playwright-core/lib/server/chromium/crCoverage.js +235 -0
  136. package/browser-runtime/playwright-core/lib/server/chromium/crDevTools.js +111 -0
  137. package/browser-runtime/playwright-core/lib/server/chromium/crDragDrop.js +131 -0
  138. package/browser-runtime/playwright-core/lib/server/chromium/crExecutionContext.js +146 -0
  139. package/browser-runtime/playwright-core/lib/server/chromium/crInput.js +187 -0
  140. package/browser-runtime/playwright-core/lib/server/chromium/crNetworkManager.js +707 -0
  141. package/browser-runtime/playwright-core/lib/server/chromium/crPage.js +1001 -0
  142. package/browser-runtime/playwright-core/lib/server/chromium/crPdf.js +121 -0
  143. package/browser-runtime/playwright-core/lib/server/chromium/crProtocolHelper.js +145 -0
  144. package/browser-runtime/playwright-core/lib/server/chromium/crServiceWorker.js +136 -0
  145. package/browser-runtime/playwright-core/lib/server/chromium/defaultFontFamilies.js +162 -0
  146. package/browser-runtime/playwright-core/lib/server/chromium/protocol.d.js +16 -0
  147. package/browser-runtime/playwright-core/lib/server/clock.js +149 -0
  148. package/browser-runtime/playwright-core/lib/server/codegen/csharp.js +327 -0
  149. package/browser-runtime/playwright-core/lib/server/codegen/java.js +274 -0
  150. package/browser-runtime/playwright-core/lib/server/codegen/javascript.js +247 -0
  151. package/browser-runtime/playwright-core/lib/server/codegen/jsonl.js +52 -0
  152. package/browser-runtime/playwright-core/lib/server/codegen/language.js +132 -0
  153. package/browser-runtime/playwright-core/lib/server/codegen/languages.js +68 -0
  154. package/browser-runtime/playwright-core/lib/server/codegen/python.js +279 -0
  155. package/browser-runtime/playwright-core/lib/server/codegen/types.js +16 -0
  156. package/browser-runtime/playwright-core/lib/server/console.js +57 -0
  157. package/browser-runtime/playwright-core/lib/server/cookieStore.js +206 -0
  158. package/browser-runtime/playwright-core/lib/server/debugController.js +191 -0
  159. package/browser-runtime/playwright-core/lib/server/debugger.js +119 -0
  160. package/browser-runtime/playwright-core/lib/server/deviceDescriptors.js +39 -0
  161. package/browser-runtime/playwright-core/lib/server/deviceDescriptorsSource.json +1779 -0
  162. package/browser-runtime/playwright-core/lib/server/dialog.js +116 -0
  163. package/browser-runtime/playwright-core/lib/server/dispatchers/androidDispatcher.js +325 -0
  164. package/browser-runtime/playwright-core/lib/server/dispatchers/artifactDispatcher.js +118 -0
  165. package/browser-runtime/playwright-core/lib/server/dispatchers/browserContextDispatcher.js +384 -0
  166. package/browser-runtime/playwright-core/lib/server/dispatchers/browserDispatcher.js +118 -0
  167. package/browser-runtime/playwright-core/lib/server/dispatchers/browserTypeDispatcher.js +64 -0
  168. package/browser-runtime/playwright-core/lib/server/dispatchers/cdpSessionDispatcher.js +44 -0
  169. package/browser-runtime/playwright-core/lib/server/dispatchers/debugControllerDispatcher.js +78 -0
  170. package/browser-runtime/playwright-core/lib/server/dispatchers/dialogDispatcher.js +47 -0
  171. package/browser-runtime/playwright-core/lib/server/dispatchers/dispatcher.js +364 -0
  172. package/browser-runtime/playwright-core/lib/server/dispatchers/electronDispatcher.js +89 -0
  173. package/browser-runtime/playwright-core/lib/server/dispatchers/elementHandlerDispatcher.js +181 -0
  174. package/browser-runtime/playwright-core/lib/server/dispatchers/frameDispatcher.js +227 -0
  175. package/browser-runtime/playwright-core/lib/server/dispatchers/jsHandleDispatcher.js +85 -0
  176. package/browser-runtime/playwright-core/lib/server/dispatchers/jsonPipeDispatcher.js +58 -0
  177. package/browser-runtime/playwright-core/lib/server/dispatchers/localUtilsDispatcher.js +149 -0
  178. package/browser-runtime/playwright-core/lib/server/dispatchers/networkDispatchers.js +213 -0
  179. package/browser-runtime/playwright-core/lib/server/dispatchers/pageAgentDispatcher.js +96 -0
  180. package/browser-runtime/playwright-core/lib/server/dispatchers/pageDispatcher.js +393 -0
  181. package/browser-runtime/playwright-core/lib/server/dispatchers/playwrightDispatcher.js +108 -0
  182. package/browser-runtime/playwright-core/lib/server/dispatchers/streamDispatcher.js +67 -0
  183. package/browser-runtime/playwright-core/lib/server/dispatchers/tracingDispatcher.js +68 -0
  184. package/browser-runtime/playwright-core/lib/server/dispatchers/webSocketRouteDispatcher.js +165 -0
  185. package/browser-runtime/playwright-core/lib/server/dispatchers/writableStreamDispatcher.js +79 -0
  186. package/browser-runtime/playwright-core/lib/server/dom.js +815 -0
  187. package/browser-runtime/playwright-core/lib/server/download.js +70 -0
  188. package/browser-runtime/playwright-core/lib/server/electron/electron.js +273 -0
  189. package/browser-runtime/playwright-core/lib/server/electron/loader.js +29 -0
  190. package/browser-runtime/playwright-core/lib/server/errors.js +69 -0
  191. package/browser-runtime/playwright-core/lib/server/fetch.js +621 -0
  192. package/browser-runtime/playwright-core/lib/server/fileChooser.js +43 -0
  193. package/browser-runtime/playwright-core/lib/server/fileUploadUtils.js +84 -0
  194. package/browser-runtime/playwright-core/lib/server/firefox/ffBrowser.js +418 -0
  195. package/browser-runtime/playwright-core/lib/server/firefox/ffConnection.js +142 -0
  196. package/browser-runtime/playwright-core/lib/server/firefox/ffExecutionContext.js +150 -0
  197. package/browser-runtime/playwright-core/lib/server/firefox/ffInput.js +159 -0
  198. package/browser-runtime/playwright-core/lib/server/firefox/ffNetworkManager.js +256 -0
  199. package/browser-runtime/playwright-core/lib/server/firefox/ffPage.js +497 -0
  200. package/browser-runtime/playwright-core/lib/server/firefox/firefox.js +114 -0
  201. package/browser-runtime/playwright-core/lib/server/firefox/protocol.d.js +16 -0
  202. package/browser-runtime/playwright-core/lib/server/formData.js +147 -0
  203. package/browser-runtime/playwright-core/lib/server/frameSelectors.js +160 -0
  204. package/browser-runtime/playwright-core/lib/server/frames.js +1471 -0
  205. package/browser-runtime/playwright-core/lib/server/har/harRecorder.js +147 -0
  206. package/browser-runtime/playwright-core/lib/server/har/harTracer.js +607 -0
  207. package/browser-runtime/playwright-core/lib/server/harBackend.js +157 -0
  208. package/browser-runtime/playwright-core/lib/server/helper.js +96 -0
  209. package/browser-runtime/playwright-core/lib/server/index.js +58 -0
  210. package/browser-runtime/playwright-core/lib/server/input.js +277 -0
  211. package/browser-runtime/playwright-core/lib/server/instrumentation.js +72 -0
  212. package/browser-runtime/playwright-core/lib/server/javascript.js +291 -0
  213. package/browser-runtime/playwright-core/lib/server/launchApp.js +128 -0
  214. package/browser-runtime/playwright-core/lib/server/localUtils.js +214 -0
  215. package/browser-runtime/playwright-core/lib/server/macEditingCommands.js +143 -0
  216. package/browser-runtime/playwright-core/lib/server/network.js +667 -0
  217. package/browser-runtime/playwright-core/lib/server/page.js +830 -0
  218. package/browser-runtime/playwright-core/lib/server/pipeTransport.js +89 -0
  219. package/browser-runtime/playwright-core/lib/server/playwright.js +69 -0
  220. package/browser-runtime/playwright-core/lib/server/progress.js +132 -0
  221. package/browser-runtime/playwright-core/lib/server/protocolError.js +52 -0
  222. package/browser-runtime/playwright-core/lib/server/recorder/chat.js +161 -0
  223. package/browser-runtime/playwright-core/lib/server/recorder/recorderApp.js +366 -0
  224. package/browser-runtime/playwright-core/lib/server/recorder/recorderRunner.js +138 -0
  225. package/browser-runtime/playwright-core/lib/server/recorder/recorderSignalProcessor.js +83 -0
  226. package/browser-runtime/playwright-core/lib/server/recorder/recorderUtils.js +157 -0
  227. package/browser-runtime/playwright-core/lib/server/recorder/throttledFile.js +57 -0
  228. package/browser-runtime/playwright-core/lib/server/recorder.js +499 -0
  229. package/browser-runtime/playwright-core/lib/server/registry/browserFetcher.js +177 -0
  230. package/browser-runtime/playwright-core/lib/server/registry/dependencies.js +371 -0
  231. package/browser-runtime/playwright-core/lib/server/registry/index.js +1422 -0
  232. package/browser-runtime/playwright-core/lib/server/registry/nativeDeps.js +1280 -0
  233. package/browser-runtime/playwright-core/lib/server/registry/oopDownloadBrowserMain.js +127 -0
  234. package/browser-runtime/playwright-core/lib/server/screencast.js +190 -0
  235. package/browser-runtime/playwright-core/lib/server/screenshotter.js +333 -0
  236. package/browser-runtime/playwright-core/lib/server/selectors.js +112 -0
  237. package/browser-runtime/playwright-core/lib/server/socksClientCertificatesInterceptor.js +383 -0
  238. package/browser-runtime/playwright-core/lib/server/socksInterceptor.js +95 -0
  239. package/browser-runtime/playwright-core/lib/server/trace/recorder/snapshotter.js +147 -0
  240. package/browser-runtime/playwright-core/lib/server/trace/recorder/snapshotterInjected.js +561 -0
  241. package/browser-runtime/playwright-core/lib/server/trace/recorder/tracing.js +604 -0
  242. package/browser-runtime/playwright-core/lib/server/trace/viewer/traceParser.js +72 -0
  243. package/browser-runtime/playwright-core/lib/server/trace/viewer/traceViewer.js +245 -0
  244. package/browser-runtime/playwright-core/lib/server/transport.js +181 -0
  245. package/browser-runtime/playwright-core/lib/server/types.js +28 -0
  246. package/browser-runtime/playwright-core/lib/server/usKeyboardLayout.js +145 -0
  247. package/browser-runtime/playwright-core/lib/server/utils/ascii.js +44 -0
  248. package/browser-runtime/playwright-core/lib/server/utils/comparators.js +139 -0
  249. package/browser-runtime/playwright-core/lib/server/utils/crypto.js +216 -0
  250. package/browser-runtime/playwright-core/lib/server/utils/debug.js +42 -0
  251. package/browser-runtime/playwright-core/lib/server/utils/debugLogger.js +122 -0
  252. package/browser-runtime/playwright-core/lib/server/utils/env.js +73 -0
  253. package/browser-runtime/playwright-core/lib/server/utils/eventsHelper.js +39 -0
  254. package/browser-runtime/playwright-core/lib/server/utils/expectUtils.js +123 -0
  255. package/browser-runtime/playwright-core/lib/server/utils/fileUtils.js +191 -0
  256. package/browser-runtime/playwright-core/lib/server/utils/happyEyeballs.js +207 -0
  257. package/browser-runtime/playwright-core/lib/server/utils/hostPlatform.js +138 -0
  258. package/browser-runtime/playwright-core/lib/server/utils/httpServer.js +203 -0
  259. package/browser-runtime/playwright-core/lib/server/utils/imageUtils.js +141 -0
  260. package/browser-runtime/playwright-core/lib/server/utils/image_tools/colorUtils.js +89 -0
  261. package/browser-runtime/playwright-core/lib/server/utils/image_tools/compare.js +109 -0
  262. package/browser-runtime/playwright-core/lib/server/utils/image_tools/imageChannel.js +78 -0
  263. package/browser-runtime/playwright-core/lib/server/utils/image_tools/stats.js +102 -0
  264. package/browser-runtime/playwright-core/lib/server/utils/linuxUtils.js +71 -0
  265. package/browser-runtime/playwright-core/lib/server/utils/network.js +242 -0
  266. package/browser-runtime/playwright-core/lib/server/utils/nodePlatform.js +154 -0
  267. package/browser-runtime/playwright-core/lib/server/utils/pipeTransport.js +84 -0
  268. package/browser-runtime/playwright-core/lib/server/utils/processLauncher.js +241 -0
  269. package/browser-runtime/playwright-core/lib/server/utils/profiler.js +65 -0
  270. package/browser-runtime/playwright-core/lib/server/utils/socksProxy.js +511 -0
  271. package/browser-runtime/playwright-core/lib/server/utils/spawnAsync.js +41 -0
  272. package/browser-runtime/playwright-core/lib/server/utils/task.js +51 -0
  273. package/browser-runtime/playwright-core/lib/server/utils/userAgent.js +98 -0
  274. package/browser-runtime/playwright-core/lib/server/utils/wsServer.js +121 -0
  275. package/browser-runtime/playwright-core/lib/server/utils/zipFile.js +74 -0
  276. package/browser-runtime/playwright-core/lib/server/utils/zones.js +57 -0
  277. package/browser-runtime/playwright-core/lib/server/videoRecorder.js +124 -0
  278. package/browser-runtime/playwright-core/lib/server/webkit/protocol.d.js +16 -0
  279. package/browser-runtime/playwright-core/lib/server/webkit/webkit.js +108 -0
  280. package/browser-runtime/playwright-core/lib/server/webkit/wkBrowser.js +335 -0
  281. package/browser-runtime/playwright-core/lib/server/webkit/wkConnection.js +144 -0
  282. package/browser-runtime/playwright-core/lib/server/webkit/wkExecutionContext.js +154 -0
  283. package/browser-runtime/playwright-core/lib/server/webkit/wkInput.js +181 -0
  284. package/browser-runtime/playwright-core/lib/server/webkit/wkInterceptableRequest.js +197 -0
  285. package/browser-runtime/playwright-core/lib/server/webkit/wkPage.js +1159 -0
  286. package/browser-runtime/playwright-core/lib/server/webkit/wkProvisionalPage.js +83 -0
  287. package/browser-runtime/playwright-core/lib/server/webkit/wkWorkers.js +105 -0
  288. package/browser-runtime/playwright-core/lib/third_party/pixelmatch.js +255 -0
  289. package/browser-runtime/playwright-core/lib/utils/isomorphic/ariaSnapshot.js +455 -0
  290. package/browser-runtime/playwright-core/lib/utils/isomorphic/assert.js +31 -0
  291. package/browser-runtime/playwright-core/lib/utils/isomorphic/colors.js +72 -0
  292. package/browser-runtime/playwright-core/lib/utils/isomorphic/cssParser.js +245 -0
  293. package/browser-runtime/playwright-core/lib/utils/isomorphic/cssTokenizer.js +1051 -0
  294. package/browser-runtime/playwright-core/lib/utils/isomorphic/headers.js +53 -0
  295. package/browser-runtime/playwright-core/lib/utils/isomorphic/locatorGenerators.js +689 -0
  296. package/browser-runtime/playwright-core/lib/utils/isomorphic/locatorParser.js +176 -0
  297. package/browser-runtime/playwright-core/lib/utils/isomorphic/locatorUtils.js +81 -0
  298. package/browser-runtime/playwright-core/lib/utils/isomorphic/lruCache.js +51 -0
  299. package/browser-runtime/playwright-core/lib/utils/isomorphic/manualPromise.js +114 -0
  300. package/browser-runtime/playwright-core/lib/utils/isomorphic/mimeType.js +459 -0
  301. package/browser-runtime/playwright-core/lib/utils/isomorphic/multimap.js +80 -0
  302. package/browser-runtime/playwright-core/lib/utils/isomorphic/protocolFormatter.js +81 -0
  303. package/browser-runtime/playwright-core/lib/utils/isomorphic/protocolMetainfo.js +330 -0
  304. package/browser-runtime/playwright-core/lib/utils/isomorphic/rtti.js +43 -0
  305. package/browser-runtime/playwright-core/lib/utils/isomorphic/selectorParser.js +386 -0
  306. package/browser-runtime/playwright-core/lib/utils/isomorphic/semaphore.js +54 -0
  307. package/browser-runtime/playwright-core/lib/utils/isomorphic/stackTrace.js +158 -0
  308. package/browser-runtime/playwright-core/lib/utils/isomorphic/stringUtils.js +204 -0
  309. package/browser-runtime/playwright-core/lib/utils/isomorphic/time.js +49 -0
  310. package/browser-runtime/playwright-core/lib/utils/isomorphic/timeoutRunner.js +66 -0
  311. package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/entries.js +16 -0
  312. package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/snapshotRenderer.js +499 -0
  313. package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/snapshotServer.js +120 -0
  314. package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/snapshotStorage.js +89 -0
  315. package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/traceLoader.js +131 -0
  316. package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/traceModel.js +365 -0
  317. package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/traceModernizer.js +400 -0
  318. package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/versions/traceV3.js +16 -0
  319. package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/versions/traceV4.js +16 -0
  320. package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/versions/traceV5.js +16 -0
  321. package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/versions/traceV6.js +16 -0
  322. package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/versions/traceV7.js +16 -0
  323. package/browser-runtime/playwright-core/lib/utils/isomorphic/trace/versions/traceV8.js +16 -0
  324. package/browser-runtime/playwright-core/lib/utils/isomorphic/traceUtils.js +58 -0
  325. package/browser-runtime/playwright-core/lib/utils/isomorphic/types.js +16 -0
  326. package/browser-runtime/playwright-core/lib/utils/isomorphic/urlMatch.js +190 -0
  327. package/browser-runtime/playwright-core/lib/utils/isomorphic/utilityScriptSerializers.js +251 -0
  328. package/browser-runtime/playwright-core/lib/utils/isomorphic/yaml.js +84 -0
  329. package/browser-runtime/playwright-core/lib/utils.js +111 -0
  330. package/browser-runtime/playwright-core/lib/utilsBundle.js +109 -0
  331. package/browser-runtime/playwright-core/lib/utilsBundleImpl/index.js +218 -0
  332. package/browser-runtime/playwright-core/lib/utilsBundleImpl/xdg-open +1066 -0
  333. package/browser-runtime/playwright-core/lib/zipBundle.js +34 -0
  334. package/browser-runtime/playwright-core/lib/zipBundleImpl.js +5 -0
  335. package/browser-runtime/playwright-core/node_modules/.bin/playwright-core +21 -0
  336. package/browser-runtime/playwright-core/package.json +43 -0
  337. package/cli.mjs +33 -4
  338. package/daemon.mjs +21 -2
  339. package/entry.mjs +655 -354
  340. package/launcher.mjs +22 -0
  341. package/package.json +7 -6
  342. package/updater.mjs +6 -0
package/cli.mjs CHANGED
@@ -1,9 +1,38 @@
1
1
  #!/usr/bin/env node
2
- import{execFileSync as P,spawn as j}from"child_process";import{createHash as B}from"crypto";import s from"fs";import i from"path";import{fileURLToPath as U}from"url";var k=new Set(["help","start","stop","restart","status","logs"]);function A(e="siboot-headless",n="/data/siboot"){console.log(`Usage:
2
+ import { createRequire as __runtimeCreateRequire } from "node:module"; const require = __runtimeCreateRequire(import.meta.url);
3
+ var Vr=Object.defineProperty;var ic=Object.getOwnPropertyDescriptor;var ac=Object.getOwnPropertyNames;var sc=Object.prototype.hasOwnProperty;var v=(e,t)=>()=>(e&&(t=e(e=0)),t);var cc=(e,t)=>{for(var r in t)Vr(e,r,{get:t[r],enumerable:!0})},uc=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ac(t))!sc.call(e,i)&&i!==r&&Vr(e,i,{get:()=>t[i],enumerable:!(n=ic(t,i))||n.enumerable});return e};var lc=e=>uc(Vr({},"__esModule",{value:!0}),e);var mc,Ve,Fr=v(()=>{"use strict";mc=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Ve=(function(e){mc(t,e);function t(r,n,i){var o=e.call(this,r)||this;return o.name="OTLPExporterError",o.data=i,o.code=n,o}return t})(Error)});var $,jr=v(()=>{"use strict";$="1.9.1"});function Tc(e){let t=new Set([e]),r=new Set,n=e.match(_o);if(!n)return()=>!1;let i={major:+n[1],minor:+n[2],patch:+n[3],prerelease:n[4]};if(i.prerelease!=null)return function(l){return l===e};function o(c){return r.add(c),!1}function s(c){return t.add(c),!0}return function(l){if(t.has(l))return!0;if(r.has(l))return!1;let a=l.match(_o);if(!a)return o(l);let u={major:+a[1],minor:+a[2],patch:+a[3],prerelease:a[4]};return u.prerelease!=null||i.major!==u.major?o(l):i.major===0?i.minor===u.minor&&i.patch<=u.patch?s(l):o(l):i.minor<=u.minor?s(l):o(l)}}var _o,mo,ho=v(()=>{"use strict";jr();_o=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/;mo=Tc($)});function ge(e,t,r,n=!1){var i;let o=Fe[He]=(i=Fe[He])!==null&&i!==void 0?i:{version:$};if(!n&&o[e]){let s=new Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return r.error(s.stack||s.message),!1}if(o.version!==$){let s=new Error(`@opentelemetry/api: Registration of version v${o.version} for ${e} does not match previously registered API v${$}`);return r.error(s.stack||s.message),!1}return o[e]=t,r.debug(`@opentelemetry/api: Registered a global for ${e} v${$}.`),!0}function K(e){var t,r;let n=(t=Fe[He])===null||t===void 0?void 0:t.version;if(!(!n||!mo(n)))return(r=Fe[He])===null||r===void 0?void 0:r[e]}function ve(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${$}.`);let r=Fe[He];r&&delete r[e]}var Sc,He,Fe,je=v(()=>{"use strict";jr();ho();Sc=$.split(".")[0],He=Symbol.for(`opentelemetry.js.api.${Sc}`),Fe=typeof globalThis=="object"?globalThis:typeof self=="object"?self:typeof window=="object"?window:typeof global=="object"?global:{}});function $e(e,t,r){let n=K("diag");if(n)return n[e](t,...r)}var wt,Eo=v(()=>{"use strict";je();wt=class{constructor(t){this._namespace=t.namespace||"DiagComponentLogger"}debug(...t){return $e("debug",this._namespace,t)}error(...t){return $e("error",this._namespace,t)}info(...t){return $e("info",this._namespace,t)}warn(...t){return $e("warn",this._namespace,t)}verbose(...t){return $e("verbose",this._namespace,t)}}});var S,bt=v(()=>{"use strict";(function(e){e[e.NONE=0]="NONE",e[e.ERROR=30]="ERROR",e[e.WARN=50]="WARN",e[e.INFO=60]="INFO",e[e.DEBUG=70]="DEBUG",e[e.VERBOSE=80]="VERBOSE",e[e.ALL=9999]="ALL"})(S||(S={}))});function go(e,t){e<S.NONE?e=S.NONE:e>S.ALL&&(e=S.ALL),t=t||{};function r(n,i){let o=t[n];return typeof o=="function"&&e>=i?o.bind(t):function(){}}return{error:r("error",S.ERROR),warn:r("warn",S.WARN),info:r("info",S.INFO),debug:r("debug",S.DEBUG),verbose:r("verbose",S.VERBOSE)}}var vo=v(()=>{"use strict";bt()});var yc,I,Ke=v(()=>{"use strict";Eo();vo();bt();je();yc="diag",I=class e{static instance(){return this._instance||(this._instance=new e),this._instance}constructor(){function t(i){return function(...o){let s=K("diag");if(s)return s[i](...o)}}let r=this,n=(i,o={logLevel:S.INFO})=>{var s,c,l;if(i===r){let f=new Error("Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation");return r.error((s=f.stack)!==null&&s!==void 0?s:f.message),!1}typeof o=="number"&&(o={logLevel:o});let a=K("diag"),u=go((c=o.logLevel)!==null&&c!==void 0?c:S.INFO,i);if(a&&!o.suppressOverrideMessage){let f=(l=new Error().stack)!==null&&l!==void 0?l:"<failed to generate stacktrace>";a.warn(`Current logger will be overwritten from ${f}`),u.warn(`Current logger will overwrite one already registered from ${f}`)}return ge("diag",u,r,!0)};r.setLogger=n,r.disable=()=>{ve(yc,r)},r.createComponentLogger=i=>new wt(i),r.verbose=t("verbose"),r.debug=t("debug"),r.info=t("info"),r.warn=t("warn"),r.error=t("error")}}});var To,So=v(()=>{"use strict";To=Symbol("BaggageEntryMetadata")});function $r(e){return typeof e!="string"&&(Ac.error(`Cannot create baggage metadata from unknown type: ${typeof e}`),e=""),{__TYPE__:To,toString(){return e}}}var Ac,yo=v(()=>{"use strict";Ke();So();Ac=I.instance()});function We(e){return Symbol.for(e)}var Kr,Wr,Pt=v(()=>{"use strict";Kr=class e{constructor(t){let r=this;r._currentContext=t?new Map(t):new Map,r.getValue=n=>r._currentContext.get(n),r.setValue=(n,i)=>{let o=new e(r._currentContext);return o._currentContext.set(n,i),o},r.deleteValue=n=>{let i=new e(r._currentContext);return i._currentContext.delete(n),i}}},Wr=new Kr});function tn(){return Oc}var Yr,Te,Xr,zr,Jr,Zr,Ye,qr,Qr,en,Oc,Rc,xc,Lc,wc,bc,Pc,Mc,Ao=v(()=>{"use strict";Yr=class{constructor(){}createGauge(t,r){return xc}createHistogram(t,r){return Lc}createCounter(t,r){return Rc}createUpDownCounter(t,r){return wc}createObservableGauge(t,r){return Pc}createObservableCounter(t,r){return bc}createObservableUpDownCounter(t,r){return Mc}addBatchObservableCallback(t,r){}removeBatchObservableCallback(t){}},Te=class{},Xr=class extends Te{add(t,r){}},zr=class extends Te{add(t,r){}},Jr=class extends Te{record(t,r){}},Zr=class extends Te{record(t,r){}},Ye=class{addCallback(t){}removeCallback(t){}},qr=class extends Ye{},Qr=class extends Ye{},en=class extends Ye{},Oc=new Yr,Rc=new Xr,xc=new Jr,Lc=new Zr,wc=new zr,bc=new qr,Pc=new Qr,Mc=new en});var L,Oo=v(()=>{"use strict";(function(e){e[e.INT=0]="INT",e[e.DOUBLE=1]="DOUBLE"})(L||(L={}))});var Mt,Ro=v(()=>{"use strict";Pt();Mt=class{active(){return Wr}with(t,r,n,...i){return r.call(n,...i)}bind(t,r){return r}enable(){return this}disable(){return this}}});var rn,Ic,J,It=v(()=>{"use strict";Ro();je();Ke();rn="context",Ic=new Mt,J=class e{constructor(){}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalContextManager(t){return ge(rn,t,I.instance())}active(){return this._getContextManager().active()}with(t,r,n,...i){return this._getContextManager().with(t,r,n,...i)}bind(t,r){return this._getContextManager().bind(t,r)}_getContextManager(){return K(rn)||Ic}disable(){this._getContextManager().disable(),ve(rn,I.instance())}}});var oe,nn=v(()=>{"use strict";(function(e){e[e.NONE=0]="NONE",e[e.SAMPLED=1]="SAMPLED"})(oe||(oe={}))});var on,an,xo,sn=v(()=>{"use strict";nn();on="0000000000000000",an="00000000000000000000000000000000",xo={traceId:an,spanId:on,traceFlags:oe.NONE}});var k,Nt=v(()=>{"use strict";sn();k=class{constructor(t=xo){this._spanContext=t}spanContext(){return this._spanContext}setAttribute(t,r){return this}setAttributes(t){return this}addEvent(t,r){return this}addLink(t){return this}addLinks(t){return this}setStatus(t){return this}updateName(t){return this}end(t){}isRecording(){return!1}recordException(t,r){}}});function Ct(e){return e.getValue(cn)||void 0}function Lo(){return Ct(J.getInstance().active())}function Xe(e,t){return e.setValue(cn,t)}function wo(e){return e.deleteValue(cn)}function bo(e,t){return Xe(e,new k(t))}function Ut(e){var t;return(t=Ct(e))===null||t===void 0?void 0:t.spanContext()}var cn,un=v(()=>{"use strict";Pt();Nt();It();cn=We("OpenTelemetry Context Key SPAN")});function Po(e,t){if(typeof e!="string"||e.length!==t)return!1;let r=0;for(let n=0;n<e.length;n+=4)r+=(Dt[e.charCodeAt(n)]|0)+(Dt[e.charCodeAt(n+1)]|0)+(Dt[e.charCodeAt(n+2)]|0)+(Dt[e.charCodeAt(n+3)]|0);return r===t}function Mo(e){return Po(e,32)&&e!==an}function Io(e){return Po(e,16)&&e!==on}function ie(e){return Mo(e.traceId)&&Io(e.spanId)}function No(e){return new k(e)}var Dt,Bt=v(()=>{"use strict";sn();Nt();Dt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1])});function Nc(e){return e!==null&&typeof e=="object"&&"spanId"in e&&typeof e.spanId=="string"&&"traceId"in e&&typeof e.traceId=="string"&&"traceFlags"in e&&typeof e.traceFlags=="number"}var ln,Se,fn=v(()=>{"use strict";It();un();Nt();Bt();ln=J.getInstance(),Se=class{startSpan(t,r,n=ln.active()){if(!!r?.root)return new k;let o=n&&Ut(n);return Nc(o)&&ie(o)?new k(o):new k}startActiveSpan(t,r,n,i){let o,s,c;if(arguments.length<2)return;arguments.length===2?c=r:arguments.length===3?(o=r,c=n):(o=r,s=n,c=i);let l=s??ln.active(),a=this.startSpan(t,o,l),u=Xe(l,a);return ln.with(u,c,void 0,a)}}});var Cc,Gt,Co=v(()=>{"use strict";fn();Cc=new Se,Gt=class{constructor(t,r,n,i){this._provider=t,this.name=r,this.version=n,this.options=i}startSpan(t,r,n){return this._getTracer().startSpan(t,r,n)}startActiveSpan(t,r,n,i){let o=this._getTracer();return Reflect.apply(o.startActiveSpan,o,arguments)}_getTracer(){if(this._delegate)return this._delegate;let t=this._provider.getDelegateTracer(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):Cc}}});var Vt,Uo=v(()=>{"use strict";fn();Vt=class{getTracer(t,r,n){return new Se}}});var Uc,ze,Do=v(()=>{"use strict";Co();Uo();Uc=new Vt,ze=class{getTracer(t,r,n){var i;return(i=this.getDelegateTracer(t,r,n))!==null&&i!==void 0?i:new Gt(this,t,r,n)}getDelegate(){var t;return(t=this._delegate)!==null&&t!==void 0?t:Uc}setDelegate(t){this._delegate=t}getDelegateTracer(t,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getTracer(t,r,n)}}});var N,Bo=v(()=>{"use strict";It();N=J.getInstance()});var p,Go=v(()=>{"use strict";Ke();p=I.instance()});var pn,kt,Vo=v(()=>{"use strict";je();Do();Bt();un();Ke();pn="trace",kt=class e{constructor(){this._proxyTracerProvider=new ze,this.wrapSpanContext=No,this.isSpanContextValid=ie,this.deleteSpan=wo,this.getSpan=Ct,this.getActiveSpan=Lo,this.getSpanContext=Ut,this.setSpan=Xe,this.setSpanContext=bo}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalTracerProvider(t){let r=ge(pn,this._proxyTracerProvider,I.instance());return r&&this._proxyTracerProvider.setDelegate(t),r}getTracerProvider(){return K(pn)||this._proxyTracerProvider}getTracer(t,r){return this.getTracerProvider().getTracer(t,r)}disable(){ve(pn,I.instance()),this._proxyTracerProvider=new ze}}});var ae,ko=v(()=>{"use strict";Vo();ae=kt.getInstance()});var g=v(()=>{"use strict";yo();Pt();bt();Ao();Oo();nn();Bt();Bo();Go();ko()});function Da(e){var t=[429,502,503,504];return t.includes(e)}function Ba(e){if(e!=null){var t=Number.parseInt(e,10);if(Number.isInteger(t))return t>0?t*1e3:-1;var r=new Date(e).getTime()-Date.now();return r>=0?r:0}}var Ga=v(()=>{"use strict"});var Ha={};cc(Ha,{compressAndSend:()=>ka,createHttpAgent:()=>zl,sendWithHttp:()=>Yl});import*as Rr from"http";import*as xr from"https";import*as Va from"zlib";import{Readable as Wl}from"stream";function Yl(e,t,r,n,i){var o=new URL(e.url),s=Number(process.versions.node.split(".")[0]),c={hostname:o.hostname,port:o.port,path:o.pathname,method:"POST",headers:Fn({},e.headers()),agent:t},l=o.protocol==="http:"?Rr.request:xr.request,a=l(c,function(f){var d=[];f.on("data",function(T){return d.push(T)}),f.on("end",function(){if(f.statusCode&&f.statusCode<299)n({status:"success",data:Buffer.concat(d)});else if(f.statusCode&&Da(f.statusCode))n({status:"retryable",retryInMillis:Ba(f.headers["retry-after"])});else{var T=new Ve(f.statusMessage,f.statusCode,Buffer.concat(d).toString());n({status:"failure",error:T})}})});a.setTimeout(i,function(){a.destroy(),n({status:"failure",error:new Error("Request Timeout")})}),a.on("error",function(f){n({status:"failure",error:f})});var u=s>=14?"close":"abort";a.on(u,function(){n({status:"failure",error:new Error("Request timed out")})}),ka(a,e.compression,r,function(f){n({status:"failure",error:f})})}function ka(e,t,r,n){var i=Xl(r);t==="gzip"&&(e.setHeader("Content-Encoding","gzip"),i=i.on("error",n).pipe(Va.createGzip()).on("error",n)),i.pipe(e).on("error",n)}function Xl(e){var t=new Wl;return t.push(e),t.push(null),t}function zl(e,t){var r=new URL(e),n=r.protocol==="http:"?Rr.Agent:xr.Agent;return new n(t)}var Fn,Fa=v(()=>{"use strict";Ga();Fr();Fn=function(){return Fn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Fn.apply(this,arguments)}});import Kf from"fs";import ws from"os";import Wf from"path";import{StringDecoder as Yf}from"string_decoder";var fc=/\b(authorization|proxy-authorization|cookie|set-cookie)\s*:\s*[^\r\n]*/gi,pc=/\b(bearer|basic)\s+[A-Z0-9._~+/=-]+/gi,_c=/\b(authorization|proxy[-_]authorization|cookie|set[-_]cookie|credential[-_]grant|taihu[-_]auth[-_]grant|app[-_]publish[-_]grant|access[-_]token|refresh[-_]token|id[-_]token|token|api[-_]?key|password|secret)\b["']?\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;&]+)/gi;function At(e){return(e instanceof Error?`${e.name}: ${e.message}`:String(e??"")).replace(fc,"$1: [redacted]").replace(pc,"$1 [redacted]").replace(_c,"$1=[redacted]").replace(/\s+/g," ").trim().slice(0,2e3)}function ao(e,t,r,n){let i=At(r),o=Object.fromEntries(Object.entries(n).map(([s,c])=>[s,At(c)]));if(Object.keys(o).length===0){e[t](i);return}e[t](i,o)}var Ue;(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"})(Ue||(Ue={}));var Ot=(function(){function e(){}return e.prototype.emit=function(t){},e})();var De=new Ot;var dc=(function(){function e(){}return e.prototype.getLogger=function(t,r,n){return new Ot},e})();var Rt=new dc;var so=(function(){function e(t,r,n,i){this._provider=t,this.name=r,this.version=n,this.options=i}return e.prototype.emit=function(t){this._getLogger().emit(t)},e.prototype._getLogger=function(){if(this._delegate)return this._delegate;var t=this._provider.getDelegateLogger(this.name,this.version,this.options);return t?(this._delegate=t,this._delegate):De},e})();var kr=(function(){function e(){}return e.prototype.getLogger=function(t,r,n){var i;return(i=this.getDelegateLogger(t,r,n))!==null&&i!==void 0?i:new so(this,t,r,n)},e.prototype.getDelegate=function(){var t;return(t=this._delegate)!==null&&t!==void 0?t:Rt},e.prototype.setDelegate=function(t){this._delegate=t},e.prototype.getDelegateLogger=function(t,r,n){var i;return(i=this._delegate)===null||i===void 0?void 0:i.getLogger(t,r,n)},e})();var xt=typeof globalThis=="object"?globalThis:global;var Be=Symbol.for("io.opentelemetry.js.api.logs"),Ee=xt;function co(e,t,r){return function(n){return n===e?t:r}}var Hr=1;var uo=(function(){function e(){this._proxyLoggerProvider=new kr}return e.getInstance=function(){return this._instance||(this._instance=new e),this._instance},e.prototype.setGlobalLoggerProvider=function(t){return Ee[Be]?this.getLoggerProvider():(Ee[Be]=co(Hr,t,Rt),this._proxyLoggerProvider.setDelegate(t),t)},e.prototype.getLoggerProvider=function(){var t,r;return(r=(t=Ee[Be])===null||t===void 0?void 0:t.call(Ee,Hr))!==null&&r!==void 0?r:this._proxyLoggerProvider},e.prototype.getLogger=function(t,r,n){return this.getLoggerProvider().getLogger(t,r,n)},e.prototype.disable=function(){delete Ee[Be],this._proxyLoggerProvider=new kr},e})();var I_=uo.getInstance();var Ge=(function(){function e(t){this._delegate=t}return e.prototype.export=function(t,r){this._delegate.export(t,r)},e.prototype.forceFlush=function(){return this._delegate.forceFlush()},e.prototype.shutdown=function(){return this._delegate.shutdown()},e})();function hc(e){if(!Number.isNaN(e)&&Number.isFinite(e)&&e>0)return e;throw new Error("Configuration: timeoutMillis is invalid, expected number greater than 0 (actual: '"+e+"')")}function Lt(e){if(e!=null)return function(){return e}}function lo(e,t,r){var n,i,o,s,c,l;return{timeoutMillis:hc((i=(n=e.timeoutMillis)!==null&&n!==void 0?n:t.timeoutMillis)!==null&&i!==void 0?i:r.timeoutMillis),concurrencyLimit:(s=(o=e.concurrencyLimit)!==null&&o!==void 0?o:t.concurrencyLimit)!==null&&s!==void 0?s:r.concurrencyLimit,compression:(l=(c=e.compression)!==null&&c!==void 0?c:t.compression)!==null&&l!==void 0?l:r.compression}}function fo(){return{timeoutMillis:1e4,concurrencyLimit:30,compression:"none"}}var ke;(function(e){e.NONE="none",e.GZIP="gzip"})(ke||(ke={}));var Ec=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{a(n.next(u))}catch(f){s(f)}}function l(u){try{a(n.throw(u))}catch(f){s(f)}}function a(u){u.done?o(u.value):i(u.value).then(c,l)}a((n=n.apply(e,t||[])).next())})},gc=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},vc=(function(){function e(t){this._sendingPromises=[],this._concurrencyLimit=t}return e.prototype.pushPromise=function(t){var r=this;if(this.hasReachedLimit())throw new Error("Concurrency Limit reached");this._sendingPromises.push(t);var n=function(){var i=r._sendingPromises.indexOf(t);r._sendingPromises.splice(i,1)};t.then(n,n)},e.prototype.hasReachedLimit=function(){return this._sendingPromises.length>=this._concurrencyLimit},e.prototype.awaitAll=function(){return Ec(this,void 0,void 0,function(){return gc(this,function(t){switch(t.label){case 0:return[4,Promise.all(this._sendingPromises)];case 1:return t.sent(),[2]}})})},e})();function po(e){return new vc(e.concurrencyLimit)}g();var Dc=We("OpenTelemetry SDK Context Key SUPPRESS_TRACING");function Ho(e){return e.setValue(Dc,!0)}var Fo="=",Ht=";",_n=",";var jo=8192;g();var Bc=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function $o(e){return e.reduce(function(t,r){var n=""+t+(t!==""?_n:"")+r;return n.length>jo?t:n},"")}function Ko(e){return e.getAllEntries().map(function(t){var r=Bc(t,2),n=r[0],i=r[1],o=encodeURIComponent(n)+"="+encodeURIComponent(i.value);return i.metadata!==void 0&&(o+=Ht+i.metadata.toString()),o})}function dn(e){var t=e.split(Ht);if(!(t.length<=0)){var r=t.shift();if(r){var n=r.indexOf(Fo);if(!(n<=0)){var i=decodeURIComponent(r.substring(0,n).trim()),o=decodeURIComponent(r.substring(n+1).trim()),s;return t.length>0&&(s=$r(t.join(Ht))),{key:i,value:o,metadata:s}}}}}function Wo(e){return typeof e!="string"||e.length===0?{}:e.split(_n).map(function(t){return dn(t)}).filter(function(t){return t!==void 0&&t.value.length>0}).reduce(function(t,r){return t[r.key]=r.value,t},{})}var Gc=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Ft(e){return e==null?!0:Array.isArray(e)?Vc(e):Yo(e)}function Vc(e){var t,r,n;try{for(var i=Gc(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(s!=null){if(!n){if(Yo(s)){n=typeof s;continue}return!1}if(typeof s!==n)return!1}}}catch(c){t={error:c}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return!0}function Yo(e){switch(typeof e){case"number":case"boolean":case"string":return!0}return!1}g();function Xo(){return function(e){p.error(kc(e))}}function kc(e){return typeof e=="string"?e:JSON.stringify(Hc(e))}function Hc(e){for(var t={},r=e;r!==null;)Object.getOwnPropertyNames(r).forEach(function(n){if(!t[n]){var i=r[n];i&&(t[n]=String(i))}}),r=Object.getPrototypeOf(r);return t}var Fc=Xo();function W(e){try{Fc(e)}catch{}}g();var jt;(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"})(jt||(jt={}));var jc=",",$c=["OTEL_SDK_DISABLED"];function Kc(e){return $c.indexOf(e)>-1}var Wc=["OTEL_BSP_EXPORT_TIMEOUT","OTEL_BSP_MAX_EXPORT_BATCH_SIZE","OTEL_BSP_MAX_QUEUE_SIZE","OTEL_BSP_SCHEDULE_DELAY","OTEL_BLRP_EXPORT_TIMEOUT","OTEL_BLRP_MAX_EXPORT_BATCH_SIZE","OTEL_BLRP_MAX_QUEUE_SIZE","OTEL_BLRP_SCHEDULE_DELAY","OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_ATTRIBUTE_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT","OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT","OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT","OTEL_SPAN_EVENT_COUNT_LIMIT","OTEL_SPAN_LINK_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT","OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT","OTEL_EXPORTER_OTLP_TIMEOUT","OTEL_EXPORTER_OTLP_TRACES_TIMEOUT","OTEL_EXPORTER_OTLP_METRICS_TIMEOUT","OTEL_EXPORTER_OTLP_LOGS_TIMEOUT","OTEL_EXPORTER_JAEGER_AGENT_PORT"];function Yc(e){return Wc.indexOf(e)>-1}var Xc=["OTEL_NO_PATCH_MODULES","OTEL_PROPAGATORS","OTEL_SEMCONV_STABILITY_OPT_IN"];function zc(e){return Xc.indexOf(e)>-1}var ye=1/0,Ae=128,zo=128,Jo=128,$t={OTEL_SDK_DISABLED:!1,CONTAINER_NAME:"",ECS_CONTAINER_METADATA_URI_V4:"",ECS_CONTAINER_METADATA_URI:"",HOSTNAME:"",KUBERNETES_SERVICE_HOST:"",NAMESPACE:"",OTEL_BSP_EXPORT_TIMEOUT:3e4,OTEL_BSP_MAX_EXPORT_BATCH_SIZE:512,OTEL_BSP_MAX_QUEUE_SIZE:2048,OTEL_BSP_SCHEDULE_DELAY:5e3,OTEL_BLRP_EXPORT_TIMEOUT:3e4,OTEL_BLRP_MAX_EXPORT_BATCH_SIZE:512,OTEL_BLRP_MAX_QUEUE_SIZE:2048,OTEL_BLRP_SCHEDULE_DELAY:5e3,OTEL_EXPORTER_JAEGER_AGENT_HOST:"",OTEL_EXPORTER_JAEGER_AGENT_PORT:6832,OTEL_EXPORTER_JAEGER_ENDPOINT:"",OTEL_EXPORTER_JAEGER_PASSWORD:"",OTEL_EXPORTER_JAEGER_USER:"",OTEL_EXPORTER_OTLP_ENDPOINT:"",OTEL_EXPORTER_OTLP_TRACES_ENDPOINT:"",OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:"",OTEL_EXPORTER_OTLP_LOGS_ENDPOINT:"",OTEL_EXPORTER_OTLP_HEADERS:"",OTEL_EXPORTER_OTLP_TRACES_HEADERS:"",OTEL_EXPORTER_OTLP_METRICS_HEADERS:"",OTEL_EXPORTER_OTLP_LOGS_HEADERS:"",OTEL_EXPORTER_OTLP_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_TRACES_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_METRICS_TIMEOUT:1e4,OTEL_EXPORTER_OTLP_LOGS_TIMEOUT:1e4,OTEL_EXPORTER_ZIPKIN_ENDPOINT:"http://localhost:9411/api/v2/spans",OTEL_LOG_LEVEL:S.INFO,OTEL_NO_PATCH_MODULES:[],OTEL_PROPAGATORS:["tracecontext","baggage"],OTEL_RESOURCE_ATTRIBUTES:"",OTEL_SERVICE_NAME:"",OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT:ye,OTEL_ATTRIBUTE_COUNT_LIMIT:Ae,OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT:ye,OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT:Ae,OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT:ye,OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT:Ae,OTEL_SPAN_EVENT_COUNT_LIMIT:128,OTEL_SPAN_LINK_COUNT_LIMIT:128,OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT:zo,OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT:Jo,OTEL_TRACES_EXPORTER:"",OTEL_TRACES_SAMPLER:jt.ParentBasedAlwaysOn,OTEL_TRACES_SAMPLER_ARG:"",OTEL_LOGS_EXPORTER:"",OTEL_EXPORTER_OTLP_INSECURE:"",OTEL_EXPORTER_OTLP_TRACES_INSECURE:"",OTEL_EXPORTER_OTLP_METRICS_INSECURE:"",OTEL_EXPORTER_OTLP_LOGS_INSECURE:"",OTEL_EXPORTER_OTLP_CERTIFICATE:"",OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE:"",OTEL_EXPORTER_OTLP_METRICS_CERTIFICATE:"",OTEL_EXPORTER_OTLP_LOGS_CERTIFICATE:"",OTEL_EXPORTER_OTLP_COMPRESSION:"",OTEL_EXPORTER_OTLP_TRACES_COMPRESSION:"",OTEL_EXPORTER_OTLP_METRICS_COMPRESSION:"",OTEL_EXPORTER_OTLP_LOGS_COMPRESSION:"",OTEL_EXPORTER_OTLP_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_METRICS_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_LOGS_CLIENT_KEY:"",OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_METRICS_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_LOGS_CLIENT_CERTIFICATE:"",OTEL_EXPORTER_OTLP_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_TRACES_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_METRICS_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_LOGS_PROTOCOL:"http/protobuf",OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE:"cumulative",OTEL_SEMCONV_STABILITY_OPT_IN:[]};function Jc(e,t,r){if(!(typeof r[e]>"u")){var n=String(r[e]);t[e]=n.toLowerCase()==="true"}}function Zc(e,t,r,n,i){if(n===void 0&&(n=-1/0),i===void 0&&(i=1/0),typeof r[e]<"u"){var o=Number(r[e]);isNaN(o)||(o<n?t[e]=n:o>i?t[e]=i:t[e]=o)}}function qc(e,t,r,n){n===void 0&&(n=jc);var i=r[e];typeof i=="string"&&(t[e]=i.split(n).map(function(o){return o.trim()}))}var Qc={ALL:S.ALL,VERBOSE:S.VERBOSE,DEBUG:S.DEBUG,INFO:S.INFO,WARN:S.WARN,ERROR:S.ERROR,NONE:S.NONE};function eu(e,t,r){var n=r[e];if(typeof n=="string"){var i=Qc[n.toUpperCase()];i!=null&&(t[e]=i)}}function Kt(e){var t={};for(var r in $t){var n=r;switch(n){case"OTEL_LOG_LEVEL":eu(n,t,e);break;default:if(Kc(n))Jc(n,t,e);else if(Yc(n))Zc(n,t,e);else if(zc(n))qc(n,t,e);else{var i=e[n];typeof i<"u"&&i!==null&&(t[n]=String(i))}}}return t}function H(){var e=Kt(process.env);return Object.assign({},$t,e)}function Ze(){return Kt(process.env)}function Zo(e){return e>=48&&e<=57?e-48:e>=97&&e<=102?e-87:e-55}function qe(e){for(var t=new Uint8Array(e.length/2),r=0,n=0;n<e.length;n+=2){var i=Zo(e.charCodeAt(n)),o=Zo(e.charCodeAt(n+1));t[r++]=i<<4|o}return t}import{performance as tu}from"perf_hooks";var se=tu;var qo="1.30.1";var ru="process.runtime.name";var nu="service.name";var ou="telemetry.sdk.name",iu="telemetry.sdk.language",au="telemetry.sdk.version";var Qo=ru;var ei=nu;var Qe=ou,et=iu,tt=au;var su="nodejs";var ti=su;var Oe,ce=(Oe={},Oe[Qe]="opentelemetry",Oe[Qo]="node",Oe[et]=ti,Oe[tt]=qo,Oe);function ue(e){e.unref()}var fu=9,pu=6,_u=Math.pow(10,pu),mn=Math.pow(10,fu);function D(e){var t=e/1e3,r=Math.trunc(t),n=Math.round(e%1e3*_u);return[r,n]}function hn(){var e=se.timeOrigin;if(typeof e!="number"){var t=se;e=t.timing&&t.timing.fetchStart}return e}function ri(e){var t=D(hn()),r=D(typeof e=="number"?e:se.now());return oi(t,r)}function Wt(e){if(ni(e))return e;if(typeof e=="number")return e<hn()?ri(e):D(e);if(e instanceof Date)return D(e.getTime());throw TypeError("Invalid input type")}function En(e){return e[0]*mn+e[1]}function Z(e){return e[0]*1e6+e[1]/1e3}function ni(e){return Array.isArray(e)&&e.length===2&&typeof e[0]=="number"&&typeof e[1]=="number"}function oi(e,t){var r=[e[0]+t[0],e[1]+t[1]];return r[1]>=mn&&(r[1]-=mn,r[0]+=1),r}var x;(function(e){e[e.SUCCESS=0]="SUCCESS",e[e.FAILED=1]="FAILED"})(x||(x={}));var du="[object Object]",mu="[object Null]",hu="[object Undefined]",Eu=Function.prototype,ii=Eu.toString,gu=ii.call(Object),vu=Tu(Object.getPrototypeOf,Object),ai=Object.prototype,si=ai.hasOwnProperty,le=Symbol?Symbol.toStringTag:void 0,ci=ai.toString;function Tu(e,t){return function(r){return e(t(r))}}function gn(e){if(!Su(e)||yu(e)!==du)return!1;var t=vu(e);if(t===null)return!0;var r=si.call(t,"constructor")&&t.constructor;return typeof r=="function"&&r instanceof r&&ii.call(r)===gu}function Su(e){return e!=null&&typeof e=="object"}function yu(e){return e==null?e===void 0?hu:mu:le&&le in Object(e)?Au(e):Ou(e)}function Au(e){var t=si.call(e,le),r=e[le],n=!1;try{e[le]=void 0,n=!0}catch{}var i=ci.call(e);return n&&(t?e[le]=r:delete e[le]),i}function Ou(e){return ci.call(e)}var Ru=20;function Tn(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var r=e.shift(),n=new WeakMap;e.length>0;)r=li(r,e.shift(),0,n);return r}function vn(e){return Xt(e)?e.slice():e}function li(e,t,r,n){r===void 0&&(r=0);var i;if(!(r>Ru)){if(r++,Yt(e)||Yt(t)||fi(t))i=vn(t);else if(Xt(e)){if(i=e.slice(),Xt(t))for(var o=0,s=t.length;o<s;o++)i.push(vn(t[o]));else if(rt(t))for(var c=Object.keys(t),o=0,s=c.length;o<s;o++){var l=c[o];i[l]=vn(t[l])}}else if(rt(e))if(rt(t)){if(!xu(e,t))return t;i=Object.assign({},e);for(var c=Object.keys(t),o=0,s=c.length;o<s;o++){var l=c[o],a=t[l];if(Yt(a))typeof a>"u"?delete i[l]:i[l]=a;else{var u=i[l],f=a;if(ui(e,l,n)||ui(t,l,n))delete i[l];else{if(rt(u)&&rt(f)){var d=n.get(u)||[],T=n.get(f)||[];d.push({obj:e,key:l}),T.push({obj:t,key:l}),n.set(u,d),n.set(f,T)}i[l]=li(i[l],a,r,n)}}}}else i=t;return i}}function ui(e,t,r){for(var n=r.get(e[t])||[],i=0,o=n.length;i<o;i++){var s=n[i];if(s.key===t&&s.obj===e)return!0}return!1}function Xt(e){return Array.isArray(e)}function fi(e){return typeof e=="function"}function rt(e){return!Yt(e)&&!Xt(e)&&!fi(e)&&typeof e=="object"}function Yt(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"||typeof e>"u"||e instanceof Date||e instanceof RegExp||e===null}function xu(e,t){return!(!gn(e)||!gn(t))}var Lu=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),pi=(function(e){Lu(t,e);function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return t})(Error);function nt(e,t){var r,n=new Promise(function(o,s){r=setTimeout(function(){s(new pi("Operation timed out."))},t)});return Promise.race([e,n]).then(function(i){return clearTimeout(r),i},function(i){throw clearTimeout(r),i})}var _i=(function(){function e(){var t=this;this._promise=new Promise(function(r,n){t._resolve=r,t._reject=n})}return Object.defineProperty(e.prototype,"promise",{get:function(){return this._promise},enumerable:!1,configurable:!0}),e.prototype.resolve=function(t){this._resolve(t)},e.prototype.reject=function(t){this._reject(t)},e})();var wu=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},bu=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},ot=(function(){function e(t,r){this._callback=t,this._that=r,this._isCalled=!1,this._deferred=new _i}return Object.defineProperty(e.prototype,"isCalled",{get:function(){return this._isCalled},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"promise",{get:function(){return this._deferred.promise},enumerable:!1,configurable:!0}),e.prototype.call=function(){for(var t,r=this,n=[],i=0;i<arguments.length;i++)n[i]=arguments[i];if(!this._isCalled){this._isCalled=!0;try{Promise.resolve((t=this._callback).call.apply(t,bu([this._that],wu(n),!1))).then(function(o){return r._deferred.resolve(o)},function(o){return r._deferred.reject(o)})}catch(o){this._deferred.reject(o)}}return this._deferred.promise},e})();g();function di(e,t){return new Promise(function(r){N.with(Ho(N.active()),function(){e.export(t,function(n){r(n)})})})}var it={getKeyPairs:Ko,serializeKeyPairs:$o,parseKeyPairsIntoRecord:Wo,parsePairKeyValue:dn},zt={_export:di};Fr();g();function Pu(e){return Object.prototype.hasOwnProperty.call(e,"partialSuccess")}function mi(){return{handleResponse:function(e){e==null||!Pu(e)||e.partialSuccess==null||Object.keys(e.partialSuccess).length===0||p.warn("Received Partial Success response:",JSON.stringify(e.partialSuccess))}}}g();var Mu=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{a(n.next(u))}catch(f){s(f)}}function l(u){try{a(n.throw(u))}catch(f){s(f)}}function a(u){u.done?o(u.value):i(u.value).then(c,l)}a((n=n.apply(e,t||[])).next())})},Iu=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Nu=(function(){function e(t,r,n,i,o){this._transport=t,this._serializer=r,this._responseHandler=n,this._promiseQueue=i,this._timeout=o,this._diagLogger=p.createComponentLogger({namespace:"OTLPExportDelegate"})}return e.prototype.export=function(t,r){var n=this;if(this._diagLogger.debug("items to be sent",t),this._promiseQueue.hasReachedLimit()){r({code:x.FAILED,error:new Error("Concurrent export limit reached")});return}var i=this._serializer.serializeRequest(t);if(i==null){r({code:x.FAILED,error:new Error("Nothing to send")});return}this._promiseQueue.pushPromise(this._transport.send(i,this._timeout).then(function(o){if(o.status==="success"){if(o.data!=null)try{n._responseHandler.handleResponse(n._serializer.deserializeResponse(o.data))}catch(s){n._diagLogger.warn("Export succeeded but could not deserialize response - is the response specification compliant?",s,o.data)}r({code:x.SUCCESS});return}else if(o.status==="failure"&&o.error){r({code:x.FAILED,error:o.error});return}else o.status==="retryable"?r({code:x.FAILED,error:new Ve("Export failed with retryable status")}):r({code:x.FAILED,error:new Ve("Export failed with unknown error")})},function(o){return r({code:x.FAILED,error:o})}))},e.prototype.forceFlush=function(){return this._promiseQueue.awaitAll()},e.prototype.shutdown=function(){return Mu(this,void 0,void 0,function(){return Iu(this,function(t){switch(t.label){case 0:return this._diagLogger.debug("shutdown started"),[4,this.forceFlush()];case 1:return t.sent(),this._transport.shutdown(),[2]}})})},e})();function hi(e,t){return new Nu(e.transport,e.serializer,mi(),e.promiseHandler,t.timeout)}function gi(e){var t=BigInt(1e9);return BigInt(e[0])*t+BigInt(e[1])}function Cu(e){var t=Number(BigInt.asUintN(32,e)),r=Number(BigInt.asUintN(32,e>>BigInt(32)));return{low:t,high:r}}function vi(e){var t=gi(e);return Cu(t)}function Uu(e){var t=gi(e);return t.toString()}var Du=typeof BigInt<"u"?Uu:En;function Ei(e){return e}function Ti(e){if(e!==void 0)return qe(e)}var Bu={encodeHrTime:vi,encodeSpanContext:qe,encodeOptionalSpanContext:Ti};function Jt(e){var t,r;if(e===void 0)return Bu;var n=(t=e.useLongBits)!==null&&t!==void 0?t:!0,i=(r=e.useHex)!==null&&r!==void 0?r:!1;return{encodeHrTime:n?vi:Du,encodeSpanContext:i?Ei:qe,encodeOptionalSpanContext:i?Ei:Ti}}var Gu=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function Zt(e){return{attributes:at(e.attributes),droppedAttributesCount:0}}function qt(e){return{name:e.name,version:e.version}}function at(e){return Object.keys(e).map(function(t){return Qt(t,e[t])})}function Qt(e,t){return{key:e,value:er(t)}}function er(e){var t=typeof e;return t==="string"?{stringValue:e}:t==="number"?Number.isInteger(e)?{intValue:e}:{doubleValue:e}:t==="boolean"?{boolValue:e}:e instanceof Uint8Array?{bytesValue:e}:Array.isArray(e)?{arrayValue:{values:e.map(er)}}:t==="object"&&e!=null?{kvlistValue:{values:Object.entries(e).map(function(r){var n=Gu(r,2),i=n[0],o=n[1];return Qt(i,o)})}}:{}}var Vu=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Si=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function yi(e,t){var r=Jt(t);return{resourceLogs:Hu(e,r)}}function ku(e){var t,r,n=new Map;try{for(var i=Vu(e),o=i.next();!o.done;o=i.next()){var s=o.value,c=s.resource,l=s.instrumentationScope,a=l.name,u=l.version,f=u===void 0?"":u,d=l.schemaUrl,T=d===void 0?"":d,b=n.get(c);b||(b=new Map,n.set(c,b));var ne=a+"@"+f+":"+T,he=b.get(ne);he||(he=[],b.set(ne,he)),he.push(s)}}catch(yt){t={error:yt}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return n}function Hu(e,t){var r=ku(e);return Array.from(r,function(n){var i=Si(n,2),o=i[0],s=i[1];return{resource:Zt(o),scopeLogs:Array.from(s,function(c){var l=Si(c,2),a=l[1];return{scope:qt(a[0].instrumentationScope),logRecords:a.map(function(u){return Fu(u,t)}),schemaUrl:a[0].instrumentationScope.schemaUrl}}),schemaUrl:void 0}})}function Fu(e,t){var r,n,i;return{timeUnixNano:t.encodeHrTime(e.hrTime),observedTimeUnixNano:t.encodeHrTime(e.hrTimeObserved),severityNumber:e.severityNumber,severityText:e.severityText,body:er(e.body),attributes:ju(e.attributes),droppedAttributesCount:e.droppedAttributesCount,flags:(r=e.spanContext)===null||r===void 0?void 0:r.traceFlags,traceId:t.encodeOptionalSpanContext((n=e.spanContext)===null||n===void 0?void 0:n.traceId),spanId:t.encodeOptionalSpanContext((i=e.spanContext)===null||i===void 0?void 0:i.spanId)}}function ju(e){return Object.keys(e).map(function(t){return Qt(t,e[t])})}g();var R;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE"})(R||(R={}));var w;(function(e){e[e.HISTOGRAM=0]="HISTOGRAM",e[e.EXPONENTIAL_HISTOGRAM=1]="EXPONENTIAL_HISTOGRAM",e[e.GAUGE=2]="GAUGE",e[e.SUM=3]="SUM"})(w||(w={}));g();var $u=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Ai=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{a(n.next(u))}catch(f){s(f)}}function l(u){try{a(n.throw(u))}catch(f){s(f)}}function a(u){u.done?o(u.value):i(u.value).then(c,l)}a((n=n.apply(e,t||[])).next())})},Oi=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Ku=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Wu=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},Yu=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Ri(e){return e!=null}function tr(e){var t=Object.keys(e);return t.length===0?"":(t=t.sort(),JSON.stringify(t.map(function(r){return[r,e[r]]})))}function xi(e){var t,r;return e.name+":"+((t=e.version)!==null&&t!==void 0?t:"")+":"+((r=e.schemaUrl)!==null&&r!==void 0?r:"")}var Sn=(function(e){$u(t,e);function t(r){var n=e.call(this,r)||this;return Object.setPrototypeOf(n,t.prototype),n}return t})(Error);function q(e,t){var r,n=new Promise(function(o,s){r=setTimeout(function(){s(new Sn("Operation timed out."))},t)});return Promise.race([e,n]).then(function(i){return clearTimeout(r),i},function(i){throw clearTimeout(r),i})}function Li(e){return Ai(this,void 0,void 0,function(){var t=this;return Oi(this,function(r){return[2,Promise.all(e.map(function(n){return Ai(t,void 0,void 0,function(){var i,o;return Oi(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,n];case 1:return i=s.sent(),[2,{status:"fulfilled",value:i}];case 2:return o=s.sent(),[2,{status:"rejected",reason:o}];case 3:return[2]}})})}))]})})}function wi(e){return e.status==="rejected"}function yn(e,t){var r=[];return e.forEach(function(n){r.push.apply(r,Wu([],Ku(t(n)),!1))}),r}function bi(e,t){var r,n;if(e.size!==t.size)return!1;try{for(var i=Yu(e),o=i.next();!o.done;o=i.next()){var s=o.value;if(!t.has(s))return!1}}catch(c){r={error:c}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return!0}function Pi(e,t){for(var r=0,n=e.length-1,i=e.length;n>=r;){var o=r+Math.trunc((n-r)/2);e[o]<t?r=o+1:(i=o,n=o-1)}return i}function Mi(e,t){return e.toLowerCase()===t.toLowerCase()}g();var C;(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"})(C||(C={}));var An=(function(){function e(){this.kind=C.DROP}return e.prototype.createAccumulation=function(){},e.prototype.merge=function(t,r){},e.prototype.diff=function(t,r){},e.prototype.toMetricData=function(t,r,n,i){},e})();g();var _;(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"})(_||(_={}));function F(e,t,r){var n,i,o,s;return zu(e)||p.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=r?.description)!==null&&n!==void 0?n:"",unit:(i=r?.unit)!==null&&i!==void 0?i:"",valueType:(o=r?.valueType)!==null&&o!==void 0?o:L.DOUBLE,advice:(s=r?.advice)!==null&&s!==void 0?s:{}}}function Ii(e,t){var r,n;return{name:(r=e.name)!==null&&r!==void 0?r:t.name,description:(n=e.description)!==null&&n!==void 0?n:t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function Ni(e,t){return Mi(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var Xu=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function zu(e){return e.match(Xu)!=null}var Ju=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function Zu(e){var t=e.map(function(){return 0});return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var rr=(function(){function e(t,r,n,i){n===void 0&&(n=!0),i===void 0&&(i=Zu(r)),this.startTime=t,this._boundaries=r,this._recordMinMax=n,this._current=i}return e.prototype.record=function(t){if(!Number.isNaN(t)){this._current.count+=1,this._current.sum+=t,this._recordMinMax&&(this._current.min=Math.min(t,this._current.min),this._current.max=Math.max(t,this._current.max),this._current.hasMinMax=!0);var r=Pi(this._boundaries,t);this._current.buckets.counts[r]+=1}},e.prototype.setStartTime=function(t){this.startTime=t},e.prototype.toPointValue=function(){return this._current},e})();var nr=(function(){function e(t,r){this._boundaries=t,this._recordMinMax=r,this.kind=C.HISTOGRAM}return e.prototype.createAccumulation=function(t){return new rr(t,this._boundaries,this._recordMinMax)},e.prototype.merge=function(t,r){for(var n=t.toPointValue(),i=r.toPointValue(),o=n.buckets.counts,s=i.buckets.counts,c=new Array(o.length),l=0;l<o.length;l++)c[l]=o[l]+s[l];var a=1/0,u=-1/0;return this._recordMinMax&&(n.hasMinMax&&i.hasMinMax?(a=Math.min(n.min,i.min),u=Math.max(n.max,i.max)):n.hasMinMax?(a=n.min,u=n.max):i.hasMinMax&&(a=i.min,u=i.max)),new rr(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:c},count:n.count+i.count,sum:n.sum+i.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||i.hasMinMax),min:a,max:u})},e.prototype.diff=function(t,r){for(var n=t.toPointValue(),i=r.toPointValue(),o=n.buckets.counts,s=i.buckets.counts,c=new Array(o.length),l=0;l<o.length;l++)c[l]=s[l]-o[l];return new rr(r.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:c},count:i.count-n.count,sum:i.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})},e.prototype.toMetricData=function(t,r,n,i){return{descriptor:t,aggregationTemporality:r,dataPointType:w.HISTOGRAM,dataPoints:n.map(function(o){var s=Ju(o,2),c=s[0],l=s[1],a=l.toPointValue(),u=t.type===_.GAUGE||t.type===_.UP_DOWN_COUNTER||t.type===_.OBSERVABLE_GAUGE||t.type===_.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:c,startTime:l.startTime,endTime:i,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:u?void 0:a.sum,buckets:a.buckets,count:a.count}}})}},e})();g();var On=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Rn=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},xn=(function(){function e(t,r,n,i){t===void 0&&(t=new qu),r===void 0&&(r=0),n===void 0&&(n=0),i===void 0&&(i=0),this.backing=t,this.indexBase=r,this.indexStart=n,this.indexEnd=i}return Object.defineProperty(e.prototype,"offset",{get:function(){return this.indexStart},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"length",{get:function(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1},enumerable:!1,configurable:!0}),e.prototype.counts=function(){var t=this;return Array.from({length:this.length},function(r,n){return t.at(n)})},e.prototype.at=function(t){var r=this.indexBase-this.indexStart;return t<r&&(t+=this.backing.length),t-=r,this.backing.countAt(t)},e.prototype.incrementBucket=function(t,r){this.backing.increment(t,r)},e.prototype.decrementBucket=function(t,r){this.backing.decrement(t,r)},e.prototype.trim=function(){for(var t=0;t<this.length;t++)if(this.at(t)!==0){this.indexStart+=t;break}else if(t===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(var t=this.length-1;t>=0;t--)if(this.at(t)!==0){this.indexEnd-=this.length-t-1;break}this._rotate()},e.prototype.downscale=function(t){this._rotate();for(var r=1+this.indexEnd-this.indexStart,n=1<<t,i=0,o=0,s=this.indexStart;s<=this.indexEnd;){var c=s%n;c<0&&(c+=n);for(var l=c;l<n&&i<r;l++)this._relocateBucket(o,i),i++,s++;o++}this.indexStart>>=t,this.indexEnd>>=t,this.indexBase=this.indexStart},e.prototype.clone=function(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)},e.prototype._rotate=function(){var t=this.indexBase-this.indexStart;t!==0&&(t>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,t),this.backing.reverse(t,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+t)),this.indexBase=this.indexStart)},e.prototype._relocateBucket=function(t,r){t!==r&&this.incrementBucket(t,this.backing.emptyBucket(r))},e})();var qu=(function(){function e(t){t===void 0&&(t=[0]),this._counts=t}return Object.defineProperty(e.prototype,"length",{get:function(){return this._counts.length},enumerable:!1,configurable:!0}),e.prototype.countAt=function(t){return this._counts[t]},e.prototype.growTo=function(t,r,n){var i=new Array(t).fill(0);i.splice.apply(i,Rn([n,this._counts.length-r],On(this._counts.slice(r)),!1)),i.splice.apply(i,Rn([0,r],On(this._counts.slice(0,r)),!1)),this._counts=i},e.prototype.reverse=function(t,r){for(var n=Math.floor((t+r)/2)-t,i=0;i<n;i++){var o=this._counts[t+i];this._counts[t+i]=this._counts[r-i-1],this._counts[r-i-1]=o}},e.prototype.emptyBucket=function(t){var r=this._counts[t];return this._counts[t]=0,r},e.prototype.increment=function(t,r){this._counts[t]+=r},e.prototype.decrement=function(t,r){this._counts[t]>=r?this._counts[t]-=r:this._counts[t]=0},e.prototype.clone=function(){return new e(Rn([],On(this._counts),!1))},e})();var Ci=52,Qu=2146435072,el=1048575,Ln=1023,or=-Ln+1,ir=Ln,st=Math.pow(2,-1022);function ar(e){var t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);var r=t.getUint32(0),n=(r&Qu)>>20;return n-Ln}function sr(e){var t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);var r=t.getUint32(0),n=t.getUint32(4),i=(r&el)*Math.pow(2,32);return i+n}function ct(e,t){return e===0||e===Number.POSITIVE_INFINITY||e===Number.NEGATIVE_INFINITY||Number.isNaN(e)?e:e*Math.pow(2,t)}function Di(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var tl=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Q=(function(e){tl(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(Error);var Gi=(function(){function e(t){this._shift=-t}return e.prototype.mapToIndex=function(t){if(t<st)return this._minNormalLowerBoundaryIndex();var r=ar(t),n=this._rightShift(sr(t)-1,Ci);return r+n>>this._shift},e.prototype.lowerBoundary=function(t){var r=this._minNormalLowerBoundaryIndex();if(t<r)throw new Q("underflow: "+t+" is < minimum lower boundary: "+r);var n=this._maxNormalLowerBoundaryIndex();if(t>n)throw new Q("overflow: "+t+" is > maximum lower boundary: "+n);return ct(1,t<<this._shift)},Object.defineProperty(e.prototype,"scale",{get:function(){return this._shift===0?0:-this._shift},enumerable:!1,configurable:!0}),e.prototype._minNormalLowerBoundaryIndex=function(){var t=or>>this._shift;return this._shift<2&&t--,t},e.prototype._maxNormalLowerBoundaryIndex=function(){return ir>>this._shift},e.prototype._rightShift=function(t,r){return Math.floor(t*Math.pow(2,-r))},e})();var Vi=(function(){function e(t){this._scale=t,this._scaleFactor=ct(Math.LOG2E,t),this._inverseFactor=ct(Math.LN2,-t)}return e.prototype.mapToIndex=function(t){if(t<=st)return this._minNormalLowerBoundaryIndex()-1;if(sr(t)===0){var r=ar(t);return(r<<this._scale)-1}var n=Math.floor(Math.log(t)*this._scaleFactor),i=this._maxNormalLowerBoundaryIndex();return n>=i?i:n},e.prototype.lowerBoundary=function(t){var r=this._maxNormalLowerBoundaryIndex();if(t>=r){if(t===r)return 2*Math.exp((t-(1<<this._scale))/this._scaleFactor);throw new Q("overflow: "+t+" is > maximum lower boundary: "+r)}var n=this._minNormalLowerBoundaryIndex();if(t<=n){if(t===n)return st;if(t===n-1)return Math.exp((t+(1<<this._scale))/this._scaleFactor)/2;throw new Q("overflow: "+t+" is < minimum lower boundary: "+n)}return Math.exp(t*this._inverseFactor)},Object.defineProperty(e.prototype,"scale",{get:function(){return this._scale},enumerable:!1,configurable:!0}),e.prototype._minNormalLowerBoundaryIndex=function(){return or<<this._scale},e.prototype._maxNormalLowerBoundaryIndex=function(){return(ir+1<<this._scale)-1},e})();var ki=-10,Hi=20,rl=Array.from({length:31},function(e,t){return t>10?new Vi(t-10):new Gi(t-10)});function wn(e){if(e>Hi||e<ki)throw new Q("expected scale >= "+ki+" && <= "+Hi+", got: "+e);return rl[e+10]}var nl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},cr=(function(){function e(t,r){this.low=t,this.high=r}return e.combine=function(t,r){return new e(Math.min(t.low,r.low),Math.max(t.high,r.high))},e})(),ol=20,il=160,bn=2,Fi=(function(){function e(t,r,n,i,o,s,c,l,a,u,f){t===void 0&&(t=t),r===void 0&&(r=il),n===void 0&&(n=!0),i===void 0&&(i=0),o===void 0&&(o=0),s===void 0&&(s=0),c===void 0&&(c=Number.POSITIVE_INFINITY),l===void 0&&(l=Number.NEGATIVE_INFINITY),a===void 0&&(a=new xn),u===void 0&&(u=new xn),f===void 0&&(f=wn(ol)),this.startTime=t,this._maxSize=r,this._recordMinMax=n,this._sum=i,this._count=o,this._zeroCount=s,this._min=c,this._max=l,this._positive=a,this._negative=u,this._mapping=f,this._maxSize<bn&&(p.warn("Exponential Histogram Max Size set to "+this._maxSize+", changing to the minimum size of: "+bn),this._maxSize=bn)}return e.prototype.record=function(t){this.updateByIncrement(t,1)},e.prototype.setStartTime=function(t){this.startTime=t},e.prototype.toPointValue=function(){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}},Object.defineProperty(e.prototype,"sum",{get:function(){return this._sum},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"min",{get:function(){return this._min},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this._max},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"count",{get:function(){return this._count},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"zeroCount",{get:function(){return this._zeroCount},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"scale",{get:function(){return this._count===this._zeroCount?0:this._mapping.scale},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"positive",{get:function(){return this._positive},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"negative",{get:function(){return this._negative},enumerable:!1,configurable:!0}),e.prototype.updateByIncrement=function(t,r){if(!Number.isNaN(t)){if(t>this._max&&(this._max=t),t<this._min&&(this._min=t),this._count+=r,t===0){this._zeroCount+=r;return}this._sum+=t*r,t>0?this._updateBuckets(this._positive,t,r):this._updateBuckets(this._negative,-t,r)}},e.prototype.merge=function(t){this._count===0?(this._min=t.min,this._max=t.max):t.count!==0&&(t.min<this.min&&(this._min=t.min),t.max>this.max&&(this._max=t.max)),this.startTime=t.startTime,this._sum+=t.sum,this._count+=t.count,this._zeroCount+=t.zeroCount;var r=this._minScale(t);this._downscale(this.scale-r),this._mergeBuckets(this.positive,t,t.positive,r),this._mergeBuckets(this.negative,t,t.negative,r)},e.prototype.diff=function(t){this._min=1/0,this._max=-1/0,this._sum-=t.sum,this._count-=t.count,this._zeroCount-=t.zeroCount;var r=this._minScale(t);this._downscale(this.scale-r),this._diffBuckets(this.positive,t,t.positive,r),this._diffBuckets(this.negative,t,t.negative,r)},e.prototype.clone=function(){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)},e.prototype._updateBuckets=function(t,r,n){var i=this._mapping.mapToIndex(r),o=!1,s=0,c=0;if(t.length===0?(t.indexStart=i,t.indexEnd=t.indexStart,t.indexBase=t.indexStart):i<t.indexStart&&t.indexEnd-i>=this._maxSize?(o=!0,c=i,s=t.indexEnd):i>t.indexEnd&&i-t.indexStart>=this._maxSize&&(o=!0,c=t.indexStart,s=i),o){var l=this._changeScale(s,c);this._downscale(l),i=this._mapping.mapToIndex(r)}this._incrementIndexBy(t,i,n)},e.prototype._incrementIndexBy=function(t,r,n){if(n!==0){if(t.length===0&&(t.indexStart=t.indexEnd=t.indexBase=r),r<t.indexStart){var i=t.indexEnd-r;i>=t.backing.length&&this._grow(t,i+1),t.indexStart=r}else if(r>t.indexEnd){var i=r-t.indexStart;i>=t.backing.length&&this._grow(t,i+1),t.indexEnd=r}var o=r-t.indexBase;o<0&&(o+=t.backing.length),t.incrementBucket(o,n)}},e.prototype._grow=function(t,r){var n=t.backing.length,i=t.indexBase-t.indexStart,o=n-i,s=Di(r);s>this._maxSize&&(s=this._maxSize);var c=s-i;t.backing.growTo(s,o,c)},e.prototype._changeScale=function(t,r){for(var n=0;t-r>=this._maxSize;)t>>=1,r>>=1,n++;return n},e.prototype._downscale=function(t){if(t!==0){if(t<0)throw new Error("impossible change of scale: "+this.scale);var r=this._mapping.scale-t;this._positive.downscale(t),this._negative.downscale(t),this._mapping=wn(r)}},e.prototype._minScale=function(t){var r=Math.min(this.scale,t.scale),n=cr.combine(this._highLowAtScale(this.positive,this.scale,r),this._highLowAtScale(t.positive,t.scale,r)),i=cr.combine(this._highLowAtScale(this.negative,this.scale,r),this._highLowAtScale(t.negative,t.scale,r));return Math.min(r-this._changeScale(n.high,n.low),r-this._changeScale(i.high,i.low))},e.prototype._highLowAtScale=function(t,r,n){if(t.length===0)return new cr(0,-1);var i=r-n;return new cr(t.indexStart>>i,t.indexEnd>>i)},e.prototype._mergeBuckets=function(t,r,n,i){for(var o=n.offset,s=r.scale-i,c=0;c<n.length;c++)this._incrementIndexBy(t,o+c>>s,n.at(c))},e.prototype._diffBuckets=function(t,r,n,i){for(var o=n.offset,s=r.scale-i,c=0;c<n.length;c++){var l=o+c>>s,a=l-t.indexBase;a<0&&(a+=t.backing.length),t.decrementBucket(a,n.at(c))}t.trim()},e})();var Pn=(function(){function e(t,r){this._maxSize=t,this._recordMinMax=r,this.kind=C.EXPONENTIAL_HISTOGRAM}return e.prototype.createAccumulation=function(t){return new Fi(t,this._maxSize,this._recordMinMax)},e.prototype.merge=function(t,r){var n=r.clone();return n.merge(t),n},e.prototype.diff=function(t,r){var n=r.clone();return n.diff(t),n},e.prototype.toMetricData=function(t,r,n,i){return{descriptor:t,aggregationTemporality:r,dataPointType:w.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(function(o){var s=nl(o,2),c=s[0],l=s[1],a=l.toPointValue(),u=t.type===_.GAUGE||t.type===_.UP_DOWN_COUNTER||t.type===_.OBSERVABLE_GAUGE||t.type===_.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:c,startTime:l.startTime,endTime:i,value:{min:a.hasMinMax?a.min:void 0,max:a.hasMinMax?a.max:void 0,sum:u?void 0:a.sum,positive:{offset:a.positive.offset,bucketCounts:a.positive.bucketCounts},negative:{offset:a.negative.offset,bucketCounts:a.negative.bucketCounts},count:a.count,scale:a.scale,zeroCount:a.zeroCount}}})}},e})();var al=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},ur=(function(){function e(t,r,n){r===void 0&&(r=0),n===void 0&&(n=[0,0]),this.startTime=t,this._current=r,this.sampleTime=n}return e.prototype.record=function(t){this._current=t,this.sampleTime=D(Date.now())},e.prototype.setStartTime=function(t){this.startTime=t},e.prototype.toPointValue=function(){return this._current},e})();var Mn=(function(){function e(){this.kind=C.LAST_VALUE}return e.prototype.createAccumulation=function(t){return new ur(t)},e.prototype.merge=function(t,r){var n=Z(r.sampleTime)>=Z(t.sampleTime)?r:t;return new ur(t.startTime,n.toPointValue(),n.sampleTime)},e.prototype.diff=function(t,r){var n=Z(r.sampleTime)>=Z(t.sampleTime)?r:t;return new ur(r.startTime,n.toPointValue(),n.sampleTime)},e.prototype.toMetricData=function(t,r,n,i){return{descriptor:t,aggregationTemporality:r,dataPointType:w.GAUGE,dataPoints:n.map(function(o){var s=al(o,2),c=s[0],l=s[1];return{attributes:c,startTime:l.startTime,endTime:i,value:l.toPointValue()}})}},e})();var sl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Re=(function(){function e(t,r,n,i){n===void 0&&(n=0),i===void 0&&(i=!1),this.startTime=t,this.monotonic=r,this._current=n,this.reset=i}return e.prototype.record=function(t){this.monotonic&&t<0||(this._current+=t)},e.prototype.setStartTime=function(t){this.startTime=t},e.prototype.toPointValue=function(){return this._current},e})();var lr=(function(){function e(t){this.monotonic=t,this.kind=C.SUM}return e.prototype.createAccumulation=function(t){return new Re(t,this.monotonic)},e.prototype.merge=function(t,r){var n=t.toPointValue(),i=r.toPointValue();return r.reset?new Re(r.startTime,this.monotonic,i,r.reset):new Re(t.startTime,this.monotonic,n+i)},e.prototype.diff=function(t,r){var n=t.toPointValue(),i=r.toPointValue();return this.monotonic&&n>i?new Re(r.startTime,this.monotonic,i,!0):new Re(r.startTime,this.monotonic,i-n)},e.prototype.toMetricData=function(t,r,n,i){return{descriptor:t,aggregationTemporality:r,dataPointType:w.SUM,dataPoints:n.map(function(o){var s=sl(o,2),c=s[0],l=s[1];return{attributes:c,startTime:l.startTime,endTime:i,value:l.toPointValue()}}),isMonotonic:this.monotonic}},e})();var fe=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),P=(function(){function e(){}return e.Drop=function(){return zi},e.Sum=function(){return Ji},e.LastValue=function(){return Zi},e.Histogram=function(){return qi},e.ExponentialHistogram=function(){return cl},e.Default=function(){return ul},e})();var ji=(function(e){fe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.createAggregator=function(r){return t.DEFAULT_INSTANCE},t.DEFAULT_INSTANCE=new An,t})(P);var ut=(function(e){fe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.createAggregator=function(r){switch(r.type){case _.COUNTER:case _.OBSERVABLE_COUNTER:case _.HISTOGRAM:return t.MONOTONIC_INSTANCE;default:return t.NON_MONOTONIC_INSTANCE}},t.MONOTONIC_INSTANCE=new lr(!0),t.NON_MONOTONIC_INSTANCE=new lr(!1),t})(P);var $i=(function(e){fe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.createAggregator=function(r){return t.DEFAULT_INSTANCE},t.DEFAULT_INSTANCE=new Mn,t})(P);var Ki=(function(e){fe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.createAggregator=function(r){return t.DEFAULT_INSTANCE},t.DEFAULT_INSTANCE=new nr([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0),t})(P);var Wi=(function(e){fe(t,e);function t(r,n){n===void 0&&(n=!0);var i=e.call(this)||this;if(i._recordMinMax=n,r==null)throw new Error("ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array");r=r.concat(),r=r.sort(function(c,l){return c-l});var o=r.lastIndexOf(-1/0),s=r.indexOf(1/0);return s===-1&&(s=void 0),i._boundaries=r.slice(o+1,s),i}return t.prototype.createAggregator=function(r){return new nr(this._boundaries,this._recordMinMax)},t})(P);var Yi=(function(e){fe(t,e);function t(r,n){r===void 0&&(r=160),n===void 0&&(n=!0);var i=e.call(this)||this;return i._maxSize=r,i._recordMinMax=n,i}return t.prototype.createAggregator=function(r){return new Pn(this._maxSize,this._recordMinMax)},t})(P);var Xi=(function(e){fe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype._resolve=function(r){switch(r.type){case _.COUNTER:case _.UP_DOWN_COUNTER:case _.OBSERVABLE_COUNTER:case _.OBSERVABLE_UP_DOWN_COUNTER:return Ji;case _.GAUGE:case _.OBSERVABLE_GAUGE:return Zi;case _.HISTOGRAM:return r.advice.explicitBucketBoundaries?new Wi(r.advice.explicitBucketBoundaries):qi}return p.warn("Unable to recognize instrument type: "+r.type),zi},t.prototype.createAggregator=function(r){return this._resolve(r).createAggregator(r)},t})(P);var zi=new ji,Ji=new ut,Zi=new $i,qi=new Ki,cl=new Yi,ul=new Xi;var Qi=function(e){return P.Default()},ea=function(e){return R.CUMULATIVE};var In=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{a(n.next(u))}catch(f){s(f)}}function l(u){try{a(n.throw(u))}catch(f){s(f)}}function a(u){u.done?o(u.value):i(u.value).then(c,l)}a((n=n.apply(e,t||[])).next())})},Nn=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},ta=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},ll=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},ra=(function(){function e(t){var r,n,i;this._shutdown=!1,this._aggregationSelector=(r=t?.aggregationSelector)!==null&&r!==void 0?r:Qi,this._aggregationTemporalitySelector=(n=t?.aggregationTemporalitySelector)!==null&&n!==void 0?n:ea,this._metricProducers=(i=t?.metricProducers)!==null&&i!==void 0?i:[],this._cardinalitySelector=t?.cardinalitySelector}return e.prototype.setMetricProducer=function(t){if(this._sdkMetricProducer)throw new Error("MetricReader can not be bound to a MeterProvider again.");this._sdkMetricProducer=t,this.onInitialized()},e.prototype.selectAggregation=function(t){return this._aggregationSelector(t)},e.prototype.selectAggregationTemporality=function(t){return this._aggregationTemporalitySelector(t)},e.prototype.selectCardinalityLimit=function(t){return this._cardinalitySelector?this._cardinalitySelector(t):2e3},e.prototype.onInitialized=function(){},e.prototype.collect=function(t){return In(this,void 0,void 0,function(){var r,n,i,o,s,c;return Nn(this,function(l){switch(l.label){case 0:if(this._sdkMetricProducer===void 0)throw new Error("MetricReader is not bound to a MetricProducer");if(this._shutdown)throw new Error("MetricReader is shutdown");return[4,Promise.all(ll([this._sdkMetricProducer.collect({timeoutMillis:t?.timeoutMillis})],ta(this._metricProducers.map(function(a){return a.collect({timeoutMillis:t?.timeoutMillis})})),!1))];case 1:return r=ta.apply(void 0,[l.sent()]),n=r[0],i=r.slice(1),o=n.errors.concat(yn(i,function(a){return a.errors})),s=n.resourceMetrics.resource,c=n.resourceMetrics.scopeMetrics.concat(yn(i,function(a){return a.resourceMetrics.scopeMetrics})),[2,{resourceMetrics:{resource:s,scopeMetrics:c},errors:o}]}})})},e.prototype.shutdown=function(t){return In(this,void 0,void 0,function(){return Nn(this,function(r){switch(r.label){case 0:return this._shutdown?(p.error("Cannot call shutdown twice."),[2]):t?.timeoutMillis!=null?[3,2]:[4,this.onShutdown()];case 1:return r.sent(),[3,4];case 2:return[4,q(this.onShutdown(),t.timeoutMillis)];case 3:r.sent(),r.label=4;case 4:return this._shutdown=!0,[2]}})})},e.prototype.forceFlush=function(t){return In(this,void 0,void 0,function(){return Nn(this,function(r){switch(r.label){case 0:return this._shutdown?(p.warn("Cannot forceFlush on already shutdown MetricReader."),[2]):t?.timeoutMillis!=null?[3,2]:[4,this.onForceFlush()];case 1:return r.sent(),[2];case 2:return[4,q(this.onForceFlush(),t.timeoutMillis)];case 3:return r.sent(),[2]}})})},e})();g();var fl=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),fr=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{a(n.next(u))}catch(f){s(f)}}function l(u){try{a(n.throw(u))}catch(f){s(f)}}function a(u){u.done?o(u.value):i(u.value).then(c,l)}a((n=n.apply(e,t||[])).next())})},pr=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},pl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},_l=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},Cn=(function(e){fl(t,e);function t(r){var n,i,o,s,c=e.call(this,{aggregationSelector:(n=r.exporter.selectAggregation)===null||n===void 0?void 0:n.bind(r.exporter),aggregationTemporalitySelector:(i=r.exporter.selectAggregationTemporality)===null||i===void 0?void 0:i.bind(r.exporter),metricProducers:r.metricProducers})||this;if(r.exportIntervalMillis!==void 0&&r.exportIntervalMillis<=0)throw Error("exportIntervalMillis must be greater than 0");if(r.exportTimeoutMillis!==void 0&&r.exportTimeoutMillis<=0)throw Error("exportTimeoutMillis must be greater than 0");if(r.exportTimeoutMillis!==void 0&&r.exportIntervalMillis!==void 0&&r.exportIntervalMillis<r.exportTimeoutMillis)throw Error("exportIntervalMillis must be greater than or equal to exportTimeoutMillis");return c._exportInterval=(o=r.exportIntervalMillis)!==null&&o!==void 0?o:6e4,c._exportTimeout=(s=r.exportTimeoutMillis)!==null&&s!==void 0?s:3e4,c._exporter=r.exporter,c}return t.prototype._runOnce=function(){return fr(this,void 0,void 0,function(){var r;return pr(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,q(this._doRun(),this._exportTimeout)];case 1:return n.sent(),[3,3];case 2:return r=n.sent(),r instanceof Sn?(p.error("Export took longer than %s milliseconds and timed out.",this._exportTimeout),[2]):(W(r),[3,3]);case 3:return[2]}})})},t.prototype._doRun=function(){var r,n;return fr(this,void 0,void 0,function(){var i,o,s,c,l,a;return pr(this,function(u){switch(u.label){case 0:return[4,this.collect({timeoutMillis:this._exportTimeout})];case 1:if(i=u.sent(),o=i.resourceMetrics,s=i.errors,s.length>0&&(a=p).error.apply(a,_l(["PeriodicExportingMetricReader: metrics collection errors"],pl(s),!1)),!o.resource.asyncAttributesPending)return[3,5];u.label=2;case 2:return u.trys.push([2,4,,5]),[4,(n=(r=o.resource).waitForAsyncAttributes)===null||n===void 0?void 0:n.call(r)];case 3:return u.sent(),[3,5];case 4:return c=u.sent(),p.debug("Error while resolving async portion of resource: ",c),W(c),[3,5];case 5:return o.scopeMetrics.length===0?[2]:[4,zt._export(this._exporter,o)];case 6:if(l=u.sent(),l.code!==x.SUCCESS)throw new Error("PeriodicExportingMetricReader: metrics export failed (error "+l.error+")");return[2]}})})},t.prototype.onInitialized=function(){var r=this;this._interval=setInterval(function(){r._runOnce()},this._exportInterval),ue(this._interval)},t.prototype.onForceFlush=function(){return fr(this,void 0,void 0,function(){return pr(this,function(r){switch(r.label){case 0:return[4,this._runOnce()];case 1:return r.sent(),[4,this._exporter.forceFlush()];case 2:return r.sent(),[2]}})})},t.prototype.onShutdown=function(){return fr(this,void 0,void 0,function(){return pr(this,function(r){switch(r.label){case 0:return this._interval&&clearInterval(this._interval),[4,this.onForceFlush()];case 1:return r.sent(),[4,this._exporter.shutdown()];case 2:return r.sent(),[2]}})})},t})(ra);g();g();function _r(){return"unknown_service:"+process.argv0}var ee=function(){return ee=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},ee.apply(this,arguments)},dl=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{a(n.next(u))}catch(f){s(f)}}function l(u){try{a(n.throw(u))}catch(f){s(f)}}function a(u){u.done?o(u.value):i(u.value).then(c,l)}a((n=n.apply(e,t||[])).next())})},ml=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},hl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},B=(function(){function e(t,r){var n=this,i;this._attributes=t,this.asyncAttributesPending=r!=null,this._syncAttributes=(i=this._attributes)!==null&&i!==void 0?i:{},this._asyncAttributesPromise=r?.then(function(o){return n._attributes=Object.assign({},n._attributes,o),n.asyncAttributesPending=!1,o},function(o){return p.debug("a resource's async attributes promise rejected: %s",o),n.asyncAttributesPending=!1,{}})}return e.empty=function(){return e.EMPTY},e.default=function(){var t;return new e((t={},t[ei]=_r(),t[et]=ce[et],t[Qe]=ce[Qe],t[tt]=ce[tt],t))},Object.defineProperty(e.prototype,"attributes",{get:function(){var t;return this.asyncAttributesPending&&p.error("Accessing resource attributes before async attributes settled"),(t=this._attributes)!==null&&t!==void 0?t:{}},enumerable:!1,configurable:!0}),e.prototype.waitForAsyncAttributes=function(){return dl(this,void 0,void 0,function(){return ml(this,function(t){switch(t.label){case 0:return this.asyncAttributesPending?[4,this._asyncAttributesPromise]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})},e.prototype.merge=function(t){var r=this,n;if(!t)return this;var i=ee(ee({},this._syncAttributes),(n=t._syncAttributes)!==null&&n!==void 0?n:t.attributes);if(!this._asyncAttributesPromise&&!t._asyncAttributesPromise)return new e(i);var o=Promise.all([this._asyncAttributesPromise,t._asyncAttributesPromise]).then(function(s){var c,l=hl(s,2),a=l[0],u=l[1];return ee(ee(ee(ee({},r._syncAttributes),a),(c=t._syncAttributes)!==null&&c!==void 0?c:t.attributes),u)});return new e(i,o)},e.EMPTY=new e({}),e})();var na=(function(){function e(){this._registeredViews=[]}return e.prototype.addView=function(t){this._registeredViews.push(t)},e.prototype.findViews=function(t,r){var n=this,i=this._registeredViews.filter(function(o){return n._matchInstrument(o.instrumentSelector,t)&&n._matchMeter(o.meterSelector,r)});return i},e.prototype._matchInstrument=function(t,r){return(t.getType()===void 0||r.type===t.getType())&&t.getNameFilter().match(r.name)&&t.getUnitFilter().match(r.unit)},e.prototype._matchMeter=function(t,r){return t.getNameFilter().match(r.name)&&(r.version===void 0||t.getVersionFilter().match(r.version))&&(r.schemaUrl===void 0||t.getSchemaUrlFilter().match(r.schemaUrl))},e})();g();var pe=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),dr=(function(){function e(t,r){this._writableMetricStorage=t,this._descriptor=r}return e.prototype._record=function(t,r,n){if(r===void 0&&(r={}),n===void 0&&(n=N.active()),typeof t!="number"){p.warn("non-number value provided to metric "+this._descriptor.name+": "+t);return}this._descriptor.valueType===L.INT&&!Number.isInteger(t)&&(p.warn("INT value type cannot accept a floating-point value for "+this._descriptor.name+", ignoring the fractional digits."),t=Math.trunc(t),!Number.isInteger(t))||this._writableMetricStorage.record(t,r,n,D(Date.now()))},e})();var oa=(function(e){pe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n,i){this._record(r,n,i)},t})(dr);var ia=(function(e){pe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.add=function(r,n,i){if(r<0){p.warn("negative value provided to counter "+this._descriptor.name+": "+r);return}this._record(r,n,i)},t})(dr);var aa=(function(e){pe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n,i){this._record(r,n,i)},t})(dr);var sa=(function(e){pe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.record=function(r,n,i){if(r<0){p.warn("negative value provided to histogram "+this._descriptor.name+": "+r);return}this._record(r,n,i)},t})(dr);var mr=(function(){function e(t,r,n){this._observableRegistry=n,this._descriptor=t,this._metricStorages=r}return e.prototype.addCallback=function(t){this._observableRegistry.addCallback(t,this)},e.prototype.removeCallback=function(t){this._observableRegistry.removeCallback(t,this)},e})();var ca=(function(e){pe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(mr);var ua=(function(e){pe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(mr);var la=(function(e){pe(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t})(mr);function lt(e){return e instanceof mr}var fa=(function(){function e(t){this._meterSharedState=t}return e.prototype.createGauge=function(t,r){var n=F(t,_.GAUGE,r),i=this._meterSharedState.registerMetricStorage(n);return new aa(i,n)},e.prototype.createHistogram=function(t,r){var n=F(t,_.HISTOGRAM,r),i=this._meterSharedState.registerMetricStorage(n);return new sa(i,n)},e.prototype.createCounter=function(t,r){var n=F(t,_.COUNTER,r),i=this._meterSharedState.registerMetricStorage(n);return new ia(i,n)},e.prototype.createUpDownCounter=function(t,r){var n=F(t,_.UP_DOWN_COUNTER,r),i=this._meterSharedState.registerMetricStorage(n);return new oa(i,n)},e.prototype.createObservableGauge=function(t,r){var n=F(t,_.OBSERVABLE_GAUGE,r),i=this._meterSharedState.registerAsyncMetricStorage(n);return new ua(n,i,this._meterSharedState.observableRegistry)},e.prototype.createObservableCounter=function(t,r){var n=F(t,_.OBSERVABLE_COUNTER,r),i=this._meterSharedState.registerAsyncMetricStorage(n);return new ca(n,i,this._meterSharedState.observableRegistry)},e.prototype.createObservableUpDownCounter=function(t,r){var n=F(t,_.OBSERVABLE_UP_DOWN_COUNTER,r),i=this._meterSharedState.registerAsyncMetricStorage(n);return new la(n,i,this._meterSharedState.observableRegistry)},e.prototype.addBatchObservableCallback=function(t,r){this._meterSharedState.observableRegistry.addBatchCallback(t,r)},e.prototype.removeBatchObservableCallback=function(t,r){this._meterSharedState.observableRegistry.removeBatchCallback(t,r)},e})();var hr=(function(){function e(t){this._instrumentDescriptor=t}return e.prototype.getInstrumentDescriptor=function(){return this._instrumentDescriptor},e.prototype.updateDescription=function(t){this._instrumentDescriptor=F(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:t,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})},e})();var El=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),pa=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},gl=(function(){function e(t){this._hash=t,this._valueMap=new Map,this._keyMap=new Map}return e.prototype.get=function(t,r){return r??(r=this._hash(t)),this._valueMap.get(r)},e.prototype.getOrDefault=function(t,r){var n=this._hash(t);if(this._valueMap.has(n))return this._valueMap.get(n);var i=r();return this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,i),i},e.prototype.set=function(t,r,n){n??(n=this._hash(t)),this._keyMap.has(n)||this._keyMap.set(n,t),this._valueMap.set(n,r)},e.prototype.has=function(t,r){return r??(r=this._hash(t)),this._valueMap.has(r)},e.prototype.keys=function(){var t,r;return pa(this,function(n){switch(n.label){case 0:t=this._keyMap.entries(),r=t.next(),n.label=1;case 1:return r.done===!0?[3,3]:[4,[r.value[1],r.value[0]]];case 2:return n.sent(),r=t.next(),[3,1];case 3:return[2]}})},e.prototype.entries=function(){var t,r;return pa(this,function(n){switch(n.label){case 0:t=this._valueMap.entries(),r=t.next(),n.label=1;case 1:return r.done===!0?[3,3]:[4,[this._keyMap.get(r.value[0]),r.value[1],r.value[0]]];case 2:return n.sent(),r=t.next(),[3,1];case 3:return[2]}})},Object.defineProperty(e.prototype,"size",{get:function(){return this._valueMap.size},enumerable:!1,configurable:!0}),e})();var G=(function(e){El(t,e);function t(){return e.call(this,tr)||this}return t})(gl);var vl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Er=(function(){function e(t,r){this._aggregator=t,this._activeCollectionStorage=new G,this._cumulativeMemoStorage=new G,this._overflowAttributes={"otel.metric.overflow":!0},this._cardinalityLimit=(r??2e3)-1,this._overflowHashCode=tr(this._overflowAttributes)}return e.prototype.record=function(t,r,n,i){var o=this,s=this._activeCollectionStorage.get(r);if(!s){if(this._activeCollectionStorage.size>=this._cardinalityLimit){var c=this._activeCollectionStorage.getOrDefault(this._overflowAttributes,function(){return o._aggregator.createAccumulation(i)});c?.record(t);return}s=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(r,s)}s?.record(t)},e.prototype.batchCumulate=function(t,r){var n=this;Array.from(t.entries()).forEach(function(i){var o=vl(i,3),s=o[0],c=o[1],l=o[2],a=n._aggregator.createAccumulation(r);a?.record(c);var u=a;if(n._cumulativeMemoStorage.has(s,l)){var f=n._cumulativeMemoStorage.get(s,l);u=n._aggregator.diff(f,a)}else if(n._cumulativeMemoStorage.size>=n._cardinalityLimit&&(s=n._overflowAttributes,l=n._overflowHashCode,n._cumulativeMemoStorage.has(s,l))){var f=n._cumulativeMemoStorage.get(s,l);u=n._aggregator.diff(f,a)}if(n._activeCollectionStorage.has(s,l)){var d=n._activeCollectionStorage.get(s,l);u=n._aggregator.merge(d,u)}n._cumulativeMemoStorage.set(s,a,l),n._activeCollectionStorage.set(s,u,l)})},e.prototype.collect=function(){var t=this._activeCollectionStorage;return this._activeCollectionStorage=new G,t},e})();var Un=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},_a=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},gr=(function(){function e(t,r){var n=this;this._aggregator=t,this._unreportedAccumulations=new Map,this._reportHistory=new Map,r.forEach(function(i){n._unreportedAccumulations.set(i,[])})}return e.prototype.buildMetrics=function(t,r,n,i){this._stashAccumulations(n);var o=this._getMergedUnreportedAccumulations(t),s=o,c;if(this._reportHistory.has(t)){var l=this._reportHistory.get(t),a=l.collectionTime;c=l.aggregationTemporality,c===R.CUMULATIVE?s=e.merge(l.accumulations,o,this._aggregator):s=e.calibrateStartTime(l.accumulations,o,a)}else c=t.selectAggregationTemporality(r.type);this._reportHistory.set(t,{accumulations:s,collectionTime:i,aggregationTemporality:c});var u=Tl(s);if(u.length!==0)return this._aggregator.toMetricData(r,c,u,i)},e.prototype._stashAccumulations=function(t){var r,n,i=this._unreportedAccumulations.keys();try{for(var o=Un(i),s=o.next();!s.done;s=o.next()){var c=s.value,l=this._unreportedAccumulations.get(c);l===void 0&&(l=[],this._unreportedAccumulations.set(c,l)),l.push(t)}}catch(a){r={error:a}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},e.prototype._getMergedUnreportedAccumulations=function(t){var r,n,i=new G,o=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),o===void 0)return i;try{for(var s=Un(o),c=s.next();!c.done;c=s.next()){var l=c.value;i=e.merge(i,l,this._aggregator)}}catch(a){r={error:a}}finally{try{c&&!c.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return i},e.merge=function(t,r,n){for(var i=t,o=r.entries(),s=o.next();s.done!==!0;){var c=_a(s.value,3),l=c[0],a=c[1],u=c[2];if(t.has(l,u)){var f=t.get(l,u),d=n.merge(f,a);i.set(l,d,u)}else i.set(l,a,u);s=o.next()}return i},e.calibrateStartTime=function(t,r,n){var i,o;try{for(var s=Un(t.keys()),c=s.next();!c.done;c=s.next()){var l=_a(c.value,2),a=l[0],u=l[1],f=r.get(a,u);f?.setStartTime(n)}}catch(d){i={error:d}}finally{try{c&&!c.done&&(o=s.return)&&o.call(s)}finally{if(i)throw i.error}}return r},e})();function Tl(e){return Array.from(e.entries())}var Sl=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),yl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},da=(function(e){Sl(t,e);function t(r,n,i,o,s){var c=e.call(this,r)||this;return c._attributesProcessor=i,c._aggregationCardinalityLimit=s,c._deltaMetricStorage=new Er(n,c._aggregationCardinalityLimit),c._temporalMetricStorage=new gr(n,o),c}return t.prototype.record=function(r,n){var i=this,o=new G;Array.from(r.entries()).forEach(function(s){var c=yl(s,2),l=c[0],a=c[1];o.set(i._attributesProcessor.process(l),a)}),this._deltaMetricStorage.batchCumulate(o,n)},t.prototype.collect=function(r,n){var i=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(r,this._instrumentDescriptor,i,n)},t})(hr);g();function Dn(e,t){var r="";return e.unit!==t.unit&&(r+=" - Unit '"+e.unit+"' does not match '"+t.unit+`'
4
+ `),e.type!==t.type&&(r+=" - Type '"+e.type+"' does not match '"+t.type+`'
5
+ `),e.valueType!==t.valueType&&(r+=" - Value Type '"+e.valueType+"' does not match '"+t.valueType+`'
6
+ `),e.description!==t.description&&(r+=" - Description '"+e.description+"' does not match '"+t.description+`'
7
+ `),r}function Al(e,t){return" - use valueType '"+e.valueType+"' on instrument creation or use an instrument name other than '"+t.name+"'"}function Ol(e,t){return" - use unit '"+e.unit+"' on instrument creation or use an instrument name other than '"+t.name+"'"}function Rl(e,t){var r={name:t.name,type:t.type,unit:t.unit},n=JSON.stringify(r);return" - create a new view with a name other than '"+e.name+"' and InstrumentSelector '"+n+"'"}function xl(e,t){var r={name:t.name,type:t.type,unit:t.unit},n=JSON.stringify(r);return" - create a new view with a name other than '"+e.name+"' and InstrumentSelector '"+n+`'
8
+ - OR - create a new view with the name `+e.name+" and description '"+e.description+"' and InstrumentSelector "+n+`
9
+ - OR - create a new view with the name `+t.name+" and description '"+e.description+"' and InstrumentSelector "+n}function Bn(e,t){return e.valueType!==t.valueType?Al(e,t):e.unit!==t.unit?Ol(e,t):e.type!==t.type?Rl(e,t):e.description!==t.description?xl(e,t):""}var Gn=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},ma=(function(){function e(){this._sharedRegistry=new Map,this._perCollectorRegistry=new Map}return e.create=function(){return new e},e.prototype.getStorages=function(t){var r,n,i,o,s=[];try{for(var c=Gn(this._sharedRegistry.values()),l=c.next();!l.done;l=c.next()){var a=l.value;s=s.concat(a)}}catch(T){r={error:T}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}var u=this._perCollectorRegistry.get(t);if(u!=null)try{for(var f=Gn(u.values()),d=f.next();!d.done;d=f.next()){var a=d.value;s=s.concat(a)}}catch(T){i={error:T}}finally{try{d&&!d.done&&(o=f.return)&&o.call(f)}finally{if(i)throw i.error}}return s},e.prototype.register=function(t){this._registerStorage(t,this._sharedRegistry)},e.prototype.registerForCollector=function(t,r){var n=this._perCollectorRegistry.get(t);n==null&&(n=new Map,this._perCollectorRegistry.set(t,n)),this._registerStorage(r,n)},e.prototype.findOrUpdateCompatibleStorage=function(t){var r=this._sharedRegistry.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)},e.prototype.findOrUpdateCompatibleCollectorStorage=function(t,r){var n=this._perCollectorRegistry.get(t);if(n===void 0)return null;var i=n.get(r.name);return i===void 0?null:this._findOrUpdateCompatibleStorage(r,i)},e.prototype._registerStorage=function(t,r){var n=t.getInstrumentDescriptor(),i=r.get(n.name);if(i===void 0){r.set(n.name,[t]);return}i.push(t)},e.prototype._findOrUpdateCompatibleStorage=function(t,r){var n,i,o=null;try{for(var s=Gn(r),c=s.next();!c.done;c=s.next()){var l=c.value,a=l.getInstrumentDescriptor();Ni(a,t)?(a.description!==t.description&&(t.description.length>a.description.length&&l.updateDescription(t.description),p.warn("A view or instrument with the name ",t.name,` has already been registered, but has a different description and is incompatible with another registered view.
10
+ `,`Details:
11
+ `,Dn(a,t),`The longer description will be used.
12
+ To resolve the conflict:`,Bn(a,t))),o=l):p.warn("A view or instrument with the name ",t.name,` has already been registered and is incompatible with another registered view.
13
+ `,`Details:
14
+ `,Dn(a,t),`To resolve the conflict:
15
+ `,Bn(a,t))}}catch(u){n={error:u}}finally{try{c&&!c.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}return o},e})();var ha=(function(){function e(t){this._backingStorages=t}return e.prototype.record=function(t,r,n,i){this._backingStorages.forEach(function(o){o.record(t,r,n,i)})},e})();g();g();var Ea=(function(){function e(t,r){this._instrumentName=t,this._valueType=r,this._buffer=new G}return e.prototype.observe=function(t,r){if(r===void 0&&(r={}),typeof t!="number"){p.warn("non-number value provided to metric "+this._instrumentName+": "+t);return}this._valueType===L.INT&&!Number.isInteger(t)&&(p.warn("INT value type cannot accept a floating-point value for "+this._instrumentName+", ignoring the fractional digits."),t=Math.trunc(t),!Number.isInteger(t))||this._buffer.set(r,t)},e})();var ga=(function(){function e(){this._buffer=new Map}return e.prototype.observe=function(t,r,n){if(n===void 0&&(n={}),!!lt(t)){var i=this._buffer.get(t);if(i==null&&(i=new G,this._buffer.set(t,i)),typeof r!="number"){p.warn("non-number value provided to metric "+t._descriptor.name+": "+r);return}t._descriptor.valueType===L.INT&&!Number.isInteger(r)&&(p.warn("INT value type cannot accept a floating-point value for "+t._descriptor.name+", ignoring the fractional digits."),r=Math.trunc(r),!Number.isInteger(r))||i.set(n,r)}},e})();var Vn=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{a(n.next(u))}catch(f){s(f)}}function l(u){try{a(n.throw(u))}catch(f){s(f)}}function a(u){u.done?o(u.value):i(u.value).then(c,l)}a((n=n.apply(e,t||[])).next())})},kn=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},va=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Ta=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},Sa=(function(){function e(){this._callbacks=[],this._batchCallbacks=[]}return e.prototype.addCallback=function(t,r){var n=this._findCallback(t,r);n>=0||this._callbacks.push({callback:t,instrument:r})},e.prototype.removeCallback=function(t,r){var n=this._findCallback(t,r);n<0||this._callbacks.splice(n,1)},e.prototype.addBatchCallback=function(t,r){var n=new Set(r.filter(lt));if(n.size===0){p.error("BatchObservableCallback is not associated with valid instruments",r);return}var i=this._findBatchCallback(t,n);i>=0||this._batchCallbacks.push({callback:t,instruments:n})},e.prototype.removeBatchCallback=function(t,r){var n=new Set(r.filter(lt)),i=this._findBatchCallback(t,n);i<0||this._batchCallbacks.splice(i,1)},e.prototype.observe=function(t,r){return Vn(this,void 0,void 0,function(){var n,i,o,s;return kn(this,function(c){switch(c.label){case 0:return n=this._observeCallbacks(t,r),i=this._observeBatchCallbacks(t,r),[4,Li(Ta(Ta([],va(n),!1),va(i),!1))];case 1:return o=c.sent(),s=o.filter(wi).map(function(l){return l.reason}),[2,s]}})})},e.prototype._observeCallbacks=function(t,r){var n=this;return this._callbacks.map(function(i){var o=i.callback,s=i.instrument;return Vn(n,void 0,void 0,function(){var c,l;return kn(this,function(a){switch(a.label){case 0:return c=new Ea(s._descriptor.name,s._descriptor.valueType),l=Promise.resolve(o(c)),r!=null&&(l=q(l,r)),[4,l];case 1:return a.sent(),s._metricStorages.forEach(function(u){u.record(c._buffer,t)}),[2]}})})})},e.prototype._observeBatchCallbacks=function(t,r){var n=this;return this._batchCallbacks.map(function(i){var o=i.callback,s=i.instruments;return Vn(n,void 0,void 0,function(){var c,l;return kn(this,function(a){switch(a.label){case 0:return c=new ga,l=Promise.resolve(o(c)),r!=null&&(l=q(l,r)),[4,l];case 1:return a.sent(),s.forEach(function(u){var f=c._buffer.get(u);f!=null&&u._metricStorages.forEach(function(d){d.record(f,t)})}),[2]}})})})},e.prototype._findCallback=function(t,r){return this._callbacks.findIndex(function(n){return n.callback===t&&n.instrument===r})},e.prototype._findBatchCallback=function(t,r){return this._batchCallbacks.findIndex(function(n){return n.callback===t&&bi(n.instruments,r)})},e})();var Ll=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),ya=(function(e){Ll(t,e);function t(r,n,i,o,s){var c=e.call(this,r)||this;return c._attributesProcessor=i,c._aggregationCardinalityLimit=s,c._deltaMetricStorage=new Er(n,c._aggregationCardinalityLimit),c._temporalMetricStorage=new gr(n,o),c}return t.prototype.record=function(r,n,i,o){n=this._attributesProcessor.process(n,i),this._deltaMetricStorage.record(r,n,i,o)},t.prototype.collect=function(r,n){var i=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(r,this._instrumentDescriptor,i,n)},t})(hr);var Aa=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),xe=(function(){function e(){}return e.Noop=function(){return bl},e})();var wl=(function(e){Aa(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.process=function(r,n){return r},t})(xe);var Oa=(function(e){Aa(t,e);function t(r){var n=e.call(this)||this;return n._allowedAttributeNames=r,n}return t.prototype.process=function(r,n){var i=this,o={};return Object.keys(r).filter(function(s){return i._allowedAttributeNames.includes(s)}).forEach(function(s){return o[s]=r[s]}),o},t})(xe);var bl=new wl;var Pl=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{a(n.next(u))}catch(f){s(f)}}function l(u){try{a(n.throw(u))}catch(f){s(f)}}function a(u){u.done?o(u.value):i(u.value).then(c,l)}a((n=n.apply(e,t||[])).next())})},Ml=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Il=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Ra=(function(){function e(t,r){this._meterProviderSharedState=t,this._instrumentationScope=r,this.metricStorageRegistry=new ma,this.observableRegistry=new Sa,this.meter=new fa(this)}return e.prototype.registerMetricStorage=function(t){var r=this._registerMetricStorage(t,ya);return r.length===1?r[0]:new ha(r)},e.prototype.registerAsyncMetricStorage=function(t){var r=this._registerMetricStorage(t,da);return r},e.prototype.collect=function(t,r,n){return Pl(this,void 0,void 0,function(){var i,o,s;return Ml(this,function(c){switch(c.label){case 0:return[4,this.observableRegistry.observe(r,n?.timeoutMillis)];case 1:return i=c.sent(),o=this.metricStorageRegistry.getStorages(t),o.length===0?[2,null]:(s=o.map(function(l){return l.collect(t,r)}).filter(Ri),s.length===0?[2,{errors:i}]:[2,{scopeMetrics:{scope:this._instrumentationScope,metrics:s},errors:i}])}})})},e.prototype._registerMetricStorage=function(t,r){var n=this,i=this._meterProviderSharedState.viewRegistry.findViews(t,this._instrumentationScope),o=i.map(function(l){var a=Ii(l,t),u=n.metricStorageRegistry.findOrUpdateCompatibleStorage(a);if(u!=null)return u;var f=l.aggregation.createAggregator(a),d=new r(a,f,l.attributesProcessor,n._meterProviderSharedState.metricCollectors,l.aggregationCardinalityLimit);return n.metricStorageRegistry.register(d),d});if(o.length===0){var s=this._meterProviderSharedState.selectAggregations(t.type),c=s.map(function(l){var a=Il(l,2),u=a[0],f=a[1],d=n.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(u,t);if(d!=null)return d;var T=f.createAggregator(t),b=u.selectCardinalityLimit(t.type),ne=new r(t,T,xe.Noop(),[u],b);return n.metricStorageRegistry.registerForCollector(u,ne),ne});o=o.concat(c)}return o},e})();var Nl=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},xa=(function(){function e(t){this.resource=t,this.viewRegistry=new na,this.metricCollectors=[],this.meterSharedStates=new Map}return e.prototype.getMeterSharedState=function(t){var r=xi(t),n=this.meterSharedStates.get(r);return n==null&&(n=new Ra(this,t),this.meterSharedStates.set(r,n)),n},e.prototype.selectAggregations=function(t){var r,n,i=[];try{for(var o=Nl(this.metricCollectors),s=o.next();!s.done;s=o.next()){var c=s.value;i.push([c,c.selectAggregation(t)])}}catch(l){r={error:l}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return i},e})();var vr=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{a(n.next(u))}catch(f){s(f)}}function l(u){try{a(n.throw(u))}catch(f){s(f)}}function a(u){u.done?o(u.value):i(u.value).then(c,l)}a((n=n.apply(e,t||[])).next())})},Tr=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Cl=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Ul=function(e,t,r){if(r||arguments.length===2)for(var n=0,i=t.length,o;n<i;n++)(o||!(n in t))&&(o||(o=Array.prototype.slice.call(t,0,n)),o[n]=t[n]);return e.concat(o||Array.prototype.slice.call(t))},La=(function(){function e(t,r){this._sharedState=t,this._metricReader=r}return e.prototype.collect=function(t){return vr(this,void 0,void 0,function(){var r,n,i,o,s=this;return Tr(this,function(c){switch(c.label){case 0:return r=D(Date.now()),n=[],i=[],o=Array.from(this._sharedState.meterSharedStates.values()).map(function(l){return vr(s,void 0,void 0,function(){var a;return Tr(this,function(u){switch(u.label){case 0:return[4,l.collect(this,r,t)];case 1:return a=u.sent(),a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&i.push.apply(i,Ul([],Cl(a.errors),!1)),[2]}})})}),[4,Promise.all(o)];case 1:return c.sent(),[2,{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:i}]}})})},e.prototype.forceFlush=function(t){return vr(this,void 0,void 0,function(){return Tr(this,function(r){switch(r.label){case 0:return[4,this._metricReader.forceFlush(t)];case 1:return r.sent(),[2]}})})},e.prototype.shutdown=function(t){return vr(this,void 0,void 0,function(){return Tr(this,function(r){switch(r.label){case 0:return[4,this._metricReader.shutdown(t)];case 1:return r.sent(),[2]}})})},e.prototype.selectAggregationTemporality=function(t){return this._metricReader.selectAggregationTemporality(t)},e.prototype.selectAggregation=function(t){return this._metricReader.selectAggregation(t)},e.prototype.selectCardinalityLimit=function(t){var r,n,i;return(i=(n=(r=this._metricReader).selectCardinalityLimit)===null||n===void 0?void 0:n.call(r,t))!==null&&i!==void 0?i:2e3},e})();var wa=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{a(n.next(u))}catch(f){s(f)}}function l(u){try{a(n.throw(u))}catch(f){s(f)}}function a(u){u.done?o(u.value):i(u.value).then(c,l)}a((n=n.apply(e,t||[])).next())})},ba=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},Pa=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")};function Dl(e,t){var r=t??B.empty();return e?B.default().merge(r):r}var Hn=(function(){function e(t){var r,n,i,o,s;if(this._shutdown=!1,this._sharedState=new xa(Dl((s=t?.mergeResourceWithDefaults)!==null&&s!==void 0?s:!0,t?.resource)),t?.views!=null&&t.views.length>0)try{for(var c=Pa(t.views),l=c.next();!l.done;l=c.next()){var a=l.value;this._sharedState.viewRegistry.addView(a)}}catch(T){r={error:T}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}if(t?.readers!=null&&t.readers.length>0)try{for(var u=Pa(t.readers),f=u.next();!f.done;f=u.next()){var d=f.value;this.addMetricReader(d)}}catch(T){i={error:T}}finally{try{f&&!f.done&&(o=u.return)&&o.call(u)}finally{if(i)throw i.error}}}return e.prototype.getMeter=function(t,r,n){return r===void 0&&(r=""),n===void 0&&(n={}),this._shutdown?(p.warn("A shutdown MeterProvider cannot provide a Meter"),tn()):this._sharedState.getMeterSharedState({name:t,version:r,schemaUrl:n.schemaUrl}).meter},e.prototype.addMetricReader=function(t){var r=new La(this._sharedState,t);t.setMetricProducer(r),this._sharedState.metricCollectors.push(r)},e.prototype.shutdown=function(t){return wa(this,void 0,void 0,function(){return ba(this,function(r){switch(r.label){case 0:return this._shutdown?(p.warn("shutdown may only be called once per MeterProvider"),[2]):(this._shutdown=!0,[4,Promise.all(this._sharedState.metricCollectors.map(function(n){return n.shutdown(t)}))]);case 1:return r.sent(),[2]}})})},e.prototype.forceFlush=function(t){return wa(this,void 0,void 0,function(){return ba(this,function(r){switch(r.label){case 0:return this._shutdown?(p.warn("invalid attempt to force flush after MeterProvider shutdown"),[2]):[4,Promise.all(this._sharedState.metricCollectors.map(function(n){return n.forceFlush(t)}))];case 1:return r.sent(),[2]}})})},e})();var Bl=/[\^$\\.+?()[\]{}|]/g,Sr=(function(){function e(t){t==="*"?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}return e.prototype.match=function(t){return this._matchAll?!0:this._regexp.test(t)},e.escapePattern=function(t){return"^"+t.replace(Bl,"\\$&").replace("*",".*")+"$"},e.hasWildcard=function(t){return t.includes("*")},e})();var Le=(function(){function e(t){this._matchAll=t===void 0,this._pattern=t}return e.prototype.match=function(t){return!!(this._matchAll||t===this._pattern)},e})();var Ma=(function(){function e(t){var r;this._nameFilter=new Sr((r=t?.name)!==null&&r!==void 0?r:"*"),this._type=t?.type,this._unitFilter=new Le(t?.unit)}return e.prototype.getType=function(){return this._type},e.prototype.getNameFilter=function(){return this._nameFilter},e.prototype.getUnitFilter=function(){return this._unitFilter},e})();var Ia=(function(){function e(t){this._nameFilter=new Le(t?.name),this._versionFilter=new Le(t?.version),this._schemaUrlFilter=new Le(t?.schemaUrl)}return e.prototype.getNameFilter=function(){return this._nameFilter},e.prototype.getVersionFilter=function(){return this._versionFilter},e.prototype.getSchemaUrlFilter=function(){return this._schemaUrlFilter},e})();function Gl(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}var yr=(function(){function e(t){var r;if(Gl(t))throw new Error("Cannot create view with no selector arguments supplied");if(t.name!=null&&(t?.instrumentName==null||Sr.hasWildcard(t.instrumentName)))throw new Error("Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.");t.attributeKeys!=null?this.attributesProcessor=new Oa(t.attributeKeys):this.attributesProcessor=xe.Noop(),this.name=t.name,this.description=t.description,this.aggregation=(r=t.aggregation)!==null&&r!==void 0?r:P.Default(),this.instrumentSelector=new Ma({name:t.instrumentName,type:t.instrumentType,unit:t.instrumentUnit}),this.meterSelector=new Ia({name:t.meterName,version:t.meterVersion,schemaUrl:t.meterSchemaUrl}),this.aggregationCardinalityLimit=t.aggregationCardinalityLimit}return e})();function Vl(e,t){var r=Jt(t);return{resource:Zt(e.resource),schemaUrl:void 0,scopeMetrics:kl(e.scopeMetrics,r)}}function kl(e,t){return Array.from(e.map(function(r){return{scope:qt(r.scope),metrics:r.metrics.map(function(n){return Hl(n,t)}),schemaUrl:r.scope.schemaUrl}}))}function Hl(e,t){var r={name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit},n=Kl(e.aggregationTemporality);switch(e.dataPointType){case w.SUM:r.sum={aggregationTemporality:n,isMonotonic:e.isMonotonic,dataPoints:Na(e,t)};break;case w.GAUGE:r.gauge={dataPoints:Na(e,t)};break;case w.HISTOGRAM:r.histogram={aggregationTemporality:n,dataPoints:jl(e,t)};break;case w.EXPONENTIAL_HISTOGRAM:r.exponentialHistogram={aggregationTemporality:n,dataPoints:$l(e,t)};break}return r}function Fl(e,t,r){var n={attributes:at(e.attributes),startTimeUnixNano:r.encodeHrTime(e.startTime),timeUnixNano:r.encodeHrTime(e.endTime)};switch(t){case L.INT:n.asInt=e.value;break;case L.DOUBLE:n.asDouble=e.value;break}return n}function Na(e,t){return e.dataPoints.map(function(r){return Fl(r,e.descriptor.valueType,t)})}function jl(e,t){return e.dataPoints.map(function(r){var n=r.value;return{attributes:at(r.attributes),bucketCounts:n.buckets.counts,explicitBounds:n.buckets.boundaries,count:n.count,sum:n.sum,min:n.min,max:n.max,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function $l(e,t){return e.dataPoints.map(function(r){var n=r.value;return{attributes:at(r.attributes),count:n.count,min:n.min,max:n.max,sum:n.sum,positive:{offset:n.positive.offset,bucketCounts:n.positive.bucketCounts},negative:{offset:n.negative.offset,bucketCounts:n.negative.bucketCounts},scale:n.scale,zeroCount:n.zeroCount,startTimeUnixNano:t.encodeHrTime(r.startTime),timeUnixNano:t.encodeHrTime(r.endTime)}})}function Kl(e){switch(e){case R.DELTA:return 1;case R.CUMULATIVE:return 2}}function Ca(e,t){return{resourceMetrics:e.map(function(r){return Vl(r,t)})}}var Ar={serializeRequest:function(e){var t=yi(e,{useHex:!0,useLongBits:!1}),r=new TextEncoder;return r.encode(JSON.stringify(t))},deserializeResponse:function(e){var t=new TextDecoder;return JSON.parse(t.decode(e))}};var Or={serializeRequest:function(e){var t=Ca([e],{useLongBits:!1}),r=new TextEncoder;return r.encode(JSON.stringify(t))},deserializeResponse:function(e){var t=new TextDecoder;return JSON.parse(t.decode(e))}};var Ua="0.57.2";var Jl=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{a(n.next(u))}catch(f){s(f)}}function l(u){try{a(n.throw(u))}catch(f){s(f)}}function a(u){u.done?o(u.value):i(u.value).then(c,l)}a((n=n.apply(e,t||[])).next())})},Zl=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},ql=(function(){function e(t){this._parameters=t,this._send=null,this._agent=null}return e.prototype.send=function(t,r){return Jl(this,void 0,void 0,function(){var n,i,o,s=this;return Zl(this,function(c){return this._send==null&&(n=(Fa(),lc(Ha)),i=n.sendWithHttp,o=n.createHttpAgent,this._agent=o(this._parameters.url,this._parameters.agentOptions),this._send=i),[2,new Promise(function(l){var a;(a=s._send)===null||a===void 0||a.call(s,s._parameters,s._agent,t,function(u){l(u)},r)})]})})},e.prototype.shutdown=function(){},e})();function ja(e){return new ql(e)}var Ql=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{a(n.next(u))}catch(f){s(f)}}function l(u){try{a(n.throw(u))}catch(f){s(f)}}function a(u){u.done?o(u.value):i(u.value).then(c,l)}a((n=n.apply(e,t||[])).next())})},ef=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},tf=5,rf=1e3,nf=5e3,of=1.5,$a=.2;function af(){return Math.random()*(2*$a)-$a}var sf=(function(){function e(t){this._transport=t}return e.prototype.retry=function(t,r,n){var i=this;return new Promise(function(o,s){setTimeout(function(){i._transport.send(t,r).then(o,s)},n)})},e.prototype.send=function(t,r){var n;return Ql(this,void 0,void 0,function(){var i,o,s,c,l,a,u;return ef(this,function(f){switch(f.label){case 0:return i=Date.now()+r,[4,this._transport.send(t,r)];case 1:o=f.sent(),s=tf,c=rf,f.label=2;case 2:return o.status==="retryable"&&s>0?(s--,l=Math.max(Math.min(c,nf)+af(),0),c=c*of,a=(n=o.retryInMillis)!==null&&n!==void 0?n:l,u=i-Date.now(),a>u?[2,o]:[4,this.retry(t,u,a)]):[3,4];case 3:return o=f.sent(),[3,2];case 4:return[2,o]}})})},e.prototype.shutdown=function(){return this._transport.shutdown()},e})();function Ka(e){return new sf(e.transport)}function ft(e,t){return hi({transport:Ka({transport:ja(e)}),serializer:t,promiseHandler:po(e)},{timeout:e.timeoutMillis})}g();function Wa(e){var t,r=(t=process.env[e])===null||t===void 0?void 0:t.trim();if(r!=null&&r!==""){var n=Number(r);if(!Number.isNaN(n)&&Number.isFinite(n)&&n>0)return n;p.warn("Configuration: "+e+" is invalid, expected number greater than 0 (actual: "+r+")")}}function cf(e){var t=Wa("OTEL_EXPORTER_OTLP_"+e+"_TIMEOUT"),r=Wa("OTEL_EXPORTER_OTLP_TIMEOUT");return t??r}function Ya(e){var t,r=(t=process.env[e])===null||t===void 0?void 0:t.trim();if(r!==""){if(r==null||r==="none"||r==="gzip")return r;p.warn("Configuration: "+e+" is invalid, expected 'none' or 'gzip' (actual: '"+r+"')")}}function uf(e){var t=Ya("OTEL_EXPORTER_OTLP_"+e+"_COMPRESSION"),r=Ya("OTEL_EXPORTER_OTLP_COMPRESSION");return t??r}function Xa(e){return{timeoutMillis:cf(e),compression:uf(e)}}g();var lf=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o};function za(e){return function(){var t,r={};return Object.entries((t=e?.())!==null&&t!==void 0?t:{}).forEach(function(n){var i=lf(n,2),o=i[0],s=i[1];typeof s<"u"?r[o]=String(s):p.warn('Header "'+o+'" has invalid value ('+s+") and will be ignored")}),r}}var _e=function(){return _e=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},_e.apply(this,arguments)};function ff(e,t,r){var n=_e({},r()),i={};return function(){return t!=null&&Object.assign(i,t()),e!=null&&Object.assign(i,e()),Object.assign(i,n)}}function pf(e){if(e!=null)try{return new URL(e),e}catch{throw new Error("Configuration: Could not parse user-provided export URL: '"+e+"'")}}function Ja(e,t,r){var n,i,o,s;return _e(_e({},lo(e,t,r)),{headers:ff(za(e.headers),t.headers,r.headers),url:(i=(n=pf(e.url))!==null&&n!==void 0?n:t.url)!==null&&i!==void 0?i:r.url,agentOptions:(s=(o=e.agentOptions)!==null&&o!==void 0?o:t.agentOptions)!==null&&s!==void 0?s:r.agentOptions})}function Za(e,t){return _e(_e({},fo()),{headers:function(){return e},url:"http://localhost:4318/"+t,agentOptions:{keepAlive:!0}})}g();var Lr=function(){return Lr=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},Lr.apply(this,arguments)};function _f(e){var t,r,n=(t=process.env["OTEL_EXPORTER_OTLP_"+e+"_HEADERS"])===null||t===void 0?void 0:t.trim(),i=(r=process.env.OTEL_EXPORTER_OTLP_HEADERS)===null||r===void 0?void 0:r.trim(),o=it.parseKeyPairsIntoRecord(n),s=it.parseKeyPairsIntoRecord(i);if(!(Object.keys(o).length===0&&Object.keys(s).length===0))return Object.assign({},it.parseKeyPairsIntoRecord(i),it.parseKeyPairsIntoRecord(n))}function df(e){try{var t=new URL(e);return t.toString()}catch{p.warn("Configuration: Could not parse environment-provided export URL: '"+e+"', falling back to undefined");return}}function mf(e,t){try{new URL(e)}catch{p.warn("Configuration: Could not parse environment-provided export URL: '"+e+"', falling back to undefined");return}e.endsWith("/")||(e=e+"/"),e+=t;try{new URL(e)}catch{p.warn("Configuration: Provided URL appended with '"+t+"' is not a valid URL, using 'undefined' instead of '"+e+"'");return}return e}function hf(e){var t,r=(t=process.env.OTEL_EXPORTER_OTLP_ENDPOINT)===null||t===void 0?void 0:t.trim();if(!(r==null||r===""))return mf(r,e)}function Ef(e){var t,r=(t=process.env["OTEL_EXPORTER_OTLP_"+e+"_ENDPOINT"])===null||t===void 0?void 0:t.trim();if(!(r==null||r===""))return df(r)}function qa(e,t){var r;return Lr(Lr({},Xa(e)),{url:(r=Ef(e))!==null&&r!==void 0?r:hf(t),headers:Lt(_f(e))})}g();function gf(e){return e?.keepAlive!=null&&(e.httpAgentOptions!=null?e.httpAgentOptions.keepAlive==null&&(e.httpAgentOptions.keepAlive=e.keepAlive):e.httpAgentOptions={keepAlive:e.keepAlive}),e.httpAgentOptions}function pt(e,t,r,n){return e.metadata&&p.warn("Metadata cannot be set when using http"),Ja({url:e.url,headers:Lt(e.headers),concurrencyLimit:e.concurrencyLimit,timeoutMillis:e.timeoutMillis,compression:e.compression,agentOptions:gf(e)},qa(t,r),Za(n,r))}var vf=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),_t=(function(e){vf(t,e);function t(r){return r===void 0&&(r={}),e.call(this,ft(pt(r,"LOGS","v1/logs",{"User-Agent":"OTel-OTLP-Exporter-JavaScript/"+Ua,"Content-Type":"application/json"}),Ar))||this}return t})(Ge);g();g();g();g();var Tf=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Sf=function(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var n=r.call(e),i,o=[],s;try{for(;(t===void 0||t-- >0)&&!(i=n.next()).done;)o.push(i.value)}catch(c){s={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(s)throw s.error}}return o},Qa=(function(){function e(t,r,n){this.attributes={},this.totalAttributesCount=0,this._isReadonly=!1;var i=n.timestamp,o=n.observedTimestamp,s=n.severityNumber,c=n.severityText,l=n.body,a=n.attributes,u=a===void 0?{}:a,f=n.context,d=Date.now();if(this.hrTime=Wt(i??d),this.hrTimeObserved=Wt(o??d),f){var T=ae.getSpanContext(f);T&&ie(T)&&(this.spanContext=T)}this.severityNumber=s,this.severityText=c,this.body=l,this.resource=t.resource,this.instrumentationScope=r,this._logRecordLimits=t.logRecordLimits,this.setAttributes(u)}return Object.defineProperty(e.prototype,"severityText",{get:function(){return this._severityText},set:function(t){this._isLogRecordReadonly()||(this._severityText=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"severityNumber",{get:function(){return this._severityNumber},set:function(t){this._isLogRecordReadonly()||(this._severityNumber=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return this._body},set:function(t){this._isLogRecordReadonly()||(this._body=t)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"droppedAttributesCount",{get:function(){return this.totalAttributesCount-Object.keys(this.attributes).length},enumerable:!1,configurable:!0}),e.prototype.setAttribute=function(t,r){return this._isLogRecordReadonly()?this:r===null?this:t.length===0?(p.warn("Invalid attribute key: "+t),this):!Ft(r)&&!(typeof r=="object"&&!Array.isArray(r)&&Object.keys(r).length>0)?(p.warn("Invalid attribute value set for key: "+t),this):(this.totalAttributesCount+=1,Object.keys(this.attributes).length>=this._logRecordLimits.attributeCountLimit&&!Object.prototype.hasOwnProperty.call(this.attributes,t)?(this.droppedAttributesCount===1&&p.warn("Dropping extra attributes."),this):(Ft(r)?this.attributes[t]=this._truncateToSize(r):this.attributes[t]=r,this))},e.prototype.setAttributes=function(t){var r,n;try{for(var i=Tf(Object.entries(t)),o=i.next();!o.done;o=i.next()){var s=Sf(o.value,2),c=s[0],l=s[1];this.setAttribute(c,l)}}catch(a){r={error:a}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(r)throw r.error}}return this},e.prototype.setBody=function(t){return this.body=t,this},e.prototype.setSeverityNumber=function(t){return this.severityNumber=t,this},e.prototype.setSeverityText=function(t){return this.severityText=t,this},e.prototype._makeReadonly=function(){this._isReadonly=!0},e.prototype._truncateToSize=function(t){var r=this,n=this._logRecordLimits.attributeValueLengthLimit;return n<=0?(p.warn("Attribute value limit must be positive, got "+n),t):typeof t=="string"?this._truncateToLimitUtil(t,n):Array.isArray(t)?t.map(function(i){return typeof i=="string"?r._truncateToLimitUtil(i,n):i}):t},e.prototype._truncateToLimitUtil=function(t,r){return t.length<=r?t:t.substring(0,r)},e.prototype._isLogRecordReadonly=function(){return this._isReadonly&&p.warn("Can not execute the operation on emitted log record"),this._isReadonly},e})();var jn=function(){return jn=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},jn.apply(this,arguments)},es=(function(){function e(t,r){this.instrumentationScope=t,this._sharedState=r}return e.prototype.emit=function(t){var r=t.context||N.active(),n=new Qa(this._sharedState,this.instrumentationScope,jn({context:r},t));this._sharedState.activeProcessor.onEmit(n,r),n._makeReadonly()},e})();function ts(){return{forceFlushTimeoutMillis:3e4,logRecordLimits:{attributeValueLengthLimit:H().OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT,attributeCountLimit:H().OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT},includeTraceContext:!0,mergeResourceWithDefaults:!0}}function rs(e){var t,r,n,i,o,s,c=Ze();return{attributeCountLimit:(n=(r=(t=e.attributeCountLimit)!==null&&t!==void 0?t:c.OTEL_LOGRECORD_ATTRIBUTE_COUNT_LIMIT)!==null&&r!==void 0?r:c.OTEL_ATTRIBUTE_COUNT_LIMIT)!==null&&n!==void 0?n:Ae,attributeValueLengthLimit:(s=(o=(i=e.attributeValueLengthLimit)!==null&&i!==void 0?i:c.OTEL_LOGRECORD_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&o!==void 0?o:c.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT)!==null&&s!==void 0?s:ye}}var ns=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{a(n.next(u))}catch(f){s(f)}}function l(u){try{a(n.throw(u))}catch(f){s(f)}}function a(u){u.done?o(u.value):i(u.value).then(c,l)}a((n=n.apply(e,t||[])).next())})},os=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},is=(function(){function e(t,r){this.processors=t,this.forceFlushTimeoutMillis=r}return e.prototype.forceFlush=function(){return ns(this,void 0,void 0,function(){var t;return os(this,function(r){switch(r.label){case 0:return t=this.forceFlushTimeoutMillis,[4,Promise.all(this.processors.map(function(n){return nt(n.forceFlush(),t)}))];case 1:return r.sent(),[2]}})})},e.prototype.onEmit=function(t,r){this.processors.forEach(function(n){return n.onEmit(t,r)})},e.prototype.shutdown=function(){return ns(this,void 0,void 0,function(){return os(this,function(t){switch(t.label){case 0:return[4,Promise.all(this.processors.map(function(r){return r.shutdown()}))];case 1:return t.sent(),[2]}})})},e})();var as=(function(){function e(){}return e.prototype.forceFlush=function(){return Promise.resolve()},e.prototype.onEmit=function(t,r){},e.prototype.shutdown=function(){return Promise.resolve()},e})();var ss=(function(){function e(t,r,n){this.resource=t,this.forceFlushTimeoutMillis=r,this.logRecordLimits=n,this.loggers=new Map,this.registeredLogRecordProcessors=[],this.activeProcessor=new as}return e})();var yf="unknown";function Af(e,t){var r=t??B.empty();return e?B.default().merge(r):r}var $n=(function(){function e(t){t===void 0&&(t={});var r=Tn({},ts(),t),n=Af(r.mergeResourceWithDefaults,t.resource);this._sharedState=new ss(n,r.forceFlushTimeoutMillis,rs(r.logRecordLimits)),this._shutdownOnce=new ot(this._shutdown,this)}return e.prototype.getLogger=function(t,r,n){if(this._shutdownOnce.isCalled)return p.warn("A shutdown LoggerProvider cannot provide a Logger"),De;t||p.warn("Logger requested without instrumentation scope name.");var i=t||yf,o=i+"@"+(r||"")+":"+(n?.schemaUrl||"");return this._sharedState.loggers.has(o)||this._sharedState.loggers.set(o,new es({name:i,version:r,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(o)},e.prototype.addLogRecordProcessor=function(t){this._sharedState.registeredLogRecordProcessors.length===0&&this._sharedState.activeProcessor.shutdown().catch(function(r){return p.error("Error while trying to shutdown current log record processor",r)}),this._sharedState.registeredLogRecordProcessors.push(t),this._sharedState.activeProcessor=new is(this._sharedState.registeredLogRecordProcessors,this._sharedState.forceFlushTimeoutMillis)},e.prototype.forceFlush=function(){return this._shutdownOnce.isCalled?(p.warn("invalid attempt to force flush after LoggerProvider shutdown"),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()},e.prototype.shutdown=function(){return this._shutdownOnce.isCalled?(p.warn("shutdown may only be called once per LoggerProvider"),this._shutdownOnce.promise):this._shutdownOnce.call()},e.prototype._shutdown=function(){return this._sharedState.activeProcessor.shutdown()},e})();var Of=function(e){var t=typeof Symbol=="function"&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&typeof e.length=="number")return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},Kn=(function(){function e(){}return e.prototype.export=function(t,r){this._sendLogRecords(t,r)},e.prototype.shutdown=function(){return Promise.resolve()},e.prototype._exportInfo=function(t){var r,n,i;return{resource:{attributes:t.resource.attributes},instrumentationScope:t.instrumentationScope,timestamp:Z(t.hrTime),traceId:(r=t.spanContext)===null||r===void 0?void 0:r.traceId,spanId:(n=t.spanContext)===null||n===void 0?void 0:n.spanId,traceFlags:(i=t.spanContext)===null||i===void 0?void 0:i.traceFlags,severityText:t.severityText,severityNumber:t.severityNumber,body:t.body,attributes:t.attributes}},e.prototype._sendLogRecords=function(t,r){var n,i;try{for(var o=Of(t),s=o.next();!s.done;s=o.next()){var c=s.value;console.dir(this._exportInfo(c),{depth:3})}}catch(l){n={error:l}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}r?.({code:x.SUCCESS})},e})();g();var Rf=function(e,t,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function c(u){try{a(n.next(u))}catch(f){s(f)}}function l(u){try{a(n.throw(u))}catch(f){s(f)}}function a(u){u.done?o(u.value):i(u.value).then(c,l)}a((n=n.apply(e,t||[])).next())})},xf=function(e,t){var r={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,i,o,s;return s={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function c(a){return function(u){return l([a,u])}}function l(a){if(n)throw new TypeError("Generator is already executing.");for(;r;)try{if(n=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return r.label++,{value:a[1],done:!1};case 5:r.label++,i=a[1],a=[0];continue;case 7:a=r.ops.pop(),r.trys.pop();continue;default:if(o=r.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){r=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){r.label=a[1];break}if(a[0]===6&&r.label<o[1]){r.label=o[1],o=a;break}if(o&&r.label<o[2]){r.label=o[2],r.ops.push(a);break}o[2]&&r.ops.pop(),r.trys.pop();continue}a=t.call(e,r)}catch(u){a=[6,u],i=0}finally{n=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}},cs=(function(){function e(t,r){var n,i,o,s;this._exporter=t,this._finishedLogRecords=[];var c=H();this._maxExportBatchSize=(n=r?.maxExportBatchSize)!==null&&n!==void 0?n:c.OTEL_BLRP_MAX_EXPORT_BATCH_SIZE,this._maxQueueSize=(i=r?.maxQueueSize)!==null&&i!==void 0?i:c.OTEL_BLRP_MAX_QUEUE_SIZE,this._scheduledDelayMillis=(o=r?.scheduledDelayMillis)!==null&&o!==void 0?o:c.OTEL_BLRP_SCHEDULE_DELAY,this._exportTimeoutMillis=(s=r?.exportTimeoutMillis)!==null&&s!==void 0?s:c.OTEL_BLRP_EXPORT_TIMEOUT,this._shutdownOnce=new ot(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(p.warn("BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize"),this._maxExportBatchSize=this._maxQueueSize)}return e.prototype.onEmit=function(t){this._shutdownOnce.isCalled||this._addToBuffer(t)},e.prototype.forceFlush=function(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()},e.prototype.shutdown=function(){return this._shutdownOnce.call()},e.prototype._shutdown=function(){return Rf(this,void 0,void 0,function(){return xf(this,function(t){switch(t.label){case 0:return this.onShutdown(),[4,this._flushAll()];case 1:return t.sent(),[4,this._exporter.shutdown()];case 2:return t.sent(),[2]}})})},e.prototype._addToBuffer=function(t){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(t),this._maybeStartTimer())},e.prototype._flushAll=function(){var t=this;return new Promise(function(r,n){for(var i=[],o=Math.ceil(t._finishedLogRecords.length/t._maxExportBatchSize),s=0;s<o;s++)i.push(t._flushOneBatch());Promise.all(i).then(function(){r()}).catch(n)})},e.prototype._flushOneBatch=function(){var t=this;return this._clearTimer(),this._finishedLogRecords.length===0?Promise.resolve():new Promise(function(r,n){nt(t._export(t._finishedLogRecords.splice(0,t._maxExportBatchSize)),t._exportTimeoutMillis).then(function(){return r()}).catch(n)})},e.prototype._maybeStartTimer=function(){var t=this;this._timer===void 0&&(this._timer=setTimeout(function(){t._flushOneBatch().then(function(){t._finishedLogRecords.length>0&&(t._clearTimer(),t._maybeStartTimer())}).catch(function(r){W(r)})},this._scheduledDelayMillis),ue(this._timer))},e.prototype._clearTimer=function(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)},e.prototype._export=function(t){var r=this,n=function(){return zt._export(r._exporter,t).then(function(o){var s;o.code!==x.SUCCESS&&W((s=o.error)!==null&&s!==void 0?s:new Error("BatchLogRecordProcessor: log record export failed (status "+o+")"))}).catch(W)},i=t.map(function(o){return o.resource}).filter(function(o){return o.asyncAttributesPending});return i.length===0?n():Promise.all(i.map(function(o){var s;return(s=o.waitForAsyncAttributes)===null||s===void 0?void 0:s.call(o)})).then(n,W)},e})();var Lf=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),we=(function(e){Lf(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onShutdown=function(){},t})(cs);var dt={TARGET:"target",NAMESPACE:"namespace",ENV_NAME:"envname",HOST_IP:"net.host.ip",HOST_NAME:"net.host.name",HOST_PORT:"net.host.port",CONTAINER_NAME:"container.name",SET_NAME:"set.name",SERVICE_NAME:"service.name",SERVER_OWNER:"server.owner",TENANT_ID:"tps.tenant.id",CMDB_ID:"cmdb.module.id",LANGUAGE:"telemetry.sdk.language",SDK_NAME:"telemetry.sdk.name",SDK_VERSION:"telemetry.sdk.version"};var us;(function(e){e.ClientStartedTotal="rpc_client_started_total",e.ClientHandledTotal="rpc_client_handled_total",e.ClientHandledSeconds="rpc_client_handled_seconds",e.ServerStartedTotal="rpc_server_started_total",e.ServerHandledTotal="rpc_server_handled_total",e.ServerHandledSeconds="rpc_server_handled_seconds"})(us||(us={}));var ls;(function(e){e.ProcessCpuUsage="process_cpu_usage",e.ProcessResidentMemoryUsage="process_resident_memory_usage",e.ProcessNetworkInBytes="process_network_in_bytes",e.ProcessNetworkOutBytes="process_network_out_bytes",e.ProcessBlockReadBytes="process_block_read_bytes",e.ProcessBlockWriteBytes="process_block_write_bytes",e.ProcessContainerNum="process_container_num",e.ProcessGpuUsage="process_gpu_usage",e.ProcessVideoMemoryUsage="process_video_memory_usage",e.ProcessDiskUsage="process_disk_usage",e.ProcessTcpNum="process_tcp_num",e.ProcessUdpNum="process_udp_num",e.ProcessMaxFds="process_max_fds",e.ProcessOpenFds="process_open_fds",e.ProcessPidNum="process_pid_num",e.ProcessDiskFree="process_disk_free",e.ProcessDiskUsed="process_disk_used",e.ProcessDiskUsedFraction="process_disk_used_fraction",e.ProcessCpuCores="process_cpu_cores"})(ls||(ls={}));var O;(function(e){e.CallerService="caller_service",e.CallerMethod="caller_method",e.CallerConSetid="caller_con_setid",e.CallerServer="caller_server",e.CalleeServer="callee_server",e.CalleeService="callee_service",e.CalleeMethod="callee_method",e.CalleeConSetid="callee_con_setid",e.CallerGroup="caller_group",e.CodeType="code_type",e.Code="code",e.UserExt1="user_ext1",e.UserExt2="user_ext2",e.UserExt3="user_ext3",e.CalleeIp="callee_ip",e.CalleeContainer="callee_container",e.CallerIp="caller_ip",e.CallerContainer="caller_container"})(O||(O={}));var fs;(function(e){e.clientMetrics="client_metrics",e.serverMetrics="server_metrics"})(fs||(fs={}));var M;(function(e){e.Target="target",e.EnvName="env_name",e.Namespace="namespace",e.ServiceName="service_name",e.ContainerName="container_name",e.Instance="instance",e.Version="version",e.ConSetid="con_setid"})(M||(M={}));var V;(function(e){e.Development="Development",e.Production="Production"})(V||(V={}));var te;(function(e){e.Formal="formal",e.Test="test"})(te||(te={}));var wr;(function(e){e.Webjs="webjs",e.Nodejs="nodejs"})(wr||(wr={}));var ps="galileo";g();var wf="https://galileotelemetry.tencent.com/v1/metrics";var _s="https://galileotelemetry.tencent.com/v1/logs";var bf="https://galileotelemetry.tencent.com/v1/metrics";var Pf="https://sg.tgalileo.com/v1/metrics";var Mf="http://galileotelemetry.tencent.com:80/v1/metrics";var If=e=>{try{let t=new URL(e).hostname.toLowerCase();if(t==="galileotelemetry.tencent.com")return"mainland-public";if(t==="sg.tgalileo.com"||t.endsWith(".sg.tgalileo.com"))return"singapore-public";if(t==="galileotelemetry.tencent.com"||t==="galileotelemetry.tencent.com"||t==="galileotelemetry.tencent.com"||t==="galileotelemetry.tencent.com")return"singapore-intranet"}catch{}return"mainland-intranet"};var ds=e=>{switch(If(e)){case"mainland-public":return bf;case"singapore-public":return Pf;case"singapore-intranet":return Mf;default:return wf}},be="0.3.12",ms="NodeStats",Nf=[O.UserExt1,O.UserExt2,O.UserExt3];var Cf={[O.CallerService]:"",[O.CallerMethod]:"",[O.CallerConSetid]:"",[O.CallerServer]:"",[O.CallerGroup]:"",[O.CallerIp]:"",[O.CallerContainer]:"",[O.CalleeService]:"",[O.CalleeMethod]:"",[O.CalleeConSetid]:"",[O.CalleeServer]:"",[O.CalleeIp]:"",[O.CalleeContainer]:""};g();var mt;(function(e){e[e.DELTA=0]="DELTA",e[e.CUMULATIVE=1]="CUMULATIVE",e[e.LOWMEMORY=2]="LOWMEMORY"})(mt||(mt={}));g();var Uf=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),Wn=function(){return R.CUMULATIVE},hs=function(e){switch(e){case _.COUNTER:case _.OBSERVABLE_COUNTER:case _.GAUGE:case _.HISTOGRAM:case _.OBSERVABLE_GAUGE:return R.DELTA;case _.UP_DOWN_COUNTER:case _.OBSERVABLE_UP_DOWN_COUNTER:return R.CUMULATIVE}},Es=function(e){switch(e){case _.COUNTER:case _.HISTOGRAM:return R.DELTA;case _.GAUGE:case _.UP_DOWN_COUNTER:case _.OBSERVABLE_UP_DOWN_COUNTER:case _.OBSERVABLE_COUNTER:case _.OBSERVABLE_GAUGE:return R.CUMULATIVE}};function Df(){var e=H(),t=e.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE.trim().toLowerCase();return t==="cumulative"?Wn:t==="delta"?hs:t==="lowmemory"?Es:(p.warn("OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE is set to '"+e.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE+"', but only 'cumulative' and 'delta' are allowed. Using default ('cumulative') instead."),Wn)}function Bf(e){return e!=null?e===mt.DELTA?hs:e===mt.LOWMEMORY?Es:Wn:Df()}function Gf(e){return e?.aggregationPreference?e.aggregationPreference:function(t){return P.Default()}}var gs=(function(e){Uf(t,e);function t(r,n){var i=e.call(this,r)||this;return i._aggregationSelector=Gf(n),i._aggregationTemporalitySelector=Bf(n?.temporalityPreference),i}return t.prototype.selectAggregation=function(r){return this._aggregationSelector(r)},t.prototype.selectAggregationTemporality=function(r){return this._aggregationTemporalitySelector(r)},t})(Ge);var vs="0.57.2";var Vf=(function(){var e=function(t,r){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,i){n.__proto__=i}||function(n,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(n[o]=i[o])},e(t,r)};return function(t,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");e(t,r);function n(){this.constructor=t}t.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}})(),br=function(){return br=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])}return e},br.apply(this,arguments)},kf={"User-Agent":"OTel-OTLP-Exporter-JavaScript/"+vs},ht=(function(e){Vf(t,e);function t(r){return e.call(this,ft(pt(r??{},"METRICS","v1/metrics",br(br({},kf),{"Content-Type":"application/json"})),Or),r)||this}return t})(gs);var Ts=e=>{let r=[new Cn({exporter:new ht({temporalityPreference:R.DELTA,url:e.addr,concurrencyLimit:30,compression:ke.GZIP}),exportIntervalMillis:3e4,exportTimeoutMillis:2e4})],n=[new yr({instrumentName:"node_instrument_start",aggregation:new ut,instrumentType:_.COUNTER}),new yr({instrumentName:"node_instrument_end",aggregation:new ut,instrumentType:_.COUNTER})];return new Hn({resource:e.resource,views:n,readers:r})};var ys=(e,t,r)=>Ts({resource:new B({[M.Target]:"PCG-123.galileo.otp",[M.ServiceName]:"galileo.otp",[M.Namespace]:V.Production,[M.EnvName]:e===V.Production?te.Formal:t,[M.Version]:be,[M.Instance]:"",[M.ContainerName]:"",[M.ConSetid]:""}),addr:r});var Ss=function(){let e=new WeakSet;return function(t,r){if(r instanceof Error)return`Error.message: ${r.message}
16
+ Error.stack: ${r.stack}`;if(typeof r=="object"&&r!==null){if(e.has(r))return`[Circular ${t||"root"}]`;e.add(r)}return r}},As=function(e){if(typeof e=="string")return e;try{return e instanceof Error?(JSON.stringify(e,Ss())||"undefined").replace(/"/gim,""):JSON.stringify(e,Ss())||"undefined"}catch(t){return`error happen when aegis stringify:
17
+ ${t?.message}
18
+ ${t?.stack}`}};var Os=()=>{var e;let t=ae.getSpan(N.active());return((e=t?.spanContext())===null||e===void 0?void 0:e.traceFlags)===oe.SAMPLED};var Et;(function(e){e.trace="trace",e.debug="debug",e.info="info",e.warn="warn",e.error="error"})(Et||(Et={}));var Pe;(function(e){e[e.trace=1]="trace",e[e.debug=5]="debug",e[e.info=9]="info",e[e.warn=13]="warn",e[e.error=17]="error"})(Pe||(Pe={}));function Hf(e){if(!e)return Et.trace;if(typeof e=="string"){let t=e.toLowerCase();return Object.values(Et).includes(t)?t:Et.trace}return e}var Pr=class{constructor(t){var r;this.getResource=yt=>{let{platform:oc,serverName:io}=this;return new B({[M.Target]:`${oc}.${io}`,[M.Namespace]:yt,[dt.SERVICE_NAME]:`${io}`,[dt.SDK_NAME]:ps,[dt.LANGUAGE]:wr.Nodejs,[dt.SDK_VERSION]:be})};let{env:n=te.Test,namespace:i,app:o,server:s,attributes:c={},platform:l,logCollectorAddr:a=_s,enableLocalConsole:u=!1,enableConsole:f=!1,level:d,mustLogTraced:T=!1}=t,b=i===V.Production?te.Formal:n,ne=ds(a);this.platform=l,this.serverName=`${o}.${s}`,this.enableLocalConsole=u,this.enableConsole=f,this.mustLogTraced=T;let he=(r=process.env)===null||r===void 0?void 0:r.GALILEO_LOG_LEVEL;if(this.currentLevel=Hf(d||he),!this.serverName)throw new Error("app and server are required");this.initLogRecorder(b,c),this.logger=this.initLogger(i,b,a),this.selfMeter=ys(i,b,ne).getMeter(ms,""),this.selfAttributes={SdkTarget:`${l}.${this.serverName}`,TargetNameSpace:i,ReportType:"log",Protocol:"",Kind:"",Status:""},this.nodeInstrumentStartCounter=this.selfMeter.createCounter("node_instrument_start",{valueType:L.INT}),this.nodeInstrumentEndCounter=this.selfMeter.createCounter("node_instrument_end",{valueType:L.INT});try{this.enableConsole&&this.overrideConsole()}catch{}}initLogRecorder(t,r){this.logRecorder={severityNumber:Ue.INFO,severityText:"info",body:"",attributes:{...r,server:this.serverName,env:t},instrumentationScope:{name:"default",version:be}}}updateLogRecorderAttributes(t){if(!t)throw new Error("attributes is required");this.logRecorder.attributes={...this.logRecorder.attributes,...t}}initLogger(t,r,n){let i=this.getResource(t),o=new $n({resource:i}),s={url:n,headers:{"Content-Type":"application/json"},concurrencyLimit:30},c=new _t(s),l=new we(c);return o.addLogRecordProcessor(l),this.enableLocalConsole&&t!==V.Production&&r!==te.Formal&&o.addLogRecordProcessor(new we(new Kn)),o.getLogger("default",be)}emit(t){this.logger.emit(t)}overrideConsole(){let t=console,r=this;["log","info","error","warn","debug","trace"].forEach(i=>{let o=t[i];console[i]=function(...s){try{let c=new Error().stack,l="";if(c){let a=c.split(`
19
+ `);a.length>2&&(l=a[2].trim())}if(l.includes("trpc-config-env"))return;if(!l.includes("galileo-node-sdk")){let a=s.map(u=>typeof u=="string"?u:As(u)).join(" ");i==="log"?r.method("info",`[Console.log] ${a}`):r.method(i,`[Console.${i}] ${a}`)}}catch{}o.apply(t,s)}})}shouldLog(t){return Pe[t]>=Pe[this.currentLevel]}method(t,r,n){var i,o;this.nodeInstrumentStartCounter.add(1,{...this.selfAttributes});let s=t;if(!(s in Pe))throw new Error(`method [${s}] not found`);if(!(this.mustLogTraced&&Os())&&!this.shouldLog(s))return;let l=n&&!(!((i=Object.values(n))===null||i===void 0)&&i.some(T=>typeof T!="string")),a={},u=ae.getSpan(N.active()),f=(o=u?.attributes)===null||o===void 0?void 0:o["http.user_agent"];f&&(a.user_agent=f);let d={...this.logRecorder,attributes:{...this.logRecorder.attributes,...a,...l?n:{}},severityNumber:Pe[s],severityText:s,body:r};this.nodeInstrumentEndCounter.add(1,{...this.selfAttributes,Status:"success"}),this.emit(d)}info(t,r){this.method("info",t,r)}error(t,r){this.method("error",t,r)}debug(t,r){this.method("debug",t,r)}trace(t,r){this.method("trace",t,r)}warn(t,r){this.method("warn",t,r)}sampledInfo(t,r){this.method("info",t,r)}};var Ff=!0,jf={siboot:"",coboot:"https://galileotelemetry.tencent.com"};function Rs(e,t,r={platform:e==="coboot"?"ElectronApp":"Electron",app:e,server:"app_main"}){let n=jf[e];return{...r,namespace:t?V.Production:V.Development,env:t?"formal":"test",metricsCollectorAddr:`${n}/v1/metrics`,traceCollectorAddr:`${n}/v1/traces`,logCollectorAddr:`${n}/v1/logs`,enableRemoteConfig:!1}}function xs(e){return new Pr(e)}var Yn=(e,t)=>e[t]?.trim()||void 0;function $f(e,t=process.env){return{platform:Yn(t,"CU_HEADLESS_GALILEO_PLATFORM")||(e==="coboot"?"ElectronApp":"Electron"),app:Yn(t,"CU_HEADLESS_GALILEO_APP")||e,server:Yn(t,"CU_HEADLESS_GALILEO_SERVER")||"app_main"}}function Ls(e,t,r=process.env){return{...Rs(e,t,$f(e,r)),enableHTTP:!1,enableTRPC:!1,enableFetch:!1,traceConfig:{enable:!1,processor:{sampler:{fraction:0,enableRandomSample:!1,enableParentSample:!1},enableTraceBody:!1}}}}var bs=16384,Xf=15100,zf=/(?:^|\s)(event|level|run_id|daemon_pid|pid|start_count|retry_ms|duration_ms|stopping|exit_signal|job_id|type|version|from_version|target_version|phase|exit_code)=([^\s]+)/g;function Ps(e){return At(e.replace(/https?:\/\/[^\s"'<>]+/gi,t=>{try{let r=new URL(t);return r.username="",r.password="",r.search="",r.hash="",r.toString()}catch{return"[redacted-url]"}}).replace(/\b(signature|sign|HEADLESS_DEVICE_TOKEN)\s*[:=]\s*[^\s,;]+/gi,"$1=[redacted]"))}function Jf(e){return/^\S+ \[daemon\] /.test(e)||e.startsWith("[daemon]")?"daemon":/^\S+ \[anydev-update\] /.test(e)?"update":"startup"}function Zf(e){if(!e.SIBOOT_BASE_DIR)return e.APP_VERSION||"unknown";try{return JSON.parse(Kf.readFileSync(Wf.join(e.SIBOOT_BASE_DIR,"current/manifest.json"),"utf8")).version||e.APP_VERSION||"unknown"}catch{return e.APP_VERSION||"unknown"}}function qf(e,t,r,n){let i={clientType:r.CLIENT_TYPE||"anydev",hostname:r.HOSTNAME||ws.hostname(),device_id:r.HOSTNAME||ws.hostname(),uid:r.CLIENT_UID||r.ANY_USERNAME||"",log_source:n,stream:t,version:Zf(r)};for(let s of e.matchAll(zf))i[s[1]]=s[2];return{level:i.level==="error"||t==="stderr"||i.level!=="info"&&/\b(failed|error|missing|job_failed)\b/i.test(e)?"error":"info",body:Ps(e),attributes:Object.fromEntries(Object.entries(i).map(([s,c])=>[s,Ps(c)]))}}var Mr=class{constructor(t){this.env=t;let r=Ls("coboot",!(t.BACKEND_URL||"").includes("testsite"),{});this.logger=xs({...r,enableConsole:!1,enableLocalConsole:!1})}logger;lastRecordAt=0;closing;record(t,r,n=Jf(t)){if(!t.trim()||this.closing)return;let i=qf(t,r,this.env,n);ao(this.logger,i.level,i.body,i.attributes),this.lastRecordAt=Date.now()}close(){let t=this.lastRecordAt?Math.max(0,Xf-(Date.now()-this.lastRecordAt)):0;return this.closing??=new Promise(r=>setTimeout(r,t)),this.closing}};function Ms(e){let t=new Yf("utf8"),r="",n=!1,i=o=>{for(let s of o.split(/(?<=\n)/))n||(r+=s,r.length>bs&&(r=r.slice(0,bs),n=!0)),s.endsWith(`
20
+ `)&&(e(r.trimEnd()),r="",n=!1)};return{write:o=>i(t.write(o)),end:()=>{i(t.end()),r&&e(r),r=""}}}function Is(e){if(process.env.ANYDEV_LOG_CAPTURED==="1"||e==="startup"&&process.argv.slice(2).includes("logs"))return()=>Promise.resolve();let t=new Mr(process.env),r=["stdout","stderr"].map(o=>{let s=process[o],c=s.write.bind(s),l=Ms(a=>t.record(a,o,e));return s.write=(a,u,f)=>(l.write(typeof a=="string"?Buffer.from(a,typeof u=="string"?u:void 0):Buffer.from(a)),typeof u=="function"?c(a,u):c(a,u,f)),{lines:l,stream:s,original:c}}),n,i=()=>{if(!n){for(let{lines:o,stream:s,original:c}of r)s.write=c,o.end();n=t.close()}return n};return process.once("beforeExit",()=>{i()}),i}import{execFileSync as kp,spawn as ec}from"child_process";import y from"fs";import Js from"os";import E from"path";import{fileURLToPath as Hp}from"url";var Qf=new Set(["help","install-browser","start","stop","restart","update","status","logs"]);function Ns(e="siboot-headless",t="/data/siboot",r=!1,n="SIBOOT_DATA_ROOT"){let i=r?` ${e} install-browser
21
+ `:"";console.log(`Usage:
3
22
  ${e} <device-token>
4
23
  ${e} --force-enroll <device-token>
5
- ${e} start|stop|restart|status|logs
24
+ ${i} ${e} start|stop|restart|update|status|logs
6
25
 
7
26
  Environment:
8
- SIBOOT_DATA_ROOT Persistent data root (default: ${n})`)}function w(e){let n=e[0]?.trim()||"";if(!n||n==="--help"||n==="-h"||n==="help")return{command:"help"};if(n==="--force-enroll"){let t=e[1]?.trim()||"";if(!t||e.length!==2)throw new Error("--force-enroll requires one device token");return{command:"install",token:t,forceEnroll:!0}}return k.has(n)?{command:n}:{command:"install",token:n}}import u from"fs";var T=e=>new Promise(n=>setTimeout(n,e));function x(e){if(!Number.isInteger(e)||e<=0)return!1;try{return process.kill(e,0),!0}catch{return!1}}function D(e){try{return JSON.parse(u.readFileSync(e,"utf8"))}catch{return null}}function v(e){let n=D(e);return!!(n?.deviceId?.trim()&&n?.credentialId?.trim()&&n?.ownerUid?.trim()&&n?.deviceName?.trim()&&n?.deviceType>0&&n?.publicKey?.trim()&&n?.privateKeyPem?.trim())}function I(e){return[e.credential,e.authSession]}function $(e){for(let n of e.entries){try{u.unlinkSync(n.file)}catch{}n.existed&&u.renameSync(n.backup,n.file)}}function N(e){let n=`${process.pid}-${Date.now()}`,t=I(e).map(r=>({file:r,backup:`${r}.force-enroll-${n}.bak`,existed:u.existsSync(r)})),o=[];try{for(let r of t)r.existed&&(u.renameSync(r.file,r.backup),o.push(r))}catch(r){for(let c of o.reverse())u.renameSync(c.backup,c.file);throw r}return{entries:t}}function H(e){for(let n of e.entries)n.existed&&u.unlinkSync(n.backup)}function F(e){$(e)}async function C(e,n){let t=Date.now()+n,o=0;for(;Date.now()<t;){let r=D(`${e.run}/status.json`);if(v(e.credential)&&r?.client_ready===!0&&x(r.client_pid)){if(o||=Date.now(),Date.now()-o>=1e3)return}else o=0;let c=Number.parseInt(u.readFileSync(`${e.run}/daemon.pid`,"utf8"),10);if(r?.client_exit_code!=null&&!r?.client_pid)throw new Error(`client exited during force enrollment with code ${r.client_exit_code}`);if(c&&!x(c))throw new Error("daemon exited during force enrollment");await T(100)}throw new Error(`force enrollment did not become ready within ${n}ms`)}async function y(e,n,t,o={}){let r=N(e);try{let c=await n();return await C(e,o.timeoutMs||15e3),H(r),c}catch(c){await t().catch(()=>{});try{F(r)}catch(a){throw new AggregateError([c,a],"force enrollment and rollback failed")}throw c}}var O=U(import.meta.url),b={siboot:"/data/siboot",coboot:"/data/coboot"},V=15e3,M=["BACKEND_URL","WS_URL","SIBOOT_URL","MCP_CREDENTIAL_API_BASE_URL","SKILL_CREDENTIAL_API_BASE_URL"],W=["HEADLESS_BWRAP_EXECUTABLE","HEADLESS_BWRAP_LOADER","HEADLESS_BWRAP_LIBRARY_DIR"];function J(e,n){let t=e||b[n],o=i.resolve(t);if(!i.isAbsolute(t)||o===i.parse(o).root)throw new Error(`SIBOOT_DATA_ROOT must be a non-root absolute path: ${e}`);return o}function K(e=process.env.SIBOOT_DATA_ROOT,n="siboot"){if(!(n in b))throw new Error(`unsupported headless edition: ${n}`);let t=J(e,n),o=i.join(t,".siboot");return{edition:n,root:t,home:o,releases:i.join(o,"releases"),current:i.join(o,"current"),scripts:i.join(o,"scripts"),run:i.join(o,"run"),logs:i.join(o,"logs"),workspace:i.join(t,"workspace"),credential:i.join(o,"headless-device-credential.json"),authSession:i.join(o,"headless-auth-session.json")}}function L(e){for(let n of[e.home,e.releases,e.scripts,e.run,e.workspace,i.join(e.logs,"daemon"),i.join(e.logs,"client"),i.join(e.logs,"update")])s.mkdirSync(n,{recursive:!0,mode:448})}function R(e){let n=JSON.parse(s.readFileSync(i.join(e,"package.json"),"utf8")),t=String(n.version||"").trim();if(!t||!/^[0-9A-Za-z._-]+$/.test(t))throw new Error("package version is missing or invalid");let o=String(n.headlessEdition||"").trim();if(!(o in b))throw new Error("package headlessEdition must be siboot or coboot");let r=n.headlessLinuxSandbox??null;if(o==="siboot"&&r)throw new Error("Siboot package must not include Linux sandbox metadata");if(o==="coboot"&&(r?.backend!=="bubblewrap"||!Array.isArray(r.architectures)||r.architectures.length===0))throw new Error("Coboot package is missing bundled Linux sandbox metadata");return{version:t,edition:o,linuxSandbox:r}}function Y(e,n){let t=i.relative(e.home,n),o=`${e.current}.next-${process.pid}`;try{s.unlinkSync(o)}catch{}s.symlinkSync(t,o),s.renameSync(o,e.current)}function p(e,n,t){let o=`${n}.next-${process.pid}`;s.copyFileSync(e,o),s.chmodSync(o,t),s.renameSync(o,n)}function X(e,n,t){let o=`${e}.next-${process.pid}`;s.writeFileSync(o,n,{mode:t}),s.renameSync(o,e)}function Q(e){return B("sha256").update(s.readFileSync(e)).digest("hex")}function q(e,n){if(!s.existsSync(e)||Q(e)!==n)throw new Error(`bundled Linux sandbox file failed integrity check: ${i.basename(e)}`)}function z(e,n,t,o){if(!t)return null;if(o.platform!=="linux")throw new Error(`Coboot Headless bundled sandbox supports Linux only: ${o.platform}`);if(!t.architectures.includes(o.arch))throw new Error(`Coboot Headless does not include Linux sandbox for arch: ${o.arch}`);let r=i.join(e,"native",`linux-${o.arch}`),c=i.join(r,"manifest.json");if(!s.existsSync(c))throw new Error(`package is missing Linux sandbox bundle for arch: ${o.arch}`);let a=JSON.parse(s.readFileSync(c,"utf8"));if(a.backend!==t.backend||a.backendVersion!==t.backendVersion||a.arch!==o.arch)throw new Error("bundled Linux sandbox manifest does not match package metadata");let l={bwrap:i.join(r,"bwrap"),loader:i.join(r,"ld-musl"),libcap:i.join(r,"lib","libcap.so.2")};for(let[m,E]of Object.entries(l))q(E,a.files?.[m]);let d=i.join(n,"native");return s.mkdirSync(i.join(d,"lib"),{recursive:!0,mode:448}),p(l.bwrap,i.join(d,"bwrap"),320),p(l.loader,i.join(d,"ld-musl"),320),p(l.libcap,i.join(d,"lib","libcap.so.2"),256),p(c,i.join(d,"manifest.json"),256),{backend:a.backend,version:a.backendVersion,arch:a.arch,bundled:!0}}function G(e,n,t={platform:process.platform,arch:process.arch}){L(n);let{version:o,edition:r,linuxSandbox:c}=R(e);if(r!==n.edition)throw new Error(`package edition ${r} does not match runtime layout ${n.edition}`);let a=i.join(n.releases,o);s.mkdirSync(a,{recursive:!0,mode:448});let l=i.join(e,"entry.mjs"),d=i.join(e,"daemon.mjs");if(!s.existsSync(l)||!s.existsSync(d))throw new Error("package is missing entry.mjs or daemon.mjs");p(l,i.join(a,"entry.mjs"),320),p(d,i.join(n.scripts,"daemon.mjs"),320);let m=z(e,a,c,t);return X(i.join(a,"manifest.json"),`${JSON.stringify({type:"headless-npm-daemon",version:o,edition:r,browserRuntime:"disabled",linuxSandbox:m},null,2)}
9
- `,256),Y(n,a),{version:o,releaseDir:a}}function h(e){try{let n=Number.parseInt(s.readFileSync(e,"utf8").trim(),10);return Number.isInteger(n)&&n>0?n:null}catch{return null}}function f(e){if(!e)return!1;try{return process.kill(e,0),!0}catch{return!1}}function Z(e,n){let t="";try{t=s.readFileSync(`/proc/${e}/cmdline`,"utf8").replaceAll("\0"," ").trim()}catch{}if(!t)try{t=P("ps",["-ww","-p",String(e),"-o","command="],{encoding:"utf8"}).trim()}catch{return!1}return[n,_(n)].some(o=>t.includes(o))}var g=e=>new Promise(n=>setTimeout(n,e));async function S(e){let n=i.join(e.run,"daemon.pid"),t=h(n);if(!f(t)){try{s.unlinkSync(n)}catch{}return!1}let o=i.join(e.scripts,"daemon.mjs");if(!Z(t,o))throw new Error(`refusing to stop unrelated process from stale daemon.pid: ${t}`);process.kill(t,"SIGTERM");for(let r=0;r<50&&f(t);r+=1)await g(100);if(f(t))throw new Error(`daemon did not stop within 5 seconds: ${t}`);return!0}function ee(e,n,t=process.env){let o={...t,CU_EDITION:e.edition,NO_ELECTRON:"1",CLIENT_TYPE:"anydev",SIBOOT_BASE_DIR:e.home,SIBOOT_DATA_ROOT:e.root,HEADLESS_DATA_DIR:e.root,SIBOOT_DATA_DIR:e.root,HEADLESS_DEVICE_CREDENTIAL_PATH:e.credential,HEADLESS_AUTH_SESSION_PATH:e.authSession,HEADLESS_DEVICE_REQUIRE_AUTH:"1",HEADLESS_PREWARM_DEFAULT_SESSION:"0",WORKSPACE:e.workspace,ANYDEV_UPDATE_ENABLED:"0"};n?o.HEADLESS_DEVICE_TOKEN=n:delete o.HEADLESS_DEVICE_TOKEN,delete o.CLIENT_UID,delete o.HEADLESS_DEVICE_FORCE_ENROLL;for(let r of W)delete o[r];if(e.edition==="coboot"){let r=i.join(e.current,"native");o.HEADLESS_BWRAP_EXECUTABLE=i.join(r,"bwrap"),o.HEADLESS_BWRAP_LOADER=i.join(r,"ld-musl"),o.HEADLESS_BWRAP_LIBRARY_DIR=i.join(r,"lib")}if(o.HEADLESS_ALLOW_ENDPOINT_OVERRIDE!=="1")for(let r of M)delete o[r];return o}async function ne(e,n=V){let t=Date.now()+n;for(;Date.now()<t;){let o=h(i.join(e.run,"daemon.pid"));if(!f(o))throw new Error("daemon exited during client startup");let r=null;try{r=JSON.parse(s.readFileSync(i.join(e.run,"status.json"),"utf8"))}catch{}if(r?.client_ready===!0&&f(r.client_pid))return;if(r?.client_exit_code!=null&&!r?.client_pid)throw new Error(`client exited during startup with code ${r.client_exit_code}`);await g(100)}throw new Error(`client did not become ready within ${n}ms`)}async function oe(e,n=""){L(e);let t=e.edition==="coboot"?"coboot-headless":"siboot-headless";if(!s.existsSync(e.credential)&&!n)throw new Error(`device credential is missing; run ${t} <device-token> first`);let o=i.join(e.scripts,"daemon.mjs");if(!s.existsSync(i.join(e.current,"entry.mjs"))||!s.existsSync(o))throw new Error(`runtime is not installed; run ${t} <device-token> first`);let r=s.existsSync(e.credential)?"":n,c=i.join(e.logs,"daemon",`${new Date().toISOString().slice(0,10)}.log`),a=s.openSync(c,"a",384);j(process.execPath,[o],{detached:!0,env:ee(e,r),stdio:["ignore",a,a]}).unref(),s.closeSync(a),await g(500);let d=h(i.join(e.run,"daemon.pid"));if(!f(d))throw new Error(`daemon failed to start; check ${c}`);return await ne(e),{pid:d,logFile:c}}function re(e){let n=h(i.join(e.run,"daemon.pid")),t=null;try{t=JSON.parse(s.readFileSync(i.join(e.run,"status.json"),"utf8"))}catch{}console.log(JSON.stringify({running:f(n),pid:n,current:s.existsSync(e.current),status:t},null,2))}async function te(e){let n=i.join(e.logs,"daemon",`${new Date().toISOString().slice(0,10)}.log`);if(!s.existsSync(n))throw new Error(`log file not found: ${n}`);let t=j("tail",["-n","100","-f",n],{stdio:"inherit"});await new Promise((o,r)=>{t.once("error",r),t.once("exit",c=>c===0?o():r(new Error(`tail exited ${c}`)))})}async function ie(){let e=w(process.argv.slice(2)),n=i.basename(process.argv[1]||"siboot-headless"),t=i.dirname(O),o=R(t),r=K(process.env.SIBOOT_DATA_ROOT,o.edition);if(e.command==="help")return A(n,r.root);let c=o.edition==="coboot"?"Coboot":"Siboot";if(e.command==="status")return re(r);if(e.command==="logs")return te(r);if(e.command==="stop"){let m=await S(r);console.log(m?`${c} Headless stopped`:`${c} Headless is not running`);return}await S(r);let a=async()=>{let m=G(t,r);try{let E=await oe(r,e.token||"");return{installed:m,started:E}}catch(E){throw await S(r).catch(()=>{}),E}},{installed:l,started:d}=e.forceEnroll?await y(r,a,()=>S(r)):await a();console.log(`${c} Headless ${l.version} started in background (pid=${d.pid})`),e.forceEnroll&&console.log("Device credential replaced by force enrollment"),console.log(`Logs: ${d.logFile}`)}function _(e){try{return s.realpathSync(e)}catch{return i.resolve(e)}}process.argv[1]&&_(process.argv[1])===_(O)&&ie().catch(e=>{let n=i.basename(process.argv[1]||"headless-client");console.error(`${n}: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1});export{ee as createDaemonEnv,G as installHeadlessRuntime,w as parseHeadlessCliArgs,R as readPackageMetadata,K as resolveHeadlessLayout,oe as startHeadlessRuntime,S as stopHeadlessRuntime};
27
+ ${n} Persistent data root (default: ${t})${n==="COBOOT_DATA_ROOT"?`
28
+ --workspace-dir <absolute-directory> Default Agent working directory (persisted)`:""}`)}function Ir(e,t="siboot"){let r=e.indexOf("--workspace-dir");if(r!==-1){if(t!=="coboot")throw new Error("--workspace-dir is available in Coboot only");let i=e[r+1];if(!i||i.startsWith("--"))throw new Error("--workspace-dir requires a directory");let o=[...e.slice(0,r),...e.slice(r+2)];if(o.includes("--workspace-dir"))throw new Error("--workspace-dir may be specified only once");let s=Ir(o,t);if(!["install","start","restart","update"].includes(s.command))throw new Error("--workspace-dir requires install, start, restart or update");return{...s,workspaceDir:i}}let n=e[0]?.trim()||"";if(!n||n==="--help"||n==="-h"||n==="help")return{command:"help"};if(n==="--force-enroll"){let i=e[1]?.trim()||"";if(!i||e.length!==2)throw new Error("--force-enroll requires one device token");return{command:"install",token:i,forceEnroll:!0}}return Qf.has(n)?{command:n}:{command:"install",token:n}}import{execFileSync as Ds}from"child_process";import{createRequire as ep}from"module";import re from"fs";import tp from"os";import j from"path";var rp=["/usr/local/bin/google-chrome","/usr/local/bin/chromium","/usr/local/bin/chromium-browser","/usr/bin/google-chrome","/usr/bin/google-chrome-stable","/usr/bin/chromium","/usr/bin/chromium-browser"],np="https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm",op="https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb",ip=[/error while loading shared libraries:\s*([^\s:]+)/gi,/([A-Za-z0-9_.+-]+\.so(?:\.[0-9A-Za-z.]+)?):\s*cannot open shared object file/gi,/Missing libraries:\s*([^]*?)(?:\n\s*\n|$)/gi],ap=[/error while loading shared libraries:/i,/cannot open shared object file/i,/host system is missing dependencies/i,/missing libraries:/i];function Jn(e,t=process.env){let r=t.PLAYWRIGHT_BROWSERS_PATH?.trim();return r||j.join(e,"browsers")}function zn(e){try{return re.accessSync(e,re.constants.X_OK),!0}catch{return!1}}function Nr(e){for(let t of(process.env.PATH||"").split(j.delimiter)){if(!t)continue;let r=j.join(t,e);if(zn(r))return r}return null}function Cs(){let e=process.env.HEADLESS_BROWSER_EXECUTABLE?.trim();if(e&&zn(e))return e;for(let t of rp)if(zn(t))return t;return Nr("google-chrome")||Nr("google-chrome-stable")||Nr("chromium")}function sp(e){return ap.some(t=>t.test(e))}function cp(e){let t=new Set;for(let r of ip){r.lastIndex=0;for(let n of e.matchAll(r))for(let i of n[1].split(/[\s,]+/)){let o=i.trim().replace(/[.,:;]+$/,"");/\.so(?:\.[0-9A-Za-z.]+)?$/.test(o)&&t.add(o)}}return[...t]}function up(e={arch:process.arch},t=Nr){let r=e.arch==="x64";if(t("apt-get"))return[{command:"apt-get",args:["update"],optional:!0},{attempts:[{command:"apt-get",args:["install","-y","--no-install-recommends","chromium"]},{command:"apt-get",args:["install","-y","--no-install-recommends","chromium-browser"]},...r?[{download:op,command:"apt-get",args:["install","-y","--no-install-recommends"]}]:[]]}];if(t("apk"))return[{attempts:[{command:"apk",args:["add","--no-cache","chromium"]},{command:"apk",args:["add","--no-cache","--repository=https://dl-cdn.alpinelinux.org/alpine/edge/community","chromium"]}]}];let n=t("dnf")?"dnf":t("yum")?"yum":"";if(n){let i=[{command:n,args:["install","-y","--setopt=install_weak_deps=False","chromium"]}];return r&&i.push({command:n,args:["install","-y","--setopt=install_weak_deps=False",np]}),[{attempts:i}]}throw new Error("unsupported Linux package manager; install system Chrome/Chromium manually and set HEADLESS_BROWSER_EXECUTABLE")}async function lp(e){let t=re.mkdtempSync(j.join(tp.tmpdir(),"coboot-browser-")),r=j.join(t,j.basename(new URL(e).pathname)||"browser-package");console.log(`Downloading: ${e}`);let n=await fetch(e);if(!n.ok)throw new Error(`download failed with HTTP ${n.status}: ${e}`);return re.writeFileSync(r,Buffer.from(await n.arrayBuffer())),{file:r,directory:t}}async function Us(e){let t=e.download?await lp(e.download):null,r=t?[...e.args,t.file]:e.args;try{console.log(`Running: ${e.command} ${r.join(" ")}`),Ds(e.command,r,{stdio:"inherit",env:{...process.env,DEBIAN_FRONTEND:"noninteractive"}})}finally{t&&re.rmSync(t.directory,{recursive:!0,force:!0})}}function gt(e){return e instanceof Error?e.message:String(e)}async function fp(){for(let e of up()){if(!e.attempts){try{await Us(e)}catch(n){if(!e.optional)throw n;console.warn(`Skipping optional step ${e.command}: ${gt(n)}`)}continue}let t=[],r=!1;for(let n of e.attempts)try{await Us(n),r=!0;break}catch(i){let o=n.download||n.args[n.args.length-1];t.push(`${o}: ${gt(i)}`),console.warn(`Browser package candidate failed (${o}); trying the next one`)}if(!r)throw new Error(`no browser package could be installed:
29
+ ${t.join(`
30
+ `)}`)}}function Bs(e){let t=j.join(e,"browser-runtime","playwright-core"),r=ep(j.join(e,"package.json"));return{driverRoot:t,driver:r(t)}}async function pp(e,t){let{driverRoot:r,driver:n}=Bs(e),i=j.join(r,"cli.js"),o=process.env.PLAYWRIGHT_BROWSERS_PATH;try{re.mkdirSync(o,{recursive:!0,mode:448})}catch(s){throw new Error(`\u65E0\u6CD5\u521B\u5EFA\u6D4F\u89C8\u5668\u76EE\u5F55\uFF08${t}\uFF09: ${s?.code||"write failed"}
31
+ \u8BF7\u786E\u8BA4\u5F53\u524D\u7528\u6237\u5BF9\u8BE5\u76EE\u5F55\u6709\u5199\u6743\u9650\uFF0C\u6216\u7528\u8BE5\u76EE\u5F55\u7684\u5C5E\u4E3B\u8D26\u53F7\u91CD\u65B0\u6267\u884C\u3002`)}return console.log(`Downloading Chromium into ${t}`),Ds(process.execPath,[i,"install","chromium","--no-shell"],{stdio:"inherit"}),n.chromium.executablePath()}async function _p(e,t){let{driver:r}=Bs(e),n=await r.chromium.launch({executablePath:t,headless:!0,args:["--no-sandbox","--disable-gpu","--disable-dev-shm-usage"]});try{let i=await n.newPage();if(await i.setContent("<title>Headless browser ready</title>"),await i.title()!=="Headless browser ready")throw new Error("browser smoke test returned wrong title");return n.version()}finally{await n.close()}}function dp(e,t){let r=cp(t),n=r.length?`\u7F3A\u5C11\u7CFB\u7EDF\u52A8\u6001\u5E93: ${r.join(", ")}`:"\u7F3A\u5C11\u7CFB\u7EDF\u4F9D\u8D56\u5E93";return new Error([`${e} \u65E0\u6CD5\u542F\u52A8\uFF0C${n}\u3002`,"\u8865\u9F50\u7CFB\u7EDF\u4F9D\u8D56\u9700\u8981 root \u6743\u9650\uFF0C\u8BF7\u7528 sudo \u91CD\u65B0\u6267\u884C\u540C\u4E00\u6761 install-browser \u547D\u4EE4\uFF0C\u6216\u8BA9\u7BA1\u7406\u5458\u5B89\u88C5\u4E0A\u8FF0\u5E93\u3002",`\u539F\u59CB\u9519\u8BEF: ${t}`].join(`
32
+ `))}async function Xn(e,t){console.log(`Browser executable: ${t}`);try{let r=await _p(e,t);return console.log(`Browser smoke test passed: ${r}`),{executablePath:t,version:r}}catch(r){let n=gt(r);throw sp(n)?dp(t,n):r}}function mp(e){try{let t=j.join(e.run,"daemon.pid"),r=Number.parseInt(re.readFileSync(t,"utf8").trim(),10);return!Number.isInteger(r)||r<=0?null:re.statSync(`/proc/${r}`).uid}catch{return null}}function hp(e,t){let r=mp(e),n=process.getuid?.();r===null||n===void 0||r===n||console.warn([`\u6CE8\u610F: daemon \u6B63\u4EE5 uid=${r} \u8FD0\u884C\uFF0C\u800C\u6D4F\u89C8\u5668\u88C5\u5728 uid=${n} \u540D\u4E0B\u7684${t}\u3002`,"daemon \u53EF\u80FD\u65E0\u6743\u8BFB\u53D6\u8BE5\u76EE\u5F55\u3002\u8BF7\u6539\u7528 daemon \u6240\u5C5E\u8D26\u53F7\u91CD\u65B0\u6267\u884C\u672C\u547D\u4EE4\uFF0C","\u6216\u4EE5 root \u6267\u884C\u8BA9\u5305\u7BA1\u7406\u5668\u628A\u6D4F\u89C8\u5668\u88C5\u5230\u7CFB\u7EDF\u8DEF\u5F84\u3002"].join(`
33
+ `))}async function Gs(e,t){if(process.platform!=="linux")throw new Error("install-browser currently supports Linux only");let r=process.env.PLAYWRIGHT_BROWSERS_PATH?.trim()?process.env.PLAYWRIGHT_BROWSERS_PATH.trim():`\u6570\u636E\u6839 ${t.root} \u4E0B\u7684\u6D4F\u89C8\u5668\u76EE\u5F55`,n=Jn(t.home);process.env.PLAYWRIGHT_BROWSERS_PATH=n;let i=Cs();if(i)try{return await Xn(e,i)}catch(c){console.warn(`Existing browser failed the smoke test: ${gt(c)}`)}if(process.getuid?.()===0)try{await fp();let c=Cs();if(c)return await Xn(e,c);console.warn("\u5305\u7BA1\u7406\u5668\u6267\u884C\u5B8C\u6210\u4F46\u6CA1\u6709\u627E\u5230\u6D4F\u89C8\u5668\uFF0C\u56DE\u9000\u5230\u4E0B\u8F7D\u5B89\u88C5")}catch(c){console.warn(`\u7CFB\u7EDF\u5305\u7BA1\u7406\u5668\u5B89\u88C5\u5931\u8D25\uFF0C\u56DE\u9000\u5230\u4E0B\u8F7D\u5B89\u88C5: ${gt(c)}`)}let o=await pp(e,r),s=await Xn(e,o);return console.log(`\u6D4F\u89C8\u5668\u5DF2\u88C5\u5165${r}\uFF0Cdaemon \u542F\u52A8\u65F6\u4F1A\u6307\u5411\u540C\u4E00\u76EE\u5F55\uFF0C\u65E0\u9700\u8BBE\u7F6E\u73AF\u5883\u53D8\u91CF\u3002`),hp(t,r),i&&console.warn([`\u6CE8\u610F: ${i} \u4ECD\u7136\u5B58\u5728\u4E14\u4F1A\u88AB\u4F18\u5148\u4F7F\u7528\uFF0C\u4F46\u5B83\u65E0\u6CD5\u542F\u52A8\u3002`,`\u8BF7\u7528 HEADLESS_BROWSER_EXECUTABLE=${o} \u91CD\u65B0\u542F\u52A8 daemon\uFF0C\u6216\u4EE5 root \u4FEE\u590D\u8BE5\u7CFB\u7EDF\u6D4F\u89C8\u5668\u3002`].join(`
34
+ `)),s}import U from"fs";import{createHash as Ep}from"crypto";var Vs=/^[a-f0-9]{64}$/,gp=e=>new Promise(t=>setTimeout(t,e));function ks(e){if(!Number.isInteger(e)||e<=0)return!1;try{return process.kill(e,0),!0}catch{return!1}}function Zn(e){try{return JSON.parse(U.readFileSync(e,"utf8"))}catch{return null}}function Hs(e){let t=Zn(e);return!!(t?.deviceId?.trim()&&t?.credentialId?.trim()&&t?.ownerUid?.trim()&&t?.deviceName?.trim()&&t?.deviceType>0&&t?.publicKey?.trim()&&t?.privateKeyPem?.trim())}function vp(e){return[e.credential,e.authSession,e.enrollmentReceipt]}function qn(e){return Ep("sha256").update(e).digest("hex")}function Fs(e){if(!Hs(e.credential))return null;let t=Zn(e.credential);return qn(JSON.stringify([t.deviceId,t.credentialId,t.ownerUid,t.publicKey]))}function js(e,t){let r;try{r=JSON.parse(U.readFileSync(e.enrollmentReceipt,"utf8"))}catch(n){if(n.code==="ENOENT")return!1;throw n}if(r?.schemaVersion!==1||!Vs.test(r.tokenHash)||!Vs.test(r.credentialHash))throw new Error("invalid headless enrollment receipt; inspect the installation before retrying");return r.tokenHash===qn(t.trim())&&r.credentialHash===Fs(e)}function Tp(e,t){let r=Fs(e);if(!r)throw new Error("cannot record enrollment without a complete device credential");let n=`${e.enrollmentReceipt}.${process.pid}.tmp`;try{U.writeFileSync(n,JSON.stringify({schemaVersion:1,tokenHash:qn(t.trim()),credentialHash:r})+`
35
+ `,{mode:384}),U.renameSync(n,e.enrollmentReceipt)}finally{U.rmSync(n,{force:!0})}}function Sp(e){for(let t of e.entries){try{U.unlinkSync(t.file)}catch{}t.existed&&U.renameSync(t.backup,t.file)}}function yp(e){let t=`${process.pid}-${Date.now()}`,r=vp(e).map(i=>({file:i,backup:`${i}.force-enroll-${t}.bak`,existed:U.existsSync(i)})),n=[];try{for(let i of r)i.existed&&(U.renameSync(i.file,i.backup),n.push(i))}catch(i){for(let o of n.reverse())U.renameSync(o.backup,o.file);throw i}return{entries:r}}function Ap(e){for(let t of e.entries)t.existed&&U.unlinkSync(t.backup)}function Op(e){Sp(e)}async function Rp(e,t){let r=Date.now()+t,n=0;for(;Date.now()<r;){let i=Zn(`${e.run}/status.json`);if(Hs(e.credential)&&i?.client_ready===!0&&ks(i.client_pid)){if(n||=Date.now(),Date.now()-n>=1e3)return}else n=0;let o=Number.parseInt(U.readFileSync(`${e.run}/daemon.pid`,"utf8"),10);if(i?.client_exit_code!=null&&!i?.client_pid)throw new Error(`client exited during force enrollment with code ${i.client_exit_code}`);if(o&&!ks(o))throw new Error("daemon exited during force enrollment");await gp(100)}throw new Error(`force enrollment did not become ready within ${t}ms`)}async function $s(e,t,r,n={}){let i=yp(e);try{let o=await t();return await Rp(e,n.timeoutMs||15e3),n.token&&Tp(e,n.token),Ap(i),o}catch(o){await r().catch(()=>{});try{Op(i)}catch(s){throw new AggregateError([o,s],"force enrollment and rollback failed")}throw o}}import Y from"fs";import xp from"os";import A from"path";var Me={siboot:"SIBOOT_DATA_ROOT",coboot:"COBOOT_DATA_ROOT"};function vt(e,t){if(typeof e!="string"||!A.isAbsolute(e)||A.resolve(e)===A.parse(e).root)throw new Error(`${t} must be a non-root absolute path`);return A.resolve(e)}function eo(e=process.env){let t=e.XDG_DATA_HOME?.trim()||A.join(e.HOME||xp.homedir(),".local","share");return A.join(vt(t,"XDG_DATA_HOME or HOME"),"coboot-headless")}function Cr(e,t=process.env){let r=t.SIBOOT_DATA_ROOT?.trim()||"";if(e!=="coboot")return r;let n=t.COBOOT_DATA_ROOT?.trim()||"";if(r&&r!==n)throw new Error(`SIBOOT_DATA_ROOT is not a Coboot installation setting; use COBOOT_DATA_ROOT=${r} instead`);return n}function Qn(e,t="siboot",r=process.env){if(!(t in Me))throw new Error(`unsupported headless edition: ${t}`);let n=t==="coboot"?eo(r):"/data/siboot",i=vt(e||n,Me[t]),o=A.join(i,`.${t}`);return{edition:t,root:i,home:o,releases:A.join(o,"releases"),current:A.join(o,"current"),scripts:A.join(o,"scripts"),run:A.join(o,"run"),logs:A.join(o,"logs"),workspace:A.join(i,"workspace"),credential:A.join(o,"headless-device-credential.json"),authSession:A.join(o,"headless-auth-session.json"),enrollmentReceipt:A.join(o,"headless-enrollment-receipt.json"),updateState:A.join(o,"run","runtime-update-state.json"),updateLock:A.join(o,"run","runtime-update.lock"),updater:A.join(o,"scripts","updater.mjs")}}function Ks(e=process.env){return A.join(eo(e),"installation.json")}function Ws(e=process.env){let t=Ks(e),r;try{r=Y.readFileSync(t,"utf8")}catch(n){if(n.code==="ENOENT")return null;throw n}try{let n=JSON.parse(r);if(n.schemaVersion!==1)throw new Error("unsupported schemaVersion");return{dataRoot:vt(n.dataRoot,"recorded dataRoot"),workingDirectory:n.workingDirectory===null?null:vt(n.workingDirectory,"recorded workingDirectory")}}catch(n){throw new Error(`invalid Coboot installation record at ${t}; repair the record before continuing`,{cause:n})}}function Ys(e,t=process.env,r={}){let n=Cr(e,t);if(e!=="coboot")return Qn(n,e,t);let i=Ws(t),o=n||i?.dataRoot||eo(t),s=Qn(o,e,t),c=i?.dataRoot===s.root?i.workingDirectory:null;return s.workingDirectory=r.workspaceDir===void 0?c:vt(r.workspaceDir,"--workspace-dir"),s}function Lp(e){if(!(e.edition!=="coboot"||!e.workingDirectory)){if(!Y.statSync(e.workingDirectory).isDirectory())throw new Error("--workspace-dir must refer to an existing directory");Y.accessSync(e.workingDirectory,Y.constants.R_OK|Y.constants.X_OK)}}function to(e,t=process.env){if(e.edition!=="coboot")return;let r=Ws(t);if(r&&r.dataRoot!==e.root)throw new Error("cannot switch a registered Coboot installation to another data root; keep the recorded COBOOT_DATA_ROOT");Lp(e)}function Xs(e,t=process.env){if(e.edition!=="coboot")return;to(e,t);let r=Ks(t);Y.mkdirSync(A.dirname(r),{recursive:!0,mode:448});let n=`${r}.${process.pid}.tmp`,i=!1;try{Y.writeFileSync(n,JSON.stringify({schemaVersion:1,dataRoot:e.root,workingDirectory:e.workingDirectory||null})+`
36
+ `,{mode:384,flag:"wx"}),i=!0,Y.renameSync(n,r)}finally{i&&Y.rmSync(n,{force:!0})}}import{createHash as zs}from"crypto";import m from"fs";import h from"path";var wp=new Set(["siboot","coboot"]);function ro(e){for(let t of[e.home,e.releases,e.scripts,e.run,e.workspace,h.join(e.logs,"daemon"),h.join(e.logs,"client"),h.join(e.logs,"update")])m.mkdirSync(t,{recursive:!0,mode:448})}function Tt(e){let t=JSON.parse(m.readFileSync(h.join(e,"package.json"),"utf8")),r=String(t.name||"").trim();if(!/^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/i.test(r))throw new Error("package name is missing or invalid");let n=String(t.version||"").trim();if(!n||!/^[0-9A-Za-z._-]+$/.test(n))throw new Error("package version is missing or invalid");let i=String(t.headlessEdition||"").trim();if(!wp.has(i))throw new Error("package headlessEdition must be siboot or coboot");let o=t.headlessLinuxSandbox??null;bp(i,o);let s=t.headlessBrowserRuntime??null;return Pp(i,s),{packageName:r,version:n,edition:i,linuxSandbox:o,browserRuntime:s}}function bp(e,t){if(e==="siboot"&&t)throw new Error("Siboot package must not include Linux sandbox metadata");if(e==="coboot"&&(t?.backend!=="bubblewrap"||!Array.isArray(t.architectures)||t.architectures.length===0))throw new Error("Coboot package is missing bundled Linux sandbox metadata")}function Pp(e,t){if(e==="siboot"&&t)throw new Error("Siboot package must not include guided browser runtime metadata");if(e==="coboot"&&(t?.driver!=="playwright-core"||!/^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/.test(t.driverVersion||"")||t?.browser!=="system-or-guided-install"))throw new Error("Coboot package is missing valid guided browser runtime metadata")}function Mp(e,t){let r=h.relative(e.home,t),n=`${e.current}.next-${process.pid}`;m.rmSync(n,{force:!0}),m.symlinkSync(r,n),m.renameSync(n,e.current)}function no(e){try{let t=m.readlinkSync(e.current);return h.resolve(h.dirname(e.current),t)}catch{try{return m.realpathSync(e.current)}catch{return null}}}function X(e,t,r){let n=`${t}.next-${process.pid}`;m.copyFileSync(e,n),m.chmodSync(n,r),m.renameSync(n,t)}function Ip(e,t,r){let n=`${e}.next-${process.pid}`;m.writeFileSync(n,t,{mode:r}),m.renameSync(n,e)}function Np(e){return zs("sha256").update(m.readFileSync(e)).digest("hex")}function Cp(e){let t=zs("sha256"),r=n=>{for(let i of m.readdirSync(n).sort()){let o=h.join(n,i);if(m.statSync(o).isDirectory())r(o);else{let s=m.readFileSync(o);t.update(JSON.stringify([h.relative(e,o),s.length])).update(s)}}};return r(e),t.digest("hex")}function Up(e,t){if(!m.existsSync(e)||Np(e)!==t)throw new Error(`bundled Linux sandbox file failed integrity check: ${h.basename(e)}`)}function Dp(e,t,r,n){if(!r)return null;if(n.platform!=="linux")throw new Error(`Coboot Headless bundled sandbox supports Linux only: ${n.platform}`);if(!r.architectures.includes(n.arch))throw new Error(`Coboot Headless does not include Linux sandbox for arch: ${n.arch}`);let i=h.join(e,"native",`linux-${n.arch}`),o=h.join(i,"manifest.json");if(!m.existsSync(o))throw new Error(`package is missing Linux sandbox bundle for arch: ${n.arch}`);let s=JSON.parse(m.readFileSync(o,"utf8"));if(s.backend!==r.backend||s.backendVersion!==r.backendVersion||s.arch!==n.arch)throw new Error("bundled Linux sandbox manifest does not match package metadata");let c={bwrap:h.join(i,"bwrap"),loader:h.join(i,"ld-musl"),libcap:h.join(i,"lib","libcap.so.2")};for(let[a,u]of Object.entries(c))Up(u,s.files?.[a]);let l=h.join(t,"native");return m.mkdirSync(h.join(l,"lib"),{recursive:!0,mode:448}),X(c.bwrap,h.join(l,"bwrap"),320),X(c.loader,h.join(l,"ld-musl"),320),X(c.libcap,h.join(l,"lib","libcap.so.2"),256),X(o,h.join(l,"manifest.json"),256),{backend:s.backend,version:s.backendVersion,arch:s.arch,bundled:!0}}function Bp(e,t,r){let n=h.join(e,"browser-runtime","playwright-core"),i=h.join(n,"package.json");if(!m.existsSync(i))throw new Error("package is missing bundled playwright-core");let o=JSON.parse(m.readFileSync(i,"utf8"));if(o.name!==r.driver||o.version!==r.driverVersion)throw new Error("bundled playwright-core does not match package metadata");let s=h.join(t,"node_modules","playwright-core"),c=`${s}.next-${process.pid}`;return m.rmSync(c,{recursive:!0,force:!0}),m.mkdirSync(h.dirname(s),{recursive:!0,mode:448}),m.cpSync(n,c,{recursive:!0}),m.rmSync(s,{recursive:!0,force:!0}),m.renameSync(c,s),r}function Ur(e,t,r={platform:process.platform,arch:process.arch}){ro(t);let{packageName:n,version:i,edition:o,linuxSandbox:s,browserRuntime:c}=Tt(e);if(o!==t.edition)throw new Error(`package edition ${o} does not match runtime layout ${t.edition}`);let l=m.mkdtempSync(h.join(t.releases,`.staging-${i}-`));try{Gp(e,l,{packageName:n,version:i,edition:o,linuxSandbox:s,browserRuntime:c},r);let a=h.join(t.releases,`${i}-${Cp(l)}`);return m.existsSync(a)?(m.rmSync(l,{recursive:!0,force:!0}),{version:i,releaseDir:a,reused:!0}):(m.renameSync(l,a),{version:i,releaseDir:a,reused:!1})}catch(a){throw m.rmSync(l,{recursive:!0,force:!0}),a}}function Gp(e,t,r,n){let i=h.join(e,"entry.mjs"),o=h.join(e,"daemon.mjs");if(!m.existsSync(i)||!m.existsSync(o))throw new Error("package is missing entry.mjs or daemon.mjs");X(i,h.join(t,"entry.mjs"),320),X(o,h.join(t,"daemon.mjs"),320);let s=h.join(e,"updater.mjs");m.existsSync(s)&&X(s,h.join(t,"updater.mjs"),320);let c=Dp(e,t,r.linuxSandbox,n),l=r.browserRuntime?Bp(e,t,r.browserRuntime):"disabled";Ip(h.join(t,"manifest.json"),`${JSON.stringify({type:"headless-npm-daemon",packageName:r.packageName,version:r.version,edition:r.edition,browserRuntime:l,linuxSandbox:c},null,2)}
37
+ `,256)}function Ie(e,t){Mp(e,t);let r=h.join(e.scripts,"daemon.mjs");m.existsSync(r)||X(h.join(t,"daemon.mjs"),r,320);let n=h.join(t,"updater.mjs");m.existsSync(n)?X(n,e.updater,320):m.rmSync(e.updater,{force:!0})}function Vp(e,t,r={platform:process.platform,arch:process.arch}){let n=Ur(e,t,r);return Ie(t,n.releaseDir),n}var Jy=Is(process.argv[2]==="update"?"update":"startup"),tc=Hp(import.meta.url),Fp=15e3,Zs=25e3,jp=73,qs=20,$p=new Set(["status","logs","stop"]),Kp=["BACKEND_URL","WS_URL","SIBOOT_URL","MCP_CREDENTIAL_API_BASE_URL","SKILL_CREDENTIAL_API_BASE_URL"],Wp=["HEADLESS_BWRAP_EXECUTABLE","HEADLESS_BWRAP_LOADER","HEADLESS_BWRAP_LIBRARY_DIR"];function Yp(e,t,r){return`${t?`${Me[e.edition]}=${t} `:""}npx -y ${e.packageName} ${r}`}function Xp(e,t){try{return y.statSync(e).uid===t}catch{return!1}}function zp(e,t,r){return Xp(e.root,r)?` sudo chown -R ${t} ${e.root}`:` sudo mkdir -p ${e.root} && sudo chown ${t} ${e.root}`}function Jp(e,t={}){let r=E.join(e.home,`.write-probe-${process.pid}`);try{y.mkdirSync(e.home,{recursive:!0,mode:448}),y.writeFileSync(r,"",{mode:384}),y.rmSync(r,{force:!0})}catch(n){let i=t.userName||Js.userInfo().username,o=t.uid??process.getuid?.(),s=Me[e.edition],c=t.suggestedRoot||E.join(Js.homedir(),`${e.edition}-data`),l=n?.code||"write failed";throw e.edition==="coboot"?new Error(`data root ${e.root} is not writable by user ${i} (${l}). Choose a writable absolute application data directory with COBOOT_DATA_ROOT; do not use the project working directory as the credential directory.`,{cause:n}):new Error([`data root ${e.root} is not writable by user ${i} (${l}).`,"Rerunning with sudo keeps the CLI and runtime as root; it does not hand the directory to this user.","Or ask an administrator to prepare it once:",zp(e,i,o),"or choose another writable absolute path and rerun this command:",` export ${s}=${c}`,`${s} is not persisted; status/logs/restart/update/stop must use the same value.`].join(`
38
+ `))}}function Zp(e,t){return`npx -y '${e}@${t}' install-browser`}function de(e){try{let t=Number.parseInt(y.readFileSync(e,"utf8").trim(),10);return Number.isInteger(t)&&t>0?t:null}catch{return null}}function z(e,t=process.platform==="linux"?"/proc":""){if(!e)return!1;try{process.kill(e,0)}catch{return!1}if(!t)return!0;try{let r=y.readFileSync(E.join(t,String(e),"stat"),"utf8"),n=r.lastIndexOf(") ")+2;return n<2||r[n]!=="Z"}catch{return!0}}function rc(e,t){let r="";try{r=y.readFileSync(`/proc/${e}/cmdline`,"utf8").replaceAll("\0"," ").trim()}catch{}if(!r)try{r=kp("ps",["-ww","-p",String(e),"-o","command="],{encoding:"utf8"}).trim()}catch{return!1}return t.some(n=>[n,oo(n)].some(i=>r.includes(i)))}var Dr=e=>new Promise(t=>setTimeout(t,e));function Gr(e=process.versions.node){let t=Number.parseInt(String(e).split(".")[0],10);if(!Number.isInteger(t)||t<qs)throw new Error(`Node.js >=${qs} is required; current version is ${e}`)}async function Qs(e,t,r){let n=de(e);if(!z(n)){try{y.unlinkSync(e)}catch{}return!1}if(!rc(n,t))throw new Error(`refusing to stop unrelated process from stale ${E.basename(e)}: ${n}`);process.kill(n,"SIGTERM");let i=Date.now()+Zs;for(;Date.now()<i&&z(n);)await Dr(100);if(z(n))throw new Error(`${r} did not stop within ${Zs/1e3} seconds: ${n}`);return de(e)===n&&y.rmSync(e,{force:!0}),!0}async function me(e){let t=await Qs(E.join(e.run,"daemon.pid"),[E.join(e.current,"daemon.mjs"),E.join(e.scripts,"daemon.mjs")],"daemon"),r=await Qs(E.join(e.run,"node.pid"),[E.join(e.current,"entry.mjs")],"client");return t||r}function qp(e,t,r=process.env){let n={...r,CU_EDITION:e.edition,NO_ELECTRON:"1",CLIENT_TYPE:"anydev",SIBOOT_BASE_DIR:e.home,SIBOOT_DATA_ROOT:e.root,HEADLESS_DATA_DIR:e.root,SIBOOT_DATA_DIR:e.root,HEADLESS_DEVICE_CREDENTIAL_PATH:e.credential,HEADLESS_AUTH_SESSION_PATH:e.authSession,HEADLESS_DEVICE_REQUIRE_AUTH:"1",HEADLESS_PREWARM_DEFAULT_SESSION:"0",WORKSPACE:e.workspace,ANYDEV_UPDATE_ENABLED:"0"};t?n.HEADLESS_DEVICE_TOKEN=t:delete n.HEADLESS_DEVICE_TOKEN,delete n.CLIENT_UID,delete n.HEADLESS_DEVICE_FORCE_ENROLL;for(let i of Wp)delete n[i];if(e.edition==="coboot"){n.HEADLESS_NPM_UPDATER_PATH=e.updater,n.COBOOT_DATA_ROOT=e.root,n.HEADLESS_LOG_DIR=e.logs,e.workingDirectory?n.COBOOT_HEADLESS_WORKING_DIRECTORY=e.workingDirectory:delete n.COBOOT_HEADLESS_WORKING_DIRECTORY;let i=E.join(e.current,"native");n.HEADLESS_BWRAP_EXECUTABLE=E.join(i,"bwrap"),n.HEADLESS_BWRAP_LOADER=E.join(i,"ld-musl"),n.HEADLESS_BWRAP_LIBRARY_DIR=E.join(i,"lib"),n.HEADLESS_BROWSER_RUNTIME="system-or-guided-install",n.PLAYWRIGHT_BROWSERS_PATH=Jn(e.home,r)}else delete n.HEADLESS_NPM_UPDATER_PATH,delete n.COBOOT_HEADLESS_WORKING_DIRECTORY,delete n.HEADLESS_BROWSER_RUNTIME,delete n.HEADLESS_BROWSER_INSTALL_COMMAND;if(n.HEADLESS_ALLOW_ENDPOINT_OVERRIDE!=="1")for(let i of Kp)delete n[i];return n}async function Qp(e,t=Fp){let r=Date.now()+t,n=!1;for(;Date.now()<r;){let i=de(E.join(e.run,"daemon.pid"));if(!z(i))throw new Error("daemon exited during client startup");let o=null;try{o=JSON.parse(y.readFileSync(E.join(e.run,"status.json"),"utf8"))}catch{}if(o?.client_ready===!0&&z(o.client_pid))return;if(o?.client_exit_code!=null&&!o?.client_pid){if(o.client_exit_code===jp){n=!0,await Dr(100);continue}throw new Error(`client exited during startup with code ${o.client_exit_code}`)}await Dr(100)}throw n?new Error("another Headless Driver still holds the machine lock after startup retries"):new Error(`client did not become ready within ${t}ms`)}function St(e,t=""){let r=e.edition==="coboot"?"coboot-headless":"siboot-headless";if(!y.existsSync(e.credential)&&!t)throw new Error(`device credential is missing; run ${r} <device-token> first`);let n=y.existsSync(E.join(e.current,"daemon.mjs"))?E.join(e.current,"daemon.mjs"):E.join(e.scripts,"daemon.mjs"),i=y.existsSync(E.join(e.current,"entry.mjs")),o=y.existsSync(n);if(!i||!o)throw new Error(`runtime is not installed (entry=${i}, daemon=${o}); run ${r} <device-token> first`);return n}async function Ce(e,t="",r=process.env){ro(e);let n=St(e,t),i=y.existsSync(e.credential)?"":t,o=E.join(e.logs,"daemon",`${new Date().toISOString().slice(0,10)}.log`),s=y.openSync(o,"a",384);ec(process.execPath,[n],{detached:!0,env:qp(e,i,r),stdio:["ignore",s,s]}).unref(),y.closeSync(s),await Dr(500);let l=de(E.join(e.run,"daemon.pid"));if(!z(l))throw new Error("daemon failed to start; inspect the daemon log with the logs command");return await Qp(e),{pid:l,logFile:o}}function Br(e){try{let t=JSON.parse(y.readFileSync(E.join(e.current,"manifest.json"),"utf8"));return typeof t.version=="string"?t.version:null}catch{return null}}async function e_(e,t={}){return Gr(t.nodeVersion),St(e),await me(e),Ce(e,"",t.baseEnv||process.env)}async function nc(e,t,r={}){Gr(r.nodeVersion);let n=r.token||"";if(!y.existsSync(t.credential)&&!n){let l=t.edition==="coboot"?"coboot-headless":"siboot-headless";throw new Error(`device credential is missing; run ${l} <device-token> first`)}let i=no(t),o=Br(t);console.log("[headless-runtime] event=runtime_replace phase=preparing");let s=Ur(e,t,r.runtime||{platform:process.platform,arch:process.arch}),c=l=>console.log(`[headless-runtime] event=runtime_replace phase=${l} from_version=${o||"unknown"} target_version=${s.version}`);c("stopping"),await me(t),Ie(t,s.releaseDir),c("activated");try{let l=await Ce(t,n,r.baseEnv||process.env);return c("completed"),{previousVersion:o,installed:s,started:l}}catch(l){if(c("rolling_back"),await me(t).catch(()=>{}),!i)throw l;Ie(t,i);try{await Ce(t,"",r.baseEnv||process.env)}catch(a){throw c("rollback_failed"),new AggregateError([l,a],`headless update failed and the previous runtime could not be restarted: ${a instanceof Error?a.message:String(a)}`)}throw c("rolled_back"),new Error(`headless update failed; restored ${o||"the previous version"}`,{cause:l})}}async function t_(e,t,r,n={}){return n.forceEnroll||!js(t,r)?a_(e,t,r,n):{...await nc(e,t,{...n,token:r}),identityReplaced:!1,sameEnrollment:!0}}async function r_(e,t,r={}){return St(t),nc(e,t,r)}function n_(e){let t=de(E.join(e.run,"daemon.pid")),r=null;try{r=JSON.parse(y.readFileSync(E.join(e.run,"status.json"),"utf8"))}catch{}r&&typeof r=="object"&&delete r.current_dir,console.log(JSON.stringify({running:z(t),pid:t,current:y.existsSync(e.current),status:r,...e.edition==="coboot"?{dataRoot:e.root,workingDirectory:e.workingDirectory||null}:{}},null,2))}async function o_(e){let t=E.join(e.logs,"daemon",`${new Date().toISOString().slice(0,10)}.log`);if(!y.existsSync(t))throw new Error(`no daemon log for today under ${e.root}`);let r=ec("tail",["-n","100","-f",t],{stdio:"inherit"});await new Promise((n,i)=>{r.once("error",i),r.once("exit",o=>o===0?n():i(new Error(`tail exited ${o}`)))})}function Ne(e,t=e.version){let r={...process.env};return r.HEADLESS_NPM_PACKAGE_NAME=e.packageName,r.HEADLESS_NPM_PACKAGE_VERSION=t,e.browserRuntime&&(r.HEADLESS_BROWSER_INSTALL_COMMAND=Zp(e.packageName,t)),r}function i_(e){return y.existsSync(e.credential)||y.existsSync(e.authSession)}async function a_(e,t,r,n={}){Gr(n.nodeVersion);let i=Tt(e),o=i_(t),s=no(t),c=Br(t),l=Ur(e,t,n.runtime||{platform:process.platform,arch:process.arch});await me(t);try{return await $s(t,async()=>{Ie(t,l.releaseDir);let a=await Ce(t,r,n.baseEnv||Ne(i));return{installed:l,started:a,identityReplaced:o}},()=>me(t),{token:r})}catch(a){if(!s)throw a;Ie(t,s);try{await Ce(t,"",Ne(i,c||i.version))}catch(u){throw new AggregateError([a,u],`force enrollment failed and the previous runtime could not be restarted: ${u instanceof Error?u.message:String(u)}`)}throw a}}async function s_(){let e=E.basename(process.argv[1]||"siboot-headless"),t=E.dirname(tc),r=Tt(t),n=Ir(process.argv.slice(2),r.edition),i=Ys(r.edition,process.env,n),o=r.edition==="coboot"?i.root:Cr(r.edition),s=Yp(r,o,"logs");if(n.command==="help")return Ns(e,i.root,!!r.browserRuntime,Me[r.edition]);if(!$p.has(n.command)){if(r.edition==="coboot"){if(["start","restart","update"].includes(n.command)&&St(i),n.command==="start"&&n.workspaceDir&&z(de(E.join(i.run,"daemon.pid"))))throw new Error("use restart --workspace-dir to change the working directory of a running installation");to(i)}Jp(i),Xs(i)}if(n.command==="install-browser"){if(!r.browserRuntime)throw new Error("install-browser is available in the Coboot headless npm package only");return Gs(t,i)}let c=r.edition==="coboot"?"Coboot":"Siboot";if(n.command==="status")return n_(i);if(n.command==="logs")return o_(i);if(n.command==="stop"){let d=await me(i);console.log(d?`${c} Headless stopped`:`${c} Headless is not running`);return}if(n.command==="start"){Gr(),St(i);let d=de(E.join(i.run,"daemon.pid")),T=[E.join(i.current,"daemon.mjs"),E.join(i.scripts,"daemon.mjs")];if(z(d)&&rc(d,T)){console.log(`${c} Headless is already running (pid=${d})`);return}await me(i);let b=await Ce(i,"",Ne(r,Br(i)||r.version));console.log(`${c} Headless started in background (pid=${b.pid})`),console.log(`Logs: ${s}`);return}if(n.command==="restart"){let d=await e_(i,{baseEnv:Ne(r,Br(i)||r.version)});console.log(`${c} Headless restarted in background (pid=${d.pid})`),console.log(`Logs: ${s}`);return}if(n.command==="update"){let{previousVersion:d,installed:T,started:b}=await r_(t,i,{baseEnv:Ne(r)});console.log(`${c} Headless updated ${d||"unknown"} -> ${T.version} (pid=${b.pid})`),console.log(`Logs: ${s}`);return}let{installed:l,started:a,identityReplaced:u,sameEnrollment:f}=await t_(t,i,n.token||"",{forceEnroll:n.forceEnroll,baseEnv:Ne(r)});console.log(`${c} Headless ${l.version} started in background (pid=${a.pid})`),u?console.log("Existing device credential replaced by new enrollment"):f?console.log("Enrollment already completed for this token; supplied package installed"):n.forceEnroll&&console.log("Device credential created by force enrollment"),console.log(`Logs: ${s}`)}function oo(e){try{return y.realpathSync(e)}catch{return E.resolve(e)}}process.argv[1]&&oo(process.argv[1])===oo(tc)&&s_().catch(e=>{let t=E.basename(process.argv[1]||"headless-client");console.error(`${t}: ${e instanceof Error?e.message:String(e)}`),process.exitCode=1});export{Jp as assertHeadlessDataRootWritable,Gr as assertSupportedNodeVersion,qp as createDaemonEnv,t_ as installAndStartHeadlessRuntime,Vp as installHeadlessRuntime,z as isRunning,Ir as parseHeadlessCliArgs,Tt as readPackageMetadata,Cr as resolveHeadlessDataRootSetting,Qn as resolveHeadlessLayout,e_ as restartHeadlessRuntime,Ce as startHeadlessRuntime,me as stopHeadlessRuntime,r_ as updateHeadlessRuntime,St as validateHeadlessRuntimeStart};