@drincs/pixi-vn-ink 0.12.2 → 0.12.3

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.
@@ -0,0 +1,18 @@
1
+ import {a,c,b,e,d,f as f$1}from'./chunk-M7O5Q75X.mjs';import {PixiError,createExportableElement}from'@drincs/pixi-vn';import {RegisteredLabels,narration,NarrationManagerStatic,LabelAbstract}from'@drincs/pixi-vn/narration';import {storage}from'@drincs/pixi-vn/storage';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 {sound}from'@drincs/pixi-vn/sound';import {RegisteredCharacters}from'@drincs/pixi-vn/characters';var qt=Object.defineProperty,Ut=(e,t,u)=>t in e?qt(e,t,{enumerable:true,configurable:true,writable:true,value:u}):e[t]=u,Y=(e,t,u)=>Ut(e,typeof t!="symbol"?t+"":t,u),W;(e=>(e.log=(t,...u)=>console.log(`[Pixi\u2019VN Json] ${t}`,...u),e.warn=(t,...u)=>console.warn(`[Pixi\u2019VN Json] ${t}`,...u),e.error=(t,...u)=>console.error(`[Pixi\u2019VN Json] ${t}`,...u),e.info=(t,...u)=>console.info(`[Pixi\u2019VN Json] ${t}`,...u)))(W||(W={}));var M=class O{static init(t){t.loadAssets&&(O._loadAssets=t.loadAssets),t.soundOperation&&(O._soundOperation=t.soundOperation),t.imageOperation&&(O._imageOperation=t.imageOperation),t.videoOperation&&(O._videoOperation=t.videoOperation),t.imageContainerOperation&&(O._imageContainerOperation=t.imageContainerOperation),t.textOperation&&(O._textOperation=t.textOperation),t.canvasElementOperation&&(O._canvasElementOperation=t.canvasElementOperation),t.setStorageValue&&(O._setStorageValue=t.setStorageValue),t.setInitialStorageValue&&(O._setInitialStorageValue=t.setInitialStorageValue),t.narrationOperation&&(O._narrationOperation=t.narrationOperation),t.effectOperation&&(O._effectOperation=t.effectOperation),t.animateOperation&&(O._animateOperation=t.animateOperation),t.getLogichValue&&(O._getLogichValue=t.getLogichValue),t.getConditionalStep&&(O._getConditionalStep=t.getConditionalStep);}static get loadAssets(){return O._loadAssets}static get soundOperation(){return O._soundOperation}static get imageOperation(){return O._imageOperation}static get videoOperation(){return O._videoOperation}static get textOperation(){return O._textOperation}static get imageContainerOperation(){return O._imageContainerOperation}static get canvasElementOperation(){return O._canvasElementOperation}static get setStorageValue(){return O._setStorageValue}static get setInitialStorageValue(){return O._setInitialStorageValue}static get narrationOperation(){return O._narrationOperation}static get effectOperation(){return O._effectOperation}static get animateOperation(){return O._animateOperation}static get getLogichValue(){return O._getLogichValue}static get getConditionalStep(){return O._getConditionalStep}};Y(M,"_loadAssets",()=>{}),Y(M,"_soundOperation",()=>{throw W.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.")}),Y(M,"_imageOperation",()=>{throw W.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.")}),Y(M,"_videoOperation",()=>{throw W.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.")}),Y(M,"_imageContainerOperation",()=>{throw W.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.")}),Y(M,"_textOperation",()=>{throw W.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.")}),Y(M,"_canvasElementOperation",()=>{throw W.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.")}),Y(M,"_setStorageValue",()=>{throw W.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.")}),Y(M,"_setInitialStorageValue",()=>{throw W.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.")}),Y(M,"_narrationOperation",()=>{throw W.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.")}),Y(M,"_effectOperation",()=>{throw W.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.")}),Y(M,"_animateOperation",()=>{throw W.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.")}),Y(M,"_getLogichValue",()=>{throw W.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.")}),Y(M,"_getConditionalStep",()=>{throw W.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 x=M;var Yt=Object.defineProperty,Qt=(e,t,u)=>t in e?Yt(e,t,{enumerable:true,configurable:true,writable:true,value:u}):e[t]=u,Me=(e,t,u)=>Qt(e,typeof t!="symbol"?t+"":t,u);function Xt(e){let t="";return e.values.forEach(u=>{if(typeof u=="string")t+=u;else {let r=x.getLogichValue(u);t+=`${r}`;}}),t}var Ve=class S{static t(t){return Array.isArray(t)?t.map(u=>S.translate(`${u}`)):S.translate(`${t}`)}static set beforeToTranslate(t){S._beforeToTranslate=t;}static set translate(t){S._translate=t;}static get translate(){return t=>{let u=t;return S._beforeToTranslate&&(u=S._beforeToTranslate(u)),u=S._translate(u),S._afterToTranslate&&(u=S._afterToTranslate(u)),u}}static set afterToTranslate(t){S._afterToTranslate=t;}static addKey(t,u,r){let i=r.defaultValue||"empty_string";typeof u=="string"&&(u=[u]),Array.isArray(u)&&u.forEach(o=>{t[o]===void 0&&(i==="empty_string"?t[o]="":i==="copy_key"&&(S._beforeToTranslate?t[o]=S._beforeToTranslate(o):t[o]=o));});}static getConditionalsThenElse(t,u=[]){if(typeof t=="object"&&t&&"type"in t)if(t.type==="ifelse")t.then&&S.getConditionalsThenElse(t.then,u),t.else&&S.getConditionalsThenElse(t.else,u);else if(t.type==="stepswitch"){if(t.elements)if(Array.isArray(t.elements))t.elements.forEach(r=>{S.getConditionalsThenElse(r,u);});else if(t.elements.type==="ifelse"){let r=[];S.getConditionalsThenElse(t.elements,r),r.forEach(i=>{u.push(...i);});}else if(t.elements.type==="stepswitch"){let r=[];S.getConditionalsThenElse(t.elements,r),r.forEach(i=>{u.push(...i);});}else S.getConditionalsThenElse(t.elements,u);}else t.type==="resulttocombine"?(t.firstItem&&S.getConditionalsThenElse(t.firstItem,u),t.secondConditionalItem&&t.secondConditionalItem.forEach(r=>{S.getConditionalsThenElse(r,u);})):u.push(t);else t&&u.push(t);return u}static async generateJsonTranslation(t,u={},r={}){let{defaultValue:i="copy_key",operationStringConvert:o}=r,h=t.map(async E=>{if(E.choices){let p=[];Array.isArray(E.choices)?p=[E.choices]:p=S.getConditionalsThenElse(E.choices),p.forEach(g=>g.forEach(D=>{if("type"in D){let F=[];D.type==="ifelse"||D.type==="stepswitch"?S.getConditionalsThenElse(D,F):F=[D],F.map(d=>S.getConditionalsThenElse(d.text)).forEach(d=>{Array.isArray(d)&&d.forEach(y=>{Array.isArray(y)?y.forEach(B=>{typeof B=="string"?S.addKey(u,B,{defaultValue:i}):S.getConditionalsThenElse(B).forEach(C=>{Array.isArray(C)?C.forEach(m=>{typeof m=="string"&&S.addKey(u,m,{defaultValue:i});}):typeof C=="string"&&S.addKey(u,C,{defaultValue:i});});}):typeof y=="string"&&S.addKey(u,y,{defaultValue:i});});});}}));}if(E.dialogue){let p=[];Array.isArray(E.dialogue)?p=[E.dialogue]:p=S.getConditionalsThenElse(E.dialogue),p.forEach(g=>{if(typeof g=="string")S.addKey(u,g,{defaultValue:i});else if("text"in g){let D=S.getConditionalsThenElse(g.text);typeof D=="string"&&(D=[D]),D.forEach(F=>{typeof F=="string"?S.addKey(u,F,{defaultValue:i}):S.getConditionalsThenElse(F).forEach(d=>{typeof d=="string"?S.addKey(u,d,{defaultValue:i}):Array.isArray(d)&&d.forEach(y=>{typeof y=="string"?S.addKey(u,y,{defaultValue:i}):S.getConditionalsThenElse(y).forEach(B=>{typeof B=="string"&&S.addKey(u,B,{defaultValue:i});});});});});}});}if(E.operations)for(let p of E.operations){if(p.type==="operationtoconvert"&&o){let g=Xt(p),D=await o(g,E,{});if(!D)return;p=D;}p.type==="text"&&p.operationType==="show"&&S.addKey(u,p.text,{defaultValue:i});}E.conditionalStep&&S.getConditionalsThenElse(E.conditionalStep).forEach(p=>{Array.isArray(p)?S.generateJsonTranslation(p,u,r):S.generateJsonTranslation([p],u,r);});});return await Promise.all(h),u}};Me(Ve,"_beforeToTranslate"),Me(Ve,"_translate",e=>e),Me(Ve,"_afterToTranslate");var Zt=Ve,$=Zt;var uu=Object.create,Ge=Object.defineProperty,nu=Object.getOwnPropertyDescriptor,ru=Object.getOwnPropertyNames,iu=Object.getPrototypeOf,ou=Object.prototype.hasOwnProperty,au=(e,t,u)=>t in e?Ge(e,t,{enumerable:true,configurable:true,writable:true,value:u}):e[t]=u,Ct=(e=>typeof a<"u"?a:typeof Proxy<"u"?new Proxy(e,{get:(t,u)=>(typeof a<"u"?a:t)[u]}):e)(function(e){if(typeof a<"u")return a.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')}),Et=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),su=(e,t,u,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ru(t))!ou.call(e,i)&&i!==u&&Ge(e,i,{get:()=>t[i],enumerable:!(r=nu(t,i))||r.enumerable});return e},lu=(e,t,u)=>(u=e!=null?uu(iu(e)):{},su(Ge(u,"default",{value:e,enumerable:true}),e)),We=(e,t,u)=>au(e,typeof t!="symbol"?t+"":t,u),pu=Et((e,t)=>{(function(u,r){typeof e=="object"?t.exports=e=r():typeof define=="function"&&define.amd?define([],r):u.CryptoJS=r();})(e,function(){var u=u||(function(r,i){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof global<"u"&&global.crypto&&(o=global.crypto),!o&&typeof Ct=="function")try{o=Ct("crypto");}catch{}var h=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},E=Object.create||(function(){function c(){}return function(n){var s;return c.prototype=n,s=new c,c.prototype=null,s}})(),p={},g=p.lib={},D=g.Base=(function(){return {extend:function(c){var n=E(this);return c&&n.mixIn(c),(!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 c=this.extend();return c.init.apply(c,arguments),c},init:function(){},mixIn:function(c){for(var n in c)c.hasOwnProperty(n)&&(this[n]=c[n]);c.hasOwnProperty("toString")&&(this.toString=c.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),F=g.WordArray=D.extend({init:function(c,n){c=this.words=c||[],n!=i?this.sigBytes=n:this.sigBytes=c.length*4;},toString:function(c){return (c||y).stringify(this)},concat:function(c){var n=this.words,s=c.words,a=this.sigBytes,l=c.sigBytes;if(this.clamp(),a%4)for(var b=0;b<l;b++){var P=s[b>>>2]>>>24-b%4*8&255;n[a+b>>>2]|=P<<24-(a+b)%4*8;}else for(var _=0;_<l;_+=4)n[a+_>>>2]=s[_>>>2];return this.sigBytes+=l,this},clamp:function(){var c=this.words,n=this.sigBytes;c[n>>>2]&=4294967295<<32-n%4*8,c.length=r.ceil(n/4);},clone:function(){var c=D.clone.call(this);return c.words=this.words.slice(0),c},random:function(c){for(var n=[],s=0;s<c;s+=4)n.push(h());return new F.init(n,c)}}),d=p.enc={},y=d.Hex={stringify:function(c){for(var n=c.words,s=c.sigBytes,a=[],l=0;l<s;l++){var b=n[l>>>2]>>>24-l%4*8&255;a.push((b>>>4).toString(16)),a.push((b&15).toString(16));}return a.join("")},parse:function(c){for(var n=c.length,s=[],a=0;a<n;a+=2)s[a>>>3]|=parseInt(c.substr(a,2),16)<<24-a%8*4;return new F.init(s,n/2)}},B=d.Latin1={stringify:function(c){for(var n=c.words,s=c.sigBytes,a=[],l=0;l<s;l++){var b=n[l>>>2]>>>24-l%4*8&255;a.push(String.fromCharCode(b));}return a.join("")},parse:function(c){for(var n=c.length,s=[],a=0;a<n;a++)s[a>>>2]|=(c.charCodeAt(a)&255)<<24-a%4*8;return new F.init(s,n)}},C=d.Utf8={stringify:function(c){try{return decodeURIComponent(escape(B.stringify(c)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(c){return B.parse(unescape(encodeURIComponent(c)))}},m=g.BufferedBlockAlgorithm=D.extend({reset:function(){this._data=new F.init,this._nDataBytes=0;},_append:function(c){typeof c=="string"&&(c=C.parse(c)),this._data.concat(c),this._nDataBytes+=c.sigBytes;},_process:function(c){var n,s=this._data,a=s.words,l=s.sigBytes,b=this.blockSize,P=b*4,_=l/P;c?_=r.ceil(_):_=r.max((_|0)-this._minBufferSize,0);var I=_*b,J=r.min(I*4,l);if(I){for(var R=0;R<I;R+=b)this._doProcessBlock(a,R);n=a.splice(0,I),s.sigBytes-=J;}return new F.init(n,J)},clone:function(){var c=D.clone.call(this);return c._data=this._data.clone(),c},_minBufferSize:0});g.Hasher=m.extend({cfg:D.extend(),init:function(c){this.cfg=this.cfg.extend(c),this.reset();},reset:function(){m.reset.call(this),this._doReset();},update:function(c){return this._append(c),this._process(),this},finalize:function(c){c&&this._append(c);var n=this._doFinalize();return n},blockSize:16,_createHelper:function(c){return function(n,s){return new c.init(s).finalize(n)}},_createHmacHelper:function(c){return function(n,s){return new A.HMAC.init(c,s).finalize(n)}}});var A=p.algo={};return p})(Math);return u});}),cu=Et((e,t)=>{(function(u,r){typeof e=="object"?t.exports=e=r(pu()):typeof define=="function"&&define.amd?define(["./core"],r):r(u.CryptoJS);})(e,function(u){return (function(){var r=u,i=r.lib,o=i.WordArray,h=i.Hasher,E=r.algo,p=[],g=E.SHA1=h.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(D,F){for(var d=this._hash.words,y=d[0],B=d[1],C=d[2],m=d[3],A=d[4],c=0;c<80;c++){if(c<16)p[c]=D[F+c]|0;else {var n=p[c-3]^p[c-8]^p[c-14]^p[c-16];p[c]=n<<1|n>>>31;}var s=(y<<5|y>>>27)+A+p[c];c<20?s+=(B&C|~B&m)+1518500249:c<40?s+=(B^C^m)+1859775393:c<60?s+=(B&C|B&m|C&m)-1894007588:s+=(B^C^m)-899497514,A=m,m=C,C=B<<30|B>>>2,B=y,y=s;}d[0]=d[0]+y|0,d[1]=d[1]+B|0,d[2]=d[2]+C|0,d[3]=d[3]+m|0,d[4]=d[4]+A|0;},_doFinalize:function(){var D=this._data,F=D.words,d=this._nDataBytes*8,y=D.sigBytes*8;return F[y>>>5]|=128<<24-y%32,F[(y+64>>>9<<4)+14]=Math.floor(d/4294967296),F[(y+64>>>9<<4)+15]=d,D.sigBytes=F.length*4,this._process(),this._hash},clone:function(){var D=h.clone.call(this);return D._hash=this._hash.clone(),D}});r.SHA1=h._createHelper(g),r.HmacSHA1=h._createHmacHelper(g);})(),u.SHA1});}),ge;(e=>(e.log=(t,...u)=>console.log(`[Pixi\u2019VN Json] ${t}`,...u),e.warn=(t,...u)=>console.warn(`[Pixi\u2019VN Json] ${t}`,...u),e.error=(t,...u)=>console.error(`[Pixi\u2019VN Json] ${t}`,...u),e.info=(t,...u)=>console.info(`[Pixi\u2019VN Json] ${t}`,...u)))(ge||(ge={}));function Du(e){let t="";return e.values.forEach(u=>{if(typeof u=="string")t+=u;else {let r=x.getLogichValue(u);t+=`${r}`;}}),t}async function Ft(e,t){let u=x.getLogichValue(e);if(u)switch(u.type){case "sound":x.soundOperation(u);break;case "assets":case "bundle":await x.loadAssets(u);break;case "image":await x.imageOperation(u);break;case "video":await x.videoOperation(u);break;case "imagecontainer":await x.imageContainerOperation(u);break;case "text":await x.textOperation(u);break;case "canvaselement":await x.canvasElementOperation(u);break;case "value":x.setStorageValue(u);break;case "operationtoconvert":if(t){let r=Du(u),i=await t(r);i&&await Ft(i,t);}break;case "input":case "dialogue":x.narrationOperation(u);break;case "shake":await x.effectOperation(u);break;case "animate":case "animate-sequence":x.animateOperation(u);break}}function fu(e){let t=x.getLogichValue(e);t&&t.type==="value"&&t.storageOperationType==="set"&&(t.storageType==="storage"||t.storageType==="tempstorage")&&x.setInitialStorageValue(t);}async function qe(e,t={}){if(!Array.isArray(e))if(typeof e=="object"||typeof e=="string")e=[e];else {ge.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let u=e.map(async i=>{if(typeof i=="string")try{i=JSON.parse(i);}catch(o){ge.error("Error parsing imported Pixi'VN JSON",o),i={};}return i}),r=(await Promise.all(u)).map(async i=>{let o=[];if(i.initialOperations)for(let h of i.initialOperations)fu(h);if(i.labels){let h=i.labels;for(let E in h)try{let p=h[E],g=new hu(E,p,void 0,t);RegisteredLabels.add(g);}catch(p){ge.error(`Error creating JSON label ${E}`,p);}}return Promise.all(o)});await Promise.all(r);}var gu=lu(cu()),At="___param___",hu=class extends LabelAbstract{constructor(e,t,u,r={}){u||(u={}),u.onLoadingLabel=async()=>{for(let i of t){let o;if(typeof i=="function"?o=i():o=i,o=x.getConditionalStep(o),o.operations)try{let h=o.operations.map(E=>x.loadAssets(E));await Promise.all(h);}catch(h){ge.error("The operation in the onLoadingLabel function of the label has an error:",h);}}},super(e,u),We(this,"_steps"),We(this,"operationStringConvert"),We(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, gu.default)(t.toString().toLocaleLowerCase()).toString()}getDialogueText(e){let t="";if(Array.isArray(e)){let u=[];e.forEach(r=>{if(typeof r=="string")u.push(r);else if(r&&typeof r=="object"){let i=x.getLogichValue(r);i?(i&&!Array.isArray(i)&&typeof i=="object"&&(i=x.getLogichValue(i)||""),Array.isArray(i)?u=u.map(o=>`${o}`).concat(i):u.push(`${i}`)):u.push(`${r}`);}else u.push(`${r}`);}),t=u;}else {let u=x.getLogichValue(e);u&&!Array.isArray(u)&&typeof u=="object"&&(u=x.getLogichValue(u)),u&&Array.isArray(u)?t=u.map(r=>`${r}`):t=`${u}`;}return t}getDialogue(e){if(e==null)return;let t=x.getLogichValue(e);return t==null?`${t}`:typeof t=="object"&&"character"in t&&"text"in t?{character:t.character,text:$.t(this.getDialogueText(t.text))}:$.t(this.getDialogueText(t))}getChoices(e){return x.getLogichValue(e)?.map(t=>x.getLogichValue(t)).filter(t=>t!==void 0)}stepConverter(e){return async t=>{let u=typeof e=="function"?e():e;u=createExportableElement(u),u=x.getConditionalStep(u);let r=this.operationStringConvert?d=>this.operationStringConvert(d,u,t):void 0,{operations:i=[]}=u;for(let d of i)await Ft(d,r);let{labelToOpen:o=[]}=u,h=this.getChoices(u.choices),E=x.getLogichValue(u.glueEnabled),p=this.getDialogue(u.dialogue),g=[];Array.isArray(o)||(o=[o]),o.forEach(d=>{let y=x.getLogichValue(d);y&&g.push(y);});let D=x.getLogichValue(u.goNextStep),F=x.getLogichValue(u.end);if(h){let d=h.map(y=>{let B="";if(Array.isArray(y.text)){let C=[];y.text.forEach(m=>{if(typeof m=="string")C.push($.t(m));else if(m&&typeof m=="object"){let A=x.getLogichValue(m);A&&!Array.isArray(A)&&typeof A=="object"&&(A=x.getLogichValue(A)||""),A&&(Array.isArray(A)?C=C.concat($.t(A)):C.push($.t(A)));}}),B=C;}else typeof y.text=="string"&&(B=$.t(y.text));return {label:y.label,text:B,props:y.props,type:y.type,oneTime:y.oneTime,onlyHaveNoChoice:y.onlyHaveNoChoice,autoSelect:y.autoSelect}});narration.choices=d;}else narration.choices=void 0;p!==void 0&&(narration.dialogue=p,this.skipEmptyDialogs&&typeof p=="string"&&(p===""||RegExp(/^\s+$/).test(p))&&(D=true)),E?narration.dialogGlue=true:E===false&&(narration.dialogGlue=false);for(let d of g){let y=d.label;typeof y=="object"&&(y=x.getLogichValue(y)||"");let B=d.params?.map(C=>x.getLogichValue(C));t={...t,...d.props},d.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${At}${narration.openedLabels.length}`,B),await narration.call(y,t)):(storage.setTempVariable(`${At}${narration.openedLabels.length}`,B),await narration.call(y,t));}F==="game_end"?(narration.closeAllLabels(),await narration.continue(t,{runNow:true})):F==="label_end"&&narration.closeCurrentLabel(),D&&await narration.continue(t,{runNow:true});}}};var Ue="___param___";async function Lu(e){let t=x.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 q;(e=>(e.log=(t,...u)=>console.log(`[Pixi\u2019VN Json] ${t}`,...u),e.warn=(t,...u)=>console.warn(`[Pixi\u2019VN Json] ${t}`,...u),e.error=(t,...u)=>console.error(`[Pixi\u2019VN Json] ${t}`,...u),e.info=(t,...u)=>console.info(`[Pixi\u2019VN Json] ${t}`,...u)))(q||(q={}));async function Oe(e,t,u){switch(u.type){case "fade":await showWithFade(t.alias,e,u.props,u.priority);break;case "dissolve":await showWithDissolve(t.alias,e,u.props,u.priority);break;case "movein":case "moveout":await moveIn(t.alias,e,u.props,u.priority);break;case "zoomin":case "zoomout":await zoomIn(t.alias,e,u.props,u.priority);break;case "pushin":case "pushout":await pushIn(t.alias,e,u.props,u.priority);break}}function me(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 _u(e){switch(e.operationType){case "show":if(e.transition){let u=new ImageSprite(e.props,e.url||e.alias);await Oe(u,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}):q.error(`Image with alias ${e.alias} not found.`);break;case "remove":me(e);break}}async function Ru(e){switch(e.operationType){case "show":if(e.transition){let i=new VideoSprite(e.props,e.url||e.alias);await Oe(i,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}):q.error(`Video with alias ${e.alias} not found.`);break;case "remove":me(e);break;case "pause":let u=canvas.find(e.alias);u?u.paused=true:q.error(`Video with alias ${e.alias} not found.`);break;case "resume":let r=canvas.find(e.alias);r?r.paused=false:q.error(`Video with alias ${e.alias} not found.`);break}}async function ju(e){switch(e.operationType){case "show":if(e.transition){let u=new ImageContainer(e.props,e.urls);await Oe(u,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}):q.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":me(e);break}}async function Iu(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=$.t(e.text),e.transition){let u=new Text(e.props);await Oe(u,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}):q.error(`Text with alias ${e.alias} not found.`);break;case "remove":me(e);break}}async function $u(e){switch(e.operationType){case "edit":try{let t=canvas.find(e.alias);t?e.props&&(t.memory={...t.memory,...e.props}):q.error(`Canvas Element with alias ${e.alias} not found.`);}catch(t){q.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,t);}break;case "remove":me(e);break}}async function Hu(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function zu(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 Mu(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function Wu(e){switch(e.operationType){case "play":sound.play(e.alias,e.props);break;case "stop":sound.stop(e.alias);break;case "pause":sound.pause(e.alias);break;case "resume":sound.resume(e.alias);break;case "volume":sound.volume(e.alias,e.value);break}}function Gu(e){let t=x.getLogichValue(e.value),u;switch(t&&typeof t=="object"&&"type"in t?u=x.getLogichValue(t):u=t,e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.set(e.key,u);break;case "tempstorage":storage.setTempVariable(e.key,u);break;case "params":let r=storage.get(`${Ue}${narration.openedLabels.length-1}`)||[];r&&r.length-1>=e.key&&(r[e.key]=u),storage.setTempVariable(`${Ue}${narration.openedLabels.length-1}`,r);break}}function qu(e){let t=x.getLogichValue(e.value),u;switch(t&&typeof t=="object"&&"type"in t?u=x.getLogichValue(t):u=t,e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:u};break}}function Pe(e){let t=yt(e);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "value":return Yu(t);case "arithmetic":case "arithmeticsingle":return Uu(t);case "compare":case "valueCondition":case "union":return Qu(t)}return t}function Uu(e){let t=x.getLogichValue(e.leftValue);switch(e.type){case "arithmetic":let u=x.getLogichValue(e.rightValue);switch(e.operator){case "*":return t*u;case "/":return t/u;case "+":return t+u;case "-":return t-u;case "%":return t%u;case "POW":return Math.pow(t,u);case "RANDOM":return narration.getRandomNumber(t,u)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(t);case "FLOOR":return Math.floor(t);case "FLOAT":return parseFloat(t)}break}}function Yu(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return 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 x.getLogichValue(e.operation);case "params":let t=storage.get(`${Ue}${narration.openedLabels.length-1}`)||[];if(t&&t.length>e.key)return t[e.key];q.warn("getValue params not found");return}return e}function Qu(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let t=x.getLogichValue(e.leftValue),u=x.getLogichValue(e.rightValue);switch(e.operator){case "==":return t===u;case "!=":return t!==u;case "<":return t<u;case "<=":return t<=u;case ">":return t>u;case ">=":return t>=u;case "CONTAINS":return t.toString().includes(u.toString())}break;case "valueCondition":return !!x.getLogichValue(e.value);case "union":return Xu(e)}return !!e}function Xu(e){if(e.unionType==="not")return !Pe(e.condition);let t=e.unionType==="and";for(let u=0;u<e.conditions.length;u++)if(t=x.getLogichValue(e.conditions[u])||false,e.unionType==="and"){if(!t)return false}else if(t)return true;return t}function Zu(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function yt(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Ku(e);case "ifelse":return x.getLogichValue(e.condition)?x.getLogichValue(e.then):x.getLogichValue(e.else);case "stepswitch":let t=x.getLogichValue(e.elements)||[];if(t.length===0){q.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let u=Zu(0,t.length-1);return x.getLogichValue(t[u]);case "loop":let r=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return r>t.length-1?(r=r%t.length,x.getLogichValue(t[r])):x.getLogichValue(t[r]);case "sequential":let i,o=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(i=x.getLogichValue(t[t.length-1])),o>t.length-1?i:x.getLogichValue(t[o]);case "sequentialrandom":let h=NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:e.nestedId,onceOnly:true});if(h==null&&e.end=="lastItem"){let E=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!E||!E?.usedRandomNumbers){q.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let p=E.usedRandomNumbers[`0-${t.length-1}`];return x.getLogichValue(t[p[p.length-1]])}if(h==null){q.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return x.getLogichValue(t[h])}}return e}function Ye(e){if(e.conditionalStep){let t=createExportableElement(x.getLogichValue(e.conditionalStep));if(t?.glueEnabled===void 0&&delete t?.glueEnabled,t?.goNextStep===void 0&&delete t?.goNextStep,t?.end===void 0&&delete t?.end,t?.choices===void 0&&delete t?.choices,t?.dialogue===void 0&&delete t?.dialogue,t?.labelToOpen===void 0&&delete t?.labelToOpen,t?.operations===void 0&&delete t?.operations,t){let u={...e,conditionalStep:void 0,...t};return Ye(u)}else narration.dialogGlue&&(narration.dialogGlue=false);}return e}function Ku(e){let t=e.firstItem,u=[];e.secondConditionalItem?.forEach(i=>{if(Array.isArray(i))i.forEach(o=>{let h=x.getLogichValue(o);u.push(h);});else {let o=x.getLogichValue(i);u.push(o);}});let r=t?[t,...u]:u;if(r.length===0){q.warn("combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return $.t(r);if(typeof r[0]=="object"){let i=r,o,h=false,E=i.map((A,c)=>{A=Ye(A);let n=x.getLogichValue(A.dialogue)||"";return c===0?(o=x.getLogichValue(A.glueEnabled)||false,n):(typeof n=="object"&&"text"in n&&(n=n.character+": "+n.text),o===false&&h&&(n=`
2
+
3
+ `+n),n&&(h=true),o=x.getLogichValue(A.glueEnabled)||false,n)}),p=x.getLogichValue(E[0]),g=typeof p=="object"&&"character"in p?p.character:void 0,D=E.flatMap(A=>{let c;A&&typeof A=="object"&&"text"in A?c=A.text:c=A;let n;return Array.isArray(c)?n=c.map(s=>{let a=x.getLogichValue(s);return $.t(`${a}`)}):n=x.getLogichValue(c)||"",$.t(n)}),F=i.find(A=>A.end),d=i.find(A=>A.choices),y=false,B=false;i.length>0&&(i[0].glueEnabled&&i[0].goNextStep&&i[0].dialogue===void 0&&(narration.dialogGlue=true),y=i[i.length-1].glueEnabled,B=i.reverse().find(A=>!(A.operations&&(!A.dialogue||!A.choices)))?.goNextStep);let C=i.find(A=>A.labelToOpen),m=[];return i.forEach(A=>{A.operations&&(m=[...m,...A.operations]);}),{dialogue:g?{character:g,text:D}:D,end:F?.end,choices:d?.choices,glueEnabled:y,goNextStep:B,labelToOpen:C?.labelToOpen,operations:m}}}function Qe({getLogichValue:e=Pe}){x.init({animateOperation:zu,canvasElementOperation:$u,effectOperation:Hu,imageContainerOperation:ju,imageOperation:_u,textOperation:Iu,narrationOperation:Mu,loadAssets:Lu,soundOperation:Wu,videoOperation:Ru,setStorageValue:Gu,setInitialStorageValue:qu,getLogichValue:t=>e?e(yt(t),Pe):Pe(t),getConditionalStep:Ye});}var en=/[\u1680\u2000-\u200A\u202F\u205F\u3000]/,tn=/[\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]/,un=/[\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]/,Xe={Space_Separator:en,ID_Start:tn,ID_Continue:un},j={isSpaceSeparator(e){return typeof e=="string"&&Xe.Space_Separator.test(e)},isIdStartChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e==="$"||e==="_"||Xe.ID_Start.test(e))},isIdContinueChar(e){return typeof e=="string"&&(e>="a"&&e<="z"||e>="A"&&e<="Z"||e>="0"&&e<="9"||e==="$"||e==="_"||e==="\u200C"||e==="\u200D"||Xe.ID_Continue.test(e))},isDigit(e){return typeof e=="string"&&/[0-9]/.test(e)},isHexDigit(e){return typeof e=="string"&&/[0-9A-Fa-f]/.test(e)}},Ke,U,ne,Je,oe,Z,H,ut,Be,nn=function(t,u){Ke=String(t),U="start",ne=[],Je=0,oe=1,Z=0,H=void 0,ut=void 0,Be=void 0;do H=rn(),sn[U]();while(H.type!=="eof");return typeof u=="function"?et({"":Be},"",u):Be};function et(e,t,u){let r=e[t];if(r!=null&&typeof r=="object")if(Array.isArray(r))for(let i=0;i<r.length;i++){let o=String(i),h=et(r,o,u);h===void 0?delete r[o]:Object.defineProperty(r,o,{value:h,writable:true,enumerable:true,configurable:true});}else for(let i in r){let o=et(r,i,u);o===void 0?delete r[i]:Object.defineProperty(r,i,{value:o,writable:true,enumerable:true,configurable:true});}return u.call(e,t,r)}var V,T,xe,ue,v;function rn(){for(V="default",T="",xe=false,ue=1;;){v=re();let e=xt[V]();if(e)return e}}function re(){if(Ke[Je])return String.fromCodePoint(Ke.codePointAt(Je))}function f(){let e=re();return e===`
4
+ `?(oe++,Z=0):e?Z+=e.length:Z++,e&&(Je+=e.length),e}var xt={default(){switch(v){case " ":case "\v":case "\f":case " ":case "\xA0":case "\uFEFF":case `
5
+ `:case "\r":case "\u2028":case "\u2029":f();return;case "/":f(),V="comment";return;case void 0:return f(),k("eof")}if(j.isSpaceSeparator(v)){f();return}return xt[U]()},comment(){switch(v){case "*":f(),V="multiLineComment";return;case "/":f(),V="singleLineComment";return}throw L(f())},multiLineComment(){switch(v){case "*":f(),V="multiLineCommentAsterisk";return;case void 0:throw L(f())}f();},multiLineCommentAsterisk(){switch(v){case "*":f();return;case "/":f(),V="default";return;case void 0:throw L(f())}f(),V="multiLineComment";},singleLineComment(){switch(v){case `
6
+ `:case "\r":case "\u2028":case "\u2029":f(),V="default";return;case void 0:return f(),k("eof")}f();},value(){switch(v){case "{":case "[":return k("punctuator",f());case "n":return f(),ce("ull"),k("null",null);case "t":return f(),ce("rue"),k("boolean",true);case "f":return f(),ce("alse"),k("boolean",false);case "-":case "+":f()==="-"&&(ue=-1),V="sign";return;case ".":T=f(),V="decimalPointLeading";return;case "0":T=f(),V="zero";return;case "1":case "2":case "3":case "4":case "5":case "6":case "7":case "8":case "9":T=f(),V="decimalInteger";return;case "I":return f(),ce("nfinity"),k("numeric",1/0);case "N":return f(),ce("aN"),k("numeric",NaN);case '"':case "'":xe=f()==='"',T="",V="string";return}throw L(f())},identifierNameStartEscape(){if(v!=="u")throw L(f());f();let e=tt();switch(e){case "$":case "_":break;default:if(!j.isIdStartChar(e))throw mt();break}T+=e,V="identifierName";},identifierName(){switch(v){case "$":case "_":case "\u200C":case "\u200D":T+=f();return;case "\\":f(),V="identifierNameEscape";return}if(j.isIdContinueChar(v)){T+=f();return}return k("identifier",T)},identifierNameEscape(){if(v!=="u")throw L(f());f();let e=tt();switch(e){case "$":case "_":case "\u200C":case "\u200D":break;default:if(!j.isIdContinueChar(e))throw mt();break}T+=e,V="identifierName";},sign(){switch(v){case ".":T=f(),V="decimalPointLeading";return;case "0":T=f(),V="zero";return;case "1":case "2":case "3":case "4":case "5":case "6":case "7":case "8":case "9":T=f(),V="decimalInteger";return;case "I":return f(),ce("nfinity"),k("numeric",ue*(1/0));case "N":return f(),ce("aN"),k("numeric",NaN)}throw L(f())},zero(){switch(v){case ".":T+=f(),V="decimalPoint";return;case "e":case "E":T+=f(),V="decimalExponent";return;case "x":case "X":T+=f(),V="hexadecimal";return}return k("numeric",ue*0)},decimalInteger(){switch(v){case ".":T+=f(),V="decimalPoint";return;case "e":case "E":T+=f(),V="decimalExponent";return}if(j.isDigit(v)){T+=f();return}return k("numeric",ue*Number(T))},decimalPointLeading(){if(j.isDigit(v)){T+=f(),V="decimalFraction";return}throw L(f())},decimalPoint(){switch(v){case "e":case "E":T+=f(),V="decimalExponent";return}if(j.isDigit(v)){T+=f(),V="decimalFraction";return}return k("numeric",ue*Number(T))},decimalFraction(){switch(v){case "e":case "E":T+=f(),V="decimalExponent";return}if(j.isDigit(v)){T+=f();return}return k("numeric",ue*Number(T))},decimalExponent(){switch(v){case "+":case "-":T+=f(),V="decimalExponentSign";return}if(j.isDigit(v)){T+=f(),V="decimalExponentInteger";return}throw L(f())},decimalExponentSign(){if(j.isDigit(v)){T+=f(),V="decimalExponentInteger";return}throw L(f())},decimalExponentInteger(){if(j.isDigit(v)){T+=f();return}return k("numeric",ue*Number(T))},hexadecimal(){if(j.isHexDigit(v)){T+=f(),V="hexadecimalInteger";return}throw L(f())},hexadecimalInteger(){if(j.isHexDigit(v)){T+=f();return}return k("numeric",ue*Number(T))},string(){switch(v){case "\\":f(),T+=on();return;case '"':if(xe)return f(),k("string",T);T+=f();return;case "'":if(!xe)return f(),k("string",T);T+=f();return;case `
7
+ `:case "\r":throw L(f());case "\u2028":case "\u2029":ln(v);break;case void 0:throw L(f())}T+=f();},start(){switch(v){case "{":case "[":return k("punctuator",f())}V="value";},beforePropertyName(){switch(v){case "$":case "_":T=f(),V="identifierName";return;case "\\":f(),V="identifierNameStartEscape";return;case "}":return k("punctuator",f());case '"':case "'":xe=f()==='"',V="string";return}if(j.isIdStartChar(v)){T+=f(),V="identifierName";return}throw L(f())},afterPropertyName(){if(v===":")return k("punctuator",f());throw L(f())},beforePropertyValue(){V="value";},afterPropertyValue(){switch(v){case ",":case "}":return k("punctuator",f())}throw L(f())},beforeArrayValue(){if(v==="]")return k("punctuator",f());V="value";},afterArrayValue(){switch(v){case ",":case "]":return k("punctuator",f())}throw L(f())},end(){throw L(f())}};function k(e,t){return {type:e,value:t,line:oe,column:Z}}function ce(e){for(let t of e){if(re()!==t)throw L(f());f();}}function on(){switch(re()){case "b":return f(),"\b";case "f":return f(),"\f";case "n":return f(),`
8
+ `;case "r":return f(),"\r";case "t":return f()," ";case "v":return f(),"\v";case "0":if(f(),j.isDigit(re()))throw L(f());return "\0";case "x":return f(),an();case "u":return f(),tt();case `
9
+ `:case "\u2028":case "\u2029":return f(),"";case "\r":return f(),re()===`
10
+ `&&f(),"";case "1":case "2":case "3":case "4":case "5":case "6":case "7":case "8":case "9":throw L(f());case void 0:throw L(f())}return f()}function an(){let e="",t=re();if(!j.isHexDigit(t)||(e+=f(),t=re(),!j.isHexDigit(t)))throw L(f());return e+=f(),String.fromCodePoint(parseInt(e,16))}function tt(){let e="",t=4;for(;t-- >0;){let u=re();if(!j.isHexDigit(u))throw L(f());e+=f();}return String.fromCodePoint(parseInt(e,16))}var sn={start(){if(H.type==="eof")throw De();Ze();},beforePropertyName(){switch(H.type){case "identifier":case "string":ut=H.value,U="afterPropertyName";return;case "punctuator":Ne();return;case "eof":throw De()}},afterPropertyName(){if(H.type==="eof")throw De();U="beforePropertyValue";},beforePropertyValue(){if(H.type==="eof")throw De();Ze();},beforeArrayValue(){if(H.type==="eof")throw De();if(H.type==="punctuator"&&H.value==="]"){Ne();return}Ze();},afterPropertyValue(){if(H.type==="eof")throw De();switch(H.value){case ",":U="beforePropertyName";return;case "}":Ne();}},afterArrayValue(){if(H.type==="eof")throw De();switch(H.value){case ",":U="beforeArrayValue";return;case "]":Ne();}},end(){}};function Ze(){let e;switch(H.type){case "punctuator":switch(H.value){case "{":e={};break;case "[":e=[];break}break;case "null":case "boolean":case "numeric":case "string":e=H.value;break}if(Be===void 0)Be=e;else {let t=ne[ne.length-1];Array.isArray(t)?t.push(e):Object.defineProperty(t,ut,{value:e,writable:true,enumerable:true,configurable:true});}if(e!==null&&typeof e=="object")ne.push(e),Array.isArray(e)?U="beforeArrayValue":U="beforePropertyName";else {let t=ne[ne.length-1];t==null?U="end":Array.isArray(t)?U="afterArrayValue":U="afterPropertyValue";}}function Ne(){ne.pop();let e=ne[ne.length-1];e==null?U="end":Array.isArray(e)?U="afterArrayValue":U="afterPropertyValue";}function L(e){return ke(e===void 0?`JSON5: invalid end of input at ${oe}:${Z}`:`JSON5: invalid character '${Bt(e)}' at ${oe}:${Z}`)}function De(){return ke(`JSON5: invalid end of input at ${oe}:${Z}`)}function mt(){return Z-=5,ke(`JSON5: invalid identifier character at ${oe}:${Z}`)}function ln(e){console.warn(`JSON5: '${Bt(e)}' in strings is not valid ECMAScript; consider escaping`);}function Bt(e){let t={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"};if(t[e])return t[e];if(e<" "){let u=e.charCodeAt(0).toString(16);return "\\x"+("00"+u).substring(u.length)}return e}function ke(e){let t=new SyntaxError(e);return t.lineNumber=oe,t.columnNumber=Z,t}var pn=function(t,u,r){let i=[],o="",h,E,p="",g;if(u!=null&&typeof u=="object"&&!Array.isArray(u)&&(r=u.space,g=u.quote,u=u.replacer),typeof u=="function")E=u;else if(Array.isArray(u)){h=[];for(let C of u){let m;typeof C=="string"?m=C:(typeof C=="number"||C instanceof String||C instanceof Number)&&(m=String(C)),m!==void 0&&h.indexOf(m)<0&&h.push(m);}}return r instanceof Number?r=Number(r):r instanceof String&&(r=String(r)),typeof r=="number"?r>0&&(r=Math.min(10,Math.floor(r)),p=" ".substr(0,r)):typeof r=="string"&&(p=r.substr(0,10)),D("",{"":t});function D(C,m){let A=m[C];switch(A!=null&&(typeof A.toJSON5=="function"?A=A.toJSON5(C):typeof A.toJSON=="function"&&(A=A.toJSON(C))),E&&(A=E.call(m,C,A)),A instanceof Number?A=Number(A):A instanceof String?A=String(A):A instanceof Boolean&&(A=A.valueOf()),A){case null:return "null";case true:return "true";case false:return "false"}if(typeof A=="string")return F(A);if(typeof A=="number")return String(A);if(typeof A=="object")return Array.isArray(A)?B(A):d(A)}function F(C){let m={"'":.1,'"':.2},A={"'":"\\'",'"':'\\"',"\\":"\\\\","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r"," ":"\\t","\v":"\\v","\0":"\\0","\u2028":"\\u2028","\u2029":"\\u2029"},c="";for(let s=0;s<C.length;s++){let a=C[s];switch(a){case "'":case '"':m[a]++,c+=a;continue;case "\0":if(j.isDigit(C[s+1])){c+="\\x00";continue}}if(A[a]){c+=A[a];continue}if(a<" "){let l=a.charCodeAt(0).toString(16);c+="\\x"+("00"+l).substring(l.length);continue}c+=a;}let n=g||Object.keys(m).reduce((s,a)=>m[s]<m[a]?s:a);return c=c.replace(new RegExp(n,"g"),A[n]),n+c+n}function d(C){if(i.indexOf(C)>=0)throw TypeError("Converting circular structure to JSON5");i.push(C);let m=o;o=o+p;let A=h||Object.keys(C),c=[];for(let s of A){let a=D(s,C);if(a!==void 0){let l=y(s)+":";p!==""&&(l+=" "),l+=a,c.push(l);}}let n;if(c.length===0)n="{}";else {let s;if(p==="")s=c.join(","),n="{"+s+"}";else {let a=`,
11
+ `+o;s=c.join(a),n=`{
12
+ `+o+s+`,
13
+ `+m+"}";}}return i.pop(),o=m,n}function y(C){if(C.length===0)return F(C);let m=String.fromCodePoint(C.codePointAt(0));if(!j.isIdStartChar(m))return F(C);for(let A=m.length;A<C.length;A++)if(!j.isIdContinueChar(String.fromCodePoint(C.codePointAt(A))))return F(C);return C}function B(C){if(i.indexOf(C)>=0)throw TypeError("Converting circular structure to JSON5");i.push(C);let m=o;o=o+p;let A=[];for(let n=0;n<C.length;n++){let s=D(String(n),C);A.push(s!==void 0?s:"null");}let c;if(A.length===0)c="[]";else if(p==="")c="["+A.join(",")+"]";else {let n=`,
14
+ `+o,s=A.join(n);c=`[
15
+ `+o+s+`,
16
+ `+m+"]";}return i.pop(),o=m,c}},cn={parse:nn,stringify:pn},Dn=cn,Le=Dn;var bt="\xA7SPACE\xA7",Tt="\xA7DOUBLE_QUOTES\xA7",St="\xA7QUOTES\xA7",Vt="SPECIAL_\xA7QUOTES\xA7",vt="\xA7CURLY_BRACKETS1\xA7",wt="\xA7CURLY_BRACKETS2\xA7",fn=["add","play","pause","resume","remove","volume"],he=class{};c(he,"handlers",[t=>false]);var _e;(c=>{async function e(n,s){let a=he.handlers;for(let l=0;l<a.length;l++)try{let b=await a[l](n,s,y);if(b===!0||typeof b=="string")return b}catch{}return false}function t(n){he.handlers.push(n);}c.add=t;function u(){he.handlers=[];}c.clear=u;async function r(n,s,a){try{n=n.replaceAll('\\"',Tt),n=n.replaceAll("\\'",St),n=n.replaceAll("\\`",Vt),n=n.replaceAll("\\{",vt),n=n.replaceAll("\\}",wt),n=n.replaceAll("{"," { "),n=n.replaceAll("}"," } "),n=n.replaceAll(vt,"{"),n=n.replaceAll(wt,"}");let l=[],b,P="";for(let R=0;R<n.length;R++){let z=n[R];z==='"'||z==="'"||z==="`"?b===void 0?(l.push(P),P="",b=z,P+=z):b===z?(b=void 0,P+=z,l.push(P),P=""):P+=z:P+=z;}P!==""&&l.push(P),l.forEach((R,z)=>{z%2===1&&(l[z]=R.replaceAll(" ",bt));}),n=l.join(""),l=n.split(" ").filter(R=>R!==""),l=l.map(R=>R.replaceAll(bt," ").replaceAll(Tt,'"').replaceAll(St,"'").replaceAll(Vt,"`"));let _=await e(l,a);if(_===!0)return;if(typeof _=="string")return _.startsWith("#")&&(_=_.substring(1)),c.run(_,s,a);let I=l.length>1?m(l[1]):"",J=l.length>0?m(l[0]):"";switch(I){case "image":case "imagecontainer":case "canvaselement":case "video":case "text":return I==="video"&&(J==="pause"||J==="resume")?{type:"video",operationType:J,alias:m(l[2])}:i(l,I);case "sound":return p(l);case "input":if(J==="request"){let R={type:"input",operationType:"request"};if(l.length>2)try{let z=l.slice(2),ie=y(z);"type"in ie&&typeof ie.type=="string"&&(R.valueType=ie.type),"default"in ie&&(R.defaultValue=ie.default);}catch{}return R}break;case "assets":case "bundle":switch(J){case "load":case "lazyload":return {type:I,operationType:J,aliases:l.slice(2)}}break;default:if(I)switch(J){case "call":case "jump":s.labelToOpen={label:I,type:J},s.goNextStep=void 0;return;case "shake":let R={};if(l.length>2)try{R=y(l.slice(2));}catch{}return {alias:I,type:J,props:R};case "animate":let ie={},gt={};if(l.length>2){let le=l.slice(2),ze=[];if(le.includes("options")){let Te=le.indexOf("options");ze=le.slice(Te+1),le=le.slice(0,Te);}try{ie=y(le);}catch{}if(ze.length>0)try{gt=y(ze);}catch{}}return {alias:I,type:J,keyframes:ie,options:gt}}else switch(J){case "pause":return "dialogue"in s&&delete s.dialogue,"goNextStep"in s&&delete s.goNextStep,{type:"dialogue",operationType:"clean"};case "continue":s.goNextStep=!0,s.glueEnabled=!1;return}}}catch(l){throw d.error("Error parsing ink hashtag-command",n),l}d.error("The operation is not valid",n);}c.run=r;function i(n,s){let a=m(n[0]),l=m(n[2]),b=B(n.slice(3));switch(a){case "show":switch(s){case "image":case "video":return o(s,l,b);case "imagecontainer":return E(s,l,b);case "text":return h(s,l,b);default:d.error("This show operation is not valid for this type of element",s);}case "edit":return {type:s,operationType:"edit",alias:l,props:C(b)};case "remove":let _={type:s,operationType:"remove",alias:l};if(b.length>1&&b[0]==="with"){let I=n[n.indexOf("with")+1],J=n.slice(n.indexOf("with")+2),R=D(I,J);R!==void 0&&(_.transition=R);}return _;default:d.error("The operation type is not valid",a);}}function o(n,s,a){let l,b;return a.length%2===0?(l=s,b=a):(l=m(a[0]),b=a.slice(1)),g({type:n,operationType:"show",alias:s,url:l},b)}function h(n,s,a){let l,b;return a.length%2===0?(l=s,b=a):(l=m(a[0]),b=a.slice(1)),g({type:n,operationType:"show",alias:s,text:l},b)}function E(n,s,a){let l=[],b=a.findIndex(J=>J.startsWith("[")),P=a.findIndex(J=>J.endsWith("]"));if(b===-1||P===-1){d.error("Show imagecontainer must have a list of image ulrs",a);return}if(l=a.slice(b,P+1),l.length<2){d.error("Show imagecontainer must have a list of image ulrs",a);return}l[0]==="["?l.shift():l[0]=l[0].substring(1),l[l.length-1]==="]"?l.pop():l[l.length-1]=l[l.length-1].substring(0,l[l.length-1].length-1);let _={type:n,operationType:"show",alias:s,urls:l.map(J=>m(J))},I=a.slice(P+1);return g(_,I)}function p(n){let s=m(n[0]);if(!fn.includes(s))return;let a=m(n[2]);switch(s){case "play":let l={type:"sound",operationType:"play",alias:a};if(n.length>3){let J=d$1(n.slice(3));J!==void 0&&(l.props=J);}return l;case "pause":case "resume":return {type:"sound",operationType:s,alias:a};case "stop":case "remove":return {type:"sound",operationType:"stop",alias:a};case "volume":let _=parseFloat(n[3]);return {type:"sound",operationType:"volume",alias:a,value:_}}}function g(n,s){if(s.length>0){if(s.includes("with")&&s.length>s.indexOf("with")+1){let a=s[s.indexOf("with")+1],l=s.slice(s.indexOf("with")+2);s=s.slice(0,s.indexOf("with"));let b=D(a,l);b!==void 0&&(n.transition=b);}if(s.length>0){let a=C(s);n.props=a;}}return n}function D(n,s){switch(n){case "dissolve":case "fade":case "movein":case "moveout":case "zoomin":case "zoomout":case "pushin":case "pushout":break;default:return}let a={type:n};if(s.length>0)try{let l=C(s);a.props=l;}catch{}return a}function d$1(n){try{return y(n)}catch{return}}function y(n){let s=B(n);return C(s)}function B(n){let s=[],a=0,l="";for(let b=0;b<n.length;b++){let P=n[b];P.startsWith("{")?(a++,l+=P):P.endsWith("}")&&a>0?(a--,l+=P,a===0&&(s.push(l),l="")):a>0?l+=P:s.push(P);}return s}function C(n){if(n.length===0)return {};if(n.length%2!==0)throw d.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 s="{";n.forEach((a,l)=>{if(l%2===0)s+=`"${a}": `;else {switch(a){case "null":case "undefined":case "true":case "false":s+=`${a}`;break;default:A(a)?(a=m(a),s+=`"${a}"`):a.startsWith("{")&&a.endsWith("}")?s+=`${a}`:a.startsWith('"')&&a.endsWith('"')?s+=`${a}`:isNaN(parseFloat(a))?s+=`"${a}"`:s+=`${a}`;}l<n.length-1&&(s+=", ");}}),s+="}";try{return Le.parse(s)}catch(a){throw d.error("Error parsing ink json",s),a}}function m(n){return n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")||n.startsWith("`")&&n.endsWith("`")?n.substring(1,n.length-1):n}function A(n){return !!(n.startsWith('"')&&n.endsWith('"')||n.startsWith("'")&&n.endsWith("'")||n.startsWith("`")&&n.endsWith("`"))}})(_e||(_e={}));var de=_e;function gn(e){_e.add(e);}var fe=class{};c(fe,"handlers",[]);var nt;(r=>{function e(i){fe.handlers.push(i);}r.add=e;function t(){fe.handlers=[];}r.clear=t;function u(i,o,h=0){if(h>=fe.handlers.length)return o(i);let E=fe.handlers[h];return E(i,p=>u(p,o,h+1))}r.getLogichValue=u;})(nt||(nt={}));var Re=nt;var Dt=b(e(),1);var je="global decl",ae="___external_value___";function be(e,t){if(e.endsWith(".s"))return;if(new RegExp(/.*\.[0-9]+\..*$/).test(e)&&(e=e.split(".").filter(i=>!i.match(/^[0-9]+$/)).join("."),!e.startsWith(".")))return e.replaceAll(".","_|_");if(!new RegExp(/^\.\^.*$/).test(e)&&e.includes("g-")){let r=e.split("g-");return rt(t)+"_|_"+"g-"+r[r.length-1]}let u=0;for(;new RegExp(/^\.\^.*$/).test(e);)u++,e=e.substring(2);if(u=u-1,new RegExp(/^\..*$/).test(e)&&t){let r=e.substring(1);return rt(t,u)+"_|_"+r.replaceAll(".","_|_")}return e.replaceAll(".","_|_")||rt(t,u).replaceAll(".","_|_")}function rt(e,t=0){let u=e.split("_|_");for(;u.length>1&&t>0;)u.pop()?.includes("g-")&&t--,t--;return u.join("_|_")}var Pt="\xA7DOUBLE_SLASH_CONVERTOR\xA7";function ee(e){return e.startsWith("^")&&(e=e.substring(1)),e=e.replaceAll("\\\\",Pt),e=e.replaceAll("\\n",`
17
+ `),e=e.replaceAll("\\t"," "),e=e.replaceAll(" "," "),e=e.replaceAll(Pt,"\\\\"),e}var Ot=["+","-","/","*","%","_","==",">","<",">=","<=","!=","!","&&","||","MIN","MAX"],Nt=["+","-","/","*","%","POW","RANDOM"],Jt=["INT","FLOOR","FLOAT"],kt=["==",">","<",">=","<=","!=","CONTAINS"];function Ce(e,t,u){e=e.map(i=>{if(typeof i=="string"){if(i==="rnd")return "RANDOM";if(i==="?")return "CONTAINS"}return i});let r=[];return e.forEach(i=>{if(typeof i=="object"&&"CNT?"in i)if(new RegExp(/.*\.[0-9]\..*/).test(i["CNT?"])){let o=i["CNT?"].split("."),h=o.pop(),E=o.pop();if(E===void 0||h===void 0){d.error("Error parsing ink file: Conditional statement is not valid",e);return}let p=parseInt(E),g=o.join(".");if(g.includes("^.")){let F=g.split("."),d=F[F.length-1].replaceAll(".","_|_");F.pop(),g=F.join(".")+"."+d,h.includes("c-")&&(g=g+"_|_"+h);}else g=g.replaceAll(".","_|_");let D=be(g,t);if(!D)return;r.push({type:"compare",leftValue:Lt(D),operator:">=",rightValue:{type:"value",value:p}});}else {let o=be(i["CNT?"],t);if(!o)return;r.push(Lt(o));}else if(typeof i=="object"&&"VAR?"in i)r.push(Ae(i["VAR?"],u));else if(i==="&&"||i==="||"){if(r.length>=2){let o={type:"union",unionType:i==="&&"?"and":"or",conditions:[r[r.length-2],r[r.length-1]]};r.pop(),r.pop(),r.push(o);}}else if(i==="!")if(r.length===0)d.error("Error parsing ink file: Conditional statement is not valid",e);else {let o={type:"union",unionType:"not",condition:r[r.length-1]};r[r.length-1]=o;}else if(i&&typeof i=="string"&&kt.includes(i))if(r.length<2)d.error("Error parsing ink file: Conditional statement is not valid",e);else {let o={type:"compare",operator:i,rightValue:r[r.length-1],leftValue:r[r.length-2]};r.pop(),r.pop(),r.push(o);}else if(i&&typeof i=="string"&&Nt.includes(i))if(r.length<2)d.error("Error parsing ink file: Conditional statement is not valid",e);else {let o={type:"arithmetic",operator:i,rightValue:r[r.length-1],leftValue:r[r.length-2]};r.pop(),r.pop(),r.push(o);}else if(i&&typeof i=="string"&&Jt.includes(i)){let o={type:"arithmeticsingle",operator:i,leftValue:r[r.length-1]};r.pop(),r.push(o);}else i&&typeof i=="string"?i.startsWith("^")&&r.push(ee(i)):typeof i=="object"&&"^->"in i?i["^->"].includes("$r")||r.push(i["^->"]):r.push(i);}),r}function Lt(e){return {type:"value",storageType:"label",storageOperationType:"get",label:e}}function _t(e,t,u){return Ce(e,t,u)}function Ae(e,t,u="storage"){let r=t.indexOf(e);return r>=0?{type:"value",storageType:"params",storageOperationType:"get",key:r}:{type:"value",storageOperationType:"get",storageType:u,key:e}}function it(e,t,u,r="storage"){let i=t.indexOf(e);return i>=0?{type:"value",storageType:"params",storageOperationType:"set",key:i,value:u}:{type:"value",storageOperationType:"set",storageType:r,key:e,value:u}}function ot(e,t){return t||new RegExp(`${"_|_".replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}c-\\d+$`).test(e)?"call":"jump"}function Ie(e,t){t&&(typeof t=="string"?t.startsWith("^")&&e.push(ee(t)):typeof t=="object"&&"type"in t&&t.type!=="value"&&e.push(t));}function at(e,t,u,r,i={}){let{isNewLine:o=true,isHashtagScript:h=false,isThreads:E=false}=i;return dn(e,t,u,r,{isNewLine:o,isHashtagScript:h,isThreads:E})}function dn(e,t,u,r,i){if(!t)return;let{isNewLine:o,isHashtagScript:h=false,isThreads:E}=i;if(h)Array.isArray(t)&&t.length>0&&e.push({operations:[{type:"operationtoconvert",values:t}],goNextStep:true});else if(typeof t=="string"&&t.startsWith("^")||t&&typeof t=="object"&&"type"in t&&t.type=="value"&&t.storageOperationType==="get"){if(!o&&e.length>0){let p=e[e.length-1];!p.glueEnabled&&!p.operations&&(p.glueEnabled=true,p.labelToOpen||(p.goNextStep=true)),e[e.length-1]=p;}typeof t=="string"?e.push(Cn(ee(t))):e.push({dialogue:t});}else if(typeof t=="string"){if(t==="end")e.push({end:"game_end"});else if(t==="done")e.push({end:"label_end",goNextStep:true});else if(t=="<>")if(e.length>0){let p=e[e.length-1];p.glueEnabled=true,p.labelToOpen||(p.goNextStep=true),e[e.length-1]=p;}else e.push({glueEnabled:true,goNextStep:false});}else if(typeof t=="object"){if("type"in t&&t.type!=="value"){if(!o&&e.length>0){let p=e[e.length-1];!p.glueEnabled&&!p.operations&&(p.glueEnabled=true,p.labelToOpen||(p.goNextStep=true)),e[e.length-1]=p;}e.push({conditionalStep:t});}else if("->"in t){let p=o?void 0:true;if(p&&u.includes("c-")&&e.length>0&&e[e.length-1]?.dialogue===void 0&&(p=void 0),!o&&e.length>0){let g=e[e.length-1];g.labelToOpen||(g.goNextStep=true),e[e.length-1]=g;}if(t.params&&t.params.length===0&&delete t.params,t.var)e.push({labelToOpen:{label:Ae(t["->"],r),type:E?"call":"jump",params:t.params},glueEnabled:p});else {let g=be(t["->"],u);if(!g)return;e.push({labelToOpen:{label:g,type:ot(g,E),params:t.params},glueEnabled:p});}}"type"in t&&t.type=="value"&&t.storageOperationType==="set"&&(typeof t.value=="string"&&t.value.startsWith("^")&&(t.value=ee(t.value)),e.push({goNextStep:true,operations:[t]}));}}function Cn(e){let t;if(e.includes(": ")){let u=e.split(": "),r=u[0],i=u.slice(1).join(": ");RegisteredCharacters.get(r)&&(t=r,e=i);}return t?{dialogue:{character:t,text:e}}:{dialogue:e}}function st(e,t,u,r=true,i=false){return An(e,t,u,r,i)}function An(e,t,u,r,i=false){t&&(typeof t=="string"&&t.startsWith("^")||t&&typeof t=="object"&&"type"in t&&t.type=="value"&&t.storageOperationType==="get"?typeof t=="string"?e.push(ee(t)):e.push(t):typeof t=="object"&&"type"in t&&e.push(t));}function $e(e,t,u){if(e.length===0){d.error("Error parsing ink file: Arithmetic statement is not valid",e);return}let r=Ce(e,t,u);if(r.length===1){let i=r[0];return i&&typeof i=="object"&&"type"in i?{type:"value",storageType:"logic",storageOperationType:"get",operation:i}:i}}function Ee(e,t,u,r="",i,o,h=void 0){let E=[],p="sequential",g=false,D=true;e.forEach(y=>{y==="%"&&(p="loop"),y==="seq"&&(p="random"),y==="MIN"&&(g=true);});let F=e[e.length-1];return Object.keys(F).forEach(y=>{let B=F[y];if(Array.isArray(B)&&B.length>3){B=B.slice(1,B.length-2);let C=[];se(B,r,i,C,t,t,u,Fe,h,true,o),C.length===1?E.push(C[0]):E.push({type:"resulttocombine",combine:"cross",secondConditionalItem:C});}else Array.isArray(B)&&B.length===3&&(D=false);}),p==="sequential"?{type:"stepswitch",elements:E,choiceType:p,end:D?"lastItem":void 0,nestedId:h}:g&&p==="random"?{type:"stepswitch",elements:E,choiceType:"sequentialrandom",end:D?"lastItem":void 0,nestedId:h}:{type:"stepswitch",elements:E,choiceType:p}}function lt(e="",t=""){let u=Array.isArray(e)?e:[e],r=Array.isArray(t)?t:[t];return [...new Set([...u,...r])]}function Fe(e,t,u,r,i){if(e.length>0){let o={};Rt(e,o,i);for(let[h,E]of Object.entries(o)){let p=u+"_|_"+h,g={text:E.text.length===1?E.text[0]:E.text,label:p,props:{},type:ot(p,false),oneTime:E.onetime};E.text.length===0&&(g.onlyHaveNoChoice=true,g.autoSelect=true),g.oneTime===false&&delete g.oneTime;let D=pt(g,E.conditions,i,u)||g,F=t[t.length-1];if(typeof F=="object"&&F&&"type"in F&&(F={conditionalStep:F}),t.length>0&&typeof F=="object"&&F&&"choices"in F&&F.choices){let d$1=F.choices;d$1&&Array.isArray(d$1)?d$1.push(D):d.error("Unhandled case: choices is PixiVNJsonConditionalStatements<PixiVNJsonChoices> | undefined",E,d$1),F.choices=d$1.sort((y,B)=>{try{let C=y.label.split("."),m=C[C.length-1].replaceAll(".","_|_"),A=B.label.split("."),c=A[A.length-1].replaceAll(".","_|_");if(m.includes("c-")&&c.includes("c-")){let n=m.split("c-")[1],s=parseInt(n),a=c.split("c-")[1],l=parseInt(a);return s-l}}catch{}return 0});}else t.push({choices:[D]});E.preDialog&&(r.preDialog[p]={...E.preDialog});}}}function Rt(e,t,u,r){let i=[],o="",h="",E=false,p=[];for(let g=0;g<e.length;g++){let D=e[g];if(typeof D=="string")D.startsWith("^")?i.push(ee(D)):Ot.includes(D)&&p.push(D);else if(Array.isArray(D)&&D.includes("visit")){let F=Ee(D,Ie,(d,y,B)=>{},r,{preDialog:{}},u);i.push(F);}else if(D&&typeof D=="object")if("*"in D&&typeof D["*"]&&typeof D["*"]=="string")D["*"].includes("c")&&(o="c"+D["*"].split("c")[1],D.flg&16&&(E=true));else if("s"in D&&D.s instanceof Array){let F=jt(D.s),d=D.s.includes("<>");F&&(r&&t[r]?(t[r].preDialog={text:F,glue:d},t[r].text=lt(F,t[r].text)):(i.push(F),h=F));}else "CNT?"in D&&p.push(D);else p.push(D);if(o){t[o]?t[o].text=lt(i,t[o].text):t[o]={text:i,onetime:E,conditions:p},h&&(t[o].preDialog={text:h,glue:false});let F=e.slice(g+1);Rt(F,t,u,o);return}}}function jt(e){for(let t of e)if(typeof t=="string"){if(t.startsWith("^"))return ee(t)}else if(t instanceof Array){let u=jt(t);if(u)return u}}function pt(e,t,u,r,i){if(t.length===0)return;let o=Ce(t,r,u);if(o.length===1){let h={type:"ifelse",condition:o[0],then:e,else:i};return h.else||delete h.else,h}else if(o.length>1){let h={type:"ifelse",condition:{type:"union",unionType:"and",conditions:o},then:e,else:i};return h.else||delete h.else,h}}function It(e,t,u,r,i,o,h=void 0){if(e.length===0){d.error("Error parsing ink file: Conditional statement is not valid",e);return}let E=[],p=[];if(e.forEach(F=>{Array.isArray(F)?p.push(F):typeof F=="string"&&F==="du"?i.du?E.push(i.du):i.du=E[E.length-1]:(typeof F!="string"||F!=="/ev")&&E.push(F);}),p.length===0){d.error("Error parsing ink file: Conditional statement is not valid",p);return}let g=ct(p[0],t,u,r+"_|_"+"then",i,o,`${h||""}then`),D;return p.length===2?D=ct(p[1],t,u,r+"_|_"+"else",i,o,`${h||""}else`):p.length>2&&(p.shift(),p.push("nop"),p=[{b:p}],D=ct(p,t,u,r+"_|_"+"else",i,o,`${h||""}else`)),i.du=void 0,pt(g,E,o,r,D)}function ct(e,t,u,r,i,o,h=void 0){let E=[];for(let g of e)typeof g=="object"&&"b"in g&&(g.b=g.b.filter(D=>D!==null&&!(typeof D=="object"&&"->"in D&&new RegExp(/.*\.[0-9]/).test(D["->"]))),se(g.b,r,i,E,t,t,u,Fe,h,true,o));return E.length===1?E[0]:{type:"resulttocombine",combine:"cross",secondConditionalItem:E}}function se(e,t,u,r=[],i,o,h,E,p=void 0,g=true,D=[]){let F=false,d$1=[],y=false,B=false,C=false,m=[],A=[];if(u.preDialog[t]&&(g=false,i(r,"^"+u.preDialog[t].text,t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}),u.preDialog[t].glue&&i(r,"<>",t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}),delete u.preDialog[t]),e.includes("visit")){let n=Ee(e,o,h,t,u,D,p);n&&(!g&&r.length>0&&i(r,"<>",t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}),i(r,n,t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}));return}let c=e[0];if(c&&typeof c=="object"&&"temp="in c){for(;e[0]&&typeof e[0]=="object"&&"temp="in e[0];)D.push(e[0]["temp="]),e.shift();D=D.reverse();}if(e.forEach((n,s)=>{if(B){if(typeof n=="string"&&n=="/#"){let a=[];se(A,t,u,a,st,st,h,E,p,g),i(r,a,t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}),B=false,A=[];}else A.push(n);return}else if(F)if(Array.isArray(n))d$1.push(n);else if(n&&typeof n=="object")if("CNT?"in n)s>0&&e[s-1]=="ev"?(y=true,m.push(n)):y?m.push(n):(d$1.push(n),g=false);else if("VAR="in n||"temp="in n){let a=it("VAR="in n?n["VAR="]:n["temp="],D,e[s-1],"VAR="in n?"storage":"tempstorage");if(a.value&&typeof a.value=="string"&&a.value=="/str"&&(a.value=e[s-2]),a.value&&typeof a.value=="object"&&"^->"in a.value&&(a.value=a.value["^->"]),d$1.length>1){let l=$e(d$1,t,D);d$1=[],l&&typeof l=="object"&&"type"in l&&l.type=="value"&&"storageType"in l&&l.storageType=="logic"&&(a.value=l.operation);}(typeof a.key!="string"||!a.key.includes("$r"))&&(i(r,a,t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}),g=true);}else "VAR?"in n?d$1.push(n):"^->"in n&&(n["^->"].includes("$r")||d$1.push(n));else if(typeof n=="string"&&n=="/ev")y&&m.push(n),F=false,d$1.push(n);else if(typeof n=="string"&&n=="out"){if(d$1.length>0){let a=d$1[d$1.length-1];if(a&&typeof a=="object"&&"VAR?"in a){d$1.pop();let l=Ae(a["VAR?"],D,"storage");i(r,l,t,D,{isNewLine:g,isHashtagScript:B,isThreads:C});}else {let l=[];for(;d$1.length>0&&d$1[d$1.length-1]!="/ev";)l.push(d$1.pop());l=l.reverse();let b=$e(l,t,D);d$1=[],b&&typeof b=="object"&&"type"in b&&b.type=="value"&&"storageType"in b&&b.storageType=="logic"?i(r,{storageOperationType:"get",storageType:"logic",operation:b.operation,type:"value"},t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}):(i(r,"<>",t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}),b=`^${b}`,i(r,b,t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}));}g=false;}}else d$1.push(n);else if(typeof n=="string")if(n.startsWith("^"))i(r,n,t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}),g=false;else if(n=="ev")F=true;else if(n==`
18
+ `)g=true;else if(n=="done"||n=="end")i(r,n,t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}),g=false;else if(n=="<>")i(r,n,t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}),g=false;else if(n=="nop"&&y){let a=It(m,o,h,t,u,D,p);a&&i(r,a,t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}),y=false,m=[];}else n=="#"?B=true:n=="thread"&&(C=true);else if(n instanceof Array)if(y)m.push(n);else if(n.length>1&&typeof n[n.length-2]=="object"&&n[n.length-2]&&"c"in n[n.length-2]&&typeof n[n.length-1]=="object"&&n[n.length-1]&&"b"in n[n.length-1]){d$1.pop();let a=[],l=[];for(;d$1.length>0&&d$1[d$1.length-1]!="/ev";)a.push(d$1.pop());m=[...m,...a.reverse()],y=true,l.push(n.pop()),l.push(n.pop()),m=[...m,...n],m.push(l);}else if(n.length>1&&typeof n[n.length-1]=="object"&&n[n.length-1]&&"#n"in n[n.length-1]){let a=n.pop();if(!a){d.error("Error parsing ink file: el is undefined");return}let l=a["#n"];delete a["#n"],n.push(a),i(r,{"->":t?t+"_|_"+l:l},t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}),h({[l]:n},t,u);}else se(n,t,u,r,i,o,h,E,p,g,D);else if(n&&typeof n=="object")if("->"in n&&typeof n["->"]=="string"&&!new RegExp(/^\.\^\.\^\.\d\.s$/).test(n["->"])){let a=[];d$1.length>0&&(a=_t(["ev",...d$1],t,D)),n.params=a,i(r,n,t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}),g=false;}else if("*"in n&&typeof n["*"]=="string")n["*"].includes("c")&&(d$1.push(n),g=false);else if("s"in n&&n.s instanceof Array)d$1.push(n),g=false;else if("CNT?"in n)d$1.push(n),g=false;else if("VAR="in n||"temp="in n){let a=[],l=it("VAR="in n?n["VAR="]:n["temp="],D,void 0,"VAR="in n?"storage":"tempstorage");if(l.key!=="$r"){for(d$1.pop(),d$1[d$1.length-1]=="/ev"&&d$1.pop();d$1.length>0&&d$1[d$1.length-1]!="/ev";)a.push(d$1.pop());a=a.reverse(),l.value=$e(a,t,D),d$1=[],(l.value!==void 0||l.value!==null)&&i(r,l,t,D,{isNewLine:g,isHashtagScript:B,isThreads:C}),g=false;}}else h(n,t,u);}),E(d$1,r,t,u,D),t.includes("_|_")&&r.length==2){let n=r[0],s=r[1];n&&s&&typeof n=="object"&&"dialogue"in n&&typeof s=="object"&&"labelToOpen"in s&&n.dialogue==" "&&s.labelToOpen&&(r.shift(),delete s.glueEnabled,r[0]=s);}}function $t(e){try{let t={};return Ht(e,t),t}catch(t){d.error("Error parsing ink file",t);}}function Ht(e,t,u={externalSwitch:void 0}){for(let r of e)if(r)if(r instanceof Array)if(r.includes("visit")){let i=Ee(r,Ie,(o,h,E)=>{},"",{preDialog:{}},[]);i&&(u.externalSwitch=i);}else Ht(r,t,u);else typeof r=="object"&&(r&&"VAR="in r&&u.externalSwitch&&(t[ae]||(t[ae]=[]),t[ae].push({operations:[{type:"value",value:u.externalSwitch,key:r["VAR="],storageType:"storage",storageOperationType:"set"}]})),zt(r,t));}function zt(e,t,u="",r={preDialog:{}}){if(e!==null){for(let[i,o]of Object.entries(e))if(o instanceof Array){let h=[],E={},p=(u?u+"_|_":"")+i;se(o,p,r,h,at,at,(g,D,F)=>{zt(g,E,D,F);},Fe);for(let[g,D]of Object.entries(E))t[g]=D;h.length>0&&(t[p]=h);}}}function He(e){let{json:t,labelToRemove:u,issues:r,initialVarsToRemove:i}=f$1(e);if(r.forEach(({message:h,type:E})=>{E===Dt.ErrorType.Error?d.error("Ink compilation error: "+h):E===Dt.ErrorType.Warning?d.warn("Ink compilation warning: "+h):d.info("Ink compilation info: "+h);}),!t){d.error("No JSON generated from ink file");return}let o;try{o=Le.parse(t);}catch{d.error("Error parsing ink file");return}return Mt(o,{labelToRemove:u,initialVarsToRemove:i})}function Mt(e,t={}){let{labelToRemove:u=[],initialVarsToRemove:r=[]}=t,i={};if(i.labels=$t(e.root),i.labels&&je in i.labels){let o=i.labels[je];delete i.labels[je],o.forEach(h=>{h.operations&&(i.initialOperations=i.initialOperations?[...i.initialOperations,...h.operations]:[...h.operations]);});}if(i.labels&&ae in i.labels){let o=i.labels[ae];delete i.labels[ae],o.forEach(h=>{h.operations&&(i.initialOperations=i.initialOperations?[...i.initialOperations,...h.operations]:[...h.operations]);});}return u.forEach(o=>{i.labels&&o in i.labels&&delete i.labels[o];}),r.forEach(o=>{i.initialOperations&&(i.initialOperations=i.initialOperations.filter(h=>!(h.type==="value"&&h.key===o)));}),i}async function En(e){Array.isArray(e)||(e=[e]),Qe({getLogichValue:(u,r)=>Re.getLogichValue(u,r)});let t=e.map(async u=>{let r=He(u);return r&&await qe(r,{operationStringConvert:de.run,skipEmptyDialogs:true}),u});return await Promise.all(t)}async function Fn(e){return Qe({getLogichValue:(t,u)=>Re.getLogichValue(t,u)}),await qe(e,{operationStringConvert:de.run,skipEmptyDialogs:true})}function yn(e){$.afterToTranslate=t=>ft(t,e);}function mn(e){$.beforeToTranslate=t=>ft(t,e);}function ft(e,t){let u=e.match(/\[([^\]]+)\]/);if(u){let r=u[1],i=t(r);return i&&(e=e.replaceAll(u[0],i)),ft(e,t)}return e}function xn(e){$.translate=e;}async function Bn(e,t={},u={}){let r=[];return e.labels&&Object.values(e.labels).forEach(i=>{r=r.concat(i);}),await $.generateJsonTranslation(r,t,{...u,operationStringConvert:de.run})}export{de as a,gn as b,Re as c,He as d,Mt as e,En as f,Fn as g,yn as h,mn as i,xn as j,Bn as k};