@drincs/pixi-vn-json 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/dist/{PixiVNJsonConditionalStatements-BBopD3ft.d.cts → PixiVNJsonConditionalStatements-CVkQSKpq.d.cts} +15 -4
  2. package/dist/{PixiVNJsonConditionalStatements-CSzbVYiW.d.ts → PixiVNJsonConditionalStatements-CVkQSKpq.d.ts} +15 -4
  3. package/dist/classes/LabelJson.cjs +4 -2
  4. package/dist/classes/LabelJson.d.cts +14 -5
  5. package/dist/classes/LabelJson.d.ts +14 -5
  6. package/dist/classes/LabelJson.js +5 -3
  7. package/dist/classes/index.cjs +4 -2
  8. package/dist/classes/index.d.cts +1 -2
  9. package/dist/classes/index.d.ts +1 -2
  10. package/dist/classes/index.js +5 -3
  11. package/dist/functions/importer.cjs +4 -2
  12. package/dist/functions/importer.d.cts +6 -6
  13. package/dist/functions/importer.d.ts +6 -6
  14. package/dist/functions/importer.js +5 -3
  15. package/dist/functions/index.cjs +6 -6
  16. package/dist/functions/index.d.cts +6 -6
  17. package/dist/functions/index.d.ts +6 -6
  18. package/dist/functions/index.js +5 -3
  19. package/dist/functions/operationUtility.cjs +9 -0
  20. package/dist/functions/operationUtility.d.cts +11 -0
  21. package/dist/functions/operationUtility.d.ts +11 -0
  22. package/dist/functions/operationUtility.js +7 -0
  23. package/dist/functions/utility.cjs +6 -5
  24. package/dist/functions/utility.d.cts +11 -17
  25. package/dist/functions/utility.d.ts +11 -17
  26. package/dist/functions/utility.js +5 -3
  27. package/dist/index.cjs +9 -9
  28. package/dist/index.d.cts +2 -3
  29. package/dist/index.d.ts +2 -3
  30. package/dist/index.js +5 -3
  31. package/dist/interface/PixiVNJson.d.cts +1 -2
  32. package/dist/interface/PixiVNJson.d.ts +1 -2
  33. package/dist/interface/PixiVNJsonArithmeticOperations.d.cts +1 -2
  34. package/dist/interface/PixiVNJsonArithmeticOperations.d.ts +1 -2
  35. package/dist/interface/PixiVNJsonConditionalResultToCombine.d.cts +1 -2
  36. package/dist/interface/PixiVNJsonConditionalResultToCombine.d.ts +1 -2
  37. package/dist/interface/PixiVNJsonConditionalStatements.d.cts +1 -2
  38. package/dist/interface/PixiVNJsonConditionalStatements.d.ts +1 -2
  39. package/dist/interface/PixiVNJsonConditions.d.cts +1 -2
  40. package/dist/interface/PixiVNJsonConditions.d.ts +1 -2
  41. package/dist/interface/PixiVNJsonIfElse.d.cts +1 -2
  42. package/dist/interface/PixiVNJsonIfElse.d.ts +1 -2
  43. package/dist/interface/PixiVNJsonLabelStep.d.cts +12 -5
  44. package/dist/interface/PixiVNJsonLabelStep.d.ts +12 -5
  45. package/dist/interface/PixiVNJsonLabels.d.cts +1 -2
  46. package/dist/interface/PixiVNJsonLabels.d.ts +1 -2
  47. package/dist/interface/PixiVNJsonOperations.d.cts +1 -2
  48. package/dist/interface/PixiVNJsonOperations.d.ts +1 -2
  49. package/dist/interface/PixiVNJsonStepSwitch.d.cts +1 -2
  50. package/dist/interface/PixiVNJsonStepSwitch.d.ts +1 -2
  51. package/dist/interface/PixiVNJsonUnionCondition.d.cts +1 -2
  52. package/dist/interface/PixiVNJsonUnionCondition.d.ts +1 -2
  53. package/dist/interface/PixiVNJsonValue.d.cts +1 -2
  54. package/dist/interface/PixiVNJsonValue.d.ts +1 -2
  55. package/dist/interface/index.d.cts +1 -2
  56. package/dist/interface/index.d.ts +1 -2
  57. package/package.json +2 -2
  58. package/dist/interface/PixiVNJsonLabelCondition.cjs +0 -2
  59. package/dist/interface/PixiVNJsonLabelCondition.d.cts +0 -16
  60. package/dist/interface/PixiVNJsonLabelCondition.d.ts +0 -16
  61. package/dist/interface/PixiVNJsonLabelCondition.js +0 -1
@@ -2,6 +2,8 @@
2
2
 
3
3
  var pixiVn = require('@drincs/pixi-vn');
4
4
 
