ontrackd 0.0.1 → 0.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (684) hide show
  1. package/LICENSE +14 -0
  2. package/README.md +133 -2
  3. package/dist/cli/build.d.ts +1 -0
  4. package/dist/cli/build.js +172 -0
  5. package/dist/cli/build.js.map +1 -0
  6. package/dist/cli/cloud.d.ts +20 -0
  7. package/dist/cli/cloud.js +395 -0
  8. package/dist/cli/cloud.js.map +1 -0
  9. package/dist/cli/feedback.d.ts +4 -0
  10. package/dist/cli/feedback.js +90 -0
  11. package/dist/cli/feedback.js.map +1 -0
  12. package/dist/cli/hugo.d.ts +1 -0
  13. package/dist/cli/hugo.js +396 -0
  14. package/dist/cli/hugo.js.map +1 -0
  15. package/dist/cli/init.d.ts +8 -0
  16. package/dist/cli/init.js +346 -0
  17. package/dist/cli/init.js.map +1 -0
  18. package/dist/cli/invite.d.ts +2 -0
  19. package/dist/cli/invite.js +65 -0
  20. package/dist/cli/invite.js.map +1 -0
  21. package/dist/cli/link.d.ts +20 -0
  22. package/dist/cli/link.js +287 -0
  23. package/dist/cli/link.js.map +1 -0
  24. package/dist/cli/pull.d.ts +31 -0
  25. package/dist/cli/pull.js +273 -0
  26. package/dist/cli/pull.js.map +1 -0
  27. package/dist/cli/push.d.ts +9 -0
  28. package/dist/cli/push.js +57 -0
  29. package/dist/cli/push.js.map +1 -0
  30. package/dist/cli/remote.d.ts +1 -0
  31. package/dist/cli/remote.js +114 -0
  32. package/dist/cli/remote.js.map +1 -0
  33. package/dist/cli/serve.d.ts +1 -0
  34. package/dist/cli/serve.js +178 -0
  35. package/dist/cli/serve.js.map +1 -0
  36. package/dist/cli/sidecar.d.ts +9 -0
  37. package/dist/cli/sidecar.js +23 -0
  38. package/dist/cli/sidecar.js.map +1 -0
  39. package/dist/core/anchorId.d.ts +42 -0
  40. package/dist/core/anchorId.js +50 -0
  41. package/dist/core/anchorId.js.map +1 -0
  42. package/dist/core/apiKind.d.ts +42 -0
  43. package/dist/core/apiKind.js +83 -0
  44. package/dist/core/apiKind.js.map +1 -0
  45. package/dist/core/astroAnchors.d.ts +39 -0
  46. package/dist/core/astroAnchors.js +217 -0
  47. package/dist/core/astroAnchors.js.map +1 -0
  48. package/dist/core/attachmentTypes.d.ts +74 -0
  49. package/dist/core/attachmentTypes.js +199 -0
  50. package/dist/core/attachmentTypes.js.map +1 -0
  51. package/dist/core/elementHints.d.ts +40 -0
  52. package/dist/core/elementHints.js +116 -0
  53. package/dist/core/elementHints.js.map +1 -0
  54. package/dist/core/exportTaskDoc.d.ts +81 -0
  55. package/dist/core/exportTaskDoc.js +828 -0
  56. package/dist/core/exportTaskDoc.js.map +1 -0
  57. package/dist/core/feedbackTypes.d.ts +241 -0
  58. package/dist/core/feedbackTypes.js +2 -0
  59. package/dist/core/feedbackTypes.js.map +1 -0
  60. package/dist/core/fingerprint.d.ts +12 -0
  61. package/dist/core/fingerprint.js +24 -0
  62. package/dist/core/fingerprint.js.map +1 -0
  63. package/dist/core/htmlAnchors.d.ts +18 -0
  64. package/dist/core/htmlAnchors.js +157 -0
  65. package/dist/core/htmlAnchors.js.map +1 -0
  66. package/dist/core/imageSniff.d.ts +7 -0
  67. package/dist/core/imageSniff.js +12 -0
  68. package/dist/core/imageSniff.js.map +1 -0
  69. package/dist/core/ordering.d.ts +16 -0
  70. package/dist/core/ordering.js +10 -0
  71. package/dist/core/ordering.js.map +1 -0
  72. package/dist/core/oxcAst.d.ts +39 -0
  73. package/dist/core/oxcAst.js +147 -0
  74. package/dist/core/oxcAst.js.map +1 -0
  75. package/dist/core/pageUrl.d.ts +10 -0
  76. package/dist/core/pageUrl.js +27 -0
  77. package/dist/core/pageUrl.js.map +1 -0
  78. package/dist/core/participants.d.ts +14 -0
  79. package/dist/core/participants.js +38 -0
  80. package/dist/core/participants.js.map +1 -0
  81. package/dist/core/ports.d.ts +86 -0
  82. package/dist/core/ports.js +2 -0
  83. package/dist/core/ports.js.map +1 -0
  84. package/dist/core/projectSecret.d.ts +9 -0
  85. package/dist/core/projectSecret.js +57 -0
  86. package/dist/core/projectSecret.js.map +1 -0
  87. package/dist/core/recipe.d.ts +117 -0
  88. package/dist/core/recipe.js +181 -0
  89. package/dist/core/recipe.js.map +1 -0
  90. package/dist/core/recordingSummary.d.ts +12 -0
  91. package/dist/core/recordingSummary.js +150 -0
  92. package/dist/core/recordingSummary.js.map +1 -0
  93. package/dist/core/resolveAnchors.d.ts +70 -0
  94. package/dist/core/resolveAnchors.js +101 -0
  95. package/dist/core/resolveAnchors.js.map +1 -0
  96. package/dist/core/scriptImport.d.ts +10 -0
  97. package/dist/core/scriptImport.js +18 -0
  98. package/dist/core/scriptImport.js.map +1 -0
  99. package/dist/core/sourceAnchors.d.ts +62 -0
  100. package/dist/core/sourceAnchors.js +82 -0
  101. package/dist/core/sourceAnchors.js.map +1 -0
  102. package/dist/core/sourceContext.d.ts +62 -0
  103. package/dist/core/sourceContext.js +182 -0
  104. package/dist/core/sourceContext.js.map +1 -0
  105. package/dist/core/sourcePath.d.ts +2 -0
  106. package/dist/core/sourcePath.js +11 -0
  107. package/dist/core/sourcePath.js.map +1 -0
  108. package/dist/core/staleness.d.ts +118 -0
  109. package/dist/core/staleness.js +155 -0
  110. package/dist/core/staleness.js.map +1 -0
  111. package/dist/core/styleOrigin.d.ts +98 -0
  112. package/dist/core/styleOrigin.js +142 -0
  113. package/dist/core/styleOrigin.js.map +1 -0
  114. package/dist/core/svelteAnchors.d.ts +18 -0
  115. package/dist/core/svelteAnchors.js +125 -0
  116. package/dist/core/svelteAnchors.js.map +1 -0
  117. package/dist/core/taskFiles.d.ts +31 -0
  118. package/dist/core/taskFiles.js +55 -0
  119. package/dist/core/taskFiles.js.map +1 -0
  120. package/dist/core/untrusted.d.ts +57 -0
  121. package/dist/core/untrusted.js +268 -0
  122. package/dist/core/untrusted.js.map +1 -0
  123. package/dist/core/vueAnchors.d.ts +21 -0
  124. package/dist/core/vueAnchors.js +130 -0
  125. package/dist/core/vueAnchors.js.map +1 -0
  126. package/dist/expo/app/Avatar.d.ts +6 -0
  127. package/dist/expo/app/Avatar.js +12 -0
  128. package/dist/expo/app/Avatar.js.map +1 -0
  129. package/dist/expo/app/Bars.d.ts +9 -0
  130. package/dist/expo/app/Bars.js +38 -0
  131. package/dist/expo/app/Bars.js.map +1 -0
  132. package/dist/expo/app/CommentThreadSheet.d.ts +35 -0
  133. package/dist/expo/app/CommentThreadSheet.js +200 -0
  134. package/dist/expo/app/CommentThreadSheet.js.map +1 -0
  135. package/dist/expo/app/CommentsSheet.d.ts +22 -0
  136. package/dist/expo/app/CommentsSheet.js +76 -0
  137. package/dist/expo/app/CommentsSheet.js.map +1 -0
  138. package/dist/expo/app/Files.d.ts +16 -0
  139. package/dist/expo/app/Files.js +62 -0
  140. package/dist/expo/app/Files.js.map +1 -0
  141. package/dist/expo/app/Highlight.d.ts +5 -0
  142. package/dist/expo/app/Highlight.js +12 -0
  143. package/dist/expo/app/Highlight.js.map +1 -0
  144. package/dist/expo/app/Icon.d.ts +9 -0
  145. package/dist/expo/app/Icon.js +22 -0
  146. package/dist/expo/app/Icon.js.map +1 -0
  147. package/dist/expo/app/MarkerPins.d.ts +10 -0
  148. package/dist/expo/app/MarkerPins.js +70 -0
  149. package/dist/expo/app/MarkerPins.js.map +1 -0
  150. package/dist/expo/app/Provider.d.ts +13 -0
  151. package/dist/expo/app/Provider.js +597 -0
  152. package/dist/expo/app/Provider.js.map +1 -0
  153. package/dist/expo/app/Sheet.d.ts +53 -0
  154. package/dist/expo/app/Sheet.js +106 -0
  155. package/dist/expo/app/Sheet.js.map +1 -0
  156. package/dist/expo/app/Toolbar.d.ts +26 -0
  157. package/dist/expo/app/Toolbar.js +71 -0
  158. package/dist/expo/app/Toolbar.js.map +1 -0
  159. package/dist/expo/app/adapter.d.ts +55 -0
  160. package/dist/expo/app/adapter.js +145 -0
  161. package/dist/expo/app/adapter.js.map +1 -0
  162. package/dist/expo/app/api.d.ts +68 -0
  163. package/dist/expo/app/api.js +86 -0
  164. package/dist/expo/app/api.js.map +1 -0
  165. package/dist/expo/app/assets/attach.png +0 -0
  166. package/dist/expo/app/assets/close.png +0 -0
  167. package/dist/expo/app/assets/comment.png +0 -0
  168. package/dist/expo/app/assets/edit.png +0 -0
  169. package/dist/expo/app/assets/file.png +0 -0
  170. package/dist/expo/app/assets/narrow.png +0 -0
  171. package/dist/expo/app/assets/panel.png +0 -0
  172. package/dist/expo/app/assets/pins.png +0 -0
  173. package/dist/expo/app/assets/pinsOff.png +0 -0
  174. package/dist/expo/app/assets/remove.png +0 -0
  175. package/dist/expo/app/assets/reopen.png +0 -0
  176. package/dist/expo/app/assets/resolve.png +0 -0
  177. package/dist/expo/app/assets/send.png +0 -0
  178. package/dist/expo/app/assets/widen.png +0 -0
  179. package/dist/expo/app/attachments.d.ts +93 -0
  180. package/dist/expo/app/attachments.js +181 -0
  181. package/dist/expo/app/attachments.js.map +1 -0
  182. package/dist/expo/app/cloudApi.d.ts +63 -0
  183. package/dist/expo/app/cloudApi.js +330 -0
  184. package/dist/expo/app/cloudApi.js.map +1 -0
  185. package/dist/expo/app/cloudAuth.d.ts +20 -0
  186. package/dist/expo/app/cloudAuth.js +71 -0
  187. package/dist/expo/app/cloudAuth.js.map +1 -0
  188. package/dist/expo/app/cloudHttp.d.ts +20 -0
  189. package/dist/expo/app/cloudHttp.js +46 -0
  190. package/dist/expo/app/cloudHttp.js.map +1 -0
  191. package/dist/expo/app/cloudSession.d.ts +30 -0
  192. package/dist/expo/app/cloudSession.js +72 -0
  193. package/dist/expo/app/cloudSession.js.map +1 -0
  194. package/dist/expo/app/comments.d.ts +20 -0
  195. package/dist/expo/app/comments.js +131 -0
  196. package/dist/expo/app/comments.js.map +1 -0
  197. package/dist/expo/app/devMenuNone.d.ts +5 -0
  198. package/dist/expo/app/devMenuNone.js +3 -0
  199. package/dist/expo/app/devMenuNone.js.map +1 -0
  200. package/dist/expo/app/devServerNone.d.ts +4 -0
  201. package/dist/expo/app/devServerNone.js +4 -0
  202. package/dist/expo/app/devServerNone.js.map +1 -0
  203. package/dist/expo/app/embeddedConfig.d.ts +1 -0
  204. package/dist/expo/app/embeddedConfig.js +12 -0
  205. package/dist/expo/app/embeddedConfig.js.map +1 -0
  206. package/dist/expo/app/embeddedConfigCloud.d.ts +2 -0
  207. package/dist/expo/app/embeddedConfigCloud.js +8 -0
  208. package/dist/expo/app/embeddedConfigCloud.js.map +1 -0
  209. package/dist/expo/app/embeddedConfigNone.d.ts +2 -0
  210. package/dist/expo/app/embeddedConfigNone.js +3 -0
  211. package/dist/expo/app/embeddedConfigNone.js.map +1 -0
  212. package/dist/expo/app/expo.d.ts +4 -0
  213. package/dist/expo/app/expo.js +35 -0
  214. package/dist/expo/app/expo.js.map +1 -0
  215. package/dist/expo/app/expoGo.d.ts +4 -0
  216. package/dist/expo/app/expoGo.js +33 -0
  217. package/dist/expo/app/expoGo.js.map +1 -0
  218. package/dist/expo/app/expoPickers.d.ts +11 -0
  219. package/dist/expo/app/expoPickers.js +91 -0
  220. package/dist/expo/app/expoPickers.js.map +1 -0
  221. package/dist/expo/app/expoRandom.d.ts +6 -0
  222. package/dist/expo/app/expoRandom.js +21 -0
  223. package/dist/expo/app/expoRandom.js.map +1 -0
  224. package/dist/expo/app/idle.d.ts +4 -0
  225. package/dist/expo/app/idle.js +7 -0
  226. package/dist/expo/app/idle.js.map +1 -0
  227. package/dist/expo/app/index.d.ts +3 -0
  228. package/dist/expo/app/index.js +3 -0
  229. package/dist/expo/app/index.js.map +1 -0
  230. package/dist/expo/app/interactions.d.ts +38 -0
  231. package/dist/expo/app/interactions.js +40 -0
  232. package/dist/expo/app/interactions.js.map +1 -0
  233. package/dist/expo/app/markers.d.ts +28 -0
  234. package/dist/expo/app/markers.js +187 -0
  235. package/dist/expo/app/markers.js.map +1 -0
  236. package/dist/expo/app/movedAnchors.d.ts +46 -0
  237. package/dist/expo/app/movedAnchors.js +39 -0
  238. package/dist/expo/app/movedAnchors.js.map +1 -0
  239. package/dist/expo/app/native.d.ts +12 -0
  240. package/dist/expo/app/native.js +78 -0
  241. package/dist/expo/app/native.js.map +1 -0
  242. package/dist/expo/app/panel.d.ts +27 -0
  243. package/dist/expo/app/panel.js +37 -0
  244. package/dist/expo/app/panel.js.map +1 -0
  245. package/dist/expo/app/payload.d.ts +43 -0
  246. package/dist/expo/app/payload.js +22 -0
  247. package/dist/expo/app/payload.js.map +1 -0
  248. package/dist/expo/app/pick.d.ts +14 -0
  249. package/dist/expo/app/pick.js +124 -0
  250. package/dist/expo/app/pick.js.map +1 -0
  251. package/dist/expo/app/pickerNone.d.ts +1 -0
  252. package/dist/expo/app/pickerNone.js +2 -0
  253. package/dist/expo/app/pickerNone.js.map +1 -0
  254. package/dist/expo/app/placement.d.ts +53 -0
  255. package/dist/expo/app/placement.js +100 -0
  256. package/dist/expo/app/placement.js.map +1 -0
  257. package/dist/expo/app/random.d.ts +13 -0
  258. package/dist/expo/app/random.js +56 -0
  259. package/dist/expo/app/random.js.map +1 -0
  260. package/dist/expo/app/reactNative.d.ts +2 -0
  261. package/dist/expo/app/reactNative.js +3 -0
  262. package/dist/expo/app/reactNative.js.map +1 -0
  263. package/dist/expo/app/runtimeConfig.d.ts +30 -0
  264. package/dist/expo/app/runtimeConfig.js +104 -0
  265. package/dist/expo/app/runtimeConfig.js.map +1 -0
  266. package/dist/expo/app/sheetMotion.d.ts +22 -0
  267. package/dist/expo/app/sheetMotion.js +39 -0
  268. package/dist/expo/app/sheetMotion.js.map +1 -0
  269. package/dist/expo/app/signIn.d.ts +32 -0
  270. package/dist/expo/app/signIn.js +28 -0
  271. package/dist/expo/app/signIn.js.map +1 -0
  272. package/dist/expo/app/state.d.ts +45 -0
  273. package/dist/expo/app/state.js +32 -0
  274. package/dist/expo/app/state.js.map +1 -0
  275. package/dist/expo/app/theme.d.ts +15 -0
  276. package/dist/expo/app/theme.js +9 -0
  277. package/dist/expo/app/theme.js.map +1 -0
  278. package/dist/expo/app/types.d.ts +87 -0
  279. package/dist/expo/app/types.js +2 -0
  280. package/dist/expo/app/types.js.map +1 -0
  281. package/dist/expo/app/useCloudReviewer.d.ts +75 -0
  282. package/dist/expo/app/useCloudReviewer.js +211 -0
  283. package/dist/expo/app/useCloudReviewer.js.map +1 -0
  284. package/dist/expo/app/useComments.d.ts +64 -0
  285. package/dist/expo/app/useComments.js +156 -0
  286. package/dist/expo/app/useComments.js.map +1 -0
  287. package/dist/expo/app/useUploads.d.ts +32 -0
  288. package/dist/expo/app/useUploads.js +106 -0
  289. package/dist/expo/app/useUploads.js.map +1 -0
  290. package/dist/expo/expoGoMetro.cjs +83 -0
  291. package/dist/expo/expoMetro.cjs +86 -0
  292. package/dist/expo/metro.cjs +304 -0
  293. package/dist/expo/metroBuild.d.ts +22 -0
  294. package/dist/expo/metroBuild.js +169 -0
  295. package/dist/expo/metroBuild.js.map +1 -0
  296. package/dist/expo/middleware.d.ts +11 -0
  297. package/dist/expo/middleware.js +26 -0
  298. package/dist/expo/middleware.js.map +1 -0
  299. package/dist/expo/mode.d.ts +20 -0
  300. package/dist/expo/mode.js +37 -0
  301. package/dist/expo/mode.js.map +1 -0
  302. package/dist/expo/publicConfig.d.ts +37 -0
  303. package/dist/expo/publicConfig.js +87 -0
  304. package/dist/expo/publicConfig.js.map +1 -0
  305. package/dist/expo/transform.d.ts +22 -0
  306. package/dist/expo/transform.js +38 -0
  307. package/dist/expo/transform.js.map +1 -0
  308. package/dist/expo/transformer.cjs +73 -0
  309. package/dist/index.d.ts +21 -0
  310. package/dist/index.js +17 -0
  311. package/dist/index.js.map +1 -0
  312. package/dist/integration/apiRoutes.d.ts +2 -0
  313. package/dist/integration/apiRoutes.js +3 -0
  314. package/dist/integration/apiRoutes.js.map +1 -0
  315. package/dist/integration/buildCredentials.d.ts +12 -0
  316. package/dist/integration/buildCredentials.js +97 -0
  317. package/dist/integration/buildCredentials.js.map +1 -0
  318. package/dist/integration/buildSession.d.ts +8 -0
  319. package/dist/integration/buildSession.js +96 -0
  320. package/dist/integration/buildSession.js.map +1 -0
  321. package/dist/integration/bundleCheck.d.ts +43 -0
  322. package/dist/integration/bundleCheck.js +111 -0
  323. package/dist/integration/bundleCheck.js.map +1 -0
  324. package/dist/integration/commentPull.d.ts +134 -0
  325. package/dist/integration/commentPull.js +260 -0
  326. package/dist/integration/commentPull.js.map +1 -0
  327. package/dist/integration/configuredApi.d.ts +7 -0
  328. package/dist/integration/configuredApi.js +24 -0
  329. package/dist/integration/configuredApi.js.map +1 -0
  330. package/dist/integration/devCloud.d.ts +27 -0
  331. package/dist/integration/devCloud.js +56 -0
  332. package/dist/integration/devCloud.js.map +1 -0
  333. package/dist/integration/devReviewLinks.d.ts +2 -0
  334. package/dist/integration/devReviewLinks.js +10 -0
  335. package/dist/integration/devReviewLinks.js.map +1 -0
  336. package/dist/integration/gitBranch.d.ts +19 -0
  337. package/dist/integration/gitBranch.js +56 -0
  338. package/dist/integration/gitBranch.js.map +1 -0
  339. package/dist/integration/importPlan.d.ts +19 -0
  340. package/dist/integration/importPlan.js +90 -0
  341. package/dist/integration/importPlan.js.map +1 -0
  342. package/dist/integration/index.d.ts +14 -0
  343. package/dist/integration/index.js +13 -0
  344. package/dist/integration/index.js.map +1 -0
  345. package/dist/integration/manifest.d.ts +120 -0
  346. package/dist/integration/manifest.js +147 -0
  347. package/dist/integration/manifest.js.map +1 -0
  348. package/dist/integration/manifestParts.d.ts +29 -0
  349. package/dist/integration/manifestParts.js +65 -0
  350. package/dist/integration/manifestParts.js.map +1 -0
  351. package/dist/integration/manifestSink.d.ts +75 -0
  352. package/dist/integration/manifestSink.js +157 -0
  353. package/dist/integration/manifestSink.js.map +1 -0
  354. package/dist/integration/manifestUpload.d.ts +64 -0
  355. package/dist/integration/manifestUpload.js +177 -0
  356. package/dist/integration/manifestUpload.js.map +1 -0
  357. package/dist/integration/middleware.d.ts +55 -0
  358. package/dist/integration/middleware.js +379 -0
  359. package/dist/integration/middleware.js.map +1 -0
  360. package/dist/integration/nextStyles.d.ts +4 -0
  361. package/dist/integration/nextStyles.js +121 -0
  362. package/dist/integration/nextStyles.js.map +1 -0
  363. package/dist/integration/requestGuards.d.ts +71 -0
  364. package/dist/integration/requestGuards.js +255 -0
  365. package/dist/integration/requestGuards.js.map +1 -0
  366. package/dist/integration/sharedBuild.d.ts +71 -0
  367. package/dist/integration/sharedBuild.js +105 -0
  368. package/dist/integration/sharedBuild.js.map +1 -0
  369. package/dist/integration/sharedInject.d.ts +88 -0
  370. package/dist/integration/sharedInject.js +164 -0
  371. package/dist/integration/sharedInject.js.map +1 -0
  372. package/dist/integration/sidecarProcess.d.ts +26 -0
  373. package/dist/integration/sidecarProcess.js +137 -0
  374. package/dist/integration/sidecarProcess.js.map +1 -0
  375. package/dist/integration/styleCollector.d.ts +49 -0
  376. package/dist/integration/styleCollector.js +220 -0
  377. package/dist/integration/styleCollector.js.map +1 -0
  378. package/dist/integration/transform.d.ts +24 -0
  379. package/dist/integration/transform.js +36 -0
  380. package/dist/integration/transform.js.map +1 -0
  381. package/dist/integration/tunnelClient.d.ts +44 -0
  382. package/dist/integration/tunnelClient.js +148 -0
  383. package/dist/integration/tunnelClient.js.map +1 -0
  384. package/dist/integration/tunnelProtocol.d.ts +152 -0
  385. package/dist/integration/tunnelProtocol.js +110 -0
  386. package/dist/integration/tunnelProtocol.js.map +1 -0
  387. package/dist/mcp/cli.d.ts +2 -0
  388. package/dist/mcp/cli.js +327 -0
  389. package/dist/mcp/cli.js.map +1 -0
  390. package/dist/mcp/cloudRefresh.d.ts +36 -0
  391. package/dist/mcp/cloudRefresh.js +52 -0
  392. package/dist/mcp/cloudRefresh.js.map +1 -0
  393. package/dist/mcp/context.d.ts +7 -0
  394. package/dist/mcp/context.js +18 -0
  395. package/dist/mcp/context.js.map +1 -0
  396. package/dist/mcp/files.d.ts +66 -0
  397. package/dist/mcp/files.js +157 -0
  398. package/dist/mcp/files.js.map +1 -0
  399. package/dist/mcp/search.d.ts +3 -0
  400. package/dist/mcp/search.js +9 -0
  401. package/dist/mcp/search.js.map +1 -0
  402. package/dist/mcp/server.d.ts +50 -0
  403. package/dist/mcp/server.js +555 -0
  404. package/dist/mcp/server.js.map +1 -0
  405. package/dist/overlay/anchors.d.ts +130 -0
  406. package/dist/overlay/anchors.js +365 -0
  407. package/dist/overlay/anchors.js.map +1 -0
  408. package/dist/overlay/api.d.ts +150 -0
  409. package/dist/overlay/api.js +259 -0
  410. package/dist/overlay/api.js.map +1 -0
  411. package/dist/overlay/attachments.d.ts +60 -0
  412. package/dist/overlay/attachments.js +163 -0
  413. package/dist/overlay/attachments.js.map +1 -0
  414. package/dist/overlay/browser.d.ts +1 -0
  415. package/dist/overlay/browser.js +203 -0
  416. package/dist/overlay/browser.js.map +1 -0
  417. package/dist/overlay/chip.d.ts +27 -0
  418. package/dist/overlay/chip.js +31 -0
  419. package/dist/overlay/chip.js.map +1 -0
  420. package/dist/overlay/compact.d.ts +11 -0
  421. package/dist/overlay/compact.js +21 -0
  422. package/dist/overlay/compact.js.map +1 -0
  423. package/dist/overlay/cssScope.d.ts +46 -0
  424. package/dist/overlay/cssScope.js +180 -0
  425. package/dist/overlay/cssScope.js.map +1 -0
  426. package/dist/overlay/cursor.d.ts +2 -0
  427. package/dist/overlay/cursor.js +68 -0
  428. package/dist/overlay/cursor.js.map +1 -0
  429. package/dist/overlay/devBrowser.d.ts +1 -0
  430. package/dist/overlay/devBrowser.js +18 -0
  431. package/dist/overlay/devBrowser.js.map +1 -0
  432. package/dist/overlay/devReview.d.ts +4 -0
  433. package/dist/overlay/devReview.js +18 -0
  434. package/dist/overlay/devReview.js.map +1 -0
  435. package/dist/overlay/directReviewer.d.ts +149 -0
  436. package/dist/overlay/directReviewer.js +448 -0
  437. package/dist/overlay/directReviewer.js.map +1 -0
  438. package/dist/overlay/elementDescription.d.ts +10 -0
  439. package/dist/overlay/elementDescription.js +251 -0
  440. package/dist/overlay/elementDescription.js.map +1 -0
  441. package/dist/overlay/icons.d.ts +8 -0
  442. package/dist/overlay/icons.js +36 -0
  443. package/dist/overlay/icons.js.map +1 -0
  444. package/dist/overlay/identity.d.ts +48 -0
  445. package/dist/overlay/identity.js +125 -0
  446. package/dist/overlay/identity.js.map +1 -0
  447. package/dist/overlay/localMachine.d.ts +23 -0
  448. package/dist/overlay/localMachine.js +40 -0
  449. package/dist/overlay/localMachine.js.map +1 -0
  450. package/dist/overlay/magicLink.d.ts +10 -0
  451. package/dist/overlay/magicLink.js +87 -0
  452. package/dist/overlay/magicLink.js.map +1 -0
  453. package/dist/overlay/modern-screenshot.js +1676 -0
  454. package/dist/overlay/movedAnchors.d.ts +30 -0
  455. package/dist/overlay/movedAnchors.js +128 -0
  456. package/dist/overlay/movedAnchors.js.map +1 -0
  457. package/dist/overlay/notificationGroups.d.ts +2 -0
  458. package/dist/overlay/notificationGroups.js +41 -0
  459. package/dist/overlay/notificationGroups.js.map +1 -0
  460. package/dist/overlay/permissions.d.ts +10 -0
  461. package/dist/overlay/permissions.js +9 -0
  462. package/dist/overlay/permissions.js.map +1 -0
  463. package/dist/overlay/pinGroups.d.ts +16 -0
  464. package/dist/overlay/pinGroups.js +17 -0
  465. package/dist/overlay/pinGroups.js.map +1 -0
  466. package/dist/overlay/presence.d.ts +50 -0
  467. package/dist/overlay/presence.js +258 -0
  468. package/dist/overlay/presence.js.map +1 -0
  469. package/dist/overlay/projectChannel.d.ts +11 -0
  470. package/dist/overlay/projectChannel.js +111 -0
  471. package/dist/overlay/projectChannel.js.map +1 -0
  472. package/dist/overlay/recorder.d.ts +56 -0
  473. package/dist/overlay/recorder.js +130 -0
  474. package/dist/overlay/recorder.js.map +1 -0
  475. package/dist/overlay/reviewMode.d.ts +21 -0
  476. package/dist/overlay/reviewMode.js +59 -0
  477. package/dist/overlay/reviewMode.js.map +1 -0
  478. package/dist/overlay/reviewerAuth.d.ts +131 -0
  479. package/dist/overlay/reviewerAuth.js +279 -0
  480. package/dist/overlay/reviewerAuth.js.map +1 -0
  481. package/dist/overlay/route.d.ts +18 -0
  482. package/dist/overlay/route.js +56 -0
  483. package/dist/overlay/route.js.map +1 -0
  484. package/dist/overlay/rrweb-record.js +63 -0
  485. package/dist/overlay/runtime.d.ts +1 -0
  486. package/dist/overlay/runtime.js +4857 -0
  487. package/dist/overlay/runtime.js.map +1 -0
  488. package/dist/overlay/session.d.ts +32 -0
  489. package/dist/overlay/session.js +76 -0
  490. package/dist/overlay/session.js.map +1 -0
  491. package/dist/overlay/sharedMode.d.ts +38 -0
  492. package/dist/overlay/sharedMode.js +37 -0
  493. package/dist/overlay/sharedMode.js.map +1 -0
  494. package/dist/overlay/sheet.d.ts +73 -0
  495. package/dist/overlay/sheet.js +278 -0
  496. package/dist/overlay/sheet.js.map +1 -0
  497. package/dist/overlay/snapshot.d.ts +26 -0
  498. package/dist/overlay/snapshot.js +185 -0
  499. package/dist/overlay/snapshot.js.map +1 -0
  500. package/dist/overlay/state.d.ts +63 -0
  501. package/dist/overlay/state.js +241 -0
  502. package/dist/overlay/state.js.map +1 -0
  503. package/dist/overlay/steps.d.ts +22 -0
  504. package/dist/overlay/steps.js +34 -0
  505. package/dist/overlay/steps.js.map +1 -0
  506. package/dist/overlay/styles.d.ts +7 -0
  507. package/dist/overlay/styles.js +1449 -0
  508. package/dist/overlay/styles.js.map +1 -0
  509. package/dist/overlay/trace.d.ts +19 -0
  510. package/dist/overlay/trace.js +29 -0
  511. package/dist/overlay/trace.js.map +1 -0
  512. package/dist/overlay/upload.d.ts +35 -0
  513. package/dist/overlay/upload.js +99 -0
  514. package/dist/overlay/upload.js.map +1 -0
  515. package/dist/plugin/astro.d.ts +31 -0
  516. package/dist/plugin/astro.js +22 -0
  517. package/dist/plugin/astro.js.map +1 -0
  518. package/dist/plugin/eleventy.d.ts +44 -0
  519. package/dist/plugin/eleventy.js +186 -0
  520. package/dist/plugin/eleventy.js.map +1 -0
  521. package/dist/plugin/next-loader.cjs +11 -0
  522. package/dist/plugin/next.d.ts +29 -0
  523. package/dist/plugin/next.js +176 -0
  524. package/dist/plugin/next.js.map +1 -0
  525. package/dist/plugin/nextOverlay.d.ts +2 -0
  526. package/dist/plugin/nextOverlay.js +22 -0
  527. package/dist/plugin/nextOverlay.js.map +1 -0
  528. package/dist/plugin/nextTransform.d.ts +19 -0
  529. package/dist/plugin/nextTransform.js +29 -0
  530. package/dist/plugin/nextTransform.js.map +1 -0
  531. package/dist/plugin/rsbuild.d.ts +25 -0
  532. package/dist/plugin/rsbuild.js +56 -0
  533. package/dist/plugin/rsbuild.js.map +1 -0
  534. package/dist/plugin/vite.d.ts +40 -0
  535. package/dist/plugin/vite.js +585 -0
  536. package/dist/plugin/vite.js.map +1 -0
  537. package/dist/plugin/webpack.d.ts +69 -0
  538. package/dist/plugin/webpack.js +192 -0
  539. package/dist/plugin/webpack.js.map +1 -0
  540. package/dist/remote/account.d.ts +41 -0
  541. package/dist/remote/account.js +177 -0
  542. package/dist/remote/account.js.map +1 -0
  543. package/dist/remote/base64url.d.ts +14 -0
  544. package/dist/remote/base64url.js +71 -0
  545. package/dist/remote/base64url.js.map +1 -0
  546. package/dist/remote/branchLabel.d.ts +12 -0
  547. package/dist/remote/branchLabel.js +20 -0
  548. package/dist/remote/branchLabel.js.map +1 -0
  549. package/dist/remote/client.d.ts +340 -0
  550. package/dist/remote/client.js +424 -0
  551. package/dist/remote/client.js.map +1 -0
  552. package/dist/remote/cloudApi.d.ts +72 -0
  553. package/dist/remote/cloudApi.js +72 -0
  554. package/dist/remote/cloudApi.js.map +1 -0
  555. package/dist/remote/codec.d.ts +54 -0
  556. package/dist/remote/codec.js +62 -0
  557. package/dist/remote/codec.js.map +1 -0
  558. package/dist/remote/config.d.ts +30 -0
  559. package/dist/remote/config.js +112 -0
  560. package/dist/remote/config.js.map +1 -0
  561. package/dist/remote/content-schema.d.ts +428 -0
  562. package/dist/remote/content-schema.js +209 -0
  563. package/dist/remote/content-schema.js.map +1 -0
  564. package/dist/remote/content.d.ts +44 -0
  565. package/dist/remote/content.js +75 -0
  566. package/dist/remote/content.js.map +1 -0
  567. package/dist/remote/envelope.d.ts +76 -0
  568. package/dist/remote/envelope.js +109 -0
  569. package/dist/remote/envelope.js.map +1 -0
  570. package/dist/remote/errors.d.ts +55 -0
  571. package/dist/remote/errors.js +63 -0
  572. package/dist/remote/errors.js.map +1 -0
  573. package/dist/remote/ids.d.ts +8 -0
  574. package/dist/remote/ids.js +25 -0
  575. package/dist/remote/ids.js.map +1 -0
  576. package/dist/remote/index.d.ts +7 -0
  577. package/dist/remote/index.js +8 -0
  578. package/dist/remote/index.js.map +1 -0
  579. package/dist/remote/keys.d.ts +62 -0
  580. package/dist/remote/keys.js +162 -0
  581. package/dist/remote/keys.js.map +1 -0
  582. package/dist/remote/localAnchors.d.ts +4 -0
  583. package/dist/remote/localAnchors.js +23 -0
  584. package/dist/remote/localAnchors.js.map +1 -0
  585. package/dist/remote/mapping.d.ts +11 -0
  586. package/dist/remote/mapping.js +22 -0
  587. package/dist/remote/mapping.js.map +1 -0
  588. package/dist/remote/presence.d.ts +63 -0
  589. package/dist/remote/presence.js +143 -0
  590. package/dist/remote/presence.js.map +1 -0
  591. package/dist/remote/realtime.d.ts +142 -0
  592. package/dist/remote/realtime.js +326 -0
  593. package/dist/remote/realtime.js.map +1 -0
  594. package/dist/remote/store.d.ts +183 -0
  595. package/dist/remote/store.js +907 -0
  596. package/dist/remote/store.js.map +1 -0
  597. package/dist/remote/sync.d.ts +113 -0
  598. package/dist/remote/sync.js +370 -0
  599. package/dist/remote/sync.js.map +1 -0
  600. package/dist/remote/types.d.ts +99 -0
  601. package/dist/remote/types.js +6 -0
  602. package/dist/remote/types.js.map +1 -0
  603. package/dist/setup/agents.d.ts +23 -0
  604. package/dist/setup/agents.js +80 -0
  605. package/dist/setup/agents.js.map +1 -0
  606. package/dist/setup/configure.d.ts +27 -0
  607. package/dist/setup/configure.js +201 -0
  608. package/dist/setup/configure.js.map +1 -0
  609. package/dist/setup/connect.d.ts +60 -0
  610. package/dist/setup/connect.js +244 -0
  611. package/dist/setup/connect.js.map +1 -0
  612. package/dist/setup/detect.d.ts +67 -0
  613. package/dist/setup/detect.js +168 -0
  614. package/dist/setup/detect.js.map +1 -0
  615. package/dist/setup/frameworks.d.ts +41 -0
  616. package/dist/setup/frameworks.js +81 -0
  617. package/dist/setup/frameworks.js.map +1 -0
  618. package/dist/sidecar/cli.d.ts +1 -0
  619. package/dist/sidecar/cli.js +70 -0
  620. package/dist/sidecar/cli.js.map +1 -0
  621. package/dist/sidecar/cloudSync.d.ts +33 -0
  622. package/dist/sidecar/cloudSync.js +139 -0
  623. package/dist/sidecar/cloudSync.js.map +1 -0
  624. package/dist/sidecar/commentFiles.d.ts +59 -0
  625. package/dist/sidecar/commentFiles.js +217 -0
  626. package/dist/sidecar/commentFiles.js.map +1 -0
  627. package/dist/sidecar/cssAttribution.d.ts +26 -0
  628. package/dist/sidecar/cssAttribution.js +114 -0
  629. package/dist/sidecar/cssAttribution.js.map +1 -0
  630. package/dist/sidecar/exportTasks.d.ts +38 -0
  631. package/dist/sidecar/exportTasks.js +249 -0
  632. package/dist/sidecar/exportTasks.js.map +1 -0
  633. package/dist/sidecar/http.d.ts +20 -0
  634. package/dist/sidecar/http.js +904 -0
  635. package/dist/sidecar/http.js.map +1 -0
  636. package/dist/sidecar/inviteTarget.d.ts +4 -0
  637. package/dist/sidecar/inviteTarget.js +32 -0
  638. package/dist/sidecar/inviteTarget.js.map +1 -0
  639. package/dist/sidecar/presence.d.ts +4 -0
  640. package/dist/sidecar/presence.js +92 -0
  641. package/dist/sidecar/presence.js.map +1 -0
  642. package/dist/storage/cliSession.d.ts +8 -0
  643. package/dist/storage/cliSession.js +41 -0
  644. package/dist/storage/cliSession.js.map +1 -0
  645. package/dist/storage/devStyleMap.d.ts +12 -0
  646. package/dist/storage/devStyleMap.js +31 -0
  647. package/dist/storage/devStyleMap.js.map +1 -0
  648. package/dist/storage/fileCache.d.ts +34 -0
  649. package/dist/storage/fileCache.js +122 -0
  650. package/dist/storage/fileCache.js.map +1 -0
  651. package/dist/storage/localAttachments.d.ts +82 -0
  652. package/dist/storage/localAttachments.js +276 -0
  653. package/dist/storage/localAttachments.js.map +1 -0
  654. package/dist/storage/localComments.d.ts +31 -0
  655. package/dist/storage/localComments.js +159 -0
  656. package/dist/storage/localComments.js.map +1 -0
  657. package/dist/storage/localCredentials.d.ts +74 -0
  658. package/dist/storage/localCredentials.js +210 -0
  659. package/dist/storage/localCredentials.js.map +1 -0
  660. package/dist/storage/localParticipants.d.ts +33 -0
  661. package/dist/storage/localParticipants.js +110 -0
  662. package/dist/storage/localParticipants.js.map +1 -0
  663. package/dist/storage/localRecipe.d.ts +22 -0
  664. package/dist/storage/localRecipe.js +46 -0
  665. package/dist/storage/localRecipe.js.map +1 -0
  666. package/dist/storage/localScreenshots.d.ts +23 -0
  667. package/dist/storage/localScreenshots.js +55 -0
  668. package/dist/storage/localScreenshots.js.map +1 -0
  669. package/dist/storage/localSource.d.ts +31 -0
  670. package/dist/storage/localSource.js +175 -0
  671. package/dist/storage/localSource.js.map +1 -0
  672. package/dist/storage/pulledComments.d.ts +81 -0
  673. package/dist/storage/pulledComments.js +107 -0
  674. package/dist/storage/pulledComments.js.map +1 -0
  675. package/dist/storage/remoteRecipe.d.ts +7 -0
  676. package/dist/storage/remoteRecipe.js +85 -0
  677. package/dist/storage/remoteRecipe.js.map +1 -0
  678. package/dist/storage/savedRemote.d.ts +2 -0
  679. package/dist/storage/savedRemote.js +22 -0
  680. package/dist/storage/savedRemote.js.map +1 -0
  681. package/dist/storage/sidecarAccess.d.ts +7 -0
  682. package/dist/storage/sidecarAccess.js +68 -0
  683. package/dist/storage/sidecarAccess.js.map +1 -0
  684. package/package.json +306 -4
