@drincs/pixi-vn-ink 0.13.2 → 1.0.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 +24 -83
- package/dist/chunk-FXKQHWQR.mjs +3 -0
- package/dist/chunk-I6LBNKYY.mjs +1 -0
- package/dist/chunk-YGSSDCYK.mjs +14 -0
- package/dist/index.cjs +15 -68
- package/dist/index.d.cts +211 -216
- package/dist/index.d.ts +211 -216
- package/dist/index.mjs +1 -1
- package/dist/mapper.cjs +16 -0
- package/dist/mapper.d.cts +200 -0
- package/dist/mapper.d.ts +200 -0
- package/dist/mapper.mjs +16 -0
- package/dist/parser.cjs +78 -0
- package/dist/parser.d.cts +34 -0
- package/dist/parser.d.ts +34 -0
- package/dist/{chunk-M7O5Q75X.mjs → parser.mjs} +67 -41
- package/dist/vite/client.d.ts +25 -0
- package/dist/vite-listener.cjs +15 -68
- package/dist/vite-listener.d.cts +6 -0
- package/dist/vite-listener.d.ts +6 -0
- package/dist/vite-listener.mjs +1 -1
- package/dist/vite.cjs +17 -52
- package/dist/vite.d.cts +193 -5
- package/dist/vite.d.ts +193 -5
- package/dist/vite.mjs +4 -1
- package/package.json +46 -9
- package/dist/chunk-USLPPQUR.mjs +0 -18
package/README.md
CHANGED
|
@@ -10,27 +10,23 @@
|
|
|
10
10
|
<a target="_blank" href="https://discord.gg/E95FZWakzp" rel="noopener noreferrer nofollow"><img alt="Discord" src="https://img.shields.io/discord/1263071210011496501?color=7289da&label=discord"></a>
|
|
11
11
|
</p>
|
|
12
12
|
|
|
13
|
-
Pixi’VN gives you the ability to write your own narrative using
|
|
13
|
+
Pixi’VN gives you the ability to write your own narrative using **_ink_**, a scripting language for writing interactive narrative.
|
|
14
14
|
|
|
15
|
-
The
|
|
15
|
+
The **_ink_ + Pixi’VN integration**, exploits the [inkjs](https://github.com/inkle/inkjs) and [PixiVNJson](https://github.com/DRincs-Productions/pixi-vn-json) libraries, to parse **_ink_ code** and generate a Json that can be interpreted by Pixi’VN. So Javascript/Typescript and **_ink_** share the same storage and canvas, and it is also possible to launch **_ink_** labels (or knots) from Javascript/Typescript and vice versa. This allows you to use the best of both languages. You can use **_ink_** to write the narration, while using Javascript/Typescript to create minigames or complex animations.
|
|
16
16
|
|
|
17
|
-
**What is
|
|
17
|
+
**What is _ink_?**
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
**_ink_** is a scripting language for writing interactive narrative. It is used in games like 80 Days, Heaven's Vault, and Sorcery! to create branching stories.
|
|
20
20
|
|
|
21
|
-
This language is very simple to learn. Go on [
|
|
21
|
+
This language is very simple to learn. Go on [_ink_ website](https://www.inklestudios.com/ink/) to learn more about it.
|
|
22
22
|
|
|
23
|
-
## Why use
|
|
23
|
+
## Why use _ink_ integration?
|
|
24
24
|
|
|
25
25
|
Programming a game narrative in **Javascript/Typescript** has the advantage of having total development freedom, but the disadvantage is that it slows down the writing of a narrative (it makes you write a lot of code).
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
## Installation
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
If you have not created a project yet then it is recommended to use the [template](https://pixi-vn.web.app/start/getting-started.html#project-initialization) to start your project with ***ink***.
|
|
32
|
-
|
|
33
|
-
Otherwise to add ***ink*** to your Pixi’VN project you need to install the `@drincs/pixi-vn-ink` package.
|
|
29
|
+
To install the package, run the following command in your project:
|
|
34
30
|
|
|
35
31
|
```bash
|
|
36
32
|
# npm
|
|
@@ -46,84 +42,29 @@ pnpm add @drincs/pixi-vn-ink
|
|
|
46
42
|
bun add @drincs/pixi-vn-ink
|
|
47
43
|
```
|
|
48
44
|
|
|
49
|
-
|
|
45
|
+
## Start using _ink_ in Pixi’VN
|
|
50
46
|
|
|
51
|
-
|
|
52
|
-
// main.ts
|
|
53
|
-
import { importInkText } from '@drincs/pixi-vn-ink'
|
|
47
|
+
If you have not created a project yet then it is recommended to use the [template](https://pixi-vn.web.app/start/getting-started.html#project-initialization) to start your project with **_ink_**.
|
|
54
48
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
After installing the package you need to use the `importInkText()` function to import the **_ink_ script** into your project.
|
|
50
|
+
|
|
51
|
+
```ts title="main.ts"
|
|
52
|
+
import { narration } from "@drincs/pixi-vn";
|
|
53
|
+
import { importInkText } from '@drincs/pixi-vn-ink'
|
|
60
54
|
|
|
61
55
|
importInkText([inkText, ...])
|
|
56
|
+
narration.callLabel(`start`, {});
|
|
62
57
|
```
|
|
63
58
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
narration.callLabel(`start`, {})
|
|
59
|
+
```ink title="ink/story.ink"
|
|
60
|
+
=== start ===
|
|
61
|
+
Hello, world!
|
|
62
|
+
-> END
|
|
70
63
|
```
|
|
71
64
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
To import text contained in `.ink` files you need create the file `ink.d.ts` to declare the module `*.ink`.
|
|
77
|
-
|
|
78
|
-
```typescript
|
|
79
|
-
// src/ink.d.ts
|
|
80
|
-
declare module '*.ink' {
|
|
81
|
-
const value: string
|
|
82
|
-
export default value
|
|
65
|
+
```ts tab="ink.d.ts"
|
|
66
|
+
declare module "*.ink" {
|
|
67
|
+
const value: string;
|
|
68
|
+
export default value;
|
|
83
69
|
}
|
|
84
70
|
```
|
|
85
|
-
|
|
86
|
-
After that you need to add the `.ink` extension to the `assetsInclude` option in the `vite.config.ts` file.
|
|
87
|
-
|
|
88
|
-
```typescript
|
|
89
|
-
// vite.config.ts
|
|
90
|
-
export default defineConfig({
|
|
91
|
-
// ...
|
|
92
|
-
assetsInclude: ['**/*.ink'],
|
|
93
|
-
})
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
After that you can import the *ink* file and add `?raw` at the end of the import to get the text content.
|
|
97
|
-
|
|
98
|
-
```typescript
|
|
99
|
-
// main.ts
|
|
100
|
-
import { importInkText } from '@drincs/pixi-vn-ink'
|
|
101
|
-
import startLabel from './ink_labels/start.ink?raw'
|
|
102
|
-
|
|
103
|
-
importInkText([startLabel, ...])
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## *ink* syntax that will be ignored by Pixi’VN
|
|
107
|
-
|
|
108
|
-
The following syntax will be ignored by Pixi’VN. You can use them in your ***ink* script** ( For example if you want test your script with **Inky editor** ), but they will be ignored by Pixi’VN.
|
|
109
|
-
|
|
110
|
-
### INCLUDE
|
|
111
|
-
|
|
112
|
-
`INCLUDE` is used by ***ink*** to import other ***ink* files**.
|
|
113
|
-
|
|
114
|
-
In Pixi’VN you can use the `importInkText()` function to import the ***ink* files**. So if you use `INCLUDE` it will not be handled, so it does not import the files.
|
|
115
|
-
|
|
116
|
-
### Narration outside the knots
|
|
117
|
-
|
|
118
|
-
The narration outside the knots (or labels) will be ignored, except for variables. The reason is that you must run the first knot (or label) with the [Pixi’VN functions](https://pixi-vn.web.app/start/labels.html#run-a-label).
|
|
119
|
-
|
|
120
|
-
So for example the following cases will be ignored:
|
|
121
|
-
|
|
122
|
-
```ink
|
|
123
|
-
VAR my_var = false // ✅ This will be handled (because it is a variable)
|
|
124
|
-
Hello // ❌ This will be ignored
|
|
125
|
-
-> start // ❌ This will be ignored
|
|
126
|
-
=== start === // ✅ This will be handled
|
|
127
|
-
My name is John // ✅ This will be handled
|
|
128
|
-
-> DONE // ✅ This will be handled
|
|
129
|
-
```
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import {a,e,f,h}from'./chunk-YGSSDCYK.mjs';import {createExportableElement,PixiError}from'@drincs/pixi-vn';import {canvas,VideoSprite,showVideo,Assets,Text,showText,ImageSprite,showImage,ImageContainer,showImageContainer,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn/canvas';import {NarrationManagerStatic,narration,RegisteredLabels,LabelAbstract}from'@drincs/pixi-vn/narration';import {sound}from'@drincs/pixi-vn/sound';import {storage}from'@drincs/pixi-vn/storage';import {RegisteredCharacters}from'@drincs/pixi-vn/characters';import a$1,{ZodType}from'zod';var Ye=Object.defineProperty,Xe=(e,t,i)=>t in e?Ye(e,t,{enumerable:true,configurable:true,writable:true,value:i}):e[t]=i,W=(e,t,i)=>Xe(e,typeof t!="symbol"?t+"":t,i),I;(e=>(e.log=(t,...i)=>console.log(`[Pixi\u2019VN Json] ${t}`,...i),e.warn=(t,...i)=>console.warn(`[Pixi\u2019VN Json] ${t}`,...i),e.error=(t,...i)=>console.error(`[Pixi\u2019VN Json] ${t}`,...i),e.info=(t,...i)=>console.info(`[Pixi\u2019VN Json] ${t}`,...i)))(I||(I={}));var z=class N{static init(t){t.loadAssets&&(N._loadAssets=t.loadAssets),t.soundOperation&&(N._soundOperation=t.soundOperation),t.imageOperation&&(N._imageOperation=t.imageOperation),t.videoOperation&&(N._videoOperation=t.videoOperation),t.imageContainerOperation&&(N._imageContainerOperation=t.imageContainerOperation),t.textOperation&&(N._textOperation=t.textOperation),t.canvasElementOperation&&(N._canvasElementOperation=t.canvasElementOperation),t.setStorageValue&&(N._setStorageValue=t.setStorageValue),t.setInitialStorageValue&&(N._setInitialStorageValue=t.setInitialStorageValue),t.narrationOperation&&(N._narrationOperation=t.narrationOperation),t.effectOperation&&(N._effectOperation=t.effectOperation),t.animateOperation&&(N._animateOperation=t.animateOperation),t.getLogichValue&&(N._getLogichValue=t.getLogichValue),t.getConditionalStep&&(N._getConditionalStep=t.getConditionalStep);}static get loadAssets(){return N._loadAssets}static get soundOperation(){return N._soundOperation}static get imageOperation(){return N._imageOperation}static get videoOperation(){return N._videoOperation}static get imageContainerOperation(){return N._imageContainerOperation}static get textOperation(){return N._textOperation}static get canvasElementOperation(){return N._canvasElementOperation}static get setStorageValue(){return N._setStorageValue}static get setInitialStorageValue(){return N._setInitialStorageValue}static get narrationOperation(){return N._narrationOperation}static get effectOperation(){return N._effectOperation}static get animateOperation(){return N._animateOperation}static get getLogichValue(){return N._getLogichValue}static get getConditionalStep(){return N._getConditionalStep}};W(z,"_loadAssets",()=>{}),W(z,"_soundOperation",()=>{throw I.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),W(z,"_imageOperation",()=>{throw I.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),W(z,"_videoOperation",()=>{throw I.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),W(z,"_imageContainerOperation",()=>{throw I.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),W(z,"_textOperation",()=>{throw I.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),W(z,"_canvasElementOperation",()=>{throw I.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),W(z,"_setStorageValue",()=>{throw I.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),W(z,"_setInitialStorageValue",()=>{throw I.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),W(z,"_narrationOperation",()=>{throw I.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),W(z,"_effectOperation",()=>{throw I.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),W(z,"_animateOperation",()=>{throw I.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),W(z,"_getLogichValue",()=>{throw I.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),W(z,"_getConditionalStep",()=>{throw I.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var d=z;var Ze=Object.defineProperty,et=(e,t,i)=>t in e?Ze(e,t,{enumerable:true,configurable:true,writable:true,value:i}):e[t]=i,de=(e,t,i)=>et(e,typeof t!="symbol"?t+"":t,i);function tt(e,t={}){let i="";return e.values.forEach(r=>{if(typeof r=="string")i+=r;else {let o=d.getLogichValue(r,t);i+=`${o}`;}}),i}var ae=class V{static t(t){return Array.isArray(t)?t.map(i=>V.translate(`${i}`)):V.translate(`${t}`)}static set beforeToTranslate(t){V._beforeToTranslate=t;}static set translate(t){V._translate=t;}static get translate(){return t=>{let i=t;return V._beforeToTranslate&&(i=V._beforeToTranslate(i)),i=V._translate(i),V._afterToTranslate&&(i=V._afterToTranslate(i)),i}}static set afterToTranslate(t){V._afterToTranslate=t;}static addKey(t,i,r){let o=r.defaultValue||"empty_string";typeof i=="string"&&(i=[i]),Array.isArray(i)&&i.forEach(l=>{t[l]===void 0&&(o==="empty_string"?t[l]="":o==="copy_key"&&(V._beforeToTranslate?t[l]=V._beforeToTranslate(l):t[l]=l));});}static getConditionalsThenElse(t,i=[]){if(typeof t=="object"&&t&&"type"in t)if(t.type==="ifelse")t.then&&V.getConditionalsThenElse(t.then,i),t.else&&V.getConditionalsThenElse(t.else,i);else if(t.type==="stepswitch"){if(t.elements)if(Array.isArray(t.elements))t.elements.forEach(r=>{V.getConditionalsThenElse(r,i);});else if(t.elements.type==="ifelse"){let r=[];V.getConditionalsThenElse(t.elements,r),r.forEach(o=>{i.push(...o);});}else if(t.elements.type==="stepswitch"){let r=[];V.getConditionalsThenElse(t.elements,r),r.forEach(o=>{i.push(...o);});}else V.getConditionalsThenElse(t.elements,i);}else t.type==="resulttocombine"?(t.firstItem&&V.getConditionalsThenElse(t.firstItem,i),t.secondConditionalItem&&t.secondConditionalItem.forEach(r=>{V.getConditionalsThenElse(r,i);})):i.push(t);else t&&i.push(t);return i}static async generateJsonTranslation(t,i={},r={}){let{defaultValue:o="copy_key",operationStringConvert:l}=r,g=t.map(async y=>{if(y.choices){let c=[];Array.isArray(y.choices)?c=[y.choices]:c=V.getConditionalsThenElse(y.choices),c.forEach(x=>x.forEach(v=>{if("type"in v){let b=[];v.type==="ifelse"||v.type==="stepswitch"?V.getConditionalsThenElse(v,b):b=[v],b.map(h=>V.getConditionalsThenElse(h.text)).forEach(h=>{Array.isArray(h)&&h.forEach(O=>{Array.isArray(O)?O.forEach(A=>{typeof A=="string"?V.addKey(i,A,{defaultValue:o}):V.getConditionalsThenElse(A).forEach(S=>{Array.isArray(S)?S.forEach(P=>{typeof P=="string"&&V.addKey(i,P,{defaultValue:o});}):typeof S=="string"&&V.addKey(i,S,{defaultValue:o});});}):typeof O=="string"&&V.addKey(i,O,{defaultValue:o});});});}}));}if(y.dialogue){let c=[];Array.isArray(y.dialogue)?c=[y.dialogue]:c=V.getConditionalsThenElse(y.dialogue),c.forEach(x=>{if(typeof x=="string")V.addKey(i,x,{defaultValue:o});else if("text"in x){let v=V.getConditionalsThenElse(x.text);typeof v=="string"&&(v=[v]),v.forEach(b=>{typeof b=="string"?V.addKey(i,b,{defaultValue:o}):V.getConditionalsThenElse(b).forEach(h=>{typeof h=="string"?V.addKey(i,h,{defaultValue:o}):Array.isArray(h)&&h.forEach(O=>{typeof O=="string"?V.addKey(i,O,{defaultValue:o}):V.getConditionalsThenElse(O).forEach(A=>{typeof A=="string"&&V.addKey(i,A,{defaultValue:o});});});});});}});}if(y.operations)for(let c of y.operations){if(c.type==="operationtoconvert"&&l){let x=tt(c),v=await l(x,y,{});if(!v)return;c=v;}c.type==="text"&&c.operationType==="show"&&V.addKey(i,c.text,{defaultValue:o});}y.conditionalStep&&V.getConditionalsThenElse(y.conditionalStep).forEach(c=>{Array.isArray(c)?V.generateJsonTranslation(c,i,r):V.generateJsonTranslation([c],i,r);});});return await Promise.all(g),i}};de(ae,"_beforeToTranslate"),de(ae,"_translate",e=>e),de(ae,"_afterToTranslate");var it=ae,M=it;var Vt=Object.defineProperty,At=(e,t,i)=>t in e?Vt(e,t,{enumerable:true,configurable:true,writable:true,value:i}):e[t]=i,H=(e,t,i)=>At(e,typeof t!="symbol"?t+"":t,i);async function Ae(e){let t=d.getLogichValue(e,{});if(t)switch(t.type){case "assets":switch(t.operationType){case "load":await Assets.load(t.aliases);break;case "lazyload":Assets.backgroundLoad(t.aliases);break}break;case "bundle":switch(t.operationType){case "load":await Assets.loadBundle(t.aliases);break;case "lazyload":Assets.backgroundLoadBundle(t.aliases);break}break}}var T;(e=>(e.log=(t,...i)=>console.log(`[Pixi\u2019VN Json] ${t}`,...i),e.warn=(t,...i)=>console.warn(`[Pixi\u2019VN Json] ${t}`,...i),e.error=(t,...i)=>console.error(`[Pixi\u2019VN Json] ${t}`,...i),e.info=(t,...i)=>console.info(`[Pixi\u2019VN Json] ${t}`,...i)))(T||(T={}));async function se(e,t,i){switch(i.type){case "fade":await showWithFade(t.alias,e,i.props,i.priority);break;case "dissolve":await showWithDissolve(t.alias,e,i.props,i.priority);break;case "movein":case "moveout":await moveIn(t.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await zoomIn(t.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await pushIn(t.alias,e,i.props,i.priority);break}}function ie(e){if(e.transition)switch(e.transition.type){case "fade":removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);}async function Pe(e){switch(e.operationType){case "show":if(e.transition){let t=new ImageSprite(e.props,e.url||e.alias);await se(t,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):T.error(`Image with alias ${e.alias} not found.`);break}case "remove":ie(e);break}}async function Se(e){switch(e.operationType){case "show":if(e.transition){let t=new VideoSprite(e.props,e.url||e.alias);await se(t,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):T.error(`Video with alias ${e.alias} not found.`);break}case "remove":ie(e);break;case "pause":case "resume":{let t=canvas.find(e.alias);t?t.paused=e.operationType==="pause":T.error(`Video with alias ${e.alias} not found.`);break}}}async function Te(e){switch(e.operationType){case "show":if(e.transition){let t=new ImageContainer(e.props,e.urls);await se(t,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):T.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":ie(e);break}}async function Ne(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=M.t(e.text),e.transition){let t=new Text(e.props);await se(t,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):T.error(`Text with alias ${e.alias} not found.`);break}case "remove":ie(e);break}}async function Le(e){switch(e.operationType){case "edit":try{let t=canvas.find(e.alias);t?e.props&&t.setMemory({...t.memory,...e.props}):T.error(`Canvas Element with alias ${e.alias} not found.`);}catch(t){T.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,t);}break;case "remove":ie(e);break}}async function je(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function Ce(e){switch(e.type){case "animate":canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function Ee(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function _e(e){switch(e.operationType){case "play":e.url?sound.play(e.alias,e.url,e.props):sound.play(e.alias,e.props);break;case "stop":switch(e.type){case "sound":sound.stop(e.alias);break;case "all":sound.stopAll();break}break;case "pause":switch(e.type){case "sound":sound.pause(e.alias);break;case "channel":sound.findChannel(e.alias).pauseAll();break;case "all":sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.resume(e.alias);break;case "channel":sound.findChannel(e.alias).resumeAll();break;case "all":sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([t,i])=>{let r=sound.find(e.alias);r&&(t==="volume"?r.volume.value=i:r.paused=i);});break}}var ge="___param___",J=class L{static init(t){t.loadAssets&&(L._loadAssets=t.loadAssets),t.soundOperation&&(L._soundOperation=t.soundOperation),t.imageOperation&&(L._imageOperation=t.imageOperation),t.videoOperation&&(L._videoOperation=t.videoOperation),t.imageContainerOperation&&(L._imageContainerOperation=t.imageContainerOperation),t.textOperation&&(L._textOperation=t.textOperation),t.canvasElementOperation&&(L._canvasElementOperation=t.canvasElementOperation),t.setStorageValue&&(L._setStorageValue=t.setStorageValue),t.setInitialStorageValue&&(L._setInitialStorageValue=t.setInitialStorageValue),t.narrationOperation&&(L._narrationOperation=t.narrationOperation),t.effectOperation&&(L._effectOperation=t.effectOperation),t.animateOperation&&(L._animateOperation=t.animateOperation),t.getLogichValue&&(L._getLogichValue=t.getLogichValue),t.getConditionalStep&&(L._getConditionalStep=t.getConditionalStep);}static get loadAssets(){return L._loadAssets}static get soundOperation(){return L._soundOperation}static get imageOperation(){return L._imageOperation}static get videoOperation(){return L._videoOperation}static get imageContainerOperation(){return L._imageContainerOperation}static get textOperation(){return L._textOperation}static get canvasElementOperation(){return L._canvasElementOperation}static get setStorageValue(){return L._setStorageValue}static get setInitialStorageValue(){return L._setInitialStorageValue}static get narrationOperation(){return L._narrationOperation}static get effectOperation(){return L._effectOperation}static get animateOperation(){return L._animateOperation}static get getLogichValue(){return L._getLogichValue}static get getConditionalStep(){return L._getConditionalStep}};H(J,"_loadAssets",()=>{}),H(J,"_soundOperation",()=>{throw T.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),H(J,"_imageOperation",()=>{throw T.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),H(J,"_videoOperation",()=>{throw T.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),H(J,"_imageContainerOperation",()=>{throw T.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),H(J,"_textOperation",()=>{throw T.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),H(J,"_canvasElementOperation",()=>{throw T.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),H(J,"_setStorageValue",()=>{throw T.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),H(J,"_setInitialStorageValue",()=>{throw T.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),H(J,"_narrationOperation",()=>{throw T.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),H(J,"_effectOperation",()=>{throw T.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),H(J,"_animateOperation",()=>{throw T.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),H(J,"_getLogichValue",()=>{throw T.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),H(J,"_getConditionalStep",()=>{throw T.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var Pt=J;function St(e,t){if(t&&typeof t=="object"&&typeof e.functionName=="string"&&e.functionName in t){let i=t[e.functionName];if(typeof i=="function"){let r=e.args.map(o=>Pt.getLogichValue(o,t));return i(...r)}else T.warn(`getLogichValue function ${e.functionName} not found in props`);}}function ke(e,t){let i=d.getLogichValue(e,t);return i&&typeof i=="object"&&"type"in i?d.getLogichValue(i,t):i}function ze(e,t={}){let i=ke(e.value,t);switch(e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.set(e.key,i);break;case "tempstorage":storage.setTempVariable(e.key,i);break;case "params":{let r=storage.get(`${ge}${narration.openedLabels.length-1}`)||[];r.length>e.key&&(r[e.key]=i),storage.setTempVariable(`${ge}${narration.openedLabels.length-1}`,r);break}}}function Ie(e,t={}){let i=ke(e.value,t);switch(e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:i};break}}function he(e,t={}){let i=fe(e,t);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case "value":return Nt(i,t);case "arithmetic":case "arithmeticsingle":return Tt(i,t);case "compare":case "union":return Lt(i,t);case "function":return St(i,t)}return i}function Tt(e,t){let i=d.getLogichValue(e.leftValue,t);switch(e.type){case "arithmetic":{let r=d.getLogichValue(e.rightValue,t);switch(e.operator){case "*":return i*r;case "/":return i/r;case "+":return typeof i=="string"||typeof r=="string"?`${i}${r}`:Array.isArray(i)&&Array.isArray(r)?[...i,...r]:Array.isArray(i)?[...i,r]:Array.isArray(r)?[i,...r]:i+r;case "-":if(Array.isArray(i)&&Array.isArray(r))return i.filter(o=>!r.includes(o));if(Array.isArray(i))return i.filter(o=>o!==r);if(Array.isArray(r)){T.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return i-r;case "%":return i%r;case "POW":return i**r;case "RANDOM":return narration.getRandomNumber(i,r);case "INTERSECTION":if(Array.isArray(i)&&Array.isArray(r))return i.filter(o=>r.includes(o));T.warn("getValueFromArithmeticOperations cannot intersect non-array values");return;default:T.warn("getValueFromArithmeticOperations unknown operator",e);return}}case "arithmeticsingle":switch(e.operator){case "INT":return Number(i);case "FLOOR":return Math.floor(i)}break}}function Nt(e,t){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.inputValue:storage.get(e.key);case "flagStorage":return storage.getFlag(e.key);case "label":return narration.getTimesLabelOpened(e.label);case "choice":return narration.getTimesChoiceMade(e.index);case "logic":return d.getLogichValue(e.operation,t);case "params":{let i=storage.get(`${ge}${narration.openedLabels.length-1}`)||[];if(i&&i.length>e.key)return i[e.key];T.warn("getValue params not found");return}}return e}function Lt(e,t){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":{let i=d.getLogichValue(e.leftValue,t),r=d.getLogichValue(e.rightValue,t);switch(e.operator){case "==":return Array.isArray(i)&&Array.isArray(r)?i.length===r.length&&i.every(o=>r.includes(o)):i===r;case "!=":return Array.isArray(i)&&Array.isArray(r)?i.length!==r.length||!i.every(o=>r.includes(o)):i!==r;case "<":return typeof i=="string"&&typeof r=="string"?i.localeCompare(r)<0:Array.isArray(i)&&Array.isArray(r)?i.length<r.length:i<r;case "<=":return typeof i=="string"&&typeof r=="string"?i.localeCompare(r)<=0:Array.isArray(i)&&Array.isArray(r)?i.length<=r.length:i<=r;case ">":return typeof i=="string"&&typeof r=="string"?i.localeCompare(r)>0:Array.isArray(i)&&Array.isArray(r)?i.length>r.length:i>r;case ">=":return typeof i=="string"&&typeof r=="string"?i.localeCompare(r)>=0:Array.isArray(i)&&Array.isArray(r)?i.length>=r.length:i>=r;case "CONTAINS":return Array.isArray(i)&&Array.isArray(r)?r.every(o=>i.includes(o)):Array.isArray(i)?i.includes(r):i.toString().includes(r.toString())}break}case "value":{let i=d.getLogichValue(e,t);return Array.isArray(i)?i.length>0:i&&typeof i=="object"?Object.keys(i).length>0:!!i}case "union":return jt(e,t)}return !!e}function jt(e,t){if(e.unionType==="not"){let r=he(e.condition,t);return Array.isArray(r)?r.length===0:r&&typeof r=="object"?Object.keys(r).length===0:!r}let i=r=>d.getLogichValue(r,t)||false;return e.unionType==="and"?e.conditions.every(i):e.conditions.some(i)}function Ct(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function fe(e,t={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Et(e,t);case "ifelse":return d.getLogichValue(e.condition,t)?d.getLogichValue(e.then,t):d.getLogichValue(e.else,t);case "stepswitch":{let i=d.getLogichValue(e.elements,t)||[];if(i.length===0){T.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let r=Ct(0,i.length-1);return d.getLogichValue(i[r],t)}case "loop":{let r=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return r>i.length-1?(r=r%i.length,d.getLogichValue(i[r],t)):d.getLogichValue(i[r],t)}case "sequential":{let r,o=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(r=d.getLogichValue(i[i.length-1],t)),o>i.length-1?r:d.getLogichValue(i[o],t)}case "sequentialrandom":{let r=NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(r===void 0&&e.end==="lastItem"){let o=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!o?.usedRandomNumbers){T.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let l=o.usedRandomNumbers[`0-${i.length-1}`];return d.getLogichValue(i[l[l.length-1]],t)}if(r===void 0){T.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return d.getLogichValue(i[r],t)}}}}return e}function le(e,t={}){if(e.conditionalStep){let i=createExportableElement(d.getLogichValue(e.conditionalStep,t));if(i?.glueEnabled===void 0&&delete i?.glueEnabled,i?.goNextStep===void 0&&delete i?.goNextStep,i?.end===void 0&&delete i?.end,i?.choices===void 0&&delete i?.choices,i?.dialogue===void 0&&delete i?.dialogue,i?.labelToOpen===void 0&&delete i?.labelToOpen,i?.operations===void 0&&delete i?.operations,i){let r={...e,conditionalStep:void 0,...i};return le(r,t)}else narration.dialogGlue&&(narration.dialogGlue=false);}return e}function Et(e,t){let i=e.firstItem,r=(e.secondConditionalItem??[]).flatMap(l=>Array.isArray(l)?l.map(g=>d.getLogichValue(g,t)):[d.getLogichValue(l,t)]),o=i?[i,...r]:r;if(o.length===0){T.warn("combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return M.t(o);if(typeof o[0]=="object"){let l=o,g,y=false,c=l.map((s,n)=>{s=le(s,t);let p=d.getLogichValue(s.dialogue,t)||"";return n===0?(g=d.getLogichValue(s.glueEnabled,t)||false,p):(typeof p=="object"&&"text"in p&&(p=`${p.character}: ${p.text}`),g===false&&y&&(p=`
|
|
2
|
+
|
|
3
|
+
${p}`),p&&(y=true),g=d.getLogichValue(s.glueEnabled,t)||false,p)}),x=d.getLogichValue(c[0],t),v=typeof x=="object"&&"character"in x?x.character:void 0,b=c.flatMap(s=>{let n;s&&typeof s=="object"&&"text"in s?n=s.text:n=s;let p;return Array.isArray(n)?p=n.map(u=>{let f=d.getLogichValue(u,t);return M.t(`${f}`)}):p=d.getLogichValue(n,t)||"",M.t(p)}),h=l.find(s=>s.end),O=l.find(s=>s.choices),A=false,S=false;l.length>0&&(l[0].glueEnabled&&l[0].goNextStep&&l[0].dialogue===void 0&&(narration.dialogGlue=true),A=l[l.length-1].glueEnabled,S=l.reverse().find(s=>!(s.operations&&(!s.dialogue||!s.choices)))?.goNextStep);let P=l.find(s=>s.labelToOpen),C=[];return l.forEach(s=>{s.operations&&(C=[...C,...s.operations]);}),{dialogue:v?{character:v,text:b}:b,end:h?.end,choices:O?.choices,glueEnabled:A,goNextStep:S,labelToOpen:P?.labelToOpen,operations:C}}}var It=Object.create,me=Object.defineProperty,Mt=Object.getOwnPropertyDescriptor,Jt=Object.getOwnPropertyNames,Rt=Object.getPrototypeOf,$t=Object.prototype.hasOwnProperty,Wt=(e,t,i)=>t in e?me(e,t,{enumerable:true,configurable:true,writable:true,value:i}):e[t]=i,Je=(e=>typeof a<"u"?a:typeof Proxy<"u"?new Proxy(e,{get:(t,i)=>(typeof a<"u"?a:t)[i]}):e)(function(e){if(typeof a<"u")return a.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),We=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ht=(e,t,i,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Jt(t))!$t.call(e,o)&&o!==i&&me(e,o,{get:()=>t[o],enumerable:!(r=Mt(t,o))||r.enumerable});return e},Bt=(e,t,i)=>(i=e!=null?It(Rt(e)):{},Ht(me(i,"default",{value:e,enumerable:true}),e)),k=(e,t,i)=>Wt(e,typeof t!="symbol"?t+"":t,i),Dt=We((e,t)=>{(function(i,r){typeof e=="object"?t.exports=e=r():typeof define=="function"&&define.amd?define([],r):i.CryptoJS=r();})(e,function(){var i=i||(function(r,o){var l;if(typeof window<"u"&&window.crypto&&(l=window.crypto),typeof self<"u"&&self.crypto&&(l=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(l=globalThis.crypto),!l&&typeof window<"u"&&window.msCrypto&&(l=window.msCrypto),!l&&typeof global<"u"&&global.crypto&&(l=global.crypto),!l&&typeof Je=="function")try{l=Je("crypto");}catch{}var g=function(){if(l){if(typeof l.getRandomValues=="function")try{return l.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof l.randomBytes=="function")try{return l.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},y=Object.create||(function(){function s(){}return function(n){var p;return s.prototype=n,p=new s,s.prototype=null,p}})(),c={},x=c.lib={},v=x.Base=(function(){return {extend:function(s){var n=y(this);return s&&n.mixIn(s),(!n.hasOwnProperty("init")||this.init===n.init)&&(n.init=function(){n.$super.init.apply(this,arguments);}),n.init.prototype=n,n.$super=this,n},create:function(){var s=this.extend();return s.init.apply(s,arguments),s},init:function(){},mixIn:function(s){for(var n in s)s.hasOwnProperty(n)&&(this[n]=s[n]);s.hasOwnProperty("toString")&&(this.toString=s.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),b=x.WordArray=v.extend({init:function(s,n){s=this.words=s||[],n!=o?this.sigBytes=n:this.sigBytes=s.length*4;},toString:function(s){return (s||O).stringify(this)},concat:function(s){var n=this.words,p=s.words,u=this.sigBytes,f=s.sigBytes;if(this.clamp(),u%4)for(var w=0;w<f;w++){var E=p[w>>>2]>>>24-w%4*8&255;n[u+w>>>2]|=E<<24-(u+w)%4*8;}else for(var B=0;B<f;B+=4)n[u+B>>>2]=p[B>>>2];return this.sigBytes+=f,this},clamp:function(){var s=this.words,n=this.sigBytes;s[n>>>2]&=4294967295<<32-n%4*8,s.length=r.ceil(n/4);},clone:function(){var s=v.clone.call(this);return s.words=this.words.slice(0),s},random:function(s){for(var n=[],p=0;p<s;p+=4)n.push(g());return new b.init(n,s)}}),h=c.enc={},O=h.Hex={stringify:function(s){for(var n=s.words,p=s.sigBytes,u=[],f=0;f<p;f++){var w=n[f>>>2]>>>24-f%4*8&255;u.push((w>>>4).toString(16)),u.push((w&15).toString(16));}return u.join("")},parse:function(s){for(var n=s.length,p=[],u=0;u<n;u+=2)p[u>>>3]|=parseInt(s.substr(u,2),16)<<24-u%8*4;return new b.init(p,n/2)}},A=h.Latin1={stringify:function(s){for(var n=s.words,p=s.sigBytes,u=[],f=0;f<p;f++){var w=n[f>>>2]>>>24-f%4*8&255;u.push(String.fromCharCode(w));}return u.join("")},parse:function(s){for(var n=s.length,p=[],u=0;u<n;u++)p[u>>>2]|=(s.charCodeAt(u)&255)<<24-u%4*8;return new b.init(p,n)}},S=h.Utf8={stringify:function(s){try{return decodeURIComponent(escape(A.stringify(s)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(s){return A.parse(unescape(encodeURIComponent(s)))}},P=x.BufferedBlockAlgorithm=v.extend({reset:function(){this._data=new b.init,this._nDataBytes=0;},_append:function(s){typeof s=="string"&&(s=S.parse(s)),this._data.concat(s),this._nDataBytes+=s.sigBytes;},_process:function(s){var n,p=this._data,u=p.words,f=p.sigBytes,w=this.blockSize,E=w*4,B=f/E;s?B=r.ceil(B):B=r.max((B|0)-this._minBufferSize,0);var X=B*w,te=r.min(X*4,f);if(X){for(var ce=0;ce<X;ce+=w)this._doProcessBlock(u,ce);n=u.splice(0,X),p.sigBytes-=te;}return new b.init(n,te)},clone:function(){var s=v.clone.call(this);return s._data=this._data.clone(),s},_minBufferSize:0});x.Hasher=P.extend({cfg:v.extend(),init:function(s){this.cfg=this.cfg.extend(s),this.reset();},reset:function(){P.reset.call(this),this._doReset();},update:function(s){return this._append(s),this._process(),this},finalize:function(s){s&&this._append(s);var n=this._doFinalize();return n},blockSize:16,_createHelper:function(s){return function(n,p){return new s.init(p).finalize(n)}},_createHmacHelper:function(s){return function(n,p){return new C.HMAC.init(s,p).finalize(n)}}});var C=c.algo={};return c})(Math);return i});}),Ft=We((e,t)=>{(function(i,r){typeof e=="object"?t.exports=e=r(Dt()):typeof define=="function"&&define.amd?define(["./core"],r):r(i.CryptoJS);})(e,function(i){return (function(){var r=i,o=r.lib,l=o.WordArray,g=o.Hasher,y=r.algo,c=[],x=y.SHA1=g.extend({_doReset:function(){this._hash=new l.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(v,b){for(var h=this._hash.words,O=h[0],A=h[1],S=h[2],P=h[3],C=h[4],s=0;s<80;s++){if(s<16)c[s]=v[b+s]|0;else {var n=c[s-3]^c[s-8]^c[s-14]^c[s-16];c[s]=n<<1|n>>>31;}var p=(O<<5|O>>>27)+C+c[s];s<20?p+=(A&S|~A&P)+1518500249:s<40?p+=(A^S^P)+1859775393:s<60?p+=(A&S|A&P|S&P)-1894007588:p+=(A^S^P)-899497514,C=P,P=S,S=A<<30|A>>>2,A=O,O=p;}h[0]=h[0]+O|0,h[1]=h[1]+A|0,h[2]=h[2]+S|0,h[3]=h[3]+P|0,h[4]=h[4]+C|0;},_doFinalize:function(){var v=this._data,b=v.words,h=this._nDataBytes*8,O=v.sigBytes*8;return b[O>>>5]|=128<<24-O%32,b[(O+64>>>9<<4)+14]=Math.floor(h/4294967296),b[(O+64>>>9<<4)+15]=h,v.sigBytes=b.length*4,this._process(),this._hash},clone:function(){var v=g.clone.call(this);return v._hash=this._hash.clone(),v}});r.SHA1=g._createHelper(x),r.HmacSHA1=g._createHmacHelper(x);})(),i.SHA1});}),Re="___param___",_;(e=>(e.log=(t,...i)=>console.log(`[Pixi\u2019VN Json] ${t}`,...i),e.warn=(t,...i)=>console.warn(`[Pixi\u2019VN Json] ${t}`,...i),e.error=(t,...i)=>console.error(`[Pixi\u2019VN Json] ${t}`,...i),e.info=(t,...i)=>console.info(`[Pixi\u2019VN Json] ${t}`,...i)))(_||(_={}));var $=class j{static init(t){t.loadAssets&&(j._loadAssets=t.loadAssets),t.soundOperation&&(j._soundOperation=t.soundOperation),t.imageOperation&&(j._imageOperation=t.imageOperation),t.videoOperation&&(j._videoOperation=t.videoOperation),t.imageContainerOperation&&(j._imageContainerOperation=t.imageContainerOperation),t.textOperation&&(j._textOperation=t.textOperation),t.canvasElementOperation&&(j._canvasElementOperation=t.canvasElementOperation),t.setStorageValue&&(j._setStorageValue=t.setStorageValue),t.setInitialStorageValue&&(j._setInitialStorageValue=t.setInitialStorageValue),t.narrationOperation&&(j._narrationOperation=t.narrationOperation),t.effectOperation&&(j._effectOperation=t.effectOperation),t.animateOperation&&(j._animateOperation=t.animateOperation),t.getLogichValue&&(j._getLogichValue=t.getLogichValue),t.getConditionalStep&&(j._getConditionalStep=t.getConditionalStep);}static get loadAssets(){return j._loadAssets}static get soundOperation(){return j._soundOperation}static get imageOperation(){return j._imageOperation}static get videoOperation(){return j._videoOperation}static get imageContainerOperation(){return j._imageContainerOperation}static get textOperation(){return j._textOperation}static get canvasElementOperation(){return j._canvasElementOperation}static get setStorageValue(){return j._setStorageValue}static get setInitialStorageValue(){return j._setInitialStorageValue}static get narrationOperation(){return j._narrationOperation}static get effectOperation(){return j._effectOperation}static get animateOperation(){return j._animateOperation}static get getLogichValue(){return j._getLogichValue}static get getConditionalStep(){return j._getConditionalStep}};k($,"_loadAssets",()=>{}),k($,"_soundOperation",()=>{throw _.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),k($,"_imageOperation",()=>{throw _.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),k($,"_videoOperation",()=>{throw _.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),k($,"_imageContainerOperation",()=>{throw _.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),k($,"_textOperation",()=>{throw _.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),k($,"_canvasElementOperation",()=>{throw _.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),k($,"_setStorageValue",()=>{throw _.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),k($,"_setInitialStorageValue",()=>{throw _.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),k($,"_narrationOperation",()=>{throw _.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),k($,"_effectOperation",()=>{throw _.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),k($,"_animateOperation",()=>{throw _.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),k($,"_getLogichValue",()=>{throw _.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),k($,"_getConditionalStep",()=>{throw _.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var Ut=$;function qt(e,t){if(t&&typeof t=="object"&&typeof e.functionName=="string"&&e.functionName in t){let i=t[e.functionName];if(typeof i=="function"){let r=e.args.map(o=>Ut.getLogichValue(o,t));return i(...r)}else _.warn(`getLogichValue function ${e.functionName} not found in props`);}}function Kt(e,t={}){let i="";return e.values.forEach(r=>{if(typeof r=="string")i+=r;else {let o=d.getLogichValue(r,t);i+=`${o}`;}}),i}async function He(e,t,i){let r=d.getLogichValue(e,t);if(r)switch(r.type){case "sound":d.soundOperation(r);break;case "assets":case "bundle":await d.loadAssets(r);break;case "image":await d.imageOperation(r);break;case "video":await d.videoOperation(r);break;case "imagecontainer":await d.imageContainerOperation(r);break;case "text":await d.textOperation(r);break;case "canvaselement":await d.canvasElementOperation(r);break;case "value":d.setStorageValue(r,t);break;case "operationtoconvert":if(i){let o=Kt(r,t),l=await i(o);l&&await He(l,t,i);}break;case "input":case "dialogue":d.narrationOperation(r);break;case "shake":await d.effectOperation(r);break;case "animate":case "animate-sequence":d.animateOperation(r);break;case "function":await qt(r,t);break}}function $e(e){let t=d.getLogichValue(e,{});t&&t.type==="value"&&t.storageOperationType==="set"&&(t.storageType==="storage"||t.storageType==="tempstorage")&&d.setInitialStorageValue(t);}var Qt=Bt(Ft()),Gt=class extends LabelAbstract{constructor(e,t,i,r={}){i||(i={}),i.onLoadingLabel=async()=>{for(let o of t){let l;if(typeof o=="function"?l=o():l=o,l=d.getConditionalStep(l),l.operations)try{let g=l.operations.map(y=>d.loadAssets(y));await Promise.all(g);}catch(g){_.error("The operation in the onLoadingLabel function of the label has an error:",g);}}},super(e,i),k(this,"_steps"),k(this,"operationStringConvert"),k(this,"skipEmptyDialogs",false),this._steps=t,this.operationStringConvert=r.operationStringConvert,this.skipEmptyDialogs=r.skipEmptyDialogs||false;}get steps(){return this._steps.map(e=>this.stepConverter(e))}get stepCount(){return this._steps.length}getStepById(e){if(e<0||e>=this._steps.length)return;let t=this._steps[e];return this.stepConverter(t)}getStepSha(e){if(e<0||e>=this.steps.length)return;let t=this._steps[e];return (0, Qt.default)(t.toString().toLocaleLowerCase()).toString()}getDialogueText(e,t){let i="";if(Array.isArray(e)){let r=[];e.forEach(o=>{if(typeof o=="string")r.push(o);else if(o&&typeof o=="object"){let l=d.getLogichValue(o,t);l?(l&&!Array.isArray(l)&&typeof l=="object"&&(l=d.getLogichValue(l,t)||""),Array.isArray(l)?r=r.map(g=>`${g}`).concat(l):r.push(`${l}`)):r.push(`${o}`);}else r.push(`${o}`);}),i=r;}else {let r=d.getLogichValue(e,t);r&&!Array.isArray(r)&&typeof r=="object"&&(r=d.getLogichValue(r,t)),r&&Array.isArray(r)?i=r.map(o=>`${o}`):i=`${r}`;}return i}getDialogue(e,t){if(e==null)return;let i=d.getLogichValue(e,t);return i==null?`${i}`:typeof i=="object"&&"character"in i&&"text"in i?{character:i.character,text:M.t(this.getDialogueText(i.text,t))}:M.t(this.getDialogueText(i,t))}getChoices(e,t){return d.getLogichValue(e,t)?.map(i=>d.getLogichValue(i,t)).filter(i=>i!==void 0)}stepConverter(e){return async t=>{let i=typeof e=="function"?e():e;i=createExportableElement(i),i=d.getConditionalStep(i,t);let r=this.operationStringConvert?h=>this.operationStringConvert(h,i,t):void 0,{operations:o=[]}=i;for(let h of o)await He(h,t,r);let{labelToOpen:l=[]}=i,g=this.getChoices(i.choices,t),y=d.getLogichValue(i.glueEnabled,t),c=this.getDialogue(i.dialogue,t),x=[];Array.isArray(l)||(l=[l]),l.forEach(h=>{let O=d.getLogichValue(h,t);O&&x.push(O);});let v=d.getLogichValue(i.goNextStep,t),b=d.getLogichValue(i.end,t);if(g){let h=g.map(O=>{let A="";if(Array.isArray(O.text)){let S=[];O.text.forEach(P=>{if(typeof P=="string")S.push(M.t(P));else if(P&&typeof P=="object"){let C=d.getLogichValue(P,t);C&&!Array.isArray(C)&&typeof C=="object"&&(C=d.getLogichValue(C,t)||""),C&&(Array.isArray(C)?S=S.concat(M.t(C)):S.push(M.t(C)));}}),A=S;}else typeof O.text=="string"&&(A=M.t(O.text));return {label:O.label,text:A,props:O.props,type:O.type,oneTime:O.oneTime,onlyHaveNoChoice:O.onlyHaveNoChoice,autoSelect:O.autoSelect}});narration.choices=h;}else narration.choices=void 0;c!==void 0&&(narration.dialogue=c,this.skipEmptyDialogs&&typeof c=="string"&&(c===""||RegExp(/^\s+$/).test(c))&&(v=true)),y?narration.dialogGlue=true:y===false&&(narration.dialogGlue=false);for(let h of x){let O=h.label;typeof O=="object"&&(O=d.getLogichValue(O,t)||"");let A=h.params?.map(S=>d.getLogichValue(S,t));t={...t,...h.props},h.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${Re}${narration.openedLabels.length}`,A),await narration.call(O,t)):(storage.setTempVariable(`${Re}${narration.openedLabels.length}`,A),await narration.call(O,t));}b==="game_end"?(narration.closeAllLabels(),await narration.continue(t,{runNow:true})):b==="label_end"&&narration.closeCurrentLabel(),v&&await narration.continue(t,{runNow:true});}}};async function ye(e,t={}){if(!Array.isArray(e))if(typeof e=="object"||typeof e=="string")e=[e];else {_.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let i=e.map(l=>{if(typeof l=="string")try{return JSON.parse(l)}catch(g){return _.error("Error parsing imported Pixi'VN JSON",g),{}}return l}),r=i.map(async l=>{if(l.initialOperations)for(let g of l.initialOperations)g.type==="value"&&(typeof g.value!="object"||!g.value||!("type"in g.value))&&$e(g);return Promise.resolve()});await Promise.all(r);let o=i.map(async l=>{if(l.initialOperations)for(let g of l.initialOperations)(g.type!=="value"||g.type==="value"&&typeof g.value=="object"&&g.value&&"type"in g.value)&&$e(g);if(l.labels){let g=l.labels;for(let y in g)try{let c=g[y],x=new Gt(y,c,void 0,t);RegisteredLabels.add(x);}catch(c){_.error(`Error creating JSON label ${y}`,c);}}return Promise.resolve()});await Promise.all(o);}var ve;(e=>{let t=new Set;function i(l){t.add(l);}e.add=i;function r(){t.clear();}e.clear=r;function o(l,g={}){let y=v=>he(v,g)??void 0,c=fe(l,g);if(t.size===0)return y(c);let x=y;for(let v of t){let b=x;x=h=>v(h,b)??void 0;}return x(c)}e.getLogichValue=o;})(ve||(ve={}));var we;(e=>{e.options={replaceRegex:/\[([^\]]+)\]/};let t=[],i=false,r=false;function o(x,v){t.push({fn:x,opts:v});let b=v.type??"before-translation";b==="before-translation"&&!i?(M.beforeToTranslate=h=>y(h,{type:"before-translation"}),i=true):b==="after-translation"&&!r&&(M.afterToTranslate=h=>y(h,{type:"after-translation"}),r=true);}e.add=o;function l(x){let v=t.findIndex(b=>b.fn===x);v!==-1&&t.splice(v,1);}e.remove=l;function g(){return t.map(x=>x.opts)}e.info=g;function y(x,v){let b=t.filter(h=>(h.opts.type??"before-translation")===v.type);for(let h of b)x=c(x,h.fn,h.opts.validation);return x}e.replace=y;function c(x,v,b){let h=new RegExp(e.options.replaceRegex.source,"g"),O=[...x.matchAll(h)],A=new Set,S=[];for(let P of O)A.has(P[1])||(A.add(P[1]),S.push(P[1]));for(let P of S){if(b==="characterId"){if(!RegisteredCharacters.has(P))continue}else if(b!=="all"){if(b instanceof RegExp){if(!b.test(P))continue}else if(b instanceof ZodType&&!b.safeParse(P).success)continue}let C=v(P);C!==void 0&&(x=x.replaceAll(`[${P}]`,C));}return x}})(we||(we={}));function xe(){d.init({animateOperation:Ce,canvasElementOperation:Le,effectOperation:je,imageContainerOperation:Te,imageOperation:Pe,textOperation:Ne,narrationOperation:Ee,loadAssets:Ae,soundOperation:_e,videoOperation:Se,setStorageValue:ze,setInitialStorageValue:Ie,getLogichValue:ve.getLogichValue,getConditionalStep:le});}var De="\xA7SPACE\xA7",Fe="\xA7DOUBLE_QUOTES\xA7",Ue="\xA7QUOTES\xA7",qe="SPECIAL_\xA7QUOTES\xA7",Ke="\xA7CURLY_BRACKETS1\xA7",Qe="\xA7CURLY_BRACKETS2\xA7",m;(s=>{let e$1=[],t=[];async function i(n,p){for(let u=0;u<e$1.length;u++)try{let{validation:f}=e$1[u].opts;if(f instanceof RegExp){if(!f.test(n.join(" ")))continue}else if(f instanceof ZodType&&!f.safeParse(n).success)continue;let w=await e$1[u].fn(n,p,b);if(w===!0||typeof w=="string")return w}catch{}return false}function r(n,p={name:"custom-command",validation:/^/}){e$1.push({fn:n,opts:p});}s.add=r;function o(){return [...t.map(n=>n.opts),...e$1.map(n=>n.opts)]}s.info=o;function l(n,p){t.push({fn:n,opts:p});}s.addMapper=l;function g(){e$1.length=0;}s.clear=g;function y(){t.length=0;}s.clearMappers=y;async function c(n,p,u){try{let f=x(n),w=await i(f,u);return w===!0?void 0:typeof w=="string"?(w.startsWith("#")&&(w=w.substring(1)),await s.run(w,p,u)):v(f,p)}catch(f){throw e.error("Error parsing ink hashtag-command",n),f}}s.run=c;function x(n){n=n.replaceAll('\\"',Fe),n=n.replaceAll("\\'",Ue),n=n.replaceAll("\\`",qe),n=n.replaceAll("\\{",Ke),n=n.replaceAll("\\}",Qe),n=n.replaceAll("{"," { "),n=n.replaceAll("}"," } "),n=n.replaceAll(Ke,"{"),n=n.replaceAll(Qe,"}");let p=[],u,f="";for(let w=0;w<n.length;w++){let E=n[w];E==='"'||E==="'"||E==="`"?u===void 0?(p.push(f),f="",u=E,f+=E):u===E?(u=void 0,f+=E,p.push(f),f=""):f+=E:f+=E;}return f!==""&&p.push(f),p.forEach((w,E)=>{E%2===1&&(p[E]=w.replaceAll(" ",De));}),n=p.join(""),p=n.split(" ").filter(w=>w!==""),p=p.map(w=>w.replaceAll(De," ").replaceAll(Fe,'"').replaceAll(Ue,"'").replaceAll(qe,"`")),p=h(p),p=p.map(w=>w.startsWith('"')&&w.endsWith('"')||w.startsWith("'")&&w.endsWith("'")||w.startsWith("`")&&w.endsWith("`")?w.slice(1,-1):w),p}s.convertTagTolist=x;function v(n,p){for(let u of t){let{validation:f}=u.opts,w=false;if(f instanceof RegExp?w=f.test(n.join(" ")):f instanceof ZodType&&(w=f.safeParse(n).success),w)return u.fn(n,p)}e.error("The operation is not valid",n);}s.convertOperation=v;function b(n){return S(n)}s.convertListStringToObj=b;function h(n){return O(n).tokens}s.mergeJsonBlocks=h;function O(n){let p=[],u=false;for(let f$1=0;f$1<n.length;f$1++){let w=n[f$1];if(w!=="{"){p.push(w);continue}let E=A(n,f$1);if(E===-1){p.push(w);continue}let B=O(n.slice(f$1+1,E)),X=["{",...B.tokens,"}"],te=X.join(" ");if(!B.hasInvalidMatchedBlock)try{f.parse(te),p.push(te),f$1=E;continue}catch{}u=true,p.push(...X),f$1=E;}return {tokens:p,hasInvalidMatchedBlock:u}}function A(n,p){let u=0;for(let f=p;f<n.length;f++)if(n[f]==="{")u++;else if(n[f]==="}"&&(u--,u===0))return f;return -1}function S(n){if(n.length===0)return {};if(n.length%2!==0)throw e.error("The props list must have a pair number of elements",n),new Error("The props list must have a pair number of elements");let p="{";n.forEach((u,f)=>{if(f%2===0)p+=`"${u}": `;else {switch(u){case "null":case "undefined":case "true":case "false":p+=`${u}`;break;default:C(u)?(u=P(u),p+=`"${u}"`):u.startsWith("{")&&u.endsWith("}")?p+=`${u}`:u.startsWith('"')&&u.endsWith('"')?p+=`${u}`:Number.isNaN(parseFloat(u))?p+=`"${u}"`:p+=`${u}`;}f<n.length-1&&(p+=", ");}}),p+="}";try{return f.parse(p)}catch(u){throw e.error("Error parsing ink json",p),u}}function P(n){return n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")||n.startsWith("`")&&n.endsWith("`")?n.substring(1,n.length-1):n}function C(n){return !!(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")||n.startsWith("`")&&n.endsWith("`"))}})(m||(m={}));function ei(e){m.add(e);}m.addMapper((e,t)=>{t.labelToOpen={label:e[1],type:"call"},t.goNextStep=void 0;},{name:"call",description:"Calls the label specified by the second token, then returns to the current position.",validation:a$1.tuple([a$1.literal("call"),a$1.string()])});m.addMapper((e,t)=>{t.labelToOpen={label:e[1],type:"jump"},t.goNextStep=void 0;},{name:"jump",description:"Jumps to the label specified by the second token without returning.",validation:a$1.tuple([a$1.literal("jump"),a$1.string()])});m.addMapper((e,t)=>("dialogue"in t&&delete t.dialogue,"goNextStep"in t&&delete t.goNextStep,{type:"dialogue",operationType:"clean"}),{name:"pause",description:"Clears the current dialogue and waits for user input before advancing.",validation:a$1.tuple([a$1.literal("pause")])});m.addMapper((e,t)=>{t.goNextStep=true,t.glueEnabled=false;},{name:"continue",description:"Forces the story to proceed to the next step automatically.",validation:a$1.tuple([a$1.literal("continue")])});m.addMapper(e=>({type:"video",operationType:e[0],alias:e[2]}),{name:"video-pause-resume",description:"Pauses or resumes a video canvas element identified by its alias.",validation:a$1.tuple([a$1.enum(["pause","resume"]),a$1.literal("video"),a$1.string()])});m.addMapper(e=>({type:e[1],operationType:e[0],aliases:e.slice(2)}),{name:"assets-bundle-load",description:"Loads (eagerly or lazily) a set of asset or bundle aliases.",validation:a$1.tuple([a$1.enum(["load","lazyload"]),a$1.enum(["assets","bundle"])]).rest(a$1.string())});m.addMapper(e=>({type:"all",operationType:e[0]}),{name:"all-sounds-pause-resume-stop",description:"Pauses, resumes, or stops all active sounds at once.",validation:a$1.tuple([a$1.enum(["pause","resume","stop"]),a$1.literal("all"),a$1.enum(["sounds","sound"])])});m.addMapper(e=>({type:"sound",operationType:"pause",alias:e[2]}),{name:"pause-sound",description:"Pauses the sound identified by its alias.",validation:a$1.tuple([a$1.literal("pause"),a$1.literal("sound"),a$1.string()])});m.addMapper(e=>({type:"channel",operationType:"pause",alias:e[2]}),{name:"pause-channel",description:"Pauses the audio channel identified by its alias.",validation:a$1.tuple([a$1.literal("pause"),a$1.literal("channel"),a$1.string()])});m.addMapper(e=>({type:"sound",operationType:"resume",alias:e[2]}),{name:"resume-sound",description:"Resumes the sound identified by its alias.",validation:a$1.tuple([a$1.literal("resume"),a$1.literal("sound"),a$1.string()])});m.addMapper(e=>({type:"channel",operationType:"resume",alias:e[2]}),{name:"resume-channel",description:"Resumes the audio channel identified by its alias.",validation:a$1.tuple([a$1.literal("resume"),a$1.literal("channel"),a$1.string()])});m.addMapper(e=>({type:"sound",operationType:"stop",alias:e[2]}),{name:"stop-sound",description:"Stops the sound identified by its alias.",validation:a$1.tuple([a$1.literal("stop"),a$1.literal("sound"),a$1.string()])});m.addMapper(e=>({type:"sound",operationType:"stop",alias:e[2]}),{name:"(deprecate) remove-sound",description:"Removes (stops) the sound identified by its alias.",validation:a$1.tuple([a$1.literal("remove"),a$1.literal("sound"),a$1.string()])});m.addMapper(e=>({type:"sound",operationType:"edit",alias:e[2],props:m.convertListStringToObj(e.slice(3))}),{name:"edit-sound",description:"Edits the properties of a sound identified by its alias.",validation:a$1.tuple([a$1.literal("edit"),a$1.literal("sound"),a$1.string()]).rest(a$1.string()).refine(e=>(e.length-3)%2===0)});m.addMapper(e=>{let t=e[2],i={type:"sound",operationType:"play",alias:t,url:t};return e.length>3&&(i.props=m.convertListStringToObj(e.slice(3))),i},{name:"play-sound",description:"Plays a sound using its alias as the URL, with optional key/value properties.",validation:a$1.tuple([a$1.literal("play"),a$1.literal("sound"),a$1.string()]).rest(a$1.string()).refine(e=>(e.length-3)%2===0)});m.addMapper(e=>{let t=e[2],i=e[3],r={type:"sound",operationType:"play",alias:t,url:i};return e.length>4&&(r.props=m.convertListStringToObj(e.slice(4))),r},{name:"play-sound-with-source",description:"Plays a sound with an explicit source URL and optional key/value properties.",validation:a$1.tuple([a$1.literal("play"),a$1.literal("sound"),a$1.string()]).rest(a$1.string()).refine(e=>e.length>3&&(e.length-3)%2!==0)});function Q(e){let t=[],i=0,r="";for(let o of e)o.startsWith("{")?(i++,r+=o):o.endsWith("}")&&i>0?(i--,r+=o,i===0&&(t.push(r),r="")):i>0?r+=o:t.push(o);return t}function pe(e,t){switch(e){case "dissolve":case "fade":case "movein":case "moveout":case "zoomin":case "zoomout":case "pushin":case "pushout":break;default:return}let i={type:e};if(t.length>0)try{i.props=m.convertListStringToObj(t);}catch{}return i}function Ge(e,t,i){let r,o;i.length%2===0?(r=t,o=i):(r=i[0],o=i.slice(1));let l={type:e,operationType:"show",alias:t,url:r};if(o.length>0){if(o.includes("with")&&o.length>o.indexOf("with")+1){let g=o[o.indexOf("with")+1],y=o.slice(o.indexOf("with")+2);o=o.slice(0,o.indexOf("with"));let c=pe(g,y);c!==void 0&&(l.transition=c);}o.length>0&&(l.props=m.convertListStringToObj(o));}return l}function ti(e,t){let i,r;t.length%2===0?(i=e,r=t):(i=t[0],r=t.slice(1));let o={type:"text",operationType:"show",alias:e,text:i};if(r.length>0){if(r.includes("with")&&r.length>r.indexOf("with")+1){let l=r[r.indexOf("with")+1],g=r.slice(r.indexOf("with")+2);r=r.slice(0,r.indexOf("with"));let y=pe(l,g);y!==void 0&&(o.transition=y);}r.length>0&&(o.props=m.convertListStringToObj(r));}return o}function re(e,t,i){let r={type:e,operationType:"remove",alias:t};if(i.includes("with")&&i.length>i.indexOf("with")+1){let o=i[i.indexOf("with")+1],l=i.slice(i.indexOf("with")+2),g=pe(o,l);g!==void 0&&(r.transition=g);}return r}function Oe(e$1,t){let i=c=>c.startsWith('"')&&c.endsWith('"')||c.startsWith("'")&&c.endsWith("'")||c.startsWith("`")&&c.endsWith("`")?c.substring(1,c.length-1):c,r=[],o=t.findIndex(c=>c.startsWith("[")),l=t.findIndex(c=>c.endsWith("]"));if(o===-1||l===-1){e.error("Show imagecontainer must have a list of image ulrs",t);return}if(r=t.slice(o,l+1),r.length<2){e.error("Show imagecontainer must have a list of image ulrs",t);return}r[0]==="["?r.shift():r[0]=r[0].substring(1),r[r.length-1]==="]"?r.pop():r[r.length-1]=r[r.length-1].substring(0,r[r.length-1].length-1);let g={type:"imagecontainer",operationType:"show",alias:e$1,urls:r.map(c=>i(c))},y=t.slice(l+1);if(y.length>0){if(y.includes("with")&&y.length>y.indexOf("with")+1){let c=y[y.indexOf("with")+1],x=y.slice(y.indexOf("with")+2);y=y.slice(0,y.indexOf("with"));let v=pe(c,x);v!==void 0&&(g.transition=v);}y.length>0&&(g.props=m.convertListStringToObj(y));}return g}function be(e){let t=e.slice(3),i=t.findIndex(g=>g.startsWith("[")),r=t.findIndex(g=>g.endsWith("]"));if(i===-1||r===-1||r<i)return;let o=t.slice(r+1),l=o.indexOf("with");return l===-1?{beforeWith:o,afterWith:[]}:{beforeWith:o.slice(0,l),afterWith:o.slice(l+1)}}m.addMapper(e=>({alias:e[1],type:"shake",props:m.convertListStringToObj(e.slice(2))}),{name:"shake-effect",description:"Applies shake effect to a canvas alias with optional key/value parameters.",validation:a$1.tuple([a$1.literal("shake"),a$1.string()]).rest(a$1.string()).refine(e=>(e.length-2)%2===0)});m.addMapper(e=>{let t=e.slice(2),i=t,r=[];if(t.includes("options")){let l=t.indexOf("options");i=t.slice(0,l),r=t.slice(l+1);}return {alias:e[1],type:"animate",keyframes:m.convertListStringToObj(i),options:m.convertListStringToObj(r)}},{name:"animate-effect",description:"Animates a canvas alias with keyframes and optional options section, both in key/value pairs.",validation:a$1.tuple([a$1.literal("animate"),a$1.string()]).rest(a$1.string()).refine(e=>{let t=e.slice(2),i=t.indexOf("options");if(i===-1)return t.length%2===0;if(t.lastIndexOf("options")!==i)return false;let r=t.slice(0,i),o=t.slice(i+1);return r.length%2===0&&o.length%2===0})});m.addMapper(e=>{let t=e[2],i=Q(e.slice(3));return Ge("image",t,i)},{name:"show-image",description:"Shows an image canvas element with optional source, properties, and transition.",validation:a$1.tuple([a$1.literal("show"),a$1.literal("image"),a$1.string()]).rest(a$1.string())});m.addMapper(e=>Oe(e[2],Q(e.slice(3))),{name:"show-imagecontainer",description:"Shows an image-container canvas element with list and optional key/value properties.",validation:a$1.tuple([a$1.literal("show"),a$1.literal("imagecontainer"),a$1.string()]).rest(a$1.string()).refine(e=>{let t=be(e);return t===void 0?false:t.afterWith.length===0&&t.beforeWith.length%2===0})});m.addMapper(e=>Oe(e[2],Q(e.slice(3))),{name:"show-imagecontainer-with-transition",description:"Shows an image-container canvas element with list, optional properties, and transition.",validation:a$1.tuple([a$1.literal("show"),a$1.literal("imagecontainer"),a$1.string()]).rest(a$1.string()).refine(e=>{let t=be(e);return t===void 0?false:t.afterWith.length===1&&t.beforeWith.length%2===0})});m.addMapper(e=>Oe(e[2],Q(e.slice(3))),{name:"show-imagecontainer-with-transition-props",description:"Shows an image-container canvas element with list, optional properties, transition, and transition properties.",validation:a$1.tuple([a$1.literal("show"),a$1.literal("imagecontainer"),a$1.string()]).rest(a$1.string()).refine(e=>{let t=be(e);return t===void 0?false:t.afterWith.length>1&&(t.afterWith.length-1)%2===0&&t.beforeWith.length%2===0})});m.addMapper(e=>{let t=e[2],i=Q(e.slice(3));return Ge("video",t,i)},{name:"show-video",description:"Shows a video canvas element with optional source, properties, and transition.",validation:a$1.tuple([a$1.literal("show"),a$1.literal("video"),a$1.string()]).rest(a$1.string())});m.addMapper(e=>{let t=e[2];return ti(t,e.slice(3))},{name:"show-text",description:"Shows a text canvas element with optional text, properties, and transition.",validation:a$1.tuple([a$1.literal("show"),a$1.literal("text"),a$1.string()]).rest(a$1.string())});m.addMapper(e=>{let t=e[2],i=Q(e.slice(3));return re("image",t,i)},{name:"remove-image",description:"Removes an image canvas element with optional source/properties and transition.",validation:a$1.tuple([a$1.literal("remove"),a$1.literal("image"),a$1.string()]).rest(a$1.string())});m.addMapper(e=>{let t=e[2],i=Q(e.slice(3));return re("video",t,i)},{name:"remove-video",description:"Removes a video canvas element with optional source/properties and transition.",validation:a$1.tuple([a$1.literal("remove"),a$1.literal("video"),a$1.string()]).rest(a$1.string())});m.addMapper(e=>{let t=e[2],i=Q(e.slice(3));return re("canvaselement",t,i)},{name:"remove-canvaselement",description:"Removes a canvas element with optional properties and optional transition params.",validation:a$1.tuple([a$1.literal("remove"),a$1.literal("canvaselement"),a$1.string()]).rest(a$1.string())});m.addMapper(e=>{let t=e[2],i=Q(e.slice(3));return re("text",t,i)},{name:"remove-text",description:"Removes a text canvas element with optional properties and transition.",validation:a$1.tuple([a$1.literal("remove"),a$1.literal("text"),a$1.string()]).rest(a$1.string())});m.addMapper(e=>{let t=e[2],i=Q(e.slice(3));return re("imagecontainer",t,i)},{name:"remove-imagecontainer",description:"Removes an image-container canvas element with optional properties and transition.",validation:a$1.tuple([a$1.literal("remove"),a$1.literal("imagecontainer"),a$1.string()]).rest(a$1.string())});m.addMapper(e=>({type:"image",operationType:"edit",alias:e[2],props:m.convertListStringToObj(e.slice(3))}),{name:"edit-image",description:"Edits the properties of an image canvas element identified by its alias.",validation:a$1.tuple([a$1.literal("edit"),a$1.literal("image"),a$1.string()]).rest(a$1.string())});m.addMapper(e=>({type:"imagecontainer",operationType:"edit",alias:e[2],props:m.convertListStringToObj(e.slice(3))}),{name:"edit-imagecontainer",description:"Edits the properties of an image-container canvas element identified by its alias.",validation:a$1.tuple([a$1.literal("edit"),a$1.literal("imagecontainer"),a$1.string()]).rest(a$1.string())});m.addMapper(e=>({type:"canvaselement",operationType:"edit",alias:e[2],props:m.convertListStringToObj(e.slice(3))}),{name:"edit-canvaselement",description:"Edits the properties of a canvas element identified by its alias.",validation:a$1.tuple([a$1.literal("edit"),a$1.literal("canvaselement"),a$1.string()]).rest(a$1.string())});m.addMapper(e=>({type:"video",operationType:"edit",alias:e[2],props:m.convertListStringToObj(e.slice(3))}),{name:"edit-video",description:"Edits the properties of a video canvas element identified by its alias.",validation:a$1.tuple([a$1.literal("edit"),a$1.literal("video"),a$1.string()]).rest(a$1.string())});m.addMapper(e=>({type:"text",operationType:"edit",alias:e[2],props:m.convertListStringToObj(e.slice(3))}),{name:"edit-text",description:"Edits the properties of a text canvas element identified by its alias.",validation:a$1.tuple([a$1.literal("edit"),a$1.literal("text"),a$1.string()]).rest(a$1.string())});m.addMapper(e=>({type:"input",operationType:"request"}),{name:"request-input",description:"Requests player input without any additional constraints.",validation:a$1.tuple([a$1.literal("request"),a$1.literal("input")])});m.addMapper(e=>{let t={type:"input",operationType:"request"};try{let i=m.convertListStringToObj(e.slice(2));"type"in i&&typeof i.type=="string"&&(t.valueType=i.type),"default"in i&&(t.defaultValue=i.default);}catch{}return t},{name:"request-input-params",description:"Requests player input with optional key/value parameters (e.g. type, default).",validation:a$1.tuple([a$1.literal("request"),a$1.literal("input")]).rest(a$1.string()).refine(e=>e.length>2&&(e.length-2)%2===0)});async function Bi(e){Array.isArray(e)||(e=[e]),xe();let t={functions:[],enums:{}},i=e.map(async r=>{let o=h(r,t);return o&&await ye(o,{operationStringConvert:m.run,skipEmptyDialogs:true}),r});return await Promise.all(i)}async function Di(e){return xe(),await ye(e,{operationStringConvert:m.run,skipEmptyDialogs:true})}export{M as a,ve as b,we as c,m as d,ei as e,Bi as f,Di as g};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var _="/__pixi-vn-ink/hashtag-commands",n="/__pixi-vn-ink/text-replaces";export{_ as a,n as b};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {InkMapper}from'@drincs/pixi-vn-ink/mapper';import {InkCompiler}from'@drincs/pixi-vn-ink/parser';var Cu=Object.create;var H=Object.defineProperty;var Au=Object.getOwnPropertyDescriptor;var nu=Object.getOwnPropertyNames;var Eu=Object.getPrototypeOf,iu=Object.prototype.hasOwnProperty;var au=(u,e,t)=>e in u?H(u,e,{enumerable:true,configurable:true,writable:true,value:t}):u[e]=t;var Iu=(u=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(u,{get:(e,t)=>(typeof require<"u"?require:e)[t]}):u)(function(u){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+u+'" is not supported')});var ou=(u,e)=>()=>(e||u((e={exports:{}}).exports,e),e.exports);var Bu=(u,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of nu(e))!iu.call(u,a)&&a!==t&&H(u,a,{get:()=>e[a],enumerable:!(n=Au(e,a))||n.enumerable});return u};var su=(u,e,t)=>(t=u!=null?Cu(Eu(u)):{},Bu(e||!u||!u.__esModule?H(t,"default",{value:u,enumerable:true}):t,u));var Pu=(u,e,t)=>au(u,typeof e!="symbol"?e+"":e,t);var U=ou(J=>{Object.defineProperty(J,"__esModule",{value:true});J.ErrorType=void 0;var G;(function(u){u[u.Author=0]="Author",u[u.Warning=1]="Warning",u[u.Error=2]="Error";})(G||(J.ErrorType=G={}));});var x;(a=>(a.log=(i,...f)=>console.log(`[Pixi\u2019VN Ink] ${i}`,...f),a.warn=(i,...f)=>console.warn(`[Pixi\u2019VN Ink] ${i}`,...f),a.error=(i,...f)=>console.error(`[Pixi\u2019VN Ink] ${i}`,...f),a.info=(i,...f)=>console.info(`[Pixi\u2019VN Ink] ${i}`,...f)))(x||(x={}));var Q=su(U(),1);var cu=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,fu=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]/,lu=/[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u08D4-\u08E1\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u09FC\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9-\u0AFF\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C80-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D00-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D54-\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19D9\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1CD0-\u1CD2\u1CD4-\u1CF9\u1D00-\u1DF9\u1DFB-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u2E2F\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099\u309A\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C5\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF2D-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE3E\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC00-\uDC4A\uDC50-\uDC59\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDE00-\uDE3E\uDE47\uDE50-\uDE83\uDE86-\uDE99\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC36\uDC38-\uDC40\uDC50-\uDC59\uDC72-\uDC8F\uDC92-\uDCA7\uDCA9-\uDCB6\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD36\uDD3A\uDD3C\uDD3D\uDD3F-\uDD47\uDD50-\uDD59]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD838[\uDC00-\uDC06\uDC08-\uDC18\uDC1B-\uDC21\uDC23\uDC24\uDC26-\uDC2A]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6\uDD00-\uDD4A\uDD50-\uDD59]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/,q={Space_Separator:cu,ID_Start:fu,ID_Continue:lu},c={isSpaceSeparator(u){return typeof u=="string"&&q.Space_Separator.test(u)},isIdStartChar(u){return typeof u=="string"&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||u==="$"||u==="_"||q.ID_Start.test(u))},isIdContinueChar(u){return typeof u=="string"&&(u>="a"&&u<="z"||u>="A"&&u<="Z"||u>="0"&&u<="9"||u==="$"||u==="_"||u==="\u200C"||u==="\u200D"||q.ID_Continue.test(u))},isDigit(u){return typeof u=="string"&&/[0-9]/.test(u)},isHexDigit(u){return typeof u=="string"&&/[0-9A-Fa-f]/.test(u)}},R,y,w,L,N,g,d,K,V,pu=function(e,t){R=String(e),y="start",w=[],L=0,N=1,g=0,d=void 0,K=void 0,V=void 0;do d=du(),yu[y]();while(d.type!=="eof");return typeof t=="function"?W({"":V},"",t):V};function W(u,e,t){let n=u[e];if(n!=null&&typeof n=="object")if(Array.isArray(n))for(let a=0;a<n.length;a++){let i=String(a),f=W(n,i,t);f===void 0?delete n[i]:Object.defineProperty(n,i,{value:f,writable:true,enumerable:true,configurable:true});}else for(let a in n){let i=W(n,a,t);i===void 0?delete n[a]:Object.defineProperty(n,a,{value:i,writable:true,enumerable:true,configurable:true});}return t.call(u,e,n)}var C,r,$,b,A;function du(){for(C="default",r="",$=false,b=1;;){A=S();let u=uu[C]();if(u)return u}}function S(){if(R[L])return String.fromCodePoint(R.codePointAt(L))}function D(){let u=S();return u===`
|
|
2
|
+
`?(N++,g=0):u?g+=u.length:g++,u&&(L+=u.length),u}var uu={default(){switch(A){case " ":case "\v":case "\f":case " ":case "\xA0":case "\uFEFF":case `
|
|
3
|
+
`:case "\r":case "\u2028":case "\u2029":D();return;case "/":D(),C="comment";return;case void 0:return D(),o("eof")}if(c.isSpaceSeparator(A)){D();return}return uu[y]()},comment(){switch(A){case "*":D(),C="multiLineComment";return;case "/":D(),C="singleLineComment";return}throw B(D())},multiLineComment(){switch(A){case "*":D(),C="multiLineCommentAsterisk";return;case void 0:throw B(D())}D();},multiLineCommentAsterisk(){switch(A){case "*":D();return;case "/":D(),C="default";return;case void 0:throw B(D())}D(),C="multiLineComment";},singleLineComment(){switch(A){case `
|
|
4
|
+
`:case "\r":case "\u2028":case "\u2029":D(),C="default";return;case void 0:return D(),o("eof")}D();},value(){switch(A){case "{":case "[":return o("punctuator",D());case "n":return D(),P("ull"),o("null",null);case "t":return D(),P("rue"),o("boolean",true);case "f":return D(),P("alse"),o("boolean",false);case "-":case "+":D()==="-"&&(b=-1),C="sign";return;case ".":r=D(),C="decimalPointLeading";return;case "0":r=D(),C="zero";return;case "1":case "2":case "3":case "4":case "5":case "6":case "7":case "8":case "9":r=D(),C="decimalInteger";return;case "I":return D(),P("nfinity"),o("numeric",1/0);case "N":return D(),P("aN"),o("numeric",NaN);case '"':case "'":$=D()==='"',r="",C="string";return}throw B(D())},identifierNameStartEscape(){if(A!=="u")throw B(D());D();let u=Z();switch(u){case "$":case "_":break;default:if(!c.isIdStartChar(u))throw Y();break}r+=u,C="identifierName";},identifierName(){switch(A){case "$":case "_":case "\u200C":case "\u200D":r+=D();return;case "\\":D(),C="identifierNameEscape";return}if(c.isIdContinueChar(A)){r+=D();return}return o("identifier",r)},identifierNameEscape(){if(A!=="u")throw B(D());D();let u=Z();switch(u){case "$":case "_":case "\u200C":case "\u200D":break;default:if(!c.isIdContinueChar(u))throw Y();break}r+=u,C="identifierName";},sign(){switch(A){case ".":r=D(),C="decimalPointLeading";return;case "0":r=D(),C="zero";return;case "1":case "2":case "3":case "4":case "5":case "6":case "7":case "8":case "9":r=D(),C="decimalInteger";return;case "I":return D(),P("nfinity"),o("numeric",b*(1/0));case "N":return D(),P("aN"),o("numeric",NaN)}throw B(D())},zero(){switch(A){case ".":r+=D(),C="decimalPoint";return;case "e":case "E":r+=D(),C="decimalExponent";return;case "x":case "X":r+=D(),C="hexadecimal";return}return o("numeric",b*0)},decimalInteger(){switch(A){case ".":r+=D(),C="decimalPoint";return;case "e":case "E":r+=D(),C="decimalExponent";return}if(c.isDigit(A)){r+=D();return}return o("numeric",b*Number(r))},decimalPointLeading(){if(c.isDigit(A)){r+=D(),C="decimalFraction";return}throw B(D())},decimalPoint(){switch(A){case "e":case "E":r+=D(),C="decimalExponent";return}if(c.isDigit(A)){r+=D(),C="decimalFraction";return}return o("numeric",b*Number(r))},decimalFraction(){switch(A){case "e":case "E":r+=D(),C="decimalExponent";return}if(c.isDigit(A)){r+=D();return}return o("numeric",b*Number(r))},decimalExponent(){switch(A){case "+":case "-":r+=D(),C="decimalExponentSign";return}if(c.isDigit(A)){r+=D(),C="decimalExponentInteger";return}throw B(D())},decimalExponentSign(){if(c.isDigit(A)){r+=D(),C="decimalExponentInteger";return}throw B(D())},decimalExponentInteger(){if(c.isDigit(A)){r+=D();return}return o("numeric",b*Number(r))},hexadecimal(){if(c.isHexDigit(A)){r+=D(),C="hexadecimalInteger";return}throw B(D())},hexadecimalInteger(){if(c.isHexDigit(A)){r+=D();return}return o("numeric",b*Number(r))},string(){switch(A){case "\\":D(),r+=mu();return;case '"':if($)return D(),o("string",r);r+=D();return;case "'":if(!$)return D(),o("string",r);r+=D();return;case `
|
|
5
|
+
`:case "\r":throw B(D());case "\u2028":case "\u2029":gu(A);break;case void 0:throw B(D())}r+=D();},start(){switch(A){case "{":case "[":return o("punctuator",D())}C="value";},beforePropertyName(){switch(A){case "$":case "_":r=D(),C="identifierName";return;case "\\":D(),C="identifierNameStartEscape";return;case "}":return o("punctuator",D());case '"':case "'":$=D()==='"',C="string";return}if(c.isIdStartChar(A)){r+=D(),C="identifierName";return}throw B(D())},afterPropertyName(){if(A===":")return o("punctuator",D());throw B(D())},beforePropertyValue(){C="value";},afterPropertyValue(){switch(A){case ",":case "}":return o("punctuator",D())}throw B(D())},beforeArrayValue(){if(A==="]")return o("punctuator",D());C="value";},afterArrayValue(){switch(A){case ",":case "]":return o("punctuator",D())}throw B(D())},end(){throw B(D())}};function o(u,e){return {type:u,value:e,line:N,column:g}}function P(u){for(let e of u){if(S()!==e)throw B(D());D();}}function mu(){switch(S()){case "b":return D(),"\b";case "f":return D(),"\f";case "n":return D(),`
|
|
6
|
+
`;case "r":return D(),"\r";case "t":return D()," ";case "v":return D(),"\v";case "0":if(D(),c.isDigit(S()))throw B(D());return "\0";case "x":return D(),hu();case "u":return D(),Z();case `
|
|
7
|
+
`:case "\u2028":case "\u2029":return D(),"";case "\r":return D(),S()===`
|
|
8
|
+
`&&D(),"";case "1":case "2":case "3":case "4":case "5":case "6":case "7":case "8":case "9":throw B(D());case void 0:throw B(D())}return D()}function hu(){let u="",e=S();if(!c.isHexDigit(e)||(u+=D(),e=S(),!c.isHexDigit(e)))throw B(D());return u+=D(),String.fromCodePoint(parseInt(u,16))}function Z(){let u="",e=4;for(;e-- >0;){let t=S();if(!c.isHexDigit(t))throw B(D());u+=D();}return String.fromCodePoint(parseInt(u,16))}var yu={start(){if(d.type==="eof")throw v();M();},beforePropertyName(){switch(d.type){case "identifier":case "string":K=d.value,y="afterPropertyName";return;case "punctuator":_();return;case "eof":throw v()}},afterPropertyName(){if(d.type==="eof")throw v();y="beforePropertyValue";},beforePropertyValue(){if(d.type==="eof")throw v();M();},beforeArrayValue(){if(d.type==="eof")throw v();if(d.type==="punctuator"&&d.value==="]"){_();return}M();},afterPropertyValue(){if(d.type==="eof")throw v();switch(d.value){case ",":y="beforePropertyName";return;case "}":_();}},afterArrayValue(){if(d.type==="eof")throw v();switch(d.value){case ",":y="beforeArrayValue";return;case "]":_();}},end(){}};function M(){let u;switch(d.type){case "punctuator":switch(d.value){case "{":u={};break;case "[":u=[];break}break;case "null":case "boolean":case "numeric":case "string":u=d.value;break}if(V===void 0)V=u;else {let e=w[w.length-1];Array.isArray(e)?e.push(u):Object.defineProperty(e,K,{value:u,writable:true,enumerable:true,configurable:true});}if(u!==null&&typeof u=="object")w.push(u),Array.isArray(u)?y="beforeArrayValue":y="beforePropertyName";else {let e=w[w.length-1];e==null?y="end":Array.isArray(e)?y="afterArrayValue":y="afterPropertyValue";}}function _(){w.pop();let u=w[w.length-1];u==null?y="end":Array.isArray(u)?y="afterArrayValue":y="afterPropertyValue";}function B(u){return T(u===void 0?`JSON5: invalid end of input at ${N}:${g}`:`JSON5: invalid character '${Du(u)}' at ${N}:${g}`)}function v(){return T(`JSON5: invalid end of input at ${N}:${g}`)}function Y(){return g-=5,T(`JSON5: invalid identifier character at ${N}:${g}`)}function gu(u){console.warn(`JSON5: '${Du(u)}' in strings is not valid ECMAScript; consider escaping`);}function Du(u){let e={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(e[u])return e[u];if(u<" "){let t=u.charCodeAt(0).toString(16);return "\\x"+("00"+t).substring(t.length)}return u}function T(u){let e=new SyntaxError(u);return e.lineNumber=N,e.columnNumber=g,e}var bu=function(e,t,n){let a=[],i="",f,k,I="",X;if(t!=null&&typeof t=="object"&&!Array.isArray(t)&&(n=t.space,X=t.quote,t=t.replacer),typeof t=="function")k=t;else if(Array.isArray(t)){f=[];for(let E of t){let s;typeof E=="string"?s=E:(typeof E=="number"||E instanceof String||E instanceof Number)&&(s=String(E)),s!==void 0&&f.indexOf(s)<0&&f.push(s);}}return n instanceof Number?n=Number(n):n instanceof String&&(n=String(n)),typeof n=="number"?n>0&&(n=Math.min(10,Math.floor(n)),I=" ".substr(0,n)):typeof n=="string"&&(I=n.substr(0,10)),z("",{"":e});function z(E,s){let F=s[E];switch(F!=null&&(typeof F.toJSON5=="function"?F=F.toJSON5(E):typeof F.toJSON=="function"&&(F=F.toJSON(E))),k&&(F=k.call(s,E,F)),F instanceof Number?F=Number(F):F instanceof String?F=String(F):F instanceof Boolean&&(F=F.valueOf()),F){case null:return "null";case true:return "true";case false:return "false"}if(typeof F=="string")return j(F);if(typeof F=="number")return String(F);if(typeof F=="object")return Array.isArray(F)?Fu(F):ru(F)}function j(E){let s={"'":.1,'"':.2},F={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},p="";for(let l=0;l<E.length;l++){let h=E[l];switch(h){case "'":case '"':s[h]++,p+=h;continue;case "\0":if(c.isDigit(E[l+1])){p+="\\x00";continue}}if(F[h]){p+=F[h];continue}if(h<" "){let O=h.charCodeAt(0).toString(16);p+="\\x"+("00"+O).substring(O.length);continue}p+=h;}let m=X||Object.keys(s).reduce((l,h)=>s[l]<s[h]?l:h);return p=p.replace(new RegExp(m,"g"),F[m]),m+p+m}function ru(E){if(a.indexOf(E)>=0)throw TypeError("Converting circular structure to JSON5");a.push(E);let s=i;i=i+I;let F=f||Object.keys(E),p=[];for(let l of F){let h=z(l,E);if(h!==void 0){let O=tu(l)+":";I!==""&&(O+=" "),O+=h,p.push(O);}}let m;if(p.length===0)m="{}";else {let l;if(I==="")l=p.join(","),m="{"+l+"}";else {let h=`,
|
|
9
|
+
`+i;l=p.join(h),m=`{
|
|
10
|
+
`+i+l+`,
|
|
11
|
+
`+s+"}";}}return a.pop(),i=s,m}function tu(E){if(E.length===0)return j(E);let s=String.fromCodePoint(E.codePointAt(0));if(!c.isIdStartChar(s))return j(E);for(let F=s.length;F<E.length;F++)if(!c.isIdContinueChar(String.fromCodePoint(E.codePointAt(F))))return j(E);return E}function Fu(E){if(a.indexOf(E)>=0)throw TypeError("Converting circular structure to JSON5");a.push(E);let s=i;i=i+I;let F=[];for(let m=0;m<E.length;m++){let l=z(String(m),E);F.push(l!==void 0?l:"null");}let p;if(F.length===0)p="[]";else if(I==="")p="["+F.join(",")+"]";else {let m=`,
|
|
12
|
+
`+i,l=F.join(m);p=`[
|
|
13
|
+
`+i+l+`,
|
|
14
|
+
`+s+"]";}return a.pop(),i=s,p}},wu={parse:pu,stringify:bu},Su=wu,eu=Su;function Lu(u,e={}){let t={labelToRemove:[],initialVarsToRemove:[],functions:e.functions||[],enums:e.enums||{},textSource:u},{json:n,issues:a}=InkCompiler.compile(u,t);if(a.forEach(({message:f,type:k})=>{k===Q.ErrorType.Error?x.error(`Ink compilation error: ${f}`):k===Q.ErrorType.Warning?x.warn(`Ink compilation warning: ${f}`):x.info(`Ink compilation info: ${f}`);}),!n){x.error("No JSON generated from ink file");return}let i;try{i=eu.parse(n);}catch{x.error("Error parsing ink file");return}return t.enums=i.listDefs||{},InkMapper.inkToJson(i,t)}export{Iu as a,ou as b,su as c,Pu as d,x as e,eu as f,U as g,Lu as h};
|