@kaeawc/auto-mobile 0.0.91 → 0.0.92

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 (267) hide show
  1. package/dist/build-info.json +12 -12
  2. package/dist/schemas/README.md +16 -0
  3. package/dist/schemas/prototype-icon-names.json +302 -0
  4. package/dist/src/chunk-09442h7v.js +4 -0
  5. package/dist/src/chunk-0dfnyfkh.js +5 -0
  6. package/dist/src/chunk-0e4gm1kj.js +5 -0
  7. package/dist/src/chunk-0eb8576f.js +4 -0
  8. package/dist/src/chunk-0rjm4nx7.js +5 -0
  9. package/dist/src/chunk-0w1spptt.js +6 -0
  10. package/dist/src/chunk-1zmh2eak.js +4 -0
  11. package/dist/src/chunk-28k63ha3.js +5 -0
  12. package/dist/src/chunk-2d4wmp8b.js +4 -0
  13. package/dist/src/chunk-2e6s75qv.js +78 -0
  14. package/dist/src/chunk-2v7tw1nj.js +5 -0
  15. package/dist/src/chunk-32jpxz2y.js +323 -0
  16. package/dist/src/chunk-34zxqcmq.js +5 -0
  17. package/dist/src/chunk-3jmvqygr.js +238 -0
  18. package/dist/src/chunk-3swvfhqt.js +5 -0
  19. package/dist/src/chunk-44bt78m9.js +5 -0
  20. package/dist/src/chunk-488vt2bp.js +4 -0
  21. package/dist/src/chunk-4fgdhcwx.js +5 -0
  22. package/dist/src/chunk-4jp2se4w.js +4 -0
  23. package/dist/src/chunk-4pfftt07.js +5 -0
  24. package/dist/src/chunk-4vhr9e4t.js +4 -0
  25. package/dist/src/chunk-4xd6zs3y.js +15 -0
  26. package/dist/src/chunk-51567pg8.js +4 -0
  27. package/dist/src/chunk-5agqsfev.js +4 -0
  28. package/dist/src/chunk-5d706gmr.js +4 -0
  29. package/dist/src/chunk-5kd4rqk7.js +5 -0
  30. package/dist/src/chunk-5s645vr4.js +4 -0
  31. package/dist/src/chunk-61t538bm.js +4 -0
  32. package/dist/src/chunk-6d3mmqxt.js +54 -0
  33. package/dist/src/chunk-6hyt398x.js +5 -0
  34. package/dist/src/chunk-6mnr8kpm.js +4 -0
  35. package/dist/src/chunk-6pg7bqck.js +4 -0
  36. package/dist/src/chunk-79q5xsdc.js +42 -0
  37. package/dist/src/chunk-7bdgand3.js +4 -0
  38. package/dist/src/chunk-84cp9dw5.js +4 -0
  39. package/dist/src/chunk-86f2h5ww.js +5 -0
  40. package/dist/src/chunk-8cghfzb2.js +19 -0
  41. package/dist/src/chunk-8en08r7q.js +5 -0
  42. package/dist/src/chunk-950qcq1e.js +10 -0
  43. package/dist/src/chunk-9rkfyt6q.js +5 -0
  44. package/dist/src/chunk-9tf2p9y9.js +5 -0
  45. package/dist/src/chunk-9y5bcy28.js +6 -0
  46. package/dist/src/chunk-a2sc4jm0.js +5 -0
  47. package/dist/src/chunk-a4k9rt7z.js +5 -0
  48. package/dist/src/chunk-aa5ng3d1.js +4 -0
  49. package/dist/src/chunk-ajsrz473.js +5 -0
  50. package/dist/src/chunk-b3h0a6ca.js +4 -0
  51. package/dist/src/chunk-b4cxdzwy.js +20 -0
  52. package/dist/src/chunk-b6a737qt.js +4 -0
  53. package/dist/src/chunk-bn64x5z5.js +5 -0
  54. package/dist/src/chunk-bvh649za.js +12 -0
  55. package/dist/src/chunk-c9nk1r78.js +5 -0
  56. package/dist/src/chunk-c9tyfg4j.js +26 -0
  57. package/dist/src/chunk-cfsdfqnm.js +4 -0
  58. package/dist/src/chunk-cxyf04jc.js +7 -0
  59. package/dist/src/chunk-d57432wq.js +4 -0
  60. package/dist/src/chunk-da08tx5v.js +4 -0
  61. package/dist/src/chunk-eka89q3k.js +4 -0
  62. package/dist/src/chunk-f2tc08m2.js +4 -0
  63. package/dist/src/chunk-f8tnk179.js +5 -0
  64. package/dist/src/chunk-f9s1kkhx.js +5 -0
  65. package/dist/src/chunk-fbp8a4rx.js +4 -0
  66. package/dist/src/chunk-fd2z0sze.js +4 -0
  67. package/dist/src/chunk-fk927f4q.js +54 -0
  68. package/dist/src/chunk-fxmr3a0f.js +4 -0
  69. package/dist/src/chunk-gaqwhd44.js +4 -0
  70. package/dist/src/chunk-ggtd5x5a.js +5 -0
  71. package/dist/src/chunk-gndcfrm7.js +4 -0
  72. package/dist/src/chunk-h3n4adc6.js +310 -0
  73. package/dist/src/chunk-h5pjbb83.js +4 -0
  74. package/dist/src/chunk-hgnnh302.js +4 -0
  75. package/dist/src/chunk-hmke8nhx.js +5 -0
  76. package/dist/src/chunk-j2bx12hn.js +4 -0
  77. package/dist/src/chunk-j70y1a2g.js +4 -0
  78. package/dist/src/chunk-jdqvcq0a.js +5 -0
  79. package/dist/src/chunk-jhnbfj19.js +55 -0
  80. package/dist/src/chunk-js1jpyxp.js +6 -0
  81. package/dist/src/chunk-kbjq0qvb.js +4 -0
  82. package/dist/src/chunk-kfwx57xd.js +4 -0
  83. package/dist/src/chunk-km0dy5vc.js +71 -0
  84. package/dist/src/chunk-kzwctna2.js +4 -0
  85. package/dist/src/chunk-m9ehyehy.js +4 -0
  86. package/dist/src/chunk-mct91p1f.js +4 -0
  87. package/dist/src/chunk-mf9spd4g.js +5 -0
  88. package/dist/src/chunk-mgrcansb.js +4 -0
  89. package/dist/src/chunk-mqc1d0eb.js +6 -0
  90. package/dist/src/chunk-n1zmpk0z.js +4 -0
  91. package/dist/src/chunk-ncyjf63g.js +4 -0
  92. package/dist/src/chunk-nr64d21q.js +973 -0
  93. package/dist/src/chunk-nwm2pq5v.js +168 -0
  94. package/dist/src/chunk-pm06b05d.js +9 -0
  95. package/dist/src/chunk-q50s00ry.js +4 -0
  96. package/dist/src/chunk-qv2918jt.js +4 -0
  97. package/dist/src/chunk-qwye1958.js +14 -0
  98. package/dist/src/chunk-r0f1q783.js +5 -0
  99. package/dist/src/chunk-r14wwk37.js +18 -0
  100. package/dist/src/chunk-r20pe1nv.js +5 -0
  101. package/dist/src/chunk-r8z9pfve.js +5 -0
  102. package/dist/src/chunk-rdpgkjf6.js +4 -0
  103. package/dist/src/chunk-rkr0dks9.js +5 -0
  104. package/dist/src/chunk-rn84t3sf.js +11 -0
  105. package/dist/src/chunk-s123kn7n.js +4 -0
  106. package/dist/src/chunk-s1zq65ny.js +4 -0
  107. package/dist/src/chunk-s73qn3fx.js +4 -0
  108. package/dist/src/chunk-sjn0nj4p.js +5 -0
  109. package/dist/src/chunk-sns0c35v.js +7 -0
  110. package/dist/src/chunk-stfzjr9y.js +8 -0
  111. package/dist/src/chunk-sz1a7p43.js +4 -0
  112. package/dist/src/chunk-t4dr5c8v.js +8 -0
  113. package/dist/src/chunk-tc8k9c1j.js +4 -0
  114. package/dist/src/chunk-teznhase.js +4 -0
  115. package/dist/src/chunk-ty9xgmz4.js +4 -0
  116. package/dist/src/chunk-tyazf3sk.js +145 -0
  117. package/dist/src/chunk-v6npjrjm.js +5 -0
  118. package/dist/src/chunk-v90es00d.js +4 -0
  119. package/dist/src/chunk-vbvtzkwz.js +5 -0
  120. package/dist/src/chunk-vefd8qee.js +8 -0
  121. package/dist/src/chunk-vs9r72ta.js +17 -0
  122. package/dist/src/chunk-w2mwa0jk.js +4 -0
  123. package/dist/src/chunk-w7zsh13a.js +9 -0
  124. package/dist/src/chunk-w88k0bgr.js +4 -0
  125. package/dist/src/chunk-wry6skrm.js +4 -0
  126. package/dist/src/chunk-wzdt0enk.js +4 -0
  127. package/dist/src/chunk-xhhv854c.js +4 -0
  128. package/dist/src/chunk-y58270hd.js +4 -0
  129. package/dist/src/chunk-yk0hmbex.js +4 -0
  130. package/dist/src/chunk-ympy4fdz.js +28 -0
  131. package/dist/src/chunk-yw436axy.js +4 -0
  132. package/dist/src/chunk-z04jrpjy.js +5 -0
  133. package/dist/src/chunk-z2xznczw.js +4 -0
  134. package/dist/src/chunk-z4xnrgps.js +4 -0
  135. package/dist/src/chunk-z7csyszv.js +4 -0
  136. package/dist/src/chunk-z8t0v07j.js +11 -0
  137. package/dist/src/chunk-z916af47.js +228 -0
  138. package/dist/src/chunk-zcr8he8q.js +5 -0
  139. package/dist/src/chunk-zd9vmkzn.js +9 -0
  140. package/dist/src/chunk-zg67wjkh.js +5 -0
  141. package/dist/src/chunk-zj939v0h.js +5 -0
  142. package/dist/src/chunk-zkdjwtc1.js +4 -0
  143. package/dist/src/chunk-zkv5kzt6.js +4 -0
  144. package/dist/src/daemon/processEntry.js +4 -0
  145. package/dist/src/index.js +4 -2843
  146. package/dist/src/runtime/bunRuntimeGuard.js +4 -0
  147. package/dist/src/utils/workers/iosBundleExtractWorker.js +2 -3
  148. package/package.json +5 -5
  149. package/schemas/README.md +16 -0
  150. package/schemas/prototype-icon-names.json +302 -0
  151. package/node_modules/@borewit/text-codec/README.md +0 -87
  152. package/node_modules/@jimp/diff/node_modules/pixelmatch/README.md +0 -110
  153. package/node_modules/@jimp/diff/node_modules/pixelmatch/node_modules/pngjs/README.md +0 -433
  154. package/node_modules/@jimp/file-ops/dist/browser/index.js +0 -8
  155. package/node_modules/@jimp/js-png/README.md +0 -35
  156. package/node_modules/@jimp/js-png/src/__image_snapshots__/index-node-test-ts-png-should-use-png-options-1-snap.png +0 -0
  157. package/node_modules/@jimp/js-png/src/output.png +0 -0
  158. package/node_modules/@jimp/js-png/vitest.config.browser.mjs +0 -3
  159. package/node_modules/@jimp/plugin-resize/README.md +0 -12
  160. package/node_modules/@jimp/plugin-resize/vitest.config.browser.mjs +0 -3
  161. package/node_modules/@tokenizer/inflate/README.md +0 -114
  162. package/node_modules/@tokenizer/token/README.md +0 -19
  163. package/node_modules/await-to-js/README.md +0 -82
  164. package/node_modules/debug/README.md +0 -481
  165. package/node_modules/exif-parser/README.md +0 -83
  166. package/node_modules/file-type/readme.md +0 -667
  167. package/node_modules/ieee754/README.md +0 -51
  168. package/node_modules/mime/README.md +0 -178
  169. package/node_modules/ms/readme.md +0 -59
  170. package/node_modules/parse-bmfont-xml/README.md +0 -74
  171. package/node_modules/parse-bmfont-xml/lib/browser.js +0 -85
  172. package/node_modules/parse-bmfont-xml/node_modules/xml2js/README.md +0 -507
  173. package/node_modules/pngjs/README.md +0 -287
  174. package/node_modules/sax/README.md +0 -228
  175. package/node_modules/strtok3/README.md +0 -795
  176. package/node_modules/tinycolor2/README.md +0 -492
  177. package/node_modules/tinycolor2/cjs/test.js +0 -2191
  178. package/node_modules/tinycolor2/cjs/test_template.js +0 -26
  179. package/node_modules/tinycolor2/deno_asserts@0.168.0.mjs +0 -807
  180. package/node_modules/tinycolor2/esm/test.js +0 -2189
  181. package/node_modules/tinycolor2/esm/test_template.js +0 -24
  182. package/node_modules/tinycolor2/tinycolor.js +0 -1191
  183. package/node_modules/token-types/README.md +0 -160
  184. package/node_modules/uint8array-extras/readme.md +0 -318
  185. package/node_modules/xml-parse-from-string/README.md +0 -35
  186. package/node_modules/xmlbuilder/README.md +0 -86
  187. package/node_modules/zod/README.md +0 -208
  188. package/node_modules/zod/v4/locales/ar.d.cts +0 -4
  189. package/node_modules/zod/v4/locales/ar.d.ts +0 -4
  190. package/node_modules/zod/v4/locales/az.d.cts +0 -4
  191. package/node_modules/zod/v4/locales/az.d.ts +0 -4
  192. package/node_modules/zod/v4/locales/be.d.cts +0 -4
  193. package/node_modules/zod/v4/locales/be.d.ts +0 -4
  194. package/node_modules/zod/v4/locales/ca.d.cts +0 -4
  195. package/node_modules/zod/v4/locales/ca.d.ts +0 -4
  196. package/node_modules/zod/v4/locales/cs.d.cts +0 -4
  197. package/node_modules/zod/v4/locales/cs.d.ts +0 -4
  198. package/node_modules/zod/v4/locales/de.d.cts +0 -4
  199. package/node_modules/zod/v4/locales/de.d.ts +0 -4
  200. package/node_modules/zod/v4/locales/en.d.cts +0 -5
  201. package/node_modules/zod/v4/locales/en.d.ts +0 -5
  202. package/node_modules/zod/v4/locales/eo.d.cts +0 -5
  203. package/node_modules/zod/v4/locales/eo.d.ts +0 -5
  204. package/node_modules/zod/v4/locales/es.d.cts +0 -4
  205. package/node_modules/zod/v4/locales/es.d.ts +0 -4
  206. package/node_modules/zod/v4/locales/fa.d.cts +0 -4
  207. package/node_modules/zod/v4/locales/fa.d.ts +0 -4
  208. package/node_modules/zod/v4/locales/fi.d.cts +0 -4
  209. package/node_modules/zod/v4/locales/fi.d.ts +0 -4
  210. package/node_modules/zod/v4/locales/fr-CA.d.cts +0 -4
  211. package/node_modules/zod/v4/locales/fr-CA.d.ts +0 -4
  212. package/node_modules/zod/v4/locales/fr.d.cts +0 -4
  213. package/node_modules/zod/v4/locales/fr.d.ts +0 -4
  214. package/node_modules/zod/v4/locales/he.d.cts +0 -4
  215. package/node_modules/zod/v4/locales/he.d.ts +0 -4
  216. package/node_modules/zod/v4/locales/hu.d.cts +0 -4
  217. package/node_modules/zod/v4/locales/hu.d.ts +0 -4
  218. package/node_modules/zod/v4/locales/id.d.cts +0 -4
  219. package/node_modules/zod/v4/locales/id.d.ts +0 -4
  220. package/node_modules/zod/v4/locales/index.d.cts +0 -39
  221. package/node_modules/zod/v4/locales/index.d.ts +0 -39
  222. package/node_modules/zod/v4/locales/it.d.cts +0 -4
  223. package/node_modules/zod/v4/locales/it.d.ts +0 -4
  224. package/node_modules/zod/v4/locales/ja.d.cts +0 -4
  225. package/node_modules/zod/v4/locales/ja.d.ts +0 -4
  226. package/node_modules/zod/v4/locales/kh.d.cts +0 -4
  227. package/node_modules/zod/v4/locales/kh.d.ts +0 -4
  228. package/node_modules/zod/v4/locales/ko.d.cts +0 -4
  229. package/node_modules/zod/v4/locales/ko.d.ts +0 -4
  230. package/node_modules/zod/v4/locales/mk.d.cts +0 -4
  231. package/node_modules/zod/v4/locales/mk.d.ts +0 -4
  232. package/node_modules/zod/v4/locales/ms.d.cts +0 -4
  233. package/node_modules/zod/v4/locales/ms.d.ts +0 -4
  234. package/node_modules/zod/v4/locales/nl.d.cts +0 -4
  235. package/node_modules/zod/v4/locales/nl.d.ts +0 -4
  236. package/node_modules/zod/v4/locales/no.d.cts +0 -4
  237. package/node_modules/zod/v4/locales/no.d.ts +0 -4
  238. package/node_modules/zod/v4/locales/ota.d.cts +0 -4
  239. package/node_modules/zod/v4/locales/ota.d.ts +0 -4
  240. package/node_modules/zod/v4/locales/pl.d.cts +0 -4
  241. package/node_modules/zod/v4/locales/pl.d.ts +0 -4
  242. package/node_modules/zod/v4/locales/ps.d.cts +0 -4
  243. package/node_modules/zod/v4/locales/ps.d.ts +0 -4
  244. package/node_modules/zod/v4/locales/pt.d.cts +0 -4
  245. package/node_modules/zod/v4/locales/pt.d.ts +0 -4
  246. package/node_modules/zod/v4/locales/ru.d.cts +0 -4
  247. package/node_modules/zod/v4/locales/ru.d.ts +0 -4
  248. package/node_modules/zod/v4/locales/sl.d.cts +0 -4
  249. package/node_modules/zod/v4/locales/sl.d.ts +0 -4
  250. package/node_modules/zod/v4/locales/sv.d.cts +0 -4
  251. package/node_modules/zod/v4/locales/sv.d.ts +0 -4
  252. package/node_modules/zod/v4/locales/ta.d.cts +0 -4
  253. package/node_modules/zod/v4/locales/ta.d.ts +0 -4
  254. package/node_modules/zod/v4/locales/th.d.cts +0 -4
  255. package/node_modules/zod/v4/locales/th.d.ts +0 -4
  256. package/node_modules/zod/v4/locales/tr.d.cts +0 -5
  257. package/node_modules/zod/v4/locales/tr.d.ts +0 -5
  258. package/node_modules/zod/v4/locales/ua.d.cts +0 -4
  259. package/node_modules/zod/v4/locales/ua.d.ts +0 -4
  260. package/node_modules/zod/v4/locales/ur.d.cts +0 -4
  261. package/node_modules/zod/v4/locales/ur.d.ts +0 -4
  262. package/node_modules/zod/v4/locales/vi.d.cts +0 -4
  263. package/node_modules/zod/v4/locales/vi.d.ts +0 -4
  264. package/node_modules/zod/v4/locales/zh-CN.d.cts +0 -4
  265. package/node_modules/zod/v4/locales/zh-CN.d.ts +0 -4
  266. package/node_modules/zod/v4/locales/zh-TW.d.cts +0 -4
  267. package/node_modules/zod/v4/locales/zh-TW.d.ts +0 -4
