@omnigateway/pokemon 1.1.0 → 1.1.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/omni-plugin.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "pokemon",
3
3
  "name": "Pok\u00e9mon Companion",
4
- "version": "1.1.0",
4
+ "version": "1.1.1",
5
5
  "api": 1,
6
6
  "sdk": "^0.1.1",
7
7
  "server": "server/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnigateway/pokemon",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
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
@@ -61,7 +61,8 @@ var ITEM_SPRITE_FILES = {
61
61
  incense: "luck-incense",
62
62
  lure: "honey",
63
63
  mint: "mental-herb",
64
- egg: "lucky-egg"
64
+ egg: "lucky-egg",
65
+ incubating: "mystery-egg"
65
66
  };
66
67
  var ITEM_SPRITE_NAMES = new Map(Object.entries(ITEM_SPRITE_FILES));
67
68
  var FRESH_EGG_BASE_PRICE = 1e9;
package/ui/index.js CHANGED
@@ -1,10 +1,10 @@
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`
1
+ import{definePluginUI as Lt,useLive as Bt}from"@omnigateway/dashboard-sdk";import{useMutation as ye,useQuery as ht,useQueryClient as Ft}from"@tanstack/react-query";import{useState as ft}from"react";var yt={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 A(e){return ke.get(e)??{blurb:"",emoji:"❔",consumable:!0}}var ke=new Map(Object.entries(yt)),_t=[...ke].filter(([,e])=>e.consumable).map(([e])=>e),Ie="\uD83E\uDD5A";function $e(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 ce(e,t){return`/api/plugins/${e}/item-sprite/${t}`}var St="incubating";function Ce(e){return ce(e,St)}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 M(e,t){return e??`#${t}`}function D(e,t,o){return`${e??`Species ${t}`}${o?", shiny":""}`}function L(e){return e.replace(/([A-Z])/g," $1").toLowerCase()}function Re(e){if(e.kind==="item")return L(e.item);return e.tier===null?"fresh egg":`fresh egg (${e.tier}+)`}var Ee=[null,"common","uncommon","rare","legendary"],Te=60000,we=60*Te;function O(e,t,o){if(!e)return"egg";if(t===null)return"sleep";let i=o-t;if(i<5*Te)return"working";if(i<we)return"idle";if(i<8*we)return"tired";return"sleep"}import{useState as vt}from"react";import n from"styled-components";var l={xs:"4px",sm:"8px",md:"12px",lg:"20px",xl:"32px"},E="192px",z="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",_=n.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
- `,ue=r.h3`
7
+ `,me=n.h3`
8
8
  display: flex;
9
9
  align-items: center;
10
10
  gap: ${l.md};
@@ -21,15 +21,15 @@ import{definePluginUI as It,useLive as $t}from"@omnigateway/dashboard-sdk";impor
21
21
  height: 1px;
22
22
  background: var(--rule);
23
23
  }
24
- `,Re=r(ue)`
24
+ `,De=n(me)`
25
25
  &::after {
26
26
  content: none;
27
27
  }
28
- `,Te=r.span`
28
+ `,Ne=n.span`
29
29
  flex: 1;
30
30
  height: 1px;
31
31
  background: var(--rule);
32
- `,De=r.button`
32
+ `,Pe=n.button`
33
33
  display: flex;
34
34
  align-items: center;
35
35
  gap: ${l.sm};
@@ -52,7 +52,7 @@ import{definePluginUI as It,useLive as $t}from"@omnigateway/dashboard-sdk";impor
52
52
  outline-offset: 4px;
53
53
  border-radius: 2px;
54
54
  }
55
- `,Ee=r.span`
55
+ `,Ae=n.span`
56
56
  display: inline-block;
57
57
  font-size: 9px;
58
58
  line-height: 1;
@@ -62,22 +62,22 @@ import{definePluginUI as It,useLive as $t}from"@omnigateway/dashboard-sdk";impor
62
62
  @media (prefers-reduced-motion: reduce) {
63
63
  transition: none;
64
64
  }
65
- `,Pe=r.span`
65
+ `,Le=n.span`
66
66
  color: var(--ink-faint);
67
67
  letter-spacing: 0.08em;