5
- var ne=Object.create;var G=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var R=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(i,n)=>(typeof require<"u"?require:i)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var F=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports);var le=(t,i,n,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of oe(i))!se.call(t,o)&&o!==n&&G(t,o,{get:()=>i[o],enumerable:!(e=re(i,o))||e.enumerable});return t};var ue=(t,i,n)=>(n=t!=null?ne(ae(t)):{},le(G(n,"default",{value:t,enumerable:!0}),t));var M=F((L,z)=>{(function(t,i){typeof L=="object"?z.exports=L=i():typeof define=="function"&&define.amd?define([],i):t.CryptoJS=i();})(L,function(){var t=t||function(i,n){var e;if(typeof window<"u"&&window.crypto&&(e=window.crypto),typeof self<"u"&&self.crypto&&(e=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(e=globalThis.crypto),!e&&typeof window<"u"&&window.msCrypto&&(e=window.msCrypto),!e&&typeof global<"u"&&global.crypto&&(e=global.crypto),!e&&typeof R=="function")try{e=R("crypto");}catch{}var o=function(){if(e){if(typeof e.getRandomValues=="function")try{return e.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof e.randomBytes=="function")try{return e.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},l=Object.create||function(){function r(){}return function(a){var p;return r.prototype=a,p=new r,r.prototype=null,p}}(),s={},d=s.lib={},x=d.Base=function(){return {extend:function(r){var a=l(this);return r&&a.mixIn(r),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var r=this.extend();return r.init.apply(r,arguments),r},init:function(){},mixIn:function(r){for(var a in r)r.hasOwnProperty(a)&&(this[a]=r[a]);r.hasOwnProperty("toString")&&(this.toString=r.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),m=d.WordArray=x.extend({init:function(r,a){r=this.words=r||[],a!=n?this.sigBytes=a:this.sigBytes=r.length*4;},toString:function(r){return (r||f).stringify(this)},concat:function(r){var a=this.words,p=r.words,g=this.sigBytes,T=r.sigBytes;if(this.clamp(),g%4)for(var N=0;N<T;N++){var B=p[N>>>2]>>>24-N%4*8&255;a[g+N>>>2]|=B<<24-(g+N)%4*8;}else for(var J=0;J<T;J+=4)a[g+J>>>2]=p[J>>>2];return this.sigBytes+=T,this},clamp:function(){var r=this.words,a=this.sigBytes;r[a>>>2]&=4294967295<<32-a%4*8,r.length=i.ceil(a/4);},clone:function(){var r=x.clone.call(this);return r.words=this.words.slice(0),r},random:function(r){for(var a=[],p=0;p<r;p+=4)a.push(o());return new m.init(a,r)}}),u=s.enc={},f=u.Hex={stringify:function(r){for(var a=r.words,p=r.sigBytes,g=[],T=0;T<p;T++){var N=a[T>>>2]>>>24-T%4*8&255;g.push((N>>>4).toString(16)),g.push((N&15).toString(16));}return g.join("")},parse:function(r){for(var a=r.length,p=[],g=0;g<a;g+=2)p[g>>>3]|=parseInt(r.substr(g,2),16)<<24-g%8*4;return new m.init(p,a/2)}},y=u.Latin1={stringify:function(r){for(var a=r.words,p=r.sigBytes,g=[],T=0;T<p;T++){var N=a[T>>>2]>>>24-T%4*8&255;g.push(String.fromCharCode(N));}return g.join("")},parse:function(r){for(var a=r.length,p=[],g=0;g<a;g++)p[g>>>2]|=(r.charCodeAt(g)&255)<<24-g%4*8;return new m.init(p,a)}},b=u.Utf8={stringify:function(r){try{return decodeURIComponent(escape(y.stringify(r)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(r){return y.parse(unescape(encodeURIComponent(r)))}},c=d.BufferedBlockAlgorithm=x.extend({reset:function(){this._data=new m.init,this._nDataBytes=0;},_append:function(r){typeof r=="string"&&(r=b.parse(r)),this._data.concat(r),this._nDataBytes+=r.sigBytes;},_process:function(r){var a,p=this._data,g=p.words,T=p.sigBytes,N=this.blockSize,B=N*4,J=T/B;r?J=i.ceil(J):J=i.max((J|0)-this._minBufferSize,0);var A=J*N,H=i.min(A*4,T);if(A){for(var D=0;D<A;D+=N)this._doProcessBlock(g,D);a=g.splice(0,A),p.sigBytes-=H;}return new m.init(a,H)},clone:function(){var r=x.clone.call(this);return r._data=this._data.clone(),r},_minBufferSize:0});d.Hasher=c.extend({cfg:x.extend(),init:function(r){this.cfg=this.cfg.extend(r),this.reset();},reset:function(){c.reset.call(this),this._doReset();},update:function(r){return this._append(r),this._process(),this},finalize:function(r){r&&this._append(r);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(r){return function(a,p){return new r.init(p).finalize(a)}},_createHmacHelper:function(r){return function(a,p){return new V.HMAC.init(r,p).finalize(a)}}});var V=s.algo={};return s}(Math);return t});});var U=F((I,W)=>{(function(t,i){typeof I=="object"?W.exports=I=i(M()):typeof define=="function"&&define.amd?define(["./core"],i):i(t.CryptoJS);})(I,function(t){return function(){var i=t,n=i.lib,e=n.WordArray,o=n.Hasher,l=i.algo,s=[],d=l.SHA1=o.extend({_doReset:function(){this._hash=new e.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(x,m){for(var u=this._hash.words,f=u[0],y=u[1],b=u[2],c=u[3],v=u[4],V=0;V<80;V++){if(V<16)s[V]=x[m+V]|0;else {var r=s[V-3]^s[V-8]^s[V-14]^s[V-16];s[V]=r<<1|r>>>31;}var a=(f<<5|f>>>27)+v+s[V];V<20?a+=(y&b|~y&c)+1518500249:V<40?a+=(y^b^c)+1859775393:V<60?a+=(y&b|y&c|b&c)-1894007588:a+=(y^b^c)-899497514,v=c,c=b,b=y<<30|y>>>2,y=f,f=a;}u[0]=u[0]+f|0,u[1]=u[1]+y|0,u[2]=u[2]+b|0,u[3]=u[3]+c|0,u[4]=u[4]+v|0;},_doFinalize:function(){var x=this._data,m=x.words,u=this._nDataBytes*8,f=x.sigBytes*8;return m[f>>>5]|=128<<24-f%32,m[(f+64>>>9<<4)+14]=Math.floor(u/4294967296),m[(f+64>>>9<<4)+15]=u,x.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var x=o.clone.call(this);return x._hash=this._hash.clone(),x}});i.SHA1=o._createHelper(d),i.HmacSHA1=o._createHmacHelper(d);}(),t.SHA1});});var ie=ue(U());var j="___param___";function de(t,i){return Math.floor(Math.random()*(i-t+1)+t)}function h(t,i){if(!(Array.isArray(t)||!t)){if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"resulttocombine":return pe(t,i);case"ifelse":return P(t.condition,i)?h(t.then,i):h(t.else,i);case"stepswitch":let e=h(t.elements,i)||[];if(e.length===0){console.error("[Pixi'VN] getValueFromConditionalStatements elements.length === 0");return}switch(t.choiceType){case"random":let o=de(0,e.length);return h(e[o],i);case"loop":return pixiVn.narration.currentStepTimesCounter>e.length-1?(pixiVn.narration.currentStepTimesCounter=0,h(e[0],i)):h(e[pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)],i);case"sequential":let l;return t.end=="lastItem"&&(l=h(e[e.length-1],i)),pixiVn.narration.currentStepTimesCounter>e.length-1?l:h(e[pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)],i);case"sequentialrandom":let s=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:t.nestedId,onceOnly:!0});if(s==null&&t.end=="lastItem"){let d=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(t.nestedId);if(!d||!d?.usedRandomNumbers)return;let x=d.usedRandomNumbers[`0-${e.length-1}`];return h(e[x[x.length-1]],i)}return s==null?void 0:h(e[s],i)}}return t}}function pe(t,i){let n=t.firstItem,e=[];t.secondConditionalItem?.forEach(l=>{if(Array.isArray(l))l.forEach(s=>{let d=h(s,i);d&&e.push(d);});else {let s=h(l,i);s&&e.push(s);}});let o=n?[n,...e]:e;if(o.length!==0){if(typeof o[0]=="string")return o.join("");if(typeof o[0]=="object"){let l=o,s=l.map(c=>c.dialogue).join(""),d=l.find(c=>c.end),x=l.find(c=>c.choices),m=l.find(c=>c.glueEnabled),u=l.find(c=>c.goNextStep),f=l.find(c=>c.labelToOpen),y=l.find(c=>c.operation);return {dialogue:s,end:d?.end,choices:x?.choices,glueEnabled:m?.glueEnabled,goNextStep:u?.goNextStep,labelToOpen:f?.labelToOpen,operation:y?.operation}}}}function ge(t,i){if(!t)return !1;if(typeof t!="object"||!("type"in t))return !!t;switch(t.type){case"compare":let n=w(t.leftValue,i),e=w(t.rightValue,i);switch(t.operator){case"==":return n===e;case"!=":return n!==e;case"<":return n<e;case"<=":return n<=e;case">":return n>e;case">=":return n>=e;case"CONTAINS":return n.toString().includes(e.toString())}break;case"valueCondition":return !!w(t.value,i);case"union":return he(t,i);case"labelcondition":if("operator"in t&&"label"in t)switch(t.operator){case"started":return pixiVn.narration.getTimesLabelOpened(t.label)>0;case"completed":return pixiVn.narration.isLabelAlreadyCompleted(t.label)}break}return !!t}function w(t,i){if(t&&typeof t=="object"&&"type"in t)if(t.type==="value"&&t.storageOperationType==="get")switch(t.storageType){case"storage":return pixiVn.storage.getVariable(t.key);case"tempstorage":return pixiVn.StorageManagerStatic.getTempVariable(t.key);case"flagStorage":return pixiVn.getFlag(t.key);case"label":return pixiVn.narration.getTimesLabelOpened(t.label);case"logic":return P(t.operation,i);case"params":return i&&i.length-1>=t.key?i[t.key]:void 0}else return P(t,i);return t}function he(t,i){if(t.unionType==="not")return !P(t.condition,i);let n=t.unionType==="and";for(let e=0;e<t.conditions.length;e++)if(n=P(t.conditions[e],i)||!1,t.unionType==="and"){if(!n)return !1}else if(n)return !0;return n}function X(t,i){let n=h(t.value,i),e;switch(n&&typeof n=="object"&&"type"in n?e=P(n,i):e=n,t.storageType){case"flagStorage":pixiVn.setFlag(t.key,t.value);break;case"storage":pixiVn.storage.setVariable(t.key,e);break;case"tempstorage":pixiVn.StorageManagerStatic.setTempVariable(t.key,e);break;case"params":i&&i.length-1>=t.key&&(i[t.key]=e);break}}function P(t,i){let n=h(t,i);if(n&&typeof n=="object"&&"type"in n)switch(n.type){case"value":return w(n,i);case"arithmetic":case"arithmeticsingle":return ye(n,i);case"compare":case"valueCondition":case"union":case"labelcondition":return ge(n,i)}return n}function ye(t,i){let n=P(t.leftValue,i);switch(t.type){case"arithmetic":let e=P(t.rightValue,i);switch(t.operator){case"*":return n*e;case"/":return n/e;case"+":return n+e;case"-":return n-e;case"%":return n%e;case"POW":return Math.pow(n,e);case"RANDOM":return Math.floor(Math.random()*(e-n+1))+n}case"arithmeticsingle":switch(t.operator){case"INT":return parseInt(n);case"FLOOR":return Math.floor(n);case"FLOAT":return parseFloat(n)}break}}var O=class extends pixiVn.LabelAbstract{constructor(i,n,e,o){super(i,e),this._steps=n,this.operationStringConvert=o;}_steps;get steps(){return this._steps.map(this.stepConverter)}operationStringConvert;getStepSha1(i){if(i<0||i>=this.steps.length)return;let n=this._steps[i];return (0, ie.default)(n.toString().toLocaleLowerCase()).toString()}getDialogueText(i,n){let e="";if(Array.isArray(i)){let o=[];i.forEach(l=>{if(typeof l=="string")o.push(l);else if(l&&typeof l=="object"){let s=h(l,n);s&&(s&&!Array.isArray(s)&&typeof s=="object"&&(s=w(s,n)||""),Array.isArray(s)?o=o.concat(s):o.push(s));}}),e=o;}else {let o=h(i,n)||"";o&&!Array.isArray(o)&&typeof o=="object"&&(o=w(o,n)||""),e=o;}return e}getDialogue(i,n){let e=h(i,n),o;return e&&(typeof e=="object"&&"character"in e&&"text"in e?o={character:e.character,text:this.getDialogueText(e.text,n)}:o=this.getDialogueText(e,n)),o}getChoices(i,n){let e=h(i,n);if(e)return e.map(l=>h(l,n)).filter(l=>l!==void 0)}stepConverter(i){return async n=>{let e=n[j];if(typeof i=="function"&&(i=i()),i.operation)for(let u of i.operation)await this.runOperation(u,e);let o=this.getChoices(i.choices,e),l=h(i.glueEnabled,e),s=this.getDialogue(i.dialogue,e),d=[];i.labelToOpen&&(Array.isArray(i.labelToOpen)||(i.labelToOpen=[i.labelToOpen]),i.labelToOpen.forEach(u=>{let f=h(u,e);f&&d.push(f);}));let x=h(i.goNextStep,e),m=h(i.end,e);if(o){let u=o.map(f=>{let y="";if(Array.isArray(f.text)){let b=[];f.text.forEach(c=>{if(typeof c=="string")b.push(c);else if(c&&typeof c=="object"){let v=h(c,e);v&&!Array.isArray(v)&&typeof v=="object"&&(v=w(v,e)||""),v&&(Array.isArray(v)?b=b.concat(v):b.push(v));}}),y=b.join();}else typeof f.text=="string"&&(y=f.text);return new pixiVn.ChoiceMenuOption(y,f.label,f.props,{type:f.type,oneTime:f.oneTime})});u=u.filter((f,y)=>{if(f.oneTime){let b=pixiVn.narration.alreadyCurrentStepMadeChoices;if(b&&b.includes(y))return !1}return !0}),pixiVn.narration.choiceMenuOptions=u;}else pixiVn.narration.choiceMenuOptions=void 0;l?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):l===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1),s&&(pixiVn.narration.dialogue=s),d.forEach(u=>{let f=u.label;typeof f=="object"&&(f=w(f,e)||"");let y=u.params?.map(b=>P(b,e));n={...n,...u.props,[j]:y},u.type==="jump"?pixiVn.narration.jumpLabel(f,n):pixiVn.narration.callLabel(f,n);}),x&&await pixiVn.narration.goNext(n),m==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(n)):m==="label_end"&&pixiVn.narration.closeCurrentLabel();}}async runOperation(i,n){let e=h(i,n);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":pixiVn.sound.add(e.alias,{...e.props,url:e.url});break;case"play":pixiVn.sound.play(e.alias,e.props);break;case"remove":pixiVn.sound.remove(e.alias);break;case"pause":pixiVn.sound.pause(e.alias);break;case"resume":pixiVn.sound.resume(e.alias);break;case"volume":pixiVn.sound.volume(e.alias,e.value);break}break;case"image":switch(e.operationType){case"show":if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,e.url,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,e.url,e.transition.props,e.transition.priority);break}else await pixiVn.showImage(e.alias,e.url);break;case"edit":let o=pixiVn.canvas.find(e.alias);o?e.props&&(o.memory={...o.memory,...e.props}):console.error(`[Pixi'VN] Image with alias ${e.alias} not found.`);break;case"remove":pixiVn.canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":if(e.transition){let d=new pixiVn.CanvasVideo;switch(d.videoLink=e.url,e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,d,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,d,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,d,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,d,e.transition.props,e.transition.priority);break}}else await pixiVn.showVideo(e.alias,e.url);break;case"edit":let o=pixiVn.canvas.find(e.alias);o?e.props&&(o.memory={...o.memory,...e.props}):console.error(`[Pixi'VN] Video with alias ${e.alias} not found.`);break;case"remove":pixiVn.canvas.remove(e.alias);break;case"pause":let l=pixiVn.canvas.find(e.alias);l?l.paused=!0:console.error(`[Pixi'VN] Video with alias ${e.alias} not found.`);break;case"resume":let s=pixiVn.canvas.find(e.alias);s?s.paused=!1:console.error(`[Pixi'VN] Video with alias ${e.alias} not found.`);break}break;case"value":X(e,n);break;case"oprationtoconvert":if(this.operationStringConvert){let o="";e.values.forEach(s=>{if(typeof s=="string")o+=s;else {let d=P(s,n);d&&(o+=`${d}`);}});let l=this.operationStringConvert(o);l&&await this.runOperation(l,n);}break;case"input":switch(e.operationType){case"request":pixiVn.narration.requestInput({type:e.valueType});break}break}}};function He(t,i){try{typeof t=="string"&&(t=JSON.parse(t));}catch(n){console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON",n);return}if(typeof t!="object"){console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON: data is not an object");return}if(t.labels){let n=t.labels;for(let e in n)try{let o=n[e],l=new O(e,o,void 0,i);pixiVn.saveLabel(l);}catch(o){console.error(`[Pixi'VN] Error creating JSON label ${e}`,o);}}}
5
+ var re=Object.create;var W=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var H=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var z=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ue=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of oe(t))!le.call(i,o)&&o!==e&&W(i,o,{get:()=>t[o],enumerable:!(r=ae(t,o))||r.enumerable});return i};var fe=(i,t,e)=>(e=i!=null?re(se(i)):{},ue(W(e,"default",{value:i,enumerable:!0}),i));var U=z((k,M)=>{(function(i,t){typeof k=="object"?M.exports=k=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(k,function(){var i=i||function(t,e){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof H=="function")try{r=H("crypto");}catch{}var o=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},u=Object.create||function(){function n(){}return function(a){var f;return n.prototype=a,f=new n,n.prototype=null,f}}(),c={},b=c.lib={},g=b.Base=function(){return {extend:function(n){var a=u(this);return n&&a.mixIn(n),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var a in n)n.hasOwnProperty(a)&&(this[a]=n[a]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),p=b.WordArray=g.extend({init:function(n,a){n=this.words=n||[],a!=e?this.sigBytes=a:this.sigBytes=n.length*4;},toString:function(n){return (n||m).stringify(this)},concat:function(n){var a=this.words,f=n.words,d=this.sigBytes,V=n.sigBytes;if(this.clamp(),d%4)for(var N=0;N<V;N++){var G=f[N>>>2]>>>24-N%4*8&255;a[d+N>>>2]|=G<<24-(d+N)%4*8;}else for(var P=0;P<V;P+=4)a[d+P>>>2]=f[P>>>2];return this.sigBytes+=V,this},clamp:function(){var n=this.words,a=this.sigBytes;n[a>>>2]&=4294967295<<32-a%4*8,n.length=t.ceil(a/4);},clone:function(){var n=g.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var a=[],f=0;f<n;f+=4)a.push(o());return new p.init(a,n)}}),l=c.enc={},m=l.Hex={stringify:function(n){for(var a=n.words,f=n.sigBytes,d=[],V=0;V<f;V++){var N=a[V>>>2]>>>24-V%4*8&255;d.push((N>>>4).toString(16)),d.push((N&15).toString(16));}return d.join("")},parse:function(n){for(var a=n.length,f=[],d=0;d<a;d+=2)f[d>>>3]|=parseInt(n.substr(d,2),16)<<24-d%8*4;return new p.init(f,a/2)}},h=l.Latin1={stringify:function(n){for(var a=n.words,f=n.sigBytes,d=[],V=0;V<f;V++){var N=a[V>>>2]>>>24-V%4*8&255;d.push(String.fromCharCode(N));}return d.join("")},parse:function(n){for(var a=n.length,f=[],d=0;d<a;d++)f[d>>>2]|=(n.charCodeAt(d)&255)<<24-d%4*8;return new p.init(f,a)}},x=l.Utf8={stringify:function(n){try{return decodeURIComponent(escape(h.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return h.parse(unescape(encodeURIComponent(n)))}},y=b.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new p.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=x.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var a,f=this._data,d=f.words,V=f.sigBytes,N=this.blockSize,G=N*4,P=V/G;n?P=t.ceil(P):P=t.max((P|0)-this._minBufferSize,0);var A=P*N,F=t.min(A*4,V);if(A){for(var j=0;j<A;j+=N)this._doProcessBlock(d,j);a=d.splice(0,A),f.sigBytes-=F;}return new p.init(a,F)},clone:function(){var n=g.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});b.Hasher=y.extend({cfg:g.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){y.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(n){return function(a,f){return new n.init(f).finalize(a)}},_createHmacHelper:function(n){return function(a,f){return new T.HMAC.init(n,f).finalize(a)}}});var T=c.algo={};return c}(Math);return i});});var q=z((I,X)=>{(function(i,t){typeof I=="object"?X.exports=I=t(U()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(I,function(i){return function(){var t=i,e=t.lib,r=e.WordArray,o=e.Hasher,u=t.algo,c=[],b=u.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,p){for(var l=this._hash.words,m=l[0],h=l[1],x=l[2],y=l[3],v=l[4],T=0;T<80;T++){if(T<16)c[T]=g[p+T]|0;else {var n=c[T-3]^c[T-8]^c[T-14]^c[T-16];c[T]=n<<1|n>>>31;}var a=(m<<5|m>>>27)+v+c[T];T<20?a+=(h&x|~h&y)+1518500249:T<40?a+=(h^x^y)+1859775393:T<60?a+=(h&x|h&y|x&y)-1894007588:a+=(h^x^y)-899497514,v=y,y=x,x=h<<30|h>>>2,h=m,m=a;}l[0]=l[0]+m|0,l[1]=l[1]+h|0,l[2]=l[2]+x|0,l[3]=l[3]+y|0,l[4]=l[4]+v|0;},_doFinalize:function(){var g=this._data,p=g.words,l=this._nDataBytes*8,m=g.sigBytes*8;return p[m>>>5]|=128<<24-m%32,p[(m+64>>>9<<4)+14]=Math.floor(l/4294967296),p[(m+64>>>9<<4)+15]=l,g.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var g=o.clone.call(this);return g._hash=this._hash.clone(),g}});t.SHA1=o._createHelper(b),t.HmacSHA1=o._createHmacHelper(b);}(),i.SHA1});});var ne=fe(q());var _="___param___";function pe(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function de(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return ge(i);case"ifelse":return s(i.condition)?s(i.then):s(i.else);case"stepswitch":let e=s(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let r=pe(0,e.length-1);return s(e[r]);case"loop":let o=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return o>e.length-1&&(o=o%e.length),s(e[o]);case"sequential":let u,c=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(u=s(e[e.length-1])),c>e.length-1?u:s(e[c]);case"sequentialrandom":let b=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(b==null&&i.end=="lastItem"){let g=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!g||!g?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let p=g.usedRandomNumbers[`0-${e.length-1}`];return s(e[p[p.length-1]])}if(b==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return s(e[b])}}return i}function R(i){if(i.conditionalStep){let t=pixiVn.createExportableElement(s(i.conditionalStep));if(t?.glueEnabled===void 0&&delete t?.glueEnabled,t?.goNextStep===void 0&&delete t?.goNextStep,t?.end===void 0&&delete t?.end,t?.choices===void 0&&delete t?.choices,t?.dialogue===void 0&&delete t?.dialogue,t?.labelToOpen===void 0&&delete t?.labelToOpen,t?.operation===void 0&&delete t?.operation,t){let e={...i,conditionalStep:void 0,...t};return R(e)}else pixiVn.getFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);}return i}function ge(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(o=>{if(Array.isArray(o))o.forEach(u=>{let c=s(u);e.push(c);});else {let u=s(o);e.push(u);}});let r=t?[t,...e]:e;if(r.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return r.join("");if(typeof r[0]=="object"){let o=r,u,c=o.map((n,a)=>{n=R(n);let f=s(n.dialogue)||"";return a===0?(u=s(n.glueEnabled)||!1,f):(typeof f=="object"&&"text"in f&&(f=f.character+": "+f.text),u===!1&&(f=`
6
6
 
7
- exports.importPixiVNJson = He;
7
+ `+f),u=s(n.glueEnabled)||!1,f)}),b=s(c[0]),g=typeof b=="object"&&"character"in b?b.character:void 0,p=c.map(n=>{let a;n&&typeof n=="object"&&"text"in n?a=n.text:a=n;let f;return Array.isArray(a)?f=a.map(d=>`${s(d)}`).join(""):f=s(a)||"",f}).join(""),l=o.find(n=>n.end),m=o.find(n=>n.choices),h=!1,x=!1;o.length>0&&(o[0].glueEnabled&&o[0].goNextStep&&o[0].dialogue===void 0&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),h=o[o.length-1].glueEnabled,x=o.reverse().find(n=>!(n.operation&&(!n.dialogue||!n.choices)))?.goNextStep);let y=o.find(n=>n.labelToOpen),v=[];return o.forEach(n=>{n.operation&&v.forEach(a=>{v.push(a);});}),{dialogue:g?{character:g,text:p}:p,end:l?.end,choices:m?.choices,glueEnabled:h,goNextStep:x,labelToOpen:y?.labelToOpen,operation:v}}}function he(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=s(i.leftValue),e=s(i.rightValue);switch(i.operator){case"==":return t===e;case"!=":return t!==e;case"<":return t<e;case"<=":return t<=e;case">":return t>e;case">=":return t>=e;case"CONTAINS":return t.toString().includes(e.toString())}break;case"valueCondition":return !!s(i.value);case"union":return me(i)}return !!i}function ye(i){if(i&&typeof i=="object"&&"type"in i&&i.type==="value"&&i.storageOperationType==="get")switch(i.storageType){case"storage":case"tempstorage":return pixiVn.storage.getVariable(i.key);case"flagStorage":return pixiVn.getFlag(i.key);case"label":return pixiVn.narration.getTimesLabelOpened(i.label);case"choice":return pixiVn.narration.getTimesChoiceMade(i.index);case"logic":return s(i.operation);case"params":let t=pixiVn.storage.getVariable(`${_}${pixiVn.narration.openedLabels.length-1}`)||[];if(t&&t.length>i.key)return t[i.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return i}function me(i){if(i.unionType==="not")return !s(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=s(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function Y(i){let t=s(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=s(t):e=t,i.storageType){case"flagStorage":pixiVn.setFlag(i.key,i.value);break;case"storage":pixiVn.storage.setVariable(i.key,e);break;case"tempstorage":pixiVn.storage.setTempVariable(i.key,e);break;case"params":let r=pixiVn.storage.getVariable(`${_}${pixiVn.narration.openedLabels.length-1}`)||[];r&&r.length-1>=i.key&&(r[i.key]=e),pixiVn.storage.setTempVariable(`${_}${pixiVn.narration.openedLabels.length-1}`,r);break}}function s(i){let t=de(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return ye(t);case"arithmetic":case"arithmeticsingle":return xe(t);case"compare":case"valueCondition":case"union":return he(t)}return t}function xe(i){let t=s(i.leftValue);switch(i.type){case"arithmetic":let e=s(i.rightValue);switch(i.operator){case"*":return t*e;case"/":return t/e;case"+":return t+e;case"-":return t-e;case"%":return t%e;case"POW":return Math.pow(t,e);case"RANDOM":return pixiVn.narration.getRandomNumber(t,e)}case"arithmeticsingle":switch(i.operator){case"INT":return parseInt(t);case"FLOOR":return Math.floor(t);case"FLOAT":return parseFloat(t)}break}}async function E(i,t){let e=s(i);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":pixiVn.sound.add(e.alias,{...e.props,url:e.url});break;case"play":pixiVn.sound.play(e.alias,e.props);break;case"remove":pixiVn.sound.remove(e.alias);break;case"pause":pixiVn.sound.pause(e.alias);break;case"resume":pixiVn.sound.resume(e.alias);break;case"volume":pixiVn.sound.volume(e.alias,e.value);break}break;case"image":switch(e.operationType){case"show":if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,e.url,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,e.url,e.transition.props,e.transition.priority);break}else await pixiVn.showImage(e.alias,e.url);break;case"edit":let r=pixiVn.canvas.find(e.alias);r?e.props&&(r.memory={...r.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":pixiVn.canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":if(e.transition){let c=new pixiVn.CanvasVideo;switch(c.videoLink=e.url,e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,c,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,c,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,c,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,c,e.transition.props,e.transition.priority);break}}else await pixiVn.showVideo(e.alias,e.url);break;case"edit":let r=pixiVn.canvas.find(e.alias);r?e.props&&(r.memory={...r.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":pixiVn.canvas.remove(e.alias);break;case"pause":let o=pixiVn.canvas.find(e.alias);o?o.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let u=pixiVn.canvas.find(e.alias);u?u.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":Y(e);break;case"oprationtoconvert":if(t){let r="";e.values.forEach(u=>{if(typeof u=="string")r+=u;else {let c=s(u);r+=`${c}`;}});let o=t(r);o&&await E(o);}break;case"input":switch(e.operationType){case"request":pixiVn.narration.requestInput({type:e.valueType});break}break}}var L=class extends pixiVn.LabelAbstract{constructor(t,e,r,o={}){super(t,r),this._steps=e,this.operationStringConvert=o.operationStringConvert,this.skipEmptyDialogs=o.skipEmptyDialogs||!1;}_steps;get steps(){return this._steps.map(t=>this.stepConverter(t))}operationStringConvert;skipEmptyDialogs=!1;getStepSha1(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, ne.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let r=[];t.forEach(o=>{if(typeof o=="string")r.push(o);else if(o&&typeof o=="object"){let u=s(o);u?(u&&!Array.isArray(u)&&typeof u=="object"&&(u=s(u)||""),Array.isArray(u)?r=r.concat(u):r.push(`${u}`)):r.push(`${o}`);}}),e=r;}else {let r=s(t)||"";r&&!Array.isArray(r)&&typeof r=="object"&&(r=s(r)||""),e=r;}return `${e}`}getDialogue(t){let e=s(t);if(e)return typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:this.getDialogueText(e.text)}:this.getDialogueText(e);if(e!=null)return `${e}`}getChoices(t){return s(t)?.map(o=>s(o)).filter(o=>o!==void 0)}stepConverter(t){return async e=>{if(typeof t=="function"&&(t=t()),t=R(t),t.operation)for(let p of t.operation)await E(p,this.operationStringConvert);let r=this.getChoices(t.choices),o=s(t.glueEnabled),u=this.getDialogue(t.dialogue),c=[];t.labelToOpen&&(Array.isArray(t.labelToOpen)||(t.labelToOpen=[t.labelToOpen]),t.labelToOpen.forEach(p=>{let l=s(p);l&&c.push(l);}));let b=s(t.goNextStep),g=s(t.end);if(r){let p=r.map(l=>{let m="";if(Array.isArray(l.text)){let h=[];l.text.forEach(x=>{if(typeof x=="string")h.push(x);else if(x&&typeof x=="object"){let y=s(x);y&&!Array.isArray(y)&&typeof y=="object"&&(y=s(y)||""),y&&(Array.isArray(y)?h=h.concat(y):h.push(y));}}),m=h.join();}else typeof l.text=="string"&&(m=l.text);return new pixiVn.ChoiceMenuOption(m,l.label,l.props,{type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect})});pixiVn.narration.choiceMenuOptions=p;}else pixiVn.narration.choiceMenuOptions=void 0;u!==void 0&&(pixiVn.narration.dialogue=u,this.skipEmptyDialogs&&typeof u=="string"&&(u===""||RegExp(/^\s+$/).test(u))&&(b=!0)),o?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):o===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1),c.forEach(p=>{let l=p.label;typeof l=="object"&&(l=s(l)||"");let m=p.params?.map(h=>s(h));e={...e,...p.props},p.type==="jump"?(pixiVn.narration.closeCurrentLabel(),pixiVn.storage.setTempVariable(`${_}${pixiVn.narration.openedLabels.length}`,m),pixiVn.narration.callLabel(l,e)):(pixiVn.storage.setTempVariable(`${_}${pixiVn.narration.openedLabels.length}`,m),pixiVn.narration.callLabel(l,e));}),g==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e)):g==="label_end"&&pixiVn.narration.closeCurrentLabel(),b&&await pixiVn.narration.goNext(e);}}};function Ke(i,t={}){let e=t?.operationStringConvert;try{typeof i=="string"&&(i=JSON.parse(i));}catch(r){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON",r);return}if(typeof i!="object"){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON: data is not an object");return}if(i.initialOperations){for(let r of i.initialOperations)E(r,e);pixiVn.StorageManagerStatic.saveStorageAsBasicStorage();}if(i.labels){let r=i.labels;for(let o in r)try{let u=r[o],c=new L(o,u,void 0,t);pixiVn.saveLabel(c);}catch(u){console.error(`[Pixi\u2019VN Json] Error creating JSON label ${o}`,u);}}}
8
+
9
+ exports.importPixiVNJson = Ke;
@@ -1,14 +1,14 @@
1
+ import { LabelJsonOptions } from '../classes/LabelJson.cjs';
1
2
  import PixiVNJson from '../interface/PixiVNJson.cjs';
2
- import { PixiVNJsonOperation } from '../interface/PixiVNJsonOperations.cjs';
3
- import '../interface/PixiVNJsonLabels.cjs';
4
- import '../interface/PixiVNJsonLabelStep.cjs';
5
3
  import '@drincs/pixi-vn';
6
- import '../PixiVNJsonConditionalStatements-BBopD3ft.cjs';
7
- import '../interface/PixiVNJsonLabelCondition.cjs';
4
+ import '../interface/PixiVNJsonLabelStep.cjs';
5
+ import '../PixiVNJsonConditionalStatements-CVkQSKpq.cjs';
6
+ import '../interface/PixiVNJsonOperations.cjs';
8
7
  import '../interface/PixiVNJsonInput.cjs';
9
8
  import '../interface/PixiVNJsonMedia.cjs';
10
9
  import '../interface/PixiVNJsonMediaTransiotions.cjs';
11
10
  import 'pixi.js';
11
+ import '../interface/PixiVNJsonLabels.cjs';
12
12
 
13
13
  /**
14
14
  * Import a Pixi'VN JSON to the system.
@@ -16,6 +16,6 @@ import 'pixi.js';
16
16
  * @param data The Pixi'VN JSON to be imported
17
17
  * @returns
18
18
  */
19
- declare function importPixiVNJson(data: PixiVNJson | string, operationStringConvert?: (value: string) => PixiVNJsonOperation | undefined): void;
19
+ declare function importPixiVNJson(data: PixiVNJson | string, options?: LabelJsonOptions): void;
20
20
 
21
21
  export { importPixiVNJson };
@@ -1,14 +1,14 @@
1
+ import { LabelJsonOptions } from '../classes/LabelJson.js';
1
2
  import PixiVNJson from '../interface/PixiVNJson.js';
2
- import { PixiVNJsonOperation } from '../interface/PixiVNJsonOperations.js';
3
- import '../interface/PixiVNJsonLabels.js';
4
- import '../interface/PixiVNJsonLabelStep.js';
5
3
  import '@drincs/pixi-vn';
6
- import '../PixiVNJsonConditionalStatements-CSzbVYiW.js';
7
- import '../interface/PixiVNJsonLabelCondition.js';
4
+ import '../interface/PixiVNJsonLabelStep.js';
5
+ import '../PixiVNJsonConditionalStatements-CVkQSKpq.js';
6
+ import '../interface/PixiVNJsonOperations.js';
8
7
  import '../interface/PixiVNJsonInput.js';
9
8
  import '../interface/PixiVNJsonMedia.js';
10
9
  import '../interface/PixiVNJsonMediaTransiotions.js';
11
10
  import 'pixi.js';
11
+ import '../interface/PixiVNJsonLabels.js';
12
12
 
13
13
  /**
14
14
  * Import a Pixi'VN JSON to the system.
@@ -16,6 +16,6 @@ import 'pixi.js';
16
16
  * @param data The Pixi'VN JSON to be imported
17
17
  * @returns
18
18
  */
19
- declare function importPixiVNJson(data: PixiVNJson | string, operationStringConvert?: (value: string) => PixiVNJsonOperation | undefined): void;
19
+ declare function importPixiVNJson(data: PixiVNJson | string, options?: LabelJsonOptions): void;
20
20
 
21
21
  export { importPixiVNJson };
@@ -1,5 +1,7 @@
1
- import { saveLabel, LabelAbstract, ChoiceMenuOption, narration, setFlag, storage, canvas, CanvasVideo, zoomIn, moveIn, showWithDissolveTransition, showWithFadeTransition, showVideo, showImage, sound, NarrationManagerStatic, getFlag, StorageManagerStatic } from '@drincs/pixi-vn';
1
+ import { StorageManagerStatic, saveLabel, narration, canvas, CanvasVideo, zoomIn, moveIn, showWithDissolveTransition, showWithFadeTransition, showVideo, showImage, sound, LabelAbstract, ChoiceMenuOption, setFlag, storage, createExportableElement, getFlag, NarrationManagerStatic } from '@drincs/pixi-vn';
2
2
 
3
- var ne=Object.create;var G=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var R=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(i,n)=>(typeof require<"u"?require:i)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var F=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports);var le=(t,i,n,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of oe(i))!se.call(t,o)&&o!==n&&G(t,o,{get:()=>i[o],enumerable:!(e=re(i,o))||e.enumerable});return t};var ue=(t,i,n)=>(n=t!=null?ne(ae(t)):{},le(G(n,"default",{value:t,enumerable:!0}),t));var M=F((L,z)=>{(function(t,i){typeof L=="object"?z.exports=L=i():typeof define=="function"&&define.amd?define([],i):t.CryptoJS=i();})(L,function(){var t=t||function(i,n){var e;if(typeof window<"u"&&window.crypto&&(e=window.crypto),typeof self<"u"&&self.crypto&&(e=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(e=globalThis.crypto),!e&&typeof window<"u"&&window.msCrypto&&(e=window.msCrypto),!e&&typeof global<"u"&&global.crypto&&(e=global.crypto),!e&&typeof R=="function")try{e=R("crypto");}catch{}var o=function(){if(e){if(typeof e.getRandomValues=="function")try{return e.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof e.randomBytes=="function")try{return e.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},l=Object.create||function(){function r(){}return function(a){var p;return r.prototype=a,p=new r,r.prototype=null,p}}(),s={},d=s.lib={},x=d.Base=function(){return {extend:function(r){var a=l(this);return r&&a.mixIn(r),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var r=this.extend();return r.init.apply(r,arguments),r},init:function(){},mixIn:function(r){for(var a in r)r.hasOwnProperty(a)&&(this[a]=r[a]);r.hasOwnProperty("toString")&&(this.toString=r.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),m=d.WordArray=x.extend({init:function(r,a){r=this.words=r||[],a!=n?this.sigBytes=a:this.sigBytes=r.length*4;},toString:function(r){return (r||f).stringify(this)},concat:function(r){var a=this.words,p=r.words,g=this.sigBytes,T=r.sigBytes;if(this.clamp(),g%4)for(var N=0;N<T;N++){var B=p[N>>>2]>>>24-N%4*8&255;a[g+N>>>2]|=B<<24-(g+N)%4*8;}else for(var J=0;J<T;J+=4)a[g+J>>>2]=p[J>>>2];return this.sigBytes+=T,this},clamp:function(){var r=this.words,a=this.sigBytes;r[a>>>2]&=4294967295<<32-a%4*8,r.length=i.ceil(a/4);},clone:function(){var r=x.clone.call(this);return r.words=this.words.slice(0),r},random:function(r){for(var a=[],p=0;p<r;p+=4)a.push(o());return new m.init(a,r)}}),u=s.enc={},f=u.Hex={stringify:function(r){for(var a=r.words,p=r.sigBytes,g=[],T=0;T<p;T++){var N=a[T>>>2]>>>24-T%4*8&255;g.push((N>>>4).toString(16)),g.push((N&15).toString(16));}return g.join("")},parse:function(r){for(var a=r.length,p=[],g=0;g<a;g+=2)p[g>>>3]|=parseInt(r.substr(g,2),16)<<24-g%8*4;return new m.init(p,a/2)}},y=u.Latin1={stringify:function(r){for(var a=r.words,p=r.sigBytes,g=[],T=0;T<p;T++){var N=a[T>>>2]>>>24-T%4*8&255;g.push(String.fromCharCode(N));}return g.join("")},parse:function(r){for(var a=r.length,p=[],g=0;g<a;g++)p[g>>>2]|=(r.charCodeAt(g)&255)<<24-g%4*8;return new m.init(p,a)}},b=u.Utf8={stringify:function(r){try{return decodeURIComponent(escape(y.stringify(r)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(r){return y.parse(unescape(encodeURIComponent(r)))}},c=d.BufferedBlockAlgorithm=x.extend({reset:function(){this._data=new m.init,this._nDataBytes=0;},_append:function(r){typeof r=="string"&&(r=b.parse(r)),this._data.concat(r),this._nDataBytes+=r.sigBytes;},_process:function(r){var a,p=this._data,g=p.words,T=p.sigBytes,N=this.blockSize,B=N*4,J=T/B;r?J=i.ceil(J):J=i.max((J|0)-this._minBufferSize,0);var A=J*N,H=i.min(A*4,T);if(A){for(var D=0;D<A;D+=N)this._doProcessBlock(g,D);a=g.splice(0,A),p.sigBytes-=H;}return new m.init(a,H)},clone:function(){var r=x.clone.call(this);return r._data=this._data.clone(),r},_minBufferSize:0});d.Hasher=c.extend({cfg:x.extend(),init:function(r){this.cfg=this.cfg.extend(r),this.reset();},reset:function(){c.reset.call(this),this._doReset();},update:function(r){return this._append(r),this._process(),this},finalize:function(r){r&&this._append(r);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(r){return function(a,p){return new r.init(p).finalize(a)}},_createHmacHelper:function(r){return function(a,p){return new V.HMAC.init(r,p).finalize(a)}}});var V=s.algo={};return s}(Math);return t});});var U=F((I,W)=>{(function(t,i){typeof I=="object"?W.exports=I=i(M()):typeof define=="function"&&define.amd?define(["./core"],i):i(t.CryptoJS);})(I,function(t){return function(){var i=t,n=i.lib,e=n.WordArray,o=n.Hasher,l=i.algo,s=[],d=l.SHA1=o.extend({_doReset:function(){this._hash=new e.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(x,m){for(var u=this._hash.words,f=u[0],y=u[1],b=u[2],c=u[3],v=u[4],V=0;V<80;V++){if(V<16)s[V]=x[m+V]|0;else {var r=s[V-3]^s[V-8]^s[V-14]^s[V-16];s[V]=r<<1|r>>>31;}var a=(f<<5|f>>>27)+v+s[V];V<20?a+=(y&b|~y&c)+1518500249:V<40?a+=(y^b^c)+1859775393:V<60?a+=(y&b|y&c|b&c)-1894007588:a+=(y^b^c)-899497514,v=c,c=b,b=y<<30|y>>>2,y=f,f=a;}u[0]=u[0]+f|0,u[1]=u[1]+y|0,u[2]=u[2]+b|0,u[3]=u[3]+c|0,u[4]=u[4]+v|0;},_doFinalize:function(){var x=this._data,m=x.words,u=this._nDataBytes*8,f=x.sigBytes*8;return m[f>>>5]|=128<<24-f%32,m[(f+64>>>9<<4)+14]=Math.floor(u/4294967296),m[(f+64>>>9<<4)+15]=u,x.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var x=o.clone.call(this);return x._hash=this._hash.clone(),x}});i.SHA1=o._createHelper(d),i.HmacSHA1=o._createHmacHelper(d);}(),t.SHA1});});var ie=ue(U());var j="___param___";function de(t,i){return Math.floor(Math.random()*(i-t+1)+t)}function h(t,i){if(!(Array.isArray(t)||!t)){if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"resulttocombine":return pe(t,i);case"ifelse":return P(t.condition,i)?h(t.then,i):h(t.else,i);case"stepswitch":let e=h(t.elements,i)||[];if(e.length===0){console.error("[Pixi'VN] getValueFromConditionalStatements elements.length === 0");return}switch(t.choiceType){case"random":let o=de(0,e.length);return h(e[o],i);case"loop":return narration.currentStepTimesCounter>e.length-1?(narration.currentStepTimesCounter=0,h(e[0],i)):h(e[NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)],i);case"sequential":let l;return t.end=="lastItem"&&(l=h(e[e.length-1],i)),narration.currentStepTimesCounter>e.length-1?l:h(e[NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)],i);case"sequentialrandom":let s=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:t.nestedId,onceOnly:!0});if(s==null&&t.end=="lastItem"){let d=NarrationManagerStatic.getCurrentStepTimesCounterData(t.nestedId);if(!d||!d?.usedRandomNumbers)return;let x=d.usedRandomNumbers[`0-${e.length-1}`];return h(e[x[x.length-1]],i)}return s==null?void 0:h(e[s],i)}}return t}}function pe(t,i){let n=t.firstItem,e=[];t.secondConditionalItem?.forEach(l=>{if(Array.isArray(l))l.forEach(s=>{let d=h(s,i);d&&e.push(d);});else {let s=h(l,i);s&&e.push(s);}});let o=n?[n,...e]:e;if(o.length!==0){if(typeof o[0]=="string")return o.join("");if(typeof o[0]=="object"){let l=o,s=l.map(c=>c.dialogue).join(""),d=l.find(c=>c.end),x=l.find(c=>c.choices),m=l.find(c=>c.glueEnabled),u=l.find(c=>c.goNextStep),f=l.find(c=>c.labelToOpen),y=l.find(c=>c.operation);return {dialogue:s,end:d?.end,choices:x?.choices,glueEnabled:m?.glueEnabled,goNextStep:u?.goNextStep,labelToOpen:f?.labelToOpen,operation:y?.operation}}}}function ge(t,i){if(!t)return !1;if(typeof t!="object"||!("type"in t))return !!t;switch(t.type){case"compare":let n=w(t.leftValue,i),e=w(t.rightValue,i);switch(t.operator){case"==":return n===e;case"!=":return n!==e;case"<":return n<e;case"<=":return n<=e;case">":return n>e;case">=":return n>=e;case"CONTAINS":return n.toString().includes(e.toString())}break;case"valueCondition":return !!w(t.value,i);case"union":return he(t,i);case"labelcondition":if("operator"in t&&"label"in t)switch(t.operator){case"started":return narration.getTimesLabelOpened(t.label)>0;case"completed":return narration.isLabelAlreadyCompleted(t.label)}break}return !!t}function w(t,i){if(t&&typeof t=="object"&&"type"in t)if(t.type==="value"&&t.storageOperationType==="get")switch(t.storageType){case"storage":return storage.getVariable(t.key);case"tempstorage":return StorageManagerStatic.getTempVariable(t.key);case"flagStorage":return getFlag(t.key);case"label":return narration.getTimesLabelOpened(t.label);case"logic":return P(t.operation,i);case"params":return i&&i.length-1>=t.key?i[t.key]:void 0}else return P(t,i);return t}function he(t,i){if(t.unionType==="not")return !P(t.condition,i);let n=t.unionType==="and";for(let e=0;e<t.conditions.length;e++)if(n=P(t.conditions[e],i)||!1,t.unionType==="and"){if(!n)return !1}else if(n)return !0;return n}function X(t,i){let n=h(t.value,i),e;switch(n&&typeof n=="object"&&"type"in n?e=P(n,i):e=n,t.storageType){case"flagStorage":setFlag(t.key,t.value);break;case"storage":storage.setVariable(t.key,e);break;case"tempstorage":StorageManagerStatic.setTempVariable(t.key,e);break;case"params":i&&i.length-1>=t.key&&(i[t.key]=e);break}}function P(t,i){let n=h(t,i);if(n&&typeof n=="object"&&"type"in n)switch(n.type){case"value":return w(n,i);case"arithmetic":case"arithmeticsingle":return ye(n,i);case"compare":case"valueCondition":case"union":case"labelcondition":return ge(n,i)}return n}function ye(t,i){let n=P(t.leftValue,i);switch(t.type){case"arithmetic":let e=P(t.rightValue,i);switch(t.operator){case"*":return n*e;case"/":return n/e;case"+":return n+e;case"-":return n-e;case"%":return n%e;case"POW":return Math.pow(n,e);case"RANDOM":return Math.floor(Math.random()*(e-n+1))+n}case"arithmeticsingle":switch(t.operator){case"INT":return parseInt(n);case"FLOOR":return Math.floor(n);case"FLOAT":return parseFloat(n)}break}}var O=class extends LabelAbstract{constructor(i,n,e,o){super(i,e),this._steps=n,this.operationStringConvert=o;}_steps;get steps(){return this._steps.map(this.stepConverter)}operationStringConvert;getStepSha1(i){if(i<0||i>=this.steps.length)return;let n=this._steps[i];return (0, ie.default)(n.toString().toLocaleLowerCase()).toString()}getDialogueText(i,n){let e="";if(Array.isArray(i)){let o=[];i.forEach(l=>{if(typeof l=="string")o.push(l);else if(l&&typeof l=="object"){let s=h(l,n);s&&(s&&!Array.isArray(s)&&typeof s=="object"&&(s=w(s,n)||""),Array.isArray(s)?o=o.concat(s):o.push(s));}}),e=o;}else {let o=h(i,n)||"";o&&!Array.isArray(o)&&typeof o=="object"&&(o=w(o,n)||""),e=o;}return e}getDialogue(i,n){let e=h(i,n),o;return e&&(typeof e=="object"&&"character"in e&&"text"in e?o={character:e.character,text:this.getDialogueText(e.text,n)}:o=this.getDialogueText(e,n)),o}getChoices(i,n){let e=h(i,n);if(e)return e.map(l=>h(l,n)).filter(l=>l!==void 0)}stepConverter(i){return async n=>{let e=n[j];if(typeof i=="function"&&(i=i()),i.operation)for(let u of i.operation)await this.runOperation(u,e);let o=this.getChoices(i.choices,e),l=h(i.glueEnabled,e),s=this.getDialogue(i.dialogue,e),d=[];i.labelToOpen&&(Array.isArray(i.labelToOpen)||(i.labelToOpen=[i.labelToOpen]),i.labelToOpen.forEach(u=>{let f=h(u,e);f&&d.push(f);}));let x=h(i.goNextStep,e),m=h(i.end,e);if(o){let u=o.map(f=>{let y="";if(Array.isArray(f.text)){let b=[];f.text.forEach(c=>{if(typeof c=="string")b.push(c);else if(c&&typeof c=="object"){let v=h(c,e);v&&!Array.isArray(v)&&typeof v=="object"&&(v=w(v,e)||""),v&&(Array.isArray(v)?b=b.concat(v):b.push(v));}}),y=b.join();}else typeof f.text=="string"&&(y=f.text);return new ChoiceMenuOption(y,f.label,f.props,{type:f.type,oneTime:f.oneTime})});u=u.filter((f,y)=>{if(f.oneTime){let b=narration.alreadyCurrentStepMadeChoices;if(b&&b.includes(y))return !1}return !0}),narration.choiceMenuOptions=u;}else narration.choiceMenuOptions=void 0;l?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):l===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1),s&&(narration.dialogue=s),d.forEach(u=>{let f=u.label;typeof f=="object"&&(f=w(f,e)||"");let y=u.params?.map(b=>P(b,e));n={...n,...u.props,[j]:y},u.type==="jump"?narration.jumpLabel(f,n):narration.callLabel(f,n);}),x&&await narration.goNext(n),m==="game_end"?(narration.closeAllLabels(),await narration.goNext(n)):m==="label_end"&&narration.closeCurrentLabel();}}async runOperation(i,n){let e=h(i,n);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":sound.add(e.alias,{...e.props,url:e.url});break;case"play":sound.play(e.alias,e.props);break;case"remove":sound.remove(e.alias);break;case"pause":sound.pause(e.alias);break;case"resume":sound.resume(e.alias);break;case"volume":sound.volume(e.alias,e.value);break}break;case"image":switch(e.operationType){case"show":if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,e.url,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,e.url,e.transition.props,e.transition.priority);break}else await showImage(e.alias,e.url);break;case"edit":let o=canvas.find(e.alias);o?e.props&&(o.memory={...o.memory,...e.props}):console.error(`[Pixi'VN] Image with alias ${e.alias} not found.`);break;case"remove":canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":if(e.transition){let d=new CanvasVideo;switch(d.videoLink=e.url,e.transition.type){case"fade":await showWithFadeTransition(e.alias,d,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,d,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,d,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,d,e.transition.props,e.transition.priority);break}}else await showVideo(e.alias,e.url);break;case"edit":let o=canvas.find(e.alias);o?e.props&&(o.memory={...o.memory,...e.props}):console.error(`[Pixi'VN] Video with alias ${e.alias} not found.`);break;case"remove":canvas.remove(e.alias);break;case"pause":let l=canvas.find(e.alias);l?l.paused=!0:console.error(`[Pixi'VN] Video with alias ${e.alias} not found.`);break;case"resume":let s=canvas.find(e.alias);s?s.paused=!1:console.error(`[Pixi'VN] Video with alias ${e.alias} not found.`);break}break;case"value":X(e,n);break;case"oprationtoconvert":if(this.operationStringConvert){let o="";e.values.forEach(s=>{if(typeof s=="string")o+=s;else {let d=P(s,n);d&&(o+=`${d}`);}});let l=this.operationStringConvert(o);l&&await this.runOperation(l,n);}break;case"input":switch(e.operationType){case"request":narration.requestInput({type:e.valueType});break}break}}};function He(t,i){try{typeof t=="string"&&(t=JSON.parse(t));}catch(n){console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON",n);return}if(typeof t!="object"){console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON: data is not an object");return}if(t.labels){let n=t.labels;for(let e in n)try{let o=n[e],l=new O(e,o,void 0,i);saveLabel(l);}catch(o){console.error(`[Pixi'VN] Error creating JSON label ${e}`,o);}}}
3
+ var re=Object.create;var W=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var H=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var z=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ue=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of oe(t))!le.call(i,o)&&o!==e&&W(i,o,{get:()=>t[o],enumerable:!(r=ae(t,o))||r.enumerable});return i};var fe=(i,t,e)=>(e=i!=null?re(se(i)):{},ue(W(e,"default",{value:i,enumerable:!0}),i));var U=z((k,M)=>{(function(i,t){typeof k=="object"?M.exports=k=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(k,function(){var i=i||function(t,e){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof H=="function")try{r=H("crypto");}catch{}var o=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},u=Object.create||function(){function n(){}return function(a){var f;return n.prototype=a,f=new n,n.prototype=null,f}}(),c={},b=c.lib={},g=b.Base=function(){return {extend:function(n){var a=u(this);return n&&a.mixIn(n),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var a in n)n.hasOwnProperty(a)&&(this[a]=n[a]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),p=b.WordArray=g.extend({init:function(n,a){n=this.words=n||[],a!=e?this.sigBytes=a:this.sigBytes=n.length*4;},toString:function(n){return (n||m).stringify(this)},concat:function(n){var a=this.words,f=n.words,d=this.sigBytes,V=n.sigBytes;if(this.clamp(),d%4)for(var N=0;N<V;N++){var G=f[N>>>2]>>>24-N%4*8&255;a[d+N>>>2]|=G<<24-(d+N)%4*8;}else for(var P=0;P<V;P+=4)a[d+P>>>2]=f[P>>>2];return this.sigBytes+=V,this},clamp:function(){var n=this.words,a=this.sigBytes;n[a>>>2]&=4294967295<<32-a%4*8,n.length=t.ceil(a/4);},clone:function(){var n=g.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var a=[],f=0;f<n;f+=4)a.push(o());return new p.init(a,n)}}),l=c.enc={},m=l.Hex={stringify:function(n){for(var a=n.words,f=n.sigBytes,d=[],V=0;V<f;V++){var N=a[V>>>2]>>>24-V%4*8&255;d.push((N>>>4).toString(16)),d.push((N&15).toString(16));}return d.join("")},parse:function(n){for(var a=n.length,f=[],d=0;d<a;d+=2)f[d>>>3]|=parseInt(n.substr(d,2),16)<<24-d%8*4;return new p.init(f,a/2)}},h=l.Latin1={stringify:function(n){for(var a=n.words,f=n.sigBytes,d=[],V=0;V<f;V++){var N=a[V>>>2]>>>24-V%4*8&255;d.push(String.fromCharCode(N));}return d.join("")},parse:function(n){for(var a=n.length,f=[],d=0;d<a;d++)f[d>>>2]|=(n.charCodeAt(d)&255)<<24-d%4*8;return new p.init(f,a)}},x=l.Utf8={stringify:function(n){try{return decodeURIComponent(escape(h.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return h.parse(unescape(encodeURIComponent(n)))}},y=b.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new p.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=x.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var a,f=this._data,d=f.words,V=f.sigBytes,N=this.blockSize,G=N*4,P=V/G;n?P=t.ceil(P):P=t.max((P|0)-this._minBufferSize,0);var A=P*N,F=t.min(A*4,V);if(A){for(var j=0;j<A;j+=N)this._doProcessBlock(d,j);a=d.splice(0,A),f.sigBytes-=F;}return new p.init(a,F)},clone:function(){var n=g.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});b.Hasher=y.extend({cfg:g.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){y.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(n){return function(a,f){return new n.init(f).finalize(a)}},_createHmacHelper:function(n){return function(a,f){return new T.HMAC.init(n,f).finalize(a)}}});var T=c.algo={};return c}(Math);return i});});var q=z((I,X)=>{(function(i,t){typeof I=="object"?X.exports=I=t(U()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(I,function(i){return function(){var t=i,e=t.lib,r=e.WordArray,o=e.Hasher,u=t.algo,c=[],b=u.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,p){for(var l=this._hash.words,m=l[0],h=l[1],x=l[2],y=l[3],v=l[4],T=0;T<80;T++){if(T<16)c[T]=g[p+T]|0;else {var n=c[T-3]^c[T-8]^c[T-14]^c[T-16];c[T]=n<<1|n>>>31;}var a=(m<<5|m>>>27)+v+c[T];T<20?a+=(h&x|~h&y)+1518500249:T<40?a+=(h^x^y)+1859775393:T<60?a+=(h&x|h&y|x&y)-1894007588:a+=(h^x^y)-899497514,v=y,y=x,x=h<<30|h>>>2,h=m,m=a;}l[0]=l[0]+m|0,l[1]=l[1]+h|0,l[2]=l[2]+x|0,l[3]=l[3]+y|0,l[4]=l[4]+v|0;},_doFinalize:function(){var g=this._data,p=g.words,l=this._nDataBytes*8,m=g.sigBytes*8;return p[m>>>5]|=128<<24-m%32,p[(m+64>>>9<<4)+14]=Math.floor(l/4294967296),p[(m+64>>>9<<4)+15]=l,g.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var g=o.clone.call(this);return g._hash=this._hash.clone(),g}});t.SHA1=o._createHelper(b),t.HmacSHA1=o._createHmacHelper(b);}(),i.SHA1});});var ne=fe(q());var _="___param___";function pe(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function de(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return ge(i);case"ifelse":return s(i.condition)?s(i.then):s(i.else);case"stepswitch":let e=s(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let r=pe(0,e.length-1);return s(e[r]);case"loop":let o=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return o>e.length-1&&(o=o%e.length),s(e[o]);case"sequential":let u,c=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(u=s(e[e.length-1])),c>e.length-1?u:s(e[c]);case"sequentialrandom":let b=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(b==null&&i.end=="lastItem"){let g=NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!g||!g?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let p=g.usedRandomNumbers[`0-${e.length-1}`];return s(e[p[p.length-1]])}if(b==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return s(e[b])}}return i}function R(i){if(i.conditionalStep){let t=createExportableElement(s(i.conditionalStep));if(t?.glueEnabled===void 0&&delete t?.glueEnabled,t?.goNextStep===void 0&&delete t?.goNextStep,t?.end===void 0&&delete t?.end,t?.choices===void 0&&delete t?.choices,t?.dialogue===void 0&&delete t?.dialogue,t?.labelToOpen===void 0&&delete t?.labelToOpen,t?.operation===void 0&&delete t?.operation,t){let e={...i,conditionalStep:void 0,...t};return R(e)}else getFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);}return i}function ge(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(o=>{if(Array.isArray(o))o.forEach(u=>{let c=s(u);e.push(c);});else {let u=s(o);e.push(u);}});let r=t?[t,...e]:e;if(r.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return r.join("");if(typeof r[0]=="object"){let o=r,u,c=o.map((n,a)=>{n=R(n);let f=s(n.dialogue)||"";return a===0?(u=s(n.glueEnabled)||!1,f):(typeof f=="object"&&"text"in f&&(f=f.character+": "+f.text),u===!1&&(f=`
4
4
 
5
- export { He as importPixiVNJson };
5
+ `+f),u=s(n.glueEnabled)||!1,f)}),b=s(c[0]),g=typeof b=="object"&&"character"in b?b.character:void 0,p=c.map(n=>{let a;n&&typeof n=="object"&&"text"in n?a=n.text:a=n;let f;return Array.isArray(a)?f=a.map(d=>`${s(d)}`).join(""):f=s(a)||"",f}).join(""),l=o.find(n=>n.end),m=o.find(n=>n.choices),h=!1,x=!1;o.length>0&&(o[0].glueEnabled&&o[0].goNextStep&&o[0].dialogue===void 0&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),h=o[o.length-1].glueEnabled,x=o.reverse().find(n=>!(n.operation&&(!n.dialogue||!n.choices)))?.goNextStep);let y=o.find(n=>n.labelToOpen),v=[];return o.forEach(n=>{n.operation&&v.forEach(a=>{v.push(a);});}),{dialogue:g?{character:g,text:p}:p,end:l?.end,choices:m?.choices,glueEnabled:h,goNextStep:x,labelToOpen:y?.labelToOpen,operation:v}}}function he(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=s(i.leftValue),e=s(i.rightValue);switch(i.operator){case"==":return t===e;case"!=":return t!==e;case"<":return t<e;case"<=":return t<=e;case">":return t>e;case">=":return t>=e;case"CONTAINS":return t.toString().includes(e.toString())}break;case"valueCondition":return !!s(i.value);case"union":return me(i)}return !!i}function ye(i){if(i&&typeof i=="object"&&"type"in i&&i.type==="value"&&i.storageOperationType==="get")switch(i.storageType){case"storage":case"tempstorage":return storage.getVariable(i.key);case"flagStorage":return getFlag(i.key);case"label":return narration.getTimesLabelOpened(i.label);case"choice":return narration.getTimesChoiceMade(i.index);case"logic":return s(i.operation);case"params":let t=storage.getVariable(`${_}${narration.openedLabels.length-1}`)||[];if(t&&t.length>i.key)return t[i.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return i}function me(i){if(i.unionType==="not")return !s(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=s(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function Y(i){let t=s(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=s(t):e=t,i.storageType){case"flagStorage":setFlag(i.key,i.value);break;case"storage":storage.setVariable(i.key,e);break;case"tempstorage":storage.setTempVariable(i.key,e);break;case"params":let r=storage.getVariable(`${_}${narration.openedLabels.length-1}`)||[];r&&r.length-1>=i.key&&(r[i.key]=e),storage.setTempVariable(`${_}${narration.openedLabels.length-1}`,r);break}}function s(i){let t=de(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return ye(t);case"arithmetic":case"arithmeticsingle":return xe(t);case"compare":case"valueCondition":case"union":return he(t)}return t}function xe(i){let t=s(i.leftValue);switch(i.type){case"arithmetic":let e=s(i.rightValue);switch(i.operator){case"*":return t*e;case"/":return t/e;case"+":return t+e;case"-":return t-e;case"%":return t%e;case"POW":return Math.pow(t,e);case"RANDOM":return narration.getRandomNumber(t,e)}case"arithmeticsingle":switch(i.operator){case"INT":return parseInt(t);case"FLOOR":return Math.floor(t);case"FLOAT":return parseFloat(t)}break}}async function E(i,t){let e=s(i);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":sound.add(e.alias,{...e.props,url:e.url});break;case"play":sound.play(e.alias,e.props);break;case"remove":sound.remove(e.alias);break;case"pause":sound.pause(e.alias);break;case"resume":sound.resume(e.alias);break;case"volume":sound.volume(e.alias,e.value);break}break;case"image":switch(e.operationType){case"show":if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,e.url,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,e.url,e.transition.props,e.transition.priority);break}else await showImage(e.alias,e.url);break;case"edit":let r=canvas.find(e.alias);r?e.props&&(r.memory={...r.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":if(e.transition){let c=new CanvasVideo;switch(c.videoLink=e.url,e.transition.type){case"fade":await showWithFadeTransition(e.alias,c,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,c,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,c,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,c,e.transition.props,e.transition.priority);break}}else await showVideo(e.alias,e.url);break;case"edit":let r=canvas.find(e.alias);r?e.props&&(r.memory={...r.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":canvas.remove(e.alias);break;case"pause":let o=canvas.find(e.alias);o?o.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let u=canvas.find(e.alias);u?u.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":Y(e);break;case"oprationtoconvert":if(t){let r="";e.values.forEach(u=>{if(typeof u=="string")r+=u;else {let c=s(u);r+=`${c}`;}});let o=t(r);o&&await E(o);}break;case"input":switch(e.operationType){case"request":narration.requestInput({type:e.valueType});break}break}}var L=class extends LabelAbstract{constructor(t,e,r,o={}){super(t,r),this._steps=e,this.operationStringConvert=o.operationStringConvert,this.skipEmptyDialogs=o.skipEmptyDialogs||!1;}_steps;get steps(){return this._steps.map(t=>this.stepConverter(t))}operationStringConvert;skipEmptyDialogs=!1;getStepSha1(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, ne.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let r=[];t.forEach(o=>{if(typeof o=="string")r.push(o);else if(o&&typeof o=="object"){let u=s(o);u?(u&&!Array.isArray(u)&&typeof u=="object"&&(u=s(u)||""),Array.isArray(u)?r=r.concat(u):r.push(`${u}`)):r.push(`${o}`);}}),e=r;}else {let r=s(t)||"";r&&!Array.isArray(r)&&typeof r=="object"&&(r=s(r)||""),e=r;}return `${e}`}getDialogue(t){let e=s(t);if(e)return typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:this.getDialogueText(e.text)}:this.getDialogueText(e);if(e!=null)return `${e}`}getChoices(t){return s(t)?.map(o=>s(o)).filter(o=>o!==void 0)}stepConverter(t){return async e=>{if(typeof t=="function"&&(t=t()),t=R(t),t.operation)for(let p of t.operation)await E(p,this.operationStringConvert);let r=this.getChoices(t.choices),o=s(t.glueEnabled),u=this.getDialogue(t.dialogue),c=[];t.labelToOpen&&(Array.isArray(t.labelToOpen)||(t.labelToOpen=[t.labelToOpen]),t.labelToOpen.forEach(p=>{let l=s(p);l&&c.push(l);}));let b=s(t.goNextStep),g=s(t.end);if(r){let p=r.map(l=>{let m="";if(Array.isArray(l.text)){let h=[];l.text.forEach(x=>{if(typeof x=="string")h.push(x);else if(x&&typeof x=="object"){let y=s(x);y&&!Array.isArray(y)&&typeof y=="object"&&(y=s(y)||""),y&&(Array.isArray(y)?h=h.concat(y):h.push(y));}}),m=h.join();}else typeof l.text=="string"&&(m=l.text);return new ChoiceMenuOption(m,l.label,l.props,{type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect})});narration.choiceMenuOptions=p;}else narration.choiceMenuOptions=void 0;u!==void 0&&(narration.dialogue=u,this.skipEmptyDialogs&&typeof u=="string"&&(u===""||RegExp(/^\s+$/).test(u))&&(b=!0)),o?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):o===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1),c.forEach(p=>{let l=p.label;typeof l=="object"&&(l=s(l)||"");let m=p.params?.map(h=>s(h));e={...e,...p.props},p.type==="jump"?(narration.closeCurrentLabel(),storage.setTempVariable(`${_}${narration.openedLabels.length}`,m),narration.callLabel(l,e)):(storage.setTempVariable(`${_}${narration.openedLabels.length}`,m),narration.callLabel(l,e));}),g==="game_end"?(narration.closeAllLabels(),await narration.goNext(e)):g==="label_end"&&narration.closeCurrentLabel(),b&&await narration.goNext(e);}}};function Ke(i,t={}){let e=t?.operationStringConvert;try{typeof i=="string"&&(i=JSON.parse(i));}catch(r){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON",r);return}if(typeof i!="object"){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON: data is not an object");return}if(i.initialOperations){for(let r of i.initialOperations)E(r,e);StorageManagerStatic.saveStorageAsBasicStorage();}if(i.labels){let r=i.labels;for(let o in r)try{let u=r[o],c=new L(o,u,void 0,t);saveLabel(c);}catch(u){console.error(`[Pixi\u2019VN Json] Error creating JSON label ${o}`,u);}}}
6
+
7
+ export { Ke as importPixiVNJson };
@@ -2,10 +2,10 @@
2
2
 
3
3
  var pixiVn = require('@drincs/pixi-vn');
4
4
 
5
- var ne=Object.create;var G=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var R=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(i,n)=>(typeof require<"u"?require:i)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var z=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports);var le=(t,i,n,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of oe(i))!se.call(t,o)&&o!==n&&G(t,o,{get:()=>i[o],enumerable:!(e=re(i,o))||e.enumerable});return t};var ue=(t,i,n)=>(n=t!=null?ne(ae(t)):{},le(G(n,"default",{value:t,enumerable:!0}),t));var W=z((L,M)=>{(function(t,i){typeof L=="object"?M.exports=L=i():typeof define=="function"&&define.amd?define([],i):t.CryptoJS=i();})(L,function(){var t=t||function(i,n){var e;if(typeof window<"u"&&window.crypto&&(e=window.crypto),typeof self<"u"&&self.crypto&&(e=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(e=globalThis.crypto),!e&&typeof window<"u"&&window.msCrypto&&(e=window.msCrypto),!e&&typeof global<"u"&&global.crypto&&(e=global.crypto),!e&&typeof R=="function")try{e=R("crypto");}catch{}var o=function(){if(e){if(typeof e.getRandomValues=="function")try{return e.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof e.randomBytes=="function")try{return e.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},l=Object.create||function(){function r(){}return function(a){var g;return r.prototype=a,g=new r,r.prototype=null,g}}(),s={},d=s.lib={},x=d.Base=function(){return {extend:function(r){var a=l(this);return r&&a.mixIn(r),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var r=this.extend();return r.init.apply(r,arguments),r},init:function(){},mixIn:function(r){for(var a in r)r.hasOwnProperty(a)&&(this[a]=r[a]);r.hasOwnProperty("toString")&&(this.toString=r.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),m=d.WordArray=x.extend({init:function(r,a){r=this.words=r||[],a!=n?this.sigBytes=a:this.sigBytes=r.length*4;},toString:function(r){return (r||f).stringify(this)},concat:function(r){var a=this.words,g=r.words,h=this.sigBytes,T=r.sigBytes;if(this.clamp(),h%4)for(var N=0;N<T;N++){var B=g[N>>>2]>>>24-N%4*8&255;a[h+N>>>2]|=B<<24-(h+N)%4*8;}else for(var J=0;J<T;J+=4)a[h+J>>>2]=g[J>>>2];return this.sigBytes+=T,this},clamp:function(){var r=this.words,a=this.sigBytes;r[a>>>2]&=4294967295<<32-a%4*8,r.length=i.ceil(a/4);},clone:function(){var r=x.clone.call(this);return r.words=this.words.slice(0),r},random:function(r){for(var a=[],g=0;g<r;g+=4)a.push(o());return new m.init(a,r)}}),u=s.enc={},f=u.Hex={stringify:function(r){for(var a=r.words,g=r.sigBytes,h=[],T=0;T<g;T++){var N=a[T>>>2]>>>24-T%4*8&255;h.push((N>>>4).toString(16)),h.push((N&15).toString(16));}return h.join("")},parse:function(r){for(var a=r.length,g=[],h=0;h<a;h+=2)g[h>>>3]|=parseInt(r.substr(h,2),16)<<24-h%8*4;return new m.init(g,a/2)}},y=u.Latin1={stringify:function(r){for(var a=r.words,g=r.sigBytes,h=[],T=0;T<g;T++){var N=a[T>>>2]>>>24-T%4*8&255;h.push(String.fromCharCode(N));}return h.join("")},parse:function(r){for(var a=r.length,g=[],h=0;h<a;h++)g[h>>>2]|=(r.charCodeAt(h)&255)<<24-h%4*8;return new m.init(g,a)}},b=u.Utf8={stringify:function(r){try{return decodeURIComponent(escape(y.stringify(r)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(r){return y.parse(unescape(encodeURIComponent(r)))}},c=d.BufferedBlockAlgorithm=x.extend({reset:function(){this._data=new m.init,this._nDataBytes=0;},_append:function(r){typeof r=="string"&&(r=b.parse(r)),this._data.concat(r),this._nDataBytes+=r.sigBytes;},_process:function(r){var a,g=this._data,h=g.words,T=g.sigBytes,N=this.blockSize,B=N*4,J=T/B;r?J=i.ceil(J):J=i.max((J|0)-this._minBufferSize,0);var A=J*N,F=i.min(A*4,T);if(A){for(var D=0;D<A;D+=N)this._doProcessBlock(h,D);a=h.splice(0,A),g.sigBytes-=F;}return new m.init(a,F)},clone:function(){var r=x.clone.call(this);return r._data=this._data.clone(),r},_minBufferSize:0});d.Hasher=c.extend({cfg:x.extend(),init:function(r){this.cfg=this.cfg.extend(r),this.reset();},reset:function(){c.reset.call(this),this._doReset();},update:function(r){return this._append(r),this._process(),this},finalize:function(r){r&&this._append(r);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(r){return function(a,g){return new r.init(g).finalize(a)}},_createHmacHelper:function(r){return function(a,g){return new V.HMAC.init(r,g).finalize(a)}}});var V=s.algo={};return s}(Math);return t});});var $=z((I,U)=>{(function(t,i){typeof I=="object"?U.exports=I=i(W()):typeof define=="function"&&define.amd?define(["./core"],i):i(t.CryptoJS);})(I,function(t){return function(){var i=t,n=i.lib,e=n.WordArray,o=n.Hasher,l=i.algo,s=[],d=l.SHA1=o.extend({_doReset:function(){this._hash=new e.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(x,m){for(var u=this._hash.words,f=u[0],y=u[1],b=u[2],c=u[3],v=u[4],V=0;V<80;V++){if(V<16)s[V]=x[m+V]|0;else {var r=s[V-3]^s[V-8]^s[V-14]^s[V-16];s[V]=r<<1|r>>>31;}var a=(f<<5|f>>>27)+v+s[V];V<20?a+=(y&b|~y&c)+1518500249:V<40?a+=(y^b^c)+1859775393:V<60?a+=(y&b|y&c|b&c)-1894007588:a+=(y^b^c)-899497514,v=c,c=b,b=y<<30|y>>>2,y=f,f=a;}u[0]=u[0]+f|0,u[1]=u[1]+y|0,u[2]=u[2]+b|0,u[3]=u[3]+c|0,u[4]=u[4]+v|0;},_doFinalize:function(){var x=this._data,m=x.words,u=this._nDataBytes*8,f=x.sigBytes*8;return m[f>>>5]|=128<<24-f%32,m[(f+64>>>9<<4)+14]=Math.floor(u/4294967296),m[(f+64>>>9<<4)+15]=u,x.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var x=o.clone.call(this);return x._hash=this._hash.clone(),x}});i.SHA1=o._createHelper(d),i.HmacSHA1=o._createHmacHelper(d);}(),t.SHA1});});var ie=ue($());var j="___param___";function de(t,i){return Math.floor(Math.random()*(i-t+1)+t)}function p(t,i){if(!(Array.isArray(t)||!t)){if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"resulttocombine":return pe(t,i);case"ifelse":return P(t.condition,i)?p(t.then,i):p(t.else,i);case"stepswitch":let e=p(t.elements,i)||[];if(e.length===0){console.error("[Pixi'VN] getValueFromConditionalStatements elements.length === 0");return}switch(t.choiceType){case"random":let o=de(0,e.length);return p(e[o],i);case"loop":return pixiVn.narration.currentStepTimesCounter>e.length-1?(pixiVn.narration.currentStepTimesCounter=0,p(e[0],i)):p(e[pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)],i);case"sequential":let l;return t.end=="lastItem"&&(l=p(e[e.length-1],i)),pixiVn.narration.currentStepTimesCounter>e.length-1?l:p(e[pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)],i);case"sequentialrandom":let s=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:t.nestedId,onceOnly:!0});if(s==null&&t.end=="lastItem"){let d=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(t.nestedId);if(!d||!d?.usedRandomNumbers)return;let x=d.usedRandomNumbers[`0-${e.length-1}`];return p(e[x[x.length-1]],i)}return s==null?void 0:p(e[s],i)}}return t}}function pe(t,i){let n=t.firstItem,e=[];t.secondConditionalItem?.forEach(l=>{if(Array.isArray(l))l.forEach(s=>{let d=p(s,i);d&&e.push(d);});else {let s=p(l,i);s&&e.push(s);}});let o=n?[n,...e]:e;if(o.length!==0){if(typeof o[0]=="string")return o.join("");if(typeof o[0]=="object"){let l=o,s=l.map(c=>c.dialogue).join(""),d=l.find(c=>c.end),x=l.find(c=>c.choices),m=l.find(c=>c.glueEnabled),u=l.find(c=>c.goNextStep),f=l.find(c=>c.labelToOpen),y=l.find(c=>c.operation);return {dialogue:s,end:d?.end,choices:x?.choices,glueEnabled:m?.glueEnabled,goNextStep:u?.goNextStep,labelToOpen:f?.labelToOpen,operation:y?.operation}}}}function ge(t,i){if(!t)return !1;if(typeof t!="object"||!("type"in t))return !!t;switch(t.type){case"compare":let n=w(t.leftValue,i),e=w(t.rightValue,i);switch(t.operator){case"==":return n===e;case"!=":return n!==e;case"<":return n<e;case"<=":return n<=e;case">":return n>e;case">=":return n>=e;case"CONTAINS":return n.toString().includes(e.toString())}break;case"valueCondition":return !!w(t.value,i);case"union":return he(t,i);case"labelcondition":if("operator"in t&&"label"in t)switch(t.operator){case"started":return pixiVn.narration.getTimesLabelOpened(t.label)>0;case"completed":return pixiVn.narration.isLabelAlreadyCompleted(t.label)}break}return !!t}function w(t,i){if(t&&typeof t=="object"&&"type"in t)if(t.type==="value"&&t.storageOperationType==="get")switch(t.storageType){case"storage":return pixiVn.storage.getVariable(t.key);case"tempstorage":return pixiVn.StorageManagerStatic.getTempVariable(t.key);case"flagStorage":return pixiVn.getFlag(t.key);case"label":return pixiVn.narration.getTimesLabelOpened(t.label);case"logic":return P(t.operation,i);case"params":return i&&i.length-1>=t.key?i[t.key]:void 0}else return P(t,i);return t}function he(t,i){if(t.unionType==="not")return !P(t.condition,i);let n=t.unionType==="and";for(let e=0;e<t.conditions.length;e++)if(n=P(t.conditions[e],i)||!1,t.unionType==="and"){if(!n)return !1}else if(n)return !0;return n}function H(t,i){let n=p(t.value,i),e;switch(n&&typeof n=="object"&&"type"in n?e=P(n,i):e=n,t.storageType){case"flagStorage":pixiVn.setFlag(t.key,t.value);break;case"storage":pixiVn.storage.setVariable(t.key,e);break;case"tempstorage":pixiVn.StorageManagerStatic.setTempVariable(t.key,e);break;case"params":i&&i.length-1>=t.key&&(i[t.key]=e);break}}function P(t,i){let n=p(t,i);if(n&&typeof n=="object"&&"type"in n)switch(n.type){case"value":return w(n,i);case"arithmetic":case"arithmeticsingle":return ye(n,i);case"compare":case"valueCondition":case"union":case"labelcondition":return ge(n,i)}return n}function ye(t,i){let n=P(t.leftValue,i);switch(t.type){case"arithmetic":let e=P(t.rightValue,i);switch(t.operator){case"*":return n*e;case"/":return n/e;case"+":return n+e;case"-":return n-e;case"%":return n%e;case"POW":return Math.pow(n,e);case"RANDOM":return Math.floor(Math.random()*(e-n+1))+n}case"arithmeticsingle":switch(t.operator){case"INT":return parseInt(n);case"FLOOR":return Math.floor(n);case"FLOAT":return parseFloat(n)}break}}var O=class extends pixiVn.LabelAbstract{constructor(i,n,e,o){super(i,e),this._steps=n,this.operationStringConvert=o;}_steps;get steps(){return this._steps.map(this.stepConverter)}operationStringConvert;getStepSha1(i){if(i<0||i>=this.steps.length)return;let n=this._steps[i];return (0, ie.default)(n.toString().toLocaleLowerCase()).toString()}getDialogueText(i,n){let e="";if(Array.isArray(i)){let o=[];i.forEach(l=>{if(typeof l=="string")o.push(l);else if(l&&typeof l=="object"){let s=p(l,n);s&&(s&&!Array.isArray(s)&&typeof s=="object"&&(s=w(s,n)||""),Array.isArray(s)?o=o.concat(s):o.push(s));}}),e=o;}else {let o=p(i,n)||"";o&&!Array.isArray(o)&&typeof o=="object"&&(o=w(o,n)||""),e=o;}return e}getDialogue(i,n){let e=p(i,n),o;return e&&(typeof e=="object"&&"character"in e&&"text"in e?o={character:e.character,text:this.getDialogueText(e.text,n)}:o=this.getDialogueText(e,n)),o}getChoices(i,n){let e=p(i,n);if(e)return e.map(l=>p(l,n)).filter(l=>l!==void 0)}stepConverter(i){return async n=>{let e=n[j];if(typeof i=="function"&&(i=i()),i.operation)for(let u of i.operation)await this.runOperation(u,e);let o=this.getChoices(i.choices,e),l=p(i.glueEnabled,e),s=this.getDialogue(i.dialogue,e),d=[];i.labelToOpen&&(Array.isArray(i.labelToOpen)||(i.labelToOpen=[i.labelToOpen]),i.labelToOpen.forEach(u=>{let f=p(u,e);f&&d.push(f);}));let x=p(i.goNextStep,e),m=p(i.end,e);if(o){let u=o.map(f=>{let y="";if(Array.isArray(f.text)){let b=[];f.text.forEach(c=>{if(typeof c=="string")b.push(c);else if(c&&typeof c=="object"){let v=p(c,e);v&&!Array.isArray(v)&&typeof v=="object"&&(v=w(v,e)||""),v&&(Array.isArray(v)?b=b.concat(v):b.push(v));}}),y=b.join();}else typeof f.text=="string"&&(y=f.text);return new pixiVn.ChoiceMenuOption(y,f.label,f.props,{type:f.type,oneTime:f.oneTime})});u=u.filter((f,y)=>{if(f.oneTime){let b=pixiVn.narration.alreadyCurrentStepMadeChoices;if(b&&b.includes(y))return !1}return !0}),pixiVn.narration.choiceMenuOptions=u;}else pixiVn.narration.choiceMenuOptions=void 0;l?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):l===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1),s&&(pixiVn.narration.dialogue=s),d.forEach(u=>{let f=u.label;typeof f=="object"&&(f=w(f,e)||"");let y=u.params?.map(b=>P(b,e));n={...n,...u.props,[j]:y},u.type==="jump"?pixiVn.narration.jumpLabel(f,n):pixiVn.narration.callLabel(f,n);}),x&&await pixiVn.narration.goNext(n),m==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(n)):m==="label_end"&&pixiVn.narration.closeCurrentLabel();}}async runOperation(i,n){let e=p(i,n);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":pixiVn.sound.add(e.alias,{...e.props,url:e.url});break;case"play":pixiVn.sound.play(e.alias,e.props);break;case"remove":pixiVn.sound.remove(e.alias);break;case"pause":pixiVn.sound.pause(e.alias);break;case"resume":pixiVn.sound.resume(e.alias);break;case"volume":pixiVn.sound.volume(e.alias,e.value);break}break;case"image":switch(e.operationType){case"show":if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,e.url,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,e.url,e.transition.props,e.transition.priority);break}else await pixiVn.showImage(e.alias,e.url);break;case"edit":let o=pixiVn.canvas.find(e.alias);o?e.props&&(o.memory={...o.memory,...e.props}):console.error(`[Pixi'VN] Image with alias ${e.alias} not found.`);break;case"remove":pixiVn.canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":if(e.transition){let d=new pixiVn.CanvasVideo;switch(d.videoLink=e.url,e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,d,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,d,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,d,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,d,e.transition.props,e.transition.priority);break}}else await pixiVn.showVideo(e.alias,e.url);break;case"edit":let o=pixiVn.canvas.find(e.alias);o?e.props&&(o.memory={...o.memory,...e.props}):console.error(`[Pixi'VN] Video with alias ${e.alias} not found.`);break;case"remove":pixiVn.canvas.remove(e.alias);break;case"pause":let l=pixiVn.canvas.find(e.alias);l?l.paused=!0:console.error(`[Pixi'VN] Video with alias ${e.alias} not found.`);break;case"resume":let s=pixiVn.canvas.find(e.alias);s?s.paused=!1:console.error(`[Pixi'VN] Video with alias ${e.alias} not found.`);break}break;case"value":H(e,n);break;case"oprationtoconvert":if(this.operationStringConvert){let o="";e.values.forEach(s=>{if(typeof s=="string")o+=s;else {let d=P(s,n);d&&(o+=`${d}`);}});let l=this.operationStringConvert(o);l&&await this.runOperation(l,n);}break;case"input":switch(e.operationType){case"request":pixiVn.narration.requestInput({type:e.valueType});break}break}}};function ve(t,i){try{typeof t=="string"&&(t=JSON.parse(t));}catch(n){console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON",n);return}if(typeof t!="object"){console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON: data is not an object");return}if(t.labels){let n=t.labels;for(let e in n)try{let o=n[e],l=new O(e,o,void 0,i);pixiVn.saveLabel(l);}catch(o){console.error(`[Pixi'VN] Error creating JSON label ${e}`,o);}}}
5
+ var re=Object.create;var z=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var H=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var M=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ue=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of oe(t))!le.call(i,o)&&o!==e&&z(i,o,{get:()=>t[o],enumerable:!(r=ae(t,o))||r.enumerable});return i};var fe=(i,t,e)=>(e=i!=null?re(se(i)):{},ue(z(e,"default",{value:i,enumerable:!0}),i));var X=M((k,U)=>{(function(i,t){typeof k=="object"?U.exports=k=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(k,function(){var i=i||function(t,e){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof H=="function")try{r=H("crypto");}catch{}var o=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},u=Object.create||function(){function n(){}return function(a){var f;return n.prototype=a,f=new n,n.prototype=null,f}}(),c={},b=c.lib={},g=b.Base=function(){return {extend:function(n){var a=u(this);return n&&a.mixIn(n),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var a in n)n.hasOwnProperty(a)&&(this[a]=n[a]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),p=b.WordArray=g.extend({init:function(n,a){n=this.words=n||[],a!=e?this.sigBytes=a:this.sigBytes=n.length*4;},toString:function(n){return (n||m).stringify(this)},concat:function(n){var a=this.words,f=n.words,d=this.sigBytes,T=n.sigBytes;if(this.clamp(),d%4)for(var N=0;N<T;N++){var G=f[N>>>2]>>>24-N%4*8&255;a[d+N>>>2]|=G<<24-(d+N)%4*8;}else for(var P=0;P<T;P+=4)a[d+P>>>2]=f[P>>>2];return this.sigBytes+=T,this},clamp:function(){var n=this.words,a=this.sigBytes;n[a>>>2]&=4294967295<<32-a%4*8,n.length=t.ceil(a/4);},clone:function(){var n=g.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var a=[],f=0;f<n;f+=4)a.push(o());return new p.init(a,n)}}),l=c.enc={},m=l.Hex={stringify:function(n){for(var a=n.words,f=n.sigBytes,d=[],T=0;T<f;T++){var N=a[T>>>2]>>>24-T%4*8&255;d.push((N>>>4).toString(16)),d.push((N&15).toString(16));}return d.join("")},parse:function(n){for(var a=n.length,f=[],d=0;d<a;d+=2)f[d>>>3]|=parseInt(n.substr(d,2),16)<<24-d%8*4;return new p.init(f,a/2)}},h=l.Latin1={stringify:function(n){for(var a=n.words,f=n.sigBytes,d=[],T=0;T<f;T++){var N=a[T>>>2]>>>24-T%4*8&255;d.push(String.fromCharCode(N));}return d.join("")},parse:function(n){for(var a=n.length,f=[],d=0;d<a;d++)f[d>>>2]|=(n.charCodeAt(d)&255)<<24-d%4*8;return new p.init(f,a)}},x=l.Utf8={stringify:function(n){try{return decodeURIComponent(escape(h.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return h.parse(unescape(encodeURIComponent(n)))}},y=b.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new p.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=x.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var a,f=this._data,d=f.words,T=f.sigBytes,N=this.blockSize,G=N*4,P=T/G;n?P=t.ceil(P):P=t.max((P|0)-this._minBufferSize,0);var A=P*N,W=t.min(A*4,T);if(A){for(var j=0;j<A;j+=N)this._doProcessBlock(d,j);a=d.splice(0,A),f.sigBytes-=W;}return new p.init(a,W)},clone:function(){var n=g.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});b.Hasher=y.extend({cfg:g.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){y.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(n){return function(a,f){return new n.init(f).finalize(a)}},_createHmacHelper:function(n){return function(a,f){return new V.HMAC.init(n,f).finalize(a)}}});var V=c.algo={};return c}(Math);return i});});var K=M((I,q)=>{(function(i,t){typeof I=="object"?q.exports=I=t(X()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(I,function(i){return function(){var t=i,e=t.lib,r=e.WordArray,o=e.Hasher,u=t.algo,c=[],b=u.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,p){for(var l=this._hash.words,m=l[0],h=l[1],x=l[2],y=l[3],v=l[4],V=0;V<80;V++){if(V<16)c[V]=g[p+V]|0;else {var n=c[V-3]^c[V-8]^c[V-14]^c[V-16];c[V]=n<<1|n>>>31;}var a=(m<<5|m>>>27)+v+c[V];V<20?a+=(h&x|~h&y)+1518500249:V<40?a+=(h^x^y)+1859775393:V<60?a+=(h&x|h&y|x&y)-1894007588:a+=(h^x^y)-899497514,v=y,y=x,x=h<<30|h>>>2,h=m,m=a;}l[0]=l[0]+m|0,l[1]=l[1]+h|0,l[2]=l[2]+x|0,l[3]=l[3]+y|0,l[4]=l[4]+v|0;},_doFinalize:function(){var g=this._data,p=g.words,l=this._nDataBytes*8,m=g.sigBytes*8;return p[m>>>5]|=128<<24-m%32,p[(m+64>>>9<<4)+14]=Math.floor(l/4294967296),p[(m+64>>>9<<4)+15]=l,g.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var g=o.clone.call(this);return g._hash=this._hash.clone(),g}});t.SHA1=o._createHelper(b),t.HmacSHA1=o._createHmacHelper(b);}(),i.SHA1});});var ne=fe(K());var _="___param___";function pe(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function de(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return ge(i);case"ifelse":return s(i.condition)?s(i.then):s(i.else);case"stepswitch":let e=s(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let r=pe(0,e.length-1);return s(e[r]);case"loop":let o=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return o>e.length-1&&(o=o%e.length),s(e[o]);case"sequential":let u,c=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(u=s(e[e.length-1])),c>e.length-1?u:s(e[c]);case"sequentialrandom":let b=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(b==null&&i.end=="lastItem"){let g=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!g||!g?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let p=g.usedRandomNumbers[`0-${e.length-1}`];return s(e[p[p.length-1]])}if(b==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return s(e[b])}}return i}function R(i){if(i.conditionalStep){let t=pixiVn.createExportableElement(s(i.conditionalStep));if(t?.glueEnabled===void 0&&delete t?.glueEnabled,t?.goNextStep===void 0&&delete t?.goNextStep,t?.end===void 0&&delete t?.end,t?.choices===void 0&&delete t?.choices,t?.dialogue===void 0&&delete t?.dialogue,t?.labelToOpen===void 0&&delete t?.labelToOpen,t?.operation===void 0&&delete t?.operation,t){let e={...i,conditionalStep:void 0,...t};return R(e)}else pixiVn.getFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);}return i}function ge(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(o=>{if(Array.isArray(o))o.forEach(u=>{let c=s(u);e.push(c);});else {let u=s(o);e.push(u);}});let r=t?[t,...e]:e;if(r.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return r.join("");if(typeof r[0]=="object"){let o=r,u,c=o.map((n,a)=>{n=R(n);let f=s(n.dialogue)||"";return a===0?(u=s(n.glueEnabled)||!1,f):(typeof f=="object"&&"text"in f&&(f=f.character+": "+f.text),u===!1&&(f=`
6
6
 
7
- exports.geLogichValue = P;
8
- exports.getValue = w;
9
- exports.getValueFromConditionalStatements = p;
10
- exports.importPixiVNJson = ve;
11
- exports.setStorageJson = H;
7
+ `+f),u=s(n.glueEnabled)||!1,f)}),b=s(c[0]),g=typeof b=="object"&&"character"in b?b.character:void 0,p=c.map(n=>{let a;n&&typeof n=="object"&&"text"in n?a=n.text:a=n;let f;return Array.isArray(a)?f=a.map(d=>`${s(d)}`).join(""):f=s(a)||"",f}).join(""),l=o.find(n=>n.end),m=o.find(n=>n.choices),h=!1,x=!1;o.length>0&&(o[0].glueEnabled&&o[0].goNextStep&&o[0].dialogue===void 0&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),h=o[o.length-1].glueEnabled,x=o.reverse().find(n=>!(n.operation&&(!n.dialogue||!n.choices)))?.goNextStep);let y=o.find(n=>n.labelToOpen),v=[];return o.forEach(n=>{n.operation&&v.forEach(a=>{v.push(a);});}),{dialogue:g?{character:g,text:p}:p,end:l?.end,choices:m?.choices,glueEnabled:h,goNextStep:x,labelToOpen:y?.labelToOpen,operation:v}}}function he(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=s(i.leftValue),e=s(i.rightValue);switch(i.operator){case"==":return t===e;case"!=":return t!==e;case"<":return t<e;case"<=":return t<=e;case">":return t>e;case">=":return t>=e;case"CONTAINS":return t.toString().includes(e.toString())}break;case"valueCondition":return !!s(i.value);case"union":return me(i)}return !!i}function ye(i){if(i&&typeof i=="object"&&"type"in i&&i.type==="value"&&i.storageOperationType==="get")switch(i.storageType){case"storage":case"tempstorage":return pixiVn.storage.getVariable(i.key);case"flagStorage":return pixiVn.getFlag(i.key);case"label":return pixiVn.narration.getTimesLabelOpened(i.label);case"choice":return pixiVn.narration.getTimesChoiceMade(i.index);case"logic":return s(i.operation);case"params":let t=pixiVn.storage.getVariable(`${_}${pixiVn.narration.openedLabels.length-1}`)||[];if(t&&t.length>i.key)return t[i.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return i}function me(i){if(i.unionType==="not")return !s(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=s(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function F(i){let t=s(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=s(t):e=t,i.storageType){case"flagStorage":pixiVn.setFlag(i.key,i.value);break;case"storage":pixiVn.storage.setVariable(i.key,e);break;case"tempstorage":pixiVn.storage.setTempVariable(i.key,e);break;case"params":let r=pixiVn.storage.getVariable(`${_}${pixiVn.narration.openedLabels.length-1}`)||[];r&&r.length-1>=i.key&&(r[i.key]=e),pixiVn.storage.setTempVariable(`${_}${pixiVn.narration.openedLabels.length-1}`,r);break}}function s(i){let t=de(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return ye(t);case"arithmetic":case"arithmeticsingle":return xe(t);case"compare":case"valueCondition":case"union":return he(t)}return t}function xe(i){let t=s(i.leftValue);switch(i.type){case"arithmetic":let e=s(i.rightValue);switch(i.operator){case"*":return t*e;case"/":return t/e;case"+":return t+e;case"-":return t-e;case"%":return t%e;case"POW":return Math.pow(t,e);case"RANDOM":return pixiVn.narration.getRandomNumber(t,e)}case"arithmeticsingle":switch(i.operator){case"INT":return parseInt(t);case"FLOOR":return Math.floor(t);case"FLOAT":return parseFloat(t)}break}}async function E(i,t){let e=s(i);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":pixiVn.sound.add(e.alias,{...e.props,url:e.url});break;case"play":pixiVn.sound.play(e.alias,e.props);break;case"remove":pixiVn.sound.remove(e.alias);break;case"pause":pixiVn.sound.pause(e.alias);break;case"resume":pixiVn.sound.resume(e.alias);break;case"volume":pixiVn.sound.volume(e.alias,e.value);break}break;case"image":switch(e.operationType){case"show":if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,e.url,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,e.url,e.transition.props,e.transition.priority);break}else await pixiVn.showImage(e.alias,e.url);break;case"edit":let r=pixiVn.canvas.find(e.alias);r?e.props&&(r.memory={...r.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":pixiVn.canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":if(e.transition){let c=new pixiVn.CanvasVideo;switch(c.videoLink=e.url,e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,c,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,c,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,c,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,c,e.transition.props,e.transition.priority);break}}else await pixiVn.showVideo(e.alias,e.url);break;case"edit":let r=pixiVn.canvas.find(e.alias);r?e.props&&(r.memory={...r.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":pixiVn.canvas.remove(e.alias);break;case"pause":let o=pixiVn.canvas.find(e.alias);o?o.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let u=pixiVn.canvas.find(e.alias);u?u.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":F(e);break;case"oprationtoconvert":if(t){let r="";e.values.forEach(u=>{if(typeof u=="string")r+=u;else {let c=s(u);r+=`${c}`;}});let o=t(r);o&&await E(o);}break;case"input":switch(e.operationType){case"request":pixiVn.narration.requestInput({type:e.valueType});break}break}}var L=class extends pixiVn.LabelAbstract{constructor(t,e,r,o={}){super(t,r),this._steps=e,this.operationStringConvert=o.operationStringConvert,this.skipEmptyDialogs=o.skipEmptyDialogs||!1;}_steps;get steps(){return this._steps.map(t=>this.stepConverter(t))}operationStringConvert;skipEmptyDialogs=!1;getStepSha1(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, ne.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let r=[];t.forEach(o=>{if(typeof o=="string")r.push(o);else if(o&&typeof o=="object"){let u=s(o);u?(u&&!Array.isArray(u)&&typeof u=="object"&&(u=s(u)||""),Array.isArray(u)?r=r.concat(u):r.push(`${u}`)):r.push(`${o}`);}}),e=r;}else {let r=s(t)||"";r&&!Array.isArray(r)&&typeof r=="object"&&(r=s(r)||""),e=r;}return `${e}`}getDialogue(t){let e=s(t);if(e)return typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:this.getDialogueText(e.text)}:this.getDialogueText(e);if(e!=null)return `${e}`}getChoices(t){return s(t)?.map(o=>s(o)).filter(o=>o!==void 0)}stepConverter(t){return async e=>{if(typeof t=="function"&&(t=t()),t=R(t),t.operation)for(let p of t.operation)await E(p,this.operationStringConvert);let r=this.getChoices(t.choices),o=s(t.glueEnabled),u=this.getDialogue(t.dialogue),c=[];t.labelToOpen&&(Array.isArray(t.labelToOpen)||(t.labelToOpen=[t.labelToOpen]),t.labelToOpen.forEach(p=>{let l=s(p);l&&c.push(l);}));let b=s(t.goNextStep),g=s(t.end);if(r){let p=r.map(l=>{let m="";if(Array.isArray(l.text)){let h=[];l.text.forEach(x=>{if(typeof x=="string")h.push(x);else if(x&&typeof x=="object"){let y=s(x);y&&!Array.isArray(y)&&typeof y=="object"&&(y=s(y)||""),y&&(Array.isArray(y)?h=h.concat(y):h.push(y));}}),m=h.join();}else typeof l.text=="string"&&(m=l.text);return new pixiVn.ChoiceMenuOption(m,l.label,l.props,{type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect})});pixiVn.narration.choiceMenuOptions=p;}else pixiVn.narration.choiceMenuOptions=void 0;u!==void 0&&(pixiVn.narration.dialogue=u,this.skipEmptyDialogs&&typeof u=="string"&&(u===""||RegExp(/^\s+$/).test(u))&&(b=!0)),o?pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):o===!1&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1),c.forEach(p=>{let l=p.label;typeof l=="object"&&(l=s(l)||"");let m=p.params?.map(h=>s(h));e={...e,...p.props},p.type==="jump"?(pixiVn.narration.closeCurrentLabel(),pixiVn.storage.setTempVariable(`${_}${pixiVn.narration.openedLabels.length}`,m),pixiVn.narration.callLabel(l,e)):(pixiVn.storage.setTempVariable(`${_}${pixiVn.narration.openedLabels.length}`,m),pixiVn.narration.callLabel(l,e));}),g==="game_end"?(pixiVn.narration.closeAllLabels(),await pixiVn.narration.goNext(e)):g==="label_end"&&pixiVn.narration.closeCurrentLabel(),b&&await pixiVn.narration.goNext(e);}}};function _e(i,t={}){let e=t?.operationStringConvert;try{typeof i=="string"&&(i=JSON.parse(i));}catch(r){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON",r);return}if(typeof i!="object"){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON: data is not an object");return}if(i.initialOperations){for(let r of i.initialOperations)E(r,e);pixiVn.StorageManagerStatic.saveStorageAsBasicStorage();}if(i.labels){let r=i.labels;for(let o in r)try{let u=r[o],c=new L(o,u,void 0,t);pixiVn.saveLabel(c);}catch(u){console.error(`[Pixi\u2019VN Json] Error creating JSON label ${o}`,u);}}}
8
+
9
+ exports.geLogichValue = s;
10
+ exports.importPixiVNJson = _e;
11
+ exports.setStorageJson = F;
@@ -1,13 +1,13 @@
1
1
  export { importPixiVNJson } from './importer.cjs';
2
- export { geLogichValue, getValue, getValueFromConditionalStatements, setStorageJson } from './utility.cjs';
3
- import '../interface/PixiVNJson.cjs';
4
- import '../interface/PixiVNJsonLabels.cjs';
5
- import '../interface/PixiVNJsonLabelStep.cjs';
2
+ export { getLogichValue as geLogichValue, setStorageJson } from './utility.cjs';
3
+ import '../classes/LabelJson.cjs';
6
4
  import '@drincs/pixi-vn';
7
- import '../PixiVNJsonConditionalStatements-BBopD3ft.cjs';
8
- import '../interface/PixiVNJsonLabelCondition.cjs';
5
+ import '../interface/PixiVNJsonLabelStep.cjs';
6
+ import '../PixiVNJsonConditionalStatements-CVkQSKpq.cjs';
9
7
  import '../interface/PixiVNJsonOperations.cjs';
10
8
  import '../interface/PixiVNJsonInput.cjs';
11
9
  import '../interface/PixiVNJsonMedia.cjs';
12
10
  import '../interface/PixiVNJsonMediaTransiotions.cjs';
13
11
  import 'pixi.js';
12
+ import '../interface/PixiVNJson.cjs';
13
+ import '../interface/PixiVNJsonLabels.cjs';
@@ -1,13 +1,13 @@
1
1
  export { importPixiVNJson } from './importer.js';
2
- export { geLogichValue, getValue, getValueFromConditionalStatements, setStorageJson } from './utility.js';
3
- import '../interface/PixiVNJson.js';
4
- import '../interface/PixiVNJsonLabels.js';
5
- import '../interface/PixiVNJsonLabelStep.js';
2
+ export { getLogichValue as geLogichValue, setStorageJson } from './utility.js';
3
+ import '../classes/LabelJson.js';
6
4
  import '@drincs/pixi-vn';
7
- import '../PixiVNJsonConditionalStatements-CSzbVYiW.js';
8
- import '../interface/PixiVNJsonLabelCondition.js';
5
+ import '../interface/PixiVNJsonLabelStep.js';
6
+ import '../PixiVNJsonConditionalStatements-CVkQSKpq.js';
9
7
  import '../interface/PixiVNJsonOperations.js';
10
8
  import '../interface/PixiVNJsonInput.js';
11
9
  import '../interface/PixiVNJsonMedia.js';
12
10
  import '../interface/PixiVNJsonMediaTransiotions.js';
13
11
  import 'pixi.js';
12
+ import '../interface/PixiVNJson.js';
13
+ import '../interface/PixiVNJsonLabels.js';
@@ -1,5 +1,7 @@
1
- import { NarrationManagerStatic, narration, getFlag, StorageManagerStatic, storage, setFlag, saveLabel, LabelAbstract, ChoiceMenuOption, canvas, CanvasVideo, zoomIn, moveIn, showWithDissolveTransition, showWithFadeTransition, showVideo, showImage, sound } from '@drincs/pixi-vn';
1
+ import { storage, narration, setFlag, StorageManagerStatic, saveLabel, NarrationManagerStatic, getFlag, canvas, CanvasVideo, zoomIn, moveIn, showWithDissolveTransition, showWithFadeTransition, showVideo, showImage, sound, LabelAbstract, ChoiceMenuOption, createExportableElement } from '@drincs/pixi-vn';
2
2
 
3
- var ne=Object.create;var G=Object.defineProperty;var re=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var ae=Object.getPrototypeOf,se=Object.prototype.hasOwnProperty;var R=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(i,n)=>(typeof require<"u"?require:i)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var z=(t,i)=>()=>(i||t((i={exports:{}}).exports,i),i.exports);var le=(t,i,n,e)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of oe(i))!se.call(t,o)&&o!==n&&G(t,o,{get:()=>i[o],enumerable:!(e=re(i,o))||e.enumerable});return t};var ue=(t,i,n)=>(n=t!=null?ne(ae(t)):{},le(G(n,"default",{value:t,enumerable:!0}),t));var W=z((L,M)=>{(function(t,i){typeof L=="object"?M.exports=L=i():typeof define=="function"&&define.amd?define([],i):t.CryptoJS=i();})(L,function(){var t=t||function(i,n){var e;if(typeof window<"u"&&window.crypto&&(e=window.crypto),typeof self<"u"&&self.crypto&&(e=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(e=globalThis.crypto),!e&&typeof window<"u"&&window.msCrypto&&(e=window.msCrypto),!e&&typeof global<"u"&&global.crypto&&(e=global.crypto),!e&&typeof R=="function")try{e=R("crypto");}catch{}var o=function(){if(e){if(typeof e.getRandomValues=="function")try{return e.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof e.randomBytes=="function")try{return e.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},l=Object.create||function(){function r(){}return function(a){var g;return r.prototype=a,g=new r,r.prototype=null,g}}(),s={},d=s.lib={},x=d.Base=function(){return {extend:function(r){var a=l(this);return r&&a.mixIn(r),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var r=this.extend();return r.init.apply(r,arguments),r},init:function(){},mixIn:function(r){for(var a in r)r.hasOwnProperty(a)&&(this[a]=r[a]);r.hasOwnProperty("toString")&&(this.toString=r.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),m=d.WordArray=x.extend({init:function(r,a){r=this.words=r||[],a!=n?this.sigBytes=a:this.sigBytes=r.length*4;},toString:function(r){return (r||f).stringify(this)},concat:function(r){var a=this.words,g=r.words,h=this.sigBytes,T=r.sigBytes;if(this.clamp(),h%4)for(var N=0;N<T;N++){var B=g[N>>>2]>>>24-N%4*8&255;a[h+N>>>2]|=B<<24-(h+N)%4*8;}else for(var J=0;J<T;J+=4)a[h+J>>>2]=g[J>>>2];return this.sigBytes+=T,this},clamp:function(){var r=this.words,a=this.sigBytes;r[a>>>2]&=4294967295<<32-a%4*8,r.length=i.ceil(a/4);},clone:function(){var r=x.clone.call(this);return r.words=this.words.slice(0),r},random:function(r){for(var a=[],g=0;g<r;g+=4)a.push(o());return new m.init(a,r)}}),u=s.enc={},f=u.Hex={stringify:function(r){for(var a=r.words,g=r.sigBytes,h=[],T=0;T<g;T++){var N=a[T>>>2]>>>24-T%4*8&255;h.push((N>>>4).toString(16)),h.push((N&15).toString(16));}return h.join("")},parse:function(r){for(var a=r.length,g=[],h=0;h<a;h+=2)g[h>>>3]|=parseInt(r.substr(h,2),16)<<24-h%8*4;return new m.init(g,a/2)}},y=u.Latin1={stringify:function(r){for(var a=r.words,g=r.sigBytes,h=[],T=0;T<g;T++){var N=a[T>>>2]>>>24-T%4*8&255;h.push(String.fromCharCode(N));}return h.join("")},parse:function(r){for(var a=r.length,g=[],h=0;h<a;h++)g[h>>>2]|=(r.charCodeAt(h)&255)<<24-h%4*8;return new m.init(g,a)}},b=u.Utf8={stringify:function(r){try{return decodeURIComponent(escape(y.stringify(r)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(r){return y.parse(unescape(encodeURIComponent(r)))}},c=d.BufferedBlockAlgorithm=x.extend({reset:function(){this._data=new m.init,this._nDataBytes=0;},_append:function(r){typeof r=="string"&&(r=b.parse(r)),this._data.concat(r),this._nDataBytes+=r.sigBytes;},_process:function(r){var a,g=this._data,h=g.words,T=g.sigBytes,N=this.blockSize,B=N*4,J=T/B;r?J=i.ceil(J):J=i.max((J|0)-this._minBufferSize,0);var A=J*N,F=i.min(A*4,T);if(A){for(var D=0;D<A;D+=N)this._doProcessBlock(h,D);a=h.splice(0,A),g.sigBytes-=F;}return new m.init(a,F)},clone:function(){var r=x.clone.call(this);return r._data=this._data.clone(),r},_minBufferSize:0});d.Hasher=c.extend({cfg:x.extend(),init:function(r){this.cfg=this.cfg.extend(r),this.reset();},reset:function(){c.reset.call(this),this._doReset();},update:function(r){return this._append(r),this._process(),this},finalize:function(r){r&&this._append(r);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(r){return function(a,g){return new r.init(g).finalize(a)}},_createHmacHelper:function(r){return function(a,g){return new V.HMAC.init(r,g).finalize(a)}}});var V=s.algo={};return s}(Math);return t});});var $=z((I,U)=>{(function(t,i){typeof I=="object"?U.exports=I=i(W()):typeof define=="function"&&define.amd?define(["./core"],i):i(t.CryptoJS);})(I,function(t){return function(){var i=t,n=i.lib,e=n.WordArray,o=n.Hasher,l=i.algo,s=[],d=l.SHA1=o.extend({_doReset:function(){this._hash=new e.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(x,m){for(var u=this._hash.words,f=u[0],y=u[1],b=u[2],c=u[3],v=u[4],V=0;V<80;V++){if(V<16)s[V]=x[m+V]|0;else {var r=s[V-3]^s[V-8]^s[V-14]^s[V-16];s[V]=r<<1|r>>>31;}var a=(f<<5|f>>>27)+v+s[V];V<20?a+=(y&b|~y&c)+1518500249:V<40?a+=(y^b^c)+1859775393:V<60?a+=(y&b|y&c|b&c)-1894007588:a+=(y^b^c)-899497514,v=c,c=b,b=y<<30|y>>>2,y=f,f=a;}u[0]=u[0]+f|0,u[1]=u[1]+y|0,u[2]=u[2]+b|0,u[3]=u[3]+c|0,u[4]=u[4]+v|0;},_doFinalize:function(){var x=this._data,m=x.words,u=this._nDataBytes*8,f=x.sigBytes*8;return m[f>>>5]|=128<<24-f%32,m[(f+64>>>9<<4)+14]=Math.floor(u/4294967296),m[(f+64>>>9<<4)+15]=u,x.sigBytes=m.length*4,this._process(),this._hash},clone:function(){var x=o.clone.call(this);return x._hash=this._hash.clone(),x}});i.SHA1=o._createHelper(d),i.HmacSHA1=o._createHmacHelper(d);}(),t.SHA1});});var ie=ue($());var j="___param___";function de(t,i){return Math.floor(Math.random()*(i-t+1)+t)}function p(t,i){if(!(Array.isArray(t)||!t)){if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"resulttocombine":return pe(t,i);case"ifelse":return P(t.condition,i)?p(t.then,i):p(t.else,i);case"stepswitch":let e=p(t.elements,i)||[];if(e.length===0){console.error("[Pixi'VN] getValueFromConditionalStatements elements.length === 0");return}switch(t.choiceType){case"random":let o=de(0,e.length);return p(e[o],i);case"loop":return narration.currentStepTimesCounter>e.length-1?(narration.currentStepTimesCounter=0,p(e[0],i)):p(e[NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)],i);case"sequential":let l;return t.end=="lastItem"&&(l=p(e[e.length-1],i)),narration.currentStepTimesCounter>e.length-1?l:p(e[NarrationManagerStatic.getCurrentStepTimesCounter(t.nestedId)],i);case"sequentialrandom":let s=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:t.nestedId,onceOnly:!0});if(s==null&&t.end=="lastItem"){let d=NarrationManagerStatic.getCurrentStepTimesCounterData(t.nestedId);if(!d||!d?.usedRandomNumbers)return;let x=d.usedRandomNumbers[`0-${e.length-1}`];return p(e[x[x.length-1]],i)}return s==null?void 0:p(e[s],i)}}return t}}function pe(t,i){let n=t.firstItem,e=[];t.secondConditionalItem?.forEach(l=>{if(Array.isArray(l))l.forEach(s=>{let d=p(s,i);d&&e.push(d);});else {let s=p(l,i);s&&e.push(s);}});let o=n?[n,...e]:e;if(o.length!==0){if(typeof o[0]=="string")return o.join("");if(typeof o[0]=="object"){let l=o,s=l.map(c=>c.dialogue).join(""),d=l.find(c=>c.end),x=l.find(c=>c.choices),m=l.find(c=>c.glueEnabled),u=l.find(c=>c.goNextStep),f=l.find(c=>c.labelToOpen),y=l.find(c=>c.operation);return {dialogue:s,end:d?.end,choices:x?.choices,glueEnabled:m?.glueEnabled,goNextStep:u?.goNextStep,labelToOpen:f?.labelToOpen,operation:y?.operation}}}}function ge(t,i){if(!t)return !1;if(typeof t!="object"||!("type"in t))return !!t;switch(t.type){case"compare":let n=w(t.leftValue,i),e=w(t.rightValue,i);switch(t.operator){case"==":return n===e;case"!=":return n!==e;case"<":return n<e;case"<=":return n<=e;case">":return n>e;case">=":return n>=e;case"CONTAINS":return n.toString().includes(e.toString())}break;case"valueCondition":return !!w(t.value,i);case"union":return he(t,i);case"labelcondition":if("operator"in t&&"label"in t)switch(t.operator){case"started":return narration.getTimesLabelOpened(t.label)>0;case"completed":return narration.isLabelAlreadyCompleted(t.label)}break}return !!t}function w(t,i){if(t&&typeof t=="object"&&"type"in t)if(t.type==="value"&&t.storageOperationType==="get")switch(t.storageType){case"storage":return storage.getVariable(t.key);case"tempstorage":return StorageManagerStatic.getTempVariable(t.key);case"flagStorage":return getFlag(t.key);case"label":return narration.getTimesLabelOpened(t.label);case"logic":return P(t.operation,i);case"params":return i&&i.length-1>=t.key?i[t.key]:void 0}else return P(t,i);return t}function he(t,i){if(t.unionType==="not")return !P(t.condition,i);let n=t.unionType==="and";for(let e=0;e<t.conditions.length;e++)if(n=P(t.conditions[e],i)||!1,t.unionType==="and"){if(!n)return !1}else if(n)return !0;return n}function H(t,i){let n=p(t.value,i),e;switch(n&&typeof n=="object"&&"type"in n?e=P(n,i):e=n,t.storageType){case"flagStorage":setFlag(t.key,t.value);break;case"storage":storage.setVariable(t.key,e);break;case"tempstorage":StorageManagerStatic.setTempVariable(t.key,e);break;case"params":i&&i.length-1>=t.key&&(i[t.key]=e);break}}function P(t,i){let n=p(t,i);if(n&&typeof n=="object"&&"type"in n)switch(n.type){case"value":return w(n,i);case"arithmetic":case"arithmeticsingle":return ye(n,i);case"compare":case"valueCondition":case"union":case"labelcondition":return ge(n,i)}return n}function ye(t,i){let n=P(t.leftValue,i);switch(t.type){case"arithmetic":let e=P(t.rightValue,i);switch(t.operator){case"*":return n*e;case"/":return n/e;case"+":return n+e;case"-":return n-e;case"%":return n%e;case"POW":return Math.pow(n,e);case"RANDOM":return Math.floor(Math.random()*(e-n+1))+n}case"arithmeticsingle":switch(t.operator){case"INT":return parseInt(n);case"FLOOR":return Math.floor(n);case"FLOAT":return parseFloat(n)}break}}var O=class extends LabelAbstract{constructor(i,n,e,o){super(i,e),this._steps=n,this.operationStringConvert=o;}_steps;get steps(){return this._steps.map(this.stepConverter)}operationStringConvert;getStepSha1(i){if(i<0||i>=this.steps.length)return;let n=this._steps[i];return (0, ie.default)(n.toString().toLocaleLowerCase()).toString()}getDialogueText(i,n){let e="";if(Array.isArray(i)){let o=[];i.forEach(l=>{if(typeof l=="string")o.push(l);else if(l&&typeof l=="object"){let s=p(l,n);s&&(s&&!Array.isArray(s)&&typeof s=="object"&&(s=w(s,n)||""),Array.isArray(s)?o=o.concat(s):o.push(s));}}),e=o;}else {let o=p(i,n)||"";o&&!Array.isArray(o)&&typeof o=="object"&&(o=w(o,n)||""),e=o;}return e}getDialogue(i,n){let e=p(i,n),o;return e&&(typeof e=="object"&&"character"in e&&"text"in e?o={character:e.character,text:this.getDialogueText(e.text,n)}:o=this.getDialogueText(e,n)),o}getChoices(i,n){let e=p(i,n);if(e)return e.map(l=>p(l,n)).filter(l=>l!==void 0)}stepConverter(i){return async n=>{let e=n[j];if(typeof i=="function"&&(i=i()),i.operation)for(let u of i.operation)await this.runOperation(u,e);let o=this.getChoices(i.choices,e),l=p(i.glueEnabled,e),s=this.getDialogue(i.dialogue,e),d=[];i.labelToOpen&&(Array.isArray(i.labelToOpen)||(i.labelToOpen=[i.labelToOpen]),i.labelToOpen.forEach(u=>{let f=p(u,e);f&&d.push(f);}));let x=p(i.goNextStep,e),m=p(i.end,e);if(o){let u=o.map(f=>{let y="";if(Array.isArray(f.text)){let b=[];f.text.forEach(c=>{if(typeof c=="string")b.push(c);else if(c&&typeof c=="object"){let v=p(c,e);v&&!Array.isArray(v)&&typeof v=="object"&&(v=w(v,e)||""),v&&(Array.isArray(v)?b=b.concat(v):b.push(v));}}),y=b.join();}else typeof f.text=="string"&&(y=f.text);return new ChoiceMenuOption(y,f.label,f.props,{type:f.type,oneTime:f.oneTime})});u=u.filter((f,y)=>{if(f.oneTime){let b=narration.alreadyCurrentStepMadeChoices;if(b&&b.includes(y))return !1}return !0}),narration.choiceMenuOptions=u;}else narration.choiceMenuOptions=void 0;l?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):l===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1),s&&(narration.dialogue=s),d.forEach(u=>{let f=u.label;typeof f=="object"&&(f=w(f,e)||"");let y=u.params?.map(b=>P(b,e));n={...n,...u.props,[j]:y},u.type==="jump"?narration.jumpLabel(f,n):narration.callLabel(f,n);}),x&&await narration.goNext(n),m==="game_end"?(narration.closeAllLabels(),await narration.goNext(n)):m==="label_end"&&narration.closeCurrentLabel();}}async runOperation(i,n){let e=p(i,n);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":sound.add(e.alias,{...e.props,url:e.url});break;case"play":sound.play(e.alias,e.props);break;case"remove":sound.remove(e.alias);break;case"pause":sound.pause(e.alias);break;case"resume":sound.resume(e.alias);break;case"volume":sound.volume(e.alias,e.value);break}break;case"image":switch(e.operationType){case"show":if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,e.url,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,e.url,e.transition.props,e.transition.priority);break}else await showImage(e.alias,e.url);break;case"edit":let o=canvas.find(e.alias);o?e.props&&(o.memory={...o.memory,...e.props}):console.error(`[Pixi'VN] Image with alias ${e.alias} not found.`);break;case"remove":canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":if(e.transition){let d=new CanvasVideo;switch(d.videoLink=e.url,e.transition.type){case"fade":await showWithFadeTransition(e.alias,d,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,d,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,d,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,d,e.transition.props,e.transition.priority);break}}else await showVideo(e.alias,e.url);break;case"edit":let o=canvas.find(e.alias);o?e.props&&(o.memory={...o.memory,...e.props}):console.error(`[Pixi'VN] Video with alias ${e.alias} not found.`);break;case"remove":canvas.remove(e.alias);break;case"pause":let l=canvas.find(e.alias);l?l.paused=!0:console.error(`[Pixi'VN] Video with alias ${e.alias} not found.`);break;case"resume":let s=canvas.find(e.alias);s?s.paused=!1:console.error(`[Pixi'VN] Video with alias ${e.alias} not found.`);break}break;case"value":H(e,n);break;case"oprationtoconvert":if(this.operationStringConvert){let o="";e.values.forEach(s=>{if(typeof s=="string")o+=s;else {let d=P(s,n);d&&(o+=`${d}`);}});let l=this.operationStringConvert(o);l&&await this.runOperation(l,n);}break;case"input":switch(e.operationType){case"request":narration.requestInput({type:e.valueType});break}break}}};function ve(t,i){try{typeof t=="string"&&(t=JSON.parse(t));}catch(n){console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON",n);return}if(typeof t!="object"){console.error("[Pixi'VN] Error parsing imported Pixi'VN JSON: data is not an object");return}if(t.labels){let n=t.labels;for(let e in n)try{let o=n[e],l=new O(e,o,void 0,i);saveLabel(l);}catch(o){console.error(`[Pixi'VN] Error creating JSON label ${e}`,o);}}}
3
+ var re=Object.create;var z=Object.defineProperty;var ae=Object.getOwnPropertyDescriptor;var oe=Object.getOwnPropertyNames;var se=Object.getPrototypeOf,le=Object.prototype.hasOwnProperty;var H=(i=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(i,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):i)(function(i){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+i+'" is not supported')});var M=(i,t)=>()=>(t||i((t={exports:{}}).exports,t),t.exports);var ue=(i,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of oe(t))!le.call(i,o)&&o!==e&&z(i,o,{get:()=>t[o],enumerable:!(r=ae(t,o))||r.enumerable});return i};var fe=(i,t,e)=>(e=i!=null?re(se(i)):{},ue(z(e,"default",{value:i,enumerable:!0}),i));var X=M((k,U)=>{(function(i,t){typeof k=="object"?U.exports=k=t():typeof define=="function"&&define.amd?define([],t):i.CryptoJS=t();})(k,function(){var i=i||function(t,e){var r;if(typeof window<"u"&&window.crypto&&(r=window.crypto),typeof self<"u"&&self.crypto&&(r=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(r=globalThis.crypto),!r&&typeof window<"u"&&window.msCrypto&&(r=window.msCrypto),!r&&typeof global<"u"&&global.crypto&&(r=global.crypto),!r&&typeof H=="function")try{r=H("crypto");}catch{}var o=function(){if(r){if(typeof r.getRandomValues=="function")try{return r.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof r.randomBytes=="function")try{return r.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},u=Object.create||function(){function n(){}return function(a){var f;return n.prototype=a,f=new n,n.prototype=null,f}}(),c={},b=c.lib={},g=b.Base=function(){return {extend:function(n){var a=u(this);return n&&a.mixIn(n),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var a in n)n.hasOwnProperty(a)&&(this[a]=n[a]);n.hasOwnProperty("toString")&&(this.toString=n.toString);},clone:function(){return this.init.prototype.extend(this)}}}(),p=b.WordArray=g.extend({init:function(n,a){n=this.words=n||[],a!=e?this.sigBytes=a:this.sigBytes=n.length*4;},toString:function(n){return (n||m).stringify(this)},concat:function(n){var a=this.words,f=n.words,d=this.sigBytes,T=n.sigBytes;if(this.clamp(),d%4)for(var N=0;N<T;N++){var G=f[N>>>2]>>>24-N%4*8&255;a[d+N>>>2]|=G<<24-(d+N)%4*8;}else for(var P=0;P<T;P+=4)a[d+P>>>2]=f[P>>>2];return this.sigBytes+=T,this},clamp:function(){var n=this.words,a=this.sigBytes;n[a>>>2]&=4294967295<<32-a%4*8,n.length=t.ceil(a/4);},clone:function(){var n=g.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var a=[],f=0;f<n;f+=4)a.push(o());return new p.init(a,n)}}),l=c.enc={},m=l.Hex={stringify:function(n){for(var a=n.words,f=n.sigBytes,d=[],T=0;T<f;T++){var N=a[T>>>2]>>>24-T%4*8&255;d.push((N>>>4).toString(16)),d.push((N&15).toString(16));}return d.join("")},parse:function(n){for(var a=n.length,f=[],d=0;d<a;d+=2)f[d>>>3]|=parseInt(n.substr(d,2),16)<<24-d%8*4;return new p.init(f,a/2)}},h=l.Latin1={stringify:function(n){for(var a=n.words,f=n.sigBytes,d=[],T=0;T<f;T++){var N=a[T>>>2]>>>24-T%4*8&255;d.push(String.fromCharCode(N));}return d.join("")},parse:function(n){for(var a=n.length,f=[],d=0;d<a;d++)f[d>>>2]|=(n.charCodeAt(d)&255)<<24-d%4*8;return new p.init(f,a)}},x=l.Utf8={stringify:function(n){try{return decodeURIComponent(escape(h.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return h.parse(unescape(encodeURIComponent(n)))}},y=b.BufferedBlockAlgorithm=g.extend({reset:function(){this._data=new p.init,this._nDataBytes=0;},_append:function(n){typeof n=="string"&&(n=x.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes;},_process:function(n){var a,f=this._data,d=f.words,T=f.sigBytes,N=this.blockSize,G=N*4,P=T/G;n?P=t.ceil(P):P=t.max((P|0)-this._minBufferSize,0);var A=P*N,W=t.min(A*4,T);if(A){for(var j=0;j<A;j+=N)this._doProcessBlock(d,j);a=d.splice(0,A),f.sigBytes-=W;}return new p.init(a,W)},clone:function(){var n=g.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});b.Hasher=y.extend({cfg:g.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset();},reset:function(){y.reset.call(this),this._doReset();},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(n){return function(a,f){return new n.init(f).finalize(a)}},_createHmacHelper:function(n){return function(a,f){return new V.HMAC.init(n,f).finalize(a)}}});var V=c.algo={};return c}(Math);return i});});var K=M((I,q)=>{(function(i,t){typeof I=="object"?q.exports=I=t(X()):typeof define=="function"&&define.amd?define(["./core"],t):t(i.CryptoJS);})(I,function(i){return function(){var t=i,e=t.lib,r=e.WordArray,o=e.Hasher,u=t.algo,c=[],b=u.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(g,p){for(var l=this._hash.words,m=l[0],h=l[1],x=l[2],y=l[3],v=l[4],V=0;V<80;V++){if(V<16)c[V]=g[p+V]|0;else {var n=c[V-3]^c[V-8]^c[V-14]^c[V-16];c[V]=n<<1|n>>>31;}var a=(m<<5|m>>>27)+v+c[V];V<20?a+=(h&x|~h&y)+1518500249:V<40?a+=(h^x^y)+1859775393:V<60?a+=(h&x|h&y|x&y)-1894007588:a+=(h^x^y)-899497514,v=y,y=x,x=h<<30|h>>>2,h=m,m=a;}l[0]=l[0]+m|0,l[1]=l[1]+h|0,l[2]=l[2]+x|0,l[3]=l[3]+y|0,l[4]=l[4]+v|0;},_doFinalize:function(){var g=this._data,p=g.words,l=this._nDataBytes*8,m=g.sigBytes*8;return p[m>>>5]|=128<<24-m%32,p[(m+64>>>9<<4)+14]=Math.floor(l/4294967296),p[(m+64>>>9<<4)+15]=l,g.sigBytes=p.length*4,this._process(),this._hash},clone:function(){var g=o.clone.call(this);return g._hash=this._hash.clone(),g}});t.SHA1=o._createHelper(b),t.HmacSHA1=o._createHmacHelper(b);}(),i.SHA1});});var ne=fe(K());var _="___param___";function pe(i,t){return Math.floor(Math.random()*(t-i+1)+i)}function de(i){if(Array.isArray(i)||!i)return i;if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"resulttocombine":return ge(i);case"ifelse":return s(i.condition)?s(i.then):s(i.else);case"stepswitch":let e=s(i.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(i.choiceType){case"random":let r=pe(0,e.length-1);return s(e[r]);case"loop":let o=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return o>e.length-1&&(o=o%e.length),s(e[o]);case"sequential":let u,c=NarrationManagerStatic.getCurrentStepTimesCounter(i.nestedId)-1;return i.end=="lastItem"&&(u=s(e[e.length-1])),c>e.length-1?u:s(e[c]);case"sequentialrandom":let b=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:i.nestedId,onceOnly:!0});if(b==null&&i.end=="lastItem"){let g=NarrationManagerStatic.getCurrentStepTimesCounterData(i.nestedId);if(!g||!g?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let p=g.usedRandomNumbers[`0-${e.length-1}`];return s(e[p[p.length-1]])}if(b==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return s(e[b])}}return i}function R(i){if(i.conditionalStep){let t=createExportableElement(s(i.conditionalStep));if(t?.glueEnabled===void 0&&delete t?.glueEnabled,t?.goNextStep===void 0&&delete t?.goNextStep,t?.end===void 0&&delete t?.end,t?.choices===void 0&&delete t?.choices,t?.dialogue===void 0&&delete t?.dialogue,t?.labelToOpen===void 0&&delete t?.labelToOpen,t?.operation===void 0&&delete t?.operation,t){let e={...i,conditionalStep:void 0,...t};return R(e)}else getFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);}return i}function ge(i){let t=i.firstItem,e=[];i.secondConditionalItem?.forEach(o=>{if(Array.isArray(o))o.forEach(u=>{let c=s(u);e.push(c);});else {let u=s(o);e.push(u);}});let r=t?[t,...e]:e;if(r.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof r[0]=="string")return r.join("");if(typeof r[0]=="object"){let o=r,u,c=o.map((n,a)=>{n=R(n);let f=s(n.dialogue)||"";return a===0?(u=s(n.glueEnabled)||!1,f):(typeof f=="object"&&"text"in f&&(f=f.character+": "+f.text),u===!1&&(f=`
4
4
 
5
- export { P as geLogichValue, w as getValue, p as getValueFromConditionalStatements, ve as importPixiVNJson, H as setStorageJson };
5
+ `+f),u=s(n.glueEnabled)||!1,f)}),b=s(c[0]),g=typeof b=="object"&&"character"in b?b.character:void 0,p=c.map(n=>{let a;n&&typeof n=="object"&&"text"in n?a=n.text:a=n;let f;return Array.isArray(a)?f=a.map(d=>`${s(d)}`).join(""):f=s(a)||"",f}).join(""),l=o.find(n=>n.end),m=o.find(n=>n.choices),h=!1,x=!1;o.length>0&&(o[0].glueEnabled&&o[0].goNextStep&&o[0].dialogue===void 0&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),h=o[o.length-1].glueEnabled,x=o.reverse().find(n=>!(n.operation&&(!n.dialogue||!n.choices)))?.goNextStep);let y=o.find(n=>n.labelToOpen),v=[];return o.forEach(n=>{n.operation&&v.forEach(a=>{v.push(a);});}),{dialogue:g?{character:g,text:p}:p,end:l?.end,choices:m?.choices,glueEnabled:h,goNextStep:x,labelToOpen:y?.labelToOpen,operation:v}}}function he(i){if(!i)return !1;if(typeof i!="object"||!("type"in i))return !!i;switch(i.type){case"compare":let t=s(i.leftValue),e=s(i.rightValue);switch(i.operator){case"==":return t===e;case"!=":return t!==e;case"<":return t<e;case"<=":return t<=e;case">":return t>e;case">=":return t>=e;case"CONTAINS":return t.toString().includes(e.toString())}break;case"valueCondition":return !!s(i.value);case"union":return me(i)}return !!i}function ye(i){if(i&&typeof i=="object"&&"type"in i&&i.type==="value"&&i.storageOperationType==="get")switch(i.storageType){case"storage":case"tempstorage":return storage.getVariable(i.key);case"flagStorage":return getFlag(i.key);case"label":return narration.getTimesLabelOpened(i.label);case"choice":return narration.getTimesChoiceMade(i.index);case"logic":return s(i.operation);case"params":let t=storage.getVariable(`${_}${narration.openedLabels.length-1}`)||[];if(t&&t.length>i.key)return t[i.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return i}function me(i){if(i.unionType==="not")return !s(i.condition);let t=i.unionType==="and";for(let e=0;e<i.conditions.length;e++)if(t=s(i.conditions[e])||!1,i.unionType==="and"){if(!t)return !1}else if(t)return !0;return t}function F(i){let t=s(i.value),e;switch(t&&typeof t=="object"&&"type"in t?e=s(t):e=t,i.storageType){case"flagStorage":setFlag(i.key,i.value);break;case"storage":storage.setVariable(i.key,e);break;case"tempstorage":storage.setTempVariable(i.key,e);break;case"params":let r=storage.getVariable(`${_}${narration.openedLabels.length-1}`)||[];r&&r.length-1>=i.key&&(r[i.key]=e),storage.setTempVariable(`${_}${narration.openedLabels.length-1}`,r);break}}function s(i){let t=de(i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case"value":return ye(t);case"arithmetic":case"arithmeticsingle":return xe(t);case"compare":case"valueCondition":case"union":return he(t)}return t}function xe(i){let t=s(i.leftValue);switch(i.type){case"arithmetic":let e=s(i.rightValue);switch(i.operator){case"*":return t*e;case"/":return t/e;case"+":return t+e;case"-":return t-e;case"%":return t%e;case"POW":return Math.pow(t,e);case"RANDOM":return narration.getRandomNumber(t,e)}case"arithmeticsingle":switch(i.operator){case"INT":return parseInt(t);case"FLOOR":return Math.floor(t);case"FLOAT":return parseFloat(t)}break}}async function E(i,t){let e=s(i);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":sound.add(e.alias,{...e.props,url:e.url});break;case"play":sound.play(e.alias,e.props);break;case"remove":sound.remove(e.alias);break;case"pause":sound.pause(e.alias);break;case"resume":sound.resume(e.alias);break;case"volume":sound.volume(e.alias,e.value);break}break;case"image":switch(e.operationType){case"show":if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,e.url,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,e.url,e.transition.props,e.transition.priority);break}else await showImage(e.alias,e.url);break;case"edit":let r=canvas.find(e.alias);r?e.props&&(r.memory={...r.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":if(e.transition){let c=new CanvasVideo;switch(c.videoLink=e.url,e.transition.type){case"fade":await showWithFadeTransition(e.alias,c,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,c,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,c,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,c,e.transition.props,e.transition.priority);break}}else await showVideo(e.alias,e.url);break;case"edit":let r=canvas.find(e.alias);r?e.props&&(r.memory={...r.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":canvas.remove(e.alias);break;case"pause":let o=canvas.find(e.alias);o?o.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let u=canvas.find(e.alias);u?u.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":F(e);break;case"oprationtoconvert":if(t){let r="";e.values.forEach(u=>{if(typeof u=="string")r+=u;else {let c=s(u);r+=`${c}`;}});let o=t(r);o&&await E(o);}break;case"input":switch(e.operationType){case"request":narration.requestInput({type:e.valueType});break}break}}var L=class extends LabelAbstract{constructor(t,e,r,o={}){super(t,r),this._steps=e,this.operationStringConvert=o.operationStringConvert,this.skipEmptyDialogs=o.skipEmptyDialogs||!1;}_steps;get steps(){return this._steps.map(t=>this.stepConverter(t))}operationStringConvert;skipEmptyDialogs=!1;getStepSha1(t){if(t<0||t>=this.steps.length)return;let e=this._steps[t];return (0, ne.default)(e.toString().toLocaleLowerCase()).toString()}getDialogueText(t){let e="";if(Array.isArray(t)){let r=[];t.forEach(o=>{if(typeof o=="string")r.push(o);else if(o&&typeof o=="object"){let u=s(o);u?(u&&!Array.isArray(u)&&typeof u=="object"&&(u=s(u)||""),Array.isArray(u)?r=r.concat(u):r.push(`${u}`)):r.push(`${o}`);}}),e=r;}else {let r=s(t)||"";r&&!Array.isArray(r)&&typeof r=="object"&&(r=s(r)||""),e=r;}return `${e}`}getDialogue(t){let e=s(t);if(e)return typeof e=="object"&&"character"in e&&"text"in e?{character:e.character,text:this.getDialogueText(e.text)}:this.getDialogueText(e);if(e!=null)return `${e}`}getChoices(t){return s(t)?.map(o=>s(o)).filter(o=>o!==void 0)}stepConverter(t){return async e=>{if(typeof t=="function"&&(t=t()),t=R(t),t.operation)for(let p of t.operation)await E(p,this.operationStringConvert);let r=this.getChoices(t.choices),o=s(t.glueEnabled),u=this.getDialogue(t.dialogue),c=[];t.labelToOpen&&(Array.isArray(t.labelToOpen)||(t.labelToOpen=[t.labelToOpen]),t.labelToOpen.forEach(p=>{let l=s(p);l&&c.push(l);}));let b=s(t.goNextStep),g=s(t.end);if(r){let p=r.map(l=>{let m="";if(Array.isArray(l.text)){let h=[];l.text.forEach(x=>{if(typeof x=="string")h.push(x);else if(x&&typeof x=="object"){let y=s(x);y&&!Array.isArray(y)&&typeof y=="object"&&(y=s(y)||""),y&&(Array.isArray(y)?h=h.concat(y):h.push(y));}}),m=h.join();}else typeof l.text=="string"&&(m=l.text);return new ChoiceMenuOption(m,l.label,l.props,{type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect})});narration.choiceMenuOptions=p;}else narration.choiceMenuOptions=void 0;u!==void 0&&(narration.dialogue=u,this.skipEmptyDialogs&&typeof u=="string"&&(u===""||RegExp(/^\s+$/).test(u))&&(b=!0)),o?setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0):o===!1&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1),c.forEach(p=>{let l=p.label;typeof l=="object"&&(l=s(l)||"");let m=p.params?.map(h=>s(h));e={...e,...p.props},p.type==="jump"?(narration.closeCurrentLabel(),storage.setTempVariable(`${_}${narration.openedLabels.length}`,m),narration.callLabel(l,e)):(storage.setTempVariable(`${_}${narration.openedLabels.length}`,m),narration.callLabel(l,e));}),g==="game_end"?(narration.closeAllLabels(),await narration.goNext(e)):g==="label_end"&&narration.closeCurrentLabel(),b&&await narration.goNext(e);}}};function _e(i,t={}){let e=t?.operationStringConvert;try{typeof i=="string"&&(i=JSON.parse(i));}catch(r){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON",r);return}if(typeof i!="object"){console.error("[Pixi\u2019VN Json] Error parsing imported Pixi'VN JSON: data is not an object");return}if(i.initialOperations){for(let r of i.initialOperations)E(r,e);StorageManagerStatic.saveStorageAsBasicStorage();}if(i.labels){let r=i.labels;for(let o in r)try{let u=r[o],c=new L(o,u,void 0,t);saveLabel(c);}catch(u){console.error(`[Pixi\u2019VN Json] Error creating JSON label ${o}`,u);}}}
6
+
7
+ export { s as geLogichValue, _e as importPixiVNJson, F as setStorageJson };
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ var pixiVn = require('@drincs/pixi-vn');
4
+
5
+ var V="___param___";function v(n,i){return Math.floor(Math.random()*(i-n+1)+n)}function G(n){if(Array.isArray(n)||!n)return n;if(n&&typeof n=="object"&&"type"in n)switch(n.type){case"resulttocombine":return R(n);case"ifelse":return a(n.condition)?a(n.then):a(n.else);case"stepswitch":let e=a(n.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(n.choiceType){case"random":let o=v(0,e.length-1);return a(e[o]);case"loop":let t=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(n.nestedId)-1;return t>e.length-1&&(t=t%e.length),a(e[t]);case"sequential":let r,l=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounter(n.nestedId)-1;return n.end=="lastItem"&&(r=a(e[e.length-1])),l>e.length-1?r:a(e[l]);case"sequentialrandom":let p=pixiVn.NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:n.nestedId,onceOnly:!0});if(p==null&&n.end=="lastItem"){let f=pixiVn.NarrationManagerStatic.getCurrentStepTimesCounterData(n.nestedId);if(!f||!f?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=f.usedRandomNumbers[`0-${e.length-1}`];return a(e[y[y.length-1]])}if(p==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return a(e[p])}}return n}function S(n){if(n.conditionalStep){let i=pixiVn.createExportableElement(a(n.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?.operation===void 0&&delete i?.operation,i){let e={...n,conditionalStep:void 0,...i};return S(e)}else pixiVn.getFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);}return n}function R(n){let i=n.firstItem,e=[];n.secondConditionalItem?.forEach(t=>{if(Array.isArray(t))t.forEach(r=>{let l=a(r);e.push(l);});else {let r=a(t);e.push(r);}});let o=i?[i,...e]:e;if(o.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return o.join("");if(typeof o[0]=="object"){let t=o,r,l=t.map((s,d)=>{s=S(s);let u=a(s.dialogue)||"";return d===0?(r=a(s.glueEnabled)||!1,u):(typeof u=="object"&&"text"in u&&(u=u.character+": "+u.text),r===!1&&(u=`
6
+
7
+ `+u),r=a(s.glueEnabled)||!1,u)}),p=a(l[0]),f=typeof p=="object"&&"character"in p?p.character:void 0,y=l.map(s=>{let d;s&&typeof s=="object"&&"text"in s?d=s.text:d=s;let u;return Array.isArray(d)?u=d.map(L=>`${a(L)}`).join(""):u=a(d)||"",u}).join(""),I=t.find(s=>s.end),_=t.find(s=>s.choices),N=!1,P=!1;t.length>0&&(t[0].glueEnabled&&t[0].goNextStep&&t[0].dialogue===void 0&&pixiVn.setFlag(pixiVn.storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),N=t[t.length-1].glueEnabled,P=t.reverse().find(s=>!(s.operation&&(!s.dialogue||!s.choices)))?.goNextStep);let A=t.find(s=>s.labelToOpen),x=[];return t.forEach(s=>{s.operation&&x.forEach(d=>{x.push(d);});}),{dialogue:f?{character:f,text:y}:y,end:I?.end,choices:_?.choices,glueEnabled:N,goNextStep:P,labelToOpen:A?.labelToOpen,operation:x}}}function j(n){if(!n)return !1;if(typeof n!="object"||!("type"in n))return !!n;switch(n.type){case"compare":let i=a(n.leftValue),e=a(n.rightValue);switch(n.operator){case"==":return i===e;case"!=":return i!==e;case"<":return i<e;case"<=":return i<=e;case">":return i>e;case">=":return i>=e;case"CONTAINS":return i.toString().includes(e.toString())}break;case"valueCondition":return !!a(n.value);case"union":return $(n)}return !!n}function F(n){if(n&&typeof n=="object"&&"type"in n&&n.type==="value"&&n.storageOperationType==="get")switch(n.storageType){case"storage":case"tempstorage":return pixiVn.storage.getVariable(n.key);case"flagStorage":return pixiVn.getFlag(n.key);case"label":return pixiVn.narration.getTimesLabelOpened(n.label);case"choice":return pixiVn.narration.getTimesChoiceMade(n.index);case"logic":return a(n.operation);case"params":let i=pixiVn.storage.getVariable(`${V}${pixiVn.narration.openedLabels.length-1}`)||[];if(i&&i.length>n.key)return i[n.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return n}function $(n){if(n.unionType==="not")return !a(n.condition);let i=n.unionType==="and";for(let e=0;e<n.conditions.length;e++)if(i=a(n.conditions[e])||!1,n.unionType==="and"){if(!i)return !1}else if(i)return !0;return i}function k(n){let i=a(n.value),e;switch(i&&typeof i=="object"&&"type"in i?e=a(i):e=i,n.storageType){case"flagStorage":pixiVn.setFlag(n.key,n.value);break;case"storage":pixiVn.storage.setVariable(n.key,e);break;case"tempstorage":pixiVn.storage.setTempVariable(n.key,e);break;case"params":let o=pixiVn.storage.getVariable(`${V}${pixiVn.narration.openedLabels.length-1}`)||[];o&&o.length-1>=n.key&&(o[n.key]=e),pixiVn.storage.setTempVariable(`${V}${pixiVn.narration.openedLabels.length-1}`,o);break}}function a(n){let i=G(n);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"value":return F(i);case"arithmetic":case"arithmeticsingle":return M(i);case"compare":case"valueCondition":case"union":return j(i)}return i}function M(n){let i=a(n.leftValue);switch(n.type){case"arithmetic":let e=a(n.rightValue);switch(n.operator){case"*":return i*e;case"/":return i/e;case"+":return i+e;case"-":return i-e;case"%":return i%e;case"POW":return Math.pow(i,e);case"RANDOM":return pixiVn.narration.getRandomNumber(i,e)}case"arithmeticsingle":switch(n.operator){case"INT":return parseInt(i);case"FLOOR":return Math.floor(i);case"FLOAT":return parseFloat(i)}break}}async function q(n,i){let e=a(n);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":pixiVn.sound.add(e.alias,{...e.props,url:e.url});break;case"play":pixiVn.sound.play(e.alias,e.props);break;case"remove":pixiVn.sound.remove(e.alias);break;case"pause":pixiVn.sound.pause(e.alias);break;case"resume":pixiVn.sound.resume(e.alias);break;case"volume":pixiVn.sound.volume(e.alias,e.value);break}break;case"image":switch(e.operationType){case"show":if(e.transition)switch(e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,e.url,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,e.url,e.transition.props,e.transition.priority);break}else await pixiVn.showImage(e.alias,e.url);break;case"edit":let o=pixiVn.canvas.find(e.alias);o?e.props&&(o.memory={...o.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":pixiVn.canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":if(e.transition){let l=new pixiVn.CanvasVideo;switch(l.videoLink=e.url,e.transition.type){case"fade":await pixiVn.showWithFadeTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"dissolve":await pixiVn.showWithDissolveTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await pixiVn.moveIn(e.alias,l,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await pixiVn.zoomIn(e.alias,l,e.transition.props,e.transition.priority);break}}else await pixiVn.showVideo(e.alias,e.url);break;case"edit":let o=pixiVn.canvas.find(e.alias);o?e.props&&(o.memory={...o.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":pixiVn.canvas.remove(e.alias);break;case"pause":let t=pixiVn.canvas.find(e.alias);t?t.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let r=pixiVn.canvas.find(e.alias);r?r.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":k(e);break;case"oprationtoconvert":if(i){let o="";e.values.forEach(r=>{if(typeof r=="string")o+=r;else {let l=a(r);o+=`${l}`;}});let t=i(o);t&&await q(t);}break;case"input":switch(e.operationType){case"request":pixiVn.narration.requestInput({type:e.valueType});break}break}}
8
+
9
+ exports.runOperation = q;
@@ -0,0 +1,11 @@
1
+ import { e as PixiVNJsonIfElse } from '../PixiVNJsonConditionalStatements-CVkQSKpq.cjs';
2
+ import { PixiVNJsonOperation, PixiVNJsonOperationString } from '../interface/PixiVNJsonOperations.cjs';
3
+ import '@drincs/pixi-vn';
4
+ import '../interface/PixiVNJsonInput.cjs';
5
+ import '../interface/PixiVNJsonMedia.cjs';
6
+ import '../interface/PixiVNJsonMediaTransiotions.cjs';
7
+ import 'pixi.js';
8
+
9
+ declare function runOperation(origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString, operationStringConvert?: (value: string) => PixiVNJsonOperation | undefined): Promise<void>;
10
+
11
+ export { runOperation };
@@ -0,0 +1,11 @@
1
+ import { e as PixiVNJsonIfElse } from '../PixiVNJsonConditionalStatements-CVkQSKpq.js';
2
+ import { PixiVNJsonOperation, PixiVNJsonOperationString } from '../interface/PixiVNJsonOperations.js';
3
+ import '@drincs/pixi-vn';
4
+ import '../interface/PixiVNJsonInput.js';
5
+ import '../interface/PixiVNJsonMedia.js';
6
+ import '../interface/PixiVNJsonMediaTransiotions.js';
7
+ import 'pixi.js';
8
+
9
+ declare function runOperation(origin: PixiVNJsonOperation | PixiVNJsonIfElse<PixiVNJsonOperation> | PixiVNJsonOperationString, operationStringConvert?: (value: string) => PixiVNJsonOperation | undefined): Promise<void>;
10
+
11
+ export { runOperation };
@@ -0,0 +1,7 @@
1
+ import { narration, canvas, CanvasVideo, zoomIn, moveIn, showWithDissolveTransition, showWithFadeTransition, showVideo, showImage, sound, storage, setFlag, NarrationManagerStatic, getFlag, createExportableElement } from '@drincs/pixi-vn';
2
+
3
+ var V="___param___";function v(n,i){return Math.floor(Math.random()*(i-n+1)+n)}function G(n){if(Array.isArray(n)||!n)return n;if(n&&typeof n=="object"&&"type"in n)switch(n.type){case"resulttocombine":return R(n);case"ifelse":return a(n.condition)?a(n.then):a(n.else);case"stepswitch":let e=a(n.elements)||[];if(e.length===0){console.error("[Pixi\u2019VN Json] getValueFromConditionalStatements elements.length === 0");return}switch(n.choiceType){case"random":let o=v(0,e.length-1);return a(e[o]);case"loop":let t=NarrationManagerStatic.getCurrentStepTimesCounter(n.nestedId)-1;return t>e.length-1&&(t=t%e.length),a(e[t]);case"sequential":let r,l=NarrationManagerStatic.getCurrentStepTimesCounter(n.nestedId)-1;return n.end=="lastItem"&&(r=a(e[e.length-1])),l>e.length-1?r:a(e[l]);case"sequentialrandom":let p=NarrationManagerStatic.getRandomNumber(0,e.length-1,{nestedId:n.nestedId,onceOnly:!0});if(p==null&&n.end=="lastItem"){let f=NarrationManagerStatic.getCurrentStepTimesCounterData(n.nestedId);if(!f||!f?.usedRandomNumbers){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let y=f.usedRandomNumbers[`0-${e.length-1}`];return a(e[y[y.length-1]])}if(p==null){console.warn("[Pixi\u2019VN Json] getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return a(e[p])}}return n}function S(n){if(n.conditionalStep){let i=createExportableElement(a(n.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?.operation===void 0&&delete i?.operation,i){let e={...n,conditionalStep:void 0,...i};return S(e)}else getFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY)&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!1);}return n}function R(n){let i=n.firstItem,e=[];n.secondConditionalItem?.forEach(t=>{if(Array.isArray(t))t.forEach(r=>{let l=a(r);e.push(l);});else {let r=a(t);e.push(r);}});let o=i?[i,...e]:e;if(o.length===0){console.warn("[Pixi\u2019VN Json] combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return o.join("");if(typeof o[0]=="object"){let t=o,r,l=t.map((s,d)=>{s=S(s);let u=a(s.dialogue)||"";return d===0?(r=a(s.glueEnabled)||!1,u):(typeof u=="object"&&"text"in u&&(u=u.character+": "+u.text),r===!1&&(u=`
4
+
5
+ `+u),r=a(s.glueEnabled)||!1,u)}),p=a(l[0]),f=typeof p=="object"&&"character"in p?p.character:void 0,y=l.map(s=>{let d;s&&typeof s=="object"&&"text"in s?d=s.text:d=s;let u;return Array.isArray(d)?u=d.map(L=>`${a(L)}`).join(""):u=a(d)||"",u}).join(""),I=t.find(s=>s.end),_=t.find(s=>s.choices),N=!1,P=!1;t.length>0&&(t[0].glueEnabled&&t[0].goNextStep&&t[0].dialogue===void 0&&setFlag(storage.keysSystem.ADD_NEXT_DIALOG_TEXT_INTO_THE_CURRENT_DIALOG_FLAG_KEY,!0),N=t[t.length-1].glueEnabled,P=t.reverse().find(s=>!(s.operation&&(!s.dialogue||!s.choices)))?.goNextStep);let A=t.find(s=>s.labelToOpen),x=[];return t.forEach(s=>{s.operation&&x.forEach(d=>{x.push(d);});}),{dialogue:f?{character:f,text:y}:y,end:I?.end,choices:_?.choices,glueEnabled:N,goNextStep:P,labelToOpen:A?.labelToOpen,operation:x}}}function j(n){if(!n)return !1;if(typeof n!="object"||!("type"in n))return !!n;switch(n.type){case"compare":let i=a(n.leftValue),e=a(n.rightValue);switch(n.operator){case"==":return i===e;case"!=":return i!==e;case"<":return i<e;case"<=":return i<=e;case">":return i>e;case">=":return i>=e;case"CONTAINS":return i.toString().includes(e.toString())}break;case"valueCondition":return !!a(n.value);case"union":return $(n)}return !!n}function F(n){if(n&&typeof n=="object"&&"type"in n&&n.type==="value"&&n.storageOperationType==="get")switch(n.storageType){case"storage":case"tempstorage":return storage.getVariable(n.key);case"flagStorage":return getFlag(n.key);case"label":return narration.getTimesLabelOpened(n.label);case"choice":return narration.getTimesChoiceMade(n.index);case"logic":return a(n.operation);case"params":let i=storage.getVariable(`${V}${narration.openedLabels.length-1}`)||[];if(i&&i.length>n.key)return i[n.key];console.warn("[Pixi\u2019VN Json] getValue params not found");return}return n}function $(n){if(n.unionType==="not")return !a(n.condition);let i=n.unionType==="and";for(let e=0;e<n.conditions.length;e++)if(i=a(n.conditions[e])||!1,n.unionType==="and"){if(!i)return !1}else if(i)return !0;return i}function k(n){let i=a(n.value),e;switch(i&&typeof i=="object"&&"type"in i?e=a(i):e=i,n.storageType){case"flagStorage":setFlag(n.key,n.value);break;case"storage":storage.setVariable(n.key,e);break;case"tempstorage":storage.setTempVariable(n.key,e);break;case"params":let o=storage.getVariable(`${V}${narration.openedLabels.length-1}`)||[];o&&o.length-1>=n.key&&(o[n.key]=e),storage.setTempVariable(`${V}${narration.openedLabels.length-1}`,o);break}}function a(n){let i=G(n);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case"value":return F(i);case"arithmetic":case"arithmeticsingle":return M(i);case"compare":case"valueCondition":case"union":return j(i)}return i}function M(n){let i=a(n.leftValue);switch(n.type){case"arithmetic":let e=a(n.rightValue);switch(n.operator){case"*":return i*e;case"/":return i/e;case"+":return i+e;case"-":return i-e;case"%":return i%e;case"POW":return Math.pow(i,e);case"RANDOM":return narration.getRandomNumber(i,e)}case"arithmeticsingle":switch(n.operator){case"INT":return parseInt(i);case"FLOOR":return Math.floor(i);case"FLOAT":return parseFloat(i)}break}}async function q(n,i){let e=a(n);if(e)switch(e.type){case"sound":switch(e.operationType){case"add":sound.add(e.alias,{...e.props,url:e.url});break;case"play":sound.play(e.alias,e.props);break;case"remove":sound.remove(e.alias);break;case"pause":sound.pause(e.alias);break;case"resume":sound.resume(e.alias);break;case"volume":sound.volume(e.alias,e.value);break}break;case"image":switch(e.operationType){case"show":if(e.transition)switch(e.transition.type){case"fade":await showWithFadeTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,e.url,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,e.url,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,e.url,e.transition.props,e.transition.priority);break}else await showImage(e.alias,e.url);break;case"edit":let o=canvas.find(e.alias);o?e.props&&(o.memory={...o.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Image with alias ${e.alias} not found.`);break;case"remove":canvas.remove(e.alias);break}break;case"video":switch(e.operationType){case"show":if(e.transition){let l=new CanvasVideo;switch(l.videoLink=e.url,e.transition.type){case"fade":await showWithFadeTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"dissolve":await showWithDissolveTransition(e.alias,l,e.transition.props,e.transition.priority);break;case"movein":case"moveout":await moveIn(e.alias,l,e.transition.props,e.transition.priority);break;case"zoomin":case"zoomout":await zoomIn(e.alias,l,e.transition.props,e.transition.priority);break}}else await showVideo(e.alias,e.url);break;case"edit":let o=canvas.find(e.alias);o?e.props&&(o.memory={...o.memory,...e.props}):console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"remove":canvas.remove(e.alias);break;case"pause":let t=canvas.find(e.alias);t?t.paused=!0:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break;case"resume":let r=canvas.find(e.alias);r?r.paused=!1:console.error(`[Pixi\u2019VN Json] Video with alias ${e.alias} not found.`);break}break;case"value":k(e);break;case"oprationtoconvert":if(i){let o="";e.values.forEach(r=>{if(typeof r=="string")o+=r;else {let l=a(r);o+=`${l}`;}});let t=i(o);t&&await q(t);}break;case"input":switch(e.operationType){case"request":narration.requestInput({type:e.valueType});break}break}}
6
+
7
+ export { q as runOperation };