@drincs/pixi-vn-json 1.1.6 → 1.1.7

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.
@@ -1,3 +1,3 @@
1
- 'use strict';var pixiVn=require('@drincs/pixi-vn');var pe=Object.create;var K=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var $=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var j=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var he=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of de(t))!ye.call(i,r)&&r!==e&&K(i,r,{get:()=>t[r],enumerable:!(a=ue(t,r))||a.enumerable});return i};var me=(i,t,e)=>(e=i!=null?pe(ge(i)):{},he(K(e,"default",{value:i,enumerable:!0}),i));var X=j((O,U)=>{(function(i,t){typeof O=="object"?U.exports=O=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(O,function(){var i=i||function(t,e){var a;if(typeof window<"u"&&window.crypto&&(a=window.crypto),typeof self<"u"&&self.crypto&&(a=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a=globalThis.crypto),!a&&typeof window<"u"&&window.msCrypto&&(a=window.msCrypto),!a&&typeof global<"u"&&global.crypto&&(a=global.crypto),!a&&typeof $=="function")try{a=$("crypto");}catch{}var r=function(){if(a){if(typeof a.getRandomValues=="function")try{return a.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a.randomBytes=="function")try{return a.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),u={},f=u.lib={},d=f.Base=function(){return {extend:function(n){var s=c(this);return n&&s.mixIn(n),(!s.hasOwnProperty("init")||this.init===s.init)&&(s.init=function(){s.$super.init.apply(this,arguments);}),s.init.prototype=s,s.$super=this,s},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var s in n)n.hasOwnProperty(s)&&(this[s]=n[s]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),y=f.WordArray=d.extend({init:function(n,s){n=this.words=n||[],s!=e?this.sigBytes=s:this.sigBytes=n.length*4;},toString:function(n){return (n||p).stringify(this)},concat:function(n){var s=this.words,g=n.words,h=this.sigBytes,V=n.sigBytes;if(this.clamp(),h%4)for(var P=0;P<V;P++){var G=g[P>>>2]>>>24-P%4*8&255;s[h+P>>>2]|=G<<24-(h+P)%4*8;}else for(var C=0;C<V;C+=4)s[h+C>>>2]=g[C>>>2];return this.sigBytes+=V,this},clamp:function(){var n=this.words,s=this.sigBytes;n[s>>>2]&=4294967295<<32-s%4*8,n.length=t.ceil(s/4);},clone:function(){var n=d.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var s=[],g=0;g<n;g+=4)s.push(r());return new y.init(s,n)}}),o=u.enc={},p=o.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push((P>>>4).toString(16)),h.push((P&15).toString(16));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h+=2)g[h>>>3]|=parseInt(n.substr(h,2),16)<<24-h%8*4;return new y.init(g,s/2)}},m=o.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push(String.fromCharCode(P));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h++)g[h>>>2]|=(n.charCodeAt(h)&255)<<24-h%4*8;return new y.init(g,s)}},T=o.Utf8={stringify:function(n){try{return decodeURIComponent(escape(m.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return m.parse(unescape(encodeURIComponent(n)))}},x=f.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=T.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var s,g=this._data,h=g.words,V=g.sigBytes,P=this.blockSize,G=P*4,C=V/G;n?C=t.ceil(C):C=t.max((C|0)-this._minBufferSize,0);var _=C*P,M=t.min(_*4,V);if(_){for(var H=0;H<_;H+=P)this._doProcessBlock(h,H);s=h.splice(0,_),g.sigBytes-=M;}return new y.init(s,M)},clone:function(){var n=d.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});f.Hasher=x.extend({cfg:d.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var s=this._doFinalize();return s},blockSize:512/32,_createHelper:function(n){return function(s,g){return new n.init(g).finalize(s)}},_createHmacHelper:function(n){return function(s,g){return new N.HMAC.init(n,g).finalize(s)}}});var N=u.algo={};return u}(Math);return i});});var Y=j((L,q)=>{(function(i,t){typeof L=="object"?q.exports=L=t(X()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(L,function(i){return function(){var t=i,e=t.lib,a=e.WordArray,r=e.Hasher,c=t.algo,u=[],f=c.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,y){for(var o=this._hash.words,p=o[0],m=o[1],T=o[2],x=o[3],b=o[4],N=0;N<80;N++){if(N<16)u[N]=d[y+N]|0;else {var n=u[N-3]^u[N-8]^u[N-14]^u[N-16];u[N]=n<<1|n>>>31;}var s=(p<<5|p>>>27)+b+u[N];N<20?s+=(m&T|~m&x)+1518500249:N<40?s+=(m^T^x)+1859775393:N<60?s+=(m&T|m&x|T&x)-1894007588:s+=(m^T^x)-899497514,b=x,x=T,T=m<<30|m>>>2,m=p,p=s;}o[0]=o[0]+p|0,o[1]=o[1]+m|0,o[2]=o[2]+T|0,o[3]=o[3]+x|0,o[4]=o[4]+b|0;},_doFinalize:function(){var d=this._data,y=d.words,o=this._nDataBytes*8,p=d.sigBytes*8;return y[p>>>5]|=128<<24-p%32,y[(p+64>>>9<<4)+14]=Math.floor(o/4294967296),y[(p+64>>>9<<4)+15]=o,d.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});t.SHA1=r._createHelper(f),t.HmacSHA1=r._createHmacHelper(f);}(),i.SHA1});});var ce=me(Y());var E="___param___";var v=class i{static _beforeToTranslate=void 0;static _translate=t=>t;static _afterToTranslate=void 0;static t(t){return Array.isArray(t)?t.map(e=>i.translate(`${e}`)):i.translate(`${t}`)}static set beforeToTranslate(t){i._beforeToTranslate=t;}static set translate(t){i._translate=t;}static get translate(){return t=>{let e=t;return i._beforeToTranslate&&(e=i._beforeToTranslate(e)),e=i._translate(e),i._afterToTranslate&&(e=i._afterToTranslate(e)),e}}static set afterToTranslate(t){i._afterToTranslate=t;}static addKey(t,e,a){let r=a.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(c=>{t[c]===void 0&&(r==="empty_string"?t[c]="":r==="copy_key"&&(i._beforeToTranslate?t[c]=i._beforeToTranslate(c):t[c]=c));});}static getConditionalsThenElse(t,e=[]){if(typeof t=="object"&&t&&"type"in t)if(t.type==="ifelse")t.then&&i.getConditionalsThenElse(t.then,e),t.else&&i.getConditionalsThenElse(t.else,e);else if(t.type==="stepswitch"){if(t.elements)if(Array.isArray(t.elements))t.elements.forEach(a=>{i.getConditionalsThenElse(a,e);});else if(t.elements.type==="ifelse"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else if(t.elements.type==="stepswitch"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else i.getConditionalsThenElse(t.elements,e);}else t.type==="resulttocombine"?(t.firstItem&&i.getConditionalsThenElse(t.firstItem,e),t.secondConditionalItem&&t.secondConditionalItem.forEach(a=>{i.getConditionalsThenElse(a,e);})):e.push(t);else t&&e.push(t);return e}static generateJsonTranslation(t,e={},a={}){return t.forEach(r=>{if(r.choices){let c=[];Array.isArray(r.choices)?c=[r.choices]:c=i.getConditionalsThenElse(r.choices),c.forEach(u=>u.forEach(f=>{if("type"in f){let d=[];f.type==="ifelse"||f.type==="stepswitch"?i.getConditionalsThenElse(f,d):d=[f],d.map(o=>i.getConditionalsThenElse(o.text)).forEach(o=>{Array.isArray(o)&&o.forEach(p=>{Array.isArray(p)?p.forEach(m=>{typeof m=="string"?i.addKey(e,m,a):i.getConditionalsThenElse(m).forEach(T=>{Array.isArray(T)?T.forEach(x=>{typeof x=="string"&&i.addKey(e,x,a);}):typeof T=="string"&&i.addKey(e,T,a);});}):typeof p=="string"&&i.addKey(e,p,a);});});}}));}if(r.dialogue){let c=[];Array.isArray(r.dialogue)?c=[r.dialogue]:c=i.getConditionalsThenElse(r.dialogue),c.forEach(u=>{typeof u=="string"?i.addKey(e,u,a):"text"in u&&Array.isArray(u.text)&&u.text.forEach(f=>{typeof f=="string"?i.addKey(e,f,a):i.getConditionalsThenElse(f).forEach(y=>{typeof y=="string"?i.addKey(e,y,a):Array.isArray(y)&&y.forEach(o=>{typeof o=="string"?i.addKey(e,o,a):i.getConditionalsThenElse(o).forEach(p=>{typeof p=="string"&&i.addKey(e,p,a);});});});});});}r.conditionalStep&&i.getConditionalsThenElse(r.conditionalStep).forEach(u=>{Array.isArray(u)?i.generateJsonTranslation(u,e,a):i.generateJsonTranslation([u],e,a);});}),e}};var D=v;function xe(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function be(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return Ve(i);case"ifelse":return l(i.condition)?l(i.then):l(i.else);case"stepswitch":let e=l(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let a=xe(0,e.length-1);return l(e[a]);case"loop":let r=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return r>e.length-1&&(r=r%e.length),l(e[r]);case"sequential":let c,u=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(c=l(e[e.length-1])),u>e.length-1?c:l(e[u]);case"sequentialrandom":let f=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(f==null&&i.end=="lastItem"){let d=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!d||!d?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=d.usedRandomNumbers[`0-${e.length-1}`];return l(e[y[y.length-1]])}if(f==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return l(e[f])}}return i}function R(i){if(i.conditionalStep){let t=pixiVn.createExportableElement(l(i.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 e={...i,conditionalStep:void 0,...t};return R(e)}else pixiVn.getFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);}return i}function Ve(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(c=>{let u=l(c);e.push(u);});else {let c=l(r);e.push(c);}});let a=t?[t,...e]:e;if(a.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof a[0]=="string")return D.t(a).join("");if(typeof a[0]=="object"){let r=a,c,u=r.map((n,s)=>{n=R(n);let g=l(n.dialogue)||"";return s===0?(c=l(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),c===!1&&(g=`
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn');var ce=Object.create;var K=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty;var $=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var j=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ye=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ue(t))!ge.call(i,r)&&r!==e&&K(i,r,{get:()=>t[r],enumerable:!(a=pe(t,r))||a.enumerable});return i};var he=(i,t,e)=>(e=i!=null?ce(de(i)):{},ye(K(e,"default",{value:i,enumerable:!0}),i));var X=j((O,U)=>{(function(i,t){typeof O=="object"?U.exports=O=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(O,function(){var i=i||function(t,e){var a;if(typeof window<"u"&&window.crypto&&(a=window.crypto),typeof self<"u"&&self.crypto&&(a=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a=globalThis.crypto),!a&&typeof window<"u"&&window.msCrypto&&(a=window.msCrypto),!a&&typeof global<"u"&&global.crypto&&(a=global.crypto),!a&&typeof $=="function")try{a=$("crypto");}catch{}var r=function(){if(a){if(typeof a.getRandomValues=="function")try{return a.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a.randomBytes=="function")try{return a.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),u={},f=u.lib={},d=f.Base=function(){return {extend:function(n){var s=c(this);return n&&s.mixIn(n),(!s.hasOwnProperty("init")||this.init===s.init)&&(s.init=function(){s.$super.init.apply(this,arguments);}),s.init.prototype=s,s.$super=this,s},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var s in n)n.hasOwnProperty(s)&&(this[s]=n[s]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),y=f.WordArray=d.extend({init:function(n,s){n=this.words=n||[],s!=e?this.sigBytes=s:this.sigBytes=n.length*4;},toString:function(n){return (n||p).stringify(this)},concat:function(n){var s=this.words,g=n.words,h=this.sigBytes,V=n.sigBytes;if(this.clamp(),h%4)for(var P=0;P<V;P++){var G=g[P>>>2]>>>24-P%4*8&255;s[h+P>>>2]|=G<<24-(h+P)%4*8;}else for(var C=0;C<V;C+=4)s[h+C>>>2]=g[C>>>2];return this.sigBytes+=V,this},clamp:function(){var n=this.words,s=this.sigBytes;n[s>>>2]&=4294967295<<32-s%4*8,n.length=t.ceil(s/4);},clone:function(){var n=d.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var s=[],g=0;g<n;g+=4)s.push(r());return new y.init(s,n)}}),o=u.enc={},p=o.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push((P>>>4).toString(16)),h.push((P&15).toString(16));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h+=2)g[h>>>3]|=parseInt(n.substr(h,2),16)<<24-h%8*4;return new y.init(g,s/2)}},m=o.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push(String.fromCharCode(P));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h++)g[h>>>2]|=(n.charCodeAt(h)&255)<<24-h%4*8;return new y.init(g,s)}},T=o.Utf8={stringify:function(n){try{return decodeURIComponent(escape(m.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return m.parse(unescape(encodeURIComponent(n)))}},x=f.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=T.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var s,g=this._data,h=g.words,V=g.sigBytes,P=this.blockSize,G=P*4,C=V/G;n?C=t.ceil(C):C=t.max((C|0)-this._minBufferSize,0);var _=C*P,M=t.min(_*4,V);if(_){for(var H=0;H<_;H+=P)this._doProcessBlock(h,H);s=h.splice(0,_),g.sigBytes-=M;}return new y.init(s,M)},clone:function(){var n=d.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});f.Hasher=x.extend({cfg:d.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var s=this._doFinalize();return s},blockSize:512/32,_createHelper:function(n){return function(s,g){return new n.init(g).finalize(s)}},_createHmacHelper:function(n){return function(s,g){return new N.HMAC.init(n,g).finalize(s)}}});var N=u.algo={};return u}(Math);return i});});var Y=j((L,q)=>{(function(i,t){typeof L=="object"?q.exports=L=t(X()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(L,function(i){return function(){var t=i,e=t.lib,a=e.WordArray,r=e.Hasher,c=t.algo,u=[],f=c.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,y){for(var o=this._hash.words,p=o[0],m=o[1],T=o[2],x=o[3],b=o[4],N=0;N<80;N++){if(N<16)u[N]=d[y+N]|0;else {var n=u[N-3]^u[N-8]^u[N-14]^u[N-16];u[N]=n<<1|n>>>31;}var s=(p<<5|p>>>27)+b+u[N];N<20?s+=(m&T|~m&x)+1518500249:N<40?s+=(m^T^x)+1859775393:N<60?s+=(m&T|m&x|T&x)-1894007588:s+=(m^T^x)-899497514,b=x,x=T,T=m<<30|m>>>2,m=p,p=s;}o[0]=o[0]+p|0,o[1]=o[1]+m|0,o[2]=o[2]+T|0,o[3]=o[3]+x|0,o[4]=o[4]+b|0;},_doFinalize:function(){var d=this._data,y=d.words,o=this._nDataBytes*8,p=d.sigBytes*8;return y[p>>>5]|=128<<24-p%32,y[(p+64>>>9<<4)+14]=Math.floor(o/4294967296),y[(p+64>>>9<<4)+15]=o,d.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});t.SHA1=r._createHelper(f),t.HmacSHA1=r._createHmacHelper(f);}(),i.SHA1});});var fe=he(Y());var E="___param___";var v=class i{static _beforeToTranslate=void 0;static _translate=t=>t;static _afterToTranslate=void 0;static t(t){return Array.isArray(t)?t.map(e=>i.translate(`${e}`)):i.translate(`${t}`)}static set beforeToTranslate(t){i._beforeToTranslate=t;}static set translate(t){i._translate=t;}static get translate(){return t=>{let e=t;return i._beforeToTranslate&&(e=i._beforeToTranslate(e)),e=i._translate(e),i._afterToTranslate&&(e=i._afterToTranslate(e)),e}}static set afterToTranslate(t){i._afterToTranslate=t;}static addKey(t,e,a){let r=a.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(c=>{t[c]===void 0&&(r==="empty_string"?t[c]="":r==="copy_key"&&(i._beforeToTranslate?t[c]=i._beforeToTranslate(c):t[c]=c));});}static getConditionalsThenElse(t,e=[]){if(typeof t=="object"&&t&&"type"in t)if(t.type==="ifelse")t.then&&i.getConditionalsThenElse(t.then,e),t.else&&i.getConditionalsThenElse(t.else,e);else if(t.type==="stepswitch"){if(t.elements)if(Array.isArray(t.elements))t.elements.forEach(a=>{i.getConditionalsThenElse(a,e);});else if(t.elements.type==="ifelse"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else if(t.elements.type==="stepswitch"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else i.getConditionalsThenElse(t.elements,e);}else t.type==="resulttocombine"?(t.firstItem&&i.getConditionalsThenElse(t.firstItem,e),t.secondConditionalItem&&t.secondConditionalItem.forEach(a=>{i.getConditionalsThenElse(a,e);})):e.push(t);else t&&e.push(t);return e}static generateJsonTranslation(t,e={},a={}){return t.forEach(r=>{if(r.choices){let c=[];Array.isArray(r.choices)?c=[r.choices]:c=i.getConditionalsThenElse(r.choices),c.forEach(u=>u.forEach(f=>{if("type"in f){let d=[];f.type==="ifelse"||f.type==="stepswitch"?i.getConditionalsThenElse(f,d):d=[f],d.map(o=>i.getConditionalsThenElse(o.text)).forEach(o=>{Array.isArray(o)&&o.forEach(p=>{Array.isArray(p)?p.forEach(m=>{typeof m=="string"?i.addKey(e,m,a):i.getConditionalsThenElse(m).forEach(T=>{Array.isArray(T)?T.forEach(x=>{typeof x=="string"&&i.addKey(e,x,a);}):typeof T=="string"&&i.addKey(e,T,a);});}):typeof p=="string"&&i.addKey(e,p,a);});});}}));}if(r.dialogue){let c=[];Array.isArray(r.dialogue)?c=[r.dialogue]:c=i.getConditionalsThenElse(r.dialogue),c.forEach(u=>{typeof u=="string"?i.addKey(e,u,a):"text"in u&&Array.isArray(u.text)&&u.text.forEach(f=>{typeof f=="string"?i.addKey(e,f,a):i.getConditionalsThenElse(f).forEach(y=>{typeof y=="string"?i.addKey(e,y,a):Array.isArray(y)&&y.forEach(o=>{typeof o=="string"?i.addKey(e,o,a):i.getConditionalsThenElse(o).forEach(p=>{typeof p=="string"&&i.addKey(e,p,a);});});});});});}r.conditionalStep&&i.getConditionalsThenElse(r.conditionalStep).forEach(u=>{Array.isArray(u)?i.generateJsonTranslation(u,e,a):i.generateJsonTranslation([u],e,a);});}),e}};var D=v;function Te(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function xe(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return be(i);case"ifelse":return l(i.condition)?l(i.then):l(i.else);case"stepswitch":let e=l(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let a=Te(0,e.length-1);return l(e[a]);case"loop":let r=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return r>e.length-1&&(r=r%e.length),l(e[r]);case"sequential":let c,u=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(c=l(e[e.length-1])),u>e.length-1?c:l(e[u]);case"sequentialrandom":let f=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(f==null&&i.end=="lastItem"){let d=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!d||!d?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=d.usedRandomNumbers[`0-${e.length-1}`];return l(e[y[y.length-1]])}if(f==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return l(e[f])}}return i}function R(i){if(i.conditionalStep){let t=pixiVn.createExportableElement(l(i.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 e={...i,conditionalStep:void 0,...t};return R(e)}else pixiVn.getFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);}return i}function be(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(c=>{let u=l(c);e.push(u);});else {let c=l(r);e.push(c);}});let a=t?[t,...e]:e;if(a.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof a[0]=="string")return D.t(a).join("");if(typeof a[0]=="object"){let r=a,c,u=r.map((n,s)=>{n=R(n);let g=l(n.dialogue)||"";return s===0?(c=l(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),c===!1&&(g=`
2
2
 
3
- `+g),c=l(n.glueEnabled)||!1,g)}),f=l(u[0]),d=typeof f=="object"&&"character"in f?f.character:void 0,y=u.map(n=>{let s;n&&typeof n=="object"&&"text"in n?s=n.text:s=n;let g;return Array.isArray(s)?g=s.map(h=>{let V=l(h);return D.t(`${V}`)}).join(""):g=l(s)||"",D.t(g)}).join(""),o=r.find(n=>n.end),p=r.find(n=>n.choices),m=!1,T=!1;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),m=r[r.length-1].glueEnabled,T=r.reverse().find(n=>!(n.operations&&(!n.dialogue||!n.choices)))?.goNextStep);let x=r.find(n=>n.labelToOpen),b=[];return r.forEach(n=>{n.operations&&b.forEach(s=>{b.push(s);});}),{dialogue:d?{character:d,text:y}:y,end:o?.end,choices:p?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function Ne(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=l(i.leftValue),e=l(i.rightValue);switch(i.operator){case"==":return t===e;case"!=":return t!==e;case"<":return t<e;case"<=":return t<=e;case">":return t>e;case">=":return t>=e;case"CONTAINS":return t.toString().includes(e.toString())}break;case"valueCondition":return !!l(i.value);case"union":return ve(i)}return !!i}function Pe(i){if(i&&typeof i=="object"&&"type"in i&&i.type==="value"&&i.storageOperationType==="get")switch(i.storageType){case"storage":case"tempstorage":return pixiVn.storage.getVariable(i.key);case"flagStorage":return pixiVn.getFlag(i.key);case"label":return pixiVn.narration.getTimesLabelOpened(i.label);case"choice":return pixiVn.narration.getTimesChoiceMade(i.index);case"logic":return l(i.operation);case"params":let t=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];if(t&&t.length>i.key)return t[i.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return i}function ve(i){if(i.unionType==="not")return !l(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=l(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function Q(i){let t=l(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=l(t):e=t,i.storageType){case"flagStorage":pixiVn.setFlag(i.key,i.value);break;case"storage":pixiVn.storage.setVariable(i.key,e);break;case"tempstorage":pixiVn.storage.setTempVariable(i.key,e);break;case"params":let a=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];a&&a.length-1>=i.key&&(a[i.key]=e),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length-1}`,a);break}}function l(i){let t=be(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return Pe(t);case"arithmetic":case"arithmeticsingle":return Je(t);case"compare":case"valueCondition":case"union":return Ne(t)}return t}function Je(i){let t=l(i.leftValue);switch(i.type){case"arithmetic":let e=l(i.rightValue);switch(i.operator){case"*":return t*e;case"/":return t/e;case"+":return t+e;case"-":return t-e;case"%":return t%e;case"POW":return Math.pow(t,e);case"RANDOM":return pixiVn.narration.getRandomNumber(t,e)}case"arithmeticsingle":switch(i.operator){case"INT":return parseInt(t);case"FLOOR":return Math.floor(t);case"FLOAT":return parseFloat(t)}break}}async function z(i,t){let e=l(i);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":pixiVn.sound.add(e.alias,{...e.props,url:e.url});break;case"play":pixiVn.sound.play(e.alias,e.props);break;case"remove":pixiVn.sound.remove(e.alias);break;case"pause":pixiVn.sound.pause(e.alias);break;case"resume":pixiVn.sound.resume(e.alias);break;case"volume":pixiVn.sound.volume(e.alias,e.value);break}break;case"assets":switch(e.operationType){case"load":await pixiVn.Assets.load(e.assets);break}break;case"image":switch(e.operationType){case"show":let f=new pixiVn.CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,f,e.transition.props,e.transition.priority);break;case"pushin":case"pushout":await pixiVn.pushIn(e.alias,f,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,f),await f.load();break;case"edit":let d=pixiVn.canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":pixiVn.removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case"pushin":case"pushout":pixiVn.pushOut(e.alias,e.transition.props,e.transition.priority);break}else pixiVn.canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":let f=new pixiVn.CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,f,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,f),await f.load();break;case"edit":let d=pixiVn.canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":pixiVn.removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(e.alias,e.transition.props,e.transition.priority);break}else pixiVn.canvas.remove(e.alias);break;case"pause":let y=pixiVn.canvas.find(e.alias);y?y.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let o=pixiVn.canvas.find(e.alias);o?o.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":Q(e);break;case"operationtoconvert":if(t){let f="";e.values.forEach(y=>{if(typeof y=="string")f+=y;else {let o=l(y);f+=`${o}`;}});let d=await t(f);d&&await z(d,t);}break;case"input":switch(e.operationType){case"request":pixiVn.narration.requestInput({type:e.valueType}),pixiVn.narration.inputValue=e.defaultValue;break}break;case"fade":let a=new pixiVn.FadeAlphaTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,a);break;case"move":let r=new pixiVn.MoveTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,r);break;case"rotate":let c=new pixiVn.RotateTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,c);break;case"zoom":let u=new pixiVn.ZoomTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,u);break;case"shake":await pixiVn.shakeEffect(e.alias,e.props,e.priority);break}}var W=class extends pixiVn.LabelAbstract{constructor(t,e,a,r={}){super(t,a),this._steps=e,this.operationStringConvert=r.operationStringConvert,this.skipEmptyDialogs=r.skipEmptyDialogs||!1;}_steps;get steps(){return this._steps.map(t=>this.stepConverter(t))}operationStringConvert;skipEmptyDialogs=!1;getStepSha1(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, ce.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let a=[];t.forEach(r=>{if(typeof r=="string")a.push(r);else if(r&&typeof r=="object"){let c=l(r);c?(c&&!Array.isArray(c)&&typeof c=="object"&&(c=l(c)||""),Array.isArray(c)?a=a.concat(c):a.push(`${c}`)):a.push(`${r}`);}}),e=a;}else {let a=l(t)||"";a&&!Array.isArray(a)&&typeof a=="object"&&(a=l(a)||""),e=a;}return `${e}`}getDialogue(t){if(t==null)return;let e=l(t);return e==null?"":typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:v.t(this.getDialogueText(e.text))}:v.t(this.getDialogueText(e))}getChoices(t){return l(t)?.map(r=>l(r)).filter(r=>r!==void 0)}stepConverter(t){return async e=>{let a;if(typeof t=="function"?a=t():a=t,a=R(a),a.operations)for(let o of a.operations)await z(o,this.operationStringConvert?p=>this.operationStringConvert(p,a,e):void 0);let r=this.getChoices(a.choices),c=l(a.glueEnabled),u=this.getDialogue(a.dialogue),f=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(o=>{let p=l(o);p&&f.push(p);}));let d=l(a.goNextStep),y=l(a.end);if(r){let o=r.map(p=>{let m="";if(Array.isArray(p.text)){let T=[];p.text.forEach(x=>{if(typeof x=="string")T.push(v.t(x));else if(x&&typeof x=="object"){let b=l(x);b&&!Array.isArray(b)&&typeof b=="object"&&(b=l(b)||""),b&&(Array.isArray(b)?T=T.concat(v.t(b)):T.push(v.t(b)));}}),m=T.join();}else typeof p.text=="string"&&(m=v.t(p.text));return new pixiVn.ChoiceMenuOption(m,p.label,p.props,{type:p.type,oneTime:p.oneTime,onlyHaveNoChoice:p.onlyHaveNoChoice,autoSelect:p.autoSelect})});pixiVn.narration.choiceMenuOptions=o;}else pixiVn.narration.choiceMenuOptions=void 0;u!==void 0&&(pixiVn.narration.dialogue=u,this.skipEmptyDialogs&&typeof u=="string"&&(u===""||RegExp(/^\s+$/).test(u))&&(d=!0)),c?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):c===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let o of f){let p=o.label;typeof p=="object"&&(p=l(p)||"");let m=o.params?.map(T=>l(T));e={...e,...o.props},o.type==="jump"?(pixiVn.narration.closeCurrentLabel(),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,m),await pixiVn.narration.callLabel(p,e)):(pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,m),await pixiVn.narration.callLabel(p,e));}y==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e)):y==="label_end"&&pixiVn.narration.closeCurrentLabel(),d&&await pixiVn.narration.goNext(e);}}};module.exports=W;
3
+ `+g),c=l(n.glueEnabled)||!1,g)}),f=l(u[0]),d=typeof f=="object"&&"character"in f?f.character:void 0,y=u.map(n=>{let s;n&&typeof n=="object"&&"text"in n?s=n.text:s=n;let g;return Array.isArray(s)?g=s.map(h=>{let V=l(h);return D.t(`${V}`)}).join(""):g=l(s)||"",D.t(g)}).join(""),o=r.find(n=>n.end),p=r.find(n=>n.choices),m=!1,T=!1;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),m=r[r.length-1].glueEnabled,T=r.reverse().find(n=>!(n.operations&&(!n.dialogue||!n.choices)))?.goNextStep);let x=r.find(n=>n.labelToOpen),b=[];return r.forEach(n=>{n.operations&&b.forEach(s=>{b.push(s);});}),{dialogue:d?{character:d,text:y}:y,end:o?.end,choices:p?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function Ve(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=l(i.leftValue),e=l(i.rightValue);switch(i.operator){case"==":return t===e;case"!=":return t!==e;case"<":return t<e;case"<=":return t<=e;case">":return t>e;case">=":return t>=e;case"CONTAINS":return t.toString().includes(e.toString())}break;case"valueCondition":return !!l(i.value);case"union":return Pe(i)}return !!i}function Ne(i){if(i&&typeof i=="object"&&"type"in i&&i.type==="value"&&i.storageOperationType==="get")switch(i.storageType){case"storage":case"tempstorage":return pixiVn.storage.getVariable(i.key);case"flagStorage":return pixiVn.getFlag(i.key);case"label":return pixiVn.narration.getTimesLabelOpened(i.label);case"choice":return pixiVn.narration.getTimesChoiceMade(i.index);case"logic":return l(i.operation);case"params":let t=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];if(t&&t.length>i.key)return t[i.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return i}function Pe(i){if(i.unionType==="not")return !l(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=l(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function Q(i){let t=l(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=l(t):e=t,i.storageType){case"flagStorage":pixiVn.setFlag(i.key,i.value);break;case"storage":pixiVn.storage.setVariable(i.key,e);break;case"tempstorage":pixiVn.storage.setTempVariable(i.key,e);break;case"params":let a=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];a&&a.length-1>=i.key&&(a[i.key]=e),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length-1}`,a);break}}function l(i){let t=xe(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return Ne(t);case"arithmetic":case"arithmeticsingle":return ve(t);case"compare":case"valueCondition":case"union":return Ve(t)}return t}function ve(i){let t=l(i.leftValue);switch(i.type){case"arithmetic":let e=l(i.rightValue);switch(i.operator){case"*":return t*e;case"/":return t/e;case"+":return t+e;case"-":return t-e;case"%":return t%e;case"POW":return Math.pow(t,e);case"RANDOM":return pixiVn.narration.getRandomNumber(t,e)}case"arithmeticsingle":switch(i.operator){case"INT":return parseInt(t);case"FLOOR":return Math.floor(t);case"FLOAT":return parseFloat(t)}break}}async function z(i,t){let e=l(i);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":pixiVn.sound.add(e.alias,{...e.props,url:e.url});break;case"play":pixiVn.sound.play(e.alias,e.props);break;case"remove":pixiVn.sound.remove(e.alias);break;case"pause":pixiVn.sound.pause(e.alias);break;case"resume":pixiVn.sound.resume(e.alias);break;case"volume":pixiVn.sound.volume(e.alias,e.value);break}break;case"assets":switch(e.operationType){case"load":await pixiVn.Assets.load(e.assets);break}break;case"image":switch(e.operationType){case"show":let f=new pixiVn.CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,f,e.transition.props,e.transition.priority);break;case"pushin":case"pushout":await pixiVn.pushIn(e.alias,f,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,f),await f.load();break;case"edit":let d=pixiVn.canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":pixiVn.removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case"pushin":case"pushout":pixiVn.pushOut(e.alias,e.transition.props,e.transition.priority);break}else pixiVn.canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":let f=new pixiVn.CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,f,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,f),await f.load();break;case"edit":let d=pixiVn.canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":pixiVn.removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(e.alias,e.transition.props,e.transition.priority);break}else pixiVn.canvas.remove(e.alias);break;case"pause":let y=pixiVn.canvas.find(e.alias);y?y.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let o=pixiVn.canvas.find(e.alias);o?o.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":Q(e);break;case"operationtoconvert":if(t){let f="";e.values.forEach(y=>{if(typeof y=="string")f+=y;else {let o=l(y);f+=`${o}`;}});let d=await t(f);d&&await z(d,t);}break;case"input":switch(e.operationType){case"request":pixiVn.narration.requestInput({type:e.valueType},e.defaultValue);break}break;case"fade":let a=new pixiVn.FadeAlphaTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,a);break;case"move":let r=new pixiVn.MoveTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,r);break;case"rotate":let c=new pixiVn.RotateTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,c);break;case"zoom":let u=new pixiVn.ZoomTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,u);break;case"shake":await pixiVn.shakeEffect(e.alias,e.props,e.priority);break}}var W=class extends pixiVn.LabelAbstract{constructor(t,e,a,r={}){super(t,a),this._steps=e,this.operationStringConvert=r.operationStringConvert,this.skipEmptyDialogs=r.skipEmptyDialogs||!1;}_steps;get steps(){return this._steps.map(t=>this.stepConverter(t))}operationStringConvert;skipEmptyDialogs=!1;getStepSha1(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, fe.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let a=[];t.forEach(r=>{if(typeof r=="string")a.push(r);else if(r&&typeof r=="object"){let c=l(r);c?(c&&!Array.isArray(c)&&typeof c=="object"&&(c=l(c)||""),Array.isArray(c)?a=a.concat(c):a.push(`${c}`)):a.push(`${r}`);}}),e=a;}else {let a=l(t)||"";a&&!Array.isArray(a)&&typeof a=="object"&&(a=l(a)||""),e=a;}return `${e}`}getDialogue(t){if(t==null)return;let e=l(t);return e==null?"":typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:v.t(this.getDialogueText(e.text))}:v.t(this.getDialogueText(e))}getChoices(t){return l(t)?.map(r=>l(r)).filter(r=>r!==void 0)}stepConverter(t){return async e=>{let a;if(typeof t=="function"?a=t():a=t,a=R(a),a.operations)for(let o of a.operations)await z(o,this.operationStringConvert?p=>this.operationStringConvert(p,a,e):void 0);let r=this.getChoices(a.choices),c=l(a.glueEnabled),u=this.getDialogue(a.dialogue),f=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(o=>{let p=l(o);p&&f.push(p);}));let d=l(a.goNextStep),y=l(a.end);if(r){let o=r.map(p=>{let m="";if(Array.isArray(p.text)){let T=[];p.text.forEach(x=>{if(typeof x=="string")T.push(v.t(x));else if(x&&typeof x=="object"){let b=l(x);b&&!Array.isArray(b)&&typeof b=="object"&&(b=l(b)||""),b&&(Array.isArray(b)?T=T.concat(v.t(b)):T.push(v.t(b)));}}),m=T.join();}else typeof p.text=="string"&&(m=v.t(p.text));return new pixiVn.ChoiceMenuOption(m,p.label,p.props,{type:p.type,oneTime:p.oneTime,onlyHaveNoChoice:p.onlyHaveNoChoice,autoSelect:p.autoSelect})});pixiVn.narration.choiceMenuOptions=o;}else pixiVn.narration.choiceMenuOptions=void 0;u!==void 0&&(pixiVn.narration.dialogue=u,this.skipEmptyDialogs&&typeof u=="string"&&(u===""||RegExp(/^\s+$/).test(u))&&(d=!0)),c?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):c===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let o of f){let p=o.label;typeof p=="object"&&(p=l(p)||"");let m=o.params?.map(T=>l(T));e={...e,...o.props},o.type==="jump"?(pixiVn.narration.closeCurrentLabel(),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,m),await pixiVn.narration.callLabel(p,e)):(pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,m),await pixiVn.narration.callLabel(p,e));}y==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e)):y==="label_end"&&pixiVn.narration.closeCurrentLabel(),d&&await pixiVn.narration.goNext(e);}}};module.exports=W;
@@ -1,3 +1,3 @@
1
- import {LabelAbstract,ChoiceMenuOption,narration,setFlag,storage,createExportableElement,getFlag,shakeEffect,ZoomTicker,canvas,RotateTicker,MoveTicker,FadeAlphaTicker,zoomOut,moveOut,removeWithDissolveTransition,removeWithFadeTransition,CanvasVideo,zoomIn,moveIn,showWithDissolveTransition,showWithFadeTransition,pushOut,CanvasImage,pushIn,Assets,sound,NarrationManagerStatic}from'@drincs/pixi-vn';var pe=Object.create;var K=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var $=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var j=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var he=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of de(t))!ye.call(i,r)&&r!==e&&K(i,r,{get:()=>t[r],enumerable:!(a=ue(t,r))||a.enumerable});return i};var me=(i,t,e)=>(e=i!=null?pe(ge(i)):{},he(K(e,"default",{value:i,enumerable:!0}),i));var X=j((O,U)=>{(function(i,t){typeof O=="object"?U.exports=O=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(O,function(){var i=i||function(t,e){var a;if(typeof window<"u"&&window.crypto&&(a=window.crypto),typeof self<"u"&&self.crypto&&(a=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a=globalThis.crypto),!a&&typeof window<"u"&&window.msCrypto&&(a=window.msCrypto),!a&&typeof global<"u"&&global.crypto&&(a=global.crypto),!a&&typeof $=="function")try{a=$("crypto");}catch{}var r=function(){if(a){if(typeof a.getRandomValues=="function")try{return a.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a.randomBytes=="function")try{return a.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),u={},f=u.lib={},d=f.Base=function(){return {extend:function(n){var s=c(this);return n&&s.mixIn(n),(!s.hasOwnProperty("init")||this.init===s.init)&&(s.init=function(){s.$super.init.apply(this,arguments);}),s.init.prototype=s,s.$super=this,s},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var s in n)n.hasOwnProperty(s)&&(this[s]=n[s]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),y=f.WordArray=d.extend({init:function(n,s){n=this.words=n||[],s!=e?this.sigBytes=s:this.sigBytes=n.length*4;},toString:function(n){return (n||p).stringify(this)},concat:function(n){var s=this.words,g=n.words,h=this.sigBytes,V=n.sigBytes;if(this.clamp(),h%4)for(var P=0;P<V;P++){var G=g[P>>>2]>>>24-P%4*8&255;s[h+P>>>2]|=G<<24-(h+P)%4*8;}else for(var C=0;C<V;C+=4)s[h+C>>>2]=g[C>>>2];return this.sigBytes+=V,this},clamp:function(){var n=this.words,s=this.sigBytes;n[s>>>2]&=4294967295<<32-s%4*8,n.length=t.ceil(s/4);},clone:function(){var n=d.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var s=[],g=0;g<n;g+=4)s.push(r());return new y.init(s,n)}}),o=u.enc={},p=o.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push((P>>>4).toString(16)),h.push((P&15).toString(16));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h+=2)g[h>>>3]|=parseInt(n.substr(h,2),16)<<24-h%8*4;return new y.init(g,s/2)}},m=o.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push(String.fromCharCode(P));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h++)g[h>>>2]|=(n.charCodeAt(h)&255)<<24-h%4*8;return new y.init(g,s)}},T=o.Utf8={stringify:function(n){try{return decodeURIComponent(escape(m.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return m.parse(unescape(encodeURIComponent(n)))}},x=f.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=T.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var s,g=this._data,h=g.words,V=g.sigBytes,P=this.blockSize,G=P*4,C=V/G;n?C=t.ceil(C):C=t.max((C|0)-this._minBufferSize,0);var _=C*P,M=t.min(_*4,V);if(_){for(var H=0;H<_;H+=P)this._doProcessBlock(h,H);s=h.splice(0,_),g.sigBytes-=M;}return new y.init(s,M)},clone:function(){var n=d.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});f.Hasher=x.extend({cfg:d.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var s=this._doFinalize();return s},blockSize:512/32,_createHelper:function(n){return function(s,g){return new n.init(g).finalize(s)}},_createHmacHelper:function(n){return function(s,g){return new N.HMAC.init(n,g).finalize(s)}}});var N=u.algo={};return u}(Math);return i});});var Y=j((L,q)=>{(function(i,t){typeof L=="object"?q.exports=L=t(X()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(L,function(i){return function(){var t=i,e=t.lib,a=e.WordArray,r=e.Hasher,c=t.algo,u=[],f=c.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,y){for(var o=this._hash.words,p=o[0],m=o[1],T=o[2],x=o[3],b=o[4],N=0;N<80;N++){if(N<16)u[N]=d[y+N]|0;else {var n=u[N-3]^u[N-8]^u[N-14]^u[N-16];u[N]=n<<1|n>>>31;}var s=(p<<5|p>>>27)+b+u[N];N<20?s+=(m&T|~m&x)+1518500249:N<40?s+=(m^T^x)+1859775393:N<60?s+=(m&T|m&x|T&x)-1894007588:s+=(m^T^x)-899497514,b=x,x=T,T=m<<30|m>>>2,m=p,p=s;}o[0]=o[0]+p|0,o[1]=o[1]+m|0,o[2]=o[2]+T|0,o[3]=o[3]+x|0,o[4]=o[4]+b|0;},_doFinalize:function(){var d=this._data,y=d.words,o=this._nDataBytes*8,p=d.sigBytes*8;return y[p>>>5]|=128<<24-p%32,y[(p+64>>>9<<4)+14]=Math.floor(o/4294967296),y[(p+64>>>9<<4)+15]=o,d.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});t.SHA1=r._createHelper(f),t.HmacSHA1=r._createHmacHelper(f);}(),i.SHA1});});var ce=me(Y());var E="___param___";var v=class i{static _beforeToTranslate=void 0;static _translate=t=>t;static _afterToTranslate=void 0;static t(t){return Array.isArray(t)?t.map(e=>i.translate(`${e}`)):i.translate(`${t}`)}static set beforeToTranslate(t){i._beforeToTranslate=t;}static set translate(t){i._translate=t;}static get translate(){return t=>{let e=t;return i._beforeToTranslate&&(e=i._beforeToTranslate(e)),e=i._translate(e),i._afterToTranslate&&(e=i._afterToTranslate(e)),e}}static set afterToTranslate(t){i._afterToTranslate=t;}static addKey(t,e,a){let r=a.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(c=>{t[c]===void 0&&(r==="empty_string"?t[c]="":r==="copy_key"&&(i._beforeToTranslate?t[c]=i._beforeToTranslate(c):t[c]=c));});}static getConditionalsThenElse(t,e=[]){if(typeof t=="object"&&t&&"type"in t)if(t.type==="ifelse")t.then&&i.getConditionalsThenElse(t.then,e),t.else&&i.getConditionalsThenElse(t.else,e);else if(t.type==="stepswitch"){if(t.elements)if(Array.isArray(t.elements))t.elements.forEach(a=>{i.getConditionalsThenElse(a,e);});else if(t.elements.type==="ifelse"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else if(t.elements.type==="stepswitch"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else i.getConditionalsThenElse(t.elements,e);}else t.type==="resulttocombine"?(t.firstItem&&i.getConditionalsThenElse(t.firstItem,e),t.secondConditionalItem&&t.secondConditionalItem.forEach(a=>{i.getConditionalsThenElse(a,e);})):e.push(t);else t&&e.push(t);return e}static generateJsonTranslation(t,e={},a={}){return t.forEach(r=>{if(r.choices){let c=[];Array.isArray(r.choices)?c=[r.choices]:c=i.getConditionalsThenElse(r.choices),c.forEach(u=>u.forEach(f=>{if("type"in f){let d=[];f.type==="ifelse"||f.type==="stepswitch"?i.getConditionalsThenElse(f,d):d=[f],d.map(o=>i.getConditionalsThenElse(o.text)).forEach(o=>{Array.isArray(o)&&o.forEach(p=>{Array.isArray(p)?p.forEach(m=>{typeof m=="string"?i.addKey(e,m,a):i.getConditionalsThenElse(m).forEach(T=>{Array.isArray(T)?T.forEach(x=>{typeof x=="string"&&i.addKey(e,x,a);}):typeof T=="string"&&i.addKey(e,T,a);});}):typeof p=="string"&&i.addKey(e,p,a);});});}}));}if(r.dialogue){let c=[];Array.isArray(r.dialogue)?c=[r.dialogue]:c=i.getConditionalsThenElse(r.dialogue),c.forEach(u=>{typeof u=="string"?i.addKey(e,u,a):"text"in u&&Array.isArray(u.text)&&u.text.forEach(f=>{typeof f=="string"?i.addKey(e,f,a):i.getConditionalsThenElse(f).forEach(y=>{typeof y=="string"?i.addKey(e,y,a):Array.isArray(y)&&y.forEach(o=>{typeof o=="string"?i.addKey(e,o,a):i.getConditionalsThenElse(o).forEach(p=>{typeof p=="string"&&i.addKey(e,p,a);});});});});});}r.conditionalStep&&i.getConditionalsThenElse(r.conditionalStep).forEach(u=>{Array.isArray(u)?i.generateJsonTranslation(u,e,a):i.generateJsonTranslation([u],e,a);});}),e}};var D=v;function xe(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function be(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return Ve(i);case"ifelse":return l(i.condition)?l(i.then):l(i.else);case"stepswitch":let e=l(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let a=xe(0,e.length-1);return l(e[a]);case"loop":let r=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return r>e.length-1&&(r=r%e.length),l(e[r]);case"sequential":let c,u=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(c=l(e[e.length-1])),u>e.length-1?c:l(e[u]);case"sequentialrandom":let f=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(f==null&&i.end=="lastItem"){let d=NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!d||!d?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=d.usedRandomNumbers[`0-${e.length-1}`];return l(e[y[y.length-1]])}if(f==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return l(e[f])}}return i}function R(i){if(i.conditionalStep){let t=createExportableElement(l(i.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 e={...i,conditionalStep:void 0,...t};return R(e)}else getFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);}return i}function Ve(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(c=>{let u=l(c);e.push(u);});else {let c=l(r);e.push(c);}});let a=t?[t,...e]:e;if(a.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof a[0]=="string")return D.t(a).join("");if(typeof a[0]=="object"){let r=a,c,u=r.map((n,s)=>{n=R(n);let g=l(n.dialogue)||"";return s===0?(c=l(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),c===!1&&(g=`
1
+ import {LabelAbstract,ChoiceMenuOption,narration,setFlag,storage,createExportableElement,getFlag,shakeEffect,ZoomTicker,canvas,RotateTicker,MoveTicker,FadeAlphaTicker,zoomOut,moveOut,removeWithDissolveTransition,removeWithFadeTransition,CanvasVideo,zoomIn,moveIn,showWithDissolveTransition,showWithFadeTransition,pushOut,CanvasImage,pushIn,Assets,sound,NarrationManagerStatic}from'@drincs/pixi-vn';var ce=Object.create;var K=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty;var $=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var j=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ye=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ue(t))!ge.call(i,r)&&r!==e&&K(i,r,{get:()=>t[r],enumerable:!(a=pe(t,r))||a.enumerable});return i};var he=(i,t,e)=>(e=i!=null?ce(de(i)):{},ye(K(e,"default",{value:i,enumerable:!0}),i));var X=j((O,U)=>{(function(i,t){typeof O=="object"?U.exports=O=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(O,function(){var i=i||function(t,e){var a;if(typeof window<"u"&&window.crypto&&(a=window.crypto),typeof self<"u"&&self.crypto&&(a=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a=globalThis.crypto),!a&&typeof window<"u"&&window.msCrypto&&(a=window.msCrypto),!a&&typeof global<"u"&&global.crypto&&(a=global.crypto),!a&&typeof $=="function")try{a=$("crypto");}catch{}var r=function(){if(a){if(typeof a.getRandomValues=="function")try{return a.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a.randomBytes=="function")try{return a.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),u={},f=u.lib={},d=f.Base=function(){return {extend:function(n){var s=c(this);return n&&s.mixIn(n),(!s.hasOwnProperty("init")||this.init===s.init)&&(s.init=function(){s.$super.init.apply(this,arguments);}),s.init.prototype=s,s.$super=this,s},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var s in n)n.hasOwnProperty(s)&&(this[s]=n[s]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),y=f.WordArray=d.extend({init:function(n,s){n=this.words=n||[],s!=e?this.sigBytes=s:this.sigBytes=n.length*4;},toString:function(n){return (n||p).stringify(this)},concat:function(n){var s=this.words,g=n.words,h=this.sigBytes,V=n.sigBytes;if(this.clamp(),h%4)for(var P=0;P<V;P++){var G=g[P>>>2]>>>24-P%4*8&255;s[h+P>>>2]|=G<<24-(h+P)%4*8;}else for(var C=0;C<V;C+=4)s[h+C>>>2]=g[C>>>2];return this.sigBytes+=V,this},clamp:function(){var n=this.words,s=this.sigBytes;n[s>>>2]&=4294967295<<32-s%4*8,n.length=t.ceil(s/4);},clone:function(){var n=d.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var s=[],g=0;g<n;g+=4)s.push(r());return new y.init(s,n)}}),o=u.enc={},p=o.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push((P>>>4).toString(16)),h.push((P&15).toString(16));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h+=2)g[h>>>3]|=parseInt(n.substr(h,2),16)<<24-h%8*4;return new y.init(g,s/2)}},m=o.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push(String.fromCharCode(P));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h++)g[h>>>2]|=(n.charCodeAt(h)&255)<<24-h%4*8;return new y.init(g,s)}},T=o.Utf8={stringify:function(n){try{return decodeURIComponent(escape(m.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return m.parse(unescape(encodeURIComponent(n)))}},x=f.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=T.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var s,g=this._data,h=g.words,V=g.sigBytes,P=this.blockSize,G=P*4,C=V/G;n?C=t.ceil(C):C=t.max((C|0)-this._minBufferSize,0);var _=C*P,M=t.min(_*4,V);if(_){for(var H=0;H<_;H+=P)this._doProcessBlock(h,H);s=h.splice(0,_),g.sigBytes-=M;}return new y.init(s,M)},clone:function(){var n=d.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});f.Hasher=x.extend({cfg:d.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var s=this._doFinalize();return s},blockSize:512/32,_createHelper:function(n){return function(s,g){return new n.init(g).finalize(s)}},_createHmacHelper:function(n){return function(s,g){return new N.HMAC.init(n,g).finalize(s)}}});var N=u.algo={};return u}(Math);return i});});var Y=j((L,q)=>{(function(i,t){typeof L=="object"?q.exports=L=t(X()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(L,function(i){return function(){var t=i,e=t.lib,a=e.WordArray,r=e.Hasher,c=t.algo,u=[],f=c.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,y){for(var o=this._hash.words,p=o[0],m=o[1],T=o[2],x=o[3],b=o[4],N=0;N<80;N++){if(N<16)u[N]=d[y+N]|0;else {var n=u[N-3]^u[N-8]^u[N-14]^u[N-16];u[N]=n<<1|n>>>31;}var s=(p<<5|p>>>27)+b+u[N];N<20?s+=(m&T|~m&x)+1518500249:N<40?s+=(m^T^x)+1859775393:N<60?s+=(m&T|m&x|T&x)-1894007588:s+=(m^T^x)-899497514,b=x,x=T,T=m<<30|m>>>2,m=p,p=s;}o[0]=o[0]+p|0,o[1]=o[1]+m|0,o[2]=o[2]+T|0,o[3]=o[3]+x|0,o[4]=o[4]+b|0;},_doFinalize:function(){var d=this._data,y=d.words,o=this._nDataBytes*8,p=d.sigBytes*8;return y[p>>>5]|=128<<24-p%32,y[(p+64>>>9<<4)+14]=Math.floor(o/4294967296),y[(p+64>>>9<<4)+15]=o,d.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});t.SHA1=r._createHelper(f),t.HmacSHA1=r._createHmacHelper(f);}(),i.SHA1});});var fe=he(Y());var E="___param___";var v=class i{static _beforeToTranslate=void 0;static _translate=t=>t;static _afterToTranslate=void 0;static t(t){return Array.isArray(t)?t.map(e=>i.translate(`${e}`)):i.translate(`${t}`)}static set beforeToTranslate(t){i._beforeToTranslate=t;}static set translate(t){i._translate=t;}static get translate(){return t=>{let e=t;return i._beforeToTranslate&&(e=i._beforeToTranslate(e)),e=i._translate(e),i._afterToTranslate&&(e=i._afterToTranslate(e)),e}}static set afterToTranslate(t){i._afterToTranslate=t;}static addKey(t,e,a){let r=a.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(c=>{t[c]===void 0&&(r==="empty_string"?t[c]="":r==="copy_key"&&(i._beforeToTranslate?t[c]=i._beforeToTranslate(c):t[c]=c));});}static getConditionalsThenElse(t,e=[]){if(typeof t=="object"&&t&&"type"in t)if(t.type==="ifelse")t.then&&i.getConditionalsThenElse(t.then,e),t.else&&i.getConditionalsThenElse(t.else,e);else if(t.type==="stepswitch"){if(t.elements)if(Array.isArray(t.elements))t.elements.forEach(a=>{i.getConditionalsThenElse(a,e);});else if(t.elements.type==="ifelse"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else if(t.elements.type==="stepswitch"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else i.getConditionalsThenElse(t.elements,e);}else t.type==="resulttocombine"?(t.firstItem&&i.getConditionalsThenElse(t.firstItem,e),t.secondConditionalItem&&t.secondConditionalItem.forEach(a=>{i.getConditionalsThenElse(a,e);})):e.push(t);else t&&e.push(t);return e}static generateJsonTranslation(t,e={},a={}){return t.forEach(r=>{if(r.choices){let c=[];Array.isArray(r.choices)?c=[r.choices]:c=i.getConditionalsThenElse(r.choices),c.forEach(u=>u.forEach(f=>{if("type"in f){let d=[];f.type==="ifelse"||f.type==="stepswitch"?i.getConditionalsThenElse(f,d):d=[f],d.map(o=>i.getConditionalsThenElse(o.text)).forEach(o=>{Array.isArray(o)&&o.forEach(p=>{Array.isArray(p)?p.forEach(m=>{typeof m=="string"?i.addKey(e,m,a):i.getConditionalsThenElse(m).forEach(T=>{Array.isArray(T)?T.forEach(x=>{typeof x=="string"&&i.addKey(e,x,a);}):typeof T=="string"&&i.addKey(e,T,a);});}):typeof p=="string"&&i.addKey(e,p,a);});});}}));}if(r.dialogue){let c=[];Array.isArray(r.dialogue)?c=[r.dialogue]:c=i.getConditionalsThenElse(r.dialogue),c.forEach(u=>{typeof u=="string"?i.addKey(e,u,a):"text"in u&&Array.isArray(u.text)&&u.text.forEach(f=>{typeof f=="string"?i.addKey(e,f,a):i.getConditionalsThenElse(f).forEach(y=>{typeof y=="string"?i.addKey(e,y,a):Array.isArray(y)&&y.forEach(o=>{typeof o=="string"?i.addKey(e,o,a):i.getConditionalsThenElse(o).forEach(p=>{typeof p=="string"&&i.addKey(e,p,a);});});});});});}r.conditionalStep&&i.getConditionalsThenElse(r.conditionalStep).forEach(u=>{Array.isArray(u)?i.generateJsonTranslation(u,e,a):i.generateJsonTranslation([u],e,a);});}),e}};var D=v;function Te(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function xe(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return be(i);case"ifelse":return l(i.condition)?l(i.then):l(i.else);case"stepswitch":let e=l(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let a=Te(0,e.length-1);return l(e[a]);case"loop":let r=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return r>e.length-1&&(r=r%e.length),l(e[r]);case"sequential":let c,u=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(c=l(e[e.length-1])),u>e.length-1?c:l(e[u]);case"sequentialrandom":let f=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(f==null&&i.end=="lastItem"){let d=NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!d||!d?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=d.usedRandomNumbers[`0-${e.length-1}`];return l(e[y[y.length-1]])}if(f==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return l(e[f])}}return i}function R(i){if(i.conditionalStep){let t=createExportableElement(l(i.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 e={...i,conditionalStep:void 0,...t};return R(e)}else getFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);}return i}function be(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(c=>{let u=l(c);e.push(u);});else {let c=l(r);e.push(c);}});let a=t?[t,...e]:e;if(a.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof a[0]=="string")return D.t(a).join("");if(typeof a[0]=="object"){let r=a,c,u=r.map((n,s)=>{n=R(n);let g=l(n.dialogue)||"";return s===0?(c=l(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),c===!1&&(g=`
2
2
 
3
- `+g),c=l(n.glueEnabled)||!1,g)}),f=l(u[0]),d=typeof f=="object"&&"character"in f?f.character:void 0,y=u.map(n=>{let s;n&&typeof n=="object"&&"text"in n?s=n.text:s=n;let g;return Array.isArray(s)?g=s.map(h=>{let V=l(h);return D.t(`${V}`)}).join(""):g=l(s)||"",D.t(g)}).join(""),o=r.find(n=>n.end),p=r.find(n=>n.choices),m=!1,T=!1;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),m=r[r.length-1].glueEnabled,T=r.reverse().find(n=>!(n.operations&&(!n.dialogue||!n.choices)))?.goNextStep);let x=r.find(n=>n.labelToOpen),b=[];return r.forEach(n=>{n.operations&&b.forEach(s=>{b.push(s);});}),{dialogue:d?{character:d,text:y}:y,end:o?.end,choices:p?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function Ne(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=l(i.leftValue),e=l(i.rightValue);switch(i.operator){case"==":return t===e;case"!=":return t!==e;case"<":return t<e;case"<=":return t<=e;case">":return t>e;case">=":return t>=e;case"CONTAINS":return t.toString().includes(e.toString())}break;case"valueCondition":return !!l(i.value);case"union":return ve(i)}return !!i}function Pe(i){if(i&&typeof i=="object"&&"type"in i&&i.type==="value"&&i.storageOperationType==="get")switch(i.storageType){case"storage":case"tempstorage":return storage.getVariable(i.key);case"flagStorage":return getFlag(i.key);case"label":return narration.getTimesLabelOpened(i.label);case"choice":return narration.getTimesChoiceMade(i.index);case"logic":return l(i.operation);case"params":let t=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];if(t&&t.length>i.key)return t[i.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return i}function ve(i){if(i.unionType==="not")return !l(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=l(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function Q(i){let t=l(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=l(t):e=t,i.storageType){case"flagStorage":setFlag(i.key,i.value);break;case"storage":storage.setVariable(i.key,e);break;case"tempstorage":storage.setTempVariable(i.key,e);break;case"params":let a=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];a&&a.length-1>=i.key&&(a[i.key]=e),storage.setTempVariable(`${E}${narration.openedLabels.length-1}`,a);break}}function l(i){let t=be(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return Pe(t);case"arithmetic":case"arithmeticsingle":return Je(t);case"compare":case"valueCondition":case"union":return Ne(t)}return t}function Je(i){let t=l(i.leftValue);switch(i.type){case"arithmetic":let e=l(i.rightValue);switch(i.operator){case"*":return t*e;case"/":return t/e;case"+":return t+e;case"-":return t-e;case"%":return t%e;case"POW":return Math.pow(t,e);case"RANDOM":return narration.getRandomNumber(t,e)}case"arithmeticsingle":switch(i.operator){case"INT":return parseInt(t);case"FLOOR":return Math.floor(t);case"FLOAT":return parseFloat(t)}break}}async function z(i,t){let e=l(i);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":sound.add(e.alias,{...e.props,url:e.url});break;case"play":sound.play(e.alias,e.props);break;case"remove":sound.remove(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}break;case"assets":switch(e.operationType){case"load":await Assets.load(e.assets);break}break;case"image":switch(e.operationType){case"show":let f=new CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,f,e.transition.props,e.transition.priority);break;case"pushin":case"pushout":await pushIn(e.alias,f,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,f),await f.load();break;case"edit":let d=canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":removeWithDissolveTransition(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);break}break;case"video":switch(e.operationType){case"show":let f=new CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,f,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,f),await f.load();break;case"edit":let d=canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":removeWithDissolveTransition(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}else canvas.remove(e.alias);break;case"pause":let y=canvas.find(e.alias);y?y.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let o=canvas.find(e.alias);o?o.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":Q(e);break;case"operationtoconvert":if(t){let f="";e.values.forEach(y=>{if(typeof y=="string")f+=y;else {let o=l(y);f+=`${o}`;}});let d=await t(f);d&&await z(d,t);}break;case"input":switch(e.operationType){case"request":narration.requestInput({type:e.valueType}),narration.inputValue=e.defaultValue;break}break;case"fade":let a=new FadeAlphaTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,a);break;case"move":let r=new MoveTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,r);break;case"rotate":let c=new RotateTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,c);break;case"zoom":let u=new ZoomTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,u);break;case"shake":await shakeEffect(e.alias,e.props,e.priority);break}}var W=class extends LabelAbstract{constructor(t,e,a,r={}){super(t,a),this._steps=e,this.operationStringConvert=r.operationStringConvert,this.skipEmptyDialogs=r.skipEmptyDialogs||!1;}_steps;get steps(){return this._steps.map(t=>this.stepConverter(t))}operationStringConvert;skipEmptyDialogs=!1;getStepSha1(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, ce.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let a=[];t.forEach(r=>{if(typeof r=="string")a.push(r);else if(r&&typeof r=="object"){let c=l(r);c?(c&&!Array.isArray(c)&&typeof c=="object"&&(c=l(c)||""),Array.isArray(c)?a=a.concat(c):a.push(`${c}`)):a.push(`${r}`);}}),e=a;}else {let a=l(t)||"";a&&!Array.isArray(a)&&typeof a=="object"&&(a=l(a)||""),e=a;}return `${e}`}getDialogue(t){if(t==null)return;let e=l(t);return e==null?"":typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:v.t(this.getDialogueText(e.text))}:v.t(this.getDialogueText(e))}getChoices(t){return l(t)?.map(r=>l(r)).filter(r=>r!==void 0)}stepConverter(t){return async e=>{let a;if(typeof t=="function"?a=t():a=t,a=R(a),a.operations)for(let o of a.operations)await z(o,this.operationStringConvert?p=>this.operationStringConvert(p,a,e):void 0);let r=this.getChoices(a.choices),c=l(a.glueEnabled),u=this.getDialogue(a.dialogue),f=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(o=>{let p=l(o);p&&f.push(p);}));let d=l(a.goNextStep),y=l(a.end);if(r){let o=r.map(p=>{let m="";if(Array.isArray(p.text)){let T=[];p.text.forEach(x=>{if(typeof x=="string")T.push(v.t(x));else if(x&&typeof x=="object"){let b=l(x);b&&!Array.isArray(b)&&typeof b=="object"&&(b=l(b)||""),b&&(Array.isArray(b)?T=T.concat(v.t(b)):T.push(v.t(b)));}}),m=T.join();}else typeof p.text=="string"&&(m=v.t(p.text));return new ChoiceMenuOption(m,p.label,p.props,{type:p.type,oneTime:p.oneTime,onlyHaveNoChoice:p.onlyHaveNoChoice,autoSelect:p.autoSelect})});narration.choiceMenuOptions=o;}else narration.choiceMenuOptions=void 0;u!==void 0&&(narration.dialogue=u,this.skipEmptyDialogs&&typeof u=="string"&&(u===""||RegExp(/^\s+$/).test(u))&&(d=!0)),c?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):c===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let o of f){let p=o.label;typeof p=="object"&&(p=l(p)||"");let m=o.params?.map(T=>l(T));e={...e,...o.props},o.type==="jump"?(narration.closeCurrentLabel(),storage.setTempVariable(`${E}${narration.openedLabels.length}`,m),await narration.callLabel(p,e)):(storage.setTempVariable(`${E}${narration.openedLabels.length}`,m),await narration.callLabel(p,e));}y==="game_end"?(narration.closeAllLabels(),await narration.goNext(e)):y==="label_end"&&narration.closeCurrentLabel(),d&&await narration.goNext(e);}}};export{W as default};
3
+ `+g),c=l(n.glueEnabled)||!1,g)}),f=l(u[0]),d=typeof f=="object"&&"character"in f?f.character:void 0,y=u.map(n=>{let s;n&&typeof n=="object"&&"text"in n?s=n.text:s=n;let g;return Array.isArray(s)?g=s.map(h=>{let V=l(h);return D.t(`${V}`)}).join(""):g=l(s)||"",D.t(g)}).join(""),o=r.find(n=>n.end),p=r.find(n=>n.choices),m=!1,T=!1;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),m=r[r.length-1].glueEnabled,T=r.reverse().find(n=>!(n.operations&&(!n.dialogue||!n.choices)))?.goNextStep);let x=r.find(n=>n.labelToOpen),b=[];return r.forEach(n=>{n.operations&&b.forEach(s=>{b.push(s);});}),{dialogue:d?{character:d,text:y}:y,end:o?.end,choices:p?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function Ve(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=l(i.leftValue),e=l(i.rightValue);switch(i.operator){case"==":return t===e;case"!=":return t!==e;case"<":return t<e;case"<=":return t<=e;case">":return t>e;case">=":return t>=e;case"CONTAINS":return t.toString().includes(e.toString())}break;case"valueCondition":return !!l(i.value);case"union":return Pe(i)}return !!i}function Ne(i){if(i&&typeof i=="object"&&"type"in i&&i.type==="value"&&i.storageOperationType==="get")switch(i.storageType){case"storage":case"tempstorage":return storage.getVariable(i.key);case"flagStorage":return getFlag(i.key);case"label":return narration.getTimesLabelOpened(i.label);case"choice":return narration.getTimesChoiceMade(i.index);case"logic":return l(i.operation);case"params":let t=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];if(t&&t.length>i.key)return t[i.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return i}function Pe(i){if(i.unionType==="not")return !l(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=l(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function Q(i){let t=l(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=l(t):e=t,i.storageType){case"flagStorage":setFlag(i.key,i.value);break;case"storage":storage.setVariable(i.key,e);break;case"tempstorage":storage.setTempVariable(i.key,e);break;case"params":let a=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];a&&a.length-1>=i.key&&(a[i.key]=e),storage.setTempVariable(`${E}${narration.openedLabels.length-1}`,a);break}}function l(i){let t=xe(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return Ne(t);case"arithmetic":case"arithmeticsingle":return ve(t);case"compare":case"valueCondition":case"union":return Ve(t)}return t}function ve(i){let t=l(i.leftValue);switch(i.type){case"arithmetic":let e=l(i.rightValue);switch(i.operator){case"*":return t*e;case"/":return t/e;case"+":return t+e;case"-":return t-e;case"%":return t%e;case"POW":return Math.pow(t,e);case"RANDOM":return narration.getRandomNumber(t,e)}case"arithmeticsingle":switch(i.operator){case"INT":return parseInt(t);case"FLOOR":return Math.floor(t);case"FLOAT":return parseFloat(t)}break}}async function z(i,t){let e=l(i);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":sound.add(e.alias,{...e.props,url:e.url});break;case"play":sound.play(e.alias,e.props);break;case"remove":sound.remove(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}break;case"assets":switch(e.operationType){case"load":await Assets.load(e.assets);break}break;case"image":switch(e.operationType){case"show":let f=new CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,f,e.transition.props,e.transition.priority);break;case"pushin":case"pushout":await pushIn(e.alias,f,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,f),await f.load();break;case"edit":let d=canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":removeWithDissolveTransition(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);break}break;case"video":switch(e.operationType){case"show":let f=new CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,f,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,f),await f.load();break;case"edit":let d=canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":removeWithDissolveTransition(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}else canvas.remove(e.alias);break;case"pause":let y=canvas.find(e.alias);y?y.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let o=canvas.find(e.alias);o?o.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":Q(e);break;case"operationtoconvert":if(t){let f="";e.values.forEach(y=>{if(typeof y=="string")f+=y;else {let o=l(y);f+=`${o}`;}});let d=await t(f);d&&await z(d,t);}break;case"input":switch(e.operationType){case"request":narration.requestInput({type:e.valueType},e.defaultValue);break}break;case"fade":let a=new FadeAlphaTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,a);break;case"move":let r=new MoveTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,r);break;case"rotate":let c=new RotateTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,c);break;case"zoom":let u=new ZoomTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,u);break;case"shake":await shakeEffect(e.alias,e.props,e.priority);break}}var W=class extends LabelAbstract{constructor(t,e,a,r={}){super(t,a),this._steps=e,this.operationStringConvert=r.operationStringConvert,this.skipEmptyDialogs=r.skipEmptyDialogs||!1;}_steps;get steps(){return this._steps.map(t=>this.stepConverter(t))}operationStringConvert;skipEmptyDialogs=!1;getStepSha1(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, fe.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let a=[];t.forEach(r=>{if(typeof r=="string")a.push(r);else if(r&&typeof r=="object"){let c=l(r);c?(c&&!Array.isArray(c)&&typeof c=="object"&&(c=l(c)||""),Array.isArray(c)?a=a.concat(c):a.push(`${c}`)):a.push(`${r}`);}}),e=a;}else {let a=l(t)||"";a&&!Array.isArray(a)&&typeof a=="object"&&(a=l(a)||""),e=a;}return `${e}`}getDialogue(t){if(t==null)return;let e=l(t);return e==null?"":typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:v.t(this.getDialogueText(e.text))}:v.t(this.getDialogueText(e))}getChoices(t){return l(t)?.map(r=>l(r)).filter(r=>r!==void 0)}stepConverter(t){return async e=>{let a;if(typeof t=="function"?a=t():a=t,a=R(a),a.operations)for(let o of a.operations)await z(o,this.operationStringConvert?p=>this.operationStringConvert(p,a,e):void 0);let r=this.getChoices(a.choices),c=l(a.glueEnabled),u=this.getDialogue(a.dialogue),f=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(o=>{let p=l(o);p&&f.push(p);}));let d=l(a.goNextStep),y=l(a.end);if(r){let o=r.map(p=>{let m="";if(Array.isArray(p.text)){let T=[];p.text.forEach(x=>{if(typeof x=="string")T.push(v.t(x));else if(x&&typeof x=="object"){let b=l(x);b&&!Array.isArray(b)&&typeof b=="object"&&(b=l(b)||""),b&&(Array.isArray(b)?T=T.concat(v.t(b)):T.push(v.t(b)));}}),m=T.join();}else typeof p.text=="string"&&(m=v.t(p.text));return new ChoiceMenuOption(m,p.label,p.props,{type:p.type,oneTime:p.oneTime,onlyHaveNoChoice:p.onlyHaveNoChoice,autoSelect:p.autoSelect})});narration.choiceMenuOptions=o;}else narration.choiceMenuOptions=void 0;u!==void 0&&(narration.dialogue=u,this.skipEmptyDialogs&&typeof u=="string"&&(u===""||RegExp(/^\s+$/).test(u))&&(d=!0)),c?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):c===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let o of f){let p=o.label;typeof p=="object"&&(p=l(p)||"");let m=o.params?.map(T=>l(T));e={...e,...o.props},o.type==="jump"?(narration.closeCurrentLabel(),storage.setTempVariable(`${E}${narration.openedLabels.length}`,m),await narration.callLabel(p,e)):(storage.setTempVariable(`${E}${narration.openedLabels.length}`,m),await narration.callLabel(p,e));}y==="game_end"?(narration.closeAllLabels(),await narration.goNext(e)):y==="label_end"&&narration.closeCurrentLabel(),d&&await narration.goNext(e);}}};export{W as default};
@@ -1,3 +1,3 @@
1
- 'use strict';var pixiVn=require('@drincs/pixi-vn');var pe=Object.create;var K=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var F=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var j=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var he=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of de(t))!ye.call(i,r)&&r!==e&&K(i,r,{get:()=>t[r],enumerable:!(a=ue(t,r))||a.enumerable});return i};var me=(i,t,e)=>(e=i!=null?pe(ge(i)):{},he(K(e,"default",{value:i,enumerable:!0}),i));var X=j((L,U)=>{(function(i,t){typeof L=="object"?U.exports=L=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(L,function(){var i=i||function(t,e){var a;if(typeof window<"u"&&window.crypto&&(a=window.crypto),typeof self<"u"&&self.crypto&&(a=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a=globalThis.crypto),!a&&typeof window<"u"&&window.msCrypto&&(a=window.msCrypto),!a&&typeof global<"u"&&global.crypto&&(a=global.crypto),!a&&typeof F=="function")try{a=F("crypto");}catch{}var r=function(){if(a){if(typeof a.getRandomValues=="function")try{return a.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a.randomBytes=="function")try{return a.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),u={},f=u.lib={},d=f.Base=function(){return {extend:function(n){var s=c(this);return n&&s.mixIn(n),(!s.hasOwnProperty("init")||this.init===s.init)&&(s.init=function(){s.$super.init.apply(this,arguments);}),s.init.prototype=s,s.$super=this,s},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var s in n)n.hasOwnProperty(s)&&(this[s]=n[s]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),y=f.WordArray=d.extend({init:function(n,s){n=this.words=n||[],s!=e?this.sigBytes=s:this.sigBytes=n.length*4;},toString:function(n){return (n||p).stringify(this)},concat:function(n){var s=this.words,g=n.words,h=this.sigBytes,V=n.sigBytes;if(this.clamp(),h%4)for(var P=0;P<V;P++){var H=g[P>>>2]>>>24-P%4*8&255;s[h+P>>>2]|=H<<24-(h+P)%4*8;}else for(var C=0;C<V;C+=4)s[h+C>>>2]=g[C>>>2];return this.sigBytes+=V,this},clamp:function(){var n=this.words,s=this.sigBytes;n[s>>>2]&=4294967295<<32-s%4*8,n.length=t.ceil(s/4);},clone:function(){var n=d.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var s=[],g=0;g<n;g+=4)s.push(r());return new y.init(s,n)}}),o=u.enc={},p=o.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push((P>>>4).toString(16)),h.push((P&15).toString(16));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h+=2)g[h>>>3]|=parseInt(n.substr(h,2),16)<<24-h%8*4;return new y.init(g,s/2)}},m=o.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push(String.fromCharCode(P));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h++)g[h>>>2]|=(n.charCodeAt(h)&255)<<24-h%4*8;return new y.init(g,s)}},T=o.Utf8={stringify:function(n){try{return decodeURIComponent(escape(m.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return m.parse(unescape(encodeURIComponent(n)))}},x=f.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=T.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var s,g=this._data,h=g.words,V=g.sigBytes,P=this.blockSize,H=P*4,C=V/H;n?C=t.ceil(C):C=t.max((C|0)-this._minBufferSize,0);var _=C*P,M=t.min(_*4,V);if(_){for(var $=0;$<_;$+=P)this._doProcessBlock(h,$);s=h.splice(0,_),g.sigBytes-=M;}return new y.init(s,M)},clone:function(){var n=d.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});f.Hasher=x.extend({cfg:d.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var s=this._doFinalize();return s},blockSize:512/32,_createHelper:function(n){return function(s,g){return new n.init(g).finalize(s)}},_createHmacHelper:function(n){return function(s,g){return new N.HMAC.init(n,g).finalize(s)}}});var N=u.algo={};return u}(Math);return i});});var Y=j((O,q)=>{(function(i,t){typeof O=="object"?q.exports=O=t(X()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(O,function(i){return function(){var t=i,e=t.lib,a=e.WordArray,r=e.Hasher,c=t.algo,u=[],f=c.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,y){for(var o=this._hash.words,p=o[0],m=o[1],T=o[2],x=o[3],b=o[4],N=0;N<80;N++){if(N<16)u[N]=d[y+N]|0;else {var n=u[N-3]^u[N-8]^u[N-14]^u[N-16];u[N]=n<<1|n>>>31;}var s=(p<<5|p>>>27)+b+u[N];N<20?s+=(m&T|~m&x)+1518500249:N<40?s+=(m^T^x)+1859775393:N<60?s+=(m&T|m&x|T&x)-1894007588:s+=(m^T^x)-899497514,b=x,x=T,T=m<<30|m>>>2,m=p,p=s;}o[0]=o[0]+p|0,o[1]=o[1]+m|0,o[2]=o[2]+T|0,o[3]=o[3]+x|0,o[4]=o[4]+b|0;},_doFinalize:function(){var d=this._data,y=d.words,o=this._nDataBytes*8,p=d.sigBytes*8;return y[p>>>5]|=128<<24-p%32,y[(p+64>>>9<<4)+14]=Math.floor(o/4294967296),y[(p+64>>>9<<4)+15]=o,d.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});t.SHA1=r._createHelper(f),t.HmacSHA1=r._createHmacHelper(f);}(),i.SHA1});});var ce=me(Y());var E="___param___";var J=class i{static _beforeToTranslate=void 0;static _translate=t=>t;static _afterToTranslate=void 0;static t(t){return Array.isArray(t)?t.map(e=>i.translate(`${e}`)):i.translate(`${t}`)}static set beforeToTranslate(t){i._beforeToTranslate=t;}static set translate(t){i._translate=t;}static get translate(){return t=>{let e=t;return i._beforeToTranslate&&(e=i._beforeToTranslate(e)),e=i._translate(e),i._afterToTranslate&&(e=i._afterToTranslate(e)),e}}static set afterToTranslate(t){i._afterToTranslate=t;}static addKey(t,e,a){let r=a.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(c=>{t[c]===void 0&&(r==="empty_string"?t[c]="":r==="copy_key"&&(i._beforeToTranslate?t[c]=i._beforeToTranslate(c):t[c]=c));});}static getConditionalsThenElse(t,e=[]){if(typeof t=="object"&&t&&"type"in t)if(t.type==="ifelse")t.then&&i.getConditionalsThenElse(t.then,e),t.else&&i.getConditionalsThenElse(t.else,e);else if(t.type==="stepswitch"){if(t.elements)if(Array.isArray(t.elements))t.elements.forEach(a=>{i.getConditionalsThenElse(a,e);});else if(t.elements.type==="ifelse"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else if(t.elements.type==="stepswitch"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else i.getConditionalsThenElse(t.elements,e);}else t.type==="resulttocombine"?(t.firstItem&&i.getConditionalsThenElse(t.firstItem,e),t.secondConditionalItem&&t.secondConditionalItem.forEach(a=>{i.getConditionalsThenElse(a,e);})):e.push(t);else t&&e.push(t);return e}static generateJsonTranslation(t,e={},a={}){return t.forEach(r=>{if(r.choices){let c=[];Array.isArray(r.choices)?c=[r.choices]:c=i.getConditionalsThenElse(r.choices),c.forEach(u=>u.forEach(f=>{if("type"in f){let d=[];f.type==="ifelse"||f.type==="stepswitch"?i.getConditionalsThenElse(f,d):d=[f],d.map(o=>i.getConditionalsThenElse(o.text)).forEach(o=>{Array.isArray(o)&&o.forEach(p=>{Array.isArray(p)?p.forEach(m=>{typeof m=="string"?i.addKey(e,m,a):i.getConditionalsThenElse(m).forEach(T=>{Array.isArray(T)?T.forEach(x=>{typeof x=="string"&&i.addKey(e,x,a);}):typeof T=="string"&&i.addKey(e,T,a);});}):typeof p=="string"&&i.addKey(e,p,a);});});}}));}if(r.dialogue){let c=[];Array.isArray(r.dialogue)?c=[r.dialogue]:c=i.getConditionalsThenElse(r.dialogue),c.forEach(u=>{typeof u=="string"?i.addKey(e,u,a):"text"in u&&Array.isArray(u.text)&&u.text.forEach(f=>{typeof f=="string"?i.addKey(e,f,a):i.getConditionalsThenElse(f).forEach(y=>{typeof y=="string"?i.addKey(e,y,a):Array.isArray(y)&&y.forEach(o=>{typeof o=="string"?i.addKey(e,o,a):i.getConditionalsThenElse(o).forEach(p=>{typeof p=="string"&&i.addKey(e,p,a);});});});});});}r.conditionalStep&&i.getConditionalsThenElse(r.conditionalStep).forEach(u=>{Array.isArray(u)?i.generateJsonTranslation(u,e,a):i.generateJsonTranslation([u],e,a);});}),e}};var D=J;function xe(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function be(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return Ve(i);case"ifelse":return l(i.condition)?l(i.then):l(i.else);case"stepswitch":let e=l(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let a=xe(0,e.length-1);return l(e[a]);case"loop":let r=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return r>e.length-1&&(r=r%e.length),l(e[r]);case"sequential":let c,u=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(c=l(e[e.length-1])),u>e.length-1?c:l(e[u]);case"sequentialrandom":let f=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(f==null&&i.end=="lastItem"){let d=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!d||!d?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=d.usedRandomNumbers[`0-${e.length-1}`];return l(e[y[y.length-1]])}if(f==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return l(e[f])}}return i}function R(i){if(i.conditionalStep){let t=pixiVn.createExportableElement(l(i.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 e={...i,conditionalStep:void 0,...t};return R(e)}else pixiVn.getFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);}return i}function Ve(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(c=>{let u=l(c);e.push(u);});else {let c=l(r);e.push(c);}});let a=t?[t,...e]:e;if(a.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof a[0]=="string")return D.t(a).join("");if(typeof a[0]=="object"){let r=a,c,u=r.map((n,s)=>{n=R(n);let g=l(n.dialogue)||"";return s===0?(c=l(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),c===!1&&(g=`
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn');var ce=Object.create;var K=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty;var F=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var j=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ye=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ue(t))!ge.call(i,r)&&r!==e&&K(i,r,{get:()=>t[r],enumerable:!(a=pe(t,r))||a.enumerable});return i};var he=(i,t,e)=>(e=i!=null?ce(de(i)):{},ye(K(e,"default",{value:i,enumerable:!0}),i));var X=j((L,U)=>{(function(i,t){typeof L=="object"?U.exports=L=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(L,function(){var i=i||function(t,e){var a;if(typeof window<"u"&&window.crypto&&(a=window.crypto),typeof self<"u"&&self.crypto&&(a=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a=globalThis.crypto),!a&&typeof window<"u"&&window.msCrypto&&(a=window.msCrypto),!a&&typeof global<"u"&&global.crypto&&(a=global.crypto),!a&&typeof F=="function")try{a=F("crypto");}catch{}var r=function(){if(a){if(typeof a.getRandomValues=="function")try{return a.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a.randomBytes=="function")try{return a.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),u={},f=u.lib={},d=f.Base=function(){return {extend:function(n){var s=c(this);return n&&s.mixIn(n),(!s.hasOwnProperty("init")||this.init===s.init)&&(s.init=function(){s.$super.init.apply(this,arguments);}),s.init.prototype=s,s.$super=this,s},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var s in n)n.hasOwnProperty(s)&&(this[s]=n[s]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),y=f.WordArray=d.extend({init:function(n,s){n=this.words=n||[],s!=e?this.sigBytes=s:this.sigBytes=n.length*4;},toString:function(n){return (n||p).stringify(this)},concat:function(n){var s=this.words,g=n.words,h=this.sigBytes,V=n.sigBytes;if(this.clamp(),h%4)for(var P=0;P<V;P++){var H=g[P>>>2]>>>24-P%4*8&255;s[h+P>>>2]|=H<<24-(h+P)%4*8;}else for(var C=0;C<V;C+=4)s[h+C>>>2]=g[C>>>2];return this.sigBytes+=V,this},clamp:function(){var n=this.words,s=this.sigBytes;n[s>>>2]&=4294967295<<32-s%4*8,n.length=t.ceil(s/4);},clone:function(){var n=d.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var s=[],g=0;g<n;g+=4)s.push(r());return new y.init(s,n)}}),o=u.enc={},p=o.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push((P>>>4).toString(16)),h.push((P&15).toString(16));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h+=2)g[h>>>3]|=parseInt(n.substr(h,2),16)<<24-h%8*4;return new y.init(g,s/2)}},m=o.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push(String.fromCharCode(P));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h++)g[h>>>2]|=(n.charCodeAt(h)&255)<<24-h%4*8;return new y.init(g,s)}},T=o.Utf8={stringify:function(n){try{return decodeURIComponent(escape(m.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return m.parse(unescape(encodeURIComponent(n)))}},x=f.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=T.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var s,g=this._data,h=g.words,V=g.sigBytes,P=this.blockSize,H=P*4,C=V/H;n?C=t.ceil(C):C=t.max((C|0)-this._minBufferSize,0);var _=C*P,M=t.min(_*4,V);if(_){for(var $=0;$<_;$+=P)this._doProcessBlock(h,$);s=h.splice(0,_),g.sigBytes-=M;}return new y.init(s,M)},clone:function(){var n=d.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});f.Hasher=x.extend({cfg:d.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var s=this._doFinalize();return s},blockSize:512/32,_createHelper:function(n){return function(s,g){return new n.init(g).finalize(s)}},_createHmacHelper:function(n){return function(s,g){return new N.HMAC.init(n,g).finalize(s)}}});var N=u.algo={};return u}(Math);return i});});var Y=j((O,q)=>{(function(i,t){typeof O=="object"?q.exports=O=t(X()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(O,function(i){return function(){var t=i,e=t.lib,a=e.WordArray,r=e.Hasher,c=t.algo,u=[],f=c.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,y){for(var o=this._hash.words,p=o[0],m=o[1],T=o[2],x=o[3],b=o[4],N=0;N<80;N++){if(N<16)u[N]=d[y+N]|0;else {var n=u[N-3]^u[N-8]^u[N-14]^u[N-16];u[N]=n<<1|n>>>31;}var s=(p<<5|p>>>27)+b+u[N];N<20?s+=(m&T|~m&x)+1518500249:N<40?s+=(m^T^x)+1859775393:N<60?s+=(m&T|m&x|T&x)-1894007588:s+=(m^T^x)-899497514,b=x,x=T,T=m<<30|m>>>2,m=p,p=s;}o[0]=o[0]+p|0,o[1]=o[1]+m|0,o[2]=o[2]+T|0,o[3]=o[3]+x|0,o[4]=o[4]+b|0;},_doFinalize:function(){var d=this._data,y=d.words,o=this._nDataBytes*8,p=d.sigBytes*8;return y[p>>>5]|=128<<24-p%32,y[(p+64>>>9<<4)+14]=Math.floor(o/4294967296),y[(p+64>>>9<<4)+15]=o,d.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});t.SHA1=r._createHelper(f),t.HmacSHA1=r._createHmacHelper(f);}(),i.SHA1});});var fe=he(Y());var E="___param___";var J=class i{static _beforeToTranslate=void 0;static _translate=t=>t;static _afterToTranslate=void 0;static t(t){return Array.isArray(t)?t.map(e=>i.translate(`${e}`)):i.translate(`${t}`)}static set beforeToTranslate(t){i._beforeToTranslate=t;}static set translate(t){i._translate=t;}static get translate(){return t=>{let e=t;return i._beforeToTranslate&&(e=i._beforeToTranslate(e)),e=i._translate(e),i._afterToTranslate&&(e=i._afterToTranslate(e)),e}}static set afterToTranslate(t){i._afterToTranslate=t;}static addKey(t,e,a){let r=a.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(c=>{t[c]===void 0&&(r==="empty_string"?t[c]="":r==="copy_key"&&(i._beforeToTranslate?t[c]=i._beforeToTranslate(c):t[c]=c));});}static getConditionalsThenElse(t,e=[]){if(typeof t=="object"&&t&&"type"in t)if(t.type==="ifelse")t.then&&i.getConditionalsThenElse(t.then,e),t.else&&i.getConditionalsThenElse(t.else,e);else if(t.type==="stepswitch"){if(t.elements)if(Array.isArray(t.elements))t.elements.forEach(a=>{i.getConditionalsThenElse(a,e);});else if(t.elements.type==="ifelse"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else if(t.elements.type==="stepswitch"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else i.getConditionalsThenElse(t.elements,e);}else t.type==="resulttocombine"?(t.firstItem&&i.getConditionalsThenElse(t.firstItem,e),t.secondConditionalItem&&t.secondConditionalItem.forEach(a=>{i.getConditionalsThenElse(a,e);})):e.push(t);else t&&e.push(t);return e}static generateJsonTranslation(t,e={},a={}){return t.forEach(r=>{if(r.choices){let c=[];Array.isArray(r.choices)?c=[r.choices]:c=i.getConditionalsThenElse(r.choices),c.forEach(u=>u.forEach(f=>{if("type"in f){let d=[];f.type==="ifelse"||f.type==="stepswitch"?i.getConditionalsThenElse(f,d):d=[f],d.map(o=>i.getConditionalsThenElse(o.text)).forEach(o=>{Array.isArray(o)&&o.forEach(p=>{Array.isArray(p)?p.forEach(m=>{typeof m=="string"?i.addKey(e,m,a):i.getConditionalsThenElse(m).forEach(T=>{Array.isArray(T)?T.forEach(x=>{typeof x=="string"&&i.addKey(e,x,a);}):typeof T=="string"&&i.addKey(e,T,a);});}):typeof p=="string"&&i.addKey(e,p,a);});});}}));}if(r.dialogue){let c=[];Array.isArray(r.dialogue)?c=[r.dialogue]:c=i.getConditionalsThenElse(r.dialogue),c.forEach(u=>{typeof u=="string"?i.addKey(e,u,a):"text"in u&&Array.isArray(u.text)&&u.text.forEach(f=>{typeof f=="string"?i.addKey(e,f,a):i.getConditionalsThenElse(f).forEach(y=>{typeof y=="string"?i.addKey(e,y,a):Array.isArray(y)&&y.forEach(o=>{typeof o=="string"?i.addKey(e,o,a):i.getConditionalsThenElse(o).forEach(p=>{typeof p=="string"&&i.addKey(e,p,a);});});});});});}r.conditionalStep&&i.getConditionalsThenElse(r.conditionalStep).forEach(u=>{Array.isArray(u)?i.generateJsonTranslation(u,e,a):i.generateJsonTranslation([u],e,a);});}),e}};var D=J;function Te(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function xe(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return be(i);case"ifelse":return l(i.condition)?l(i.then):l(i.else);case"stepswitch":let e=l(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let a=Te(0,e.length-1);return l(e[a]);case"loop":let r=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return r>e.length-1&&(r=r%e.length),l(e[r]);case"sequential":let c,u=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(c=l(e[e.length-1])),u>e.length-1?c:l(e[u]);case"sequentialrandom":let f=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(f==null&&i.end=="lastItem"){let d=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!d||!d?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=d.usedRandomNumbers[`0-${e.length-1}`];return l(e[y[y.length-1]])}if(f==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return l(e[f])}}return i}function R(i){if(i.conditionalStep){let t=pixiVn.createExportableElement(l(i.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 e={...i,conditionalStep:void 0,...t};return R(e)}else pixiVn.getFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);}return i}function be(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(c=>{let u=l(c);e.push(u);});else {let c=l(r);e.push(c);}});let a=t?[t,...e]:e;if(a.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof a[0]=="string")return D.t(a).join("");if(typeof a[0]=="object"){let r=a,c,u=r.map((n,s)=>{n=R(n);let g=l(n.dialogue)||"";return s===0?(c=l(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),c===!1&&(g=`
2
2
 
3
- `+g),c=l(n.glueEnabled)||!1,g)}),f=l(u[0]),d=typeof f=="object"&&"character"in f?f.character:void 0,y=u.map(n=>{let s;n&&typeof n=="object"&&"text"in n?s=n.text:s=n;let g;return Array.isArray(s)?g=s.map(h=>{let V=l(h);return D.t(`${V}`)}).join(""):g=l(s)||"",D.t(g)}).join(""),o=r.find(n=>n.end),p=r.find(n=>n.choices),m=!1,T=!1;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),m=r[r.length-1].glueEnabled,T=r.reverse().find(n=>!(n.operations&&(!n.dialogue||!n.choices)))?.goNextStep);let x=r.find(n=>n.labelToOpen),b=[];return r.forEach(n=>{n.operations&&b.forEach(s=>{b.push(s);});}),{dialogue:d?{character:d,text:y}:y,end:o?.end,choices:p?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function Ne(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=l(i.leftValue),e=l(i.rightValue);switch(i.operator){case"==":return t===e;case"!=":return t!==e;case"<":return t<e;case"<=":return t<=e;case">":return t>e;case">=":return t>=e;case"CONTAINS":return t.toString().includes(e.toString())}break;case"valueCondition":return !!l(i.value);case"union":return Je(i)}return !!i}function Pe(i){if(i&&typeof i=="object"&&"type"in i&&i.type==="value"&&i.storageOperationType==="get")switch(i.storageType){case"storage":case"tempstorage":return pixiVn.storage.getVariable(i.key);case"flagStorage":return pixiVn.getFlag(i.key);case"label":return pixiVn.narration.getTimesLabelOpened(i.label);case"choice":return pixiVn.narration.getTimesChoiceMade(i.index);case"logic":return l(i.operation);case"params":let t=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];if(t&&t.length>i.key)return t[i.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return i}function Je(i){if(i.unionType==="not")return !l(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=l(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function Q(i){let t=l(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=l(t):e=t,i.storageType){case"flagStorage":pixiVn.setFlag(i.key,i.value);break;case"storage":pixiVn.storage.setVariable(i.key,e);break;case"tempstorage":pixiVn.storage.setTempVariable(i.key,e);break;case"params":let a=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];a&&a.length-1>=i.key&&(a[i.key]=e),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length-1}`,a);break}}function l(i){let t=be(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return Pe(t);case"arithmetic":case"arithmeticsingle":return ve(t);case"compare":case"valueCondition":case"union":return Ne(t)}return t}function ve(i){let t=l(i.leftValue);switch(i.type){case"arithmetic":let e=l(i.rightValue);switch(i.operator){case"*":return t*e;case"/":return t/e;case"+":return t+e;case"-":return t-e;case"%":return t%e;case"POW":return Math.pow(t,e);case"RANDOM":return pixiVn.narration.getRandomNumber(t,e)}case"arithmeticsingle":switch(i.operator){case"INT":return parseInt(t);case"FLOOR":return Math.floor(t);case"FLOAT":return parseFloat(t)}break}}async function W(i,t){let e=l(i);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":pixiVn.sound.add(e.alias,{...e.props,url:e.url});break;case"play":pixiVn.sound.play(e.alias,e.props);break;case"remove":pixiVn.sound.remove(e.alias);break;case"pause":pixiVn.sound.pause(e.alias);break;case"resume":pixiVn.sound.resume(e.alias);break;case"volume":pixiVn.sound.volume(e.alias,e.value);break}break;case"assets":switch(e.operationType){case"load":await pixiVn.Assets.load(e.assets);break}break;case"image":switch(e.operationType){case"show":let f=new pixiVn.CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,f,e.transition.props,e.transition.priority);break;case"pushin":case"pushout":await pixiVn.pushIn(e.alias,f,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,f),await f.load();break;case"edit":let d=pixiVn.canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":pixiVn.removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case"pushin":case"pushout":pixiVn.pushOut(e.alias,e.transition.props,e.transition.priority);break}else pixiVn.canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":let f=new pixiVn.CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,f,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,f),await f.load();break;case"edit":let d=pixiVn.canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":pixiVn.removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(e.alias,e.transition.props,e.transition.priority);break}else pixiVn.canvas.remove(e.alias);break;case"pause":let y=pixiVn.canvas.find(e.alias);y?y.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let o=pixiVn.canvas.find(e.alias);o?o.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":Q(e);break;case"operationtoconvert":if(t){let f="";e.values.forEach(y=>{if(typeof y=="string")f+=y;else {let o=l(y);f+=`${o}`;}});let d=await t(f);d&&await W(d,t);}break;case"input":switch(e.operationType){case"request":pixiVn.narration.requestInput({type:e.valueType}),pixiVn.narration.inputValue=e.defaultValue;break}break;case"fade":let a=new pixiVn.FadeAlphaTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,a);break;case"move":let r=new pixiVn.MoveTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,r);break;case"rotate":let c=new pixiVn.RotateTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,c);break;case"zoom":let u=new pixiVn.ZoomTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,u);break;case"shake":await pixiVn.shakeEffect(e.alias,e.props,e.priority);break}}var G=class extends pixiVn.LabelAbstract{constructor(t,e,a,r={}){super(t,a),this._steps=e,this.operationStringConvert=r.operationStringConvert,this.skipEmptyDialogs=r.skipEmptyDialogs||!1;}_steps;get steps(){return this._steps.map(t=>this.stepConverter(t))}operationStringConvert;skipEmptyDialogs=!1;getStepSha1(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, ce.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let a=[];t.forEach(r=>{if(typeof r=="string")a.push(r);else if(r&&typeof r=="object"){let c=l(r);c?(c&&!Array.isArray(c)&&typeof c=="object"&&(c=l(c)||""),Array.isArray(c)?a=a.concat(c):a.push(`${c}`)):a.push(`${r}`);}}),e=a;}else {let a=l(t)||"";a&&!Array.isArray(a)&&typeof a=="object"&&(a=l(a)||""),e=a;}return `${e}`}getDialogue(t){if(t==null)return;let e=l(t);return e==null?"":typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:J.t(this.getDialogueText(e.text))}:J.t(this.getDialogueText(e))}getChoices(t){return l(t)?.map(r=>l(r)).filter(r=>r!==void 0)}stepConverter(t){return async e=>{let a;if(typeof t=="function"?a=t():a=t,a=R(a),a.operations)for(let o of a.operations)await W(o,this.operationStringConvert?p=>this.operationStringConvert(p,a,e):void 0);let r=this.getChoices(a.choices),c=l(a.glueEnabled),u=this.getDialogue(a.dialogue),f=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(o=>{let p=l(o);p&&f.push(p);}));let d=l(a.goNextStep),y=l(a.end);if(r){let o=r.map(p=>{let m="";if(Array.isArray(p.text)){let T=[];p.text.forEach(x=>{if(typeof x=="string")T.push(J.t(x));else if(x&&typeof x=="object"){let b=l(x);b&&!Array.isArray(b)&&typeof b=="object"&&(b=l(b)||""),b&&(Array.isArray(b)?T=T.concat(J.t(b)):T.push(J.t(b)));}}),m=T.join();}else typeof p.text=="string"&&(m=J.t(p.text));return new pixiVn.ChoiceMenuOption(m,p.label,p.props,{type:p.type,oneTime:p.oneTime,onlyHaveNoChoice:p.onlyHaveNoChoice,autoSelect:p.autoSelect})});pixiVn.narration.choiceMenuOptions=o;}else pixiVn.narration.choiceMenuOptions=void 0;u!==void 0&&(pixiVn.narration.dialogue=u,this.skipEmptyDialogs&&typeof u=="string"&&(u===""||RegExp(/^\s+$/).test(u))&&(d=!0)),c?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):c===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let o of f){let p=o.label;typeof p=="object"&&(p=l(p)||"");let m=o.params?.map(T=>l(T));e={...e,...o.props},o.type==="jump"?(pixiVn.narration.closeCurrentLabel(),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,m),await pixiVn.narration.callLabel(p,e)):(pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,m),await pixiVn.narration.callLabel(p,e));}y==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e)):y==="label_end"&&pixiVn.narration.closeCurrentLabel(),d&&await pixiVn.narration.goNext(e);}}};exports.LabelJson=G;
3
+ `+g),c=l(n.glueEnabled)||!1,g)}),f=l(u[0]),d=typeof f=="object"&&"character"in f?f.character:void 0,y=u.map(n=>{let s;n&&typeof n=="object"&&"text"in n?s=n.text:s=n;let g;return Array.isArray(s)?g=s.map(h=>{let V=l(h);return D.t(`${V}`)}).join(""):g=l(s)||"",D.t(g)}).join(""),o=r.find(n=>n.end),p=r.find(n=>n.choices),m=!1,T=!1;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),m=r[r.length-1].glueEnabled,T=r.reverse().find(n=>!(n.operations&&(!n.dialogue||!n.choices)))?.goNextStep);let x=r.find(n=>n.labelToOpen),b=[];return r.forEach(n=>{n.operations&&b.forEach(s=>{b.push(s);});}),{dialogue:d?{character:d,text:y}:y,end:o?.end,choices:p?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function Ve(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=l(i.leftValue),e=l(i.rightValue);switch(i.operator){case"==":return t===e;case"!=":return t!==e;case"<":return t<e;case"<=":return t<=e;case">":return t>e;case">=":return t>=e;case"CONTAINS":return t.toString().includes(e.toString())}break;case"valueCondition":return !!l(i.value);case"union":return Pe(i)}return !!i}function Ne(i){if(i&&typeof i=="object"&&"type"in i&&i.type==="value"&&i.storageOperationType==="get")switch(i.storageType){case"storage":case"tempstorage":return pixiVn.storage.getVariable(i.key);case"flagStorage":return pixiVn.getFlag(i.key);case"label":return pixiVn.narration.getTimesLabelOpened(i.label);case"choice":return pixiVn.narration.getTimesChoiceMade(i.index);case"logic":return l(i.operation);case"params":let t=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];if(t&&t.length>i.key)return t[i.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return i}function Pe(i){if(i.unionType==="not")return !l(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=l(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function Q(i){let t=l(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=l(t):e=t,i.storageType){case"flagStorage":pixiVn.setFlag(i.key,i.value);break;case"storage":pixiVn.storage.setVariable(i.key,e);break;case"tempstorage":pixiVn.storage.setTempVariable(i.key,e);break;case"params":let a=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];a&&a.length-1>=i.key&&(a[i.key]=e),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length-1}`,a);break}}function l(i){let t=xe(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return Ne(t);case"arithmetic":case"arithmeticsingle":return Je(t);case"compare":case"valueCondition":case"union":return Ve(t)}return t}function Je(i){let t=l(i.leftValue);switch(i.type){case"arithmetic":let e=l(i.rightValue);switch(i.operator){case"*":return t*e;case"/":return t/e;case"+":return t+e;case"-":return t-e;case"%":return t%e;case"POW":return Math.pow(t,e);case"RANDOM":return pixiVn.narration.getRandomNumber(t,e)}case"arithmeticsingle":switch(i.operator){case"INT":return parseInt(t);case"FLOOR":return Math.floor(t);case"FLOAT":return parseFloat(t)}break}}async function W(i,t){let e=l(i);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":pixiVn.sound.add(e.alias,{...e.props,url:e.url});break;case"play":pixiVn.sound.play(e.alias,e.props);break;case"remove":pixiVn.sound.remove(e.alias);break;case"pause":pixiVn.sound.pause(e.alias);break;case"resume":pixiVn.sound.resume(e.alias);break;case"volume":pixiVn.sound.volume(e.alias,e.value);break}break;case"assets":switch(e.operationType){case"load":await pixiVn.Assets.load(e.assets);break}break;case"image":switch(e.operationType){case"show":let f=new pixiVn.CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,f,e.transition.props,e.transition.priority);break;case"pushin":case"pushout":await pixiVn.pushIn(e.alias,f,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,f),await f.load();break;case"edit":let d=pixiVn.canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":pixiVn.removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case"pushin":case"pushout":pixiVn.pushOut(e.alias,e.transition.props,e.transition.priority);break}else pixiVn.canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":let f=new pixiVn.CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,f,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,f),await f.load();break;case"edit":let d=pixiVn.canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":pixiVn.removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(e.alias,e.transition.props,e.transition.priority);break}else pixiVn.canvas.remove(e.alias);break;case"pause":let y=pixiVn.canvas.find(e.alias);y?y.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let o=pixiVn.canvas.find(e.alias);o?o.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":Q(e);break;case"operationtoconvert":if(t){let f="";e.values.forEach(y=>{if(typeof y=="string")f+=y;else {let o=l(y);f+=`${o}`;}});let d=await t(f);d&&await W(d,t);}break;case"input":switch(e.operationType){case"request":pixiVn.narration.requestInput({type:e.valueType},e.defaultValue);break}break;case"fade":let a=new pixiVn.FadeAlphaTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,a);break;case"move":let r=new pixiVn.MoveTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,r);break;case"rotate":let c=new pixiVn.RotateTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,c);break;case"zoom":let u=new pixiVn.ZoomTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,u);break;case"shake":await pixiVn.shakeEffect(e.alias,e.props,e.priority);break}}var G=class extends pixiVn.LabelAbstract{constructor(t,e,a,r={}){super(t,a),this._steps=e,this.operationStringConvert=r.operationStringConvert,this.skipEmptyDialogs=r.skipEmptyDialogs||!1;}_steps;get steps(){return this._steps.map(t=>this.stepConverter(t))}operationStringConvert;skipEmptyDialogs=!1;getStepSha1(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, fe.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let a=[];t.forEach(r=>{if(typeof r=="string")a.push(r);else if(r&&typeof r=="object"){let c=l(r);c?(c&&!Array.isArray(c)&&typeof c=="object"&&(c=l(c)||""),Array.isArray(c)?a=a.concat(c):a.push(`${c}`)):a.push(`${r}`);}}),e=a;}else {let a=l(t)||"";a&&!Array.isArray(a)&&typeof a=="object"&&(a=l(a)||""),e=a;}return `${e}`}getDialogue(t){if(t==null)return;let e=l(t);return e==null?"":typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:J.t(this.getDialogueText(e.text))}:J.t(this.getDialogueText(e))}getChoices(t){return l(t)?.map(r=>l(r)).filter(r=>r!==void 0)}stepConverter(t){return async e=>{let a;if(typeof t=="function"?a=t():a=t,a=R(a),a.operations)for(let o of a.operations)await W(o,this.operationStringConvert?p=>this.operationStringConvert(p,a,e):void 0);let r=this.getChoices(a.choices),c=l(a.glueEnabled),u=this.getDialogue(a.dialogue),f=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(o=>{let p=l(o);p&&f.push(p);}));let d=l(a.goNextStep),y=l(a.end);if(r){let o=r.map(p=>{let m="";if(Array.isArray(p.text)){let T=[];p.text.forEach(x=>{if(typeof x=="string")T.push(J.t(x));else if(x&&typeof x=="object"){let b=l(x);b&&!Array.isArray(b)&&typeof b=="object"&&(b=l(b)||""),b&&(Array.isArray(b)?T=T.concat(J.t(b)):T.push(J.t(b)));}}),m=T.join();}else typeof p.text=="string"&&(m=J.t(p.text));return new pixiVn.ChoiceMenuOption(m,p.label,p.props,{type:p.type,oneTime:p.oneTime,onlyHaveNoChoice:p.onlyHaveNoChoice,autoSelect:p.autoSelect})});pixiVn.narration.choiceMenuOptions=o;}else pixiVn.narration.choiceMenuOptions=void 0;u!==void 0&&(pixiVn.narration.dialogue=u,this.skipEmptyDialogs&&typeof u=="string"&&(u===""||RegExp(/^\s+$/).test(u))&&(d=!0)),c?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):c===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let o of f){let p=o.label;typeof p=="object"&&(p=l(p)||"");let m=o.params?.map(T=>l(T));e={...e,...o.props},o.type==="jump"?(pixiVn.narration.closeCurrentLabel(),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,m),await pixiVn.narration.callLabel(p,e)):(pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,m),await pixiVn.narration.callLabel(p,e));}y==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e)):y==="label_end"&&pixiVn.narration.closeCurrentLabel(),d&&await pixiVn.narration.goNext(e);}}};exports.LabelJson=G;
@@ -1,3 +1,3 @@
1
- import {LabelAbstract,ChoiceMenuOption,narration,setFlag,storage,createExportableElement,getFlag,shakeEffect,ZoomTicker,canvas,RotateTicker,MoveTicker,FadeAlphaTicker,zoomOut,moveOut,removeWithDissolveTransition,removeWithFadeTransition,CanvasVideo,zoomIn,moveIn,showWithDissolveTransition,showWithFadeTransition,pushOut,CanvasImage,pushIn,Assets,sound,NarrationManagerStatic}from'@drincs/pixi-vn';var pe=Object.create;var K=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var de=Object.getOwnPropertyNames;var ge=Object.getPrototypeOf,ye=Object.prototype.hasOwnProperty;var F=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var j=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var he=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of de(t))!ye.call(i,r)&&r!==e&&K(i,r,{get:()=>t[r],enumerable:!(a=ue(t,r))||a.enumerable});return i};var me=(i,t,e)=>(e=i!=null?pe(ge(i)):{},he(K(e,"default",{value:i,enumerable:!0}),i));var X=j((L,U)=>{(function(i,t){typeof L=="object"?U.exports=L=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(L,function(){var i=i||function(t,e){var a;if(typeof window<"u"&&window.crypto&&(a=window.crypto),typeof self<"u"&&self.crypto&&(a=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a=globalThis.crypto),!a&&typeof window<"u"&&window.msCrypto&&(a=window.msCrypto),!a&&typeof global<"u"&&global.crypto&&(a=global.crypto),!a&&typeof F=="function")try{a=F("crypto");}catch{}var r=function(){if(a){if(typeof a.getRandomValues=="function")try{return a.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a.randomBytes=="function")try{return a.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),u={},f=u.lib={},d=f.Base=function(){return {extend:function(n){var s=c(this);return n&&s.mixIn(n),(!s.hasOwnProperty("init")||this.init===s.init)&&(s.init=function(){s.$super.init.apply(this,arguments);}),s.init.prototype=s,s.$super=this,s},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var s in n)n.hasOwnProperty(s)&&(this[s]=n[s]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),y=f.WordArray=d.extend({init:function(n,s){n=this.words=n||[],s!=e?this.sigBytes=s:this.sigBytes=n.length*4;},toString:function(n){return (n||p).stringify(this)},concat:function(n){var s=this.words,g=n.words,h=this.sigBytes,V=n.sigBytes;if(this.clamp(),h%4)for(var P=0;P<V;P++){var H=g[P>>>2]>>>24-P%4*8&255;s[h+P>>>2]|=H<<24-(h+P)%4*8;}else for(var C=0;C<V;C+=4)s[h+C>>>2]=g[C>>>2];return this.sigBytes+=V,this},clamp:function(){var n=this.words,s=this.sigBytes;n[s>>>2]&=4294967295<<32-s%4*8,n.length=t.ceil(s/4);},clone:function(){var n=d.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var s=[],g=0;g<n;g+=4)s.push(r());return new y.init(s,n)}}),o=u.enc={},p=o.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push((P>>>4).toString(16)),h.push((P&15).toString(16));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h+=2)g[h>>>3]|=parseInt(n.substr(h,2),16)<<24-h%8*4;return new y.init(g,s/2)}},m=o.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push(String.fromCharCode(P));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h++)g[h>>>2]|=(n.charCodeAt(h)&255)<<24-h%4*8;return new y.init(g,s)}},T=o.Utf8={stringify:function(n){try{return decodeURIComponent(escape(m.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return m.parse(unescape(encodeURIComponent(n)))}},x=f.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=T.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var s,g=this._data,h=g.words,V=g.sigBytes,P=this.blockSize,H=P*4,C=V/H;n?C=t.ceil(C):C=t.max((C|0)-this._minBufferSize,0);var _=C*P,M=t.min(_*4,V);if(_){for(var $=0;$<_;$+=P)this._doProcessBlock(h,$);s=h.splice(0,_),g.sigBytes-=M;}return new y.init(s,M)},clone:function(){var n=d.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});f.Hasher=x.extend({cfg:d.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var s=this._doFinalize();return s},blockSize:512/32,_createHelper:function(n){return function(s,g){return new n.init(g).finalize(s)}},_createHmacHelper:function(n){return function(s,g){return new N.HMAC.init(n,g).finalize(s)}}});var N=u.algo={};return u}(Math);return i});});var Y=j((O,q)=>{(function(i,t){typeof O=="object"?q.exports=O=t(X()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(O,function(i){return function(){var t=i,e=t.lib,a=e.WordArray,r=e.Hasher,c=t.algo,u=[],f=c.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,y){for(var o=this._hash.words,p=o[0],m=o[1],T=o[2],x=o[3],b=o[4],N=0;N<80;N++){if(N<16)u[N]=d[y+N]|0;else {var n=u[N-3]^u[N-8]^u[N-14]^u[N-16];u[N]=n<<1|n>>>31;}var s=(p<<5|p>>>27)+b+u[N];N<20?s+=(m&T|~m&x)+1518500249:N<40?s+=(m^T^x)+1859775393:N<60?s+=(m&T|m&x|T&x)-1894007588:s+=(m^T^x)-899497514,b=x,x=T,T=m<<30|m>>>2,m=p,p=s;}o[0]=o[0]+p|0,o[1]=o[1]+m|0,o[2]=o[2]+T|0,o[3]=o[3]+x|0,o[4]=o[4]+b|0;},_doFinalize:function(){var d=this._data,y=d.words,o=this._nDataBytes*8,p=d.sigBytes*8;return y[p>>>5]|=128<<24-p%32,y[(p+64>>>9<<4)+14]=Math.floor(o/4294967296),y[(p+64>>>9<<4)+15]=o,d.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});t.SHA1=r._createHelper(f),t.HmacSHA1=r._createHmacHelper(f);}(),i.SHA1});});var ce=me(Y());var E="___param___";var J=class i{static _beforeToTranslate=void 0;static _translate=t=>t;static _afterToTranslate=void 0;static t(t){return Array.isArray(t)?t.map(e=>i.translate(`${e}`)):i.translate(`${t}`)}static set beforeToTranslate(t){i._beforeToTranslate=t;}static set translate(t){i._translate=t;}static get translate(){return t=>{let e=t;return i._beforeToTranslate&&(e=i._beforeToTranslate(e)),e=i._translate(e),i._afterToTranslate&&(e=i._afterToTranslate(e)),e}}static set afterToTranslate(t){i._afterToTranslate=t;}static addKey(t,e,a){let r=a.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(c=>{t[c]===void 0&&(r==="empty_string"?t[c]="":r==="copy_key"&&(i._beforeToTranslate?t[c]=i._beforeToTranslate(c):t[c]=c));});}static getConditionalsThenElse(t,e=[]){if(typeof t=="object"&&t&&"type"in t)if(t.type==="ifelse")t.then&&i.getConditionalsThenElse(t.then,e),t.else&&i.getConditionalsThenElse(t.else,e);else if(t.type==="stepswitch"){if(t.elements)if(Array.isArray(t.elements))t.elements.forEach(a=>{i.getConditionalsThenElse(a,e);});else if(t.elements.type==="ifelse"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else if(t.elements.type==="stepswitch"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else i.getConditionalsThenElse(t.elements,e);}else t.type==="resulttocombine"?(t.firstItem&&i.getConditionalsThenElse(t.firstItem,e),t.secondConditionalItem&&t.secondConditionalItem.forEach(a=>{i.getConditionalsThenElse(a,e);})):e.push(t);else t&&e.push(t);return e}static generateJsonTranslation(t,e={},a={}){return t.forEach(r=>{if(r.choices){let c=[];Array.isArray(r.choices)?c=[r.choices]:c=i.getConditionalsThenElse(r.choices),c.forEach(u=>u.forEach(f=>{if("type"in f){let d=[];f.type==="ifelse"||f.type==="stepswitch"?i.getConditionalsThenElse(f,d):d=[f],d.map(o=>i.getConditionalsThenElse(o.text)).forEach(o=>{Array.isArray(o)&&o.forEach(p=>{Array.isArray(p)?p.forEach(m=>{typeof m=="string"?i.addKey(e,m,a):i.getConditionalsThenElse(m).forEach(T=>{Array.isArray(T)?T.forEach(x=>{typeof x=="string"&&i.addKey(e,x,a);}):typeof T=="string"&&i.addKey(e,T,a);});}):typeof p=="string"&&i.addKey(e,p,a);});});}}));}if(r.dialogue){let c=[];Array.isArray(r.dialogue)?c=[r.dialogue]:c=i.getConditionalsThenElse(r.dialogue),c.forEach(u=>{typeof u=="string"?i.addKey(e,u,a):"text"in u&&Array.isArray(u.text)&&u.text.forEach(f=>{typeof f=="string"?i.addKey(e,f,a):i.getConditionalsThenElse(f).forEach(y=>{typeof y=="string"?i.addKey(e,y,a):Array.isArray(y)&&y.forEach(o=>{typeof o=="string"?i.addKey(e,o,a):i.getConditionalsThenElse(o).forEach(p=>{typeof p=="string"&&i.addKey(e,p,a);});});});});});}r.conditionalStep&&i.getConditionalsThenElse(r.conditionalStep).forEach(u=>{Array.isArray(u)?i.generateJsonTranslation(u,e,a):i.generateJsonTranslation([u],e,a);});}),e}};var D=J;function xe(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function be(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return Ve(i);case"ifelse":return l(i.condition)?l(i.then):l(i.else);case"stepswitch":let e=l(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let a=xe(0,e.length-1);return l(e[a]);case"loop":let r=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return r>e.length-1&&(r=r%e.length),l(e[r]);case"sequential":let c,u=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(c=l(e[e.length-1])),u>e.length-1?c:l(e[u]);case"sequentialrandom":let f=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(f==null&&i.end=="lastItem"){let d=NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!d||!d?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=d.usedRandomNumbers[`0-${e.length-1}`];return l(e[y[y.length-1]])}if(f==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return l(e[f])}}return i}function R(i){if(i.conditionalStep){let t=createExportableElement(l(i.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 e={...i,conditionalStep:void 0,...t};return R(e)}else getFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);}return i}function Ve(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(c=>{let u=l(c);e.push(u);});else {let c=l(r);e.push(c);}});let a=t?[t,...e]:e;if(a.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof a[0]=="string")return D.t(a).join("");if(typeof a[0]=="object"){let r=a,c,u=r.map((n,s)=>{n=R(n);let g=l(n.dialogue)||"";return s===0?(c=l(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),c===!1&&(g=`
1
+ import {LabelAbstract,ChoiceMenuOption,narration,setFlag,storage,createExportableElement,getFlag,shakeEffect,ZoomTicker,canvas,RotateTicker,MoveTicker,FadeAlphaTicker,zoomOut,moveOut,removeWithDissolveTransition,removeWithFadeTransition,CanvasVideo,zoomIn,moveIn,showWithDissolveTransition,showWithFadeTransition,pushOut,CanvasImage,pushIn,Assets,sound,NarrationManagerStatic}from'@drincs/pixi-vn';var ce=Object.create;var K=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty;var F=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var j=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ye=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of ue(t))!ge.call(i,r)&&r!==e&&K(i,r,{get:()=>t[r],enumerable:!(a=pe(t,r))||a.enumerable});return i};var he=(i,t,e)=>(e=i!=null?ce(de(i)):{},ye(K(e,"default",{value:i,enumerable:!0}),i));var X=j((L,U)=>{(function(i,t){typeof L=="object"?U.exports=L=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(L,function(){var i=i||function(t,e){var a;if(typeof window<"u"&&window.crypto&&(a=window.crypto),typeof self<"u"&&self.crypto&&(a=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(a=globalThis.crypto),!a&&typeof window<"u"&&window.msCrypto&&(a=window.msCrypto),!a&&typeof global<"u"&&global.crypto&&(a=global.crypto),!a&&typeof F=="function")try{a=F("crypto");}catch{}var r=function(){if(a){if(typeof a.getRandomValues=="function")try{return a.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof a.randomBytes=="function")try{return a.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),u={},f=u.lib={},d=f.Base=function(){return {extend:function(n){var s=c(this);return n&&s.mixIn(n),(!s.hasOwnProperty("init")||this.init===s.init)&&(s.init=function(){s.$super.init.apply(this,arguments);}),s.init.prototype=s,s.$super=this,s},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var s in n)n.hasOwnProperty(s)&&(this[s]=n[s]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),y=f.WordArray=d.extend({init:function(n,s){n=this.words=n||[],s!=e?this.sigBytes=s:this.sigBytes=n.length*4;},toString:function(n){return (n||p).stringify(this)},concat:function(n){var s=this.words,g=n.words,h=this.sigBytes,V=n.sigBytes;if(this.clamp(),h%4)for(var P=0;P<V;P++){var H=g[P>>>2]>>>24-P%4*8&255;s[h+P>>>2]|=H<<24-(h+P)%4*8;}else for(var C=0;C<V;C+=4)s[h+C>>>2]=g[C>>>2];return this.sigBytes+=V,this},clamp:function(){var n=this.words,s=this.sigBytes;n[s>>>2]&=4294967295<<32-s%4*8,n.length=t.ceil(s/4);},clone:function(){var n=d.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var s=[],g=0;g<n;g+=4)s.push(r());return new y.init(s,n)}}),o=u.enc={},p=o.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push((P>>>4).toString(16)),h.push((P&15).toString(16));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h+=2)g[h>>>3]|=parseInt(n.substr(h,2),16)<<24-h%8*4;return new y.init(g,s/2)}},m=o.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,h=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;h.push(String.fromCharCode(P));}return h.join("")},parse:function(n){for(var s=n.length,g=[],h=0;h<s;h++)g[h>>>2]|=(n.charCodeAt(h)&255)<<24-h%4*8;return new y.init(g,s)}},T=o.Utf8={stringify:function(n){try{return decodeURIComponent(escape(m.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return m.parse(unescape(encodeURIComponent(n)))}},x=f.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=T.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var s,g=this._data,h=g.words,V=g.sigBytes,P=this.blockSize,H=P*4,C=V/H;n?C=t.ceil(C):C=t.max((C|0)-this._minBufferSize,0);var _=C*P,M=t.min(_*4,V);if(_){for(var $=0;$<_;$+=P)this._doProcessBlock(h,$);s=h.splice(0,_),g.sigBytes-=M;}return new y.init(s,M)},clone:function(){var n=d.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});f.Hasher=x.extend({cfg:d.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var s=this._doFinalize();return s},blockSize:512/32,_createHelper:function(n){return function(s,g){return new n.init(g).finalize(s)}},_createHmacHelper:function(n){return function(s,g){return new N.HMAC.init(n,g).finalize(s)}}});var N=u.algo={};return u}(Math);return i});});var Y=j((O,q)=>{(function(i,t){typeof O=="object"?q.exports=O=t(X()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(O,function(i){return function(){var t=i,e=t.lib,a=e.WordArray,r=e.Hasher,c=t.algo,u=[],f=c.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,y){for(var o=this._hash.words,p=o[0],m=o[1],T=o[2],x=o[3],b=o[4],N=0;N<80;N++){if(N<16)u[N]=d[y+N]|0;else {var n=u[N-3]^u[N-8]^u[N-14]^u[N-16];u[N]=n<<1|n>>>31;}var s=(p<<5|p>>>27)+b+u[N];N<20?s+=(m&T|~m&x)+1518500249:N<40?s+=(m^T^x)+1859775393:N<60?s+=(m&T|m&x|T&x)-1894007588:s+=(m^T^x)-899497514,b=x,x=T,T=m<<30|m>>>2,m=p,p=s;}o[0]=o[0]+p|0,o[1]=o[1]+m|0,o[2]=o[2]+T|0,o[3]=o[3]+x|0,o[4]=o[4]+b|0;},_doFinalize:function(){var d=this._data,y=d.words,o=this._nDataBytes*8,p=d.sigBytes*8;return y[p>>>5]|=128<<24-p%32,y[(p+64>>>9<<4)+14]=Math.floor(o/4294967296),y[(p+64>>>9<<4)+15]=o,d.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var d=r.clone.call(this);return d._hash=this._hash.clone(),d}});t.SHA1=r._createHelper(f),t.HmacSHA1=r._createHmacHelper(f);}(),i.SHA1});});var fe=he(Y());var E="___param___";var J=class i{static _beforeToTranslate=void 0;static _translate=t=>t;static _afterToTranslate=void 0;static t(t){return Array.isArray(t)?t.map(e=>i.translate(`${e}`)):i.translate(`${t}`)}static set beforeToTranslate(t){i._beforeToTranslate=t;}static set translate(t){i._translate=t;}static get translate(){return t=>{let e=t;return i._beforeToTranslate&&(e=i._beforeToTranslate(e)),e=i._translate(e),i._afterToTranslate&&(e=i._afterToTranslate(e)),e}}static set afterToTranslate(t){i._afterToTranslate=t;}static addKey(t,e,a){let r=a.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(c=>{t[c]===void 0&&(r==="empty_string"?t[c]="":r==="copy_key"&&(i._beforeToTranslate?t[c]=i._beforeToTranslate(c):t[c]=c));});}static getConditionalsThenElse(t,e=[]){if(typeof t=="object"&&t&&"type"in t)if(t.type==="ifelse")t.then&&i.getConditionalsThenElse(t.then,e),t.else&&i.getConditionalsThenElse(t.else,e);else if(t.type==="stepswitch"){if(t.elements)if(Array.isArray(t.elements))t.elements.forEach(a=>{i.getConditionalsThenElse(a,e);});else if(t.elements.type==="ifelse"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else if(t.elements.type==="stepswitch"){let a=[];i.getConditionalsThenElse(t.elements,a),a.forEach(r=>{e.push(...r);});}else i.getConditionalsThenElse(t.elements,e);}else t.type==="resulttocombine"?(t.firstItem&&i.getConditionalsThenElse(t.firstItem,e),t.secondConditionalItem&&t.secondConditionalItem.forEach(a=>{i.getConditionalsThenElse(a,e);})):e.push(t);else t&&e.push(t);return e}static generateJsonTranslation(t,e={},a={}){return t.forEach(r=>{if(r.choices){let c=[];Array.isArray(r.choices)?c=[r.choices]:c=i.getConditionalsThenElse(r.choices),c.forEach(u=>u.forEach(f=>{if("type"in f){let d=[];f.type==="ifelse"||f.type==="stepswitch"?i.getConditionalsThenElse(f,d):d=[f],d.map(o=>i.getConditionalsThenElse(o.text)).forEach(o=>{Array.isArray(o)&&o.forEach(p=>{Array.isArray(p)?p.forEach(m=>{typeof m=="string"?i.addKey(e,m,a):i.getConditionalsThenElse(m).forEach(T=>{Array.isArray(T)?T.forEach(x=>{typeof x=="string"&&i.addKey(e,x,a);}):typeof T=="string"&&i.addKey(e,T,a);});}):typeof p=="string"&&i.addKey(e,p,a);});});}}));}if(r.dialogue){let c=[];Array.isArray(r.dialogue)?c=[r.dialogue]:c=i.getConditionalsThenElse(r.dialogue),c.forEach(u=>{typeof u=="string"?i.addKey(e,u,a):"text"in u&&Array.isArray(u.text)&&u.text.forEach(f=>{typeof f=="string"?i.addKey(e,f,a):i.getConditionalsThenElse(f).forEach(y=>{typeof y=="string"?i.addKey(e,y,a):Array.isArray(y)&&y.forEach(o=>{typeof o=="string"?i.addKey(e,o,a):i.getConditionalsThenElse(o).forEach(p=>{typeof p=="string"&&i.addKey(e,p,a);});});});});});}r.conditionalStep&&i.getConditionalsThenElse(r.conditionalStep).forEach(u=>{Array.isArray(u)?i.generateJsonTranslation(u,e,a):i.generateJsonTranslation([u],e,a);});}),e}};var D=J;function Te(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function xe(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return be(i);case"ifelse":return l(i.condition)?l(i.then):l(i.else);case"stepswitch":let e=l(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let a=Te(0,e.length-1);return l(e[a]);case"loop":let r=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return r>e.length-1&&(r=r%e.length),l(e[r]);case"sequential":let c,u=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(c=l(e[e.length-1])),u>e.length-1?c:l(e[u]);case"sequentialrandom":let f=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(f==null&&i.end=="lastItem"){let d=NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!d||!d?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=d.usedRandomNumbers[`0-${e.length-1}`];return l(e[y[y.length-1]])}if(f==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return l(e[f])}}return i}function R(i){if(i.conditionalStep){let t=createExportableElement(l(i.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 e={...i,conditionalStep:void 0,...t};return R(e)}else getFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);}return i}function be(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(c=>{let u=l(c);e.push(u);});else {let c=l(r);e.push(c);}});let a=t?[t,...e]:e;if(a.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof a[0]=="string")return D.t(a).join("");if(typeof a[0]=="object"){let r=a,c,u=r.map((n,s)=>{n=R(n);let g=l(n.dialogue)||"";return s===0?(c=l(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),c===!1&&(g=`
2
2
 
3
- `+g),c=l(n.glueEnabled)||!1,g)}),f=l(u[0]),d=typeof f=="object"&&"character"in f?f.character:void 0,y=u.map(n=>{let s;n&&typeof n=="object"&&"text"in n?s=n.text:s=n;let g;return Array.isArray(s)?g=s.map(h=>{let V=l(h);return D.t(`${V}`)}).join(""):g=l(s)||"",D.t(g)}).join(""),o=r.find(n=>n.end),p=r.find(n=>n.choices),m=!1,T=!1;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),m=r[r.length-1].glueEnabled,T=r.reverse().find(n=>!(n.operations&&(!n.dialogue||!n.choices)))?.goNextStep);let x=r.find(n=>n.labelToOpen),b=[];return r.forEach(n=>{n.operations&&b.forEach(s=>{b.push(s);});}),{dialogue:d?{character:d,text:y}:y,end:o?.end,choices:p?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function Ne(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=l(i.leftValue),e=l(i.rightValue);switch(i.operator){case"==":return t===e;case"!=":return t!==e;case"<":return t<e;case"<=":return t<=e;case">":return t>e;case">=":return t>=e;case"CONTAINS":return t.toString().includes(e.toString())}break;case"valueCondition":return !!l(i.value);case"union":return Je(i)}return !!i}function Pe(i){if(i&&typeof i=="object"&&"type"in i&&i.type==="value"&&i.storageOperationType==="get")switch(i.storageType){case"storage":case"tempstorage":return storage.getVariable(i.key);case"flagStorage":return getFlag(i.key);case"label":return narration.getTimesLabelOpened(i.label);case"choice":return narration.getTimesChoiceMade(i.index);case"logic":return l(i.operation);case"params":let t=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];if(t&&t.length>i.key)return t[i.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return i}function Je(i){if(i.unionType==="not")return !l(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=l(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function Q(i){let t=l(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=l(t):e=t,i.storageType){case"flagStorage":setFlag(i.key,i.value);break;case"storage":storage.setVariable(i.key,e);break;case"tempstorage":storage.setTempVariable(i.key,e);break;case"params":let a=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];a&&a.length-1>=i.key&&(a[i.key]=e),storage.setTempVariable(`${E}${narration.openedLabels.length-1}`,a);break}}function l(i){let t=be(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return Pe(t);case"arithmetic":case"arithmeticsingle":return ve(t);case"compare":case"valueCondition":case"union":return Ne(t)}return t}function ve(i){let t=l(i.leftValue);switch(i.type){case"arithmetic":let e=l(i.rightValue);switch(i.operator){case"*":return t*e;case"/":return t/e;case"+":return t+e;case"-":return t-e;case"%":return t%e;case"POW":return Math.pow(t,e);case"RANDOM":return narration.getRandomNumber(t,e)}case"arithmeticsingle":switch(i.operator){case"INT":return parseInt(t);case"FLOOR":return Math.floor(t);case"FLOAT":return parseFloat(t)}break}}async function W(i,t){let e=l(i);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":sound.add(e.alias,{...e.props,url:e.url});break;case"play":sound.play(e.alias,e.props);break;case"remove":sound.remove(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}break;case"assets":switch(e.operationType){case"load":await Assets.load(e.assets);break}break;case"image":switch(e.operationType){case"show":let f=new CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,f,e.transition.props,e.transition.priority);break;case"pushin":case"pushout":await pushIn(e.alias,f,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,f),await f.load();break;case"edit":let d=canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":removeWithDissolveTransition(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);break}break;case"video":switch(e.operationType){case"show":let f=new CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,f,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,f),await f.load();break;case"edit":let d=canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":removeWithDissolveTransition(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}else canvas.remove(e.alias);break;case"pause":let y=canvas.find(e.alias);y?y.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let o=canvas.find(e.alias);o?o.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":Q(e);break;case"operationtoconvert":if(t){let f="";e.values.forEach(y=>{if(typeof y=="string")f+=y;else {let o=l(y);f+=`${o}`;}});let d=await t(f);d&&await W(d,t);}break;case"input":switch(e.operationType){case"request":narration.requestInput({type:e.valueType}),narration.inputValue=e.defaultValue;break}break;case"fade":let a=new FadeAlphaTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,a);break;case"move":let r=new MoveTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,r);break;case"rotate":let c=new RotateTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,c);break;case"zoom":let u=new ZoomTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,u);break;case"shake":await shakeEffect(e.alias,e.props,e.priority);break}}var G=class extends LabelAbstract{constructor(t,e,a,r={}){super(t,a),this._steps=e,this.operationStringConvert=r.operationStringConvert,this.skipEmptyDialogs=r.skipEmptyDialogs||!1;}_steps;get steps(){return this._steps.map(t=>this.stepConverter(t))}operationStringConvert;skipEmptyDialogs=!1;getStepSha1(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, ce.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let a=[];t.forEach(r=>{if(typeof r=="string")a.push(r);else if(r&&typeof r=="object"){let c=l(r);c?(c&&!Array.isArray(c)&&typeof c=="object"&&(c=l(c)||""),Array.isArray(c)?a=a.concat(c):a.push(`${c}`)):a.push(`${r}`);}}),e=a;}else {let a=l(t)||"";a&&!Array.isArray(a)&&typeof a=="object"&&(a=l(a)||""),e=a;}return `${e}`}getDialogue(t){if(t==null)return;let e=l(t);return e==null?"":typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:J.t(this.getDialogueText(e.text))}:J.t(this.getDialogueText(e))}getChoices(t){return l(t)?.map(r=>l(r)).filter(r=>r!==void 0)}stepConverter(t){return async e=>{let a;if(typeof t=="function"?a=t():a=t,a=R(a),a.operations)for(let o of a.operations)await W(o,this.operationStringConvert?p=>this.operationStringConvert(p,a,e):void 0);let r=this.getChoices(a.choices),c=l(a.glueEnabled),u=this.getDialogue(a.dialogue),f=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(o=>{let p=l(o);p&&f.push(p);}));let d=l(a.goNextStep),y=l(a.end);if(r){let o=r.map(p=>{let m="";if(Array.isArray(p.text)){let T=[];p.text.forEach(x=>{if(typeof x=="string")T.push(J.t(x));else if(x&&typeof x=="object"){let b=l(x);b&&!Array.isArray(b)&&typeof b=="object"&&(b=l(b)||""),b&&(Array.isArray(b)?T=T.concat(J.t(b)):T.push(J.t(b)));}}),m=T.join();}else typeof p.text=="string"&&(m=J.t(p.text));return new ChoiceMenuOption(m,p.label,p.props,{type:p.type,oneTime:p.oneTime,onlyHaveNoChoice:p.onlyHaveNoChoice,autoSelect:p.autoSelect})});narration.choiceMenuOptions=o;}else narration.choiceMenuOptions=void 0;u!==void 0&&(narration.dialogue=u,this.skipEmptyDialogs&&typeof u=="string"&&(u===""||RegExp(/^\s+$/).test(u))&&(d=!0)),c?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):c===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let o of f){let p=o.label;typeof p=="object"&&(p=l(p)||"");let m=o.params?.map(T=>l(T));e={...e,...o.props},o.type==="jump"?(narration.closeCurrentLabel(),storage.setTempVariable(`${E}${narration.openedLabels.length}`,m),await narration.callLabel(p,e)):(storage.setTempVariable(`${E}${narration.openedLabels.length}`,m),await narration.callLabel(p,e));}y==="game_end"?(narration.closeAllLabels(),await narration.goNext(e)):y==="label_end"&&narration.closeCurrentLabel(),d&&await narration.goNext(e);}}};export{G as LabelJson};
3
+ `+g),c=l(n.glueEnabled)||!1,g)}),f=l(u[0]),d=typeof f=="object"&&"character"in f?f.character:void 0,y=u.map(n=>{let s;n&&typeof n=="object"&&"text"in n?s=n.text:s=n;let g;return Array.isArray(s)?g=s.map(h=>{let V=l(h);return D.t(`${V}`)}).join(""):g=l(s)||"",D.t(g)}).join(""),o=r.find(n=>n.end),p=r.find(n=>n.choices),m=!1,T=!1;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),m=r[r.length-1].glueEnabled,T=r.reverse().find(n=>!(n.operations&&(!n.dialogue||!n.choices)))?.goNextStep);let x=r.find(n=>n.labelToOpen),b=[];return r.forEach(n=>{n.operations&&b.forEach(s=>{b.push(s);});}),{dialogue:d?{character:d,text:y}:y,end:o?.end,choices:p?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function Ve(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=l(i.leftValue),e=l(i.rightValue);switch(i.operator){case"==":return t===e;case"!=":return t!==e;case"<":return t<e;case"<=":return t<=e;case">":return t>e;case">=":return t>=e;case"CONTAINS":return t.toString().includes(e.toString())}break;case"valueCondition":return !!l(i.value);case"union":return Pe(i)}return !!i}function Ne(i){if(i&&typeof i=="object"&&"type"in i&&i.type==="value"&&i.storageOperationType==="get")switch(i.storageType){case"storage":case"tempstorage":return storage.getVariable(i.key);case"flagStorage":return getFlag(i.key);case"label":return narration.getTimesLabelOpened(i.label);case"choice":return narration.getTimesChoiceMade(i.index);case"logic":return l(i.operation);case"params":let t=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];if(t&&t.length>i.key)return t[i.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return i}function Pe(i){if(i.unionType==="not")return !l(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=l(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function Q(i){let t=l(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=l(t):e=t,i.storageType){case"flagStorage":setFlag(i.key,i.value);break;case"storage":storage.setVariable(i.key,e);break;case"tempstorage":storage.setTempVariable(i.key,e);break;case"params":let a=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];a&&a.length-1>=i.key&&(a[i.key]=e),storage.setTempVariable(`${E}${narration.openedLabels.length-1}`,a);break}}function l(i){let t=xe(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return Ne(t);case"arithmetic":case"arithmeticsingle":return Je(t);case"compare":case"valueCondition":case"union":return Ve(t)}return t}function Je(i){let t=l(i.leftValue);switch(i.type){case"arithmetic":let e=l(i.rightValue);switch(i.operator){case"*":return t*e;case"/":return t/e;case"+":return t+e;case"-":return t-e;case"%":return t%e;case"POW":return Math.pow(t,e);case"RANDOM":return narration.getRandomNumber(t,e)}case"arithmeticsingle":switch(i.operator){case"INT":return parseInt(t);case"FLOOR":return Math.floor(t);case"FLOAT":return parseFloat(t)}break}}async function W(i,t){let e=l(i);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":sound.add(e.alias,{...e.props,url:e.url});break;case"play":sound.play(e.alias,e.props);break;case"remove":sound.remove(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}break;case"assets":switch(e.operationType){case"load":await Assets.load(e.assets);break}break;case"image":switch(e.operationType){case"show":let f=new CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,f,e.transition.props,e.transition.priority);break;case"pushin":case"pushout":await pushIn(e.alias,f,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,f),await f.load();break;case"edit":let d=canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":removeWithDissolveTransition(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);break}break;case"video":switch(e.operationType){case"show":let f=new CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,f,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,f,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,f,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,f),await f.load();break;case"edit":let d=canvas.find(e.alias);d?e.props&&(d.memory={...d.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":if(e.transition)switch(e.transition.type){case"fade":removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":removeWithDissolveTransition(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}else canvas.remove(e.alias);break;case"pause":let y=canvas.find(e.alias);y?y.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let o=canvas.find(e.alias);o?o.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":Q(e);break;case"operationtoconvert":if(t){let f="";e.values.forEach(y=>{if(typeof y=="string")f+=y;else {let o=l(y);f+=`${o}`;}});let d=await t(f);d&&await W(d,t);}break;case"input":switch(e.operationType){case"request":narration.requestInput({type:e.valueType},e.defaultValue);break}break;case"fade":let a=new FadeAlphaTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,a);break;case"move":let r=new MoveTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,r);break;case"rotate":let c=new RotateTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,c);break;case"zoom":let u=new ZoomTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,u);break;case"shake":await shakeEffect(e.alias,e.props,e.priority);break}}var G=class extends LabelAbstract{constructor(t,e,a,r={}){super(t,a),this._steps=e,this.operationStringConvert=r.operationStringConvert,this.skipEmptyDialogs=r.skipEmptyDialogs||!1;}_steps;get steps(){return this._steps.map(t=>this.stepConverter(t))}operationStringConvert;skipEmptyDialogs=!1;getStepSha1(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, fe.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let a=[];t.forEach(r=>{if(typeof r=="string")a.push(r);else if(r&&typeof r=="object"){let c=l(r);c?(c&&!Array.isArray(c)&&typeof c=="object"&&(c=l(c)||""),Array.isArray(c)?a=a.concat(c):a.push(`${c}`)):a.push(`${r}`);}}),e=a;}else {let a=l(t)||"";a&&!Array.isArray(a)&&typeof a=="object"&&(a=l(a)||""),e=a;}return `${e}`}getDialogue(t){if(t==null)return;let e=l(t);return e==null?"":typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:J.t(this.getDialogueText(e.text))}:J.t(this.getDialogueText(e))}getChoices(t){return l(t)?.map(r=>l(r)).filter(r=>r!==void 0)}stepConverter(t){return async e=>{let a;if(typeof t=="function"?a=t():a=t,a=R(a),a.operations)for(let o of a.operations)await W(o,this.operationStringConvert?p=>this.operationStringConvert(p,a,e):void 0);let r=this.getChoices(a.choices),c=l(a.glueEnabled),u=this.getDialogue(a.dialogue),f=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(o=>{let p=l(o);p&&f.push(p);}));let d=l(a.goNextStep),y=l(a.end);if(r){let o=r.map(p=>{let m="";if(Array.isArray(p.text)){let T=[];p.text.forEach(x=>{if(typeof x=="string")T.push(J.t(x));else if(x&&typeof x=="object"){let b=l(x);b&&!Array.isArray(b)&&typeof b=="object"&&(b=l(b)||""),b&&(Array.isArray(b)?T=T.concat(J.t(b)):T.push(J.t(b)));}}),m=T.join();}else typeof p.text=="string"&&(m=J.t(p.text));return new ChoiceMenuOption(m,p.label,p.props,{type:p.type,oneTime:p.oneTime,onlyHaveNoChoice:p.onlyHaveNoChoice,autoSelect:p.autoSelect})});narration.choiceMenuOptions=o;}else narration.choiceMenuOptions=void 0;u!==void 0&&(narration.dialogue=u,this.skipEmptyDialogs&&typeof u=="string"&&(u===""||RegExp(/^\s+$/).test(u))&&(d=!0)),c?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):c===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let o of f){let p=o.label;typeof p=="object"&&(p=l(p)||"");let m=o.params?.map(T=>l(T));e={...e,...o.props},o.type==="jump"?(narration.closeCurrentLabel(),storage.setTempVariable(`${E}${narration.openedLabels.length}`,m),await narration.callLabel(p,e)):(storage.setTempVariable(`${E}${narration.openedLabels.length}`,m),await narration.callLabel(p,e));}y==="game_end"?(narration.closeAllLabels(),await narration.goNext(e)):y==="label_end"&&narration.closeCurrentLabel(),d&&await narration.goNext(e);}}};export{G as LabelJson};