68
68
  white-space: nowrap;
69
- `,I=r.div`
69
+ `,w=n.div`
70
70
  display: flex;
71
71
  gap: ${l.md};
72
72
  align-items: center;
73
73
  flex-wrap: wrap;
74
- `,Ae=r(I)`
74
+ `,Be=n(w)`
75
75
  h2 {
76
76
  margin: 0;
77
77
  }
78
- `,x=r.span`
78
+ `,x=n.span`
79
79
  color: var(--ink-dim);
80
- `,_=r(x)`
80
+ `,G=n(x)`
81
81
  display: block;
82
82
  margin-top: ${l.sm};
83
83
 
@@ -88,16 +88,16 @@ import{definePluginUI as It,useLive as $t}from"@omnigateway/dashboard-sdk";impor
88
88
  & + & {
89
89
  margin-top: ${l.xs};
90
90
  }
91
- `,Le=r.p`
91
+ `,Fe=n.p`
92
92
  color: var(--ink-dim);
93
93
  margin: ${l.xs} 0 ${l.lg};
94
- `,ce=r.p`
94
+ `,ge=n.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=r.span`
100
+ `,b=n.span`
101
101
  display: inline-flex;
102
102
  align-items: center;
103
103
  gap: ${l.xs};
@@ -109,31 +109,42 @@ import{definePluginUI as It,useLive as $t}from"@omnigateway/dashboard-sdk";impor
109
109
  text-transform: uppercase;
110
110
  color: var(--ink-dim);
111
111
  white-space: nowrap;
112
- `,Ne=r(I)`
112
+ `,Ke=n(w)`
113
113
  margin: ${l.xs} 0 ${l.sm};
114
- `,V=r(b)`
114
+ `,V=n(b)`
115
115
  border-color: var(--rule-strong);
116
116
  color: var(--ink);
117
117
  font-weight: 600;
118
- `,z=r.img`
119
- width: ${B};
120
- height: ${B};
118
+ `,q=n.img`
119
+ width: ${E};
120
+ height: ${E};
121
121
  image-rendering: pixelated;
122
- `,q=r.div`
122
+ `,Me=n.div`
123
123
  box-sizing: border-box;
124
- width: ${B};
125
- height: ${B};
124
+ width: ${E};
125
+ height: ${E};
126
126
  border-radius: 50% 50% 45% 45%;
127
127
  background: var(--panel-sunk);
128
128
  border: 2px solid var(--rule-strong);
129
- `,Be=r.div`
129
+ `,Oe=n.span`
130
+ display: inline-flex;
131
+ align-items: center;
132
+ justify-content: center;
133
+ flex: none;
134
+ width: ${E};
135
+ height: ${E};
136
+ `,_e=n.img`
137
+ width: 180px;
138
+ height: 180px;
139
+ image-rendering: pixelated;
140
+ `,Ge=n.div`
130
141
  box-sizing: border-box;
131
- width: ${B};
132
- height: ${B};
142
+ width: ${E};
143
+ height: ${E};
133
144
  border-radius: 6px;
134
145
  background: var(--warn-wash);
135
146
  border: 2px dashed var(--warn);
136
- `,k=r.button`
147
+ `,v=n.button`
137
148
  background: var(--panel-raised);
138
149
  border: 1px solid var(--rule);
139
150
  border-radius: 6px;
@@ -158,22 +169,22 @@ import{definePluginUI as It,useLive as $t}from"@omnigateway/dashboard-sdk";impor
158
169
  color: var(--ink-faint);
159
170
  cursor: not-allowed;
160
171
  }
161
- `,K=r.span`
162
- font-family: ${de};
172
+ `,B=n.span`
173
+ font-family: ${z};
163
174
  font-variant-numeric: tabular-nums;
164
- `,Ke=r.div`
175
+ `,He=n.div`
165
176
  display: flex;
166
177
  gap: 3px;
167
178
  min-width: 240px;
168
179
  max-width: 340px;
169
- `,Fe=r.div`
180
+ `,Ue=n.div`
170
181
  flex: 1;
171
182
  height: 10px;
172
183
  background: var(--panel-sunk);
173
184
  border: 1px solid var(--rule);
174
185
  border-radius: 3px;
