narrat 2.2.12 → 2.2.13-test
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/main.d.ts +1 -0
- package/dist/narrat.es.js.map +1 -1
- package/dist/narrat.umd.js +2 -2
- package/dist/narrat.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +4 -5
package/dist/narrat.umd.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* @license Licensed under MIT license
|
|
5
5
|
* See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
|
|
6
6
|
* @version v4.2.8+1e68dce6
|
|
7
|
-
*/(function(t,e){(function(n,r){t.exports=r()})(Fr,function(){function n(ye){var Ce=typeof ye;return ye!==null&&(Ce==="object"||Ce==="function")}function r(ye){return typeof ye=="function"}var o=void 0;Array.isArray?o=Array.isArray:o=function(ye){return Object.prototype.toString.call(ye)==="[object Array]"};var i=o,a=0,s=void 0,u=void 0,l=function(Ce,Re){E[a]=Ce,E[a+1]=Re,a+=2,a===2&&(u?u(O):_())};function f(ye){u=ye}function c(ye){l=ye}var d=typeof window<"u"?window:void 0,h=d||{},p=h.MutationObserver||h.WebKitMutationObserver,v=typeof self>"u"&&typeof process<"u"&&{}.toString.call(process)==="[object process]",g=typeof Uint8ClampedArray<"u"&&typeof importScripts<"u"&&typeof MessageChannel<"u";function m(){return function(){return process.nextTick(O)}}function y(){return typeof s<"u"?function(){s(O)}:w()}function b(){var ye=0,Ce=new p(O),Re=document.createTextNode("");return Ce.observe(Re,{characterData:!0}),function(){Re.data=ye=++ye%2}}function k(){var ye=new MessageChannel;return ye.port1.onmessage=O,function(){return ye.port2.postMessage(0)}}function w(){var ye=setTimeout;return function(){return ye(O,1)}}var E=new Array(1e3);function O(){for(var ye=0;ye<a;ye+=2){var Ce=E[ye],Re=E[ye+1];Ce(Re),E[ye]=void 0,E[ye+1]=void 0}a=0}function L(){try{var ye=Function("return this")().require("vertx");return s=ye.runOnLoop||ye.runOnContext,y()}catch{return w()}}var _=void 0;v?_=m():p?_=b():g?_=k():d===void 0&&typeof T8=="function"?_=L():_=w();function T(ye,Ce){var Re=this,ge=new this.constructor($);ge[z]===void 0&&se(ge);var Be=Re._state;if(Be){var Ke=arguments[Be-1];l(function(){return we(Be,ge,Ke,Re._result)})}else U(Re,ge,ye,Ce);return ge}function C(ye){var Ce=this;if(ye&&typeof ye=="object"&&ye.constructor===Ce)return ye;var Re=new Ce($);return R(Re,ye),Re}var z=Math.random().toString(36).substring(2);function $(){}var S=void 0,V=1,Q=2;function B(){return new TypeError("You cannot resolve a promise with itself")}function K(){return new TypeError("A promises callback cannot return that same promise.")}function D(ye,Ce,Re,ge){try{ye.call(Ce,Re,ge)}catch(Be){return Be}}function I(ye,Ce,Re){l(function(ge){var Be=!1,Ke=D(Re,Ce,function(yt){Be||(Be=!0,Ce!==yt?R(ge,yt):x(ge,yt))},function(yt){Be||(Be=!0,M(ge,yt))},"Settle: "+(ge._label||" unknown promise"));!Be&&Ke&&(Be=!0,M(ge,Ke))},ye)}function H(ye,Ce){Ce._state===V?x(ye,Ce._result):Ce._state===Q?M(ye,Ce._result):U(Ce,void 0,function(Re){return R(ye,Re)},function(Re){return M(ye,Re)})}function F(ye,Ce,Re){Ce.constructor===ye.constructor&&Re===T&&Ce.constructor.resolve===C?H(ye,Ce):Re===void 0?x(ye,Ce):r(Re)?I(ye,Ce,Re):x(ye,Ce)}function R(ye,Ce){if(ye===Ce)M(ye,B());else if(n(Ce)){var Re=void 0;try{Re=Ce.then}catch(ge){M(ye,ge);return}F(ye,Ce,Re)}else x(ye,Ce)}function A(ye){ye._onerror&&ye._onerror(ye._result),ie(ye)}function x(ye,Ce){ye._state===S&&(ye._result=Ce,ye._state=V,ye._subscribers.length!==0&&l(ie,ye))}function M(ye,Ce){ye._state===S&&(ye._state=Q,ye._result=Ce,l(A,ye))}function U(ye,Ce,Re,ge){var Be=ye._subscribers,Ke=Be.length;ye._onerror=null,Be[Ke]=Ce,Be[Ke+V]=Re,Be[Ke+Q]=ge,Ke===0&&ye._state&&l(ie,ye)}function ie(ye){var Ce=ye._subscribers,Re=ye._state;if(Ce.length!==0){for(var ge=void 0,Be=void 0,Ke=ye._result,yt=0;yt<Ce.length;yt+=3)ge=Ce[yt],Be=Ce[yt+Re],ge?we(Re,ge,Be,Ke):Be(Ke);ye._subscribers.length=0}}function we(ye,Ce,Re,ge){var Be=r(Re),Ke=void 0,yt=void 0,nn=!0;if(Be){try{Ke=Re(ge)}catch(ln){nn=!1,yt=ln}if(Ce===Ke){M(Ce,K());return}}else Ke=ge;Ce._state!==S||(Be&&nn?R(Ce,Ke):nn===!1?M(Ce,yt):ye===V?x(Ce,Ke):ye===Q&&M(Ce,Ke))}function _e(ye,Ce){try{Ce(function(ge){R(ye,ge)},function(ge){M(ye,ge)})}catch(Re){M(ye,Re)}}var N=0;function J(){return N++}function se(ye){ye[z]=N++,ye._state=void 0,ye._result=void 0,ye._subscribers=[]}function ae(){return new Error("Array Methods must be provided an Array")}var ve=function(){function ye(Ce,Re){this._instanceConstructor=Ce,this.promise=new Ce($),this.promise[z]||se(this.promise),i(Re)?(this.length=Re.length,this._remaining=Re.length,this._result=new Array(this.length),this.length===0?x(this.promise,this._result):(this.length=this.length||0,this._enumerate(Re),this._remaining===0&&x(this.promise,this._result))):M(this.promise,ae())}return ye.prototype._enumerate=function(Re){for(var ge=0;this._state===S&&ge<Re.length;ge++)this._eachEntry(Re[ge],ge)},ye.prototype._eachEntry=function(Re,ge){var Be=this._instanceConstructor,Ke=Be.resolve;if(Ke===C){var yt=void 0,nn=void 0,ln=!1;try{yt=Re.then}catch(Z){ln=!0,nn=Z}if(yt===T&&Re._state!==S)this._settledAt(Re._state,ge,Re._result);else if(typeof yt!="function")this._remaining--,this._result[ge]=Re;else if(Be===Fe){var Mn=new Be($);ln?M(Mn,nn):F(Mn,Re,yt),this._willSettleAt(Mn,ge)}else this._willSettleAt(new Be(function(Z){return Z(Re)}),ge)}else this._willSettleAt(Ke(Re),ge)},ye.prototype._settledAt=function(Re,ge,Be){var Ke=this.promise;Ke._state===S&&(this._remaining--,Re===Q?M(Ke,Be):this._result[ge]=Be),this._remaining===0&&x(Ke,this._result)},ye.prototype._willSettleAt=function(Re,ge){var Be=this;U(Re,void 0,function(Ke){return Be._settledAt(V,ge,Ke)},function(Ke){return Be._settledAt(Q,ge,Ke)})},ye}();function Se(ye){return new ve(this,ye).promise}function ce(ye){var Ce=this;return i(ye)?new Ce(function(Re,ge){for(var Be=ye.length,Ke=0;Ke<Be;Ke++)Ce.resolve(ye[Ke]).then(Re,ge)}):new Ce(function(Re,ge){return ge(new TypeError("You must pass an array to race."))})}function Y(ye){var Ce=this,Re=new Ce($);return M(Re,ye),Re}function qe(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function Ge(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var Fe=function(){function ye(Ce){this[z]=J(),this._result=this._state=void 0,this._subscribers=[],$!==Ce&&(typeof Ce!="function"&&qe(),this instanceof ye?_e(this,Ce):Ge())}return ye.prototype.catch=function(Re){return this.then(null,Re)},ye.prototype.finally=function(Re){var ge=this,Be=ge.constructor;return r(Re)?ge.then(function(Ke){return Be.resolve(Re()).then(function(){return Ke})},function(Ke){return Be.resolve(Re()).then(function(){throw Ke})}):ge.then(Re,Re)},ye}();Fe.prototype.then=T,Fe.all=Se,Fe.race=ce,Fe.resolve=C,Fe.reject=Y,Fe._setScheduler=f,Fe._setAsap=c,Fe._asap=l;function Ae(){var ye=void 0;if(typeof Fr<"u")ye=Fr;else if(typeof self<"u")ye=self;else try{ye=Function("return this")()}catch{throw new Error("polyfill failed because global object is unavailable in this environment")}var Ce=ye.Promise;if(Ce){var Re=null;try{Re=Object.prototype.toString.call(Ce.resolve())}catch{}if(Re==="[object Promise]"&&!Ce.cast)return}ye.Promise=Fe}return Fe.polyfill=Ae,Fe.Promise=Fe,Fe})})(o0),o0.exports.polyfill();const tY="",i0=j.ref([]),a0=j.ref(null),s0=j.ref(null),u0=j.ref(null),Zr=j.reactive({current:""}),Vd=[],M8=j.ref(!1),Fd=j.readonly(i0),I8=j.readonly(a0),N8=j.readonly(s0),L8=j.readonly(u0),D8=j.readonly(Zr),l0=(t=I8.value)=>{Zr.current=t;const e=Fd.value.findIndex(r=>r.name===t),n=Fd.value.map(r=>r.name);for(let r=0;r<n.length;r++){if(r>0&&r<n.length-1){const o=n[r]+"Minus",i=n[r]+"Plus";Zr[o]=e<=r,Zr[i]=e>=r}Zr[n[r]]=n[r]===t}},c0=(t=N8.value)=>{Zr.orientation=t,Zr.isLandscape=t==="landscape",Zr.isPortrait=t==="portrait"},f0=(t=L8.value||"light")=>{Zr.theme=t,Zr.isDark=t==="dark",Zr.isLight=t==="light"};function qd(t,e){if(typeof window>"u"||!window.matchMedia)return!1;if(typeof window<"u"&&!window.matchMedia)return console.error("Vue3 Mq: No MatchMedia support detected in this browser. Responsive breakpoints not available."),!1;{M8.value=!0;const n=window.matchMedia(t),r=({matches:o})=>{o&&e()};Vd.push({mql:n,cb:r}),n.addEventListener&&typeof n.addEventListener=="function"?n.addEventListener("change",r):n.addListener(r),r(n)}}var Hd=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",bootstrap5:{xs:0,sm:576,md:768,lg:992,xl:1200,xxl:1400},bootstrap4:{xs:0,sm:576,md:768,lg:992,xl:1200},bootstrap3:{xs:0,sm:768,md:992,lg:1200},vuetify:{xs:0,sm:600,md:960,lg:1264,xl:1904},tailwind:{xs:0,sm:640,md:768,lg:1024,xl:1280,xxl:1536},devices:{phone:0,tablet:768,laptop:1370,desktop:1906}});const d0=t=>{if(!t||typeof t!="object")return!1;const e=[];for(let n in t){const r=parseFloat(t[n]);n&&typeof n=="string"?/^[^a-z]/i.test(n)||/[^a-zA-Z0-9_]/.test(n)?console.warn(`Vue3 Mq: "${n}" is an invalid breakpoint key. Breakpoint keys must start with a letter and contain only alphanumeric characters and underscores. Skipping.`):!r&&r!==0||isNaN(r)||r<0?console.warn(`Vue3 Mq: "${n}: ${t[n]}" is not a valid breakpoint. Breakpoints should be a number of zero or above. Skipping.`):e.push({name:n,min:r}):console.warn(`Vue3 Mq: Invalid or missing breakpoint key (${JSON.stringify(n)}). Skipping.`)}return e.some(n=>n.min===0)||console.warn("Vue3 Mq: You have not declared a breakpoint with a minimum value of 0. There may be screen sizes to which Vue3Mq does not respond."),new Set(e.map(n=>n.min)).size<e.length&&console.warn("Vue3 Mq: Your breakpoint configuration contains duplicate values. Behaviour may be unpredictable."),e.length!==0&&e.sort((n,r)=>n.min-r.min)};function h0({breakpoints:t,preset:e}){const n=(a=>{if(typeof a=="string"&&Hd[a])return Hd[a];{const s=Object.keys(Hd);return console.error(`Vue3 Mq: "${a}" is not a valid preset. Available options are: ${s.join(", ")}`),!1}})(e),r=d0(t);if(n===!1&&!r)throw new TypeError("Vue3 Mq: You must provide a valid preset, or valid breakpoint settings.");var o;o=r||d0(n),i0.value=o,function(){for(;Vd.length>0;){const a=Vd.shift();if(a&&typeof a=="object"){const{mql:s,cb:u}=a;s.addEventListener&&typeof s.addEventListener=="function"?s.removeEventListener("change",u):s.removeListener(u)}}}(),(()=>{const a=Object.keys(Zr);for(let s of a)delete Zr[s];l0(),c0(),f0()})();const i=Fd.value.reduce((a,s,u,l)=>{const f=`(min-width: ${s.min}px)`,c=u<l.length-1?`(max-width: ${l[u+1].min-1}px)`:null,d=f+(c?" and "+c:"");return Object.assign(a,{[s.name]:d})},{});for(const a in i)qd(i[a],()=>{l0(a)});["portrait","landscape"].forEach(a=>{qd(`(orientation: ${a})`,()=>{c0(a)})}),["light","dark"].forEach(a=>{qd(`(prefers-color-scheme: ${a})`,()=>{f0(a)})})}var R8={install:(t,{preset:e="bootstrap5",breakpoints:n,defaultBreakpoint:r,defaultOrientation:o="landscape",defaultTheme:i}={})=>{try{const u=["landscape","portrait"].includes(s=o)===!1?(console.error(`Vue3 Mq: "${s}" is not a valid default orientation. Reverting to unset value.`),null):s,l=((f=null)=>["dark","light"].includes(f)===!1&&f!==null?(console.error(`Vue3 Mq: "${f}" is not a valid default theme. Reverting to unset value.`),null):f)(i);a=r,a0.value=a,(f=>{s0.value=f})(u),(f=>{u0.value=f})(l),t.provide("mq",D8),t.provide("updateBreakpoints",h0),h0({breakpoints:n,preset:e})}catch(u){console.error(u)}var a,s}};class p0{constructor(){Po(this,"debug");Po(this,"logger",{log:()=>{}})}setupDebugger(e){this.debug=e,e&&(this.logger.log=console.log.bind(window.console))}}const v0=new p0,To=v0.logger;function Wd(t,e){return Date.now()-t+e}function Ud(t){const e=parseInt(t,10);let n=Math.floor(e/3600),r=Math.floor((e-n*3600)/60),o=e-n*3600-r*60;return n<10&&(n="0"+n),r<10&&(r="0"+r),o<10&&(o="0"+o),n+":"+r+":"+o}const B8=j.defineComponent({props:{containerCssClass:String}}),nY="",qr=(t,e)=>{const n=t.__vccOpts||t;for(const[r,o]of e)n[r]=o;return n},z8={class:"modal-header"},V8=j.createTextVNode(" default header "),F8=j.createElementVNode("hr",{class:"solid"},null,-1),q8={class:"modal-body"},H8=j.createTextVNode(" default body "),W8={class:"modal-footer"};function U8(t,e,n,r,o,i){return j.openBlock(),j.createBlock(j.Transition,{name:"modal"},{default:j.withCtx(()=>[j.createElementVNode("div",{class:"modal-mask",onClick:e[2]||(e[2]=a=>t.$emit("close"))},[j.createElementVNode("div",{class:j.normalizeClass(["modal-container bg-gray-800 card-4",t.containerCssClass]),onClick:e[1]||(e[1]=a=>a.stopPropagation())},[j.createElementVNode("div",z8,[j.createElementVNode("button",{class:"close-button",onClick:e[0]||(e[0]=a=>t.$emit("close"))},"X"),j.renderSlot(t.$slots,"header",{},()=>[V8]),F8]),j.createElementVNode("div",q8,[j.renderSlot(t.$slots,"body",{},()=>[H8])]),j.createElementVNode("div",W8,[j.renderSlot(t.$slots,"footer")])],2)])]),_:3})}const hs=qr(B8,[["render",U8]]);function Oi(t){return Array.isArray?Array.isArray(t):y0(t)==="[object Array]"}const J8=1/0;function G8(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-J8?"-0":e}function K8(t){return t==null?"":G8(t)}function ti(t){return typeof t=="string"}function m0(t){return typeof t=="number"}function Q8(t){return t===!0||t===!1||Y8(t)&&y0(t)=="[object Boolean]"}function g0(t){return typeof t=="object"}function Y8(t){return g0(t)&&t!==null}function eo(t){return t!=null}function Jd(t){return!t.trim().length}function y0(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const rY="Extended search is not available",X8="Incorrect 'index' type",Z8=t=>`Invalid value for key ${t}`,eP=t=>`Pattern length exceeds max of ${t}.`,tP=t=>`Missing ${t} property in key`,nP=t=>`Property 'weight' in key '${t}' must be a positive integer`,b0=Object.prototype.hasOwnProperty;class rP{constructor(e){this._keys=[],this._keyMap={};let n=0;e.forEach(r=>{let o=k0(r);n+=o.weight,this._keys.push(o),this._keyMap[o.id]=o,n+=o.weight}),this._keys.forEach(r=>{r.weight/=n})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function k0(t){let e=null,n=null,r=null,o=1,i=null;if(ti(t)||Oi(t))r=t,e=w0(t),n=Gd(t);else{if(!b0.call(t,"name"))throw new Error(tP("name"));const a=t.name;if(r=a,b0.call(t,"weight")&&(o=t.weight,o<=0))throw new Error(nP(a));e=w0(a),n=Gd(a),i=t.getFn}return{path:e,id:n,weight:o,src:r,getFn:i}}function w0(t){return Oi(t)?t:t.split(".")}function Gd(t){return Oi(t)?t.join("."):t}function oP(t,e){let n=[],r=!1;const o=(i,a,s)=>{if(!!eo(i))if(!a[s])n.push(i);else{let u=a[s];const l=i[u];if(!eo(l))return;if(s===a.length-1&&(ti(l)||m0(l)||Q8(l)))n.push(K8(l));else if(Oi(l)){r=!0;for(let f=0,c=l.length;f<c;f+=1)o(l[f],a,s+1)}else a.length&&o(l,a,s+1)}};return o(t,ti(e)?e.split("."):e,0),r?n:n[0]}var Dt={...{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},...{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},...{location:0,threshold:.6,distance:100},...{useExtendedSearch:!1,getFn:oP,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const iP=/[^ ]+/g;function aP(t=1,e=3){const n=new Map,r=Math.pow(10,e);return{get(o){const i=o.match(iP).length;if(n.has(i))return n.get(i);const a=1/Math.pow(i,.5*t),s=parseFloat(Math.round(a*r)/r);return n.set(i,s),s},clear(){n.clear()}}}class Kd{constructor({getFn:e=Dt.getFn,fieldNormWeight:n=Dt.fieldNormWeight}={}){this.norm=aP(n,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((n,r)=>{this._keysMap[n.id]=r})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,ti(this.docs[0])?this.docs.forEach((e,n)=>{this._addString(e,n)}):this.docs.forEach((e,n)=>{this._addObject(e,n)}),this.norm.clear())}add(e){const n=this.size();ti(e)?this._addString(e,n):this._addObject(e,n)}removeAt(e){this.records.splice(e,1);for(let n=e,r=this.size();n<r;n+=1)this.records[n].i-=1}getValueForItemAtKeyId(e,n){return e[this._keysMap[n]]}size(){return this.records.length}_addString(e,n){if(!eo(e)||Jd(e))return;let r={v:e,i:n,n:this.norm.get(e)};this.records.push(r)}_addObject(e,n){let r={i:n,$:{}};this.keys.forEach((o,i)=>{let a=o.getFn?o.getFn(e):this.getFn(e,o.path);if(!!eo(a)){if(Oi(a)){let s=[];const u=[{nestedArrIndex:-1,value:a}];for(;u.length;){const{nestedArrIndex:l,value:f}=u.pop();if(!!eo(f))if(ti(f)&&!Jd(f)){let c={v:f,i:l,n:this.norm.get(f)};s.push(c)}else Oi(f)&&f.forEach((c,d)=>{u.push({nestedArrIndex:d,value:c})})}r.$[i]=s}else if(ti(a)&&!Jd(a)){let s={v:a,n:this.norm.get(a)};r.$[i]=s}}}),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function j0(t,e,{getFn:n=Dt.getFn,fieldNormWeight:r=Dt.fieldNormWeight}={}){const o=new Kd({getFn:n,fieldNormWeight:r});return o.setKeys(t.map(k0)),o.setSources(e),o.create(),o}function sP(t,{getFn:e=Dt.getFn,fieldNormWeight:n=Dt.fieldNormWeight}={}){const{keys:r,records:o}=t,i=new Kd({getFn:e,fieldNormWeight:n});return i.setKeys(r),i.setIndexRecords(o),i}function ql(t,{errors:e=0,currentLocation:n=0,expectedLocation:r=0,distance:o=Dt.distance,ignoreLocation:i=Dt.ignoreLocation}={}){const a=e/t.length;if(i)return a;const s=Math.abs(r-n);return o?a+s/o:s?1:a}function uP(t=[],e=Dt.minMatchCharLength){let n=[],r=-1,o=-1,i=0;for(let a=t.length;i<a;i+=1){let s=t[i];s&&r===-1?r=i:!s&&r!==-1&&(o=i-1,o-r+1>=e&&n.push([r,o]),r=-1)}return t[i-1]&&i-r>=e&&n.push([r,i-1]),n}const $a=32;function lP(t,e,n,{location:r=Dt.location,distance:o=Dt.distance,threshold:i=Dt.threshold,findAllMatches:a=Dt.findAllMatches,minMatchCharLength:s=Dt.minMatchCharLength,includeMatches:u=Dt.includeMatches,ignoreLocation:l=Dt.ignoreLocation}={}){if(e.length>$a)throw new Error(eP($a));const f=e.length,c=t.length,d=Math.max(0,Math.min(r,c));let h=i,p=d;const v=s>1||u,g=v?Array(c):[];let m;for(;(m=t.indexOf(e,p))>-1;){let O=ql(e,{currentLocation:m,expectedLocation:d,distance:o,ignoreLocation:l});if(h=Math.min(O,h),p=m+f,v){let L=0;for(;L<f;)g[m+L]=1,L+=1}}p=-1;let y=[],b=1,k=f+c;const w=1<<f-1;for(let O=0;O<f;O+=1){let L=0,_=k;for(;L<_;)ql(e,{errors:O,currentLocation:d+_,expectedLocation:d,distance:o,ignoreLocation:l})<=h?L=_:k=_,_=Math.floor((k-L)/2+L);k=_;let T=Math.max(1,d-_+1),C=a?c:Math.min(d+_,c)+f,z=Array(C+2);z[C+1]=(1<<O)-1;for(let S=C;S>=T;S-=1){let V=S-1,Q=n[t.charAt(V)];if(v&&(g[V]=+!!Q),z[S]=(z[S+1]<<1|1)&Q,O&&(z[S]|=(y[S+1]|y[S])<<1|1|y[S+1]),z[S]&w&&(b=ql(e,{errors:O,currentLocation:V,expectedLocation:d,distance:o,ignoreLocation:l}),b<=h)){if(h=b,p=V,p<=d)break;T=Math.max(1,2*d-p)}}if(ql(e,{errors:O+1,currentLocation:d,expectedLocation:d,distance:o,ignoreLocation:l})>h)break;y=z}const E={isMatch:p>=0,score:Math.max(.001,b)};if(v){const O=uP(g,s);O.length?u&&(E.indices=O):E.isMatch=!1}return E}function cP(t){let e={};for(let n=0,r=t.length;n<r;n+=1){const o=t.charAt(n);e[o]=(e[o]||0)|1<<r-n-1}return e}class x0{constructor(e,{location:n=Dt.location,threshold:r=Dt.threshold,distance:o=Dt.distance,includeMatches:i=Dt.includeMatches,findAllMatches:a=Dt.findAllMatches,minMatchCharLength:s=Dt.minMatchCharLength,isCaseSensitive:u=Dt.isCaseSensitive,ignoreLocation:l=Dt.ignoreLocation}={}){if(this.options={location:n,threshold:r,distance:o,includeMatches:i,findAllMatches:a,minMatchCharLength:s,isCaseSensitive:u,ignoreLocation:l},this.pattern=u?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const f=(d,h)=>{this.chunks.push({pattern:d,alphabet:cP(d),startIndex:h})},c=this.pattern.length;if(c>$a){let d=0;const h=c%$a,p=c-h;for(;d<p;)f(this.pattern.substr(d,$a),d),d+=$a;if(h){const v=c-$a;f(this.pattern.substr(v),v)}}else f(this.pattern,0)}searchIn(e){const{isCaseSensitive:n,includeMatches:r}=this.options;if(n||(e=e.toLowerCase()),this.pattern===e){let p={isMatch:!0,score:0};return r&&(p.indices=[[0,e.length-1]]),p}const{location:o,distance:i,threshold:a,findAllMatches:s,minMatchCharLength:u,ignoreLocation:l}=this.options;let f=[],c=0,d=!1;this.chunks.forEach(({pattern:p,alphabet:v,startIndex:g})=>{const{isMatch:m,score:y,indices:b}=lP(e,p,v,{location:o+g,distance:i,threshold:a,findAllMatches:s,minMatchCharLength:u,includeMatches:r,ignoreLocation:l});m&&(d=!0),c+=y,m&&b&&(f=[...f,...b])});let h={isMatch:d,score:d?c/this.chunks.length:1};return d&&r&&(h.indices=f),h}}class Ji{constructor(e){this.pattern=e}static isMultiMatch(e){return _0(e,this.multiRegex)}static isSingleMatch(e){return _0(e,this.singleRegex)}search(){}}function _0(t,e){const n=t.match(e);return n?n[1]:null}class fP extends Ji{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const n=e===this.pattern;return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class dP extends Ji{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const r=e.indexOf(this.pattern)===-1;return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class hP extends Ji{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const n=e.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class pP extends Ji{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const n=!e.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class vP extends Ji{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const n=e.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class mP extends Ji{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const n=!e.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class S0 extends Ji{constructor(e,{location:n=Dt.location,threshold:r=Dt.threshold,distance:o=Dt.distance,includeMatches:i=Dt.includeMatches,findAllMatches:a=Dt.findAllMatches,minMatchCharLength:s=Dt.minMatchCharLength,isCaseSensitive:u=Dt.isCaseSensitive,ignoreLocation:l=Dt.ignoreLocation}={}){super(e),this._bitapSearch=new x0(e,{location:n,threshold:r,distance:o,includeMatches:i,findAllMatches:a,minMatchCharLength:s,isCaseSensitive:u,ignoreLocation:l})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class C0 extends Ji{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let n=0,r;const o=[],i=this.pattern.length;for(;(r=e.indexOf(this.pattern,n))>-1;)n=r+i,o.push([r,n-1]);const a=!!o.length;return{isMatch:a,score:a?0:1,indices:o}}}const Qd=[fP,C0,hP,pP,mP,vP,dP,S0],$0=Qd.length,gP=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,yP="|";function bP(t,e={}){return t.split(yP).map(n=>{let r=n.trim().split(gP).filter(i=>i&&!!i.trim()),o=[];for(let i=0,a=r.length;i<a;i+=1){const s=r[i];let u=!1,l=-1;for(;!u&&++l<$0;){const f=Qd[l];let c=f.isMultiMatch(s);c&&(o.push(new f(c,e)),u=!0)}if(!u)for(l=-1;++l<$0;){const f=Qd[l];let c=f.isSingleMatch(s);if(c){o.push(new f(c,e));break}}}return o})}const kP=new Set([S0.type,C0.type]);class wP{constructor(e,{isCaseSensitive:n=Dt.isCaseSensitive,includeMatches:r=Dt.includeMatches,minMatchCharLength:o=Dt.minMatchCharLength,ignoreLocation:i=Dt.ignoreLocation,findAllMatches:a=Dt.findAllMatches,location:s=Dt.location,threshold:u=Dt.threshold,distance:l=Dt.distance}={}){this.query=null,this.options={isCaseSensitive:n,includeMatches:r,minMatchCharLength:o,findAllMatches:a,ignoreLocation:i,location:s,threshold:u,distance:l},this.pattern=n?e:e.toLowerCase(),this.query=bP(this.pattern,this.options)}static condition(e,n){return n.useExtendedSearch}searchIn(e){const n=this.query;if(!n)return{isMatch:!1,score:1};const{includeMatches:r,isCaseSensitive:o}=this.options;e=o?e:e.toLowerCase();let i=0,a=[],s=0;for(let u=0,l=n.length;u<l;u+=1){const f=n[u];a.length=0,i=0;for(let c=0,d=f.length;c<d;c+=1){const h=f[c],{isMatch:p,indices:v,score:g}=h.search(e);if(p){if(i+=1,s+=g,r){const m=h.constructor.type;kP.has(m)?a=[...a,...v]:a.push(v)}}else{s=0,i=0,a.length=0;break}}if(i){let c={isMatch:!0,score:s/i};return r&&(c.indices=a),c}}return{isMatch:!1,score:1}}}const Yd=[];function jP(...t){Yd.push(...t)}function Xd(t,e){for(let n=0,r=Yd.length;n<r;n+=1){let o=Yd[n];if(o.condition(t,e))return new o(t,e)}return new x0(t,e)}const Hl={AND:"$and",OR:"$or"},Zd={PATH:"$path",PATTERN:"$val"},eh=t=>!!(t[Hl.AND]||t[Hl.OR]),xP=t=>!!t[Zd.PATH],_P=t=>!Oi(t)&&g0(t)&&!eh(t),O0=t=>({[Hl.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function E0(t,e,{auto:n=!0}={}){const r=o=>{let i=Object.keys(o);const a=xP(o);if(!a&&i.length>1&&!eh(o))return r(O0(o));if(_P(o)){const u=a?o[Zd.PATH]:i[0],l=a?o[Zd.PATTERN]:o[u];if(!ti(l))throw new Error(Z8(u));const f={keyId:Gd(u),pattern:l};return n&&(f.searcher=Xd(l,e)),f}let s={children:[],operator:i[0]};return i.forEach(u=>{const l=o[u];Oi(l)&&l.forEach(f=>{s.children.push(r(f))})}),s};return eh(t)||(t=O0(t)),r(t)}function SP(t,{ignoreFieldNorm:e=Dt.ignoreFieldNorm}){t.forEach(n=>{let r=1;n.matches.forEach(({key:o,norm:i,score:a})=>{const s=o?o.weight:null;r*=Math.pow(a===0&&s?Number.EPSILON:a,(s||1)*(e?1:i))}),n.score=r})}function CP(t,e){const n=t.matches;e.matches=[],eo(n)&&n.forEach(r=>{if(!eo(r.indices)||!r.indices.length)return;const{indices:o,value:i}=r;let a={indices:o,value:i};r.key&&(a.key=r.key.src),r.idx>-1&&(a.refIndex=r.idx),e.matches.push(a)})}function $P(t,e){e.score=t.score}function OP(t,e,{includeMatches:n=Dt.includeMatches,includeScore:r=Dt.includeScore}={}){const o=[];return n&&o.push(CP),r&&o.push($P),t.map(i=>{const{idx:a}=i,s={item:e[a],refIndex:a};return o.length&&o.forEach(u=>{u(i,s)}),s})}class ps{constructor(e,n={},r){this.options={...Dt,...n},this.options.useExtendedSearch,this._keyStore=new rP(this.options.keys),this.setCollection(e,r)}setCollection(e,n){if(this._docs=e,n&&!(n instanceof Kd))throw new Error(X8);this._myIndex=n||j0(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){!eo(e)||(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const n=[];for(let r=0,o=this._docs.length;r<o;r+=1){const i=this._docs[r];e(i,r)&&(this.removeAt(r),r-=1,o-=1,n.push(i))}return n}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:n=-1}={}){const{includeMatches:r,includeScore:o,shouldSort:i,sortFn:a,ignoreFieldNorm:s}=this.options;let u=ti(e)?ti(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return SP(u,{ignoreFieldNorm:s}),i&&u.sort(a),m0(n)&&n>-1&&(u=u.slice(0,n)),OP(u,this._docs,{includeMatches:r,includeScore:o})}_searchStringList(e){const n=Xd(e,this.options),{records:r}=this._myIndex,o=[];return r.forEach(({v:i,i:a,n:s})=>{if(!eo(i))return;const{isMatch:u,score:l,indices:f}=n.searchIn(i);u&&o.push({item:i,idx:a,matches:[{score:l,value:i,norm:s,indices:f}]})}),o}_searchLogical(e){const n=E0(e,this.options),r=(s,u,l)=>{if(!s.children){const{keyId:c,searcher:d}=s,h=this._findMatches({key:this._keyStore.get(c),value:this._myIndex.getValueForItemAtKeyId(u,c),searcher:d});return h&&h.length?[{idx:l,item:u,matches:h}]:[]}const f=[];for(let c=0,d=s.children.length;c<d;c+=1){const h=s.children[c],p=r(h,u,l);if(p.length)f.push(...p);else if(s.operator===Hl.AND)return[]}return f},o=this._myIndex.records,i={},a=[];return o.forEach(({$:s,i:u})=>{if(eo(s)){let l=r(n,s,u);l.length&&(i[u]||(i[u]={idx:u,item:s,matches:[]},a.push(i[u])),l.forEach(({matches:f})=>{i[u].matches.push(...f)}))}}),a}_searchObjectList(e){const n=Xd(e,this.options),{keys:r,records:o}=this._myIndex,i=[];return o.forEach(({$:a,i:s})=>{if(!eo(a))return;let u=[];r.forEach((l,f)=>{u.push(...this._findMatches({key:l,value:a[f],searcher:n}))}),u.length&&i.push({idx:s,item:a,matches:u})}),i}_findMatches({key:e,value:n,searcher:r}){if(!eo(n))return[];let o=[];if(Oi(n))n.forEach(({v:i,i:a,n:s})=>{if(!eo(i))return;const{isMatch:u,score:l,indices:f}=r.searchIn(i);u&&o.push({score:l,key:e,value:i,idx:a,norm:s,indices:f})});else{const{v:i,n:a}=n,{isMatch:s,score:u,indices:l}=r.searchIn(i);s&&o.push({score:u,key:e,value:i,norm:a,indices:l})}return o}}ps.version="6.6.2",ps.createIndex=j0,ps.parseIndex=sP,ps.config=Dt,ps.parseQuery=E0,jP(wP);var A0,P0,T0,M0,I0,N0,L0,D0,R0,B0,z0,V0,F0,q0,H0,W0,U0,J0,G0,K0,Q0,Y0,X0,Z0,ey,ty,ny,ry,oy,iy,ay,sy,uy,ly,cy,fy,dy,hy,py,vy,my,gy,yy,by,ky,wy,jy,xy,_y,Sy,Cy,$y,Oy,Ey,Ay,Py,Ty,My,Iy,Ny,Ly,Dy,Ry,By,zy,Vy,Fy,qy,Hy,Wy,Uy,Jy,Gy,Ky,Qy,Yy,Xy,Zy,e1,t1,n1,r1,o1,i1,a1,s1,u1,l1,c1,f1,d1,h1,p1,v1,m1,g1,y1,b1,k1,w1,j1,x1,_1,S1,C1,$1,O1,E1,A1,P1,T1,M1,I1,N1,L1,D1,R1,B1,z1,V1,F1,q1,H1,W1,U1,J1,G1,K1,Q1,Y1,X1,Z1,eb,tb,nb,rb,ob,ib,ab,sb,ub,lb,cb,fb,db,hb,pb,vb,mb,gb,yb,bb,kb,wb,jb,xb,_b,Sb,Cb,$b,Ob,Eb,Ab,Pb,Tb,Mb,Ib,Nb,Lb,Db,Rb,Bb,zb,Vb,Fb,qb,Hb,Wb,Ub,Jb,Gb,Kb,Qb,Yb,Xb,Zb,ek,tk,nk,rk,ok,ik,ak,sk,uk,lk,ck,fk,dk,hk,pk,vk,mk,gk,yk,bk,kk,wk,jk,xk,_k,Sk,Ck,$k,Ok,Ek,Ak,Pk,Tk,Mk,Ik,Nk,Lk,Dk,Rk,Bk,zk,Vk,Fk,qk,Hk,Wk,Uk,Jk,Gk,Kk,Qk,Yk,Xk,Zk,ew,tw,nw,rw,ow,iw,aw,sw,uw,lw,cw,fw,dw,hw,pw,vw,mw,gw,yw,bw,kw,ww,jw,xw,_w,Sw,Cw,$w,Ow,Ew,Aw,Pw,Tw,Mw,Iw,Nw,Lw,Dw,Rw,Bw,zw,Vw;function Wl(t){var e=typeof Map=="function"?new Map:void 0;return(Wl=function(n){if(n===null||(r=n,Function.toString.call(r).indexOf("[native code]")===-1))return n;var r;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,o)}function o(){return Fw(n,arguments,Kt(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Ul(o,n)})(t)}function Fw(t,e,n){return(Fw=Ww()?Reflect.construct.bind():function(r,o,i){var a=[null];a.push.apply(a,o);var s=new(Function.bind.apply(r,a));return i&&Ul(s,i.prototype),s}).apply(null,arguments)}function ne(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function vt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */vt=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=typeof Symbol=="function"?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function s(T,C,z){return Object.defineProperty(T,C,{value:z,enumerable:!0,configurable:!0,writable:!0}),T[C]}try{s({},"")}catch{s=function(C,z,$){return C[z]=$}}function u(T,C,z,$){var S=C&&C.prototype instanceof c?C:c,V=Object.create(S.prototype),Q=new O($||[]);return V._invoke=function(B,K,D){var I="suspendedStart";return function(H,F){if(I==="executing")throw new Error("Generator is already running");if(I==="completed"){if(H==="throw")throw F;return _()}for(D.method=H,D.arg=F;;){var R=D.delegate;if(R){var A=k(R,D);if(A){if(A===f)continue;return A}}if(D.method==="next")D.sent=D._sent=D.arg;else if(D.method==="throw"){if(I==="suspendedStart")throw I="completed",D.arg;D.dispatchException(D.arg)}else D.method==="return"&&D.abrupt("return",D.arg);I="executing";var x=l(B,K,D);if(x.type==="normal"){if(I=D.done?"completed":"suspendedYield",x.arg===f)continue;return{value:x.arg,done:D.done}}x.type==="throw"&&(I="completed",D.method="throw",D.arg=x.arg)}}}(T,z,Q),V}function l(T,C,z){try{return{type:"normal",arg:T.call(C,z)}}catch($){return{type:"throw",arg:$}}}t.wrap=u;var f={};function c(){}function d(){}function h(){}var p={};s(p,o,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(L([])));g&&g!==e&&n.call(g,o)&&(p=g);var m=h.prototype=c.prototype=Object.create(p);function y(T){["next","throw","return"].forEach(function(C){s(T,C,function(z){return this._invoke(C,z)})})}function b(T,C){function z(S,V,Q,B){var K=l(T[S],T,V);if(K.type!=="throw"){var D=K.arg,I=D.value;return I&&at(I)=="object"&&n.call(I,"__await")?C.resolve(I.__await).then(function(H){z("next",H,Q,B)},function(H){z("throw",H,Q,B)}):C.resolve(I).then(function(H){D.value=H,Q(D)},function(H){return z("throw",H,Q,B)})}B(K.arg)}var $;this._invoke=function(S,V){function Q(){return new C(function(B,K){z(S,V,B,K)})}return $=$?$.then(Q,Q):Q()}}function k(T,C){var z=T.iterator[C.method];if(z===void 0){if(C.delegate=null,C.method==="throw"){if(T.iterator.return&&(C.method="return",C.arg=void 0,k(T,C),C.method==="throw"))return f;C.method="throw",C.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var $=l(z,T.iterator,C.arg);if($.type==="throw")return C.method="throw",C.arg=$.arg,C.delegate=null,f;var S=$.arg;return S?S.done?(C[T.resultName]=S.value,C.next=T.nextLoc,C.method!=="return"&&(C.method="next",C.arg=void 0),C.delegate=null,f):S:(C.method="throw",C.arg=new TypeError("iterator result is not an object"),C.delegate=null,f)}function w(T){var C={tryLoc:T[0]};1 in T&&(C.catchLoc=T[1]),2 in T&&(C.finallyLoc=T[2],C.afterLoc=T[3]),this.tryEntries.push(C)}function E(T){var C=T.completion||{};C.type="normal",delete C.arg,T.completion=C}function O(T){this.tryEntries=[{tryLoc:"root"}],T.forEach(w,this),this.reset(!0)}function L(T){if(T){var C=T[o];if(C)return C.call(T);if(typeof T.next=="function")return T;if(!isNaN(T.length)){var z=-1,$=function S(){for(;++z<T.length;)if(n.call(T,z))return S.value=T[z],S.done=!1,S;return S.value=void 0,S.done=!0,S};return $.next=$}}return{next:_}}function _(){return{value:void 0,done:!0}}return d.prototype=h,s(m,"constructor",h),s(h,"constructor",d),d.displayName=s(h,a,"GeneratorFunction"),t.isGeneratorFunction=function(T){var C=typeof T=="function"&&T.constructor;return!!C&&(C===d||(C.displayName||C.name)==="GeneratorFunction")},t.mark=function(T){return Object.setPrototypeOf?Object.setPrototypeOf(T,h):(T.__proto__=h,s(T,a,"GeneratorFunction")),T.prototype=Object.create(m),T},t.awrap=function(T){return{__await:T}},y(b.prototype),s(b.prototype,i,function(){return this}),t.AsyncIterator=b,t.async=function(T,C,z,$,S){S===void 0&&(S=Promise);var V=new b(u(T,C,z,$),S);return t.isGeneratorFunction(C)?V:V.next().then(function(Q){return Q.done?Q.value:V.next()})},y(m),s(m,a,"Generator"),s(m,o,function(){return this}),s(m,"toString",function(){return"[object Generator]"}),t.keys=function(T){var C=[];for(var z in T)C.push(z);return C.reverse(),function $(){for(;C.length;){var S=C.pop();if(S in T)return $.value=S,$.done=!1,$}return $.done=!0,$}},t.values=L,O.prototype={constructor:O,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!T)for(var C in this)C.charAt(0)==="t"&&n.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=void 0)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var C=this;function z(K,D){return V.type="throw",V.arg=T,C.next=K,D&&(C.method="next",C.arg=void 0),!!D}for(var $=this.tryEntries.length-1;$>=0;--$){var S=this.tryEntries[$],V=S.completion;if(S.tryLoc==="root")return z("end");if(S.tryLoc<=this.prev){var Q=n.call(S,"catchLoc"),B=n.call(S,"finallyLoc");if(Q&&B){if(this.prev<S.catchLoc)return z(S.catchLoc,!0);if(this.prev<S.finallyLoc)return z(S.finallyLoc)}else if(Q){if(this.prev<S.catchLoc)return z(S.catchLoc,!0)}else{if(!B)throw new Error("try statement without catch or finally");if(this.prev<S.finallyLoc)return z(S.finallyLoc)}}}},abrupt:function(T,C){for(var z=this.tryEntries.length-1;z>=0;--z){var $=this.tryEntries[z];if($.tryLoc<=this.prev&&n.call($,"finallyLoc")&&this.prev<$.finallyLoc){var S=$;break}}S&&(T==="break"||T==="continue")&&S.tryLoc<=C&&C<=S.finallyLoc&&(S=null);var V=S?S.completion:{};return V.type=T,V.arg=C,S?(this.method="next",this.next=S.finallyLoc,f):this.complete(V)},complete:function(T,C){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&C&&(this.next=C),f},finish:function(T){for(var C=this.tryEntries.length-1;C>=0;--C){var z=this.tryEntries[C];if(z.finallyLoc===T)return this.complete(z.completion,z.afterLoc),E(z),f}},catch:function(T){for(var C=this.tryEntries.length-1;C>=0;--C){var z=this.tryEntries[C];if(z.tryLoc===T){var $=z.completion;if($.type==="throw"){var S=$.arg;E(z)}return S}}throw new Error("illegal catch attempt")},delegateYield:function(T,C,z){return this.delegate={iterator:L(T),resultName:C,nextLoc:z},this.method==="next"&&(this.arg=void 0),f}},t}function qw(t,e,n,r,o,i,a){try{var s=t[i](a),u=s.value}catch(l){return void n(l)}s.done?e(u):Promise.resolve(u).then(r,o)}function _n(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(u){qw(i,r,o,a,s,"next",u)}function s(u){qw(i,r,o,a,s,"throw",u)}a(void 0)})}}function ue(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=th(t))||e&&t&&typeof t.length=="number"){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(u){throw u},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
7
|
+
*/(function(t,e){(function(n,r){t.exports=r()})(Fr,function(){function n(ye){var Ce=typeof ye;return ye!==null&&(Ce==="object"||Ce==="function")}function r(ye){return typeof ye=="function"}var o=void 0;Array.isArray?o=Array.isArray:o=function(ye){return Object.prototype.toString.call(ye)==="[object Array]"};var i=o,a=0,s=void 0,u=void 0,l=function(Ce,Re){E[a]=Ce,E[a+1]=Re,a+=2,a===2&&(u?u(O):_())};function f(ye){u=ye}function c(ye){l=ye}var d=typeof window<"u"?window:void 0,h=d||{},p=h.MutationObserver||h.WebKitMutationObserver,v=typeof self>"u"&&typeof process<"u"&&{}.toString.call(process)==="[object process]",g=typeof Uint8ClampedArray<"u"&&typeof importScripts<"u"&&typeof MessageChannel<"u";function m(){return function(){return process.nextTick(O)}}function y(){return typeof s<"u"?function(){s(O)}:w()}function b(){var ye=0,Ce=new p(O),Re=document.createTextNode("");return Ce.observe(Re,{characterData:!0}),function(){Re.data=ye=++ye%2}}function k(){var ye=new MessageChannel;return ye.port1.onmessage=O,function(){return ye.port2.postMessage(0)}}function w(){var ye=setTimeout;return function(){return ye(O,1)}}var E=new Array(1e3);function O(){for(var ye=0;ye<a;ye+=2){var Ce=E[ye],Re=E[ye+1];Ce(Re),E[ye]=void 0,E[ye+1]=void 0}a=0}function L(){try{var ye=Function("return this")().require("vertx");return s=ye.runOnLoop||ye.runOnContext,y()}catch{return w()}}var _=void 0;v?_=m():p?_=b():g?_=k():d===void 0&&typeof T8=="function"?_=L():_=w();function T(ye,Ce){var Re=this,ge=new this.constructor($);ge[z]===void 0&&se(ge);var Be=Re._state;if(Be){var Ke=arguments[Be-1];l(function(){return we(Be,ge,Ke,Re._result)})}else U(Re,ge,ye,Ce);return ge}function C(ye){var Ce=this;if(ye&&typeof ye=="object"&&ye.constructor===Ce)return ye;var Re=new Ce($);return R(Re,ye),Re}var z=Math.random().toString(36).substring(2);function $(){}var S=void 0,V=1,Q=2;function B(){return new TypeError("You cannot resolve a promise with itself")}function K(){return new TypeError("A promises callback cannot return that same promise.")}function D(ye,Ce,Re,ge){try{ye.call(Ce,Re,ge)}catch(Be){return Be}}function I(ye,Ce,Re){l(function(ge){var Be=!1,Ke=D(Re,Ce,function(yt){Be||(Be=!0,Ce!==yt?R(ge,yt):x(ge,yt))},function(yt){Be||(Be=!0,M(ge,yt))},"Settle: "+(ge._label||" unknown promise"));!Be&&Ke&&(Be=!0,M(ge,Ke))},ye)}function H(ye,Ce){Ce._state===V?x(ye,Ce._result):Ce._state===Q?M(ye,Ce._result):U(Ce,void 0,function(Re){return R(ye,Re)},function(Re){return M(ye,Re)})}function F(ye,Ce,Re){Ce.constructor===ye.constructor&&Re===T&&Ce.constructor.resolve===C?H(ye,Ce):Re===void 0?x(ye,Ce):r(Re)?I(ye,Ce,Re):x(ye,Ce)}function R(ye,Ce){if(ye===Ce)M(ye,B());else if(n(Ce)){var Re=void 0;try{Re=Ce.then}catch(ge){M(ye,ge);return}F(ye,Ce,Re)}else x(ye,Ce)}function A(ye){ye._onerror&&ye._onerror(ye._result),ie(ye)}function x(ye,Ce){ye._state===S&&(ye._result=Ce,ye._state=V,ye._subscribers.length!==0&&l(ie,ye))}function M(ye,Ce){ye._state===S&&(ye._state=Q,ye._result=Ce,l(A,ye))}function U(ye,Ce,Re,ge){var Be=ye._subscribers,Ke=Be.length;ye._onerror=null,Be[Ke]=Ce,Be[Ke+V]=Re,Be[Ke+Q]=ge,Ke===0&&ye._state&&l(ie,ye)}function ie(ye){var Ce=ye._subscribers,Re=ye._state;if(Ce.length!==0){for(var ge=void 0,Be=void 0,Ke=ye._result,yt=0;yt<Ce.length;yt+=3)ge=Ce[yt],Be=Ce[yt+Re],ge?we(Re,ge,Be,Ke):Be(Ke);ye._subscribers.length=0}}function we(ye,Ce,Re,ge){var Be=r(Re),Ke=void 0,yt=void 0,nn=!0;if(Be){try{Ke=Re(ge)}catch(ln){nn=!1,yt=ln}if(Ce===Ke){M(Ce,K());return}}else Ke=ge;Ce._state!==S||(Be&&nn?R(Ce,Ke):nn===!1?M(Ce,yt):ye===V?x(Ce,Ke):ye===Q&&M(Ce,Ke))}function _e(ye,Ce){try{Ce(function(ge){R(ye,ge)},function(ge){M(ye,ge)})}catch(Re){M(ye,Re)}}var N=0;function J(){return N++}function se(ye){ye[z]=N++,ye._state=void 0,ye._result=void 0,ye._subscribers=[]}function ae(){return new Error("Array Methods must be provided an Array")}var ve=function(){function ye(Ce,Re){this._instanceConstructor=Ce,this.promise=new Ce($),this.promise[z]||se(this.promise),i(Re)?(this.length=Re.length,this._remaining=Re.length,this._result=new Array(this.length),this.length===0?x(this.promise,this._result):(this.length=this.length||0,this._enumerate(Re),this._remaining===0&&x(this.promise,this._result))):M(this.promise,ae())}return ye.prototype._enumerate=function(Re){for(var ge=0;this._state===S&&ge<Re.length;ge++)this._eachEntry(Re[ge],ge)},ye.prototype._eachEntry=function(Re,ge){var Be=this._instanceConstructor,Ke=Be.resolve;if(Ke===C){var yt=void 0,nn=void 0,ln=!1;try{yt=Re.then}catch(Z){ln=!0,nn=Z}if(yt===T&&Re._state!==S)this._settledAt(Re._state,ge,Re._result);else if(typeof yt!="function")this._remaining--,this._result[ge]=Re;else if(Be===Fe){var Mn=new Be($);ln?M(Mn,nn):F(Mn,Re,yt),this._willSettleAt(Mn,ge)}else this._willSettleAt(new Be(function(Z){return Z(Re)}),ge)}else this._willSettleAt(Ke(Re),ge)},ye.prototype._settledAt=function(Re,ge,Be){var Ke=this.promise;Ke._state===S&&(this._remaining--,Re===Q?M(Ke,Be):this._result[ge]=Be),this._remaining===0&&x(Ke,this._result)},ye.prototype._willSettleAt=function(Re,ge){var Be=this;U(Re,void 0,function(Ke){return Be._settledAt(V,ge,Ke)},function(Ke){return Be._settledAt(Q,ge,Ke)})},ye}();function Se(ye){return new ve(this,ye).promise}function ce(ye){var Ce=this;return i(ye)?new Ce(function(Re,ge){for(var Be=ye.length,Ke=0;Ke<Be;Ke++)Ce.resolve(ye[Ke]).then(Re,ge)}):new Ce(function(Re,ge){return ge(new TypeError("You must pass an array to race."))})}function Y(ye){var Ce=this,Re=new Ce($);return M(Re,ye),Re}function qe(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function Ge(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}var Fe=function(){function ye(Ce){this[z]=J(),this._result=this._state=void 0,this._subscribers=[],$!==Ce&&(typeof Ce!="function"&&qe(),this instanceof ye?_e(this,Ce):Ge())}return ye.prototype.catch=function(Re){return this.then(null,Re)},ye.prototype.finally=function(Re){var ge=this,Be=ge.constructor;return r(Re)?ge.then(function(Ke){return Be.resolve(Re()).then(function(){return Ke})},function(Ke){return Be.resolve(Re()).then(function(){throw Ke})}):ge.then(Re,Re)},ye}();Fe.prototype.then=T,Fe.all=Se,Fe.race=ce,Fe.resolve=C,Fe.reject=Y,Fe._setScheduler=f,Fe._setAsap=c,Fe._asap=l;function Ae(){var ye=void 0;if(typeof Fr<"u")ye=Fr;else if(typeof self<"u")ye=self;else try{ye=Function("return this")()}catch{throw new Error("polyfill failed because global object is unavailable in this environment")}var Ce=ye.Promise;if(Ce){var Re=null;try{Re=Object.prototype.toString.call(Ce.resolve())}catch{}if(Re==="[object Promise]"&&!Ce.cast)return}ye.Promise=Fe}return Fe.polyfill=Ae,Fe.Promise=Fe,Fe})})(o0),o0.exports.polyfill();const tY="",nY="",i0=j.ref([]),a0=j.ref(null),s0=j.ref(null),u0=j.ref(null),Zr=j.reactive({current:""}),Vd=[],M8=j.ref(!1),Fd=j.readonly(i0),I8=j.readonly(a0),N8=j.readonly(s0),L8=j.readonly(u0),D8=j.readonly(Zr),l0=(t=I8.value)=>{Zr.current=t;const e=Fd.value.findIndex(r=>r.name===t),n=Fd.value.map(r=>r.name);for(let r=0;r<n.length;r++){if(r>0&&r<n.length-1){const o=n[r]+"Minus",i=n[r]+"Plus";Zr[o]=e<=r,Zr[i]=e>=r}Zr[n[r]]=n[r]===t}},c0=(t=N8.value)=>{Zr.orientation=t,Zr.isLandscape=t==="landscape",Zr.isPortrait=t==="portrait"},f0=(t=L8.value||"light")=>{Zr.theme=t,Zr.isDark=t==="dark",Zr.isLight=t==="light"};function qd(t,e){if(typeof window>"u"||!window.matchMedia)return!1;if(typeof window<"u"&&!window.matchMedia)return console.error("Vue3 Mq: No MatchMedia support detected in this browser. Responsive breakpoints not available."),!1;{M8.value=!0;const n=window.matchMedia(t),r=({matches:o})=>{o&&e()};Vd.push({mql:n,cb:r}),n.addEventListener&&typeof n.addEventListener=="function"?n.addEventListener("change",r):n.addListener(r),r(n)}}var Hd=Object.freeze({__proto__:null,[Symbol.toStringTag]:"Module",bootstrap5:{xs:0,sm:576,md:768,lg:992,xl:1200,xxl:1400},bootstrap4:{xs:0,sm:576,md:768,lg:992,xl:1200},bootstrap3:{xs:0,sm:768,md:992,lg:1200},vuetify:{xs:0,sm:600,md:960,lg:1264,xl:1904},tailwind:{xs:0,sm:640,md:768,lg:1024,xl:1280,xxl:1536},devices:{phone:0,tablet:768,laptop:1370,desktop:1906}});const d0=t=>{if(!t||typeof t!="object")return!1;const e=[];for(let n in t){const r=parseFloat(t[n]);n&&typeof n=="string"?/^[^a-z]/i.test(n)||/[^a-zA-Z0-9_]/.test(n)?console.warn(`Vue3 Mq: "${n}" is an invalid breakpoint key. Breakpoint keys must start with a letter and contain only alphanumeric characters and underscores. Skipping.`):!r&&r!==0||isNaN(r)||r<0?console.warn(`Vue3 Mq: "${n}: ${t[n]}" is not a valid breakpoint. Breakpoints should be a number of zero or above. Skipping.`):e.push({name:n,min:r}):console.warn(`Vue3 Mq: Invalid or missing breakpoint key (${JSON.stringify(n)}). Skipping.`)}return e.some(n=>n.min===0)||console.warn("Vue3 Mq: You have not declared a breakpoint with a minimum value of 0. There may be screen sizes to which Vue3Mq does not respond."),new Set(e.map(n=>n.min)).size<e.length&&console.warn("Vue3 Mq: Your breakpoint configuration contains duplicate values. Behaviour may be unpredictable."),e.length!==0&&e.sort((n,r)=>n.min-r.min)};function h0({breakpoints:t,preset:e}){const n=(a=>{if(typeof a=="string"&&Hd[a])return Hd[a];{const s=Object.keys(Hd);return console.error(`Vue3 Mq: "${a}" is not a valid preset. Available options are: ${s.join(", ")}`),!1}})(e),r=d0(t);if(n===!1&&!r)throw new TypeError("Vue3 Mq: You must provide a valid preset, or valid breakpoint settings.");var o;o=r||d0(n),i0.value=o,function(){for(;Vd.length>0;){const a=Vd.shift();if(a&&typeof a=="object"){const{mql:s,cb:u}=a;s.addEventListener&&typeof s.addEventListener=="function"?s.removeEventListener("change",u):s.removeListener(u)}}}(),(()=>{const a=Object.keys(Zr);for(let s of a)delete Zr[s];l0(),c0(),f0()})();const i=Fd.value.reduce((a,s,u,l)=>{const f=`(min-width: ${s.min}px)`,c=u<l.length-1?`(max-width: ${l[u+1].min-1}px)`:null,d=f+(c?" and "+c:"");return Object.assign(a,{[s.name]:d})},{});for(const a in i)qd(i[a],()=>{l0(a)});["portrait","landscape"].forEach(a=>{qd(`(orientation: ${a})`,()=>{c0(a)})}),["light","dark"].forEach(a=>{qd(`(prefers-color-scheme: ${a})`,()=>{f0(a)})})}var R8={install:(t,{preset:e="bootstrap5",breakpoints:n,defaultBreakpoint:r,defaultOrientation:o="landscape",defaultTheme:i}={})=>{try{const u=["landscape","portrait"].includes(s=o)===!1?(console.error(`Vue3 Mq: "${s}" is not a valid default orientation. Reverting to unset value.`),null):s,l=((f=null)=>["dark","light"].includes(f)===!1&&f!==null?(console.error(`Vue3 Mq: "${f}" is not a valid default theme. Reverting to unset value.`),null):f)(i);a=r,a0.value=a,(f=>{s0.value=f})(u),(f=>{u0.value=f})(l),t.provide("mq",D8),t.provide("updateBreakpoints",h0),h0({breakpoints:n,preset:e})}catch(u){console.error(u)}var a,s}};class p0{constructor(){Po(this,"debug");Po(this,"logger",{log:()=>{}})}setupDebugger(e){this.debug=e,e&&(this.logger.log=console.log.bind(window.console))}}const v0=new p0,To=v0.logger;function Wd(t,e){return Date.now()-t+e}function Ud(t){const e=parseInt(t,10);let n=Math.floor(e/3600),r=Math.floor((e-n*3600)/60),o=e-n*3600-r*60;return n<10&&(n="0"+n),r<10&&(r="0"+r),o<10&&(o="0"+o),n+":"+r+":"+o}const B8=j.defineComponent({props:{containerCssClass:String}}),rY="",qr=(t,e)=>{const n=t.__vccOpts||t;for(const[r,o]of e)n[r]=o;return n},z8={class:"modal-header"},V8=j.createTextVNode(" default header "),F8=j.createElementVNode("hr",{class:"solid"},null,-1),q8={class:"modal-body"},H8=j.createTextVNode(" default body "),W8={class:"modal-footer"};function U8(t,e,n,r,o,i){return j.openBlock(),j.createBlock(j.Transition,{name:"modal"},{default:j.withCtx(()=>[j.createElementVNode("div",{class:"modal-mask",onClick:e[2]||(e[2]=a=>t.$emit("close"))},[j.createElementVNode("div",{class:j.normalizeClass(["modal-container bg-gray-800 card-4",t.containerCssClass]),onClick:e[1]||(e[1]=a=>a.stopPropagation())},[j.createElementVNode("div",z8,[j.createElementVNode("button",{class:"close-button",onClick:e[0]||(e[0]=a=>t.$emit("close"))},"X"),j.renderSlot(t.$slots,"header",{},()=>[V8]),F8]),j.createElementVNode("div",q8,[j.renderSlot(t.$slots,"body",{},()=>[H8])]),j.createElementVNode("div",W8,[j.renderSlot(t.$slots,"footer")])],2)])]),_:3})}const hs=qr(B8,[["render",U8]]);function Oi(t){return Array.isArray?Array.isArray(t):y0(t)==="[object Array]"}const J8=1/0;function G8(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-J8?"-0":e}function K8(t){return t==null?"":G8(t)}function ti(t){return typeof t=="string"}function m0(t){return typeof t=="number"}function Q8(t){return t===!0||t===!1||Y8(t)&&y0(t)=="[object Boolean]"}function g0(t){return typeof t=="object"}function Y8(t){return g0(t)&&t!==null}function eo(t){return t!=null}function Jd(t){return!t.trim().length}function y0(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const oY="Extended search is not available",X8="Incorrect 'index' type",Z8=t=>`Invalid value for key ${t}`,eP=t=>`Pattern length exceeds max of ${t}.`,tP=t=>`Missing ${t} property in key`,nP=t=>`Property 'weight' in key '${t}' must be a positive integer`,b0=Object.prototype.hasOwnProperty;class rP{constructor(e){this._keys=[],this._keyMap={};let n=0;e.forEach(r=>{let o=k0(r);n+=o.weight,this._keys.push(o),this._keyMap[o.id]=o,n+=o.weight}),this._keys.forEach(r=>{r.weight/=n})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function k0(t){let e=null,n=null,r=null,o=1,i=null;if(ti(t)||Oi(t))r=t,e=w0(t),n=Gd(t);else{if(!b0.call(t,"name"))throw new Error(tP("name"));const a=t.name;if(r=a,b0.call(t,"weight")&&(o=t.weight,o<=0))throw new Error(nP(a));e=w0(a),n=Gd(a),i=t.getFn}return{path:e,id:n,weight:o,src:r,getFn:i}}function w0(t){return Oi(t)?t:t.split(".")}function Gd(t){return Oi(t)?t.join("."):t}function oP(t,e){let n=[],r=!1;const o=(i,a,s)=>{if(!!eo(i))if(!a[s])n.push(i);else{let u=a[s];const l=i[u];if(!eo(l))return;if(s===a.length-1&&(ti(l)||m0(l)||Q8(l)))n.push(K8(l));else if(Oi(l)){r=!0;for(let f=0,c=l.length;f<c;f+=1)o(l[f],a,s+1)}else a.length&&o(l,a,s+1)}};return o(t,ti(e)?e.split("."):e,0),r?n:n[0]}var Dt={...{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(t,e)=>t.score===e.score?t.idx<e.idx?-1:1:t.score<e.score?-1:1},...{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},...{location:0,threshold:.6,distance:100},...{useExtendedSearch:!1,getFn:oP,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const iP=/[^ ]+/g;function aP(t=1,e=3){const n=new Map,r=Math.pow(10,e);return{get(o){const i=o.match(iP).length;if(n.has(i))return n.get(i);const a=1/Math.pow(i,.5*t),s=parseFloat(Math.round(a*r)/r);return n.set(i,s),s},clear(){n.clear()}}}class Kd{constructor({getFn:e=Dt.getFn,fieldNormWeight:n=Dt.fieldNormWeight}={}){this.norm=aP(n,3),this.getFn=e,this.isCreated=!1,this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((n,r)=>{this._keysMap[n.id]=r})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,ti(this.docs[0])?this.docs.forEach((e,n)=>{this._addString(e,n)}):this.docs.forEach((e,n)=>{this._addObject(e,n)}),this.norm.clear())}add(e){const n=this.size();ti(e)?this._addString(e,n):this._addObject(e,n)}removeAt(e){this.records.splice(e,1);for(let n=e,r=this.size();n<r;n+=1)this.records[n].i-=1}getValueForItemAtKeyId(e,n){return e[this._keysMap[n]]}size(){return this.records.length}_addString(e,n){if(!eo(e)||Jd(e))return;let r={v:e,i:n,n:this.norm.get(e)};this.records.push(r)}_addObject(e,n){let r={i:n,$:{}};this.keys.forEach((o,i)=>{let a=o.getFn?o.getFn(e):this.getFn(e,o.path);if(!!eo(a)){if(Oi(a)){let s=[];const u=[{nestedArrIndex:-1,value:a}];for(;u.length;){const{nestedArrIndex:l,value:f}=u.pop();if(!!eo(f))if(ti(f)&&!Jd(f)){let c={v:f,i:l,n:this.norm.get(f)};s.push(c)}else Oi(f)&&f.forEach((c,d)=>{u.push({nestedArrIndex:d,value:c})})}r.$[i]=s}else if(ti(a)&&!Jd(a)){let s={v:a,n:this.norm.get(a)};r.$[i]=s}}}),this.records.push(r)}toJSON(){return{keys:this.keys,records:this.records}}}function j0(t,e,{getFn:n=Dt.getFn,fieldNormWeight:r=Dt.fieldNormWeight}={}){const o=new Kd({getFn:n,fieldNormWeight:r});return o.setKeys(t.map(k0)),o.setSources(e),o.create(),o}function sP(t,{getFn:e=Dt.getFn,fieldNormWeight:n=Dt.fieldNormWeight}={}){const{keys:r,records:o}=t,i=new Kd({getFn:e,fieldNormWeight:n});return i.setKeys(r),i.setIndexRecords(o),i}function ql(t,{errors:e=0,currentLocation:n=0,expectedLocation:r=0,distance:o=Dt.distance,ignoreLocation:i=Dt.ignoreLocation}={}){const a=e/t.length;if(i)return a;const s=Math.abs(r-n);return o?a+s/o:s?1:a}function uP(t=[],e=Dt.minMatchCharLength){let n=[],r=-1,o=-1,i=0;for(let a=t.length;i<a;i+=1){let s=t[i];s&&r===-1?r=i:!s&&r!==-1&&(o=i-1,o-r+1>=e&&n.push([r,o]),r=-1)}return t[i-1]&&i-r>=e&&n.push([r,i-1]),n}const $a=32;function lP(t,e,n,{location:r=Dt.location,distance:o=Dt.distance,threshold:i=Dt.threshold,findAllMatches:a=Dt.findAllMatches,minMatchCharLength:s=Dt.minMatchCharLength,includeMatches:u=Dt.includeMatches,ignoreLocation:l=Dt.ignoreLocation}={}){if(e.length>$a)throw new Error(eP($a));const f=e.length,c=t.length,d=Math.max(0,Math.min(r,c));let h=i,p=d;const v=s>1||u,g=v?Array(c):[];let m;for(;(m=t.indexOf(e,p))>-1;){let O=ql(e,{currentLocation:m,expectedLocation:d,distance:o,ignoreLocation:l});if(h=Math.min(O,h),p=m+f,v){let L=0;for(;L<f;)g[m+L]=1,L+=1}}p=-1;let y=[],b=1,k=f+c;const w=1<<f-1;for(let O=0;O<f;O+=1){let L=0,_=k;for(;L<_;)ql(e,{errors:O,currentLocation:d+_,expectedLocation:d,distance:o,ignoreLocation:l})<=h?L=_:k=_,_=Math.floor((k-L)/2+L);k=_;let T=Math.max(1,d-_+1),C=a?c:Math.min(d+_,c)+f,z=Array(C+2);z[C+1]=(1<<O)-1;for(let S=C;S>=T;S-=1){let V=S-1,Q=n[t.charAt(V)];if(v&&(g[V]=+!!Q),z[S]=(z[S+1]<<1|1)&Q,O&&(z[S]|=(y[S+1]|y[S])<<1|1|y[S+1]),z[S]&w&&(b=ql(e,{errors:O,currentLocation:V,expectedLocation:d,distance:o,ignoreLocation:l}),b<=h)){if(h=b,p=V,p<=d)break;T=Math.max(1,2*d-p)}}if(ql(e,{errors:O+1,currentLocation:d,expectedLocation:d,distance:o,ignoreLocation:l})>h)break;y=z}const E={isMatch:p>=0,score:Math.max(.001,b)};if(v){const O=uP(g,s);O.length?u&&(E.indices=O):E.isMatch=!1}return E}function cP(t){let e={};for(let n=0,r=t.length;n<r;n+=1){const o=t.charAt(n);e[o]=(e[o]||0)|1<<r-n-1}return e}class x0{constructor(e,{location:n=Dt.location,threshold:r=Dt.threshold,distance:o=Dt.distance,includeMatches:i=Dt.includeMatches,findAllMatches:a=Dt.findAllMatches,minMatchCharLength:s=Dt.minMatchCharLength,isCaseSensitive:u=Dt.isCaseSensitive,ignoreLocation:l=Dt.ignoreLocation}={}){if(this.options={location:n,threshold:r,distance:o,includeMatches:i,findAllMatches:a,minMatchCharLength:s,isCaseSensitive:u,ignoreLocation:l},this.pattern=u?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const f=(d,h)=>{this.chunks.push({pattern:d,alphabet:cP(d),startIndex:h})},c=this.pattern.length;if(c>$a){let d=0;const h=c%$a,p=c-h;for(;d<p;)f(this.pattern.substr(d,$a),d),d+=$a;if(h){const v=c-$a;f(this.pattern.substr(v),v)}}else f(this.pattern,0)}searchIn(e){const{isCaseSensitive:n,includeMatches:r}=this.options;if(n||(e=e.toLowerCase()),this.pattern===e){let p={isMatch:!0,score:0};return r&&(p.indices=[[0,e.length-1]]),p}const{location:o,distance:i,threshold:a,findAllMatches:s,minMatchCharLength:u,ignoreLocation:l}=this.options;let f=[],c=0,d=!1;this.chunks.forEach(({pattern:p,alphabet:v,startIndex:g})=>{const{isMatch:m,score:y,indices:b}=lP(e,p,v,{location:o+g,distance:i,threshold:a,findAllMatches:s,minMatchCharLength:u,includeMatches:r,ignoreLocation:l});m&&(d=!0),c+=y,m&&b&&(f=[...f,...b])});let h={isMatch:d,score:d?c/this.chunks.length:1};return d&&r&&(h.indices=f),h}}class Ji{constructor(e){this.pattern=e}static isMultiMatch(e){return _0(e,this.multiRegex)}static isSingleMatch(e){return _0(e,this.singleRegex)}search(){}}function _0(t,e){const n=t.match(e);return n?n[1]:null}class fP extends Ji{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const n=e===this.pattern;return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class dP extends Ji{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const r=e.indexOf(this.pattern)===-1;return{isMatch:r,score:r?0:1,indices:[0,e.length-1]}}}class hP extends Ji{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const n=e.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,this.pattern.length-1]}}}class pP extends Ji{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const n=!e.startsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class vP extends Ji{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const n=e.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}class mP extends Ji{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const n=!e.endsWith(this.pattern);return{isMatch:n,score:n?0:1,indices:[0,e.length-1]}}}class S0 extends Ji{constructor(e,{location:n=Dt.location,threshold:r=Dt.threshold,distance:o=Dt.distance,includeMatches:i=Dt.includeMatches,findAllMatches:a=Dt.findAllMatches,minMatchCharLength:s=Dt.minMatchCharLength,isCaseSensitive:u=Dt.isCaseSensitive,ignoreLocation:l=Dt.ignoreLocation}={}){super(e),this._bitapSearch=new x0(e,{location:n,threshold:r,distance:o,includeMatches:i,findAllMatches:a,minMatchCharLength:s,isCaseSensitive:u,ignoreLocation:l})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class C0 extends Ji{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let n=0,r;const o=[],i=this.pattern.length;for(;(r=e.indexOf(this.pattern,n))>-1;)n=r+i,o.push([r,n-1]);const a=!!o.length;return{isMatch:a,score:a?0:1,indices:o}}}const Qd=[fP,C0,hP,pP,mP,vP,dP,S0],$0=Qd.length,gP=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,yP="|";function bP(t,e={}){return t.split(yP).map(n=>{let r=n.trim().split(gP).filter(i=>i&&!!i.trim()),o=[];for(let i=0,a=r.length;i<a;i+=1){const s=r[i];let u=!1,l=-1;for(;!u&&++l<$0;){const f=Qd[l];let c=f.isMultiMatch(s);c&&(o.push(new f(c,e)),u=!0)}if(!u)for(l=-1;++l<$0;){const f=Qd[l];let c=f.isSingleMatch(s);if(c){o.push(new f(c,e));break}}}return o})}const kP=new Set([S0.type,C0.type]);class wP{constructor(e,{isCaseSensitive:n=Dt.isCaseSensitive,includeMatches:r=Dt.includeMatches,minMatchCharLength:o=Dt.minMatchCharLength,ignoreLocation:i=Dt.ignoreLocation,findAllMatches:a=Dt.findAllMatches,location:s=Dt.location,threshold:u=Dt.threshold,distance:l=Dt.distance}={}){this.query=null,this.options={isCaseSensitive:n,includeMatches:r,minMatchCharLength:o,findAllMatches:a,ignoreLocation:i,location:s,threshold:u,distance:l},this.pattern=n?e:e.toLowerCase(),this.query=bP(this.pattern,this.options)}static condition(e,n){return n.useExtendedSearch}searchIn(e){const n=this.query;if(!n)return{isMatch:!1,score:1};const{includeMatches:r,isCaseSensitive:o}=this.options;e=o?e:e.toLowerCase();let i=0,a=[],s=0;for(let u=0,l=n.length;u<l;u+=1){const f=n[u];a.length=0,i=0;for(let c=0,d=f.length;c<d;c+=1){const h=f[c],{isMatch:p,indices:v,score:g}=h.search(e);if(p){if(i+=1,s+=g,r){const m=h.constructor.type;kP.has(m)?a=[...a,...v]:a.push(v)}}else{s=0,i=0,a.length=0;break}}if(i){let c={isMatch:!0,score:s/i};return r&&(c.indices=a),c}}return{isMatch:!1,score:1}}}const Yd=[];function jP(...t){Yd.push(...t)}function Xd(t,e){for(let n=0,r=Yd.length;n<r;n+=1){let o=Yd[n];if(o.condition(t,e))return new o(t,e)}return new x0(t,e)}const Hl={AND:"$and",OR:"$or"},Zd={PATH:"$path",PATTERN:"$val"},eh=t=>!!(t[Hl.AND]||t[Hl.OR]),xP=t=>!!t[Zd.PATH],_P=t=>!Oi(t)&&g0(t)&&!eh(t),O0=t=>({[Hl.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function E0(t,e,{auto:n=!0}={}){const r=o=>{let i=Object.keys(o);const a=xP(o);if(!a&&i.length>1&&!eh(o))return r(O0(o));if(_P(o)){const u=a?o[Zd.PATH]:i[0],l=a?o[Zd.PATTERN]:o[u];if(!ti(l))throw new Error(Z8(u));const f={keyId:Gd(u),pattern:l};return n&&(f.searcher=Xd(l,e)),f}let s={children:[],operator:i[0]};return i.forEach(u=>{const l=o[u];Oi(l)&&l.forEach(f=>{s.children.push(r(f))})}),s};return eh(t)||(t=O0(t)),r(t)}function SP(t,{ignoreFieldNorm:e=Dt.ignoreFieldNorm}){t.forEach(n=>{let r=1;n.matches.forEach(({key:o,norm:i,score:a})=>{const s=o?o.weight:null;r*=Math.pow(a===0&&s?Number.EPSILON:a,(s||1)*(e?1:i))}),n.score=r})}function CP(t,e){const n=t.matches;e.matches=[],eo(n)&&n.forEach(r=>{if(!eo(r.indices)||!r.indices.length)return;const{indices:o,value:i}=r;let a={indices:o,value:i};r.key&&(a.key=r.key.src),r.idx>-1&&(a.refIndex=r.idx),e.matches.push(a)})}function $P(t,e){e.score=t.score}function OP(t,e,{includeMatches:n=Dt.includeMatches,includeScore:r=Dt.includeScore}={}){const o=[];return n&&o.push(CP),r&&o.push($P),t.map(i=>{const{idx:a}=i,s={item:e[a],refIndex:a};return o.length&&o.forEach(u=>{u(i,s)}),s})}class ps{constructor(e,n={},r){this.options={...Dt,...n},this.options.useExtendedSearch,this._keyStore=new rP(this.options.keys),this.setCollection(e,r)}setCollection(e,n){if(this._docs=e,n&&!(n instanceof Kd))throw new Error(X8);this._myIndex=n||j0(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){!eo(e)||(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const n=[];for(let r=0,o=this._docs.length;r<o;r+=1){const i=this._docs[r];e(i,r)&&(this.removeAt(r),r-=1,o-=1,n.push(i))}return n}removeAt(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}getIndex(){return this._myIndex}search(e,{limit:n=-1}={}){const{includeMatches:r,includeScore:o,shouldSort:i,sortFn:a,ignoreFieldNorm:s}=this.options;let u=ti(e)?ti(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return SP(u,{ignoreFieldNorm:s}),i&&u.sort(a),m0(n)&&n>-1&&(u=u.slice(0,n)),OP(u,this._docs,{includeMatches:r,includeScore:o})}_searchStringList(e){const n=Xd(e,this.options),{records:r}=this._myIndex,o=[];return r.forEach(({v:i,i:a,n:s})=>{if(!eo(i))return;const{isMatch:u,score:l,indices:f}=n.searchIn(i);u&&o.push({item:i,idx:a,matches:[{score:l,value:i,norm:s,indices:f}]})}),o}_searchLogical(e){const n=E0(e,this.options),r=(s,u,l)=>{if(!s.children){const{keyId:c,searcher:d}=s,h=this._findMatches({key:this._keyStore.get(c),value:this._myIndex.getValueForItemAtKeyId(u,c),searcher:d});return h&&h.length?[{idx:l,item:u,matches:h}]:[]}const f=[];for(let c=0,d=s.children.length;c<d;c+=1){const h=s.children[c],p=r(h,u,l);if(p.length)f.push(...p);else if(s.operator===Hl.AND)return[]}return f},o=this._myIndex.records,i={},a=[];return o.forEach(({$:s,i:u})=>{if(eo(s)){let l=r(n,s,u);l.length&&(i[u]||(i[u]={idx:u,item:s,matches:[]},a.push(i[u])),l.forEach(({matches:f})=>{i[u].matches.push(...f)}))}}),a}_searchObjectList(e){const n=Xd(e,this.options),{keys:r,records:o}=this._myIndex,i=[];return o.forEach(({$:a,i:s})=>{if(!eo(a))return;let u=[];r.forEach((l,f)=>{u.push(...this._findMatches({key:l,value:a[f],searcher:n}))}),u.length&&i.push({idx:s,item:a,matches:u})}),i}_findMatches({key:e,value:n,searcher:r}){if(!eo(n))return[];let o=[];if(Oi(n))n.forEach(({v:i,i:a,n:s})=>{if(!eo(i))return;const{isMatch:u,score:l,indices:f}=r.searchIn(i);u&&o.push({score:l,key:e,value:i,idx:a,norm:s,indices:f})});else{const{v:i,n:a}=n,{isMatch:s,score:u,indices:l}=r.searchIn(i);s&&o.push({score:u,key:e,value:i,norm:a,indices:l})}return o}}ps.version="6.6.2",ps.createIndex=j0,ps.parseIndex=sP,ps.config=Dt,ps.parseQuery=E0,jP(wP);var A0,P0,T0,M0,I0,N0,L0,D0,R0,B0,z0,V0,F0,q0,H0,W0,U0,J0,G0,K0,Q0,Y0,X0,Z0,ey,ty,ny,ry,oy,iy,ay,sy,uy,ly,cy,fy,dy,hy,py,vy,my,gy,yy,by,ky,wy,jy,xy,_y,Sy,Cy,$y,Oy,Ey,Ay,Py,Ty,My,Iy,Ny,Ly,Dy,Ry,By,zy,Vy,Fy,qy,Hy,Wy,Uy,Jy,Gy,Ky,Qy,Yy,Xy,Zy,e1,t1,n1,r1,o1,i1,a1,s1,u1,l1,c1,f1,d1,h1,p1,v1,m1,g1,y1,b1,k1,w1,j1,x1,_1,S1,C1,$1,O1,E1,A1,P1,T1,M1,I1,N1,L1,D1,R1,B1,z1,V1,F1,q1,H1,W1,U1,J1,G1,K1,Q1,Y1,X1,Z1,eb,tb,nb,rb,ob,ib,ab,sb,ub,lb,cb,fb,db,hb,pb,vb,mb,gb,yb,bb,kb,wb,jb,xb,_b,Sb,Cb,$b,Ob,Eb,Ab,Pb,Tb,Mb,Ib,Nb,Lb,Db,Rb,Bb,zb,Vb,Fb,qb,Hb,Wb,Ub,Jb,Gb,Kb,Qb,Yb,Xb,Zb,ek,tk,nk,rk,ok,ik,ak,sk,uk,lk,ck,fk,dk,hk,pk,vk,mk,gk,yk,bk,kk,wk,jk,xk,_k,Sk,Ck,$k,Ok,Ek,Ak,Pk,Tk,Mk,Ik,Nk,Lk,Dk,Rk,Bk,zk,Vk,Fk,qk,Hk,Wk,Uk,Jk,Gk,Kk,Qk,Yk,Xk,Zk,ew,tw,nw,rw,ow,iw,aw,sw,uw,lw,cw,fw,dw,hw,pw,vw,mw,gw,yw,bw,kw,ww,jw,xw,_w,Sw,Cw,$w,Ow,Ew,Aw,Pw,Tw,Mw,Iw,Nw,Lw,Dw,Rw,Bw,zw,Vw;function Wl(t){var e=typeof Map=="function"?new Map:void 0;return(Wl=function(n){if(n===null||(r=n,Function.toString.call(r).indexOf("[native code]")===-1))return n;var r;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(e!==void 0){if(e.has(n))return e.get(n);e.set(n,o)}function o(){return Fw(n,arguments,Kt(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),Ul(o,n)})(t)}function Fw(t,e,n){return(Fw=Ww()?Reflect.construct.bind():function(r,o,i){var a=[null];a.push.apply(a,o);var s=new(Function.bind.apply(r,a));return i&&Ul(s,i.prototype),s}).apply(null,arguments)}function ne(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function vt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */vt=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r=typeof Symbol=="function"?Symbol:{},o=r.iterator||"@@iterator",i=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function s(T,C,z){return Object.defineProperty(T,C,{value:z,enumerable:!0,configurable:!0,writable:!0}),T[C]}try{s({},"")}catch{s=function(C,z,$){return C[z]=$}}function u(T,C,z,$){var S=C&&C.prototype instanceof c?C:c,V=Object.create(S.prototype),Q=new O($||[]);return V._invoke=function(B,K,D){var I="suspendedStart";return function(H,F){if(I==="executing")throw new Error("Generator is already running");if(I==="completed"){if(H==="throw")throw F;return _()}for(D.method=H,D.arg=F;;){var R=D.delegate;if(R){var A=k(R,D);if(A){if(A===f)continue;return A}}if(D.method==="next")D.sent=D._sent=D.arg;else if(D.method==="throw"){if(I==="suspendedStart")throw I="completed",D.arg;D.dispatchException(D.arg)}else D.method==="return"&&D.abrupt("return",D.arg);I="executing";var x=l(B,K,D);if(x.type==="normal"){if(I=D.done?"completed":"suspendedYield",x.arg===f)continue;return{value:x.arg,done:D.done}}x.type==="throw"&&(I="completed",D.method="throw",D.arg=x.arg)}}}(T,z,Q),V}function l(T,C,z){try{return{type:"normal",arg:T.call(C,z)}}catch($){return{type:"throw",arg:$}}}t.wrap=u;var f={};function c(){}function d(){}function h(){}var p={};s(p,o,function(){return this});var v=Object.getPrototypeOf,g=v&&v(v(L([])));g&&g!==e&&n.call(g,o)&&(p=g);var m=h.prototype=c.prototype=Object.create(p);function y(T){["next","throw","return"].forEach(function(C){s(T,C,function(z){return this._invoke(C,z)})})}function b(T,C){function z(S,V,Q,B){var K=l(T[S],T,V);if(K.type!=="throw"){var D=K.arg,I=D.value;return I&&at(I)=="object"&&n.call(I,"__await")?C.resolve(I.__await).then(function(H){z("next",H,Q,B)},function(H){z("throw",H,Q,B)}):C.resolve(I).then(function(H){D.value=H,Q(D)},function(H){return z("throw",H,Q,B)})}B(K.arg)}var $;this._invoke=function(S,V){function Q(){return new C(function(B,K){z(S,V,B,K)})}return $=$?$.then(Q,Q):Q()}}function k(T,C){var z=T.iterator[C.method];if(z===void 0){if(C.delegate=null,C.method==="throw"){if(T.iterator.return&&(C.method="return",C.arg=void 0,k(T,C),C.method==="throw"))return f;C.method="throw",C.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var $=l(z,T.iterator,C.arg);if($.type==="throw")return C.method="throw",C.arg=$.arg,C.delegate=null,f;var S=$.arg;return S?S.done?(C[T.resultName]=S.value,C.next=T.nextLoc,C.method!=="return"&&(C.method="next",C.arg=void 0),C.delegate=null,f):S:(C.method="throw",C.arg=new TypeError("iterator result is not an object"),C.delegate=null,f)}function w(T){var C={tryLoc:T[0]};1 in T&&(C.catchLoc=T[1]),2 in T&&(C.finallyLoc=T[2],C.afterLoc=T[3]),this.tryEntries.push(C)}function E(T){var C=T.completion||{};C.type="normal",delete C.arg,T.completion=C}function O(T){this.tryEntries=[{tryLoc:"root"}],T.forEach(w,this),this.reset(!0)}function L(T){if(T){var C=T[o];if(C)return C.call(T);if(typeof T.next=="function")return T;if(!isNaN(T.length)){var z=-1,$=function S(){for(;++z<T.length;)if(n.call(T,z))return S.value=T[z],S.done=!1,S;return S.value=void 0,S.done=!0,S};return $.next=$}}return{next:_}}function _(){return{value:void 0,done:!0}}return d.prototype=h,s(m,"constructor",h),s(h,"constructor",d),d.displayName=s(h,a,"GeneratorFunction"),t.isGeneratorFunction=function(T){var C=typeof T=="function"&&T.constructor;return!!C&&(C===d||(C.displayName||C.name)==="GeneratorFunction")},t.mark=function(T){return Object.setPrototypeOf?Object.setPrototypeOf(T,h):(T.__proto__=h,s(T,a,"GeneratorFunction")),T.prototype=Object.create(m),T},t.awrap=function(T){return{__await:T}},y(b.prototype),s(b.prototype,i,function(){return this}),t.AsyncIterator=b,t.async=function(T,C,z,$,S){S===void 0&&(S=Promise);var V=new b(u(T,C,z,$),S);return t.isGeneratorFunction(C)?V:V.next().then(function(Q){return Q.done?Q.value:V.next()})},y(m),s(m,a,"Generator"),s(m,o,function(){return this}),s(m,"toString",function(){return"[object Generator]"}),t.keys=function(T){var C=[];for(var z in T)C.push(z);return C.reverse(),function $(){for(;C.length;){var S=C.pop();if(S in T)return $.value=S,$.done=!1,$}return $.done=!0,$}},t.values=L,O.prototype={constructor:O,reset:function(T){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!T)for(var C in this)C.charAt(0)==="t"&&n.call(this,C)&&!isNaN(+C.slice(1))&&(this[C]=void 0)},stop:function(){this.done=!0;var T=this.tryEntries[0].completion;if(T.type==="throw")throw T.arg;return this.rval},dispatchException:function(T){if(this.done)throw T;var C=this;function z(K,D){return V.type="throw",V.arg=T,C.next=K,D&&(C.method="next",C.arg=void 0),!!D}for(var $=this.tryEntries.length-1;$>=0;--$){var S=this.tryEntries[$],V=S.completion;if(S.tryLoc==="root")return z("end");if(S.tryLoc<=this.prev){var Q=n.call(S,"catchLoc"),B=n.call(S,"finallyLoc");if(Q&&B){if(this.prev<S.catchLoc)return z(S.catchLoc,!0);if(this.prev<S.finallyLoc)return z(S.finallyLoc)}else if(Q){if(this.prev<S.catchLoc)return z(S.catchLoc,!0)}else{if(!B)throw new Error("try statement without catch or finally");if(this.prev<S.finallyLoc)return z(S.finallyLoc)}}}},abrupt:function(T,C){for(var z=this.tryEntries.length-1;z>=0;--z){var $=this.tryEntries[z];if($.tryLoc<=this.prev&&n.call($,"finallyLoc")&&this.prev<$.finallyLoc){var S=$;break}}S&&(T==="break"||T==="continue")&&S.tryLoc<=C&&C<=S.finallyLoc&&(S=null);var V=S?S.completion:{};return V.type=T,V.arg=C,S?(this.method="next",this.next=S.finallyLoc,f):this.complete(V)},complete:function(T,C){if(T.type==="throw")throw T.arg;return T.type==="break"||T.type==="continue"?this.next=T.arg:T.type==="return"?(this.rval=this.arg=T.arg,this.method="return",this.next="end"):T.type==="normal"&&C&&(this.next=C),f},finish:function(T){for(var C=this.tryEntries.length-1;C>=0;--C){var z=this.tryEntries[C];if(z.finallyLoc===T)return this.complete(z.completion,z.afterLoc),E(z),f}},catch:function(T){for(var C=this.tryEntries.length-1;C>=0;--C){var z=this.tryEntries[C];if(z.tryLoc===T){var $=z.completion;if($.type==="throw"){var S=$.arg;E(z)}return S}}throw new Error("illegal catch attempt")},delegateYield:function(T,C,z){return this.delegate={iterator:L(T),resultName:C,nextLoc:z},this.method==="next"&&(this.arg=void 0),f}},t}function qw(t,e,n,r,o,i,a){try{var s=t[i](a),u=s.value}catch(l){return void n(l)}s.done?e(u):Promise.resolve(u).then(r,o)}function _n(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(u){qw(i,r,o,a,s,"next",u)}function s(u){qw(i,r,o,a,s,"throw",u)}a(void 0)})}}function ue(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=th(t))||e&&t&&typeof t.length=="number"){n&&(t=n);var r=0,o=function(){};return{s:o,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(u){throw u},f:o}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
8
8
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var i,a=!0,s=!1;return{s:function(){n=n.call(t)},n:function(){var u=n.next();return a=u.done,u},e:function(u){s=!0,i=u},f:function(){try{a||n.return==null||n.return()}finally{if(s)throw i}}}}function rn(){return(rn=typeof Reflect<"u"&&Reflect.get?Reflect.get.bind():function(t,e,n){var r=EP(t,e);if(r){var o=Object.getOwnPropertyDescriptor(r,e);return o.get?o.get.call(arguments.length<3?t:n):o.value}}).apply(this,arguments)}function EP(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=Kt(t))!==null;);return t}function St(t,e){return function(n){if(Array.isArray(n))return n}(t)||function(n,r){var o=n==null?null:typeof Symbol<"u"&&n[Symbol.iterator]||n["@@iterator"];if(o!=null){var i,a,s=[],u=!0,l=!1;try{for(o=o.call(n);!(u=(i=o.next()).done)&&(s.push(i.value),!r||s.length!==r);u=!0);}catch(f){l=!0,a=f}finally{try{u||o.return==null||o.return()}finally{if(l)throw a}}return s}}(t,e)||th(t,e)||function(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
9
9
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function Ie(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Ul(t,e)}function Ul(t,e){return(Ul=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n})(t,e)}function Ne(t){var e=Ww();return function(){var n,r=Kt(t);if(e){var o=Kt(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return Hw(this,n)}}function Hw(t,e){if(e&&(at(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return mt(t)}function mt(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Ww(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function Kt(t){return(Kt=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(t)}function Uw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function st(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Uw(Object(n),!0).forEach(function(r){vu(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Uw(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function vu(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qt(t){return function(e){if(Array.isArray(e))return nh(e)}(t)||function(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}(t)||th(t)||function(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
10
10
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}()}function th(t,e){if(t){if(typeof t=="string")return nh(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?nh(t,e):void 0}}function nh(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function re(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Jw(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function oe(t,e,n){return e&&Jw(t.prototype,e),n&&Jw(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function at(t){return(at=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function Je(){}var Gw=function(t){return t};function Gi(t,e){for(var n in e)t[n]=e[n];return t}function Kw(t){return t()}function Qw(){return Object.create(null)}function In(t){t.forEach(Kw)}function Mo(t){return typeof t=="function"}function nr(t,e){return t!=t?e==e:t!==e||t&&at(t)==="object"||typeof t=="function"}function Zt(t,e){return t!=t?e==e:t!==e}function Io(t,e,n,r){if(t){var o=Yw(t,e,n,r);return t[0](o)}}function Yw(t,e,n,r){return t[1]&&r?Gi(n.ctx.slice(),t[1](r(e))):n.ctx}function No(t,e,n,r){if(t[2]&&r){var o=t[2](r(n));if(e.dirty===void 0)return o;if(at(o)==="object"){for(var i=[],a=Math.max(e.dirty.length,o.length),s=0;s<a;s+=1)i[s]=e.dirty[s]|o[s];return i}return e.dirty|o}return e.dirty}function Lo(t,e,n,r,o,i){if(o){var a=Yw(e,n,r,i);t.p(a,o)}}function Do(t){if(t.ctx.length>32){for(var e=[],n=t.ctx.length/32,r=0;r<n;r++)e[r]=-1;return e}return-1}function Zn(t){return t==null?"":t}function mu(t){return t&&Mo(t.destroy)?t.destroy:Je}var Jl,Xw=typeof window<"u",AP=Xw?function(){return window.performance.now()}:function(){return Date.now()},rh=Xw?function(t){return requestAnimationFrame(t)}:Je,gu=new Set;function Zw(t){gu.forEach(function(e){e.c(t)||(gu.delete(e),e.f())}),gu.size!==0&&rh(Zw)}function q(t,e){t.appendChild(e)}function Mt(t,e,n){var r=oh(t);if(!r.getElementById(e)){var o=ee("style");o.id=e,o.textContent=n,e2(r,o)}}function oh(t){if(!t)return document;var e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function PP(t){var e=ee("style");return e2(oh(t),e),e.sheet}function e2(t,e){q(t.head||t,e)}function he(t,e,n){t.insertBefore(e,n||null)}function fe(t){t.parentNode.removeChild(t)}function Hr(t,e){for(var n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function ee(t){return document.createElement(t)}function Ei(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function tt(t){return document.createTextNode(t)}function xe(){return tt(" ")}function on(){return tt("")}function Le(t,e,n,r){return t.addEventListener(e,n,r),function(){return t.removeEventListener(e,n,r)}}function t2(t){return function(e){return e.stopPropagation(),t.call(this,e)}}function P(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function n2(t,e){var n=Object.getOwnPropertyDescriptors(t.__proto__);for(var r in e)e[r]==null?t.removeAttribute(r):r==="style"?t.style.cssText=e[r]:r==="__value"?t.value=t[r]=e[r]:n[r]&&n[r].set?t[r]=e[r]:P(t,r,e[r])}function Gl(t,e){for(var n in e)P(t,n,e[n])}function ih(t,e,n){e in t?t[e]=typeof t[e]=="boolean"&&n===""||n:P(t,e,n)}function TP(t){return Array.from(t.childNodes)}function Jt(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Ki(t,e){t.value=e==null?"":e}function ni(t,e,n,r){n===null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function r2(t,e){for(var n=0;n<t.options.length;n+=1){var r=t.options[n];if(r.__value===e)return void(r.selected=!0)}t.selectedIndex=-1}function MP(){if(Jl===void 0){Jl=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{Jl=!0}}return Jl}function Ye(t,e,n){t.classList[n?"add":"remove"](e)}function o2(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.bubbles,o=r!==void 0&&r,i=n.cancelable,a=i!==void 0&&i,s=document.createEvent("CustomEvent");return s.initCustomEvent(t,o,a,e),s}var yu,IP=function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0&&arguments[0];re(this,t),this.is_svg=!1,this.is_svg=e,this.e=this.n=null}return oe(t,[{key:"c",value:function(e){this.h(e)}},{key:"m",value:function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:null;this.e||(this.is_svg?this.e=Ei(n.nodeName):this.e=ee(n.nodeName),this.t=n,this.c(e)),this.i(r)}},{key:"h",value:function(e){this.e.innerHTML=e,this.n=Array.from(this.e.childNodes)}},{key:"i",value:function(e){for(var n=0;n<this.n.length;n+=1)he(this.t,this.n[n],e)}},{key:"p",value:function(e){this.d(),this.h(e),this.i(this.a)}},{key:"d",value:function(){this.n.forEach(fe)}}]),t}(),Kl=new Map,ah=0;function NP(t){for(var e=5381,n=t.length;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}function LP(t,e){var n={stylesheet:PP(e),rules:{}};return Kl.set(t,n),n}function i2(t,e,n,r,o,i,a){for(var s=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,u=16.666/r,l=`{
|
|
@@ -179,7 +179,7 @@ This will fail in production.`);s=Tl,s._s.has(r)||(i?Fg(r,e,o,s):Z7(r,o,s),proce
|
|
|
179
179
|
<b>${o}</b>
|
|
180
180
|
Script: ${t.code}
|
|
181
181
|
Label: ${((r=n.currentFrame)==null?void 0:r.label)||"none"}`)}}async function _U(t,e){const n=t.command,r=ar.commands[n.commandType];if(r){const o={args:[],options:{},operator:n.operator,staticOptions:n.staticOptions,code:t.code,commandType:n.commandType,fileName:t.fileName,line:t.line},i=r.argTypes;o.options={};for(const[a,s]of n.args.entries()){let u;if(j8(s))u=await Xg(s,e);else if(typeof s=="string")if(s.search(b8)===0)u=s.substring(3);else if(x8(s)){const l=fu(),f=pU(l,s.substring(1));if(f){const[c,d]=f;u=c[d]}else u=s}else u=s;else u=s;if(o.args.push(u),Array.isArray(i)&&i.length>a){const l=i[a];u!==null&&(o.options[l.name]=u)}}return o}else throw new Error(`${n.commandType} is not a valid command`)}async function Xg(t,e){const n=await _U(t,e),r=ar.commands[n.commandType];if(r)return await r.run(n,e);throw new Error(`${n.commandType} is not a valid command`)}async function SU(t){Td("onPlayerAnswered");const e=fn(),n=e.popAnswerQueue(),r=e.currentLine;try{if(n){const o=ar.commands[n.commandType];if(o)return await o.processPlayerAnswer(n,t)}}catch(o){console.error(o),Bn(`Error after player answer at ${r.fileName}:${r.line+1} (${r.code}<br /> - Error: ${o}`)}}const du=Qo("rendering",{state:()=>({screenHeight:window.innerHeight,screenWidth:window.innerWidth,canvasWidth:window.innerWidth,canvasHeight:window.innerHeight,renderRatio:1,topOffset:0,leftOffset:0,layoutMode:"horizontal"}),actions:{updateScreenSize(t,e,n){this.screenHeight=e,this.screenWidth=t,this.renderRatio=1,this.topOffset=0,this.leftOffset=0,t<gt().layout.verticalLayoutThreshold?this.layoutMode="vertical":this.layoutMode="horizontal"}}}),yn=Qo("main",{state:()=>({ready:!1,playing:!1,errors:[],playTime:{start:0,previousPlaytime:0},saveSlot:0,options:{logging:!1,debug:!1},flowState:"menu",modal:!1,paused:!1}),actions:{async setup(t,e){var n;Or().setMasterVolume((n=e.audioOptions.volume)!=null?n:1),e.audioOptions.defaultMusic&&Or().playChannel("music",e.audioOptions.defaultMusic,0),await fn().loadScripts(t),this.resetAllStores()},startMachine(){Or().stopAll(),Td("onPressStart"),fn().start(),this.ready=!0,this.startPlaying(),ar.callHook("onGameStart"),this.setFlowState("playing")},setSaveSlot(t){this.saveSlot=t,BW(t)},async startGame(t){this.setSaveSlot(t),this.startMachine(),await this.saveGame(),fn().runGame()},async loadGame(t,e){this.setSaveSlot(e),this.startMachine(),t&&(this.setLoadedData(t),Or().reloadAudio(t.audio),fn().jumpToLabel(t.vm.lastLabel))},playerAnswered(t){SU(t)},menuReturn(){this.reset(),this.setFlowState("menu"),gt().audioOptions.defaultMusic&&Or().playChannel("music",gt().audioOptions.defaultMusic,0)},createError(t){this.errors.push({text:t})},clearErrors(){this.errors=[]},setFlowState(t){this.flowState=t},openModal(t){this.modal=t},closeModal(){this.modal=!1},toggleMenu(){this.modal?this.modal=!1:this.modal="menu"},pause(){this.paused=!0},unpause(){this.paused=!1},setOptions(t){this.options=t},startPlaying(){this.playing=!0,this.playTime.start=Date.now()},reset(){this.ready=!1,this.errors=[],this.modal=!1,this.paused=!1,fn().reset(),Or().reset(),this.resetAllStores(),this.playing=!1,this.ready=!0},resetAllStores(){const t=$i(),e=gt();t.setButtons(e),cr().setupSkills(e.skills),Wi().setupHudStats(e.hudStats),mr().setupItems(e.items),Vr().setupQuests(e.quests)},generateSaveData(){return{playTime:Wd(this.playTime.start,this.playTime.previousPlaytime)}},loadSaveData(t){this.playTime.previousPlaytime=t.playTime},saveGame(){const t=$i(),e=cr(),n=Xr(),r=fn(),o=yn(),i=Wi(),a=Or(),s=mr(),u={version:i8,screen:t.generateSaveData(),skills:e.generateSaveData(),dialog:n.generateSaveData(),vm:r.generateSaveData(),main:o.generateSaveData(),hud:i.generateSaveData(),audio:a.generateSaveData(),inventory:s.generateSaveData(),quests:Vr().generateSaveData(),metadata:{saveDate:new Date().toISOString()}};RW(u,this.saveSlot)},setLoadedData(t){const e=$i(),n=cr(),r=Xr(),o=fn(),i=yn(),a=Wi(),s=Or(),u=mr();e.loadSaveData(t.screen),n.loadSaveData(t.skills),r.loadSaveData(t.dialog),o.loadSaveData(t.vm),i.loadSaveData(t.main),a.loadSaveData(t.hud),s.loadSaveData(t.audio),u.loadSaveData(t.inventory),Vr().loadSaveData(t.quests)},getAllStates(){return{main:this,screens:$i(),skills:cr(),dialog:Xr(),vm:fn(),hud:Wi(),audio:Or(),rendering:du(),notifications:$o(),inventory:mr(),quests:Vr()}},overrideStates(t){const e=this.getAllStates();for(const n in t){const r=t[n];Object.assign(e[n],r)}}},getters:{isInGame(t){return t.flowState==="playing"}}});function CU(t,e,n){console.error(`Parser error: ${t.fileName}:${t.currentLine}`,n);const r=`[Parser Error] in <span class="error-filename">${t.fileName}:${e+1}</span> - <b>${n}</b>`;Bn(r)}function Bn(t,...e){const n=yn();console.error(t,...e),t=t.replace(/[\r\n]/g,`
|
|
182
|
-
<br />`),n.createError(`\u274C ${t}`)}const cr=Qo("skills",{state:()=>({skillChecks:{},skills:{}}),actions:{setupSkillCheck(t,e){this.skillChecks[e]=t},passSkillCheck(t,e){this.skillChecks[t].happened=!0,this.skillChecks[t].succeeded=!0,e&&(this.skillChecks[t].hidden=!0)},failSkillCheck(t,e){this.skillChecks[t].happened=!0,this.skillChecks[t].succeeded=!1,e&&(this.skillChecks[t].hidden=!0)},generateSaveData(){return{skillChecks:this.skillChecks,skills:this.skills}},getSkillCheck(t){return this.skillChecks[t]||this.setupSkillCheck(this.createSkillCheckState(),t),this.skillChecks[t]},createSkillCheckState(){return{happened:!1,succeeded:!1,hidden:!1}},loadSaveData(t){this.skillChecks=Nd(this.skillChecks,t.skillChecks),this.skills=Nd(this.skills,t.skills)},setupSkills(t){for(const e in t)this.skills[e]={id:e,level:t[e].startingLevel||0,xp:0}},getSkill(t){return this.skills[t]},getSkillLevel(t){return this.getSkill(t).level},getSkillXp(t){return this.getSkill(t).xp},addXp(t,e){const n=this.getSkill(t);n||Bn(`Skill ${t} doesn't exist`),n.xp+=e,n.xp>=gt().skillOptions.xpPerLevel&&(n.xp=0,n.level++,this.levelledUp(t))},setSkillLevel(t,e){const n=this.getSkill(t);n||Bn(`Skill ${t} doesn't exist`),n.level=e,this.levelledUp(t)},incrementSkill(t,e){this.getSkill(t).level+=e,this.levelledUp(t)},levelledUp(t){const e=gt().skills[t].name,n=this.skills[t].level;gt().skillOptions.notifyLevelUp&&$o().addNotification(`Your skill in ${e} is now level ${n}`)}}});let C8;const $U=j.defineComponent({components:{Modal:hs},setup(){const t=cr(),e=j.computed(()=>t.skills),n=j.computed(()=>t.skillChecks);return{skills:e,skillChecks:n}},data(){return{showDebug:!1,jumping:!1,searchString:"",matches:[],matchCursor:0}},mounted(){window.addEventListener("keydown",t=>{if(this.jumping||(t.key==="d"&&this.toggle(),t.key==="j"&&this.jump()),t.key==="ArrowDown"&&(t.preventDefault(),this.matches.length>this.matchCursor+1?this.matchCursor+=1:this.matchCursor=0),t.key==="ArrowUp"&&(t.preventDefault(),this.matchCursor>0?this.matchCursor-=1:this.matchCursor=this.matches.length-1),t.key==="Escape"&&(this.finishJumping(),this.showDebug=!1),this.jumping&&t.key==="Enter"&&this.matchCursor<this.matches.length){const e=this.matches[this.matchCursor];fn().jumpToLabel(e),this.finishJumping()}})},methods:{finishJumping(){this.jumping=!1,this.matches=[],this.searchString=""},labelSelected(t){const e=t.target.value;fn().jumpToLabel(e),this.close()},close(){this.showDebug=!1},closeErrors(){yn().clearErrors()},open(){this.showDebug=!0;const t=fn(),e=yn(),n=Vr(),r=mr(),o=cr();this.$nextTick(()=>{new $7({target:this.$refs.variablesViewer,props:{content:{text:void 0,json:{data:this.variables,quests:n.quests,items:r.items,skills:o.skills,skillChecks:o.skillChecks}},onChange:i=>{t.overrideData(i.json.data),n.quests=i.json.quests,r.items=i.json.items,o.skills=i.json.skills,o.skillChecks=i.json.skillChecks}}}),new $7({target:this.$refs.stateViewer,props:{content:{text:void 0,json:e.getAllStates()},onChange:i=>{e.overrideStates(i.json)}}})})},toggle(){this.showDebug?this.showDebug=!1:this.jumping?this.finishJumping():this.open()},jump(){C8=new ps(this.labels,{includeScore:!0}),this.jumping=!0,setTimeout(()=>{this.$nextTick(()=>{this.$refs.search.focus()})},10),this.matchCursor=0,this.matches=this.labels},getMatchResultStyle(t){if(t===this.matchCursor)return{background:"var(--light-background)"}},onSearchInput(){const t=this.searchString;console.log(t);const e=C8.search(t);this.matches=e.map(n=>n.item),this.matches.length>0&&this.matchCursor>this.matches.length-1&&(this.matchCursor=this.matches.length-1)},save(){yn().saveGame()},wordCount(){const e=Object.values(this.script).reduce((n,r)=>(To.log(n),n+this.countWordsInScriptBranch(r.branch)),0);alert(`You have ${e} words`)},countWordsInScriptLine(t){if(t.command.commandType==="talk"&&typeof t.command.args[2]=="string")return this.countWordsInString(t.command.args[2]);if(t.command.commandType==="text")return this.countWordsInString(t.code);if(t.command.commandType==="choice"){const e=t.command.staticOptions;let n=this.countWordsInScriptLine(e.prompt);return n+=e.choices.reduce((o,i)=>o+this.countWordsInString(i.prompt.code),0),e.choices.reduce((o,i)=>i.branch?o+this.countWordsInScriptBranch(i.branch):o,n)}if(t.command.commandType==="if"){const e=t.command.staticOptions;return[e.success,e.failure].reduce((r,o)=>o?r+this.countWordsInScriptBranch(o):r,0)}return 0},countWordsInString(t){return t.split(" ").length},countWordsInScriptBranch(t){return t.reduce((e,n)=>n?e+this.countWordsInScriptLine(n):e,0)},getPlayTimeString(){const t=Wd(this.playTime.start,this.playTime.previousPlaytime);return Ud(t/1e3)}},computed:{...Ci(fn,["script","data"]),...Ci(yn,["playTime","errors","playing","flowState"]),labels(){const t=this.script;return Object.keys(t).sort()},variables(){return this.data}}}),uY="",OU={class:"debug-menu"},EU={key:0,class:"debug-info"},AU=[j.createElementVNode("h3",null,"Debug mode is ON",-1),j.createElementVNode("ul",null,[j.createElementVNode("li",null,[j.createElementVNode("b",null,"j"),j.createTextVNode(": Quick Label Jump")]),j.createElementVNode("li",null,[j.createElementVNode("b",null,"d"),j.createTextVNode(": Debug Menu")]),j.createElementVNode("li",null,[j.createElementVNode("b",null,"Escape"),j.createTextVNode(": Toggle Menu")])],-1)],PU=j.createElementVNode("h3",{class:"title"},"Jump to label",-1),TU={key:0,class:"search-results"},MU={key:1},IU=[j.createElementVNode("h3",null,"No matches found",-1)],NU=j.createElementVNode("h3",{class:"title"},"Error(s)",-1),LU=j.createTextVNode(" There are errors in your dialogue scripts. Open the developer console for more details. "),DU=["innerHTML"],RU=j.createElementVNode("h3",{class:"title"},"Debug Menu!",-1),BU={class:"container"},zU=j.createTextVNode(" Hello this is the debug menu. "),VU=j.createElementVNode("option",{class:"option",selected:"",disabled:""},"Jump to a label",-1),FU=["value"],qU={class:"grid grid-cols-3 gap-4"},HU=j.createElementVNode("h2",null,"Variables Editor",-1),WU={ref:"variablesViewer"},UU=j.createElementVNode("h2",null,"Skill Checks",-1),JU={class:"table-auto"},GU=j.createElementVNode("thead",null,[j.createElementVNode("tr",null,[j.createElementVNode("th",null,"Skill Check"),j.createElementVNode("th",null,"Happened"),j.createElementVNode("th",null,"Succeeded")])],-1),KU=j.createElementVNode("h2",null,"App State editor (entire app and engine",-1),QU=j.createElementVNode("h3",{style:{color:"pink"}}," Use for debugging, editing some of those things can cause issues ",-1),YU={ref:"stateViewer"};function XU(t,e,n,r,o,i){const a=j.resolveComponent("modal");return j.openBlock(),j.createElementBlock("div",OU,[j.createElementVNode("button",{onClick:e[0]||(e[0]=(...s)=>t.open&&t.open(...s)),class:"button debug-button"},"Debug Menu"),!t.playing&&t.flowState==="menu"?(j.openBlock(),j.createElementBlock("div",EU,AU)):j.createCommentVNode("",!0),t.jumping?(j.openBlock(),j.createBlock(a,{key:1,onClose:t.finishJumping,containerCssClass:"jump-menu-container"},{header:j.withCtx(()=>[PU]),body:j.withCtx(()=>[j.withDirectives(j.createElementVNode("input",{type:"text",class:"label-input input",ref:"search","onUpdate:modelValue":e[1]||(e[1]=s=>t.searchString=s),onInput:e[2]||(e[2]=(...s)=>t.onSearchInput&&t.onSearchInput(...s))},null,544),[[j.vModelText,t.searchString]]),t.matches.length>0?(j.openBlock(),j.createElementBlock("div",TU,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.matches,(s,u)=>(j.openBlock(),j.createElementBlock("div",{class:"search-result",style:j.normalizeStyle(t.getMatchResultStyle(u)),key:u},j.toDisplayString(s),5))),128))])):(j.openBlock(),j.createElementBlock("div",MU,IU))]),_:1},8,["onClose"])):j.createCommentVNode("",!0),t.errors.length>0?(j.openBlock(),j.createBlock(a,{key:2,onClose:t.closeErrors,containerCssClass:"debug-menu-container"},{header:j.withCtx(()=>[NU]),body:j.withCtx(()=>[LU,j.createElementVNode("ul",null,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.errors,(s,u)=>(j.openBlock(),j.createElementBlock("li",{key:u,class:"error-message list-disc",innerHTML:s.text},null,8,DU))),128))])]),_:1},8,["onClose"])):j.createCommentVNode("",!0),t.showDebug?(j.openBlock(),j.createBlock(a,{key:3,onClose:t.close,containerCssClass:"debug-menu-container"},{header:j.withCtx(()=>[RU]),body:j.withCtx(()=>[j.createElementVNode("div",BU,[zU,j.createElementVNode("select",{class:"select",name:"label-selector",onChange:e[3]||(e[3]=s=>t.labelSelected(s))},[VU,(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.labels,s=>(j.openBlock(),j.createElementBlock("option",{class:"option",value:s,key:s},j.toDisplayString(s),9,FU))),128))],32),j.createElementVNode("div",qU,[j.createElementVNode("button",{onClick:e[4]||(e[4]=(...s)=>t.wordCount&&t.wordCount(...s)),class:"button"},"Word Count"),j.createElementVNode("button",{onClick:e[5]||(e[5]=(...s)=>t.save&&t.save(...s)),class:"button"},"Save Game")]),j.createElementVNode("h3",null,"Play time: "+j.toDisplayString(t.getPlayTimeString()),1),HU,j.createElementVNode("div",WU,null,512),UU,j.createElementVNode("table",JU,[GU,j.createElementVNode("tbody",null,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.skillChecks,(s,u)=>(j.openBlock(),j.createElementBlock("tr",{key:u},[j.createElementVNode("td",null,j.toDisplayString(u),1),j.createElementVNode("td",null,j.toDisplayString(s.happened?"\u2705":"\u274C"),1),j.createElementVNode("td",null,j.toDisplayString(s.happened?s.succeeded?"\u2705":"\u274C":"NA"),1)]))),128))])]),KU,QU,j.createElementVNode("div",YU,null,512)])]),_:1},8,["onClose"])):j.createCommentVNode("",!0)])}const ZU=qr($U,[["render",XU]]),eJ=j.defineComponent({data(){return{}},methods:{getStatImage(t){return Al(this.statsConfig[t].icon)}},computed:{...Ci(Wi,["hudStats"]),...Ci(du,["layoutMode"]),statsConfig(){return gt().hudStats},stats(){return this.hudStats},hudStyle(){let t="0";return this.layoutMode==="horizontal"&&(t=`${gt().layout.minTextWidth}px`),{right:t}}}}),dY="",tJ=["src"],nJ={class:"bold hud-text"},rJ=j.createTextVNode(": ");function oJ(t,e,n,r,o,i){return j.openBlock(),j.createElementBlock("div",{class:"hud",style:j.normalizeStyle(t.hudStyle)},[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.stats,(a,s)=>(j.openBlock(),j.createElementBlock("div",{key:s,class:"hud-stat"},[j.createElementVNode("img",{class:"hud-icon",src:t.getStatImage(s)},null,8,tJ),j.createElementVNode("span",nJ,j.toDisplayString(t.statsConfig[s].name),1),rJ,j.createElementVNode("span",null,j.toDisplayString(Math.floor(a.value*100)/100),1)]))),128))],4)}const iJ=qr(eJ,[["render",oJ]]),aJ=j.defineComponent({props:{percentage:Number,step:String},methods:{loadingStyle(){return{width:`${this.percentage*40}vw`}}},computed:{}}),hY="",sJ={id:"loading-bar"},uJ={id:"loading-text"};function lJ(t,e,n,r,o,i){return j.openBlock(),j.createElementBlock("div",sJ,[j.createElementVNode("div",{id:"inner-loading-bar",style:j.normalizeStyle(t.loadingStyle())},null,4),j.createElementVNode("div",uJ,[j.createElementVNode("h3",null,"Loading "+j.toDisplayString(Math.floor(t.percentage*100))+"% - "+j.toDisplayString(t.step),1)])])}const cJ=qr(aJ,[["render",lJ]]),fJ=j.defineComponent({data(){},methods:{},computed:{...Ci($o,["notifications"])}}),pY="",dJ=["innerHTML"];function hJ(t,e,n,r,o,i){return j.openBlock(),j.createBlock(j.TransitionGroup,{name:"notification",tag:"div",class:"notifications-holder"},{default:j.withCtx(()=>[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.notifications,(a,s)=>(j.openBlock(),j.createElementBlock("div",{class:"notification",key:s},[j.createElementVNode("h3",{innerHTML:a.text},null,8,dJ)]))),128))]),_:1})}const pJ=qr(fJ,[["render",hJ]]);let Zg;function vJ(t){Zg=t}function e0(t){return Zg.characters[t]}function mJ(t,e){const n=e0(t);if(e||(e="default"),n.sprites)return`${Zg.config.imagesPath}${n.sprites[e]}`}function Ld(t){return t?e0(t).style||{}:{}}function $8(t,e,n,r){const o=t/n,i=e/r;return Math.min(o,i)}let O8=0,E8=0;function gJ(t){return To.log("Loading images"),new Promise((e,n)=>{if(Object.keys(t.images).length<1){e();return}for(const r in t.images){const o=t.images[r];yJ(r,o,e,n)}})}function yJ(t,e,n,r){O8++,To.log(`Loading image ${t} at ${e}`);const o=new Image;o.onload=()=>{E8+=1,To.log(`Loaded image ${t} successfully`),E8>=O8&&(To.log("All images loaded"),n())},o.onerror=i=>{Bn(`Failed to load image ${t} at ${e}`,i),r(i)},o.src=e}function A8(t,e=50,n={}){var c,d;let r;const o=(c=n.isImmediate)!=null?c:!1,i=(d=n.callback)!=null?d:!1,a=n.maxWait;let s=Date.now(),u=[];function l(){if(console.log("wait: ",e),a!==void 0){const h=Date.now()-s;if(h+e>=a)return a-h}return e}const f=function(...h){const p=this;return new Promise((v,g)=>{const m=function(){if(r=void 0,s=Date.now(),!o){const k=t.apply(p,h);i&&i(k),u.forEach(({resolve:w})=>w(k)),u=[]}};console.log("should call now? ",o,r);const y=o&&r===void 0;r!==void 0&&(console.log("clearing timeout"),clearTimeout(r));const b=l();if(console.log(`nextInvoke: ${b}`),r=setTimeout(m,b),y){console.log("calling");const k=t.apply(p,h);return i&&i(k),v(k)}u.push({resolve:v,reject:g})})};return f.cancel=function(h){r!==void 0&&clearTimeout(r),u.forEach(({reject:p})=>p(h)),u=[]},f}const bJ=j.defineComponent({data(){return{muted:!1,volumes:[],modeNames:{master:"Master volume:",music:"Music:",ambiant:"Ambiant:",sound:"Sound effects:"}}},mounted(){const t=Or(),e=ja.Howler.volume();this.volumes.push({mode:"master",volume:e}),t.modes.forEach((n,r)=>{this.volumes.push({mode:r,volume:t.modes.get(r).options.volume})})},methods:{changeVolume(t,e){const n=e.target;t==="master"?Or().setMasterVolume(n.value):Or().setModeVolume(t,n.value)},toggleMute(){this.muted?(ja.Howler.mute(!1),this.muted=!1):(ja.Howler.mute(!0),this.muted=!0)}}}),vY="",kJ={class:"volume-controls"},wJ=j.createElementVNode("h3",{class:"subtitle"},"Volume",-1),jJ={for:"volume",class:"volume-label"},xJ=["onUpdate:modelValue","onChange"];function _J(t,e,n,r,o,i){return j.openBlock(),j.createElementBlock("div",kJ,[wJ,(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.volumes,(a,s)=>(j.openBlock(),j.createElementBlock("div",{class:"volume-control",key:a.mode},[j.createElementVNode("label",jJ,j.toDisplayString(t.modeNames[a.mode]),1),j.withDirectives(j.createElementVNode("input",{ref_for:!0,ref:"slider",class:"volume-slider",type:"range",id:"volume",name:"volume",min:"0",max:"1",step:"0.1","onUpdate:modelValue":u=>t.volumes[s].volume=u,onChange:u=>t.changeVolume(a.mode,u)},null,40,xJ),[[j.vModelText,t.volumes[s].volume]])]))),128))])}const SJ=qr(bJ,[["render",_J]]),CJ=j.defineComponent({components:{Modal:hs,VolumeControls:SJ},data(){return{}},mounted(){},methods:{quit(){window.close()},mainMenu(){yn().menuReturn(),this.closeMenu()},closeMenu(){this.$emit("close")},getPlayTimeString(){const t=Wd(this.playTime.start,this.playTime.previousPlaytime);return Ud(t/1e3)}},computed:{...Ci(yn,["playTime"])}}),mY="",$J=j.createElementVNode("h3",{class:"title"},"Menu",-1),OJ={class:"menu-content"};function EJ(t,e,n,r,o,i){const a=j.resolveComponent("VolumeControls"),s=j.resolveComponent("modal");return j.openBlock(),j.createBlock(s,{class:"menu",onClose:e[2]||(e[2]=u=>t.$emit("close")),containerCssClass:"main-menu-modal"},{header:j.withCtx(()=>[$J]),body:j.withCtx(()=>[j.createElementVNode("div",OJ,[j.createElementVNode("h3",null,"Play time: "+j.toDisplayString(t.getPlayTimeString()),1),j.createVNode(a),j.createElementVNode("button",{class:"button title quit-button",onClick:e[0]||(e[0]=(...u)=>t.mainMenu&&t.mainMenu(...u))}," Main Menu "),j.createElementVNode("button",{class:"button title quit-button",onClick:e[1]||(e[1]=(...u)=>t.quit&&t.quit(...u))},"Exit")])]),_:1})}const AJ=qr(CJ,[["render",EJ]]),PJ=j.defineComponent({setup(){const t=cr();return{skills:j.computed(()=>t.skills)}},components:{Modal:hs},data(){return{chosenSkill:!1}},mounted(){},methods:{getSkillStyle(t){return{backgroundImage:`url(${this.skillConf[t].icon})`}},getSkillName(t){return this.skillConf[t].name},clickSkill(t){this.chosenSkill=t},closeSkill(){this.chosenSkill=!1},xpBarWidth(t){return{width:`${Math.floor(t/this.xpPerLevel*100)}%`}}},computed:{skillsToDisplay(){const t={};for(const e in this.skills)this.skillConf[e].hidden&&this.skills[e].level<1||(t[e]=this.skills[e]);return t},skillConf(){return gt().skills},xpPerLevel(){return gt().skillOptions.xpPerLevel}}}),gY="",TJ=j.createElementVNode("h3",{class:"title"},"Skills",-1),MJ={key:0,class:"skills-container"},IJ=["onClick"],NJ={class:"skill-title"},LJ={class:"skill-xp-container"},DJ={class:"skill-xp-text"},RJ={class:"skill-level"},BJ={key:1},zJ={class:"flex flex-row skill-description-container"},VJ={class:"flex skill-left"},FJ={class:"flex skill-right"},qJ=j.createElementVNode("hr",{class:"hr-solid"},null,-1);function HJ(t,e,n,r,o,i){const a=j.resolveComponent("modal");return j.openBlock(),j.createBlock(a,{class:"menu",onClose:e[1]||(e[1]=s=>t.$emit("close")),containerCssClass:"skills-modal"},{header:j.withCtx(()=>[TJ]),body:j.withCtx(()=>[t.chosenSkill?typeof t.chosenSkill=="string"?(j.openBlock(),j.createElementBlock("div",BJ,[j.createElementVNode("div",zJ,[j.createElementVNode("div",VJ,[j.createElementVNode("div",{class:"skill-display",style:j.normalizeStyle(t.getSkillStyle(t.chosenSkill))},null,4)]),j.createElementVNode("div",FJ,[j.createElementVNode("h2",null,j.toDisplayString(t.getSkillName(t.chosenSkill)),1),qJ,j.createElementVNode("h3",null,"Level: "+j.toDisplayString(t.skills[t.chosenSkill].level),1),j.createElementVNode("p",null,j.toDisplayString(t.skillConf[t.chosenSkill].description),1)])]),j.createElementVNode("button",{class:"button",onClick:e[0]||(e[0]=(...s)=>t.closeSkill&&t.closeSkill(...s))},j.toDisplayString("<--"))])):j.createCommentVNode("",!0):(j.openBlock(),j.createElementBlock("div",MJ,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.skillsToDisplay,s=>(j.openBlock(),j.createElementBlock("button",{onClick:()=>t.clickSkill(s.id),class:"skill-display",style:j.normalizeStyle(t.getSkillStyle(s.id)),key:s.id},[j.createElementVNode("h3",NJ,j.toDisplayString(t.getSkillName(s.id)),1),j.createElementVNode("div",LJ,[j.createElementVNode("div",{class:"skill-xp-bar",style:j.normalizeStyle(t.xpBarWidth(s.xp))},null,4),j.createElementVNode("h3",DJ,j.toDisplayString(s.xp)+" / "+j.toDisplayString(t.xpPerLevel)+" XP",1)]),j.createElementVNode("h3",RJ,j.toDisplayString(s.level),1)],12,IJ))),128))]))]),_:1})}const WJ=qr(PJ,[["render",HJ]]),UJ=j.defineComponent({setup(){const t=mr(),e=Xr(),n=j.computed(()=>t.items),r=j.computed(()=>e.currentDialog.choices);return{items:n,currentlyChoosing:r}},components:{Modal:hs},data(){return{chosenId:!1}},mounted(){},methods:{close(){this.$emit("close")},getItemStyle(t){return{backgroundImage:`url(${this.itemConf[t].icon})`}},getItemName(t){return this.itemConf[t].name},getItemConf(t){return this.itemConf[t]},clickItem(t){this.chosenId=t},closeItem(){this.chosenId=!1},useItem(){if(this.chosenItem&&this.canUseChosenItem&&this.chosenItemConf){const t=this.chosenItemConf.onUse;this.close(),t.action==="jump"?fn().jumpToLabel(t.label):t.action==="run"?fn().runThenGoBackToPreviousDialog(t.label,!0):Bn(`Unknown action ${t.action}`)}},canUseItem(t){const e=this.itemConf[t.id];return!!(e&&e.onUse&&!mr().isInteractionTagBlocked(e.tag)&&!this.currentlyChoosing)}},computed:{itemsToDisplay(){const t={};for(const e in this.items)this.items[e].amount>0&&(t[e]=this.items[e]);return t},chosenItem(){return this.chosenId?this.items[this.chosenId]:null},canUseChosenItem(){return this.canUseItem(this.chosenItem)},chosenItemConf(){return this.chosenId?this.itemConf[this.chosenId]:null},itemConf(){return gt().items}}}),yY="",JJ=j.createElementVNode("h3",{class:"title"},"Inventory",-1),GJ={key:0,class:"inventory-container"},KJ=["onClick"],QJ={class:"item-title"},YJ={class:"item-amount"},XJ={key:1},ZJ={class:"flex flex-row item-description-container"},eG={class:"flex item-left"},tG={class:"flex item-right"},nG=j.createElementVNode("hr",{class:"hr-solid"},null,-1),rG={key:2},oG=[j.createElementVNode("h2",null,"The inventory is empty!",-1)];function iG(t,e,n,r,o,i){const a=j.resolveComponent("modal");return j.openBlock(),j.createBlock(a,{class:"menu",onClose:t.close,containerCssClass:"inventory-modal"},{header:j.withCtx(()=>[JJ]),body:j.withCtx(()=>[!t.chosenItem&&Object.keys(t.itemsToDisplay).length>0?(j.openBlock(),j.createElementBlock("div",GJ,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.itemsToDisplay,s=>(j.openBlock(),j.createElementBlock("button",{onClick:()=>t.clickItem(s.id),class:"item-display",style:j.normalizeStyle(t.getItemStyle(s.id)),key:s.id},[j.createElementVNode("h3",QJ,j.toDisplayString(t.getItemName(s.id)),1),j.createElementVNode("h3",YJ,j.toDisplayString(s.amount),1)],12,KJ))),128))])):typeof t.chosenId=="string"?(j.openBlock(),j.createElementBlock("div",XJ,[j.createElementVNode("div",ZJ,[j.createElementVNode("div",eG,[j.createElementVNode("div",{class:"item-display",style:j.normalizeStyle(t.getItemStyle(t.chosenId))},null,4)]),j.createElementVNode("div",tG,[j.createElementVNode("h2",null,j.toDisplayString(t.getItemName(t.chosenId)),1),nG,j.createElementVNode("h3",null,"Amount: "+j.toDisplayString(t.chosenItem.amount),1),j.createElementVNode("p",null,j.toDisplayString(t.chosenItemConf.description),1),j.createElementVNode("button",{onClick:e[0]||(e[0]=(...s)=>t.useItem&&t.useItem(...s)),class:j.normalizeClass(["button",t.canUseChosenItem?"":"disabled"])}," Use ",2)])]),j.createElementVNode("button",{class:"button",onClick:e[1]||(e[1]=(...s)=>t.closeItem&&t.closeItem(...s))},j.toDisplayString("<--"))])):(j.openBlock(),j.createElementBlock("div",rG,oG))]),_:1},8,["onClose"])}const aG=qr(UJ,[["render",iG]]),sG=j.defineComponent({props:{pictureUrl:String},computed:{...Ci(du,["layoutMode"]),boxStyle(){const t=gt().layout;let e=0,n=0;return this.layoutMode==="vertical"?(e="50%",n=`${t.mobileDialogHeightPercentage-5}%`):(e=`${t.minTextWidth-10}px`,n="20%"),{right:e,bottom:n,width:`${t.portraits.width}px`,height:`${t.portraits.height}px`}}}}),kY="",uG=["src"];function lG(t,e,n,r,o,i){return j.openBlock(),j.createElementBlock("div",{class:"dialog-picture override",style:j.normalizeStyle(t.boxStyle)},[j.createElementVNode("img",{src:t.pictureUrl,class:"picture override"},null,8,uG)],4)}const cG=qr(sG,[["render",lG]]);class fG{constructor(){Po(this,"listeners",{})}on(e,n){return this.listeners[e]||this.addEventToMap(e),this.listeners[e].add(n),n}off(e,n){return this.listeners[e]&&this.listeners[e].delete(n),n}once(e,n){const r=(...o)=>{this.off(e,r),n(...o)};return this.on(e,r)}emit(e,...n){this.listeners[e]&&this.listeners[e].forEach(r=>r(...n))}clear(){Object.keys(this.listeners).forEach(e=>{delete this.listeners[e]})}addEventToMap(e){this.listeners[e]=new Set}}class dG extends fG{setup(e=!1){const r=e?"keydown":"keyup",o=A8(i=>{Nl.emit("debouncedKeydown",i)},10,{isImmediate:!0,maxWait:10});document.addEventListener("keydown",i=>{Nl.emit("keydown",i)}),document.addEventListener(r,i=>{o(i)})}}const Nl=new dG,hG=j.defineComponent({data(){return{playerText:"",passed:!1,listener:null,timeout:null}},props:{options:{type:Object,required:!0},active:Boolean},mounted(){if(this.canInteract){const t=e=>{if(this.canInteract&&this.options.textField&&e.key==="Enter"&&this.submitText(),this.canInteract&&!this.options.textField){let n=-1;if(e.key===" ")n=0;else switch(e.key){case" ":n=0;break;case"1":n=0;break;case"2":n=1;break;case"3":n=2;break;case"4":n=3;break;case"5":n=4;break;case"6":n=5;break;case"7":n=6;break;case"8":n=7;break}n!==-1&&(this.choices&&n<this.choices.length?this.chooseOption(this.choices[n]):this.chooseOption(n))}};this.listener=Nl.on("debouncedKeydown",t),this.timeout=setTimeout(()=>{this.options.textField&&this.$refs.playerInput.focus()},10)}},unmounted(){this.clearListeners()},computed:{...Ci(yn,["paused"]),preText(){return this.options.title?" \u2013 ":""},style(){return Ld(this.options.styleId)},dialogBoxStyle(){const t=Ld(this.options.styleId),e={opacity:this.options.old?"0.7":"1"};return this.options.title||(e.marginTop="-20px"),{...t.boxCss,...e}},titleStyle(){const t=Ld(this.options.styleId);return{color:t.color,...t.nameCss}},textStyle(){return Ld(this.options.styleId).textCss},choices(){if(this.options.choices)return this.options.choices},canInteract(){return this.active&&!this.passed&&this.options.interactive&&!this.paused}},methods:{clearListeners(){this.listener&&(Nl.off("keydown",this.listener),this.listener=null),this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},chooseOption(t){this.finishLine();let e;typeof t=="object"?e=t.originalIndex:e=t,yn().playerAnswered(e)},finishLine(){this.clearListeners(),this.passed=!0},dialogStyle(t){const e={};return t.allowed||(e.pointerEvents="none",e.textDecoration="line-through"),e},dialogClass(t){if(!t.allowed)return"strike-anim"},submitText(){const t=this.playerText;yn().playerAnswered(t)}}}),wY="",pG={class:"dialog-content"},vG=["innerHTML"],mG=["innerHTML"],gG=["innerHTML"],yG={key:1,class:"dialog-choices"},bG=["onClick","innerHTML"],kG={key:2},wG={key:3,class:"buttons-container"};function jG(t,e,n,r,o,i){return j.openBlock(),j.createElementBlock("div",{class:"dialog-box w-full override",style:j.normalizeStyle(t.dialogBoxStyle)},[j.createElementVNode("div",pG,[t.options.title?(j.openBlock(),j.createElementBlock("span",{key:0,class:"dialog-title override",style:j.normalizeStyle(t.titleStyle),innerHTML:t.options.title},null,12,vG)):j.createCommentVNode("",!0),j.createElementVNode("span",{class:"dialog-text dialog-separator override",style:j.normalizeStyle(t.textStyle),innerHTML:t.preText},null,12,mG),j.createElementVNode("span",{class:j.normalizeClass(["dialog-text override",t.options.cssClass]),style:j.normalizeStyle(t.textStyle),innerHTML:t.options.text},null,14,gG),t.canInteract&&t.choices?(j.openBlock(),j.createElementBlock("div",yG,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.choices,(a,s)=>(j.openBlock(),j.createElementBlock("p",{key:s,style:j.normalizeStyle(t.dialogStyle(a)),class:j.normalizeClass([t.dialogClass(a),"dialog-choice override"]),onClick:u=>t.chooseOption(a),innerHTML:`${s+1}. \u2013\xA0 ${a.choice}`},null,14,bG))),128))])):t.canInteract&&t.options.textField?(j.openBlock(),j.createElementBlock("div",kG,[j.withDirectives(j.createElementVNode("input",{type:"text",class:"label-input input",ref:"playerInput",id:"player-input-field","onUpdate:modelValue":e[0]||(e[0]=a=>t.playerText=a)},null,512),[[j.vModelText,t.playerText]]),j.createElementVNode("button",{onClick:e[1]||(e[1]=(...a)=>t.submitText&&t.submitText(...a)),class:"button",id:"player-input-submit"}," Submit ")])):t.canInteract?(j.openBlock(),j.createElementBlock("div",wG,[j.createElementVNode("div",{onClick:e[2]||(e[2]=a=>t.chooseOption(0)),class:"interact-button button override"}," Continue ")])):j.createCommentVNode("",!0)])],4)}const xG=qr(hG,[["render",jG]]),_G=j.createElementVNode("div",{class:"anchor"},null,-1),SG=j.defineComponent({__name:"game-dialog",props:{layoutMode:String,inGame:Boolean},setup(t){const e=t,n=fn(),r=j.computed(()=>n.stack),o=Xr(),i=j.computed(()=>o.dialog),a=j.ref(null),s=j.computed(()=>e.layoutMode==="vertical"?{}:{paddingBottom:`${gt().layout.dialogBottomPadding}px`}),u=j.computed(()=>{if(i.value.length>0)return i.value[i.value.length-1]}),l=j.computed(()=>{if(u.value)return mJ(u.value.speaker,u.value.pose)}),f=j.computed(()=>gt().layout.minTextWidth),c=j.computed(()=>{let p;const v="100%";return e.layoutMode,{width:e.layoutMode==="horizontal"?`${f.value}px`:"100%",height:v,transform:p,transformOrigin:"right"}});function d(p,v){let m=e0(p.speaker).name;return v>=1&&i.value[v-1].speaker===p.speaker&&(m=void 0),p.choices&&p.choices.forEach(y=>{y.choice=Qg(y.choice)}),{title:m!=null?m:"",text:p.text,cssClass:p.cssClass,styleId:p.speaker,choices:p.choices,old:v<i.value.length-1,interactive:p.interactive,textField:p.textField}}function h(p){return p===o.dialog.length-1&&r.value.length>0}return j.watch(i.value,p=>{if(a.value){const v=a.value;v.scrollTop=v.scrollHeight+1e8}}),(p,v)=>(j.openBlock(),j.createElementBlock(j.Fragment,null,[j.createVNode(j.Transition,{name:"fade"},{default:j.withCtx(()=>[j.unref(l)?(j.openBlock(),j.createBlock(cG,{key:0,pictureUrl:j.unref(l)},null,8,["pictureUrl"])):j.createCommentVNode("",!0)]),_:1}),t.inGame?(j.openBlock(),j.createElementBlock("div",{key:0,class:"dialog override",ref_key:"dialogRef",ref:a,style:j.normalizeStyle(j.unref(c))},[j.createVNode(j.TransitionGroup,{name:"list",tag:"div",class:"dialog-container w-full override",style:j.normalizeStyle(j.unref(s))},{default:j.withCtx(()=>[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(j.unref(i),(g,m)=>(j.openBlock(),j.createBlock(xG,{key:g.id,options:d(g,m),active:h(m)},null,8,["options","active"]))),128))]),_:1},8,["style"]),_G],4)):j.createCommentVNode("",!0)],64))}}),jY="",CG=j.defineComponent({setup(){const t=Vr();return{quests:j.computed(()=>t.quests)}},computed:{questsToDisplay(){return o8(this.quests,t=>t.state!=="hidden")}},methods:{close(){this.$emit("close")},getQuestData(t){return Cd(t)},getObjectiveData(t,e){return Ng(t,e)},getDisplayTextForQuestState(t){switch(t.state){case"hidden":return" Hidden";case"unlocked":return"";case"completed":return" (Completed)";default:return" Unknown"}},getQuestDescription(t){return t.ending?t.ending:this.getQuestData(t.id).description},getAvailableObjectives(t){return o8(t.objectives,e=>e.state!=="hidden")}},components:{Modal:hs}}),xY="",$G=j.createElementVNode("h3",{class:"title"},"Quests",-1),OG={key:0,class:"quests-container"},EG={class:"quest-title"},AG={class:"quest-description"},PG={key:0,class:"quest-objectives-container list-disc"},TG={key:1,class:"menu-container"},MG=[j.createElementVNode("h2",{class:"title"},"There are no quests!",-1)];function IG(t,e,n,r,o,i){const a=j.resolveComponent("modal");return j.openBlock(),j.createBlock(a,{class:"quests",onClose:t.close,containerCssClass:"quests-modal"},{header:j.withCtx(()=>[$G]),body:j.withCtx(()=>[Object.keys(t.questsToDisplay).length>0?(j.openBlock(),j.createElementBlock("div",OG,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.questsToDisplay,s=>(j.openBlock(),j.createElementBlock("div",{class:"quest-display",key:s.id},[j.createElementVNode("div",{class:j.normalizeClass(["quest-header",s.state==="completed"?"quest-completed":"quest-in-progress"])},[j.createElementVNode("h3",EG,j.toDisplayString(t.getQuestData(s.id).title)+" "+j.toDisplayString(t.getDisplayTextForQuestState(s)),1)],2),j.createElementVNode("p",AG,j.toDisplayString(t.getQuestDescription(s)),1),s.state!=="completed"?(j.openBlock(),j.createElementBlock("ul",PG,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.getAvailableObjectives(s),u=>(j.openBlock(),j.createElementBlock("li",{class:"quest-objective-display",key:u.id},[j.createElementVNode("p",{class:j.normalizeClass(["quest-objective-description",u.state==="completed"?"quest-objective-completed":"quest-objctive-in-progress"])},j.toDisplayString(t.getObjectiveData(s.id,u.id).description),3)]))),128))])):j.createCommentVNode("",!0)]))),128))])):(j.openBlock(),j.createElementBlock("div",TG,MG))]),_:1},8,["onClose"])}const NG=qr(CG,[["render",IG]]),LG=j.defineComponent({data(){return{buttons:[{id:"menu",cssId:"menu-button",text:"Menu"},{id:"skills",cssId:"skills-menu-button",text:"Skills",condition:()=>this.showSkills},{id:"inventory",cssId:"inventory-menu-button",text:"Items",condition:()=>this.showInventory},{id:"quests",cssId:"quests-menu-button",text:"Quests",condition:()=>this.showQuests}],activeMenu:!1}},mounted(){document.addEventListener("keydown",t=>{t.key==="Escape"&&this.toggleMenu()}),ar.callHook("onGameMounted")},unmounted(){ar.callHook("onGameUnmounted")},methods:{buttonClick(t){t.onClick?t.onClick():yn().openModal(t.id)},openMenu(){yn().openModal("menu")},openSkills(){yn().openModal("skills")},openInventory(){yn().openModal("inventory")},openQuests(){yn().openModal("quests")},closeMenu(){yn().closeModal()},toggleMenu(){yn().toggleMenu()}},computed:{buttonsToShow(){return this.buttons.map(t=>{const e=gt().menuButtons[t.id]||{};return{...t,...e}}).filter(t=>t.condition?t.condition():!0)},showSkills(){return Object.entries(gt().skills).length>0},showInventory(){return Object.entries(gt().items).length>0},showQuests(){return Object.entries(gt().quests).length>0}}}),SY="",DG={class:"menu-container"},RG=["onClick","id"];function BG(t,e,n,r,o,i){return j.openBlock(),j.createElementBlock("div",DG,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.buttonsToShow,a=>(j.openBlock(),j.createElementBlock("button",{key:a.id,onClick:s=>t.buttonClick(a),id:a.cssId,class:"button menu-toggle-button"},j.toDisplayString(a.text),9,RG))),128))])}const zG=qr(LG,[["render",BG]]),VG=["id"],FG=["id","onClick"],t0=j.defineComponent({__name:"screen-layer",props:{layer:String,transitioning:{type:Boolean,default:!1}},setup(t){const e=t,n=fn(),r=yn(),o=$i(),i=j.computed(()=>gt().layout.backgrounds.width),a=j.computed(()=>gt().layout.backgrounds.height),s=j.computed(()=>e.layer),u=j.computed(()=>o.buttons),l=j.computed(()=>{const m=gt().screens[s.value];if(!m)throw new Error(`Screen ${s.value} doesn't have a config`);return m}),f=j.computed(()=>l.value.buttons||[]),c=j.computed(()=>r.isInGame);function d(m){const b=Pl(m).background;if(!!b)return I7(b)}function h(m){const y=Pl(m),b=u.value[m],k=y.tag||"default",w=b.state;return w===!0&&mr().isInteractionTagBlocked(k)?"greyed":w}function p(m){const y=Pl(m),b={},k=h(m);y.position.width&&(b.width=`${y.position.width}px`),y.position.height&&(b.height=`${y.position.height}px`),y.background&&(b.backgroundImage=`url(${d(m)})`),k==="greyed"?(b.opacity=.3,b.pointerEvents="none"):(k==="hidden"||k===!1)&&(b.display="none",b.pointerEvents="none");let w=y.position.left,E=y.position.top;return y.anchor&&(w=y.position.left-y.position.width*y.anchor.x,E=y.position.top-y.position.height*y.anchor.y),{...b,left:`${w}px`,top:`${E}px`}}function v(m){if(e.transitioning)return;const y=Pl(m);if(u.value[m].state===!0){const k=y.action;y.actionType==="run"?n.runLabelFunction(k):n.jumpToLabel(k)}}const g=j.computed(()=>({backgroundImage:`url(${I7(l.value.background)})`,width:`${i.value}px`,height:`${a.value}px`}));return(m,y)=>j.unref(c)?(j.openBlock(),j.createElementBlock("div",{key:0,class:"viewport-layer",id:`viewport-layer-${j.unref(s)}`,style:j.normalizeStyle(j.unref(g))},[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(j.unref(f),(b,k)=>(j.openBlock(),j.createElementBlock("button",{key:k,class:"viewport-button",id:`viewport-button-${b}`,onClick:w=>v(b),style:j.normalizeStyle(p(b))},j.toDisplayString(j.unref(Pl)(b).text),13,FG))),128))],12,VG)):j.createCommentVNode("",!0)}}),CY="",qG=j.defineComponent({__name:"NarratTransition",props:{name:{type:String,required:!0},duration:{type:Number,required:!0},delay:Number},emits:["complete"],setup(t,{emit:e}){const n=t,r=j.ref("start"),o=j.reactive({oldSlotClasses:{},oldSlotStyle:{},newSlotClasses:{},newSlotStyle:{}});return j.onMounted(async()=>{var a;const i=`narrat-transition-${n.name}`;o.newSlotClasses={[`${i}-enter-from`]:!0,[`${i}-enter-active`]:!0},o.oldSlotStyle={transitionDuration:`${n.duration/1e3}s`},o.newSlotStyle={transitionDuration:`${n.duration/1e3}s`},o.oldSlotClasses={[`${i}-leave-active`]:!0},await os(30),o.oldSlotClasses[`${i}-leave-to`]=!0,await os((a=n.delay)!=null?a:0),delete o.newSlotClasses[`${i}-enter-from`],await os(n.duration),delete o.newSlotClasses[`${i}-enter-active`],delete o.oldSlotClasses[`${i}-leave-active`],r.value="end",e("complete")}),(i,a)=>(j.openBlock(),j.createElementBlock(j.Fragment,null,[r.value!=="end"?(j.openBlock(),j.createElementBlock("div",{key:0,class:j.normalizeClass(["transition-holder",o.oldSlotClasses]),style:j.normalizeStyle(o.oldSlotStyle)},[j.renderSlot(i.$slots,"oldElement",{class:j.normalizeClass(o.oldSlotClasses)})],6)):j.createCommentVNode("",!0),j.createElementVNode("div",{class:j.normalizeClass(["transition-holder",o.newSlotClasses]),style:j.normalizeStyle(o.newSlotStyle)},[j.renderSlot(i.$slots,"newElement")],6)],64))}}),$Y="",HG=j.defineComponent({__name:"screens",setup(t){const e=du(),n=yn(),r=$i(),o=j.computed(()=>r.layers.filter(c=>c)),i=j.computed(()=>e.layoutMode),a=j.computed(()=>gt().layout.backgrounds.width),s=j.computed(()=>gt().layout.backgrounds.height),u=j.computed(()=>n.isInGame);function l(c){r.finishTransition(c)}const f=j.computed(()=>{const c=`${a.value}px`;let d=`${s.value}px`;return i.value==="vertical"&&(d=`${100-gt().layout.mobileDialogHeightPercentage}%`),{height:d,width:c}});return(c,d)=>j.unref(u)?(j.openBlock(),j.createElementBlock("div",{key:0,class:"viewport",id:"narrat-viewport",style:j.normalizeStyle(j.unref(f))},[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(j.unref(o),(h,p)=>(j.openBlock(),j.createElementBlock("div",{key:p,class:"layer-container"},[h.transition?(j.openBlock(),j.createBlock(qG,{key:0,name:h.transition.transition,duration:h.transition.duration,delay:h.transition.delay,onComplete:()=>l(p)},{oldElement:j.withCtx(()=>[j.createVNode(t0,{layer:h.transition.oldScreen,transitioning:!0},null,8,["layer"])]),newElement:j.withCtx(()=>[j.createVNode(t0,{layer:h.screen,transitioning:!0},null,8,["layer"])]),_:2},1032,["name","duration","delay","onComplete"])):(j.openBlock(),j.createBlock(t0,{key:1,layer:h.screen},null,8,["layer"]))]))),128))],4)):j.createCommentVNode("",!0)}}),OY="",WG=j.createElementVNode("h3",{class:"title"},"Choose a save file",-1),UG={class:"saves-container flex flex-col"},JG={key:0,class:"empty-save-slot flex flex-row justify-around items-center grow"},GG=["onClick"],KG=[j.createElementVNode("h3",null,"Create a new save slot",-1)],QG={key:1,class:"used-save-slot flex flex-row justify-between items-center grow"},YG={class:"flex flex-col"},XG={class:"flex flex-col"},ZG={class:"flex flex-row"},eK=["onClick"],tK=[j.createElementVNode("h3",null,"Load",-1)],nK=["onClick"],rK=[j.createElementVNode("h3",null,"Delete",-1)],oK=j.defineComponent({__name:"save-slots",emits:["chosen","close"],setup(t,{emit:e}){const n=j.reactive([]);j.onMounted(()=>{a8().slots.forEach((s,u)=>{n[u]=s}),n.push(null)});function r(a){const s={saveData:n[a],slot:a};e("chosen",s)}function o(a){FW(a),n[a]=null}function i(a){return Ud(a.main.playTime)}return(a,s)=>(j.openBlock(),j.createBlock(hs,{onClose:s[0]||(s[0]=u=>a.$emit("close")),containerCssClass:"save-modal"},{header:j.withCtx(()=>[WG]),body:j.withCtx(()=>[j.createElementVNode("div",UG,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(n,(u,l)=>(j.openBlock(),j.createElementBlock("div",{class:"save-slot flex flex-row",key:l},[u==null?(j.openBlock(),j.createElementBlock("div",JG,[j.createElementVNode("button",{class:"button",onClick:f=>r(l)},KG,8,GG)])):(j.openBlock(),j.createElementBlock("div",QG,[j.createElementVNode("div",YG,[j.createElementVNode("h3",null,"Slot "+j.toDisplayString(l+1),1),j.createElementVNode("div",XG,[j.createElementVNode("p",null,"Play time: "+j.toDisplayString(i(u)),1),j.createElementVNode("p",null," Last save: "+j.toDisplayString(new Date(u.metadata.saveDate).toLocaleString()),1)])]),j.createElementVNode("div",ZG,[j.createElementVNode("button",{class:"button",onClick:f=>r(l)},tK,8,eK),j.createElementVNode("button",{class:"button",onClick:f=>o(l)},rK,8,nK)])]))]))),128))])]),_:1}))}}),TY="",iK={id:"game-menu",style:{height:"100%",padding:"20px"}},aK={id:"game-header",class:"flex flex-col justify-between items-center"},sK={id:"game-title-container"},uK={id:"game-title-text"},lK={class:"flex flex-col start-menu-buttons-container"},cK=j.defineComponent({__name:"StartMenu",setup(t){const e=j.ref(!1),n=j.ref(null),r=j.ref(-1),o=j.ref(!1);async function i(){const c=yn();r.value===-1&&(r.value=zW()),await c.startGame(r.value)}async function a(){const c=VW(r.value);if(!c){Bn("No save file found");return}yn().loadGame(c,r.value)}function s(){typeof n.value=="number"&&(r.value=n.value,a())}function u(){o.value=!0}function l({saveData:c,slot:d}){r.value=d,c?a():i()}j.onMounted(()=>{const c=a8();c.slots.length>0&&(e.value=!0),c.lastSaveSlot&&c.slots.length>c.lastSaveSlot&&c.slots[c.lastSaveSlot]&&(n.value=c.lastSaveSlot)});const f=j.computed(()=>gt().gameTitle);return(c,d)=>(j.openBlock(),j.createElementBlock("div",iK,[o.value?(j.openBlock(),j.createBlock(oK,{key:0,onChosen:l,onClose:d[0]||(d[0]=h=>o.value=!1)})):j.createCommentVNode("",!0),j.createElementVNode("div",aK,[j.createElementVNode("div",sK,[j.createElementVNode("h1",uK,j.toDisplayString(j.unref(f)),1)]),j.createElementVNode("div",lK,[n.value?(j.openBlock(),j.createElementBlock("button",{key:0,class:"button menu-button main-menu-button large continue-button override",onClick:s}," Continue ")):j.createCommentVNode("",!0),j.createElementVNode("button",{class:"button menu-button main-menu-button large start-button override",onClick:i}," New Game "),e.value?(j.openBlock(),j.createElementBlock("button",{key:1,class:"button menu-button main-menu-button large continue-button override",onClick:u}," Load Game ")):j.createCommentVNode("",!0)])])]))}}),MY="",fK=j.defineComponent({setup(){const t=Xr(),e=fn(),n=yn();return{dialog:j.computed(()=>t.dialog),stack:j.computed(()=>e.stack),modal:j.computed(()=>n.modal),flowState:j.computed(()=>n.flowState)}},$refs:{dialogContainer:HTMLInputElement},inject:["mq"],components:{DebugMenu:ZU,LoadingBar:cJ,NotificationToast:pJ,Hud:iJ,MainMenu:AJ,Skills:WJ,InventoryUi:aG,GameDialog:SG,QuestsUi:NG,MenuButtons:zG,Screens:HG,StartMenu:cK},data(){return{lineTitle:"title",lineText:"hello",gameLoaded:!1,loadingStep:"Loading",loadingPercentage:.1}},props:{config:Object,options:Object},async mounted(){ar.callHook("onAppMounted"),this.loadingStep="Characters";const t=await Ug(this.config.charactersPath);await vJ(JSON.parse(t)),this.loadingPercentage=.2,this.loadingStep="Data",this.loadingPercentage=.3,this.loadingStep="Images",await gJ(gt()),this.loadingPercentage=.7,this.loadingStep="Audio",await TW(gt()),ar.callHook("onAssetsLoaded"),this.loadingPercentage=.95,this.loadingStep="Starting...",await this.setupMachine(),ar.callHook("onGameSetup"),this.loadingPercentage=.1,this.gameLoaded=!0,window.addEventListener("resize",A8(()=>{this.updateScreenSize()},100,{maxWait:200})),Nl.setup(this.options.debug),setTimeout(()=>{this.updateScreenSize()},50)},computed:{...Ci(du,["screenWidth","screenHeight","canvasWidth","canvasHeight","topOffset","leftOffset","layoutMode"]),...Ci(fn,["currentLine"]),backgroundStyle(){let t;return this.layoutMode==="vertical"&&(t=`${100-gt().layout.mobileDialogHeightPercentage}%`),{backgroundColor:"red",height:t}},layoutWidth(){return gt().layout.backgrounds.width},inGame(){return this.flowState==="playing"},layoutHeight(){return gt().layout.backgrounds.height},backgroundSize(){return{width:this.canvasWidth,height:this.canvasHeight,top:this.topOffset,left:this.leftOffset}},gameWidth(){const t=gt();return this.layoutMode==="vertical"?window.innerWidth:t.layout.backgrounds.width+t.layout.minTextWidth},gameHeight(){const t=gt();return this.layoutMode==="vertical"?window.innerHeight:t.layout.backgrounds.height},appStyle(){const t=gt();if(this.screenWidth&&this.screenHeight&&t&&this.layoutMode==="horizontal"){const e=$8(this.screenWidth,this.screenHeight,this.gameWidth,this.gameHeight);return{transform:`scale(${e}, ${e})`,width:`${this.gameWidth}px`,height:`${this.gameHeight}px`}}return{}},gameStyle(){let t="row";return this.layoutMode==="vertical"&&(t="column"),{flexDirection:t}},screenRatio(){const t=gt(),e=t.layout.minTextWidth+t.layout.backgrounds.width;return this.screenWidth/e}},methods:{async setupMachine(){const t=gt().scripts;return yn().setup(t,gt())},updateScreenSize(){du().updateScreenSize(window.innerWidth,window.innerHeight,this.layoutMode==="horizontal"?gt().layout.minTextWidth*this.screenRatio:0)},closeModal(){yn().closeModal()}}}),IY="",dK={key:3};function hK(t,e,n,r,o,i){const a=j.resolveComponent("Hud"),s=j.resolveComponent("MenuButtons"),u=j.resolveComponent("Skills"),l=j.resolveComponent("InventoryUi"),f=j.resolveComponent("QuestsUi"),c=j.resolveComponent("MainMenu"),d=j.resolveComponent("Screens"),h=j.resolveComponent("GameDialog"),p=j.resolveComponent("StartMenu"),v=j.resolveComponent("LoadingBar"),g=j.resolveComponent("DebugMenu"),m=j.resolveComponent("NotificationToast");return j.openBlock(),j.createElementBlock("div",{id:"app",style:j.normalizeStyle(t.appStyle)},[t.inGame?(j.openBlock(),j.createBlock(a,{key:0})):j.createCommentVNode("",!0),t.inGame?(j.openBlock(),j.createElementBlock("div",{key:1,class:"game",style:j.normalizeStyle(t.gameStyle)},[j.createVNode(s,{class:"menu-toggle"}),t.modal==="skills"?(j.openBlock(),j.createBlock(u,{key:0,onClose:t.closeModal},null,8,["onClose"])):j.createCommentVNode("",!0),t.modal==="inventory"?(j.openBlock(),j.createBlock(l,{key:1,onClose:t.closeModal},null,8,["onClose"])):j.createCommentVNode("",!0),t.modal==="quests"?(j.openBlock(),j.createBlock(f,{key:2,onClose:t.closeModal},null,8,["onClose"])):j.createCommentVNode("",!0),t.modal==="menu"?(j.openBlock(),j.createBlock(c,{key:3,onClose:t.closeModal},null,8,["onClose"])):j.createCommentVNode("",!0),j.createVNode(d),j.createVNode(h,{inGame:t.inGame,layoutMode:t.layoutMode},null,8,["inGame","layoutMode"])],4)):t.gameLoaded?(j.openBlock(),j.createBlock(p,{key:2})):(j.openBlock(),j.createElementBlock("div",dK,[j.createVNode(v,{percentage:t.loadingPercentage,step:t.loadingStep},null,8,["percentage","step"])])),t.options.debug?(j.openBlock(),j.createBlock(g,{key:4})):j.createCommentVNode("",!0),j.createVNode(m)],4)}const pK=qr(fK,[["render",hK]]);function dn(t,e){console.error("Runtime error ========================="),console.error(`Command: ${t.commandType}`),console.error("Args: ",t.args),console.error("Options: ",t.options),Bn(`Runtime error at ${t.fileName}:${t.line} (${t.commandType}) ${t.code}. -
|
|
182
|
+
<br />`),n.createError(`\u274C ${t}`)}const cr=Qo("skills",{state:()=>({skillChecks:{},skills:{}}),actions:{setupSkillCheck(t,e){this.skillChecks[e]=t},passSkillCheck(t,e){this.skillChecks[t].happened=!0,this.skillChecks[t].succeeded=!0,e&&(this.skillChecks[t].hidden=!0)},failSkillCheck(t,e){this.skillChecks[t].happened=!0,this.skillChecks[t].succeeded=!1,e&&(this.skillChecks[t].hidden=!0)},generateSaveData(){return{skillChecks:this.skillChecks,skills:this.skills}},getSkillCheck(t){return this.skillChecks[t]||this.setupSkillCheck(this.createSkillCheckState(),t),this.skillChecks[t]},createSkillCheckState(){return{happened:!1,succeeded:!1,hidden:!1}},loadSaveData(t){this.skillChecks=Nd(this.skillChecks,t.skillChecks),this.skills=Nd(this.skills,t.skills)},setupSkills(t){for(const e in t)this.skills[e]={id:e,level:t[e].startingLevel||0,xp:0}},getSkill(t){return this.skills[t]},getSkillLevel(t){return this.getSkill(t).level},getSkillXp(t){return this.getSkill(t).xp},addXp(t,e){const n=this.getSkill(t);n||Bn(`Skill ${t} doesn't exist`),n.xp+=e,n.xp>=gt().skillOptions.xpPerLevel&&(n.xp=0,n.level++,this.levelledUp(t))},setSkillLevel(t,e){const n=this.getSkill(t);n||Bn(`Skill ${t} doesn't exist`),n.level=e,this.levelledUp(t)},incrementSkill(t,e){this.getSkill(t).level+=e,this.levelledUp(t)},levelledUp(t){const e=gt().skills[t].name,n=this.skills[t].level;gt().skillOptions.notifyLevelUp&&$o().addNotification(`Your skill in ${e} is now level ${n}`)}}});let C8;const $U=j.defineComponent({components:{Modal:hs},setup(){const t=cr(),e=j.computed(()=>t.skills),n=j.computed(()=>t.skillChecks);return{skills:e,skillChecks:n}},data(){return{showDebug:!1,jumping:!1,searchString:"",matches:[],matchCursor:0}},mounted(){window.addEventListener("keydown",t=>{if(this.jumping||(t.key==="d"&&this.toggle(),t.key==="j"&&this.jump()),t.key==="ArrowDown"&&(t.preventDefault(),this.matches.length>this.matchCursor+1?this.matchCursor+=1:this.matchCursor=0),t.key==="ArrowUp"&&(t.preventDefault(),this.matchCursor>0?this.matchCursor-=1:this.matchCursor=this.matches.length-1),t.key==="Escape"&&(this.finishJumping(),this.showDebug=!1),this.jumping&&t.key==="Enter"&&this.matchCursor<this.matches.length){const e=this.matches[this.matchCursor];fn().jumpToLabel(e),this.finishJumping()}})},methods:{finishJumping(){this.jumping=!1,this.matches=[],this.searchString=""},labelSelected(t){const e=t.target.value;fn().jumpToLabel(e),this.close()},close(){this.showDebug=!1},closeErrors(){yn().clearErrors()},open(){this.showDebug=!0;const t=fn(),e=yn(),n=Vr(),r=mr(),o=cr();this.$nextTick(()=>{new $7({target:this.$refs.variablesViewer,props:{content:{text:void 0,json:{data:this.variables,quests:n.quests,items:r.items,skills:o.skills,skillChecks:o.skillChecks}},onChange:i=>{t.overrideData(i.json.data),n.quests=i.json.quests,r.items=i.json.items,o.skills=i.json.skills,o.skillChecks=i.json.skillChecks}}}),new $7({target:this.$refs.stateViewer,props:{content:{text:void 0,json:e.getAllStates()},onChange:i=>{e.overrideStates(i.json)}}})})},toggle(){this.showDebug?this.showDebug=!1:this.jumping?this.finishJumping():this.open()},jump(){C8=new ps(this.labels,{includeScore:!0}),this.jumping=!0,setTimeout(()=>{this.$nextTick(()=>{this.$refs.search.focus()})},10),this.matchCursor=0,this.matches=this.labels},getMatchResultStyle(t){if(t===this.matchCursor)return{background:"var(--light-background)"}},onSearchInput(){const t=this.searchString;console.log(t);const e=C8.search(t);this.matches=e.map(n=>n.item),this.matches.length>0&&this.matchCursor>this.matches.length-1&&(this.matchCursor=this.matches.length-1)},save(){yn().saveGame()},wordCount(){const e=Object.values(this.script).reduce((n,r)=>(To.log(n),n+this.countWordsInScriptBranch(r.branch)),0);alert(`You have ${e} words`)},countWordsInScriptLine(t){if(t.command.commandType==="talk"&&typeof t.command.args[2]=="string")return this.countWordsInString(t.command.args[2]);if(t.command.commandType==="text")return this.countWordsInString(t.code);if(t.command.commandType==="choice"){const e=t.command.staticOptions;let n=this.countWordsInScriptLine(e.prompt);return n+=e.choices.reduce((o,i)=>o+this.countWordsInString(i.prompt.code),0),e.choices.reduce((o,i)=>i.branch?o+this.countWordsInScriptBranch(i.branch):o,n)}if(t.command.commandType==="if"){const e=t.command.staticOptions;return[e.success,e.failure].reduce((r,o)=>o?r+this.countWordsInScriptBranch(o):r,0)}return 0},countWordsInString(t){return t.split(" ").length},countWordsInScriptBranch(t){return t.reduce((e,n)=>n?e+this.countWordsInScriptLine(n):e,0)},getPlayTimeString(){const t=Wd(this.playTime.start,this.playTime.previousPlaytime);return Ud(t/1e3)}},computed:{...Ci(fn,["script","data"]),...Ci(yn,["playTime","errors","playing","flowState"]),labels(){const t=this.script;return Object.keys(t).sort()},variables(){return this.data}}}),lY="",OU={class:"debug-menu"},EU={key:0,class:"debug-info"},AU=[j.createElementVNode("h3",null,"Debug mode is ON",-1),j.createElementVNode("ul",null,[j.createElementVNode("li",null,[j.createElementVNode("b",null,"j"),j.createTextVNode(": Quick Label Jump")]),j.createElementVNode("li",null,[j.createElementVNode("b",null,"d"),j.createTextVNode(": Debug Menu")]),j.createElementVNode("li",null,[j.createElementVNode("b",null,"Escape"),j.createTextVNode(": Toggle Menu")])],-1)],PU=j.createElementVNode("h3",{class:"title"},"Jump to label",-1),TU={key:0,class:"search-results"},MU={key:1},IU=[j.createElementVNode("h3",null,"No matches found",-1)],NU=j.createElementVNode("h3",{class:"title"},"Error(s)",-1),LU=j.createTextVNode(" There are errors in your dialogue scripts. Open the developer console for more details. "),DU=["innerHTML"],RU=j.createElementVNode("h3",{class:"title"},"Debug Menu!",-1),BU={class:"container"},zU=j.createTextVNode(" Hello this is the debug menu. "),VU=j.createElementVNode("option",{class:"option",selected:"",disabled:""},"Jump to a label",-1),FU=["value"],qU={class:"grid grid-cols-3 gap-4"},HU=j.createElementVNode("h2",null,"Variables Editor",-1),WU={ref:"variablesViewer"},UU=j.createElementVNode("h2",null,"Skill Checks",-1),JU={class:"table-auto"},GU=j.createElementVNode("thead",null,[j.createElementVNode("tr",null,[j.createElementVNode("th",null,"Skill Check"),j.createElementVNode("th",null,"Happened"),j.createElementVNode("th",null,"Succeeded")])],-1),KU=j.createElementVNode("h2",null,"App State editor (entire app and engine",-1),QU=j.createElementVNode("h3",{style:{color:"pink"}}," Use for debugging, editing some of those things can cause issues ",-1),YU={ref:"stateViewer"};function XU(t,e,n,r,o,i){const a=j.resolveComponent("modal");return j.openBlock(),j.createElementBlock("div",OU,[j.createElementVNode("button",{onClick:e[0]||(e[0]=(...s)=>t.open&&t.open(...s)),class:"button debug-button"},"Debug Menu"),!t.playing&&t.flowState==="menu"?(j.openBlock(),j.createElementBlock("div",EU,AU)):j.createCommentVNode("",!0),t.jumping?(j.openBlock(),j.createBlock(a,{key:1,onClose:t.finishJumping,containerCssClass:"jump-menu-container"},{header:j.withCtx(()=>[PU]),body:j.withCtx(()=>[j.withDirectives(j.createElementVNode("input",{type:"text",class:"label-input input",ref:"search","onUpdate:modelValue":e[1]||(e[1]=s=>t.searchString=s),onInput:e[2]||(e[2]=(...s)=>t.onSearchInput&&t.onSearchInput(...s))},null,544),[[j.vModelText,t.searchString]]),t.matches.length>0?(j.openBlock(),j.createElementBlock("div",TU,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.matches,(s,u)=>(j.openBlock(),j.createElementBlock("div",{class:"search-result",style:j.normalizeStyle(t.getMatchResultStyle(u)),key:u},j.toDisplayString(s),5))),128))])):(j.openBlock(),j.createElementBlock("div",MU,IU))]),_:1},8,["onClose"])):j.createCommentVNode("",!0),t.errors.length>0?(j.openBlock(),j.createBlock(a,{key:2,onClose:t.closeErrors,containerCssClass:"debug-menu-container"},{header:j.withCtx(()=>[NU]),body:j.withCtx(()=>[LU,j.createElementVNode("ul",null,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.errors,(s,u)=>(j.openBlock(),j.createElementBlock("li",{key:u,class:"error-message list-disc",innerHTML:s.text},null,8,DU))),128))])]),_:1},8,["onClose"])):j.createCommentVNode("",!0),t.showDebug?(j.openBlock(),j.createBlock(a,{key:3,onClose:t.close,containerCssClass:"debug-menu-container"},{header:j.withCtx(()=>[RU]),body:j.withCtx(()=>[j.createElementVNode("div",BU,[zU,j.createElementVNode("select",{class:"select",name:"label-selector",onChange:e[3]||(e[3]=s=>t.labelSelected(s))},[VU,(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.labels,s=>(j.openBlock(),j.createElementBlock("option",{class:"option",value:s,key:s},j.toDisplayString(s),9,FU))),128))],32),j.createElementVNode("div",qU,[j.createElementVNode("button",{onClick:e[4]||(e[4]=(...s)=>t.wordCount&&t.wordCount(...s)),class:"button"},"Word Count"),j.createElementVNode("button",{onClick:e[5]||(e[5]=(...s)=>t.save&&t.save(...s)),class:"button"},"Save Game")]),j.createElementVNode("h3",null,"Play time: "+j.toDisplayString(t.getPlayTimeString()),1),HU,j.createElementVNode("div",WU,null,512),UU,j.createElementVNode("table",JU,[GU,j.createElementVNode("tbody",null,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.skillChecks,(s,u)=>(j.openBlock(),j.createElementBlock("tr",{key:u},[j.createElementVNode("td",null,j.toDisplayString(u),1),j.createElementVNode("td",null,j.toDisplayString(s.happened?"\u2705":"\u274C"),1),j.createElementVNode("td",null,j.toDisplayString(s.happened?s.succeeded?"\u2705":"\u274C":"NA"),1)]))),128))])]),KU,QU,j.createElementVNode("div",YU,null,512)])]),_:1},8,["onClose"])):j.createCommentVNode("",!0)])}const ZU=qr($U,[["render",XU]]),eJ=j.defineComponent({data(){return{}},methods:{getStatImage(t){return Al(this.statsConfig[t].icon)}},computed:{...Ci(Wi,["hudStats"]),...Ci(du,["layoutMode"]),statsConfig(){return gt().hudStats},stats(){return this.hudStats},hudStyle(){let t="0";return this.layoutMode==="horizontal"&&(t=`${gt().layout.minTextWidth}px`),{right:t}}}}),hY="",tJ=["src"],nJ={class:"bold hud-text"},rJ=j.createTextVNode(": ");function oJ(t,e,n,r,o,i){return j.openBlock(),j.createElementBlock("div",{class:"hud",style:j.normalizeStyle(t.hudStyle)},[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.stats,(a,s)=>(j.openBlock(),j.createElementBlock("div",{key:s,class:"hud-stat"},[j.createElementVNode("img",{class:"hud-icon",src:t.getStatImage(s)},null,8,tJ),j.createElementVNode("span",nJ,j.toDisplayString(t.statsConfig[s].name),1),rJ,j.createElementVNode("span",null,j.toDisplayString(Math.floor(a.value*100)/100),1)]))),128))],4)}const iJ=qr(eJ,[["render",oJ]]),aJ=j.defineComponent({props:{percentage:Number,step:String},methods:{loadingStyle(){return{width:`${this.percentage*40}vw`}}},computed:{}}),pY="",sJ={id:"loading-bar"},uJ={id:"loading-text"};function lJ(t,e,n,r,o,i){return j.openBlock(),j.createElementBlock("div",sJ,[j.createElementVNode("div",{id:"inner-loading-bar",style:j.normalizeStyle(t.loadingStyle())},null,4),j.createElementVNode("div",uJ,[j.createElementVNode("h3",null,"Loading "+j.toDisplayString(Math.floor(t.percentage*100))+"% - "+j.toDisplayString(t.step),1)])])}const cJ=qr(aJ,[["render",lJ]]),fJ=j.defineComponent({data(){},methods:{},computed:{...Ci($o,["notifications"])}}),vY="",dJ=["innerHTML"];function hJ(t,e,n,r,o,i){return j.openBlock(),j.createBlock(j.TransitionGroup,{name:"notification",tag:"div",class:"notifications-holder"},{default:j.withCtx(()=>[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.notifications,(a,s)=>(j.openBlock(),j.createElementBlock("div",{class:"notification",key:s},[j.createElementVNode("h3",{innerHTML:a.text},null,8,dJ)]))),128))]),_:1})}const pJ=qr(fJ,[["render",hJ]]);let Zg;function vJ(t){Zg=t}function e0(t){return Zg.characters[t]}function mJ(t,e){const n=e0(t);if(e||(e="default"),n.sprites)return`${Zg.config.imagesPath}${n.sprites[e]}`}function Ld(t){return t?e0(t).style||{}:{}}function $8(t,e,n,r){const o=t/n,i=e/r;return Math.min(o,i)}let O8=0,E8=0;function gJ(t){return To.log("Loading images"),new Promise((e,n)=>{if(Object.keys(t.images).length<1){e();return}for(const r in t.images){const o=t.images[r];yJ(r,o,e,n)}})}function yJ(t,e,n,r){O8++,To.log(`Loading image ${t} at ${e}`);const o=new Image;o.onload=()=>{E8+=1,To.log(`Loaded image ${t} successfully`),E8>=O8&&(To.log("All images loaded"),n())},o.onerror=i=>{Bn(`Failed to load image ${t} at ${e}`,i),r(i)},o.src=e}function A8(t,e=50,n={}){var c,d;let r;const o=(c=n.isImmediate)!=null?c:!1,i=(d=n.callback)!=null?d:!1,a=n.maxWait;let s=Date.now(),u=[];function l(){if(console.log("wait: ",e),a!==void 0){const h=Date.now()-s;if(h+e>=a)return a-h}return e}const f=function(...h){const p=this;return new Promise((v,g)=>{const m=function(){if(r=void 0,s=Date.now(),!o){const k=t.apply(p,h);i&&i(k),u.forEach(({resolve:w})=>w(k)),u=[]}};console.log("should call now? ",o,r);const y=o&&r===void 0;r!==void 0&&(console.log("clearing timeout"),clearTimeout(r));const b=l();if(console.log(`nextInvoke: ${b}`),r=setTimeout(m,b),y){console.log("calling");const k=t.apply(p,h);return i&&i(k),v(k)}u.push({resolve:v,reject:g})})};return f.cancel=function(h){r!==void 0&&clearTimeout(r),u.forEach(({reject:p})=>p(h)),u=[]},f}const bJ=j.defineComponent({data(){return{muted:!1,volumes:[],modeNames:{master:"Master volume:",music:"Music:",ambiant:"Ambiant:",sound:"Sound effects:"}}},mounted(){const t=Or(),e=ja.Howler.volume();this.volumes.push({mode:"master",volume:e}),t.modes.forEach((n,r)=>{this.volumes.push({mode:r,volume:t.modes.get(r).options.volume})})},methods:{changeVolume(t,e){const n=e.target;t==="master"?Or().setMasterVolume(n.value):Or().setModeVolume(t,n.value)},toggleMute(){this.muted?(ja.Howler.mute(!1),this.muted=!1):(ja.Howler.mute(!0),this.muted=!0)}}}),mY="",kJ={class:"volume-controls"},wJ=j.createElementVNode("h3",{class:"subtitle"},"Volume",-1),jJ={for:"volume",class:"volume-label"},xJ=["onUpdate:modelValue","onChange"];function _J(t,e,n,r,o,i){return j.openBlock(),j.createElementBlock("div",kJ,[wJ,(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.volumes,(a,s)=>(j.openBlock(),j.createElementBlock("div",{class:"volume-control",key:a.mode},[j.createElementVNode("label",jJ,j.toDisplayString(t.modeNames[a.mode]),1),j.withDirectives(j.createElementVNode("input",{ref_for:!0,ref:"slider",class:"volume-slider",type:"range",id:"volume",name:"volume",min:"0",max:"1",step:"0.1","onUpdate:modelValue":u=>t.volumes[s].volume=u,onChange:u=>t.changeVolume(a.mode,u)},null,40,xJ),[[j.vModelText,t.volumes[s].volume]])]))),128))])}const SJ=qr(bJ,[["render",_J]]),CJ=j.defineComponent({components:{Modal:hs,VolumeControls:SJ},data(){return{}},mounted(){},methods:{quit(){window.close()},mainMenu(){yn().menuReturn(),this.closeMenu()},closeMenu(){this.$emit("close")},getPlayTimeString(){const t=Wd(this.playTime.start,this.playTime.previousPlaytime);return Ud(t/1e3)}},computed:{...Ci(yn,["playTime"])}}),gY="",$J=j.createElementVNode("h3",{class:"title"},"Menu",-1),OJ={class:"menu-content"};function EJ(t,e,n,r,o,i){const a=j.resolveComponent("VolumeControls"),s=j.resolveComponent("modal");return j.openBlock(),j.createBlock(s,{class:"menu",onClose:e[2]||(e[2]=u=>t.$emit("close")),containerCssClass:"main-menu-modal"},{header:j.withCtx(()=>[$J]),body:j.withCtx(()=>[j.createElementVNode("div",OJ,[j.createElementVNode("h3",null,"Play time: "+j.toDisplayString(t.getPlayTimeString()),1),j.createVNode(a),j.createElementVNode("button",{class:"button title quit-button",onClick:e[0]||(e[0]=(...u)=>t.mainMenu&&t.mainMenu(...u))}," Main Menu "),j.createElementVNode("button",{class:"button title quit-button",onClick:e[1]||(e[1]=(...u)=>t.quit&&t.quit(...u))},"Exit")])]),_:1})}const AJ=qr(CJ,[["render",EJ]]),PJ=j.defineComponent({setup(){const t=cr();return{skills:j.computed(()=>t.skills)}},components:{Modal:hs},data(){return{chosenSkill:!1}},mounted(){},methods:{getSkillStyle(t){return{backgroundImage:`url(${this.skillConf[t].icon})`}},getSkillName(t){return this.skillConf[t].name},clickSkill(t){this.chosenSkill=t},closeSkill(){this.chosenSkill=!1},xpBarWidth(t){return{width:`${Math.floor(t/this.xpPerLevel*100)}%`}}},computed:{skillsToDisplay(){const t={};for(const e in this.skills)this.skillConf[e].hidden&&this.skills[e].level<1||(t[e]=this.skills[e]);return t},skillConf(){return gt().skills},xpPerLevel(){return gt().skillOptions.xpPerLevel}}}),yY="",TJ=j.createElementVNode("h3",{class:"title"},"Skills",-1),MJ={key:0,class:"skills-container"},IJ=["onClick"],NJ={class:"skill-title"},LJ={class:"skill-xp-container"},DJ={class:"skill-xp-text"},RJ={class:"skill-level"},BJ={key:1},zJ={class:"flex flex-row skill-description-container"},VJ={class:"flex skill-left"},FJ={class:"flex skill-right"},qJ=j.createElementVNode("hr",{class:"hr-solid"},null,-1);function HJ(t,e,n,r,o,i){const a=j.resolveComponent("modal");return j.openBlock(),j.createBlock(a,{class:"menu",onClose:e[1]||(e[1]=s=>t.$emit("close")),containerCssClass:"skills-modal"},{header:j.withCtx(()=>[TJ]),body:j.withCtx(()=>[t.chosenSkill?typeof t.chosenSkill=="string"?(j.openBlock(),j.createElementBlock("div",BJ,[j.createElementVNode("div",zJ,[j.createElementVNode("div",VJ,[j.createElementVNode("div",{class:"skill-display",style:j.normalizeStyle(t.getSkillStyle(t.chosenSkill))},null,4)]),j.createElementVNode("div",FJ,[j.createElementVNode("h2",null,j.toDisplayString(t.getSkillName(t.chosenSkill)),1),qJ,j.createElementVNode("h3",null,"Level: "+j.toDisplayString(t.skills[t.chosenSkill].level),1),j.createElementVNode("p",null,j.toDisplayString(t.skillConf[t.chosenSkill].description),1)])]),j.createElementVNode("button",{class:"button",onClick:e[0]||(e[0]=(...s)=>t.closeSkill&&t.closeSkill(...s))},j.toDisplayString("<--"))])):j.createCommentVNode("",!0):(j.openBlock(),j.createElementBlock("div",MJ,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.skillsToDisplay,s=>(j.openBlock(),j.createElementBlock("button",{onClick:()=>t.clickSkill(s.id),class:"skill-display",style:j.normalizeStyle(t.getSkillStyle(s.id)),key:s.id},[j.createElementVNode("h3",NJ,j.toDisplayString(t.getSkillName(s.id)),1),j.createElementVNode("div",LJ,[j.createElementVNode("div",{class:"skill-xp-bar",style:j.normalizeStyle(t.xpBarWidth(s.xp))},null,4),j.createElementVNode("h3",DJ,j.toDisplayString(s.xp)+" / "+j.toDisplayString(t.xpPerLevel)+" XP",1)]),j.createElementVNode("h3",RJ,j.toDisplayString(s.level),1)],12,IJ))),128))]))]),_:1})}const WJ=qr(PJ,[["render",HJ]]),UJ=j.defineComponent({setup(){const t=mr(),e=Xr(),n=j.computed(()=>t.items),r=j.computed(()=>e.currentDialog.choices);return{items:n,currentlyChoosing:r}},components:{Modal:hs},data(){return{chosenId:!1}},mounted(){},methods:{close(){this.$emit("close")},getItemStyle(t){return{backgroundImage:`url(${this.itemConf[t].icon})`}},getItemName(t){return this.itemConf[t].name},getItemConf(t){return this.itemConf[t]},clickItem(t){this.chosenId=t},closeItem(){this.chosenId=!1},useItem(){if(this.chosenItem&&this.canUseChosenItem&&this.chosenItemConf){const t=this.chosenItemConf.onUse;this.close(),t.action==="jump"?fn().jumpToLabel(t.label):t.action==="run"?fn().runThenGoBackToPreviousDialog(t.label,!0):Bn(`Unknown action ${t.action}`)}},canUseItem(t){const e=this.itemConf[t.id];return!!(e&&e.onUse&&!mr().isInteractionTagBlocked(e.tag)&&!this.currentlyChoosing)}},computed:{itemsToDisplay(){const t={};for(const e in this.items)this.items[e].amount>0&&(t[e]=this.items[e]);return t},chosenItem(){return this.chosenId?this.items[this.chosenId]:null},canUseChosenItem(){return this.canUseItem(this.chosenItem)},chosenItemConf(){return this.chosenId?this.itemConf[this.chosenId]:null},itemConf(){return gt().items}}}),bY="",JJ=j.createElementVNode("h3",{class:"title"},"Inventory",-1),GJ={key:0,class:"inventory-container"},KJ=["onClick"],QJ={class:"item-title"},YJ={class:"item-amount"},XJ={key:1},ZJ={class:"flex flex-row item-description-container"},eG={class:"flex item-left"},tG={class:"flex item-right"},nG=j.createElementVNode("hr",{class:"hr-solid"},null,-1),rG={key:2},oG=[j.createElementVNode("h2",null,"The inventory is empty!",-1)];function iG(t,e,n,r,o,i){const a=j.resolveComponent("modal");return j.openBlock(),j.createBlock(a,{class:"menu",onClose:t.close,containerCssClass:"inventory-modal"},{header:j.withCtx(()=>[JJ]),body:j.withCtx(()=>[!t.chosenItem&&Object.keys(t.itemsToDisplay).length>0?(j.openBlock(),j.createElementBlock("div",GJ,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.itemsToDisplay,s=>(j.openBlock(),j.createElementBlock("button",{onClick:()=>t.clickItem(s.id),class:"item-display",style:j.normalizeStyle(t.getItemStyle(s.id)),key:s.id},[j.createElementVNode("h3",QJ,j.toDisplayString(t.getItemName(s.id)),1),j.createElementVNode("h3",YJ,j.toDisplayString(s.amount),1)],12,KJ))),128))])):typeof t.chosenId=="string"?(j.openBlock(),j.createElementBlock("div",XJ,[j.createElementVNode("div",ZJ,[j.createElementVNode("div",eG,[j.createElementVNode("div",{class:"item-display",style:j.normalizeStyle(t.getItemStyle(t.chosenId))},null,4)]),j.createElementVNode("div",tG,[j.createElementVNode("h2",null,j.toDisplayString(t.getItemName(t.chosenId)),1),nG,j.createElementVNode("h3",null,"Amount: "+j.toDisplayString(t.chosenItem.amount),1),j.createElementVNode("p",null,j.toDisplayString(t.chosenItemConf.description),1),j.createElementVNode("button",{onClick:e[0]||(e[0]=(...s)=>t.useItem&&t.useItem(...s)),class:j.normalizeClass(["button",t.canUseChosenItem?"":"disabled"])}," Use ",2)])]),j.createElementVNode("button",{class:"button",onClick:e[1]||(e[1]=(...s)=>t.closeItem&&t.closeItem(...s))},j.toDisplayString("<--"))])):(j.openBlock(),j.createElementBlock("div",rG,oG))]),_:1},8,["onClose"])}const aG=qr(UJ,[["render",iG]]),sG=j.defineComponent({props:{pictureUrl:String},computed:{...Ci(du,["layoutMode"]),boxStyle(){const t=gt().layout;let e=0,n=0;return this.layoutMode==="vertical"?(e="50%",n=`${t.mobileDialogHeightPercentage-5}%`):(e=`${t.minTextWidth-10}px`,n="20%"),{right:e,bottom:n,width:`${t.portraits.width}px`,height:`${t.portraits.height}px`}}}}),wY="",uG=["src"];function lG(t,e,n,r,o,i){return j.openBlock(),j.createElementBlock("div",{class:"dialog-picture override",style:j.normalizeStyle(t.boxStyle)},[j.createElementVNode("img",{src:t.pictureUrl,class:"picture override"},null,8,uG)],4)}const cG=qr(sG,[["render",lG]]);class fG{constructor(){Po(this,"listeners",{})}on(e,n){return this.listeners[e]||this.addEventToMap(e),this.listeners[e].add(n),n}off(e,n){return this.listeners[e]&&this.listeners[e].delete(n),n}once(e,n){const r=(...o)=>{this.off(e,r),n(...o)};return this.on(e,r)}emit(e,...n){this.listeners[e]&&this.listeners[e].forEach(r=>r(...n))}clear(){Object.keys(this.listeners).forEach(e=>{delete this.listeners[e]})}addEventToMap(e){this.listeners[e]=new Set}}class dG extends fG{setup(e=!1){const r=e?"keydown":"keyup",o=A8(i=>{Nl.emit("debouncedKeydown",i)},10,{isImmediate:!0,maxWait:10});document.addEventListener("keydown",i=>{Nl.emit("keydown",i)}),document.addEventListener(r,i=>{o(i)})}}const Nl=new dG,hG=j.defineComponent({data(){return{playerText:"",passed:!1,listener:null,timeout:null}},props:{options:{type:Object,required:!0},active:Boolean},mounted(){if(this.canInteract){const t=e=>{if(this.canInteract&&this.options.textField&&e.key==="Enter"&&this.submitText(),this.canInteract&&!this.options.textField){let n=-1;if(e.key===" ")n=0;else switch(e.key){case" ":n=0;break;case"1":n=0;break;case"2":n=1;break;case"3":n=2;break;case"4":n=3;break;case"5":n=4;break;case"6":n=5;break;case"7":n=6;break;case"8":n=7;break}n!==-1&&(this.choices&&n<this.choices.length?this.chooseOption(this.choices[n]):this.chooseOption(n))}};this.listener=Nl.on("debouncedKeydown",t),this.timeout=setTimeout(()=>{this.options.textField&&this.$refs.playerInput.focus()},10)}},unmounted(){this.clearListeners()},computed:{...Ci(yn,["paused"]),preText(){return this.options.title?" \u2013 ":""},style(){return Ld(this.options.styleId)},dialogBoxStyle(){const t=Ld(this.options.styleId),e={opacity:this.options.old?"0.7":"1"};return this.options.title||(e.marginTop="-20px"),{...t.boxCss,...e}},titleStyle(){const t=Ld(this.options.styleId);return{color:t.color,...t.nameCss}},textStyle(){return Ld(this.options.styleId).textCss},choices(){if(this.options.choices)return this.options.choices},canInteract(){return this.active&&!this.passed&&this.options.interactive&&!this.paused}},methods:{clearListeners(){this.listener&&(Nl.off("keydown",this.listener),this.listener=null),this.timeout&&(clearTimeout(this.timeout),this.timeout=null)},chooseOption(t){this.finishLine();let e;typeof t=="object"?e=t.originalIndex:e=t,yn().playerAnswered(e)},finishLine(){this.clearListeners(),this.passed=!0},dialogStyle(t){const e={};return t.allowed||(e.pointerEvents="none",e.textDecoration="line-through"),e},dialogClass(t){if(!t.allowed)return"strike-anim"},submitText(){const t=this.playerText;yn().playerAnswered(t)}}}),jY="",pG={class:"dialog-content"},vG=["innerHTML"],mG=["innerHTML"],gG=["innerHTML"],yG={key:1,class:"dialog-choices"},bG=["onClick","innerHTML"],kG={key:2},wG={key:3,class:"buttons-container"};function jG(t,e,n,r,o,i){return j.openBlock(),j.createElementBlock("div",{class:"dialog-box w-full override",style:j.normalizeStyle(t.dialogBoxStyle)},[j.createElementVNode("div",pG,[t.options.title?(j.openBlock(),j.createElementBlock("span",{key:0,class:"dialog-title override",style:j.normalizeStyle(t.titleStyle),innerHTML:t.options.title},null,12,vG)):j.createCommentVNode("",!0),j.createElementVNode("span",{class:"dialog-text dialog-separator override",style:j.normalizeStyle(t.textStyle),innerHTML:t.preText},null,12,mG),j.createElementVNode("span",{class:j.normalizeClass(["dialog-text override",t.options.cssClass]),style:j.normalizeStyle(t.textStyle),innerHTML:t.options.text},null,14,gG),t.canInteract&&t.choices?(j.openBlock(),j.createElementBlock("div",yG,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.choices,(a,s)=>(j.openBlock(),j.createElementBlock("p",{key:s,style:j.normalizeStyle(t.dialogStyle(a)),class:j.normalizeClass([t.dialogClass(a),"dialog-choice override"]),onClick:u=>t.chooseOption(a),innerHTML:`${s+1}. \u2013\xA0 ${a.choice}`},null,14,bG))),128))])):t.canInteract&&t.options.textField?(j.openBlock(),j.createElementBlock("div",kG,[j.withDirectives(j.createElementVNode("input",{type:"text",class:"label-input input",ref:"playerInput",id:"player-input-field","onUpdate:modelValue":e[0]||(e[0]=a=>t.playerText=a)},null,512),[[j.vModelText,t.playerText]]),j.createElementVNode("button",{onClick:e[1]||(e[1]=(...a)=>t.submitText&&t.submitText(...a)),class:"button",id:"player-input-submit"}," Submit ")])):t.canInteract?(j.openBlock(),j.createElementBlock("div",wG,[j.createElementVNode("div",{onClick:e[2]||(e[2]=a=>t.chooseOption(0)),class:"interact-button button override"}," Continue ")])):j.createCommentVNode("",!0)])],4)}const xG=qr(hG,[["render",jG]]),_G=j.createElementVNode("div",{class:"anchor"},null,-1),SG=j.defineComponent({__name:"game-dialog",props:{layoutMode:String,inGame:Boolean},setup(t){const e=t,n=fn(),r=j.computed(()=>n.stack),o=Xr(),i=j.computed(()=>o.dialog),a=j.ref(null),s=j.computed(()=>e.layoutMode==="vertical"?{}:{paddingBottom:`${gt().layout.dialogBottomPadding}px`}),u=j.computed(()=>{if(i.value.length>0)return i.value[i.value.length-1]}),l=j.computed(()=>{if(u.value)return mJ(u.value.speaker,u.value.pose)}),f=j.computed(()=>gt().layout.minTextWidth),c=j.computed(()=>{let p;const v="100%";return e.layoutMode,{width:e.layoutMode==="horizontal"?`${f.value}px`:"100%",height:v,transform:p,transformOrigin:"right"}});function d(p,v){let m=e0(p.speaker).name;return v>=1&&i.value[v-1].speaker===p.speaker&&(m=void 0),p.choices&&p.choices.forEach(y=>{y.choice=Qg(y.choice)}),{title:m!=null?m:"",text:p.text,cssClass:p.cssClass,styleId:p.speaker,choices:p.choices,old:v<i.value.length-1,interactive:p.interactive,textField:p.textField}}function h(p){return p===o.dialog.length-1&&r.value.length>0}return j.watch(i.value,p=>{if(a.value){const v=a.value;v.scrollTop=v.scrollHeight+1e8}}),(p,v)=>(j.openBlock(),j.createElementBlock(j.Fragment,null,[j.createVNode(j.Transition,{name:"fade"},{default:j.withCtx(()=>[j.unref(l)?(j.openBlock(),j.createBlock(cG,{key:0,pictureUrl:j.unref(l)},null,8,["pictureUrl"])):j.createCommentVNode("",!0)]),_:1}),t.inGame?(j.openBlock(),j.createElementBlock("div",{key:0,class:"dialog override",ref_key:"dialogRef",ref:a,style:j.normalizeStyle(j.unref(c))},[j.createVNode(j.TransitionGroup,{name:"list",tag:"div",class:"dialog-container w-full override",style:j.normalizeStyle(j.unref(s))},{default:j.withCtx(()=>[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(j.unref(i),(g,m)=>(j.openBlock(),j.createBlock(xG,{key:g.id,options:d(g,m),active:h(m)},null,8,["options","active"]))),128))]),_:1},8,["style"]),_G],4)):j.createCommentVNode("",!0)],64))}}),xY="",CG=j.defineComponent({setup(){const t=Vr();return{quests:j.computed(()=>t.quests)}},computed:{questsToDisplay(){return o8(this.quests,t=>t.state!=="hidden")}},methods:{close(){this.$emit("close")},getQuestData(t){return Cd(t)},getObjectiveData(t,e){return Ng(t,e)},getDisplayTextForQuestState(t){switch(t.state){case"hidden":return" Hidden";case"unlocked":return"";case"completed":return" (Completed)";default:return" Unknown"}},getQuestDescription(t){return t.ending?t.ending:this.getQuestData(t.id).description},getAvailableObjectives(t){return o8(t.objectives,e=>e.state!=="hidden")}},components:{Modal:hs}}),_Y="",$G=j.createElementVNode("h3",{class:"title"},"Quests",-1),OG={key:0,class:"quests-container"},EG={class:"quest-title"},AG={class:"quest-description"},PG={key:0,class:"quest-objectives-container list-disc"},TG={key:1,class:"menu-container"},MG=[j.createElementVNode("h2",{class:"title"},"There are no quests!",-1)];function IG(t,e,n,r,o,i){const a=j.resolveComponent("modal");return j.openBlock(),j.createBlock(a,{class:"quests",onClose:t.close,containerCssClass:"quests-modal"},{header:j.withCtx(()=>[$G]),body:j.withCtx(()=>[Object.keys(t.questsToDisplay).length>0?(j.openBlock(),j.createElementBlock("div",OG,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.questsToDisplay,s=>(j.openBlock(),j.createElementBlock("div",{class:"quest-display",key:s.id},[j.createElementVNode("div",{class:j.normalizeClass(["quest-header",s.state==="completed"?"quest-completed":"quest-in-progress"])},[j.createElementVNode("h3",EG,j.toDisplayString(t.getQuestData(s.id).title)+" "+j.toDisplayString(t.getDisplayTextForQuestState(s)),1)],2),j.createElementVNode("p",AG,j.toDisplayString(t.getQuestDescription(s)),1),s.state!=="completed"?(j.openBlock(),j.createElementBlock("ul",PG,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.getAvailableObjectives(s),u=>(j.openBlock(),j.createElementBlock("li",{class:"quest-objective-display",key:u.id},[j.createElementVNode("p",{class:j.normalizeClass(["quest-objective-description",u.state==="completed"?"quest-objective-completed":"quest-objctive-in-progress"])},j.toDisplayString(t.getObjectiveData(s.id,u.id).description),3)]))),128))])):j.createCommentVNode("",!0)]))),128))])):(j.openBlock(),j.createElementBlock("div",TG,MG))]),_:1},8,["onClose"])}const NG=qr(CG,[["render",IG]]),LG=j.defineComponent({data(){return{buttons:[{id:"menu",cssId:"menu-button",text:"Menu"},{id:"skills",cssId:"skills-menu-button",text:"Skills",condition:()=>this.showSkills},{id:"inventory",cssId:"inventory-menu-button",text:"Items",condition:()=>this.showInventory},{id:"quests",cssId:"quests-menu-button",text:"Quests",condition:()=>this.showQuests}],activeMenu:!1}},mounted(){document.addEventListener("keydown",t=>{t.key==="Escape"&&this.toggleMenu()}),ar.callHook("onGameMounted")},unmounted(){ar.callHook("onGameUnmounted")},methods:{buttonClick(t){t.onClick?t.onClick():yn().openModal(t.id)},openMenu(){yn().openModal("menu")},openSkills(){yn().openModal("skills")},openInventory(){yn().openModal("inventory")},openQuests(){yn().openModal("quests")},closeMenu(){yn().closeModal()},toggleMenu(){yn().toggleMenu()}},computed:{buttonsToShow(){return this.buttons.map(t=>{const e=gt().menuButtons[t.id]||{};return{...t,...e}}).filter(t=>t.condition?t.condition():!0)},showSkills(){return Object.entries(gt().skills).length>0},showInventory(){return Object.entries(gt().items).length>0},showQuests(){return Object.entries(gt().quests).length>0}}}),CY="",DG={class:"menu-container"},RG=["onClick","id"];function BG(t,e,n,r,o,i){return j.openBlock(),j.createElementBlock("div",DG,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(t.buttonsToShow,a=>(j.openBlock(),j.createElementBlock("button",{key:a.id,onClick:s=>t.buttonClick(a),id:a.cssId,class:"button menu-toggle-button"},j.toDisplayString(a.text),9,RG))),128))])}const zG=qr(LG,[["render",BG]]),VG=["id"],FG=["id","onClick"],t0=j.defineComponent({__name:"screen-layer",props:{layer:String,transitioning:{type:Boolean,default:!1}},setup(t){const e=t,n=fn(),r=yn(),o=$i(),i=j.computed(()=>gt().layout.backgrounds.width),a=j.computed(()=>gt().layout.backgrounds.height),s=j.computed(()=>e.layer),u=j.computed(()=>o.buttons),l=j.computed(()=>{const m=gt().screens[s.value];if(!m)throw new Error(`Screen ${s.value} doesn't have a config`);return m}),f=j.computed(()=>l.value.buttons||[]),c=j.computed(()=>r.isInGame);function d(m){const b=Pl(m).background;if(!!b)return I7(b)}function h(m){const y=Pl(m),b=u.value[m],k=y.tag||"default",w=b.state;return w===!0&&mr().isInteractionTagBlocked(k)?"greyed":w}function p(m){const y=Pl(m),b={},k=h(m);y.position.width&&(b.width=`${y.position.width}px`),y.position.height&&(b.height=`${y.position.height}px`),y.background&&(b.backgroundImage=`url(${d(m)})`),k==="greyed"?(b.opacity=.3,b.pointerEvents="none"):(k==="hidden"||k===!1)&&(b.display="none",b.pointerEvents="none");let w=y.position.left,E=y.position.top;return y.anchor&&(w=y.position.left-y.position.width*y.anchor.x,E=y.position.top-y.position.height*y.anchor.y),{...b,left:`${w}px`,top:`${E}px`}}function v(m){if(e.transitioning)return;const y=Pl(m);if(u.value[m].state===!0){const k=y.action;y.actionType==="run"?n.runLabelFunction(k):n.jumpToLabel(k)}}const g=j.computed(()=>({backgroundImage:`url(${I7(l.value.background)})`,width:`${i.value}px`,height:`${a.value}px`}));return(m,y)=>j.unref(c)?(j.openBlock(),j.createElementBlock("div",{key:0,class:"viewport-layer",id:`viewport-layer-${j.unref(s)}`,style:j.normalizeStyle(j.unref(g))},[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(j.unref(f),(b,k)=>(j.openBlock(),j.createElementBlock("button",{key:k,class:"viewport-button",id:`viewport-button-${b}`,onClick:w=>v(b),style:j.normalizeStyle(p(b))},j.toDisplayString(j.unref(Pl)(b).text),13,FG))),128))],12,VG)):j.createCommentVNode("",!0)}}),$Y="",qG=j.defineComponent({__name:"NarratTransition",props:{name:{type:String,required:!0},duration:{type:Number,required:!0},delay:Number},emits:["complete"],setup(t,{emit:e}){const n=t,r=j.ref("start"),o=j.reactive({oldSlotClasses:{},oldSlotStyle:{},newSlotClasses:{},newSlotStyle:{}});return j.onMounted(async()=>{var a;const i=`narrat-transition-${n.name}`;o.newSlotClasses={[`${i}-enter-from`]:!0,[`${i}-enter-active`]:!0},o.oldSlotStyle={transitionDuration:`${n.duration/1e3}s`},o.newSlotStyle={transitionDuration:`${n.duration/1e3}s`},o.oldSlotClasses={[`${i}-leave-active`]:!0},await os(30),o.oldSlotClasses[`${i}-leave-to`]=!0,await os((a=n.delay)!=null?a:0),delete o.newSlotClasses[`${i}-enter-from`],await os(n.duration),delete o.newSlotClasses[`${i}-enter-active`],delete o.oldSlotClasses[`${i}-leave-active`],r.value="end",e("complete")}),(i,a)=>(j.openBlock(),j.createElementBlock(j.Fragment,null,[r.value!=="end"?(j.openBlock(),j.createElementBlock("div",{key:0,class:j.normalizeClass(["transition-holder",o.oldSlotClasses]),style:j.normalizeStyle(o.oldSlotStyle)},[j.renderSlot(i.$slots,"oldElement",{class:j.normalizeClass(o.oldSlotClasses)})],6)):j.createCommentVNode("",!0),j.createElementVNode("div",{class:j.normalizeClass(["transition-holder",o.newSlotClasses]),style:j.normalizeStyle(o.newSlotStyle)},[j.renderSlot(i.$slots,"newElement")],6)],64))}}),OY="",HG=j.defineComponent({__name:"screens",setup(t){const e=du(),n=yn(),r=$i(),o=j.computed(()=>r.layers.filter(c=>c)),i=j.computed(()=>e.layoutMode),a=j.computed(()=>gt().layout.backgrounds.width),s=j.computed(()=>gt().layout.backgrounds.height),u=j.computed(()=>n.isInGame);function l(c){r.finishTransition(c)}const f=j.computed(()=>{const c=`${a.value}px`;let d=`${s.value}px`;return i.value==="vertical"&&(d=`${100-gt().layout.mobileDialogHeightPercentage}%`),{height:d,width:c}});return(c,d)=>j.unref(u)?(j.openBlock(),j.createElementBlock("div",{key:0,class:"viewport",id:"narrat-viewport",style:j.normalizeStyle(j.unref(f))},[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(j.unref(o),(h,p)=>(j.openBlock(),j.createElementBlock("div",{key:p,class:"layer-container"},[h.transition?(j.openBlock(),j.createBlock(qG,{key:0,name:h.transition.transition,duration:h.transition.duration,delay:h.transition.delay,onComplete:()=>l(p)},{oldElement:j.withCtx(()=>[j.createVNode(t0,{layer:h.transition.oldScreen,transitioning:!0},null,8,["layer"])]),newElement:j.withCtx(()=>[j.createVNode(t0,{layer:h.screen,transitioning:!0},null,8,["layer"])]),_:2},1032,["name","duration","delay","onComplete"])):(j.openBlock(),j.createBlock(t0,{key:1,layer:h.screen},null,8,["layer"]))]))),128))],4)):j.createCommentVNode("",!0)}}),EY="",WG=j.createElementVNode("h3",{class:"title"},"Choose a save file",-1),UG={class:"saves-container flex flex-col"},JG={key:0,class:"empty-save-slot flex flex-row justify-around items-center grow"},GG=["onClick"],KG=[j.createElementVNode("h3",null,"Create a new save slot",-1)],QG={key:1,class:"used-save-slot flex flex-row justify-between items-center grow"},YG={class:"flex flex-col"},XG={class:"flex flex-col"},ZG={class:"flex flex-row"},eK=["onClick"],tK=[j.createElementVNode("h3",null,"Load",-1)],nK=["onClick"],rK=[j.createElementVNode("h3",null,"Delete",-1)],oK=j.defineComponent({__name:"save-slots",emits:["chosen","close"],setup(t,{emit:e}){const n=j.reactive([]);j.onMounted(()=>{a8().slots.forEach((s,u)=>{n[u]=s}),n.push(null)});function r(a){const s={saveData:n[a],slot:a};e("chosen",s)}function o(a){FW(a),n[a]=null}function i(a){return Ud(a.main.playTime)}return(a,s)=>(j.openBlock(),j.createBlock(hs,{onClose:s[0]||(s[0]=u=>a.$emit("close")),containerCssClass:"save-modal"},{header:j.withCtx(()=>[WG]),body:j.withCtx(()=>[j.createElementVNode("div",UG,[(j.openBlock(!0),j.createElementBlock(j.Fragment,null,j.renderList(n,(u,l)=>(j.openBlock(),j.createElementBlock("div",{class:"save-slot flex flex-row",key:l},[u==null?(j.openBlock(),j.createElementBlock("div",JG,[j.createElementVNode("button",{class:"button",onClick:f=>r(l)},KG,8,GG)])):(j.openBlock(),j.createElementBlock("div",QG,[j.createElementVNode("div",YG,[j.createElementVNode("h3",null,"Slot "+j.toDisplayString(l+1),1),j.createElementVNode("div",XG,[j.createElementVNode("p",null,"Play time: "+j.toDisplayString(i(u)),1),j.createElementVNode("p",null," Last save: "+j.toDisplayString(new Date(u.metadata.saveDate).toLocaleString()),1)])]),j.createElementVNode("div",ZG,[j.createElementVNode("button",{class:"button",onClick:f=>r(l)},tK,8,eK),j.createElementVNode("button",{class:"button",onClick:f=>o(l)},rK,8,nK)])]))]))),128))])]),_:1}))}}),MY="",iK={id:"game-menu",style:{height:"100%",padding:"20px"}},aK={id:"game-header",class:"flex flex-col justify-between items-center"},sK={id:"game-title-container"},uK={id:"game-title-text"},lK={class:"flex flex-col start-menu-buttons-container"},cK=j.defineComponent({__name:"StartMenu",setup(t){const e=j.ref(!1),n=j.ref(null),r=j.ref(-1),o=j.ref(!1);async function i(){const c=yn();r.value===-1&&(r.value=zW()),await c.startGame(r.value)}async function a(){const c=VW(r.value);if(!c){Bn("No save file found");return}yn().loadGame(c,r.value)}function s(){typeof n.value=="number"&&(r.value=n.value,a())}function u(){o.value=!0}function l({saveData:c,slot:d}){r.value=d,c?a():i()}j.onMounted(()=>{const c=a8();c.slots.length>0&&(e.value=!0),c.lastSaveSlot&&c.slots.length>c.lastSaveSlot&&c.slots[c.lastSaveSlot]&&(n.value=c.lastSaveSlot)});const f=j.computed(()=>gt().gameTitle);return(c,d)=>(j.openBlock(),j.createElementBlock("div",iK,[o.value?(j.openBlock(),j.createBlock(oK,{key:0,onChosen:l,onClose:d[0]||(d[0]=h=>o.value=!1)})):j.createCommentVNode("",!0),j.createElementVNode("div",aK,[j.createElementVNode("div",sK,[j.createElementVNode("h1",uK,j.toDisplayString(j.unref(f)),1)]),j.createElementVNode("div",lK,[n.value?(j.openBlock(),j.createElementBlock("button",{key:0,class:"button menu-button main-menu-button large continue-button override",onClick:s}," Continue ")):j.createCommentVNode("",!0),j.createElementVNode("button",{class:"button menu-button main-menu-button large start-button override",onClick:i}," New Game "),e.value?(j.openBlock(),j.createElementBlock("button",{key:1,class:"button menu-button main-menu-button large continue-button override",onClick:u}," Load Game ")):j.createCommentVNode("",!0)])])]))}}),IY="",fK=j.defineComponent({setup(){const t=Xr(),e=fn(),n=yn();return{dialog:j.computed(()=>t.dialog),stack:j.computed(()=>e.stack),modal:j.computed(()=>n.modal),flowState:j.computed(()=>n.flowState)}},$refs:{dialogContainer:HTMLInputElement},inject:["mq"],components:{DebugMenu:ZU,LoadingBar:cJ,NotificationToast:pJ,Hud:iJ,MainMenu:AJ,Skills:WJ,InventoryUi:aG,GameDialog:SG,QuestsUi:NG,MenuButtons:zG,Screens:HG,StartMenu:cK},data(){return{lineTitle:"title",lineText:"hello",gameLoaded:!1,loadingStep:"Loading",loadingPercentage:.1}},props:{config:Object,options:Object},async mounted(){ar.callHook("onAppMounted"),this.loadingStep="Characters";const t=await Ug(this.config.charactersPath);await vJ(JSON.parse(t)),this.loadingPercentage=.2,this.loadingStep="Data",this.loadingPercentage=.3,this.loadingStep="Images",await gJ(gt()),this.loadingPercentage=.7,this.loadingStep="Audio",await TW(gt()),ar.callHook("onAssetsLoaded"),this.loadingPercentage=.95,this.loadingStep="Starting...",await this.setupMachine(),ar.callHook("onGameSetup"),this.loadingPercentage=.1,this.gameLoaded=!0,window.addEventListener("resize",A8(()=>{this.updateScreenSize()},100,{maxWait:200})),Nl.setup(this.options.debug),setTimeout(()=>{this.updateScreenSize()},50)},computed:{...Ci(du,["screenWidth","screenHeight","canvasWidth","canvasHeight","topOffset","leftOffset","layoutMode"]),...Ci(fn,["currentLine"]),backgroundStyle(){let t;return this.layoutMode==="vertical"&&(t=`${100-gt().layout.mobileDialogHeightPercentage}%`),{backgroundColor:"red",height:t}},layoutWidth(){return gt().layout.backgrounds.width},inGame(){return this.flowState==="playing"},layoutHeight(){return gt().layout.backgrounds.height},backgroundSize(){return{width:this.canvasWidth,height:this.canvasHeight,top:this.topOffset,left:this.leftOffset}},gameWidth(){const t=gt();return this.layoutMode==="vertical"?window.innerWidth:t.layout.backgrounds.width+t.layout.minTextWidth},gameHeight(){const t=gt();return this.layoutMode==="vertical"?window.innerHeight:t.layout.backgrounds.height},appStyle(){const t=gt();if(this.screenWidth&&this.screenHeight&&t&&this.layoutMode==="horizontal"){const e=$8(this.screenWidth,this.screenHeight,this.gameWidth,this.gameHeight);return{transform:`scale(${e}, ${e})`,width:`${this.gameWidth}px`,height:`${this.gameHeight}px`}}return{}},gameStyle(){let t="row";return this.layoutMode==="vertical"&&(t="column"),{flexDirection:t}},screenRatio(){const t=gt(),e=t.layout.minTextWidth+t.layout.backgrounds.width;return this.screenWidth/e}},methods:{async setupMachine(){const t=gt().scripts;return yn().setup(t,gt())},updateScreenSize(){du().updateScreenSize(window.innerWidth,window.innerHeight,this.layoutMode==="horizontal"?gt().layout.minTextWidth*this.screenRatio:0)},closeModal(){yn().closeModal()}}}),NY="",dK={key:3};function hK(t,e,n,r,o,i){const a=j.resolveComponent("Hud"),s=j.resolveComponent("MenuButtons"),u=j.resolveComponent("Skills"),l=j.resolveComponent("InventoryUi"),f=j.resolveComponent("QuestsUi"),c=j.resolveComponent("MainMenu"),d=j.resolveComponent("Screens"),h=j.resolveComponent("GameDialog"),p=j.resolveComponent("StartMenu"),v=j.resolveComponent("LoadingBar"),g=j.resolveComponent("DebugMenu"),m=j.resolveComponent("NotificationToast");return j.openBlock(),j.createElementBlock("div",{id:"app",style:j.normalizeStyle(t.appStyle)},[t.inGame?(j.openBlock(),j.createBlock(a,{key:0})):j.createCommentVNode("",!0),t.inGame?(j.openBlock(),j.createElementBlock("div",{key:1,class:"game",style:j.normalizeStyle(t.gameStyle)},[j.createVNode(s,{class:"menu-toggle"}),t.modal==="skills"?(j.openBlock(),j.createBlock(u,{key:0,onClose:t.closeModal},null,8,["onClose"])):j.createCommentVNode("",!0),t.modal==="inventory"?(j.openBlock(),j.createBlock(l,{key:1,onClose:t.closeModal},null,8,["onClose"])):j.createCommentVNode("",!0),t.modal==="quests"?(j.openBlock(),j.createBlock(f,{key:2,onClose:t.closeModal},null,8,["onClose"])):j.createCommentVNode("",!0),t.modal==="menu"?(j.openBlock(),j.createBlock(c,{key:3,onClose:t.closeModal},null,8,["onClose"])):j.createCommentVNode("",!0),j.createVNode(d),j.createVNode(h,{inGame:t.inGame,layoutMode:t.layoutMode},null,8,["inGame","layoutMode"])],4)):t.gameLoaded?(j.openBlock(),j.createBlock(p,{key:2})):(j.openBlock(),j.createElementBlock("div",dK,[j.createVNode(v,{percentage:t.loadingPercentage,step:t.loadingStep},null,8,["percentage","step"])])),t.options.debug?(j.openBlock(),j.createBlock(g,{key:4})):j.createCommentVNode("",!0),j.createVNode(m)],4)}const pK=qr(fK,[["render",hK]]);function dn(t,e){console.error("Runtime error ========================="),console.error(`Command: ${t.commandType}`),console.error("Args: ",t.args),console.error("Options: ",t.options),Bn(`Runtime error at ${t.fileName}:${t.line} (${t.commandType}) ${t.code}. -
|
|
183
183
|
<br />
|
|
184
184
|
Error: ${e}`),console.error("============================")}function vK(t,...e){console.log(`[${t.fileName}:${t.line}] log: `,...e)}class Ze{constructor(e,n,r,o){Po(this,"keyword");Po(this,"runner");Po(this,"argTypes");Po(this,"parser");Po(this,"onPlayerAnswered");Po(this,"returnAfterPlayerAnswer");this.keyword=e,this.runner=r,this.argTypes=n,o?this.parser=o:this.parser=Ll(this.keyword,this.argTypes),this.returnAfterPlayerAnswer=!1}async run(e,n){let r=await this.runner(e,n);return this.returnAfterPlayerAnswer&&(r=await new Promise((o,i)=>{fn().waitForPlayerAnswer(e),e.finishCommand=o})),r}async processPlayerAnswer(e,n){let r=n;return this.onPlayerAnswered&&(r=await this.onPlayerAnswered(e,n)),this.returnAfterPlayerAnswer&&e.finishCommand&&e.finishCommand(r),r}static FromOptions(e){var r;const n=new Ze(e.keyword,e.argTypes,e.runner,e.parser);return n.onPlayerAnswered=e.onPlayerAnswered,n.returnAfterPlayerAnswer=(r=e.returnAfterPlayerAnswer)!=null?r:!1,n}}function Ll(t,e){let n=[];if(e!=="any"){n=[];const r=e.reduce((o,i)=>i.optional?o+1:o,0);r>=1?n.push(e.length-r):n.push(e.length),n.push(e.length)}return(r,o)=>{const i={newLine:r.currentLine+1},a=o.command.args;return e!=="any"&&(a.length<n[0]||a.length>n[1])?(console.log("Error details"),console.log(o.command),console.log(a),r.parserContext.error(r.line.line,`Command ${t}: Expected ${n.join(" to ")} arguments but got ${a.length}`),i):(o.command.commandType=t,e!=="any"&&o.command.args.forEach((s,u)=>{const l=e[u];!j8(s)&&!x8(s)&&(l.type==="any"||typeof s===l.type||r.parserContext.error(r.line.line,`Command ${t}: Argument #${u+1} (${l.name}) should be a ${l.type}, but got type ${typeof s}: ${JSON.stringify(s)}`))}),{newLine:r.currentLine+1})}}const mK=new Ze("add_level",[{name:"skillKey",type:"string"},{name:"amount",type:"number"}],async t=>{let{skillKey:e,amount:n}=t.options;if((!e||!n)&&dn(t,"add_level command needs a skill id and a value as parameters"),!Number.isInteger(n)){const r=n;n=Math.round(n),console.warn(`add_level expects a level to be an integer. Auto Rounding ${r} to ${n}`)}cr().incrementSkill(e,n)}),gK=Ze.FromOptions({keyword:"set_level",argTypes:[{name:"skill",type:"string"},{name:"level",type:"number"}],runner:async t=>{let{skill:e,level:n}=t.options;if((!e||!n)&&dn(t,"set_level command needs a skill id and a value as parameters"),!Number.isInteger(n)){const r=n;n=Math.round(n),console.warn(`set_level expects a level to be an integer. Auto Rounding ${r} to ${n}`)}cr().setSkillLevel(e,n)}}),yK=new Ze("add_xp",[{name:"xpKey",type:"string"},{name:"xpToAdd",type:"number"}],async t=>{const{xpKey:e,xpToAdd:n}=t.options;(!e||!n)&&dn(t,"add_xp command needs a skill id and a value as parameters"),cr().addXp(e,n)}),bK=new Ze("get_level",[{name:"skillKey",type:"string"}],async t=>{const{skillKey:e}=t.options;e||dn(t,"get_level command needs a skill id as parameter");const n=cr().getSkill(e);return n||dn(t,`Skill ${e} not found`),n.level}),kK=new Ze("get_xp",[{name:"xpKey",type:"string"}],async t=>{const{xpKey:e}=t.options;e||dn(t,"get_xp command needs a skill id as parameter");const n=cr().getSkillXp(e);return n||dn(t,`XP ${e} not found`),n}),wK=new Ze("roll",[{name:"id",type:"string"},{name:"skill",type:"string"},{name:"value",type:"number"},{name:"hideAfterRoll",type:"boolean",optional:!0}],async t=>{const{id:e,skill:n,value:r,hideAfterRoll:o}=t.options;return w8({id:e,skill:n,value:r,hideAfterRoll:o}).succeeded}),jK=new Ze("add_stat",[{name:"statKey",type:"string"},{name:"amountToAdd",type:"number"}],async t=>{const{statKey:e,amountToAdd:n}=t.options;(!e||typeof n!="number")&&dn(t,"add_stat command needs a stat id and a value as parameters"),Wi().addStat(e,n)}),xK=new Ze("set_stat",[{name:"statKey",type:"string"},{name:"value",type:"number"}],async t=>{const{statKey:e,value:n}=t.options;(!e||typeof n!="number")&&dn(t,"set_stat command needs a stat id and a value as parameters"),Wi().setStat(e,n)}),_K=new Ze("get_stat_value",[{name:"statKey",type:"string"}],async t=>{const{statKey:e}=t.options;return e||dn(t,"get_stat_value command needs a stat id as parameter"),Wi().getStatValue(e)}),SK=Ze.FromOptions({keyword:"jump",argTypes:"any",runner:async t=>{(t.args.length<1||typeof t.args[0]!="string")&&dn(t,"requires a label argument");const e=t.args[0],n=fn(),r={branchData:n.script[e],label:e,args:t.args.splice(1),currentIndex:0};return n.jumpTarget=r,await yn().saveGame(),Md}}),CK=Ze.FromOptions({keyword:"run",argTypes:"any",runner:async t=>{(t.args.length<1||typeof t.args[0]!="string")&&dn(t,"run command needs a label to argument run");const e=t.args[0];return await fn().runLabelFunction(e,...t.args.slice(1))}}),$K=Ze.FromOptions({keyword:"var",argTypes:[{name:"name",type:"string"},{name:"value",type:"any"}],runner:async t=>{const{name:e,value:n}=t.options;fn().addScopedVariable(e,n)}}),OK=Ze.FromOptions({keyword:"return",argTypes:[{name:"value",type:"any"}],runner:async t=>{const{value:e}=t.options;return fn().setReturnValue(e),Wg}}),EK=Ze.FromOptions({keyword:"log",argTypes:"any",runner:async t=>{vK(t,...t.args)}}),AK=Ze.FromOptions({keyword:"menu_return",argTypes:[],runner:async t=>(yn().menuReturn(),Id)}),PK=[{name:"mode",type:"string"},{name:"audio",type:"string"},{name:"channel",type:"number",optional:!0}],TK=new Ze("play",PK,async t=>{const e=Or(),{mode:n,audio:r,channel:o}=t.options,i=n0(t,n);i&&e.playChannel(i,r,o!=null?o:0)}),MK=new Ze("pause",[{name:"mode",type:"string"},{name:"channel",type:"number",optional:!0}],async t=>{const e=Or(),{mode:n,channel:r}=t.options,o=n0(t,n);o&&e.pauseChannel(o,r!=null?r:0)}),IK=new Ze("stop",[{name:"mode",type:"string"},{name:"channel",type:"number",optional:!0}],async t=>{const e=Or(),{mode:n,channel:r}=t.options,o=n0(t,n);o&&e.stopChannel(o,r!=null?r:0)});function n0(t,e){return NK(e)?e:(dn(t,`${e} is not a valid audio mode.`),!1)}function NK(t){return!!e8.includes(t)}const LK=new Ze("set",[{name:"key",type:"string"},{name:"value",type:"any"}],async t=>{const e=fu();g8(e,t.options.key,t.options.value)}),DK=new Ze("add",[{name:"key",type:"string"},{name:"value",type:"any"}],async t=>{const e=fu();y8(e,t.options.key,t.options.value)}),RK=new Ze("set_screen",[{name:"screen",type:"string"},{name:"layer",type:"number",optional:!0},{name:"transitionName",type:"string",optional:!0},{name:"transitionDuration",type:"number",optional:!0},{name:"transitionDelay",type:"number",optional:!0}],async t=>{var n;const e=$i();return t.options.transitionName?e.transitionScreen(t.options.screen,{transition:t.options.transitionName,duration:t.options.transitionDuration,delay:t.options.transitionDelay},t.options.layer):e.setScreen(t.options.screen,(n=t.options.layer)!=null?n:0)}),BK=new Ze("empty_layer",[{name:"layer",type:"number"}],async t=>{$i().emptyLayer(t.options.layer)}),zK=new Ze("set_button",[{name:"buttonId",type:"string"},{name:"state",type:"any"}],async t=>{const{buttonId:e,state:n}=t.options;$i().changeButton(e,n)}),VK=Ze.FromOptions({keyword:"talk",argTypes:[{name:"speaker",type:"string"},{name:"pose",type:"string"},{name:"text",type:"string"}],runner:async(t,e)=>{await Yg({speaker:t.options.speaker,pose:t.options.pose,cssClass:"talk-command",text:`"${t.options.text}"`,choices:e,interactive:!0})},returnAfterPlayerAnswer:!0}),FK=Ze.FromOptions({keyword:"think",argTypes:[{name:"speaker",type:"string"},{name:"pose",type:"string"},{name:"text",type:"string"}],runner:async(t,e)=>{await Yg({speaker:t.options.speaker,pose:t.options.pose,cssClass:"think-command",text:`${t.options.text}`,choices:e,interactive:!0})},returnAfterPlayerAnswer:!0}),qK=()=>{const t=Ll("text",[]);return(e,n)=>{const r=t(e,n);return n.command.staticOptions={text:n.code.substring(1,n.code.length-1)},r}},HK=Ze.FromOptions({keyword:"text",argTypes:[],runner:async(t,e)=>{await Yg({speaker:"game",cssClass:"text-command",text:t.staticOptions.text,choices:e,interactive:!0})},parser:qK(),returnAfterPlayerAnswer:!0}),WK=new Ze("add_item",[{name:"id",type:"string"},{name:"amount",type:"number"}],async t=>{const{id:e,amount:n}=t.options;mr().add({id:e,amount:n})}),UK=new Ze("remove_item",[{name:"id",type:"string"},{name:"amount",type:"number"}],async t=>{const{id:e,amount:n}=t.options;mr().remove({id:e,amount:n})}),JK=new Ze("has_item?",[{name:"id",type:"string"},{name:"amount",type:"number",optional:!0}],async t=>{const{id:e,amount:n}=t.options;return mr().hasItem(e,n)}),GK=new Ze("item_amount?",[{name:"id",type:"string"}],async t=>{const{id:e}=t.options;return mr().getItemAmount(e)}),KK=new Ze("enable_interaction",[{name:"tag",type:"string"}],async t=>{const e=t.options.tag;mr().enableInteraction(e)}),QK=new Ze("disable_interaction",[{name:"tag",type:"string"}],async t=>{const e=t.options.tag;mr().disableInteraction(e)}),YK=new Ze("start_quest",[{name:"questId",type:"string"}],async t=>{const e=t.options.questId;Vr().startQuest(e)}),XK=new Ze("start_objective",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async t=>{const{questId:e,objectiveId:n}=t.options;Vr().startObjective(e,n)}),ZK=new Ze("complete_objective",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async t=>{const{questId:e,objectiveId:n}=t.options;Vr().completeObjective(e,n)}),eQ=new Ze("complete_quest",[{name:"questId",type:"string"},{name:"ending",type:"string",optional:!0}],async t=>{const{questId:e,ending:n}=t.options;Vr().completeQuest(e,n)}),tQ=new Ze("quest_completed?",[{name:"questId",type:"string"}],async t=>{const{questId:e}=t.options;return Vr().isQuestCompleted(e)}),nQ=new Ze("objective_completed?",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async t=>{const{questId:e,objectiveId:n}=t.options;return Vr().isObjectiveCompleted(e,n)}),rQ=new Ze("quest_started?",[{name:"questId",type:"string"}],async t=>{const{questId:e}=t.options;return Vr().isQuestStarted(e)}),oQ=new Ze("objective_started?",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async t=>{const{questId:e,objectiveId:n}=t.options;return Vr().isObjectiveStarted(e,n)}),iQ=Ze.FromOptions({keyword:"wait",argTypes:[{name:"duration",type:"number"}],runner:async t=>{await os(t.options.duration)}}),aQ=new Ze("notify",[{name:"text",type:"string"}],async t=>{const{text:e}=t.options;$o().addNotification(e)}),sQ=new Ze("disable_notifications",[],async t=>{$o().disableNotifications()}),uQ=new Ze("enable_notifications",[],async t=>{$o().enableNotifications()}),lQ=new Ze("clear_dialog",[],async t=>{Xr().clearDialog()}),cQ=new Ze("if",[{name:"condition",type:"boolean"}],async t=>{const e=wU(t),n=fn();if(e){const r={branchData:{branch:e},currentIndex:0};return n.addAndRunBlock(r)}},(t,e)=>{let n=t.currentLine;Ll("if",[{name:"condition",type:"string"}])(t,e);const{lines:o,currentLine:i,line:a}=t,s=e.command;let u;const l=jU(o,i+1);return l&&l.code==="else:"&&(u=t.processCommandsFunction(t.parserContext,l.branch,a),n++),s.staticOptions={success:t.processCommandsFunction(t.parserContext,a.branch,a),failure:u},n++,{newLine:n}}),fQ=new Ze("==","any",async t=>{t.args.length<2&&dn(t,"requires at least two arguments");let e=t.args[0],n=!0;for(const r of t.args)if(r!=e){n=!1;break}else e=r;return n}),dQ=new Ze(">",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e>n}),hQ=new Ze("<",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e<n}),pQ=new Ze(">=",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e>=n}),vQ=new Ze("<=",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e<=n}),mQ=new Ze("!=",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e!=n}),gQ=new Ze("!",[{name:"a",type:"any"}],async t=>{const{a:e}=t.options;return!e}),yQ=new Ze("&&","any",async t=>{const e=t.args;return t.args.length<2&&dn(t,"requires at least two arguments"),e.reduce((n,r)=>n&&r,!0)}),bQ=new Ze("||","any",async t=>(t.args.length<2&&dn(t,"requires at least two arguments"),t.args.reduce((e,n)=>e||n,!1))),kQ=new Ze("?",[{name:"a",type:"any"},{name:"b",type:"any"},{name:"c",type:"any"}],async t=>{const{a:e,b:n,c:r}=t.options;return e?n:r}),wQ=new Ze("+","any",async t=>(t.args.length<2&&dn(t,"requires at least two arguments"),t.args.reduce((e,n)=>typeof n=="number"?e+n:(dn(t,"requires all arguments to be numbers"),e),0))),jQ=new Ze("-","any",async t=>(t.args.length<2&&dn(t,"requires at least two arguments"),t.args.slice(1).reduce((e,n)=>typeof n=="number"?e-n:(dn(t,"requires all arguments to be numbers"),e),t.args[0]))),xQ=new Ze("neg",[{name:"a",type:"number"}],async t=>(t.args.length!==1&&dn(t,"requires one argument"),-t.options.a)),_Q=new Ze("abs",[{name:"a",type:"number"}],async t=>(t.args.length!==1&&dn(t,"requires one argument"),Math.abs(t.options.a))),SQ=new Ze("*","any",async t=>(t.args.length<2&&dn(t,"requires at least two arguments"),t.args.reduce((e,n)=>typeof n=="number"?e*n:(dn(t,"requires all arguments to be numbers"),e),1))),CQ=new Ze("/","any",async t=>{t.args.length<2&&dn(t,"requires at least two arguments");const e=t.args[0]/t.args[1];return t.args.slice(2).reduce((n,r)=>typeof r=="number"?n/r:(dn(t,"requires all arguments to be numbers"),n),e)}),$Q=async t=>{const{prompt:e,choices:n}=t.staticOptions,r=[];for(const[,a]of n.entries()){const s=await Xg(a.prompt);r.push(s)}t.options.choiceResults=r;const o=r.map((a,s)=>{var f,c;let u=!0;return a.skillCheck&&(u=(c=(f=a.skillCheck)==null?void 0:f.allowed)!=null?c:!1),{choice:a.text,originalIndex:s,allowed:u}}).filter(a=>a.choice),i=await S8(e,o);return await PQ(t,i)};function OQ(t,e){e.branch||t.parserContext.error(e.line,`Choice option doesn't have any branch to go to (${e.code} - ${e.line})`);let n,r;const o=e.branch;return e.expression[1]==="roll"?((!o[0].branch||!o[1].branch)&&t.parserContext.error(e.line,`Choice option with a skill roll needs success and failure branches (${e.code} - ${e.line})`),n={success:t.processCommandsFunction(t.parserContext,o[0].branch,e),failure:t.processCommandsFunction(t.parserContext,o[1].branch,e)}):r=t.processCommandsFunction(t.parserContext,o,e),{prompt:t.processCommandsFunction(t.parserContext,[e],e)[0],branch:r,skillBranches:n}}const EQ=(t,e)=>{let n=t.currentLine;Ll("choice",[]);const{line:r}=t,o=e.command;(!r.branch||r.branch.length<2)&&t.parserContext.error(r.line,"Choice menu needs to have at least one option");const i=r.branch[0];i||t.parserContext.error(t.line.line,"Choice prompt is missing ");const s=r.branch.slice(1).map((u,l)=>(u.branch||t.parserContext.error(u.line,`Choice option doesn't have any branch to go to (${u.code})`),u=TQ(t.parserContext,u),OQ(t,u)));return o.staticOptions={prompt:t.processCommandsFunction(t.parserContext,[i],r)[0],choices:s},n++,{newLine:n}},AQ=Ze.FromOptions({keyword:"choice",argTypes:[],runner:$Q,parser:EQ}),PQ=async(t,e)=>{const n=e,r=fn(),{choices:o}=t.staticOptions,i=o[n],a=t.options.choiceResults[n];let s=a.text,u;if(a.skillCheck?(s=null,w8({skill:a.skillCheck.skillId,value:a.skillCheck.difficulty,id:a.skillCheck.skillCheckId,hideAfterRoll:a.skillCheck.hideAfterRoll}).succeeded?u=i.skillBranches.success:u=i.skillBranches.failure):u=i.branch,s){const l={speaker:"player",text:s,interactive:!1};Xr().addDialog(l)}if(u){const l={currentIndex:0,branchData:{branch:u}};return await r.addAndRunBlock(l)}};function TQ(t,e){return{code:`choicePrompt ${e.code}`,indentation:e.indentation,line:e.line,branch:e.branch,expression:["choicePrompt",...e.expression]}}const MQ=new Ze("choicePrompt","any",async t=>{const e=t.args;if(e[0]==="roll"){const n=e[1],r=e[2],o=e[3],i=e[4],a=e.length>5?e[5]:!1,s=cr().getSkillCheck(n);if(s.hidden)return{text:null};const u=s.happened&&!s.succeeded,{difficultyText:l}=gU({skill:r,skillCheckId:n,value:o});return{text:`${l} ${i}`,skillCheck:{allowed:!u,skillId:r,skillCheckId:n,difficulty:o,hideAfterRoll:a}}}else if(e.length>1&&e[1]==="if"){const n=e[0];let r=!0;return e.length>2&&(r=e[2]),r?{text:n}:{text:null}}else return{text:e[0]}}),P8=Ze.FromOptions({keyword:"text_field",argTypes:[{name:"prompt",type:"string"}],returnAfterPlayerAnswer:!0,runner:async t=>{const e={speaker:"game",text:t.options.prompt,textField:!0,interactive:!0};Xr().addDialog(e)}});P8.onPlayerAnswered=async(t,e)=>(typeof e!="string"&&dn(t,"The player's answer should be a string"),e);const IQ=Ze.FromOptions({keyword:"text_field_prompt",argTypes:[{name:"prompt",type:"string"}],runner:async t=>{const e={speaker:"game",text:t.options.prompt,textField:!0,interactive:!0};Xr().addDialog(e)}}),NQ=new Ze("random",[{name:"a",type:"number"},{name:"b",type:"number"}],async t=>{const{a:e,b:n}=t.options;return typeof e!="number"||typeof n!="number"?(dn(t,"random command needs two numbers as parameters"),0):Math.floor(Math.random()*(n-e+1))+e}),LQ=new Ze("random_float",[{name:"a",type:"number"},{name:"b",type:"number"}],async t=>{const{a:e,b:n}=t.options;return typeof e!="number"||typeof n!="number"?(dn(t,"random_float command needs two numbers as parameters"),0):Math.random()*(n-e)+e}),DQ=new Ze("random_from_args",[],async t=>{const e=t.args;return!e||!e.length?(dn(t,"random_from_args command needs at least one argument"),0):e[Math.floor(Math.random()*e.length)]}),RQ=new Ze("concat","any",async t=>(t.args.length<2&&dn(t,"requires at least two arguments"),t.args.reduce((e,n)=>typeof n=="string"?`${e}${n}`:(dn(t,"requires all arguments to be strings"),e),""))),BQ=new Ze("join","any",async t=>{const e=t.args[0];return t.args.length<3&&dn(t,"requires at least 3 arguments"),t.args.slice(1).reduce((n,r)=>typeof r=="string"?`${n}${e}${r}`:(dn(t,"requires all arguments to be strings"),n),"")}),zQ=Ze.FromOptions({keyword:"min",argTypes:[{name:"min",type:"number"},{name:"value",type:"number"}],runner:async t=>{const{min:e,value:n}=t.options;return n<e?n:e}}),VQ=Ze.FromOptions({keyword:"max",argTypes:[{name:"max",type:"number"},{name:"value",type:"number"}],runner:async t=>{const{max:e,value:n}=t.options;return n>e?n:e}}),FQ=Ze.FromOptions({keyword:"clamp",argTypes:[{name:"min",type:"number"},{name:"max",type:"number"},{name:"value",type:"number"}],runner:async t=>{const{min:e,max:n,value:r}=t.options;return r<e?e:r>n?n:r}}),qQ=Ze.FromOptions({keyword:"floor",argTypes:[{name:"value",type:"number"}],runner:async t=>{const{value:e}=t.options;return Math.floor(e)}}),HQ=Ze.FromOptions({keyword:"ceil",argTypes:[{name:"value",type:"number"}],runner:async t=>{const{value:e}=t.options;return Math.ceil(e)}}),WQ=Ze.FromOptions({keyword:"round",argTypes:[{name:"value",type:"number"}],runner:async t=>{const{value:e}=t.options;return Math.round(e)}}),UQ=Ze.FromOptions({keyword:"sqrt",argTypes:[{name:"value",type:"number"}],runner:async t=>{const{value:e}=t.options;return Math.sqrt(e)}}),JQ=Ze.FromOptions({keyword:"^",argTypes:[{name:"base",type:"number"},{name:"exponent",type:"number"}],runner:async t=>{const{base:e,exponent:n}=t.options;return Math.pow(e,n)}});function GQ(t){t.addCommand(AQ),t.addCommand(MQ),t.addCommand(cQ),t.addCommand(jK),t.addCommand(xK),t.addCommand(_K),t.addCommand(lQ),t.addCommand(aQ),t.addCommand(sQ),t.addCommand(uQ),t.addCommand(MK),t.addCommand(TK),t.addCommand(IK),t.addCommand(zK),t.addCommand(RK),t.addCommand(BK),t.addCommand(iQ),t.addCommand(fQ),t.addCommand(dQ),t.addCommand(hQ),t.addCommand(pQ),t.addCommand(vQ),t.addCommand(mQ),t.addCommand(gQ),t.addCommand(yQ),t.addCommand(bQ),t.addCommand(kQ),t.addCommand(wQ),t.addCommand(jQ),t.addCommand(SQ),t.addCommand(CQ),t.addCommand(xQ),t.addCommand(_Q),t.addCommand(DK),t.addCommand(LK),t.addCommand(HK),t.addCommand(VK),t.addCommand(FK),t.addCommand(SK),t.addCommand(CK),t.addCommand($K),t.addCommand(OK),t.addCommand(EK),t.addCommand(AK),t.addCommand(YK),t.addCommand(XK),t.addCommand(ZK),t.addCommand(eQ),t.addCommand(rQ),t.addCommand(oQ),t.addCommand(tQ),t.addCommand(nQ),t.addCommand(WK),t.addCommand(UK),t.addCommand(KK),t.addCommand(QK),t.addCommand(JK),t.addCommand(GK),t.addCommand(mK),t.addCommand(gK),t.addCommand(yK),t.addCommand(wK),t.addCommand(bK),t.addCommand(kK),t.addCommand(P8),t.addCommand(IQ),t.addCommand(NQ),t.addCommand(LQ),t.addCommand(DQ),t.addCommand(RQ),t.addCommand(BQ),t.addCommand(zQ),t.addCommand(VQ),t.addCommand(FQ),t.addCommand(qQ),t.addCommand(WQ),t.addCommand(HQ),t.addCommand(UQ),t.addCommand(JQ)}let Dl;ar.callHook("onPageLoaded");async function KQ(t,e){const n=await Ug(t.configPath);oW(JSON.parse(n)),t.baseAssetsPath&&(gt().baseAssetsPath=t.baseAssetsPath),Dl=j.createApp(pK,{config:t,options:e});const r=EW();if(Dl.use(r),yn().setOptions(e),Dl.use(R8,{breakpoints:{s:0,m:800,l:1200}}),GQ(ar),v0.setupDebugger(e.debug),console.log("%c Narrat game engine \u2013 [VI]{version} - {date}[/VI]","background: #222; color: #bada55"),ar.callHook("onNarratSetup"),Dl.mount("#game-holder"),e.debug){const o={app:Dl,vm:ar,jump:i=>{fn().jumpToLabel(i)}};window.narrat=o}}class QQ{onPageLoaded(){}onNarratSetup(){}onAppMounted(){}onAssetsLoaded(){}onGameSetup(){}onGameStart(){}onGameMounted(){}onGameDismounted(){}}function YQ(t){ar.addPlugin(t)}function XQ(t){ar.addCommand(t)}sn.CommandPlugin=Ze,sn.NarratPlugin=QQ,sn.addCommand=XQ,sn.aspectRatioFit=$8,sn.generateParser=Ll,sn.getConfig=gt,sn.registerPlugin=YQ,sn.startApp=KQ,Object.defineProperties(sn,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
185
185
|
//# sourceMappingURL=narrat.umd.js.map
|