melonjs 19.1.0 → 19.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -15
- package/build/application/application.d.ts +33 -0
- package/build/application/application.d.ts.map +1 -1
- package/build/application/settings.d.ts +1 -0
- package/build/application/settings.d.ts.map +1 -1
- package/build/camera/camera2d.d.ts +45 -22
- package/build/camera/camera2d.d.ts.map +1 -1
- package/build/camera/effects/camera_effect.d.ts +45 -0
- package/build/camera/effects/camera_effect.d.ts.map +1 -0
- package/build/camera/effects/fade_effect.d.ts +60 -0
- package/build/camera/effects/fade_effect.d.ts.map +1 -0
- package/build/camera/effects/mask_effect.d.ts +88 -0
- package/build/camera/effects/mask_effect.d.ts.map +1 -0
- package/build/camera/effects/shake_effect.d.ts +47 -0
- package/build/camera/effects/shake_effect.d.ts.map +1 -0
- package/build/index.d.ts +10 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4283 -1315
- package/build/index.js.map +4 -4
- package/build/level/tiled/TMXObjectFactory.d.ts.map +1 -1
- package/build/math/color_matrix.d.ts +51 -0
- package/build/math/color_matrix.d.ts.map +1 -0
- package/build/math/matrix2d.d.ts +6 -6
- package/build/math/matrix3d.d.ts +17 -0
- package/build/math/matrix3d.d.ts.map +1 -1
- package/build/particles/emitter.d.ts +19 -5
- package/build/particles/emitter.d.ts.map +1 -1
- package/build/particles/particle.d.ts +4 -1
- package/build/particles/particle.d.ts.map +1 -1
- package/build/particles/settings.d.ts +200 -31
- package/build/particles/settings.d.ts.map +1 -1
- package/build/physics/bounds.d.ts +5 -2
- package/build/physics/bounds.d.ts.map +1 -1
- package/build/physics/quadtree.d.ts.map +1 -1
- package/build/renderable/container.d.ts +1 -1
- package/build/renderable/container.d.ts.map +1 -1
- package/build/renderable/imagelayer.d.ts +13 -2
- package/build/renderable/imagelayer.d.ts.map +1 -1
- package/build/renderable/light2d.d.ts +128 -18
- package/build/renderable/light2d.d.ts.map +1 -1
- package/build/renderable/renderable.d.ts +54 -35
- package/build/renderable/renderable.d.ts.map +1 -1
- package/build/renderable/sprite.d.ts +38 -6
- package/build/renderable/sprite.d.ts.map +1 -1
- package/build/renderable/text/bitmaptext.d.ts +33 -5
- package/build/renderable/text/bitmaptext.d.ts.map +1 -1
- package/build/renderable/text/text.d.ts +27 -1
- package/build/renderable/text/text.d.ts.map +1 -1
- package/build/renderable/trigger.d.ts +44 -19
- package/build/renderable/trigger.d.ts.map +1 -1
- package/build/state/stage.d.ts +65 -9
- package/build/state/stage.d.ts.map +1 -1
- package/build/state/state.d.ts +44 -2
- package/build/state/state.d.ts.map +1 -1
- package/build/tweens/tween.d.ts +9 -0
- package/build/tweens/tween.d.ts.map +1 -1
- package/build/video/buffer/index.d.ts +40 -0
- package/build/video/buffer/index.d.ts.map +1 -0
- package/build/video/{webgl/buffer → buffer}/vertex.d.ts +5 -3
- package/build/video/buffer/vertex.d.ts.map +1 -0
- package/build/video/canvas/canvas_renderer.d.ts +2 -0
- package/build/video/canvas/canvas_renderer.d.ts.map +1 -1
- package/build/video/renderer.d.ts +141 -0
- package/build/video/renderer.d.ts.map +1 -1
- package/build/video/renderstate.d.ts +27 -0
- package/build/video/renderstate.d.ts.map +1 -1
- package/build/video/rendertarget/canvasrendertarget.d.ts +26 -63
- package/build/video/rendertarget/canvasrendertarget.d.ts.map +1 -1
- package/build/video/rendertarget/render_target_pool.d.ts +73 -0
- package/build/video/rendertarget/render_target_pool.d.ts.map +1 -0
- package/build/video/rendertarget/rendertarget.d.ts +77 -0
- package/build/video/rendertarget/rendertarget.d.ts.map +1 -0
- package/build/video/rendertarget/webglrendertarget.d.ts +30 -0
- package/build/video/rendertarget/webglrendertarget.d.ts.map +1 -0
- package/build/video/texture/atlas.d.ts +26 -2
- package/build/video/texture/atlas.d.ts.map +1 -1
- package/build/video/webgl/batchers/batcher.d.ts +10 -4
- package/build/video/webgl/batchers/batcher.d.ts.map +1 -1
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts +109 -0
- package/build/video/webgl/batchers/lit_quad_batcher.d.ts.map +1 -0
- package/build/video/webgl/batchers/quad_batcher.d.ts +34 -3
- package/build/video/webgl/batchers/quad_batcher.d.ts.map +1 -1
- package/build/video/webgl/buffer/index.d.ts +5 -34
- package/build/video/webgl/buffer/index.d.ts.map +1 -1
- package/build/video/webgl/effects/colorMatrix.d.ts +92 -0
- package/build/video/webgl/effects/colorMatrix.d.ts.map +1 -0
- package/build/video/webgl/effects/desaturate.d.ts +2 -4
- package/build/video/webgl/effects/desaturate.d.ts.map +1 -1
- package/build/video/webgl/effects/invert.d.ts +2 -2
- package/build/video/webgl/effects/invert.d.ts.map +1 -1
- package/build/video/webgl/effects/radialGradient.d.ts +105 -0
- package/build/video/webgl/effects/radialGradient.d.ts.map +1 -0
- package/build/video/webgl/effects/sepia.d.ts +2 -2
- package/build/video/webgl/effects/sepia.d.ts.map +1 -1
- package/build/video/webgl/effects/vignette.d.ts +42 -0
- package/build/video/webgl/effects/vignette.d.ts.map +1 -0
- package/build/video/webgl/glshader.d.ts.map +1 -1
- package/build/video/webgl/lighting/constants.d.ts +13 -0
- package/build/video/webgl/lighting/constants.d.ts.map +1 -0
- package/build/video/webgl/lighting/pack.d.ts +76 -0
- package/build/video/webgl/lighting/pack.d.ts.map +1 -0
- package/build/video/webgl/shaders/multitexture-lit.d.ts +23 -0
- package/build/video/webgl/shaders/multitexture-lit.d.ts.map +1 -0
- package/build/video/webgl/webgl_renderer.d.ts +24 -7
- package/build/video/webgl/webgl_renderer.d.ts.map +1 -1
- package/package.json +1 -1
- package/build/video/webgl/buffer/vertex.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../src/renderable/trigger.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../../src/renderable/trigger.js"],"names":[],"mappings":"AASA;;;GAGG;AAEH;;;;GAIG;AACH;IACC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAgDG;IACH,eAhDW,MAAM,KACN,MAAM,YAEd;QAA0B,KAAK;QACL,MAAM;QACqB,MAAM;QACjC,QAAQ;QACF,KAAK,GAA7B,MAAM,GAAC,KAAK;QACM,UAAU;QACD,KAAK,GAAhC,OAAO,GAAC,OAAO;QACG,KAAK;QACL,EAAE;QACQ,SAAS,GAArC,MAAM,GAAC,SAAS;QACI,QAAQ;QACT,OAAO;QACP,iBAAiB;KAC5C,EAiFF;IA5CA,WAA4C;IAC5C,6BAAiC;IACjC,mBAA+C;IAC/C,qBAAqC;IACrC,gBAAmB;IAInB,UAAyB;IACzB,QAAqB;IACrB,8BAA4B;IAG5B;;MAEC;IAwBD,UAAiC;IAOlC;;OAEG;IACH;;MAQC;IAED;;;OAGG;IACH,+BA+EC;CAcD;uBA/NsB,iBAAiB"}
|
package/build/state/stage.d.ts
CHANGED
|
@@ -25,28 +25,50 @@ export default class Stage {
|
|
|
25
25
|
cameras: Map<string, Camera2d>;
|
|
26
26
|
/**
|
|
27
27
|
* The list of active lights in this stage.
|
|
28
|
-
*
|
|
28
|
+
*
|
|
29
|
+
* Since 19.3.0, `Light2d` is a first-class world Renderable — the
|
|
30
|
+
* recommended pattern is to add lights directly to `app.world` (or any
|
|
31
|
+
* container, including a sprite, so the light follows it via parent
|
|
32
|
+
* transforms). The `lights` Map remains for backward compatibility:
|
|
33
|
+
* any entry added via `this.lights.set(name, light)` in
|
|
34
|
+
* `onResetEvent()` is automatically adopted into the world tree at
|
|
35
|
+
* stage reset time so it renders normally.
|
|
29
36
|
* @see Light2d
|
|
30
37
|
* @see Stage.ambientLight
|
|
31
38
|
* @example
|
|
32
|
-
* //
|
|
33
|
-
* const whiteLight = new Light2d(
|
|
34
|
-
*
|
|
39
|
+
* // recommended:
|
|
40
|
+
* const whiteLight = new Light2d(100, 100, 140, 140, "#fff", 0.7);
|
|
41
|
+
* app.world.addChild(whiteLight);
|
|
42
|
+
*
|
|
43
|
+
* // legacy (still works, auto-adopted into world):
|
|
35
44
|
* this.lights.set("whiteLight", whiteLight);
|
|
36
|
-
*
|
|
45
|
+
*
|
|
37
46
|
* this.ambientLight.parseCSS("#1117");
|
|
38
|
-
* // make the light follow the mouse
|
|
39
|
-
* input.registerPointerEvent("pointermove", app.viewport, (event) => {
|
|
40
|
-
* whiteLight.centerOn(event.gameX, event.gameY);
|
|
41
|
-
* });
|
|
42
47
|
*/
|
|
43
48
|
lights: Map<string, Light2d>;
|
|
49
|
+
/**
|
|
50
|
+
* Internal set of active lights, auto-populated by `Light2d`'s
|
|
51
|
+
* `onActivateEvent` / `onDeactivateEvent` hooks. Used by Camera2d's
|
|
52
|
+
* ambient-overlay pass to compute the cutouts.
|
|
53
|
+
* @ignore
|
|
54
|
+
*/
|
|
55
|
+
_activeLights: Set<Light2d>;
|
|
44
56
|
/**
|
|
45
57
|
* an ambient light that will be added to the stage rendering
|
|
46
58
|
* @default "#000000"
|
|
47
59
|
* @see Light2d
|
|
48
60
|
*/
|
|
49
61
|
ambientLight: Color;
|
|
62
|
+
/**
|
|
63
|
+
* Base light level applied to every normal-mapped sprite in the
|
|
64
|
+
* lit rendering path. Unlike {@link Stage#ambientLight} (which is
|
|
65
|
+
* the dark overlay punched by each light's cutout), this color is
|
|
66
|
+
* added to every lit pixel so unlit areas don't render pure
|
|
67
|
+
* black. Defaults to black (0, 0, 0) — sprites without a
|
|
68
|
+
* `normalMap` ignore it entirely.
|
|
69
|
+
* @default "#000000"
|
|
70
|
+
*/
|
|
71
|
+
ambientLightingColor: Color;
|
|
50
72
|
/**
|
|
51
73
|
* The given constructor options
|
|
52
74
|
*/
|
|
@@ -58,6 +80,17 @@ export default class Stage {
|
|
|
58
80
|
* @param [settings.onDestroyEvent] - called by the state manager before switching to another state
|
|
59
81
|
*/
|
|
60
82
|
constructor(settings?: Partial<StageSettings>);
|
|
83
|
+
/**
|
|
84
|
+
* Called by `Light2d.onActivateEvent` to register the light with the
|
|
85
|
+
* stage's ambient-overlay cutout list. Users normally don't call this.
|
|
86
|
+
* @ignore
|
|
87
|
+
*/
|
|
88
|
+
_registerLight(light: Light2d): void;
|
|
89
|
+
/**
|
|
90
|
+
* Called by `Light2d.onDeactivateEvent` to deregister the light.
|
|
91
|
+
* @ignore
|
|
92
|
+
*/
|
|
93
|
+
_unregisterLight(light: Light2d): void;
|
|
61
94
|
/**
|
|
62
95
|
* Object reset function
|
|
63
96
|
* @ignore
|
|
@@ -72,11 +105,34 @@ export default class Stage {
|
|
|
72
105
|
update(dt: number): boolean;
|
|
73
106
|
/**
|
|
74
107
|
* draw the current stage
|
|
108
|
+
*
|
|
109
|
+
* Lights are rendered as part of the world tree (they're now first-class
|
|
110
|
+
* Renderables) and the ambient overlay pass runs inside each Camera's
|
|
111
|
+
* post-effect FBO bracket via {@link Stage#drawLighting}.
|
|
75
112
|
* @ignore
|
|
76
113
|
* @param renderer - the renderer object to draw with
|
|
77
114
|
* @param world - the world object to draw
|
|
78
115
|
*/
|
|
79
116
|
draw(renderer: Renderer, world: World): void;
|
|
117
|
+
/**
|
|
118
|
+
* Draw the stage's ambient-light overlay with cutouts for each active
|
|
119
|
+
* light. Called from each `Camera2d` inside its post-effect FBO bracket —
|
|
120
|
+
* lights themselves render via the world tree (they're standard
|
|
121
|
+
* Renderables); this pass only paints the dark fill that the lights cut
|
|
122
|
+
* holes through.
|
|
123
|
+
*
|
|
124
|
+
* Subclasses can override this method to implement custom lighting (e.g.
|
|
125
|
+
* per-pixel normal-mapped lighting via a custom shader). Called once per
|
|
126
|
+
* camera per frame.
|
|
127
|
+
* @param renderer - the active renderer
|
|
128
|
+
* @param camera - the camera currently rendering this stage
|
|
129
|
+
* @param translateX - the same world-to-screen X translate that
|
|
130
|
+
* `Camera2d.draw()` applies to the world container (i.e.
|
|
131
|
+
* `camera.pos.x + camera.offset.x` for the default camera, plus
|
|
132
|
+
* the container's own offset for non-default cameras)
|
|
133
|
+
* @param translateY - the world-to-screen Y translate (see `translateX`)
|
|
134
|
+
*/
|
|
135
|
+
drawLighting(renderer: Renderer, camera: Camera2d, translateX?: number, translateY?: number): void;
|
|
80
136
|
/**
|
|
81
137
|
* destroy function
|
|
82
138
|
* @ignore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../src/state/stage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,iCAAiC,CAAC;AAC/D,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,uBAAuB,CAAC;AAC/C,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AAEtD,OAAO,KAAK,QAAQ,MAAM,wBAAwB,CAAC;AAEnD,UAAU,aAAa;IACtB,OAAO,EAAE,QAAQ,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,IAAI,CAAC;IAC9D,cAAc,CAAC,EAAE,CAAC,GAAG,EAAE,WAAW,KAAK,IAAI,CAAC;CAC5C;AAUD;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,KAAK;IACzB;;;;OAIG;IACH,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAE/B
|
|
1
|
+
{"version":3,"file":"stage.d.ts","sourceRoot":"","sources":["../../src/state/stage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,iCAAiC,CAAC;AAC/D,OAAO,QAAQ,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,uBAAuB,CAAC;AAC/C,OAAO,KAAK,OAAO,MAAM,4BAA4B,CAAC;AAEtD,OAAO,KAAK,QAAQ,MAA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,EAChB,UAAU,GAAE,MAAuC,EACnD,UAAU,GAAE,MAAuC,GACjD,IAAI;IAiCP;;;OAGG;IACH,OAAO,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI;IAkB/B;;;;;;;OAOG;IACH,YAAY,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAOxD;;;;OAIG;IACH,cAAc,CAAC,GAAG,EAAE,WAAW,GAAG,IAAI;CAMtC"}
|
package/build/state/state.d.ts
CHANGED
|
@@ -73,6 +73,35 @@ declare const state: {
|
|
|
73
73
|
* @param [music=false] - resume current music track on screen resume
|
|
74
74
|
*/
|
|
75
75
|
resume(music?: boolean): void;
|
|
76
|
+
/**
|
|
77
|
+
* Freeze the current stage for a fixed duration, then automatically resume.
|
|
78
|
+
* Useful for hit-stop / hit-pause effects on impact.
|
|
79
|
+
*
|
|
80
|
+
* Behaviour notes:
|
|
81
|
+
* - If `freeze()` is called again while a freeze is already active, the
|
|
82
|
+
* freeze is *extended* to whichever end-time is later (calls do not
|
|
83
|
+
* stack). The `music` flag from the initial call is preserved.
|
|
84
|
+
* - If the game was already paused when `freeze()` was called, the freeze
|
|
85
|
+
* timer will *not* unpause it on expiry — the game stays paused.
|
|
86
|
+
* - Calling `state.resume()` or `state.stop()` while a freeze is active
|
|
87
|
+
* cancels the timer and resolves the returned promise immediately.
|
|
88
|
+
* - The freeze is also cancelled when the window loses focus (BLUR) since
|
|
89
|
+
* the hit-stop's "moment" is short enough that the user has missed it
|
|
90
|
+
* by the time they return. The regular `pauseOnBlur` behaviour still
|
|
91
|
+
* keeps the game paused while away.
|
|
92
|
+
* - Negative, `NaN`, and `Infinity` durations silently no-op.
|
|
93
|
+
* @param duration - duration of the freeze in milliseconds
|
|
94
|
+
* @param [music=false] - also pause the current music track during the freeze
|
|
95
|
+
* @returns a Promise that resolves once the freeze ends (or is cancelled)
|
|
96
|
+
* @example
|
|
97
|
+
* // simple hit-stop on impact
|
|
98
|
+
* state.freeze(80);
|
|
99
|
+
*
|
|
100
|
+
* // chain VFX after the freeze
|
|
101
|
+
* await state.freeze(120);
|
|
102
|
+
* spawnImpactParticles();
|
|
103
|
+
*/
|
|
104
|
+
freeze(duration: number, music?: boolean): Promise<void>;
|
|
76
105
|
/**
|
|
77
106
|
* return the running state of the state manager
|
|
78
107
|
* @returns true if a "process is running"
|
|
@@ -127,11 +156,24 @@ declare const state: {
|
|
|
127
156
|
current(): Stage | undefined;
|
|
128
157
|
/**
|
|
129
158
|
* specify a global transition effect
|
|
130
|
-
* @param effect -
|
|
159
|
+
* @param effect - "fade" for a color fade, "mask" for a shape-based mask transition
|
|
131
160
|
* @param color - a CSS color value
|
|
132
161
|
* @param [duration=1000] - expressed in milliseconds
|
|
162
|
+
* @param [shape] - an Ellipse or Polygon defining the mask shape (required when effect is "mask")
|
|
163
|
+
* @example
|
|
164
|
+
* // classic fade to black
|
|
165
|
+
* state.transition("fade", "#000", 500);
|
|
166
|
+
* @example
|
|
167
|
+
* // iris (circle) mask transition
|
|
168
|
+
* state.transition("mask", "#000", 500, new Ellipse(0, 0, 1, 1));
|
|
169
|
+
* @example
|
|
170
|
+
* // diamond mask transition
|
|
171
|
+
* state.transition("mask", "#000", 400, new Polygon(0, 0, [
|
|
172
|
+
* { x: 0, y: -1 }, { x: 1, y: 0 },
|
|
173
|
+
* { x: 0, y: 1 }, { x: -1, y: 0 },
|
|
174
|
+
* ]));
|
|
133
175
|
*/
|
|
134
|
-
transition(effect:
|
|
176
|
+
transition(effect: "fade" | "mask", color: string, duration?: number, shape?: import("../geometries/ellipse.ts").Ellipse | import("../geometries/polygon.ts").Polygon): void;
|
|
135
177
|
/**
|
|
136
178
|
* enable/disable the transition to a particular state (by default enabled for all)
|
|
137
179
|
* @param stateId - State ID (see constants)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.d.ts","sourceRoot":"","sources":["../../src/state/state.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version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export default class Tween {
|
|
|
43
43
|
_yoyo: boolean;
|
|
44
44
|
_reversed: boolean;
|
|
45
45
|
_delayTime: number;
|
|
46
|
+
_repeatDelayTime: number | undefined;
|
|
46
47
|
_startTime: number | null;
|
|
47
48
|
_easingFunction: EasingFunction;
|
|
48
49
|
_interpolationFunction: InterpolationFunction;
|
|
@@ -109,6 +110,7 @@ export default class Tween {
|
|
|
109
110
|
* @param [options.delay] - delay before starting, in milliseconds
|
|
110
111
|
* @param [options.yoyo] - bounce back to original values when finished (use with `repeat`)
|
|
111
112
|
* @param [options.repeat] - number of times to repeat (use `Infinity` for endless loops)
|
|
113
|
+
* @param [options.repeatDelay] - delay in milliseconds before each repeat cycle
|
|
112
114
|
* @param [options.interpolation] - interpolation function for array values
|
|
113
115
|
* @param [options.autoStart] - start the tween immediately without calling `start()`
|
|
114
116
|
* @returns this instance for object chaining
|
|
@@ -119,6 +121,7 @@ export default class Tween {
|
|
|
119
121
|
yoyo?: boolean | undefined;
|
|
120
122
|
repeat?: number | undefined;
|
|
121
123
|
delay?: number | undefined;
|
|
124
|
+
repeatDelay?: number | undefined;
|
|
122
125
|
interpolation?: InterpolationFunction | undefined;
|
|
123
126
|
autoStart?: boolean | undefined;
|
|
124
127
|
}): this;
|
|
@@ -145,6 +148,12 @@ export default class Tween {
|
|
|
145
148
|
* @returns this instance for object chaining
|
|
146
149
|
*/
|
|
147
150
|
repeat(times: number): this;
|
|
151
|
+
/**
|
|
152
|
+
* Set a delay before each repeat.
|
|
153
|
+
* @param amount - delay in milliseconds before each repeat cycle
|
|
154
|
+
* @returns this instance for object chaining
|
|
155
|
+
*/
|
|
156
|
+
repeatDelay(amount: number): this;
|
|
148
157
|
/**
|
|
149
158
|
* Allows the tween to bounce back to their original value when finished.
|
|
150
159
|
* To be used together with repeat to create endless loops.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tween.d.ts","sourceRoot":"","sources":["../../src/tweens/tween.ts"],"names":[],"mappings":"AAWA,OA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;;;;MAEhB;IAED;;;;;;;OAOG;IACH,MAAM,KAAK,aAAa;;;;MAEvB;CACD;AAED,eAAO,MAAM,SAAS,wDASpB,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A renderer-agnostic index buffer.
|
|
3
|
+
* Manages a typed array of vertex indices for indexed drawing.
|
|
4
|
+
* {@link WebGLIndexBuffer} extends this with GL-specific bind/upload operations.
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
7
|
+
export default class IndexBuffer {
|
|
8
|
+
/**
|
|
9
|
+
* @param {number} maxIndices - maximum number of indices this buffer can hold
|
|
10
|
+
* @param {boolean} [useUint32=false] - use Uint32 indices instead of Uint16
|
|
11
|
+
*/
|
|
12
|
+
constructor(maxIndices: number, useUint32?: boolean);
|
|
13
|
+
data: Uint16Array<ArrayBuffer> | Uint32Array<ArrayBuffer>;
|
|
14
|
+
/**
|
|
15
|
+
* the current number of indices in the buffer
|
|
16
|
+
* @type {number}
|
|
17
|
+
*/
|
|
18
|
+
length: number;
|
|
19
|
+
/**
|
|
20
|
+
* Fill the buffer with a repeating quad index pattern [0,1,2, 2,1,3, 4,5,6, ...]
|
|
21
|
+
* @param {number} maxQuads - number of quads to generate indices for
|
|
22
|
+
*/
|
|
23
|
+
fillQuadPattern(maxQuads: number): void;
|
|
24
|
+
/**
|
|
25
|
+
* Reset the index count
|
|
26
|
+
*/
|
|
27
|
+
clear(): void;
|
|
28
|
+
/**
|
|
29
|
+
* Add indices to the buffer, rebased by the given vertex offset
|
|
30
|
+
* @param {number[]} indices - source indices to add
|
|
31
|
+
* @param {number} vertexOffset - value to add to each index
|
|
32
|
+
*/
|
|
33
|
+
add(indices: number[], vertexOffset: number): void;
|
|
34
|
+
/**
|
|
35
|
+
* Add pre-computed absolute indices to the buffer (no rebasing)
|
|
36
|
+
* @param {number[]} indices - absolute index values to add
|
|
37
|
+
*/
|
|
38
|
+
addRaw(indices: number[]): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/video/buffer/index.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;IACC;;;OAGG;IACH,wBAHW,MAAM,cACN,OAAO,EAYjB;IATA,0DAE8B;IAE9B;;;OAGG;IACH,QAFU,MAAM,CAED;IAGhB;;;OAGG;IACH,0BAFW,MAAM,QAYhB;IAED;;OAEG;IACH,cAEC;IAED;;;;OAIG;IACH,aAHW,MAAM,EAAE,gBACR,MAAM,QAOhB;IAED;;;OAGG;IACH,gBAFW,MAAM,EAAE,QAOlB;CACD"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* A fixed-size vertex array buffer for batching vertex data.
|
|
3
|
+
* Renderer-agnostic — stores vertex data in typed arrays (Float32/Uint32).
|
|
4
|
+
* Batchers must check isFull() and flush before the buffer overflows.
|
|
4
5
|
* @ignore
|
|
5
6
|
*/
|
|
6
7
|
export default class VertexArrayBuffer {
|
|
@@ -29,9 +30,10 @@ export default class VertexArrayBuffer {
|
|
|
29
30
|
* @param {number} v - texture V coordinate
|
|
30
31
|
* @param {number} tint - tint color in UINT32 (argb) format
|
|
31
32
|
* @param {number} [textureId] - texture unit index for multi-texture batching
|
|
33
|
+
* @param {number} [normalTextureId] - paired normal-map texture unit index, or `-1` for unlit quads
|
|
32
34
|
* @ignore
|
|
33
35
|
*/
|
|
34
|
-
push(x: number, y: number, u: number, v: number, tint: number, textureId?: number): this;
|
|
36
|
+
push(x: number, y: number, u: number, v: number, tint: number, textureId?: number, normalTextureId?: number): this;
|
|
35
37
|
/**
|
|
36
38
|
* push a new vertex with all-float data to the buffer
|
|
37
39
|
* @param {ArrayLike<number>} data - float values for one vertex
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertex.d.ts","sourceRoot":"","sources":["../../../src/video/buffer/vertex.js"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;IACC,6CAeC;IAbA,gBAA4B;IAE5B,eAA0B;IAE1B,oBAAoB;IAGpB,oBAEC;IAED,qCAA8C;IAC9C,oCAA6C;IAG9C;;;OAGG;IACH,cAEC;IAED;;;OAGG;IACH,6BAEC;IAED;;;;;;;;;;OAUG;IACH,QATW,MAAM,KACN,MAAM,KACN,MAAM,KACN,MAAM,QACN,MAAM,cACN,MAAM,oBACN,MAAM,QA4BhB;IAED;;;;;;OAMG;IACH,iBALW,SAAS,CAAC,MAAM,CAAC,aACjB,MAAM,SACN,MAAM,QAahB;IAED;;;OAGG;IACH,kEAaC;IAED;;;OAGG;IACH,2DAMC;IAED;;;OAGG;IACH,yDAMC;CACD"}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*/
|
|
14
14
|
export default class CanvasRenderer extends Renderer {
|
|
15
15
|
cache: TextureCache;
|
|
16
|
+
_lightCache: WeakMap<object, any> | undefined;
|
|
16
17
|
/**
|
|
17
18
|
* Reset the canvas transform to identity
|
|
18
19
|
*/
|
|
@@ -448,6 +449,7 @@ export default class CanvasRenderer extends Renderer {
|
|
|
448
449
|
* @param {boolean} [invert=false] - either the given shape should define what is visible (default) or the opposite
|
|
449
450
|
*/
|
|
450
451
|
setMask(mask?: Rect | RoundRect | Polygon | Line | Ellipse, invert?: boolean): void;
|
|
452
|
+
_maskInvertOuterAdded: boolean | undefined;
|
|
451
453
|
}
|
|
452
454
|
import Renderer from "./../renderer.js";
|
|
453
455
|
import TextureCache from "./../texture/cache.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"canvas_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/canvas/canvas_renderer.js"],"names":[],"mappings":"AAYA;;;;;;;;GAQG;AAEH;;;GAGG;AACH;IAcE,oBAAmC;
|
|
1
|
+
{"version":3,"file":"canvas_renderer.d.ts","sourceRoot":"","sources":["../../../src/video/canvas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CAAiC;6BACnC,6BAA6B;0BAChC,4BAA4B;6BACzB,+BAA+B;8BAC9B,wBAAwB"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @import RenderTargetPool from "./rendertarget/render_target_pool.js";
|
|
3
|
+
*/
|
|
1
4
|
/**
|
|
2
5
|
* @import {Rect} from "./../geometries/rectangle.ts";
|
|
3
6
|
* @import {RoundRect} from "./../geometries/roundrect.ts";
|
|
@@ -55,8 +58,16 @@ export default class Renderer {
|
|
|
55
58
|
* Set by a renderable's preDraw when a shader is assigned.
|
|
56
59
|
* (WebGL only, ignored by Canvas renderer)
|
|
57
60
|
* @type {GLShader|ShaderEffect|undefined}
|
|
61
|
+
* @ignore
|
|
58
62
|
*/
|
|
59
63
|
customShader: GLShader | ShaderEffect | undefined;
|
|
64
|
+
/**
|
|
65
|
+
* The render target pool for post-effect processing (ping-pong FBOs).
|
|
66
|
+
* Initialized by GPU renderers (WebGL, WebGPU). Null on Canvas renderer.
|
|
67
|
+
* @type {RenderTargetPool|null}
|
|
68
|
+
* @ignore
|
|
69
|
+
*/
|
|
70
|
+
_renderTargetPool: RenderTargetPool | null;
|
|
60
71
|
/**
|
|
61
72
|
* The Path2D instance used by the renderer to draw primitives
|
|
62
73
|
* @type {Path2D}
|
|
@@ -90,6 +101,25 @@ export default class Renderer {
|
|
|
90
101
|
maskLevel: number;
|
|
91
102
|
projectionMatrix: Matrix3d;
|
|
92
103
|
uvOffset: number;
|
|
104
|
+
/**
|
|
105
|
+
* The normal-map texture associated with the next `drawImage` call,
|
|
106
|
+
* if any. Set by `Sprite.draw` (and any other normal-map-aware
|
|
107
|
+
* renderable) just before calling `drawImage`, then cleared back
|
|
108
|
+
* to `null` after. The WebGL renderer reads this state and routes
|
|
109
|
+
* lit quads through the shader's lighting path; the Canvas
|
|
110
|
+
* renderer ignores it entirely.
|
|
111
|
+
* @type {HTMLImageElement|HTMLCanvasElement|OffscreenCanvas|ImageBitmap|null}
|
|
112
|
+
*/
|
|
113
|
+
currentNormalMap: HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap | null;
|
|
114
|
+
/**
|
|
115
|
+
* Number of active `Light2d` instances uploaded to the lit batcher
|
|
116
|
+
* for the current frame. Set by `setLightUniforms`. The WebGL
|
|
117
|
+
* renderer's `drawImage` reads this to decide between the unlit
|
|
118
|
+
* fast-path batcher (default) and the lit batcher (only when
|
|
119
|
+
* lights AND a normal map are both in play).
|
|
120
|
+
* @type {number}
|
|
121
|
+
*/
|
|
122
|
+
activeLightCount: number;
|
|
93
123
|
set currentBlendMode(value: string);
|
|
94
124
|
/**
|
|
95
125
|
* @type {string}
|
|
@@ -152,6 +182,73 @@ export default class Renderer {
|
|
|
152
182
|
* @returns {boolean}
|
|
153
183
|
*/
|
|
154
184
|
hasSupportedCompressedFormats(format: number): boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Begin capturing rendering to an offscreen buffer for post-effect processing.
|
|
187
|
+
* Call endPostEffect() after rendering to blit the result to the screen.
|
|
188
|
+
* No-op on Canvas renderer.
|
|
189
|
+
* @param {Renderable} renderable - the renderable with postEffects to apply
|
|
190
|
+
* @returns {boolean} false (Canvas renderer does not support post-effect processing)
|
|
191
|
+
* @ignore
|
|
192
|
+
*/
|
|
193
|
+
beginPostEffect(renderable: Renderable): boolean;
|
|
194
|
+
/**
|
|
195
|
+
* End post-effect capture and blit the offscreen buffer to the screen
|
|
196
|
+
* through the renderable's post-effects.
|
|
197
|
+
* No-op on Canvas renderer.
|
|
198
|
+
* @param {Renderable} renderable - the renderable with postEffects to apply
|
|
199
|
+
* @ignore
|
|
200
|
+
*/
|
|
201
|
+
endPostEffect(renderable: Renderable): void;
|
|
202
|
+
/**
|
|
203
|
+
* Blit a texture to the screen through a shader effect.
|
|
204
|
+
* Draws a screen-aligned quad using the given texture as source
|
|
205
|
+
* and the given shader for post-processing (e.g. scanlines, desaturation).
|
|
206
|
+
* No-op on Canvas renderer.
|
|
207
|
+
* @param {WebGLTexture} source - the source texture to blit
|
|
208
|
+
* @param {number} x - destination x position
|
|
209
|
+
* @param {number} y - destination y position
|
|
210
|
+
* @param {number} width - destination width
|
|
211
|
+
* @param {number} height - destination height
|
|
212
|
+
* @param {ShaderEffect} shader - the shader effect to apply
|
|
213
|
+
* @param {boolean} [keepBlend=false] - if true, keep current blend mode (for sprite compositing)
|
|
214
|
+
*/
|
|
215
|
+
blitEffect(source: WebGLTexture, x: number, y: number, width: number, height: number, shader: ShaderEffect, keepBlend?: boolean): void;
|
|
216
|
+
/**
|
|
217
|
+
* Sets the viewport for the renderer.
|
|
218
|
+
* Defines the affine transformation from normalized device coordinates to window coordinates.
|
|
219
|
+
* No-op on Canvas renderer.
|
|
220
|
+
* @param {number} [x=0] - x coordinate of the viewport origin
|
|
221
|
+
* @param {number} [y=0] - y coordinate of the viewport origin
|
|
222
|
+
* @param {number} [w] - width of the viewport (defaults to canvas width)
|
|
223
|
+
* @param {number} [h] - height of the viewport (defaults to canvas height)
|
|
224
|
+
*/
|
|
225
|
+
setViewport(x?: number, y?: number, w?: number, h?: number): void;
|
|
226
|
+
/**
|
|
227
|
+
* Clear the current render target to transparent black (color + stencil).
|
|
228
|
+
* Used to prepare FBOs for post-effect capture.
|
|
229
|
+
* No-op on Canvas renderer.
|
|
230
|
+
*/
|
|
231
|
+
clearRenderTarget(): void;
|
|
232
|
+
/**
|
|
233
|
+
* Enable the scissor test with the given rectangle.
|
|
234
|
+
* No-op on Canvas renderer.
|
|
235
|
+
* @param {number} x - x coordinate of the scissor rectangle
|
|
236
|
+
* @param {number} y - y coordinate of the scissor rectangle
|
|
237
|
+
* @param {number} width - width of the scissor rectangle
|
|
238
|
+
* @param {number} height - height of the scissor rectangle
|
|
239
|
+
*/
|
|
240
|
+
enableScissor(x: number, y: number, width: number, height: number): void;
|
|
241
|
+
/**
|
|
242
|
+
* Disable the scissor test, allowing rendering to the full viewport.
|
|
243
|
+
* No-op on Canvas renderer.
|
|
244
|
+
*/
|
|
245
|
+
disableScissor(): void;
|
|
246
|
+
/**
|
|
247
|
+
* Enable or disable alpha blending.
|
|
248
|
+
* No-op on Canvas renderer (Canvas always blends).
|
|
249
|
+
* @param {boolean} enable - true to enable blending, false to disable
|
|
250
|
+
*/
|
|
251
|
+
setBlendEnabled(enable: boolean): void;
|
|
155
252
|
/**
|
|
156
253
|
* returns the current blend mode for this renderer
|
|
157
254
|
* @returns {string} blend mode
|
|
@@ -164,6 +261,49 @@ export default class Renderer {
|
|
|
164
261
|
* @param {boolean} [premultipliedAlpha=true] - whether textures use premultiplied alpha (WebGL only)
|
|
165
262
|
*/
|
|
166
263
|
setBlendMode(mode?: string): void;
|
|
264
|
+
/**
|
|
265
|
+
* Upload the active scene lights to the lit sprite pipeline.
|
|
266
|
+
*
|
|
267
|
+
* Called once per camera per frame by `Camera2d.draw()` (after the
|
|
268
|
+
* FBO is bound, before the world tree walk fires `Sprite.draw` for
|
|
269
|
+
* any normal-mapped sprite). The WebGL renderer overrides this to
|
|
270
|
+
* pack the lights into the lit shader's uniform buffers; the Canvas
|
|
271
|
+
* renderer cannot do per-pixel normal-map lighting and silently
|
|
272
|
+
* ignores the call. The first time a non-empty light list is passed
|
|
273
|
+
* in Canvas mode, a one-shot console warning is emitted.
|
|
274
|
+
*
|
|
275
|
+
* Stage stays renderer-agnostic by passing the raw scene data —
|
|
276
|
+
* lights iterable and ambient color — and letting the renderer
|
|
277
|
+
* decide how to encode them.
|
|
278
|
+
* @param {Iterable<object>} [lights] - active `Light2d` instances; falsy/empty no-ops
|
|
279
|
+
* @param {object} [ambient] - ambient lighting color (0..255 RGB)
|
|
280
|
+
* @param {number} [translateX=0] - world-to-screen X translate (matches `Camera2d.draw()`)
|
|
281
|
+
* @param {number} [translateY=0] - world-to-screen Y translate
|
|
282
|
+
*/
|
|
283
|
+
setLightUniforms(lights?: Iterable<object>, ambient?: object, translateX?: number, translateY?: number): void;
|
|
284
|
+
_litPipelineWarned: boolean | undefined;
|
|
285
|
+
/**
|
|
286
|
+
* Render a `Light2d` instance.
|
|
287
|
+
*
|
|
288
|
+
* Each renderer implements its own strategy: the WebGL renderer
|
|
289
|
+
* draws lights as quads through a shared procedural radial-falloff
|
|
290
|
+
* fragment shader (no per-light texture, color and intensity
|
|
291
|
+
* encoded in the per-vertex tint so consecutive draws batch); the
|
|
292
|
+
* Canvas renderer caches a small `Gradient` config object per
|
|
293
|
+
* light in a `WeakMap` (rebuilt only when the light's radii /
|
|
294
|
+
* color / intensity change), rasterizes it with `Gradient.toCanvas()`
|
|
295
|
+
* into a single shared `CanvasRenderTarget`, and composites the
|
|
296
|
+
* result via `drawImage`. The base implementation is a no-op so
|
|
297
|
+
* renderers without a lighting path can be polymorphically
|
|
298
|
+
* substituted.
|
|
299
|
+
*
|
|
300
|
+
* Light2d itself is renderer-agnostic — it just calls
|
|
301
|
+
* `renderer.drawLight(this)` and relies on the renderer to pick
|
|
302
|
+
* the right machinery.
|
|
303
|
+
* @param {object} light - the Light2d instance to render
|
|
304
|
+
* @see Light2d
|
|
305
|
+
*/
|
|
306
|
+
drawLight(light: object): void;
|
|
167
307
|
/**
|
|
168
308
|
* Set the current fill & stroke style color.
|
|
169
309
|
* By default, or upon reset, the value is set to #000000.
|
|
@@ -312,6 +452,7 @@ export default class Renderer {
|
|
|
312
452
|
}
|
|
313
453
|
import CanvasRenderTarget from "./rendertarget/canvasrendertarget.js";
|
|
314
454
|
import { Vector2d } from "../math/vector2d.ts";
|
|
455
|
+
import type RenderTargetPool from "./rendertarget/render_target_pool.js";
|
|
315
456
|
import Path2D from "./../geometries/path2d.js";
|
|
316
457
|
import { Color } from "./../math/color.ts";
|
|
317
458
|
import RenderState from "./renderstate.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.d.ts","sourceRoot":"","sources":["../../src/video/renderer.js"],"names":[],"mappings":"AASA;;;;;;;GAOG;AAEH;;;GAGG;AACH;IACC;;OAEG;IACH,sBAFW,mBAAmB,
|
|
1
|
+
{"version":3,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class RenderState {
|
|
|
45
45
|
* @type {string}
|
|
46
46
|
*/
|
|
47
47
|
currentBlendMode: string;
|
|
48
|
+
/**
|
|
49
|
+
* current custom shader effect (undefined when using default shader)
|
|
50
|
+
* @type {ShaderEffect|undefined}
|
|
51
|
+
*/
|
|
52
|
+
currentShader: ShaderEffect | undefined;
|
|
48
53
|
/**
|
|
49
54
|
* @ignore
|
|
50
55
|
*/
|
|
@@ -70,11 +75,33 @@ export default class RenderState {
|
|
|
70
75
|
_gradientStack: any[];
|
|
71
76
|
/** @ignore */
|
|
72
77
|
_blendStack: any[];
|
|
78
|
+
/** @ignore */
|
|
79
|
+
_shaderStack: any[];
|
|
73
80
|
/**
|
|
74
81
|
* Save the current state onto the stack (zero allocations).
|
|
75
82
|
* @param {boolean} [scissorTestActive=false] - whether scissor/clip is currently enabled
|
|
76
83
|
*/
|
|
77
84
|
save(scissorTestActive?: boolean): void;
|
|
85
|
+
/**
|
|
86
|
+
* Inspect the scissor box that the next `restore()` would install,
|
|
87
|
+
* without mutating any state. Lets renderers detect whether a
|
|
88
|
+
* pending `restore()` will actually change the scissor (and
|
|
89
|
+
* decide, e.g., whether to flush GPU work first).
|
|
90
|
+
*
|
|
91
|
+
* Returns:
|
|
92
|
+
* - `Int32Array` (length 4) — `[x, y, width, height]` of the
|
|
93
|
+
* saved scissor when scissor was active at the matching `save()`
|
|
94
|
+
* call.
|
|
95
|
+
* - `null` — when the saved state had scissor disabled, or the
|
|
96
|
+
* stack is empty. Treat this as "next scissor will be inactive".
|
|
97
|
+
*
|
|
98
|
+
* The returned array is a **live reference into the internal
|
|
99
|
+
* stack** — zero allocation on a hot path. Callers MUST treat it
|
|
100
|
+
* as read-only; mutating it corrupts subsequent `restore()` calls.
|
|
101
|
+
* @ignore
|
|
102
|
+
* @returns {Int32Array | null}
|
|
103
|
+
*/
|
|
104
|
+
peekScissor(): Int32Array | null;
|
|
78
105
|
/**
|
|
79
106
|
* Restore state from the stack.
|
|
80
107
|
* Color, tint, transform, and scissor are restored in place.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderstate.d.ts","sourceRoot":"","sources":["../../src/video/renderstate.js"],"names":[],"mappings":"AAGA;;GAEG;AAEH;;;;;;;GAOG;AACH;IAEE;;;OAGG;IACH,cAFU,KAAK,CAE4B;IAE3C;;;OAGG;IACH,aAFU,KAAK,CAEiC;IAEhD;;;OAGG;IACH,kBAFU,QAAQ,CAEoB;IAEtC;;;OAGG;IACH,gBAFU,UAAU,CAEmB;IAEvC;;;OAGG;IACH,iBAFU,QAAQ,GAAC,IAAI,CAEI;IAE3B;;;OAGG;IACH,UAFU,MAAM,EAAE,CAEA;IAElB;;;OAGG;IACH,kBAFU,MAAM,CAEc;IAI9B;;OAEG;IACH,uBAAwB;IAExB;;;OAGG;IACH,oBAAoB;IAEpB,cAAc;IACd,qBAEE;IAEF,cAAc;IACd,oBAEE;IAEF,cAAc;IACd,yBAEE;IAEF,cAAc;IACd,yCAEE;IAEF,cAAc;IACd,sBAAoD;IAEpD,cAAc;IACd,wCAAyD;IAEzD,cAAc;IACd,sBAAoD;IAEpD,cAAc;IACd,mBAAiD;
|
|
1
|
+
{"version":3,"file":"renderstate.d.ts","sourceRoot":"","sources":["../../src/video/renderstate.js"],"names":[],"mappings":"AAGA;;GAEG;AAEH;;;;;;;GAOG;AACH;IAEE;;;OAGG;IACH,cAFU,KAAK,CAE4B;IAE3C;;;OAGG;IACH,aAFU,KAAK,CAEiC;IAEhD;;;OAGG;IACH,kBAFU,QAAQ,CAEoB;IAEtC;;;OAGG;IACH,gBAFU,UAAU,CAEmB;IAEvC;;;OAGG;IACH,iBAFU,QAAQ,GAAC,IAAI,CAEI;IAE3B;;;OAGG;IACH,UAFU,MAAM,EAAE,CAEA;IAElB;;;OAGG;IACH,kBAFU,MAAM,CAEc;IAE9B;;;OAGG;IACH,eAFU,YAAY,GAAC,SAAS,CAEF;IAI9B;;OAEG;IACH,uBAAwB;IAExB;;;OAGG;IACH,oBAAoB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