@@ -0,0 +1,8 @@
1
+ // @bun
2
+ import{i,l,e}from"./chunk-z8t0v07j.js";import{Yd}from"./chunk-6d3mmqxt.js";import{w,v,rt,Na,k}from"./chunk-h3n4adc6.js";import{L}from"./chunk-32jpxz2y.js";import{an,kn}from"./chunk-ggtd5x5a.js";import{Lc}from"./chunk-pm06b05d.js";import{gS}from"./chunk-jhnbfj19.js";import{vK}from"./chunk-r20pe1nv.js";import{Rf,xp}from"./chunk-qwye1958.js";import{Pa,kh}from"./chunk-sns0c35v.js";import{r,t,u}from"./chunk-9rkfyt6q.js";var MU=2,gE=100,mf=200,oP=1,yE=5000,yK=3000,ff=20000,Qe=50;function RJ(n,o,s){let a=[];for(let[d,c]of n.points.entries()){let p=Lc({x:c.x,y:c.y,coordinateSpace:n.coordinateSpace},o,s,"dragPath");if("error"in p)return{error:`points[${d}]: ${p.error}`};a.push({x:p.x,y:p.y})}return{points:a}}function PJ(n,o){if(n.length<MU)throw new t(`dragPath needs at least ${MU} points`);let s=o.holdMs??0,a=o.releaseHoldMs??0,d=[],c=0;for(let p=1;p<n.length;p++){let h=n[p-1],m=n[p],f=o.points[p]?.durationMs??mf,y=Math.max(1,Math.ceil(f/Qe));for(let S=1;S<=y;S++){let g=S/y;d.push({atMs:c+Math.round(f*g),x:S===y?m.x:Math.round(h.x+(m.x-h.x)*g),y:S===y?m.y:Math.round(h.y+(m.y-h.y)*g)})}c+=f}return{start:n[0],holdMs:s,moves:d,releaseHoldMs:a,totalMs:s+c+a,vertices:n}}function AJ(n){let o=[{x:n.start.x,y:n.start.y,offsetMs:0}];if(n.holdMs>0)o.push({x:n.start.x,y:n.start.y,offsetMs:n.holdMs});for(let a of n.moves)o.push({x:a.x,y:a.y,offsetMs:n.holdMs+a.atMs});let s=o[o.length-1];if(n.releaseHoldMs>0)o.push({x:s.x,y:s.y,offsetMs:s.offsetMs+n.releaseHoldMs});return o}function WO(n,o,s=0){if(n>ff)throw new t(`dragPath total duration ${n} ms exceeds the ${ff} ms limit; shorten the segments or holds. No input was sent.`);if(o===void 0)return;let a=n+s+Na;if(a>o)throw new t(`dragPath duration ${n} ms does not fit the remaining request budget (${o} ms; needs ${a} ms including dispatch headroom); no input was sent. Increase the request timeout or shorten the path.`)}function C(n){if(n.toolType!=="stylus"&&n.toolType!=="eraser")return;let o={toolType:n.toolType};if(n.pressure?.normalized)o.pressure=Math.round(n.pressure.mean*1e4)/1e4;if(n.tilt!==void 0)o.tilt=n.tilt;if(n.buttons?.length)o.buttons=n.buttons.map((s)=>s==="stylusPrimary"?"primary":"secondary");return o}var x={TOUCH_SLOP_DP:8,STROKE_PRESSURE_RANGE:0.05,PEN_MAX_SAMPLES:100,LONG_PRESS_MS:400,TAP_TIMEOUT_MS:100,DOUBLE_TAP_MS:300,DOUBLE_TAP_SLOP_DP:100,FLING_MIN_DP_PER_S:50,PINCH_MIN_SCALE_DELTA:0.1};function T(n){return Boolean(n.unknownAxes?.length)}function et(n,o){return n.type==="tap"&&n.toolType===o.toolType&&!T(n)&&n.screenX!==void 0&&n.screenY!==void 0}function ye(n,o){if(!et(n,o))return!1;let s=o.arrivedAt-n.arrivedAt,a=s>=0&&s<=x.DOUBLE_TAP_MS;if(o.firstTapArrivedAt!==void 0)return n.arrivedAt===o.firstTapArrivedAt&&a;let d=(o.screenX??1/0)-(n.screenX??1/0),c=(o.screenY??1/0)-(n.screenY??1/0);return a&&Math.hypot(d,c)<=x.DOUBLE_TAP_SLOP_DP}function ge(n,o){return n.kernelAtMs!==void 0&&o.kernelAtMs!==void 0?n.kernelAtMs-o.kernelAtMs:n.arrivedAt-o.arrivedAt}function X(n){let o=n.type==="stroke"?n.path:n.hover;if(n.type!=="stroke"&&n.type!=="hover"||n.toolType!=="stylus"||T(n)||!o||o.length<2)return!1;return o.reduce((a,d,c)=>a+(c>0?ge(d,o[c-1]):0),0)>ff}function ve(n){let o=n.type==="stroke"?n.path:n.hover;if(n.toolType!=="stylus"||T(n)||!o?.length||n.type==="stroke"&&o.length<2||X(n))return null;let s=it(o);return{tool:n.type==="stroke"?"dragPath":"hoverAt",params:{points:s,...n.type==="hover"?{toolType:"stylus"}:{pointer:C(n)}}}}function tt(n,o,s){let a=Math.ceil(s/yE);return Array.from({length:a},(d,c)=>{let p=(c+1)/a,h={...o,x:n.x+(o.x-n.x)*p,y:n.y+(o.y-n.y)*p,durationMs:Math.round(s*p)-Math.round(s*c/a)};for(let m of["pressure","distance"])if(n[m]!==void 0&&o[m]!==void 0)h[m]=n[m]+(o[m]-n[m])*p;return c===a-1?{...o,durationMs:h.durationMs}:h})}function nt(n){while(n.length>gE){let o=(p)=>p.pressure??p.distance??0,s=n.reduce((p,h,m)=>o(h)<o(n[p])?m:p,0),a=n.reduce((p,h,m)=>o(h)>o(n[p])?m:p,0),d=1/0,c=1;for(let p=1;p<n.length-1;p++){let h=n[p].durationMs+n[p+1].durationMs;if(p!==s&&p!==a&&h<d)d=h,c=p}n[c+1].durationMs=d,n.splice(c,1)}}function it(n){let o=[],s=0,a=0;for(let[d,c]of n.entries()){let{arrivedAt:p,kernelAtMs:h,...m}=c;if(d===0){o.push(m);continue}s+=Math.max(0,ge({arrivedAt:p,kernelAtMs:h},n[d-1]));let f=Math.round(s),y=f-a;if(y<oP){if(d!==n.length-1)continue;if(o.length===1)o.push({...m,durationMs:oP});else o[o.length-1]={...m,durationMs:o.at(-1).durationMs};continue}o.push(...tt(o.at(-1),m,y)),a=f}return nt(o),o}var ot="a pen gesture made with the eraser end was exported as an eraser step; replay injects an eraser only on a root adb shell with a uinput tool and refuses that step elsewhere",st="a pen gesture without a known position or path was not exported: replaying it as a finger would be wrong",at=`a stylus stroke was not exported because its duration exceeds the ${ff/1000} second replay limit; record a shorter stroke`,ut=`a stylus hover was not exported because its duration exceeds the ${ff/1000} second replay limit; record a shorter hover`,lt="a pen hovered over the screen without touching it; no known position or hover distance was recorded, so nothing was exported for it",dt="a stylus double tap was exported, but replay refuses stylus double taps, so that step will fail when run";function ct(n,o){if(n.toolType===void 0)return;if(n.type==="hover")return o?void 0:X(n)?ut:lt;if(!o)return X(n)?at:st;if(o.params.pointer!==void 0&&o.params.action==="doubleTap")return dt;return n.toolType==="eraser"?ot:void 0}function K(n,o,s){let a=ct(o,s);if(a)n.add(a)}var Te=0,xe=1,Ae=24,we=26,Pe=27,Ee=53,Me=54,Re=58;function Q(n){let o=/^(add|remove) device \d+:\s+(\/dev\/input\/event\d+)\s*$/.exec(n);return o?{action:o[1]==="add"?"add":"remove",path:o[2]}:null}async function Ie(n){let{stdout:o}=await n.executeCommand("shell getevent -p"),s=ee(o);if(s.touch===null&&s.pen.length===0)e.warn("[InputNodeDiscovery] No multitouch or pen input device found");return s}function ee(n){let o=pt(n);return{touch:o.find((s)=>s.kind==="touch")??null,pen:o.filter((s)=>s.kind==="pen")}}function pt(n){let o=[];for(let s of gt(n)){let a=s.abs.get(Ee),d=s.abs.get(Me);if(a&&d){o.push(Se(s,a,d,{pressure:s.abs.get(Re),kind:"touch"}));continue}let c=s.abs.get(Te),p=s.abs.get(xe);if(c&&p&&s.hasPenTool)o.push(Se(s,c,p,{pressure:s.abs.get(Ae),kind:"pen"}))}return o}function Se(n,o,s,{pressure:a,kind:d}){let c=n.abs.get(d==="pen"?25:59),p=n.abs.get(we),h=n.abs.get(Pe);return{path:n.path,name:n.name,axisXMin:o.min,axisXMax:o.max,axisYMin:s.min,axisYMax:s.max,kind:d,...c&&c.max>c.min?{distanceRange:c}:{},...p&&h?{tiltAxes:{x:p,y:h}}:{},...a&&a.max>a.min?{pressureMin:a.min,pressureMax:a.max}:{}}}var be=/\b(?:BTN_TOOL_PEN|BTN_TOOL_RUBBER|0140|0141)\b/,ht={ABS_X:Te,ABS_Y:xe,ABS_PRESSURE:Ae,ABS_DISTANCE:25,ABS_MT_DISTANCE:59,ABS_TILT_X:we,ABS_TILT_Y:Pe,ABS_MT_POSITION_X:Ee,ABS_MT_POSITION_Y:Me,ABS_MT_PRESSURE:Re},mt=/^\s*(?:ABS\s*\(0003\):\s*)?(?:(ABS_\w+)(?:\s+\(([0-9a-f]{4})\))?|([0-9a-f]{4}))\s*:\s+value\s+-?\d+,\s*min\s+(-?\d+),\s*max\s+(-?\d+)/,ft=/^\s+(\w+)\s*\([0-9a-f]{4}\):(.*)$/;function yt(n){let o=n[2]??n[3];return o?parseInt(o,16):ht[n[1]]}function gt(n){let o=[],s=null,a={inKeyBlock:!1};for(let d of n.split(`
3
+ `)){let c=Q(d);if(c?.action==="add"){let{path:p}=c;s={path:p,name:p,abs:new Map,hasPenTool:!1},o.push(s),a.inKeyBlock=!1}else if(s)vt(s,d,a)}return o}function vt(n,o,s){let a=o.match(/^\s+name:\s+"(.+)"/);if(a){n.name=a[1],s.inKeyBlock=!1;return}let d=o.match(mt);if(d){let h=yt(d);if(h!==void 0)n.abs.set(h,St(d,o));s.inKeyBlock=!1;return}let c=o.match(ft);if(c){if(s.inKeyBlock=c[1]==="KEY"||c[1]==="EV_KEY",s.inKeyBlock&&be.test(c[2]))n.hasPenTool=!0;return}let p=/^\s+[\w ]+$/.test(o);if(s.inKeyBlock&&p&&be.test(o))n.hasPenTool=!0;else if(!p)s.inKeyBlock=!1}function St(n,o){let s=o.match(/,\s*resolution\s+(\d+)/);return{min:parseInt(n[4],10),max:parseInt(n[5],10),...s?{resolution:parseInt(s[1],10)}:{}}}function _e(n){let o=(d,c)=>Math.min(Math.max(d,0),Math.max(c-1,0)),s=(d,c)=>o(Math.round((c?n.xMax-d:d-n.xMin)/(n.xMax-n.xMin+1)*n.displayWidth),n.displayWidth),a=(d,c)=>o(Math.round((c?n.yMax-d:d-n.yMin)/(n.yMax-n.yMin+1)*n.displayHeight),n.displayHeight);return{toScreenPoint(d,c){switch(n.rotation){case 1:return{x:a(c,!1),y:s(d,!0)};case 2:return{x:s(d,!0),y:a(c,!0)};case 3:return{x:a(c,!0),y:s(d,!1)};default:return{x:s(d,!1),y:a(c,!1)}}}}}async function W(n,o={}){let{stdout:s}=o.timeoutMs===void 0?await n.executeCommand("shell wm size"):await n.executeCommand("shell wm size",{timeoutMs:o.timeoutMs,noRetry:!0}),a=s.match(/Physical size:\s*(\d+)x(\d+)/);if(!a)throw Error(`Could not parse display size from wm size output: ${s}`);return{width:parseInt(a[1],10),height:parseInt(a[2],10)}}async function Ge(n){try{let{stdout:o}=await n.executeCommand("shell wm density"),s=o.match(/Physical density:\s*(\d+)/);if(s)return parseInt(s[1],10)/160}catch(o){e.warn(`[AxisRanges] Failed to query density; using 440 dpi: ${r(o)}`,o)}return 2.75}var te=500,re="display rotation could not be read; touch coordinates and swipe directions may be mapped with the wrong rotation",bt="display size could not be read after a display change; touch coordinates may be scaled with the wrong size";function Tt(n,o){return`display size changed from ${n.width}x${n.height} to ${o.width}x${o.height} (fold/unfold?); touches are still read from the touch node chosen when recording started, so coordinates may refer to a different panel`}class z{axes;entries;changeReports=[];baselineDisplay;followers=[];constructor(n,o,s,a=[]){this.axes=n;this.baselineDisplay=o.display,this.entries=[this.entry(o,s,a)]}scalerAt(n){return this.entryAt(n).scaler}geometryAt(n){let{rotation:o,display:s}=this.entryAt(n),a=o%2!==0;return{deviceWidth:a?s.height:s.width,deviceHeight:a?s.width:s.height,orientation:o}}get currentRotation(){return this.entries[this.entries.length-1].rotation}get lastKnownGoodAt(){for(let n=this.entries.length-1;n>=0;n--)if(this.entries[n].caveats.length===0)return this.entries[n].reportedAt;return this.entries[0].reportedAt}noteChangeReported(n){this.changeReports.push(n);for(let o of this.followers)o.noteChangeReported(n)}follow(n){return n.entries.splice(0,n.entries.length,...this.entries.map((o)=>n.entry(o,o.reportedAt,o.caveats))),n.changeReports.splice(0,n.changeReports.length,...this.changeReports),this.followers.push(n),()=>{let o=this.followers.indexOf(n);if(o!==-1)this.followers.splice(o,1)}}apply(n,o){for(let c of this.followers)c.apply(n,o);let s=this.entries[this.entries.length-1],a=[];if(n.rotation===null)a.push(re);if(n.display===null)a.push(bt);let d={rotation:n.rotation??s.rotation,display:n.display??s.display};if(d.display.width!==this.baselineDisplay.width||d.display.height!==this.baselineDisplay.height)a.push(Tt(this.baselineDisplay,d.display));this.entries.push(this.entry(d,Math.max(o,s.reportedAt),a))}warningsFor(n,o){let s=new Set(this.entryAt(n).caveats);if(this.changeReports.some((d)=>d>n&&d<=o))s.add("gesture spans a display rotation/size change; its coordinates and direction mix two geometries");else if(this.changeReports.some((d)=>d>=n-te&&d<=o+te))s.add(`display rotation/size changed within ${te} ms of this gesture; its coordinates or direction may use a stale rotation`);return[...s]}entryAt(n){let o=this.entries[0];for(let s of this.entries){if(s.reportedAt>n)break;o=s}return o}entry(n,o,s){return{...n,reportedAt:o,caveats:s,scaler:_e({...this.axes,displayWidth:n.display.width,displayHeight:n.display.height,rotation:n.rotation})}}}function De(n,o,s,{startedAt:a,caveats:d}){return o.map((c)=>{let p=new z({xMin:c.axisXMin,xMax:c.axisXMax,yMin:c.axisYMin,yMax:c.axisYMax},s,a,d),h=n.follow(p);return{node:c,scaler:p,stopFollowing:h}})}var xt=0,Ne=1000;function Oe(n){return{readRotation:()=>Yd(n,{timeoutMs:Ne}),readPhysicalSize:()=>W(n,{timeoutMs:Ne})}}function ke(n){return n!==void 0&&Number.isInteger(n)&&n>=0&&n<=3}class ne{timeline;probe;timer;refreshChain=Promise.resolve();generation=0;disposed=!1;constructor(n,o,s){this.timeline=n;this.probe=o;this.timer=s}dispose(){this.disposed=!0,this.refreshChain=Promise.resolve()}handleTransition(n){if(this.disposed||n.displayId!==xt||n.change==="removed")return;let o=this.timer.now(),s=++this.generation;if(this.timeline.noteChangeReported(o),ke(n.rotation))this.timeline.apply({rotation:n.rotation},o);let a=ke(n.rotation);this.refreshChain=this.refreshChain.then(()=>this.refresh(o,a,s))}async settle(){let n;do n=this.refreshChain,await n;while(n!==this.refreshChain)}async verifyAtStop(){if(this.disposed)return;let n=await this.probe.readRotation().then(void 0,(s)=>{if(!this.disposed)throw s;return e.debug("[DisplayGeometryTracker] Cancelled stop-time geometry read failed",s),null});if(this.disposed)return;if(n===null)throw Error("WindowManager did not report a display rotation at stop");let o=this.timeline.currentRotation;if(n!==o)return`display rotation at stop (${n}) differs from the rotation tracked during recording (${o}); a rotation was not reported, so tapAt and swipeOn steps after it may be recorded at the wrong coordinates or direction`;return}async refresh(n,o,s){if(this.disposed||s!==this.generation)return;let a=o?void 0:await this.readRotationOrNull();if(this.disposed)return;let d=await this.readSizeOrNull();if(this.disposed||s!==this.generation)return;this.timeline.apply({rotation:a,display:d},n)}async readRotationOrNull(){try{return await this.probe.readRotation()}catch(n){return e.warn(`[DisplayGeometryTracker] Failed to read rotation after a display change: ${r(n)}`,n),null}}async readSizeOrNull(){try{return await this.probe.readPhysicalSize()}catch(n){return e.warn(`[DisplayGeometryTracker] Failed to read display size after a display change: ${r(n)}`,n),null}}}var Ce=(n,o,s)=>({type:"hover",arrivedAt:o,toolType:n,...s.samples.length?{hover:s.samples}:{}});class ie{nodeEpisode;slotEpisodes=new Map;penEntered(){this.nodeEpisode??={touched:!1,samples:[]}}penTouched(){this.nodeEpisode??={touched:!1,samples:[]},this.nodeEpisode.touched=!0}penLeft(n,o){let s=this.nodeEpisode;return this.nodeEpisode=void 0,s&&!s.touched?Ce(n,o,s):null}slotHovering(n,o,s,a){if(!this.slotEpisodes.has(n))this.slotEpisodes.set(n,{touched:!1,samples:[]});this.sample(this.slotEpisodes.get(n),o,s,a)}penHovering(n,o,s){if(this.nodeEpisode)this.sample(this.nodeEpisode,n,o,s)}sample(n,o,s,a){if(n.touched||!Number.isFinite(o.x)||!Number.isFinite(o.y)||o.distance===void 0||!Number.isFinite(o.distance))return;if(n.samples.length>=x.PEN_MAX_SAMPLES)n.samples=n.samples.filter((d,c)=>c===0||c%2===1);n.samples.push({x:o.x,y:o.y,distance:o.distance,arrivedAt:s,...a===void 0?{}:{kernelAtMs:a}})}slotTouching(n){this.slotEpisodes.set(n,{touched:!0,samples:[]})}slotReleased(n,o,s){let a=this.slotEpisodes.get(n);return this.slotEpisodes.delete(n),a&&!a.touched&&o?Ce(o,s,a):null}}var At={KEY_BACK:"back",KEY_HOME:"home",KEY_MENU:"menu",KEY_POWER:"power",KEY_VOLUMEUP:"volume_up",KEY_VOLUMEDOWN:"volume_down",KEY_APPSELECT:"recent"};class oe{options;slots=new Map;currentSlot=0;penPaths=new Map;releasedSlots=new Set;touchingSlots=new Set;lastEmitted=new Map;nodeTool;heldButtons=new Set;hover=new ie;kernelAtMs=0;constructor(n={}){this.options=n}emitHover(n){if(n)this.options.onHover?.(n)}feedLine(n,o){let s=n.match(/^\[\s*(\d+(?:\.\d+)?)\]\s+(\S+)\s+(\S+)\s+(\S+)\s*$/);if(!s)return null;this.kernelAtMs=Number(s[1])*1000;let a=s[2],d=s[3],c=s[4];if(a==="EV_ABS")return this.handleAbsEvent(d,c,o);if(a==="EV_SYN")return this.handleSynEvent(d,c,o);if(a==="EV_KEY"){let p=c==="DOWN"?At[d]:void 0;if(p)return{type:"pressButton",arrivedAt:o,button:p};this.handleKeyEvent(d,c==="DOWN"||c==="REPEAT",o)}return null}handleAbsEvent(n,o,s){let a=parseInt(o,16);switch(n){case"ABS_MT_SLOT":this.currentSlot=a;break;case"ABS_MT_TRACKING_ID":if(o==="ffffffff")this.releaseCurrentSlot(s);else{let d=this.getOrCreateSlot();if(d.trackingId>=0&&d.trackingId!==a){let c=this.endedByReplacement(d,s);return this.emitHover(this.hover.slotReleased(d.slotId,this.withPenState({...d}).toolType,s)),d.trackingId=a,c}d.trackingId=a}break;case"ABS_MT_POSITION_X":this.observeAxis("x",a);break;case"ABS_MT_POSITION_Y":this.observeAxis("y",a);break;case"ABS_MT_PRESSURE":this.getOrCreateSlot().pressure=a;break;default:this.handlePenAbsEvent(n,a);break}return null}releaseCurrentSlot(n){let o=this.slots.get(this.currentSlot);if(!o)return;if(o.trackingId>=0)this.releasedSlots.add(o.slotId),o.trackingId=-1;this.emitHover(this.hover.slotReleased(o.slotId,this.withPenState({...o}).toolType,n))}observePenSlot(n,o){if(this.options.singleTouch||n.toolType===void 0||n.trackingId<0)return;if(this.isMtPenHovering(n))this.hover.slotHovering(n.slotId,n,o,this.kernelAtMs);else this.hover.slotTouching(n.slotId)}endedByReplacement(n,o){let s=[];for(let[,a]of this.slots)if(a.slotId!==n.slotId&&a.trackingId>=0&&!this.isMtPenHovering(a)){let d=this.withPenState({...a});if(d.toolType)d.path=this.samplePen(d,o);s.push(d)}return this.releasedSlots.delete(n.slotId),this.touchingSlots.delete(n.slotId),this.lastEmitted.delete(n.slotId),this.penPaths.delete(n.slotId),{arrivedAt:o,activeSlots:s,releasedSlots:[n.slotId]}}handlePenAbsEvent(n,o){switch(n){case"ABS_MT_TOOL_TYPE":if(o===1)this.getOrCreateSlot().toolType="stylus";else delete this.getOrCreateSlot().toolType;break;case"ABS_X":case"ABS_Y":case"ABS_PRESSURE":if(this.options.singleTouch)this.handleSingleTouchAxis(n,o);break;case"ABS_TILT_X":this.getOrCreateSlot().tiltX=o|0;break;case"ABS_TILT_Y":this.getOrCreateSlot().tiltY=o|0;break;case"ABS_DISTANCE":case"ABS_MT_DISTANCE":this.getOrCreateSlot().distance=o;break;default:break}}handleSingleTouchAxis(n,o){if(this.currentSlot=0,n==="ABS_X")this.observeAxis("x",o);else if(n==="ABS_Y")this.observeAxis("y",o);else this.getOrCreateSlot().pressure=o}handleKeyEvent(n,o,s){switch(n){case"BTN_DIGI":case"BTN_TOOL_PEN":this.setNodeTool("stylus",o,s);break;case"BTN_TOOL_RUBBER":this.setNodeTool("eraser",o,s);break;case"BTN_STYLUS":this.setButton("stylusPrimary",o);break;case"BTN_STYLUS2":this.setButton("stylusSecondary",o);break;case"BTN_TOUCH":if(this.options.singleTouch){if(this.handleSingleTouchContact(o),o)this.hover.penTouched()}break;default:break}}setNodeTool(n,o,s){if(o){if(this.nodeTool=n,this.options.singleTouch)this.hover.penEntered();return}if(this.nodeTool!==n&&this.nodeTool!==void 0)return;if(this.nodeTool=void 0,this.options.singleTouch)this.handleSingleTouchContact(!1),this.emitHover(this.hover.penLeft(n,s))}setButton(n,o){if(o)this.heldButtons.add(n);else this.heldButtons.delete(n)}handleSingleTouchContact(n){if(this.currentSlot=0,n){this.getOrCreateSlot().trackingId=0;return}let o=this.slots.get(0);if(o&&o.trackingId>=0)this.releasedSlots.add(0),o.trackingId=-1}handleSynEvent(n,o,s){if(n!=="SYN_REPORT")return null;if(parseInt(o,16)!==0)return null;let d=[],c=[],p=[],h=new Set;for(let[,m]of this.slots)if(this.observePenSample(m,s),m.trackingId>=0&&!this.isMtPenHovering(m)){h.add(m.slotId);let f=this.withPenState({...m});if(f.toolType)f.path=this.samplePen(f,s);d.push(f),this.lastEmitted.set(m.slotId,{x:m.x,y:m.y})}else if(this.releasedSlots.has(m.slotId)||m.trackingId>=0&&this.touchingSlots.has(m.slotId))c.push(m.slotId),p.push(...this.takeFinalMove(m,s));for(let m of c)this.penPaths.delete(m);return this.releasedSlots.clear(),this.touchingSlots=h,p.length>0?{arrivedAt:s,activeSlots:d,releasedSlots:c,releasedFinalSamples:p}:{arrivedAt:s,activeSlots:d,releasedSlots:c}}observePenSample(n,o){if(this.observePenSlot(n,o),this.options.singleTouch&&this.nodeTool&&n.trackingId<0)this.hover.penHovering(n,o,this.kernelAtMs)}takeFinalMove(n,o){let s=this.lastEmitted.get(n.slotId);if(this.lastEmitted.delete(n.slotId),!s||s.x===n.x&&s.y===n.y)return[];let a=this.withPenState({...n}),d=this.penPaths.get(n.slotId)?.at(-1)?.pressure;if(a.toolType&&d!==void 0)a.path=this.samplePen({...a,pressure:d},o);return[a]}withPenState(n){if(!(this.options.singleTouch||n.toolType!==void 0))return delete n.tiltX,delete n.tiltY,n;if(this.options.singleTouch)n.toolType=this.nodeTool??"stylus";else if(this.nodeTool==="eraser")n.toolType=this.nodeTool;if(this.heldButtons.size>0)n.buttons=[...this.heldButtons];return n}isMtPenHovering(n){return!this.options.singleTouch&&n.toolType!==void 0&&(n.distance??0)>0}samplePen(n,o){let s=this.penPaths.get(n.slotId)??[],a={x:n.x,y:n.y,pressure:n.pressure,arrivedAt:o,kernelAtMs:this.kernelAtMs};if(s.length>=x.PEN_MAX_SAMPLES){let d=s.reduce((p,h,m)=>h.pressure<s[p].pressure?m:p,0),c=s.reduce((p,h,m)=>h.pressure>s[p].pressure?m:p,0);s=s.filter((p,h)=>h===0||h===d||h===c||h%2===1)}return s.push(a),this.penPaths.set(n.slotId,s),[...s]}getOrCreateSlot(){if(!this.slots.has(this.currentSlot))this.slots.set(this.currentSlot,{slotId:this.currentSlot,trackingId:-1,x:NaN,y:NaN,pressure:0,unknownAxes:["x","y"]});return this.slots.get(this.currentSlot)}observeAxis(n,o){let s=this.getOrCreateSlot();if(s[n]=o,s.unknownAxes=s.unknownAxes?.filter((a)=>a!==n),!s.unknownAxes?.length)delete s.unknownAxes}}class ue{scaler;densityDp;pressureRange;tiltAxes;contacts=new Map;lastTap=null;pinchState=null;inTwoFingerMode=!1;constructor(n,o,s,a){this.scaler=n;this.densityDp=o;this.pressureRange=s;this.tiltAxes=a}scalerAt(n){return"scalerAt"in this.scaler?this.scaler.scalerAt(n):this.scaler}downStamp(n){return"scalerAt"in this.scaler?{downAt:n.arrivedAt}:{}}feedFrame(n){this.updateContacts(n);let o=n.activeSlots.length;if(this.updatePinchState(n,o),n.releasedSlots.length===0)return null;if(this.inTwoFingerMode&&this.pinchState){for(let s of n.releasedSlots)this.contacts.delete(s);if(o===0){let s=this.maybeEmitPinch(n.arrivedAt);return this.inTwoFingerMode=!1,this.pinchState=null,s}return null}if(!this.inTwoFingerMode&&n.releasedSlots.length===1&&o===0)return this.completeSingleFingerGesture(n);for(let s of n.releasedSlots)this.contacts.delete(s);return null}updateContacts(n){for(let o of n.releasedFinalSamples??[]){let s=this.contacts.get(o.slotId);if(s)s.lastX=o.x,s.lastY=o.y,s.path=o.path??s.path}for(let o of n.activeSlots){let s=this.contacts.get(o.slotId);if(s){if(!Number.isFinite(s.startX))s.startX=o.x;if(!Number.isFinite(s.startY))s.startY=o.y;s.lastX=o.x,s.lastY=o.y,s.path=o.path,s.unknownAxes=se(s.unknownAxes,o.unknownAxes),Le(s.pen,o,this.tiltAxes)}else{let a=wt();Le(a,o,this.tiltAxes),this.contacts.set(o.slotId,{startX:o.x,startY:o.y,arrivedAt:n.arrivedAt,lastX:o.x,lastY:o.y,scaler:this.scalerAt(n.arrivedAt),unknownAxes:o.unknownAxes,pen:a,path:o.path})}}}updatePinchState(n,o){if(o===2){this.inTwoFingerMode=!0;let[s,a]=n.activeSlots,d=se(this.contacts.get(s.slotId)?.unknownAxes,this.contacts.get(a.slotId)?.unknownAxes),c=this.contacts.get(s.slotId)?.scaler??this.scalerAt(n.arrivedAt),p=d?.length?void 0:Be(c,s.x,s.y,{rawX2:a.x,rawY2:a.y});if(!this.pinchState)this.pinchState={initialDist:p,finalDist:p,unknownAxes:d};else this.pinchState.finalDist=p,this.pinchState.unknownAxes=se(this.pinchState.unknownAxes,d)}}completeSingleFingerGesture(n){let o=n.releasedSlots[0],s=this.contacts.get(o);if(this.contacts.delete(o),!s)return null;if(s.unknownAxes?.length)return{...this.evaluateUnknownContact(s,n.arrivedAt),...this.penFields(s)};let{x:a,y:d}=s.scaler.toScreenPoint(s.startX,s.startY),{x:c,y:p}=s.scaler.toScreenPoint(s.lastX,s.lastY),h=n.arrivedAt-s.arrivedAt,m=V(a,d,c,p),f=x.TOUCH_SLOP_DP*this.densityDp,y=m<f?this.evaluateTapOrLongPress(a,d,h,{arrivedAt:n.arrivedAt,toolType:s.pen.toolType}):this.evaluateSwipe({x:a,y:d},{x:c,y:p},h,n.arrivedAt);return this.completeContactGesture(s,y,n.arrivedAt,h)}completeContactGesture(n,o,s,a){let d=this.penFields(n);if(o.type==="swipe"&&n.pen.toolType==="stylus"&&d.pressure?.normalized&&this.pressureRange&&(n.pen.pressureMax-n.pen.pressureMin)/(this.pressureRange.max-this.pressureRange.min)>=x.STROKE_PRESSURE_RANGE&&n.path&&n.path.length>=2){this.lastTap=null;let c=this.pressureRange,p=n.path.map((h)=>({...n.scaler.toScreenPoint(h.x,h.y),arrivedAt:h.arrivedAt,...h.kernelAtMs===void 0?{}:{kernelAtMs:h.kernelAtMs},pressure:Math.round(ae((h.pressure-c.min)/(c.max-c.min))*1e4)/1e4}));return{type:"stroke",arrivedAt:s,durationMs:a,path:p,...this.downStamp(n),...d}}return{...o,...this.downStamp(n),...d}}penFields(n){let{toolType:o,buttons:s,pressureCount:a,pressureSum:d,pressureMin:c,pressureMax:p}=n.pen,h={};if(o)h.toolType=o;if(a>0){let m=this.pressureRange,f=(y)=>Math.round((m?ae((y-m.min)/(m.max-m.min)):y)*1e4)/1e4;h.pressure={min:f(c),max:f(p),mean:f(d/a),normalized:m!==void 0}}if(n.pen.tiltCount>0)h.tilt=Math.min(Math.PI/2,Math.round(n.pen.tiltSum/n.pen.tiltCount*1e4)/1e4);if(s.size>0)h.buttons=[...s];return h}evaluateUnknownContact(n,o){this.lastTap=null;let s=o-n.arrivedAt,a=Number.isFinite(n.startX)?n.startX:0,d=Number.isFinite(n.startY)?n.startY:0,c=Number.isFinite(n.lastX)?n.lastX:a,p=Number.isFinite(n.lastY)?n.lastY:d;return{type:Be(n.scaler,a,d,{rawX2:c,rawY2:p})>=x.TOUCH_SLOP_DP*this.densityDp?"swipe":s>=x.LONG_PRESS_MS?"longPress":"tap",arrivedAt:o,durationMs:s,unknownAxes:n.unknownAxes}}maybeEmitPinch(n){let o=this.pinchState;if(o?.unknownAxes?.length)return this.lastTap=null,null;if(!o||o.initialDist===void 0||o.finalDist===void 0||o.initialDist===0)return null;let s=o.finalDist/o.initialDist;if(Math.abs(s-1)<x.PINCH_MIN_SCALE_DELTA)return null;return{type:"pinch",arrivedAt:n,scale:s,pinchDirection:s<1?"in":"out"}}evaluateTapOrLongPress(n,o,s,{arrivedAt:a,toolType:d}){if(s>=x.LONG_PRESS_MS)return{type:"longPress",arrivedAt:a,screenX:n,screenY:o,durationMs:s};if(this.lastTap&&this.lastTap.toolType===d){let c=a-this.lastTap.arrivedAt,p=V(n,o,this.lastTap.screenX,this.lastTap.screenY),h=x.DOUBLE_TAP_SLOP_DP*this.densityDp;if(c<=x.DOUBLE_TAP_MS&&p<=h){let m=this.lastTap.arrivedAt;return this.lastTap=null,{type:"doubleTap",arrivedAt:a,screenX:n,screenY:o,firstTapArrivedAt:m}}}return this.lastTap={screenX:n,screenY:o,arrivedAt:a,toolType:d},{type:"tap",arrivedAt:a,screenX:n,screenY:o}}evaluateSwipe(n,o,s,a){let{x:d,y:c}=n,{x:p,y:h}=o,m=p-d,f=h-c,y=V(d,c,p,h),S=Math.abs(m)>=Math.abs(f)?m>0?"right":"left":f>0?"down":"up",g=s>0?y/s*1000:0,P=x.FLING_MIN_DP_PER_S*this.densityDp,I=g>=P?"fast":"normal";return{type:"swipe",arrivedAt:a,direction:S,startX:d,startY:c,endX:p,endY:h,speed:I}}}function Be(n,o,s,{rawX2:a,rawY2:d}){let c=n.toScreenPoint(o,s),p=n.toScreenPoint(a,d);return V(c.x,c.y,p.x,p.y)}function V(n,o,s,a){return Math.sqrt((s-n)**2+(a-o)**2)}function se(n,o){if(!n?.length&&!o?.length)return;return[...new Set([...n??[],...o??[]])]}function wt(){return{buttons:new Set,pressureCount:0,pressureSum:0,pressureMin:1/0,pressureMax:-1/0,tiltCount:0,tiltSum:0}}function Le(n,o,s){if(o.toolType)n.toolType=o.toolType;for(let a of o.buttons??[])n.buttons.add(a);if(o.toolType==="stylus"||o.toolType==="eraser")Pt(n,o,s);if(o.pressure>0)n.pressureCount+=1,n.pressureSum+=o.pressure,n.pressureMin=Math.min(n.pressureMin,o.pressure),n.pressureMax=Math.max(n.pressureMax,o.pressure)}function Pt(n,o,s){if(s&&He(s.x)&&He(s.y)&&o.tiltX!==void 0&&o.tiltY!==void 0&&Number.isFinite(o.tiltX)&&Number.isFinite(o.tiltY)){let a=Fe(o.tiltX,s.x),d=Fe(o.tiltY,s.y),c=Math.cos(a)*Math.cos(d);n.tiltCount+=1,n.tiltSum+=Math.acos(ae(c))}}function Fe(n,o){let s=o.resolution?1/o.resolution:Math.PI/180;return(n-(o.min+o.max)/2)*s}function He(n){return Number.isFinite(n.min)&&Number.isFinite(n.max)&&n.max>n.min&&(n.resolution===void 0||Number.isFinite(n.resolution)&&n.resolution>=0)}function ae(n){return Math.min(Math.max(n,0),1)}class le{opts;pending=[];maxSeenKernelMs=-1/0;releasePoint=-1/0;flushTimer;flushAt;windowMs;constructor(n){this.opts=n;if(this.windowMs=n.windowMs??50,!Number.isFinite(this.windowMs)||this.windowMs<0)throw RangeError("Kernel reorder window must be finite and non-negative")}push(n,o,s){let a=/^\[\s*(\d+(?:\.\d+)?)\s*\]/.exec(o),d=a?Number(a[1])*1000:NaN;if(!Number.isFinite(d)){this.opts.onLine({nodeKey:n,line:o,arrivedAt:s});return}this.maxSeenKernelMs=Math.max(this.maxSeenKernelMs,d),this.pending.push({nodeKey:n,kernelMs:d,line:o,arrivedAt:s,releaseAt:this.now()+this.windowMs}),this.pending.sort((c,p)=>c.kernelMs-p.kernelMs),this.releaseThrough(Math.max(this.releasePoint,this.maxSeenKernelMs-this.windowMs)),this.scheduleFlush()}drain(){this.cancelFlush(),this.releaseThrough(this.maxSeenKernelMs)}dropNode(n){this.pending=this.pending.filter((o)=>o.nodeKey!==n),this.scheduleFlush()}clear(){this.cancelFlush(),this.pending=[],this.maxSeenKernelMs=-1/0,this.releasePoint=-1/0}releaseThrough(n){this.releasePoint=n;while(this.pending.length>0&&this.pending[0].kernelMs<=n){let o=this.pending.shift(),{nodeKey:s,kernelMs:a,line:d,arrivedAt:c}=o;this.opts.onLine({nodeKey:s,kernelMs:a,line:d,arrivedAt:c})}}scheduleFlush(){if(this.pending.length===0){this.cancelFlush();return}let n=1/0;for(let o of this.pending)n=Math.min(n,o.releaseAt);if(this.flushAt===n)return;this.cancelFlush(),this.flushAt=n,this.flushTimer=this.opts.timer.setTimeout(()=>{this.flushTimer=void 0,this.flushAt=void 0;let o=this.now(),s=this.releasePoint;for(let a of this.pending)if(a.releaseAt<=o)s=Math.max(s,a.kernelMs);this.releaseThrough(s),this.scheduleFlush()},Math.max(0,n-this.now()))}cancelFlush(){if(this.flushTimer!==void 0)this.opts.timer.clearTimeout(this.flushTimer),this.flushTimer=void 0;this.flushAt=void 0}now(){return this.opts.timer.monotonicNow?.()??this.opts.timer.now()}}class B{handlers=new Map;buffer;constructor(n){this.buffer=new le({...n,onLine:({nodeKey:o,line:s,arrivedAt:a})=>this.handlers.get(o)?.(s,a)})}register(n,o){this.buffer.dropNode(n);let s=(a,d)=>o(a,d);return this.handlers.set(n,s),()=>{if(this.handlers.get(n)!==s)return;if(this.handlers.delete(n),this.buffer.dropNode(n),this.handlers.size===0)this.buffer.clear()}}push(n,o,s){if(this.handlers.has(n))this.buffer.push(n,o,s)}}class F{opts;children=new Set;starting=!1;generation=0;cleanups=new Set;timer;constructor(n){this.opts=n;this.timer=n.timer??i}start(n,o){if(this.children.size>0||this.starting)return;this.starting=!0;let s=++this.generation,a=this.opts.lineMerge??new B({timer:this.timer,windowMs:this.opts.kernelReorderWindowMs});this.startProcess(s,this.opts.touchNode,this.opts.scaler,{onGesture:n,onError:o,lineMerge:a});for(let{node:d,scaler:c}of this.opts.penNodes??[])this.startProcess(s,d,c,{onGesture:n,lineMerge:a,onError:(p)=>e.warn(`[GetEventReader] pen node ${d.path} stopped; finger recording continues: ${p.message}`,p)})}async startProcess(n,o,s,{onGesture:a,onError:d,lineMerge:c}){let p=new oe({singleTouch:o.kind==="pen",onHover:(b)=>{let E=b.hover,M=o.distanceRange,G=E?.[0],fe=G&&"scalerAt"in s?s.scalerAt(G.arrivedAt):s;a({...b,...G?{downAt:G.arrivedAt}:{},hover:M&&E&&"toScreenPoint"in fe?E.map((N)=>({...fe.toScreenPoint(N.x,N.y),arrivedAt:N.arrivedAt,...N.kernelAtMs===void 0?{}:{kernelAtMs:N.kernelAtMs},distance:Math.min(1,Math.max(0,(N.distance-M.min)/(M.max-M.min)))})):void 0})}}),h=new ue(s,this.opts.density,Et(o),o.tiltAxes),m=["shell","getevent","-lt",o.path];e.debug(`[GetEventReader] Spawning: ${m.join(" ")}`);let f;try{f=await this.opts.adb.spawn(m)}catch(b){let E=b instanceof Error?b:Error(String(b));if(e.error(`[GetEventReader] spawn error: ${E.message}`),n===this.generation){if(o===this.opts.touchNode)this.starting=!1;d?.(E)}return}if(n!==this.generation){f.on("error",()=>{}),f.kill();return}if(this.children.add(f),o===this.opts.touchNode)this.starting=!1;let y="",S="",g=c.register(o.path,(b,E)=>{if(n!==this.generation)return;let M=p.feedLine(b,E);if(!M)return;if(Mt(M)){let G=h.feedFrame(M);if(G)a(G)}else a(M)}),P=(b)=>{y+=b.toString();let E=y.split(`
4
+ `);y=E.pop()??"";for(let M of E){if(!M.trim()||n!==this.generation)continue;let G=this.timer.now();c.push(o.path,M,G)}},I=(b)=>{S=(S+b.toString()).slice(-4096),e.debug(`[GetEventReader] stderr: ${b.toString().trim()}`)},R=()=>{y="",f.stdout.off("data",P),f.stderr.off("data",I),f.on("error",Z),f.off("error",O),f.off("exit",U),this.children.delete(f),this.cleanups.delete(R),g()},Z=()=>{},O=(b)=>{R();let E=S.trim()?Error(`[GetEventReader] getevent process error: ${b.message}; stderr tail: ${S.trim()}`,{cause:b}):b;e.warn(`[GetEventReader] process error: ${E.message}`),d?.(E)},U=(b,E)=>{R();let M=Error(`[GetEventReader] getevent exited with ${E?`signal ${E}`:`code ${b}`}`+(S.trim()?`; stderr tail: ${S.trim()}`:""));e.warn(M.message),d?.(M)};this.cleanups.add(R),f.stdout.on("data",P),f.stderr.on("data",I),f.on("error",O),f.on("exit",U)}stop(){this.starting=!1,++this.generation;let n=[...this.children];for(let o of[...this.cleanups])o();for(let o of n)if(!o.killed)e.debug("[GetEventReader] Stopping getevent process"),o.kill();this.children.clear()}}function Et(n){return n.pressureMin!==void 0&&n.pressureMax!==void 0?{min:n.pressureMin,max:n.pressureMax}:void 0}function Mt(n){return n!==null&&"activeSlots"in n}class de{opts;running=!1;generation=0;pens=new Map;stopMonitor;constructor(n){this.opts=n}start(n,o){if(this.running)return;this.running=!0;let s=++this.generation,{primary:a}=this.opts;if(a.node.kind==="pen")this.pens.set(a.node.path,{controller:new AbortController,reader:a.reader});a.reader.start(n,o);for(let d of this.opts.penNodes){let c={controller:new AbortController};this.pens.set(d.path,c),this.startPen(d,c,n)}this.monitor(s,n)}startPen(n,o,s){o.reader=this.opts.createPenReader(n),o.reader.start((a)=>{if(this.pens.get(n.path)===o)s(a)},(a)=>{if(this.pens.get(n.path)!==o)return;this.removePen(n.path),e.warn(`[PenHotplugReader] pen node ${n.path} stopped; finger recording continues: ${a.message}`,a)})}async addPen(n,o){if(this.pens.has(n)||n===this.opts.primary.node.path&&this.opts.primary.node.kind!=="pen")return;let s={controller:new AbortController};this.pens.set(n,s);try{let{stdout:a}=await this.opts.adb.execute(["shell","getevent","-lp",n],{signal:s.controller.signal,timeoutMs:1000,noRetry:!0});if(this.pens.get(n)!==s)return;let d=ee(a).pen.find((c)=>c.path===n);if(d)this.startPen(d,s,o);else this.removePen(n)}catch(a){if(this.pens.get(n)!==s){e.debug(`[PenHotplugReader] discarded probe for removed node ${n}`,a);return}this.removePen(n),e.warn(`[PenHotplugReader] cannot read pen node ${n}; finger recording continues: ${r(a)}`,a)}}removePen(n){let o=this.pens.get(n);this.pens.delete(n),o?.controller.abort(),o?.reader?.stop()}async monitor(n,o){let s;try{s=await this.opts.adb.spawn(["shell","getevent","-lt"])}catch(g){if(n===this.generation)e.warn(`[PenHotplugReader] hotplug monitor failed; finger recording continues: ${r(g)}`,g);return}if(n!==this.generation){s.on("error",()=>{}),s.kill();return}let a="",d="",c=(g)=>{a+=g.toString();let P=a.split(`
5
+ `);a=P.pop()??"";for(let I of P){let R=Q(I);if(R?.action==="add")this.addPen(R.path,o);else if(R?.action==="remove")this.removePen(R.path)}},p=(g)=>{d=(d+g.toString()).slice(-4096)},h=()=>{if(s.stdout.off("data",c),s.stderr.off("data",p),s.on("error",m),s.off("error",y),s.off("exit",S),a="",this.stopMonitor=void 0,!s.killed)s.kill()},m=()=>{},f=(g)=>{h(),e.warn(`[PenHotplugReader] hotplug monitor stopped; finger recording continues: ${g}`+(d.trim()?`; stderr tail: ${d.trim()}`:""))},y=(g)=>f(g.message),S=(g,P)=>f(P?`signal ${P}`:`code ${g}`);this.stopMonitor=h,s.stdout.on("data",c),s.stderr.on("data",p),s.on("error",y),s.on("exit",S)}stop(){this.running=!1,++this.generation,this.stopMonitor?.();for(let n of this.pens.keys())this.removePen(n);this.opts.primary.reader.stop()}}function Ye({adb:n,penNode:o,timeline:s,rotation:a,display:d,caveats:c,density:p,timer:h,lineMerge:m}){let[{scaler:f,stopFollowing:y}]=De(s,[o],{rotation:a,display:d},{startedAt:h.now(),caveats:c}),S=new F({adb:n,touchNode:o,scaler:f,density:p,timer:h,lineMerge:m});return{start:(g,P)=>S.start(g,P),stop:()=>{S.stop(),y()}}}function Rt(n){return n?{action:"type",text:n,operation:"replace"}:{action:"clear"}}var H=750,It=3000,$e="rotation/size could not be confirmed at stop; tapAt and swipeOn steps recorded after a display change may be at the wrong coordinates or direction";class j{device;gestureEmitter;a11ySource;steps=[];orderedSteps=[];latestEntry=null;pendingGestures=[];exportWarnings=new Set;bufferedInteractions=[];lastInputText=null;activeEmitter=null;unsubscribeA11y=null;activeA11y=null;stopped=!1;firstTouchTrackFailure;geometry;displaySource;unsubscribeDisplay=null;geometrySpans=new Map;finalized;get touchTrackFailure(){return this.firstTouchTrackFailure}get stepCount(){return this.steps.length}get capturedSteps(){return this.steps}get capturedExportWarnings(){return[...this.exportWarnings]}timer;constructor(n,o,s,{timer:a=i,...d}={}){this.device=n;this.gestureEmitter=o;this.a11ySource=s;this.timer=a,this.geometry=d.geometry,this.displaySource=d.displaySource}async start(){let n;if(!this.a11ySource)n=k.getInstance(this.device);let o=this.a11ySource??n;if(!await o.ensureConnected())throw Error("[DualTrackRecorder] Unable to connect to the accessibility service.");if(n)n.notifyRecordingStarted(),this.activeA11y=n;let a=this.gestureEmitter??await this.createGetEventReader();this.activeEmitter=a,a.start((d)=>this.handleGestureEvent(d),(d)=>{if(this.stopped||this.firstTouchTrackFailure)return;this.firstTouchTrackFailure={error:d,failedAt:this.timer.now()},e.warn(`[DualTrackRecorder] Touch track (getevent) failed: ${d.message}`)}),this.unsubscribeA11y=o.onInteraction((d)=>this.handleInteractionEvent(d)),this.subscribeDisplayChanges(n),e.debug("[DualTrackRecorder] Started dual-track recording")}async stop(n={}){if(n.hostOnly)this.geometry?.dispose();if(this.stopped){let s=await this.finalized??[];return this.stopResult(s)}if(this.stopped=!0,!n.hostOnly)this.activeA11y?.notifyRecordingStopped();this.activeA11y=null,this.unsubscribeA11y?.(),this.unsubscribeA11y=null,this.activeEmitter?.stop(),this.activeEmitter=null,this.flushPendingGestures(),this.finalized=(n.hostOnly?Promise.resolve(this.geometry?[$e]:[]):this.finalizeGeometry()).finally(()=>{this.unsubscribeDisplay?.(),this.unsubscribeDisplay=null});let o=await this.finalized;return e.debug(`[DualTrackRecorder] Stopped with ${this.steps.length} steps`),this.stopResult(o)}flushPendingGestures(){for(let n of this.pendingGestures)if(!n.resolved)this.resolveGesture(n);this.pendingGestures=[]}stopResult(n){return{steps:this.steps,stepCount:this.steps.length,...this.touchTrackFailure?{touchTrackFailure:this.touchTrackFailure}:{},...n.length>0?{geometryWarnings:n}:{},...this.exportWarnings.size>0?{exportWarnings:[...this.exportWarnings]}:{}}}subscribeDisplayChanges(n){let o=this.displaySource??(n?Gt(n):void 0),s=this.geometry;if(o&&s)this.unsubscribeDisplay=o.onDisplayChange((a)=>s.handleTransition(a))}async finalizeGeometry(){let n=this.geometry;if(!n)return[];let{mismatch:o,unconfirmed:s}=await this.confirmGeometryAtStop(n),a=new Set;for(let[d,{downAt:c,upAt:p}]of this.geometrySpans){let h=n.timeline.warningsFor(c,p);if(o&&p>=n.timeline.lastKnownGoodAt)h.push(o);if(h.length>0){d.label=`Warning: ${h.join("; ")}`;for(let m of h)a.add(m)}}if(o)a.add(o);if(s)a.add($e);return[...a]}async confirmGeometryAtStop(n){try{return{mismatch:await l(async()=>(await n.settle(),n.verifyAtStop()),{timer:this.timer,timeoutMs:It,label:"Confirming display geometry at stop"}),unconfirmed:!1}}catch(o){return e.warn(`[DualTrackRecorder] Could not confirm display geometry at stop: ${r(o)}`,o),{unconfirmed:!0}}}handleGestureEvent(n){if(this.stopped)return;if(n.type==="hover"){let s=ze(n);K(this.exportWarnings,n,s),this.trackGeometrySpan(n,s),this.enqueueStep({resolved:!0,step:s??void 0});return}if(n.type==="pressButton"){this.enqueueStep({resolved:!0,step:Bt(n)});return}if(n.type==="pinch"){this.enqueueStep({resolved:!0,step:Lt(n)??void 0});return}if(this.pendingGestures=this.pendingGestures.filter((s)=>!s.resolved||s.step!==void 0&&s.stepIndex===void 0||T(s.gesture)&&this.timer.now()-s.arrivedAt<=H*2||s.gesture.type==="tap"&&n.arrivedAt-s.gesture.arrivedAt<=x.DOUBLE_TAP_MS),this.upgradeDoubleTap(n))return;let o={gesture:n,arrivedAt:this.timer.now(),resolved:!1};this.pendingGestures.push(o),this.enqueueStep(o),o.timeout=this.timer.setTimeout(()=>this.resolveGesture(o),H)}upgradeDoubleTap(n){if(n.type!=="doubleTap"||T(n))return!1;let o=[...this.pendingGestures].reverse().find((a)=>ye(a.gesture,n)),s=o?.step;if(s&&["tapOn","tapAt"].includes(s.tool)&&s.params.action==="tap")return s.params.action="doubleTap",K(this.exportWarnings,n,s),!0;if(o&&!o.resolved){if(o.timeout)this.timer.clearTimeout(o.timeout);return o.gesture=n,o.arrivedAt=this.timer.now(),o.timeout=this.timer.setTimeout(()=>this.resolveGesture(o),H),!0}return!1}enqueueStep(n){this.latestEntry=n,this.orderedSteps.push(n),this.flushResolvedSteps()}flushResolvedSteps(){while(this.orderedSteps[0]?.resolved){let n=this.orderedSteps.shift();if(n.step)n.stepIndex=this.steps.length,this.steps.push(n.step)}}handleInteractionEvent(n){if(this.stopped)return;if(n.type==="windowChange")return;if(n.type==="inputText"){this.handleInputText(n);return}let o={...n,receivedAt:this.timer.now()},s=this.pendingGestures.find((a)=>!a.resolved&&!T(a.gesture)&&this.isPairCandidate(a,o));if(s)this.resolveGesture(s,n);else if(!this.pendingGestures.some((a)=>a.resolved&&!T(a.gesture)&&ce(a.gesture.type,n.type)&&Ue(a.gesture,n.element)))this.bufferedInteractions.push(o)}resolveGesture(n,o){if(n.resolved)return;if(n.resolved=!0,n.timeout)this.timer.clearTimeout(n.timeout);let s=this.selectInteraction(n,o),a=kt(n.gesture,s);if(K(this.exportWarnings,n.gesture,a),n.step=a??void 0,this.trackGeometrySpan(n.gesture,a),this.flushResolvedSteps(),!a&&T(n.gesture)){qe(n.gesture);return}if(!s||!q(s.element)||!a){let d=n.gesture,[c,p]=d.type==="swipe"?[d.startX,d.startY]:[d.screenX,d.screenY],h=a?`recorded ${a.tool} fallback`:"no swipe direction or missing coordinates \u2014 step skipped";e.warn(`[DualTrackRecorder] No element match for ${d.type} at (${c}, ${p}) \u2014 ${h}`)}}trackGeometrySpan(n,o){if(o&&n.downAt!==void 0&&["tapAt","swipeOn","swipeAt","dragPath","hoverAt"].includes(o.tool))this.geometrySpans.set(o,{downAt:n.downAt,upAt:n.arrivedAt})}selectInteraction(n,o){let s=this.timer.now(),a=H*2;this.bufferedInteractions=this.bufferedInteractions.filter((h)=>s-h.receivedAt<=a);let d=this.bufferedInteractions.map((h,m)=>({event:h,index:m}));if(o)d.push({event:{...o,receivedAt:s},index:-1});let c=d.filter(({event:h})=>this.isPairCandidate(n,h));if(T(n.gesture)&&!this.isUnambiguousUnknownPair(n,c.map(({event:h})=>h)))return;let p=c.sort((h,m)=>{let f=h.event.receivedAt-n.arrivedAt,y=m.event.receivedAt-n.arrivedAt;return Number(m.event.type==="tap")-Number(h.event.type==="tap")||Number(f<0)-Number(y<0)||Math.abs(f)-Math.abs(y)})[0];if(p&&p.index>=0)this.bufferedInteractions.splice(p.index,1);return p?.event}isPairCandidate(n,o){let s=n.gesture;if(Math.abs(o.receivedAt-n.arrivedAt)>H)return!1;if(T(s)){let a=(s.type==="tap"||s.type==="longPress")&&o.type==="scroll"&&pe(o.scrollDeltaX,o.scrollDeltaY)!==null;return Boolean((a||ce(s.type,o.type,!1))&&o.element?.bounds&&q(o.element))}return ce(s.type,o.type)&&Ue(s,o.element)}isUnambiguousUnknownPair(n,o){if(o.length!==1)return!1;let s=o[0];return!this.pendingGestures.some((a)=>a!==n&&(T(a.gesture)||!a.resolved)&&this.isPairCandidate(a,s))}handleInputText(n){let o=Nt(n);if(n.text===void 0)return;let s=Rt(n.text);if(this.coalesceInputText(o,s))return;let a={resolved:!0,step:this.buildRecordedTextStep(s)};if(this.enqueueStep(a),o)this.lastInputText={elementKey:o,entry:a}}buildRecordedTextStep(n){return{tool:"sendKeys",params:{commands:[n]}}}coalesceInputText(n,o){let s=this.lastInputText;if(!s||!n||s.elementKey!==n||s.entry!==this.latestEntry)return!1;return this.updateCoalescedTextStep(s.entry.step,o)}updateCoalescedTextStep(n,o){let s=n?.params.commands?.[0];if(n?.tool!=="sendKeys"||s?.action!=="type"&&s?.action!=="clear")return!1;return n.params.commands=[o],!0}async createGetEventReader(){let n=v.create(this.device),{touch:o,pen:s}=await Ie(n),a=o??s[0];if(!a)throw Error("[DualTrackRecorder] No multitouch input device found on this device");let d=await Ge(n),c=Oe(n),p=await W(n),{rotation:h,caveats:m}=await _t(c),f=new z({xMin:a.axisXMin,xMax:a.axisXMax,yMin:a.axisYMin,yMax:a.axisYMax},{rotation:h,display:p},this.timer.now(),m);this.geometry=new ne(f,c,this.timer);let y=new B({timer:this.timer}),S=new F({adb:n,touchNode:a,scaler:f,density:d,timer:this.timer,lineMerge:y}),g=new de({adb:n,primary:{node:a,reader:S},penNodes:o?s:s.slice(1),createPenReader:(P)=>Ye({adb:n,penNode:P,timeline:f,rotation:h,display:p,caveats:m,density:d,timer:this.timer,lineMerge:y})});return Ft(g,f,this.timer)}}async function _t(n){try{let o=await n.readRotation();if(o!==null)return{rotation:o,caveats:[]};e.warn("[DualTrackRecorder] WindowManager reported no display rotation at start")}catch(o){e.warn(`[DualTrackRecorder] Failed to read display rotation at start: ${r(o)}`,o)}return{rotation:0,caveats:[re]}}function Gt(n){return{onDisplayChange(o){let s=n.onDisplayTransition,a=(d)=>{s?.(d),o(d)};return n.onDisplayTransition=a,()=>{if(n.onDisplayTransition===a)n.onDisplayTransition=s}}}}function ce(n,o,s=!0){return(n==="tap"||n==="doubleTap")&&(o==="tap"||s&&o==="stateChange")||n==="longPress"&&o==="longPress"||n==="swipe"&&(o==="scroll"||o==="swipe")}function Ue(n,o){let s=o?.bounds;if(!s)return!1;if(T(n))return!1;let a=n.screenX??n.startX,d=n.screenY??n.startY;if(typeof a!=="number"||typeof d!=="number"||!Number.isFinite(a)||!Number.isFinite(d))return!1;return Dt(a,d,s)}function Dt(n,o,s){return n>=s.left-20&&n<=s.right+20&&o>=s.top-20&&o<=s.bottom+20}function q(n){if(!n)return null;let o=n["resource-id"];if(o)return{elementId:o};let s=n.text??n["content-desc"];if(s)return{text:s};return null}function Nt(n){let o=n.element;if(!o)return null;let s=o["resource-id"]??"",a=o["content-desc"]??"",d=o.class??"";if(!s&&!a&&!d)return null;return`${s}|${a}|${d}`}function pe(n,o){let s=n??0,a=o??0;if(s===0&&a===0)return null;if(Math.abs(s)>=Math.abs(a))return s>0?"left":"right";return a>0?"up":"down"}function kt(n,o={type:"",timestamp:0}){if(n.toolType!==void 0)return ze(n);let s=q(o.element);switch(n.type){case"tap":case"doubleTap":case"longPress":{if(n.type!=="doubleTap"&&T(n)&&o.type==="scroll")return Xe(n,o);if(s)return{tool:"tapOn",params:{action:n.type,...s}};return Ve(n)}case"swipe":return Xe(n,o);default:return null}}var Ot=0.5;function Ke(n){let{startX:o,startY:s,endX:a,endY:d}=n;if(T(n)||o===void 0||s===void 0||a===void 0||d===void 0||o===a&&s===d)return null;return{from:{x:o,y:s},to:{x:a,y:d}}}function Ct({from:n,to:o}){let s=Math.abs(o.x-n.x),a=Math.abs(o.y-n.y);return Math.min(s,a)>=Math.max(s,a)*Ot}function We(n,o){let s={from:o.from,to:o.to},a=n.geometry?.deviceWidth,d=n.geometry?.deviceHeight;if(a&&d&&a>0&&d>0)s.from={x:xp(o.from.x,a),y:xp(o.from.y,d)},s.to={x:xp(o.to.x,a),y:xp(o.to.y,d)},s.coordinateSpace="normalized";if(n.speed==="fast")s.speed="fast";let c=C(n);if(c)s.pointer=c;return{tool:"swipeAt",params:s}}function ze(n){if(n.toolType!=="stylus"&&n.toolType!=="eraser")return null;if(n.type==="stroke"||n.type==="hover")return ve(n);if(n.type==="swipe"){let o=Ke(n);return o?We(n,o):null}return Ve(n)}function Xe(n,o){let s=q(o.element),a=T(n)?s&&pe(o.scrollDeltaX,o.scrollDeltaY):n.direction??pe(o.scrollDeltaX,o.scrollDeltaY),d=Ke(n);if(d&&(!a||Ct(d)))return We(n,d);if(!a)return null;let c={direction:a};if(s)c.container="elementId"in s?{elementId:s.elementId}:{text:s.text};if(!T(n)&&n.speed==="fast")c.speed="fast";return{tool:"swipeOn",params:c}}function Ve(n){if(T(n)||n.screenX===void 0||n.screenY===void 0)return null;let o={x:n.screenX,y:n.screenY,action:n.type};if(n.type==="longPress"&&n.durationMs!==void 0)o.durationMs=Math.min(kh,Math.max(Pa,n.durationMs));let s=C(n);if(s)o.pointer=s;return{tool:"tapAt",params:o,...n.geometry?{geometry:{...n.geometry,x:n.screenX,y:n.screenY}}:{}}}function qe(n){e.warn(`[DualTrackRecorder] ${n.type} has unknown axes: ${n.unknownAxes?.join(", ")} \u2014 no resolved element gesture; step skipped`)}function Bt(n){return{tool:"pressButton",params:{button:n.button}}}function Lt(n){if(T(n))return qe(n),null;return{tool:"pinchOn",params:{direction:n.pinchDirection,scale:n.scale}}}function Ft(n,o,s){return{start:(a,d)=>n.start((c)=>a({...c,geometry:{platform:"android",...o.geometryAt(c.downAt??s.now())}}),d),stop:()=>n.stop()}}var Ht="user-input",Yt="no_user_input_captured",Ze="Device gesture recordings capture input made on the device itself (touches on its touch screen or emulator window, and text changes in input fields). Taps, swipes and other gestures sent through AutoMobile tools (tapAt, tapOn, swipeOn, etc.) or adb shell input are injected and are not recorded by design; use recordToolCalls to record tool calls.";class sP extends t{reason=Yt;constructor(n){super("No recorded interactions were captured. "+Ze+(n?` ${n}`:""))}}var je=1e4,A=null,D=null,_=null,$t=16,Y=new Map;function Ut(n,o){if(!n.ownerSessionUuid)return;if(Y.set(n.recordingId,{owner:n.ownerSessionUuid,result:o}),Y.size>$t){let s=Y.keys().next();if(!s.done)Y.delete(s.value)}}function he(n){let o=w.sessionManager();if(!o)return n;return rt(n,o)??n}function vE(n,o,s=he){let a=Y.get(n);if(!a||o===void 0)return;return me(a.owner,o,s)?a.result:void 0}function me(n,o,s){if(n===void 0||o===void 0)return!1;let a=s(o);return n===o||vK(n,a)||s(n)===a}async function zO(n,o,s=he){let a=_;if(!a||a.session.recordingId!==n||!me(a.session.ownerSessionUuid,o,s))return;return await a.promise,vE(n,o,s)}function aP(n=i){if(!A)return null;let o=n.now()-A.startedAt,s=A.recorder.stepCount;return{recordingId:A.recordingId,deviceId:A.deviceId,platform:A.platform,startedAt:new Date(A.startedAt).toISOString(),eventCount:s,durationMs:o,captureScope:Ht,...s===0?{notice:Ze}:{}}}function J(){return A??D?.session??_?.session??null}function TJ(n,o){let s=J();if(!s||s.deviceId!==n||s.ownerSessionUuid!==void 0)return!1;return s.ownerSessionUuid=o,!0}function NU(n,o){let s=J();return s!==null&&s.ownerSessionUuid===n&&s.deviceId===o}function jO(n,o){let s=J();return s&&NU(n,o)?s.recordingId:void 0}var Xt=(n,o,s,{stoppedAt:a,omittedInput:d})=>{if(n.length===0)throw new sP(d);let c=new Date(o.startedAt),p=a-o.startedAt,h={name:s,description:`Recorded plan with ${n.length} interaction(s).`,steps:n,mcpVersion:an(kn()),metadata:{createdAt:new Date(a).toISOString(),version:"1.0.0",recording:{recordingId:o.recordingId,startedAt:c.toISOString(),stoppedAt:new Date(a).toISOString(),durationMs:p,deviceId:o.deviceId,platform:o.platform,interactionCount:n.length}}};return Rf.validate(h),{plan:h,stepCount:n.length}},Kt=(n)=>{if(n&&n.trim().length>0)return n.trim();return`recorded-plan-${new Date().toISOString().replace(/[:.]/g,"-")}`};function Je(n,o,{ownerSessionUuid:s,baseSessionUuid:a}){if(n.deviceId!==o.deviceId)throw Error(`Recording already active on device ${n.deviceId} (${n.recordingId}). Stop the existing recording before starting a new one on ${o.deviceId}.`);if(!(n.ownerSessionUuid===s||me(n.ownerSessionUuid,s,a??he)))throw new t(`A recording owned by another session is active on device ${o.deviceId}. Wait for it to stop before starting a recording.`)}async function bE(n,o=i,s=L,{recorderFactory:a=(c)=>new j(c),...d}={}){if(_)return await _.promise.catch(()=>{return}),bE(n,o,s,{recorderFactory:a,...d});let{ownerSessionUuid:c}=d;if(A)return Je(A,n,d),e.info(`[DeviceGestureRecording] Recording already active (${A.recordingId}), returning existing session`),{recordingId:A.recordingId,startedAt:new Date(A.startedAt).toISOString(),deviceId:A.deviceId,platform:A.platform};if(D)return Je(D.session,n,d),D.promise;if(n.platform!=="android")throw Error(`Device gesture recording is only supported on Android right now (got ${n.platform}).`);let p=s.next(),h=o.now(),m={recordingId:p,deviceId:n.deviceId,platform:n.platform,startedAt:h,timer:o,recorder:a(n),ownerSessionUuid:c},f=Promise.resolve().then(async()=>{try{return await m.recorder.start(),A=m,e.info(`[DeviceGestureRecording] Started recording ${p} on ${n.deviceId}`),{recordingId:p,startedAt:new Date(h).toISOString(),deviceId:n.deviceId,platform:n.platform}}catch(y){try{await m.recorder.stop()}catch(S){throw u(AggregateError([y,S],"Recorder startup and teardown both failed"),"Failed to start device gesture recording")}throw u(y,"Failed to start device gesture recording")}finally{if(D?.session===m)D=null}});return D={session:m,promise:f},f}function Wt(){return J()?.timer??i}async function Vg(n,o,s=Wt(),a={}){if(D)await D.promise;let d=A??_?.session??null;if(!d)throw Error("No active recording. Start a recording before stopping.");if(n&&n!==d.recordingId)throw Error(`Recording ID ${n} does not match active recording ${d.recordingId}.`);if(_?.session===d)return _.promise;A=null;let c=qt(d,o,s,a).then((p)=>(Ut(d,p),p)).finally(()=>{if(_?.session===d)_=null});return _={session:d,promise:c},c}async function zt(n,o,s){try{return await l(()=>n.recorder.stop(s),{timer:o,timeoutMs:je,label:"Stopping device gesture recording",timeoutError:()=>Error(`Device gesture recording stop timed out after ${je} ms`)})}catch(a){e.warn(`[DeviceGestureRecording] Failed to stop recording ${n.recordingId}`,a);let d=n.recorder.capturedSteps??[];if(d.length===0)throw u(a,"Failed to stop device gesture recording");return{steps:[...d],exportWarnings:[...n.recorder.capturedExportWarnings??[]],salvagedAfter:r(a)}}}function Vt(n){if(!n?.length)return;let o=`Some recorded input was left out of the plan: ${n.join("; ")}.`;return e.warn(`[DeviceGestureRecording] ${o}`),o}async function qt(n,o,s,a){let{steps:d,touchTrackFailure:c,geometryWarnings:p,exportWarnings:h,salvagedAfter:m}=await zt(n,s,a),f=c?`Touch track (getevent) stopped ${c.failedAt-n.startedAt} ms after recording start: ${c.error.message}. Later taps may be missing.`:void 0;if(f&&d.length===0)throw u(Error(f,{cause:c?.error}),"Failed to stop device gesture recording");if(f)e.warn(`[DeviceGestureRecording] ${f}`);let y=p?.length?`Display geometry changed or was unreadable during recording: ${p.join("; ")}. Steps labelled "Warning:" may be recorded at the wrong coordinates or direction.`:void 0;if(y)e.warn(`[DeviceGestureRecording] ${y}`);let S=Vt(h),g=m?`Stopping the recorder did not finish (${m}); the steps captured so far are returned without confirming display rotation/size, so tapAt and swipeOn steps recorded after a display change may be at the wrong coordinates or direction.`:void 0;if(g)e.warn(`[DeviceGestureRecording] ${g}`);let P=[f,y,S,g].filter(Boolean).join(" "),I=s.now(),R=Kt(o),{plan:Z,stepCount:O}=Xt(d,n,R,{stoppedAt:I,omittedInput:S}),U=gS(Z,{indent:2,lineWidth:-1,noRefs:!0}),b=I-n.startedAt;return e.info(`[DeviceGestureRecording] Stopped recording ${n.recordingId} with ${O} steps`),{recordingId:n.recordingId,startedAt:new Date(n.startedAt).toISOString(),stoppedAt:new Date(I).toISOString(),durationMs:b,planName:R,planContent:U,stepCount:O,...P?{error:`Warning: ${P}`}:{},deviceId:n.deviceId,platform:n.platform}}
6
+ export{MU,gE,mf,oP,yE,yK,ff,RJ,PJ,AJ,WO,sP,vE,zO,aP,TJ,NU,jO,bE,Vg};
7
+
8
+ //# debugId=59B2D7B266B142D064756E2164756E21
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import{O$,Fe,t9,r9,n9,Yk,x2,Jk,Xk,C2,of,Pp,fO,hO,sf,gO,Zk,Ap,YR,D2,O2,yO,Qk,vO,JR,M$,M2,N2,F2,L2}from"./chunk-z916af47.js";import"./chunk-bn64x5z5.js";import"./chunk-4fgdhcwx.js";import"./chunk-6d3mmqxt.js";import"./chunk-h3n4adc6.js";import"./chunk-32jpxz2y.js";import"./chunk-79q5xsdc.js";import"./chunk-ggtd5x5a.js";import"./chunk-z8t0v07j.js";import"./chunk-mf9spd4g.js";export{YR as NotificationShadeNotOpenError,Ap as TransientPreSwipeError,M$ as captureNotificationDismissBaseline,of as captureSystemTrayTerminalEvidence,L2 as clearIosSystemTrayNotifications,N2 as clearMatchingSystemTrayNotifications,fO as ensureSystemTrayClosed,Pp as ensureSystemTrayOpen,Qk as expandAndRematchIfCollapsed,Fe as getSystemTrayDependencies,vO as isSwipeTargetIsolatedFromGroup,D2 as listSystemTrayNotifications,O2 as listSystemTrayNotificationsForClear,hO as notificationNotFoundError,C2 as observeSystemTrayAfterTap,yO as readActiveNotificationKeysForApp,F2 as readClearAllTerminalObservation,r9 as resetSystemTrayDependencies,n9 as resolveAppLabel,O$ as resolveNotificationGroupExpansionState,Jk as resolveNotificationSwipeElement,x2 as resolveNotificationTapElement,Xk as resolveSystemTrayAwaitTimeout,Yk as resolveUniqueTrayAppLabel,JR as retryTransientPreSwipe,t9 as setSystemTrayDependencies,Zk as swipeElement,gO as tapElement,M2 as verifyNotificationDismissed,sf as waitForNotificationMatch};
3
+
4
+ //# debugId=B8FC38E99939D43A64756E2164756E21
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import{sr}from"./chunk-6d3mmqxt.js";import"./chunk-32jpxz2y.js";import"./chunk-z8t0v07j.js";import"./chunk-mf9spd4g.js";export{sr as FeatureFlagService};
3
+
4
+ //# debugId=926AE1EEA9BF77BD64756E2164756E21
@@ -0,0 +1,4 @@
1
+ // @bun
2
+ import{t0,uoe}from"./chunk-9y5bcy28.js";import"./chunk-z8t0v07j.js";import"./chunk-mf9spd4g.js";export{uoe as NetworkFilterInstaller,t0 as NetworkFilterStatusInspector};
3
+
4
+ //# debugId=DAE973E4E223F45D64756E2164756E21