@cloudcare/cocos-session-replay 0.1.0-alpha.6

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 (169) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +53 -0
  3. package/THIRD_PARTY_NOTICES +5 -0
  4. package/components/creator2/ReplayPrivacy.ts +23 -0
  5. package/components/creator3/ReplayPrivacy.ts +25 -0
  6. package/creator2/package.json +4 -0
  7. package/creator3/package.json +5 -0
  8. package/dist/creator2/core/client.d.ts +30 -0
  9. package/dist/creator2/core/client.d.ts.map +1 -0
  10. package/dist/creator2/core/client.js +115 -0
  11. package/dist/creator2/core/client.js.map +1 -0
  12. package/dist/creator2/core/replay-async-transport.d.ts +4 -0
  13. package/dist/creator2/core/replay-async-transport.d.ts.map +1 -0
  14. package/dist/creator2/core/replay-async-transport.js +67 -0
  15. package/dist/creator2/core/replay-async-transport.js.map +1 -0
  16. package/dist/creator2/core/replay-budget.d.ts +28 -0
  17. package/dist/creator2/core/replay-budget.d.ts.map +1 -0
  18. package/dist/creator2/core/replay-budget.js +126 -0
  19. package/dist/creator2/core/replay-budget.js.map +1 -0
  20. package/dist/creator2/core/replay-diagnostics.d.ts +36 -0
  21. package/dist/creator2/core/replay-diagnostics.d.ts.map +1 -0
  22. package/dist/creator2/core/replay-diagnostics.js +40 -0
  23. package/dist/creator2/core/replay-diagnostics.js.map +1 -0
  24. package/dist/creator2/core/replay-encoding.d.ts +31 -0
  25. package/dist/creator2/core/replay-encoding.d.ts.map +1 -0
  26. package/dist/creator2/core/replay-encoding.js +63 -0
  27. package/dist/creator2/core/replay-encoding.js.map +1 -0
  28. package/dist/creator2/core/replay-file.d.ts +5 -0
  29. package/dist/creator2/core/replay-file.d.ts.map +1 -0
  30. package/dist/creator2/core/replay-file.js +101 -0
  31. package/dist/creator2/core/replay-file.js.map +1 -0
  32. package/dist/creator2/core/replay-pixels.d.ts +3 -0
  33. package/dist/creator2/core/replay-pixels.d.ts.map +1 -0
  34. package/dist/creator2/core/replay-pixels.js +16 -0
  35. package/dist/creator2/core/replay-pixels.js.map +1 -0
  36. package/dist/creator2/core/replay-privacy-nodes.d.ts +14 -0
  37. package/dist/creator2/core/replay-privacy-nodes.d.ts.map +1 -0
  38. package/dist/creator2/core/replay-privacy-nodes.js +18 -0
  39. package/dist/creator2/core/replay-privacy-nodes.js.map +1 -0
  40. package/dist/creator2/core/replay-privacy.d.ts +15 -0
  41. package/dist/creator2/core/replay-privacy.d.ts.map +1 -0
  42. package/dist/creator2/core/replay-privacy.js +36 -0
  43. package/dist/creator2/core/replay-privacy.js.map +1 -0
  44. package/dist/creator2/core/replay.d.ts +102 -0
  45. package/dist/creator2/core/replay.d.ts.map +1 -0
  46. package/dist/creator2/core/replay.js +653 -0
  47. package/dist/creator2/core/replay.js.map +1 -0
  48. package/dist/creator2/core/transport.d.ts +3 -0
  49. package/dist/creator2/core/transport.d.ts.map +1 -0
  50. package/dist/creator2/core/transport.js +22 -0
  51. package/dist/creator2/core/transport.js.map +1 -0
  52. package/dist/creator2/core/types.d.ts +82 -0
  53. package/dist/creator2/core/types.d.ts.map +1 -0
  54. package/dist/creator2/core/types.js +3 -0
  55. package/dist/creator2/core/types.js.map +1 -0
  56. package/dist/creator2/core/validation.d.ts +13 -0
  57. package/dist/creator2/core/validation.d.ts.map +1 -0
  58. package/dist/creator2/core/validation.js +75 -0
  59. package/dist/creator2/core/validation.js.map +1 -0
  60. package/dist/creator2/core/version.d.ts +2 -0
  61. package/dist/creator2/core/version.d.ts.map +1 -0
  62. package/dist/creator2/core/version.js +5 -0
  63. package/dist/creator2/core/version.js.map +1 -0
  64. package/dist/creator2/creator2/capture.d.ts +17 -0
  65. package/dist/creator2/creator2/capture.d.ts.map +1 -0
  66. package/dist/creator2/creator2/capture.js +168 -0
  67. package/dist/creator2/creator2/capture.js.map +1 -0
  68. package/dist/creator2/creator2/index.d.ts +8 -0
  69. package/dist/creator2/creator2/index.d.ts.map +1 -0
  70. package/dist/creator2/creator2/index.js +19 -0
  71. package/dist/creator2/creator2/index.js.map +1 -0
  72. package/dist/creator2/creator2/pointer.d.ts +5 -0
  73. package/dist/creator2/creator2/pointer.d.ts.map +1 -0
  74. package/dist/creator2/creator2/pointer.js +49 -0
  75. package/dist/creator2/creator2/pointer.js.map +1 -0
  76. package/dist/creator2/creator2/transport.d.ts +8 -0
  77. package/dist/creator2/creator2/transport.d.ts.map +1 -0
  78. package/dist/creator2/creator2/transport.js +38 -0
  79. package/dist/creator2/creator2/transport.js.map +1 -0
  80. package/dist/creator3/core/client.d.ts +30 -0
  81. package/dist/creator3/core/client.d.ts.map +1 -0
  82. package/dist/creator3/core/client.js +97 -0
  83. package/dist/creator3/core/client.js.map +1 -0
  84. package/dist/creator3/core/replay-async-transport.d.ts +4 -0
  85. package/dist/creator3/core/replay-async-transport.d.ts.map +1 -0
  86. package/dist/creator3/core/replay-async-transport.js +16 -0
  87. package/dist/creator3/core/replay-async-transport.js.map +1 -0
  88. package/dist/creator3/core/replay-budget.d.ts +28 -0
  89. package/dist/creator3/core/replay-budget.d.ts.map +1 -0
  90. package/dist/creator3/core/replay-budget.js +118 -0
  91. package/dist/creator3/core/replay-budget.js.map +1 -0
  92. package/dist/creator3/core/replay-diagnostics.d.ts +36 -0
  93. package/dist/creator3/core/replay-diagnostics.d.ts.map +1 -0
  94. package/dist/creator3/core/replay-diagnostics.js +36 -0
  95. package/dist/creator3/core/replay-diagnostics.js.map +1 -0
  96. package/dist/creator3/core/replay-encoding.d.ts +31 -0
  97. package/dist/creator3/core/replay-encoding.d.ts.map +1 -0
  98. package/dist/creator3/core/replay-encoding.js +62 -0
  99. package/dist/creator3/core/replay-encoding.js.map +1 -0
  100. package/dist/creator3/core/replay-file.d.ts +5 -0
  101. package/dist/creator3/core/replay-file.d.ts.map +1 -0
  102. package/dist/creator3/core/replay-file.js +31 -0
  103. package/dist/creator3/core/replay-file.js.map +1 -0
  104. package/dist/creator3/core/replay-pixels.d.ts +3 -0
  105. package/dist/creator3/core/replay-pixels.d.ts.map +1 -0
  106. package/dist/creator3/core/replay-pixels.js +13 -0
  107. package/dist/creator3/core/replay-pixels.js.map +1 -0
  108. package/dist/creator3/core/replay-privacy-nodes.d.ts +14 -0
  109. package/dist/creator3/core/replay-privacy-nodes.d.ts.map +1 -0
  110. package/dist/creator3/core/replay-privacy-nodes.js +15 -0
  111. package/dist/creator3/core/replay-privacy-nodes.js.map +1 -0
  112. package/dist/creator3/core/replay-privacy.d.ts +15 -0
  113. package/dist/creator3/core/replay-privacy.d.ts.map +1 -0
  114. package/dist/creator3/core/replay-privacy.js +33 -0
  115. package/dist/creator3/core/replay-privacy.js.map +1 -0
  116. package/dist/creator3/core/replay.d.ts +102 -0
  117. package/dist/creator3/core/replay.d.ts.map +1 -0
  118. package/dist/creator3/core/replay.js +576 -0
  119. package/dist/creator3/core/replay.js.map +1 -0
  120. package/dist/creator3/core/transport.d.ts +3 -0
  121. package/dist/creator3/core/transport.d.ts.map +1 -0
  122. package/dist/creator3/core/transport.js +19 -0
  123. package/dist/creator3/core/transport.js.map +1 -0
  124. package/dist/creator3/core/types.d.ts +82 -0
  125. package/dist/creator3/core/types.d.ts.map +1 -0
  126. package/dist/creator3/core/types.js +2 -0
  127. package/dist/creator3/core/types.js.map +1 -0
  128. package/dist/creator3/core/validation.d.ts +13 -0
  129. package/dist/creator3/core/validation.d.ts.map +1 -0
  130. package/dist/creator3/core/validation.js +70 -0
  131. package/dist/creator3/core/validation.js.map +1 -0
  132. package/dist/creator3/core/version.d.ts +2 -0
  133. package/dist/creator3/core/version.d.ts.map +1 -0
  134. package/dist/creator3/core/version.js +2 -0
  135. package/dist/creator3/core/version.js.map +1 -0
  136. package/dist/creator3/creator3/capture.d.ts +17 -0
  137. package/dist/creator3/creator3/capture.d.ts.map +1 -0
  138. package/dist/creator3/creator3/capture.js +112 -0
  139. package/dist/creator3/creator3/capture.js.map +1 -0
  140. package/dist/creator3/creator3/index.d.ts +8 -0
  141. package/dist/creator3/creator3/index.d.ts.map +1 -0
  142. package/dist/creator3/creator3/index.js +14 -0
  143. package/dist/creator3/creator3/index.js.map +1 -0
  144. package/dist/creator3/creator3/pointer.d.ts +5 -0
  145. package/dist/creator3/creator3/pointer.d.ts.map +1 -0
  146. package/dist/creator3/creator3/pointer.js +29 -0
  147. package/dist/creator3/creator3/pointer.js.map +1 -0
  148. package/dist/creator3/creator3/replay-render-cycle.d.ts +9 -0
  149. package/dist/creator3/creator3/replay-render-cycle.d.ts.map +1 -0
  150. package/dist/creator3/creator3/replay-render-cycle.js +12 -0
  151. package/dist/creator3/creator3/replay-render-cycle.js.map +1 -0
  152. package/dist/creator3/creator3/transport.d.ts +9 -0
  153. package/dist/creator3/creator3/transport.d.ts.map +1 -0
  154. package/dist/creator3/creator3/transport.js +28 -0
  155. package/dist/creator3/creator3/transport.js.map +1 -0
  156. package/dist/creator3/package.json +1 -0
  157. package/native/android/src/main/java/com/ft/sdk/cocos/FTCocosReplayBridge.java +168 -0
  158. package/native/android/src/main/java/com/ft/sdk/cocos/FTCocosReplayImageJobs.java +55 -0
  159. package/native/ios/FTCocosReplayBridge.h +10 -0
  160. package/native/ios/FTCocosReplayBridge.m +275 -0
  161. package/native/ios/FTCocosReplayBridge.podspec +18 -0
  162. package/native/ios/FTCocosReplayImageJobs.h +11 -0
  163. package/native/ios/FTCocosReplayImageJobs.m +54 -0
  164. package/native/ios/Package.swift +26 -0
  165. package/native/ios/include/FTCocosReplayBridge.h +10 -0
  166. package/native/shared/FTReplayFileBridge.h +62 -0
  167. package/native/shared/FTReplayFileWorker.h +88 -0
  168. package/native-integration.json +9 -0
  169. package/package.json +58 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2020 Changzhou Guance Information Technology Co., Ltd.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # Guance Cocos Session Replay
