@rpgjs/client 5.0.0-alpha.13 → 5.0.0-alpha.14
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/dist/index10.js +1 -1
- package/dist/index15.js +2 -2
- package/dist/index15.js.map +1 -1
- package/dist/index16.js.map +1 -1
- package/dist/index19.js.map +1 -1
- package/dist/index22.js +32 -32
- package/dist/index22.js.map +1 -1
- package/dist/index23.js +2 -2
- package/dist/index23.js.map +1 -1
- package/dist/index30.js.map +1 -1
- package/dist/index31.js.map +1 -1
- package/dist/index33.js +1 -1
- package/dist/index34.js +1 -1
- package/dist/index35.js +184 -9
- package/dist/index35.js.map +1 -1
- package/dist/index36.js +495 -4394
- package/dist/index36.js.map +1 -1
- package/dist/index37.js +9 -171
- package/dist/index37.js.map +1 -1
- package/dist/index38.js +6 -500
- package/dist/index38.js.map +1 -1
- package/dist/index39.js +3680 -67
- package/dist/index39.js.map +1 -1
- package/dist/index4.js +6 -1
- package/dist/index4.js.map +1 -1
- package/dist/index40.js +67 -10
- package/dist/index40.js.map +1 -1
- package/dist/index41.js +3 -93
- package/dist/index41.js.map +1 -1
- package/dist/index42.js +20 -0
- package/dist/index42.js.map +1 -0
- package/dist/index43.js +96 -0
- package/dist/index43.js.map +1 -0
- package/dist/index44.js +12 -0
- package/dist/index44.js.map +1 -0
- package/dist/index45.js +113 -0
- package/dist/index45.js.map +1 -0
- package/dist/index46.js +136 -0
- package/dist/index46.js.map +1 -0
- package/dist/index47.js +137 -0
- package/dist/index47.js.map +1 -0
- package/dist/index48.js +112 -0
- package/dist/index48.js.map +1 -0
- package/dist/index49.js +9 -0
- package/dist/index49.js.map +1 -0
- package/dist/services/mmorpg.d.ts +1 -0
- package/package.json +8 -8
- package/src/components/character.ce +3 -2
- package/src/services/mmorpg.ts +7 -1
package/dist/index4.js
CHANGED
|
@@ -9,6 +9,9 @@ class BridgeWebsocket extends AbstractWebsocket {
|
|
|
9
9
|
super(context);
|
|
10
10
|
this.context = context;
|
|
11
11
|
this.options = options;
|
|
12
|
+
const id = localStorage.getItem("rpgjs-user-id") || crypto.randomUUID();
|
|
13
|
+
localStorage.setItem("rpgjs-user-id", id);
|
|
14
|
+
this.privateId = id;
|
|
12
15
|
}
|
|
13
16
|
async connection(listeners) {
|
|
14
17
|
class Room {
|
|
@@ -16,7 +19,8 @@ class BridgeWebsocket extends AbstractWebsocket {
|
|
|
16
19
|
const instance = new Room();
|
|
17
20
|
this.socket = await connectionRoom({
|
|
18
21
|
host: this.options.host || window.location.host,
|
|
19
|
-
room: "lobby-1"
|
|
22
|
+
room: "lobby-1",
|
|
23
|
+
id: this.privateId
|
|
20
24
|
}, instance);
|
|
21
25
|
listeners?.(this.socket);
|
|
22
26
|
}
|
|
@@ -32,6 +36,7 @@ class BridgeWebsocket extends AbstractWebsocket {
|
|
|
32
36
|
updateProperties({ room }) {
|
|
33
37
|
this.socket.conn.updateProperties({
|
|
34
38
|
room,
|
|
39
|
+
id: this.privateId,
|
|
35
40
|
host: this.options.host
|
|
36
41
|
});
|
|
37
42
|
}
|
package/dist/index4.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index4.js","sources":["../src/services/mmorpg.ts"],"sourcesContent":["import { Context } from \"@signe/di\";\nimport { connectionRoom } from \"@signe/sync/client\";\nimport { RpgGui } from \"../Gui/Gui\";\nimport { RpgClientEngine } from \"../RpgClientEngine\";\nimport { AbstractWebsocket, WebSocketToken } from \"./AbstractSocket\";\nimport { UpdateMapService, UpdateMapToken } from \"@rpgjs/common\";\n\ninterface MmorpgOptions {\n host?: string;\n}\n\nclass BridgeWebsocket extends AbstractWebsocket {\n
|
|
1
|
+
{"version":3,"file":"index4.js","sources":["../src/services/mmorpg.ts"],"sourcesContent":["import { Context } from \"@signe/di\";\nimport { connectionRoom } from \"@signe/sync/client\";\nimport { RpgGui } from \"../Gui/Gui\";\nimport { RpgClientEngine } from \"../RpgClientEngine\";\nimport { AbstractWebsocket, WebSocketToken } from \"./AbstractSocket\";\nimport { UpdateMapService, UpdateMapToken } from \"@rpgjs/common\";\n\ninterface MmorpgOptions {\n host?: string;\n}\n\nclass BridgeWebsocket extends AbstractWebsocket {\n private socket: any;\n private privateId: string;\n\n constructor(protected context: Context, private options: MmorpgOptions = {}) {\n super(context);\n const id = localStorage.getItem(\"rpgjs-user-id\") || crypto.randomUUID()\n localStorage.setItem(\"rpgjs-user-id\", id)\n this.privateId = id\n }\n\n async connection(listeners?: (data: any) => void) {\n // tmp\n class Room {\n \n }\n const instance = new Room()\n this.socket = await connectionRoom({\n host: this.options.host || window.location.host,\n room: \"lobby-1\",\n id: this.privateId\n }, instance)\n\n listeners?.(this.socket)\n }\n\n on(key: string, callback: (data: any) => void) {\n this.socket.on(key, callback);\n }\n\n off(event: string, callback: (data: any) => void) {\n this.socket.off(event, callback);\n }\n\n emit(event: string, data: any) {\n this.socket.emit(event, data);\n }\n\n updateProperties({ room }: { room: any }) {\n this.socket.conn.updateProperties({\n room: room,\n id: this.privateId,\n host: this.options.host\n })\n }\n\n async reconnect(listeners?: (data: any) => void) {\n this.socket.conn.reconnect()\n }\n}\n\nclass UpdateMapStandaloneService extends UpdateMapService {\n constructor(protected context: Context, private options: MmorpgOptions) {\n super(context);\n }\n\n async update(map: any) {\n // nothing\n }\n}\n\nexport function provideMmorpg(options: MmorpgOptions) {\n return [\n {\n provide: WebSocketToken,\n useFactory: (context: Context) => new BridgeWebsocket(context, options),\n },\n {\n provide: UpdateMapToken,\n useFactory: (context: Context) => new UpdateMapStandaloneService(context, options),\n },\n RpgGui,\n RpgClientEngine,\n ];\n}\n"],"names":[],"mappings":";;;;;;AAWA,MAAM,wBAAwB,iBAAA,CAAkB;AAAA,EAI9C,WAAA,CAAsB,OAAA,EAA0B,OAAA,GAAyB,EAAC,EAAG;AAC3E,IAAA,KAAA,CAAM,OAAO,CAAA;AADO,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAA0B,IAAA,IAAA,CAA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;AAAA,EACH;AAAA,EAEA,MAAM,UAAU,SAAA,EAAiC;AAChD,IAAA,IAAA,CAAK,MAAA,CAAO,KAAK,SAAA,EAAU;AAAA,EAC5B;AACF;AAEA,MAAM,mCAAmC,gBAAA,CAAiB;AAAA,EACxD,WAAA,CAAsB,SAA0B,OAAA,EAAwB;AACtE,IAAA,KAAA,CAAM,OAAO,CAAA;AADO,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAA0B,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAAA,EAEhD;AAAA,EAEA,MAAM,OAAO,GAAA,EAAU;AAAA,EAEvB;AACF;AAEO,SAAS,cAAc,OAAA,EAAwB;AACpD,EAAA,OAAO;AAAA,IACL;AAAA,MACE,OAAA,EAAS,cAAA;AAAA,MACT,YAAY,CAAC,OAAA,KAAqB,IAAI,eAAA,CAAgB,SAAS,OAAO;AAAA,KACxE;AAAA,IACA;AAAA,MACE,OAAA,EAAS,cAAA;AAAA,MACT,YAAY,CAAC,OAAA,KAAqB,IAAI,0BAAA,CAA2B,SAAS,OAAO;AAAA,KACnF;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
package/dist/index40.js
CHANGED
|
@@ -1,18 +1,75 @@
|
|
|
1
|
-
import { useProps, useDefineProps,
|
|
1
|
+
import { useProps, useDefineProps, mount, signal, h, Container, loop, Howl, computed } from 'canvasengine';
|
|
2
|
+
import component$1 from './index42.js';
|
|
3
|
+
import { RpgClientEngine } from './index2.js';
|
|
4
|
+
import { inject } from './index6.js';
|
|
2
5
|
|
|
3
6
|
function component($$props) {
|
|
4
7
|
useProps($$props);
|
|
5
8
|
const defineProps = useDefineProps($$props);
|
|
6
|
-
var _a
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
var _a, _b, _c, _d, _e, _f;
|
|
10
|
+
var _g = defineProps(), items = _g.items, wrapAround = _g.wrapAround, onSelect = _g.onSelect, selectedIndex = _g.selectedIndex;
|
|
11
|
+
var client = inject(RpgClientEngine);
|
|
12
|
+
var keyboardControls = client.globalConfig.keyboardControls;
|
|
13
|
+
var sounds = client.sounds;
|
|
14
|
+
var dialogBoxCursorSound = (_c = (_b = (_a = client.globalConfig) === null || _a === void 0 ? void 0 : _a.box) === null || _b === void 0 ? void 0 : _b.sounds) === null || _c === void 0 ? void 0 : _c.cursorMove;
|
|
15
|
+
var dialogBoxCursorSelectSound = (_f = (_e = (_d = client.globalConfig) === null || _d === void 0 ? void 0 : _d.box) === null || _e === void 0 ? void 0 : _e.sounds) === null || _f === void 0 ? void 0 : _f.cursorSelect;
|
|
16
|
+
var playDialogBoxSound = function (soundId) {
|
|
17
|
+
var _a;
|
|
18
|
+
if (!soundId)
|
|
19
|
+
return;
|
|
20
|
+
var sound = new Howl.Howl({
|
|
21
|
+
src: [(_a = sounds.get(soundId)) === null || _a === void 0 ? void 0 : _a.src]
|
|
22
|
+
});
|
|
23
|
+
sound.play();
|
|
24
|
+
};
|
|
25
|
+
var selected = function (index) {
|
|
26
|
+
return computed(function () {
|
|
27
|
+
return index === selectedIndex();
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
mount(function (element) {
|
|
31
|
+
return function () {
|
|
32
|
+
element.directives.controls.onDestroy();
|
|
33
|
+
};
|
|
11
34
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
35
|
+
var controls = signal({
|
|
36
|
+
down: {
|
|
37
|
+
bind: keyboardControls.down,
|
|
38
|
+
keyDown: function () {
|
|
39
|
+
playDialogBoxSound(dialogBoxCursorSound);
|
|
40
|
+
selectedIndex.update(function (currentIndex) {
|
|
41
|
+
if (wrapAround) {
|
|
42
|
+
return (currentIndex + 1) % items().length;
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return Math.min(currentIndex + 1, items().length - 1);
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
up: {
|
|
51
|
+
bind: keyboardControls.up,
|
|
52
|
+
keyDown: function () {
|
|
53
|
+
playDialogBoxSound(dialogBoxCursorSound);
|
|
54
|
+
selectedIndex.update(function (currentIndex) {
|
|
55
|
+
if (wrapAround) {
|
|
56
|
+
return (currentIndex - 1 + items().length) % items().length;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
return Math.max(currentIndex - 1, 0);
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
enter: {
|
|
65
|
+
bind: keyboardControls.action,
|
|
66
|
+
keyDown: function () {
|
|
67
|
+
onSelect === null || onSelect === void 0 ? void 0 : onSelect(selectedIndex());
|
|
68
|
+
playDialogBoxSound(dialogBoxCursorSelectSound);
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
let $this = h(Container, { controls, flexDirection: 'column', margin: [0, 0, 0, 50] }, loop(items, (item, index) => h(component$1, { text: item.text, isSelected: selected(index) })));
|
|
16
73
|
return $this
|
|
17
74
|
}
|
|
18
75
|
|
package/dist/index40.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index40.js","sources":["../src/components/gui/dialogbox/
|
|
1
|
+
{"version":3,"file":"index40.js","sources":["../src/components/gui/dialogbox/selection.ce"],"sourcesContent":["<Container controls flexDirection=\"column\" margin={[0, 0, 0, 50]}>\n @for ((item,index) of items) { \n <ItemMenu text={@item.@text} isSelected={@selected(@index)} /> \n }\n</Container>\n\n<script>\n import { signal, computed, mount, Howl } from \"canvasengine\";\n import ItemMenu from \"./itemMenu.ce\";\n import { RpgClientEngine } from \"../../../RpgClientEngine\";\n import { inject } from \"../../../core/inject\";\n\n const {\n items,\n wrapAround,\n onSelect,\n selectedIndex,\n } = defineProps();\n\n const client = inject(RpgClientEngine);\n const keyboardControls = client.globalConfig.keyboardControls;\n const sounds = client.sounds;\n const dialogBoxCursorSound = client.globalConfig?.box?.sounds?.cursorMove\n const dialogBoxCursorSelectSound = client.globalConfig?.box?.sounds?.cursorSelect\n\n\n const playDialogBoxSound = (soundId) => {\n if (!soundId) return;\n const sound = new Howl.Howl({\n src: [sounds.get(soundId)?.src]\n })\n sound.play()\n }\n\n const selected = (index) => {\n return computed(() => {\n return index === selectedIndex();\n })\n }\n\n mount((element) => {\n return () => {\n element.directives.controls.onDestroy()\n }\n })\n\n const controls = signal({\n down: {\n bind: keyboardControls.down,\n keyDown() {\n playDialogBoxSound(dialogBoxCursorSound);\n selectedIndex.update((currentIndex) => {\n if (wrapAround) {\n return (currentIndex + 1) % items().length;\n } else {\n return Math.min(currentIndex + 1, items().length - 1);\n }\n });\n },\n },\n up: {\n bind: keyboardControls.up,\n keyDown() {\n playDialogBoxSound(dialogBoxCursorSound);\n selectedIndex.update((currentIndex) => {\n if (wrapAround) {\n return (currentIndex - 1 + items().length) % items().length;\n } else {\n return Math.max(currentIndex - 1, 0);\n }\n });\n },\n },\n enter: {\n bind: keyboardControls.action,\n keyDown() {\n onSelect?.(selectedIndex());\n playDialogBoxSound(dialogBoxCursorSelectSound);\n },\n },\n });\n</script>\n"],"names":["ItemMenu"],"mappings":";;;;;AASqB,SAAS,SAAS,CAAC,OAAO,EAAE;AACjD,QAAuB,QAAQ,CAAC,OAAO;AACvC,QAAQ,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO;AAClD,QAAQ,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE;AAClC,IAAI,EAAE,GAAG,WAAW,EAAE,EAAE,KAAK,GAAG,EAAE,CAAC,KAAK,EAAE,UAAU,GAAG,EAAE,CAAC,UAAU,EAAE,QAAQ,GAAG,EAAE,CAAC,QAAQ,EAAE,aAAa,GAAG,EAAE,CAAC,aAAa;AAC9H,IAAI,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC;AACpC,IAAI,gBAAgB,GAAG,MAAM,CAAC,YAAY,CAAC,gBAAgB;AAC3D,IAA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,IAAI,EAAE,gBAAgB,CAAC,MAAM;AACrC,QAAQ,OAAO,EAAE,YAAY;AAC7B,YAAY,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC,aAAa,EAAE,CAAC;AACzF,YAAY,kBAAkB,CAAC,0BAA0B,CAAC;AAC1D,QAAQ,CAAC;AACT,KAAK;AACL,CAAC,CAAC;AACF,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,KAAK,KAAK,CAAC,CAACA,WAAQ,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAC1L,QAAQ,OAAO;AACf,MAAM;;;;"}
|
package/dist/index41.js
CHANGED
|
@@ -1,96 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { trigger, signal } from 'canvasengine';
|
|
3
|
-
import { inject } from './index6.js';
|
|
4
|
-
import { RpgClientEngine } from './index2.js';
|
|
1
|
+
import * as external from './index38.js';
|
|
5
2
|
|
|
6
|
-
class RpgClientObject extends RpgCommonPlayer {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
this.emitParticleTrigger = trigger();
|
|
10
|
-
this.particleName = signal("");
|
|
11
|
-
this.animationCurrentIndex = signal(0);
|
|
12
|
-
this.animationIsPlaying = signal(false);
|
|
13
|
-
this._param = signal({});
|
|
14
|
-
this.hooks.callHooks("client-sprite-onInit", this).subscribe();
|
|
15
|
-
}
|
|
16
|
-
get hooks() {
|
|
17
|
-
return inject(ModulesToken);
|
|
18
|
-
}
|
|
19
|
-
flash(color, duration = 100) {
|
|
20
|
-
return new Promise((resolve) => {
|
|
21
|
-
const lastTint = this.tint();
|
|
22
|
-
this.tint.set(color);
|
|
23
|
-
setTimeout(() => {
|
|
24
|
-
this.tint.set(lastTint);
|
|
25
|
-
resolve(true);
|
|
26
|
-
}, duration);
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Reset animation state when animation changes externally
|
|
31
|
-
*
|
|
32
|
-
* This method should be called when the animation changes due to movement
|
|
33
|
-
* or other external factors to ensure the animation system doesn't get stuck
|
|
34
|
-
*
|
|
35
|
-
* @example
|
|
36
|
-
* ```ts
|
|
37
|
-
* // Reset when player starts moving
|
|
38
|
-
* player.resetAnimationState();
|
|
39
|
-
* ```
|
|
40
|
-
*/
|
|
41
|
-
resetAnimationState() {
|
|
42
|
-
this.animationIsPlaying.set(false);
|
|
43
|
-
this.animationCurrentIndex.set(0);
|
|
44
|
-
if (this.animationSubscription) {
|
|
45
|
-
this.animationSubscription.unsubscribe();
|
|
46
|
-
this.animationSubscription = void 0;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Set a custom animation for a specific number of times
|
|
51
|
-
*
|
|
52
|
-
* Plays a custom animation for the specified number of repetitions.
|
|
53
|
-
* The animation system prevents overlapping animations and automatically
|
|
54
|
-
* returns to the previous animation when complete.
|
|
55
|
-
*
|
|
56
|
-
* @param animationName - Name of the animation to play
|
|
57
|
-
* @param nbTimes - Number of times to repeat the animation (default: Infinity for continuous)
|
|
58
|
-
*
|
|
59
|
-
* @example
|
|
60
|
-
* ```ts
|
|
61
|
-
* // Play attack animation 3 times
|
|
62
|
-
* player.setAnimation('attack', 3);
|
|
63
|
-
*
|
|
64
|
-
* // Play continuous spell animation
|
|
65
|
-
* player.setAnimation('spell');
|
|
66
|
-
* ```
|
|
67
|
-
*/
|
|
68
|
-
setAnimation(animationName, nbTimes = Infinity) {
|
|
69
|
-
if (this.animationIsPlaying()) return;
|
|
70
|
-
this.animationIsPlaying.set(true);
|
|
71
|
-
const previousAnimationName = this.animationName();
|
|
72
|
-
this.animationCurrentIndex.set(0);
|
|
73
|
-
if (this.animationSubscription) {
|
|
74
|
-
this.animationSubscription.unsubscribe();
|
|
75
|
-
}
|
|
76
|
-
this.animationSubscription = this.animationCurrentIndex.observable.subscribe((index) => {
|
|
77
|
-
if (index >= nbTimes) {
|
|
78
|
-
this.animationCurrentIndex.set(0);
|
|
79
|
-
this.animationName.set(previousAnimationName);
|
|
80
|
-
this.animationIsPlaying.set(false);
|
|
81
|
-
if (this.animationSubscription) {
|
|
82
|
-
this.animationSubscription.unsubscribe();
|
|
83
|
-
this.animationSubscription = void 0;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
this.animationName.set(animationName);
|
|
88
|
-
}
|
|
89
|
-
showComponentAnimation(id, params) {
|
|
90
|
-
const engine = inject(RpgClientEngine);
|
|
91
|
-
engine.getComponentAnimation(id).displayEffect(params, this);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
3
|
|
|
95
|
-
|
|
4
|
+
|
|
5
|
+
export { external as default, external as z };
|
|
96
6
|
//# sourceMappingURL=index41.js.map
|
package/dist/index41.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index41.js","sources":[
|
|
1
|
+
{"version":3,"file":"index41.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/index42.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useProps, useDefineProps, animatedSignal, h, Container, Rect, Text } from 'canvasengine';
|
|
2
|
+
|
|
3
|
+
function component($$props) {
|
|
4
|
+
useProps($$props);
|
|
5
|
+
const defineProps = useDefineProps($$props);
|
|
6
|
+
var _a = defineProps(), text = _a.text, isSelected = _a.isSelected;
|
|
7
|
+
var alpha = animatedSignal(1, {
|
|
8
|
+
repeatType: "reverse",
|
|
9
|
+
duration: 500,
|
|
10
|
+
repeat: Infinity,
|
|
11
|
+
});
|
|
12
|
+
alpha.set(0.5);
|
|
13
|
+
var height = 40;
|
|
14
|
+
var width = 256;
|
|
15
|
+
let $this = h(Container, null, [h(Rect, { width, height, color: '#595971', alpha, visible: isSelected }), h(Container, { flexDirection: 'row', alignItems: 'center', justifyContent: 'center' }, h(Text, { text, color: '#fff', fontSize: 18, margin: 10 }))]);
|
|
16
|
+
return $this
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { component as default };
|
|
20
|
+
//# sourceMappingURL=index42.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index42.js","sources":["../src/components/gui/dialogbox/itemMenu.ce"],"sourcesContent":["<Container>\n <Rect width height color=\"#595971\" alpha visible={isSelected} />\n <Container flexDirection=\"row\" alignItems=\"center\" justifyContent=\"center\">\n <Text text color=\"#fff\" fontSize={18} margin={10} />\n </Container>\n</Container>\n\n<script>\nimport { animatedSignal } from \"canvasengine\";\n\nconst { text, isSelected } = defineProps();\n\nconst alpha = animatedSignal(1, {\n repeatType: \"reverse\",\n duration: 500,\n repeat: Infinity,\n});\n\nalpha.set(0.5);\n\nconst height = 40;\nconst width = 256;\n</script>"],"names":[],"mappings":";;AAQqB,SAAS,SAAS,CAAC,OAAO,EAAE;AACjD,QAAuB,QAAQ,CAAC,OAAO;AACvC,QAAQ,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO;AAClD,QAAQ,IAAI,EAAE,GAAG,WAAW,EAAE,EAAE,IAAI,GAAG,EAAE,CAAC,IAAI,EAAE,UAAU,GAAG,EAAE,CAAC,UAAU;AAC1E,IAAI,KAAK,GAAG,cAAc,CAAC,CAAC,EAAE;AAC9B,IAAI,UAAU,EAAE,SAAS;AACzB,IAAI,QAAQ,EAAE,GAAG;AACjB,IAAI,MAAM,EAAE,QAAQ;AACpB,CAAC,CAAC;AACF,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC;AACd,IAAI,MAAM,GAAG,EAAE;AACf,IAAI,KAAK,GAAG,GAAG;AACf,QAAQ,IAAI,KAAK,GAAG,CAAC,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;AACrQ,QAAQ,OAAO;AACf,MAAM;;;;"}
|
package/dist/index43.js
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { RpgCommonPlayer, ModulesToken } from '@rpgjs/common';
|
|
2
|
+
import { trigger, signal } from 'canvasengine';
|
|
3
|
+
import { inject } from './index6.js';
|
|
4
|
+
import { RpgClientEngine } from './index2.js';
|
|
5
|
+
|
|
6
|
+
class RpgClientObject extends RpgCommonPlayer {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.emitParticleTrigger = trigger();
|
|
10
|
+
this.particleName = signal("");
|
|
11
|
+
this.animationCurrentIndex = signal(0);
|
|
12
|
+
this.animationIsPlaying = signal(false);
|
|
13
|
+
this._param = signal({});
|
|
14
|
+
this.hooks.callHooks("client-sprite-onInit", this).subscribe();
|
|
15
|
+
}
|
|
16
|
+
get hooks() {
|
|
17
|
+
return inject(ModulesToken);
|
|
18
|
+
}
|
|
19
|
+
flash(color, duration = 100) {
|
|
20
|
+
return new Promise((resolve) => {
|
|
21
|
+
const lastTint = this.tint();
|
|
22
|
+
this.tint.set(color);
|
|
23
|
+
setTimeout(() => {
|
|
24
|
+
this.tint.set(lastTint);
|
|
25
|
+
resolve(true);
|
|
26
|
+
}, duration);
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Reset animation state when animation changes externally
|
|
31
|
+
*
|
|
32
|
+
* This method should be called when the animation changes due to movement
|
|
33
|
+
* or other external factors to ensure the animation system doesn't get stuck
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* // Reset when player starts moving
|
|
38
|
+
* player.resetAnimationState();
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
resetAnimationState() {
|
|
42
|
+
this.animationIsPlaying.set(false);
|
|
43
|
+
this.animationCurrentIndex.set(0);
|
|
44
|
+
if (this.animationSubscription) {
|
|
45
|
+
this.animationSubscription.unsubscribe();
|
|
46
|
+
this.animationSubscription = void 0;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Set a custom animation for a specific number of times
|
|
51
|
+
*
|
|
52
|
+
* Plays a custom animation for the specified number of repetitions.
|
|
53
|
+
* The animation system prevents overlapping animations and automatically
|
|
54
|
+
* returns to the previous animation when complete.
|
|
55
|
+
*
|
|
56
|
+
* @param animationName - Name of the animation to play
|
|
57
|
+
* @param nbTimes - Number of times to repeat the animation (default: Infinity for continuous)
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* // Play attack animation 3 times
|
|
62
|
+
* player.setAnimation('attack', 3);
|
|
63
|
+
*
|
|
64
|
+
* // Play continuous spell animation
|
|
65
|
+
* player.setAnimation('spell');
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
setAnimation(animationName, nbTimes = Infinity) {
|
|
69
|
+
if (this.animationIsPlaying()) return;
|
|
70
|
+
this.animationIsPlaying.set(true);
|
|
71
|
+
const previousAnimationName = this.animationName();
|
|
72
|
+
this.animationCurrentIndex.set(0);
|
|
73
|
+
if (this.animationSubscription) {
|
|
74
|
+
this.animationSubscription.unsubscribe();
|
|
75
|
+
}
|
|
76
|
+
this.animationSubscription = this.animationCurrentIndex.observable.subscribe((index) => {
|
|
77
|
+
if (index >= nbTimes) {
|
|
78
|
+
this.animationCurrentIndex.set(0);
|
|
79
|
+
this.animationName.set(previousAnimationName);
|
|
80
|
+
this.animationIsPlaying.set(false);
|
|
81
|
+
if (this.animationSubscription) {
|
|
82
|
+
this.animationSubscription.unsubscribe();
|
|
83
|
+
this.animationSubscription = void 0;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
this.animationName.set(animationName);
|
|
88
|
+
}
|
|
89
|
+
showComponentAnimation(id, params) {
|
|
90
|
+
const engine = inject(RpgClientEngine);
|
|
91
|
+
engine.getComponentAnimation(id).displayEffect(params, this);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { RpgClientObject };
|
|
96
|
+
//# sourceMappingURL=index43.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index43.js","sources":["../src/Game/Object.ts"],"sourcesContent":["import { Hooks, ModulesToken, RpgCommonPlayer } from \"@rpgjs/common\";\nimport { sync } from \"@signe/sync\";\nimport { trigger, signal } from \"canvasengine\";\nimport { Subscription } from \"rxjs\";\nimport { inject } from \"../core/inject\";\nimport { RpgClientEngine } from \"../RpgClientEngine\";\n\nexport abstract class RpgClientObject extends RpgCommonPlayer {\n abstract type: string;\n emitParticleTrigger = trigger()\n particleName = signal('')\n animationCurrentIndex = signal(0)\n animationIsPlaying = signal(false)\n _param = signal({})\n\n constructor() {\n super()\n this.hooks.callHooks(\"client-sprite-onInit\", this).subscribe();\n }\n\n get hooks() {\n return inject<Hooks>(ModulesToken);\n }\n \n private animationSubscription?: Subscription\n\n flash(color: string, duration: number = 100) {\n return new Promise((resolve) => {\n const lastTint = this.tint()\n this.tint.set(color);\n setTimeout(() => {\n this.tint.set(lastTint)\n resolve(true)\n }, duration)\n })\n }\n\n /**\n * Reset animation state when animation changes externally\n * \n * This method should be called when the animation changes due to movement\n * or other external factors to ensure the animation system doesn't get stuck\n * \n * @example\n * ```ts\n * // Reset when player starts moving\n * player.resetAnimationState();\n * ```\n */\n resetAnimationState() {\n this.animationIsPlaying.set(false);\n this.animationCurrentIndex.set(0);\n if (this.animationSubscription) {\n this.animationSubscription.unsubscribe();\n this.animationSubscription = undefined;\n }\n }\n\n /**\n * Set a custom animation for a specific number of times\n * \n * Plays a custom animation for the specified number of repetitions.\n * The animation system prevents overlapping animations and automatically\n * returns to the previous animation when complete.\n * \n * @param animationName - Name of the animation to play\n * @param nbTimes - Number of times to repeat the animation (default: Infinity for continuous)\n * \n * @example\n * ```ts\n * // Play attack animation 3 times\n * player.setAnimation('attack', 3);\n * \n * // Play continuous spell animation\n * player.setAnimation('spell');\n * ```\n */\n setAnimation(animationName: string, nbTimes: number = Infinity) {\n if (this.animationIsPlaying()) return;\n this.animationIsPlaying.set(true);\n const previousAnimationName = this.animationName();\n this.animationCurrentIndex.set(0);\n \n // Clean up any existing subscription\n if (this.animationSubscription) {\n this.animationSubscription.unsubscribe();\n }\n \n this.animationSubscription = this.animationCurrentIndex.observable.subscribe(index => {\n if (index >= nbTimes) {\n this.animationCurrentIndex.set(0);\n this.animationName.set(previousAnimationName);\n this.animationIsPlaying.set(false);\n if (this.animationSubscription) {\n this.animationSubscription.unsubscribe();\n this.animationSubscription = undefined;\n }\n }\n })\n this.animationName.set(animationName);\n }\n\n showComponentAnimation(id: string, params: any) {\n const engine = inject(RpgClientEngine)\n engine.getComponentAnimation(id).displayEffect(params, this)\n }\n} "],"names":[],"mappings":";;;;;AAOO,MAAe,wBAAwB,eAAA,CAAgB;AAAA,EAQ5D,WAAA,GAAc;AACZ,IAAA,KAAA,EAAM;AAPR,IAAA,IAAA,CAAA,mBAAA,GAAsB,OAAA,EAAQ;AAC9B,IAAA,IAAA,CAAA,YAAA,GAAe,OAAO,EAAE,CAAA;AACxB,IAAA,IAAA,CAAA,qBAAA,GAAwB,OAAO,CAAC,CAAA;AAChC,IAAA,IAAA,CAAA,kBAAA,GAAqB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
+
function getErrorMap() {
|
|
8
|
+
return overrideErrorMap;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export { errorMap as defaultErrorMap, getErrorMap, setErrorMap };
|
|
12
|
+
//# sourceMappingURL=index44.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index44.js","sources":["../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/errors.js"],"sourcesContent":["import defaultErrorMap from \"./locales/en.js\";\nlet overrideErrorMap = defaultErrorMap;\nexport { defaultErrorMap };\nexport function setErrorMap(map) {\n overrideErrorMap = map;\n}\nexport function getErrorMap() {\n return overrideErrorMap;\n}\n"],"names":["defaultErrorMap"],"mappings":";;AACA,IAAI,gBAAgB,GAAGA,QAAe;AAE/B,SAAS,WAAW,CAAC,GAAG,EAAE;AACjC,IAAI,gBAAgB,GAAG,GAAG;AAC1B;AACO,SAAS,WAAW,GAAG;AAC9B,IAAI,OAAO,gBAAgB;AAC3B;;;;","x_google_ignoreList":[0]}
|
package/dist/index45.js
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { getErrorMap } from './index44.js';
|
|
2
|
+
import errorMap from './index48.js';
|
|
3
|
+
|
|
4
|
+
const makeIssue = (params) => {
|
|
5
|
+
const { data, path, errorMaps, issueData } = params;
|
|
6
|
+
const fullPath = [...path, ...(issueData.path || [])];
|
|
7
|
+
const fullIssue = {
|
|
8
|
+
...issueData,
|
|
9
|
+
path: fullPath,
|
|
10
|
+
};
|
|
11
|
+
if (issueData.message !== undefined) {
|
|
12
|
+
return {
|
|
13
|
+
...issueData,
|
|
14
|
+
path: fullPath,
|
|
15
|
+
message: issueData.message,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
let errorMessage = "";
|
|
19
|
+
const maps = errorMaps
|
|
20
|
+
.filter((m) => !!m)
|
|
21
|
+
.slice()
|
|
22
|
+
.reverse();
|
|
23
|
+
for (const map of maps) {
|
|
24
|
+
errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
|
|
25
|
+
}
|
|
26
|
+
return {
|
|
27
|
+
...issueData,
|
|
28
|
+
path: fullPath,
|
|
29
|
+
message: errorMessage,
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
const EMPTY_PATH = [];
|
|
33
|
+
function addIssueToContext(ctx, issueData) {
|
|
34
|
+
const overrideMap = getErrorMap();
|
|
35
|
+
const issue = makeIssue({
|
|
36
|
+
issueData: issueData,
|
|
37
|
+
data: ctx.data,
|
|
38
|
+
path: ctx.path,
|
|
39
|
+
errorMaps: [
|
|
40
|
+
ctx.common.contextualErrorMap, // contextual error map is first priority
|
|
41
|
+
ctx.schemaErrorMap, // then schema-bound map if available
|
|
42
|
+
overrideMap, // then global override map
|
|
43
|
+
overrideMap === errorMap ? undefined : errorMap, // then global default map
|
|
44
|
+
].filter((x) => !!x),
|
|
45
|
+
});
|
|
46
|
+
ctx.common.issues.push(issue);
|
|
47
|
+
}
|
|
48
|
+
class ParseStatus {
|
|
49
|
+
constructor() {
|
|
50
|
+
this.value = "valid";
|
|
51
|
+
}
|
|
52
|
+
dirty() {
|
|
53
|
+
if (this.value === "valid")
|
|
54
|
+
this.value = "dirty";
|
|
55
|
+
}
|
|
56
|
+
abort() {
|
|
57
|
+
if (this.value !== "aborted")
|
|
58
|
+
this.value = "aborted";
|
|
59
|
+
}
|
|
60
|
+
static mergeArray(status, results) {
|
|
61
|
+
const arrayValue = [];
|
|
62
|
+
for (const s of results) {
|
|
63
|
+
if (s.status === "aborted")
|
|
64
|
+
return INVALID;
|
|
65
|
+
if (s.status === "dirty")
|
|
66
|
+
status.dirty();
|
|
67
|
+
arrayValue.push(s.value);
|
|
68
|
+
}
|
|
69
|
+
return { status: status.value, value: arrayValue };
|
|
70
|
+
}
|
|
71
|
+
static async mergeObjectAsync(status, pairs) {
|
|
72
|
+
const syncPairs = [];
|
|
73
|
+
for (const pair of pairs) {
|
|
74
|
+
const key = await pair.key;
|
|
75
|
+
const value = await pair.value;
|
|
76
|
+
syncPairs.push({
|
|
77
|
+
key,
|
|
78
|
+
value,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return ParseStatus.mergeObjectSync(status, syncPairs);
|
|
82
|
+
}
|
|
83
|
+
static mergeObjectSync(status, pairs) {
|
|
84
|
+
const finalObject = {};
|
|
85
|
+
for (const pair of pairs) {
|
|
86
|
+
const { key, value } = pair;
|
|
87
|
+
if (key.status === "aborted")
|
|
88
|
+
return INVALID;
|
|
89
|
+
if (value.status === "aborted")
|
|
90
|
+
return INVALID;
|
|
91
|
+
if (key.status === "dirty")
|
|
92
|
+
status.dirty();
|
|
93
|
+
if (value.status === "dirty")
|
|
94
|
+
status.dirty();
|
|
95
|
+
if (key.value !== "__proto__" && (typeof value.value !== "undefined" || pair.alwaysSet)) {
|
|
96
|
+
finalObject[key.value] = value.value;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
return { status: status.value, value: finalObject };
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const INVALID = Object.freeze({
|
|
103
|
+
status: "aborted",
|
|
104
|
+
});
|
|
105
|
+
const DIRTY = (value) => ({ status: "dirty", value });
|
|
106
|
+
const OK = (value) => ({ status: "valid", value });
|
|
107
|
+
const isAborted = (x) => x.status === "aborted";
|
|
108
|
+
const isDirty = (x) => x.status === "dirty";
|
|
109
|
+
const isValid = (x) => x.status === "valid";
|
|
110
|
+
const isAsync = (x) => typeof Promise !== "undefined" && x instanceof Promise;
|
|
111
|
+
|
|
112
|
+
export { DIRTY, EMPTY_PATH, INVALID, OK, ParseStatus, addIssueToContext, isAborted, isAsync, isDirty, isValid, makeIssue };
|
|
113
|
+
//# sourceMappingURL=index45.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index45.js","sources":["../../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js"],"sourcesContent":["import { getErrorMap } from \"../errors.js\";\nimport defaultErrorMap from \"../locales/en.js\";\nexport const makeIssue = (params) => {\n const { data, path, errorMaps, issueData } = params;\n const fullPath = [...path, ...(issueData.path || [])];\n const fullIssue = {\n ...issueData,\n path: fullPath,\n };\n if (issueData.message !== undefined) {\n return {\n ...issueData,\n path: fullPath,\n message: issueData.message,\n };\n }\n let errorMessage = \"\";\n const maps = errorMaps\n .filter((m) => !!m)\n .slice()\n .reverse();\n for (const map of maps) {\n errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;\n }\n return {\n ...issueData,\n path: fullPath,\n message: errorMessage,\n };\n};\nexport const EMPTY_PATH = [];\nexport function addIssueToContext(ctx, issueData) {\n const overrideMap = getErrorMap();\n const issue = makeIssue({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap, // contextual error map is first priority\n ctx.schemaErrorMap, // then schema-bound map if available\n overrideMap, // then global override map\n overrideMap === defaultErrorMap ? undefined : defaultErrorMap, // then global default map\n ].filter((x) => !!x),\n });\n ctx.common.issues.push(issue);\n}\nexport class ParseStatus {\n constructor() {\n this.value = \"valid\";\n }\n dirty() {\n if (this.value === \"valid\")\n this.value = \"dirty\";\n }\n abort() {\n if (this.value !== \"aborted\")\n this.value = \"aborted\";\n }\n static mergeArray(status, results) {\n const arrayValue = [];\n for (const s of results) {\n if (s.status === \"aborted\")\n return INVALID;\n if (s.status === \"dirty\")\n status.dirty();\n arrayValue.push(s.value);\n }\n return { status: status.value, value: arrayValue };\n }\n static async mergeObjectAsync(status, pairs) {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n syncPairs.push({\n key,\n value,\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }\n static mergeObjectSync(status, pairs) {\n const finalObject = {};\n for (const pair of pairs) {\n const { key, value } = pair;\n if (key.status === \"aborted\")\n return INVALID;\n if (value.status === \"aborted\")\n return INVALID;\n if (key.status === \"dirty\")\n status.dirty();\n if (value.status === \"dirty\")\n status.dirty();\n if (key.value !== \"__proto__\" && (typeof value.value !== \"undefined\" || pair.alwaysSet)) {\n finalObject[key.value] = value.value;\n }\n }\n return { status: status.value, value: finalObject };\n }\n}\nexport const INVALID = Object.freeze({\n status: \"aborted\",\n});\nexport const DIRTY = (value) => ({ status: \"dirty\", value });\nexport const OK = (value) => ({ status: \"valid\", value });\nexport const isAborted = (x) => x.status === \"aborted\";\nexport const isDirty = (x) => x.status === \"dirty\";\nexport const isValid = (x) => x.status === \"valid\";\nexport const isAsync = (x) => typeof Promise !== \"undefined\" && x instanceof Promise;\n"],"names":["defaultErrorMap"],"mappings":";;;AAEY,MAAC,SAAS,GAAG,CAAC,MAAM,KAAK;AACrC,IAAI,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,MAAM;AACvD,IAAI,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,IAAI,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;AACzD,IAAI,MAAM,SAAS,GAAG;AACtB,QAAQ,GAAG,SAAS;AACpB,QAAQ,IAAI,EAAE,QAAQ;AACtB,KAAK;AACL,IAAI,IAAI,SAAS,CAAC,OAAO,KAAK,SAAS,EAAE;AACzC,QAAQ,OAAO;AACf,YAAY,GAAG,SAAS;AACxB,YAAY,IAAI,EAAE,QAAQ;AAC1B,YAAY,OAAO,EAAE,SAAS,CAAC,OAAO;AACtC,SAAS;AACT,IAAI;AACJ,IAAI,IAAI,YAAY,GAAG,EAAE;AACzB,IAAI,MAAM,IAAI,GAAG;AACjB,SAAS,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;AAC1B,SAAS,KAAK;AACd,SAAS,OAAO,EAAE;AAClB,IAAI,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;AAC5B,QAAQ,YAAY,GAAG,GAAG,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,CAAC,CAAC,OAAO;AACnF,IAAI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