@drincs/pixi-vn-json 1.0.13 → 1.1.1

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.
Files changed (51) hide show
  1. package/dist/classes/LabelJson.cjs +2 -2
  2. package/dist/classes/LabelJson.d.cts +3 -1
  3. package/dist/classes/LabelJson.d.ts +3 -1
  4. package/dist/classes/LabelJson.js +2 -2
  5. package/dist/classes/index.cjs +2 -2
  6. package/dist/classes/index.d.cts +3 -1
  7. package/dist/classes/index.d.ts +3 -1
  8. package/dist/classes/index.js +2 -2
  9. package/dist/functions/importer.cjs +2 -2
  10. package/dist/functions/importer.d.cts +3 -1
  11. package/dist/functions/importer.d.ts +3 -1
  12. package/dist/functions/importer.js +2 -2
  13. package/dist/functions/index.cjs +2 -2
  14. package/dist/functions/index.d.cts +3 -1
  15. package/dist/functions/index.d.ts +3 -1
  16. package/dist/functions/index.js +2 -2
  17. package/dist/functions/operation-utility.cjs +2 -2
  18. package/dist/functions/operation-utility.d.cts +3 -1
  19. package/dist/functions/operation-utility.d.ts +3 -1
  20. package/dist/functions/operation-utility.js +2 -2
  21. package/dist/functions/utility.d.cts +3 -1
  22. package/dist/functions/utility.d.ts +3 -1
  23. package/dist/index.cjs +2 -2
  24. package/dist/index.d.cts +2 -0
  25. package/dist/index.d.ts +2 -0
  26. package/dist/index.js +2 -2
  27. package/dist/interface/PixiVNJson.d.cts +2 -0
  28. package/dist/interface/PixiVNJson.d.ts +2 -0
  29. package/dist/interface/PixiVNJsonCanvas.d.cts +3 -1
  30. package/dist/interface/PixiVNJsonCanvas.d.ts +3 -1
  31. package/dist/interface/PixiVNJsonEffect.cjs +1 -0
  32. package/dist/interface/PixiVNJsonEffect.d.cts +12 -0
  33. package/dist/interface/PixiVNJsonEffect.d.ts +12 -0
  34. package/dist/interface/PixiVNJsonEffect.js +0 -0
  35. package/dist/interface/PixiVNJsonLabelStep.d.cts +3 -1
  36. package/dist/interface/PixiVNJsonLabelStep.d.ts +3 -1
  37. package/dist/interface/PixiVNJsonLabels.d.cts +3 -1
  38. package/dist/interface/PixiVNJsonLabels.d.ts +3 -1
  39. package/dist/interface/PixiVNJsonOperations.d.cts +3 -1
  40. package/dist/interface/PixiVNJsonOperations.d.ts +3 -1
  41. package/dist/interface/PixiVNJsonTicker.cjs +1 -0
  42. package/dist/interface/PixiVNJsonTicker.d.cts +34 -0
  43. package/dist/interface/PixiVNJsonTicker.d.ts +34 -0
  44. package/dist/interface/PixiVNJsonTicker.js +0 -0
  45. package/dist/interface/index.d.cts +2 -0
  46. package/dist/interface/index.d.ts +2 -0
  47. package/dist/managers/TranslateManager.d.cts +3 -1
  48. package/dist/managers/TranslateManager.d.ts +3 -1
  49. package/dist/managers/index.d.cts +3 -1
  50. package/dist/managers/index.d.ts +3 -1
  51. package/package.json +1 -1