2
+
3
+ Optional Session Replay for native Android and iOS applications built with Cocos Creator 2.4 and 3.x. Install the exact same version of `@cloudcare/cocos-sdk` and `@cloudcare/cocos-session-replay`.
4
+
5
+ ```sh
6
+ npm install @cloudcare/cocos-sdk@<version> @cloudcare/cocos-session-replay@<version>
7
+ npx guance-cocos install --replay
8
+ ```
9
+
10
+ Reopen Creator and rebuild the native project. Use `--creator 2` or `--creator 3` if automatic detection is unavailable. Add `--ios-dependency-manager spm` to select Swift Package Manager; CocoaPods remains the default.
11
+
12
+ ## Standalone application
13
+
14
+ ```ts
15
+ import { guanceSdk as baseSdk } from '@cloudcare/cocos-sdk/creator3';
16
+ import { withSessionReplay } from '@cloudcare/cocos-session-replay/creator3';
17
+
18
+ export const sdk = withSessionReplay(baseSdk);
19
+ sdk.start({
20
+ sdk: { datakitUrl: 'http://localhost:9529' },
21
+ rum: { androidAppId: 'your-app-id', iosAppId: 'your-app-id' },
22
+ replay: { captureFps: 1, touchPrivacy: 'hide' },
23
+ });
24
+ ```
25
+
26
+ For Creator 2, use the `/creator2` entry from both packages. Compose before starting or attaching the base SDK. `sdk.setReplayCamera(camera)` selects the capture camera; `sdk.replay.setPrivacy(node, 'mask')` protects a node. The installer places `ReplayPrivacy.ts` under `assets/guance-cocos-sdk` for scene/prefab use.
27
+
28
+ ## Hybrid application
29
+
30
+ The native host owns SDK/RUM/Replay initialization and sampling. Attach the composed SDK to that instance:
31
+
32
+ ```ts
33
+ sdk.attach({ replay: { captureFps: 1 }, autoTrack: { scenes: true } });
34
+ sdk.enterCocos();
35
+ // When returning to the native host:
36
+ sdk.leaveCocos();
37
+ ```
38
+
39
+ If automatic scene tracking is disabled, pass a `viewName` to `enterCocos`. Use `leaveCocos` instead of `shutdown` in Hybrid mode. Replay uses the native host's existing RUM session, image storage, and uploader.
40
+
41
+ ## Migration from the combined package
42
+
43
+ Add this package and compose the existing SDK with `withSessionReplay`. Move the old `setReplayCamera(camera)` call to `sdk.setReplayCamera(camera)`. Import Replay configuration types from this package. Existing `start({ replay })`, `attach({ replay })`, and `sdk.replay` operations are available on the composed SDK.
44
+
45
+ The base package alone does not accept Replay configuration. Missing or incompatible native Replay integration reports an error when enabling Replay, with instructions to rerun installation and rebuild.
46
+
47
+ Run `npx guance-cocos install --no-replay` and rebuild to remove SDK-managed native Replay integration. Existing ReplayPrivacy scripts and their `.meta` identifiers are preserved because scenes may reference them. Native Replay independently used by a Hybrid host must remain installed by that host.
48
+
49
+ ## Native dependencies
50
+
51
+ This package carries the optional Replay bridge, asynchronous image workers, C++ frame-file bindings, and privacy components. Its integration descriptor adds Android `ft-session-replay`, or iOS `GuanceSDK/FTSessionReplay` / `GuanceSessionReplay`. Base SDK dependencies are shared rather than duplicated.
52
+
53
+ Licensed under Apache-2.0; see `LICENSE` and `THIRD_PARTY_NOTICES`.
@@ -0,0 +1,5 @@
1
+ THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
2
+
3
+ This distribution does not bundle third-party source code or generated
4
+ third-party declarations. Build-time and development dependencies are obtained
5
+ separately and remain subject to their respective licenses.
@@ -0,0 +1,23 @@
1
+ const { ccclass, property, menu, disallowMultiple } = cc._decorator;
2
+
3
+ export enum ReplayPrivacyMode {
4
+ Mask = 0,
5
+ Hide = 1,
6
+ }
7
+
8
+ /** Attach to a node or prefab to protect its bounds in Session Replay. */
9
+ @ccclass('ReplayPrivacy')
10
+ @menu('Session Replay/ReplayPrivacy')
11
+ @disallowMultiple
12
+ export default class ReplayPrivacy extends cc.Component {
13
+ @property({
14
+ type: cc.Enum(ReplayPrivacyMode),
15
+ tooltip: 'Mask fills the Replay region gray; Hide fills it black. The live scene is unchanged.',
16
+ })
17
+ mode: ReplayPrivacyMode = ReplayPrivacyMode.Mask;
18
+
19
+ /** Read by the SDK during capture; independent of SDK initialization order. */
20
+ get replayPrivacyMode(): 'mask' | 'hide' {
21
+ return this.mode === ReplayPrivacyMode.Hide ? 'hide' : 'mask';
22
+ }
23
+ }
@@ -0,0 +1,25 @@
1
+ import { _decorator, Component, Enum } from 'cc';
2
+
3
+ const { ccclass, property, menu, disallowMultiple } = _decorator;
4
+
5
+ export enum ReplayPrivacyMode {
6
+ Mask = 0,
7
+ Hide = 1,
8
+ }
9
+
10
+ /** Attach to a node or prefab to protect its bounds in Session Replay. */
11
+ @ccclass('ReplayPrivacy')
12
+ @menu('Session Replay/ReplayPrivacy')
13
+ @disallowMultiple
14
+ export default class ReplayPrivacy extends Component {
15
+ @property({
16
+ type: Enum(ReplayPrivacyMode),
17
+ tooltip: 'Mask fills the Replay region gray; Hide fills it black. The live scene is unchanged.',
18
+ })
19
+ mode: ReplayPrivacyMode = ReplayPrivacyMode.Mask;
20
+
21
+ /** Read by the SDK during capture; independent of SDK initialization order. */
22
+ get replayPrivacyMode(): 'mask' | 'hide' {
23
+ return this.mode === ReplayPrivacyMode.Hide ? 'hide' : 'mask';
24
+ }
25
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "main": "../dist/creator2/creator2/index.js",
3
+ "types": "../dist/creator2/creator2/index.d.ts"
4
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "type": "module",
3
+ "main": "../dist/creator3/creator3/index.js",
4
+ "types": "../dist/creator3/creator3/index.d.ts"
5
+ }
@@ -0,0 +1,30 @@
1
+ import type { FTCocosSDK, FTNativeTransport, FTCocosEnterOptions } from '@cloudcare/cocos-sdk/plugin-api';
2
+ import { FTSessionReplay, type FTCanvasCapture, type FTReplayPointerSource } from './replay.js';
3
+ import type { FTCocosReplayConfig, FTCocosHybridReplayConfig, FTSessionReplayConfig } from './types.js';
4
+ export interface FTReplayCapture extends FTCanvasCapture {
5
+ setCamera(camera: unknown): void;
6
+ }
7
+ /** Typed Replay facade; the supplied base SDK continues to own lifecycle state. */
8
+ export declare class FTCocosReplaySDK {
9
+ private readonly base;
10
+ readonly replay: FTSessionReplay;
11
+ private readonly capture;
12
+ private readonly configure;
13
+ readonly mobile: FTCocosSDK['mobile'];
14
+ readonly rum: FTCocosSDK['rum'];
15
+ readonly logger: FTCocosSDK['logger'];
16
+ readonly trace: FTCocosSDK['trace'];
17
+ constructor(base: FTCocosSDK, replay: FTSessionReplay, capture: FTReplayCapture, configure: (config: FTSessionReplayConfig | undefined) => void);
18
+ start(config: FTCocosReplayConfig): void;
19
+ attach(config?: FTCocosHybridReplayConfig): void;
20
+ setReplayCamera(camera: unknown): void;
21
+ enterCocos(options?: FTCocosEnterOptions): void;
22
+ leaveCocos(): void;
23
+ shutdown(): void;
24
+ }
25
+ export declare function composeSessionReplay(base: FTCocosSDK, engine: 'creator2' | 'creator3', create: () => {
26
+ transport: FTNativeTransport;
27
+ capture: FTReplayCapture;
28
+ pointers: FTReplayPointerSource;
29
+ }): FTCocosReplaySDK;
30
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../../src/session-replay/core/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAC1G,OAAO,EAAE,eAAe,EAAE,KAAK,eAAe,EAAE,KAAK,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAChG,OAAO,KAAK,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,qBAAqB,EAA+B,MAAM,YAAY,CAAC;AAIrI,MAAM,WAAW,eAAgB,SAAQ,eAAe;IAAG,SAAS,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CAAE;AAE9F,mFAAmF;AACnF,qBAAa,gBAAgB;IAOzB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,QAAQ,CAAC,MAAM,EAAE,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAT5B,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IACtC,QAAQ,CAAC,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;gBAGjB,IAAI,EAAE,UAAU,EACxB,MAAM,EAAE,eAAe,EACf,OAAO,EAAE,eAAe,EACxB,SAAS,EAAE,CAAC,MAAM,EAAE,qBAAqB,GAAG,SAAS,KAAK,IAAI;IAQjF,KAAK,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI;IAMxC,MAAM,CAAC,MAAM,GAAE,yBAA8B,GAAG,IAAI;IAMpD,eAAe,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IACtC,UAAU,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,IAAI;IAC/C,UAAU,IAAI,IAAI;IAClB,QAAQ,IAAI,IAAI;CACjB;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,UAAU,GAAG,UAAU,EAC/B,MAAM,EAAE,MAAM;IAAE,SAAS,EAAE,iBAAiB,CAAC;IAAC,OAAO,EAAE,eAAe,CAAC;IAAC,QAAQ,EAAE,qBAAqB,CAAA;CAAE,GACxG,gBAAgB,CAkClB"}
@@ -0,0 +1,115 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.FTCocosReplaySDK = void 0;
15
+ exports.composeSessionReplay = composeSessionReplay;
16
+ var replay_js_1 = require("./replay.js");
17
+ var version_js_1 = require("./version.js");
18
+ var validation_js_1 = require("./validation.js");
19
+ /** Typed Replay facade; the supplied base SDK continues to own lifecycle state. */
20
+ var FTCocosReplaySDK = /** @class */ (function () {
21
+ function FTCocosReplaySDK(base, replay, capture, configure) {
22
+ this.base = base;
23
+ this.replay = replay;
24
+ this.capture = capture;
25
+ this.configure = configure;
26
+ this.mobile = base.mobile;
27
+ this.rum = base.rum;
28
+ this.logger = base.logger;
29
+ this.trace = base.trace;
30
+ }
31
+ FTCocosReplaySDK.prototype.start = function (config) {
32
+ var replay = config.replay, base = __rest(config, ["replay"]);
33
+ this.configure(replay);
34
+ try {
35
+ this.base.start(base);
36
+ }
37
+ finally {
38
+ this.configure(undefined);
39
+ }
40
+ };
41
+ FTCocosReplaySDK.prototype.attach = function (config) {
42
+ if (config === void 0) { config = {}; }
43
+ var replay = config.replay, base = __rest(config, ["replay"]);
44
+ this.configure(replay);
45
+ try {
46
+ this.base.attach(base);
47
+ }
48
+ finally {
49
+ this.configure(undefined);
50
+ }
51
+ };
52
+ FTCocosReplaySDK.prototype.setReplayCamera = function (camera) { this.capture.setCamera(camera); };
53
+ FTCocosReplaySDK.prototype.enterCocos = function (options) { this.base.enterCocos(options); };
54
+ FTCocosReplaySDK.prototype.leaveCocos = function () { this.base.leaveCocos(); };
55
+ FTCocosReplaySDK.prototype.shutdown = function () { this.base.shutdown(); };
56
+ return FTCocosReplaySDK;
57
+ }());
58
+ exports.FTCocosReplaySDK = FTCocosReplaySDK;
59
+ function composeSessionReplay(base, engine, create) {
60
+ if (!base || base.extensionProtocol !== 1 || typeof base.registerExtension !== 'function') {
61
+ throw new Error('Upgrade @cloudcare/cocos-sdk to the matching Session Replay package version');
62
+ }
63
+ return base.registerExtension('session-replay', version_js_1.FT_COCOS_REPLAY_VERSION, engine, function () {
64
+ var _a = create(), transport = _a.transport, capture = _a.capture, pointers = _a.pointers;
65
+ var replay = new replay_js_1.FTSessionReplay(transport, capture, pointers, function () { return validateNativeReplay(transport, false); });
66
+ var pending;
67
+ var facade = new FTCocosReplaySDK(base, replay, capture, function (config) { pending = config; });
68
+ return {
69
+ value: facade,
70
+ lifecycle: {
71
+ beforeStart: function () {
72
+ if (pending === undefined)
73
+ return;
74
+ validateConfig(pending);
75
+ (0, validation_js_1.samplingRate)(pending.sampleRate, 'replay.sampleRate');
76
+ (0, validation_js_1.samplingRate)(pending.sessionOnErrorSampleRate, 'replay.sessionOnErrorSampleRate');
77
+ validateNativeReplay(transport, false);
78
+ },
79
+ afterStart: function () { if (pending !== undefined)
80
+ replay.start(pending); },
81
+ beforeAttach: function () {
82
+ if (pending !== undefined) {
83
+ validateConfig(pending);
84
+ validateNativeReplay(transport, true);
85
+ }
86
+ replay.attachHybrid(pending);
87
+ },
88
+ rollbackAttach: function () { return replay.detachHybrid(); },
89
+ enter: function () { return replay.enterHybrid(); },
90
+ leave: function () { return replay.leaveHybrid(); },
91
+ shutdown: function () { return replay.stop(); },
92
+ },
93
+ };
94
+ });
95
+ }
96
+ function validateConfig(config) {
97
+ (0, validation_js_1.captureFps)(config.captureFps);
98
+ (0, validation_js_1.replayImagePolicy)(config);
99
+ if (config.touchPrivacy !== undefined && config.touchPrivacy !== 'hide' && config.touchPrivacy !== 'show') {
100
+ throw new TypeError("touchPrivacy must be either 'show' or 'hide'");
101
+ }
102
+ }
103
+ function validateNativeReplay(transport, hybrid) {
104
+ if (transport.platform === 'unsupported')
105
+ return;
106
+ try {
107
+ var result = transport.invoke('replay.capabilities', { hybrid: hybrid });
108
+ if ((result === null || result === void 0 ? void 0 : result.protocol) !== 1)
109
+ throw new Error('Native Replay bridge protocol does not match');
110
+ }
111
+ catch (error) {
112
+ throw new Error("Session Replay native integration is unavailable. Run the SDK installer with --replay and rebuild the native application. ".concat(String(error)));
113
+ }
114
+ }
115
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../../src/session-replay/core/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AA6CA,oDAsCC;AA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AA8C,CAAC,CAAC;IACtE,CAAC;AACH,CAAC;AAED,SAAS,oBAAoB,CAAC,SAA4B,EAAE,MAAe;IACzE,IAAI,SAAS,CAAC,QAAQ,KAAK,aAAa;QAAE,OAAO;IACjD,IAAI,CAAC;QACH,IAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAuB,qBAAqB,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAC;QACzF,IAAI,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,MAAK,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAC9F,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,oIAA6H,MAAM,CAAC,KAAK,CAAC,CAAE,CAAC,CAAC;IAChK,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { FTNativeTransport } from '@cloudcare/cocos-sdk/plugin-api';
2
+ /** Polls a single native worker without keeping a synchronous bridge call open. */
3
+ export declare function invokeReplayAsync<T>(transport: FTNativeTransport, method: string, payload?: unknown): Promise<T | undefined>;
4
+ //# sourceMappingURL=replay-async-transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay-async-transport.d.ts","sourceRoot":"","sources":["../../../../../src/session-replay/core/replay-async-transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAGzE,mFAAmF;AACnF,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CASlI"}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.invokeReplayAsync = invokeReplayAsync;
40
+ var transport_js_1 = require("./transport.js");
41
+ /** Polls a single native worker without keeping a synchronous bridge call open. */
42
+ function invokeReplayAsync(transport, method, payload) {
43
+ return __awaiter(this, void 0, void 0, function () {
44
+ var job, result;
45
+ return __generator(this, function (_a) {
46
+ switch (_a.label) {
47
+ case 0:
48
+ job = transport.invoke('replay.beginSaveImage', { method: method, arguments: payload });
49
+ if (!job)
50
+ throw new Error('Rebuild the native bridge to enable asynchronous Replay encoding');
51
+ _a.label = 1;
52
+ case 1: return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 16); })];
53
+ case 2:
54
+ _a.sent();
55
+ result = transport.invoke('replay.pollSaveImage', { job: job });
56
+ if (!result)
57
+ throw new Error('Replay encoding job is unavailable');
58
+ if (!result.pending)
59
+ return [2 /*return*/, (0, transport_js_1.parseTransportResponse)(result.response)];
60
+ _a.label = 3;
61
+ case 3: return [3 /*break*/, 1];
62
+ case 4: return [2 /*return*/];
63
+ }
64
+ });
65
+ });
66
+ }
67
+ //# sourceMappingURL=replay-async-transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay-async-transport.js","sourceRoot":"","sources":["../../../../../src/session-replay/core/replay-async-transport.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,8CASC;AAZD,+CAAwD;AAExD,mFAAmF;AACnF,SAAsB,iBAAiB,CAAI,SAA4B,EAAE,MAAc,EAAE,OAAiB;;;;;;oBAClG,GAAG,GAAG,SAAS,CAAC,MAAM,CAAS,uBAAuB,EAAE,EAAE,MAAM,QAAA,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC;oBAC9F,IAAI,CAAC,GAAG;wBAAE,MAAM,IAAI,KAAK,CAAC,kEAAkE,CAAC,CAAC;;wBAE5F,qBAAM,IAAI,OAAO,CAAO,UAAC,OAAO,IAAK,OAAA,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,EAAvB,CAAuB,CAAC,EAAA;;oBAA7D,SAA6D,CAAC;oBACxD,MAAM,GAAG,SAAS,CAAC,MAAM,CAA0C,sBAAsB,EAAE,EAAE,GAAG,KAAA,EAAE,CAAC,CAAC;oBAC1G,IAAI,CAAC,MAAM;wBAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;oBACnE,IAAI,CAAC,MAAM,CAAC,OAAO;wBAAE,sBAAO,IAAA,qCAAsB,EAAI,MAAM,CAAC,QAAQ,CAAC,EAAC;;;;;;;CAE1E"}
@@ -0,0 +1,28 @@
1
+ import type { FTResolvedReplayImagePolicy } from './validation.js';
2
+ export declare const REPLAY_KEY_FRAME_BURST_BYTES: number;
3
+ export interface FTReplayCaptureDecision {
4
+ allowed: boolean;
5
+ compressionQuality: number;
6
+ maxImageDimension: number;
7
+ maxFrameBytes: number;
8
+ usedBytes: number;
9
+ priority: boolean;
10
+ reason?: 'budget' | 'throttle';
11
+ }
12
+ /** Rolling image budget. Segment and pointer bytes intentionally remain outside this controller. */
13
+ export declare class FTReplayBudget {
14
+ private readonly policy;
15
+ private entries;
16
+ private lastCaptureAttempt;
17
+ private burstKeys;
18
+ private pressure;
19
+ constructor(policy: FTResolvedReplayImagePolicy);
20
+ reset(): void;
21
+ decide(timestamp: number, priorityKey?: string): FTReplayCaptureDecision;
22
+ record(timestamp: number, byteSize: number, priorityKey?: string): void;
23
+ usedBytes(timestamp: number): number;
24
+ private prune;
25
+ private decision;
26
+ private updatePressure;
27
+ }
28
+ //# sourceMappingURL=replay-budget.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay-budget.d.ts","sourceRoot":"","sources":["../../../../../src/session-replay/core/replay-budget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,iBAAiB,CAAC;AAInE,eAAO,MAAM,4BAA4B,QAAa,CAAC;AAOvD,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;CAChC;AAED,oGAAoG;AACpG,qBAAa,cAAc;IAMb,OAAO,CAAC,QAAQ,CAAC,MAAM;IALnC,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,SAAS,CAAgB;IACjC,OAAO,CAAC,QAAQ,CAA4D;gBAE/C,MAAM,EAAE,2BAA2B;IAEhE,KAAK,IAAI,IAAI;IAOb,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,uBAAuB;IA6CxE,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI;IAUvE,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAKpC,OAAO,CAAC,KAAK;IAKb,OAAO,CAAC,QAAQ;IA2BhB,OAAO,CAAC,cAAc;CA0BvB"}