playsout-web-sdk 1.0.2 → 1.0.4

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 CHANGED
@@ -1,6 +1,18 @@
1
- # Playsout Web SDK
1
+ # Playsout Web SDK Integration Guide
2
2
 
3
- Playsout Web SDK provides a game list widget, SDK initialization, platform login, login state access, locale switching, and user points display for HTML, React, and Vue projects.
3
+ Playsout Web SDK lets HTML, Vue 3, and React applications embed the Playsout game list widget. It also provides SDK initialization, platform login, login state, user information, locale switching, and user points display.
4
+
5
+ This guide is organized so that integrators can select their project type and use the corresponding code directly.
6
+
7
+ ## Key Points
8
+
9
+ - `appId` is not required.
10
+ - Game details use iframe mode by default, so `detailMode` does not need to be provided.
11
+ - Persistent SDK image caching is currently disabled. Images use their online URLs directly.
12
+ - `user-points` seeds the widget's frontend gem balance. The SDK does not fetch or persist the balance through a backend.
13
+ - In iframe detail mode, games can request simulated gem payment through the `privy-bridge` postMessage protocol.
14
+ - Vue 3 projects built with Vite must configure `isCustomElement`.
15
+ - React projects do not need Vue's `isCustomElement` configuration. Import `playsout-web-sdk/web-components` once instead.
4
16
 
5
17
  ## Installation
6
18
 
@@ -8,32 +20,46 @@ Playsout Web SDK provides a game list widget, SDK initialization, platform login
8
20
  npm install playsout-web-sdk
9
21
  ```
10
22
 
11
- ## Supported Locales
23
+ ## Choose an Integration
12
24
 
13
- ```ts
14
- 'zh' | 'en' | 'ja' | 'ko' | 'vi' | 'th' | 'id' | 'ms'
15
- ```
25
+ | Project type | Guide |
26
+ | --- | --- |
27
+ | HTML / IIFE | [HTML integration](#html-integration) |
28
+ | Vue 3 + Vite | [Vue 3 integration](#vue-3-integration) |
29
+ | React | [React integration](#react-integration) |
16
30
 
17
- ## Login Platform Parameters
31
+ ## Recommended Integration Flow
18
32
 
19
- `appId` is not required.
33
+ Use the following sequence when the application starts:
20
34
 
21
- The public login method is:
35
+ 1. Initialize the SDK.
36
+ 2. Read the current login state.
37
+ 3. If the user is not logged in, call `Login()`.
38
+ 4. Render `<playsout-widget>`.
39
+ 5. Use `locale` to control the language and `user-points` to display the gem amount.
22
40
 
23
- ```ts
24
- Playsout.Login(params)
41
+ During initialization, the SDK checks `expiresAt` and `refreshExpiresAt`. It uses a valid access token directly, refreshes an expired access token when the refresh token is still valid, and clears the session when the refresh token has expired. Do not use `getUserInfo()` as a startup gate. Call it only when a page explicitly needs fresh backend user data, and handle that request error separately so the widget can still render.
42
+
43
+ ## Login Parameters
44
+
45
+ Grab and Eros use the same public login method:
46
+
47
+ ```js
48
+ await Playsout.Login(params);
25
49
  ```
26
50
 
27
- Supported platform values:
51
+ Required parameters:
28
52
 
29
- | Platform | `platform` |
53
+ | Parameter | Description |
30
54
  | --- | --- |
31
- | Grab | `grab` |
32
- | Eros | `eros` |
55
+ | `platform` | Platform identifier. Use `'grab'` or `'eros'`. |
56
+ | `platformUserId` | Unique user ID from the host platform. |
57
+ | `platformToken` | Login credential issued by the host platform for the current user. |
58
+ | `username` | User display name. |
33
59
 
34
- Login parameters:
60
+ Example:
35
61
 
