@drincs/pixi-vn-json 1.13.0 → 1.13.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- 'use strict';var pixiVn=require('@drincs/pixi-vn'),core=require('@drincs/pixi-vn-json/core'),translator=require('@drincs/pixi-vn-json/translator'),narration=require('@drincs/pixi-vn/narration'),storage=require('@drincs/pixi-vn/storage');var te=Object.create;var R=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var ae=(a,e,r)=>e in a?R(a,e,{enumerable:true,configurable:true,writable:true,value:r}):a[e]=r;var D=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var q=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports);var se=(a,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ne(e))!re.call(a,n)&&n!==r&&R(a,n,{get:()=>e[n],enumerable:!(t=ie(e,n))||t.enumerable});return a};var pe=(a,e,r)=>(r=a!=null?te(oe(a)):{},se(R(r,"default",{value:a,enumerable:true}),a));var V=(a,e,r)=>ae(a,typeof e!="symbol"?e+"":e,r);var Q=q((I,K)=>{(function(a,e){typeof I=="object"?K.exports=I=e():typeof define=="function"&&define.amd?define([],e):a.CryptoJS=e();})(I,function(){var a=a||(function(e,r){var t;if(typeof window<"u"&&window.crypto&&(t=window.crypto),typeof self<"u"&&self.crypto&&(t=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(t=globalThis.crypto),!t&&typeof window<"u"&&window.msCrypto&&(t=window.msCrypto),!t&&typeof global<"u"&&global.crypto&&(t=global.crypto),!t&&typeof D=="function")try{t=D("crypto");}catch{}var n=function(){if(t){if(typeof t.getRandomValues=="function")try{return t.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof t.randomBytes=="function")try{return t.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function i(){}return function(o){var u;return i.prototype=o,u=new i,i.prototype=null,u}})(),p={},d=p.lib={},g=d.Base=(function(){return {extend:function(i){var o=s(this);return i&&o.mixIn(i),(!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 i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var o in i)i.hasOwnProperty(o)&&(this[o]=i[o]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),y=d.WordArray=g.extend({init:function(i,o){i=this.words=i||[],o!=r?this.sigBytes=o:this.sigBytes=i.length*4;},toString:function(i){return (i||J).stringify(this)},concat:function(i){var o=this.words,u=i.words,l=this.sigBytes,S=i.sigBytes;if(this.clamp(),l%4)for(var b=0;b<S;b++){var k=u[b>>>2]>>>24-b%4*8&255;o[l+b>>>2]|=k<<24-(l+b)%4*8;}else for(var j=0;j<S;j+=4)o[l+j>>>2]=u[j>>>2];return this.sigBytes+=S,this},clamp:function(){var i=this.words,o=this.sigBytes;i[o>>>2]&=4294967295<<32-o%4*8,i.length=e.ceil(o/4);},clone:function(){var i=g.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var o=[],u=0;u<i;u+=4)o.push(n());return new y.init(o,i)}}),f=p.enc={},J=f.Hex={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push((b>>>4).toString(16)),l.push((b&15).toString(16));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l+=2)u[l>>>3]|=parseInt(i.substr(l,2),16)<<24-l%8*4;return new y.init(u,o/2)}},N=f.Latin1={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push(String.fromCharCode(b));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l++)u[l>>>2]|=(i.charCodeAt(l)&255)<<24-l%4*8;return new y.init(u,o)}},C=f.Utf8={stringify:function(i){try{return decodeURIComponent(escape(N.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return N.parse(unescape(encodeURIComponent(i)))}},m=d.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=C.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var o,u=this._data,l=u.words,S=u.sigBytes,b=this.blockSize,k=b*4,j=S/k;i?j=e.ceil(j):j=e.max((j|0)-this._minBufferSize,0);var E=j*b,M=e.min(E*4,S);if(E){for(var z=0;z<E;z+=b)this._doProcessBlock(l,z);o=l.splice(0,E),u.sigBytes-=M;}return new y.init(o,M)},clone:function(){var i=g.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});d.Hasher=m.extend({cfg:g.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){m.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(i){return function(o,u){return new i.init(u).finalize(o)}},_createHmacHelper:function(i){return function(o,u){return new P.HMAC.init(i,u).finalize(o)}}});var P=p.algo={};return p})(Math);return a});});var Z=q((B,Y)=>{(function(a,e){typeof B=="object"?Y.exports=B=e(Q()):typeof define=="function"&&define.amd?define(["./core"],e):e(a.CryptoJS);})(B,function(a){return (function(){var e=a,r=e.lib,t=r.WordArray,n=r.Hasher,s=e.algo,p=[],d=s.SHA1=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,y){for(var f=this._hash.words,J=f[0],N=f[1],C=f[2],m=f[3],x=f[4],P=0;P<80;P++){if(P<16)p[P]=g[y+P]|0;else {var i=p[P-3]^p[P-8]^p[P-14]^p[P-16];p[P]=i<<1|i>>>31;}var o=(J<<5|J>>>27)+x+p[P];P<20?o+=(N&C|~N&m)+1518500249:P<40?o+=(N^C^m)+1859775393:P<60?o+=(N&C|N&m|C&m)-1894007588:o+=(N^C^m)-899497514,x=m,m=C,C=N<<30|N>>>2,N=J,J=o;}f[0]=f[0]+J|0,f[1]=f[1]+N|0,f[2]=f[2]+C|0,f[3]=f[3]+m|0,f[4]=f[4]+x|0;},_doFinalize:function(){var g=this._data,y=g.words,f=this._nDataBytes*8,J=g.sigBytes*8;return y[J>>>5]|=128<<24-J%32,y[(J+64>>>9<<4)+14]=Math.floor(f/4294967296),y[(J+64>>>9<<4)+15]=f,g.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var g=n.clone.call(this);return g._hash=this._hash.clone(),g}});e.SHA1=n._createHelper(d),e.HmacSHA1=n._createHmacHelper(d);})(),a.SHA1});});var H="___param___";var h;(n=>(n.log=(s,...p)=>console.log(`[Pixi\u2019VN Json] ${s}`,...p),n.warn=(s,...p)=>console.warn(`[Pixi\u2019VN Json] ${s}`,...p),n.error=(s,...p)=>console.error(`[Pixi\u2019VN Json] ${s}`,...p),n.info=(s,...p)=>console.info(`[Pixi\u2019VN Json] ${s}`,...p)))(h||(h={}));var c=class c{static init(e){e.loadAssets&&(c._loadAssets=e.loadAssets),e.soundOperation&&(c._soundOperation=e.soundOperation),e.imageOperation&&(c._imageOperation=e.imageOperation),e.videoOperation&&(c._videoOperation=e.videoOperation),e.imageContainerOperation&&(c._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(c._textOperation=e.textOperation),e.canvasElementOperation&&(c._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(c._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(c._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(c._narrationOperation=e.narrationOperation),e.effectOperation&&(c._effectOperation=e.effectOperation),e.animateOperation&&(c._animateOperation=e.animateOperation),e.getLogichValue&&(c._getLogichValue=e.getLogichValue),e.getConditionalStep&&(c._getConditionalStep=e.getConditionalStep);}static get loadAssets(){return c._loadAssets}static get soundOperation(){return c._soundOperation}static get imageOperation(){return c._imageOperation}static get videoOperation(){return c._videoOperation}static get imageContainerOperation(){return c._imageContainerOperation}static get textOperation(){return c._textOperation}static get canvasElementOperation(){return c._canvasElementOperation}static get setStorageValue(){return c._setStorageValue}static get setInitialStorageValue(){return c._setInitialStorageValue}static get narrationOperation(){return c._narrationOperation}static get effectOperation(){return c._effectOperation}static get animateOperation(){return c._animateOperation}static get getLogichValue(){return c._getLogichValue}static get getConditionalStep(){return c._getConditionalStep}};V(c,"_loadAssets",()=>{}),V(c,"_soundOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_imageOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_videoOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_imageContainerOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_textOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_canvasElementOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_setStorageValue",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_setInitialStorageValue",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_narrationOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_effectOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_animateOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_getLogichValue",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_getConditionalStep",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var T=c;function G(a,e){if(e&&typeof e=="object"&&typeof a.functionName=="string"&&a.functionName in e){let r=e[a.functionName];if(typeof r=="function"){let t=a.args.map(n=>T.getLogichValue(n,e));return r(...t)}else h.warn(`getLogichValue function ${a.functionName} not found in props`);}}function F(a,e={}){let r="";return a.values.forEach(t=>{if(typeof t=="string")r+=t;else {let n=core.JsonUnifier.getLogichValue(t,e);r+=`${n}`;}}),r}async function $(a,e,r){let t=core.JsonUnifier.getLogichValue(a,e);if(t)switch(t.type){case "sound":core.JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await core.JsonUnifier.loadAssets(t);break;case "image":await core.JsonUnifier.imageOperation(t);break;case "video":await core.JsonUnifier.videoOperation(t);break;case "imagecontainer":await core.JsonUnifier.imageContainerOperation(t);break;case "text":await core.JsonUnifier.textOperation(t);break;case "canvaselement":await core.JsonUnifier.canvasElementOperation(t);break;case "value":core.JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(r){let n=F(t,e),s=await r(n);s&&await $(s,e,r);}break;case "input":case "dialogue":core.JsonUnifier.narrationOperation(t);break;case "shake":await core.JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":core.JsonUnifier.animateOperation(t);break;case "function":await G(t,e);break}}function X(a){let e=core.JsonUnifier.getLogichValue(a,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&core.JsonUnifier.setInitialStorageValue(e);}var ee=pe(Z());var _=class extends narration.LabelAbstract{constructor(r,t,n,s={}){n||(n={}),n.onLoadingLabel=async()=>{for(let p of t){let d;if(typeof p=="function"?d=p():d=p,d=core.JsonUnifier.getConditionalStep(d),d.operations)try{let g=d.operations.map(y=>core.JsonUnifier.loadAssets(y));await Promise.all(g);}catch(g){h.error("The operation in the onLoadingLabel function of the label has an error:",g);}}};super(r,n);V(this,"_steps");V(this,"operationStringConvert");V(this,"skipEmptyDialogs",false);this._steps=t,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}get steps(){return this._steps.map(r=>this.stepConverter(r))}get stepCount(){return this._steps.length}getStepById(r){if(r<0||r>=this._steps.length)return;let t=this._steps[r];return this.stepConverter(t)}getStepSha(r){if(r<0||r>=this.steps.length)return;let t=this._steps[r];return (0, ee.default)(t.toString().toLocaleLowerCase()).toString()}getDialogueText(r,t){let n="";if(Array.isArray(r)){let s=[];r.forEach(p=>{if(typeof p=="string")s.push(p);else if(p&&typeof p=="object"){let d=core.JsonUnifier.getLogichValue(p,t);d?(d&&!Array.isArray(d)&&typeof d=="object"&&(d=core.JsonUnifier.getLogichValue(d,t)||""),Array.isArray(d)?s=s.map(g=>`${g}`).concat(d):s.push(`${d}`)):s.push(`${p}`);}else s.push(`${p}`);}),n=s;}else {let s=core.JsonUnifier.getLogichValue(r,t);s&&!Array.isArray(s)&&typeof s=="object"&&(s=core.JsonUnifier.getLogichValue(s,t)),s&&Array.isArray(s)?n=s.map(p=>`${p}`):n=`${s}`;}return n}getDialogue(r,t){if(r==null)return;let n=core.JsonUnifier.getLogichValue(r,t);return n==null?`${n}`:typeof n=="object"&&"character"in n&&"text"in n?{character:n.character,text:translator.translator.t(this.getDialogueText(n.text,t))}:translator.translator.t(this.getDialogueText(n,t))}getChoices(r,t){return core.JsonUnifier.getLogichValue(r,t)?.map(p=>core.JsonUnifier.getLogichValue(p,t)).filter(p=>p!==void 0)}stepConverter(r){return async t=>{let n=typeof r=="function"?r():r;n=pixiVn.createExportableElement(n),n=core.JsonUnifier.getConditionalStep(n,t);let s=this.operationStringConvert?m=>this.operationStringConvert(m,n,t):void 0,{operations:p=[]}=n;for(let m of p)await $(m,t,s);let{labelToOpen:d=[]}=n,g=this.getChoices(n.choices,t),y=core.JsonUnifier.getLogichValue(n.glueEnabled,t),f=this.getDialogue(n.dialogue,t),J=[];Array.isArray(d)||(d=[d]),d.forEach(m=>{let x=core.JsonUnifier.getLogichValue(m,t);x&&J.push(x);});let N=core.JsonUnifier.getLogichValue(n.goNextStep,t),C=core.JsonUnifier.getLogichValue(n.end,t);if(g){let m=g.map(x=>{let P="";if(Array.isArray(x.text)){let o=[];x.text.forEach(u=>{if(typeof u=="string")o.push(translator.translator.t(u));else if(u&&typeof u=="object"){let l=core.JsonUnifier.getLogichValue(u,t);l&&!Array.isArray(l)&&typeof l=="object"&&(l=core.JsonUnifier.getLogichValue(l,t)||""),l&&(Array.isArray(l)?o=o.concat(translator.translator.t(l)):o.push(translator.translator.t(l)));}}),P=o;}else typeof x.text=="string"&&(P=translator.translator.t(x.text));return {label:x.label,text:P,props:x.props,type:x.type,oneTime:x.oneTime,onlyHaveNoChoice:x.onlyHaveNoChoice,autoSelect:x.autoSelect}});narration.narration.choices=m;}else narration.narration.choices=void 0;f!==void 0&&(narration.narration.dialogue=f,this.skipEmptyDialogs&&typeof f=="string"&&(f===""||RegExp(/^\s+$/).test(f))&&(N=true)),y?narration.narration.dialogGlue=true:y===false&&(narration.narration.dialogGlue=false);for(let m of J){let x=m.label;typeof x=="object"&&(x=core.JsonUnifier.getLogichValue(x,t)||"");let P=m.params?.map(i=>core.JsonUnifier.getLogichValue(i,t));t={...t,...m.props},m.type==="jump"?(narration.narration.openedLabels.length>0&&narration.narration.closeCurrentLabel(),storage.storage.setTempVariable(`${H}${narration.narration.openedLabels.length}`,P),await narration.narration.call(x,t)):(storage.storage.setTempVariable(`${H}${narration.narration.openedLabels.length}`,P),await narration.narration.call(x,t));}C==="game_end"?(narration.narration.closeAllLabels(),await narration.narration.continue(t,{runNow:true})):C==="label_end"&&narration.narration.closeCurrentLabel(),N&&await narration.narration.continue(t,{runNow:true});}}};async function ge(a,e={}){if(!Array.isArray(a))if(typeof a=="object"||typeof a=="string")a=[a];else {h.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let t=a.map(n=>{if(typeof n=="string")try{return JSON.parse(n)}catch(s){return h.error("Error parsing imported Pixi'VN JSON",s),{}}return n}).map(async n=>{if(n.initialOperations)for(let s of n.initialOperations)X(s);if(n.labels){let s=n.labels;for(let p in s)try{let d=s[p],g=new _(p,d,void 0,e);narration.RegisteredLabels.add(g);}catch(d){h.error(`Error creating JSON label ${p}`,d);}}});await Promise.all(t);}exports.LabelJson=_;exports.importPixiVNJson=ge;
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn'),core=require('@drincs/pixi-vn-json/core'),translator=require('@drincs/pixi-vn-json/translator'),narration=require('@drincs/pixi-vn/narration'),storage=require('@drincs/pixi-vn/storage');var te=Object.create;var R=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var ae=(s,e,r)=>e in s?R(s,e,{enumerable:true,configurable:true,writable:true,value:r}):s[e]=r;var D=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var W=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var se=(s,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ne(e))!re.call(s,n)&&n!==r&&R(s,n,{get:()=>e[n],enumerable:!(t=ie(e,n))||t.enumerable});return s};var pe=(s,e,r)=>(r=s!=null?te(oe(s)):{},se(R(r,"default",{value:s,enumerable:true}),s));var V=(s,e,r)=>ae(s,typeof e!="symbol"?e+"":e,r);var Q=W((I,K)=>{(function(s,e){typeof I=="object"?K.exports=I=e():typeof define=="function"&&define.amd?define([],e):s.CryptoJS=e();})(I,function(){var s=s||(function(e,r){var t;if(typeof window<"u"&&window.crypto&&(t=window.crypto),typeof self<"u"&&self.crypto&&(t=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(t=globalThis.crypto),!t&&typeof window<"u"&&window.msCrypto&&(t=window.msCrypto),!t&&typeof global<"u"&&global.crypto&&(t=global.crypto),!t&&typeof D=="function")try{t=D("crypto");}catch{}var n=function(){if(t){if(typeof t.getRandomValues=="function")try{return t.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof t.randomBytes=="function")try{return t.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},p=Object.create||(function(){function i(){}return function(o){var u;return i.prototype=o,u=new i,i.prototype=null,u}})(),a={},d=a.lib={},m=d.Base=(function(){return {extend:function(i){var o=p(this);return i&&o.mixIn(i),(!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 i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var o in i)i.hasOwnProperty(o)&&(this[o]=i[o]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),v=d.WordArray=m.extend({init:function(i,o){i=this.words=i||[],o!=r?this.sigBytes=o:this.sigBytes=i.length*4;},toString:function(i){return (i||J).stringify(this)},concat:function(i){var o=this.words,u=i.words,l=this.sigBytes,S=i.sigBytes;if(this.clamp(),l%4)for(var b=0;b<S;b++){var B=u[b>>>2]>>>24-b%4*8&255;o[l+b>>>2]|=B<<24-(l+b)%4*8;}else for(var j=0;j<S;j+=4)o[l+j>>>2]=u[j>>>2];return this.sigBytes+=S,this},clamp:function(){var i=this.words,o=this.sigBytes;i[o>>>2]&=4294967295<<32-o%4*8,i.length=e.ceil(o/4);},clone:function(){var i=m.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var o=[],u=0;u<i;u+=4)o.push(n());return new v.init(o,i)}}),f=a.enc={},J=f.Hex={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push((b>>>4).toString(16)),l.push((b&15).toString(16));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l+=2)u[l>>>3]|=parseInt(i.substr(l,2),16)<<24-l%8*4;return new v.init(u,o/2)}},N=f.Latin1={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push(String.fromCharCode(b));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l++)u[l>>>2]|=(i.charCodeAt(l)&255)<<24-l%4*8;return new v.init(u,o)}},C=f.Utf8={stringify:function(i){try{return decodeURIComponent(escape(N.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return N.parse(unescape(encodeURIComponent(i)))}},g=d.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new v.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=C.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var o,u=this._data,l=u.words,S=u.sigBytes,b=this.blockSize,B=b*4,j=S/B;i?j=e.ceil(j):j=e.max((j|0)-this._minBufferSize,0);var E=j*b,q=e.min(E*4,S);if(E){for(var k=0;k<E;k+=b)this._doProcessBlock(l,k);o=l.splice(0,E),u.sigBytes-=q;}return new v.init(o,q)},clone:function(){var i=m.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});d.Hasher=g.extend({cfg:m.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){g.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(i){return function(o,u){return new i.init(u).finalize(o)}},_createHmacHelper:function(i){return function(o,u){return new P.HMAC.init(i,u).finalize(o)}}});var P=a.algo={};return a})(Math);return s});});var Z=W((z,Y)=>{(function(s,e){typeof z=="object"?Y.exports=z=e(Q()):typeof define=="function"&&define.amd?define(["./core"],e):e(s.CryptoJS);})(z,function(s){return (function(){var e=s,r=e.lib,t=r.WordArray,n=r.Hasher,p=e.algo,a=[],d=p.SHA1=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(m,v){for(var f=this._hash.words,J=f[0],N=f[1],C=f[2],g=f[3],x=f[4],P=0;P<80;P++){if(P<16)a[P]=m[v+P]|0;else {var i=a[P-3]^a[P-8]^a[P-14]^a[P-16];a[P]=i<<1|i>>>31;}var o=(J<<5|J>>>27)+x+a[P];P<20?o+=(N&C|~N&g)+1518500249:P<40?o+=(N^C^g)+1859775393:P<60?o+=(N&C|N&g|C&g)-1894007588:o+=(N^C^g)-899497514,x=g,g=C,C=N<<30|N>>>2,N=J,J=o;}f[0]=f[0]+J|0,f[1]=f[1]+N|0,f[2]=f[2]+C|0,f[3]=f[3]+g|0,f[4]=f[4]+x|0;},_doFinalize:function(){var m=this._data,v=m.words,f=this._nDataBytes*8,J=m.sigBytes*8;return v[J>>>5]|=128<<24-J%32,v[(J+64>>>9<<4)+14]=Math.floor(f/4294967296),v[(J+64>>>9<<4)+15]=f,m.sigBytes=v.length*4,this._process(),this._hash},clone:function(){var m=n.clone.call(this);return m._hash=this._hash.clone(),m}});e.SHA1=n._createHelper(d),e.HmacSHA1=n._createHmacHelper(d);})(),s.SHA1});});var H="___param___";var h;(n=>(n.log=(p,...a)=>console.log(`[Pixi\u2019VN Json] ${p}`,...a),n.warn=(p,...a)=>console.warn(`[Pixi\u2019VN Json] ${p}`,...a),n.error=(p,...a)=>console.error(`[Pixi\u2019VN Json] ${p}`,...a),n.info=(p,...a)=>console.info(`[Pixi\u2019VN Json] ${p}`,...a)))(h||(h={}));var c=class c{static init(e){e.loadAssets&&(c._loadAssets=e.loadAssets),e.soundOperation&&(c._soundOperation=e.soundOperation),e.imageOperation&&(c._imageOperation=e.imageOperation),e.videoOperation&&(c._videoOperation=e.videoOperation),e.imageContainerOperation&&(c._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(c._textOperation=e.textOperation),e.canvasElementOperation&&(c._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(c._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(c._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(c._narrationOperation=e.narrationOperation),e.effectOperation&&(c._effectOperation=e.effectOperation),e.animateOperation&&(c._animateOperation=e.animateOperation),e.getLogichValue&&(c._getLogichValue=e.getLogichValue),e.getConditionalStep&&(c._getConditionalStep=e.getConditionalStep);}static get loadAssets(){return c._loadAssets}static get soundOperation(){return c._soundOperation}static get imageOperation(){return c._imageOperation}static get videoOperation(){return c._videoOperation}static get imageContainerOperation(){return c._imageContainerOperation}static get textOperation(){return c._textOperation}static get canvasElementOperation(){return c._canvasElementOperation}static get setStorageValue(){return c._setStorageValue}static get setInitialStorageValue(){return c._setInitialStorageValue}static get narrationOperation(){return c._narrationOperation}static get effectOperation(){return c._effectOperation}static get animateOperation(){return c._animateOperation}static get getLogichValue(){return c._getLogichValue}static get getConditionalStep(){return c._getConditionalStep}};V(c,"_loadAssets",()=>{}),V(c,"_soundOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_imageOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_videoOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_imageContainerOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_textOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_canvasElementOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_setStorageValue",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_setInitialStorageValue",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_narrationOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_effectOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_animateOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_getLogichValue",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_getConditionalStep",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var T=c;function F(s,e){if(e&&typeof e=="object"&&typeof s.functionName=="string"&&s.functionName in e){let r=e[s.functionName];if(typeof r=="function"){let t=s.args.map(n=>T.getLogichValue(n,e));return r(...t)}else h.warn(`getLogichValue function ${s.functionName} not found in props`);}}function X(s,e={}){let r="";return s.values.forEach(t=>{if(typeof t=="string")r+=t;else {let n=core.JsonUnifier.getLogichValue(t,e);r+=`${n}`;}}),r}async function $(s,e,r){let t=core.JsonUnifier.getLogichValue(s,e);if(t)switch(t.type){case "sound":core.JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await core.JsonUnifier.loadAssets(t);break;case "image":await core.JsonUnifier.imageOperation(t);break;case "video":await core.JsonUnifier.videoOperation(t);break;case "imagecontainer":await core.JsonUnifier.imageContainerOperation(t);break;case "text":await core.JsonUnifier.textOperation(t);break;case "canvaselement":await core.JsonUnifier.canvasElementOperation(t);break;case "value":core.JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(r){let n=X(t,e),p=await r(n);p&&await $(p,e,r);}break;case "input":case "dialogue":core.JsonUnifier.narrationOperation(t);break;case "shake":await core.JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":core.JsonUnifier.animateOperation(t);break;case "function":await F(t,e);break}}function M(s){let e=core.JsonUnifier.getLogichValue(s,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&core.JsonUnifier.setInitialStorageValue(e);}var ee=pe(Z());var _=class extends narration.LabelAbstract{constructor(r,t,n,p={}){n||(n={}),n.onLoadingLabel=async()=>{for(let a of t){let d;if(typeof a=="function"?d=a():d=a,d=core.JsonUnifier.getConditionalStep(d),d.operations)try{let m=d.operations.map(v=>core.JsonUnifier.loadAssets(v));await Promise.all(m);}catch(m){h.error("The operation in the onLoadingLabel function of the label has an error:",m);}}};super(r,n);V(this,"_steps");V(this,"operationStringConvert");V(this,"skipEmptyDialogs",false);this._steps=t,this.operationStringConvert=p.operationStringConvert,this.skipEmptyDialogs=p.skipEmptyDialogs||false;}get steps(){return this._steps.map(r=>this.stepConverter(r))}get stepCount(){return this._steps.length}getStepById(r){if(r<0||r>=this._steps.length)return;let t=this._steps[r];return this.stepConverter(t)}getStepSha(r){if(r<0||r>=this.steps.length)return;let t=this._steps[r];return (0, ee.default)(t.toString().toLocaleLowerCase()).toString()}getDialogueText(r,t){let n="";if(Array.isArray(r)){let p=[];r.forEach(a=>{if(typeof a=="string")p.push(a);else if(a&&typeof a=="object"){let d=core.JsonUnifier.getLogichValue(a,t);d?(d&&!Array.isArray(d)&&typeof d=="object"&&(d=core.JsonUnifier.getLogichValue(d,t)||""),Array.isArray(d)?p=p.map(m=>`${m}`).concat(d):p.push(`${d}`)):p.push(`${a}`);}else p.push(`${a}`);}),n=p;}else {let p=core.JsonUnifier.getLogichValue(r,t);p&&!Array.isArray(p)&&typeof p=="object"&&(p=core.JsonUnifier.getLogichValue(p,t)),p&&Array.isArray(p)?n=p.map(a=>`${a}`):n=`${p}`;}return n}getDialogue(r,t){if(r==null)return;let n=core.JsonUnifier.getLogichValue(r,t);return n==null?`${n}`:typeof n=="object"&&"character"in n&&"text"in n?{character:n.character,text:translator.translator.t(this.getDialogueText(n.text,t))}:translator.translator.t(this.getDialogueText(n,t))}getChoices(r,t){return core.JsonUnifier.getLogichValue(r,t)?.map(a=>core.JsonUnifier.getLogichValue(a,t)).filter(a=>a!==void 0)}stepConverter(r){return async t=>{let n=typeof r=="function"?r():r;n=pixiVn.createExportableElement(n),n=core.JsonUnifier.getConditionalStep(n,t);let p=this.operationStringConvert?g=>this.operationStringConvert(g,n,t):void 0,{operations:a=[]}=n;for(let g of a)await $(g,t,p);let{labelToOpen:d=[]}=n,m=this.getChoices(n.choices,t),v=core.JsonUnifier.getLogichValue(n.glueEnabled,t),f=this.getDialogue(n.dialogue,t),J=[];Array.isArray(d)||(d=[d]),d.forEach(g=>{let x=core.JsonUnifier.getLogichValue(g,t);x&&J.push(x);});let N=core.JsonUnifier.getLogichValue(n.goNextStep,t),C=core.JsonUnifier.getLogichValue(n.end,t);if(m){let g=m.map(x=>{let P="";if(Array.isArray(x.text)){let o=[];x.text.forEach(u=>{if(typeof u=="string")o.push(translator.translator.t(u));else if(u&&typeof u=="object"){let l=core.JsonUnifier.getLogichValue(u,t);l&&!Array.isArray(l)&&typeof l=="object"&&(l=core.JsonUnifier.getLogichValue(l,t)||""),l&&(Array.isArray(l)?o=o.concat(translator.translator.t(l)):o.push(translator.translator.t(l)));}}),P=o;}else typeof x.text=="string"&&(P=translator.translator.t(x.text));return {label:x.label,text:P,props:x.props,type:x.type,oneTime:x.oneTime,onlyHaveNoChoice:x.onlyHaveNoChoice,autoSelect:x.autoSelect}});narration.narration.choices=g;}else narration.narration.choices=void 0;f!==void 0&&(narration.narration.dialogue=f,this.skipEmptyDialogs&&typeof f=="string"&&(f===""||RegExp(/^\s+$/).test(f))&&(N=true)),v?narration.narration.dialogGlue=true:v===false&&(narration.narration.dialogGlue=false);for(let g of J){let x=g.label;typeof x=="object"&&(x=core.JsonUnifier.getLogichValue(x,t)||"");let P=g.params?.map(i=>core.JsonUnifier.getLogichValue(i,t));t={...t,...g.props},g.type==="jump"?(narration.narration.openedLabels.length>0&&narration.narration.closeCurrentLabel(),storage.storage.setTempVariable(`${H}${narration.narration.openedLabels.length}`,P),await narration.narration.call(x,t)):(storage.storage.setTempVariable(`${H}${narration.narration.openedLabels.length}`,P),await narration.narration.call(x,t));}C==="game_end"?(narration.narration.closeAllLabels(),await narration.narration.continue(t,{runNow:true})):C==="label_end"&&narration.narration.closeCurrentLabel(),N&&await narration.narration.continue(t,{runNow:true});}}};async function me(s,e={}){if(!Array.isArray(s))if(typeof s=="object"||typeof s=="string")s=[s];else {h.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let r=s.map(p=>{if(typeof p=="string")try{return JSON.parse(p)}catch(a){return h.error("Error parsing imported Pixi'VN JSON",a),{}}return p}),t=r.map(async p=>{if(p.initialOperations)for(let a of p.initialOperations)a.type==="value"&&(typeof a.value!="object"||!a.value||!("type"in a.value))&&M(a);return Promise.resolve()});await Promise.all(t);let n=r.map(async p=>{if(p.initialOperations)for(let a of p.initialOperations)(a.type!=="value"||a.type==="value"&&typeof a.value=="object"&&a.value&&"type"in a.value)&&M(a);if(p.labels){let a=p.labels;for(let d in a)try{let m=a[d],v=new _(d,m,void 0,e);narration.RegisteredLabels.add(v);}catch(m){h.error(`Error creating JSON label ${d}`,m);}}return Promise.resolve()});await Promise.all(n);}exports.LabelJson=_;exports.importPixiVNJson=me;
@@ -1,4 +1,4 @@
1
- import { P as PixiVNJsonLabelStep, a as PixiVNJsonValueSet, b as PixiVNJsonIfElse, c as PixiVNJsonOperation } from './PixiVNJsonLabelStep-DgN7qF7j.cjs';
1
+ import { P as PixiVNJsonLabelStep, a as PixiVNJsonValueSet, b as PixiVNJsonIfElse, c as PixiVNJsonOperation } from './PixiVNJsonLabelStep-C-9WKwTo.cjs';
2
2
  import { LabelAbstract, LabelProps, StepLabelPropsType, StepLabelType } from '@drincs/pixi-vn/narration';
3
3
  import '@drincs/pixi-vn';
4
4
  import '@drincs/pixi-vn/motion';
@@ -1,4 +1,4 @@
1
- import { P as PixiVNJsonLabelStep, a as PixiVNJsonValueSet, b as PixiVNJsonIfElse, c as PixiVNJsonOperation } from './PixiVNJsonLabelStep-DgN7qF7j.js';
1
+ import { P as PixiVNJsonLabelStep, a as PixiVNJsonValueSet, b as PixiVNJsonIfElse, c as PixiVNJsonOperation } from './PixiVNJsonLabelStep-C-9WKwTo.js';
2
2
  import { LabelAbstract, LabelProps, StepLabelPropsType, StepLabelType } from '@drincs/pixi-vn/narration';
3
3
  import '@drincs/pixi-vn';
4
4
  import '@drincs/pixi-vn/motion';
@@ -1 +1 @@
1
- import {PixiError,createExportableElement}from'@drincs/pixi-vn';import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {translator}from'@drincs/pixi-vn-json/translator';import {LabelAbstract,narration,RegisteredLabels}from'@drincs/pixi-vn/narration';import {storage}from'@drincs/pixi-vn/storage';var te=Object.create;var R=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var ae=(a,e,r)=>e in a?R(a,e,{enumerable:true,configurable:true,writable:true,value:r}):a[e]=r;var D=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var q=(a,e)=>()=>(e||a((e={exports:{}}).exports,e),e.exports);var se=(a,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ne(e))!re.call(a,n)&&n!==r&&R(a,n,{get:()=>e[n],enumerable:!(t=ie(e,n))||t.enumerable});return a};var pe=(a,e,r)=>(r=a!=null?te(oe(a)):{},se(R(r,"default",{value:a,enumerable:true}),a));var V=(a,e,r)=>ae(a,typeof e!="symbol"?e+"":e,r);var Q=q((I,K)=>{(function(a,e){typeof I=="object"?K.exports=I=e():typeof define=="function"&&define.amd?define([],e):a.CryptoJS=e();})(I,function(){var a=a||(function(e,r){var t;if(typeof window<"u"&&window.crypto&&(t=window.crypto),typeof self<"u"&&self.crypto&&(t=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(t=globalThis.crypto),!t&&typeof window<"u"&&window.msCrypto&&(t=window.msCrypto),!t&&typeof global<"u"&&global.crypto&&(t=global.crypto),!t&&typeof D=="function")try{t=D("crypto");}catch{}var n=function(){if(t){if(typeof t.getRandomValues=="function")try{return t.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof t.randomBytes=="function")try{return t.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function i(){}return function(o){var u;return i.prototype=o,u=new i,i.prototype=null,u}})(),p={},d=p.lib={},g=d.Base=(function(){return {extend:function(i){var o=s(this);return i&&o.mixIn(i),(!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 i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var o in i)i.hasOwnProperty(o)&&(this[o]=i[o]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),y=d.WordArray=g.extend({init:function(i,o){i=this.words=i||[],o!=r?this.sigBytes=o:this.sigBytes=i.length*4;},toString:function(i){return (i||J).stringify(this)},concat:function(i){var o=this.words,u=i.words,l=this.sigBytes,S=i.sigBytes;if(this.clamp(),l%4)for(var b=0;b<S;b++){var k=u[b>>>2]>>>24-b%4*8&255;o[l+b>>>2]|=k<<24-(l+b)%4*8;}else for(var j=0;j<S;j+=4)o[l+j>>>2]=u[j>>>2];return this.sigBytes+=S,this},clamp:function(){var i=this.words,o=this.sigBytes;i[o>>>2]&=4294967295<<32-o%4*8,i.length=e.ceil(o/4);},clone:function(){var i=g.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var o=[],u=0;u<i;u+=4)o.push(n());return new y.init(o,i)}}),f=p.enc={},J=f.Hex={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push((b>>>4).toString(16)),l.push((b&15).toString(16));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l+=2)u[l>>>3]|=parseInt(i.substr(l,2),16)<<24-l%8*4;return new y.init(u,o/2)}},N=f.Latin1={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push(String.fromCharCode(b));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l++)u[l>>>2]|=(i.charCodeAt(l)&255)<<24-l%4*8;return new y.init(u,o)}},C=f.Utf8={stringify:function(i){try{return decodeURIComponent(escape(N.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return N.parse(unescape(encodeURIComponent(i)))}},m=d.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new y.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=C.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var o,u=this._data,l=u.words,S=u.sigBytes,b=this.blockSize,k=b*4,j=S/k;i?j=e.ceil(j):j=e.max((j|0)-this._minBufferSize,0);var E=j*b,M=e.min(E*4,S);if(E){for(var z=0;z<E;z+=b)this._doProcessBlock(l,z);o=l.splice(0,E),u.sigBytes-=M;}return new y.init(o,M)},clone:function(){var i=g.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});d.Hasher=m.extend({cfg:g.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){m.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(i){return function(o,u){return new i.init(u).finalize(o)}},_createHmacHelper:function(i){return function(o,u){return new P.HMAC.init(i,u).finalize(o)}}});var P=p.algo={};return p})(Math);return a});});var Z=q((B,Y)=>{(function(a,e){typeof B=="object"?Y.exports=B=e(Q()):typeof define=="function"&&define.amd?define(["./core"],e):e(a.CryptoJS);})(B,function(a){return (function(){var e=a,r=e.lib,t=r.WordArray,n=r.Hasher,s=e.algo,p=[],d=s.SHA1=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,y){for(var f=this._hash.words,J=f[0],N=f[1],C=f[2],m=f[3],x=f[4],P=0;P<80;P++){if(P<16)p[P]=g[y+P]|0;else {var i=p[P-3]^p[P-8]^p[P-14]^p[P-16];p[P]=i<<1|i>>>31;}var o=(J<<5|J>>>27)+x+p[P];P<20?o+=(N&C|~N&m)+1518500249:P<40?o+=(N^C^m)+1859775393:P<60?o+=(N&C|N&m|C&m)-1894007588:o+=(N^C^m)-899497514,x=m,m=C,C=N<<30|N>>>2,N=J,J=o;}f[0]=f[0]+J|0,f[1]=f[1]+N|0,f[2]=f[2]+C|0,f[3]=f[3]+m|0,f[4]=f[4]+x|0;},_doFinalize:function(){var g=this._data,y=g.words,f=this._nDataBytes*8,J=g.sigBytes*8;return y[J>>>5]|=128<<24-J%32,y[(J+64>>>9<<4)+14]=Math.floor(f/4294967296),y[(J+64>>>9<<4)+15]=f,g.sigBytes=y.length*4,this._process(),this._hash},clone:function(){var g=n.clone.call(this);return g._hash=this._hash.clone(),g}});e.SHA1=n._createHelper(d),e.HmacSHA1=n._createHmacHelper(d);})(),a.SHA1});});var H="___param___";var h;(n=>(n.log=(s,...p)=>console.log(`[Pixi\u2019VN Json] ${s}`,...p),n.warn=(s,...p)=>console.warn(`[Pixi\u2019VN Json] ${s}`,...p),n.error=(s,...p)=>console.error(`[Pixi\u2019VN Json] ${s}`,...p),n.info=(s,...p)=>console.info(`[Pixi\u2019VN Json] ${s}`,...p)))(h||(h={}));var c=class c{static init(e){e.loadAssets&&(c._loadAssets=e.loadAssets),e.soundOperation&&(c._soundOperation=e.soundOperation),e.imageOperation&&(c._imageOperation=e.imageOperation),e.videoOperation&&(c._videoOperation=e.videoOperation),e.imageContainerOperation&&(c._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(c._textOperation=e.textOperation),e.canvasElementOperation&&(c._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(c._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(c._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(c._narrationOperation=e.narrationOperation),e.effectOperation&&(c._effectOperation=e.effectOperation),e.animateOperation&&(c._animateOperation=e.animateOperation),e.getLogichValue&&(c._getLogichValue=e.getLogichValue),e.getConditionalStep&&(c._getConditionalStep=e.getConditionalStep);}static get loadAssets(){return c._loadAssets}static get soundOperation(){return c._soundOperation}static get imageOperation(){return c._imageOperation}static get videoOperation(){return c._videoOperation}static get imageContainerOperation(){return c._imageContainerOperation}static get textOperation(){return c._textOperation}static get canvasElementOperation(){return c._canvasElementOperation}static get setStorageValue(){return c._setStorageValue}static get setInitialStorageValue(){return c._setInitialStorageValue}static get narrationOperation(){return c._narrationOperation}static get effectOperation(){return c._effectOperation}static get animateOperation(){return c._animateOperation}static get getLogichValue(){return c._getLogichValue}static get getConditionalStep(){return c._getConditionalStep}};V(c,"_loadAssets",()=>{}),V(c,"_soundOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_imageOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_videoOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_imageContainerOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_textOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_canvasElementOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_setStorageValue",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_setInitialStorageValue",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_narrationOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_effectOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_animateOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_getLogichValue",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_getConditionalStep",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var T=c;function G(a,e){if(e&&typeof e=="object"&&typeof a.functionName=="string"&&a.functionName in e){let r=e[a.functionName];if(typeof r=="function"){let t=a.args.map(n=>T.getLogichValue(n,e));return r(...t)}else h.warn(`getLogichValue function ${a.functionName} not found in props`);}}function F(a,e={}){let r="";return a.values.forEach(t=>{if(typeof t=="string")r+=t;else {let n=JsonUnifier.getLogichValue(t,e);r+=`${n}`;}}),r}async function $(a,e,r){let t=JsonUnifier.getLogichValue(a,e);if(t)switch(t.type){case "sound":JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await JsonUnifier.loadAssets(t);break;case "image":await JsonUnifier.imageOperation(t);break;case "video":await JsonUnifier.videoOperation(t);break;case "imagecontainer":await JsonUnifier.imageContainerOperation(t);break;case "text":await JsonUnifier.textOperation(t);break;case "canvaselement":await JsonUnifier.canvasElementOperation(t);break;case "value":JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(r){let n=F(t,e),s=await r(n);s&&await $(s,e,r);}break;case "input":case "dialogue":JsonUnifier.narrationOperation(t);break;case "shake":await JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":JsonUnifier.animateOperation(t);break;case "function":await G(t,e);break}}function X(a){let e=JsonUnifier.getLogichValue(a,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&JsonUnifier.setInitialStorageValue(e);}var ee=pe(Z());var _=class extends LabelAbstract{constructor(r,t,n,s={}){n||(n={}),n.onLoadingLabel=async()=>{for(let p of t){let d;if(typeof p=="function"?d=p():d=p,d=JsonUnifier.getConditionalStep(d),d.operations)try{let g=d.operations.map(y=>JsonUnifier.loadAssets(y));await Promise.all(g);}catch(g){h.error("The operation in the onLoadingLabel function of the label has an error:",g);}}};super(r,n);V(this,"_steps");V(this,"operationStringConvert");V(this,"skipEmptyDialogs",false);this._steps=t,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}get steps(){return this._steps.map(r=>this.stepConverter(r))}get stepCount(){return this._steps.length}getStepById(r){if(r<0||r>=this._steps.length)return;let t=this._steps[r];return this.stepConverter(t)}getStepSha(r){if(r<0||r>=this.steps.length)return;let t=this._steps[r];return (0, ee.default)(t.toString().toLocaleLowerCase()).toString()}getDialogueText(r,t){let n="";if(Array.isArray(r)){let s=[];r.forEach(p=>{if(typeof p=="string")s.push(p);else if(p&&typeof p=="object"){let d=JsonUnifier.getLogichValue(p,t);d?(d&&!Array.isArray(d)&&typeof d=="object"&&(d=JsonUnifier.getLogichValue(d,t)||""),Array.isArray(d)?s=s.map(g=>`${g}`).concat(d):s.push(`${d}`)):s.push(`${p}`);}else s.push(`${p}`);}),n=s;}else {let s=JsonUnifier.getLogichValue(r,t);s&&!Array.isArray(s)&&typeof s=="object"&&(s=JsonUnifier.getLogichValue(s,t)),s&&Array.isArray(s)?n=s.map(p=>`${p}`):n=`${s}`;}return n}getDialogue(r,t){if(r==null)return;let n=JsonUnifier.getLogichValue(r,t);return n==null?`${n}`:typeof n=="object"&&"character"in n&&"text"in n?{character:n.character,text:translator.t(this.getDialogueText(n.text,t))}:translator.t(this.getDialogueText(n,t))}getChoices(r,t){return JsonUnifier.getLogichValue(r,t)?.map(p=>JsonUnifier.getLogichValue(p,t)).filter(p=>p!==void 0)}stepConverter(r){return async t=>{let n=typeof r=="function"?r():r;n=createExportableElement(n),n=JsonUnifier.getConditionalStep(n,t);let s=this.operationStringConvert?m=>this.operationStringConvert(m,n,t):void 0,{operations:p=[]}=n;for(let m of p)await $(m,t,s);let{labelToOpen:d=[]}=n,g=this.getChoices(n.choices,t),y=JsonUnifier.getLogichValue(n.glueEnabled,t),f=this.getDialogue(n.dialogue,t),J=[];Array.isArray(d)||(d=[d]),d.forEach(m=>{let x=JsonUnifier.getLogichValue(m,t);x&&J.push(x);});let N=JsonUnifier.getLogichValue(n.goNextStep,t),C=JsonUnifier.getLogichValue(n.end,t);if(g){let m=g.map(x=>{let P="";if(Array.isArray(x.text)){let o=[];x.text.forEach(u=>{if(typeof u=="string")o.push(translator.t(u));else if(u&&typeof u=="object"){let l=JsonUnifier.getLogichValue(u,t);l&&!Array.isArray(l)&&typeof l=="object"&&(l=JsonUnifier.getLogichValue(l,t)||""),l&&(Array.isArray(l)?o=o.concat(translator.t(l)):o.push(translator.t(l)));}}),P=o;}else typeof x.text=="string"&&(P=translator.t(x.text));return {label:x.label,text:P,props:x.props,type:x.type,oneTime:x.oneTime,onlyHaveNoChoice:x.onlyHaveNoChoice,autoSelect:x.autoSelect}});narration.choices=m;}else narration.choices=void 0;f!==void 0&&(narration.dialogue=f,this.skipEmptyDialogs&&typeof f=="string"&&(f===""||RegExp(/^\s+$/).test(f))&&(N=true)),y?narration.dialogGlue=true:y===false&&(narration.dialogGlue=false);for(let m of J){let x=m.label;typeof x=="object"&&(x=JsonUnifier.getLogichValue(x,t)||"");let P=m.params?.map(i=>JsonUnifier.getLogichValue(i,t));t={...t,...m.props},m.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${H}${narration.openedLabels.length}`,P),await narration.call(x,t)):(storage.setTempVariable(`${H}${narration.openedLabels.length}`,P),await narration.call(x,t));}C==="game_end"?(narration.closeAllLabels(),await narration.continue(t,{runNow:true})):C==="label_end"&&narration.closeCurrentLabel(),N&&await narration.continue(t,{runNow:true});}}};async function ge(a,e={}){if(!Array.isArray(a))if(typeof a=="object"||typeof a=="string")a=[a];else {h.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let t=a.map(n=>{if(typeof n=="string")try{return JSON.parse(n)}catch(s){return h.error("Error parsing imported Pixi'VN JSON",s),{}}return n}).map(async n=>{if(n.initialOperations)for(let s of n.initialOperations)X(s);if(n.labels){let s=n.labels;for(let p in s)try{let d=s[p],g=new _(p,d,void 0,e);RegisteredLabels.add(g);}catch(d){h.error(`Error creating JSON label ${p}`,d);}}});await Promise.all(t);}export{_ as LabelJson,ge as importPixiVNJson};
1
+ import {PixiError,createExportableElement}from'@drincs/pixi-vn';import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {translator}from'@drincs/pixi-vn-json/translator';import {LabelAbstract,narration,RegisteredLabels}from'@drincs/pixi-vn/narration';import {storage}from'@drincs/pixi-vn/storage';var te=Object.create;var R=Object.defineProperty;var ie=Object.getOwnPropertyDescriptor;var ne=Object.getOwnPropertyNames;var oe=Object.getPrototypeOf,re=Object.prototype.hasOwnProperty;var ae=(s,e,r)=>e in s?R(s,e,{enumerable:true,configurable:true,writable:true,value:r}):s[e]=r;var D=(s=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(s,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):s)(function(s){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+s+'" is not supported')});var W=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var se=(s,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of ne(e))!re.call(s,n)&&n!==r&&R(s,n,{get:()=>e[n],enumerable:!(t=ie(e,n))||t.enumerable});return s};var pe=(s,e,r)=>(r=s!=null?te(oe(s)):{},se(R(r,"default",{value:s,enumerable:true}),s));var V=(s,e,r)=>ae(s,typeof e!="symbol"?e+"":e,r);var Q=W((I,K)=>{(function(s,e){typeof I=="object"?K.exports=I=e():typeof define=="function"&&define.amd?define([],e):s.CryptoJS=e();})(I,function(){var s=s||(function(e,r){var t;if(typeof window<"u"&&window.crypto&&(t=window.crypto),typeof self<"u"&&self.crypto&&(t=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(t=globalThis.crypto),!t&&typeof window<"u"&&window.msCrypto&&(t=window.msCrypto),!t&&typeof global<"u"&&global.crypto&&(t=global.crypto),!t&&typeof D=="function")try{t=D("crypto");}catch{}var n=function(){if(t){if(typeof t.getRandomValues=="function")try{return t.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof t.randomBytes=="function")try{return t.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},p=Object.create||(function(){function i(){}return function(o){var u;return i.prototype=o,u=new i,i.prototype=null,u}})(),a={},d=a.lib={},m=d.Base=(function(){return {extend:function(i){var o=p(this);return i&&o.mixIn(i),(!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 i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var o in i)i.hasOwnProperty(o)&&(this[o]=i[o]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),v=d.WordArray=m.extend({init:function(i,o){i=this.words=i||[],o!=r?this.sigBytes=o:this.sigBytes=i.length*4;},toString:function(i){return (i||J).stringify(this)},concat:function(i){var o=this.words,u=i.words,l=this.sigBytes,S=i.sigBytes;if(this.clamp(),l%4)for(var b=0;b<S;b++){var B=u[b>>>2]>>>24-b%4*8&255;o[l+b>>>2]|=B<<24-(l+b)%4*8;}else for(var j=0;j<S;j+=4)o[l+j>>>2]=u[j>>>2];return this.sigBytes+=S,this},clamp:function(){var i=this.words,o=this.sigBytes;i[o>>>2]&=4294967295<<32-o%4*8,i.length=e.ceil(o/4);},clone:function(){var i=m.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var o=[],u=0;u<i;u+=4)o.push(n());return new v.init(o,i)}}),f=a.enc={},J=f.Hex={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push((b>>>4).toString(16)),l.push((b&15).toString(16));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l+=2)u[l>>>3]|=parseInt(i.substr(l,2),16)<<24-l%8*4;return new v.init(u,o/2)}},N=f.Latin1={stringify:function(i){for(var o=i.words,u=i.sigBytes,l=[],S=0;S<u;S++){var b=o[S>>>2]>>>24-S%4*8&255;l.push(String.fromCharCode(b));}return l.join("")},parse:function(i){for(var o=i.length,u=[],l=0;l<o;l++)u[l>>>2]|=(i.charCodeAt(l)&255)<<24-l%4*8;return new v.init(u,o)}},C=f.Utf8={stringify:function(i){try{return decodeURIComponent(escape(N.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return N.parse(unescape(encodeURIComponent(i)))}},g=d.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new v.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=C.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var o,u=this._data,l=u.words,S=u.sigBytes,b=this.blockSize,B=b*4,j=S/B;i?j=e.ceil(j):j=e.max((j|0)-this._minBufferSize,0);var E=j*b,q=e.min(E*4,S);if(E){for(var k=0;k<E;k+=b)this._doProcessBlock(l,k);o=l.splice(0,E),u.sigBytes-=q;}return new v.init(o,q)},clone:function(){var i=m.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});d.Hasher=g.extend({cfg:m.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){g.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var o=this._doFinalize();return o},blockSize:512/32,_createHelper:function(i){return function(o,u){return new i.init(u).finalize(o)}},_createHmacHelper:function(i){return function(o,u){return new P.HMAC.init(i,u).finalize(o)}}});var P=a.algo={};return a})(Math);return s});});var Z=W((z,Y)=>{(function(s,e){typeof z=="object"?Y.exports=z=e(Q()):typeof define=="function"&&define.amd?define(["./core"],e):e(s.CryptoJS);})(z,function(s){return (function(){var e=s,r=e.lib,t=r.WordArray,n=r.Hasher,p=e.algo,a=[],d=p.SHA1=n.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(m,v){for(var f=this._hash.words,J=f[0],N=f[1],C=f[2],g=f[3],x=f[4],P=0;P<80;P++){if(P<16)a[P]=m[v+P]|0;else {var i=a[P-3]^a[P-8]^a[P-14]^a[P-16];a[P]=i<<1|i>>>31;}var o=(J<<5|J>>>27)+x+a[P];P<20?o+=(N&C|~N&g)+1518500249:P<40?o+=(N^C^g)+1859775393:P<60?o+=(N&C|N&g|C&g)-1894007588:o+=(N^C^g)-899497514,x=g,g=C,C=N<<30|N>>>2,N=J,J=o;}f[0]=f[0]+J|0,f[1]=f[1]+N|0,f[2]=f[2]+C|0,f[3]=f[3]+g|0,f[4]=f[4]+x|0;},_doFinalize:function(){var m=this._data,v=m.words,f=this._nDataBytes*8,J=m.sigBytes*8;return v[J>>>5]|=128<<24-J%32,v[(J+64>>>9<<4)+14]=Math.floor(f/4294967296),v[(J+64>>>9<<4)+15]=f,m.sigBytes=v.length*4,this._process(),this._hash},clone:function(){var m=n.clone.call(this);return m._hash=this._hash.clone(),m}});e.SHA1=n._createHelper(d),e.HmacSHA1=n._createHmacHelper(d);})(),s.SHA1});});var H="___param___";var h;(n=>(n.log=(p,...a)=>console.log(`[Pixi\u2019VN Json] ${p}`,...a),n.warn=(p,...a)=>console.warn(`[Pixi\u2019VN Json] ${p}`,...a),n.error=(p,...a)=>console.error(`[Pixi\u2019VN Json] ${p}`,...a),n.info=(p,...a)=>console.info(`[Pixi\u2019VN Json] ${p}`,...a)))(h||(h={}));var c=class c{static init(e){e.loadAssets&&(c._loadAssets=e.loadAssets),e.soundOperation&&(c._soundOperation=e.soundOperation),e.imageOperation&&(c._imageOperation=e.imageOperation),e.videoOperation&&(c._videoOperation=e.videoOperation),e.imageContainerOperation&&(c._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(c._textOperation=e.textOperation),e.canvasElementOperation&&(c._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(c._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(c._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(c._narrationOperation=e.narrationOperation),e.effectOperation&&(c._effectOperation=e.effectOperation),e.animateOperation&&(c._animateOperation=e.animateOperation),e.getLogichValue&&(c._getLogichValue=e.getLogichValue),e.getConditionalStep&&(c._getConditionalStep=e.getConditionalStep);}static get loadAssets(){return c._loadAssets}static get soundOperation(){return c._soundOperation}static get imageOperation(){return c._imageOperation}static get videoOperation(){return c._videoOperation}static get imageContainerOperation(){return c._imageContainerOperation}static get textOperation(){return c._textOperation}static get canvasElementOperation(){return c._canvasElementOperation}static get setStorageValue(){return c._setStorageValue}static get setInitialStorageValue(){return c._setInitialStorageValue}static get narrationOperation(){return c._narrationOperation}static get effectOperation(){return c._effectOperation}static get animateOperation(){return c._animateOperation}static get getLogichValue(){return c._getLogichValue}static get getConditionalStep(){return c._getConditionalStep}};V(c,"_loadAssets",()=>{}),V(c,"_soundOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_imageOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_videoOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_imageContainerOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_textOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_canvasElementOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_setStorageValue",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_setInitialStorageValue",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_narrationOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_effectOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_animateOperation",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_getLogichValue",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")}),V(c,"_getConditionalStep",()=>{throw h.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")});var T=c;function F(s,e){if(e&&typeof e=="object"&&typeof s.functionName=="string"&&s.functionName in e){let r=e[s.functionName];if(typeof r=="function"){let t=s.args.map(n=>T.getLogichValue(n,e));return r(...t)}else h.warn(`getLogichValue function ${s.functionName} not found in props`);}}function X(s,e={}){let r="";return s.values.forEach(t=>{if(typeof t=="string")r+=t;else {let n=JsonUnifier.getLogichValue(t,e);r+=`${n}`;}}),r}async function $(s,e,r){let t=JsonUnifier.getLogichValue(s,e);if(t)switch(t.type){case "sound":JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await JsonUnifier.loadAssets(t);break;case "image":await JsonUnifier.imageOperation(t);break;case "video":await JsonUnifier.videoOperation(t);break;case "imagecontainer":await JsonUnifier.imageContainerOperation(t);break;case "text":await JsonUnifier.textOperation(t);break;case "canvaselement":await JsonUnifier.canvasElementOperation(t);break;case "value":JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(r){let n=X(t,e),p=await r(n);p&&await $(p,e,r);}break;case "input":case "dialogue":JsonUnifier.narrationOperation(t);break;case "shake":await JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":JsonUnifier.animateOperation(t);break;case "function":await F(t,e);break}}function M(s){let e=JsonUnifier.getLogichValue(s,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&JsonUnifier.setInitialStorageValue(e);}var ee=pe(Z());var _=class extends LabelAbstract{constructor(r,t,n,p={}){n||(n={}),n.onLoadingLabel=async()=>{for(let a of t){let d;if(typeof a=="function"?d=a():d=a,d=JsonUnifier.getConditionalStep(d),d.operations)try{let m=d.operations.map(v=>JsonUnifier.loadAssets(v));await Promise.all(m);}catch(m){h.error("The operation in the onLoadingLabel function of the label has an error:",m);}}};super(r,n);V(this,"_steps");V(this,"operationStringConvert");V(this,"skipEmptyDialogs",false);this._steps=t,this.operationStringConvert=p.operationStringConvert,this.skipEmptyDialogs=p.skipEmptyDialogs||false;}get steps(){return this._steps.map(r=>this.stepConverter(r))}get stepCount(){return this._steps.length}getStepById(r){if(r<0||r>=this._steps.length)return;let t=this._steps[r];return this.stepConverter(t)}getStepSha(r){if(r<0||r>=this.steps.length)return;let t=this._steps[r];return (0, ee.default)(t.toString().toLocaleLowerCase()).toString()}getDialogueText(r,t){let n="";if(Array.isArray(r)){let p=[];r.forEach(a=>{if(typeof a=="string")p.push(a);else if(a&&typeof a=="object"){let d=JsonUnifier.getLogichValue(a,t);d?(d&&!Array.isArray(d)&&typeof d=="object"&&(d=JsonUnifier.getLogichValue(d,t)||""),Array.isArray(d)?p=p.map(m=>`${m}`).concat(d):p.push(`${d}`)):p.push(`${a}`);}else p.push(`${a}`);}),n=p;}else {let p=JsonUnifier.getLogichValue(r,t);p&&!Array.isArray(p)&&typeof p=="object"&&(p=JsonUnifier.getLogichValue(p,t)),p&&Array.isArray(p)?n=p.map(a=>`${a}`):n=`${p}`;}return n}getDialogue(r,t){if(r==null)return;let n=JsonUnifier.getLogichValue(r,t);return n==null?`${n}`:typeof n=="object"&&"character"in n&&"text"in n?{character:n.character,text:translator.t(this.getDialogueText(n.text,t))}:translator.t(this.getDialogueText(n,t))}getChoices(r,t){return JsonUnifier.getLogichValue(r,t)?.map(a=>JsonUnifier.getLogichValue(a,t)).filter(a=>a!==void 0)}stepConverter(r){return async t=>{let n=typeof r=="function"?r():r;n=createExportableElement(n),n=JsonUnifier.getConditionalStep(n,t);let p=this.operationStringConvert?g=>this.operationStringConvert(g,n,t):void 0,{operations:a=[]}=n;for(let g of a)await $(g,t,p);let{labelToOpen:d=[]}=n,m=this.getChoices(n.choices,t),v=JsonUnifier.getLogichValue(n.glueEnabled,t),f=this.getDialogue(n.dialogue,t),J=[];Array.isArray(d)||(d=[d]),d.forEach(g=>{let x=JsonUnifier.getLogichValue(g,t);x&&J.push(x);});let N=JsonUnifier.getLogichValue(n.goNextStep,t),C=JsonUnifier.getLogichValue(n.end,t);if(m){let g=m.map(x=>{let P="";if(Array.isArray(x.text)){let o=[];x.text.forEach(u=>{if(typeof u=="string")o.push(translator.t(u));else if(u&&typeof u=="object"){let l=JsonUnifier.getLogichValue(u,t);l&&!Array.isArray(l)&&typeof l=="object"&&(l=JsonUnifier.getLogichValue(l,t)||""),l&&(Array.isArray(l)?o=o.concat(translator.t(l)):o.push(translator.t(l)));}}),P=o;}else typeof x.text=="string"&&(P=translator.t(x.text));return {label:x.label,text:P,props:x.props,type:x.type,oneTime:x.oneTime,onlyHaveNoChoice:x.onlyHaveNoChoice,autoSelect:x.autoSelect}});narration.choices=g;}else narration.choices=void 0;f!==void 0&&(narration.dialogue=f,this.skipEmptyDialogs&&typeof f=="string"&&(f===""||RegExp(/^\s+$/).test(f))&&(N=true)),v?narration.dialogGlue=true:v===false&&(narration.dialogGlue=false);for(let g of J){let x=g.label;typeof x=="object"&&(x=JsonUnifier.getLogichValue(x,t)||"");let P=g.params?.map(i=>JsonUnifier.getLogichValue(i,t));t={...t,...g.props},g.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${H}${narration.openedLabels.length}`,P),await narration.call(x,t)):(storage.setTempVariable(`${H}${narration.openedLabels.length}`,P),await narration.call(x,t));}C==="game_end"?(narration.closeAllLabels(),await narration.continue(t,{runNow:true})):C==="label_end"&&narration.closeCurrentLabel(),N&&await narration.continue(t,{runNow:true});}}};async function me(s,e={}){if(!Array.isArray(s))if(typeof s=="object"||typeof s=="string")s=[s];else {h.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let r=s.map(p=>{if(typeof p=="string")try{return JSON.parse(p)}catch(a){return h.error("Error parsing imported Pixi'VN JSON",a),{}}return p}),t=r.map(async p=>{if(p.initialOperations)for(let a of p.initialOperations)a.type==="value"&&(typeof a.value!="object"||!a.value||!("type"in a.value))&&M(a);return Promise.resolve()});await Promise.all(t);let n=r.map(async p=>{if(p.initialOperations)for(let a of p.initialOperations)(a.type!=="value"||a.type==="value"&&typeof a.value=="object"&&a.value&&"type"in a.value)&&M(a);if(p.labels){let a=p.labels;for(let d in a)try{let m=a[d],v=new _(d,m,void 0,e);RegisteredLabels.add(v);}catch(m){h.error(`Error creating JSON label ${d}`,m);}}return Promise.resolve()});await Promise.all(n);}export{_ as LabelJson,me as importPixiVNJson};
package/dist/schema.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { w as PixiVNJsonLabelStep, n as PixiVNJsonValueSet, a as PixiVNJsonIfElse } from './PixiVNJsonLabelStep-dVwPLFMT.cjs';
2
- export { x as PixiVNJsonAnimateBase, y as PixiVNJsonAnimateSequence, t as PixiVNJsonArithmeticOperations, z as PixiVNJsonArithmeticOperationsArithmetic, A as PixiVNJsonArithmeticOperationsArithmeticSingle, B as PixiVNJsonCanvas, r as PixiVNJsonCanvasAnimate, C as PixiVNJsonCanvasEdit, q as PixiVNJsonCanvasEffect, i as PixiVNJsonCanvasImageContainerShow, d as PixiVNJsonCanvasImageVideoShow, f as PixiVNJsonCanvasRemove, D as PixiVNJsonCanvasShow, k as PixiVNJsonCanvasTextShow, E as PixiVNJsonChoice, F as PixiVNJsonChoiceGet, G as PixiVNJsonChoices, H as PixiVNJsonComparation, I as PixiVNJsonComparationOperatorsType, J as PixiVNJsonConditionalOperation, K as PixiVNJsonConditionalResultToCombine, v as PixiVNJsonConditionalStatements, u as PixiVNJsonConditions, L as PixiVNJsonDialog, M as PixiVNJsonDialogText, N as PixiVNJsonFunction, j as PixiVNJsonImageContainerEdit, e as PixiVNJsonImageEdit, O as PixiVNJsonLabelGet, Q as PixiVNJsonLabelToOpen, R as PixiVNJsonLogicGet, S as PixiVNJsonMediaTransiotions, p as PixiVNJsonNarration, o as PixiVNJsonOnlyStorageSet, P as PixiVNJsonOperation, b as PixiVNJsonOperationString, T as PixiVNJsonParamGet, c as PixiVNJsonSound, U as PixiVNJsonStepSwitch, V as PixiVNJsonStepSwitchElementType, W as PixiVNJsonStepSwitchElementsType, X as PixiVNJsonStorageGet, l as PixiVNJsonTextEdit, Y as PixiVNJsonUnionCondition, m as PixiVNJsonUnknownEdit, s as PixiVNJsonValueGet, g as PixiVNJsonVideoEdit, h as PixiVNJsonVideoPauseResume } from './PixiVNJsonLabelStep-dVwPLFMT.cjs';
1
+ import { w as PixiVNJsonLabelStep, n as PixiVNJsonValueSet, a as PixiVNJsonIfElse } from './PixiVNJsonLabelStep-B335RwgE.cjs';
2
+ export { x as PixiVNJsonAnimateBase, y as PixiVNJsonAnimateSequence, t as PixiVNJsonArithmeticOperations, z as PixiVNJsonArithmeticOperationsArithmetic, A as PixiVNJsonArithmeticOperationsArithmeticSingle, B as PixiVNJsonCanvas, r as PixiVNJsonCanvasAnimate, C as PixiVNJsonCanvasEdit, q as PixiVNJsonCanvasEffect, i as PixiVNJsonCanvasImageContainerShow, d as PixiVNJsonCanvasImageVideoShow, f as PixiVNJsonCanvasRemove, D as PixiVNJsonCanvasShow, k as PixiVNJsonCanvasTextShow, E as PixiVNJsonChoice, F as PixiVNJsonChoiceGet, G as PixiVNJsonChoices, H as PixiVNJsonComparation, I as PixiVNJsonComparationOperatorsType, J as PixiVNJsonConditionalOperation, K as PixiVNJsonConditionalResultToCombine, v as PixiVNJsonConditionalStatements, u as PixiVNJsonConditions, L as PixiVNJsonDialog, M as PixiVNJsonDialogText, N as PixiVNJsonDialogue, O as PixiVNJsonFunction, j as PixiVNJsonImageContainerEdit, e as PixiVNJsonImageEdit, Q as PixiVNJsonInputRequest, R as PixiVNJsonLabelGet, S as PixiVNJsonLabelToOpen, T as PixiVNJsonLogicGet, U as PixiVNJsonMediaTransiotions, p as PixiVNJsonNarration, o as PixiVNJsonOnlyStorageSet, P as PixiVNJsonOperation, b as PixiVNJsonOperationString, V as PixiVNJsonParamGet, c as PixiVNJsonSound, W as PixiVNJsonSoundEdit, X as PixiVNJsonSoundPauseResume, Y as PixiVNJsonSoundPlay, Z as PixiVNJsonSoundRemove, _ as PixiVNJsonStepSwitch, $ as PixiVNJsonStepSwitchElementType, a0 as PixiVNJsonStepSwitchElementsType, a1 as PixiVNJsonStorageGet, l as PixiVNJsonTextEdit, a2 as PixiVNJsonUnionCondition, m as PixiVNJsonUnknownEdit, s as PixiVNJsonValueGet, g as PixiVNJsonVideoEdit, h as PixiVNJsonVideoPauseResume } from './PixiVNJsonLabelStep-B335RwgE.cjs';
3
3
  import '@drincs/pixi-vn';
4
4
  import '@drincs/pixi-vn/motion';
5
5
  import 'pixi.js';
package/dist/schema.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { w as PixiVNJsonLabelStep, n as PixiVNJsonValueSet, a as PixiVNJsonIfElse } from './PixiVNJsonLabelStep-dVwPLFMT.js';
2
- export { x as PixiVNJsonAnimateBase, y as PixiVNJsonAnimateSequence, t as PixiVNJsonArithmeticOperations, z as PixiVNJsonArithmeticOperationsArithmetic, A as PixiVNJsonArithmeticOperationsArithmeticSingle, B as PixiVNJsonCanvas, r as PixiVNJsonCanvasAnimate, C as PixiVNJsonCanvasEdit, q as PixiVNJsonCanvasEffect, i as PixiVNJsonCanvasImageContainerShow, d as PixiVNJsonCanvasImageVideoShow, f as PixiVNJsonCanvasRemove, D as PixiVNJsonCanvasShow, k as PixiVNJsonCanvasTextShow, E as PixiVNJsonChoice, F as PixiVNJsonChoiceGet, G as PixiVNJsonChoices, H as PixiVNJsonComparation, I as PixiVNJsonComparationOperatorsType, J as PixiVNJsonConditionalOperation, K as PixiVNJsonConditionalResultToCombine, v as PixiVNJsonConditionalStatements, u as PixiVNJsonConditions, L as PixiVNJsonDialog, M as PixiVNJsonDialogText, N as PixiVNJsonFunction, j as PixiVNJsonImageContainerEdit, e as PixiVNJsonImageEdit, O as PixiVNJsonLabelGet, Q as PixiVNJsonLabelToOpen, R as PixiVNJsonLogicGet, S as PixiVNJsonMediaTransiotions, p as PixiVNJsonNarration, o as PixiVNJsonOnlyStorageSet, P as PixiVNJsonOperation, b as PixiVNJsonOperationString, T as PixiVNJsonParamGet, c as PixiVNJsonSound, U as PixiVNJsonStepSwitch, V as PixiVNJsonStepSwitchElementType, W as PixiVNJsonStepSwitchElementsType, X as PixiVNJsonStorageGet, l as PixiVNJsonTextEdit, Y as PixiVNJsonUnionCondition, m as PixiVNJsonUnknownEdit, s as PixiVNJsonValueGet, g as PixiVNJsonVideoEdit, h as PixiVNJsonVideoPauseResume } from './PixiVNJsonLabelStep-dVwPLFMT.js';
1
+ import { w as PixiVNJsonLabelStep, n as PixiVNJsonValueSet, a as PixiVNJsonIfElse } from './PixiVNJsonLabelStep-B335RwgE.js';
2
+ export { x as PixiVNJsonAnimateBase, y as PixiVNJsonAnimateSequence, t as PixiVNJsonArithmeticOperations, z as PixiVNJsonArithmeticOperationsArithmetic, A as PixiVNJsonArithmeticOperationsArithmeticSingle, B as PixiVNJsonCanvas, r as PixiVNJsonCanvasAnimate, C as PixiVNJsonCanvasEdit, q as PixiVNJsonCanvasEffect, i as PixiVNJsonCanvasImageContainerShow, d as PixiVNJsonCanvasImageVideoShow, f as PixiVNJsonCanvasRemove, D as PixiVNJsonCanvasShow, k as PixiVNJsonCanvasTextShow, E as PixiVNJsonChoice, F as PixiVNJsonChoiceGet, G as PixiVNJsonChoices, H as PixiVNJsonComparation, I as PixiVNJsonComparationOperatorsType, J as PixiVNJsonConditionalOperation, K as PixiVNJsonConditionalResultToCombine, v as PixiVNJsonConditionalStatements, u as PixiVNJsonConditions, L as PixiVNJsonDialog, M as PixiVNJsonDialogText, N as PixiVNJsonDialogue, O as PixiVNJsonFunction, j as PixiVNJsonImageContainerEdit, e as PixiVNJsonImageEdit, Q as PixiVNJsonInputRequest, R as PixiVNJsonLabelGet, S as PixiVNJsonLabelToOpen, T as PixiVNJsonLogicGet, U as PixiVNJsonMediaTransiotions, p as PixiVNJsonNarration, o as PixiVNJsonOnlyStorageSet, P as PixiVNJsonOperation, b as PixiVNJsonOperationString, V as PixiVNJsonParamGet, c as PixiVNJsonSound, W as PixiVNJsonSoundEdit, X as PixiVNJsonSoundPauseResume, Y as PixiVNJsonSoundPlay, Z as PixiVNJsonSoundRemove, _ as PixiVNJsonStepSwitch, $ as PixiVNJsonStepSwitchElementType, a0 as PixiVNJsonStepSwitchElementsType, a1 as PixiVNJsonStorageGet, l as PixiVNJsonTextEdit, a2 as PixiVNJsonUnionCondition, m as PixiVNJsonUnknownEdit, s as PixiVNJsonValueGet, g as PixiVNJsonVideoEdit, h as PixiVNJsonVideoPauseResume } from './PixiVNJsonLabelStep-B335RwgE.js';
3
3
  import '@drincs/pixi-vn';
4
4
  import '@drincs/pixi-vn/motion';
5
5
  import 'pixi.js';
@@ -277,13 +277,14 @@ interface PixiVNJsonArithmeticOperationsArithmetic {
277
277
  * Operator of the arithmetic operation:
278
278
  * - `"*"` multiplication
279
279
  * - `"/"` division
280
- * - `"+"` addition
281
- * - `"-"` subtraction
280
+ * - `"+"` addition (concatenation for strings and arrays)
281
+ * - `"-"` subtraction (removal of elements for arrays)
282
282
  * - `"%"` modulo
283
283
  * - `"POW"` exponentiation
284
284
  * - `"RANDOM"` random integer between leftValue and rightValue (inclusive)
285
+ * - `"INTERSECTION"` intersection of two arrays (only elements present in both arrays are included in the result)
285
286
  */
286
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
287
+ operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM" | "INTERSECTION";
287
288
  }
288
289
  /**
289
290
  * Unary arithmetic operation applied to a single value (e.g. INT, FLOOR, FLOAT).
@@ -346,7 +347,7 @@ type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionC
346
347
  * - `"<="` less than or equal
347
348
  * - `">"` greater than
348
349
  * - `">="` greater than or equal
349
- * - `"CONTAINS"` checks whether the left string/array contains the right value
350
+ * - `"CONTAINS"` checks whether the left string/array contains the right value, if left and right are arrays, checks if all items in right are included in left
350
351
  */
351
352
  type PixiVNJsonComparationOperatorsType = "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
352
353
  /**
@@ -388,6 +389,13 @@ interface PixiVNJsonIfElse<Then> {
388
389
  type: "ifelse";
389
390
  /**
390
391
  * The list of conditions to be checked.
392
+ *
393
+ * if is a {@link StorageElementType} or a {@link PixiVNJsonValueGet}:
394
+ * - if is a array or object, the condition is true if not empty
395
+ * - if is a string, the condition is true if not empty
396
+ * - if is a number, the condition is true if not zero
397
+ * - if is a boolean, the condition is true if true
398
+ * - if is null or undefined, the condition is false
391
399
  */
392
400
  condition: PixiVNJsonConditions;
393
401
  /**
@@ -277,13 +277,14 @@ interface PixiVNJsonArithmeticOperationsArithmetic {
277
277
  * Operator of the arithmetic operation:
278
278
  * - `"*"` multiplication
279
279
  * - `"/"` division
280
- * - `"+"` addition
281
- * - `"-"` subtraction
280
+ * - `"+"` addition (concatenation for strings and arrays)
281
+ * - `"-"` subtraction (removal of elements for arrays)
282
282
  * - `"%"` modulo
283
283
  * - `"POW"` exponentiation
284
284
  * - `"RANDOM"` random integer between leftValue and rightValue (inclusive)
285
+ * - `"INTERSECTION"` intersection of two arrays (only elements present in both arrays are included in the result)
285
286
  */
286
- operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM";
287
+ operator: "*" | "/" | "+" | "-" | "%" | "POW" | "RANDOM" | "INTERSECTION";
287
288
  }
288
289
  /**
289
290
  * Unary arithmetic operation applied to a single value (e.g. INT, FLOOR, FLOAT).
@@ -346,7 +347,7 @@ type PixiVNJsonUnionCondition = PixiVNJsonUnionConditionAndOr | PixiVNJsonUnionC
346
347
  * - `"<="` less than or equal
347
348
  * - `">"` greater than
348
349
  * - `">="` greater than or equal
349
- * - `"CONTAINS"` checks whether the left string/array contains the right value
350
+ * - `"CONTAINS"` checks whether the left string/array contains the right value, if left and right are arrays, checks if all items in right are included in left
350
351
  */
351
352
  type PixiVNJsonComparationOperatorsType = "==" | "!=" | "<" | "<=" | ">" | ">=" | "CONTAINS";
352
353
  /**
@@ -388,6 +389,13 @@ interface PixiVNJsonIfElse<Then> {
388
389
  type: "ifelse";
389
390
  /**
390
391
  * The list of conditions to be checked.
392
+ *
393
+ * if is a {@link StorageElementType} or a {@link PixiVNJsonValueGet}:
394
+ * - if is a array or object, the condition is true if not empty
395
+ * - if is a string, the condition is true if not empty
396
+ * - if is a number, the condition is true if not zero
397
+ * - if is a boolean, the condition is true if true
398
+ * - if is null or undefined, the condition is false
391
399
  */
392
400
  condition: PixiVNJsonConditions;
393
401
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn-json",
3
- "version": "1.13.0",
3
+ "version": "1.13.2",
4
4
  "type": "module",
5
5
  "description": "Pixi'VN can be integrated with JSON files to create a visual novel.",
6
6
  "main": "./dist/index.cjs",
@@ -108,11 +108,12 @@
108
108
  "typedoc": "^0.28.19",
109
109
  "typedoc-plugin-markdown": "^4.11.0",
110
110
  "typescript": "^6.0.3",
111
- "typescript-json-schema": "^0.67.1",
111
+ "typescript-json-schema": "^0.67.2",
112
112
  "vite-tsconfig-paths": "^6.1.1"
113
113
  },
114
114
  "peerDependencies": {
115
- "@drincs/pixi-vn": ">=1.8.0"
115
+ "@drincs/pixi-vn": ">=1.8.0",
116
+ "zod": ">=4.4.0"
116
117
  },
117
118
  "keywords": [
118
119
  "game",
@@ -125,6 +126,7 @@
125
126
  "visual-novel"
126
127
  ],
127
128
  "dependencies": {
128
- "vitest": "^3.2.4"
129
+ "vitest": "^3.2.4",
130
+ "zod": "^4.4.3"
129
131
  }
130
132
  }