175
186
  overflow: hidden;
176
- `,me=r.div`
187
+ `,he=n.div`
177
188
  height: 100%;
178
189
  background: var(--accent);
179
190
  width: ${(e)=>Math.min(100,Math.max(0,e.$pct))}%;
@@ -182,54 +193,65 @@ import{definePluginUI as It,useLive as $t}from"@omnigateway/dashboard-sdk";impor
182
193
  @media (prefers-reduced-motion: reduce) {
183
194
  transition: none;
184
195
  }
185
- `,Me=r.dl`
196
+ `,je=n.dl`
186
197
  display: flex;
187
198
  flex-wrap: wrap;
188
199
  gap: ${l.xl};
189
200
  margin: ${l.lg} 0 0;
190
201
  padding-top: ${l.lg};
191
202
  border-top: 1px solid var(--rule);
192
- `,J=r.div`
203
+ `,J=n.div`
193
204
  display: flex;
194
205
  flex-direction: column;
195
206
  gap: 2px;
196
- `,Q=r.dt`
207
+ `,Q=n.dt`
197
208
  font-size: 11px;
198
209
  letter-spacing: 0.08em;
199
210
  text-transform: uppercase;
200
211
  color: var(--ink-faint);
201
- `,Y=r.dd`
212
+ `,Y=n.dd`
202
213
  margin: 0;
203
- font-family: ${de};
214
+ font-family: ${z};
204
215
  font-variant-numeric: tabular-nums;
205
216
  font-size: 18px;
206
217
  color: var(--ink);
207
- `,Oe=r.div`
218
+ `,ze=n.div`
208
219
  display: grid;
209
220
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
210
221
  gap: ${l.md};
211
- `,_e=r.button`
222
+ `,Ve=n.button`
212
223
  margin: 0;
213
224
  display: flex;
214
225
  flex-direction: column;
215
226
  align-items: center;
216
227
  gap: 2px;
217
- padding: ${l.xs};
218
- background: ${(e)=>e.$open?"var(--accent-wash)":"none"};
219
- border: 1px solid ${(e)=>e.$open?"var(--accent)":"transparent"};
228
+ padding: ${l.sm};
229
+ background: ${(e)=>e.$open?"var(--accent-wash)":"var(--panel-sunk)"};
230
+ border: 1px solid ${(e)=>e.$open?"var(--accent)":"var(--rule)"};
220
231
  border-radius: 8px;
221
232
  color: inherit;
222
233
  font: inherit;
223
234
  cursor: pointer;
224
235
 
225
236
  &:hover {
226
- border-color: ${(e)=>e.$open?"var(--accent)":"var(--rule)"};
237
+ border-color: ${(e)=>e.$open?"var(--accent)":"var(--rule-strong)"};
227
238
  }
228
239
  &:focus-visible {
229
240
  outline: 2px solid var(--accent);
230
241
  outline-offset: 2px;
231
242
  }
232
- `,Ge=r.div`
243
+ `,Z=n.span`
244
+ font-family: ${z};
245
+ font-variant-numeric: tabular-nums;
246
+ font-size: 0.8em;
247
+ color: var(--ink-faint);
248
+ `,qe=n.h3`
249
+ display: flex;
250
+ align-items: baseline;
251
+ gap: ${l.sm};
252
+ `,Je=n(w)`
253
+ margin: 0 0 ${l.md};
254
+ `,Qe=n.div`
233
255
  grid-column: 1 / -1;
234
256
  display: flex;
235
257
  gap: ${l.lg};
@@ -237,18 +259,18 @@ import{definePluginUI as It,useLive as $t}from"@omnigateway/dashboard-sdk";impor
237
259
  background: var(--panel-sunk);
238
260
  border: 1px solid var(--rule);
239
261
  border-radius: 8px;
240
- `,He=r.div`
262
+ `,Ye=n.div`
241
263
  display: flex;
242
264
  flex-direction: column;
243
265
  align-items: flex-start;
244
266
  gap: ${l.sm};
245
267
  min-width: 0;
246
- `,Ue=r.div`
268
+ `,Ze=n.div`
247
269
  display: flex;
248
270
  align-items: center;
249
271
  gap: ${l.sm};