@@ -1,3 +1,3 @@
1
- 'use strict';var pixiVn=require('@drincs/pixi-vn');var oe=Object.create;var M=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,ce=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 K=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ue=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of le(t))!ce.call(i,a)&&a!==e&&M(i,a,{get:()=>t[a],enumerable:!(n=se(t,a))||n.enumerable});return i};var pe=(i,t,e)=>(e=i!=null?oe(fe(i)):{},ue(M(e,"default",{value:i,enumerable:!0}),i));var X=K((D,U)=>{(function(i,t){typeof D=="object"?U.exports=D=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(D,function(){var i=i||function(t,e){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof W=="function")try{n=W("crypto");}catch{}var a=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function r(){}return function(o){var u;return r.prototype=o,u=new r,r.prototype=null,u}}(),c={},y=c.lib={},d=y.Base=function(){return {extend:function(r){var o=s(this);return r&&o.mixIn(r),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var r=this.extend();return r.init.apply(r,arguments),r},init:function(){},mixIn:function(r){for(var o in r)r.hasOwnProperty(o)&&(this[o]=r[o]);r.hasOwnProperty("toString")&&(this.toString=r.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),p=y.WordArray=d.extend({init:function(r,o){r=this.words=r||[],o!=e?this.sigBytes=o:this.sigBytes=r.length*4;},toString:function(r){return (r||g).stringify(this)},concat:function(r){var o=this.words,u=r.words,m=this.sigBytes,b=r.sigBytes;if(this.clamp(),m%4)for(var N=0;N<b;N++){var H=u[N>>>2]>>>24-N%4*8&255;o[m+N>>>2]|=H<<24-(m+N)%4*8;}else for(var S=0;S<b;S+=4)o[m+S>>>2]=u[S>>>2];return this.sigBytes+=b,this},clamp:function(){var r=this.words,o=this.sigBytes;r[o>>>2]&=4294967295<<32-o%4*8,r.length=t.ceil(o/4);},clone:function(){var r=d.clone.call(this);return r.words=this.words.slice(0),r},random:function(r){for(var o=[],u=0;u<r;u+=4)o.push(a());return new p.init(o,r)}}),l=c.enc={},g=l.Hex={stringify:function(r){for(var o=r.words,u=r.sigBytes,m=[],b=0;b<u;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push((N>>>4).toString(16)),m.push((N&15).toString(16));}return m.join("")},parse:function(r){for(var o=r.length,u=[],m=0;m<o;m+=2)u[m>>>3]|=parseInt(r.substr(m,2),16)<<24-m%8*4;return new p.init(u,o/2)}},h=l.Latin1={stringify:function(r){for(var o=r.words,u=r.sigBytes,m=[],b=0;b<u;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push(String.fromCharCode(N));}return m.join("")},parse:function(r){for(var o=r.length,u=[],m=0;m<o;m++)u[m>>>2]|=(r.charCodeAt(m)&255)<<24-m%4*8;return new p.init(u,o)}},x=l.Utf8={stringify:function(r){try{return decodeURIComponent(escape(h.stringify(r)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(r){return h.parse(unescape(encodeURIComponent(r)))}},T=y.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new p.init,this._nDataBytes=0;},_append:function(r){typeof r=="string"&&(r=x.parse(r)),this._data.concat(r),this._nDataBytes+=r.sigBytes;},_process:function(r){var o,u=this._data,m=u.words,b=u.sigBytes,N=this.blockSize,H=N*4,S=b/H;r?S=t.ceil(S):S=t.max((S|0)-this._minBufferSize,0);var k=S*N,z=t.min(k*4,b);if(k){for(var F=0;F<k;F+=N)this._doProcessBlock(m,F);o=m.splice(0,k),u.sigBytes-=z;}return new p.init(o,z)},clone:function(){var r=d.clone.call(this);return r._data=this._data.clone(),r},_minBufferSize:0});y.Hasher=T.extend({cfg:d.extend(),init:function(r){this.cfg=this.cfg.extend(r),this.reset();},reset:function(){T.reset.call(this),this._doReset();},update:function(r){return this._append(r),this._process(),this},finalize:function(r){r&&this._append(r);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(r){return function(o,u){return new r.init(u).finalize(o)}},_createHmacHelper:function(r){return function(o,u){return new V.HMAC.init(r,u).finalize(o)}}});var V=c.algo={};return c}(Math);return i});});var Y=K((I,q)=>{(function(i,t){typeof I=="object"?q.exports=I=t(X()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(I,function(i){return function(){var t=i,e=t.lib,n=e.WordArray,a=e.Hasher,s=t.algo,c=[],y=s.SHA1=a.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,p){for(var l=this._hash.words,g=l[0],h=l[1],x=l[2],T=l[3],C=l[4],V=0;V<80;V++){if(V<16)c[V]=d[p+V]|0;else {var r=c[V-3]^c[V-8]^c[V-14]^c[V-16];c[V]=r<<1|r>>>31;}var o=(g<<5|g>>>27)+C+c[V];V<20?o+=(h&x|~h&T)+1518500249:V<40?o+=(h^x^T)+1859775393:V<60?o+=(h&x|h&T|x&T)-1894007588:o+=(h^x^T)-899497514,C=T,T=x,x=h<<30|h>>>2,h=g,g=o;}l[0]=l[0]+g|0,l[1]=l[1]+h|0,l[2]=l[2]+x|0,l[3]=l[3]+T|0,l[4]=l[4]+C|0;},_doFinalize:function(){var d=this._data,p=d.words,l=this._nDataBytes*8,g=d.sigBytes*8;return p[g>>>5]|=128<<24-g%32,p[(g+64>>>9<<4)+14]=Math.floor(l/4294967296),p[(g+64>>>9<<4)+15]=l,d.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});t.SHA1=a._createHelper(y),t.HmacSHA1=a._createHmacHelper(y);}(),i.SHA1});});var ae=pe(Y());var E="___param___";var P=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,n){let a=n.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(s=>{t[s]===void 0&&(a==="empty_string"?t[s]="":a==="copy_key"&&(i._beforeToTranslate?t[s]=i._beforeToTranslate(s):t[s]=s));});}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(n=>{i.getConditionalsThenElse(n,e);});else if(t.elements.type==="ifelse"){let n=[];i.getConditionalsThenElse(t.elements,n),n.forEach(a=>{e.push(...a);});}else if(t.elements.type==="stepswitch"){let n=[];i.getConditionalsThenElse(t.elements,n),n.forEach(a=>{e.push(...a);});}else i.getConditionalsThenElse(t.elements,e);}else t.type==="resulttocombine"?(t.firstItem&&i.getConditionalsThenElse(t.firstItem,e),t.secondConditionalItem&&t.secondConditionalItem.forEach(n=>{i.getConditionalsThenElse(n,e);})):e.push(t);else t&&e.push(t);return e}static generateJsonTranslation(t,e={},n={}){return t.forEach(a=>{if(a.choices){let s=[];Array.isArray(a.choices)?s=[a.choices]:s=i.getConditionalsThenElse(a.choices),s.forEach(c=>c.forEach(y=>{if("type"in y){let d=[];y.type==="ifelse"||y.type==="stepswitch"?i.getConditionalsThenElse(y,d):d=[y],d.map(l=>i.getConditionalsThenElse(l.text)).forEach(l=>{Array.isArray(l)&&l.forEach(g=>{Array.isArray(g)?g.forEach(h=>{typeof h=="string"?i.addKey(e,h,n):i.getConditionalsThenElse(h).forEach(x=>{Array.isArray(x)?x.forEach(T=>{typeof T=="string"&&i.addKey(e,T,n);}):typeof x=="string"&&i.addKey(e,x,n);});}):typeof g=="string"&&i.addKey(e,g,n);});});}}));}if(a.dialogue){let s=[];Array.isArray(a.dialogue)?s=[a.dialogue]:s=i.getConditionalsThenElse(a.dialogue),s.forEach(c=>{typeof c=="string"?i.addKey(e,c,n):"text"in c&&Array.isArray(c.text)&&c.text.forEach(y=>{typeof y=="string"?i.addKey(e,y,n):i.getConditionalsThenElse(y).forEach(p=>{typeof p=="string"?i.addKey(e,p,n):Array.isArray(p)&&p.forEach(l=>{typeof l=="string"?i.addKey(e,l,n):i.getConditionalsThenElse(l).forEach(g=>{typeof g=="string"&&i.addKey(e,g,n);});});});});});}a.conditionalStep&&i.getConditionalsThenElse(a.conditionalStep).forEach(c=>{Array.isArray(c)?i.generateJsonTranslation(c,e,n):i.generateJsonTranslation([c],e,n);});}),e}};var R=P;function ge(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function ye(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 f(i.condition)?f(i.then):f(i.else);case"stepswitch":let e=f(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let n=ge(0,e.length-1);return f(e[n]);case"loop":let a=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return a>e.length-1&&(a=a%e.length),f(e[a]);case"sequential":let s,c=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(s=f(e[e.length-1])),c>e.length-1?s:f(e[c]);case"sequentialrandom":let y=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(y==null&&i.end=="lastItem"){let d=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!d||!d?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let p=d.usedRandomNumbers[`0-${e.length-1}`];return f(e[p[p.length-1]])}if(y==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return f(e[y])}}return i}function G(i){if(i.conditionalStep){let t=pixiVn.createExportableElement(f(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 G(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(a=>{if(Array.isArray(a))a.forEach(s=>{let c=f(s);e.push(c);});else {let s=f(a);e.push(s);}});let n=t?[t,...e]:e;if(n.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof n[0]=="string")return R.t(n).join("");if(typeof n[0]=="object"){let a=n,s,c=a.map((r,o)=>{r=G(r);let u=f(r.dialogue)||"";return o===0?(s=f(r.glueEnabled)||!1,u):(typeof u=="object"&&"text"in u&&(u=u.character+": "+u.text),s===!1&&(u=`
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn');var ce=Object.create;var j=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty;var z=(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 K=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports);var ye=(t,i,e,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of ue(i))!ge.call(t,a)&&a!==e&&j(t,a,{get:()=>i[a],enumerable:!(r=pe(i,a))||r.enumerable});return t};var he=(t,i,e)=>(e=t!=null?ce(de(t)):{},ye(j(e,"default",{value:t,enumerable:!0}),t));var X=K((D,U)=>{(function(t,i){typeof D=="object"?U.exports=D=i():typeof define=="function"&&define.amd?define([],i):t.CryptoJS=i();})(D,function(){var t=t||function(i,e){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof z=="function")try{r=z("crypto");}catch{}var a=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.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(o){var d;return n.prototype=o,d=new n,n.prototype=null,d}}(),g={},l=g.lib={},u=l.Base=function(){return {extend:function(n){var o=f(this);return n&&o.mixIn(n),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var o in n)n.hasOwnProperty(o)&&(this[o]=n[o]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),p=l.WordArray=u.extend({init:function(n,o){n=this.words=n||[],o!=e?this.sigBytes=o:this.sigBytes=n.length*4;},toString:function(n){return (n||y).stringify(this)},concat:function(n){var o=this.words,d=n.words,m=this.sigBytes,b=n.sigBytes;if(this.clamp(),m%4)for(var N=0;N<b;N++){var H=d[N>>>2]>>>24-N%4*8&255;o[m+N>>>2]|=H<<24-(m+N)%4*8;}else for(var S=0;S<b;S+=4)o[m+S>>>2]=d[S>>>2];return this.sigBytes+=b,this},clamp:function(){var n=this.words,o=this.sigBytes;n[o>>>2]&=4294967295<<32-o%4*8,n.length=i.ceil(o/4);},clone:function(){var n=u.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var o=[],d=0;d<n;d+=4)o.push(a());return new p.init(o,n)}}),s=g.enc={},y=s.Hex={stringify:function(n){for(var o=n.words,d=n.sigBytes,m=[],b=0;b<d;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push((N>>>4).toString(16)),m.push((N&15).toString(16));}return m.join("")},parse:function(n){for(var o=n.length,d=[],m=0;m<o;m+=2)d[m>>>3]|=parseInt(n.substr(m,2),16)<<24-m%8*4;return new p.init(d,o/2)}},h=s.Latin1={stringify:function(n){for(var o=n.words,d=n.sigBytes,m=[],b=0;b<d;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push(String.fromCharCode(N));}return m.join("")},parse:function(n){for(var o=n.length,d=[],m=0;m<o;m++)d[m>>>2]|=(n.charCodeAt(m)&255)<<24-m%4*8;return new p.init(d,o)}},x=s.Utf8={stringify:function(n){try{return decodeURIComponent(escape(h.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return h.parse(unescape(encodeURIComponent(n)))}},T=l.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new p.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=x.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var o,d=this._data,m=d.words,b=d.sigBytes,N=this.blockSize,H=N*4,S=b/H;n?S=i.ceil(S):S=i.max((S|0)-this._minBufferSize,0);var L=S*N,M=i.min(L*4,b);if(L){for(var F=0;F<L;F+=N)this._doProcessBlock(m,F);o=m.splice(0,L),d.sigBytes-=M;}return new p.init(o,M)},clone:function(){var n=u.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});l.Hasher=T.extend({cfg:u.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){T.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(n){return function(o,d){return new n.init(d).finalize(o)}},_createHmacHelper:function(n){return function(o,d){return new V.HMAC.init(n,d).finalize(o)}}});var V=g.algo={};return g}(Math);return t});});var Y=K((I,q)=>{(function(t,i){typeof I=="object"?q.exports=I=i(X()):typeof define=="function"&&define.amd?define(["./core"],i):i(t.CryptoJS);})(I,function(t){return function(){var i=t,e=i.lib,r=e.WordArray,a=e.Hasher,f=i.algo,g=[],l=f.SHA1=a.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(u,p){for(var s=this._hash.words,y=s[0],h=s[1],x=s[2],T=s[3],w=s[4],V=0;V<80;V++){if(V<16)g[V]=u[p+V]|0;else {var n=g[V-3]^g[V-8]^g[V-14]^g[V-16];g[V]=n<<1|n>>>31;}var o=(y<<5|y>>>27)+w+g[V];V<20?o+=(h&x|~h&T)+1518500249:V<40?o+=(h^x^T)+1859775393:V<60?o+=(h&x|h&T|x&T)-1894007588:o+=(h^x^T)-899497514,w=T,T=x,x=h<<30|h>>>2,h=y,y=o;}s[0]=s[0]+y|0,s[1]=s[1]+h|0,s[2]=s[2]+x|0,s[3]=s[3]+T|0,s[4]=s[4]+w|0;},_doFinalize:function(){var u=this._data,p=u.words,s=this._nDataBytes*8,y=u.sigBytes*8;return p[y>>>5]|=128<<24-y%32,p[(y+64>>>9<<4)+14]=Math.floor(s/4294967296),p[(y+64>>>9<<4)+15]=s,u.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var u=a.clone.call(this);return u._hash=this._hash.clone(),u}});i.SHA1=a._createHelper(l),i.HmacSHA1=a._createHmacHelper(l);}(),t.SHA1});});var fe=he(Y());var E="___param___";var P=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,r){let a=r.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(f=>{i[f]===void 0&&(a==="empty_string"?i[f]="":a==="copy_key"&&(t._beforeToTranslate?i[f]=t._beforeToTranslate(f):i[f]=f));});}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(r=>{t.getConditionalsThenElse(r,e);});else if(i.elements.type==="ifelse"){let r=[];t.getConditionalsThenElse(i.elements,r),r.forEach(a=>{e.push(...a);});}else if(i.elements.type==="stepswitch"){let r=[];t.getConditionalsThenElse(i.elements,r),r.forEach(a=>{e.push(...a);});}else t.getConditionalsThenElse(i.elements,e);}else i.type==="resulttocombine"?(i.firstItem&&t.getConditionalsThenElse(i.firstItem,e),i.secondConditionalItem&&i.secondConditionalItem.forEach(r=>{t.getConditionalsThenElse(r,e);})):e.push(i);else i&&e.push(i);return e}static generateJsonTranslation(i,e={},r={}){return i.forEach(a=>{if(a.choices){let f=[];Array.isArray(a.choices)?f=[a.choices]:f=t.getConditionalsThenElse(a.choices),f.forEach(g=>g.forEach(l=>{if("type"in l){let u=[];l.type==="ifelse"||l.type==="stepswitch"?t.getConditionalsThenElse(l,u):u=[l],u.map(s=>t.getConditionalsThenElse(s.text)).forEach(s=>{Array.isArray(s)&&s.forEach(y=>{Array.isArray(y)?y.forEach(h=>{typeof h=="string"?t.addKey(e,h,r):t.getConditionalsThenElse(h).forEach(x=>{Array.isArray(x)?x.forEach(T=>{typeof T=="string"&&t.addKey(e,T,r);}):typeof x=="string"&&t.addKey(e,x,r);});}):typeof y=="string"&&t.addKey(e,y,r);});});}}));}if(a.dialogue){let f=[];Array.isArray(a.dialogue)?f=[a.dialogue]:f=t.getConditionalsThenElse(a.dialogue),f.forEach(g=>{typeof g=="string"?t.addKey(e,g,r):"text"in g&&Array.isArray(g.text)&&g.text.forEach(l=>{typeof l=="string"?t.addKey(e,l,r):t.getConditionalsThenElse(l).forEach(p=>{typeof p=="string"?t.addKey(e,p,r):Array.isArray(p)&&p.forEach(s=>{typeof s=="string"?t.addKey(e,s,r):t.getConditionalsThenElse(s).forEach(y=>{typeof y=="string"&&t.addKey(e,y,r);});});});});});}a.conditionalStep&&t.getConditionalsThenElse(a.conditionalStep).forEach(g=>{Array.isArray(g)?t.generateJsonTranslation(g,e,r):t.generateJsonTranslation([g],e,r);});}),e}};var R=P;function Te(t,i){return Math.floor(Math.random()*(i-t+1)+t)}function xe(t){if(Array.isArray(t)||!t)return t;if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"resulttocombine":return be(t);case"ifelse":return c(t.condition)?c(t.then):c(t.else);case"stepswitch":let e=c(t.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(t.choiceType){case"random":let r=Te(0,e.length-1);return c(e[r]);case"loop":let a=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return a>e.length-1&&(a=a%e.length),c(e[a]);case"sequential":let f,g=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return t.end=="lastItem"&&(f=c(e[e.length-1])),g>e.length-1?f:c(e[g]);case"sequentialrandom":let l=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:t.nestedId,onceOnly:!0});if(l==null&&t.end=="lastItem"){let u=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(t.nestedId);if(!u||!u?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let p=u.usedRandomNumbers[`0-${e.length-1}`];return c(e[p[p.length-1]])}if(l==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return c(e[l])}}return t}function G(t){if(t.conditionalStep){let i=pixiVn.createExportableElement(c(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 G(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 be(t){let i=t.firstItem,e=[];t.secondConditionalItem?.forEach(a=>{if(Array.isArray(a))a.forEach(f=>{let g=c(f);e.push(g);});else {let f=c(a);e.push(f);}});let r=i?[i,...e]:e;if(r.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return R.t(r).join("");if(typeof r[0]=="object"){let a=r,f,g=a.map((n,o)=>{n=G(n);let d=c(n.dialogue)||"";return o===0?(f=c(n.glueEnabled)||!1,d):(typeof d=="object"&&"text"in d&&(d=d.character+": "+d.text),f===!1&&(d=`
2
2
 
3
- `+u),s=f(r.glueEnabled)||!1,u)}),y=f(c[0]),d=typeof y=="object"&&"character"in y?y.character:void 0,p=c.map(r=>{let o;r&&typeof r=="object"&&"text"in r?o=r.text:o=r;let u;return Array.isArray(o)?u=o.map(m=>{let b=f(m);return R.t(`${b}`)}).join(""):u=f(o)||"",R.t(u)}).join(""),l=a.find(r=>r.end),g=a.find(r=>r.choices),h=!1,x=!1;a.length>0&&(a[0].glueEnabled&&a[0].goNextStep&&a[0].dialogue===void 0&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),h=a[a.length-1].glueEnabled,x=a.reverse().find(r=>!(r.operations&&(!r.dialogue||!r.choices)))?.goNextStep);let T=a.find(r=>r.labelToOpen),C=[];return a.forEach(r=>{r.operations&&C.forEach(o=>{C.push(o);});}),{dialogue:d?{character:d,text:p}:p,end:l?.end,choices:g?.choices,glueEnabled:h,goNextStep:x,labelToOpen:T?.labelToOpen,operations:C}}}function me(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=f(i.leftValue),e=f(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 !!f(i.value);case"union":return xe(i)}return !!i}function Te(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 f(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 xe(i){if(i.unionType==="not")return !f(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=f(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function Z(i){let t=f(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=f(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 n=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];n&&n.length-1>=i.key&&(n[i.key]=e),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length-1}`,n);break}}function f(i){let t=ye(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return Te(t);case"arithmetic":case"arithmeticsingle":return be(t);case"compare":case"valueCondition":case"union":return me(t)}return t}function be(i){let t=f(i.leftValue);switch(i.type){case"arithmetic":let e=f(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 L(i,t){let e=f(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}case"image":switch(e.operationType){case"show":let n=new pixiVn.CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,n,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,n,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,n),await n.load();break;case"edit":let a=pixiVn.canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":pixiVn.canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":let n=new pixiVn.CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,n,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,n,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,n),await n.load();break;case"edit":let a=pixiVn.canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":pixiVn.canvas.remove(e.alias);break;case"pause":let s=pixiVn.canvas.find(e.alias);s?s.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let c=pixiVn.canvas.find(e.alias);c?c.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":Z(e);break;case"oprationtoconvert":if(t){let n="";e.values.forEach(s=>{if(typeof s=="string")n+=s;else {let c=f(s);n+=`${c}`;}});let a=await t(n);a&&await L(a,t);}break;case"input":switch(e.operationType){case"request":pixiVn.narration.requestInput({type:e.valueType});break}break}}var _=class extends pixiVn.LabelAbstract{constructor(t,e,n,a={}){super(t,n),this._steps=e,this.operationStringConvert=a.operationStringConvert,this.skipEmptyDialogs=a.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 n=[];t.forEach(a=>{if(typeof a=="string")n.push(a);else if(a&&typeof a=="object"){let s=f(a);s?(s&&!Array.isArray(s)&&typeof s=="object"&&(s=f(s)||""),Array.isArray(s)?n=n.concat(s):n.push(`${s}`)):n.push(`${a}`);}}),e=n;}else {let n=f(t)||"";n&&!Array.isArray(n)&&typeof n=="object"&&(n=f(n)||""),e=n;}return `${e}`}getDialogue(t){let e=f(t);if(e)return typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:P.t(this.getDialogueText(e.text))}:P.t(this.getDialogueText(e));if(e!=null)return `${e}`}getChoices(t){return f(t)?.map(a=>f(a)).filter(a=>a!==void 0)}stepConverter(t){return async e=>{if(typeof t=="function"&&(t=t()),t=G(t),t.operations)for(let p of t.operations)await L(p,this.operationStringConvert?l=>this.operationStringConvert(l,e):void 0);let n=this.getChoices(t.choices),a=f(t.glueEnabled),s=this.getDialogue(t.dialogue),c=[];t.labelToOpen&&(Array.isArray(t.labelToOpen)||(t.labelToOpen=[t.labelToOpen]),t.labelToOpen.forEach(p=>{let l=f(p);l&&c.push(l);}));let y=f(t.goNextStep),d=f(t.end);if(n){let p=n.map(l=>{let g="";if(Array.isArray(l.text)){let h=[];l.text.forEach(x=>{if(typeof x=="string")h.push(P.t(x));else if(x&&typeof x=="object"){let T=f(x);T&&!Array.isArray(T)&&typeof T=="object"&&(T=f(T)||""),T&&(Array.isArray(T)?h=h.concat(P.t(T)):h.push(P.t(T)));}}),g=h.join();}else typeof l.text=="string"&&(g=P.t(l.text));return new pixiVn.ChoiceMenuOption(g,l.label,l.props,{type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect})});pixiVn.narration.choiceMenuOptions=p;}else pixiVn.narration.choiceMenuOptions=void 0;s!==void 0&&(pixiVn.narration.dialogue=s,this.skipEmptyDialogs&&typeof s=="string"&&(s===""||RegExp(/^\s+$/).test(s))&&(y=!0)),a?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):a===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let p of c){let l=p.label;typeof l=="object"&&(l=f(l)||"");let g=p.params?.map(h=>f(h));e={...e,...p.props},p.type==="jump"?(pixiVn.narration.closeCurrentLabel(),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,g),await pixiVn.narration.callLabel(l,e)):(pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,g),await pixiVn.narration.callLabel(l,e));}d==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e)):d==="label_end"&&pixiVn.narration.closeCurrentLabel(),y&&await pixiVn.narration.goNext(e);}}};function nt(i,t={}){let e=t?.operationStringConvert;try{typeof i=="string"&&(i=JSON.parse(i));}catch(n){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON",n);return}if(typeof i!="object"){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON: data is not an object");return}if(i.initialOperations){for(let n of i.initialOperations)L(n,e?a=>e(a,{}):void 0);pixiVn.StorageManagerStatic.saveStorageAsBasicStorage();}if(i.labels){let n=i.labels;for(let a in n)try{let s=n[a],c=new _(a,s,void 0,t);pixiVn.saveLabel(c);}catch(s){console.error(`[Pixi\u2019VN Json] Error creating JSON label ${a}`,s);}}}exports.importPixiVNJson=nt;
3
+ `+d),f=c(n.glueEnabled)||!1,d)}),l=c(g[0]),u=typeof l=="object"&&"character"in l?l.character:void 0,p=g.map(n=>{let o;n&&typeof n=="object"&&"text"in n?o=n.text:o=n;let d;return Array.isArray(o)?d=o.map(m=>{let b=c(m);return R.t(`${b}`)}).join(""):d=c(o)||"",R.t(d)}).join(""),s=a.find(n=>n.end),y=a.find(n=>n.choices),h=!1,x=!1;a.length>0&&(a[0].glueEnabled&&a[0].goNextStep&&a[0].dialogue===void 0&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),h=a[a.length-1].glueEnabled,x=a.reverse().find(n=>!(n.operations&&(!n.dialogue||!n.choices)))?.goNextStep);let T=a.find(n=>n.labelToOpen),w=[];return a.forEach(n=>{n.operations&&w.forEach(o=>{w.push(o);});}),{dialogue:u?{character:u,text:p}:p,end:s?.end,choices:y?.choices,glueEnabled:h,goNextStep:x,labelToOpen:T?.labelToOpen,operations:w}}}function Ve(t){if(!t)return !1;if(typeof t!="object"||!("type"in t))return !!t;switch(t.type){case"compare":let i=c(t.leftValue),e=c(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 !!c(t.value);case"union":return Pe(t)}return !!t}function Ne(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 c(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 Pe(t){if(t.unionType==="not")return !c(t.condition);let i=t.unionType==="and";for(let e=0;e<t.conditions.length;e++)if(i=c(t.conditions[e])||!1,t.unionType==="and"){if(!i)return !1}else if(i)return !0;return i}function Q(t){let i=c(t.value),e;switch(i&&typeof i=="object"&&"type"in i?e=c(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 r=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];r&&r.length-1>=t.key&&(r[t.key]=e),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length-1}`,r);break}}function c(t){let i=xe(t);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"value":return Ne(i);case"arithmetic":case"arithmeticsingle":return Je(i);case"compare":case"valueCondition":case"union":return Ve(i)}return i}function Je(t){let i=c(t.leftValue);switch(t.type){case"arithmetic":let e=c(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 _(t,i){let e=c(t);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 l=new pixiVn.CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await pixiVn.showWithFadeTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"dissolve":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await pixiVn.showWithDissolveTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,l,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,l,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,l),await l.load();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":if(e.transition)switch(e.transition.type){case"fade":pixiVn.removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(e.alias,e.transition.props,e.transition.priority);break}else pixiVn.canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":let l=new pixiVn.CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await pixiVn.showWithFadeTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"dissolve":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await pixiVn.showWithDissolveTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,l,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,l,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,l),await l.load();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":if(e.transition)switch(e.transition.type){case"fade":pixiVn.removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(e.alias,e.transition.props,e.transition.priority);break}else pixiVn.canvas.remove(e.alias);break;case"pause":let p=pixiVn.canvas.find(e.alias);p?p.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let s=pixiVn.canvas.find(e.alias);s?s.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":Q(e);break;case"oprationtoconvert":if(i){let l="";e.values.forEach(p=>{if(typeof p=="string")l+=p;else {let s=c(p);l+=`${s}`;}});let u=await i(l);u&&await _(u,i);}break;case"input":switch(e.operationType){case"request":pixiVn.narration.requestInput({type:e.valueType});break}break;case"fade":let r=new pixiVn.FadeAlphaTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,r);break;case"move":let a=new pixiVn.MoveTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,a);break;case"rotate":let f=new pixiVn.RotateTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,f);break;case"zoom":let g=new pixiVn.ZoomTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,g);break;case"shake":await pixiVn.shakeEffect(e.alias,e.props,e.priority);break}}var O=class extends pixiVn.LabelAbstract{constructor(i,e,r,a={}){super(i,r),this._steps=e,this.operationStringConvert=a.operationStringConvert,this.skipEmptyDialogs=a.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, fe.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(i){let e="";if(Array.isArray(i)){let r=[];i.forEach(a=>{if(typeof a=="string")r.push(a);else if(a&&typeof a=="object"){let f=c(a);f?(f&&!Array.isArray(f)&&typeof f=="object"&&(f=c(f)||""),Array.isArray(f)?r=r.concat(f):r.push(`${f}`)):r.push(`${a}`);}}),e=r;}else {let r=c(i)||"";r&&!Array.isArray(r)&&typeof r=="object"&&(r=c(r)||""),e=r;}return `${e}`}getDialogue(i){let e=c(i);if(e)return typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:P.t(this.getDialogueText(e.text))}:P.t(this.getDialogueText(e));if(e!=null)return `${e}`}getChoices(i){return c(i)?.map(a=>c(a)).filter(a=>a!==void 0)}stepConverter(i){return async e=>{if(typeof i=="function"&&(i=i()),i=G(i),i.operations)for(let p of i.operations)await _(p,this.operationStringConvert?s=>this.operationStringConvert(s,e):void 0);let r=this.getChoices(i.choices),a=c(i.glueEnabled),f=this.getDialogue(i.dialogue),g=[];i.labelToOpen&&(Array.isArray(i.labelToOpen)||(i.labelToOpen=[i.labelToOpen]),i.labelToOpen.forEach(p=>{let s=c(p);s&&g.push(s);}));let l=c(i.goNextStep),u=c(i.end);if(r){let p=r.map(s=>{let y="";if(Array.isArray(s.text)){let h=[];s.text.forEach(x=>{if(typeof x=="string")h.push(P.t(x));else if(x&&typeof x=="object"){let T=c(x);T&&!Array.isArray(T)&&typeof T=="object"&&(T=c(T)||""),T&&(Array.isArray(T)?h=h.concat(P.t(T)):h.push(P.t(T)));}}),y=h.join();}else typeof s.text=="string"&&(y=P.t(s.text));return new pixiVn.ChoiceMenuOption(y,s.label,s.props,{type:s.type,oneTime:s.oneTime,onlyHaveNoChoice:s.onlyHaveNoChoice,autoSelect:s.autoSelect})});pixiVn.narration.choiceMenuOptions=p;}else pixiVn.narration.choiceMenuOptions=void 0;f!==void 0&&(pixiVn.narration.dialogue=f,this.skipEmptyDialogs&&typeof f=="string"&&(f===""||RegExp(/^\s+$/).test(f))&&(l=!0)),a?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):a===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let p of g){let s=p.label;typeof s=="object"&&(s=c(s)||"");let y=p.params?.map(h=>c(h));e={...e,...p.props},p.type==="jump"?(pixiVn.narration.closeCurrentLabel(),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,y),await pixiVn.narration.callLabel(s,e)):(pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,y),await pixiVn.narration.callLabel(s,e));}u==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e)):u==="label_end"&&pixiVn.narration.closeCurrentLabel(),l&&await pixiVn.narration.goNext(e);}}};function ui(t,i={}){let e=i?.operationStringConvert;try{typeof t=="string"&&(t=JSON.parse(t));}catch(r){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON",r);return}if(typeof t!="object"){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON: data is not an object");return}if(t.initialOperations){for(let r of t.initialOperations)_(r,e?a=>e(a,{}):void 0);pixiVn.StorageManagerStatic.saveStorageAsBasicStorage();}if(t.labels){let r=t.labels;for(let a in r)try{let f=r[a],g=new O(a,f,void 0,i);pixiVn.saveLabel(g);}catch(f){console.error(`[Pixi\u2019VN Json] Error creating JSON label ${a}`,f);}}}exports.importPixiVNJson=ui;
@@ -5,8 +5,10 @@ import '../interface/PixiVNJsonLabelStep.cjs';
5
5
  import '../PixiVNJsonConditionalStatements-CVkQSKpq.cjs';
