@drincs/pixi-vn-json 1.10.3 → 1.11.0
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.
- package/dist/core.cjs +2 -1
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +9 -8
- package/dist/core.d.ts +9 -8
- package/dist/core.mjs +2 -1
- package/dist/core.mjs.map +1 -0
- package/dist/importer.cjs +2 -1
- package/dist/importer.cjs.map +1 -0
- package/dist/importer.d.cts +9 -8
- package/dist/importer.d.ts +9 -8
- package/dist/importer.mjs +2 -1
- package/dist/importer.mjs.map +1 -0
- package/dist/index.cjs +2 -2
- package/dist/index.d.cts +9 -8
- package/dist/index.d.ts +9 -8
- package/dist/index.mjs +2 -2
- package/dist/translator.cjs +2 -1
- package/dist/translator.cjs.map +1 -0
- package/dist/translator.d.cts +9 -8
- package/dist/translator.d.ts +9 -8
- package/dist/translator.mjs +2 -1
- package/dist/translator.mjs.map +1 -0
- package/package.json +4 -4
package/dist/importer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory,
|
|
1
|
+
import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptionsWithChannel, IMediaInstance, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
|
|
2
2
|
import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
|
|
3
3
|
import { UPDATE_PRIORITY } from 'pixi.js';
|
|
4
4
|
import { LabelAbstract, LabelProps, StepLabelPropsType as StepLabelPropsType$1, StepLabelType } from '@drincs/pixi-vn/narration';
|
|
@@ -352,7 +352,7 @@ type PixiVNJsonTextEdit = {
|
|
|
352
352
|
alias: string;
|
|
353
353
|
props?: Partial<TextMemory>;
|
|
354
354
|
};
|
|
355
|
-
type PixiVNJsonUnknownEdit<T extends ContainerOptions
|
|
355
|
+
type PixiVNJsonUnknownEdit<T extends ContainerOptions<any>> = {
|
|
356
356
|
type: "canvaselement";
|
|
357
357
|
operationType: "edit";
|
|
358
358
|
alias: string;
|
|
@@ -394,7 +394,8 @@ type PixiVNJsonSoundPlay = {
|
|
|
394
394
|
type: "sound";
|
|
395
395
|
operationType: "play";
|
|
396
396
|
alias: string;
|
|
397
|
-
|
|
397
|
+
url?: string;
|
|
398
|
+
props?: SoundPlayOptionsWithChannel;
|
|
398
399
|
};
|
|
399
400
|
type PixiVNJsonSoundRemove = {
|
|
400
401
|
type: "sound";
|
|
@@ -402,17 +403,17 @@ type PixiVNJsonSoundRemove = {
|
|
|
402
403
|
alias: string;
|
|
403
404
|
};
|
|
404
405
|
type PixiVNJsonSoundPauseResume = {
|
|
405
|
-
type: "sound";
|
|
406
|
+
type: "sound" | "channel" | "all";
|
|
406
407
|
operationType: "pause" | "resume";
|
|
407
408
|
alias: string;
|
|
408
409
|
};
|
|
409
|
-
type
|
|
410
|
+
type PixiVNJsonSoundEdit = {
|
|
410
411
|
type: "sound";
|
|
411
|
-
operationType: "
|
|
412
|
+
operationType: "edit";
|
|
412
413
|
alias: string;
|
|
413
|
-
|
|
414
|
+
props: Partial<Pick<IMediaInstance, "speed" | "volume" | "muted" | "loop" | "paused">>;
|
|
414
415
|
};
|
|
415
|
-
type PixiVNJsonSound = PixiVNJsonSoundPlay | PixiVNJsonSoundRemove | PixiVNJsonSoundPauseResume |
|
|
416
|
+
type PixiVNJsonSound = PixiVNJsonSoundPlay | PixiVNJsonSoundRemove | PixiVNJsonSoundPauseResume | PixiVNJsonSoundEdit;
|
|
416
417
|
|
|
417
418
|
type PixiVNJsonOperationString = {
|
|
418
419
|
type: "operationtoconvert";
|
package/dist/importer.mjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
import {RegisteredLabels,LabelAbstract,narration}from'@drincs/pixi-vn/narration';import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {createExportableElement}from'@drincs/pixi-vn';import {translator}from'@drincs/pixi-vn-json/translator';import {storage}from'@drincs/pixi-vn/storage';var K=Object.create;var E=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var te=(a,i,t)=>i in a?E(a,i,{enumerable:true,configurable:true,writable:true,value:t}):a[i]=t;var H=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(i,t)=>(typeof require<"u"?require:i)[t]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var R=(a,i)=>()=>(i||a((i={exports:{}}).exports,i),i.exports);var ie=(a,i,t,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of Y(i))!ee.call(a,n)&&n!==t&&E(a,n,{get:()=>i[n],enumerable:!(o=Q(i,n))||o.enumerable});return a};var ne=(a,i,t)=>(t=a!=null?K(Z(a)):{},ie(E(t,"default",{value:a,enumerable:true}),a));var T=(a,i,t)=>te(a,typeof i!="symbol"?i+"":i,t);var q=R((A,U)=>{(function(a,i){typeof A=="object"?U.exports=A=i():typeof define=="function"&&define.amd?define([],i):a.CryptoJS=i();})(A,function(){var a=a||(function(i,t){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof global<"u"&&global.crypto&&(o=global.crypto),!o&&typeof H=="function")try{o=H("crypto");}catch{}var n=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function e(){}return function(r){var c;return e.prototype=r,c=new e,e.prototype=null,c}})(),l={},u=l.lib={},g=u.Base=(function(){return {extend:function(e){var r=s(this);return e&&r.mixIn(e),(!r.hasOwnProperty("init")||this.init===r.init)&&(r.init=function(){r.$super.init.apply(this,arguments);}),r.init.prototype=r,r.$super=this,r},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var r in e)e.hasOwnProperty(r)&&(this[r]=e[r]);e.hasOwnProperty("toString")&&(this.toString=e.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),x=u.WordArray=g.extend({init:function(e,r){e=this.words=e||[],r!=t?this.sigBytes=r:this.sigBytes=e.length*4;},toString:function(e){return (e||V).stringify(this)},concat:function(e){var r=this.words,c=e.words,f=this.sigBytes,v=e.sigBytes;if(this.clamp(),f%4)for(var P=0;P<v;P++){var k=c[P>>>2]>>>24-P%4*8&255;r[f+P>>>2]|=k<<24-(f+P)%4*8;}else for(var L=0;L<v;L+=4)r[f+L>>>2]=c[L>>>2];return this.sigBytes+=v,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=i.ceil(r/4);},clone:function(){var e=g.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var r=[],c=0;c<e;c+=4)r.push(n());return new x.init(r,e)}}),p=l.enc={},V=p.Hex={stringify:function(e){for(var r=e.words,c=e.sigBytes,f=[],v=0;v<c;v++){var P=r[v>>>2]>>>24-v%4*8&255;f.push((P>>>4).toString(16)),f.push((P&15).toString(16));}return f.join("")},parse:function(e){for(var r=e.length,c=[],f=0;f<r;f+=2)c[f>>>3]|=parseInt(e.substr(f,2),16)<<24-f%8*4;return new x.init(c,r/2)}},b=p.Latin1={stringify:function(e){for(var r=e.words,c=e.sigBytes,f=[],v=0;v<c;v++){var P=r[v>>>2]>>>24-v%4*8&255;f.push(String.fromCharCode(P));}return f.join("")},parse:function(e){for(var r=e.length,c=[],f=0;f<r;f++)c[f>>>2]|=(e.charCodeAt(f)&255)<<24-f%4*8;return new x.init(c,r)}},N=p.Utf8={stringify:function(e){try{return decodeURIComponent(escape(b.stringify(e)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(e){return b.parse(unescape(encodeURIComponent(e)))}},h=u.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new x.init,this._nDataBytes=0;},_append:function(e){typeof e=="string"&&(e=N.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes;},_process:function(e){var r,c=this._data,f=c.words,v=c.sigBytes,P=this.blockSize,k=P*4,L=v/k;e?L=i.ceil(L):L=i.max((L|0)-this._minBufferSize,0);var C=L*P,j=i.min(C*4,v);if(C){for(var D=0;D<C;D+=P)this._doProcessBlock(f,D);r=f.splice(0,C),c.sigBytes-=j;}return new x.init(r,j)},clone:function(){var e=g.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});u.Hasher=h.extend({cfg:g.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset();},reset:function(){h.reset.call(this),this._doReset();},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var r=this._doFinalize();return r},blockSize:512/32,_createHelper:function(e){return function(r,c){return new e.init(c).finalize(r)}},_createHmacHelper:function(e){return function(r,c){return new y.HMAC.init(e,c).finalize(r)}}});var y=l.algo={};return l})(Math);return a});});var M=R((B,F)=>{(function(a,i){typeof B=="object"?F.exports=B=i(q()):typeof define=="function"&&define.amd?define(["./core"],i):i(a.CryptoJS);})(B,function(a){return (function(){var i=a,t=i.lib,o=t.WordArray,n=t.Hasher,s=i.algo,l=[],u=s.SHA1=n.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,x){for(var p=this._hash.words,V=p[0],b=p[1],N=p[2],h=p[3],d=p[4],y=0;y<80;y++){if(y<16)l[y]=g[x+y]|0;else {var e=l[y-3]^l[y-8]^l[y-14]^l[y-16];l[y]=e<<1|e>>>31;}var r=(V<<5|V>>>27)+d+l[y];y<20?r+=(b&N|~b&h)+1518500249:y<40?r+=(b^N^h)+1859775393:y<60?r+=(b&N|b&h|N&h)-1894007588:r+=(b^N^h)-899497514,d=h,h=N,N=b<<30|b>>>2,b=V,V=r;}p[0]=p[0]+V|0,p[1]=p[1]+b|0,p[2]=p[2]+N|0,p[3]=p[3]+h|0,p[4]=p[4]+d|0;},_doFinalize:function(){var g=this._data,x=g.words,p=this._nDataBytes*8,V=g.sigBytes*8;return x[V>>>5]|=128<<24-V%32,x[(V+64>>>9<<4)+14]=Math.floor(p/4294967296),x[(V+64>>>9<<4)+15]=p,g.sigBytes=x.length*4,this._process(),this._hash},clone:function(){var g=n.clone.call(this);return g._hash=this._hash.clone(),g}});i.SHA1=n._createHelper(u),i.HmacSHA1=n._createHmacHelper(u);})(),a.SHA1});});var w;(n=>(n.log=(s,...l)=>console.log(`[Pixi\u2019VN Json] ${s}`,...l),n.warn=(s,...l)=>console.warn(`[Pixi\u2019VN Json] ${s}`,...l),n.error=(s,...l)=>console.error(`[Pixi\u2019VN Json] ${s}`,...l),n.info=(s,...l)=>console.info(`[Pixi\u2019VN Json] ${s}`,...l)))(w||(w={}));function z(a){let i="";return a.values.forEach(t=>{if(typeof t=="string")i+=t;else {let o=JsonUnifier.getLogichValue(t);i+=`${o}`;}}),i}async function I(a,i){let t=JsonUnifier.getLogichValue(a);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);break;case "operationtoconvert":if(i){let o=z(t),n=await i(o);n&&await I(n,i);}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}}function W(a){let i=JsonUnifier.getLogichValue(a);i&&i.type==="value"&&i.storageOperationType==="set"&&(i.storageType==="storage"||i.storageType==="tempstorage")&&JsonUnifier.setInitialStorageValue(i);}async function ae(a,i={}){if(!Array.isArray(a))if(typeof a=="object"||typeof a=="string")a=[a];else {w.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let t=a.map(async s=>{if(typeof s=="string")try{s=JSON.parse(s);}catch(l){w.error("Error parsing imported Pixi'VN JSON",l),s={};}return s}),n=(await Promise.all(t)).map(async s=>{let l=[];if(s.initialOperations)for(let u of s.initialOperations)W(u);if(s.labels){let u=s.labels;for(let g in u)try{let x=u[g],p=new _(g,x,void 0,i);RegisteredLabels.add(p);}catch(x){w.error(`Error creating JSON label ${g}`,x);}}return Promise.all(l)});await Promise.all(n);}var X=ne(M());var $="___param___";var _=class extends LabelAbstract{constructor(t,o,n,s={}){n||(n={}),n.onLoadingLabel=async()=>{for(let l of o){let u;if(typeof l=="function"?u=l():u=l,u=JsonUnifier.getConditionalStep(u),u.operations)try{let g=u.operations.map(x=>JsonUnifier.loadAssets(x));await Promise.all(g);}catch(g){w.error("The operation in the onLoadingLabel function of the label has an error:",g);}}};super(t,n);T(this,"_steps");T(this,"operationStringConvert");T(this,"skipEmptyDialogs",false);this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}get steps(){return this._steps.map(t=>this.stepConverter(t))}get stepCount(){return this._steps.length}getStepById(t){if(t<0||t>=this._steps.length)return;let o=this._steps[t];return this.stepConverter(o)}getStepSha(t){if(t<0||t>=this.steps.length)return;let o=this._steps[t];return (0, X.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let o="";if(Array.isArray(t)){let n=[];t.forEach(s=>{if(typeof s=="string")n.push(s);else if(s&&typeof s=="object"){let l=JsonUnifier.getLogichValue(s);l?(l&&!Array.isArray(l)&&typeof l=="object"&&(l=JsonUnifier.getLogichValue(l)||""),Array.isArray(l)?n=n.map(u=>`${u}`).concat(l):n.push(`${l}`)):n.push(`${s}`);}else n.push(`${s}`);}),o=n;}else {let n=JsonUnifier.getLogichValue(t);n&&!Array.isArray(n)&&typeof n=="object"&&(n=JsonUnifier.getLogichValue(n)),n&&Array.isArray(n)?o=n.map(s=>`${s}`):o=`${n}`;}return o}getDialogue(t){if(t==null)return;let o=JsonUnifier.getLogichValue(t);return o==null?`${o}`:typeof o=="object"&&"character"in o&&"text"in o?{character:o.character,text:translator.t(this.getDialogueText(o.text))}:translator.t(this.getDialogueText(o))}getChoices(t){return JsonUnifier.getLogichValue(t)?.map(s=>JsonUnifier.getLogichValue(s)).filter(s=>s!==void 0)}stepConverter(t){return async o=>{let n=typeof t=="function"?t():t;n=createExportableElement(n),n=JsonUnifier.getConditionalStep(n);let s=this.operationStringConvert?h=>this.operationStringConvert(h,n,o):void 0,{operations:l=[]}=n;for(let h of l)await I(h,s);let{labelToOpen:u=[]}=n,g=this.getChoices(n.choices),x=JsonUnifier.getLogichValue(n.glueEnabled),p=this.getDialogue(n.dialogue),V=[];Array.isArray(u)||(u=[u]),u.forEach(h=>{let d=JsonUnifier.getLogichValue(h);d&&V.push(d);});let b=JsonUnifier.getLogichValue(n.goNextStep),N=JsonUnifier.getLogichValue(n.end);if(g){let h=g.map(d=>{let y="";if(Array.isArray(d.text)){let r=[];d.text.forEach(c=>{if(typeof c=="string")r.push(translator.t(c));else if(c&&typeof c=="object"){let f=JsonUnifier.getLogichValue(c);f&&!Array.isArray(f)&&typeof f=="object"&&(f=JsonUnifier.getLogichValue(f)||""),f&&(Array.isArray(f)?r=r.concat(translator.t(f)):r.push(translator.t(f)));}}),y=r;}else typeof d.text=="string"&&(y=translator.t(d.text));return {label:d.label,text:y,props:d.props,type:d.type,oneTime:d.oneTime,onlyHaveNoChoice:d.onlyHaveNoChoice,autoSelect:d.autoSelect}});narration.choices=h;}else narration.choices=void 0;p!==void 0&&(narration.dialogue=p,this.skipEmptyDialogs&&typeof p=="string"&&(p===""||RegExp(/^\s+$/).test(p))&&(b=true)),x?narration.dialogGlue=true:x===false&&(narration.dialogGlue=false);for(let h of V){let d=h.label;typeof d=="object"&&(d=JsonUnifier.getLogichValue(d)||"");let y=h.params?.map(e=>JsonUnifier.getLogichValue(e));o={...o,...h.props},h.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${$}${narration.openedLabels.length}`,y),await narration.call(d,o)):(storage.setTempVariable(`${$}${narration.openedLabels.length}`,y),await narration.call(d,o));}N==="game_end"?(narration.closeAllLabels(),await narration.continue(o,{runNow:true})):N==="label_end"&&narration.closeCurrentLabel(),b&&await narration.continue(o,{runNow:true});}}};export{_ as LabelJson,ae as importPixiVNJson};
|
|
1
|
+
import {RegisteredLabels,LabelAbstract,narration}from'@drincs/pixi-vn/narration';import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {createExportableElement}from'@drincs/pixi-vn';import {translator}from'@drincs/pixi-vn-json/translator';import {storage}from'@drincs/pixi-vn/storage';var K=Object.create;var E=Object.defineProperty;var Q=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var Z=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var te=(a,i,t)=>i in a?E(a,i,{enumerable:true,configurable:true,writable:true,value:t}):a[i]=t;var H=(a=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(i,t)=>(typeof require<"u"?require:i)[t]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});var R=(a,i)=>()=>(i||a((i={exports:{}}).exports,i),i.exports);var ie=(a,i,t,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of Y(i))!ee.call(a,n)&&n!==t&&E(a,n,{get:()=>i[n],enumerable:!(o=Q(i,n))||o.enumerable});return a};var ne=(a,i,t)=>(t=a!=null?K(Z(a)):{},ie(E(t,"default",{value:a,enumerable:true}),a));var T=(a,i,t)=>te(a,typeof i!="symbol"?i+"":i,t);var q=R((A,U)=>{(function(a,i){typeof A=="object"?U.exports=A=i():typeof define=="function"&&define.amd?define([],i):a.CryptoJS=i();})(A,function(){var a=a||(function(i,t){var o;if(typeof window<"u"&&window.crypto&&(o=window.crypto),typeof self<"u"&&self.crypto&&(o=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(o=globalThis.crypto),!o&&typeof window<"u"&&window.msCrypto&&(o=window.msCrypto),!o&&typeof global<"u"&&global.crypto&&(o=global.crypto),!o&&typeof H=="function")try{o=H("crypto");}catch{}var n=function(){if(o){if(typeof o.getRandomValues=="function")try{return o.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof o.randomBytes=="function")try{return o.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},s=Object.create||(function(){function e(){}return function(r){var c;return e.prototype=r,c=new e,e.prototype=null,c}})(),l={},u=l.lib={},g=u.Base=(function(){return {extend:function(e){var r=s(this);return e&&r.mixIn(e),(!r.hasOwnProperty("init")||this.init===r.init)&&(r.init=function(){r.$super.init.apply(this,arguments);}),r.init.prototype=r,r.$super=this,r},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var r in e)e.hasOwnProperty(r)&&(this[r]=e[r]);e.hasOwnProperty("toString")&&(this.toString=e.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),x=u.WordArray=g.extend({init:function(e,r){e=this.words=e||[],r!=t?this.sigBytes=r:this.sigBytes=e.length*4;},toString:function(e){return (e||V).stringify(this)},concat:function(e){var r=this.words,c=e.words,f=this.sigBytes,v=e.sigBytes;if(this.clamp(),f%4)for(var P=0;P<v;P++){var k=c[P>>>2]>>>24-P%4*8&255;r[f+P>>>2]|=k<<24-(f+P)%4*8;}else for(var L=0;L<v;L+=4)r[f+L>>>2]=c[L>>>2];return this.sigBytes+=v,this},clamp:function(){var e=this.words,r=this.sigBytes;e[r>>>2]&=4294967295<<32-r%4*8,e.length=i.ceil(r/4);},clone:function(){var e=g.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var r=[],c=0;c<e;c+=4)r.push(n());return new x.init(r,e)}}),p=l.enc={},V=p.Hex={stringify:function(e){for(var r=e.words,c=e.sigBytes,f=[],v=0;v<c;v++){var P=r[v>>>2]>>>24-v%4*8&255;f.push((P>>>4).toString(16)),f.push((P&15).toString(16));}return f.join("")},parse:function(e){for(var r=e.length,c=[],f=0;f<r;f+=2)c[f>>>3]|=parseInt(e.substr(f,2),16)<<24-f%8*4;return new x.init(c,r/2)}},b=p.Latin1={stringify:function(e){for(var r=e.words,c=e.sigBytes,f=[],v=0;v<c;v++){var P=r[v>>>2]>>>24-v%4*8&255;f.push(String.fromCharCode(P));}return f.join("")},parse:function(e){for(var r=e.length,c=[],f=0;f<r;f++)c[f>>>2]|=(e.charCodeAt(f)&255)<<24-f%4*8;return new x.init(c,r)}},N=p.Utf8={stringify:function(e){try{return decodeURIComponent(escape(b.stringify(e)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(e){return b.parse(unescape(encodeURIComponent(e)))}},h=u.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new x.init,this._nDataBytes=0;},_append:function(e){typeof e=="string"&&(e=N.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes;},_process:function(e){var r,c=this._data,f=c.words,v=c.sigBytes,P=this.blockSize,k=P*4,L=v/k;e?L=i.ceil(L):L=i.max((L|0)-this._minBufferSize,0);var C=L*P,j=i.min(C*4,v);if(C){for(var D=0;D<C;D+=P)this._doProcessBlock(f,D);r=f.splice(0,C),c.sigBytes-=j;}return new x.init(r,j)},clone:function(){var e=g.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});u.Hasher=h.extend({cfg:g.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset();},reset:function(){h.reset.call(this),this._doReset();},update:function(e){return this._append(e),this._process(),this},finalize:function(e){e&&this._append(e);var r=this._doFinalize();return r},blockSize:512/32,_createHelper:function(e){return function(r,c){return new e.init(c).finalize(r)}},_createHmacHelper:function(e){return function(r,c){return new y.HMAC.init(e,c).finalize(r)}}});var y=l.algo={};return l})(Math);return a});});var M=R((B,F)=>{(function(a,i){typeof B=="object"?F.exports=B=i(q()):typeof define=="function"&&define.amd?define(["./core"],i):i(a.CryptoJS);})(B,function(a){return (function(){var i=a,t=i.lib,o=t.WordArray,n=t.Hasher,s=i.algo,l=[],u=s.SHA1=n.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,x){for(var p=this._hash.words,V=p[0],b=p[1],N=p[2],h=p[3],d=p[4],y=0;y<80;y++){if(y<16)l[y]=g[x+y]|0;else {var e=l[y-3]^l[y-8]^l[y-14]^l[y-16];l[y]=e<<1|e>>>31;}var r=(V<<5|V>>>27)+d+l[y];y<20?r+=(b&N|~b&h)+1518500249:y<40?r+=(b^N^h)+1859775393:y<60?r+=(b&N|b&h|N&h)-1894007588:r+=(b^N^h)-899497514,d=h,h=N,N=b<<30|b>>>2,b=V,V=r;}p[0]=p[0]+V|0,p[1]=p[1]+b|0,p[2]=p[2]+N|0,p[3]=p[3]+h|0,p[4]=p[4]+d|0;},_doFinalize:function(){var g=this._data,x=g.words,p=this._nDataBytes*8,V=g.sigBytes*8;return x[V>>>5]|=128<<24-V%32,x[(V+64>>>9<<4)+14]=Math.floor(p/4294967296),x[(V+64>>>9<<4)+15]=p,g.sigBytes=x.length*4,this._process(),this._hash},clone:function(){var g=n.clone.call(this);return g._hash=this._hash.clone(),g}});i.SHA1=n._createHelper(u),i.HmacSHA1=n._createHmacHelper(u);})(),a.SHA1});});var w;(n=>(n.log=(s,...l)=>console.log(`[Pixi\u2019VN Json] ${s}`,...l),n.warn=(s,...l)=>console.warn(`[Pixi\u2019VN Json] ${s}`,...l),n.error=(s,...l)=>console.error(`[Pixi\u2019VN Json] ${s}`,...l),n.info=(s,...l)=>console.info(`[Pixi\u2019VN Json] ${s}`,...l)))(w||(w={}));function z(a){let i="";return a.values.forEach(t=>{if(typeof t=="string")i+=t;else {let o=JsonUnifier.getLogichValue(t);i+=`${o}`;}}),i}async function I(a,i){let t=JsonUnifier.getLogichValue(a);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);break;case "operationtoconvert":if(i){let o=z(t),n=await i(o);n&&await I(n,i);}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}}function W(a){let i=JsonUnifier.getLogichValue(a);i&&i.type==="value"&&i.storageOperationType==="set"&&(i.storageType==="storage"||i.storageType==="tempstorage")&&JsonUnifier.setInitialStorageValue(i);}async function ae(a,i={}){if(!Array.isArray(a))if(typeof a=="object"||typeof a=="string")a=[a];else {w.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let t=a.map(async s=>{if(typeof s=="string")try{s=JSON.parse(s);}catch(l){w.error("Error parsing imported Pixi'VN JSON",l),s={};}return s}),n=(await Promise.all(t)).map(async s=>{let l=[];if(s.initialOperations)for(let u of s.initialOperations)W(u);if(s.labels){let u=s.labels;for(let g in u)try{let x=u[g],p=new _(g,x,void 0,i);RegisteredLabels.add(p);}catch(x){w.error(`Error creating JSON label ${g}`,x);}}return Promise.all(l)});await Promise.all(n);}var X=ne(M());var $="___param___";var _=class extends LabelAbstract{constructor(t,o,n,s={}){n||(n={}),n.onLoadingLabel=async()=>{for(let l of o){let u;if(typeof l=="function"?u=l():u=l,u=JsonUnifier.getConditionalStep(u),u.operations)try{let g=u.operations.map(x=>JsonUnifier.loadAssets(x));await Promise.all(g);}catch(g){w.error("The operation in the onLoadingLabel function of the label has an error:",g);}}};super(t,n);T(this,"_steps");T(this,"operationStringConvert");T(this,"skipEmptyDialogs",false);this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}get steps(){return this._steps.map(t=>this.stepConverter(t))}get stepCount(){return this._steps.length}getStepById(t){if(t<0||t>=this._steps.length)return;let o=this._steps[t];return this.stepConverter(o)}getStepSha(t){if(t<0||t>=this.steps.length)return;let o=this._steps[t];return (0, X.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let o="";if(Array.isArray(t)){let n=[];t.forEach(s=>{if(typeof s=="string")n.push(s);else if(s&&typeof s=="object"){let l=JsonUnifier.getLogichValue(s);l?(l&&!Array.isArray(l)&&typeof l=="object"&&(l=JsonUnifier.getLogichValue(l)||""),Array.isArray(l)?n=n.map(u=>`${u}`).concat(l):n.push(`${l}`)):n.push(`${s}`);}else n.push(`${s}`);}),o=n;}else {let n=JsonUnifier.getLogichValue(t);n&&!Array.isArray(n)&&typeof n=="object"&&(n=JsonUnifier.getLogichValue(n)),n&&Array.isArray(n)?o=n.map(s=>`${s}`):o=`${n}`;}return o}getDialogue(t){if(t==null)return;let o=JsonUnifier.getLogichValue(t);return o==null?`${o}`:typeof o=="object"&&"character"in o&&"text"in o?{character:o.character,text:translator.t(this.getDialogueText(o.text))}:translator.t(this.getDialogueText(o))}getChoices(t){return JsonUnifier.getLogichValue(t)?.map(s=>JsonUnifier.getLogichValue(s)).filter(s=>s!==void 0)}stepConverter(t){return async o=>{let n=typeof t=="function"?t():t;n=createExportableElement(n),n=JsonUnifier.getConditionalStep(n);let s=this.operationStringConvert?h=>this.operationStringConvert(h,n,o):void 0,{operations:l=[]}=n;for(let h of l)await I(h,s);let{labelToOpen:u=[]}=n,g=this.getChoices(n.choices),x=JsonUnifier.getLogichValue(n.glueEnabled),p=this.getDialogue(n.dialogue),V=[];Array.isArray(u)||(u=[u]),u.forEach(h=>{let d=JsonUnifier.getLogichValue(h);d&&V.push(d);});let b=JsonUnifier.getLogichValue(n.goNextStep),N=JsonUnifier.getLogichValue(n.end);if(g){let h=g.map(d=>{let y="";if(Array.isArray(d.text)){let r=[];d.text.forEach(c=>{if(typeof c=="string")r.push(translator.t(c));else if(c&&typeof c=="object"){let f=JsonUnifier.getLogichValue(c);f&&!Array.isArray(f)&&typeof f=="object"&&(f=JsonUnifier.getLogichValue(f)||""),f&&(Array.isArray(f)?r=r.concat(translator.t(f)):r.push(translator.t(f)));}}),y=r;}else typeof d.text=="string"&&(y=translator.t(d.text));return {label:d.label,text:y,props:d.props,type:d.type,oneTime:d.oneTime,onlyHaveNoChoice:d.onlyHaveNoChoice,autoSelect:d.autoSelect}});narration.choices=h;}else narration.choices=void 0;p!==void 0&&(narration.dialogue=p,this.skipEmptyDialogs&&typeof p=="string"&&(p===""||RegExp(/^\s+$/).test(p))&&(b=true)),x?narration.dialogGlue=true:x===false&&(narration.dialogGlue=false);for(let h of V){let d=h.label;typeof d=="object"&&(d=JsonUnifier.getLogichValue(d)||"");let y=h.params?.map(e=>JsonUnifier.getLogichValue(e));o={...o,...h.props},h.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${$}${narration.openedLabels.length}`,y),await narration.call(d,o)):(storage.setTempVariable(`${$}${narration.openedLabels.length}`,y),await narration.call(d,o));}N==="game_end"?(narration.closeAllLabels(),await narration.continue(o,{runNow:true})):N==="label_end"&&narration.closeCurrentLabel(),b&&await narration.continue(o,{runNow:true});}}};export{_ as LabelJson,ae as importPixiVNJson};//# sourceMappingURL=importer.mjs.map
|
|
2
|
+
//# sourceMappingURL=importer.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../node_modules/crypto-js/core.js","../node_modules/crypto-js/sha1.js","../src/utils/log-utility.ts","../src/utils/operationtoconvert.ts","../src/importer/operation-utility.ts","../src/importer/importer.ts","../src/importer/LabelJson.ts","../src/constants.ts"],"names":["require_core","__commonJSMin","exports","module","root","factory","CryptoJS","Math","undefined","crypto","__require","cryptoSecureRandomInt","create","F","obj","subtype","C","C_lib","Base","overrides","instance","properties","propertyName","WordArray","words","sigBytes","encoder","Hex","wordArray","thisWords","thatWords","thisSigBytes","thatSigBytes","i","thatByte","j","clone","nBytes","C_enc","hexChars","bite","hexStr","hexStrLength","Latin1","latin1Chars","latin1Str","latin1StrLength","Utf8","utf8Str","BufferedBlockAlgorithm","data","doFlush","processedWords","dataWords","dataSigBytes","blockSize","blockSizeBytes","nBlocksReady","nWordsReady","nBytesReady","offset","cfg","messageUpdate","hash","hasher","message","key","C_algo","require_sha1","Hasher","W","SHA1","M","H","a","c","d","e","n","t","nBitsTotal","nBitsLeft","logger","optionalParams","operationStringToString","operation","stringOperation","value","res","JsonUnifier","runOperation","origin","operationStringConvert","op","runInitialOperation","importPixiVNJson","values","options","jsonsPromises","promises","labels","labelId","steps","label","LabelJson","RegisteredLabels","import_sha1","PIXIVNJSON_PARAM_ID","LabelAbstract","id","props","stepProp","step","error","__publicField","stepId","index","sha1","text","texts","v","dialogue","translator","option","createExportableElement","operations","tempLabelToOpen","choices","glueEnabled","labelToOpen","goNextStep","end","narration","labelString","labelParams","param","storage"],"mappings":"kSAAA,IAAA,CAAA,CAAA,MAAA,CAAA,MAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,cAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,wBAAA,CAAA,IAAA,CAAA,CAAA,MAAA,CAAA,mBAAA,CAAA,IAAA,CAAA,CAAA,MA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,eAAe8C,CAAK,CAC1C,CAAA,CACDzB,CAAAA,CAAQ,CACJ,GAAGA,CAAAA,CACH,GAAGP,CAAAA,CAAM,KACb,CAAA,CACIA,CAAAA,CAAM,IAAA,GAAS,MAAA,EACX6B,UAAU,YAAA,CAAa,MAAA,CAAS,CAAA,EAAGA,SAAAA,CAAU,mBAAkB,CACnEI,OAAAA,CAAQ,eAAA,CAAgB,CAAA,EAAG7B,CAAmB,CAAA,EAAGyB,SAAAA,CAAU,YAAA,CAAa,MAAM,GAAIE,CAAW,CAAA,CAC7F,MAAMF,SAAAA,CAAU,KAAKC,CAAAA,CAAavB,CAAK,CAAA,GAEvC0B,OAAAA,CAAQ,gBAAgB,CAAA,EAAG7B,CAAmB,CAAA,EAAGyB,SAAAA,CAAU,aAAa,MAAM,CAAA,CAAA,CAAIE,CAAW,CAAA,CAC7F,MAAMF,SAAAA,CAAU,IAAA,CAAKC,CAAAA,CAAavB,CAAK,GAE/C,CAEIqB,CAAAA,GAAQ,UAAA,EACRC,SAAAA,CAAU,gBAAe,CACzB,MAAMA,SAAAA,CAAU,QAAA,CAAStB,EAAO,CAAE,MAAA,CAAQ,IAAK,CAAC,GACzCqB,CAAAA,GAAQ,WAAA,EACfC,SAAAA,CAAU,iBAAA,GAGVF,CAAAA,EACA,MAAME,SAAAA,CAAU,QAAA,CAAStB,EAAO,CAAE,MAAA,CAAQ,IAAK,CAAC,EAExD,CACJ,CACJ","file":"importer.mjs","sourcesContent":[";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory();\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\troot.CryptoJS = factory();\n\t}\n}(this, function () {\n\n\t/*globals window, global, require*/\n\n\t/**\n\t * CryptoJS core components.\n\t */\n\tvar CryptoJS = CryptoJS || (function (Math, undefined) {\n\n\t var crypto;\n\n\t // Native crypto from window (Browser)\n\t if (typeof window !== 'undefined' && window.crypto) {\n\t crypto = window.crypto;\n\t }\n\n\t // Native crypto in web worker (Browser)\n\t if (typeof self !== 'undefined' && self.crypto) {\n\t crypto = self.crypto;\n\t }\n\n\t // Native crypto from worker\n\t if (typeof globalThis !== 'undefined' && globalThis.crypto) {\n\t crypto = globalThis.crypto;\n\t }\n\n\t // Native (experimental IE 11) crypto from window (Browser)\n\t if (!crypto && typeof window !== 'undefined' && window.msCrypto) {\n\t crypto = window.msCrypto;\n\t }\n\n\t // Native crypto from global (NodeJS)\n\t if (!crypto && typeof global !== 'undefined' && global.crypto) {\n\t crypto = global.crypto;\n\t }\n\n\t // Native crypto import via require (NodeJS)\n\t if (!crypto && typeof require === 'function') {\n\t try {\n\t crypto = require('crypto');\n\t } catch (err) {}\n\t }\n\n\t /*\n\t * Cryptographically secure pseudorandom number generator\n\t *\n\t * As Math.random() is cryptographically not safe to use\n\t */\n\t var cryptoSecureRandomInt = function () {\n\t if (crypto) {\n\t // Use getRandomValues method (Browser)\n\t if (typeof crypto.getRandomValues === 'function') {\n\t try {\n\t return crypto.getRandomValues(new Uint32Array(1))[0];\n\t } catch (err) {}\n\t }\n\n\t // Use randomBytes method (NodeJS)\n\t if (typeof crypto.randomBytes === 'function') {\n\t try {\n\t return crypto.randomBytes(4).readInt32LE();\n\t } catch (err) {}\n\t }\n\t }\n\n\t throw new Error('Native crypto module could not be used to get secure random number.');\n\t };\n\n\t /*\n\t * Local polyfill of Object.create\n\n\t */\n\t var create = Object.create || (function () {\n\t function F() {}\n\n\t return function (obj) {\n\t var subtype;\n\n\t F.prototype = obj;\n\n\t subtype = new F();\n\n\t F.prototype = null;\n\n\t return subtype;\n\t };\n\t }());\n\n\t /**\n\t * CryptoJS namespace.\n\t */\n\t var C = {};\n\n\t /**\n\t * Library namespace.\n\t */\n\t var C_lib = C.lib = {};\n\n\t /**\n\t * Base object for prototypal inheritance.\n\t */\n\t var Base = C_lib.Base = (function () {\n\n\n\t return {\n\t /**\n\t * Creates a new object that inherits from this object.\n\t *\n\t * @param {Object} overrides Properties to copy into the new object.\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * field: 'value',\n\t *\n\t * method: function () {\n\t * }\n\t * });\n\t */\n\t extend: function (overrides) {\n\t // Spawn\n\t var subtype = create(this);\n\n\t // Augment\n\t if (overrides) {\n\t subtype.mixIn(overrides);\n\t }\n\n\t // Create default initializer\n\t if (!subtype.hasOwnProperty('init') || this.init === subtype.init) {\n\t subtype.init = function () {\n\t subtype.$super.init.apply(this, arguments);\n\t };\n\t }\n\n\t // Initializer's prototype is the subtype object\n\t subtype.init.prototype = subtype;\n\n\t // Reference supertype\n\t subtype.$super = this;\n\n\t return subtype;\n\t },\n\n\t /**\n\t * Extends this object and runs the init method.\n\t * Arguments to create() will be passed to init().\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var instance = MyType.create();\n\t */\n\t create: function () {\n\t var instance = this.extend();\n\t instance.init.apply(instance, arguments);\n\n\t return instance;\n\t },\n\n\t /**\n\t * Initializes a newly created object.\n\t * Override this method to add some logic when your objects are created.\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * init: function () {\n\t * // ...\n\t * }\n\t * });\n\t */\n\t init: function () {\n\t },\n\n\t /**\n\t * Copies properties into this object.\n\t *\n\t * @param {Object} properties The properties to mix in.\n\t *\n\t * @example\n\t *\n\t * MyType.mixIn({\n\t * field: 'value'\n\t * });\n\t */\n\t mixIn: function (properties) {\n\t for (var propertyName in properties) {\n\t if (properties.hasOwnProperty(propertyName)) {\n\t this[propertyName] = properties[propertyName];\n\t }\n\t }\n\n\t // IE won't copy toString using the loop above\n\t if (properties.hasOwnProperty('toString')) {\n\t this.toString = properties.toString;\n\t }\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = instance.clone();\n\t */\n\t clone: function () {\n\t return this.init.prototype.extend(this);\n\t }\n\t };\n\t }());\n\n\t /**\n\t * An array of 32-bit words.\n\t *\n\t * @property {Array} words The array of 32-bit words.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var WordArray = C_lib.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of 32-bit words.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.create();\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 4;\n\t }\n\t },\n\n\t /**\n\t * Converts this word array to a string.\n\t *\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n\t *\n\t * @return {string} The stringified word array.\n\t *\n\t * @example\n\t *\n\t * var string = wordArray + '';\n\t * var string = wordArray.toString();\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\n\t */\n\t toString: function (encoder) {\n\t return (encoder || Hex).stringify(this);\n\t },\n\n\t /**\n\t * Concatenates a word array to this word array.\n\t *\n\t * @param {WordArray} wordArray The word array to append.\n\t *\n\t * @return {WordArray} This word array.\n\t *\n\t * @example\n\t *\n\t * wordArray1.concat(wordArray2);\n\t */\n\t concat: function (wordArray) {\n\t // Shortcuts\n\t var thisWords = this.words;\n\t var thatWords = wordArray.words;\n\t var thisSigBytes = this.sigBytes;\n\t var thatSigBytes = wordArray.sigBytes;\n\n\t // Clamp excess bits\n\t this.clamp();\n\n\t // Concat\n\t if (thisSigBytes % 4) {\n\t // Copy one byte at a time\n\t for (var i = 0; i < thatSigBytes; i++) {\n\t var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\n\t }\n\t } else {\n\t // Copy one word at a time\n\t for (var j = 0; j < thatSigBytes; j += 4) {\n\t thisWords[(thisSigBytes + j) >>> 2] = thatWords[j >>> 2];\n\t }\n\t }\n\t this.sigBytes += thatSigBytes;\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Removes insignificant bits.\n\t *\n\t * @example\n\t *\n\t * wordArray.clamp();\n\t */\n\t clamp: function () {\n\t // Shortcuts\n\t var words = this.words;\n\t var sigBytes = this.sigBytes;\n\n\t // Clamp\n\t words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\n\t words.length = Math.ceil(sigBytes / 4);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = wordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone.words = this.words.slice(0);\n\n\t return clone;\n\t },\n\n\t /**\n\t * Creates a word array filled with random bytes.\n\t *\n\t * @param {number} nBytes The number of random bytes to generate.\n\t *\n\t * @return {WordArray} The random word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\n\t */\n\t random: function (nBytes) {\n\t var words = [];\n\n\t for (var i = 0; i < nBytes; i += 4) {\n\t words.push(cryptoSecureRandomInt());\n\t }\n\n\t return new WordArray.init(words, nBytes);\n\t }\n\t });\n\n\t /**\n\t * Encoder namespace.\n\t */\n\t var C_enc = C.enc = {};\n\n\t /**\n\t * Hex encoding strategy.\n\t */\n\t var Hex = C_enc.Hex = {\n\t /**\n\t * Converts a word array to a hex string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The hex string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var hexChars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t hexChars.push((bite >>> 4).toString(16));\n\t hexChars.push((bite & 0x0f).toString(16));\n\t }\n\n\t return hexChars.join('');\n\t },\n\n\t /**\n\t * Converts a hex string to a word array.\n\t *\n\t * @param {string} hexStr The hex string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\n\t */\n\t parse: function (hexStr) {\n\t // Shortcut\n\t var hexStrLength = hexStr.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < hexStrLength; i += 2) {\n\t words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n\t }\n\n\t return new WordArray.init(words, hexStrLength / 2);\n\t }\n\t };\n\n\t /**\n\t * Latin1 encoding strategy.\n\t */\n\t var Latin1 = C_enc.Latin1 = {\n\t /**\n\t * Converts a word array to a Latin1 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Latin1 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var latin1Chars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t latin1Chars.push(String.fromCharCode(bite));\n\t }\n\n\t return latin1Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Latin1 string to a word array.\n\t *\n\t * @param {string} latin1Str The Latin1 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n\t */\n\t parse: function (latin1Str) {\n\t // Shortcut\n\t var latin1StrLength = latin1Str.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < latin1StrLength; i++) {\n\t words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n\t }\n\n\t return new WordArray.init(words, latin1StrLength);\n\t }\n\t };\n\n\t /**\n\t * UTF-8 encoding strategy.\n\t */\n\t var Utf8 = C_enc.Utf8 = {\n\t /**\n\t * Converts a word array to a UTF-8 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The UTF-8 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t try {\n\t return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n\t } catch (e) {\n\t throw new Error('Malformed UTF-8 data');\n\t }\n\t },\n\n\t /**\n\t * Converts a UTF-8 string to a word array.\n\t *\n\t * @param {string} utf8Str The UTF-8 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n\t */\n\t parse: function (utf8Str) {\n\t return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n\t }\n\t };\n\n\t /**\n\t * Abstract buffered block algorithm template.\n\t *\n\t * The property blockSize must be implemented in a concrete subtype.\n\t *\n\t * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\n\t */\n\t var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\n\t /**\n\t * Resets this block algorithm's data buffer to its initial state.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm.reset();\n\t */\n\t reset: function () {\n\t // Initial values\n\t this._data = new WordArray.init();\n\t this._nDataBytes = 0;\n\t },\n\n\t /**\n\t * Adds new data to this block algorithm's buffer.\n\t *\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm._append('data');\n\t * bufferedBlockAlgorithm._append(wordArray);\n\t */\n\t _append: function (data) {\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof data == 'string') {\n\t data = Utf8.parse(data);\n\t }\n\n\t // Append\n\t this._data.concat(data);\n\t this._nDataBytes += data.sigBytes;\n\t },\n\n\t /**\n\t * Processes available data blocks.\n\t *\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n\t *\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n\t *\n\t * @return {WordArray} The processed data.\n\t *\n\t * @example\n\t *\n\t * var processedData = bufferedBlockAlgorithm._process();\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\n\t */\n\t _process: function (doFlush) {\n\t var processedWords;\n\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\t var dataSigBytes = data.sigBytes;\n\t var blockSize = this.blockSize;\n\t var blockSizeBytes = blockSize * 4;\n\n\t // Count blocks ready\n\t var nBlocksReady = dataSigBytes / blockSizeBytes;\n\t if (doFlush) {\n\t // Round up to include partial blocks\n\t nBlocksReady = Math.ceil(nBlocksReady);\n\t } else {\n\t // Round down to include only full blocks,\n\t // less the number of blocks that must remain in the buffer\n\t nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n\t }\n\n\t // Count words ready\n\t var nWordsReady = nBlocksReady * blockSize;\n\n\t // Count bytes ready\n\t var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\n\n\t // Process blocks\n\t if (nWordsReady) {\n\t for (var offset = 0; offset < nWordsReady; offset += blockSize) {\n\t // Perform concrete-algorithm logic\n\t this._doProcessBlock(dataWords, offset);\n\t }\n\n\t // Remove processed words\n\t processedWords = dataWords.splice(0, nWordsReady);\n\t data.sigBytes -= nBytesReady;\n\t }\n\n\t // Return processed words\n\t return new WordArray.init(processedWords, nBytesReady);\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = bufferedBlockAlgorithm.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone._data = this._data.clone();\n\n\t return clone;\n\t },\n\n\t _minBufferSize: 0\n\t });\n\n\t /**\n\t * Abstract hasher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n\t */\n\t var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\n\t /**\n\t * Configuration options.\n\t */\n\t cfg: Base.extend(),\n\n\t /**\n\t * Initializes a newly created hasher.\n\t *\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\n\t *\n\t * @example\n\t *\n\t * var hasher = CryptoJS.algo.SHA256.create();\n\t */\n\t init: function (cfg) {\n\t // Apply config defaults\n\t this.cfg = this.cfg.extend(cfg);\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this hasher to its initial state.\n\t *\n\t * @example\n\t *\n\t * hasher.reset();\n\t */\n\t reset: function () {\n\t // Reset data buffer\n\t BufferedBlockAlgorithm.reset.call(this);\n\n\t // Perform concrete-hasher logic\n\t this._doReset();\n\t },\n\n\t /**\n\t * Updates this hasher with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {Hasher} This hasher.\n\t *\n\t * @example\n\t *\n\t * hasher.update('message');\n\t * hasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t // Append\n\t this._append(messageUpdate);\n\n\t // Update the hash\n\t this._process();\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the hash computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @example\n\t *\n\t * var hash = hasher.finalize();\n\t * var hash = hasher.finalize('message');\n\t * var hash = hasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Final message update\n\t if (messageUpdate) {\n\t this._append(messageUpdate);\n\t }\n\n\t // Perform concrete-hasher logic\n\t var hash = this._doFinalize();\n\n\t return hash;\n\t },\n\n\t blockSize: 512/32,\n\n\t /**\n\t * Creates a shortcut function to a hasher's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to create a helper for.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHelper: function (hasher) {\n\t return function (message, cfg) {\n\t return new hasher.init(cfg).finalize(message);\n\t };\n\t },\n\n\t /**\n\t * Creates a shortcut function to the HMAC's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHmacHelper: function (hasher) {\n\t return function (message, key) {\n\t return new C_algo.HMAC.init(hasher, key).finalize(message);\n\t };\n\t }\n\t });\n\n\t /**\n\t * Algorithm namespace.\n\t */\n\t var C_algo = C.algo = {};\n\n\t return C;\n\t}(Math));\n\n\n\treturn CryptoJS;\n\n}));",";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function () {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var Hasher = C_lib.Hasher;\n\t var C_algo = C.algo;\n\n\t // Reusable object\n\t var W = [];\n\n\t /**\n\t * SHA-1 hash algorithm.\n\t */\n\t var SHA1 = C_algo.SHA1 = Hasher.extend({\n\t _doReset: function () {\n\t this._hash = new WordArray.init([\n\t 0x67452301, 0xefcdab89,\n\t 0x98badcfe, 0x10325476,\n\t 0xc3d2e1f0\n\t ]);\n\t },\n\n\t _doProcessBlock: function (M, offset) {\n\t // Shortcut\n\t var H = this._hash.words;\n\n\t // Working variables\n\t var a = H[0];\n\t var b = H[1];\n\t var c = H[2];\n\t var d = H[3];\n\t var e = H[4];\n\n\t // Computation\n\t for (var i = 0; i < 80; i++) {\n\t if (i < 16) {\n\t W[i] = M[offset + i] | 0;\n\t } else {\n\t var n = W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16];\n\t W[i] = (n << 1) | (n >>> 31);\n\t }\n\n\t var t = ((a << 5) | (a >>> 27)) + e + W[i];\n\t if (i < 20) {\n\t t += ((b & c) | (~b & d)) + 0x5a827999;\n\t } else if (i < 40) {\n\t t += (b ^ c ^ d) + 0x6ed9eba1;\n\t } else if (i < 60) {\n\t t += ((b & c) | (b & d) | (c & d)) - 0x70e44324;\n\t } else /* if (i < 80) */ {\n\t t += (b ^ c ^ d) - 0x359d3e2a;\n\t }\n\n\t e = d;\n\t d = c;\n\t c = (b << 30) | (b >>> 2);\n\t b = a;\n\t a = t;\n\t }\n\n\t // Intermediate hash value\n\t H[0] = (H[0] + a) | 0;\n\t H[1] = (H[1] + b) | 0;\n\t H[2] = (H[2] + c) | 0;\n\t H[3] = (H[3] + d) | 0;\n\t H[4] = (H[4] + e) | 0;\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\n\t var nBitsTotal = this._nDataBytes * 8;\n\t var nBitsLeft = data.sigBytes * 8;\n\n\t // Add padding\n\t dataWords[nBitsLeft >>> 5] |= 0x80 << (24 - nBitsLeft % 32);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 14] = Math.floor(nBitsTotal / 0x100000000);\n\t dataWords[(((nBitsLeft + 64) >>> 9) << 4) + 15] = nBitsTotal;\n\t data.sigBytes = dataWords.length * 4;\n\n\t // Hash final blocks\n\t this._process();\n\n\t // Return final computed hash\n\t return this._hash;\n\t },\n\n\t clone: function () {\n\t var clone = Hasher.clone.call(this);\n\t clone._hash = this._hash.clone();\n\n\t return clone;\n\t }\n\t });\n\n\t /**\n\t * Shortcut function to the hasher's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hash = CryptoJS.SHA1('message');\n\t * var hash = CryptoJS.SHA1(wordArray);\n\t */\n\t C.SHA1 = Hasher._createHelper(SHA1);\n\n\t /**\n\t * Shortcut function to the HMAC's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hmac = CryptoJS.HmacSHA1(message, key);\n\t */\n\t C.HmacSHA1 = Hasher._createHmacHelper(SHA1);\n\t}());\n\n\n\treturn CryptoJS.SHA1;\n\n}));","export namespace logger {\n export const log = (message?: any, ...optionalParams: any[]) =>\n console.log(`[Pixi’VN Json] ${message}`, ...optionalParams);\n export const warn = (message?: any, ...optionalParams: any[]) =>\n console.warn(`[Pixi’VN Json] ${message}`, ...optionalParams);\n export const error = (message?: any, ...optionalParams: any[]) =>\n console.error(`[Pixi’VN Json] ${message}`, ...optionalParams);\n export const info = (message?: any, ...optionalParams: any[]) =>\n console.info(`[Pixi’VN Json] ${message}`, ...optionalParams);\n}\n","import { JsonUnifier } from \"@drincs/pixi-vn-json/core\";\nimport { PixiVNJsonOperationString } from \"../interface\";\n\nexport function operationStringToString(operation: PixiVNJsonOperationString): string {\n let stringOperation = \"\";\n operation.values.forEach((value) => {\n if (typeof value === \"string\") {\n stringOperation += value;\n } else {\n let res = JsonUnifier.getLogichValue<string>(value);\n stringOperation += `${res}`;\n }\n });\n return stringOperation;\n}\n","import { JsonUnifier } from \"@drincs/pixi-vn-json/core\";\nimport { PixiVNJsonIfElse, PixiVNJsonOperation } from \"../interface\";\nimport { PixiVNJsonOperationString } from \"../interface/PixiVNJsonOperations\";\nimport { operationStringToString } from \"../utils/operationtoconvert\";\n\nexport async function runOperation(\n origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString,\n operationStringConvert?: (value: string) => Promise<PixiVNJsonOperation | undefined>,\n) {\n let operation = JsonUnifier.getLogichValue<PixiVNJsonOperation | PixiVNJsonOperationString>(origin);\n if (!operation) {\n return;\n }\n switch (operation.type) {\n case \"sound\":\n JsonUnifier.soundOperation(operation);\n break;\n case \"assets\":\n case \"bundle\":\n await JsonUnifier.loadAssets(operation);\n break;\n case \"image\":\n await JsonUnifier.imageOperation(operation);\n break;\n case \"video\":\n await JsonUnifier.videoOperation(operation);\n break;\n case \"imagecontainer\":\n await JsonUnifier.imageContainerOperation(operation);\n break;\n case \"text\":\n await JsonUnifier.textOperation(operation);\n break;\n case \"canvaselement\":\n await JsonUnifier.canvasElementOperation(operation);\n break;\n case \"value\":\n JsonUnifier.setStorageValue(operation);\n break;\n case \"operationtoconvert\":\n if (operationStringConvert) {\n let stringOperation = operationStringToString(operation);\n let op = await operationStringConvert(stringOperation);\n if (op) {\n await runOperation(op, operationStringConvert);\n }\n }\n break;\n case \"input\":\n case \"dialogue\":\n JsonUnifier.narrationOperation(operation);\n break;\n case \"shake\":\n await JsonUnifier.effectOperation(operation);\n break;\n case \"animate\":\n case \"animate-sequence\":\n JsonUnifier.animateOperation(operation);\n break;\n }\n}\n\nexport function runInitialOperation(\n origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString,\n) {\n let operation = JsonUnifier.getLogichValue<PixiVNJsonOperation | PixiVNJsonOperationString>(origin);\n if (!operation) {\n return;\n }\n switch (operation.type) {\n case \"value\":\n if (\n operation.storageOperationType === \"set\" &&\n (operation.storageType === \"storage\" || operation.storageType === \"tempstorage\")\n ) {\n JsonUnifier.setInitialStorageValue(operation);\n }\n break;\n }\n}\n","import { RegisteredLabels } from \"@drincs/pixi-vn/narration\";\nimport { LabelJson } from \".\";\nimport { PixiVNJson, PixiVNJsonLabelStep } from \"../interface\";\nimport { logger } from \"../utils/log-utility\";\nimport { LabelJsonOptions } from \"./LabelJson\";\nimport { runInitialOperation } from \"./operation-utility\";\n\n/**\n * Import a Pixi'VN JSON to the system.\n * This feature was created to give other developers the ability to create tools that can generate Pixi'VN labels or that generate Pixi'VN after extracting information from a programming language designed for writing narratives.\n * @param values The Pixi'VN JSON to be imported\n * @returns\n */\nexport async function importPixiVNJson(\n values: PixiVNJson | string | (PixiVNJson | string)[],\n options: LabelJsonOptions = {}\n) {\n if (!Array.isArray(values)) {\n if (typeof values === \"object\" || typeof values === \"string\") {\n values = [values];\n } else {\n logger.error(\"Error parsing imported Pixi'VN JSON: data is not an object\");\n return;\n }\n }\n\n const jsonsPromises: Promise<PixiVNJson>[] = values.map(async (data) => {\n if (typeof data === \"string\") {\n try {\n data = JSON.parse(data) as PixiVNJson;\n } catch (e) {\n logger.error(\"Error parsing imported Pixi'VN JSON\", e);\n data = {};\n }\n }\n return data;\n });\n const jsons = await Promise.all(jsonsPromises);\n\n const promises = jsons.map(async (data) => {\n const promises: Promise<void>[] = [];\n if (data.initialOperations) {\n for (let operation of data.initialOperations) {\n runInitialOperation(operation);\n }\n }\n if (data.labels) {\n let labels = data.labels;\n for (const labelId in labels) {\n try {\n const steps: PixiVNJsonLabelStep[] = labels[labelId];\n let label = new LabelJson(labelId, steps, undefined, options);\n RegisteredLabels.add(label);\n } catch (e) {\n logger.error(`Error creating JSON label ${labelId}`, e);\n }\n }\n }\n return Promise.all(promises);\n });\n\n await Promise.all(promises);\n}\n","import { createExportableElement } from \"@drincs/pixi-vn\";\nimport { JsonUnifier } from \"@drincs/pixi-vn-json/core\";\nimport { translator } from \"@drincs/pixi-vn-json/translator\";\nimport {\n LabelAbstract,\n LabelProps,\n narration,\n StepLabelPropsType,\n StepLabelType,\n StoredChoiceInterface,\n} from \"@drincs/pixi-vn/narration\";\nimport { storage } from \"@drincs/pixi-vn/storage\";\nimport sha1 from \"crypto-js/sha1\";\nimport { PIXIVNJSON_PARAM_ID } from \"../constants\";\nimport { PixiVNJsonLabelStep, PixiVNJsonOperation } from \"../interface\";\nimport PixiVNJsonConditionalStatements from \"../interface/PixiVNJsonConditionalStatements\";\nimport {\n PixiVNJsonChoice,\n PixiVNJsonChoices,\n PixiVNJsonDialog,\n PixiVNJsonDialogText,\n PixiVNJsonLabelToOpen,\n} from \"../interface/PixiVNJsonLabelStep\";\nimport { logger } from \"../utils/log-utility\";\nimport { runOperation } from \"./operation-utility\";\n\nexport type LabelJsonOptions = {\n /**\n * Function that converts a string to a {@link PixiVNJsonOperation}.\n * If is a special operation you can return undefined and can run the operation.\n */\n operationStringConvert?: (\n value: string,\n step: PixiVNJsonLabelStep,\n props: StepLabelPropsType | {},\n ) => Promise<PixiVNJsonOperation | undefined>;\n /**\n * If true and a dialog is empty or has only spaces, {@link PixiVNJsonLabelStep.goNextStep} will be set to true.\n */\n skipEmptyDialogs?: boolean;\n};\n\nexport default class LabelJson<T extends {} = {}> extends LabelAbstract<LabelJson<T>, T> {\n /**\n * @param id is the id of the label\n * @param steps is the list of steps that the label will perform\n * @param props is the properties of the label\n */\n constructor(\n id: string,\n steps: (PixiVNJsonLabelStep | (() => PixiVNJsonLabelStep))[],\n props?: LabelProps<LabelJson<T>>,\n options: LabelJsonOptions = {},\n ) {\n if (!props) {\n props = {};\n }\n props.onLoadingLabel = async () => {\n for (let stepProp of steps) {\n let step: PixiVNJsonLabelStep;\n if (typeof stepProp === \"function\") {\n step = stepProp();\n } else {\n step = stepProp;\n }\n\n step = JsonUnifier.getConditionalStep(step);\n\n if (step.operations) {\n try {\n let promises = step.operations.map((operation) => JsonUnifier.loadAssets(operation));\n await Promise.all(promises);\n } catch (error) {\n logger.error(\"The operation in the onLoadingLabel function of the label has an error:\", error);\n }\n }\n }\n };\n super(id, props);\n this._steps = steps;\n this.operationStringConvert = options.operationStringConvert;\n this.skipEmptyDialogs = options.skipEmptyDialogs || false;\n }\n\n private _steps: (PixiVNJsonLabelStep | (() => PixiVNJsonLabelStep))[];\n get steps(): StepLabelType<T>[] {\n return this._steps.map((step) => {\n return this.stepConverter(step);\n });\n }\n get stepCount(): number {\n return this._steps.length;\n }\n getStepById(stepId: number): StepLabelType<T> | undefined {\n if (stepId < 0 || stepId >= this._steps.length) {\n return undefined;\n }\n let step = this._steps[stepId];\n return this.stepConverter(step);\n }\n\n private operationStringConvert?: (\n value: string,\n step: PixiVNJsonLabelStep,\n props: StepLabelPropsType,\n ) => Promise<PixiVNJsonOperation | undefined>;\n private skipEmptyDialogs: boolean = false;\n\n public getStepSha(index: number): string | undefined {\n if (index < 0 || index >= this.steps.length) {\n return undefined;\n }\n let step = this._steps[index];\n let sha1String = sha1(step.toString().toLocaleLowerCase());\n return sha1String.toString();\n }\n\n private getDialogueText(origin: PixiVNJsonDialogText): string | string[] {\n let text: string | string[] = \"\";\n if (Array.isArray(origin)) {\n let texts: string[] = [];\n origin.forEach((t) => {\n if (typeof t === \"string\") {\n texts.push(t);\n } else if (t && typeof t === \"object\") {\n let res = JsonUnifier.getLogichValue<string | any[]>(t);\n if (res) {\n if (res && !Array.isArray(res) && typeof res === \"object\") {\n res = JsonUnifier.getLogichValue<string | string[]>(res) || \"\";\n }\n if (Array.isArray(res)) {\n texts = texts.map((v) => `${v}`).concat(res);\n } else {\n texts.push(`${res}`);\n }\n } else {\n texts.push(`${t}`);\n }\n } else {\n texts.push(`${t}`);\n }\n });\n text = texts;\n } else {\n let res = JsonUnifier.getLogichValue<string | any[]>(origin);\n if (res && !Array.isArray(res) && typeof res === \"object\") {\n res = JsonUnifier.getLogichValue<string | string[]>(res);\n }\n\n if (res && Array.isArray(res)) {\n text = res.map((v) => `${v}`);\n } else {\n text = `${res}`;\n }\n }\n return text;\n }\n private getDialogue(\n origin:\n | PixiVNJsonDialog<PixiVNJsonDialogText>\n | PixiVNJsonConditionalStatements<PixiVNJsonDialog<PixiVNJsonDialogText>>\n | undefined,\n ): PixiVNJsonDialog<string | string[]> | undefined {\n if (origin === undefined || origin === null) {\n return undefined;\n }\n let dialogue = JsonUnifier.getLogichValue<PixiVNJsonDialog<PixiVNJsonDialogText>>(origin);\n if (dialogue === undefined || dialogue === null) {\n return `${dialogue}`;\n }\n if (typeof dialogue === \"object\" && \"character\" in dialogue && \"text\" in dialogue) {\n return {\n character: dialogue.character,\n text: translator.t(this.getDialogueText(dialogue.text)),\n };\n } else {\n return translator.t(this.getDialogueText(dialogue));\n }\n }\n\n private getChoices(\n origin: PixiVNJsonChoices | PixiVNJsonConditionalStatements<PixiVNJsonChoices> | undefined,\n ): PixiVNJsonChoice[] | undefined {\n const choices = JsonUnifier.getLogichValue<PixiVNJsonChoices>(origin);\n const options = choices\n ?.map((option) => {\n return JsonUnifier.getLogichValue<PixiVNJsonChoice>(option);\n })\n .filter((option) => option !== undefined);\n return options;\n }\n\n private stepConverter(stepProp: PixiVNJsonLabelStep | (() => PixiVNJsonLabelStep)): StepLabelType<T> {\n return async (props) => {\n let step: PixiVNJsonLabelStep = typeof stepProp === \"function\" ? stepProp() : stepProp;\n step = createExportableElement(step);\n step = JsonUnifier.getConditionalStep(step);\n const operationStringConvert = this.operationStringConvert\n ? (value: string) => this.operationStringConvert!(value, step, props)\n : undefined;\n const { operations = [] } = step;\n for (let operation of operations) {\n await runOperation(operation, operationStringConvert);\n }\n\n let { labelToOpen: tempLabelToOpen = [] } = step;\n const choices = this.getChoices(step.choices);\n const glueEnabled = JsonUnifier.getLogichValue<boolean>(step.glueEnabled);\n const dialogue = this.getDialogue(step.dialogue);\n\n let labelToOpen: PixiVNJsonLabelToOpen[] = [];\n if (!Array.isArray(tempLabelToOpen)) {\n tempLabelToOpen = [tempLabelToOpen];\n }\n tempLabelToOpen.forEach((label) => {\n let i = JsonUnifier.getLogichValue<PixiVNJsonLabelToOpen<{}>>(label);\n if (i) {\n labelToOpen.push(i);\n }\n });\n\n let goNextStep = JsonUnifier.getLogichValue<boolean>(step.goNextStep);\n let end = JsonUnifier.getLogichValue<\"game_end\" | \"label_end\">(step.end);\n\n if (choices) {\n let options: StoredChoiceInterface[] = choices.map((option) => {\n let text: string | string[] = \"\";\n if (Array.isArray(option.text)) {\n let texts: string[] = [];\n option.text.forEach((t) => {\n if (typeof t === \"string\") {\n texts.push(translator.t(t));\n } else if (t && typeof t === \"object\") {\n let res = JsonUnifier.getLogichValue<string | any[]>(t);\n if (res && !Array.isArray(res) && typeof res === \"object\") {\n res = JsonUnifier.getLogichValue<string | string[]>(res) || \"\";\n }\n if (res) {\n if (Array.isArray(res)) {\n texts = texts.concat(translator.t(res));\n } else {\n texts.push(translator.t(res));\n }\n }\n }\n });\n text = texts;\n } else if (typeof option.text === \"string\") {\n text = translator.t(option.text);\n }\n const res: StoredChoiceInterface = {\n label: option.label,\n text: text,\n props: option.props,\n type: option.type,\n oneTime: option.oneTime,\n onlyHaveNoChoice: option.onlyHaveNoChoice,\n autoSelect: option.autoSelect,\n };\n return res;\n });\n narration.choices = options;\n } else {\n narration.choices = undefined;\n }\n\n if (dialogue !== undefined) {\n narration.dialogue = dialogue;\n if (\n this.skipEmptyDialogs &&\n typeof dialogue === \"string\" &&\n (dialogue === \"\" || RegExp(/^\\s+$/).test(dialogue))\n ) {\n goNextStep = true;\n }\n }\n if (glueEnabled) {\n narration.dialogGlue = true;\n } else if (glueEnabled === false) {\n narration.dialogGlue = false;\n }\n\n for (let label of labelToOpen) {\n let labelString = label.label;\n if (typeof labelString === \"object\") {\n labelString = JsonUnifier.getLogichValue<string>(labelString) || \"\";\n }\n let labelParams = label.params?.map((param) => {\n return JsonUnifier.getLogichValue(param);\n });\n props = {\n ...props,\n ...label.props,\n };\n if (label.type === \"jump\") {\n if (narration.openedLabels.length > 0) narration.closeCurrentLabel();\n storage.setTempVariable(`${PIXIVNJSON_PARAM_ID}${narration.openedLabels.length}`, labelParams);\n await narration.call(labelString, props);\n } else {\n storage.setTempVariable(`${PIXIVNJSON_PARAM_ID}${narration.openedLabels.length}`, labelParams);\n await narration.call(labelString, props);\n }\n }\n\n if (end === \"game_end\") {\n narration.closeAllLabels();\n await narration.continue(props, { runNow: true });\n } else if (end === \"label_end\") {\n narration.closeCurrentLabel();\n }\n\n if (goNextStep) {\n await narration.continue(props, { runNow: true });\n }\n };\n }\n}\n","export const PIXIVNJSON_PARAM_ID = \"___param___\"\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
'use strict';var core=require('@drincs/pixi-vn-json/core'),importer=require('@drincs/pixi-vn-json/importer'),translator=require('@drincs/pixi-vn-json/translator'),canvas=require('@drincs/pixi-vn/canvas'),narration=require('@drincs/pixi-vn/narration'),sound=require('@drincs/pixi-vn/sound'),pixiVn=require('@drincs/pixi-vn'),storage=require('@drincs/pixi-vn/storage');var h="___param___";async function L(e){let i=core.JsonUnifier.getLogichValue(e);if(i)switch(i.type){case "assets":switch(i.operationType){case "load":await canvas.Assets.load(i.aliases);break;case "lazyload":canvas.Assets.backgroundLoad(i.aliases);break}break;case "bundle":switch(i.operationType){case "load":await canvas.Assets.loadBundle(i.aliases);break;case "lazyload":canvas.Assets.backgroundLoadBundle(i.aliases);break}break}}var r;(n=>(n.log=(o,...u)=>console.log(`[Pixi\u2019VN Json] ${o}`,...u),n.warn=(o,...u)=>console.warn(`[Pixi\u2019VN Json] ${o}`,...u),n.error=(o,...u)=>console.error(`[Pixi\u2019VN Json] ${o}`,...u),n.info=(o,...u)=>console.info(`[Pixi\u2019VN Json] ${o}`,...u)))(r||(r={}));async function P(e,i,a){switch(a.type){case "fade":await canvas.showWithFade(i.alias,e,a.props,a.priority);break;case "dissolve":await canvas.showWithDissolve(i.alias,e,a.props,a.priority);break;case "movein":case "moveout":await canvas.moveIn(i.alias,e,a.props,a.priority);break;case "zoomin":case "zoomout":await canvas.zoomIn(i.alias,e,a.props,a.priority);break;case "pushin":case "pushout":await canvas.pushIn(i.alias,e,a.props,a.priority);break}}function y(e){if(e.transition)switch(e.transition.type){case "fade":canvas.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":canvas.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":canvas.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":canvas.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":canvas.pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.canvas.remove(e.alias);}async function E(e){switch(e.operationType){case "show":if(e.transition){let a=new canvas.ImageSprite(e.props,e.url||e.alias);await P(a,e,e.transition);}else await canvas.showImage(e.alias,e.url,e.props);break;case "edit":let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`Image with alias ${e.alias} not found.`);break;case "remove":y(e);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let n=new canvas.VideoSprite(e.props,e.url||e.alias);await P(n,e,e.transition);}else await canvas.showVideo(e.alias,e.url,e.props);break;case "edit":let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`Video with alias ${e.alias} not found.`);break;case "remove":y(e);break;case "pause":let a=canvas.canvas.find(e.alias);a?a.paused=true:r.error(`Video with alias ${e.alias} not found.`);break;case "resume":let l=canvas.canvas.find(e.alias);l?l.paused=false:r.error(`Video with alias ${e.alias} not found.`);break}}async function R(e){switch(e.operationType){case "show":if(e.transition){let a=new canvas.ImageContainer(e.props,e.urls);await P(a,e,e.transition);}else await canvas.showImageContainer(e.alias,e.urls,e.props);break;case "edit":let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":y(e);break}}async function M(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.translator.t(e.text),e.transition){let a=new canvas.Text(e.props);await P(a,e,e.transition);}else canvas.showText(e.alias,e.text,e.props);break;case "edit":let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`Text with alias ${e.alias} not found.`);break;case "remove":y(e);break}}async function $(e){switch(e.operationType){case "edit":try{let i=canvas.canvas.find(e.alias);i?e.props&&(i.memory={...i.memory,...e.props}):r.error(`Canvas Element with alias ${e.alias} not found.`);}catch(i){r.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,i);}break;case "remove":y(e);break}}async function G(e){e.type==="shake"&&await canvas.shakeEffect(e.alias,e.props,e.priority);}function D(e){switch(e.type){case "animate":canvas.canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function j(e){switch(e.type){case "input":narration.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.narration.dialogue=void 0;break}}function _(e){switch(e.operationType){case "play":sound.sound.play(e.alias,e.props);break;case "stop":sound.sound.stop(e.alias);break;case "pause":sound.sound.pause(e.alias);break;case "resume":sound.sound.resume(e.alias);break;case "volume":sound.sound.volume(e.alias,e.value);break}}function U(e){let i=core.JsonUnifier.getLogichValue(e.value),a;switch(i&&typeof i=="object"&&"type"in i?a=core.JsonUnifier.getLogichValue(i):a=i,e.storageType){case "flagStorage":storage.storage.setFlag(e.key,e.value);break;case "storage":storage.storage.set(e.key,a);break;case "tempstorage":storage.storage.setTempVariable(e.key,a);break;case "params":let l=storage.storage.get(`${h}${narration.narration.openedLabels.length-1}`)||[];l&&l.length-1>=e.key&&(l[e.key]=a),storage.storage.setTempVariable(`${h}${narration.narration.openedLabels.length-1}`,l);break}}function z(e){let i=core.JsonUnifier.getLogichValue(e.value),a;switch(i&&typeof i=="object"&&"type"in i?a=core.JsonUnifier.getLogichValue(i):a=i,e.storageType){case "storage":case "tempstorage":storage.storage.default={[e.key]:a};break}}function T(e){let i=k(e);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case "value":return ye(i);case "arithmetic":case "arithmeticsingle":return he(i);case "compare":case "valueCondition":case "union":return Ne(i)}return i}function he(e){let i=core.JsonUnifier.getLogichValue(e.leftValue);switch(e.type){case "arithmetic":let a=core.JsonUnifier.getLogichValue(e.rightValue);switch(e.operator){case "*":return i*a;case "/":return i/a;case "+":return i+a;case "-":return i-a;case "%":return i%a;case "POW":return Math.pow(i,a);case "RANDOM":return narration.narration.getRandomNumber(i,a)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(i);case "FLOOR":return Math.floor(i);case "FLOAT":return parseFloat(i)}break}}function ye(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return storage.storage.get(e.key);case "flagStorage":return storage.storage.getFlag(e.key);case "label":return narration.narration.getTimesLabelOpened(e.label);case "choice":return narration.narration.getTimesChoiceMade(e.index);case "logic":return core.JsonUnifier.getLogichValue(e.operation);case "params":let i=storage.storage.get(`${h}${narration.narration.openedLabels.length-1}`)||[];if(i&&i.length>e.key)return i[e.key];r.warn("getValue params not found");return}return e}function Ne(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let i=core.JsonUnifier.getLogichValue(e.leftValue),a=core.JsonUnifier.getLogichValue(e.rightValue);switch(e.operator){case "==":return i===a;case "!=":return i!==a;case "<":return i<a;case "<=":return i<=a;case ">":return i>a;case ">=":return i>=a;case "CONTAINS":return i.toString().includes(a.toString())}break;case "valueCondition":return !!core.JsonUnifier.getLogichValue(e.value);case "union":return Te(e)}return !!e}function Te(e){if(e.unionType==="not")return !T(e.condition);let i=e.unionType==="and";for(let a=0;a<e.conditions.length;a++)if(i=core.JsonUnifier.getLogichValue(e.conditions[a])||false,e.unionType==="and"){if(!i)return false}else if(i)return true;return i}function be(e,i){return Math.floor(Math.random()*(i-e+1)+e)}function k(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Pe(e);case "ifelse":return core.JsonUnifier.getLogichValue(e.condition)?core.JsonUnifier.getLogichValue(e.then):core.JsonUnifier.getLogichValue(e.else);case "stepswitch":let a=core.JsonUnifier.getLogichValue(e.elements)||[];if(a.length===0){r.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let l=be(0,a.length-1);return core.JsonUnifier.getLogichValue(a[l]);case "loop":let n=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>a.length-1?(n=n%a.length,core.JsonUnifier.getLogichValue(a[n])):core.JsonUnifier.getLogichValue(a[n]);case "sequential":let o,u=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(o=core.JsonUnifier.getLogichValue(a[a.length-1])),u>a.length-1?o:core.JsonUnifier.getLogichValue(a[u]);case "sequentialrandom":let V=narration.NarrationManagerStatic.getRandomNumber(0,a.length-1,{nestedId:e.nestedId,onceOnly:true});if(V==null&&e.end=="lastItem"){let g=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!g||!g?.usedRandomNumbers){r.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let x=g.usedRandomNumbers[`0-${a.length-1}`];return core.JsonUnifier.getLogichValue(a[x[x.length-1]])}if(V==null){r.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return core.JsonUnifier.getLogichValue(a[V])}}return e}function S(e){if(e.conditionalStep){let i=pixiVn.createExportableElement(core.JsonUnifier.getLogichValue(e.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 a={...e,conditionalStep:void 0,...i};return S(a)}else narration.narration.dialogGlue&&(narration.narration.dialogGlue=false);}return e}function Pe(e){let i=e.firstItem,a=[];e.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(o=>{let u=core.JsonUnifier.getLogichValue(o);a.push(u);});else {let o=core.JsonUnifier.getLogichValue(n);a.push(o);}});let l=i?[i,...a]:a;if(l.length===0){r.warn("combinateResult toCheck.length === 0");return}if(typeof l[0]=="string")return translator.translator.t(l);if(typeof l[0]=="object"){let n=l,o,u=false,V=n.map((s,p)=>{s=S(s);let c=core.JsonUnifier.getLogichValue(s.dialogue)||"";return p===0?(o=core.JsonUnifier.getLogichValue(s.glueEnabled)||false,c):(typeof c=="object"&&"text"in c&&(c=c.character+": "+c.text),o===false&&u&&(c=`
|
|
1
|
+
'use strict';var core=require('@drincs/pixi-vn-json/core'),importer=require('@drincs/pixi-vn-json/importer'),translator=require('@drincs/pixi-vn-json/translator'),canvas=require('@drincs/pixi-vn/canvas'),narration=require('@drincs/pixi-vn/narration'),sound=require('@drincs/pixi-vn/sound'),pixiVn=require('@drincs/pixi-vn'),storage=require('@drincs/pixi-vn/storage');var y="___param___";async function E(e){let a=core.JsonUnifier.getLogichValue(e);if(a)switch(a.type){case "assets":switch(a.operationType){case "load":await canvas.Assets.load(a.aliases);break;case "lazyload":canvas.Assets.backgroundLoad(a.aliases);break}break;case "bundle":switch(a.operationType){case "load":await canvas.Assets.loadBundle(a.aliases);break;case "lazyload":canvas.Assets.backgroundLoadBundle(a.aliases);break}break}}var l;(n=>(n.log=(r,...u)=>console.log(`[Pixi\u2019VN Json] ${r}`,...u),n.warn=(r,...u)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...u),n.error=(r,...u)=>console.error(`[Pixi\u2019VN Json] ${r}`,...u),n.info=(r,...u)=>console.info(`[Pixi\u2019VN Json] ${r}`,...u)))(l||(l={}));async function P(e,a,i){switch(i.type){case "fade":await canvas.showWithFade(a.alias,e,i.props,i.priority);break;case "dissolve":await canvas.showWithDissolve(a.alias,e,i.props,i.priority);break;case "movein":case "moveout":await canvas.moveIn(a.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await canvas.zoomIn(a.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await canvas.pushIn(a.alias,e,i.props,i.priority);break}}function N(e){if(e.transition)switch(e.transition.type){case "fade":canvas.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":canvas.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":canvas.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":canvas.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":canvas.pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.canvas.remove(e.alias);}async function L(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageSprite(e.props,e.url||e.alias);await P(i,e,e.transition);}else await canvas.showImage(e.alias,e.url,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):l.error(`Image with alias ${e.alias} not found.`);break;case "remove":N(e);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let n=new canvas.VideoSprite(e.props,e.url||e.alias);await P(n,e,e.transition);}else await canvas.showVideo(e.alias,e.url,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):l.error(`Video with alias ${e.alias} not found.`);break;case "remove":N(e);break;case "pause":let i=canvas.canvas.find(e.alias);i?i.paused=true:l.error(`Video with alias ${e.alias} not found.`);break;case "resume":let o=canvas.canvas.find(e.alias);o?o.paused=false:l.error(`Video with alias ${e.alias} not found.`);break}}async function R(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageContainer(e.props,e.urls);await P(i,e,e.transition);}else await canvas.showImageContainer(e.alias,e.urls,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):l.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":N(e);break}}async function M(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.translator.t(e.text),e.transition){let i=new canvas.Text(e.props);await P(i,e,e.transition);}else canvas.showText(e.alias,e.text,e.props);break;case "edit":let a=canvas.canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):l.error(`Text with alias ${e.alias} not found.`);break;case "remove":N(e);break}}async function $(e){switch(e.operationType){case "edit":try{let a=canvas.canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):l.error(`Canvas Element with alias ${e.alias} not found.`);}catch(a){l.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,a);}break;case "remove":N(e);break}}async function G(e){e.type==="shake"&&await canvas.shakeEffect(e.alias,e.props,e.priority);}function D(e){switch(e.type){case "animate":canvas.canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function j(e){switch(e.type){case "input":narration.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.narration.dialogue=void 0;break}}function F(e){switch(e.operationType){case "play":e.url?sound.sound.play(e.alias,e.url,e.props):sound.sound.play(e.alias,e.props);break;case "stop":sound.sound.stop(e.alias);break;case "pause":switch(e.type){case "sound":sound.sound.pause(e.alias);break;case "channel":sound.sound.findChannel(e.alias).pauseAll();break;case "all":sound.sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.sound.resume(e.alias);break;case "channel":sound.sound.findChannel(e.alias).resumeAll();break;case "all":sound.sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([a,i])=>{let o=sound.sound.find(e.alias);o&&o.set(a,i);});break}}function U(e){let a=core.JsonUnifier.getLogichValue(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=core.JsonUnifier.getLogichValue(a):i=a,e.storageType){case "flagStorage":storage.storage.setFlag(e.key,e.value);break;case "storage":storage.storage.set(e.key,i);break;case "tempstorage":storage.storage.setTempVariable(e.key,i);break;case "params":let o=storage.storage.get(`${y}${narration.narration.openedLabels.length-1}`)||[];o&&o.length-1>=e.key&&(o[e.key]=i),storage.storage.setTempVariable(`${y}${narration.narration.openedLabels.length-1}`,o);break}}function z(e){let a=core.JsonUnifier.getLogichValue(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=core.JsonUnifier.getLogichValue(a):i=a,e.storageType){case "storage":case "tempstorage":storage.storage.default={[e.key]:i};break}}function T(e){let a=k(e);if(a&&typeof a=="object"&&"type"in a)switch(a.type){case "value":return ye(a);case "arithmetic":case "arithmeticsingle":return xe(a);case "compare":case "valueCondition":case "union":return Ne(a)}return a}function xe(e){let a=core.JsonUnifier.getLogichValue(e.leftValue);switch(e.type){case "arithmetic":let i=core.JsonUnifier.getLogichValue(e.rightValue);switch(e.operator){case "*":return a*i;case "/":return a/i;case "+":return a+i;case "-":return a-i;case "%":return a%i;case "POW":return Math.pow(a,i);case "RANDOM":return narration.narration.getRandomNumber(a,i)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(a);case "FLOOR":return Math.floor(a);case "FLOAT":return parseFloat(a)}break}}function ye(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.narration.inputValue:storage.storage.get(e.key);case "flagStorage":return storage.storage.getFlag(e.key);case "label":return narration.narration.getTimesLabelOpened(e.label);case "choice":return narration.narration.getTimesChoiceMade(e.index);case "logic":return core.JsonUnifier.getLogichValue(e.operation);case "params":let a=storage.storage.get(`${y}${narration.narration.openedLabels.length-1}`)||[];if(a&&a.length>e.key)return a[e.key];l.warn("getValue params not found");return}return e}function Ne(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let a=core.JsonUnifier.getLogichValue(e.leftValue),i=core.JsonUnifier.getLogichValue(e.rightValue);switch(e.operator){case "==":return a===i;case "!=":return a!==i;case "<":return a<i;case "<=":return a<=i;case ">":return a>i;case ">=":return a>=i;case "CONTAINS":return a.toString().includes(i.toString())}break;case "valueCondition":return !!core.JsonUnifier.getLogichValue(e.value);case "union":return Te(e)}return !!e}function Te(e){if(e.unionType==="not")return !T(e.condition);let a=e.unionType==="and";for(let i=0;i<e.conditions.length;i++)if(a=core.JsonUnifier.getLogichValue(e.conditions[i])||false,e.unionType==="and"){if(!a)return false}else if(a)return true;return a}function be(e,a){return Math.floor(Math.random()*(a-e+1)+e)}function k(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Pe(e);case "ifelse":return core.JsonUnifier.getLogichValue(e.condition)?core.JsonUnifier.getLogichValue(e.then):core.JsonUnifier.getLogichValue(e.else);case "stepswitch":let i=core.JsonUnifier.getLogichValue(e.elements)||[];if(i.length===0){l.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let o=be(0,i.length-1);return core.JsonUnifier.getLogichValue(i[o]);case "loop":let n=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>i.length-1?(n=n%i.length,core.JsonUnifier.getLogichValue(i[n])):core.JsonUnifier.getLogichValue(i[n]);case "sequential":let r,u=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(r=core.JsonUnifier.getLogichValue(i[i.length-1])),u>i.length-1?r:core.JsonUnifier.getLogichValue(i[u]);case "sequentialrandom":let h=narration.NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(h==null&&e.end=="lastItem"){let p=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!p||!p?.usedRandomNumbers){l.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let x=p.usedRandomNumbers[`0-${i.length-1}`];return core.JsonUnifier.getLogichValue(i[x[x.length-1]])}if(h==null){l.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return core.JsonUnifier.getLogichValue(i[h])}}return e}function S(e){if(e.conditionalStep){let a=pixiVn.createExportableElement(core.JsonUnifier.getLogichValue(e.conditionalStep));if(a?.glueEnabled===void 0&&delete a?.glueEnabled,a?.goNextStep===void 0&&delete a?.goNextStep,a?.end===void 0&&delete a?.end,a?.choices===void 0&&delete a?.choices,a?.dialogue===void 0&&delete a?.dialogue,a?.labelToOpen===void 0&&delete a?.labelToOpen,a?.operations===void 0&&delete a?.operations,a){let i={...e,conditionalStep:void 0,...a};return S(i)}else narration.narration.dialogGlue&&(narration.narration.dialogGlue=false);}return e}function Pe(e){let a=e.firstItem,i=[];e.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(r=>{let u=core.JsonUnifier.getLogichValue(r);i.push(u);});else {let r=core.JsonUnifier.getLogichValue(n);i.push(r);}});let o=a?[a,...i]:i;if(o.length===0){l.warn("combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return translator.translator.t(o);if(typeof o[0]=="object"){let n=o,r,u=false,h=n.map((s,V)=>{s=S(s);let c=core.JsonUnifier.getLogichValue(s.dialogue)||"";return V===0?(r=core.JsonUnifier.getLogichValue(s.glueEnabled)||false,c):(typeof c=="object"&&"text"in c&&(c=c.character+": "+c.text),r===false&&u&&(c=`
|
|
2
2
|
|
|
3
|
-
`+c),c&&(u=true),
|
|
3
|
+
`+c),c&&(u=true),r=core.JsonUnifier.getLogichValue(s.glueEnabled)||false,c)}),p=core.JsonUnifier.getLogichValue(h[0]),x=typeof p=="object"&&"character"in p?p.character:void 0,O=h.flatMap(s=>{let V;s&&typeof s=="object"&&"text"in s?V=s.text:V=s;let c;return Array.isArray(V)?c=V.map(B=>{let H=core.JsonUnifier.getLogichValue(B);return translator.translator.t(`${H}`)}):c=core.JsonUnifier.getLogichValue(V)||"",translator.translator.t(c)}),W=n.find(s=>s.end),q=n.find(s=>s.choices),I=false,v=false;n.length>0&&(n[0].glueEnabled&&n[0].goNextStep&&n[0].dialogue===void 0&&(narration.narration.dialogGlue=true),I=n[n.length-1].glueEnabled,v=n.reverse().find(s=>!(s.operations&&(!s.dialogue||!s.choices)))?.goNextStep);let X=n.find(s=>s.labelToOpen),w=[];return n.forEach(s=>{s.operations&&(w=[...w,...s.operations]);}),{dialogue:x?{character:x,text:O}:O,end:W?.end,choices:q?.choices,glueEnabled:I,goNextStep:v,labelToOpen:X?.labelToOpen,operations:w}}}function na({getLogichValue:e=T}){core.JsonUnifier.init({animateOperation:D,canvasElementOperation:$,effectOperation:G,imageContainerOperation:R,imageOperation:L,textOperation:M,narrationOperation:j,loadAssets:E,soundOperation:F,videoOperation:A,setStorageValue:U,setInitialStorageValue:z,getLogichValue:a=>e?e(k(a),T):T(a),getConditionalStep:S});}exports.PIXIVNJSON_PARAM_ID=y;exports.init=na;Object.keys(core).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return core[k]}})});Object.keys(importer).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return importer[k]}})});Object.keys(translator).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return translator[k]}})});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from '@drincs/pixi-vn-json/core';
|
|
2
2
|
export * from '@drincs/pixi-vn-json/importer';
|
|
3
3
|
export * from '@drincs/pixi-vn-json/translator';
|
|
4
|
-
import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory,
|
|
4
|
+
import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptionsWithChannel, IMediaInstance, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
|
|
5
5
|
import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
|
|
6
6
|
import { UPDATE_PRIORITY } from 'pixi.js';
|
|
7
7
|
|
|
@@ -356,7 +356,7 @@ type PixiVNJsonTextEdit = {
|
|
|
356
356
|
alias: string;
|
|
357
357
|
props?: Partial<TextMemory>;
|
|
358
358
|
};
|
|
359
|
-
type PixiVNJsonUnknownEdit<T extends ContainerOptions
|
|
359
|
+
type PixiVNJsonUnknownEdit<T extends ContainerOptions<any>> = {
|
|
360
360
|
type: "canvaselement";
|
|
361
361
|
operationType: "edit";
|
|
362
362
|
alias: string;
|
|
@@ -398,7 +398,8 @@ type PixiVNJsonSoundPlay = {
|
|
|
398
398
|
type: "sound";
|
|
399
399
|
operationType: "play";
|
|
400
400
|
alias: string;
|
|
401
|
-
|
|
401
|
+
url?: string;
|
|
402
|
+
props?: SoundPlayOptionsWithChannel;
|
|
402
403
|
};
|
|
403
404
|
type PixiVNJsonSoundRemove = {
|
|
404
405
|
type: "sound";
|
|
@@ -406,17 +407,17 @@ type PixiVNJsonSoundRemove = {
|
|
|
406
407
|
alias: string;
|
|
407
408
|
};
|
|
408
409
|
type PixiVNJsonSoundPauseResume = {
|
|
409
|
-
type: "sound";
|
|
410
|
+
type: "sound" | "channel" | "all";
|
|
410
411
|
operationType: "pause" | "resume";
|
|
411
412
|
alias: string;
|
|
412
413
|
};
|
|
413
|
-
type
|
|
414
|
+
type PixiVNJsonSoundEdit = {
|
|
414
415
|
type: "sound";
|
|
415
|
-
operationType: "
|
|
416
|
+
operationType: "edit";
|
|
416
417
|
alias: string;
|
|
417
|
-
|
|
418
|
+
props: Partial<Pick<IMediaInstance, "speed" | "volume" | "muted" | "loop" | "paused">>;
|
|
418
419
|
};
|
|
419
|
-
type PixiVNJsonSound = PixiVNJsonSoundPlay | PixiVNJsonSoundRemove | PixiVNJsonSoundPauseResume |
|
|
420
|
+
type PixiVNJsonSound = PixiVNJsonSoundPlay | PixiVNJsonSoundRemove | PixiVNJsonSoundPauseResume | PixiVNJsonSoundEdit;
|
|
420
421
|
|
|
421
422
|
type PixiVNJsonOperationString = {
|
|
422
423
|
type: "operationtoconvert";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export * from '@drincs/pixi-vn-json/core';
|
|
2
2
|
export * from '@drincs/pixi-vn-json/importer';
|
|
3
3
|
export * from '@drincs/pixi-vn-json/translator';
|
|
4
|
-
import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory,
|
|
4
|
+
import { StorageElementType, CanvasBaseInterface, ImageSprite, ShakeEffectProps, ShowWithDissolveTransitionProps, ShowWithFadeTransitionProps, MoveInOutProps, ZoomInOutProps, PushInOutProps, ImageContainerOptions, ImageSpriteOptions, TextOptions, ImageSpriteMemory, VideoSpriteMemory, ImageContainerMemory, TextMemory, ContainerOptions, ContainerMemory, SoundPlayOptionsWithChannel, IMediaInstance, LabelRunModeType, StorageObjectType, StepLabelPropsType } from '@drincs/pixi-vn';
|
|
5
5
|
import { KeyframesType, AnimationOptions, ObjectSegment, ObjectSegmentWithTransition, SequenceOptions } from '@drincs/pixi-vn/motion';
|
|
6
6
|
import { UPDATE_PRIORITY } from 'pixi.js';
|
|
7
7
|
|
|
@@ -356,7 +356,7 @@ type PixiVNJsonTextEdit = {
|
|
|
356
356
|
alias: string;
|
|
357
357
|
props?: Partial<TextMemory>;
|
|
358
358
|
};
|
|
359
|
-
type PixiVNJsonUnknownEdit<T extends ContainerOptions
|
|
359
|
+
type PixiVNJsonUnknownEdit<T extends ContainerOptions<any>> = {
|
|
360
360
|
type: "canvaselement";
|
|
361
361
|
operationType: "edit";
|
|
362
362
|
alias: string;
|
|
@@ -398,7 +398,8 @@ type PixiVNJsonSoundPlay = {
|
|
|
398
398
|
type: "sound";
|
|
399
399
|
operationType: "play";
|
|
400
400
|
alias: string;
|
|
401
|
-
|
|
401
|
+
url?: string;
|
|
402
|
+
props?: SoundPlayOptionsWithChannel;
|
|
402
403
|
};
|
|
403
404
|
type PixiVNJsonSoundRemove = {
|
|
404
405
|
type: "sound";
|
|
@@ -406,17 +407,17 @@ type PixiVNJsonSoundRemove = {
|
|
|
406
407
|
alias: string;
|
|
407
408
|
};
|
|
408
409
|
type PixiVNJsonSoundPauseResume = {
|
|
409
|
-
type: "sound";
|
|
410
|
+
type: "sound" | "channel" | "all";
|
|
410
411
|
operationType: "pause" | "resume";
|
|
411
412
|
alias: string;
|
|
412
413
|
};
|
|
413
|
-
type
|
|
414
|
+
type PixiVNJsonSoundEdit = {
|
|
414
415
|
type: "sound";
|
|
415
|
-
operationType: "
|
|
416
|
+
operationType: "edit";
|
|
416
417
|
alias: string;
|
|
417
|
-
|
|
418
|
+
props: Partial<Pick<IMediaInstance, "speed" | "volume" | "muted" | "loop" | "paused">>;
|
|
418
419
|
};
|
|
419
|
-
type PixiVNJsonSound = PixiVNJsonSoundPlay | PixiVNJsonSoundRemove | PixiVNJsonSoundPauseResume |
|
|
420
|
+
type PixiVNJsonSound = PixiVNJsonSoundPlay | PixiVNJsonSoundRemove | PixiVNJsonSoundPauseResume | PixiVNJsonSoundEdit;
|
|
420
421
|
|
|
421
422
|
type PixiVNJsonOperationString = {
|
|
422
423
|
type: "operationtoconvert";
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {JsonUnifier}from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/importer';import {translator as translator$1}from'@drincs/pixi-vn-json/translator';export*from'@drincs/pixi-vn-json/translator';import {canvas,VideoSprite,showVideo,Assets,Text,showText,ImageSprite,showImage,ImageContainer,showImageContainer,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn/canvas';import {narration,NarrationManagerStatic}from'@drincs/pixi-vn/narration';import {sound}from'@drincs/pixi-vn/sound';import {createExportableElement}from'@drincs/pixi-vn';import {storage}from'@drincs/pixi-vn/storage';var h="___param___";async function L(e){let i=JsonUnifier.getLogichValue(e);if(i)switch(i.type){case "assets":switch(i.operationType){case "load":await Assets.load(i.aliases);break;case "lazyload":Assets.backgroundLoad(i.aliases);break}break;case "bundle":switch(i.operationType){case "load":await Assets.loadBundle(i.aliases);break;case "lazyload":Assets.backgroundLoadBundle(i.aliases);break}break}}var r;(n=>(n.log=(o,...u)=>console.log(`[Pixi\u2019VN Json] ${o}`,...u),n.warn=(o,...u)=>console.warn(`[Pixi\u2019VN Json] ${o}`,...u),n.error=(o,...u)=>console.error(`[Pixi\u2019VN Json] ${o}`,...u),n.info=(o,...u)=>console.info(`[Pixi\u2019VN Json] ${o}`,...u)))(r||(r={}));async function P(e,i,a){switch(a.type){case "fade":await showWithFade(i.alias,e,a.props,a.priority);break;case "dissolve":await showWithDissolve(i.alias,e,a.props,a.priority);break;case "movein":case "moveout":await moveIn(i.alias,e,a.props,a.priority);break;case "zoomin":case "zoomout":await zoomIn(i.alias,e,a.props,a.priority);break;case "pushin":case "pushout":await pushIn(i.alias,e,a.props,a.priority);break}}function y(e){if(e.transition)switch(e.transition.type){case "fade":removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);}async function E(e){switch(e.operationType){case "show":if(e.transition){let a=new ImageSprite(e.props,e.url||e.alias);await P(a,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`Image with alias ${e.alias} not found.`);break;case "remove":y(e);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let n=new VideoSprite(e.props,e.url||e.alias);await P(n,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`Video with alias ${e.alias} not found.`);break;case "remove":y(e);break;case "pause":let a=canvas.find(e.alias);a?a.paused=true:r.error(`Video with alias ${e.alias} not found.`);break;case "resume":let l=canvas.find(e.alias);l?l.paused=false:r.error(`Video with alias ${e.alias} not found.`);break}}async function R(e){switch(e.operationType){case "show":if(e.transition){let a=new ImageContainer(e.props,e.urls);await P(a,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":y(e);break}}async function M(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator$1.t(e.text),e.transition){let a=new Text(e.props);await P(a,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):r.error(`Text with alias ${e.alias} not found.`);break;case "remove":y(e);break}}async function $(e){switch(e.operationType){case "edit":try{let i=canvas.find(e.alias);i?e.props&&(i.memory={...i.memory,...e.props}):r.error(`Canvas Element with alias ${e.alias} not found.`);}catch(i){r.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,i);}break;case "remove":y(e);break}}async function G(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function D(e){switch(e.type){case "animate":canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function j(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function _(e){switch(e.operationType){case "play":sound.play(e.alias,e.props);break;case "stop":sound.stop(e.alias);break;case "pause":sound.pause(e.alias);break;case "resume":sound.resume(e.alias);break;case "volume":sound.volume(e.alias,e.value);break}}function U(e){let i=JsonUnifier.getLogichValue(e.value),a;switch(i&&typeof i=="object"&&"type"in i?a=JsonUnifier.getLogichValue(i):a=i,e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.set(e.key,a);break;case "tempstorage":storage.setTempVariable(e.key,a);break;case "params":let l=storage.get(`${h}${narration.openedLabels.length-1}`)||[];l&&l.length-1>=e.key&&(l[e.key]=a),storage.setTempVariable(`${h}${narration.openedLabels.length-1}`,l);break}}function z(e){let i=JsonUnifier.getLogichValue(e.value),a;switch(i&&typeof i=="object"&&"type"in i?a=JsonUnifier.getLogichValue(i):a=i,e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:a};break}}function T(e){let i=k(e);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case "value":return ye(i);case "arithmetic":case "arithmeticsingle":return he(i);case "compare":case "valueCondition":case "union":return Ne(i)}return i}function he(e){let i=JsonUnifier.getLogichValue(e.leftValue);switch(e.type){case "arithmetic":let a=JsonUnifier.getLogichValue(e.rightValue);switch(e.operator){case "*":return i*a;case "/":return i/a;case "+":return i+a;case "-":return i-a;case "%":return i%a;case "POW":return Math.pow(i,a);case "RANDOM":return narration.getRandomNumber(i,a)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(i);case "FLOOR":return Math.floor(i);case "FLOAT":return parseFloat(i)}break}}function ye(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return storage.get(e.key);case "flagStorage":return storage.getFlag(e.key);case "label":return narration.getTimesLabelOpened(e.label);case "choice":return narration.getTimesChoiceMade(e.index);case "logic":return JsonUnifier.getLogichValue(e.operation);case "params":let i=storage.get(`${h}${narration.openedLabels.length-1}`)||[];if(i&&i.length>e.key)return i[e.key];r.warn("getValue params not found");return}return e}function Ne(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let i=JsonUnifier.getLogichValue(e.leftValue),a=JsonUnifier.getLogichValue(e.rightValue);switch(e.operator){case "==":return i===a;case "!=":return i!==a;case "<":return i<a;case "<=":return i<=a;case ">":return i>a;case ">=":return i>=a;case "CONTAINS":return i.toString().includes(a.toString())}break;case "valueCondition":return !!JsonUnifier.getLogichValue(e.value);case "union":return Te(e)}return !!e}function Te(e){if(e.unionType==="not")return !T(e.condition);let i=e.unionType==="and";for(let a=0;a<e.conditions.length;a++)if(i=JsonUnifier.getLogichValue(e.conditions[a])||false,e.unionType==="and"){if(!i)return false}else if(i)return true;return i}function be(e,i){return Math.floor(Math.random()*(i-e+1)+e)}function k(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Pe(e);case "ifelse":return JsonUnifier.getLogichValue(e.condition)?JsonUnifier.getLogichValue(e.then):JsonUnifier.getLogichValue(e.else);case "stepswitch":let a=JsonUnifier.getLogichValue(e.elements)||[];if(a.length===0){r.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let l=be(0,a.length-1);return JsonUnifier.getLogichValue(a[l]);case "loop":let n=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>a.length-1?(n=n%a.length,JsonUnifier.getLogichValue(a[n])):JsonUnifier.getLogichValue(a[n]);case "sequential":let o,u=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(o=JsonUnifier.getLogichValue(a[a.length-1])),u>a.length-1?o:JsonUnifier.getLogichValue(a[u]);case "sequentialrandom":let V=NarrationManagerStatic.getRandomNumber(0,a.length-1,{nestedId:e.nestedId,onceOnly:true});if(V==null&&e.end=="lastItem"){let g=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!g||!g?.usedRandomNumbers){r.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let x=g.usedRandomNumbers[`0-${a.length-1}`];return JsonUnifier.getLogichValue(a[x[x.length-1]])}if(V==null){r.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return JsonUnifier.getLogichValue(a[V])}}return e}function S(e){if(e.conditionalStep){let i=createExportableElement(JsonUnifier.getLogichValue(e.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 a={...e,conditionalStep:void 0,...i};return S(a)}else narration.dialogGlue&&(narration.dialogGlue=false);}return e}function Pe(e){let i=e.firstItem,a=[];e.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(o=>{let u=JsonUnifier.getLogichValue(o);a.push(u);});else {let o=JsonUnifier.getLogichValue(n);a.push(o);}});let l=i?[i,...a]:a;if(l.length===0){r.warn("combinateResult toCheck.length === 0");return}if(typeof l[0]=="string")return translator$1.t(l);if(typeof l[0]=="object"){let n=l,o,u=false,V=n.map((s,p)=>{s=S(s);let c=JsonUnifier.getLogichValue(s.dialogue)||"";return p===0?(o=JsonUnifier.getLogichValue(s.glueEnabled)||false,c):(typeof c=="object"&&"text"in c&&(c=c.character+": "+c.text),o===false&&u&&(c=`
|
|
1
|
+
import {JsonUnifier}from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/importer';import {translator as translator$1}from'@drincs/pixi-vn-json/translator';export*from'@drincs/pixi-vn-json/translator';import {canvas,VideoSprite,showVideo,Assets,Text,showText,ImageSprite,showImage,ImageContainer,showImageContainer,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn/canvas';import {narration,NarrationManagerStatic}from'@drincs/pixi-vn/narration';import {sound}from'@drincs/pixi-vn/sound';import {createExportableElement}from'@drincs/pixi-vn';import {storage}from'@drincs/pixi-vn/storage';var y="___param___";async function E(e){let a=JsonUnifier.getLogichValue(e);if(a)switch(a.type){case "assets":switch(a.operationType){case "load":await Assets.load(a.aliases);break;case "lazyload":Assets.backgroundLoad(a.aliases);break}break;case "bundle":switch(a.operationType){case "load":await Assets.loadBundle(a.aliases);break;case "lazyload":Assets.backgroundLoadBundle(a.aliases);break}break}}var l;(n=>(n.log=(r,...u)=>console.log(`[Pixi\u2019VN Json] ${r}`,...u),n.warn=(r,...u)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...u),n.error=(r,...u)=>console.error(`[Pixi\u2019VN Json] ${r}`,...u),n.info=(r,...u)=>console.info(`[Pixi\u2019VN Json] ${r}`,...u)))(l||(l={}));async function P(e,a,i){switch(i.type){case "fade":await showWithFade(a.alias,e,i.props,i.priority);break;case "dissolve":await showWithDissolve(a.alias,e,i.props,i.priority);break;case "movein":case "moveout":await moveIn(a.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await zoomIn(a.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await pushIn(a.alias,e,i.props,i.priority);break}}function N(e){if(e.transition)switch(e.transition.type){case "fade":removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);}async function L(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageSprite(e.props,e.url||e.alias);await P(i,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):l.error(`Image with alias ${e.alias} not found.`);break;case "remove":N(e);break}}async function A(e){switch(e.operationType){case "show":if(e.transition){let n=new VideoSprite(e.props,e.url||e.alias);await P(n,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):l.error(`Video with alias ${e.alias} not found.`);break;case "remove":N(e);break;case "pause":let i=canvas.find(e.alias);i?i.paused=true:l.error(`Video with alias ${e.alias} not found.`);break;case "resume":let o=canvas.find(e.alias);o?o.paused=false:l.error(`Video with alias ${e.alias} not found.`);break}}async function R(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageContainer(e.props,e.urls);await P(i,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):l.error(`ImageContainer with alias ${e.alias} not found.`);break;case "remove":N(e);break}}async function M(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator$1.t(e.text),e.transition){let i=new Text(e.props);await P(i,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":let a=canvas.find(e.alias);a?e.props&&await a.setMemory({...a.memory,...e.props}):l.error(`Text with alias ${e.alias} not found.`);break;case "remove":N(e);break}}async function $(e){switch(e.operationType){case "edit":try{let a=canvas.find(e.alias);a?e.props&&(a.memory={...a.memory,...e.props}):l.error(`Canvas Element with alias ${e.alias} not found.`);}catch(a){l.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,a);}break;case "remove":N(e);break}}async function G(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function D(e){switch(e.type){case "animate":canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function j(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function F(e){switch(e.operationType){case "play":e.url?sound.play(e.alias,e.url,e.props):sound.play(e.alias,e.props);break;case "stop":sound.stop(e.alias);break;case "pause":switch(e.type){case "sound":sound.pause(e.alias);break;case "channel":sound.findChannel(e.alias).pauseAll();break;case "all":sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.resume(e.alias);break;case "channel":sound.findChannel(e.alias).resumeAll();break;case "all":sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([a,i])=>{let o=sound.find(e.alias);o&&o.set(a,i);});break}}function U(e){let a=JsonUnifier.getLogichValue(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=JsonUnifier.getLogichValue(a):i=a,e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.set(e.key,i);break;case "tempstorage":storage.setTempVariable(e.key,i);break;case "params":let o=storage.get(`${y}${narration.openedLabels.length-1}`)||[];o&&o.length-1>=e.key&&(o[e.key]=i),storage.setTempVariable(`${y}${narration.openedLabels.length-1}`,o);break}}function z(e){let a=JsonUnifier.getLogichValue(e.value),i;switch(a&&typeof a=="object"&&"type"in a?i=JsonUnifier.getLogichValue(a):i=a,e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:i};break}}function T(e){let a=k(e);if(a&&typeof a=="object"&&"type"in a)switch(a.type){case "value":return ye(a);case "arithmetic":case "arithmeticsingle":return xe(a);case "compare":case "valueCondition":case "union":return Ne(a)}return a}function xe(e){let a=JsonUnifier.getLogichValue(e.leftValue);switch(e.type){case "arithmetic":let i=JsonUnifier.getLogichValue(e.rightValue);switch(e.operator){case "*":return a*i;case "/":return a/i;case "+":return a+i;case "-":return a-i;case "%":return a%i;case "POW":return Math.pow(a,i);case "RANDOM":return narration.getRandomNumber(a,i)}case "arithmeticsingle":switch(e.operator){case "INT":return parseInt(a);case "FLOOR":return Math.floor(a);case "FLOAT":return parseFloat(a)}break}}function ye(e){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.inputValue:storage.get(e.key);case "flagStorage":return storage.getFlag(e.key);case "label":return narration.getTimesLabelOpened(e.label);case "choice":return narration.getTimesChoiceMade(e.index);case "logic":return JsonUnifier.getLogichValue(e.operation);case "params":let a=storage.get(`${y}${narration.openedLabels.length-1}`)||[];if(a&&a.length>e.key)return a[e.key];l.warn("getValue params not found");return}return e}function Ne(e){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":let a=JsonUnifier.getLogichValue(e.leftValue),i=JsonUnifier.getLogichValue(e.rightValue);switch(e.operator){case "==":return a===i;case "!=":return a!==i;case "<":return a<i;case "<=":return a<=i;case ">":return a>i;case ">=":return a>=i;case "CONTAINS":return a.toString().includes(i.toString())}break;case "valueCondition":return !!JsonUnifier.getLogichValue(e.value);case "union":return Te(e)}return !!e}function Te(e){if(e.unionType==="not")return !T(e.condition);let a=e.unionType==="and";for(let i=0;i<e.conditions.length;i++)if(a=JsonUnifier.getLogichValue(e.conditions[i])||false,e.unionType==="and"){if(!a)return false}else if(a)return true;return a}function be(e,a){return Math.floor(Math.random()*(a-e+1)+e)}function k(e){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Pe(e);case "ifelse":return JsonUnifier.getLogichValue(e.condition)?JsonUnifier.getLogichValue(e.then):JsonUnifier.getLogichValue(e.else);case "stepswitch":let i=JsonUnifier.getLogichValue(e.elements)||[];if(i.length===0){l.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":let o=be(0,i.length-1);return JsonUnifier.getLogichValue(i[o]);case "loop":let n=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>i.length-1?(n=n%i.length,JsonUnifier.getLogichValue(i[n])):JsonUnifier.getLogichValue(i[n]);case "sequential":let r,u=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end=="lastItem"&&(r=JsonUnifier.getLogichValue(i[i.length-1])),u>i.length-1?r:JsonUnifier.getLogichValue(i[u]);case "sequentialrandom":let h=NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(h==null&&e.end=="lastItem"){let p=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!p||!p?.usedRandomNumbers){l.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let x=p.usedRandomNumbers[`0-${i.length-1}`];return JsonUnifier.getLogichValue(i[x[x.length-1]])}if(h==null){l.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return JsonUnifier.getLogichValue(i[h])}}return e}function S(e){if(e.conditionalStep){let a=createExportableElement(JsonUnifier.getLogichValue(e.conditionalStep));if(a?.glueEnabled===void 0&&delete a?.glueEnabled,a?.goNextStep===void 0&&delete a?.goNextStep,a?.end===void 0&&delete a?.end,a?.choices===void 0&&delete a?.choices,a?.dialogue===void 0&&delete a?.dialogue,a?.labelToOpen===void 0&&delete a?.labelToOpen,a?.operations===void 0&&delete a?.operations,a){let i={...e,conditionalStep:void 0,...a};return S(i)}else narration.dialogGlue&&(narration.dialogGlue=false);}return e}function Pe(e){let a=e.firstItem,i=[];e.secondConditionalItem?.forEach(n=>{if(Array.isArray(n))n.forEach(r=>{let u=JsonUnifier.getLogichValue(r);i.push(u);});else {let r=JsonUnifier.getLogichValue(n);i.push(r);}});let o=a?[a,...i]:i;if(o.length===0){l.warn("combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return translator$1.t(o);if(typeof o[0]=="object"){let n=o,r,u=false,h=n.map((s,V)=>{s=S(s);let c=JsonUnifier.getLogichValue(s.dialogue)||"";return V===0?(r=JsonUnifier.getLogichValue(s.glueEnabled)||false,c):(typeof c=="object"&&"text"in c&&(c=c.character+": "+c.text),r===false&&u&&(c=`
|
|
2
2
|
|
|
3
|
-
`+c),c&&(u=true),
|
|
3
|
+
`+c),c&&(u=true),r=JsonUnifier.getLogichValue(s.glueEnabled)||false,c)}),p=JsonUnifier.getLogichValue(h[0]),x=typeof p=="object"&&"character"in p?p.character:void 0,O=h.flatMap(s=>{let V;s&&typeof s=="object"&&"text"in s?V=s.text:V=s;let c;return Array.isArray(V)?c=V.map(B=>{let H=JsonUnifier.getLogichValue(B);return translator$1.t(`${H}`)}):c=JsonUnifier.getLogichValue(V)||"",translator$1.t(c)}),W=n.find(s=>s.end),q=n.find(s=>s.choices),I=false,v=false;n.length>0&&(n[0].glueEnabled&&n[0].goNextStep&&n[0].dialogue===void 0&&(narration.dialogGlue=true),I=n[n.length-1].glueEnabled,v=n.reverse().find(s=>!(s.operations&&(!s.dialogue||!s.choices)))?.goNextStep);let X=n.find(s=>s.labelToOpen),w=[];return n.forEach(s=>{s.operations&&(w=[...w,...s.operations]);}),{dialogue:x?{character:x,text:O}:O,end:W?.end,choices:q?.choices,glueEnabled:I,goNextStep:v,labelToOpen:X?.labelToOpen,operations:w}}}function na({getLogichValue:e=T}){JsonUnifier.init({animateOperation:D,canvasElementOperation:$,effectOperation:G,imageContainerOperation:R,imageOperation:L,textOperation:M,narrationOperation:j,loadAssets:E,soundOperation:F,videoOperation:A,setStorageValue:U,setInitialStorageValue:z,getLogichValue:a=>e?e(k(a),T):T(a),getConditionalStep:S});}export{y as PIXIVNJSON_PARAM_ID,na as init};
|
package/dist/translator.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
'use strict';var core=require('@drincs/pixi-vn-json/core');var V=Object.defineProperty;var J=(y,e,i)=>e in y?V(y,e,{enumerable:true,configurable:true,writable:true,value:i}):y[e]=i;var m=(y,e,i)=>J(y,typeof e!="symbol"?e+"":e,i);function E(y){let e="";return y.values.forEach(i=>{if(typeof i=="string")e+=i;else {let n=core.JsonUnifier.getLogichValue(i);e+=`${n}`;}}),e}var t=class t{static t(e){return Array.isArray(e)?e.map(i=>t.translate(`${i}`)):t.translate(`${e}`)}static set beforeToTranslate(e){t._beforeToTranslate=e;}static set translate(e){t._translate=e;}static get translate(){return e=>{let i=e;return t._beforeToTranslate&&(i=t._beforeToTranslate(i)),i=t._translate(i),t._afterToTranslate&&(i=t._afterToTranslate(i)),i}}static set afterToTranslate(e){t._afterToTranslate=e;}static addKey(e,i,n){let s=n.defaultValue||"empty_string";typeof i=="string"&&(i=[i]),Array.isArray(i)&&i.forEach(f=>{e[f]===void 0&&(s==="empty_string"?e[f]="":s==="copy_key"&&(t._beforeToTranslate?e[f]=t._beforeToTranslate(f):e[f]=f));});}static getConditionalsThenElse(e,i=[]){if(typeof e=="object"&&e&&"type"in e)if(e.type==="ifelse")e.then&&t.getConditionalsThenElse(e.then,i),e.else&&t.getConditionalsThenElse(e.else,i);else if(e.type==="stepswitch"){if(e.elements)if(Array.isArray(e.elements))e.elements.forEach(n=>{t.getConditionalsThenElse(n,i);});else if(e.elements.type==="ifelse"){let n=[];t.getConditionalsThenElse(e.elements,n),n.forEach(s=>{i.push(...s);});}else if(e.elements.type==="stepswitch"){let n=[];t.getConditionalsThenElse(e.elements,n),n.forEach(s=>{i.push(...s);});}else t.getConditionalsThenElse(e.elements,i);}else e.type==="resulttocombine"?(e.firstItem&&t.getConditionalsThenElse(e.firstItem,i),e.secondConditionalItem&&e.secondConditionalItem.forEach(n=>{t.getConditionalsThenElse(n,i);})):i.push(e);else e&&i.push(e);return i}static async generateJsonTranslation(e,i={},n={}){let{defaultValue:s="copy_key",operationStringConvert:f}=n,C=e.map(async o=>{if(o.choices){let r=[];Array.isArray(o.choices)?r=[o.choices]:r=t.getConditionalsThenElse(o.choices),r.forEach(l=>l.forEach(a=>{if("type"in a){let T=[];a.type==="ifelse"||a.type==="stepswitch"?t.getConditionalsThenElse(a,T):T=[a],T.map(p=>t.getConditionalsThenElse(p.text)).forEach(p=>{Array.isArray(p)&&p.forEach(g=>{Array.isArray(g)?g.forEach(c=>{typeof c=="string"?t.addKey(i,c,{defaultValue:s}):t.getConditionalsThenElse(c).forEach(d=>{Array.isArray(d)?d.forEach(u=>{typeof u=="string"&&t.addKey(i,u,{defaultValue:s});}):typeof d=="string"&&t.addKey(i,d,{defaultValue:s});});}):typeof g=="string"&&t.addKey(i,g,{defaultValue:s});});});}}));}if(o.dialogue){let r=[];Array.isArray(o.dialogue)?r=[o.dialogue]:r=t.getConditionalsThenElse(o.dialogue),r.forEach(l=>{if(typeof l=="string")t.addKey(i,l,{defaultValue:s});else if("text"in l){let a=t.getConditionalsThenElse(l.text);typeof a=="string"&&(a=[a]),a.forEach(T=>{typeof T=="string"?t.addKey(i,T,{defaultValue:s}):t.getConditionalsThenElse(T).forEach(p=>{typeof p=="string"?t.addKey(i,p,{defaultValue:s}):Array.isArray(p)&&p.forEach(g=>{typeof g=="string"?t.addKey(i,g,{defaultValue:s}):t.getConditionalsThenElse(g).forEach(c=>{typeof c=="string"&&t.addKey(i,c,{defaultValue:s});});});});});}});}if(o.operations)for(let r of o.operations){if(r.type==="operationtoconvert"&&f){let l=E(r),a=await f(l,o,{});if(!a)return;r=a;}r.type==="text"&&r.operationType==="show"&&t.addKey(i,r.text,{defaultValue:s});}o.conditionalStep&&t.getConditionalsThenElse(o.conditionalStep).forEach(l=>{Array.isArray(l)?t.generateJsonTranslation(l,i,n):t.generateJsonTranslation([l],i,n);});});return await Promise.all(C),i}};m(t,"_beforeToTranslate"),m(t,"_translate",e=>e),m(t,"_afterToTranslate");var h=t;var L=h;exports.translator=L
|
|
1
|
+
'use strict';var core=require('@drincs/pixi-vn-json/core');var V=Object.defineProperty;var J=(y,e,i)=>e in y?V(y,e,{enumerable:true,configurable:true,writable:true,value:i}):y[e]=i;var m=(y,e,i)=>J(y,typeof e!="symbol"?e+"":e,i);function E(y){let e="";return y.values.forEach(i=>{if(typeof i=="string")e+=i;else {let n=core.JsonUnifier.getLogichValue(i);e+=`${n}`;}}),e}var t=class t{static t(e){return Array.isArray(e)?e.map(i=>t.translate(`${i}`)):t.translate(`${e}`)}static set beforeToTranslate(e){t._beforeToTranslate=e;}static set translate(e){t._translate=e;}static get translate(){return e=>{let i=e;return t._beforeToTranslate&&(i=t._beforeToTranslate(i)),i=t._translate(i),t._afterToTranslate&&(i=t._afterToTranslate(i)),i}}static set afterToTranslate(e){t._afterToTranslate=e;}static addKey(e,i,n){let s=n.defaultValue||"empty_string";typeof i=="string"&&(i=[i]),Array.isArray(i)&&i.forEach(f=>{e[f]===void 0&&(s==="empty_string"?e[f]="":s==="copy_key"&&(t._beforeToTranslate?e[f]=t._beforeToTranslate(f):e[f]=f));});}static getConditionalsThenElse(e,i=[]){if(typeof e=="object"&&e&&"type"in e)if(e.type==="ifelse")e.then&&t.getConditionalsThenElse(e.then,i),e.else&&t.getConditionalsThenElse(e.else,i);else if(e.type==="stepswitch"){if(e.elements)if(Array.isArray(e.elements))e.elements.forEach(n=>{t.getConditionalsThenElse(n,i);});else if(e.elements.type==="ifelse"){let n=[];t.getConditionalsThenElse(e.elements,n),n.forEach(s=>{i.push(...s);});}else if(e.elements.type==="stepswitch"){let n=[];t.getConditionalsThenElse(e.elements,n),n.forEach(s=>{i.push(...s);});}else t.getConditionalsThenElse(e.elements,i);}else e.type==="resulttocombine"?(e.firstItem&&t.getConditionalsThenElse(e.firstItem,i),e.secondConditionalItem&&e.secondConditionalItem.forEach(n=>{t.getConditionalsThenElse(n,i);})):i.push(e);else e&&i.push(e);return i}static async generateJsonTranslation(e,i={},n={}){let{defaultValue:s="copy_key",operationStringConvert:f}=n,C=e.map(async o=>{if(o.choices){let r=[];Array.isArray(o.choices)?r=[o.choices]:r=t.getConditionalsThenElse(o.choices),r.forEach(l=>l.forEach(a=>{if("type"in a){let T=[];a.type==="ifelse"||a.type==="stepswitch"?t.getConditionalsThenElse(a,T):T=[a],T.map(p=>t.getConditionalsThenElse(p.text)).forEach(p=>{Array.isArray(p)&&p.forEach(g=>{Array.isArray(g)?g.forEach(c=>{typeof c=="string"?t.addKey(i,c,{defaultValue:s}):t.getConditionalsThenElse(c).forEach(d=>{Array.isArray(d)?d.forEach(u=>{typeof u=="string"&&t.addKey(i,u,{defaultValue:s});}):typeof d=="string"&&t.addKey(i,d,{defaultValue:s});});}):typeof g=="string"&&t.addKey(i,g,{defaultValue:s});});});}}));}if(o.dialogue){let r=[];Array.isArray(o.dialogue)?r=[o.dialogue]:r=t.getConditionalsThenElse(o.dialogue),r.forEach(l=>{if(typeof l=="string")t.addKey(i,l,{defaultValue:s});else if("text"in l){let a=t.getConditionalsThenElse(l.text);typeof a=="string"&&(a=[a]),a.forEach(T=>{typeof T=="string"?t.addKey(i,T,{defaultValue:s}):t.getConditionalsThenElse(T).forEach(p=>{typeof p=="string"?t.addKey(i,p,{defaultValue:s}):Array.isArray(p)&&p.forEach(g=>{typeof g=="string"?t.addKey(i,g,{defaultValue:s}):t.getConditionalsThenElse(g).forEach(c=>{typeof c=="string"&&t.addKey(i,c,{defaultValue:s});});});});});}});}if(o.operations)for(let r of o.operations){if(r.type==="operationtoconvert"&&f){let l=E(r),a=await f(l,o,{});if(!a)return;r=a;}r.type==="text"&&r.operationType==="show"&&t.addKey(i,r.text,{defaultValue:s});}o.conditionalStep&&t.getConditionalsThenElse(o.conditionalStep).forEach(l=>{Array.isArray(l)?t.generateJsonTranslation(l,i,n):t.generateJsonTranslation([l],i,n);});});return await Promise.all(C),i}};m(t,"_beforeToTranslate"),m(t,"_translate",e=>e),m(t,"_afterToTranslate");var h=t;var L=h;exports.translator=L;//# sourceMappingURL=translator.cjs.map
|
|
2
|
+
//# sourceMappingURL=translator.cjs.map
|