250
272
  flex-wrap: wrap;
251
- `,je=r.figure`
273
+ `,We=n.figure`
252
274
  margin: 0;
253
275
  display: flex;
254
276
  flex-direction: column;
@@ -260,16 +282,16 @@ import{definePluginUI as It,useLive as $t}from"@omnigateway/dashboard-sdk";impor
260
282
  height: 48px;
261
283
  image-rendering: pixelated;
262
284
  }
263
- `,Z=r.figcaption`
285
+ `,W=n.figcaption`
264
286
  color: var(--ink-dim);
265
287
  font-size: 11px;
266
288
  text-align: center;
267
289
  overflow-wrap: anywhere;
268
- `,Ve=r.div`
290
+ `,Xe=n.div`
269
291
  display: grid;
270
292
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
271
293
  gap: ${l.md};
272
- `,ze=r.button`
294
+ `,et=n.button`
273
295
  display: flex;
274
296
  flex-direction: column;
275
297
  align-items: center;
@@ -290,16 +312,16 @@ import{definePluginUI as It,useLive as $t}from"@omnigateway/dashboard-sdk";impor
290
312
  outline: 2px solid var(--accent);
291
313
  outline-offset: 2px;
292
314
  }
293
- `,W=r.span`
294
- font-family: ${de};
315
+ `,X=n.span`
316
+ font-family: ${z};
295
317
  font-size: 12px;
296
318
  color: var(--ink-dim);
297
319
  overflow-wrap: anywhere;
298
- `,X=r.div`
320
+ `,ee=n.div`
299
321
  display: grid;
300
322
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
301
323
  gap: ${l.md};
302
- `,ee=r.div`
324
+ `,te=n.div`
303
325
  display: flex;
304
326
  flex-direction: column;
305
327
  gap: ${l.sm};
@@ -307,25 +329,25 @@ import{definePluginUI as It,useLive as $t}from"@omnigateway/dashboard-sdk";impor
307
329
  background: var(--panel-sunk);
308
330
  border: 1px solid var(--rule);
309
331
  border-radius: 8px;
310
- `,te=r.div`
332
+ `,ne=n.div`
311
333
  display: flex;
312
334
  align-items: center;
313
335
  gap: ${l.sm};
314
- `,ne=r.span`
336
+ `,oe=n.span`
315
337
  flex: 1;
316
338
  overflow-wrap: anywhere;
317
- `,oe=r.p`
339
+ `,re=n.p`
318
340
  margin: 0;
319
341
  color: var(--ink-dim);
320
342
  font-size: 12px;
321
343
  line-height: 1.45;
322
- `,re=r.div`
344
+ `,ie=n.div`
323
345
  display: flex;
324
346
  align-items: center;
325
347
  justify-content: flex-end;
326
348
  gap: ${l.sm};
327
349
  margin-top: auto;
328
- `,qe=r.span`
350
+ `,tt=n.span`
329
351
  display: inline-flex;
330
352
  align-items: center;
331
353
  justify-content: center;
@@ -334,8 +356,8 @@ import{definePluginUI as It,useLive as $t}from"@omnigateway/dashboard-sdk";impor
334
356
  height: 32px;
335
357
  font-size: 20px;
336
358
  line-height: 1;
337
- `,Je=r.img`
359
+ `,nt=n.img`
338
360
  width: 32px;
339
361
  height: 32px;