6
6
  import '../interface/PixiVNJsonOperations.cjs';
7
7
  import '../interface/PixiVNJsonCanvas.cjs';
8
- import '../interface/PixiVNJsonMediaTransiotions.cjs';
8
+ import '../interface/PixiVNJsonEffect.cjs';
9
9
  import 'pixi.js';
10
+ import '../interface/PixiVNJsonMediaTransiotions.cjs';
11
+ import '../interface/PixiVNJsonTicker.cjs';
10
12
  import '../interface/PixiVNJsonInput.cjs';
11
13
  import '../interface/PixiVNJsonSound.cjs';
12
14
  import '../interface/PixiVNJsonLabels.cjs';
@@ -5,8 +5,10 @@ import '../interface/PixiVNJsonLabelStep.js';
5
5
  import '../PixiVNJsonConditionalStatements-CVkQSKpq.js';
6
6
  import '../interface/PixiVNJsonOperations.js';
7
7
  import '../interface/PixiVNJsonCanvas.js';
8
- import '../interface/PixiVNJsonMediaTransiotions.js';
8
+ import '../interface/PixiVNJsonEffect.js';
9
9
  import 'pixi.js';
10
+ import '../interface/PixiVNJsonMediaTransiotions.js';
11
+ import '../interface/PixiVNJsonTicker.js';
10
12
  import '../interface/PixiVNJsonInput.js';
11
13
  import '../interface/PixiVNJsonSound.js';
12
14
  import '../interface/PixiVNJsonLabels.js';
