@drincs/pixi-vn-json 1.13.16 → 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 Ce(e){let i=core.JsonUnifier.getLogichValue(e,{});if(i)switch(i.type){case "assets":switch(i.operationType){case "load":await canvas.Assets.load(i.aliases);break;case "lazyload":canvas.Assets.backgroundLoad(i.aliases);break}break;case "bundle":switch(i.operationType){case "load":await canvas.Assets.loadBundle(i.aliases);break;case "lazyload":canvas.Assets.backgroundLoadBundle(i.aliases);break}break}}var 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,i,t){switch(t.type){case "fade":await canvas.showWithFade(i.alias,e,t.props,t.priority);break;case "dissolve":await canvas.showWithDissolve(i.alias,e,t.props,t.priority);break;case "movein":case "moveout":await canvas.moveIn(i.alias,e,t.props,t.priority);break;case "zoomin":case "zoomout":await canvas.zoomIn(i.alias,e,t.props,t.priority);break;case "pushin":case "pushout":await canvas.pushIn(i.alias,e,t.props,t.priority);break}}function N(e){if(e.transition)switch(e.transition.type){case "fade":canvas.removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":canvas.removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":canvas.moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":canvas.zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":canvas.pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.canvas.remove(e.alias);}async function Ee(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageSprite(e.props,e.url||e.alias);await J(i,e,e.transition);}else await canvas.showImage(e.alias,e.url,e.props);break;case "edit":{let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`Image with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function Re(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.VideoSprite(e.props,e.url||e.alias);await J(i,e,e.transition);}else await canvas.showVideo(e.alias,e.url,e.props);break;case "edit":{let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`Video with alias ${e.alias} not found.`);break}case "remove":N(e);break;case "pause":case "resume":{let i=canvas.canvas.find(e.alias);i?i.paused=e.operationType==="pause":a.error(`Video with alias ${e.alias} not found.`);break}}}async function _e(e){switch(e.operationType){case "show":if(e.transition){let i=new canvas.ImageContainer(e.props,e.urls);await J(i,e,e.transition);}else await canvas.showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function De(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.translator.t(e.text),e.transition){let i=new canvas.Text(e.props);await J(i,e,e.transition);}else canvas.showText(e.alias,e.text,e.props);break;case "edit":{let i=canvas.canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`Text with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function ze(e){switch(e.operationType){case "edit":try{let i=canvas.canvas.find(e.alias);i?e.props&&i.setMemory({...i.memory,...e.props}):a.error(`Canvas Element with alias ${e.alias} not found.`);}catch(i){a.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,i);}break;case "remove":N(e);break}}function Me(e){e.operationType==="clear"&&canvas.canvas.removeAll();}async function Ge(e){e.type==="shake"&&await canvas.shakeEffect(e.alias,e.props,e.priority);}function $e(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={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 We=["dissolve","fade","movein","zoomin","pushin"];async function Be(e,i,t,n){switch(t){case "dissolve":return canvas.showWithDissolve(e,i,n);case "fade":return canvas.showWithFade(e,i,n);case "movein":return canvas.moveIn(e,i,n);case "zoomin":return canvas.zoomIn(e,i,n);case "pushin":return canvas.pushIn(e,i,n)}}function Ye(e){switch(e.type){case "input":narration.narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.narration.dialogue=void 0;break}}function et(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(([i,t])=>{let n=sound.sound.find(e.alias);n&&(i==="volume"?n.volume.value=t:n.paused=t);});break}}var S="___param___";var V=class e{static init(i){i.loadAssets&&(e._loadAssets=i.loadAssets),i.soundOperation&&(e._soundOperation=i.soundOperation),i.imageOperation&&(e._imageOperation=i.imageOperation),i.videoOperation&&(e._videoOperation=i.videoOperation),i.imageContainerOperation&&(e._imageContainerOperation=i.imageContainerOperation),i.textOperation&&(e._textOperation=i.textOperation),i.canvasElementOperation&&(e._canvasElementOperation=i.canvasElementOperation),i.setStorageValue&&(e._setStorageValue=i.setStorageValue),i.setInitialStorageValue&&(e._setInitialStorageValue=i.setInitialStorageValue),i.narrationOperation&&(e._narrationOperation=i.narrationOperation),i.effectOperation&&(e._effectOperation=i.effectOperation),i.animateOperation&&(e._animateOperation=i.animateOperation),i.canvasOperation&&(e._canvasOperation=i.canvasOperation),i.getLogichValue&&(e._getLogichValue=i.getLogichValue),i.getConditionalStep&&(e._getConditionalStep=i.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 _(e,i){if(i&&typeof i=="object"&&typeof e.functionName=="string"&&e.functionName in i){let t=i[e.functionName];if(typeof t=="function"){let n=e.args.map(o=>V.getLogichValue(o,i));return t(...n)}else a.warn(`getLogichValue function ${e.functionName} not found in props`);}}function D(e,i){let t=core.JsonUnifier.getLogichValue(e,i);return t&&typeof t=="object"&&"type"in t?core.JsonUnifier.getLogichValue(t,i):t}function Nt(e,i={}){let t=D(e.value,i);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 n=storage.storage.get(`${S}${narration.narration.openedLabels.length-1}`)||[];n.length>e.key&&(n[e.key]=t),storage.storage.setTempVariable(`${S}${narration.narration.openedLabels.length-1}`,n);break}}}function vt(e,i={}){let t=D(e.value,i);switch(e.storageType){case "storage":case "tempstorage":storage.storage.default={[e.key]:t};break}}function A(e,i={}){let t=k(e,i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "value":return he(t,i);case "arithmetic":case "arithmeticsingle":return Ve(t,i);case "compare":case "union":return Pe(t,i);case "function":return _(t,i)}return t}function Ve(e,i){let t=core.JsonUnifier.getLogichValue(e.leftValue,i);switch(e.type){case "arithmetic":{let n=core.JsonUnifier.getLogichValue(e.rightValue,i);switch(e.operator){case "*":return t*n;case "/":return t/n;case "+":return typeof t=="string"||typeof n=="string"?`${t}${n}`:Array.isArray(t)&&Array.isArray(n)?[...t,...n]:Array.isArray(t)?[...t,n]:Array.isArray(n)?[t,...n]:t+n;case "-":if(Array.isArray(t)&&Array.isArray(n))return t.filter(o=>!n.includes(o));if(Array.isArray(t))return t.filter(o=>o!==n);if(Array.isArray(n)){a.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return t-n;case "%":return t%n;case "POW":return t**n;case "RANDOM":return narration.narration.getRandomNumber(t,n);case "INTERSECTION":if(Array.isArray(t)&&Array.isArray(n))return t.filter(o=>n.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 he(e,i){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,i);case "params":{let t=storage.storage.get(`${S}${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 Pe(e,i){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,i),n=core.JsonUnifier.getLogichValue(e.rightValue,i);switch(e.operator){case "==":return Array.isArray(t)&&Array.isArray(n)?t.length===n.length&&t.every(o=>n.includes(o)):t===n;case "!=":return Array.isArray(t)&&Array.isArray(n)?t.length!==n.length||!t.every(o=>n.includes(o)):t!==n;case "<":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)<0:Array.isArray(t)&&Array.isArray(n)?t.length<n.length:t<n;case "<=":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)<=0:Array.isArray(t)&&Array.isArray(n)?t.length<=n.length:t<=n;case ">":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)>0:Array.isArray(t)&&Array.isArray(n)?t.length>n.length:t>n;case ">=":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)>=0:Array.isArray(t)&&Array.isArray(n)?t.length>=n.length:t>=n;case "CONTAINS":return Array.isArray(t)&&Array.isArray(n)?n.every(o=>t.includes(o)):Array.isArray(t)?t.includes(n):t.toString().includes(n.toString())}break}case "value":{let t=core.JsonUnifier.getLogichValue(e,i);return Array.isArray(t)?t.length>0:t&&typeof t=="object"?Object.keys(t).length>0:!!t}case "union":return Ne(e,i)}return !!e}function Ne(e,i){if(e.unionType==="not"){let n=A(e.condition,i);return Array.isArray(n)?n.length===0:n&&typeof n=="object"?Object.keys(n).length===0:!n}let t=n=>core.JsonUnifier.getLogichValue(n,i)||false;return e.unionType==="and"?e.conditions.every(t):e.conditions.some(t)}function ve(e,i){return Math.floor(Math.random()*(i-e+1)+e)}function k(e,i={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Te(e,i);case "ifelse":return core.JsonUnifier.getLogichValue(e.condition,i)?core.JsonUnifier.getLogichValue(e.then,i):core.JsonUnifier.getLogichValue(e.else,i);case "stepswitch":{let t=core.JsonUnifier.getLogichValue(e.elements,i)||[];if(t.length===0){a.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let n=ve(0,t.length-1);return core.JsonUnifier.getLogichValue(t[n],i)}case "loop":{let n=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>t.length-1?(n=n%t.length,core.JsonUnifier.getLogichValue(t[n],i)):core.JsonUnifier.getLogichValue(t[n],i)}case "sequential":{let n,o=narration.NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(n=core.JsonUnifier.getLogichValue(t[t.length-1],i)),o>t.length-1?n:core.JsonUnifier.getLogichValue(t[o],i)}case "sequentialrandom":{let n=narration.NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:e.nestedId,onceOnly:true});if(n===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]],i)}if(n===void 0){a.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return core.JsonUnifier.getLogichValue(t[n],i)}}}}return e}function z(e,i={}){if(e.conditionalStep){let t=pixiVn.createExportableElement(core.JsonUnifier.getLogichValue(e.conditionalStep,i));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 n={...e,conditionalStep:void 0,...t};return z(n,i)}else narration.narration.dialogGlue&&(narration.narration.dialogGlue=false);}return e}function Te(e,i){let t=e.firstItem,n=(e.secondConditionalItem??[]).flatMap(r=>Array.isArray(r)?r.map(p=>core.JsonUnifier.getLogichValue(p,i)):[core.JsonUnifier.getLogichValue(r,i)]),o=t?[t,...n]:n;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,h=false,P=r.map((c,b)=>{c=z(c,i);let l=core.JsonUnifier.getLogichValue(c.dialogue,i)||"";return b===0?(p=core.JsonUnifier.getLogichValue(c.glueEnabled,i)||false,l):(typeof l=="object"&&"text"in l&&(l=`${l.character}: ${l.text}`),p===false&&h&&(l=`
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
- ${l}`),l&&(h=true),p=core.JsonUnifier.getLogichValue(c.glueEnabled,i)||false,l)}),g=core.JsonUnifier.getLogichValue(P[0],i),x=typeof g=="object"&&"character"in g?g.character:void 0,v=P.flatMap(c=>{let b;c&&typeof c=="object"&&"text"in c?b=c.text:b=c;let l;return Array.isArray(b)?l=b.map($=>{let F=core.JsonUnifier.getLogichValue($,i);return translator.translator.t(`${F}`)}):l=core.JsonUnifier.getLogichValue(b,i)||"",translator.translator.t(l)}),O=r.find(c=>c.end),M=r.find(c=>c.choices),I=false,L=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,L=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:v}:v,end:O?.end,choices:M?.choices,glueEnabled:I,goNextStep:L,labelToOpen:G?.labelToOpen,operations:C}}}exports.VariableGetter=void 0;(o=>{let e=new Set;function i(r){e.add(r);}o.add=i;function t(){e.clear();}o.clear=t;function n(r,p={}){let h=x=>A(x,p)??void 0,P=k(r,p);if(e.size===0)return h(P);let g=h;for(let x of e){let v=g;g=O=>x(O,v)??void 0;}return g(P)}o.getLogichValue=n;})(exports.VariableGetter||={});exports.ENTRANCE_TRANSITION_TYPES=We;exports.animateOperation=$e;exports.canvasElementOperation=ze;exports.canvasOperation=Me;exports.effectOperation=Ge;exports.entranceTransitionKeySchemas=ue;exports.executeEntranceTransition=Be;exports.getConditionalStep=z;exports.getLogichValue=A;exports.getValueFromConditionalStatements=k;exports.imageContainerOperation=_e;exports.imageOperation=Ee;exports.loadAssets=Ce;exports.narrationOperation=Ye;exports.setInitialStorageValue=vt;exports.setStorageValue=Nt;exports.soundOperation=et;exports.textOperation=De;exports.videoOperation=Re;
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;
@@ -68,6 +68,19 @@ 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
+
71
84
  /**
72
85
  * GENERATED FILE — do not edit by hand.
73
86
  * Produced by `scripts/generate-entrance-transition-schemas.mjs` from
@@ -175,4 +188,4 @@ declare function getValueFromConditionalStatements<T>(statement: PixiVNJsonCondi
175
188
  */
176
189
  declare function getConditionalStep(originalStep: PixiVNJsonLabelStep, props?: StepLabelPropsType): PixiVNJsonLabelStep;
177
190
 
178
- export { ENTRANCE_TRANSITION_TYPES, type EntranceTransitionType, animateOperation, canvasElementOperation, canvasOperation, effectOperation, entranceTransitionKeySchemas, executeEntranceTransition, 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
@@ -68,6 +68,19 @@ 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
+
71
84
  /**
72
85
  * GENERATED FILE — do not edit by hand.
73
86
  * Produced by `scripts/generate-entrance-transition-schemas.mjs` from
@@ -175,4 +188,4 @@ declare function getValueFromConditionalStatements<T>(statement: PixiVNJsonCondi
175
188
  */
176
189
  declare function getConditionalStep(originalStep: PixiVNJsonLabelStep, props?: StepLabelPropsType): PixiVNJsonLabelStep;
177
190
 
178
- export { ENTRANCE_TRANSITION_TYPES, type EntranceTransitionType, animateOperation, canvasElementOperation, canvasOperation, effectOperation, entranceTransitionKeySchemas, executeEntranceTransition, 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,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 Ce(e){let i=JsonUnifier.getLogichValue(e,{});if(i)switch(i.type){case "assets":switch(i.operationType){case "load":await Assets.load(i.aliases);break;case "lazyload":Assets.backgroundLoad(i.aliases);break}break;case "bundle":switch(i.operationType){case "load":await Assets.loadBundle(i.aliases);break;case "lazyload":Assets.backgroundLoadBundle(i.aliases);break}break}}var 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,i,t){switch(t.type){case "fade":await showWithFade(i.alias,e,t.props,t.priority);break;case "dissolve":await showWithDissolve(i.alias,e,t.props,t.priority);break;case "movein":case "moveout":await moveIn(i.alias,e,t.props,t.priority);break;case "zoomin":case "zoomout":await zoomIn(i.alias,e,t.props,t.priority);break;case "pushin":case "pushout":await pushIn(i.alias,e,t.props,t.priority);break}}function N(e){if(e.transition)switch(e.transition.type){case "fade":removeWithFade(e.alias,e.transition.props,e.transition.priority);break;case "dissolve":removeWithDissolve(e.alias,e.transition.props,e.transition.priority);break;case "movein":case "moveout":moveOut(e.alias,e.transition.props,e.transition.priority);break;case "zoomin":case "zoomout":zoomOut(e.alias,e.transition.props,e.transition.priority);break;case "pushin":case "pushout":pushOut(e.alias,e.transition.props,e.transition.priority);break}else canvas.remove(e.alias);}async function Ee(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageSprite(e.props,e.url||e.alias);await J(i,e,e.transition);}else await showImage(e.alias,e.url,e.props);break;case "edit":{let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`Image with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function Re(e){switch(e.operationType){case "show":if(e.transition){let i=new VideoSprite(e.props,e.url||e.alias);await J(i,e,e.transition);}else await showVideo(e.alias,e.url,e.props);break;case "edit":{let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`Video with alias ${e.alias} not found.`);break}case "remove":N(e);break;case "pause":case "resume":{let i=canvas.find(e.alias);i?i.paused=e.operationType==="pause":a.error(`Video with alias ${e.alias} not found.`);break}}}async function _e(e){switch(e.operationType){case "show":if(e.transition){let i=new ImageContainer(e.props,e.urls);await J(i,e,e.transition);}else await showImageContainer(e.alias,e.urls,e.props);break;case "edit":{let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`ImageContainer with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function De(e){switch(e.operationType){case "show":if(e.props=e.props||{},e.props.text=translator.t(e.text),e.transition){let i=new Text(e.props);await J(i,e,e.transition);}else showText(e.alias,e.text,e.props);break;case "edit":{let i=canvas.find(e.alias);i?e.props&&await i.setMemory({...i.memory,...e.props}):a.error(`Text with alias ${e.alias} not found.`);break}case "remove":N(e);break}}async function ze(e){switch(e.operationType){case "edit":try{let i=canvas.find(e.alias);i?e.props&&i.setMemory({...i.memory,...e.props}):a.error(`Canvas Element with alias ${e.alias} not found.`);}catch(i){a.error(`There was an error while trying to edit the canvas element with alias ${e.alias}.`,i);}break;case "remove":N(e);break}}function Me(e){e.operationType==="clear"&&canvas.removeAll();}async function Ge(e){e.type==="shake"&&await shakeEffect(e.alias,e.props,e.priority);}function $e(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={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 We=["dissolve","fade","movein","zoomin","pushin"];async function Be(e,i,t,n){switch(t){case "dissolve":return showWithDissolve(e,i,n);case "fade":return showWithFade(e,i,n);case "movein":return moveIn(e,i,n);case "zoomin":return zoomIn(e,i,n);case "pushin":return pushIn(e,i,n)}}function Ye(e){switch(e.type){case "input":narration.requestInput({type:e.valueType},e.defaultValue);break;case "dialogue":narration.dialogue=void 0;break}}function et(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(([i,t])=>{let n=sound.find(e.alias);n&&(i==="volume"?n.volume.value=t:n.paused=t);});break}}var S="___param___";var V=class e{static init(i){i.loadAssets&&(e._loadAssets=i.loadAssets),i.soundOperation&&(e._soundOperation=i.soundOperation),i.imageOperation&&(e._imageOperation=i.imageOperation),i.videoOperation&&(e._videoOperation=i.videoOperation),i.imageContainerOperation&&(e._imageContainerOperation=i.imageContainerOperation),i.textOperation&&(e._textOperation=i.textOperation),i.canvasElementOperation&&(e._canvasElementOperation=i.canvasElementOperation),i.setStorageValue&&(e._setStorageValue=i.setStorageValue),i.setInitialStorageValue&&(e._setInitialStorageValue=i.setInitialStorageValue),i.narrationOperation&&(e._narrationOperation=i.narrationOperation),i.effectOperation&&(e._effectOperation=i.effectOperation),i.animateOperation&&(e._animateOperation=i.animateOperation),i.canvasOperation&&(e._canvasOperation=i.canvasOperation),i.getLogichValue&&(e._getLogichValue=i.getLogichValue),i.getConditionalStep&&(e._getConditionalStep=i.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 _(e,i){if(i&&typeof i=="object"&&typeof e.functionName=="string"&&e.functionName in i){let t=i[e.functionName];if(typeof t=="function"){let n=e.args.map(o=>V.getLogichValue(o,i));return t(...n)}else a.warn(`getLogichValue function ${e.functionName} not found in props`);}}function D(e,i){let t=JsonUnifier.getLogichValue(e,i);return t&&typeof t=="object"&&"type"in t?JsonUnifier.getLogichValue(t,i):t}function Nt(e,i={}){let t=D(e.value,i);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 n=storage.get(`${S}${narration.openedLabels.length-1}`)||[];n.length>e.key&&(n[e.key]=t),storage.setTempVariable(`${S}${narration.openedLabels.length-1}`,n);break}}}function vt(e,i={}){let t=D(e.value,i);switch(e.storageType){case "storage":case "tempstorage":storage.default={[e.key]:t};break}}function A(e,i={}){let t=k(e,i);if(t&&typeof t=="object"&&"type"in t)switch(t.type){case "value":return he(t,i);case "arithmetic":case "arithmeticsingle":return Ve(t,i);case "compare":case "union":return Pe(t,i);case "function":return _(t,i)}return t}function Ve(e,i){let t=JsonUnifier.getLogichValue(e.leftValue,i);switch(e.type){case "arithmetic":{let n=JsonUnifier.getLogichValue(e.rightValue,i);switch(e.operator){case "*":return t*n;case "/":return t/n;case "+":return typeof t=="string"||typeof n=="string"?`${t}${n}`:Array.isArray(t)&&Array.isArray(n)?[...t,...n]:Array.isArray(t)?[...t,n]:Array.isArray(n)?[t,...n]:t+n;case "-":if(Array.isArray(t)&&Array.isArray(n))return t.filter(o=>!n.includes(o));if(Array.isArray(t))return t.filter(o=>o!==n);if(Array.isArray(n)){a.warn("getValueFromArithmeticOperations cannot subtract array from non-array");return}return t-n;case "%":return t%n;case "POW":return t**n;case "RANDOM":return narration.getRandomNumber(t,n);case "INTERSECTION":if(Array.isArray(t)&&Array.isArray(n))return t.filter(o=>n.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 he(e,i){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,i);case "params":{let t=storage.get(`${S}${narration.openedLabels.length-1}`)||[];if(t&&t.length>e.key)return t[e.key];a.warn("getValue params not found");return}}return e}function Pe(e,i){if(!e)return false;if(typeof e!="object"||!("type"in e))return !!e;switch(e.type){case "compare":{let t=JsonUnifier.getLogichValue(e.leftValue,i),n=JsonUnifier.getLogichValue(e.rightValue,i);switch(e.operator){case "==":return Array.isArray(t)&&Array.isArray(n)?t.length===n.length&&t.every(o=>n.includes(o)):t===n;case "!=":return Array.isArray(t)&&Array.isArray(n)?t.length!==n.length||!t.every(o=>n.includes(o)):t!==n;case "<":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)<0:Array.isArray(t)&&Array.isArray(n)?t.length<n.length:t<n;case "<=":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)<=0:Array.isArray(t)&&Array.isArray(n)?t.length<=n.length:t<=n;case ">":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)>0:Array.isArray(t)&&Array.isArray(n)?t.length>n.length:t>n;case ">=":return typeof t=="string"&&typeof n=="string"?t.localeCompare(n)>=0:Array.isArray(t)&&Array.isArray(n)?t.length>=n.length:t>=n;case "CONTAINS":return Array.isArray(t)&&Array.isArray(n)?n.every(o=>t.includes(o)):Array.isArray(t)?t.includes(n):t.toString().includes(n.toString())}break}case "value":{let t=JsonUnifier.getLogichValue(e,i);return Array.isArray(t)?t.length>0:t&&typeof t=="object"?Object.keys(t).length>0:!!t}case "union":return Ne(e,i)}return !!e}function Ne(e,i){if(e.unionType==="not"){let n=A(e.condition,i);return Array.isArray(n)?n.length===0:n&&typeof n=="object"?Object.keys(n).length===0:!n}let t=n=>JsonUnifier.getLogichValue(n,i)||false;return e.unionType==="and"?e.conditions.every(t):e.conditions.some(t)}function ve(e,i){return Math.floor(Math.random()*(i-e+1)+e)}function k(e,i={}){if(Array.isArray(e)||!e)return e;if(e&&typeof e=="object"&&"type"in e)switch(e.type){case "resulttocombine":return Te(e,i);case "ifelse":return JsonUnifier.getLogichValue(e.condition,i)?JsonUnifier.getLogichValue(e.then,i):JsonUnifier.getLogichValue(e.else,i);case "stepswitch":{let t=JsonUnifier.getLogichValue(e.elements,i)||[];if(t.length===0){a.error("getValueFromConditionalStatements elements.length === 0");return}switch(e.choiceType){case "random":{let n=ve(0,t.length-1);return JsonUnifier.getLogichValue(t[n],i)}case "loop":{let n=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return n>t.length-1?(n=n%t.length,JsonUnifier.getLogichValue(t[n],i)):JsonUnifier.getLogichValue(t[n],i)}case "sequential":{let n,o=NarrationManagerStatic.getCurrentStepTimesCounter(e.nestedId)-1;return e.end==="lastItem"&&(n=JsonUnifier.getLogichValue(t[t.length-1],i)),o>t.length-1?n:JsonUnifier.getLogichValue(t[o],i)}case "sequentialrandom":{let n=NarrationManagerStatic.getRandomNumber(0,t.length-1,{nestedId:e.nestedId,onceOnly:true});if(n===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]],i)}if(n===void 0){a.warn("getValueFromConditionalStatements randomIndexWhitExclude == undefined");return}return JsonUnifier.getLogichValue(t[n],i)}}}}return e}function z(e,i={}){if(e.conditionalStep){let t=createExportableElement(JsonUnifier.getLogichValue(e.conditionalStep,i));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 n={...e,conditionalStep:void 0,...t};return z(n,i)}else narration.dialogGlue&&(narration.dialogGlue=false);}return e}function Te(e,i){let t=e.firstItem,n=(e.secondConditionalItem??[]).flatMap(r=>Array.isArray(r)?r.map(p=>JsonUnifier.getLogichValue(p,i)):[JsonUnifier.getLogichValue(r,i)]),o=t?[t,...n]:n;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,h=false,P=r.map((c,b)=>{c=z(c,i);let l=JsonUnifier.getLogichValue(c.dialogue,i)||"";return b===0?(p=JsonUnifier.getLogichValue(c.glueEnabled,i)||false,l):(typeof l=="object"&&"text"in l&&(l=`${l.character}: ${l.text}`),p===false&&h&&(l=`
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
- ${l}`),l&&(h=true),p=JsonUnifier.getLogichValue(c.glueEnabled,i)||false,l)}),g=JsonUnifier.getLogichValue(P[0],i),x=typeof g=="object"&&"character"in g?g.character:void 0,v=P.flatMap(c=>{let b;c&&typeof c=="object"&&"text"in c?b=c.text:b=c;let l;return Array.isArray(b)?l=b.map($=>{let F=JsonUnifier.getLogichValue($,i);return translator.t(`${F}`)}):l=JsonUnifier.getLogichValue(b,i)||"",translator.t(l)}),O=r.find(c=>c.end),M=r.find(c=>c.choices),I=false,L=false;r.length>0&&(r[0].glueEnabled&&r[0].goNextStep&&r[0].dialogue===void 0&&(narration.dialogGlue=true),I=r[r.length-1].glueEnabled,L=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:v}:v,end:O?.end,choices:M?.choices,glueEnabled:I,goNextStep:L,labelToOpen:G?.labelToOpen,operations:C}}}var Je;(o=>{let e=new Set;function i(r){e.add(r);}o.add=i;function t(){e.clear();}o.clear=t;function n(r,p={}){let h=x=>A(x,p)??void 0,P=k(r,p);if(e.size===0)return h(P);let g=h;for(let x of e){let v=g;g=O=>x(O,v)??void 0;}return g(P)}o.getLogichValue=n;})(Je||={});export{We as ENTRANCE_TRANSITION_TYPES,Je as VariableGetter,$e as animateOperation,ze as canvasElementOperation,Me as canvasOperation,Ge as effectOperation,ue as entranceTransitionKeySchemas,Be as executeEntranceTransition,z as getConditionalStep,A as getLogichValue,k as getValueFromConditionalStatements,_e as imageContainerOperation,Ee as imageOperation,Ce as loadAssets,Ye as narrationOperation,vt as setInitialStorageValue,Nt as setStorageValue,et as soundOperation,De as textOperation,Re 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 s={version:"1.13.16"};var r="___param___",o=`https://pixi-vn.com/schemas/${s.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 s={version:"1.13.16"};var r="___param___",o=`https://pixi-vn.com/schemas/${s.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.16"};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});}
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
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.16"};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});}
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
2
  export{e as PIXIVNJSON_PARAM_ID,i as PIXIVNJSON_SCHEMA_URL,r as PixiVNJsonComparationOperators,_ as init};
@@ -1 +1 @@
1
- 'use strict';var pixiVn=require('@drincs/pixi-vn'),core=require('@drincs/pixi-vn-json/core'),translator=require('@drincs/pixi-vn-json/translator'),narration=require('@drincs/pixi-vn/narration'),storage=require('@drincs/pixi-vn/storage');var Z=Object.create;var $=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var k=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var M=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var oe=(n,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ie(e))!ne.call(n,s)&&s!==o&&$(n,s,{get:()=>e[s],enumerable:!(t=ee(e,s))||t.enumerable});return n};var re=(n,e,o)=>(o=n!=null?Z(te(n)):{},oe($(o,"default",{value:n,enumerable:true}),n));var F=M((T,G)=>{(function(n,e){typeof T=="object"?G.exports=T=e():typeof define=="function"&&define.amd?define([],e):n.CryptoJS=e();})(T,function(){var n=n||(function(e,o){var t;if(typeof window<"u"&&window.crypto&&(t=window.crypto),typeof self<"u"&&self.crypto&&(t=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(t=globalThis.crypto),!t&&typeof window<"u"&&window.msCrypto&&(t=window.msCrypto),!t&&typeof global<"u"&&global.crypto&&(t=global.crypto),!t&&typeof k=="function")try{t=k("crypto");}catch{}var s=function(){if(t){if(typeof t.getRandomValues=="function")try{return t.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof t.randomBytes=="function")try{return t.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},p=Object.create||(function(){function i(){}return function(a){var c;return i.prototype=a,c=new i,i.prototype=null,c}})(),r={},x=r.lib={},m=x.Base=(function(){return {extend:function(i){var a=p(this);return i&&a.mixIn(i),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var a in i)i.hasOwnProperty(a)&&(this[a]=i[a]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),h=x.WordArray=m.extend({init:function(i,a){i=this.words=i||[],a!=o?this.sigBytes=a:this.sigBytes=i.length*4;},toString:function(i){return (i||N).stringify(this)},concat:function(i){var a=this.words,c=i.words,d=this.sigBytes,y=i.sigBytes;if(this.clamp(),d%4)for(var J=0;J<y;J++){var I=c[J>>>2]>>>24-J%4*8&255;a[d+J>>>2]|=I<<24-(d+J)%4*8;}else for(var C=0;C<y;C+=4)a[d+C>>>2]=c[C>>>2];return this.sigBytes+=y,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=e.ceil(a/4);},clone:function(){var i=m.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var a=[],c=0;c<i;c+=4)a.push(s());return new h.init(a,i)}}),u=r.enc={},N=u.Hex={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var J=a[y>>>2]>>>24-y%4*8&255;d.push((J>>>4).toString(16)),d.push((J&15).toString(16));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d+=2)c[d>>>3]|=parseInt(i.substr(d,2),16)<<24-d%8*4;return new h.init(c,a/2)}},V=u.Latin1={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var J=a[y>>>2]>>>24-y%4*8&255;d.push(String.fromCharCode(J));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d++)c[d>>>2]|=(i.charCodeAt(d)&255)<<24-d%4*8;return new h.init(c,a)}},g=u.Utf8={stringify:function(i){try{return decodeURIComponent(escape(V.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return V.parse(unescape(encodeURIComponent(i)))}},l=x.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=g.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var a,c=this._data,d=c.words,y=c.sigBytes,J=this.blockSize,I=J*4,C=y/I;i?C=e.ceil(C):C=e.max((C|0)-this._minBufferSize,0);var A=C*J,H=e.min(A*4,y);if(A){for(var z=0;z<A;z+=J)this._doProcessBlock(d,z);a=d.splice(0,A),c.sigBytes-=H;}return new h.init(a,H)},clone:function(){var i=m.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});x.Hasher=l.extend({cfg:m.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){l.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(i){return function(a,c){return new i.init(c).finalize(a)}},_createHmacHelper:function(i){return function(a,c){return new v.HMAC.init(i,c).finalize(a)}}});var v=r.algo={};return r})(Math);return n});});var K=M((E,X)=>{(function(n,e){typeof E=="object"?X.exports=E=e(F()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS);})(E,function(n){return (function(){var e=n,o=e.lib,t=o.WordArray,s=o.Hasher,p=e.algo,r=[],x=p.SHA1=s.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(m,h){for(var u=this._hash.words,N=u[0],V=u[1],g=u[2],l=u[3],w=u[4],v=0;v<80;v++){if(v<16)r[v]=m[h+v]|0;else {var i=r[v-3]^r[v-8]^r[v-14]^r[v-16];r[v]=i<<1|i>>>31;}var a=(N<<5|N>>>27)+w+r[v];v<20?a+=(V&g|~V&l)+1518500249:v<40?a+=(V^g^l)+1859775393:v<60?a+=(V&g|V&l|g&l)-1894007588:a+=(V^g^l)-899497514,w=l,l=g,g=V<<30|V>>>2,V=N,N=a;}u[0]=u[0]+N|0,u[1]=u[1]+V|0,u[2]=u[2]+g|0,u[3]=u[3]+l|0,u[4]=u[4]+w|0;},_doFinalize:function(){var m=this._data,h=m.words,u=this._nDataBytes*8,N=m.sigBytes*8;return h[N>>>5]|=128<<24-N%32,h[(N+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(N+64>>>9<<4)+15]=u,m.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var m=s.clone.call(this);return m._hash=this._hash.clone(),m}});e.SHA1=s._createHelper(x),e.HmacSHA1=s._createHmacHelper(x);})(),n.SHA1});});var B="___param___";var f;(s=>(s.log=(p,...r)=>console.log(`[Pixi\u2019VN Json] ${p}`,...r),s.warn=(p,...r)=>console.warn(`[Pixi\u2019VN Json] ${p}`,...r),s.error=(p,...r)=>console.error(`[Pixi\u2019VN Json] ${p}`,...r),s.info=(p,...r)=>console.info(`[Pixi\u2019VN Json] ${p}`,...r)))(f||={});var L=class n{static init(e){e.loadAssets&&(n._loadAssets=e.loadAssets),e.soundOperation&&(n._soundOperation=e.soundOperation),e.imageOperation&&(n._imageOperation=e.imageOperation),e.videoOperation&&(n._videoOperation=e.videoOperation),e.imageContainerOperation&&(n._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(n._textOperation=e.textOperation),e.canvasElementOperation&&(n._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(n._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(n._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(n._narrationOperation=e.narrationOperation),e.effectOperation&&(n._effectOperation=e.effectOperation),e.animateOperation&&(n._animateOperation=e.animateOperation),e.canvasOperation&&(n._canvasOperation=e.canvasOperation),e.getLogichValue&&(n._getLogichValue=e.getLogichValue),e.getConditionalStep&&(n._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return n._loadAssets}static _soundOperation=()=>{throw f.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 n._soundOperation}static _imageOperation=()=>{throw f.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 n._imageOperation}static _videoOperation=()=>{throw f.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 n._videoOperation}static _imageContainerOperation=()=>{throw f.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 n._imageContainerOperation}static _textOperation=()=>{throw f.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 n._textOperation}static _canvasElementOperation=()=>{throw f.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 n._canvasElementOperation}static _setStorageValue=()=>{throw f.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 n._setStorageValue}static _setInitialStorageValue=()=>{throw f.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 n._setInitialStorageValue}static _narrationOperation=()=>{throw f.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 n._narrationOperation}static _effectOperation=()=>{throw f.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 n._effectOperation}static _animateOperation=()=>{throw f.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 n._animateOperation}static _canvasOperation=()=>{throw f.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 n._canvasOperation}static _getLogichValue=()=>{throw f.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 n._getLogichValue}static _getConditionalStep=()=>{throw f.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 n._getConditionalStep}};function q(n,e){if(e&&typeof e=="object"&&typeof n.functionName=="string"&&n.functionName in e){let o=e[n.functionName];if(typeof o=="function"){let t=n.args.map(s=>L.getLogichValue(s,e));return o(...t)}else f.warn(`getLogichValue function ${n.functionName} not found in props`);}}function W(n,e={}){let o="";return n.values.forEach(t=>{if(typeof t=="string")o+=t;else {let s=core.JsonUnifier.getLogichValue(t,e);o+=`${s}`;}}),o}async function R(n,e,o){let t=core.JsonUnifier.getLogichValue(n,e);if(t)switch(t.type){case "sound":core.JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await core.JsonUnifier.loadAssets(t);break;case "image":await core.JsonUnifier.imageOperation(t);break;case "video":await core.JsonUnifier.videoOperation(t);break;case "imagecontainer":await core.JsonUnifier.imageContainerOperation(t);break;case "text":await core.JsonUnifier.textOperation(t);break;case "canvaselement":await core.JsonUnifier.canvasElementOperation(t);break;case "canvas":core.JsonUnifier.canvasOperation(t);break;case "value":core.JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(o){let s=W(t,e),p=await o(s);p&&await R(p,e,o);}break;case "input":case "dialogue":core.JsonUnifier.narrationOperation(t);break;case "shake":await core.JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":core.JsonUnifier.animateOperation(t);break;case "function":await q(t,e);break}}function D(n){let e=core.JsonUnifier.getLogichValue(n,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&core.JsonUnifier.setInitialStorageValue(e);}var Y=re(K());var _=class extends narration.LabelAbstract{constructor(e,o,t,s={}){t||(t={}),t.onLoadingLabel=async()=>{for(let p of o){let r;if(typeof p=="function"?r=p():r=p,r=core.JsonUnifier.getConditionalStep(r),r.operations)try{let x=r.operations.map(m=>core.JsonUnifier.loadAssets(m));await Promise.all(x);}catch(x){f.error("The operation in the onLoadingLabel function of the label has an error:",x);}}},super(e,t),this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}_steps;get steps(){return this._steps.map(e=>this.stepConverter(e))}get stepCount(){return this._steps.length}getStepById(e){if(e<0||e>=this._steps.length)return;let o=this._steps[e];return this.stepConverter(o)}operationStringConvert;skipEmptyDialogs=false;getStepSha(e){if(e<0||e>=this.steps.length)return;let o=this._steps[e];return (0, Y.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(e,o){let t="";if(Array.isArray(e)){let s=[];e.forEach(p=>{if(typeof p=="string")s.push(p);else if(p&&typeof p=="object"){let r=core.JsonUnifier.getLogichValue(p,o);r?(r&&!Array.isArray(r)&&typeof r=="object"&&(r=core.JsonUnifier.getLogichValue(r,o)||""),Array.isArray(r)?s=s.map(x=>`${x}`).concat(r):s.push(`${r}`)):s.push(`${p}`);}else s.push(`${p}`);}),t=s;}else {let s=core.JsonUnifier.getLogichValue(e,o);s&&!Array.isArray(s)&&typeof s=="object"&&(s=core.JsonUnifier.getLogichValue(s,o)),s&&Array.isArray(s)?t=s.map(p=>`${p}`):t=`${s}`;}return t}getDialogue(e,o){if(e==null)return;let t=core.JsonUnifier.getLogichValue(e,o);return t==null?`${t}`:typeof t=="object"&&"character"in t&&"text"in t?{character:t.character,text:translator.translator.t(this.getDialogueText(t.text,o))}:translator.translator.t(this.getDialogueText(t,o))}getChoices(e,o){return core.JsonUnifier.getLogichValue(e,o)?.map(p=>core.JsonUnifier.getLogichValue(p,o)).filter(p=>p!==void 0)}stepConverter(e){return async o=>{let t=typeof e=="function"?e():e;t=pixiVn.createExportableElement(t),t=core.JsonUnifier.getConditionalStep(t,o);let s=this.operationStringConvert?g=>this.operationStringConvert(g,t,o):void 0,{operations:p=[]}=t;for(let g of p)await R(g,o,s);let{labelToOpen:r=[]}=t,x=this.getChoices(t.choices,o),m=core.JsonUnifier.getLogichValue(t.glueEnabled,o),h=this.getDialogue(t.dialogue,o),u=[];Array.isArray(r)||(r=[r]),r.forEach(g=>{let l=core.JsonUnifier.getLogichValue(g,o);l&&u.push(l);});let N=core.JsonUnifier.getLogichValue(t.goNextStep,o),V=core.JsonUnifier.getLogichValue(t.end,o);if(x){let g=x.map(l=>{let w="";if(Array.isArray(l.text)){let i=[];l.text.forEach(a=>{if(typeof a=="string")i.push(translator.translator.t(a));else if(a&&typeof a=="object"){let c=core.JsonUnifier.getLogichValue(a,o);c&&!Array.isArray(c)&&typeof c=="object"&&(c=core.JsonUnifier.getLogichValue(c,o)||""),c&&(Array.isArray(c)?i=i.concat(translator.translator.t(c)):i.push(translator.translator.t(c)));}}),w=i;}else typeof l.text=="string"&&(w=translator.translator.t(l.text));return {label:l.label,text:w,props:l.props,type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect}});narration.narration.choices=g;}else narration.narration.choices=void 0;h!==void 0&&(narration.narration.dialogue=h,this.skipEmptyDialogs&&typeof h=="string"&&(h===""||RegExp(/^\s+$/).test(h))&&(N=true)),m?narration.narration.dialogGlue=true:m===false&&(narration.narration.dialogGlue=false);for(let g of u){let l=g.label;typeof l=="object"&&(l=core.JsonUnifier.getLogichValue(l,o)||"");let w=g.params?.map(v=>core.JsonUnifier.getLogichValue(v,o));o={...o,...g.props},g.type==="jump"?(narration.narration.openedLabels.length>0&&narration.narration.closeCurrentLabel(),storage.storage.setTempVariable(`${B}${narration.narration.openedLabels.length}`,w),await narration.narration.call(l,o)):(storage.storage.setTempVariable(`${B}${narration.narration.openedLabels.length}`,w),await narration.narration.call(l,o));}V==="game_end"?(narration.narration.closeAllLabels(),await narration.narration.continue(o,{runNow:true})):V==="label_end"&&narration.narration.closeCurrentLabel(),N&&await narration.narration.continue(o,{runNow:true});}}};async function de(n,e={}){if(!Array.isArray(n))if(typeof n=="object"||typeof n=="string")n=[n];else {f.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let o=n.map(p=>{if(typeof p=="string")try{return JSON.parse(p)}catch(r){return f.error("Error parsing imported Pixi'VN JSON",r),{}}return p}),t=o.map(async p=>{if(p.initialOperations)for(let r of p.initialOperations)r.type==="value"&&(typeof r.value!="object"||!r.value||!("type"in r.value))&&D(r);return Promise.resolve()});await Promise.all(t);let s=o.map(async p=>{if(p.initialOperations)for(let r of p.initialOperations)(r.type!=="value"||r.type==="value"&&typeof r.value=="object"&&r.value&&"type"in r.value)&&D(r);if(p.labels){let r=p.labels;for(let x in r)try{let m=r[x],h=new _(x,m,void 0,e);narration.RegisteredLabels.add(h);}catch(m){f.error(`Error creating JSON label ${x}`,m);}}return Promise.resolve()});await Promise.all(s);}exports.LabelJson=_;exports.importPixiVNJson=de;
1
+ 'use strict';var pixiVn=require('@drincs/pixi-vn'),core=require('@drincs/pixi-vn-json/core'),translator=require('@drincs/pixi-vn-json/translator'),narration=require('@drincs/pixi-vn/narration'),storage=require('@drincs/pixi-vn/storage');var Z=Object.create;var $=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var k=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var M=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var oe=(n,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ie(e))!ne.call(n,s)&&s!==o&&$(n,s,{get:()=>e[s],enumerable:!(t=ee(e,s))||t.enumerable});return n};var re=(n,e,o)=>(o=n!=null?Z(te(n)):{},oe($(o,"default",{value:n,enumerable:true}),n));var F=M((T,G)=>{(function(n,e){typeof T=="object"?G.exports=T=e():typeof define=="function"&&define.amd?define([],e):n.CryptoJS=e();})(T,function(){var n=n||(function(e,o){var t;if(typeof window<"u"&&window.crypto&&(t=window.crypto),typeof self<"u"&&self.crypto&&(t=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(t=globalThis.crypto),!t&&typeof window<"u"&&window.msCrypto&&(t=window.msCrypto),!t&&typeof global<"u"&&global.crypto&&(t=global.crypto),!t&&typeof k=="function")try{t=k("crypto");}catch{}var s=function(){if(t){if(typeof t.getRandomValues=="function")try{return t.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof t.randomBytes=="function")try{return t.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||(function(){function i(){}return function(a){var p;return i.prototype=a,p=new i,i.prototype=null,p}})(),r={},x=r.lib={},m=x.Base=(function(){return {extend:function(i){var a=c(this);return i&&a.mixIn(i),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var a in i)i.hasOwnProperty(a)&&(this[a]=i[a]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),h=x.WordArray=m.extend({init:function(i,a){i=this.words=i||[],a!=o?this.sigBytes=a:this.sigBytes=i.length*4;},toString:function(i){return (i||N).stringify(this)},concat:function(i){var a=this.words,p=i.words,d=this.sigBytes,y=i.sigBytes;if(this.clamp(),d%4)for(var J=0;J<y;J++){var I=p[J>>>2]>>>24-J%4*8&255;a[d+J>>>2]|=I<<24-(d+J)%4*8;}else for(var C=0;C<y;C+=4)a[d+C>>>2]=p[C>>>2];return this.sigBytes+=y,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=e.ceil(a/4);},clone:function(){var i=m.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var a=[],p=0;p<i;p+=4)a.push(s());return new h.init(a,i)}}),u=r.enc={},N=u.Hex={stringify:function(i){for(var a=i.words,p=i.sigBytes,d=[],y=0;y<p;y++){var J=a[y>>>2]>>>24-y%4*8&255;d.push((J>>>4).toString(16)),d.push((J&15).toString(16));}return d.join("")},parse:function(i){for(var a=i.length,p=[],d=0;d<a;d+=2)p[d>>>3]|=parseInt(i.substr(d,2),16)<<24-d%8*4;return new h.init(p,a/2)}},V=u.Latin1={stringify:function(i){for(var a=i.words,p=i.sigBytes,d=[],y=0;y<p;y++){var J=a[y>>>2]>>>24-y%4*8&255;d.push(String.fromCharCode(J));}return d.join("")},parse:function(i){for(var a=i.length,p=[],d=0;d<a;d++)p[d>>>2]|=(i.charCodeAt(d)&255)<<24-d%4*8;return new h.init(p,a)}},g=u.Utf8={stringify:function(i){try{return decodeURIComponent(escape(V.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return V.parse(unescape(encodeURIComponent(i)))}},l=x.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=g.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var a,p=this._data,d=p.words,y=p.sigBytes,J=this.blockSize,I=J*4,C=y/I;i?C=e.ceil(C):C=e.max((C|0)-this._minBufferSize,0);var A=C*J,H=e.min(A*4,y);if(A){for(var z=0;z<A;z+=J)this._doProcessBlock(d,z);a=d.splice(0,A),p.sigBytes-=H;}return new h.init(a,H)},clone:function(){var i=m.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});x.Hasher=l.extend({cfg:m.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){l.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(i){return function(a,p){return new i.init(p).finalize(a)}},_createHmacHelper:function(i){return function(a,p){return new v.HMAC.init(i,p).finalize(a)}}});var v=r.algo={};return r})(Math);return n});});var K=M((E,X)=>{(function(n,e){typeof E=="object"?X.exports=E=e(F()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS);})(E,function(n){return (function(){var e=n,o=e.lib,t=o.WordArray,s=o.Hasher,c=e.algo,r=[],x=c.SHA1=s.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(m,h){for(var u=this._hash.words,N=u[0],V=u[1],g=u[2],l=u[3],w=u[4],v=0;v<80;v++){if(v<16)r[v]=m[h+v]|0;else {var i=r[v-3]^r[v-8]^r[v-14]^r[v-16];r[v]=i<<1|i>>>31;}var a=(N<<5|N>>>27)+w+r[v];v<20?a+=(V&g|~V&l)+1518500249:v<40?a+=(V^g^l)+1859775393:v<60?a+=(V&g|V&l|g&l)-1894007588:a+=(V^g^l)-899497514,w=l,l=g,g=V<<30|V>>>2,V=N,N=a;}u[0]=u[0]+N|0,u[1]=u[1]+V|0,u[2]=u[2]+g|0,u[3]=u[3]+l|0,u[4]=u[4]+w|0;},_doFinalize:function(){var m=this._data,h=m.words,u=this._nDataBytes*8,N=m.sigBytes*8;return h[N>>>5]|=128<<24-N%32,h[(N+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(N+64>>>9<<4)+15]=u,m.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var m=s.clone.call(this);return m._hash=this._hash.clone(),m}});e.SHA1=s._createHelper(x),e.HmacSHA1=s._createHmacHelper(x);})(),n.SHA1});});var B="___param___";var f;(s=>(s.log=(c,...r)=>console.log(`[Pixi\u2019VN Json] ${c}`,...r),s.warn=(c,...r)=>console.warn(`[Pixi\u2019VN Json] ${c}`,...r),s.error=(c,...r)=>console.error(`[Pixi\u2019VN Json] ${c}`,...r),s.info=(c,...r)=>console.info(`[Pixi\u2019VN Json] ${c}`,...r)))(f||={});var L=class n{static init(e){e.loadAssets&&(n._loadAssets=e.loadAssets),e.soundOperation&&(n._soundOperation=e.soundOperation),e.imageOperation&&(n._imageOperation=e.imageOperation),e.videoOperation&&(n._videoOperation=e.videoOperation),e.imageContainerOperation&&(n._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(n._textOperation=e.textOperation),e.canvasElementOperation&&(n._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(n._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(n._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(n._narrationOperation=e.narrationOperation),e.effectOperation&&(n._effectOperation=e.effectOperation),e.animateOperation&&(n._animateOperation=e.animateOperation),e.canvasOperation&&(n._canvasOperation=e.canvasOperation),e.getLogichValue&&(n._getLogichValue=e.getLogichValue),e.getConditionalStep&&(n._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return n._loadAssets}static _soundOperation=()=>{throw f.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 n._soundOperation}static _imageOperation=()=>{throw f.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 n._imageOperation}static _videoOperation=()=>{throw f.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 n._videoOperation}static _imageContainerOperation=()=>{throw f.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 n._imageContainerOperation}static _textOperation=()=>{throw f.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 n._textOperation}static _canvasElementOperation=()=>{throw f.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 n._canvasElementOperation}static _setStorageValue=()=>{throw f.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 n._setStorageValue}static _setInitialStorageValue=()=>{throw f.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 n._setInitialStorageValue}static _narrationOperation=()=>{throw f.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 n._narrationOperation}static _effectOperation=()=>{throw f.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 n._effectOperation}static _animateOperation=()=>{throw f.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 n._animateOperation}static _canvasOperation=()=>{throw f.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 n._canvasOperation}static _getLogichValue=()=>{throw f.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 n._getLogichValue}static _getConditionalStep=()=>{throw f.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 n._getConditionalStep}};function q(n,e){if(e&&typeof e=="object"&&typeof n.functionName=="string"&&n.functionName in e){let o=e[n.functionName];if(typeof o=="function"){let t=n.args.map(s=>L.getLogichValue(s,e));return o(...t)}else f.warn(`getLogichValue function ${n.functionName} not found in props`);}}function W(n,e={}){let o="";return n.values.forEach(t=>{if(typeof t=="string")o+=t;else {let s=core.JsonUnifier.getLogichValue(t,e);o+=`${s}`;}}),o}async function R(n,e,o){let t=core.JsonUnifier.getLogichValue(n,e);if(t)switch(t.type){case "sound":core.JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await core.JsonUnifier.loadAssets(t);break;case "image":await core.JsonUnifier.imageOperation(t);break;case "video":await core.JsonUnifier.videoOperation(t);break;case "imagecontainer":await core.JsonUnifier.imageContainerOperation(t);break;case "text":await core.JsonUnifier.textOperation(t);break;case "canvaselement":await core.JsonUnifier.canvasElementOperation(t);break;case "canvas":core.JsonUnifier.canvasOperation(t);break;case "value":core.JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(o){let s=W(t,e),c=await o(s);c&&await R(c,e,o);}break;case "input":case "dialogue":core.JsonUnifier.narrationOperation(t);break;case "shake":await core.JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":core.JsonUnifier.animateOperation(t);break;case "function":await q(t,e);break}}function D(n){let e=core.JsonUnifier.getLogichValue(n,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&core.JsonUnifier.setInitialStorageValue(e);}var Y=re(K());var _=class extends narration.LabelAbstract{constructor(e,o,t,s={}){t||(t={}),t.onLoadingLabel=async()=>{for(let c of o){let r;if(typeof c=="function"?r=c():r=c,r=core.JsonUnifier.getConditionalStep(r),r.operations)try{let x=r.operations.map(m=>core.JsonUnifier.loadAssets(m));await Promise.all(x);}catch(x){f.error("The operation in the onLoadingLabel function of the label has an error:",x);}}},super(e,t),this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}_steps;get steps(){return this._steps.map(e=>this.stepConverter(e))}get stepCount(){return this._steps.length}getStepById(e){if(e<0||e>=this._steps.length)return;let o=this._steps[e];return this.stepConverter(o)}operationStringConvert;skipEmptyDialogs=false;getStepSha(e){if(e<0||e>=this.steps.length)return;let o=this._steps[e];return (0, Y.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(e,o){let t="";if(Array.isArray(e)){let s=[];e.forEach(c=>{if(typeof c=="string")s.push(c);else if(c&&typeof c=="object"){let r=core.JsonUnifier.getLogichValue(c,o);r?(r&&!Array.isArray(r)&&typeof r=="object"&&(r=core.JsonUnifier.getLogichValue(r,o)||""),Array.isArray(r)?s=s.map(x=>`${x}`).concat(r):s.push(`${r}`)):s.push(`${c}`);}else s.push(`${c}`);}),t=s;}else {let s=core.JsonUnifier.getLogichValue(e,o);s&&!Array.isArray(s)&&typeof s=="object"&&(s=core.JsonUnifier.getLogichValue(s,o)),s&&Array.isArray(s)?t=s.map(c=>`${c}`):t=`${s}`;}return t}getDialogue(e,o){if(e==null)return;let t=core.JsonUnifier.getLogichValue(e,o);return t==null?`${t}`:typeof t=="object"&&"character"in t&&"text"in t?{character:t.character,text:translator.translator.t(this.getDialogueText(t.text,o))}:translator.translator.t(this.getDialogueText(t,o))}getChoices(e,o){return core.JsonUnifier.getLogichValue(e,o)?.map(c=>core.JsonUnifier.getLogichValue(c,o)).filter(c=>c!==void 0)}stepConverter(e){return async o=>{let t=typeof e=="function"?e():e;t=pixiVn.createExportableElement(t),t=core.JsonUnifier.getConditionalStep(t,o);let s=this.operationStringConvert?g=>this.operationStringConvert(g,t,o):void 0,{operations:c=[]}=t;for(let g of c)await R(g,o,s);let{labelToOpen:r=[]}=t,x=this.getChoices(t.choices,o),m=core.JsonUnifier.getLogichValue(t.glueEnabled,o),h=this.getDialogue(t.dialogue,o),u=[];Array.isArray(r)||(r=[r]),r.forEach(g=>{let l=core.JsonUnifier.getLogichValue(g,o);l&&u.push(l);});let N=core.JsonUnifier.getLogichValue(t.goNextStep,o),V=core.JsonUnifier.getLogichValue(t.end,o);if(x){let g=x.map(l=>{let w="";if(Array.isArray(l.text)){let i=[];l.text.forEach(a=>{if(typeof a=="string")i.push(translator.translator.t(a));else if(a&&typeof a=="object"){let p=core.JsonUnifier.getLogichValue(a,o);p&&!Array.isArray(p)&&typeof p=="object"&&(p=core.JsonUnifier.getLogichValue(p,o)||""),p&&(Array.isArray(p)?i=i.concat(translator.translator.t(p)):i.push(translator.translator.t(p)));}}),w=i;}else typeof l.text=="string"&&(w=translator.translator.t(l.text));return {label:l.label,text:w,props:l.props,type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect}});narration.narration.choices=g;}else narration.narration.choices=void 0;h!==void 0&&(narration.narration.dialogue=h,this.skipEmptyDialogs&&typeof h=="string"&&(h===""||RegExp(/^\s+$/).test(h))&&(N=true)),m?narration.narration.dialogGlue=true:m===false&&(narration.narration.dialogGlue=false);for(let g of u){let l=g.label;typeof l=="object"&&(l=core.JsonUnifier.getLogichValue(l,o)||"");let w=g.params?.map(v=>core.JsonUnifier.getLogichValue(v,o));o={...o,...g.props},g.type==="jump"?(narration.narration.openedLabels.length>0&&narration.narration.closeCurrentLabel(),storage.storage.setTempVariable(`${B}${narration.narration.openedLabels.length}`,w),await narration.narration.call(l,o)):(storage.storage.setTempVariable(`${B}${narration.narration.openedLabels.length}`,w),await narration.narration.call(l,o));}V==="game_end"?(narration.narration.closeAllLabels(),await narration.narration.continue(o,{runNow:true})):V==="label_end"&&narration.narration.closeCurrentLabel(),N&&await narration.narration.continue(o,{runNow:true});}}};async function de(n,e={}){if(!Array.isArray(n))if(typeof n=="object"||typeof n=="string")n=[n];else {f.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let o=n.map(c=>{if(typeof c=="string")try{return JSON.parse(c)}catch(r){return f.error("Error parsing imported Pixi'VN JSON",r),{}}return c}),t=o.map(async c=>{if(c.initialOperations)for(let r of c.initialOperations)r.type==="value"&&(typeof r.value!="object"||!r.value||!("type"in r.value))&&D(r);return Promise.resolve()});await Promise.all(t);let s=o.map(async c=>{if(c.initialOperations)for(let r of c.initialOperations)(r.type!=="value"||r.type==="value"&&typeof r.value=="object"&&r.value&&"type"in r.value)&&D(r);if(c.labels){let r=c.labels;for(let x in r)try{let m=r[x],h=new _(x,m,void 0,e);narration.RegisteredLabels.add(h);}catch(m){f.error(`Error creating JSON label ${x}`,m);}}return Promise.resolve()});await Promise.all(s);}exports.LabelJson=_;exports.importPixiVNJson=de;
@@ -1 +1 @@
1
- import {createExportableElement,PixiError}from'@drincs/pixi-vn';import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {translator}from'@drincs/pixi-vn-json/translator';import {LabelAbstract,narration,RegisteredLabels}from'@drincs/pixi-vn/narration';import {storage}from'@drincs/pixi-vn/storage';var Z=Object.create;var $=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var k=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var M=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var oe=(n,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ie(e))!ne.call(n,s)&&s!==o&&$(n,s,{get:()=>e[s],enumerable:!(t=ee(e,s))||t.enumerable});return n};var re=(n,e,o)=>(o=n!=null?Z(te(n)):{},oe($(o,"default",{value:n,enumerable:true}),n));var F=M((T,G)=>{(function(n,e){typeof T=="object"?G.exports=T=e():typeof define=="function"&&define.amd?define([],e):n.CryptoJS=e();})(T,function(){var n=n||(function(e,o){var t;if(typeof window<"u"&&window.crypto&&(t=window.crypto),typeof self<"u"&&self.crypto&&(t=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(t=globalThis.crypto),!t&&typeof window<"u"&&window.msCrypto&&(t=window.msCrypto),!t&&typeof global<"u"&&global.crypto&&(t=global.crypto),!t&&typeof k=="function")try{t=k("crypto");}catch{}var s=function(){if(t){if(typeof t.getRandomValues=="function")try{return t.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof t.randomBytes=="function")try{return t.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},p=Object.create||(function(){function i(){}return function(a){var c;return i.prototype=a,c=new i,i.prototype=null,c}})(),r={},x=r.lib={},m=x.Base=(function(){return {extend:function(i){var a=p(this);return i&&a.mixIn(i),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var a in i)i.hasOwnProperty(a)&&(this[a]=i[a]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),h=x.WordArray=m.extend({init:function(i,a){i=this.words=i||[],a!=o?this.sigBytes=a:this.sigBytes=i.length*4;},toString:function(i){return (i||N).stringify(this)},concat:function(i){var a=this.words,c=i.words,d=this.sigBytes,y=i.sigBytes;if(this.clamp(),d%4)for(var J=0;J<y;J++){var I=c[J>>>2]>>>24-J%4*8&255;a[d+J>>>2]|=I<<24-(d+J)%4*8;}else for(var C=0;C<y;C+=4)a[d+C>>>2]=c[C>>>2];return this.sigBytes+=y,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=e.ceil(a/4);},clone:function(){var i=m.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var a=[],c=0;c<i;c+=4)a.push(s());return new h.init(a,i)}}),u=r.enc={},N=u.Hex={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var J=a[y>>>2]>>>24-y%4*8&255;d.push((J>>>4).toString(16)),d.push((J&15).toString(16));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d+=2)c[d>>>3]|=parseInt(i.substr(d,2),16)<<24-d%8*4;return new h.init(c,a/2)}},V=u.Latin1={stringify:function(i){for(var a=i.words,c=i.sigBytes,d=[],y=0;y<c;y++){var J=a[y>>>2]>>>24-y%4*8&255;d.push(String.fromCharCode(J));}return d.join("")},parse:function(i){for(var a=i.length,c=[],d=0;d<a;d++)c[d>>>2]|=(i.charCodeAt(d)&255)<<24-d%4*8;return new h.init(c,a)}},g=u.Utf8={stringify:function(i){try{return decodeURIComponent(escape(V.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return V.parse(unescape(encodeURIComponent(i)))}},l=x.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=g.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var a,c=this._data,d=c.words,y=c.sigBytes,J=this.blockSize,I=J*4,C=y/I;i?C=e.ceil(C):C=e.max((C|0)-this._minBufferSize,0);var A=C*J,H=e.min(A*4,y);if(A){for(var z=0;z<A;z+=J)this._doProcessBlock(d,z);a=d.splice(0,A),c.sigBytes-=H;}return new h.init(a,H)},clone:function(){var i=m.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});x.Hasher=l.extend({cfg:m.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){l.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(i){return function(a,c){return new i.init(c).finalize(a)}},_createHmacHelper:function(i){return function(a,c){return new v.HMAC.init(i,c).finalize(a)}}});var v=r.algo={};return r})(Math);return n});});var K=M((E,X)=>{(function(n,e){typeof E=="object"?X.exports=E=e(F()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS);})(E,function(n){return (function(){var e=n,o=e.lib,t=o.WordArray,s=o.Hasher,p=e.algo,r=[],x=p.SHA1=s.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(m,h){for(var u=this._hash.words,N=u[0],V=u[1],g=u[2],l=u[3],w=u[4],v=0;v<80;v++){if(v<16)r[v]=m[h+v]|0;else {var i=r[v-3]^r[v-8]^r[v-14]^r[v-16];r[v]=i<<1|i>>>31;}var a=(N<<5|N>>>27)+w+r[v];v<20?a+=(V&g|~V&l)+1518500249:v<40?a+=(V^g^l)+1859775393:v<60?a+=(V&g|V&l|g&l)-1894007588:a+=(V^g^l)-899497514,w=l,l=g,g=V<<30|V>>>2,V=N,N=a;}u[0]=u[0]+N|0,u[1]=u[1]+V|0,u[2]=u[2]+g|0,u[3]=u[3]+l|0,u[4]=u[4]+w|0;},_doFinalize:function(){var m=this._data,h=m.words,u=this._nDataBytes*8,N=m.sigBytes*8;return h[N>>>5]|=128<<24-N%32,h[(N+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(N+64>>>9<<4)+15]=u,m.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var m=s.clone.call(this);return m._hash=this._hash.clone(),m}});e.SHA1=s._createHelper(x),e.HmacSHA1=s._createHmacHelper(x);})(),n.SHA1});});var B="___param___";var f;(s=>(s.log=(p,...r)=>console.log(`[Pixi\u2019VN Json] ${p}`,...r),s.warn=(p,...r)=>console.warn(`[Pixi\u2019VN Json] ${p}`,...r),s.error=(p,...r)=>console.error(`[Pixi\u2019VN Json] ${p}`,...r),s.info=(p,...r)=>console.info(`[Pixi\u2019VN Json] ${p}`,...r)))(f||={});var L=class n{static init(e){e.loadAssets&&(n._loadAssets=e.loadAssets),e.soundOperation&&(n._soundOperation=e.soundOperation),e.imageOperation&&(n._imageOperation=e.imageOperation),e.videoOperation&&(n._videoOperation=e.videoOperation),e.imageContainerOperation&&(n._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(n._textOperation=e.textOperation),e.canvasElementOperation&&(n._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(n._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(n._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(n._narrationOperation=e.narrationOperation),e.effectOperation&&(n._effectOperation=e.effectOperation),e.animateOperation&&(n._animateOperation=e.animateOperation),e.canvasOperation&&(n._canvasOperation=e.canvasOperation),e.getLogichValue&&(n._getLogichValue=e.getLogichValue),e.getConditionalStep&&(n._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return n._loadAssets}static _soundOperation=()=>{throw f.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 n._soundOperation}static _imageOperation=()=>{throw f.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 n._imageOperation}static _videoOperation=()=>{throw f.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 n._videoOperation}static _imageContainerOperation=()=>{throw f.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 n._imageContainerOperation}static _textOperation=()=>{throw f.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 n._textOperation}static _canvasElementOperation=()=>{throw f.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 n._canvasElementOperation}static _setStorageValue=()=>{throw f.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 n._setStorageValue}static _setInitialStorageValue=()=>{throw f.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 n._setInitialStorageValue}static _narrationOperation=()=>{throw f.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 n._narrationOperation}static _effectOperation=()=>{throw f.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 n._effectOperation}static _animateOperation=()=>{throw f.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 n._animateOperation}static _canvasOperation=()=>{throw f.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 n._canvasOperation}static _getLogichValue=()=>{throw f.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 n._getLogichValue}static _getConditionalStep=()=>{throw f.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 n._getConditionalStep}};function q(n,e){if(e&&typeof e=="object"&&typeof n.functionName=="string"&&n.functionName in e){let o=e[n.functionName];if(typeof o=="function"){let t=n.args.map(s=>L.getLogichValue(s,e));return o(...t)}else f.warn(`getLogichValue function ${n.functionName} not found in props`);}}function W(n,e={}){let o="";return n.values.forEach(t=>{if(typeof t=="string")o+=t;else {let s=JsonUnifier.getLogichValue(t,e);o+=`${s}`;}}),o}async function R(n,e,o){let t=JsonUnifier.getLogichValue(n,e);if(t)switch(t.type){case "sound":JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await JsonUnifier.loadAssets(t);break;case "image":await JsonUnifier.imageOperation(t);break;case "video":await JsonUnifier.videoOperation(t);break;case "imagecontainer":await JsonUnifier.imageContainerOperation(t);break;case "text":await JsonUnifier.textOperation(t);break;case "canvaselement":await JsonUnifier.canvasElementOperation(t);break;case "canvas":JsonUnifier.canvasOperation(t);break;case "value":JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(o){let s=W(t,e),p=await o(s);p&&await R(p,e,o);}break;case "input":case "dialogue":JsonUnifier.narrationOperation(t);break;case "shake":await JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":JsonUnifier.animateOperation(t);break;case "function":await q(t,e);break}}function D(n){let e=JsonUnifier.getLogichValue(n,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&JsonUnifier.setInitialStorageValue(e);}var Y=re(K());var _=class extends LabelAbstract{constructor(e,o,t,s={}){t||(t={}),t.onLoadingLabel=async()=>{for(let p of o){let r;if(typeof p=="function"?r=p():r=p,r=JsonUnifier.getConditionalStep(r),r.operations)try{let x=r.operations.map(m=>JsonUnifier.loadAssets(m));await Promise.all(x);}catch(x){f.error("The operation in the onLoadingLabel function of the label has an error:",x);}}},super(e,t),this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}_steps;get steps(){return this._steps.map(e=>this.stepConverter(e))}get stepCount(){return this._steps.length}getStepById(e){if(e<0||e>=this._steps.length)return;let o=this._steps[e];return this.stepConverter(o)}operationStringConvert;skipEmptyDialogs=false;getStepSha(e){if(e<0||e>=this.steps.length)return;let o=this._steps[e];return (0, Y.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(e,o){let t="";if(Array.isArray(e)){let s=[];e.forEach(p=>{if(typeof p=="string")s.push(p);else if(p&&typeof p=="object"){let r=JsonUnifier.getLogichValue(p,o);r?(r&&!Array.isArray(r)&&typeof r=="object"&&(r=JsonUnifier.getLogichValue(r,o)||""),Array.isArray(r)?s=s.map(x=>`${x}`).concat(r):s.push(`${r}`)):s.push(`${p}`);}else s.push(`${p}`);}),t=s;}else {let s=JsonUnifier.getLogichValue(e,o);s&&!Array.isArray(s)&&typeof s=="object"&&(s=JsonUnifier.getLogichValue(s,o)),s&&Array.isArray(s)?t=s.map(p=>`${p}`):t=`${s}`;}return t}getDialogue(e,o){if(e==null)return;let t=JsonUnifier.getLogichValue(e,o);return t==null?`${t}`:typeof t=="object"&&"character"in t&&"text"in t?{character:t.character,text:translator.t(this.getDialogueText(t.text,o))}:translator.t(this.getDialogueText(t,o))}getChoices(e,o){return JsonUnifier.getLogichValue(e,o)?.map(p=>JsonUnifier.getLogichValue(p,o)).filter(p=>p!==void 0)}stepConverter(e){return async o=>{let t=typeof e=="function"?e():e;t=createExportableElement(t),t=JsonUnifier.getConditionalStep(t,o);let s=this.operationStringConvert?g=>this.operationStringConvert(g,t,o):void 0,{operations:p=[]}=t;for(let g of p)await R(g,o,s);let{labelToOpen:r=[]}=t,x=this.getChoices(t.choices,o),m=JsonUnifier.getLogichValue(t.glueEnabled,o),h=this.getDialogue(t.dialogue,o),u=[];Array.isArray(r)||(r=[r]),r.forEach(g=>{let l=JsonUnifier.getLogichValue(g,o);l&&u.push(l);});let N=JsonUnifier.getLogichValue(t.goNextStep,o),V=JsonUnifier.getLogichValue(t.end,o);if(x){let g=x.map(l=>{let w="";if(Array.isArray(l.text)){let i=[];l.text.forEach(a=>{if(typeof a=="string")i.push(translator.t(a));else if(a&&typeof a=="object"){let c=JsonUnifier.getLogichValue(a,o);c&&!Array.isArray(c)&&typeof c=="object"&&(c=JsonUnifier.getLogichValue(c,o)||""),c&&(Array.isArray(c)?i=i.concat(translator.t(c)):i.push(translator.t(c)));}}),w=i;}else typeof l.text=="string"&&(w=translator.t(l.text));return {label:l.label,text:w,props:l.props,type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect}});narration.choices=g;}else narration.choices=void 0;h!==void 0&&(narration.dialogue=h,this.skipEmptyDialogs&&typeof h=="string"&&(h===""||RegExp(/^\s+$/).test(h))&&(N=true)),m?narration.dialogGlue=true:m===false&&(narration.dialogGlue=false);for(let g of u){let l=g.label;typeof l=="object"&&(l=JsonUnifier.getLogichValue(l,o)||"");let w=g.params?.map(v=>JsonUnifier.getLogichValue(v,o));o={...o,...g.props},g.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${B}${narration.openedLabels.length}`,w),await narration.call(l,o)):(storage.setTempVariable(`${B}${narration.openedLabels.length}`,w),await narration.call(l,o));}V==="game_end"?(narration.closeAllLabels(),await narration.continue(o,{runNow:true})):V==="label_end"&&narration.closeCurrentLabel(),N&&await narration.continue(o,{runNow:true});}}};async function de(n,e={}){if(!Array.isArray(n))if(typeof n=="object"||typeof n=="string")n=[n];else {f.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let o=n.map(p=>{if(typeof p=="string")try{return JSON.parse(p)}catch(r){return f.error("Error parsing imported Pixi'VN JSON",r),{}}return p}),t=o.map(async p=>{if(p.initialOperations)for(let r of p.initialOperations)r.type==="value"&&(typeof r.value!="object"||!r.value||!("type"in r.value))&&D(r);return Promise.resolve()});await Promise.all(t);let s=o.map(async p=>{if(p.initialOperations)for(let r of p.initialOperations)(r.type!=="value"||r.type==="value"&&typeof r.value=="object"&&r.value&&"type"in r.value)&&D(r);if(p.labels){let r=p.labels;for(let x in r)try{let m=r[x],h=new _(x,m,void 0,e);RegisteredLabels.add(h);}catch(m){f.error(`Error creating JSON label ${x}`,m);}}return Promise.resolve()});await Promise.all(s);}export{_ as LabelJson,de as importPixiVNJson};
1
+ import {createExportableElement,PixiError}from'@drincs/pixi-vn';import {JsonUnifier}from'@drincs/pixi-vn-json/core';import {translator}from'@drincs/pixi-vn-json/translator';import {LabelAbstract,narration,RegisteredLabels}from'@drincs/pixi-vn/narration';import {storage}from'@drincs/pixi-vn/storage';var Z=Object.create;var $=Object.defineProperty;var ee=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var te=Object.getPrototypeOf,ne=Object.prototype.hasOwnProperty;var k=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var M=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var oe=(n,e,o,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of ie(e))!ne.call(n,s)&&s!==o&&$(n,s,{get:()=>e[s],enumerable:!(t=ee(e,s))||t.enumerable});return n};var re=(n,e,o)=>(o=n!=null?Z(te(n)):{},oe($(o,"default",{value:n,enumerable:true}),n));var F=M((T,G)=>{(function(n,e){typeof T=="object"?G.exports=T=e():typeof define=="function"&&define.amd?define([],e):n.CryptoJS=e();})(T,function(){var n=n||(function(e,o){var t;if(typeof window<"u"&&window.crypto&&(t=window.crypto),typeof self<"u"&&self.crypto&&(t=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(t=globalThis.crypto),!t&&typeof window<"u"&&window.msCrypto&&(t=window.msCrypto),!t&&typeof global<"u"&&global.crypto&&(t=global.crypto),!t&&typeof k=="function")try{t=k("crypto");}catch{}var s=function(){if(t){if(typeof t.getRandomValues=="function")try{return t.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof t.randomBytes=="function")try{return t.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},c=Object.create||(function(){function i(){}return function(a){var p;return i.prototype=a,p=new i,i.prototype=null,p}})(),r={},x=r.lib={},m=x.Base=(function(){return {extend:function(i){var a=c(this);return i&&a.mixIn(i),(!a.hasOwnProperty("init")||this.init===a.init)&&(a.init=function(){a.$super.init.apply(this,arguments);}),a.init.prototype=a,a.$super=this,a},create:function(){var i=this.extend();return i.init.apply(i,arguments),i},init:function(){},mixIn:function(i){for(var a in i)i.hasOwnProperty(a)&&(this[a]=i[a]);i.hasOwnProperty("toString")&&(this.toString=i.toString);},clone:function(){return this.init.prototype.extend(this)}}})(),h=x.WordArray=m.extend({init:function(i,a){i=this.words=i||[],a!=o?this.sigBytes=a:this.sigBytes=i.length*4;},toString:function(i){return (i||N).stringify(this)},concat:function(i){var a=this.words,p=i.words,d=this.sigBytes,y=i.sigBytes;if(this.clamp(),d%4)for(var J=0;J<y;J++){var I=p[J>>>2]>>>24-J%4*8&255;a[d+J>>>2]|=I<<24-(d+J)%4*8;}else for(var C=0;C<y;C+=4)a[d+C>>>2]=p[C>>>2];return this.sigBytes+=y,this},clamp:function(){var i=this.words,a=this.sigBytes;i[a>>>2]&=4294967295<<32-a%4*8,i.length=e.ceil(a/4);},clone:function(){var i=m.clone.call(this);return i.words=this.words.slice(0),i},random:function(i){for(var a=[],p=0;p<i;p+=4)a.push(s());return new h.init(a,i)}}),u=r.enc={},N=u.Hex={stringify:function(i){for(var a=i.words,p=i.sigBytes,d=[],y=0;y<p;y++){var J=a[y>>>2]>>>24-y%4*8&255;d.push((J>>>4).toString(16)),d.push((J&15).toString(16));}return d.join("")},parse:function(i){for(var a=i.length,p=[],d=0;d<a;d+=2)p[d>>>3]|=parseInt(i.substr(d,2),16)<<24-d%8*4;return new h.init(p,a/2)}},V=u.Latin1={stringify:function(i){for(var a=i.words,p=i.sigBytes,d=[],y=0;y<p;y++){var J=a[y>>>2]>>>24-y%4*8&255;d.push(String.fromCharCode(J));}return d.join("")},parse:function(i){for(var a=i.length,p=[],d=0;d<a;d++)p[d>>>2]|=(i.charCodeAt(d)&255)<<24-d%4*8;return new h.init(p,a)}},g=u.Utf8={stringify:function(i){try{return decodeURIComponent(escape(V.stringify(i)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(i){return V.parse(unescape(encodeURIComponent(i)))}},l=x.BufferedBlockAlgorithm=m.extend({reset:function(){this._data=new h.init,this._nDataBytes=0;},_append:function(i){typeof i=="string"&&(i=g.parse(i)),this._data.concat(i),this._nDataBytes+=i.sigBytes;},_process:function(i){var a,p=this._data,d=p.words,y=p.sigBytes,J=this.blockSize,I=J*4,C=y/I;i?C=e.ceil(C):C=e.max((C|0)-this._minBufferSize,0);var A=C*J,H=e.min(A*4,y);if(A){for(var z=0;z<A;z+=J)this._doProcessBlock(d,z);a=d.splice(0,A),p.sigBytes-=H;}return new h.init(a,H)},clone:function(){var i=m.clone.call(this);return i._data=this._data.clone(),i},_minBufferSize:0});x.Hasher=l.extend({cfg:m.extend(),init:function(i){this.cfg=this.cfg.extend(i),this.reset();},reset:function(){l.reset.call(this),this._doReset();},update:function(i){return this._append(i),this._process(),this},finalize:function(i){i&&this._append(i);var a=this._doFinalize();return a},blockSize:512/32,_createHelper:function(i){return function(a,p){return new i.init(p).finalize(a)}},_createHmacHelper:function(i){return function(a,p){return new v.HMAC.init(i,p).finalize(a)}}});var v=r.algo={};return r})(Math);return n});});var K=M((E,X)=>{(function(n,e){typeof E=="object"?X.exports=E=e(F()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS);})(E,function(n){return (function(){var e=n,o=e.lib,t=o.WordArray,s=o.Hasher,c=e.algo,r=[],x=c.SHA1=s.extend({_doReset:function(){this._hash=new t.init([1732584193,4023233417,2562383102,271733878,3285377520]);},_doProcessBlock:function(m,h){for(var u=this._hash.words,N=u[0],V=u[1],g=u[2],l=u[3],w=u[4],v=0;v<80;v++){if(v<16)r[v]=m[h+v]|0;else {var i=r[v-3]^r[v-8]^r[v-14]^r[v-16];r[v]=i<<1|i>>>31;}var a=(N<<5|N>>>27)+w+r[v];v<20?a+=(V&g|~V&l)+1518500249:v<40?a+=(V^g^l)+1859775393:v<60?a+=(V&g|V&l|g&l)-1894007588:a+=(V^g^l)-899497514,w=l,l=g,g=V<<30|V>>>2,V=N,N=a;}u[0]=u[0]+N|0,u[1]=u[1]+V|0,u[2]=u[2]+g|0,u[3]=u[3]+l|0,u[4]=u[4]+w|0;},_doFinalize:function(){var m=this._data,h=m.words,u=this._nDataBytes*8,N=m.sigBytes*8;return h[N>>>5]|=128<<24-N%32,h[(N+64>>>9<<4)+14]=Math.floor(u/4294967296),h[(N+64>>>9<<4)+15]=u,m.sigBytes=h.length*4,this._process(),this._hash},clone:function(){var m=s.clone.call(this);return m._hash=this._hash.clone(),m}});e.SHA1=s._createHelper(x),e.HmacSHA1=s._createHmacHelper(x);})(),n.SHA1});});var B="___param___";var f;(s=>(s.log=(c,...r)=>console.log(`[Pixi\u2019VN Json] ${c}`,...r),s.warn=(c,...r)=>console.warn(`[Pixi\u2019VN Json] ${c}`,...r),s.error=(c,...r)=>console.error(`[Pixi\u2019VN Json] ${c}`,...r),s.info=(c,...r)=>console.info(`[Pixi\u2019VN Json] ${c}`,...r)))(f||={});var L=class n{static init(e){e.loadAssets&&(n._loadAssets=e.loadAssets),e.soundOperation&&(n._soundOperation=e.soundOperation),e.imageOperation&&(n._imageOperation=e.imageOperation),e.videoOperation&&(n._videoOperation=e.videoOperation),e.imageContainerOperation&&(n._imageContainerOperation=e.imageContainerOperation),e.textOperation&&(n._textOperation=e.textOperation),e.canvasElementOperation&&(n._canvasElementOperation=e.canvasElementOperation),e.setStorageValue&&(n._setStorageValue=e.setStorageValue),e.setInitialStorageValue&&(n._setInitialStorageValue=e.setInitialStorageValue),e.narrationOperation&&(n._narrationOperation=e.narrationOperation),e.effectOperation&&(n._effectOperation=e.effectOperation),e.animateOperation&&(n._animateOperation=e.animateOperation),e.canvasOperation&&(n._canvasOperation=e.canvasOperation),e.getLogichValue&&(n._getLogichValue=e.getLogichValue),e.getConditionalStep&&(n._getConditionalStep=e.getConditionalStep);}static _loadAssets=()=>{};static get loadAssets(){return n._loadAssets}static _soundOperation=()=>{throw f.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 n._soundOperation}static _imageOperation=()=>{throw f.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 n._imageOperation}static _videoOperation=()=>{throw f.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 n._videoOperation}static _imageContainerOperation=()=>{throw f.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 n._imageContainerOperation}static _textOperation=()=>{throw f.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 n._textOperation}static _canvasElementOperation=()=>{throw f.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 n._canvasElementOperation}static _setStorageValue=()=>{throw f.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 n._setStorageValue}static _setInitialStorageValue=()=>{throw f.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 n._setInitialStorageValue}static _narrationOperation=()=>{throw f.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 n._narrationOperation}static _effectOperation=()=>{throw f.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 n._effectOperation}static _animateOperation=()=>{throw f.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 n._animateOperation}static _canvasOperation=()=>{throw f.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 n._canvasOperation}static _getLogichValue=()=>{throw f.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 n._getLogichValue}static _getConditionalStep=()=>{throw f.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 n._getConditionalStep}};function q(n,e){if(e&&typeof e=="object"&&typeof n.functionName=="string"&&n.functionName in e){let o=e[n.functionName];if(typeof o=="function"){let t=n.args.map(s=>L.getLogichValue(s,e));return o(...t)}else f.warn(`getLogichValue function ${n.functionName} not found in props`);}}function W(n,e={}){let o="";return n.values.forEach(t=>{if(typeof t=="string")o+=t;else {let s=JsonUnifier.getLogichValue(t,e);o+=`${s}`;}}),o}async function R(n,e,o){let t=JsonUnifier.getLogichValue(n,e);if(t)switch(t.type){case "sound":JsonUnifier.soundOperation(t);break;case "assets":case "bundle":await JsonUnifier.loadAssets(t);break;case "image":await JsonUnifier.imageOperation(t);break;case "video":await JsonUnifier.videoOperation(t);break;case "imagecontainer":await JsonUnifier.imageContainerOperation(t);break;case "text":await JsonUnifier.textOperation(t);break;case "canvaselement":await JsonUnifier.canvasElementOperation(t);break;case "canvas":JsonUnifier.canvasOperation(t);break;case "value":JsonUnifier.setStorageValue(t,e);break;case "operationtoconvert":if(o){let s=W(t,e),c=await o(s);c&&await R(c,e,o);}break;case "input":case "dialogue":JsonUnifier.narrationOperation(t);break;case "shake":await JsonUnifier.effectOperation(t);break;case "animate":case "animate-sequence":JsonUnifier.animateOperation(t);break;case "function":await q(t,e);break}}function D(n){let e=JsonUnifier.getLogichValue(n,{});e&&e.type==="value"&&e.storageOperationType==="set"&&(e.storageType==="storage"||e.storageType==="tempstorage")&&JsonUnifier.setInitialStorageValue(e);}var Y=re(K());var _=class extends LabelAbstract{constructor(e,o,t,s={}){t||(t={}),t.onLoadingLabel=async()=>{for(let c of o){let r;if(typeof c=="function"?r=c():r=c,r=JsonUnifier.getConditionalStep(r),r.operations)try{let x=r.operations.map(m=>JsonUnifier.loadAssets(m));await Promise.all(x);}catch(x){f.error("The operation in the onLoadingLabel function of the label has an error:",x);}}},super(e,t),this._steps=o,this.operationStringConvert=s.operationStringConvert,this.skipEmptyDialogs=s.skipEmptyDialogs||false;}_steps;get steps(){return this._steps.map(e=>this.stepConverter(e))}get stepCount(){return this._steps.length}getStepById(e){if(e<0||e>=this._steps.length)return;let o=this._steps[e];return this.stepConverter(o)}operationStringConvert;skipEmptyDialogs=false;getStepSha(e){if(e<0||e>=this.steps.length)return;let o=this._steps[e];return (0, Y.default)(o.toString().toLocaleLowerCase()).toString()}getDialogueText(e,o){let t="";if(Array.isArray(e)){let s=[];e.forEach(c=>{if(typeof c=="string")s.push(c);else if(c&&typeof c=="object"){let r=JsonUnifier.getLogichValue(c,o);r?(r&&!Array.isArray(r)&&typeof r=="object"&&(r=JsonUnifier.getLogichValue(r,o)||""),Array.isArray(r)?s=s.map(x=>`${x}`).concat(r):s.push(`${r}`)):s.push(`${c}`);}else s.push(`${c}`);}),t=s;}else {let s=JsonUnifier.getLogichValue(e,o);s&&!Array.isArray(s)&&typeof s=="object"&&(s=JsonUnifier.getLogichValue(s,o)),s&&Array.isArray(s)?t=s.map(c=>`${c}`):t=`${s}`;}return t}getDialogue(e,o){if(e==null)return;let t=JsonUnifier.getLogichValue(e,o);return t==null?`${t}`:typeof t=="object"&&"character"in t&&"text"in t?{character:t.character,text:translator.t(this.getDialogueText(t.text,o))}:translator.t(this.getDialogueText(t,o))}getChoices(e,o){return JsonUnifier.getLogichValue(e,o)?.map(c=>JsonUnifier.getLogichValue(c,o)).filter(c=>c!==void 0)}stepConverter(e){return async o=>{let t=typeof e=="function"?e():e;t=createExportableElement(t),t=JsonUnifier.getConditionalStep(t,o);let s=this.operationStringConvert?g=>this.operationStringConvert(g,t,o):void 0,{operations:c=[]}=t;for(let g of c)await R(g,o,s);let{labelToOpen:r=[]}=t,x=this.getChoices(t.choices,o),m=JsonUnifier.getLogichValue(t.glueEnabled,o),h=this.getDialogue(t.dialogue,o),u=[];Array.isArray(r)||(r=[r]),r.forEach(g=>{let l=JsonUnifier.getLogichValue(g,o);l&&u.push(l);});let N=JsonUnifier.getLogichValue(t.goNextStep,o),V=JsonUnifier.getLogichValue(t.end,o);if(x){let g=x.map(l=>{let w="";if(Array.isArray(l.text)){let i=[];l.text.forEach(a=>{if(typeof a=="string")i.push(translator.t(a));else if(a&&typeof a=="object"){let p=JsonUnifier.getLogichValue(a,o);p&&!Array.isArray(p)&&typeof p=="object"&&(p=JsonUnifier.getLogichValue(p,o)||""),p&&(Array.isArray(p)?i=i.concat(translator.t(p)):i.push(translator.t(p)));}}),w=i;}else typeof l.text=="string"&&(w=translator.t(l.text));return {label:l.label,text:w,props:l.props,type:l.type,oneTime:l.oneTime,onlyHaveNoChoice:l.onlyHaveNoChoice,autoSelect:l.autoSelect}});narration.choices=g;}else narration.choices=void 0;h!==void 0&&(narration.dialogue=h,this.skipEmptyDialogs&&typeof h=="string"&&(h===""||RegExp(/^\s+$/).test(h))&&(N=true)),m?narration.dialogGlue=true:m===false&&(narration.dialogGlue=false);for(let g of u){let l=g.label;typeof l=="object"&&(l=JsonUnifier.getLogichValue(l,o)||"");let w=g.params?.map(v=>JsonUnifier.getLogichValue(v,o));o={...o,...g.props},g.type==="jump"?(narration.openedLabels.length>0&&narration.closeCurrentLabel(),storage.setTempVariable(`${B}${narration.openedLabels.length}`,w),await narration.call(l,o)):(storage.setTempVariable(`${B}${narration.openedLabels.length}`,w),await narration.call(l,o));}V==="game_end"?(narration.closeAllLabels(),await narration.continue(o,{runNow:true})):V==="label_end"&&narration.closeCurrentLabel(),N&&await narration.continue(o,{runNow:true});}}};async function de(n,e={}){if(!Array.isArray(n))if(typeof n=="object"||typeof n=="string")n=[n];else {f.error("Error parsing imported Pixi'VN JSON: data is not an object");return}let o=n.map(c=>{if(typeof c=="string")try{return JSON.parse(c)}catch(r){return f.error("Error parsing imported Pixi'VN JSON",r),{}}return c}),t=o.map(async c=>{if(c.initialOperations)for(let r of c.initialOperations)r.type==="value"&&(typeof r.value!="object"||!r.value||!("type"in r.value))&&D(r);return Promise.resolve()});await Promise.all(t);let s=o.map(async c=>{if(c.initialOperations)for(let r of c.initialOperations)(r.type!=="value"||r.type==="value"&&typeof r.value=="object"&&r.value&&"type"in r.value)&&D(r);if(c.labels){let r=c.labels;for(let x in r)try{let m=r[x],h=new _(x,m,void 0,e);RegisteredLabels.add(h);}catch(m){f.error(`Error creating JSON label ${x}`,m);}}return Promise.resolve()});await Promise.all(s);}export{_ as LabelJson,de as importPixiVNJson};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drincs/pixi-vn-json",
3
- "version": "1.13.16",
3
+ "version": "1.13.17",
4
4
  "type": "module",
5
5
  "description": "Pixi'VN can be integrated with JSON files to create a visual novel.",
6
6
  "main": "./dist/index.cjs",
@@ -15,6 +15,7 @@
15
15
  "build": "tsup --config tsup.config.ts",
16
16
  "generate-schema": "node scripts/generate-schema.mjs",
17
17
  "generate-entrance-transition-schemas": "node scripts/generate-entrance-transition-schemas.mjs",
18
+ "generate-container-memory-schema": "node scripts/generate-container-memory-schema.mjs",
18
19
  "lint": "biome lint",
19
20
  "check": "biome check",
20
21
  "format": "biome format --write",
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Generates the JSON Schema used by `containerMemorySchema` (src/actions/container-memory.ts)
4
+ * from `@drincs/pixi-vn`'s own `ContainerMemory` type, via this package's own generic
5
+ * TypeScript-interface-to-JSON-Schema generator (`schema-generator.mjs`) — the same generator used
6
+ * by `generate-entrance-transition-schemas.mjs`.
7
+ *
8
+ * `ContainerMemory` is read straight off `@drincs/pixi-vn`'s own `.d.ts` (it's not declared
9
+ * anywhere in this package), so no `interfaceDir` is passed — generated via the depth-capped
10
+ * "external" path, at the default `maxDepth: 1` ("branching" = 1): every direct property is typed
11
+ * correctly, but any property that is itself an object collapses to an opaque `{ type: "object" }`
12
+ * rather than being expanded.
13
+ *
14
+ * `elements` (`CanvasBaseItemMemory[]`, the container's own children) is deliberately dropped from
15
+ * the generated schema after generation: it's a self-referential list of arbitrary canvas-element
16
+ * snapshots (potentially containers themselves), not a plain, flat property this schema is meant
17
+ * to validate.
18
+ *
19
+ * Run via `npm run generate-container-memory-schema`; re-run whenever `@drincs/pixi-vn`'s
20
+ * `ContainerMemory` type changes.
21
+ */
22
+
23
+ import { readdirSync, writeFileSync } from "node:fs";
24
+ import { dirname, join, resolve } from "node:path";
25
+ import { fileURLToPath } from "node:url";
26
+ import { generateJsonSchema } from "./schema-generator.mjs";
27
+
28
+ const __dirname = dirname(fileURLToPath(import.meta.url));
29
+ const rootDir = resolve(__dirname, "..");
30
+
31
+ const pixiVnDistDir = join(rootDir, "node_modules", "@drincs", "pixi-vn", "dist");
32
+
33
+ // `ContainerMemory` isn't declared in `canvas.d.ts` itself — that file only re-exports it from a
34
+ // shared chunk whose filename is content-hashed (e.g. `ContainerMemory-D2HtgX7w.d.ts`), so a
35
+ // `generateJsonSchema` lookup rooted at `canvas.d.ts` alone can't find its declaration (it only
36
+ // resolves types declared directly in one of `rootFiles`, not merely re-exported through it).
37
+ // Resolve the actual chunk by filename pattern instead of hardcoding the hash, since it changes
38
+ // whenever `@drincs/pixi-vn`'s own build reshuffles its chunks.
39
+ const containerMemoryChunk = readdirSync(pixiVnDistDir).find((name) =>
40
+ /^ContainerMemory-.*\.d\.ts$/.test(name),
41
+ );
42
+ if (!containerMemoryChunk) {
43
+ throw new Error(
44
+ `Could not find the chunk declaring "ContainerMemory" under ${pixiVnDistDir} (expected a file matching ContainerMemory-*.d.ts).`,
45
+ );
46
+ }
47
+ const containerMemoryDts = join(pixiVnDistDir, containerMemoryChunk);
48
+
49
+ const { schemas, definitions } = generateJsonSchema({
50
+ rootFiles: [containerMemoryDts],
51
+ rootTypeNames: ["ContainerMemory"],
52
+ compilerOptions: { types: [] },
53
+ });
54
+
55
+ /** Each entry must be self-contained (it's used standalone as one JSON Schema by any validator). */
56
+ function toStandaloneSchema(rootSchema) {
57
+ if (rootSchema.$ref) {
58
+ const key = rootSchema.$ref.replace("#/definitions/", "");
59
+ const { [key]: own, ...rest } = definitions;
60
+ const usedRefs = JSON.stringify(own).match(/#\/definitions\/[A-Za-z0-9_]+/g) ?? [];
61
+ if (usedRefs.length === 0) return own;
62
+ const neededDefinitions = Object.fromEntries(
63
+ usedRefs
64
+ .map((ref) => ref.replace("#/definitions/", ""))
65
+ .filter((k) => k in rest)
66
+ .map((k) => [k, rest[k]]),
67
+ );
68
+ return Object.keys(neededDefinitions).length > 0
69
+ ? { ...own, definitions: neededDefinitions }
70
+ : own;
71
+ }
72
+ return rootSchema;
73
+ }
74
+
75
+ /** Drops `elements` — see the module header comment for why. */
76
+ function withoutElements(schema) {
77
+ const { elements: _elements, ...properties } = schema.properties ?? {};
78
+ return {
79
+ ...schema,
80
+ properties,
81
+ required: (schema.required ?? []).filter((key) => key !== "elements"),
82
+ };
83
+ }
84
+
85
+ const containerMemorySchema = withoutElements(toStandaloneSchema(schemas.ContainerMemory));
86
+
87
+ const outPath = join(rootDir, "src", "actions", "container-memory-schema.generated.ts");
88
+ const banner = `/**
89
+ * GENERATED FILE — do not edit by hand.
90
+ * Produced by \`scripts/generate-container-memory-schema.mjs\` from \`@drincs/pixi-vn\`'s own
91
+ * \`ContainerMemory\` type. Re-run that script (see its header comment) to refresh this file after
92
+ * that type changes.
93
+ */
94
+
95
+ /**
96
+ * JSON Schema (usable as \`@drincs/pixi-vn-ink\`'s \`HashtagHandlerOptions.keySchemas\` values, or
97
+ * with any other JSON Schema validator) for \`ContainerMemory\`, excluding its own \`elements\` (the
98
+ * container's child canvas elements — a self-referential list, not a flat property).
99
+ */
100
+ export const containerMemorySchema: object = `;
101
+
102
+ writeFileSync(outPath, `${banner}${JSON.stringify(containerMemorySchema, null, 4)};\n`);
103
+
104
+ console.log(`Generated: ${outPath}`);
105
+ console.log(
106
+ `Properties: ${Object.keys(containerMemorySchema.properties ?? {}).length} (excluding "elements")`,
107
+ );