narrat 2.1.0 → 2.1.1

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.
@@ -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()})(zr,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,c=function(Ce,De){E[a]=Ce,E[a+1]=De,a+=2,a===2&&(u?u(O):x())};function f(ye){u=ye}function l(ye){c=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),De=document.createTextNode("");return Ce.observe(De,{characterData:!0}),function(){De.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],De=E[ye+1];Ce(De),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 x=void 0;v?x=m():p?x=b():g?x=k():d===void 0&&typeof w8=="function"?x=L():x=w();function T(ye,Ce){var De=this,ge=new this.constructor($);ge[z]===void 0&&se(ge);var Be=De._state;if(Be){var Ke=arguments[Be-1];c(function(){return we(Be,ge,Ke,De._result)})}else U(De,ge,ye,Ce);return ge}function S(ye){var Ce=this;if(ye&&typeof ye=="object"&&ye.constructor===Ce)return ye;var De=new Ce($);return D(De,ye),De}var z=Math.random().toString(36).substring(2);function $(){}var _=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 R(ye,Ce,De,ge){try{ye.call(Ce,De,ge)}catch(Be){return Be}}function I(ye,Ce,De){c(function(ge){var Be=!1,Ke=R(De,Ce,function(gt){Be||(Be=!0,Ce!==gt?D(ge,gt):j(ge,gt))},function(gt){Be||(Be=!0,M(ge,gt))},"Settle: "+(ge._label||" unknown promise"));!Be&&Ke&&(Be=!0,M(ge,Ke))},ye)}function H(ye,Ce){Ce._state===V?j(ye,Ce._result):Ce._state===Q?M(ye,Ce._result):U(Ce,void 0,function(De){return D(ye,De)},function(De){return M(ye,De)})}function F(ye,Ce,De){Ce.constructor===ye.constructor&&De===T&&Ce.constructor.resolve===S?H(ye,Ce):De===void 0?j(ye,Ce):r(De)?I(ye,Ce,De):j(ye,Ce)}function D(ye,Ce){if(ye===Ce)M(ye,B());else if(n(Ce)){var De=void 0;try{De=Ce.then}catch(ge){M(ye,ge);return}F(ye,Ce,De)}else j(ye,Ce)}function A(ye){ye._onerror&&ye._onerror(ye._result),ie(ye)}function j(ye,Ce){ye._state===_&&(ye._result=Ce,ye._state=V,ye._subscribers.length!==0&&c(ie,ye))}function M(ye,Ce){ye._state===_&&(ye._state=Q,ye._result=Ce,c(A,ye))}function U(ye,Ce,De,ge){var Be=ye._subscribers,Ke=Be.length;ye._onerror=null,Be[Ke]=Ce,Be[Ke+V]=De,Be[Ke+Q]=ge,Ke===0&&ye._state&&c(ie,ye)}function ie(ye){var Ce=ye._subscribers,De=ye._state;if(Ce.length!==0){for(var ge=void 0,Be=void 0,Ke=ye._result,gt=0;gt<Ce.length;gt+=3)ge=Ce[gt],Be=Ce[gt+De],ge?we(De,ge,Be,Ke):Be(Ke);ye._subscribers.length=0}}function we(ye,Ce,De,ge){var Be=r(De),Ke=void 0,gt=void 0,nn=!0;if(Be){try{Ke=De(ge)}catch(fn){nn=!1,gt=fn}if(Ce===Ke){M(Ce,K());return}}else Ke=ge;Ce._state!==_||(Be&&nn?D(Ce,Ke):nn===!1?M(Ce,gt):ye===V?j(Ce,Ke):ye===Q&&M(Ce,Ke))}function _e(ye,Ce){try{Ce(function(ge){D(ye,ge)},function(ge){M(ye,ge)})}catch(De){M(ye,De)}}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,De){this._instanceConstructor=Ce,this.promise=new Ce($),this.promise[z]||se(this.promise),i(De)?(this.length=De.length,this._remaining=De.length,this._result=new Array(this.length),this.length===0?j(this.promise,this._result):(this.length=this.length||0,this._enumerate(De),this._remaining===0&&j(this.promise,this._result))):M(this.promise,ae())}return ye.prototype._enumerate=function(De){for(var ge=0;this._state===_&&ge<De.length;ge++)this._eachEntry(De[ge],ge)},ye.prototype._eachEntry=function(De,ge){var Be=this._instanceConstructor,Ke=Be.resolve;if(Ke===S){var gt=void 0,nn=void 0,fn=!1;try{gt=De.then}catch(Z){fn=!0,nn=Z}if(gt===T&&De._state!==_)this._settledAt(De._state,ge,De._result);else if(typeof gt!="function")this._remaining--,this._result[ge]=De;else if(Be===Fe){var Mn=new Be($);fn?M(Mn,nn):F(Mn,De,gt),this._willSettleAt(Mn,ge)}else this._willSettleAt(new Be(function(Z){return Z(De)}),ge)}else this._willSettleAt(Ke(De),ge)},ye.prototype._settledAt=function(De,ge,Be){var Ke=this.promise;Ke._state===_&&(this._remaining--,De===Q?M(Ke,Be):this._result[ge]=Be),this._remaining===0&&j(Ke,this._result)},ye.prototype._willSettleAt=function(De,ge){var Be=this;U(De,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 le(ye){var Ce=this;return i(ye)?new Ce(function(De,ge){for(var Be=ye.length,Ke=0;Ke<Be;Ke++)Ce.resolve(ye[Ke]).then(De,ge)}):new Ce(function(De,ge){return ge(new TypeError("You must pass an array to race."))})}function Y(ye){var Ce=this,De=new Ce($);return M(De,ye),De}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(De){return this.then(null,De)},ye.prototype.finally=function(De){var ge=this,Be=ge.constructor;return r(De)?ge.then(function(Ke){return Be.resolve(De()).then(function(){return Ke})},function(Ke){return Be.resolve(De()).then(function(){throw Ke})}):ge.then(De,De)},ye}();Fe.prototype.then=T,Fe.all=Se,Fe.race=le,Fe.resolve=S,Fe.reject=Y,Fe._setScheduler=f,Fe._setAsap=l,Fe._asap=c;function Ee(){var ye=void 0;if(typeof zr<"u")ye=zr;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 De=null;try{De=Object.prototype.toString.call(Ce.resolve())}catch{}if(De==="[object Promise]"&&!Ce.cast)return}ye.Promise=Fe}return Fe.polyfill=Ee,Fe.Promise=Fe,Fe})})(Gg),Gg.exports.polyfill();const rQ="",Kg=C.ref([]),Qg=C.ref(null),Yg=C.ref(null),Xg=C.ref(null),Kr=C.reactive({current:""}),Ld=[],j8=C.ref(!1),Rd=C.readonly(Kg),x8=C.readonly(Qg),_8=C.readonly(Yg),S8=C.readonly(Xg),C8=C.readonly(Kr),Zg=(t=x8.value)=>{Kr.current=t;const e=Rd.value.findIndex(r=>r.name===t),n=Rd.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";Kr[o]=e<=r,Kr[i]=e>=r}Kr[n[r]]=n[r]===t}},e0=(t=_8.value)=>{Kr.orientation=t,Kr.isLandscape=t==="landscape",Kr.isPortrait=t==="portrait"},t0=(t=S8.value||"light")=>{Kr.theme=t,Kr.isDark=t==="dark",Kr.isLight=t==="light"};function Dd(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;{j8.value=!0;const n=window.matchMedia(t),r=({matches:o})=>{o&&e()};Ld.push({mql:n,cb:r}),n.addEventListener&&typeof n.addEventListener=="function"?n.addEventListener("change",r):n.addListener(r),r(n)}}var Bd=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 n0=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 r0({breakpoints:t,preset:e}){const n=(a=>{if(typeof a=="string"&&Bd[a])return Bd[a];{const s=Object.keys(Bd);return console.error(`Vue3 Mq: "${a}" is not a valid preset. Available options are: ${s.join(", ")}`),!1}})(e),r=n0(t);if(n===!1&&!r)throw new TypeError("Vue3 Mq: You must provide a valid preset, or valid breakpoint settings.");var o;o=r||n0(n),Kg.value=o,function(){for(;Ld.length>0;){const a=Ld.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(Kr);for(let s of a)delete Kr[s];Zg(),e0(),t0()})();const i=Rd.value.reduce((a,s,u,c)=>{const f=`(min-width: ${s.min}px)`,l=u<c.length-1?`(max-width: ${c[u+1].min-1}px)`:null,d=f+(l?" and "+l:"");return Object.assign(a,{[s.name]:d})},{});for(const a in i)Dd(i[a],()=>{Zg(a)});["portrait","landscape"].forEach(a=>{Dd(`(orientation: ${a})`,()=>{e0(a)})}),["light","dark"].forEach(a=>{Dd(`(prefers-color-scheme: ${a})`,()=>{t0(a)})})}var $8={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,c=((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,Qg.value=a,(f=>{Yg.value=f})(u),(f=>{Xg.value=f})(c),t.provide("mq",C8),t.provide("updateBreakpoints",r0),r0({breakpoints:n,preset:e})}catch(u){console.error(u)}var a,s}};class o0{constructor(){Yo(this,"debug");Yo(this,"logger",{log:()=>{}})}setupDebugger(e){this.debug=e,e&&(this.logger.log=console.log.bind(window.console))}}const i0=new o0,Oo=i0.logger;function zd(t,e){return Date.now()-t+e}function a0(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 oQ="",Vr=(t,e)=>{const n=t.__vccOpts||t;for(const[r,o]of e)n[r]=o;return n},O8=C.defineComponent({props:{containerCssClass:String}}),A8={class:"modal-header"},E8=C.createTextVNode(" default header "),P8=C.createElementVNode("hr",{class:"solid"},null,-1),T8={class:"modal-body"},M8=C.createTextVNode(" default body "),I8={class:"modal-footer"};function N8(t,e,n,r,o,i){return C.openBlock(),C.createBlock(C.Transition,{name:"modal"},{default:C.withCtx(()=>[C.createElementVNode("div",{class:"modal-mask",onClick:e[2]||(e[2]=a=>t.$emit("close"))},[C.createElementVNode("div",{class:C.normalizeClass(["modal-container bg-gray-800 card-4",t.containerCssClass]),onClick:e[1]||(e[1]=a=>a.stopPropagation())},[C.createElementVNode("div",A8,[C.createElementVNode("button",{class:"close-button",onClick:e[0]||(e[0]=a=>t.$emit("close"))},"X"),C.renderSlot(t.$slots,"header",{},()=>[E8]),P8]),C.createElementVNode("div",T8,[C.renderSlot(t.$slots,"body",{},()=>[M8])]),C.createElementVNode("div",I8,[C.renderSlot(t.$slots,"footer")])],2)])]),_:3})}const fu=Vr(O8,[["render",N8]]);function $i(t){return Array.isArray?Array.isArray(t):c0(t)==="[object Array]"}const L8=1/0;function R8(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-L8?"-0":e}function D8(t){return t==null?"":R8(t)}function Xo(t){return typeof t=="string"}function s0(t){return typeof t=="number"}function B8(t){return t===!0||t===!1||z8(t)&&c0(t)=="[object Boolean]"}function u0(t){return typeof t=="object"}function z8(t){return u0(t)&&t!==null}function Qr(t){return t!=null}function Vd(t){return!t.trim().length}function c0(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const iQ="Extended search is not available",V8="Incorrect 'index' type",F8=t=>`Invalid value for key ${t}`,q8=t=>`Pattern length exceeds max of ${t}.`,H8=t=>`Missing ${t} property in key`,W8=t=>`Property 'weight' in key '${t}' must be a positive integer`,l0=Object.prototype.hasOwnProperty;class U8{constructor(e){this._keys=[],this._keyMap={};let n=0;e.forEach(r=>{let o=f0(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 f0(t){let e=null,n=null,r=null,o=1,i=null;if(Xo(t)||$i(t))r=t,e=d0(t),n=Fd(t);else{if(!l0.call(t,"name"))throw new Error(H8("name"));const a=t.name;if(r=a,l0.call(t,"weight")&&(o=t.weight,o<=0))throw new Error(W8(a));e=d0(a),n=Fd(a),i=t.getFn}return{path:e,id:n,weight:o,src:r,getFn:i}}function d0(t){return $i(t)?t:t.split(".")}function Fd(t){return $i(t)?t.join("."):t}function J8(t,e){let n=[],r=!1;const o=(i,a,s)=>{if(!!Qr(i))if(!a[s])n.push(i);else{let u=a[s];const c=i[u];if(!Qr(c))return;if(s===a.length-1&&(Xo(c)||s0(c)||B8(c)))n.push(D8(c));else if($i(c)){r=!0;for(let f=0,l=c.length;f<l;f+=1)o(c[f],a,s+1)}else a.length&&o(c,a,s+1)}};return o(t,Xo(e)?e.split("."):e,0),r?n:n[0]}var Lt={...{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:J8,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const G8=/[^ ]+/g;function K8(t=1,e=3){const n=new Map,r=Math.pow(10,e);return{get(o){const i=o.match(G8).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 qd{constructor({getFn:e=Lt.getFn,fieldNormWeight:n=Lt.fieldNormWeight}={}){this.norm=K8(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,Xo(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();Xo(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(!Qr(e)||Vd(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(!!Qr(a)){if($i(a)){let s=[];const u=[{nestedArrIndex:-1,value:a}];for(;u.length;){const{nestedArrIndex:c,value:f}=u.pop();if(!!Qr(f))if(Xo(f)&&!Vd(f)){let l={v:f,i:c,n:this.norm.get(f)};s.push(l)}else $i(f)&&f.forEach((l,d)=>{u.push({nestedArrIndex:d,value:l})})}r.$[i]=s}else if(Xo(a)&&!Vd(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 h0(t,e,{getFn:n=Lt.getFn,fieldNormWeight:r=Lt.fieldNormWeight}={}){const o=new qd({getFn:n,fieldNormWeight:r});return o.setKeys(t.map(f0)),o.setSources(e),o.create(),o}function Q8(t,{getFn:e=Lt.getFn,fieldNormWeight:n=Lt.fieldNormWeight}={}){const{keys:r,records:o}=t,i=new qd({getFn:e,fieldNormWeight:n});return i.setKeys(r),i.setIndexRecords(o),i}function zc(t,{errors:e=0,currentLocation:n=0,expectedLocation:r=0,distance:o=Lt.distance,ignoreLocation:i=Lt.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 Y8(t=[],e=Lt.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 Ca=32;function X8(t,e,n,{location:r=Lt.location,distance:o=Lt.distance,threshold:i=Lt.threshold,findAllMatches:a=Lt.findAllMatches,minMatchCharLength:s=Lt.minMatchCharLength,includeMatches:u=Lt.includeMatches,ignoreLocation:c=Lt.ignoreLocation}={}){if(e.length>Ca)throw new Error(q8(Ca));const f=e.length,l=t.length,d=Math.max(0,Math.min(r,l));let h=i,p=d;const v=s>1||u,g=v?Array(l):[];let m;for(;(m=t.indexOf(e,p))>-1;){let O=zc(e,{currentLocation:m,expectedLocation:d,distance:o,ignoreLocation:c});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+l;const w=1<<f-1;for(let O=0;O<f;O+=1){let L=0,x=k;for(;L<x;)zc(e,{errors:O,currentLocation:d+x,expectedLocation:d,distance:o,ignoreLocation:c})<=h?L=x:k=x,x=Math.floor((k-L)/2+L);k=x;let T=Math.max(1,d-x+1),S=a?l:Math.min(d+x,l)+f,z=Array(S+2);z[S+1]=(1<<O)-1;for(let _=S;_>=T;_-=1){let V=_-1,Q=n[t.charAt(V)];if(v&&(g[V]=+!!Q),z[_]=(z[_+1]<<1|1)&Q,O&&(z[_]|=(y[_+1]|y[_])<<1|1|y[_+1]),z[_]&w&&(b=zc(e,{errors:O,currentLocation:V,expectedLocation:d,distance:o,ignoreLocation:c}),b<=h)){if(h=b,p=V,p<=d)break;T=Math.max(1,2*d-p)}}if(zc(e,{errors:O+1,currentLocation:d,expectedLocation:d,distance:o,ignoreLocation:c})>h)break;y=z}const E={isMatch:p>=0,score:Math.max(.001,b)};if(v){const O=Y8(g,s);O.length?u&&(E.indices=O):E.isMatch=!1}return E}function Z8(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 p0{constructor(e,{location:n=Lt.location,threshold:r=Lt.threshold,distance:o=Lt.distance,includeMatches:i=Lt.includeMatches,findAllMatches:a=Lt.findAllMatches,minMatchCharLength:s=Lt.minMatchCharLength,isCaseSensitive:u=Lt.isCaseSensitive,ignoreLocation:c=Lt.ignoreLocation}={}){if(this.options={location:n,threshold:r,distance:o,includeMatches:i,findAllMatches:a,minMatchCharLength:s,isCaseSensitive:u,ignoreLocation:c},this.pattern=u?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const f=(d,h)=>{this.chunks.push({pattern:d,alphabet:Z8(d),startIndex:h})},l=this.pattern.length;if(l>Ca){let d=0;const h=l%Ca,p=l-h;for(;d<p;)f(this.pattern.substr(d,Ca),d),d+=Ca;if(h){const v=l-Ca;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:c}=this.options;let f=[],l=0,d=!1;this.chunks.forEach(({pattern:p,alphabet:v,startIndex:g})=>{const{isMatch:m,score:y,indices:b}=X8(e,p,v,{location:o+g,distance:i,threshold:a,findAllMatches:s,minMatchCharLength:u,includeMatches:r,ignoreLocation:c});m&&(d=!0),l+=y,m&&b&&(f=[...f,...b])});let h={isMatch:d,score:d?l/this.chunks.length:1};return d&&r&&(h.indices=f),h}}class Ui{constructor(e){this.pattern=e}static isMultiMatch(e){return v0(e,this.multiRegex)}static isSingleMatch(e){return v0(e,this.singleRegex)}search(){}}function v0(t,e){const n=t.match(e);return n?n[1]:null}class eP extends Ui{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 tP extends Ui{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 nP extends Ui{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 rP extends Ui{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 oP extends Ui{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 iP extends Ui{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 m0 extends Ui{constructor(e,{location:n=Lt.location,threshold:r=Lt.threshold,distance:o=Lt.distance,includeMatches:i=Lt.includeMatches,findAllMatches:a=Lt.findAllMatches,minMatchCharLength:s=Lt.minMatchCharLength,isCaseSensitive:u=Lt.isCaseSensitive,ignoreLocation:c=Lt.ignoreLocation}={}){super(e),this._bitapSearch=new p0(e,{location:n,threshold:r,distance:o,includeMatches:i,findAllMatches:a,minMatchCharLength:s,isCaseSensitive:u,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class g0 extends Ui{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 Hd=[eP,g0,nP,rP,iP,oP,tP,m0],y0=Hd.length,aP=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,sP="|";function uP(t,e={}){return t.split(sP).map(n=>{let r=n.trim().split(aP).filter(i=>i&&!!i.trim()),o=[];for(let i=0,a=r.length;i<a;i+=1){const s=r[i];let u=!1,c=-1;for(;!u&&++c<y0;){const f=Hd[c];let l=f.isMultiMatch(s);l&&(o.push(new f(l,e)),u=!0)}if(!u)for(c=-1;++c<y0;){const f=Hd[c];let l=f.isSingleMatch(s);if(l){o.push(new f(l,e));break}}}return o})}const cP=new Set([m0.type,g0.type]);class lP{constructor(e,{isCaseSensitive:n=Lt.isCaseSensitive,includeMatches:r=Lt.includeMatches,minMatchCharLength:o=Lt.minMatchCharLength,ignoreLocation:i=Lt.ignoreLocation,findAllMatches:a=Lt.findAllMatches,location:s=Lt.location,threshold:u=Lt.threshold,distance:c=Lt.distance}={}){this.query=null,this.options={isCaseSensitive:n,includeMatches:r,minMatchCharLength:o,findAllMatches:a,ignoreLocation:i,location:s,threshold:u,distance:c},this.pattern=n?e:e.toLowerCase(),this.query=uP(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,c=n.length;u<c;u+=1){const f=n[u];a.length=0,i=0;for(let l=0,d=f.length;l<d;l+=1){const h=f[l],{isMatch:p,indices:v,score:g}=h.search(e);if(p){if(i+=1,s+=g,r){const m=h.constructor.type;cP.has(m)?a=[...a,...v]:a.push(v)}}else{s=0,i=0,a.length=0;break}}if(i){let l={isMatch:!0,score:s/i};return r&&(l.indices=a),l}}return{isMatch:!1,score:1}}}const Wd=[];function fP(...t){Wd.push(...t)}function Ud(t,e){for(let n=0,r=Wd.length;n<r;n+=1){let o=Wd[n];if(o.condition(t,e))return new o(t,e)}return new p0(t,e)}const Vc={AND:"$and",OR:"$or"},Jd={PATH:"$path",PATTERN:"$val"},Gd=t=>!!(t[Vc.AND]||t[Vc.OR]),dP=t=>!!t[Jd.PATH],hP=t=>!$i(t)&&u0(t)&&!Gd(t),b0=t=>({[Vc.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function k0(t,e,{auto:n=!0}={}){const r=o=>{let i=Object.keys(o);const a=dP(o);if(!a&&i.length>1&&!Gd(o))return r(b0(o));if(hP(o)){const u=a?o[Jd.PATH]:i[0],c=a?o[Jd.PATTERN]:o[u];if(!Xo(c))throw new Error(F8(u));const f={keyId:Fd(u),pattern:c};return n&&(f.searcher=Ud(c,e)),f}let s={children:[],operator:i[0]};return i.forEach(u=>{const c=o[u];$i(c)&&c.forEach(f=>{s.children.push(r(f))})}),s};return Gd(t)||(t=b0(t)),r(t)}function pP(t,{ignoreFieldNorm:e=Lt.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 vP(t,e){const n=t.matches;e.matches=[],Qr(n)&&n.forEach(r=>{if(!Qr(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 mP(t,e){e.score=t.score}function gP(t,e,{includeMatches:n=Lt.includeMatches,includeScore:r=Lt.includeScore}={}){const o=[];return n&&o.push(vP),r&&o.push(mP),t.map(i=>{const{idx:a}=i,s={item:e[a],refIndex:a};return o.length&&o.forEach(u=>{u(i,s)}),s})}class fs{constructor(e,n={},r){this.options={...Lt,...n},this.options.useExtendedSearch,this._keyStore=new U8(this.options.keys),this.setCollection(e,r)}setCollection(e,n){if(this._docs=e,n&&!(n instanceof qd))throw new Error(V8);this._myIndex=n||h0(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){!Qr(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=Xo(e)?Xo(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return pP(u,{ignoreFieldNorm:s}),i&&u.sort(a),s0(n)&&n>-1&&(u=u.slice(0,n)),gP(u,this._docs,{includeMatches:r,includeScore:o})}_searchStringList(e){const n=Ud(e,this.options),{records:r}=this._myIndex,o=[];return r.forEach(({v:i,i:a,n:s})=>{if(!Qr(i))return;const{isMatch:u,score:c,indices:f}=n.searchIn(i);u&&o.push({item:i,idx:a,matches:[{score:c,value:i,norm:s,indices:f}]})}),o}_searchLogical(e){const n=k0(e,this.options),r=(s,u,c)=>{if(!s.children){const{keyId:l,searcher:d}=s,h=this._findMatches({key:this._keyStore.get(l),value:this._myIndex.getValueForItemAtKeyId(u,l),searcher:d});return h&&h.length?[{idx:c,item:u,matches:h}]:[]}const f=[];for(let l=0,d=s.children.length;l<d;l+=1){const h=s.children[l],p=r(h,u,c);if(p.length)f.push(...p);else if(s.operator===Vc.AND)return[]}return f},o=this._myIndex.records,i={},a=[];return o.forEach(({$:s,i:u})=>{if(Qr(s)){let c=r(n,s,u);c.length&&(i[u]||(i[u]={idx:u,item:s,matches:[]},a.push(i[u])),c.forEach(({matches:f})=>{i[u].matches.push(...f)}))}}),a}_searchObjectList(e){const n=Ud(e,this.options),{keys:r,records:o}=this._myIndex,i=[];return o.forEach(({$:a,i:s})=>{if(!Qr(a))return;let u=[];r.forEach((c,f)=>{u.push(...this._findMatches({key:c,value:a[f],searcher:n}))}),u.length&&i.push({idx:s,item:a,matches:u})}),i}_findMatches({key:e,value:n,searcher:r}){if(!Qr(n))return[];let o=[];if($i(n))n.forEach(({v:i,i:a,n:s})=>{if(!Qr(i))return;const{isMatch:u,score:c,indices:f}=r.searchIn(i);u&&o.push({score:c,key:e,value:i,idx:a,norm:s,indices:f})});else{const{v:i,n:a}=n,{isMatch:s,score:u,indices:c}=r.searchIn(i);s&&o.push({score:u,key:e,value:i,norm:a,indices:c})}return o}}fs.version="6.6.2",fs.createIndex=h0,fs.parseIndex=Q8,fs.config=Lt,fs.parseQuery=k0,fP(lP);var w0,j0,x0,_0,S0,C0,$0,O0,A0,E0,P0,T0,M0,I0,N0,L0,R0,D0,B0,z0,V0,F0,q0,H0,W0,U0,J0,G0,K0,Q0,Y0,X0,Z0,ey,ty,ny,ry,oy,iy,ay,sy,uy,cy,ly,fy,dy,hy,py,vy,my,gy,yy,by,ky,wy,jy,xy,_y,Sy,Cy,$y,Oy,Ay,Ey,Py,Ty,My,Iy,Ny,Ly,Ry,Dy,By,zy,Vy,Fy,qy,Hy,Wy,Uy,Jy,Gy,Ky,Qy,Yy,Xy,Zy,e1,t1,n1,r1,o1,i1,a1,s1,u1,c1,l1,f1,d1,h1,p1,v1,m1,g1,y1,b1,k1,w1,j1,x1,_1,S1,C1,$1,O1,A1,E1,P1,T1,M1,I1,N1,L1,R1,D1,B1,z1,V1,F1,q1,H1,W1,U1,J1,G1,K1,Q1,Y1,X1,Z1,eb,tb,nb,rb,ob,ib,ab,sb,ub,cb,lb,fb,db,hb,pb,vb,mb,gb,yb,bb,kb,wb,jb,xb,_b,Sb,Cb,$b,Ob,Ab,Eb,Pb,Tb,Mb,Ib,Nb,Lb,Rb,Db,Bb,zb,Vb,Fb,qb,Hb,Wb,Ub,Jb,Gb,Kb,Qb,Yb,Xb,Zb,ek,tk,nk,rk,ok,ik,ak,sk,uk,ck,lk,fk,dk,hk,pk,vk,mk,gk,yk,bk,kk,wk,jk,xk,_k,Sk,Ck,$k,Ok,Ak,Ek,Pk,Tk,Mk,Ik,Nk,Lk,Rk,Dk,Bk,zk,Vk,Fk,qk,Hk,Wk,Uk,Jk,Gk,Kk,Qk,Yk,Xk,Zk,ew,tw,nw,rw,ow,iw,aw,sw,uw,cw,lw,fw,dw,hw,pw,vw,mw,gw,yw,bw,kw,ww,jw,xw,_w,Sw,Cw,$w,Ow,Aw,Ew,Pw,Tw;function Fc(t){var e=typeof Map=="function"?new Map:void 0;return(Fc=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 Mw(n,arguments,Kt(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),qc(o,n)})(t)}function Mw(t,e,n){return(Mw=Lw()?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&&qc(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,S,z){return Object.defineProperty(T,S,{value:z,enumerable:!0,configurable:!0,writable:!0}),T[S]}try{s({},"")}catch{s=function(S,z,$){return S[z]=$}}function u(T,S,z,$){var _=S&&S.prototype instanceof l?S:l,V=Object.create(_.prototype),Q=new O($||[]);return V._invoke=function(B,K,R){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 x()}for(R.method=H,R.arg=F;;){var D=R.delegate;if(D){var A=k(D,R);if(A){if(A===f)continue;return A}}if(R.method==="next")R.sent=R._sent=R.arg;else if(R.method==="throw"){if(I==="suspendedStart")throw I="completed",R.arg;R.dispatchException(R.arg)}else R.method==="return"&&R.abrupt("return",R.arg);I="executing";var j=c(B,K,R);if(j.type==="normal"){if(I=R.done?"completed":"suspendedYield",j.arg===f)continue;return{value:j.arg,done:R.done}}j.type==="throw"&&(I="completed",R.method="throw",R.arg=j.arg)}}}(T,z,Q),V}function c(T,S,z){try{return{type:"normal",arg:T.call(S,z)}}catch($){return{type:"throw",arg:$}}}t.wrap=u;var f={};function l(){}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=l.prototype=Object.create(p);function y(T){["next","throw","return"].forEach(function(S){s(T,S,function(z){return this._invoke(S,z)})})}function b(T,S){function z(_,V,Q,B){var K=c(T[_],T,V);if(K.type!=="throw"){var R=K.arg,I=R.value;return I&&it(I)=="object"&&n.call(I,"__await")?S.resolve(I.__await).then(function(H){z("next",H,Q,B)},function(H){z("throw",H,Q,B)}):S.resolve(I).then(function(H){R.value=H,Q(R)},function(H){return z("throw",H,Q,B)})}B(K.arg)}var $;this._invoke=function(_,V){function Q(){return new S(function(B,K){z(_,V,B,K)})}return $=$?$.then(Q,Q):Q()}}function k(T,S){var z=T.iterator[S.method];if(z===void 0){if(S.delegate=null,S.method==="throw"){if(T.iterator.return&&(S.method="return",S.arg=void 0,k(T,S),S.method==="throw"))return f;S.method="throw",S.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var $=c(z,T.iterator,S.arg);if($.type==="throw")return S.method="throw",S.arg=$.arg,S.delegate=null,f;var _=$.arg;return _?_.done?(S[T.resultName]=_.value,S.next=T.nextLoc,S.method!=="return"&&(S.method="next",S.arg=void 0),S.delegate=null,f):_:(S.method="throw",S.arg=new TypeError("iterator result is not an object"),S.delegate=null,f)}function w(T){var S={tryLoc:T[0]};1 in T&&(S.catchLoc=T[1]),2 in T&&(S.finallyLoc=T[2],S.afterLoc=T[3]),this.tryEntries.push(S)}function E(T){var S=T.completion||{};S.type="normal",delete S.arg,T.completion=S}function O(T){this.tryEntries=[{tryLoc:"root"}],T.forEach(w,this),this.reset(!0)}function L(T){if(T){var S=T[o];if(S)return S.call(T);if(typeof T.next=="function")return T;if(!isNaN(T.length)){var z=-1,$=function _(){for(;++z<T.length;)if(n.call(T,z))return _.value=T[z],_.done=!1,_;return _.value=void 0,_.done=!0,_};return $.next=$}}return{next:x}}function x(){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 S=typeof T=="function"&&T.constructor;return!!S&&(S===d||(S.displayName||S.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,S,z,$,_){_===void 0&&(_=Promise);var V=new b(u(T,S,z,$),_);return t.isGeneratorFunction(S)?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 S=[];for(var z in T)S.push(z);return S.reverse(),function $(){for(;S.length;){var _=S.pop();if(_ in T)return $.value=_,$.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 S in this)S.charAt(0)==="t"&&n.call(this,S)&&!isNaN(+S.slice(1))&&(this[S]=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 S=this;function z(K,R){return V.type="throw",V.arg=T,S.next=K,R&&(S.method="next",S.arg=void 0),!!R}for(var $=this.tryEntries.length-1;$>=0;--$){var _=this.tryEntries[$],V=_.completion;if(_.tryLoc==="root")return z("end");if(_.tryLoc<=this.prev){var Q=n.call(_,"catchLoc"),B=n.call(_,"finallyLoc");if(Q&&B){if(this.prev<_.catchLoc)return z(_.catchLoc,!0);if(this.prev<_.finallyLoc)return z(_.finallyLoc)}else if(Q){if(this.prev<_.catchLoc)return z(_.catchLoc,!0)}else{if(!B)throw new Error("try statement without catch or finally");if(this.prev<_.finallyLoc)return z(_.finallyLoc)}}}},abrupt:function(T,S){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 _=$;break}}_&&(T==="break"||T==="continue")&&_.tryLoc<=S&&S<=_.finallyLoc&&(_=null);var V=_?_.completion:{};return V.type=T,V.arg=S,_?(this.method="next",this.next=_.finallyLoc,f):this.complete(V)},complete:function(T,S){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"&&S&&(this.next=S),f},finish:function(T){for(var S=this.tryEntries.length-1;S>=0;--S){var z=this.tryEntries[S];if(z.finallyLoc===T)return this.complete(z.completion,z.afterLoc),E(z),f}},catch:function(T){for(var S=this.tryEntries.length-1;S>=0;--S){var z=this.tryEntries[S];if(z.tryLoc===T){var $=z.completion;if($.type==="throw"){var _=$.arg;E(z)}return _}}throw new Error("illegal catch attempt")},delegateYield:function(T,S,z){return this.delegate={iterator:L(T),resultName:S,nextLoc:z},this.method==="next"&&(this.arg=void 0),f}},t}function Iw(t,e,n,r,o,i,a){try{var s=t[i](a),u=s.value}catch(c){return void n(c)}s.done?e(u):Promise.resolve(u).then(r,o)}function xn(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(u){Iw(i,r,o,a,s,"next",u)}function s(u){Iw(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=Kd(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()})(zr,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,c=function(Ce,De){E[a]=Ce,E[a+1]=De,a+=2,a===2&&(u?u(O):x())};function f(ye){u=ye}function l(ye){c=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),De=document.createTextNode("");return Ce.observe(De,{characterData:!0}),function(){De.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],De=E[ye+1];Ce(De),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 x=void 0;v?x=m():p?x=b():g?x=k():d===void 0&&typeof w8=="function"?x=L():x=w();function T(ye,Ce){var De=this,ge=new this.constructor($);ge[z]===void 0&&se(ge);var Be=De._state;if(Be){var Ke=arguments[Be-1];c(function(){return we(Be,ge,Ke,De._result)})}else U(De,ge,ye,Ce);return ge}function S(ye){var Ce=this;if(ye&&typeof ye=="object"&&ye.constructor===Ce)return ye;var De=new Ce($);return D(De,ye),De}var z=Math.random().toString(36).substring(2);function $(){}var _=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 R(ye,Ce,De,ge){try{ye.call(Ce,De,ge)}catch(Be){return Be}}function I(ye,Ce,De){c(function(ge){var Be=!1,Ke=R(De,Ce,function(gt){Be||(Be=!0,Ce!==gt?D(ge,gt):j(ge,gt))},function(gt){Be||(Be=!0,M(ge,gt))},"Settle: "+(ge._label||" unknown promise"));!Be&&Ke&&(Be=!0,M(ge,Ke))},ye)}function H(ye,Ce){Ce._state===V?j(ye,Ce._result):Ce._state===Q?M(ye,Ce._result):U(Ce,void 0,function(De){return D(ye,De)},function(De){return M(ye,De)})}function F(ye,Ce,De){Ce.constructor===ye.constructor&&De===T&&Ce.constructor.resolve===S?H(ye,Ce):De===void 0?j(ye,Ce):r(De)?I(ye,Ce,De):j(ye,Ce)}function D(ye,Ce){if(ye===Ce)M(ye,B());else if(n(Ce)){var De=void 0;try{De=Ce.then}catch(ge){M(ye,ge);return}F(ye,Ce,De)}else j(ye,Ce)}function A(ye){ye._onerror&&ye._onerror(ye._result),ie(ye)}function j(ye,Ce){ye._state===_&&(ye._result=Ce,ye._state=V,ye._subscribers.length!==0&&c(ie,ye))}function M(ye,Ce){ye._state===_&&(ye._state=Q,ye._result=Ce,c(A,ye))}function U(ye,Ce,De,ge){var Be=ye._subscribers,Ke=Be.length;ye._onerror=null,Be[Ke]=Ce,Be[Ke+V]=De,Be[Ke+Q]=ge,Ke===0&&ye._state&&c(ie,ye)}function ie(ye){var Ce=ye._subscribers,De=ye._state;if(Ce.length!==0){for(var ge=void 0,Be=void 0,Ke=ye._result,gt=0;gt<Ce.length;gt+=3)ge=Ce[gt],Be=Ce[gt+De],ge?we(De,ge,Be,Ke):Be(Ke);ye._subscribers.length=0}}function we(ye,Ce,De,ge){var Be=r(De),Ke=void 0,gt=void 0,nn=!0;if(Be){try{Ke=De(ge)}catch(fn){nn=!1,gt=fn}if(Ce===Ke){M(Ce,K());return}}else Ke=ge;Ce._state!==_||(Be&&nn?D(Ce,Ke):nn===!1?M(Ce,gt):ye===V?j(Ce,Ke):ye===Q&&M(Ce,Ke))}function _e(ye,Ce){try{Ce(function(ge){D(ye,ge)},function(ge){M(ye,ge)})}catch(De){M(ye,De)}}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,De){this._instanceConstructor=Ce,this.promise=new Ce($),this.promise[z]||se(this.promise),i(De)?(this.length=De.length,this._remaining=De.length,this._result=new Array(this.length),this.length===0?j(this.promise,this._result):(this.length=this.length||0,this._enumerate(De),this._remaining===0&&j(this.promise,this._result))):M(this.promise,ae())}return ye.prototype._enumerate=function(De){for(var ge=0;this._state===_&&ge<De.length;ge++)this._eachEntry(De[ge],ge)},ye.prototype._eachEntry=function(De,ge){var Be=this._instanceConstructor,Ke=Be.resolve;if(Ke===S){var gt=void 0,nn=void 0,fn=!1;try{gt=De.then}catch(Z){fn=!0,nn=Z}if(gt===T&&De._state!==_)this._settledAt(De._state,ge,De._result);else if(typeof gt!="function")this._remaining--,this._result[ge]=De;else if(Be===Fe){var Mn=new Be($);fn?M(Mn,nn):F(Mn,De,gt),this._willSettleAt(Mn,ge)}else this._willSettleAt(new Be(function(Z){return Z(De)}),ge)}else this._willSettleAt(Ke(De),ge)},ye.prototype._settledAt=function(De,ge,Be){var Ke=this.promise;Ke._state===_&&(this._remaining--,De===Q?M(Ke,Be):this._result[ge]=Be),this._remaining===0&&j(Ke,this._result)},ye.prototype._willSettleAt=function(De,ge){var Be=this;U(De,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 le(ye){var Ce=this;return i(ye)?new Ce(function(De,ge){for(var Be=ye.length,Ke=0;Ke<Be;Ke++)Ce.resolve(ye[Ke]).then(De,ge)}):new Ce(function(De,ge){return ge(new TypeError("You must pass an array to race."))})}function Y(ye){var Ce=this,De=new Ce($);return M(De,ye),De}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(De){return this.then(null,De)},ye.prototype.finally=function(De){var ge=this,Be=ge.constructor;return r(De)?ge.then(function(Ke){return Be.resolve(De()).then(function(){return Ke})},function(Ke){return Be.resolve(De()).then(function(){throw Ke})}):ge.then(De,De)},ye}();Fe.prototype.then=T,Fe.all=Se,Fe.race=le,Fe.resolve=S,Fe.reject=Y,Fe._setScheduler=f,Fe._setAsap=l,Fe._asap=c;function Ee(){var ye=void 0;if(typeof zr<"u")ye=zr;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 De=null;try{De=Object.prototype.toString.call(Ce.resolve())}catch{}if(De==="[object Promise]"&&!Ce.cast)return}ye.Promise=Fe}return Fe.polyfill=Ee,Fe.Promise=Fe,Fe})})(Gg),Gg.exports.polyfill();const rQ="",Kg=C.ref([]),Qg=C.ref(null),Yg=C.ref(null),Xg=C.ref(null),Kr=C.reactive({current:""}),Ld=[],j8=C.ref(!1),Rd=C.readonly(Kg),x8=C.readonly(Qg),_8=C.readonly(Yg),S8=C.readonly(Xg),C8=C.readonly(Kr),Zg=(t=x8.value)=>{Kr.current=t;const e=Rd.value.findIndex(r=>r.name===t),n=Rd.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";Kr[o]=e<=r,Kr[i]=e>=r}Kr[n[r]]=n[r]===t}},e0=(t=_8.value)=>{Kr.orientation=t,Kr.isLandscape=t==="landscape",Kr.isPortrait=t==="portrait"},t0=(t=S8.value||"light")=>{Kr.theme=t,Kr.isDark=t==="dark",Kr.isLight=t==="light"};function Dd(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;{j8.value=!0;const n=window.matchMedia(t),r=({matches:o})=>{o&&e()};Ld.push({mql:n,cb:r}),n.addEventListener&&typeof n.addEventListener=="function"?n.addEventListener("change",r):n.addListener(r),r(n)}}var Bd=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 n0=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 r0({breakpoints:t,preset:e}){const n=(a=>{if(typeof a=="string"&&Bd[a])return Bd[a];{const s=Object.keys(Bd);return console.error(`Vue3 Mq: "${a}" is not a valid preset. Available options are: ${s.join(", ")}`),!1}})(e),r=n0(t);if(n===!1&&!r)throw new TypeError("Vue3 Mq: You must provide a valid preset, or valid breakpoint settings.");var o;o=r||n0(n),Kg.value=o,function(){for(;Ld.length>0;){const a=Ld.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(Kr);for(let s of a)delete Kr[s];Zg(),e0(),t0()})();const i=Rd.value.reduce((a,s,u,c)=>{const f=`(min-width: ${s.min}px)`,l=u<c.length-1?`(max-width: ${c[u+1].min-1}px)`:null,d=f+(l?" and "+l:"");return Object.assign(a,{[s.name]:d})},{});for(const a in i)Dd(i[a],()=>{Zg(a)});["portrait","landscape"].forEach(a=>{Dd(`(orientation: ${a})`,()=>{e0(a)})}),["light","dark"].forEach(a=>{Dd(`(prefers-color-scheme: ${a})`,()=>{t0(a)})})}var $8={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,c=((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,Qg.value=a,(f=>{Yg.value=f})(u),(f=>{Xg.value=f})(c),t.provide("mq",C8),t.provide("updateBreakpoints",r0),r0({breakpoints:n,preset:e})}catch(u){console.error(u)}var a,s}};class o0{constructor(){Yo(this,"debug");Yo(this,"logger",{log:()=>{}})}setupDebugger(e){this.debug=e,e&&(this.logger.log=console.log.bind(window.console))}}const i0=new o0,Oo=i0.logger;function zd(t,e){return Date.now()-t+e}function a0(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 O8=C.defineComponent({props:{containerCssClass:String}}),oQ="",Vr=(t,e)=>{const n=t.__vccOpts||t;for(const[r,o]of e)n[r]=o;return n},A8={class:"modal-header"},E8=C.createTextVNode(" default header "),P8=C.createElementVNode("hr",{class:"solid"},null,-1),T8={class:"modal-body"},M8=C.createTextVNode(" default body "),I8={class:"modal-footer"};function N8(t,e,n,r,o,i){return C.openBlock(),C.createBlock(C.Transition,{name:"modal"},{default:C.withCtx(()=>[C.createElementVNode("div",{class:"modal-mask",onClick:e[2]||(e[2]=a=>t.$emit("close"))},[C.createElementVNode("div",{class:C.normalizeClass(["modal-container bg-gray-800 card-4",t.containerCssClass]),onClick:e[1]||(e[1]=a=>a.stopPropagation())},[C.createElementVNode("div",A8,[C.createElementVNode("button",{class:"close-button",onClick:e[0]||(e[0]=a=>t.$emit("close"))},"X"),C.renderSlot(t.$slots,"header",{},()=>[E8]),P8]),C.createElementVNode("div",T8,[C.renderSlot(t.$slots,"body",{},()=>[M8])]),C.createElementVNode("div",I8,[C.renderSlot(t.$slots,"footer")])],2)])]),_:3})}const fu=Vr(O8,[["render",N8]]);function $i(t){return Array.isArray?Array.isArray(t):c0(t)==="[object Array]"}const L8=1/0;function R8(t){if(typeof t=="string")return t;let e=t+"";return e=="0"&&1/t==-L8?"-0":e}function D8(t){return t==null?"":R8(t)}function Xo(t){return typeof t=="string"}function s0(t){return typeof t=="number"}function B8(t){return t===!0||t===!1||z8(t)&&c0(t)=="[object Boolean]"}function u0(t){return typeof t=="object"}function z8(t){return u0(t)&&t!==null}function Qr(t){return t!=null}function Vd(t){return!t.trim().length}function c0(t){return t==null?t===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const iQ="Extended search is not available",V8="Incorrect 'index' type",F8=t=>`Invalid value for key ${t}`,q8=t=>`Pattern length exceeds max of ${t}.`,H8=t=>`Missing ${t} property in key`,W8=t=>`Property 'weight' in key '${t}' must be a positive integer`,l0=Object.prototype.hasOwnProperty;class U8{constructor(e){this._keys=[],this._keyMap={};let n=0;e.forEach(r=>{let o=f0(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 f0(t){let e=null,n=null,r=null,o=1,i=null;if(Xo(t)||$i(t))r=t,e=d0(t),n=Fd(t);else{if(!l0.call(t,"name"))throw new Error(H8("name"));const a=t.name;if(r=a,l0.call(t,"weight")&&(o=t.weight,o<=0))throw new Error(W8(a));e=d0(a),n=Fd(a),i=t.getFn}return{path:e,id:n,weight:o,src:r,getFn:i}}function d0(t){return $i(t)?t:t.split(".")}function Fd(t){return $i(t)?t.join("."):t}function J8(t,e){let n=[],r=!1;const o=(i,a,s)=>{if(!!Qr(i))if(!a[s])n.push(i);else{let u=a[s];const c=i[u];if(!Qr(c))return;if(s===a.length-1&&(Xo(c)||s0(c)||B8(c)))n.push(D8(c));else if($i(c)){r=!0;for(let f=0,l=c.length;f<l;f+=1)o(c[f],a,s+1)}else a.length&&o(c,a,s+1)}};return o(t,Xo(e)?e.split("."):e,0),r?n:n[0]}var Lt={...{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:J8,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1}};const G8=/[^ ]+/g;function K8(t=1,e=3){const n=new Map,r=Math.pow(10,e);return{get(o){const i=o.match(G8).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 qd{constructor({getFn:e=Lt.getFn,fieldNormWeight:n=Lt.fieldNormWeight}={}){this.norm=K8(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,Xo(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();Xo(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(!Qr(e)||Vd(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(!!Qr(a)){if($i(a)){let s=[];const u=[{nestedArrIndex:-1,value:a}];for(;u.length;){const{nestedArrIndex:c,value:f}=u.pop();if(!!Qr(f))if(Xo(f)&&!Vd(f)){let l={v:f,i:c,n:this.norm.get(f)};s.push(l)}else $i(f)&&f.forEach((l,d)=>{u.push({nestedArrIndex:d,value:l})})}r.$[i]=s}else if(Xo(a)&&!Vd(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 h0(t,e,{getFn:n=Lt.getFn,fieldNormWeight:r=Lt.fieldNormWeight}={}){const o=new qd({getFn:n,fieldNormWeight:r});return o.setKeys(t.map(f0)),o.setSources(e),o.create(),o}function Q8(t,{getFn:e=Lt.getFn,fieldNormWeight:n=Lt.fieldNormWeight}={}){const{keys:r,records:o}=t,i=new qd({getFn:e,fieldNormWeight:n});return i.setKeys(r),i.setIndexRecords(o),i}function zc(t,{errors:e=0,currentLocation:n=0,expectedLocation:r=0,distance:o=Lt.distance,ignoreLocation:i=Lt.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 Y8(t=[],e=Lt.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 Ca=32;function X8(t,e,n,{location:r=Lt.location,distance:o=Lt.distance,threshold:i=Lt.threshold,findAllMatches:a=Lt.findAllMatches,minMatchCharLength:s=Lt.minMatchCharLength,includeMatches:u=Lt.includeMatches,ignoreLocation:c=Lt.ignoreLocation}={}){if(e.length>Ca)throw new Error(q8(Ca));const f=e.length,l=t.length,d=Math.max(0,Math.min(r,l));let h=i,p=d;const v=s>1||u,g=v?Array(l):[];let m;for(;(m=t.indexOf(e,p))>-1;){let O=zc(e,{currentLocation:m,expectedLocation:d,distance:o,ignoreLocation:c});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+l;const w=1<<f-1;for(let O=0;O<f;O+=1){let L=0,x=k;for(;L<x;)zc(e,{errors:O,currentLocation:d+x,expectedLocation:d,distance:o,ignoreLocation:c})<=h?L=x:k=x,x=Math.floor((k-L)/2+L);k=x;let T=Math.max(1,d-x+1),S=a?l:Math.min(d+x,l)+f,z=Array(S+2);z[S+1]=(1<<O)-1;for(let _=S;_>=T;_-=1){let V=_-1,Q=n[t.charAt(V)];if(v&&(g[V]=+!!Q),z[_]=(z[_+1]<<1|1)&Q,O&&(z[_]|=(y[_+1]|y[_])<<1|1|y[_+1]),z[_]&w&&(b=zc(e,{errors:O,currentLocation:V,expectedLocation:d,distance:o,ignoreLocation:c}),b<=h)){if(h=b,p=V,p<=d)break;T=Math.max(1,2*d-p)}}if(zc(e,{errors:O+1,currentLocation:d,expectedLocation:d,distance:o,ignoreLocation:c})>h)break;y=z}const E={isMatch:p>=0,score:Math.max(.001,b)};if(v){const O=Y8(g,s);O.length?u&&(E.indices=O):E.isMatch=!1}return E}function Z8(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 p0{constructor(e,{location:n=Lt.location,threshold:r=Lt.threshold,distance:o=Lt.distance,includeMatches:i=Lt.includeMatches,findAllMatches:a=Lt.findAllMatches,minMatchCharLength:s=Lt.minMatchCharLength,isCaseSensitive:u=Lt.isCaseSensitive,ignoreLocation:c=Lt.ignoreLocation}={}){if(this.options={location:n,threshold:r,distance:o,includeMatches:i,findAllMatches:a,minMatchCharLength:s,isCaseSensitive:u,ignoreLocation:c},this.pattern=u?e:e.toLowerCase(),this.chunks=[],!this.pattern.length)return;const f=(d,h)=>{this.chunks.push({pattern:d,alphabet:Z8(d),startIndex:h})},l=this.pattern.length;if(l>Ca){let d=0;const h=l%Ca,p=l-h;for(;d<p;)f(this.pattern.substr(d,Ca),d),d+=Ca;if(h){const v=l-Ca;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:c}=this.options;let f=[],l=0,d=!1;this.chunks.forEach(({pattern:p,alphabet:v,startIndex:g})=>{const{isMatch:m,score:y,indices:b}=X8(e,p,v,{location:o+g,distance:i,threshold:a,findAllMatches:s,minMatchCharLength:u,includeMatches:r,ignoreLocation:c});m&&(d=!0),l+=y,m&&b&&(f=[...f,...b])});let h={isMatch:d,score:d?l/this.chunks.length:1};return d&&r&&(h.indices=f),h}}class Ui{constructor(e){this.pattern=e}static isMultiMatch(e){return v0(e,this.multiRegex)}static isSingleMatch(e){return v0(e,this.singleRegex)}search(){}}function v0(t,e){const n=t.match(e);return n?n[1]:null}class eP extends Ui{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 tP extends Ui{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 nP extends Ui{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 rP extends Ui{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 oP extends Ui{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 iP extends Ui{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 m0 extends Ui{constructor(e,{location:n=Lt.location,threshold:r=Lt.threshold,distance:o=Lt.distance,includeMatches:i=Lt.includeMatches,findAllMatches:a=Lt.findAllMatches,minMatchCharLength:s=Lt.minMatchCharLength,isCaseSensitive:u=Lt.isCaseSensitive,ignoreLocation:c=Lt.ignoreLocation}={}){super(e),this._bitapSearch=new p0(e,{location:n,threshold:r,distance:o,includeMatches:i,findAllMatches:a,minMatchCharLength:s,isCaseSensitive:u,ignoreLocation:c})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class g0 extends Ui{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 Hd=[eP,g0,nP,rP,iP,oP,tP,m0],y0=Hd.length,aP=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,sP="|";function uP(t,e={}){return t.split(sP).map(n=>{let r=n.trim().split(aP).filter(i=>i&&!!i.trim()),o=[];for(let i=0,a=r.length;i<a;i+=1){const s=r[i];let u=!1,c=-1;for(;!u&&++c<y0;){const f=Hd[c];let l=f.isMultiMatch(s);l&&(o.push(new f(l,e)),u=!0)}if(!u)for(c=-1;++c<y0;){const f=Hd[c];let l=f.isSingleMatch(s);if(l){o.push(new f(l,e));break}}}return o})}const cP=new Set([m0.type,g0.type]);class lP{constructor(e,{isCaseSensitive:n=Lt.isCaseSensitive,includeMatches:r=Lt.includeMatches,minMatchCharLength:o=Lt.minMatchCharLength,ignoreLocation:i=Lt.ignoreLocation,findAllMatches:a=Lt.findAllMatches,location:s=Lt.location,threshold:u=Lt.threshold,distance:c=Lt.distance}={}){this.query=null,this.options={isCaseSensitive:n,includeMatches:r,minMatchCharLength:o,findAllMatches:a,ignoreLocation:i,location:s,threshold:u,distance:c},this.pattern=n?e:e.toLowerCase(),this.query=uP(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,c=n.length;u<c;u+=1){const f=n[u];a.length=0,i=0;for(let l=0,d=f.length;l<d;l+=1){const h=f[l],{isMatch:p,indices:v,score:g}=h.search(e);if(p){if(i+=1,s+=g,r){const m=h.constructor.type;cP.has(m)?a=[...a,...v]:a.push(v)}}else{s=0,i=0,a.length=0;break}}if(i){let l={isMatch:!0,score:s/i};return r&&(l.indices=a),l}}return{isMatch:!1,score:1}}}const Wd=[];function fP(...t){Wd.push(...t)}function Ud(t,e){for(let n=0,r=Wd.length;n<r;n+=1){let o=Wd[n];if(o.condition(t,e))return new o(t,e)}return new p0(t,e)}const Vc={AND:"$and",OR:"$or"},Jd={PATH:"$path",PATTERN:"$val"},Gd=t=>!!(t[Vc.AND]||t[Vc.OR]),dP=t=>!!t[Jd.PATH],hP=t=>!$i(t)&&u0(t)&&!Gd(t),b0=t=>({[Vc.AND]:Object.keys(t).map(e=>({[e]:t[e]}))});function k0(t,e,{auto:n=!0}={}){const r=o=>{let i=Object.keys(o);const a=dP(o);if(!a&&i.length>1&&!Gd(o))return r(b0(o));if(hP(o)){const u=a?o[Jd.PATH]:i[0],c=a?o[Jd.PATTERN]:o[u];if(!Xo(c))throw new Error(F8(u));const f={keyId:Fd(u),pattern:c};return n&&(f.searcher=Ud(c,e)),f}let s={children:[],operator:i[0]};return i.forEach(u=>{const c=o[u];$i(c)&&c.forEach(f=>{s.children.push(r(f))})}),s};return Gd(t)||(t=b0(t)),r(t)}function pP(t,{ignoreFieldNorm:e=Lt.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 vP(t,e){const n=t.matches;e.matches=[],Qr(n)&&n.forEach(r=>{if(!Qr(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 mP(t,e){e.score=t.score}function gP(t,e,{includeMatches:n=Lt.includeMatches,includeScore:r=Lt.includeScore}={}){const o=[];return n&&o.push(vP),r&&o.push(mP),t.map(i=>{const{idx:a}=i,s={item:e[a],refIndex:a};return o.length&&o.forEach(u=>{u(i,s)}),s})}class fs{constructor(e,n={},r){this.options={...Lt,...n},this.options.useExtendedSearch,this._keyStore=new U8(this.options.keys),this.setCollection(e,r)}setCollection(e,n){if(this._docs=e,n&&!(n instanceof qd))throw new Error(V8);this._myIndex=n||h0(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){!Qr(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=Xo(e)?Xo(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return pP(u,{ignoreFieldNorm:s}),i&&u.sort(a),s0(n)&&n>-1&&(u=u.slice(0,n)),gP(u,this._docs,{includeMatches:r,includeScore:o})}_searchStringList(e){const n=Ud(e,this.options),{records:r}=this._myIndex,o=[];return r.forEach(({v:i,i:a,n:s})=>{if(!Qr(i))return;const{isMatch:u,score:c,indices:f}=n.searchIn(i);u&&o.push({item:i,idx:a,matches:[{score:c,value:i,norm:s,indices:f}]})}),o}_searchLogical(e){const n=k0(e,this.options),r=(s,u,c)=>{if(!s.children){const{keyId:l,searcher:d}=s,h=this._findMatches({key:this._keyStore.get(l),value:this._myIndex.getValueForItemAtKeyId(u,l),searcher:d});return h&&h.length?[{idx:c,item:u,matches:h}]:[]}const f=[];for(let l=0,d=s.children.length;l<d;l+=1){const h=s.children[l],p=r(h,u,c);if(p.length)f.push(...p);else if(s.operator===Vc.AND)return[]}return f},o=this._myIndex.records,i={},a=[];return o.forEach(({$:s,i:u})=>{if(Qr(s)){let c=r(n,s,u);c.length&&(i[u]||(i[u]={idx:u,item:s,matches:[]},a.push(i[u])),c.forEach(({matches:f})=>{i[u].matches.push(...f)}))}}),a}_searchObjectList(e){const n=Ud(e,this.options),{keys:r,records:o}=this._myIndex,i=[];return o.forEach(({$:a,i:s})=>{if(!Qr(a))return;let u=[];r.forEach((c,f)=>{u.push(...this._findMatches({key:c,value:a[f],searcher:n}))}),u.length&&i.push({idx:s,item:a,matches:u})}),i}_findMatches({key:e,value:n,searcher:r}){if(!Qr(n))return[];let o=[];if($i(n))n.forEach(({v:i,i:a,n:s})=>{if(!Qr(i))return;const{isMatch:u,score:c,indices:f}=r.searchIn(i);u&&o.push({score:c,key:e,value:i,idx:a,norm:s,indices:f})});else{const{v:i,n:a}=n,{isMatch:s,score:u,indices:c}=r.searchIn(i);s&&o.push({score:u,key:e,value:i,norm:a,indices:c})}return o}}fs.version="6.6.2",fs.createIndex=h0,fs.parseIndex=Q8,fs.config=Lt,fs.parseQuery=k0,fP(lP);var w0,j0,x0,_0,S0,C0,$0,O0,A0,E0,P0,T0,M0,I0,N0,L0,R0,D0,B0,z0,V0,F0,q0,H0,W0,U0,J0,G0,K0,Q0,Y0,X0,Z0,ey,ty,ny,ry,oy,iy,ay,sy,uy,cy,ly,fy,dy,hy,py,vy,my,gy,yy,by,ky,wy,jy,xy,_y,Sy,Cy,$y,Oy,Ay,Ey,Py,Ty,My,Iy,Ny,Ly,Ry,Dy,By,zy,Vy,Fy,qy,Hy,Wy,Uy,Jy,Gy,Ky,Qy,Yy,Xy,Zy,e1,t1,n1,r1,o1,i1,a1,s1,u1,c1,l1,f1,d1,h1,p1,v1,m1,g1,y1,b1,k1,w1,j1,x1,_1,S1,C1,$1,O1,A1,E1,P1,T1,M1,I1,N1,L1,R1,D1,B1,z1,V1,F1,q1,H1,W1,U1,J1,G1,K1,Q1,Y1,X1,Z1,eb,tb,nb,rb,ob,ib,ab,sb,ub,cb,lb,fb,db,hb,pb,vb,mb,gb,yb,bb,kb,wb,jb,xb,_b,Sb,Cb,$b,Ob,Ab,Eb,Pb,Tb,Mb,Ib,Nb,Lb,Rb,Db,Bb,zb,Vb,Fb,qb,Hb,Wb,Ub,Jb,Gb,Kb,Qb,Yb,Xb,Zb,ek,tk,nk,rk,ok,ik,ak,sk,uk,ck,lk,fk,dk,hk,pk,vk,mk,gk,yk,bk,kk,wk,jk,xk,_k,Sk,Ck,$k,Ok,Ak,Ek,Pk,Tk,Mk,Ik,Nk,Lk,Rk,Dk,Bk,zk,Vk,Fk,qk,Hk,Wk,Uk,Jk,Gk,Kk,Qk,Yk,Xk,Zk,ew,tw,nw,rw,ow,iw,aw,sw,uw,cw,lw,fw,dw,hw,pw,vw,mw,gw,yw,bw,kw,ww,jw,xw,_w,Sw,Cw,$w,Ow,Aw,Ew,Pw,Tw;function Fc(t){var e=typeof Map=="function"?new Map:void 0;return(Fc=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 Mw(n,arguments,Kt(this).constructor)}return o.prototype=Object.create(n.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),qc(o,n)})(t)}function Mw(t,e,n){return(Mw=Lw()?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&&qc(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,S,z){return Object.defineProperty(T,S,{value:z,enumerable:!0,configurable:!0,writable:!0}),T[S]}try{s({},"")}catch{s=function(S,z,$){return S[z]=$}}function u(T,S,z,$){var _=S&&S.prototype instanceof l?S:l,V=Object.create(_.prototype),Q=new O($||[]);return V._invoke=function(B,K,R){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 x()}for(R.method=H,R.arg=F;;){var D=R.delegate;if(D){var A=k(D,R);if(A){if(A===f)continue;return A}}if(R.method==="next")R.sent=R._sent=R.arg;else if(R.method==="throw"){if(I==="suspendedStart")throw I="completed",R.arg;R.dispatchException(R.arg)}else R.method==="return"&&R.abrupt("return",R.arg);I="executing";var j=c(B,K,R);if(j.type==="normal"){if(I=R.done?"completed":"suspendedYield",j.arg===f)continue;return{value:j.arg,done:R.done}}j.type==="throw"&&(I="completed",R.method="throw",R.arg=j.arg)}}}(T,z,Q),V}function c(T,S,z){try{return{type:"normal",arg:T.call(S,z)}}catch($){return{type:"throw",arg:$}}}t.wrap=u;var f={};function l(){}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=l.prototype=Object.create(p);function y(T){["next","throw","return"].forEach(function(S){s(T,S,function(z){return this._invoke(S,z)})})}function b(T,S){function z(_,V,Q,B){var K=c(T[_],T,V);if(K.type!=="throw"){var R=K.arg,I=R.value;return I&&it(I)=="object"&&n.call(I,"__await")?S.resolve(I.__await).then(function(H){z("next",H,Q,B)},function(H){z("throw",H,Q,B)}):S.resolve(I).then(function(H){R.value=H,Q(R)},function(H){return z("throw",H,Q,B)})}B(K.arg)}var $;this._invoke=function(_,V){function Q(){return new S(function(B,K){z(_,V,B,K)})}return $=$?$.then(Q,Q):Q()}}function k(T,S){var z=T.iterator[S.method];if(z===void 0){if(S.delegate=null,S.method==="throw"){if(T.iterator.return&&(S.method="return",S.arg=void 0,k(T,S),S.method==="throw"))return f;S.method="throw",S.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var $=c(z,T.iterator,S.arg);if($.type==="throw")return S.method="throw",S.arg=$.arg,S.delegate=null,f;var _=$.arg;return _?_.done?(S[T.resultName]=_.value,S.next=T.nextLoc,S.method!=="return"&&(S.method="next",S.arg=void 0),S.delegate=null,f):_:(S.method="throw",S.arg=new TypeError("iterator result is not an object"),S.delegate=null,f)}function w(T){var S={tryLoc:T[0]};1 in T&&(S.catchLoc=T[1]),2 in T&&(S.finallyLoc=T[2],S.afterLoc=T[3]),this.tryEntries.push(S)}function E(T){var S=T.completion||{};S.type="normal",delete S.arg,T.completion=S}function O(T){this.tryEntries=[{tryLoc:"root"}],T.forEach(w,this),this.reset(!0)}function L(T){if(T){var S=T[o];if(S)return S.call(T);if(typeof T.next=="function")return T;if(!isNaN(T.length)){var z=-1,$=function _(){for(;++z<T.length;)if(n.call(T,z))return _.value=T[z],_.done=!1,_;return _.value=void 0,_.done=!0,_};return $.next=$}}return{next:x}}function x(){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 S=typeof T=="function"&&T.constructor;return!!S&&(S===d||(S.displayName||S.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,S,z,$,_){_===void 0&&(_=Promise);var V=new b(u(T,S,z,$),_);return t.isGeneratorFunction(S)?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 S=[];for(var z in T)S.push(z);return S.reverse(),function $(){for(;S.length;){var _=S.pop();if(_ in T)return $.value=_,$.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 S in this)S.charAt(0)==="t"&&n.call(this,S)&&!isNaN(+S.slice(1))&&(this[S]=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 S=this;function z(K,R){return V.type="throw",V.arg=T,S.next=K,R&&(S.method="next",S.arg=void 0),!!R}for(var $=this.tryEntries.length-1;$>=0;--$){var _=this.tryEntries[$],V=_.completion;if(_.tryLoc==="root")return z("end");if(_.tryLoc<=this.prev){var Q=n.call(_,"catchLoc"),B=n.call(_,"finallyLoc");if(Q&&B){if(this.prev<_.catchLoc)return z(_.catchLoc,!0);if(this.prev<_.finallyLoc)return z(_.finallyLoc)}else if(Q){if(this.prev<_.catchLoc)return z(_.catchLoc,!0)}else{if(!B)throw new Error("try statement without catch or finally");if(this.prev<_.finallyLoc)return z(_.finallyLoc)}}}},abrupt:function(T,S){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 _=$;break}}_&&(T==="break"||T==="continue")&&_.tryLoc<=S&&S<=_.finallyLoc&&(_=null);var V=_?_.completion:{};return V.type=T,V.arg=S,_?(this.method="next",this.next=_.finallyLoc,f):this.complete(V)},complete:function(T,S){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"&&S&&(this.next=S),f},finish:function(T){for(var S=this.tryEntries.length-1;S>=0;--S){var z=this.tryEntries[S];if(z.finallyLoc===T)return this.complete(z.completion,z.afterLoc),E(z),f}},catch:function(T){for(var S=this.tryEntries.length-1;S>=0;--S){var z=this.tryEntries[S];if(z.tryLoc===T){var $=z.completion;if($.type==="throw"){var _=$.arg;E(z)}return _}}throw new Error("illegal catch attempt")},delegateYield:function(T,S,z){return this.delegate={iterator:L(T),resultName:S,nextLoc:z},this.method==="next"&&(this.arg=void 0),f}},t}function Iw(t,e,n,r,o,i,a){try{var s=t[i](a),u=s.value}catch(c){return void n(c)}s.done?e(u):Promise.resolve(u).then(r,o)}function xn(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var i=t.apply(e,n);function a(u){Iw(i,r,o,a,s,"next",u)}function s(u){Iw(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=Kd(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=yP(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 yP(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&(t=Kt(t))!==null;);return t}function _t(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,c=!1;try{for(o=o.call(n);!(u=(i=o.next()).done)&&(s.push(i.value),!r||s.length!==r);u=!0);}catch(f){c=!0,a=f}finally{try{u||o.return==null||o.return()}finally{if(c)throw a}}return s}}(t,e)||Kd(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&&qc(t,e)}function qc(t,e){return(qc=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n})(t,e)}function Ne(t){var e=Lw();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 Nw(this,n)}}function Nw(t,e){if(e&&(it(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 Lw(){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 Rw(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?Rw(Object(n),!0).forEach(function(r){du(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Rw(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function du(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 Qd(e)}(t)||function(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}(t)||Kd(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 Kd(t,e){if(t){if(typeof t=="string")return Qd(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)?Qd(t,e):void 0}}function Qd(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 Dw(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&&Dw(t.prototype,e),n&&Dw(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function it(t){return(it=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 Bw=function(t){return t};function Ji(t,e){for(var n in e)t[n]=e[n];return t}function zw(t){return t()}function Vw(){return Object.create(null)}function In(t){t.forEach(zw)}function Ao(t){return typeof t=="function"}function er(t,e){return t!=t?e==e:t!==e||t&&it(t)==="object"||typeof t=="function"}function Zt(t,e){return t!=t?e==e:t!==e}function Eo(t,e,n,r){if(t){var o=Fw(t,e,n,r);return t[0](o)}}function Fw(t,e,n,r){return t[1]&&r?Ji(n.ctx.slice(),t[1](r(e))):n.ctx}function Po(t,e,n,r){if(t[2]&&r){var o=t[2](r(n));if(e.dirty===void 0)return o;if(it(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 To(t,e,n,r,o,i){if(o){var a=Fw(e,n,r,i);t.p(a,o)}}function Mo(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 Xn(t){return t==null?"":t}function hu(t){return t&&Ao(t.destroy)?t.destroy:Je}var Hc,qw=typeof window<"u",bP=qw?function(){return window.performance.now()}:function(){return Date.now()},Yd=qw?function(t){return requestAnimationFrame(t)}:Je,pu=new Set;function Hw(t){pu.forEach(function(e){e.c(t)||(pu.delete(e),e.f())}),pu.size!==0&&Yd(Hw)}function q(t,e){t.appendChild(e)}function Tt(t,e,n){var r=Xd(t);if(!r.getElementById(e)){var o=ee("style");o.id=e,o.textContent=n,Ww(r,o)}}function Xd(t){if(!t)return document;var e=t.getRootNode?t.getRootNode():t.ownerDocument;return e&&e.host?e:t.ownerDocument}function kP(t){var e=ee("style");return Ww(Xd(t),e),e.sheet}function Ww(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 Fr(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 Oi(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function et(t){return document.createTextNode(t)}function xe(){return et(" ")}function on(){return et("")}function Le(t,e,n,r){return t.addEventListener(e,n,r),function(){return t.removeEventListener(e,n,r)}}function Uw(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 Jw(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 Wc(t,e){for(var n in e)P(t,n,e[n])}function Zd(t,e,n){e in t?t[e]=typeof t[e]=="boolean"&&n===""||n:P(t,e,n)}function wP(t){return Array.from(t.childNodes)}function Jt(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Gi(t,e){t.value=e==null?"":e}function Zo(t,e,n,r){n===null?t.style.removeProperty(e):t.style.setProperty(e,n,r?"important":"")}function Gw(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 jP(){if(Hc===void 0){Hc=!1;try{typeof window<"u"&&window.parent&&window.parent.document}catch{Hc=!0}}return Hc}function Ye(t,e,n){t.classList[n?"add":"remove"](e)}function Kw(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 vu,xP=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=Oi(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}(),Uc=new Map,eh=0;function _P(t){for(var e=5381,n=t.length;n--;)e=(e<<5)-e^t.charCodeAt(n);return e>>>0}function SP(t,e){var n={stylesheet:kP(e),rules:{}};return Uc.set(t,n),n}function Qw(t,e,n,r,o,i,a){for(var s=arguments.length>7&&arguments[7]!==void 0?arguments[7]:0,u=16.666/r,c=`{
@@ -179,7 +179,7 @@ This will fail in production.`);s=Oc,s._s.has(r)||(i?Rg(r,e,o,s):H7(r,o,s),proce
179
179
  <b>${r}</b>
180
180
  Script: ${t.code}
181
181
  Label: ${n.currentFrame.label}`)}}async function nU(t,e){const n=t.command,r=or.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(l8(s))u=await qg(s,e);else if(typeof s=="string")if(s.search(s8)===0)u=s.substring(3);else if(f8(s)){const c=su(),f=LW(c,s.substring(1));if(f){const[l,d]=f;u=l[d]}else u=s}else u=s;else u=s;if(o.args.push(u),Array.isArray(i)&&i.length>a){const c=i[a];u!==null&&(o.options[c.name]=u)}}return o}else throw new Error(`${n.commandType} is not a valid command`)}async function qg(t,e){const n=await nU(t,e),r=or.commands[n.commandType];if(r)return await r.run(n,e);throw new Error(`${n.commandType} is not a valid command`)}async function rU(t){Ec("onPlayerAnswered");const e=sn(),n=e.popAnswerQueue(),r=e.currentLine;try{if(n){const o=or.commands[n.commandType];if(o)return await o.processPlayerAnswer(n,t)}}catch(o){console.error(o),cr(`Error after player answer at ${r.fileName}:${r.line+1} (${r.code}<br /> - Error: ${o}`)}}const uu=Uo("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<Bt().layout.verticalLayoutThreshold?this.layoutMode="vertical":this.layoutMode="horizontal"}}}),_n=Uo("main",{state:()=>({ready:!1,playing:!1,errors:[],playTime:{start:0,previousPlaytime:0},options:{logging:!1,debug:!1},flowState:"menu",modal:!1,paused:!1}),actions:{async setup(t,e){e.audioOptions.defaultMusic&&Ad(e.audioOptions.defaultMusic),await sn().loadScripts(t),Ci().setButtons(e),ir().setupSkills(e.skills),Hi().setupHudStats(e.hudStats),Cr().setupItems(e.items),Br().setupQuests(e.quests)},startMachine(){uo().stopMusic(),sn().start(),this.ready=!0,this.startPlaying(),or.callHook("onGameStart"),this.setFlowState("playing")},async startGame(){this.startMachine(),await sn().runGame(),await this.saveGame()},async loadGame(t){if(this.startMachine(),t){const e=JSON.parse(t);this.setLoadedData(e),e.audio.currentMusic&&Ad(e.audio.currentMusic),sn().runLabel(e.vm.lastLabel)}},playerAnswered(t){rU(t)},menuReturn(){this.reset(),uo().stopMusic(),this.setFlowState("menu"),Bt().audioOptions.defaultMusic&&Ad(Bt().audioOptions.defaultMusic)},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,sn().reset(),uo().reset(),this.playing=!1,this.ready=!0},generateSaveData(){return{playTime:zd(this.playTime.start,this.playTime.previousPlaytime)}},loadSaveData(t){this.playTime.previousPlaytime=t.playTime},saveGame(){const t=Ci(),e=ir(),n=co(),r=sn(),o=_n(),i=Hi(),a=uo(),s=Cr(),u={version:"1.0.0",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:Br().generateSaveData()};wW(u)},setLoadedData(t){const e=Ci(),n=ir(),r=co(),o=sn(),i=_n(),a=Hi(),s=uo(),u=Cr();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),Br().loadSaveData(t.quests)},getAllStates(){return{main:this,screens:Ci(),skills:ir(),dialog:co(),vm:sn(),hud:Hi(),audio:uo(),rendering:uu(),notifications:Si(),inventory:Cr(),quests:Br()}},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 oU(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>`;cr(r)}function cr(t){const e=_n();console.error(t),t=t.replace(/[\r\n]/g,`
182
- <br />`),e.createError(`\u274C ${t}`)}const ir=Uo("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=Ed(this.skillChecks,t.skillChecks),this.skills=Ed(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||cr(`Skill ${t} doesn't exist`),n.xp+=e,n.xp>=Bt().skillOptions.xpPerLevel&&(n.xp=0,n.level++,this.levelledUp(t))},setSkillLevel(t,e){const n=this.getSkill(t);n||cr(`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=Bt().skills[t].name,n=this.skills[t].level;Si().addNotification(`Your skill in ${e} is now level ${n}`)}}}),lQ="";let v8;const iU=C.defineComponent({components:{Modal:fu},setup(){const t=ir(),e=C.computed(()=>t.skills),n=C.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];sn().runLabel(e),this.finishJumping()}})},methods:{finishJumping(){this.jumping=!1,this.matches=[],this.searchString=""},labelSelected(t){const e=t.target.value;sn().runLabel(e),this.close()},close(){this.showDebug=!1},closeErrors(){_n().clearErrors()},open(){this.showDebug=!0;const t=sn(),e=_n(),n=Br(),r=Cr(),o=ir();this.$nextTick(()=>{new y7({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 y7({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(){v8=new fs(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=v8.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(){_n().saveGame()},wordCount(){const e=Object.values(this.script).reduce((n,r)=>(Oo.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=zd(this.playTime.start,this.playTime.previousPlaytime);return a0(t/1e3)}},computed:{..._i(sn,["script","data"]),..._i(_n,["playTime","errors","playing","flowState"]),labels(){const t=this.script;return Object.keys(t).sort()},variables(){return this.data}}}),aU={class:"debug-menu"},sU={key:0,class:"debug-info"},uU=[C.createElementVNode("h3",null,"Debug mode is ON",-1),C.createElementVNode("ul",null,[C.createElementVNode("li",null,[C.createElementVNode("b",null,"j"),C.createTextVNode(": Quick Label Jump")]),C.createElementVNode("li",null,[C.createElementVNode("b",null,"d"),C.createTextVNode(": Debug Menu")]),C.createElementVNode("li",null,[C.createElementVNode("b",null,"Escape"),C.createTextVNode(": Toggle Menu")])],-1)],cU=C.createElementVNode("h3",{class:"title"},"Jump to label",-1),lU={key:0,class:"search-results"},fU={key:1},dU=[C.createElementVNode("h3",null,"No matches found",-1)],hU=C.createElementVNode("h3",{class:"title"},"Error(s)",-1),pU=C.createTextVNode(" There are errors in your dialogue scripts. Open the developer console for more details. "),vU=["innerHTML"],mU=C.createElementVNode("h3",{class:"title"},"Debug Menu!",-1),gU={class:"container"},yU=C.createTextVNode(" Hello this is the debug menu. "),bU=C.createElementVNode("option",{class:"option",selected:"",disabled:""},"Jump to a label",-1),kU=["value"],wU={class:"grid grid-cols-3 gap-4"},jU=C.createElementVNode("h2",null,"Variables Editor",-1),xU={ref:"variablesViewer"},_U=C.createElementVNode("h2",null,"Skill Checks",-1),SU={class:"table-auto"},CU=C.createElementVNode("thead",null,[C.createElementVNode("tr",null,[C.createElementVNode("th",null,"Skill Check"),C.createElementVNode("th",null,"Happened"),C.createElementVNode("th",null,"Succeeded")])],-1),$U=C.createElementVNode("h2",null,"App State editor (entire app and engine",-1),OU=C.createElementVNode("h3",{style:{color:"pink"}}," Use for debugging, editing some of those things can cause issues ",-1),AU={ref:"stateViewer"};function EU(t,e,n,r,o,i){const a=C.resolveComponent("modal");return C.openBlock(),C.createElementBlock("div",aU,[C.createElementVNode("button",{onClick:e[0]||(e[0]=(...s)=>t.open&&t.open(...s)),class:"button debug-button"},"Debug Menu"),!t.playing&&t.flowState==="menu"?(C.openBlock(),C.createElementBlock("div",sU,uU)):C.createCommentVNode("",!0),t.jumping?(C.openBlock(),C.createBlock(a,{key:1,onClose:t.finishJumping,containerCssClass:"jump-menu-container"},{header:C.withCtx(()=>[cU]),body:C.withCtx(()=>[C.withDirectives(C.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),[[C.vModelText,t.searchString]]),t.matches.length>0?(C.openBlock(),C.createElementBlock("div",lU,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.matches,(s,u)=>(C.openBlock(),C.createElementBlock("div",{class:"search-result",style:C.normalizeStyle(t.getMatchResultStyle(u)),key:u},C.toDisplayString(s),5))),128))])):(C.openBlock(),C.createElementBlock("div",fU,dU))]),_:1},8,["onClose"])):C.createCommentVNode("",!0),t.errors.length>0?(C.openBlock(),C.createBlock(a,{key:2,onClose:t.closeErrors,containerCssClass:"debug-menu-container"},{header:C.withCtx(()=>[hU]),body:C.withCtx(()=>[pU,C.createElementVNode("ul",null,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.errors,(s,u)=>(C.openBlock(),C.createElementBlock("li",{key:u,class:"error-message list-disc",innerHTML:s.text},null,8,vU))),128))])]),_:1},8,["onClose"])):C.createCommentVNode("",!0),t.showDebug?(C.openBlock(),C.createBlock(a,{key:3,onClose:t.close,containerCssClass:"debug-menu-container"},{header:C.withCtx(()=>[mU]),body:C.withCtx(()=>[C.createElementVNode("div",gU,[yU,C.createElementVNode("select",{class:"select",name:"label-selector",onChange:e[3]||(e[3]=s=>t.labelSelected(s))},[bU,(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.labels,s=>(C.openBlock(),C.createElementBlock("option",{class:"option",value:s,key:s},C.toDisplayString(s),9,kU))),128))],32),C.createElementVNode("div",wU,[C.createElementVNode("button",{onClick:e[4]||(e[4]=(...s)=>t.wordCount&&t.wordCount(...s)),class:"button"},"Word Count"),C.createElementVNode("button",{onClick:e[5]||(e[5]=(...s)=>t.save&&t.save(...s)),class:"button"},"Save Game")]),C.createElementVNode("h3",null,"Play time: "+C.toDisplayString(t.getPlayTimeString()),1),jU,C.createElementVNode("div",xU,null,512),_U,C.createElementVNode("table",SU,[CU,C.createElementVNode("tbody",null,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.skillChecks,(s,u)=>(C.openBlock(),C.createElementBlock("tr",{key:u},[C.createElementVNode("td",null,C.toDisplayString(u),1),C.createElementVNode("td",null,C.toDisplayString(s.happened?"\u2705":"\u274C"),1),C.createElementVNode("td",null,C.toDisplayString(s.happened?s.succeeded?"\u2705":"\u274C":"NA"),1)]))),128))])]),$U,OU,C.createElementVNode("div",AU,null,512)])]),_:1},8,["onClose"])):C.createCommentVNode("",!0)])}const PU=Vr(iU,[["render",EU]]),pQ="",TU=C.defineComponent({data(){return{}},methods:{getStatImage(t){return $c(this.statsConfig[t].icon)}},computed:{..._i(Hi,["hudStats"]),..._i(uu,["layoutMode"]),statsConfig(){return Bt().hudStats},stats(){return this.hudStats},hudStyle(){let t="0";return this.layoutMode==="horizontal"&&(t=`${Bt().layout.minTextWidth}px`),{right:t}}}}),MU=["src"],IU={class:"bold hud-text"},NU=C.createTextVNode(": ");function LU(t,e,n,r,o,i){return C.openBlock(),C.createElementBlock("div",{class:"hud",style:C.normalizeStyle(t.hudStyle)},[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.stats,(a,s)=>(C.openBlock(),C.createElementBlock("div",{key:s,class:"hud-stat"},[C.createElementVNode("img",{class:"hud-icon",src:t.getStatImage(s)},null,8,MU),C.createElementVNode("span",IU,C.toDisplayString(t.statsConfig[s].name),1),NU,C.createElementVNode("span",null,C.toDisplayString(Math.floor(a.value*100)/100),1)]))),128))],4)}const RU=Vr(TU,[["render",LU]]),vQ="",DU=C.defineComponent({props:{percentage:Number,step:String},methods:{loadingStyle(){return{width:`${this.percentage*40}vw`}}},computed:{}}),BU={id:"loading-bar"},zU={id:"loading-text"};function VU(t,e,n,r,o,i){return C.openBlock(),C.createElementBlock("div",BU,[C.createElementVNode("div",{id:"inner-loading-bar",style:C.normalizeStyle(t.loadingStyle())},null,4),C.createElementVNode("div",zU,[C.createElementVNode("h3",null,"Loading "+C.toDisplayString(Math.floor(t.percentage*100))+"% - "+C.toDisplayString(t.step),1)])])}const FU=Vr(DU,[["render",VU]]),mQ="",qU=C.defineComponent({data(){},methods:{},computed:{..._i(Si,["notifications"])}});function HU(t,e,n,r,o,i){return C.openBlock(),C.createBlock(C.TransitionGroup,{name:"notification",tag:"div",class:"notifications-holder"},{default:C.withCtx(()=>[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.notifications,(a,s)=>(C.openBlock(),C.createElementBlock("div",{class:"notification",key:s},[C.createElementVNode("h3",null,C.toDisplayString(a.text),1)]))),128))]),_:1})}const WU=Vr(qU,[["render",HU]]);let Hg;function UU(t){Hg=t}function Wg(t){return Hg.characters[t]}function JU(t,e){const n=Wg(t);if(e||(e="default"),n.sprites)return`${Hg.config.imagesPath}${n.sprites[e]}`}function Pd(t){return t?Wg(t).style||{}:{}}function m8(t,e,n,r){const o=t/n,i=e/r;return Math.min(o,i)}let g8=0,y8=0;function GU(t){return Oo.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];KU(r,o,e,n)}})}function KU(t,e,n,r){g8++,Oo.log(`Loading image ${t} at ${e}`);const o=new Image;o.onload=()=>{y8+=1,Oo.log(`Loaded image ${t} successfully`),y8>=g8&&(Oo.log("All images loaded"),n())},o.onerror=i=>{console.error(`Error loading image ${t}`),r(i)},o.src=e}function QU(t,e=50,n={}){var l,d;let r;const o=(l=n.isImmediate)!=null?l:!1,i=(d=n.callback)!=null?d:!1,a=n.maxWait;let s=Date.now(),u=[];function c(){if(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 b=t.apply(p,h);i&&i(b),u.forEach(({resolve:k})=>k(b)),u=[]}},y=o&&r===void 0;if(r!==void 0&&clearTimeout(r),r=setTimeout(m,c()),y){const b=t.apply(p,h);return i&&i(b),v(b)}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 gQ="",YU=C.defineComponent({data(){return{muted:!1}},mounted(){const t=wa.Howler.volume();this.$refs.slider.value=t},methods:{changeVolume(t){const e=t.target;wa.Howler.volume(e.value)},toggleMute(){this.muted?(wa.Howler.mute(!1),this.muted=!1):(wa.Howler.mute(!0),this.muted=!0)}}}),XU={class:"volume-controls"},ZU=C.createElementVNode("label",{for:"volume",class:"volume-label"},"Volume",-1);function eJ(t,e,n,r,o,i){return C.openBlock(),C.createElementBlock("div",XU,[ZU,C.createElementVNode("input",{ref:"slider",class:"volume-slider",type:"range",id:"volume",name:"volume",min:"0",max:"1",step:"0.1",value:"0.5",onChange:e[0]||(e[0]=(...a)=>t.changeVolume&&t.changeVolume(...a))},null,544)])}const tJ=Vr(YU,[["render",eJ]]),yQ="",nJ=C.defineComponent({components:{Modal:fu,VolumeControls:tJ},data(){return{}},mounted(){},methods:{quit(){window.close()},mainMenu(){_n().menuReturn(),this.closeMenu()},closeMenu(){this.$emit("close")},getPlayTimeString(){const t=zd(this.playTime.start,this.playTime.previousPlaytime);return a0(t/1e3)}},computed:{..._i(_n,["playTime"])}}),rJ=C.createElementVNode("h3",{class:"title"},"Menu",-1),oJ={class:"menu-content"};function iJ(t,e,n,r,o,i){const a=C.resolveComponent("VolumeControls"),s=C.resolveComponent("modal");return C.openBlock(),C.createBlock(s,{class:"menu",onClose:e[2]||(e[2]=u=>t.$emit("close")),containerCssClass:"menu-modal"},{header:C.withCtx(()=>[rJ]),body:C.withCtx(()=>[C.createElementVNode("div",oJ,[C.createElementVNode("h3",null,"Play time: "+C.toDisplayString(t.getPlayTimeString()),1),C.createVNode(a),C.createElementVNode("button",{class:"button title quit-button",onClick:e[0]||(e[0]=(...u)=>t.mainMenu&&t.mainMenu(...u))}," Main Menu "),C.createElementVNode("button",{class:"button title quit-button",onClick:e[1]||(e[1]=(...u)=>t.quit&&t.quit(...u))},"Exit")])]),_:1})}const aJ=Vr(nJ,[["render",iJ]]),bQ="",sJ=C.defineComponent({setup(){const t=ir();return{skills:C.computed(()=>t.skills)}},components:{Modal:fu},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 Bt().skills},xpPerLevel(){return Bt().skillOptions.xpPerLevel}}}),uJ=C.createElementVNode("h3",{class:"title"},"Skills",-1),cJ={key:0,class:"skills-container"},lJ=["onClick"],fJ={class:"skill-title"},dJ={class:"skill-xp-container"},hJ={class:"skill-xp-text"},pJ={class:"skill-level"},vJ={key:1},mJ={class:"flex flex-row skill-description-container"},gJ={class:"flex skill-left"},yJ={class:"flex skill-right"},bJ=C.createElementVNode("hr",{class:"hr-solid"},null,-1);function kJ(t,e,n,r,o,i){const a=C.resolveComponent("modal");return C.openBlock(),C.createBlock(a,{class:"menu",onClose:e[1]||(e[1]=s=>t.$emit("close")),containerCssClass:"skills-modal"},{header:C.withCtx(()=>[uJ]),body:C.withCtx(()=>[t.chosenSkill?typeof t.chosenSkill=="string"?(C.openBlock(),C.createElementBlock("div",vJ,[C.createElementVNode("div",mJ,[C.createElementVNode("div",gJ,[C.createElementVNode("div",{class:"skill-display",style:C.normalizeStyle(t.getSkillStyle(t.chosenSkill))},null,4)]),C.createElementVNode("div",yJ,[C.createElementVNode("h2",null,C.toDisplayString(t.getSkillName(t.chosenSkill)),1),bJ,C.createElementVNode("h3",null,"Level: "+C.toDisplayString(t.skills[t.chosenSkill].level),1),C.createElementVNode("p",null,C.toDisplayString(t.skillConf[t.chosenSkill].description),1)])]),C.createElementVNode("button",{class:"button",onClick:e[0]||(e[0]=(...s)=>t.closeSkill&&t.closeSkill(...s))},C.toDisplayString("<--"))])):C.createCommentVNode("",!0):(C.openBlock(),C.createElementBlock("div",cJ,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.skillsToDisplay,s=>(C.openBlock(),C.createElementBlock("button",{onClick:()=>t.clickSkill(s.id),class:"skill-display",style:C.normalizeStyle(t.getSkillStyle(s.id)),key:s.id},[C.createElementVNode("h3",fJ,C.toDisplayString(t.getSkillName(s.id)),1),C.createElementVNode("div",dJ,[C.createElementVNode("div",{class:"skill-xp-bar",style:C.normalizeStyle(t.xpBarWidth(s.xp))},null,4),C.createElementVNode("h3",hJ,C.toDisplayString(s.xp)+" / "+C.toDisplayString(t.xpPerLevel)+" XP",1)]),C.createElementVNode("h3",pJ,C.toDisplayString(s.level),1)],12,lJ))),128))]))]),_:1})}const wJ=Vr(sJ,[["render",kJ]]),kQ="",jJ=C.defineComponent({setup(){const t=Cr(),e=co(),n=C.computed(()=>t.items),r=C.computed(()=>e.currentDialog.choices);return{items:n,currentlyChoosing:r}},components:{Modal:fu},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"?sn().runLabel(t.label):t.action==="run"?sn().runLabelFunction(t.label,!0):cr(`Unknown action ${t.action}`)}},canUseItem(t){const e=this.itemConf[t.id];return!!(e&&e.onUse&&!Cr().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 Bt().items}}}),xJ=C.createElementVNode("h3",{class:"title"},"Inventory",-1),_J={key:0,class:"inventory-container"},SJ=["onClick"],CJ={class:"item-title"},$J={class:"item-amount"},OJ={key:1},AJ={class:"flex flex-row item-description-container"},EJ={class:"flex item-left"},PJ={class:"flex item-right"},TJ=C.createElementVNode("hr",{class:"hr-solid"},null,-1),MJ={key:2},IJ=[C.createElementVNode("h2",null,"The inventory is empty!",-1)];function NJ(t,e,n,r,o,i){const a=C.resolveComponent("modal");return C.openBlock(),C.createBlock(a,{class:"menu",onClose:t.close,containerCssClass:"inventory-modal"},{header:C.withCtx(()=>[xJ]),body:C.withCtx(()=>[!t.chosenItem&&Object.keys(t.itemsToDisplay).length>0?(C.openBlock(),C.createElementBlock("div",_J,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.itemsToDisplay,s=>(C.openBlock(),C.createElementBlock("button",{onClick:()=>t.clickItem(s.id),class:"item-display",style:C.normalizeStyle(t.getItemStyle(s.id)),key:s.id},[C.createElementVNode("h3",CJ,C.toDisplayString(t.getItemName(s.id)),1),C.createElementVNode("h3",$J,C.toDisplayString(s.amount),1)],12,SJ))),128))])):typeof t.chosenId=="string"?(C.openBlock(),C.createElementBlock("div",OJ,[C.createElementVNode("div",AJ,[C.createElementVNode("div",EJ,[C.createElementVNode("div",{class:"item-display",style:C.normalizeStyle(t.getItemStyle(t.chosenId))},null,4)]),C.createElementVNode("div",PJ,[C.createElementVNode("h2",null,C.toDisplayString(t.getItemName(t.chosenId)),1),TJ,C.createElementVNode("h3",null,"Amount: "+C.toDisplayString(t.chosenItem.amount),1),C.createElementVNode("p",null,C.toDisplayString(t.chosenItemConf.description),1),C.createElementVNode("button",{onClick:e[0]||(e[0]=(...s)=>t.useItem&&t.useItem(...s)),class:C.normalizeClass(["button",t.canUseChosenItem?"":"disabled"])}," Use ",2)])]),C.createElementVNode("button",{class:"button",onClick:e[1]||(e[1]=(...s)=>t.closeItem&&t.closeItem(...s))},C.toDisplayString("<--"))])):(C.openBlock(),C.createElementBlock("div",MJ,IJ))]),_:1},8,["onClose"])}const LJ=Vr(jJ,[["render",NJ]]),jQ="",RJ=C.defineComponent({props:{pictureUrl:String},computed:{..._i(uu,["layoutMode"]),boxStyle(){const t=Bt().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`}}}}),DJ=["src"];function BJ(t,e,n,r,o,i){return C.openBlock(),C.createElementBlock("div",{class:"dialog-picture override",style:C.normalizeStyle(t.boxStyle)},[C.createElementVNode("img",{src:t.pictureUrl,class:"picture override"},null,8,DJ)],4)}const zJ=Vr(RJ,[["render",BJ]]),xQ="",VJ=C.defineComponent({data(){return{playerText:"",passed:!1}},props:{options:{type:Object,required:!0},active:Boolean},mounted(){document.addEventListener("keydown",t=>{if(this.canInteract&&this.options.textField&&t.key==="Enter"&&this.submitText(),this.canInteract&&!this.options.textField){let e=-1;if(t.key===" ")this.choices?e=0:this.chooseOption(0);else switch(t.key){case" ":e=0;break;case"1":e=0;break;case"2":e=1;break;case"3":e=2;break;case"4":e=3;break;case"5":e=4;break;case"6":e=5;break;case"7":e=6;break;case"8":e=7;break}e!==-1&&this.choices&&e<this.choices.length&&this.chooseOption(this.choices[e])}}),setTimeout(()=>{this.options.textField&&this.$refs.playerInput.focus()},10)},computed:{..._i(_n,["paused"]),preText(){return this.options.title?" &nbsp;\u2013&nbsp; ":""},style(){return Pd(this.options.styleId)},dialogBoxStyle(){const t=Pd(this.options.styleId),e={opacity:this.options.old?"0.7":"1"};return this.options.title||(e.marginTop="-20px"),{...t.boxCss,...e}},titleStyle(){const t=Pd(this.options.styleId);return{color:t.color,...t.nameCss}},textStyle(){return Pd(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:{chooseOption(t){this.passed=!0;let e;typeof t=="object"?e=t.originalIndex:e=t,_n().playerAnswered(e)},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;_n().playerAnswered(t)}}}),FJ={class:"dialog-content"},qJ=["innerHTML"],HJ=["innerHTML"],WJ=["innerHTML"],UJ={key:1,class:"dialog-choices"},JJ=["onClick","innerHTML"],GJ={key:2},KJ={key:3,class:"buttons-container"};function QJ(t,e,n,r,o,i){return C.openBlock(),C.createElementBlock("div",{class:"dialog-box w-full override",style:C.normalizeStyle(t.dialogBoxStyle)},[C.createElementVNode("div",FJ,[t.options.title?(C.openBlock(),C.createElementBlock("span",{key:0,class:"dialog-title override",style:C.normalizeStyle(t.titleStyle),innerHTML:t.options.title},null,12,qJ)):C.createCommentVNode("",!0),C.createElementVNode("span",{class:"dialog-text dialog-separator override",style:C.normalizeStyle(t.textStyle),innerHTML:t.preText},null,12,HJ),C.createElementVNode("span",{class:"dialog-text override",style:C.normalizeStyle(t.textStyle),innerHTML:t.options.text},null,12,WJ),t.canInteract&&t.choices?(C.openBlock(),C.createElementBlock("div",UJ,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.choices,(a,s)=>(C.openBlock(),C.createElementBlock("p",{key:s,style:C.normalizeStyle(t.dialogStyle(a)),class:C.normalizeClass([t.dialogClass(a),"dialog-choice override"]),onClick:u=>t.chooseOption(a),innerHTML:`${s+1}. \u2013\xA0 ${a.choice}`},null,14,JJ))),128))])):t.canInteract&&t.options.textField?(C.openBlock(),C.createElementBlock("div",GJ,[C.withDirectives(C.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),[[C.vModelText,t.playerText]]),C.createElementVNode("button",{onClick:e[1]||(e[1]=(...a)=>t.submitText&&t.submitText(...a)),class:"button",id:"player-input-submit"}," Submit ")])):t.canInteract?(C.openBlock(),C.createElementBlock("div",KJ,[C.createElementVNode("div",{onClick:e[2]||(e[2]=a=>t.chooseOption(0)),class:"interact-button button override"}," Continue ")])):C.createCommentVNode("",!0)])],4)}const YJ=Vr(VJ,[["render",QJ]]),_Q="",XJ=C.createElementVNode("div",{class:"anchor"},null,-1),ZJ=C.defineComponent({__name:"game-dialog",props:{layoutMode:String,inGame:Boolean},setup(t){const e=t,n=sn(),r=C.computed(()=>n.stack),o=co(),i=C.computed(()=>o.dialog),a=C.ref(null),s=C.computed(()=>e.layoutMode==="vertical"?{}:{paddingBottom:`${Bt().layout.dialogBottomPadding}px`}),u=C.computed(()=>{if(i.value.length>0)return i.value[i.value.length-1]}),c=C.computed(()=>{if(u.value)return JU(u.value.speaker,u.value.pose)}),f=C.computed(()=>Bt().layout.minTextWidth),l=C.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=Wg(p.speaker).name;return v>=1&&i.value[v-1].speaker===p.speaker&&(m=void 0),p.choices&&p.choices.forEach(y=>{y.choice=a8(y.choice)}),{title:m!=null?m:"",text:p.text,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 C.watch(i.value,p=>{if(a.value){const v=a.value;v.scrollTop=v.scrollHeight+1e8}}),(p,v)=>(C.openBlock(),C.createElementBlock(C.Fragment,null,[C.createVNode(C.Transition,{name:"fade"},{default:C.withCtx(()=>[C.unref(c)?(C.openBlock(),C.createBlock(zJ,{key:0,pictureUrl:C.unref(c)},null,8,["pictureUrl"])):C.createCommentVNode("",!0)]),_:1}),t.inGame?(C.openBlock(),C.createElementBlock("div",{key:0,class:"dialog override",ref_key:"dialogRef",ref:a,style:C.normalizeStyle(C.unref(l))},[C.createVNode(C.TransitionGroup,{name:"list",tag:"div",class:"dialog-container w-full override",style:C.normalizeStyle(C.unref(s))},{default:C.withCtx(()=>[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(C.unref(i),(g,m)=>(C.openBlock(),C.createBlock(YJ,{key:g.id,options:d(g,m),active:h(m)},null,8,["options","active"]))),128))]),_:1},8,["style"]),XJ],4)):C.createCommentVNode("",!0)],64))}}),b8=(t,e)=>{const n={};for(const r in t)e(t[r])&&(n[r]=t[r]);return n},SQ="",eG=C.defineComponent({setup(){const t=Br();return{quests:C.computed(()=>t.quests)}},computed:{questsToDisplay(){return b8(this.quests,t=>t.state!=="hidden")}},methods:{close(){this.$emit("close")},getQuestData(t){return xd(t)},getObjectiveData(t,e){return Ag(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 b8(t.objectives,e=>e.state!=="hidden")}},components:{Modal:fu}}),tG=C.createElementVNode("h3",{class:"title"},"Quests",-1),nG={key:0,class:"quests-container"},rG={class:"quest-title"},oG={class:"quest-description"},iG={key:0,class:"quest-objectives-container list-disc"},aG={key:1,class:"menu-container"},sG=[C.createElementVNode("h2",{class:"title"},"There are no quests!",-1)];function uG(t,e,n,r,o,i){const a=C.resolveComponent("modal");return C.openBlock(),C.createBlock(a,{class:"quests",onClose:t.close,containerCssClass:"quests-modal"},{header:C.withCtx(()=>[tG]),body:C.withCtx(()=>[Object.keys(t.questsToDisplay).length>0?(C.openBlock(),C.createElementBlock("div",nG,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.questsToDisplay,s=>(C.openBlock(),C.createElementBlock("div",{class:"quest-display",key:s.id},[C.createElementVNode("div",{class:C.normalizeClass(["quest-header",s.state==="completed"?"quest-completed":"quest-in-progress"])},[C.createElementVNode("h3",rG,C.toDisplayString(t.getQuestData(s.id).title)+" "+C.toDisplayString(t.getDisplayTextForQuestState(s)),1)],2),C.createElementVNode("p",oG,C.toDisplayString(t.getQuestDescription(s)),1),s.state!=="completed"?(C.openBlock(),C.createElementBlock("ul",iG,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.getAvailableObjectives(s),u=>(C.openBlock(),C.createElementBlock("li",{class:"quest-objective-display",key:u.id},[C.createElementVNode("p",{class:C.normalizeClass(["quest-objective-description",u.state==="completed"?"quest-objective-completed":"quest-objctive-in-progress"])},C.toDisplayString(t.getObjectiveData(s.id,u.id).description),3)]))),128))])):C.createCommentVNode("",!0)]))),128))])):(C.openBlock(),C.createElementBlock("div",aG,sG))]),_:1},8,["onClose"])}const cG=Vr(eG,[["render",uG]]),$Q="",lG=C.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()}),or.callHook("onGameMounted")},unmounted(){or.callHook("onGameUnmounted")},methods:{buttonClick(t){t.onClick?t.onClick():_n().openModal(t.id)},openMenu(){_n().openModal("menu")},openSkills(){_n().openModal("skills")},openInventory(){_n().openModal("inventory")},openQuests(){_n().openModal("quests")},closeMenu(){_n().closeModal()},toggleMenu(){_n().toggleMenu()}},computed:{buttonsToShow(){return this.buttons.map(t=>{const e=Bt().menuButtons[t.id]||{};return{...t,...e}}).filter(t=>t.condition?t.condition():!0)},showSkills(){return Object.entries(Bt().skills).length>0},showInventory(){return Object.entries(Bt().items).length>0},showQuests(){return Object.entries(Bt().quests).length>0}}}),fG={class:"menu-container"},dG=["onClick","id"];function hG(t,e,n,r,o,i){return C.openBlock(),C.createElementBlock("div",fG,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.buttonsToShow,a=>(C.openBlock(),C.createElementBlock("button",{key:a.id,onClick:s=>t.buttonClick(a),id:a.cssId,class:"button menu-toggle-button"},C.toDisplayString(a.text),9,dG))),128))])}const pG=Vr(lG,[["render",hG]]),OQ="",vG=["id"],mG=["id","onClick"],gG=C.defineComponent({__name:"screen-layer",props:{layer:String},setup(t){const e=t,n=sn(),r=_n(),o=Ci(),i=C.computed(()=>e.layer),a=C.computed(()=>o.buttons),s=C.computed(()=>{const p=Bt().screens[i.value];if(!p)throw new Error(`Screen ${i.value} doesn't have a config`);return p}),u=C.computed(()=>s.value.buttons||[]),c=C.computed(()=>r.isInGame);function f(p){const g=jd(p).background;if(!!g)return S7(g)}function l(p){const v=jd(p),g={};v.position.width&&(g.width=`${v.position.width}px`),v.position.height&&(g.height=`${v.position.height}px`),v.background&&(g.backgroundImage=`url(${f(p)})`);const m=a.value[p].state;m==="greyed"?(g.opacity=.3,g.pointerEvents="none"):(m==="hidden"||m===!1)&&(g.display="none");let y=v.position.left,b=v.position.top;return v.anchor&&(y=v.position.left-v.position.width*v.anchor.x,b=v.position.top-v.position.height*v.anchor.y),{...g,left:`${y}px`,top:`${b}px`}}function d(p){const v=jd(p);if(a.value[p].state===!0){const m=v.action,y={branchData:n.script[m],currentIndex:0,label:m};n.setStack(y),n.runLine()}}const h=C.computed(()=>({backgroundImage:`url(${S7(s.value.background)})`}));return(p,v)=>C.unref(c)?(C.openBlock(),C.createElementBlock("div",{key:0,class:"viewport-layer",id:`viewport-layer-${C.unref(i)}`,style:C.normalizeStyle(C.unref(h))},[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(C.unref(u),(g,m)=>(C.openBlock(),C.createElementBlock("button",{key:m,class:"viewport-button",id:`viewport-button-${g}`,onClick:y=>d(g),style:C.normalizeStyle(l(g))},C.toDisplayString(C.unref(jd)(g).text),13,mG))),128))],12,vG)):C.createCommentVNode("",!0)}}),AQ="",yG=C.defineComponent({__name:"screens",setup(t){const e=uu(),n=_n(),r=Ci(),o=C.computed(()=>r.layers.filter(f=>f)),i=C.computed(()=>e.layoutMode),a=C.computed(()=>Bt().layout.backgrounds.width),s=C.computed(()=>Bt().layout.backgrounds.height),u=C.computed(()=>n.isInGame),c=C.computed(()=>{const f=`${a.value}px`;let l=`${s.value}px`;return i.value==="vertical"&&(l=`${100-Bt().layout.mobileDialogHeightPercentage}%`),{height:l,width:f}});return(f,l)=>C.unref(u)?(C.openBlock(),C.createElementBlock("div",{key:0,class:"viewport",id:"narrat-viewport",style:C.normalizeStyle(C.unref(c))},[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(C.unref(o),(d,h)=>(C.openBlock(),C.createBlock(gG,{key:h,layer:d},null,8,["layer"]))),128))],4)):C.createCommentVNode("",!0)}}),EQ="",bG=C.defineComponent({setup(){const t=co(),e=sn(),n=_n();return{dialog:C.computed(()=>t.dialog),stack:C.computed(()=>e.stack),modal:C.computed(()=>n.modal),flowState:C.computed(()=>n.flowState)}},$refs:{dialogContainer:HTMLInputElement},inject:["mq"],components:{DebugMenu:PU,LoadingBar:FU,NotificationToast:WU,Hud:RU,MainMenu:aJ,Skills:wJ,InventoryUi:LJ,GameDialog:ZJ,QuestsUi:cG,MenuButtons:pG,Screens:yG},data(){return{lineTitle:"title",lineText:"hello",gameLoaded:!1,loadingStep:"Loading",loadingPercentage:.1,hasSave:!1}},props:{config:Object,options:Object},async mounted(){or.callHook("onAppMounted"),this.loadingStep="Characters";const t=await Bg(this.config.charactersPath);await UU(JSON.parse(t)),this.loadingPercentage=.2,this.loadingStep="Data",this.loadingPercentage=.3,this.loadingStep="Images",await GU(Bt()),this.loadingPercentage=.7,this.loadingStep="Audio",await bW(Bt()),or.callHook("onAssetsLoaded"),this.loadingPercentage=.95,this.loadingStep="Starting...",await this.setupMachine(),or.callHook("onGameSetup"),this.loadingPercentage=.1,this.gameLoaded=!0,this.getSaveFile()&&(this.hasSave=!0),window.addEventListener("resize",QU(()=>{this.updateScreenSize()},100,{maxWait:200})),setTimeout(()=>{this.updateScreenSize()},50)},computed:{..._i(uu,["screenWidth","screenHeight","canvasWidth","canvasHeight","topOffset","leftOffset","layoutMode"]),..._i(sn,["currentLine"]),backgroundStyle(){let t;return this.layoutMode==="vertical"&&(t=`${100-Bt().layout.mobileDialogHeightPercentage}%`),{backgroundColor:"red",height:t}},layoutWidth(){return Bt().layout.backgrounds.width},gameTitle(){return Bt().gameTitle},inGame(){return this.flowState==="playing"},layoutHeight(){return Bt().layout.backgrounds.height},backgroundSize(){return{width:this.canvasWidth,height:this.canvasHeight,top:this.topOffset,left:this.leftOffset}},gameWidth(){const t=Bt();return this.layoutMode==="vertical"?window.innerWidth:t.layout.backgrounds.width+t.layout.minTextWidth},gameHeight(){const t=Bt();return this.layoutMode==="vertical"?window.innerHeight:t.layout.backgrounds.height},appStyle(){const t=Bt();if(this.screenWidth&&this.screenHeight&&t&&this.layoutMode==="horizontal"){const e=m8(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=Bt(),e=t.layout.minTextWidth+t.layout.backgrounds.width;return this.screenWidth/e}},methods:{async setupMachine(){const t=Bt().scripts;return _n().setup(t,Bt())},getSaveFile(){return localStorage.getItem(K7)},async startGame(){Ec("onPressStart"),await _n().startGame()},async loadGame(){Ec("onPressStart"),_n().loadGame(this.getSaveFile())},nextLine(){sn().nextLine()},updateScreenSize(){uu().updateScreenSize(window.innerWidth,window.innerHeight,this.layoutMode==="horizontal"?Bt().layout.minTextWidth*this.screenRatio:0)},closeModal(){_n().closeModal()}}}),kG={key:2,id:"game-menu",style:{height:"100%",padding:"20px"}},wG={id:"game-header"},jG={id:"game-title-container"},xG={id:"game-title-text"},_G={class:"flex flex-col"},SG={key:3};function CG(t,e,n,r,o,i){const a=C.resolveComponent("Hud"),s=C.resolveComponent("MenuButtons"),u=C.resolveComponent("Skills"),c=C.resolveComponent("InventoryUi"),f=C.resolveComponent("QuestsUi"),l=C.resolveComponent("MainMenu"),d=C.resolveComponent("Screens"),h=C.resolveComponent("GameDialog"),p=C.resolveComponent("LoadingBar"),v=C.resolveComponent("DebugMenu"),g=C.resolveComponent("NotificationToast");return C.openBlock(),C.createElementBlock("div",{id:"app",style:C.normalizeStyle(t.appStyle)},[t.inGame?(C.openBlock(),C.createBlock(a,{key:0})):C.createCommentVNode("",!0),t.inGame?(C.openBlock(),C.createElementBlock("div",{key:1,class:"game",style:C.normalizeStyle(t.gameStyle)},[C.createVNode(s,{class:"menu-toggle"}),t.modal==="skills"?(C.openBlock(),C.createBlock(u,{key:0,onClose:t.closeModal},null,8,["onClose"])):C.createCommentVNode("",!0),t.modal==="inventory"?(C.openBlock(),C.createBlock(c,{key:1,onClose:t.closeModal},null,8,["onClose"])):C.createCommentVNode("",!0),t.modal==="quests"?(C.openBlock(),C.createBlock(f,{key:2,onClose:t.closeModal},null,8,["onClose"])):C.createCommentVNode("",!0),t.modal==="menu"?(C.openBlock(),C.createBlock(l,{key:3,onClose:t.closeModal},null,8,["onClose"])):C.createCommentVNode("",!0),C.createVNode(d),C.createVNode(h,{inGame:t.inGame,layoutMode:t.layoutMode},null,8,["inGame","layoutMode"])],4)):t.gameLoaded?(C.openBlock(),C.createElementBlock("div",kG,[C.createElementVNode("div",wG,[C.createElementVNode("div",jG,[C.createElementVNode("h1",xG,C.toDisplayString(t.gameTitle),1)]),C.createElementVNode("div",_G,[C.createElementVNode("button",{class:"button menu-button main-menu-button larg start-button override",onClick:e[0]||(e[0]=(...m)=>t.startGame&&t.startGame(...m))}," Start Game "),t.hasSave?(C.openBlock(),C.createElementBlock("button",{key:0,class:"button menu-button main-menu-button large continue-button override",onClick:e[1]||(e[1]=(...m)=>t.loadGame&&t.loadGame(...m))}," Continue Game ")):C.createCommentVNode("",!0)])])])):(C.openBlock(),C.createElementBlock("div",SG,[C.createVNode(p,{percentage:t.loadingPercentage,step:t.loadingStep},null,8,["percentage","step"])])),t.options.debug?(C.openBlock(),C.createBlock(v,{key:4})):C.createCommentVNode("",!0),C.createVNode(g)],4)}const $G=Vr(bG,[["render",CG]]);function ln(t,e){console.error("Runtime error ========================="),console.error(`Command: ${t.commandType}`),console.error("Args: ",t.args),console.error("Options: ",t.options),cr(`Runtime error at ${t.fileName}:${t.line} (${t.commandType}) ${t.code}. -
182
+ <br />`),e.createError(`\u274C ${t}`)}const ir=Uo("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=Ed(this.skillChecks,t.skillChecks),this.skills=Ed(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||cr(`Skill ${t} doesn't exist`),n.xp+=e,n.xp>=Bt().skillOptions.xpPerLevel&&(n.xp=0,n.level++,this.levelledUp(t))},setSkillLevel(t,e){const n=this.getSkill(t);n||cr(`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=Bt().skills[t].name,n=this.skills[t].level;Si().addNotification(`Your skill in ${e} is now level ${n}`)}}});let v8;const iU=C.defineComponent({components:{Modal:fu},setup(){const t=ir(),e=C.computed(()=>t.skills),n=C.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];sn().runLabel(e),this.finishJumping()}})},methods:{finishJumping(){this.jumping=!1,this.matches=[],this.searchString=""},labelSelected(t){const e=t.target.value;sn().runLabel(e),this.close()},close(){this.showDebug=!1},closeErrors(){_n().clearErrors()},open(){this.showDebug=!0;const t=sn(),e=_n(),n=Br(),r=Cr(),o=ir();this.$nextTick(()=>{new y7({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 y7({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(){v8=new fs(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=v8.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(){_n().saveGame()},wordCount(){const e=Object.values(this.script).reduce((n,r)=>(Oo.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=zd(this.playTime.start,this.playTime.previousPlaytime);return a0(t/1e3)}},computed:{..._i(sn,["script","data"]),..._i(_n,["playTime","errors","playing","flowState"]),labels(){const t=this.script;return Object.keys(t).sort()},variables(){return this.data}}}),lQ="",aU={class:"debug-menu"},sU={key:0,class:"debug-info"},uU=[C.createElementVNode("h3",null,"Debug mode is ON",-1),C.createElementVNode("ul",null,[C.createElementVNode("li",null,[C.createElementVNode("b",null,"j"),C.createTextVNode(": Quick Label Jump")]),C.createElementVNode("li",null,[C.createElementVNode("b",null,"d"),C.createTextVNode(": Debug Menu")]),C.createElementVNode("li",null,[C.createElementVNode("b",null,"Escape"),C.createTextVNode(": Toggle Menu")])],-1)],cU=C.createElementVNode("h3",{class:"title"},"Jump to label",-1),lU={key:0,class:"search-results"},fU={key:1},dU=[C.createElementVNode("h3",null,"No matches found",-1)],hU=C.createElementVNode("h3",{class:"title"},"Error(s)",-1),pU=C.createTextVNode(" There are errors in your dialogue scripts. Open the developer console for more details. "),vU=["innerHTML"],mU=C.createElementVNode("h3",{class:"title"},"Debug Menu!",-1),gU={class:"container"},yU=C.createTextVNode(" Hello this is the debug menu. "),bU=C.createElementVNode("option",{class:"option",selected:"",disabled:""},"Jump to a label",-1),kU=["value"],wU={class:"grid grid-cols-3 gap-4"},jU=C.createElementVNode("h2",null,"Variables Editor",-1),xU={ref:"variablesViewer"},_U=C.createElementVNode("h2",null,"Skill Checks",-1),SU={class:"table-auto"},CU=C.createElementVNode("thead",null,[C.createElementVNode("tr",null,[C.createElementVNode("th",null,"Skill Check"),C.createElementVNode("th",null,"Happened"),C.createElementVNode("th",null,"Succeeded")])],-1),$U=C.createElementVNode("h2",null,"App State editor (entire app and engine",-1),OU=C.createElementVNode("h3",{style:{color:"pink"}}," Use for debugging, editing some of those things can cause issues ",-1),AU={ref:"stateViewer"};function EU(t,e,n,r,o,i){const a=C.resolveComponent("modal");return C.openBlock(),C.createElementBlock("div",aU,[C.createElementVNode("button",{onClick:e[0]||(e[0]=(...s)=>t.open&&t.open(...s)),class:"button debug-button"},"Debug Menu"),!t.playing&&t.flowState==="menu"?(C.openBlock(),C.createElementBlock("div",sU,uU)):C.createCommentVNode("",!0),t.jumping?(C.openBlock(),C.createBlock(a,{key:1,onClose:t.finishJumping,containerCssClass:"jump-menu-container"},{header:C.withCtx(()=>[cU]),body:C.withCtx(()=>[C.withDirectives(C.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),[[C.vModelText,t.searchString]]),t.matches.length>0?(C.openBlock(),C.createElementBlock("div",lU,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.matches,(s,u)=>(C.openBlock(),C.createElementBlock("div",{class:"search-result",style:C.normalizeStyle(t.getMatchResultStyle(u)),key:u},C.toDisplayString(s),5))),128))])):(C.openBlock(),C.createElementBlock("div",fU,dU))]),_:1},8,["onClose"])):C.createCommentVNode("",!0),t.errors.length>0?(C.openBlock(),C.createBlock(a,{key:2,onClose:t.closeErrors,containerCssClass:"debug-menu-container"},{header:C.withCtx(()=>[hU]),body:C.withCtx(()=>[pU,C.createElementVNode("ul",null,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.errors,(s,u)=>(C.openBlock(),C.createElementBlock("li",{key:u,class:"error-message list-disc",innerHTML:s.text},null,8,vU))),128))])]),_:1},8,["onClose"])):C.createCommentVNode("",!0),t.showDebug?(C.openBlock(),C.createBlock(a,{key:3,onClose:t.close,containerCssClass:"debug-menu-container"},{header:C.withCtx(()=>[mU]),body:C.withCtx(()=>[C.createElementVNode("div",gU,[yU,C.createElementVNode("select",{class:"select",name:"label-selector",onChange:e[3]||(e[3]=s=>t.labelSelected(s))},[bU,(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.labels,s=>(C.openBlock(),C.createElementBlock("option",{class:"option",value:s,key:s},C.toDisplayString(s),9,kU))),128))],32),C.createElementVNode("div",wU,[C.createElementVNode("button",{onClick:e[4]||(e[4]=(...s)=>t.wordCount&&t.wordCount(...s)),class:"button"},"Word Count"),C.createElementVNode("button",{onClick:e[5]||(e[5]=(...s)=>t.save&&t.save(...s)),class:"button"},"Save Game")]),C.createElementVNode("h3",null,"Play time: "+C.toDisplayString(t.getPlayTimeString()),1),jU,C.createElementVNode("div",xU,null,512),_U,C.createElementVNode("table",SU,[CU,C.createElementVNode("tbody",null,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.skillChecks,(s,u)=>(C.openBlock(),C.createElementBlock("tr",{key:u},[C.createElementVNode("td",null,C.toDisplayString(u),1),C.createElementVNode("td",null,C.toDisplayString(s.happened?"\u2705":"\u274C"),1),C.createElementVNode("td",null,C.toDisplayString(s.happened?s.succeeded?"\u2705":"\u274C":"NA"),1)]))),128))])]),$U,OU,C.createElementVNode("div",AU,null,512)])]),_:1},8,["onClose"])):C.createCommentVNode("",!0)])}const PU=Vr(iU,[["render",EU]]),TU=C.defineComponent({data(){return{}},methods:{getStatImage(t){return $c(this.statsConfig[t].icon)}},computed:{..._i(Hi,["hudStats"]),..._i(uu,["layoutMode"]),statsConfig(){return Bt().hudStats},stats(){return this.hudStats},hudStyle(){let t="0";return this.layoutMode==="horizontal"&&(t=`${Bt().layout.minTextWidth}px`),{right:t}}}}),pQ="",MU=["src"],IU={class:"bold hud-text"},NU=C.createTextVNode(": ");function LU(t,e,n,r,o,i){return C.openBlock(),C.createElementBlock("div",{class:"hud",style:C.normalizeStyle(t.hudStyle)},[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.stats,(a,s)=>(C.openBlock(),C.createElementBlock("div",{key:s,class:"hud-stat"},[C.createElementVNode("img",{class:"hud-icon",src:t.getStatImage(s)},null,8,MU),C.createElementVNode("span",IU,C.toDisplayString(t.statsConfig[s].name),1),NU,C.createElementVNode("span",null,C.toDisplayString(Math.floor(a.value*100)/100),1)]))),128))],4)}const RU=Vr(TU,[["render",LU]]),DU=C.defineComponent({props:{percentage:Number,step:String},methods:{loadingStyle(){return{width:`${this.percentage*40}vw`}}},computed:{}}),vQ="",BU={id:"loading-bar"},zU={id:"loading-text"};function VU(t,e,n,r,o,i){return C.openBlock(),C.createElementBlock("div",BU,[C.createElementVNode("div",{id:"inner-loading-bar",style:C.normalizeStyle(t.loadingStyle())},null,4),C.createElementVNode("div",zU,[C.createElementVNode("h3",null,"Loading "+C.toDisplayString(Math.floor(t.percentage*100))+"% - "+C.toDisplayString(t.step),1)])])}const FU=Vr(DU,[["render",VU]]),qU=C.defineComponent({data(){},methods:{},computed:{..._i(Si,["notifications"])}}),mQ="";function HU(t,e,n,r,o,i){return C.openBlock(),C.createBlock(C.TransitionGroup,{name:"notification",tag:"div",class:"notifications-holder"},{default:C.withCtx(()=>[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.notifications,(a,s)=>(C.openBlock(),C.createElementBlock("div",{class:"notification",key:s},[C.createElementVNode("h3",null,C.toDisplayString(a.text),1)]))),128))]),_:1})}const WU=Vr(qU,[["render",HU]]);let Hg;function UU(t){Hg=t}function Wg(t){return Hg.characters[t]}function JU(t,e){const n=Wg(t);if(e||(e="default"),n.sprites)return`${Hg.config.imagesPath}${n.sprites[e]}`}function Pd(t){return t?Wg(t).style||{}:{}}function m8(t,e,n,r){const o=t/n,i=e/r;return Math.min(o,i)}let g8=0,y8=0;function GU(t){return Oo.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];KU(r,o,e,n)}})}function KU(t,e,n,r){g8++,Oo.log(`Loading image ${t} at ${e}`);const o=new Image;o.onload=()=>{y8+=1,Oo.log(`Loaded image ${t} successfully`),y8>=g8&&(Oo.log("All images loaded"),n())},o.onerror=i=>{console.error(`Error loading image ${t}`),r(i)},o.src=e}function QU(t,e=50,n={}){var l,d;let r;const o=(l=n.isImmediate)!=null?l:!1,i=(d=n.callback)!=null?d:!1,a=n.maxWait;let s=Date.now(),u=[];function c(){if(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 b=t.apply(p,h);i&&i(b),u.forEach(({resolve:k})=>k(b)),u=[]}},y=o&&r===void 0;if(r!==void 0&&clearTimeout(r),r=setTimeout(m,c()),y){const b=t.apply(p,h);return i&&i(b),v(b)}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 YU=C.defineComponent({data(){return{muted:!1}},mounted(){const t=wa.Howler.volume();this.$refs.slider.value=t},methods:{changeVolume(t){const e=t.target;wa.Howler.volume(e.value)},toggleMute(){this.muted?(wa.Howler.mute(!1),this.muted=!1):(wa.Howler.mute(!0),this.muted=!0)}}}),gQ="",XU={class:"volume-controls"},ZU=C.createElementVNode("label",{for:"volume",class:"volume-label"},"Volume",-1);function eJ(t,e,n,r,o,i){return C.openBlock(),C.createElementBlock("div",XU,[ZU,C.createElementVNode("input",{ref:"slider",class:"volume-slider",type:"range",id:"volume",name:"volume",min:"0",max:"1",step:"0.1",value:"0.5",onChange:e[0]||(e[0]=(...a)=>t.changeVolume&&t.changeVolume(...a))},null,544)])}const tJ=Vr(YU,[["render",eJ]]),nJ=C.defineComponent({components:{Modal:fu,VolumeControls:tJ},data(){return{}},mounted(){},methods:{quit(){window.close()},mainMenu(){_n().menuReturn(),this.closeMenu()},closeMenu(){this.$emit("close")},getPlayTimeString(){const t=zd(this.playTime.start,this.playTime.previousPlaytime);return a0(t/1e3)}},computed:{..._i(_n,["playTime"])}}),yQ="",rJ=C.createElementVNode("h3",{class:"title"},"Menu",-1),oJ={class:"menu-content"};function iJ(t,e,n,r,o,i){const a=C.resolveComponent("VolumeControls"),s=C.resolveComponent("modal");return C.openBlock(),C.createBlock(s,{class:"menu",onClose:e[2]||(e[2]=u=>t.$emit("close")),containerCssClass:"menu-modal"},{header:C.withCtx(()=>[rJ]),body:C.withCtx(()=>[C.createElementVNode("div",oJ,[C.createElementVNode("h3",null,"Play time: "+C.toDisplayString(t.getPlayTimeString()),1),C.createVNode(a),C.createElementVNode("button",{class:"button title quit-button",onClick:e[0]||(e[0]=(...u)=>t.mainMenu&&t.mainMenu(...u))}," Main Menu "),C.createElementVNode("button",{class:"button title quit-button",onClick:e[1]||(e[1]=(...u)=>t.quit&&t.quit(...u))},"Exit")])]),_:1})}const aJ=Vr(nJ,[["render",iJ]]),sJ=C.defineComponent({setup(){const t=ir();return{skills:C.computed(()=>t.skills)}},components:{Modal:fu},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 Bt().skills},xpPerLevel(){return Bt().skillOptions.xpPerLevel}}}),bQ="",uJ=C.createElementVNode("h3",{class:"title"},"Skills",-1),cJ={key:0,class:"skills-container"},lJ=["onClick"],fJ={class:"skill-title"},dJ={class:"skill-xp-container"},hJ={class:"skill-xp-text"},pJ={class:"skill-level"},vJ={key:1},mJ={class:"flex flex-row skill-description-container"},gJ={class:"flex skill-left"},yJ={class:"flex skill-right"},bJ=C.createElementVNode("hr",{class:"hr-solid"},null,-1);function kJ(t,e,n,r,o,i){const a=C.resolveComponent("modal");return C.openBlock(),C.createBlock(a,{class:"menu",onClose:e[1]||(e[1]=s=>t.$emit("close")),containerCssClass:"skills-modal"},{header:C.withCtx(()=>[uJ]),body:C.withCtx(()=>[t.chosenSkill?typeof t.chosenSkill=="string"?(C.openBlock(),C.createElementBlock("div",vJ,[C.createElementVNode("div",mJ,[C.createElementVNode("div",gJ,[C.createElementVNode("div",{class:"skill-display",style:C.normalizeStyle(t.getSkillStyle(t.chosenSkill))},null,4)]),C.createElementVNode("div",yJ,[C.createElementVNode("h2",null,C.toDisplayString(t.getSkillName(t.chosenSkill)),1),bJ,C.createElementVNode("h3",null,"Level: "+C.toDisplayString(t.skills[t.chosenSkill].level),1),C.createElementVNode("p",null,C.toDisplayString(t.skillConf[t.chosenSkill].description),1)])]),C.createElementVNode("button",{class:"button",onClick:e[0]||(e[0]=(...s)=>t.closeSkill&&t.closeSkill(...s))},C.toDisplayString("<--"))])):C.createCommentVNode("",!0):(C.openBlock(),C.createElementBlock("div",cJ,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.skillsToDisplay,s=>(C.openBlock(),C.createElementBlock("button",{onClick:()=>t.clickSkill(s.id),class:"skill-display",style:C.normalizeStyle(t.getSkillStyle(s.id)),key:s.id},[C.createElementVNode("h3",fJ,C.toDisplayString(t.getSkillName(s.id)),1),C.createElementVNode("div",dJ,[C.createElementVNode("div",{class:"skill-xp-bar",style:C.normalizeStyle(t.xpBarWidth(s.xp))},null,4),C.createElementVNode("h3",hJ,C.toDisplayString(s.xp)+" / "+C.toDisplayString(t.xpPerLevel)+" XP",1)]),C.createElementVNode("h3",pJ,C.toDisplayString(s.level),1)],12,lJ))),128))]))]),_:1})}const wJ=Vr(sJ,[["render",kJ]]),jJ=C.defineComponent({setup(){const t=Cr(),e=co(),n=C.computed(()=>t.items),r=C.computed(()=>e.currentDialog.choices);return{items:n,currentlyChoosing:r}},components:{Modal:fu},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"?sn().runLabel(t.label):t.action==="run"?sn().runLabelFunction(t.label,!0):cr(`Unknown action ${t.action}`)}},canUseItem(t){const e=this.itemConf[t.id];return!!(e&&e.onUse&&!Cr().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 Bt().items}}}),kQ="",xJ=C.createElementVNode("h3",{class:"title"},"Inventory",-1),_J={key:0,class:"inventory-container"},SJ=["onClick"],CJ={class:"item-title"},$J={class:"item-amount"},OJ={key:1},AJ={class:"flex flex-row item-description-container"},EJ={class:"flex item-left"},PJ={class:"flex item-right"},TJ=C.createElementVNode("hr",{class:"hr-solid"},null,-1),MJ={key:2},IJ=[C.createElementVNode("h2",null,"The inventory is empty!",-1)];function NJ(t,e,n,r,o,i){const a=C.resolveComponent("modal");return C.openBlock(),C.createBlock(a,{class:"menu",onClose:t.close,containerCssClass:"inventory-modal"},{header:C.withCtx(()=>[xJ]),body:C.withCtx(()=>[!t.chosenItem&&Object.keys(t.itemsToDisplay).length>0?(C.openBlock(),C.createElementBlock("div",_J,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.itemsToDisplay,s=>(C.openBlock(),C.createElementBlock("button",{onClick:()=>t.clickItem(s.id),class:"item-display",style:C.normalizeStyle(t.getItemStyle(s.id)),key:s.id},[C.createElementVNode("h3",CJ,C.toDisplayString(t.getItemName(s.id)),1),C.createElementVNode("h3",$J,C.toDisplayString(s.amount),1)],12,SJ))),128))])):typeof t.chosenId=="string"?(C.openBlock(),C.createElementBlock("div",OJ,[C.createElementVNode("div",AJ,[C.createElementVNode("div",EJ,[C.createElementVNode("div",{class:"item-display",style:C.normalizeStyle(t.getItemStyle(t.chosenId))},null,4)]),C.createElementVNode("div",PJ,[C.createElementVNode("h2",null,C.toDisplayString(t.getItemName(t.chosenId)),1),TJ,C.createElementVNode("h3",null,"Amount: "+C.toDisplayString(t.chosenItem.amount),1),C.createElementVNode("p",null,C.toDisplayString(t.chosenItemConf.description),1),C.createElementVNode("button",{onClick:e[0]||(e[0]=(...s)=>t.useItem&&t.useItem(...s)),class:C.normalizeClass(["button",t.canUseChosenItem?"":"disabled"])}," Use ",2)])]),C.createElementVNode("button",{class:"button",onClick:e[1]||(e[1]=(...s)=>t.closeItem&&t.closeItem(...s))},C.toDisplayString("<--"))])):(C.openBlock(),C.createElementBlock("div",MJ,IJ))]),_:1},8,["onClose"])}const LJ=Vr(jJ,[["render",NJ]]),RJ=C.defineComponent({props:{pictureUrl:String},computed:{..._i(uu,["layoutMode"]),boxStyle(){const t=Bt().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`}}}}),jQ="",DJ=["src"];function BJ(t,e,n,r,o,i){return C.openBlock(),C.createElementBlock("div",{class:"dialog-picture override",style:C.normalizeStyle(t.boxStyle)},[C.createElementVNode("img",{src:t.pictureUrl,class:"picture override"},null,8,DJ)],4)}const zJ=Vr(RJ,[["render",BJ]]),VJ=C.defineComponent({data(){return{playerText:"",passed:!1}},props:{options:{type:Object,required:!0},active:Boolean},mounted(){document.addEventListener("keydown",t=>{if(this.canInteract&&this.options.textField&&t.key==="Enter"&&this.submitText(),this.canInteract&&!this.options.textField){let e=-1;if(t.key===" ")this.choices?e=0:this.chooseOption(0);else switch(t.key){case" ":e=0;break;case"1":e=0;break;case"2":e=1;break;case"3":e=2;break;case"4":e=3;break;case"5":e=4;break;case"6":e=5;break;case"7":e=6;break;case"8":e=7;break}e!==-1&&this.choices&&e<this.choices.length&&this.chooseOption(this.choices[e])}}),setTimeout(()=>{this.options.textField&&this.$refs.playerInput.focus()},10)},computed:{..._i(_n,["paused"]),preText(){return this.options.title?" &nbsp;\u2013&nbsp; ":""},style(){return Pd(this.options.styleId)},dialogBoxStyle(){const t=Pd(this.options.styleId),e={opacity:this.options.old?"0.7":"1"};return this.options.title||(e.marginTop="-20px"),{...t.boxCss,...e}},titleStyle(){const t=Pd(this.options.styleId);return{color:t.color,...t.nameCss}},textStyle(){return Pd(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:{chooseOption(t){this.passed=!0;let e;typeof t=="object"?e=t.originalIndex:e=t,_n().playerAnswered(e)},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;_n().playerAnswered(t)}}}),xQ="",FJ={class:"dialog-content"},qJ=["innerHTML"],HJ=["innerHTML"],WJ=["innerHTML"],UJ={key:1,class:"dialog-choices"},JJ=["onClick","innerHTML"],GJ={key:2},KJ={key:3,class:"buttons-container"};function QJ(t,e,n,r,o,i){return C.openBlock(),C.createElementBlock("div",{class:"dialog-box w-full override",style:C.normalizeStyle(t.dialogBoxStyle)},[C.createElementVNode("div",FJ,[t.options.title?(C.openBlock(),C.createElementBlock("span",{key:0,class:"dialog-title override",style:C.normalizeStyle(t.titleStyle),innerHTML:t.options.title},null,12,qJ)):C.createCommentVNode("",!0),C.createElementVNode("span",{class:"dialog-text dialog-separator override",style:C.normalizeStyle(t.textStyle),innerHTML:t.preText},null,12,HJ),C.createElementVNode("span",{class:"dialog-text override",style:C.normalizeStyle(t.textStyle),innerHTML:t.options.text},null,12,WJ),t.canInteract&&t.choices?(C.openBlock(),C.createElementBlock("div",UJ,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.choices,(a,s)=>(C.openBlock(),C.createElementBlock("p",{key:s,style:C.normalizeStyle(t.dialogStyle(a)),class:C.normalizeClass([t.dialogClass(a),"dialog-choice override"]),onClick:u=>t.chooseOption(a),innerHTML:`${s+1}. \u2013\xA0 ${a.choice}`},null,14,JJ))),128))])):t.canInteract&&t.options.textField?(C.openBlock(),C.createElementBlock("div",GJ,[C.withDirectives(C.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),[[C.vModelText,t.playerText]]),C.createElementVNode("button",{onClick:e[1]||(e[1]=(...a)=>t.submitText&&t.submitText(...a)),class:"button",id:"player-input-submit"}," Submit ")])):t.canInteract?(C.openBlock(),C.createElementBlock("div",KJ,[C.createElementVNode("div",{onClick:e[2]||(e[2]=a=>t.chooseOption(0)),class:"interact-button button override"}," Continue ")])):C.createCommentVNode("",!0)])],4)}const YJ=Vr(VJ,[["render",QJ]]),XJ=C.createElementVNode("div",{class:"anchor"},null,-1),ZJ=C.defineComponent({__name:"game-dialog",props:{layoutMode:String,inGame:Boolean},setup(t){const e=t,n=sn(),r=C.computed(()=>n.stack),o=co(),i=C.computed(()=>o.dialog),a=C.ref(null),s=C.computed(()=>e.layoutMode==="vertical"?{}:{paddingBottom:`${Bt().layout.dialogBottomPadding}px`}),u=C.computed(()=>{if(i.value.length>0)return i.value[i.value.length-1]}),c=C.computed(()=>{if(u.value)return JU(u.value.speaker,u.value.pose)}),f=C.computed(()=>Bt().layout.minTextWidth),l=C.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=Wg(p.speaker).name;return v>=1&&i.value[v-1].speaker===p.speaker&&(m=void 0),p.choices&&p.choices.forEach(y=>{y.choice=a8(y.choice)}),{title:m!=null?m:"",text:p.text,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 C.watch(i.value,p=>{if(a.value){const v=a.value;v.scrollTop=v.scrollHeight+1e8}}),(p,v)=>(C.openBlock(),C.createElementBlock(C.Fragment,null,[C.createVNode(C.Transition,{name:"fade"},{default:C.withCtx(()=>[C.unref(c)?(C.openBlock(),C.createBlock(zJ,{key:0,pictureUrl:C.unref(c)},null,8,["pictureUrl"])):C.createCommentVNode("",!0)]),_:1}),t.inGame?(C.openBlock(),C.createElementBlock("div",{key:0,class:"dialog override",ref_key:"dialogRef",ref:a,style:C.normalizeStyle(C.unref(l))},[C.createVNode(C.TransitionGroup,{name:"list",tag:"div",class:"dialog-container w-full override",style:C.normalizeStyle(C.unref(s))},{default:C.withCtx(()=>[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(C.unref(i),(g,m)=>(C.openBlock(),C.createBlock(YJ,{key:g.id,options:d(g,m),active:h(m)},null,8,["options","active"]))),128))]),_:1},8,["style"]),XJ],4)):C.createCommentVNode("",!0)],64))}}),_Q="",b8=(t,e)=>{const n={};for(const r in t)e(t[r])&&(n[r]=t[r]);return n},eG=C.defineComponent({setup(){const t=Br();return{quests:C.computed(()=>t.quests)}},computed:{questsToDisplay(){return b8(this.quests,t=>t.state!=="hidden")}},methods:{close(){this.$emit("close")},getQuestData(t){return xd(t)},getObjectiveData(t,e){return Ag(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 b8(t.objectives,e=>e.state!=="hidden")}},components:{Modal:fu}}),SQ="",tG=C.createElementVNode("h3",{class:"title"},"Quests",-1),nG={key:0,class:"quests-container"},rG={class:"quest-title"},oG={class:"quest-description"},iG={key:0,class:"quest-objectives-container list-disc"},aG={key:1,class:"menu-container"},sG=[C.createElementVNode("h2",{class:"title"},"There are no quests!",-1)];function uG(t,e,n,r,o,i){const a=C.resolveComponent("modal");return C.openBlock(),C.createBlock(a,{class:"quests",onClose:t.close,containerCssClass:"quests-modal"},{header:C.withCtx(()=>[tG]),body:C.withCtx(()=>[Object.keys(t.questsToDisplay).length>0?(C.openBlock(),C.createElementBlock("div",nG,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.questsToDisplay,s=>(C.openBlock(),C.createElementBlock("div",{class:"quest-display",key:s.id},[C.createElementVNode("div",{class:C.normalizeClass(["quest-header",s.state==="completed"?"quest-completed":"quest-in-progress"])},[C.createElementVNode("h3",rG,C.toDisplayString(t.getQuestData(s.id).title)+" "+C.toDisplayString(t.getDisplayTextForQuestState(s)),1)],2),C.createElementVNode("p",oG,C.toDisplayString(t.getQuestDescription(s)),1),s.state!=="completed"?(C.openBlock(),C.createElementBlock("ul",iG,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.getAvailableObjectives(s),u=>(C.openBlock(),C.createElementBlock("li",{class:"quest-objective-display",key:u.id},[C.createElementVNode("p",{class:C.normalizeClass(["quest-objective-description",u.state==="completed"?"quest-objective-completed":"quest-objctive-in-progress"])},C.toDisplayString(t.getObjectiveData(s.id,u.id).description),3)]))),128))])):C.createCommentVNode("",!0)]))),128))])):(C.openBlock(),C.createElementBlock("div",aG,sG))]),_:1},8,["onClose"])}const cG=Vr(eG,[["render",uG]]),lG=C.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()}),or.callHook("onGameMounted")},unmounted(){or.callHook("onGameUnmounted")},methods:{buttonClick(t){t.onClick?t.onClick():_n().openModal(t.id)},openMenu(){_n().openModal("menu")},openSkills(){_n().openModal("skills")},openInventory(){_n().openModal("inventory")},openQuests(){_n().openModal("quests")},closeMenu(){_n().closeModal()},toggleMenu(){_n().toggleMenu()}},computed:{buttonsToShow(){return this.buttons.map(t=>{const e=Bt().menuButtons[t.id]||{};return{...t,...e}}).filter(t=>t.condition?t.condition():!0)},showSkills(){return Object.entries(Bt().skills).length>0},showInventory(){return Object.entries(Bt().items).length>0},showQuests(){return Object.entries(Bt().quests).length>0}}}),$Q="",fG={class:"menu-container"},dG=["onClick","id"];function hG(t,e,n,r,o,i){return C.openBlock(),C.createElementBlock("div",fG,[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(t.buttonsToShow,a=>(C.openBlock(),C.createElementBlock("button",{key:a.id,onClick:s=>t.buttonClick(a),id:a.cssId,class:"button menu-toggle-button"},C.toDisplayString(a.text),9,dG))),128))])}const pG=Vr(lG,[["render",hG]]),vG=["id"],mG=["id","onClick"],gG=C.defineComponent({__name:"screen-layer",props:{layer:String},setup(t){const e=t,n=sn(),r=_n(),o=Ci(),i=C.computed(()=>e.layer),a=C.computed(()=>o.buttons),s=C.computed(()=>{const p=Bt().screens[i.value];if(!p)throw new Error(`Screen ${i.value} doesn't have a config`);return p}),u=C.computed(()=>s.value.buttons||[]),c=C.computed(()=>r.isInGame);function f(p){const g=jd(p).background;if(!!g)return S7(g)}function l(p){const v=jd(p),g={};v.position.width&&(g.width=`${v.position.width}px`),v.position.height&&(g.height=`${v.position.height}px`),v.background&&(g.backgroundImage=`url(${f(p)})`);const m=a.value[p].state;m==="greyed"?(g.opacity=.3,g.pointerEvents="none"):(m==="hidden"||m===!1)&&(g.display="none");let y=v.position.left,b=v.position.top;return v.anchor&&(y=v.position.left-v.position.width*v.anchor.x,b=v.position.top-v.position.height*v.anchor.y),{...g,left:`${y}px`,top:`${b}px`}}function d(p){const v=jd(p);if(a.value[p].state===!0){const m=v.action,y={branchData:n.script[m],currentIndex:0,label:m};n.setStack(y),n.runLine()}}const h=C.computed(()=>({backgroundImage:`url(${S7(s.value.background)})`}));return(p,v)=>C.unref(c)?(C.openBlock(),C.createElementBlock("div",{key:0,class:"viewport-layer",id:`viewport-layer-${C.unref(i)}`,style:C.normalizeStyle(C.unref(h))},[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(C.unref(u),(g,m)=>(C.openBlock(),C.createElementBlock("button",{key:m,class:"viewport-button",id:`viewport-button-${g}`,onClick:y=>d(g),style:C.normalizeStyle(l(g))},C.toDisplayString(C.unref(jd)(g).text),13,mG))),128))],12,vG)):C.createCommentVNode("",!0)}}),OQ="",yG=C.defineComponent({__name:"screens",setup(t){const e=uu(),n=_n(),r=Ci(),o=C.computed(()=>r.layers.filter(f=>f)),i=C.computed(()=>e.layoutMode),a=C.computed(()=>Bt().layout.backgrounds.width),s=C.computed(()=>Bt().layout.backgrounds.height),u=C.computed(()=>n.isInGame),c=C.computed(()=>{const f=`${a.value}px`;let l=`${s.value}px`;return i.value==="vertical"&&(l=`${100-Bt().layout.mobileDialogHeightPercentage}%`),{height:l,width:f}});return(f,l)=>C.unref(u)?(C.openBlock(),C.createElementBlock("div",{key:0,class:"viewport",id:"narrat-viewport",style:C.normalizeStyle(C.unref(c))},[(C.openBlock(!0),C.createElementBlock(C.Fragment,null,C.renderList(C.unref(o),(d,h)=>(C.openBlock(),C.createBlock(gG,{key:h,layer:d},null,8,["layer"]))),128))],4)):C.createCommentVNode("",!0)}}),AQ="",bG=C.defineComponent({setup(){const t=co(),e=sn(),n=_n();return{dialog:C.computed(()=>t.dialog),stack:C.computed(()=>e.stack),modal:C.computed(()=>n.modal),flowState:C.computed(()=>n.flowState)}},$refs:{dialogContainer:HTMLInputElement},inject:["mq"],components:{DebugMenu:PU,LoadingBar:FU,NotificationToast:WU,Hud:RU,MainMenu:aJ,Skills:wJ,InventoryUi:LJ,GameDialog:ZJ,QuestsUi:cG,MenuButtons:pG,Screens:yG},data(){return{lineTitle:"title",lineText:"hello",gameLoaded:!1,loadingStep:"Loading",loadingPercentage:.1,hasSave:!1}},props:{config:Object,options:Object},async mounted(){or.callHook("onAppMounted"),this.loadingStep="Characters";const t=await Bg(this.config.charactersPath);await UU(JSON.parse(t)),this.loadingPercentage=.2,this.loadingStep="Data",this.loadingPercentage=.3,this.loadingStep="Images",await GU(Bt()),this.loadingPercentage=.7,this.loadingStep="Audio",await bW(Bt()),or.callHook("onAssetsLoaded"),this.loadingPercentage=.95,this.loadingStep="Starting...",await this.setupMachine(),or.callHook("onGameSetup"),this.loadingPercentage=.1,this.gameLoaded=!0,this.getSaveFile()&&(this.hasSave=!0),window.addEventListener("resize",QU(()=>{this.updateScreenSize()},100,{maxWait:200})),setTimeout(()=>{this.updateScreenSize()},50)},computed:{..._i(uu,["screenWidth","screenHeight","canvasWidth","canvasHeight","topOffset","leftOffset","layoutMode"]),..._i(sn,["currentLine"]),backgroundStyle(){let t;return this.layoutMode==="vertical"&&(t=`${100-Bt().layout.mobileDialogHeightPercentage}%`),{backgroundColor:"red",height:t}},layoutWidth(){return Bt().layout.backgrounds.width},gameTitle(){return Bt().gameTitle},inGame(){return this.flowState==="playing"},layoutHeight(){return Bt().layout.backgrounds.height},backgroundSize(){return{width:this.canvasWidth,height:this.canvasHeight,top:this.topOffset,left:this.leftOffset}},gameWidth(){const t=Bt();return this.layoutMode==="vertical"?window.innerWidth:t.layout.backgrounds.width+t.layout.minTextWidth},gameHeight(){const t=Bt();return this.layoutMode==="vertical"?window.innerHeight:t.layout.backgrounds.height},appStyle(){const t=Bt();if(this.screenWidth&&this.screenHeight&&t&&this.layoutMode==="horizontal"){const e=m8(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=Bt(),e=t.layout.minTextWidth+t.layout.backgrounds.width;return this.screenWidth/e}},methods:{async setupMachine(){const t=Bt().scripts;return _n().setup(t,Bt())},getSaveFile(){return localStorage.getItem(K7)},async startGame(){Ec("onPressStart"),await _n().startGame()},async loadGame(){Ec("onPressStart"),_n().loadGame(this.getSaveFile())},nextLine(){sn().nextLine()},updateScreenSize(){uu().updateScreenSize(window.innerWidth,window.innerHeight,this.layoutMode==="horizontal"?Bt().layout.minTextWidth*this.screenRatio:0)},closeModal(){_n().closeModal()}}}),EQ="",kG={key:2,id:"game-menu",style:{height:"100%",padding:"20px"}},wG={id:"game-header"},jG={id:"game-title-container"},xG={id:"game-title-text"},_G={class:"flex flex-col"},SG={key:3};function CG(t,e,n,r,o,i){const a=C.resolveComponent("Hud"),s=C.resolveComponent("MenuButtons"),u=C.resolveComponent("Skills"),c=C.resolveComponent("InventoryUi"),f=C.resolveComponent("QuestsUi"),l=C.resolveComponent("MainMenu"),d=C.resolveComponent("Screens"),h=C.resolveComponent("GameDialog"),p=C.resolveComponent("LoadingBar"),v=C.resolveComponent("DebugMenu"),g=C.resolveComponent("NotificationToast");return C.openBlock(),C.createElementBlock("div",{id:"app",style:C.normalizeStyle(t.appStyle)},[t.inGame?(C.openBlock(),C.createBlock(a,{key:0})):C.createCommentVNode("",!0),t.inGame?(C.openBlock(),C.createElementBlock("div",{key:1,class:"game",style:C.normalizeStyle(t.gameStyle)},[C.createVNode(s,{class:"menu-toggle"}),t.modal==="skills"?(C.openBlock(),C.createBlock(u,{key:0,onClose:t.closeModal},null,8,["onClose"])):C.createCommentVNode("",!0),t.modal==="inventory"?(C.openBlock(),C.createBlock(c,{key:1,onClose:t.closeModal},null,8,["onClose"])):C.createCommentVNode("",!0),t.modal==="quests"?(C.openBlock(),C.createBlock(f,{key:2,onClose:t.closeModal},null,8,["onClose"])):C.createCommentVNode("",!0),t.modal==="menu"?(C.openBlock(),C.createBlock(l,{key:3,onClose:t.closeModal},null,8,["onClose"])):C.createCommentVNode("",!0),C.createVNode(d),C.createVNode(h,{inGame:t.inGame,layoutMode:t.layoutMode},null,8,["inGame","layoutMode"])],4)):t.gameLoaded?(C.openBlock(),C.createElementBlock("div",kG,[C.createElementVNode("div",wG,[C.createElementVNode("div",jG,[C.createElementVNode("h1",xG,C.toDisplayString(t.gameTitle),1)]),C.createElementVNode("div",_G,[C.createElementVNode("button",{class:"button menu-button main-menu-button larg start-button override",onClick:e[0]||(e[0]=(...m)=>t.startGame&&t.startGame(...m))}," Start Game "),t.hasSave?(C.openBlock(),C.createElementBlock("button",{key:0,class:"button menu-button main-menu-button large continue-button override",onClick:e[1]||(e[1]=(...m)=>t.loadGame&&t.loadGame(...m))}," Continue Game ")):C.createCommentVNode("",!0)])])])):(C.openBlock(),C.createElementBlock("div",SG,[C.createVNode(p,{percentage:t.loadingPercentage,step:t.loadingStep},null,8,["percentage","step"])])),t.options.debug?(C.openBlock(),C.createBlock(v,{key:4})):C.createCommentVNode("",!0),C.createVNode(g)],4)}const $G=Vr(bG,[["render",CG]]);function ln(t,e){console.error("Runtime error ========================="),console.error(`Command: ${t.commandType}`),console.error("Args: ",t.args),console.error("Options: ",t.options),cr(`Runtime error at ${t.fileName}:${t.line} (${t.commandType}) ${t.code}. -
183
183
  <br />
184
- Error: ${e}`),console.error("============================")}function OG(t,...e){console.log(`[${t.fileName}:${t.line}] log: `,...e)}class at{constructor(e,n,r,o){Yo(this,"keyword");Yo(this,"runner");Yo(this,"argTypes");Yo(this,"parser");Yo(this,"onPlayerAnswered");Yo(this,"returnAfterPlayerAnswer");this.keyword=e,this.runner=r,this.argTypes=n,o?this.parser=o:this.parser=Mc(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)=>{sn().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 at(e.keyword,e.argTypes,e.runner,e.parser);return n.onPlayerAnswered=e.onPlayerAnswered,n.returnAfterPlayerAnswer=(r=e.returnAfterPlayerAnswer)!=null?r:!1,n}}function Mc(t,e){let n=[];if(e!=="any"){n=[e.length];const r=e.reduce((o,i)=>i.optional?o+1:o,0);if(r>1)throw new Error(`Only one optional argument is allowed for commands but ${t} has multiple ones`);r===1&&n.push(e.length-1)}return(r,o)=>{const i={newLine:r.currentLine+1},a=o.command.args;return e!=="any"&&!n.includes(a.length)?(console.log("Error details"),console.log(o.command),console.log(a),r.parserContext.error(r.line.line,`Command ${t}: Expected ${n.join(" or ")} arguments but got ${a.length}`),i):(o.command.commandType=t,e!=="any"&&o.command.args.forEach((s,u)=>{const c=e[u];!l8(s)&&!f8(s)&&(c.type==="any"||typeof s===c.type||r.parserContext.error(r.line.line,`Command ${t}: Argument #${u+1} (${c.name}) should be a ${c.type}, but got type ${typeof s}: ${JSON.stringify(s)}`))}),{newLine:r.currentLine+1})}}const AG=new at("add_level",[{name:"skillKey",type:"string"},{name:"amount",type:"number"}],async t=>{const{skillKey:e,amount:n}=t.options;(!e||!n)&&ln(t,"add_level command needs a skill id and a value as parameters"),ir().incrementSkill(e,n)}),EG=at.FromOptions({keyword:"set_level",argTypes:[{name:"skill",type:"string"},{name:"level",type:"number"}],runner:async t=>{const{skill:e,level:n}=t.options;(!e||!n)&&ln(t,"set_level command needs a skill id and a value as parameters"),ir().setSkillLevel(e,n)}}),PG=new at("add_xp",[{name:"xpKey",type:"string"},{name:"xpToAdd",type:"number"}],async t=>{const{xpKey:e,xpToAdd:n}=t.options;(!e||!n)&&ln(t,"add_xp command needs a skill id and a value as parameters"),ir().addXp(e,n)}),TG=new at("get_level",[{name:"skillKey",type:"string"}],async t=>{const{skillKey:e}=t.options;e||ln(t,"get_level command needs a skill id as parameter");const n=ir().getSkill(e);return n||ln(t,`Skill ${e} not found`),n.level}),MG=new at("get_xp",[{name:"xpKey",type:"string"}],async t=>{const{xpKey:e}=t.options;e||ln(t,"get_xp command needs a skill id as parameter");const n=ir().getSkillXp(e);return n||ln(t,`XP ${e} not found`),n}),IG=new at("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 c8({id:e,skill:n,value:r,hideAfterRoll:o}).succeeded}),NG=new at("add_stat",[{name:"statKey",type:"string"},{name:"amountToAdd",type:"number"}],async t=>{const{statKey:e,amountToAdd:n}=t.options;(!e||typeof n!="number")&&ln(t,"add_stat command needs a stat id and a value as parameters"),Hi().addStat(e,n)}),LG=new at("set_stat",[{name:"statKey",type:"string"},{name:"value",type:"number"}],async t=>{const{statKey:e,value:n}=t.options;(!e||typeof n!="number")&&ln(t,"set_stat command needs a stat id and a value as parameters"),Hi().setStat(e,n)}),RG=new at("get_stat_value",[{name:"statKey",type:"string"}],async t=>{const{statKey:e}=t.options;return e||ln(t,"get_stat_value command needs a stat id as parameter"),Hi().getStatValue(e)}),DG=at.FromOptions({keyword:"jump",argTypes:"any",runner:async t=>{(t.args.length<1||typeof t.args[0]!="string")&&ln(t,"requires a label argument");const e=t.args[0],n=sn(),r={branchData:n.script[e],label:e,args:t.args.splice(1),currentIndex:0};n.setStack(r),await _n().saveGame(),await n.runFrame()}}),BG=at.FromOptions({keyword:"run",argTypes:"any",runner:async t=>{(t.args.length<1||typeof t.args[0]!="string")&&ln(t,"run command needs a label to argument run");const e=t.args[0];return await sn().runLabelFunction(e,...t.args.slice(1))}}),zG=at.FromOptions({keyword:"var",argTypes:[{name:"name",type:"string"},{name:"value",type:"any"}],runner:async t=>{const{name:e,value:n}=t.options;sn().addScopedVariable(e,n)}}),VG=at.FromOptions({keyword:"return",argTypes:[{name:"value",type:"any"}],runner:async t=>{const{value:e}=t.options;sn().setReturnValue(e)}}),FG=at.FromOptions({keyword:"log",argTypes:"any",runner:async t=>{OG(t,...t.args)}}),Ug=[{name:"mode",type:"string"},{name:"audio",type:"string",optional:!0}],qG=new at("play",Ug,async t=>{const e=t.options;e.mode==="music"?Ad(e.audio):U7(e.audio)}),HG=new at("pause",Ug,async t=>{const e=t.options;if(e.mode==="music"){const n=uo();n.currentMusic&&G7(n.currentMusic)}else e.mode==="sound"&&e.audio?G7(e.audio):ln(t,"pause first option needs to either be in music mode, or if stopping a sound needs to have the sound name supplied as second argument.")}),WG=new at("stop",Ug,async t=>{const e=t.options;e.mode==="music"?uo().currentMusic&&uo().stopMusic():e.mode==="sound"&&e.audio?J7(e.audio):ln(t,"stop option needs to either be in music mode, or if stopping a sound needs to have the sound name supplied as second argument.")}),UG=new at("set",[{name:"key",type:"string"},{name:"value",type:"any"}],async t=>{const e=su();X7(e,t.options.key,t.options.value)}),JG=new at("add",[{name:"key",type:"string"},{name:"value",type:"any"}],async t=>{const e=su();Z7(e,t.options.key,t.options.value)}),GG=new at("set_screen",[{name:"screen",type:"string"},{name:"layer",type:"number",optional:!0}],async t=>{Ci().setScreen(t.options.screen,t.options.layer)}),KG=new at("empty_layer",[{name:"layer",type:"number"}],async t=>{Ci().emptyLayer(t.options.layer)}),QG=new at("set_button",[{name:"buttonId",type:"string"},{name:"state",type:"any"}],async t=>{const{buttonId:e,state:n}=t.options;Ci().changeButton(e,n)}),YG=at.FromOptions({keyword:"talk",argTypes:[{name:"speaker",type:"string"},{name:"pose",type:"string"},{name:"text",type:"string"}],runner:async(t,e)=>{await h8({speaker:t.options.speaker,pose:t.options.pose,text:`"${t.options.text}"`,choices:e,interactive:!0})},returnAfterPlayerAnswer:!0}),XG=()=>{const t=Mc("text",[]);return(e,n)=>{const r=t(e,n);return n.command.staticOptions={text:n.code},r}},ZG=at.FromOptions({keyword:"text",argTypes:[],runner:async(t,e)=>{await h8({speaker:"game",text:t.staticOptions.text,choices:e,interactive:!0})},parser:XG(),returnAfterPlayerAnswer:!0}),eK=new at("add_item",[{name:"id",type:"string"},{name:"amount",type:"number"}],async t=>{const{id:e,amount:n}=t.options;Cr().add({id:e,amount:n})}),tK=new at("remove_item",[{name:"id",type:"string"},{name:"amount",type:"number"}],async t=>{const{id:e,amount:n}=t.options;Cr().remove({id:e,amount:n})}),nK=new at("has_item?",[{name:"id",type:"string"},{name:"amount",type:"number",optional:!0}],async t=>{const{id:e,amount:n}=t.options;return Cr().hasItem(e,n)}),rK=new at("item_amount?",[{name:"id",type:"string"}],async t=>{const{id:e}=t.options;return Cr().getItemAmount(e)}),oK=new at("enable_interaction",[{name:"tag",type:"string"}],async t=>{const e=t.options.tag;Cr().enableInteraction(e)}),iK=new at("disable_interaction",[{name:"tag",type:"string"}],async t=>{const e=t.options.tag;Cr().disableInteraction(e)}),aK=new at("start_quest",[{name:"questId",type:"string"}],async t=>{const e=t.options.questId;Br().startQuest(e)}),sK=new at("start_objective",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async t=>{const{questId:e,objectiveId:n}=t.options;Br().startObjective(e,n)}),uK=new at("complete_objective",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async t=>{const{questId:e,objectiveId:n}=t.options;Br().completeObjective(e,n)}),cK=new at("complete_quest",[{name:"questId",type:"string"},{name:"ending",type:"string",optional:!0}],async t=>{const{questId:e,ending:n}=t.options;Br().completeQuest(e,n)}),lK=new at("quest_completed?",[{name:"questId",type:"string"}],async t=>{const{questId:e}=t.options;return Br().isQuestCompleted(e)}),fK=new at("objective_completed?",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async t=>{const{questId:e,objectiveId:n}=t.options;return Br().isObjectiveCompleted(e,n)}),dK=new at("quest_started?",[{name:"questId",type:"string"}],async t=>{const{questId:e}=t.options;return Br().isQuestStarted(e)}),hK=new at("objective_started?",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async t=>{const{questId:e,objectiveId:n}=t.options;return Br().isObjectiveStarted(e,n)}),pK=at.FromOptions({keyword:"wait",argTypes:[{name:"duration",type:"number"}],runner:async t=>{await Eg(t.options.duration)}}),vK=new at("notify",[{name:"text",type:"string"}],async t=>{const{text:e}=t.options;Si().addNotification(e)}),mK=new at("clear_dialog",[],async t=>{co().clearDialog()}),gK=new at("if",[{name:"condition",type:"boolean"}],async t=>{const e=ZW(t),n=sn();if(e){const r={branchData:{branch:e},currentIndex:0};return n.addAndRunFrame(r)}},(t,e)=>{let n=t.currentLine;Mc("if",[{name:"condition",type:"string"}])(t,e);const{lines:o,currentLine:i,line:a}=t,s=e.command;let u;const c=eU(o,i+1);return c&&c.code==="else:"&&(u=t.processCommandsFunction(t.parserContext,c.branch,a),n++),s.staticOptions={success:t.processCommandsFunction(t.parserContext,a.branch,a),failure:u},n++,{newLine:n}}),yK=new at("==","any",async t=>{t.args.length<2&&ln(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}),bK=new at(">",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e>n}),kK=new at("<",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e<n}),wK=new at(">=",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e>=n}),jK=new at("<=",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e<=n}),xK=new at("!=",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e!=n}),_K=new at("!",[{name:"a",type:"any"}],async t=>{const{a:e}=t.options;return!e}),SK=new at("&&","any",async t=>{const e=t.args;return t.args.length<2&&ln(t,"requires at least two arguments"),e.reduce((n,r)=>n&&r,!0)}),CK=new at("||","any",async t=>(t.args.length<2&&ln(t,"requires at least two arguments"),t.args.reduce((e,n)=>e||n,!1))),$K=new at("?",[{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}),OK=new at("+","any",async t=>(t.args.length<2&&ln(t,"requires at least two arguments"),t.args.reduce((e,n)=>typeof n=="number"?e+n:(ln(t,"requires all arguments to be numbers"),e),0))),AK=new at("-","any",async t=>(t.args.length<2&&ln(t,"requires at least two arguments"),t.args.slice(1).reduce((e,n)=>typeof n=="number"?e-n:(ln(t,"requires all arguments to be numbers"),e),t.args[0]))),EK=new at("neg",[{name:"a",type:"number"}],async t=>(t.args.length!==1&&ln(t,"requires one argument"),-t.options.a)),PK=new at("abs",[{name:"a",type:"number"}],async t=>(t.args.length!==1&&ln(t,"requires one argument"),Math.abs(t.options.a))),TK=new at("*","any",async t=>(t.args.length<2&&ln(t,"requires at least two arguments"),t.args.reduce((e,n)=>typeof n=="number"?e*n:(ln(t,"requires all arguments to be numbers"),e),1))),MK=new at("/","any",async t=>{t.args.length<2&&ln(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:(ln(t,"requires all arguments to be numbers"),n),e)}),IK=async t=>{const{prompt:e,choices:n}=t.staticOptions,r=[];for(const[a,s]of n.entries()){const u=await qg(s.prompt);r.push(u)}t.options.choiceResults=r;const o=r.map((a,s)=>{var f,l;let u=!0;return a.skillCheck&&(u=(l=(f=a.skillCheck)==null?void 0:f.allowed)!=null?l:!1),{choice:a.text,originalIndex:s,allowed:u}}).filter(a=>a.choice),i=await p8(e,o);await DK(t,i)};function NK(t,e,n){e.expression,e.branch||t.parserContext.error(e.line,`Choice option doesn't have any branch to go to (${e.code} - ${e.line})`);let r,o;const i=e.branch;return e.expression[1]==="roll"?((!i[0].branch||!i[1].branch)&&t.parserContext.error(e.line,`Choice option with a skill roll needs success and failure branches (${e.code} - ${e.line})`),r={success:t.processCommandsFunction(t.parserContext,i[0].branch,e),failure:t.processCommandsFunction(t.parserContext,i[1].branch,e)}):o=t.processCommandsFunction(t.parserContext,i,e),{prompt:t.processCommandsFunction(t.parserContext,[e],e)[0],branch:o,skillBranches:r}}const LK=(t,e)=>{let n=t.currentLine;Mc("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,c)=>(u.branch||t.parserContext.error(u.line,`Choice option doesn't have any branch to go to (${u.code})`),u=BK(t.parserContext,u),NK(t,u)));return o.staticOptions={prompt:t.processCommandsFunction(t.parserContext,[i],r)[0],choices:s},n++,{newLine:n}},RK=at.FromOptions({keyword:"choice",argTypes:[],runner:IK,parser:LK}),DK=async(t,e)=>{const n=e,r=sn(),{choices:o}=t.staticOptions,i=o[n],a=t.options.choiceResults[n];let s=a.text,u;if(a.skillCheck?(s=null,c8({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 c={speaker:"player",text:s,interactive:!1};co().addDialog(c)}if(u){const c={currentIndex:0,branchData:{branch:u}};await r.addAndRunFrame(c)}};function BK(t,e){return{code:`choicePrompt ${e.code}`,indentation:e.indentation,line:e.line,branch:e.branch,expression:["choicePrompt",...e.expression]}}const zK=new at("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=ir().getSkillCheck(n);if(s.hidden)return{text:null};const u=s.happened&&!s.succeeded,{difficultyText:c}=KW({skill:r,skillCheckId:n,value:o});return{text:`${c} ${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]}}),k8=at.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};co().addDialog(e)}});k8.onPlayerAnswered=async(t,e)=>(typeof e!="string"&&ln(t,"The player's answer should be a string"),e);const VK=at.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};co().addDialog(e)}}),FK=new at("random",[{name:"a",type:"number"},{name:"b",type:"number"}],async t=>{const{a:e,b:n}=t.options;return(!e||!n)&&ln(t,"random command needs two numbers as parameters"),Math.floor(Math.random()*(n-e+1))+e}),qK=new at("random_float",[{name:"a",type:"number"},{name:"b",type:"number"}],async t=>{const{a:e,b:n}=t.options;return(!e||!n)&&ln(t,"random_float command needs two numbers as parameters"),Math.random()*(n-e)+e}),HK=new at("random_from_args",[],async t=>{const e=t.args;return(!e||!e.length)&&ln(t,"random_from_args command needs at least one argument"),e[Math.floor(Math.random()*e.length)]}),WK=new at("concat","any",async t=>(t.args.length<2&&ln(t,"requires at least two arguments"),t.args.reduce((e,n)=>typeof n=="string"?`${e}${n}`:(ln(t,"requires all arguments to be strings"),e),""))),UK=new at("join","any",async t=>{const e=t.args[0];return t.args.length<3&&ln(t,"requires at least 3 arguments"),t.args.slice(1).reduce((n,r)=>typeof r=="string"?`${n}${e}${r}`:(ln(t,"requires all arguments to be strings"),n),"")}),JK=at.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}}),GK=at.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}}),KK=at.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}});function QK(t){t.addCommand(RK),t.addCommand(zK),t.addCommand(gK),t.addCommand(NG),t.addCommand(LG),t.addCommand(RG),t.addCommand(mK),t.addCommand(vK),t.addCommand(HG),t.addCommand(qG),t.addCommand(WG),t.addCommand(QG),t.addCommand(GG),t.addCommand(KG),t.addCommand(pK),t.addCommand(yK),t.addCommand(bK),t.addCommand(kK),t.addCommand(wK),t.addCommand(jK),t.addCommand(xK),t.addCommand(_K),t.addCommand(SK),t.addCommand(CK),t.addCommand($K),t.addCommand(OK),t.addCommand(AK),t.addCommand(TK),t.addCommand(MK),t.addCommand(EK),t.addCommand(PK),t.addCommand(JG),t.addCommand(UG),t.addCommand(ZG),t.addCommand(YG),t.addCommand(DG),t.addCommand(BG),t.addCommand(zG),t.addCommand(VG),t.addCommand(FG),t.addCommand(aK),t.addCommand(sK),t.addCommand(uK),t.addCommand(cK),t.addCommand(dK),t.addCommand(hK),t.addCommand(lK),t.addCommand(fK),t.addCommand(eK),t.addCommand(tK),t.addCommand(oK),t.addCommand(iK),t.addCommand(nK),t.addCommand(rK),t.addCommand(AG),t.addCommand(EG),t.addCommand(PG),t.addCommand(IG),t.addCommand(TG),t.addCommand(MG),t.addCommand(k8),t.addCommand(VK),t.addCommand(FK),t.addCommand(qK),t.addCommand(HK),t.addCommand(WK),t.addCommand(UK),t.addCommand(JK),t.addCommand(GK),t.addCommand(KK)}let Ic;or.callHook("onPageLoaded");async function YK(t,e){const n=await Bg(t.configPath);UH(JSON.parse(n)),t.baseAssetsPath&&(Bt().baseAssetsPath=t.baseAssetsPath),Ic=C.createApp($G,{config:t,options:e});const r=mW();if(Ic.use(r),_n().setOptions(e),Ic.use($8,{breakpoints:{s:0,m:800,l:1200}}),QK(or),i0.setupDebugger(e.debug),console.log("%c Narrat game engine \u2013 [VI]{version} - {date}[/VI]","background: #222; color: #bada55"),or.callHook("onNarratSetup"),Ic.mount("#game-holder"),e.debug){const o={app:Ic,vm:or,jump:i=>{sn().runLabel(i)}};window.narrat=o}}class XK{onPageLoaded(){}onNarratSetup(){}onAppMounted(){}onAssetsLoaded(){}onGameSetup(){}onGameStart(){}onGameMounted(){}onGameDismounted(){}}function ZK(t){or.addPlugin(t)}function eQ(t){or.addCommand(t)}un.CommandPlugin=at,un.NarratPlugin=XK,un.addCommand=eQ,un.aspectRatioFit=m8,un.generateParser=Mc,un.getConfig=Bt,un.registerPlugin=ZK,un.startApp=YK,Object.defineProperties(un,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
184
+ Error: ${e}`),console.error("============================")}function OG(t,...e){console.log(`[${t.fileName}:${t.line}] log: `,...e)}class at{constructor(e,n,r,o){Yo(this,"keyword");Yo(this,"runner");Yo(this,"argTypes");Yo(this,"parser");Yo(this,"onPlayerAnswered");Yo(this,"returnAfterPlayerAnswer");this.keyword=e,this.runner=r,this.argTypes=n,o?this.parser=o:this.parser=Mc(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)=>{sn().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 at(e.keyword,e.argTypes,e.runner,e.parser);return n.onPlayerAnswered=e.onPlayerAnswered,n.returnAfterPlayerAnswer=(r=e.returnAfterPlayerAnswer)!=null?r:!1,n}}function Mc(t,e){let n=[];if(e!=="any"){n=[e.length];const r=e.reduce((o,i)=>i.optional?o+1:o,0);if(r>1)throw new Error(`Only one optional argument is allowed for commands but ${t} has multiple ones`);r===1&&n.push(e.length-1)}return(r,o)=>{const i={newLine:r.currentLine+1},a=o.command.args;return e!=="any"&&!n.includes(a.length)?(console.log("Error details"),console.log(o.command),console.log(a),r.parserContext.error(r.line.line,`Command ${t}: Expected ${n.join(" or ")} arguments but got ${a.length}`),i):(o.command.commandType=t,e!=="any"&&o.command.args.forEach((s,u)=>{const c=e[u];!l8(s)&&!f8(s)&&(c.type==="any"||typeof s===c.type||r.parserContext.error(r.line.line,`Command ${t}: Argument #${u+1} (${c.name}) should be a ${c.type}, but got type ${typeof s}: ${JSON.stringify(s)}`))}),{newLine:r.currentLine+1})}}const AG=new at("add_level",[{name:"skillKey",type:"string"},{name:"amount",type:"number"}],async t=>{const{skillKey:e,amount:n}=t.options;(!e||!n)&&ln(t,"add_level command needs a skill id and a value as parameters"),ir().incrementSkill(e,n)}),EG=at.FromOptions({keyword:"set_level",argTypes:[{name:"skill",type:"string"},{name:"level",type:"number"}],runner:async t=>{const{skill:e,level:n}=t.options;(!e||!n)&&ln(t,"set_level command needs a skill id and a value as parameters"),ir().setSkillLevel(e,n)}}),PG=new at("add_xp",[{name:"xpKey",type:"string"},{name:"xpToAdd",type:"number"}],async t=>{const{xpKey:e,xpToAdd:n}=t.options;(!e||!n)&&ln(t,"add_xp command needs a skill id and a value as parameters"),ir().addXp(e,n)}),TG=new at("get_level",[{name:"skillKey",type:"string"}],async t=>{const{skillKey:e}=t.options;e||ln(t,"get_level command needs a skill id as parameter");const n=ir().getSkill(e);return n||ln(t,`Skill ${e} not found`),n.level}),MG=new at("get_xp",[{name:"xpKey",type:"string"}],async t=>{const{xpKey:e}=t.options;e||ln(t,"get_xp command needs a skill id as parameter");const n=ir().getSkillXp(e);return n||ln(t,`XP ${e} not found`),n}),IG=new at("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 c8({id:e,skill:n,value:r,hideAfterRoll:o}).succeeded}),NG=new at("add_stat",[{name:"statKey",type:"string"},{name:"amountToAdd",type:"number"}],async t=>{const{statKey:e,amountToAdd:n}=t.options;(!e||typeof n!="number")&&ln(t,"add_stat command needs a stat id and a value as parameters"),Hi().addStat(e,n)}),LG=new at("set_stat",[{name:"statKey",type:"string"},{name:"value",type:"number"}],async t=>{const{statKey:e,value:n}=t.options;(!e||typeof n!="number")&&ln(t,"set_stat command needs a stat id and a value as parameters"),Hi().setStat(e,n)}),RG=new at("get_stat_value",[{name:"statKey",type:"string"}],async t=>{const{statKey:e}=t.options;return e||ln(t,"get_stat_value command needs a stat id as parameter"),Hi().getStatValue(e)}),DG=at.FromOptions({keyword:"jump",argTypes:"any",runner:async t=>{(t.args.length<1||typeof t.args[0]!="string")&&ln(t,"requires a label argument");const e=t.args[0],n=sn(),r={branchData:n.script[e],label:e,args:t.args.splice(1),currentIndex:0};n.setStack(r),await _n().saveGame(),await n.runFrame()}}),BG=at.FromOptions({keyword:"run",argTypes:"any",runner:async t=>{(t.args.length<1||typeof t.args[0]!="string")&&ln(t,"run command needs a label to argument run");const e=t.args[0];return await sn().runLabelFunction(e,...t.args.slice(1))}}),zG=at.FromOptions({keyword:"var",argTypes:[{name:"name",type:"string"},{name:"value",type:"any"}],runner:async t=>{const{name:e,value:n}=t.options;sn().addScopedVariable(e,n)}}),VG=at.FromOptions({keyword:"return",argTypes:[{name:"value",type:"any"}],runner:async t=>{const{value:e}=t.options;sn().setReturnValue(e)}}),FG=at.FromOptions({keyword:"log",argTypes:"any",runner:async t=>{OG(t,...t.args)}}),Ug=[{name:"mode",type:"string"},{name:"audio",type:"string",optional:!0}],qG=new at("play",Ug,async t=>{const e=t.options;e.mode==="music"?Ad(e.audio):U7(e.audio)}),HG=new at("pause",Ug,async t=>{const e=t.options;if(e.mode==="music"){const n=uo();n.currentMusic&&G7(n.currentMusic)}else e.mode==="sound"&&e.audio?G7(e.audio):ln(t,"pause first option needs to either be in music mode, or if stopping a sound needs to have the sound name supplied as second argument.")}),WG=new at("stop",Ug,async t=>{const e=t.options;e.mode==="music"?uo().currentMusic&&uo().stopMusic():e.mode==="sound"&&e.audio?J7(e.audio):ln(t,"stop option needs to either be in music mode, or if stopping a sound needs to have the sound name supplied as second argument.")}),UG=new at("set",[{name:"key",type:"string"},{name:"value",type:"any"}],async t=>{const e=su();X7(e,t.options.key,t.options.value)}),JG=new at("add",[{name:"key",type:"string"},{name:"value",type:"any"}],async t=>{const e=su();Z7(e,t.options.key,t.options.value)}),GG=new at("set_screen",[{name:"screen",type:"string"},{name:"layer",type:"number",optional:!0}],async t=>{Ci().setScreen(t.options.screen,t.options.layer)}),KG=new at("empty_layer",[{name:"layer",type:"number"}],async t=>{Ci().emptyLayer(t.options.layer)}),QG=new at("set_button",[{name:"buttonId",type:"string"},{name:"state",type:"any"}],async t=>{const{buttonId:e,state:n}=t.options;Ci().changeButton(e,n)}),YG=at.FromOptions({keyword:"talk",argTypes:[{name:"speaker",type:"string"},{name:"pose",type:"string"},{name:"text",type:"string"}],runner:async(t,e)=>{await h8({speaker:t.options.speaker,pose:t.options.pose,text:`"${t.options.text}"`,choices:e,interactive:!0})},returnAfterPlayerAnswer:!0}),XG=()=>{const t=Mc("text",[]);return(e,n)=>{const r=t(e,n);return n.command.staticOptions={text:n.code.substring(1,n.code.length-2)},r}},ZG=at.FromOptions({keyword:"text",argTypes:[],runner:async(t,e)=>{await h8({speaker:"game",text:t.staticOptions.text,choices:e,interactive:!0})},parser:XG(),returnAfterPlayerAnswer:!0}),eK=new at("add_item",[{name:"id",type:"string"},{name:"amount",type:"number"}],async t=>{const{id:e,amount:n}=t.options;Cr().add({id:e,amount:n})}),tK=new at("remove_item",[{name:"id",type:"string"},{name:"amount",type:"number"}],async t=>{const{id:e,amount:n}=t.options;Cr().remove({id:e,amount:n})}),nK=new at("has_item?",[{name:"id",type:"string"},{name:"amount",type:"number",optional:!0}],async t=>{const{id:e,amount:n}=t.options;return Cr().hasItem(e,n)}),rK=new at("item_amount?",[{name:"id",type:"string"}],async t=>{const{id:e}=t.options;return Cr().getItemAmount(e)}),oK=new at("enable_interaction",[{name:"tag",type:"string"}],async t=>{const e=t.options.tag;Cr().enableInteraction(e)}),iK=new at("disable_interaction",[{name:"tag",type:"string"}],async t=>{const e=t.options.tag;Cr().disableInteraction(e)}),aK=new at("start_quest",[{name:"questId",type:"string"}],async t=>{const e=t.options.questId;Br().startQuest(e)}),sK=new at("start_objective",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async t=>{const{questId:e,objectiveId:n}=t.options;Br().startObjective(e,n)}),uK=new at("complete_objective",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async t=>{const{questId:e,objectiveId:n}=t.options;Br().completeObjective(e,n)}),cK=new at("complete_quest",[{name:"questId",type:"string"},{name:"ending",type:"string",optional:!0}],async t=>{const{questId:e,ending:n}=t.options;Br().completeQuest(e,n)}),lK=new at("quest_completed?",[{name:"questId",type:"string"}],async t=>{const{questId:e}=t.options;return Br().isQuestCompleted(e)}),fK=new at("objective_completed?",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async t=>{const{questId:e,objectiveId:n}=t.options;return Br().isObjectiveCompleted(e,n)}),dK=new at("quest_started?",[{name:"questId",type:"string"}],async t=>{const{questId:e}=t.options;return Br().isQuestStarted(e)}),hK=new at("objective_started?",[{name:"questId",type:"string"},{name:"objectiveId",type:"string"}],async t=>{const{questId:e,objectiveId:n}=t.options;return Br().isObjectiveStarted(e,n)}),pK=at.FromOptions({keyword:"wait",argTypes:[{name:"duration",type:"number"}],runner:async t=>{await Eg(t.options.duration)}}),vK=new at("notify",[{name:"text",type:"string"}],async t=>{const{text:e}=t.options;Si().addNotification(e)}),mK=new at("clear_dialog",[],async t=>{co().clearDialog()}),gK=new at("if",[{name:"condition",type:"boolean"}],async t=>{const e=ZW(t),n=sn();if(e){const r={branchData:{branch:e},currentIndex:0};return n.addAndRunFrame(r)}},(t,e)=>{let n=t.currentLine;Mc("if",[{name:"condition",type:"string"}])(t,e);const{lines:o,currentLine:i,line:a}=t,s=e.command;let u;const c=eU(o,i+1);return c&&c.code==="else:"&&(u=t.processCommandsFunction(t.parserContext,c.branch,a),n++),s.staticOptions={success:t.processCommandsFunction(t.parserContext,a.branch,a),failure:u},n++,{newLine:n}}),yK=new at("==","any",async t=>{t.args.length<2&&ln(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}),bK=new at(">",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e>n}),kK=new at("<",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e<n}),wK=new at(">=",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e>=n}),jK=new at("<=",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e<=n}),xK=new at("!=",[{name:"a",type:"any"},{name:"b",type:"any"}],async t=>{const{a:e,b:n}=t.options;return e!=n}),_K=new at("!",[{name:"a",type:"any"}],async t=>{const{a:e}=t.options;return!e}),SK=new at("&&","any",async t=>{const e=t.args;return t.args.length<2&&ln(t,"requires at least two arguments"),e.reduce((n,r)=>n&&r,!0)}),CK=new at("||","any",async t=>(t.args.length<2&&ln(t,"requires at least two arguments"),t.args.reduce((e,n)=>e||n,!1))),$K=new at("?",[{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}),OK=new at("+","any",async t=>(t.args.length<2&&ln(t,"requires at least two arguments"),t.args.reduce((e,n)=>typeof n=="number"?e+n:(ln(t,"requires all arguments to be numbers"),e),0))),AK=new at("-","any",async t=>(t.args.length<2&&ln(t,"requires at least two arguments"),t.args.slice(1).reduce((e,n)=>typeof n=="number"?e-n:(ln(t,"requires all arguments to be numbers"),e),t.args[0]))),EK=new at("neg",[{name:"a",type:"number"}],async t=>(t.args.length!==1&&ln(t,"requires one argument"),-t.options.a)),PK=new at("abs",[{name:"a",type:"number"}],async t=>(t.args.length!==1&&ln(t,"requires one argument"),Math.abs(t.options.a))),TK=new at("*","any",async t=>(t.args.length<2&&ln(t,"requires at least two arguments"),t.args.reduce((e,n)=>typeof n=="number"?e*n:(ln(t,"requires all arguments to be numbers"),e),1))),MK=new at("/","any",async t=>{t.args.length<2&&ln(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:(ln(t,"requires all arguments to be numbers"),n),e)}),IK=async t=>{const{prompt:e,choices:n}=t.staticOptions,r=[];for(const[a,s]of n.entries()){const u=await qg(s.prompt);r.push(u)}t.options.choiceResults=r;const o=r.map((a,s)=>{var f,l;let u=!0;return a.skillCheck&&(u=(l=(f=a.skillCheck)==null?void 0:f.allowed)!=null?l:!1),{choice:a.text,originalIndex:s,allowed:u}}).filter(a=>a.choice),i=await p8(e,o);await DK(t,i)};function NK(t,e,n){e.expression,e.branch||t.parserContext.error(e.line,`Choice option doesn't have any branch to go to (${e.code} - ${e.line})`);let r,o;const i=e.branch;return e.expression[1]==="roll"?((!i[0].branch||!i[1].branch)&&t.parserContext.error(e.line,`Choice option with a skill roll needs success and failure branches (${e.code} - ${e.line})`),r={success:t.processCommandsFunction(t.parserContext,i[0].branch,e),failure:t.processCommandsFunction(t.parserContext,i[1].branch,e)}):o=t.processCommandsFunction(t.parserContext,i,e),{prompt:t.processCommandsFunction(t.parserContext,[e],e)[0],branch:o,skillBranches:r}}const LK=(t,e)=>{let n=t.currentLine;Mc("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,c)=>(u.branch||t.parserContext.error(u.line,`Choice option doesn't have any branch to go to (${u.code})`),u=BK(t.parserContext,u),NK(t,u)));return o.staticOptions={prompt:t.processCommandsFunction(t.parserContext,[i],r)[0],choices:s},n++,{newLine:n}},RK=at.FromOptions({keyword:"choice",argTypes:[],runner:IK,parser:LK}),DK=async(t,e)=>{const n=e,r=sn(),{choices:o}=t.staticOptions,i=o[n],a=t.options.choiceResults[n];let s=a.text,u;if(a.skillCheck?(s=null,c8({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 c={speaker:"player",text:s,interactive:!1};co().addDialog(c)}if(u){const c={currentIndex:0,branchData:{branch:u}};await r.addAndRunFrame(c)}};function BK(t,e){return{code:`choicePrompt ${e.code}`,indentation:e.indentation,line:e.line,branch:e.branch,expression:["choicePrompt",...e.expression]}}const zK=new at("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=ir().getSkillCheck(n);if(s.hidden)return{text:null};const u=s.happened&&!s.succeeded,{difficultyText:c}=KW({skill:r,skillCheckId:n,value:o});return{text:`${c} ${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]}}),k8=at.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};co().addDialog(e)}});k8.onPlayerAnswered=async(t,e)=>(typeof e!="string"&&ln(t,"The player's answer should be a string"),e);const VK=at.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};co().addDialog(e)}}),FK=new at("random",[{name:"a",type:"number"},{name:"b",type:"number"}],async t=>{const{a:e,b:n}=t.options;return(!e||!n)&&ln(t,"random command needs two numbers as parameters"),Math.floor(Math.random()*(n-e+1))+e}),qK=new at("random_float",[{name:"a",type:"number"},{name:"b",type:"number"}],async t=>{const{a:e,b:n}=t.options;return(!e||!n)&&ln(t,"random_float command needs two numbers as parameters"),Math.random()*(n-e)+e}),HK=new at("random_from_args",[],async t=>{const e=t.args;return(!e||!e.length)&&ln(t,"random_from_args command needs at least one argument"),e[Math.floor(Math.random()*e.length)]}),WK=new at("concat","any",async t=>(t.args.length<2&&ln(t,"requires at least two arguments"),t.args.reduce((e,n)=>typeof n=="string"?`${e}${n}`:(ln(t,"requires all arguments to be strings"),e),""))),UK=new at("join","any",async t=>{const e=t.args[0];return t.args.length<3&&ln(t,"requires at least 3 arguments"),t.args.slice(1).reduce((n,r)=>typeof r=="string"?`${n}${e}${r}`:(ln(t,"requires all arguments to be strings"),n),"")}),JK=at.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}}),GK=at.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}}),KK=at.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}});function QK(t){t.addCommand(RK),t.addCommand(zK),t.addCommand(gK),t.addCommand(NG),t.addCommand(LG),t.addCommand(RG),t.addCommand(mK),t.addCommand(vK),t.addCommand(HG),t.addCommand(qG),t.addCommand(WG),t.addCommand(QG),t.addCommand(GG),t.addCommand(KG),t.addCommand(pK),t.addCommand(yK),t.addCommand(bK),t.addCommand(kK),t.addCommand(wK),t.addCommand(jK),t.addCommand(xK),t.addCommand(_K),t.addCommand(SK),t.addCommand(CK),t.addCommand($K),t.addCommand(OK),t.addCommand(AK),t.addCommand(TK),t.addCommand(MK),t.addCommand(EK),t.addCommand(PK),t.addCommand(JG),t.addCommand(UG),t.addCommand(ZG),t.addCommand(YG),t.addCommand(DG),t.addCommand(BG),t.addCommand(zG),t.addCommand(VG),t.addCommand(FG),t.addCommand(aK),t.addCommand(sK),t.addCommand(uK),t.addCommand(cK),t.addCommand(dK),t.addCommand(hK),t.addCommand(lK),t.addCommand(fK),t.addCommand(eK),t.addCommand(tK),t.addCommand(oK),t.addCommand(iK),t.addCommand(nK),t.addCommand(rK),t.addCommand(AG),t.addCommand(EG),t.addCommand(PG),t.addCommand(IG),t.addCommand(TG),t.addCommand(MG),t.addCommand(k8),t.addCommand(VK),t.addCommand(FK),t.addCommand(qK),t.addCommand(HK),t.addCommand(WK),t.addCommand(UK),t.addCommand(JK),t.addCommand(GK),t.addCommand(KK)}let Ic;or.callHook("onPageLoaded");async function YK(t,e){const n=await Bg(t.configPath);UH(JSON.parse(n)),t.baseAssetsPath&&(Bt().baseAssetsPath=t.baseAssetsPath),Ic=C.createApp($G,{config:t,options:e});const r=mW();if(Ic.use(r),_n().setOptions(e),Ic.use($8,{breakpoints:{s:0,m:800,l:1200}}),QK(or),i0.setupDebugger(e.debug),console.log("%c Narrat game engine \u2013 [VI]{version} - {date}[/VI]","background: #222; color: #bada55"),or.callHook("onNarratSetup"),Ic.mount("#game-holder"),e.debug){const o={app:Ic,vm:or,jump:i=>{sn().runLabel(i)}};window.narrat=o}}class XK{onPageLoaded(){}onNarratSetup(){}onAppMounted(){}onAssetsLoaded(){}onGameSetup(){}onGameStart(){}onGameMounted(){}onGameDismounted(){}}function ZK(t){or.addPlugin(t)}function eQ(t){or.addCommand(t)}un.CommandPlugin=at,un.NarratPlugin=XK,un.addCommand=eQ,un.aspectRatioFit=m8,un.generateParser=Mc,un.getConfig=Bt,un.registerPlugin=ZK,un.startApp=YK,Object.defineProperties(un,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
185
185
  //# sourceMappingURL=narrat.umd.js.map