@@ -1,3 +1,3 @@
1
- import {StorageManagerStatic,saveLabel,narration,canvas,CanvasVideo,zoomIn,moveIn,showWithDissolveTransition,showWithFadeTransition,CanvasImage,Assets,sound,LabelAbstract,ChoiceMenuOption,setFlag,storage,createExportableElement,getFlag,NarrationManagerStatic}from'@drincs/pixi-vn';var oe=Object.create;var M=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,ce=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 K=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ue=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of le(t))!ce.call(i,a)&&a!==e&&M(i,a,{get:()=>t[a],enumerable:!(n=se(t,a))||n.enumerable});return i};var pe=(i,t,e)=>(e=i!=null?oe(fe(i)):{},ue(M(e,"default",{value:i,enumerable:!0}),i));var X=K((D,U)=>{(function(i,t){typeof D=="object"?U.exports=D=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(D,function(){var i=i||function(t,e){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof W=="function")try{n=W("crypto");}catch{}var a=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function r(){}return function(o){var u;return r.prototype=o,u=new r,r.prototype=null,u}}(),c={},y=c.lib={},d=y.Base=function(){return {extend:function(r){var o=s(this);return r&&o.mixIn(r),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var r=this.extend();return r.init.apply(r,arguments),r},init:function(){},mixIn:function(r){for(var o in r)r.hasOwnProperty(o)&&(this[o]=r[o]);r.hasOwnProperty("toString")&&(this.toString=r.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),p=y.WordArray=d.extend({init:function(r,o){r=this.words=r||[],o!=e?this.sigBytes=o:this.sigBytes=r.length*4;},toString:function(r){return (r||g).stringify(this)},concat:function(r){var o=this.words,u=r.words,m=this.sigBytes,b=r.sigBytes;if(this.clamp(),m%4)for(var N=0;N<b;N++){var H=u[N>>>2]>>>24-N%4*8&255;o[m+N>>>2]|=H<<24-(m+N)%4*8;}else for(var S=0;S<b;S+=4)o[m+S>>>2]=u[S>>>2];return this.sigBytes+=b,this},clamp:function(){var r=this.words,o=this.sigBytes;r[o>>>2]&=4294967295<<32-o%4*8,r.length=t.ceil(o/4);},clone:function(){var r=d.clone.call(this);return r.words=this.words.slice(0),r},random:function(r){for(var o=[],u=0;u<r;u+=4)o.push(a());return new p.init(o,r)}}),l=c.enc={},g=l.Hex={stringify:function(r){for(var o=r.words,u=r.sigBytes,m=[],b=0;b<u;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push((N>>>4).toString(16)),m.push((N&15).toString(16));}return m.join("")},parse:function(r){for(var o=r.length,u=[],m=0;m<o;m+=2)u[m>>>3]|=parseInt(r.substr(m,2),16)<<24-m%8*4;return new p.init(u,o/2)}},h=l.Latin1={stringify:function(r){for(var o=r.words,u=r.sigBytes,m=[],b=0;b<u;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push(String.fromCharCode(N));}return m.join("")},parse:function(r){for(var o=r.length,u=[],m=0;m<o;m++)u[m>>>2]|=(r.charCodeAt(m)&255)<<24-m%4*8;return new p.init(u,o)}},x=l.Utf8={stringify:function(r){try{return decodeURIComponent(escape(h.stringify(r)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(r){return h.parse(unescape(encodeURIComponent(r)))}},T=y.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new p.init,this._nDataBytes=0;},_append:function(r){typeof r=="string"&&(r=x.parse(r)),this._data.concat(r),this._nDataBytes+=r.sigBytes;},_process:function(r){var o,u=this._data,m=u.words,b=u.sigBytes,N=this.blockSize,H=N*4,S=b/H;r?S=t.ceil(S):S=t.max((S|0)-this._minBufferSize,0);var k=S*N,z=t.min(k*4,b);if(k){for(var F=0;F<k;F+=N)this._doProcessBlock(m,F);o=m.splice(0,k),u.sigBytes-=z;}return new p.init(o,z)},clone:function(){var r=d.clone.call(this);return r._data=this._data.clone(),r},_minBufferSize:0});y.Hasher=T.extend({cfg:d.extend(),init:function(r){this.cfg=this.cfg.extend(r),this.reset();},reset:function(){T.reset.call(this),this._doReset();},update:function(r){return this._append(r),this._process(),this},finalize:function(r){r&&this._append(r);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(r){return function(o,u){return new r.init(u).finalize(o)}},_createHmacHelper:function(r){return function(o,u){return new V.HMAC.init(r,u).finalize(o)}}});var V=c.algo={};return c}(Math);return i});});var Y=K((I,q)=>{(function(i,t){typeof I=="object"?q.exports=I=t(X()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(I,function(i){return function(){var t=i,e=t.lib,n=e.WordArray,a=e.Hasher,s=t.algo,c=[],y=s.SHA1=a.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,p){for(var l=this._hash.words,g=l[0],h=l[1],x=l[2],T=l[3],C=l[4],V=0;V<80;V++){if(V<16)c[V]=d[p+V]|0;else {var r=c[V-3]^c[V-8]^c[V-14]^c[V-16];c[V]=r<<1|r>>>31;}var o=(g<<5|g>>>27)+C+c[V];V<20?o+=(h&x|~h&T)+1518500249:V<40?o+=(h^x^T)+1859775393:V<60?o+=(h&x|h&T|x&T)-1894007588:o+=(h^x^T)-899497514,C=T,T=x,x=h<<30|h>>>2,h=g,g=o;}l[0]=l[0]+g|0,l[1]=l[1]+h|0,l[2]=l[2]+x|0,l[3]=l[3]+T|0,l[4]=l[4]+C|0;},_doFinalize:function(){var d=this._data,p=d.words,l=this._nDataBytes*8,g=d.sigBytes*8;return p[g>>>5]|=128<<24-g%32,p[(g+64>>>9<<4)+14]=Math.floor(l/4294967296),p[(g+64>>>9<<4)+15]=l,d.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});t.SHA1=a._createHelper(y),t.HmacSHA1=a._createHmacHelper(y);}(),i.SHA1});});var ae=pe(Y());var E="___param___";var P=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,n){let a=n.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(s=>{t[s]===void 0&&(a==="empty_string"?t[s]="":a==="copy_key"&&(i._beforeToTranslate?t[s]=i._beforeToTranslate(s):t[s]=s));});}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(n=>{i.getConditionalsThenElse(n,e);});else if(t.elements.type==="ifelse"){let n=[];i.getConditionalsThenElse(t.elements,n),n.forEach(a=>{e.push(...a);});}else if(t.elements.type==="stepswitch"){let n=[];i.getConditionalsThenElse(t.elements,n),n.forEach(a=>{e.push(...a);});}else i.getConditionalsThenElse(t.elements,e);}else t.type==="resulttocombine"?(t.firstItem&&i.getConditionalsThenElse(t.firstItem,e),t.secondConditionalItem&&t.secondConditionalItem.forEach(n=>{i.getConditionalsThenElse(n,e);})):e.push(t);else t&&e.push(t);return e}static generateJsonTranslation(t,e={},n={}){return t.forEach(a=>{if(a.choices){let s=[];Array.isArray(a.choices)?s=[a.choices]:s=i.getConditionalsThenElse(a.choices),s.forEach(c=>c.forEach(y=>{if("type"in y){let d=[];y.type==="ifelse"||y.type==="stepswitch"?i.getConditionalsThenElse(y,d):d=[y],d.map(l=>i.getConditionalsThenElse(l.text)).forEach(l=>{Array.isArray(l)&&l.forEach(g=>{Array.isArray(g)?g.forEach(h=>{typeof h=="string"?i.addKey(e,h,n):i.getConditionalsThenElse(h).forEach(x=>{Array.isArray(x)?x.forEach(T=>{typeof T=="string"&&i.addKey(e,T,n);}):typeof x=="string"&&i.addKey(e,x,n);});}):typeof g=="string"&&i.addKey(e,g,n);});});}}));}if(a.dialogue){let s=[];Array.isArray(a.dialogue)?s=[a.dialogue]:s=i.getConditionalsThenElse(a.dialogue),s.forEach(c=>{typeof c=="string"?i.addKey(e,c,n):"text"in c&&Array.isArray(c.text)&&c.text.forEach(y=>{typeof y=="string"?i.addKey(e,y,n):i.getConditionalsThenElse(y).forEach(p=>{typeof p=="string"?i.addKey(e,p,n):Array.isArray(p)&&p.forEach(l=>{typeof l=="string"?i.addKey(e,l,n):i.getConditionalsThenElse(l).forEach(g=>{typeof g=="string"&&i.addKey(e,g,n);});});});});});}a.conditionalStep&&i.getConditionalsThenElse(a.conditionalStep).forEach(c=>{Array.isArray(c)?i.generateJsonTranslation(c,e,n):i.generateJsonTranslation([c],e,n);});}),e}};var R=P;function ge(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function ye(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 f(i.condition)?f(i.then):f(i.else);case"stepswitch":let e=f(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let n=ge(0,e.length-1);return f(e[n]);case"loop":let a=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return a>e.length-1&&(a=a%e.length),f(e[a]);case"sequential":let s,c=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(s=f(e[e.length-1])),c>e.length-1?s:f(e[c]);case"sequentialrandom":let y=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(y==null&&i.end=="lastItem"){let d=NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!d||!d?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let p=d.usedRandomNumbers[`0-${e.length-1}`];return f(e[p[p.length-1]])}if(y==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return f(e[y])}}return i}function G(i){if(i.conditionalStep){let t=createExportableElement(f(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 G(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(a=>{if(Array.isArray(a))a.forEach(s=>{let c=f(s);e.push(c);});else {let s=f(a);e.push(s);}});let n=t?[t,...e]:e;if(n.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof n[0]=="string")return R.t(n).join("");if(typeof n[0]=="object"){let a=n,s,c=a.map((r,o)=>{r=G(r);let u=f(r.dialogue)||"";return o===0?(s=f(r.glueEnabled)||!1,u):(typeof u=="object"&&"text"in u&&(u=u.character+": "+u.text),s===!1&&(u=`
1
+ import {StorageManagerStatic,saveLabel,shakeEffect,ZoomTicker,canvas,RotateTicker,MoveTicker,FadeAlphaTicker,narration,zoomOut,moveOut,removeWithDissolveTransition,removeWithFadeTransition,CanvasVideo,zoomIn,moveIn,showWithDissolveTransition,showWithFadeTransition,CanvasImage,Assets,sound,LabelAbstract,ChoiceMenuOption,setFlag,storage,createExportableElement,getFlag,NarrationManagerStatic}from'@drincs/pixi-vn';var ce=Object.create;var j=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty;var z=(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 K=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports);var ye=(t,i,e,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of ue(i))!ge.call(t,a)&&a!==e&&j(t,a,{get:()=>i[a],enumerable:!(r=pe(i,a))||r.enumerable});return t};var he=(t,i,e)=>(e=t!=null?ce(de(t)):{},ye(j(e,"default",{value:t,enumerable:!0}),t));var X=K((D,U)=>{(function(t,i){typeof D=="object"?U.exports=D=i():typeof define=="function"&&define.amd?define([],i):t.CryptoJS=i();})(D,function(){var t=t||function(i,e){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof z=="function")try{r=z("crypto");}catch{}var a=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.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(o){var d;return n.prototype=o,d=new n,n.prototype=null,d}}(),g={},l=g.lib={},u=l.Base=function(){return {extend:function(n){var o=f(this);return n&&o.mixIn(n),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var o in n)n.hasOwnProperty(o)&&(this[o]=n[o]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),p=l.WordArray=u.extend({init:function(n,o){n=this.words=n||[],o!=e?this.sigBytes=o:this.sigBytes=n.length*4;},toString:function(n){return (n||y).stringify(this)},concat:function(n){var o=this.words,d=n.words,m=this.sigBytes,b=n.sigBytes;if(this.clamp(),m%4)for(var N=0;N<b;N++){var H=d[N>>>2]>>>24-N%4*8&255;o[m+N>>>2]|=H<<24-(m+N)%4*8;}else for(var S=0;S<b;S+=4)o[m+S>>>2]=d[S>>>2];return this.sigBytes+=b,this},clamp:function(){var n=this.words,o=this.sigBytes;n[o>>>2]&=4294967295<<32-o%4*8,n.length=i.ceil(o/4);},clone:function(){var n=u.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var o=[],d=0;d<n;d+=4)o.push(a());return new p.init(o,n)}}),s=g.enc={},y=s.Hex={stringify:function(n){for(var o=n.words,d=n.sigBytes,m=[],b=0;b<d;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push((N>>>4).toString(16)),m.push((N&15).toString(16));}return m.join("")},parse:function(n){for(var o=n.length,d=[],m=0;m<o;m+=2)d[m>>>3]|=parseInt(n.substr(m,2),16)<<24-m%8*4;return new p.init(d,o/2)}},h=s.Latin1={stringify:function(n){for(var o=n.words,d=n.sigBytes,m=[],b=0;b<d;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push(String.fromCharCode(N));}return m.join("")},parse:function(n){for(var o=n.length,d=[],m=0;m<o;m++)d[m>>>2]|=(n.charCodeAt(m)&255)<<24-m%4*8;return new p.init(d,o)}},x=s.Utf8={stringify:function(n){try{return decodeURIComponent(escape(h.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return h.parse(unescape(encodeURIComponent(n)))}},T=l.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new p.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=x.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var o,d=this._data,m=d.words,b=d.sigBytes,N=this.blockSize,H=N*4,S=b/H;n?S=i.ceil(S):S=i.max((S|0)-this._minBufferSize,0);var L=S*N,M=i.min(L*4,b);if(L){for(var F=0;F<L;F+=N)this._doProcessBlock(m,F);o=m.splice(0,L),d.sigBytes-=M;}return new p.init(o,M)},clone:function(){var n=u.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});l.Hasher=T.extend({cfg:u.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){T.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(n){return function(o,d){return new n.init(d).finalize(o)}},_createHmacHelper:function(n){return function(o,d){return new V.HMAC.init(n,d).finalize(o)}}});var V=g.algo={};return g}(Math);return t});});var Y=K((I,q)=>{(function(t,i){typeof I=="object"?q.exports=I=i(X()):typeof define=="function"&&define.amd?define(["./core"],i):i(t.CryptoJS);})(I,function(t){return function(){var i=t,e=i.lib,r=e.WordArray,a=e.Hasher,f=i.algo,g=[],l=f.SHA1=a.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(u,p){for(var s=this._hash.words,y=s[0],h=s[1],x=s[2],T=s[3],w=s[4],V=0;V<80;V++){if(V<16)g[V]=u[p+V]|0;else {var n=g[V-3]^g[V-8]^g[V-14]^g[V-16];g[V]=n<<1|n>>>31;}var o=(y<<5|y>>>27)+w+g[V];V<20?o+=(h&x|~h&T)+1518500249:V<40?o+=(h^x^T)+1859775393:V<60?o+=(h&x|h&T|x&T)-1894007588:o+=(h^x^T)-899497514,w=T,T=x,x=h<<30|h>>>2,h=y,y=o;}s[0]=s[0]+y|0,s[1]=s[1]+h|0,s[2]=s[2]+x|0,s[3]=s[3]+T|0,s[4]=s[4]+w|0;},_doFinalize:function(){var u=this._data,p=u.words,s=this._nDataBytes*8,y=u.sigBytes*8;return p[y>>>5]|=128<<24-y%32,p[(y+64>>>9<<4)+14]=Math.floor(s/4294967296),p[(y+64>>>9<<4)+15]=s,u.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var u=a.clone.call(this);return u._hash=this._hash.clone(),u}});i.SHA1=a._createHelper(l),i.HmacSHA1=a._createHmacHelper(l);}(),t.SHA1});});var fe=he(Y());var E="___param___";var P=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,r){let a=r.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(f=>{i[f]===void 0&&(a==="empty_string"?i[f]="":a==="copy_key"&&(t._beforeToTranslate?i[f]=t._beforeToTranslate(f):i[f]=f));});}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(r=>{t.getConditionalsThenElse(r,e);});else if(i.elements.type==="ifelse"){let r=[];t.getConditionalsThenElse(i.elements,r),r.forEach(a=>{e.push(...a);});}else if(i.elements.type==="stepswitch"){let r=[];t.getConditionalsThenElse(i.elements,r),r.forEach(a=>{e.push(...a);});}else t.getConditionalsThenElse(i.elements,e);}else i.type==="resulttocombine"?(i.firstItem&&t.getConditionalsThenElse(i.firstItem,e),i.secondConditionalItem&&i.secondConditionalItem.forEach(r=>{t.getConditionalsThenElse(r,e);})):e.push(i);else i&&e.push(i);return e}static generateJsonTranslation(i,e={},r={}){return i.forEach(a=>{if(a.choices){let f=[];Array.isArray(a.choices)?f=[a.choices]:f=t.getConditionalsThenElse(a.choices),f.forEach(g=>g.forEach(l=>{if("type"in l){let u=[];l.type==="ifelse"||l.type==="stepswitch"?t.getConditionalsThenElse(l,u):u=[l],u.map(s=>t.getConditionalsThenElse(s.text)).forEach(s=>{Array.isArray(s)&&s.forEach(y=>{Array.isArray(y)?y.forEach(h=>{typeof h=="string"?t.addKey(e,h,r):t.getConditionalsThenElse(h).forEach(x=>{Array.isArray(x)?x.forEach(T=>{typeof T=="string"&&t.addKey(e,T,r);}):typeof x=="string"&&t.addKey(e,x,r);});}):typeof y=="string"&&t.addKey(e,y,r);});});}}));}if(a.dialogue){let f=[];Array.isArray(a.dialogue)?f=[a.dialogue]:f=t.getConditionalsThenElse(a.dialogue),f.forEach(g=>{typeof g=="string"?t.addKey(e,g,r):"text"in g&&Array.isArray(g.text)&&g.text.forEach(l=>{typeof l=="string"?t.addKey(e,l,r):t.getConditionalsThenElse(l).forEach(p=>{typeof p=="string"?t.addKey(e,p,r):Array.isArray(p)&&p.forEach(s=>{typeof s=="string"?t.addKey(e,s,r):t.getConditionalsThenElse(s).forEach(y=>{typeof y=="string"&&t.addKey(e,y,r);});});});});});}a.conditionalStep&&t.getConditionalsThenElse(a.conditionalStep).forEach(g=>{Array.isArray(g)?t.generateJsonTranslation(g,e,r):t.generateJsonTranslation([g],e,r);});}),e}};var R=P;function Te(t,i){return Math.floor(Math.random()*(i-t+1)+t)}function xe(t){if(Array.isArray(t)||!t)return t;if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"resulttocombine":return be(t);case"ifelse":return c(t.condition)?c(t.then):c(t.else);case"stepswitch":let e=c(t.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(t.choiceType){case"random":let r=Te(0,e.length-1);return c(e[r]);case"loop":let a=NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return a>e.length-1&&(a=a%e.length),c(e[a]);case"sequential":let f,g=NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return t.end=="lastItem"&&(f=c(e[e.length-1])),g>e.length-1?f:c(e[g]);case"sequentialrandom":let l=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:t.nestedId,onceOnly:!0});if(l==null&&t.end=="lastItem"){let u=NarrationManagerStatic.getCurrentStepTimesCounterData(t.nestedId);if(!u||!u?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let p=u.usedRandomNumbers[`0-${e.length-1}`];return c(e[p[p.length-1]])}if(l==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return c(e[l])}}return t}function G(t){if(t.conditionalStep){let i=createExportableElement(c(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 G(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 be(t){let i=t.firstItem,e=[];t.secondConditionalItem?.forEach(a=>{if(Array.isArray(a))a.forEach(f=>{let g=c(f);e.push(g);});else {let f=c(a);e.push(f);}});let r=i?[i,...e]:e;if(r.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return R.t(r).join("");if(typeof r[0]=="object"){let a=r,f,g=a.map((n,o)=>{n=G(n);let d=c(n.dialogue)||"";return o===0?(f=c(n.glueEnabled)||!1,d):(typeof d=="object"&&"text"in d&&(d=d.character+": "+d.text),f===!1&&(d=`
2
2
 
3
- `+u),s=f(r.glueEnabled)||!1,u)}),y=f(c[0]),d=typeof y=="object"&&"character"in y?y.character:void 0,p=c.map(r=>{let o;r&&typeof r=="object"&&"text"in r?o=r.text:o=r;let u;return Array.isArray(o)?u=o.map(m=>{let b=f(m);return R.t(`${b}`)}).join(""):u=f(o)||"",R.t(u)}).join(""),l=a.find(r=>r.end),g=a.find(r=>r.choices),h=!1,x=!1;a.length>0&&(a[0].glueEnabled&&a[0].goNextStep&&a[0].dialogue===void 0&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),h=a[a.length-1].glueEnabled,x=a.reverse().find(r=>!(r.operations&&(!r.dialogue||!r.choices)))?.goNextStep);let T=a.find(r=>r.labelToOpen),C=[];return a.forEach(r=>{r.operations&&C.forEach(o=>{C.push(o);});}),{dialogue:d?{character:d,text:p}:p,end:l?.end,choices:g?.choices,glueEnabled:h,goNextStep:x,labelToOpen:T?.labelToOpen,operations:C}}}function me(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=f(i.leftValue),e=f(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 !!f(i.value);case"union":return xe(i)}return !!i}function Te(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 f(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 xe(i){if(i.unionType==="not")return !f(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=f(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function Z(i){let t=f(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=f(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 n=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];n&&n.length-1>=i.key&&(n[i.key]=e),storage.setTempVariable(`${E}${narration.openedLabels.length-1}`,n);break}}function f(i){let t=ye(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return Te(t);case"arithmetic":case"arithmeticsingle":return be(t);case"compare":case"valueCondition":case"union":return me(t)}return t}function be(i){let t=f(i.leftValue);switch(i.type){case"arithmetic":let e=f(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 L(i,t){let e=f(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}case"image":switch(e.operationType){case"show":let n=new CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,n,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,n,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,n),await n.load();break;case"edit":let a=canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":let n=new CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,n,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,n,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,n),await n.load();break;case"edit":let a=canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":canvas.remove(e.alias);break;case"pause":let s=canvas.find(e.alias);s?s.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let c=canvas.find(e.alias);c?c.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":Z(e);break;case"oprationtoconvert":if(t){let n="";e.values.forEach(s=>{if(typeof s=="string")n+=s;else {let c=f(s);n+=`${c}`;}});let a=await t(n);a&&await L(a,t);}break;case"input":switch(e.operationType){case"request":narration.requestInput({type:e.valueType});break}break}}var _=class extends LabelAbstract{constructor(t,e,n,a={}){super(t,n),this._steps=e,this.operationStringConvert=a.operationStringConvert,this.skipEmptyDialogs=a.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 n=[];t.forEach(a=>{if(typeof a=="string")n.push(a);else if(a&&typeof a=="object"){let s=f(a);s?(s&&!Array.isArray(s)&&typeof s=="object"&&(s=f(s)||""),Array.isArray(s)?n=n.concat(s):n.push(`${s}`)):n.push(`${a}`);}}),e=n;}else {let n=f(t)||"";n&&!Array.isArray(n)&&typeof n=="object"&&(n=f(n)||""),e=n;}return `${e}`}getDialogue(t){let e=f(t);if(e)return typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:P.t(this.getDialogueText(e.text))}:P.t(this.getDialogueText(e));if(e!=null)return `${e}`}getChoices(t){return f(t)?.map(a=>f(a)).filter(a=>a!==void 0)}stepConverter(t){return async e=>{if(typeof t=="function"&&(t=t()),t=G(t),t.operations)for(let p of t.operations)await L(p,this.operationStringConvert?l=>this.operationStringConvert(l,e):void 0);let n=this.getChoices(t.choices),a=f(t.glueEnabled),s=this.getDialogue(t.dialogue),c=[];t.labelToOpen&&(Array.isArray(t.labelToOpen)||(t.labelToOpen=[t.labelToOpen]),t.labelToOpen.forEach(p=>{let l=f(p);l&&c.push(l);}));let y=f(t.goNextStep),d=f(t.end);if(n){let p=n.map(l=>{let g="";if(Array.isArray(l.text)){let h=[];l.text.forEach(x=>{if(typeof x=="string")h.push(P.t(x));else if(x&&typeof x=="object"){let T=f(x);T&&!Array.isArray(T)&&typeof T=="object"&&(T=f(T)||""),T&&(Array.isArray(T)?h=h.concat(P.t(T)):h.push(P.t(T)));}}),g=h.join();}else typeof l.text=="string"&&(g=P.t(l.text));return new ChoiceMenuOption(g,l.label,l.props,{type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect})});narration.choiceMenuOptions=p;}else narration.choiceMenuOptions=void 0;s!==void 0&&(narration.dialogue=s,this.skipEmptyDialogs&&typeof s=="string"&&(s===""||RegExp(/^\s+$/).test(s))&&(y=!0)),a?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):a===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let p of c){let l=p.label;typeof l=="object"&&(l=f(l)||"");let g=p.params?.map(h=>f(h));e={...e,...p.props},p.type==="jump"?(narration.closeCurrentLabel(),storage.setTempVariable(`${E}${narration.openedLabels.length}`,g),await narration.callLabel(l,e)):(storage.setTempVariable(`${E}${narration.openedLabels.length}`,g),await narration.callLabel(l,e));}d==="game_end"?(narration.closeAllLabels(),await narration.goNext(e)):d==="label_end"&&narration.closeCurrentLabel(),y&&await narration.goNext(e);}}};function nt(i,t={}){let e=t?.operationStringConvert;try{typeof i=="string"&&(i=JSON.parse(i));}catch(n){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON",n);return}if(typeof i!="object"){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON: data is not an object");return}if(i.initialOperations){for(let n of i.initialOperations)L(n,e?a=>e(a,{}):void 0);StorageManagerStatic.saveStorageAsBasicStorage();}if(i.labels){let n=i.labels;for(let a in n)try{let s=n[a],c=new _(a,s,void 0,t);saveLabel(c);}catch(s){console.error(`[Pixi\u2019VN Json] Error creating JSON label ${a}`,s);}}}export{nt as importPixiVNJson};
3
+ `+d),f=c(n.glueEnabled)||!1,d)}),l=c(g[0]),u=typeof l=="object"&&"character"in l?l.character:void 0,p=g.map(n=>{let o;n&&typeof n=="object"&&"text"in n?o=n.text:o=n;let d;return Array.isArray(o)?d=o.map(m=>{let b=c(m);return R.t(`${b}`)}).join(""):d=c(o)||"",R.t(d)}).join(""),s=a.find(n=>n.end),y=a.find(n=>n.choices),h=!1,x=!1;a.length>0&&(a[0].glueEnabled&&a[0].goNextStep&&a[0].dialogue===void 0&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),h=a[a.length-1].glueEnabled,x=a.reverse().find(n=>!(n.operations&&(!n.dialogue||!n.choices)))?.goNextStep);let T=a.find(n=>n.labelToOpen),w=[];return a.forEach(n=>{n.operations&&w.forEach(o=>{w.push(o);});}),{dialogue:u?{character:u,text:p}:p,end:s?.end,choices:y?.choices,glueEnabled:h,goNextStep:x,labelToOpen:T?.labelToOpen,operations:w}}}function Ve(t){if(!t)return !1;if(typeof t!="object"||!("type"in t))return !!t;switch(t.type){case"compare":let i=c(t.leftValue),e=c(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 !!c(t.value);case"union":return Pe(t)}return !!t}function Ne(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 c(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 Pe(t){if(t.unionType==="not")return !c(t.condition);let i=t.unionType==="and";for(let e=0;e<t.conditions.length;e++)if(i=c(t.conditions[e])||!1,t.unionType==="and"){if(!i)return !1}else if(i)return !0;return i}function Q(t){let i=c(t.value),e;switch(i&&typeof i=="object"&&"type"in i?e=c(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 r=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];r&&r.length-1>=t.key&&(r[t.key]=e),storage.setTempVariable(`${E}${narration.openedLabels.length-1}`,r);break}}function c(t){let i=xe(t);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"value":return Ne(i);case"arithmetic":case"arithmeticsingle":return Je(i);case"compare":case"valueCondition":case"union":return Ve(i)}return i}function Je(t){let i=c(t.leftValue);switch(t.type){case"arithmetic":let e=c(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 _(t,i){let e=c(t);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 l=new CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await showWithFadeTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"dissolve":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await showWithDissolveTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,l,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,l,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,l),await l.load();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":if(e.transition)switch(e.transition.type){case"fade":removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":let l=new CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await showWithFadeTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"dissolve":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await showWithDissolveTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,l,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,l,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,l),await l.load();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":if(e.transition)switch(e.transition.type){case"fade":removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);break;case"pause":let p=canvas.find(e.alias);p?p.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let s=canvas.find(e.alias);s?s.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":Q(e);break;case"oprationtoconvert":if(i){let l="";e.values.forEach(p=>{if(typeof p=="string")l+=p;else {let s=c(p);l+=`${s}`;}});let u=await i(l);u&&await _(u,i);}break;case"input":switch(e.operationType){case"request":narration.requestInput({type:e.valueType});break}break;case"fade":let r=new FadeAlphaTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,r);break;case"move":let a=new MoveTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,a);break;case"rotate":let f=new RotateTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,f);break;case"zoom":let g=new ZoomTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,g);break;case"shake":await shakeEffect(e.alias,e.props,e.priority);break}}var O=class extends LabelAbstract{constructor(i,e,r,a={}){super(i,r),this._steps=e,this.operationStringConvert=a.operationStringConvert,this.skipEmptyDialogs=a.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, fe.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(i){let e="";if(Array.isArray(i)){let r=[];i.forEach(a=>{if(typeof a=="string")r.push(a);else if(a&&typeof a=="object"){let f=c(a);f?(f&&!Array.isArray(f)&&typeof f=="object"&&(f=c(f)||""),Array.isArray(f)?r=r.concat(f):r.push(`${f}`)):r.push(`${a}`);}}),e=r;}else {let r=c(i)||"";r&&!Array.isArray(r)&&typeof r=="object"&&(r=c(r)||""),e=r;}return `${e}`}getDialogue(i){let e=c(i);if(e)return typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:P.t(this.getDialogueText(e.text))}:P.t(this.getDialogueText(e));if(e!=null)return `${e}`}getChoices(i){return c(i)?.map(a=>c(a)).filter(a=>a!==void 0)}stepConverter(i){return async e=>{if(typeof i=="function"&&(i=i()),i=G(i),i.operations)for(let p of i.operations)await _(p,this.operationStringConvert?s=>this.operationStringConvert(s,e):void 0);let r=this.getChoices(i.choices),a=c(i.glueEnabled),f=this.getDialogue(i.dialogue),g=[];i.labelToOpen&&(Array.isArray(i.labelToOpen)||(i.labelToOpen=[i.labelToOpen]),i.labelToOpen.forEach(p=>{let s=c(p);s&&g.push(s);}));let l=c(i.goNextStep),u=c(i.end);if(r){let p=r.map(s=>{let y="";if(Array.isArray(s.text)){let h=[];s.text.forEach(x=>{if(typeof x=="string")h.push(P.t(x));else if(x&&typeof x=="object"){let T=c(x);T&&!Array.isArray(T)&&typeof T=="object"&&(T=c(T)||""),T&&(Array.isArray(T)?h=h.concat(P.t(T)):h.push(P.t(T)));}}),y=h.join();}else typeof s.text=="string"&&(y=P.t(s.text));return new ChoiceMenuOption(y,s.label,s.props,{type:s.type,oneTime:s.oneTime,onlyHaveNoChoice:s.onlyHaveNoChoice,autoSelect:s.autoSelect})});narration.choiceMenuOptions=p;}else narration.choiceMenuOptions=void 0;f!==void 0&&(narration.dialogue=f,this.skipEmptyDialogs&&typeof f=="string"&&(f===""||RegExp(/^\s+$/).test(f))&&(l=!0)),a?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):a===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let p of g){let s=p.label;typeof s=="object"&&(s=c(s)||"");let y=p.params?.map(h=>c(h));e={...e,...p.props},p.type==="jump"?(narration.closeCurrentLabel(),storage.setTempVariable(`${E}${narration.openedLabels.length}`,y),await narration.callLabel(s,e)):(storage.setTempVariable(`${E}${narration.openedLabels.length}`,y),await narration.callLabel(s,e));}u==="game_end"?(narration.closeAllLabels(),await narration.goNext(e)):u==="label_end"&&narration.closeCurrentLabel(),l&&await narration.goNext(e);}}};function ui(t,i={}){let e=i?.operationStringConvert;try{typeof t=="string"&&(t=JSON.parse(t));}catch(r){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON",r);return}if(typeof t!="object"){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON: data is not an object");return}if(t.initialOperations){for(let r of t.initialOperations)_(r,e?a=>e(a,{}):void 0);StorageManagerStatic.saveStorageAsBasicStorage();}if(t.labels){let r=t.labels;for(let a in r)try{let f=r[a],g=new O(a,f,void 0,i);saveLabel(g);}catch(f){console.error(`[Pixi\u2019VN Json] Error creating JSON label ${a}`,f);}}}export{ui as importPixiVNJson};
@@ -1,3 +1,3 @@
1
- 'use strict';var pixiVn=require('@drincs/pixi-vn');var oe=Object.create;var K=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,ce=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 U=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ue=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of le(t))!ce.call(i,a)&&a!==e&&K(i,a,{get:()=>t[a],enumerable:!(n=se(t,a))||n.enumerable});return i};var pe=(i,t,e)=>(e=i!=null?oe(fe(i)):{},ue(K(e,"default",{value:i,enumerable:!0}),i));var q=U((D,X)=>{(function(i,t){typeof D=="object"?X.exports=D=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(D,function(){var i=i||function(t,e){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof W=="function")try{n=W("crypto");}catch{}var a=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function r(){}return function(o){var u;return r.prototype=o,u=new r,r.prototype=null,u}}(),c={},y=c.lib={},d=y.Base=function(){return {extend:function(r){var o=s(this);return r&&o.mixIn(r),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var r=this.extend();return r.init.apply(r,arguments),r},init:function(){},mixIn:function(r){for(var o in r)r.hasOwnProperty(o)&&(this[o]=r[o]);r.hasOwnProperty("toString")&&(this.toString=r.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),p=y.WordArray=d.extend({init:function(r,o){r=this.words=r||[],o!=e?this.sigBytes=o:this.sigBytes=r.length*4;},toString:function(r){return (r||g).stringify(this)},concat:function(r){var o=this.words,u=r.words,m=this.sigBytes,b=r.sigBytes;if(this.clamp(),m%4)for(var N=0;N<b;N++){var H=u[N>>>2]>>>24-N%4*8&255;o[m+N>>>2]|=H<<24-(m+N)%4*8;}else for(var S=0;S<b;S+=4)o[m+S>>>2]=u[S>>>2];return this.sigBytes+=b,this},clamp:function(){var r=this.words,o=this.sigBytes;r[o>>>2]&=4294967295<<32-o%4*8,r.length=t.ceil(o/4);},clone:function(){var r=d.clone.call(this);return r.words=this.words.slice(0),r},random:function(r){for(var o=[],u=0;u<r;u+=4)o.push(a());return new p.init(o,r)}}),l=c.enc={},g=l.Hex={stringify:function(r){for(var o=r.words,u=r.sigBytes,m=[],b=0;b<u;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push((N>>>4).toString(16)),m.push((N&15).toString(16));}return m.join("")},parse:function(r){for(var o=r.length,u=[],m=0;m<o;m+=2)u[m>>>3]|=parseInt(r.substr(m,2),16)<<24-m%8*4;return new p.init(u,o/2)}},h=l.Latin1={stringify:function(r){for(var o=r.words,u=r.sigBytes,m=[],b=0;b<u;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push(String.fromCharCode(N));}return m.join("")},parse:function(r){for(var o=r.length,u=[],m=0;m<o;m++)u[m>>>2]|=(r.charCodeAt(m)&255)<<24-m%4*8;return new p.init(u,o)}},T=l.Utf8={stringify:function(r){try{return decodeURIComponent(escape(h.stringify(r)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(r){return h.parse(unescape(encodeURIComponent(r)))}},x=y.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new p.init,this._nDataBytes=0;},_append:function(r){typeof r=="string"&&(r=T.parse(r)),this._data.concat(r),this._nDataBytes+=r.sigBytes;},_process:function(r){var o,u=this._data,m=u.words,b=u.sigBytes,N=this.blockSize,H=N*4,S=b/H;r?S=t.ceil(S):S=t.max((S|0)-this._minBufferSize,0);var k=S*N,M=t.min(k*4,b);if(k){for(var F=0;F<k;F+=N)this._doProcessBlock(m,F);o=m.splice(0,k),u.sigBytes-=M;}return new p.init(o,M)},clone:function(){var r=d.clone.call(this);return r._data=this._data.clone(),r},_minBufferSize:0});y.Hasher=x.extend({cfg:d.extend(),init:function(r){this.cfg=this.cfg.extend(r),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(r){return this._append(r),this._process(),this},finalize:function(r){r&&this._append(r);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(r){return function(o,u){return new r.init(u).finalize(o)}},_createHmacHelper:function(r){return function(o,u){return new V.HMAC.init(r,u).finalize(o)}}});var V=c.algo={};return c}(Math);return i});});var Q=U((I,Y)=>{(function(i,t){typeof I=="object"?Y.exports=I=t(q()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(I,function(i){return function(){var t=i,e=t.lib,n=e.WordArray,a=e.Hasher,s=t.algo,c=[],y=s.SHA1=a.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,p){for(var l=this._hash.words,g=l[0],h=l[1],T=l[2],x=l[3],C=l[4],V=0;V<80;V++){if(V<16)c[V]=d[p+V]|0;else {var r=c[V-3]^c[V-8]^c[V-14]^c[V-16];c[V]=r<<1|r>>>31;}var o=(g<<5|g>>>27)+C+c[V];V<20?o+=(h&T|~h&x)+1518500249:V<40?o+=(h^T^x)+1859775393:V<60?o+=(h&T|h&x|T&x)-1894007588:o+=(h^T^x)-899497514,C=x,x=T,T=h<<30|h>>>2,h=g,g=o;}l[0]=l[0]+g|0,l[1]=l[1]+h|0,l[2]=l[2]+T|0,l[3]=l[3]+x|0,l[4]=l[4]+C|0;},_doFinalize:function(){var d=this._data,p=d.words,l=this._nDataBytes*8,g=d.sigBytes*8;return p[g>>>5]|=128<<24-g%32,p[(g+64>>>9<<4)+14]=Math.floor(l/4294967296),p[(g+64>>>9<<4)+15]=l,d.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});t.SHA1=a._createHelper(y),t.HmacSHA1=a._createHmacHelper(y);}(),i.SHA1});});var ae=pe(Q());var E="___param___";var P=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,n){let a=n.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(s=>{t[s]===void 0&&(a==="empty_string"?t[s]="":a==="copy_key"&&(i._beforeToTranslate?t[s]=i._beforeToTranslate(s):t[s]=s));});}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(n=>{i.getConditionalsThenElse(n,e);});else if(t.elements.type==="ifelse"){let n=[];i.getConditionalsThenElse(t.elements,n),n.forEach(a=>{e.push(...a);});}else if(t.elements.type==="stepswitch"){let n=[];i.getConditionalsThenElse(t.elements,n),n.forEach(a=>{e.push(...a);});}else i.getConditionalsThenElse(t.elements,e);}else t.type==="resulttocombine"?(t.firstItem&&i.getConditionalsThenElse(t.firstItem,e),t.secondConditionalItem&&t.secondConditionalItem.forEach(n=>{i.getConditionalsThenElse(n,e);})):e.push(t);else t&&e.push(t);return e}static generateJsonTranslation(t,e={},n={}){return t.forEach(a=>{if(a.choices){let s=[];Array.isArray(a.choices)?s=[a.choices]:s=i.getConditionalsThenElse(a.choices),s.forEach(c=>c.forEach(y=>{if("type"in y){let d=[];y.type==="ifelse"||y.type==="stepswitch"?i.getConditionalsThenElse(y,d):d=[y],d.map(l=>i.getConditionalsThenElse(l.text)).forEach(l=>{Array.isArray(l)&&l.forEach(g=>{Array.isArray(g)?g.forEach(h=>{typeof h=="string"?i.addKey(e,h,n):i.getConditionalsThenElse(h).forEach(T=>{Array.isArray(T)?T.forEach(x=>{typeof x=="string"&&i.addKey(e,x,n);}):typeof T=="string"&&i.addKey(e,T,n);});}):typeof g=="string"&&i.addKey(e,g,n);});});}}));}if(a.dialogue){let s=[];Array.isArray(a.dialogue)?s=[a.dialogue]:s=i.getConditionalsThenElse(a.dialogue),s.forEach(c=>{typeof c=="string"?i.addKey(e,c,n):"text"in c&&Array.isArray(c.text)&&c.text.forEach(y=>{typeof y=="string"?i.addKey(e,y,n):i.getConditionalsThenElse(y).forEach(p=>{typeof p=="string"?i.addKey(e,p,n):Array.isArray(p)&&p.forEach(l=>{typeof l=="string"?i.addKey(e,l,n):i.getConditionalsThenElse(l).forEach(g=>{typeof g=="string"&&i.addKey(e,g,n);});});});});});}a.conditionalStep&&i.getConditionalsThenElse(a.conditionalStep).forEach(c=>{Array.isArray(c)?i.generateJsonTranslation(c,e,n):i.generateJsonTranslation([c],e,n);});}),e}};var R=P;function ge(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function ye(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 f(i.condition)?f(i.then):f(i.else);case"stepswitch":let e=f(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let n=ge(0,e.length-1);return f(e[n]);case"loop":let a=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return a>e.length-1&&(a=a%e.length),f(e[a]);case"sequential":let s,c=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(s=f(e[e.length-1])),c>e.length-1?s:f(e[c]);case"sequentialrandom":let y=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(y==null&&i.end=="lastItem"){let d=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!d||!d?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let p=d.usedRandomNumbers[`0-${e.length-1}`];return f(e[p[p.length-1]])}if(y==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return f(e[y])}}return i}function G(i){if(i.conditionalStep){let t=pixiVn.createExportableElement(f(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 G(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(a=>{if(Array.isArray(a))a.forEach(s=>{let c=f(s);e.push(c);});else {let s=f(a);e.push(s);}});let n=t?[t,...e]:e;if(n.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof n[0]=="string")return R.t(n).join("");if(typeof n[0]=="object"){let a=n,s,c=a.map((r,o)=>{r=G(r);let u=f(r.dialogue)||"";return o===0?(s=f(r.glueEnabled)||!1,u):(typeof u=="object"&&"text"in u&&(u=u.character+": "+u.text),s===!1&&(u=`
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn');var ce=Object.create;var K=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty;var z=(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 U=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports);var ye=(t,i,e,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of ue(i))!ge.call(t,a)&&a!==e&&K(t,a,{get:()=>i[a],enumerable:!(r=pe(i,a))||r.enumerable});return t};var he=(t,i,e)=>(e=t!=null?ce(de(t)):{},ye(K(e,"default",{value:t,enumerable:!0}),t));var q=U((D,X)=>{(function(t,i){typeof D=="object"?X.exports=D=i():typeof define=="function"&&define.amd?define([],i):t.CryptoJS=i();})(D,function(){var t=t||function(i,e){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof z=="function")try{r=z("crypto");}catch{}var a=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.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(o){var d;return n.prototype=o,d=new n,n.prototype=null,d}}(),g={},l=g.lib={},u=l.Base=function(){return {extend:function(n){var o=f(this);return n&&o.mixIn(n),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var o in n)n.hasOwnProperty(o)&&(this[o]=n[o]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),p=l.WordArray=u.extend({init:function(n,o){n=this.words=n||[],o!=e?this.sigBytes=o:this.sigBytes=n.length*4;},toString:function(n){return (n||y).stringify(this)},concat:function(n){var o=this.words,d=n.words,m=this.sigBytes,b=n.sigBytes;if(this.clamp(),m%4)for(var N=0;N<b;N++){var H=d[N>>>2]>>>24-N%4*8&255;o[m+N>>>2]|=H<<24-(m+N)%4*8;}else for(var S=0;S<b;S+=4)o[m+S>>>2]=d[S>>>2];return this.sigBytes+=b,this},clamp:function(){var n=this.words,o=this.sigBytes;n[o>>>2]&=4294967295<<32-o%4*8,n.length=i.ceil(o/4);},clone:function(){var n=u.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var o=[],d=0;d<n;d+=4)o.push(a());return new p.init(o,n)}}),s=g.enc={},y=s.Hex={stringify:function(n){for(var o=n.words,d=n.sigBytes,m=[],b=0;b<d;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push((N>>>4).toString(16)),m.push((N&15).toString(16));}return m.join("")},parse:function(n){for(var o=n.length,d=[],m=0;m<o;m+=2)d[m>>>3]|=parseInt(n.substr(m,2),16)<<24-m%8*4;return new p.init(d,o/2)}},h=s.Latin1={stringify:function(n){for(var o=n.words,d=n.sigBytes,m=[],b=0;b<d;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push(String.fromCharCode(N));}return m.join("")},parse:function(n){for(var o=n.length,d=[],m=0;m<o;m++)d[m>>>2]|=(n.charCodeAt(m)&255)<<24-m%4*8;return new p.init(d,o)}},x=s.Utf8={stringify:function(n){try{return decodeURIComponent(escape(h.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return h.parse(unescape(encodeURIComponent(n)))}},T=l.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new p.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=x.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var o,d=this._data,m=d.words,b=d.sigBytes,N=this.blockSize,H=N*4,S=b/H;n?S=i.ceil(S):S=i.max((S|0)-this._minBufferSize,0);var L=S*N,j=i.min(L*4,b);if(L){for(var F=0;F<L;F+=N)this._doProcessBlock(m,F);o=m.splice(0,L),d.sigBytes-=j;}return new p.init(o,j)},clone:function(){var n=u.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});l.Hasher=T.extend({cfg:u.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){T.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(n){return function(o,d){return new n.init(d).finalize(o)}},_createHmacHelper:function(n){return function(o,d){return new V.HMAC.init(n,d).finalize(o)}}});var V=g.algo={};return g}(Math);return t});});var Z=U((I,Y)=>{(function(t,i){typeof I=="object"?Y.exports=I=i(q()):typeof define=="function"&&define.amd?define(["./core"],i):i(t.CryptoJS);})(I,function(t){return function(){var i=t,e=i.lib,r=e.WordArray,a=e.Hasher,f=i.algo,g=[],l=f.SHA1=a.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(u,p){for(var s=this._hash.words,y=s[0],h=s[1],x=s[2],T=s[3],w=s[4],V=0;V<80;V++){if(V<16)g[V]=u[p+V]|0;else {var n=g[V-3]^g[V-8]^g[V-14]^g[V-16];g[V]=n<<1|n>>>31;}var o=(y<<5|y>>>27)+w+g[V];V<20?o+=(h&x|~h&T)+1518500249:V<40?o+=(h^x^T)+1859775393:V<60?o+=(h&x|h&T|x&T)-1894007588:o+=(h^x^T)-899497514,w=T,T=x,x=h<<30|h>>>2,h=y,y=o;}s[0]=s[0]+y|0,s[1]=s[1]+h|0,s[2]=s[2]+x|0,s[3]=s[3]+T|0,s[4]=s[4]+w|0;},_doFinalize:function(){var u=this._data,p=u.words,s=this._nDataBytes*8,y=u.sigBytes*8;return p[y>>>5]|=128<<24-y%32,p[(y+64>>>9<<4)+14]=Math.floor(s/4294967296),p[(y+64>>>9<<4)+15]=s,u.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var u=a.clone.call(this);return u._hash=this._hash.clone(),u}});i.SHA1=a._createHelper(l),i.HmacSHA1=a._createHmacHelper(l);}(),t.SHA1});});var fe=he(Z());var E="___param___";var P=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,r){let a=r.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(f=>{i[f]===void 0&&(a==="empty_string"?i[f]="":a==="copy_key"&&(t._beforeToTranslate?i[f]=t._beforeToTranslate(f):i[f]=f));});}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(r=>{t.getConditionalsThenElse(r,e);});else if(i.elements.type==="ifelse"){let r=[];t.getConditionalsThenElse(i.elements,r),r.forEach(a=>{e.push(...a);});}else if(i.elements.type==="stepswitch"){let r=[];t.getConditionalsThenElse(i.elements,r),r.forEach(a=>{e.push(...a);});}else t.getConditionalsThenElse(i.elements,e);}else i.type==="resulttocombine"?(i.firstItem&&t.getConditionalsThenElse(i.firstItem,e),i.secondConditionalItem&&i.secondConditionalItem.forEach(r=>{t.getConditionalsThenElse(r,e);})):e.push(i);else i&&e.push(i);return e}static generateJsonTranslation(i,e={},r={}){return i.forEach(a=>{if(a.choices){let f=[];Array.isArray(a.choices)?f=[a.choices]:f=t.getConditionalsThenElse(a.choices),f.forEach(g=>g.forEach(l=>{if("type"in l){let u=[];l.type==="ifelse"||l.type==="stepswitch"?t.getConditionalsThenElse(l,u):u=[l],u.map(s=>t.getConditionalsThenElse(s.text)).forEach(s=>{Array.isArray(s)&&s.forEach(y=>{Array.isArray(y)?y.forEach(h=>{typeof h=="string"?t.addKey(e,h,r):t.getConditionalsThenElse(h).forEach(x=>{Array.isArray(x)?x.forEach(T=>{typeof T=="string"&&t.addKey(e,T,r);}):typeof x=="string"&&t.addKey(e,x,r);});}):typeof y=="string"&&t.addKey(e,y,r);});});}}));}if(a.dialogue){let f=[];Array.isArray(a.dialogue)?f=[a.dialogue]:f=t.getConditionalsThenElse(a.dialogue),f.forEach(g=>{typeof g=="string"?t.addKey(e,g,r):"text"in g&&Array.isArray(g.text)&&g.text.forEach(l=>{typeof l=="string"?t.addKey(e,l,r):t.getConditionalsThenElse(l).forEach(p=>{typeof p=="string"?t.addKey(e,p,r):Array.isArray(p)&&p.forEach(s=>{typeof s=="string"?t.addKey(e,s,r):t.getConditionalsThenElse(s).forEach(y=>{typeof y=="string"&&t.addKey(e,y,r);});});});});});}a.conditionalStep&&t.getConditionalsThenElse(a.conditionalStep).forEach(g=>{Array.isArray(g)?t.generateJsonTranslation(g,e,r):t.generateJsonTranslation([g],e,r);});}),e}};var R=P;function Te(t,i){return Math.floor(Math.random()*(i-t+1)+t)}function xe(t){if(Array.isArray(t)||!t)return t;if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"resulttocombine":return be(t);case"ifelse":return c(t.condition)?c(t.then):c(t.else);case"stepswitch":let e=c(t.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(t.choiceType){case"random":let r=Te(0,e.length-1);return c(e[r]);case"loop":let a=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return a>e.length-1&&(a=a%e.length),c(e[a]);case"sequential":let f,g=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return t.end=="lastItem"&&(f=c(e[e.length-1])),g>e.length-1?f:c(e[g]);case"sequentialrandom":let l=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:t.nestedId,onceOnly:!0});if(l==null&&t.end=="lastItem"){let u=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(t.nestedId);if(!u||!u?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let p=u.usedRandomNumbers[`0-${e.length-1}`];return c(e[p[p.length-1]])}if(l==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return c(e[l])}}return t}function G(t){if(t.conditionalStep){let i=pixiVn.createExportableElement(c(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 G(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 be(t){let i=t.firstItem,e=[];t.secondConditionalItem?.forEach(a=>{if(Array.isArray(a))a.forEach(f=>{let g=c(f);e.push(g);});else {let f=c(a);e.push(f);}});let r=i?[i,...e]:e;if(r.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return R.t(r).join("");if(typeof r[0]=="object"){let a=r,f,g=a.map((n,o)=>{n=G(n);let d=c(n.dialogue)||"";return o===0?(f=c(n.glueEnabled)||!1,d):(typeof d=="object"&&"text"in d&&(d=d.character+": "+d.text),f===!1&&(d=`
2
2
 
3
- `+u),s=f(r.glueEnabled)||!1,u)}),y=f(c[0]),d=typeof y=="object"&&"character"in y?y.character:void 0,p=c.map(r=>{let o;r&&typeof r=="object"&&"text"in r?o=r.text:o=r;let u;return Array.isArray(o)?u=o.map(m=>{let b=f(m);return R.t(`${b}`)}).join(""):u=f(o)||"",R.t(u)}).join(""),l=a.find(r=>r.end),g=a.find(r=>r.choices),h=!1,T=!1;a.length>0&&(a[0].glueEnabled&&a[0].goNextStep&&a[0].dialogue===void 0&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),h=a[a.length-1].glueEnabled,T=a.reverse().find(r=>!(r.operations&&(!r.dialogue||!r.choices)))?.goNextStep);let x=a.find(r=>r.labelToOpen),C=[];return a.forEach(r=>{r.operations&&C.forEach(o=>{C.push(o);});}),{dialogue:d?{character:d,text:p}:p,end:l?.end,choices:g?.choices,glueEnabled:h,goNextStep:T,labelToOpen:x?.labelToOpen,operations:C}}}function me(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=f(i.leftValue),e=f(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 !!f(i.value);case"union":return Te(i)}return !!i}function xe(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 f(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 !f(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=f(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function z(i){let t=f(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=f(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 n=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];n&&n.length-1>=i.key&&(n[i.key]=e),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length-1}`,n);break}}function f(i){let t=ye(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return xe(t);case"arithmetic":case"arithmeticsingle":return be(t);case"compare":case"valueCondition":case"union":return me(t)}return t}function be(i){let t=f(i.leftValue);switch(i.type){case"arithmetic":let e=f(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 L(i,t){let e=f(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}case"image":switch(e.operationType){case"show":let n=new pixiVn.CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,n,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,n,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,n),await n.load();break;case"edit":let a=pixiVn.canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":pixiVn.canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":let n=new pixiVn.CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,n,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,n,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,n),await n.load();break;case"edit":let a=pixiVn.canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":pixiVn.canvas.remove(e.alias);break;case"pause":let s=pixiVn.canvas.find(e.alias);s?s.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let c=pixiVn.canvas.find(e.alias);c?c.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":z(e);break;case"oprationtoconvert":if(t){let n="";e.values.forEach(s=>{if(typeof s=="string")n+=s;else {let c=f(s);n+=`${c}`;}});let a=await t(n);a&&await L(a,t);}break;case"input":switch(e.operationType){case"request":pixiVn.narration.requestInput({type:e.valueType});break}break}}var _=class extends pixiVn.LabelAbstract{constructor(t,e,n,a={}){super(t,n),this._steps=e,this.operationStringConvert=a.operationStringConvert,this.skipEmptyDialogs=a.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 n=[];t.forEach(a=>{if(typeof a=="string")n.push(a);else if(a&&typeof a=="object"){let s=f(a);s?(s&&!Array.isArray(s)&&typeof s=="object"&&(s=f(s)||""),Array.isArray(s)?n=n.concat(s):n.push(`${s}`)):n.push(`${a}`);}}),e=n;}else {let n=f(t)||"";n&&!Array.isArray(n)&&typeof n=="object"&&(n=f(n)||""),e=n;}return `${e}`}getDialogue(t){let e=f(t);if(e)return typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:P.t(this.getDialogueText(e.text))}:P.t(this.getDialogueText(e));if(e!=null)return `${e}`}getChoices(t){return f(t)?.map(a=>f(a)).filter(a=>a!==void 0)}stepConverter(t){return async e=>{if(typeof t=="function"&&(t=t()),t=G(t),t.operations)for(let p of t.operations)await L(p,this.operationStringConvert?l=>this.operationStringConvert(l,e):void 0);let n=this.getChoices(t.choices),a=f(t.glueEnabled),s=this.getDialogue(t.dialogue),c=[];t.labelToOpen&&(Array.isArray(t.labelToOpen)||(t.labelToOpen=[t.labelToOpen]),t.labelToOpen.forEach(p=>{let l=f(p);l&&c.push(l);}));let y=f(t.goNextStep),d=f(t.end);if(n){let p=n.map(l=>{let g="";if(Array.isArray(l.text)){let h=[];l.text.forEach(T=>{if(typeof T=="string")h.push(P.t(T));else if(T&&typeof T=="object"){let x=f(T);x&&!Array.isArray(x)&&typeof x=="object"&&(x=f(x)||""),x&&(Array.isArray(x)?h=h.concat(P.t(x)):h.push(P.t(x)));}}),g=h.join();}else typeof l.text=="string"&&(g=P.t(l.text));return new pixiVn.ChoiceMenuOption(g,l.label,l.props,{type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect})});pixiVn.narration.choiceMenuOptions=p;}else pixiVn.narration.choiceMenuOptions=void 0;s!==void 0&&(pixiVn.narration.dialogue=s,this.skipEmptyDialogs&&typeof s=="string"&&(s===""||RegExp(/^\s+$/).test(s))&&(y=!0)),a?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):a===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let p of c){let l=p.label;typeof l=="object"&&(l=f(l)||"");let g=p.params?.map(h=>f(h));e={...e,...p.props},p.type==="jump"?(pixiVn.narration.closeCurrentLabel(),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,g),await pixiVn.narration.callLabel(l,e)):(pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,g),await pixiVn.narration.callLabel(l,e));}d==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e)):d==="label_end"&&pixiVn.narration.closeCurrentLabel(),y&&await pixiVn.narration.goNext(e);}}};function Ee(i,t={}){let e=t?.operationStringConvert;try{typeof i=="string"&&(i=JSON.parse(i));}catch(n){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON",n);return}if(typeof i!="object"){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON: data is not an object");return}if(i.initialOperations){for(let n of i.initialOperations)L(n,e?a=>e(a,{}):void 0);pixiVn.StorageManagerStatic.saveStorageAsBasicStorage();}if(i.labels){let n=i.labels;for(let a in n)try{let s=n[a],c=new _(a,s,void 0,t);pixiVn.saveLabel(c);}catch(s){console.error(`[Pixi\u2019VN Json] Error creating JSON label ${a}`,s);}}}exports.geLogichValue=f;exports.importPixiVNJson=Ee;exports.setStorageJson=z;
3
+ `+d),f=c(n.glueEnabled)||!1,d)}),l=c(g[0]),u=typeof l=="object"&&"character"in l?l.character:void 0,p=g.map(n=>{let o;n&&typeof n=="object"&&"text"in n?o=n.text:o=n;let d;return Array.isArray(o)?d=o.map(m=>{let b=c(m);return R.t(`${b}`)}).join(""):d=c(o)||"",R.t(d)}).join(""),s=a.find(n=>n.end),y=a.find(n=>n.choices),h=!1,x=!1;a.length>0&&(a[0].glueEnabled&&a[0].goNextStep&&a[0].dialogue===void 0&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),h=a[a.length-1].glueEnabled,x=a.reverse().find(n=>!(n.operations&&(!n.dialogue||!n.choices)))?.goNextStep);let T=a.find(n=>n.labelToOpen),w=[];return a.forEach(n=>{n.operations&&w.forEach(o=>{w.push(o);});}),{dialogue:u?{character:u,text:p}:p,end:s?.end,choices:y?.choices,glueEnabled:h,goNextStep:x,labelToOpen:T?.labelToOpen,operations:w}}}function Ve(t){if(!t)return !1;if(typeof t!="object"||!("type"in t))return !!t;switch(t.type){case"compare":let i=c(t.leftValue),e=c(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 !!c(t.value);case"union":return Pe(t)}return !!t}function Ne(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 c(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 Pe(t){if(t.unionType==="not")return !c(t.condition);let i=t.unionType==="and";for(let e=0;e<t.conditions.length;e++)if(i=c(t.conditions[e])||!1,t.unionType==="and"){if(!i)return !1}else if(i)return !0;return i}function M(t){let i=c(t.value),e;switch(i&&typeof i=="object"&&"type"in i?e=c(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 r=pixiVn.storage.getVariable(`${E}${pixiVn.narration.openedLabels.length-1}`)||[];r&&r.length-1>=t.key&&(r[t.key]=e),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length-1}`,r);break}}function c(t){let i=xe(t);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"value":return Ne(i);case"arithmetic":case"arithmeticsingle":return Je(i);case"compare":case"valueCondition":case"union":return Ve(i)}return i}function Je(t){let i=c(t.leftValue);switch(t.type){case"arithmetic":let e=c(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 _(t,i){let e=c(t);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 l=new pixiVn.CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await pixiVn.showWithFadeTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"dissolve":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await pixiVn.showWithDissolveTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,l,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,l,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,l),await l.load();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":if(e.transition)switch(e.transition.type){case"fade":pixiVn.removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(e.alias,e.transition.props,e.transition.priority);break}else pixiVn.canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":let l=new pixiVn.CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await pixiVn.showWithFadeTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"dissolve":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await pixiVn.showWithDissolveTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,l,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,l,e.transition.props,e.transition.priority);break}else pixiVn.canvas.add(e.alias,l),await l.load();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":if(e.transition)switch(e.transition.type){case"fade":pixiVn.removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":pixiVn.removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":pixiVn.moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":pixiVn.zoomOut(e.alias,e.transition.props,e.transition.priority);break}else pixiVn.canvas.remove(e.alias);break;case"pause":let p=pixiVn.canvas.find(e.alias);p?p.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let s=pixiVn.canvas.find(e.alias);s?s.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":M(e);break;case"oprationtoconvert":if(i){let l="";e.values.forEach(p=>{if(typeof p=="string")l+=p;else {let s=c(p);l+=`${s}`;}});let u=await i(l);u&&await _(u,i);}break;case"input":switch(e.operationType){case"request":pixiVn.narration.requestInput({type:e.valueType});break}break;case"fade":let r=new pixiVn.FadeAlphaTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,r);break;case"move":let a=new pixiVn.MoveTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,a);break;case"rotate":let f=new pixiVn.RotateTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,f);break;case"zoom":let g=new pixiVn.ZoomTicker(e.props,e.duration,e.priority);pixiVn.canvas.addTicker(e.alias,g);break;case"shake":await pixiVn.shakeEffect(e.alias,e.props,e.priority);break}}var O=class extends pixiVn.LabelAbstract{constructor(i,e,r,a={}){super(i,r),this._steps=e,this.operationStringConvert=a.operationStringConvert,this.skipEmptyDialogs=a.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, fe.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(i){let e="";if(Array.isArray(i)){let r=[];i.forEach(a=>{if(typeof a=="string")r.push(a);else if(a&&typeof a=="object"){let f=c(a);f?(f&&!Array.isArray(f)&&typeof f=="object"&&(f=c(f)||""),Array.isArray(f)?r=r.concat(f):r.push(`${f}`)):r.push(`${a}`);}}),e=r;}else {let r=c(i)||"";r&&!Array.isArray(r)&&typeof r=="object"&&(r=c(r)||""),e=r;}return `${e}`}getDialogue(i){let e=c(i);if(e)return typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:P.t(this.getDialogueText(e.text))}:P.t(this.getDialogueText(e));if(e!=null)return `${e}`}getChoices(i){return c(i)?.map(a=>c(a)).filter(a=>a!==void 0)}stepConverter(i){return async e=>{if(typeof i=="function"&&(i=i()),i=G(i),i.operations)for(let p of i.operations)await _(p,this.operationStringConvert?s=>this.operationStringConvert(s,e):void 0);let r=this.getChoices(i.choices),a=c(i.glueEnabled),f=this.getDialogue(i.dialogue),g=[];i.labelToOpen&&(Array.isArray(i.labelToOpen)||(i.labelToOpen=[i.labelToOpen]),i.labelToOpen.forEach(p=>{let s=c(p);s&&g.push(s);}));let l=c(i.goNextStep),u=c(i.end);if(r){let p=r.map(s=>{let y="";if(Array.isArray(s.text)){let h=[];s.text.forEach(x=>{if(typeof x=="string")h.push(P.t(x));else if(x&&typeof x=="object"){let T=c(x);T&&!Array.isArray(T)&&typeof T=="object"&&(T=c(T)||""),T&&(Array.isArray(T)?h=h.concat(P.t(T)):h.push(P.t(T)));}}),y=h.join();}else typeof s.text=="string"&&(y=P.t(s.text));return new pixiVn.ChoiceMenuOption(y,s.label,s.props,{type:s.type,oneTime:s.oneTime,onlyHaveNoChoice:s.onlyHaveNoChoice,autoSelect:s.autoSelect})});pixiVn.narration.choiceMenuOptions=p;}else pixiVn.narration.choiceMenuOptions=void 0;f!==void 0&&(pixiVn.narration.dialogue=f,this.skipEmptyDialogs&&typeof f=="string"&&(f===""||RegExp(/^\s+$/).test(f))&&(l=!0)),a?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):a===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let p of g){let s=p.label;typeof s=="object"&&(s=c(s)||"");let y=p.params?.map(h=>c(h));e={...e,...p.props},p.type==="jump"?(pixiVn.narration.closeCurrentLabel(),pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,y),await pixiVn.narration.callLabel(s,e)):(pixiVn.storage.setTempVariable(`${E}${pixiVn.narration.openedLabels.length}`,y),await pixiVn.narration.callLabel(s,e));}u==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e)):u==="label_end"&&pixiVn.narration.closeCurrentLabel(),l&&await pixiVn.narration.goNext(e);}}};function Be(t,i={}){let e=i?.operationStringConvert;try{typeof t=="string"&&(t=JSON.parse(t));}catch(r){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON",r);return}if(typeof t!="object"){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON: data is not an object");return}if(t.initialOperations){for(let r of t.initialOperations)_(r,e?a=>e(a,{}):void 0);pixiVn.StorageManagerStatic.saveStorageAsBasicStorage();}if(t.labels){let r=t.labels;for(let a in r)try{let f=r[a],g=new O(a,f,void 0,i);pixiVn.saveLabel(g);}catch(f){console.error(`[Pixi\u2019VN Json] Error creating JSON label ${a}`,f);}}}exports.geLogichValue=c;exports.importPixiVNJson=Be;exports.setStorageJson=M;
@@ -6,8 +6,10 @@ import '../interface/PixiVNJsonLabelStep.cjs';
6
6
  import '../PixiVNJsonConditionalStatements-CVkQSKpq.cjs';
7
7
  import '../interface/PixiVNJsonOperations.cjs';
8
8
  import '../interface/PixiVNJsonCanvas.cjs';
9
- import '../interface/PixiVNJsonMediaTransiotions.cjs';
9
+ import '../interface/PixiVNJsonEffect.cjs';
10
10
  import 'pixi.js';
11
+ import '../interface/PixiVNJsonMediaTransiotions.cjs';
12
+ import '../interface/PixiVNJsonTicker.cjs';
11
13
  import '../interface/PixiVNJsonInput.cjs';
12
14
  import '../interface/PixiVNJsonSound.cjs';
13
15
  import '../interface/PixiVNJson.cjs';
@@ -6,8 +6,10 @@ import '../interface/PixiVNJsonLabelStep.js';
6
6
  import '../PixiVNJsonConditionalStatements-CVkQSKpq.js';
7
7
  import '../interface/PixiVNJsonOperations.js';
8
8
  import '../interface/PixiVNJsonCanvas.js';
9
- import '../interface/PixiVNJsonMediaTransiotions.js';
9
+ import '../interface/PixiVNJsonEffect.js';
10
10
  import 'pixi.js';
11
+ import '../interface/PixiVNJsonMediaTransiotions.js';
12
+ import '../interface/PixiVNJsonTicker.js';
11
13
  import '../interface/PixiVNJsonInput.js';
12
14
  import '../interface/PixiVNJsonSound.js';
13
15
  import '../interface/PixiVNJson.js';
@@ -1,3 +1,3 @@
1
- import {storage,narration,setFlag,StorageManagerStatic,saveLabel,NarrationManagerStatic,getFlag,canvas,CanvasVideo,zoomIn,moveIn,showWithDissolveTransition,showWithFadeTransition,CanvasImage,Assets,sound,LabelAbstract,ChoiceMenuOption,createExportableElement}from'@drincs/pixi-vn';var oe=Object.create;var K=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var le=Object.getOwnPropertyNames;var fe=Object.getPrototypeOf,ce=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 U=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ue=(i,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of le(t))!ce.call(i,a)&&a!==e&&K(i,a,{get:()=>t[a],enumerable:!(n=se(t,a))||n.enumerable});return i};var pe=(i,t,e)=>(e=i!=null?oe(fe(i)):{},ue(K(e,"default",{value:i,enumerable:!0}),i));var q=U((D,X)=>{(function(i,t){typeof D=="object"?X.exports=D=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(D,function(){var i=i||function(t,e){var n;if(typeof window<"u"&&window.crypto&&(n=window.crypto),typeof self<"u"&&self.crypto&&(n=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(n=globalThis.crypto),!n&&typeof window<"u"&&window.msCrypto&&(n=window.msCrypto),!n&&typeof global<"u"&&global.crypto&&(n=global.crypto),!n&&typeof W=="function")try{n=W("crypto");}catch{}var a=function(){if(n){if(typeof n.getRandomValues=="function")try{return n.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof n.randomBytes=="function")try{return n.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||function(){function r(){}return function(o){var u;return r.prototype=o,u=new r,r.prototype=null,u}}(),c={},y=c.lib={},d=y.Base=function(){return {extend:function(r){var o=s(this);return r&&o.mixIn(r),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var r=this.extend();return r.init.apply(r,arguments),r},init:function(){},mixIn:function(r){for(var o in r)r.hasOwnProperty(o)&&(this[o]=r[o]);r.hasOwnProperty("toString")&&(this.toString=r.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),p=y.WordArray=d.extend({init:function(r,o){r=this.words=r||[],o!=e?this.sigBytes=o:this.sigBytes=r.length*4;},toString:function(r){return (r||g).stringify(this)},concat:function(r){var o=this.words,u=r.words,m=this.sigBytes,b=r.sigBytes;if(this.clamp(),m%4)for(var N=0;N<b;N++){var H=u[N>>>2]>>>24-N%4*8&255;o[m+N>>>2]|=H<<24-(m+N)%4*8;}else for(var S=0;S<b;S+=4)o[m+S>>>2]=u[S>>>2];return this.sigBytes+=b,this},clamp:function(){var r=this.words,o=this.sigBytes;r[o>>>2]&=4294967295<<32-o%4*8,r.length=t.ceil(o/4);},clone:function(){var r=d.clone.call(this);return r.words=this.words.slice(0),r},random:function(r){for(var o=[],u=0;u<r;u+=4)o.push(a());return new p.init(o,r)}}),l=c.enc={},g=l.Hex={stringify:function(r){for(var o=r.words,u=r.sigBytes,m=[],b=0;b<u;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push((N>>>4).toString(16)),m.push((N&15).toString(16));}return m.join("")},parse:function(r){for(var o=r.length,u=[],m=0;m<o;m+=2)u[m>>>3]|=parseInt(r.substr(m,2),16)<<24-m%8*4;return new p.init(u,o/2)}},h=l.Latin1={stringify:function(r){for(var o=r.words,u=r.sigBytes,m=[],b=0;b<u;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push(String.fromCharCode(N));}return m.join("")},parse:function(r){for(var o=r.length,u=[],m=0;m<o;m++)u[m>>>2]|=(r.charCodeAt(m)&255)<<24-m%4*8;return new p.init(u,o)}},T=l.Utf8={stringify:function(r){try{return decodeURIComponent(escape(h.stringify(r)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(r){return h.parse(unescape(encodeURIComponent(r)))}},x=y.BufferedBlockAlgorithm=d.extend({reset:function(){this._data=new p.init,this._nDataBytes=0;},_append:function(r){typeof r=="string"&&(r=T.parse(r)),this._data.concat(r),this._nDataBytes+=r.sigBytes;},_process:function(r){var o,u=this._data,m=u.words,b=u.sigBytes,N=this.blockSize,H=N*4,S=b/H;r?S=t.ceil(S):S=t.max((S|0)-this._minBufferSize,0);var k=S*N,M=t.min(k*4,b);if(k){for(var F=0;F<k;F+=N)this._doProcessBlock(m,F);o=m.splice(0,k),u.sigBytes-=M;}return new p.init(o,M)},clone:function(){var r=d.clone.call(this);return r._data=this._data.clone(),r},_minBufferSize:0});y.Hasher=x.extend({cfg:d.extend(),init:function(r){this.cfg=this.cfg.extend(r),this.reset();},reset:function(){x.reset.call(this),this._doReset();},update:function(r){return this._append(r),this._process(),this},finalize:function(r){r&&this._append(r);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(r){return function(o,u){return new r.init(u).finalize(o)}},_createHmacHelper:function(r){return function(o,u){return new V.HMAC.init(r,u).finalize(o)}}});var V=c.algo={};return c}(Math);return i});});var Q=U((I,Y)=>{(function(i,t){typeof I=="object"?Y.exports=I=t(q()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(I,function(i){return function(){var t=i,e=t.lib,n=e.WordArray,a=e.Hasher,s=t.algo,c=[],y=s.SHA1=a.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(d,p){for(var l=this._hash.words,g=l[0],h=l[1],T=l[2],x=l[3],C=l[4],V=0;V<80;V++){if(V<16)c[V]=d[p+V]|0;else {var r=c[V-3]^c[V-8]^c[V-14]^c[V-16];c[V]=r<<1|r>>>31;}var o=(g<<5|g>>>27)+C+c[V];V<20?o+=(h&T|~h&x)+1518500249:V<40?o+=(h^T^x)+1859775393:V<60?o+=(h&T|h&x|T&x)-1894007588:o+=(h^T^x)-899497514,C=x,x=T,T=h<<30|h>>>2,h=g,g=o;}l[0]=l[0]+g|0,l[1]=l[1]+h|0,l[2]=l[2]+T|0,l[3]=l[3]+x|0,l[4]=l[4]+C|0;},_doFinalize:function(){var d=this._data,p=d.words,l=this._nDataBytes*8,g=d.sigBytes*8;return p[g>>>5]|=128<<24-g%32,p[(g+64>>>9<<4)+14]=Math.floor(l/4294967296),p[(g+64>>>9<<4)+15]=l,d.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var d=a.clone.call(this);return d._hash=this._hash.clone(),d}});t.SHA1=a._createHelper(y),t.HmacSHA1=a._createHmacHelper(y);}(),i.SHA1});});var ae=pe(Q());var E="___param___";var P=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,n){let a=n.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(s=>{t[s]===void 0&&(a==="empty_string"?t[s]="":a==="copy_key"&&(i._beforeToTranslate?t[s]=i._beforeToTranslate(s):t[s]=s));});}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(n=>{i.getConditionalsThenElse(n,e);});else if(t.elements.type==="ifelse"){let n=[];i.getConditionalsThenElse(t.elements,n),n.forEach(a=>{e.push(...a);});}else if(t.elements.type==="stepswitch"){let n=[];i.getConditionalsThenElse(t.elements,n),n.forEach(a=>{e.push(...a);});}else i.getConditionalsThenElse(t.elements,e);}else t.type==="resulttocombine"?(t.firstItem&&i.getConditionalsThenElse(t.firstItem,e),t.secondConditionalItem&&t.secondConditionalItem.forEach(n=>{i.getConditionalsThenElse(n,e);})):e.push(t);else t&&e.push(t);return e}static generateJsonTranslation(t,e={},n={}){return t.forEach(a=>{if(a.choices){let s=[];Array.isArray(a.choices)?s=[a.choices]:s=i.getConditionalsThenElse(a.choices),s.forEach(c=>c.forEach(y=>{if("type"in y){let d=[];y.type==="ifelse"||y.type==="stepswitch"?i.getConditionalsThenElse(y,d):d=[y],d.map(l=>i.getConditionalsThenElse(l.text)).forEach(l=>{Array.isArray(l)&&l.forEach(g=>{Array.isArray(g)?g.forEach(h=>{typeof h=="string"?i.addKey(e,h,n):i.getConditionalsThenElse(h).forEach(T=>{Array.isArray(T)?T.forEach(x=>{typeof x=="string"&&i.addKey(e,x,n);}):typeof T=="string"&&i.addKey(e,T,n);});}):typeof g=="string"&&i.addKey(e,g,n);});});}}));}if(a.dialogue){let s=[];Array.isArray(a.dialogue)?s=[a.dialogue]:s=i.getConditionalsThenElse(a.dialogue),s.forEach(c=>{typeof c=="string"?i.addKey(e,c,n):"text"in c&&Array.isArray(c.text)&&c.text.forEach(y=>{typeof y=="string"?i.addKey(e,y,n):i.getConditionalsThenElse(y).forEach(p=>{typeof p=="string"?i.addKey(e,p,n):Array.isArray(p)&&p.forEach(l=>{typeof l=="string"?i.addKey(e,l,n):i.getConditionalsThenElse(l).forEach(g=>{typeof g=="string"&&i.addKey(e,g,n);});});});});});}a.conditionalStep&&i.getConditionalsThenElse(a.conditionalStep).forEach(c=>{Array.isArray(c)?i.generateJsonTranslation(c,e,n):i.generateJsonTranslation([c],e,n);});}),e}};var R=P;function ge(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function ye(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 f(i.condition)?f(i.then):f(i.else);case"stepswitch":let e=f(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let n=ge(0,e.length-1);return f(e[n]);case"loop":let a=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return a>e.length-1&&(a=a%e.length),f(e[a]);case"sequential":let s,c=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(s=f(e[e.length-1])),c>e.length-1?s:f(e[c]);case"sequentialrandom":let y=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(y==null&&i.end=="lastItem"){let d=NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!d||!d?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let p=d.usedRandomNumbers[`0-${e.length-1}`];return f(e[p[p.length-1]])}if(y==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return f(e[y])}}return i}function G(i){if(i.conditionalStep){let t=createExportableElement(f(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 G(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(a=>{if(Array.isArray(a))a.forEach(s=>{let c=f(s);e.push(c);});else {let s=f(a);e.push(s);}});let n=t?[t,...e]:e;if(n.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof n[0]=="string")return R.t(n).join("");if(typeof n[0]=="object"){let a=n,s,c=a.map((r,o)=>{r=G(r);let u=f(r.dialogue)||"";return o===0?(s=f(r.glueEnabled)||!1,u):(typeof u=="object"&&"text"in u&&(u=u.character+": "+u.text),s===!1&&(u=`
1
+ import {storage,narration,setFlag,StorageManagerStatic,saveLabel,NarrationManagerStatic,getFlag,shakeEffect,ZoomTicker,canvas,RotateTicker,MoveTicker,FadeAlphaTicker,zoomOut,moveOut,removeWithDissolveTransition,removeWithFadeTransition,CanvasVideo,zoomIn,moveIn,showWithDissolveTransition,showWithFadeTransition,CanvasImage,Assets,sound,LabelAbstract,ChoiceMenuOption,createExportableElement}from'@drincs/pixi-vn';var ce=Object.create;var K=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,ge=Object.prototype.hasOwnProperty;var z=(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 U=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports);var ye=(t,i,e,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let a of ue(i))!ge.call(t,a)&&a!==e&&K(t,a,{get:()=>i[a],enumerable:!(r=pe(i,a))||r.enumerable});return t};var he=(t,i,e)=>(e=t!=null?ce(de(t)):{},ye(K(e,"default",{value:t,enumerable:!0}),t));var q=U((D,X)=>{(function(t,i){typeof D=="object"?X.exports=D=i():typeof define=="function"&&define.amd?define([],i):t.CryptoJS=i();})(D,function(){var t=t||function(i,e){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof z=="function")try{r=z("crypto");}catch{}var a=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.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(o){var d;return n.prototype=o,d=new n,n.prototype=null,d}}(),g={},l=g.lib={},u=l.Base=function(){return {extend:function(n){var o=f(this);return n&&o.mixIn(n),(!o.hasOwnProperty("init")||this.init===o.init)&&(o.init=function(){o.$super.init.apply(this,arguments);}),o.init.prototype=o,o.$super=this,o},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var o in n)n.hasOwnProperty(o)&&(this[o]=n[o]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),p=l.WordArray=u.extend({init:function(n,o){n=this.words=n||[],o!=e?this.sigBytes=o:this.sigBytes=n.length*4;},toString:function(n){return (n||y).stringify(this)},concat:function(n){var o=this.words,d=n.words,m=this.sigBytes,b=n.sigBytes;if(this.clamp(),m%4)for(var N=0;N<b;N++){var H=d[N>>>2]>>>24-N%4*8&255;o[m+N>>>2]|=H<<24-(m+N)%4*8;}else for(var S=0;S<b;S+=4)o[m+S>>>2]=d[S>>>2];return this.sigBytes+=b,this},clamp:function(){var n=this.words,o=this.sigBytes;n[o>>>2]&=4294967295<<32-o%4*8,n.length=i.ceil(o/4);},clone:function(){var n=u.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var o=[],d=0;d<n;d+=4)o.push(a());return new p.init(o,n)}}),s=g.enc={},y=s.Hex={stringify:function(n){for(var o=n.words,d=n.sigBytes,m=[],b=0;b<d;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push((N>>>4).toString(16)),m.push((N&15).toString(16));}return m.join("")},parse:function(n){for(var o=n.length,d=[],m=0;m<o;m+=2)d[m>>>3]|=parseInt(n.substr(m,2),16)<<24-m%8*4;return new p.init(d,o/2)}},h=s.Latin1={stringify:function(n){for(var o=n.words,d=n.sigBytes,m=[],b=0;b<d;b++){var N=o[b>>>2]>>>24-b%4*8&255;m.push(String.fromCharCode(N));}return m.join("")},parse:function(n){for(var o=n.length,d=[],m=0;m<o;m++)d[m>>>2]|=(n.charCodeAt(m)&255)<<24-m%4*8;return new p.init(d,o)}},x=s.Utf8={stringify:function(n){try{return decodeURIComponent(escape(h.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return h.parse(unescape(encodeURIComponent(n)))}},T=l.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new p.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=x.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var o,d=this._data,m=d.words,b=d.sigBytes,N=this.blockSize,H=N*4,S=b/H;n?S=i.ceil(S):S=i.max((S|0)-this._minBufferSize,0);var L=S*N,j=i.min(L*4,b);if(L){for(var F=0;F<L;F+=N)this._doProcessBlock(m,F);o=m.splice(0,L),d.sigBytes-=j;}return new p.init(o,j)},clone:function(){var n=u.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});l.Hasher=T.extend({cfg:u.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){T.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(n){return function(o,d){return new n.init(d).finalize(o)}},_createHmacHelper:function(n){return function(o,d){return new V.HMAC.init(n,d).finalize(o)}}});var V=g.algo={};return g}(Math);return t});});var Z=U((I,Y)=>{(function(t,i){typeof I=="object"?Y.exports=I=i(q()):typeof define=="function"&&define.amd?define(["./core"],i):i(t.CryptoJS);})(I,function(t){return function(){var i=t,e=i.lib,r=e.WordArray,a=e.Hasher,f=i.algo,g=[],l=f.SHA1=a.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(u,p){for(var s=this._hash.words,y=s[0],h=s[1],x=s[2],T=s[3],w=s[4],V=0;V<80;V++){if(V<16)g[V]=u[p+V]|0;else {var n=g[V-3]^g[V-8]^g[V-14]^g[V-16];g[V]=n<<1|n>>>31;}var o=(y<<5|y>>>27)+w+g[V];V<20?o+=(h&x|~h&T)+1518500249:V<40?o+=(h^x^T)+1859775393:V<60?o+=(h&x|h&T|x&T)-1894007588:o+=(h^x^T)-899497514,w=T,T=x,x=h<<30|h>>>2,h=y,y=o;}s[0]=s[0]+y|0,s[1]=s[1]+h|0,s[2]=s[2]+x|0,s[3]=s[3]+T|0,s[4]=s[4]+w|0;},_doFinalize:function(){var u=this._data,p=u.words,s=this._nDataBytes*8,y=u.sigBytes*8;return p[y>>>5]|=128<<24-y%32,p[(y+64>>>9<<4)+14]=Math.floor(s/4294967296),p[(y+64>>>9<<4)+15]=s,u.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var u=a.clone.call(this);return u._hash=this._hash.clone(),u}});i.SHA1=a._createHelper(l),i.HmacSHA1=a._createHmacHelper(l);}(),t.SHA1});});var fe=he(Z());var E="___param___";var P=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,r){let a=r.defaultValue||"empty_string";typeof e=="string"&&(e=[e]),Array.isArray(e)&&e.forEach(f=>{i[f]===void 0&&(a==="empty_string"?i[f]="":a==="copy_key"&&(t._beforeToTranslate?i[f]=t._beforeToTranslate(f):i[f]=f));});}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(r=>{t.getConditionalsThenElse(r,e);});else if(i.elements.type==="ifelse"){let r=[];t.getConditionalsThenElse(i.elements,r),r.forEach(a=>{e.push(...a);});}else if(i.elements.type==="stepswitch"){let r=[];t.getConditionalsThenElse(i.elements,r),r.forEach(a=>{e.push(...a);});}else t.getConditionalsThenElse(i.elements,e);}else i.type==="resulttocombine"?(i.firstItem&&t.getConditionalsThenElse(i.firstItem,e),i.secondConditionalItem&&i.secondConditionalItem.forEach(r=>{t.getConditionalsThenElse(r,e);})):e.push(i);else i&&e.push(i);return e}static generateJsonTranslation(i,e={},r={}){return i.forEach(a=>{if(a.choices){let f=[];Array.isArray(a.choices)?f=[a.choices]:f=t.getConditionalsThenElse(a.choices),f.forEach(g=>g.forEach(l=>{if("type"in l){let u=[];l.type==="ifelse"||l.type==="stepswitch"?t.getConditionalsThenElse(l,u):u=[l],u.map(s=>t.getConditionalsThenElse(s.text)).forEach(s=>{Array.isArray(s)&&s.forEach(y=>{Array.isArray(y)?y.forEach(h=>{typeof h=="string"?t.addKey(e,h,r):t.getConditionalsThenElse(h).forEach(x=>{Array.isArray(x)?x.forEach(T=>{typeof T=="string"&&t.addKey(e,T,r);}):typeof x=="string"&&t.addKey(e,x,r);});}):typeof y=="string"&&t.addKey(e,y,r);});});}}));}if(a.dialogue){let f=[];Array.isArray(a.dialogue)?f=[a.dialogue]:f=t.getConditionalsThenElse(a.dialogue),f.forEach(g=>{typeof g=="string"?t.addKey(e,g,r):"text"in g&&Array.isArray(g.text)&&g.text.forEach(l=>{typeof l=="string"?t.addKey(e,l,r):t.getConditionalsThenElse(l).forEach(p=>{typeof p=="string"?t.addKey(e,p,r):Array.isArray(p)&&p.forEach(s=>{typeof s=="string"?t.addKey(e,s,r):t.getConditionalsThenElse(s).forEach(y=>{typeof y=="string"&&t.addKey(e,y,r);});});});});});}a.conditionalStep&&t.getConditionalsThenElse(a.conditionalStep).forEach(g=>{Array.isArray(g)?t.generateJsonTranslation(g,e,r):t.generateJsonTranslation([g],e,r);});}),e}};var R=P;function Te(t,i){return Math.floor(Math.random()*(i-t+1)+t)}function xe(t){if(Array.isArray(t)||!t)return t;if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"resulttocombine":return be(t);case"ifelse":return c(t.condition)?c(t.then):c(t.else);case"stepswitch":let e=c(t.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(t.choiceType){case"random":let r=Te(0,e.length-1);return c(e[r]);case"loop":let a=NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return a>e.length-1&&(a=a%e.length),c(e[a]);case"sequential":let f,g=NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)-1;return t.end=="lastItem"&&(f=c(e[e.length-1])),g>e.length-1?f:c(e[g]);case"sequentialrandom":let l=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:t.nestedId,onceOnly:!0});if(l==null&&t.end=="lastItem"){let u=NarrationManagerStatic.getCurrentStepTimesCounterData(t.nestedId);if(!u||!u?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let p=u.usedRandomNumbers[`0-${e.length-1}`];return c(e[p[p.length-1]])}if(l==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return c(e[l])}}return t}function G(t){if(t.conditionalStep){let i=createExportableElement(c(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 G(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 be(t){let i=t.firstItem,e=[];t.secondConditionalItem?.forEach(a=>{if(Array.isArray(a))a.forEach(f=>{let g=c(f);e.push(g);});else {let f=c(a);e.push(f);}});let r=i?[i,...e]:e;if(r.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return R.t(r).join("");if(typeof r[0]=="object"){let a=r,f,g=a.map((n,o)=>{n=G(n);let d=c(n.dialogue)||"";return o===0?(f=c(n.glueEnabled)||!1,d):(typeof d=="object"&&"text"in d&&(d=d.character+": "+d.text),f===!1&&(d=`
2
2
 
3
- `+u),s=f(r.glueEnabled)||!1,u)}),y=f(c[0]),d=typeof y=="object"&&"character"in y?y.character:void 0,p=c.map(r=>{let o;r&&typeof r=="object"&&"text"in r?o=r.text:o=r;let u;return Array.isArray(o)?u=o.map(m=>{let b=f(m);return R.t(`${b}`)}).join(""):u=f(o)||"",R.t(u)}).join(""),l=a.find(r=>r.end),g=a.find(r=>r.choices),h=!1,T=!1;a.length>0&&(a[0].glueEnabled&&a[0].goNextStep&&a[0].dialogue===void 0&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),h=a[a.length-1].glueEnabled,T=a.reverse().find(r=>!(r.operations&&(!r.dialogue||!r.choices)))?.goNextStep);let x=a.find(r=>r.labelToOpen),C=[];return a.forEach(r=>{r.operations&&C.forEach(o=>{C.push(o);});}),{dialogue:d?{character:d,text:p}:p,end:l?.end,choices:g?.choices,glueEnabled:h,goNextStep:T,labelToOpen:x?.labelToOpen,operations:C}}}function me(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=f(i.leftValue),e=f(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 !!f(i.value);case"union":return Te(i)}return !!i}function xe(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 f(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 !f(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=f(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function z(i){let t=f(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=f(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 n=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];n&&n.length-1>=i.key&&(n[i.key]=e),storage.setTempVariable(`${E}${narration.openedLabels.length-1}`,n);break}}function f(i){let t=ye(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return xe(t);case"arithmetic":case"arithmeticsingle":return be(t);case"compare":case"valueCondition":case"union":return me(t)}return t}function be(i){let t=f(i.leftValue);switch(i.type){case"arithmetic":let e=f(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 L(i,t){let e=f(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}case"image":switch(e.operationType){case"show":let n=new CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,n,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,n,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,n),await n.load();break;case"edit":let a=canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":let n=new CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,n,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,n,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,n,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,n),await n.load();break;case"edit":let a=canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":canvas.remove(e.alias);break;case"pause":let s=canvas.find(e.alias);s?s.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let c=canvas.find(e.alias);c?c.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":z(e);break;case"oprationtoconvert":if(t){let n="";e.values.forEach(s=>{if(typeof s=="string")n+=s;else {let c=f(s);n+=`${c}`;}});let a=await t(n);a&&await L(a,t);}break;case"input":switch(e.operationType){case"request":narration.requestInput({type:e.valueType});break}break}}var _=class extends LabelAbstract{constructor(t,e,n,a={}){super(t,n),this._steps=e,this.operationStringConvert=a.operationStringConvert,this.skipEmptyDialogs=a.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 n=[];t.forEach(a=>{if(typeof a=="string")n.push(a);else if(a&&typeof a=="object"){let s=f(a);s?(s&&!Array.isArray(s)&&typeof s=="object"&&(s=f(s)||""),Array.isArray(s)?n=n.concat(s):n.push(`${s}`)):n.push(`${a}`);}}),e=n;}else {let n=f(t)||"";n&&!Array.isArray(n)&&typeof n=="object"&&(n=f(n)||""),e=n;}return `${e}`}getDialogue(t){let e=f(t);if(e)return typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:P.t(this.getDialogueText(e.text))}:P.t(this.getDialogueText(e));if(e!=null)return `${e}`}getChoices(t){return f(t)?.map(a=>f(a)).filter(a=>a!==void 0)}stepConverter(t){return async e=>{if(typeof t=="function"&&(t=t()),t=G(t),t.operations)for(let p of t.operations)await L(p,this.operationStringConvert?l=>this.operationStringConvert(l,e):void 0);let n=this.getChoices(t.choices),a=f(t.glueEnabled),s=this.getDialogue(t.dialogue),c=[];t.labelToOpen&&(Array.isArray(t.labelToOpen)||(t.labelToOpen=[t.labelToOpen]),t.labelToOpen.forEach(p=>{let l=f(p);l&&c.push(l);}));let y=f(t.goNextStep),d=f(t.end);if(n){let p=n.map(l=>{let g="";if(Array.isArray(l.text)){let h=[];l.text.forEach(T=>{if(typeof T=="string")h.push(P.t(T));else if(T&&typeof T=="object"){let x=f(T);x&&!Array.isArray(x)&&typeof x=="object"&&(x=f(x)||""),x&&(Array.isArray(x)?h=h.concat(P.t(x)):h.push(P.t(x)));}}),g=h.join();}else typeof l.text=="string"&&(g=P.t(l.text));return new ChoiceMenuOption(g,l.label,l.props,{type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect})});narration.choiceMenuOptions=p;}else narration.choiceMenuOptions=void 0;s!==void 0&&(narration.dialogue=s,this.skipEmptyDialogs&&typeof s=="string"&&(s===""||RegExp(/^\s+$/).test(s))&&(y=!0)),a?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):a===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let p of c){let l=p.label;typeof l=="object"&&(l=f(l)||"");let g=p.params?.map(h=>f(h));e={...e,...p.props},p.type==="jump"?(narration.closeCurrentLabel(),storage.setTempVariable(`${E}${narration.openedLabels.length}`,g),await narration.callLabel(l,e)):(storage.setTempVariable(`${E}${narration.openedLabels.length}`,g),await narration.callLabel(l,e));}d==="game_end"?(narration.closeAllLabels(),await narration.goNext(e)):d==="label_end"&&narration.closeCurrentLabel(),y&&await narration.goNext(e);}}};function Ee(i,t={}){let e=t?.operationStringConvert;try{typeof i=="string"&&(i=JSON.parse(i));}catch(n){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON",n);return}if(typeof i!="object"){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON: data is not an object");return}if(i.initialOperations){for(let n of i.initialOperations)L(n,e?a=>e(a,{}):void 0);StorageManagerStatic.saveStorageAsBasicStorage();}if(i.labels){let n=i.labels;for(let a in n)try{let s=n[a],c=new _(a,s,void 0,t);saveLabel(c);}catch(s){console.error(`[Pixi\u2019VN Json] Error creating JSON label ${a}`,s);}}}export{f as geLogichValue,Ee as importPixiVNJson,z as setStorageJson};
3
+ `+d),f=c(n.glueEnabled)||!1,d)}),l=c(g[0]),u=typeof l=="object"&&"character"in l?l.character:void 0,p=g.map(n=>{let o;n&&typeof n=="object"&&"text"in n?o=n.text:o=n;let d;return Array.isArray(o)?d=o.map(m=>{let b=c(m);return R.t(`${b}`)}).join(""):d=c(o)||"",R.t(d)}).join(""),s=a.find(n=>n.end),y=a.find(n=>n.choices),h=!1,x=!1;a.length>0&&(a[0].glueEnabled&&a[0].goNextStep&&a[0].dialogue===void 0&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),h=a[a.length-1].glueEnabled,x=a.reverse().find(n=>!(n.operations&&(!n.dialogue||!n.choices)))?.goNextStep);let T=a.find(n=>n.labelToOpen),w=[];return a.forEach(n=>{n.operations&&w.forEach(o=>{w.push(o);});}),{dialogue:u?{character:u,text:p}:p,end:s?.end,choices:y?.choices,glueEnabled:h,goNextStep:x,labelToOpen:T?.labelToOpen,operations:w}}}function Ve(t){if(!t)return !1;if(typeof t!="object"||!("type"in t))return !!t;switch(t.type){case"compare":let i=c(t.leftValue),e=c(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 !!c(t.value);case"union":return Pe(t)}return !!t}function Ne(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 c(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 Pe(t){if(t.unionType==="not")return !c(t.condition);let i=t.unionType==="and";for(let e=0;e<t.conditions.length;e++)if(i=c(t.conditions[e])||!1,t.unionType==="and"){if(!i)return !1}else if(i)return !0;return i}function M(t){let i=c(t.value),e;switch(i&&typeof i=="object"&&"type"in i?e=c(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 r=storage.getVariable(`${E}${narration.openedLabels.length-1}`)||[];r&&r.length-1>=t.key&&(r[t.key]=e),storage.setTempVariable(`${E}${narration.openedLabels.length-1}`,r);break}}function c(t){let i=xe(t);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"value":return Ne(i);case"arithmetic":case"arithmeticsingle":return Je(i);case"compare":case"valueCondition":case"union":return Ve(i)}return i}function Je(t){let i=c(t.leftValue);switch(t.type){case"arithmetic":let e=c(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 _(t,i){let e=c(t);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 l=new CanvasImage(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await showWithFadeTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"dissolve":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await showWithDissolveTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,l,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,l,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,l),await l.load();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":if(e.transition)switch(e.transition.type){case"fade":removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":let l=new CanvasVideo(e.props,e.url);if(e.transition)switch(e.transition.type){case"fade":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await showWithFadeTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"dissolve":(!e.props||!("alpha"in e.props))&&(await l.load(),l.alpha=0),await showWithDissolveTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,l,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,l,e.transition.props,e.transition.priority);break}else canvas.add(e.alias,l),await l.load();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":if(e.transition)switch(e.transition.type){case"fade":removeWithFadeTransition(e.alias,e.transition.props,e.transition.priority);break;case"dissolve":removeWithDissolveTransition(e.alias,e.transition.props,e.transition.priority);break;case"movein":case"moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);break;case"pause":let p=canvas.find(e.alias);p?p.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let s=canvas.find(e.alias);s?s.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":M(e);break;case"oprationtoconvert":if(i){let l="";e.values.forEach(p=>{if(typeof p=="string")l+=p;else {let s=c(p);l+=`${s}`;}});let u=await i(l);u&&await _(u,i);}break;case"input":switch(e.operationType){case"request":narration.requestInput({type:e.valueType});break}break;case"fade":let r=new FadeAlphaTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,r);break;case"move":let a=new MoveTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,a);break;case"rotate":let f=new RotateTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,f);break;case"zoom":let g=new ZoomTicker(e.props,e.duration,e.priority);canvas.addTicker(e.alias,g);break;case"shake":await shakeEffect(e.alias,e.props,e.priority);break}}var O=class extends LabelAbstract{constructor(i,e,r,a={}){super(i,r),this._steps=e,this.operationStringConvert=a.operationStringConvert,this.skipEmptyDialogs=a.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, fe.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(i){let e="";if(Array.isArray(i)){let r=[];i.forEach(a=>{if(typeof a=="string")r.push(a);else if(a&&typeof a=="object"){let f=c(a);f?(f&&!Array.isArray(f)&&typeof f=="object"&&(f=c(f)||""),Array.isArray(f)?r=r.concat(f):r.push(`${f}`)):r.push(`${a}`);}}),e=r;}else {let r=c(i)||"";r&&!Array.isArray(r)&&typeof r=="object"&&(r=c(r)||""),e=r;}return `${e}`}getDialogue(i){let e=c(i);if(e)return typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:P.t(this.getDialogueText(e.text))}:P.t(this.getDialogueText(e));if(e!=null)return `${e}`}getChoices(i){return c(i)?.map(a=>c(a)).filter(a=>a!==void 0)}stepConverter(i){return async e=>{if(typeof i=="function"&&(i=i()),i=G(i),i.operations)for(let p of i.operations)await _(p,this.operationStringConvert?s=>this.operationStringConvert(s,e):void 0);let r=this.getChoices(i.choices),a=c(i.glueEnabled),f=this.getDialogue(i.dialogue),g=[];i.labelToOpen&&(Array.isArray(i.labelToOpen)||(i.labelToOpen=[i.labelToOpen]),i.labelToOpen.forEach(p=>{let s=c(p);s&&g.push(s);}));let l=c(i.goNextStep),u=c(i.end);if(r){let p=r.map(s=>{let y="";if(Array.isArray(s.text)){let h=[];s.text.forEach(x=>{if(typeof x=="string")h.push(P.t(x));else if(x&&typeof x=="object"){let T=c(x);T&&!Array.isArray(T)&&typeof T=="object"&&(T=c(T)||""),T&&(Array.isArray(T)?h=h.concat(P.t(T)):h.push(P.t(T)));}}),y=h.join();}else typeof s.text=="string"&&(y=P.t(s.text));return new ChoiceMenuOption(y,s.label,s.props,{type:s.type,oneTime:s.oneTime,onlyHaveNoChoice:s.onlyHaveNoChoice,autoSelect:s.autoSelect})});narration.choiceMenuOptions=p;}else narration.choiceMenuOptions=void 0;f!==void 0&&(narration.dialogue=f,this.skipEmptyDialogs&&typeof f=="string"&&(f===""||RegExp(/^\s+$/).test(f))&&(l=!0)),a?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):a===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);for(let p of g){let s=p.label;typeof s=="object"&&(s=c(s)||"");let y=p.params?.map(h=>c(h));e={...e,...p.props},p.type==="jump"?(narration.closeCurrentLabel(),storage.setTempVariable(`${E}${narration.openedLabels.length}`,y),await narration.callLabel(s,e)):(storage.setTempVariable(`${E}${narration.openedLabels.length}`,y),await narration.callLabel(s,e));}u==="game_end"?(narration.closeAllLabels(),await narration.goNext(e)):u==="label_end"&&narration.closeCurrentLabel(),l&&await narration.goNext(e);}}};function Be(t,i={}){let e=i?.operationStringConvert;try{typeof t=="string"&&(t=JSON.parse(t));}catch(r){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON",r);return}if(typeof t!="object"){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON: data is not an object");return}if(t.initialOperations){for(let r of t.initialOperations)_(r,e?a=>e(a,{}):void 0);StorageManagerStatic.saveStorageAsBasicStorage();}if(t.labels){let r=t.labels;for(let a in r)try{let f=r[a],g=new O(a,f,void 0,i);saveLabel(g);}catch(f){console.error(`[Pixi\u2019VN Json] Error creating JSON label ${a}`,f);}}}export{c as geLogichValue,Be as importPixiVNJson,M as setStorageJson};