@drincs/pixi-vn-json 1.13.15 → 1.13.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/actions.cjs CHANGED
@@ -1,3 +1,3 @@
1
- 'use strict';var core=require('@drincs/pixi-vn-json/core'),canvas=require('@drincs/pixi-vn/canvas'),translator=require('@drincs/pixi-vn-json/translator'),narration=require('@drincs/pixi-vn/narration'),sound=require('@drincs/pixi-vn/sound'),pixiVn=require('@drincs/pixi-vn'),storage=require('@drincs/pixi-vn/storage');async function Je(e){let t=core.JsonUnifier.getLogichValue(e,{});if(t)switch(t.type){case "assets":switch(t.operationType){case "load":await canvas.Assets.load(t.aliases);break;case "lazyload":canvas.Assets.backgroundLoad(t.aliases);break}break;case "bundle":switch(t.operationType){case "load":await canvas.Assets.loadBundle(t.aliases);break;case "lazyload":canvas.Assets.backgroundLoadBundle(t.aliases);break}break}}var n;(o=>(o.log=(r,...l)=>console.log(`[Pixi\u2019VN Json] ${r}`,...l),o.warn=(r,...l)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...l),o.error=(r,...l)=>console.error(`[Pixi\u2019VN Json] ${r}`,...l),o.info=(r,...l)=>console.info(`[Pixi\u2019VN Json] ${r}`,...l)))(n||={});async function w(e,t,i){switch(i.type){case "fade":await canvas.showWithFade(t.alias,e,i.props,i.priority);break;case "dissolve":await canvas.showWithDissolve(t.alias,e,i.props,i.priority);break;case "movein":case "moveout":await canvas.moveIn(t.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await canvas.zoomIn(t.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await canvas.pushIn(t.alias,e,i.props,i.priority);break}}function v(e){if(e.transition)switch(e.transition.type){case "fade":canvas.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":canvas.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":canvas.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":canvas.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":canvas.pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.canvas.remove(e.alias);}async function Oe(e){switch(e.operationType){case "show":if(e.transition){let t=new canvas.ImageSprite(e.props,e.url||e.alias);await w(t,e,e.transition);}else await canvas.showImage(e.alias,e.url,e.props);break;case "edit":{let t=canvas.canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`Image with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function Ae(e){switch(e.operationType){case "show":if(e.transition){let t=new canvas.VideoSprite(e.props,e.url||e.alias);await w(t,e,e.transition);}else await canvas.showVideo(e.alias,e.url,e.props);break;case "edit":{let t=canvas.canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`Video with alias ${e.alias} not found.`);break}case "remove":v(e);break;case "pause":case "resume":{let t=canvas.canvas.find(e.alias);t?t.paused=e.operationType==="pause":n.error(`Video with alias ${e.alias} not found.`);break}}}async function ke(e){switch(e.operationType){case "show":if(e.transition){let t=new canvas.ImageContainer(e.props,e.urls);await w(t,e,e.transition);}else await canvas.showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let t=canvas.canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function je(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.translator.t(e.text),e.transition){let t=new canvas.Text(e.props);await w(t,e,e.transition);}else canvas.showText(e.alias,e.text,e.props);break;case "edit":{let t=canvas.canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`Text with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function Le(e){switch(e.operationType){case "edit":try{let t=canvas.canvas.find(e.alias);t?e.props&&t.setMemory({...t.memory,...e.props}):n.error(`Canvas Element with alias ${e.alias} not found.`);}catch(t){n.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,t);}break;case "remove":v(e);break}}function Ie(e){e.operationType==="clear"&&canvas.canvas.removeAll();}async function Ee(e){e.type==="shake"&&await canvas.shakeEffect(e.alias,e.props,e.priority);}function Re(e){switch(e.type){case "animate":canvas.canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function Me(e){switch(e.type){case "input":narration.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.narration.dialogue=void 0;break}}function Fe(e){switch(e.operationType){case "play":e.url?sound.sound.play(e.alias,e.url,e.props):sound.sound.play(e.alias,e.props);break;case "stop":switch(e.type){case "sound":sound.sound.stop(e.alias);break;case "all":sound.sound.stopAll();break}break;case "pause":switch(e.type){case "sound":sound.sound.pause(e.alias);break;case "channel":sound.sound.findChannel(e.alias).pauseAll();break;case "all":sound.sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.sound.resume(e.alias);break;case "channel":sound.sound.findChannel(e.alias).resumeAll();break;case "all":sound.sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([t,i])=>{let a=sound.sound.find(e.alias);a&&(t==="volume"?a.volume.value=i:a.paused=i);});break}}var b="___param___";var h=class e{static init(t){t.loadAssets&&(e._loadAssets=t.loadAssets),t.soundOperation&&(e._soundOperation=t.soundOperation),t.imageOperation&&(e._imageOperation=t.imageOperation),t.videoOperation&&(e._videoOperation=t.videoOperation),t.imageContainerOperation&&(e._imageContainerOperation=t.imageContainerOperation),t.textOperation&&(e._textOperation=t.textOperation),t.canvasElementOperation&&(e._canvasElementOperation=t.canvasElementOperation),t.setStorageValue&&(e._setStorageValue=t.setStorageValue),t.setInitialStorageValue&&(e._setInitialStorageValue=t.setInitialStorageValue),t.narrationOperation&&(e._narrationOperation=t.narrationOperation),t.effectOperation&&(e._effectOperation=t.effectOperation),t.animateOperation&&(e._animateOperation=t.animateOperation),t.canvasOperation&&(e._canvasOperation=t.canvasOperation),t.getLogichValue&&(e._getLogichValue=t.getLogichValue),t.getConditionalStep&&(e._getConditionalStep=t.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return e._loadAssets}static _soundOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get soundOperation(){return e._soundOperation}static _imageOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageOperation(){return e._imageOperation}static _videoOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get videoOperation(){return e._videoOperation}static _imageContainerOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageContainerOperation(){return e._imageContainerOperation}static _textOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get textOperation(){return e._textOperation}static _canvasElementOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasElementOperation(){return e._canvasElementOperation}static _setStorageValue=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setStorageValue(){return e._setStorageValue}static _setInitialStorageValue=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setInitialStorageValue(){return e._setInitialStorageValue}static _narrationOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get narrationOperation(){return e._narrationOperation}static _effectOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get effectOperation(){return e._effectOperation}static _animateOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animateOperation(){return e._animateOperation}static _canvasOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasOperation(){return e._canvasOperation}static _getLogichValue=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getLogichValue(){return e._getLogichValue}static _getConditionalStep=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getConditionalStep(){return e._getConditionalStep}};function _(e,t){if(t&&typeof t=="object"&&typeof e.functionName=="string"&&e.functionName in t){let i=t[e.functionName];if(typeof i=="function"){let a=e.args.map(o=>h.getLogichValue(o,t));return i(...a)}else n.warn(`getLogichValue function ${e.functionName} not found in props`);}}function z(e,t){let i=core.JsonUnifier.getLogichValue(e,t);return i&&typeof i=="object"&&"type"in i?core.JsonUnifier.getLogichValue(i,t):i}function ui(e,t={}){let i=z(e.value,t);switch(e.storageType){case "flagStorage":storage.storage.setFlag(e.key,e.value);break;case "storage":storage.storage.set(e.key,i);break;case "tempstorage":storage.storage.setTempVariable(e.key,i);break;case "params":{let a=storage.storage.get(`${b}${narration.narration.openedLabels.length-1}`)||[];a.length>e.key&&(a[e.key]=i),storage.storage.setTempVariable(`${b}${narration.narration.openedLabels.length-1}`,a);break}}}function di(e,t={}){let i=z(e.value,t);switch(e.storageType){case "storage":case "tempstorage":storage.storage.default={[e.key]:i};break}}function k(e,t={}){let i=j(e,t);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case "value":return xe(i,t);case "arithmetic":case "arithmeticsingle":return me(i,t);case "compare":case "union":return ge(i,t);case "function":return _(i,t)}return i}function me(e,t){let i=core.JsonUnifier.getLogichValue(e.leftValue,t);switch(e.type){case "arithmetic":{let a=core.JsonUnifier.getLogichValue(e.rightValue,t);switch(e.operator){case "*":return i*a;case "/":return i/a;case "+":return typeof i=="string"||typeof a=="string"?`${i}${a}`:Array.isArray(i)&&Array.isArray(a)?[...i,...a]:Array.isArray(i)?[...i,a]:Array.isArray(a)?[i,...a]:i+a;case "-":if(Array.isArray(i)&&Array.isArray(a))return i.filter(o=>!a.includes(o));if(Array.isArray(i))return i.filter(o=>o!==a);if(Array.isArray(a)){n.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return i-a;case "%":return i%a;case "POW":return i**a;case "RANDOM":return narration.narration.getRandomNumber(i,a);case "INTERSECTION":if(Array.isArray(i)&&Array.isArray(a))return i.filter(o=>a.includes(o));n.warn("getValueFromArithmeticOperations cannot intersect non-array values");return;default:n.warn("getValueFromArithmeticOperations unknown operator",e);return}}case "arithmeticsingle":switch(e.operator){case "INT":return Number(i);case "FLOOR":return Math.floor(i);}break}}function xe(e,t){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.narration.inputValue:storage.storage.get(e.key);case "flagStorage":return storage.storage.getFlag(e.key);case "label":return narration.narration.getTimesLabelOpened(e.label);case "choice":return narration.narration.getTimesChoiceMade(e.index);case "logic":return core.JsonUnifier.getLogichValue(e.operation,t);case "params":{let i=storage.storage.get(`${b}${narration.narration.openedLabels.length-1}`)||[];if(i&&i.length>e.key)return i[e.key];n.warn("getValue params not found");return}}return e}function ge(e,t){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":{let i=core.JsonUnifier.getLogichValue(e.leftValue,t),a=core.JsonUnifier.getLogichValue(e.rightValue,t);switch(e.operator){case "==":return Array.isArray(i)&&Array.isArray(a)?i.length===a.length&&i.every(o=>a.includes(o)):i===a;case "!=":return Array.isArray(i)&&Array.isArray(a)?i.length!==a.length||!i.every(o=>a.includes(o)):i!==a;case "<":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)<0:Array.isArray(i)&&Array.isArray(a)?i.length<a.length:i<a;case "<=":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)<=0:Array.isArray(i)&&Array.isArray(a)?i.length<=a.length:i<=a;case ">":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)>0:Array.isArray(i)&&Array.isArray(a)?i.length>a.length:i>a;case ">=":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)>=0:Array.isArray(i)&&Array.isArray(a)?i.length>=a.length:i>=a;case "CONTAINS":return Array.isArray(i)&&Array.isArray(a)?a.every(o=>i.includes(o)):Array.isArray(i)?i.includes(a):i.toString().includes(a.toString())}break}case "value":{let i=core.JsonUnifier.getLogichValue(e,t);return Array.isArray(i)?i.length>0:i&&typeof i=="object"?Object.keys(i).length>0:!!i}case "union":return Ve(e,t)}return !!e}function Ve(e,t){if(e.unionType==="not"){let a=k(e.condition,t);return Array.isArray(a)?a.length===0:a&&typeof a=="object"?Object.keys(a).length===0:!a}let i=a=>core.JsonUnifier.getLogichValue(a,t)||false;return e.unionType==="and"?e.conditions.every(i):e.conditions.some(i)}function fe(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function j(e,t={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return ye(e,t);case "ifelse":return core.JsonUnifier.getLogichValue(e.condition,t)?core.JsonUnifier.getLogichValue(e.then,t):core.JsonUnifier.getLogichValue(e.else,t);case "stepswitch":{let i=core.JsonUnifier.getLogichValue(e.elements,t)||[];if(i.length===0){n.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let a=fe(0,i.length-1);return core.JsonUnifier.getLogichValue(i[a],t)}case "loop":{let a=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return a>i.length-1?(a=a%i.length,core.JsonUnifier.getLogichValue(i[a],t)):core.JsonUnifier.getLogichValue(i[a],t)}case "sequential":{let a,o=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(a=core.JsonUnifier.getLogichValue(i[i.length-1],t)),o>i.length-1?a:core.JsonUnifier.getLogichValue(i[o],t)}case "sequentialrandom":{let a=narration.NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(a===void 0&&e.end==="lastItem"){let o=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!o?.usedRandomNumbers){n.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let r=o.usedRandomNumbers[`0-${i.length-1}`];return core.JsonUnifier.getLogichValue(i[r[r.length-1]],t)}if(a===void 0){n.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return core.JsonUnifier.getLogichValue(i[a],t)}}}}return e}function M(e,t={}){if(e.conditionalStep){let i=pixiVn.createExportableElement(core.JsonUnifier.getLogichValue(e.conditionalStep,t));if(i?.glueEnabled===void 0&&delete i?.glueEnabled,i?.goNextStep===void 0&&delete i?.goNextStep,i?.end===void 0&&delete i?.end,i?.choices===void 0&&delete i?.choices,i?.dialogue===void 0&&delete i?.dialogue,i?.labelToOpen===void 0&&delete i?.labelToOpen,i?.operations===void 0&&delete i?.operations,i){let a={...e,conditionalStep:void 0,...i};return M(a,t)}else narration.narration.dialogGlue&&(narration.narration.dialogGlue=false);}return e}function ye(e,t){let i=e.firstItem,a=(e.secondConditionalItem??[]).flatMap(r=>Array.isArray(r)?r.map(l=>core.JsonUnifier.getLogichValue(l,t)):[core.JsonUnifier.getLogichValue(r,t)]),o=i?[i,...a]:a;if(o.length===0){n.warn("combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return translator.translator.t(o);if(typeof o[0]=="object"){let r=o,l,P=false,N=r.map((c,f)=>{c=M(c,t);let u=core.JsonUnifier.getLogichValue(c.dialogue,t)||"";return f===0?(l=core.JsonUnifier.getLogichValue(c.glueEnabled,t)||false,u):(typeof u=="object"&&"text"in u&&(u=`${u.character}: ${u.text}`),l===false&&P&&(u=`
1
+ 'use strict';var core=require('@drincs/pixi-vn-json/core'),canvas=require('@drincs/pixi-vn/canvas'),translator=require('@drincs/pixi-vn-json/translator'),narration=require('@drincs/pixi-vn/narration'),sound=require('@drincs/pixi-vn/sound'),pixiVn=require('@drincs/pixi-vn'),storage=require('@drincs/pixi-vn/storage');async function je(e){let n=core.JsonUnifier.getLogichValue(e,{});if(n)switch(n.type){case "assets":switch(n.operationType){case "load":await canvas.Assets.load(n.aliases);break;case "lazyload":canvas.Assets.backgroundLoad(n.aliases);break}break;case "bundle":switch(n.operationType){case "load":await canvas.Assets.loadBundle(n.aliases);break;case "lazyload":canvas.Assets.backgroundLoadBundle(n.aliases);break}break}}var a;(o=>(o.log=(r,...p)=>console.log(`[Pixi\u2019VN Json] ${r}`,...p),o.warn=(r,...p)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...p),o.error=(r,...p)=>console.error(`[Pixi\u2019VN Json] ${r}`,...p),o.info=(r,...p)=>console.info(`[Pixi\u2019VN Json] ${r}`,...p)))(a||={});async function J(e,n,t){switch(t.type){case "fade":await canvas.showWithFade(n.alias,e,t.props,t.priority);break;case "dissolve":await canvas.showWithDissolve(n.alias,e,t.props,t.priority);break;case "movein":case "moveout":await canvas.moveIn(n.alias,e,t.props,t.priority);break;case "zoomin":case "zoomout":await canvas.zoomIn(n.alias,e,t.props,t.priority);break;case "pushin":case "pushout":await canvas.pushIn(n.alias,e,t.props,t.priority);break}}function v(e){if(e.transition)switch(e.transition.type){case "fade":canvas.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":canvas.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":canvas.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":canvas.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":canvas.pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.canvas.remove(e.alias);}async function Re(e){switch(e.operationType){case "show":if(e.transition){let n=new canvas.ImageSprite(e.props,e.url||e.alias);await J(n,e,e.transition);}else await canvas.showImage(e.alias,e.url,e.props);break;case "edit":{let n=canvas.canvas.find(e.alias);n?e.props&&await n.setMemory({...n.memory,...e.props}):a.error(`Image with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function ze(e){switch(e.operationType){case "show":if(e.transition){let n=new canvas.VideoSprite(e.props,e.url||e.alias);await J(n,e,e.transition);}else await canvas.showVideo(e.alias,e.url,e.props);break;case "edit":{let n=canvas.canvas.find(e.alias);n?e.props&&await n.setMemory({...n.memory,...e.props}):a.error(`Video with alias ${e.alias} not found.`);break}case "remove":v(e);break;case "pause":case "resume":{let n=canvas.canvas.find(e.alias);n?n.paused=e.operationType==="pause":a.error(`Video with alias ${e.alias} not found.`);break}}}async function De(e){switch(e.operationType){case "show":if(e.transition){let n=new canvas.ImageContainer(e.props,e.urls);await J(n,e,e.transition);}else await canvas.showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let n=canvas.canvas.find(e.alias);n?e.props&&await n.setMemory({...n.memory,...e.props}):a.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function _e(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.translator.t(e.text),e.transition){let n=new canvas.Text(e.props);await J(n,e,e.transition);}else canvas.showText(e.alias,e.text,e.props);break;case "edit":{let n=canvas.canvas.find(e.alias);n?e.props&&await n.setMemory({...n.memory,...e.props}):a.error(`Text with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function Me(e){switch(e.operationType){case "edit":try{let n=canvas.canvas.find(e.alias);n?e.props&&n.setMemory({...n.memory,...e.props}):a.error(`Canvas Element with alias ${e.alias} not found.`);}catch(n){a.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,n);}break;case "remove":v(e);break}}function Ge(e){e.operationType==="clear"&&canvas.canvas.removeAll();}async function $e(e){e.type==="shake"&&await canvas.shakeEffect(e.alias,e.props,e.priority);}function Fe(e){switch(e.type){case "animate":canvas.canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}var ue={type:"object",properties:{isRenderGroup:{type:"boolean"},blendMode:{enum:["inherit","normal","add","multiply","screen","darken","lighten","erase","color-dodge","color-burn","linear-burn","linear-dodge","linear-light","hard-light","soft-light","pin-light","difference","exclusion","overlay","saturation","color","luminosity","normal-npm","add-npm","screen-npm","none","subtract","divide","vivid-light","hard-mix","negation","min","max"]},tint:{anyOf:[{type:"string"},{type:"number"},{type:"object"},{type:"object"},{type:"object"},{type:"object"},{type:"object"},{allOf:[{type:"object"},{type:"object"}]},{type:"object"},{allOf:[{type:"object"},{type:"object"}]},{type:"object"},{allOf:[{type:"object"},{type:"object"}]},{type:"object"}]},alpha:{type:"number"},angle:{type:"number"},children:{type:"object"},parent:{type:"object"},renderable:{type:"boolean"},rotation:{type:"number"},scale:{type:["number","object"]},pivot:{type:["number","object"]},origin:{type:["number","object"]},position:{type:"object"},skew:{type:"object"},visible:{type:"boolean"},x:{type:"number"},y:{type:"number"},boundsArea:{type:"object"},accessible:{type:"boolean"},accessibleTitle:{type:"string"},accessibleHint:{type:"string"},tabIndex:{type:"number"},accessibleType:{enum:["object","label","a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]},accessiblePointerEvents:{enum:["inherit","none","auto","visiblePainted","visibleFill","visibleStroke","visible","painted","fill","stroke","all"]},accessibleText:{type:"string"},accessibleChildren:{type:"boolean"},cullArea:{type:"object"},cullable:{type:"boolean"},cullableChildren:{type:"boolean"},cursor:{anyOf:[{const:"none"},{const:"progress"},{const:"auto"},{const:"default"},{const:"context-menu"},{const:"help"},{const:"pointer"},{const:"wait"},{const:"cell"},{const:"crosshair"},{const:"text"},{const:"vertical-text"},{const:"alias"},{const:"copy"},{const:"move"},{const:"no-drop"},{const:"not-allowed"},{const:"e-resize"},{const:"n-resize"},{const:"ne-resize"},{const:"nw-resize"},{const:"s-resize"},{const:"se-resize"},{const:"sw-resize"},{const:"w-resize"},{const:"ns-resize"},{const:"ew-resize"},{const:"nesw-resize"},{const:"col-resize"},{const:"nwse-resize"},{const:"row-resize"},{const:"all-scroll"},{const:"zoom-in"},{const:"zoom-out"},{const:"grab"},{const:"grabbing"},{allOf:[{type:"string"},{type:"object"}]}]},eventMode:{enum:["none","auto","passive","static","dynamic"]},interactive:{type:"boolean"},interactiveChildren:{type:"boolean"},hitArea:{type:"object"},width:{type:"number"},height:{type:"number"},mask:{type:["number","object"]},filters:{type:"object"},label:{type:"string"},zIndex:{type:"number"},sortDirty:{type:"boolean"},sortableChildren:{type:"boolean"},pixivnId:{type:"string"},index:{type:"number"},parentLabel:{type:"string"},onEvents:{type:"object"},align:{type:["number","object"]},xAlign:{type:"number"},yAlign:{type:"number"},percentagePosition:{type:["number","object"]},percentageX:{type:"number"},percentageY:{type:"number"}},required:["pixivnId"],additionalProperties:false};var me={dissolve:{type:"object",properties:{forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},fade:{type:"object",properties:{forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},movein:{type:"object",properties:{direction:{enum:["left","right","up","down"]},forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},zoomin:{type:"object",properties:{direction:{enum:["left","right","up","down"]},forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},pushin:{type:"object",properties:{direction:{enum:["left","right","up","down"]},forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false}};var Ye=["dissolve","fade","movein","zoomin","pushin"];async function Ke(e,n,t,i){switch(t){case "dissolve":return canvas.showWithDissolve(e,n,i);case "fade":return canvas.showWithFade(e,n,i);case "movein":return canvas.moveIn(e,n,i);case "zoomin":return canvas.zoomIn(e,n,i);case "pushin":return canvas.pushIn(e,n,i)}}function tt(e){switch(e.type){case "input":narration.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.narration.dialogue=void 0;break}}function at(e){switch(e.operationType){case "play":e.url?sound.sound.play(e.alias,e.url,e.props):sound.sound.play(e.alias,e.props);break;case "stop":switch(e.type){case "sound":sound.sound.stop(e.alias);break;case "all":sound.sound.stopAll();break}break;case "pause":switch(e.type){case "sound":sound.sound.pause(e.alias);break;case "channel":sound.sound.findChannel(e.alias).pauseAll();break;case "all":sound.sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.sound.resume(e.alias);break;case "channel":sound.sound.findChannel(e.alias).resumeAll();break;case "all":sound.sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([n,t])=>{let i=sound.sound.find(e.alias);i&&(n==="volume"?i.volume.value=t:i.paused=t);});break}}var w="___param___";var h=class e{static init(n){n.loadAssets&&(e._loadAssets=n.loadAssets),n.soundOperation&&(e._soundOperation=n.soundOperation),n.imageOperation&&(e._imageOperation=n.imageOperation),n.videoOperation&&(e._videoOperation=n.videoOperation),n.imageContainerOperation&&(e._imageContainerOperation=n.imageContainerOperation),n.textOperation&&(e._textOperation=n.textOperation),n.canvasElementOperation&&(e._canvasElementOperation=n.canvasElementOperation),n.setStorageValue&&(e._setStorageValue=n.setStorageValue),n.setInitialStorageValue&&(e._setInitialStorageValue=n.setInitialStorageValue),n.narrationOperation&&(e._narrationOperation=n.narrationOperation),n.effectOperation&&(e._effectOperation=n.effectOperation),n.animateOperation&&(e._animateOperation=n.animateOperation),n.canvasOperation&&(e._canvasOperation=n.canvasOperation),n.getLogichValue&&(e._getLogichValue=n.getLogichValue),n.getConditionalStep&&(e._getConditionalStep=n.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return e._loadAssets}static _soundOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get soundOperation(){return e._soundOperation}static _imageOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageOperation(){return e._imageOperation}static _videoOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get videoOperation(){return e._videoOperation}static _imageContainerOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageContainerOperation(){return e._imageContainerOperation}static _textOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get textOperation(){return e._textOperation}static _canvasElementOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasElementOperation(){return e._canvasElementOperation}static _setStorageValue=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setStorageValue(){return e._setStorageValue}static _setInitialStorageValue=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setInitialStorageValue(){return e._setInitialStorageValue}static _narrationOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get narrationOperation(){return e._narrationOperation}static _effectOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get effectOperation(){return e._effectOperation}static _animateOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animateOperation(){return e._animateOperation}static _canvasOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasOperation(){return e._canvasOperation}static _getLogichValue=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getLogichValue(){return e._getLogichValue}static _getConditionalStep=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new pixiVn.PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getConditionalStep(){return e._getConditionalStep}};function z(e,n){if(n&&typeof n=="object"&&typeof e.functionName=="string"&&e.functionName in n){let t=n[e.functionName];if(typeof t=="function"){let i=e.args.map(o=>h.getLogichValue(o,n));return t(...i)}else a.warn(`getLogichValue function ${e.functionName} not found in props`);}}function D(e,n){let t=core.JsonUnifier.getLogichValue(e,n);return t&&typeof t=="object"&&"type"in t?core.JsonUnifier.getLogichValue(t,n):t}function wt(e,n={}){let t=D(e.value,n);switch(e.storageType){case "flagStorage":storage.storage.setFlag(e.key,e.value);break;case "storage":storage.storage.set(e.key,t);break;case "tempstorage":storage.storage.setTempVariable(e.key,t);break;case "params":{let i=storage.storage.get(`${w}${narration.narration.openedLabels.length-1}`)||[];i.length>e.key&&(i[e.key]=t),storage.storage.setTempVariable(`${w}${narration.narration.openedLabels.length-1}`,i);break}}}function St(e,n={}){let t=D(e.value,n);switch(e.storageType){case "storage":case "tempstorage":storage.storage.default={[e.key]:t};break}}function A(e,n={}){let t=k(e,n);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "value":return Pe(t,n);case "arithmetic":case "arithmeticsingle":return Ve(t,n);case "compare":case "union":return ve(t,n);case "function":return z(t,n)}return t}function Ve(e,n){let t=core.JsonUnifier.getLogichValue(e.leftValue,n);switch(e.type){case "arithmetic":{let i=core.JsonUnifier.getLogichValue(e.rightValue,n);switch(e.operator){case "*":return t*i;case "/":return t/i;case "+":return typeof t=="string"||typeof i=="string"?`${t}${i}`:Array.isArray(t)&&Array.isArray(i)?[...t,...i]:Array.isArray(t)?[...t,i]:Array.isArray(i)?[t,...i]:t+i;case "-":if(Array.isArray(t)&&Array.isArray(i))return t.filter(o=>!i.includes(o));if(Array.isArray(t))return t.filter(o=>o!==i);if(Array.isArray(i)){a.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return t-i;case "%":return t%i;case "POW":return t**i;case "RANDOM":return narration.narration.getRandomNumber(t,i);case "INTERSECTION":if(Array.isArray(t)&&Array.isArray(i))return t.filter(o=>i.includes(o));a.warn("getValueFromArithmeticOperations cannot intersect non-array values");return;default:a.warn("getValueFromArithmeticOperations unknown operator",e);return}}case "arithmeticsingle":switch(e.operator){case "INT":return Number(t);case "FLOOR":return Math.floor(t);}break}}function Pe(e,n){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.narration.inputValue:storage.storage.get(e.key);case "flagStorage":return storage.storage.getFlag(e.key);case "label":return narration.narration.getTimesLabelOpened(e.label);case "choice":return narration.narration.getTimesChoiceMade(e.index);case "logic":return core.JsonUnifier.getLogichValue(e.operation,n);case "params":{let t=storage.storage.get(`${w}${narration.narration.openedLabels.length-1}`)||[];if(t&&t.length>e.key)return t[e.key];a.warn("getValue params not found");return}}return e}function ve(e,n){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":{let t=core.JsonUnifier.getLogichValue(e.leftValue,n),i=core.JsonUnifier.getLogichValue(e.rightValue,n);switch(e.operator){case "==":return Array.isArray(t)&&Array.isArray(i)?t.length===i.length&&t.every(o=>i.includes(o)):t===i;case "!=":return Array.isArray(t)&&Array.isArray(i)?t.length!==i.length||!t.every(o=>i.includes(o)):t!==i;case "<":return typeof t=="string"&&typeof i=="string"?t.localeCompare(i)<0:Array.isArray(t)&&Array.isArray(i)?t.length<i.length:t<i;case "<=":return typeof t=="string"&&typeof i=="string"?t.localeCompare(i)<=0:Array.isArray(t)&&Array.isArray(i)?t.length<=i.length:t<=i;case ">":return typeof t=="string"&&typeof i=="string"?t.localeCompare(i)>0:Array.isArray(t)&&Array.isArray(i)?t.length>i.length:t>i;case ">=":return typeof t=="string"&&typeof i=="string"?t.localeCompare(i)>=0:Array.isArray(t)&&Array.isArray(i)?t.length>=i.length:t>=i;case "CONTAINS":return Array.isArray(t)&&Array.isArray(i)?i.every(o=>t.includes(o)):Array.isArray(t)?t.includes(i):t.toString().includes(i.toString())}break}case "value":{let t=core.JsonUnifier.getLogichValue(e,n);return Array.isArray(t)?t.length>0:t&&typeof t=="object"?Object.keys(t).length>0:!!t}case "union":return Ne(e,n)}return !!e}function Ne(e,n){if(e.unionType==="not"){let i=A(e.condition,n);return Array.isArray(i)?i.length===0:i&&typeof i=="object"?Object.keys(i).length===0:!i}let t=i=>core.JsonUnifier.getLogichValue(i,n)||false;return e.unionType==="and"?e.conditions.every(t):e.conditions.some(t)}function Te(e,n){return Math.floor(Math.random()*(n-e+1)+e)}function k(e,n={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Je(e,n);case "ifelse":return core.JsonUnifier.getLogichValue(e.condition,n)?core.JsonUnifier.getLogichValue(e.then,n):core.JsonUnifier.getLogichValue(e.else,n);case "stepswitch":{let t=core.JsonUnifier.getLogichValue(e.elements,n)||[];if(t.length===0){a.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let i=Te(0,t.length-1);return core.JsonUnifier.getLogichValue(t[i],n)}case "loop":{let i=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return i>t.length-1?(i=i%t.length,core.JsonUnifier.getLogichValue(t[i],n)):core.JsonUnifier.getLogichValue(t[i],n)}case "sequential":{let i,o=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(i=core.JsonUnifier.getLogichValue(t[t.length-1],n)),o>t.length-1?i:core.JsonUnifier.getLogichValue(t[o],n)}case "sequentialrandom":{let i=narration.NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:e.nestedId,onceOnly:true});if(i===void 0&&e.end==="lastItem"){let o=narration.NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!o?.usedRandomNumbers){a.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let r=o.usedRandomNumbers[`0-${t.length-1}`];return core.JsonUnifier.getLogichValue(t[r[r.length-1]],n)}if(i===void 0){a.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return core.JsonUnifier.getLogichValue(t[i],n)}}}}return e}function _(e,n={}){if(e.conditionalStep){let t=pixiVn.createExportableElement(core.JsonUnifier.getLogichValue(e.conditionalStep,n));if(t?.glueEnabled===void 0&&delete t?.glueEnabled,t?.goNextStep===void 0&&delete t?.goNextStep,t?.end===void 0&&delete t?.end,t?.choices===void 0&&delete t?.choices,t?.dialogue===void 0&&delete t?.dialogue,t?.labelToOpen===void 0&&delete t?.labelToOpen,t?.operations===void 0&&delete t?.operations,t){let i={...e,conditionalStep:void 0,...t};return _(i,n)}else narration.narration.dialogGlue&&(narration.narration.dialogGlue=false);}return e}function Je(e,n){let t=e.firstItem,i=(e.secondConditionalItem??[]).flatMap(r=>Array.isArray(r)?r.map(p=>core.JsonUnifier.getLogichValue(p,n)):[core.JsonUnifier.getLogichValue(r,n)]),o=t?[t,...i]:i;if(o.length===0){a.warn("combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return translator.translator.t(o);if(typeof o[0]=="object"){let r=o,p,V=false,P=r.map((c,f)=>{c=_(c,n);let l=core.JsonUnifier.getLogichValue(c.dialogue,n)||"";return f===0?(p=core.JsonUnifier.getLogichValue(c.glueEnabled,n)||false,l):(typeof l=="object"&&"text"in l&&(l=`${l.character}: ${l.text}`),p===false&&V&&(l=`
2
2
 
3
- ${u}`),u&&(P=true),l=core.JsonUnifier.getLogichValue(c.glueEnabled,t)||false,u)}),V=core.JsonUnifier.getLogichValue(N[0],t),y=typeof V=="object"&&"character"in V?V.character:void 0,J=N.flatMap(c=>{let f;c&&typeof c=="object"&&"text"in c?f=c.text:f=c;let u;return Array.isArray(f)?u=f.map(F=>{let D=core.JsonUnifier.getLogichValue(F,t);return translator.translator.t(`${D}`)}):u=core.JsonUnifier.getLogichValue(f,t)||"",translator.translator.t(u)}),C=r.find(c=>c.end),G=r.find(c=>c.choices),L=false,I=false;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&(narration.narration.dialogGlue=true),L=r[r.length-1].glueEnabled,I=r.reverse().find(c=>!(c.operations&&(!c.dialogue||!c.choices)))?.goNextStep);let $=r.find(c=>c.labelToOpen),O=[];return r.forEach(c=>{c.operations&&(O=[...O,...c.operations]);}),{dialogue:y?{character:y,text:J}:J,end:C?.end,choices:G?.choices,glueEnabled:L,goNextStep:I,labelToOpen:$?.labelToOpen,operations:O}}}exports.VariableGetter=void 0;(o=>{let e=new Set;function t(r){e.add(r);}o.add=t;function i(){e.clear();}o.clear=i;function a(r,l={}){let P=y=>k(y,l)??void 0,N=j(r,l);if(e.size===0)return P(N);let V=P;for(let y of e){let J=V;V=C=>y(C,J)??void 0;}return V(N)}o.getLogichValue=a;})(exports.VariableGetter||={});exports.animateOperation=Re;exports.canvasElementOperation=Le;exports.canvasOperation=Ie;exports.effectOperation=Ee;exports.getConditionalStep=M;exports.getLogichValue=k;exports.getValueFromConditionalStatements=j;exports.imageContainerOperation=ke;exports.imageOperation=Oe;exports.loadAssets=Je;exports.narrationOperation=Me;exports.setInitialStorageValue=di;exports.setStorageValue=ui;exports.soundOperation=Fe;exports.textOperation=je;exports.videoOperation=Ae;
3
+ ${l}`),l&&(V=true),p=core.JsonUnifier.getLogichValue(c.glueEnabled,n)||false,l)}),g=core.JsonUnifier.getLogichValue(P[0],n),x=typeof g=="object"&&"character"in g?g.character:void 0,N=P.flatMap(c=>{let f;c&&typeof c=="object"&&"text"in c?f=c.text:f=c;let l;return Array.isArray(f)?l=f.map($=>{let F=core.JsonUnifier.getLogichValue($,n);return translator.translator.t(`${F}`)}):l=core.JsonUnifier.getLogichValue(f,n)||"",translator.translator.t(l)}),O=r.find(c=>c.end),M=r.find(c=>c.choices),I=false,E=false;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&(narration.narration.dialogGlue=true),I=r[r.length-1].glueEnabled,E=r.reverse().find(c=>!(c.operations&&(!c.dialogue||!c.choices)))?.goNextStep);let G=r.find(c=>c.labelToOpen),C=[];return r.forEach(c=>{c.operations&&(C=[...C,...c.operations]);}),{dialogue:x?{character:x,text:N}:N,end:O?.end,choices:M?.choices,glueEnabled:I,goNextStep:E,labelToOpen:G?.labelToOpen,operations:C}}}exports.VariableGetter=void 0;(o=>{let e=new Set;function n(r){e.add(r);}o.add=n;function t(){e.clear();}o.clear=t;function i(r,p={}){let V=x=>A(x,p)??void 0,P=k(r,p);if(e.size===0)return V(P);let g=V;for(let x of e){let N=g;g=O=>x(O,N)??void 0;}return g(P)}o.getLogichValue=i;})(exports.VariableGetter||={});exports.ENTRANCE_TRANSITION_TYPES=Ye;exports.animateOperation=Fe;exports.canvasElementOperation=Me;exports.canvasOperation=Ge;exports.containerMemorySchema=ue;exports.effectOperation=$e;exports.entranceTransitionKeySchemas=me;exports.executeEntranceTransition=Ke;exports.getConditionalStep=_;exports.getLogichValue=A;exports.getValueFromConditionalStatements=k;exports.imageContainerOperation=De;exports.imageOperation=Re;exports.loadAssets=je;exports.narrationOperation=tt;exports.setInitialStorageValue=St;exports.setStorageValue=wt;exports.soundOperation=at;exports.textOperation=_e;exports.videoOperation=ze;
@@ -1,6 +1,6 @@
1
1
  import { P as PixiVNJsonIfElse, c as PixiVNJsonValueGet, d as PixiVNJsonArithmeticOperations, e as PixiVNJsonConditions, m as PixiVNJsonFunction, f as PixiVNJsonConditionalStatements, l as PixiVNJsonConditionalResultToCombine, b as PixiVNJsonOnlyStorageSet, a as PixiVNJsonValueSet } from './PixiVNJsonIfElse-B_OG8Qs1.cjs';
2
2
  import { P as PixiVNJsonOperation, a as PixiVNJsonOperationString, o as PixiVNJsonCanvasAnimate, l as PixiVNJsonUnknownEdit, e as PixiVNJsonCanvasRemove, p as PixiVNJsonCanvasClear, n as PixiVNJsonCanvasEffect, h as PixiVNJsonCanvasImageContainerShow, i as PixiVNJsonImageContainerEdit, c as PixiVNJsonCanvasImageVideoShow, d as PixiVNJsonImageEdit, j as PixiVNJsonCanvasTextShow, k as PixiVNJsonTextEdit, f as PixiVNJsonVideoEdit, g as PixiVNJsonVideoPauseResume, m as PixiVNJsonNarration, b as PixiVNJsonSound, q as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-D-FkTLeR.cjs';
3
- import { ImageSpriteMemory, VideoSpriteMemory, ContainerMemory, ContainerChild } from '@drincs/pixi-vn/canvas';
3
+ import { ImageSpriteMemory, VideoSpriteMemory, ContainerMemory, ContainerChild, CanvasBaseInterface } from '@drincs/pixi-vn/canvas';
4
4
  import { StepLabelPropsType } from '@drincs/pixi-vn/narration';
5
5
  import { StorageElementType } from '@drincs/pixi-vn/storage';
6
6
  export { V as VariableGetter, a as VariableGetterHandler } from './VariableGetter-ZDA6kdah.cjs';
@@ -68,6 +68,62 @@ declare function effectOperation(operation: PixiVNJsonCanvasEffect): Promise<voi
68
68
  */
69
69
  declare function animateOperation(operation: PixiVNJsonCanvasAnimate): void;
70
70
 
71
+ /**
72
+ * GENERATED FILE — do not edit by hand.
73
+ * Produced by `scripts/generate-container-memory-schema.mjs` from `@drincs/pixi-vn`'s own
74
+ * `ContainerMemory` type. Re-run that script (see its header comment) to refresh this file after
75
+ * that type changes.
76
+ */
77
+ /**
78
+ * JSON Schema (usable as `@drincs/pixi-vn-ink`'s `HashtagHandlerOptions.keySchemas` values, or
79
+ * with any other JSON Schema validator) for `ContainerMemory`, excluding its own `elements` (the
80
+ * container's child canvas elements — a self-referential list, not a flat property).
81
+ */
82
+ declare const containerMemorySchema: object;
83
+
84
+ /**
85
+ * GENERATED FILE — do not edit by hand.
86
+ * Produced by `scripts/generate-entrance-transition-schemas.mjs` from
87
+ * `@drincs/pixi-vn`'s own transition prop types. Re-run that script (see its header comment) to
88
+ * refresh this file after those types change.
89
+ */
90
+ /**
91
+ * JSON Schemas (usable as `@drincs/pixi-vn-ink`'s `HashtagHandlerOptions.keySchemas` values, or
92
+ * with any other JSON Schema validator) for each entrance transition's own props, keyed by
93
+ * transition name.
94
+ */
95
+ declare const entranceTransitionKeySchemas: Record<string, object>;
96
+
97
+ /**
98
+ * The transition types used to bring a canvas element **in** (as opposed to
99
+ * `moveout`/`zoomout`/`pushout`, used only to remove one). `dissolve`/`fade` have no direction —
100
+ * they're shared with removal — but are still "entrance" transitions in the sense that
101
+ * {@link entranceTransitionKeySchemas} validates them the same way for a `show`-style command.
102
+ */
103
+ declare const ENTRANCE_TRANSITION_TYPES: readonly ["dissolve", "fade", "movein", "zoomin", "pushin"];
104
+ /**
105
+ * One of {@link ENTRANCE_TRANSITION_TYPES}.
106
+ */
107
+ type EntranceTransitionType = (typeof ENTRANCE_TRANSITION_TYPES)[number];
108
+ /**
109
+ * Runs an entrance transition on a canvas element — the same dispatch this package's own
110
+ * interpreter uses internally (see `@/actions/canvas`) for the built-in
111
+ * `image`/`video`/`text`/`imagecontainer` `show` operations (`showWithDissolve`, `showWithFade`,
112
+ * `moveIn`, `zoomIn`, `pushIn`), exposed here so a third-party canvas-component library (e.g.
113
+ * `pixi-vn-spine`) can reuse it for its own custom operation/command instead of re-implementing
114
+ * the type → function mapping.
115
+ *
116
+ * @param alias The unique alias the element is (or will be) registered under on the canvas.
117
+ * @param component The canvas element to show (e.g. a `Spine` instance already built by the
118
+ * caller). Matches the `component` parameter of `@drincs/pixi-vn`'s own `showWithDissolve`/
119
+ * `moveIn`/etc.
120
+ * @param transitionType Which entrance transition to run (e.g. `"dissolve"`).
121
+ * @param props The transition's own props (e.g. `{ duration: 2 }`), typically validated against
122
+ * {@link entranceTransitionKeySchemas} beforehand.
123
+ * @returns The ids of the tickers used by the transition, once it starts.
124
+ */
125
+ declare function executeEntranceTransition(alias: string, component: CanvasBaseInterface<any> | undefined, transitionType: EntranceTransitionType, props?: object): Promise<string[] | undefined>;
126
+
71
127
  /**
72
128
  * Handles narration-related operations such as requesting player input or
73
129
  * clearing the current dialogue line.
@@ -132,4 +188,4 @@ declare function getValueFromConditionalStatements<T>(statement: PixiVNJsonCondi
132
188
  */
133
189
  declare function getConditionalStep(originalStep: PixiVNJsonLabelStep, props?: StepLabelPropsType): PixiVNJsonLabelStep;
134
190
 
135
- export { animateOperation, canvasElementOperation, canvasOperation, effectOperation, getConditionalStep, getLogichValue, getValueFromConditionalStatements, imageContainerOperation, imageOperation, loadAssets, narrationOperation, setInitialStorageValue, setStorageValue, soundOperation, textOperation, videoOperation };
191
+ export { ENTRANCE_TRANSITION_TYPES, type EntranceTransitionType, animateOperation, canvasElementOperation, canvasOperation, containerMemorySchema, effectOperation, entranceTransitionKeySchemas, executeEntranceTransition, getConditionalStep, getLogichValue, getValueFromConditionalStatements, imageContainerOperation, imageOperation, loadAssets, narrationOperation, setInitialStorageValue, setStorageValue, soundOperation, textOperation, videoOperation };
package/dist/actions.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { P as PixiVNJsonIfElse, c as PixiVNJsonValueGet, d as PixiVNJsonArithmeticOperations, e as PixiVNJsonConditions, m as PixiVNJsonFunction, f as PixiVNJsonConditionalStatements, l as PixiVNJsonConditionalResultToCombine, b as PixiVNJsonOnlyStorageSet, a as PixiVNJsonValueSet } from './PixiVNJsonIfElse-B_OG8Qs1.js';
2
2
  import { P as PixiVNJsonOperation, a as PixiVNJsonOperationString, o as PixiVNJsonCanvasAnimate, l as PixiVNJsonUnknownEdit, e as PixiVNJsonCanvasRemove, p as PixiVNJsonCanvasClear, n as PixiVNJsonCanvasEffect, h as PixiVNJsonCanvasImageContainerShow, i as PixiVNJsonImageContainerEdit, c as PixiVNJsonCanvasImageVideoShow, d as PixiVNJsonImageEdit, j as PixiVNJsonCanvasTextShow, k as PixiVNJsonTextEdit, f as PixiVNJsonVideoEdit, g as PixiVNJsonVideoPauseResume, m as PixiVNJsonNarration, b as PixiVNJsonSound, q as PixiVNJsonLabelStep } from './PixiVNJsonLabelStep-CELQY8TP.js';
3
- import { ImageSpriteMemory, VideoSpriteMemory, ContainerMemory, ContainerChild } from '@drincs/pixi-vn/canvas';
3
+ import { ImageSpriteMemory, VideoSpriteMemory, ContainerMemory, ContainerChild, CanvasBaseInterface } from '@drincs/pixi-vn/canvas';
4
4
  import { StepLabelPropsType } from '@drincs/pixi-vn/narration';
5
5
  import { StorageElementType } from '@drincs/pixi-vn/storage';
6
6
  export { V as VariableGetter, a as VariableGetterHandler } from './VariableGetter-ZDA6kdah.js';
@@ -68,6 +68,62 @@ declare function effectOperation(operation: PixiVNJsonCanvasEffect): Promise<voi
68
68
  */
69
69
  declare function animateOperation(operation: PixiVNJsonCanvasAnimate): void;
70
70
 
71
+ /**
72
+ * GENERATED FILE — do not edit by hand.
73
+ * Produced by `scripts/generate-container-memory-schema.mjs` from `@drincs/pixi-vn`'s own
74
+ * `ContainerMemory` type. Re-run that script (see its header comment) to refresh this file after
75
+ * that type changes.
76
+ */
77
+ /**
78
+ * JSON Schema (usable as `@drincs/pixi-vn-ink`'s `HashtagHandlerOptions.keySchemas` values, or
79
+ * with any other JSON Schema validator) for `ContainerMemory`, excluding its own `elements` (the
80
+ * container's child canvas elements — a self-referential list, not a flat property).
81
+ */
82
+ declare const containerMemorySchema: object;
83
+
84
+ /**
85
+ * GENERATED FILE — do not edit by hand.
86
+ * Produced by `scripts/generate-entrance-transition-schemas.mjs` from
87
+ * `@drincs/pixi-vn`'s own transition prop types. Re-run that script (see its header comment) to
88
+ * refresh this file after those types change.
89
+ */
90
+ /**
91
+ * JSON Schemas (usable as `@drincs/pixi-vn-ink`'s `HashtagHandlerOptions.keySchemas` values, or
92
+ * with any other JSON Schema validator) for each entrance transition's own props, keyed by
93
+ * transition name.
94
+ */
95
+ declare const entranceTransitionKeySchemas: Record<string, object>;
96
+
97
+ /**
98
+ * The transition types used to bring a canvas element **in** (as opposed to
99
+ * `moveout`/`zoomout`/`pushout`, used only to remove one). `dissolve`/`fade` have no direction —
100
+ * they're shared with removal — but are still "entrance" transitions in the sense that
101
+ * {@link entranceTransitionKeySchemas} validates them the same way for a `show`-style command.
102
+ */
103
+ declare const ENTRANCE_TRANSITION_TYPES: readonly ["dissolve", "fade", "movein", "zoomin", "pushin"];
104
+ /**
105
+ * One of {@link ENTRANCE_TRANSITION_TYPES}.
106
+ */
107
+ type EntranceTransitionType = (typeof ENTRANCE_TRANSITION_TYPES)[number];
108
+ /**
109
+ * Runs an entrance transition on a canvas element — the same dispatch this package's own
110
+ * interpreter uses internally (see `@/actions/canvas`) for the built-in
111
+ * `image`/`video`/`text`/`imagecontainer` `show` operations (`showWithDissolve`, `showWithFade`,
112
+ * `moveIn`, `zoomIn`, `pushIn`), exposed here so a third-party canvas-component library (e.g.
113
+ * `pixi-vn-spine`) can reuse it for its own custom operation/command instead of re-implementing
114
+ * the type → function mapping.
115
+ *
116
+ * @param alias The unique alias the element is (or will be) registered under on the canvas.
117
+ * @param component The canvas element to show (e.g. a `Spine` instance already built by the
118
+ * caller). Matches the `component` parameter of `@drincs/pixi-vn`'s own `showWithDissolve`/
119
+ * `moveIn`/etc.
120
+ * @param transitionType Which entrance transition to run (e.g. `"dissolve"`).
121
+ * @param props The transition's own props (e.g. `{ duration: 2 }`), typically validated against
122
+ * {@link entranceTransitionKeySchemas} beforehand.
123
+ * @returns The ids of the tickers used by the transition, once it starts.
124
+ */
125
+ declare function executeEntranceTransition(alias: string, component: CanvasBaseInterface<any> | undefined, transitionType: EntranceTransitionType, props?: object): Promise<string[] | undefined>;
126
+
71
127
  /**
72
128
  * Handles narration-related operations such as requesting player input or
73
129
  * clearing the current dialogue line.
@@ -132,4 +188,4 @@ declare function getValueFromConditionalStatements<T>(statement: PixiVNJsonCondi
132
188
  */
133
189
  declare function getConditionalStep(originalStep: PixiVNJsonLabelStep, props?: StepLabelPropsType): PixiVNJsonLabelStep;
134
190
 
135
- export { animateOperation, canvasElementOperation, canvasOperation, effectOperation, getConditionalStep, getLogichValue, getValueFromConditionalStatements, imageContainerOperation, imageOperation, loadAssets, narrationOperation, setInitialStorageValue, setStorageValue, soundOperation, textOperation, videoOperation };
191
+ export { ENTRANCE_TRANSITION_TYPES, type EntranceTransitionType, animateOperation, canvasElementOperation, canvasOperation, containerMemorySchema, effectOperation, entranceTransitionKeySchemas, executeEntranceTransition, getConditionalStep, getLogichValue, getValueFromConditionalStatements, imageContainerOperation, imageOperation, loadAssets, narrationOperation, setInitialStorageValue, setStorageValue, soundOperation, textOperation, videoOperation };
package/dist/actions.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {Assets,canvas,ImageSprite,showImage,VideoSprite,showVideo,ImageContainer,showImageContainer,Text,showText,shakeEffect,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade,pushIn,zoomIn,moveIn,showWithDissolve,showWithFade}from'@drincs/pixi-vn/canvas';import {translator}from'@drincs/pixi-vn-json/translator';import {NarrationManagerStatic,narration}from'@drincs/pixi-vn/narration';import {sound}from'@drincs/pixi-vn/sound';import {createExportableElement,PixiError}from'@drincs/pixi-vn';import {storage}from'@drincs/pixi-vn/storage';async function Je(e){let t=JsonUnifier.getLogichValue(e,{});if(t)switch(t.type){case "assets":switch(t.operationType){case "load":await Assets.load(t.aliases);break;case "lazyload":Assets.backgroundLoad(t.aliases);break}break;case "bundle":switch(t.operationType){case "load":await Assets.loadBundle(t.aliases);break;case "lazyload":Assets.backgroundLoadBundle(t.aliases);break}break}}var n;(o=>(o.log=(r,...l)=>console.log(`[Pixi\u2019VN Json] ${r}`,...l),o.warn=(r,...l)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...l),o.error=(r,...l)=>console.error(`[Pixi\u2019VN Json] ${r}`,...l),o.info=(r,...l)=>console.info(`[Pixi\u2019VN Json] ${r}`,...l)))(n||={});async function w(e,t,i){switch(i.type){case "fade":await showWithFade(t.alias,e,i.props,i.priority);break;case "dissolve":await showWithDissolve(t.alias,e,i.props,i.priority);break;case "movein":case "moveout":await moveIn(t.alias,e,i.props,i.priority);break;case "zoomin":case "zoomout":await zoomIn(t.alias,e,i.props,i.priority);break;case "pushin":case "pushout":await pushIn(t.alias,e,i.props,i.priority);break}}function v(e){if(e.transition)switch(e.transition.type){case "fade":removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);}async function Oe(e){switch(e.operationType){case "show":if(e.transition){let t=new ImageSprite(e.props,e.url||e.alias);await w(t,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`Image with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function Ae(e){switch(e.operationType){case "show":if(e.transition){let t=new VideoSprite(e.props,e.url||e.alias);await w(t,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`Video with alias ${e.alias} not found.`);break}case "remove":v(e);break;case "pause":case "resume":{let t=canvas.find(e.alias);t?t.paused=e.operationType==="pause":n.error(`Video with alias ${e.alias} not found.`);break}}}async function ke(e){switch(e.operationType){case "show":if(e.transition){let t=new ImageContainer(e.props,e.urls);await w(t,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function je(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.t(e.text),e.transition){let t=new Text(e.props);await w(t,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":{let t=canvas.find(e.alias);t?e.props&&await t.setMemory({...t.memory,...e.props}):n.error(`Text with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function Le(e){switch(e.operationType){case "edit":try{let t=canvas.find(e.alias);t?e.props&&t.setMemory({...t.memory,...e.props}):n.error(`Canvas Element with alias ${e.alias} not found.`);}catch(t){n.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,t);}break;case "remove":v(e);break}}function Ie(e){e.operationType==="clear"&&canvas.removeAll();}async function Ee(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function Re(e){switch(e.type){case "animate":canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}function Me(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function Fe(e){switch(e.operationType){case "play":e.url?sound.play(e.alias,e.url,e.props):sound.play(e.alias,e.props);break;case "stop":switch(e.type){case "sound":sound.stop(e.alias);break;case "all":sound.stopAll();break}break;case "pause":switch(e.type){case "sound":sound.pause(e.alias);break;case "channel":sound.findChannel(e.alias).pauseAll();break;case "all":sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.resume(e.alias);break;case "channel":sound.findChannel(e.alias).resumeAll();break;case "all":sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([t,i])=>{let a=sound.find(e.alias);a&&(t==="volume"?a.volume.value=i:a.paused=i);});break}}var b="___param___";var h=class e{static init(t){t.loadAssets&&(e._loadAssets=t.loadAssets),t.soundOperation&&(e._soundOperation=t.soundOperation),t.imageOperation&&(e._imageOperation=t.imageOperation),t.videoOperation&&(e._videoOperation=t.videoOperation),t.imageContainerOperation&&(e._imageContainerOperation=t.imageContainerOperation),t.textOperation&&(e._textOperation=t.textOperation),t.canvasElementOperation&&(e._canvasElementOperation=t.canvasElementOperation),t.setStorageValue&&(e._setStorageValue=t.setStorageValue),t.setInitialStorageValue&&(e._setInitialStorageValue=t.setInitialStorageValue),t.narrationOperation&&(e._narrationOperation=t.narrationOperation),t.effectOperation&&(e._effectOperation=t.effectOperation),t.animateOperation&&(e._animateOperation=t.animateOperation),t.canvasOperation&&(e._canvasOperation=t.canvasOperation),t.getLogichValue&&(e._getLogichValue=t.getLogichValue),t.getConditionalStep&&(e._getConditionalStep=t.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return e._loadAssets}static _soundOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get soundOperation(){return e._soundOperation}static _imageOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageOperation(){return e._imageOperation}static _videoOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get videoOperation(){return e._videoOperation}static _imageContainerOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageContainerOperation(){return e._imageContainerOperation}static _textOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get textOperation(){return e._textOperation}static _canvasElementOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasElementOperation(){return e._canvasElementOperation}static _setStorageValue=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setStorageValue(){return e._setStorageValue}static _setInitialStorageValue=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setInitialStorageValue(){return e._setInitialStorageValue}static _narrationOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get narrationOperation(){return e._narrationOperation}static _effectOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get effectOperation(){return e._effectOperation}static _animateOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animateOperation(){return e._animateOperation}static _canvasOperation=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasOperation(){return e._canvasOperation}static _getLogichValue=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getLogichValue(){return e._getLogichValue}static _getConditionalStep=()=>{throw n.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getConditionalStep(){return e._getConditionalStep}};function _(e,t){if(t&&typeof t=="object"&&typeof e.functionName=="string"&&e.functionName in t){let i=t[e.functionName];if(typeof i=="function"){let a=e.args.map(o=>h.getLogichValue(o,t));return i(...a)}else n.warn(`getLogichValue function ${e.functionName} not found in props`);}}function z(e,t){let i=JsonUnifier.getLogichValue(e,t);return i&&typeof i=="object"&&"type"in i?JsonUnifier.getLogichValue(i,t):i}function ui(e,t={}){let i=z(e.value,t);switch(e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.set(e.key,i);break;case "tempstorage":storage.setTempVariable(e.key,i);break;case "params":{let a=storage.get(`${b}${narration.openedLabels.length-1}`)||[];a.length>e.key&&(a[e.key]=i),storage.setTempVariable(`${b}${narration.openedLabels.length-1}`,a);break}}}function di(e,t={}){let i=z(e.value,t);switch(e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:i};break}}function k(e,t={}){let i=j(e,t);if(i&&typeof i=="object"&&"type"in i)switch(i.type){case "value":return xe(i,t);case "arithmetic":case "arithmeticsingle":return me(i,t);case "compare":case "union":return ge(i,t);case "function":return _(i,t)}return i}function me(e,t){let i=JsonUnifier.getLogichValue(e.leftValue,t);switch(e.type){case "arithmetic":{let a=JsonUnifier.getLogichValue(e.rightValue,t);switch(e.operator){case "*":return i*a;case "/":return i/a;case "+":return typeof i=="string"||typeof a=="string"?`${i}${a}`:Array.isArray(i)&&Array.isArray(a)?[...i,...a]:Array.isArray(i)?[...i,a]:Array.isArray(a)?[i,...a]:i+a;case "-":if(Array.isArray(i)&&Array.isArray(a))return i.filter(o=>!a.includes(o));if(Array.isArray(i))return i.filter(o=>o!==a);if(Array.isArray(a)){n.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return i-a;case "%":return i%a;case "POW":return i**a;case "RANDOM":return narration.getRandomNumber(i,a);case "INTERSECTION":if(Array.isArray(i)&&Array.isArray(a))return i.filter(o=>a.includes(o));n.warn("getValueFromArithmeticOperations cannot intersect non-array values");return;default:n.warn("getValueFromArithmeticOperations unknown operator",e);return}}case "arithmeticsingle":switch(e.operator){case "INT":return Number(i);case "FLOOR":return Math.floor(i);}break}}function xe(e,t){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.inputValue:storage.get(e.key);case "flagStorage":return storage.getFlag(e.key);case "label":return narration.getTimesLabelOpened(e.label);case "choice":return narration.getTimesChoiceMade(e.index);case "logic":return JsonUnifier.getLogichValue(e.operation,t);case "params":{let i=storage.get(`${b}${narration.openedLabels.length-1}`)||[];if(i&&i.length>e.key)return i[e.key];n.warn("getValue params not found");return}}return e}function ge(e,t){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":{let i=JsonUnifier.getLogichValue(e.leftValue,t),a=JsonUnifier.getLogichValue(e.rightValue,t);switch(e.operator){case "==":return Array.isArray(i)&&Array.isArray(a)?i.length===a.length&&i.every(o=>a.includes(o)):i===a;case "!=":return Array.isArray(i)&&Array.isArray(a)?i.length!==a.length||!i.every(o=>a.includes(o)):i!==a;case "<":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)<0:Array.isArray(i)&&Array.isArray(a)?i.length<a.length:i<a;case "<=":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)<=0:Array.isArray(i)&&Array.isArray(a)?i.length<=a.length:i<=a;case ">":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)>0:Array.isArray(i)&&Array.isArray(a)?i.length>a.length:i>a;case ">=":return typeof i=="string"&&typeof a=="string"?i.localeCompare(a)>=0:Array.isArray(i)&&Array.isArray(a)?i.length>=a.length:i>=a;case "CONTAINS":return Array.isArray(i)&&Array.isArray(a)?a.every(o=>i.includes(o)):Array.isArray(i)?i.includes(a):i.toString().includes(a.toString())}break}case "value":{let i=JsonUnifier.getLogichValue(e,t);return Array.isArray(i)?i.length>0:i&&typeof i=="object"?Object.keys(i).length>0:!!i}case "union":return Ve(e,t)}return !!e}function Ve(e,t){if(e.unionType==="not"){let a=k(e.condition,t);return Array.isArray(a)?a.length===0:a&&typeof a=="object"?Object.keys(a).length===0:!a}let i=a=>JsonUnifier.getLogichValue(a,t)||false;return e.unionType==="and"?e.conditions.every(i):e.conditions.some(i)}function fe(e,t){return Math.floor(Math.random()*(t-e+1)+e)}function j(e,t={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return ye(e,t);case "ifelse":return JsonUnifier.getLogichValue(e.condition,t)?JsonUnifier.getLogichValue(e.then,t):JsonUnifier.getLogichValue(e.else,t);case "stepswitch":{let i=JsonUnifier.getLogichValue(e.elements,t)||[];if(i.length===0){n.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let a=fe(0,i.length-1);return JsonUnifier.getLogichValue(i[a],t)}case "loop":{let a=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return a>i.length-1?(a=a%i.length,JsonUnifier.getLogichValue(i[a],t)):JsonUnifier.getLogichValue(i[a],t)}case "sequential":{let a,o=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(a=JsonUnifier.getLogichValue(i[i.length-1],t)),o>i.length-1?a:JsonUnifier.getLogichValue(i[o],t)}case "sequentialrandom":{let a=NarrationManagerStatic.getRandomNumber(0,i.length-1,{nestedId:e.nestedId,onceOnly:true});if(a===void 0&&e.end==="lastItem"){let o=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!o?.usedRandomNumbers){n.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let r=o.usedRandomNumbers[`0-${i.length-1}`];return JsonUnifier.getLogichValue(i[r[r.length-1]],t)}if(a===void 0){n.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return JsonUnifier.getLogichValue(i[a],t)}}}}return e}function M(e,t={}){if(e.conditionalStep){let i=createExportableElement(JsonUnifier.getLogichValue(e.conditionalStep,t));if(i?.glueEnabled===void 0&&delete i?.glueEnabled,i?.goNextStep===void 0&&delete i?.goNextStep,i?.end===void 0&&delete i?.end,i?.choices===void 0&&delete i?.choices,i?.dialogue===void 0&&delete i?.dialogue,i?.labelToOpen===void 0&&delete i?.labelToOpen,i?.operations===void 0&&delete i?.operations,i){let a={...e,conditionalStep:void 0,...i};return M(a,t)}else narration.dialogGlue&&(narration.dialogGlue=false);}return e}function ye(e,t){let i=e.firstItem,a=(e.secondConditionalItem??[]).flatMap(r=>Array.isArray(r)?r.map(l=>JsonUnifier.getLogichValue(l,t)):[JsonUnifier.getLogichValue(r,t)]),o=i?[i,...a]:a;if(o.length===0){n.warn("combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return translator.t(o);if(typeof o[0]=="object"){let r=o,l,P=false,N=r.map((c,f)=>{c=M(c,t);let u=JsonUnifier.getLogichValue(c.dialogue,t)||"";return f===0?(l=JsonUnifier.getLogichValue(c.glueEnabled,t)||false,u):(typeof u=="object"&&"text"in u&&(u=`${u.character}: ${u.text}`),l===false&&P&&(u=`
1
+ import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {Assets,canvas,ImageSprite,showImage,VideoSprite,showVideo,ImageContainer,showImageContainer,Text,showText,shakeEffect,pushIn,zoomIn,moveIn,showWithFade,showWithDissolve,pushOut,zoomOut,moveOut,removeWithDissolve,removeWithFade}from'@drincs/pixi-vn/canvas';import {translator}from'@drincs/pixi-vn-json/translator';import {NarrationManagerStatic,narration}from'@drincs/pixi-vn/narration';import {sound}from'@drincs/pixi-vn/sound';import {createExportableElement,PixiError}from'@drincs/pixi-vn';import {storage}from'@drincs/pixi-vn/storage';async function je(e){let n=JsonUnifier.getLogichValue(e,{});if(n)switch(n.type){case "assets":switch(n.operationType){case "load":await Assets.load(n.aliases);break;case "lazyload":Assets.backgroundLoad(n.aliases);break}break;case "bundle":switch(n.operationType){case "load":await Assets.loadBundle(n.aliases);break;case "lazyload":Assets.backgroundLoadBundle(n.aliases);break}break}}var a;(o=>(o.log=(r,...p)=>console.log(`[Pixi\u2019VN Json] ${r}`,...p),o.warn=(r,...p)=>console.warn(`[Pixi\u2019VN Json] ${r}`,...p),o.error=(r,...p)=>console.error(`[Pixi\u2019VN Json] ${r}`,...p),o.info=(r,...p)=>console.info(`[Pixi\u2019VN Json] ${r}`,...p)))(a||={});async function J(e,n,t){switch(t.type){case "fade":await showWithFade(n.alias,e,t.props,t.priority);break;case "dissolve":await showWithDissolve(n.alias,e,t.props,t.priority);break;case "movein":case "moveout":await moveIn(n.alias,e,t.props,t.priority);break;case "zoomin":case "zoomout":await zoomIn(n.alias,e,t.props,t.priority);break;case "pushin":case "pushout":await pushIn(n.alias,e,t.props,t.priority);break}}function v(e){if(e.transition)switch(e.transition.type){case "fade":removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);}async function Re(e){switch(e.operationType){case "show":if(e.transition){let n=new ImageSprite(e.props,e.url||e.alias);await J(n,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":{let n=canvas.find(e.alias);n?e.props&&await n.setMemory({...n.memory,...e.props}):a.error(`Image with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function ze(e){switch(e.operationType){case "show":if(e.transition){let n=new VideoSprite(e.props,e.url||e.alias);await J(n,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":{let n=canvas.find(e.alias);n?e.props&&await n.setMemory({...n.memory,...e.props}):a.error(`Video with alias ${e.alias} not found.`);break}case "remove":v(e);break;case "pause":case "resume":{let n=canvas.find(e.alias);n?n.paused=e.operationType==="pause":a.error(`Video with alias ${e.alias} not found.`);break}}}async function De(e){switch(e.operationType){case "show":if(e.transition){let n=new ImageContainer(e.props,e.urls);await J(n,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let n=canvas.find(e.alias);n?e.props&&await n.setMemory({...n.memory,...e.props}):a.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function _e(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.t(e.text),e.transition){let n=new Text(e.props);await J(n,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":{let n=canvas.find(e.alias);n?e.props&&await n.setMemory({...n.memory,...e.props}):a.error(`Text with alias ${e.alias} not found.`);break}case "remove":v(e);break}}async function Me(e){switch(e.operationType){case "edit":try{let n=canvas.find(e.alias);n?e.props&&n.setMemory({...n.memory,...e.props}):a.error(`Canvas Element with alias ${e.alias} not found.`);}catch(n){a.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,n);}break;case "remove":v(e);break}}function Ge(e){e.operationType==="clear"&&canvas.removeAll();}async function $e(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function Fe(e){switch(e.type){case "animate":canvas.animate(e.alias,e.keyframes,e.options,e.priority);break;case "animate-sequence":canvas.animate(e.alias,e.sequence,e.options,e.priority);break}}var ue={type:"object",properties:{isRenderGroup:{type:"boolean"},blendMode:{enum:["inherit","normal","add","multiply","screen","darken","lighten","erase","color-dodge","color-burn","linear-burn","linear-dodge","linear-light","hard-light","soft-light","pin-light","difference","exclusion","overlay","saturation","color","luminosity","normal-npm","add-npm","screen-npm","none","subtract","divide","vivid-light","hard-mix","negation","min","max"]},tint:{anyOf:[{type:"string"},{type:"number"},{type:"object"},{type:"object"},{type:"object"},{type:"object"},{type:"object"},{allOf:[{type:"object"},{type:"object"}]},{type:"object"},{allOf:[{type:"object"},{type:"object"}]},{type:"object"},{allOf:[{type:"object"},{type:"object"}]},{type:"object"}]},alpha:{type:"number"},angle:{type:"number"},children:{type:"object"},parent:{type:"object"},renderable:{type:"boolean"},rotation:{type:"number"},scale:{type:["number","object"]},pivot:{type:["number","object"]},origin:{type:["number","object"]},position:{type:"object"},skew:{type:"object"},visible:{type:"boolean"},x:{type:"number"},y:{type:"number"},boundsArea:{type:"object"},accessible:{type:"boolean"},accessibleTitle:{type:"string"},accessibleHint:{type:"string"},tabIndex:{type:"number"},accessibleType:{enum:["object","label","a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]},accessiblePointerEvents:{enum:["inherit","none","auto","visiblePainted","visibleFill","visibleStroke","visible","painted","fill","stroke","all"]},accessibleText:{type:"string"},accessibleChildren:{type:"boolean"},cullArea:{type:"object"},cullable:{type:"boolean"},cullableChildren:{type:"boolean"},cursor:{anyOf:[{const:"none"},{const:"progress"},{const:"auto"},{const:"default"},{const:"context-menu"},{const:"help"},{const:"pointer"},{const:"wait"},{const:"cell"},{const:"crosshair"},{const:"text"},{const:"vertical-text"},{const:"alias"},{const:"copy"},{const:"move"},{const:"no-drop"},{const:"not-allowed"},{const:"e-resize"},{const:"n-resize"},{const:"ne-resize"},{const:"nw-resize"},{const:"s-resize"},{const:"se-resize"},{const:"sw-resize"},{const:"w-resize"},{const:"ns-resize"},{const:"ew-resize"},{const:"nesw-resize"},{const:"col-resize"},{const:"nwse-resize"},{const:"row-resize"},{const:"all-scroll"},{const:"zoom-in"},{const:"zoom-out"},{const:"grab"},{const:"grabbing"},{allOf:[{type:"string"},{type:"object"}]}]},eventMode:{enum:["none","auto","passive","static","dynamic"]},interactive:{type:"boolean"},interactiveChildren:{type:"boolean"},hitArea:{type:"object"},width:{type:"number"},height:{type:"number"},mask:{type:["number","object"]},filters:{type:"object"},label:{type:"string"},zIndex:{type:"number"},sortDirty:{type:"boolean"},sortableChildren:{type:"boolean"},pixivnId:{type:"string"},index:{type:"number"},parentLabel:{type:"string"},onEvents:{type:"object"},align:{type:["number","object"]},xAlign:{type:"number"},yAlign:{type:"number"},percentagePosition:{type:["number","object"]},percentageX:{type:"number"},percentageY:{type:"number"}},required:["pixivnId"],additionalProperties:false};var me={dissolve:{type:"object",properties:{forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},fade:{type:"object",properties:{forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},movein:{type:"object",properties:{direction:{enum:["left","right","up","down"]},forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},zoomin:{type:"object",properties:{direction:{enum:["left","right","up","down"]},forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false},pushin:{type:"object",properties:{direction:{enum:["left","right","up","down"]},forceCompleteBeforeNext:{type:"boolean"},completeOnContinue:{type:"boolean"},delay:{type:["number","object"]},stiffness:{type:"number"},damping:{type:"number"},mass:{type:"number"},duration:{type:"number"},visualDuration:{type:"number"},bounce:{type:"number"},velocity:{type:"number"},restSpeed:{type:"number"},restDelta:{type:"number"},bounceStiffness:{type:"number"},bounceDamping:{type:"number"},min:{type:"number"},max:{type:"number"},power:{type:"number"},timeConstant:{type:"number"},isSync:{type:"boolean"},elapsed:{type:"number"},type:{anyOf:[{const:false},{const:"keyframes"},{type:"object"},{const:"decay"},{const:"spring"},{const:"tween"},{const:"inertia"}]},autoplay:{type:"boolean"},startTime:{type:"number"},from:{},inherit:{type:"boolean"},skipAnimations:{type:"boolean"},path:{anyOf:[{type:"object"},{allOf:[{type:"object"},{type:"object"}]}]},when:{anyOf:[{type:"string"},{const:false}]},delayChildren:{type:["number","object"]},staggerChildren:{type:"number"},staggerDirection:{type:"number"},repeat:{type:"number"},repeatType:{enum:["loop","reverse","mirror"]},repeatDelay:{type:"number"},ease:{anyOf:[{type:"object"},{const:"linear"},{const:"easeIn"},{const:"easeOut"},{const:"easeInOut"},{const:"circIn"},{const:"circOut"},{const:"circInOut"},{const:"backIn"},{const:"backOut"},{const:"backInOut"},{const:"anticipate"},{type:"object"},{type:"object"}]},times:{type:"object"},reduceMotion:{type:"boolean"},aliasToRemoveAfter:{type:["string","object"]},tickerAliasToResume:{type:["string","object"]},tickerIdToResume:{type:["string","object"]}},additionalProperties:false}};var Ye=["dissolve","fade","movein","zoomin","pushin"];async function Ke(e,n,t,i){switch(t){case "dissolve":return showWithDissolve(e,n,i);case "fade":return showWithFade(e,n,i);case "movein":return moveIn(e,n,i);case "zoomin":return zoomIn(e,n,i);case "pushin":return pushIn(e,n,i)}}function tt(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function at(e){switch(e.operationType){case "play":e.url?sound.play(e.alias,e.url,e.props):sound.play(e.alias,e.props);break;case "stop":switch(e.type){case "sound":sound.stop(e.alias);break;case "all":sound.stopAll();break}break;case "pause":switch(e.type){case "sound":sound.pause(e.alias);break;case "channel":sound.findChannel(e.alias).pauseAll();break;case "all":sound.pauseAll();break}break;case "resume":switch(e.type){case "sound":sound.resume(e.alias);break;case "channel":sound.findChannel(e.alias).resumeAll();break;case "all":sound.resumeAll();break}break;case "edit":Object.entries(e.props).forEach(([n,t])=>{let i=sound.find(e.alias);i&&(n==="volume"?i.volume.value=t:i.paused=t);});break}}var w="___param___";var h=class e{static init(n){n.loadAssets&&(e._loadAssets=n.loadAssets),n.soundOperation&&(e._soundOperation=n.soundOperation),n.imageOperation&&(e._imageOperation=n.imageOperation),n.videoOperation&&(e._videoOperation=n.videoOperation),n.imageContainerOperation&&(e._imageContainerOperation=n.imageContainerOperation),n.textOperation&&(e._textOperation=n.textOperation),n.canvasElementOperation&&(e._canvasElementOperation=n.canvasElementOperation),n.setStorageValue&&(e._setStorageValue=n.setStorageValue),n.setInitialStorageValue&&(e._setInitialStorageValue=n.setInitialStorageValue),n.narrationOperation&&(e._narrationOperation=n.narrationOperation),n.effectOperation&&(e._effectOperation=n.effectOperation),n.animateOperation&&(e._animateOperation=n.animateOperation),n.canvasOperation&&(e._canvasOperation=n.canvasOperation),n.getLogichValue&&(e._getLogichValue=n.getLogichValue),n.getConditionalStep&&(e._getConditionalStep=n.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return e._loadAssets}static _soundOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get soundOperation(){return e._soundOperation}static _imageOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageOperation(){return e._imageOperation}static _videoOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get videoOperation(){return e._videoOperation}static _imageContainerOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get imageContainerOperation(){return e._imageContainerOperation}static _textOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get textOperation(){return e._textOperation}static _canvasElementOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasElementOperation(){return e._canvasElementOperation}static _setStorageValue=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setStorageValue(){return e._setStorageValue}static _setInitialStorageValue=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get setInitialStorageValue(){return e._setInitialStorageValue}static _narrationOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get narrationOperation(){return e._narrationOperation}static _effectOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get effectOperation(){return e._effectOperation}static _animateOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get animateOperation(){return e._animateOperation}static _canvasOperation=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get canvasOperation(){return e._canvasOperation}static _getLogichValue=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getLogichValue(){return e._getLogichValue}static _getConditionalStep=()=>{throw a.error("An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue."),new PixiError("invalid_usage","An error occurred! pixi-vn-json was not initialized. Please contact the Pixi'VN team to report the issue.")};static get getConditionalStep(){return e._getConditionalStep}};function z(e,n){if(n&&typeof n=="object"&&typeof e.functionName=="string"&&e.functionName in n){let t=n[e.functionName];if(typeof t=="function"){let i=e.args.map(o=>h.getLogichValue(o,n));return t(...i)}else a.warn(`getLogichValue function ${e.functionName} not found in props`);}}function D(e,n){let t=JsonUnifier.getLogichValue(e,n);return t&&typeof t=="object"&&"type"in t?JsonUnifier.getLogichValue(t,n):t}function wt(e,n={}){let t=D(e.value,n);switch(e.storageType){case "flagStorage":storage.setFlag(e.key,e.value);break;case "storage":storage.set(e.key,t);break;case "tempstorage":storage.setTempVariable(e.key,t);break;case "params":{let i=storage.get(`${w}${narration.openedLabels.length-1}`)||[];i.length>e.key&&(i[e.key]=t),storage.setTempVariable(`${w}${narration.openedLabels.length-1}`,i);break}}}function St(e,n={}){let t=D(e.value,n);switch(e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:t};break}}function A(e,n={}){let t=k(e,n);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "value":return Pe(t,n);case "arithmetic":case "arithmeticsingle":return Ve(t,n);case "compare":case "union":return ve(t,n);case "function":return z(t,n)}return t}function Ve(e,n){let t=JsonUnifier.getLogichValue(e.leftValue,n);switch(e.type){case "arithmetic":{let i=JsonUnifier.getLogichValue(e.rightValue,n);switch(e.operator){case "*":return t*i;case "/":return t/i;case "+":return typeof t=="string"||typeof i=="string"?`${t}${i}`:Array.isArray(t)&&Array.isArray(i)?[...t,...i]:Array.isArray(t)?[...t,i]:Array.isArray(i)?[t,...i]:t+i;case "-":if(Array.isArray(t)&&Array.isArray(i))return t.filter(o=>!i.includes(o));if(Array.isArray(t))return t.filter(o=>o!==i);if(Array.isArray(i)){a.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return t-i;case "%":return t%i;case "POW":return t**i;case "RANDOM":return narration.getRandomNumber(t,i);case "INTERSECTION":if(Array.isArray(t)&&Array.isArray(i))return t.filter(o=>i.includes(o));a.warn("getValueFromArithmeticOperations cannot intersect non-array values");return;default:a.warn("getValueFromArithmeticOperations unknown operator",e);return}}case "arithmeticsingle":switch(e.operator){case "INT":return Number(t);case "FLOOR":return Math.floor(t);}break}}function Pe(e,n){if(e&&typeof e=="object"&&"type"in e&&e.type==="value"&&e.storageOperationType==="get")switch(e.storageType){case "storage":case "tempstorage":return e.key==="_input_value_"?narration.inputValue:storage.get(e.key);case "flagStorage":return storage.getFlag(e.key);case "label":return narration.getTimesLabelOpened(e.label);case "choice":return narration.getTimesChoiceMade(e.index);case "logic":return JsonUnifier.getLogichValue(e.operation,n);case "params":{let t=storage.get(`${w}${narration.openedLabels.length-1}`)||[];if(t&&t.length>e.key)return t[e.key];a.warn("getValue params not found");return}}return e}function ve(e,n){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":{let t=JsonUnifier.getLogichValue(e.leftValue,n),i=JsonUnifier.getLogichValue(e.rightValue,n);switch(e.operator){case "==":return Array.isArray(t)&&Array.isArray(i)?t.length===i.length&&t.every(o=>i.includes(o)):t===i;case "!=":return Array.isArray(t)&&Array.isArray(i)?t.length!==i.length||!t.every(o=>i.includes(o)):t!==i;case "<":return typeof t=="string"&&typeof i=="string"?t.localeCompare(i)<0:Array.isArray(t)&&Array.isArray(i)?t.length<i.length:t<i;case "<=":return typeof t=="string"&&typeof i=="string"?t.localeCompare(i)<=0:Array.isArray(t)&&Array.isArray(i)?t.length<=i.length:t<=i;case ">":return typeof t=="string"&&typeof i=="string"?t.localeCompare(i)>0:Array.isArray(t)&&Array.isArray(i)?t.length>i.length:t>i;case ">=":return typeof t=="string"&&typeof i=="string"?t.localeCompare(i)>=0:Array.isArray(t)&&Array.isArray(i)?t.length>=i.length:t>=i;case "CONTAINS":return Array.isArray(t)&&Array.isArray(i)?i.every(o=>t.includes(o)):Array.isArray(t)?t.includes(i):t.toString().includes(i.toString())}break}case "value":{let t=JsonUnifier.getLogichValue(e,n);return Array.isArray(t)?t.length>0:t&&typeof t=="object"?Object.keys(t).length>0:!!t}case "union":return Ne(e,n)}return !!e}function Ne(e,n){if(e.unionType==="not"){let i=A(e.condition,n);return Array.isArray(i)?i.length===0:i&&typeof i=="object"?Object.keys(i).length===0:!i}let t=i=>JsonUnifier.getLogichValue(i,n)||false;return e.unionType==="and"?e.conditions.every(t):e.conditions.some(t)}function Te(e,n){return Math.floor(Math.random()*(n-e+1)+e)}function k(e,n={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Je(e,n);case "ifelse":return JsonUnifier.getLogichValue(e.condition,n)?JsonUnifier.getLogichValue(e.then,n):JsonUnifier.getLogichValue(e.else,n);case "stepswitch":{let t=JsonUnifier.getLogichValue(e.elements,n)||[];if(t.length===0){a.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let i=Te(0,t.length-1);return JsonUnifier.getLogichValue(t[i],n)}case "loop":{let i=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return i>t.length-1?(i=i%t.length,JsonUnifier.getLogichValue(t[i],n)):JsonUnifier.getLogichValue(t[i],n)}case "sequential":{let i,o=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(i=JsonUnifier.getLogichValue(t[t.length-1],n)),o>t.length-1?i:JsonUnifier.getLogichValue(t[o],n)}case "sequentialrandom":{let i=NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:e.nestedId,onceOnly:true});if(i===void 0&&e.end==="lastItem"){let o=NarrationManagerStatic.getCurrentStepTimesCounterData(e.nestedId);if(!o?.usedRandomNumbers){a.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}let r=o.usedRandomNumbers[`0-${t.length-1}`];return JsonUnifier.getLogichValue(t[r[r.length-1]],n)}if(i===void 0){a.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return JsonUnifier.getLogichValue(t[i],n)}}}}return e}function _(e,n={}){if(e.conditionalStep){let t=createExportableElement(JsonUnifier.getLogichValue(e.conditionalStep,n));if(t?.glueEnabled===void 0&&delete t?.glueEnabled,t?.goNextStep===void 0&&delete t?.goNextStep,t?.end===void 0&&delete t?.end,t?.choices===void 0&&delete t?.choices,t?.dialogue===void 0&&delete t?.dialogue,t?.labelToOpen===void 0&&delete t?.labelToOpen,t?.operations===void 0&&delete t?.operations,t){let i={...e,conditionalStep:void 0,...t};return _(i,n)}else narration.dialogGlue&&(narration.dialogGlue=false);}return e}function Je(e,n){let t=e.firstItem,i=(e.secondConditionalItem??[]).flatMap(r=>Array.isArray(r)?r.map(p=>JsonUnifier.getLogichValue(p,n)):[JsonUnifier.getLogichValue(r,n)]),o=t?[t,...i]:i;if(o.length===0){a.warn("combinateResult toCheck.length === 0");return}if(typeof o[0]=="string")return translator.t(o);if(typeof o[0]=="object"){let r=o,p,V=false,P=r.map((c,f)=>{c=_(c,n);let l=JsonUnifier.getLogichValue(c.dialogue,n)||"";return f===0?(p=JsonUnifier.getLogichValue(c.glueEnabled,n)||false,l):(typeof l=="object"&&"text"in l&&(l=`${l.character}: ${l.text}`),p===false&&V&&(l=`
2
2
 
3
- ${u}`),u&&(P=true),l=JsonUnifier.getLogichValue(c.glueEnabled,t)||false,u)}),V=JsonUnifier.getLogichValue(N[0],t),y=typeof V=="object"&&"character"in V?V.character:void 0,J=N.flatMap(c=>{let f;c&&typeof c=="object"&&"text"in c?f=c.text:f=c;let u;return Array.isArray(f)?u=f.map(F=>{let D=JsonUnifier.getLogichValue(F,t);return translator.t(`${D}`)}):u=JsonUnifier.getLogichValue(f,t)||"",translator.t(u)}),C=r.find(c=>c.end),G=r.find(c=>c.choices),L=false,I=false;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&(narration.dialogGlue=true),L=r[r.length-1].glueEnabled,I=r.reverse().find(c=>!(c.operations&&(!c.dialogue||!c.choices)))?.goNextStep);let $=r.find(c=>c.labelToOpen),O=[];return r.forEach(c=>{c.operations&&(O=[...O,...c.operations]);}),{dialogue:y?{character:y,text:J}:J,end:C?.end,choices:G?.choices,glueEnabled:L,goNextStep:I,labelToOpen:$?.labelToOpen,operations:O}}}var he;(o=>{let e=new Set;function t(r){e.add(r);}o.add=t;function i(){e.clear();}o.clear=i;function a(r,l={}){let P=y=>k(y,l)??void 0,N=j(r,l);if(e.size===0)return P(N);let V=P;for(let y of e){let J=V;V=C=>y(C,J)??void 0;}return V(N)}o.getLogichValue=a;})(he||={});export{he as VariableGetter,Re as animateOperation,Le as canvasElementOperation,Ie as canvasOperation,Ee as effectOperation,M as getConditionalStep,k as getLogichValue,j as getValueFromConditionalStatements,ke as imageContainerOperation,Oe as imageOperation,Je as loadAssets,Me as narrationOperation,di as setInitialStorageValue,ui as setStorageValue,Fe as soundOperation,je as textOperation,Ae as videoOperation};
3
+ ${l}`),l&&(V=true),p=JsonUnifier.getLogichValue(c.glueEnabled,n)||false,l)}),g=JsonUnifier.getLogichValue(P[0],n),x=typeof g=="object"&&"character"in g?g.character:void 0,N=P.flatMap(c=>{let f;c&&typeof c=="object"&&"text"in c?f=c.text:f=c;let l;return Array.isArray(f)?l=f.map($=>{let F=JsonUnifier.getLogichValue($,n);return translator.t(`${F}`)}):l=JsonUnifier.getLogichValue(f,n)||"",translator.t(l)}),O=r.find(c=>c.end),M=r.find(c=>c.choices),I=false,E=false;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&(narration.dialogGlue=true),I=r[r.length-1].glueEnabled,E=r.reverse().find(c=>!(c.operations&&(!c.dialogue||!c.choices)))?.goNextStep);let G=r.find(c=>c.labelToOpen),C=[];return r.forEach(c=>{c.operations&&(C=[...C,...c.operations]);}),{dialogue:x?{character:x,text:N}:N,end:O?.end,choices:M?.choices,glueEnabled:I,goNextStep:E,labelToOpen:G?.labelToOpen,operations:C}}}var we;(o=>{let e=new Set;function n(r){e.add(r);}o.add=n;function t(){e.clear();}o.clear=t;function i(r,p={}){let V=x=>A(x,p)??void 0,P=k(r,p);if(e.size===0)return V(P);let g=V;for(let x of e){let N=g;g=O=>x(O,N)??void 0;}return g(P)}o.getLogichValue=i;})(we||={});export{Ye as ENTRANCE_TRANSITION_TYPES,we as VariableGetter,Fe as animateOperation,Me as canvasElementOperation,Ge as canvasOperation,ue as containerMemorySchema,$e as effectOperation,me as entranceTransitionKeySchemas,Ke as executeEntranceTransition,_ as getConditionalStep,A as getLogichValue,k as getValueFromConditionalStatements,De as imageContainerOperation,Re as imageOperation,je as loadAssets,tt as narrationOperation,St as setInitialStorageValue,wt as setStorageValue,at as soundOperation,_e as textOperation,ze as videoOperation};
@@ -1,2 +1,2 @@
1
- 'use strict';var t={version:"1.13.15"};var r="___param___",o=`https://pixi-vn.com/schemas/${t.version}/schema.json`,n=["==","!=","<","<=",">",">=","CONTAINS"];
1
+ 'use strict';var s={version:"1.13.17"};var r="___param___",o=`https://pixi-vn.com/schemas/${s.version}/schema.json`,n=["==","!=","<","<=",">",">=","CONTAINS"];
2
2
  exports.PIXIVNJSON_PARAM_ID=r;exports.PIXIVNJSON_SCHEMA_URL=o;exports.PixiVNJsonComparationOperators=n;
@@ -1,2 +1,2 @@
1
- var t={version:"1.13.15"};var r="___param___",o=`https://pixi-vn.com/schemas/${t.version}/schema.json`,n=["==","!=","<","<=",">",">=","CONTAINS"];
1
+ var s={version:"1.13.17"};var r="___param___",o=`https://pixi-vn.com/schemas/${s.version}/schema.json`,n=["==","!=","<","<=",">",">=","CONTAINS"];
2
2
  export{r as PIXIVNJSON_PARAM_ID,o as PIXIVNJSON_SCHEMA_URL,n as PixiVNJsonComparationOperators};
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- 'use strict';var actions=require('@drincs/pixi-vn-json/actions'),core=require('@drincs/pixi-vn-json/core'),interpreter=require('@drincs/pixi-vn-json/interpreter'),translator=require('@drincs/pixi-vn-json/translator');var t={version:"1.13.15"};var i="___param___",e=`https://pixi-vn.com/schemas/${t.version}/schema.json`,r=["==","!=","<","<=",">",">=","CONTAINS"];function _(){core.JsonUnifier.init({animateOperation:actions.animateOperation,canvasElementOperation:actions.canvasElementOperation,canvasOperation:actions.canvasOperation,effectOperation:actions.effectOperation,imageContainerOperation:actions.imageContainerOperation,imageOperation:actions.imageOperation,textOperation:actions.textOperation,narrationOperation:actions.narrationOperation,loadAssets:actions.loadAssets,soundOperation:actions.soundOperation,videoOperation:actions.videoOperation,setStorageValue:actions.setStorageValue,setInitialStorageValue:actions.setInitialStorageValue,getLogichValue:actions.VariableGetter.getLogichValue,getConditionalStep:actions.getConditionalStep});}
2
- Object.defineProperty(exports,"VariableGetter",{enumerable:true,get:function(){return actions.VariableGetter}});exports.PIXIVNJSON_PARAM_ID=i;exports.PIXIVNJSON_SCHEMA_URL=e;exports.PixiVNJsonComparationOperators=r;exports.init=_;Object.keys(interpreter).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return interpreter[k]}})});Object.keys(translator).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return translator[k]}})});
1
+ 'use strict';var actions=require('@drincs/pixi-vn-json/actions'),core=require('@drincs/pixi-vn-json/core'),interpreter=require('@drincs/pixi-vn-json/interpreter'),translator=require('@drincs/pixi-vn-json/translator');var t={version:"1.13.17"};var e="___param___",i=`https://pixi-vn.com/schemas/${t.version}/schema.json`,r=["==","!=","<","<=",">",">=","CONTAINS"];function _(){core.JsonUnifier.init({animateOperation:actions.animateOperation,canvasElementOperation:actions.canvasElementOperation,canvasOperation:actions.canvasOperation,effectOperation:actions.effectOperation,imageContainerOperation:actions.imageContainerOperation,imageOperation:actions.imageOperation,textOperation:actions.textOperation,narrationOperation:actions.narrationOperation,loadAssets:actions.loadAssets,soundOperation:actions.soundOperation,videoOperation:actions.videoOperation,setStorageValue:actions.setStorageValue,setInitialStorageValue:actions.setInitialStorageValue,getLogichValue:actions.VariableGetter.getLogichValue,getConditionalStep:actions.getConditionalStep});}
2
+ Object.defineProperty(exports,"VariableGetter",{enumerable:true,get:function(){return actions.VariableGetter}});exports.PIXIVNJSON_PARAM_ID=e;exports.PIXIVNJSON_SCHEMA_URL=i;exports.PixiVNJsonComparationOperators=r;exports.init=_;Object.keys(interpreter).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return interpreter[k]}})});Object.keys(translator).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return translator[k]}})});
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import {getConditionalStep,VariableGetter,setInitialStorageValue,setStorageValue,videoOperation,soundOperation,loadAssets,narrationOperation,textOperation,imageOperation,imageContainerOperation,effectOperation,canvasOperation,canvasElementOperation,animateOperation}from'@drincs/pixi-vn-json/actions';export{VariableGetter}from'@drincs/pixi-vn-json/actions';import {JsonUnifier}from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/interpreter';export*from'@drincs/pixi-vn-json/translator';var t={version:"1.13.15"};var i="___param___",e=`https://pixi-vn.com/schemas/${t.version}/schema.json`,r=["==","!=","<","<=",">",">=","CONTAINS"];function _(){JsonUnifier.init({animateOperation:animateOperation,canvasElementOperation:canvasElementOperation,canvasOperation:canvasOperation,effectOperation:effectOperation,imageContainerOperation:imageContainerOperation,imageOperation:imageOperation,textOperation:textOperation,narrationOperation:narrationOperation,loadAssets:loadAssets,soundOperation:soundOperation,videoOperation:videoOperation,setStorageValue:setStorageValue,setInitialStorageValue:setInitialStorageValue,getLogichValue:VariableGetter.getLogichValue,getConditionalStep:getConditionalStep});}
2
- export{i as PIXIVNJSON_PARAM_ID,e as PIXIVNJSON_SCHEMA_URL,r as PixiVNJsonComparationOperators,_ as init};
1
+ import {getConditionalStep,VariableGetter,setInitialStorageValue,setStorageValue,videoOperation,soundOperation,loadAssets,narrationOperation,textOperation,imageOperation,imageContainerOperation,effectOperation,canvasOperation,canvasElementOperation,animateOperation}from'@drincs/pixi-vn-json/actions';export{VariableGetter}from'@drincs/pixi-vn-json/actions';import {JsonUnifier}from'@drincs/pixi-vn-json/core';export*from'@drincs/pixi-vn-json/interpreter';export*from'@drincs/pixi-vn-json/translator';var t={version:"1.13.17"};var e="___param___",i=`https://pixi-vn.com/schemas/${t.version}/schema.json`,r=["==","!=","<","<=",">",">=","CONTAINS"];function _(){JsonUnifier.init({animateOperation:animateOperation,canvasElementOperation:canvasElementOperation,canvasOperation:canvasOperation,effectOperation:effectOperation,imageContainerOperation:imageContainerOperation,imageOperation:imageOperation,textOperation:textOperation,narrationOperation:narrationOperation,loadAssets:loadAssets,soundOperation:soundOperation,videoOperation:videoOperation,setStorageValue:setStorageValue,setInitialStorageValue:setInitialStorageValue,getLogichValue:VariableGetter.getLogichValue,getConditionalStep:getConditionalStep});}
2
+ export{e as PIXIVNJSON_PARAM_ID,i as PIXIVNJSON_SCHEMA_URL,r as PixiVNJsonComparationOperators,_ as init};