@drincs/pixi-vn-json 1.2.0 → 1.2.2

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 ae=Object.create;var U=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,le=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 X=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var fe=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of se(t))!le.call(i,r)&&r!==e&&U(i,r,{get:()=>t[r],enumerable:!(a=re(t,r))||a.enumerable});return i};var ce=(i,t,e)=>(e=i!=null?ae(oe(i)):{},fe(U(e,"default",{value:i,enumerable:!0}),i));var Y=X((O,q)=>{(function(i,t){typeof O=="object"?q.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 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.")},f=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),d={},c=d.lib={},u=c.Base=function(){return {extend:function(n){var s=f(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)}}}(),h=c.WordArray=u.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,y=this.sigBytes,V=n.sigBytes;if(this.clamp(),y%4)for(var P=0;P<V;P++){var $=g[P>>>2]>>>24-P%4*8&255;s[y+P>>>2]|=$<<24-(y+P)%4*8;}else for(var C=0;C<V;C+=4)s[y+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=u.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 h.init(s,n)}}),o=d.enc={},p=o.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push((P>>>4).toString(16)),y.push((P&15).toString(16));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y+=2)g[y>>>3]|=parseInt(n.substr(y,2),16)<<24-y%8*4;return new h.init(g,s/2)}},m=o.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push(String.fromCharCode(P));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y++)g[y>>>2]|=(n.charCodeAt(y)&255)<<24-y%4*8;return new h.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=c.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new h.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,y=g.words,V=g.sigBytes,P=this.blockSize,$=P*4,C=V/$;n?C=t.ceil(C):C=t.max((C|0)-this._minBufferSize,0);var _=C*P,j=t.min(_*4,V);if(_){for(var H=0;H<_;H+=P)this._doProcessBlock(y,H);s=y.splice(0,_),g.sigBytes-=j;}return new h.init(s,j)},clone:function(){var n=u.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});c.Hasher=x.extend({cfg:u.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=d.algo={};return d}(Math);return i});});var Q=X((L,Z)=>{(function(i,t){typeof L=="object"?Z.exports=L=t(Y()):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,f=t.algo,d=[],c=f.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(u,h){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)d[N]=u[h+N]|0;else {var n=d[N-3]^d[N-8]^d[N-14]^d[N-16];d[N]=n<<1|n>>>31;}var s=(p<<5|p>>>27)+b+d[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 u=this._data,h=u.words,o=this._nDataBytes*8,p=u.sigBytes*8;return h[p>>>5]|=128<<24-p%32,h[(p+64>>>9<<4)+14]=Math.floor(o/4294967296),h[(p+64>>>9<<4)+15]=o,u.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var u=r.clone.call(this);return u._hash=this._hash.clone(),u}});t.SHA1=r._createHelper(c),t.HmacSHA1=r._createHmacHelper(c);}(),i.SHA1});});var ne=ce(Q());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(f=>{t[f]===void 0&&(r==="empty_string"?t[f]="":r==="copy_key"&&(i._beforeToTranslate?t[f]=i._beforeToTranslate(f):t[f]=f));});}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 f=[];Array.isArray(r.choices)?f=[r.choices]:f=i.getConditionalsThenElse(r.choices),f.forEach(d=>d.forEach(c=>{if("type"in c){let u=[];c.type==="ifelse"||c.type==="stepswitch"?i.getConditionalsThenElse(c,u):u=[c],u.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 f=[];Array.isArray(r.dialogue)?f=[r.dialogue]:f=i.getConditionalsThenElse(r.dialogue),f.forEach(d=>{typeof d=="string"?i.addKey(e,d,a):"text"in d&&Array.isArray(d.text)&&d.text.forEach(c=>{typeof c=="string"?i.addKey(e,c,a):i.getConditionalsThenElse(c).forEach(h=>{typeof h=="string"?i.addKey(e,h,a):Array.isArray(h)&&h.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(d=>{Array.isArray(d)?i.generateJsonTranslation(d,e,a):i.generateJsonTranslation([d],e,a);});}),e}};var I=J;function pe(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function de(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return ge(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=pe(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 f,d=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(f=l(e[e.length-1])),d>e.length-1?f:l(e[d]);case"sequentialrandom":let c=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(c==null&&i.end=="lastItem"){let u=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!u||!u?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let h=u.usedRandomNumbers[`0-${e.length-1}`];return l(e[h[h.length-1]])}if(c==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return l(e[c])}}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 ge(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(f=>{let d=l(f);e.push(d);});else {let f=l(r);e.push(f);}});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 I.t(a).join("");if(typeof a[0]=="object"){let r=a,f,d=r.map((n,s)=>{n=R(n);let g=l(n.dialogue)||"";return s===0?(f=l(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),f===!1&&(g=`
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn');var re=Object.create;var U=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var le=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var F=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(i,e)=>(typeof require<"u"?require:i)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var X=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports);var ce=(t,i,e,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of oe(i))!fe.call(t,r)&&r!==e&&U(t,r,{get:()=>i[r],enumerable:!(a=se(i,r))||a.enumerable});return t};var ue=(t,i,e)=>(e=t!=null?re(le(t)):{},ce(U(e,"default",{value:t,enumerable:!0}),t));var Y=X((L,q)=>{(function(t,i){typeof L=="object"?q.exports=L=i():typeof define=="function"&&define.amd?define([],i):t.CryptoJS=i();})(L,function(){var t=t||function(i,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.")},l=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),c={},u=c.lib={},p=u.Base=function(){return {extend:function(n){var s=l(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)}}}(),h=u.WordArray=p.extend({init:function(n,s){n=this.words=n||[],s!=e?this.sigBytes=s:this.sigBytes=n.length*4;},toString:function(n){return (n||d).stringify(this)},concat:function(n){var s=this.words,g=n.words,y=this.sigBytes,V=n.sigBytes;if(this.clamp(),y%4)for(var P=0;P<V;P++){var $=g[P>>>2]>>>24-P%4*8&255;s[y+P>>>2]|=$<<24-(y+P)%4*8;}else for(var w=0;w<V;w+=4)s[y+w>>>2]=g[w>>>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=i.ceil(s/4);},clone:function(){var n=p.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 h.init(s,n)}}),f=c.enc={},d=f.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push((P>>>4).toString(16)),y.push((P&15).toString(16));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y+=2)g[y>>>3]|=parseInt(n.substr(y,2),16)<<24-y%8*4;return new h.init(g,s/2)}},m=f.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push(String.fromCharCode(P));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y++)g[y>>>2]|=(n.charCodeAt(y)&255)<<24-y%4*8;return new h.init(g,s)}},T=f.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=u.BufferedBlockAlgorithm=p.extend({reset:function(){this._data=new h.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,y=g.words,V=g.sigBytes,P=this.blockSize,$=P*4,w=V/$;n?w=i.ceil(w):w=i.max((w|0)-this._minBufferSize,0);var _=w*P,j=i.min(_*4,V);if(_){for(var H=0;H<_;H+=P)this._doProcessBlock(y,H);s=y.splice(0,_),g.sigBytes-=j;}return new h.init(s,j)},clone:function(){var n=p.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});u.Hasher=x.extend({cfg:p.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=c.algo={};return c}(Math);return t});});var Q=X((I,Z)=>{(function(t,i){typeof I=="object"?Z.exports=I=i(Y()):typeof define=="function"&&define.amd?define(["./core"],i):i(t.CryptoJS);})(I,function(t){return function(){var i=t,e=i.lib,a=e.WordArray,r=e.Hasher,l=i.algo,c=[],u=l.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(p,h){for(var f=this._hash.words,d=f[0],m=f[1],T=f[2],x=f[3],b=f[4],N=0;N<80;N++){if(N<16)c[N]=p[h+N]|0;else {var n=c[N-3]^c[N-8]^c[N-14]^c[N-16];c[N]=n<<1|n>>>31;}var s=(d<<5|d>>>27)+b+c[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=d,d=s;}f[0]=f[0]+d|0,f[1]=f[1]+m|0,f[2]=f[2]+T|0,f[3]=f[3]+x|0,f[4]=f[4]+b|0;},_doFinalize:function(){var p=this._data,h=p.words,f=this._nDataBytes*8,d=p.sigBytes*8;return h[d>>>5]|=128<<24-d%32,h[(d+64>>>9<<4)+14]=Math.floor(f/4294967296),h[(d+64>>>9<<4)+15]=f,p.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var p=r.clone.call(this);return p._hash=this._hash.clone(),p}});i.SHA1=r._createHelper(u),i.HmacSHA1=r._createHmacHelper(u);}(),t.SHA1});});var ae=ue(Q());var E="___param___";var J=class t{static _beforeToTranslate=void 0;static _translate=i=>i;static _afterToTranslate=void 0;static t(i){return Array.isArray(i)?i.map(e=>t.translate(`${e}`)):t.translate(`${i}`)}static set beforeToTranslate(i){t._beforeToTranslate=i;}static set translate(i){t._translate=i;}static get translate(){return i=>{let e=i;return t._beforeToTranslate&&(e=t._beforeToTranslate(e)),e=t._translate(e),t._afterToTranslate&&(e=t._afterToTranslate(e)),e}}static set afterToTranslate(i){t._afterToTranslate=i;}static addKey(i,e,a){let r=a.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(l=>{i[l]===void 0&&(r==="empty_string"?i[l]="":r==="copy_key"&&(t._beforeToTranslate?i[l]=t._beforeToTranslate(l):i[l]=l));});}static getConditionalsThenElse(i,e=[]){if(typeof i=="object"&&i&&"type"in i)if(i.type==="ifelse")i.then&&t.getConditionalsThenElse(i.then,e),i.else&&t.getConditionalsThenElse(i.else,e);else if(i.type==="stepswitch"){if(i.elements)if(Array.isArray(i.elements))i.elements.forEach(a=>{t.getConditionalsThenElse(a,e);});else if(i.elements.type==="ifelse"){let a=[];t.getConditionalsThenElse(i.elements,a),a.forEach(r=>{e.push(...r);});}else if(i.elements.type==="stepswitch"){let a=[];t.getConditionalsThenElse(i.elements,a),a.forEach(r=>{e.push(...r);});}else t.getConditionalsThenElse(i.elements,e);}else i.type==="resulttocombine"?(i.firstItem&&t.getConditionalsThenElse(i.firstItem,e),i.secondConditionalItem&&i.secondConditionalItem.forEach(a=>{t.getConditionalsThenElse(a,e);})):e.push(i);else i&&e.push(i);return e}static generateJsonTranslation(i,e={},a={}){return i.forEach(r=>{if(r.choices){let l=[];Array.isArray(r.choices)?l=[r.choices]:l=t.getConditionalsThenElse(r.choices),l.forEach(c=>c.forEach(u=>{if("type"in u){let p=[];u.type==="ifelse"||u.type==="stepswitch"?t.getConditionalsThenElse(u,p):p=[u],p.map(f=>t.getConditionalsThenElse(f.text)).forEach(f=>{Array.isArray(f)&&f.forEach(d=>{Array.isArray(d)?d.forEach(m=>{typeof m=="string"?t.addKey(e,m,a):t.getConditionalsThenElse(m).forEach(T=>{Array.isArray(T)?T.forEach(x=>{typeof x=="string"&&t.addKey(e,x,a);}):typeof T=="string"&&t.addKey(e,T,a);});}):typeof d=="string"&&t.addKey(e,d,a);});});}}));}if(r.dialogue){let l=[];Array.isArray(r.dialogue)?l=[r.dialogue]:l=t.getConditionalsThenElse(r.dialogue),l.forEach(c=>{typeof c=="string"?t.addKey(e,c,a):"text"in c&&Array.isArray(c.text)&&c.text.forEach(u=>{typeof u=="string"?t.addKey(e,u,a):t.getConditionalsThenElse(u).forEach(h=>{typeof h=="string"?t.addKey(e,h,a):Array.isArray(h)&&h.forEach(f=>{typeof f=="string"?t.addKey(e,f,a):t.getConditionalsThenElse(f).forEach(d=>{typeof d=="string"&&t.addKey(e,d,a);});});});});});}r.conditionalStep&&t.getConditionalsThenElse(r.conditionalStep).forEach(c=>{Array.isArray(c)?t.generateJsonTranslation(c,e,a):t.generateJsonTranslation([c],e,a);});}),e}};var D=J;function de(t,i){return Math.floor(Math.random()*(i-t+1)+t)}function ge(t){if(Array.isArray(t)||!t)return t;if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"resulttocombine":return he(t);case"ifelse":return o(t.condition)?o(t.then):o(t.else);case"stepswitch":let e=o(t.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(t.choiceType){case"random":let a=de(0,e.length-1);return o(e[a]);case"loop":let r=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return r>e.length-1&&(r=r%e.length),o(e[r]);case"sequential":let l,c=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return t.end=="lastItem"&&(l=o(e[e.length-1])),c>e.length-1?l:o(e[c]);case"sequentialrandom":let u=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:t.nestedId,onceOnly:!0});if(u==null&&t.end=="lastItem"){let p=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(t.nestedId);if(!p||!p?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let h=p.usedRandomNumbers[`0-${e.length-1}`];return o(e[h[h.length-1]])}if(u==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return o(e[u])}}return t}function A(t){if(t.conditionalStep){let i=pixiVn.createExportableElement(o(t.conditionalStep));if(i?.glueEnabled===void 0&&delete i?.glueEnabled,i?.goNextStep===void 0&&delete i?.goNextStep,i?.end===void 0&&delete i?.end,i?.choices===void 0&&delete i?.choices,i?.dialogue===void 0&&delete i?.dialogue,i?.labelToOpen===void 0&&delete i?.labelToOpen,i?.operations===void 0&&delete i?.operations,i){let e={...t,conditionalStep:void 0,...i};return A(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 t}function he(t){let i=t.firstItem,e=[];t.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(l=>{let c=o(l);e.push(c);});else {let l=o(r);e.push(l);}});let a=i?[i,...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,l,c=r.map((n,s)=>{n=A(n);let g=o(n.dialogue)||"";return s===0?(l=o(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),l===!1&&(g=`
2
2
 
3
- `+g),f=l(n.glueEnabled)||!1,g)}),c=l(d[0]),u=typeof c=="object"&&"character"in c?c.character:void 0,h=d.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(y=>{let V=l(y);return I.t(`${V}`)}).join(""):g=l(s)||"",I.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:u?{character:u,text:h}:h,end:o?.end,choices:p?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function he(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 me(i)}return !!i}function ye(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 me(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 te(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=de(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return ye(t);case"arithmetic":case"arithmeticsingle":return Te(t);case"compare":case"valueCondition":case"union":return he(t)}return t}function Te(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 M(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 c=new pixiVn.ImageSprite(e.props,e.url||e.alias);await z(c,e);break;case"edit":let u=pixiVn.canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"video":switch(e.operationType){case"show":let c=new pixiVn.VideoSprite(e.props,e.url||e.alias);await z(c,e);break;case"edit":let u=pixiVn.canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":B(e);break;case"pause":let h=pixiVn.canvas.find(e.alias);h?h.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"imagecontainer":switch(e.operationType){case"show":let c=new pixiVn.ImageContainer(e.props,e.urls);await z(c,e);break;case"edit":let u=pixiVn.canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] ImageContainer with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"canvaselement":switch(e.operationType){case"edit":try{let c=pixiVn.canvas.find(e.alias);c?e.props&&(c.memory={...c.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Canvas Element with alias ${e.alias} not found.`);}catch(c){console.error(`[Pixi\u2019VN Json] There was an error while trying to edit the canvas element with alias ${e.alias}.`,c);}break;case"remove":B(e);break}break;case"value":te(e);break;case"operationtoconvert":if(t){let c="";e.values.forEach(h=>{if(typeof h=="string")c+=h;else {let o=l(h);c+=`${o}`;}});let u=await t(c);u&&await M(u,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 f=new pixiVn.RotateTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,f);break;case"zoom":let d=new pixiVn.ZoomTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,d);break;case"shake":await pixiVn.shakeEffect(e.alias,e.props,e.priority);break}}async function z(i,t){if(t.transition)switch(t.transition.type){case"fade":await pixiVn.showWithFadeTransition(t.alias,i,t.transition.props,t.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(t.alias,i,t.transition.props,t.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(t.alias,i,t.transition.props,t.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(t.alias,i,t.transition.props,t.transition.priority);break;case"pushin":case"pushout":await pixiVn.pushIn(t.alias,i,t.transition.props,t.transition.priority);break}else pixiVn.canvas.add(t.alias,i),await i.load();}function B(i){if(i.transition)switch(i.transition.type){case"fade":pixiVn.removeWithFadeTransition(i.alias,i.transition.props,i.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(i.alias,i.transition.props,i.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(i.alias,i.transition.props,i.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(i.alias,i.transition.props,i.transition.priority);break;case"pushin":case"pushout":pixiVn.pushOut(i.alias,i.transition.props,i.transition.priority);break}else pixiVn.canvas.remove(i.alias);}var K=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, ne.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 f=l(r);f?(f&&!Array.isArray(f)&&typeof f=="object"&&(f=l(f)||""),Array.isArray(f)?a=a.concat(f):a.push(`${f}`)):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 M(o,this.operationStringConvert?p=>this.operationStringConvert(p,a,e):void 0);let r=this.getChoices(a.choices),f=l(a.glueEnabled),d=this.getDialogue(a.dialogue),c=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(o=>{let p=l(o);p&&c.push(p);}));let u=l(a.goNextStep),h=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;d!==void 0&&(pixiVn.narration.dialogue=d,this.skipEmptyDialogs&&typeof d=="string"&&(d===""||RegExp(/^\s+$/).test(d))&&(u=!0)),f?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):f===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let o of c){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));}h==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e)):h==="label_end"&&pixiVn.narration.closeCurrentLabel(),u&&await pixiVn.narration.goNext(e);}}};module.exports=K;
3
+ `+g),l=o(n.glueEnabled)||!1,g)}),u=o(c[0]),p=typeof u=="object"&&"character"in u?u.character:void 0,h=c.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(y=>{let V=o(y);return D.t(`${V}`)}).join(""):g=o(s)||"",D.t(g)}).join(""),f=r.find(n=>n.end),d=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:p?{character:p,text:h}:h,end:f?.end,choices:d?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function ye(t){if(!t)return !1;if(typeof t!="object"||!("type"in t))return !!t;switch(t.type){case"compare":let i=o(t.leftValue),e=o(t.rightValue);switch(t.operator){case"==":return i===e;case"!=":return i!==e;case"<":return i<e;case"<=":return i<=e;case">":return i>e;case">=":return i>=e;case"CONTAINS":return i.toString().includes(e.toString())}break;case"valueCondition":return !!o(t.value);case"union":return Te(t)}return !!t}function me(t){if(t&&typeof t=="object"&&"type"in t&&t.type==="value"&&t.storageOperationType==="get")switch(t.storageType){case"storage":case"tempstorage":return pixiVn.storage.getVariable(t.key);case"flagStorage":return pixiVn.getFlag(t.key);case"label":return pixiVn.narration.getTimesLabelOpened(t.label);case"choice":return pixiVn.narration.getTimesChoiceMade(t.index);case"logic":return o(t.operation);case"params":let i=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];if(i&&i.length>t.key)return i[t.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return t}function Te(t){if(t.unionType==="not")return !o(t.condition);let i=t.unionType==="and";for(let e=0;e<t.conditions.length;e++)if(i=o(t.conditions[e])||!1,t.unionType==="and"){if(!i)return !1}else if(i)return !0;return i}function ie(t){let i=o(t.value),e;switch(i&&typeof i=="object"&&"type"in i?e=o(i):e=i,t.storageType){case"flagStorage":pixiVn.setFlag(t.key,t.value);break;case"storage":pixiVn.storage.setVariable(t.key,e);break;case"tempstorage":pixiVn.storage.setTempVariable(t.key,e);break;case"params":let a=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];a&&a.length-1>=t.key&&(a[t.key]=e),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length-1}`,a);break}}function o(t){let i=ge(t);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"value":return me(i);case"arithmetic":case"arithmeticsingle":return xe(i);case"compare":case"valueCondition":case"union":return ye(i)}return i}function xe(t){let i=o(t.leftValue);switch(t.type){case"arithmetic":let e=o(t.rightValue);switch(t.operator){case"*":return i*e;case"/":return i/e;case"+":return i+e;case"-":return i-e;case"%":return i%e;case"POW":return Math.pow(i,e);case"RANDOM":return pixiVn.narration.getRandomNumber(i,e)}case"arithmeticsingle":switch(t.operator){case"INT":return parseInt(i);case"FLOOR":return Math.floor(i);case"FLOAT":return parseFloat(i)}break}}async function te(t){let i=o(t);if(i)switch(i.type){case"assets":switch(i.operationType){case"load":await pixiVn.Assets.load(i.assets);break}break}}async function z(t,i){let e=o(t);if(e)switch(e.type){case"sound":switch(e.operationType){case"play":pixiVn.sound.play(e.alias,e.props);break;case"stop":pixiVn.sound.stop(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 u=new pixiVn.ImageSprite(e.props,e.url||e.alias);await W(u,e);break;case"edit":let p=pixiVn.canvas.find(e.alias);p?e.props&&await p.setMemory({...p.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"video":switch(e.operationType){case"show":let u=new pixiVn.VideoSprite(e.props,e.url||e.alias);await W(u,e);break;case"edit":let p=pixiVn.canvas.find(e.alias);p?e.props&&await p.setMemory({...p.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":B(e);break;case"pause":let h=pixiVn.canvas.find(e.alias);h?h.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let f=pixiVn.canvas.find(e.alias);f?f.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"imagecontainer":switch(e.operationType){case"show":let u=new pixiVn.ImageContainer(e.props,e.urls);await W(u,e);break;case"edit":let p=pixiVn.canvas.find(e.alias);p?e.props&&await p.setMemory({...p.memory,...e.props}):console.error(`[Pixi\u2019VN Json] ImageContainer with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"canvaselement":switch(e.operationType){case"edit":try{let u=pixiVn.canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Canvas Element with alias ${e.alias} not found.`);}catch(u){console.error(`[Pixi\u2019VN Json] There was an error while trying to edit the canvas element with alias ${e.alias}.`,u);}break;case"remove":B(e);break}break;case"value":ie(e);break;case"operationtoconvert":if(i){let u="";e.values.forEach(h=>{if(typeof h=="string")u+=h;else {let f=o(h);u+=`${f}`;}});let p=await i(u);p&&await z(p,i);}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 l=new pixiVn.RotateTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,l);break;case"zoom":let c=new pixiVn.ZoomTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,c);break;case"shake":await pixiVn.shakeEffect(e.alias,e.props,e.priority);break}}async function W(t,i){if(i.transition)switch(i.transition.type){case"fade":await pixiVn.showWithFadeTransition(i.alias,t,i.transition.props,i.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(i.alias,t,i.transition.props,i.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(i.alias,t,i.transition.props,i.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(i.alias,t,i.transition.props,i.transition.priority);break;case"pushin":case"pushout":await pixiVn.pushIn(i.alias,t,i.transition.props,i.transition.priority);break}else pixiVn.canvas.add(i.alias,t),await t.load();}function B(t){if(t.transition)switch(t.transition.type){case"fade":pixiVn.removeWithFadeTransition(t.alias,t.transition.props,t.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(t.alias,t.transition.props,t.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(t.alias,t.transition.props,t.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(t.alias,t.transition.props,t.transition.priority);break;case"pushin":case"pushout":pixiVn.pushOut(t.alias,t.transition.props,t.transition.priority);break}else pixiVn.canvas.remove(t.alias);}var K=class extends pixiVn.LabelAbstract{constructor(i,e,a,r={}){a||(a={}),a.onLoadingLabel=async()=>{for(let l of e){let c;if(typeof l=="function"?c=l():c=l,c=A(c),c.operations){let u=c.operations.map(p=>te(p));await Promise.all(u);}}},super(i,a),this._steps=e,this.operationStringConvert=r.operationStringConvert,this.skipEmptyDialogs=r.skipEmptyDialogs||!1;}_steps;get steps(){return this._steps.map(i=>this.stepConverter(i))}operationStringConvert;skipEmptyDialogs=!1;getStepSha1(i){if(i<0||i>=this.steps.length)return;let e=this._steps[i];return (0, ae.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(i){let e="";if(Array.isArray(i)){let a=[];i.forEach(r=>{if(typeof r=="string")a.push(r);else if(r&&typeof r=="object"){let l=o(r);l?(l&&!Array.isArray(l)&&typeof l=="object"&&(l=o(l)||""),Array.isArray(l)?a=a.concat(l):a.push(`${l}`)):a.push(`${r}`);}}),e=a;}else {let a=o(i)||"";a&&!Array.isArray(a)&&typeof a=="object"&&(a=o(a)||""),e=a;}return `${e}`}getDialogue(i){if(i==null)return;let e=o(i);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(i){return o(i)?.map(r=>o(r)).filter(r=>r!==void 0)}stepConverter(i){return async e=>{let a;if(typeof i=="function"?a=i():a=i,a=A(a),a.operations)for(let f of a.operations)await z(f,this.operationStringConvert?d=>this.operationStringConvert(d,a,e):void 0);let r=this.getChoices(a.choices),l=o(a.glueEnabled),c=this.getDialogue(a.dialogue),u=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(f=>{let d=o(f);d&&u.push(d);}));let p=o(a.goNextStep),h=o(a.end);if(r){let f=r.map(d=>{let m="";if(Array.isArray(d.text)){let T=[];d.text.forEach(x=>{if(typeof x=="string")T.push(J.t(x));else if(x&&typeof x=="object"){let b=o(x);b&&!Array.isArray(b)&&typeof b=="object"&&(b=o(b)||""),b&&(Array.isArray(b)?T=T.concat(J.t(b)):T.push(J.t(b)));}}),m=T.join();}else typeof d.text=="string"&&(m=J.t(d.text));return new pixiVn.ChoiceMenuOption(m,d.label,d.props,{type:d.type,oneTime:d.oneTime,onlyHaveNoChoice:d.onlyHaveNoChoice,autoSelect:d.autoSelect})});pixiVn.narration.choiceMenuOptions=f;}else pixiVn.narration.choiceMenuOptions=void 0;c!==void 0&&(pixiVn.narration.dialogue=c,this.skipEmptyDialogs&&typeof c=="string"&&(c===""||RegExp(/^\s+$/).test(c))&&(p=!0)),l?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):l===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let f of u){let d=f.label;typeof d=="object"&&(d=o(d)||"");let m=f.params?.map(T=>o(T));e={...e,...f.props},f.type==="jump"?(pixiVn.narration.closeCurrentLabel(),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,m),await pixiVn.narration.callLabel(d,e)):(pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,m),await pixiVn.narration.callLabel(d,e));}h==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e)):h==="label_end"&&pixiVn.narration.closeCurrentLabel(),p&&await pixiVn.narration.goNext(e);}}};module.exports=K;
@@ -1,3 +1,3 @@
1
- import {LabelAbstract,ChoiceMenuOption,narration,setFlag,storage,createExportableElement,getFlag,shakeEffect,ZoomTicker,canvas,RotateTicker,MoveTicker,FadeAlphaTicker,ImageContainer,VideoSprite,ImageSprite,Assets,sound,pushIn,zoomIn,moveIn,showWithDissolveTransition,showWithFadeTransition,pushOut,zoomOut,moveOut,removeWithDissolveTransition,removeWithFadeTransition,NarrationManagerStatic}from'@drincs/pixi-vn';var ae=Object.create;var U=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,le=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 X=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var fe=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of se(t))!le.call(i,r)&&r!==e&&U(i,r,{get:()=>t[r],enumerable:!(a=re(t,r))||a.enumerable});return i};var ce=(i,t,e)=>(e=i!=null?ae(oe(i)):{},fe(U(e,"default",{value:i,enumerable:!0}),i));var Y=X((O,q)=>{(function(i,t){typeof O=="object"?q.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 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.")},f=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),d={},c=d.lib={},u=c.Base=function(){return {extend:function(n){var s=f(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)}}}(),h=c.WordArray=u.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,y=this.sigBytes,V=n.sigBytes;if(this.clamp(),y%4)for(var P=0;P<V;P++){var $=g[P>>>2]>>>24-P%4*8&255;s[y+P>>>2]|=$<<24-(y+P)%4*8;}else for(var C=0;C<V;C+=4)s[y+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=u.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 h.init(s,n)}}),o=d.enc={},p=o.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push((P>>>4).toString(16)),y.push((P&15).toString(16));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y+=2)g[y>>>3]|=parseInt(n.substr(y,2),16)<<24-y%8*4;return new h.init(g,s/2)}},m=o.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push(String.fromCharCode(P));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y++)g[y>>>2]|=(n.charCodeAt(y)&255)<<24-y%4*8;return new h.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=c.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new h.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,y=g.words,V=g.sigBytes,P=this.blockSize,$=P*4,C=V/$;n?C=t.ceil(C):C=t.max((C|0)-this._minBufferSize,0);var _=C*P,j=t.min(_*4,V);if(_){for(var H=0;H<_;H+=P)this._doProcessBlock(y,H);s=y.splice(0,_),g.sigBytes-=j;}return new h.init(s,j)},clone:function(){var n=u.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});c.Hasher=x.extend({cfg:u.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=d.algo={};return d}(Math);return i});});var Q=X((L,Z)=>{(function(i,t){typeof L=="object"?Z.exports=L=t(Y()):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,f=t.algo,d=[],c=f.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(u,h){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)d[N]=u[h+N]|0;else {var n=d[N-3]^d[N-8]^d[N-14]^d[N-16];d[N]=n<<1|n>>>31;}var s=(p<<5|p>>>27)+b+d[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 u=this._data,h=u.words,o=this._nDataBytes*8,p=u.sigBytes*8;return h[p>>>5]|=128<<24-p%32,h[(p+64>>>9<<4)+14]=Math.floor(o/4294967296),h[(p+64>>>9<<4)+15]=o,u.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var u=r.clone.call(this);return u._hash=this._hash.clone(),u}});t.SHA1=r._createHelper(c),t.HmacSHA1=r._createHmacHelper(c);}(),i.SHA1});});var ne=ce(Q());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(f=>{t[f]===void 0&&(r==="empty_string"?t[f]="":r==="copy_key"&&(i._beforeToTranslate?t[f]=i._beforeToTranslate(f):t[f]=f));});}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 f=[];Array.isArray(r.choices)?f=[r.choices]:f=i.getConditionalsThenElse(r.choices),f.forEach(d=>d.forEach(c=>{if("type"in c){let u=[];c.type==="ifelse"||c.type==="stepswitch"?i.getConditionalsThenElse(c,u):u=[c],u.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 f=[];Array.isArray(r.dialogue)?f=[r.dialogue]:f=i.getConditionalsThenElse(r.dialogue),f.forEach(d=>{typeof d=="string"?i.addKey(e,d,a):"text"in d&&Array.isArray(d.text)&&d.text.forEach(c=>{typeof c=="string"?i.addKey(e,c,a):i.getConditionalsThenElse(c).forEach(h=>{typeof h=="string"?i.addKey(e,h,a):Array.isArray(h)&&h.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(d=>{Array.isArray(d)?i.generateJsonTranslation(d,e,a):i.generateJsonTranslation([d],e,a);});}),e}};var I=J;function pe(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function de(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return ge(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=pe(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 f,d=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(f=l(e[e.length-1])),d>e.length-1?f:l(e[d]);case"sequentialrandom":let c=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(c==null&&i.end=="lastItem"){let u=NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!u||!u?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let h=u.usedRandomNumbers[`0-${e.length-1}`];return l(e[h[h.length-1]])}if(c==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return l(e[c])}}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 ge(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(f=>{let d=l(f);e.push(d);});else {let f=l(r);e.push(f);}});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 I.t(a).join("");if(typeof a[0]=="object"){let r=a,f,d=r.map((n,s)=>{n=R(n);let g=l(n.dialogue)||"";return s===0?(f=l(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),f===!1&&(g=`
1
+ import {LabelAbstract,ChoiceMenuOption,narration,setFlag,storage,createExportableElement,getFlag,Assets,shakeEffect,ZoomTicker,canvas,RotateTicker,MoveTicker,FadeAlphaTicker,ImageContainer,VideoSprite,ImageSprite,sound,pushIn,zoomIn,moveIn,showWithDissolveTransition,showWithFadeTransition,pushOut,zoomOut,moveOut,removeWithDissolveTransition,removeWithFadeTransition,NarrationManagerStatic}from'@drincs/pixi-vn';var re=Object.create;var U=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var le=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var F=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(i,e)=>(typeof require<"u"?require:i)[e]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var X=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports);var ce=(t,i,e,a)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of oe(i))!fe.call(t,r)&&r!==e&&U(t,r,{get:()=>i[r],enumerable:!(a=se(i,r))||a.enumerable});return t};var ue=(t,i,e)=>(e=t!=null?re(le(t)):{},ce(U(e,"default",{value:t,enumerable:!0}),t));var Y=X((L,q)=>{(function(t,i){typeof L=="object"?q.exports=L=i():typeof define=="function"&&define.amd?define([],i):t.CryptoJS=i();})(L,function(){var t=t||function(i,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.")},l=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),c={},u=c.lib={},p=u.Base=function(){return {extend:function(n){var s=l(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)}}}(),h=u.WordArray=p.extend({init:function(n,s){n=this.words=n||[],s!=e?this.sigBytes=s:this.sigBytes=n.length*4;},toString:function(n){return (n||d).stringify(this)},concat:function(n){var s=this.words,g=n.words,y=this.sigBytes,V=n.sigBytes;if(this.clamp(),y%4)for(var P=0;P<V;P++){var $=g[P>>>2]>>>24-P%4*8&255;s[y+P>>>2]|=$<<24-(y+P)%4*8;}else for(var w=0;w<V;w+=4)s[y+w>>>2]=g[w>>>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=i.ceil(s/4);},clone:function(){var n=p.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 h.init(s,n)}}),f=c.enc={},d=f.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push((P>>>4).toString(16)),y.push((P&15).toString(16));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y+=2)g[y>>>3]|=parseInt(n.substr(y,2),16)<<24-y%8*4;return new h.init(g,s/2)}},m=f.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push(String.fromCharCode(P));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y++)g[y>>>2]|=(n.charCodeAt(y)&255)<<24-y%4*8;return new h.init(g,s)}},T=f.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=u.BufferedBlockAlgorithm=p.extend({reset:function(){this._data=new h.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,y=g.words,V=g.sigBytes,P=this.blockSize,$=P*4,w=V/$;n?w=i.ceil(w):w=i.max((w|0)-this._minBufferSize,0);var _=w*P,j=i.min(_*4,V);if(_){for(var H=0;H<_;H+=P)this._doProcessBlock(y,H);s=y.splice(0,_),g.sigBytes-=j;}return new h.init(s,j)},clone:function(){var n=p.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});u.Hasher=x.extend({cfg:p.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=c.algo={};return c}(Math);return t});});var Q=X((I,Z)=>{(function(t,i){typeof I=="object"?Z.exports=I=i(Y()):typeof define=="function"&&define.amd?define(["./core"],i):i(t.CryptoJS);})(I,function(t){return function(){var i=t,e=i.lib,a=e.WordArray,r=e.Hasher,l=i.algo,c=[],u=l.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(p,h){for(var f=this._hash.words,d=f[0],m=f[1],T=f[2],x=f[3],b=f[4],N=0;N<80;N++){if(N<16)c[N]=p[h+N]|0;else {var n=c[N-3]^c[N-8]^c[N-14]^c[N-16];c[N]=n<<1|n>>>31;}var s=(d<<5|d>>>27)+b+c[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=d,d=s;}f[0]=f[0]+d|0,f[1]=f[1]+m|0,f[2]=f[2]+T|0,f[3]=f[3]+x|0,f[4]=f[4]+b|0;},_doFinalize:function(){var p=this._data,h=p.words,f=this._nDataBytes*8,d=p.sigBytes*8;return h[d>>>5]|=128<<24-d%32,h[(d+64>>>9<<4)+14]=Math.floor(f/4294967296),h[(d+64>>>9<<4)+15]=f,p.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var p=r.clone.call(this);return p._hash=this._hash.clone(),p}});i.SHA1=r._createHelper(u),i.HmacSHA1=r._createHmacHelper(u);}(),t.SHA1});});var ae=ue(Q());var E="___param___";var J=class t{static _beforeToTranslate=void 0;static _translate=i=>i;static _afterToTranslate=void 0;static t(i){return Array.isArray(i)?i.map(e=>t.translate(`${e}`)):t.translate(`${i}`)}static set beforeToTranslate(i){t._beforeToTranslate=i;}static set translate(i){t._translate=i;}static get translate(){return i=>{let e=i;return t._beforeToTranslate&&(e=t._beforeToTranslate(e)),e=t._translate(e),t._afterToTranslate&&(e=t._afterToTranslate(e)),e}}static set afterToTranslate(i){t._afterToTranslate=i;}static addKey(i,e,a){let r=a.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(l=>{i[l]===void 0&&(r==="empty_string"?i[l]="":r==="copy_key"&&(t._beforeToTranslate?i[l]=t._beforeToTranslate(l):i[l]=l));});}static getConditionalsThenElse(i,e=[]){if(typeof i=="object"&&i&&"type"in i)if(i.type==="ifelse")i.then&&t.getConditionalsThenElse(i.then,e),i.else&&t.getConditionalsThenElse(i.else,e);else if(i.type==="stepswitch"){if(i.elements)if(Array.isArray(i.elements))i.elements.forEach(a=>{t.getConditionalsThenElse(a,e);});else if(i.elements.type==="ifelse"){let a=[];t.getConditionalsThenElse(i.elements,a),a.forEach(r=>{e.push(...r);});}else if(i.elements.type==="stepswitch"){let a=[];t.getConditionalsThenElse(i.elements,a),a.forEach(r=>{e.push(...r);});}else t.getConditionalsThenElse(i.elements,e);}else i.type==="resulttocombine"?(i.firstItem&&t.getConditionalsThenElse(i.firstItem,e),i.secondConditionalItem&&i.secondConditionalItem.forEach(a=>{t.getConditionalsThenElse(a,e);})):e.push(i);else i&&e.push(i);return e}static generateJsonTranslation(i,e={},a={}){return i.forEach(r=>{if(r.choices){let l=[];Array.isArray(r.choices)?l=[r.choices]:l=t.getConditionalsThenElse(r.choices),l.forEach(c=>c.forEach(u=>{if("type"in u){let p=[];u.type==="ifelse"||u.type==="stepswitch"?t.getConditionalsThenElse(u,p):p=[u],p.map(f=>t.getConditionalsThenElse(f.text)).forEach(f=>{Array.isArray(f)&&f.forEach(d=>{Array.isArray(d)?d.forEach(m=>{typeof m=="string"?t.addKey(e,m,a):t.getConditionalsThenElse(m).forEach(T=>{Array.isArray(T)?T.forEach(x=>{typeof x=="string"&&t.addKey(e,x,a);}):typeof T=="string"&&t.addKey(e,T,a);});}):typeof d=="string"&&t.addKey(e,d,a);});});}}));}if(r.dialogue){let l=[];Array.isArray(r.dialogue)?l=[r.dialogue]:l=t.getConditionalsThenElse(r.dialogue),l.forEach(c=>{typeof c=="string"?t.addKey(e,c,a):"text"in c&&Array.isArray(c.text)&&c.text.forEach(u=>{typeof u=="string"?t.addKey(e,u,a):t.getConditionalsThenElse(u).forEach(h=>{typeof h=="string"?t.addKey(e,h,a):Array.isArray(h)&&h.forEach(f=>{typeof f=="string"?t.addKey(e,f,a):t.getConditionalsThenElse(f).forEach(d=>{typeof d=="string"&&t.addKey(e,d,a);});});});});});}r.conditionalStep&&t.getConditionalsThenElse(r.conditionalStep).forEach(c=>{Array.isArray(c)?t.generateJsonTranslation(c,e,a):t.generateJsonTranslation([c],e,a);});}),e}};var D=J;function de(t,i){return Math.floor(Math.random()*(i-t+1)+t)}function ge(t){if(Array.isArray(t)||!t)return t;if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"resulttocombine":return he(t);case"ifelse":return o(t.condition)?o(t.then):o(t.else);case"stepswitch":let e=o(t.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(t.choiceType){case"random":let a=de(0,e.length-1);return o(e[a]);case"loop":let r=NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return r>e.length-1&&(r=r%e.length),o(e[r]);case"sequential":let l,c=NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return t.end=="lastItem"&&(l=o(e[e.length-1])),c>e.length-1?l:o(e[c]);case"sequentialrandom":let u=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:t.nestedId,onceOnly:!0});if(u==null&&t.end=="lastItem"){let p=NarrationManagerStatic.getCurrentStepTimesCounterData(t.nestedId);if(!p||!p?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let h=p.usedRandomNumbers[`0-${e.length-1}`];return o(e[h[h.length-1]])}if(u==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return o(e[u])}}return t}function A(t){if(t.conditionalStep){let i=createExportableElement(o(t.conditionalStep));if(i?.glueEnabled===void 0&&delete i?.glueEnabled,i?.goNextStep===void 0&&delete i?.goNextStep,i?.end===void 0&&delete i?.end,i?.choices===void 0&&delete i?.choices,i?.dialogue===void 0&&delete i?.dialogue,i?.labelToOpen===void 0&&delete i?.labelToOpen,i?.operations===void 0&&delete i?.operations,i){let e={...t,conditionalStep:void 0,...i};return A(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 t}function he(t){let i=t.firstItem,e=[];t.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(l=>{let c=o(l);e.push(c);});else {let l=o(r);e.push(l);}});let a=i?[i,...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,l,c=r.map((n,s)=>{n=A(n);let g=o(n.dialogue)||"";return s===0?(l=o(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),l===!1&&(g=`
2
2
 
3
- `+g),f=l(n.glueEnabled)||!1,g)}),c=l(d[0]),u=typeof c=="object"&&"character"in c?c.character:void 0,h=d.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(y=>{let V=l(y);return I.t(`${V}`)}).join(""):g=l(s)||"",I.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:u?{character:u,text:h}:h,end:o?.end,choices:p?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function he(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 me(i)}return !!i}function ye(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 me(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 te(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=de(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return ye(t);case"arithmetic":case"arithmeticsingle":return Te(t);case"compare":case"valueCondition":case"union":return he(t)}return t}function Te(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 M(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 c=new ImageSprite(e.props,e.url||e.alias);await z(c,e);break;case"edit":let u=canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"video":switch(e.operationType){case"show":let c=new VideoSprite(e.props,e.url||e.alias);await z(c,e);break;case"edit":let u=canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":B(e);break;case"pause":let h=canvas.find(e.alias);h?h.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"imagecontainer":switch(e.operationType){case"show":let c=new ImageContainer(e.props,e.urls);await z(c,e);break;case"edit":let u=canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] ImageContainer with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"canvaselement":switch(e.operationType){case"edit":try{let c=canvas.find(e.alias);c?e.props&&(c.memory={...c.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Canvas Element with alias ${e.alias} not found.`);}catch(c){console.error(`[Pixi\u2019VN Json] There was an error while trying to edit the canvas element with alias ${e.alias}.`,c);}break;case"remove":B(e);break}break;case"value":te(e);break;case"operationtoconvert":if(t){let c="";e.values.forEach(h=>{if(typeof h=="string")c+=h;else {let o=l(h);c+=`${o}`;}});let u=await t(c);u&&await M(u,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 f=new RotateTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,f);break;case"zoom":let d=new ZoomTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,d);break;case"shake":await shakeEffect(e.alias,e.props,e.priority);break}}async function z(i,t){if(t.transition)switch(t.transition.type){case"fade":await showWithFadeTransition(t.alias,i,t.transition.props,t.transition.priority);break;case"dissolve":await showWithDissolveTransition(t.alias,i,t.transition.props,t.transition.priority);break;case"movein":case"moveout":await moveIn(t.alias,i,t.transition.props,t.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(t.alias,i,t.transition.props,t.transition.priority);break;case"pushin":case"pushout":await pushIn(t.alias,i,t.transition.props,t.transition.priority);break}else canvas.add(t.alias,i),await i.load();}function B(i){if(i.transition)switch(i.transition.type){case"fade":removeWithFadeTransition(i.alias,i.transition.props,i.transition.priority);break;case"dissolve":removeWithDissolveTransition(i.alias,i.transition.props,i.transition.priority);break;case"movein":case"moveout":moveOut(i.alias,i.transition.props,i.transition.priority);break;case"zoomin":case"zoomout":zoomOut(i.alias,i.transition.props,i.transition.priority);break;case"pushin":case"pushout":pushOut(i.alias,i.transition.props,i.transition.priority);break}else canvas.remove(i.alias);}var K=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, ne.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 f=l(r);f?(f&&!Array.isArray(f)&&typeof f=="object"&&(f=l(f)||""),Array.isArray(f)?a=a.concat(f):a.push(`${f}`)):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 M(o,this.operationStringConvert?p=>this.operationStringConvert(p,a,e):void 0);let r=this.getChoices(a.choices),f=l(a.glueEnabled),d=this.getDialogue(a.dialogue),c=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(o=>{let p=l(o);p&&c.push(p);}));let u=l(a.goNextStep),h=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;d!==void 0&&(narration.dialogue=d,this.skipEmptyDialogs&&typeof d=="string"&&(d===""||RegExp(/^\s+$/).test(d))&&(u=!0)),f?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):f===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let o of c){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));}h==="game_end"?(narration.closeAllLabels(),await narration.goNext(e)):h==="label_end"&&narration.closeCurrentLabel(),u&&await narration.goNext(e);}}};export{K as default};
3
+ `+g),l=o(n.glueEnabled)||!1,g)}),u=o(c[0]),p=typeof u=="object"&&"character"in u?u.character:void 0,h=c.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(y=>{let V=o(y);return D.t(`${V}`)}).join(""):g=o(s)||"",D.t(g)}).join(""),f=r.find(n=>n.end),d=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:p?{character:p,text:h}:h,end:f?.end,choices:d?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function ye(t){if(!t)return !1;if(typeof t!="object"||!("type"in t))return !!t;switch(t.type){case"compare":let i=o(t.leftValue),e=o(t.rightValue);switch(t.operator){case"==":return i===e;case"!=":return i!==e;case"<":return i<e;case"<=":return i<=e;case">":return i>e;case">=":return i>=e;case"CONTAINS":return i.toString().includes(e.toString())}break;case"valueCondition":return !!o(t.value);case"union":return Te(t)}return !!t}function me(t){if(t&&typeof t=="object"&&"type"in t&&t.type==="value"&&t.storageOperationType==="get")switch(t.storageType){case"storage":case"tempstorage":return storage.getVariable(t.key);case"flagStorage":return getFlag(t.key);case"label":return narration.getTimesLabelOpened(t.label);case"choice":return narration.getTimesChoiceMade(t.index);case"logic":return o(t.operation);case"params":let i=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];if(i&&i.length>t.key)return i[t.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return t}function Te(t){if(t.unionType==="not")return !o(t.condition);let i=t.unionType==="and";for(let e=0;e<t.conditions.length;e++)if(i=o(t.conditions[e])||!1,t.unionType==="and"){if(!i)return !1}else if(i)return !0;return i}function ie(t){let i=o(t.value),e;switch(i&&typeof i=="object"&&"type"in i?e=o(i):e=i,t.storageType){case"flagStorage":setFlag(t.key,t.value);break;case"storage":storage.setVariable(t.key,e);break;case"tempstorage":storage.setTempVariable(t.key,e);break;case"params":let a=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];a&&a.length-1>=t.key&&(a[t.key]=e),storage.setTempVariable(`${E}${narration.openedLabels.length-1}`,a);break}}function o(t){let i=ge(t);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"value":return me(i);case"arithmetic":case"arithmeticsingle":return xe(i);case"compare":case"valueCondition":case"union":return ye(i)}return i}function xe(t){let i=o(t.leftValue);switch(t.type){case"arithmetic":let e=o(t.rightValue);switch(t.operator){case"*":return i*e;case"/":return i/e;case"+":return i+e;case"-":return i-e;case"%":return i%e;case"POW":return Math.pow(i,e);case"RANDOM":return narration.getRandomNumber(i,e)}case"arithmeticsingle":switch(t.operator){case"INT":return parseInt(i);case"FLOOR":return Math.floor(i);case"FLOAT":return parseFloat(i)}break}}async function te(t){let i=o(t);if(i)switch(i.type){case"assets":switch(i.operationType){case"load":await Assets.load(i.assets);break}break}}async function z(t,i){let e=o(t);if(e)switch(e.type){case"sound":switch(e.operationType){case"play":sound.play(e.alias,e.props);break;case"stop":sound.stop(e.alias);break;case"pause":sound.pause(e.alias);break;case"resume":sound.resume(e.alias);break;case"volume":sound.volume(e.alias,e.value);break}break;case"assets":switch(e.operationType){case"load":await Assets.load(e.assets);break}break;case"image":switch(e.operationType){case"show":let u=new ImageSprite(e.props,e.url||e.alias);await W(u,e);break;case"edit":let p=canvas.find(e.alias);p?e.props&&await p.setMemory({...p.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"video":switch(e.operationType){case"show":let u=new VideoSprite(e.props,e.url||e.alias);await W(u,e);break;case"edit":let p=canvas.find(e.alias);p?e.props&&await p.setMemory({...p.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":B(e);break;case"pause":let h=canvas.find(e.alias);h?h.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let f=canvas.find(e.alias);f?f.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"imagecontainer":switch(e.operationType){case"show":let u=new ImageContainer(e.props,e.urls);await W(u,e);break;case"edit":let p=canvas.find(e.alias);p?e.props&&await p.setMemory({...p.memory,...e.props}):console.error(`[Pixi\u2019VN Json] ImageContainer with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"canvaselement":switch(e.operationType){case"edit":try{let u=canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Canvas Element with alias ${e.alias} not found.`);}catch(u){console.error(`[Pixi\u2019VN Json] There was an error while trying to edit the canvas element with alias ${e.alias}.`,u);}break;case"remove":B(e);break}break;case"value":ie(e);break;case"operationtoconvert":if(i){let u="";e.values.forEach(h=>{if(typeof h=="string")u+=h;else {let f=o(h);u+=`${f}`;}});let p=await i(u);p&&await z(p,i);}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 l=new RotateTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,l);break;case"zoom":let c=new ZoomTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,c);break;case"shake":await shakeEffect(e.alias,e.props,e.priority);break}}async function W(t,i){if(i.transition)switch(i.transition.type){case"fade":await showWithFadeTransition(i.alias,t,i.transition.props,i.transition.priority);break;case"dissolve":await showWithDissolveTransition(i.alias,t,i.transition.props,i.transition.priority);break;case"movein":case"moveout":await moveIn(i.alias,t,i.transition.props,i.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(i.alias,t,i.transition.props,i.transition.priority);break;case"pushin":case"pushout":await pushIn(i.alias,t,i.transition.props,i.transition.priority);break}else canvas.add(i.alias,t),await t.load();}function B(t){if(t.transition)switch(t.transition.type){case"fade":removeWithFadeTransition(t.alias,t.transition.props,t.transition.priority);break;case"dissolve":removeWithDissolveTransition(t.alias,t.transition.props,t.transition.priority);break;case"movein":case"moveout":moveOut(t.alias,t.transition.props,t.transition.priority);break;case"zoomin":case"zoomout":zoomOut(t.alias,t.transition.props,t.transition.priority);break;case"pushin":case"pushout":pushOut(t.alias,t.transition.props,t.transition.priority);break}else canvas.remove(t.alias);}var K=class extends LabelAbstract{constructor(i,e,a,r={}){a||(a={}),a.onLoadingLabel=async()=>{for(let l of e){let c;if(typeof l=="function"?c=l():c=l,c=A(c),c.operations){let u=c.operations.map(p=>te(p));await Promise.all(u);}}},super(i,a),this._steps=e,this.operationStringConvert=r.operationStringConvert,this.skipEmptyDialogs=r.skipEmptyDialogs||!1;}_steps;get steps(){return this._steps.map(i=>this.stepConverter(i))}operationStringConvert;skipEmptyDialogs=!1;getStepSha1(i){if(i<0||i>=this.steps.length)return;let e=this._steps[i];return (0, ae.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(i){let e="";if(Array.isArray(i)){let a=[];i.forEach(r=>{if(typeof r=="string")a.push(r);else if(r&&typeof r=="object"){let l=o(r);l?(l&&!Array.isArray(l)&&typeof l=="object"&&(l=o(l)||""),Array.isArray(l)?a=a.concat(l):a.push(`${l}`)):a.push(`${r}`);}}),e=a;}else {let a=o(i)||"";a&&!Array.isArray(a)&&typeof a=="object"&&(a=o(a)||""),e=a;}return `${e}`}getDialogue(i){if(i==null)return;let e=o(i);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(i){return o(i)?.map(r=>o(r)).filter(r=>r!==void 0)}stepConverter(i){return async e=>{let a;if(typeof i=="function"?a=i():a=i,a=A(a),a.operations)for(let f of a.operations)await z(f,this.operationStringConvert?d=>this.operationStringConvert(d,a,e):void 0);let r=this.getChoices(a.choices),l=o(a.glueEnabled),c=this.getDialogue(a.dialogue),u=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(f=>{let d=o(f);d&&u.push(d);}));let p=o(a.goNextStep),h=o(a.end);if(r){let f=r.map(d=>{let m="";if(Array.isArray(d.text)){let T=[];d.text.forEach(x=>{if(typeof x=="string")T.push(J.t(x));else if(x&&typeof x=="object"){let b=o(x);b&&!Array.isArray(b)&&typeof b=="object"&&(b=o(b)||""),b&&(Array.isArray(b)?T=T.concat(J.t(b)):T.push(J.t(b)));}}),m=T.join();}else typeof d.text=="string"&&(m=J.t(d.text));return new ChoiceMenuOption(m,d.label,d.props,{type:d.type,oneTime:d.oneTime,onlyHaveNoChoice:d.onlyHaveNoChoice,autoSelect:d.autoSelect})});narration.choiceMenuOptions=f;}else narration.choiceMenuOptions=void 0;c!==void 0&&(narration.dialogue=c,this.skipEmptyDialogs&&typeof c=="string"&&(c===""||RegExp(/^\s+$/).test(c))&&(p=!0)),l?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):l===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let f of u){let d=f.label;typeof d=="object"&&(d=o(d)||"");let m=f.params?.map(T=>o(T));e={...e,...f.props},f.type==="jump"?(narration.closeCurrentLabel(),storage.setTempVariable(`${E}${narration.openedLabels.length}`,m),await narration.callLabel(d,e)):(storage.setTempVariable(`${E}${narration.openedLabels.length}`,m),await narration.callLabel(d,e));}h==="game_end"?(narration.closeAllLabels(),await narration.goNext(e)):h==="label_end"&&narration.closeCurrentLabel(),p&&await narration.goNext(e);}}};export{K as default};
@@ -1,3 +1,3 @@
1
- 'use strict';var pixiVn=require('@drincs/pixi-vn');var ae=Object.create;var U=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var W=(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 X=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var fe=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of se(t))!le.call(i,r)&&r!==e&&U(i,r,{get:()=>t[r],enumerable:!(a=re(t,r))||a.enumerable});return i};var ce=(i,t,e)=>(e=i!=null?ae(oe(i)):{},fe(U(e,"default",{value:i,enumerable:!0}),i));var Y=X((L,q)=>{(function(i,t){typeof L=="object"?q.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 W=="function")try{a=W("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.")},f=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),d={},c=d.lib={},u=c.Base=function(){return {extend:function(n){var s=f(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)}}}(),h=c.WordArray=u.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,y=this.sigBytes,V=n.sigBytes;if(this.clamp(),y%4)for(var P=0;P<V;P++){var H=g[P>>>2]>>>24-P%4*8&255;s[y+P>>>2]|=H<<24-(y+P)%4*8;}else for(var C=0;C<V;C+=4)s[y+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=u.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 h.init(s,n)}}),o=d.enc={},p=o.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push((P>>>4).toString(16)),y.push((P&15).toString(16));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y+=2)g[y>>>3]|=parseInt(n.substr(y,2),16)<<24-y%8*4;return new h.init(g,s/2)}},m=o.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push(String.fromCharCode(P));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y++)g[y>>>2]|=(n.charCodeAt(y)&255)<<24-y%4*8;return new h.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=c.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new h.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,y=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,j=t.min(_*4,V);if(_){for(var F=0;F<_;F+=P)this._doProcessBlock(y,F);s=y.splice(0,_),g.sigBytes-=j;}return new h.init(s,j)},clone:function(){var n=u.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});c.Hasher=x.extend({cfg:u.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=d.algo={};return d}(Math);return i});});var Q=X((O,Z)=>{(function(i,t){typeof O=="object"?Z.exports=O=t(Y()):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,f=t.algo,d=[],c=f.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(u,h){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)d[N]=u[h+N]|0;else {var n=d[N-3]^d[N-8]^d[N-14]^d[N-16];d[N]=n<<1|n>>>31;}var s=(p<<5|p>>>27)+b+d[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 u=this._data,h=u.words,o=this._nDataBytes*8,p=u.sigBytes*8;return h[p>>>5]|=128<<24-p%32,h[(p+64>>>9<<4)+14]=Math.floor(o/4294967296),h[(p+64>>>9<<4)+15]=o,u.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var u=r.clone.call(this);return u._hash=this._hash.clone(),u}});t.SHA1=r._createHelper(c),t.HmacSHA1=r._createHmacHelper(c);}(),i.SHA1});});var ne=ce(Q());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(f=>{t[f]===void 0&&(r==="empty_string"?t[f]="":r==="copy_key"&&(i._beforeToTranslate?t[f]=i._beforeToTranslate(f):t[f]=f));});}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 f=[];Array.isArray(r.choices)?f=[r.choices]:f=i.getConditionalsThenElse(r.choices),f.forEach(d=>d.forEach(c=>{if("type"in c){let u=[];c.type==="ifelse"||c.type==="stepswitch"?i.getConditionalsThenElse(c,u):u=[c],u.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 f=[];Array.isArray(r.dialogue)?f=[r.dialogue]:f=i.getConditionalsThenElse(r.dialogue),f.forEach(d=>{typeof d=="string"?i.addKey(e,d,a):"text"in d&&Array.isArray(d.text)&&d.text.forEach(c=>{typeof c=="string"?i.addKey(e,c,a):i.getConditionalsThenElse(c).forEach(h=>{typeof h=="string"?i.addKey(e,h,a):Array.isArray(h)&&h.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(d=>{Array.isArray(d)?i.generateJsonTranslation(d,e,a):i.generateJsonTranslation([d],e,a);});}),e}};var I=J;function pe(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function de(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return ge(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=pe(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 f,d=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(f=l(e[e.length-1])),d>e.length-1?f:l(e[d]);case"sequentialrandom":let c=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(c==null&&i.end=="lastItem"){let u=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!u||!u?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let h=u.usedRandomNumbers[`0-${e.length-1}`];return l(e[h[h.length-1]])}if(c==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return l(e[c])}}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 ge(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(f=>{let d=l(f);e.push(d);});else {let f=l(r);e.push(f);}});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 I.t(a).join("");if(typeof a[0]=="object"){let r=a,f,d=r.map((n,s)=>{n=R(n);let g=l(n.dialogue)||"";return s===0?(f=l(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),f===!1&&(g=`
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn');var re=Object.create;var U=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var le=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var M=(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 X=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ce=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of oe(t))!fe.call(i,r)&&r!==e&&U(i,r,{get:()=>t[r],enumerable:!(a=se(t,r))||a.enumerable});return i};var ue=(i,t,e)=>(e=i!=null?re(le(i)):{},ce(U(e,"default",{value:i,enumerable:!0}),i));var Y=X((L,q)=>{(function(i,t){typeof L=="object"?q.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 M=="function")try{a=M("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.")},l=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),c={},u=c.lib={},p=u.Base=function(){return {extend:function(n){var s=l(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)}}}(),h=u.WordArray=p.extend({init:function(n,s){n=this.words=n||[],s!=e?this.sigBytes=s:this.sigBytes=n.length*4;},toString:function(n){return (n||d).stringify(this)},concat:function(n){var s=this.words,g=n.words,y=this.sigBytes,V=n.sigBytes;if(this.clamp(),y%4)for(var P=0;P<V;P++){var H=g[P>>>2]>>>24-P%4*8&255;s[y+P>>>2]|=H<<24-(y+P)%4*8;}else for(var w=0;w<V;w+=4)s[y+w>>>2]=g[w>>>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=p.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 h.init(s,n)}}),f=c.enc={},d=f.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push((P>>>4).toString(16)),y.push((P&15).toString(16));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y+=2)g[y>>>3]|=parseInt(n.substr(y,2),16)<<24-y%8*4;return new h.init(g,s/2)}},m=f.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push(String.fromCharCode(P));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y++)g[y>>>2]|=(n.charCodeAt(y)&255)<<24-y%4*8;return new h.init(g,s)}},T=f.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=u.BufferedBlockAlgorithm=p.extend({reset:function(){this._data=new h.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,y=g.words,V=g.sigBytes,P=this.blockSize,H=P*4,w=V/H;n?w=t.ceil(w):w=t.max((w|0)-this._minBufferSize,0);var _=w*P,j=t.min(_*4,V);if(_){for(var F=0;F<_;F+=P)this._doProcessBlock(y,F);s=y.splice(0,_),g.sigBytes-=j;}return new h.init(s,j)},clone:function(){var n=p.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});u.Hasher=x.extend({cfg:p.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=c.algo={};return c}(Math);return i});});var Q=X((I,Z)=>{(function(i,t){typeof I=="object"?Z.exports=I=t(Y()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(I,function(i){return function(){var t=i,e=t.lib,a=e.WordArray,r=e.Hasher,l=t.algo,c=[],u=l.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(p,h){for(var f=this._hash.words,d=f[0],m=f[1],T=f[2],x=f[3],b=f[4],N=0;N<80;N++){if(N<16)c[N]=p[h+N]|0;else {var n=c[N-3]^c[N-8]^c[N-14]^c[N-16];c[N]=n<<1|n>>>31;}var s=(d<<5|d>>>27)+b+c[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=d,d=s;}f[0]=f[0]+d|0,f[1]=f[1]+m|0,f[2]=f[2]+T|0,f[3]=f[3]+x|0,f[4]=f[4]+b|0;},_doFinalize:function(){var p=this._data,h=p.words,f=this._nDataBytes*8,d=p.sigBytes*8;return h[d>>>5]|=128<<24-d%32,h[(d+64>>>9<<4)+14]=Math.floor(f/4294967296),h[(d+64>>>9<<4)+15]=f,p.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var p=r.clone.call(this);return p._hash=this._hash.clone(),p}});t.SHA1=r._createHelper(u),t.HmacSHA1=r._createHmacHelper(u);}(),i.SHA1});});var ae=ue(Q());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(l=>{t[l]===void 0&&(r==="empty_string"?t[l]="":r==="copy_key"&&(i._beforeToTranslate?t[l]=i._beforeToTranslate(l):t[l]=l));});}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 l=[];Array.isArray(r.choices)?l=[r.choices]:l=i.getConditionalsThenElse(r.choices),l.forEach(c=>c.forEach(u=>{if("type"in u){let p=[];u.type==="ifelse"||u.type==="stepswitch"?i.getConditionalsThenElse(u,p):p=[u],p.map(f=>i.getConditionalsThenElse(f.text)).forEach(f=>{Array.isArray(f)&&f.forEach(d=>{Array.isArray(d)?d.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 d=="string"&&i.addKey(e,d,a);});});}}));}if(r.dialogue){let l=[];Array.isArray(r.dialogue)?l=[r.dialogue]:l=i.getConditionalsThenElse(r.dialogue),l.forEach(c=>{typeof c=="string"?i.addKey(e,c,a):"text"in c&&Array.isArray(c.text)&&c.text.forEach(u=>{typeof u=="string"?i.addKey(e,u,a):i.getConditionalsThenElse(u).forEach(h=>{typeof h=="string"?i.addKey(e,h,a):Array.isArray(h)&&h.forEach(f=>{typeof f=="string"?i.addKey(e,f,a):i.getConditionalsThenElse(f).forEach(d=>{typeof d=="string"&&i.addKey(e,d,a);});});});});});}r.conditionalStep&&i.getConditionalsThenElse(r.conditionalStep).forEach(c=>{Array.isArray(c)?i.generateJsonTranslation(c,e,a):i.generateJsonTranslation([c],e,a);});}),e}};var D=J;function de(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function ge(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return he(i);case"ifelse":return o(i.condition)?o(i.then):o(i.else);case"stepswitch":let e=o(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let a=de(0,e.length-1);return o(e[a]);case"loop":let r=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return r>e.length-1&&(r=r%e.length),o(e[r]);case"sequential":let l,c=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(l=o(e[e.length-1])),c>e.length-1?l:o(e[c]);case"sequentialrandom":let u=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(u==null&&i.end=="lastItem"){let p=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!p||!p?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let h=p.usedRandomNumbers[`0-${e.length-1}`];return o(e[h[h.length-1]])}if(u==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return o(e[u])}}return i}function A(i){if(i.conditionalStep){let t=pixiVn.createExportableElement(o(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 A(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 he(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(l=>{let c=o(l);e.push(c);});else {let l=o(r);e.push(l);}});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,l,c=r.map((n,s)=>{n=A(n);let g=o(n.dialogue)||"";return s===0?(l=o(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),l===!1&&(g=`
2
2
 
3
- `+g),f=l(n.glueEnabled)||!1,g)}),c=l(d[0]),u=typeof c=="object"&&"character"in c?c.character:void 0,h=d.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(y=>{let V=l(y);return I.t(`${V}`)}).join(""):g=l(s)||"",I.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:u?{character:u,text:h}:h,end:o?.end,choices:p?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function he(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 me(i)}return !!i}function ye(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 me(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 te(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=de(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return ye(t);case"arithmetic":case"arithmeticsingle":return Te(t);case"compare":case"valueCondition":case"union":return he(t)}return t}function Te(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 K(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 c=new pixiVn.ImageSprite(e.props,e.url||e.alias);await M(c,e);break;case"edit":let u=pixiVn.canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"video":switch(e.operationType){case"show":let c=new pixiVn.VideoSprite(e.props,e.url||e.alias);await M(c,e);break;case"edit":let u=pixiVn.canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":B(e);break;case"pause":let h=pixiVn.canvas.find(e.alias);h?h.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"imagecontainer":switch(e.operationType){case"show":let c=new pixiVn.ImageContainer(e.props,e.urls);await M(c,e);break;case"edit":let u=pixiVn.canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] ImageContainer with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"canvaselement":switch(e.operationType){case"edit":try{let c=pixiVn.canvas.find(e.alias);c?e.props&&(c.memory={...c.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Canvas Element with alias ${e.alias} not found.`);}catch(c){console.error(`[Pixi\u2019VN Json] There was an error while trying to edit the canvas element with alias ${e.alias}.`,c);}break;case"remove":B(e);break}break;case"value":te(e);break;case"operationtoconvert":if(t){let c="";e.values.forEach(h=>{if(typeof h=="string")c+=h;else {let o=l(h);c+=`${o}`;}});let u=await t(c);u&&await K(u,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 f=new pixiVn.RotateTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,f);break;case"zoom":let d=new pixiVn.ZoomTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,d);break;case"shake":await pixiVn.shakeEffect(e.alias,e.props,e.priority);break}}async function M(i,t){if(t.transition)switch(t.transition.type){case"fade":await pixiVn.showWithFadeTransition(t.alias,i,t.transition.props,t.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(t.alias,i,t.transition.props,t.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(t.alias,i,t.transition.props,t.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(t.alias,i,t.transition.props,t.transition.priority);break;case"pushin":case"pushout":await pixiVn.pushIn(t.alias,i,t.transition.props,t.transition.priority);break}else pixiVn.canvas.add(t.alias,i),await i.load();}function B(i){if(i.transition)switch(i.transition.type){case"fade":pixiVn.removeWithFadeTransition(i.alias,i.transition.props,i.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(i.alias,i.transition.props,i.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(i.alias,i.transition.props,i.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(i.alias,i.transition.props,i.transition.priority);break;case"pushin":case"pushout":pixiVn.pushOut(i.alias,i.transition.props,i.transition.priority);break}else pixiVn.canvas.remove(i.alias);}var $=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, ne.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 f=l(r);f?(f&&!Array.isArray(f)&&typeof f=="object"&&(f=l(f)||""),Array.isArray(f)?a=a.concat(f):a.push(`${f}`)):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 K(o,this.operationStringConvert?p=>this.operationStringConvert(p,a,e):void 0);let r=this.getChoices(a.choices),f=l(a.glueEnabled),d=this.getDialogue(a.dialogue),c=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(o=>{let p=l(o);p&&c.push(p);}));let u=l(a.goNextStep),h=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;d!==void 0&&(pixiVn.narration.dialogue=d,this.skipEmptyDialogs&&typeof d=="string"&&(d===""||RegExp(/^\s+$/).test(d))&&(u=!0)),f?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):f===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let o of c){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));}h==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e)):h==="label_end"&&pixiVn.narration.closeCurrentLabel(),u&&await pixiVn.narration.goNext(e);}}};exports.LabelJson=$;
3
+ `+g),l=o(n.glueEnabled)||!1,g)}),u=o(c[0]),p=typeof u=="object"&&"character"in u?u.character:void 0,h=c.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(y=>{let V=o(y);return D.t(`${V}`)}).join(""):g=o(s)||"",D.t(g)}).join(""),f=r.find(n=>n.end),d=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:p?{character:p,text:h}:h,end:f?.end,choices:d?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function ye(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=o(i.leftValue),e=o(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 !!o(i.value);case"union":return Te(i)}return !!i}function me(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 o(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 Te(i){if(i.unionType==="not")return !o(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=o(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function te(i){let t=o(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=o(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 o(i){let t=ge(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return me(t);case"arithmetic":case"arithmeticsingle":return xe(t);case"compare":case"valueCondition":case"union":return ye(t)}return t}function xe(i){let t=o(i.leftValue);switch(i.type){case"arithmetic":let e=o(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 ie(i){let t=o(i);if(t)switch(t.type){case"assets":switch(t.operationType){case"load":await pixiVn.Assets.load(t.assets);break}break}}async function K(i,t){let e=o(i);if(e)switch(e.type){case"sound":switch(e.operationType){case"play":pixiVn.sound.play(e.alias,e.props);break;case"stop":pixiVn.sound.stop(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 u=new pixiVn.ImageSprite(e.props,e.url||e.alias);await z(u,e);break;case"edit":let p=pixiVn.canvas.find(e.alias);p?e.props&&await p.setMemory({...p.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"video":switch(e.operationType){case"show":let u=new pixiVn.VideoSprite(e.props,e.url||e.alias);await z(u,e);break;case"edit":let p=pixiVn.canvas.find(e.alias);p?e.props&&await p.setMemory({...p.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":B(e);break;case"pause":let h=pixiVn.canvas.find(e.alias);h?h.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let f=pixiVn.canvas.find(e.alias);f?f.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"imagecontainer":switch(e.operationType){case"show":let u=new pixiVn.ImageContainer(e.props,e.urls);await z(u,e);break;case"edit":let p=pixiVn.canvas.find(e.alias);p?e.props&&await p.setMemory({...p.memory,...e.props}):console.error(`[Pixi\u2019VN Json] ImageContainer with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"canvaselement":switch(e.operationType){case"edit":try{let u=pixiVn.canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Canvas Element with alias ${e.alias} not found.`);}catch(u){console.error(`[Pixi\u2019VN Json] There was an error while trying to edit the canvas element with alias ${e.alias}.`,u);}break;case"remove":B(e);break}break;case"value":te(e);break;case"operationtoconvert":if(t){let u="";e.values.forEach(h=>{if(typeof h=="string")u+=h;else {let f=o(h);u+=`${f}`;}});let p=await t(u);p&&await K(p,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 l=new pixiVn.RotateTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,l);break;case"zoom":let c=new pixiVn.ZoomTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,c);break;case"shake":await pixiVn.shakeEffect(e.alias,e.props,e.priority);break}}async function z(i,t){if(t.transition)switch(t.transition.type){case"fade":await pixiVn.showWithFadeTransition(t.alias,i,t.transition.props,t.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(t.alias,i,t.transition.props,t.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(t.alias,i,t.transition.props,t.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(t.alias,i,t.transition.props,t.transition.priority);break;case"pushin":case"pushout":await pixiVn.pushIn(t.alias,i,t.transition.props,t.transition.priority);break}else pixiVn.canvas.add(t.alias,i),await i.load();}function B(i){if(i.transition)switch(i.transition.type){case"fade":pixiVn.removeWithFadeTransition(i.alias,i.transition.props,i.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(i.alias,i.transition.props,i.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(i.alias,i.transition.props,i.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(i.alias,i.transition.props,i.transition.priority);break;case"pushin":case"pushout":pixiVn.pushOut(i.alias,i.transition.props,i.transition.priority);break}else pixiVn.canvas.remove(i.alias);}var $=class extends pixiVn.LabelAbstract{constructor(t,e,a,r={}){a||(a={}),a.onLoadingLabel=async()=>{for(let l of e){let c;if(typeof l=="function"?c=l():c=l,c=A(c),c.operations){let u=c.operations.map(p=>ie(p));await Promise.all(u);}}},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, ae.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 l=o(r);l?(l&&!Array.isArray(l)&&typeof l=="object"&&(l=o(l)||""),Array.isArray(l)?a=a.concat(l):a.push(`${l}`)):a.push(`${r}`);}}),e=a;}else {let a=o(t)||"";a&&!Array.isArray(a)&&typeof a=="object"&&(a=o(a)||""),e=a;}return `${e}`}getDialogue(t){if(t==null)return;let e=o(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 o(t)?.map(r=>o(r)).filter(r=>r!==void 0)}stepConverter(t){return async e=>{let a;if(typeof t=="function"?a=t():a=t,a=A(a),a.operations)for(let f of a.operations)await K(f,this.operationStringConvert?d=>this.operationStringConvert(d,a,e):void 0);let r=this.getChoices(a.choices),l=o(a.glueEnabled),c=this.getDialogue(a.dialogue),u=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(f=>{let d=o(f);d&&u.push(d);}));let p=o(a.goNextStep),h=o(a.end);if(r){let f=r.map(d=>{let m="";if(Array.isArray(d.text)){let T=[];d.text.forEach(x=>{if(typeof x=="string")T.push(J.t(x));else if(x&&typeof x=="object"){let b=o(x);b&&!Array.isArray(b)&&typeof b=="object"&&(b=o(b)||""),b&&(Array.isArray(b)?T=T.concat(J.t(b)):T.push(J.t(b)));}}),m=T.join();}else typeof d.text=="string"&&(m=J.t(d.text));return new pixiVn.ChoiceMenuOption(m,d.label,d.props,{type:d.type,oneTime:d.oneTime,onlyHaveNoChoice:d.onlyHaveNoChoice,autoSelect:d.autoSelect})});pixiVn.narration.choiceMenuOptions=f;}else pixiVn.narration.choiceMenuOptions=void 0;c!==void 0&&(pixiVn.narration.dialogue=c,this.skipEmptyDialogs&&typeof c=="string"&&(c===""||RegExp(/^\s+$/).test(c))&&(p=!0)),l?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):l===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let f of u){let d=f.label;typeof d=="object"&&(d=o(d)||"");let m=f.params?.map(T=>o(T));e={...e,...f.props},f.type==="jump"?(pixiVn.narration.closeCurrentLabel(),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,m),await pixiVn.narration.callLabel(d,e)):(pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,m),await pixiVn.narration.callLabel(d,e));}h==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e)):h==="label_end"&&pixiVn.narration.closeCurrentLabel(),p&&await pixiVn.narration.goNext(e);}}};exports.LabelJson=$;
@@ -1,3 +1,3 @@
1
- import {LabelAbstract,ChoiceMenuOption,narration,setFlag,storage,createExportableElement,getFlag,shakeEffect,ZoomTicker,canvas,RotateTicker,MoveTicker,FadeAlphaTicker,ImageContainer,VideoSprite,ImageSprite,Assets,sound,pushIn,zoomIn,moveIn,showWithDissolveTransition,showWithFadeTransition,pushOut,zoomOut,moveOut,removeWithDissolveTransition,removeWithFadeTransition,NarrationManagerStatic}from'@drincs/pixi-vn';var ae=Object.create;var U=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var se=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var W=(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 X=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var fe=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of se(t))!le.call(i,r)&&r!==e&&U(i,r,{get:()=>t[r],enumerable:!(a=re(t,r))||a.enumerable});return i};var ce=(i,t,e)=>(e=i!=null?ae(oe(i)):{},fe(U(e,"default",{value:i,enumerable:!0}),i));var Y=X((L,q)=>{(function(i,t){typeof L=="object"?q.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 W=="function")try{a=W("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.")},f=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),d={},c=d.lib={},u=c.Base=function(){return {extend:function(n){var s=f(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)}}}(),h=c.WordArray=u.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,y=this.sigBytes,V=n.sigBytes;if(this.clamp(),y%4)for(var P=0;P<V;P++){var H=g[P>>>2]>>>24-P%4*8&255;s[y+P>>>2]|=H<<24-(y+P)%4*8;}else for(var C=0;C<V;C+=4)s[y+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=u.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 h.init(s,n)}}),o=d.enc={},p=o.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push((P>>>4).toString(16)),y.push((P&15).toString(16));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y+=2)g[y>>>3]|=parseInt(n.substr(y,2),16)<<24-y%8*4;return new h.init(g,s/2)}},m=o.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push(String.fromCharCode(P));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y++)g[y>>>2]|=(n.charCodeAt(y)&255)<<24-y%4*8;return new h.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=c.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new h.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,y=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,j=t.min(_*4,V);if(_){for(var F=0;F<_;F+=P)this._doProcessBlock(y,F);s=y.splice(0,_),g.sigBytes-=j;}return new h.init(s,j)},clone:function(){var n=u.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});c.Hasher=x.extend({cfg:u.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=d.algo={};return d}(Math);return i});});var Q=X((O,Z)=>{(function(i,t){typeof O=="object"?Z.exports=O=t(Y()):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,f=t.algo,d=[],c=f.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(u,h){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)d[N]=u[h+N]|0;else {var n=d[N-3]^d[N-8]^d[N-14]^d[N-16];d[N]=n<<1|n>>>31;}var s=(p<<5|p>>>27)+b+d[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 u=this._data,h=u.words,o=this._nDataBytes*8,p=u.sigBytes*8;return h[p>>>5]|=128<<24-p%32,h[(p+64>>>9<<4)+14]=Math.floor(o/4294967296),h[(p+64>>>9<<4)+15]=o,u.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var u=r.clone.call(this);return u._hash=this._hash.clone(),u}});t.SHA1=r._createHelper(c),t.HmacSHA1=r._createHmacHelper(c);}(),i.SHA1});});var ne=ce(Q());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(f=>{t[f]===void 0&&(r==="empty_string"?t[f]="":r==="copy_key"&&(i._beforeToTranslate?t[f]=i._beforeToTranslate(f):t[f]=f));});}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 f=[];Array.isArray(r.choices)?f=[r.choices]:f=i.getConditionalsThenElse(r.choices),f.forEach(d=>d.forEach(c=>{if("type"in c){let u=[];c.type==="ifelse"||c.type==="stepswitch"?i.getConditionalsThenElse(c,u):u=[c],u.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 f=[];Array.isArray(r.dialogue)?f=[r.dialogue]:f=i.getConditionalsThenElse(r.dialogue),f.forEach(d=>{typeof d=="string"?i.addKey(e,d,a):"text"in d&&Array.isArray(d.text)&&d.text.forEach(c=>{typeof c=="string"?i.addKey(e,c,a):i.getConditionalsThenElse(c).forEach(h=>{typeof h=="string"?i.addKey(e,h,a):Array.isArray(h)&&h.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(d=>{Array.isArray(d)?i.generateJsonTranslation(d,e,a):i.generateJsonTranslation([d],e,a);});}),e}};var I=J;function pe(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function de(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return ge(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=pe(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 f,d=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(f=l(e[e.length-1])),d>e.length-1?f:l(e[d]);case"sequentialrandom":let c=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(c==null&&i.end=="lastItem"){let u=NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!u||!u?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let h=u.usedRandomNumbers[`0-${e.length-1}`];return l(e[h[h.length-1]])}if(c==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return l(e[c])}}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 ge(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(f=>{let d=l(f);e.push(d);});else {let f=l(r);e.push(f);}});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 I.t(a).join("");if(typeof a[0]=="object"){let r=a,f,d=r.map((n,s)=>{n=R(n);let g=l(n.dialogue)||"";return s===0?(f=l(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),f===!1&&(g=`
1
+ import {LabelAbstract,ChoiceMenuOption,narration,setFlag,storage,createExportableElement,getFlag,Assets,shakeEffect,ZoomTicker,canvas,RotateTicker,MoveTicker,FadeAlphaTicker,ImageContainer,VideoSprite,ImageSprite,sound,pushIn,zoomIn,moveIn,showWithDissolveTransition,showWithFadeTransition,pushOut,zoomOut,moveOut,removeWithDissolveTransition,removeWithFadeTransition,NarrationManagerStatic}from'@drincs/pixi-vn';var re=Object.create;var U=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var le=Object.getPrototypeOf,fe=Object.prototype.hasOwnProperty;var M=(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 X=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ce=(i,t,e,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of oe(t))!fe.call(i,r)&&r!==e&&U(i,r,{get:()=>t[r],enumerable:!(a=se(t,r))||a.enumerable});return i};var ue=(i,t,e)=>(e=i!=null?re(le(i)):{},ce(U(e,"default",{value:i,enumerable:!0}),i));var Y=X((L,q)=>{(function(i,t){typeof L=="object"?q.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 M=="function")try{a=M("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.")},l=Object.create||function(){function n(){}return function(s){var g;return n.prototype=s,g=new n,n.prototype=null,g}}(),c={},u=c.lib={},p=u.Base=function(){return {extend:function(n){var s=l(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)}}}(),h=u.WordArray=p.extend({init:function(n,s){n=this.words=n||[],s!=e?this.sigBytes=s:this.sigBytes=n.length*4;},toString:function(n){return (n||d).stringify(this)},concat:function(n){var s=this.words,g=n.words,y=this.sigBytes,V=n.sigBytes;if(this.clamp(),y%4)for(var P=0;P<V;P++){var H=g[P>>>2]>>>24-P%4*8&255;s[y+P>>>2]|=H<<24-(y+P)%4*8;}else for(var w=0;w<V;w+=4)s[y+w>>>2]=g[w>>>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=p.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 h.init(s,n)}}),f=c.enc={},d=f.Hex={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push((P>>>4).toString(16)),y.push((P&15).toString(16));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y+=2)g[y>>>3]|=parseInt(n.substr(y,2),16)<<24-y%8*4;return new h.init(g,s/2)}},m=f.Latin1={stringify:function(n){for(var s=n.words,g=n.sigBytes,y=[],V=0;V<g;V++){var P=s[V>>>2]>>>24-V%4*8&255;y.push(String.fromCharCode(P));}return y.join("")},parse:function(n){for(var s=n.length,g=[],y=0;y<s;y++)g[y>>>2]|=(n.charCodeAt(y)&255)<<24-y%4*8;return new h.init(g,s)}},T=f.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=u.BufferedBlockAlgorithm=p.extend({reset:function(){this._data=new h.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,y=g.words,V=g.sigBytes,P=this.blockSize,H=P*4,w=V/H;n?w=t.ceil(w):w=t.max((w|0)-this._minBufferSize,0);var _=w*P,j=t.min(_*4,V);if(_){for(var F=0;F<_;F+=P)this._doProcessBlock(y,F);s=y.splice(0,_),g.sigBytes-=j;}return new h.init(s,j)},clone:function(){var n=p.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});u.Hasher=x.extend({cfg:p.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=c.algo={};return c}(Math);return i});});var Q=X((I,Z)=>{(function(i,t){typeof I=="object"?Z.exports=I=t(Y()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(I,function(i){return function(){var t=i,e=t.lib,a=e.WordArray,r=e.Hasher,l=t.algo,c=[],u=l.SHA1=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(p,h){for(var f=this._hash.words,d=f[0],m=f[1],T=f[2],x=f[3],b=f[4],N=0;N<80;N++){if(N<16)c[N]=p[h+N]|0;else {var n=c[N-3]^c[N-8]^c[N-14]^c[N-16];c[N]=n<<1|n>>>31;}var s=(d<<5|d>>>27)+b+c[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=d,d=s;}f[0]=f[0]+d|0,f[1]=f[1]+m|0,f[2]=f[2]+T|0,f[3]=f[3]+x|0,f[4]=f[4]+b|0;},_doFinalize:function(){var p=this._data,h=p.words,f=this._nDataBytes*8,d=p.sigBytes*8;return h[d>>>5]|=128<<24-d%32,h[(d+64>>>9<<4)+14]=Math.floor(f/4294967296),h[(d+64>>>9<<4)+15]=f,p.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var p=r.clone.call(this);return p._hash=this._hash.clone(),p}});t.SHA1=r._createHelper(u),t.HmacSHA1=r._createHmacHelper(u);}(),i.SHA1});});var ae=ue(Q());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(l=>{t[l]===void 0&&(r==="empty_string"?t[l]="":r==="copy_key"&&(i._beforeToTranslate?t[l]=i._beforeToTranslate(l):t[l]=l));});}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 l=[];Array.isArray(r.choices)?l=[r.choices]:l=i.getConditionalsThenElse(r.choices),l.forEach(c=>c.forEach(u=>{if("type"in u){let p=[];u.type==="ifelse"||u.type==="stepswitch"?i.getConditionalsThenElse(u,p):p=[u],p.map(f=>i.getConditionalsThenElse(f.text)).forEach(f=>{Array.isArray(f)&&f.forEach(d=>{Array.isArray(d)?d.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 d=="string"&&i.addKey(e,d,a);});});}}));}if(r.dialogue){let l=[];Array.isArray(r.dialogue)?l=[r.dialogue]:l=i.getConditionalsThenElse(r.dialogue),l.forEach(c=>{typeof c=="string"?i.addKey(e,c,a):"text"in c&&Array.isArray(c.text)&&c.text.forEach(u=>{typeof u=="string"?i.addKey(e,u,a):i.getConditionalsThenElse(u).forEach(h=>{typeof h=="string"?i.addKey(e,h,a):Array.isArray(h)&&h.forEach(f=>{typeof f=="string"?i.addKey(e,f,a):i.getConditionalsThenElse(f).forEach(d=>{typeof d=="string"&&i.addKey(e,d,a);});});});});});}r.conditionalStep&&i.getConditionalsThenElse(r.conditionalStep).forEach(c=>{Array.isArray(c)?i.generateJsonTranslation(c,e,a):i.generateJsonTranslation([c],e,a);});}),e}};var D=J;function de(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function ge(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return he(i);case"ifelse":return o(i.condition)?o(i.then):o(i.else);case"stepswitch":let e=o(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let a=de(0,e.length-1);return o(e[a]);case"loop":let r=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return r>e.length-1&&(r=r%e.length),o(e[r]);case"sequential":let l,c=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(l=o(e[e.length-1])),c>e.length-1?l:o(e[c]);case"sequentialrandom":let u=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(u==null&&i.end=="lastItem"){let p=NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!p||!p?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let h=p.usedRandomNumbers[`0-${e.length-1}`];return o(e[h[h.length-1]])}if(u==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return o(e[u])}}return i}function A(i){if(i.conditionalStep){let t=createExportableElement(o(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 A(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 he(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(r=>{if(Array.isArray(r))r.forEach(l=>{let c=o(l);e.push(c);});else {let l=o(r);e.push(l);}});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,l,c=r.map((n,s)=>{n=A(n);let g=o(n.dialogue)||"";return s===0?(l=o(n.glueEnabled)||!1,g):(typeof g=="object"&&"text"in g&&(g=g.character+": "+g.text),l===!1&&(g=`
2
2
 
3
- `+g),f=l(n.glueEnabled)||!1,g)}),c=l(d[0]),u=typeof c=="object"&&"character"in c?c.character:void 0,h=d.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(y=>{let V=l(y);return I.t(`${V}`)}).join(""):g=l(s)||"",I.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:u?{character:u,text:h}:h,end:o?.end,choices:p?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function he(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 me(i)}return !!i}function ye(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 me(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 te(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=de(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return ye(t);case"arithmetic":case"arithmeticsingle":return Te(t);case"compare":case"valueCondition":case"union":return he(t)}return t}function Te(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 K(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 c=new ImageSprite(e.props,e.url||e.alias);await M(c,e);break;case"edit":let u=canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"video":switch(e.operationType){case"show":let c=new VideoSprite(e.props,e.url||e.alias);await M(c,e);break;case"edit":let u=canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":B(e);break;case"pause":let h=canvas.find(e.alias);h?h.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"imagecontainer":switch(e.operationType){case"show":let c=new ImageContainer(e.props,e.urls);await M(c,e);break;case"edit":let u=canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] ImageContainer with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"canvaselement":switch(e.operationType){case"edit":try{let c=canvas.find(e.alias);c?e.props&&(c.memory={...c.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Canvas Element with alias ${e.alias} not found.`);}catch(c){console.error(`[Pixi\u2019VN Json] There was an error while trying to edit the canvas element with alias ${e.alias}.`,c);}break;case"remove":B(e);break}break;case"value":te(e);break;case"operationtoconvert":if(t){let c="";e.values.forEach(h=>{if(typeof h=="string")c+=h;else {let o=l(h);c+=`${o}`;}});let u=await t(c);u&&await K(u,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 f=new RotateTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,f);break;case"zoom":let d=new ZoomTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,d);break;case"shake":await shakeEffect(e.alias,e.props,e.priority);break}}async function M(i,t){if(t.transition)switch(t.transition.type){case"fade":await showWithFadeTransition(t.alias,i,t.transition.props,t.transition.priority);break;case"dissolve":await showWithDissolveTransition(t.alias,i,t.transition.props,t.transition.priority);break;case"movein":case"moveout":await moveIn(t.alias,i,t.transition.props,t.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(t.alias,i,t.transition.props,t.transition.priority);break;case"pushin":case"pushout":await pushIn(t.alias,i,t.transition.props,t.transition.priority);break}else canvas.add(t.alias,i),await i.load();}function B(i){if(i.transition)switch(i.transition.type){case"fade":removeWithFadeTransition(i.alias,i.transition.props,i.transition.priority);break;case"dissolve":removeWithDissolveTransition(i.alias,i.transition.props,i.transition.priority);break;case"movein":case"moveout":moveOut(i.alias,i.transition.props,i.transition.priority);break;case"zoomin":case"zoomout":zoomOut(i.alias,i.transition.props,i.transition.priority);break;case"pushin":case"pushout":pushOut(i.alias,i.transition.props,i.transition.priority);break}else canvas.remove(i.alias);}var $=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, ne.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 f=l(r);f?(f&&!Array.isArray(f)&&typeof f=="object"&&(f=l(f)||""),Array.isArray(f)?a=a.concat(f):a.push(`${f}`)):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 K(o,this.operationStringConvert?p=>this.operationStringConvert(p,a,e):void 0);let r=this.getChoices(a.choices),f=l(a.glueEnabled),d=this.getDialogue(a.dialogue),c=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(o=>{let p=l(o);p&&c.push(p);}));let u=l(a.goNextStep),h=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;d!==void 0&&(narration.dialogue=d,this.skipEmptyDialogs&&typeof d=="string"&&(d===""||RegExp(/^\s+$/).test(d))&&(u=!0)),f?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):f===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let o of c){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));}h==="game_end"?(narration.closeAllLabels(),await narration.goNext(e)):h==="label_end"&&narration.closeCurrentLabel(),u&&await narration.goNext(e);}}};export{$ as LabelJson};
3
+ `+g),l=o(n.glueEnabled)||!1,g)}),u=o(c[0]),p=typeof u=="object"&&"character"in u?u.character:void 0,h=c.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(y=>{let V=o(y);return D.t(`${V}`)}).join(""):g=o(s)||"",D.t(g)}).join(""),f=r.find(n=>n.end),d=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:p?{character:p,text:h}:h,end:f?.end,choices:d?.choices,glueEnabled:m,goNextStep:T,labelToOpen:x?.labelToOpen,operations:b}}}function ye(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=o(i.leftValue),e=o(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 !!o(i.value);case"union":return Te(i)}return !!i}function me(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 o(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 Te(i){if(i.unionType==="not")return !o(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=o(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function te(i){let t=o(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=o(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 o(i){let t=ge(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return me(t);case"arithmetic":case"arithmeticsingle":return xe(t);case"compare":case"valueCondition":case"union":return ye(t)}return t}function xe(i){let t=o(i.leftValue);switch(i.type){case"arithmetic":let e=o(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 ie(i){let t=o(i);if(t)switch(t.type){case"assets":switch(t.operationType){case"load":await Assets.load(t.assets);break}break}}async function K(i,t){let e=o(i);if(e)switch(e.type){case"sound":switch(e.operationType){case"play":sound.play(e.alias,e.props);break;case"stop":sound.stop(e.alias);break;case"pause":sound.pause(e.alias);break;case"resume":sound.resume(e.alias);break;case"volume":sound.volume(e.alias,e.value);break}break;case"assets":switch(e.operationType){case"load":await Assets.load(e.assets);break}break;case"image":switch(e.operationType){case"show":let u=new ImageSprite(e.props,e.url||e.alias);await z(u,e);break;case"edit":let p=canvas.find(e.alias);p?e.props&&await p.setMemory({...p.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"video":switch(e.operationType){case"show":let u=new VideoSprite(e.props,e.url||e.alias);await z(u,e);break;case"edit":let p=canvas.find(e.alias);p?e.props&&await p.setMemory({...p.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":B(e);break;case"pause":let h=canvas.find(e.alias);h?h.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let f=canvas.find(e.alias);f?f.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"imagecontainer":switch(e.operationType){case"show":let u=new ImageContainer(e.props,e.urls);await z(u,e);break;case"edit":let p=canvas.find(e.alias);p?e.props&&await p.setMemory({...p.memory,...e.props}):console.error(`[Pixi\u2019VN Json] ImageContainer with alias ${e.alias} not found.`);break;case"remove":B(e);break}break;case"canvaselement":switch(e.operationType){case"edit":try{let u=canvas.find(e.alias);u?e.props&&(u.memory={...u.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Canvas Element with alias ${e.alias} not found.`);}catch(u){console.error(`[Pixi\u2019VN Json] There was an error while trying to edit the canvas element with alias ${e.alias}.`,u);}break;case"remove":B(e);break}break;case"value":te(e);break;case"operationtoconvert":if(t){let u="";e.values.forEach(h=>{if(typeof h=="string")u+=h;else {let f=o(h);u+=`${f}`;}});let p=await t(u);p&&await K(p,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 l=new RotateTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,l);break;case"zoom":let c=new ZoomTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,c);break;case"shake":await shakeEffect(e.alias,e.props,e.priority);break}}async function z(i,t){if(t.transition)switch(t.transition.type){case"fade":await showWithFadeTransition(t.alias,i,t.transition.props,t.transition.priority);break;case"dissolve":await showWithDissolveTransition(t.alias,i,t.transition.props,t.transition.priority);break;case"movein":case"moveout":await moveIn(t.alias,i,t.transition.props,t.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(t.alias,i,t.transition.props,t.transition.priority);break;case"pushin":case"pushout":await pushIn(t.alias,i,t.transition.props,t.transition.priority);break}else canvas.add(t.alias,i),await i.load();}function B(i){if(i.transition)switch(i.transition.type){case"fade":removeWithFadeTransition(i.alias,i.transition.props,i.transition.priority);break;case"dissolve":removeWithDissolveTransition(i.alias,i.transition.props,i.transition.priority);break;case"movein":case"moveout":moveOut(i.alias,i.transition.props,i.transition.priority);break;case"zoomin":case"zoomout":zoomOut(i.alias,i.transition.props,i.transition.priority);break;case"pushin":case"pushout":pushOut(i.alias,i.transition.props,i.transition.priority);break}else canvas.remove(i.alias);}var $=class extends LabelAbstract{constructor(t,e,a,r={}){a||(a={}),a.onLoadingLabel=async()=>{for(let l of e){let c;if(typeof l=="function"?c=l():c=l,c=A(c),c.operations){let u=c.operations.map(p=>ie(p));await Promise.all(u);}}},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, ae.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 l=o(r);l?(l&&!Array.isArray(l)&&typeof l=="object"&&(l=o(l)||""),Array.isArray(l)?a=a.concat(l):a.push(`${l}`)):a.push(`${r}`);}}),e=a;}else {let a=o(t)||"";a&&!Array.isArray(a)&&typeof a=="object"&&(a=o(a)||""),e=a;}return `${e}`}getDialogue(t){if(t==null)return;let e=o(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 o(t)?.map(r=>o(r)).filter(r=>r!==void 0)}stepConverter(t){return async e=>{let a;if(typeof t=="function"?a=t():a=t,a=A(a),a.operations)for(let f of a.operations)await K(f,this.operationStringConvert?d=>this.operationStringConvert(d,a,e):void 0);let r=this.getChoices(a.choices),l=o(a.glueEnabled),c=this.getDialogue(a.dialogue),u=[];a.labelToOpen&&(Array.isArray(a.labelToOpen)||(a.labelToOpen=[a.labelToOpen]),a.labelToOpen.forEach(f=>{let d=o(f);d&&u.push(d);}));let p=o(a.goNextStep),h=o(a.end);if(r){let f=r.map(d=>{let m="";if(Array.isArray(d.text)){let T=[];d.text.forEach(x=>{if(typeof x=="string")T.push(J.t(x));else if(x&&typeof x=="object"){let b=o(x);b&&!Array.isArray(b)&&typeof b=="object"&&(b=o(b)||""),b&&(Array.isArray(b)?T=T.concat(J.t(b)):T.push(J.t(b)));}}),m=T.join();}else typeof d.text=="string"&&(m=J.t(d.text));return new ChoiceMenuOption(m,d.label,d.props,{type:d.type,oneTime:d.oneTime,onlyHaveNoChoice:d.onlyHaveNoChoice,autoSelect:d.autoSelect})});narration.choiceMenuOptions=f;}else narration.choiceMenuOptions=void 0;c!==void 0&&(narration.dialogue=c,this.skipEmptyDialogs&&typeof c=="string"&&(c===""||RegExp(/^\s+$/).test(c))&&(p=!0)),l?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):l===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let f of u){let d=f.label;typeof d=="object"&&(d=o(d)||"");let m=f.params?.map(T=>o(T));e={...e,...f.props},f.type==="jump"?(narration.closeCurrentLabel(),storage.setTempVariable(`${E}${narration.openedLabels.length}`,m),await narration.callLabel(d,e)):(storage.setTempVariable(`${E}${narration.openedLabels.length}`,m),await narration.callLabel(d,e));}h==="game_end"?(narration.closeAllLabels(),await narration.goNext(e)):h==="label_end"&&narration.closeCurrentLabel(),p&&await narration.goNext(e);}}};export{$ as LabelJson};
@@ -0,0 +1,3 @@
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn');var E="___param___";var m=class e{static _beforeToTranslate=void 0;static _translate=n=>n;static _afterToTranslate=void 0;static t(n){return Array.isArray(n)?n.map(t=>e.translate(`${t}`)):e.translate(`${n}`)}static set beforeToTranslate(n){e._beforeToTranslate=n;}static set translate(n){e._translate=n;}static get translate(){return n=>{let t=n;return e._beforeToTranslate&&(t=e._beforeToTranslate(t)),t=e._translate(t),e._afterToTranslate&&(t=e._afterToTranslate(t)),t}}static set afterToTranslate(n){e._afterToTranslate=n;}static addKey(n,t,s){let i=s.defaultValue||"empty_string";typeof t=="string"&&(t=[t]),Array.isArray(t)&&t.forEach(r=>{n[r]===void 0&&(i==="empty_string"?n[r]="":i==="copy_key"&&(e._beforeToTranslate?n[r]=e._beforeToTranslate(r):n[r]=r));});}static getConditionalsThenElse(n,t=[]){if(typeof n=="object"&&n&&"type"in n)if(n.type==="ifelse")n.then&&e.getConditionalsThenElse(n.then,t),n.else&&e.getConditionalsThenElse(n.else,t);else if(n.type==="stepswitch"){if(n.elements)if(Array.isArray(n.elements))n.elements.forEach(s=>{e.getConditionalsThenElse(s,t);});else if(n.elements.type==="ifelse"){let s=[];e.getConditionalsThenElse(n.elements,s),s.forEach(i=>{t.push(...i);});}else if(n.elements.type==="stepswitch"){let s=[];e.getConditionalsThenElse(n.elements,s),s.forEach(i=>{t.push(...i);});}else e.getConditionalsThenElse(n.elements,t);}else n.type==="resulttocombine"?(n.firstItem&&e.getConditionalsThenElse(n.firstItem,t),n.secondConditionalItem&&n.secondConditionalItem.forEach(s=>{e.getConditionalsThenElse(s,t);})):t.push(n);else n&&t.push(n);return t}static generateJsonTranslation(n,t={},s={}){return n.forEach(i=>{if(i.choices){let r=[];Array.isArray(i.choices)?r=[i.choices]:r=e.getConditionalsThenElse(i.choices),r.forEach(l=>l.forEach(f=>{if("type"in f){let c=[];f.type==="ifelse"||f.type==="stepswitch"?e.getConditionalsThenElse(f,c):c=[f],c.map(g=>e.getConditionalsThenElse(g.text)).forEach(g=>{Array.isArray(g)&&g.forEach(T=>{Array.isArray(T)?T.forEach(h=>{typeof h=="string"?e.addKey(t,h,s):e.getConditionalsThenElse(h).forEach(y=>{Array.isArray(y)?y.forEach(V=>{typeof V=="string"&&e.addKey(t,V,s);}):typeof y=="string"&&e.addKey(t,y,s);});}):typeof T=="string"&&e.addKey(t,T,s);});});}}));}if(i.dialogue){let r=[];Array.isArray(i.dialogue)?r=[i.dialogue]:r=e.getConditionalsThenElse(i.dialogue),r.forEach(l=>{typeof l=="string"?e.addKey(t,l,s):"text"in l&&Array.isArray(l.text)&&l.text.forEach(f=>{typeof f=="string"?e.addKey(t,f,s):e.getConditionalsThenElse(f).forEach(d=>{typeof d=="string"?e.addKey(t,d,s):Array.isArray(d)&&d.forEach(g=>{typeof g=="string"?e.addKey(t,g,s):e.getConditionalsThenElse(g).forEach(T=>{typeof T=="string"&&e.addKey(t,T,s);});});});});});}i.conditionalStep&&e.getConditionalsThenElse(i.conditionalStep).forEach(l=>{Array.isArray(l)?e.generateJsonTranslation(l,t,s):e.generateJsonTranslation([l],t,s);});}),t}};var N=m;function D(e,n){return Math.floor(Math.random()*(n-e+1)+e)}function L(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case"resulttocombine":return k(e);case"ifelse":return a(e.condition)?a(e.then):a(e.else);case"stepswitch":let t=a(e.elements)||[];if(t.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case"random":let s=D(0,t.length-1);return a(t[s]);case"loop":let i=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return i>t.length-1&&(i=i%t.length),a(t[i]);case"sequential":let r,l=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(r=a(t[t.length-1])),l>t.length-1?r:a(t[l]);case"sequentialrandom":let f=pixiVn.NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:e.nestedId,onceOnly:!0});if(f==null&&e.end=="lastItem"){let c=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!c||!c?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let d=c.usedRandomNumbers[`0-${t.length-1}`];return a(t[d[d.length-1]])}if(f==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return a(t[f])}}return e}function A(e){if(e.conditionalStep){let n=pixiVn.createExportableElement(a(e.conditionalStep));if(n?.glueEnabled===void 0&&delete n?.glueEnabled,n?.goNextStep===void 0&&delete n?.goNextStep,n?.end===void 0&&delete n?.end,n?.choices===void 0&&delete n?.choices,n?.dialogue===void 0&&delete n?.dialogue,n?.labelToOpen===void 0&&delete n?.labelToOpen,n?.operations===void 0&&delete n?.operations,n){let t={...e,conditionalStep:void 0,...n};return A(t)}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 e}function k(e){let n=e.firstItem,t=[];e.secondConditionalItem?.forEach(i=>{if(Array.isArray(i))i.forEach(r=>{let l=a(r);t.push(l);});else {let r=a(i);t.push(r);}});let s=n?[n,...t]:t;if(s.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof s[0]=="string")return N.t(s).join("");if(typeof s[0]=="object"){let i=s,r,l=i.map((o,p)=>{o=A(o);let u=a(o.dialogue)||"";return p===0?(r=a(o.glueEnabled)||!1,u):(typeof u=="object"&&"text"in u&&(u=u.character+": "+u.text),r===!1&&(u=`
2
+
3
+ `+u),r=a(o.glueEnabled)||!1,u)}),f=a(l[0]),c=typeof f=="object"&&"character"in f?f.character:void 0,d=l.map(o=>{let p;o&&typeof o=="object"&&"text"in o?p=o.text:p=o;let u;return Array.isArray(p)?u=p.map(O=>{let I=a(O);return N.t(`${I}`)}).join(""):u=a(p)||"",N.t(u)}).join(""),g=i.find(o=>o.end),T=i.find(o=>o.choices),h=!1,y=!1;i.length>0&&(i[0].glueEnabled&&i[0].goNextStep&&i[0].dialogue===void 0&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),h=i[i.length-1].glueEnabled,y=i.reverse().find(o=>!(o.operations&&(!o.dialogue||!o.choices)))?.goNextStep);let V=i.find(o=>o.labelToOpen),P=[];return i.forEach(o=>{o.operations&&P.forEach(p=>{P.push(p);});}),{dialogue:c?{character:c,text:d}:d,end:g?.end,choices:T?.choices,glueEnabled:h,goNextStep:y,labelToOpen:V?.labelToOpen,operations:P}}}function R(e){if(!e)return !1;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case"compare":let n=a(e.leftValue),t=a(e.rightValue);switch(e.operator){case"==":return n===t;case"!=":return n!==t;case"<":return n<t;case"<=":return n<=t;case">":return n>t;case">=":return n>=t;case"CONTAINS":return n.toString().includes(t.toString())}break;case"valueCondition":return !!a(e.value);case"union":return _(e)}return !!e}function G(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case"storage":case"tempstorage":return pixiVn.storage.getVariable(e.key);case"flagStorage":return pixiVn.getFlag(e.key);case"label":return pixiVn.narration.getTimesLabelOpened(e.label);case"choice":return pixiVn.narration.getTimesChoiceMade(e.index);case"logic":return a(e.operation);case"params":let n=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];if(n&&n.length>e.key)return n[e.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return e}function _(e){if(e.unionType==="not")return !a(e.condition);let n=e.unionType==="and";for(let t=0;t<e.conditions.length;t++)if(n=a(e.conditions[t])||!1,e.unionType==="and"){if(!n)return !1}else if(n)return !0;return n}function a(e){let n=L(e);if(n&&typeof n=="object"&&"type"in n)switch(n.type){case"value":return G(n);case"arithmetic":case"arithmeticsingle":return F(n);case"compare":case"valueCondition":case"union":return R(n)}return n}function F(e){let n=a(e.leftValue);switch(e.type){case"arithmetic":let t=a(e.rightValue);switch(e.operator){case"*":return n*t;case"/":return n/t;case"+":return n+t;case"-":return n-t;case"%":return n%t;case"POW":return Math.pow(n,t);case"RANDOM":return pixiVn.narration.getRandomNumber(n,t)}case"arithmeticsingle":switch(e.operator){case"INT":return parseInt(n);case"FLOOR":return Math.floor(n);case"FLOAT":return parseFloat(n)}break}}async function Z(e){let n=a(e);if(n)switch(n.type){case"assets":switch(n.operationType){case"load":await pixiVn.Assets.load(n.assets);break}break}}exports.loadAssets=Z;
@@ -0,0 +1,15 @@
1
+ import { e as PixiVNJsonIfElse } from '../PixiVNJsonConditionalStatements-CVkQSKpq.cjs';
2
+ import { PixiVNJsonOperation, PixiVNJsonOperationString } from '../interface/PixiVNJsonOperations.cjs';
3
+ import '@drincs/pixi-vn';
4
+ import '../interface/PixiVNJsonCanvas.cjs';
5
+ import 'pixi.js';
6
+ import '../interface/PixiVNJsonCanvasEffect.cjs';
7
+ import '../interface/PixiVNJsonCanvasTicker.cjs';
8
+ import '../interface/PixiVNJsonMediaTransiotions.cjs';
9
+ import '@drincs/pixi-vn/dist/interface/canvas/transition-props';
10
+ import '../interface/PixiVNJsonInput.cjs';
11
+ import '../interface/PixiVNJsonSound.cjs';
12
+
13
+ declare function loadAssets(origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString): Promise<void>;
14
+
15
+ export { loadAssets };
@@ -0,0 +1,15 @@
1
+ import { e as PixiVNJsonIfElse } from '../PixiVNJsonConditionalStatements-CVkQSKpq.js';
2
+ import { PixiVNJsonOperation, PixiVNJsonOperationString } from '../interface/PixiVNJsonOperations.js';
3
+ import '@drincs/pixi-vn';
4
+ import '../interface/PixiVNJsonCanvas.js';
5
+ import 'pixi.js';
6
+ import '../interface/PixiVNJsonCanvasEffect.js';
7
+ import '../interface/PixiVNJsonCanvasTicker.js';
8
+ import '../interface/PixiVNJsonMediaTransiotions.js';
9
+ import '@drincs/pixi-vn/dist/interface/canvas/transition-props';
10
+ import '../interface/PixiVNJsonInput.js';
11
+ import '../interface/PixiVNJsonSound.js';
12
+
13
+ declare function loadAssets(origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString): Promise<void>;
14
+
15
+ export { loadAssets };
@@ -0,0 +1,3 @@
1
+ import {Assets,narration,NarrationManagerStatic,setFlag,storage,getFlag,createExportableElement}from'@drincs/pixi-vn';var E="___param___";var m=class e{static _beforeToTranslate=void 0;static _translate=n=>n;static _afterToTranslate=void 0;static t(n){return Array.isArray(n)?n.map(t=>e.translate(`${t}`)):e.translate(`${n}`)}static set beforeToTranslate(n){e._beforeToTranslate=n;}static set translate(n){e._translate=n;}static get translate(){return n=>{let t=n;return e._beforeToTranslate&&(t=e._beforeToTranslate(t)),t=e._translate(t),e._afterToTranslate&&(t=e._afterToTranslate(t)),t}}static set afterToTranslate(n){e._afterToTranslate=n;}static addKey(n,t,s){let i=s.defaultValue||"empty_string";typeof t=="string"&&(t=[t]),Array.isArray(t)&&t.forEach(r=>{n[r]===void 0&&(i==="empty_string"?n[r]="":i==="copy_key"&&(e._beforeToTranslate?n[r]=e._beforeToTranslate(r):n[r]=r));});}static getConditionalsThenElse(n,t=[]){if(typeof n=="object"&&n&&"type"in n)if(n.type==="ifelse")n.then&&e.getConditionalsThenElse(n.then,t),n.else&&e.getConditionalsThenElse(n.else,t);else if(n.type==="stepswitch"){if(n.elements)if(Array.isArray(n.elements))n.elements.forEach(s=>{e.getConditionalsThenElse(s,t);});else if(n.elements.type==="ifelse"){let s=[];e.getConditionalsThenElse(n.elements,s),s.forEach(i=>{t.push(...i);});}else if(n.elements.type==="stepswitch"){let s=[];e.getConditionalsThenElse(n.elements,s),s.forEach(i=>{t.push(...i);});}else e.getConditionalsThenElse(n.elements,t);}else n.type==="resulttocombine"?(n.firstItem&&e.getConditionalsThenElse(n.firstItem,t),n.secondConditionalItem&&n.secondConditionalItem.forEach(s=>{e.getConditionalsThenElse(s,t);})):t.push(n);else n&&t.push(n);return t}static generateJsonTranslation(n,t={},s={}){return n.forEach(i=>{if(i.choices){let r=[];Array.isArray(i.choices)?r=[i.choices]:r=e.getConditionalsThenElse(i.choices),r.forEach(l=>l.forEach(f=>{if("type"in f){let c=[];f.type==="ifelse"||f.type==="stepswitch"?e.getConditionalsThenElse(f,c):c=[f],c.map(g=>e.getConditionalsThenElse(g.text)).forEach(g=>{Array.isArray(g)&&g.forEach(T=>{Array.isArray(T)?T.forEach(h=>{typeof h=="string"?e.addKey(t,h,s):e.getConditionalsThenElse(h).forEach(y=>{Array.isArray(y)?y.forEach(V=>{typeof V=="string"&&e.addKey(t,V,s);}):typeof y=="string"&&e.addKey(t,y,s);});}):typeof T=="string"&&e.addKey(t,T,s);});});}}));}if(i.dialogue){let r=[];Array.isArray(i.dialogue)?r=[i.dialogue]:r=e.getConditionalsThenElse(i.dialogue),r.forEach(l=>{typeof l=="string"?e.addKey(t,l,s):"text"in l&&Array.isArray(l.text)&&l.text.forEach(f=>{typeof f=="string"?e.addKey(t,f,s):e.getConditionalsThenElse(f).forEach(d=>{typeof d=="string"?e.addKey(t,d,s):Array.isArray(d)&&d.forEach(g=>{typeof g=="string"?e.addKey(t,g,s):e.getConditionalsThenElse(g).forEach(T=>{typeof T=="string"&&e.addKey(t,T,s);});});});});});}i.conditionalStep&&e.getConditionalsThenElse(i.conditionalStep).forEach(l=>{Array.isArray(l)?e.generateJsonTranslation(l,t,s):e.generateJsonTranslation([l],t,s);});}),t}};var N=m;function D(e,n){return Math.floor(Math.random()*(n-e+1)+e)}function L(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case"resulttocombine":return k(e);case"ifelse":return a(e.condition)?a(e.then):a(e.else);case"stepswitch":let t=a(e.elements)||[];if(t.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case"random":let s=D(0,t.length-1);return a(t[s]);case"loop":let i=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return i>t.length-1&&(i=i%t.length),a(t[i]);case"sequential":let r,l=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(r=a(t[t.length-1])),l>t.length-1?r:a(t[l]);case"sequentialrandom":let f=NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:e.nestedId,onceOnly:!0});if(f==null&&e.end=="lastItem"){let c=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!c||!c?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let d=c.usedRandomNumbers[`0-${t.length-1}`];return a(t[d[d.length-1]])}if(f==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return a(t[f])}}return e}function A(e){if(e.conditionalStep){let n=createExportableElement(a(e.conditionalStep));if(n?.glueEnabled===void 0&&delete n?.glueEnabled,n?.goNextStep===void 0&&delete n?.goNextStep,n?.end===void 0&&delete n?.end,n?.choices===void 0&&delete n?.choices,n?.dialogue===void 0&&delete n?.dialogue,n?.labelToOpen===void 0&&delete n?.labelToOpen,n?.operations===void 0&&delete n?.operations,n){let t={...e,conditionalStep:void 0,...n};return A(t)}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 e}function k(e){let n=e.firstItem,t=[];e.secondConditionalItem?.forEach(i=>{if(Array.isArray(i))i.forEach(r=>{let l=a(r);t.push(l);});else {let r=a(i);t.push(r);}});let s=n?[n,...t]:t;if(s.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof s[0]=="string")return N.t(s).join("");if(typeof s[0]=="object"){let i=s,r,l=i.map((o,p)=>{o=A(o);let u=a(o.dialogue)||"";return p===0?(r=a(o.glueEnabled)||!1,u):(typeof u=="object"&&"text"in u&&(u=u.character+": "+u.text),r===!1&&(u=`
2
+
3
+ `+u),r=a(o.glueEnabled)||!1,u)}),f=a(l[0]),c=typeof f=="object"&&"character"in f?f.character:void 0,d=l.map(o=>{let p;o&&typeof o=="object"&&"text"in o?p=o.text:p=o;let u;return Array.isArray(p)?u=p.map(O=>{let I=a(O);return N.t(`${I}`)}).join(""):u=a(p)||"",N.t(u)}).join(""),g=i.find(o=>o.end),T=i.find(o=>o.choices),h=!1,y=!1;i.length>0&&(i[0].glueEnabled&&i[0].goNextStep&&i[0].dialogue===void 0&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),h=i[i.length-1].glueEnabled,y=i.reverse().find(o=>!(o.operations&&(!o.dialogue||!o.choices)))?.goNextStep);let V=i.find(o=>o.labelToOpen),P=[];return i.forEach(o=>{o.operations&&P.forEach(p=>{P.push(p);});}),{dialogue:c?{character:c,text:d}:d,end:g?.end,choices:T?.choices,glueEnabled:h,goNextStep:y,labelToOpen:V?.labelToOpen,operations:P}}}function R(e){if(!e)return !1;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case"compare":let n=a(e.leftValue),t=a(e.rightValue);switch(e.operator){case"==":return n===t;case"!=":return n!==t;case"<":return n<t;case"<=":return n<=t;case">":return n>t;case">=":return n>=t;case"CONTAINS":return n.toString().includes(t.toString())}break;case"valueCondition":return !!a(e.value);case"union":return _(e)}return !!e}function G(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case"storage":case"tempstorage":return storage.getVariable(e.key);case"flagStorage":return getFlag(e.key);case"label":return narration.getTimesLabelOpened(e.label);case"choice":return narration.getTimesChoiceMade(e.index);case"logic":return a(e.operation);case"params":let n=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];if(n&&n.length>e.key)return n[e.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return e}function _(e){if(e.unionType==="not")return !a(e.condition);let n=e.unionType==="and";for(let t=0;t<e.conditions.length;t++)if(n=a(e.conditions[t])||!1,e.unionType==="and"){if(!n)return !1}else if(n)return !0;return n}function a(e){let n=L(e);if(n&&typeof n=="object"&&"type"in n)switch(n.type){case"value":return G(n);case"arithmetic":case"arithmeticsingle":return F(n);case"compare":case"valueCondition":case"union":return R(n)}return n}function F(e){let n=a(e.leftValue);switch(e.type){case"arithmetic":let t=a(e.rightValue);switch(e.operator){case"*":return n*t;case"/":return n/t;case"+":return n+t;case"-":return n-t;case"%":return n%t;case"POW":return Math.pow(n,t);case"RANDOM":return narration.getRandomNumber(n,t)}case"arithmeticsingle":switch(e.operator){case"INT":return parseInt(n);case"FLOOR":return Math.floor(n);case"FLOAT":return parseFloat(n)}break}}async function Z(e){let n=a(e);if(n)switch(n.type){case"assets":switch(n.operationType){case"load":await Assets.load(n.assets);break}break}}export{Z as loadAssets};