@@ -0,0 +1,279 @@
1
+ import { apiKindFor, routedFetch } from '../core/apiKind.js';
2
+ /**
3
+ * The one message for an address that cannot sign in.
4
+ *
5
+ * The same words whether the invitation expired or never existed, because distinguishing them
6
+ * would let anyone ask the API whether an address is on a project. Written so the person who
7
+ * genuinely was invited still knows what to do, which is the only thing that makes a
8
+ * deliberately uninformative message acceptable.
9
+ */
10
+ export const cannotSignIn = "We couldn't sign you in. Ask whoever sent you this link to invite you again.";
11
+ /** Anything unexpected. Never a status code, never a stack: see spec 6.0.4. */
12
+ const somethingWentWrong = 'Something went wrong at our end. Try again in a moment.';
13
+ /**
14
+ * The request did not arrive.
15
+ *
16
+ * Not "check your internet connection", which is false and unhelpful: their page loaded, so
17
+ * their connection works. What failed is our service - which could equally be an origin nobody
18
+ * registered, or us being down - and none of those are theirs to fix. Sending someone to debug
19
+ * their wifi for our outage wastes their time and teaches them the product is unreliable.
20
+ *
21
+ * The last clause routes the report to the person who can actually act on it.
22
+ */
23
+ const cannotReach = 'We could not reach the feedback service. Try again in a moment, and tell whoever sent you '
24
+ + 'this link if it keeps happening.';
25
+ const headersFor = (config) => ({
26
+ 'content-type': 'application/json',
27
+ 'x-feedback-project': config.projectId,
28
+ });
29
+ export async function sendCode(config, email) {
30
+ const address = email.trim();
31
+ if (!address || !address.includes('@')) {
32
+ return { ok: false, message: 'That does not look like an email address.' };
33
+ }
34
+ try {
35
+ const { response } = await routedFetch(config, fetch, (legacy) => ({
36
+ url: `${config.apiBase}${legacy ? '/v1/auth/email-otp/send-verification-otp' : `/v0/auth/email-code?projectId=${encodeURIComponent(config.projectId)}`}`,
37
+ init: { method: 'POST', headers: headersFor(config), body: JSON.stringify(legacy ? { email: address, type: 'sign-in' } : { email: address }) },
38
+ }));
39
+ // 403 from the origin gate: this preview's address was never registered for the project.
40
+ // That is a configuration mistake by whoever set the project up, not something the reviewer
41
+ // can act on - see `misconfiguredNotice`, which is written for the developer and shown in
42
+ // the console rather than to the person who just wanted to leave a comment.
43
+ if (response.status === 403) {
44
+ return { ok: false, message: somethingWentWrong, misconfigured: true };
45
+ }
46
+ // A 200 here means the request was accepted, not that an email was sent: the server
47
+ // deliberately answers identically for an address it has never heard of. So the overlay
48
+ // moves to the code screen either way, and an address that was never invited discovers it
49
+ // by the code not arriving - which is the same thing it discovers today, without the API
50
+ // having confirmed anything.
51
+ return response.ok ? { ok: true } : { ok: false, message: somethingWentWrong };
52
+ }
53
+ catch {
54
+ return { ok: false, message: cannotReach };
55
+ }
56
+ }
57
+ export async function verifyCode(config, email, code) {
58
+ const digits = code.replace(/\D/g, '');
59
+ if (digits.length !== 6) {
60
+ return { ok: false, message: 'The code is six digits.' };
61
+ }
62
+ try {
63
+ const { response, kind } = await routedFetch(config, fetch, (legacy) => ({
64
+ url: `${config.apiBase}${legacy ? '/v1/auth/sign-in/email-otp' : `/v0/auth/email-code/verify?projectId=${encodeURIComponent(config.projectId)}`}`,
65
+ init: { method: 'POST', headers: headersFor(config), body: JSON.stringify(legacy ? { email: email.trim(), otp: digits } : { email: email.trim(), code: digits }) },
66
+ }));
67
+ if (response.status === 401 || response.status === 400) {
68
+ // Two situations, one message, and the distinction is not ours to leak: a wrong code and
69
+ // an address that was never invited must be indistinguishable from here.
70
+ const body = await response.text().catch(() => '');
71
+ return {
72
+ ok: false,
73
+ message: /invalid otp|incorrect/i.test(body)
74
+ ? 'That code is not right. Check the email and try again.'
75
+ : cannotSignIn,
76
+ };
77
+ }
78
+ if (!response.ok) {
79
+ return { ok: false, message: somethingWentWrong };
80
+ }
81
+ const data = (await response.json());
82
+ if (!data.token) {
83
+ return { ok: false, message: somethingWentWrong };
84
+ }
85
+ // Expiry comes from the server. Computing it here from an assumed lifetime is how a token
86
+ // outlives its own validity in storage and is sent after it has stopped working.
87
+ const serverExpiry = data.expiresAt ?? data.session?.expiresAt;
88
+ if (kind === 'v0' && (!serverExpiry || !Number.isFinite(Date.parse(serverExpiry)) || !data.account?.id))
89
+ return { ok: false, message: somethingWentWrong };
90
+ const expiresAt = serverExpiry
91
+ ? new Date(serverExpiry).getTime()
92
+ : Date.now() + 12 * 60 * 60 * 1000;
93
+ return { ok: true, session: { token: data.token, expiresAt, email: email.trim(), ...(data.account ? { account: data.account } : {}) } };
94
+ }
95
+ catch {
96
+ return { ok: false, message: cannotReach };
97
+ }
98
+ }
99
+ /**
100
+ * What a developer needs to read when the origin is not registered, and the reviewer must not.
101
+ *
102
+ * A reviewer shown a CORS explanation concludes the product is broken, and they are not wrong
103
+ * to - from where they stand it is. But the fix belongs to whoever set the project up, and they
104
+ * are not in the room. So the reviewer gets the ordinary "something went wrong at our end", and
105
+ * this goes to the console, which is where a developer opening the preview will look.
106
+ *
107
+ * Deliberately not thrown, and deliberately not rendered: an error in the page is the customer's
108
+ * console filling with our noise (RAW-POLICY rule 6). One line, once, and only when we are
109
+ * certain of the cause.
110
+ */
111
+ export function misconfiguredNotice(origin, projectId) {
112
+ return (`feedback: ${origin} is not one of the allowed sites of project ${projectId}, so the API refuses `
113
+ + 'sign-in from this page before it reaches authentication.\n'
114
+ + ` Add ${origin} in the dashboard: the project's Settings, Allowed sites.`);
115
+ }
116
+ /**
117
+ * The sign-in's own words for the same refusal, when the API has said so for certain.
118
+ *
119
+ * The one place the dialog names an address. Whoever opened this page cannot sign in from it by
120
+ * any means, and a sign-in without buttons and without a reason sent the developer looking for a
121
+ * provider problem that did not exist. The address is in it because that is what has to be
122
+ * pasted, and a reviewer who cannot act on it can forward it to someone who can.
123
+ */
124
+ export function notAllowedHere(origin) {
125
+ const { protocol, hostname } = new URL(origin);
126
+ // The API takes plain http from loopback only (the Worker's `originSchema`), so allowing a
127
+ // LAN address such as http://192.168.1.10:3000 would change nothing: say what would.
128
+ if (protocol === 'http:' && !['localhost', '127.0.0.1', '[::1]'].includes(hostname)) {
129
+ return `This address (${origin}) can't be one of the project's allowed sites: sign-in needs https, `
130
+ + 'or localhost on this machine.';
131
+ }
132
+ return `This address (${origin}) isn't one of the project's allowed sites: add it in the dashboard, `
133
+ + 'Project → Settings → Allowed sites.';
134
+ }
135
+ export const providerLabels = { github: 'GitHub', google: 'Google', microsoft: 'Microsoft' };
136
+ const isProvider = (id) => id === 'github' || id === 'google' || id === 'microsoft';
137
+ const providersKey = (config) => `feedback:providers:${config.apiBase}`;
138
+ const lastKey = 'feedback:last-sign-in';
139
+ /**
140
+ * The providers from this browser's last visit, so the dialog opens with its buttons already in
141
+ * place instead of growing them a moment later. Null when there was no last visit.
142
+ */
143
+ export function cachedProviders(config) {
144
+ try {
145
+ const stored = JSON.parse(localStorage.getItem(providersKey(config)) ?? 'null');
146
+ return Array.isArray(stored) ? stored.filter(isProvider) : null;
147
+ }
148
+ catch {
149
+ return null;
150
+ }
151
+ }
152
+ export async function oauthProviders(config) {
153
+ try {
154
+ const { response, kind } = await routedFetch(config, fetch, (legacy) => ({
155
+ url: `${config.apiBase}${legacy ? '/v1/oauth/providers' : `/v0/auth/providers?projectId=${encodeURIComponent(config.projectId)}`}`,
156
+ ...(legacy ? {} : { init: { headers: headersFor(config) } }),
157
+ }));
158
+ // Only the v0 API lets the page read this refusal (see the Worker's `reviewerCors`).
159
+ if (kind === 'v0' && response.status === 403)
160
+ return { providers: [], refused: true };
161
+ // A failure is not an empty list: caching it would draw no buttons on the next visit too.
162
+ if (!response.ok)
163
+ return { providers: cachedProviders(config) ?? [] };
164
+ const body = (await response.json());
165
+ const found = Array.isArray(body.providers) ? body.providers.filter(isProvider) : [];
166
+ try {
167
+ localStorage.setItem(providersKey(config), JSON.stringify(found));
168
+ }
169
+ catch { /* storage full or blocked */ }
170
+ return { providers: found };
171
+ }
172
+ catch {
173
+ return { providers: cachedProviders(config) ?? [] };
174
+ }
175
+ }
176
+ /** How this browser last signed in to a preview here, for the "Last used" tag. */
177
+ export function lastSignIn() {
178
+ try {
179
+ const stored = localStorage.getItem(lastKey);
180
+ return stored === 'email' || isProvider(stored) ? stored : null;
181
+ }
182
+ catch {
183
+ return null;
184
+ }
185
+ }
186
+ export function rememberSignIn(method) {
187
+ try {
188
+ localStorage.setItem(lastKey, method);
189
+ }
190
+ catch { /* storage full or blocked */ }
191
+ }
192
+ /**
193
+ * Made before the click, because the popup has to open inside it: a browser blocks a window
194
+ * opened after an `await`, and hashing is one.
195
+ */
196
+ export async function oauthTicket() {
197
+ const bytes = crypto.getRandomValues(new Uint8Array(32));
198
+ const secret = btoa(String.fromCharCode(...bytes)).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
199
+ const digest = await crypto.subtle.digest('SHA-256', new TextEncoder().encode(secret));
200
+ const hash = Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, '0')).join('');
201
+ return { secret, hash };
202
+ }
203
+ /** Opens the provider's window. False when the browser refused to open it. */
204
+ export function openProviderWindow(config, provider, ticket) {
205
+ const v0 = apiKindFor(config) === 'v0';
206
+ const query = new URLSearchParams(v0
207
+ ? { h: ticket.hash, projectId: config.projectId, previewOrigin: window.location.origin }
208
+ : { provider, h: ticket.hash, mode: 'popup', project: config.projectId });
209
+ const width = 500;
210
+ const height = 680;
211
+ const left = Math.max(0, window.screenX + (window.outerWidth - width) / 2);
212
+ const top = Math.max(0, window.screenY + (window.outerHeight - height) / 3);
213
+ const opened = window.open(`${config.apiBase}${v0 ? `/v0/auth/oauth/${provider}/preview` : '/v1/oauth/start'}?${query}`, 'ontrackd-sign-in', `popup,width=${width},height=${height},left=${Math.round(left)},top=${Math.round(top)}`);
214
+ return opened !== null;
215
+ }
216
+ const pendingKey = (config) => `feedback:oauth-pending:${config.projectId}`;
217
+ /**
218
+ * Signing in with a provider in this tab (phones, v0 API): where to go. A phone's "window" is a second tab
219
+ * nobody returns from, and in-app browsers refuse it. The secret waits in this tab's session storage, which
220
+ * survives the round trip to the provider and nothing else; only its hash and the page's own path leave.
221
+ * Null when storage is refused (the popup is the way then).
222
+ */
223
+ export function providerRedirect(config, provider, ticket, back, link = {}) {
224
+ try {
225
+ sessionStorage.setItem(pendingKey(config), JSON.stringify({ ...ticket, provider, back, at: Date.now(), ...link }));
226
+ }
227
+ catch {
228
+ return null;
229
+ }
230
+ const query = new URLSearchParams({ h: ticket.hash, projectId: config.projectId, previewOrigin: window.location.origin, back });
231
+ return `${config.apiBase}/v0/auth/oauth/${provider}/preview?${query}`;
232
+ }
233
+ /** The sign-in this tab left for, once: taken out as it is read, and only for ten minutes. */
234
+ export function takePendingProvider(config) {
235
+ try {
236
+ const raw = sessionStorage.getItem(pendingKey(config));
237
+ sessionStorage.removeItem(pendingKey(config));
238
+ const value = raw ? JSON.parse(raw) : null;
239
+ if (!value || !isProvider(value.provider) || typeof value.secret !== 'string' || typeof value.hash !== 'string'
240
+ || typeof value.back !== 'string' || typeof value.at !== 'number' || Date.now() - value.at > 10 * 60_000)
241
+ return null;
242
+ // The link as the address would have given it (runtime.ts `readLinkedComment`, `readLinkedSession`), or none.
243
+ const linkedComment = typeof value.linkedComment === 'string' && /^[\w-]{1,64}$/.test(value.linkedComment) ? value.linkedComment : null;
244
+ const linkedSession = typeof value.linkedSession === 'string' && /^ses_[0-7][0-9a-hjkmnp-tv-z]{25}$/.test(value.linkedSession) ? value.linkedSession : null;
245
+ return { ...value, linkedComment, linkedSession };
246
+ }
247
+ catch {
248
+ return null;
249
+ }
250
+ }
251
+ /**
252
+ * One ask. Pending until the person has finished in the other window. `back`: the same-tab sign-in's return
253
+ * path, which the API bound into the flow (v0 only).
254
+ */
255
+ export async function collectProviderSignIn(config, ticket, back) {
256
+ try {
257
+ const { response, kind } = await routedFetch(config, fetch, (legacy) => ({
258
+ url: `${config.apiBase}${legacy ? '/v1/oauth/handoff' : `/v0/auth/oauth/preview/handoff?projectId=${encodeURIComponent(config.projectId)}`}`,
259
+ init: { method: 'POST', headers: legacy ? { 'content-type': 'application/json' } : headersFor(config),
260
+ body: JSON.stringify(!legacy && back ? { secret: ticket.secret, back } : { secret: ticket.secret }) },
261
+ }));
262
+ if (response.status === 403)
263
+ return { status: 'failed', message: somethingWentWrong };
264
+ const body = (await response.json());
265
+ if (body.status === 'failed')
266
+ return { status: 'failed', message: body.error ?? somethingWentWrong };
267
+ if (body.status !== 'ready' || !body.token)
268
+ return { status: 'pending' };
269
+ if (kind === 'v0' && (!body.account?.id || !body.expiresAt || !Number.isFinite(Date.parse(body.expiresAt))))
270
+ return { status: 'failed', message: somethingWentWrong };
271
+ const expiresAt = body.expiresAt ? new Date(body.expiresAt).getTime() : Date.now() + 12 * 60 * 60 * 1000;
272
+ return { status: 'ready', session: { token: body.token, expiresAt, email: body.account?.email ?? body.user?.email ?? '', ...(body.account ? { account: body.account } : {}) } };
273
+ }
274
+ catch {
275
+ // A dropped poll is not a failure: the next one asks again.
276
+ return { status: 'pending' };
277
+ }
278
+ }
279
+ //# sourceMappingURL=reviewerAuth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reviewerAuth.js","sourceRoot":"","sources":["../../src/overlay/reviewerAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAkB,MAAM,oBAAoB,CAAC;AA0B7E;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,YAAY,GACvB,8EAA8E,CAAC;AAEjF,+EAA+E;AAC/E,MAAM,kBAAkB,GAAG,yDAAyD,CAAC;AAErF;;;;;;;;;GASG;AACH,MAAM,WAAW,GACf,4FAA4F;MAC1F,kCAAkC,CAAC;AAEvC,MAAM,UAAU,GAAG,CAAC,MAAkB,EAAE,EAAE,CAAC,CAAC;IAC1C,cAAc,EAAE,kBAAkB;IAClC,oBAAoB,EAAE,MAAM,CAAC,SAAS;CACvC,CAAC,CAAC;AAEH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,MAAkB,EAAE,KAAa;IAC9D,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,2CAA2C,EAAE,CAAC;IAC7E,CAAC;IAED,IAAI,CAAC;QACH,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACjE,GAAG,EAAE,GAAG,MA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,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;YAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC;QACtK,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;QACzG,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IAClL,CAAC;IAAC,MAAM,CAAC;QACP,4DAA4D;QAC5D,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAC/B,CAAC;AACH,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Notifies when the host app changes route.
3
+ *
4
+ * Comments are scoped to a route (SPEC 7.2), but a single-page app navigates with
5
+ * `history.pushState`, which fires no event. Without patching it the overlay keeps showing
6
+ * the previous route's pins after navigation. `popstate` alone is not enough: it covers
7
+ * back and forward, not programmatic navigation.
8
+ */
9
+ export declare function observeRoute(onChange: () => void): () => void;
10
+ /**
11
+ * Where a comment's recorded route may take this page: a same-origin http(s) URL for a path that
12
+ * starts with a single `/`, or null. The route is stored content any reviewer can write, so a
13
+ * `javascript:` URL, `//other.host`, `/\other.host` or anything resolving off-origin is refused.
14
+ */
15
+ export declare function sameOriginRoute(route: unknown, here?: {
16
+ origin: string;
17
+ }): URL | null;
18
+ export { pageUrl } from '../core/pageUrl.js';
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Notifies when the host app changes route.
3
+ *
4
+ * Comments are scoped to a route (SPEC 7.2), but a single-page app navigates with
5
+ * `history.pushState`, which fires no event. Without patching it the overlay keeps showing
6
+ * the previous route's pins after navigation. `popstate` alone is not enough: it covers
7
+ * back and forward, not programmatic navigation.
8
+ */
9
+ export function observeRoute(onChange) {
10
+ let current = window.location.pathname;
11
+ const notifyIfChanged = () => {
12
+ if (window.location.pathname !== current) {
13
+ current = window.location.pathname;
14
+ onChange();
15
+ }
16
+ };
17
+ const originalPush = history.pushState;
18
+ const originalReplace = history.replaceState;
19
+ // The host app's navigation must keep its normal behavior; this only observes it.
20
+ history.pushState = function patchedPushState(...args) {
21
+ const result = originalPush.apply(this, args);
22
+ queueMicrotask(notifyIfChanged);
23
+ return result;
24
+ };
25
+ history.replaceState = function patchedReplaceState(...args) {
26
+ const result = originalReplace.apply(this, args);
27
+ queueMicrotask(notifyIfChanged);
28
+ return result;
29
+ };
30
+ window.addEventListener('popstate', notifyIfChanged);
31
+ window.addEventListener('hashchange', notifyIfChanged);
32
+ return () => {
33
+ history.pushState = originalPush;
34
+ history.replaceState = originalReplace;
35
+ window.removeEventListener('popstate', notifyIfChanged);
36
+ window.removeEventListener('hashchange', notifyIfChanged);
37
+ };
38
+ }
39
+ /**
40
+ * Where a comment's recorded route may take this page: a same-origin http(s) URL for a path that
41
+ * starts with a single `/`, or null. The route is stored content any reviewer can write, so a
42
+ * `javascript:` URL, `//other.host`, `/\other.host` or anything resolving off-origin is refused.
43
+ */
44
+ export function sameOriginRoute(route, here = window.location) {
45
+ if (typeof route !== 'string' || !/^\/(?![/\\])/.test(route) || /[\u0000-\u0020\\\u007f]/.test(route))
46
+ return null;
47
+ try {
48
+ const url = new URL(route, here.origin);
49
+ return (url.protocol === 'http:' || url.protocol === 'https:') && url.origin === here.origin ? url : null;
50
+ }
51
+ catch {
52
+ return null;
53
+ }
54
+ }
55
+ export { pageUrl } from '../core/pageUrl.js';
56
+ //# sourceMappingURL=route.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/overlay/route.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,QAAoB;IAC/C,IAAI,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAEvC,MAAM,eAAe,GAAG,GAAG,EAAE;QAC3B,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YACzC,OAAO,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACnC,QAAQ,EAAE,CAAC;QACb,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC;IACvC,MAAM,eAAe,GAAG,OAAO,CAAC,YAAY,CAAC;IAE7C,kFAAkF;IAClF,OAAO,CAAC,SAAS,GAAG,SAAS,gBAAgB,CAAC,GAAG,IAAI;QACnD,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC9C,cAAc,CAAC,eAAe,CAAC,CAAC;QAChC,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,OAAO,CAAC,YAAY,GAAG,SAAS,mBAAmB,CAAC,GAAG,IAAI;QACzD,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QACjD,cAAc,CAAC,eAAe,CAAC,CAAC;QAChC,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;IAEF,MAAM,CAAC,gBAAgB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IACrD,MAAM,CAAC,gBAAgB,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;IAEvD,OAAO,GAAG,EAAE;QACV,OAAO,CAAC,SAAS,GAAG,YAAY,CAAC;QACjC,OAAO,CAAC,YAAY,GAAG,eAAe,CAAC;QACvC,MAAM,CAAC,mBAAmB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;QACxD,MAAM,CAAC,mBAAmB,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;IAC5D,CAAC,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc,EAAE,OAA2B,MAAM,CAAC,QAAQ;IACxF,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,yBAAyB,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnH,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;QACxC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,IAAI,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5G,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAGD,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC"}
@@ -0,0 +1,63 @@
1
+ /*! @rrweb/record 2.2.2 | MIT License | https://github.com/rrweb-io/rrweb */
2
+ var I=(function(e){return e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e[e.Asset=7]="Asset",e[e.Annotation=8]="Annotation",e})({}),R=(function(e){return e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e})({}),U=(function(e){return e[e.MouseUp=0]="MouseUp",e[e.MouseDown=1]="MouseDown",e[e.Click=2]="Click",e[e.ContextMenu=3]="ContextMenu",e[e.DblClick=4]="DblClick",e[e.Focus=5]="Focus",e[e.Blur=6]="Blur",e[e.TouchStart=7]="TouchStart",e[e.TouchMove_Departed=8]="TouchMove_Departed",e[e.TouchEnd=9]="TouchEnd",e[e.TouchCancel=10]="TouchCancel",e})({}),Z=(function(e){return e[e.Mouse=0]="Mouse",e[e.Pen=1]="Pen",e[e.Touch=2]="Touch",e})({}),Ce=(function(e){return e[e["2D"]=0]="2D",e[e.WebGL=1]="WebGL",e[e.WebGL2=2]="WebGL2",e})({}),me=(function(e){return e[e.Play=0]="Play",e[e.Pause=1]="Pause",e[e.Seeked=2]="Seeked",e[e.VolumeChange=3]="VolumeChange",e[e.RateChange=4]="RateChange",e})({}),x=(function(e){return e[e.Document=0]="Document",e[e.DocumentType=1]="DocumentType",e[e.Element=2]="Element",e[e.Text=3]="Text",e[e.CDATA=4]="CDATA",e[e.Comment=5]="Comment",e})({}),rt={Node:["childNodes","parentNode","parentElement","textContent","ownerDocument","firstChild","lastChild","nextSibling","previousSibling"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},nt={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},ye={},Ve={},ot=0;function Yt(e){let t=globalThis?.Zone?.__symbol__?.(e);if(t&&globalThis[t])return globalThis[t]}function Je(e){if(ye[e])return ye[e];let t=Yt(e)||globalThis[e],r=t.prototype,n=e in rt?rt[e]:void 0,o=!!(n&&n.every(l=>!!Object.getOwnPropertyDescriptor(r,l)?.get?.toString().includes("[native code]"))),s=e in nt?nt[e]:void 0,a=!!(s&&s.every(l=>typeof r[l]=="function"&&r[l]?.toString().includes("[native code]")));if(o&&a)return ye[e]=t.prototype,t.prototype;try{let l=document.createElement("iframe");l.style.display="none",document.body.appendChild(l);let i=l.contentWindow;if(!i)return t.prototype;let h=i[e].prototype;if(!h)return l.remove(),r;let f=navigator.userAgent;return f.includes("Safari")&&!f.includes("Chrome")?(l.classList.add("rr-block"),l.setAttribute("__rrwebUntaintedMutationObserver",""),Ve[e]=()=>l.remove()):l.remove(),ye[e]=h}catch{return r}}var st={};function B(e,t,r){let n=st[e]?.[r];if(n)return n.call(t);let o=Je(e),s=Object.getOwnPropertyDescriptor(o,r)?.get;return s?((st[e]||={})[r]=s,s.call(t)):t[r]}var ze={};function St(e,t,r){let n=`${e}.${String(r)}`;if(ze[n])return ze[n].bind(t);let o=Je(e)[r];return typeof o!="function"?t[r]:(ze[n]=o,o.bind(t))}function Jt(e){return B("Node",e,"ownerDocument")}function Zt(e){return B("Node",e,"childNodes")}function Qt(e){return B("Node",e,"parentNode")}function Kt(e){return B("Node",e,"parentElement")}function er(e){return B("Node",e,"textContent")}function tr(e){return B("Node",e,"firstChild")}function rr(e){return B("Node",e,"lastChild")}function nr(e){return B("Node",e,"nextSibling")}function or(e){return B("Node",e,"previousSibling")}function sr(e,t){return St("Node",e,"contains")(t)}function ar(e){return St("Node",e,"getRootNode")()}function ir(e){return!e||!("host"in e)?null:B("ShadowRoot",e,"host")}function lr(e){return e.styleSheets}function cr(e){return!e||!("shadowRoot"in e)?null:B("Element",e,"shadowRoot")}function dr(e,t){return B("Element",e,"querySelector")(t)}function ur(e,t){return B("Element",e,"querySelectorAll")(t)}function bt(){let e=Je("MutationObserver");ot++;let t=!1;return[e.constructor,()=>{if(t||(t=!0,--ot!==0))return;let r=Ve.MutationObserver;if(r)try{r()}finally{delete ye.MutationObserver,delete Ve.MutationObserver}}]}var Me=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(Me=()=>new Date().getTime());function oe(e,t,r){try{if(!(t in e))return()=>{};let n=e[t],o=r(n);return typeof o=="function"&&(o.prototype=o.prototype||{},Object.defineProperties(o,{__rrweb_original__:{enumerable:!1,value:n}})),e[t]=o,()=>{e[t]=n}}catch{return()=>{}}}var S={ownerDocument:Jt,childNodes:Zt,parentNode:Qt,parentElement:Kt,textContent:er,firstChild:tr,lastChild:rr,nextSibling:nr,previousSibling:or,contains:sr,getRootNode:ar,host:ir,styleSheets:lr,shadowRoot:cr,querySelector:dr,querySelectorAll:ur,nowTimestamp:Me,mutationObserverCtor:bt,patch:oe};function wt(e){return e.nodeType===e.ELEMENT_NODE}function Se(e){let t=e&&"host"in e&&"mode"in e&&S.host(e)||null;return!!(t&&"shadowRoot"in t&&S.shadowRoot(t)===e)}function be(e){return Object.prototype.toString.call(e)==="[object ShadowRoot]"}function fr(e){return e.includes(" background-clip: text;")&&!e.includes(" -webkit-background-clip: text;")&&(e=e.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),e}function hr(e){let{cssText:t}=e;if(t.split('"').length<3)return t;let r=["@import",`url(${JSON.stringify(e.href)})`];return e.layerName===""?r.push("layer"):e.layerName&&r.push(`layer(${e.layerName})`),e.supportsText&&r.push(`supports(${e.supportsText})`),e.media.length&&r.push(e.media.mediaText),r.join(" ")+";"}function $e(e){try{let t=e.rules||e.cssRules;if(!t)return null;let r=e.href;return!r&&e.ownerNode&&(r=e.ownerNode.baseURI),fr(Array.from(t,n=>Ct(n,r)).join(""))}catch{return null}}function Ct(e,t){if(mr(e)){let r;try{r=$e(e.styleSheet)||hr(e)}catch{r=e.cssText}return e.styleSheet.href?Ae(r,e.styleSheet.href):r}else{let r=e.cssText;return gr(e)&&e.selectorText.includes(":")&&(r=pr(r)),t?Ae(r,t):r}}function pr(e){return e.replace(/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm,"$1\\$2")}function mr(e){return"styleSheet"in e}function gr(e){return"selectorText"in e}var Mt=class{idNodeMap=new Map;nodeMetaMap=new WeakMap;getId(e){return e?this.getMeta(e)?.id??-1:-1}getNode(e){return this.idNodeMap.get(e)||null}getIds(){return Array.from(this.idNodeMap.keys())}getMeta(e){return this.nodeMetaMap.get(e)||null}removeNodeFromMap(e){let t=this.getId(e);this.idNodeMap.delete(t),e.childNodes&&e.childNodes.forEach(n=>this.removeNodeFromMap(n));let r=S.shadowRoot(e);r&&this.removeNodeFromMap(r)}has(e){return this.idNodeMap.has(e)}hasNode(e){return this.nodeMetaMap.has(e)}add(e,t){let r=t.id;this.idNodeMap.set(r,e),this.nodeMetaMap.set(e,t)}replace(e,t){let r=this.getNode(e);if(r){let n=this.nodeMetaMap.get(r);n&&this.nodeMetaMap.set(t,n)}this.idNodeMap.set(e,t)}reset(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap}};function yr(){return new Mt}function Le({element:e,maskInputOptions:t,tagName:r,type:n,value:o,maskInputFn:s}){let a=o||"",l=n&&ee(n);return(t[r.toLowerCase()]||l&&t[l])&&(s?a=s(a,e):a="*".repeat(a.length)),a}function ee(e){return e.toLowerCase()}var at="__rrweb_original__";function Sr(e){let t=e.getContext("2d");if(!t)return!0;let r=50;for(let n=0;n<e.width;n+=r)for(let o=0;o<e.height;o+=r){let s=t.getImageData,a=at in s?s[at]:s;if(new Uint32Array(a.call(t,n,o,Math.min(r,e.width-n),Math.min(r,e.height-o)).data.buffer).some(l=>l!==0))return!1}return!0}function xe(e){let t=e.type;return e.hasAttribute("data-rr-is-password")?"password":t?ee(t):null}function vt(e,t){let r;try{r=new URL(e,t??window.location.href)}catch{return null}return r.pathname.match(/\.([0-9a-z]+)(?:$)/i)?.[1]??null}function br(e){let t="";return e.indexOf("//")>-1?t=e.split("/").slice(0,3).join("/"):t=e.split("/")[0],t=t.split("?")[0],t}var wr=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,Cr=/^(?:[a-z+]+:)?\/\//i,Mr=/^www\..*/i,vr=/^(data:)([^,]*),(.*)/i,Ir=/^blob:/i;function Ae(e,t){return(e||"").replace(wr,(r,n,o,s,a,l)=>{let i=o||a||l,h=n||s||"";if(!i)return r;if(Cr.test(i)||Mr.test(i))return`url(${h}${i}${h})`;if(vr.test(i)||Ir.test(i))return`url(${h}${i}${h})`;if(i[0]==="#")return`url(${h}${i}${h})`;if(i[0]==="/")return`url(${h}${br(t)+i}${h})`;let f=i.split("#")[0],c=i.substring(f.length),m=t.split("#")[0].split("/"),p=f.split("/");m.pop();for(let d of p)d!=="."&&(d===".."?m.pop():m.push(d));return`url(${h}${m.join("/")}${c}${h})`})}var It="(?:/\\*[^*]*\\*/)|[\\s;]",Rr=new RegExp(`${It}|\\b(0)px?`,"g"),Or=new RegExp(It,"g");function Ee(e,t=!1){return t?e.replace(Or,""):e.replace(Rr,"$1")}function Er(e,t,r=!1){let n=Array.from(t.childNodes),o=[],s=0;if(n.length>1&&e&&typeof e=="string"){let a=Ee(e,r),l=a.length/e.length;for(let i=1;i<n.length;i++)if(n[i].textContent&&typeof n[i].textContent=="string"){let h=Ee(n[i].textContent,r),f=100,c=3;for(;c<h.length&&(h[c].match(/[a-zA-Z0-9]/)||h.indexOf(h.substring(0,c),1)!==-1);c++);for(;c<h.length;c++){let m=h.substring(0,c),p=a.split(m),d=-1;if(p.length===2)d=p[0].length;else if(p.length>2&&p[0]===""&&n[i-1].textContent!=="")d=a.indexOf(m,1);else if(p.length===1){if(m=m.substring(0,m.length-1),p=a.split(m),p.length<=1)return o.push(e),o;c=101}else c===h.length-1&&(d=a.indexOf(m));if(p.length>=2&&c>f){let u=n[i-1].textContent;if(u&&typeof u=="string"){let g=Ee(u).length;d=a.indexOf(m,g)}d===-1&&(d=p[0].length)}if(d!==-1){let u=Math.floor(d/l);for(;u>0&&u<e.length;){if(s+=1,s>50*n.length)return o.push(e),o;let g=Ee(e.substring(0,u),r);if(g.length===d){o.push(e.substring(0,u)),e=e.substring(u),a=a.substring(d);break}else g.length<d?u+=Math.max(1,Math.floor((d-g.length)/l)):u-=Math.max(1,Math.floor((g.length-d)*l))}break}}}}return o.push(e),o}function Nr(e,t){return Er(e,t).join("/* rr_split */")}var kr=1,Tr=new RegExp("[^a-z0-9-_:]");function Rt(){return kr++}function Dr(e){if(e instanceof HTMLFormElement)return"form";let t=ee(e.tagName);return Tr.test(t)?"div":t}var ae,it,Lr=/^[^ \t\n\r\u000c]+/,xr=/^[, \t\n\r\u000c]+/;function Ar(e,t){if(t.trim()==="")return t;let r=0;function n(s){let a,l=s.exec(t.substring(r));return l?(a=l[0],r+=a.length,a):""}let o=[];for(;n(xr),!(r>=t.length);){let s=n(Lr);if(s.slice(-1)===",")s=le(e,s.substring(0,s.length-1)),o.push(s);else{let a="";s=le(e,s);let l=!1;for(;;){let i=t.charAt(r);if(i===""){o.push((s+a).trim());break}else if(l)i===")"&&(l=!1);else if(i===","){r+=1,o.push((s+a).trim());break}else i==="("&&(l=!0);a+=i,r+=1}}}return o.join(", ")}var lt=new WeakMap;function le(e,t){return!t||t.trim()===""?t:Ze(e,t)}function _r(e){return!!(e.tagName==="svg"||e.ownerSVGElement)}function Ze(e,t){let r=lt.get(e);if(r||(r=e.createElement("a"),lt.set(e,r)),!t)t="";else if(t.startsWith("blob:")||t.startsWith("data:"))return t;return r.setAttribute("href",t),r.href}function Ot(e,t,r,n){return n&&(r==="src"||r==="href"&&!(t==="use"&&n[0]==="#")||r==="xlink:href"&&n[0]!=="#"||r==="background"&&["table","td","th"].includes(t)?le(e,n):r==="srcset"?Ar(e,n):r==="style"?Ae(n,Ze(e)):t==="object"&&r==="data"?le(e,n):n)}function Et(e,t,r){return["video","audio"].includes(e)&&ee(t)==="autoplay"}function Nt(e,t,r){try{if(typeof t=="string"){if(e.classList.contains(t))return!0}else for(let n=e.classList.length;n--;){let o=e.classList[n];if(t.test(o))return!0}if(r)return e.matches(r)}catch{}return!1}function _e(e,t,r){if(!e)return!1;if(e.nodeType!==e.ELEMENT_NODE)return r?_e(S.parentNode(e),t,r):!1;for(let n=e.classList.length;n--;){let o=e.classList[n];if(t.test(o))return!0}return r?_e(S.parentNode(e),t,r):!1}function kt(e,t,r,n){let o;if(wt(e)){if(o=e,!S.childNodes(o).length)return!1}else{if(S.parentElement(e)===null)return!1;o=S.parentElement(e)}try{if(typeof t=="string"){if(n){if(o.closest(`.${t}`))return!0}else if(o.classList.contains(t))return!0}else if(_e(o,t,n))return!0;if(r){if(n){if(o.closest(r))return!0}else if(o.matches(r))return!0}}catch{}return!1}function Fr(e,t,r){let n=e.contentWindow;if(!n)return;let o=!1,s;try{s=n.document.readyState}catch{return}if(s!=="complete"){let l=setTimeout(()=>{o||(t(),o=!0)},r);e.addEventListener("load",()=>{clearTimeout(l),o=!0,t()});return}let a="about:blank";if(n.location.href!==a||e.src===a||e.src==="")return setTimeout(t,0),e.addEventListener("load",t);e.addEventListener("load",t)}function Wr(e,t,r){let n=!1,o;try{o=e.sheet}catch{return}if(o)return;let s=setTimeout(()=>{n||(t(),n=!0)},r);e.addEventListener("load",()=>{clearTimeout(s),n=!0,t()})}function Pr(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:a,inlineStylesheet:l,maskInputOptions:i={},maskTextFn:h,maskInputFn:f,dataURLOptions:c={},inlineImages:m,recordCanvas:p,keepIframeSrcFn:d,newlyAddedElement:u=!1,cssCaptured:g=!1}=t,b=Ur(r,n);switch(e.nodeType){case e.DOCUMENT_NODE:return e.compatMode!=="CSS1Compat"?{type:x.Document,childNodes:[],compatMode:e.compatMode}:{type:x.Document,childNodes:[]};case e.DOCUMENT_TYPE_NODE:return{type:x.DocumentType,name:e.name,publicId:e.publicId,systemId:e.systemId,rootId:b};case e.ELEMENT_NODE:return zr(e,{doc:r,blockClass:o,blockSelector:s,inlineStylesheet:l,maskInputOptions:i,maskInputFn:f,dataURLOptions:c,inlineImages:m,recordCanvas:p,keepIframeSrcFn:d,newlyAddedElement:u,rootId:b});case e.TEXT_NODE:return Br(e,{doc:r,needsMask:a,maskTextFn:h,rootId:b,cssCaptured:g});case e.CDATA_SECTION_NODE:return{type:x.CDATA,textContent:"",rootId:b};case e.COMMENT_NODE:return{type:x.Comment,textContent:S.textContent(e)||"",rootId:b};default:return!1}}function Ur(e,t){if(!t.hasNode(e))return;let r=t.getId(e);return r===1?void 0:r}function Br(e,t){let{needsMask:r,maskTextFn:n,rootId:o,cssCaptured:s}=t,a=S.parentNode(e),l=a&&a.tagName,i="",h=l==="STYLE"?!0:void 0,f=l==="SCRIPT"?!0:void 0;return f?i="SCRIPT_PLACEHOLDER":s||(i=S.textContent(e),h&&i&&(i=Ae(i,Ze(t.doc)))),!h&&!f&&i&&r&&(i=n?n(i,S.parentElement(e)):i.replace(/[\S]/g,"*")),{type:x.Text,textContent:i||"",rootId:o}}function zr(e,t){let{doc:r,blockClass:n,blockSelector:o,inlineStylesheet:s,maskInputOptions:a={},maskInputFn:l,dataURLOptions:i={},inlineImages:h,recordCanvas:f,keepIframeSrcFn:c,newlyAddedElement:m=!1,rootId:p}=t,d=Nt(e,n,o),u=Dr(e),g={},b=e.attributes.length;for(let y=0;y<b;y++){let C=e.attributes[y];Et(u,C.name,C.value)||(g[C.name]=Ot(r,u,ee(C.name),C.value))}if(u==="link"&&s){let y=Array.from(r.styleSheets).find(L=>L.href===e.href),C=null;y&&(C=$e(y)),C&&(delete g.rel,delete g.href,g._cssText=C)}if(u==="style"&&e.sheet){let y=$e(e.sheet);y&&(e.childNodes.length>1&&(y=Nr(y,e)),g._cssText=y)}if(["input","textarea","select"].includes(u)){let y=e.value,C=e.checked;g.type!=="radio"&&g.type!=="checkbox"&&g.type!=="submit"&&g.type!=="button"&&y?g.value=Le({element:e,type:xe(e),tagName:u,value:y,maskInputOptions:a,maskInputFn:l}):C&&(g.checked=C)}if(u==="option"&&(e.selected&&!a.select?g.selected=!0:delete g.selected),u==="dialog"&&e.open&&(g.rr_open_mode=e.matches("dialog:modal")?"modal":"non-modal"),u==="canvas"&&f){if(e.__context==="2d")Sr(e)||(g.rr_dataURL=e.toDataURL(i.type,i.quality));else if(!("__context"in e)){let y=e.toDataURL(i.type,i.quality),C=r.createElement("canvas");C.width=e.width,C.height=e.height,y!==C.toDataURL(i.type,i.quality)&&(g.rr_dataURL=y)}}if(u==="img"&&h){ae||(ae=r.createElement("canvas"),it=ae.getContext("2d"));let y=e,C=y.currentSrc||y.getAttribute("src")||"<unknown-src>",L=y.crossOrigin,D=()=>{y.removeEventListener("load",D);try{ae.width=y.naturalWidth,ae.height=y.naturalHeight,it.drawImage(y,0,0),g.rr_dataURL=ae.toDataURL(i.type,i.quality)}catch(z){if(y.crossOrigin!=="anonymous"){y.crossOrigin="anonymous",y.complete&&y.naturalWidth!==0?D():y.addEventListener("load",D);return}else console.warn(`Cannot inline img src=${C}! Error: ${z}`)}y.crossOrigin==="anonymous"&&(L?g.crossOrigin=L:y.removeAttribute("crossorigin"))};y.complete&&y.naturalWidth!==0?D():y.addEventListener("load",D)}if(["audio","video"].includes(u)){let y=g;y.rr_mediaState=e.paused?"paused":"played",y.rr_mediaCurrentTime=e.currentTime,y.rr_mediaPlaybackRate=e.playbackRate,y.rr_mediaMuted=e.muted,y.rr_mediaLoop=e.loop,y.rr_mediaVolume=e.volume}if(m||(e.scrollLeft&&(g.rr_scrollLeft=e.scrollLeft),e.scrollTop&&(g.rr_scrollTop=e.scrollTop)),d){let{width:y,height:C}=e.getBoundingClientRect();g={class:g.class,rr_width:`${y}px`,rr_height:`${C}px`}}u==="iframe"&&!c(g.src)&&(e.contentDocument||(g.rr_src=g.src),delete g.src);let w;try{customElements.get(u)&&(w=!0)}catch{}return{type:x.Element,tagName:u,attributes:g,childNodes:[],isSVG:_r(e)||void 0,needBlock:d,rootId:p,isCustom:w}}function k(e){return e==null?"":e.toLowerCase()}function Tt(e){return e===!0||e==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:e==="all",headMetaDescKeywords:e==="all",headTitleMutations:e==="all"}:e||{}}function Hr(e,t){if(t.comment&&e.type===x.Comment)return!0;if(e.type===x.Element){if(t.script&&(e.tagName==="script"||e.tagName==="link"&&(e.attributes.rel==="preload"&&e.attributes.as==="script"||e.attributes.rel==="modulepreload")||e.tagName==="link"&&e.attributes.rel==="prefetch"&&typeof e.attributes.href=="string"&&vt(e.attributes.href)==="js"))return!0;if(t.headFavicon&&(e.tagName==="link"&&e.attributes.rel==="shortcut icon"||e.tagName==="meta"&&(k(e.attributes.name).match(/^msapplication-tile(image|color)$/)||k(e.attributes.name)==="application-name"||k(e.attributes.rel)==="icon"||k(e.attributes.rel)==="apple-touch-icon"||k(e.attributes.rel)==="shortcut icon")))return!0;if(e.tagName==="meta"){if(t.headMetaDescKeywords&&k(e.attributes.name).match(/^description|keywords$/))return!0;if(t.headMetaSocial&&(k(e.attributes.property).match(/^(og|twitter|fb):/)||k(e.attributes.name).match(/^(og|twitter):/)||k(e.attributes.name)==="pinterest"))return!0;if(t.headMetaRobots&&(k(e.attributes.name)==="robots"||k(e.attributes.name)==="googlebot"||k(e.attributes.name)==="bingbot"))return!0;if(t.headMetaHttpEquiv&&e.attributes["http-equiv"]!==void 0)return!0;if(t.headMetaAuthorship&&(k(e.attributes.name)==="author"||k(e.attributes.name)==="generator"||k(e.attributes.name)==="framework"||k(e.attributes.name)==="publisher"||k(e.attributes.name)==="progid"||k(e.attributes.property).match(/^article:/)||k(e.attributes.property).match(/^product:/)))return!0;if(t.headMetaVerification&&(k(e.attributes.name)==="google-site-verification"||k(e.attributes.name)==="yandex-verification"||k(e.attributes.name)==="csrf-token"||k(e.attributes.name)==="p:domain_verify"||k(e.attributes.name)==="verify-v1"||k(e.attributes.name)==="verification"||k(e.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function ce(e,t){let{doc:r,mirror:n,blockClass:o,blockSelector:s,maskTextClass:a,maskTextSelector:l,skipChild:i=!1,inlineStylesheet:h=!0,maskInputOptions:f={},maskTextFn:c,maskInputFn:m,slimDOMOptions:p,dataURLOptions:d={},inlineImages:u=!1,recordCanvas:g=!1,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:y=5e3,onStylesheetLoad:C,stylesheetLoadTimeout:L=5e3,keepIframeSrcFn:D=()=>!1,newlyAddedElement:z=!1,cssCaptured:te=!1}=t,{needsMask:P}=t,{preserveWhiteSpace:j=!0}=t;P||(P=kt(e,a,l,P===void 0));let X=Pr(e,{doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:P,inlineStylesheet:h,maskInputOptions:f,maskTextFn:c,maskInputFn:m,dataURLOptions:d,inlineImages:u,recordCanvas:g,keepIframeSrcFn:D,newlyAddedElement:z,cssCaptured:te});if(!X)return console.warn(e,"not serialized"),null;let Y;n.hasNode(e)?Y=n.getId(e):Hr(X,p)||!j&&X.type===x.Text&&!X.textContent.replace(/^\s+|\s+$/gm,"").length?Y=-2:Y=Rt();let E=Object.assign(X,{id:Y});if(n.add(e,E),Y===-2)return null;b&&b(e);let he=!i;if(E.type===x.Element){he=he&&!E.needBlock,delete E.needBlock;let A=S.shadowRoot(e);A&&be(A)&&(E.isShadowHost=!0)}if((E.type===x.Document||E.type===x.Element)&&he){p.headWhitespace&&E.type===x.Element&&E.tagName==="head"&&(j=!1);let A={doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:P,maskTextClass:a,maskTextSelector:l,skipChild:i,inlineStylesheet:h,maskInputOptions:f,maskTextFn:c,maskInputFn:m,slimDOMOptions:p,dataURLOptions:d,inlineImages:u,recordCanvas:g,preserveWhiteSpace:j,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:y,onStylesheetLoad:C,stylesheetLoadTimeout:L,keepIframeSrcFn:D,cssCaptured:!1};if(!(E.type===x.Element&&E.tagName==="textarea"&&E.attributes.value!==void 0)){E.type===x.Element&&E.attributes._cssText!==void 0&&typeof E.attributes._cssText=="string"&&(A.cssCaptured=!0);for(let re of Array.from(S.childNodes(e))){let q=ce(re,A);q&&E.childNodes.push(q)}}let H=null;if(wt(e)&&(H=S.shadowRoot(e)))for(let re of Array.from(S.childNodes(H))){let q=ce(re,A);q&&(be(H)&&(q.isShadow=!0),E.childNodes.push(q))}}let pe=S.parentNode(e);return pe&&Se(pe)&&be(pe)&&(E.isShadow=!0),E.type===x.Element&&E.tagName==="iframe"&&!Nt(e,o,s)&&Fr(e,()=>{let A=e.contentDocument;if(A&&w){let H=ce(A,{doc:A,mirror:n,blockClass:o,blockSelector:s,needsMask:P,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:c,maskInputFn:m,slimDOMOptions:p,dataURLOptions:d,inlineImages:u,recordCanvas:g,preserveWhiteSpace:j,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:y,onStylesheetLoad:C,stylesheetLoadTimeout:L,keepIframeSrcFn:D});H&&w(e,H)}},y),E.type===x.Element&&E.tagName==="link"&&typeof E.attributes.rel=="string"&&(E.attributes.rel==="stylesheet"||E.attributes.rel==="preload"&&typeof E.attributes.href=="string"&&vt(E.attributes.href)==="css")&&Wr(e,()=>{if(C){let A=ce(e,{doc:r,mirror:n,blockClass:o,blockSelector:s,needsMask:P,maskTextClass:a,maskTextSelector:l,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:c,maskInputFn:m,slimDOMOptions:p,dataURLOptions:d,inlineImages:u,recordCanvas:g,preserveWhiteSpace:j,onSerialize:b,onIframeLoad:w,iframeLoadTimeout:y,onStylesheetLoad:C,stylesheetLoadTimeout:L,keepIframeSrcFn:D});A&&C(e,A)}},L),E}function Gr(e,t){let{mirror:r=new Mt,blockClass:n="rr-block",blockSelector:o=null,maskTextClass:s="rr-mask",maskTextSelector:a=null,inlineStylesheet:l=!0,inlineImages:i=!1,recordCanvas:h=!1,maskAllInputs:f=!1,maskTextFn:c,maskInputFn:m,slimDOM:p=!1,dataURLOptions:d,preserveWhiteSpace:u,onSerialize:g,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:y,stylesheetLoadTimeout:C,keepIframeSrcFn:L=()=>!1}=t||{};return ce(e,{doc:e,mirror:r,blockClass:n,blockSelector:o,maskTextClass:s,maskTextSelector:a,skipChild:!1,inlineStylesheet:l,maskInputOptions:f===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:f===!1?{password:!0}:f,maskTextFn:c,maskInputFn:m,slimDOMOptions:Tt(p),dataURLOptions:d,inlineImages:i,recordCanvas:h,preserveWhiteSpace:u,onSerialize:g,onIframeLoad:b,iframeLoadTimeout:w,onStylesheetLoad:y,stylesheetLoadTimeout:C,keepIframeSrcFn:L,newlyAddedElement:!1})}var Vr=class Dt{parentElement=null;parentNode=null;ownerDocument;firstChild=null;lastChild=null;previousSibling=null;nextSibling=null;ELEMENT_NODE=1;TEXT_NODE=3;nodeType;nodeName;RRNodeType;constructor(...t){}get childNodes(){let t=[],r=this.firstChild;for(;r;)t.push(r),r=r.nextSibling;return t}contains(t){if(t instanceof Dt){if(t.ownerDocument!==this.ownerDocument)return!1;if(t===this)return!0}else return!1;for(;t.parentNode;){if(t.parentNode===this)return!0;t=t.parentNode}return!1}appendChild(t){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")}insertBefore(t,r){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")}removeChild(t){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")}toString(){return"RRNode"}};function _(e,t,r=document){let n={capture:!0,passive:!0};return r.addEventListener(e,t,n),()=>r.removeEventListener(e,t,n)}var ie=`Please stop import mirror directly. Instead of that,\r
3
+ now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
4
+ or you can use record.mirror to access the mirror instance during recording.`,ct={map:{},getId(){return console.error(ie),-1},getNode(){return console.error(ie),null},removeNodeFromMap(){console.error(ie)},has(){return console.error(ie),!1},reset(){console.error(ie)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(ct=new Proxy(ct,{get(e,t,r){return t==="map"&&console.error(ie),Reflect.get(e,t,r)}}));function ve(e,t,r={}){let n=null,o=0;return function(...s){let a=Date.now();!o&&r.leading===!1&&(o=a);let l=t-(a-o),i=this;l<=0||l>t?(n&&(clearTimeout(n),n=null),o=a,e.apply(i,s)):!n&&r.trailing!==!1&&(n=setTimeout(()=>{o=r.leading===!1?0:Date.now(),n=null,e.apply(i,s)},l))}}function We(e,t,r,n,o=window){let s=o.Object.getOwnPropertyDescriptor(e,t);return o.Object.defineProperty(e,t,n?r:{set(a){setTimeout(()=>{r.set.call(this,a)},0),s&&s.set&&s.set.call(this,a)}}),()=>We(e,t,s||{},!0)}function Lt(e){let t=e.document;return{left:t.scrollingElement?t.scrollingElement.scrollLeft:e.pageXOffset!==void 0?e.pageXOffset:t.documentElement.scrollLeft||t?.body&&S.parentElement(t.body)?.scrollLeft||t?.body?.scrollLeft||0,top:t.scrollingElement?t.scrollingElement.scrollTop:e.pageYOffset!==void 0?e.pageYOffset:t?.documentElement.scrollTop||t?.body&&S.parentElement(t.body)?.scrollTop||t?.body?.scrollTop||0}}function xt(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function At(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function _t(e){return e?e.nodeType===e.ELEMENT_NODE?e:S.parentElement(e):null}function F(e,t,r,n){if(!e)return!1;let o=_t(e);if(!o)return!1;try{if(typeof t=="string"){if(o.classList.contains(t)||n&&o.closest("."+t)!==null)return!0}else if(_e(o,t,n))return!0}catch{}return!!(r&&(o.matches(r)||n&&o.closest(r)!==null))}function $r(e,t){return t.getId(e)!==-1}function He(e,t,r){return e.tagName==="TITLE"&&r.headTitleMutations?!0:t.getId(e)===-2}function Ft(e,t){if(Se(e))return!1;let r=t.getId(e);if(!t.has(r))return!0;let n=S.parentNode(e);return n&&n.nodeType===e.DOCUMENT_NODE?!1:n?Ft(n,t):!0}function je(e){return!!e.changedTouches}function jr(e=window){"NodeList"in e&&!e.NodeList.prototype.forEach&&(e.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in e&&!e.DOMTokenList.prototype.forEach&&(e.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Wt(e,t){return!!(e.nodeName==="IFRAME"&&t.getMeta(e))}function Pt(e,t){return!!(e.nodeName==="LINK"&&e.nodeType===e.ELEMENT_NODE&&e.getAttribute&&e.getAttribute("rel")==="stylesheet"&&t.getMeta(e))}function qe(e){return e?e instanceof Vr&&"shadowRoot"in e?!!e.shadowRoot:!!S.shadowRoot(e):!1}var qr=class{id=1;styleIDMap=new WeakMap;idStyleMap=new Map;getId(e){return this.styleIDMap.get(e)??-1}has(e){return this.styleIDMap.has(e)}add(e,t){if(this.has(e))return this.getId(e);let r;return t===void 0?r=this.id++:r=t,this.styleIDMap.set(e,r),this.idStyleMap.set(r,e),r}getStyle(e){return this.idStyleMap.get(e)||null}reset(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1}generateId(){return this.id++}};function Ut(e){let t=null;return"getRootNode"in e&&S.getRootNode(e)?.nodeType===Node.DOCUMENT_FRAGMENT_NODE&&S.host(S.getRootNode(e))&&(t=S.host(S.getRootNode(e))),t}function Xr(e){let t=e,r;for(;r=Ut(t);)t=r;return t}function Yr(e){let t=S.ownerDocument(e);if(!t)return!1;let r=Xr(e);return S.contains(t,r)}function Xe(e){let t=S.ownerDocument(e);return t?S.contains(t,e)||Yr(e):!1}var dt=(e,t)=>`${e}@${t}`,Jr=class{frozen=!1;locked=!1;texts=[];attributes=[];attributeMap=new WeakMap;removes=[];mapRemoves=[];movedMap={};addedSet=new Set;movedSet=new Set;droppedSet=new Set;removesSubTreeCache=new Set;mutationCb;blockClass;blockSelector;maskTextClass;maskTextSelector;inlineStylesheet;maskInputOptions;maskTextFn;maskInputFn;keepIframeSrcFn;recordCanvas;inlineImages;slimDOMOptions;dataURLOptions;doc;mirror;iframeManager;stylesheetManager;shadowDomManager;processedNodeManager;unattachedDoc;init(e){["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","processedNodeManager"].forEach(t=>{this[t]=e[t]})}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1,this.emit()}isFrozen(){return this.frozen}lock(){this.locked=!0}unlock(){this.locked=!1,this.emit()}processMutations=e=>{e.forEach(this.processMutation),this.emit()};emit=()=>{if(this.frozen||this.locked)return;let e=[],t=new Set;for(;this.mapRemoves.length;)this.mirror.removeNodeFromMap(this.mapRemoves.shift());for(let c of this.movedSet){let m=S.parentNode(c);this.removesSubTreeCache.has(m)&&!this.movedSet.has(m)||this.addedSet.add(c)}let r=null,n=null,o=-1,s=null,a=!1,l=new Set,i=this.addedSet.values(),h=i.next();for(;this.addedSet.size;){if(r!==null&&this.addedSet.has(S.previousSibling(r)))s=r,r=S.previousSibling(r);else{for(this.addedSet.has(h.value)||(h=i.next()),r=h.value;;){if(n=S.parentNode(r),this.addedSet.has(n)){r=n;continue}break}if(l.has(n))n=null;else if(n){if(Xe(n)?(a=ut(this.droppedSet,n)||this.removesSubTreeCache.has(n),a&&ut(this.movedSet,r)&&(a=!1)):a=!0,this.addedSet.has(S.lastChild(n)))r=S.lastChild(n),s=null;else for(;;){if(s=S.nextSibling(r),this.addedSet.has(s)){r=s;continue}break}if(o=Se(n)?this.mirror.getId(Ut(r)):this.mirror.getId(n),o===-1&&n.nodeType===Node.DOCUMENT_FRAGMENT_NODE){let d=S.host(n);o=this.mirror.getId(d)}}}if(this.addedSet.delete(r),!n||o===-1){l.add(r);continue}else if(a){this.droppedSet.add(r);continue}let c=!1;if(r.nodeType===Node.TEXT_NODE){let d=n.tagName;if(d==="TEXTAREA")continue;d==="STYLE"&&t.has(o)&&(c=!0)}let m=s?this.mirror.getId(s):null;for(;m===-2;)s=s&&S.nextSibling(s),m=s&&this.mirror.getId(s);if(m===-1){console.warn("Couldn't record new node. Couldn't find mirror id for nextSibling:",s),r=null;continue}let p=ce(r,{doc:this.doc,mirror:this.mirror,blockClass:this.blockClass,blockSelector:this.blockSelector,maskTextClass:this.maskTextClass,maskTextSelector:this.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:this.inlineStylesheet,maskInputOptions:this.maskInputOptions,maskTextFn:this.maskTextFn,maskInputFn:this.maskInputFn,slimDOMOptions:this.slimDOMOptions,dataURLOptions:this.dataURLOptions,recordCanvas:this.recordCanvas,inlineImages:this.inlineImages,onSerialize:d=>{Wt(d,this.mirror)&&this.iframeManager.addIframe(d),Pt(d,this.mirror)&&this.stylesheetManager.trackLinkElement(d),qe(r)&&this.shadowDomManager.addShadowRoot(S.shadowRoot(r),this.doc)},onIframeLoad:(d,u)=>{this.iframeManager.attachIframe(d,u),this.shadowDomManager.observeAttachShadow(d)},onStylesheetLoad:(d,u)=>{this.stylesheetManager.attachLinkElement(d,u)},cssCaptured:c});p&&(e.push({parentId:o,nextId:m,node:p}),t.add(p.id))}let f={texts:this.texts.map(c=>{let m=c.node,p=S.parentNode(m);return p&&p.tagName==="TEXTAREA"&&this.genTextAreaValueMutation(p),{id:this.mirror.getId(m),value:c.value}}).filter(c=>!t.has(c.id)).filter(c=>this.mirror.has(c.id)),attributes:this.attributes.map(c=>{let{attributes:m}=c;if(typeof m.style=="string"){let p=JSON.stringify(c.styleDiff),d=JSON.stringify(c._unchangedStyles);p.length<m.style.length&&(p+d).split("var(").length===m.style.split("var(").length&&(m.style=c.styleDiff)}return{id:this.mirror.getId(c.node),attributes:m}}).filter(c=>!t.has(c.id)).filter(c=>this.mirror.has(c.id)),removes:this.removes,adds:e};!f.texts.length&&!f.attributes.length&&!f.removes.length&&!f.adds.length||(this.texts=[],this.attributes=[],this.attributeMap=new WeakMap,this.removes=[],this.addedSet=new Set,this.movedSet=new Set,this.droppedSet=new Set,this.removesSubTreeCache=new Set,this.movedMap={},this.mutationCb(f))};genTextAreaValueMutation=e=>{let t=this.attributeMap.get(e);t||(t={node:e,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(t),this.attributeMap.set(e,t));let r=Array.from(S.childNodes(e),n=>S.textContent(n)||"").join("");t.attributes.value=Le({element:e,maskInputOptions:this.maskInputOptions,tagName:e.tagName,type:xe(e),value:r,maskInputFn:this.maskInputFn})};processMutation=e=>{if(!He(e.target,this.mirror,this.slimDOMOptions))switch(e.type){case"characterData":{let t=S.textContent(e.target);!F(e.target,this.blockClass,this.blockSelector,!1)&&t!==e.oldValue&&this.texts.push({value:kt(e.target,this.maskTextClass,this.maskTextSelector,!0)&&t?this.maskTextFn?this.maskTextFn(t,_t(e.target)):t.replace(/[\S]/g,"*"):t,node:e.target});break}case"attributes":{let t=e.target,r=ee(t.tagName),n=e.attributeName,o=e.target.getAttribute(n);if(n==="value"){let a=xe(t);o=Le({element:t,maskInputOptions:this.maskInputOptions,tagName:t.tagName,type:a,value:o,maskInputFn:this.maskInputFn})}if(F(e.target,this.blockClass,this.blockSelector,!1)||o===e.oldValue)return;let s=this.attributeMap.get(e.target);if(r==="iframe"&&n==="src"&&!this.keepIframeSrcFn(o))if(!t.contentDocument)n="rr_src";else return;if(s||(s={node:e.target,attributes:{},styleDiff:{},_unchangedStyles:{}},this.attributes.push(s),this.attributeMap.set(e.target,s)),n==="type"&&r==="input"&&(e.oldValue||"").toLowerCase()==="password"&&t.setAttribute("data-rr-is-password","true"),!Et(r,n,o))if(s.attributes[n]=Ot(this.doc,r,ee(n),o),n==="style"){if(!this.unattachedDoc)try{this.unattachedDoc=document.implementation.createHTMLDocument()}catch{this.unattachedDoc=this.doc}let a=this.unattachedDoc.createElement("span");e.oldValue&&a.setAttribute("style",e.oldValue);for(let l of Array.from(t.style)){let i=t.style.getPropertyValue(l),h=t.style.getPropertyPriority(l);i!==a.style.getPropertyValue(l)||h!==a.style.getPropertyPriority(l)?h===""?s.styleDiff[l]=i:s.styleDiff[l]=[i,h]:s._unchangedStyles[l]=[i,h]}for(let l of Array.from(a.style))t.style.getPropertyValue(l)===""&&(s.styleDiff[l]=!1)}else n==="open"&&t.tagName==="DIALOG"&&(t.matches("dialog:modal")?s.attributes.rr_open_mode="modal":s.attributes.rr_open_mode="non-modal");break}case"childList":if(F(e.target,this.blockClass,this.blockSelector,!0))return;if(e.target.tagName==="TEXTAREA"){this.genTextAreaValueMutation(e.target);return}e.addedNodes.forEach(t=>this.genAdds(t,e.target)),e.removedNodes.forEach(t=>{Xe(t)||this.shadowDomManager.removeShadowRootsIn(t);let r=this.mirror.getId(t),n=Se(e.target)?this.mirror.getId(S.host(e.target)):this.mirror.getId(e.target);F(e.target,this.blockClass,this.blockSelector,!1)||He(t,this.mirror,this.slimDOMOptions)||!$r(t,this.mirror)||(this.addedSet.has(t)?(Ye(this.addedSet,t),this.droppedSet.add(t)):this.addedSet.has(e.target)&&r===-1||Ft(e.target,this.mirror)||(this.movedSet.has(t)&&this.movedMap[dt(r,n)]?Ye(this.movedSet,t):(this.removes.push({parentId:n,id:r,isShadow:Se(e.target)&&be(e.target)?!0:void 0}),Zr(t,this.removesSubTreeCache))),this.mapRemoves.push(t))})}};genAdds=(e,t)=>{if(!this.processedNodeManager.inOtherBuffer(e,this)&&!(this.addedSet.has(e)||this.movedSet.has(e))){if(this.mirror.hasNode(e)){if(He(e,this.mirror,this.slimDOMOptions))return;this.movedSet.add(e);let r=null;t&&this.mirror.hasNode(t)&&(r=this.mirror.getId(t)),r&&r!==-1&&(this.movedMap[dt(this.mirror.getId(e),r)]=!0)}else this.addedSet.add(e),this.droppedSet.delete(e);F(e,this.blockClass,this.blockSelector,!1)||(S.childNodes(e).forEach(r=>this.genAdds(r)),qe(e)&&S.childNodes(S.shadowRoot(e)).forEach(r=>{this.processedNodeManager.add(r,this),this.genAdds(r,e)}))}}};function Ye(e,t){e.delete(t),S.childNodes(t).forEach(r=>Ye(e,r))}function Zr(e,t){let r=[e];for(;r.length;){let n=r.pop();t.has(n)||(t.add(n),S.childNodes(n).forEach(o=>r.push(o)))}}function ut(e,t){return e.size===0?!1:Bt(e,t)}function Bt(e,t){if(e.has(t))return!0;let r=S.parentNode(t);return r?Bt(e,r):!1}var we;function Qr(e){we=e}function Kr(){we=void 0}var O=e=>we?((...r)=>{try{return e(...r)}catch(n){if(we&&we(n)===!0)return;throw n}}):e,ue=new Set;function Re(e){try{if("composedPath"in e){let t=e.composedPath();if(t.length)return t[0]}else if("path"in e&&e.path.length)return e.path[0]}catch{}return e&&e.target}function zt(e,t){let r=new Jr;ue.add(r),r.init(e);let[n,o]=bt(),s=new n(O(r.processMutations.bind(r)));return s.observe(t,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),()=>{s.disconnect(),ue.delete(r),o()}}function en({mousemoveCb:e,sampling:t,doc:r,mirror:n}){if(t.mousemove===!1)return()=>{};let o=typeof t.mousemove=="number"?t.mousemove:50,s=typeof t.mousemoveCallback=="number"?t.mousemoveCallback:500,a=[],l,i=ve(O(c=>{let m=Date.now()-l;e(a.map(p=>(p.timeOffset-=m,p)),c),a=[],l=null}),s),h=O(ve(O(c=>{let m=Re(c),{clientX:p,clientY:d}=je(c)?c.changedTouches[0]:c;l||(l=Me()),a.push({x:p,y:d,id:n.getId(m),timeOffset:Me()-l}),i(typeof DragEvent<"u"&&c instanceof DragEvent?R.Drag:c instanceof MouseEvent?R.MouseMove:R.TouchMove)}),o,{trailing:!1})),f=[_("mousemove",h,r),_("touchmove",h,r),_("drag",h,r)];return O(()=>{f.forEach(c=>c())})}function tn({mouseInteractionCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:s}){if(s.mouseInteraction===!1)return()=>{};let a=s.mouseInteraction===!0||s.mouseInteraction===void 0?{}:s.mouseInteraction,l=[],i=null,h=f=>c=>{let m=Re(c);if(F(m,n,o,!0))return;let p=null,d=f;if("pointerType"in c){switch(c.pointerType){case"mouse":p=Z.Mouse;break;case"touch":p=Z.Touch;break;case"pen":p=Z.Pen}p===Z.Touch?U[f]===U.MouseDown?d="TouchStart":U[f]===U.MouseUp&&(d="TouchEnd"):Z.Pen}else je(c)&&(p=Z.Touch);p!==null?(i=p,(d.startsWith("Touch")&&p===Z.Touch||d.startsWith("Mouse")&&p===Z.Mouse)&&(p=null)):U[f]===U.Click&&(p=i,i=null);let u=je(c)?c.changedTouches[0]:c;if(!u)return;let g=r.getId(m),{clientX:b,clientY:w}=u;O(e)({type:U[d],id:g,x:b,y:w,...p!==null&&{pointerType:p}})};return Object.keys(U).filter(f=>Number.isNaN(Number(f))&&!f.endsWith("_Departed")&&a[f]!==!1).forEach(f=>{let c=ee(f),m=h(f);if(window.PointerEvent)switch(U[f]){case U.MouseDown:case U.MouseUp:c=c.replace("mouse","pointer");break;case U.TouchStart:case U.TouchEnd:return}l.push(_(c,m,t))}),O(()=>{l.forEach(f=>f())})}function Ht({scrollCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,sampling:s}){return _("scroll",O(ve(O(a=>{let l=Re(a);if(!l||F(l,n,o,!0))return;let i=r.getId(l);if(l===t&&t.defaultView){let h=Lt(t.defaultView);e({id:i,x:h.left,y:h.top})}else e({id:i,x:l.scrollLeft,y:l.scrollTop})}),s.scroll||100)),t)}function rn({viewportResizeCb:e},{win:t}){let r=-1,n=-1;return _("resize",O(ve(O(()=>{let o=xt(),s=At();(r!==o||n!==s)&&(e({width:Number(s),height:Number(o)}),r=o,n=s)}),200)),t)}var nn=["INPUT","TEXTAREA","SELECT"],ft=new WeakMap;function on({inputCb:e,doc:t,mirror:r,blockClass:n,blockSelector:o,ignoreClass:s,ignoreSelector:a,maskInputOptions:l,maskInputFn:i,sampling:h,userTriggeredOnInput:f}){function c(b){let w=Re(b),y=b.isTrusted,C=w&&w.tagName;if(w&&C==="OPTION"&&(w=S.parentElement(w)),!w||!C||nn.indexOf(C)<0||F(w,n,o,!0)||w.classList.contains(s)||a&&w.matches(a))return;let L=w.value,D=!1,z=xe(w)||"";z==="radio"||z==="checkbox"?D=w.checked:(l[C.toLowerCase()]||l[z])&&(L=Le({element:w,maskInputOptions:l,tagName:C,type:z,value:L,maskInputFn:i})),m(w,f?{text:L,isChecked:D,userTriggered:y}:{text:L,isChecked:D});let te=w.name;z==="radio"&&te&&D&&t.querySelectorAll(`input[type="radio"][name="${te}"]`).forEach(P=>{if(P!==w){let j=P.value;m(P,f?{text:j,isChecked:!D,userTriggered:!1}:{text:j,isChecked:!D})}})}function m(b,w){let y=ft.get(b);if(!y||y.text!==w.text||y.isChecked!==w.isChecked){ft.set(b,w);let C=r.getId(b);O(e)({...w,id:C})}}let p=(h.input==="last"?["change"]:["input","change"]).map(b=>_(b,O(c),t)),d=t.defaultView;if(!d)return()=>{p.forEach(b=>b())};let u=d.Object.getOwnPropertyDescriptor(d.HTMLInputElement.prototype,"value"),g=[[d.HTMLInputElement.prototype,"value"],[d.HTMLInputElement.prototype,"checked"],[d.HTMLSelectElement.prototype,"value"],[d.HTMLTextAreaElement.prototype,"value"],[d.HTMLSelectElement.prototype,"selectedIndex"],[d.HTMLOptionElement.prototype,"selected"]];return u&&u.set&&p.push(...g.map(b=>We(b[0],b[1],{set(){O(c)({target:this,isTrusted:!1})}},!1,d))),O(()=>{p.forEach(b=>b())})}function Fe(e){let t=[];function r(n,o){if(Ne("CSSGroupingRule")&&n.parentRule instanceof CSSGroupingRule||Ne("CSSMediaRule")&&n.parentRule instanceof CSSMediaRule||Ne("CSSSupportsRule")&&n.parentRule instanceof CSSSupportsRule||Ne("CSSConditionRule")&&n.parentRule instanceof CSSConditionRule){let s=Array.from(n.parentRule.cssRules).indexOf(n);return o.unshift(s),r(n.parentRule,o)}else if(n.parentStyleSheet){let s=Array.from(n.parentStyleSheet.cssRules).indexOf(n);o.unshift(s)}return o}return r(e,t)}function K(e,t,r){let n,o;return e?(e.ownerNode?n=t.getId(e.ownerNode):o=r.getId(e),{styleId:o,id:n}):{}}function sn({styleSheetRuleCb:e,mirror:t,stylesheetManager:r},{win:n}){if(!n.CSSStyleSheet||!n.CSSStyleSheet.prototype)return()=>{};let o=n.CSSStyleSheet.prototype.insertRule;n.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:O((f,c,m)=>{let[p,d]=m,{id:u,styleId:g}=K(c,t,r.styleMirror);return(u&&u!==-1||g&&g!==-1)&&e({id:u,styleId:g,adds:[{rule:p,index:d}]}),f.apply(c,m)})}),n.CSSStyleSheet.prototype.addRule=function(f,c,m=this.cssRules.length){let p=`${f} { ${c} }`;return n.CSSStyleSheet.prototype.insertRule.apply(this,[p,m])};let s=n.CSSStyleSheet.prototype.deleteRule;n.CSSStyleSheet.prototype.deleteRule=new Proxy(s,{apply:O((f,c,m)=>{let[p]=m,{id:d,styleId:u}=K(c,t,r.styleMirror);return(d&&d!==-1||u&&u!==-1)&&e({id:d,styleId:u,removes:[{index:p}]}),f.apply(c,m)})}),n.CSSStyleSheet.prototype.removeRule=function(f){return n.CSSStyleSheet.prototype.deleteRule.apply(this,[f])};let a;n.CSSStyleSheet.prototype.replace&&(a=n.CSSStyleSheet.prototype.replace,n.CSSStyleSheet.prototype.replace=new Proxy(a,{apply:O((f,c,m)=>{let[p]=m,{id:d,styleId:u}=K(c,t,r.styleMirror);return(d&&d!==-1||u&&u!==-1)&&e({id:d,styleId:u,replace:p}),f.apply(c,m)})}));let l;n.CSSStyleSheet.prototype.replaceSync&&(l=n.CSSStyleSheet.prototype.replaceSync,n.CSSStyleSheet.prototype.replaceSync=new Proxy(l,{apply:O((f,c,m)=>{let[p]=m,{id:d,styleId:u}=K(c,t,r.styleMirror);return(d&&d!==-1||u&&u!==-1)&&e({id:d,styleId:u,replaceSync:p}),f.apply(c,m)})}));let i={};ke("CSSGroupingRule")?i.CSSGroupingRule=n.CSSGroupingRule:(ke("CSSMediaRule")&&(i.CSSMediaRule=n.CSSMediaRule),ke("CSSConditionRule")&&(i.CSSConditionRule=n.CSSConditionRule),ke("CSSSupportsRule")&&(i.CSSSupportsRule=n.CSSSupportsRule));let h={};return Object.entries(i).forEach(([f,c])=>{h[f]={insertRule:c.prototype.insertRule,deleteRule:c.prototype.deleteRule},c.prototype.insertRule=new Proxy(h[f].insertRule,{apply:O((m,p,d)=>{let[u,g]=d,{id:b,styleId:w}=K(p.parentStyleSheet,t,r.styleMirror);return(b&&b!==-1||w&&w!==-1)&&e({id:b,styleId:w,adds:[{rule:u,index:[...Fe(p),g||0]}]}),m.apply(p,d)})}),c.prototype.deleteRule=new Proxy(h[f].deleteRule,{apply:O((m,p,d)=>{let[u]=d,{id:g,styleId:b}=K(p.parentStyleSheet,t,r.styleMirror);return(g&&g!==-1||b&&b!==-1)&&e({id:g,styleId:b,removes:[{index:[...Fe(p),u]}]}),m.apply(p,d)})})}),O(()=>{n.CSSStyleSheet.prototype.insertRule=o,n.CSSStyleSheet.prototype.deleteRule=s,a&&(n.CSSStyleSheet.prototype.replace=a),l&&(n.CSSStyleSheet.prototype.replaceSync=l),Object.entries(i).forEach(([f,c])=>{c.prototype.insertRule=h[f].insertRule,c.prototype.deleteRule=h[f].deleteRule})})}function Gt({mirror:e,stylesheetManager:t},r){let n=null;r.nodeName==="#document"?n=e.getId(r):n=e.getId(S.host(r));let o=r.nodeName==="#document"?r.defaultView?.Document:r.ownerDocument?.defaultView?.ShadowRoot,s=o?.prototype?Object.getOwnPropertyDescriptor(o?.prototype,"adoptedStyleSheets"):void 0;return n===null||n===-1||!o||!s?()=>{}:(Object.defineProperty(r,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get(){return s.get?.call(this)},set(a){let l=s.set?.call(this,a);if(n!==null&&n!==-1)try{t.adoptStyleSheets(a,n)}catch{}return l}}),O(()=>{Object.defineProperty(r,"adoptedStyleSheets",{configurable:s.configurable,enumerable:s.enumerable,get:s.get,set:s.set})}))}function an({styleDeclarationCb:e,mirror:t,ignoreCSSAttributes:r,stylesheetManager:n},{win:o}){let s=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(s,{apply:O((l,i,h)=>{let[f,c,m]=h;if(r.has(f))return s.apply(i,[f,c,m]);let{id:p,styleId:d}=K(i.parentRule?.parentStyleSheet,t,n.styleMirror);return(p&&p!==-1||d&&d!==-1)&&e({id:p,styleId:d,set:{property:f,value:c,priority:m},index:Fe(i.parentRule)}),l.apply(i,h)})});let a=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(a,{apply:O((l,i,h)=>{let[f]=h;if(r.has(f))return a.apply(i,[f]);let{id:c,styleId:m}=K(i.parentRule?.parentStyleSheet,t,n.styleMirror);return(c&&c!==-1||m&&m!==-1)&&e({id:c,styleId:m,remove:{property:f},index:Fe(i.parentRule)}),l.apply(i,h)})}),O(()=>{o.CSSStyleDeclaration.prototype.setProperty=s,o.CSSStyleDeclaration.prototype.removeProperty=a})}function ln({mediaInteractionCb:e,blockClass:t,blockSelector:r,mirror:n,sampling:o,doc:s}){let a=O(i=>ve(O(h=>{let f=Re(h);if(!f||!(f instanceof HTMLMediaElement)||F(f,t,r,!0))return;let{currentTime:c,volume:m,muted:p,playbackRate:d,loop:u}=f;e({type:i,id:n.getId(f),currentTime:c,volume:m,muted:p,playbackRate:d,loop:u})}),o.media||500)),l=[_("play",a(me.Play),s),_("pause",a(me.Pause),s),_("seeked",a(me.Seeked),s),_("volumechange",a(me.VolumeChange),s),_("ratechange",a(me.RateChange),s)];return O(()=>{l.forEach(i=>i())})}function cn({fontCb:e,doc:t}){let r=t.defaultView;if(!r)return()=>{};let n=[],o=new WeakMap,s=r.FontFace;r.FontFace=function(i,h,f){let c=new s(i,h,f);return o.set(c,{family:i,buffer:typeof h!="string",descriptors:f,fontSource:typeof h=="string"?h:JSON.stringify(Array.from(new Uint8Array(h)))}),c};let a=oe(t.fonts,"add",function(l){return function(i){return setTimeout(O(()=>{let h=o.get(i);h&&(e(h),o.delete(i))}),0),l.apply(this,[i])}});return n.push(()=>{r.FontFace=s}),n.push(a),O(()=>{n.forEach(l=>l())})}function dn(e){let{doc:t,mirror:r,blockClass:n,blockSelector:o,selectionCb:s}=e,a=!0,l=O(()=>{let i=t.getSelection();if(!i||a&&i?.isCollapsed)return;a=i.isCollapsed||!1;let h=[],f=i.rangeCount||0;for(let c=0;c<f;c++){let{startContainer:m,startOffset:p,endContainer:d,endOffset:u}=i.getRangeAt(c);F(m,n,o,!0)||F(d,n,o,!0)||h.push({start:r.getId(m),startOffset:p,end:r.getId(d),endOffset:u})}s({ranges:h})});return l(),_("selectionchange",l)}function un({doc:e,customElementCb:t}){let r=e.defaultView;return!r||!r.customElements?()=>{}:oe(r.customElements,"define",function(n){return function(o,s,a){try{t({define:{name:o}})}catch{console.warn(`Custom element callback failed for ${o}`)}return n.apply(this,[o,s,a])}})}function fn(e,t){let{mutationCb:r,mousemoveCb:n,mouseInteractionCb:o,scrollCb:s,viewportResizeCb:a,inputCb:l,mediaInteractionCb:i,styleSheetRuleCb:h,styleDeclarationCb:f,canvasMutationCb:c,fontCb:m,selectionCb:p,customElementCb:d}=e;e.mutationCb=(...u)=>{t.mutation&&t.mutation(...u),r(...u)},e.mousemoveCb=(...u)=>{t.mousemove&&t.mousemove(...u),n(...u)},e.mouseInteractionCb=(...u)=>{t.mouseInteraction&&t.mouseInteraction(...u),o(...u)},e.scrollCb=(...u)=>{t.scroll&&t.scroll(...u),s(...u)},e.viewportResizeCb=(...u)=>{t.viewportResize&&t.viewportResize(...u),a(...u)},e.inputCb=(...u)=>{t.input&&t.input(...u),l(...u)},e.mediaInteractionCb=(...u)=>{t.mediaInteaction&&t.mediaInteaction(...u),i(...u)},e.styleSheetRuleCb=(...u)=>{t.styleSheetRule&&t.styleSheetRule(...u),h(...u)},e.styleDeclarationCb=(...u)=>{t.styleDeclaration&&t.styleDeclaration(...u),f(...u)},e.canvasMutationCb=(...u)=>{t.canvasMutation&&t.canvasMutation(...u),c(...u)},e.fontCb=(...u)=>{t.font&&t.font(...u),m(...u)},e.selectionCb=(...u)=>{t.selection&&t.selection(...u),p(...u)},e.customElementCb=(...u)=>{t.customElement&&t.customElement(...u),d(...u)}}function hn(e,t={}){let r=e.doc.defaultView;if(!r)return()=>{};fn(e,t);let n;e.recordDOM&&(n=zt(e,e.doc));let o=en(e),s=tn(e),a=Ht(e),l=rn(e,{win:r}),i=on(e),h=ln(e),f=()=>{},c=()=>{},m=()=>{},p=()=>{};e.recordDOM&&(f=sn(e,{win:r}),c=Gt(e,e.doc),m=an(e,{win:r}),e.collectFonts&&(p=cn(e)));let d=dn(e),u=un(e),g=[];for(let b of e.plugins)g.push(b.observer(b.callback,r,b.options));return O(()=>{n?.(),o(),s(),a(),l(),i(),h(),f(),c(),m(),p(),d(),u(),g.forEach(b=>b())})}function Ne(e){return typeof window[e]<"u"}function ke(e){return!!(typeof window[e]<"u"&&window[e].prototype&&"insertRule"in window[e].prototype&&"deleteRule"in window[e].prototype)}var ht=class{generateIdFn;iframeIdToRemoteIdMap=new WeakMap;iframeRemoteIdToIdMap=new WeakMap;constructor(e){this.generateIdFn=e}getId(e,t,r,n){let o=r||this.getIdToRemoteIdMap(e),s=n||this.getRemoteIdToIdMap(e),a=o.get(t);return a||(a=this.generateIdFn(),o.set(t,a),s.set(a,t)),a}getIds(e,t){let r=this.getIdToRemoteIdMap(e),n=this.getRemoteIdToIdMap(e);return t.map(o=>this.getId(e,o,r,n))}getRemoteId(e,t,r){let n=r||this.getRemoteIdToIdMap(e);if(typeof t!="number")return t;let o=n.get(t);return o||-1}getRemoteIds(e,t){let r=this.getRemoteIdToIdMap(e);return t.map(n=>this.getRemoteId(e,n,r))}reset(e){if(!e){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(e),this.iframeRemoteIdToIdMap.delete(e)}getIdToRemoteIdMap(e){let t=this.iframeIdToRemoteIdMap.get(e);return t||(t=new Map,this.iframeIdToRemoteIdMap.set(e,t)),t}getRemoteIdToIdMap(e){let t=this.iframeRemoteIdToIdMap.get(e);return t||(t=new Map,this.iframeRemoteIdToIdMap.set(e,t)),t}},pn=class{iframes=new WeakMap;crossOriginIframeMap=new WeakMap;crossOriginIframeMirror=new ht(Rt);crossOriginIframeStyleMirror;crossOriginIframeRootIdMap=new WeakMap;mirror;mutationCb;wrappedEmit;loadListener;unloadListener;attachedWindows=new Map;messageHandler=e=>this.handleMessage(e);stylesheetManager;recordCrossOriginIframes;constructor(e){this.mutationCb=e.mutationCb,this.wrappedEmit=e.wrappedEmit,this.stylesheetManager=e.stylesheetManager,this.recordCrossOriginIframes=e.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new ht(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=e.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.messageHandler)}addIframe(e){this.iframes.set(e,!0),e.contentWindow&&this.crossOriginIframeMap.set(e.contentWindow,e)}addLoadListener(e){this.loadListener=e}addUnloadListener(e){this.unloadListener=e}attachIframe(e,t){this.mutationCb({adds:[{parentId:this.mirror.getId(e),nextId:null,node:t}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),this.watchIframeWindow(e),this.loadListener?.(e),e.contentDocument&&e.contentDocument.adoptedStyleSheets&&e.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(e.contentDocument.adoptedStyleSheets,this.mirror.getId(e.contentDocument))}destroy(){window.removeEventListener("message",this.messageHandler),this.attachedWindows.forEach(e=>e())}watchIframeWindow(e){let t=e.contentWindow;if(!t||this.attachedWindows.has(t))return;let r=[],n=()=>{this.attachedWindows.delete(t),r.forEach(o=>{try{o()}catch{}})};this.attachedWindows.set(t,n),this.recordCrossOriginIframes&&r.push(_("message",this.messageHandler,t)),r.push(_("pagehide",o=>{if(o.persisted)return;let s=t.document;n(),this.unloadListener?.(s)},t))}handleMessage(e){let t=e;if(t.data.type!=="rrweb"||t.origin!==t.data.origin||!e.source)return;let r=this.crossOriginIframeMap.get(e.source);if(!r)return;let n=this.transformCrossOriginEvent(r,t.data.event);n&&this.wrappedEmit(n,t.data.isCheckout)}transformCrossOriginEvent(e,t){switch(t.type){case I.FullSnapshot:{this.crossOriginIframeMirror.reset(e),this.crossOriginIframeStyleMirror.reset(e),this.replaceIdOnNode(t.data.node,e);let r=t.data.node.id;return this.crossOriginIframeRootIdMap.set(e,r),this.patchRootIdOnNode(t.data.node,r),{timestamp:t.timestamp,type:I.IncrementalSnapshot,data:{source:R.Mutation,adds:[{parentId:this.mirror.getId(e),nextId:null,node:t.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case I.Meta:case I.Load:case I.DomContentLoaded:return!1;case I.Annotation:case I.Plugin:return t;case I.Custom:return this.replaceIds(t.data.payload,e,["id","parentId","previousId","nextId"]),t;case I.IncrementalSnapshot:switch(t.data.source){case R.Mutation:return t.data.adds.forEach(r=>{this.replaceIds(r,e,["parentId","nextId","previousId"]),this.replaceIdOnNode(r.node,e);let n=this.crossOriginIframeRootIdMap.get(e);n&&this.patchRootIdOnNode(r.node,n)}),t.data.removes.forEach(r=>{this.replaceIds(r,e,["parentId","id"])}),t.data.attributes.forEach(r=>{this.replaceIds(r,e,["id"])}),t.data.texts.forEach(r=>{this.replaceIds(r,e,["id"])}),t;case R.Drag:case R.TouchMove:case R.MouseMove:return t.data.positions.forEach(r=>{this.replaceIds(r,e,["id"])}),t;case R.ViewportResize:return!1;case R.MediaInteraction:case R.MouseInteraction:case R.Scroll:case R.CanvasMutation:case R.Input:return this.replaceIds(t.data,e,["id"]),t;case R.StyleSheetRule:case R.StyleDeclaration:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleId"]),t;case R.Font:return t;case R.Selection:return t.data.ranges.forEach(r=>{this.replaceIds(r,e,["start","end"])}),t;case R.AdoptedStyleSheet:return this.replaceIds(t.data,e,["id"]),this.replaceStyleIds(t.data,e,["styleIds"]),t.data.styles?.forEach(r=>{this.replaceStyleIds(r,e,["styleId"])}),t}}return!1}replace(e,t,r,n){for(let o of n)!Array.isArray(t[o])&&typeof t[o]!="number"||(Array.isArray(t[o])?t[o]=e.getIds(r,t[o]):t[o]=e.getId(r,t[o]));return t}replaceIds(e,t,r){return this.replace(this.crossOriginIframeMirror,e,t,r)}replaceStyleIds(e,t,r){return this.replace(this.crossOriginIframeStyleMirror,e,t,r)}replaceIdOnNode(e,t){this.replaceIds(e,t,["id","rootId"]),"childNodes"in e&&e.childNodes.forEach(r=>{this.replaceIdOnNode(r,t)})}patchRootIdOnNode(e,t){e.type!==x.Document&&!e.rootId&&(e.rootId=t),"childNodes"in e&&e.childNodes.forEach(r=>{this.patchRootIdOnNode(r,t)})}},mn=class{shadowDoms=new Map;mutationCb;scrollCb;bypassOptions;mirror;restoreHandlers=[];constructor(e){this.mutationCb=e.mutationCb,this.scrollCb=e.scrollCb,this.bypassOptions=e.bypassOptions,this.mirror=e.mirror,this.init()}init(){this.reset(),this.patchAttachShadow(Element,document)}addShadowRoot(e,t){if(!be(e)||this.shadowDoms.has(e))return;let r=[];this.shadowDoms.set(e,r);let n=zt({...this.bypassOptions,doc:t,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this},e);r.push(n),r.push(Ht({...this.bypassOptions,scrollCb:this.scrollCb,doc:e,mirror:this.mirror})),setTimeout(()=>{this.shadowDoms.get(e)===r&&(e.adoptedStyleSheets&&e.adoptedStyleSheets.length>0&&this.bypassOptions.stylesheetManager.adoptStyleSheets(e.adoptedStyleSheets,this.mirror.getId(S.host(e))),r.push(Gt({mirror:this.mirror,stylesheetManager:this.bypassOptions.stylesheetManager},e)))},0)}removeShadowRootsIn(e){if(this.shadowDoms.size===0)return;let t=S.shadowRoot(e);t&&(this.shadowDoms.has(t)&&this.removeShadowRoot(t),this.removeShadowRootsIn(t)),S.childNodes(e).forEach(r=>this.removeShadowRootsIn(r))}removeShadowRoot(e){let t=this.shadowDoms.get(e);this.shadowDoms.delete(e),t?.forEach(Ge)}observeAttachShadow(e){!e.contentWindow||!e.contentDocument||this.patchAttachShadow(e.contentWindow.Element,e.contentDocument)}patchAttachShadow(e,t){let r=this;this.restoreHandlers.push(oe(e.prototype,"attachShadow",function(n){return function(o){let s=n.call(this,o),a=S.shadowRoot(this);return a&&Xe(this)&&r.addShadowRoot(a,t),s}}))}reset(){this.restoreHandlers.forEach(Ge),this.restoreHandlers=[];let e=this.shadowDoms;this.shadowDoms=new Map,e.forEach(t=>t.forEach(Ge))}};function Ge(e){try{e()}catch{}}var de="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gn=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(ge=0;ge<de.length;ge++)gn[de.charCodeAt(ge)]=ge;var ge,yn=function(e){var t=new Uint8Array(e),r,n=t.length,o="";for(r=0;r<n;r+=3)o+=de[t[r]>>2],o+=de[(t[r]&3)<<4|t[r+1]>>4],o+=de[(t[r+1]&15)<<2|t[r+2]>>6],o+=de[t[r+2]&63];return n%3===2?o=o.substring(0,o.length-1)+"=":n%3===1&&(o=o.substring(0,o.length-2)+"=="),o},pt=new Map;function Sn(e,t){let r=pt.get(e);return r||(r=new Map,pt.set(e,r)),r.has(t)||r.set(t,[]),r.get(t)}var Vt=(e,t,r)=>{if(!e||!(jt(e,t)||typeof e=="object"))return;let n=e.constructor.name,o=Sn(r,n),s=o.indexOf(e);return s===-1&&(s=o.length,o.push(e)),s};function Te(e,t,r){if(e instanceof Array)return e.map(n=>Te(n,t,r));if(e===null)return e;if(e instanceof Float32Array||e instanceof Float64Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Uint8Array||e instanceof Uint16Array||e instanceof Int16Array||e instanceof Int8Array||e instanceof Uint8ClampedArray)return{rr_type:e.constructor.name,args:[Object.values(e)]};if(e instanceof ArrayBuffer)return{rr_type:e.constructor.name,base64:yn(e)};if(e instanceof DataView)return{rr_type:e.constructor.name,args:[Te(e.buffer,t,r),e.byteOffset,e.byteLength]};if(e instanceof HTMLImageElement){let n=e.constructor.name,{src:o}=e;return{rr_type:n,src:o}}else{if(e instanceof HTMLCanvasElement)return{rr_type:"HTMLImageElement",src:e.toDataURL()};if(e instanceof ImageData)return{rr_type:e.constructor.name,args:[Te(e.data,t,r),e.width,e.height]};if(jt(e,t)||typeof e=="object")return{rr_type:e.constructor.name,index:Vt(e,t,r)}}return e}var $t=(e,t,r)=>e.map(n=>Te(n,t,r)),jt=(e,t)=>!!["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"].filter(n=>typeof t[n]=="function").find(n=>e instanceof t[n]);function bn(e,t,r,n){let o=[],s=Object.getOwnPropertyNames(t.CanvasRenderingContext2D.prototype);for(let a of s)try{if(typeof t.CanvasRenderingContext2D.prototype[a]!="function")continue;let l=oe(t.CanvasRenderingContext2D.prototype,a,function(i){return function(...h){return F(this.canvas,r,n,!0)||setTimeout(()=>{let f=$t(h,t,this);e(this.canvas,{type:Ce["2D"],property:a,args:f})},0),i.apply(this,h)}});o.push(l)}catch{let l=We(t.CanvasRenderingContext2D.prototype,a,{set(i){e(this.canvas,{type:Ce["2D"],property:a,args:[i],setter:!0})}});o.push(l)}return()=>{o.forEach(a=>a())}}function wn(e){return e==="experimental-webgl"?"webgl":e}function mt(e,t,r,n){let o=[];try{let s=oe(e.HTMLCanvasElement.prototype,"getContext",function(a){return function(l,...i){if(!F(this,t,r,!0)){let h=wn(l);if("__context"in this||(this.__context=h),n&&["webgl","webgl2"].includes(h))if(i[0]&&typeof i[0]=="object"){let f=i[0];f.preserveDrawingBuffer||(f.preserveDrawingBuffer=!0)}else i.splice(0,1,{preserveDrawingBuffer:!0})}return a.apply(this,[l,...i])}});o.push(s)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return()=>{o.forEach(s=>s())}}function gt(e,t,r,n,o,s){let a=[],l=Object.getOwnPropertyNames(e);for(let i of l)if(!["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(i))try{if(typeof e[i]!="function")continue;let h=oe(e,i,function(f){return function(...c){let m=f.apply(this,c);if(Vt(m,s,this),"tagName"in this.canvas&&!F(this.canvas,n,o,!0)){let p=$t(c,s,this),d={type:t,property:i,args:p};r(this.canvas,d)}return m}});a.push(h)}catch{let h=We(e,i,{set(f){r(this.canvas,{type:t,property:i,args:[f],setter:!0})}});a.push(h)}return a}function Cn(e,t,r,n){let o=[];return typeof t.WebGLRenderingContext<"u"&&o.push(...gt(t.WebGLRenderingContext.prototype,Ce.WebGL,e,r,n,t)),typeof t.WebGL2RenderingContext<"u"&&o.push(...gt(t.WebGL2RenderingContext.prototype,Ce.WebGL2,e,r,n,t)),()=>{o.forEach(s=>s())}}var qt=`(function() {
5
+ // ../../node_modules/base64-arraybuffer/dist/base64-arraybuffer.es5.js
6
+ var chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
7
+ var lookup = typeof Uint8Array === "undefined" ? [] : /* @__PURE__ */ new Uint8Array(256);
8
+ for (var i = 0; i < chars.length; i++) lookup[chars.charCodeAt(i)] = i;
9
+ var encode = function(arraybuffer) {
10
+ var bytes = new Uint8Array(arraybuffer), i, len = bytes.length, base64 = "";
11
+ for (i = 0; i < len; i += 3) {
12
+ base64 += chars[bytes[i] >> 2];
13
+ base64 += chars[(bytes[i] & 3) << 4 | bytes[i + 1] >> 4];
14
+ base64 += chars[(bytes[i + 1] & 15) << 2 | bytes[i + 2] >> 6];
15
+ base64 += chars[bytes[i + 2] & 63];
16
+ }
17
+ if (len % 3 === 2) base64 = base64.substring(0, base64.length - 1) + "=";
18
+ else if (len % 3 === 1) base64 = base64.substring(0, base64.length - 2) + "==";
19
+ return base64;
20
+ };
21
+ // ../rrweb/src/record/workers/image-bitmap-data-url-worker.ts
22
+ const lastBlobMap = /* @__PURE__ */ new Map();
23
+ const transparentBlobMap = /* @__PURE__ */ new Map();
24
+ async function getTransparentBlobFor(width, height, dataURLOptions) {
25
+ const id = \`\${width}-\${height}\`;
26
+ if ("OffscreenCanvas" in globalThis) {
27
+ if (transparentBlobMap.has(id)) return transparentBlobMap.get(id);
28
+ const offscreen = new OffscreenCanvas(width, height);
29
+ offscreen.getContext("2d");
30
+ const base64 = encode(await (await offscreen.convertToBlob(dataURLOptions)).arrayBuffer());
31
+ transparentBlobMap.set(id, base64);
32
+ return base64;
33
+ } else return "";
34
+ }
35
+ const worker = self;
36
+ worker.onmessage = async function(e) {
37
+ if ("OffscreenCanvas" in globalThis) {
38
+ const { id, bitmap, width, height, dataURLOptions } = e.data;
39
+ const transparentBase64 = getTransparentBlobFor(width, height, dataURLOptions);
40
+ const offscreen = new OffscreenCanvas(width, height);
41
+ offscreen.getContext("2d").drawImage(bitmap, 0, 0);
42
+ bitmap.close();
43
+ const blob = await offscreen.convertToBlob(dataURLOptions);
44
+ const type = blob.type;
45
+ const base64 = encode(await blob.arrayBuffer());
46
+ if (!lastBlobMap.has(id) && await transparentBase64 === base64) {
47
+ lastBlobMap.set(id, base64);
48
+ return worker.postMessage({ id });
49
+ }
50
+ if (lastBlobMap.get(id) === base64) return worker.postMessage({ id });
51
+ worker.postMessage({
52
+ id,
53
+ type,
54
+ base64,
55
+ width,
56
+ height
57
+ });
58
+ lastBlobMap.set(id, base64);
59
+ } else return worker.postMessage({ id: e.data.id });
60
+ };
61
+ })();
62
+
63
+ //# sourceMappingURL=image-bitmap-data-url-worker-DVcMqE1_.js.map`,yt=typeof self<"u"&&self.Blob&&new Blob(["(self.URL || self.webkitURL).revokeObjectURL(self.location.href);",qt],{type:"text/javascript;charset=utf-8"});function Mn(e){let t;try{if(t=yt&&(self.URL||self.webkitURL).createObjectURL(yt),!t)throw"";let r=new Worker(t,{name:e?.name});return r.addEventListener("error",()=>{(self.URL||self.webkitURL).revokeObjectURL(t)}),r}catch{return new Worker("data:text/javascript;charset=utf-8,"+encodeURIComponent(qt),{name:e?.name})}}var vn=class{pendingCanvasMutations=new Map;rafStamps={latestId:0,invokeId:null};mirror;mutationCb;resetObservers;frozen=!1;locked=!1;reset(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()}freeze(){this.frozen=!0}unfreeze(){this.frozen=!1}lock(){this.locked=!0}unlock(){this.locked=!1}constructor(e){let{sampling:t="all",win:r,blockClass:n,blockSelector:o,recordCanvas:s,dataURLOptions:a}=e;this.mutationCb=e.mutationCb,this.mirror=e.mirror,s&&t==="all"&&this.initCanvasMutationObserver(r,n,o),s&&typeof t=="number"&&this.initCanvasFPSObserver(t,r,n,o,{dataURLOptions:a})}processMutation=(e,t)=>{(this.rafStamps.invokeId&&this.rafStamps.latestId!==this.rafStamps.invokeId||!this.rafStamps.invokeId)&&(this.rafStamps.invokeId=this.rafStamps.latestId),this.pendingCanvasMutations.has(e)||this.pendingCanvasMutations.set(e,[]),this.pendingCanvasMutations.get(e).push(t)};initCanvasFPSObserver(e,t,r,n,o){let s=mt(t,r,n,!0),a=new Map,l=new Mn;l.onmessage=p=>{let{id:d}=p.data;if(a.set(d,!1),!("base64"in p.data))return;let{base64:u,type:g,width:b,height:w}=p.data;this.mutationCb({id:d,type:Ce["2D"],commands:[{property:"clearRect",args:[0,0,b,w]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:u}],type:g}]},0,0]}]})};let i=1e3/e,h=0,f,c=()=>{let p=[];return t.document.querySelectorAll("canvas").forEach(d=>{F(d,r,n,!0)||p.push(d)}),p},m=p=>{if(h&&p-h<i){f=requestAnimationFrame(m);return}h=p,c().forEach(async d=>{let u=this.mirror.getId(d);if(a.get(u)||d.width===0||d.height===0)return;if(a.set(u,!0),["webgl","webgl2"].includes(d.__context)){let b=d.getContext(d.__context);b?.getContextAttributes()?.preserveDrawingBuffer===!1&&b.clear(b.COLOR_BUFFER_BIT)}let g=await createImageBitmap(d);l.postMessage({id:u,bitmap:g,width:d.width,height:d.height,dataURLOptions:o.dataURLOptions},[g])}),f=requestAnimationFrame(m)};f=requestAnimationFrame(m),this.resetObservers=()=>{s(),cancelAnimationFrame(f)}}initCanvasMutationObserver(e,t,r){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();let n=mt(e,t,r,!1),o=bn(this.processMutation.bind(this),e,t,r),s=Cn(this.processMutation.bind(this),e,t,r);this.resetObservers=()=>{n(),o(),s()}}startPendingCanvasMutationFlusher(){requestAnimationFrame(()=>this.flushPendingCanvasMutations())}startRAFTimestamping(){let e=t=>{this.rafStamps.latestId=t,requestAnimationFrame(e)};requestAnimationFrame(e)}flushPendingCanvasMutations(){this.pendingCanvasMutations.forEach((e,t)=>{let r=this.mirror.getId(t);this.flushPendingCanvasMutationFor(t,r)}),requestAnimationFrame(()=>this.flushPendingCanvasMutations())}flushPendingCanvasMutationFor(e,t){if(this.frozen||this.locked)return;let r=this.pendingCanvasMutations.get(e);if(!r||t===-1)return;let n=r.map(s=>{let{type:a,...l}=s;return l}),{type:o}=r[0];this.mutationCb({id:t,type:o,commands:n}),this.pendingCanvasMutations.delete(e)}},In=class{trackedLinkElements=new WeakSet;mutationCb;adoptedStyleSheetCb;styleMirror=new qr;constructor(e){this.mutationCb=e.mutationCb,this.adoptedStyleSheetCb=e.adoptedStyleSheetCb}attachLinkElement(e,t){"_cssText"in t.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:t.id,attributes:t.attributes}]}),this.trackLinkElement(e)}trackLinkElement(e){this.trackedLinkElements.has(e)||(this.trackedLinkElements.add(e),this.trackStylesheetInLinkElement(e))}adoptStyleSheets(e,t){if(e.length===0)return;let r={id:t,styleIds:[]},n=[];for(let o of e){let s;this.styleMirror.has(o)?s=this.styleMirror.getId(o):(s=this.styleMirror.add(o),n.push({styleId:s,rules:Array.from(o.rules||CSSRule,(a,l)=>({rule:Ct(a,o.href),index:l}))})),r.styleIds.push(s)}n.length>0&&(r.styles=n),this.adoptedStyleSheetCb(r)}reset(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet}trackStylesheetInLinkElement(e){}},Rn=class{nodeMap=new WeakMap;active=!1;inOtherBuffer(e,t){let r=this.nodeMap.get(e);return r&&Array.from(r).some(n=>n!==t)}add(e,t){this.active||(this.active=!0,requestAnimationFrame(()=>{this.nodeMap=new WeakMap,this.active=!1})),this.nodeMap.set(e,(this.nodeMap.get(e)||new Set).add(t))}destroy(){}},T,De,Q,Ie=!1;try{if(Array.from([1],e=>e*2)[0]!==2){let e=document.createElement("iframe");document.body.appendChild(e),Array.from=e.contentWindow?.Array.from||Array.from,document.body.removeChild(e)}}catch(e){console.debug("Unable to override Array.from",e)}var V=yr();function fe(e={}){let{emit:t,checkoutEveryNms:r,checkoutEveryNth:n,blockClass:o="rr-block",blockSelector:s=null,ignoreClass:a="rr-ignore",ignoreSelector:l=null,maskTextClass:i="rr-mask",maskTextSelector:h=null,inlineStylesheet:f=!0,maskAllInputs:c,maskInputOptions:m,slimDOMOptions:p,maskInputFn:d,maskTextFn:u,hooks:g,packFn:b,sampling:w={},dataURLOptions:y={},mousemoveWait:C,recordDOM:L=!0,recordCanvas:D=!1,recordCrossOriginIframes:z=!1,recordAfter:te=e.recordAfter==="DOMContentLoaded"?e.recordAfter:"load",userTriggeredOnInput:P=!1,collectFonts:j=!1,inlineImages:X=!1,plugins:Y,keepIframeSrcFn:E=()=>!1,ignoreCSSAttributes:he=new Set([]),errorHandler:pe}=e;Qr(pe);let A=z?window.parent===window:!0,H=!1;if(!A)try{window.parent.document&&(H=!1)}catch{H=!0}if(A&&!t)throw new Error("emit function is required");if(!A&&!H)return()=>{};C!==void 0&&w.mousemove===void 0&&(w.mousemove=C),V.reset();let re=c===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0}:m!==void 0?m:{password:!0},q=Tt(p);jr();let Qe,Pe=0,Ke=N=>{for(let $ of Y||[])$.eventProcessor&&(N=$.eventProcessor(N));return b&&!H&&(N=b(N)),N};T=(N,$)=>{let v=N;if(v.timestamp=Me(),v.type!==I.FullSnapshot&&!(v.type===I.IncrementalSnapshot&&v.data.source===R.Mutation)){Q.unfreeze();for(let W of ue)if(W.isFrozen())W.unfreeze();else break}if(A)t?.(Ke(v),$);else if(H){let W={type:"rrweb",event:Ke(v),origin:window.location.origin,isCheckout:$};window.parent.postMessage(W,"*")}if(v.type===I.FullSnapshot)Qe=v,Pe=0;else if(v.type===I.IncrementalSnapshot){if(v.data.source===R.Mutation&&v.data.isAttachIframe)return;Pe++;let W=n&&Pe>=n,G=r&&v.timestamp-Qe.timestamp>r;(W||G)&&De(!0)}};let Oe=N=>{T({type:I.IncrementalSnapshot,data:{source:R.Mutation,...N}})},et=N=>T({type:I.IncrementalSnapshot,data:{source:R.Scroll,...N}}),tt=N=>T({type:I.IncrementalSnapshot,data:{source:R.CanvasMutation,...N}}),Xt=N=>T({type:I.IncrementalSnapshot,data:{source:R.AdoptedStyleSheet,...N}}),ne=new In({mutationCb:Oe,adoptedStyleSheetCb:Xt}),J=new pn({mirror:V,mutationCb:Oe,stylesheetManager:ne,recordCrossOriginIframes:z,wrappedEmit:T});for(let N of Y||[])N.getMirror&&N.getMirror({nodeMirror:V,crossOriginIframeMirror:J.crossOriginIframeMirror,crossOriginIframeStyleMirror:J.crossOriginIframeStyleMirror});let Ue=new Rn;Q=new vn({recordCanvas:D,mutationCb:tt,win:window,blockClass:o,blockSelector:s,mirror:V,sampling:w.canvas,dataURLOptions:y});let se=new mn({mutationCb:Oe,scrollCb:et,bypassOptions:{blockClass:o,blockSelector:s,maskTextClass:i,maskTextSelector:h,inlineStylesheet:f,maskInputOptions:re,dataURLOptions:y,maskTextFn:u,maskInputFn:d,recordCanvas:D,inlineImages:X,sampling:w,slimDOMOptions:q,iframeManager:J,stylesheetManager:ne,canvasManager:Q,keepIframeSrcFn:E,processedNodeManager:Ue},mirror:V});De=(N=!1)=>{if(!L)return;T({type:I.Meta,data:{href:window.location.href,width:At(),height:xt()}},N),ne.reset(),se.init(),Q.lock(),ue.forEach(v=>v.lock());let $=Gr(document,{mirror:V,blockClass:o,blockSelector:s,maskTextClass:i,maskTextSelector:h,inlineStylesheet:f,maskAllInputs:re,maskTextFn:u,maskInputFn:d,slimDOM:q,dataURLOptions:y,recordCanvas:D,inlineImages:X,onSerialize:v=>{Wt(v,V)&&J.addIframe(v),Pt(v,V)&&ne.trackLinkElement(v),qe(v)&&se.addShadowRoot(S.shadowRoot(v),document)},onIframeLoad:(v,W)=>{J.attachIframe(v,W),se.observeAttachShadow(v)},onStylesheetLoad:(v,W)=>{ne.attachLinkElement(v,W)},keepIframeSrcFn:E});if(!$)return console.warn("Failed to snapshot the document");T({type:I.FullSnapshot,data:{node:$,initialOffset:Lt(window)}},N),Q.unlock(),ue.forEach(v=>v.unlock()),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&ne.adoptStyleSheets(document.adoptedStyleSheets,V.getId(document))};try{let N=[],$=G=>O(hn)({mutationCb:Oe,mousemoveCb:(M,Be)=>T({type:I.IncrementalSnapshot,data:{source:Be,positions:M}}),mouseInteractionCb:M=>T({type:I.IncrementalSnapshot,data:{source:R.MouseInteraction,...M}}),scrollCb:et,viewportResizeCb:M=>T({type:I.IncrementalSnapshot,data:{source:R.ViewportResize,...M}}),inputCb:M=>T({type:I.IncrementalSnapshot,data:{source:R.Input,...M}}),mediaInteractionCb:M=>T({type:I.IncrementalSnapshot,data:{source:R.MediaInteraction,...M}}),styleSheetRuleCb:M=>T({type:I.IncrementalSnapshot,data:{source:R.StyleSheetRule,...M}}),styleDeclarationCb:M=>T({type:I.IncrementalSnapshot,data:{source:R.StyleDeclaration,...M}}),canvasMutationCb:tt,fontCb:M=>T({type:I.IncrementalSnapshot,data:{source:R.Font,...M}}),selectionCb:M=>{T({type:I.IncrementalSnapshot,data:{source:R.Selection,...M}})},customElementCb:M=>{T({type:I.IncrementalSnapshot,data:{source:R.CustomElement,...M}})},blockClass:o,ignoreClass:a,ignoreSelector:l,maskTextClass:i,maskTextSelector:h,maskInputOptions:re,inlineStylesheet:f,sampling:w,recordDOM:L,recordCanvas:D,inlineImages:X,userTriggeredOnInput:P,collectFonts:j,doc:G,maskInputFn:d,maskTextFn:u,keepIframeSrcFn:E,blockSelector:s,slimDOMOptions:q,dataURLOptions:y,mirror:V,iframeManager:J,stylesheetManager:ne,shadowDomManager:se,processedNodeManager:Ue,canvasManager:Q,ignoreCSSAttributes:he,plugins:Y?.filter(M=>M.observer)?.map(M=>({observer:M.observer,options:M.options,callback:Be=>T({type:I.Plugin,data:{plugin:M.name,payload:Be}})}))||[]},g),v=new Map;J.addLoadListener(G=>{try{let M=G.contentDocument;if(v.has(M))return;v.set(M,$(M))}catch(M){console.warn(M)}}),J.addUnloadListener(G=>{let M=v.get(G);M&&(v.delete(G),M(),se.removeShadowRootsIn(G),V.removeNodeFromMap(G))});let W=()=>{De(),N.push($(document)),Ie=!0};return["interactive","complete"].includes(document.readyState)?W():(N.push(_("DOMContentLoaded",()=>{T({type:I.DomContentLoaded,data:{}}),te==="DOMContentLoaded"&&W()})),N.push(_("load",()=>{T({type:I.Load,data:{}}),te==="load"&&W()},window))),()=>{[...N,...v.values()].forEach(G=>{try{G()}catch(M){String(M).toLowerCase().includes("cross-origin")||console.warn(M)}}),v.clear(),J.destroy(),Ue.destroy(),se.reset(),Q.reset(),Ie=!1,Kr()}}catch(N){console.warn(N)}}fe.addCustomEvent=(e,t)=>{if(!Ie)throw new Error("please add custom event after start recording");T({type:I.Custom,data:{tag:e,payload:t}})};fe.addAnnotation=e=>{if(!Ie)throw new Error("please add annotation after recording started");T({type:I.Annotation,data:e})};fe.freezePage=()=>{Q.freeze(),ue.forEach(e=>e.freeze())};fe.takeFullSnapshot=e=>{if(!Ie)throw new Error("please take full snapshot after start recording");De(e)};fe.mirror=V;export{fe as record};