@omnigateway/pokemon 1.0.2 → 1.1.0
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/README.md +22 -2
- package/omni-plugin.json +2 -2
- package/package.json +1 -1
- package/server/index.js +1 -0
- package/ui/index.js +47 -47
package/README.md
CHANGED
|
@@ -70,8 +70,7 @@ from one readable file. It constrains honest code and not hostile code.
|
|
|
70
70
|
The plugin degrades rather than failing when a capability is absent. With no
|
|
71
71
|
`net`, an incubating egg holds its progress instead of losing it, and both
|
|
72
72
|
sprite routes answer `503` — the panel then draws each item as an emoji, which
|
|
73
|
-
is the same thing it draws before the cache has filled
|
|
74
|
-
draws for `mint`, whose icon does not exist upstream at all.
|
|
73
|
+
is the same thing it draws before the cache has filled.
|
|
75
74
|
|
|
76
75
|
## Nintendo and Game Freak intellectual property
|
|
77
76
|
|
|
@@ -108,6 +107,27 @@ is deliberate: a plugin developed inside the monorepo can reach packages an
|
|
|
108
107
|
installed plugin cannot, and a build that only succeeds there proves nothing
|
|
109
108
|
about one that has to run anywhere else.
|
|
110
109
|
|
|
110
|
+
`@omnigateway/dashboard-sdk` is an **external** of the UI build, alongside React
|
|
111
|
+
and friends — the console serves one copy of each through its import map.
|
|
112
|
+
(`@omnigateway/plugin-api` is not: it is a runtime dependency of the *server*
|
|
113
|
+
half and is bundled into it, and the panel never imports it.)
|
|
114
|
+
|
|
115
|
+
The SDK is the easiest external to forget, because it is the one package here
|
|
116
|
+
that is obviously ours, and forgetting it fails silently: the SDK holds the
|
|
117
|
+
console's LIVE switch in a React context, so a bundled copy is a second context,
|
|
118
|
+
and the panel stops refreshing without an error anywhere.
|
|
119
|
+
`test/package.test.ts` checks the built bundle still imports it and carries no
|
|
120
|
+
`createContext` of its own.
|
|
121
|
+
|
|
122
|
+
## The console's LIVE switch
|
|
123
|
+
|
|
124
|
+
The panel polls, because growth arrives from requests it cannot hear about. It
|
|
125
|
+
polls on the console's cadence rather than its own: the chassis bar's LIVE
|
|
126
|
+
control pauses every screen at once, this panel included, and there is
|
|
127
|
+
deliberately no per-panel refresh setting. Paused means it stops refetching, not
|
|
128
|
+
that it stops working — an operator who pauses still sees the companion they
|
|
129
|
+
opened.
|
|
130
|
+
|
|
111
131
|
## Licence
|
|
112
132
|
|
|
113
133
|
MIT. See [LICENSE](LICENSE). The licence covers this plugin's code and not the
|
package/omni-plugin.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@omnigateway/pokemon",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A Pokémon companion for OmniGateway. Each gateway key raises one that hatches, evolves, and graduates into a Pokédex on the tokens that key spends.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Harismawan <mail@harismawan.com>",
|
package/server/index.js
CHANGED
package/ui/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import{definePluginUI as It,useLive as $t}from"@omnigateway/dashboard-sdk";import{useMutation as fe,useQuery as at,useQueryClient as wt}from"@tanstack/react-query";import{useState as st}from"react";var dt={rareCandy:{blurb:"Injects 100.0M growth. Priced at five times what it grants.",emoji:"\uD83C\uDF6C",consumable:!0},mint:{blurb:"Rerolls this companion's nature. Cosmetic, and cheap enough to reroll again.",emoji:"\uD83C\uDF3F",consumable:!0},shinyCharm:{blurb:"Kept, never spent. Raises every future hatch from 1 in 64 to 1 in 48.",emoji:"✨",consumable:!1},everstone:{blurb:"Pins this companion: it will not evolve, reveal, or graduate.",emoji:"\uD83E\uDEA8",consumable:!0},lure:{blurb:"Next egg prefers a species the Dex has not collected. A preference, never a veto.",emoji:"\uD83C\uDF6F",consumable:!0},sootheBell:{blurb:"This companion grows 25% faster. Bound to it, and never repays its price.",emoji:"\uD83D\uDD14",consumable:!0},incense:{blurb:"Next egg leans toward a longer evolution line. Buys events, not value.",emoji:"\uD83D\uDD6F️",consumable:!0},repel:{blurb:"Next egg will not hatch one named line.",emoji:"\uD83D\uDEAB",consumable:!0}};function L(e){return ye.get(e)??{blurb:"",emoji:"❔",consumable:!0}}var ye=new Map(Object.entries(dt)),Dt=[...ye].filter(([,e])=>e.consumable).map(([e])=>e),ve="\uD83E\uDD5A";function ke(e){return e===null?"Sends this companion off and starts again.":`Sends this companion off for an egg guaranteed to hatch ${e} or better.`}function R(e,t,o){return`/api/plugins/${e}/sprite/${t}${o?"?shiny=1":""}`}function Ie(e,t){return`/api/plugins/${e}/item-sprite/${t}`}function h(e){if(e>=1e9)return`${(e/1e9).toFixed(2)}B`;if(e>=1e6)return`${(e/1e6).toFixed(1)}M`;return e.toLocaleString()}function T(e,t){return e??`#${t}`}function E(e,t,o){return`${e??`Species ${t}`}${o?", shiny":""}`}function N(e){return e.replace(/([A-Z])/g," $1").toLowerCase()}function $e(e){if(e.kind==="item")return N(e.item);return e.tier===null?"fresh egg":`fresh egg (${e.tier}+)`}var we=[null,"common","uncommon","rare","legendary"],Ce=60000,Se=60*Ce;function M(e,t,o){if(!e)return"egg";if(t===null)return"sleep";let i=o-t;if(i<5*Ce)return"working";if(i<Se)return"idle";if(i<8*Se)return"tired";return"sleep"}import{useState as ut}from"react";import r from"styled-components";var l={xs:"4px",sm:"8px",md:"12px",lg:"20px",xl:"32px"},B="192px",de="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",O=r.section`
|
|
2
2
|
background: var(--panel);
|
|
3
3
|
border: 1px solid var(--rule);
|
|
4
4
|
border-radius: 8px;
|
|
5
5
|
padding: ${l.lg};
|
|
6
6
|
color: var(--ink);
|
|
7
|
-
`,
|
|
7
|
+
`,ue=r.h3`
|
|
8
8
|
display: flex;
|
|
9
9
|
align-items: center;
|
|
10
10
|
gap: ${l.md};
|
|
@@ -21,15 +21,15 @@ function ue(e){return e}import{useMutation as xe,useQuery as at,useQueryClient a
|
|
|
21
21
|
height: 1px;
|
|
22
22
|
background: var(--rule);
|
|
23
23
|
}
|
|
24
|
-
`,
|
|
24
|
+
`,Re=r(ue)`
|
|
25
25
|
&::after {
|
|
26
26
|
content: none;
|
|
27
27
|
}
|
|
28
|
-
`,
|
|
28
|
+
`,Te=r.span`
|
|
29
29
|
flex: 1;
|
|
30
30
|
height: 1px;
|
|
31
31
|
background: var(--rule);
|
|
32
|
-
`,
|
|
32
|
+
`,De=r.button`
|
|
33
33
|
display: flex;
|
|
34
34
|
align-items: center;
|
|
35
35
|
gap: ${l.sm};
|
|
@@ -52,7 +52,7 @@ function ue(e){return e}import{useMutation as xe,useQuery as at,useQueryClient a
|
|
|
52
52
|
outline-offset: 4px;
|
|
53
53
|
border-radius: 2px;
|
|
54
54
|
}
|
|
55
|
-
`,
|
|
55
|
+
`,Ee=r.span`
|
|
56
56
|
display: inline-block;
|
|
57
57
|
font-size: 9px;
|
|
58
58
|
line-height: 1;
|
|
@@ -62,22 +62,22 @@ function ue(e){return e}import{useMutation as xe,useQuery as at,useQueryClient a
|
|
|
62
62
|
@media (prefers-reduced-motion: reduce) {
|
|
63
63
|
transition: none;
|
|
64
64
|
}
|
|
65
|
-
`,
|
|
65
|
+
`,Pe=r.span`
|
|
66
66
|
color: var(--ink-faint);
|
|
67
67
|
letter-spacing: 0.08em;
|
|
68
68
|
white-space: nowrap;
|
|
69
|
-
`,
|
|
69
|
+
`,I=r.div`
|
|
70
70
|
display: flex;
|
|
71
71
|
gap: ${l.md};
|
|
72
72
|
align-items: center;
|
|
73
73
|
flex-wrap: wrap;
|
|
74
|
-
`,
|
|
74
|
+
`,Ae=r(I)`
|
|
75
75
|
h2 {
|
|
76
76
|
margin: 0;
|
|
77
77
|
}
|
|
78
|
-
`,x=
|
|
78
|
+
`,x=r.span`
|
|
79
79
|
color: var(--ink-dim);
|
|
80
|
-
`,
|
|
80
|
+
`,_=r(x)`
|
|
81
81
|
display: block;
|
|
82
82
|
margin-top: ${l.sm};
|
|
83
83
|
|
|
@@ -88,16 +88,16 @@ function ue(e){return e}import{useMutation as xe,useQuery as at,useQueryClient a
|
|
|
88
88
|
& + & {
|
|
89
89
|
margin-top: ${l.xs};
|
|
90
90
|
}
|
|
91
|
-
`,
|
|
91
|
+
`,Le=r.p`
|
|
92
92
|
color: var(--ink-dim);
|
|
93
93
|
margin: ${l.xs} 0 ${l.lg};
|
|
94
|
-
`,
|
|
94
|
+
`,ce=r.p`
|
|
95
95
|
color: var(--warn);
|
|
96
96
|
background: var(--warn-wash);
|
|
97
97
|
border-radius: 6px;
|
|
98
98
|
padding: ${l.md};
|
|
99
99
|
margin: ${l.md} 0 0;
|
|
100
|
-
`,b=
|
|
100
|
+
`,b=r.span`
|
|
101
101
|
display: inline-flex;
|
|
102
102
|
align-items: center;
|
|
103
103
|
gap: ${l.xs};
|
|
@@ -109,31 +109,31 @@ function ue(e){return e}import{useMutation as xe,useQuery as at,useQueryClient a
|
|
|
109
109
|
text-transform: uppercase;
|
|
110
110
|
color: var(--ink-dim);
|
|
111
111
|
white-space: nowrap;
|
|
112
|
-
`,
|
|
112
|
+
`,Ne=r(I)`
|
|
113
113
|
margin: ${l.xs} 0 ${l.sm};
|
|
114
|
-
`,
|
|
114
|
+
`,V=r(b)`
|
|
115
115
|
border-color: var(--rule-strong);
|
|
116
116
|
color: var(--ink);
|
|
117
117
|
font-weight: 600;
|
|
118
|
-
`,z=
|
|
118
|
+
`,z=r.img`
|
|
119
119
|
width: ${B};
|
|
120
120
|
height: ${B};
|
|
121
121
|
image-rendering: pixelated;
|
|
122
|
-
`,q=
|
|
122
|
+
`,q=r.div`
|
|
123
123
|
box-sizing: border-box;
|
|
124
124
|
width: ${B};
|
|
125
125
|
height: ${B};
|
|
126
126
|
border-radius: 50% 50% 45% 45%;
|
|
127
127
|
background: var(--panel-sunk);
|
|
128
128
|
border: 2px solid var(--rule-strong);
|
|
129
|
-
`,Be=
|
|
129
|
+
`,Be=r.div`
|
|
130
130
|
box-sizing: border-box;
|
|
131
131
|
width: ${B};
|
|
132
132
|
height: ${B};
|
|
133
133
|
border-radius: 6px;
|
|
134
134
|
background: var(--warn-wash);
|
|
135
135
|
border: 2px dashed var(--warn);
|
|
136
|
-
`,
|
|
136
|
+
`,k=r.button`
|
|
137
137
|
background: var(--panel-raised);
|
|
138
138
|
border: 1px solid var(--rule);
|
|
139
139
|
border-radius: 6px;
|
|
@@ -158,22 +158,22 @@ function ue(e){return e}import{useMutation as xe,useQuery as at,useQueryClient a
|
|
|
158
158
|
color: var(--ink-faint);
|
|
159
159
|
cursor: not-allowed;
|
|
160
160
|
}
|
|
161
|
-
`,
|
|
161
|
+
`,K=r.span`
|
|
162
162
|
font-family: ${de};
|
|
163
163
|
font-variant-numeric: tabular-nums;
|
|
164
|
-
`,
|
|
164
|
+
`,Ke=r.div`
|
|
165
165
|
display: flex;
|
|
166
166
|
gap: 3px;
|
|
167
167
|
min-width: 240px;
|
|
168
168
|
max-width: 340px;
|
|
169
|
-
`,
|
|
169
|
+
`,Fe=r.div`
|
|
170
170
|
flex: 1;
|
|
171
171
|
height: 10px;
|
|
172
172
|
background: var(--panel-sunk);
|
|
173
173
|
border: 1px solid var(--rule);
|
|
174
174
|
border-radius: 3px;
|
|
175
175
|
overflow: hidden;
|
|
176
|
-
`,me=
|
|
176
|
+
`,me=r.div`
|
|
177
177
|
height: 100%;
|
|
178
178
|
background: var(--accent);
|
|
179
179
|
width: ${(e)=>Math.min(100,Math.max(0,e.$pct))}%;
|
|
@@ -182,33 +182,33 @@ function ue(e){return e}import{useMutation as xe,useQuery as at,useQueryClient a
|
|
|
182
182
|
@media (prefers-reduced-motion: reduce) {
|
|
183
183
|
transition: none;
|
|
184
184
|
}
|
|
185
|
-
`,
|
|
185
|
+
`,Me=r.dl`
|
|
186
186
|
display: flex;
|
|
187
187
|
flex-wrap: wrap;
|
|
188
188
|
gap: ${l.xl};
|
|
189
189
|
margin: ${l.lg} 0 0;
|
|
190
190
|
padding-top: ${l.lg};
|
|
191
191
|
border-top: 1px solid var(--rule);
|
|
192
|
-
`,J=
|
|
192
|
+
`,J=r.div`
|
|
193
193
|
display: flex;
|
|
194
194
|
flex-direction: column;
|
|
195
195
|
gap: 2px;
|
|
196
|
-
`,Q=
|
|
196
|
+
`,Q=r.dt`
|
|
197
197
|
font-size: 11px;
|
|
198
198
|
letter-spacing: 0.08em;
|
|
199
199
|
text-transform: uppercase;
|
|
200
200
|
color: var(--ink-faint);
|
|
201
|
-
`,
|
|
201
|
+
`,Y=r.dd`
|
|
202
202
|
margin: 0;
|
|
203
203
|
font-family: ${de};
|
|
204
204
|
font-variant-numeric: tabular-nums;
|
|
205
205
|
font-size: 18px;
|
|
206
206
|
color: var(--ink);
|
|
207
|
-
`,
|
|
207
|
+
`,Oe=r.div`
|
|
208
208
|
display: grid;
|
|
209
209
|
grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
|
|
210
210
|
gap: ${l.md};
|
|
211
|
-
`,
|
|
211
|
+
`,_e=r.button`
|
|
212
212
|
margin: 0;
|
|
213
213
|
display: flex;
|
|
214
214
|
flex-direction: column;
|
|
@@ -229,7 +229,7 @@ function ue(e){return e}import{useMutation as xe,useQuery as at,useQueryClient a
|
|
|
229
229
|
outline: 2px solid var(--accent);
|
|
230
230
|
outline-offset: 2px;
|
|
231
231
|
}
|
|
232
|
-
`,
|
|
232
|
+
`,Ge=r.div`
|
|
233
233
|
grid-column: 1 / -1;
|
|
234
234
|
display: flex;
|
|
235
235
|
gap: ${l.lg};
|
|
@@ -237,18 +237,18 @@ function ue(e){return e}import{useMutation as xe,useQuery as at,useQueryClient a
|
|
|
237
237
|
background: var(--panel-sunk);
|
|
238
238
|
border: 1px solid var(--rule);
|
|
239
239
|
border-radius: 8px;
|
|
240
|
-
`,
|
|
240
|
+
`,He=r.div`
|
|
241
241
|
display: flex;
|
|
242
242
|
flex-direction: column;
|
|
243
243
|
align-items: flex-start;
|
|
244
244
|
gap: ${l.sm};
|
|
245
245
|
min-width: 0;
|
|
246
|
-
`,
|
|
246
|
+
`,Ue=r.div`
|
|
247
247
|
display: flex;
|
|
248
248
|
align-items: center;
|
|
249
249
|
gap: ${l.sm};
|
|
250
250
|
flex-wrap: wrap;
|
|
251
|
-
`,
|
|
251
|
+
`,je=r.figure`
|
|
252
252
|
margin: 0;
|
|
253
253
|
display: flex;
|
|
254
254
|
flex-direction: column;
|
|
@@ -260,16 +260,16 @@ function ue(e){return e}import{useMutation as xe,useQuery as at,useQueryClient a
|
|
|
260
260
|
height: 48px;
|
|
261
261
|
image-rendering: pixelated;
|
|
262
262
|
}
|
|
263
|
-
`,
|
|
263
|
+
`,Z=r.figcaption`
|
|
264
264
|
color: var(--ink-dim);
|
|
265
265
|
font-size: 11px;
|
|
266
266
|
text-align: center;
|
|
267
267
|
overflow-wrap: anywhere;
|
|
268
|
-
`,
|
|
268
|
+
`,Ve=r.div`
|
|
269
269
|
display: grid;
|
|
270
270
|
grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
|
|
271
271
|
gap: ${l.md};
|
|
272
|
-
`,ze=
|
|
272
|
+
`,ze=r.button`
|
|
273
273
|
display: flex;
|
|
274
274
|
flex-direction: column;
|
|
275
275
|
align-items: center;
|
|
@@ -290,16 +290,16 @@ function ue(e){return e}import{useMutation as xe,useQuery as at,useQueryClient a
|
|
|
290
290
|
outline: 2px solid var(--accent);
|
|
291
291
|
outline-offset: 2px;
|
|
292
292
|
}
|
|
293
|
-
`,
|
|
293
|
+
`,W=r.span`
|
|
294
294
|
font-family: ${de};
|
|
295
295
|
font-size: 12px;
|
|
296
296
|
color: var(--ink-dim);
|
|
297
297
|
overflow-wrap: anywhere;
|
|
298
|
-
`,X=
|
|
298
|
+
`,X=r.div`
|
|
299
299
|
display: grid;
|
|
300
300
|
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
|
301
301
|
gap: ${l.md};
|
|
302
|
-
`,ee=
|
|
302
|
+
`,ee=r.div`
|
|
303
303
|
display: flex;
|
|
304
304
|
flex-direction: column;
|
|
305
305
|
gap: ${l.sm};
|
|
@@ -307,25 +307,25 @@ function ue(e){return e}import{useMutation as xe,useQuery as at,useQueryClient a
|
|
|
307
307
|
background: var(--panel-sunk);
|
|
308
308
|
border: 1px solid var(--rule);
|
|
309
309
|
border-radius: 8px;
|
|
310
|
-
`,te=
|
|
310
|
+
`,te=r.div`
|
|
311
311
|
display: flex;
|
|
312
312
|
align-items: center;
|
|
313
313
|
gap: ${l.sm};
|
|
314
|
-
`,ne=
|
|
314
|
+
`,ne=r.span`
|
|
315
315
|
flex: 1;
|
|
316
316
|
overflow-wrap: anywhere;
|
|
317
|
-
`,oe=
|
|
317
|
+
`,oe=r.p`
|
|
318
318
|
margin: 0;
|
|
319
319
|
color: var(--ink-dim);
|
|
320
320
|
font-size: 12px;
|
|
321
321
|
line-height: 1.45;
|
|
322
|
-
`,re=
|
|
322
|
+
`,re=r.div`
|
|
323
323
|
display: flex;
|
|
324
324
|
align-items: center;
|
|
325
325
|
justify-content: flex-end;
|
|
326
326
|
gap: ${l.sm};
|
|
327
327
|
margin-top: auto;
|
|
328
|
-
`,qe=
|
|
328
|
+
`,qe=r.span`
|
|
329
329
|
display: inline-flex;
|
|
330
330
|
align-items: center;
|
|
331
331
|
justify-content: center;
|
|
@@ -334,8 +334,8 @@ function ue(e){return e}import{useMutation as xe,useQuery as at,useQueryClient a
|
|
|
334
334
|
height: 32px;
|
|
335
335
|
font-size: 20px;
|
|
336
336
|
line-height: 1;
|
|
337
|
-
`,Je=
|
|
337
|
+
`,Je=r.img`
|
|
338
338
|
width: 32px;
|
|
339
339
|
height: 32px;
|
|
340
340
|
image-rendering: pixelated;
|
|
341
|
-
`;import{jsx as Qe}from"react/jsx-runtime";function ie({item:e,emoji:t,pluginId:o}){let[a,u]=ut(!1);return Qe(qe,{"aria-hidden":"true",children:a?t:Qe(Je,{alt:"",onError:()=>u(!0),src:Ie(o,e)})})}import{jsx as A,jsxs as ae}from"react/jsx-runtime";function We({inventory:e,onUse:t,pending:o,pluginId:a}){let u=Object.entries(e).filter(([,s])=>s>0);if(u.length===0)return A(x,{children:"Nothing in the bag."});return A(X,{children:u.map(([s,r])=>{let n=N(s);return ae(ee,{children:[ae(te,{children:[A(ie,{emoji:n.emoji,item:s,pluginId:a}),A(ne,{children:L(s)}),ae(O,{children:["×",r]})]}),A(oe,{children:n.blurb}),A(re,{children:n.consumable?ae(v,{disabled:o,onClick:()=>t(s),type:"button",children:["Use ",L(s)]}):A(x,{children:"held"})})]},s)})})}import{Fragment as dt,useState as Ye}from"react";import{jsx as y,jsxs as C,Fragment as gt}from"react/jsx-runtime";function Ze({entries:e,pluginId:t}){let[o,a]=Ye(null),[u,s]=Ye(null);if(e.length===0)return y(x,{children:"Nothing graduated yet."});let r=o===null?e:e.filter((n)=>n.rarity===o);return C(gt,{children:[y(w,{children:$e.map((n)=>y(v,{"aria-pressed":o===n,onClick:()=>{a(n),s(null)},type:"button",children:n??"all"},n??"all"))}),r.length===0?C(x,{children:["No ",o," graduates yet."]}):y(Me,{children:r.map((n)=>{let p=u===n.id,I=`dex-detail-${n.id}`;return C(dt,{children:[C(Fe,{$open:p,"aria-controls":I,"aria-expanded":p,onClick:()=>s(p?null:n.id),type:"button",children:[y("img",{alt:`${n.rarity}${n.isShiny?" shiny":""} ${n.name??`species ${n.finalId}`}`,src:T(t,n.finalId,n.isShiny),style:{width:"64px",height:"64px",imageRendering:"pixelated"}}),y(Y,{children:R(n.name,n.finalId)}),n.nature===null?null:y(Y,{children:n.nature})]}),p?y(ct,{entry:n,id:I,pluginId:t}):null]},n.id)})})]})}function ct({entry:e,id:t,pluginId:o}){return C(Ue,{id:t,children:[y("img",{alt:P(e.name,e.finalId,e.isShiny),src:T(o,e.finalId,e.isShiny),style:{width:"96px",height:"96px",imageRendering:"pixelated"}}),C(Ge,{children:[y("strong",{children:R(e.name,e.finalId)}),C(w,{children:[y(b,{children:e.rarity}),e.isShiny?y(j,{children:"✦ shiny"}):null,e.nature===null?null:y(b,{children:e.nature})]}),y(He,{children:e.chainOrder.map((a,u)=>C(Ve,{children:[y("img",{alt:P(null,a,!1),src:T(o,a,!1)}),y(Y,{children:a===e.finalId?R(e.name,a):`#${a}`})]},`${a}-${u}`))}),C(x,{children:["caught ",new Date(e.caughtAt).toLocaleDateString()]})]})]})}import{jsx as he,jsxs as mt}from"react/jsx-runtime";function fe({stages:e,stageIndex:t,progress:o,threshold:a,label:u,valueText:s}){let r=o/Math.max(1,a)*100;return he(Oe,{"aria-label":u,"aria-valuemax":a,"aria-valuemin":0,"aria-valuenow":o,"aria-valuetext":s,role:"progressbar",children:Array.from({length:Math.max(1,e)},(n,p)=>mt(Ke,{children:[p<t?he(me,{$pct:100}):null,p===t?he(me,{$pct:r}):null]},p))})}function Xe(e,t,o,a){return`stage ${t+1} of ${e}, ${h(o)} of ${h(a)} tokens`}import{jsx as c,jsxs as g,Fragment as U}from"react/jsx-runtime";function et({view:e,activity:t,pluginId:o,onRelease:a,releasing:u}){let s=e.state;if(s===null)return null;let{active:r}=s,n=r===null?null:r.plannedPath[r.stageIndex]??null;return g(U,{children:[g(w,{children:[n===null?c(q,{"aria-label":"An egg, not yet hatched",role:"img"}):c(z,{alt:P(e.name,n,r?.isShiny===!0),src:T(o,n,r?.isShiny===!0)}),g("div",{children:[c("h3",{children:n===null?"Egg":R(e.name,n)}),g(Le,{children:[r===null?s.eggTier===null?null:g(b,{children:[s.eggTier,"+ guaranteed"]}):g(U,{children:[c(b,{children:r.rarity}),r.isShiny?g(j,{children:[c("span",{"aria-hidden":"true",children:"✦"}),"shiny"]}):null,c(b,{children:r.nature}),r.dittoDisguise===null||r.dittoRevealed?null:c(b,{children:"?"}),r.everstone?c(b,{children:"everstone"}):null,r.soothe?c(b,{children:"soothe bell"}):null]}),c(b,{"aria-label":`Activity: ${t}`,role:"status",children:t})]}),r===null?g(U,{children:[c(fe,{label:"Incubation",progress:e.progress,stageIndex:0,stages:1,threshold:e.nextThreshold,valueText:`${h(e.progress)} of ${h(e.nextThreshold)} tokens incubated`}),g(F,{children:[h(e.progress)," / ",h(e.nextThreshold)," tokens incubated"]})]}):g(U,{children:[c(fe,{label:"Growth to the next evolution",progress:e.progress,stageIndex:r.stageIndex,stages:r.plannedPath.length,threshold:e.nextThreshold,valueText:Xe(r.plannedPath.length,r.stageIndex,e.progress,e.nextThreshold)}),g(F,{children:["Stage ",r.stageIndex+1," of ",r.plannedPath.length]}),r.everstone?g(U,{children:[g(F,{children:["Held at this stage · ",h(e.progress)," banked"]}),c(v,{disabled:u,onClick:a,type:"button",children:"Release"})]}):g(F,{children:[h(e.progress)," / ",h(e.nextThreshold)," to the next stage"]})]})]})]}),g(_e,{children:[g(J,{children:[c(Q,{children:"Earned"}),c(W,{children:h(e.tokensTotal)})]}),g(J,{children:[c(Q,{children:"To spend"}),c(W,{children:h(e.wallet)})]}),g(J,{children:[c(Q,{children:"Graduated"}),c(W,{children:e.dex.length.toLocaleString()})]})]})]})}import{useState as ht}from"react";import{jsx as k,jsxs as se}from"react/jsx-runtime";function tt({keys:e,onPick:t,pluginId:o,rosterFailed:a}){let[u,s]=ht("");return se(M,{children:[k("h2",{children:"Companion"}),k(Ne,{children:"Each API key raises its own Pokémon on the tokens it spends. Pick a key."}),e.length>0?k(je,{children:e.map((r)=>k(ft,{entry:r,onPick:t,pluginId:o},r.apiKeyId))}):k(x,{children:a?"The list of keys could not be loaded. Enter a key id below to reach a companion directly.":"No key has spent a token yet. A companion appears the first time a key serves a request."}),k(ce,{children:"Or by key id"}),k("form",{onSubmit:(r)=>{r.preventDefault();let n=u.trim();if(n!=="")t(n)},children:se(w,{children:[k("input",{"aria-label":"API key id",onChange:(r)=>s(r.target.value),placeholder:"key id",value:u}),k(v,{type:"submit",children:"Show"})]})})]})}function ft({entry:e,onPick:t,pluginId:o}){let a=_(e.speciesId!==null,e.lastCreditAt,Date.now());return se(ze,{onClick:()=>t(e.apiKeyId),type:"button",children:[e.unreadable?k(Be,{"aria-label":"This key's save could not be read",role:"img"}):e.speciesId===null?k(q,{"aria-label":"An egg, not yet hatched",role:"img"}):k(z,{alt:P(e.name,e.speciesId,e.isShiny),src:T(o,e.speciesId,e.isShiny)}),k("strong",{children:e.unreadable?"Save unreadable":e.speciesId===null?"Egg":R(e.name,e.speciesId)}),e.rarity===null?null:k(b,{children:e.rarity}),k(Z,{children:e.apiKeyId}),se(x,{children:[k(O,{children:h(e.tokensTotal)}),e.unreadable?null:` · ${a}`]})]})}import{useId as xt,useState as bt}from"react";import{jsx as G,jsxs as nt,Fragment as kt}from"react/jsx-runtime";var K={shop:!0,bag:!0,dex:!0},ot=(e)=>`plugin:${e}:sections`;function yt(e){try{let t=globalThis.localStorage?.getItem(ot(e));if(t===null||t===void 0)return K;let o=JSON.parse(t);if(typeof o!=="object"||o===null)return K;let a=o;return{shop:typeof a.shop==="boolean"?a.shop:K.shop,bag:typeof a.bag==="boolean"?a.bag:K.bag,dex:typeof a.dex==="boolean"?a.dex:K.dex}}catch{return K}}function rt(e){let[t,o]=bt(()=>yt(e));return{open:t,toggle:(u)=>{o((s)=>{let r={...s,[u]:!s[u]};try{globalThis.localStorage?.setItem(ot(e),JSON.stringify(r))}catch{}return r})}}}function le({title:e,count:t,open:o,onToggle:a,children:u}){let s=xt();return nt(kt,{children:[G(Te,{children:nt(Pe,{"aria-controls":s,"aria-expanded":o,onClick:a,type:"button",children:[G(Ae,{$open:o,children:"▶"}),e,G(Re,{}),G(Ee,{children:t})]})}),o?G("div",{id:s,children:u}):null]})}import{jsx as E,jsxs as pe}from"react/jsx-runtime";function it({offers:e,wallet:t,onBuy:o,pending:a,inventory:u,hasCompanion:s,pluginId:r}){return E(X,{children:e.map((n)=>{let{entry:p,price:I}=n,S=St(p,u),d=p.kind==="egg"&&!s,D=p.kind==="item"?L(p.item):"fresh egg";return pe(ee,{children:[pe(te,{children:[E(ie,{emoji:p.kind==="item"?N(p.item).emoji:ke,item:p.kind==="item"?p.item:"egg",pluginId:r}),E(ne,{children:D}),S?E(x,{children:"owned"}):E(O,{children:h(I)})]}),p.kind==="egg"&&p.tier!==null?pe(b,{children:[p.tier,"+"]}):null,E(oe,{children:p.kind==="item"?N(p.item).blurb:Se(p.tier)}),E(re,{children:pe(v,{disabled:S||d||t<I||a,onClick:()=>o(p),type:"button",children:["Buy ",we(p)]})})]},p.kind==="item"?`item:${p.item}`:`egg:${p.tier??""}`)})})}function St(e,t){if(e.kind!=="item")return!1;return!N(e.item).consumable&&(t[e.item]??0)>0}import{jsx as f,jsxs as be,Fragment as Ct}from"react/jsx-runtime";var It=15000;function wt({pluginId:e,api:t}){let[o,a]=st({at:"start"}),u=vt(),s=at({queryKey:["roster"],queryFn:()=>t.get("keys")}),r=s.data?.keys??[];if(o.at==="start"&&!s.isPending){let m=r.length===1?r[0]:void 0;a(m===void 0?{at:"roster"}:{at:"key",apiKeyId:m.apiKeyId})}let n=o.at==="key"?o.apiKeyId:null,p=at({queryKey:["companion",n],queryFn:()=>t.get(`keys/${n}`),enabled:n!==null,refetchInterval:It}),[I,S]=st(null),d=()=>{u.invalidateQueries({queryKey:["companion",n]}),u.invalidateQueries({queryKey:["roster"]})},D=xe({mutationFn:(m)=>t.post(`keys/${n}/purchase`,m),onMutate:()=>S(null),onError:(m)=>S(m instanceof Error?m.message:"the purchase was refused"),onSuccess:d}),H=xe({mutationFn:(m)=>t.post(`keys/${n}/use`,{item:m}),onMutate:()=>S(null),onError:(m)=>S(m instanceof Error?m.message:"the item could not be used"),onSuccess:d}),V=xe({mutationFn:()=>t.post(`keys/${n}/unpin`),onMutate:()=>S(null),onError:(m)=>S(m instanceof Error?m.message:"the companion could not be released"),onSuccess:d});if(s.isPending)return f(M,{children:"Loading…"});if(n===null)return f(tt,{keys:r,onPick:(m)=>a({at:"key",apiKeyId:m}),pluginId:e,rosterFailed:s.isError});return be(M,{children:[be(De,{children:[f("h2",{children:"Companion"}),f(Z,{children:n}),f(v,{onClick:()=>a({at:"roster"}),type:"button",children:"All keys"})]}),f($t,{buy:D.mutate,buying:D.isPending,keyId:n,onRelease:()=>V.mutate(),onUse:H.mutate,pluginId:e,query:p,refusal:I,releasing:V.isPending,using:H.isPending})]})}function $t({query:e,pluginId:t,buy:o,onUse:a,onRelease:u,buying:s,using:r,releasing:n,refusal:p}){let{open:I,toggle:S}=rt(t);if(e.isPending)return f(x,{children:"Loading…"});if(e.isError||e.data===void 0)return f(x,{children:"No companion for that key yet."});let d=e.data;if(d.state===null)return f(ge,{children:"This key's save could not be read. It has been left untouched rather than replaced — nothing has been lost, but it needs looking at."});let D=_(d.state.active!==null,d.lastCreditAt,Date.now()),H=Object.values(d.state.inventory).filter((V)=>V>0).length;return be(Ct,{children:[f(et,{activity:D,onRelease:u,pluginId:t,releasing:n,view:d}),f(le,{count:lt(d.shop.length,"offer"),onToggle:()=>S("shop"),open:I.shop,title:"Shop",children:f(it,{hasCompanion:d.state.active!==null,inventory:d.state.inventory,offers:d.shop,onBuy:o,pending:s,pluginId:t,wallet:d.wallet})}),f(le,{count:`${H} held`,onToggle:()=>S("bag"),open:I.bag,title:"Bag",children:f(We,{inventory:d.state.inventory,onUse:a,pending:r,pluginId:t})}),p===null?null:f(ge,{role:"alert",children:p}),f(le,{count:lt(d.dex.length,"graduate"),onToggle:()=>S("dex"),open:I.dex,title:"Pokédex",children:f(Ze,{entries:d.dex,pluginId:t})})]})}function lt(e,t){return`${e} ${t}${e===1?"":"s"}`}var jn=ue({mount:wt});export{_ as activityOf,jn as default};
|
|
341
|
+
`;import{jsx as Qe}from"react/jsx-runtime";function ie({item:e,emoji:t,pluginId:o}){let[i,d]=ut(!1);return Qe(qe,{"aria-hidden":"true",children:i?t:Qe(Je,{alt:"",onError:()=>d(!0),src:Ie(o,e)})})}import{jsx as P,jsxs as ae}from"react/jsx-runtime";function Ye({inventory:e,onUse:t,pending:o,pluginId:i}){let d=Object.entries(e).filter(([,p])=>p>0);if(d.length===0)return P(x,{children:"Nothing in the bag."});return P(X,{children:d.map(([p,n])=>{let a=L(p);return ae(ee,{children:[ae(te,{children:[P(ie,{emoji:a.emoji,item:p,pluginId:i}),P(ne,{children:N(p)}),ae(K,{children:["×",n]})]}),P(oe,{children:a.blurb}),P(re,{children:a.consumable?ae(k,{disabled:o,onClick:()=>t(p),type:"button",children:["Use ",N(p)]}):P(x,{children:"held"})})]},p)})})}import{Fragment as ct,useState as Ze}from"react";import{jsx as y,jsxs as w,Fragment as gt}from"react/jsx-runtime";function We({entries:e,pluginId:t}){let[o,i]=Ze(null),[d,p]=Ze(null);if(e.length===0)return y(x,{children:"Nothing graduated yet."});let n=o===null?e:e.filter((a)=>a.rarity===o);return w(gt,{children:[y(I,{children:we.map((a)=>y(k,{"aria-pressed":o===a,onClick:()=>{i(a),p(null)},type:"button",children:a??"all"},a??"all"))}),n.length===0?w(x,{children:["No ",o," graduates yet."]}):y(Oe,{children:n.map((a)=>{let s=d===a.id,S=`dex-detail-${a.id}`;return w(ct,{children:[w(_e,{$open:s,"aria-controls":S,"aria-expanded":s,onClick:()=>p(s?null:a.id),type:"button",children:[y("img",{alt:`${a.rarity}${a.isShiny?" shiny":""} ${a.name??`species ${a.finalId}`}`,src:R(t,a.finalId,a.isShiny),style:{width:"64px",height:"64px",imageRendering:"pixelated"}}),y(Z,{children:T(a.name,a.finalId)}),a.nature===null?null:y(Z,{children:a.nature})]}),s?y(mt,{entry:a,id:S,pluginId:t}):null]},a.id)})})]})}function mt({entry:e,id:t,pluginId:o}){return w(Ge,{id:t,children:[y("img",{alt:E(e.name,e.finalId,e.isShiny),src:R(o,e.finalId,e.isShiny),style:{width:"96px",height:"96px",imageRendering:"pixelated"}}),w(He,{children:[y("strong",{children:T(e.name,e.finalId)}),w(I,{children:[y(b,{children:e.rarity}),e.isShiny?y(V,{children:"✦ shiny"}):null,e.nature===null?null:y(b,{children:e.nature})]}),y(Ue,{children:e.chainOrder.map((i,d)=>w(je,{children:[y("img",{alt:E(null,i,!1),src:R(o,i,!1)}),y(Z,{children:i===e.finalId?T(e.name,i):`#${i}`})]},`${i}-${d}`))}),w(x,{children:["caught ",new Date(e.caughtAt).toLocaleDateString()]})]})]})}import{jsx as ge,jsxs as ht}from"react/jsx-runtime";function he({stages:e,stageIndex:t,progress:o,threshold:i,label:d,valueText:p}){let n=o/Math.max(1,i)*100;return ge(Ke,{"aria-label":d,"aria-valuemax":i,"aria-valuemin":0,"aria-valuenow":o,"aria-valuetext":p,role:"progressbar",children:Array.from({length:Math.max(1,e)},(a,s)=>ht(Fe,{children:[s<t?ge(me,{$pct:100}):null,s===t?ge(me,{$pct:n}):null]},s))})}function Xe(e,t,o,i){return`stage ${t+1} of ${e}, ${h(o)} of ${h(i)} tokens`}import{jsx as c,jsxs as m,Fragment as G}from"react/jsx-runtime";function et({view:e,activity:t,pluginId:o,onRelease:i,releasing:d}){let p=e.state;if(p===null)return null;let{active:n}=p,a=n===null?null:n.plannedPath[n.stageIndex]??null;return m(G,{children:[m(I,{children:[a===null?c(q,{"aria-label":"An egg, not yet hatched",role:"img"}):c(z,{alt:E(e.name,a,n?.isShiny===!0),src:R(o,a,n?.isShiny===!0)}),m("div",{children:[c("h3",{children:a===null?"Egg":T(e.name,a)}),m(Ne,{children:[n===null?p.eggTier===null?null:m(b,{children:[p.eggTier,"+ guaranteed"]}):m(G,{children:[c(b,{children:n.rarity}),n.isShiny?m(V,{children:[c("span",{"aria-hidden":"true",children:"✦"}),"shiny"]}):null,c(b,{children:n.nature}),n.dittoDisguise===null||n.dittoRevealed?null:c(b,{children:"?"}),n.everstone?c(b,{children:"everstone"}):null,n.soothe?c(b,{children:"soothe bell"}):null]}),c(b,{"aria-label":`Activity: ${t}`,role:"status",children:t})]}),n===null?m(G,{children:[c(he,{label:"Incubation",progress:e.progress,stageIndex:0,stages:1,threshold:e.nextThreshold,valueText:`${h(e.progress)} of ${h(e.nextThreshold)} tokens incubated`}),m(_,{children:[h(e.progress)," / ",h(e.nextThreshold)," tokens incubated"]})]}):m(G,{children:[c(he,{label:"Growth to the next evolution",progress:e.progress,stageIndex:n.stageIndex,stages:n.plannedPath.length,threshold:e.nextThreshold,valueText:Xe(n.plannedPath.length,n.stageIndex,e.progress,e.nextThreshold)}),m(_,{children:["Stage ",n.stageIndex+1," of ",n.plannedPath.length]}),n.everstone?m(G,{children:[m(_,{children:["Held at this stage · ",h(e.progress)," banked"]}),c(k,{disabled:d,onClick:i,type:"button",children:"Release"})]}):m(_,{children:[h(e.progress)," / ",h(e.nextThreshold)," to the next stage"]})]})]})]}),m(Me,{children:[m(J,{children:[c(Q,{children:"Earned"}),c(Y,{children:h(e.tokensTotal)})]}),m(J,{children:[c(Q,{children:"To spend"}),c(Y,{children:h(e.wallet)})]}),m(J,{children:[c(Q,{children:"Graduated"}),c(Y,{children:e.dex.length.toLocaleString()})]})]})]})}import{useState as ft}from"react";import{jsx as v,jsxs as se}from"react/jsx-runtime";function tt({keys:e,onPick:t,pluginId:o,rosterFailed:i}){let[d,p]=ft("");return se(O,{children:[v("h2",{children:"Companion"}),v(Le,{children:"Each API key raises its own Pokémon on the tokens it spends. Pick a key."}),e.length>0?v(Ve,{children:e.map((n)=>v(xt,{entry:n,onPick:t,pluginId:o},n.apiKeyId))}):v(x,{children:i?"The list of keys could not be loaded. Enter a key id below to reach a companion directly.":"No key has spent a token yet. A companion appears the first time a key serves a request."}),v(ue,{children:"Or by key id"}),v("form",{onSubmit:(n)=>{n.preventDefault();let a=d.trim();if(a!=="")t(a)},children:se(I,{children:[v("input",{"aria-label":"API key id",onChange:(n)=>p(n.target.value),placeholder:"key id",value:d}),v(k,{type:"submit",children:"Show"})]})})]})}function xt({entry:e,onPick:t,pluginId:o}){let i=M(e.speciesId!==null,e.lastCreditAt,Date.now());return se(ze,{onClick:()=>t(e.apiKeyId),type:"button",children:[e.unreadable?v(Be,{"aria-label":"This key's save could not be read",role:"img"}):e.speciesId===null?v(q,{"aria-label":"An egg, not yet hatched",role:"img"}):v(z,{alt:E(e.name,e.speciesId,e.isShiny),src:R(o,e.speciesId,e.isShiny)}),v("strong",{children:e.unreadable?"Save unreadable":e.speciesId===null?"Egg":T(e.name,e.speciesId)}),e.rarity===null?null:v(b,{children:e.rarity}),v(W,{children:e.apiKeyId}),se(x,{children:[v(K,{children:h(e.tokensTotal)}),e.unreadable?null:` · ${i}`]})]})}import{useId as bt,useState as yt}from"react";import{jsx as H,jsxs as nt,Fragment as kt}from"react/jsx-runtime";var F={shop:!0,bag:!0,dex:!0},ot=(e)=>`plugin:${e}:sections`;function vt(e){try{let t=globalThis.localStorage?.getItem(ot(e));if(t===null||t===void 0)return F;let o=JSON.parse(t);if(typeof o!=="object"||o===null)return F;let i=o;return{shop:typeof i.shop==="boolean"?i.shop:F.shop,bag:typeof i.bag==="boolean"?i.bag:F.bag,dex:typeof i.dex==="boolean"?i.dex:F.dex}}catch{return F}}function rt(e){let[t,o]=yt(()=>vt(e));return{open:t,toggle:(d)=>{o((p)=>{let n={...p,[d]:!p[d]};try{globalThis.localStorage?.setItem(ot(e),JSON.stringify(n))}catch{}return n})}}}function le({title:e,count:t,open:o,onToggle:i,children:d}){let p=bt();return nt(kt,{children:[H(Re,{children:nt(De,{"aria-controls":p,"aria-expanded":o,onClick:i,type:"button",children:[H(Ee,{$open:o,children:"▶"}),e,H(Te,{}),H(Pe,{children:t})]})}),o?H("div",{id:p,children:d}):null]})}import{jsx as A,jsxs as pe}from"react/jsx-runtime";function it({offers:e,wallet:t,onBuy:o,pending:i,inventory:d,hasCompanion:p,pluginId:n}){return A(X,{children:e.map((a)=>{let{entry:s,price:S}=a,C=St(s,d),u=s.kind==="egg"&&!p,D=s.kind==="item"?N(s.item):"fresh egg";return pe(ee,{children:[pe(te,{children:[A(ie,{emoji:s.kind==="item"?L(s.item).emoji:ve,item:s.kind==="item"?s.item:"egg",pluginId:n}),A(ne,{children:D}),C?A(x,{children:"owned"}):A(K,{children:h(S)})]}),s.kind==="egg"&&s.tier!==null?pe(b,{children:[s.tier,"+"]}):null,A(oe,{children:s.kind==="item"?L(s.item).blurb:ke(s.tier)}),A(re,{children:pe(k,{disabled:C||u||t<S||i,onClick:()=>o(s),type:"button",children:["Buy ",$e(s)]})})]},s.kind==="item"?`item:${s.item}`:`egg:${s.tier??""}`)})})}function St(e,t){if(e.kind!=="item")return!1;return!L(e.item).consumable&&(t[e.item]??0)>0}import{jsx as f,jsxs as xe,Fragment as Tt}from"react/jsx-runtime";var lt=1e4;function Ct({pluginId:e,api:t}){let[o,i]=st({at:"start"}),d=wt(),{cadence:p}=$t(),n=at({queryKey:["roster"],queryFn:()=>t.get("keys"),refetchInterval:p(lt)}),a=n.data?.keys??[];if(o.at==="start"&&!n.isPending){let g=a.length===1?a[0]:void 0;i(g===void 0?{at:"roster"}:{at:"key",apiKeyId:g.apiKeyId})}let s=o.at==="key"?o.apiKeyId:null,S=at({queryKey:["companion",s],queryFn:()=>t.get(`keys/${s}`),enabled:s!==null,refetchInterval:p(lt)}),[C,u]=st(null),D=()=>{d.invalidateQueries({queryKey:["companion",s]}),d.invalidateQueries({queryKey:["roster"]})},U=fe({mutationFn:(g)=>t.post(`keys/${s}/purchase`,g),onMutate:()=>u(null),onError:(g)=>u(g instanceof Error?g.message:"the purchase was refused"),onSuccess:D}),j=fe({mutationFn:(g)=>t.post(`keys/${s}/use`,{item:g}),onMutate:()=>u(null),onError:(g)=>u(g instanceof Error?g.message:"the item could not be used"),onSuccess:D}),be=fe({mutationFn:()=>t.post(`keys/${s}/unpin`),onMutate:()=>u(null),onError:(g)=>u(g instanceof Error?g.message:"the companion could not be released"),onSuccess:D});if(n.isPending)return f(O,{children:"Loading…"});if(s===null)return f(tt,{keys:a,onPick:(g)=>i({at:"key",apiKeyId:g}),pluginId:e,rosterFailed:n.isError});return xe(O,{children:[xe(Ae,{children:[f("h2",{children:"Companion"}),f(W,{children:s}),f(k,{onClick:()=>i({at:"roster"}),type:"button",children:"All keys"})]}),f(Rt,{buy:U.mutate,buying:U.isPending,keyId:s,onRelease:()=>be.mutate(),onUse:j.mutate,pluginId:e,query:S,refusal:C,releasing:be.isPending,using:j.isPending})]})}function Rt({query:e,pluginId:t,buy:o,onUse:i,onRelease:d,buying:p,using:n,releasing:a,refusal:s}){let{open:S,toggle:C}=rt(t);if(e.isPending)return f(x,{children:"Loading…"});if(e.isError||e.data===void 0)return f(x,{children:"No companion for that key yet."});let u=e.data;if(u.state===null)return f(ce,{children:"This key's save could not be read. It has been left untouched rather than replaced — nothing has been lost, but it needs looking at."});let D=M(u.state.active!==null,u.lastCreditAt,Date.now()),U=Object.values(u.state.inventory).filter((j)=>j>0).length;return xe(Tt,{children:[f(et,{activity:D,onRelease:d,pluginId:t,releasing:a,view:u}),f(le,{count:pt(u.shop.length,"offer"),onToggle:()=>C("shop"),open:S.shop,title:"Shop",children:f(it,{hasCompanion:u.state.active!==null,inventory:u.state.inventory,offers:u.shop,onBuy:o,pending:p,pluginId:t,wallet:u.wallet})}),f(le,{count:`${U} held`,onToggle:()=>C("bag"),open:S.bag,title:"Bag",children:f(Ye,{inventory:u.state.inventory,onUse:i,pending:n,pluginId:t})}),s===null?null:f(ce,{role:"alert",children:s}),f(le,{count:pt(u.dex.length,"graduate"),onToggle:()=>C("dex"),open:S.dex,title:"Pokédex",children:f(We,{entries:u.dex,pluginId:t})})]})}function pt(e,t){return`${e} ${t}${e===1?"":"s"}`}var An=It({mount:Ct});export{M as activityOf,An as default};
|