@inkweave/web 1.0.0

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.
@@ -0,0 +1,52 @@
1
+ typeof window<"u"&&typeof window.process>"u"&&(window.process={env:{NODE_ENV:"production"},browser:!0});var InkWeave=(function(Yn){Object.defineProperty(Yn,Symbol.toStringTag,{value:"Module"});var Zm=Object.create,ih=Object.defineProperty,Jm=Object.getOwnPropertyDescriptor,$m=Object.getOwnPropertyNames,tv=Object.getPrototypeOf,ev=Object.prototype.hasOwnProperty,lt=(r,u)=>()=>(u||r((u={exports:{}}).exports,u),u.exports),nv=(r,u,h,c)=>{if(u&&typeof u=="object"||typeof u=="function")for(var s=$m(u),p=0,m=s.length,v;p<m;p++)v=s[p],!ev.call(r,v)&&v!==h&&ih(r,v,{get:(y=>u[y]).bind(null,v),enumerable:!(c=Jm(u,v))||c.enumerable});return r},iv=(r,u,h)=>(h=r!=null?Zm(tv(r)):{},nv(u||!r||!r.__esModule?ih(h,"default",{value:r,enumerable:!0}):h,r)),ys=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CompilerOptions=void 0;var u=class{constructor(h=null,c=[],s=!1,p=null,m=null){this.sourceFilename=h,this.pluginNames=c,this.countAllVisits=s,this.errorHandler=p,this.fileHandler=m}};r.CompilerOptions=u})),av=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebugSourceRange=void 0;var u=class{constructor(h,c,s){this.length=h,this.debugMetadata=c,this.text=s}};r.DebugSourceRange=u})),Cs=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ErrorType=void 0;var u;(function(h){h[h.Author=0]="Author",h[h.Warning=1]="Warning",h[h.Error=2]="Error"})(u||(r.ErrorType=u={}))})),lv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Argument=void 0;var u=class{constructor(h=null,c=null,s=null){this.identifier=h,this.isByReference=c,this.isDivertTarget=s}get typeName(){return"Argument"}};r.Argument=u})),Bt=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.filterUndef=r.isEquatable=r.nullIfUndefined=r.asINamedContentOrNull=r.asBooleanOrThrows=r.asNumberOrThrows=r.asOrThrows=r.asOrNull=void 0;function u(o,T){return o instanceof T?y(o,T):null}r.asOrNull=u;function h(o,T){if(o instanceof T)return y(o,T);throw new Error(`${o} is not of type ${T}`)}r.asOrThrows=h;function c(o){if(typeof o=="number")return o;throw new Error(`${o} is not a number`)}r.asNumberOrThrows=c;function s(o){if(typeof o=="boolean")return o;throw new Error(`${o} is not a boolean`)}r.asBooleanOrThrows=s;function p(o){return o.hasValidName&&o.name?o:null}r.asINamedContentOrNull=p;function m(o){return typeof o>"u"?null:o}r.nullIfUndefined=m;function v(o){return typeof o=="object"&&typeof o.Equals=="function"}r.isEquatable=v;function y(o,T){return o}function A(o){return o!=null}r.filterUndef=A})),Zt=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ParsedObject=void 0;var u=Bt(),h=class{constructor(){this._alreadyHadError=!1,this._alreadyHadWarning=!1,this._debugMetadata=null,this._runtimeObject=null,this.content=[],this.parent=null,this.GetType=()=>this.typeName,this.AddContent=c=>{this.content===null&&(this.content=[]);const s=Array.isArray(c)?c:[c];for(const p of s)p.hasOwnProperty("parent")&&(p.parent=this),this.content.push(p);if(!Array.isArray(c))return c},this.InsertContent=(c,s)=>(this.content===null&&(this.content=[]),s.parent=this,this.content.splice(c,0,s),s),this.Find=c=>(s=null)=>{let p=(0,u.asOrNull)(this,c);if(p!==null&&(s===null||s(p)===!0))return p;if(this.content===null)return null;for(const m of this.content){let v=m.Find&&m.Find(c)(s);if(v)return v}return null},this.FindAll=c=>(s,p)=>{const m=Array.isArray(p)?p:[],v=(0,u.asOrNull)(this,c);if(v!==null&&(!s||s(v)===!0)&&m.push(v),this.content===null)return[];for(const y of this.content)y.FindAll&&y.FindAll(c)(s,m);return m},this.Warning=(c,s=null)=>{this.Error(c,s,!0)}}get debugMetadata(){return this._debugMetadata===null&&this.parent?this.parent.debugMetadata:this._debugMetadata}set debugMetadata(c){this._debugMetadata=c}get hasOwnDebugMetadata(){return!!this.debugMetadata}get typeName(){return"ParsedObject"}get story(){let c=this;for(;c.parent;)c=c.parent;return c}get runtimeObject(){return this._runtimeObject||(this._runtimeObject=this.GenerateRuntimeObject(),this._runtimeObject&&(this._runtimeObject.debugMetadata=this.debugMetadata)),this._runtimeObject}set runtimeObject(c){this._runtimeObject=c}get runtimePath(){if(!this.runtimeObject.path)throw new Error;return this.runtimeObject.path}get containerForCounting(){return this.runtimeObject}get ancestry(){let c=[],s=this.parent;for(;s;)c.push(s),s=s.parent;return c=c.reverse(),c}ResolveReferences(c){if(this.content!==null)for(const s of this.content)s.ResolveReferences(c)}Error(c,s=null,p=!1){if(s===null&&(s=this),!(s._alreadyHadError&&!p||s._alreadyHadWarning&&p)){if(this.parent)this.parent.Error(c,s,p);else throw new Error(`No parent object to send error to: ${c}`);p?s._alreadyHadWarning=!0:s._alreadyHadError=!0}}};r.ParsedObject=h})),Ss=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.AuthorWarning=void 0;var u=Zt(),h=class extends u.ParsedObject{constructor(c){super(),this.warningMessage=c,this.GenerateRuntimeObject=()=>(this.Warning(this.warningMessage),null)}get typeName(){return"AuthorWarning"}};r.AuthorWarning=h})),Me=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Path=void 0;var u=class gn{constructor(){if(this._components=[],this._componentsString=null,this._isRelative=!1,typeof arguments[0]=="string")this.componentsString=arguments[0];else if(arguments[0]instanceof gn.Component&&arguments[1]instanceof gn){let c=arguments[0],s=arguments[1];this._components.push(c),this._components=this._components.concat(s._components)}else if(arguments[0]instanceof Array){let c=arguments[0],s=!!arguments[1];this._components=this._components.concat(c),this._isRelative=s}}get isRelative(){return this._isRelative}get componentCount(){return this._components.length}get head(){return this._components.length>0?this._components[0]:null}get tail(){if(this._components.length>=2){let c=this._components.slice(1,this._components.length);return new gn(c)}else return gn.self}get length(){return this._components.length}get lastComponent(){let c=this._components.length-1;return c>=0?this._components[c]:null}get containsNamedComponent(){for(let c=0,s=this._components.length;c<s;c++)if(!this._components[c].isIndex)return!0;return!1}static get self(){let c=new gn;return c._isRelative=!0,c}GetComponent(c){return this._components[c]}PathByAppendingPath(c){let s=new gn,p=0;for(let m=0;m<c._components.length&&c._components[m].isParent;++m)p++;for(let m=0;m<this._components.length-p;++m)s._components.push(this._components[m]);for(let m=p;m<c._components.length;++m)s._components.push(c._components[m]);return s}get componentsString(){return this._componentsString==null&&(this._componentsString=this._components.join("."),this.isRelative&&(this._componentsString="."+this._componentsString)),this._componentsString}set componentsString(c){if(this._components.length=0,this._componentsString=c,this._componentsString==null||this._componentsString=="")return;this._componentsString[0]=="."&&(this._isRelative=!0,this._componentsString=this._componentsString.substring(1));let s=this._componentsString.split(".");for(let p of s)/^(\-|\+)?([0-9]+|Infinity)$/.test(p)?this._components.push(new gn.Component(parseInt(p))):this._components.push(new gn.Component(p))}toString(){return this.componentsString}Equals(c){if(c==null||c._components.length!=this._components.length||c.isRelative!=this.isRelative)return!1;for(let s=0,p=c._components.length;s<p;s++)if(!c._components[s].Equals(this._components[s]))return!1;return!0}PathByAppendingComponent(c){let s=new gn;return s._components.push(...this._components),s._components.push(c),s}};r.Path=u,u.parentId="^",(function(h){class c{constructor(p){this.index=-1,this.name=null,typeof p=="string"?this.name=p:this.index=p}get isIndex(){return this.index>=0}get isParent(){return this.name==h.parentId}static ToParent(){return new c(h.parentId)}toString(){return this.isIndex?this.index.toString():this.name}Equals(p){return p!=null&&p.isIndex==this.isIndex?this.isIndex?this.index==p.index:this.name==p.name:!1}}h.Component=c})(u||(r.Path=u={}))})),Bl=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Debug=void 0;var u;(function(h){function c(p,m,v){s(p instanceof m,v)}h.AssertType=c;function s(p,m){if(!p)throw typeof m<"u"&&console.warn(m),console.trace&&console.trace(),new Error("")}h.Assert=s})(u||(r.Debug=u={}))})),be=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.throwNullException=r.NullException=void 0;var u=class extends Error{};r.NullException=u;function h(c){throw new u(`${c} is null or undefined`)}r.throwNullException=h})),Fe=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InkObject=void 0;var u=Me(),h=oe(),c=Bl(),s=Bt(),p=be(),m=class{constructor(){this.parent=null,this._debugMetadata=null,this._path=null}get debugMetadata(){return this._debugMetadata===null&&this.parent?this.parent.debugMetadata:this._debugMetadata}set debugMetadata(v){this._debugMetadata=v}get ownDebugMetadata(){return this._debugMetadata}DebugLineNumberOfPath(v){if(v===null)return null;let y=this.rootContentContainer;if(y){let A=y.ContentAtPath(v).obj;if(A){let o=A.debugMetadata;if(o!==null)return o.startLineNumber}}return null}get path(){if(this._path==null)if(this.parent==null)this._path=new u.Path;else{let v=[],y=this,A=(0,s.asOrNull)(y.parent,h.Container);for(;A!==null;){let o=(0,s.asINamedContentOrNull)(y);if(o!=null&&o.hasValidName){if(o.name===null)return(0,p.throwNullException)("namedChild.name");v.unshift(new u.Path.Component(o.name))}else v.unshift(new u.Path.Component(A.content.indexOf(y)));y=A,A=(0,s.asOrNull)(A.parent,h.Container)}this._path=new u.Path(v)}return this._path}ResolvePath(v){if(v===null)return(0,p.throwNullException)("path");if(v.isRelative){let y=(0,s.asOrNull)(this,h.Container);return y===null&&(c.Debug.Assert(this.parent!==null,"Can't resolve relative path because we don't have a parent"),y=(0,s.asOrNull)(this.parent,h.Container),c.Debug.Assert(y!==null,"Expected parent to be a container"),c.Debug.Assert(v.GetComponent(0).isParent),v=v.tail),y===null?(0,p.throwNullException)("nearestContainer"):y.ContentAtPath(v)}else{let y=this.rootContentContainer;return y===null?(0,p.throwNullException)("contentContainer"):y.ContentAtPath(v)}}ConvertPathToRelative(v){let y=this.path,A=Math.min(v.length,y.length),o=-1;for(let g=0;g<A;++g){let V=y.GetComponent(g),B=v.GetComponent(g);if(V.Equals(B))o=g;else break}if(o==-1)return v;let T=y.componentCount-1-o,f=[];for(let g=0;g<T;++g)f.push(u.Path.Component.ToParent());for(let g=o+1;g<v.componentCount;++g)f.push(v.GetComponent(g));return new u.Path(f,!0)}CompactPathString(v){let y=null,A=null;return v.isRelative?(A=v.componentsString,y=this.path.PathByAppendingPath(v).componentsString):(A=this.ConvertPathToRelative(v).componentsString,y=v.componentsString),A.length<y.length?A:y}get rootContentContainer(){let v=this;for(;v.parent;)v=v.parent;return(0,s.asOrNull)(v,h.Container)}Copy(){throw Error("Not Implemented: Doesn't support copying")}SetChild(v,y,A){v[y]&&(v[y]=null),v[y]=A,v[y]&&(v[y].parent=this)}Equals(v){return v===this}};r.InkObject=m})),Ui=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.StringBuilder=void 0;var u=class{constructor(h){h=typeof h<"u"?h.toString():"",this.string=h}get Length(){return this.string.length}Append(h){h!==null&&(this.string+=h)}AppendLine(h){typeof h<"u"&&this.Append(h),this.string+=`
2
+ `}AppendFormat(h,...c){this.string+=h.replace(/{(\d+)}/g,(s,p)=>typeof c[p]<"u"?c[p]:s)}toString(){return this.string}Clear(){this.string=""}};r.StringBuilder=u})),Ie=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InkList=r.InkListItem=void 0;var u=be(),h=Ui(),c=class Gi{constructor(){if(this.originName=null,this.itemName=null,typeof arguments[1]<"u"){let m=arguments[0],v=arguments[1];this.originName=m,this.itemName=v}else if(arguments[0]){let m=arguments[0].toString().split(".");this.originName=m[0],this.itemName=m[1]}}static get Null(){return new Gi(null,null)}get isNull(){return this.originName==null&&this.itemName==null}get fullName(){return(this.originName!==null?this.originName:"?")+"."+this.itemName}toString(){return this.fullName}Equals(m){if(m instanceof Gi){let v=m;return v.itemName==this.itemName&&v.originName==this.originName}return!1}copy(){return new Gi(this.originName,this.itemName)}serialized(){return JSON.stringify({originName:this.originName,itemName:this.itemName})}static fromSerializedKey(m){let v=JSON.parse(m);if(!Gi.isLikeInkListItem(v))return Gi.Null;let y=v;return new Gi(y.originName,y.itemName)}static isLikeInkListItem(m){return!(typeof m!="object"||!m.hasOwnProperty("originName")||!m.hasOwnProperty("itemName")||typeof m.originName!="string"||typeof m.itemName!="string")}};r.InkListItem=c;var s=class ue extends Map{constructor(){if(super(arguments[0]instanceof ue?arguments[0]:[]),this.origins=null,this._originNames=[],arguments[0]instanceof ue){let m=arguments[0],v=m.originNames;v!==null&&(this._originNames=v.slice()),m.origins!==null&&(this.origins=m.origins.slice())}else if(typeof arguments[0]=="string"){let m=arguments[0],v=arguments[1];if(this.SetInitialOriginName(m),v.listDefinitions===null)return(0,u.throwNullException)("originStory.listDefinitions");let y=v.listDefinitions.TryListGetDefinition(m,null);if(y.exists){if(y.result===null)return(0,u.throwNullException)("def.result");this.origins=[y.result]}else throw new Error("InkList origin could not be found in story when constructing new list: "+m)}else if(typeof arguments[0]=="object"&&arguments[0].hasOwnProperty("Key")&&arguments[0].hasOwnProperty("Value")){let m=arguments[0];this.Add(m.Key,m.Value)}}static FromString(m,v){var y;if(m==null||m=="")return new ue;let A=(y=v.listDefinitions)===null||y===void 0?void 0:y.FindSingleItemListWithName(m);if(A)return A.value===null?(0,u.throwNullException)("listValue.value"):new ue(A.value);throw new Error("Could not find the InkListItem from the string '"+m+"' to create an InkList because it doesn't exist in the original list definition in ink.")}AddItem(m,v=null){if(m instanceof c){let y=m;if(y.originName==null){this.AddItem(y.itemName);return}if(this.origins===null)return(0,u.throwNullException)("this.origins");for(let A of this.origins)if(A.name==y.originName){let o=A.TryGetValueForItem(y,0);if(o.exists){this.Add(y,o.result);return}else throw new Error("Could not add the item "+y+" to this list because it doesn't exist in the original list definition in ink.")}throw new Error("Failed to add item to list because the item was from a new list definition that wasn't previously known to this list. Only items from previously known lists can be used, so that the int value can be found.")}else if(m!==null){let y=m,A=null;if(this.origins===null)return(0,u.throwNullException)("this.origins");for(let o of this.origins){if(y===null)return(0,u.throwNullException)("itemName");if(o.ContainsItemWithName(y)){if(A!=null)throw new Error("Could not add the item "+y+" to this list because it could come from either "+o.name+" or "+A.name);A=o}}if(A==null){if(v==null)throw new Error("Could not add the item "+y+" to this list because it isn't known to any list definitions previously associated with this list.");{let o=ue.FromString(y,v).orderedItems[0];this.Add(o.Key,o.Value)}}else{let o=new c(A.name,y),T=A.ValueForItem(o);this.Add(o,T)}}}ContainsItemNamed(m){for(let[v]of this)if(c.fromSerializedKey(v).itemName==m)return!0;return!1}ContainsKey(m){return this.has(m.serialized())}Add(m,v){let y=m.serialized();if(this.has(y))throw new Error(`The Map already contains an entry for ${m}`);this.set(y,v)}Remove(m){return this.delete(m.serialized())}get Count(){return this.size}get originOfMaxItem(){if(this.origins==null)return null;let m=this.maxItem.Key.originName,v=null;return this.origins.every(y=>y.name==m?(v=y,!1):!0),v}get originNames(){if(this.Count>0){this._originNames==null&&this.Count>0?this._originNames=[]:(this._originNames||(this._originNames=[]),this._originNames.length=0);for(let[m]of this){let v=c.fromSerializedKey(m);if(v.originName===null)return(0,u.throwNullException)("item.originName");this._originNames.push(v.originName)}}return this._originNames}SetInitialOriginName(m){this._originNames=[m]}SetInitialOriginNames(m){m==null?this._originNames=null:this._originNames=m.slice()}get maxItem(){let m={Key:c.Null,Value:0};for(let[v,y]of this){let A=c.fromSerializedKey(v);(m.Key.isNull||y>m.Value)&&(m={Key:A,Value:y})}return m}get minItem(){let m={Key:c.Null,Value:0};for(let[v,y]of this){let A=c.fromSerializedKey(v);(m.Key.isNull||y<m.Value)&&(m={Key:A,Value:y})}return m}get inverse(){let m=new ue;if(this.origins!=null)for(let v of this.origins)for(let[y,A]of v.items){let o=c.fromSerializedKey(y);this.ContainsKey(o)||m.Add(o,A)}return m}get all(){let m=new ue;if(this.origins!=null)for(let v of this.origins)for(let[y,A]of v.items){let o=c.fromSerializedKey(y);m.set(o.serialized(),A)}return m}Union(m){let v=new ue(this);for(let[y,A]of m)v.set(y,A);return v}Intersect(m){let v=new ue;for(let[y,A]of this)m.has(y)&&v.set(y,A);return v}HasIntersection(m){for(let[v]of this)if(m.has(v))return!0;return!1}Without(m){let v=new ue(this);for(let[y]of m)v.delete(y);return v}Contains(m){if(typeof m=="string")return this.ContainsItemNamed(m);const v=m;if(v.size==0||this.size==0)return!1;for(let[y]of v)if(!this.has(y))return!1;return!0}GreaterThan(m){return this.Count==0?!1:m.Count==0?!0:this.minItem.Value>m.maxItem.Value}GreaterThanOrEquals(m){return this.Count==0?!1:m.Count==0?!0:this.minItem.Value>=m.minItem.Value&&this.maxItem.Value>=m.maxItem.Value}LessThan(m){return m.Count==0?!1:this.Count==0?!0:this.maxItem.Value<m.minItem.Value}LessThanOrEquals(m){return m.Count==0?!1:this.Count==0?!0:this.maxItem.Value<=m.maxItem.Value&&this.minItem.Value<=m.minItem.Value}MaxAsList(){return this.Count>0?new ue(this.maxItem):new ue}MinAsList(){return this.Count>0?new ue(this.minItem):new ue}ListWithSubRange(m,v){if(this.Count==0)return new ue;let y=this.orderedItems,A=0,o=Number.MAX_SAFE_INTEGER;Number.isInteger(m)?A=m:m instanceof ue&&m.Count>0&&(A=m.minItem.Value),Number.isInteger(v)?o=v:v instanceof ue&&v.Count>0&&(o=v.maxItem.Value);let T=new ue;T.SetInitialOriginNames(this.originNames);for(let f of y)f.Value>=A&&f.Value<=o&&T.Add(f.Key,f.Value);return T}Equals(m){if(!(m instanceof ue)||m.Count!=this.Count)return!1;for(let[v]of this)if(!m.has(v))return!1;return!0}get orderedItems(){let m=new Array;for(let[v,y]of this){let A=c.fromSerializedKey(v);m.push({Key:A,Value:y})}return m.sort((v,y)=>v.Key.originName===null?(0,u.throwNullException)("x.Key.originName"):y.Key.originName===null?(0,u.throwNullException)("y.Key.originName"):v.Value==y.Value?v.Key.originName.localeCompare(y.Key.originName):v.Value<y.Value?-1:v.Value>y.Value?1:0),m}get singleItem(){for(let m of this.orderedItems)return m.Key;return null}toString(){let m=this.orderedItems,v=new h.StringBuilder;for(let y=0;y<m.length;y++){y>0&&v.Append(", ");let A=m[y].Key;if(A.itemName===null)return(0,u.throwNullException)("item.itemName");v.Append(A.itemName)}return v.toString()}valueOf(){return NaN}};r.InkList=s})),Gl=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.StoryException=void 0;var u=class extends Error{constructor(h){super(h),this.useEndLineNumber=!1,this.message=h,this.name="StoryException"}};r.StoryException=u})),Ia=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tryParseFloat=r.tryParseInt=r.tryGetValueFromMap=void 0;function u(s,p,m){if(s===null)return{result:m,exists:!1};let v=s.get(p);return typeof v>"u"?{result:m,exists:!1}:{result:v,exists:!0}}r.tryGetValueFromMap=u;function h(s,p=0){let m=parseInt(s);return Number.isNaN(m)?{result:p,exists:!1}:{result:m,exists:!0}}r.tryParseInt=h;function c(s,p=0){let m=parseFloat(s);return Number.isNaN(m)?{result:p,exists:!1}:{result:m,exists:!0}}r.tryParseFloat=c})),Jt=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ValueType=r.ListValue=r.VariablePointerValue=r.DivertTargetValue=r.StringValue=r.FloatValue=r.IntValue=r.BoolValue=r.Value=r.AbstractValue=void 0;var u=Fe(),h=Me(),c=Ie(),s=Gl(),p=Bt(),m=Ia(),v=be(),y=class Wm extends u.InkObject{static Create(q,z){if(z){if(z===M.Int&&Number.isInteger(Number(q)))return new T(Number(q));if(z===M.Float&&!isNaN(q))return new f(Number(q))}if(typeof q=="boolean")return new o(!!q);if(typeof q=="string")return new g(String(q));if(Number.isInteger(Number(q)))return new T(Number(q));if(isNaN(q)){if(q instanceof h.Path)return new V((0,p.asOrThrows)(q,h.Path));if(q instanceof c.InkList)return new k((0,p.asOrThrows)(q,c.InkList))}else return new f(Number(q));return null}Copy(){return(0,p.asOrThrows)(Wm.Create(this.valueObject),u.InkObject)}BadCastException(q){return new s.StoryException("Can't cast "+this.valueObject+" from "+this.valueType+" to "+q)}};r.AbstractValue=y;var A=class extends y{constructor(j){super(),this.value=j}get valueObject(){return this.value}toString(){return this.value===null?(0,v.throwNullException)("Value.value"):this.value.toString()}};r.Value=A;var o=class extends A{constructor(j){super(j||!1)}get isTruthy(){return!!this.value}get valueType(){return M.Bool}Cast(j){if(this.value===null)return(0,v.throwNullException)("Value.value");if(j==this.valueType)return this;if(j==M.Int)return new T(this.value?1:0);if(j==M.Float)return new f(this.value?1:0);if(j==M.String)return new g(this.value?"true":"false");throw this.BadCastException(j)}toString(){return this.value?"true":"false"}};r.BoolValue=o;var T=class extends A{constructor(j){super(j||0)}get isTruthy(){return this.value!=0}get valueType(){return M.Int}Cast(j){if(this.value===null)return(0,v.throwNullException)("Value.value");if(j==this.valueType)return this;if(j==M.Bool)return new o(this.value!==0);if(j==M.Float)return new f(this.value);if(j==M.String)return new g(""+this.value);throw this.BadCastException(j)}};r.IntValue=T;var f=class extends A{constructor(j){super(j||0)}get isTruthy(){return this.value!=0}get valueType(){return M.Float}Cast(j){if(this.value===null)return(0,v.throwNullException)("Value.value");if(j==this.valueType)return this;if(j==M.Bool)return new o(this.value!==0);if(j==M.Int)return new T(this.value);if(j==M.String)return new g(""+this.value);throw this.BadCastException(j)}};r.FloatValue=f;var g=class extends A{constructor(j){if(super(j||""),this._isNewline=this.value==`
3
+ `,this._isInlineWhitespace=!0,this.value===null)return(0,v.throwNullException)("Value.value");this.value.length>0&&this.value.split("").every(q=>q!=" "&&q!=" "?(this._isInlineWhitespace=!1,!1):!0)}get valueType(){return M.String}get isTruthy(){return this.value===null?(0,v.throwNullException)("Value.value"):this.value.length>0}get isNewline(){return this._isNewline}get isInlineWhitespace(){return this._isInlineWhitespace}get isNonWhitespace(){return!this.isNewline&&!this.isInlineWhitespace}Cast(j){if(j==this.valueType)return this;if(j==M.Int){let q=(0,m.tryParseInt)(this.value);if(q.exists)return new T(q.result);throw this.BadCastException(j)}if(j==M.Float){let q=(0,m.tryParseFloat)(this.value);if(q.exists)return new f(q.result);throw this.BadCastException(j)}throw this.BadCastException(j)}};r.StringValue=g;var V=class extends A{constructor(j=null){super(j)}get valueType(){return M.DivertTarget}get targetPath(){return this.value===null?(0,v.throwNullException)("Value.value"):this.value}set targetPath(j){this.value=j}get isTruthy(){throw new Error("Shouldn't be checking the truthiness of a divert target")}Cast(j){if(j==this.valueType)return this;throw this.BadCastException(j)}toString(){return"DivertTargetValue("+this.targetPath+")"}};r.DivertTargetValue=V;var B=class km extends A{constructor(q,z=-1){super(q),this._contextIndex=z}get contextIndex(){return this._contextIndex}set contextIndex(q){this._contextIndex=q}get variableName(){return this.value===null?(0,v.throwNullException)("Value.value"):this.value}set variableName(q){this.value=q}get valueType(){return M.VariablePointer}get isTruthy(){throw new Error("Shouldn't be checking the truthiness of a variable pointer")}Cast(q){if(q==this.valueType)return this;throw this.BadCastException(q)}toString(){return"VariablePointerValue("+this.variableName+")"}Copy(){return new km(this.variableName,this.contextIndex)}};r.VariablePointerValue=B;var k=class Zo extends A{get isTruthy(){return this.value===null?(0,v.throwNullException)("this.value"):this.value.Count>0}get valueType(){return M.List}Cast(q){if(this.value===null)return(0,v.throwNullException)("Value.value");if(q==M.Int){let z=this.value.maxItem;return z.Key.isNull?new T(0):new T(z.Value)}else if(q==M.Float){let z=this.value.maxItem;return z.Key.isNull?new f(0):new f(z.Value)}else if(q==M.String){let z=this.value.maxItem;return z.Key.isNull?new g(""):new g(z.Key.toString())}if(q==this.valueType)return this;throw this.BadCastException(q)}constructor(q,z){super(null),!q&&!z?this.value=new c.InkList:q instanceof c.InkList?this.value=new c.InkList(q):q instanceof c.InkListItem&&typeof z=="number"&&(this.value=new c.InkList({Key:q,Value:z}))}static RetainListOriginsForAssignment(q,z){let Q=(0,p.asOrNull)(q,Zo),O=(0,p.asOrNull)(z,Zo);if(O&&O.value===null)return(0,v.throwNullException)("newList.value");if(Q&&Q.value===null)return(0,v.throwNullException)("oldList.value");Q&&O&&O.value.Count==0&&O.value.SetInitialOriginNames(Q.value.originNames)}};r.ListValue=k;var M;(function(j){j[j.Bool=-1]="Bool",j[j.Int=0]="Int",j[j.Float=1]="Float",j[j.List=2]="List",j[j.String=3]="String",j[j.DivertTarget=4]="DivertTarget",j[j.VariablePointer=5]="VariablePointer"})(M||(r.ValueType=M={}))})),rv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SearchResult=void 0;var u=oe(),h=class Bm{constructor(){this.obj=null,this.approximate=!1}get correctObj(){return this.approximate?null:this.obj}get container(){return this.obj instanceof u.Container?this.obj:null}copy(){let s=new Bm;return s.obj=this.obj,s.approximate=this.approximate,s}};r.SearchResult=h})),oe=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Container=void 0;var u=Jt(),h=be(),c=Ui(),s=Fe(),p=rv(),m=Me(),v=Bl(),y=Ia(),A=Bt(),o=class Ye extends s.InkObject{constructor(){super(...arguments),this.name=null,this._content=[],this.namedContent=new Map,this.visitsShouldBeCounted=!1,this.turnIndexShouldBeCounted=!1,this.countingAtStartOnly=!1,this._pathToFirstLeafContent=null}get hasValidName(){return this.name!=null&&this.name.length>0}get content(){return this._content}set content(f){this.AddContent(f)}get namedOnlyContent(){let f=new Map;for(let[g,V]of this.namedContent){let B=(0,A.asOrThrows)(V,s.InkObject);f.set(g,B)}for(let g of this.content){let V=(0,A.asINamedContentOrNull)(g);V!=null&&V.hasValidName&&f.delete(V.name)}return f.size==0&&(f=null),f}set namedOnlyContent(f){let g=this.namedOnlyContent;if(g!=null)for(let[V]of g)this.namedContent.delete(V);if(f!=null)for(let[,V]of f){let B=(0,A.asINamedContentOrNull)(V);B!=null&&this.AddToNamedContentOnly(B)}}get countFlags(){let f=0;return this.visitsShouldBeCounted&&(f|=Ye.CountFlags.Visits),this.turnIndexShouldBeCounted&&(f|=Ye.CountFlags.Turns),this.countingAtStartOnly&&(f|=Ye.CountFlags.CountStartOnly),f==Ye.CountFlags.CountStartOnly&&(f=0),f}set countFlags(f){let g=f;(g&Ye.CountFlags.Visits)>0&&(this.visitsShouldBeCounted=!0),(g&Ye.CountFlags.Turns)>0&&(this.turnIndexShouldBeCounted=!0),(g&Ye.CountFlags.CountStartOnly)>0&&(this.countingAtStartOnly=!0)}get pathToFirstLeafContent(){return this._pathToFirstLeafContent==null&&(this._pathToFirstLeafContent=this.path.PathByAppendingPath(this.internalPathToFirstLeafContent)),this._pathToFirstLeafContent}get internalPathToFirstLeafContent(){let f=[],g=this;for(;g instanceof Ye;)g.content.length>0&&(f.push(new m.Path.Component(0)),g=g.content[0]);return new m.Path(f)}AddContent(f){if(f instanceof Array){let g=f;for(let V of g)this.AddContent(V)}else{let g=f;if(this._content.push(g),g.parent)throw new Error("content is already in "+g.parent);g.parent=this,this.TryAddNamedContent(g)}}TryAddNamedContent(f){let g=(0,A.asINamedContentOrNull)(f);g!=null&&g.hasValidName&&this.AddToNamedContentOnly(g)}AddToNamedContentOnly(f){v.Debug.AssertType(f,s.InkObject,"Can only add Runtime.Objects to a Runtime.Container");let g=(0,A.asOrThrows)(f,s.InkObject);if(g.parent=this,f.name===null)return(0,h.throwNullException)("namedContentObj.name");this.namedContent.set(f.name,f)}ContentAtPath(f,g=0,V=-1){V==-1&&(V=f.length);let B=new p.SearchResult;B.approximate=!1;let k=this,M=this;for(let j=g;j<V;++j){let q=f.GetComponent(j);if(k==null){B.approximate=!0;break}let z=k.ContentWithPathComponent(q);if(z==null){B.approximate=!0;break}const Q=(0,A.asOrNull)(z,Ye);if(j<V-1&&Q==null){B.approximate=!0;break}M=z,k=Q}return B.obj=M,B}InsertContent(f,g){if(this.content.splice(g,0,f),f.parent)throw new Error("content is already in "+f.parent);f.parent=this,this.TryAddNamedContent(f)}AddContentsOfContainer(f){this.content.push(...f.content);for(let g of f.content)g.parent=this,this.TryAddNamedContent(g)}ContentWithPathComponent(f){if(f.isIndex)return f.index>=0&&f.index<this.content.length?this.content[f.index]:null;if(f.isParent)return this.parent;{if(f.name===null)return(0,h.throwNullException)("component.name");let g=(0,y.tryGetValueFromMap)(this.namedContent,f.name,null);return g.exists?(0,A.asOrThrows)(g.result,s.InkObject):null}}BuildStringOfHierarchy(){let f;if(arguments.length==0)return f=new c.StringBuilder,this.BuildStringOfHierarchy(f,0,null),f.toString();f=arguments[0];let g=arguments[1],V=arguments[2];function B(){for(let j=0;j<4*g;++j)f.Append(" ")}B(),f.Append("["),this.hasValidName&&f.AppendFormat(" ({0})",this.name),this==V&&f.Append(" <---"),f.AppendLine(),g++;for(let M=0;M<this.content.length;++M){let j=this.content[M];j instanceof Ye?j.BuildStringOfHierarchy(f,g,V):(B(),j instanceof u.StringValue?(f.Append('"'),f.Append(j.toString().replace(`
4
+ `,"\\n")),f.Append('"')):f.Append(j.toString())),M!=this.content.length-1&&f.Append(","),!(j instanceof Ye)&&j==V&&f.Append(" <---"),f.AppendLine()}let k=new Map;for(let[M,j]of this.namedContent)this.content.indexOf((0,A.asOrThrows)(j,s.InkObject))>=0||k.set(M,j);if(k.size>0){B(),f.AppendLine("-- named: --");for(let[,M]of k)v.Debug.AssertType(M,Ye,"Can only print out named Containers"),M.BuildStringOfHierarchy(f,g,V),f.AppendLine()}g--,B(),f.Append("]")}};r.Container=o,(function(T){(function(f){f[f.Start=0]="Start",f[f.Visits=1]="Visits",f[f.Turns=2]="Turns",f[f.CountStartOnly=4]="CountStartOnly"})(T.CountFlags||(T.CountFlags={}))})(o||(r.Container=o={}))})),Ee=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ControlCommand=void 0;var u=Fe(),h=class gt extends u.InkObject{get commandType(){return this._commandType}constructor(s=gt.CommandType.NotSet){super(),this._commandType=s}Copy(){return new gt(this.commandType)}static EvalStart(){return new gt(gt.CommandType.EvalStart)}static EvalOutput(){return new gt(gt.CommandType.EvalOutput)}static EvalEnd(){return new gt(gt.CommandType.EvalEnd)}static Duplicate(){return new gt(gt.CommandType.Duplicate)}static PopEvaluatedValue(){return new gt(gt.CommandType.PopEvaluatedValue)}static PopFunction(){return new gt(gt.CommandType.PopFunction)}static PopTunnel(){return new gt(gt.CommandType.PopTunnel)}static BeginString(){return new gt(gt.CommandType.BeginString)}static EndString(){return new gt(gt.CommandType.EndString)}static NoOp(){return new gt(gt.CommandType.NoOp)}static ChoiceCount(){return new gt(gt.CommandType.ChoiceCount)}static Turns(){return new gt(gt.CommandType.Turns)}static TurnsSince(){return new gt(gt.CommandType.TurnsSince)}static ReadCount(){return new gt(gt.CommandType.ReadCount)}static Random(){return new gt(gt.CommandType.Random)}static SeedRandom(){return new gt(gt.CommandType.SeedRandom)}static VisitIndex(){return new gt(gt.CommandType.VisitIndex)}static SequenceShuffleIndex(){return new gt(gt.CommandType.SequenceShuffleIndex)}static StartThread(){return new gt(gt.CommandType.StartThread)}static Done(){return new gt(gt.CommandType.Done)}static End(){return new gt(gt.CommandType.End)}static ListFromInt(){return new gt(gt.CommandType.ListFromInt)}static ListRange(){return new gt(gt.CommandType.ListRange)}static ListRandom(){return new gt(gt.CommandType.ListRandom)}static BeginTag(){return new gt(gt.CommandType.BeginTag)}static EndTag(){return new gt(gt.CommandType.EndTag)}toString(){return"ControlCommand "+this.commandType.toString()}};r.ControlCommand=h,(function(c){(function(s){s[s.NotSet=-1]="NotSet",s[s.EvalStart=0]="EvalStart",s[s.EvalOutput=1]="EvalOutput",s[s.EvalEnd=2]="EvalEnd",s[s.Duplicate=3]="Duplicate",s[s.PopEvaluatedValue=4]="PopEvaluatedValue",s[s.PopFunction=5]="PopFunction",s[s.PopTunnel=6]="PopTunnel",s[s.BeginString=7]="BeginString",s[s.EndString=8]="EndString",s[s.NoOp=9]="NoOp",s[s.ChoiceCount=10]="ChoiceCount",s[s.Turns=11]="Turns",s[s.TurnsSince=12]="TurnsSince",s[s.ReadCount=13]="ReadCount",s[s.Random=14]="Random",s[s.SeedRandom=15]="SeedRandom",s[s.VisitIndex=16]="VisitIndex",s[s.SequenceShuffleIndex=17]="SequenceShuffleIndex",s[s.StartThread=18]="StartThread",s[s.Done=19]="Done",s[s.End=20]="End",s[s.ListFromInt=21]="ListFromInt",s[s.ListRange=22]="ListRange",s[s.ListRandom=23]="ListRandom",s[s.BeginTag=24]="BeginTag",s[s.EndTag=25]="EndTag",s[s.TOTAL_VALUES=26]="TOTAL_VALUES"})(c.CommandType||(c.CommandType={}))})(h||(r.ControlCommand=h={}))})),on=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Expression=void 0;var u=oe(),h=Ee(),c=Zt(),s=class extends c.ParsedObject{constructor(){super(...arguments),this._prototypeRuntimeConstantExpression=null,this.outputWhenComplete=!1,this.GenerateRuntimeObject=()=>{const p=new u.Container;return p.AddContent(h.ControlCommand.EvalStart()),this.GenerateIntoContainer(p),this.outputWhenComplete&&p.AddContent(h.ControlCommand.EvalOutput()),p.AddContent(h.ControlCommand.EvalEnd()),p},this.GenerateConstantIntoContainer=p=>{this._prototypeRuntimeConstantExpression===null&&(this._prototypeRuntimeConstantExpression=new u.Container,this.GenerateIntoContainer(this._prototypeRuntimeConstantExpression));for(const m of this._prototypeRuntimeConstantExpression.content){const v=m.Copy();v&&p.AddContent(v)}},this.toString=()=>"No string value in JavaScript."}get typeName(){return"Expression"}Equals(p){return!1}};r.Expression=s})),Hi=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Void=void 0;var u=Fe(),h=class extends u.InkObject{toString(){return"Void"}};r.Void=h})),yn=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.NativeFunctionCall=void 0;var u=Jt(),h=Gl(),c=Hi(),s=Ie(),p=Fe(),m=Bt(),v=be(),y=class Ke extends p.InkObject{static CallWithName(o){return new Ke(o)}static CallExistsWithName(o){return this.GenerateNativeFunctionsIfNecessary(),this._nativeFunctions.get(o)}get name(){return this._name===null?(0,v.throwNullException)("NativeFunctionCall._name"):this._name}set name(o){this._name=o,this._isPrototype||(Ke._nativeFunctions===null?(0,v.throwNullException)("NativeFunctionCall._nativeFunctions"):this._prototype=Ke._nativeFunctions.get(this._name)||null)}get numberOfParameters(){return this._prototype?this._prototype.numberOfParameters:this._numberOfParameters}set numberOfParameters(o){this._numberOfParameters=o}Call(o){if(this._prototype)return this._prototype.Call(o);if(this.numberOfParameters!=o.length)throw new Error("Unexpected number of parameters");let T=!1;for(let V of o){if(V instanceof c.Void)throw new h.StoryException("Attempting to perform "+this.name+' on a void value. Did you forget to "return" a value from a function you called here?');V instanceof u.ListValue&&(T=!0)}if(o.length==2&&T)return this.CallBinaryListOperation(o);let f=this.CoerceValuesToSingleType(o),g=f[0].valueType;return g==u.ValueType.Int?this.CallType(f):g==u.ValueType.Float?this.CallType(f):g==u.ValueType.String?this.CallType(f):g==u.ValueType.DivertTarget?this.CallType(f):g==u.ValueType.List?this.CallType(f):null}CallType(o){let T=(0,m.asOrThrows)(o[0],u.Value),f=T.valueType,g=T,V=o.length;if(V==2||V==1){if(this._operationFuncs===null)return(0,v.throwNullException)("NativeFunctionCall._operationFuncs");let B=this._operationFuncs.get(f);if(!B){const k=u.ValueType[f];throw new h.StoryException("Cannot perform operation "+this.name+" on "+k)}if(V==2){let k=(0,m.asOrThrows)(o[1],u.Value),M=B;if(g.value===null||k.value===null)return(0,v.throwNullException)("NativeFunctionCall.Call BinaryOp values");let j=M(g.value,k.value);return u.Value.Create(j)}else{let k=B;if(g.value===null)return(0,v.throwNullException)("NativeFunctionCall.Call UnaryOp value");let M=k(g.value);return this.name===Ke.Int?u.Value.Create(M,u.ValueType.Int):this.name===Ke.Float?u.Value.Create(M,u.ValueType.Float):u.Value.Create(M,T.valueType)}}else throw new Error("Unexpected number of parameters to NativeFunctionCall: "+o.length)}CallBinaryListOperation(o){if((this.name=="+"||this.name=="-")&&o[0]instanceof u.ListValue&&o[1]instanceof u.IntValue)return this.CallListIncrementOperation(o);let T=(0,m.asOrThrows)(o[0],u.Value),f=(0,m.asOrThrows)(o[1],u.Value);if((this.name=="&&"||this.name=="||")&&(T.valueType!=u.ValueType.List||f.valueType!=u.ValueType.List)){if(this._operationFuncs===null)return(0,v.throwNullException)("NativeFunctionCall._operationFuncs");let g=this._operationFuncs.get(u.ValueType.Int);if(g===null)return(0,v.throwNullException)("NativeFunctionCall.CallBinaryListOperation op");let V=(0,m.asBooleanOrThrows)(g(T.isTruthy?1:0,f.isTruthy?1:0));return new u.BoolValue(V)}if(T.valueType==u.ValueType.List&&f.valueType==u.ValueType.List)return this.CallType([T,f]);throw new h.StoryException("Can not call use "+this.name+" operation on "+u.ValueType[T.valueType]+" and "+u.ValueType[f.valueType])}CallListIncrementOperation(o){let T=(0,m.asOrThrows)(o[0],u.ListValue),f=(0,m.asOrThrows)(o[1],u.IntValue),g=new s.InkList;if(T.value===null)return(0,v.throwNullException)("NativeFunctionCall.CallListIncrementOperation listVal.value");for(let[V,B]of T.value){let k=s.InkListItem.fromSerializedKey(V);if(this._operationFuncs===null)return(0,v.throwNullException)("NativeFunctionCall._operationFuncs");let M=this._operationFuncs.get(u.ValueType.Int);if(f.value===null)return(0,v.throwNullException)("NativeFunctionCall.CallListIncrementOperation intVal.value");let j=M(B,f.value),q=null;if(T.value.origins===null)return(0,v.throwNullException)("NativeFunctionCall.CallListIncrementOperation listVal.value.origins");for(let z of T.value.origins)if(z.name==k.originName){q=z;break}if(q!=null){let z=q.TryGetItemWithValue(j,s.InkListItem.Null);z.exists&&g.Add(z.result,j)}}return new u.ListValue(g)}CoerceValuesToSingleType(o){let T=u.ValueType.Int,f=null;for(let V of o){let B=(0,m.asOrThrows)(V,u.Value);B.valueType>T&&(T=B.valueType),B.valueType==u.ValueType.List&&(f=(0,m.asOrNull)(B,u.ListValue))}let g=[];if(u.ValueType[T]==u.ValueType[u.ValueType.List])for(let V of o){let B=(0,m.asOrThrows)(V,u.Value);if(B.valueType==u.ValueType.List)g.push(B);else if(B.valueType==u.ValueType.Int){let k=parseInt(B.valueObject);if(f=(0,m.asOrThrows)(f,u.ListValue),f.value===null)return(0,v.throwNullException)("NativeFunctionCall.CoerceValuesToSingleType specialCaseList.value");let M=f.value.originOfMaxItem;if(M===null)return(0,v.throwNullException)("NativeFunctionCall.CoerceValuesToSingleType list");let j=M.TryGetItemWithValue(k,s.InkListItem.Null);if(j.exists){let q=new u.ListValue(j.result,k);g.push(q)}else throw new h.StoryException("Could not find List item with the value "+k+" in "+M.name)}else{const k=u.ValueType[B.valueType];throw new h.StoryException("Cannot mix Lists and "+k+" values in this operation")}}else for(let V of o){let B=(0,m.asOrThrows)(V,u.Value).Cast(T);g.push(B)}return g}constructor(){if(super(),this._name=null,this._numberOfParameters=0,this._prototype=null,this._isPrototype=!1,this._operationFuncs=null,arguments.length===0)Ke.GenerateNativeFunctionsIfNecessary();else if(arguments.length===1){let o=arguments[0];Ke.GenerateNativeFunctionsIfNecessary(),this.name=o}else if(arguments.length===2){let o=arguments[0],T=arguments[1];this._isPrototype=!0,this.name=o,this.numberOfParameters=T}}static Identity(o){return o}static GenerateNativeFunctionsIfNecessary(){if(this._nativeFunctions==null){this._nativeFunctions=new Map,this.AddIntBinaryOp(this.Add,(f,g)=>f+g),this.AddIntBinaryOp(this.Subtract,(f,g)=>f-g),this.AddIntBinaryOp(this.Multiply,(f,g)=>f*g),this.AddIntBinaryOp(this.Divide,(f,g)=>Math.floor(f/g)),this.AddIntBinaryOp(this.Mod,(f,g)=>f%g),this.AddIntUnaryOp(this.Negate,f=>-f),this.AddIntBinaryOp(this.Equal,(f,g)=>f==g),this.AddIntBinaryOp(this.Greater,(f,g)=>f>g),this.AddIntBinaryOp(this.Less,(f,g)=>f<g),this.AddIntBinaryOp(this.GreaterThanOrEquals,(f,g)=>f>=g),this.AddIntBinaryOp(this.LessThanOrEquals,(f,g)=>f<=g),this.AddIntBinaryOp(this.NotEquals,(f,g)=>f!=g),this.AddIntUnaryOp(this.Not,f=>f==0),this.AddIntBinaryOp(this.And,(f,g)=>f!=0&&g!=0),this.AddIntBinaryOp(this.Or,(f,g)=>f!=0||g!=0),this.AddIntBinaryOp(this.Max,(f,g)=>Math.max(f,g)),this.AddIntBinaryOp(this.Min,(f,g)=>Math.min(f,g)),this.AddIntBinaryOp(this.Pow,(f,g)=>Math.pow(f,g)),this.AddIntUnaryOp(this.Floor,Ke.Identity),this.AddIntUnaryOp(this.Ceiling,Ke.Identity),this.AddIntUnaryOp(this.Int,Ke.Identity),this.AddIntUnaryOp(this.Float,f=>f),this.AddFloatBinaryOp(this.Add,(f,g)=>f+g),this.AddFloatBinaryOp(this.Subtract,(f,g)=>f-g),this.AddFloatBinaryOp(this.Multiply,(f,g)=>f*g),this.AddFloatBinaryOp(this.Divide,(f,g)=>f/g),this.AddFloatBinaryOp(this.Mod,(f,g)=>f%g),this.AddFloatUnaryOp(this.Negate,f=>-f),this.AddFloatBinaryOp(this.Equal,(f,g)=>f==g),this.AddFloatBinaryOp(this.Greater,(f,g)=>f>g),this.AddFloatBinaryOp(this.Less,(f,g)=>f<g),this.AddFloatBinaryOp(this.GreaterThanOrEquals,(f,g)=>f>=g),this.AddFloatBinaryOp(this.LessThanOrEquals,(f,g)=>f<=g),this.AddFloatBinaryOp(this.NotEquals,(f,g)=>f!=g),this.AddFloatUnaryOp(this.Not,f=>f==0),this.AddFloatBinaryOp(this.And,(f,g)=>f!=0&&g!=0),this.AddFloatBinaryOp(this.Or,(f,g)=>f!=0||g!=0),this.AddFloatBinaryOp(this.Max,(f,g)=>Math.max(f,g)),this.AddFloatBinaryOp(this.Min,(f,g)=>Math.min(f,g)),this.AddFloatBinaryOp(this.Pow,(f,g)=>Math.pow(f,g)),this.AddFloatUnaryOp(this.Floor,f=>Math.floor(f)),this.AddFloatUnaryOp(this.Ceiling,f=>Math.ceil(f)),this.AddFloatUnaryOp(this.Int,f=>Math.floor(f)),this.AddFloatUnaryOp(this.Float,Ke.Identity),this.AddStringBinaryOp(this.Add,(f,g)=>f+g),this.AddStringBinaryOp(this.Equal,(f,g)=>f===g),this.AddStringBinaryOp(this.NotEquals,(f,g)=>f!==g),this.AddStringBinaryOp(this.Has,(f,g)=>f.includes(g)),this.AddStringBinaryOp(this.Hasnt,(f,g)=>!f.includes(g)),this.AddListBinaryOp(this.Add,(f,g)=>f.Union(g)),this.AddListBinaryOp(this.Subtract,(f,g)=>f.Without(g)),this.AddListBinaryOp(this.Has,(f,g)=>f.Contains(g)),this.AddListBinaryOp(this.Hasnt,(f,g)=>!f.Contains(g)),this.AddListBinaryOp(this.Intersect,(f,g)=>f.Intersect(g)),this.AddListBinaryOp(this.Equal,(f,g)=>f.Equals(g)),this.AddListBinaryOp(this.Greater,(f,g)=>f.GreaterThan(g)),this.AddListBinaryOp(this.Less,(f,g)=>f.LessThan(g)),this.AddListBinaryOp(this.GreaterThanOrEquals,(f,g)=>f.GreaterThanOrEquals(g)),this.AddListBinaryOp(this.LessThanOrEquals,(f,g)=>f.LessThanOrEquals(g)),this.AddListBinaryOp(this.NotEquals,(f,g)=>!f.Equals(g)),this.AddListBinaryOp(this.And,(f,g)=>f.Count>0&&g.Count>0),this.AddListBinaryOp(this.Or,(f,g)=>f.Count>0||g.Count>0),this.AddListUnaryOp(this.Not,f=>f.Count==0?1:0),this.AddListUnaryOp(this.Invert,f=>f.inverse),this.AddListUnaryOp(this.All,f=>f.all),this.AddListUnaryOp(this.ListMin,f=>f.MinAsList()),this.AddListUnaryOp(this.ListMax,f=>f.MaxAsList()),this.AddListUnaryOp(this.Count,f=>f.Count),this.AddListUnaryOp(this.ValueOfList,f=>f.maxItem.Value);let o=(f,g)=>f.Equals(g),T=(f,g)=>!f.Equals(g);this.AddOpToNativeFunc(this.Equal,2,u.ValueType.DivertTarget,o),this.AddOpToNativeFunc(this.NotEquals,2,u.ValueType.DivertTarget,T)}}AddOpFuncForType(o,T){this._operationFuncs==null&&(this._operationFuncs=new Map),this._operationFuncs.set(o,T)}static AddOpToNativeFunc(o,T,f,g){if(this._nativeFunctions===null)return(0,v.throwNullException)("NativeFunctionCall._nativeFunctions");let V=this._nativeFunctions.get(o);V||(V=new Ke(o,T),this._nativeFunctions.set(o,V)),V.AddOpFuncForType(f,g)}static AddIntBinaryOp(o,T){this.AddOpToNativeFunc(o,2,u.ValueType.Int,T)}static AddIntUnaryOp(o,T){this.AddOpToNativeFunc(o,1,u.ValueType.Int,T)}static AddFloatBinaryOp(o,T){this.AddOpToNativeFunc(o,2,u.ValueType.Float,T)}static AddFloatUnaryOp(o,T){this.AddOpToNativeFunc(o,1,u.ValueType.Float,T)}static AddStringBinaryOp(o,T){this.AddOpToNativeFunc(o,2,u.ValueType.String,T)}static AddListBinaryOp(o,T){this.AddOpToNativeFunc(o,2,u.ValueType.List,T)}static AddListUnaryOp(o,T){this.AddOpToNativeFunc(o,1,u.ValueType.List,T)}toString(){return'Native "'+this.name+'"'}};r.NativeFunctionCall=y,y.Add="+",y.Subtract="-",y.Divide="/",y.Multiply="*",y.Mod="%",y.Negate="_",y.Equal="==",y.Greater=">",y.Less="<",y.GreaterThanOrEquals=">=",y.LessThanOrEquals="<=",y.NotEquals="!=",y.Not="!",y.And="&&",y.Or="||",y.Min="MIN",y.Max="MAX",y.Pow="POW",y.Floor="FLOOR",y.Ceiling="CEILING",y.Int="INT",y.Float="FLOAT",y.Has="?",y.Hasnt="!?",y.Intersect="^",y.ListMin="LIST_MIN",y.ListMax="LIST_MAX",y.All="LIST_ALL",y.Count="LIST_COUNT",y.ValueOfList="LIST_VALUE",y.Invert="LIST_INVERT",y._nativeFunctions=null})),_s=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.NumberExpression=void 0;var u=on(),h=Jt(),c=Bt(),s=class Gm extends u.Expression{constructor(m,v){if(super(),this.isInt=()=>this.subtype=="int",this.isFloat=()=>this.subtype=="float",this.isBool=()=>this.subtype=="bool",this.GenerateIntoContainer=y=>{this.isInt()?y.AddContent(new h.IntValue(this.value)):this.isFloat()?y.AddContent(new h.FloatValue(this.value)):this.isBool()&&y.AddContent(new h.BoolValue(this.value))},this.toString=()=>String(this.value),typeof m=="number"&&!Number.isNaN(m)||typeof m=="boolean")this.value=m,this.subtype=v;else throw new Error("Unexpected object type in NumberExpression.")}get typeName(){return"Number"}Equals(m){const v=(0,c.asOrNull)(m,Gm);return v?v.subtype==this.subtype&&v.value==this.value:!1}};r.NumberExpression=s})),ah=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.UnaryExpression=void 0;var u=on(),h=yn(),c=_s(),s=Bt(),p=class extends u.Expression{get nativeNameForOp(){return this.op==="-"?"_":this.op==="not"?"!":this.op}constructor(m,v){super(),this.op=v,this.GenerateIntoContainer=y=>{this.innerExpression.GenerateIntoContainer(y),y.AddContent(h.NativeFunctionCall.CallWithName(this.nativeNameForOp))},this.toString=()=>this.nativeNameForOp+this.innerExpression,this.innerExpression=this.AddContent(m)}get typeName(){return"UnaryExpression"}};r.UnaryExpression=p,p.WithInner=(m,v)=>{const y=(0,s.asOrNull)(m,c.NumberExpression);if(y){if(v==="-"){if(y.isInt())return new c.NumberExpression(-y.value,"int");if(y.isFloat())return new c.NumberExpression(-y.value,"float")}else if(v=="!"||v=="not"){if(y.isInt())return new c.NumberExpression(y.value==0,"bool");if(y.isFloat())return new c.NumberExpression(y.value==0,"bool");if(y.isBool())return new c.NumberExpression(!y.value,"bool")}throw new Error("Unexpected operation or number type")}return new p(m,v)}})),lh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.BinaryExpression=void 0;var u=on(),h=yn(),c=ah(),s=Bt(),p=class extends u.Expression{constructor(m,v,y){super(),this.opName=y,this.GenerateIntoContainer=A=>{this.leftExpression.GenerateIntoContainer(A),this.rightExpression.GenerateIntoContainer(A),this.opName=this.NativeNameForOp(this.opName),A.AddContent(h.NativeFunctionCall.CallWithName(this.opName))},this.NativeNameForOp=A=>A==="and"?"&&":A==="or"?"||":A==="mod"?"%":A==="has"?"?":A==="hasnt"?"!?":A,this.toString=()=>`(${this.leftExpression} ${this.opName} ${this.rightExpression})`,this.leftExpression=this.AddContent(m),this.rightExpression=this.AddContent(v),this.opName=y}get typeName(){return"BinaryExpression"}ResolveReferences(m){if(super.ResolveReferences(m),this.NativeNameForOp(this.opName)==="?"){const v=(0,s.asOrNull)(this.leftExpression,c.UnaryExpression);v!==null&&(v.op==="not"||v.op==="!")&&this.Error(`Using 'not' or '!' here negates '${v.innerExpression}' rather than the result of the '?' or 'has' operator. You need to add parentheses around the (A ? B) expression.`)}}};r.BinaryExpression=p})),ql=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterSet=void 0;var u=class{constructor(h){this.set=new Set,this.Add=c=>this.set.add(c),this.AddRange=(c,s)=>{for(let p=c.charCodeAt(0);p<=s.charCodeAt(0);++p)this.Add(String.fromCharCode(p));return this},this.AddCharacters=c=>{if(typeof c=="string"||Array.isArray(c))for(const s of c)this.Add(s);else for(const s of c.set)this.Add(s);return this},h&&this.AddCharacters(h)}};r.CharacterSet=u,u.FromRange=(h,c)=>new u().AddRange(h,c)})),sv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CharacterRange=void 0;var u=ql(),h=class{constructor(c,s,p=[]){if(this._start=c,this._end=s,this._correspondingCharSet=new u.CharacterSet,this._excludes=new Set,this.ToCharacterSet=()=>{if(this._correspondingCharSet.set.size===0)for(let m=this.start.charCodeAt(0),v;m<=this.end.charCodeAt(0);m+=1)v=String.fromCharCode(m),this._excludes.has(v)||this._correspondingCharSet.AddCharacters(v);return this._correspondingCharSet},p instanceof u.CharacterSet)this._excludes=p.set;else for(const m of p)this._excludes.add(m)}get start(){return this._start}get end(){return this._end}};r.CharacterRange=h,h.Define=(c,s,p=[])=>new h(c,s,p)})),bs=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ChoicePoint=void 0;var u=Fe(),h=Me(),c=be(),s=class extends u.InkObject{constructor(p=!0){super(),this._pathOnChoice=null,this.hasCondition=!1,this.hasStartContent=!1,this.hasChoiceOnlyContent=!1,this.isInvisibleDefault=!1,this.onceOnly=!0,this.onceOnly=p}get pathOnChoice(){if(this._pathOnChoice!=null&&this._pathOnChoice.isRelative){let p=this.choiceTarget;p&&(this._pathOnChoice=p.path)}return this._pathOnChoice}set pathOnChoice(p){this._pathOnChoice=p}get choiceTarget(){return this._pathOnChoice===null?(0,c.throwNullException)("ChoicePoint._pathOnChoice"):this.ResolvePath(this._pathOnChoice).container}get pathStringOnChoice(){return this.pathOnChoice===null?(0,c.throwNullException)("ChoicePoint.pathOnChoice"):this.CompactPathString(this.pathOnChoice)}set pathStringOnChoice(p){this.pathOnChoice=new h.Path(p)}get flags(){let p=0;return this.hasCondition&&(p|=1),this.hasStartContent&&(p|=2),this.hasChoiceOnlyContent&&(p|=4),this.isInvisibleDefault&&(p|=8),this.onceOnly&&(p|=16),p}set flags(p){this.hasCondition=(p&1)>0,this.hasStartContent=(p&2)>0,this.hasChoiceOnlyContent=(p&4)>0,this.isInvisibleDefault=(p&8)>0,this.onceOnly=(p&16)>0}toString(){if(this.pathOnChoice===null)return(0,c.throwNullException)("ChoicePoint.pathOnChoice");let p=null,m=this.pathOnChoice.toString();return p!=null&&(m=" line "+p+"("+m+")"),"Choice: -> "+m}};r.ChoicePoint=s})),Yi=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PushPopType=void 0;var u;(function(h){h[h.Tunnel=0]="Tunnel",h[h.Function=1]="Function",h[h.FunctionEvaluationFromGame=2]="FunctionEvaluationFromGame"})(u||(r.PushPopType=u={}))})),zl=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Pointer=void 0;var u=Me(),h=class vs{constructor(){this.container=null,this.index=-1,arguments.length===2&&(this.container=arguments[0],this.index=arguments[1])}Resolve(){return this.index<0?this.container:this.container==null?null:this.container.content.length==0?this.container:this.index>=this.container.content.length?null:this.container.content[this.index]}get isNull(){return this.container==null}get path(){return this.isNull?null:this.index>=0?this.container.path.PathByAppendingComponent(new u.Path.Component(this.index)):this.container.path}toString(){return this.container?"Ink Pointer -> "+this.container.path.toString()+" -- index "+this.index:"Ink Pointer (null)"}copy(){return new vs(this.container,this.index)}static StartOf(s){return new vs(s,0)}static get Null(){return new vs(null,-1)}};r.Pointer=h})),Cn=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Divert=void 0;var u=Me(),h=Yi(),c=Ui(),s=Fe(),p=zl(),m=oe(),v=be(),y=class qm extends s.InkObject{get targetPath(){if(this._targetPath!=null&&this._targetPath.isRelative){let o=this.targetPointer.Resolve();o&&(this._targetPath=o.path)}return this._targetPath}set targetPath(o){this._targetPath=o,this._targetPointer=p.Pointer.Null}get targetPointer(){if(this._targetPointer.isNull){let o=this.ResolvePath(this._targetPath).obj;if(this._targetPath===null)return(0,v.throwNullException)("this._targetPath");if(this._targetPath.lastComponent===null)return(0,v.throwNullException)("this._targetPath.lastComponent");if(this._targetPath.lastComponent.isIndex){if(o===null)return(0,v.throwNullException)("targetObj");this._targetPointer.container=o.parent instanceof m.Container?o.parent:null,this._targetPointer.index=this._targetPath.lastComponent.index}else this._targetPointer=p.Pointer.StartOf(o instanceof m.Container?o:null)}return this._targetPointer.copy()}get targetPathString(){return this.targetPath==null?null:this.CompactPathString(this.targetPath)}set targetPathString(o){o==null?this.targetPath=null:this.targetPath=new u.Path(o)}get hasVariableTarget(){return this.variableDivertName!=null}constructor(o){super(),this._targetPath=null,this._targetPointer=p.Pointer.Null,this.variableDivertName=null,this.pushesToStack=!1,this.stackPushType=0,this.isExternal=!1,this.externalArgs=0,this.isConditional=!1,this.pushesToStack=!1,typeof o<"u"&&(this.pushesToStack=!0,this.stackPushType=o)}Equals(o){let T=o;return T instanceof qm&&this.hasVariableTarget==T.hasVariableTarget?this.hasVariableTarget?this.variableDivertName==T.variableDivertName:this.targetPath===null?(0,v.throwNullException)("this.targetPath"):this.targetPath.Equals(T.targetPath):!1}toString(){if(this.hasVariableTarget)return"Divert(variable: "+this.variableDivertName+")";if(this.targetPath==null)return"Divert(null)";{let o=new c.StringBuilder,T=this.targetPath.toString(),f=null;return f!=null&&(T="line "+f),o.Append("Divert"),this.isConditional&&o.Append("?"),this.pushesToStack&&(this.stackPushType==h.PushPopType.Function?o.Append(" function"):o.Append(" tunnel")),o.Append(" -> "),o.Append(this.targetPathString),o.Append(" ("),o.Append(T),o.Append(")"),o.toString()}}};r.Divert=y})),Kn=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SymbolType=void 0;var u;(function(h){h[h.Knot=0]="Knot",h[h.List=1]="List",h[h.ListItem=2]="ListItem",h[h.Var=3]="Var",h[h.SubFlowAndWeave=4]="SubFlowAndWeave",h[h.Arg=5]="Arg",h[h.Temp=6]="Temp"})(u||(r.SymbolType=u={}))})),Ci=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.VariableAssignment=void 0;var u=Fe(),h=class extends u.InkObject{constructor(c,s){super(),this.variableName=c||null,this.isNewDeclaration=!!s,this.isGlobal=!1}toString(){return"VarAssign to "+this.variableName}};r.VariableAssignment=h})),ja=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Choice=void 0;var u=bs(),h=oe(),c=Ee(),s=Cn(),p=Jt(),m=Zt(),v=Kn(),y=Ci(),A=class extends m.ParsedObject{get runtimeChoice(){if(!this._runtimeChoice)throw new Error;return this._runtimeChoice}get name(){var o;return((o=this.identifier)===null||o===void 0?void 0:o.name)||null}get condition(){return this._condition}set condition(o){this._condition=o,o&&this.AddContent(o)}get runtimeContainer(){return this._innerContentContainer}get innerContentContainer(){return this._innerContentContainer}get containerForCounting(){return this._innerContentContainer}get runtimePath(){if(!this.innerContentContainer||!this.innerContentContainer.path)throw new Error;return this.innerContentContainer.path}constructor(o,T,f){super(),this._condition=null,this._innerContentContainer=null,this._outerContainer=null,this._runtimeChoice=null,this._returnToR1=null,this._returnToR2=null,this._r1Label=null,this._r2Label=null,this._divertToStartContentOuter=null,this._divertToStartContentInner=null,this._startContentRuntimeContainer=null,this.isInvisibleDefault=!1,this.hasWeaveStyleInlineBrackets=!1,this.GenerateRuntimeObject=()=>{if(this._outerContainer=new h.Container,this._runtimeChoice=new u.ChoicePoint(this.onceOnly),this._runtimeChoice.isInvisibleDefault=this.isInvisibleDefault,(this.startContent||this.choiceOnlyContent||this.condition)&&this._outerContainer.AddContent(c.ControlCommand.EvalStart()),this.startContent){this._returnToR1=new p.DivertTargetValue,this._outerContainer.AddContent(this._returnToR1);const g=new y.VariableAssignment("$r",!0);this._outerContainer.AddContent(g),this._outerContainer.AddContent(c.ControlCommand.BeginString()),this._divertToStartContentOuter=new s.Divert,this._outerContainer.AddContent(this._divertToStartContentOuter),this._startContentRuntimeContainer=this.startContent.GenerateRuntimeObject(),this._startContentRuntimeContainer.name="s";const V=new s.Divert;V.variableDivertName="$r",this._startContentRuntimeContainer.AddContent(V),this._outerContainer.AddToNamedContentOnly(this._startContentRuntimeContainer),this._r1Label=new h.Container,this._r1Label.name="$r1",this._outerContainer.AddContent(this._r1Label),this._outerContainer.AddContent(c.ControlCommand.EndString()),this._runtimeChoice.hasStartContent=!0}if(this.choiceOnlyContent){this._outerContainer.AddContent(c.ControlCommand.BeginString());const g=this.choiceOnlyContent.GenerateRuntimeObject();this._outerContainer.AddContentsOfContainer(g),this._outerContainer.AddContent(c.ControlCommand.EndString()),this._runtimeChoice.hasChoiceOnlyContent=!0}if(this.condition&&(this.condition.GenerateIntoContainer(this._outerContainer),this._runtimeChoice.hasCondition=!0),(this.startContent||this.choiceOnlyContent||this.condition)&&this._outerContainer.AddContent(c.ControlCommand.EvalEnd()),this._outerContainer.AddContent(this._runtimeChoice),this._innerContentContainer=new h.Container,this.startContent){this._returnToR2=new p.DivertTargetValue,this._innerContentContainer.AddContent(c.ControlCommand.EvalStart()),this._innerContentContainer.AddContent(this._returnToR2),this._innerContentContainer.AddContent(c.ControlCommand.EvalEnd());const g=new y.VariableAssignment("$r",!0);this._innerContentContainer.AddContent(g),this._divertToStartContentInner=new s.Divert,this._innerContentContainer.AddContent(this._divertToStartContentInner),this._r2Label=new h.Container,this._r2Label.name="$r2",this._innerContentContainer.AddContent(this._r2Label)}if(this.innerContent){const g=this.innerContent.GenerateRuntimeObject();this._innerContentContainer.AddContentsOfContainer(g)}return this.story.countAllVisits&&(this._innerContentContainer.visitsShouldBeCounted=!0),this._innerContentContainer.countingAtStartOnly=!0,this._outerContainer},this.toString=()=>this.choiceOnlyContent!==null?`* ${this.startContent}[${this.choiceOnlyContent}]...`:`* ${this.startContent}...`,this.startContent=o,this.choiceOnlyContent=T,this.innerContent=f,this.indentationDepth=1,o&&this.AddContent(this.startContent),T&&this.AddContent(this.choiceOnlyContent),f&&this.AddContent(this.innerContent),this.onceOnly=!0}get typeName(){return"Choice"}ResolveReferences(o){var T;if(this._innerContentContainer&&(this.runtimeChoice.pathOnChoice=this._innerContentContainer.path,this.onceOnly&&(this._innerContentContainer.visitsShouldBeCounted=!0)),this._returnToR1){if(!this._r1Label)throw new Error;this._returnToR1.targetPath=this._r1Label.path}if(this._returnToR2){if(!this._r2Label)throw new Error;this._returnToR2.targetPath=this._r2Label.path}if(this._divertToStartContentOuter){if(!this._startContentRuntimeContainer)throw new Error;this._divertToStartContentOuter.targetPath=this._startContentRuntimeContainer.path}if(this._divertToStartContentInner){if(!this._startContentRuntimeContainer)throw new Error;this._divertToStartContentInner.targetPath=this._startContentRuntimeContainer.path}super.ResolveReferences(o),this.identifier&&(((T=this.identifier)===null||T===void 0?void 0:T.name)||"").length>0&&o.CheckForNamingCollisions(this,this.identifier,v.SymbolType.SubFlowAndWeave)}};r.Choice=A})),uv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.StringParserElement=void 0;var u=class Jo{constructor(){this.characterIndex=0,this.characterInLineIndex=0,this.lineIndex=0,this.reportedErrorInScope=!1,this.uniqueId=0,this.customFlags=0,this.CopyFrom=c=>{Jo._uniqueIdCounter++,this.uniqueId=Jo._uniqueIdCounter,this.characterIndex=c.characterIndex,this.characterInLineIndex=c.characterInLineIndex,this.lineIndex=c.lineIndex,this.customFlags=c.customFlags,this.reportedErrorInScope=!1},this.SquashFrom=c=>{this.characterIndex=c.characterIndex,this.characterInLineIndex=c.characterInLineIndex,this.lineIndex=c.lineIndex,this.reportedErrorInScope=c.reportedErrorInScope,this.customFlags=c.customFlags}}};r.StringParserElement=u,u._uniqueIdCounter=1e3})),ov=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.StringParserState=void 0;var u=uv(),h=class{get currentElement(){return this._stack[this._numElements-1]}get lineIndex(){return this.currentElement.lineIndex}set lineIndex(c){this.currentElement.lineIndex=c}get characterIndex(){return this.currentElement.characterIndex}set characterIndex(c){this.currentElement.characterIndex=c}get characterInLineIndex(){return this.currentElement.characterInLineIndex}set characterInLineIndex(c){this.currentElement.characterInLineIndex=c}get customFlags(){return this.currentElement.customFlags}set customFlags(c){this.currentElement.customFlags=c}get errorReportedAlreadyInScope(){return this.currentElement.reportedErrorInScope}get stackHeight(){return this._numElements}constructor(){this._stack=[],this._numElements=0,this.StringParserState=()=>{this._stack=new Array(200);for(let p=0;p<200;++p)this._stack[p]=new u.StringParserElement;this._numElements=1},this.Push=()=>{if(this._numElements>=this._stack.length&&this._numElements>0)throw new Error("Stack overflow in parser state.");const s=this._stack[this._numElements-1],p=this._stack[this._numElements];return this._numElements++,p.CopyFrom(s),p.uniqueId},this.Pop=s=>{if(this._numElements==1)throw new Error("Attempting to remove final stack element is illegal! Mismatched Begin/Succceed/Fail?");if(this.currentElement.uniqueId!=s)throw new Error("Mismatched rule IDs while Poping - do you have mismatched Begin/Succeed/Fail?");this._numElements-=1},this.Peek=s=>{if(this.currentElement.uniqueId!=s)throw new Error("Mismatched rule IDs while Peeking - do you have mismatched Begin/Succeed/Fail?");return this._stack[this._numElements-1]},this.PeekPenultimate=()=>this._numElements>=2?this._stack[this._numElements-2]:null,this.Squash=()=>{if(this._numElements<2)throw new Error("Attempting to remove final stack element is illegal! Mismatched Begin/Succceed/Fail?");const s=this._stack[this._numElements-2],p=this._stack[this._numElements-1];s.SquashFrom(p),this._numElements-=1},this.NoteErrorReported=()=>{for(const s of this._stack)s.reportedErrorInScope=!0};const c=200;for(let s=0;s<c;s++)this._stack[s]=new u.StringParserElement;this._numElements=1}};r.StringParserState=h})),rh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.StringParser=r.ParseSuccess=void 0;var u=ql(),h=ov();r.ParseSuccess=Symbol("ParseSuccessStruct");var c=class pn{constructor(p){this.ParseRule=null,this.errorHandler=null,this.hadError=!1,this.BeginRule=()=>this.state.Push(),this.FailRule=v=>(this.state.Pop(v),null),this.CancelRule=v=>{this.state.Pop(v)},this.SucceedRule=(v,y=null)=>{const A=this.state.Peek(v),o=this.state.PeekPenultimate();this.RuleDidSucceed&&this.RuleDidSucceed(y,o,A),this.state.Squash();let T=y;return T===null&&(T=pn.ParseSuccess),T},this.Expect=(v,y=null,A=null)=>{let o=this.ParseObject(v);if(o===null){y===null&&(y=v.name);let T;const f=this.LineRemainder();f===null||f.length===0?T="end of line":T=`'${f}'`,this.Error(`Expected ${y} but saw ${T}`),A!==null&&(o=A())}return o},this.Error=(v,y=!1)=>{this.ErrorOnLine(v,this.lineIndex+1,y)},this.ErrorWithParsedObject=(v,y,A=!1)=>{this.ErrorOnLine(v,y.debugMetadata?y.debugMetadata.startLineNumber:-1,A)},this.ErrorOnLine=(v,y,A)=>{if(!this.state.errorReportedAlreadyInScope){const o=A?"Warning":"Error";if(this.errorHandler)this.errorHandler(v,this.index,y-1,A);else throw new Error(`${o} on line ${y}: ${v}`);this.state.NoteErrorReported()}A||(this.hadError=!0)},this.Warning=v=>this.Error(v,!0),this.LineRemainder=()=>this.Peek(()=>this.ParseUntilCharactersFromString(`
5
+ \r`)),this.SetFlag=(v,y)=>{y?this.state.customFlags|=v:this.state.customFlags&=~v},this.GetFlag=v=>!!(this.state.customFlags&v),this.ParseObject=v=>{const y=this.BeginRule(),A=this.state.stackHeight,o=v();if(A!==this.state.stackHeight)throw new Error("Mismatched Begin/Fail/Succeed rules");return o===null?this.FailRule(y):(this.SucceedRule(y,o),o)},this.Parse=v=>{const y=this.BeginRule(),A=v();return A===null?(this.FailRule(y),null):(this.SucceedRule(y,A),A)},this.OneOf=v=>{for(const y of v){const A=this.ParseObject(y);if(A!==null)return A}return null},this.OneOrMore=v=>{const y=[];let A=null;do A=this.ParseObject(v),A!==null&&y.push(A);while(A!==null);return y.length>0?y:null},this.Optional=v=>()=>{const y=this.ParseObject(v);return y===null?pn.ParseSuccess:y},this.Exclude=v=>()=>this.ParseObject(v)&&pn.ParseSuccess,this.OptionalExclude=v=>()=>(this.ParseObject(v),pn.ParseSuccess),this.String=v=>()=>this.ParseString(v),this.TryAddResultToList=(v,y,A=!0)=>{if(v!==pn.ParseSuccess){if(A&&Array.isArray(v)){const o=v;if(o!==null){for(const T of o)y.push(T);return}}y.push(v)}},this.Interleave=(v,y,A=null,o=!0)=>{const T=this.BeginRule(),f=[],g=this.ParseObject(v);if(g===null)return this.FailRule(T);this.TryAddResultToList(g,f,o);let V=null,B=null;do{if(A!==null&&this.Peek(A)!==null||(V=this.ParseObject(y),V===null))break;if(this.TryAddResultToList(V,f,o),B=null,V!==null){if(B=this.ParseObject(v),B===null)break;this.TryAddResultToList(B,f,o)}}while((V!==null||B!==null)&&!(V===pn.ParseSuccess&&B==pn.ParseSuccess)&&this.remainingLength>0);return f.length===0?this.FailRule(T):this.SucceedRule(T,f)},this.ParseString=v=>{if(v.length>this.remainingLength)return null;const y=this.BeginRule();let A=this.index,o=this.characterInLineIndex,T=this.lineIndex,f=!0;for(let g=0;g<v.length;g+=1){const V=v[g];if(this._chars[A]!==V){f=!1;break}V===`
6
+ `&&(T++,o=-1),A++,o++}return this.index=A,this.characterInLineIndex=o,this.lineIndex=T,f?this.SucceedRule(y,v):this.FailRule(y)},this.ParseSingleCharacter=()=>{if(this.remainingLength>0){const v=this._chars[this.index];return v===`
7
+ `&&(this.lineIndex+=1,this.characterInLineIndex=-1),this.index+=1,this.characterInLineIndex+=1,v}return"0"},this.ParseUntilCharactersFromString=(v,y=-1)=>this.ParseCharactersFromString(v,!1,y),this.ParseUntilCharactersFromCharSet=(v,y=-1)=>this.ParseCharactersFromCharSet(v,!1,y),this.ParseCharactersFromString=(v,y=-1,A=-1)=>{const o=new u.CharacterSet(v);return typeof y=="number"?this.ParseCharactersFromCharSet(o,!0,y):this.ParseCharactersFromCharSet(o,y,A)},this.ParseCharactersFromCharSet=(v,y=!0,A=-1)=>{A===-1&&(A=Number.MAX_SAFE_INTEGER);const o=this.index;let T=this.index,f=this.characterInLineIndex,g=this.lineIndex,V=0;for(;T<this._chars.length&&v.set.has(this._chars[T])===y&&V<A;)this._chars[T]===`
8
+ `&&(g+=1,f=-1),T+=1,f+=1,V+=1;return this.index=T,this.characterInLineIndex=f,this.lineIndex=g,this.index>o?this._chars.slice(o,this.index).join(""):null},this.Peek=v=>{const y=this.BeginRule(),A=v();return this.CancelRule(y),A},this.ParseInt=()=>{const v=this.index,y=this.characterInLineIndex,A=this.ParseString("-")!==null;this.ParseCharactersFromString(" ");const o=this.ParseCharactersFromCharSet(pn.numbersCharacterSet);if(o===null)return this.index=v,this.characterInLineIndex=y,null;let T;return Number.isNaN(Number(o))?(this.Error("Failed to read integer value: "+o+". Perhaps it's out of the range of acceptable numbers ink supports? ("+Number.MIN_SAFE_INTEGER+" to "+Number.MAX_SAFE_INTEGER+")"),null):(T=Number(o),A?-T:T)},this.ParseFloat=()=>{const v=this.index,y=this.characterInLineIndex,A=this.ParseInt();if(A!==null&&this.ParseString(".")!==null){const o=this.ParseCharactersFromCharSet(pn.numbersCharacterSet);return+`${A}.${o}`}return this.index=v,this.characterInLineIndex=y,null},this.ParseNewline=()=>{const v=this.BeginRule();return this.ParseString("\r"),this.ParseString(`
9
+ `)===null?this.FailRule(v):this.SucceedRule(v,`
10
+ `)};const m=this.PreProcessInputString(p);this.state=new h.StringParserState,p?this._chars=m.split(""):this._chars=[],this.inputString=m}get currentCharacter(){return this.index>=0&&this.remainingLength>0?this._chars[this.index]:"0"}PreProcessInputString(p){return p}get endOfInput(){return this.index>=this._chars.length}get remainingString(){return this._chars.slice(this.index,this.index+this.remainingLength).join("")}get remainingLength(){return this._chars.length-this.index}get lineIndex(){return this.state.lineIndex}set lineIndex(p){this.state.lineIndex=p}set characterInLineIndex(p){this.state.characterInLineIndex=p}get characterInLineIndex(){return this.state.characterInLineIndex}get index(){return this.state.characterIndex}set index(p){this.state.characterIndex=p}ParseUntil(p,m=null,v=null){const y=this.BeginRule(),A=new u.CharacterSet;m!==null&&(A.set=new Set([...A.set.values(),...m.set.values()])),v!==null&&(A.set=new Set([...A.set.values(),...v.set.values()]));let o="",T=null;do{const f=this.ParseUntilCharactersFromCharSet(A);if(f&&(o+=f),T=this.Peek(p),T!==null)break;{if(this.endOfInput)break;const g=this.currentCharacter;if(m!==null&&m.set.has(g)){o+=g,g===`
11
+ `&&(this.lineIndex+=1,this.characterInLineIndex=-1),this.index+=1,this.characterInLineIndex+=1;continue}else break}}while(!0);return o.length>0?this.SucceedRule(y,String(o)):this.FailRule(y)}};r.StringParser=c,c.ParseSuccess=r.ParseSuccess,c.numbersCharacterSet=new u.CharacterSet("0123456789")})),hv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CommentEliminator=void 0;var u=ql(),h=rh(),c=class extends h.StringParser{constructor(){super(...arguments),this._commentOrNewlineStartCharacter=new u.CharacterSet(`/\r
12
+ `),this._commentBlockEndCharacter=new u.CharacterSet("*"),this._newlineCharacters=new u.CharacterSet(`
13
+ \r`),this.Process=()=>{const s=this.Interleave(this.Optional(this.CommentsAndNewlines),this.Optional(this.MainInk));return s!==null?s.join(""):""},this.MainInk=()=>this.ParseUntil(this.CommentsAndNewlines,this._commentOrNewlineStartCharacter,null),this.CommentsAndNewlines=()=>{let s=this.Interleave(this.Optional(this.ParseNewline),this.Optional(this.ParseSingleComment));return s!==null?s.join(""):null},this.ParseSingleComment=()=>this.OneOf([this.EndOfLineComment,this.BlockComment]),this.EndOfLineComment=()=>this.ParseString("//")===null?null:(this.ParseUntilCharactersFromCharSet(this._newlineCharacters),""),this.BlockComment=()=>{if(this.ParseString("/*")===null)return null;const s=this.lineIndex,p=this.ParseUntil(this.String("*/"),this._commentBlockEndCharacter,null);return this.endOfInput||this.ParseString("*/"),p!=null?`
14
+ `.repeat(this.lineIndex-s):null}}PreProcessInputString(s){return s}};r.CommentEliminator=c})),Es=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Conditional=void 0;var u=oe(),h=Ee(),c=Zt(),s=class extends c.ParsedObject{constructor(p,m){super(),this.initialCondition=p,this.branches=m,this._reJoinTarget=null,this.GenerateRuntimeObject=()=>{const v=new u.Container;this.initialCondition&&v.AddContent(this.initialCondition.runtimeObject);for(const y of this.branches){const A=y.runtimeObject;v.AddContent(A)}return this.initialCondition!==null&&this.branches[0].ownExpression!==null&&!this.branches[this.branches.length-1].isElse&&v.AddContent(h.ControlCommand.PopEvaluatedValue()),this._reJoinTarget=h.ControlCommand.NoOp(),v.AddContent(this._reJoinTarget),v},this.initialCondition&&this.AddContent(this.initialCondition),this.branches!==null&&this.AddContent(this.branches)}get typeName(){return"Conditional"}ResolveReferences(p){const m=this._reJoinTarget.path;for(const v of this.branches){if(!v.returnDivert)throw new Error;v.returnDivert.targetPath=m}super.ResolveReferences(p)}};r.Conditional=s})),Si=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Text=void 0;var u=Zt(),h=Jt(),c=class extends u.ParsedObject{constructor(s){super(),this.text=s,this.GenerateRuntimeObject=()=>new h.StringValue(this.text),this.toString=()=>this.text}get typeName(){return"Text"}};r.Text=c})),Ts=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ConstantDeclaration=void 0;var u=Zt(),h=Kn(),c=class extends u.ParsedObject{get constantName(){var s;return(s=this.constantIdentifier)===null||s===void 0?void 0:s.name}get expression(){if(!this._expression)throw new Error;return this._expression}constructor(s,p){super(),this._expression=null,this.GenerateRuntimeObject=()=>null,this.constantIdentifier=s,p&&(this._expression=this.AddContent(p))}get typeName(){return"CONST"}ResolveReferences(s){super.ResolveReferences(s),s.CheckForNamingCollisions(this,this.constantIdentifier,h.SymbolType.Var)}};r.ConstantDeclaration=c})),Wa=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FlowLevel=void 0;var u;(function(h){h[h.Story=0]="Story",h[h.Knot=1]="Knot",h[h.Stitch=2]="Stitch",h[h.WeavePoint=3]="WeavePoint"})(u||(r.FlowLevel=u={}))})),Ul=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Gather=void 0;var u=oe(),h=Zt(),c=Kn(),s=class extends h.ParsedObject{get name(){var p;return((p=this.identifier)===null||p===void 0?void 0:p.name)||null}get runtimeContainer(){return this.runtimeObject}constructor(p,m){super(),this.indentationDepth=m,this.GenerateRuntimeObject=()=>{const v=new u.Container;if(v.name=this.name,this.story.countAllVisits&&(v.visitsShouldBeCounted=!0),v.countingAtStartOnly=!0,this.content)for(const y of this.content)v.AddContent(y.runtimeObject);return v},this.toString=()=>{var v,y;return`- ${!((v=this.identifier)===null||v===void 0)&&v.name?"("+((y=this.identifier)===null||y===void 0?void 0:y.name)+")":"gather"}`},p&&(this.identifier=p)}get typeName(){return"Gather"}ResolveReferences(p){super.ResolveReferences(p),this.identifier&&(this.identifier.name||"").length>0&&p.CheckForNamingCollisions(this,this.identifier,c.SymbolType.SubFlowAndWeave)}};r.Gather=s})),Ki=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Path=void 0;var u=Bt(),h=Sn(),c=Wa(),s=Xi(),p=class{get baseTargetLevel(){return this.baseLevelIsAmbiguous?c.FlowLevel.Story:this._baseTargetLevel}get baseLevelIsAmbiguous(){return!this._baseTargetLevel}get firstComponent(){return this.components==null||!this.components.length?null:this.components[0].name}get numberOfComponents(){return this.components?this.components.length:0}get dotSeparatedComponents(){return this._dotSeparatedComponents==null&&(this._dotSeparatedComponents=(this.components?this.components:[]).map(m=>m.name).filter(u.filterUndef).join(".")),this._dotSeparatedComponents}constructor(m,v){this._dotSeparatedComponents=null,this.toString=()=>this.components===null||this.components.length===0?this.baseTargetLevel===c.FlowLevel.WeavePoint?"-> <next gather point>":"<invalid Path>":`-> ${this.dotSeparatedComponents}`,this.ResolveFromContext=y=>{if(this.components==null||this.components.length==0)return null;let A=this.ResolveBaseTarget(y);return A===null?null:this.components.length>1?this.ResolveTailComponents(A):A},this.ResolveBaseTarget=y=>{const A=this.firstComponent;let o=y;for(;o;){const T=o===y,f=this.GetChildFromContext(o,A,null,T);if(f)return f;o=o.parent}return null},this.ResolveTailComponents=y=>{let A=y;if(!this.components)return null;for(let o=1;o<this.components.length;++o){const T=this.components[o].name;let f,g=(0,u.asOrNull)(A,h.FlowBase);if(g!==null?f=g.flowLevel+1:f=c.FlowLevel.WeavePoint,A=this.GetChildFromContext(A,T,f),A===null)break}return A},this.GetChildFromContext=(y,A,o,T=!1)=>{const f=o===null,g=(0,u.asOrNull)(y,s.Weave);if(A&&g!==null&&(f||o===c.FlowLevel.WeavePoint))return g.WeavePointNamed(A);let V=(0,u.asOrNull)(y,h.FlowBase);if(A&&V!==null){const B=T||V.flowLevel===c.FlowLevel.Knot;return V.ContentWithNameAtLevel(A,o,B)}return null},Object.values(c.FlowLevel).includes(m)?(this._baseTargetLevel=m,this.components=v||[]):Array.isArray(m)?(this._baseTargetLevel=null,this.components=m||[]):(this._baseTargetLevel=null,this.components=[m])}get typeName(){return"Path"}};r.Path=p})),sh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ReturnType=void 0;var u=Zt(),h=oe(),c=Ee(),s=Hi(),p=class extends u.ParsedObject{constructor(m=null){super(),this.returnedExpression=null,this.GenerateRuntimeObject=()=>{const v=new h.Container;return this.returnedExpression?v.AddContent(this.returnedExpression.runtimeObject):(v.AddContent(c.ControlCommand.EvalStart()),v.AddContent(new s.Void),v.AddContent(c.ControlCommand.EvalEnd())),v.AddContent(c.ControlCommand.PopFunction()),v},m&&(this.returnedExpression=this.AddContent(m))}get typeName(){return"ReturnType"}};r.ReturnType=p})),Hl=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ClosestFlowBase=void 0;function u(h){let c=h.parent;for(;c;){if(c.hasOwnProperty("iamFlowbase")&&c.iamFlowbase())return c;c=c.parent}return null}r.ClosestFlowBase=u})),Os=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Identifier=void 0;var u=class zm{constructor(c){this.debugMetadata=null,this.toString=()=>this.name||"undefined identifer",this.name=c}get typeName(){return"Identifier"}static Done(){return new zm("DONE")}};r.Identifier=u})),Sn=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FlowBase=void 0;var u=ja(),h=qa(),c=Ga(),s=Wa(),p=Ul(),m=Zt(),v=Ki(),y=sh(),A=oe(),o=Cn(),T=Ci(),f=Kn(),g=Xi(),V=Hl(),B=Os(),k=Bt(),M=class $o extends m.ParsedObject{get hasParameters(){return this.args!==null&&this.args.length>0}get subFlowsByName(){return this._subFlowsByName}get typeName(){return this.isFunction?"Function":String(this.flowLevel)}get name(){var q;return((q=this.identifier)===null||q===void 0?void 0:q.name)||null}constructor(q,z=null,Q=null,O=!1,w=!1){super(),this.isFunction=O,this._rootWeave=null,this._subFlowsByName=new Map,this._startingSubFlowDivert=null,this._startingSubFlowRuntime=null,this._firstChildFlow=null,this.variableDeclarations=new Map,this.identifier=null,this.args=null,this.iamFlowbase=()=>!0,this.SplitWeaveAndSubFlowContent=(N,C)=>{var S,F;const K=[],it=[];this._subFlowsByName=new Map;for(const E of N){const x=(0,k.asOrNull)(E,$o);x?(this._firstChildFlow===null&&(this._firstChildFlow=x),it.push(E),!((S=x.identifier)===null||S===void 0)&&S.name&&this._subFlowsByName.set((F=x.identifier)===null||F===void 0?void 0:F.name,x)):K.push(E)}C&&K.push(new p.Gather(null,1),new h.Divert(new v.Path(B.Identifier.Done())));const ot=[];return K.length>0&&(this._rootWeave=new g.Weave(K,0),ot.push(this._rootWeave)),it.length>0&&ot.push(...it),ot},this.ResolveVariableWithName=(N,C)=>{var S;const F={},K=C===null?this:(0,V.ClosestFlowBase)(C);if(K){if(K.args!==null){for(const it of K.args)if(((S=it.identifier)===null||S===void 0?void 0:S.name)===N)return F.found=!0,F.isArgument=!0,F.ownerFlow=K,F}if(K!==this.story&&K.variableDeclarations.has(N))return F.found=!0,F.ownerFlow=K,F.isTemporary=!0,F}return this.story.variableDeclarations.has(N)?(F.found=!0,F.ownerFlow=this.story,F.isGlobal=!0,F):(F.found=!1,F)},this.AddNewVariableDeclaration=N=>{const C=N.variableName;if(this.variableDeclarations.has(C)){const S=this.variableDeclarations.get(C);let F="";S.debugMetadata&&(F=` (${S.debugMetadata})`),this.Error(`found declaration variable '${C}' that was already declared${F}`,N,!1);return}this.variableDeclarations.set(N.variableName,N)},this.ResolveWeavePointNaming=()=>{this._rootWeave&&this._rootWeave.ResolveWeavePointNaming();for(const[,N]of this._subFlowsByName)N.hasOwnProperty("ResolveWeavePointNaming")&&N.ResolveWeavePointNaming()},this.GenerateRuntimeObject=()=>{var N;let C=null;this.isFunction?this.CheckForDisallowedFunctionFlowControl():(this.flowLevel===s.FlowLevel.Knot||this.flowLevel===s.FlowLevel.Stitch)&&(C=this.Find(y.ReturnType)(),C!==null&&this.Error(`Return statements can only be used in knots that are declared as functions: == function ${this.identifier} ==`,C));const S=new A.Container;S.name=(N=this.identifier)===null||N===void 0?void 0:N.name,this.story.countAllVisits&&(S.visitsShouldBeCounted=!0),this.GenerateArgumentVariableAssignments(S);let F=0;for(;this.content!==null&&F<this.content.length;){const K=this.content[F];if(K instanceof $o){const it=K,ot=it.runtimeObject;F===0&&!it.hasParameters&&this.flowLevel===s.FlowLevel.Knot&&(this._startingSubFlowDivert=new o.Divert,S.AddContent(this._startingSubFlowDivert),this._startingSubFlowRuntime=ot);const E=ot,x=S.namedContent.get(E.name)||null;if(x){const D=`${this.GetType()} already contains flow named '${E.name}' (at ${x.debugMetadata})`;this.Error(D,it)}S.AddToNamedContentOnly(E)}else K&&S.AddContent(K.runtimeObject);F+=1}return this.flowLevel!==s.FlowLevel.Story&&!this.isFunction&&this._rootWeave!==null&&C===null&&this._rootWeave.ValidateTermination(this.WarningInTermination),S},this.GenerateArgumentVariableAssignments=N=>{var C;if(!(this.args===null||this.args.length===0))for(let S=this.args.length-1;S>=0;--S){const F=((C=this.args[S].identifier)===null||C===void 0?void 0:C.name)||null,K=new T.VariableAssignment(F,!0);N.AddContent(K)}},this.ContentWithNameAtLevel=(N,C=null,S=!1)=>{var F;if((C===this.flowLevel||C===null)&&N===((F=this.identifier)===null||F===void 0?void 0:F.name))return this;if(C===s.FlowLevel.WeavePoint||C===null){let it=null;if(this._rootWeave&&(it=this._rootWeave.WeavePointNamed(N),it))return it;if(C===s.FlowLevel.WeavePoint)return S?this.DeepSearchForAnyLevelContent(N):null}if(C!==null&&C<this.flowLevel)return null;let K=this._subFlowsByName.get(N)||null;return K&&(C===null||C===K.flowLevel)?K:S?this.DeepSearchForAnyLevelContent(N):null},this.DeepSearchForAnyLevelContent=N=>{const C=this.ContentWithNameAtLevel(N,s.FlowLevel.WeavePoint,!1);if(C)return C;for(const[,S]of this._subFlowsByName){const F=S.ContentWithNameAtLevel(N,null,!0);if(F)return F}return null},this.CheckForDisallowedFunctionFlowControl=()=>{this.flowLevel!==s.FlowLevel.Knot&&this.Error("Functions cannot be stitches - i.e. they should be defined as '== function myFunc ==' rather than internal to another knot.");for(const[S,F]of this._subFlowsByName)this.Error(`Functions may not contain stitches, but saw '${S}' within the function '${this.identifier}'`,F);if(!this._rootWeave)throw new Error;const N=this._rootWeave.FindAll(h.Divert)();for(const S of N)!S.isFunctionCall&&!(S.parent instanceof c.DivertTarget)&&this.Error(`Functions may not contain diverts, but saw '${S}'`,S);const C=this._rootWeave.FindAll(u.Choice)();for(const S of C)this.Error(`Functions may not contain choices, but saw '${S}'`,S)},this.WarningInTermination=N=>{let C="Apparent loose end exists where the flow runs out. Do you need a '-> DONE' statement, choice or divert?";N.parent===this._rootWeave&&this._firstChildFlow&&(C=`${C} Note that if you intend to enter '${this._firstChildFlow.identifier}' next, you need to divert to it explicitly.`);const S=(0,k.asOrNull)(N,h.Divert);S&&S.isTunnel&&(C+=` When final tunnel to '${S.target} ->' returns it won't have anywhere to go.`),this.Warning(C,N)},this.toString=()=>`${this.typeName} '${this.identifier}'`,this.identifier=q,this.args=Q,z===null&&(z=[]),this.PreProcessTopLevelObjects(z),z=this.SplitWeaveAndSubFlowContent(z,this.GetType()=="Story"&&!w),this.AddContent(z)}PreProcessTopLevelObjects(q){}ResolveReferences(q){var z,Q;if(this._startingSubFlowDivert){if(!this._startingSubFlowRuntime)throw new Error;this._startingSubFlowDivert.targetPath=this._startingSubFlowRuntime.path}if(super.ResolveReferences(q),this.args!==null){for(const O of this.args)q.CheckForNamingCollisions(this,O.identifier,f.SymbolType.Arg,"argument");for(let O=0;O<this.args.length;O+=1)for(let w=O+1;w<this.args.length;w+=1)((z=this.args[O].identifier)===null||z===void 0?void 0:z.name)==((Q=this.args[w].identifier)===null||Q===void 0?void 0:Q.name)&&this.Error(`Multiple arguments with the same name: '${this.args[O].identifier}'`)}if(this.flowLevel!==s.FlowLevel.Story){const O=this.flowLevel===s.FlowLevel.Knot?f.SymbolType.Knot:f.SymbolType.SubFlowAndWeave;q.CheckForNamingCollisions(this,this.identifier,O)}}};r.FlowBase=M})),Ns=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ContentList=void 0;var u=oe(),h=Zt(),c=Si(),s=Bt(),p=class extends h.ParsedObject{get runtimeContainer(){return this.runtimeObject}constructor(m,...v){super(),this.dontFlatten=!1,this.TrimTrailingWhitespace=()=>{for(let y=this.content.length-1;y>=0;--y){const A=(0,s.asOrNull)(this.content[y],c.Text);if(A===null)break;if(A.text=A.text.replace(new RegExp(/[ \t]/g),""),A.text.length===0)this.content.splice(y,1);else break}},this.GenerateRuntimeObject=()=>{const y=new u.Container;if(this.content!==null)for(const A of this.content){const o=A.runtimeObject;o&&y.AddContent(o)}return this.dontFlatten&&this.story.DontFlattenContainer(y),y},this.toString=()=>`ContentList(${this.content.join(", ")})`,m&&this.AddContent(m),v&&this.AddContent(v)}get typeName(){return"ContentList"}};r.ContentList=p})),ka=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.VariableReference=void 0;var u=Fe(),h=Me(),c=class extends u.InkObject{get containerForCount(){return this.pathForCount===null?null:this.ResolvePath(this.pathForCount).container}get pathStringForCount(){return this.pathForCount===null?null:this.CompactPathString(this.pathForCount)}set pathStringForCount(s){s===null?this.pathForCount=null:this.pathForCount=new h.Path(s)}constructor(s=null){super(),this.pathForCount=null,this.name=s}toString(){return this.name!=null?"var("+this.name+")":"read_count("+this.pathStringForCount+")"}};r.VariableReference=c})),Ba=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.VariableReference=void 0;var u=Ns(),h=on(),c=Sn(),s=Ki(),p=ka(),m=Xi(),v=Os(),y=Bt(),A=class extends h.Expression{get name(){return this.path.join(".")}get path(){return this.pathIdentifiers.map(o=>o.name).filter(y.filterUndef)}get identifier(){if(!this.pathIdentifiers||this.pathIdentifiers.length==0)return null;const o=this.path.join(".");return new v.Identifier(o)}get runtimeVarRef(){return this._runtimeVarRef}constructor(o){super(),this.pathIdentifiers=o,this._runtimeVarRef=null,this.isConstantReference=!1,this.isListItemReference=!1,this.GenerateIntoContainer=T=>{let f=this.story.constants.get(this.name);if(f){f.GenerateConstantIntoContainer(T),this.isConstantReference=!0;return}if(this._runtimeVarRef=new p.VariableReference(this.name),this.path.length===1||this.path.length===2){let g="",V="";this.path.length===1?g=this.path[0]:(V=this.path[0],g=this.path[1]),this.story.ResolveListItem(V,g,this)&&(this.isListItemReference=!0)}T.AddContent(this._runtimeVarRef)},this.toString=()=>`{${this.path.join(".")}}`}get typeName(){return"ref"}ResolveReferences(o){if(super.ResolveReferences(o),this.isConstantReference||this.isListItemReference)return;const T=new s.Path(this.pathIdentifiers),f=T.ResolveFromContext(this);if(f){if(!f.containerForCounting)throw new Error;if(f.containerForCounting.visitsShouldBeCounted=!0,this._runtimeVarRef===null)return;this._runtimeVarRef.pathForCount=f.runtimePath,this._runtimeVarRef.name=null;let g=(0,y.asOrNull)(f,c.FlowBase);g&&g.isFunction&&(this.parent instanceof m.Weave||this.parent instanceof u.ContentList||this.parent instanceof c.FlowBase)&&this.Warning(`'${g.identifier}' being used as read count rather than being called as function. Perhaps you intended to write ${g.identifier}()`);return}if(this.path.length>1){let g=`Could not find target for read count: ${T}`;this.path.length<=2&&(g+=`, or couldn't find list item with the name ${this.path.join(",")}`),this.Error(g);return}o.ResolveVariableWithName(this.name,this).found||this.Error(`Unresolved variable: ${this.name}`,this)}};r.VariableReference=A})),Yl=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FunctionCall=void 0;var u=Ee(),h=qa(),c=Ga(),s=on(),p=Ie(),m=Jt(),v=yn(),y=_s(),A=Ki(),o=Jt(),T=Ba(),f=Bt(),g=class th extends s.Expression{get proxyDivert(){return this._proxyDivert}get name(){return this._proxyDivert.target.firstComponent||""}get args(){return this._proxyDivert.args}get runtimeDivert(){return this._proxyDivert.runtimeDivert}get isChoiceCount(){return this.name==="CHOICE_COUNT"}get isTurns(){return this.name==="TURNS"}get isTurnsSince(){return this.name==="TURNS_SINCE"}get isRandom(){return this.name==="RANDOM"}get isSeedRandom(){return this.name==="SEED_RANDOM"}get isListRange(){return this.name==="LIST_RANGE"}get isListRandom(){return this.name==="LIST_RANDOM"}get isReadCount(){return this.name==="READ_COUNT"}constructor(B,k){super(),this._divertTargetToCount=null,this._variableReferenceToCount=null,this.shouldPopReturnedValue=!1,this.GenerateIntoContainer=M=>{const j=this.story.ResolveList(this.name);let q=!1;if(this.isChoiceCount)this.args.length>0&&this.Error("The CHOICE_COUNT() function shouldn't take any arguments"),M.AddContent(u.ControlCommand.ChoiceCount());else if(this.isTurns)this.args.length>0&&this.Error("The TURNS() function shouldn't take any arguments"),M.AddContent(u.ControlCommand.Turns());else if(this.isTurnsSince||this.isReadCount){const z=(0,f.asOrNull)(this.args[0],c.DivertTarget),Q=(0,f.asOrNull)(this.args[0],T.VariableReference);if(this.args.length!==1||z===null&&Q===null){this.Error(`The ${this.name}() function should take one argument: a divert target to the target knot, stitch, gather or choice you want to check. e.g. TURNS_SINCE(-> myKnot)`);return}z?(this._divertTargetToCount=z,this.AddContent(this._divertTargetToCount),this._divertTargetToCount.GenerateIntoContainer(M)):Q&&(this._variableReferenceToCount=Q,this.AddContent(this._variableReferenceToCount),this._variableReferenceToCount.GenerateIntoContainer(M)),this.isTurnsSince?M.AddContent(u.ControlCommand.TurnsSince()):M.AddContent(u.ControlCommand.ReadCount())}else if(this.isRandom){this.args.length!==2&&this.Error("RANDOM should take 2 parameters: a minimum and a maximum integer");for(let z=0;z<this.args.length;z+=1){const Q=(0,f.asOrNull)(this.args[z],y.NumberExpression);if(Q&&!Q.isInt()){const O=z===0?"minimum":"maximum";this.Error(`RANDOM's ${O} parameter should be an integer`)}this.args[z].GenerateIntoContainer(M)}M.AddContent(u.ControlCommand.Random())}else if(this.isSeedRandom){this.args.length!==1&&this.Error("SEED_RANDOM should take 1 parameter - an integer seed");const z=(0,f.asOrNull)(this.args[0],y.NumberExpression);z&&!z.isInt()&&this.Error("SEED_RANDOM's parameter should be an integer seed"),this.args[0].GenerateIntoContainer(M),M.AddContent(u.ControlCommand.SeedRandom())}else if(this.isListRange){this.args.length!==3&&this.Error("LIST_RANGE should take 3 parameters - a list, a min and a max");for(let z=0;z<this.args.length;z+=1)this.args[z].GenerateIntoContainer(M);M.AddContent(u.ControlCommand.ListRange())}else if(this.isListRandom)this.args.length!==1&&this.Error("LIST_RANDOM should take 1 parameter - a list"),this.args[0].GenerateIntoContainer(M),M.AddContent(u.ControlCommand.ListRandom());else if(v.NativeFunctionCall.CallExistsWithName(this.name)){const z=v.NativeFunctionCall.CallWithName(this.name);if(z.numberOfParameters!==this.args.length){let Q=`${th.name} should take ${z.numberOfParameters} parameter`;z.numberOfParameters>1&&(Q+="s"),this.Error(Q)}for(let Q=0;Q<this.args.length;Q+=1)this.args[Q].GenerateIntoContainer(M);M.AddContent(v.NativeFunctionCall.CallWithName(this.name))}else if(j!==null)if(this.args.length>1&&this.Error("Can currently only construct a list from one integer (or an empty list from a given list definition)"),this.args.length===1)M.AddContent(new o.StringValue(this.name)),this.args[0].GenerateIntoContainer(M),M.AddContent(u.ControlCommand.ListFromInt());else{const z=new p.InkList;z.SetInitialOriginName(this.name),M.AddContent(new m.ListValue(z))}else M.AddContent(this._proxyDivert.runtimeObject),q=!0;q||this.content.splice(this.content.indexOf(this._proxyDivert),1),this.shouldPopReturnedValue&&M.AddContent(u.ControlCommand.PopEvaluatedValue())},this.toString=()=>{const M=this.args.join(", ");return`${this.name}(${M})`},this._proxyDivert=new h.Divert(new A.Path(B),k),this._proxyDivert.isFunctionCall=!0,this.AddContent(this._proxyDivert)}get typeName(){return"FunctionCall"}ResolveReferences(B){if(super.ResolveReferences(B),!this.content.includes(this._proxyDivert)&&this.args!==null)for(const k of this.args)k.ResolveReferences(B);if(this._divertTargetToCount){const k=this._divertTargetToCount.divert,M=k.runtimeDivert.variableDivertName!=null;if(M){this.Error(`When getting the TURNS_SINCE() of a variable target, remove the '->' - i.e. it should just be TURNS_SINCE(${k.runtimeDivert.variableDivertName})`);return}const j=k.targetContent;if(j===null)M||this.Error(`Failed to find target for TURNS_SINCE: '${k.target}'`);else{if(!j.containerForCounting)throw new Error;j.containerForCounting.turnIndexShouldBeCounted=!0}}else if(this._variableReferenceToCount){const k=this._variableReferenceToCount.runtimeVarRef;if(!k)throw new Error;k.pathForCount!==null&&this.Error(`Should be '${th.name}'(-> '${this._variableReferenceToCount.name}). Usage without the '->' only makes sense for variable targets.`)}}};r.FunctionCall=g,g.IsBuiltIn=V=>v.NativeFunctionCall.CallExistsWithName(V)?!0:V==="CHOICE_COUNT"||V==="TURNS_SINCE"||V==="TURNS"||V==="RANDOM"||V==="SEED_RANDOM"||V==="LIST_VALUE"||V==="LIST_RANDOM"||V==="READ_COUNT"})),uh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.MultipleConditionExpression=void 0;var u=on(),h=yn(),c=class extends u.Expression{get subExpressions(){return this.content}constructor(s){super(),this.GenerateIntoContainer=p=>{let m=!0;for(const v of this.subExpressions)v.GenerateIntoContainer(p),m||p.AddContent(h.NativeFunctionCall.CallWithName("&&")),m=!1},this.AddContent(s)}get typeName(){return"MultipleConditionExpression"}};r.MultipleConditionExpression=c})),Ga=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DivertTarget=void 0;var u=lh(),h=ja(),c=Es(),s=mh(),p=Jt(),m=on(),v=Sn(),y=Yl(),A=uh(),o=Ba(),T=Bt(),f=class gs extends m.Expression{get runtimeDivert(){if(!this._runtimeDivert)throw new Error;return this._runtimeDivert}get runtimeDivertTargetValue(){if(!this._runtimeDivertTargetValue)throw new Error;return this._runtimeDivertTargetValue}constructor(V){super(),this._runtimeDivert=null,this._runtimeDivertTargetValue=null,this.GenerateIntoContainer=B=>{this.divert.GenerateRuntimeObject(),this._runtimeDivert=this.divert.runtimeDivert,this._runtimeDivertTargetValue=new p.DivertTargetValue,B.AddContent(this.runtimeDivertTargetValue)},this.Equals=B=>{const k=(0,T.asOrNull)(B,gs);return!k||!this.divert.target||!k.divert.target?!1:this.divert.target.dotSeparatedComponents===k.divert.target.dotSeparatedComponents},this.divert=this.AddContent(V)}get typeName(){return"DivertTarget"}ResolveReferences(V){if(super.ResolveReferences(V),this.divert.isDone||this.divert.isEnd){this.Error("Can't use -> DONE or -> END as variable divert targets",this);return}let B=this;for(;B&&B instanceof m.Expression;){let M=!1,j=!1;const q=B.parent;if(q instanceof u.BinaryExpression){const z=q;z.opName!=="=="&&z.opName!=="!="?M=!0:(z.leftExpression instanceof gs||z.leftExpression instanceof o.VariableReference)&&(z.rightExpression instanceof gs||z.rightExpression instanceof o.VariableReference)||(M=!0),j=!0}else if(q instanceof y.FunctionCall){const z=q;!z.isTurnsSince&&!z.isReadCount&&(M=!0),j=!0}else(q instanceof m.Expression||q instanceof A.MultipleConditionExpression||q instanceof h.Choice&&q.condition===B||q instanceof c.Conditional||q instanceof s.ConditionalSingleBranch)&&(M=!0,j=!0);if(M&&this.Error(`Can't use a divert target like that. Did you intend to call '${this.divert.target}' as a function: likeThis(), or check the read count: likeThis, with no arrows?`,this),j)break;B=q}if(this.runtimeDivert.hasVariableTarget){if(!this.divert.target)throw new Error;this.Error(`Since '${this.divert.target.dotSeparatedComponents}' is a variable, it shouldn't be preceded by '->' here.`)}this.runtimeDivert.targetPath&&(this.runtimeDivertTargetValue.targetPath=this.runtimeDivert.targetPath);let k=this.divert.targetContent;if(k!==null){let M=k.containerForCounting;if(M!==null){const q=(0,T.asOrNull)(this.parent,y.FunctionCall);q&&q.isTurnsSince||(M.visitsShouldBeCounted=!0),M.turnIndexShouldBeCounted=!0}let j=(0,T.asOrNull)(k,v.FlowBase);if(j!=null&&j.args!==null)for(const q of j.args)q.isByReference&&this.Error(`Can't store a divert target to a knot or function that has by-reference arguments ('${j.identifier}' has 'ref ${q.identifier}').`)}}};r.DivertTarget=f})),qa=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Divert=void 0;var u=oe(),h=Ee(),c=Cn(),s=Ga(),p=Sn(),m=Yl(),v=Zt(),y=Ki(),A=Me(),o=Yi(),T=Jt(),f=Ba(),g=Hl(),V=Bt(),B=class extends v.ParsedObject{get runtimeDivert(){if(!this._runtimeDivert)throw new Error;return this._runtimeDivert}set runtimeDivert(k){this._runtimeDivert=k}get isEnd(){return!!(this.target&&this.target.dotSeparatedComponents==="END")}get isDone(){return!!(this.target&&this.target.dotSeparatedComponents==="DONE")}constructor(k,M){super(),this.args=[],this.target=null,this.targetContent=null,this._runtimeDivert=null,this.isFunctionCall=!1,this.isEmpty=!1,this.isTunnel=!1,this.isThread=!1,this.GenerateRuntimeObject=()=>{if(this.isEnd)return h.ControlCommand.End();if(this.isDone)return h.ControlCommand.Done();this.runtimeDivert=new c.Divert,this.ResolveTargetContent(),this.CheckArgumentValidity();const j=this.args!==null&&this.args.length>0;if(j||this.isFunctionCall||this.isTunnel||this.isThread){const q=new u.Container;if(j){this.isFunctionCall||q.AddContent(h.ControlCommand.EvalStart());let z=null;this.targetContent&&(z=this.targetContent.args);for(let Q=0;Q<this.args.length;++Q){const O=this.args[Q];let w=null;if(z&&Q<z.length&&(w=z[Q]),w&&w.isByReference){const N=(0,V.asOrNull)(O,f.VariableReference);if(!N){this.Error(`Expected variable name to pass by reference to 'ref ${w.identifier}' but saw ${O}`);break}const C=new y.Path(N.pathIdentifiers);if(C.ResolveFromContext(this)){this.Error(`can't pass a read count by reference. '${C.dotSeparatedComponents}' is a knot/stitch/label, but '${this.target.dotSeparatedComponents}' requires the name of a VAR to be passed.`);break}const S=new T.VariablePointerValue(N.name);q.AddContent(S)}else O.GenerateIntoContainer(q)}this.isFunctionCall||q.AddContent(h.ControlCommand.EvalEnd())}return this.isThread?q.AddContent(h.ControlCommand.StartThread()):(this.isFunctionCall||this.isTunnel)&&(this.runtimeDivert.pushesToStack=!0,this.runtimeDivert.stackPushType=this.isFunctionCall?o.PushPopType.Function:o.PushPopType.Tunnel),q.AddContent(this.runtimeDivert),q}return this.runtimeDivert},this.PathAsVariableName=()=>this.target?this.target.firstComponent:null,this.ResolveTargetContent=()=>{if(!(this.isEmpty||this.isEnd)&&this.targetContent===null){let j=this.PathAsVariableName();if(j!==null){const q=(0,V.asOrNull)((0,g.ClosestFlowBase)(this),p.FlowBase);if(q){const z=q.ResolveVariableWithName(j,this);if(z.found){if(z.isArgument&&z.ownerFlow&&z.ownerFlow.args){let Q=z.ownerFlow.args.find(O=>{var w;return((w=O.identifier)===null||w===void 0?void 0:w.name)==j});Q&&!Q.isDivertTarget&&this.Error(`Since '${Q.identifier}' is used as a variable divert target (on ${this.debugMetadata}), it should be marked as: -> ${Q.identifier}`,z.ownerFlow)}this.runtimeDivert.variableDivertName=j;return}}}if(!this.target)throw new Error;this.targetContent=this.target.ResolveFromContext(this)}},this.CheckArgumentValidity=()=>{if(this.isEmpty)return;let j=0;if(this.args!==null&&this.args.length>0&&(j=this.args.length),this.targetContent===null)return;const q=(0,V.asOrNull)(this.targetContent,p.FlowBase);if(j===0&&(q===null||!q.hasParameters))return;if(q===null&&j>0){this.Error("target needs to be a knot or stitch in order to pass arguments");return}else if(q!==null&&(q.args===null||!q.args&&j>0)){this.Error(`target (${q.name}) doesn't take parameters`);return}else if(this.parent instanceof s.DivertTarget){j>0&&this.Error("can't store arguments in a divert target variable");return}const z=q.args.length;if(z!==j){let Q;j===0?Q="but there weren't any passed to it":j<z?Q=`but only got ${j}`:Q=`but got ${j}`,this.Error(`to '${q.identifier}' requires ${z} arguments, ${Q}`);return}for(let Q=0;Q<z;++Q){const O=q.args[Q],w=this.args[Q];if(O.isDivertTarget){let N=(0,V.asOrNull)(w,f.VariableReference);if(!(w instanceof s.DivertTarget)&&N===null)this.Error(`Target '${q.identifier}' expects a divert target for the parameter named -> ${O.identifier} but saw ${w}`,w);else if(N){const C=new y.Path(N.pathIdentifiers);C.ResolveFromContext(N)&&this.Error(`Passing read count of '${C.dotSeparatedComponents}' instead of a divert target. You probably meant '${C}'`)}}}if(q===null){this.Error("Can't call as a function or with arguments unless it's a knot or stitch");return}},this.CheckExternalArgumentValidity=j=>{const q=this.target?this.target.firstComponent:null,z=j.externals.get(q);if(!z)throw new Error("external not found");const Q=z.argumentNames.length;let O=0;this.args&&(O=this.args.length),O!==Q&&this.Error(`incorrect number of arguments sent to external function '${q}'. Expected ${Q} but got ${O}`)},this.toString=()=>{let j="";if(this.target!==null)j+=this.target.toString();else return"-> <empty divert>";return this.isTunnel&&(j+=" ->"),this.isFunctionCall&&(j+=" ()"),j},k&&(this.target=k),M&&(this.args=M,this.AddContent(M))}get typeName(){return"Divert"}ResolveReferences(k){if(this.isEmpty||this.isEnd||this.isDone)return;if(!this.runtimeDivert)throw new Error;this.targetContent&&(this.runtimeDivert.targetPath=this.targetContent.runtimePath),super.ResolveReferences(k);let M=(0,V.asOrNull)(this.targetContent,p.FlowBase);M&&(!M.isFunction&&this.isFunctionCall?super.Error(`${M.identifier} hasn't been marked as a function, but it's being called as one. Do you need to declare the knot as '== function ${M.identifier} =='?`):M.isFunction&&!this.isFunctionCall&&!(this.parent instanceof s.DivertTarget)&&super.Error(M.identifier+" can't be diverted to. It can only be called as a function since it's been marked as such: '"+M.identifier+"(...)'"));const j=this.targetContent!==null;let q=!1,z=!1;if(this.target){if(this.target.numberOfComponents===1){if(!this.target.firstComponent)throw new Error;if(q=m.FunctionCall.IsBuiltIn(this.target.firstComponent),z=k.IsExternal(this.target.firstComponent),q||z){this.isFunctionCall||super.Error(`${this.target.firstComponent} must be called as a function: ~ ${this.target.firstComponent}()`),z&&(this.runtimeDivert.isExternal=!0,this.args!==null&&(this.runtimeDivert.externalArgs=this.args.length),this.runtimeDivert.pushesToStack=!1,this.runtimeDivert.targetPath=new A.Path(this.target.firstComponent),this.CheckExternalArgumentValidity(k));return}}}else throw new Error;this.runtimeDivert.variableDivertName==null&&!j&&!q&&!z&&this.Error(`target not found: '${this.target}'`)}Error(k,M=null,j=!1){if(M!==this&&M){super.Error(k,M);return}this.isFunctionCall?super.Error(`Function call ${k}`,M,j):super.Error(`Divert ${k}`,M,j)}};r.Divert=B})),cv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.GatherPointToResolve=void 0;var u=class{constructor(h,c){this.divert=h,this.targetRuntimeObj=c}};r.GatherPointToResolve=u})),fv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SequenceDivertToResolve=void 0;var u=class{constructor(h,c){this.divert=h,this.targetContent=c}};r.SequenceDivertToResolve=u})),oh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SequenceType=void 0;var u;(function(h){h[h.Stopping=1]="Stopping",h[h.Cycle=2]="Cycle",h[h.Shuffle=4]="Shuffle",h[h.Once=8]="Once"})(u||(r.SequenceType=u={}))})),hh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Sequence=void 0;var u=oe(),h=Ee(),c=Cn(),s=Jt(),p=yn(),m=Zt(),v=fv(),y=oh(),A=Xi(),o=class extends m.ParsedObject{constructor(T,f){super(),this.sequenceType=f,this._sequenceDivertsToResolve=[],this.GenerateRuntimeObject=()=>{const g=new u.Container;g.visitsShouldBeCounted=!0,g.countingAtStartOnly=!0,this._sequenceDivertsToResolve=[],g.AddContent(h.ControlCommand.EvalStart()),g.AddContent(h.ControlCommand.VisitIndex());const V=(this.sequenceType&y.SequenceType.Once)>0,B=(this.sequenceType&y.SequenceType.Cycle)>0,k=(this.sequenceType&y.SequenceType.Stopping)>0,M=(this.sequenceType&y.SequenceType.Shuffle)>0;let j=this.sequenceElements.length;if(V&&(j+=1),k||V?(g.AddContent(new s.IntValue(j-1)),g.AddContent(p.NativeFunctionCall.CallWithName("MIN"))):B&&(g.AddContent(new s.IntValue(this.sequenceElements.length)),g.AddContent(p.NativeFunctionCall.CallWithName("%"))),M){const z=h.ControlCommand.NoOp();if(V||k){const O=k?this.sequenceElements.length-1:this.sequenceElements.length;g.AddContent(h.ControlCommand.Duplicate()),g.AddContent(new s.IntValue(O)),g.AddContent(p.NativeFunctionCall.CallWithName("=="));const w=new c.Divert;w.isConditional=!0,g.AddContent(w),this.AddDivertToResolve(w,z)}let Q=this.sequenceElements.length;k&&(Q-=1),g.AddContent(new s.IntValue(Q)),g.AddContent(h.ControlCommand.SequenceShuffleIndex()),(V||k)&&g.AddContent(z)}g.AddContent(h.ControlCommand.EvalEnd());const q=h.ControlCommand.NoOp();for(let z=0;z<j;z+=1){g.AddContent(h.ControlCommand.EvalStart()),g.AddContent(h.ControlCommand.Duplicate()),g.AddContent(new s.IntValue(z)),g.AddContent(p.NativeFunctionCall.CallWithName("==")),g.AddContent(h.ControlCommand.EvalEnd());const Q=new c.Divert;Q.isConditional=!0,g.AddContent(Q);let O;z<this.sequenceElements.length?O=this.sequenceElements[z].runtimeObject:O=new u.Container,O.name=`s${z}`,O.InsertContent(h.ControlCommand.PopEvaluatedValue(),0);const w=new c.Divert;O.AddContent(w),g.AddToNamedContentOnly(O),this.AddDivertToResolve(Q,O),this.AddDivertToResolve(w,q)}return g.AddContent(q),g},this.AddDivertToResolve=(g,V)=>{this._sequenceDivertsToResolve.push(new v.SequenceDivertToResolve(g,V))},this.sequenceType=f,this.sequenceElements=[];for(const g of T){const V=g.content;let B=null;V===null||V.length===0?B=g:B=new A.Weave(V),this.sequenceElements.push(B),this.AddContent(B)}}get typeName(){return"Sequence"}ResolveReferences(T){super.ResolveReferences(T);for(const f of this._sequenceDivertsToResolve)f.divert.targetPath=f.targetContent.path}};r.Sequence=o})),ch=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.TunnelOnwards=void 0;var u=oe(),h=Ee(),c=Cn(),s=Jt(),p=Zt(),m=Hi(),v=Bt(),y=ka(),A=class extends p.ParsedObject{constructor(){super(...arguments),this._overrideDivertTarget=null,this._divertAfter=null,this.GenerateRuntimeObject=()=>{const o=new u.Container;if(o.AddContent(h.ControlCommand.EvalStart()),this.divertAfter){const T=this.divertAfter.GenerateRuntimeObject(),f=T;if(f){const V=this.divertAfter.args;if(V!==null&&V.length>0){let B=-1,k=-1;for(let M=0;M<f.content.length;M+=1){const j=f.content[M];j&&(B==-1&&j.commandType===h.ControlCommand.CommandType.EvalStart?B=M:j.commandType===h.ControlCommand.CommandType.EvalEnd&&(k=M))}for(let M=B+1;M<k;M+=1){const j=f.content[M];j.parent=null,o.AddContent(f.content[M])}}}let g=(0,v.asOrNull)(T,c.Divert);if(g!=null&&g.hasVariableTarget){let V=new y.VariableReference(g.variableDivertName);o.AddContent(V)}else this._overrideDivertTarget=new s.DivertTargetValue,o.AddContent(this._overrideDivertTarget)}else o.AddContent(new m.Void);return o.AddContent(h.ControlCommand.EvalEnd()),o.AddContent(h.ControlCommand.PopTunnel()),o},this.toString=()=>` -> ${this._divertAfter}`}get divertAfter(){return this._divertAfter}set divertAfter(o){this._divertAfter=o,this._divertAfter&&this.AddContent(this._divertAfter)}get typeName(){return"TunnelOnwards"}ResolveReferences(o){super.ResolveReferences(o),this.divertAfter&&this.divertAfter.targetContent&&(this._overrideDivertTarget.targetPath=this.divertAfter.targetContent.runtimePath)}};r.TunnelOnwards=A})),fh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ListDefinition=void 0;var u=Ie(),h=class{constructor(c,s){this._name=c||"",this._items=null,this._itemNameToValues=s||new Map}get name(){return this._name}get items(){if(this._items==null){this._items=new Map;for(let[c,s]of this._itemNameToValues){let p=new u.InkListItem(this.name,c);this._items.set(p.serialized(),s)}}return this._items}ValueForItem(c){if(!c.itemName)return 0;let s=this._itemNameToValues.get(c.itemName);return typeof s<"u"?s:0}ContainsItem(c){return!c.itemName||c.originName!=this.name?!1:this._itemNameToValues.has(c.itemName)}ContainsItemWithName(c){return this._itemNameToValues.has(c)}TryGetItemWithValue(c,s){for(let[p,m]of this._itemNameToValues)if(m==c)return s=new u.InkListItem(this.name,p),{result:s,exists:!0};return s=u.InkListItem.Null,{result:s,exists:!1}}TryGetValueForItem(c,s){if(!c.itemName)return{result:0,exists:!1};let p=this._itemNameToValues.get(c.itemName);return p?{result:p,exists:!0}:{result:0,exists:!1}}};r.ListDefinition=h})),As=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ListDefinition=void 0;var u=Ie(),h=Ie(),c=fh(),s=Jt(),p=Zt(),m=Kn(),v=class extends p.ParsedObject{get typeName(){return"ListDefinition"}get runtimeListDefinition(){var y;const A=new Map;for(const o of this.itemDefinitions)A.has(o.name)?this.Error(`List '${this.identifier}' contains duplicate items called '${o.name}'`):A.set(o.name,o.seriesValue);return new c.ListDefinition(((y=this.identifier)===null||y===void 0?void 0:y.name)||"",A)}constructor(y){super(),this.itemDefinitions=y,this.identifier=null,this.variableAssignment=null,this._elementsByName=null,this.ItemNamed=o=>{if(this._elementsByName===null){this._elementsByName=new Map;for(const T of this.itemDefinitions)this._elementsByName.set(T.name,T)}return this._elementsByName.get(o)||null},this.GenerateRuntimeObject=()=>{var o,T;const f=new u.InkList;for(const g of this.itemDefinitions)if(g.inInitialList){const V=new h.InkListItem(((o=this.identifier)===null||o===void 0?void 0:o.name)||null,g.name||null);f.Add(V,g.seriesValue)}return f.SetInitialOriginName(((T=this.identifier)===null||T===void 0?void 0:T.name)||""),new s.ListValue(f)};let A=1;for(const o of this.itemDefinitions)o.explicitValue!==null&&(A=o.explicitValue),o.seriesValue=A,A+=1;this.AddContent(y)}ResolveReferences(y){super.ResolveReferences(y),y.CheckForNamingCollisions(this,this.identifier,m.SymbolType.List)}};r.ListDefinition=v})),dh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.VariableAssignment=void 0;var u=oe(),h=Hl(),c=As(),s=Zt(),p=Kn(),m=Ci(),v=Ba(),y=Bt(),A=class extends s.ParsedObject{get variableName(){return this.variableIdentifier.name}get typeName(){return this.isNewTemporaryDeclaration?"temp":this.isGlobalDeclaration?this.listDefinition!==null?"LIST":"VAR":"variable assignment"}get isDeclaration(){return this.isGlobalDeclaration||this.isNewTemporaryDeclaration}constructor({assignedExpression:o,isGlobalDeclaration:T,isTemporaryNewDeclaration:f,listDef:g,variableIdentifier:V}){super(),this._runtimeAssignment=null,this.expression=null,this.listDefinition=null,this.GenerateRuntimeObject=()=>{let B=null;if(this.isGlobalDeclaration?B=this.story:this.isNewTemporaryDeclaration&&(B=(0,h.ClosestFlowBase)(this)),B&&B.AddNewVariableDeclaration(this),this.isGlobalDeclaration)return null;const k=new u.Container;return this.expression?k.AddContent(this.expression.runtimeObject):this.listDefinition&&k.AddContent(this.listDefinition.runtimeObject),this._runtimeAssignment=new m.VariableAssignment(this.variableName,this.isNewTemporaryDeclaration),k.AddContent(this._runtimeAssignment),k},this.toString=()=>`${this.isGlobalDeclaration?"VAR":this.isNewTemporaryDeclaration?"~ temp":""} ${this.variableName}`,this.variableIdentifier=V,this.isGlobalDeclaration=!!T,this.isNewTemporaryDeclaration=!!f,g instanceof c.ListDefinition?(this.listDefinition=this.AddContent(g),this.listDefinition.variableAssignment=this,this.isGlobalDeclaration=!0):o&&(this.expression=this.AddContent(o))}ResolveReferences(o){if(super.ResolveReferences(o),this.isDeclaration&&this.listDefinition===null&&o.CheckForNamingCollisions(this,this.variableIdentifier,this.isGlobalDeclaration?p.SymbolType.Var:p.SymbolType.Temp),this.isGlobalDeclaration){const T=(0,y.asOrNull)(this.expression,v.VariableReference);T&&!T.isConstantReference&&!T.isListItemReference&&this.Error("global variable assignments cannot refer to other variables, only literal values, constants and list items")}if(!this.isNewTemporaryDeclaration){const T=o.ResolveVariableWithName(this.variableName,this);T.found||(this.variableName in this.story.constants?this.Error(`Can't re-assign to a constant (do you need to use VAR when declaring '${this.variableName}'?)`,this):this.Error(`Variable could not be found to assign to: '${this.variableName}'`,this)),this._runtimeAssignment&&(this._runtimeAssignment.isGlobal=T.isGlobal)}}};r.VariableAssignment=A})),Xi=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Weave=void 0;var u=Ss(),h=ja(),c=Es(),s=Ts(),p=oe(),m=qa(),v=Cn(),y=Ga(),A=Sn(),o=Ul(),T=cv(),f=Zt(),g=hh(),V=Si(),B=ch(),k=dh(),M=Bt(),j=class qi extends f.ParsedObject{get rootContainer(){return this._rootContainer||(this._rootContainer=this.GenerateRuntimeObject()),this._rootContainer}get namedWeavePoints(){return this._namedWeavePoints}get lastParsedSignificantObject(){if(this.content.length===0)return null;let z=null;for(let O=this.content.length-1;O>=0;--O){z=this.content[O];let w=(0,M.asOrNull)(z,V.Text);if(!(w&&w.text===`
15
+ `)&&!this.IsGlobalDeclaration(z))break}const Q=(0,M.asOrNull)(z,qi);return Q&&(z=Q.lastParsedSignificantObject),z}constructor(z,Q=-1){super(),this.previousWeavePoint=null,this.addContentToPreviousWeavePoint=!1,this.hasSeenChoiceInSection=!1,this.currentContainer=null,this._unnamedGatherCount=0,this._choiceCount=0,this._rootContainer=null,this._namedWeavePoints=new Map,this.looseEnds=[],this.gatherPointsToResolve=[],this.ResolveWeavePointNaming=()=>{var O,w,N;const C=[...this.FindAll(o.Gather)(S=>!(S.name===null||S.name===void 0)),...this.FindAll(h.Choice)(S=>!(S.name===null||S.name===void 0))];this._namedWeavePoints=new Map;for(const S of C){const F=this.namedWeavePoints.get(((O=S.identifier)===null||O===void 0?void 0:O.name)||"");if(F){const K=F instanceof o.Gather?"gather":"choice",it=F;this.Error(`A ${K} with the same label name '${S.name}' already exists in this context on line ${it.debugMetadata?it.debugMetadata.startLineNumber:"NO DEBUG METADATA AVAILABLE"}`,S)}!((w=S.identifier)===null||w===void 0)&&w.name&&this.namedWeavePoints.set((N=S.identifier)===null||N===void 0?void 0:N.name,S)}},this.ConstructWeaveHierarchyFromIndentation=()=>{let O=0;for(;O<this.content.length;){const w=this.content[O];if(w instanceof h.Choice||w instanceof o.Gather){const N=w.indentationDepth-1;if(N>this.baseIndentIndex){let C=O;for(;O<this.content.length;){const it=(0,M.asOrNull)(this.content[O],h.Choice)||(0,M.asOrNull)(this.content[O],o.Gather);if(it!==null&&it.indentationDepth-1<=this.baseIndentIndex)break;O+=1}const S=O-C,F=this.content.slice(C,C+S);this.content.splice(C,S);const K=new qi(F,N);this.InsertContent(C,K),O=C}}O+=1}},this.DetermineBaseIndentationFromContent=O=>{for(const w of O)if(w instanceof h.Choice||w instanceof o.Gather)return w.indentationDepth-1;return 0},this.GenerateRuntimeObject=()=>{this._rootContainer=new p.Container,this.currentContainer=this._rootContainer,this.looseEnds=[],this.gatherPointsToResolve=[];for(const O of this.content)if(O instanceof h.Choice||O instanceof o.Gather)this.AddRuntimeForWeavePoint(O);else if(O instanceof qi){const w=O;this.AddRuntimeForNestedWeave(w),this.gatherPointsToResolve.splice(0,0,...w.gatherPointsToResolve)}else this.AddGeneralRuntimeContent(O.runtimeObject);return this.PassLooseEndsToAncestors(),this._rootContainer},this.AddRuntimeForGather=O=>{const w=!this.hasSeenChoiceInSection;this.hasSeenChoiceInSection=!1;const N=O.runtimeContainer;if(O.name||(N.name=`g-${this._unnamedGatherCount}`,this._unnamedGatherCount+=1),w){if(!this.currentContainer)throw new Error;this.currentContainer.AddContent(N)}else this.rootContainer.AddToNamedContentOnly(N);for(const C of this.looseEnds){const S=C;if(S instanceof o.Gather&&S.indentationDepth==O.indentationDepth)continue;let F=null;if(S instanceof m.Divert)F=S.runtimeObject;else{F=new v.Divert;const K=S;if(!K.runtimeContainer)throw new Error;K.runtimeContainer.AddContent(F)}this.gatherPointsToResolve.push(new T.GatherPointToResolve(F,N))}this.looseEnds=[],this.currentContainer=N},this.AddRuntimeForWeavePoint=O=>{if(O instanceof o.Gather)this.AddRuntimeForGather(O);else if(O instanceof h.Choice){if(!this.currentContainer)throw new Error;this.previousWeavePoint instanceof o.Gather&&this.looseEnds.splice(this.looseEnds.indexOf(this.previousWeavePoint),1);const w=O;if(this.currentContainer.AddContent(w.runtimeObject),!w.innerContentContainer)throw new Error;w.innerContentContainer.name=`c-${this._choiceCount}`,this.currentContainer.AddToNamedContentOnly(w.innerContentContainer),this._choiceCount+=1,this.hasSeenChoiceInSection=!0}this.addContentToPreviousWeavePoint=!1,this.WeavePointHasLooseEnd(O)&&(this.looseEnds.push(O),(0,M.asOrNull)(O,h.Choice)&&(this.addContentToPreviousWeavePoint=!0)),this.previousWeavePoint=O},this.AddRuntimeForNestedWeave=O=>{this.AddGeneralRuntimeContent(O.rootContainer),this.previousWeavePoint!==null&&(this.looseEnds.splice(this.looseEnds.indexOf(this.previousWeavePoint),1),this.addContentToPreviousWeavePoint=!1)},this.AddGeneralRuntimeContent=O=>{if(O!==null)if(this.addContentToPreviousWeavePoint){if(!this.previousWeavePoint||!this.previousWeavePoint.runtimeContainer)throw new Error;this.previousWeavePoint.runtimeContainer.AddContent(O)}else{if(!this.currentContainer)throw new Error;this.currentContainer.AddContent(O)}},this.PassLooseEndsToAncestors=()=>{if(this.looseEnds.length===0)return;let O=null,w=null,N=!1;for(let C=this.parent;C!==null;C=C.parent){const S=(0,M.asOrNull)(C,qi);S&&(!N&&O===null&&(O=S),N&&w===null&&(w=S)),(C instanceof g.Sequence||C instanceof c.Conditional)&&(N=!0)}if(!(O===null&&w===null))for(let C=this.looseEnds.length-1;C>=0;C-=1){const S=this.looseEnds[C];let F=!1;if(N){if(S instanceof h.Choice&&O!==null)O.ReceiveLooseEnd(S),F=!0;else if(!(S instanceof h.Choice)){const K=O||w;K!==null&&(K.ReceiveLooseEnd(S),F=!0)}}else O?.hasOwnProperty("ReceiveLooseEnd")&&O.ReceiveLooseEnd(S),F=!0;F&&this.looseEnds.splice(C,1)}},this.ReceiveLooseEnd=O=>{this.looseEnds.push(O)},this.WeavePointNamed=O=>{if(!this.namedWeavePoints)return null;let w=this.namedWeavePoints.get(O);return w||null},this.IsGlobalDeclaration=O=>{const w=(0,M.asOrNull)(O,k.VariableAssignment);return!!(w&&w.isGlobalDeclaration&&w.isDeclaration||(0,M.asOrNull)(O,s.ConstantDeclaration))},this.ContentThatFollowsWeavePoint=O=>{const w=[],N=O;if(N.content!==null)for(const F of N.content)this.IsGlobalDeclaration(F)||w.push(F);const C=(0,M.asOrNull)(N.parent,qi);if(C===null)throw new Error("Expected weave point parent to be weave?");const S=C.content.indexOf(N);for(let F=S+1;F<C.content.length;F+=1){const K=C.content[F];if(!this.IsGlobalDeclaration(K)){if(K instanceof h.Choice||K instanceof o.Gather||K instanceof qi)break;w.push(K)}}return w},this.ValidateTermination=O=>{if(!(this.lastParsedSignificantObject instanceof u.AuthorWarning))if(this.looseEnds!==null&&this.looseEnds.length>0)for(const w of this.looseEnds){const N=this.ContentThatFollowsWeavePoint(w);this.ValidateFlowOfObjectsTerminates(N,w,O)}else{for(const w of this.content)if(w instanceof h.Choice||w instanceof m.Divert)return;this.ValidateFlowOfObjectsTerminates(this.content,this,O)}},this.BadNestedTerminationHandler=O=>{let w=null;for(let C=O.parent;C!==null;C=C.parent)if(C instanceof g.Sequence||C instanceof c.Conditional){w=(0,M.asOrNull)(C,c.Conditional);break}let N="Choices nested in conditionals or sequences need to explicitly divert afterwards.";w!==null&&w.FindAll(h.Choice)().length===1&&(N=`Choices with conditions should be written: '* {condition} choice'. Otherwise, ${N.toLowerCase()}`),this.Error(N,O)},this.ValidateFlowOfObjectsTerminates=(O,w,N)=>{let C=!1,S=w;for(const F of O){if(F.Find(m.Divert)(K=>!K.isThread&&!K.isTunnel&&!K.isFunctionCall&&!(K.parent instanceof y.DivertTarget))!==null&&(C=!0),F.Find(B.TunnelOnwards)()!=null){C=!0;break}S=F}if(!C){if(S instanceof u.AuthorWarning)return;N(S)}},this.WeavePointHasLooseEnd=O=>{if(O.content===null)return!0;for(let w=O.content.length-1;w>=0;--w){let N=(0,M.asOrNull)(O.content[w],m.Divert);if(N&&!(N.isThread||N.isTunnel||N.isFunctionCall))return!1}return!0},this.CheckForWeavePointNamingCollisions=()=>{if(!this.namedWeavePoints)return;const O=[];for(const w of this.ancestry){const N=(0,M.asOrNull)(w,A.FlowBase);if(N)O.push(N);else break}for(const[w,N]of this.namedWeavePoints)for(const C of O){const S=C.ContentWithNameAtLevel(w);if(S&&S!==N){const F=`${N.GetType()} '${w}' has the same label name as a ${S.GetType()} (on ${S.debugMetadata})`;this.Error(F,N)}}},Q==-1?this.baseIndentIndex=this.DetermineBaseIndentationFromContent(z):this.baseIndentIndex=Q,this.AddContent(z),this.ConstructWeaveHierarchyFromIndentation()}get typeName(){return"Weave"}ResolveReferences(z){if(super.ResolveReferences(z),this.looseEnds!==null&&this.looseEnds.length>0){let Q=!1;for(let O=this.parent;O!==null;O=O.parent)if(O instanceof g.Sequence||O instanceof c.Conditional){Q=!0;break}Q&&this.ValidateTermination(this.BadNestedTerminationHandler)}for(const Q of this.gatherPointsToResolve)Q.divert.targetPath=Q.targetRuntimeObj.path;this.CheckForWeavePointNamingCollisions()}};r.Weave=j})),mh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ConditionalSingleBranch=void 0;var u=oe(),h=Ee(),c=Cn(),s=Zt(),p=yn(),m=Jt(),v=Si(),y=Xi(),A=Bt(),o=class extends s.ParsedObject{get ownExpression(){return this._ownExpression}set ownExpression(T){this._ownExpression=T,this._ownExpression&&this.AddContent(this._ownExpression)}constructor(T){super(),this._contentContainer=null,this._conditionalDivert=null,this._ownExpression=null,this._innerWeave=null,this.isTrueBranch=!1,this.matchingEquality=!1,this.isElse=!1,this.isInline=!1,this.returnDivert=null,this.GenerateRuntimeObject=()=>{if(this._innerWeave)for(const V of this._innerWeave.content){const B=(0,A.asOrNull)(V,v.Text);B&&B.text.startsWith("else:")&&this.Warning("Saw the text 'else:' which is being treated as content. Did you mean '- else:'?",B)}const f=new u.Container,g=this.matchingEquality&&!this.isElse;if(g&&f.AddContent(h.ControlCommand.Duplicate()),this._conditionalDivert=new c.Divert,this._conditionalDivert.isConditional=!this.isElse,!this.isTrueBranch&&!this.isElse){const V=this.ownExpression!==null;V&&f.AddContent(h.ControlCommand.EvalStart()),this.ownExpression&&this.ownExpression.GenerateIntoContainer(f),this.matchingEquality&&f.AddContent(p.NativeFunctionCall.CallWithName("==")),V&&f.AddContent(h.ControlCommand.EvalEnd())}return f.AddContent(this._conditionalDivert),this._contentContainer=this.GenerateRuntimeForContent(),this._contentContainer.name="b",this.isInline||this._contentContainer.InsertContent(new m.StringValue(`
16
+ `),0),(g||this.isElse&&this.matchingEquality)&&this._contentContainer.InsertContent(h.ControlCommand.PopEvaluatedValue(),0),f.AddToNamedContentOnly(this._contentContainer),this.returnDivert=new c.Divert,this._contentContainer.AddContent(this.returnDivert),f},this.GenerateRuntimeForContent=()=>this._innerWeave===null?new u.Container:this._innerWeave.rootContainer,T&&(this._innerWeave=new y.Weave(T),this.AddContent(this._innerWeave))}get typeName(){return"ConditionalSingleBranch"}ResolveReferences(T){if(!this._conditionalDivert||!this._contentContainer)throw new Error;this._conditionalDivert.targetPath=this._contentContainer.path,super.ResolveReferences(T)}};r.ConditionalSingleBranch=o})),dv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CustomFlags=void 0;var u;(function(h){h[h.ParsingString=1]="ParsingString",h[h.TagActive=2]="TagActive"})(u||(r.CustomFlags=u={}))})),mv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DebugMetadata=void 0;var u=class Um{constructor(){this.startLineNumber=0,this.endLineNumber=0,this.startCharacterNumber=0,this.endCharacterNumber=0,this.fileName=null,this.sourceName=null}Merge(c){let s=new Um;return s.fileName=this.fileName,s.sourceName=this.sourceName,this.startLineNumber<c.startLineNumber?(s.startLineNumber=this.startLineNumber,s.startCharacterNumber=this.startCharacterNumber):this.startLineNumber>c.startLineNumber?(s.startLineNumber=c.startLineNumber,s.startCharacterNumber=c.startCharacterNumber):(s.startLineNumber=this.startLineNumber,s.startCharacterNumber=Math.min(this.startCharacterNumber,c.startCharacterNumber)),this.endLineNumber>c.endLineNumber?(s.endLineNumber=this.endLineNumber,s.endCharacterNumber=this.endCharacterNumber):this.endLineNumber<c.endLineNumber?(s.endLineNumber=c.endLineNumber,s.endCharacterNumber=c.endCharacterNumber):(s.endLineNumber=this.endLineNumber,s.endCharacterNumber=Math.max(this.endCharacterNumber,c.endCharacterNumber)),s}toString(){return this.fileName!==null?`line ${this.startLineNumber} of ${this.fileName}"`:"line "+this.startLineNumber}};r.DebugMetadata=u})),vv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ExternalDeclaration=void 0;var u=Zt(),h=class extends u.ParsedObject{get name(){var c;return((c=this.identifier)===null||c===void 0?void 0:c.name)||null}constructor(c,s){super(),this.identifier=c,this.argumentNames=s,this.GenerateRuntimeObject=()=>(this.story.AddExternal(this),null)}get typeName(){return"EXTERNAL"}toString(){var c;return`EXTERNAL ${(c=this.identifier)===null||c===void 0?void 0:c.name}`}};r.ExternalDeclaration=h})),gv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.FlowDecl=void 0;var u=class{constructor(h,c,s){this.name=h,this.args=c,this.isFunction=s}};r.FlowDecl=u})),vh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Wrap=void 0;var u=Zt(),h=class extends u.ParsedObject{constructor(c){super(),this._objToWrap=c,this.GenerateRuntimeObject=()=>this._objToWrap}};r.Wrap=h})),pv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Glue=void 0;var u=vh(),h=class extends u.Wrap{constructor(c){super(c)}get typeName(){return"Glue"}};r.Glue=h})),ws=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Glue=void 0;var u=Fe(),h=class extends u.InkObject{toString(){return"Glue"}};r.Glue=h})),yv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IncDecExpression=void 0;var u=Ns(),h=on(),c=Sn(),s=yn(),p=Jt(),m=Ci(),v=ka(),y=Xi(),A=class extends h.Expression{constructor(o,T,f){super(),this.varIdentifier=o,this._runtimeAssignment=null,this.expression=null,this.GenerateIntoContainer=g=>{var V,B;g.AddContent(new v.VariableReference(((V=this.varIdentifier)===null||V===void 0?void 0:V.name)||null)),this.expression?this.expression.GenerateIntoContainer(g):g.AddContent(new p.IntValue(1)),g.AddContent(s.NativeFunctionCall.CallWithName(this.isInc?"+":"-")),this._runtimeAssignment=new m.VariableAssignment(((B=this.varIdentifier)===null||B===void 0?void 0:B.name)||null,!1),g.AddContent(this._runtimeAssignment)},this.toString=()=>{var g,V;return this.expression?`${(g=this.varIdentifier)===null||g===void 0?void 0:g.name}${this.isInc?" += ":" -= "}${this.expression}`:`${(V=this.varIdentifier)===null||V===void 0?void 0:V.name}`+(this.isInc?"++":"--")},T instanceof h.Expression?(this.expression=T,this.AddContent(this.expression),this.isInc=!!f):this.isInc=T}get typeName(){return"IncDecExpression"}ResolveReferences(o){var T;super.ResolveReferences(o);const f=o.ResolveVariableWithName(((T=this.varIdentifier)===null||T===void 0?void 0:T.name)||"",this);if(f.found||this.Error(`variable for ${this.incrementDecrementWord} could not be found: '${this.varIdentifier}' after searching: {this.descriptionOfScope}`),!this._runtimeAssignment)throw new Error;this._runtimeAssignment.isGlobal=f.isGlobal,!(this.parent instanceof y.Weave)&&!(this.parent instanceof c.FlowBase)&&!(this.parent instanceof u.ContentList)&&this.Error(`Can't use ${this.incrementDecrementWord} as sub-expression`)}get incrementDecrementWord(){return this.isInc?"increment":"decrement"}};r.IncDecExpression=A})),gh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.IncludedFile=void 0;var u=Zt(),h=class extends u.ParsedObject{constructor(c){super(),this.includedStory=c,this.GenerateRuntimeObject=()=>null}get typeName(){return"IncludedFile"}};r.IncludedFile=h})),Cv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InfixOperator=void 0;var u=class{constructor(h,c,s){this.type=h,this.precedence=c,this.requireWhitespace=s,this.toString=()=>this.type}};r.InfixOperator=u})),ph=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Knot=void 0;var u=Sn(),h=Wa(),c=class extends u.FlowBase{get flowLevel(){return h.FlowLevel.Knot}constructor(s,p,m,v){super(s,p,m,v)}get typeName(){return this.isFunction?"Function":"Knot"}ResolveReferences(s){super.ResolveReferences(s);let p=this.story;for(const m in this.subFlowsByName){const v=p.ContentWithNameAtLevel(m,h.FlowLevel.Knot,!1);if(v){const y=this.subFlowsByName.get(m),A=`Stitch '${y?y.name:"NO STITCH FOUND"}' has the same name as a knot (on ${v.debugMetadata})`;this.Error(A,y)}}}};r.Knot=c})),Sv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.List=void 0;var u=on(),h=Ie(),c=Ie(),s=Jt(),p=class extends u.Expression{constructor(m){super(),this.itemIdentifierList=m,this.GenerateIntoContainer=v=>{var y,A;const o=new h.InkList;if(this.itemIdentifierList!=null)for(const T of this.itemIdentifierList){const f=((y=T?.name)===null||y===void 0?void 0:y.split("."))||[];let g=null,V="";f.length>1?(g=f[0],V=f[1]):V=f[0];const B=this.story.ResolveListItem(g,V,this);if(B===null)g===null?this.Error(`Could not find list definition that contains item '${T}'`):this.Error(`Could not find list item ${T}`);else{if(B.parent==null){this.Error(`Could not find list definition for item ${T}`);return}g||(g=((A=B.parent.identifier)===null||A===void 0?void 0:A.name)||null);const k=new c.InkListItem(g,B.name||null);o.has(k.serialized())?this.Warning(`Duplicate of item '${T}' in list.`):o.Add(k,B.seriesValue)}}v.AddContent(new s.ListValue(o))}}get typeName(){return"List"}};r.List=p})),yh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ListElementDefinition=void 0;var u=Zt(),h=Kn(),c=class extends u.ParsedObject{get fullName(){var s;const p=this.parent;if(p===null)throw new Error("Can't get full name without a parent list.");return`${(s=p.identifier)===null||s===void 0?void 0:s.name}.${this.name}`}get typeName(){return"ListElement"}get name(){var s;return((s=this.indentifier)===null||s===void 0?void 0:s.name)||null}constructor(s,p,m=null){super(),this.indentifier=s,this.inInitialList=p,this.explicitValue=m,this.seriesValue=0,this.parent=null,this.GenerateRuntimeObject=()=>{throw new Error("Not implemented.")},this.toString=()=>this.fullName,this.parent=this.parent}ResolveReferences(s){super.ResolveReferences(s),s.CheckForNamingCollisions(this,this.indentifier,h.SymbolType.ListItem)}};r.ListElementDefinition=c})),Ch=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.StatementLevel=void 0;var u;(function(h){h[h.InnerBlock=0]="InnerBlock",h[h.Stitch=1]="Stitch",h[h.Knot=2]="Knot",h[h.Top=3]="Top"})(u||(r.StatementLevel=u={}))})),Sh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Stitch=void 0;var u=Sn(),h=Wa(),c=class extends u.FlowBase{get flowLevel(){return h.FlowLevel.Stitch}constructor(s,p,m,v){super(s,p,m,v),this.baseToString=this.toString,this.toString=()=>`${this.parent!==null?this.parent+" > ":""}${this.baseToString()}`}get typeName(){return"Stitch"}};r.Stitch=c})),xs=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Tag=void 0;var u=Fe(),h=class extends u.InkObject{constructor(c){super(),this.text=c.toString()||""}toString(){return"# "+this.text}};r.Tag=h})),_h=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Choice=void 0;var u=Me(),h=be(),c=Fe(),s=class Hm extends c.InkObject{constructor(){super(...arguments),this.text="",this.index=0,this.threadAtGeneration=null,this.sourcePath="",this.targetPath=null,this.isInvisibleDefault=!1,this.tags=null,this.originalThreadIndex=0}get pathStringOnChoice(){return this.targetPath===null?(0,h.throwNullException)("Choice.targetPath"):this.targetPath.toString()}set pathStringOnChoice(m){this.targetPath=new u.Path(m)}Clone(){let m=new Hm;return m.text=this.text,m.sourcePath=this.sourcePath,m.index=this.index,m.targetPath=this.targetPath,m.originalThreadIndex=this.originalThreadIndex,m.isInvisibleDefault=this.isInvisibleDefault,this.threadAtGeneration!==null&&(m.threadAtGeneration=this.threadAtGeneration.Copy()),m}};r.Choice=s})),bh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ListDefinitionsOrigin=void 0;var u=Ie(),h=Jt(),c=be(),s=class{constructor(p){this._lists=new Map,this._allUnambiguousListValueCache=new Map;for(let m of p){this._lists.set(m.name,m);for(let[v,y]of m.items){let A=u.InkListItem.fromSerializedKey(v),o=new h.ListValue(A,y);if(!A.itemName)throw new Error("item.itemName is null or undefined.");this._allUnambiguousListValueCache.set(A.itemName,o),this._allUnambiguousListValueCache.set(A.fullName,o)}}}get lists(){let p=[];for(let[,m]of this._lists)p.push(m);return p}TryListGetDefinition(p,m){if(p===null)return{result:m,exists:!1};let v=this._lists.get(p);return v?{result:v,exists:!0}:{result:m,exists:!1}}FindSingleItemListWithName(p){if(p===null)return(0,c.throwNullException)("name");let m=this._allUnambiguousListValueCache.get(p);return typeof m<"u"?m:null}};r.ListDefinitionsOrigin=s})),za=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.JsonSerialisation=void 0;var u=oe(),h=Jt(),c=ws(),s=Ee(),p=Yi(),m=Cn(),v=bs(),y=ka(),A=Ci(),o=yn(),T=Hi(),f=xs(),g=Me(),V=_h(),B=fh(),k=bh(),M=Ie(),j=Bt(),q=be(),z=class ps{static JArrayToRuntimeObjList(O,w=!1){let N=O.length;w&&N--;let C=[];for(let S=0;S<N;S++){let F=O[S],K=this.JTokenToRuntimeObject(F);if(K===null)return(0,q.throwNullException)("runtimeObj");C.push(K)}return C}static WriteDictionaryRuntimeObjs(O,w){O.WriteObjectStart();for(let[N,C]of w)O.WritePropertyStart(N),this.WriteRuntimeObject(O,C),O.WritePropertyEnd();O.WriteObjectEnd()}static WriteListRuntimeObjs(O,w){O.WriteArrayStart();for(let N of w)this.WriteRuntimeObject(O,N);O.WriteArrayEnd()}static WriteIntDictionary(O,w){O.WriteObjectStart();for(let[N,C]of w)O.WriteIntProperty(N,C);O.WriteObjectEnd()}static WriteRuntimeObject(O,w){let N=(0,j.asOrNull)(w,u.Container);if(N){this.WriteRuntimeContainer(O,N);return}let C=(0,j.asOrNull)(w,m.Divert);if(C){let rt="->";C.isExternal?rt="x()":C.pushesToStack&&(C.stackPushType==p.PushPopType.Function?rt="f()":C.stackPushType==p.PushPopType.Tunnel&&(rt="->t->"));let ut;C.hasVariableTarget?ut=C.variableDivertName:ut=C.targetPathString,O.WriteObjectStart(),O.WriteProperty(rt,ut),C.hasVariableTarget&&O.WriteProperty("var",!0),C.isConditional&&O.WriteProperty("c",!0),C.externalArgs>0&&O.WriteIntProperty("exArgs",C.externalArgs),O.WriteObjectEnd();return}let S=(0,j.asOrNull)(w,v.ChoicePoint);if(S){O.WriteObjectStart(),O.WriteProperty("*",S.pathStringOnChoice),O.WriteIntProperty("flg",S.flags),O.WriteObjectEnd();return}let F=(0,j.asOrNull)(w,h.BoolValue);if(F){O.WriteBool(F.value);return}let K=(0,j.asOrNull)(w,h.IntValue);if(K){O.WriteInt(K.value);return}let it=(0,j.asOrNull)(w,h.FloatValue);if(it){O.WriteFloat(it.value);return}let ot=(0,j.asOrNull)(w,h.StringValue);if(ot){ot.isNewline?O.Write(`
17
+ `,!1):(O.WriteStringStart(),O.WriteStringInner("^"),O.WriteStringInner(ot.value),O.WriteStringEnd());return}let E=(0,j.asOrNull)(w,h.ListValue);if(E){this.WriteInkList(O,E);return}let x=(0,j.asOrNull)(w,h.DivertTargetValue);if(x){if(O.WriteObjectStart(),x.value===null)return(0,q.throwNullException)("divTargetVal.value");O.WriteProperty("^->",x.value.componentsString),O.WriteObjectEnd();return}let D=(0,j.asOrNull)(w,h.VariablePointerValue);if(D){O.WriteObjectStart(),O.WriteProperty("^var",D.value),O.WriteIntProperty("ci",D.contextIndex),O.WriteObjectEnd();return}if((0,j.asOrNull)(w,c.Glue)){O.Write("<>");return}let R=(0,j.asOrNull)(w,s.ControlCommand);if(R){O.Write(ps._controlCommandNames[R.commandType]);return}let Z=(0,j.asOrNull)(w,o.NativeFunctionCall);if(Z){let rt=Z.name;rt=="^"&&(rt="L^"),O.Write(rt);return}let tt=(0,j.asOrNull)(w,y.VariableReference);if(tt){O.WriteObjectStart();let rt=tt.pathStringForCount;rt!=null?O.WriteProperty("CNT?",rt):O.WriteProperty("VAR?",tt.name),O.WriteObjectEnd();return}let ft=(0,j.asOrNull)(w,A.VariableAssignment);if(ft){O.WriteObjectStart();let rt=ft.isGlobal?"VAR=":"temp=";O.WriteProperty(rt,ft.variableName),ft.isNewDeclaration||O.WriteProperty("re",!0),O.WriteObjectEnd();return}if((0,j.asOrNull)(w,T.Void)){O.Write("void");return}let L=(0,j.asOrNull)(w,f.Tag);if(L){O.WriteObjectStart(),O.WriteProperty("#",L.text),O.WriteObjectEnd();return}let $=(0,j.asOrNull)(w,V.Choice);if($){this.WriteChoice(O,$);return}throw new Error("Failed to convert runtime object to Json token: "+w)}static JObjectToDictionaryRuntimeObjs(O){let w=new Map;for(let N in O)if(O.hasOwnProperty(N)){let C=this.JTokenToRuntimeObject(O[N]);if(C===null)return(0,q.throwNullException)("inkObject");w.set(N,C)}return w}static JObjectToIntDictionary(O){let w=new Map;for(let N in O)O.hasOwnProperty(N)&&w.set(N,parseInt(O[N]));return w}static JTokenToRuntimeObject(O){if(typeof O=="number"&&!isNaN(O)||typeof O=="boolean")return h.Value.Create(O);if(typeof O=="string"){let w=O.toString();const N=/^([0-9]+.[0-9]+f)$/.exec(w);if(N)return new h.FloatValue(parseFloat(N[0]));let C=w[0];if(C=="^")return new h.StringValue(w.substring(1));if(C==`
18
+ `&&w.length==1)return new h.StringValue(`
19
+ `);if(w=="<>")return new c.Glue;for(let S=0;S<ps._controlCommandNames.length;++S){let F=ps._controlCommandNames[S];if(w==F)return new s.ControlCommand(S)}if(w=="L^"&&(w="^"),o.NativeFunctionCall.CallExistsWithName(w))return o.NativeFunctionCall.CallWithName(w);if(w=="->->")return s.ControlCommand.PopTunnel();if(w=="~ret")return s.ControlCommand.PopFunction();if(w=="void")return new T.Void}if(typeof O=="object"&&!Array.isArray(O)){let w=O,N;if(w["^->"])return N=w["^->"],new h.DivertTargetValue(new g.Path(N.toString()));if(w["^var"]){N=w["^var"];let E=new h.VariablePointerValue(N.toString());return"ci"in w&&(N=w.ci,E.contextIndex=parseInt(N)),E}let C=!1,S=!1,F=p.PushPopType.Function,K=!1;if((N=w["->"])?C=!0:(N=w["f()"])?(C=!0,S=!0,F=p.PushPopType.Function):(N=w["->t->"])?(C=!0,S=!0,F=p.PushPopType.Tunnel):(N=w["x()"])&&(C=!0,K=!0,S=!1,F=p.PushPopType.Function),C){let E=new m.Divert;E.pushesToStack=S,E.stackPushType=F,E.isExternal=K;let x=N.toString();return(N=w.var)?E.variableDivertName=x:E.targetPathString=x,E.isConditional=!!w.c,K&&(N=w.exArgs)&&(E.externalArgs=parseInt(N)),E}if(N=w["*"]){let E=new v.ChoicePoint;return E.pathStringOnChoice=N.toString(),(N=w.flg)&&(E.flags=parseInt(N)),E}if(N=w["VAR?"])return new y.VariableReference(N.toString());if(N=w["CNT?"]){let E=new y.VariableReference;return E.pathStringForCount=N.toString(),E}let it=!1,ot=!1;if((N=w["VAR="])?(it=!0,ot=!0):(N=w["temp="])&&(it=!0,ot=!1),it){let E=N.toString(),x=!w.re,D=new A.VariableAssignment(E,x);return D.isGlobal=ot,D}if(w["#"]!==void 0)return N=w["#"],new f.Tag(N.toString());if(N=w.list){let E=N,x=new M.InkList;if(N=w.origins){let D=N;x.SetInitialOriginNames(D)}for(let D in E)if(E.hasOwnProperty(D)){let R=E[D],Z=new M.InkListItem(D),tt=parseInt(R);x.Add(Z,tt)}return new h.ListValue(x)}if(w.originalChoicePath!=null)return this.JObjectToChoice(w)}if(Array.isArray(O))return this.JArrayToContainer(O);if(O==null)return null;throw new Error("Failed to convert token to runtime object: "+this.toJson(O,["parent"]))}static toJson(O,w,N){return JSON.stringify(O,(C,S)=>w?.some(F=>F===C)?void 0:S,N)}static WriteRuntimeContainer(O,w,N=!1){if(O.WriteArrayStart(),w===null)return(0,q.throwNullException)("container");for(let it of w.content)this.WriteRuntimeObject(O,it);let C=w.namedOnlyContent,S=w.countFlags,F=w.name!=null&&!N,K=C!=null||S>0||F;if(K&&O.WriteObjectStart(),C!=null)for(let[it,ot]of C){let E=it,x=(0,j.asOrNull)(ot,u.Container);O.WritePropertyStart(E),this.WriteRuntimeContainer(O,x,!0),O.WritePropertyEnd()}S>0&&O.WriteIntProperty("#f",S),F&&O.WriteProperty("#n",w.name),K?O.WriteObjectEnd():O.WriteNull(),O.WriteArrayEnd()}static JArrayToContainer(O){let w=new u.Container;w.content=this.JArrayToRuntimeObjList(O,!0);let N=O[O.length-1];if(N!=null){let C=new Map;for(let S in N)if(S=="#f")w.countFlags=parseInt(N[S]);else if(S=="#n")w.name=N[S].toString();else{let F=this.JTokenToRuntimeObject(N[S]),K=(0,j.asOrNull)(F,u.Container);K&&(K.name=S),C.set(S,F)}w.namedOnlyContent=C}return w}static JObjectToChoice(O){let w=new V.Choice;return w.text=O.text.toString(),w.index=parseInt(O.index),w.sourcePath=O.originalChoicePath.toString(),w.originalThreadIndex=parseInt(O.originalThreadIndex),w.pathStringOnChoice=O.targetPath.toString(),w.tags=this.JArrayToTags(O),w.isInvisibleDefault=!!O.isInvisibleDefault,w}static JArrayToTags(O){return O.tags?O.tags:null}static WriteChoice(O,w){O.WriteObjectStart(),O.WriteProperty("text",w.text),O.WriteIntProperty("index",w.index),O.WriteProperty("originalChoicePath",w.sourcePath),O.WriteIntProperty("originalThreadIndex",w.originalThreadIndex),O.WriteProperty("targetPath",w.pathStringOnChoice),O.WriteProperty("isInvisibleDefault",w.isInvisibleDefault),this.WriteChoiceTags(O,w),O.WriteObjectEnd()}static WriteChoiceTags(O,w){if(w.tags&&w.tags.length>0){O.WritePropertyStart("tags"),O.WriteArrayStart();for(const N of w.tags)O.Write(N);O.WriteArrayEnd(),O.WritePropertyEnd()}}static WriteInkList(O,w){let N=w.value;if(N===null)return(0,q.throwNullException)("rawList");O.WriteObjectStart(),O.WritePropertyStart("list"),O.WriteObjectStart();for(let[C,S]of N){let F=M.InkListItem.fromSerializedKey(C),K=S;if(F.itemName===null)return(0,q.throwNullException)("item.itemName");O.WritePropertyNameStart(),O.WritePropertyNameInner(F.originName?F.originName:"?"),O.WritePropertyNameInner("."),O.WritePropertyNameInner(F.itemName),O.WritePropertyNameEnd(),O.Write(K),O.WritePropertyEnd()}if(O.WriteObjectEnd(),O.WritePropertyEnd(),N.Count==0&&N.originNames!=null&&N.originNames.length>0){O.WritePropertyStart("origins"),O.WriteArrayStart();for(let C of N.originNames)O.Write(C);O.WriteArrayEnd(),O.WritePropertyEnd()}O.WriteObjectEnd()}static ListDefinitionsToJToken(O){let w={};for(let N of O.lists){let C={};for(let[S,F]of N.items){let K=M.InkListItem.fromSerializedKey(S);if(K.itemName===null)return(0,q.throwNullException)("item.itemName");C[K.itemName]=F}w[N.name]=C}return w}static JTokenToListDefinitions(O){let w=O,N=[];for(let C in w)if(w.hasOwnProperty(C)){let S=C.toString(),F=w[C],K=new Map;for(let ot in F)if(w.hasOwnProperty(C)){let E=F[ot];K.set(ot,parseInt(E))}let it=new B.ListDefinition(S,K);N.push(it)}return new k.ListDefinitionsOrigin(N)}};r.JsonSerialisation=z,z._controlCommandNames=(()=>{let Q=[];Q[s.ControlCommand.CommandType.EvalStart]="ev",Q[s.ControlCommand.CommandType.EvalOutput]="out",Q[s.ControlCommand.CommandType.EvalEnd]="/ev",Q[s.ControlCommand.CommandType.Duplicate]="du",Q[s.ControlCommand.CommandType.PopEvaluatedValue]="pop",Q[s.ControlCommand.CommandType.PopFunction]="~ret",Q[s.ControlCommand.CommandType.PopTunnel]="->->",Q[s.ControlCommand.CommandType.BeginString]="str",Q[s.ControlCommand.CommandType.EndString]="/str",Q[s.ControlCommand.CommandType.NoOp]="nop",Q[s.ControlCommand.CommandType.ChoiceCount]="choiceCnt",Q[s.ControlCommand.CommandType.Turns]="turn",Q[s.ControlCommand.CommandType.TurnsSince]="turns",Q[s.ControlCommand.CommandType.ReadCount]="readc",Q[s.ControlCommand.CommandType.Random]="rnd",Q[s.ControlCommand.CommandType.SeedRandom]="srnd",Q[s.ControlCommand.CommandType.VisitIndex]="visit",Q[s.ControlCommand.CommandType.SequenceShuffleIndex]="seq",Q[s.ControlCommand.CommandType.StartThread]="thread",Q[s.ControlCommand.CommandType.Done]="done",Q[s.ControlCommand.CommandType.End]="end",Q[s.ControlCommand.CommandType.ListFromInt]="listInt",Q[s.ControlCommand.CommandType.ListRange]="range",Q[s.ControlCommand.CommandType.ListRandom]="lrnd",Q[s.ControlCommand.CommandType.BeginTag]="#",Q[s.ControlCommand.CommandType.EndTag]="/#";for(let O=0;O<s.ControlCommand.CommandType.TOTAL_VALUES;++O)if(Q[O]==null)throw new Error("Control command not accounted for in serialisation");return Q})()})),Eh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.CallStack=void 0;var u=Yi(),h=Me(),c=Ua(),s=za(),p=Jt(),m=Ui(),v=zl(),y=Bl(),A=Ia(),o=be(),T=class kl{get elements(){return this.callStack}get depth(){return this.elements.length}get currentElement(){let g=this._threads[this._threads.length-1].callstack;return g[g.length-1]}get currentElementIndex(){return this.callStack.length-1}get currentThread(){return this._threads[this._threads.length-1]}set currentThread(g){y.Debug.Assert(this._threads.length==1,"Shouldn't be directly setting the current thread when we have a stack of them"),this._threads.length=0,this._threads.push(g)}get canPop(){return this.callStack.length>1}constructor(){if(this._threadCounter=0,this._startOfRoot=v.Pointer.Null,arguments[0]instanceof c.Story){let g=arguments[0];this._startOfRoot=v.Pointer.StartOf(g.rootContentContainer),this.Reset()}else{let g=arguments[0];this._threads=[];for(let V of g._threads)this._threads.push(V.Copy());this._threadCounter=g._threadCounter,this._startOfRoot=g._startOfRoot.copy()}}Reset(){this._threads=[],this._threads.push(new kl.Thread),this._threads[0].callstack.push(new kl.Element(u.PushPopType.Tunnel,this._startOfRoot))}SetJsonToken(g,V){this._threads.length=0;let B=g.threads;for(let k of B){let M=k,j=new kl.Thread(M,V);this._threads.push(j)}this._threadCounter=parseInt(g.threadCounter),this._startOfRoot=v.Pointer.StartOf(V.rootContentContainer)}WriteJson(g){g.WriteObject(V=>{V.WritePropertyStart("threads"),V.WriteArrayStart();for(let B of this._threads)B.WriteJson(V);V.WriteArrayEnd(),V.WritePropertyEnd(),V.WritePropertyStart("threadCounter"),V.WriteInt(this._threadCounter),V.WritePropertyEnd()})}PushThread(){let g=this.currentThread.Copy();this._threadCounter++,g.threadIndex=this._threadCounter,this._threads.push(g)}ForkThread(){let g=this.currentThread.Copy();return this._threadCounter++,g.threadIndex=this._threadCounter,g}PopThread(){if(this.canPopThread)this._threads.splice(this._threads.indexOf(this.currentThread),1);else throw new Error("Can't pop thread")}get canPopThread(){return this._threads.length>1&&!this.elementIsEvaluateFromGame}get elementIsEvaluateFromGame(){return this.currentElement.type==u.PushPopType.FunctionEvaluationFromGame}Push(g,V=0,B=0){let k=new kl.Element(g,this.currentElement.currentPointer,!1);k.evaluationStackHeightWhenPushed=V,k.functionStartInOutputStream=B,this.callStack.push(k)}CanPop(g=null){return this.canPop?g==null?!0:this.currentElement.type==g:!1}Pop(g=null){if(this.CanPop(g)){this.callStack.pop();return}else throw new Error("Mismatched push/pop in Callstack")}GetTemporaryVariableWithName(g,V=-1){V==-1&&(V=this.currentElementIndex+1);let B=this.callStack[V-1],k=(0,A.tryGetValueFromMap)(B.temporaryVariables,g,null);return k.exists?k.result:null}SetTemporaryVariable(g,V,B,k=-1){k==-1&&(k=this.currentElementIndex+1);let M=this.callStack[k-1];if(!B&&!M.temporaryVariables.get(g))throw new Error("Could not find temporary variable to set: "+g);let j=(0,A.tryGetValueFromMap)(M.temporaryVariables,g,null);j.exists&&p.ListValue.RetainListOriginsForAssignment(j.result,V),M.temporaryVariables.set(g,V)}ContextForVariableNamed(g){return this.currentElement.temporaryVariables.get(g)?this.currentElementIndex+1:0}ThreadWithIndex(g){let V=this._threads.filter(B=>{if(B.threadIndex==g)return B});return V.length>0?V[0]:null}get callStack(){return this.currentThread.callstack}get callStackTrace(){let g=new m.StringBuilder;for(let V=0;V<this._threads.length;V++){let B=this._threads[V],k=V==this._threads.length-1;g.AppendFormat(`=== THREAD {0}/{1} {2}===
20
+ `,V+1,this._threads.length,k?"(current) ":"");for(let M=0;M<B.callstack.length;M++){B.callstack[M].type==u.PushPopType.Function?g.Append(" [FUNCTION] "):g.Append(" [TUNNEL] ");let j=B.callstack[M].currentPointer;if(!j.isNull){if(g.Append("<SOMEWHERE IN "),j.container===null)return(0,o.throwNullException)("pointer.container");g.Append(j.container.path.toString()),g.AppendLine(">")}}}return g.toString()}};r.CallStack=T,(function(f){class g{constructor(k,M,j=!1){this.evaluationStackHeightWhenPushed=0,this.functionStartInOutputStream=0,this.currentPointer=M.copy(),this.inExpressionEvaluation=j,this.temporaryVariables=new Map,this.type=k}Copy(){let k=new g(this.type,this.currentPointer,this.inExpressionEvaluation);return k.temporaryVariables=new Map(this.temporaryVariables),k.evaluationStackHeightWhenPushed=this.evaluationStackHeightWhenPushed,k.functionStartInOutputStream=this.functionStartInOutputStream,k}}f.Element=g;class V{constructor(){if(this.threadIndex=0,this.previousPointer=v.Pointer.Null,this.callstack=[],arguments[0]&&arguments[1]){let k=arguments[0],M=arguments[1];this.threadIndex=parseInt(k.threadIndex);let j=k.callstack;for(let z of j){let Q=z,O=parseInt(Q.type),w=v.Pointer.Null,N,C=Q.cPath;if(typeof C<"u"){N=C.toString();let K=M.ContentAtPath(new h.Path(N));if(w.container=K.container,w.index=parseInt(Q.idx),K.obj==null)throw new Error("When loading state, internal story location couldn't be found: "+N+". Has the story changed since this save data was created?");K.approximate&&(w.container!==null?M.Warning("When loading state, exact internal story location couldn't be found: '"+N+"', so it was approximated to '"+w.container.path.toString()+"' to recover. Has the story changed since this save data was created?"):M.Warning("When loading state, exact internal story location couldn't be found: '"+N+"' and it may not be recoverable. Has the story changed since this save data was created?"))}let S=new g(O,w,!!Q.exp),F=Q.temp;typeof F<"u"?S.temporaryVariables=s.JsonSerialisation.JObjectToDictionaryRuntimeObjs(F):S.temporaryVariables.clear(),this.callstack.push(S)}let q=k.previousContentObject;if(typeof q<"u"){let z=new h.Path(q.toString());this.previousPointer=M.PointerAtPath(z)}}}Copy(){let k=new V;k.threadIndex=this.threadIndex;for(let M of this.callstack)k.callstack.push(M.Copy());return k.previousPointer=this.previousPointer.copy(),k}WriteJson(k){k.WriteObjectStart(),k.WritePropertyStart("callstack"),k.WriteArrayStart();for(let M of this.callstack){if(k.WriteObjectStart(),!M.currentPointer.isNull){if(M.currentPointer.container===null)return(0,o.throwNullException)("el.currentPointer.container");k.WriteProperty("cPath",M.currentPointer.container.path.componentsString),k.WriteIntProperty("idx",M.currentPointer.index)}k.WriteProperty("exp",M.inExpressionEvaluation),k.WriteIntProperty("type",M.type),M.temporaryVariables.size>0&&(k.WritePropertyStart("temp"),s.JsonSerialisation.WriteDictionaryRuntimeObjs(k,M.temporaryVariables),k.WritePropertyEnd()),k.WriteObjectEnd()}if(k.WriteArrayEnd(),k.WritePropertyEnd(),k.WriteIntProperty("threadIndex",this.threadIndex),!this.previousPointer.isNull){let M=this.previousPointer.Resolve();if(M===null)return(0,o.throwNullException)("this.previousPointer.Resolve()");k.WriteProperty("previousContentObject",M.path.toString())}k.WriteObjectEnd()}}f.Thread=V})(T||(r.CallStack=T={}))})),_v=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.VariablesState=void 0;var u=Jt(),h=Gl(),c=za(),s=Bt(),p=Ia(),m=be();function v(){return class{}}var y=class Ym extends v(){variableChangedEvent(o,T){for(let f of this.variableChangedEventCallbacks)f(o,T)}StartVariableObservation(){this._batchObservingVariableChanges=!0,this._changedVariablesForBatchObs=new Set}CompleteVariableObservation(){this._batchObservingVariableChanges=!1;let o=new Map;if(this._changedVariablesForBatchObs!=null)for(let T of this._changedVariablesForBatchObs){let f=this._globalVariables.get(T);this.variableChangedEvent(T,f)}if(this.patch!=null)for(let T of this.patch.changedVariables){let f=this.patch.TryGetGlobal(T,null);f.exists&&o.set(T,f)}return this._changedVariablesForBatchObs=null,o}NotifyObservers(o){for(const[T,f]of o)this.variableChangedEvent(T,f)}get callStack(){return this._callStack}set callStack(o){this._callStack=o}$(o,T){if(typeof T>"u"){let f=null;return this.patch!==null&&(f=this.patch.TryGetGlobal(o,null),f.exists)?f.result.valueObject:(f=this._globalVariables.get(o),typeof f>"u"&&(f=this._defaultGlobalVariables.get(o)),typeof f<"u"?f.valueObject:null)}else{if(typeof this._defaultGlobalVariables.get(o)>"u")throw new h.StoryException("Cannot assign to a variable ("+o+") that hasn't been declared in the story");let f=u.Value.Create(T);if(f==null)throw T==null?new Error("Cannot pass null to VariableState"):new Error("Invalid value passed to VariableState: "+T.toString());this.SetGlobal(o,f)}}constructor(o,T){super(),this.variableChangedEventCallbacks=[],this.patch=null,this._defaultGlobalVariables=new Map,this._changedVariablesForBatchObs=new Set,this._batchObservingVariableChanges=!1,this._globalVariables=new Map,this._callStack=o,this._listDefsOrigin=T;try{return new Proxy(this,{get(f,g){return g in f?f[g]:f.$(g)},set(f,g,V){return g in f?f[g]=V:f.$(g,V),!0},ownKeys(f){return[...new Set([...f._defaultGlobalVariables.keys(),...f._globalVariables.keys()])]},getOwnPropertyDescriptor(f,g){return{enumerable:!0,configurable:!0,value:f.$(g)}}})}catch{}}ApplyPatch(){if(this.patch===null)return(0,m.throwNullException)("this.patch");for(let[o,T]of this.patch.globals)this._globalVariables.set(o,T);if(this._changedVariablesForBatchObs!==null)for(let o of this.patch.changedVariables)this._changedVariablesForBatchObs.add(o);this.patch=null}SetJsonToken(o){this._globalVariables.clear();for(let[T,f]of this._defaultGlobalVariables){let g=o[T];if(typeof g<"u"){let V=c.JsonSerialisation.JTokenToRuntimeObject(g);if(V===null)return(0,m.throwNullException)("tokenInkObject");this._globalVariables.set(T,V)}else this._globalVariables.set(T,f)}}WriteJson(o){o.WriteObjectStart();for(let[T,f]of this._globalVariables){let g=T,V=f;if(Ym.dontSaveDefaultValues&&this._defaultGlobalVariables.has(g)){let B=this._defaultGlobalVariables.get(g);if(this.RuntimeObjectsEqual(V,B))continue}o.WritePropertyStart(g),c.JsonSerialisation.WriteRuntimeObject(o,V),o.WritePropertyEnd()}o.WriteObjectEnd()}RuntimeObjectsEqual(o,T){if(o===null)return(0,m.throwNullException)("obj1");if(T===null)return(0,m.throwNullException)("obj2");if(o.constructor!==T.constructor)return!1;let f=(0,s.asOrNull)(o,u.BoolValue);if(f!==null)return f.value===(0,s.asOrThrows)(T,u.BoolValue).value;let g=(0,s.asOrNull)(o,u.IntValue);if(g!==null)return g.value===(0,s.asOrThrows)(T,u.IntValue).value;let V=(0,s.asOrNull)(o,u.FloatValue);if(V!==null)return V.value===(0,s.asOrThrows)(T,u.FloatValue).value;let B=(0,s.asOrNull)(o,u.Value),k=(0,s.asOrNull)(T,u.Value);if(B!==null&&k!==null)return(0,s.isEquatable)(B.valueObject)&&(0,s.isEquatable)(k.valueObject)?B.valueObject.Equals(k.valueObject):B.valueObject===k.valueObject;throw new Error("FastRoughDefinitelyEquals: Unsupported runtime object type: "+o.constructor.name)}GetVariableWithName(o,T=-1){let f=this.GetRawVariableWithName(o,T),g=(0,s.asOrNull)(f,u.VariablePointerValue);return g!==null&&(f=this.ValueAtVariablePointer(g)),f}TryGetDefaultVariableValue(o){let T=(0,p.tryGetValueFromMap)(this._defaultGlobalVariables,o,null);return T.exists?T.result:null}GlobalVariableExistsWithName(o){return this._globalVariables.has(o)||this._defaultGlobalVariables!==null&&this._defaultGlobalVariables.has(o)}GetRawVariableWithName(o,T){let f=null;if(T==0||T==-1){let g=null;if(this.patch!==null&&(g=this.patch.TryGetGlobal(o,null),g.exists)||(g=(0,p.tryGetValueFromMap)(this._globalVariables,o,null),g.exists)||this._defaultGlobalVariables!==null&&(g=(0,p.tryGetValueFromMap)(this._defaultGlobalVariables,o,null),g.exists))return g.result;if(this._listDefsOrigin===null)return(0,m.throwNullException)("VariablesState._listDefsOrigin");let V=this._listDefsOrigin.FindSingleItemListWithName(o);if(V)return V}return f=this._callStack.GetTemporaryVariableWithName(o,T),f}ValueAtVariablePointer(o){return this.GetVariableWithName(o.variableName,o.contextIndex)}Assign(o,T){let f=o.variableName;if(f===null)return(0,m.throwNullException)("name");let g=-1,V=!1;if(o.isNewDeclaration?V=o.isGlobal:V=this.GlobalVariableExistsWithName(f),o.isNewDeclaration){let B=(0,s.asOrNull)(T,u.VariablePointerValue);B!==null&&(T=this.ResolveVariablePointer(B))}else{let B=null;do B=(0,s.asOrNull)(this.GetRawVariableWithName(f,g),u.VariablePointerValue),B!=null&&(f=B.variableName,g=B.contextIndex,V=g==0);while(B!=null)}V?this.SetGlobal(f,T):this._callStack.SetTemporaryVariable(f,T,o.isNewDeclaration,g)}SnapshotDefaultGlobals(){this._defaultGlobalVariables=new Map(this._globalVariables)}RetainListOriginsForAssignment(o,T){let f=(0,s.asOrThrows)(o,u.ListValue),g=(0,s.asOrThrows)(T,u.ListValue);f.value&&g.value&&g.value.Count==0&&g.value.SetInitialOriginNames(f.value.originNames)}SetGlobal(o,T){let f=null;if(this.patch===null&&(f=(0,p.tryGetValueFromMap)(this._globalVariables,o,null)),this.patch!==null&&(f=this.patch.TryGetGlobal(o,null),f.exists||(f=(0,p.tryGetValueFromMap)(this._globalVariables,o,null))),u.ListValue.RetainListOriginsForAssignment(f.result,T),o===null)return(0,m.throwNullException)("variableName");if(this.patch!==null?this.patch.SetGlobal(o,T):this._globalVariables.set(o,T),this.variableChangedEvent!==null&&f!==null&&T!==f.result)if(this._batchObservingVariableChanges){if(this._changedVariablesForBatchObs===null)return(0,m.throwNullException)("this._changedVariablesForBatchObs");this.patch!==null?this.patch.AddChangedVariable(o):this._changedVariablesForBatchObs!==null&&this._changedVariablesForBatchObs.add(o)}else this.variableChangedEvent(o,T)}ResolveVariablePointer(o){let T=o.contextIndex;T==-1&&(T=this.GetContextIndexOfVariableNamed(o.variableName));let f=this.GetRawVariableWithName(o.variableName,T),g=(0,s.asOrNull)(f,u.VariablePointerValue);return g??new u.VariablePointerValue(o.variableName,T)}GetContextIndexOfVariableNamed(o){return this.GlobalVariableExistsWithName(o)?0:this._callStack.currentElementIndex}ObserveVariableChange(o){this.variableChangedEventCallbacks.push(o)}};r.VariablesState=y,y.dontSaveDefaultValues=!0})),Th=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.PRNG=void 0;var u=class{constructor(h){this.seed=h%2147483647,this.seed<=0&&(this.seed+=2147483646)}next(){return this.seed=this.seed*48271%2147483647}nextFloat(){return(this.next()-1)/2147483646}};r.PRNG=u})),bv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.StatePatch=void 0;var u=class{get globals(){return this._globals}get changedVariables(){return this._changedVariables}get visitCounts(){return this._visitCounts}get turnIndices(){return this._turnIndices}constructor(){if(this._changedVariables=new Set,this._visitCounts=new Map,this._turnIndices=new Map,arguments.length===1&&arguments[0]!==null){let h=arguments[0];this._globals=new Map(h._globals),this._changedVariables=new Set(h._changedVariables),this._visitCounts=new Map(h._visitCounts),this._turnIndices=new Map(h._turnIndices)}else this._globals=new Map,this._changedVariables=new Set,this._visitCounts=new Map,this._turnIndices=new Map}TryGetGlobal(h,c){return h!==null&&this._globals.has(h)?{result:this._globals.get(h),exists:!0}:{result:c,exists:!1}}SetGlobal(h,c){this._globals.set(h,c)}AddChangedVariable(h){return this._changedVariables.add(h)}TryGetVisitCount(h,c){return this._visitCounts.has(h)?{result:this._visitCounts.get(h),exists:!0}:{result:c,exists:!1}}SetVisitCount(h,c){this._visitCounts.set(h,c)}SetTurnIndex(h,c){this._turnIndices.set(h,c)}TryGetTurnIndex(h,c){return this._turnIndices.has(h)?{result:this._turnIndices.get(h),exists:!0}:{result:c,exists:!1}}};r.StatePatch=u})),Oh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.SimpleJson=void 0;var u=class eh{static TextToDictionary(c){return new eh.Reader(c).ToDictionary()}static TextToArray(c){return new eh.Reader(c).ToArray()}};r.SimpleJson=u,(function(h){class c{constructor(m){if(JSON.parse("0",(v,y,A)=>A!=null)){const v=(y,A,o)=>Number.isInteger(A)&&o.source.endsWith(".0")?o.source+"f":A;this._rootObject=JSON.parse(m,v)}else{const v=m.replace(/(,\s*)([0-9]+\.[0]+)([,]*)/g,'$1"$2f"$3');this._rootObject=JSON.parse(v)}}ToDictionary(){return this._rootObject}ToArray(){return this._rootObject}}h.Reader=c;class s{constructor(){this._currentPropertyName=null,this._currentString=null,this._stateStack=[],this._collectionStack=[],this._propertyNameStack=[],this._jsonObject=null}WriteObject(m){this.WriteObjectStart(),m(this),this.WriteObjectEnd()}WriteObjectStart(){this.StartNewObject(!0);let m={};if(this.state===h.Writer.State.Property){this.Assert(this.currentCollection!==null),this.Assert(this.currentPropertyName!==null);let v=this._propertyNameStack.pop();this.currentCollection[v]=m,this._collectionStack.push(m)}else this.state===h.Writer.State.Array?(this.Assert(this.currentCollection!==null),this.currentCollection.push(m),this._collectionStack.push(m)):(this.Assert(this.state===h.Writer.State.None),this._jsonObject=m,this._collectionStack.push(m));this._stateStack.push(new h.Writer.StateElement(h.Writer.State.Object))}WriteObjectEnd(){this.Assert(this.state===h.Writer.State.Object),this._collectionStack.pop(),this._stateStack.pop()}WriteProperty(m,v){if(this.WritePropertyStart(m),arguments[1]instanceof Function){let y=arguments[1];y(this)}else{let y=arguments[1];this.Write(y)}this.WritePropertyEnd()}WriteIntProperty(m,v){this.WritePropertyStart(m),this.WriteInt(v),this.WritePropertyEnd()}WriteFloatProperty(m,v){this.WritePropertyStart(m),this.WriteFloat(v),this.WritePropertyEnd()}WritePropertyStart(m){this.Assert(this.state===h.Writer.State.Object),this._propertyNameStack.push(m),this.IncrementChildCount(),this._stateStack.push(new h.Writer.StateElement(h.Writer.State.Property))}WritePropertyEnd(){this.Assert(this.state===h.Writer.State.Property),this.Assert(this.childCount===1),this._stateStack.pop()}WritePropertyNameStart(){this.Assert(this.state===h.Writer.State.Object),this.IncrementChildCount(),this._currentPropertyName="",this._stateStack.push(new h.Writer.StateElement(h.Writer.State.Property)),this._stateStack.push(new h.Writer.StateElement(h.Writer.State.PropertyName))}WritePropertyNameEnd(){this.Assert(this.state===h.Writer.State.PropertyName),this.Assert(this._currentPropertyName!==null),this._propertyNameStack.push(this._currentPropertyName),this._currentPropertyName=null,this._stateStack.pop()}WritePropertyNameInner(m){this.Assert(this.state===h.Writer.State.PropertyName),this.Assert(this._currentPropertyName!==null),this._currentPropertyName+=m}WriteArrayStart(){this.StartNewObject(!0);let m=[];if(this.state===h.Writer.State.Property){this.Assert(this.currentCollection!==null),this.Assert(this.currentPropertyName!==null);let v=this._propertyNameStack.pop();this.currentCollection[v]=m,this._collectionStack.push(m)}else this.state===h.Writer.State.Array?(this.Assert(this.currentCollection!==null),this.currentCollection.push(m),this._collectionStack.push(m)):(this.Assert(this.state===h.Writer.State.None),this._jsonObject=m,this._collectionStack.push(m));this._stateStack.push(new h.Writer.StateElement(h.Writer.State.Array))}WriteArrayEnd(){this.Assert(this.state===h.Writer.State.Array),this._collectionStack.pop(),this._stateStack.pop()}Write(m,v=!0){if(m===null){console.error("Warning: trying to write a null value");return}this.StartNewObject(!1),this._addToCurrentObject(m)}WriteBool(m){m!==null&&(this.StartNewObject(!1),this._addToCurrentObject(m))}WriteInt(m){m!==null&&(this.StartNewObject(!1),this._addToCurrentObject(Math.floor(m)))}WriteFloat(m){m!==null&&(this.StartNewObject(!1),m==Number.POSITIVE_INFINITY?this._addToCurrentObject(34e37):m==Number.NEGATIVE_INFINITY?this._addToCurrentObject(-34e37):isNaN(m)?this._addToCurrentObject(0):this._addToCurrentObject(m))}WriteNull(){this.StartNewObject(!1),this._addToCurrentObject(null)}WriteStringStart(){this.StartNewObject(!1),this._currentString="",this._stateStack.push(new h.Writer.StateElement(h.Writer.State.String))}WriteStringEnd(){this.Assert(this.state==h.Writer.State.String),this._stateStack.pop(),this._addToCurrentObject(this._currentString),this._currentString=null}WriteStringInner(m,v=!0){if(this.Assert(this.state===h.Writer.State.String),m===null){console.error("Warning: trying to write a null string");return}this._currentString+=m}toString(){return this._jsonObject===null?"":JSON.stringify(this._jsonObject)}StartNewObject(m){m?this.Assert(this.state===h.Writer.State.None||this.state===h.Writer.State.Property||this.state===h.Writer.State.Array):this.Assert(this.state===h.Writer.State.Property||this.state===h.Writer.State.Array),this.state===h.Writer.State.Property&&this.Assert(this.childCount===0),(this.state===h.Writer.State.Array||this.state===h.Writer.State.Property)&&this.IncrementChildCount()}get state(){return this._stateStack.length>0?this._stateStack[this._stateStack.length-1].type:h.Writer.State.None}get childCount(){return this._stateStack.length>0?this._stateStack[this._stateStack.length-1].childCount:0}get currentCollection(){return this._collectionStack.length>0?this._collectionStack[this._collectionStack.length-1]:null}get currentPropertyName(){return this._propertyNameStack.length>0?this._propertyNameStack[this._propertyNameStack.length-1]:null}IncrementChildCount(){this.Assert(this._stateStack.length>0);let m=this._stateStack.pop();m.childCount++,this._stateStack.push(m)}Assert(m){if(!m)throw Error("Assert failed while writing JSON")}_addToCurrentObject(m){this.Assert(this.currentCollection!==null),this.state===h.Writer.State.Array?(this.Assert(Array.isArray(this.currentCollection)),this.currentCollection.push(m)):this.state===h.Writer.State.Property&&(this.Assert(!Array.isArray(this.currentCollection)),this.Assert(this.currentPropertyName!==null),this.currentCollection[this.currentPropertyName]=m,this._propertyNameStack.pop())}}h.Writer=s,(function(p){(function(v){v[v.None=0]="None",v[v.Object=1]="Object",v[v.Array=2]="Array",v[v.Property=3]="Property",v[v.PropertyName=4]="PropertyName",v[v.String=5]="String"})(p.State||(p.State={}));class m{constructor(y){this.type=h.Writer.State.None,this.childCount=0,this.type=y}}p.StateElement=m})(s=h.Writer||(h.Writer={}))})(u||(r.SimpleJson=u={}))})),Ev=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Flow=void 0;var u=Eh(),h=za(),c=be(),s=class{constructor(){let p=arguments[0],m=arguments[1];if(this.name=p,this.callStack=new u.CallStack(m),arguments[2]){let v=arguments[2];this.callStack.SetJsonToken(v.callstack,m),this.outputStream=h.JsonSerialisation.JArrayToRuntimeObjList(v.outputStream),this.currentChoices=h.JsonSerialisation.JArrayToRuntimeObjList(v.currentChoices);let y=v.choiceThreads;typeof y<"u"&&this.LoadFlowChoiceThreads(y,m)}else this.outputStream=[],this.currentChoices=[]}WriteJson(p){p.WriteObjectStart(),p.WriteProperty("callstack",v=>this.callStack.WriteJson(v)),p.WriteProperty("outputStream",v=>h.JsonSerialisation.WriteListRuntimeObjs(v,this.outputStream));let m=!1;for(let v of this.currentChoices){if(v.threadAtGeneration===null)return(0,c.throwNullException)("c.threadAtGeneration");v.originalThreadIndex=v.threadAtGeneration.threadIndex,this.callStack.ThreadWithIndex(v.originalThreadIndex)===null&&(m||(m=!0,p.WritePropertyStart("choiceThreads"),p.WriteObjectStart()),p.WritePropertyStart(v.originalThreadIndex),v.threadAtGeneration.WriteJson(p),p.WritePropertyEnd())}m&&(p.WriteObjectEnd(),p.WritePropertyEnd()),p.WriteProperty("currentChoices",v=>{v.WriteArrayStart();for(let y of this.currentChoices)h.JsonSerialisation.WriteChoice(v,y);v.WriteArrayEnd()}),p.WriteObjectEnd()}LoadFlowChoiceThreads(p,m){for(let v of this.currentChoices){let y=this.callStack.ThreadWithIndex(v.originalThreadIndex);if(y!==null)v.threadAtGeneration=y.Copy();else{let A=p[`${v.originalThreadIndex}`];v.threadAtGeneration=new u.CallStack.Thread(A,m)}}}};r.Flow=s})),Tv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.StoryState=void 0;var u=Eh(),h=_v(),c=Jt(),s=Yi(),p=xs(),m=ws(),v=Me(),y=Ee(),A=Ui(),o=za(),T=Th(),f=Hi(),g=zl(),V=Ia(),B=Bt(),k=Bl(),M=be(),j=Ua(),q=bv(),z=Oh(),Q=Ev(),O=Ie(),w=class Km{ToJson(C=!1){let S=new z.SimpleJson.Writer;return this.WriteJson(S),S.toString()}toJson(C=!1){return this.ToJson(C)}LoadJson(C){let S=z.SimpleJson.TextToDictionary(C);this.LoadJsonObj(S),this.onDidLoadState!==null&&this.onDidLoadState()}VisitCountAtPathString(C){let S;if(this._patch!==null){let F=this.story.ContentAtPath(new v.Path(C)).container;if(F===null)throw new Error("Content at path not found: "+C);if(S=this._patch.TryGetVisitCount(F,0),S.exists)return S.result}return S=(0,V.tryGetValueFromMap)(this._visitCounts,C,null),S.exists?S.result:0}VisitCountForContainer(C){if(C===null)return(0,M.throwNullException)("container");if(!C.visitsShouldBeCounted)return this.story.Error("Read count for target ("+C.name+" - on "+C.debugMetadata+") unknown. The story may need to be compiled with countAllVisits flag (-c)."),0;if(this._patch!==null){let K=this._patch.TryGetVisitCount(C,0);if(K.exists)return K.result}let S=C.path.toString(),F=(0,V.tryGetValueFromMap)(this._visitCounts,S,null);return F.exists?F.result:0}IncrementVisitCountForContainer(C){if(this._patch!==null){let K=this.VisitCountForContainer(C);K++,this._patch.SetVisitCount(C,K);return}let S=C.path.toString(),F=(0,V.tryGetValueFromMap)(this._visitCounts,S,null);F.exists?this._visitCounts.set(S,F.result+1):this._visitCounts.set(S,1)}RecordTurnIndexVisitToContainer(C){if(this._patch!==null){this._patch.SetTurnIndex(C,this.currentTurnIndex);return}let S=C.path.toString();this._turnIndices.set(S,this.currentTurnIndex)}TurnsSinceForContainer(C){if(C.turnIndexShouldBeCounted||this.story.Error("TURNS_SINCE() for target ("+C.name+" - on "+C.debugMetadata+") unknown. The story may need to be compiled with countAllVisits flag (-c)."),this._patch!==null){let K=this._patch.TryGetTurnIndex(C,0);if(K.exists)return this.currentTurnIndex-K.result}let S=C.path.toString(),F=(0,V.tryGetValueFromMap)(this._turnIndices,S,0);return F.exists?this.currentTurnIndex-F.result:-1}get callstackDepth(){return this.callStack.depth}get outputStream(){return this._currentFlow.outputStream}get currentChoices(){return this.canContinue?[]:this._currentFlow.currentChoices}get generatedChoices(){return this._currentFlow.currentChoices}get currentErrors(){return this._currentErrors}get currentWarnings(){return this._currentWarnings}get variablesState(){return this._variablesState}set variablesState(C){this._variablesState=C}get callStack(){return this._currentFlow.callStack}get evaluationStack(){return this._evaluationStack}get currentTurnIndex(){return this._currentTurnIndex}set currentTurnIndex(C){this._currentTurnIndex=C}get currentPathString(){let C=this.currentPointer;return C.isNull?null:C.path===null?(0,M.throwNullException)("pointer.path"):C.path.toString()}get previousPathString(){let C=this.previousPointer;return C.isNull?null:C.path===null?(0,M.throwNullException)("previousPointer.path"):C.path.toString()}get currentPointer(){return this.callStack.currentElement.currentPointer.copy()}set currentPointer(C){this.callStack.currentElement.currentPointer=C.copy()}get previousPointer(){return this.callStack.currentThread.previousPointer.copy()}set previousPointer(C){this.callStack.currentThread.previousPointer=C.copy()}get canContinue(){return!this.currentPointer.isNull&&!this.hasError}get hasError(){return this.currentErrors!=null&&this.currentErrors.length>0}get hasWarning(){return this.currentWarnings!=null&&this.currentWarnings.length>0}get currentText(){if(this._outputStreamTextDirty){let C=new A.StringBuilder,S=!1;for(let F of this.outputStream){let K=(0,B.asOrNull)(F,c.StringValue);if(!S&&K!==null)C.Append(K.value);else{let it=(0,B.asOrNull)(F,y.ControlCommand);it!==null&&(it.commandType==y.ControlCommand.CommandType.BeginTag?S=!0:it.commandType==y.ControlCommand.CommandType.EndTag&&(S=!1))}}this._currentText=this.CleanOutputWhitespace(C.toString()),this._outputStreamTextDirty=!1}return this._currentText}CleanOutputWhitespace(C){let S=new A.StringBuilder,F=-1,K=0;for(let it=0;it<C.length;it++){let ot=C.charAt(it),E=ot==" "||ot==" ";E&&F==-1&&(F=it),E||(ot!=`
21
+ `&&F>0&&F!=K&&S.Append(" "),F=-1),ot==`
22
+ `&&(K=it+1),E||S.Append(ot)}return S.toString()}get currentTags(){if(this._outputStreamTagsDirty){this._currentTags=[];let C=!1,S=new A.StringBuilder;for(let F of this.outputStream){let K=(0,B.asOrNull)(F,y.ControlCommand);if(K!=null){if(K.commandType==y.ControlCommand.CommandType.BeginTag){if(C&&S.Length>0){let it=this.CleanOutputWhitespace(S.toString());this._currentTags.push(it),S.Clear()}C=!0}else if(K.commandType==y.ControlCommand.CommandType.EndTag){if(S.Length>0){let it=this.CleanOutputWhitespace(S.toString());this._currentTags.push(it),S.Clear()}C=!1}}else if(C){let it=(0,B.asOrNull)(F,c.StringValue);it!==null&&S.Append(it.value)}else{let it=(0,B.asOrNull)(F,p.Tag);it!=null&&it.text!=null&&it.text.length>0&&this._currentTags.push(it.text)}}if(S.Length>0){let F=this.CleanOutputWhitespace(S.toString());this._currentTags.push(F),S.Clear()}this._outputStreamTagsDirty=!1}return this._currentTags}get currentFlowName(){return this._currentFlow.name}get currentFlowIsDefaultFlow(){return this._currentFlow.name==this.kDefaultFlowName}get aliveFlowNames(){if(this._aliveFlowNamesDirty){if(this._aliveFlowNames=[],this._namedFlows!=null)for(let C of this._namedFlows.keys())C!=this.kDefaultFlowName&&this._aliveFlowNames.push(C);this._aliveFlowNamesDirty=!1}return this._aliveFlowNames}get inExpressionEvaluation(){return this.callStack.currentElement.inExpressionEvaluation}set inExpressionEvaluation(C){this.callStack.currentElement.inExpressionEvaluation=C}constructor(C){this.kInkSaveStateVersion=10,this.kMinCompatibleLoadVersion=8,this.onDidLoadState=null,this._currentErrors=null,this._currentWarnings=null,this.divertedPointer=g.Pointer.Null,this._currentTurnIndex=0,this.storySeed=0,this.previousRandom=0,this.didSafeExit=!1,this._currentText=null,this._currentTags=null,this._outputStreamTextDirty=!0,this._outputStreamTagsDirty=!0,this._patch=null,this._aliveFlowNames=null,this._namedFlows=null,this.kDefaultFlowName="DEFAULT_FLOW",this._aliveFlowNamesDirty=!0,this.story=C,this._currentFlow=new Q.Flow(this.kDefaultFlowName,C),this.OutputStreamDirty(),this._aliveFlowNamesDirty=!0,this._evaluationStack=[],this._variablesState=new h.VariablesState(this.callStack,C.listDefinitions),this._visitCounts=new Map,this._turnIndices=new Map,this.currentTurnIndex=-1;let S=new Date().getTime();this.storySeed=new T.PRNG(S).next()%100,this.previousRandom=0,this.GoToStart()}GoToStart(){this.callStack.currentElement.currentPointer=g.Pointer.StartOf(this.story.mainContentContainer)}SwitchFlow_Internal(C){if(C===null)throw new Error("Must pass a non-null string to Story.SwitchFlow");if(this._namedFlows===null&&(this._namedFlows=new Map,this._namedFlows.set(this.kDefaultFlowName,this._currentFlow)),C===this._currentFlow.name)return;let S,F=(0,V.tryGetValueFromMap)(this._namedFlows,C,null);F.exists?S=F.result:(S=new Q.Flow(C,this.story),this._namedFlows.set(C,S),this._aliveFlowNamesDirty=!0),this._currentFlow=S,this.variablesState.callStack=this._currentFlow.callStack,this.OutputStreamDirty()}SwitchToDefaultFlow_Internal(){this._namedFlows!==null&&this.SwitchFlow_Internal(this.kDefaultFlowName)}RemoveFlow_Internal(C){if(C===null)throw new Error("Must pass a non-null string to Story.DestroyFlow");if(C===this.kDefaultFlowName)throw new Error("Cannot destroy default flow");if(this._currentFlow.name===C&&this.SwitchToDefaultFlow_Internal(),this._namedFlows===null)return(0,M.throwNullException)("this._namedFlows");this._namedFlows.delete(C),this._aliveFlowNamesDirty=!0}CopyAndStartPatching(C){let S=new Km(this.story);if(S._patch=new q.StatePatch(this._patch),S._currentFlow.name=this._currentFlow.name,S._currentFlow.callStack=new u.CallStack(this._currentFlow.callStack),S._currentFlow.outputStream.push(...this._currentFlow.outputStream),S.OutputStreamDirty(),C)for(let F of this._currentFlow.currentChoices)S._currentFlow.currentChoices.push(F.Clone());else S._currentFlow.currentChoices.push(...this._currentFlow.currentChoices);if(this._namedFlows!==null){S._namedFlows=new Map;for(let[F,K]of this._namedFlows)S._namedFlows.set(F,K),S._aliveFlowNamesDirty=!0;S._namedFlows.set(this._currentFlow.name,S._currentFlow)}return this.hasError&&(S._currentErrors=[],S._currentErrors.push(...this.currentErrors||[])),this.hasWarning&&(S._currentWarnings=[],S._currentWarnings.push(...this.currentWarnings||[])),S.variablesState=this.variablesState,S.variablesState.callStack=S.callStack,S.variablesState.patch=S._patch,S.evaluationStack.push(...this.evaluationStack),this.divertedPointer.isNull||(S.divertedPointer=this.divertedPointer.copy()),S.previousPointer=this.previousPointer.copy(),S._visitCounts=this._visitCounts,S._turnIndices=this._turnIndices,S.currentTurnIndex=this.currentTurnIndex,S.storySeed=this.storySeed,S.previousRandom=this.previousRandom,S.didSafeExit=this.didSafeExit,S}RestoreAfterPatch(){this.variablesState.callStack=this.callStack,this.variablesState.patch=this._patch}ApplyAnyPatch(){if(this._patch!==null){this.variablesState.ApplyPatch();for(let[C,S]of this._patch.visitCounts)this.ApplyCountChanges(C,S,!0);for(let[C,S]of this._patch.turnIndices)this.ApplyCountChanges(C,S,!1);this._patch=null}}ApplyCountChanges(C,S,F){(F?this._visitCounts:this._turnIndices).set(C.path.toString(),S)}WriteJson(C){if(C.WriteObjectStart(),C.WritePropertyStart("flows"),C.WriteObjectStart(),this._namedFlows!==null)for(let[S,F]of this._namedFlows)C.WriteProperty(S,K=>F.WriteJson(K));else C.WriteProperty(this._currentFlow.name,S=>this._currentFlow.WriteJson(S));if(C.WriteObjectEnd(),C.WritePropertyEnd(),C.WriteProperty("currentFlowName",this._currentFlow.name),C.WriteProperty("variablesState",S=>this.variablesState.WriteJson(S)),C.WriteProperty("evalStack",S=>o.JsonSerialisation.WriteListRuntimeObjs(S,this.evaluationStack)),!this.divertedPointer.isNull){if(this.divertedPointer.path===null)return(0,M.throwNullException)("divertedPointer");C.WriteProperty("currentDivertTarget",this.divertedPointer.path.componentsString)}C.WriteProperty("visitCounts",S=>o.JsonSerialisation.WriteIntDictionary(S,this._visitCounts)),C.WriteProperty("turnIndices",S=>o.JsonSerialisation.WriteIntDictionary(S,this._turnIndices)),C.WriteIntProperty("turnIdx",this.currentTurnIndex),C.WriteIntProperty("storySeed",this.storySeed),C.WriteIntProperty("previousRandom",this.previousRandom),C.WriteIntProperty("inkSaveVersion",this.kInkSaveStateVersion),C.WriteIntProperty("inkFormatVersion",j.Story.inkVersionCurrent),C.WriteObjectEnd()}LoadJsonObj(C){let S=C,F=S.inkSaveVersion;if(F==null)throw new Error("ink save format incorrect, can't load.");if(parseInt(F)<this.kMinCompatibleLoadVersion)throw new Error("Ink save format isn't compatible with the current version (saw '"+F+"', but minimum is "+this.kMinCompatibleLoadVersion+"), so can't load.");let K=S.flows;if(K!=null){let ot=K;Object.keys(ot).length===1?this._namedFlows=null:this._namedFlows===null?this._namedFlows=new Map:this._namedFlows.clear();let E=Object.entries(ot);for(let[x,D]of E){let R=x,Z=D,tt=new Q.Flow(R,this.story,Z);if(Object.keys(ot).length===1)this._currentFlow=new Q.Flow(R,this.story,Z);else{if(this._namedFlows===null)return(0,M.throwNullException)("this._namedFlows");this._namedFlows.set(R,tt)}}if(this._namedFlows!=null&&this._namedFlows.size>1){let x=S.currentFlowName;this._currentFlow=this._namedFlows.get(x)}}else{this._namedFlows=null,this._currentFlow.name=this.kDefaultFlowName,this._currentFlow.callStack.SetJsonToken(S.callstackThreads,this.story),this._currentFlow.outputStream=o.JsonSerialisation.JArrayToRuntimeObjList(S.outputStream),this._currentFlow.currentChoices=o.JsonSerialisation.JArrayToRuntimeObjList(S.currentChoices);let ot=S.choiceThreads;this._currentFlow.LoadFlowChoiceThreads(ot,this.story)}this.OutputStreamDirty(),this._aliveFlowNamesDirty=!0,this.variablesState.SetJsonToken(S.variablesState),this.variablesState.callStack=this._currentFlow.callStack,this._evaluationStack=o.JsonSerialisation.JArrayToRuntimeObjList(S.evalStack);let it=S.currentDivertTarget;if(it!=null){let ot=new v.Path(it.toString());this.divertedPointer=this.story.PointerAtPath(ot)}this._visitCounts=o.JsonSerialisation.JObjectToIntDictionary(S.visitCounts),this._turnIndices=o.JsonSerialisation.JObjectToIntDictionary(S.turnIndices),this.currentTurnIndex=parseInt(S.turnIdx),this.storySeed=parseInt(S.storySeed),this.previousRandom=parseInt(S.previousRandom)}ResetErrors(){this._currentErrors=null,this._currentWarnings=null}ResetOutput(C=null){this.outputStream.length=0,C!==null&&this.outputStream.push(...C),this.OutputStreamDirty()}PushToOutputStream(C){let S=(0,B.asOrNull)(C,c.StringValue);if(S!==null){let F=this.TrySplittingHeadTailWhitespace(S);if(F!==null){for(let K of F)this.PushToOutputStreamIndividual(K);this.OutputStreamDirty();return}}this.PushToOutputStreamIndividual(C),this.OutputStreamDirty()}PopFromOutputStream(C){this.outputStream.splice(this.outputStream.length-C,C),this.OutputStreamDirty()}TrySplittingHeadTailWhitespace(C){let S=C.value;if(S===null)return(0,M.throwNullException)("single.value");let F=-1,K=-1;for(let R=0;R<S.length;R++){let Z=S[R];if(Z==`
23
+ `)F==-1&&(F=R),K=R;else{if(Z==" "||Z==" ")continue;break}}let it=-1,ot=-1;for(let R=S.length-1;R>=0;R--){let Z=S[R];if(Z==`
24
+ `)it==-1&&(it=R),ot=R;else{if(Z==" "||Z==" ")continue;break}}if(F==-1&&it==-1)return null;let E=[],x=0,D=S.length;if(F!=-1){if(F>0){let R=new c.StringValue(S.substring(0,F));E.push(R)}E.push(new c.StringValue(`
25
+ `)),x=K+1}if(it!=-1&&(D=ot),D>x){let R=S.substring(x,D);E.push(new c.StringValue(R))}if(it!=-1&&ot>K&&(E.push(new c.StringValue(`
26
+ `)),it<S.length-1)){let R=S.length-it-1,Z=new c.StringValue(S.substring(it+1,it+1+R));E.push(Z)}return E}PushToOutputStreamIndividual(C){let S=(0,B.asOrNull)(C,m.Glue),F=(0,B.asOrNull)(C,c.StringValue),K=!0;if(S)this.TrimNewlinesFromOutputStream(),K=!0;else if(F){let it=-1,ot=this.callStack.currentElement;ot.type==s.PushPopType.Function&&(it=ot.functionStartInOutputStream);let E=-1;for(let D=this.outputStream.length-1;D>=0;D--){let R=this.outputStream[D],Z=R instanceof y.ControlCommand?R:null;if((R instanceof m.Glue?R:null)!=null){E=D;break}else if(Z!=null&&Z.commandType==y.ControlCommand.CommandType.BeginString){D>=it&&(it=-1);break}}let x=-1;if(E!=-1&&it!=-1?x=Math.min(it,E):E!=-1?x=E:x=it,x!=-1){if(F.isNewline)K=!1;else if(F.isNonWhitespace&&(E>-1&&this.RemoveExistingGlue(),it>-1)){let D=this.callStack.elements;for(let R=D.length-1;R>=0;R--){let Z=D[R];if(Z.type==s.PushPopType.Function)Z.functionStartInOutputStream=-1;else break}}}else F.isNewline&&(this.outputStreamEndsInNewline||!this.outputStreamContainsContent)&&(K=!1)}if(K){if(C===null)return(0,M.throwNullException)("obj");this.outputStream.push(C),this.OutputStreamDirty()}}TrimNewlinesFromOutputStream(){let C=-1,S=this.outputStream.length-1;for(;S>=0;){let F=this.outputStream[S],K=(0,B.asOrNull)(F,y.ControlCommand),it=(0,B.asOrNull)(F,c.StringValue);if(K!=null||it!=null&&it.isNonWhitespace)break;it!=null&&it.isNewline&&(C=S),S--}if(C>=0)for(S=C;S<this.outputStream.length;)(0,B.asOrNull)(this.outputStream[S],c.StringValue)?this.outputStream.splice(S,1):S++;this.OutputStreamDirty()}RemoveExistingGlue(){for(let C=this.outputStream.length-1;C>=0;C--){let S=this.outputStream[C];if(S instanceof m.Glue)this.outputStream.splice(C,1);else if(S instanceof y.ControlCommand)break}this.OutputStreamDirty()}get outputStreamEndsInNewline(){if(this.outputStream.length>0)for(let C=this.outputStream.length-1;C>=0&&!(this.outputStream[C]instanceof y.ControlCommand);C--){let S=this.outputStream[C];if(S instanceof c.StringValue){if(S.isNewline)return!0;if(S.isNonWhitespace)break}}return!1}get outputStreamContainsContent(){for(let C of this.outputStream)if(C instanceof c.StringValue)return!0;return!1}get inStringEvaluation(){for(let C=this.outputStream.length-1;C>=0;C--){let S=(0,B.asOrNull)(this.outputStream[C],y.ControlCommand);if(S instanceof y.ControlCommand&&S.commandType==y.ControlCommand.CommandType.BeginString)return!0}return!1}PushEvaluationStack(C){let S=(0,B.asOrNull)(C,c.ListValue);if(S){let F=S.value;if(F===null)return(0,M.throwNullException)("rawList");if(F.originNames!=null){F.origins||(F.origins=[]),F.origins.length=0;for(let K of F.originNames){if(this.story.listDefinitions===null)return(0,M.throwNullException)("StoryState.story.listDefinitions");let it=this.story.listDefinitions.TryListGetDefinition(K,null);if(it.result===null)return(0,M.throwNullException)("StoryState def.result");F.origins.indexOf(it.result)<0&&F.origins.push(it.result)}}}if(C===null)return(0,M.throwNullException)("obj");this.evaluationStack.push(C)}PopEvaluationStack(C){if(typeof C>"u"){let S=this.evaluationStack.pop();return(0,B.nullIfUndefined)(S)}else{if(C>this.evaluationStack.length)throw new Error("trying to pop too many objects");let S=this.evaluationStack.splice(this.evaluationStack.length-C,C);return(0,B.nullIfUndefined)(S)}}PeekEvaluationStack(){return this.evaluationStack[this.evaluationStack.length-1]}ForceEnd(){this.callStack.Reset(),this._currentFlow.currentChoices.length=0,this.currentPointer=g.Pointer.Null,this.previousPointer=g.Pointer.Null,this.didSafeExit=!0}TrimWhitespaceFromFunctionEnd(){k.Debug.Assert(this.callStack.currentElement.type==s.PushPopType.Function);let C=this.callStack.currentElement.functionStartInOutputStream;C==-1&&(C=0);for(let S=this.outputStream.length-1;S>=C;S--){let F=this.outputStream[S],K=(0,B.asOrNull)(F,c.StringValue),it=(0,B.asOrNull)(F,y.ControlCommand);if(K!=null){if(it)break;if(K.isNewline||K.isInlineWhitespace)this.outputStream.splice(S,1),this.OutputStreamDirty();else break}}}PopCallStack(C=null){this.callStack.currentElement.type==s.PushPopType.Function&&this.TrimWhitespaceFromFunctionEnd(),this.callStack.Pop(C)}SetChosenPath(C,S){this._currentFlow.currentChoices.length=0;let F=this.story.PointerAtPath(C);!F.isNull&&F.index==-1&&(F.index=0),this.currentPointer=F,S&&this.currentTurnIndex++}StartFunctionEvaluationFromGame(C,S){this.callStack.Push(s.PushPopType.FunctionEvaluationFromGame,this.evaluationStack.length),this.callStack.currentElement.currentPointer=g.Pointer.StartOf(C),this.PassArgumentsToEvaluationStack(S)}PassArgumentsToEvaluationStack(C){if(C!==null)for(let S=0;S<C.length;S++){if(!(typeof C[S]=="number"||typeof C[S]=="string"||typeof C[S]=="boolean"||C[S]instanceof O.InkList))throw new Error("ink arguments when calling EvaluateFunction / ChoosePathStringWithParameters must benumber, string, bool or InkList. Argument was "+((0,B.nullIfUndefined)(C[S])===null?"null":C[S].constructor.name));this.PushEvaluationStack(c.Value.Create(C[S]))}}TryExitFunctionEvaluationFromGame(){return this.callStack.currentElement.type==s.PushPopType.FunctionEvaluationFromGame?(this.currentPointer=g.Pointer.Null,this.didSafeExit=!0,!0):!1}CompleteFunctionEvaluationFromGame(){if(this.callStack.currentElement.type!=s.PushPopType.FunctionEvaluationFromGame)throw new Error("Expected external function evaluation to be complete. Stack trace: "+this.callStack.callStackTrace);let C=this.callStack.currentElement.evaluationStackHeightWhenPushed,S=null;for(;this.evaluationStack.length>C;){let F=this.PopEvaluationStack();S===null&&(S=F)}if(this.PopCallStack(s.PushPopType.FunctionEvaluationFromGame),S){if(S instanceof f.Void)return null;let F=(0,B.asOrThrows)(S,c.Value);return F.valueType==c.ValueType.DivertTarget?"-> "+F.valueObject.toString():F.valueObject}return null}AddError(C,S){S?(this._currentWarnings==null&&(this._currentWarnings=[]),this._currentWarnings.push(C)):(this._currentErrors==null&&(this._currentErrors=[]),this._currentErrors.push(C))}OutputStreamDirty(){this._outputStreamTextDirty=!0,this._outputStreamTagsDirty=!0}};r.StoryState=w})),Ov=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Stopwatch=void 0;var u=class{constructor(){this.startTime=void 0}get ElapsedMilliseconds(){return typeof this.startTime>"u"?0:new Date().getTime()-this.startTime}Start(){this.startTime=new Date().getTime()}Stop(){this.startTime=void 0}};r.Stopwatch=u})),Nv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ErrorType=void 0;var u;(function(h){h[h.Author=0]="Author",h[h.Warning=1]="Warning",h[h.Error=2]="Error"})(u||(r.ErrorType=u={}))})),Ua=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Story=r.InkList=void 0;var u=oe(),h=Fe(),c=za(),s=Tv(),p=Ee(),m=Yi(),v=bs(),y=_h(),A=Cn(),o=Jt(),T=Me(),f=Hi(),g=xs(),V=Ci(),B=ka(),k=yn(),M=Gl(),j=Th(),q=Ui(),z=bh(),Q=Ov(),O=zl(),w=Ie(),N=Bt(),C=be(),S=Oh(),F=Nv(),K=Ie();Object.defineProperty(r,"InkList",{enumerable:!0,get:function(){return K.InkList}}),Number.isInteger||(Number.isInteger=function(E){return typeof E=="number"&&isFinite(E)&&E>-9007199254740992&&E<9007199254740992&&Math.floor(E)===E});var it=class sn extends h.InkObject{get currentChoices(){let E=[];if(this._state===null)return(0,C.throwNullException)("this._state");for(let x of this._state.currentChoices)x.isInvisibleDefault||(x.index=E.length,E.push(x));return E}get currentText(){return this.IfAsyncWeCant("call currentText since it's a work in progress"),this.state.currentText}get currentTags(){return this.IfAsyncWeCant("call currentTags since it's a work in progress"),this.state.currentTags}get currentErrors(){return this.state.currentErrors}get currentWarnings(){return this.state.currentWarnings}get currentFlowName(){return this.state.currentFlowName}get currentFlowIsDefaultFlow(){return this.state.currentFlowIsDefaultFlow}get aliveFlowNames(){return this.state.aliveFlowNames}get hasError(){return this.state.hasError}get hasWarning(){return this.state.hasWarning}get variablesState(){return this.state.variablesState}get listDefinitions(){return this._listDefinitions}get state(){return this._state}StartProfiling(){}EndProfiling(){}constructor(){super(),this.inkVersionMinimumCompatible=18,this.onError=null,this.onDidContinue=null,this.onMakeChoice=null,this.onEvaluateFunction=null,this.onCompleteEvaluateFunction=null,this.onChoosePathString=null,this._prevContainers=[],this.allowExternalFunctionFallbacks=!1,this._listDefinitions=null,this._variableObservers=null,this._hasValidatedExternals=!1,this._temporaryEvaluationContainer=null,this._asyncContinueActive=!1,this._stateSnapshotAtLastNewline=null,this._sawLookaheadUnsafeFunctionAfterNewline=!1,this._recursiveContinueCount=0,this._asyncSaving=!1,this._profiler=null;let E,x=null,D=null;if(arguments[0]instanceof u.Container)E=arguments[0],typeof arguments[1]<"u"&&(x=arguments[1]),this._mainContentContainer=E;else if(typeof arguments[0]=="string"){let R=arguments[0];D=S.SimpleJson.TextToDictionary(R)}else D=arguments[0];if(x!=null&&(this._listDefinitions=new z.ListDefinitionsOrigin(x)),this._externals=new Map,D!==null){let R=D,Z=R.inkVersion;if(Z==null)throw new Error("ink version number not found. Are you sure it's a valid .ink.json file?");let tt=parseInt(Z);if(tt>sn.inkVersionCurrent)throw new Error("Version of ink used to build story was newer than the current version of the engine");if(tt<this.inkVersionMinimumCompatible)throw new Error("Version of ink used to build story is too old to be loaded by this version of the engine");tt!=sn.inkVersionCurrent&&console.warn(`WARNING: Version of ink ${sn.inkVersionCurrent} used to build story doesn't match current version of engine (${tt}). Non-critical, but recommend synchronising.`);let ft=R.root;if(ft==null)throw new Error("Root node for ink not found. Are you sure it's a valid .ink.json file?");let L;(L=R.listDefs)&&(this._listDefinitions=c.JsonSerialisation.JTokenToListDefinitions(L)),this._mainContentContainer=(0,N.asOrThrows)(c.JsonSerialisation.JTokenToRuntimeObject(ft),u.Container),this.ResetState()}}ToJson(E){let x=!1;if(E||(x=!0,E=new S.SimpleJson.Writer),E.WriteObjectStart(),E.WriteIntProperty("inkVersion",sn.inkVersionCurrent),E.WriteProperty("root",D=>c.JsonSerialisation.WriteRuntimeContainer(D,this._mainContentContainer)),this._listDefinitions!=null){E.WritePropertyStart("listDefs"),E.WriteObjectStart();for(let D of this._listDefinitions.lists){E.WritePropertyStart(D.name),E.WriteObjectStart();for(let[R,Z]of D.items){let tt=w.InkListItem.fromSerializedKey(R),ft=Z;E.WriteIntProperty(tt.itemName,ft)}E.WriteObjectEnd(),E.WritePropertyEnd()}E.WriteObjectEnd(),E.WritePropertyEnd()}if(E.WriteObjectEnd(),x)return E.toString()}ResetState(){this.IfAsyncWeCant("ResetState"),this._state=new s.StoryState(this),this._state.variablesState.ObserveVariableChange(this.VariableStateDidChangeEvent.bind(this)),this.ResetGlobals()}ResetErrors(){if(this._state===null)return(0,C.throwNullException)("this._state");this._state.ResetErrors()}ResetCallstack(){if(this.IfAsyncWeCant("ResetCallstack"),this._state===null)return(0,C.throwNullException)("this._state");this._state.ForceEnd()}ResetGlobals(){if(this._mainContentContainer.namedContent.get("global decl")){let E=this.state.currentPointer.copy();this.ChoosePath(new T.Path("global decl"),!1),this.ContinueInternal(),this.state.currentPointer=E}this.state.variablesState.SnapshotDefaultGlobals()}SwitchFlow(E){if(this.IfAsyncWeCant("switch flow"),this._asyncSaving)throw new Error("Story is already in background saving mode, can't switch flow to "+E);this.state.SwitchFlow_Internal(E)}RemoveFlow(E){this.state.RemoveFlow_Internal(E)}SwitchToDefaultFlow(){this.state.SwitchToDefaultFlow_Internal()}Continue(){return this.ContinueAsync(0),this.currentText}get canContinue(){return this.state.canContinue}get asyncContinueComplete(){return!this._asyncContinueActive}ContinueAsync(E){this._hasValidatedExternals||this.ValidateExternalBindings(),this.ContinueInternal(E)}ContinueInternal(E=0){this._profiler!=null&&this._profiler.PreContinue();let x=E>0;if(this._recursiveContinueCount++,this._asyncContinueActive)this._asyncContinueActive&&!x&&(this._asyncContinueActive=!1);else{if(this._asyncContinueActive=x,!this.canContinue)throw new Error("Can't continue - should check canContinue before calling Continue");this._state.didSafeExit=!1,this._state.ResetOutput(),this._recursiveContinueCount==1&&this._state.variablesState.StartVariableObservation()}let D=new Q.Stopwatch;D.Start();let R=!1;this._sawLookaheadUnsafeFunctionAfterNewline=!1;do{try{R=this.ContinueSingleStep()}catch(tt){if(!(tt instanceof M.StoryException))throw tt;this.AddError(tt.message,void 0,tt.useEndLineNumber);break}if(R||this._asyncContinueActive&&D.ElapsedMilliseconds>E)break}while(this.canContinue);D.Stop();let Z=null;if((R||!this.canContinue)&&(this._stateSnapshotAtLastNewline!==null&&this.RestoreStateSnapshot(),this.canContinue||(this.state.callStack.canPopThread&&this.AddError("Thread available to pop, threads should always be flat by the end of evaluation?"),this.state.generatedChoices.length==0&&!this.state.didSafeExit&&this._temporaryEvaluationContainer==null&&(this.state.callStack.CanPop(m.PushPopType.Tunnel)?this.AddError("unexpectedly reached end of content. Do you need a '->->' to return from a tunnel?"):this.state.callStack.CanPop(m.PushPopType.Function)?this.AddError("unexpectedly reached end of content. Do you need a '~ return'?"):this.state.callStack.canPop?this.AddError("unexpectedly reached end of content for unknown reason. Please debug compiler!"):this.AddError("ran out of content. Do you need a '-> DONE' or '-> END'?"))),this.state.didSafeExit=!1,this._sawLookaheadUnsafeFunctionAfterNewline=!1,this._recursiveContinueCount==1&&(Z=this._state.variablesState.CompleteVariableObservation()),this._asyncContinueActive=!1,this.onDidContinue!==null&&this.onDidContinue()),this._recursiveContinueCount--,this._profiler!=null&&this._profiler.PostContinue(),this.state.hasError||this.state.hasWarning)if(this.onError!==null){if(this.state.hasError)for(let tt of this.state.currentErrors)this.onError(tt,F.ErrorType.Error);if(this.state.hasWarning)for(let tt of this.state.currentWarnings)this.onError(tt,F.ErrorType.Warning);this.ResetErrors()}else{let tt=new q.StringBuilder;throw tt.Append("Ink had "),this.state.hasError&&(tt.Append(`${this.state.currentErrors.length}`),tt.Append(this.state.currentErrors.length==1?" error":" errors"),this.state.hasWarning&&tt.Append(" and ")),this.state.hasWarning&&(tt.Append(`${this.state.currentWarnings.length}`),tt.Append(this.state.currentWarnings.length==1?" warning":" warnings"),this.state.hasWarning&&tt.Append(" and ")),tt.Append(". It is strongly suggested that you assign an error handler to story.onError. The first issue was: "),tt.Append(this.state.hasError?this.state.currentErrors[0]:this.state.currentWarnings[0]),new M.StoryException(tt.toString())}Z!=null&&Object.keys(Z).length>0&&this._state.variablesState.NotifyObservers(Z)}ContinueSingleStep(){if(this._profiler!=null&&this._profiler.PreStep(),this.Step(),this._profiler!=null&&this._profiler.PostStep(),!this.canContinue&&!this.state.callStack.elementIsEvaluateFromGame&&this.TryFollowDefaultInvisibleChoice(),this._profiler!=null&&this._profiler.PreSnapshot(),!this.state.inStringEvaluation){if(this._stateSnapshotAtLastNewline!==null){if(this._stateSnapshotAtLastNewline.currentTags===null)return(0,C.throwNullException)("this._stateAtLastNewline.currentTags");if(this.state.currentTags===null)return(0,C.throwNullException)("this.state.currentTags");let E=this.CalculateNewlineOutputStateChange(this._stateSnapshotAtLastNewline.currentText,this.state.currentText,this._stateSnapshotAtLastNewline.currentTags.length,this.state.currentTags.length);if(E==sn.OutputStateChange.ExtendedBeyondNewline||this._sawLookaheadUnsafeFunctionAfterNewline)return this.RestoreStateSnapshot(),!0;E==sn.OutputStateChange.NewlineRemoved&&this.DiscardSnapshot()}this.state.outputStreamEndsInNewline&&(this.canContinue?this._stateSnapshotAtLastNewline==null&&this.StateSnapshot():this.DiscardSnapshot())}return this._profiler!=null&&this._profiler.PostSnapshot(),!1}CalculateNewlineOutputStateChange(E,x,D,R){if(E===null)return(0,C.throwNullException)("prevText");if(x===null)return(0,C.throwNullException)("currText");let Z=x.length>=E.length&&E.length>0&&x.charAt(E.length-1)==`
27
+ `;if(D==R&&E.length==x.length&&Z)return sn.OutputStateChange.NoChange;if(!Z)return sn.OutputStateChange.NewlineRemoved;if(R>D)return sn.OutputStateChange.ExtendedBeyondNewline;for(let tt=E.length;tt<x.length;tt++){let ft=x.charAt(tt);if(ft!=" "&&ft!=" ")return sn.OutputStateChange.ExtendedBeyondNewline}return sn.OutputStateChange.NoChange}ContinueMaximally(){this.IfAsyncWeCant("ContinueMaximally");let E=new q.StringBuilder;for(;this.canContinue;)E.Append(this.Continue());return E.toString()}ContentAtPath(E){return this.mainContentContainer.ContentAtPath(E)}KnotContainerWithName(E){let x=this.mainContentContainer.namedContent.get(E);return x instanceof u.Container?x:null}PointerAtPath(E){if(E.length==0)return O.Pointer.Null;let x=new O.Pointer,D=E.length,R=null;return E.lastComponent===null?(0,C.throwNullException)("path.lastComponent"):(E.lastComponent.isIndex?(D=E.length-1,R=this.mainContentContainer.ContentAtPath(E,void 0,D),x.container=R.container,x.index=E.lastComponent.index):(R=this.mainContentContainer.ContentAtPath(E),x.container=R.container,x.index=-1),R.obj==null||R.obj==this.mainContentContainer&&D>0?this.Error("Failed to find content at path '"+E+"', and no approximation of it was possible."):R.approximate&&this.Warning("Failed to find content at path '"+E+"', so it was approximated to: '"+R.obj.path+"'."),x)}StateSnapshot(){this._stateSnapshotAtLastNewline=this._state,this._state=this._state.CopyAndStartPatching(!1)}RestoreStateSnapshot(){this._stateSnapshotAtLastNewline===null&&(0,C.throwNullException)("_stateSnapshotAtLastNewline"),this._stateSnapshotAtLastNewline.RestoreAfterPatch(),this._state=this._stateSnapshotAtLastNewline,this._stateSnapshotAtLastNewline=null,this._asyncSaving||this._state.ApplyAnyPatch()}DiscardSnapshot(){this._asyncSaving||this._state.ApplyAnyPatch(),this._stateSnapshotAtLastNewline=null}CopyStateForBackgroundThreadSave(){if(this.IfAsyncWeCant("start saving on a background thread"),this._asyncSaving)throw new Error("Story is already in background saving mode, can't call CopyStateForBackgroundThreadSave again!");let E=this._state;return this._state=this._state.CopyAndStartPatching(!0),this._asyncSaving=!0,E}BackgroundSaveComplete(){this._stateSnapshotAtLastNewline===null&&this._state.ApplyAnyPatch(),this._asyncSaving=!1}Step(){let E=!0,x=this.state.currentPointer.copy();if(x.isNull)return;let D=(0,N.asOrNull)(x.Resolve(),u.Container);for(;D&&(this.VisitContainer(D,!0),D.content.length!=0);)x=O.Pointer.StartOf(D),D=(0,N.asOrNull)(x.Resolve(),u.Container);this.state.currentPointer=x.copy(),this._profiler!=null&&this._profiler.Step(this.state.callStack);let R=x.Resolve(),Z=this.PerformLogicAndFlowControl(R);if(this.state.currentPointer.isNull)return;Z&&(E=!1);let tt=(0,N.asOrNull)(R,v.ChoicePoint);if(tt){let L=this.ProcessChoice(tt);L&&this.state.generatedChoices.push(L),R=null,E=!1}if(R instanceof u.Container&&(E=!1),E){let L=(0,N.asOrNull)(R,o.VariablePointerValue);if(L&&L.contextIndex==-1){let $=this.state.callStack.ContextForVariableNamed(L.variableName);R=new o.VariablePointerValue(L.variableName,$)}this.state.inExpressionEvaluation?this.state.PushEvaluationStack(R):this.state.PushToOutputStream(R)}this.NextContent();let ft=(0,N.asOrNull)(R,p.ControlCommand);ft&&ft.commandType==p.ControlCommand.CommandType.StartThread&&this.state.callStack.PushThread()}VisitContainer(E,x){(!E.countingAtStartOnly||x)&&(E.visitsShouldBeCounted&&this.state.IncrementVisitCountForContainer(E),E.turnIndexShouldBeCounted&&this.state.RecordTurnIndexVisitToContainer(E))}VisitChangedContainersDueToDivert(){let E=this.state.previousPointer.copy(),x=this.state.currentPointer.copy();if(x.isNull||x.index==-1)return;if(this._prevContainers.length=0,!E.isNull){let tt=E.Resolve(),ft=(0,N.asOrNull)(tt,u.Container)||(0,N.asOrNull)(E.container,u.Container);for(;ft;)this._prevContainers.push(ft),ft=(0,N.asOrNull)(ft.parent,u.Container)}let D=x.Resolve();if(D==null)return;let R=(0,N.asOrNull)(D.parent,u.Container),Z=!0;for(;R&&(this._prevContainers.indexOf(R)<0||R.countingAtStartOnly);){let tt=R.content.length>0&&D==R.content[0]&&Z;tt||(Z=!1),this.VisitContainer(R,tt),D=R,R=(0,N.asOrNull)(R.parent,u.Container)}}PopChoiceStringAndTags(E){let x=(0,N.asOrThrows)(this.state.PopEvaluationStack(),o.StringValue);for(;this.state.evaluationStack.length>0&&(0,N.asOrNull)(this.state.PeekEvaluationStack(),g.Tag)!=null;){let D=(0,N.asOrNull)(this.state.PopEvaluationStack(),g.Tag);D&&E.push(D.text)}return x.value}ProcessChoice(E){let x=!0;if(E.hasCondition){let ft=this.state.PopEvaluationStack();this.IsTruthy(ft)||(x=!1)}let D="",R="",Z=[];if(E.hasChoiceOnlyContent&&(R=this.PopChoiceStringAndTags(Z)||""),E.hasStartContent&&(D=this.PopChoiceStringAndTags(Z)||""),E.onceOnly&&this.state.VisitCountForContainer(E.choiceTarget)>0&&(x=!1),!x)return null;let tt=new y.Choice;return tt.targetPath=E.pathOnChoice,tt.sourcePath=E.path.toString(),tt.isInvisibleDefault=E.isInvisibleDefault,tt.threadAtGeneration=this.state.callStack.ForkThread(),tt.tags=Z.reverse(),tt.text=(D+R).replace(/^[ \t]+|[ \t]+$/g,""),tt}IsTruthy(E){let x=!1;if(E instanceof o.Value){let D=E;if(D instanceof o.DivertTargetValue){let R=D;return this.Error("Shouldn't use a divert target (to "+R.targetPath+") as a conditional value. Did you intend a function call 'likeThis()' or a read count check 'likeThis'? (no arrows)"),!1}return D.isTruthy}return x}PerformLogicAndFlowControl(E){if(E==null)return!1;if(E instanceof A.Divert){let x=E;if(x.isConditional){let D=this.state.PopEvaluationStack();if(!this.IsTruthy(D))return!0}if(x.hasVariableTarget){let D=x.variableDivertName,R=this.state.variablesState.GetVariableWithName(D);if(R==null)this.Error("Tried to divert using a target from a variable that could not be found ("+D+")");else if(!(R instanceof o.DivertTargetValue)){let tt=(0,N.asOrNull)(R,o.IntValue),ft="Tried to divert to a target from a variable, but the variable ("+D+") didn't contain a divert target, it ";tt instanceof o.IntValue&&tt.value==0?ft+="was empty/null (the value 0).":ft+="contained '"+R+"'.",this.Error(ft)}let Z=(0,N.asOrThrows)(R,o.DivertTargetValue);this.state.divertedPointer=this.PointerAtPath(Z.targetPath)}else{if(x.isExternal)return this.CallExternalFunction(x.targetPathString,x.externalArgs),!0;this.state.divertedPointer=x.targetPointer.copy()}return x.pushesToStack&&this.state.callStack.Push(x.stackPushType,void 0,this.state.outputStream.length),this.state.divertedPointer.isNull&&!x.isExternal&&(x&&x.debugMetadata&&x.debugMetadata.sourceName!=null?this.Error("Divert target doesn't exist: "+x.debugMetadata.sourceName):this.Error("Divert resolution failed: "+x)),!0}else if(E instanceof p.ControlCommand){let x=E;switch(x.commandType){case p.ControlCommand.CommandType.EvalStart:this.Assert(this.state.inExpressionEvaluation===!1,"Already in expression evaluation?"),this.state.inExpressionEvaluation=!0;break;case p.ControlCommand.CommandType.EvalEnd:this.Assert(this.state.inExpressionEvaluation===!0,"Not in expression evaluation mode"),this.state.inExpressionEvaluation=!1;break;case p.ControlCommand.CommandType.EvalOutput:if(this.state.evaluationStack.length>0){let Et=this.state.PopEvaluationStack();if(!(Et instanceof f.Void)){let pt=new o.StringValue(Et.toString());this.state.PushToOutputStream(pt)}}break;case p.ControlCommand.CommandType.NoOp:break;case p.ControlCommand.CommandType.Duplicate:this.state.PushEvaluationStack(this.state.PeekEvaluationStack());break;case p.ControlCommand.CommandType.PopEvaluatedValue:this.state.PopEvaluationStack();break;case p.ControlCommand.CommandType.PopFunction:case p.ControlCommand.CommandType.PopTunnel:let D=x.commandType==p.ControlCommand.CommandType.PopFunction?m.PushPopType.Function:m.PushPopType.Tunnel,R=null;if(D==m.PushPopType.Tunnel){let Et=this.state.PopEvaluationStack();R=(0,N.asOrNull)(Et,o.DivertTargetValue),R===null&&this.Assert(Et instanceof f.Void,"Expected void if ->-> doesn't override target")}if(this.state.TryExitFunctionEvaluationFromGame())break;if(this.state.callStack.currentElement.type!=D||!this.state.callStack.canPop){let Et=new Map;Et.set(m.PushPopType.Function,"function return statement (~ return)"),Et.set(m.PushPopType.Tunnel,"tunnel onwards statement (->->)");let pt=Et.get(this.state.callStack.currentElement.type);this.state.callStack.canPop||(pt="end of flow (-> END or choice)");let $t="Found "+Et.get(D)+", when expected "+pt;this.Error($t)}else this.state.PopCallStack(),R&&(this.state.divertedPointer=this.PointerAtPath(R.targetPath));break;case p.ControlCommand.CommandType.BeginString:this.state.PushToOutputStream(x),this.Assert(this.state.inExpressionEvaluation===!0,"Expected to be in an expression when evaluating a string"),this.state.inExpressionEvaluation=!1;break;case p.ControlCommand.CommandType.BeginTag:this.state.PushToOutputStream(x);break;case p.ControlCommand.CommandType.EndTag:if(this.state.inStringEvaluation){let Et=[],pt=0;for(let Kt=this.state.outputStream.length-1;Kt>=0;--Kt){let he=this.state.outputStream[Kt];pt++;let Te=(0,N.asOrNull)(he,p.ControlCommand);if(Te!=null){if(Te.commandType==p.ControlCommand.CommandType.BeginTag)break;this.Error("Unexpected ControlCommand while extracting tag from choice");break}he instanceof o.StringValue&&Et.push(he)}this.state.PopFromOutputStream(pt);let $t=new q.StringBuilder;for(let Kt of Et.reverse())$t.Append(Kt.toString());let zt=new g.Tag(this.state.CleanOutputWhitespace($t.toString()));this.state.PushEvaluationStack(zt)}else this.state.PushToOutputStream(x);break;case p.ControlCommand.CommandType.EndString:{let Et=[],pt=[],$t=0;for(let Kt=this.state.outputStream.length-1;Kt>=0;--Kt){let he=this.state.outputStream[Kt];$t++;let Te=(0,N.asOrNull)(he,p.ControlCommand);if(Te&&Te.commandType==p.ControlCommand.CommandType.BeginString)break;he instanceof g.Tag&&pt.push(he),he instanceof o.StringValue&&Et.push(he)}this.state.PopFromOutputStream($t);for(let Kt of pt)this.state.PushToOutputStream(Kt);Et=Et.reverse();let zt=new q.StringBuilder;for(let Kt of Et)zt.Append(Kt.toString());this.state.inExpressionEvaluation=!0,this.state.PushEvaluationStack(new o.StringValue(zt.toString()));break}case p.ControlCommand.CommandType.ChoiceCount:let Z=this.state.generatedChoices.length;this.state.PushEvaluationStack(new o.IntValue(Z));break;case p.ControlCommand.CommandType.Turns:this.state.PushEvaluationStack(new o.IntValue(this.state.currentTurnIndex+1));break;case p.ControlCommand.CommandType.TurnsSince:case p.ControlCommand.CommandType.ReadCount:let tt=this.state.PopEvaluationStack();if(!(tt instanceof o.DivertTargetValue)){let Et="";tt instanceof o.IntValue&&(Et=". Did you accidentally pass a read count ('knot_name') instead of a target ('-> knot_name')?"),this.Error("TURNS_SINCE / READ_COUNT expected a divert target (knot, stitch, label name), but saw "+tt+Et);break}let ft=(0,N.asOrThrows)(tt,o.DivertTargetValue),L=(0,N.asOrNull)(this.ContentAtPath(ft.targetPath).correctObj,u.Container),$;L!=null?x.commandType==p.ControlCommand.CommandType.TurnsSince?$=this.state.TurnsSinceForContainer(L):$=this.state.VisitCountForContainer(L):(x.commandType==p.ControlCommand.CommandType.TurnsSince?$=-1:$=0,this.Warning("Failed to find container for "+x.toString()+" lookup at "+ft.targetPath.toString())),this.state.PushEvaluationStack(new o.IntValue($));break;case p.ControlCommand.CommandType.Random:{let Et=(0,N.asOrNull)(this.state.PopEvaluationStack(),o.IntValue),pt=(0,N.asOrNull)(this.state.PopEvaluationStack(),o.IntValue);if(pt==null||!(pt instanceof o.IntValue))return this.Error("Invalid value for minimum parameter of RANDOM(min, max)");if(Et==null||!(Et instanceof o.IntValue))return this.Error("Invalid value for maximum parameter of RANDOM(min, max)");if(Et.value===null)return(0,C.throwNullException)("maxInt.value");if(pt.value===null)return(0,C.throwNullException)("minInt.value");let $t=Et.value-pt.value+1;(!isFinite($t)||$t>Number.MAX_SAFE_INTEGER)&&($t=Number.MAX_SAFE_INTEGER,this.Error("RANDOM was called with a range that exceeds the size that ink numbers can use.")),$t<=0&&this.Error("RANDOM was called with minimum as "+pt.value+" and maximum as "+Et.value+". The maximum must be larger");let zt=this.state.storySeed+this.state.previousRandom,Kt=new j.PRNG(zt).next(),he=Kt%$t+pt.value;this.state.PushEvaluationStack(new o.IntValue(he)),this.state.previousRandom=Kt;break}case p.ControlCommand.CommandType.SeedRandom:let rt=(0,N.asOrNull)(this.state.PopEvaluationStack(),o.IntValue);if(rt==null||!(rt instanceof o.IntValue))return this.Error("Invalid value passed to SEED_RANDOM");if(rt.value===null)return(0,C.throwNullException)("minInt.value");this.state.storySeed=rt.value,this.state.previousRandom=0,this.state.PushEvaluationStack(new f.Void);break;case p.ControlCommand.CommandType.VisitIndex:let ut=this.state.VisitCountForContainer(this.state.currentPointer.container)-1;this.state.PushEvaluationStack(new o.IntValue(ut));break;case p.ControlCommand.CommandType.SequenceShuffleIndex:let dt=this.NextSequenceShuffleIndex();this.state.PushEvaluationStack(new o.IntValue(dt));break;case p.ControlCommand.CommandType.StartThread:break;case p.ControlCommand.CommandType.Done:this.state.callStack.canPopThread?this.state.callStack.PopThread():(this.state.didSafeExit=!0,this.state.currentPointer=O.Pointer.Null);break;case p.ControlCommand.CommandType.End:this.state.ForceEnd();break;case p.ControlCommand.CommandType.ListFromInt:let Ct=(0,N.asOrNull)(this.state.PopEvaluationStack(),o.IntValue),Nt=(0,N.asOrThrows)(this.state.PopEvaluationStack(),o.StringValue);if(Ct===null)throw new M.StoryException("Passed non-integer when creating a list element from a numerical value.");let Yt=null;if(this.listDefinitions===null)return(0,C.throwNullException)("this.listDefinitions");let qt=this.listDefinitions.TryListGetDefinition(Nt.value,null);if(qt.exists){if(Ct.value===null)return(0,C.throwNullException)("minInt.value");let Et=qt.result.TryGetItemWithValue(Ct.value,w.InkListItem.Null);Et.exists&&(Yt=new o.ListValue(Et.result,Ct.value))}else throw new M.StoryException("Failed to find LIST called "+Nt.value);Yt==null&&(Yt=new o.ListValue),this.state.PushEvaluationStack(Yt);break;case p.ControlCommand.CommandType.ListRange:let ge=(0,N.asOrNull)(this.state.PopEvaluationStack(),o.Value),je=(0,N.asOrNull)(this.state.PopEvaluationStack(),o.Value),Ne=(0,N.asOrNull)(this.state.PopEvaluationStack(),o.ListValue);if(Ne===null||je===null||ge===null)throw new M.StoryException("Expected list, minimum and maximum for LIST_RANGE");if(Ne.value===null)return(0,C.throwNullException)("targetList.value");let _i=Ne.value.ListWithSubRange(je.valueObject,ge.valueObject);this.state.PushEvaluationStack(new o.ListValue(_i));break;case p.ControlCommand.CommandType.ListRandom:{let Et=this.state.PopEvaluationStack();if(Et===null)throw new M.StoryException("Expected list for LIST_RANDOM");let pt=Et.value,$t=null;if(pt===null)throw(0,C.throwNullException)("list");if(pt.Count==0)$t=new w.InkList;else{let zt=this.state.storySeed+this.state.previousRandom,Kt=new j.PRNG(zt).next(),he=Kt%pt.Count,Te=pt.entries();for(let P=0;P<=he-1;P++)Te.next();let Nn=Te.next().value,_={Key:w.InkListItem.fromSerializedKey(Nn[0]),Value:Nn[1]};if(_.Key.originName===null)return(0,C.throwNullException)("randomItem.Key.originName");$t=new w.InkList(_.Key.originName,this),$t.Add(_.Key,_.Value),this.state.previousRandom=Kt}this.state.PushEvaluationStack(new o.ListValue($t));break}default:this.Error("unhandled ControlCommand: "+x);break}return!0}else if(E instanceof V.VariableAssignment){let x=E,D=this.state.PopEvaluationStack();return this.state.variablesState.Assign(x,D),!0}else if(E instanceof B.VariableReference){let x=E,D=null;if(x.pathForCount!=null){let R=x.containerForCount,Z=this.state.VisitCountForContainer(R);D=new o.IntValue(Z)}else D=this.state.variablesState.GetVariableWithName(x.name),D==null&&(this.Warning("Variable not found: '"+x.name+"'. Using default value of 0 (false). This can happen with temporary variables if the declaration hasn't yet been hit. Globals are always given a default value on load if a value doesn't exist in the save state."),D=new o.IntValue(0));return this.state.PushEvaluationStack(D),!0}else if(E instanceof k.NativeFunctionCall){let x=E,D=this.state.PopEvaluationStack(x.numberOfParameters),R=x.Call(D);return this.state.PushEvaluationStack(R),!0}return!1}ChoosePathString(E,x=!0,D=[]){if(this.IfAsyncWeCant("call ChoosePathString right now"),this.onChoosePathString!==null&&this.onChoosePathString(E,D),x)this.ResetCallstack();else if(this.state.callStack.currentElement.type==m.PushPopType.Function){let R="",Z=this.state.callStack.currentElement.currentPointer.container;throw Z!=null&&(R="("+Z.path.toString()+") "),new Error("Story was running a function "+R+"when you called ChoosePathString("+E+`) - this is almost certainly not not what you want! Full stack trace:
28
+ `+this.state.callStack.callStackTrace)}this.state.PassArgumentsToEvaluationStack(D),this.ChoosePath(new T.Path(E))}IfAsyncWeCant(E){if(this._asyncContinueActive)throw new Error("Can't "+E+". Story is in the middle of a ContinueAsync(). Make more ContinueAsync() calls or a single Continue() call beforehand.")}ChoosePath(E,x=!0){this.state.SetChosenPath(E,x),this.VisitChangedContainersDueToDivert()}ChooseChoiceIndex(E){E=E;let x=this.currentChoices;this.Assert(E>=0&&E<x.length,"choice out of range");let D=x[E];if(this.onMakeChoice!==null&&this.onMakeChoice(D),D.threadAtGeneration===null)return(0,C.throwNullException)("choiceToChoose.threadAtGeneration");if(D.targetPath===null)return(0,C.throwNullException)("choiceToChoose.targetPath");this.state.callStack.currentThread=D.threadAtGeneration,this.ChoosePath(D.targetPath)}HasFunction(E){try{return this.KnotContainerWithName(E)!=null}catch{return!1}}EvaluateFunction(E,x=[],D=!1){if(this.onEvaluateFunction!==null&&this.onEvaluateFunction(E,x),this.IfAsyncWeCant("evaluate a function"),E==null)throw new Error("Function is null");if(E==""||E.trim()=="")throw new Error("Function is empty or white space.");let R=this.KnotContainerWithName(E);if(R==null)throw new Error("Function doesn't exist: '"+E+"'");let Z=[];Z.push(...this.state.outputStream),this._state.ResetOutput(),this.state.StartFunctionEvaluationFromGame(R,x);let tt=new q.StringBuilder;for(;this.canContinue;)tt.Append(this.Continue());let ft=tt.toString();this._state.ResetOutput(Z);let L=this.state.CompleteFunctionEvaluationFromGame();return this.onCompleteEvaluateFunction!=null&&this.onCompleteEvaluateFunction(E,x,ft,L),D?{returned:L,output:ft}:L}EvaluateExpression(E){let x=this.state.callStack.elements.length;this.state.callStack.Push(m.PushPopType.Tunnel),this._temporaryEvaluationContainer=E,this.state.GoToStart();let D=this.state.evaluationStack.length;return this.Continue(),this._temporaryEvaluationContainer=null,this.state.callStack.elements.length>x&&this.state.PopCallStack(),this.state.evaluationStack.length>D?this.state.PopEvaluationStack():null}CallExternalFunction(E,x){if(E===null)return(0,C.throwNullException)("funcName");let D=this._externals.get(E),R=null,Z=typeof D<"u";if(Z&&!D.lookAheadSafe&&this._state.inStringEvaluation&&this.Error("External function "+E+` could not be called because 1) it wasn't marked as lookaheadSafe when BindExternalFunction was called and 2) the story is in the middle of string generation, either because choice text is being generated, or because you have ink like "hello {func()}". You can work around this by generating the result of your function into a temporary variable before the string or choice gets generated: ~ temp x = `+E+"()"),Z&&!D.lookAheadSafe&&this._stateSnapshotAtLastNewline!==null){this._sawLookaheadUnsafeFunctionAfterNewline=!0;return}if(!Z)if(this.allowExternalFunctionFallbacks){R=this.KnotContainerWithName(E),this.Assert(R!==null,"Trying to call EXTERNAL function '"+E+"' which has not been bound, and fallback ink function could not be found."),this.state.callStack.Push(m.PushPopType.Function,void 0,this.state.outputStream.length),this.state.divertedPointer=O.Pointer.StartOf(R);return}else this.Assert(!1,"Trying to call EXTERNAL function '"+E+"' which has not been bound (and ink fallbacks disabled).");let tt=[];for(let $=0;$<x;++$){let rt=(0,N.asOrThrows)(this.state.PopEvaluationStack(),o.Value).valueObject;tt.push(rt)}tt.reverse();let ft=D.function(tt),L=null;ft!=null?(L=o.Value.Create(ft),this.Assert(L!==null,"Could not create ink value from returned object of type "+typeof ft)):L=new f.Void,this.state.PushEvaluationStack(L)}BindExternalFunctionGeneral(E,x,D=!0){this.IfAsyncWeCant("bind an external function"),this.Assert(!this._externals.has(E),"Function '"+E+"' has already been bound."),this._externals.set(E,{function:x,lookAheadSafe:D})}TryCoerce(E){return E}BindExternalFunction(E,x,D=!1){this.Assert(x!=null,"Can't bind a null function"),this.BindExternalFunctionGeneral(E,R=>{this.Assert(R.length>=x.length,"External function expected "+x.length+" arguments");let Z=[];for(let tt=0,ft=R.length;tt<ft;tt++)Z[tt]=this.TryCoerce(R[tt]);return x.apply(null,Z)},D)}UnbindExternalFunction(E){this.IfAsyncWeCant("unbind an external a function"),this.Assert(this._externals.has(E),"Function '"+E+"' has not been bound."),this._externals.delete(E)}ValidateExternalBindings(){let E=null,x=null,D=arguments[1]||new Set;if(arguments[0]instanceof u.Container&&(E=arguments[0]),arguments[0]instanceof h.InkObject&&(x=arguments[0]),E===null&&x===null)if(this.ValidateExternalBindings(this._mainContentContainer,D),this._hasValidatedExternals=!0,D.size==0)this._hasValidatedExternals=!0;else{let R="Error: Missing function binding for external";R+=D.size>1?"s":"",R+=": '",R+=Array.from(D).join("', '"),R+="' ",R+=this.allowExternalFunctionFallbacks?", and no fallback ink function found.":" (ink fallbacks disabled)",this.Error(R)}else if(E!=null){for(let R of E.content){let Z=R;(Z==null||!Z.hasValidName)&&this.ValidateExternalBindings(R,D)}for(let[,R]of E.namedContent)this.ValidateExternalBindings((0,N.asOrNull)(R,h.InkObject),D)}else if(x!=null){let R=(0,N.asOrNull)(x,A.Divert);if(R&&R.isExternal){let Z=R.targetPathString;if(Z===null)return(0,C.throwNullException)("name");this._externals.has(Z)||this.allowExternalFunctionFallbacks&&this.mainContentContainer.namedContent.has(Z)||D.add(Z)}}}ObserveVariable(E,x){if(this.IfAsyncWeCant("observe a new variable"),this._variableObservers===null&&(this._variableObservers=new Map),!this.state.variablesState.GlobalVariableExistsWithName(E))throw new Error("Cannot observe variable '"+E+"' because it wasn't declared in the ink story.");this._variableObservers.has(E)?this._variableObservers.get(E).push(x):this._variableObservers.set(E,[x])}ObserveVariables(E,x){for(let D=0,R=E.length;D<R;D++)this.ObserveVariable(E[D],x[D])}RemoveVariableObserver(E,x){if(this.IfAsyncWeCant("remove a variable observer"),this._variableObservers!==null){if(x!=null){if(this._variableObservers.has(x))if(E!=null){let D=this._variableObservers.get(x);D!=null&&(D.splice(D.indexOf(E),1),D.length===0&&this._variableObservers.delete(x))}else this._variableObservers.delete(x)}else if(E!=null){let D=this._variableObservers.keys();for(let R of D){let Z=this._variableObservers.get(R);Z!=null&&(Z.splice(Z.indexOf(E),1),Z.length===0&&this._variableObservers.delete(R))}}}}VariableStateDidChangeEvent(E,x){if(this._variableObservers===null)return;let D=this._variableObservers.get(E);if(typeof D<"u"){if(!(x instanceof o.Value))throw new Error("Tried to get the value of a variable that isn't a standard type");let R=(0,N.asOrThrows)(x,o.Value);for(let Z of D)Z(E,R.valueObject)}}get globalTags(){return this.TagsAtStartOfFlowContainerWithPathString("")}TagsForContentAtPath(E){return this.TagsAtStartOfFlowContainerWithPathString(E)}TagsAtStartOfFlowContainerWithPathString(E){let x=new T.Path(E),D=this.ContentAtPath(x).container;if(D===null)return(0,C.throwNullException)("flowContainer");for(;;){let tt=D.content[0];if(tt instanceof u.Container)D=tt;else break}let R=!1,Z=null;for(let tt of D.content){let ft=(0,N.asOrNull)(tt,p.ControlCommand);if(ft!=null)ft.commandType==p.ControlCommand.CommandType.BeginTag?R=!0:ft.commandType==p.ControlCommand.CommandType.EndTag&&(R=!1);else if(R){let L=(0,N.asOrNull)(tt,o.StringValue);L!==null?(Z===null&&(Z=[]),L.value!==null&&Z.push(L.value)):this.Error("Tag contained non-text content. Only plain text is allowed when using globalTags or TagsAtContentPath. If you want to evaluate dynamic content, you need to use story.Continue().")}else break}return Z}BuildStringOfHierarchy(){let E=new q.StringBuilder;return this.mainContentContainer.BuildStringOfHierarchy(E,0,this.state.currentPointer.Resolve()),E.toString()}BuildStringOfContainer(E){let x=new q.StringBuilder;return E.BuildStringOfHierarchy(x,0,this.state.currentPointer.Resolve()),x.toString()}NextContent(){if(this.state.previousPointer=this.state.currentPointer.copy(),!(!this.state.divertedPointer.isNull&&(this.state.currentPointer=this.state.divertedPointer.copy(),this.state.divertedPointer=O.Pointer.Null,this.VisitChangedContainersDueToDivert(),!this.state.currentPointer.isNull))&&!this.IncrementContentPointer()){let E=!1;this.state.callStack.CanPop(m.PushPopType.Function)?(this.state.PopCallStack(m.PushPopType.Function),this.state.inExpressionEvaluation&&this.state.PushEvaluationStack(new f.Void),E=!0):this.state.callStack.canPopThread?(this.state.callStack.PopThread(),E=!0):this.state.TryExitFunctionEvaluationFromGame(),E&&!this.state.currentPointer.isNull&&this.NextContent()}}IncrementContentPointer(){let E=!0,x=this.state.callStack.currentElement.currentPointer.copy();if(x.index++,x.container===null)return(0,C.throwNullException)("pointer.container");for(;x.index>=x.container.content.length;){E=!1;let D=(0,N.asOrNull)(x.container.parent,u.Container);if(!(D instanceof u.Container))break;let R=D.content.indexOf(x.container);if(R==-1)break;if(x=new O.Pointer(D,R),x.index++,E=!0,x.container===null)return(0,C.throwNullException)("pointer.container")}return E||(x=O.Pointer.Null),this.state.callStack.currentElement.currentPointer=x.copy(),E}TryFollowDefaultInvisibleChoice(){let E=this._state.currentChoices,x=E.filter(R=>R.isInvisibleDefault);if(x.length==0||E.length>x.length)return!1;let D=x[0];return D.targetPath===null?(0,C.throwNullException)("choice.targetPath"):D.threadAtGeneration===null?(0,C.throwNullException)("choice.threadAtGeneration"):(this.state.callStack.currentThread=D.threadAtGeneration,this._stateSnapshotAtLastNewline!==null&&(this.state.callStack.currentThread=this.state.callStack.ForkThread()),this.ChoosePath(D.targetPath,!1),!0)}NextSequenceShuffleIndex(){let E=(0,N.asOrNull)(this.state.PopEvaluationStack(),o.IntValue);if(!(E instanceof o.IntValue))return this.Error("expected number of elements in sequence for shuffle index"),0;let x=this.state.currentPointer.container;if(x===null)return(0,C.throwNullException)("seqContainer");if(E.value===null)return(0,C.throwNullException)("numElementsIntVal.value");let D=E.value,R=(0,N.asOrThrows)(this.state.PopEvaluationStack(),o.IntValue).value;if(R===null)return(0,C.throwNullException)("seqCount");let Z=R/D,tt=R%D,ft=x.path.toString(),L=0;for(let dt=0,Ct=ft.length;dt<Ct;dt++)L+=ft.charCodeAt(dt)||0;let $=L+Z+this.state.storySeed,rt=new j.PRNG(Math.floor($)),ut=[];for(let dt=0;dt<D;++dt)ut.push(dt);for(let dt=0;dt<=tt;++dt){let Ct=rt.next()%ut.length,Nt=ut[Ct];if(ut.splice(Ct,1),dt==tt)return Nt}throw new Error("Should never reach here")}Error(E,x=!1){let D=new M.StoryException(E);throw D.useEndLineNumber=x,D}Warning(E){this.AddError(E,!0)}AddError(E,x=!1,D=!1){let R=this.currentDebugMetadata,Z=x?"WARNING":"ERROR";if(R!=null){let tt=D?R.endLineNumber:R.startLineNumber;E="RUNTIME "+Z+": '"+R.fileName+"' line "+tt+": "+E}else this.state.currentPointer.isNull?E="RUNTIME "+Z+": "+E:E="RUNTIME "+Z+": ("+this.state.currentPointer+"): "+E;this.state.AddError(E,x),x||this.state.ForceEnd()}Assert(E,x=null){if(E==!1)throw x==null&&(x="Story assert"),new Error(x+" "+this.currentDebugMetadata)}get currentDebugMetadata(){let E,x=this.state.currentPointer;if(!x.isNull&&x.Resolve()!==null&&(E=x.Resolve().debugMetadata,E!==null))return E;for(let D=this.state.callStack.elements.length-1;D>=0;--D)if(x=this.state.callStack.elements[D].currentPointer,!x.isNull&&x.Resolve()!==null&&(E=x.Resolve().debugMetadata,E!==null))return E;for(let D=this.state.outputStream.length-1;D>=0;--D)if(E=this.state.outputStream[D].debugMetadata,E!==null)return E;return null}get mainContentContainer(){return this._temporaryEvaluationContainer?this._temporaryEvaluationContainer:this._mainContentContainer}};r.Story=it,it.inkVersionCurrent=21,(function(ot){(function(E){E[E.NoChange=0]="NoChange",E[E.ExtendedBeyondNewline=1]="ExtendedBeyondNewline",E[E.NewlineRemoved=2]="NewlineRemoved"})(ot.OutputStateChange||(ot.OutputStateChange={}))})(it||(r.Story=it={}))})),Av=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Story=void 0;var u=Ss(),h=Ts(),c=oe(),s=Ee(),p=Cs(),m=Sn(),v=Wa(),y=gh(),A=As(),o=yh(),T=Ua(),f=Kn(),g=Si(),V=Ci(),B=Bt(),k=Hl(),M=Yl(),j=Ki(),q=class Xm extends m.FlowBase{get flowLevel(){return v.FlowLevel.Story}get hadError(){return this._hadError}get hadWarning(){return this._hadWarning}constructor(Q,O=!1){super(null,Q,null,!1,O),this._errorHandler=null,this._hadError=!1,this._hadWarning=!1,this._dontFlattenContainers=new Set,this._listDefs=new Map,this.constants=new Map,this.externals=new Map,this.countAllVisits=!1,this.ExportRuntime=(w=null)=>{var N,C;this._errorHandler=w,this.constants=new Map;for(const ot of this.FindAll(h.ConstantDeclaration)()){const E=this.constants.get(ot.constantName);if(E&&!E.Equals(ot.expression)){const x=`CONST '${ot.constantName}' has been redefined with a different value. Multiple definitions of the same CONST are valid so long as they contain the same value. Initial definition was on ${E.debugMetadata}.`;this.Error(x,ot,!1)}this.constants.set(ot.constantName,ot.expression)}this._listDefs=new Map;for(const ot of this.FindAll(A.ListDefinition)())!((N=ot.identifier)===null||N===void 0)&&N.name&&this._listDefs.set((C=ot.identifier)===null||C===void 0?void 0:C.name,ot);this.externals=new Map,this.ResolveWeavePointNaming();const S=this.runtimeObject,F=new c.Container;F.AddContent(s.ControlCommand.EvalStart());const K=[];for(const[ot,E]of this.variableDeclarations)if(E.isGlobalDeclaration){if(E.listDefinition)this._listDefs.set(ot,E.listDefinition),F.AddContent(E.listDefinition.runtimeObject),K.push(E.listDefinition.runtimeListDefinition);else{if(!E.expression)throw new Error;E.expression.GenerateIntoContainer(F)}const x=new V.VariableAssignment(ot,!0);x.isGlobal=!0,F.AddContent(x)}F.AddContent(s.ControlCommand.EvalEnd()),F.AddContent(s.ControlCommand.End()),this.variableDeclarations.size>0&&(F.name="global decl",S.AddToNamedContentOnly(F)),S.AddContent(s.ControlCommand.Done());const it=new T.Story(S,K);return this.runtimeObject=it,this.hadError||(this.FlattenContainersIn(S),this.ResolveReferences(this),this.hadError)?null:(it.ResetState(),it)},this.ResolveList=w=>{let N=this._listDefs.get(w);return N||null},this.ResolveListItem=(w,N,C=null)=>{let S=null;if(w)return(S=this._listDefs.get(w))?S.ItemNamed(N):null;{let F=null,K=null;for(const[,it]of this._listDefs.entries()){const ot=it.ItemNamed(N);ot&&(F?this.Error(`Ambiguous item name '${N}' found in multiple sets, including ${K.identifier} and ${it.identifier}`,C,!1):(F=ot,K=it))}return F}},this.FlattenContainersIn=w=>{const N=new Set;if(w.content)for(const C of w.content){const S=(0,B.asOrNull)(C,c.Container);S&&N.add(S)}if(w.namedContent)for(const[,C]of w.namedContent){const S=(0,B.asOrNull)(C,c.Container);S&&N.add(S)}for(const C of N)this.TryFlattenContainer(C),this.FlattenContainersIn(C)},this.TryFlattenContainer=w=>{if(w.namedContent&&w.namedContent.size>0||w.hasValidName||this._dontFlattenContainers.has(w))return;const N=(0,B.asOrNull)(w.parent,c.Container);if(N){let C=N.content.indexOf(w);N.content.splice(C,1);const S=w.ownDebugMetadata;if(w.content)for(const F of w.content)F.parent=null,S!==null&&F.ownDebugMetadata===null&&(F.debugMetadata=S),N.InsertContent(F,C),C+=1}},this.Error=(w,N,C)=>{let S=C?p.ErrorType.Warning:p.ErrorType.Error,F="";if(N instanceof u.AuthorWarning?(F+="TODO: ",S=p.ErrorType.Author):C?F+="WARNING: ":F+="ERROR: ",N&&N.debugMetadata!==null&&N.debugMetadata.startLineNumber>=1&&(N.debugMetadata.fileName!=null&&(F+=`'${N.debugMetadata.fileName}' `),F+=`line ${N.debugMetadata.startLineNumber}: `),F+=w,w=F,this._errorHandler!==null)this._errorHandler(w,S);else throw new Error(w);this._hadError=S===p.ErrorType.Error,this._hadWarning=S===p.ErrorType.Warning},this.ResetError=()=>{this._hadError=!1,this._hadWarning=!1},this.IsExternal=w=>this.externals.has(w),this.AddExternal=w=>{this.externals.has(w.name)?this.Error(`Duplicate EXTERNAL definition of '${w.name}'`,w,!1):w.name&&this.externals.set(w.name,w)},this.DontFlattenContainer=w=>{this._dontFlattenContainers.add(w)},this.NameConflictError=(w,N,C,S)=>{w.Error(`${S} '${N}': name has already been used for a ${C.typeName.toLowerCase()} on ${C.debugMetadata}`)},this.CheckForNamingCollisions=(w,N,C,S="")=>{var F;const K=S||w.typeName;if(Xm.IsReservedKeyword(N?.name)){w.Error(`'${N}' cannot be used for the name of a ${K.toLowerCase()} because it's a reserved keyword`);return}else if(M.FunctionCall.IsBuiltIn(N?.name||"")){w.Error(`'${N}' cannot be used for the name of a ${K.toLowerCase()} because it's a built in function`);return}const it=this.ContentWithNameAtLevel(N?.name||"",v.FlowLevel.Knot),ot=(0,B.asOrNull)(it,m.FlowBase);if(ot&&(ot!==w||C===f.SymbolType.Arg)){this.NameConflictError(w,N?.name||"",ot,K);return}if(C<f.SymbolType.List)return;for(const[D,R]of this._listDefs)if(N?.name===D&&w!==R&&R.variableAssignment!==w&&this.NameConflictError(w,N?.name,R,K),!(w instanceof o.ListElementDefinition))for(const Z of R.itemDefinitions)N?.name===Z.name&&this.NameConflictError(w,N?.name||"",Z,K);if(C<=f.SymbolType.Var)return;const E=N?.name&&this.variableDeclarations.get(N?.name)||null;if(E&&E!==w&&E.isGlobalDeclaration&&E.listDefinition==null&&this.NameConflictError(w,N?.name||"",E,K),C<f.SymbolType.SubFlowAndWeave)return;const x=new j.Path(N).ResolveFromContext(w);if(x&&x!==w){this.NameConflictError(w,N?.name||"",x,K);return}if(!(C<f.SymbolType.Arg)&&C!==f.SymbolType.Arg){let D=(0,B.asOrNull)(w,m.FlowBase);if(D||(D=(0,k.ClosestFlowBase)(w)),D&&D.hasParameters&&D.args){for(const R of D.args)if(((F=R.identifier)===null||F===void 0?void 0:F.name)===N?.name){w.Error(`${K} '${N}': name has already been used for a argument to ${D.identifier} on ${D.debugMetadata}`);return}}}}}get typeName(){return"Story"}PreProcessTopLevelObjects(Q){super.PreProcessTopLevelObjects(Q);const O=[];for(let w of Q)if(w instanceof y.IncludedFile){const N=w,C=Q.indexOf(w);if(Q.splice(C,1),N.includedStory){const S=[],F=N.includedStory;if(F.content!=null){for(const K of F.content)K instanceof m.FlowBase?O.push(K):S.push(K);S.push(new g.Text(`
29
+ `)),Q.splice(C,0,...S)}}continue}Q.splice(0,0,...O)}};r.Story=q,q.IsReservedKeyword=z=>{switch(z){case"true":case"false":case"not":case"return":case"else":case"VAR":case"CONST":case"temp":case"LIST":case"function":return!0}return!1}})),wv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.StringExpression=void 0;var u=Ee(),h=on(),c=Si(),s=Bt(),p=class Qm extends h.Expression{get isSingleString(){return!(this.content.length!==1||!(this.content[0]instanceof c.Text))}constructor(v){super(),this.GenerateIntoContainer=y=>{y.AddContent(u.ControlCommand.BeginString());for(const A of this.content)y.AddContent(A.runtimeObject);y.AddContent(u.ControlCommand.EndString())},this.toString=()=>{let y="";for(const A of this.content)y+=A;return y},this.AddContent(v)}get typeName(){return"String"}Equals(v){const y=(0,s.asOrNull)(v,Qm);return y===null||!this.isSingleString||!y.isSingleString?!1:this.toString()===y.toString()}};r.StringExpression=p})),xv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.LegacyTag=r.Tag=void 0;var u=Zt(),h=Ee(),c=class extends u.ParsedObject{constructor(m,v=!1){super(),this.GenerateRuntimeObject=()=>this.isStart?h.ControlCommand.BeginTag():h.ControlCommand.EndTag(),this.toString=()=>this.isStart?"#StartTag":"#EndTag",this.isStart=m,this.inChoice=v}get typeName(){return"Tag"}};r.Tag=c;var s=vh(),p=class extends s.Wrap{constructor(m){super(m)}get typeName(){return"Tag"}};r.LegacyTag=p})),Dv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.DefaultFileHandler=void 0;var u=class{constructor(h){this.rootPath=h,this.ResolveInkFilename=()=>{throw Error("Can't resolve filename because no FileHandler was provided when instantiating the parser / compiler.")},this.LoadInkFileContents=()=>{throw Error("Can't load ink content because no FileHandler was provided when instantiating the parser / compiler.")}}};r.DefaultFileHandler=u})),Nh=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.InkParser=void 0;var u=lv(),h=Ss(),c=lh(),s=sv(),p=ql(),m=ja(),v=hv(),y=Es(),A=mh(),o=Ns(),T=Ts(),f=dv(),g=mv(),V=qa(),B=Ga(),k=on(),M=vv(),j=gv(),q=Yl(),z=Ul(),Q=pv(),O=ws(),w=yv(),N=gh(),C=Cv(),S=ph(),F=Sv(),K=As(),it=yh(),ot=uh(),E=Zt(),x=Ki(),D=sh(),R=hh(),Z=oh(),tt=Ch(),ft=Sh(),L=Av(),$=wv(),rt=rh(),ut=xv(),dt=Si(),Ct=ch(),Nt=dh(),Yt=Ba(),qt=ah(),ge=Bt(),je=Os(),Ne=_s(),_i=Cs(),Et=Dv(),pt=class nh extends rt.StringParser{get fileHandler(){if(!this._fileHandler)throw new Error("No FileHandler defined");return this._fileHandler}set fileHandler(zt){this._fileHandler=zt}constructor(zt,Kt=null,he=null,Te=null,Nn=null){if(super(zt),this.ParseStory=()=>{const _=this.StatementsAtLevel(tt.StatementLevel.Top);return new L.Story(_,this._rootParser!==this)},this.SeparatedList=(_,P)=>{const U=this.Parse(_);if(U===null)return null;const st=[];st.push(U);do{const ht=this.BeginRule();if(P()===null){this.FailRule(ht);break}const bt=this.Parse(_);if(bt===null){this.FailRule(ht);break}this.SucceedRule(ht),st.push(bt)}while(!0);return st},this.CreateDebugMetadata=(_,P)=>{const U=new g.DebugMetadata;return U.startLineNumber=(_?.lineIndex||0)+1,U.endLineNumber=P.lineIndex+1,U.startCharacterNumber=(_?.characterInLineIndex||0)+1,U.endCharacterNumber=P.characterInLineIndex+1,U.fileName=this._filename,U},this.RuleDidSucceed=(_,P,U)=>{const st=(0,ge.asOrNull)(_,E.ParsedObject);st&&(st.debugMetadata=this.CreateDebugMetadata(P,U));const ht=Array.isArray(_)?_:null;if(ht!==null)for(const Xt of ht)(0,ge.asOrNull)(Xt,E.ParsedObject)&&(Xt.hasOwnDebugMetadata||(Xt.debugMetadata=this.CreateDebugMetadata(P,U)));const bt=(0,ge.asOrNull)(_,je.Identifier);bt!=null&&(bt.debugMetadata=this.CreateDebugMetadata(P,U))},this.OnStringParserError=(_,P,U=0,st=!1)=>{let ht=st?"WARNING:":"ERROR:";if(this._filename!==null&&(ht+=` '${this._filename}'`),ht+=` line ${U+1}: ${_}`,this._externalErrorHandler!==null)this._externalErrorHandler(ht,st?_i.ErrorType.Warning:_i.ErrorType.Error);else throw new Error(ht)},this.AuthorWarning=()=>{this.Whitespace();const _=this.Parse(this.IdentifierWithMetadata);if(_===null||_.name!=="TODO")return null;this.Whitespace(),this.ParseString(":"),this.Whitespace();const P=this.ParseUntilCharactersFromString(`
30
+ \r`);return P?new h.AuthorWarning(P):null},this.ExtendIdentifierCharacterRanges=_=>{const P=nh.ListAllCharacterRanges();for(const U of P)_.AddCharacters(U.ToCharacterSet())},this._parsingChoice=!1,this.Choice=()=>{let _=!0,P=this.Interleave(this.OptionalExclude(this.Whitespace),this.String("*"));if(!P){if(P=this.Interleave(this.OptionalExclude(this.Whitespace),this.String("+")),P===null)return null;_=!1}const U=this.Parse(this.BracketedName);this.Whitespace(),U!=null&&this.Newline();const st=this.Parse(this.ChoiceCondition);if(this.Whitespace(),this._parsingChoice)throw new Error("Already parsing a choice - shouldn't have nested choices");this._parsingChoice=!0;let ht=null;const bt=this.Parse(this.MixedTextAndLogic);bt&&(ht=new o.ContentList(bt));let Xt=null,ce=null;const Ji=this.ParseString("[")!==null;if(Ji){this.EndTagIfNecessary(ht);const fe=this.Parse(this.MixedTextAndLogic);fe!==null&&(Xt=new o.ContentList(fe)),this.Expect(this.String("]"),"closing ']' for weave-style option"),this.EndTagIfNecessary(Xt);let Ae=this.Parse(this.MixedTextAndLogic);Ae!==null&&(ce=new o.ContentList(Ae))}this.Whitespace(),this.EndTagIfNecessary(ce??ht);const Ka=this.Parse(this.MultiDivert);this._parsingChoice=!1,this.Whitespace();const Jl=!ht&&!ce&&!Xt;if(Jl&&Ka===null&&this.Warning("Choice is completely empty. Interpretting as a default fallback choice. Add a divert arrow to remove this warning: * ->"),!ht&&Ji&&!Xt&&this.Warning("Blank choice - if you intended a default fallback choice, use the `* ->` syntax"),ce||(ce=new o.ContentList),this.EndTagIfNecessary(ce),Ka!==null)for(const fe of Ka){const Ae=(0,ge.asOrNull)(fe,V.Divert);Ae&&Ae.isEmpty||ce.AddContent(fe)}ce.AddContent(new dt.Text(`
31
+ `));const We=new m.Choice(ht,Xt,ce);return U&&(We.identifier=U),We.indentationDepth=P.length,We.hasWeaveStyleInlineBrackets=Ji,We.condition=st,We.onceOnly=_,We.isInvisibleDefault=Jl,We},this.ChoiceCondition=()=>{const _=this.Interleave(this.ChoiceSingleCondition,this.ChoiceConditionsSpace);return _===null?null:_.length===1?_[0]:new ot.MultipleConditionExpression(_)},this.ChoiceConditionsSpace=()=>(this.Newline(),this.Whitespace(),rt.ParseSuccess),this.ChoiceSingleCondition=()=>{if(this.ParseString("{")===null)return null;const _=this.Expect(this.Expression,"choice condition inside { }");return this.DisallowIncrement(_),this.Expect(this.String("}"),"closing '}' for choice condition"),_},this.Gather=()=>{const _=this.Parse(this.GatherDashes);if(_===null)return null;const P=Number(_),U=this.Parse(this.BracketedName),st=new z.Gather(U,P);return this.Newline(),st},this.GatherDashes=()=>{this.Whitespace();let _=0;for(;this.ParseDashNotArrow()!==null;)_+=1,this.Whitespace();return _===0?null:_},this.ParseDashNotArrow=()=>{const _=this.BeginRule();return this.ParseString("->")===null&&this.ParseSingleCharacter()==="-"?this.SucceedRule(_):this.FailRule(_)},this.BracketedName=()=>{if(this.ParseString("(")===null)return null;this.Whitespace();const _=this.Parse(this.IdentifierWithMetadata);return _===null?null:(this.Whitespace(),this.Expect(this.String(")"),"closing ')' for bracketed name"),_)},this.InnerConditionalContent=_=>{if(_===void 0){const ht=this.Parse(this.ConditionExpression),bt=this.Parse(()=>this.InnerConditionalContent(ht));return bt===null?null:bt}let P;const U=_!==null,st=this.Parse(this.Newline)===null;if(st&&!U)return null;if(st)P=this.InlineConditionalBranches();else{if(P=this.MultilineConditionalBranches(),P===null){if(_){let ht=this.StatementsAtLevel(tt.StatementLevel.InnerBlock);if(ht!==null){P=[new A.ConditionalSingleBranch(ht)];const bt=this.Parse(this.SingleMultilineCondition);bt&&(bt.isElse||(this.ErrorWithParsedObject("Expected an '- else:' clause here rather than an extra condition",bt),bt.isElse=!0),P.push(bt))}}if(P===null)return null}else if(P.length===1&&P[0].isElse&&_){const ht=new A.ConditionalSingleBranch(null);ht.isTrueBranch=!0,P.unshift(ht)}if(_){let ht=!1;for(let bt=0;bt<P.length;++bt){const Xt=P[bt],ce=bt===P.length-1;Xt.ownExpression?(Xt.matchingEquality=!0,ht=!0):ht&&ce?(Xt.matchingEquality=!0,Xt.isElse=!0):!ce&&P.length>2?this.ErrorWithParsedObject("Only final branch can be an 'else'. Did you miss a ':'?",Xt):bt===0?Xt.isTrueBranch=!0:Xt.isElse=!0}}else{for(let ht=0;ht<P.length;++ht){const bt=P[ht],Xt=ht===P.length-1;if(bt.ownExpression===null)if(Xt)bt.isElse=!0;else if(bt.isElse){const ce=P[P.length-1];ce.isElse?this.ErrorWithParsedObject("Multiple 'else' cases. Can have a maximum of one, at the end.",ce):this.ErrorWithParsedObject("'else' case in conditional should always be the final one",bt)}else this.ErrorWithParsedObject("Branch doesn't have condition. Are you missing a ':'? ",bt)}P.length===1&&P[0].ownExpression===null&&this.ErrorWithParsedObject("Condition block with no conditions",P[0])}}if(P===null)return null;for(const ht of P)ht.isInline=st;return new y.Conditional(_,P)},this.InlineConditionalBranches=()=>{const _=this.Interleave(this.MixedTextAndLogic,this.Exclude(this.String("|")),null,!1);if(_===null||_.length===0)return null;const P=[];if(_.length>2)this.Error("Expected one or two alternatives separated by '|' in inline conditional");else{const U=new A.ConditionalSingleBranch(_[0]);if(U.isTrueBranch=!0,P.push(U),_.length>1){const st=new A.ConditionalSingleBranch(_[1]);st.isElse=!0,P.push(st)}}return P},this.MultilineConditionalBranches=()=>{this.MultilineWhitespace();const _=this.OneOrMore(this.SingleMultilineCondition);return _===null?null:(this.MultilineWhitespace(),_)},this.SingleMultilineCondition=()=>{if(this.Whitespace(),this.ParseString("->")!==null||this.ParseString("-")===null)return null;this.Whitespace();let _=null;const P=this.Parse(this.ElseExpression)!==null;P||(_=this.Parse(this.ConditionExpression));let U=this.StatementsAtLevel(tt.StatementLevel.InnerBlock);_===null&&U===null&&(this.Error("expected content for the conditional branch following '-'"),U=[new dt.Text("")]),this.MultilineWhitespace();const st=new A.ConditionalSingleBranch(U);return st.ownExpression=_,st.isElse=P,st},this.ConditionExpression=()=>{const _=this.Parse(this.Expression);return _===null||(this.DisallowIncrement(_),this.Whitespace(),this.ParseString(":")===null)?null:_},this.ElseExpression=()=>this.ParseString("else")===null||(this.Whitespace(),this.ParseString(":")===null)?null:rt.ParseSuccess,this._nonTextPauseCharacters=null,this._nonTextEndCharacters=null,this._notTextEndCharactersChoice=null,this._notTextEndCharactersString=null,this.TrimEndWhitespace=(_,P)=>{if(_.length>0){const U=_.length-1,st=_[U];if(st instanceof dt.Text){const ht=st;ht.text=ht.text.replace(new RegExp(/[ \t]+$/g),""),P?ht.text+=" ":ht.text.length===0&&(_.splice(U,1),this.TrimEndWhitespace(_,!1))}}},this.LineOfMixedTextAndLogic=()=>{this.Parse(this.Whitespace);let _=this.Parse(this.MixedTextAndLogic);if(!_||!_.length)return null;const P=_[0];return P&&P.text&&P.text.startsWith("return")&&this.Warning("Do you need a '~' before 'return'? If not, perhaps use a glue: <> (since it's lowercase) or rewrite somehow?"),_.length===0?null:(_[_.length-1]instanceof V.Divert||this.TrimEndWhitespace(_,!1),this.EndTagIfNecessary(_),_.length>0&&_[0]instanceof ut.Tag&&_[0].isStart||_.push(new dt.Text(`
32
+ `)),this.Expect(this.EndOfLine,"end of line",this.SkipToNextLine),_)},this.MixedTextAndLogic=()=>{this.ParseObject(this.Spaced(this.String("~")))!==null&&this.Error("You shouldn't use a '~' here - tildas are for logic that's on its own line. To do inline logic, use { curly braces } instead");let _=this.Interleave(this.Optional(this.ContentText),this.Optional(this.InlineLogicOrGlueOrStartTag));if(!this._parsingChoice){const P=this.Parse(this.MultiDivert);P!==null&&(_===null&&(_=[]),this.EndTagIfNecessary(_),this.TrimEndWhitespace(_,!0),_.push(...P))}return _||null},this.ContentText=()=>this.ContentTextAllowingEscapeChar(),this.ContentTextAllowingEscapeChar=()=>{let _=null;do{let P=this.Parse(this.ContentTextNoEscape);const U=this.ParseString("\\")!==null;if(U||P!==null){if(_===null&&(_=""),P!==null&&(_+=String(P)),U){const st=this.ParseSingleCharacter();_+=st}}else break}while(!0);return _!==null?new dt.Text(_):null},this.ContentTextNoEscape=()=>{this._nonTextPauseCharacters===null&&(this._nonTextPauseCharacters=new p.CharacterSet("-<")),this._nonTextEndCharacters===null&&(this._nonTextEndCharacters=new p.CharacterSet(`{}|
33
+ \r\\#`),this._notTextEndCharactersChoice=new p.CharacterSet(this._nonTextEndCharacters),this._notTextEndCharactersChoice.AddCharacters("[]"),this._notTextEndCharactersString=new p.CharacterSet(this._nonTextEndCharacters),this._notTextEndCharactersString.AddCharacters('"'));const _=()=>this.OneOf([this.ParseDivertArrow,this.ParseThreadArrow,this.EndOfLine,this.Glue]);let P=null;this.parsingStringExpression?P=this._notTextEndCharactersString:this._parsingChoice?P=this._notTextEndCharactersChoice:P=this._nonTextEndCharacters;const U=this.ParseUntil(_,this._nonTextPauseCharacters,P);return U!==null?U:null},this.MultiDivert=()=>{this.Whitespace();let _=[];const P=this.Parse(this.StartThread);if(P)return _=[P],_;const U=this.Interleave(this.ParseDivertArrowOrTunnelOnwards,this.DivertIdentifierWithArguments);if(!U)return null;_=[],this.EndTagIfNecessary(_);for(let st=0;st<U.length;++st)if(st%2===0){if(U[st]==="->->"){st===0||st===U.length-1||st===U.length-2||this.Error("Tunnel onwards '->->' must only come at the begining or the start of a divert");const ht=new Ct.TunnelOnwards;st<U.length-1&&(ht.divertAfter=(0,ge.asOrNull)(U[st+1],V.Divert)),_.push(ht);break}}else{const ht=U[st];st<U.length-1&&(ht.isTunnel=!0),_.push(ht)}if(_.length===0&&U.length===1){const st=new V.Divert(null);st.isEmpty=!0,_.push(st),this._parsingChoice||this.Error("Empty diverts (->) are only valid on choices")}return _},this.StartThread=()=>{if(this.Whitespace(),this.ParseThreadArrow()===null)return null;this.Whitespace();const _=this.Expect(this.DivertIdentifierWithArguments,"target for new thread",()=>new V.Divert(null));return _.isThread=!0,_},this.DivertIdentifierWithArguments=()=>{this.Whitespace();const _=this.Parse(this.DotSeparatedDivertPathComponents);if(!_)return null;this.Whitespace();const P=this.Parse(this.ExpressionFunctionCallArguments);this.Whitespace();const U=new x.Path(_);return new V.Divert(U,P)},this.SingleDivert=()=>{const _=this.Parse(this.MultiDivert);if(!_||_.length!==1||_[0]instanceof Ct.TunnelOnwards)return null;const P=_[0];return P.isTunnel?null:P},this.DotSeparatedDivertPathComponents=()=>this.Interleave(this.Spaced(this.IdentifierWithMetadata),this.Exclude(this.String("."))),this.ParseDivertArrowOrTunnelOnwards=()=>{let _=0;for(;this.ParseString("->")!==null;)_+=1;return _===0?null:_===1?"->":(_===2||this.Error("Unexpected number of arrows in divert. Should only have '->' or '->->'"),"->->")},this.ParseDivertArrow=()=>this.ParseString("->"),this.ParseThreadArrow=()=>this.ParseString("<-"),this._binaryOperators=[],this._maxBinaryOpLength=0,this.TempDeclarationOrAssignment=()=>{this.Whitespace();const _=this.ParseTempKeyword();this.Whitespace();let P=null;if(_?P=this.Expect(this.IdentifierWithMetadata,"variable name"):P=this.Parse(this.IdentifierWithMetadata),P===null)return null;this.Whitespace();const U=this.ParseString("+")!==null,st=this.ParseString("-")!==null;if(U&&st&&this.Error("Unexpected sequence '+-'"),this.ParseString("=")===null)return _&&this.Error("Expected '='"),null;const ht=this.Expect(this.Expression,"value expression to be assigned");return U||st?new w.IncDecExpression(P,ht,U):new Nt.VariableAssignment({variableIdentifier:P,assignedExpression:ht,isTemporaryNewDeclaration:_})},this.DisallowIncrement=_=>{_ instanceof w.IncDecExpression&&this.Error("Can't use increment/decrement here. It can only be used on a ~ line")},this.ParseTempKeyword=()=>{const _=this.BeginRule();return this.Parse(this.Identifier)==="temp"?(this.SucceedRule(_),!0):(this.FailRule(_),!1)},this.ReturnStatement=()=>{if(this.Whitespace(),this.Parse(this.Identifier)!=="return")return null;this.Whitespace();const _=this.Parse(this.Expression);return new D.ReturnType(_)},this.Expression=(_=0)=>{this.Whitespace();let P=this.ExpressionUnary();if(P===null)return null;for(this.Whitespace();;){const U=this.BeginRule(),st=this.ParseInfixOperator();if(st!==null&&st.precedence>_){const ht=`right side of '${st.type}' expression`,bt=this.Expect(()=>this.ExpressionInfixRight(P,st),ht);if(bt===null)return this.FailRule(U),null;P=this.SucceedRule(U,bt);continue}this.FailRule(U);break}return this.Whitespace(),P},this.ExpressionUnary=()=>{const _=this.Parse(this.ExpressionDivertTarget);if(_!==null)return _;let P=this.OneOf([this.String("-"),this.String("!")]);P===null&&(P=this.Parse(this.ExpressionNot)),this.Whitespace();let U=this.OneOf([this.ExpressionList,this.ExpressionParen,this.ExpressionFunctionCall,this.ExpressionVariableName,this.ExpressionLiteral]);if(U===null&&P!==null&&(U=this.ExpressionUnary()),U===null)return null;P!==null&&(U=qt.UnaryExpression.WithInner(U,P)),this.Whitespace();const st=this.OneOf([this.String("++"),this.String("--")]);if(st!==null){const ht=st==="++";if(!(U instanceof Yt.VariableReference))this.Error(`can only increment and decrement variables, but saw '${U}'.`);else{const bt=U;U=new w.IncDecExpression(bt.identifier,ht)}}return U},this.ExpressionNot=()=>{const _=this.Identifier();return _==="not"?_:null},this.ExpressionLiteral=()=>this.OneOf([this.ExpressionFloat,this.ExpressionInt,this.ExpressionBool,this.ExpressionString]),this.ExpressionDivertTarget=()=>{this.Whitespace();const _=this.Parse(this.SingleDivert);return!_||_&&_.isThread?null:(this.Whitespace(),new B.DivertTarget(_))},this.ExpressionInt=()=>{const _=this.ParseInt();return _===null?null:new Ne.NumberExpression(_,"int")},this.ExpressionFloat=()=>{const _=this.ParseFloat();return _===null?null:new Ne.NumberExpression(_,"float")},this.ExpressionString=()=>{if(this.ParseString('"')===null)return null;this.parsingStringExpression=!0;let _=this.Parse(this.MixedTextAndLogic);return this.Expect(this.String('"'),"close quote for string expression"),this.parsingStringExpression=!1,_===null?_=[new dt.Text("")]:_.find(P=>P instanceof V.Divert)&&this.Error("String expressions cannot contain diverts (->)"),new $.StringExpression(_)},this.ExpressionBool=()=>{const _=this.Parse(this.Identifier);return _==="true"?new Ne.NumberExpression(!0,"bool"):_==="false"?new Ne.NumberExpression(!1,"bool"):null},this.ExpressionFunctionCall=()=>{const _=this.Parse(this.IdentifierWithMetadata);if(_===null)return null;this.Whitespace();const P=this.Parse(this.ExpressionFunctionCallArguments);return P===null?null:new q.FunctionCall(_,P)},this.ExpressionFunctionCallArguments=()=>{if(this.ParseString("(")===null)return null;const _=this.Exclude(this.String(","));let P=this.Interleave(this.Expression,_);return P===null&&(P=[]),this.Whitespace(),this.Expect(this.String(")"),"closing ')' for function call"),P},this.ExpressionVariableName=()=>{const _=this.Interleave(this.IdentifierWithMetadata,this.Exclude(this.Spaced(this.String("."))));return _===null||L.Story.IsReservedKeyword(_[0].name)?null:new Yt.VariableReference(_)},this.ExpressionParen=()=>{if(this.ParseString("(")===null)return null;const _=this.Parse(this.Expression);return _===null?null:(this.Whitespace(),this.Expect(this.String(")"),"closing parenthesis ')' for expression"),_)},this.ExpressionInfixRight=(_,P)=>{if(!_)return null;this.Whitespace();const U=this.Parse(()=>this.Expression(P.precedence));return U?new c.BinaryExpression(_,U,P.type):null},this.ParseInfixOperator=()=>{for(const _ of this._binaryOperators){const P=this.BeginRule();if(this.ParseString(_.type)!==null){if(_.requireWhitespace&&this.Whitespace()===null){this.FailRule(P);continue}return this.SucceedRule(P,_)}this.FailRule(P)}return null},this.ExpressionList=()=>{if(this.Whitespace(),this.ParseString("(")===null)return null;this.Whitespace();const _=this.SeparatedList(this.ListMember,this.Spaced(this.String(",")));return this.Whitespace(),this.ParseString(")")===null?null:new F.List(_)},this.ListMember=()=>{this.Whitespace();let _=this.Parse(this.IdentifierWithMetadata);if(_===null)return null;if(this.ParseString(".")!==null){const P=this.Expect(this.IdentifierWithMetadata,`element name within the set ${_}`);_.name+=`.${P?.name}`}return this.Whitespace(),_},this.RegisterExpressionOperators=()=>{this.RegisterBinaryOperator("&&",1),this.RegisterBinaryOperator("||",1),this.RegisterBinaryOperator("and",1,!0),this.RegisterBinaryOperator("or",1,!0),this.RegisterBinaryOperator("==",2),this.RegisterBinaryOperator(">=",2),this.RegisterBinaryOperator("<=",2),this.RegisterBinaryOperator("<",2),this.RegisterBinaryOperator(">",2),this.RegisterBinaryOperator("!=",2),this.RegisterBinaryOperator("?",3),this.RegisterBinaryOperator("has",3,!0),this.RegisterBinaryOperator("!?",3),this.RegisterBinaryOperator("hasnt",3,!0),this.RegisterBinaryOperator("^",3),this.RegisterBinaryOperator("+",4),this.RegisterBinaryOperator("-",5),this.RegisterBinaryOperator("*",6),this.RegisterBinaryOperator("/",7),this.RegisterBinaryOperator("%",8),this.RegisterBinaryOperator("mod",8,!0)},this.RegisterBinaryOperator=(_,P,U=!1)=>{const st=new C.InfixOperator(_,P,U);this._binaryOperators.push(st),this._maxBinaryOpLength=Math.max(this._maxBinaryOpLength,_.length)},this._openFilenames=[],this.IncludeStatement=()=>{if(this.Whitespace(),this.ParseString("INCLUDE")===null)return null;this.Whitespace();let _=this.Expect(()=>this.ParseUntilCharactersFromString(`
34
+ \r`),"filename for include statement");_=_.replace(new RegExp(/[ \t]+$/g),"");const P=this.fileHandler.ResolveInkFilename(_,this._filename);if(this.FilenameIsAlreadyOpen(P))return this.Error(`Recursive INCLUDE detected: '${P}' is already open.`),this.ParseUntilCharactersFromString(`\r
35
+ `),new N.IncludedFile(null);this.AddOpenFilename(P);let U=null,st="";try{st=this._rootParser.fileHandler.LoadInkFileContents(P,this._filename)}catch(ht){this.Error(`Failed to load: '${_}'.
36
+ Error:${ht}`)}return st!=null&&(U=new nh(st,_,this._externalErrorHandler,this._rootParser,this.fileHandler).ParseStory()),this.RemoveOpenFilename(P),new N.IncludedFile(U)},this.FilenameIsAlreadyOpen=_=>this._rootParser._openFilenames.includes(_),this.AddOpenFilename=_=>{this._rootParser._openFilenames.push(_)},this.RemoveOpenFilename=_=>{this._rootParser._openFilenames.splice(this._rootParser._openFilenames.indexOf(_),1)},this.KnotDefinition=()=>{const _=this.Parse(this.KnotDeclaration);if(_===null)return null;this.Expect(this.EndOfLine,"end of line after knot name definition",this.SkipToNextLine);const P=()=>this.StatementsAtLevel(tt.StatementLevel.Knot),U=this.Expect(P,"at least one line within the knot",this.KnotStitchNoContentRecoveryRule);return new S.Knot(_.name,U,_.args,_.isFunction)},this.KnotDeclaration=()=>{if(this.Whitespace(),this.KnotTitleEquals()===null)return null;this.Whitespace();const _=this.Parse(this.IdentifierWithMetadata);let P;const U=_?.name==="function";U?(this.Expect(this.Whitespace,"whitespace after the 'function' keyword"),P=this.Parse(this.IdentifierWithMetadata)):P=_,P===null&&(this.Error(`Expected the name of the ${U?"function":"knot"}`),P=new je.Identifier("")),this.Whitespace();const st=this.Parse(this.BracketedKnotDeclArguments);return this.Whitespace(),this.Parse(this.KnotTitleEquals),new j.FlowDecl(P,st,U)},this.KnotTitleEquals=()=>{const _=this.ParseCharactersFromString("=");return _===null||_.length<=1?null:_},this.StitchDefinition=()=>{const _=this.Parse(this.StitchDeclaration);if(_===null)return null;this.Expect(this.EndOfLine,"end of line after stitch name",this.SkipToNextLine);const P=()=>this.StatementsAtLevel(tt.StatementLevel.Stitch),U=this.Expect(P,"at least one line within the stitch",this.KnotStitchNoContentRecoveryRule);return new ft.Stitch(_.name,U,_.args,_.isFunction)},this.StitchDeclaration=()=>{if(this.Whitespace(),this.ParseString("=")===null||this.ParseString("=")!==null)return null;this.Whitespace();const _=this.ParseString("function")!==null;_&&this.Whitespace();const P=this.Parse(this.IdentifierWithMetadata);if(P===null)return null;this.Whitespace();const U=this.Parse(this.BracketedKnotDeclArguments);return this.Whitespace(),new j.FlowDecl(P,U,_)},this.KnotStitchNoContentRecoveryRule=()=>(this.ParseUntil(this.KnotDeclaration,new p.CharacterSet("="),null),[new dt.Text("<ERROR IN FLOW>")]),this.BracketedKnotDeclArguments=()=>{if(this.ParseString("(")===null)return null;let _=this.Interleave(this.Spaced(this.FlowDeclArgument),this.Exclude(this.String(",")));return this.Expect(this.String(")"),"closing ')' for parameter list"),_===null&&(_=[]),_},this.FlowDeclArgument=()=>{const _=this.Parse(this.IdentifierWithMetadata);this.Whitespace();const P=this.ParseDivertArrow();this.Whitespace();const U=this.Parse(this.IdentifierWithMetadata);if(_==null&&U===null)return null;const st=new u.Argument;return P!==null&&(st.isDivertTarget=!0),_!==null&&_.name==="ref"?(U===null&&this.Error("Expected an parameter name after 'ref'"),st.identifier=U,st.isByReference=!0):(st.isDivertTarget?st.identifier=U:st.identifier=_,st.identifier===null&&this.Error("Expected an parameter name"),st.isByReference=!1),st},this.ExternalDeclaration=()=>{this.Whitespace();const _=this.Parse(this.IdentifierWithMetadata);if(_===null||_.name!="EXTERNAL")return null;this.Whitespace();const P=this.Expect(this.IdentifierWithMetadata,"name of external function")||new je.Identifier("");this.Whitespace();let U=this.Expect(this.BracketedKnotDeclArguments,`declaration of arguments for EXTERNAL, even if empty, i.e. 'EXTERNAL ${P}()'`);U===null&&(U=[]);const st=U.map(ht=>{var bt;return(bt=ht.identifier)===null||bt===void 0?void 0:bt.name}).filter(ge.filterUndef);return new M.ExternalDeclaration(P,st)},this._identifierCharSet=null,this.LogicLine=()=>{if(this.Whitespace(),this.ParseString("~")===null)return null;this.Whitespace();const _=()=>this.OneOf([this.ReturnStatement,this.TempDeclarationOrAssignment,this.Expression]);let P=this.Expect(_,"expression after '~'",this.SkipToNextLine);if(P===null)return new o.ContentList;P instanceof k.Expression&&!(P instanceof q.FunctionCall||P instanceof w.IncDecExpression)&&this.Error(`Logic following a '~' can't be that type of expression. It can only be something like:
37
+ ~ return
38
+ ~ var x = blah
39
+ ~ x++
40
+ ~ myFunction()`);const U=(0,ge.asOrNull)(P,q.FunctionCall);return U&&(U.shouldPopReturnedValue=!0),P.Find(q.FunctionCall)()!==null&&(P=new o.ContentList(P,new dt.Text(`
41
+ `))),this.Expect(this.EndOfLine,"end of line",this.SkipToNextLine),P},this.VariableDeclaration=()=>{if(this.Whitespace(),this.Parse(this.Identifier)!=="VAR")return null;this.Whitespace();const _=this.Expect(this.IdentifierWithMetadata,"variable name");this.Whitespace(),this.Expect(this.String("="),"the '=' for an assignment of a value, e.g. '= 5' (initial values are mandatory)"),this.Whitespace();const P=this.Expect(this.Expression,"initial value for ");return P?(P instanceof Ne.NumberExpression||P instanceof $.StringExpression||P instanceof B.DivertTarget||P instanceof Yt.VariableReference||P instanceof F.List||this.Error("initial value for a variable must be a number, constant, list or divert target"),this.Parse(this.ListElementDefinitionSeparator)!==null?this.Error("Unexpected ','. If you're trying to declare a new list, use the LIST keyword, not VAR"):P instanceof $.StringExpression&&(P.isSingleString||this.Error("Constant strings cannot contain any logic.")),new Nt.VariableAssignment({assignedExpression:P,isGlobalDeclaration:!0,variableIdentifier:_})):null},this.ListDeclaration=()=>{if(this.Whitespace(),this.Parse(this.Identifier)!="LIST")return null;this.Whitespace();const _=this.Expect(this.IdentifierWithMetadata,"list name");this.Whitespace(),this.Expect(this.String("="),"the '=' for an assignment of the list definition"),this.Whitespace();const P=this.Expect(this.ListDefinition,"list item names");return P?(P.identifier=new je.Identifier(_.name),new Nt.VariableAssignment({variableIdentifier:_,listDef:P})):null},this.ListDefinition=()=>{this.AnyWhitespace();const _=this.SeparatedList(this.ListElementDefinition,this.ListElementDefinitionSeparator);return _===null?null:new K.ListDefinition(_)},this.ListElementDefinitionSeparator=()=>(this.AnyWhitespace(),this.ParseString(",")===null?null:(this.AnyWhitespace(),",")),this.ListElementDefinition=()=>{const _=this.ParseString("(")!==null;let P=_;this.Whitespace();const U=this.Parse(this.IdentifierWithMetadata);if(U===null)return null;this.Whitespace(),_&&this.ParseString(")")!=null&&(P=!1,this.Whitespace());let st=null;if(this.ParseString("=")!==null){this.Whitespace();const ht=this.Expect(this.ExpressionInt,"value to be assigned to list item");ht!==null&&(st=ht.value),P&&(this.Whitespace(),this.ParseString(")")!==null&&(P=!1))}return P&&this.Error("Expected closing ')'"),new it.ListElementDefinition(U,_,st)},this.ConstDeclaration=()=>{if(this.Whitespace(),this.Parse(this.Identifier)!=="CONST")return null;this.Whitespace();const _=this.Expect(this.IdentifierWithMetadata,"constant name");this.Whitespace(),this.Expect(this.String("="),"the '=' for an assignment of a value, e.g. '= 5' (initial values are mandatory)"),this.Whitespace();const P=this.Expect(this.Expression,"initial value for ");return P instanceof Ne.NumberExpression||P instanceof B.DivertTarget||P instanceof $.StringExpression?P instanceof $.StringExpression&&(P.isSingleString||this.Error("Constant strings cannot contain any logic.")):this.Error("initial value for a constant must be a number or divert target"),new T.ConstantDeclaration(_,P)},this.InlineLogicOrGlueOrStartTag=()=>this.OneOf([this.InlineLogic,this.Glue,this.StartTag]),this.Glue=()=>this.ParseString("<>")!==null?new Q.Glue(new O.Glue):null,this.InlineLogic=()=>{if(this.ParseString("{")===null)return null;let _=this.parsingStringExpression,P=this.tagActive;this.Whitespace();const U=this.Expect(this.InnerLogic,"some kind of logic, conditional or sequence within braces: { ... }");if(U===null)return this.parsingStringExpression=_,null;this.DisallowIncrement(U);let st=(0,ge.asOrNull)(U,o.ContentList);return st||(st=new o.ContentList(U)),this.Whitespace(),this.Expect(this.String("}"),"closing brace '}' for inline logic"),this.parsingStringExpression=_,P||this.EndTagIfNecessary(st),st},this.InnerLogic=()=>{this.Whitespace();const _=this.ParseObject(this.SequenceTypeAnnotation);if(_!==null){const st=this.Expect(this.InnerSequenceObjects,"sequence elements (for cycle/stoping etc)");return st===null?null:new R.Sequence(st,_)}const P=this.Parse(this.ConditionExpression);if(P)return this.Expect(()=>this.InnerConditionalContent(P),"conditional content following query");const U=[this.InnerConditionalContent,this.InnerSequence,this.InnerExpression];for(const st of U){const ht=this.BeginRule(),bt=this.ParseObject(st);if(bt)if(this.Peek(this.Spaced(this.String("}")))===null)this.FailRule(ht);else return this.SucceedRule(ht,bt);else this.FailRule(ht)}return null},this.InnerExpression=()=>{const _=this.Parse(this.Expression);return _&&(_.outputWhenComplete=!0),_},this.IdentifierWithMetadata=()=>{const _=this.Identifier();return _===null?null:new je.Identifier(_)},this.Identifier=()=>{const _=this.ParseCharactersFromCharSet(this.identifierCharSet);if(_===null)return null;let P=!0;for(let U of _)if(!(U>="0"&&U<="9")){P=!1;break}return P?null:_},this._sequenceTypeSymbols=new p.CharacterSet("!&~$"),this.InnerSequence=()=>{this.Whitespace();let _=Z.SequenceType.Stopping;const P=this.Parse(this.SequenceTypeAnnotation);P!==null&&(_=P);const U=this.Parse(this.InnerSequenceObjects);return U===null||U.length<=1?null:new R.Sequence(U,_)},this.SequenceTypeAnnotation=()=>{let _=this.Parse(this.SequenceTypeSymbolAnnotation);if(_===null&&(_=this.Parse(this.SequenceTypeWordAnnotation)),_===null)return null;switch(_){case Z.SequenceType.Once:case Z.SequenceType.Cycle:case Z.SequenceType.Stopping:case Z.SequenceType.Shuffle:case Z.SequenceType.Shuffle|Z.SequenceType.Stopping:case Z.SequenceType.Shuffle|Z.SequenceType.Once:break;default:return this.Error(`Sequence type combination not supported: ${_}`),Z.SequenceType.Stopping}return _},this.SequenceTypeSymbolAnnotation=()=>{this._sequenceTypeSymbols===null&&(this._sequenceTypeSymbols=new p.CharacterSet("!&~$ "));let _=0;const P=this.ParseCharactersFromCharSet(this._sequenceTypeSymbols);if(P===null)return null;for(const U of P)switch(U){case"!":_|=Z.SequenceType.Once;break;case"&":_|=Z.SequenceType.Cycle;break;case"~":_|=Z.SequenceType.Shuffle;break;case"$":_|=Z.SequenceType.Stopping;break}return _===0?null:_},this.SequenceTypeWordAnnotation=()=>{const _=this.Interleave(this.SequenceTypeSingleWord,this.Exclude(this.Whitespace));if(_===null||_.length===0||this.ParseString(":")===null)return null;let P=0;for(const U of _)P|=U;return P},this.SequenceTypeSingleWord=()=>{let _=null;const P=this.Parse(this.IdentifierWithMetadata);if(P!==null)switch(P.name){case"once":_=Z.SequenceType.Once;break;case"cycle":_=Z.SequenceType.Cycle;break;case"shuffle":_=Z.SequenceType.Shuffle;break;case"stopping":_=Z.SequenceType.Stopping;break}return _===null?null:_},this.InnerSequenceObjects=()=>{const _=this.Parse(this.Newline)!==null;let P=null;return _?P=this.Parse(this.InnerMultilineSequenceObjects):P=this.Parse(this.InnerInlineSequenceObjects),P},this.InnerInlineSequenceObjects=()=>{const _=this.Interleave(this.Optional(this.MixedTextAndLogic),this.String("|"),null,!1);if(_===null)return null;const P=[];let U=!1;for(const st of _)if(st==="|")U||P.push(new o.ContentList),U=!1;else{const ht=st;ht===null?this.Error(`Expected content, but got ${st} (this is an ink compiler bug!)`):P.push(new o.ContentList(ht)),U=!0}return U||P.push(new o.ContentList),P},this.InnerMultilineSequenceObjects=()=>{this.MultilineWhitespace();const _=this.OneOrMore(this.SingleMultilineSequenceElement);return _===null?null:_},this.SingleMultilineSequenceElement=()=>{if(this.Whitespace(),this.ParseString("->")!==null||this.ParseString("-")===null)return null;this.Whitespace();const _=this.StatementsAtLevel(tt.StatementLevel.InnerBlock);return _===null?this.MultilineWhitespace():_.unshift(new dt.Text(`
42
+ `)),new o.ContentList(_)},this._statementRulesAtLevel=[],this._statementBreakRulesAtLevel=[],this.StatementsAtLevel=_=>(_===tt.StatementLevel.InnerBlock&&this.Parse(this.GatherDashes)!==null&&this.Error("You can't use a gather (the dashes) within the { curly braces } context. For multi-line sequences and conditions, you should only use one dash."),this.Interleave(this.Optional(this.MultilineWhitespace),()=>this.StatementAtLevel(_),()=>this.StatementsBreakForLevel(_))),this.StatementAtLevel=_=>{const P=this._statementRulesAtLevel[_],U=this.OneOf(P);return _===tt.StatementLevel.Top&&U instanceof D.ReturnType&&this.Error("should not have return statement outside of a knot"),U},this.StatementsBreakForLevel=_=>{this.Whitespace();const P=this._statementBreakRulesAtLevel[_],U=this.OneOf(P);return U===null?null:U},this.GenerateStatementLevelRules=()=>{const _=Object.values(tt.StatementLevel);this._statementRulesAtLevel="f".repeat(_.length).split("f").map(()=>[]),this._statementBreakRulesAtLevel="f".repeat(_.length).split("f").map(()=>[]);for(const P of _){const U=[],st=[];U.push(this.Line(this.MultiDivert)),P>=tt.StatementLevel.Top&&U.push(this.KnotDefinition),U.push(this.Line(this.Choice)),U.push(this.Line(this.AuthorWarning)),P>tt.StatementLevel.InnerBlock&&U.push(this.Gather),P>=tt.StatementLevel.Knot&&U.push(this.StitchDefinition),U.push(this.Line(this.ListDeclaration)),U.push(this.Line(this.VariableDeclaration)),U.push(this.Line(this.ConstDeclaration)),U.push(this.Line(this.ExternalDeclaration)),U.push(this.Line(this.IncludeStatement)),U.push(this.LogicLine),U.push(this.LineOfMixedTextAndLogic),P<=tt.StatementLevel.Knot&&st.push(this.KnotDeclaration),P<=tt.StatementLevel.Stitch&&st.push(this.StitchDeclaration),P<=tt.StatementLevel.InnerBlock&&(st.push(this.ParseDashNotArrow),st.push(this.String("}"))),this._statementRulesAtLevel[P]=U,this._statementBreakRulesAtLevel[P]=st}},this.SkipToNextLine=()=>(this.ParseUntilCharactersFromString(`
43
+ \r`),this.ParseNewline(),rt.ParseSuccess),this.Line=_=>()=>{const P=this.ParseObject(_);return P===null?null:(this.Expect(this.EndOfLine,"end of line",this.SkipToNextLine),P)},this.StartTag=()=>{if(this.Whitespace(),this.ParseString("#")===null)return null;this.parsingStringExpression&&this.Error("Tags aren't allowed inside of strings. Please use \\# if you want a hash symbol.");let _=null;if(this.tagActive){let P=new o.ContentList;P.AddContent(new ut.Tag(!1)),P.AddContent(new ut.Tag(!0)),_=P}else _=new ut.Tag(!0);return this.tagActive=!0,this.Whitespace(),_},this._inlineWhitespaceChars=new p.CharacterSet(" "),this.EndOfLine=()=>this.OneOf([this.Newline,this.EndOfFile]),this.Newline=()=>(this.Whitespace(),this.ParseNewline()===null?null:rt.ParseSuccess),this.EndOfFile=()=>(this.Whitespace(),this.endOfInput?rt.ParseSuccess:null),this.MultilineWhitespace=()=>{let _=this.OneOrMore(this.Newline);return _===null?null:_.length>=1?rt.ParseSuccess:null},this.Whitespace=()=>this.ParseCharactersFromCharSet(this._inlineWhitespaceChars)!==null?rt.ParseSuccess:null,this.Spaced=_=>()=>{this.Whitespace();const P=this.ParseObject(_);return P===null?null:(this.Whitespace(),P)},this.AnyWhitespace=()=>{let _=!1;for(;this.OneOf([this.Whitespace,this.MultilineWhitespace])!==null;)_=!0;return _?rt.ParseSuccess:null},this.MultiSpaced=_=>()=>{this.AnyWhitespace();const P=this.ParseObject(_);return P===null?null:(this.AnyWhitespace(),P)},this._filename=null,this._externalErrorHandler=null,this._fileHandler=null,this._filename=Kt,this.RegisterExpressionOperators(),this.GenerateStatementLevelRules(),this.errorHandler=this.OnStringParserError,this._externalErrorHandler=he,Nn===null?this._fileHandler=new Et.DefaultFileHandler:this._fileHandler=Nn,Te===null){if(this._rootParser=this,this._openFilenames=[],this._filename!==null){const _=this.fileHandler.ResolveInkFilename(this._filename);this._openFilenames.push(_)}}else this._rootParser=Te}PreProcessInputString(zt){return new v.CommentEliminator(zt).Process()}get parsingStringExpression(){return this.GetFlag(Number(f.CustomFlags.ParsingString))}set parsingStringExpression(zt){this.SetFlag(Number(f.CustomFlags.ParsingString),zt)}get tagActive(){return this.GetFlag(Number(f.CustomFlags.TagActive))}set tagActive(zt){this.SetFlag(Number(f.CustomFlags.TagActive),zt)}get identifierCharSet(){return this._identifierCharSet===null&&((this._identifierCharSet=new p.CharacterSet).AddRange("A","Z").AddRange("a","z").AddRange("0","9").Add("_"),this.ExtendIdentifierCharacterRanges(this._identifierCharSet)),this._identifierCharSet}EndTagIfNecessary(zt){this.tagActive&&(zt!=null&&(zt instanceof o.ContentList?zt.AddContent(new ut.Tag(!1)):zt.push(new ut.Tag(!1))),this.tagActive=!1)}};r.InkParser=pt,pt.LatinBasic=s.CharacterRange.Define("A","z",new p.CharacterSet().AddRange("[","`")),pt.LatinExtendedA=s.CharacterRange.Define("Ā","ſ"),pt.LatinExtendedB=s.CharacterRange.Define("ƀ","ɏ"),pt.Greek=s.CharacterRange.Define("Ͱ","Ͽ",new p.CharacterSet().AddRange("͸","΅").AddCharacters("ʹ͵͸·΋΍΢")),pt.Cyrillic=s.CharacterRange.Define("Ѐ","ӿ",new p.CharacterSet().AddRange("҂","҉")),pt.Armenian=s.CharacterRange.Define("԰","֏",new p.CharacterSet().AddCharacters("԰").AddRange("՗","ՠ").AddRange("ֈ","֎")),pt.Hebrew=s.CharacterRange.Define("֐","׿",new p.CharacterSet),pt.Arabic=s.CharacterRange.Define("؀","ۿ",new p.CharacterSet),pt.Korean=s.CharacterRange.Define("가","힯",new p.CharacterSet),pt.Latin1Supplement=s.CharacterRange.Define("€","ÿ",new p.CharacterSet),pt.Chinese=s.CharacterRange.Define("一","鿿",new p.CharacterSet),pt.ListAllCharacterRanges=()=>[pt.LatinBasic,pt.LatinExtendedA,pt.LatinExtendedB,pt.Arabic,pt.Armenian,pt.Cyrillic,pt.Greek,pt.Hebrew,pt.Korean,pt.Latin1Supplement,pt.Chinese]})),Rv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.GenerateStoryStats=void 0;var u=ja(),h=qa(),c=Ul(),s=ph(),p=Sh(),m=Si();function v(y){let A=y.FindAll(m.Text)(),o=0;for(const k of A){let M=0,j=!0;for(const q of k.text)q==" "||q==" "||q==`
44
+ `||q=="\r"?j=!0:j&&(M++,j=!1);o+=M}const T=y.FindAll(s.Knot)(),f=y.FindAll(p.Stitch)(),g=y.FindAll(u.Choice)(),V=y.FindAll(c.Gather)(k=>k.debugMetadata!=null),B=y.FindAll(h.Divert)();return{words:o,knots:T.length,functions:T.filter(k=>k.isFunction).length,stitches:f.length,gathers:V.length,diverts:B.length-1,choices:g.length}}r.GenerateStoryStats=v})),Vv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.JsonFileHandler=void 0;var u=class{constructor(h){this.fileHierarchy=h,this.ResolveInkFilename=c=>{if(Object.keys(this.fileHierarchy).includes(c))return c;throw new Error(`Cannot locate ${c}. Are you trying a relative import ? This is not yet implemented.`)},this.LoadInkFileContents=c=>{if(Object.keys(this.fileHierarchy).includes(c))return this.fileHierarchy[c];throw new Error(`Cannot open ${c}.`)}}};r.JsonFileHandler=u})),Pv=lt((r=>{Object.defineProperty(r,"__esModule",{value:!0}),r.Compiler=r.Story=r.InkList=r.JsonFileHandler=r.StatementLevel=r.InkParser=r.CompilerOptions=void 0;var u=ys(),h=av(),c=Cs(),s=Nh(),p=Jt(),m=Bt(),v=Rv(),y=ys();Object.defineProperty(r,"CompilerOptions",{enumerable:!0,get:function(){return y.CompilerOptions}});var A=Nh();Object.defineProperty(r,"InkParser",{enumerable:!0,get:function(){return A.InkParser}});var o=Ch();Object.defineProperty(r,"StatementLevel",{enumerable:!0,get:function(){return o.StatementLevel}});var T=Vv();Object.defineProperty(r,"JsonFileHandler",{enumerable:!0,get:function(){return T.JsonFileHandler}});var f=Ua();Object.defineProperty(r,"InkList",{enumerable:!0,get:function(){return f.InkList}}),Object.defineProperty(r,"Story",{enumerable:!0,get:function(){return f.Story}});var g=class{get errors(){return this._errors}get warnings(){return this._warnings}get authorMessages(){return this._authorMessages}get inputString(){return this._inputString}get options(){return this._options}get parsedStory(){if(!this._parsedStory)throw new Error;return this._parsedStory}get runtimeStory(){if(!this._runtimeStory)throw new Error("Compilation failed.");return this._runtimeStory}get parser(){if(!this._parser)throw new Error;return this._parser}get debugSourceRanges(){return this._debugSourceRanges}constructor(V,B=null){this._errors=[],this._warnings=[],this._authorMessages=[],this._parsedStory=null,this._runtimeStory=null,this._parser=null,this._debugSourceRanges=[],this.Compile=()=>(this._parser=new s.InkParser(this.inputString,this.options.sourceFilename||null,this.OnError,null,this.options.fileHandler),this._parsedStory=this.parser.ParseStory(),this.errors.length===0?(this.parsedStory.countAllVisits=this.options.countAllVisits,this._runtimeStory=this.parsedStory.ExportRuntime(this.OnError)):this._runtimeStory=null,this.runtimeStory),this.RetrieveDebugSourceForLatestContent=()=>{var k;for(const M of this.runtimeStory.state.outputStream){const j=(0,m.asOrNull)(M,p.StringValue);if(j!==null){const q=new h.DebugSourceRange(((k=j.value)===null||k===void 0?void 0:k.length)||0,j.debugMetadata,j.value||"unknown");this.debugSourceRanges.push(q)}}},this.GenerateStats=()=>this._parsedStory===null?null:(0,v.GenerateStoryStats)(this._parsedStory),this.DebugMetadataForContentAtOffset=k=>{let M=0,j=null;for(const q of this.debugSourceRanges){if(q.debugMetadata!==null&&(j=q.debugMetadata),k>=M&&k<M+q.length)return j;M+=q.length}return null},this.OnError=(k,M)=>{switch(M){case c.ErrorType.Author:this._authorMessages.push(k);break;case c.ErrorType.Warning:this._warnings.push(k);break;case c.ErrorType.Error:this._errors.push(k);break}this.options.errorHandler!==null&&this.options.errorHandler(k,M)},this._inputString=V,this._options=B||new u.CompilerOptions}};r.Compiler=g})),Ah=r=>{let u;const h=new Set,c=(A,o)=>{const T=typeof A=="function"?A(u):A;if(!Object.is(T,u)){const f=u;u=o??(typeof T!="object"||T===null)?T:Object.assign({},u,T),h.forEach(g=>g(u,f))}},s=()=>u,v={setState:c,getState:s,getInitialState:()=>y,subscribe:A=>(h.add(A),()=>h.delete(A))},y=u=r(c,s,v);return v},Lv=(r=>r?Ah(r):Ah),Mv=lt((r=>{var u=Symbol.for("react.transitional.element"),h=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),s=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),m=Symbol.for("react.consumer"),v=Symbol.for("react.context"),y=Symbol.for("react.forward_ref"),A=Symbol.for("react.suspense"),o=Symbol.for("react.memo"),T=Symbol.for("react.lazy"),f=Symbol.for("react.activity"),g=Symbol.iterator;function V(L){return L===null||typeof L!="object"?null:(L=g&&L[g]||L["@@iterator"],typeof L=="function"?L:null)}var B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},k=Object.assign,M={};function j(L,$,rt){this.props=L,this.context=$,this.refs=M,this.updater=rt||B}j.prototype.isReactComponent={},j.prototype.setState=function(L,$){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,$,"setState")},j.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function q(){}q.prototype=j.prototype;function z(L,$,rt){this.props=L,this.context=$,this.refs=M,this.updater=rt||B}var Q=z.prototype=new q;Q.constructor=z,k(Q,j.prototype),Q.isPureReactComponent=!0;var O=Array.isArray;function w(){}var N={H:null,A:null,T:null,S:null},C=Object.prototype.hasOwnProperty;function S(L,$,rt){var ut=rt.ref;return{$$typeof:u,type:L,key:$,ref:ut!==void 0?ut:null,props:rt}}function F(L,$){return S(L.type,$,L.props)}function K(L){return typeof L=="object"&&L!==null&&L.$$typeof===u}function it(L){var $={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(rt){return $[rt]})}var ot=/\/+/g;function E(L,$){return typeof L=="object"&&L!==null&&L.key!=null?it(""+L.key):$.toString(36)}function x(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(w,w):(L.status="pending",L.then(function($){L.status==="pending"&&(L.status="fulfilled",L.value=$)},function($){L.status==="pending"&&(L.status="rejected",L.reason=$)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function D(L,$,rt,ut,dt){var Ct=typeof L;(Ct==="undefined"||Ct==="boolean")&&(L=null);var Nt=!1;if(L===null)Nt=!0;else switch(Ct){case"bigint":case"string":case"number":Nt=!0;break;case"object":switch(L.$$typeof){case u:case h:Nt=!0;break;case T:return Nt=L._init,D(Nt(L._payload),$,rt,ut,dt)}}if(Nt)return dt=dt(L),Nt=ut===""?"."+E(L,0):ut,O(dt)?(rt="",Nt!=null&&(rt=Nt.replace(ot,"$&/")+"/"),D(dt,$,rt,"",function(ge){return ge})):dt!=null&&(K(dt)&&(dt=F(dt,rt+(dt.key==null||L&&L.key===dt.key?"":(""+dt.key).replace(ot,"$&/")+"/")+Nt)),$.push(dt)),1;Nt=0;var Yt=ut===""?".":ut+":";if(O(L))for(var qt=0;qt<L.length;qt++)ut=L[qt],Ct=Yt+E(ut,qt),Nt+=D(ut,$,rt,Ct,dt);else if(qt=V(L),typeof qt=="function")for(L=qt.call(L),qt=0;!(ut=L.next()).done;)ut=ut.value,Ct=Yt+E(ut,qt++),Nt+=D(ut,$,rt,Ct,dt);else if(Ct==="object"){if(typeof L.then=="function")return D(x(L),$,rt,ut,dt);throw $=String(L),Error("Objects are not valid as a React child (found: "+($==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":$)+"). If you meant to render a collection of children, use an array instead.")}return Nt}function R(L,$,rt){if(L==null)return L;var ut=[],dt=0;return D(L,ut,"","",function(Ct){return $.call(rt,Ct,dt++)}),ut}function Z(L){if(L._status===-1){var $=L._result;$=$(),$.then(function(rt){(L._status===0||L._status===-1)&&(L._status=1,L._result=rt)},function(rt){(L._status===0||L._status===-1)&&(L._status=2,L._result=rt)}),L._status===-1&&(L._status=0,L._result=$)}if(L._status===1)return L._result.default;throw L._result}var tt=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var $=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent($))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},ft={map:R,forEach:function(L,$,rt){R(L,function(){$.apply(this,arguments)},rt)},count:function(L){var $=0;return R(L,function(){$++}),$},toArray:function(L){return R(L,function($){return $})||[]},only:function(L){if(!K(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};r.Activity=f,r.Children=ft,r.Component=j,r.Fragment=c,r.Profiler=p,r.PureComponent=z,r.StrictMode=s,r.Suspense=A,r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=N,r.__COMPILER_RUNTIME={__proto__:null,c:function(L){return N.H.useMemoCache(L)}},r.cache=function(L){return function(){return L.apply(null,arguments)}},r.cacheSignal=function(){return null},r.cloneElement=function(L,$,rt){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var ut=k({},L.props),dt=L.key;if($!=null)for(Ct in $.key!==void 0&&(dt=""+$.key),$)!C.call($,Ct)||Ct==="key"||Ct==="__self"||Ct==="__source"||Ct==="ref"&&$.ref===void 0||(ut[Ct]=$[Ct]);var Ct=arguments.length-2;if(Ct===1)ut.children=rt;else if(1<Ct){for(var Nt=Array(Ct),Yt=0;Yt<Ct;Yt++)Nt[Yt]=arguments[Yt+2];ut.children=Nt}return S(L.type,dt,ut)},r.createContext=function(L){return L={$$typeof:v,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:m,_context:L},L},r.createElement=function(L,$,rt){var ut,dt={},Ct=null;if($!=null)for(ut in $.key!==void 0&&(Ct=""+$.key),$)C.call($,ut)&&ut!=="key"&&ut!=="__self"&&ut!=="__source"&&(dt[ut]=$[ut]);var Nt=arguments.length-2;if(Nt===1)dt.children=rt;else if(1<Nt){for(var Yt=Array(Nt),qt=0;qt<Nt;qt++)Yt[qt]=arguments[qt+2];dt.children=Yt}if(L&&L.defaultProps)for(ut in Nt=L.defaultProps,Nt)dt[ut]===void 0&&(dt[ut]=Nt[ut]);return S(L,Ct,dt)},r.createRef=function(){return{current:null}},r.forwardRef=function(L){return{$$typeof:y,render:L}},r.isValidElement=K,r.lazy=function(L){return{$$typeof:T,_payload:{_status:-1,_result:L},_init:Z}},r.memo=function(L,$){return{$$typeof:o,type:L,compare:$===void 0?null:$}},r.startTransition=function(L){var $=N.T,rt={};N.T=rt;try{var ut=L(),dt=N.S;dt!==null&&dt(rt,ut),typeof ut=="object"&&ut!==null&&typeof ut.then=="function"&&ut.then(w,tt)}catch(Ct){tt(Ct)}finally{$!==null&&rt.types!==null&&($.types=rt.types),N.T=$}},r.unstable_useCacheRefresh=function(){return N.H.useCacheRefresh()},r.use=function(L){return N.H.use(L)},r.useActionState=function(L,$,rt){return N.H.useActionState(L,$,rt)},r.useCallback=function(L,$){return N.H.useCallback(L,$)},r.useContext=function(L){return N.H.useContext(L)},r.useDebugValue=function(){},r.useDeferredValue=function(L,$){return N.H.useDeferredValue(L,$)},r.useEffect=function(L,$){return N.H.useEffect(L,$)},r.useEffectEvent=function(L){return N.H.useEffectEvent(L)},r.useId=function(){return N.H.useId()},r.useImperativeHandle=function(L,$,rt){return N.H.useImperativeHandle(L,$,rt)},r.useInsertionEffect=function(L,$){return N.H.useInsertionEffect(L,$)},r.useLayoutEffect=function(L,$){return N.H.useLayoutEffect(L,$)},r.useMemo=function(L,$){return N.H.useMemo(L,$)},r.useOptimistic=function(L,$){return N.H.useOptimistic(L,$)},r.useReducer=function(L,$,rt){return N.H.useReducer(L,$,rt)},r.useRef=function(L){return N.H.useRef(L)},r.useState=function(L){return N.H.useState(L)},r.useSyncExternalStore=function(L,$,rt){return N.H.useSyncExternalStore(L,$,rt)},r.useTransition=function(){return N.H.useTransition()},r.version="19.2.4"})),Ds=lt(((r,u)=>{u.exports=Mv()})),_t=iv(Ds(),1),Fv=r=>r;function Iv(r,u=Fv){const h=_t.useSyncExternalStore(r.subscribe,_t.useCallback(()=>u(r.getState()),[r,u]),_t.useCallback(()=>u(r.getInitialState()),[r,u]));return _t.useDebugValue(h),h}var wh=r=>{const u=Lv(r),h=c=>Iv(u,c);return Object.assign(h,u),h},Qi=(r=>r?wh(r):wh),jv=Pv(),Wv=ys(),xh=Ua(),kv=class zi{static _functions=new Map;static get functions(){return zi._functions}static set functions(u){zi._functions=u}static add(u,h){zi.functions.set(u,h)}static get(u){return zi.functions.get(u)}static bind(u,h){let c=zi.get(h)||(typeof window<"u"?window[h]:void 0);c&&u.story.BindExternalFunction(h,c.bind(u))}static clear(){zi.functions.clear()}},_n=class yi{static _functions=new Map;static excludeKeys=new Set(["clear","restart"]);static get functions(){return yi._functions}static clear(){for(let[u,h]of yi._functions.entries())yi.excludeKeys.has(u)||yi._functions.delete(u)}static add(u,h){yi.functions.set(u,h)}static process=(u,h)=>{let c=Rs(h,":");if(c)if(yi.functions.has(c.before))yi.functions.get(c.before)?.(c.after,u);else{let s=u.options;if(s[c.before]!==void 0){let p=c.after;switch(typeof s[c.before]){case"string":break;case"number":p=typeof p=="string"?parseFloat(p):void 0;break;case"boolean":p=!!p;break;default:p=void 0}p!==void 0&&!Number.isNaN(p)&&(s[c.before]=p)}}}},Rs=(r,u)=>{if(!r)return;let h=r.indexOf(u);return h===-1?{before:r.trim().toLowerCase()}:{before:r.slice(0,h).trim().toLowerCase(),after:r.slice(h+1).trim()}};_n.add("clear",(r,u)=>{u.clear()}),_n.add("restart",(r,u)=>{u.restart()});var Bv=class un{static _tags={};static _patterns=[];static get tags(){return un._tags}static get patterns(){return un._patterns}static clear=()=>{un._tags={},un._patterns=[]};static tag(u,h){un.tags[u]=h}static pattern(u,h){un.patterns.push({matcher:u,callback:h})}static process=(u,h=[])=>{if(!u)return"";let c={text:u,tags:h,classes:[]};return c.tags.length&&Object.keys(un.tags).length&&c.tags.forEach(s=>{let p=Rs(s,":");if(p&&p.before in un.tags){let m=un.tags[p.before];m&&m(c,p.before,p.after)}}),c.text&&un.patterns.length&&un.patterns.forEach(s=>{(typeof s.matcher=="string"&&c.text.includes(s.matcher)||s.matcher instanceof RegExp&&c.text.match(s.matcher))&&s.callback(c)}),c.text}},bn=class Hn{static _patches=[];static _options={};static get patches(){return Hn._patches}static set patches(u){Hn._patches=u}static add(u,h={}){Object.assign(Hn._options,h),u&&Hn._patches.push(u)}static apply(u,h){let c=u;Object.assign(c.options,Hn._options);for(let s of Hn._patches)s&&s.bind(c,h)()}static clear(){Hn._patches=[],Hn._options={}}},Kl=class Fa{static _tags=new Map;static excludeKeys=new Set(["unclickable"]);static get tags(){return Fa._tags}static clear=()=>{for(let[u,h]of this._tags.entries())this.excludeKeys.has(u)||this._tags.delete(u)};static add=(u,h)=>{Fa.tags.set(u,h)};static process=(u,h)=>{if(!u.text)return h;u.tags?.length&&Fa.tags.size&&u.tags.forEach(c=>{let s=Rs(c,":");s&&Fa.tags.has(s.before)&&Fa.tags.get(s.before)?.(h,s.after)})}};Kl.add("unclickable",r=>{r.type="unclickable"});var Dh="\0ink-divider\0",Gv={debug:!1},Rh=class{basePath;constructor(r){this.basePath=r?.basePath||""}resolveFilename(r){return this.basePath?`${this.basePath.replace(/\/$/,"")}/${r}`:r}loadFile(r){throw Error("loadFile must be implemented by subclass")}},qv=class{text;index;type;val;constructor(r,u,h="default"){this.text=r||"",this.index=u,this.type=h}},Xl=r=>{let u=r;return u.use=new Proxy({},{get:(h,c)=>()=>u(s=>s[c])}),u},Ql=Xl(Qi(r=>({choices:[],setChoices:u=>{r({choices:u.map(h=>{let c=new qv(h.text,h.index);return h.tags?.length&&Kl.process(h,c),c})})},clear:()=>r({choices:[]})}))),Zi=Xl(Qi(r=>({contents:[],setContents:u=>r({contents:u}),add:u=>{r(h=>({contents:[...h.contents,...u]}))},clear:()=>r({contents:[]})}))),zv=Xl(Qi(r=>({variables:new Map,setGlobalVars:u=>{let h=new Map,c=u._globalVariables;if(c)for(let s of c.keys()){let p=c.get(s);p&&h.set(s,p.value)}r({variables:h})}}))),Uv=class{title;story;options;_side_effects=[];_cleanups=[];_clears=[];_save_label=["contents"];constructor(r,u,h){this.options={...Gv,...h},this.story=r,this.title=u;let c=this.story.ToJson()||"";Hv(this),bn.apply(this,c),this.bindExternalFunctions(c),this.clears.push(()=>{this.contents.length=0})}get contents(){return Zi.getState().contents}set contents(r){Zi.getState().setContents(r)}get choices(){return Ql.getState().choices}get clears(){return this._clears}get cleanups(){return this._cleanups}get effects(){return this._side_effects}get save_label(){return this._save_label}continue(){let r=[];for(;this.story.canContinue;){let c=this.story.Continue()||"";this.story.currentTags&&(this.story.currentTags.forEach(s=>{_n.process(this,s),(s==="clear"||s==="restart")&&(r.length=0)}),c&&this.story.currentTags.length&&(c=Bv.process(c,this.story.currentTags))),c.trim()&&r.push(c)}Zi.getState().add(r);let{currentChoices:u,variablesState:h}=this.story;Ql.getState().setChoices(u),zv.getState().setGlobalVars(h)}choose(r){this.story.ChooseChoiceIndex(r),Zi.getState().add([Dh]),this.continue()}clear(){this.clears.forEach(r=>{r()})}restart(){this.story.ResetState(),this.clear(),this.continue()}useEffect(){this.effects.forEach(r=>{r&&r()})}dispose(){this.cleanups.forEach(r=>{r&&r()})}bindExternalFunctions=r=>{let u=Array.from(r.matchAll(/"x\(\)":"(\w+)/gi));new Set(u.map(h=>h[1]).filter(h=>h!==void 0)).forEach(h=>{kv.bind(this,h)})}};function Hv(r){let u=Object.getPrototypeOf(r);Object.getOwnPropertyNames(u).forEach(h=>{if(h!=="constructor"&&typeof Object.getOwnPropertyDescriptor(u,h)?.value=="function"){let c=r,s=c[h];s&&(c[h]=s.bind(r))}})}var Yv=class{handler;resolve;constructor(r){this.handler=r,this.resolve=r instanceof Rh?u=>r.resolveFilename(u):u=>u}ResolveInkFilename=r=>this.resolve(r);LoadInkFileContents=r=>this.handler.loadFile(r)};function Kv(r){let u=r.trim();return u.startsWith("{")&&u.endsWith("}")}function Xv(r,u){let h;if(r instanceof xh.Story)h=r;else if(typeof r=="string")h=Kv(r)?new xh.Story(r):new jv.Compiler(r,new Wv.CompilerOptions(null,[],!1,u?.errorHandler||null,u?.fileHandler?new Yv(u.fileHandler):null)).Compile();else throw Error("Invalid source type: expected string or Story");return new Uv(h,u?.title||"Ink Story",u)}var Qv=lt((r=>{var u=Symbol.for("react.transitional.element"),h=Symbol.for("react.fragment");function c(s,p,m){var v=null;if(m!==void 0&&(v=""+m),p.key!==void 0&&(v=""+p.key),"key"in p){m={};for(var y in p)y!=="key"&&(m[y]=p[y])}else m=p;return p=m.ref,{$$typeof:u,type:s,key:v,ref:p!==void 0?p:null,props:m}}r.jsx=c,r.jsxs=c})),Zv=lt(((r,u)=>{u.exports=Qv()})),St=Zv(),Vs=new class{_components=new Map;get(r){return this._components.get(r)}register(r,u){this._components.set(r,u)}unregister(r){this._components.delete(r)}clear(){this._components.clear()}has(r){return this._components.has(r)}},Jv="_choices_qiofu_1",$v="_item_qiofu_20",tg="_button_qiofu_40",eg="_disabled_qiofu_65",Xn={choices:Jv,"fade-in":"_fade-in_qiofu_1",item:$v,button:tg,disabled:eg},Vh=(0,_t.memo)(({choice:r,index:u,onClick:h})=>{let c=(0,_t.useCallback)(()=>{r.type!=="unclickable"&&h(r.index)},[r.index,r.type,h]),s=Vs.get(r.type);return s?(0,St.jsx)("li",{style:{"--index":u},children:(0,_t.createElement)(s,{choice:r,onClick:c,className:`inkweave-choice ${Xn.button}`,children:r.text})}):(0,St.jsx)("li",{className:Xn.item,style:{"--index":u},children:(0,St.jsx)("a",{onClick:c,className:`inkweave-choice ${Xn.button} ${r.type==="unclickable"?Xn.disabled:""}`,"aria-disabled":r.type==="unclickable",children:r.text})})},(r,u)=>r.choice.index===u.choice.index&&r.choice.type===u.choice.type&&r.choice.text===u.choice.text&&r.choice.val===u.choice.val);Vh.displayName="ChoiceItem";var ng=(0,_t.memo)(()=>{let r=Ps(),u=Ql(p=>p.choices),h=r,c=h&&"choicesCanShow"in h?h.choicesCanShow:!0,s=(0,_t.useCallback)(p=>{r.choose(p)},[r]);return(0,St.jsx)("ul",{"data-inkweave":"choices",className:`inkweave-choices ${Xn.choices}`,style:{visibility:c?"visible":"hidden"},children:u.map((p,m)=>(0,St.jsx)(Vh,{choice:p,index:m,onClick:s},p.index))},c?"visible":"hidden")}),ig={contents:"_contents_18tyw_1","fade-in":"_fade-in_18tyw_1"},ag=(0,_t.memo)(()=>{let r=Ps(),u=Zi(m=>m.contents),h=r,c=h?.visibleLines===void 0?u.length:h.visibleLines,s=r.options.linedelay??.05,p=(0,_t.useMemo)(()=>u.map((m,v)=>{let y={"--delay":`${(v>c?v-c:0)*s}s`},A=m===Dh,o=A?`divider_${v}`:`line_${v}_${m.slice(0,20)}`;return A?(0,St.jsx)("div",{style:y,children:(0,St.jsx)("hr",{className:"inkweave-divider"})},o):(0,St.jsx)("div",{style:y,children:(0,St.jsx)("p",{children:m})},o)}),[u,c,s]);return(0,St.jsx)("section",{className:`inkweave-contents ${ig.contents}`,children:p})}),lg={story:"_story_1hvvl_1"},Ph=(0,_t.createContext)(null),Ps=()=>{let r=(0,_t.useContext)(Ph);if(!r)throw Error("useStory must be used within StoryProvider");return r},rg=({ink:r,children:u})=>(0,St.jsx)(Ph.Provider,{value:r,children:u}),sg=(0,_t.memo)(({ink:r,children:u,className:h="",onInit:c})=>{let s=(0,_t.useRef)(c);return s.current=c,(0,_t.useEffect)(()=>{r.restart(),s.current?.(r)},[r]),(0,St.jsx)(rg,{ink:r,children:(0,St.jsxs)("div",{className:`inkweave-story ${lg.story} ${h}`.trim(),"data-inkweave":"story",children:[u,(0,St.jsx)(ag,{}),(0,St.jsx)(ng,{})]})})});function ug(r,u){let h;try{h=r()}catch{return}return{getItem:c=>{var s;const p=v=>v===null?null:JSON.parse(v,u?.reviver),m=(s=h.getItem(c))!=null?s:null;return m instanceof Promise?m.then(p):p(m)},setItem:(c,s)=>h.setItem(c,JSON.stringify(s,u?.replacer)),removeItem:c=>h.removeItem(c)}}var Ls=r=>u=>{try{const h=r(u);return h instanceof Promise?h:{then(c){return Ls(c)(h)},catch(c){return this}}}catch(h){return{then(c){return this},catch(c){return Ls(c)(h)}}}},og=(r,u)=>(h,c,s)=>{let p={storage:ug(()=>window.localStorage),partialize:k=>k,version:0,merge:(k,M)=>({...M,...k}),...u},m=!1,v=0;const y=new Set,A=new Set;let o=p.storage;if(!o)return r((...k)=>{console.warn(`[zustand persist middleware] Unable to update item '${p.name}', the given storage is currently unavailable.`),h(...k)},c,s);const T=()=>{const k=p.partialize({...c()});return o.setItem(p.name,{state:k,version:p.version})},f=s.setState;s.setState=(k,M)=>(f(k,M),T());const g=r((...k)=>(h(...k),T()),c,s);s.getInitialState=()=>g;let V;const B=()=>{var k,M;if(!o)return;const j=++v;m=!1,y.forEach(z=>{var Q;return z((Q=c())!=null?Q:g)});const q=((M=p.onRehydrateStorage)==null?void 0:M.call(p,(k=c())!=null?k:g))||void 0;return Ls(o.getItem.bind(o))(p.name).then(z=>{if(z)if(typeof z.version=="number"&&z.version!==p.version){if(p.migrate){const Q=p.migrate(z.state,z.version);return Q instanceof Promise?Q.then(O=>[!0,O]):[!0,Q]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,z.state];return[!1,void 0]}).then(z=>{var Q;if(j!==v)return;const[O,w]=z;if(V=p.merge(w,(Q=c())!=null?Q:g),h(V,!0),O)return T()}).then(()=>{j===v&&(q?.(c(),void 0),V=c(),m=!0,A.forEach(z=>z(V)))}).catch(z=>{j===v&&q?.(void 0,z)})};return s.persist={setOptions:k=>{p={...p,...k},k.storage&&(o=k.storage)},clearStorage:()=>{o?.removeItem(p.name)},getOptions:()=>p,rehydrate:()=>B(),hasHydrated:()=>m,onHydrate:k=>(y.add(k),()=>{y.delete(k)}),onFinishHydration:k=>(A.add(k),()=>{A.delete(k)})},p.skipHydration||B(),V||g},hg=og,En=class Lt{static _sound=null;static _music=null;static _sound_handler=()=>{};static _music_handler=()=>{};static get sound(){return Lt._sound}static get music(){return Lt._music}static get sound_handler(){return Lt._sound_handler}static get music_handler(){return Lt._music_handler}static set_music(u){Lt._music=new Audio(u),Lt._music.loop=!0,Lt._music_handler=()=>{Lt._music?.play()},Lt._music.addEventListener("canplaythrough",Lt._music_handler)}static set_sound(u){Lt._sound=new Audio(u),Lt._sound_handler=()=>{Lt._sound?.play()},Lt._sound.addEventListener("canplaythrough",Lt._sound_handler)}static cleanupSound(){Lt._sound&&(Lt._sound.pause(),Lt._sound.currentTime=0,Lt._sound.removeEventListener("canplaythrough",Lt._sound_handler),Lt._sound.src=""),Lt._sound=null,Lt._sound_handler=()=>{}}static cleanupMusic(){Lt._music&&(Lt._music.pause(),Lt._music.currentTime=0,Lt._music.removeEventListener("canplaythrough",Lt._music_handler),Lt._music.src=""),Lt._music=null,Lt._music_handler=()=>{}}},Lh=(r,u)=>u&&"resolveFilename"in u?u.resolveFilename(r):r,cg=()=>{_n.add("sound",(r,u)=>{r?(En.cleanupSound(),En.set_sound(Lh(r,u.options.fileHandler))):En.cleanupSound()}),_n.add("music",(r,u)=>{r?(En.cleanupMusic(),En.set_music(Lh(r,u.options.fileHandler))):En.cleanupMusic()}),bn.add(function(){this.audio=En,this.cleanups.push(()=>{En.cleanupSound(),En.cleanupMusic()})},{})},fg=(0,_t.memo)(({choice:r,onClick:u,className:h="",children:c})=>{let s=(0,_t.useRef)(null),p=(0,_t.useRef)(u),m=parseFloat(r.val||"0");return p.current=u,(0,_t.useEffect)(()=>{if(!(m<=0))return s.current=setInterval(()=>{p.current()},m*1e3),()=>{s.current&&clearInterval(s.current)}},[m]),(0,St.jsx)("a",{className:`${Xn.button} ${h}`.trim(),style:{display:"none"},children:c})}),dg=()=>{Kl.add("auto",(r,u)=>{r.type="auto",r.val=u}),Vs.register("auto",fg),bn.add(null,{})},Mh={local:localStorage,session:sessionStorage},Ms="local",Fs=()=>{let r=Mh[Ms];if(!r){let u=Object.keys(Mh).join(", ");throw Error(`Invalid storage type: "${Ms}". Valid types: ${u}`)}return r},mg=class{data;timestamp;meta;constructor(r){this.data=JSON.stringify(r),this.timestamp=new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}).format(Date.now()),this.meta="autogenerated"}},Is=Qi()(hg((r,u)=>({storage:new Map,setStorage:(h,c,s)=>{let p=new Map(u().storage),m=[...p.get(h)||[]];m[c]=new mg(s),p.set(h,m),r({storage:p})},changeFormat:h=>{Ms=h}}),{name:"inkStory",storage:{getItem:r=>{let u=Fs().getItem(r);if(!u)return null;try{let{state:h}=JSON.parse(u);return{state:{...h,storage:new Map(h.storage)}}}catch(h){return console.error("InkWeave: Failed to parse storage data:",h),null}},setItem:(r,u)=>{let h=JSON.stringify({state:{...u.state,storage:Array.from(u.state.storage.entries())}});Fs().setItem(r,h)},removeItem:r=>{Fs().removeItem(r)}}})),Fh={memory_format:"local"},vg=r=>Is(u=>u.storage.get(r)||null),gg=(r,u)=>{let h={state:u.story.state.toJson()};u.save_label.forEach(c=>{let s=u[c];c in u&&s!==void 0&&(typeof s=="string"||typeof s=="number"||typeof s=="boolean"||Array.isArray(s))&&(h[c]=s)}),Is.getState().setStorage(u.title,r,h)},pg=(r,u)=>{let h=null;try{h=JSON.parse(r)}catch(c){console.error("InkWeave: Failed to parse save data:",c);return}h&&(u.story.state.LoadJson(h.state),u.clear(),u.save_label.forEach(c=>{c in u&&u[c]!==void 0&&c in h&&(u[c]=h[c])}),u.continue())},yg=()=>{bn.add(()=>{Is.getState().changeFormat(Fh.memory_format)},Fh)},Zl={save:gg,load:pg,show:vg},Cg={autosave_enabled:!0},dC=()=>{_n.add("autosave",(r,u)=>{u.options.autosave_enabled&&Zl.save(1,u)}),bn.add(null,Cg)},js=new Map;function Sg(r){return`${r.type}_${r.text}_${r.val||""}`}function _g(r){let u=js.get(r)||0;return Date.now()<u}function bg(r){let u=js.get(r)||0,h=Math.max(0,u-Date.now());return Math.ceil(h/1e3)}function Eg(r,u){js.set(r,Date.now()+u*1e3)}var Tg=(0,_t.memo)(({choice:r,onClick:u,className:h="",children:c})=>{let s=parseFloat(r.val||"0"),p=Sg(r),m=Ps(),[,v]=(0,_t.useState)(0),y=(0,_t.useRef)(!0),A=_g(p),o=bg(p);(0,_t.useEffect)(()=>()=>{y.current=!1},[]),(0,_t.useEffect)(()=>{if(!A)return;let V=setInterval(()=>{y.current&&v(B=>B+1)},1e3);return()=>clearInterval(V)},[A]);let T=(0,_t.useCallback)(()=>{A||(u(),Eg(p,s),v(V=>V+1))},[A,s,u,p]),f=`${Xn?.button||""} ${h} ${A&&Xn?.disabled||""}`.trim(),g=m.options.cdTemplate||"{text} ({time})";return(0,St.jsx)("a",{className:f,onClick:T,children:A&&o>0?g.replace("{text}",String(c)).replace("{time}",String(o)):c})}),Og={cdTemplate:"{text} ({time})"},Ng=()=>{Kl.add("cd",(r,u)=>{r.type="cd",r.val=u}),Vs.register("cd",Tg),bn.add(null,Og)},Ag={linedelay:.05},Tn=Qi(r=>({contentComplete:!0,last_content:"",setContentComplete:u=>r({contentComplete:u}),setLastContent:u=>{if(u.length===0){r({last_content:""});return}let h=u[u.length-1];r({last_content:h})}})),wg=()=>{_n.add("linedelay",(r,u)=>{if(r!=null){let h=parseFloat(r);Number.isNaN(h)||(u.options.linedelay=h,h===0&&Tn.getState().setContentComplete(!0))}}),bn.add(function(){let r=this.choose,u=this;this.choose=s=>(u.options.linedelay!==0&&(Tn.getState().setContentComplete(!1),Tn.getState().setLastContent(u.contents)),r.call(u,s)),Object.defineProperty(this,"visibleLines",{get(){let s=Tn.getState().last_content;return s?u.contents.lastIndexOf(s):-1}}),Object.defineProperty(this,"choicesCanShow",{get(){return Xl(Tn).use.contentComplete()}});let h=null,c=Zi.subscribe(()=>{if(h&&clearTimeout(h),u.options.linedelay===0){Tn.getState().setContentComplete(!0);return}h=setTimeout(()=>{Tn.getState().setContentComplete(!0)},Math.max(0,(u.contents.length-u.visibleLines)*u.options.linedelay*1e3))});this.cleanups.push(()=>{c(),h&&clearTimeout(h)}),this.clears.push(()=>{u.options.linedelay!==0&&Tn.getState().setContentComplete(!1),Tn.getState().setLastContent([])})},Ag)},xg={container:"_container_1a16a_1"},Dg=(0,_t.memo)(({className:r="",fallback:u=null})=>{let h=Ha(A=>A.image),[c,s]=(0,_t.useState)(!1);(0,_t.useEffect)(()=>{s(!1)},[]);let p=(0,_t.useRef)(h);p.current=h;let m=(0,_t.useCallback)(()=>{s(!0),console.warn(`InkWeave: Failed to load image: ${p.current}`)},[]),v=(0,_t.useCallback)(()=>{s(!1)},[]),y=`${xg.container} ${r}`.trim();return c?u?(0,St.jsx)("div",{className:y,children:u}):null:(0,St.jsx)("div",{className:y,children:(0,St.jsx)("img",{src:h??"",alt:"",onError:m,onLoad:v})})}),Ha=Qi(r=>({image:"",setImage:u=>r({image:u})})),Rg=(r,u)=>u&&"resolveFilename"in u?u.resolveFilename(r):r,Vg=()=>{_n.add("image",(r,u)=>{r?Ha.getState().setImage(Rg(r,u.options.fileHandler)):Ha.getState().setImage("")}),bn.add(function(){Object.defineProperty(this,"image",{get(){return Ha.getState().image},set(r){Ha.getState().setImage(r)}}),this.save_label.push("image"),this.clears.push(()=>{this.image=""})},{})},Pg=["http:","https:"],Lg=()=>{_n.add("linkopen",r=>{if(r){try{let u=new URL(r);if(!Pg.includes(u.protocol)){console.warn("InkWeave: Blocked unsafe URL protocol:",u.protocol);return}}catch{console.warn("InkWeave: Invalid URL:",r);return}window.open(r,"_blank","noopener,noreferrer")}})},Mg=()=>{bn.add(function(){let r=null,u=Ql.subscribe(()=>{r&&clearTimeout(r),r=setTimeout(()=>{let h=document.querySelector('[data-inkweave="choices"] > li:last-child');h&&document.querySelector('[data-inkweave="story"]')?.scrollTo({top:h.offsetTop,behavior:"smooth"})},0)});this.cleanups.push(()=>{u(),r&&clearTimeout(r)})},{})},Fg=lt((r=>{function u(x,D){var R=x.length;x.push(D);t:for(;0<R;){var Z=R-1>>>1,tt=x[Z];if(0<s(tt,D))x[Z]=D,x[R]=tt,R=Z;else break t}}function h(x){return x.length===0?null:x[0]}function c(x){if(x.length===0)return null;var D=x[0],R=x.pop();if(R!==D){x[0]=R;t:for(var Z=0,tt=x.length,ft=tt>>>1;Z<ft;){var L=2*(Z+1)-1,$=x[L],rt=L+1,ut=x[rt];if(0>s($,R))rt<tt&&0>s(ut,$)?(x[Z]=ut,x[rt]=R,Z=rt):(x[Z]=$,x[L]=R,Z=L);else if(rt<tt&&0>s(ut,R))x[Z]=ut,x[rt]=R,Z=rt;else break t}}return D}function s(x,D){var R=x.sortIndex-D.sortIndex;return R!==0?R:x.id-D.id}if(r.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var p=performance;r.unstable_now=function(){return p.now()}}else{var m=Date,v=m.now();r.unstable_now=function(){return m.now()-v}}var y=[],A=[],o=1,T=null,f=3,g=!1,V=!1,B=!1,k=!1,M=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function z(x){for(var D=h(A);D!==null;){if(D.callback===null)c(A);else if(D.startTime<=x)c(A),D.sortIndex=D.expirationTime,u(y,D);else break;D=h(A)}}function Q(x){if(B=!1,z(x),!V)if(h(y)!==null)V=!0,O||(O=!0,K());else{var D=h(A);D!==null&&E(Q,D.startTime-x)}}var O=!1,w=-1,N=5,C=-1;function S(){return k?!0:!(r.unstable_now()-C<N)}function F(){if(k=!1,O){var x=r.unstable_now();C=x;var D=!0;try{t:{V=!1,B&&(B=!1,j(w),w=-1),g=!0;var R=f;try{e:{for(z(x),T=h(y);T!==null&&!(T.expirationTime>x&&S());){var Z=T.callback;if(typeof Z=="function"){T.callback=null,f=T.priorityLevel;var tt=Z(T.expirationTime<=x);if(x=r.unstable_now(),typeof tt=="function"){T.callback=tt,z(x),D=!0;break e}T===h(y)&&c(y),z(x)}else c(y);T=h(y)}if(T!==null)D=!0;else{var ft=h(A);ft!==null&&E(Q,ft.startTime-x),D=!1}}break t}finally{T=null,f=R,g=!1}D=void 0}}finally{D?K():O=!1}}}var K;if(typeof q=="function")K=function(){q(F)};else if(typeof MessageChannel<"u"){var it=new MessageChannel,ot=it.port2;it.port1.onmessage=F,K=function(){ot.postMessage(null)}}else K=function(){M(F,0)};function E(x,D){w=M(function(){x(r.unstable_now())},D)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(x){x.callback=null},r.unstable_forceFrameRate=function(x){0>x||125<x?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<x?Math.floor(1e3/x):5},r.unstable_getCurrentPriorityLevel=function(){return f},r.unstable_next=function(x){switch(f){case 1:case 2:case 3:var D=3;break;default:D=f}var R=f;f=D;try{return x()}finally{f=R}},r.unstable_requestPaint=function(){k=!0},r.unstable_runWithPriority=function(x,D){switch(x){case 1:case 2:case 3:case 4:case 5:break;default:x=3}var R=f;f=x;try{return D()}finally{f=R}},r.unstable_scheduleCallback=function(x,D,R){var Z=r.unstable_now();switch(typeof R=="object"&&R!==null?(R=R.delay,R=typeof R=="number"&&0<R?Z+R:Z):R=Z,x){case 1:var tt=-1;break;case 2:tt=250;break;case 5:tt=1073741823;break;case 4:tt=1e4;break;default:tt=5e3}return tt=R+tt,x={id:o++,callback:D,priorityLevel:x,startTime:R,expirationTime:tt,sortIndex:-1},R>Z?(x.sortIndex=R,u(A,x),h(y)===null&&x===h(A)&&(B?(j(w),w=-1):B=!0,E(Q,R-Z))):(x.sortIndex=tt,u(y,x),V||g||(V=!0,O||(O=!0,K()))),x},r.unstable_shouldYield=S,r.unstable_wrapCallback=function(x){var D=f;return function(){var R=f;f=D;try{return x.apply(this,arguments)}finally{f=R}}}})),Ig=lt(((r,u)=>{u.exports=Fg()})),jg=lt((r=>{var u=Ds();function h(A){var o="https://react.dev/errors/"+A;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var T=2;T<arguments.length;T++)o+="&args[]="+encodeURIComponent(arguments[T])}return"Minified React error #"+A+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function c(){}var s={d:{f:c,r:function(){throw Error(h(522))},D:c,C:c,L:c,m:c,X:c,S:c,M:c},p:0,findDOMNode:null},p=Symbol.for("react.portal");function m(A,o,T){var f=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:p,key:f==null?null:""+f,children:A,containerInfo:o,implementation:T}}var v=u.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function y(A,o){if(A==="font")return"";if(typeof o=="string")return o==="use-credentials"?o:""}r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=s,r.createPortal=function(A,o){var T=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)throw Error(h(299));return m(A,o,null,T)},r.flushSync=function(A){var o=v.T,T=s.p;try{if(v.T=null,s.p=2,A)return A()}finally{v.T=o,s.p=T,s.d.f()}},r.preconnect=function(A,o){typeof A=="string"&&(o?(o=o.crossOrigin,o=typeof o=="string"?o==="use-credentials"?o:"":void 0):o=null,s.d.C(A,o))},r.prefetchDNS=function(A){typeof A=="string"&&s.d.D(A)},r.preinit=function(A,o){if(typeof A=="string"&&o&&typeof o.as=="string"){var T=o.as,f=y(T,o.crossOrigin),g=typeof o.integrity=="string"?o.integrity:void 0,V=typeof o.fetchPriority=="string"?o.fetchPriority:void 0;T==="style"?s.d.S(A,typeof o.precedence=="string"?o.precedence:void 0,{crossOrigin:f,integrity:g,fetchPriority:V}):T==="script"&&s.d.X(A,{crossOrigin:f,integrity:g,fetchPriority:V,nonce:typeof o.nonce=="string"?o.nonce:void 0})}},r.preinitModule=function(A,o){if(typeof A=="string")if(typeof o=="object"&&o!==null){if(o.as==null||o.as==="script"){var T=y(o.as,o.crossOrigin);s.d.M(A,{crossOrigin:T,integrity:typeof o.integrity=="string"?o.integrity:void 0,nonce:typeof o.nonce=="string"?o.nonce:void 0})}}else o??s.d.M(A)},r.preload=function(A,o){if(typeof A=="string"&&typeof o=="object"&&o!==null&&typeof o.as=="string"){var T=o.as,f=y(T,o.crossOrigin);s.d.L(A,T,{crossOrigin:f,integrity:typeof o.integrity=="string"?o.integrity:void 0,nonce:typeof o.nonce=="string"?o.nonce:void 0,type:typeof o.type=="string"?o.type:void 0,fetchPriority:typeof o.fetchPriority=="string"?o.fetchPriority:void 0,referrerPolicy:typeof o.referrerPolicy=="string"?o.referrerPolicy:void 0,imageSrcSet:typeof o.imageSrcSet=="string"?o.imageSrcSet:void 0,imageSizes:typeof o.imageSizes=="string"?o.imageSizes:void 0,media:typeof o.media=="string"?o.media:void 0})}},r.preloadModule=function(A,o){if(typeof A=="string")if(o){var T=y(o.as,o.crossOrigin);s.d.m(A,{as:typeof o.as=="string"&&o.as!=="script"?o.as:void 0,crossOrigin:T,integrity:typeof o.integrity=="string"?o.integrity:void 0})}else s.d.m(A)},r.requestFormReset=function(A){s.d.r(A)},r.unstable_batchedUpdates=function(A,o){return A(o)},r.useFormState=function(A,o,T){return v.H.useFormState(A,o,T)},r.useFormStatus=function(){return v.H.useHostTransitionStatus()},r.version="19.2.4"})),Wg=lt(((r,u)=>{function h(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(h)}catch(c){console.error(c)}}h(),u.exports=jg()})),kg=lt((r=>{var u=Ig(),h=Ds(),c=Wg();function s(t){var e="https://react.dev/errors/"+t;if(1<arguments.length){e+="?args[]="+encodeURIComponent(arguments[1]);for(var n=2;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n])}return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function p(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function m(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,(e.flags&4098)!==0&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function v(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function y(t){if(t.tag===31){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function A(t){if(m(t)!==t)throw Error(s(188))}function o(t){var e=t.alternate;if(!e){if(e=m(t),e===null)throw Error(s(188));return e!==t?null:t}for(var n=t,i=e;;){var a=n.return;if(a===null)break;var l=a.alternate;if(l===null){if(i=a.return,i!==null){n=i;continue}break}if(a.child===l.child){for(l=a.child;l;){if(l===n)return A(a),t;if(l===i)return A(a),e;l=l.sibling}throw Error(s(188))}if(n.return!==i.return)n=a,i=l;else{for(var d=!1,b=a.child;b;){if(b===n){d=!0,n=a,i=l;break}if(b===i){d=!0,i=a,n=l;break}b=b.sibling}if(!d){for(b=l.child;b;){if(b===n){d=!0,n=l,i=a;break}if(b===i){d=!0,i=l,n=a;break}b=b.sibling}if(!d)throw Error(s(189))}}if(n.alternate!==i)throw Error(s(190))}if(n.tag!==3)throw Error(s(188));return n.stateNode.current===n?t:e}function T(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t;for(t=t.child;t!==null;){if(e=T(t),e!==null)return e;t=t.sibling}return null}var f=Object.assign,g=Symbol.for("react.element"),V=Symbol.for("react.transitional.element"),B=Symbol.for("react.portal"),k=Symbol.for("react.fragment"),M=Symbol.for("react.strict_mode"),j=Symbol.for("react.profiler"),q=Symbol.for("react.consumer"),z=Symbol.for("react.context"),Q=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),w=Symbol.for("react.suspense_list"),N=Symbol.for("react.memo"),C=Symbol.for("react.lazy"),S=Symbol.for("react.activity"),F=Symbol.for("react.memo_cache_sentinel"),K=Symbol.iterator;function it(t){return t===null||typeof t!="object"?null:(t=K&&t[K]||t["@@iterator"],typeof t=="function"?t:null)}var ot=Symbol.for("react.client.reference");function E(t){if(t==null)return null;if(typeof t=="function")return t.$$typeof===ot?null:t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case k:return"Fragment";case j:return"Profiler";case M:return"StrictMode";case O:return"Suspense";case w:return"SuspenseList";case S:return"Activity"}if(typeof t=="object")switch(t.$$typeof){case B:return"Portal";case z:return t.displayName||"Context";case q:return(t._context.displayName||"Context")+".Consumer";case Q:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case N:return e=t.displayName||null,e!==null?e:E(t.type)||"Memo";case C:e=t._payload,t=t._init;try{return E(t(e))}catch{}}return null}var x=Array.isArray,D=h.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,R=c.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Z={pending:!1,data:null,method:null,action:null},tt=[],ft=-1;function L(t){return{current:t}}function $(t){0>ft||(t.current=tt[ft],tt[ft]=null,ft--)}function rt(t,e){ft++,tt[ft]=t.current,t.current=e}var ut=L(null),dt=L(null),Ct=L(null),Nt=L(null);function Yt(t,e){switch(rt(Ct,e),rt(dt,t),rt(ut,null),e.nodeType){case 9:case 11:t=(t=e.documentElement)&&(t=t.namespaceURI)?cm(t):0;break;default:if(t=e.tagName,e=e.namespaceURI)e=cm(e),t=fm(e,t);else switch(t){case"svg":t=1;break;case"math":t=2;break;default:t=0}}$(ut),rt(ut,t)}function qt(){$(ut),$(dt),$(Ct)}function ge(t){t.memoizedState!==null&&rt(Nt,t);var e=ut.current,n=fm(e,t.type);e!==n&&(rt(dt,t),rt(ut,n))}function je(t){dt.current===t&&($(ut),$(dt)),Nt.current===t&&($(Nt),Fl._currentValue=Z)}var Ne,_i;function Et(t){if(Ne===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Ne=e&&e[1]||"",_i=-1<n.stack.indexOf(`
45
+ at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
46
+ `+Ne+t+_i}var pt=!1;function $t(t,e){if(!t||pt)return"";pt=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var i={DetermineComponentFrameRoot:function(){try{if(e){var at=function(){throw Error()};if(Object.defineProperty(at.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(at,[])}catch(J){var X=J}Reflect.construct(t,[],at)}else{try{at.call()}catch(J){X=J}t.call(at.prototype)}}else{try{throw Error()}catch(J){X=J}(at=t())&&typeof at.catch=="function"&&at.catch(function(){})}}catch(J){if(J&&X&&typeof J.stack=="string")return[J.stack,X.stack]}return[null,null]}};i.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var a=Object.getOwnPropertyDescriptor(i.DetermineComponentFrameRoot,"name");a&&a.configurable&&Object.defineProperty(i.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var l=i.DetermineComponentFrameRoot(),d=l[0],b=l[1];if(d&&b){var I=d.split(`
47
+ `),Y=b.split(`
48
+ `);for(a=i=0;i<I.length&&!I[i].includes("DetermineComponentFrameRoot");)i++;for(;a<Y.length&&!Y[a].includes("DetermineComponentFrameRoot");)a++;if(i===I.length||a===Y.length)for(i=I.length-1,a=Y.length-1;1<=i&&0<=a&&I[i]!==Y[a];)a--;for(;1<=i&&0<=a;i--,a--)if(I[i]!==Y[a]){if(i!==1||a!==1)do if(i--,a--,0>a||I[i]!==Y[a]){var et=`
49
+ `+I[i].replace(" at new "," at ");return t.displayName&&et.includes("<anonymous>")&&(et=et.replace("<anonymous>",t.displayName)),et}while(1<=i&&0<=a);break}}}finally{pt=!1,Error.prepareStackTrace=n}return(n=t?t.displayName||t.name:"")?Et(n):""}function zt(t,e){switch(t.tag){case 26:case 27:case 5:return Et(t.type);case 16:return Et("Lazy");case 13:return t.child!==e&&e!==null?Et("Suspense Fallback"):Et("Suspense");case 19:return Et("SuspenseList");case 0:case 15:return $t(t.type,!1);case 11:return $t(t.type.render,!1);case 1:return $t(t.type,!0);case 31:return Et("Activity");default:return""}}function Kt(t){try{var e="",n=null;do e+=zt(t,n),n=t,t=t.return;while(t);return e}catch(i){return`
50
+ Error generating stack: `+i.message+`
51
+ `+i.stack}}var he=Object.prototype.hasOwnProperty,Te=u.unstable_scheduleCallback,Nn=u.unstable_cancelCallback,_=u.unstable_shouldYield,P=u.unstable_requestPaint,U=u.unstable_now,st=u.unstable_getCurrentPriorityLevel,ht=u.unstable_ImmediatePriority,bt=u.unstable_UserBlockingPriority,Xt=u.unstable_NormalPriority,ce=u.unstable_LowPriority,Ji=u.unstable_IdlePriority,Ka=u.log,Jl=u.unstable_setDisableYieldValue,We=null,fe=null;function Ae(t){if(typeof Ka=="function"&&Jl(t),fe&&typeof fe.setStrictMode=="function")try{fe.setStrictMode(We,t)}catch{}}var ke=Math.clz32?Math.clz32:rp,ap=Math.log,lp=Math.LN2;function rp(t){return t>>>=0,t===0?32:31-(ap(t)/lp|0)|0}var $l=256,tr=262144,er=4194304;function bi(t){var e=t&42;if(e!==0)return e;switch(t&-t){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return t&261888;case 262144:case 524288:case 1048576:case 2097152:return t&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return t&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return t}}function nr(t,e,n){var i=t.pendingLanes;if(i===0)return 0;var a=0,l=t.suspendedLanes,d=t.pingedLanes;t=t.warmLanes;var b=i&134217727;return b!==0?(i=b&~l,i!==0?a=bi(i):(d&=b,d!==0?a=bi(d):n||(n=b&~t,n!==0&&(a=bi(n))))):(b=i&~l,b!==0?a=bi(b):d!==0?a=bi(d):n||(n=i&~t,n!==0&&(a=bi(n)))),a===0?0:e!==0&&e!==a&&(e&l)===0&&(l=a&-a,n=e&-e,l>=n||l===32&&(n&4194048)!==0)?e:a}function Xa(t,e){return(t.pendingLanes&~(t.suspendedLanes&~t.pingedLanes)&e)===0}function sp(t,e){switch(t){case 1:case 2:case 4:case 8:case 64:return e+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Hh(){var t=er;return er<<=1,(er&62914560)===0&&(er=4194304),t}function Ws(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function ir(t,e){t.pendingLanes|=e,e!==268435456&&(t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0)}function up(t,e,n,i,a,l){var d=t.pendingLanes;t.pendingLanes=n,t.suspendedLanes=0,t.pingedLanes=0,t.warmLanes=0,t.expiredLanes&=n,t.entangledLanes&=n,t.errorRecoveryDisabledLanes&=n,t.shellSuspendCounter=0;var b=t.entanglements,I=t.expirationTimes,Y=t.hiddenUpdates;for(n=d&~n;0<n;){var et=31-ke(n),at=1<<et;b[et]=0,I[et]=-1;var X=Y[et];if(X!==null)for(Y[et]=null,et=0;et<X.length;et++){var J=X[et];J!==null&&(J.lane&=-536870913)}n&=~at}i!==0&&Yh(t,i,0),l!==0&&a===0&&t.tag!==0&&(t.suspendedLanes|=l&~(d&~e))}function Yh(t,e,n){t.pendingLanes|=e,t.suspendedLanes&=~e;var i=31-ke(e);t.entangledLanes|=e,t.entanglements[i]=t.entanglements[i]|1073741824|n&261930}function Kh(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var i=31-ke(n),a=1<<i;a&e|t[i]&e&&(t[i]|=e),n&=~a}}function Xh(t,e){var n=e&-e;return n=(n&42)!==0?1:Qh(n),(n&(t.suspendedLanes|e))!==0?0:n}function Qh(t){switch(t){case 2:t=1;break;case 8:t=4;break;case 32:t=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:t=128;break;case 268435456:t=134217728;break;default:t=0}return t}function ks(t){return t&=-t,2<t?8<t?(t&134217727)!==0?32:268435456:8:2}function Zh(){var t=R.p;return t!==0?t:(t=window.event,t===void 0?32:Pm(t.type))}function Jh(t,e){var n=R.p;try{return R.p=t,e()}finally{R.p=n}}var Qn=Math.random().toString(36).slice(2),pe="__reactFiber$"+Qn,we="__reactProps$"+Qn,Qa="__reactContainer$"+Qn,Bs="__reactEvents$"+Qn,op="__reactListeners$"+Qn,hp="__reactHandles$"+Qn,$h="__reactResources$"+Qn,Za="__reactMarker$"+Qn;function Gs(t){delete t[pe],delete t[we],delete t[Bs],delete t[op],delete t[hp]}function $i(t){var e=t[pe];if(e)return e;for(var n=t.parentNode;n;){if(e=n[Qa]||n[pe]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=Cm(t);t!==null;){if(n=t[pe])return n;t=Cm(t)}return e}t=n,n=t.parentNode}return null}function ta(t){if(t=t[pe]||t[Qa]){var e=t.tag;if(e===5||e===6||e===13||e===31||e===26||e===27||e===3)return t}return null}function Ja(t){var e=t.tag;if(e===5||e===26||e===27||e===6)return t.stateNode;throw Error(s(33))}function ea(t){var e=t[$h];return e||(e=t[$h]={hoistableStyles:new Map,hoistableScripts:new Map}),e}function me(t){t[Za]=!0}var tc=new Set,ec={};function Ei(t,e){na(t,e),na(t+"Capture",e)}function na(t,e){for(ec[t]=e,t=0;t<e.length;t++)tc.add(e[t])}var cp=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),nc={},ic={};function fp(t){return he.call(ic,t)?!0:he.call(nc,t)?!1:cp.test(t)?ic[t]=!0:(nc[t]=!0,!1)}function ar(t,e,n){if(fp(e))if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":t.removeAttribute(e);return;case"boolean":var i=e.toLowerCase().slice(0,5);if(i!=="data-"&&i!=="aria-"){t.removeAttribute(e);return}}t.setAttribute(e,""+n)}}function lr(t,e,n){if(n===null)t.removeAttribute(e);else{switch(typeof n){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(e);return}t.setAttribute(e,""+n)}}function An(t,e,n,i){if(i===null)t.removeAttribute(n);else{switch(typeof i){case"undefined":case"function":case"symbol":case"boolean":t.removeAttribute(n);return}t.setAttributeNS(e,n,""+i)}}function Xe(t){switch(typeof t){case"bigint":case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function ac(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function dp(t,e,n){var i=Object.getOwnPropertyDescriptor(t.constructor.prototype,e);if(!t.hasOwnProperty(e)&&typeof i<"u"&&typeof i.get=="function"&&typeof i.set=="function"){var a=i.get,l=i.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return a.call(this)},set:function(d){n=""+d,l.call(this,d)}}),Object.defineProperty(t,e,{enumerable:i.enumerable}),{getValue:function(){return n},setValue:function(d){n=""+d},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function qs(t){if(!t._valueTracker){var e=ac(t)?"checked":"value";t._valueTracker=dp(t,e,""+t[e])}}function lc(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),i="";return t&&(i=ac(t)?t.checked?"true":"false":t.value),t=i,t!==n?(e.setValue(t),!0):!1}function rr(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}var mp=/[\n"\\]/g;function Qe(t){return t.replace(mp,function(e){return"\\"+e.charCodeAt(0).toString(16)+" "})}function zs(t,e,n,i,a,l,d,b){t.name="",d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"?t.type=d:t.removeAttribute("type"),e!=null?d==="number"?(e===0&&t.value===""||t.value!=e)&&(t.value=""+Xe(e)):t.value!==""+Xe(e)&&(t.value=""+Xe(e)):d!=="submit"&&d!=="reset"||t.removeAttribute("value"),e!=null?Us(t,d,Xe(e)):n!=null?Us(t,d,Xe(n)):i!=null&&t.removeAttribute("value"),a==null&&l!=null&&(t.defaultChecked=!!l),a!=null&&(t.checked=a&&typeof a!="function"&&typeof a!="symbol"),b!=null&&typeof b!="function"&&typeof b!="symbol"&&typeof b!="boolean"?t.name=""+Xe(b):t.removeAttribute("name")}function rc(t,e,n,i,a,l,d,b){if(l!=null&&typeof l!="function"&&typeof l!="symbol"&&typeof l!="boolean"&&(t.type=l),e!=null||n!=null){if(!(l!=="submit"&&l!=="reset"||e!=null)){qs(t);return}n=n!=null?""+Xe(n):"",e=e!=null?""+Xe(e):n,b||e===t.value||(t.value=e),t.defaultValue=e}i=i??a,i=typeof i!="function"&&typeof i!="symbol"&&!!i,t.checked=b?t.checked:!!i,t.defaultChecked=!!i,d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(t.name=d),qs(t)}function Us(t,e,n){e==="number"&&rr(t.ownerDocument)===t||t.defaultValue===""+n||(t.defaultValue=""+n)}function ia(t,e,n,i){if(t=t.options,e){e={};for(var a=0;a<n.length;a++)e["$"+n[a]]=!0;for(n=0;n<t.length;n++)a=e.hasOwnProperty("$"+t[n].value),t[n].selected!==a&&(t[n].selected=a),a&&i&&(t[n].defaultSelected=!0)}else{for(n=""+Xe(n),e=null,a=0;a<t.length;a++){if(t[a].value===n){t[a].selected=!0,i&&(t[a].defaultSelected=!0);return}e!==null||t[a].disabled||(e=t[a])}e!==null&&(e.selected=!0)}}function sc(t,e,n){if(e!=null&&(e=""+Xe(e),e!==t.value&&(t.value=e),n==null)){t.defaultValue!==e&&(t.defaultValue=e);return}t.defaultValue=n!=null?""+Xe(n):""}function uc(t,e,n,i){if(e==null){if(i!=null){if(n!=null)throw Error(s(92));if(x(i)){if(1<i.length)throw Error(s(93));i=i[0]}n=i}n??="",e=n}n=Xe(e),t.defaultValue=n,i=t.textContent,i===n&&i!==""&&i!==null&&(t.value=i),qs(t)}function aa(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var vp=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function oc(t,e,n){var i=e.indexOf("--")===0;n==null||typeof n=="boolean"||n===""?i?t.setProperty(e,""):e==="float"?t.cssFloat="":t[e]="":i?t.setProperty(e,n):typeof n!="number"||n===0||vp.has(e)?e==="float"?t.cssFloat=n:t[e]=(""+n).trim():t[e]=n+"px"}function hc(t,e,n){if(e!=null&&typeof e!="object")throw Error(s(62));if(t=t.style,n!=null){for(var i in n)!n.hasOwnProperty(i)||e!=null&&e.hasOwnProperty(i)||(i.indexOf("--")===0?t.setProperty(i,""):i==="float"?t.cssFloat="":t[i]="");for(var a in e)i=e[a],e.hasOwnProperty(a)&&n[a]!==i&&oc(t,a,i)}else for(var l in e)e.hasOwnProperty(l)&&oc(t,l,e[l])}function Hs(t){if(t.indexOf("-")===-1)return!1;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var gp=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),pp=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function sr(t){return pp.test(""+t)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":t}function wn(){}var Ys=null;function Ks(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var la=null,ra=null;function cc(t){var e=ta(t);if(e&&(t=e.stateNode)){var n=t[we]||null;t:switch(t=e.stateNode,e.type){case"input":if(zs(t,n.value,n.defaultValue,n.defaultValue,n.checked,n.defaultChecked,n.type,n.name),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll('input[name="'+Qe(""+e)+'"][type="radio"]'),e=0;e<n.length;e++){var i=n[e];if(i!==t&&i.form===t.form){var a=i[we]||null;if(!a)throw Error(s(90));zs(i,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name)}}for(e=0;e<n.length;e++)i=n[e],i.form===t.form&&lc(i)}break t;case"textarea":sc(t,n.value,n.defaultValue);break t;case"select":e=n.value,e!=null&&ia(t,!!n.multiple,e,!1)}}}var Xs=!1;function fc(t,e,n){if(Xs)return t(e,n);Xs=!0;try{return t(e)}finally{if(Xs=!1,(la!==null||ra!==null)&&(Kr(),la&&(e=la,t=ra,ra=la=null,cc(e),t)))for(e=0;e<t.length;e++)cc(t[e])}}function $a(t,e){var n=t.stateNode;if(n===null)return null;var i=n[we]||null;if(i===null)return null;n=i[e];t:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(i=!i.disabled)||(t=t.type,i=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!i;break t;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(s(231,e,typeof n));return n}var xn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Qs=!1;if(xn)try{var tl={};Object.defineProperty(tl,"passive",{get:function(){Qs=!0}}),window.addEventListener("test",tl,tl),window.removeEventListener("test",tl,tl)}catch{Qs=!1}var Zn=null,Zs=null,ur=null;function dc(){if(ur)return ur;var t,e=Zs,n=e.length,i,a="value"in Zn?Zn.value:Zn.textContent,l=a.length;for(t=0;t<n&&e[t]===a[t];t++);var d=n-t;for(i=1;i<=d&&e[n-i]===a[l-i];i++);return ur=a.slice(t,1<i?1-i:void 0)}function or(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function hr(){return!0}function mc(){return!1}function xe(t){function e(n,i,a,l,d){this._reactName=n,this._targetInst=a,this.type=i,this.nativeEvent=l,this.target=d,this.currentTarget=null;for(var b in t)t.hasOwnProperty(b)&&(n=t[b],this[b]=n?n(l):l[b]);return this.isDefaultPrevented=(l.defaultPrevented!=null?l.defaultPrevented:l.returnValue===!1)?hr:mc,this.isPropagationStopped=mc,this}return f(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=hr)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=hr)},persist:function(){},isPersistent:hr}),e}var Ti={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},cr=xe(Ti),el=f({},Ti,{view:0,detail:0}),yp=xe(el),Js,$s,nl,fr=f({},el,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:eu,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==nl&&(nl&&t.type==="mousemove"?(Js=t.screenX-nl.screenX,$s=t.screenY-nl.screenY):$s=Js=0,nl=t),Js)},movementY:function(t){return"movementY"in t?t.movementY:$s}}),vc=xe(fr),Cp=xe(f({},fr,{dataTransfer:0})),tu=xe(f({},el,{relatedTarget:0})),Sp=xe(f({},Ti,{animationName:0,elapsedTime:0,pseudoElement:0})),_p=xe(f({},Ti,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}})),gc=xe(f({},Ti,{data:0})),bp={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Ep={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Tp={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Op(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=Tp[t])?!!e[t]:!1}function eu(){return Op}var Np=xe(f({},el,{key:function(t){if(t.key){var e=bp[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=or(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?Ep[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:eu,charCode:function(t){return t.type==="keypress"?or(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?or(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}})),pc=xe(f({},fr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0})),Ap=xe(f({},el,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:eu})),wp=xe(f({},Ti,{propertyName:0,elapsedTime:0,pseudoElement:0})),xp=xe(f({},fr,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0})),Dp=xe(f({},Ti,{newState:0,oldState:0})),Rp=[9,13,27,32],nu=xn&&"CompositionEvent"in window,il=null;xn&&"documentMode"in document&&(il=document.documentMode);var Vp=xn&&"TextEvent"in window&&!il,yc=xn&&(!nu||il&&8<il&&11>=il),Cc=" ",Sc=!1;function _c(t,e){switch(t){case"keyup":return Rp.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function bc(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var sa=!1;function Pp(t,e){switch(t){case"compositionend":return bc(e);case"keypress":return e.which!==32?null:(Sc=!0,Cc);case"textInput":return t=e.data,t===Cc&&Sc?null:t;default:return null}}function Lp(t,e){if(sa)return t==="compositionend"||!nu&&_c(t,e)?(t=dc(),ur=Zs=Zn=null,sa=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return yc&&e.locale!=="ko"?null:e.data;default:return null}}var Mp={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function Ec(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!Mp[t.type]:e==="textarea"}function Tc(t,e,n,i){la?ra?ra.push(i):ra=[i]:la=i,e=es(e,"onChange"),0<e.length&&(n=new cr("onChange","change",null,n,i),t.push({event:n,listeners:e}))}var al=null,ll=null;function Fp(t){am(t,0)}function dr(t){if(lc(Ja(t)))return t}function Oc(t,e){if(t==="change")return e}var Nc=!1;if(xn){var iu;if(xn){var au="oninput"in document;if(!au){var Ac=document.createElement("div");Ac.setAttribute("oninput","return;"),au=typeof Ac.oninput=="function"}iu=au}else iu=!1;Nc=iu&&(!document.documentMode||9<document.documentMode)}function wc(){al&&(al.detachEvent("onpropertychange",xc),ll=al=null)}function xc(t){if(t.propertyName==="value"&&dr(ll)){var e=[];Tc(e,ll,t,Ks(t)),fc(Fp,e)}}function Ip(t,e,n){t==="focusin"?(wc(),al=e,ll=n,al.attachEvent("onpropertychange",xc)):t==="focusout"&&wc()}function jp(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return dr(ll)}function Wp(t,e){if(t==="click")return dr(e)}function kp(t,e){if(t==="input"||t==="change")return dr(e)}function Bp(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Be=typeof Object.is=="function"?Object.is:Bp;function rl(t,e){if(Be(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(i=0;i<n.length;i++){var a=n[i];if(!he.call(e,a)||!Be(t[a],e[a]))return!1}return!0}function Dc(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function Rc(t,e){var n=Dc(t);t=0;for(var i;n;){if(n.nodeType===3){if(i=t+n.textContent.length,t<=e&&i>=e)return{node:n,offset:e-t};t=i}t:{for(;n;){if(n.nextSibling){n=n.nextSibling;break t}n=n.parentNode}n=void 0}n=Dc(n)}}function Vc(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?Vc(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function Pc(t){t=t!=null&&t.ownerDocument!=null&&t.ownerDocument.defaultView!=null?t.ownerDocument.defaultView:window;for(var e=rr(t.document);e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=rr(t.document)}return e}function lu(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}var Gp=xn&&"documentMode"in document&&11>=document.documentMode,ua=null,ru=null,sl=null,su=!1;function Lc(t,e,n){var i=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;su||ua==null||ua!==rr(i)||(i=ua,"selectionStart"in i&&lu(i)?i={start:i.selectionStart,end:i.selectionEnd}:(i=(i.ownerDocument&&i.ownerDocument.defaultView||window).getSelection(),i={anchorNode:i.anchorNode,anchorOffset:i.anchorOffset,focusNode:i.focusNode,focusOffset:i.focusOffset}),sl&&rl(sl,i)||(sl=i,i=es(ru,"onSelect"),0<i.length&&(e=new cr("onSelect","select",null,e,n),t.push({event:e,listeners:i}),e.target=ua)))}function Oi(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var oa={animationend:Oi("Animation","AnimationEnd"),animationiteration:Oi("Animation","AnimationIteration"),animationstart:Oi("Animation","AnimationStart"),transitionrun:Oi("Transition","TransitionRun"),transitionstart:Oi("Transition","TransitionStart"),transitioncancel:Oi("Transition","TransitionCancel"),transitionend:Oi("Transition","TransitionEnd")},uu={},Mc={};xn&&(Mc=document.createElement("div").style,"AnimationEvent"in window||(delete oa.animationend.animation,delete oa.animationiteration.animation,delete oa.animationstart.animation),"TransitionEvent"in window||delete oa.transitionend.transition);function Ni(t){if(uu[t])return uu[t];if(!oa[t])return t;var e=oa[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Mc)return uu[t]=e[n];return t}var Fc=Ni("animationend"),Ic=Ni("animationiteration"),jc=Ni("animationstart"),qp=Ni("transitionrun"),zp=Ni("transitionstart"),Up=Ni("transitioncancel"),Wc=Ni("transitionend"),kc=new Map,ou="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");ou.push("scrollEnd");function hn(t,e){kc.set(t,e),Ei(e,[t])}var mr=typeof reportError=="function"?reportError:function(t){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var e=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof t=="object"&&t!==null&&typeof t.message=="string"?String(t.message):String(t),error:t});if(!window.dispatchEvent(e))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",t);return}console.error(t)},Ze=[],ha=0,hu=0;function vr(){for(var t=ha,e=hu=ha=0;e<t;){var n=Ze[e];Ze[e++]=null;var i=Ze[e];Ze[e++]=null;var a=Ze[e];Ze[e++]=null;var l=Ze[e];if(Ze[e++]=null,i!==null&&a!==null){var d=i.pending;d===null?a.next=a:(a.next=d.next,d.next=a),i.pending=a}l!==0&&Bc(n,a,l)}}function gr(t,e,n,i){Ze[ha++]=t,Ze[ha++]=e,Ze[ha++]=n,Ze[ha++]=i,hu|=i,t.lanes|=i,t=t.alternate,t!==null&&(t.lanes|=i)}function cu(t,e,n,i){return gr(t,e,n,i),pr(t)}function Ai(t,e){return gr(t,null,null,e),pr(t)}function Bc(t,e,n){t.lanes|=n;var i=t.alternate;i!==null&&(i.lanes|=n);for(var a=!1,l=t.return;l!==null;)l.childLanes|=n,i=l.alternate,i!==null&&(i.childLanes|=n),l.tag===22&&(t=l.stateNode,t===null||t._visibility&1||(a=!0)),t=l,l=l.return;return t.tag===3?(l=t.stateNode,a&&e!==null&&(a=31-ke(n),t=l.hiddenUpdates,i=t[a],i===null?t[a]=[e]:i.push(e),e.lane=n|536870912),l):null}function pr(t){if(50<xl)throw xl=0,_o=null,Error(s(185));for(var e=t.return;e!==null;)t=e,e=t.return;return t.tag===3?t.stateNode:null}var ca={};function Hp(t,e,n,i){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=i,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ge(t,e,n,i){return new Hp(t,e,n,i)}function fu(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Dn(t,e){var n=t.alternate;return n===null?(n=Ge(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&65011712,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n.refCleanup=t.refCleanup,n}function Gc(t,e){t.flags&=65011714;var n=t.alternate;return n===null?(t.childLanes=0,t.lanes=e,t.child=null,t.subtreeFlags=0,t.memoizedProps=null,t.memoizedState=null,t.updateQueue=null,t.dependencies=null,t.stateNode=null):(t.childLanes=n.childLanes,t.lanes=n.lanes,t.child=n.child,t.subtreeFlags=0,t.deletions=null,t.memoizedProps=n.memoizedProps,t.memoizedState=n.memoizedState,t.updateQueue=n.updateQueue,t.type=n.type,e=n.dependencies,t.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext}),t}function yr(t,e,n,i,a,l){var d=0;if(i=t,typeof t=="function")fu(t)&&(d=1);else if(typeof t=="string")d=Jy(t,n,ut.current)?26:t==="html"||t==="head"||t==="body"?27:5;else t:switch(t){case S:return t=Ge(31,n,e,a),t.elementType=S,t.lanes=l,t;case k:return wi(n.children,a,l,e);case M:d=8,a|=24;break;case j:return t=Ge(12,n,e,a|2),t.elementType=j,t.lanes=l,t;case O:return t=Ge(13,n,e,a),t.elementType=O,t.lanes=l,t;case w:return t=Ge(19,n,e,a),t.elementType=w,t.lanes=l,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case z:d=10;break t;case q:d=9;break t;case Q:d=11;break t;case N:d=14;break t;case C:d=16,i=null;break t}d=29,n=Error(s(130,t===null?"null":typeof t,"")),i=null}return e=Ge(d,n,e,a),e.elementType=t,e.type=i,e.lanes=l,e}function wi(t,e,n,i){return t=Ge(7,t,i,e),t.lanes=n,t}function du(t,e,n){return t=Ge(6,t,null,e),t.lanes=n,t}function qc(t){var e=Ge(18,null,null,0);return e.stateNode=t,e}function mu(t,e,n){return e=Ge(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}var zc=new WeakMap;function Je(t,e){if(typeof t=="object"&&t!==null){var n=zc.get(t);return n!==void 0?n:(e={value:t,source:e,stack:Kt(e)},zc.set(t,e),e)}return{value:t,source:e,stack:Kt(e)}}var fa=[],da=0,Cr=null,ul=0,$e=[],tn=0,Jn=null,dn=1,mn="";function Rn(t,e){fa[da++]=ul,fa[da++]=Cr,Cr=t,ul=e}function Uc(t,e,n){$e[tn++]=dn,$e[tn++]=mn,$e[tn++]=Jn,Jn=t;var i=dn;t=mn;var a=32-ke(i)-1;i&=~(1<<a),n+=1;var l=32-ke(e)+a;if(30<l){var d=a-a%5;l=(i&(1<<d)-1).toString(32),i>>=d,a-=d,dn=1<<32-ke(e)+a|n<<a|i,mn=l+t}else dn=1<<l|n<<a|i,mn=t}function vu(t){t.return!==null&&(Rn(t,1),Uc(t,1,0))}function gu(t){for(;t===Cr;)Cr=fa[--da],fa[da]=null,ul=fa[--da],fa[da]=null;for(;t===Jn;)Jn=$e[--tn],$e[tn]=null,mn=$e[--tn],$e[tn]=null,dn=$e[--tn],$e[tn]=null}function Hc(t,e){$e[tn++]=dn,$e[tn++]=mn,$e[tn++]=Jn,dn=e.id,mn=e.overflow,Jn=t}var ye=null,Ut=null,Rt=!1,$n=null,en=!1,pu=Error(s(519));function ti(t){throw ol(Je(Error(s(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML","")),t)),pu}function Yc(t){var e=t.stateNode,n=t.type,i=t.memoizedProps;switch(e[pe]=t,e[we]=i,n){case"dialog":wt("cancel",e),wt("close",e);break;case"iframe":case"object":case"embed":wt("load",e);break;case"video":case"audio":for(n=0;n<Rl.length;n++)wt(Rl[n],e);break;case"source":wt("error",e);break;case"img":case"image":case"link":wt("error",e),wt("load",e);break;case"details":wt("toggle",e);break;case"input":wt("invalid",e),rc(e,i.value,i.defaultValue,i.checked,i.defaultChecked,i.type,i.name,!0);break;case"select":wt("invalid",e);break;case"textarea":wt("invalid",e),uc(e,i.value,i.defaultValue,i.children)}n=i.children,typeof n!="string"&&typeof n!="number"&&typeof n!="bigint"||e.textContent===""+n||i.suppressHydrationWarning===!0||om(e.textContent,n)?(i.popover!=null&&(wt("beforetoggle",e),wt("toggle",e)),i.onScroll!=null&&wt("scroll",e),i.onScrollEnd!=null&&wt("scrollend",e),i.onClick!=null&&(e.onclick=wn),e=!0):e=!1,e||ti(t,!0)}function Kc(t){for(ye=t.return;ye;)switch(ye.tag){case 5:case 31:case 13:en=!1;return;case 27:case 3:en=!0;return;default:ye=ye.return}}function ma(t){if(t!==ye)return!1;if(!Rt)return Kc(t),Rt=!0,!1;var e=t.tag,n;if((n=e!==3&&e!==27)&&((n=e===5)&&(n=t.type,n=!(n!=="form"&&n!=="button")||Mo(t.type,t.memoizedProps)),n=!n),n&&Ut&&ti(t),Kc(t),e===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));Ut=ym(t)}else if(e===31){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(317));Ut=ym(t)}else e===27?(e=Ut,fi(t.type)?(t=ko,ko=null,Ut=t):Ut=e):Ut=ye?ln(t.stateNode.nextSibling):null;return!0}function xi(){Ut=ye=null,Rt=!1}function yu(){var t=$n;return t!==null&&(Pe===null?Pe=t:Pe.push.apply(Pe,t),$n=null),t}function ol(t){$n===null?$n=[t]:$n.push(t)}var Cu=L(null),Di=null,Vn=null;function ei(t,e,n){rt(Cu,e._currentValue),e._currentValue=n}function Pn(t){t._currentValue=Cu.current,$(Cu)}function Su(t,e,n){for(;t!==null;){var i=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,i!==null&&(i.childLanes|=e)):i!==null&&(i.childLanes&e)!==e&&(i.childLanes|=e),t===n)break;t=t.return}}function _u(t,e,n,i){var a=t.child;for(a!==null&&(a.return=t);a!==null;){var l=a.dependencies;if(l!==null){var d=a.child;l=l.firstContext;t:for(;l!==null;){var b=l;l=a;for(var I=0;I<e.length;I++)if(b.context===e[I]){l.lanes|=n,b=l.alternate,b!==null&&(b.lanes|=n),Su(l.return,n,t),i||(d=null);break t}l=b.next}}else if(a.tag===18){if(d=a.return,d===null)throw Error(s(341));d.lanes|=n,l=d.alternate,l!==null&&(l.lanes|=n),Su(d,n,t),d=null}else d=a.child;if(d!==null)d.return=a;else for(d=a;d!==null;){if(d===t){d=null;break}if(a=d.sibling,a!==null){a.return=d.return,d=a;break}d=d.return}a=d}}function va(t,e,n,i){t=null;for(var a=e,l=!1;a!==null;){if(!l){if((a.flags&524288)!==0)l=!0;else if((a.flags&262144)!==0)break}if(a.tag===10){var d=a.alternate;if(d===null)throw Error(s(387));if(d=d.memoizedProps,d!==null){var b=a.type;Be(a.pendingProps.value,d.value)||(t!==null?t.push(b):t=[b])}}else if(a===Nt.current){if(d=a.alternate,d===null)throw Error(s(387));d.memoizedState.memoizedState!==a.memoizedState.memoizedState&&(t!==null?t.push(Fl):t=[Fl])}a=a.return}t!==null&&_u(e,t,n,i),e.flags|=262144}function Sr(t){for(t=t.firstContext;t!==null;){if(!Be(t.context._currentValue,t.memoizedValue))return!0;t=t.next}return!1}function Ri(t){Di=t,Vn=null,t=t.dependencies,t!==null&&(t.firstContext=null)}function Ce(t){return Xc(Di,t)}function _r(t,e){return Di===null&&Ri(t),Xc(t,e)}function Xc(t,e){var n=e._currentValue;if(e={context:e,memoizedValue:n,next:null},Vn===null){if(t===null)throw Error(s(308));Vn=e,t.dependencies={lanes:0,firstContext:e},t.flags|=524288}else Vn=Vn.next=e;return n}var Yp=typeof AbortController<"u"?AbortController:function(){var t=[],e=this.signal={aborted:!1,addEventListener:function(n,i){t.push(i)}};this.abort=function(){e.aborted=!0,t.forEach(function(n){return n()})}},Kp=u.unstable_scheduleCallback,Xp=u.unstable_NormalPriority,ae={$$typeof:z,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function bu(){return{controller:new Yp,data:new Map,refCount:0}}function hl(t){t.refCount--,t.refCount===0&&Kp(Xp,function(){t.controller.abort()})}var cl=null,Eu=0,ga=0,pa=null;function Qp(t,e){if(cl===null){var n=cl=[];Eu=0,ga=Ao(),pa={status:"pending",value:void 0,then:function(i){n.push(i)}}}return Eu++,e.then(Qc,Qc),e}function Qc(){if(--Eu===0&&cl!==null){pa!==null&&(pa.status="fulfilled");var t=cl;cl=null,ga=0,pa=null;for(var e=0;e<t.length;e++)(0,t[e])()}}function Zp(t,e){var n=[],i={status:"pending",value:null,reason:null,then:function(a){n.push(a)}};return t.then(function(){i.status="fulfilled",i.value=e;for(var a=0;a<n.length;a++)(0,n[a])(e)},function(a){for(i.status="rejected",i.reason=a,a=0;a<n.length;a++)(0,n[a])(void 0)}),i}var Zc=D.S;D.S=function(t,e){Vd=U(),typeof e=="object"&&e!==null&&typeof e.then=="function"&&Qp(t,e),Zc!==null&&Zc(t,e)};var Vi=L(null);function Tu(){var t=Vi.current;return t!==null?t:Gt.pooledCache}function br(t,e){e===null?rt(Vi,Vi.current):rt(Vi,e.pool)}function Jc(){var t=Tu();return t===null?null:{parent:ae._currentValue,pool:t}}var ya=Error(s(460)),Ou=Error(s(474)),Er=Error(s(542)),Tr={then:function(){}};function $c(t){return t=t.status,t==="fulfilled"||t==="rejected"}function tf(t,e,n){switch(n=t[n],n===void 0?t.push(e):n!==e&&(e.then(wn,wn),e=n),e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,nf(t),t;default:if(typeof e.status=="string")e.then(wn,wn);else{if(t=Gt,t!==null&&100<t.shellSuspendCounter)throw Error(s(482));t=e,t.status="pending",t.then(function(i){if(e.status==="pending"){var a=e;a.status="fulfilled",a.value=i}},function(i){if(e.status==="pending"){var a=e;a.status="rejected",a.reason=i}})}switch(e.status){case"fulfilled":return e.value;case"rejected":throw t=e.reason,nf(t),t}throw Li=e,ya}}function Pi(t){try{var e=t._init;return e(t._payload)}catch(n){throw n!==null&&typeof n=="object"&&typeof n.then=="function"?(Li=n,ya):n}}var Li=null;function ef(){if(Li===null)throw Error(s(459));var t=Li;return Li=null,t}function nf(t){if(t===ya||t===Er)throw Error(s(483))}var Ca=null,fl=0;function Or(t){var e=fl;return fl+=1,Ca===null&&(Ca=[]),tf(Ca,t,e)}function dl(t,e){e=e.props.ref,t.ref=e!==void 0?e:null}function Nr(t,e){throw e.$$typeof===g?Error(s(525)):(t=Object.prototype.toString.call(e),Error(s(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t)))}function af(t){function e(G,W){if(t){var H=G.deletions;H===null?(G.deletions=[W],G.flags|=16):H.push(W)}}function n(G,W){if(!t)return null;for(;W!==null;)e(G,W),W=W.sibling;return null}function i(G){for(var W=new Map;G!==null;)G.key!==null?W.set(G.key,G):W.set(G.index,G),G=G.sibling;return W}function a(G,W){return G=Dn(G,W),G.index=0,G.sibling=null,G}function l(G,W,H){return G.index=H,t?(H=G.alternate,H!==null?(H=H.index,H<W?(G.flags|=67108866,W):H):(G.flags|=67108866,W)):(G.flags|=1048576,W)}function d(G){return t&&G.alternate===null&&(G.flags|=67108866),G}function b(G,W,H,nt){return W===null||W.tag!==6?(W=du(H,G.mode,nt),W.return=G,W):(W=a(W,H),W.return=G,W)}function I(G,W,H,nt){var vt=H.type;return vt===k?et(G,W,H.props.children,nt,H.key):W!==null&&(W.elementType===vt||typeof vt=="object"&&vt!==null&&vt.$$typeof===C&&Pi(vt)===W.type)?(W=a(W,H.props),dl(W,H),W.return=G,W):(W=yr(H.type,H.key,H.props,null,G.mode,nt),dl(W,H),W.return=G,W)}function Y(G,W,H,nt){return W===null||W.tag!==4||W.stateNode.containerInfo!==H.containerInfo||W.stateNode.implementation!==H.implementation?(W=mu(H,G.mode,nt),W.return=G,W):(W=a(W,H.children||[]),W.return=G,W)}function et(G,W,H,nt,vt){return W===null||W.tag!==7?(W=wi(H,G.mode,nt,vt),W.return=G,W):(W=a(W,H),W.return=G,W)}function at(G,W,H){if(typeof W=="string"&&W!==""||typeof W=="number"||typeof W=="bigint")return W=du(""+W,G.mode,H),W.return=G,W;if(typeof W=="object"&&W!==null){switch(W.$$typeof){case V:return H=yr(W.type,W.key,W.props,null,G.mode,H),dl(H,W),H.return=G,H;case B:return W=mu(W,G.mode,H),W.return=G,W;case C:return W=Pi(W),at(G,W,H)}if(x(W)||it(W))return W=wi(W,G.mode,H,null),W.return=G,W;if(typeof W.then=="function")return at(G,Or(W),H);if(W.$$typeof===z)return at(G,_r(G,W),H);Nr(G,W)}return null}function X(G,W,H,nt){var vt=W!==null?W.key:null;if(typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint")return vt!==null?null:b(G,W,""+H,nt);if(typeof H=="object"&&H!==null){switch(H.$$typeof){case V:return H.key===vt?I(G,W,H,nt):null;case B:return H.key===vt?Y(G,W,H,nt):null;case C:return H=Pi(H),X(G,W,H,nt)}if(x(H)||it(H))return vt!==null?null:et(G,W,H,nt,null);if(typeof H.then=="function")return X(G,W,Or(H),nt);if(H.$$typeof===z)return X(G,W,_r(G,H),nt);Nr(G,H)}return null}function J(G,W,H,nt,vt){if(typeof nt=="string"&&nt!==""||typeof nt=="number"||typeof nt=="bigint")return G=G.get(H)||null,b(W,G,""+nt,vt);if(typeof nt=="object"&&nt!==null){switch(nt.$$typeof){case V:return G=G.get(nt.key===null?H:nt.key)||null,I(W,G,nt,vt);case B:return G=G.get(nt.key===null?H:nt.key)||null,Y(W,G,nt,vt);case C:return nt=Pi(nt),J(G,W,H,nt,vt)}if(x(nt)||it(nt))return G=G.get(H)||null,et(W,G,nt,vt,null);if(typeof nt.then=="function")return J(G,W,H,Or(nt),vt);if(nt.$$typeof===z)return J(G,W,H,_r(W,nt),vt);Nr(W,nt)}return null}function ct(G,W,H,nt){for(var vt=null,Vt=null,mt=W,Ot=W=0,Dt=null;mt!==null&&Ot<H.length;Ot++){mt.index>Ot?(Dt=mt,mt=null):Dt=mt.sibling;var Pt=X(G,mt,H[Ot],nt);if(Pt===null){mt===null&&(mt=Dt);break}t&&mt&&Pt.alternate===null&&e(G,mt),W=l(Pt,W,Ot),Vt===null?vt=Pt:Vt.sibling=Pt,Vt=Pt,mt=Dt}if(Ot===H.length)return n(G,mt),Rt&&Rn(G,Ot),vt;if(mt===null){for(;Ot<H.length;Ot++)mt=at(G,H[Ot],nt),mt!==null&&(W=l(mt,W,Ot),Vt===null?vt=mt:Vt.sibling=mt,Vt=mt);return Rt&&Rn(G,Ot),vt}for(mt=i(mt);Ot<H.length;Ot++)Dt=J(mt,G,Ot,H[Ot],nt),Dt!==null&&(t&&Dt.alternate!==null&&mt.delete(Dt.key===null?Ot:Dt.key),W=l(Dt,W,Ot),Vt===null?vt=Dt:Vt.sibling=Dt,Vt=Dt);return t&&mt.forEach(function(pi){return e(G,pi)}),Rt&&Rn(G,Ot),vt}function yt(G,W,H,nt){if(H==null)throw Error(s(151));for(var vt=null,Vt=null,mt=W,Ot=W=0,Dt=null,Pt=H.next();mt!==null&&!Pt.done;Ot++,Pt=H.next()){mt.index>Ot?(Dt=mt,mt=null):Dt=mt.sibling;var pi=X(G,mt,Pt.value,nt);if(pi===null){mt===null&&(mt=Dt);break}t&&mt&&pi.alternate===null&&e(G,mt),W=l(pi,W,Ot),Vt===null?vt=pi:Vt.sibling=pi,Vt=pi,mt=Dt}if(Pt.done)return n(G,mt),Rt&&Rn(G,Ot),vt;if(mt===null){for(;!Pt.done;Ot++,Pt=H.next())Pt=at(G,Pt.value,nt),Pt!==null&&(W=l(Pt,W,Ot),Vt===null?vt=Pt:Vt.sibling=Pt,Vt=Pt);return Rt&&Rn(G,Ot),vt}for(mt=i(mt);!Pt.done;Ot++,Pt=H.next())Pt=J(mt,G,Ot,Pt.value,nt),Pt!==null&&(t&&Pt.alternate!==null&&mt.delete(Pt.key===null?Ot:Pt.key),W=l(Pt,W,Ot),Vt===null?vt=Pt:Vt.sibling=Pt,Vt=Pt);return t&&mt.forEach(function(fC){return e(G,fC)}),Rt&&Rn(G,Ot),vt}function kt(G,W,H,nt){if(typeof H=="object"&&H!==null&&H.type===k&&H.key===null&&(H=H.props.children),typeof H=="object"&&H!==null){switch(H.$$typeof){case V:t:{for(var vt=H.key;W!==null;){if(W.key===vt){if(vt=H.type,vt===k){if(W.tag===7){n(G,W.sibling),nt=a(W,H.props.children),nt.return=G,G=nt;break t}}else if(W.elementType===vt||typeof vt=="object"&&vt!==null&&vt.$$typeof===C&&Pi(vt)===W.type){n(G,W.sibling),nt=a(W,H.props),dl(nt,H),nt.return=G,G=nt;break t}n(G,W);break}else e(G,W);W=W.sibling}H.type===k?(nt=wi(H.props.children,G.mode,nt,H.key),nt.return=G,G=nt):(nt=yr(H.type,H.key,H.props,null,G.mode,nt),dl(nt,H),nt.return=G,G=nt)}return d(G);case B:t:{for(vt=H.key;W!==null;){if(W.key===vt)if(W.tag===4&&W.stateNode.containerInfo===H.containerInfo&&W.stateNode.implementation===H.implementation){n(G,W.sibling),nt=a(W,H.children||[]),nt.return=G,G=nt;break t}else{n(G,W);break}else e(G,W);W=W.sibling}nt=mu(H,G.mode,nt),nt.return=G,G=nt}return d(G);case C:return H=Pi(H),kt(G,W,H,nt)}if(x(H))return ct(G,W,H,nt);if(it(H)){if(vt=it(H),typeof vt!="function")throw Error(s(150));return H=vt.call(H),yt(G,W,H,nt)}if(typeof H.then=="function")return kt(G,W,Or(H),nt);if(H.$$typeof===z)return kt(G,W,_r(G,H),nt);Nr(G,H)}return typeof H=="string"&&H!==""||typeof H=="number"||typeof H=="bigint"?(H=""+H,W!==null&&W.tag===6?(n(G,W.sibling),nt=a(W,H),nt.return=G,G=nt):(n(G,W),nt=du(H,G.mode,nt),nt.return=G,G=nt),d(G)):n(G,W)}return function(G,W,H,nt){try{fl=0;var vt=kt(G,W,H,nt);return Ca=null,vt}catch(mt){if(mt===ya||mt===Er)throw mt;var Vt=Ge(29,mt,null,G.mode);return Vt.lanes=nt,Vt.return=G,Vt}}}var Mi=af(!0),lf=af(!1),ni=!1;function Nu(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Au(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,callbacks:null})}function Fi(t){return{lane:t,tag:0,payload:null,callback:null,next:null}}function Ii(t,e,n){var i=t.updateQueue;if(i===null)return null;if(i=i.shared,(Mt&2)!==0){var a=i.pending;return a===null?e.next=e:(e.next=a.next,a.next=e),i.pending=e,e=pr(t),Bc(t,null,n),e}return gr(t,i,e,n),pr(t)}function ml(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194048)!==0)){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,Kh(t,n)}}function wu(t,e){var n=t.updateQueue,i=t.alternate;if(i!==null&&(i=i.updateQueue,n===i)){var a=null,l=null;if(n=n.firstBaseUpdate,n!==null){do{var d={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};l===null?a=l=d:l=l.next=d,n=n.next}while(n!==null);l===null?a=l=e:l=l.next=e}else a=l=e;n={baseState:i.baseState,firstBaseUpdate:a,lastBaseUpdate:l,shared:i.shared,callbacks:i.callbacks},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}var xu=!1;function vl(){if(xu){var t=pa;if(t!==null)throw t}}function gl(t,e,n,i){xu=!1;var a=t.updateQueue;ni=!1;var l=a.firstBaseUpdate,d=a.lastBaseUpdate,b=a.shared.pending;if(b!==null){a.shared.pending=null;var I=b,Y=I.next;I.next=null,d===null?l=Y:d.next=Y,d=I;var et=t.alternate;et!==null&&(et=et.updateQueue,b=et.lastBaseUpdate,b!==d&&(b===null?et.firstBaseUpdate=Y:b.next=Y,et.lastBaseUpdate=I))}if(l!==null){var at=a.baseState;d=0,et=Y=I=null,b=l;do{var X=b.lane&-536870913,J=X!==b.lane;if(J?(xt&X)===X:(i&X)===X){X!==0&&X===ga&&(xu=!0),et!==null&&(et=et.next={lane:0,tag:b.tag,payload:b.payload,callback:null,next:null});t:{var ct=t,yt=b;X=e;var kt=n;switch(yt.tag){case 1:if(ct=yt.payload,typeof ct=="function"){at=ct.call(kt,at,X);break t}at=ct;break t;case 3:ct.flags=ct.flags&-65537|128;case 0:if(ct=yt.payload,X=typeof ct=="function"?ct.call(kt,at,X):ct,X==null)break t;at=f({},at,X);break t;case 2:ni=!0}}X=b.callback,X!==null&&(t.flags|=64,J&&(t.flags|=8192),J=a.callbacks,J===null?a.callbacks=[X]:J.push(X))}else J={lane:X,tag:b.tag,payload:b.payload,callback:b.callback,next:null},et===null?(Y=et=J,I=at):et=et.next=J,d|=X;if(b=b.next,b===null){if(b=a.shared.pending,b===null)break;J=b,b=J.next,J.next=null,a.lastBaseUpdate=J,a.shared.pending=null}}while(!0);et===null&&(I=at),a.baseState=I,a.firstBaseUpdate=Y,a.lastBaseUpdate=et,l===null&&(a.shared.lanes=0),si|=d,t.lanes=d,t.memoizedState=at}}function rf(t,e){if(typeof t!="function")throw Error(s(191,t));t.call(e)}function sf(t,e){var n=t.callbacks;if(n!==null)for(t.callbacks=null,t=0;t<n.length;t++)rf(n[t],e)}var Sa=L(null),Ar=L(0);function uf(t,e){t=Gn,rt(Ar,t),rt(Sa,e),Gn=t|e.baseLanes}function Du(){rt(Ar,Gn),rt(Sa,Sa.current)}function Ru(){Gn=Ar.current,$(Sa),$(Ar)}var qe=L(null),nn=null;function ii(t){var e=t.alternate;rt(ne,ne.current&1),rt(qe,t),nn===null&&(e===null||Sa.current!==null||e.memoizedState!==null)&&(nn=t)}function Vu(t){rt(ne,ne.current),rt(qe,t),nn===null&&(nn=t)}function of(t){t.tag===22?(rt(ne,ne.current),rt(qe,t),nn===null&&(nn=t)):ai(t)}function ai(){rt(ne,ne.current),rt(qe,qe.current)}function ze(t){$(qe),nn===t&&(nn=null),$(ne)}var ne=L(0);function wr(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||jo(n)||Wo(n)))return e}else if(e.tag===19&&(e.memoizedProps.revealOrder==="forwards"||e.memoizedProps.revealOrder==="backwards"||e.memoizedProps.revealOrder==="unstable_legacy-backwards"||e.memoizedProps.revealOrder==="together")){if((e.flags&128)!==0)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var Ln=0,Tt=null,jt=null,le=null,xr=!1,_a=!1,ji=!1,Dr=0,pl=0,ba=null,Jp=0;function te(){throw Error(s(321))}function Pu(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Be(t[n],e[n]))return!1;return!0}function Lu(t,e,n,i,a,l){return Ln=l,Tt=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,D.H=t===null||t.memoizedState===null?Hf:Xu,ji=!1,l=n(i,a),ji=!1,_a&&(l=cf(e,n,i,a)),hf(t),l}function hf(t){D.H=Sl;var e=jt!==null&&jt.next!==null;if(Ln=0,le=jt=Tt=null,xr=!1,pl=0,ba=null,e)throw Error(s(300));t===null||re||(t=t.dependencies,t!==null&&Sr(t)&&(re=!0))}function cf(t,e,n,i){Tt=t;var a=0;do{if(_a&&(ba=null),pl=0,_a=!1,25<=a)throw Error(s(301));if(a+=1,le=jt=null,t.updateQueue!=null){var l=t.updateQueue;l.lastEffect=null,l.events=null,l.stores=null,l.memoCache!=null&&(l.memoCache.index=0)}D.H=Yf,l=e(n,i)}while(_a);return l}function $p(){var t=D.H,e=t.useState()[0];return e=typeof e.then=="function"?yl(e):e,t=t.useState()[0],(jt!==null?jt.memoizedState:null)!==t&&(Tt.flags|=1024),e}function Mu(){var t=Dr!==0;return Dr=0,t}function Fu(t,e,n){e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~n}function Iu(t){if(xr){for(t=t.memoizedState;t!==null;){var e=t.queue;e!==null&&(e.pending=null),t=t.next}xr=!1}Ln=0,le=jt=Tt=null,_a=!1,pl=Dr=0,ba=null}function Oe(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return le===null?Tt.memoizedState=le=t:le=le.next=t,le}function ie(){if(jt===null){var t=Tt.alternate;t=t!==null?t.memoizedState:null}else t=jt.next;var e=le===null?Tt.memoizedState:le.next;if(e!==null)le=e,jt=t;else{if(t===null)throw Tt.alternate===null?Error(s(467)):Error(s(310));jt=t,t={memoizedState:jt.memoizedState,baseState:jt.baseState,baseQueue:jt.baseQueue,queue:jt.queue,next:null},le===null?Tt.memoizedState=le=t:le=le.next=t}return le}function Rr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function yl(t){var e=pl;return pl+=1,ba===null&&(ba=[]),t=tf(ba,t,e),e=Tt,(le===null?e.memoizedState:le.next)===null&&(e=e.alternate,D.H=e===null||e.memoizedState===null?Hf:Xu),t}function Vr(t){if(t!==null&&typeof t=="object"){if(typeof t.then=="function")return yl(t);if(t.$$typeof===z)return Ce(t)}throw Error(s(438,String(t)))}function ju(t){var e=null,n=Tt.updateQueue;if(n!==null&&(e=n.memoCache),e==null){var i=Tt.alternate;i!==null&&(i=i.updateQueue,i!==null&&(i=i.memoCache,i!=null&&(e={data:i.data.map(function(a){return a.slice()}),index:0})))}if(e??={data:[],index:0},n===null&&(n=Rr(),Tt.updateQueue=n),n.memoCache=e,n=e.data[e.index],n===void 0)for(n=e.data[e.index]=Array(t),i=0;i<t;i++)n[i]=F;return e.index++,n}function Mn(t,e){return typeof e=="function"?e(t):e}function Pr(t){return Wu(ie(),jt,t)}function Wu(t,e,n){var i=t.queue;if(i===null)throw Error(s(311));i.lastRenderedReducer=n;var a=t.baseQueue,l=i.pending;if(l!==null){if(a!==null){var d=a.next;a.next=l.next,l.next=d}e.baseQueue=a=l,i.pending=null}if(l=t.baseState,a===null)t.memoizedState=l;else{e=a.next;var b=d=null,I=null,Y=e,et=!1;do{var at=Y.lane&-536870913;if(at!==Y.lane?(xt&at)===at:(Ln&at)===at){var X=Y.revertLane;if(X===0)I!==null&&(I=I.next={lane:0,revertLane:0,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null}),at===ga&&(et=!0);else if((Ln&X)===X){Y=Y.next,X===ga&&(et=!0);continue}else at={lane:0,revertLane:Y.revertLane,gesture:null,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},I===null?(b=I=at,d=l):I=I.next=at,Tt.lanes|=X,si|=X;at=Y.action,ji&&n(l,at),l=Y.hasEagerState?Y.eagerState:n(l,at)}else X={lane:at,revertLane:Y.revertLane,gesture:Y.gesture,action:Y.action,hasEagerState:Y.hasEagerState,eagerState:Y.eagerState,next:null},I===null?(b=I=X,d=l):I=I.next=X,Tt.lanes|=at,si|=at;Y=Y.next}while(Y!==null&&Y!==e);if(I===null?d=l:I.next=b,!Be(l,t.memoizedState)&&(re=!0,et&&(n=pa,n!==null)))throw n;t.memoizedState=l,t.baseState=d,t.baseQueue=I,i.lastRenderedState=l}return a===null&&(i.lanes=0),[t.memoizedState,i.dispatch]}function ku(t){var e=ie(),n=e.queue;if(n===null)throw Error(s(311));n.lastRenderedReducer=t;var i=n.dispatch,a=n.pending,l=e.memoizedState;if(a!==null){n.pending=null;var d=a=a.next;do l=t(l,d.action),d=d.next;while(d!==a);Be(l,e.memoizedState)||(re=!0),e.memoizedState=l,e.baseQueue===null&&(e.baseState=l),n.lastRenderedState=l}return[l,i]}function ff(t,e,n){var i=Tt,a=ie(),l=Rt;if(l){if(n===void 0)throw Error(s(407));n=n()}else n=e();var d=!Be((jt||a).memoizedState,n);if(d&&(a.memoizedState=n,re=!0),a=a.queue,qu(vf.bind(null,i,a,t),[t]),a.getSnapshot!==e||d||le!==null&&le.memoizedState.tag&1){if(i.flags|=2048,Ea(9,{destroy:void 0},mf.bind(null,i,a,n,e),null),Gt===null)throw Error(s(349));l||(Ln&127)!==0||df(i,e,n)}return n}function df(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Tt.updateQueue,e===null?(e=Rr(),Tt.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function mf(t,e,n,i){e.value=n,e.getSnapshot=i,gf(e)&&pf(t)}function vf(t,e,n){return n(function(){gf(e)&&pf(t)})}function gf(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Be(t,n)}catch{return!0}}function pf(t){var e=Ai(t,2);e!==null&&Le(e,t,2)}function Bu(t){var e=Oe();if(typeof t=="function"){var n=t;if(t=n(),ji){Ae(!0);try{n()}finally{Ae(!1)}}}return e.memoizedState=e.baseState=t,e.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mn,lastRenderedState:t},e}function yf(t,e,n,i){return t.baseState=n,Wu(t,jt,typeof i=="function"?i:Mn)}function ty(t,e,n,i,a){if(Fr(t))throw Error(s(485));if(t=e.action,t!==null){var l={payload:a,action:t,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(d){l.listeners.push(d)}};D.T!==null?n(!0):l.isTransition=!1,i(l),n=e.pending,n===null?(l.next=e.pending=l,Cf(e,l)):(l.next=n.next,e.pending=n.next=l)}}function Cf(t,e){var n=e.action,i=e.payload,a=t.state;if(e.isTransition){var l=D.T,d={};D.T=d;try{var b=n(a,i),I=D.S;I!==null&&I(d,b),Sf(t,e,b)}catch(Y){Gu(t,e,Y)}finally{l!==null&&d.types!==null&&(l.types=d.types),D.T=l}}else try{l=n(a,i),Sf(t,e,l)}catch(Y){Gu(t,e,Y)}}function Sf(t,e,n){n!==null&&typeof n=="object"&&typeof n.then=="function"?n.then(function(i){_f(t,e,i)},function(i){return Gu(t,e,i)}):_f(t,e,n)}function _f(t,e,n){e.status="fulfilled",e.value=n,bf(e),t.state=n,e=t.pending,e!==null&&(n=e.next,n===e?t.pending=null:(n=n.next,e.next=n,Cf(t,n)))}function Gu(t,e,n){var i=t.pending;if(t.pending=null,i!==null){i=i.next;do e.status="rejected",e.reason=n,bf(e),e=e.next;while(e!==i)}t.action=null}function bf(t){t=t.listeners;for(var e=0;e<t.length;e++)(0,t[e])()}function Ef(t,e){return e}function Tf(t,e){if(Rt){var n=Gt.formState;if(n!==null){t:{var i=Tt;if(Rt){if(Ut){e:{for(var a=Ut,l=en;a.nodeType!==8;){if(!l){a=null;break e}if(a=ln(a.nextSibling),a===null){a=null;break e}}l=a.data,a=l==="F!"||l==="F"?a:null}if(a){Ut=ln(a.nextSibling),i=a.data==="F!";break t}}ti(i)}i=!1}i&&(e=n[0])}}return n=Oe(),n.memoizedState=n.baseState=e,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ef,lastRenderedState:e},n.queue=i,n=qf.bind(null,Tt,i),i.dispatch=n,i=Bu(!1),l=Ku.bind(null,Tt,!1,i.queue),i=Oe(),a={state:e,dispatch:null,action:t,pending:null},i.queue=a,n=ty.bind(null,Tt,a,l,n),a.dispatch=n,i.memoizedState=t,[e,n,!1]}function Of(t){return Nf(ie(),jt,t)}function Nf(t,e,n){if(e=Wu(t,e,Ef)[0],t=Pr(Mn)[0],typeof e=="object"&&e!==null&&typeof e.then=="function")try{var i=yl(e)}catch(d){throw d===ya?Er:d}else i=e;e=ie();var a=e.queue,l=a.dispatch;return n!==e.memoizedState&&(Tt.flags|=2048,Ea(9,{destroy:void 0},ey.bind(null,a,n),null)),[i,l,t]}function ey(t,e){t.action=e}function Af(t){var e=ie(),n=jt;if(n!==null)return Nf(e,n,t);ie(),e=e.memoizedState,n=ie();var i=n.queue.dispatch;return n.memoizedState=t,[e,i,!1]}function Ea(t,e,n,i){return t={tag:t,create:n,deps:i,inst:e,next:null},e=Tt.updateQueue,e===null&&(e=Rr(),Tt.updateQueue=e),n=e.lastEffect,n===null?e.lastEffect=t.next=t:(i=n.next,n.next=t,t.next=i,e.lastEffect=t),t}function wf(){return ie().memoizedState}function Lr(t,e,n,i){var a=Oe();Tt.flags|=t,a.memoizedState=Ea(1|e,{destroy:void 0},n,i===void 0?null:i)}function Mr(t,e,n,i){var a=ie();i=i===void 0?null:i;var l=a.memoizedState.inst;jt!==null&&i!==null&&Pu(i,jt.memoizedState.deps)?a.memoizedState=Ea(e,l,n,i):(Tt.flags|=t,a.memoizedState=Ea(1|e,l,n,i))}function xf(t,e){Lr(8390656,8,t,e)}function qu(t,e){Mr(2048,8,t,e)}function ny(t){Tt.flags|=4;var e=Tt.updateQueue;if(e===null)e=Rr(),Tt.updateQueue=e,e.events=[t];else{var n=e.events;n===null?e.events=[t]:n.push(t)}}function Df(t){var e=ie().memoizedState;return ny({ref:e,nextImpl:t}),function(){if((Mt&2)!==0)throw Error(s(440));return e.impl.apply(void 0,arguments)}}function Rf(t,e){return Mr(4,2,t,e)}function Vf(t,e){return Mr(4,4,t,e)}function Pf(t,e){if(typeof e=="function"){t=t();var n=e(t);return function(){typeof n=="function"?n():e(null)}}if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function Lf(t,e,n){n=n!=null?n.concat([t]):null,Mr(4,4,Pf.bind(null,e,t),n)}function zu(){}function Mf(t,e){var n=ie();e=e===void 0?null:e;var i=n.memoizedState;return e!==null&&Pu(e,i[1])?i[0]:(n.memoizedState=[t,e],t)}function Ff(t,e){var n=ie();e=e===void 0?null:e;var i=n.memoizedState;if(e!==null&&Pu(e,i[1]))return i[0];if(i=t(),ji){Ae(!0);try{t()}finally{Ae(!1)}}return n.memoizedState=[i,e],i}function Uu(t,e,n){return n===void 0||(Ln&1073741824)!==0&&(xt&261930)===0?t.memoizedState=e:(t.memoizedState=n,t=Ld(),Tt.lanes|=t,si|=t,n)}function If(t,e,n,i){return Be(n,e)?n:Sa.current!==null?(t=Uu(t,n,i),Be(t,e)||(re=!0),t):(Ln&42)===0||(Ln&1073741824)!==0&&(xt&261930)===0?(re=!0,t.memoizedState=n):(t=Ld(),Tt.lanes|=t,si|=t,e)}function jf(t,e,n,i,a){var l=R.p;R.p=l!==0&&8>l?l:8;var d=D.T,b={};D.T=b,Ku(t,!1,e,n);try{var I=a(),Y=D.S;Y!==null&&Y(b,I),I!==null&&typeof I=="object"&&typeof I.then=="function"?Cl(t,e,Zp(I,i),an(t)):Cl(t,e,i,an(t))}catch(et){Cl(t,e,{then:function(){},status:"rejected",reason:et},an())}finally{R.p=l,d!==null&&b.types!==null&&(d.types=b.types),D.T=d}}function iy(){}function Hu(t,e,n,i){if(t.tag!==5)throw Error(s(476));var a=Wf(t).queue;jf(t,a,e,Z,n===null?iy:function(){return kf(t),n(i)})}function Wf(t){var e=t.memoizedState;if(e!==null)return e;e={memoizedState:Z,baseState:Z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mn,lastRenderedState:Z},next:null};var n={};return e.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mn,lastRenderedState:n},next:null},t.memoizedState=e,t=t.alternate,t!==null&&(t.memoizedState=e),e}function kf(t){var e=Wf(t);e.next===null&&(e=t.alternate.memoizedState),Cl(t,e.next.queue,{},an())}function Yu(){return Ce(Fl)}function Bf(){return ie().memoizedState}function Gf(){return ie().memoizedState}function ay(t){for(var e=t.return;e!==null;){switch(e.tag){case 24:case 3:var n=an();t=Fi(n);var i=Ii(e,t,n);i!==null&&(Le(i,e,n),ml(i,e,n)),e={cache:bu()},t.payload=e;return}e=e.return}}function ly(t,e,n){var i=an();n={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Fr(t)?zf(e,n):(n=cu(t,e,n,i),n!==null&&(Le(n,t,i),Uf(n,e,i)))}function qf(t,e,n){Cl(t,e,n,an())}function Cl(t,e,n,i){var a={lane:i,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Fr(t))zf(e,a);else{var l=t.alternate;if(t.lanes===0&&(l===null||l.lanes===0)&&(l=e.lastRenderedReducer,l!==null))try{var d=e.lastRenderedState,b=l(d,n);if(a.hasEagerState=!0,a.eagerState=b,Be(b,d))return gr(t,e,a,0),Gt===null&&vr(),!1}catch{}if(n=cu(t,e,a,i),n!==null)return Le(n,t,i),Uf(n,e,i),!0}return!1}function Ku(t,e,n,i){if(i={lane:2,revertLane:Ao(),gesture:null,action:i,hasEagerState:!1,eagerState:null,next:null},Fr(t)){if(e)throw Error(s(479))}else e=cu(t,n,i,2),e!==null&&Le(e,t,2)}function Fr(t){var e=t.alternate;return t===Tt||e!==null&&e===Tt}function zf(t,e){_a=xr=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Uf(t,e,n){if((n&4194048)!==0){var i=e.lanes;i&=t.pendingLanes,n|=i,e.lanes=n,Kh(t,n)}}var Sl={readContext:Ce,use:Vr,useCallback:te,useContext:te,useEffect:te,useImperativeHandle:te,useLayoutEffect:te,useInsertionEffect:te,useMemo:te,useReducer:te,useRef:te,useState:te,useDebugValue:te,useDeferredValue:te,useTransition:te,useSyncExternalStore:te,useId:te,useHostTransitionStatus:te,useFormState:te,useActionState:te,useOptimistic:te,useMemoCache:te,useCacheRefresh:te};Sl.useEffectEvent=te;var Hf={readContext:Ce,use:Vr,useCallback:function(t,e){return Oe().memoizedState=[t,e===void 0?null:e],t},useContext:Ce,useEffect:xf,useImperativeHandle:function(t,e,n){n=n!=null?n.concat([t]):null,Lr(4194308,4,Pf.bind(null,e,t),n)},useLayoutEffect:function(t,e){return Lr(4194308,4,t,e)},useInsertionEffect:function(t,e){Lr(4,2,t,e)},useMemo:function(t,e){var n=Oe();e=e===void 0?null:e;var i=t();if(ji){Ae(!0);try{t()}finally{Ae(!1)}}return n.memoizedState=[i,e],i},useReducer:function(t,e,n){var i=Oe();if(n!==void 0){var a=n(e);if(ji){Ae(!0);try{n(e)}finally{Ae(!1)}}}else a=e;return i.memoizedState=i.baseState=a,t={pending:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:a},i.queue=t,t=t.dispatch=ly.bind(null,Tt,t),[i.memoizedState,t]},useRef:function(t){var e=Oe();return t={current:t},e.memoizedState=t},useState:function(t){t=Bu(t);var e=t.queue,n=qf.bind(null,Tt,e);return e.dispatch=n,[t.memoizedState,n]},useDebugValue:zu,useDeferredValue:function(t,e){return Uu(Oe(),t,e)},useTransition:function(){var t=Bu(!1);return t=jf.bind(null,Tt,t.queue,!0,!1),Oe().memoizedState=t,[!1,t]},useSyncExternalStore:function(t,e,n){var i=Tt,a=Oe();if(Rt){if(n===void 0)throw Error(s(407));n=n()}else{if(n=e(),Gt===null)throw Error(s(349));(xt&127)!==0||df(i,e,n)}a.memoizedState=n;var l={value:n,getSnapshot:e};return a.queue=l,xf(vf.bind(null,i,l,t),[t]),i.flags|=2048,Ea(9,{destroy:void 0},mf.bind(null,i,l,n,e),null),n},useId:function(){var t=Oe(),e=Gt.identifierPrefix;if(Rt){var n=mn,i=dn;n=(i&~(1<<32-ke(i)-1)).toString(32)+n,e="_"+e+"R_"+n,n=Dr++,0<n&&(e+="H"+n.toString(32)),e+="_"}else n=Jp++,e="_"+e+"r_"+n.toString(32)+"_";return t.memoizedState=e},useHostTransitionStatus:Yu,useFormState:Tf,useActionState:Tf,useOptimistic:function(t){var e=Oe();e.memoizedState=e.baseState=t;var n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return e.queue=n,e=Ku.bind(null,Tt,!0,n),n.dispatch=e,[t,e]},useMemoCache:ju,useCacheRefresh:function(){return Oe().memoizedState=ay.bind(null,Tt)},useEffectEvent:function(t){var e=Oe(),n={impl:t};return e.memoizedState=n,function(){if((Mt&2)!==0)throw Error(s(440));return n.impl.apply(void 0,arguments)}}},Xu={readContext:Ce,use:Vr,useCallback:Mf,useContext:Ce,useEffect:qu,useImperativeHandle:Lf,useInsertionEffect:Rf,useLayoutEffect:Vf,useMemo:Ff,useReducer:Pr,useRef:wf,useState:function(){return Pr(Mn)},useDebugValue:zu,useDeferredValue:function(t,e){return If(ie(),jt.memoizedState,t,e)},useTransition:function(){var t=Pr(Mn)[0],e=ie().memoizedState;return[typeof t=="boolean"?t:yl(t),e]},useSyncExternalStore:ff,useId:Bf,useHostTransitionStatus:Yu,useFormState:Of,useActionState:Of,useOptimistic:function(t,e){return yf(ie(),jt,t,e)},useMemoCache:ju,useCacheRefresh:Gf};Xu.useEffectEvent=Df;var Yf={readContext:Ce,use:Vr,useCallback:Mf,useContext:Ce,useEffect:qu,useImperativeHandle:Lf,useInsertionEffect:Rf,useLayoutEffect:Vf,useMemo:Ff,useReducer:ku,useRef:wf,useState:function(){return ku(Mn)},useDebugValue:zu,useDeferredValue:function(t,e){var n=ie();return jt===null?Uu(n,t,e):If(n,jt.memoizedState,t,e)},useTransition:function(){var t=ku(Mn)[0],e=ie().memoizedState;return[typeof t=="boolean"?t:yl(t),e]},useSyncExternalStore:ff,useId:Bf,useHostTransitionStatus:Yu,useFormState:Af,useActionState:Af,useOptimistic:function(t,e){var n=ie();return jt!==null?yf(n,jt,t,e):(n.baseState=t,[t,n.queue.dispatch])},useMemoCache:ju,useCacheRefresh:Gf};Yf.useEffectEvent=Df;function Qu(t,e,n,i){e=t.memoizedState,n=n(i,e),n=n==null?e:f({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Zu={enqueueSetState:function(t,e,n){t=t._reactInternals;var i=an(),a=Fi(i);a.payload=e,n!=null&&(a.callback=n),e=Ii(t,a,i),e!==null&&(Le(e,t,i),ml(e,t,i))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var i=an(),a=Fi(i);a.tag=1,a.payload=e,n!=null&&(a.callback=n),e=Ii(t,a,i),e!==null&&(Le(e,t,i),ml(e,t,i))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=an(),i=Fi(n);i.tag=2,e!=null&&(i.callback=e),e=Ii(t,i,n),e!==null&&(Le(e,t,n),ml(e,t,n))}};function Kf(t,e,n,i,a,l,d){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(i,l,d):e.prototype&&e.prototype.isPureReactComponent?!rl(n,i)||!rl(a,l):!0}function Xf(t,e,n,i){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,i),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,i),e.state!==t&&Zu.enqueueReplaceState(e,e.state,null)}function Wi(t,e){var n=e;if("ref"in e){n={};for(var i in e)i!=="ref"&&(n[i]=e[i])}if(t=t.defaultProps){n===e&&(n=f({},n));for(var a in t)n[a]===void 0&&(n[a]=t[a])}return n}function ry(t){mr(t)}function sy(t){console.error(t)}function uy(t){mr(t)}function Ir(t,e){try{var n=t.onUncaughtError;n(e.value,{componentStack:e.stack})}catch(i){setTimeout(function(){throw i})}}function Qf(t,e,n){try{var i=t.onCaughtError;i(n.value,{componentStack:n.stack,errorBoundary:e.tag===1?e.stateNode:null})}catch(a){setTimeout(function(){throw a})}}function Ju(t,e,n){return n=Fi(n),n.tag=3,n.payload={element:null},n.callback=function(){Ir(t,e)},n}function Zf(t){return t=Fi(t),t.tag=3,t}function Jf(t,e,n,i){var a=n.type.getDerivedStateFromError;if(typeof a=="function"){var l=i.value;t.payload=function(){return a(l)},t.callback=function(){Qf(e,n,i)}}var d=n.stateNode;d!==null&&typeof d.componentDidCatch=="function"&&(t.callback=function(){Qf(e,n,i),typeof a!="function"&&(ui===null?ui=new Set([this]):ui.add(this));var b=i.stack;this.componentDidCatch(i.value,{componentStack:b!==null?b:""})})}function oy(t,e,n,i,a){if(n.flags|=32768,i!==null&&typeof i=="object"&&typeof i.then=="function"){if(e=n.alternate,e!==null&&va(e,n,a,!0),n=qe.current,n!==null){switch(n.tag){case 31:case 13:return nn===null?Xr():n.alternate===null&&ee===0&&(ee=3),n.flags&=-257,n.flags|=65536,n.lanes=a,i===Tr?n.flags|=16384:(e=n.updateQueue,e===null?n.updateQueue=new Set([i]):e.add(i),To(t,i,a)),!1;case 22:return n.flags|=65536,i===Tr?n.flags|=16384:(e=n.updateQueue,e===null?(e={transitions:null,markerInstances:null,retryQueue:new Set([i])},n.updateQueue=e):(n=e.retryQueue,n===null?e.retryQueue=new Set([i]):n.add(i)),To(t,i,a)),!1}throw Error(s(435,n.tag))}return To(t,i,a),Xr(),!1}if(Rt)return e=qe.current,e!==null?((e.flags&65536)===0&&(e.flags|=256),e.flags|=65536,e.lanes=a,i!==pu&&(t=Error(s(422),{cause:i}),ol(Je(t,n)))):(i!==pu&&(e=Error(s(423),{cause:i}),ol(Je(e,n))),t=t.current.alternate,t.flags|=65536,a&=-a,t.lanes|=a,i=Je(i,n),a=Ju(t.stateNode,i,a),wu(t,a),ee!==4&&(ee=2)),!1;var l=Error(s(520),{cause:i});if(l=Je(l,n),wl===null?wl=[l]:wl.push(l),ee!==4&&(ee=2),e===null)return!0;i=Je(i,n),n=e;do{switch(n.tag){case 3:return n.flags|=65536,t=a&-a,n.lanes|=t,t=Ju(n.stateNode,i,t),wu(n,t),!1;case 1:if(e=n.type,l=n.stateNode,(n.flags&128)===0&&(typeof e.getDerivedStateFromError=="function"||l!==null&&typeof l.componentDidCatch=="function"&&(ui===null||!ui.has(l))))return n.flags|=65536,a&=-a,n.lanes|=a,a=Zf(a),Jf(a,t,n,i),wu(n,a),!1}n=n.return}while(n!==null);return!1}var $u=Error(s(461)),re=!1;function Se(t,e,n,i){e.child=t===null?lf(e,null,n,i):Mi(e,t.child,n,i)}function $f(t,e,n,i,a){n=n.render;var l=e.ref;if("ref"in i){var d={};for(var b in i)b!=="ref"&&(d[b]=i[b])}else d=i;return Ri(e),i=Lu(t,e,n,d,l,a),b=Mu(),t!==null&&!re?(Fu(t,e,a),Fn(t,e,a)):(Rt&&b&&vu(e),e.flags|=1,Se(t,e,i,a),e.child)}function td(t,e,n,i,a){if(t===null){var l=n.type;return typeof l=="function"&&!fu(l)&&l.defaultProps===void 0&&n.compare===null?(e.tag=15,e.type=l,ed(t,e,l,i,a)):(t=yr(n.type,null,i,e,e.mode,a),t.ref=e.ref,t.return=e,e.child=t)}if(l=t.child,!so(t,a)){var d=l.memoizedProps;if(n=n.compare,n=n!==null?n:rl,n(d,i)&&t.ref===e.ref)return Fn(t,e,a)}return e.flags|=1,t=Dn(l,i),t.ref=e.ref,t.return=e,e.child=t}function ed(t,e,n,i,a){if(t!==null){var l=t.memoizedProps;if(rl(l,i)&&t.ref===e.ref)if(re=!1,e.pendingProps=i=l,so(t,a))(t.flags&131072)!==0&&(re=!0);else return e.lanes=t.lanes,Fn(t,e,a)}return to(t,e,n,i,a)}function nd(t,e,n,i){var a=i.children,l=t!==null?t.memoizedState:null;if(t===null&&e.stateNode===null&&(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),i.mode==="hidden"){if((e.flags&128)!==0){if(l=l!==null?l.baseLanes|n:n,t!==null){for(i=e.child=t.child,a=0;i!==null;)a=a|i.lanes|i.childLanes,i=i.sibling;i=a&~l}else i=0,e.child=null;return id(t,e,l,n,i)}if((n&536870912)!==0)e.memoizedState={baseLanes:0,cachePool:null},t!==null&&br(e,l!==null?l.cachePool:null),l!==null?uf(e,l):Du(),of(e);else return i=e.lanes=536870912,id(t,e,l!==null?l.baseLanes|n:n,n,i)}else l!==null?(br(e,l.cachePool),uf(e,l),ai(e),e.memoizedState=null):(t!==null&&br(e,null),Du(),ai(e));return Se(t,e,a,n),e.child}function _l(t,e){return t!==null&&t.tag===22||e.stateNode!==null||(e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),e.sibling}function id(t,e,n,i,a){var l=Tu();return l=l===null?null:{parent:ae._currentValue,pool:l},e.memoizedState={baseLanes:n,cachePool:l},t!==null&&br(e,null),Du(),of(e),t!==null&&va(t,e,i,!0),e.childLanes=a,null}function jr(t,e){return e=kr({mode:e.mode,children:e.children},t.mode),e.ref=t.ref,t.child=e,e.return=t,e}function ad(t,e,n){return Mi(e,t.child,null,n),t=jr(e,e.pendingProps),t.flags|=2,ze(e),e.memoizedState=null,t}function hy(t,e,n){var i=e.pendingProps,a=(e.flags&128)!==0;if(e.flags&=-129,t===null){if(Rt){if(i.mode==="hidden")return t=jr(e,i),e.lanes=536870912,_l(null,t);if(Vu(e),(t=Ut)?(t=pm(t,en),t=t!==null&&t.data==="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:Jn!==null?{id:dn,overflow:mn}:null,retryLane:536870912,hydrationErrors:null},n=qc(t),n.return=e,e.child=n,ye=e,Ut=null)):t=null,t===null)throw ti(e);return e.lanes=536870912,null}return jr(e,i)}var l=t.memoizedState;if(l!==null){var d=l.dehydrated;if(Vu(e),a)if(e.flags&256)e.flags&=-257,e=ad(t,e,n);else if(e.memoizedState!==null)e.child=t.child,e.flags|=128,e=null;else throw Error(s(558));else if(re||va(t,e,n,!1),a=(n&t.childLanes)!==0,re||a){if(i=Gt,i!==null&&(d=Xh(i,n),d!==0&&d!==l.retryLane))throw l.retryLane=d,Ai(t,d),Le(i,t,d),$u;Xr(),e=ad(t,e,n)}else t=l.treeContext,Ut=ln(d.nextSibling),ye=e,Rt=!0,$n=null,en=!1,t!==null&&Hc(e,t),e=jr(e,i),e.flags|=4096;return e}return t=Dn(t.child,{mode:i.mode,children:i.children}),t.ref=e.ref,e.child=t,t.return=e,t}function Wr(t,e){var n=e.ref;if(n===null)t!==null&&t.ref!==null&&(e.flags|=4194816);else{if(typeof n!="function"&&typeof n!="object")throw Error(s(284));(t===null||t.ref!==n)&&(e.flags|=4194816)}}function to(t,e,n,i,a){return Ri(e),n=Lu(t,e,n,i,void 0,a),i=Mu(),t!==null&&!re?(Fu(t,e,a),Fn(t,e,a)):(Rt&&i&&vu(e),e.flags|=1,Se(t,e,n,a),e.child)}function ld(t,e,n,i,a,l){return Ri(e),e.updateQueue=null,n=cf(e,i,n,a),hf(t),i=Mu(),t!==null&&!re?(Fu(t,e,l),Fn(t,e,l)):(Rt&&i&&vu(e),e.flags|=1,Se(t,e,n,l),e.child)}function rd(t,e,n,i,a){if(Ri(e),e.stateNode===null){var l=ca,d=n.contextType;typeof d=="object"&&d!==null&&(l=Ce(d)),l=new n(i,l),e.memoizedState=l.state!==null&&l.state!==void 0?l.state:null,l.updater=Zu,e.stateNode=l,l._reactInternals=e,l=e.stateNode,l.props=i,l.state=e.memoizedState,l.refs={},Nu(e),d=n.contextType,l.context=typeof d=="object"&&d!==null?Ce(d):ca,l.state=e.memoizedState,d=n.getDerivedStateFromProps,typeof d=="function"&&(Qu(e,n,d,i),l.state=e.memoizedState),typeof n.getDerivedStateFromProps=="function"||typeof l.getSnapshotBeforeUpdate=="function"||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(d=l.state,typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount(),d!==l.state&&Zu.enqueueReplaceState(l,l.state,null),gl(e,i,l,a),vl(),l.state=e.memoizedState),typeof l.componentDidMount=="function"&&(e.flags|=4194308),i=!0}else if(t===null){l=e.stateNode;var b=e.memoizedProps,I=Wi(n,b);l.props=I;var Y=l.context,et=n.contextType;d=ca,typeof et=="object"&&et!==null&&(d=Ce(et));var at=n.getDerivedStateFromProps;et=typeof at=="function"||typeof l.getSnapshotBeforeUpdate=="function",b=e.pendingProps!==b,et||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(b||Y!==d)&&Xf(e,l,i,d),ni=!1;var X=e.memoizedState;l.state=X,gl(e,i,l,a),vl(),Y=e.memoizedState,b||X!==Y||ni?(typeof at=="function"&&(Qu(e,n,at,i),Y=e.memoizedState),(I=ni||Kf(e,n,I,i,X,Y,d))?(et||typeof l.UNSAFE_componentWillMount!="function"&&typeof l.componentWillMount!="function"||(typeof l.componentWillMount=="function"&&l.componentWillMount(),typeof l.UNSAFE_componentWillMount=="function"&&l.UNSAFE_componentWillMount()),typeof l.componentDidMount=="function"&&(e.flags|=4194308)):(typeof l.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=i,e.memoizedState=Y),l.props=i,l.state=Y,l.context=d,i=I):(typeof l.componentDidMount=="function"&&(e.flags|=4194308),i=!1)}else{l=e.stateNode,Au(t,e),d=e.memoizedProps,et=Wi(n,d),l.props=et,at=e.pendingProps,X=l.context,Y=n.contextType,I=ca,typeof Y=="object"&&Y!==null&&(I=Ce(Y)),b=n.getDerivedStateFromProps,(Y=typeof b=="function"||typeof l.getSnapshotBeforeUpdate=="function")||typeof l.UNSAFE_componentWillReceiveProps!="function"&&typeof l.componentWillReceiveProps!="function"||(d!==at||X!==I)&&Xf(e,l,i,I),ni=!1,X=e.memoizedState,l.state=X,gl(e,i,l,a),vl();var J=e.memoizedState;d!==at||X!==J||ni||t!==null&&t.dependencies!==null&&Sr(t.dependencies)?(typeof b=="function"&&(Qu(e,n,b,i),J=e.memoizedState),(et=ni||Kf(e,n,et,i,X,J,I)||t!==null&&t.dependencies!==null&&Sr(t.dependencies))?(Y||typeof l.UNSAFE_componentWillUpdate!="function"&&typeof l.componentWillUpdate!="function"||(typeof l.componentWillUpdate=="function"&&l.componentWillUpdate(i,J,I),typeof l.UNSAFE_componentWillUpdate=="function"&&l.UNSAFE_componentWillUpdate(i,J,I)),typeof l.componentDidUpdate=="function"&&(e.flags|=4),typeof l.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof l.componentDidUpdate!="function"||d===t.memoizedProps&&X===t.memoizedState||(e.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||d===t.memoizedProps&&X===t.memoizedState||(e.flags|=1024),e.memoizedProps=i,e.memoizedState=J),l.props=i,l.state=J,l.context=I,i=et):(typeof l.componentDidUpdate!="function"||d===t.memoizedProps&&X===t.memoizedState||(e.flags|=4),typeof l.getSnapshotBeforeUpdate!="function"||d===t.memoizedProps&&X===t.memoizedState||(e.flags|=1024),i=!1)}return l=i,Wr(t,e),i=(e.flags&128)!==0,l||i?(l=e.stateNode,n=i&&typeof n.getDerivedStateFromError!="function"?null:l.render(),e.flags|=1,t!==null&&i?(e.child=Mi(e,t.child,null,a),e.child=Mi(e,null,n,a)):Se(t,e,n,a),e.memoizedState=l.state,t=e.child):t=Fn(t,e,a),t}function sd(t,e,n,i){return xi(),e.flags|=256,Se(t,e,n,i),e.child}var eo={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function no(t){return{baseLanes:t,cachePool:Jc()}}function io(t,e,n){return t=t!==null?t.childLanes&~n:0,e&&(t|=He),t}function ud(t,e,n){var i=e.pendingProps,a=!1,l=(e.flags&128)!==0,d;if((d=l)||(d=t!==null&&t.memoizedState===null?!1:(ne.current&2)!==0),d&&(a=!0,e.flags&=-129),d=(e.flags&32)!==0,e.flags&=-33,t===null){if(Rt){if(a?ii(e):ai(e),(t=Ut)?(t=pm(t,en),t=t!==null&&t.data!=="&"?t:null,t!==null&&(e.memoizedState={dehydrated:t,treeContext:Jn!==null?{id:dn,overflow:mn}:null,retryLane:536870912,hydrationErrors:null},n=qc(t),n.return=e,e.child=n,ye=e,Ut=null)):t=null,t===null)throw ti(e);return Wo(t)?e.lanes=32:e.lanes=536870912,null}var b=i.children;return i=i.fallback,a?(ai(e),a=e.mode,b=kr({mode:"hidden",children:b},a),i=wi(i,a,n,null),b.return=e,i.return=e,b.sibling=i,e.child=b,i=e.child,i.memoizedState=no(n),i.childLanes=io(t,d,n),e.memoizedState=eo,_l(null,i)):(ii(e),ao(e,b))}var I=t.memoizedState;if(I!==null&&(b=I.dehydrated,b!==null)){if(l)e.flags&256?(ii(e),e.flags&=-257,e=lo(t,e,n)):e.memoizedState!==null?(ai(e),e.child=t.child,e.flags|=128,e=null):(ai(e),b=i.fallback,a=e.mode,i=kr({mode:"visible",children:i.children},a),b=wi(b,a,n,null),b.flags|=2,i.return=e,b.return=e,i.sibling=b,e.child=i,Mi(e,t.child,null,n),i=e.child,i.memoizedState=no(n),i.childLanes=io(t,d,n),e.memoizedState=eo,e=_l(null,i));else if(ii(e),Wo(b)){if(d=b.nextSibling&&b.nextSibling.dataset,d)var Y=d.dgst;d=Y,i=Error(s(419)),i.stack="",i.digest=d,ol({value:i,source:null,stack:null}),e=lo(t,e,n)}else if(re||va(t,e,n,!1),d=(n&t.childLanes)!==0,re||d){if(d=Gt,d!==null&&(i=Xh(d,n),i!==0&&i!==I.retryLane))throw I.retryLane=i,Ai(t,i),Le(d,t,i),$u;jo(b)||Xr(),e=lo(t,e,n)}else jo(b)?(e.flags|=192,e.child=t.child,e=null):(t=I.treeContext,Ut=ln(b.nextSibling),ye=e,Rt=!0,$n=null,en=!1,t!==null&&Hc(e,t),e=ao(e,i.children),e.flags|=4096);return e}return a?(ai(e),b=i.fallback,a=e.mode,I=t.child,Y=I.sibling,i=Dn(I,{mode:"hidden",children:i.children}),i.subtreeFlags=I.subtreeFlags&65011712,Y!==null?b=Dn(Y,b):(b=wi(b,a,n,null),b.flags|=2),b.return=e,i.return=e,i.sibling=b,e.child=i,_l(null,i),i=e.child,b=t.child.memoizedState,b===null?b=no(n):(a=b.cachePool,a!==null?(I=ae._currentValue,a=a.parent!==I?{parent:I,pool:I}:a):a=Jc(),b={baseLanes:b.baseLanes|n,cachePool:a}),i.memoizedState=b,i.childLanes=io(t,d,n),e.memoizedState=eo,_l(t.child,i)):(ii(e),n=t.child,t=n.sibling,n=Dn(n,{mode:"visible",children:i.children}),n.return=e,n.sibling=null,t!==null&&(d=e.deletions,d===null?(e.deletions=[t],e.flags|=16):d.push(t)),e.child=n,e.memoizedState=null,n)}function ao(t,e){return e=kr({mode:"visible",children:e},t.mode),e.return=t,t.child=e}function kr(t,e){return t=Ge(22,t,null,e),t.lanes=0,t}function lo(t,e,n){return Mi(e,t.child,null,n),t=ao(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function od(t,e,n){t.lanes|=e;var i=t.alternate;i!==null&&(i.lanes|=e),Su(t.return,e,n)}function ro(t,e,n,i,a,l){var d=t.memoizedState;d===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:i,tail:n,tailMode:a,treeForkCount:l}:(d.isBackwards=e,d.rendering=null,d.renderingStartTime=0,d.last=i,d.tail=n,d.tailMode=a,d.treeForkCount=l)}function hd(t,e,n){var i=e.pendingProps,a=i.revealOrder,l=i.tail;i=i.children;var d=ne.current,b=(d&2)!==0;if(b?(d=d&1|2,e.flags|=128):d&=1,rt(ne,d),Se(t,e,i,n),i=Rt?ul:0,!b&&t!==null&&(t.flags&128)!==0)t:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&od(t,n,e);else if(t.tag===19)od(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break t;for(;t.sibling===null;){if(t.return===null||t.return===e)break t;t=t.return}t.sibling.return=t.return,t=t.sibling}switch(a){case"forwards":for(n=e.child,a=null;n!==null;)t=n.alternate,t!==null&&wr(t)===null&&(a=n),n=n.sibling;n=a,n===null?(a=e.child,e.child=null):(a=n.sibling,n.sibling=null),ro(e,!1,a,n,l,i);break;case"backwards":case"unstable_legacy-backwards":for(n=null,a=e.child,e.child=null;a!==null;){if(t=a.alternate,t!==null&&wr(t)===null){e.child=a;break}t=a.sibling,a.sibling=n,n=a,a=t}ro(e,!0,n,null,l,i);break;case"together":ro(e,!1,null,null,void 0,i);break;default:e.memoizedState=null}return e.child}function Fn(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),si|=e.lanes,(n&e.childLanes)===0)if(t!==null){if(va(t,e,n,!1),(n&e.childLanes)===0)return null}else return null;if(t!==null&&e.child!==t.child)throw Error(s(153));if(e.child!==null){for(t=e.child,n=Dn(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Dn(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function so(t,e){return(t.lanes&e)!==0?!0:(t=t.dependencies,!!(t!==null&&Sr(t)))}function cy(t,e,n){switch(e.tag){case 3:Yt(e,e.stateNode.containerInfo),ei(e,ae,t.memoizedState.cache),xi();break;case 27:case 5:ge(e);break;case 4:Yt(e,e.stateNode.containerInfo);break;case 10:ei(e,e.type,e.memoizedProps.value);break;case 31:if(e.memoizedState!==null)return e.flags|=128,Vu(e),null;break;case 13:var i=e.memoizedState;if(i!==null)return i.dehydrated!==null?(ii(e),e.flags|=128,null):(n&e.child.childLanes)!==0?ud(t,e,n):(ii(e),t=Fn(t,e,n),t!==null?t.sibling:null);ii(e);break;case 19:var a=(t.flags&128)!==0;if(i=(n&e.childLanes)!==0,i||(va(t,e,n,!1),i=(n&e.childLanes)!==0),a){if(i)return hd(t,e,n);e.flags|=128}if(a=e.memoizedState,a!==null&&(a.rendering=null,a.tail=null,a.lastEffect=null),rt(ne,ne.current),i)break;return null;case 22:return e.lanes=0,nd(t,e,n,e.pendingProps);case 24:ei(e,ae,t.memoizedState.cache)}return Fn(t,e,n)}function cd(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps)re=!0;else{if(!so(t,n)&&(e.flags&128)===0)return re=!1,cy(t,e,n);re=(t.flags&131072)!==0}else re=!1,Rt&&(e.flags&1048576)!==0&&Uc(e,ul,e.index);switch(e.lanes=0,e.tag){case 16:t:{var i=e.pendingProps;if(t=Pi(e.elementType),e.type=t,typeof t=="function")fu(t)?(i=Wi(t,i),e.tag=1,e=rd(null,e,t,i,n)):(e.tag=0,e=to(null,e,t,i,n));else{if(t!=null){var a=t.$$typeof;if(a===Q){e.tag=11,e=$f(null,e,t,i,n);break t}else if(a===N){e.tag=14,e=td(null,e,t,i,n);break t}}throw e=E(t)||t,Error(s(306,e,""))}}return e;case 0:return to(t,e,e.type,e.pendingProps,n);case 1:return i=e.type,a=Wi(i,e.pendingProps),rd(t,e,i,a,n);case 3:t:{if(Yt(e,e.stateNode.containerInfo),t===null)throw Error(s(387));i=e.pendingProps;var l=e.memoizedState;a=l.element,Au(t,e),gl(e,i,null,n);var d=e.memoizedState;if(i=d.cache,ei(e,ae,i),i!==l.cache&&_u(e,[ae],n,!0),vl(),i=d.element,l.isDehydrated)if(l={element:i,isDehydrated:!1,cache:d.cache},e.updateQueue.baseState=l,e.memoizedState=l,e.flags&256){e=sd(t,e,i,n);break t}else if(i!==a){a=Je(Error(s(424)),e),ol(a),e=sd(t,e,i,n);break t}else{switch(t=e.stateNode.containerInfo,t.nodeType){case 9:t=t.body;break;default:t=t.nodeName==="HTML"?t.ownerDocument.body:t}for(Ut=ln(t.firstChild),ye=e,Rt=!0,$n=null,en=!0,n=lf(e,null,i,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling}else{if(xi(),i===a){e=Fn(t,e,n);break t}Se(t,e,i,n)}e=e.child}return e;case 26:return Wr(t,e),t===null?(n=Em(e.type,null,e.pendingProps,null))?e.memoizedState=n:Rt||(n=e.type,t=e.pendingProps,i=ns(Ct.current).createElement(n),i[pe]=e,i[we]=t,_e(i,n,t),me(i),e.stateNode=i):e.memoizedState=Em(e.type,t.memoizedProps,e.pendingProps,t.memoizedState),null;case 27:return ge(e),t===null&&Rt&&(i=e.stateNode=Sm(e.type,e.pendingProps,Ct.current),ye=e,en=!0,a=Ut,fi(e.type)?(ko=a,Ut=ln(i.firstChild)):Ut=a),Se(t,e,e.pendingProps.children,n),Wr(t,e),t===null&&(e.flags|=4194304),e.child;case 5:return t===null&&Rt&&((a=i=Ut)&&(i=Wy(i,e.type,e.pendingProps,en),i!==null?(e.stateNode=i,ye=e,Ut=ln(i.firstChild),en=!1,a=!0):a=!1),a||ti(e)),ge(e),a=e.type,l=e.pendingProps,d=t!==null?t.memoizedProps:null,i=l.children,Mo(a,l)?i=null:d!==null&&Mo(a,d)&&(e.flags|=32),e.memoizedState!==null&&(a=Lu(t,e,$p,null,null,n),Fl._currentValue=a),Wr(t,e),Se(t,e,i,n),e.child;case 6:return t===null&&Rt&&((t=n=Ut)&&(n=ky(n,e.pendingProps,en),n!==null?(e.stateNode=n,ye=e,Ut=null,t=!0):t=!1),t||ti(e)),null;case 13:return ud(t,e,n);case 4:return Yt(e,e.stateNode.containerInfo),i=e.pendingProps,t===null?e.child=Mi(e,null,i,n):Se(t,e,i,n),e.child;case 11:return $f(t,e,e.type,e.pendingProps,n);case 7:return Se(t,e,e.pendingProps,n),e.child;case 8:return Se(t,e,e.pendingProps.children,n),e.child;case 12:return Se(t,e,e.pendingProps.children,n),e.child;case 10:return i=e.pendingProps,ei(e,e.type,i.value),Se(t,e,i.children,n),e.child;case 9:return a=e.type._context,i=e.pendingProps.children,Ri(e),a=Ce(a),i=i(a),e.flags|=1,Se(t,e,i,n),e.child;case 14:return td(t,e,e.type,e.pendingProps,n);case 15:return ed(t,e,e.type,e.pendingProps,n);case 19:return hd(t,e,n);case 31:return hy(t,e,n);case 22:return nd(t,e,n,e.pendingProps);case 24:return Ri(e),i=Ce(ae),t===null?(a=Tu(),a===null&&(a=Gt,l=bu(),a.pooledCache=l,l.refCount++,l!==null&&(a.pooledCacheLanes|=n),a=l),e.memoizedState={parent:i,cache:a},Nu(e),ei(e,ae,a)):((t.lanes&n)!==0&&(Au(t,e),gl(e,null,null,n),vl()),a=t.memoizedState,l=e.memoizedState,a.parent!==i?(a={parent:i,cache:i},e.memoizedState=a,e.lanes===0&&(e.memoizedState=e.updateQueue.baseState=a),ei(e,ae,i)):(i=l.cache,ei(e,ae,i),i!==a.cache&&_u(e,[ae],n,!0))),Se(t,e,e.pendingProps.children,n),e.child;case 29:throw e.pendingProps}throw Error(s(156,e.tag))}function In(t){t.flags|=4}function uo(t,e,n,i,a){if((e=(t.mode&32)!==0)&&(e=!1),e){if(t.flags|=16777216,(a&335544128)===a)if(t.stateNode.complete)t.flags|=8192;else if(jd())t.flags|=8192;else throw Li=Tr,Ou}else t.flags&=-16777217}function fd(t,e){if(e.type!=="stylesheet"||(e.state.loading&4)!==0)t.flags&=-16777217;else if(t.flags|=16777216,!wm(e))if(jd())t.flags|=8192;else throw Li=Tr,Ou}function Br(t,e){e!==null&&(t.flags|=4),t.flags&16384&&(e=t.tag!==22?Hh():536870912,t.lanes|=e,Aa|=e)}function bl(t,e){if(!Rt)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var i=null;n!==null;)n.alternate!==null&&(i=n),n=n.sibling;i===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:i.sibling=null}}function Ht(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,i=0;if(e)for(var a=t.child;a!==null;)n|=a.lanes|a.childLanes,i|=a.subtreeFlags&65011712,i|=a.flags&65011712,a.return=t,a=a.sibling;else for(a=t.child;a!==null;)n|=a.lanes|a.childLanes,i|=a.subtreeFlags,i|=a.flags,a.return=t,a=a.sibling;return t.subtreeFlags|=i,t.childLanes=n,e}function fy(t,e,n){var i=e.pendingProps;switch(gu(e),e.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ht(e),null;case 1:return Ht(e),null;case 3:return n=e.stateNode,i=null,t!==null&&(i=t.memoizedState.cache),e.memoizedState.cache!==i&&(e.flags|=2048),Pn(ae),qt(),n.pendingContext&&(n.context=n.pendingContext,n.pendingContext=null),(t===null||t.child===null)&&(ma(e)?In(e):t===null||t.memoizedState.isDehydrated&&(e.flags&256)===0||(e.flags|=1024,yu())),Ht(e),null;case 26:var a=e.type,l=e.memoizedState;return t===null?(In(e),l!==null?(Ht(e),fd(e,l)):(Ht(e),uo(e,a,null,i,n))):l?l!==t.memoizedState?(In(e),Ht(e),fd(e,l)):(Ht(e),e.flags&=-16777217):(t=t.memoizedProps,t!==i&&In(e),Ht(e),uo(e,a,t,i,n)),null;case 27:if(je(e),n=Ct.current,a=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==i&&In(e);else{if(!i){if(e.stateNode===null)throw Error(s(166));return Ht(e),null}t=ut.current,ma(e)?Yc(e,t):(t=Sm(a,i,n),e.stateNode=t,In(e))}return Ht(e),null;case 5:if(je(e),a=e.type,t!==null&&e.stateNode!=null)t.memoizedProps!==i&&In(e);else{if(!i){if(e.stateNode===null)throw Error(s(166));return Ht(e),null}if(l=ut.current,ma(e))Yc(e,l);else{var d=ns(Ct.current);switch(l){case 1:l=d.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:l=d.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":l=d.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":l=d.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":l=d.createElement("div"),l.innerHTML="<script><\/script>",l=l.removeChild(l.firstChild);break;case"select":l=typeof i.is=="string"?d.createElement("select",{is:i.is}):d.createElement("select"),i.multiple?l.multiple=!0:i.size&&(l.size=i.size);break;default:l=typeof i.is=="string"?d.createElement(a,{is:i.is}):d.createElement(a)}}l[pe]=e,l[we]=i;t:for(d=e.child;d!==null;){if(d.tag===5||d.tag===6)l.appendChild(d.stateNode);else if(d.tag!==4&&d.tag!==27&&d.child!==null){d.child.return=d,d=d.child;continue}if(d===e)break t;for(;d.sibling===null;){if(d.return===null||d.return===e)break t;d=d.return}d.sibling.return=d.return,d=d.sibling}e.stateNode=l;t:switch(_e(l,a,i),a){case"button":case"input":case"select":case"textarea":i=!!i.autoFocus;break t;case"img":i=!0;break t;default:i=!1}i&&In(e)}}return Ht(e),uo(e,e.type,t===null?null:t.memoizedProps,e.pendingProps,n),null;case 6:if(t&&e.stateNode!=null)t.memoizedProps!==i&&In(e);else{if(typeof i!="string"&&e.stateNode===null)throw Error(s(166));if(t=Ct.current,ma(e)){if(t=e.stateNode,n=e.memoizedProps,i=null,a=ye,a!==null)switch(a.tag){case 27:case 5:i=a.memoizedProps}t[pe]=e,t=!!(t.nodeValue===n||i!==null&&i.suppressHydrationWarning===!0||om(t.nodeValue,n)),t||ti(e,!0)}else t=ns(t).createTextNode(i),t[pe]=e,e.stateNode=t}return Ht(e),null;case 31:if(n=e.memoizedState,t===null||t.memoizedState!==null){if(i=ma(e),n!==null){if(t===null){if(!i)throw Error(s(318));if(t=e.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(s(557));t[pe]=e}else xi(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Ht(e),t=!1}else n=yu(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=n),t=!0;if(!t)return e.flags&256?(ze(e),e):(ze(e),null);if((e.flags&128)!==0)throw Error(s(558))}return Ht(e),null;case 13:if(i=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(a=ma(e),i!==null&&i.dehydrated!==null){if(t===null){if(!a)throw Error(s(318));if(a=e.memoizedState,a=a!==null?a.dehydrated:null,!a)throw Error(s(317));a[pe]=e}else xi(),(e.flags&128)===0&&(e.memoizedState=null),e.flags|=4;Ht(e),a=!1}else a=yu(),t!==null&&t.memoizedState!==null&&(t.memoizedState.hydrationErrors=a),a=!0;if(!a)return e.flags&256?(ze(e),e):(ze(e),null)}return ze(e),(e.flags&128)!==0?(e.lanes=n,e):(n=i!==null,t=t!==null&&t.memoizedState!==null,n&&(i=e.child,a=null,i.alternate!==null&&i.alternate.memoizedState!==null&&i.alternate.memoizedState.cachePool!==null&&(a=i.alternate.memoizedState.cachePool.pool),l=null,i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(l=i.memoizedState.cachePool.pool),l!==a&&(i.flags|=2048)),n!==t&&n&&(e.child.flags|=8192),Br(e,e.updateQueue),Ht(e),null);case 4:return qt(),t===null&&lm(e.stateNode.containerInfo),Ht(e),null;case 10:return Pn(e.type),Ht(e),null;case 19:if($(ne),i=e.memoizedState,i===null)return Ht(e),null;if(a=(e.flags&128)!==0,l=i.rendering,l===null)if(a)bl(i,!1);else{if(ee!==0||t!==null&&(t.flags&128)!==0)for(t=e.child;t!==null;){if(l=wr(t),l!==null){for(e.flags|=128,bl(i,!1),t=l.updateQueue,e.updateQueue=t,Br(e,t),e.subtreeFlags=0,t=n,n=e.child;n!==null;)Gc(n,t),n=n.sibling;return rt(ne,ne.current&1|2),Rt&&Rn(e,i.treeForkCount),e.child}t=t.sibling}i.tail!==null&&U()>Hr&&(e.flags|=128,a=!0,bl(i,!1),e.lanes=4194304)}else{if(!a)if(t=wr(l),t!==null){if(e.flags|=128,a=!0,t=t.updateQueue,e.updateQueue=t,Br(e,t),bl(i,!0),i.tail===null&&i.tailMode==="hidden"&&!l.alternate&&!Rt)return Ht(e),null}else 2*U()-i.renderingStartTime>Hr&&n!==536870912&&(e.flags|=128,a=!0,bl(i,!1),e.lanes=4194304);i.isBackwards?(l.sibling=e.child,e.child=l):(t=i.last,t!==null?t.sibling=l:e.child=l,i.last=l)}return i.tail!==null?(t=i.tail,i.rendering=t,i.tail=t.sibling,i.renderingStartTime=U(),t.sibling=null,n=ne.current,rt(ne,a?n&1|2:n&1),Rt&&Rn(e,i.treeForkCount),t):(Ht(e),null);case 22:case 23:return ze(e),Ru(),i=e.memoizedState!==null,t!==null?t.memoizedState!==null!==i&&(e.flags|=8192):i&&(e.flags|=8192),i?(n&536870912)!==0&&(e.flags&128)===0&&(Ht(e),e.subtreeFlags&6&&(e.flags|=8192)):Ht(e),n=e.updateQueue,n!==null&&Br(e,n.retryQueue),n=null,t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),i=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(i=e.memoizedState.cachePool.pool),i!==n&&(e.flags|=2048),t!==null&&$(Vi),null;case 24:return n=null,t!==null&&(n=t.memoizedState.cache),e.memoizedState.cache!==n&&(e.flags|=2048),Pn(ae),Ht(e),null;case 25:return null;case 30:return null}throw Error(s(156,e.tag))}function dy(t,e){switch(gu(e),e.tag){case 1:return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return Pn(ae),qt(),t=e.flags,(t&65536)!==0&&(t&128)===0?(e.flags=t&-65537|128,e):null;case 26:case 27:case 5:return je(e),null;case 31:if(e.memoizedState!==null){if(ze(e),e.alternate===null)throw Error(s(340));xi()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 13:if(ze(e),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(s(340));xi()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return $(ne),null;case 4:return qt(),null;case 10:return Pn(e.type),null;case 22:case 23:return ze(e),Ru(),t!==null&&$(Vi),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 24:return Pn(ae),null;case 25:return null;default:return null}}function dd(t,e){switch(gu(e),e.tag){case 3:Pn(ae),qt();break;case 26:case 27:case 5:je(e);break;case 4:qt();break;case 31:e.memoizedState!==null&&ze(e);break;case 13:ze(e);break;case 19:$(ne);break;case 10:Pn(e.type);break;case 22:case 23:ze(e),Ru(),t!==null&&$(Vi);break;case 24:Pn(ae)}}function El(t,e){try{var n=e.updateQueue,i=n!==null?n.lastEffect:null;if(i!==null){var a=i.next;n=a;do{if((n.tag&t)===t){i=void 0;var l=n.create,d=n.inst;i=l(),d.destroy=i}n=n.next}while(n!==a)}}catch(b){It(e,e.return,b)}}function li(t,e,n){try{var i=e.updateQueue,a=i!==null?i.lastEffect:null;if(a!==null){var l=a.next;i=l;do{if((i.tag&t)===t){var d=i.inst,b=d.destroy;if(b!==void 0){d.destroy=void 0,a=e;var I=n,Y=b;try{Y()}catch(et){It(a,I,et)}}}i=i.next}while(i!==l)}}catch(et){It(e,e.return,et)}}function md(t){var e=t.updateQueue;if(e!==null){var n=t.stateNode;try{sf(e,n)}catch(i){It(t,t.return,i)}}}function vd(t,e,n){n.props=Wi(t.type,t.memoizedProps),n.state=t.memoizedState;try{n.componentWillUnmount()}catch(i){It(t,e,i)}}function Tl(t,e){try{var n=t.ref;if(n!==null){switch(t.tag){case 26:case 27:case 5:var i=t.stateNode;break;case 30:i=t.stateNode;break;default:i=t.stateNode}typeof n=="function"?t.refCleanup=n(i):n.current=i}}catch(a){It(t,e,a)}}function vn(t,e){var n=t.ref,i=t.refCleanup;if(n!==null)if(typeof i=="function")try{i()}catch(a){It(t,e,a)}finally{t.refCleanup=null,t=t.alternate,t!=null&&(t.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(a){It(t,e,a)}else n.current=null}function gd(t){var e=t.type,n=t.memoizedProps,i=t.stateNode;try{t:switch(e){case"button":case"input":case"select":case"textarea":n.autoFocus&&i.focus();break t;case"img":n.src?i.src=n.src:n.srcSet&&(i.srcset=n.srcSet)}}catch(a){It(t,t.return,a)}}function oo(t,e,n){try{var i=t.stateNode;Py(i,t.type,n,e),i[we]=e}catch(a){It(t,t.return,a)}}function pd(t){return t.tag===5||t.tag===3||t.tag===26||t.tag===27&&fi(t.type)||t.tag===4}function ho(t){t:for(;;){for(;t.sibling===null;){if(t.return===null||pd(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.tag===27&&fi(t.type)||t.flags&2||t.child===null||t.tag===4)continue t;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function co(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(t,e):(e=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,e.appendChild(t),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=wn));else if(i!==4&&(i===27&&fi(t.type)&&(n=t.stateNode,e=null),t=t.child,t!==null))for(co(t,e,n),t=t.sibling;t!==null;)co(t,e,n),t=t.sibling}function Gr(t,e,n){var i=t.tag;if(i===5||i===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(i!==4&&(i===27&&fi(t.type)&&(n=t.stateNode),t=t.child,t!==null))for(Gr(t,e,n),t=t.sibling;t!==null;)Gr(t,e,n),t=t.sibling}function yd(t){var e=t.stateNode,n=t.memoizedProps;try{for(var i=t.type,a=e.attributes;a.length;)e.removeAttributeNode(a[0]);_e(e,i,n),e[pe]=t,e[we]=n}catch(l){It(t,t.return,l)}}var jn=!1,se=!1,fo=!1,Cd=typeof WeakSet=="function"?WeakSet:Set,ve=null;function my(t,e){if(t=t.containerInfo,Po=os,t=Pc(t),lu(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else t:{n=(n=t.ownerDocument)&&n.defaultView||window;var i=n.getSelection&&n.getSelection();if(i&&i.rangeCount!==0){n=i.anchorNode;var a=i.anchorOffset,l=i.focusNode;i=i.focusOffset;try{n.nodeType,l.nodeType}catch{n=null;break t}var d=0,b=-1,I=-1,Y=0,et=0,at=t,X=null;e:for(;;){for(var J;at!==n||a!==0&&at.nodeType!==3||(b=d+a),at!==l||i!==0&&at.nodeType!==3||(I=d+i),at.nodeType===3&&(d+=at.nodeValue.length),(J=at.firstChild)!==null;)X=at,at=J;for(;;){if(at===t)break e;if(X===n&&++Y===a&&(b=d),X===l&&++et===i&&(I=d),(J=at.nextSibling)!==null)break;at=X,X=at.parentNode}at=J}n=b===-1||I===-1?null:{start:b,end:I}}else n=null}n=n||{start:0,end:0}}else n=null;for(Lo={focusedElem:t,selectionRange:n},os=!1,ve=e;ve!==null;)if(e=ve,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ve=t;else for(;ve!==null;){switch(e=ve,l=e.alternate,t=e.flags,e.tag){case 0:if((t&4)!==0&&(t=e.updateQueue,t=t!==null?t.events:null,t!==null))for(n=0;n<t.length;n++)a=t[n],a.ref.impl=a.nextImpl;break;case 11:case 15:break;case 1:if((t&1024)!==0&&l!==null){t=void 0,n=e,a=l.memoizedProps,l=l.memoizedState,i=n.stateNode;try{var ct=Wi(n.type,a);t=i.getSnapshotBeforeUpdate(ct,l),i.__reactInternalSnapshotBeforeUpdate=t}catch(yt){It(n,n.return,yt)}}break;case 3:if((t&1024)!==0){if(t=e.stateNode.containerInfo,n=t.nodeType,n===9)Io(t);else if(n===1)switch(t.nodeName){case"HEAD":case"HTML":case"BODY":Io(t);break;default:t.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((t&1024)!==0)throw Error(s(163))}if(t=e.sibling,t!==null){t.return=e.return,ve=t;break}ve=e.return}}function Sd(t,e,n){var i=n.flags;switch(n.tag){case 0:case 11:case 15:kn(t,n),i&4&&El(5,n);break;case 1:if(kn(t,n),i&4)if(t=n.stateNode,e===null)try{t.componentDidMount()}catch(d){It(n,n.return,d)}else{var a=Wi(n.type,e.memoizedProps);e=e.memoizedState;try{t.componentDidUpdate(a,e,t.__reactInternalSnapshotBeforeUpdate)}catch(d){It(n,n.return,d)}}i&64&&md(n),i&512&&Tl(n,n.return);break;case 3:if(kn(t,n),i&64&&(t=n.updateQueue,t!==null)){if(e=null,n.child!==null)switch(n.child.tag){case 27:case 5:e=n.child.stateNode;break;case 1:e=n.child.stateNode}try{sf(t,e)}catch(d){It(n,n.return,d)}}break;case 27:e===null&&i&4&&yd(n);case 26:case 5:kn(t,n),e===null&&i&4&&gd(n),i&512&&Tl(n,n.return);break;case 12:kn(t,n);break;case 31:kn(t,n),i&4&&Ed(t,n);break;case 13:kn(t,n),i&4&&Td(t,n),i&64&&(t=n.memoizedState,t!==null&&(t=t.dehydrated,t!==null&&(n=Ey.bind(null,n),By(t,n))));break;case 22:if(i=n.memoizedState!==null||jn,!i){e=e!==null&&e.memoizedState!==null||se,a=jn;var l=se;jn=i,(se=e)&&!l?Bn(t,n,(n.subtreeFlags&8772)!==0):kn(t,n),jn=a,se=l}break;case 30:break;default:kn(t,n)}}function _d(t){var e=t.alternate;e!==null&&(t.alternate=null,_d(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&Gs(e)),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}var Qt=null,De=!1;function Wn(t,e,n){for(n=n.child;n!==null;)bd(t,e,n),n=n.sibling}function bd(t,e,n){if(fe&&typeof fe.onCommitFiberUnmount=="function")try{fe.onCommitFiberUnmount(We,n)}catch{}switch(n.tag){case 26:se||vn(n,e),Wn(t,e,n),n.memoizedState?n.memoizedState.count--:n.stateNode&&(n=n.stateNode,n.parentNode.removeChild(n));break;case 27:se||vn(n,e);var i=Qt,a=De;fi(n.type)&&(Qt=n.stateNode,De=!1),Wn(t,e,n),Pl(n.stateNode),Qt=i,De=a;break;case 5:se||vn(n,e);case 6:if(i=Qt,a=De,Qt=null,Wn(t,e,n),Qt=i,De=a,Qt!==null)if(De)try{(Qt.nodeType===9?Qt.body:Qt.nodeName==="HTML"?Qt.ownerDocument.body:Qt).removeChild(n.stateNode)}catch(l){It(n,e,l)}else try{Qt.removeChild(n.stateNode)}catch(l){It(n,e,l)}break;case 18:Qt!==null&&(De?(t=Qt,vm(t.nodeType===9?t.body:t.nodeName==="HTML"?t.ownerDocument.body:t,n.stateNode),Ma(t)):vm(Qt,n.stateNode));break;case 4:i=Qt,a=De,Qt=n.stateNode.containerInfo,De=!0,Wn(t,e,n),Qt=i,De=a;break;case 0:case 11:case 14:case 15:li(2,n,e),se||li(4,n,e),Wn(t,e,n);break;case 1:se||(vn(n,e),i=n.stateNode,typeof i.componentWillUnmount=="function"&&vd(n,e,i)),Wn(t,e,n);break;case 21:Wn(t,e,n);break;case 22:se=(i=se)||n.memoizedState!==null,Wn(t,e,n),se=i;break;default:Wn(t,e,n)}}function Ed(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null))){t=t.dehydrated;try{Ma(t)}catch(n){It(e,e.return,n)}}}function Td(t,e){if(e.memoizedState===null&&(t=e.alternate,t!==null&&(t=t.memoizedState,t!==null&&(t=t.dehydrated,t!==null))))try{Ma(t)}catch(n){It(e,e.return,n)}}function vy(t){switch(t.tag){case 31:case 13:case 19:var e=t.stateNode;return e===null&&(e=t.stateNode=new Cd),e;case 22:return t=t.stateNode,e=t._retryCache,e===null&&(e=t._retryCache=new Cd),e;default:throw Error(s(435,t.tag))}}function qr(t,e){var n=vy(t);e.forEach(function(i){if(!n.has(i)){n.add(i);var a=Ty.bind(null,t,i);i.then(a,a)}})}function Re(t,e){var n=e.deletions;if(n!==null)for(var i=0;i<n.length;i++){var a=n[i],l=t,d=e,b=d;t:for(;b!==null;){switch(b.tag){case 27:if(fi(b.type)){Qt=b.stateNode,De=!1;break t}break;case 5:Qt=b.stateNode,De=!1;break t;case 3:case 4:Qt=b.stateNode.containerInfo,De=!0;break t}b=b.return}if(Qt===null)throw Error(s(160));bd(l,d,a),Qt=null,De=!1,l=a.alternate,l!==null&&(l.return=null),a.return=null}if(e.subtreeFlags&13886)for(e=e.child;e!==null;)Od(e,t),e=e.sibling}var cn=null;function Od(t,e){var n=t.alternate,i=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:Re(e,t),Ve(t),i&4&&(li(3,t,t.return),El(3,t),li(5,t,t.return));break;case 1:Re(e,t),Ve(t),i&512&&(se||n===null||vn(n,n.return)),i&64&&jn&&(t=t.updateQueue,t!==null&&(i=t.callbacks,i!==null&&(n=t.shared.hiddenCallbacks,t.shared.hiddenCallbacks=n===null?i:n.concat(i))));break;case 26:var a=cn;if(Re(e,t),Ve(t),i&512&&(se||n===null||vn(n,n.return)),i&4){var l=n!==null?n.memoizedState:null;if(i=t.memoizedState,n===null)if(i===null)if(t.stateNode===null){t:{i=t.type,n=t.memoizedProps,a=a.ownerDocument||a;e:switch(i){case"title":l=a.getElementsByTagName("title")[0],(!l||l[Za]||l[pe]||l.namespaceURI==="http://www.w3.org/2000/svg"||l.hasAttribute("itemprop"))&&(l=a.createElement(i),a.head.insertBefore(l,a.querySelector("head > title"))),_e(l,i,n),l[pe]=t,me(l),i=l;break t;case"link":var d=Nm("link","href",a).get(i+(n.href||""));if(d){for(var b=0;b<d.length;b++)if(l=d[b],l.getAttribute("href")===(n.href==null||n.href===""?null:n.href)&&l.getAttribute("rel")===(n.rel==null?null:n.rel)&&l.getAttribute("title")===(n.title==null?null:n.title)&&l.getAttribute("crossorigin")===(n.crossOrigin==null?null:n.crossOrigin)){d.splice(b,1);break e}}l=a.createElement(i),_e(l,i,n),a.head.appendChild(l);break;case"meta":if(d=Nm("meta","content",a).get(i+(n.content||""))){for(b=0;b<d.length;b++)if(l=d[b],l.getAttribute("content")===(n.content==null?null:""+n.content)&&l.getAttribute("name")===(n.name==null?null:n.name)&&l.getAttribute("property")===(n.property==null?null:n.property)&&l.getAttribute("http-equiv")===(n.httpEquiv==null?null:n.httpEquiv)&&l.getAttribute("charset")===(n.charSet==null?null:n.charSet)){d.splice(b,1);break e}}l=a.createElement(i),_e(l,i,n),a.head.appendChild(l);break;default:throw Error(s(468,i))}l[pe]=t,me(l),i=l}t.stateNode=i}else Am(a,t.type,t.stateNode);else t.stateNode=Om(a,i,t.memoizedProps);else l!==i?(l===null?n.stateNode!==null&&(n=n.stateNode,n.parentNode.removeChild(n)):l.count--,i===null?Am(a,t.type,t.stateNode):Om(a,i,t.memoizedProps)):i===null&&t.stateNode!==null&&oo(t,t.memoizedProps,n.memoizedProps)}break;case 27:Re(e,t),Ve(t),i&512&&(se||n===null||vn(n,n.return)),n!==null&&i&4&&oo(t,t.memoizedProps,n.memoizedProps);break;case 5:if(Re(e,t),Ve(t),i&512&&(se||n===null||vn(n,n.return)),t.flags&32){a=t.stateNode;try{aa(a,"")}catch(ct){It(t,t.return,ct)}}i&4&&t.stateNode!=null&&(a=t.memoizedProps,oo(t,a,n!==null?n.memoizedProps:a)),i&1024&&(fo=!0);break;case 6:if(Re(e,t),Ve(t),i&4){if(t.stateNode===null)throw Error(s(162));i=t.memoizedProps,n=t.stateNode;try{n.nodeValue=i}catch(ct){It(t,t.return,ct)}}break;case 3:if(ls=null,a=cn,cn=is(e.containerInfo),Re(e,t),cn=a,Ve(t),i&4&&n!==null&&n.memoizedState.isDehydrated)try{Ma(e.containerInfo)}catch(ct){It(t,t.return,ct)}fo&&(fo=!1,Nd(t));break;case 4:i=cn,cn=is(t.stateNode.containerInfo),Re(e,t),Ve(t),cn=i;break;case 12:Re(e,t),Ve(t);break;case 31:Re(e,t),Ve(t),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,qr(t,i)));break;case 13:Re(e,t),Ve(t),t.child.flags&8192&&t.memoizedState!==null!=(n!==null&&n.memoizedState!==null)&&(Ur=U()),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,qr(t,i)));break;case 22:a=t.memoizedState!==null;var I=n!==null&&n.memoizedState!==null,Y=jn,et=se;if(jn=Y||a,se=et||I,Re(e,t),se=et,jn=Y,Ve(t),i&8192)t:for(e=t.stateNode,e._visibility=a?e._visibility&-2:e._visibility|1,a&&(n===null||I||jn||se||ki(t)),n=null,e=t;;){if(e.tag===5||e.tag===26){if(n===null){I=n=e;try{if(l=I.stateNode,a)d=l.style,typeof d.setProperty=="function"?d.setProperty("display","none","important"):d.display="none";else{b=I.stateNode;var at=I.memoizedProps.style,X=at!=null&&at.hasOwnProperty("display")?at.display:null;b.style.display=X==null||typeof X=="boolean"?"":(""+X).trim()}}catch(ct){It(I,I.return,ct)}}}else if(e.tag===6){if(n===null){I=e;try{I.stateNode.nodeValue=a?"":I.memoizedProps}catch(ct){It(I,I.return,ct)}}}else if(e.tag===18){if(n===null){I=e;try{var J=I.stateNode;a?gm(J,!0):gm(I.stateNode,!1)}catch(ct){It(I,I.return,ct)}}}else if((e.tag!==22&&e.tag!==23||e.memoizedState===null||e===t)&&e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break t;for(;e.sibling===null;){if(e.return===null||e.return===t)break t;n===e&&(n=null),e=e.return}n===e&&(n=null),e.sibling.return=e.return,e=e.sibling}i&4&&(i=t.updateQueue,i!==null&&(n=i.retryQueue,n!==null&&(i.retryQueue=null,qr(t,n))));break;case 19:Re(e,t),Ve(t),i&4&&(i=t.updateQueue,i!==null&&(t.updateQueue=null,qr(t,i)));break;case 30:break;case 21:break;default:Re(e,t),Ve(t)}}function Ve(t){var e=t.flags;if(e&2){try{for(var n,i=t.return;i!==null;){if(pd(i)){n=i;break}i=i.return}if(n==null)throw Error(s(160));switch(n.tag){case 27:var a=n.stateNode;Gr(t,ho(t),a);break;case 5:var l=n.stateNode;n.flags&32&&(aa(l,""),n.flags&=-33),Gr(t,ho(t),l);break;case 3:case 4:var d=n.stateNode.containerInfo;co(t,ho(t),d);break;default:throw Error(s(161))}}catch(b){It(t,t.return,b)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function Nd(t){if(t.subtreeFlags&1024)for(t=t.child;t!==null;){var e=t;Nd(e),e.tag===5&&e.flags&1024&&e.stateNode.reset(),t=t.sibling}}function kn(t,e){if(e.subtreeFlags&8772)for(e=e.child;e!==null;)Sd(t,e.alternate,e),e=e.sibling}function ki(t){for(t=t.child;t!==null;){var e=t;switch(e.tag){case 0:case 11:case 14:case 15:li(4,e,e.return),ki(e);break;case 1:vn(e,e.return);var n=e.stateNode;typeof n.componentWillUnmount=="function"&&vd(e,e.return,n),ki(e);break;case 27:Pl(e.stateNode);case 26:case 5:vn(e,e.return),ki(e);break;case 22:e.memoizedState===null&&ki(e);break;case 30:ki(e);break;default:ki(e)}t=t.sibling}}function Bn(t,e,n){for(n=n&&(e.subtreeFlags&8772)!==0,e=e.child;e!==null;){var i=e.alternate,a=t,l=e,d=l.flags;switch(l.tag){case 0:case 11:case 15:Bn(a,l,n),El(4,l);break;case 1:if(Bn(a,l,n),i=l,a=i.stateNode,typeof a.componentDidMount=="function")try{a.componentDidMount()}catch(Y){It(i,i.return,Y)}if(i=l,a=i.updateQueue,a!==null){var b=i.stateNode;try{var I=a.shared.hiddenCallbacks;if(I!==null)for(a.shared.hiddenCallbacks=null,a=0;a<I.length;a++)rf(I[a],b)}catch(Y){It(i,i.return,Y)}}n&&d&64&&md(l),Tl(l,l.return);break;case 27:yd(l);case 26:case 5:Bn(a,l,n),n&&i===null&&d&4&&gd(l),Tl(l,l.return);break;case 12:Bn(a,l,n);break;case 31:Bn(a,l,n),n&&d&4&&Ed(a,l);break;case 13:Bn(a,l,n),n&&d&4&&Td(a,l);break;case 22:l.memoizedState===null&&Bn(a,l,n),Tl(l,l.return);break;case 30:break;default:Bn(a,l,n)}e=e.sibling}}function mo(t,e){var n=null;t!==null&&t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(n=t.memoizedState.cachePool.pool),t=null,e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(t=e.memoizedState.cachePool.pool),t!==n&&(t!=null&&t.refCount++,n!=null&&hl(n))}function vo(t,e){t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&hl(t))}function fn(t,e,n,i){if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Ad(t,e,n,i),e=e.sibling}function Ad(t,e,n,i){var a=e.flags;switch(e.tag){case 0:case 11:case 15:fn(t,e,n,i),a&2048&&El(9,e);break;case 1:fn(t,e,n,i);break;case 3:fn(t,e,n,i),a&2048&&(t=null,e.alternate!==null&&(t=e.alternate.memoizedState.cache),e=e.memoizedState.cache,e!==t&&(e.refCount++,t!=null&&hl(t)));break;case 12:if(a&2048){fn(t,e,n,i),t=e.stateNode;try{var l=e.memoizedProps,d=l.id,b=l.onPostCommit;typeof b=="function"&&b(d,e.alternate===null?"mount":"update",t.passiveEffectDuration,-0)}catch(I){It(e,e.return,I)}}else fn(t,e,n,i);break;case 31:fn(t,e,n,i);break;case 13:fn(t,e,n,i);break;case 23:break;case 22:l=e.stateNode,d=e.alternate,e.memoizedState!==null?l._visibility&2?fn(t,e,n,i):Ol(t,e):l._visibility&2?fn(t,e,n,i):(l._visibility|=2,Ta(t,e,n,i,(e.subtreeFlags&10256)!==0||!1)),a&2048&&mo(d,e);break;case 24:fn(t,e,n,i),a&2048&&vo(e.alternate,e);break;default:fn(t,e,n,i)}}function Ta(t,e,n,i,a){for(a=a&&((e.subtreeFlags&10256)!==0||!1),e=e.child;e!==null;){var l=t,d=e,b=n,I=i,Y=d.flags;switch(d.tag){case 0:case 11:case 15:Ta(l,d,b,I,a),El(8,d);break;case 23:break;case 22:var et=d.stateNode;d.memoizedState!==null?et._visibility&2?Ta(l,d,b,I,a):Ol(l,d):(et._visibility|=2,Ta(l,d,b,I,a)),a&&Y&2048&&mo(d.alternate,d);break;case 24:Ta(l,d,b,I,a),a&&Y&2048&&vo(d.alternate,d);break;default:Ta(l,d,b,I,a)}e=e.sibling}}function Ol(t,e){if(e.subtreeFlags&10256)for(e=e.child;e!==null;){var n=t,i=e,a=i.flags;switch(i.tag){case 22:Ol(n,i),a&2048&&mo(i.alternate,i);break;case 24:Ol(n,i),a&2048&&vo(i.alternate,i);break;default:Ol(n,i)}e=e.sibling}}var Nl=8192;function Oa(t,e,n){if(t.subtreeFlags&Nl)for(t=t.child;t!==null;)wd(t,e,n),t=t.sibling}function wd(t,e,n){switch(t.tag){case 26:Oa(t,e,n),t.flags&Nl&&t.memoizedState!==null&&$y(n,cn,t.memoizedState,t.memoizedProps);break;case 5:Oa(t,e,n);break;case 3:case 4:var i=cn;cn=is(t.stateNode.containerInfo),Oa(t,e,n),cn=i;break;case 22:t.memoizedState===null&&(i=t.alternate,i!==null&&i.memoizedState!==null?(i=Nl,Nl=16777216,Oa(t,e,n),Nl=i):Oa(t,e,n));break;default:Oa(t,e,n)}}function xd(t){var e=t.alternate;if(e!==null&&(t=e.child,t!==null)){e.child=null;do e=t.sibling,t.sibling=null,t=e;while(t!==null)}}function Al(t){var e=t.deletions;if((t.flags&16)!==0){if(e!==null)for(var n=0;n<e.length;n++){var i=e[n];ve=i,Rd(i,t)}xd(t)}if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Dd(t),t=t.sibling}function Dd(t){switch(t.tag){case 0:case 11:case 15:Al(t),t.flags&2048&&li(9,t,t.return);break;case 3:Al(t);break;case 12:Al(t);break;case 22:var e=t.stateNode;t.memoizedState!==null&&e._visibility&2&&(t.return===null||t.return.tag!==13)?(e._visibility&=-3,zr(t)):Al(t);break;default:Al(t)}}function zr(t){var e=t.deletions;if((t.flags&16)!==0){if(e!==null)for(var n=0;n<e.length;n++){var i=e[n];ve=i,Rd(i,t)}xd(t)}for(t=t.child;t!==null;){switch(e=t,e.tag){case 0:case 11:case 15:li(8,e,e.return),zr(e);break;case 22:n=e.stateNode,n._visibility&2&&(n._visibility&=-3,zr(e));break;default:zr(e)}t=t.sibling}}function Rd(t,e){for(;ve!==null;){var n=ve;switch(n.tag){case 0:case 11:case 15:li(8,n,e);break;case 23:case 22:if(n.memoizedState!==null&&n.memoizedState.cachePool!==null){var i=n.memoizedState.cachePool.pool;i!=null&&i.refCount++}break;case 24:hl(n.memoizedState.cache)}if(i=n.child,i!==null)i.return=n,ve=i;else t:for(n=t;ve!==null;){i=ve;var a=i.sibling,l=i.return;if(_d(i),i===n){ve=null;break t}if(a!==null){a.return=l,ve=a;break t}ve=l}}}var gy={getCacheForType:function(t){var e=Ce(ae),n=e.data.get(t);return n===void 0&&(n=t(),e.data.set(t,n)),n},cacheSignal:function(){return Ce(ae).controller.signal}},py=typeof WeakMap=="function"?WeakMap:Map,Mt=0,Gt=null,At=null,xt=0,Ft=0,Ue=null,ri=!1,Na=!1,go=!1,Gn=0,ee=0,si=0,Bi=0,po=0,He=0,Aa=0,wl=null,Pe=null,yo=!1,Ur=0,Vd=0,Hr=1/0,Yr=null,ui=null,de=0,oi=null,wa=null,qn=0,Co=0,So=null,Pd=null,xl=0,_o=null;function an(){return(Mt&2)!==0&&xt!==0?xt&-xt:D.T!==null?Ao():Zh()}function Ld(){if(He===0)if((xt&536870912)===0||Rt){var t=tr;tr<<=1,(tr&3932160)===0&&(tr=262144),He=t}else He=536870912;return t=qe.current,t!==null&&(t.flags|=32),He}function Le(t,e,n){(t===Gt&&(Ft===2||Ft===9)||t.cancelPendingCommit!==null)&&(xa(t,0),hi(t,xt,He,!1)),ir(t,n),((Mt&2)===0||t!==Gt)&&(t===Gt&&((Mt&2)===0&&(Bi|=n),ee===4&&hi(t,xt,He,!1)),zn(t))}function Md(t,e,n){if((Mt&6)!==0)throw Error(s(327));var i=!n&&(e&127)===0&&(e&t.expiredLanes)===0||Xa(t,e),a=i?Sy(t,e):Eo(t,e,!0),l=i;do{if(a===0){Na&&!i&&hi(t,e,0,!1);break}else{if(n=t.current.alternate,l&&!yy(n)){a=Eo(t,e,!1),l=!1;continue}if(a===2){if(l=e,t.errorRecoveryDisabledLanes&l)var d=0;else d=t.pendingLanes&-536870913,d=d!==0?d:d&536870912?536870912:0;if(d!==0){e=d;t:{var b=t;a=wl;var I=b.current.memoizedState.isDehydrated;if(I&&(xa(b,d).flags|=256),d=Eo(b,d,!1),d!==2){if(go&&!I){b.errorRecoveryDisabledLanes|=l,Bi|=l,a=4;break t}l=Pe,Pe=a,l!==null&&(Pe===null?Pe=l:Pe.push.apply(Pe,l))}a=d}if(l=!1,a!==2)continue}}if(a===1){xa(t,0),hi(t,e,0,!0);break}t:{switch(i=t,l=a,l){case 0:case 1:throw Error(s(345));case 4:if((e&4194048)!==e)break;case 6:hi(i,e,He,!ri);break t;case 2:Pe=null;break;case 3:case 5:break;default:throw Error(s(329))}if((e&62914560)===e&&(a=Ur+300-U(),10<a)){if(hi(i,e,He,!ri),nr(i,0,!0)!==0)break t;qn=e,i.timeoutHandle=dm(Fd.bind(null,i,n,Pe,Yr,yo,e,He,Bi,Aa,ri,l,"Throttled",-0,0),a);break t}Fd(i,n,Pe,Yr,yo,e,He,Bi,Aa,ri,l,null,-0,0)}}break}while(!0);zn(t)}function Fd(t,e,n,i,a,l,d,b,I,Y,et,at,X,J){if(t.timeoutHandle=-1,at=e.subtreeFlags,at&8192||(at&16785408)===16785408){at={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:wn},wd(e,l,at);var ct=(l&62914560)===l?Ur-U():(l&4194048)===l?Vd-U():0;if(ct=tC(at,ct),ct!==null){qn=l,t.cancelPendingCommit=ct(zd.bind(null,t,e,l,n,i,a,d,b,I,et,at,null,X,J)),hi(t,l,d,!Y);return}}zd(t,e,l,n,i,a,d,b,I)}function yy(t){for(var e=t;;){var n=e.tag;if((n===0||n===11||n===15)&&e.flags&16384&&(n=e.updateQueue,n!==null&&(n=n.stores,n!==null)))for(var i=0;i<n.length;i++){var a=n[i],l=a.getSnapshot;a=a.value;try{if(!Be(l(),a))return!1}catch{return!1}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function hi(t,e,n,i){e&=~po,e&=~Bi,t.suspendedLanes|=e,t.pingedLanes&=~e,i&&(t.warmLanes|=e),i=t.expirationTimes;for(var a=e;0<a;){var l=31-ke(a),d=1<<l;i[l]=-1,a&=~d}n!==0&&Yh(t,n,e)}function Kr(){return(Mt&6)===0?(Dl(0,!1),!1):!0}function bo(){if(At!==null){if(Ft===0)var t=At.return;else t=At,Vn=Di=null,Iu(t),Ca=null,fl=0,t=At;for(;t!==null;)dd(t.alternate,t),t=t.return;At=null}}function xa(t,e){var n=t.timeoutHandle;n!==-1&&(t.timeoutHandle=-1,Fy(n)),n=t.cancelPendingCommit,n!==null&&(t.cancelPendingCommit=null,n()),qn=0,bo(),Gt=t,At=n=Dn(t.current,null),xt=e,Ft=0,Ue=null,ri=!1,Na=Xa(t,e),go=!1,Aa=He=po=Bi=si=ee=0,Pe=wl=null,yo=!1,(e&8)!==0&&(e|=e&32);var i=t.entangledLanes;if(i!==0)for(t=t.entanglements,i&=e;0<i;){var a=31-ke(i),l=1<<a;e|=t[a],i&=~l}return Gn=e,vr(),n}function Id(t,e){Tt=null,D.H=Sl,e===ya||e===Er?(e=ef(),Ft=3):e===Ou?(e=ef(),Ft=4):Ft=e===$u?8:e!==null&&typeof e=="object"&&typeof e.then=="function"?6:1,Ue=e,At===null&&(ee=1,Ir(t,Je(e,t.current)))}function jd(){var t=qe.current;return t===null?!0:(xt&4194048)===xt?nn===null:(xt&62914560)===xt||(xt&536870912)!==0?t===nn:!1}function Wd(){var t=D.H;return D.H=Sl,t===null?Sl:t}function kd(){var t=D.A;return D.A=gy,t}function Xr(){ee=4,ri||(xt&4194048)!==xt&&qe.current!==null||(Na=!0),(si&134217727)===0&&(Bi&134217727)===0||Gt===null||hi(Gt,xt,He,!1)}function Eo(t,e,n){var i=Mt;Mt|=2;var a=Wd(),l=kd();(Gt!==t||xt!==e)&&(Yr=null,xa(t,e)),e=!1;var d=ee;t:do try{if(Ft!==0&&At!==null){var b=At,I=Ue;switch(Ft){case 8:bo(),d=6;break t;case 3:case 2:case 9:case 6:qe.current===null&&(e=!0);var Y=Ft;if(Ft=0,Ue=null,Da(t,b,I,Y),n&&Na){d=0;break t}break;default:Y=Ft,Ft=0,Ue=null,Da(t,b,I,Y)}}Cy(),d=ee;break}catch(et){Id(t,et)}while(!0);return e&&t.shellSuspendCounter++,Vn=Di=null,Mt=i,D.H=a,D.A=l,At===null&&(Gt=null,xt=0,vr()),d}function Cy(){for(;At!==null;)Bd(At)}function Sy(t,e){var n=Mt;Mt|=2;var i=Wd(),a=kd();Gt!==t||xt!==e?(Yr=null,Hr=U()+500,xa(t,e)):Na=Xa(t,e);t:do try{if(Ft!==0&&At!==null){e=At;var l=Ue;e:switch(Ft){case 1:Ft=0,Ue=null,Da(t,e,l,1);break;case 2:case 9:if($c(l)){Ft=0,Ue=null,Gd(e);break}e=function(){Ft!==2&&Ft!==9||Gt!==t||(Ft=7),zn(t)},l.then(e,e);break t;case 3:Ft=7;break t;case 4:Ft=5;break t;case 7:$c(l)?(Ft=0,Ue=null,Gd(e)):(Ft=0,Ue=null,Da(t,e,l,7));break;case 5:var d=null;switch(At.tag){case 26:d=At.memoizedState;case 5:case 27:var b=At;if(d?wm(d):b.stateNode.complete){Ft=0,Ue=null;var I=b.sibling;if(I!==null)At=I;else{var Y=b.return;Y!==null?(At=Y,Qr(Y)):At=null}break e}}Ft=0,Ue=null,Da(t,e,l,5);break;case 6:Ft=0,Ue=null,Da(t,e,l,6);break;case 8:bo(),ee=6;break t;default:throw Error(s(462))}}_y();break}catch(et){Id(t,et)}while(!0);return Vn=Di=null,D.H=i,D.A=a,Mt=n,At!==null?0:(Gt=null,xt=0,vr(),ee)}function _y(){for(;At!==null&&!_();)Bd(At)}function Bd(t){var e=cd(t.alternate,t,Gn);t.memoizedProps=t.pendingProps,e===null?Qr(t):At=e}function Gd(t){var e=t,n=e.alternate;switch(e.tag){case 15:case 0:e=ld(n,e,e.pendingProps,e.type,void 0,xt);break;case 11:e=ld(n,e,e.pendingProps,e.type.render,e.ref,xt);break;case 5:Iu(e);default:dd(n,e),e=At=Gc(e,Gn),e=cd(n,e,Gn)}t.memoizedProps=t.pendingProps,e===null?Qr(t):At=e}function Da(t,e,n,i){Vn=Di=null,Iu(e),Ca=null,fl=0;var a=e.return;try{if(oy(t,a,e,n,xt)){ee=1,Ir(t,Je(n,t.current)),At=null;return}}catch(l){if(a!==null)throw At=a,l;ee=1,Ir(t,Je(n,t.current)),At=null;return}e.flags&32768?(Rt||i===1?t=!0:Na||(xt&536870912)!==0?t=!1:(ri=t=!0,(i===2||i===9||i===3||i===6)&&(i=qe.current,i!==null&&i.tag===13&&(i.flags|=16384))),qd(e,t)):Qr(e)}function Qr(t){var e=t;do{if((e.flags&32768)!==0){qd(e,ri);return}t=e.return;var n=fy(e.alternate,e,Gn);if(n!==null){At=n;return}if(e=e.sibling,e!==null){At=e;return}At=e=t}while(e!==null);ee===0&&(ee=5)}function qd(t,e){do{var n=dy(t.alternate,t);if(n!==null){n.flags&=32767,At=n;return}if(n=t.return,n!==null&&(n.flags|=32768,n.subtreeFlags=0,n.deletions=null),!e&&(t=t.sibling,t!==null)){At=t;return}At=t=n}while(t!==null);ee=6,At=null}function zd(t,e,n,i,a,l,d,b,I){t.cancelPendingCommit=null;do Zr();while(de!==0);if((Mt&6)!==0)throw Error(s(327));if(e!==null){if(e===t.current)throw Error(s(177));if(l=e.lanes|e.childLanes,l|=hu,up(t,n,l,d,b,I),t===Gt&&(At=Gt=null,xt=0),wa=e,oi=t,qn=n,Co=l,So=a,Pd=i,(e.subtreeFlags&10256)!==0||(e.flags&10256)!==0?(t.callbackNode=null,t.callbackPriority=0,Oy(Xt,function(){return Xd(),null})):(t.callbackNode=null,t.callbackPriority=0),i=(e.flags&13878)!==0,(e.subtreeFlags&13878)!==0||i){i=D.T,D.T=null,a=R.p,R.p=2,d=Mt,Mt|=4;try{my(t,e,n)}finally{Mt=d,R.p=a,D.T=i}}de=1,Ud(),Hd(),Yd()}}function Ud(){if(de===1){de=0;var t=oi,e=wa,n=(e.flags&13878)!==0;if((e.subtreeFlags&13878)!==0||n){n=D.T,D.T=null;var i=R.p;R.p=2;var a=Mt;Mt|=4;try{Od(e,t);var l=Lo,d=Pc(t.containerInfo),b=l.focusedElem,I=l.selectionRange;if(d!==b&&b&&b.ownerDocument&&Vc(b.ownerDocument.documentElement,b)){if(I!==null&&lu(b)){var Y=I.start,et=I.end;if(et===void 0&&(et=Y),"selectionStart"in b)b.selectionStart=Y,b.selectionEnd=Math.min(et,b.value.length);else{var at=b.ownerDocument||document,X=at&&at.defaultView||window;if(X.getSelection){var J=X.getSelection(),ct=b.textContent.length,yt=Math.min(I.start,ct),kt=I.end===void 0?yt:Math.min(I.end,ct);!J.extend&&yt>kt&&(d=kt,kt=yt,yt=d);var G=Rc(b,yt),W=Rc(b,kt);if(G&&W&&(J.rangeCount!==1||J.anchorNode!==G.node||J.anchorOffset!==G.offset||J.focusNode!==W.node||J.focusOffset!==W.offset)){var H=at.createRange();H.setStart(G.node,G.offset),J.removeAllRanges(),yt>kt?(J.addRange(H),J.extend(W.node,W.offset)):(H.setEnd(W.node,W.offset),J.addRange(H))}}}}for(at=[],J=b;J=J.parentNode;)J.nodeType===1&&at.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof b.focus=="function"&&b.focus(),b=0;b<at.length;b++){var nt=at[b];nt.element.scrollLeft=nt.left,nt.element.scrollTop=nt.top}}os=!!Po,Lo=Po=null}finally{Mt=a,R.p=i,D.T=n}}t.current=e,de=2}}function Hd(){if(de===2){de=0;var t=oi,e=wa,n=(e.flags&8772)!==0;if((e.subtreeFlags&8772)!==0||n){n=D.T,D.T=null;var i=R.p;R.p=2;var a=Mt;Mt|=4;try{Sd(t,e.alternate,e)}finally{Mt=a,R.p=i,D.T=n}}de=3}}function Yd(){if(de===4||de===3){de=0,P();var t=oi,e=wa,n=qn,i=Pd;(e.subtreeFlags&10256)!==0||(e.flags&10256)!==0?de=5:(de=0,wa=oi=null,Kd(t,t.pendingLanes));var a=t.pendingLanes;if(a===0&&(ui=null),ks(n),e=e.stateNode,fe&&typeof fe.onCommitFiberRoot=="function")try{fe.onCommitFiberRoot(We,e,void 0,(e.current.flags&128)===128)}catch{}if(i!==null){e=D.T,a=R.p,R.p=2,D.T=null;try{for(var l=t.onRecoverableError,d=0;d<i.length;d++){var b=i[d];l(b.value,{componentStack:b.stack})}}finally{D.T=e,R.p=a}}(qn&3)!==0&&Zr(),zn(t),a=t.pendingLanes,(n&261930)!==0&&(a&42)!==0?t===_o?xl++:(xl=0,_o=t):xl=0,Dl(0,!1)}}function Kd(t,e){(t.pooledCacheLanes&=e)===0&&(e=t.pooledCache,e!=null&&(t.pooledCache=null,hl(e)))}function Zr(){return Ud(),Hd(),Yd(),Xd()}function Xd(){if(de!==5)return!1;var t=oi,e=Co;Co=0;var n=ks(qn),i=D.T,a=R.p;try{R.p=32>n?32:n,D.T=null,n=So,So=null;var l=oi,d=qn;if(de=0,wa=oi=null,qn=0,(Mt&6)!==0)throw Error(s(331));var b=Mt;if(Mt|=4,Dd(l.current),Ad(l,l.current,d,n),Mt=b,Dl(0,!1),fe&&typeof fe.onPostCommitFiberRoot=="function")try{fe.onPostCommitFiberRoot(We,l)}catch{}return!0}finally{R.p=a,D.T=i,Kd(t,e)}}function Qd(t,e,n){e=Je(n,e),e=Ju(t.stateNode,e,2),t=Ii(t,e,2),t!==null&&(ir(t,2),zn(t))}function It(t,e,n){if(t.tag===3)Qd(t,t,n);else for(;e!==null;){if(e.tag===3){Qd(e,t,n);break}else if(e.tag===1){var i=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof i.componentDidCatch=="function"&&(ui===null||!ui.has(i))){t=Je(n,t),n=Zf(2),i=Ii(e,n,2),i!==null&&(Jf(n,i,e,t),ir(i,2),zn(i));break}}e=e.return}}function To(t,e,n){var i=t.pingCache;if(i===null){i=t.pingCache=new py;var a=new Set;i.set(e,a)}else a=i.get(e),a===void 0&&(a=new Set,i.set(e,a));a.has(n)||(go=!0,a.add(n),t=by.bind(null,t,e,n),e.then(t,t))}function by(t,e,n){var i=t.pingCache;i!==null&&i.delete(e),t.pingedLanes|=t.suspendedLanes&n,t.warmLanes&=~n,Gt===t&&(xt&n)===n&&(ee===4||ee===3&&(xt&62914560)===xt&&300>U()-Ur?(Mt&2)===0&&xa(t,0):po|=n,Aa===xt&&(Aa=0)),zn(t)}function Zd(t,e){e===0&&(e=Hh()),t=Ai(t,e),t!==null&&(ir(t,e),zn(t))}function Ey(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),Zd(t,n)}function Ty(t,e){var n=0;switch(t.tag){case 31:case 13:var i=t.stateNode,a=t.memoizedState;a!==null&&(n=a.retryLane);break;case 19:i=t.stateNode;break;case 22:i=t.stateNode._retryCache;break;default:throw Error(s(314))}i!==null&&i.delete(e),Zd(t,n)}function Oy(t,e){return Te(t,e)}var Jr=null,Ra=null,Oo=!1,$r=!1,No=!1,ci=0;function zn(t){t!==Ra&&t.next===null&&(Ra===null?Jr=Ra=t:Ra=Ra.next=t),$r=!0,Oo||(Oo=!0,Ay())}function Dl(t,e){if(!No&&$r){No=!0;do for(var n=!1,i=Jr;i!==null;){if(!e)if(t!==0){var a=i.pendingLanes;if(a===0)var l=0;else{var d=i.suspendedLanes,b=i.pingedLanes;l=(1<<31-ke(42|t)+1)-1,l&=a&~(d&~b),l=l&201326741?l&201326741|1:l?l|2:0}l!==0&&(n=!0,em(i,l))}else l=xt,l=nr(i,i===Gt?l:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),(l&3)===0||Xa(i,l)||(n=!0,em(i,l));i=i.next}while(n);No=!1}}function Ny(){Jd()}function Jd(){$r=Oo=!1;var t=0;ci!==0&&My()&&(t=ci);for(var e=U(),n=null,i=Jr;i!==null;){var a=i.next,l=$d(i,e);l===0?(i.next=null,n===null?Jr=a:n.next=a,a===null&&(Ra=n)):(n=i,(t!==0||(l&3)!==0)&&($r=!0)),i=a}de!==0&&de!==5||Dl(t,!1),ci!==0&&(ci=0)}function $d(t,e){for(var n=t.suspendedLanes,i=t.pingedLanes,a=t.expirationTimes,l=t.pendingLanes&-62914561;0<l;){var d=31-ke(l),b=1<<d,I=a[d];I===-1?((b&n)===0||(b&i)!==0)&&(a[d]=sp(b,e)):I<=e&&(t.expiredLanes|=b),l&=~b}if(e=Gt,n=xt,n=nr(t,t===e?n:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),i=t.callbackNode,n===0||t===e&&(Ft===2||Ft===9)||t.cancelPendingCommit!==null)return i!==null&&i!==null&&Nn(i),t.callbackNode=null,t.callbackPriority=0;if((n&3)===0||Xa(t,n)){if(e=n&-n,e===t.callbackPriority)return e;switch(i!==null&&Nn(i),ks(n)){case 2:case 8:n=bt;break;case 32:n=Xt;break;case 268435456:n=Ji;break;default:n=Xt}return i=tm.bind(null,t),n=Te(n,i),t.callbackPriority=e,t.callbackNode=n,e}return i!==null&&i!==null&&Nn(i),t.callbackPriority=2,t.callbackNode=null,2}function tm(t,e){if(de!==0&&de!==5)return t.callbackNode=null,t.callbackPriority=0,null;var n=t.callbackNode;if(Zr()&&t.callbackNode!==n)return null;var i=xt;return i=nr(t,t===Gt?i:0,t.cancelPendingCommit!==null||t.timeoutHandle!==-1),i===0?null:(Md(t,i,e),$d(t,U()),t.callbackNode!=null&&t.callbackNode===n?tm.bind(null,t):null)}function em(t,e){if(Zr())return null;Md(t,e,!0)}function Ay(){Iy(function(){(Mt&6)!==0?Te(ht,Ny):Jd()})}function Ao(){if(ci===0){var t=ga;t===0&&(t=$l,$l<<=1,($l&261888)===0&&($l=256)),ci=t}return ci}function nm(t){return t==null||typeof t=="symbol"||typeof t=="boolean"?null:typeof t=="function"?t:sr(""+t)}function im(t,e){var n=e.ownerDocument.createElement("input");return n.name=e.name,n.value=e.value,t.id&&n.setAttribute("form",t.id),e.parentNode.insertBefore(n,e),t=new FormData(t),n.parentNode.removeChild(n),t}function wy(t,e,n,i,a){if(e==="submit"&&n&&n.stateNode===a){var l=nm((a[we]||null).action),d=i.submitter;d&&(e=(e=d[we]||null)?nm(e.formAction):d.getAttribute("formAction"),e!==null&&(l=e,d=null));var b=new cr("action","action",null,i,a);t.push({event:b,listeners:[{instance:null,listener:function(){if(i.defaultPrevented){if(ci!==0){var I=d?im(a,d):new FormData(a);Hu(n,{pending:!0,data:I,method:a.method,action:l},null,I)}}else typeof l=="function"&&(b.preventDefault(),I=d?im(a,d):new FormData(a),Hu(n,{pending:!0,data:I,method:a.method,action:l},l,I))},currentTarget:a}]})}}for(var wo=0;wo<ou.length;wo++){var xo=ou[wo];hn(xo.toLowerCase(),"on"+(xo[0].toUpperCase()+xo.slice(1)))}hn(Fc,"onAnimationEnd"),hn(Ic,"onAnimationIteration"),hn(jc,"onAnimationStart"),hn("dblclick","onDoubleClick"),hn("focusin","onFocus"),hn("focusout","onBlur"),hn(qp,"onTransitionRun"),hn(zp,"onTransitionStart"),hn(Up,"onTransitionCancel"),hn(Wc,"onTransitionEnd"),na("onMouseEnter",["mouseout","mouseover"]),na("onMouseLeave",["mouseout","mouseover"]),na("onPointerEnter",["pointerout","pointerover"]),na("onPointerLeave",["pointerout","pointerover"]),Ei("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Ei("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Ei("onBeforeInput",["compositionend","keypress","textInput","paste"]),Ei("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Ei("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Ei("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Rl="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),xy=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Rl));function am(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var i=t[n],a=i.event;i=i.listeners;t:{var l=void 0;if(e)for(var d=i.length-1;0<=d;d--){var b=i[d],I=b.instance,Y=b.currentTarget;if(b=b.listener,I!==l&&a.isPropagationStopped())break t;l=b,a.currentTarget=Y;try{l(a)}catch(et){mr(et)}a.currentTarget=null,l=I}else for(d=0;d<i.length;d++){if(b=i[d],I=b.instance,Y=b.currentTarget,b=b.listener,I!==l&&a.isPropagationStopped())break t;l=b,a.currentTarget=Y;try{l(a)}catch(et){mr(et)}a.currentTarget=null,l=I}}}}function wt(t,e){var n=e[Bs];n===void 0&&(n=e[Bs]=new Set);var i=t+"__bubble";n.has(i)||(rm(e,t,2,!1),n.add(i))}function Do(t,e,n){var i=0;e&&(i|=4),rm(n,t,i,e)}var ts="_reactListening"+Math.random().toString(36).slice(2);function lm(t){if(!t[ts]){t[ts]=!0,tc.forEach(function(n){n!=="selectionchange"&&(xy.has(n)||Do(n,!1,t),Do(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[ts]||(e[ts]=!0,Do("selectionchange",!1,e))}}function rm(t,e,n,i){switch(Pm(e)){case 2:var a=lC;break;case 8:a=rC;break;default:a=Uo}n=a.bind(null,e,n,t),a=void 0,!Qs||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(a=!0),i?a!==void 0?t.addEventListener(e,n,{capture:!0,passive:a}):t.addEventListener(e,n,!0):a!==void 0?t.addEventListener(e,n,{passive:a}):t.addEventListener(e,n,!1)}function Ro(t,e,n,i,a){var l=i;if((e&1)===0&&(e&2)===0&&i!==null)t:for(;;){if(i===null)return;var d=i.tag;if(d===3||d===4){var b=i.stateNode.containerInfo;if(b===a)break;if(d===4)for(d=i.return;d!==null;){var I=d.tag;if((I===3||I===4)&&d.stateNode.containerInfo===a)return;d=d.return}for(;b!==null;){if(d=$i(b),d===null)return;if(I=d.tag,I===5||I===6||I===26||I===27){i=l=d;continue t}b=b.parentNode}}i=i.return}fc(function(){var Y=l,et=Ks(n),at=[];t:{var X=kc.get(t);if(X!==void 0){var J=cr,ct=t;switch(t){case"keypress":if(or(n)===0)break t;case"keydown":case"keyup":J=Np;break;case"focusin":ct="focus",J=tu;break;case"focusout":ct="blur",J=tu;break;case"beforeblur":case"afterblur":J=tu;break;case"click":if(n.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":J=vc;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":J=Cp;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":J=Ap;break;case Fc:case Ic:case jc:J=Sp;break;case Wc:J=wp;break;case"scroll":case"scrollend":J=yp;break;case"wheel":J=xp;break;case"copy":case"cut":case"paste":J=_p;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":J=pc;break;case"toggle":case"beforetoggle":J=Dp}var yt=(e&4)!==0,kt=!yt&&(t==="scroll"||t==="scrollend"),G=yt?X!==null?X+"Capture":null:X;yt=[];for(var W=Y,H;W!==null;){var nt=W;if(H=nt.stateNode,nt=nt.tag,nt!==5&&nt!==26&&nt!==27||H===null||G===null||(nt=$a(W,G),nt!=null&&yt.push(Vl(W,nt,H))),kt)break;W=W.return}0<yt.length&&(X=new J(X,ct,null,n,et),at.push({event:X,listeners:yt}))}}if((e&7)===0){t:{if(X=t==="mouseover"||t==="pointerover",J=t==="mouseout"||t==="pointerout",X&&n!==Ys&&(ct=n.relatedTarget||n.fromElement)&&($i(ct)||ct[Qa]))break t;if((J||X)&&(X=et.window===et?et:(X=et.ownerDocument)?X.defaultView||X.parentWindow:window,J?(ct=n.relatedTarget||n.toElement,J=Y,ct=ct?$i(ct):null,ct!==null&&(kt=m(ct),yt=ct.tag,ct!==kt||yt!==5&&yt!==27&&yt!==6)&&(ct=null)):(J=null,ct=Y),J!==ct)){if(yt=vc,nt="onMouseLeave",G="onMouseEnter",W="mouse",(t==="pointerout"||t==="pointerover")&&(yt=pc,nt="onPointerLeave",G="onPointerEnter",W="pointer"),kt=J==null?X:Ja(J),H=ct==null?X:Ja(ct),X=new yt(nt,W+"leave",J,n,et),X.target=kt,X.relatedTarget=H,nt=null,$i(et)===Y&&(yt=new yt(G,W+"enter",ct,n,et),yt.target=H,yt.relatedTarget=kt,nt=yt),kt=nt,J&&ct)e:{for(yt=Dy,G=J,W=ct,H=0,nt=G;nt;nt=yt(nt))H++;nt=0;for(var vt=W;vt;vt=yt(vt))nt++;for(;0<H-nt;)G=yt(G),H--;for(;0<nt-H;)W=yt(W),nt--;for(;H--;){if(G===W||W!==null&&G===W.alternate){yt=G;break e}G=yt(G),W=yt(W)}yt=null}else yt=null;J!==null&&sm(at,X,J,yt,!1),ct!==null&&kt!==null&&sm(at,kt,ct,yt,!0)}}t:{if(X=Y?Ja(Y):window,J=X.nodeName&&X.nodeName.toLowerCase(),J==="select"||J==="input"&&X.type==="file")var Vt=Oc;else if(Ec(X))if(Nc)Vt=kp;else{Vt=jp;var mt=Ip}else J=X.nodeName,!J||J.toLowerCase()!=="input"||X.type!=="checkbox"&&X.type!=="radio"?Y&&Hs(Y.elementType)&&(Vt=Oc):Vt=Wp;if(Vt&&(Vt=Vt(t,Y))){Tc(at,Vt,n,et);break t}mt&&mt(t,X,Y),t==="focusout"&&Y&&X.type==="number"&&Y.memoizedProps.value!=null&&Us(X,"number",X.value)}switch(mt=Y?Ja(Y):window,t){case"focusin":(Ec(mt)||mt.contentEditable==="true")&&(ua=mt,ru=Y,sl=null);break;case"focusout":sl=ru=ua=null;break;case"mousedown":su=!0;break;case"contextmenu":case"mouseup":case"dragend":su=!1,Lc(at,n,et);break;case"selectionchange":if(Gp)break;case"keydown":case"keyup":Lc(at,n,et)}var Ot;if(nu)t:{switch(t){case"compositionstart":var Dt="onCompositionStart";break t;case"compositionend":Dt="onCompositionEnd";break t;case"compositionupdate":Dt="onCompositionUpdate";break t}Dt=void 0}else sa?_c(t,n)&&(Dt="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(Dt="onCompositionStart");Dt&&(yc&&n.locale!=="ko"&&(sa||Dt!=="onCompositionStart"?Dt==="onCompositionEnd"&&sa&&(Ot=dc()):(Zn=et,Zs="value"in Zn?Zn.value:Zn.textContent,sa=!0)),mt=es(Y,Dt),0<mt.length&&(Dt=new gc(Dt,t,null,n,et),at.push({event:Dt,listeners:mt}),Ot?Dt.data=Ot:(Ot=bc(n),Ot!==null&&(Dt.data=Ot)))),(Ot=Vp?Pp(t,n):Lp(t,n))&&(Dt=es(Y,"onBeforeInput"),0<Dt.length&&(mt=new gc("onBeforeInput","beforeinput",null,n,et),at.push({event:mt,listeners:Dt}),mt.data=Ot)),wy(at,t,Y,n,et)}am(at,e)})}function Vl(t,e,n){return{instance:t,listener:e,currentTarget:n}}function es(t,e){for(var n=e+"Capture",i=[];t!==null;){var a=t,l=a.stateNode;if(a=a.tag,a!==5&&a!==26&&a!==27||l===null||(a=$a(t,n),a!=null&&i.unshift(Vl(t,a,l)),a=$a(t,e),a!=null&&i.push(Vl(t,a,l))),t.tag===3)return i;t=t.return}return[]}function Dy(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5&&t.tag!==27);return t||null}function sm(t,e,n,i,a){for(var l=e._reactName,d=[];n!==null&&n!==i;){var b=n,I=b.alternate,Y=b.stateNode;if(b=b.tag,I!==null&&I===i)break;b!==5&&b!==26&&b!==27||Y===null||(I=Y,a?(Y=$a(n,l),Y!=null&&d.unshift(Vl(n,Y,I))):a||(Y=$a(n,l),Y!=null&&d.push(Vl(n,Y,I)))),n=n.return}d.length!==0&&t.push({event:e,listeners:d})}var Ry=/\r\n?/g,Vy=/\u0000|\uFFFD/g;function um(t){return(typeof t=="string"?t:""+t).replace(Ry,`
52
+ `).replace(Vy,"")}function om(t,e){return e=um(e),um(t)===e}function Wt(t,e,n,i,a,l){switch(n){case"children":typeof i=="string"?e==="body"||e==="textarea"&&i===""||aa(t,i):(typeof i=="number"||typeof i=="bigint")&&e!=="body"&&aa(t,""+i);break;case"className":lr(t,"class",i);break;case"tabIndex":lr(t,"tabindex",i);break;case"dir":case"role":case"viewBox":case"width":case"height":lr(t,n,i);break;case"style":hc(t,i,l);break;case"data":if(e!=="object"){lr(t,"data",i);break}case"src":case"href":if(i===""&&(e!=="a"||n!=="href")){t.removeAttribute(n);break}if(i==null||typeof i=="function"||typeof i=="symbol"||typeof i=="boolean"){t.removeAttribute(n);break}i=sr(""+i),t.setAttribute(n,i);break;case"action":case"formAction":if(typeof i=="function"){t.setAttribute(n,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof l=="function"&&(n==="formAction"?(e!=="input"&&Wt(t,e,"name",a.name,a,null),Wt(t,e,"formEncType",a.formEncType,a,null),Wt(t,e,"formMethod",a.formMethod,a,null),Wt(t,e,"formTarget",a.formTarget,a,null)):(Wt(t,e,"encType",a.encType,a,null),Wt(t,e,"method",a.method,a,null),Wt(t,e,"target",a.target,a,null)));if(i==null||typeof i=="symbol"||typeof i=="boolean"){t.removeAttribute(n);break}i=sr(""+i),t.setAttribute(n,i);break;case"onClick":i!=null&&(t.onclick=wn);break;case"onScroll":i!=null&&wt("scroll",t);break;case"onScrollEnd":i!=null&&wt("scrollend",t);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(s(61));if(n=i.__html,n!=null){if(a.children!=null)throw Error(s(60));t.innerHTML=n}}break;case"multiple":t.multiple=i&&typeof i!="function"&&typeof i!="symbol";break;case"muted":t.muted=i&&typeof i!="function"&&typeof i!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(i==null||typeof i=="function"||typeof i=="boolean"||typeof i=="symbol"){t.removeAttribute("xlink:href");break}n=sr(""+i),t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",n);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":i!=null&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(n,""+i):t.removeAttribute(n);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":i&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(n,""):t.removeAttribute(n);break;case"capture":case"download":i===!0?t.setAttribute(n,""):i!==!1&&i!=null&&typeof i!="function"&&typeof i!="symbol"?t.setAttribute(n,i):t.removeAttribute(n);break;case"cols":case"rows":case"size":case"span":i!=null&&typeof i!="function"&&typeof i!="symbol"&&!isNaN(i)&&1<=i?t.setAttribute(n,i):t.removeAttribute(n);break;case"rowSpan":case"start":i==null||typeof i=="function"||typeof i=="symbol"||isNaN(i)?t.removeAttribute(n):t.setAttribute(n,i);break;case"popover":wt("beforetoggle",t),wt("toggle",t),ar(t,"popover",i);break;case"xlinkActuate":An(t,"http://www.w3.org/1999/xlink","xlink:actuate",i);break;case"xlinkArcrole":An(t,"http://www.w3.org/1999/xlink","xlink:arcrole",i);break;case"xlinkRole":An(t,"http://www.w3.org/1999/xlink","xlink:role",i);break;case"xlinkShow":An(t,"http://www.w3.org/1999/xlink","xlink:show",i);break;case"xlinkTitle":An(t,"http://www.w3.org/1999/xlink","xlink:title",i);break;case"xlinkType":An(t,"http://www.w3.org/1999/xlink","xlink:type",i);break;case"xmlBase":An(t,"http://www.w3.org/XML/1998/namespace","xml:base",i);break;case"xmlLang":An(t,"http://www.w3.org/XML/1998/namespace","xml:lang",i);break;case"xmlSpace":An(t,"http://www.w3.org/XML/1998/namespace","xml:space",i);break;case"is":ar(t,"is",i);break;case"innerText":case"textContent":break;default:(!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=="N")&&(n=gp.get(n)||n,ar(t,n,i))}}function Vo(t,e,n,i,a,l){switch(n){case"style":hc(t,i,l);break;case"dangerouslySetInnerHTML":if(i!=null){if(typeof i!="object"||!("__html"in i))throw Error(s(61));if(n=i.__html,n!=null){if(a.children!=null)throw Error(s(60));t.innerHTML=n}}break;case"children":typeof i=="string"?aa(t,i):(typeof i=="number"||typeof i=="bigint")&&aa(t,""+i);break;case"onScroll":i!=null&&wt("scroll",t);break;case"onScrollEnd":i!=null&&wt("scrollend",t);break;case"onClick":i!=null&&(t.onclick=wn);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!ec.hasOwnProperty(n))t:{if(n[0]==="o"&&n[1]==="n"&&(a=n.endsWith("Capture"),e=n.slice(2,a?n.length-7:void 0),l=t[we]||null,l=l!=null?l[n]:null,typeof l=="function"&&t.removeEventListener(e,l,a),typeof i=="function")){typeof l!="function"&&l!==null&&(n in t?t[n]=null:t.hasAttribute(n)&&t.removeAttribute(n)),t.addEventListener(e,i,a);break t}n in t?t[n]=i:i===!0?t.setAttribute(n,""):ar(t,n,i)}}}function _e(t,e,n){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":wt("error",t),wt("load",t);var i=!1,a=!1,l;for(l in n)if(n.hasOwnProperty(l)){var d=n[l];if(d!=null)switch(l){case"src":i=!0;break;case"srcSet":a=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(s(137,e));default:Wt(t,e,l,d,n,null)}}a&&Wt(t,e,"srcSet",n.srcSet,n,null),i&&Wt(t,e,"src",n.src,n,null);return;case"input":wt("invalid",t);var b=l=d=a=null,I=null,Y=null;for(i in n)if(n.hasOwnProperty(i)){var et=n[i];if(et!=null)switch(i){case"name":a=et;break;case"type":d=et;break;case"checked":I=et;break;case"defaultChecked":Y=et;break;case"value":l=et;break;case"defaultValue":b=et;break;case"children":case"dangerouslySetInnerHTML":if(et!=null)throw Error(s(137,e));break;default:Wt(t,e,i,et,n,null)}}rc(t,l,b,I,Y,d,a,!1);return;case"select":wt("invalid",t),i=d=l=null;for(a in n)if(n.hasOwnProperty(a)&&(b=n[a],b!=null))switch(a){case"value":l=b;break;case"defaultValue":d=b;break;case"multiple":i=b;default:Wt(t,e,a,b,n,null)}e=l,n=d,t.multiple=!!i,e!=null?ia(t,!!i,e,!1):n!=null&&ia(t,!!i,n,!0);return;case"textarea":wt("invalid",t),l=a=i=null;for(d in n)if(n.hasOwnProperty(d)&&(b=n[d],b!=null))switch(d){case"value":i=b;break;case"defaultValue":a=b;break;case"children":l=b;break;case"dangerouslySetInnerHTML":if(b!=null)throw Error(s(91));break;default:Wt(t,e,d,b,n,null)}uc(t,i,a,l);return;case"option":for(I in n)if(n.hasOwnProperty(I)&&(i=n[I],i!=null))switch(I){case"selected":t.selected=i&&typeof i!="function"&&typeof i!="symbol";break;default:Wt(t,e,I,i,n,null)}return;case"dialog":wt("beforetoggle",t),wt("toggle",t),wt("cancel",t),wt("close",t);break;case"iframe":case"object":wt("load",t);break;case"video":case"audio":for(i=0;i<Rl.length;i++)wt(Rl[i],t);break;case"image":wt("error",t),wt("load",t);break;case"details":wt("toggle",t);break;case"embed":case"source":case"link":wt("error",t),wt("load",t);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(Y in n)if(n.hasOwnProperty(Y)&&(i=n[Y],i!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":throw Error(s(137,e));default:Wt(t,e,Y,i,n,null)}return;default:if(Hs(e)){for(et in n)n.hasOwnProperty(et)&&(i=n[et],i!==void 0&&Vo(t,e,et,i,n,void 0));return}}for(b in n)n.hasOwnProperty(b)&&(i=n[b],i!=null&&Wt(t,e,b,i,n,null))}function Py(t,e,n,i){switch(e){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var a=null,l=null,d=null,b=null,I=null,Y=null,et=null;for(J in n){var at=n[J];if(n.hasOwnProperty(J)&&at!=null)switch(J){case"checked":break;case"value":break;case"defaultValue":I=at;default:i.hasOwnProperty(J)||Wt(t,e,J,null,i,at)}}for(var X in i){var J=i[X];if(at=n[X],i.hasOwnProperty(X)&&(J!=null||at!=null))switch(X){case"type":l=J;break;case"name":a=J;break;case"checked":Y=J;break;case"defaultChecked":et=J;break;case"value":d=J;break;case"defaultValue":b=J;break;case"children":case"dangerouslySetInnerHTML":if(J!=null)throw Error(s(137,e));break;default:J!==at&&Wt(t,e,X,J,i,at)}}zs(t,d,b,I,Y,et,l,a);return;case"select":J=d=b=X=null;for(l in n)if(I=n[l],n.hasOwnProperty(l)&&I!=null)switch(l){case"value":break;case"multiple":J=I;default:i.hasOwnProperty(l)||Wt(t,e,l,null,i,I)}for(a in i)if(l=i[a],I=n[a],i.hasOwnProperty(a)&&(l!=null||I!=null))switch(a){case"value":X=l;break;case"defaultValue":b=l;break;case"multiple":d=l;default:l!==I&&Wt(t,e,a,l,i,I)}e=b,n=d,i=J,X!=null?ia(t,!!n,X,!1):!!i!=!!n&&(e!=null?ia(t,!!n,e,!0):ia(t,!!n,n?[]:"",!1));return;case"textarea":J=X=null;for(b in n)if(a=n[b],n.hasOwnProperty(b)&&a!=null&&!i.hasOwnProperty(b))switch(b){case"value":break;case"children":break;default:Wt(t,e,b,null,i,a)}for(d in i)if(a=i[d],l=n[d],i.hasOwnProperty(d)&&(a!=null||l!=null))switch(d){case"value":X=a;break;case"defaultValue":J=a;break;case"children":break;case"dangerouslySetInnerHTML":if(a!=null)throw Error(s(91));break;default:a!==l&&Wt(t,e,d,a,i,l)}sc(t,X,J);return;case"option":for(var ct in n)if(X=n[ct],n.hasOwnProperty(ct)&&X!=null&&!i.hasOwnProperty(ct))switch(ct){case"selected":t.selected=!1;break;default:Wt(t,e,ct,null,i,X)}for(I in i)if(X=i[I],J=n[I],i.hasOwnProperty(I)&&X!==J&&(X!=null||J!=null))switch(I){case"selected":t.selected=X&&typeof X!="function"&&typeof X!="symbol";break;default:Wt(t,e,I,X,i,J)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var yt in n)X=n[yt],n.hasOwnProperty(yt)&&X!=null&&!i.hasOwnProperty(yt)&&Wt(t,e,yt,null,i,X);for(Y in i)if(X=i[Y],J=n[Y],i.hasOwnProperty(Y)&&X!==J&&(X!=null||J!=null))switch(Y){case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(s(137,e));break;default:Wt(t,e,Y,X,i,J)}return;default:if(Hs(e)){for(var kt in n)X=n[kt],n.hasOwnProperty(kt)&&X!==void 0&&!i.hasOwnProperty(kt)&&Vo(t,e,kt,void 0,i,X);for(et in i)X=i[et],J=n[et],!i.hasOwnProperty(et)||X===J||X===void 0&&J===void 0||Vo(t,e,et,X,i,J);return}}for(var G in n)X=n[G],n.hasOwnProperty(G)&&X!=null&&!i.hasOwnProperty(G)&&Wt(t,e,G,null,i,X);for(at in i)X=i[at],J=n[at],!i.hasOwnProperty(at)||X===J||X==null&&J==null||Wt(t,e,at,X,i,J)}function hm(t){switch(t){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Ly(){if(typeof performance.getEntriesByType=="function"){for(var t=0,e=0,n=performance.getEntriesByType("resource"),i=0;i<n.length;i++){var a=n[i],l=a.transferSize,d=a.initiatorType,b=a.duration;if(l&&b&&hm(d)){for(d=0,b=a.responseEnd,i+=1;i<n.length;i++){var I=n[i],Y=I.startTime;if(Y>b)break;var et=I.transferSize,at=I.initiatorType;et&&hm(at)&&(I=I.responseEnd,d+=et*(I<b?1:(b-Y)/(I-Y)))}if(--i,e+=8*(l+d)/(a.duration/1e3),t++,10<t)break}}if(0<t)return e/t/1e6}return navigator.connection&&(t=navigator.connection.downlink,typeof t=="number")?t:5}var Po=null,Lo=null;function ns(t){return t.nodeType===9?t:t.ownerDocument}function cm(t){switch(t){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function fm(t,e){if(t===0)switch(e){case"svg":return 1;case"math":return 2;default:return 0}return t===1&&e==="foreignObject"?0:t}function Mo(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.children=="bigint"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Fo=null;function My(){var t=window.event;return t&&t.type==="popstate"?t===Fo?!1:(Fo=t,!0):(Fo=null,!1)}var dm=typeof setTimeout=="function"?setTimeout:void 0,Fy=typeof clearTimeout=="function"?clearTimeout:void 0,mm=typeof Promise=="function"?Promise:void 0,Iy=typeof queueMicrotask=="function"?queueMicrotask:typeof mm<"u"?function(t){return mm.resolve(null).then(t).catch(jy)}:dm;function jy(t){setTimeout(function(){throw t})}function fi(t){return t==="head"}function vm(t,e){var n=e,i=0;do{var a=n.nextSibling;if(t.removeChild(n),a&&a.nodeType===8)if(n=a.data,n==="/$"||n==="/&"){if(i===0){t.removeChild(a),Ma(e);return}i--}else if(n==="$"||n==="$?"||n==="$~"||n==="$!"||n==="&")i++;else if(n==="html")Pl(t.ownerDocument.documentElement);else if(n==="head"){n=t.ownerDocument.head,Pl(n);for(var l=n.firstChild;l;){var d=l.nextSibling,b=l.nodeName;l[Za]||b==="SCRIPT"||b==="STYLE"||b==="LINK"&&l.rel.toLowerCase()==="stylesheet"||n.removeChild(l),l=d}}else n==="body"&&Pl(t.ownerDocument.body);n=a}while(n);Ma(e)}function gm(t,e){var n=t;t=0;do{var i=n.nextSibling;if(n.nodeType===1?e?(n._stashedDisplay=n.style.display,n.style.display="none"):(n.style.display=n._stashedDisplay||"",n.getAttribute("style")===""&&n.removeAttribute("style")):n.nodeType===3&&(e?(n._stashedText=n.nodeValue,n.nodeValue=""):n.nodeValue=n._stashedText||""),i&&i.nodeType===8)if(n=i.data,n==="/$"){if(t===0)break;t--}else n!=="$"&&n!=="$?"&&n!=="$~"&&n!=="$!"||t++;n=i}while(n)}function Io(t){var e=t.firstChild;for(e&&e.nodeType===10&&(e=e.nextSibling);e;){var n=e;switch(e=e.nextSibling,n.nodeName){case"HTML":case"HEAD":case"BODY":Io(n),Gs(n);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(n.rel.toLowerCase()==="stylesheet")continue}t.removeChild(n)}}function Wy(t,e,n,i){for(;t.nodeType===1;){var a=n;if(t.nodeName.toLowerCase()!==e.toLowerCase()){if(!i&&(t.nodeName!=="INPUT"||t.type!=="hidden"))break}else if(i){if(!t[Za])switch(e){case"meta":if(!t.hasAttribute("itemprop"))break;return t;case"link":if(l=t.getAttribute("rel"),l==="stylesheet"&&t.hasAttribute("data-precedence"))break;if(l!==a.rel||t.getAttribute("href")!==(a.href==null||a.href===""?null:a.href)||t.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin)||t.getAttribute("title")!==(a.title==null?null:a.title))break;return t;case"style":if(t.hasAttribute("data-precedence"))break;return t;case"script":if(l=t.getAttribute("src"),(l!==(a.src==null?null:a.src)||t.getAttribute("type")!==(a.type==null?null:a.type)||t.getAttribute("crossorigin")!==(a.crossOrigin==null?null:a.crossOrigin))&&l&&t.hasAttribute("async")&&!t.hasAttribute("itemprop"))break;return t;default:return t}}else if(e==="input"&&t.type==="hidden"){var l=a.name==null?null:""+a.name;if(a.type==="hidden"&&t.getAttribute("name")===l)return t}else return t;if(t=ln(t.nextSibling),t===null)break}return null}function ky(t,e,n){if(e==="")return null;for(;t.nodeType!==3;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!n||(t=ln(t.nextSibling),t===null))return null;return t}function pm(t,e){for(;t.nodeType!==8;)if((t.nodeType!==1||t.nodeName!=="INPUT"||t.type!=="hidden")&&!e||(t=ln(t.nextSibling),t===null))return null;return t}function jo(t){return t.data==="$?"||t.data==="$~"}function Wo(t){return t.data==="$!"||t.data==="$?"&&t.ownerDocument.readyState!=="loading"}function By(t,e){var n=t.ownerDocument;if(t.data==="$~")t._reactRetry=e;else if(t.data!=="$?"||n.readyState!=="loading")e();else{var i=function(){e(),n.removeEventListener("DOMContentLoaded",i)};n.addEventListener("DOMContentLoaded",i),t._reactRetry=i}}function ln(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?"||e==="$~"||e==="&"||e==="F!"||e==="F")break;if(e==="/$"||e==="/&")return null}}return t}var ko=null;function ym(t){t=t.nextSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"||n==="/&"){if(e===0)return ln(t.nextSibling);e--}else n!=="$"&&n!=="$!"&&n!=="$?"&&n!=="$~"&&n!=="&"||e++}t=t.nextSibling}return null}function Cm(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"||n==="$~"||n==="&"){if(e===0)return t;e--}else n!=="/$"&&n!=="/&"||e++}t=t.previousSibling}return null}function Sm(t,e,n){switch(e=ns(n),t){case"html":if(t=e.documentElement,!t)throw Error(s(452));return t;case"head":if(t=e.head,!t)throw Error(s(453));return t;case"body":if(t=e.body,!t)throw Error(s(454));return t;default:throw Error(s(451))}}function Pl(t){for(var e=t.attributes;e.length;)t.removeAttributeNode(e[0]);Gs(t)}var rn=new Map,_m=new Set;function is(t){return typeof t.getRootNode=="function"?t.getRootNode():t.nodeType===9?t:t.ownerDocument}var Un=R.d;R.d={f:Gy,r:qy,D:zy,C:Uy,L:Hy,m:Yy,X:Xy,S:Ky,M:Qy};function Gy(){var t=Un.f(),e=Kr();return t||e}function qy(t){var e=ta(t);e!==null&&e.tag===5&&e.type==="form"?kf(e):Un.r(t)}var Va=typeof document>"u"?null:document;function bm(t,e,n){var i=Va;if(i&&typeof e=="string"&&e){var a=Qe(e);a='link[rel="'+t+'"][href="'+a+'"]',typeof n=="string"&&(a+='[crossorigin="'+n+'"]'),_m.has(a)||(_m.add(a),t={rel:t,crossOrigin:n,href:e},i.querySelector(a)===null&&(e=i.createElement("link"),_e(e,"link",t),me(e),i.head.appendChild(e)))}}function zy(t){Un.D(t),bm("dns-prefetch",t,null)}function Uy(t,e){Un.C(t,e),bm("preconnect",t,e)}function Hy(t,e,n){Un.L(t,e,n);var i=Va;if(i&&t&&e){var a='link[rel="preload"][as="'+Qe(e)+'"]';e==="image"&&n&&n.imageSrcSet?(a+='[imagesrcset="'+Qe(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(a+='[imagesizes="'+Qe(n.imageSizes)+'"]')):a+='[href="'+Qe(t)+'"]';var l=a;switch(e){case"style":l=Pa(t);break;case"script":l=La(t)}rn.has(l)||(t=f({rel:"preload",href:e==="image"&&n&&n.imageSrcSet?void 0:t,as:e},n),rn.set(l,t),i.querySelector(a)!==null||e==="style"&&i.querySelector(Ll(l))||e==="script"&&i.querySelector(Ml(l))||(e=i.createElement("link"),_e(e,"link",t),me(e),i.head.appendChild(e)))}}function Yy(t,e){Un.m(t,e);var n=Va;if(n&&t){var i=e&&typeof e.as=="string"?e.as:"script",a='link[rel="modulepreload"][as="'+Qe(i)+'"][href="'+Qe(t)+'"]',l=a;switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":l=La(t)}if(!rn.has(l)&&(t=f({rel:"modulepreload",href:t},e),rn.set(l,t),n.querySelector(a)===null)){switch(i){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(Ml(l)))return}i=n.createElement("link"),_e(i,"link",t),me(i),n.head.appendChild(i)}}}function Ky(t,e,n){Un.S(t,e,n);var i=Va;if(i&&t){var a=ea(i).hoistableStyles,l=Pa(t);e=e||"default";var d=a.get(l);if(!d){var b={loading:0,preload:null};if(d=i.querySelector(Ll(l)))b.loading=5;else{t=f({rel:"stylesheet",href:t,"data-precedence":e},n),(n=rn.get(l))&&Bo(t,n);var I=d=i.createElement("link");me(I),_e(I,"link",t),I._p=new Promise(function(Y,et){I.onload=Y,I.onerror=et}),I.addEventListener("load",function(){b.loading|=1}),I.addEventListener("error",function(){b.loading|=2}),b.loading|=4,as(d,e,i)}d={type:"stylesheet",instance:d,count:1,state:b},a.set(l,d)}}}function Xy(t,e){Un.X(t,e);var n=Va;if(n&&t){var i=ea(n).hoistableScripts,a=La(t),l=i.get(a);l||(l=n.querySelector(Ml(a)),l||(t=f({src:t,async:!0},e),(e=rn.get(a))&&Go(t,e),l=n.createElement("script"),me(l),_e(l,"link",t),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},i.set(a,l))}}function Qy(t,e){Un.M(t,e);var n=Va;if(n&&t){var i=ea(n).hoistableScripts,a=La(t),l=i.get(a);l||(l=n.querySelector(Ml(a)),l||(t=f({src:t,async:!0,type:"module"},e),(e=rn.get(a))&&Go(t,e),l=n.createElement("script"),me(l),_e(l,"link",t),n.head.appendChild(l)),l={type:"script",instance:l,count:1,state:null},i.set(a,l))}}function Em(t,e,n,i){var a=(a=Ct.current)?is(a):null;if(!a)throw Error(s(446));switch(t){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(e=Pa(n.href),n=ea(a).hoistableStyles,i=n.get(e),i||(i={type:"style",instance:null,count:0,state:null},n.set(e,i)),i):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){t=Pa(n.href);var l=ea(a).hoistableStyles,d=l.get(t);if(d||(a=a.ownerDocument||a,d={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},l.set(t,d),(l=a.querySelector(Ll(t)))&&!l._p&&(d.instance=l,d.state.loading=5),rn.has(t)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},rn.set(t,n),l||Zy(a,t,n,d.state))),e&&i===null)throw Error(s(528,""));return d}if(e&&i!==null)throw Error(s(529,""));return null;case"script":return e=n.async,n=n.src,typeof n=="string"&&e&&typeof e!="function"&&typeof e!="symbol"?(e=La(n),n=ea(a).hoistableScripts,i=n.get(e),i||(i={type:"script",instance:null,count:0,state:null},n.set(e,i)),i):{type:"void",instance:null,count:0,state:null};default:throw Error(s(444,t))}}function Pa(t){return'href="'+Qe(t)+'"'}function Ll(t){return'link[rel="stylesheet"]['+t+"]"}function Tm(t){return f({},t,{"data-precedence":t.precedence,precedence:null})}function Zy(t,e,n,i){t.querySelector('link[rel="preload"][as="style"]['+e+"]")?i.loading=1:(e=t.createElement("link"),i.preload=e,e.addEventListener("load",function(){return i.loading|=1}),e.addEventListener("error",function(){return i.loading|=2}),_e(e,"link",n),me(e),t.head.appendChild(e))}function La(t){return'[src="'+Qe(t)+'"]'}function Ml(t){return"script[async]"+t}function Om(t,e,n){if(e.count++,e.instance===null)switch(e.type){case"style":var i=t.querySelector('style[data-href~="'+Qe(n.href)+'"]');if(i)return e.instance=i,me(i),i;var a=f({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return i=(t.ownerDocument||t).createElement("style"),me(i),_e(i,"style",a),as(i,n.precedence,t),e.instance=i;case"stylesheet":a=Pa(n.href);var l=t.querySelector(Ll(a));if(l)return e.state.loading|=4,e.instance=l,me(l),l;i=Tm(n),(a=rn.get(a))&&Bo(i,a),l=(t.ownerDocument||t).createElement("link"),me(l);var d=l;return d._p=new Promise(function(b,I){d.onload=b,d.onerror=I}),_e(l,"link",i),e.state.loading|=4,as(l,n.precedence,t),e.instance=l;case"script":return l=La(n.src),(a=t.querySelector(Ml(l)))?(e.instance=a,me(a),a):(i=n,(a=rn.get(l))&&(i=f({},n),Go(i,a)),t=t.ownerDocument||t,a=t.createElement("script"),me(a),_e(a,"link",i),t.head.appendChild(a),e.instance=a);case"void":return null;default:throw Error(s(443,e.type))}else e.type==="stylesheet"&&(e.state.loading&4)===0&&(i=e.instance,e.state.loading|=4,as(i,n.precedence,t));return e.instance}function as(t,e,n){for(var i=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),a=i.length?i[i.length-1]:null,l=a,d=0;d<i.length;d++){var b=i[d];if(b.dataset.precedence===e)l=b;else if(l!==a)break}l?l.parentNode.insertBefore(t,l.nextSibling):(e=n.nodeType===9?n.head:n,e.insertBefore(t,e.firstChild))}function Bo(t,e){t.crossOrigin??=e.crossOrigin,t.referrerPolicy??=e.referrerPolicy,t.title??=e.title}function Go(t,e){t.crossOrigin??=e.crossOrigin,t.referrerPolicy??=e.referrerPolicy,t.integrity??=e.integrity}var ls=null;function Nm(t,e,n){if(ls===null){var i=new Map,a=ls=new Map;a.set(n,i)}else a=ls,i=a.get(n),i||(i=new Map,a.set(n,i));if(i.has(t))return i;for(i.set(t,null),n=n.getElementsByTagName(t),a=0;a<n.length;a++){var l=n[a];if(!(l[Za]||l[pe]||t==="link"&&l.getAttribute("rel")==="stylesheet")&&l.namespaceURI!=="http://www.w3.org/2000/svg"){var d=l.getAttribute(e)||"";d=t+d;var b=i.get(d);b?b.push(l):i.set(d,[l])}}return i}function Am(t,e,n){t=t.ownerDocument||t,t.head.insertBefore(n,e==="title"?t.querySelector("head > title"):null)}function Jy(t,e,n){if(n===1||e.itemProp!=null)return!1;switch(t){case"meta":case"title":return!0;case"style":if(typeof e.precedence!="string"||typeof e.href!="string"||e.href==="")break;return!0;case"link":if(typeof e.rel!="string"||typeof e.href!="string"||e.href===""||e.onLoad||e.onError)break;switch(e.rel){case"stylesheet":return t=e.disabled,typeof e.precedence=="string"&&t==null;default:return!0}case"script":if(e.async&&typeof e.async!="function"&&typeof e.async!="symbol"&&!e.onLoad&&!e.onError&&e.src&&typeof e.src=="string")return!0}return!1}function wm(t){return!(t.type==="stylesheet"&&(t.state.loading&3)===0)}function $y(t,e,n,i){if(n.type==="stylesheet"&&(typeof i.media!="string"||matchMedia(i.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var a=Pa(i.href),l=e.querySelector(Ll(a));if(l){e=l._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(t.count++,t=rs.bind(t),e.then(t,t)),n.state.loading|=4,n.instance=l,me(l);return}l=e.ownerDocument||e,i=Tm(i),(a=rn.get(a))&&Bo(i,a),l=l.createElement("link"),me(l);var d=l;d._p=new Promise(function(b,I){d.onload=b,d.onerror=I}),_e(l,"link",i),n.instance=l}t.stylesheets===null&&(t.stylesheets=new Map),t.stylesheets.set(n,e),(e=n.state.preload)&&(n.state.loading&3)===0&&(t.count++,n=rs.bind(t),e.addEventListener("load",n),e.addEventListener("error",n))}}var qo=0;function tC(t,e){return t.stylesheets&&t.count===0&&us(t,t.stylesheets),0<t.count||0<t.imgCount?function(n){var i=setTimeout(function(){if(t.stylesheets&&us(t,t.stylesheets),t.unsuspend){var l=t.unsuspend;t.unsuspend=null,l()}},6e4+e);0<t.imgBytes&&qo===0&&(qo=62500*Ly());var a=setTimeout(function(){if(t.waitingForImages=!1,t.count===0&&(t.stylesheets&&us(t,t.stylesheets),t.unsuspend)){var l=t.unsuspend;t.unsuspend=null,l()}},(t.imgBytes>qo?50:800)+e);return t.unsuspend=n,function(){t.unsuspend=null,clearTimeout(i),clearTimeout(a)}}:null}function rs(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)us(this,this.stylesheets);else if(this.unsuspend){var t=this.unsuspend;this.unsuspend=null,t()}}}var ss=null;function us(t,e){t.stylesheets=null,t.unsuspend!==null&&(t.count++,ss=new Map,e.forEach(eC,t),ss=null,rs.call(t))}function eC(t,e){if(!(e.state.loading&4)){var n=ss.get(t);if(n)var i=n.get(null);else{n=new Map,ss.set(t,n);for(var a=t.querySelectorAll("link[data-precedence],style[data-precedence]"),l=0;l<a.length;l++){var d=a[l];(d.nodeName==="LINK"||d.getAttribute("media")!=="not all")&&(n.set(d.dataset.precedence,d),i=d)}i&&n.set(null,i)}a=e.instance,d=a.getAttribute("data-precedence"),l=n.get(d)||i,l===i&&n.set(null,a),n.set(d,a),this.count++,i=rs.bind(this),a.addEventListener("load",i),a.addEventListener("error",i),l?l.parentNode.insertBefore(a,l.nextSibling):(t=t.nodeType===9?t.head:t,t.insertBefore(a,t.firstChild)),e.state.loading|=4}}var Fl={$$typeof:z,Provider:null,Consumer:null,_currentValue:Z,_currentValue2:Z,_threadCount:0};function nC(t,e,n,i,a,l,d,b,I){this.tag=1,this.containerInfo=t,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ws(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ws(0),this.hiddenUpdates=Ws(null),this.identifierPrefix=i,this.onUncaughtError=a,this.onCaughtError=l,this.onRecoverableError=d,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=I,this.incompleteTransitions=new Map}function iC(t,e,n,i,a,l,d,b,I,Y,et,at){return t=new nC(t,e,n,d,I,Y,et,at,b),e=1,l===!0&&(e|=24),l=Ge(3,null,null,e),t.current=l,l.stateNode=t,e=bu(),e.refCount++,t.pooledCache=e,e.refCount++,l.memoizedState={element:i,isDehydrated:n,cache:e},Nu(l),t}function aC(t){return t?(t=ca,t):ca}function xm(t,e,n,i,a,l){a=aC(a),i.context===null?i.context=a:i.pendingContext=a,i=Fi(e),i.payload={element:n},l=l===void 0?null:l,l!==null&&(i.callback=l),n=Ii(t,i,e),n!==null&&(Le(n,t,e),ml(n,t,e))}function Dm(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function zo(t,e){Dm(t,e),(t=t.alternate)&&Dm(t,e)}function Rm(t){if(t.tag===13||t.tag===31){var e=Ai(t,67108864);e!==null&&Le(e,t,67108864),zo(t,67108864)}}function Vm(t){if(t.tag===13||t.tag===31){var e=an();e=Qh(e);var n=Ai(t,e);n!==null&&Le(n,t,e),zo(t,e)}}var os=!0;function lC(t,e,n,i){var a=D.T;D.T=null;var l=R.p;try{R.p=2,Uo(t,e,n,i)}finally{R.p=l,D.T=a}}function rC(t,e,n,i){var a=D.T;D.T=null;var l=R.p;try{R.p=8,Uo(t,e,n,i)}finally{R.p=l,D.T=a}}function Uo(t,e,n,i){if(os){var a=Ho(i);if(a===null)Ro(t,e,i,hs,n),Lm(t,i);else if(uC(a,t,e,n,i))i.stopPropagation();else if(Lm(t,i),e&4&&-1<sC.indexOf(t)){for(;a!==null;){var l=ta(a);if(l!==null)switch(l.tag){case 3:if(l=l.stateNode,l.current.memoizedState.isDehydrated){var d=bi(l.pendingLanes);if(d!==0){var b=l;for(b.pendingLanes|=2,b.entangledLanes|=2;d;){var I=1<<31-ke(d);b.entanglements[1]|=I,d&=~I}zn(l),(Mt&6)===0&&(Hr=U()+500,Dl(0,!1))}}break;case 31:case 13:b=Ai(l,2),b!==null&&Le(b,l,2),Kr(),zo(l,2)}if(l=Ho(i),l===null&&Ro(t,e,i,hs,n),l===a)break;a=l}a!==null&&i.stopPropagation()}else Ro(t,e,i,null,n)}}function Ho(t){return t=Ks(t),Yo(t)}var hs=null;function Yo(t){if(hs=null,t=$i(t),t!==null){var e=m(t);if(e===null)t=null;else{var n=e.tag;if(n===13){if(t=v(e),t!==null)return t;t=null}else if(n===31){if(t=y(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null)}}return hs=t,null}function Pm(t){switch(t){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(st()){case ht:return 2;case bt:return 8;case Xt:case ce:return 32;case Ji:return 268435456;default:return 32}default:return 32}}var Ko=!1,di=null,mi=null,vi=null,Il=new Map,jl=new Map,gi=[],sC="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Lm(t,e){switch(t){case"focusin":case"focusout":di=null;break;case"dragenter":case"dragleave":mi=null;break;case"mouseover":case"mouseout":vi=null;break;case"pointerover":case"pointerout":Il.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":jl.delete(e.pointerId)}}function Wl(t,e,n,i,a,l){return t===null||t.nativeEvent!==l?(t={blockedOn:e,domEventName:n,eventSystemFlags:i,nativeEvent:l,targetContainers:[a]},e!==null&&(e=ta(e),e!==null&&Rm(e)),t):(t.eventSystemFlags|=i,e=t.targetContainers,a!==null&&e.indexOf(a)===-1&&e.push(a),t)}function uC(t,e,n,i,a){switch(e){case"focusin":return di=Wl(di,t,e,n,i,a),!0;case"dragenter":return mi=Wl(mi,t,e,n,i,a),!0;case"mouseover":return vi=Wl(vi,t,e,n,i,a),!0;case"pointerover":var l=a.pointerId;return Il.set(l,Wl(Il.get(l)||null,t,e,n,i,a)),!0;case"gotpointercapture":return l=a.pointerId,jl.set(l,Wl(jl.get(l)||null,t,e,n,i,a)),!0}return!1}function Mm(t){var e=$i(t.target);if(e!==null){var n=m(e);if(n!==null){if(e=n.tag,e===13){if(e=v(n),e!==null){t.blockedOn=e,Jh(t.priority,function(){Vm(n)});return}}else if(e===31){if(e=y(n),e!==null){t.blockedOn=e,Jh(t.priority,function(){Vm(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function cs(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Ho(t.nativeEvent);if(n===null){n=t.nativeEvent;var i=new n.constructor(n.type,n);Ys=i,n.target.dispatchEvent(i),Ys=null}else return e=ta(n),e!==null&&Rm(e),t.blockedOn=n,!1;e.shift()}return!0}function Fm(t,e,n){cs(t)&&n.delete(e)}function oC(){Ko=!1,di!==null&&cs(di)&&(di=null),mi!==null&&cs(mi)&&(mi=null),vi!==null&&cs(vi)&&(vi=null),Il.forEach(Fm),jl.forEach(Fm)}function fs(t,e){t.blockedOn===e&&(t.blockedOn=null,Ko||(Ko=!0,u.unstable_scheduleCallback(u.unstable_NormalPriority,oC)))}var ds=null;function Im(t){ds!==t&&(ds=t,u.unstable_scheduleCallback(u.unstable_NormalPriority,function(){ds===t&&(ds=null);for(var e=0;e<t.length;e+=3){var n=t[e],i=t[e+1],a=t[e+2];if(typeof i!="function"){if(Yo(i||n)===null)continue;break}var l=ta(n);l!==null&&(t.splice(e,3),e-=3,Hu(l,{pending:!0,data:a,method:n.method,action:i},i,a))}}))}function Ma(t){function e(I){return fs(I,t)}di!==null&&fs(di,t),mi!==null&&fs(mi,t),vi!==null&&fs(vi,t),Il.forEach(e),jl.forEach(e);for(var n=0;n<gi.length;n++){var i=gi[n];i.blockedOn===t&&(i.blockedOn=null)}for(;0<gi.length&&(n=gi[0],n.blockedOn===null);)Mm(n),n.blockedOn===null&&gi.shift();if(n=(t.ownerDocument||t).$$reactFormReplay,n!=null)for(i=0;i<n.length;i+=3){var a=n[i],l=n[i+1],d=a[we]||null;if(typeof l=="function")d||Im(n);else if(d){var b=null;if(l&&l.hasAttribute("formAction")){if(a=l,d=l[we]||null)b=d.formAction;else if(Yo(a)!==null)continue}else b=d.action;typeof b=="function"?n[i+1]=b:(n.splice(i,3),i-=3),Im(n)}}}function hC(){function t(l){l.canIntercept&&l.info==="react-transition"&&l.intercept({handler:function(){return new Promise(function(d){return a=d})},focusReset:"manual",scroll:"manual"})}function e(){a!==null&&(a(),a=null),i||setTimeout(n,20)}function n(){if(!i&&!navigation.transition){var l=navigation.currentEntry;l&&l.url!=null&&navigation.navigate(l.url,{state:l.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var i=!1,a=null;return navigation.addEventListener("navigate",t),navigation.addEventListener("navigatesuccess",e),navigation.addEventListener("navigateerror",e),setTimeout(n,100),function(){i=!0,navigation.removeEventListener("navigate",t),navigation.removeEventListener("navigatesuccess",e),navigation.removeEventListener("navigateerror",e),a!==null&&(a(),a=null)}}}function Xo(t){this._internalRoot=t}Qo.prototype.render=Xo.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(s(409));var n=e.current;xm(n,an(),t,e,null,null)},Qo.prototype.unmount=Xo.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;xm(t.current,2,null,t,null,null),Kr(),e[Qa]=null}};function Qo(t){this._internalRoot=t}Qo.prototype.unstable_scheduleHydration=function(t){if(t){var e=Zh();t={blockedOn:null,target:t,priority:e};for(var n=0;n<gi.length&&e!==0&&e<gi[n].priority;n++);gi.splice(n,0,t),n===0&&Mm(t)}};var jm=h.version;if(jm!=="19.2.4")throw Error(s(527,jm,"19.2.4"));R.findDOMNode=function(t){var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(s(188)):(t=Object.keys(t).join(","),Error(s(268,t)));return t=o(e),t=t!==null?T(t):null,t=t===null?null:t.stateNode,t};var cC={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:D,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var ms=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!ms.isDisabled&&ms.supportsFiber)try{We=ms.inject(cC),fe=ms}catch{}}r.createRoot=function(t,e){if(!p(t))throw Error(s(299));var n=!1,i="",a=ry,l=sy,d=uy;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(i=e.identifierPrefix),e.onUncaughtError!==void 0&&(a=e.onUncaughtError),e.onCaughtError!==void 0&&(l=e.onCaughtError),e.onRecoverableError!==void 0&&(d=e.onRecoverableError)),e=iC(t,1,!1,null,null,n,i,null,a,l,d,hC),t[Qa]=e.current,lm(t),new Xo(e)}})),Bg=lt(((r,u)=>{function h(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(h)}catch(c){console.error(c)}}h(),u.exports=kg()})),Gg=Bg(),qg="_nav_1u2m0_1",zg="_actions_1u2m0_17",Ug="_btn_1u2m0_22",Ya={nav:qg,actions:zg,btn:Ug},Ih=(0,_t.memo)(()=>(0,St.jsxs)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:[(0,St.jsx)("path",{d:"M12 3a9 9 0 0 0-9 9H0l4 4 4-4H5a7 7 0 1 1 2.05 4.95l-1.41 1.41A9 9 0 1 0 12 3z"}),(0,St.jsx)("path",{d:"M13 8v5l4.25 2.52.77-1.28-3.52-2.09V8z"})]}));Ih.displayName="RestoreIcon";var jh=(0,_t.memo)(()=>(0,St.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,St.jsx)("path",{d:"M17 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V7l-4-4zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3zm3-10H5V5h10v4z"})}));jh.displayName="SaveIcon";var Wh=(0,_t.memo)(()=>(0,St.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:(0,St.jsx)("path",{d:"M17.65 6.35A7.958 7.958 0 0 0 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08A5.99 5.99 0 0 1 12 18c-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"})}));Wh.displayName="RestartIcon";var Hg=({onSave:r,onRestore:u,onRestart:h})=>(0,St.jsx)("nav",{className:Ya.nav,children:(0,St.jsxs)("div",{className:Ya.actions,children:[(0,St.jsx)("button",{type:"button",className:Ya.btn,onClick:u,title:"Restore","aria-label":"Restore saved game",children:(0,St.jsx)(Ih,{})}),(0,St.jsx)("button",{type:"button",className:Ya.btn,onClick:r,title:"Save","aria-label":"Save game",children:(0,St.jsx)(jh,{})}),(0,St.jsx)("button",{type:"button",className:Ya.btn,onClick:h,title:"Restart","aria-label":"Restart game",children:(0,St.jsx)(Wh,{})})]})}),kh=(0,_t.memo)(Hg),Yg="_modal_x7pql_1",Kg="_header_x7pql_36",Xg="_title_x7pql_45",Qg="_close_x7pql_50",Zg="_body_x7pql_75",Jg="_slot_x7pql_81",On={modal:Yg,"slide-in":"_slide-in_x7pql_1",header:Kg,title:Xg,close:Qg,body:Zg,slot:Jg,"slot-name":"_slot-name_x7pql_109","slot-timestamp":"_slot-timestamp_x7pql_113","slot-empty":"_slot-empty_x7pql_118"},$g=[1,2,3,4,5],tp=({modalRef:r,type:u,title:h,ink:c,onClose:s})=>{const p=Zl.show(h),m=(0,_t.useCallback)(y=>{c&&(u==="save"?Zl.save(y,c):u==="restore"&&p&&p[y]&&Zl.load(p[y].data,c),r.current?.close(),s?.())},[c,u,p,r,s]),v=(0,_t.useCallback)(()=>{r.current?.close(),s?.()},[r,s]);return(0,St.jsxs)("dialog",{ref:r,className:On.modal,children:[(0,St.jsxs)("div",{className:On.header,children:[(0,St.jsx)("div",{className:On.title,children:u==="save"?"Save Game":"Restore Game"}),(0,St.jsx)("button",{type:"button",className:On.close,onClick:v,"aria-label":"Close",children:"×"})]}),(0,St.jsx)("div",{className:On.body,children:$g.map(y=>{const A=p?.[y],o=!!A,T=u==="restore"&&!o;return(0,St.jsxs)("button",{type:"button",className:On.slot,onClick:()=>m(y),disabled:T,children:[(0,St.jsxs)("span",{className:On["slot-name"],children:["Slot ",y]}),(0,St.jsx)("span",{className:o?On["slot-timestamp"]:On["slot-empty"],children:o?A.timestamp:"Empty"})]},y)})})]})},Bh=(0,_t.memo)(tp),ep="_container_4pjrc_1",np={container:ep},ip=({ink:r,title:u})=>{const[h,c]=(0,_t.useState)("save"),s=(0,_t.useRef)(null),p=(0,_t.useCallback)(o=>{c(o),s.current?.showModal()},[]),m=(0,_t.useCallback)(()=>{p("save")},[p]),v=(0,_t.useCallback)(()=>{p("restore")},[p]),y=(0,_t.useCallback)(()=>{r.restart()},[r]),A=r.title||u||"";return(0,St.jsxs)("div",{className:np.container,children:[(0,St.jsx)(kh,{onSave:m,onRestore:v,onRestart:y}),(0,St.jsx)(sg,{ink:r,children:(0,St.jsx)(Dg,{})}),(0,St.jsx)(Bh,{modalRef:s,type:h,title:A,ink:r})]})},Gh=(0,_t.memo)(ip);Vg(),cg(),wg(),Mg(),Lg(),yg(),dg(),Ng();var qh=class extends Rh{loadFile(r){const u=this.resolveFilename(r),h=new XMLHttpRequest;if(h.open("GET",u,!1),h.send(),h.status!==200)throw new Error(`Failed to load: ${u}`);return h.responseText}},zh=r=>{const u=typeof r.container=="string"?document.querySelector(r.container):r.container;if(!u){console.error("InkWeave: Container not found");return}r.theme==="dark"&&u.classList.add("ink-dark");try{const h=new qh({basePath:r.basePath||""}),c=Xv(r.story,{title:r.title||"Ink Story",fileHandler:h});u.innerHTML="",(0,Gg.createRoot)(u).render((0,St.jsx)(Gh,{ink:c,title:r.title})),console.log("InkWeave v1.0.0 initialized")}catch(h){console.error("InkWeave: Failed to initialize",h)}},Uh="1.0.0";return typeof window<"u"&&(window.InkWeave={version:Uh,init:zh}),Yn.Container=Gh,Yn.FetchFileHandler=qh,Yn.Menu=kh,Yn.SaveModal=Bh,Yn.init=zh,Yn.version=Uh,Yn})({});