36
- ```ts
62
+ ```js
37
63
  await Playsout.Login({
38
64
  platform: 'eros',
39
65
  platformUserId: '10',
@@ -42,118 +68,124 @@ await Playsout.Login({
42
68
  });
43
69
  ```
44
70
 
45
- `platform` should be lowercase. `grab` and `eros` require `platformUserId` and `platformToken`.
46
-
47
- ## HTML Usage
71
+ `platformToken` is a required, non-empty string. Playsout Web SDK does not impose any specific format or content requirements; it only validates the type and forwards the value to the backend unchanged.
48
72
 
49
- Use the IIFE build from a CDN or a local copy.
50
-
51
- ```html
52
- <div id="game-container"></div>
53
-
54
- <script src="https://unpkg.com/playsout-web-sdk/index.iife.js"></script>
55
- <script>
56
- window.Playsout.init({ locale: 'zh' }).then(function () {
57
- window.Playsout.mount('#game-container', {
58
- theme: 'dark',
59
- locale: 'zh',
60
- detailMode: 'iframe'
61
- });
73
+ ## HTML Integration
62
74
 
63
- document
64
- .querySelector('playsout-widget')
65
- ?.setAttribute('user-points', '1000');
66
- });
67
- </script>
68
- ```
75
+ Use this method for a page that does not use a Vue or React build setup.
69
76
 
70
- Login:
77
+ Place the following code in `index.html`:
71
78
 
72
- ```js
73
- await window.Playsout.Login({
74
- platform: 'eros',
75
- platformUserId: '10',
76
- platformToken: 'platform_token',
77
- username: 'TestUser'
78
- });
79
+ ```html
80
+ <!doctype html>
81
+ <html lang="en">
82
+ <head>
83
+ <meta charset="UTF-8" />
84
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
85
+ <title>Playsout HTML Demo</title>
86
+ </head>
87
+ <body>
88
+ <div id="game-container"></div>
89
+
90
+ <script src="https://unpkg.com/playsout-web-sdk/index.iife.js"></script>
91
+ <script>
92
+ let loginPromise = null;
93
+
94
+ function login() {
95
+ if (!loginPromise) {
96
+ loginPromise = window.Playsout.Login({
97
+ platform: 'eros',
98
+ platformUserId: '10',
99
+ platformToken: 'platform_token',
100
+ username: 'TestUser'
101
+ }).finally(function () {
102
+ loginPromise = null;
103
+ });
104
+ }
105
+
106
+ return loginPromise;
107
+ }
108
+
109
+ async function ensureLogin() {
110
+ if (!window.Playsout.isLoggedIn) {
111
+ return login();
112
+ }
113
+ }
114
+
115
+ async function bootstrap() {
116
+ await window.Playsout.init({ locale: 'zh' });
117
+
118
+ window.Playsout.on('authExpired', function () {
119
+ login().catch(function (error) {
120
+ console.error('Playsout re-login failed:', error);
121
+ });
122
+ });
123
+
124
+ await ensureLogin();
125
+
126
+ window.Playsout.mount('#game-container');
127
+
128
+ document
129
+ .querySelector('playsout-widget')
130
+ ?.setAttribute('user-points', '1000');
131
+ }
132
+
133
+ bootstrap().catch(function (error) {
134
+ console.error('Playsout bootstrap failed:', error);
135
+ });
136
+ </script>
137
+ </body>
138
+ </html>
79
139
  ```
80
140
 
81
- Login state:
141
+ Common HTML / IIFE APIs:
82
142
 
83
143
  ```js
144
+ window.Playsout.init({ locale: 'zh' });
84
145
  window.Playsout.isLoggedIn;
85
- window.Playsout.getToken();
146
+ window.Playsout.Login(params);
147
+ window.Playsout.getUserInfo();
86
148
  window.Playsout.getUser();
87
- ```
88
-
89
- Locale:
90
-
91
- ```js
92
149
  window.Playsout.setLocale('en');
93
150
  window.Playsout.getLocale();
94
151
  ```
95
152
 
96
- Auth expiration:
153
+ ## Vue 3 Integration
97
154
 
98
- ```js
99
- window.Playsout.on('authExpired', function () {
100
- // Get a new platform credential, then call Playsout.Login() again.
101
- });
102
- ```
155
+ ### 1. Configure `vite.config.js`
103
156
 
104
- ## React Usage
157
+ Add this configuration to `vite.config.js` or `vite.config.ts` in the Vue project.
105
158
 
106
- Import the Web Component once and initialize the SDK through `PlaysoutProvider`.
159
+ It tells the Vue compiler that `<playsout-widget>` is a native Web Component rather than a Vue component.
107
160
 
108
- ```tsx
109
- import 'playsout-web-sdk/web-components';
110
- import { PlaysoutProvider } from 'playsout-web-sdk/react';
111
-
112
- export function App() {
113
- return (
114
- <PlaysoutProvider config={{ locale: 'zh' }}>
115
- <GamePage />
116
- </PlaysoutProvider>
117
- );
118
- }
119
-
120
- function GamePage() {
121
- return (
122
- <playsout-widget
123
- locale="zh"
124
- user-points="1000"
125
- detail-mode="iframe"
126
- />
127
- );
128
- }
161
+ ```js
162
+ import { defineConfig } from 'vite';
163
+ import vue from '@vitejs/plugin-vue';
164
+
165
+ export default defineConfig({
166
+ plugins: [
167
+ vue({
168
+ template: {
169
+ compilerOptions: {
170
+ isCustomElement: (tag) => tag.startsWith('playsout-'),
171
+ },
172
+ },
173
+ }),
174
+ ],
175
+ });
129
176
  ```
130
177
 
131
- Use SDK APIs in React:
132
-
133
- ```tsx
134
- import { usePlaysout } from 'playsout-web-sdk/react';
178
+ Without this configuration, Vue may report:
135
179
 
136
- function LoginButton() {
137
- const { Login, isLoggedIn, user, setLocale } = usePlaysout();
138
-
139
- async function handleLogin() {
140
- await Login({
141
- platform: 'eros',
142
- platformUserId: '10',
143
- platformToken: 'platform_token',
144
- username: 'TestUser',
145
- });
146
- }
147
-
148
- return <button onClick={handleLogin}>Login</button>;
149
- }
180
+ ```text
181
+ Failed to resolve component: playsout-widget
150
182
  ```
151
183
 
152
- ## Vue Usage
184
+ ### 2. Initialize the SDK in `src/main.js`
153
185
 
154
- Initialize the SDK with the Vue plugin.
186
+ Place this code in the Vue entry file, usually `src/main.js` or `src/main.ts`.
155
187
 
156
- ```ts
188
+ ```js
157
189
  import { createApp } from 'vue';
158
190
  import { createPlaysoutPlugin } from 'playsout-web-sdk/vue';
159
191
  import 'playsout-web-sdk/web-components';
@@ -170,57 +202,204 @@ app.use(createPlaysoutPlugin({
170
202
  app.mount('#app');
171
203
  ```
172
204
 
173
- Use the widget:
205
+ `createPlaysoutPlugin({ config })` automatically calls `init(config)` when the plugin is installed. Vue components normally should not call `init()` again.
174
206
 
175
- ```vue
176
- <template>
177
- <playsout-widget
178
- locale="zh"
179
- user-points="1000"
180
- detail-mode="iframe"
181
- />
182
- </template>
183
- ```
207
+ ### 3. Use the SDK in the game page
184
208
 
185
- Use SDK APIs in Vue:
209
+ Place this code in the page component that displays the game list. In a new Vue project, it can be placed directly in `src/App.vue`.
186
210
 
187
211
  ```vue
188
212
  <script setup>
213
+ import { watch } from 'vue';
189
214
  import { usePlaysout } from 'playsout-web-sdk/vue';
190
215
 
191
- const { Login, isLoggedIn, user, setLocale } = usePlaysout();
216
+ const {
217
+ isInitialized,
218
+ isLoggedIn,
219
+ locale,
220
+ Login,
221
+ } = usePlaysout();
192
222
 
193
- async function handleLogin() {
194
- await Login({
195
- platform: 'eros',
196
- platformUserId: '10',
197
- platformToken: 'platform_token',
198
- username: 'TestUser',
199
- });
223
+ let loginPromise = null;
224
+
225
+ function login() {
226
+ if (!loginPromise) {
227
+ loginPromise = Login({
228
+ platform: 'eros',
229
+ platformUserId: '10',
230
+ platformToken: 'platform_token',
231
+ username: 'TestUser',
232
+ }).finally(() => {
233
+ loginPromise = null;
234
+ });
235
+ }
236
+
237
+ return loginPromise;
200
238
  }
239
+
240
+ watch([isInitialized, isLoggedIn], ([initialized, loggedIn]) => {
241
+ if (!initialized || loggedIn) return;
242
+
243
+ login().catch((error) => {
244
+ console.error('Playsout login flow failed:', error);
245
+ });
246
+ }, { immediate: true });
201
247
  </script>
202
248
 
203
249
  <template>
204
- <button @click="handleLogin">Login</button>
250
+ <playsout-widget
251
+ :locale="locale"
252
+ user-points="1000"
253
+ />
205
254
  </template>
206
255
  ```
207
256
 
208
- ## User Points
257
+ Vue notes:
258
+
259
+ - The page waits for plugin initialization, then checks the login state and runs the login flow automatically.
260
+ - `locale` controls the widget language.
261
+ - For a fixed default language, `config: { locale: 'zh' }` in the entry file is sufficient. If the application later needs dynamic locale switching, call `setLocale('en')` and bind `locale`.
262
+ - `user-points="1000"` seeds the widget's frontend gem balance. Iframe game payments can deduct from this in-session balance only.
263
+ - If the application already has a game page, place the logic in that page component.
264
+
265
+ ## React Integration
266
+
267
+ ### 1. Initialize the SDK in `src/main.jsx`
268
+
269
+ Place this code in the React entry file, usually `src/main.jsx` or `src/main.tsx`.
270
+
271
+ React does not require `isCustomElement` configuration. Tags containing a hyphen, such as `<playsout-widget>`, are handled as Custom Elements.
272
+
273
+ ```jsx
274
+ import { createRoot } from 'react-dom/client';
275
+ import { PlaysoutProvider } from 'playsout-web-sdk/react';
276
+ import 'playsout-web-sdk/web-components';
277
+ import App from './App.jsx';
278
+
279
+ createRoot(document.getElementById('root')).render(
280
+ <PlaysoutProvider config={{ locale: 'zh' }}>
281
+ <App />
282
+ </PlaysoutProvider>
283
+ );
284
+ ```
285
+
286
+ `PlaysoutProvider` automatically calls `init(config)` after receiving `config`. Page components normally should not call `init()` again.
287
+
288
+ ### 2. Use the SDK in the game page
289
+
290
+ Place this code in the page component that displays the game list. In a new React project, it can be placed directly in `src/App.jsx`.
291
+
292
+ ```jsx
293
+ import { useEffect, useRef } from 'react';
294
+ import { usePlaysout } from 'playsout-web-sdk/react';
295
+
296
+ export default function App() {
297
+ const loginInFlight = useRef(false);
298
+ const {
299
+ isInitialized,
300
+ isLoggedIn,
301
+ locale,
302
+ Login,
303
+ } = usePlaysout();
304
+
305
+ useEffect(() => {
306
+ if (!isInitialized || isLoggedIn || loginInFlight.current) return;
307
+ loginInFlight.current = true;
308
+
309
+ Login({
310
+ platform: 'eros',
311
+ platformUserId: '10',
312
+ platformToken: 'platform_token',
313
+ username: 'TestUser',
314
+ })
315
+ .catch((error) => {
316
+ console.error('Playsout login flow failed:', error);
317
+ })
318
+ .finally(() => {
319
+ loginInFlight.current = false;
320
+ });
321
+ }, [isInitialized, isLoggedIn, Login]);
322
+
323
+ return (
324
+ <playsout-widget
325
+ locale={locale}
326
+ user-points="1000"
327
+ />
328
+ );
329
+ }
330
+ ```
331
+
332
+ React notes:
209
333
 
210
- `user-points` is a UI display value passed by the host application.
334
+ - `PlaysoutProvider` initializes the SDK.
335
+ - After Provider initialization, the page checks the login state and runs the login flow once.
336
+ - `usePlaysout()` provides the login state, login method, user information method, and locale APIs.
337
+ - For a fixed default language, `<PlaysoutProvider config={{ locale: 'zh' }}>` is sufficient. If the application later needs dynamic locale switching, call `setLocale('en')` and bind `locale`.
338
+ - React does not need Vue's `isCustomElement` configuration.
211
339
 
212
- The SDK does not fetch the user's points balance from the backend.
340
+ ## Common API Reference
341
+
342
+ | Capability | HTML / IIFE | Vue 3 | React |
343
+ | --- | --- | --- | --- |
344
+ | Initialize | `Playsout.init(config)` | `createPlaysoutPlugin({ config })` | `<PlaysoutProvider config={...}>` |
345
+ | Check login state | `Playsout.isLoggedIn` | `isLoggedIn.value` | `isLoggedIn` |
346
+ | Log in | `Playsout.Login(params)` | `Login(params)` | `Login(params)` |
347
+ | Fetch latest user information | `Playsout.getUserInfo()` | `Playsout.getUserInfo()` | `getUserInfo()` |
348
+ | Read locally stored user information | `Playsout.getUser()` | `Playsout.getUser()` | `user` |
349
+ | Change locale | `Playsout.setLocale('en')` | `setLocale('en')` | `setLocale('en')` |
350
+ | Read current locale | `Playsout.getLocale()` | `locale.value` | `locale` |
351
+ | Log out | `Playsout.logout()` | `logout()` | `logout()` |
352
+
353
+ ## Supported Locales
354
+
355
+ ```ts
356
+ 'zh' | 'en' | 'ja' | 'ko' | 'vi' | 'th' | 'id' | 'ms'
357
+ ```
358
+
359
+ ## User Points and Simulated Payment
360
+
361
+ Pass the value through the `user-points` attribute:
213
362
 
214
363
  ```html
215
364
  <playsout-widget user-points="1000"></playsout-widget>
216
365
  ```
217
366
 
218
- ## Token Expiration
367
+ The SDK currently does not fetch, persist, or recharge the user's gem amount through a backend. `user-points` is supplied by the host application and becomes the widget's in-session frontend balance.
368
+
369
+ When a game is opened in iframe detail mode, the widget listens for `privy-bridge` `postMessage` requests from the current iframe only. Supported methods are:
370
+
371
+ - `bridge.handshake`
372
+ - `auth.getUser`
373
+ - `pay.createOrder`
374
+ - `pay.request`
375
+ - `pay.query`
376
+
377
+ `pay.request` opens a localized confirmation dialog. Confirm deducts gems from the in-session balance and emits `gem-balance-change`; cancel and insufficient balance do not deduct gems.
378
+
379
+ ## Authentication Expiration
380
+
381
+ The SDK handles an expired access token internally:
382
+
383
+ 1. A protected API reports that the token is invalid.
384
+ 2. The SDK automatically calls the refresh token endpoint.
385
+ 3. After a successful refresh, the SDK stores the new token and retries the original request.
219
386
 
220
- The SDK retries protected requests after refreshing the access token.
387
+ If the refresh token is also invalid, the SDK:
388
+
389
+ - Clears the local token.
390
+ - Changes the login state to logged out.
391
+ - Emits the `authExpired` event.
392
+
393
+ HTML / IIFE example:
394
+
395
+ ```js
396
+ window.Playsout.on('authExpired', function () {
397
+ // Get a new platform credential, then call Playsout.Login() again.
398
+ });
399
+ ```
221
400
 
222
- If the refresh token is also invalid, the SDK clears local auth data, changes the login state to logged out, and emits `authExpired`. The host application should get a new platform credential and call `Login()` again.
401
+ React and Vue adapters synchronize their reactive login state when `authExpired` is emitted. A watcher or effect that logs in whenever initialization is complete and `isLoggedIn` becomes false will therefore handle both startup and runtime expiration.
223
402
 
224
403
  ## Image Loading
225
404
 
226
- The SDK uses online image URLs directly. Persistent SDK image caching is disabled by default.
405
+ The SDK currently uses online image URLs directly. Persistent SDK image caching is disabled by default, so the SDK does not proactively store images in persistent browser storage.
@@ -0,0 +1,2 @@
1
+ import {c as c$1,b as b$1}from'./chunk-EZLO3WY6.js';var k=(p=>(p.NOT_INITIALIZED="NOT_INITIALIZED",p.ALREADY_INITIALIZED="ALREADY_INITIALIZED",p.NOT_LOGGED_IN="NOT_LOGGED_IN",p.TOKEN_EXPIRED="TOKEN_EXPIRED",p.INVALID_TOKEN="INVALID_TOKEN",p.NETWORK_ERROR="NETWORK_ERROR",p.TIMEOUT="TIMEOUT",p.SERVER_ERROR="SERVER_ERROR",p.API_ERROR="API_ERROR",p.INVALID_PARAMS="INVALID_PARAMS",p.MISSING_PARAMS="MISSING_PARAMS",p.FEATURE_NOT_SUPPORTED="FEATURE_NOT_SUPPORTED",p.UNKNOWN="UNKNOWN",p.PAYMENT_FAILED="PAYMENT_FAILED",p.SHARE_FAILED="SHARE_FAILED",p))(k||{}),y=class extends Error{constructor(t,r,i){super(r);this.code=t;this.details=i;this.name="SDKError";}toJSON(){return {name:this.name,code:this.code,message:this.message,details:this.details}}},W={NOT_INITIALIZED:"SDK not initialized. Please call PlaysoutSDK.init() first.",ALREADY_INITIALIZED:"SDK already initialized. Please do not call init() more than once.",NOT_LOGGED_IN:"User not logged in. Please log in first.",TOKEN_EXPIRED:"Login token has expired. Please log in again.",INVALID_TOKEN:"Invalid login token. Please log in again.",NETWORK_ERROR:"Network connection failed. Please check your network.",TIMEOUT:"Request timed out. Please try again later.",SERVER_ERROR:"Server is busy. Please try again later.",API_ERROR:"API request failed.",INVALID_PARAMS:"Invalid parameter(s).",MISSING_PARAMS:"Missing required parameter(s).",FEATURE_NOT_SUPPORTED:"This feature is not supported in the current environment.",UNKNOWN:"An unknown error occurred.",PAYMENT_FAILED:"Payment failed.",SHARE_FAILED:"Share failed."};function l(o,e){return new y(o,W[o],e)}var w="playsout_",R=class{constructor(e){this.storage=e;}get(e){try{return this.storage.getItem(w+e)}catch{return null}}set(e,t){try{this.storage.setItem(w+e,t);}catch(r){console.warn("[PlaysoutSDK] Storage set failed:",r);}}remove(e){try{this.storage.removeItem(w+e);}catch{}}clear(){try{let e=[];for(let t=0;t<this.storage.length;t++){let r=this.storage.key(t);r&&r.startsWith(w)&&e.push(r);}e.forEach(t=>this.storage.removeItem(t));}catch{}}},N=class{constructor(){this.store=new Map;}get(e){return this.store.get(e)??null}set(e,t){this.store.set(e,t);}remove(e){this.store.delete(e);}clear(){this.store.clear();}};function v(o="localStorage"){return typeof window>"u"||o==="memory"?new N:o==="sessionStorage"?new R(sessionStorage):new R(localStorage)}var I=v(),g={get:o=>I.get(o),set:(o,e)=>{I.set(o,e);},remove:o=>{I.remove(o);},clear:()=>{I.clear();},getJSON:o=>{let e=I.get(o);if(!e)return null;try{return JSON.parse(e)}catch{return null}},setJSON:(o,e)=>{I.set(o,JSON.stringify(e));},configure(o){I=v(o);}},c={TOKEN_DATA:"token_data",USER:"user",LOCALE:"locale",CONFIG:"config"};var $=o=>{if(!o)return o;try{let e=new URL(o);if(e.hostname==="games.playsout.com"){let t=e.pathname,r=t.endsWith("/"),i=/\.[a-z0-9]+$/i.test(t);!r&&!i&&(e.pathname=`${t}/`);}return e.toString()}catch{return o}},J=o=>o.map(e=>{if(!e.externalUrl)return e;let t=$(e.externalUrl);return t===e.externalUrl?e:{...e,externalUrl:t}}),Z=[{id:"BlockCrushFun",title:"Block Crush Fun",category:"Puzzle",image:c$1("./games/BlockCrushFun.png"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/BlockCrushFun"},{id:"DogeSurvivors",title:"Doge Survivors",category:"Doge OS",image:c$1("./games/DogeSurvivors.jpg"),isNew:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Doge/DogeSurvivors/"},{id:"DogeMaze",title:"Doge Maze",category:"Doge OS",image:c$1("./games/DogeMaze.jpg"),isNew:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Doge/DogeMaze/"},{id:"DogeMart",title:"Doge Mart",category:"Doge OS",image:c$1("./games/DogeMart.jpg"),isNew:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Doge/DogeMart/"},{id:"KittyEscape",title:"Kitty Escape",category:"Puzzle",image:c$1("./games/KittyEscape.jpg"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/KittyEscape/"},{id:"ProjectGarden",title:"Project: Garden",category:"Adventure",image:c$1("./games/SimulatedAdventures.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/simulated/"},{id:"ProjectIDLE",title:"Project: IDLE",category:"Simulation",image:c$1("./games/ProjectIDLE.jpg"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/idle/"},{id:"CulinaryStarWeb",title:"Culinary Star",category:"Casual",image:c$1("./games/CulinaryStar.webp"),description:"Cooking game",isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CulinaryStar/"},{id:"PickaxeQuest",title:"Pickaxe Quest",category:"Adventure",image:c$1("./games/PickaxeQuest.jpg"),description:"Mining and adventure game",isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/PickaxeQuest/",apiGameId:73},{id:"MonsterSurvivors",title:"Monster Survivors",category:"Adventure",image:c$1("./games/MonsterSurvivors.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/MonsterSurvivors/"},{id:"IdleTowerDefense",title:"Idle Tower Defense",category:"RPG",image:c$1("./games/IdleTowerDefense.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/IdleTowerDefense/"},{id:"MushroomWarriors",title:"Mushroom Warriors",category:"RPG",image:c$1("./games/MushroomWarriors.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/MushroomWarriors/"},{id:"FollowThePath",title:"Follow The Path",category:"Arcade",image:c$1("./games/FollowThePath.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/FollowThePath/"},{id:"ColorRun",title:"Color Run",category:"Arcade",image:c$1("./games/ColorRun.jpg"),isNew:false,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ColorRun/"},{id:"StupidArrow",title:"Stupid Arrow",category:"Arcade",image:c$1("./games/StupidArrow.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/StupidArrow/"},{id:"ZigZag",title:"Zig Zag",category:"Arcade",image:c$1("./games/ZigZag.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ZigZag/"},{id:"SpikesEverywhere",title:"Spikes Everywhere",category:"Arcade",image:c$1("./games/SpikesEverywhere.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/SpikesEverywhere/"},{id:"ArrowRacer",title:"Arrow Racer",category:"Arcade",image:c$1("./games/ArrowRacer.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ArrowRacer/"},{id:"CircleLeap",title:"Circle Leap",category:"Arcade",image:c$1("./games/CircleLeap.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CircleLeap/"},{id:"ColorMatcher",title:"Color Matcher",category:"Arcade",image:c$1("./games/ColorMatcher.jpg"),isNew:false,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ColorMatcher/"},{id:"EndlessMaze",title:"Endless Maze",category:"Arcade",image:c$1("./games/EndlessMaze.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/EndlessMaze/"},{id:"SpinningAround",title:"Spinning Around",category:"Arcade",image:c$1("./games/SpinningAround.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/SpinningAround/"},{id:"BoomBallz",title:"Boom Ballz",category:"Arcade",image:c$1("./games/BoomBallz.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/BoomBallz/"},{id:"CubeHead",title:"Cube Head",category:"Arcade",image:c$1("./games/CubeHead.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CubeHead/"},{id:"CapybaraLink",title:"Capybara Link",category:"Puzzle",image:c$1("./games/CapybaraLink.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CapybaraLink/"},{id:"Snake2048",title:"Snake 2048",category:"Puzzle",image:c$1("./games/Snake2048.jpg"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Snake2048/"},{id:"FishTankFury",title:"Fish Tank Fury",category:"Puzzle",image:c$1("./games/FishTankFury.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/FishTankFury/"},{id:"ConnectBalls",title:"Connect Balls",category:"Arcade",image:c$1("./games/ConnectBalls.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ConnectBalls/"},{id:"CircularBreaker",title:"Circular Breaker",category:"Arcade",image:c$1("./games/CircularBreaker.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CircularBreaker/"},{id:"OneDoor",title:"One Door",category:"Arcade",image:c$1("./games/OneDoor.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/OneDoor/"},{id:"CatchtheFruits",title:"Catch the Fruits",category:"Casual",image:c$1("./games/CatchtheFruits.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CatchtheFruits/"},{id:"Falling2048",title:"Falling 2048",category:"Casual",image:c$1("./games/Falling2048.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Falling2048/"}],x=J(Z),E=()=>x.filter(o=>o.enable);({Adventure:E().filter(o=>o.category==="Adventure"),Moba:E().filter(o=>o.category==="Moba")});var G=o=>x.find(e=>e.id===o);var K=()=>Array.from(new Set(E().map(o=>o.category)));var U="https://api.playsout.com",C=3e4;function V(o){let e=String(o?.platform||"").toLowerCase();if(e==="tiktok"){let t=o.authorizationCode;if(typeof t!="string"||!t.trim())throw l("MISSING_PARAMS","authorizationCode is required for TikTok login");return {platform:e,authorizationCode:t}}if(e==="grab"||e==="eros"){let t=o;if(typeof t.platformUserId!="string"||!t.platformUserId.trim())throw l("MISSING_PARAMS","platformUserId is required for Grab/Eros login");if(typeof t.platformToken!="string"||!t.platformToken.trim())throw l("MISSING_PARAMS","platformToken is required for Grab/Eros login");return {platform:e,platformUserId:t.platformUserId,platformToken:t.platformToken,username:typeof t.username=="string"?t.username:void 0,inviteCode:typeof t.inviteCode=="string"?t.inviteCode:void 0}}throw l("INVALID_PARAMS","Unsupported platform. Expected grab, eros, or tiktok")}var A=null,O=null,L=null;function j(o){O=o;}function F(o){L=o;}function M(){if(L)try{L();}catch{}}async function z(o,e={},t,r=false){let i=t?.apiBaseUrl||U,d=o.startsWith("http")?o:`${i}${o}`,u=new AbortController,s=setTimeout(()=>u.abort(),C);try{let m=g.getJSON(c.TOKEN_DATA),f={"Content-Type":"application/json",...e.headers};m?.accessToken&&!f.token&&(f.token=m.accessToken);let h=await fetch(d,{...e,signal:u.signal,headers:f});if(clearTimeout(s),!h.ok){if(h.status===401&&r)return await H(o,e,t);throw l(h.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${h.status}: ${h.statusText}`)}let D=await h.json();if(D.code!==1e4){if(r)return await H(o,e,t);throw l("API_ERROR",D.msg||"API request failed")}return D.data}catch(m){throw clearTimeout(s),m instanceof y?m:m instanceof Error?m.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",m.message):l("UNKNOWN")}}async function H(o,e,t){await B(t);let r=t?.apiBaseUrl||U,i=o.startsWith("http")?o:`${r}${o}`,d=new AbortController,u=setTimeout(()=>d.abort(),C);try{let s=g.getJSON(c.TOKEN_DATA),m={"Content-Type":"application/json",...e.headers};s?.accessToken&&(m.token=s.accessToken);let f=await fetch(i,{...e,signal:d.signal,headers:m});if(clearTimeout(u),!f.ok)throw l(f.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${f.status}: ${f.statusText}`);let h=await f.json();if(h.code!==1e4)throw l("API_ERROR",h.msg||"API request failed");return h.data}catch(s){throw clearTimeout(u),s instanceof y?s:s instanceof Error&&s.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",s?.message||"Request failed")}}async function B(o){if(A)return A;let e=(async()=>{let t=g.getJSON(c.TOKEN_DATA),r=Math.floor(Date.now()/1e3);if(!t?.refreshToken||t.refreshExpiresAt<=r)throw M(),l("TOKEN_EXPIRED","Refresh token has expired");let i=o?.apiBaseUrl||U,d=new AbortController,u=setTimeout(()=>d.abort(),C);try{let s=await fetch(`${i}/platform/refreshToken`,{method:"POST",signal:d.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t.refreshToken})});if(clearTimeout(u),!s.ok)throw s.status>=500?l("SERVER_ERROR",`HTTP ${s.status}: ${s.statusText}`):l("TOKEN_EXPIRED",`HTTP ${s.status}: ${s.statusText}`);let m=await s.json();if(m.code!==1e4||!m.data)throw l("TOKEN_EXPIRED",m.msg||"Failed to refresh token");let f=m.data;if(g.setJSON(c.TOKEN_DATA,f),O)try{O(f);}catch{}return f}catch(s){throw clearTimeout(u),s instanceof y?((s.code==="TOKEN_EXPIRED"||s.code==="NOT_LOGGED_IN")&&M(),s):s instanceof Error&&s.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",s?.message||"Refresh token failed")}})();A=e;try{return await e}finally{A===e&&(A=null);}}var b=class{constructor(){this.config=null;}configure(e){this.config=e;}async refreshToken(){return await B(this.config||void 0)}async getGames(e){let t=E();if(e?.category&&(t=t.filter(r=>r.category===e.category)),e?.search){let r=e.search.toLowerCase();t=t.filter(i=>i.title.toLowerCase().includes(r)||i.category.toLowerCase().includes(r)||i.description&&i.description.toLowerCase().includes(r));}if(e?.sortBy)switch(e.sortBy){case "newest":t=t.filter(r=>r.isNew).concat(t.filter(r=>!r.isNew));break;case "rating":t=t.filter(r=>r.isHot).concat(t.filter(r=>!r.isHot));break}if(e?.page&&e?.pageSize){let r=(e.page-1)*e.pageSize;t=t.slice(r,r+e.pageSize);}return t}async getCategories(){let e=E(),t=new Map;return e.forEach(r=>{let i=t.get(r.category)||0;t.set(r.category,i+1);}),Array.from(t.entries()).map(([r,i],d)=>({id:`category_${d}`,name:r,count:i}))}async getGameById(e){return G(e)}async getCategoryNames(){return K()}async loginOnly(e){let t=V(e);return await z("/platform/login",{method:"POST",body:JSON.stringify(t)},this.config??void 0)}async Login(e){let t=await this.loginOnly(e),r;try{r=await this.getUserInfo();}catch{}return {tokenData:t,user:r}}async getUserInfo(){return await z("/platform/user",{method:"GET"},this.config??void 0,true)}async getUser(){return g.getJSON(c.USER)}async validateToken(e){return !!e}},_=null;function P(){return _||(_=new b),_}var X="https://api.playsout.com",q="zh",S=class o{constructor(){this.config=null;this._isInitialized=false;this._user=null;this._token=null;this._locale=q;this._widget=null;}clearAuthState(){let e=!!(this._token||g.get(c.TOKEN_DATA)||g.get(c.USER));return this._user=null,this._token=null,g.remove(c.TOKEN_DATA),g.remove(c.USER),e}handleAuthExpired(){this.clearAuthState()&&b$1.emit("authExpired"),this.config?.debug&&console.warn("[PlaysoutSDK] Auth expired, logged out");}static getInstance(){return o.instance||(o.instance=new o),o.instance}async init(e={}){if(this._isInitialized)throw l("ALREADY_INITIALIZED");this.config={apiBaseUrl:e.apiBaseUrl||X,debug:e.debug||false,storage:e.storage||"localStorage",locale:e.locale||q,appId:e.appId||""},g.configure(this.config.storage),j(i=>{this._token=i.accessToken;}),F(()=>{this.handleAuthExpired();});let t=g.getJSON(c.TOKEN_DATA);this._user=g.getJSON(c.USER),this._locale=g.get(c.LOCALE)||this.config.locale;let r=Math.floor(Date.now()/1e3);if(t)if(!t.refreshToken||t.refreshExpiresAt<=r)this.handleAuthExpired();else if(t.accessToken&&t.expiresAt>r)this._token=t.accessToken;else try{let i=P();i.configure(this.config),await i.refreshToken();}catch(i){if(!(i instanceof y&&(i.code==="TOKEN_EXPIRED"||i.code==="NOT_LOGGED_IN")))throw i}this._isInitialized=true,this.config.debug&&(console.log("[PlaysoutSDK] Initialized with config:",this.config),console.log("[PlaysoutSDK] Restored token:",this._token?this._token.substring(0,20)+"...":"(none)")),b$1.emit("initialized");}destroy(){this.config=null,this._isInitialized=false,this._user=null,this._token=null,g.clear(),b$1.clear();}get isInitialized(){return this._isInitialized}get isLoggedIn(){return !!this._token}get user(){return this._user}get token(){return this._token}get locale(){return this._locale}get sdkConfig(){return this.config}async Login(e){this.ensureInitialized(),this.config?.debug&&console.log("[PlaysoutSDK] Login with params:",e);let t=P();t.configure(this.config);let r=await t.loginOnly(e);g.setJSON(c.TOKEN_DATA,r),this.config?.debug&&console.log("[PlaysoutSDK] Token saved, expires at:",new Date(r.expiresAt*1e3).toISOString());let i;try{i=await t.getUserInfo();}catch(u){if(u instanceof y&&(u.code==="TOKEN_EXPIRED"||u.code==="NOT_LOGGED_IN"||u.code==="INVALID_TOKEN"))throw u;this.config?.debug&&console.log("[PlaysoutSDK] getUserInfo failed, login still success:",u);}let d=g.getJSON(c.TOKEN_DATA);return this._token=d?.accessToken||r.accessToken,i&&(this._user={userId:String(i.id),username:i.username},g.setJSON(c.USER,this._user)),this.config?.debug&&console.log("[PlaysoutSDK] Login success, user:",i),b$1.emit("login",{user:this._user,token:this._token}),{tokenData:r,user:i}}async getUserInfo(){if(this.ensureInitialized(),!this._token)throw l("NOT_LOGGED_IN","Please login first");let e=P();e.configure(this.config);let t=await e.getUserInfo();return this.config?.debug&&console.log("[PlaysoutSDK] getUserInfo result:",t),t&&(this._user={userId:String(t.id),username:t.username},g.setJSON(c.USER,this._user)),t}logout(){this.clearAuthState(),b$1.emit("logout");}getToken(){return this.ensureInitialized(),this._token}getUser(){return this.ensureInitialized(),this._user}setLocale(e){if(this.ensureInitialized(),!["zh","en","ja","ko","vi","th","id","ms"].includes(e))throw l("INVALID_PARAMS",`Unsupported locale: ${e}`);this._locale=e,g.set(c.LOCALE,e),this.config?.debug&&console.log("[PlaysoutSDK] Locale changed to:",e);let t=this._widget||document.querySelector("playsout-widget");t&&t.getAttribute("locale")!==e&&t.setAttribute("locale",e),b$1.emit("localeChange",e);}getLocale(){return this.ensureInitialized(),this._locale}async getGames(e){this.ensureInitialized();let t=E();if(e?.category&&(t=t.filter(r=>r.category===e.category)),e?.search){let r=e.search.toLowerCase();t=t.filter(i=>i.title.toLowerCase().includes(r)||i.category.toLowerCase().includes(r)||i.description&&i.description.toLowerCase().includes(r));}if(e?.sortBy)switch(e.sortBy){case "newest":t=t.filter(r=>r.isNew).concat(t.filter(r=>!r.isNew));break;case "rating":t=t.filter(r=>r.isHot).concat(t.filter(r=>!r.isHot));break}if(e?.page&&e?.pageSize){let r=(e.page-1)*e.pageSize;t=t.slice(r,r+e.pageSize);}return t}async getCategories(){this.ensureInitialized();let e=E(),t=new Map;return e.forEach(r=>{let i=t.get(r.category)||0;t.set(r.category,i+1);}),Array.from(t.entries()).map(([r,i],d)=>({id:`category_${d}`,name:r,count:i}))}async getGameById(e){return this.ensureInitialized(),E().find(t=>t.id===e)}mount(e,t){if(this.ensureInitialized(),typeof document>"u")throw l("FEATURE_NOT_SUPPORTED","mount requires DOM environment");let r=document.querySelector(e);if(!r)throw l("INVALID_PARAMS",`Container not found: ${e}`);let i=document.createElement("playsout-widget");this.config?.appId&&i.setAttribute("app-id",this.config.appId),i.setAttribute("locale",t?.locale||this._locale),t?.detailMode&&i.setAttribute("detail-mode",t.detailMode),this._widget=i,t?.onGameClick&&i.addEventListener("game-click",d=>{let u=d;t.onGameClick(u.detail);}),t?.onLoginRequired&&i.addEventListener("login-required",t.onLoginRequired),t?.onLocaleChange&&i.addEventListener("locale-change",d=>{let u=d;t.onLocaleChange(u.detail);}),r.appendChild(i),this.config?.debug&&console.log("[PlaysoutSDK] Widget mounted to:",e);}unmount(){let e=document.querySelector("playsout-widget");e&&e.remove(),this._widget=null;}on(e,t){return this.ensureInitialized(),b$1.on(e,t)}off(e,t){this.ensureInitialized(),b$1.off(e,t);}ensureInitialized(){if(!this._isInitialized)throw l("NOT_INITIALIZED")}},a=S.getInstance(),fe=a;typeof window<"u"&&(window.__playsout_sdk_instance=a);var Ee=Object.freeze({init:a.init.bind(a),mount:a.mount.bind(a),unmount:a.unmount.bind(a),destroy:a.destroy.bind(a),Login:a.Login.bind(a),logout:a.logout.bind(a),getToken:a.getToken.bind(a),getUserInfo:a.getUserInfo.bind(a),getUser:a.getUser.bind(a),setLocale:a.setLocale.bind(a),getLocale:a.getLocale.bind(a),getGames:a.getGames.bind(a),getCategories:a.getCategories.bind(a),on:a.on.bind(a),off:a.off.bind(a),get isInitialized(){return a.isInitialized},get isLoggedIn(){return a.isLoggedIn},instance:a,PlaysoutSDKClass:S});
2
+ export{k as a,y as b,g as c,c as d,S as e,a as f,fe as g,Ee as h};
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkZ2CIDSTP_cjs=require('./chunk-Z2CIDSTP.cjs');var k=(p=>(p.NOT_INITIALIZED="NOT_INITIALIZED",p.ALREADY_INITIALIZED="ALREADY_INITIALIZED",p.NOT_LOGGED_IN="NOT_LOGGED_IN",p.TOKEN_EXPIRED="TOKEN_EXPIRED",p.INVALID_TOKEN="INVALID_TOKEN",p.NETWORK_ERROR="NETWORK_ERROR",p.TIMEOUT="TIMEOUT",p.SERVER_ERROR="SERVER_ERROR",p.API_ERROR="API_ERROR",p.INVALID_PARAMS="INVALID_PARAMS",p.MISSING_PARAMS="MISSING_PARAMS",p.FEATURE_NOT_SUPPORTED="FEATURE_NOT_SUPPORTED",p.UNKNOWN="UNKNOWN",p.PAYMENT_FAILED="PAYMENT_FAILED",p.SHARE_FAILED="SHARE_FAILED",p))(k||{}),y=class extends Error{constructor(t,r,i){super(r);this.code=t;this.details=i;this.name="SDKError";}toJSON(){return {name:this.name,code:this.code,message:this.message,details:this.details}}},W={NOT_INITIALIZED:"SDK not initialized. Please call PlaysoutSDK.init() first.",ALREADY_INITIALIZED:"SDK already initialized. Please do not call init() more than once.",NOT_LOGGED_IN:"User not logged in. Please log in first.",TOKEN_EXPIRED:"Login token has expired. Please log in again.",INVALID_TOKEN:"Invalid login token. Please log in again.",NETWORK_ERROR:"Network connection failed. Please check your network.",TIMEOUT:"Request timed out. Please try again later.",SERVER_ERROR:"Server is busy. Please try again later.",API_ERROR:"API request failed.",INVALID_PARAMS:"Invalid parameter(s).",MISSING_PARAMS:"Missing required parameter(s).",FEATURE_NOT_SUPPORTED:"This feature is not supported in the current environment.",UNKNOWN:"An unknown error occurred.",PAYMENT_FAILED:"Payment failed.",SHARE_FAILED:"Share failed."};function l(o,e){return new y(o,W[o],e)}var w="playsout_",R=class{constructor(e){this.storage=e;}get(e){try{return this.storage.getItem(w+e)}catch{return null}}set(e,t){try{this.storage.setItem(w+e,t);}catch(r){console.warn("[PlaysoutSDK] Storage set failed:",r);}}remove(e){try{this.storage.removeItem(w+e);}catch{}}clear(){try{let e=[];for(let t=0;t<this.storage.length;t++){let r=this.storage.key(t);r&&r.startsWith(w)&&e.push(r);}e.forEach(t=>this.storage.removeItem(t));}catch{}}},N=class{constructor(){this.store=new Map;}get(e){return this.store.get(e)??null}set(e,t){this.store.set(e,t);}remove(e){this.store.delete(e);}clear(){this.store.clear();}};function v(o="localStorage"){return typeof window>"u"||o==="memory"?new N:o==="sessionStorage"?new R(sessionStorage):new R(localStorage)}var I=v(),g={get:o=>I.get(o),set:(o,e)=>{I.set(o,e);},remove:o=>{I.remove(o);},clear:()=>{I.clear();},getJSON:o=>{let e=I.get(o);if(!e)return null;try{return JSON.parse(e)}catch{return null}},setJSON:(o,e)=>{I.set(o,JSON.stringify(e));},configure(o){I=v(o);}},c={TOKEN_DATA:"token_data",USER:"user",LOCALE:"locale",CONFIG:"config"};var $=o=>{if(!o)return o;try{let e=new URL(o);if(e.hostname==="games.playsout.com"){let t=e.pathname,r=t.endsWith("/"),i=/\.[a-z0-9]+$/i.test(t);!r&&!i&&(e.pathname=`${t}/`);}return e.toString()}catch{return o}},J=o=>o.map(e=>{if(!e.externalUrl)return e;let t=$(e.externalUrl);return t===e.externalUrl?e:{...e,externalUrl:t}}),Z=[{id:"BlockCrushFun",title:"Block Crush Fun",category:"Puzzle",image:chunkZ2CIDSTP_cjs.c("./games/BlockCrushFun.png"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/BlockCrushFun"},{id:"DogeSurvivors",title:"Doge Survivors",category:"Doge OS",image:chunkZ2CIDSTP_cjs.c("./games/DogeSurvivors.jpg"),isNew:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Doge/DogeSurvivors/"},{id:"DogeMaze",title:"Doge Maze",category:"Doge OS",image:chunkZ2CIDSTP_cjs.c("./games/DogeMaze.jpg"),isNew:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Doge/DogeMaze/"},{id:"DogeMart",title:"Doge Mart",category:"Doge OS",image:chunkZ2CIDSTP_cjs.c("./games/DogeMart.jpg"),isNew:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Doge/DogeMart/"},{id:"KittyEscape",title:"Kitty Escape",category:"Puzzle",image:chunkZ2CIDSTP_cjs.c("./games/KittyEscape.jpg"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/KittyEscape/"},{id:"ProjectGarden",title:"Project: Garden",category:"Adventure",image:chunkZ2CIDSTP_cjs.c("./games/SimulatedAdventures.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/simulated/"},{id:"ProjectIDLE",title:"Project: IDLE",category:"Simulation",image:chunkZ2CIDSTP_cjs.c("./games/ProjectIDLE.jpg"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/idle/"},{id:"CulinaryStarWeb",title:"Culinary Star",category:"Casual",image:chunkZ2CIDSTP_cjs.c("./games/CulinaryStar.webp"),description:"Cooking game",isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CulinaryStar/"},{id:"PickaxeQuest",title:"Pickaxe Quest",category:"Adventure",image:chunkZ2CIDSTP_cjs.c("./games/PickaxeQuest.jpg"),description:"Mining and adventure game",isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/PickaxeQuest/",apiGameId:73},{id:"MonsterSurvivors",title:"Monster Survivors",category:"Adventure",image:chunkZ2CIDSTP_cjs.c("./games/MonsterSurvivors.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/MonsterSurvivors/"},{id:"IdleTowerDefense",title:"Idle Tower Defense",category:"RPG",image:chunkZ2CIDSTP_cjs.c("./games/IdleTowerDefense.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/IdleTowerDefense/"},{id:"MushroomWarriors",title:"Mushroom Warriors",category:"RPG",image:chunkZ2CIDSTP_cjs.c("./games/MushroomWarriors.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/MushroomWarriors/"},{id:"FollowThePath",title:"Follow The Path",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/FollowThePath.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/FollowThePath/"},{id:"ColorRun",title:"Color Run",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/ColorRun.jpg"),isNew:false,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ColorRun/"},{id:"StupidArrow",title:"Stupid Arrow",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/StupidArrow.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/StupidArrow/"},{id:"ZigZag",title:"Zig Zag",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/ZigZag.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ZigZag/"},{id:"SpikesEverywhere",title:"Spikes Everywhere",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/SpikesEverywhere.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/SpikesEverywhere/"},{id:"ArrowRacer",title:"Arrow Racer",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/ArrowRacer.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ArrowRacer/"},{id:"CircleLeap",title:"Circle Leap",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/CircleLeap.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CircleLeap/"},{id:"ColorMatcher",title:"Color Matcher",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/ColorMatcher.jpg"),isNew:false,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ColorMatcher/"},{id:"EndlessMaze",title:"Endless Maze",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/EndlessMaze.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/EndlessMaze/"},{id:"SpinningAround",title:"Spinning Around",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/SpinningAround.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/SpinningAround/"},{id:"BoomBallz",title:"Boom Ballz",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/BoomBallz.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/BoomBallz/"},{id:"CubeHead",title:"Cube Head",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/CubeHead.jpg"),isNew:false,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CubeHead/"},{id:"CapybaraLink",title:"Capybara Link",category:"Puzzle",image:chunkZ2CIDSTP_cjs.c("./games/CapybaraLink.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CapybaraLink/"},{id:"Snake2048",title:"Snake 2048",category:"Puzzle",image:chunkZ2CIDSTP_cjs.c("./games/Snake2048.jpg"),isNew:true,isHot:true,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Snake2048/"},{id:"FishTankFury",title:"Fish Tank Fury",category:"Puzzle",image:chunkZ2CIDSTP_cjs.c("./games/FishTankFury.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/FishTankFury/"},{id:"ConnectBalls",title:"Connect Balls",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/ConnectBalls.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/ConnectBalls/"},{id:"CircularBreaker",title:"Circular Breaker",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/CircularBreaker.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CircularBreaker/"},{id:"OneDoor",title:"One Door",category:"Arcade",image:chunkZ2CIDSTP_cjs.c("./games/OneDoor.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/OneDoor/"},{id:"CatchtheFruits",title:"Catch the Fruits",category:"Casual",image:chunkZ2CIDSTP_cjs.c("./games/CatchtheFruits.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/CatchtheFruits/"},{id:"Falling2048",title:"Falling 2048",category:"Casual",image:chunkZ2CIDSTP_cjs.c("./games/Falling2048.jpg"),isNew:true,isHot:false,enable:true,orientation:"portrait",externalUrl:"https://games.playsout.com/Falling2048/"}],x=J(Z),E=()=>x.filter(o=>o.enable);({Adventure:E().filter(o=>o.category==="Adventure"),Moba:E().filter(o=>o.category==="Moba")});var G=o=>x.find(e=>e.id===o);var K=()=>Array.from(new Set(E().map(o=>o.category)));var U="https://api.playsout.com",C=3e4;function V(o){let e=String(o?.platform||"").toLowerCase();if(e==="tiktok"){let t=o.authorizationCode;if(typeof t!="string"||!t.trim())throw l("MISSING_PARAMS","authorizationCode is required for TikTok login");return {platform:e,authorizationCode:t}}if(e==="grab"||e==="eros"){let t=o;if(typeof t.platformUserId!="string"||!t.platformUserId.trim())throw l("MISSING_PARAMS","platformUserId is required for Grab/Eros login");if(typeof t.platformToken!="string"||!t.platformToken.trim())throw l("MISSING_PARAMS","platformToken is required for Grab/Eros login");return {platform:e,platformUserId:t.platformUserId,platformToken:t.platformToken,username:typeof t.username=="string"?t.username:void 0,inviteCode:typeof t.inviteCode=="string"?t.inviteCode:void 0}}throw l("INVALID_PARAMS","Unsupported platform. Expected grab, eros, or tiktok")}var A=null,O=null,L=null;function j(o){O=o;}function F(o){L=o;}function M(){if(L)try{L();}catch{}}async function z(o,e={},t,r=false){let i=t?.apiBaseUrl||U,d=o.startsWith("http")?o:`${i}${o}`,u=new AbortController,s=setTimeout(()=>u.abort(),C);try{let m=g.getJSON(c.TOKEN_DATA),f={"Content-Type":"application/json",...e.headers};m?.accessToken&&!f.token&&(f.token=m.accessToken);let h=await fetch(d,{...e,signal:u.signal,headers:f});if(clearTimeout(s),!h.ok){if(h.status===401&&r)return await H(o,e,t);throw l(h.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${h.status}: ${h.statusText}`)}let D=await h.json();if(D.code!==1e4){if(r)return await H(o,e,t);throw l("API_ERROR",D.msg||"API request failed")}return D.data}catch(m){throw clearTimeout(s),m instanceof y?m:m instanceof Error?m.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",m.message):l("UNKNOWN")}}async function H(o,e,t){await B(t);let r=t?.apiBaseUrl||U,i=o.startsWith("http")?o:`${r}${o}`,d=new AbortController,u=setTimeout(()=>d.abort(),C);try{let s=g.getJSON(c.TOKEN_DATA),m={"Content-Type":"application/json",...e.headers};s?.accessToken&&(m.token=s.accessToken);let f=await fetch(i,{...e,signal:d.signal,headers:m});if(clearTimeout(u),!f.ok)throw l(f.status>=500?"SERVER_ERROR":"API_ERROR",`HTTP ${f.status}: ${f.statusText}`);let h=await f.json();if(h.code!==1e4)throw l("API_ERROR",h.msg||"API request failed");return h.data}catch(s){throw clearTimeout(u),s instanceof y?s:s instanceof Error&&s.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",s?.message||"Request failed")}}async function B(o){if(A)return A;let e=(async()=>{let t=g.getJSON(c.TOKEN_DATA),r=Math.floor(Date.now()/1e3);if(!t?.refreshToken||t.refreshExpiresAt<=r)throw M(),l("TOKEN_EXPIRED","Refresh token has expired");let i=o?.apiBaseUrl||U,d=new AbortController,u=setTimeout(()=>d.abort(),C);try{let s=await fetch(`${i}/platform/refreshToken`,{method:"POST",signal:d.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({refreshToken:t.refreshToken})});if(clearTimeout(u),!s.ok)throw s.status>=500?l("SERVER_ERROR",`HTTP ${s.status}: ${s.statusText}`):l("TOKEN_EXPIRED",`HTTP ${s.status}: ${s.statusText}`);let m=await s.json();if(m.code!==1e4||!m.data)throw l("TOKEN_EXPIRED",m.msg||"Failed to refresh token");let f=m.data;if(g.setJSON(c.TOKEN_DATA,f),O)try{O(f);}catch{}return f}catch(s){throw clearTimeout(u),s instanceof y?((s.code==="TOKEN_EXPIRED"||s.code==="NOT_LOGGED_IN")&&M(),s):s instanceof Error&&s.name==="AbortError"?l("TIMEOUT"):l("NETWORK_ERROR",s?.message||"Refresh token failed")}})();A=e;try{return await e}finally{A===e&&(A=null);}}var b=class{constructor(){this.config=null;}configure(e){this.config=e;}async refreshToken(){return await B(this.config||void 0)}async getGames(e){let t=E();if(e?.category&&(t=t.filter(r=>r.category===e.category)),e?.search){let r=e.search.toLowerCase();t=t.filter(i=>i.title.toLowerCase().includes(r)||i.category.toLowerCase().includes(r)||i.description&&i.description.toLowerCase().includes(r));}if(e?.sortBy)switch(e.sortBy){case "newest":t=t.filter(r=>r.isNew).concat(t.filter(r=>!r.isNew));break;case "rating":t=t.filter(r=>r.isHot).concat(t.filter(r=>!r.isHot));break}if(e?.page&&e?.pageSize){let r=(e.page-1)*e.pageSize;t=t.slice(r,r+e.pageSize);}return t}async getCategories(){let e=E(),t=new Map;return e.forEach(r=>{let i=t.get(r.category)||0;t.set(r.category,i+1);}),Array.from(t.entries()).map(([r,i],d)=>({id:`category_${d}`,name:r,count:i}))}async getGameById(e){return G(e)}async getCategoryNames(){return K()}async loginOnly(e){let t=V(e);return await z("/platform/login",{method:"POST",body:JSON.stringify(t)},this.config??void 0)}async Login(e){let t=await this.loginOnly(e),r;try{r=await this.getUserInfo();}catch{}return {tokenData:t,user:r}}async getUserInfo(){return await z("/platform/user",{method:"GET"},this.config??void 0,true)}async getUser(){return g.getJSON(c.USER)}async validateToken(e){return !!e}},_=null;function P(){return _||(_=new b),_}var X="https://api.playsout.com",q="zh",S=class o{constructor(){this.config=null;this._isInitialized=false;this._user=null;this._token=null;this._locale=q;this._widget=null;}clearAuthState(){let e=!!(this._token||g.get(c.TOKEN_DATA)||g.get(c.USER));return this._user=null,this._token=null,g.remove(c.TOKEN_DATA),g.remove(c.USER),e}handleAuthExpired(){this.clearAuthState()&&chunkZ2CIDSTP_cjs.b.emit("authExpired"),this.config?.debug&&console.warn("[PlaysoutSDK] Auth expired, logged out");}static getInstance(){return o.instance||(o.instance=new o),o.instance}async init(e={}){if(this._isInitialized)throw l("ALREADY_INITIALIZED");this.config={apiBaseUrl:e.apiBaseUrl||X,debug:e.debug||false,storage:e.storage||"localStorage",locale:e.locale||q,appId:e.appId||""},g.configure(this.config.storage),j(i=>{this._token=i.accessToken;}),F(()=>{this.handleAuthExpired();});let t=g.getJSON(c.TOKEN_DATA);this._user=g.getJSON(c.USER),this._locale=g.get(c.LOCALE)||this.config.locale;let r=Math.floor(Date.now()/1e3);if(t)if(!t.refreshToken||t.refreshExpiresAt<=r)this.handleAuthExpired();else if(t.accessToken&&t.expiresAt>r)this._token=t.accessToken;else try{let i=P();i.configure(this.config),await i.refreshToken();}catch(i){if(!(i instanceof y&&(i.code==="TOKEN_EXPIRED"||i.code==="NOT_LOGGED_IN")))throw i}this._isInitialized=true,this.config.debug&&(console.log("[PlaysoutSDK] Initialized with config:",this.config),console.log("[PlaysoutSDK] Restored token:",this._token?this._token.substring(0,20)+"...":"(none)")),chunkZ2CIDSTP_cjs.b.emit("initialized");}destroy(){this.config=null,this._isInitialized=false,this._user=null,this._token=null,g.clear(),chunkZ2CIDSTP_cjs.b.clear();}get isInitialized(){return this._isInitialized}get isLoggedIn(){return !!this._token}get user(){return this._user}get token(){return this._token}get locale(){return this._locale}get sdkConfig(){return this.config}async Login(e){this.ensureInitialized(),this.config?.debug&&console.log("[PlaysoutSDK] Login with params:",e);let t=P();t.configure(this.config);let r=await t.loginOnly(e);g.setJSON(c.TOKEN_DATA,r),this.config?.debug&&console.log("[PlaysoutSDK] Token saved, expires at:",new Date(r.expiresAt*1e3).toISOString());let i;try{i=await t.getUserInfo();}catch(u){if(u instanceof y&&(u.code==="TOKEN_EXPIRED"||u.code==="NOT_LOGGED_IN"||u.code==="INVALID_TOKEN"))throw u;this.config?.debug&&console.log("[PlaysoutSDK] getUserInfo failed, login still success:",u);}let d=g.getJSON(c.TOKEN_DATA);return this._token=d?.accessToken||r.accessToken,i&&(this._user={userId:String(i.id),username:i.username},g.setJSON(c.USER,this._user)),this.config?.debug&&console.log("[PlaysoutSDK] Login success, user:",i),chunkZ2CIDSTP_cjs.b.emit("login",{user:this._user,token:this._token}),{tokenData:r,user:i}}async getUserInfo(){if(this.ensureInitialized(),!this._token)throw l("NOT_LOGGED_IN","Please login first");let e=P();e.configure(this.config);let t=await e.getUserInfo();return this.config?.debug&&console.log("[PlaysoutSDK] getUserInfo result:",t),t&&(this._user={userId:String(t.id),username:t.username},g.setJSON(c.USER,this._user)),t}logout(){this.clearAuthState(),chunkZ2CIDSTP_cjs.b.emit("logout");}getToken(){return this.ensureInitialized(),this._token}getUser(){return this.ensureInitialized(),this._user}setLocale(e){if(this.ensureInitialized(),!["zh","en","ja","ko","vi","th","id","ms"].includes(e))throw l("INVALID_PARAMS",`Unsupported locale: ${e}`);this._locale=e,g.set(c.LOCALE,e),this.config?.debug&&console.log("[PlaysoutSDK] Locale changed to:",e);let t=this._widget||document.querySelector("playsout-widget");t&&t.getAttribute("locale")!==e&&t.setAttribute("locale",e),chunkZ2CIDSTP_cjs.b.emit("localeChange",e);}getLocale(){return this.ensureInitialized(),this._locale}async getGames(e){this.ensureInitialized();let t=E();if(e?.category&&(t=t.filter(r=>r.category===e.category)),e?.search){let r=e.search.toLowerCase();t=t.filter(i=>i.title.toLowerCase().includes(r)||i.category.toLowerCase().includes(r)||i.description&&i.description.toLowerCase().includes(r));}if(e?.sortBy)switch(e.sortBy){case "newest":t=t.filter(r=>r.isNew).concat(t.filter(r=>!r.isNew));break;case "rating":t=t.filter(r=>r.isHot).concat(t.filter(r=>!r.isHot));break}if(e?.page&&e?.pageSize){let r=(e.page-1)*e.pageSize;t=t.slice(r,r+e.pageSize);}return t}async getCategories(){this.ensureInitialized();let e=E(),t=new Map;return e.forEach(r=>{let i=t.get(r.category)||0;t.set(r.category,i+1);}),Array.from(t.entries()).map(([r,i],d)=>({id:`category_${d}`,name:r,count:i}))}async getGameById(e){return this.ensureInitialized(),E().find(t=>t.id===e)}mount(e,t){if(this.ensureInitialized(),typeof document>"u")throw l("FEATURE_NOT_SUPPORTED","mount requires DOM environment");let r=document.querySelector(e);if(!r)throw l("INVALID_PARAMS",`Container not found: ${e}`);let i=document.createElement("playsout-widget");this.config?.appId&&i.setAttribute("app-id",this.config.appId),i.setAttribute("locale",t?.locale||this._locale),t?.detailMode&&i.setAttribute("detail-mode",t.detailMode),this._widget=i,t?.onGameClick&&i.addEventListener("game-click",d=>{let u=d;t.onGameClick(u.detail);}),t?.onLoginRequired&&i.addEventListener("login-required",t.onLoginRequired),t?.onLocaleChange&&i.addEventListener("locale-change",d=>{let u=d;t.onLocaleChange(u.detail);}),r.appendChild(i),this.config?.debug&&console.log("[PlaysoutSDK] Widget mounted to:",e);}unmount(){let e=document.querySelector("playsout-widget");e&&e.remove(),this._widget=null;}on(e,t){return this.ensureInitialized(),chunkZ2CIDSTP_cjs.b.on(e,t)}off(e,t){this.ensureInitialized(),chunkZ2CIDSTP_cjs.b.off(e,t);}ensureInitialized(){if(!this._isInitialized)throw l("NOT_INITIALIZED")}},a=S.getInstance(),fe=a;typeof window<"u"&&(window.__playsout_sdk_instance=a);var Ee=Object.freeze({init:a.init.bind(a),mount:a.mount.bind(a),unmount:a.unmount.bind(a),destroy:a.destroy.bind(a),Login:a.Login.bind(a),logout:a.logout.bind(a),getToken:a.getToken.bind(a),getUserInfo:a.getUserInfo.bind(a),getUser:a.getUser.bind(a),setLocale:a.setLocale.bind(a),getLocale:a.getLocale.bind(a),getGames:a.getGames.bind(a),getCategories:a.getCategories.bind(a),on:a.on.bind(a),off:a.off.bind(a),get isInitialized(){return a.isInitialized},get isLoggedIn(){return a.isLoggedIn},instance:a,PlaysoutSDKClass:S});
2
+ exports.a=k;exports.b=y;exports.c=g;exports.d=c;exports.e=S;exports.f=a;exports.g=fe;exports.h=Ee;
package/core/api.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/core/api.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,SAAS,EAET,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EACV,MAAM,SAAS,CAAC;AAwFjB,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,GAAG,IAAI,CAEtF;AAMD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAEjE;AA6ND,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAA0B;IAKxC,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAS5B,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC;IAQlC,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAuClD,aAAa,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAmBpC,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC;IAOlD,gBAAgB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAOrC,SAAS,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC;IAY1D,KAAK,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAuBhE,WAAW,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAUxC,OAAO,IAAI,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAO/B,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAIrD;AAKD,wBAAgB,SAAS,IAAI,MAAM,CAKlC"}
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/core/api.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,SAAS,EAET,IAAI,EACJ,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,SAAS,EACV,MAAM,SAAS,CAAC;AAoFjB,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,GAAG,IAAI,CAEtF;AAMD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAEjE;AAsOD,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAA0B;IAKxC,SAAS,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI;IAS5B,YAAY,IAAI,OAAO,CAAC,SAAS,CAAC;IAQlC,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;IAuClD,aAAa,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAmBpC,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC;IAOlD,gBAAgB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAOrC,SAAS,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,SAAS,CAAC;IAY1D,KAAK,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAuBhE,WAAW,IAAI,OAAO,CAAC,gBAAgB,CAAC;IAUxC,OAAO,IAAI,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAO/B,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAIrD;AAKD,wBAAgB,SAAS,IAAI,MAAM,CAKlC"}