340
362
  image-rendering: pixelated;
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};
363
+ `;import{jsx as ot}from"react/jsx-runtime";function ae({item:e,emoji:t,pluginId:o}){let[i,d]=vt(!1);return ot(tt,{"aria-hidden":"true",children:i?t:ot(nt,{alt:"",onError:()=>d(!0),src:ce(o,e)})})}import{jsx as N,jsxs as se}from"react/jsx-runtime";function rt({inventory:e,onUse:t,pending:o,pluginId:i}){let d=Object.entries(e).filter(([,p])=>p>0);if(d.length===0)return N(x,{children:"Nothing in the bag."});return N(ee,{children:d.map(([p,r])=>{let a=A(p);return se(te,{children:[se(ne,{children:[N(ae,{emoji:a.emoji,item:p,pluginId:i}),N(oe,{children:L(p)}),se(B,{children:["×",r]})]}),N(re,{children:a.blurb}),N(ie,{children:a.consumable?se(v,{disabled:o,onClick:()=>t(p),type:"button",children:["Use ",L(p)]}):N(x,{children:"held"})})]},p)})})}import{Fragment as kt,useState as it}from"react";import{jsx as y,jsxs as I,Fragment as $t}from"react/jsx-runtime";function at({entries:e,pluginId:t}){let[o,i]=it(null),[d,p]=it(null);if(e.length===0)return y(x,{children:"Nothing graduated yet."});let r=o===null?e:e.filter((a)=>a.rarity===o);return I($t,{children:[y(Je,{children:Ee.map((a)=>y(v,{"aria-pressed":o===a,onClick:()=>{i(a),p(null)},type:"button",children:a??"all"},a??"all"))}),r.length===0?I(x,{children:["No ",o," graduates yet."]}):y(ze,{children:r.map((a)=>{let s=d===a.id,k=`dex-detail-${a.id}`;return I(kt,{children:[I(Ve,{$open:s,"aria-controls":k,"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"}}),I(Z,{children:["#",a.finalId]}),a.name===null?null:y(W,{children:a.name}),a.nature===null?null:y(W,{children:a.nature})]}),s?y(It,{entry:a,id:k,pluginId:t}):null]},a.id)})})]})}function It({entry:e,id:t,pluginId:o}){return I(Qe,{id:t,children:[y("img",{alt:D(e.name,e.finalId,e.isShiny),src:R(o,e.finalId,e.isShiny),style:{width:"96px",height:"96px",imageRendering:"pixelated"}}),I(Ye,{children:[y("strong",{children:M(e.name,e.finalId)}),I(w,{children:[y(b,{children:e.rarity}),e.isShiny?y(V,{children:"✦ shiny"}):null,e.nature===null?null:y(b,{children:e.nature})]}),y(Ze,{children:e.chainOrder.map((i,d)=>I(We,{children:[y("img",{alt:D(null,i,!1),src:R(o,i,!1)}),y(W,{children:i===e.finalId?M(e.name,i):`#${i}`})]},`${i}-${d}`))}),I(x,{children:["caught ",new Date(e.caughtAt).toLocaleDateString()]})]})]})}import{useState as wt}from"react";import{jsx as fe}from"react/jsx-runtime";function le({pluginId:e}){let[t,o]=wt(!1);if(t)return fe(Me,{"aria-label":st,role:"img"});return fe(Oe,{children:fe(_e,{alt:st,onError:()=>o(!0),src:Ce(e)})})}var st="An egg, not yet hatched";import{jsx as xe,jsxs as Ct}from"react/jsx-runtime";function be({stages:e,stageIndex:t,progress:o,threshold:i,label:d,valueText:p}){let r=o/Math.max(1,i)*100;return xe(He,{"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)=>Ct(Ue,{children:[s<t?xe(he,{$pct:100}):null,s===t?xe(he,{$pct:r}):null]},s))})}function lt(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 F}from"react/jsx-runtime";function pt({view:e,activity:t,pluginId:o,onRelease:i,releasing:d}){let p=e.state;if(p===null)return null;let{active:r}=p,a=r===null?null:r.plannedPath[r.stageIndex]??null;return m(F,{children:[m(w,{children:[a===null?c(le,{pluginId:o}):c(q,{alt:D(e.name,a,r?.isShiny===!0),src:R(o,a,r?.isShiny===!0)}),m("div",{children:[c(qe,{children:a===null?"Egg":m(F,{children:[m(Z,{children:["#",a]}),e.name===null?null:c("span",{children:e.name})]})}),m(Ke,{children:[r===null?p.eggTier===null?null:m(b,{children:[p.eggTier,"+ guaranteed"]}):m(F,{children:[c(b,{children:r.rarity}),r.isShiny?m(V,{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?m(F,{children:[c(be,{label:"Incubation",progress:e.progress,stageIndex:0,stages:1,threshold:e.nextThreshold,valueText:`${h(e.progress)} of ${h(e.nextThreshold)} tokens incubated`}),m(G,{children:[h(e.progress)," / ",h(e.nextThreshold)," tokens incubated"]})]}):m(F,{children:[c(be,{label:"Growth to the next evolution",progress:e.progress,stageIndex:r.stageIndex,stages:r.plannedPath.length,threshold:e.nextThreshold,valueText:lt(r.plannedPath.length,r.stageIndex,e.progress,e.nextThreshold)}),m(G,{children:["Stage ",r.stageIndex+1," of ",r.plannedPath.length]}),r.everstone?m(F,{children:[m(G,{children:["Held at this stage · ",h(e.progress)," banked"]}),c(v,{disabled:d,onClick:i,type:"button",children:"Release"})]}):m(G,{children:[h(e.progress)," / ",h(e.nextThreshold)," to the next stage"]})]})]})]}),m(je,{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 Rt}from"react";import{jsx as S,jsxs as pe}from"react/jsx-runtime";function dt({keys:e,onPick:t,pluginId:o,rosterFailed:i}){let[d,p]=Rt("");return pe(_,{children:[S("h2",{children:"Companion"}),S(Fe,{children:"Each API key raises its own Pokémon on the tokens it spends. Pick a key."}),e.length>0?S(Xe,{children:e.map((r)=>S(Et,{entry:r,onPick:t,pluginId:o},r.apiKeyId))}):S(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."}),S(me,{children:"Or by key id"}),S("form",{onSubmit:(r)=>{r.preventDefault();let a=d.trim();if(a!=="")t(a)},children:pe(w,{children:[S("input",{"aria-label":"API key id",onChange:(r)=>p(r.target.value),placeholder:"key id",value:d}),S(v,{type:"submit",children:"Show"})]})})]})}function Et({entry:e,onPick:t,pluginId:o}){let i=O(e.speciesId!==null,e.lastCreditAt,Date.now());return pe(et,{onClick:()=>t(e.apiKeyId),type:"button",children:[e.unreadable?S(Ge,{"aria-label":"This key's save could not be read",role:"img"}):e.speciesId===null?S(le,{pluginId:o}):S(q,{alt:D(e.name,e.speciesId,e.isShiny),src:R(o,e.speciesId,e.isShiny)}),S("strong",{children:e.unreadable?"Save unreadable":e.speciesId===null?"Egg":M(e.name,e.speciesId)}),e.rarity===null?null:S(b,{children:e.rarity}),S(X,{children:e.apiKeyId}),pe(x,{children:[S(B,{children:h(e.tokensTotal)}),e.unreadable?null:` · ${i}`]})]})}import{useId as Tt,useState as Dt}from"react";import{jsx as H,jsxs as ut,Fragment as Pt}from"react/jsx-runtime";var K={shop:!0,bag:!0,dex:!0},ct=(e)=>`plugin:${e}:sections`;function Nt(e){try{let t=globalThis.localStorage?.getItem(ct(e));if(t===null||t===void 0)return K;let o=JSON.parse(t);if(typeof o!=="object"||o===null)return K;let i=o;return{shop:typeof i.shop==="boolean"?i.shop:K.shop,bag:typeof i.bag==="boolean"?i.bag:K.bag,dex:typeof i.dex==="boolean"?i.dex:K.dex}}catch{return K}}function mt(e){let[t,o]=Dt(()=>Nt(e));return{open:t,toggle:(d)=>{o((p)=>{let r={...p,[d]:!p[d]};try{globalThis.localStorage?.setItem(ct(e),JSON.stringify(r))}catch{}return r})}}}function de({title:e,count:t,open:o,onToggle:i,children:d}){let p=Tt();return ut(Pt,{children:[H(De,{children:ut(Pe,{"aria-controls":p,"aria-expanded":o,onClick:i,type:"button",children:[H(Ae,{$open:o,children:"▶"}),e,H(Ne,{}),H(Le,{children:t})]})}),o?H("div",{id:p,children:d}):null]})}import{jsx as P,jsxs as ue}from"react/jsx-runtime";function gt({offers:e,wallet:t,onBuy:o,pending:i,inventory:d,hasCompanion:p,pluginId:r}){return P(ee,{children:e.map((a)=>{let{entry:s,price:k}=a,C=At(s,d),u=s.kind==="egg"&&!p,T=s.kind==="item"?L(s.item):"fresh egg";return ue(te,{children:[ue(ne,{children:[P(ae,{emoji:s.kind==="item"?A(s.item).emoji:Ie,item:s.kind==="item"?s.item:"egg",pluginId:r}),P(oe,{children:T}),C?P(x,{children:"owned"}):P(B,{children:h(k)})]}),s.kind==="egg"&&s.tier!==null?ue(b,{children:[s.tier,"+"]}):null,P(re,{children:s.kind==="item"?A(s.item).blurb:$e(s.tier)}),P(ie,{children:ue(v,{disabled:C||u||t<k||i,onClick:()=>o(s),type:"button",children:["Buy ",Re(s)]})})]},s.kind==="item"?`item:${s.item}`:`egg:${s.tier??""}`)})})}function At(e,t){if(e.kind!=="item")return!1;return!A(e.item).consumable&&(t[e.item]??0)>0}import{jsx as f,jsxs as Se,Fragment as Ot}from"react/jsx-runtime";var xt=1e4;function Kt({pluginId:e,api:t}){let[o,i]=ft({at:"start"}),d=Ft(),{cadence:p}=Bt(),r=ht({queryKey:["roster"],queryFn:()=>t.get("keys"),refetchInterval:p(xt)}),a=r.data?.keys??[];if(o.at==="start"&&!r.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,k=ht({queryKey:["companion",s],queryFn:()=>t.get(`keys/${s}`),enabled:s!==null,refetchInterval:p(xt)}),[C,u]=ft(null),T=()=>{d.invalidateQueries({queryKey:["companion",s]}),d.invalidateQueries({queryKey:["roster"]})},U=ye({mutationFn:(g)=>t.post(`keys/${s}/purchase`,g),onMutate:()=>u(null),onError:(g)=>u(g instanceof Error?g.message:"the purchase was refused"),onSuccess:T}),j=ye({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:T}),ve=ye({mutationFn:()=>t.post(`keys/${s}/unpin`),onMutate:()=>u(null),onError:(g)=>u(g instanceof Error?g.message:"the companion could not be released"),onSuccess:T});if(r.isPending)return f(_,{children:"Loading…"});if(s===null)return f(dt,{keys:a,onPick:(g)=>i({at:"key",apiKeyId:g}),pluginId:e,rosterFailed:r.isError});return Se(_,{children:[Se(Be,{children:[f("h2",{children:"Companion"}),f(X,{children:s}),f(v,{onClick:()=>i({at:"roster"}),type:"button",children:"All keys"})]}),f(Mt,{buy:U.mutate,buying:U.isPending,keyId:s,onRelease:()=>ve.mutate(),onUse:j.mutate,pluginId:e,query:k,refusal:C,releasing:ve.isPending,using:j.isPending})]})}function Mt({query:e,pluginId:t,buy:o,onUse:i,onRelease:d,buying:p,using:r,releasing:a,refusal:s}){let{open:k,toggle:C}=mt(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(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 T=O(u.state.active!==null,u.lastCreditAt,Date.now()),U=Object.values(u.state.inventory).filter((j)=>j>0).length;return Se(Ot,{children:[f(pt,{activity:T,onRelease:d,pluginId:t,releasing:a,view:u}),f(de,{count:bt(u.shop.length,"offer"),onToggle:()=>C("shop"),open:k.shop,title:"Shop",children:f(gt,{hasCompanion:u.state.active!==null,inventory:u.state.inventory,offers:u.shop,onBuy:o,pending:p,pluginId:t,wallet:u.wallet})}),f(de,{count:`${U} held`,onToggle:()=>C("bag"),open:k.bag,title:"Bag",children:f(rt,{inventory:u.state.inventory,onUse:i,pending:r,pluginId:t})}),s===null?null:f(ge,{role:"alert",children:s}),f(de,{count:bt(u.dex.length,"graduate"),onToggle:()=>C("dex"),open:k.dex,title:"Pokédex",children:f(at,{entries:u.dex,pluginId:t})})]})}function bt(e,t){return`${e} ${t}${e===1?"":"s"}`}var Yn=Lt({mount:Kt});export{O as activityOf,Yn as default};