effect-browser 0.3.0-beta.21 → 0.3.0-beta.23

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 (249) hide show
  1. package/README.md +130 -159
  2. package/dist/Action-24sLOubi.d.mts +110 -0
  3. package/dist/Action.d.mts +2 -0
  4. package/dist/Action.mjs +141 -0
  5. package/dist/Action.mjs.map +1 -0
  6. package/dist/ActionPort.d.mts +15 -0
  7. package/dist/ActionPort.mjs +101 -0
  8. package/dist/ActionPort.mjs.map +1 -0
  9. package/dist/Browser-BKPAbyys.mjs +4076 -0
  10. package/dist/Browser-BKPAbyys.mjs.map +1 -0
  11. package/dist/{Browser-CiXHT1yO.d.mts → Browser-wZhwZSlG.d.mts} +51 -13
  12. package/dist/Browser.d.mts +2 -2
  13. package/dist/Browser.mjs +1 -1
  14. package/dist/{BrowserError-Coy7EW1N.d.mts → BrowserError-BlcmLVzn.d.mts} +22 -7
  15. package/dist/BrowserError.d.mts +2 -2
  16. package/dist/BrowserError.mjs +46 -9
  17. package/dist/BrowserError.mjs.map +1 -1
  18. package/dist/{BrowserEvent-dq6FRT8w.d.mts → BrowserEvent-lLqJ3GJS.d.mts} +93 -37
  19. package/dist/BrowserEvent.d.mts +2 -2
  20. package/dist/BrowserEvent.mjs +29 -24
  21. package/dist/BrowserEvent.mjs.map +1 -1
  22. package/dist/{Change-DqING3tr.d.mts → Change-Ba7INmay.d.mts} +4 -6
  23. package/dist/Change.d.mts +2 -2
  24. package/dist/Change.mjs +97 -2
  25. package/dist/Change.mjs.map +1 -0
  26. package/dist/Clock.d.mts +57 -0
  27. package/dist/Clock.mjs +80 -0
  28. package/dist/Clock.mjs.map +1 -0
  29. package/dist/{Frame-DkNdjjjr.d.mts → Frame-UEH2hO5T.d.mts} +10 -3
  30. package/dist/Frame.d.mts +2 -2
  31. package/dist/Frame.mjs +10 -2
  32. package/dist/Frame.mjs.map +1 -1
  33. package/dist/{Motion-DND6I-64.d.mts → Geometry-DJx9qrYy.d.mts} +7 -10
  34. package/dist/Geometry.d.mts +2 -0
  35. package/dist/Geometry.mjs +32 -0
  36. package/dist/Geometry.mjs.map +1 -0
  37. package/dist/Matching.d.mts +37 -0
  38. package/dist/Matching.mjs +72 -0
  39. package/dist/Matching.mjs.map +1 -0
  40. package/dist/Page-BF5izr8R.mjs +795 -0
  41. package/dist/Page-BF5izr8R.mjs.map +1 -0
  42. package/dist/{Page-ku6j5t-v.d.mts → Page-CvsOEorc.d.mts} +158 -185
  43. package/dist/Page.d.mts +2 -2
  44. package/dist/Page.mjs +1 -1
  45. package/dist/Released-tURbFmal.d.mts +15 -0
  46. package/dist/{Snapshot-B34hZ4Jl.d.mts → Snapshot-CtBVOtuu.d.mts} +6 -1
  47. package/dist/Snapshot.d.mts +1 -1
  48. package/dist/Snapshot.mjs.map +1 -1
  49. package/dist/Stillness-CNlvayIo.mjs +136 -0
  50. package/dist/Stillness-CNlvayIo.mjs.map +1 -0
  51. package/dist/Style-AO4V7Czt.mjs +357 -0
  52. package/dist/Style-AO4V7Czt.mjs.map +1 -0
  53. package/dist/Style.d.mts +72 -0
  54. package/dist/Style.mjs +2 -0
  55. package/dist/Url.d.mts +26 -0
  56. package/dist/Url.mjs +74 -0
  57. package/dist/Url.mjs.map +1 -0
  58. package/dist/Window-CMddGMt1.d.mts +34 -0
  59. package/dist/Window.d.mts +2 -0
  60. package/dist/Window.mjs +35 -0
  61. package/dist/Window.mjs.map +1 -0
  62. package/dist/{cdp-DL7XfEj5.d.mts → connection-2KHI4_KN.d.mts} +4 -4
  63. package/dist/{cdp-BMpYMWYe.mjs → connection-CK83pvqP.mjs} +5 -6
  64. package/dist/connection-CK83pvqP.mjs.map +1 -0
  65. package/dist/index.d.mts +15 -18
  66. package/dist/index.mjs +11 -15
  67. package/dist/moment/Moment.d.mts +86 -0
  68. package/dist/{Moment.mjs → moment/Moment.mjs} +44 -38
  69. package/dist/moment/Moment.mjs.map +1 -0
  70. package/dist/{Plan-DJ4hEEna.d.mts → plan/index.d.mts} +169 -64
  71. package/dist/{Plan-BG1WifW2.mjs → plan/index.mjs} +122 -199
  72. package/dist/plan/index.mjs.map +1 -0
  73. package/dist/{Policy-BGWjbqCl.d.mts → policy/Policy.d.mts} +16 -20
  74. package/dist/{Policy.mjs → policy/Policy.mjs} +11 -21
  75. package/dist/policy/Policy.mjs.map +1 -0
  76. package/dist/presentation/Motion.d.mts +12 -0
  77. package/dist/{Motion.mjs → presentation/Motion.mjs} +4 -27
  78. package/dist/presentation/Motion.mjs.map +1 -0
  79. package/dist/presentation/Presentation.d.mts +30 -0
  80. package/dist/presentation/Presentation.mjs +105 -0
  81. package/dist/presentation/Presentation.mjs.map +1 -0
  82. package/dist/{Stage-NHp8N81k.d.mts → presentation/Stage.d.mts} +12 -15
  83. package/dist/{Stage.mjs → presentation/Stage.mjs} +68 -76
  84. package/dist/presentation/Stage.mjs.map +1 -0
  85. package/dist/presentation/feed.d.mts +20 -0
  86. package/dist/presentation/feed.mjs +18 -0
  87. package/dist/presentation/feed.mjs.map +1 -0
  88. package/dist/providers/Cdp.d.mts +9 -0
  89. package/dist/{Cdp.mjs → providers/Cdp.mjs} +3 -8
  90. package/dist/providers/Cdp.mjs.map +1 -0
  91. package/dist/{Chromium.d.mts → providers/Chromium.d.mts} +6 -7
  92. package/dist/{Chromium.mjs → providers/Chromium.mjs} +6 -15
  93. package/dist/providers/Chromium.mjs.map +1 -0
  94. package/dist/providers/Released.d.mts +2 -0
  95. package/dist/providers/Released.mjs +12 -0
  96. package/dist/providers/Released.mjs.map +1 -0
  97. package/dist/stillness/Stillness.d.mts +12 -0
  98. package/dist/stillness/Stillness.mjs +2 -0
  99. package/dist/supervisor/Supervisor.d.mts +104 -0
  100. package/dist/supervisor/Supervisor.mjs +515 -0
  101. package/dist/supervisor/Supervisor.mjs.map +1 -0
  102. package/dist/testing/index.d.mts +337 -0
  103. package/dist/testing/index.mjs +515 -0
  104. package/dist/testing/index.mjs.map +1 -0
  105. package/dist/workerd/Cdp.d.mts +8 -3
  106. package/dist/workerd/Cdp.mjs +2 -7
  107. package/dist/workerd/Cdp.mjs.map +1 -1
  108. package/package.json +89 -39
  109. package/src/Action.ts +127 -0
  110. package/src/ActionPort.ts +128 -0
  111. package/src/Browser.ts +352 -201
  112. package/src/BrowserError.ts +63 -6
  113. package/src/BrowserEvent.ts +26 -25
  114. package/src/Change.ts +0 -2
  115. package/src/{internal/pictures/clock.ts → Clock.ts} +17 -6
  116. package/src/Frame.ts +14 -0
  117. package/src/Geometry.ts +48 -0
  118. package/src/{internal/reading/match.inpage.ts → Matching.ts} +34 -4
  119. package/src/Page.ts +111 -92
  120. package/src/Snapshot.ts +5 -0
  121. package/src/{internal/input/style.ts → Style.ts} +121 -14
  122. package/src/Window.ts +30 -0
  123. package/src/index.ts +15 -6
  124. package/src/internal/input/actions.ts +61 -119
  125. package/src/internal/input/dispatch.ts +3 -3
  126. package/src/internal/input/gate.ts +21 -18
  127. package/src/internal/input/guard.inpage.ts +25 -58
  128. package/src/internal/input/guard.ts +11 -20
  129. package/src/internal/input/keyboard.ts +12 -3
  130. package/src/internal/input/perform.ts +78 -60
  131. package/src/internal/input/pointer.ts +4 -2
  132. package/src/internal/input/settle.ts +7 -5
  133. package/src/internal/input/targets.inpage.ts +1 -1
  134. package/src/internal/input/targets.ts +4 -9
  135. package/src/internal/page/bridge.ts +209 -113
  136. package/src/internal/page/context.ts +12 -59
  137. package/src/internal/page/dialogs.ts +58 -0
  138. package/src/internal/page/identity.ts +6 -5
  139. package/src/internal/page/lane.ts +14 -15
  140. package/src/internal/page/navigation.ts +50 -42
  141. package/src/internal/page/openings.ts +11 -5
  142. package/src/internal/page/page.ts +44 -81
  143. package/src/internal/page/port.ts +125 -0
  144. package/src/internal/{input → page}/replies.ts +1 -1
  145. package/src/internal/page/request-owner.ts +269 -0
  146. package/src/internal/page/requests.ts +357 -0
  147. package/src/internal/page/scripts.ts +124 -0
  148. package/src/internal/pictures/capture.ts +255 -332
  149. package/src/internal/pictures/dimensions.ts +162 -0
  150. package/src/internal/pictures/frame.ts +68 -0
  151. package/src/internal/pictures/pictures.ts +57 -23
  152. package/src/internal/pictures/quiescence.ts +1 -1
  153. package/src/internal/pictures/state.ts +26 -0
  154. package/src/internal/pictures/transport.ts +21 -4
  155. package/src/internal/reading/controls.inpage.ts +5 -70
  156. package/src/internal/reading/expect.inpage.ts +13 -17
  157. package/src/internal/reading/names.inpage.ts +89 -45
  158. package/src/internal/reading/outline.inpage.ts +6 -7
  159. package/src/internal/reading/reading.ts +144 -176
  160. package/src/internal/reading/ready.inpage.ts +6 -17
  161. package/src/internal/reading/ready.ts +13 -135
  162. package/src/internal/reading/subjects.inpage.ts +83 -43
  163. package/src/internal/reading/walk.inpage.ts +33 -13
  164. package/src/internal/timeline/changes.ts +55 -6
  165. package/src/internal/timeline/events.ts +15 -5
  166. package/src/internal/timeline/history.inpage.ts +1 -1
  167. package/src/internal/timeline/record.inpage.ts +4 -1
  168. package/src/internal/timeline/window.ts +2 -1
  169. package/src/{Moment.ts → moment/Moment.ts} +13 -31
  170. package/src/{internal/timeline → moment}/words.ts +2 -2
  171. package/src/{internal/reading → plan}/choose.ts +3 -3
  172. package/src/plan/data.ts +117 -0
  173. package/src/plan/execute.ts +411 -0
  174. package/src/plan/index.ts +36 -0
  175. package/src/plan/record.ts +71 -0
  176. package/src/plan/targets.ts +71 -0
  177. package/src/{Policy.ts → policy/Policy.ts} +13 -10
  178. package/src/{Motion.ts → presentation/Motion.ts} +12 -46
  179. package/src/presentation/Presentation.ts +176 -0
  180. package/src/{Stage.ts → presentation/Stage.ts} +147 -112
  181. package/src/presentation/feed.ts +21 -0
  182. package/src/{Cdp.ts → providers/Cdp.ts} +2 -2
  183. package/src/{Chromium.ts → providers/Chromium.ts} +7 -10
  184. package/src/providers/Released.ts +13 -0
  185. package/src/{internal/cdp.ts → providers/connection.ts} +2 -2
  186. package/src/{internal/pictures/motion.ts → stillness/Pixels.ts} +1 -1
  187. package/src/stillness/Stillness.ts +166 -0
  188. package/src/supervisor/Supervisor.ts +170 -0
  189. package/src/supervisor/contract.ts +105 -0
  190. package/src/supervisor/lifecycle.ts +272 -0
  191. package/src/supervisor/runtime.ts +238 -0
  192. package/src/testing/TestBrowser.ts +115 -0
  193. package/src/testing/TestPage.ts +10 -0
  194. package/src/testing/evidence.ts +154 -0
  195. package/src/testing/index.ts +3 -0
  196. package/src/testing/model.ts +222 -0
  197. package/src/testing/page.ts +360 -0
  198. package/src/workerd/Cdp.ts +2 -2
  199. package/dist/Browser-CxXUjxOp.mjs +0 -619
  200. package/dist/Browser-CxXUjxOp.mjs.map +0 -1
  201. package/dist/Cdp-CzCRnMlM.d.mts +0 -10
  202. package/dist/Cdp.d.mts +0 -11
  203. package/dist/Cdp.mjs.map +0 -1
  204. package/dist/Change-DNvztNLu.mjs +0 -138
  205. package/dist/Change-DNvztNLu.mjs.map +0 -1
  206. package/dist/Chromium.mjs.map +0 -1
  207. package/dist/Expect-u3P_ENLX.d.mts +0 -62
  208. package/dist/Expect.d.mts +0 -2
  209. package/dist/Expect.mjs +0 -114
  210. package/dist/Expect.mjs.map +0 -1
  211. package/dist/Moment.d.mts +0 -2
  212. package/dist/Moment.mjs.map +0 -1
  213. package/dist/Motion.d.mts +0 -2
  214. package/dist/Motion.mjs.map +0 -1
  215. package/dist/Page-BP02bmNv.mjs +0 -264
  216. package/dist/Page-BP02bmNv.mjs.map +0 -1
  217. package/dist/Plan-BG1WifW2.mjs.map +0 -1
  218. package/dist/Plan.d.mts +0 -2
  219. package/dist/Plan.mjs +0 -2
  220. package/dist/Policy.d.mts +0 -2
  221. package/dist/Policy.mjs.map +0 -1
  222. package/dist/Presentation-DxVikn9_.d.mts +0 -48
  223. package/dist/Presentation.d.mts +0 -2
  224. package/dist/Presentation.mjs +0 -118
  225. package/dist/Presentation.mjs.map +0 -1
  226. package/dist/Stage.d.mts +0 -2
  227. package/dist/Stage.mjs.map +0 -1
  228. package/dist/Supervisor-2mPjIYYs.mjs +0 -676
  229. package/dist/Supervisor-2mPjIYYs.mjs.map +0 -1
  230. package/dist/Supervisor-CfRxbaso.d.mts +0 -317
  231. package/dist/Supervisor.d.mts +0 -2
  232. package/dist/Supervisor.mjs +0 -2
  233. package/dist/cdp-BMpYMWYe.mjs.map +0 -1
  234. package/dist/context-EGhOqjNN.mjs +0 -335
  235. package/dist/context-EGhOqjNN.mjs.map +0 -1
  236. package/dist/page-PTM8m5wC.mjs +0 -4057
  237. package/dist/page-PTM8m5wC.mjs.map +0 -1
  238. package/dist/url-Bsp2y55M.mjs +0 -264
  239. package/dist/url-Bsp2y55M.mjs.map +0 -1
  240. package/dist/workerd/index.d.mts +0 -16
  241. package/dist/workerd/index.mjs +0 -17
  242. package/src/Expect.ts +0 -180
  243. package/src/Plan.ts +0 -674
  244. package/src/Presentation.ts +0 -196
  245. package/src/Supervisor.ts +0 -632
  246. package/src/internal/supervisor/lifecycle.ts +0 -484
  247. package/src/workerd/index.ts +0 -17
  248. /package/src/{internal/page/url.ts → Url.ts} +0 -0
  249. /package/src/{internal/pictures → stillness}/utilsBundle.d.ts +0 -0
