@skinhub/viewer 0.1.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/EMBED.md +105 -7
- package/README.md +47 -26
- package/dist/SkinViewer.js +1 -1
- package/dist/SkinViewer.js.map +1 -1
- package/dist/index.d.ts +10 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/item.d.ts +26 -1
- package/dist/item.d.ts.map +1 -1
- package/dist/item.js +37 -8
- package/dist/item.js.map +1 -1
- package/dist/protocol.d.ts +38 -1
- package/dist/protocol.d.ts.map +1 -1
- package/dist/protocol.js.map +1 -1
- package/dist/state.d.ts +25 -4
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +139 -12
- package/dist/state.js.map +1 -1
- package/dist/types.d.ts +118 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/SkinViewer.tsx +1 -1
- package/src/index.ts +13 -0
- package/src/item.ts +72 -1
- package/src/protocol.ts +32 -1
- package/src/state.ts +166 -15
- package/src/types.ts +144 -1
package/EMBED.md
CHANGED
|
@@ -8,6 +8,11 @@ no account, and no signup. Two ways to drive it:
|
|
|
8
8
|
| **The URL** | an `<iframe src>` | the complete initial picture: item, float, seed, stickers, charm, view, agent, gloves, lighting, quality |
|
|
9
9
|
| **`postMessage`** | ~10 lines of JavaScript | live updates on top of that, plus `ready` / `error` / `change` events |
|
|
10
10
|
|
|
11
|
+
**Five kinds of item are inspectable**, each with its own parameter: a weapon or glove
|
|
12
|
+
(`?weapon=`+`?paint=`), a sticker (`?sticker=`), a charm (`?charm=`), a collectible - pin, coin, medal
|
|
13
|
+
or trophy - (`?collectible=`), and an operator (`?subject=agent&agent=`). See
|
|
14
|
+
[the other four subjects](#the-other-four-subjects---a-sticker-a-charm-a-collectible-an-operator).
|
|
15
|
+
|
|
11
16
|
**The URL alone is a supported, first-class integration.** If your stack is PHP, Rails, Laravel, plain
|
|
12
17
|
HTML or anything else that renders on a server, you can interpolate an item into an `src` attribute
|
|
13
18
|
and be finished. Everything on this page above the "Live updates" heading works with JavaScript
|
|
@@ -79,6 +84,74 @@ Loads the legacy mesh variant. Most finishes declare this themselves and it is i
|
|
|
79
84
|
those that do not, from your catalogue's `legacy_model` column. It changes which textures apply, so
|
|
80
85
|
the wrong value is the wrong picture rather than a detail.
|
|
81
86
|
|
|
87
|
+
### The other four subjects - a sticker, a charm, a collectible, an operator
|
|
88
|
+
|
|
89
|
+
A weapon is one of **five** things the viewer draws, and a glove is not one of the other four - a glove
|
|
90
|
+
is a `?weapon=` id like any other. Each of the remaining four is named by its own parameter, and naming
|
|
91
|
+
it is the whole URL:
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
?sticker=37 one sticker, on nothing - the real holo/foil/glitter shader
|
|
95
|
+
?charm=5 one charm, off the gun
|
|
96
|
+
?collectible=874 one pin, coin, medal or trophy
|
|
97
|
+
?subject=agent&agent=5036 one operator, alone
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
| parameter | meaning | default |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| `sticker` | a `stickers.json` id. **Implies `subject=sticker`** | - |
|
|
103
|
+
| `wear` | that sticker's scratch, `0` (mint) to `1` (scraped off) | `0` |
|
|
104
|
+
| `charm` | a `keychains.json` id. **Implies `subject=charm`** | - |
|
|
105
|
+
| `pattern` | the charm's template - a hue/saturation/brightness adjust on its own albedo, not a different model | `0` |
|
|
106
|
+
| `collectible` | a `collectibles.json` item definition index. **Implies `subject=collectible`** | - |
|
|
107
|
+
| `subject` | `weapon`, `sticker`, `charm`, `collectible`, `agent` - read last, so it always wins | `weapon` |
|
|
108
|
+
|
|
109
|
+
**`?pattern=` and not `?seed=`,** because `seed` on this URL is already the weapon's paint seed.
|
|
110
|
+
|
|
111
|
+
**Two subjects in one URL:** the last one named wins, reading `sticker` → `charm` → `collectible` →
|
|
112
|
+
`subject`. There is no reason to send two; the rule exists only so that a URL which does still means
|
|
113
|
+
something.
|
|
114
|
+
|
|
115
|
+
In `@skinhub/viewer` each of the four is its own prop, and exactly one may be passed:
|
|
116
|
+
|
|
117
|
+
```jsx
|
|
118
|
+
<SkinViewer sticker={{ id: 37, wear: 0.2 }} />
|
|
119
|
+
<SkinViewer charm={{ id: 5, pattern: 900 }} />
|
|
120
|
+
<SkinViewer collectible={{ id: 874 }} />
|
|
121
|
+
<SkinViewer operator={{ id: 5036 }} />
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
#### The operator is the one that needs `?subject=`
|
|
125
|
+
|
|
126
|
+
`?agent=5036` has always meant **which operator**, and it keeps meaning exactly that. What changes is
|
|
127
|
+
what is on screen:
|
|
128
|
+
|
|
129
|
+
| | what you see |
|
|
130
|
+
|---|---|
|
|
131
|
+
| `?weapon=weapon_ak47&paint=1449&view=agent&agent=5036` | the operator **holding your weapon** |
|
|
132
|
+
| `?subject=agent&agent=5036` | the operator **alone**, no weapon drawn |
|
|
133
|
+
|
|
134
|
+
If your database row is an agent, you want the second: the first would put a rifle nobody asked for
|
|
135
|
+
into the picture. In the React package these are the `agent` prop (a modifier on the weapon subject)
|
|
136
|
+
and the `operator` prop (the person as the subject) - two words because they are two pictures.
|
|
137
|
+
|
|
138
|
+
`?pose=` works in both - 285 main-menu clips across 44 weapon families - and with no weapon on screen
|
|
139
|
+
it defaults to that team's own knife idle rather than matching a gun. The weapon each clip is
|
|
140
|
+
*holding* is never drawn, so `Look at gun` is an operator studying an empty hand.
|
|
141
|
+
|
|
142
|
+
#### What each subject does **not** have
|
|
143
|
+
|
|
144
|
+
A collectible has no float, no seed, no wear, no template and no pose - two copies of the same medal
|
|
145
|
+
are the same object, and `?collectible=874` is the entire configuration. None of the four takes
|
|
146
|
+
`?view=`, `?i=`, `?float=`, `?slot=` or the sticker slots: those are all statements about a weapon, and
|
|
147
|
+
`?view=` in particular answers "what is the weapon being shown *on*", which is not a question a sticker
|
|
148
|
+
has. They are ignored rather than rejected, and everything in §5 (lighting, background, quality, orbit,
|
|
149
|
+
zoom) applies to all five subjects identically.
|
|
150
|
+
|
|
151
|
+
An id of `0`, or one your catalogue does not have, renders **nothing** - deliberately. `sticker_id: 0`
|
|
152
|
+
is how the game itself says "empty slot", and drawing our default AK-47 for it would look exactly like
|
|
153
|
+
a successful render of the wrong item.
|
|
154
|
+
|
|
82
155
|
---
|
|
83
156
|
|
|
84
157
|
## 3. Configuring the item
|
|
@@ -248,7 +321,11 @@ Every message in both directions carries these three fields:
|
|
|
248
321
|
|
|
249
322
|
```js
|
|
250
323
|
set({
|
|
251
|
-
|
|
324
|
+
subject: 'weapon' | 'sticker' | 'charm' | 'collectible' | 'agent',
|
|
325
|
+
item: { weaponType, paintIndex, legacyModel, float, seed, statTrak, nameTag, stickers },
|
|
326
|
+
sticker: { id, wear },
|
|
327
|
+
charm: { id, pattern },
|
|
328
|
+
collectible: { id },
|
|
252
329
|
view: 'gun' | 'hands' | 'agent',
|
|
253
330
|
agent: { id, pose },
|
|
254
331
|
gloves: { type, paintIndex, float, seed } | null,
|
|
@@ -268,6 +345,13 @@ keeps your weapon, your stickers and your name plate. `set({ settings: { quality
|
|
|
268
345
|
keeps the camera and the environment. This is not just convenience - see
|
|
269
346
|
[cheap vs reload](#cheap-vs-reload).
|
|
270
347
|
|
|
348
|
+
**All five subjects are held at once, and only `subject` switches between them.**
|
|
349
|
+
`set({ sticker: { id: 37 } })` *configures* the sticker; `set({ subject: 'sticker' })` *shows* it. Send
|
|
350
|
+
both to do both. The split is what lets you pre-load the pin a visitor is about to open without
|
|
351
|
+
disturbing the rifle on screen, and what stops a host that restates its whole state on every render
|
|
352
|
+
from flipping subject whenever two groups happen to be present. Switching back is one field -
|
|
353
|
+
`set({ subject: 'weapon' })` - and the weapon is exactly where you left it.
|
|
354
|
+
|
|
271
355
|
**`null` is a value, not an absence**, wherever it means something: `nameTag: null` is no plate,
|
|
272
356
|
`statTrak: false` is no counter, `gloves: null` is the wearer's own default pair, `agent.pose: null` is
|
|
273
357
|
"match the weapon", `settings.environment.map: null` is our calibrated reference rig.
|
|
@@ -306,6 +390,18 @@ This is the part that decides whether the embed feels like a component or like a
|
|
|
306
390
|
| `float`, `seed`, `statTrak`, `nameTag`, stickers, the charm, **anything under `settings` or `interactions`** | **updates in place.** No loading card, no blank frame, no dropped frames. Drive it from a slider at 60 Hz |
|
|
307
391
|
| `item.weaponType`, `item.paintIndex`, `item.legacyModel`, `view`, and `agent.id` in the `agent` view | **reloads.** The viewer covers itself until the new model has actually drawn, and shows nothing rather than something half-built |
|
|
308
392
|
|
|
393
|
+
The same split, for the other four subjects:
|
|
394
|
+
|
|
395
|
+
| subject | reloads | updates in place |
|
|
396
|
+
|---|---|---|
|
|
397
|
+
| `sticker` | `sticker.id` | `sticker.wear` |
|
|
398
|
+
| `charm` | `charm.id` | `charm.pattern` |
|
|
399
|
+
| `collectible` | `collectible.id` | *nothing - there is no other field* |
|
|
400
|
+
| `agent` | `agent.id` | `agent.pose` |
|
|
401
|
+
|
|
402
|
+
**Changing `subject` always reloads**, in every direction: a weapon and a pin are drawn by different
|
|
403
|
+
renderers, so the picture is rebuilt from nothing.
|
|
404
|
+
|
|
309
405
|
Measured across the frame boundary: 140 `set` messages carrying a moving float, plus seed, StatTrak,
|
|
310
406
|
a name plate, a bloom change and a map change, produced **zero covered frames** over 93 drawn frames
|
|
311
407
|
and 979 samples.
|
|
@@ -426,16 +522,18 @@ Honest list, so none of it is discovered late.
|
|
|
426
522
|
and remove it on `ready`.
|
|
427
523
|
- **Click-through.** See §9.
|
|
428
524
|
- **Server-side rendering.** The viewer is WebGL; there is no server-rendered fallback image.
|
|
429
|
-
- **Render to an image.** There is no `capture()
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
525
|
+
- **Render to an image.** There is no `capture()`: the canvas runs without a preserved drawing buffer,
|
|
526
|
+
so a read from outside the render loop comes back blank. A PNG per item wants a render with no
|
|
527
|
+
browser tab open anyway, and that is a separate service and is not built.
|
|
528
|
+
- **Resolve an inspect link on its own.** `?i=` carries the item's *configuration* - float, seed,
|
|
529
|
+
StatTrak, name plate, stickers, charm - but not which weapon, so a raw-iframe integration still has
|
|
433
530
|
to send `?weapon=`/`?paint=` (or `?hash=`) alongside it.
|
|
434
531
|
**This limit is the frame's, not the product's:** `@skinhub/viewer` takes an `inspectLink` prop and
|
|
435
532
|
handles the whole thing, because it decodes host-side and resolves the `defindex` against its own
|
|
436
533
|
weapon table before building the URL. If you are in React, you never see this.
|
|
437
|
-
- **
|
|
438
|
-
|
|
534
|
+
- **Draw two subjects at once.** One frame shows one thing - a weapon or glove, a sticker, a charm, a
|
|
535
|
+
collectible, or an operator (§2). An operator shown as the subject holds no weapon, and the four
|
|
536
|
+
standalone subjects ignore `?view=`, `?i=`, `?float=`, `?slot=` and the sticker slots.
|
|
439
537
|
- **Style anything.** The frame is our document. `gizmocolor` and `gizmoshadow` are the only visual
|
|
440
538
|
hooks.
|
|
441
539
|
- **Two viewers cheaply.** Each frame is its own WebGL context. If you need a grid of them, drop
|
package/README.md
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# @skinhub/viewer
|
|
2
2
|
|
|
3
|
-
The SkinHub CS2 skin viewer as a React component
|
|
4
|
-
with stickers and a charm
|
|
5
|
-
`three` and no assets. React is the only peer
|
|
3
|
+
The SkinHub CS2 skin viewer as a React component - any weapon, knife or glove, at any wear and seed,
|
|
4
|
+
with stickers and a charm, or a sticker, charm, collectible or agent on its own. The 3D runs in an
|
|
5
|
+
iframe on our origin, so installing this pulls in no `three` and no assets. React is the only peer
|
|
6
|
+
dependency.
|
|
6
7
|
|
|
7
8
|
```bash
|
|
8
9
|
bun add @skinhub/viewer @skinhub/cdn
|
|
@@ -21,13 +22,23 @@ export default function Page() {
|
|
|
21
22
|
}
|
|
22
23
|
```
|
|
23
24
|
|
|
24
|
-
Or straight from a Steam inspect link
|
|
25
|
+
Or straight from a Steam inspect link - float, seed, StatTrak, name plate, stickers and charm all come
|
|
25
26
|
out of it:
|
|
26
27
|
|
|
27
28
|
```tsx
|
|
28
29
|
<SkinViewer inspectLink={item.inspectLink} style={{ width: 640, height: 420 }} />
|
|
29
30
|
```
|
|
30
31
|
|
|
32
|
+
A weapon is one of five things the viewer draws, and each of the other four is its own prop. They are
|
|
33
|
+
drawn on their own, with no gun in the picture:
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
<SkinViewer sticker={{ id: 37, wear: 0.2 }} /> // the real holo/foil shader, not an image on a plane
|
|
37
|
+
<SkinViewer charm={{ id: 5 }} />
|
|
38
|
+
<SkinViewer collectible={{ id: 874 }} /> // a pin, coin, medal or trophy
|
|
39
|
+
<SkinViewer operator={{ id: 5036 }} /> // an agent, alone
|
|
40
|
+
```
|
|
41
|
+
|
|
31
42
|
Two things worth knowing up front:
|
|
32
43
|
|
|
33
44
|
- **Give it a size.** It fills its container and has no intrinsic size; at 0 px you see nothing.
|
|
@@ -36,34 +47,44 @@ Two things worth knowing up front:
|
|
|
36
47
|
|
|
37
48
|
## Props
|
|
38
49
|
|
|
39
|
-
|
|
50
|
+
Exactly one subject is required - `item`, `inspectLink`, `sticker`, `charm`, `collectible` or
|
|
51
|
+
`operator`. Passing two, or none, is a type error. Everything else is optional.
|
|
40
52
|
|
|
41
53
|
| prop | type | default | |
|
|
42
54
|
|---|---|---|---|
|
|
43
|
-
| `item` | `{ weapon \| defindex, paintIndex, float?, seed?, statTrak?, nameTag?, legacyModel?, stickers?, charm? }` |
|
|
44
|
-
| `inspectLink` | `string` |
|
|
55
|
+
| `item` | `{ weapon \| defindex, paintIndex, float?, seed?, statTrak?, nameTag?, legacyModel?, stickers?, charm? }` | - | the item. `paintIndex: 0` is vanilla |
|
|
56
|
+
| `inspectLink` | `string` | - | a masked Steam inspect link, instead of `item` |
|
|
57
|
+
| `sticker` | `{ id, wear? }` | - | one sticker on nothing. `wear` is `0` (mint) to `1` |
|
|
58
|
+
| `charm` | `{ id, pattern? }` | - | one charm. `pattern` is its colour template, not a different model |
|
|
59
|
+
| `collectible` | `{ id }` | - | one pin, coin, medal or trophy. It has no other field |
|
|
60
|
+
| `operator` | `{ id, pose? }` | - | one agent alone. `pose` is a main-menu clip name, `null` for their idle |
|
|
45
61
|
| `origin` | `string` | `https://skinhub.gg` | where the embed is served. Read once, on mount |
|
|
46
62
|
| `view` | `'gun' \| 'hands' \| 'agent'` | `'gun'` | item alone, first-person, or held by an operator |
|
|
47
|
-
| `agent` | `{ id, pose? }` | default T | the
|
|
63
|
+
| `agent` | `{ id, pose? }` | default T | who is *holding* the weapon, in `hands` and `agent`. `operator` is the agent shown alone |
|
|
48
64
|
| `gloves` | `{ type, paintIndex, float?, seed? } \| null` | `null` | `null` is the wearer's own pair |
|
|
49
65
|
| `settings` | `{ camera?, quality?, environment?, overlays? }` | see below | shallow-merged per group |
|
|
50
66
|
| `interactions` | `{ orbit?, zoom?, dragStickers?, dragCharm? }` | orbit + zoom on | what the user may do |
|
|
51
67
|
| `editingSlot` | `number` | `-1` | which sticker slot is open; `5` is the charm |
|
|
52
|
-
| `onReady` | `() => void` |
|
|
53
|
-
| `onError` | `(error) => void` |
|
|
54
|
-
| `onChange` | `(item) => void` |
|
|
55
|
-
| `onResize` | `({ width, height, dpr }) => void` |
|
|
56
|
-
| `onEditingSlotChange` | `(slot) => void` |
|
|
57
|
-
| `loading` / `fallback` | `ReactNode` |
|
|
68
|
+
| `onReady` | `() => void` | - | stopped loading - **a level, not an edge**: it fires again after every weapon or view change |
|
|
69
|
+
| `onError` | `(error) => void` | - | `no-item`, `bad-inspect-link`, `unknown-weapon`, `unreachable`, `render-failed`, `protocol-mismatch`, `bad-message` |
|
|
70
|
+
| `onChange` | `(item) => void` | - | the user dragged a sticker or the charm - **carries ids, not names**, see below |
|
|
71
|
+
| `onResize` | `({ width, height, dpr }) => void` | - | the canvas box changed |
|
|
72
|
+
| `onEditingSlotChange` | `(slot) => void` | - | |
|
|
73
|
+
| `loading` / `fallback` | `ReactNode` | - | your skeleton, and your empty state on error |
|
|
58
74
|
| `className` / `style` / `title` | | | on the wrapper |
|
|
59
|
-
| `handle` | `SkinViewerHandle` |
|
|
75
|
+
| `handle` | `SkinViewerHandle` | - | from `useSkinViewer()` |
|
|
60
76
|
|
|
61
77
|
`settings.environment.background` defaults to `'transparent'`, so the canvas composites over your page.
|
|
62
78
|
`quality.bloomSpill` ships at `0` here. `MAP_NAMES` and `WEAPON_IDS` are exported as values for
|
|
63
79
|
building pickers.
|
|
64
80
|
|
|
65
|
-
|
|
66
|
-
|
|
81
|
+
`view`, `agent`, `gloves` and `editingSlot` describe a weapon, and the other four subjects ignore them.
|
|
82
|
+
`settings` and `interactions` apply to all six.
|
|
83
|
+
|
|
84
|
+
Changing `float`, `seed`, `statTrak`, `nameTag`, `stickers` or `charm` updates **in place** - no
|
|
85
|
+
reload, no flicker. Changing the weapon, paint index, legacy variant or view shows a loading cover. On
|
|
86
|
+
the other four subjects `sticker.wear`, `charm.pattern` and `operator.pose` are the in-place ones; the
|
|
87
|
+
id, and switching which subject you pass, reloads.
|
|
67
88
|
|
|
68
89
|
### Copying the item back out
|
|
69
90
|
|
|
@@ -79,7 +100,7 @@ the decoded `@skinhub/cdn` placement if you want to write database rows instead.
|
|
|
79
100
|
### `onChange` gives you ids, not names
|
|
80
101
|
|
|
81
102
|
The embed has never seen the sticker catalogue, so the item it hands back has `stickers: [{ id: 5032,
|
|
82
|
-
… }]` and no name or image. **`setItem(changed)` will therefore blank those out of your own UI**
|
|
103
|
+
… }]` and no name or image. **`setItem(changed)` will therefore blank those out of your own UI** - a
|
|
83
104
|
silent data loss in your state, with nothing to catch. Merge it into what you already hold instead:
|
|
84
105
|
|
|
85
106
|
```tsx
|
|
@@ -104,7 +125,7 @@ instance while developing:
|
|
|
104
125
|
<SkinViewer item={item} origin="http://localhost:3000" />
|
|
105
126
|
```
|
|
106
127
|
|
|
107
|
-
It is read once, at mount
|
|
128
|
+
It is read once, at mount - it is the one prop that could only be applied by reloading the frame.
|
|
108
129
|
|
|
109
130
|
## useSkinViewer()
|
|
110
131
|
|
|
@@ -123,31 +144,31 @@ viewer.reload()
|
|
|
123
144
|
|
|
124
145
|
**A CORS error fetching the catalogue.** `cdn.skinhub.gg` does not send
|
|
125
146
|
`access-control-allow-origin`, so a **browser** `fetch` for `data/skins.json` is blocked by the
|
|
126
|
-
browser before your code sees it
|
|
147
|
+
browser before your code sees it - it surfaces as a CORS failure rather than a status, so you cannot
|
|
127
148
|
even catch it. Call `@skinhub/cdn` from your **server** (a route handler, `getServerSideProps`, an RSC)
|
|
128
149
|
and pass the rows down. The files are 4–6 MB each, so you want them server-side regardless.
|
|
129
150
|
|
|
130
151
|
**Nothing renders.** If the container is 0 px in one dimension you get an empty box; the component
|
|
131
152
|
warns about that in development. Otherwise `onError` reports `unreachable` after 15 seconds, naming the
|
|
132
|
-
URL it could not reach
|
|
153
|
+
URL it could not reach - that means the embed never answered, so check the origin is reachable from
|
|
133
154
|
this browser and that your page's `Content-Security-Policy` allows framing it (`frame-src`).
|
|
134
155
|
|
|
135
156
|
**`onReady` fired but the picture is still covered.** `onReady` means "stopped loading" for the current
|
|
136
157
|
identity, and it fires again after every weapon or view change. Treat it as a level, not an edge.
|
|
137
158
|
|
|
138
159
|
**`protocol-mismatch`.** This package and the embed disagree about the wire. There is no back-compat
|
|
139
|
-
window by design: update `@skinhub/viewer`, or reload the embed if it is the stale one
|
|
160
|
+
window by design: update `@skinhub/viewer`, or reload the embed if it is the stale one - the error
|
|
140
161
|
message says which.
|
|
141
162
|
|
|
142
163
|
## More
|
|
143
164
|
|
|
144
|
-
- **[Quick-start app](https://github.com/SkinHubgg/
|
|
165
|
+
- **[Quick-start app](https://github.com/SkinHubgg/viewer-quick-start)** - a working skin picker built
|
|
145
166
|
on this and `@skinhub/cdn`, ending in an inspect link. The full example.
|
|
146
|
-
- **[EMBED.md](./EMBED.md)**
|
|
167
|
+
- **[EMBED.md](./EMBED.md)** - the raw `<iframe>` URL and `postMessage` contract, for stacks that are
|
|
147
168
|
not React. A PHP, Rails or plain-HTML page can interpolate an item into an `src` and be done; that
|
|
148
169
|
path is first-class, not a fallback.
|
|
149
|
-
- **[@skinhub/cdn](https://github.com/SkinHubgg/skinhub-cdn)**
|
|
170
|
+
- **[@skinhub/cdn](https://github.com/SkinHubgg/skinhub-cdn)** - the CS2 catalogue this pairs with:
|
|
150
171
|
skins, stickers, gloves, agents, and the inspect-link codec.
|
|
151
|
-
- [Development and releasing](./CONTRIBUTING.md)
|
|
172
|
+
- [Development and releasing](./CONTRIBUTING.md) - how the wire is kept in step with the embed.
|
|
152
173
|
|
|
153
174
|
MIT
|
package/dist/SkinViewer.js
CHANGED
|
@@ -161,7 +161,7 @@ export const SkinViewer = (props) => {
|
|
|
161
161
|
* showing, or the next real item would be diffed against a hole and sent in full for no reason.
|
|
162
162
|
*/
|
|
163
163
|
sent.current = { ...next, item: next.item ?? sent.current.item };
|
|
164
|
-
if (coversCanvas(patch, next
|
|
164
|
+
if (coversCanvas(patch, next)) {
|
|
165
165
|
setStatus('loading');
|
|
166
166
|
// A NEW ITEM IS A NEW CHANCE. A lost GL context or a 404 on one model says nothing about the
|
|
167
167
|
// next one, so the fallback comes down and the frame is allowed to try. A protocol mismatch is
|
package/dist/SkinViewer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkinViewer.js","sourceRoot":"","sources":["../src/SkinViewer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEhE,OAAO,EAAE,WAAW,EAAE,cAAc,EAAmB,MAAM,eAAe,CAAA;AAC5E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,SAAS,EA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ACnD;;;;;;;eAOG;YACH,cAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,EAAE,aAAa,EAAE,MAAM,EAAE,YAAG,OAAO,GAAO,CACtF,IACI,CACN,CAAA;AACF,CAAC,CAAA;AAED,MAAM,cAAc,GAAG,CAAC,QAAqC,EAAE,KAAsB,EAAE,EAAE,CACxF,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,6 +6,15 @@
|
|
|
6
6
|
* <SkinViewer item={{ weapon: 'weapon_ak47', paintIndex: 1449, float: 0.27 }} style={{ height: 420 }} />
|
|
7
7
|
* <SkinViewer inspectLink={tradeOffer.inspectLink} style={{ height: 420 }} />
|
|
8
8
|
*
|
|
9
|
+
* A weapon (or a glove) is one of SIX ways to name a subject, and each is its own prop:
|
|
10
|
+
*
|
|
11
|
+
* <SkinViewer sticker={{ id: 37, wear: 0.2 }} /> one sticker, the real holo/foil shader
|
|
12
|
+
* <SkinViewer charm={{ id: 5 }} /> one charm, off the gun
|
|
13
|
+
* <SkinViewer collectible={{ id: 874 }} /> one pin, coin, medal or trophy
|
|
14
|
+
* <SkinViewer operator={{ id: 5036 }} /> one agent, alone
|
|
15
|
+
*
|
|
16
|
+
* Exactly one of the six, enforced in the types - see `ViewerSubject`.
|
|
17
|
+
*
|
|
9
18
|
* The 3D is not in here. It is a page on our origin that this component embeds and drives over
|
|
10
19
|
* `postMessage`, which is why installing this pulls in no `three`, no `@react-three/fiber` and no
|
|
11
20
|
* asset bundle - the only peer dependency is React. `EMBED.md` documents the same contract for stacks
|
|
@@ -46,7 +55,7 @@ export { useSkinViewer } from './useSkinViewer.js';
|
|
|
46
55
|
* when it can hand you the link. See `item.ts` for the three easy-to-get-wrong facts these encode.
|
|
47
56
|
*/
|
|
48
57
|
export { fromInspectLink, toInspectLink, toPlacement } from './item.js';
|
|
49
|
-
export type { MapName, SkinViewerCharm, SkinViewerError, SkinViewerErrorCode, SkinViewerHandle, SkinViewerItem, SkinViewerProps, SkinViewerSticker, TimeOfDay, ViewerAgent, ViewerBackground, ViewerCameraSettings, ViewerEnvironmentSettings, ViewerGloves, ViewerInteractions, ViewerOverlaySettings, ViewerQualitySettings, ViewerResize, ViewerSettings, ViewerStatus, ViewerSubject, ViewerView, } from './types.js';
|
|
58
|
+
export type { MapName, SkinViewerCharm, SkinViewerError, SkinViewerErrorCode, SkinViewerHandle, SkinViewerItem, SkinViewerProps, SkinViewerSticker, TimeOfDay, ViewerAgent, ViewerBackground, ViewerCameraSettings, ViewerCharmSubject, ViewerCollectibleSubject, ViewerEnvironmentSettings, ViewerGloves, ViewerInteractions, ViewerOperatorSubject, ViewerOverlaySettings, ViewerQualitySettings, ViewerResize, ViewerSettings, ViewerStatus, ViewerStickerSubject, ViewerSubject, ViewerView, } from './types.js';
|
|
50
59
|
export { CHEAP_FIELDS, MAP_NAMES } from './types.js';
|
|
51
60
|
export type { KnownWeaponId, WeaponId } from './weapons.js';
|
|
52
61
|
export { defindexForWeaponId, isGloveId, isKnownWeaponId, normalizeWeaponId, WEAPON_ID_ALIASES, WEAPON_ID_BY_DEFINDEX, WEAPON_IDS, weaponIdForDefindex, } from './weapons.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEvE,YAAY,EACX,OAAO,EACP,eAAe,EACf,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,yBAAyB,EACzB,YAAY,EACZ,kBAAkB,EAClB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,aAAa,EACb,UAAU,GACV,MAAM,YAAY,CAAA;AACnB,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAEpD,YAAY,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC3D,OAAO,EACN,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,mBAAmB,GACnB,MAAM,cAAc,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,15 @@
|
|
|
6
6
|
* <SkinViewer item={{ weapon: 'weapon_ak47', paintIndex: 1449, float: 0.27 }} style={{ height: 420 }} />
|
|
7
7
|
* <SkinViewer inspectLink={tradeOffer.inspectLink} style={{ height: 420 }} />
|
|
8
8
|
*
|
|
9
|
+
* A weapon (or a glove) is one of SIX ways to name a subject, and each is its own prop:
|
|
10
|
+
*
|
|
11
|
+
* <SkinViewer sticker={{ id: 37, wear: 0.2 }} /> one sticker, the real holo/foil shader
|
|
12
|
+
* <SkinViewer charm={{ id: 5 }} /> one charm, off the gun
|
|
13
|
+
* <SkinViewer collectible={{ id: 874 }} /> one pin, coin, medal or trophy
|
|
14
|
+
* <SkinViewer operator={{ id: 5036 }} /> one agent, alone
|
|
15
|
+
*
|
|
16
|
+
* Exactly one of the six, enforced in the types - see `ViewerSubject`.
|
|
17
|
+
*
|
|
9
18
|
* The 3D is not in here. It is a page on our origin that this component embeds and drives over
|
|
10
19
|
* `postMessage`, which is why installing this pulls in no `three`, no `@react-three/fiber` and no
|
|
11
20
|
* asset bundle - the only peer dependency is React. `EMBED.md` documents the same contract for stacks
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAElD;;;GAGG;AACH,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AA8BvE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAGpD,OAAO,EACN,mBAAmB,EACnB,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACV,mBAAmB,GACnB,MAAM,cAAc,CAAA"}
|
package/dist/item.d.ts
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
* use us - That is stated as a requirement and it is the path the product exists for.
|
|
31
31
|
*/
|
|
32
32
|
import { type SkinPlacement } from '@skinhub/cdn/placement';
|
|
33
|
-
import type { FrameItem, PlacementSlots } from './protocol.js';
|
|
33
|
+
import type { FrameCharm, FrameCollectible, FrameItem, FrameSticker, FrameSubjectKind, PlacementSlots } from './protocol.js';
|
|
34
34
|
import type { SkinViewerCharm, SkinViewerError, SkinViewerItem, SkinViewerSticker, ViewerSubject } from './types.js';
|
|
35
35
|
/**
|
|
36
36
|
* The public sticker list and charm as the six-slot tuple the frame validates.
|
|
@@ -74,6 +74,31 @@ export type ResolvedSubject = {
|
|
|
74
74
|
* build the frame's URL in a `useState` initialiser and have the FIRST PAINT be the integrator's item
|
|
75
75
|
* rather than ours swapped a tick later.
|
|
76
76
|
*/
|
|
77
|
+
/**
|
|
78
|
+
* *** THE OTHER FOUR SUBJECTS, RESOLVED BEFORE THE WEAPON IS EVEN LOOKED FOR. ***
|
|
79
|
+
*
|
|
80
|
+
* Returns null when the props name none of them, which is what sends {@link resolveSubject} on to the
|
|
81
|
+
* `inspectLink` / `item` pair below. The ORDER is the arm order in `types.ts` and it only matters for
|
|
82
|
+
* props that bypassed the types (plain JavaScript, an `any`), where naming two subjects has to mean
|
|
83
|
+
* SOMETHING - it means the first one on this list.
|
|
84
|
+
*
|
|
85
|
+
* *** AN ID THAT IS NOT A POSITIVE INTEGER IS `no-item`, NOT A ZERO. *** `sticker_id: 0` IS the empty
|
|
86
|
+
* slot throughout the renderer, so passing it through would ask the frame to draw an item that by
|
|
87
|
+
* definition does not exist; the instruction card plus an `onError` is a far better answer than an
|
|
88
|
+
* empty canvas. This is the same "data had not arrived yet" case the `no-item` code exists for.
|
|
89
|
+
*/
|
|
90
|
+
export type ResolvedStandalone = {
|
|
91
|
+
subject: Exclude<FrameSubjectKind, 'weapon'>;
|
|
92
|
+
sticker?: FrameSticker;
|
|
93
|
+
charm?: FrameCharm;
|
|
94
|
+
collectible?: FrameCollectible;
|
|
95
|
+
agent?: {
|
|
96
|
+
id: number;
|
|
97
|
+
pose?: string | null;
|
|
98
|
+
};
|
|
99
|
+
error: SkinViewerError | null;
|
|
100
|
+
};
|
|
101
|
+
export declare const resolveStandalone: (props: Partial<ViewerSubject>) => ResolvedStandalone | null;
|
|
77
102
|
export declare const resolveSubject: (subject: Partial<ViewerSubject>) => ResolvedSubject;
|
|
78
103
|
/**
|
|
79
104
|
* The frame's item as the public one - what {@link SkinViewerProps.onChange} hands back.
|
package/dist/item.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../src/item.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,EAAkD,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE3G,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"item.d.ts","sourceRoot":"","sources":["../src/item.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAGH,OAAO,EAAkD,KAAK,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAE3G,OAAO,KAAK,EACX,UAAU,EACV,gBAAgB,EAChB,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,MAAM,eAAe,CAAA;AACtB,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAgBpH;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,OAAO,GACnB,UAAU,SAAS,CAAC,iBAAiB,GAAG,IAAI,CAAC,EAAE,GAAG,SAAS,EAC3D,OAAO,eAAe,GAAG,IAAI,GAAG,SAAS,KACvC,cAAc,GAAG,SAkCnB,CAAA;AAED,2FAA2F;AAC3F,eAAO,MAAM,SAAS,GACrB,OAAO,cAAc,GAAG,SAAS,KAC/B;IAAE,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAAC,KAAK,EAAE,eAAe,GAAG,IAAI,CAAA;CAyBhE,CAAA;AAMD,MAAM,MAAM,eAAe,GACxB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,IAAI,CAAA;CAAE;AACjE;;;;;GAKG;GACD;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,cAAc,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,eAAe,CAAA;CAAE,CAAA;AA+B/D;;;;;;;GAOG;AACH;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAChC,OAAO,EAAE,OAAO,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAA;IAC5C,OAAO,CAAC,EAAE,YAAY,CAAA;IACtB,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,WAAW,CAAC,EAAE,gBAAgB,CAAA;IAC9B,KAAK,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAA;IAC5C,KAAK,EAAE,eAAe,GAAG,IAAI,CAAA;CAC7B,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,CAAC,aAAa,CAAC,KAAG,kBAAkB,GAAG,IAiCtF,CAAA;AASD,eAAO,MAAM,cAAc,GAAI,SAAS,OAAO,CAAC,aAAa,CAAC,KAAG,eAwFhE,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,SAAS,KAAG,cAa9C,CAAA;AAqBD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,cAAc,KAAG,aAqBlD,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,aAAa,GAAI,MAAM,cAAc,KAAG,MAA4C,CAAA;AAEjG;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,cAAc,GAAG,IAG/D,CAAA"}
|
package/dist/item.js
CHANGED
|
@@ -149,14 +149,43 @@ const fromPlacement = (placement, weaponType) => {
|
|
|
149
149
|
stickers: slots,
|
|
150
150
|
};
|
|
151
151
|
};
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
152
|
+
export const resolveStandalone = (props) => {
|
|
153
|
+
const bad = (subject, prop, id) => ({
|
|
154
|
+
subject,
|
|
155
|
+
error: {
|
|
156
|
+
code: 'no-item',
|
|
157
|
+
message: `\`${prop}.id\` must be a positive integer, got ${JSON.stringify(id)}. In TypeScript that is a compile error, so this is JavaScript, an \`any\`, or data that had not arrived yet.`,
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
const ok = (id) => typeof id === 'number' && Number.isSafeInteger(id) && id > 0;
|
|
161
|
+
if (props.sticker)
|
|
162
|
+
return ok(props.sticker.id)
|
|
163
|
+
? { subject: 'sticker', sticker: dropUndefined({ id: props.sticker.id, wear: props.sticker.wear }), error: null }
|
|
164
|
+
: bad('sticker', 'sticker', props.sticker.id);
|
|
165
|
+
if (props.charm)
|
|
166
|
+
return ok(props.charm.id)
|
|
167
|
+
? { subject: 'charm', charm: dropUndefined({ id: props.charm.id, pattern: props.charm.pattern }), error: null }
|
|
168
|
+
: bad('charm', 'charm', props.charm.id);
|
|
169
|
+
if (props.collectible)
|
|
170
|
+
return ok(props.collectible.id)
|
|
171
|
+
? { subject: 'collectible', collectible: { id: props.collectible.id }, error: null }
|
|
172
|
+
: bad('collectible', 'collectible', props.collectible.id);
|
|
173
|
+
/* `operator` BECOMES `agent` ON THE WIRE - see `FrameSubjectKind`. The pose rides in the same group
|
|
174
|
+
the weapon views use, because it is the same question (which performance) asked of the same row. */
|
|
175
|
+
if (props.operator)
|
|
176
|
+
return ok(props.operator.id)
|
|
177
|
+
? { subject: 'agent', agent: dropUndefined({ id: props.operator.id, pose: props.operator.pose }), error: null }
|
|
178
|
+
: bad('agent', 'operator', props.operator.id);
|
|
179
|
+
return null;
|
|
180
|
+
};
|
|
181
|
+
/** Drops keys the caller did not set, so "say nothing" survives into the URL and into the diff. */
|
|
182
|
+
const dropUndefined = (source) => {
|
|
183
|
+
const out = {};
|
|
184
|
+
for (const key of Object.keys(source))
|
|
185
|
+
if (source[key] !== undefined)
|
|
186
|
+
out[key] = source[key];
|
|
187
|
+
return out;
|
|
188
|
+
};
|
|
160
189
|
export const resolveSubject = (subject) => {
|
|
161
190
|
const fail = (code, message) => ({
|
|
162
191
|
item: null,
|
package/dist/item.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item.js","sourceRoot":"","sources":["../src/item.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAsB,MAAM,wBAAwB,CAAA;
|
|
1
|
+
{"version":3,"file":"item.js","sourceRoot":"","sources":["../src/item.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACtE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAsB,MAAM,wBAAwB,CAAA;AAW3G,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAA;AAE1F,oEAAoE;AACpE,MAAM,QAAQ,GAAG,CAAC,SAAiC,EAAE,EAAE,CAAC,SAAS,CAAC,UAAU,GAAG,CAAC,CAAA;AAEhF,0FAA0F;AAC1F,MAAM,UAAU,GAAG,GAAmB,EAAE,CAAC;IACxC,YAAY,CAAC,CAAC,CAAC;IACf,YAAY,CAAC,CAAC,CAAC;IACf,YAAY,CAAC,CAAC,CAAC;IACf,YAAY,CAAC,CAAC,CAAC;IACf,YAAY,CAAC,CAAC,CAAC;IACf,aAAa,EAAE;CACf,CAAA;AAED;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CACtB,QAA2D,EAC3D,KAAyC,EACZ,EAAE;IAC/B,IAAI,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,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