@@ -1,5 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
- import { Plan, Point } from "./Motion.mjs";
2
+ import { Plan, Point } from "./Geometry.mjs";
3
+ import { Action as Action$1, Name } from "./Action.mjs";
3
4
  import { Schema } from "effect";
4
5
  //#region src/BrowserEvent.ts
5
6
  /**
@@ -16,7 +17,6 @@ import { Schema } from "effect";
16
17
  */
17
18
  var BrowserEvent_exports = /* @__PURE__ */ __exportAll({
18
19
  Action: () => Action,
19
- ActionOptions: () => ActionOptions,
20
20
  Box: () => Box,
21
21
  BrowserEvent: () => BrowserEvent,
22
22
  CursorChanged: () => CursorChanged,
@@ -32,6 +32,7 @@ var BrowserEvent_exports = /* @__PURE__ */ __exportAll({
32
32
  PointerPressed: () => PointerPressed,
33
33
  PointerReleased: () => PointerReleased,
34
34
  RecordedEvent: () => RecordedEvent,
35
+ RequestRefused: () => RequestRefused,
35
36
  SessionEnding: () => SessionEnding,
36
37
  Subject: () => Subject,
37
38
  SubjectContext: () => SubjectContext,
@@ -144,24 +145,8 @@ const Box = Schema.Struct({
144
145
  height: Schema.Finite
145
146
  });
146
147
  /**
147
- * What else an action was asked, where it changes what the action does: a click's button, count
148
- * and hold, how `type` enters its text, how often and how long `press` holds its keys, how far
149
- * `scroll` moves, and the options `select` chose. Only a completed action records them.
150
- */
151
- const ActionOptions = Schema.Struct({
152
- button: Schema.optional(Button),
153
- clickCount: Schema.optional(Schema.Finite),
154
- holdMillis: Schema.optional(Schema.Finite),
155
- replace: Schema.optional(Schema.Boolean),
156
- submit: Schema.optional(Schema.Boolean),
157
- times: Schema.optional(Schema.Finite),
158
- dx: Schema.optional(Schema.Finite),
159
- dy: Schema.optional(Schema.Finite),
160
- values: Schema.optional(Schema.Array(Schema.String))
161
- });
162
- /**
163
148
  * One page operation ended, including one its caller interrupted (`error: "interrupted"`).
164
- * `target` is what the caller asked for: a ref, a point, a URL or keys, and `options` the rest.
149
+ * `value` is the decoded call. `target` is its short rendering for observers.
165
150
  * `subject` is what an element or point action found there, and `to` where a drag ended; an
166
151
  * action that failed before finding its target has neither. Point actions carry the viewport
167
152
  * point they used. `correlation` is the id its caller gave it with `Page.correlate`, such as a
@@ -171,12 +156,13 @@ var Action = class extends Schema.TaggedClass()("Action", {
171
156
  at: Schema.Finite,
172
157
  startedAt: Schema.Finite,
173
158
  page: Schema.String,
174
- name: Schema.String,
159
+ name: Name,
160
+ /** The decoded call, with secrets removed before publication. */
161
+ value: Action$1,
175
162
  /** The address when the action ended; absent in events recorded by older releases. */
176
163
  url: Schema.optional(Schema.String),
177
164
  correlation: Schema.optional(Schema.String),
178
165
  target: Schema.optional(Schema.String),
179
- options: Schema.optional(ActionOptions),
180
166
  subject: Schema.optional(Subject),
181
167
  to: Schema.optional(Subject),
182
168
  /** For an action at a point, the box of what it found there. */
@@ -259,7 +245,7 @@ const TrackEvent = Schema.Union([
259
245
  CursorChanged
260
246
  ]);
261
247
  /**
262
- * A JavaScript dialog appeared and was answered: an alert or a leave-page prompt accepted, a
248
+ * A JavaScript dialog appeared; its completed answer, or a failed response: an alert or a leave-page prompt accepted, a
263
249
  * confirm or a prompt dismissed, as if its Cancel were pressed.
264
250
  */
265
251
  var DialogShown = class extends Schema.TaggedClass()("DialogShown", {
@@ -267,9 +253,28 @@ var DialogShown = class extends Schema.TaggedClass()("DialogShown", {
267
253
  page: Schema.String,
268
254
  kind: Schema.String,
269
255
  message: Schema.String,
270
- answer: Schema.Literals(["accepted", "dismissed"])
256
+ answer: Schema.Literals([
257
+ "accepted",
258
+ "dismissed",
259
+ "failed"
260
+ ])
261
+ }) {};
262
+ /** A context policy refused traffic; page is present only when its containing page was established.
263
+ * Worker and out-of-process iframe requests may omit it while retaining proven context ownership. */
264
+ var RequestRefused = class extends Schema.TaggedClass()("RequestRefused", {
265
+ at: Schema.Finite,
266
+ page: Schema.optional(Schema.String),
267
+ method: Schema.String,
268
+ url: Schema.String,
269
+ reason: Schema.String,
270
+ /** Safe structured diagnosis; arbitrary policy error details and causes stay private. */
271
+ failure: Schema.optional(Schema.Struct({
272
+ reason: Schema.String,
273
+ timeoutMillis: Schema.optional(Schema.Finite)
274
+ }))
271
275
  }) {};
272
276
  const BrowserEvent = Schema.Union([
277
+ RequestRefused,
273
278
  PageOpened,
274
279
  PageClosed,
275
280
  PageUntracked,
@@ -287,6 +292,6 @@ var RecordedEvent = class extends Schema.Class("effect-browser/RecordedEvent")({
287
292
  event: BrowserEvent
288
293
  }) {};
289
294
  //#endregion
290
- export { Action, ActionOptions, Box, BrowserEvent, CursorChanged, DialogShown, DisconnectCause, Disconnected, KeyChanged, Navigated, PageClosed, PageLoaded, PageOpened, PageUntracked, PointerPressed, PointerReleased, RecordedEvent, SessionEnding, Subject, SubjectContext, TextInserted, TrackEvent, TrackPerformed, TrackPlanned, WheelScrolled, BrowserEvent_exports as t };
295
+ export { Action, Box, BrowserEvent, CursorChanged, DialogShown, DisconnectCause, Disconnected, KeyChanged, Navigated, PageClosed, PageLoaded, PageOpened, PageUntracked, PointerPressed, PointerReleased, RecordedEvent, RequestRefused, SessionEnding, Subject, SubjectContext, TextInserted, TrackEvent, TrackPerformed, TrackPlanned, WheelScrolled, BrowserEvent_exports as t };
291
296
 
292
297
  //# sourceMappingURL=BrowserEvent.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BrowserEvent.mjs","names":["Motion.Point","Motion.Plan"],"sources":["../src/BrowserEvent.ts"],"sourcesContent":["/**\n * What happened in a browser, in order: pages and their documents, actions, pointer motion, and\n * the browser's own end.\n *\n * Every event carries `at`, host monotonic milliseconds from the owning browser’s Effect `Clock`.\n * This clock also stamps screencast frames’ `receivedAt` and moments, so wall-clock corrections\n * cannot disturb their order. Compare stamps only within the same browser clock, not across hosts.\n * A page is named by its CDP target id, which stays the same across reconnects, and every URL is\n * reported without its userinfo or known secret parameters.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\nimport * as Motion from \"./Motion.ts\";\n\n/** A page opened, and the page that opened it, as a link or `window.open` does, if one did. */\nexport class PageOpened extends Schema.TaggedClass<PageOpened>()(\"PageOpened\", {\n at: Schema.Finite,\n page: Schema.String,\n url: Schema.String,\n opener: Schema.optional(Schema.String),\n}) {}\n\n/**\n * The page closed (`page`), or crashed and was closed (`crashed`). A page lost with its browser\n * has no event of its own: `Disconnected` stands for all of them.\n */\nexport class PageClosed extends Schema.TaggedClass<PageClosed>()(\"PageClosed\", {\n at: Schema.Finite,\n page: Schema.String,\n cause: Schema.Literals([\"page\", \"crashed\"]),\n}) {}\n\n/**\n * A tab the site opened that the library could not track, as its registration failed with\n * `detail`. A tab that closed as it opened has no event.\n */\nexport class PageUntracked extends Schema.TaggedClass<PageUntracked>()(\"PageUntracked\", {\n at: Schema.Finite,\n url: Schema.String,\n detail: Schema.String,\n}) {}\n\n/**\n * The page's main frame moved to `url`: into a new document, or within the current one\n * (`sameDocument`), as `pushState` and fragment links do. Frames carry the document they followed.\n */\nexport class Navigated extends Schema.TaggedClass<Navigated>()(\"Navigated\", {\n at: Schema.Finite,\n page: Schema.String,\n url: Schema.String,\n /**\n * The page's documents counted from 0, the one it had when this browser began tracking it, one\n * more for each new document. The count belongs to the page within one `Browser` and starts at\n * 0 again on a new connection, so compare it only with the same page's in the same browser.\n */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n sameDocument: Schema.Boolean,\n}) {}\n\n/** The page's document finished parsing (`domcontentloaded`) or loading (`load`). */\nexport class PageLoaded extends Schema.TaggedClass<PageLoaded>()(\"PageLoaded\", {\n at: Schema.Finite,\n page: Schema.String,\n state: Schema.Literals([\"domcontentloaded\", \"load\"]),\n}) {}\n\n/**\n * Why a browser was lost to its owner: its connection dropped (`connection`), its provider ended\n * its session, at or after the session's `expiresAt` (`session`), or its owner released it.\n */\nexport const DisconnectCause = Schema.Literals([\"connection\", \"session\", \"released\"]);\n\nexport type DisconnectCause = typeof DisconnectCause.Type;\n\n/** The browser was lost to its owner, with every page in it. It happens once. */\nexport class Disconnected extends Schema.TaggedClass<Disconnected>()(\"Disconnected\", {\n at: Schema.Finite,\n cause: DisconnectCause,\n}) {}\n\n/** The provider ends this browser's session at `expiresAt`, a wall-clock instant. */\nexport class SessionEnding extends Schema.TaggedClass<SessionEnding>()(\"SessionEnding\", {\n at: Schema.Finite,\n expiresAt: Schema.DateTimeUtc,\n}) {}\n\n/**\n * The words around a subject that say which one it is, each bound to it in the page rather than\n * read off nearby text later. In a table, `row` is the row's header or first cell with text and\n * `column` the header over it; elsewhere, `label` is the words just before it in its row, item,\n * group or block, at most 40 characters. `heading` is the nearest heading above it, left out for\n * what is pinned to the viewport. Row, column and heading are at most 60 characters.\n */\nexport const SubjectContext = Schema.Struct({\n row: Schema.optional(Schema.String),\n column: Schema.optional(Schema.String),\n label: Schema.optional(Schema.String),\n heading: Schema.optional(Schema.String),\n});\n\nexport type SubjectContext = typeof SubjectContext.Type;\n\n/**\n * What an input acted on, or what `Page.find` found, as the page named it then: its role (null\n * when it has none), its accessible name (empty when it has none), its lowercase tag and its\n * context. For a point, it is the control under the point, or else the element painted there.\n * Unlike a ref, it keeps its meaning after the page changes.\n */\nexport class Subject extends Schema.Class<Subject>(\"effect-browser/Subject\")({\n role: Schema.NullOr(Schema.String),\n name: Schema.String,\n tag: Schema.String,\n context: SubjectContext,\n}) {}\n\nconst Button = Schema.Literals([\"left\", \"right\", \"middle\"]);\n\n/** An element's box in viewport CSS pixels; it may lie partly or wholly outside the viewport. */\nexport const Box = Schema.Struct({\n ...Motion.Point.fields,\n width: Schema.Finite,\n height: Schema.Finite,\n});\n\nexport type Box = typeof Box.Type;\n\n/**\n * What else an action was asked, where it changes what the action does: a click's button, count\n * and hold, how `type` enters its text, how often and how long `press` holds its keys, how far\n * `scroll` moves, and the options `select` chose. Only a completed action records them.\n */\nexport const ActionOptions = Schema.Struct({\n button: Schema.optional(Button),\n clickCount: Schema.optional(Schema.Finite),\n holdMillis: Schema.optional(Schema.Finite),\n replace: Schema.optional(Schema.Boolean),\n submit: Schema.optional(Schema.Boolean),\n times: Schema.optional(Schema.Finite),\n dx: Schema.optional(Schema.Finite),\n dy: Schema.optional(Schema.Finite),\n values: Schema.optional(Schema.Array(Schema.String)),\n});\n\nexport type ActionOptions = typeof ActionOptions.Type;\n\n/**\n * One page operation ended, including one its caller interrupted (`error: \"interrupted\"`).\n * `target` is what the caller asked for: a ref, a point, a URL or keys, and `options` the rest.\n * `subject` is what an element or point action found there, and `to` where a drag ended; an\n * action that failed before finding its target has neither. Point actions carry the viewport\n * point they used. `correlation` is the id its caller gave it with `Page.correlate`, such as a\n * model's tool call id.\n */\nexport class Action extends Schema.TaggedClass<Action>()(\"Action\", {\n at: Schema.Finite,\n startedAt: Schema.Finite,\n page: Schema.String,\n name: Schema.String,\n /** The address when the action ended; absent in events recorded by older releases. */\n url: Schema.optional(Schema.String),\n correlation: Schema.optional(Schema.String),\n target: Schema.optional(Schema.String),\n options: Schema.optional(ActionOptions),\n subject: Schema.optional(Subject),\n to: Schema.optional(Subject),\n /** For an action at a point, the box of what it found there. */\n box: Schema.optional(Box),\n text: Schema.optional(Schema.String),\n x: Schema.optional(Motion.Point.fields.x),\n y: Schema.optional(Motion.Point.fields.y),\n ok: Schema.Boolean,\n dispatched: Schema.Boolean,\n error: Schema.optional(Schema.String),\n}) {}\n\nconst Sequence = Schema.Int.check(Schema.isGreaterThan(0));\n\n/** One whole glide, published before its first input. Offsets use the host monotonic clock. */\nexport class TrackPlanned extends Schema.TaggedClass<TrackPlanned>()(\"TrackPlanned\", {\n at: Schema.Finite,\n page: Schema.String,\n from: Motion.Point,\n samples: Motion.Plan,\n}) {}\n\n/**\n * The submitted prefix of a glide. `plan` is its TrackPlanned envelope sequence; `dispatched`\n * counts samples. `complete` means every sample was submitted, not acknowledged by the browser.\n * The terminal point clips a canceled plan so a compositor never draws its unrealized future.\n */\nexport class TrackPerformed extends Schema.TaggedClass<TrackPerformed>()(\"TrackPerformed\", {\n at: Schema.Finite,\n page: Schema.String,\n plan: Sequence,\n dispatched: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n ...Motion.Point.fields,\n complete: Schema.Boolean,\n}) {}\n\nexport class PointerPressed extends Schema.TaggedClass<PointerPressed>()(\"PointerPressed\", {\n at: Schema.Finite,\n page: Schema.String,\n ...Motion.Point.fields,\n button: Button,\n clickCount: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\nexport class PointerReleased extends Schema.TaggedClass<PointerReleased>()(\"PointerReleased\", {\n at: Schema.Finite,\n page: Schema.String,\n ...Motion.Point.fields,\n button: Button,\n clickCount: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\nexport class WheelScrolled extends Schema.TaggedClass<WheelScrolled>()(\"WheelScrolled\", {\n at: Schema.Finite,\n page: Schema.String,\n ...Motion.Point.fields,\n dx: Schema.Finite,\n dy: Schema.Finite,\n}) {}\n\nexport class KeyChanged extends Schema.TaggedClass<KeyChanged>()(\"KeyChanged\", {\n at: Schema.Finite,\n page: Schema.String,\n key: Schema.String,\n phase: Schema.Literals([\"down\", \"up\"]),\n}) {}\n\n/** Literal text insertion has no corresponding key events, including Unicode and newlines. */\nexport class TextInserted extends Schema.TaggedClass<TextInserted>()(\"TextInserted\", {\n at: Schema.Finite,\n page: Schema.String,\n text: Schema.String,\n}) {}\n\n/** The target's CSS cursor, obtained during target resolution without another browser call. */\nexport class CursorChanged extends Schema.TaggedClass<CursorChanged>()(\"CursorChanged\", {\n at: Schema.Finite,\n page: Schema.String,\n cursor: Schema.String,\n}) {}\n\nexport const TrackEvent = Schema.Union([\n TrackPlanned,\n TrackPerformed,\n PointerPressed,\n PointerReleased,\n WheelScrolled,\n KeyChanged,\n TextInserted,\n CursorChanged,\n]);\n\nexport type TrackEvent = typeof TrackEvent.Type;\n\n/**\n * A JavaScript dialog appeared and was answered: an alert or a leave-page prompt accepted, a\n * confirm or a prompt dismissed, as if its Cancel were pressed.\n */\nexport class DialogShown extends Schema.TaggedClass<DialogShown>()(\"DialogShown\", {\n at: Schema.Finite,\n page: Schema.String,\n kind: Schema.String,\n message: Schema.String,\n answer: Schema.Literals([\"accepted\", \"dismissed\"]),\n}) {}\n\nexport const BrowserEvent = Schema.Union([\n PageOpened,\n PageClosed,\n PageUntracked,\n Navigated,\n PageLoaded,\n Action,\n ...TrackEvent.members,\n DialogShown,\n Disconnected,\n SessionEnding,\n]);\n\nexport type BrowserEvent = typeof BrowserEvent.Type;\n\n/** A position in the browser's one replayable event history. Sequences begin at one. */\nexport class RecordedEvent extends Schema.Class<RecordedEvent>(\"effect-browser/RecordedEvent\")({\n sequence: Sequence,\n event: BrowserEvent,\n}) {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA,IAAa,aAAb,cAAgC,OAAO,YAAwB,CAAC,CAAC,cAAc;CAC7E,IAAI,OAAO;CACX,MAAM,OAAO;C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C,CAAC;AAEJ,IAAa,aAAb,cAAgC,OAAO,YAAwB,CAAC,CAAC,cAAc;CAC7E,IAAI,OAAO;CACX,MAAM,OAAO;CACb,KAAK,OAAO;CACZ,OAAO,OAAO,SAAS,CAAC,QAAQ,IAAI,CAAC;AACvC,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAAC,gBAAgB;CACnF,IAAI,OAAO;CACX,MAAM,OAAO;CACb,MAAM,OAAO;AACf,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,gBAAb,cAAmC,OAAO,YAA2B,CAAC,CAAC,iBAAiB;CACtF,IAAI,OAAO;CACX,MAAM,OAAO;CACb,QAAQ,OAAO;AACjB,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAa,aAAa,OAAO,MAAM;CACrC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF,CAAC;;;;;AAQD,IAAa,cAAb,cAAiC,OAAO,YAAyB,CAAC,CAAC,eAAe;CAChF,IAAI,OAAO;CACX,MAAM,OAAO;CACb,MAAM,OAAO;CACb,SAAS,OAAO;CAChB,QAAQ,OAAO,SAAS,CAAC,YAAY,WAAW,CAAC;AACnD,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAa,eAAe,OAAO,MAAM;CACvC;CACA;CACA;CACA;CACA;CACA;CACA,GAAG,WAAW;CACd;CACA;CACA;AACF,CAAC;;AAKD,IAAa,gBAAb,cAAmC,OAAO,MAAqB,8BAA8B,CAAC,CAAC;CAC7F,UAAU;CACV,OAAO;AACT,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"BrowserEvent.mjs","names":["ActionValue","Motion.Point","Motion.Plan"],"sources":["../src/BrowserEvent.ts"],"sourcesContent":["/**\n * What happened in a browser, in order: pages and their documents, actions, pointer motion, and\n * the browser's own end.\n *\n * Every event carries `at`, host monotonic milliseconds from the owning browser’s Effect `Clock`.\n * This clock also stamps screencast frames’ `receivedAt` and moments, so wall-clock corrections\n * cannot disturb their order. Compare stamps only within the same browser clock, not across hosts.\n * A page is named by its CDP target id, which stays the same across reconnects, and every URL is\n * reported without its userinfo or known secret parameters.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\nimport { Action as ActionValue, Name } from \"./Action.ts\";\nimport * as Motion from \"./Geometry.ts\";\n\n/** A page opened, and the page that opened it, as a link or `window.open` does, if one did. */\nexport class PageOpened extends Schema.TaggedClass<PageOpened>()(\"PageOpened\", {\n at: Schema.Finite,\n page: Schema.String,\n url: Schema.String,\n opener: Schema.optional(Schema.String),\n}) {}\n\n/**\n * The page closed (`page`), or crashed and was closed (`crashed`). A page lost with its browser\n * has no event of its own: `Disconnected` stands for all of them.\n */\nexport class PageClosed extends Schema.TaggedClass<PageClosed>()(\"PageClosed\", {\n at: Schema.Finite,\n page: Schema.String,\n cause: Schema.Literals([\"page\", \"crashed\"]),\n}) {}\n\n/**\n * A tab the site opened that the library could not track, as its registration failed with\n * `detail`. A tab that closed as it opened has no event.\n */\nexport class PageUntracked extends Schema.TaggedClass<PageUntracked>()(\"PageUntracked\", {\n at: Schema.Finite,\n url: Schema.String,\n detail: Schema.String,\n}) {}\n\n/**\n * The page's main frame moved to `url`: into a new document, or within the current one\n * (`sameDocument`), as `pushState` and fragment links do. Frames carry the document they followed.\n */\nexport class Navigated extends Schema.TaggedClass<Navigated>()(\"Navigated\", {\n at: Schema.Finite,\n page: Schema.String,\n url: Schema.String,\n /**\n * The page's documents counted from 0, the one it had when this browser began tracking it, one\n * more for each new document. The count belongs to the page within one `Browser` and starts at\n * 0 again on a new connection, so compare it only with the same page's in the same browser.\n */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n sameDocument: Schema.Boolean,\n}) {}\n\n/** The page's document finished parsing (`domcontentloaded`) or loading (`load`). */\nexport class PageLoaded extends Schema.TaggedClass<PageLoaded>()(\"PageLoaded\", {\n at: Schema.Finite,\n page: Schema.String,\n state: Schema.Literals([\"domcontentloaded\", \"load\"]),\n}) {}\n\n/**\n * Why a browser was lost to its owner: its connection dropped (`connection`), its provider ended\n * its session, at or after the session's `expiresAt` (`session`), or its owner released it.\n */\nexport const DisconnectCause = Schema.Literals([\"connection\", \"session\", \"released\"]);\n\nexport type DisconnectCause = typeof DisconnectCause.Type;\n\n/** The browser was lost to its owner, with every page in it. It happens once. */\nexport class Disconnected extends Schema.TaggedClass<Disconnected>()(\"Disconnected\", {\n at: Schema.Finite,\n cause: DisconnectCause,\n}) {}\n\n/** The provider ends this browser's session at `expiresAt`, a wall-clock instant. */\nexport class SessionEnding extends Schema.TaggedClass<SessionEnding>()(\"SessionEnding\", {\n at: Schema.Finite,\n expiresAt: Schema.DateTimeUtc,\n}) {}\n\n/**\n * The words around a subject that say which one it is, each bound to it in the page rather than\n * read off nearby text later. In a table, `row` is the row's header or first cell with text and\n * `column` the header over it; elsewhere, `label` is the words just before it in its row, item,\n * group or block, at most 40 characters. `heading` is the nearest heading above it, left out for\n * what is pinned to the viewport. Row, column and heading are at most 60 characters.\n */\nexport const SubjectContext = Schema.Struct({\n row: Schema.optional(Schema.String),\n column: Schema.optional(Schema.String),\n label: Schema.optional(Schema.String),\n heading: Schema.optional(Schema.String),\n});\n\nexport type SubjectContext = typeof SubjectContext.Type;\n\n/**\n * What an input acted on, or what `Page.find` found, as the page named it then: its role (null\n * when it has none), its accessible name (empty when it has none), its lowercase tag and its\n * context. For a point, it is the control under the point, or else the element painted there.\n * Unlike a ref, it keeps its meaning after the page changes.\n */\nexport class Subject extends Schema.Class<Subject>(\"effect-browser/Subject\")({\n role: Schema.NullOr(Schema.String),\n name: Schema.String,\n tag: Schema.String,\n context: SubjectContext,\n}) {}\n\nconst Button = Schema.Literals([\"left\", \"right\", \"middle\"]);\n\n/** An element's box in viewport CSS pixels; it may lie partly or wholly outside the viewport. */\nexport const Box = Schema.Struct({\n ...Motion.Point.fields,\n width: Schema.Finite,\n height: Schema.Finite,\n});\n\nexport type Box = typeof Box.Type;\n\n/**\n * One page operation ended, including one its caller interrupted (`error: \"interrupted\"`).\n * `value` is the decoded call. `target` is its short rendering for observers.\n * `subject` is what an element or point action found there, and `to` where a drag ended; an\n * action that failed before finding its target has neither. Point actions carry the viewport\n * point they used. `correlation` is the id its caller gave it with `Page.correlate`, such as a\n * model's tool call id.\n */\nexport class Action extends Schema.TaggedClass<Action>()(\"Action\", {\n at: Schema.Finite,\n startedAt: Schema.Finite,\n page: Schema.String,\n name: Name,\n /** The decoded call, with secrets removed before publication. */\n value: ActionValue,\n /** The address when the action ended; absent in events recorded by older releases. */\n url: Schema.optional(Schema.String),\n correlation: Schema.optional(Schema.String),\n target: Schema.optional(Schema.String),\n subject: Schema.optional(Subject),\n to: Schema.optional(Subject),\n /** For an action at a point, the box of what it found there. */\n box: Schema.optional(Box),\n text: Schema.optional(Schema.String),\n x: Schema.optional(Motion.Point.fields.x),\n y: Schema.optional(Motion.Point.fields.y),\n ok: Schema.Boolean,\n dispatched: Schema.Boolean,\n error: Schema.optional(Schema.String),\n}) {}\n\nconst Sequence = Schema.Int.check(Schema.isGreaterThan(0));\n\n/** One whole glide, published before its first input. Offsets use the host monotonic clock. */\nexport class TrackPlanned extends Schema.TaggedClass<TrackPlanned>()(\"TrackPlanned\", {\n at: Schema.Finite,\n page: Schema.String,\n from: Motion.Point,\n samples: Motion.Plan,\n}) {}\n\n/**\n * The submitted prefix of a glide. `plan` is its TrackPlanned envelope sequence; `dispatched`\n * counts samples. `complete` means every sample was submitted, not acknowledged by the browser.\n * The terminal point clips a canceled plan so a compositor never draws its unrealized future.\n */\nexport class TrackPerformed extends Schema.TaggedClass<TrackPerformed>()(\"TrackPerformed\", {\n at: Schema.Finite,\n page: Schema.String,\n plan: Sequence,\n dispatched: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n ...Motion.Point.fields,\n complete: Schema.Boolean,\n}) {}\n\nexport class PointerPressed extends Schema.TaggedClass<PointerPressed>()(\"PointerPressed\", {\n at: Schema.Finite,\n page: Schema.String,\n ...Motion.Point.fields,\n button: Button,\n clickCount: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\nexport class PointerReleased extends Schema.TaggedClass<PointerReleased>()(\"PointerReleased\", {\n at: Schema.Finite,\n page: Schema.String,\n ...Motion.Point.fields,\n button: Button,\n clickCount: Schema.Int.check(Schema.isGreaterThan(0)),\n}) {}\n\nexport class WheelScrolled extends Schema.TaggedClass<WheelScrolled>()(\"WheelScrolled\", {\n at: Schema.Finite,\n page: Schema.String,\n ...Motion.Point.fields,\n dx: Schema.Finite,\n dy: Schema.Finite,\n}) {}\n\nexport class KeyChanged extends Schema.TaggedClass<KeyChanged>()(\"KeyChanged\", {\n at: Schema.Finite,\n page: Schema.String,\n key: Schema.String,\n phase: Schema.Literals([\"down\", \"up\"]),\n}) {}\n\n/** Literal text insertion has no corresponding key events, including Unicode and newlines. */\nexport class TextInserted extends Schema.TaggedClass<TextInserted>()(\"TextInserted\", {\n at: Schema.Finite,\n page: Schema.String,\n text: Schema.String,\n}) {}\n\n/** The target's CSS cursor, obtained during target resolution without another browser call. */\nexport class CursorChanged extends Schema.TaggedClass<CursorChanged>()(\"CursorChanged\", {\n at: Schema.Finite,\n page: Schema.String,\n cursor: Schema.String,\n}) {}\n\nexport const TrackEvent = Schema.Union([\n TrackPlanned,\n TrackPerformed,\n PointerPressed,\n PointerReleased,\n WheelScrolled,\n KeyChanged,\n TextInserted,\n CursorChanged,\n]);\n\nexport type TrackEvent = typeof TrackEvent.Type;\n\n/**\n * A JavaScript dialog appeared; its completed answer, or a failed response: an alert or a leave-page prompt accepted, a\n * confirm or a prompt dismissed, as if its Cancel were pressed.\n */\nexport class DialogShown extends Schema.TaggedClass<DialogShown>()(\"DialogShown\", {\n at: Schema.Finite,\n page: Schema.String,\n kind: Schema.String,\n message: Schema.String,\n answer: Schema.Literals([\"accepted\", \"dismissed\", \"failed\"]),\n}) {}\n\n/** A context policy refused traffic; page is present only when its containing page was established.\n * Worker and out-of-process iframe requests may omit it while retaining proven context ownership. */\nexport class RequestRefused extends Schema.TaggedClass<RequestRefused>()(\"RequestRefused\", {\n at: Schema.Finite,\n page: Schema.optional(Schema.String),\n method: Schema.String,\n url: Schema.String,\n reason: Schema.String,\n /** Safe structured diagnosis; arbitrary policy error details and causes stay private. */\n failure: Schema.optional(\n Schema.Struct({\n reason: Schema.String,\n timeoutMillis: Schema.optional(Schema.Finite),\n }),\n ),\n}) {}\n\nexport const BrowserEvent = Schema.Union([\n RequestRefused,\n PageOpened,\n PageClosed,\n PageUntracked,\n Navigated,\n PageLoaded,\n Action,\n ...TrackEvent.members,\n DialogShown,\n Disconnected,\n SessionEnding,\n]);\n\nexport type BrowserEvent = typeof BrowserEvent.Type;\n\n/** A position in the browser's one replayable event history. Sequences begin at one. */\nexport class RecordedEvent extends Schema.Class<RecordedEvent>(\"effect-browser/RecordedEvent\")({\n sequence: Sequence,\n event: BrowserEvent,\n}) {}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,IAAa,aAAb,cAAgC,OAAO,YAAwB,CAAC,CAAC,cAAc;CAC7E,IAAI,OAAO;CACX,MAAM,OAAO;CACb,KAAK,OAAO;CACZ,QAAQ,OAAO,SAAS,OAAO,MAAM;AACvC,CAAC,CAAC,CAAC,CAAC;;;;;AAMJ,IAAa,aAAb,cAAgC,OAAO,YAAwB,CAAC,CAAC,cAAc;CAC7E,IAAI,OAAO;CACX,MAAM,OAAO;CACb,OAAO,OAAO,SAAS,CAAC,QAAQ,SAAS,CAAC;AAC5C,CAAC,CAAC,CAAC,CAAC;;;;;AAMJ,IAAa,gBAAb,cAAmC,OAAO,YAA2B,CAAC,CAAC,iBAAiB;CACtF,IAAI,OAAO;CACX,KAAK,OAAO;CACZ,QAAQ,OAAO;AACjB,CAAC,CAAC,CAAC,CAAC;;;;;AAMJ,IAAa,YAAb,cAA+B,OAAO,YAAuB,CAAC,CAAC,aAAa;CAC1E,IAAI,OAAO;CACX,MAAM,OA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O;CACf,KAAK,OAAO;CACZ,QAAQ,OAAO;;CAEf,SAAS,OAAO,SACd,OAAO,OAAO;EACZ,QAAQ,OAAO;EACf,eAAe,OAAO,SAAS,OAAO,MAAM;CAC9C,CAAC,CACH;AACF,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAa,eAAe,OAAO,MAAM;CACvC;CACA;CACA;CACA;CACA;CACA;CACA;CACA,GAAG,WAAW;CACd;CACA;CACA;AACF,CAAC;;AAKD,IAAa,gBAAb,cAAmC,OAAO,MAAqB,8BAA8B,CAAC,CAAC;CAC7F,UAAU;CACV,OAAO;AACT,CAAC,CAAC,CAAC,CAAC"}
@@ -1,7 +1,7 @@
1
- import { b as Subject } from "./BrowserEvent-dq6FRT8w.mjs";
1
+ import { b as Subject } from "./BrowserEvent-lLqJ3GJS.mjs";
2
2
  import { Schema } from "effect";
3
3
  declare namespace Change_d_exports {
4
- export { Change, Changes, Kind, describe };
4
+ export { Change, Changes, Kind };
5
5
  }
6
6
  /**
7
7
  * `text` changed; `appeared` and `disappeared`, whether added or removed or shown or hidden;
@@ -64,8 +64,6 @@ declare const Changes_base: Schema.Class<Changes, Schema.Struct<{
64
64
  readonly changes: Schema.$Array<typeof Change>;
65
65
  }>, {}>;
66
66
  declare class Changes extends Changes_base {}
67
- /** A change in words for a model, such as `"$61,240" became "$62,010" (row "Bitcoin", column "Price")`. */
68
- declare const describe: (change: Change) => string;
69
67
  //#endregion
70
- export { describe as a, Kind as i, Change_d_exports as n, Changes as r, Change as t };
71
- //# sourceMappingURL=Change-DqING3tr.d.mts.map
68
+ export { Kind as i, Change_d_exports as n, Changes as r, Change as t };
69
+ //# sourceMappingURL=Change-Ba7INmay.d.mts.map
package/dist/Change.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as describe, i as Kind, r as Changes, t as Change } from "./Change-DqING3tr.mjs";
2
- export { Change, Changes, Kind, describe };
1
+ import { i as Kind, r as Changes, t as Change } from "./Change-Ba7INmay.mjs";
2
+ export { Change, Changes, Kind };
package/dist/Change.mjs CHANGED
@@ -1,2 +1,97 @@
1
- import { a as describe, i as Kind, r as Changes, t as Change } from "./Change-DNvztNLu.mjs";
2
- export { Change, Changes, Kind, describe };
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Subject } from "./BrowserEvent.mjs";
3
+ import { Schema } from "effect";
4
+ //#region src/Change.ts
5
+ /**
6
+ * What visibly changed on a page over a window, element by element: text that changed, appeared,
7
+ * disappeared or came and went, a field's value, and the document's title. A change says what was
8
+ * shown at the window's start and at its end, how often it changed between, where it is on the
9
+ * page, and the input it followed, where it was that input's doing.
10
+ *
11
+ * `Page.changes` reads it. A page records once something reads its changes: from then, and from the
12
+ * start of each later document once it is parsed, until nobody has read it for two minutes. A page
13
+ * nobody reads records nothing. The record keeps 256 elements, each with its last 32 changes, for a
14
+ * minute; an element that keeps changing gives way before news, and what gives way is counted in
15
+ * `dropped`, with `from` moved past it. A change is told when it was in view as the page rendered
16
+ * it, its style showing it, so one scrolled away later is still told, and something removed or
17
+ * hidden only if it was in view before. What the record cannot see: pictures, a canvas, frames,
18
+ * shadow roots and SVG; a value a script sets; and a class that reveals an element the record has
19
+ * not seen before, such as a toast already on the page, though its later changes are seen.
20
+ *
21
+ * @since 0.3.0
22
+ */
23
+ var Change_exports = /* @__PURE__ */ __exportAll({
24
+ Change: () => Change,
25
+ Changes: () => Changes,
26
+ Kind: () => Kind
27
+ });
28
+ /**
29
+ * `text` changed; `appeared` and `disappeared`, whether added or removed or shown or hidden;
30
+ * `brief`, appeared and gone again by the window's end; `value`, a field's; `title`, the document's.
31
+ */
32
+ const Kind = Schema.Literals([
33
+ "text",
34
+ "appeared",
35
+ "disappeared",
36
+ "brief",
37
+ "value",
38
+ "title"
39
+ ]);
40
+ var Change = class extends Schema.Class("effect-browser/Change")({
41
+ kind: Kind,
42
+ /**
43
+ * What changed, as the page names it now, or where it was for what went. Its own words are what
44
+ * changed, so its name is empty unless something else names it, as a field's label does.
45
+ */
46
+ subject: Subject,
47
+ /** When it first changed in the window, in host monotonic milliseconds on the browser's clock. */
48
+ startedAt: Schema.Finite,
49
+ /** When it last changed in the window. */
50
+ at: Schema.Finite,
51
+ /**
52
+ * What it showed at the window's start; absent for what appeared and where the record let that go.
53
+ * What disappeared says what it showed as it went. A field's value reads `••••` unless unmasked.
54
+ */
55
+ before: Schema.optional(Schema.String),
56
+ /** What it showed at the window's end; absent for what disappeared. What came and went says what it showed. */
57
+ after: Schema.optional(Schema.String),
58
+ /** How many times what it showed changed in the window. */
59
+ count: Schema.Int.check(Schema.isGreaterThan(0)),
60
+ /** For a number that changed more than once, its lowest and highest, as shown. */
61
+ lowest: Schema.optional(Schema.String),
62
+ highest: Schema.optional(Schema.String),
63
+ /** When it last changed before the window, as far back as the record keeps: in flux, not news. */
64
+ earlier: Schema.optional(Schema.Finite),
65
+ /**
66
+ * When the trusted input it followed reached the page, where it was that input's doing. It was not
67
+ * in flux: in the 10 s before the input it had not changed, and nothing had come into or left what
68
+ * it sits in, so a ticker's tick or a feed's line is not. Then it changed within 3 s inside what
69
+ * the input acted on or its row, form, dialog or controlled element; or, elsewhere, within 500 ms
70
+ * of an input on a page where nothing had changed in the 2 s before, as a menu a portal puts at
71
+ * the end of the page does. What holds the input's target, as a menu holds its item, does not
72
+ * count against it. The page's `Action` that sent it holds that time.
73
+ */
74
+ cause: Schema.optional(Schema.Finite)
75
+ }) {};
76
+ var Changes = class extends Schema.Class("effect-browser/Changes")({
77
+ /** The page's document these changes belong to, as `Navigated` counts them. */
78
+ document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
79
+ /** Where the record is whole: before it, changes may be missing. */
80
+ from: Schema.Finite,
81
+ /** Where the window ends: its `until`, or when the page was read. */
82
+ until: Schema.Finite,
83
+ /**
84
+ * Where the window ends on the page's own clock. Give these changes as the next read's `since` and
85
+ * the two windows meet exactly, whatever the clock mapping does meanwhile.
86
+ */
87
+ cursor: Schema.Finite,
88
+ /** Changes in the window the record let go, at least; 0 when it kept them all. */
89
+ dropped: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),
90
+ /** Oldest first, by when each began to change. */
91
+ changes: Schema.Array(Change)
92
+ }) {};
93
+ /** A change in words for a model, such as `"$61,240" became "$62,010" (row "Bitcoin", column "Price")`. */
94
+ //#endregion
95
+ export { Change, Changes, Kind, Change_exports as t };
96
+
97
+ //# sourceMappingURL=Change.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Change.mjs","names":[],"sources":["../src/Change.ts"],"sourcesContent":["/**\n * What visibly changed on a page over a window, element by element: text that changed, appeared,\n * disappeared or came and went, a field's value, and the document's title. A change says what was\n * shown at the window's start and at its end, how often it changed between, where it is on the\n * page, and the input it followed, where it was that input's doing.\n *\n * `Page.changes` reads it. A page records once something reads its changes: from then, and from the\n * start of each later document once it is parsed, until nobody has read it for two minutes. A page\n * nobody reads records nothing. The record keeps 256 elements, each with its last 32 changes, for a\n * minute; an element that keeps changing gives way before news, and what gives way is counted in\n * `dropped`, with `from` moved past it. A change is told when it was in view as the page rendered\n * it, its style showing it, so one scrolled away later is still told, and something removed or\n * hidden only if it was in view before. What the record cannot see: pictures, a canvas, frames,\n * shadow roots and SVG; a value a script sets; and a class that reveals an element the record has\n * not seen before, such as a toast already on the page, though its later changes are seen.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\nimport { Subject } from \"./BrowserEvent.ts\";\n\n/**\n * `text` changed; `appeared` and `disappeared`, whether added or removed or shown or hidden;\n * `brief`, appeared and gone again by the window's end; `value`, a field's; `title`, the document's.\n */\nexport const Kind = Schema.Literals([\"text\", \"appeared\", \"disappeared\", \"brief\", \"value\", \"title\"]);\n\nexport type Kind = typeof Kind.Type;\n\nexport class Change extends Schema.Class<Change>(\"effect-browser/Change\")({\n kind: Kind,\n /**\n * What changed, as the page names it now, or where it was for what went. Its own words are what\n * changed, so its name is empty unless something else names it, as a field's label does.\n */\n subject: Subject,\n /** When it first changed in the window, in host monotonic milliseconds on the browser's clock. */\n startedAt: Schema.Finite,\n /** When it last changed in the window. */\n at: Schema.Finite,\n /**\n * What it showed at the window's start; absent for what appeared and where the record let that go.\n * What disappeared says what it showed as it went. A field's value reads `••••` unless unmasked.\n */\n before: Schema.optional(Schema.String),\n /** What it showed at the window's end; absent for what disappeared. What came and went says what it showed. */\n after: Schema.optional(Schema.String),\n /** How many times what it showed changed in the window. */\n count: Schema.Int.check(Schema.isGreaterThan(0)),\n /** For a number that changed more than once, its lowest and highest, as shown. */\n lowest: Schema.optional(Schema.String),\n highest: Schema.optional(Schema.String),\n /** When it last changed before the window, as far back as the record keeps: in flux, not news. */\n earlier: Schema.optional(Schema.Finite),\n /**\n * When the trusted input it followed reached the page, where it was that input's doing. It was not\n * in flux: in the 10 s before the input it had not changed, and nothing had come into or left what\n * it sits in, so a ticker's tick or a feed's line is not. Then it changed within 3 s inside what\n * the input acted on or its row, form, dialog or controlled element; or, elsewhere, within 500 ms\n * of an input on a page where nothing had changed in the 2 s before, as a menu a portal puts at\n * the end of the page does. What holds the input's target, as a menu holds its item, does not\n * count against it. The page's `Action` that sent it holds that time.\n */\n cause: Schema.optional(Schema.Finite),\n}) {}\n\nexport class Changes extends Schema.Class<Changes>(\"effect-browser/Changes\")({\n /** The page's document these changes belong to, as `Navigated` counts them. */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** Where the record is whole: before it, changes may be missing. */\n from: Schema.Finite,\n /** Where the window ends: its `until`, or when the page was read. */\n until: Schema.Finite,\n /**\n * Where the window ends on the page's own clock. Give these changes as the next read's `since` and\n * the two windows meet exactly, whatever the clock mapping does meanwhile.\n */\n cursor: Schema.Finite,\n /** Changes in the window the record let go, at least; 0 when it kept them all. */\n dropped: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** Oldest first, by when each began to change. */\n changes: Schema.Array(Change),\n}) {}\n\n/** A change in words for a model, such as `\"$61,240\" became \"$62,010\" (row \"Bitcoin\", column \"Price\")`. */\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAa,OAAO,OAAO,SAAS;CAAC;CAAQ;CAAY;CAAe;CAAS;CAAS;AAAO,CAAC;AAIlG,IAAa,SAAb,cAA4B,OAAO,MAAc,uBAAuB,CAAC,CAAC;CACxE,MAAM;;;;;CAKN,SAAS;;CAET,WAAW,OAAO;;CAElB,IAAI,OAAO;;;;;CAKX,QAAQ,OAAO,SAAS,OAAO,MAAM;;CAErC,OAAO,OAAO,SAAS,OAAO,MAAM;;CAEpC,OAAO,OAAO,IAAI,MAAM,OAAO,cAAc,CAAC,CAAC;;CAE/C,QAAQ,OAAO,SAAS,OAAO,MAAM;CACrC,SAAS,OAAO,SAAS,OAAO,MAAM;;CAEtC,SAAS,OAAO,SAAS,OAAO,MAAM;;;;;;;;;;CAUtC,OAAO,OAAO,SAAS,OAAO,MAAM;AACtC,CAAC,CAAC,CAAC,CAAC;AAEJ,IAAa,UAAb,cAA6B,OAAO,MAAe,wBAAwB,CAAC,CAAC;;CAE3E,UAAU,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;CAE3D,MAAM,OAAO;;CAEb,OAAO,OAAO;;;;;CAKd,QAAQ,OAAO;;CAEf,SAAS,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;CAE1D,SAAS,OAAO,MAAM,MAAM;AAC9B,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { Clock, Effect, Option } from "effect";
2
+ declare namespace Clock_d_exports {
3
+ export { Estimate, Mapping, Probe, estimate, mapping, monotonicMillis, supersedes, toBrowserSeconds, toHostTime, uncertaintyAt };
4
+ }
5
+ /** Read the captured owner's clock, including from native callbacks, without changing its origin. */
6
+ export declare const monotonicMillis: (clock: Clock.Clock) => number;
7
+ export interface Probe {
8
+ readonly hostStart: number;
9
+ readonly hostEnd: number;
10
+ readonly browserTime: number;
11
+ }
12
+ export interface Estimate {
13
+ /** Browser epoch milliseconds minus the owner's host monotonic milliseconds. */
14
+ readonly offsetMillis: number;
15
+ /** Either transport direction can own the entire round trip; symmetry is not assumed. */
16
+ readonly uncertaintyMillis: number;
17
+ readonly roundTripMillis: number;
18
+ readonly sampledAt: number;
19
+ }
20
+ /** The fastest complete probe limits uncertainty without mistaking transit delay for clock offset. */
21
+ export declare const estimate: (probes: ReadonlyArray<Probe>) => Option.Option<Estimate>;
22
+ /** An estimate's uncertainty at `hostTime`, wider the further that is from when it was sampled. */
23
+ export declare const uncertaintyAt: (estimate: Estimate, hostTime: number) => number;
24
+ /**
25
+ * The browser's one epoch mapping, shared by its pages, input runs and capture generations. It is
26
+ * measured on first need, by the first capture, never ahead of it.
27
+ */
28
+ export interface Mapping {
29
+ /** The latest estimate, without measuring: input uses it, and never waits for one. */
30
+ readonly latest: () => Estimate | undefined;
31
+ /** The latest estimate, measured through `measure` only while the browser has none. */
32
+ readonly current: <E>(measure: Effect.Effect<Estimate, E>) => Effect.Effect<Estimate, E>;
33
+ /**
34
+ * Measure again once ten seconds have passed since the latest measurement began. A failed
35
+ * measurement keeps the estimate, which keeps widening with its age.
36
+ */
37
+ readonly renew: <E>(measure: Effect.Effect<Estimate, E>) => Effect.Effect<void>;
38
+ }
39
+ /**
40
+ * Whether a new measurement should replace the current estimate. Each interval contains the true
41
+ * offset, so overlapping intervals agree and the narrower one is kept, the current one widened by
42
+ * its age: a probe delayed behind a busy page cannot widen every tab's stamps. A disjoint
43
+ * measurement means the clocks moved (a wall clock step, or drift between a remote browser and
44
+ * this host), so the newer evidence wins.
45
+ */
46
+ export declare const supersedes: (next: Estimate, current: Estimate) => boolean;
47
+ /**
48
+ * Every renderer of a browser reads the same host wall clock, so the offset belongs to the
49
+ * browser rather than a page. A busy page cannot fail work that an earlier estimate can serve.
50
+ */
51
+ export declare const mapping: (now: () => number) => Mapping;
52
+ export declare const toHostTime: (calibration: Estimate, browserEpochMillis: number) => number;
53
+ /** CDP input timestamps use seconds, unlike browser frame timestamps and the owner's clock. */
54
+ export declare const toBrowserSeconds: (calibration: Estimate, hostMillis: number) => number;
55
+ //#endregion
56
+ export { Clock_d_exports as t };
57
+ //# sourceMappingURL=Clock.d.mts.map
package/dist/Clock.mjs ADDED
@@ -0,0 +1,80 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.mjs";
2
+ import { Duration, Effect, Option, Semaphore } from "effect";
3
+ //#region src/Clock.ts
4
+ /**
5
+ * Host monotonic milliseconds and the browser's clock read on the owner's: estimates of their
6
+ * offset from timed probes, how an estimate ages, and the mapping a browser's pages share.
7
+ * `pictures.ts` takes the probes.
8
+ */
9
+ var Clock_exports = /* @__PURE__ */ __exportAll({
10
+ estimate: () => estimate,
11
+ mapping: () => mapping,
12
+ monotonicMillis: () => monotonicMillis,
13
+ supersedes: () => supersedes,
14
+ toBrowserSeconds: () => toBrowserSeconds,
15
+ toHostTime: () => toHostTime,
16
+ uncertaintyAt: () => uncertaintyAt
17
+ });
18
+ /** Read the captured owner's clock, including from native callbacks, without changing its origin. */
19
+ const monotonicMillis = (clock) => Number(clock.monotonicTimeNanosUnsafe()) / 1e6;
20
+ /** The fastest complete probe limits uncertainty without mistaking transit delay for clock offset. */
21
+ const estimate = (probes) => {
22
+ let best;
23
+ for (const probe of probes) {
24
+ const roundTripMillis = probe.hostEnd - probe.hostStart;
25
+ if (!Number.isFinite(probe.hostStart) || !Number.isFinite(probe.hostEnd) || !Number.isFinite(probe.browserTime) || !Number.isFinite(roundTripMillis) || roundTripMillis < 0) continue;
26
+ const sampledAt = probe.hostStart + roundTripMillis / 2;
27
+ const offsetMillis = probe.browserTime - sampledAt;
28
+ if (!Number.isFinite(offsetMillis) || !Number.isFinite(probe.browserTime - probe.hostStart) || !Number.isFinite(probe.browserTime - probe.hostEnd)) continue;
29
+ if (best === void 0 || roundTripMillis < best.roundTripMillis) best = {
30
+ offsetMillis,
31
+ uncertaintyMillis: roundTripMillis / 2,
32
+ roundTripMillis,
33
+ sampledAt
34
+ };
35
+ }
36
+ return Option.fromUndefinedOr(best);
37
+ };
38
+ const driftPerMillis = 1e-4;
39
+ /** An estimate's uncertainty at `hostTime`, wider the further that is from when it was sampled. */
40
+ const uncertaintyAt = (estimate, hostTime) => estimate.uncertaintyMillis + Math.abs(hostTime - estimate.sampledAt) * driftPerMillis;
41
+ const renewAfter = Duration.seconds(10);
42
+ /**
43
+ * Whether a new measurement should replace the current estimate. Each interval contains the true
44
+ * offset, so overlapping intervals agree and the narrower one is kept, the current one widened by
45
+ * its age: a probe delayed behind a busy page cannot widen every tab's stamps. A disjoint
46
+ * measurement means the clocks moved (a wall clock step, or drift between a remote browser and
47
+ * this host), so the newer evidence wins.
48
+ */
49
+ const supersedes = (next, current) => {
50
+ const aged = uncertaintyAt(current, next.sampledAt);
51
+ return next.uncertaintyMillis <= aged || Math.abs(next.offsetMillis - current.offsetMillis) > next.uncertaintyMillis + aged;
52
+ };
53
+ /**
54
+ * Every renderer of a browser reads the same host wall clock, so the offset belongs to the
55
+ * browser rather than a page. A busy page cannot fail work that an earlier estimate can serve.
56
+ */
57
+ const mapping = (now) => {
58
+ let latest;
59
+ let measuredAt = Number.NEGATIVE_INFINITY;
60
+ const lock = Semaphore.makeUnsafe(1);
61
+ const adopt = (measure) => {
62
+ measuredAt = now();
63
+ return measure.pipe(Effect.map((estimate) => {
64
+ if (latest === void 0 || supersedes(estimate, latest)) latest = estimate;
65
+ return latest;
66
+ }));
67
+ };
68
+ return {
69
+ latest: () => latest,
70
+ current: (measure) => Effect.suspend(() => latest === void 0 ? lock.withPermits(1)(Effect.suspend(() => latest === void 0 ? adopt(measure) : Effect.succeed(latest))) : Effect.succeed(latest)),
71
+ renew: (measure) => lock.withPermits(1)(Effect.suspend(() => latest === void 0 || now() - measuredAt < Duration.toMillis(renewAfter) ? Effect.void : Effect.ignore(adopt(measure))))
72
+ };
73
+ };
74
+ const toHostTime = (calibration, browserEpochMillis) => browserEpochMillis - calibration.offsetMillis;
75
+ /** CDP input timestamps use seconds, unlike browser frame timestamps and the owner's clock. */
76
+ const toBrowserSeconds = (calibration, hostMillis) => (hostMillis + calibration.offsetMillis) / 1e3;
77
+ //#endregion
78
+ export { estimate, mapping, monotonicMillis, supersedes, Clock_exports as t, toBrowserSeconds, toHostTime, uncertaintyAt };
79
+
80
+ //# sourceMappingURL=Clock.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Clock.mjs","names":[],"sources":["../src/Clock.ts"],"sourcesContent":["/**\n * Host monotonic milliseconds and the browser's clock read on the owner's: estimates of their\n * offset from timed probes, how an estimate ages, and the mapping a browser's pages share.\n * `pictures.ts` takes the probes.\n */\nimport { type Clock, Duration, Effect, Option, Semaphore } from \"effect\";\n\n/** Read the captured owner's clock, including from native callbacks, without changing its origin. */\nexport const monotonicMillis = (clock: Clock.Clock): number =>\n Number(clock.monotonicTimeNanosUnsafe()) / 1e6;\n\nexport interface Probe {\n readonly hostStart: number;\n readonly hostEnd: number;\n readonly browserTime: number;\n}\n\nexport interface Estimate {\n /** Browser epoch milliseconds minus the owner's host monotonic milliseconds. */\n readonly offsetMillis: number;\n /** Either transport direction can own the entire round trip; symmetry is not assumed. */\n readonly uncertaintyMillis: number;\n readonly roundTripMillis: number;\n readonly sampledAt: number;\n}\n\n/** The fastest complete probe limits uncertainty without mistaking transit delay for clock offset. */\nexport const estimate = (probes: ReadonlyArray<Probe>): Option.Option<Estimate> => {\n let best: Estimate | undefined;\n\n for (const probe of probes) {\n const roundTripMillis = probe.hostEnd - probe.hostStart;\n\n if (\n !Number.isFinite(probe.hostStart) ||\n !Number.isFinite(probe.hostEnd) ||\n !Number.isFinite(probe.browserTime) ||\n !Number.isFinite(roundTripMillis) ||\n roundTripMillis < 0\n )\n continue;\n const sampledAt = probe.hostStart + roundTripMillis / 2;\n const offsetMillis = probe.browserTime - sampledAt;\n\n if (\n !Number.isFinite(offsetMillis) ||\n !Number.isFinite(probe.browserTime - probe.hostStart) ||\n !Number.isFinite(probe.browserTime - probe.hostEnd)\n )\n continue;\n if (best === undefined || roundTripMillis < best.roundTripMillis)\n best = {\n offsetMillis,\n uncertaintyMillis: roundTripMillis / 2,\n roundTripMillis,\n sampledAt,\n };\n }\n\n return Option.fromUndefinedOr(best);\n};\n\n// Two machines' clocks drift apart by up to about 100 parts per million, so an estimate says this\n// much less about the offset for each millisecond of its age.\nconst driftPerMillis = 1e-4;\n\n/** An estimate's uncertainty at `hostTime`, wider the further that is from when it was sampled. */\nexport const uncertaintyAt = (estimate: Estimate, hostTime: number): number =>\n estimate.uncertaintyMillis + Math.abs(hostTime - estimate.sampledAt) * driftPerMillis;\n\n// Ten seconds widen an estimate by a millisecond, far less than a remote round trip, so it is\n// measured again no more often than this.\nconst renewAfter = Duration.seconds(10);\n\n/**\n * The browser's one epoch mapping, shared by its pages, input runs and capture generations. It is\n * measured on first need, by the first capture, never ahead of it.\n */\nexport interface Mapping {\n /** The latest estimate, without measuring: input uses it, and never waits for one. */\n readonly latest: () => Estimate | undefined;\n /** The latest estimate, measured through `measure` only while the browser has none. */\n readonly current: <E>(measure: Effect.Effect<Estimate, E>) => Effect.Effect<Estimate, E>;\n /**\n * Measure again once ten seconds have passed since the latest measurement began. A failed\n * measurement keeps the estimate, which keeps widening with its age.\n */\n readonly renew: <E>(measure: Effect.Effect<Estimate, E>) => Effect.Effect<void>;\n}\n\n/**\n * Whether a new measurement should replace the current estimate. Each interval contains the true\n * offset, so overlapping intervals agree and the narrower one is kept, the current one widened by\n * its age: a probe delayed behind a busy page cannot widen every tab's stamps. A disjoint\n * measurement means the clocks moved (a wall clock step, or drift between a remote browser and\n * this host), so the newer evidence wins.\n */\nexport const supersedes = (next: Estimate, current: Estimate): boolean => {\n const aged = uncertaintyAt(current, next.sampledAt);\n\n return (\n next.uncertaintyMillis <= aged ||\n Math.abs(next.offsetMillis - current.offsetMillis) > next.uncertaintyMillis + aged\n );\n};\n\n/**\n * Every renderer of a browser reads the same host wall clock, so the offset belongs to the\n * browser rather than a page. A busy page cannot fail work that an earlier estimate can serve.\n */\nexport const mapping = (now: () => number): Mapping => {\n let latest: Estimate | undefined;\n let measuredAt = Number.NEGATIVE_INFINITY;\n const lock = Semaphore.makeUnsafe(1);\n\n // Called where a measurement is decided, so no other can be decided before this one begins.\n const adopt = <E>(measure: Effect.Effect<Estimate, E>) => {\n measuredAt = now();\n\n return measure.pipe(\n Effect.map((estimate) => {\n if (latest === undefined || supersedes(estimate, latest)) latest = estimate;\n\n return latest;\n }),\n );\n };\n\n return {\n latest: () => latest,\n current: (measure) =>\n Effect.suspend(() =>\n latest === undefined\n ? lock.withPermits(1)(\n Effect.suspend(() =>\n latest === undefined ? adopt(measure) : Effect.succeed(latest),\n ),\n )\n : Effect.succeed(latest),\n ),\n renew: (measure) =>\n lock.withPermits(1)(\n Effect.suspend(() =>\n latest === undefined || now() - measuredAt < Duration.toMillis(renewAfter)\n ? Effect.void\n : Effect.ignore(adopt(measure)),\n ),\n ),\n };\n};\n\nexport const toHostTime = (calibration: Estimate, browserEpochMillis: number): number =>\n browserEpochMillis - calibration.offsetMillis;\n\n/** CDP input timestamps use seconds, unlike browser frame timestamps and the owner's clock. */\nexport const toBrowserSeconds = (calibration: Estimate, hostMillis: number): number =>\n (hostMillis + calibration.offsetMillis) / 1000;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAQA,MAAa,mBAAmB,UAC9B,OAAO,MAAM,yBAAyB,CAAC,IAAI;;AAkB7C,MAAa,YAAY,WAA0D;CACjF,IAAI;CAEJ,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,kBAAkB,MAAM,UAAU,MAAM;EAE9C,IACE,CAAC,OAAO,SAAS,MAAM,SAAS,KAChC,CAAC,OAAO,SAAS,MAAM,OAAO,KAC9B,CAAC,OAAO,SAAS,MAAM,WAAW,KAClC,CAAC,OAAO,SAAS,eAAe,KAChC,kBAAkB,GAElB;EACF,MAAM,YAAY,MAAM,YAAY,kBAAkB;EACtD,MAAM,eAAe,MAAM,cAAc;EAEzC,IACE,CAAC,OAAO,SAA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CAClC,CACF;CACJ;AACF;AAEA,MAAa,cAAc,aAAuB,uBAChD,qBAAqB,YAAY;;AAGnC,MAAa,oBAAoB,aAAuB,gBACrD,aAAa,YAAY,gBAAgB"}
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
  declare namespace Frame_d_exports {
3
- export { BrowserPaint, CaptureStats, Frame, Image, ScreencastOptions, Screenshot };
3
+ export { BrowserPaint, CaptureStats, Frame, Image, ScreencastOptions, Screenshot, sameCapture };
4
4
  }
5
5
  declare const Image_base: Schema.Class<Image, Schema.Struct<{
6
6
  readonly data: Schema.Uint8Array;
@@ -29,6 +29,11 @@ declare const Frame_base: Schema.Class<Frame, Schema.Struct<{
29
29
  readonly session: Schema.String;
30
30
  /** Owning Browser connection; document counters restart on adoption or reattachment. */
31
31
  readonly connection: Schema.String;
32
+ /** Native capture identity. Screenshots have no capture generation or sequence. */
33
+ readonly capture: Schema.optionalKey<Schema.Struct<{
34
+ readonly generation: Schema.Int;
35
+ readonly sequence: Schema.Int;
36
+ }>>;
32
37
  readonly data: Schema.Uint8Array;
33
38
  readonly timing: Schema.Union<readonly [typeof BrowserPaint, typeof Screenshot]>;
34
39
  readonly receivedAt: Schema.Finite;
@@ -53,6 +58,8 @@ declare class Frame extends Frame_base {
53
58
  get hostTime(): number;
54
59
  get image(): Image;
55
60
  }
61
+ /** Equal capture lineage survives an image copy; untagged pictures retain object identity only. */
62
+ declare const sameCapture: (frame: Frame, other: Frame | undefined) => boolean;
56
63
  declare const CaptureStats_base: Schema.Class<CaptureStats, Schema.Struct<{
57
64
  readonly received: Schema.Int;
58
65
  readonly accepted: Schema.Int;
@@ -113,5 +120,5 @@ interface ScreencastOptions {
113
120
  } | undefined;
114
121
  }
115
122
  //#endregion
116
- export { Image as a, Frame_d_exports as i, CaptureStats as n, ScreencastOptions as o, Frame as r, Screenshot as s, BrowserPaint as t };
117
- //# sourceMappingURL=Frame-DkNdjjjr.d.mts.map
123
+ export { Image as a, sameCapture as c, Frame_d_exports as i, CaptureStats as n, ScreencastOptions as o, Frame as r, Screenshot as s, BrowserPaint as t };
124
+ //# sourceMappingURL=Frame-UEH2hO5T.d.mts.map
package/dist/Frame.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- import { a as Image, n as CaptureStats, o as ScreencastOptions, r as Frame, s as Screenshot, t as BrowserPaint } from "./Frame-DkNdjjjr.mjs";
2
- export { BrowserPaint, CaptureStats, Frame, Image, ScreencastOptions, Screenshot };
1
+ import { a as Image, c as sameCapture, n as CaptureStats, o as ScreencastOptions, r as Frame, s as Screenshot, t as BrowserPaint } from "./Frame-UEH2hO5T.mjs";
2
+ export { BrowserPaint, CaptureStats, Frame, Image, ScreencastOptions, Screenshot, sameCapture };
package/dist/Frame.mjs CHANGED
@@ -11,7 +11,8 @@ var Frame_exports = /* @__PURE__ */ __exportAll({
11
11
  CaptureStats: () => CaptureStats,
12
12
  Frame: () => Frame,
13
13
  Image: () => Image,
14
- Screenshot: () => Screenshot
14
+ Screenshot: () => Screenshot,
15
+ sameCapture: () => sameCapture
15
16
  });
16
17
  /** An encoded picture with its pixel dimensions. Crops also need their viewport origin. */
17
18
  var Image = class extends Schema.Class("effect-browser/Image")({
@@ -44,6 +45,11 @@ var Frame = class extends Schema.Class("effect-browser/Frame")({
44
45
  session: Schema.String,
45
46
  /** Owning Browser connection; document counters restart on adoption or reattachment. */
46
47
  connection: Schema.String.check(Schema.isNonEmpty()),
48
+ /** Native capture identity. Screenshots have no capture generation or sequence. */
49
+ capture: Schema.optionalKey(Schema.Struct({
50
+ generation: Count,
51
+ sequence: Count
52
+ })),
47
53
  data: Schema.Uint8Array,
48
54
  timing: Schema.Union([BrowserPaint, Screenshot]),
49
55
  receivedAt: Schema.Finite,
@@ -73,6 +79,8 @@ var Frame = class extends Schema.Class("effect-browser/Frame")({
73
79
  });
74
80
  }
75
81
  };
82
+ /** Equal capture lineage survives an image copy; untagged pictures retain object identity only. */
83
+ const sameCapture = (frame, other) => other !== void 0 && (frame === other || frame.capture !== void 0 && frame.page === other.page && frame.session === other.session && frame.connection === other.connection && frame.document === other.document && frame.capture.generation === other.capture?.generation && frame.capture.sequence === other.capture?.sequence);
76
84
  /**
77
85
  * A page's capture counts, over its life or a window of the latest minute: what Chromium sent,
78
86
  * what readers got, and why the rest went no further. Frames that came late are counted apart from
@@ -118,6 +126,6 @@ var CaptureStats = class extends Schema.Class("effect-browser/CaptureStats")({
118
126
  })
119
127
  }) {};
120
128
  //#endregion
121
- export { BrowserPaint, CaptureStats, Frame, Image, Screenshot, Frame_exports as t };
129
+ export { BrowserPaint, CaptureStats, Frame, Image, Screenshot, sameCapture, Frame_exports as t };
122
130
 
123
131
  //# sourceMappingURL=Frame.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"Frame.mjs","names":[],"sources":["../src/Frame.ts"],"sourcesContent":["/**\n * Pictures of a page: screenshots, and screencast frames stamped with the browser's clock.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\n/** An encoded picture with its pixel dimensions. Crops also need their viewport origin. */\nexport class Image extends Schema.Class<Image>(\"effect-browser/Image\")({\n data: Schema.Uint8Array,\n mediaType: Schema.Literals([\"image/jpeg\", \"image/png\"]),\n width: Schema.Finite,\n height: Schema.Finite,\n}) {}\n\nconst Nonnegative = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));\nconst Count = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));\n\n/** Native CDP paint time mapped to the owning host clock, with transport uncertainty retained. */\nexport class BrowserPaint extends Schema.TaggedClass<BrowserPaint>()(\"BrowserPaint\", {\n timestamp: Schema.Finite,\n hostTime: Schema.Finite,\n uncertaintyMillis: Nonnegative,\n}) {}\n\n/** A screenshot's host capture interval; it has no native browser paint timestamp. */\nexport class Screenshot extends Schema.TaggedClass<Screenshot>()(\"Screenshot\", {\n hostTime: Schema.Finite,\n uncertaintyMillis: Nonnegative,\n}) {}\n\n/**\n * An image and its timing evidence. Paint time and screenshot capture time cannot be confused in\n * serialized data. `receivedAt` records delivery on the owning host's monotonic clock; it does\n * not make an old paint current.\n */\nexport class Frame extends Schema.Class<Frame>(\"effect-browser/Frame\")({\n page: Schema.String,\n /** The page's browser session: its provider's session id, as `Browser.Service.id` gives it. */\n session: Schema.String,\n /** Owning Browser connection; document counters restart on adoption or reattachment. */\n connection: Schema.String.check(Schema.isNonEmpty()),\n data: Schema.Uint8Array,\n timing: Schema.Union([BrowserPaint, Screenshot]),\n receivedAt: Schema.Finite,\n width: Schema.Finite,\n height: Schema.Finite,\n /**\n * The page's document committed before the frame arrived, as `Navigated` counts them. Just\n * after a commit a browser can still show the old document's paint, so a frame may show the\n * document before its own, never one after it.\n */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** The page's address when the frame arrived. */\n url: Schema.String,\n}) {\n get timestamp(): number | undefined {\n return this.timing._tag === \"BrowserPaint\" ? this.timing.timestamp : undefined;\n }\n\n get hostTime(): number {\n return this.timing.hostTime;\n }\n\n get image(): Image {\n return new Image({\n data: this.data,\n mediaType: \"image/jpeg\",\n width: this.width,\n height: this.height,\n });\n }\n}\n\n/**\n * A page's capture counts, over its life or a window of the latest minute: what Chromium sent,\n * what readers got, and why the rest went no further. Frames that came late are counted apart from\n * those a reader lost.\n */\nexport class CaptureStats extends Schema.Class<CaptureStats>(\"effect-browser/CaptureStats\")({\n received: Count,\n accepted: Count,\n /**\n * Frames Chromium finished encoding after a newer one, dropped rather than reordered. It encodes\n * several at once, so a busy machine makes more of them; none was a paint readers missed.\n */\n late: Count,\n missingTimestamp: Count,\n /**\n * Frames dropped for their size. Most are other captures' frames, which a clipped screenshot\n * draws into a screencast. The rest are the page's own frames of a new size, dropped while still\n * unconfirmed: when another size replaced it, when its capture stopped, or beyond the 16 held.\n */\n foreignSize: Count,\n /**\n * Frames discarded while native capture is paused for a library picture and its restoration.\n * A pause can produce no callbacks, so this count may remain zero even when pictures were taken.\n */\n duringPictures: Count,\n /**\n * Frames a reader missed by falling behind. Each reader counts its own, so with several readers\n * this can exceed the frames accepted.\n */\n lost: Count,\n /**\n * Acknowledgements of frames sent and not yet answered, now, whatever the window. Chromium sends\n * a frame only while few are unacknowledged, so a backlog means fewer frames.\n */\n ackBacklog: Count,\n /** Paint-time gaps between consecutive accepted frames. */\n gaps: Schema.Struct({\n count: Count,\n totalMillis: Nonnegative,\n minMillis: Schema.NullOr(Nonnegative),\n maxMillis: Schema.NullOr(Nonnegative),\n lastMillis: Schema.NullOr(Nonnegative),\n }),\n}) {}\n\n/**\n * Settings for a page's one native capture. Readers that join a running capture share its\n * settings: one without options accepts them, and one whose explicit options differ fails with\n * `InvalidRequest`.\n */\nexport interface ScreencastOptions {\n /** JPEG quality, 0 to 100. Defaults to 80. */\n readonly quality?: number | undefined;\n /** Frames are scaled down to fit this box. Defaults to the viewport in CSS pixels. */\n readonly size?: { readonly width: number; readonly height: number } | undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAQA,IAAa,QAAb,cAA2B,OAAO,MAAa,sBAAsB,CAAC,CAAC;CACrE,MAAM,OAAO;CACb,WAAW,OAAO,SAAS,CAAC,cAAc,WAAW,CAAC;CACtD,OAAO,OAAO;CACd,QAAQ,OAAO;AACjB,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAM,cAAc,OAAO,OAAO,MAAM,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,QAAQ,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;AAG/D,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAAC,gBAAgB;CACnF,WAAW,OAAO;CAClB,UAAU,OAAO;CACjB,mBAAmB;AACrB,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,aAAb,cAAgC,OAAO,YAAwB,CAAC,CAAC,cAAc;CAC7E,UAAU,OAAO;CACjB,mBAAmB;AACrB,CAAC,CAAC,CAAC,CAAC;;;;;;AAOJ,IAAa,QAAb,cAA2B,OAAO,MAAa,sBAAsB,CAAC,CAAC;CACrE,MAAM,OAAO;;CAEb,SAAS,OAAO;;CAEhB,YAAY,OAAO,OAAO,MAAM,OAAO,WAAW,CAAC;CACnD,MAAM,OAAO;CACb,QAAQ,OAAO,MAAM,CAAC,cAAc,UAAU,CAAC;CAC/C,YAAY,OAAO;CACnB,OAAO,OAAO;CACd,QAAQ,OAAO;;;;;;CAMf,UAAU,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;CAE3D,KAAK,OAAO;AACd,CAAC,CAAC,CAAC;CACD,IAAI,YAAgC;EAClC,OAAO,KAAK,OAAO,SAAS,iBAAiB,KAAK,OAAO,YAAY,KAAA;CACvE;CAEA,IAAI,WAAmB;EACrB,OAAO,KAAK,OAAO;CACrB;CAEA,IAAI,QAAe;EACjB,OAAO,IAAI,MAAM;GACf,MAAM,KAAK;GACX,WAAW;GACX,OAAO,KAAK;GACZ,QAAQ,KAAK;EACf,CAAC;CACH;AACF;;;;;;AAOA,IAAa,eAAb,cAAkC,OAAO,MAAoB,6BAA6B,CAAC,CAAC;CAC1F,UAAU;CACV,UAAU;;;;;CAKV,MAAM;CACN,kBAAkB;;;;;;CAMlB,aAAa;;;;;CAKb,gBAAgB;;;;;CAKhB,MAAM;;;;;CAKN,YAAY;;CAEZ,MAAM,OAAO,OAAO;EAClB,OAAO;EACP,aAAa;EACb,WAAW,OAAO,OAAO,WAAW;EACpC,WAAW,OAAO,OAAO,WAAW;EACpC,YAAY,OAAO,OAAO,WAAW;CACvC,CAAC;AACH,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"Frame.mjs","names":[],"sources":["../src/Frame.ts"],"sourcesContent":["/**\n * Pictures of a page: screenshots, and screencast frames stamped with the browser's clock.\n *\n * @since 0.3.0\n */\nimport { Schema } from \"effect\";\n\n/** An encoded picture with its pixel dimensions. Crops also need their viewport origin. */\nexport class Image extends Schema.Class<Image>(\"effect-browser/Image\")({\n data: Schema.Uint8Array,\n mediaType: Schema.Literals([\"image/jpeg\", \"image/png\"]),\n width: Schema.Finite,\n height: Schema.Finite,\n}) {}\n\nconst Nonnegative = Schema.Finite.check(Schema.isGreaterThanOrEqualTo(0));\nconst Count = Schema.Int.check(Schema.isGreaterThanOrEqualTo(0));\n\n/** Native CDP paint time mapped to the owning host clock, with transport uncertainty retained. */\nexport class BrowserPaint extends Schema.TaggedClass<BrowserPaint>()(\"BrowserPaint\", {\n timestamp: Schema.Finite,\n hostTime: Schema.Finite,\n uncertaintyMillis: Nonnegative,\n}) {}\n\n/** A screenshot's host capture interval; it has no native browser paint timestamp. */\nexport class Screenshot extends Schema.TaggedClass<Screenshot>()(\"Screenshot\", {\n hostTime: Schema.Finite,\n uncertaintyMillis: Nonnegative,\n}) {}\n\n/**\n * An image and its timing evidence. Paint time and screenshot capture time cannot be confused in\n * serialized data. `receivedAt` records delivery on the owning host's monotonic clock; it does\n * not make an old paint current.\n */\nexport class Frame extends Schema.Class<Frame>(\"effect-browser/Frame\")({\n page: Schema.String,\n /** The page's browser session: its provider's session id, as `Browser.Service.id` gives it. */\n session: Schema.String,\n /** Owning Browser connection; document counters restart on adoption or reattachment. */\n connection: Schema.String.check(Schema.isNonEmpty()),\n /** Native capture identity. Screenshots have no capture generation or sequence. */\n capture: Schema.optionalKey(Schema.Struct({ generation: Count, sequence: Count })),\n data: Schema.Uint8Array,\n timing: Schema.Union([BrowserPaint, Screenshot]),\n receivedAt: Schema.Finite,\n width: Schema.Finite,\n height: Schema.Finite,\n /**\n * The page's document committed before the frame arrived, as `Navigated` counts them. Just\n * after a commit a browser can still show the old document's paint, so a frame may show the\n * document before its own, never one after it.\n */\n document: Schema.Int.check(Schema.isGreaterThanOrEqualTo(0)),\n /** The page's address when the frame arrived. */\n url: Schema.String,\n}) {\n get timestamp(): number | undefined {\n return this.timing._tag === \"BrowserPaint\" ? this.timing.timestamp : undefined;\n }\n\n get hostTime(): number {\n return this.timing.hostTime;\n }\n\n get image(): Image {\n return new Image({\n data: this.data,\n mediaType: \"image/jpeg\",\n width: this.width,\n height: this.height,\n });\n }\n}\n\n/** Equal capture lineage survives an image copy; untagged pictures retain object identity only. */\nexport const sameCapture = (frame: Frame, other: Frame | undefined): boolean =>\n other !== undefined &&\n (frame === other ||\n (frame.capture !== undefined &&\n frame.page === other.page &&\n frame.session === other.session &&\n frame.connection === other.connection &&\n frame.document === other.document &&\n frame.capture.generation === other.capture?.generation &&\n frame.capture.sequence === other.capture?.sequence));\n\n/**\n * A page's capture counts, over its life or a window of the latest minute: what Chromium sent,\n * what readers got, and why the rest went no further. Frames that came late are counted apart from\n * those a reader lost.\n */\nexport class CaptureStats extends Schema.Class<CaptureStats>(\"effect-browser/CaptureStats\")({\n received: Count,\n accepted: Count,\n /**\n * Frames Chromium finished encoding after a newer one, dropped rather than reordered. It encodes\n * several at once, so a busy machine makes more of them; none was a paint readers missed.\n */\n late: Count,\n missingTimestamp: Count,\n /**\n * Frames dropped for their size. Most are other captures' frames, which a clipped screenshot\n * draws into a screencast. The rest are the page's own frames of a new size, dropped while still\n * unconfirmed: when another size replaced it, when its capture stopped, or beyond the 16 held.\n */\n foreignSize: Count,\n /**\n * Frames discarded while native capture is paused for a library picture and its restoration.\n * A pause can produce no callbacks, so this count may remain zero even when pictures were taken.\n */\n duringPictures: Count,\n /**\n * Frames a reader missed by falling behind. Each reader counts its own, so with several readers\n * this can exceed the frames accepted.\n */\n lost: Count,\n /**\n * Acknowledgements of frames sent and not yet answered, now, whatever the window. Chromium sends\n * a frame only while few are unacknowledged, so a backlog means fewer frames.\n */\n ackBacklog: Count,\n /** Paint-time gaps between consecutive accepted frames. */\n gaps: Schema.Struct({\n count: Count,\n totalMillis: Nonnegative,\n minMillis: Schema.NullOr(Nonnegative),\n maxMillis: Schema.NullOr(Nonnegative),\n lastMillis: Schema.NullOr(Nonnegative),\n }),\n}) {}\n\n/**\n * Settings for a page's one native capture. Readers that join a running capture share its\n * settings: one without options accepts them, and one whose explicit options differ fails with\n * `InvalidRequest`.\n */\nexport interface ScreencastOptions {\n /** JPEG quality, 0 to 100. Defaults to 80. */\n readonly quality?: number | undefined;\n /** Frames are scaled down to fit this box. Defaults to the viewport in CSS pixels. */\n readonly size?: { readonly width: number; readonly height: number } | undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAQA,IAAa,QAAb,cAA2B,OAAO,MAAa,sBAAsB,CAAC,CAAC;CACrE,MAAM,OAAO;CACb,WAAW,OAAO,SAAS,CAAC,cAAc,WAAW,CAAC;CACtD,OAAO,OAAO;CACd,QAAQ,OAAO;AACjB,CAAC,CAAC,CAAC,CAAC;AAEJ,MAAM,cAAc,OAAO,OAAO,MAAM,OAAO,uBAAuB,CAAC,CAAC;AACxE,MAAM,QAAQ,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;AAG/D,IAAa,eAAb,cAAkC,OAAO,YAA0B,CAAC,CAAC,gBAAgB;CACnF,WAAW,OAAO;CAClB,UAAU,OAAO;CACjB,mBAAmB;AACrB,CAAC,CAAC,CAAC,CAAC;;AAGJ,IAAa,aAAb,cAAgC,OAAO,YAAwB,CAAC,CAAC,cAAc;CAC7E,UAAU,OAAO;CACjB,mBAAmB;AACrB,CAAC,CAAC,CAAC,CAAC;;;;;;AAOJ,IAAa,QAAb,cAA2B,OAAO,MAAa,sBAAsB,CAAC,CAAC;CACrE,MAAM,OAAO;;CAEb,SAAS,OAAO;;CAEhB,YAAY,OAAO,OAAO,MAAM,OAAO,WAAW,CAAC;;CAEnD,SAAS,OAAO,YAAY,OAAO,OAAO;EAAE,YAAY;EAAO,UAAU;CAAM,CAAC,CAAC;CACjF,MAAM,OAAO;CACb,QAAQ,OAAO,MAAM,CAAC,cAAc,UAAU,CAAC;CAC/C,YAAY,OAAO;CACnB,OAAO,OAAO;CACd,QAAQ,OAAO;;;;;;CAMf,UAAU,OAAO,IAAI,MAAM,OAAO,uBAAuB,CAAC,CAAC;;CAE3D,KAAK,OAAO;AACd,CAAC,CAAC,CAAC;CACD,IAAI,YAAgC;EAClC,OAAO,KAAK,OAAO,SAAS,iBA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