From c99ef7372bb7cccaefc664dc2306195025ec0fd0 Mon Sep 17 00:00:00 2001 From: Ray Myers Date: Tue, 2 Jan 2024 11:14:57 -0600 Subject: [PATCH] deploy --- assets/index-826985ac.js | 189 +++++++++++++++++++++++++++++++++++++++ assets/index-95333218.js | 175 ------------------------------------ index.html | 2 +- 3 files changed, 190 insertions(+), 176 deletions(-) create mode 100644 assets/index-826985ac.js delete mode 100644 assets/index-95333218.js diff --git a/assets/index-826985ac.js b/assets/index-826985ac.js new file mode 100644 index 0000000..41946a1 --- /dev/null +++ b/assets/index-826985ac.js @@ -0,0 +1,189 @@ +var vs=(d,g)=>()=>(g||d((g={exports:{}}).exports,g),g.exports);var Es=vs((exports,module)=>{function _mergeNamespaces(d,g){for(var $=0;$b[j]})}}}return Object.freeze(Object.defineProperty(d,Symbol.toStringTag,{value:"Module"}))}(function(){const g=document.createElement("link").relList;if(g&&g.supports&&g.supports("modulepreload"))return;for(const j of document.querySelectorAll('link[rel="modulepreload"]'))b(j);new MutationObserver(j=>{for(const _e of j)if(_e.type==="childList")for(const et of _e.addedNodes)et.tagName==="LINK"&&et.rel==="modulepreload"&&b(et)}).observe(document,{childList:!0,subtree:!0});function $(j){const _e={};return j.integrity&&(_e.integrity=j.integrity),j.referrerpolicy&&(_e.referrerPolicy=j.referrerpolicy),j.crossorigin==="use-credentials"?_e.credentials="include":j.crossorigin==="anonymous"?_e.credentials="omit":_e.credentials="same-origin",_e}function b(j){if(j.ep)return;j.ep=!0;const _e=$(j);fetch(j.href,_e)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function getDefaultExportFromCjs(d){return d&&d.__esModule&&Object.prototype.hasOwnProperty.call(d,"default")?d.default:d}var jsxRuntimeExports={},jsxRuntime={get exports(){return jsxRuntimeExports},set exports(d){jsxRuntimeExports=d}},reactJsxRuntime_production_min={},reactExports={},react={get exports(){return reactExports},set exports(d){reactExports=d}},react_production_min={};/** + * @license React + * react.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var l$2=Symbol.for("react.element"),n$2=Symbol.for("react.portal"),p$3=Symbol.for("react.fragment"),q$1=Symbol.for("react.strict_mode"),r$1=Symbol.for("react.profiler"),t$1=Symbol.for("react.provider"),u$1=Symbol.for("react.context"),v$2=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),x$1=Symbol.for("react.memo"),y$2=Symbol.for("react.lazy"),z$1=Symbol.iterator;function A$1(d){return d===null||typeof d!="object"?null:(d=z$1&&d[z$1]||d["@@iterator"],typeof d=="function"?d:null)}var B$1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C$1=Object.assign,D$1={};function E$1(d,g,$){this.props=d,this.context=g,this.refs=D$1,this.updater=$||B$1}E$1.prototype.isReactComponent={};E$1.prototype.setState=function(d,g){if(typeof d!="object"&&typeof d!="function"&&d!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,d,g,"setState")};E$1.prototype.forceUpdate=function(d){this.updater.enqueueForceUpdate(this,d,"forceUpdate")};function F(){}F.prototype=E$1.prototype;function G$1(d,g,$){this.props=d,this.context=g,this.refs=D$1,this.updater=$||B$1}var H$1=G$1.prototype=new F;H$1.constructor=G$1;C$1(H$1,E$1.prototype);H$1.isPureReactComponent=!0;var I$1=Array.isArray,J=Object.prototype.hasOwnProperty,K$1={current:null},L$1={key:!0,ref:!0,__self:!0,__source:!0};function M$1(d,g,$){var b,j={},_e=null,et=null;if(g!=null)for(b in g.ref!==void 0&&(et=g.ref),g.key!==void 0&&(_e=""+g.key),g)J.call(g,b)&&!L$1.hasOwnProperty(b)&&(j[b]=g[b]);var tt=arguments.length-2;if(tt===1)j.children=$;else if(1"u")throw new Error(g)}function createKey(){return Math.random().toString(36).substr(2,8)}function getHistoryState(d,g){return{usr:d.state,key:d.key,idx:g}}function createLocation(d,g,$,b){return $===void 0&&($=null),_extends$2({pathname:typeof d=="string"?d:d.pathname,search:"",hash:""},typeof g=="string"?parsePath(g):g,{state:$,key:g&&g.key||b||createKey()})}function createPath(d){let{pathname:g="/",search:$="",hash:b=""}=d;return $&&$!=="?"&&(g+=$.charAt(0)==="?"?$:"?"+$),b&&b!=="#"&&(g+=b.charAt(0)==="#"?b:"#"+b),g}function parsePath(d){let g={};if(d){let $=d.indexOf("#");$>=0&&(g.hash=d.substr($),d=d.substr(0,$));let b=d.indexOf("?");b>=0&&(g.search=d.substr(b),d=d.substr(0,b)),d&&(g.pathname=d)}return g}function getUrlBasedHistory(d,g,$,b){b===void 0&&(b={});let{window:j=document.defaultView,v5Compat:_e=!1}=b,et=j.history,tt=Action.Pop,nt=null,rt=it();rt==null&&(rt=0,et.replaceState(_extends$2({},et.state,{idx:rt}),""));function it(){return(et.state||{idx:null}).idx}function st(){tt=Action.Pop;let vt=it(),ft=vt==null?null:vt-rt;rt=vt,nt&&nt({action:tt,location:ct.location,delta:ft})}function ut(vt,ft){tt=Action.Push;let gt=createLocation(ct.location,vt,ft);$&&$(gt,vt),rt=it()+1;let pt=getHistoryState(gt,rt),yt=ct.createHref(gt);try{et.pushState(pt,"",yt)}catch{j.location.assign(yt)}_e&&nt&&nt({action:tt,location:ct.location,delta:1})}function at(vt,ft){tt=Action.Replace;let gt=createLocation(ct.location,vt,ft);$&&$(gt,vt),rt=it();let pt=getHistoryState(gt,rt),yt=ct.createHref(gt);et.replaceState(pt,"",yt),_e&&nt&&nt({action:tt,location:ct.location,delta:0})}function ht(vt){let ft=j.location.origin!=="null"?j.location.origin:j.location.href,gt=typeof vt=="string"?vt:createPath(vt);return invariant(ft,"No window.location.(origin|href) available to create URL for href: "+gt),new URL(gt,ft)}let ct={get action(){return tt},get location(){return d(j,et)},listen(vt){if(nt)throw new Error("A history only accepts one active listener");return j.addEventListener(PopStateEventType,st),nt=vt,()=>{j.removeEventListener(PopStateEventType,st),nt=null}},createHref(vt){return g(j,vt)},createURL:ht,encodeLocation(vt){let ft=ht(vt);return{pathname:ft.pathname,search:ft.search,hash:ft.hash}},push:ut,replace:at,go(vt){return et.go(vt)}};return ct}var ResultType;(function(d){d.data="data",d.deferred="deferred",d.redirect="redirect",d.error="error"})(ResultType||(ResultType={}));function isIndexRoute(d){return d.index===!0}function convertRoutesToDataRoutes(d,g,$){return g===void 0&&(g=[]),$===void 0&&($=new Set),d.map((b,j)=>{let _e=[...g,j],et=typeof b.id=="string"?b.id:_e.join("-");return invariant(b.index!==!0||!b.children,"Cannot specify children on an index route"),invariant(!$.has(et),'Found a route id collision on id "'+et+`". Route id's must be globally unique within Data Router usages`),$.add(et),isIndexRoute(b)?_extends$2({},b,{id:et}):_extends$2({},b,{id:et,children:b.children?convertRoutesToDataRoutes(b.children,_e,$):void 0})})}function matchRoutes(d,g,$){$===void 0&&($="/");let b=typeof g=="string"?parsePath(g):g,j=stripBasename(b.pathname||"/",$);if(j==null)return null;let _e=flattenRoutes(d);rankRouteBranches(_e);let et=null;for(let tt=0;et==null&&tt<_e.length;++tt)et=matchRouteBranch(_e[tt],safelyDecodeURI(j));return et}function flattenRoutes(d,g,$,b){g===void 0&&(g=[]),$===void 0&&($=[]),b===void 0&&(b="");let j=(_e,et,tt)=>{let nt={relativePath:tt===void 0?_e.path||"":tt,caseSensitive:_e.caseSensitive===!0,childrenIndex:et,route:_e};nt.relativePath.startsWith("/")&&(invariant(nt.relativePath.startsWith(b),'Absolute route path "'+nt.relativePath+'" nested under path '+('"'+b+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),nt.relativePath=nt.relativePath.slice(b.length));let rt=joinPaths([b,nt.relativePath]),it=$.concat(nt);_e.children&&_e.children.length>0&&(invariant(_e.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+rt+'".')),flattenRoutes(_e.children,g,it,rt)),!(_e.path==null&&!_e.index)&&g.push({path:rt,score:computeScore(rt,_e.index),routesMeta:it})};return d.forEach((_e,et)=>{var tt;if(_e.path===""||!((tt=_e.path)!=null&&tt.includes("?")))j(_e,et);else for(let nt of explodeOptionalSegments(_e.path))j(_e,et,nt)}),g}function explodeOptionalSegments(d){let g=d.split("/");if(g.length===0)return[];let[$,...b]=g,j=$.endsWith("?"),_e=$.replace(/\?$/,"");if(b.length===0)return j?[_e,""]:[_e];let et=explodeOptionalSegments(b.join("/")),tt=[];return tt.push(...et.map(nt=>nt===""?_e:[_e,nt].join("/"))),j&&tt.push(...et),tt.map(nt=>d.startsWith("/")&&nt===""?"/":nt)}function rankRouteBranches(d){d.sort((g,$)=>g.score!==$.score?$.score-g.score:compareIndexes(g.routesMeta.map(b=>b.childrenIndex),$.routesMeta.map(b=>b.childrenIndex)))}const paramRe=/^:\w+$/,dynamicSegmentValue=3,indexRouteValue=2,emptySegmentValue=1,staticSegmentValue=10,splatPenalty=-2,isSplat=d=>d==="*";function computeScore(d,g){let $=d.split("/"),b=$.length;return $.some(isSplat)&&(b+=splatPenalty),g&&(b+=indexRouteValue),$.filter(j=>!isSplat(j)).reduce((j,_e)=>j+(paramRe.test(_e)?dynamicSegmentValue:_e===""?emptySegmentValue:staticSegmentValue),b)}function compareIndexes(d,g){return d.length===g.length&&d.slice(0,-1).every((b,j)=>b===g[j])?d[d.length-1]-g[g.length-1]:0}function matchRouteBranch(d,g){let{routesMeta:$}=d,b={},j="/",_e=[];for(let et=0;et<$.length;++et){let tt=$[et],nt=et===$.length-1,rt=j==="/"?g:g.slice(j.length)||"/",it=matchPath({path:tt.relativePath,caseSensitive:tt.caseSensitive,end:nt},rt);if(!it)return null;Object.assign(b,it.params);let st=tt.route;_e.push({params:b,pathname:joinPaths([j,it.pathname]),pathnameBase:normalizePathname(joinPaths([j,it.pathnameBase])),route:st}),it.pathnameBase!=="/"&&(j=joinPaths([j,it.pathnameBase]))}return _e}function matchPath(d,g){typeof d=="string"&&(d={path:d,caseSensitive:!1,end:!0});let[$,b]=compilePath(d.path,d.caseSensitive,d.end),j=g.match($);if(!j)return null;let _e=j[0],et=_e.replace(/(.)\/+$/,"$1"),tt=j.slice(1);return{params:b.reduce((rt,it,st)=>{if(it==="*"){let ut=tt[st]||"";et=_e.slice(0,_e.length-ut.length).replace(/(.)\/+$/,"$1")}return rt[it]=safelyDecodeURIComponent(tt[st]||"",it),rt},{}),pathname:_e,pathnameBase:et,pattern:d}}function compilePath(d,g,$){g===void 0&&(g=!1),$===void 0&&($=!0),warning(d==="*"||!d.endsWith("*")||d.endsWith("/*"),'Route path "'+d+'" will be treated as if it were '+('"'+d.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+d.replace(/\*$/,"/*")+'".'));let b=[],j="^"+d.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,(et,tt)=>(b.push(tt),"/([^\\/]+)"));return d.endsWith("*")?(b.push("*"),j+=d==="*"||d==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):$?j+="\\/*$":d!==""&&d!=="/"&&(j+="(?:(?=\\/|$))"),[new RegExp(j,g?void 0:"i"),b]}function safelyDecodeURI(d){try{return decodeURI(d)}catch(g){return warning(!1,'The URL path "'+d+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+g+").")),d}}function safelyDecodeURIComponent(d,g){try{return decodeURIComponent(d)}catch($){return warning(!1,'The value for the URL param "'+g+'" will not be decoded because'+(' the string "'+d+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+$+").")),d}}function stripBasename(d,g){if(g==="/")return d;if(!d.toLowerCase().startsWith(g.toLowerCase()))return null;let $=g.endsWith("/")?g.length-1:g.length,b=d.charAt($);return b&&b!=="/"?null:d.slice($)||"/"}function warning(d,g){if(!d){typeof console<"u"&&console.warn(g);try{throw new Error(g)}catch{}}}function resolvePath(d,g){g===void 0&&(g="/");let{pathname:$,search:b="",hash:j=""}=typeof d=="string"?parsePath(d):d;return{pathname:$?$.startsWith("/")?$:resolvePathname($,g):g,search:normalizeSearch(b),hash:normalizeHash(j)}}function resolvePathname(d,g){let $=g.replace(/\/+$/,"").split("/");return d.split("/").forEach(j=>{j===".."?$.length>1&&$.pop():j!=="."&&$.push(j)}),$.length>1?$.join("/"):"/"}function getInvalidPathError(d,g,$,b){return"Cannot include a '"+d+"' character in a manually specified "+("`to."+g+"` field ["+JSON.stringify(b)+"]. Please separate it out to the ")+("`to."+$+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function getPathContributingMatches(d){return d.filter((g,$)=>$===0||g.route.path&&g.route.path.length>0)}function resolveTo(d,g,$,b){b===void 0&&(b=!1);let j;typeof d=="string"?j=parsePath(d):(j=_extends$2({},d),invariant(!j.pathname||!j.pathname.includes("?"),getInvalidPathError("?","pathname","search",j)),invariant(!j.pathname||!j.pathname.includes("#"),getInvalidPathError("#","pathname","hash",j)),invariant(!j.search||!j.search.includes("#"),getInvalidPathError("#","search","hash",j)));let _e=d===""||j.pathname==="",et=_e?"/":j.pathname,tt;if(b||et==null)tt=$;else{let st=g.length-1;if(et.startsWith("..")){let ut=et.split("/");for(;ut[0]==="..";)ut.shift(),st-=1;j.pathname=ut.join("/")}tt=st>=0?g[st]:"/"}let nt=resolvePath(j,tt),rt=et&&et!=="/"&&et.endsWith("/"),it=(_e||et===".")&&$.endsWith("/");return!nt.pathname.endsWith("/")&&(rt||it)&&(nt.pathname+="/"),nt}const joinPaths=d=>d.join("/").replace(/\/\/+/g,"/"),normalizePathname=d=>d.replace(/\/+$/,"").replace(/^\/*/,"/"),normalizeSearch=d=>!d||d==="?"?"":d.startsWith("?")?d:"?"+d,normalizeHash=d=>!d||d==="#"?"":d.startsWith("#")?d:"#"+d;class AbortedDeferredError extends Error{}class DeferredData{constructor(g,$){this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],invariant(g&&typeof g=="object"&&!Array.isArray(g),"defer() only accepts plain objects");let b;this.abortPromise=new Promise((_e,et)=>b=et),this.controller=new AbortController;let j=()=>b(new AbortedDeferredError("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",j),this.controller.signal.addEventListener("abort",j),this.data=Object.entries(g).reduce((_e,et)=>{let[tt,nt]=et;return Object.assign(_e,{[tt]:this.trackPromise(tt,nt)})},{}),this.done&&this.unlistenAbortSignal(),this.init=$}trackPromise(g,$){if(!($ instanceof Promise))return $;this.deferredKeys.push(g),this.pendingKeysSet.add(g);let b=Promise.race([$,this.abortPromise]).then(j=>this.onSettle(b,g,null,j),j=>this.onSettle(b,g,j));return b.catch(()=>{}),Object.defineProperty(b,"_tracked",{get:()=>!0}),b}onSettle(g,$,b,j){return this.controller.signal.aborted&&b instanceof AbortedDeferredError?(this.unlistenAbortSignal(),Object.defineProperty(g,"_error",{get:()=>b}),Promise.reject(b)):(this.pendingKeysSet.delete($),this.done&&this.unlistenAbortSignal(),b?(Object.defineProperty(g,"_error",{get:()=>b}),this.emit(!1,$),Promise.reject(b)):(Object.defineProperty(g,"_data",{get:()=>j}),this.emit(!1,$),j))}emit(g,$){this.subscribers.forEach(b=>b(g,$))}subscribe(g){return this.subscribers.add(g),()=>this.subscribers.delete(g)}cancel(){this.controller.abort(),this.pendingKeysSet.forEach((g,$)=>this.pendingKeysSet.delete($)),this.emit(!0)}async resolveData(g){let $=!1;if(!this.done){let b=()=>this.cancel();g.addEventListener("abort",b),$=await new Promise(j=>{this.subscribe(_e=>{g.removeEventListener("abort",b),(_e||this.done)&&j(_e)})})}return $}get done(){return this.pendingKeysSet.size===0}get unwrappedData(){return invariant(this.data!==null&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce((g,$)=>{let[b,j]=$;return Object.assign(g,{[b]:unwrapTrackedPromise(j)})},{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function isTrackedPromise(d){return d instanceof Promise&&d._tracked===!0}function unwrapTrackedPromise(d){if(!isTrackedPromise(d))return d;if(d._error)throw d._error;return d._data}const redirect=function(g,$){$===void 0&&($=302);let b=$;typeof b=="number"?b={status:b}:typeof b.status>"u"&&(b.status=302);let j=new Headers(b.headers);return j.set("Location",g),new Response(null,_extends$2({},b,{headers:j}))};class ErrorResponse{constructor(g,$,b,j){j===void 0&&(j=!1),this.status=g,this.statusText=$||"",this.internal=j,b instanceof Error?(this.data=b.toString(),this.error=b):this.data=b}}function isRouteErrorResponse(d){return d!=null&&typeof d.status=="number"&&typeof d.statusText=="string"&&typeof d.internal=="boolean"&&"data"in d}const validMutationMethodsArr=["post","put","patch","delete"],validMutationMethods=new Set(validMutationMethodsArr),validRequestMethodsArr=["get",...validMutationMethodsArr],validRequestMethods=new Set(validRequestMethodsArr),redirectStatusCodes=new Set([301,302,303,307,308]),redirectPreserveMethodStatusCodes=new Set([307,308]),IDLE_NAVIGATION={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},IDLE_FETCHER={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},IDLE_BLOCKER={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},isBrowser$1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",isServer=!isBrowser$1;function createRouter(d){invariant(d.routes.length>0,"You must provide a non-empty routes array to createRouter");let g=convertRoutesToDataRoutes(d.routes),$=null,b=new Set,j=null,_e=null,et=null,tt=d.hydrationData!=null,nt=matchRoutes(g,d.history.location,d.basename),rt=null;if(nt==null){let $t=getInternalRouterError(404,{pathname:d.history.location.pathname}),{matches:bt,route:Rt}=getShortCircuitMatches(g);nt=bt,rt={[Rt.id]:$t}}let it=!nt.some($t=>$t.route.loader)||d.hydrationData!=null,st,ut={historyAction:d.history.action,location:d.history.location,matches:nt,initialized:it,navigation:IDLE_NAVIGATION,restoreScrollPosition:d.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:d.hydrationData&&d.hydrationData.loaderData||{},actionData:d.hydrationData&&d.hydrationData.actionData||null,errors:d.hydrationData&&d.hydrationData.errors||rt,fetchers:new Map,blockers:new Map},at=Action.Pop,ht=!1,ct,vt=!1,ft=!1,gt=[],pt=[],yt=new Map,At=0,Dt=-1,St=new Map,Bt=new Set,Ot=new Map,Ct=new Map,_t=null,Tt=new Map,kt=!1;function Mt(){return $=d.history.listen($t=>{let{action:bt,location:Rt,delta:Ut}=$t;if(kt){kt=!1;return}warning(_t!=null&&Ut===null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let It=xn({currentLocation:ut.location,nextLocation:Rt,historyAction:bt});if(It&&Ut!=null){kt=!0,d.history.go(Ut*-1),Bn(It,{state:"blocked",location:Rt,proceed(){Bn(It,{state:"proceeding",proceed:void 0,reset:void 0,location:Rt}),d.history.go(Ut)},reset(){Tn(It),Xt({blockers:new Map(st.state.blockers)})}});return}return Yt(bt,Rt)}),ut.initialized||Yt(Action.Pop,ut.location),st}function Vt(){$&&$(),b.clear(),ct&&ct.abort(),ut.fetchers.forEach(($t,bt)=>On(bt)),ut.blockers.forEach(($t,bt)=>Tn(bt))}function Jt($t){return b.add($t),()=>b.delete($t)}function Xt($t){ut=_extends$2({},ut,$t),b.forEach(bt=>bt(ut))}function Nt($t,bt){var Rt,Ut;let It=ut.actionData!=null&&ut.navigation.formMethod!=null&&isMutationMethod(ut.navigation.formMethod)&&ut.navigation.state==="loading"&&((Rt=$t.state)==null?void 0:Rt._isRedirect)!==!0,Wt;bt.actionData?Object.keys(bt.actionData).length>0?Wt=bt.actionData:Wt=null:It?Wt=ut.actionData:Wt=null;let Gt=bt.loaderData?mergeLoaderData(ut.loaderData,bt.loaderData,bt.matches||[],bt.errors):ut.loaderData;for(let[Ht]of Tt)Tn(Ht);let Zt=ht===!0||ut.navigation.formMethod!=null&&isMutationMethod(ut.navigation.formMethod)&&((Ut=$t.state)==null?void 0:Ut._isRedirect)!==!0;Xt(_extends$2({},bt,{actionData:Wt,loaderData:Gt,historyAction:at,location:$t,initialized:!0,navigation:IDLE_NAVIGATION,revalidation:"idle",restoreScrollPosition:cn($t,bt.matches||ut.matches),preventScrollReset:Zt,blockers:new Map(ut.blockers)})),vt||at===Action.Pop||(at===Action.Push?d.history.push($t,$t.state):at===Action.Replace&&d.history.replace($t,$t.state)),at=Action.Pop,ht=!1,vt=!1,ft=!1,gt=[],pt=[]}async function Lt($t,bt){if(typeof $t=="number"){d.history.go($t);return}let{path:Rt,submission:Ut,error:It}=normalizeNavigateOptions($t,bt),Wt=ut.location,Gt=createLocation(ut.location,Rt,bt&&bt.state);Gt=_extends$2({},Gt,d.history.encodeLocation(Gt));let Zt=bt&&bt.replace!=null?bt.replace:void 0,Ht=Action.Push;Zt===!0?Ht=Action.Replace:Zt===!1||Ut!=null&&isMutationMethod(Ut.formMethod)&&Ut.formAction===ut.location.pathname+ut.location.search&&(Ht=Action.Replace);let sn=bt&&"preventScrollReset"in bt?bt.preventScrollReset===!0:void 0,qt=xn({currentLocation:Wt,nextLocation:Gt,historyAction:Ht});if(qt){Bn(qt,{state:"blocked",location:Gt,proceed(){Bn(qt,{state:"proceeding",proceed:void 0,reset:void 0,location:Gt}),Lt($t,bt)},reset(){Tn(qt),Xt({blockers:new Map(ut.blockers)})}});return}return await Yt(Ht,Gt,{submission:Ut,pendingError:It,preventScrollReset:sn,replace:bt&&bt.replace})}function jt(){if(Sn(),Xt({revalidation:"loading"}),ut.navigation.state!=="submitting"){if(ut.navigation.state==="idle"){Yt(ut.historyAction,ut.location,{startUninterruptedRevalidation:!0});return}Yt(at||ut.historyAction,ut.navigation.location,{overrideNavigation:ut.navigation})}}async function Yt($t,bt,Rt){ct&&ct.abort(),ct=null,at=$t,vt=(Rt&&Rt.startUninterruptedRevalidation)===!0,$n(ut.location,ut.matches),ht=(Rt&&Rt.preventScrollReset)===!0;let Ut=Rt&&Rt.overrideNavigation,It=matchRoutes(g,bt,d.basename);if(!It){let tn=getInternalRouterError(404,{pathname:bt.pathname}),{matches:dn,route:an}=getShortCircuitMatches(g);En(),Nt(bt,{matches:dn,loaderData:{},errors:{[an.id]:tn}});return}if(isHashChangeOnly(ut.location,bt)&&!(Rt&&Rt.submission&&isMutationMethod(Rt.submission.formMethod))){Nt(bt,{matches:It});return}ct=new AbortController;let Wt=createClientSideRequest(d.history,bt,ct.signal,Rt&&Rt.submission),Gt,Zt;if(Rt&&Rt.pendingError)Zt={[findNearestBoundary(It).route.id]:Rt.pendingError};else if(Rt&&Rt.submission&&isMutationMethod(Rt.submission.formMethod)){let tn=await Qt(Wt,bt,Rt.submission,It,{replace:Rt.replace});if(tn.shortCircuited)return;Gt=tn.pendingActionData,Zt=tn.pendingActionError,Ut=_extends$2({state:"loading",location:bt},Rt.submission),Wt=new Request(Wt.url,{signal:Wt.signal})}let{shortCircuited:Ht,loaderData:sn,errors:qt}=await on(Wt,bt,It,Ut,Rt&&Rt.submission,Rt&&Rt.replace,Gt,Zt);Ht||(ct=null,Nt(bt,_extends$2({matches:It},Gt?{actionData:Gt}:{},{loaderData:sn,errors:qt})))}async function Qt($t,bt,Rt,Ut,It){Sn();let Wt=_extends$2({state:"submitting",location:bt},Rt);Xt({navigation:Wt});let Gt,Zt=getTargetMatch(Ut,bt);if(!Zt.route.action)Gt={type:ResultType.error,error:getInternalRouterError(405,{method:$t.method,pathname:bt.pathname,routeId:Zt.route.id})};else if(Gt=await callLoaderOrAction("action",$t,Zt,Ut,st.basename),$t.signal.aborted)return{shortCircuited:!0};if(isRedirectResult(Gt)){let Ht;return It&&It.replace!=null?Ht=It.replace:Ht=Gt.location===ut.location.pathname+ut.location.search,await Dn(ut,Gt,{submission:Rt,replace:Ht}),{shortCircuited:!0}}if(isErrorResult(Gt)){let Ht=findNearestBoundary(Ut,Zt.route.id);return(It&&It.replace)!==!0&&(at=Action.Push),{pendingActionData:{},pendingActionError:{[Ht.route.id]:Gt.error}}}if(isDeferredResult(Gt))throw getInternalRouterError(400,{type:"defer-action"});return{pendingActionData:{[Zt.route.id]:Gt.data}}}async function on($t,bt,Rt,Ut,It,Wt,Gt,Zt){let Ht=Ut;Ht||(Ht=_extends$2({state:"loading",location:bt,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},It));let sn=It||(Ht.formMethod&&Ht.formAction&&Ht.formData&&Ht.formEncType?{formMethod:Ht.formMethod,formAction:Ht.formAction,formData:Ht.formData,formEncType:Ht.formEncType}:void 0),[qt,tn]=getMatchesToLoad(d.history,ut,Rt,sn,bt,ft,gt,pt,Gt,Zt,Ot);if(En(fn=>!(Rt&&Rt.some(An=>An.route.id===fn))||qt&&qt.some(An=>An.route.id===fn)),qt.length===0&&tn.length===0)return Nt(bt,_extends$2({matches:Rt,loaderData:{},errors:Zt||null},Gt?{actionData:Gt}:{})),{shortCircuited:!0};if(!vt){tn.forEach(An=>{let kn=ut.fetchers.get(An.key),zn={state:"loading",data:kn&&kn.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};ut.fetchers.set(An.key,zn)});let fn=Gt||ut.actionData;Xt(_extends$2({navigation:Ht},fn?Object.keys(fn).length===0?{actionData:null}:{actionData:fn}:{},tn.length>0?{fetchers:new Map(ut.fetchers)}:{}))}Dt=++At,tn.forEach(fn=>yt.set(fn.key,ct));let{results:dn,loaderResults:an,fetcherResults:gn}=await Vn(ut.matches,Rt,qt,tn,$t);if($t.signal.aborted)return{shortCircuited:!0};tn.forEach(fn=>yt.delete(fn.key));let _n=findRedirect(dn);if(_n)return await Dn(ut,_n,{replace:Wt}),{shortCircuited:!0};let{loaderData:bn,errors:rn}=processLoaderData(ut,Rt,qt,an,Zt,tn,gn,Ct);Ct.forEach((fn,An)=>{fn.subscribe(kn=>{(kn||fn.done)&&Ct.delete(An)})}),Ln();let Xn=Un(Dt);return _extends$2({loaderData:bn,errors:rn},Xn||tn.length>0?{fetchers:new Map(ut.fetchers)}:{})}function un($t){return ut.fetchers.get($t)||IDLE_FETCHER}function pn($t,bt,Rt,Ut){if(isServer)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");yt.has($t)&&Pn($t);let It=matchRoutes(g,Rt,d.basename);if(!It){Nn($t,bt,getInternalRouterError(404,{pathname:Rt}));return}let{path:Wt,submission:Gt}=normalizeNavigateOptions(Rt,Ut,!0),Zt=getTargetMatch(It,Wt);if(ht=(Ut&&Ut.preventScrollReset)===!0,Gt&&isMutationMethod(Gt.formMethod)){ln($t,bt,Wt,Zt,It,Gt);return}Ot.set($t,{routeId:bt,path:Wt,match:Zt,matches:It}),yn($t,bt,Wt,Zt,It,Gt)}async function ln($t,bt,Rt,Ut,It,Wt){if(Sn(),Ot.delete($t),!Ut.route.action){let Fn=getInternalRouterError(405,{method:Wt.formMethod,pathname:Rt,routeId:bt});Nn($t,bt,Fn);return}let Gt=ut.fetchers.get($t),Zt=_extends$2({state:"submitting"},Wt,{data:Gt&&Gt.data," _hasFetcherDoneAnything ":!0});ut.fetchers.set($t,Zt),Xt({fetchers:new Map(ut.fetchers)});let Ht=new AbortController,sn=createClientSideRequest(d.history,Rt,Ht.signal,Wt);yt.set($t,Ht);let qt=await callLoaderOrAction("action",sn,Ut,It,st.basename);if(sn.signal.aborted){yt.get($t)===Ht&&yt.delete($t);return}if(isRedirectResult(qt)){yt.delete($t),Bt.add($t);let Fn=_extends$2({state:"loading"},Wt,{data:void 0," _hasFetcherDoneAnything ":!0});return ut.fetchers.set($t,Fn),Xt({fetchers:new Map(ut.fetchers)}),Dn(ut,qt,{isFetchActionRedirect:!0})}if(isErrorResult(qt)){Nn($t,bt,qt.error);return}if(isDeferredResult(qt))throw getInternalRouterError(400,{type:"defer-action"});let tn=ut.navigation.location||ut.location,dn=createClientSideRequest(d.history,tn,Ht.signal),an=ut.navigation.state!=="idle"?matchRoutes(g,ut.navigation.location,d.basename):ut.matches;invariant(an,"Didn't find any matches after fetcher action");let gn=++At;St.set($t,gn);let _n=_extends$2({state:"loading",data:qt.data},Wt,{" _hasFetcherDoneAnything ":!0});ut.fetchers.set($t,_n);let[bn,rn]=getMatchesToLoad(d.history,ut,an,Wt,tn,ft,gt,pt,{[Ut.route.id]:qt.data},void 0,Ot);rn.filter(Fn=>Fn.key!==$t).forEach(Fn=>{let Kn=Fn.key,Jn=ut.fetchers.get(Kn),hr={state:"loading",data:Jn&&Jn.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};ut.fetchers.set(Kn,hr),yt.set(Kn,Ht)}),Xt({fetchers:new Map(ut.fetchers)});let{results:Xn,loaderResults:fn,fetcherResults:An}=await Vn(ut.matches,an,bn,rn,dn);if(Ht.signal.aborted)return;St.delete($t),yt.delete($t),rn.forEach(Fn=>yt.delete(Fn.key));let kn=findRedirect(Xn);if(kn)return Dn(ut,kn);let{loaderData:zn,errors:Qn}=processLoaderData(ut,ut.matches,bn,fn,void 0,rn,An,Ct),dr={state:"idle",data:qt.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};ut.fetchers.set($t,dr);let qn=Un(gn);ut.navigation.state==="loading"&&gn>Dt?(invariant(at,"Expected pending action"),ct&&ct.abort(),Nt(ut.navigation.location,{matches:an,loaderData:zn,errors:Qn,fetchers:new Map(ut.fetchers)})):(Xt(_extends$2({errors:Qn,loaderData:mergeLoaderData(ut.loaderData,zn,an,Qn)},qn?{fetchers:new Map(ut.fetchers)}:{})),ft=!1)}async function yn($t,bt,Rt,Ut,It,Wt){let Gt=ut.fetchers.get($t),Zt=_extends$2({state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},Wt,{data:Gt&&Gt.data," _hasFetcherDoneAnything ":!0});ut.fetchers.set($t,Zt),Xt({fetchers:new Map(ut.fetchers)});let Ht=new AbortController,sn=createClientSideRequest(d.history,Rt,Ht.signal);yt.set($t,Ht);let qt=await callLoaderOrAction("loader",sn,Ut,It,st.basename);if(isDeferredResult(qt)&&(qt=await resolveDeferredData(qt,sn.signal,!0)||qt),yt.get($t)===Ht&&yt.delete($t),sn.signal.aborted)return;if(isRedirectResult(qt)){await Dn(ut,qt);return}if(isErrorResult(qt)){let dn=findNearestBoundary(ut.matches,bt);ut.fetchers.delete($t),Xt({fetchers:new Map(ut.fetchers),errors:{[dn.route.id]:qt.error}});return}invariant(!isDeferredResult(qt),"Unhandled fetcher deferred data");let tn={state:"idle",data:qt.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};ut.fetchers.set($t,tn),Xt({fetchers:new Map(ut.fetchers)})}async function Dn($t,bt,Rt){var Ut;let{submission:It,replace:Wt,isFetchActionRedirect:Gt}=Rt===void 0?{}:Rt;bt.revalidate&&(ft=!0);let Zt=createLocation($t.location,bt.location,_extends$2({_isRedirect:!0},Gt?{_isFetchActionRedirect:!0}:{}));if(invariant(Zt,"Expected a location on the redirect navigation"),isBrowser$1&&typeof((Ut=window)==null?void 0:Ut.location)<"u"){let an=d.history.createURL(bt.location).origin;if(window.location.origin!==an){Wt?window.location.replace(bt.location):window.location.assign(bt.location);return}}ct=null;let Ht=Wt===!0?Action.Replace:Action.Push,{formMethod:sn,formAction:qt,formEncType:tn,formData:dn}=$t.navigation;!It&&sn&&qt&&dn&&tn&&(It={formMethod:sn,formAction:qt,formEncType:tn,formData:dn}),redirectPreserveMethodStatusCodes.has(bt.status)&&It&&isMutationMethod(It.formMethod)?await Yt(Ht,Zt,{submission:_extends$2({},It,{formAction:bt.location}),preventScrollReset:ht}):await Yt(Ht,Zt,{overrideNavigation:{state:"loading",location:Zt,formMethod:It?It.formMethod:void 0,formAction:It?It.formAction:void 0,formEncType:It?It.formEncType:void 0,formData:It?It.formData:void 0},preventScrollReset:ht})}async function Vn($t,bt,Rt,Ut,It){let Wt=await Promise.all([...Rt.map(Ht=>callLoaderOrAction("loader",It,Ht,bt,st.basename)),...Ut.map(Ht=>callLoaderOrAction("loader",createClientSideRequest(d.history,Ht.path,It.signal),Ht.match,Ht.matches,st.basename))]),Gt=Wt.slice(0,Rt.length),Zt=Wt.slice(Rt.length);return await Promise.all([resolveDeferredResults($t,Rt,Gt,It.signal,!1,ut.loaderData),resolveDeferredResults($t,Ut.map(Ht=>Ht.match),Zt,It.signal,!0)]),{results:Wt,loaderResults:Gt,fetcherResults:Zt}}function Sn(){ft=!0,gt.push(...En()),Ot.forEach(($t,bt)=>{yt.has(bt)&&(pt.push(bt),Pn(bt))})}function Nn($t,bt,Rt){let Ut=findNearestBoundary(ut.matches,bt);On($t),Xt({errors:{[Ut.route.id]:Rt},fetchers:new Map(ut.fetchers)})}function On($t){yt.has($t)&&Pn($t),Ot.delete($t),St.delete($t),Bt.delete($t),ut.fetchers.delete($t)}function Pn($t){let bt=yt.get($t);invariant(bt,"Expected fetch controller: "+$t),bt.abort(),yt.delete($t)}function Cn($t){for(let bt of $t){let Ut={state:"idle",data:un(bt).data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};ut.fetchers.set(bt,Ut)}}function Ln(){let $t=[];for(let bt of Bt){let Rt=ut.fetchers.get(bt);invariant(Rt,"Expected fetcher: "+bt),Rt.state==="loading"&&(Bt.delete(bt),$t.push(bt))}Cn($t)}function Un($t){let bt=[];for(let[Rt,Ut]of St)if(Ut<$t){let It=ut.fetchers.get(Rt);invariant(It,"Expected fetcher: "+Rt),It.state==="loading"&&(Pn(Rt),St.delete(Rt),bt.push(Rt))}return Cn(bt),bt.length>0}function Hn($t,bt){let Rt=ut.blockers.get($t)||IDLE_BLOCKER;return Tt.get($t)!==bt&&(Tt.set($t,bt),_t==null?_t=$t:$t!==_t&&warning(!1,"A router only supports one blocker at a time")),Rt}function Tn($t){ut.blockers.delete($t),Tt.delete($t),_t===$t&&(_t=null)}function Bn($t,bt){let Rt=ut.blockers.get($t)||IDLE_BLOCKER;invariant(Rt.state==="unblocked"&&bt.state==="blocked"||Rt.state==="blocked"&&bt.state==="blocked"||Rt.state==="blocked"&&bt.state==="proceeding"||Rt.state==="blocked"&&bt.state==="unblocked"||Rt.state==="proceeding"&&bt.state==="unblocked","Invalid blocker state transition: "+Rt.state+" -> "+bt.state),ut.blockers.set($t,bt),Xt({blockers:new Map(ut.blockers)})}function xn($t){let{currentLocation:bt,nextLocation:Rt,historyAction:Ut}=$t;if(_t==null)return;let It=Tt.get(_t);invariant(It,"Could not find a function for the active blocker");let Wt=ut.blockers.get(_t);if(!(Wt&&Wt.state==="proceeding")&&It({currentLocation:bt,nextLocation:Rt,historyAction:Ut}))return _t}function En($t){let bt=[];return Ct.forEach((Rt,Ut)=>{(!$t||$t(Ut))&&(Rt.cancel(),bt.push(Ut),Ct.delete(Ut))}),bt}function wn($t,bt,Rt){if(j=$t,et=bt,_e=Rt||(Ut=>Ut.key),!tt&&ut.navigation===IDLE_NAVIGATION){tt=!0;let Ut=cn(ut.location,ut.matches);Ut!=null&&Xt({restoreScrollPosition:Ut})}return()=>{j=null,et=null,_e=null}}function $n($t,bt){if(j&&_e&&et){let Rt=bt.map(It=>createUseMatchesMatch(It,ut.loaderData)),Ut=_e($t,Rt)||$t.key;j[Ut]=et()}}function cn($t,bt){if(j&&_e&&et){let Rt=bt.map(Wt=>createUseMatchesMatch(Wt,ut.loaderData)),Ut=_e($t,Rt)||$t.key,It=j[Ut];if(typeof It=="number")return It}return null}return st={get basename(){return d.basename},get state(){return ut},get routes(){return g},initialize:Mt,subscribe:Jt,enableScrollRestoration:wn,navigate:Lt,fetch:pn,revalidate:jt,createHref:$t=>d.history.createHref($t),encodeLocation:$t=>d.history.encodeLocation($t),getFetcher:un,deleteFetcher:On,dispose:Vt,getBlocker:Hn,deleteBlocker:Tn,_internalFetchControllers:yt,_internalActiveDeferreds:Ct},st}function isSubmissionNavigation(d){return d!=null&&"formData"in d}function normalizeNavigateOptions(d,g,$){$===void 0&&($=!1);let b=typeof d=="string"?d:createPath(d);if(!g||!isSubmissionNavigation(g))return{path:b};if(g.formMethod&&!isValidMethod(g.formMethod))return{path:b,error:getInternalRouterError(405,{method:g.formMethod})};let j;if(g.formData&&(j={formMethod:g.formMethod||"get",formAction:stripHashFromPath(b),formEncType:g&&g.formEncType||"application/x-www-form-urlencoded",formData:g.formData},isMutationMethod(j.formMethod)))return{path:b,submission:j};let _e=parsePath(b),et=convertFormDataToSearchParams(g.formData);return $&&_e.search&&hasNakedIndexQuery(_e.search)&&et.append("index",""),_e.search="?"+et,{path:createPath(_e),submission:j}}function getLoaderMatchesUntilBoundary(d,g){let $=d;if(g){let b=d.findIndex(j=>j.route.id===g);b>=0&&($=d.slice(0,b))}return $}function getMatchesToLoad(d,g,$,b,j,_e,et,tt,nt,rt,it){let st=rt?Object.values(rt)[0]:nt?Object.values(nt)[0]:void 0,ut=d.createURL(g.location),at=d.createURL(j),ht=_e||ut.toString()===at.toString()||ut.search!==at.search,ct=rt?Object.keys(rt)[0]:void 0,ft=getLoaderMatchesUntilBoundary($,ct).filter((pt,yt)=>{if(pt.route.loader==null)return!1;if(isNewLoader(g.loaderData,g.matches[yt],pt)||et.some(St=>St===pt.route.id))return!0;let At=g.matches[yt],Dt=pt;return shouldRevalidateLoader(pt,_extends$2({currentUrl:ut,currentParams:At.params,nextUrl:at,nextParams:Dt.params},b,{actionResult:st,defaultShouldRevalidate:ht||isNewRouteInstance(At,Dt)}))}),gt=[];return it&&it.forEach((pt,yt)=>{if($.some(At=>At.route.id===pt.routeId))tt.includes(yt)?gt.push(_extends$2({key:yt},pt)):shouldRevalidateLoader(pt.match,_extends$2({currentUrl:ut,currentParams:g.matches[g.matches.length-1].params,nextUrl:at,nextParams:$[$.length-1].params},b,{actionResult:st,defaultShouldRevalidate:ht}))&>.push(_extends$2({key:yt},pt));else return}),[ft,gt]}function isNewLoader(d,g,$){let b=!g||$.route.id!==g.route.id,j=d[$.route.id]===void 0;return b||j}function isNewRouteInstance(d,g){let $=d.route.path;return d.pathname!==g.pathname||$!=null&&$.endsWith("*")&&d.params["*"]!==g.params["*"]}function shouldRevalidateLoader(d,g){if(d.route.shouldRevalidate){let $=d.route.shouldRevalidate(g);if(typeof $=="boolean")return $}return g.defaultShouldRevalidate}async function callLoaderOrAction(d,g,$,b,j,_e,et,tt){j===void 0&&(j="/"),_e===void 0&&(_e=!1),et===void 0&&(et=!1);let nt,rt,it,st=new Promise((at,ht)=>it=ht),ut=()=>it();g.signal.addEventListener("abort",ut);try{let at=$.route[d];invariant(at,"Could not find the "+d+' to run on the "'+$.route.id+'" route'),rt=await Promise.race([at({request:g,params:$.params,context:tt}),st]),invariant(rt!==void 0,"You defined "+(d==="action"?"an action":"a loader")+" for route "+('"'+$.route.id+"\" but didn't return anything from your `"+d+"` ")+"function. Please return a value or `null`.")}catch(at){nt=ResultType.error,rt=at}finally{g.signal.removeEventListener("abort",ut)}if(isResponse(rt)){let at=rt.status;if(redirectStatusCodes.has(at)){let vt=rt.headers.get("Location");if(invariant(vt,"Redirects returned/thrown from loaders/actions must have a Location header"),/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(vt)){if(!_e){let gt=new URL(g.url),pt=vt.startsWith("//")?new URL(gt.protocol+vt):new URL(vt);pt.origin===gt.origin&&(vt=pt.pathname+pt.search+pt.hash)}}else{let gt=b.slice(0,b.indexOf($)+1),pt=getPathContributingMatches(gt).map(At=>At.pathnameBase),yt=resolveTo(vt,pt,new URL(g.url).pathname);if(invariant(createPath(yt),"Unable to resolve redirect location: "+vt),j){let At=yt.pathname;yt.pathname=At==="/"?j:joinPaths([j,At])}vt=createPath(yt)}if(_e)throw rt.headers.set("Location",vt),rt;return{type:ResultType.redirect,status:at,location:vt,revalidate:rt.headers.get("X-Remix-Revalidate")!==null}}if(et)throw{type:nt||ResultType.data,response:rt};let ht,ct=rt.headers.get("Content-Type");return ct&&/\bapplication\/json\b/.test(ct)?ht=await rt.json():ht=await rt.text(),nt===ResultType.error?{type:nt,error:new ErrorResponse(at,rt.statusText,ht),headers:rt.headers}:{type:ResultType.data,data:ht,statusCode:rt.status,headers:rt.headers}}return nt===ResultType.error?{type:nt,error:rt}:rt instanceof DeferredData?{type:ResultType.deferred,deferredData:rt}:{type:ResultType.data,data:rt}}function createClientSideRequest(d,g,$,b){let j=d.createURL(stripHashFromPath(g)).toString(),_e={signal:$};if(b&&isMutationMethod(b.formMethod)){let{formMethod:et,formEncType:tt,formData:nt}=b;_e.method=et.toUpperCase(),_e.body=tt==="application/x-www-form-urlencoded"?convertFormDataToSearchParams(nt):nt}return new Request(j,_e)}function convertFormDataToSearchParams(d){let g=new URLSearchParams;for(let[$,b]of d.entries())g.append($,b instanceof File?b.name:b);return g}function processRouteLoaderData(d,g,$,b,j){let _e={},et=null,tt,nt=!1,rt={};return $.forEach((it,st)=>{let ut=g[st].route.id;if(invariant(!isRedirectResult(it),"Cannot handle redirect results in processLoaderData"),isErrorResult(it)){let at=findNearestBoundary(d,ut),ht=it.error;b&&(ht=Object.values(b)[0],b=void 0),et=et||{},et[at.route.id]==null&&(et[at.route.id]=ht),_e[ut]=void 0,nt||(nt=!0,tt=isRouteErrorResponse(it.error)?it.error.status:500),it.headers&&(rt[ut]=it.headers)}else isDeferredResult(it)?(j.set(ut,it.deferredData),_e[ut]=it.deferredData.data):_e[ut]=it.data,it.statusCode!=null&&it.statusCode!==200&&!nt&&(tt=it.statusCode),it.headers&&(rt[ut]=it.headers)}),b&&(et=b,_e[Object.keys(b)[0]]=void 0),{loaderData:_e,errors:et,statusCode:tt||200,loaderHeaders:rt}}function processLoaderData(d,g,$,b,j,_e,et,tt){let{loaderData:nt,errors:rt}=processRouteLoaderData(g,$,b,j,tt);for(let it=0;it<_e.length;it++){let{key:st,match:ut}=_e[it];invariant(et!==void 0&&et[it]!==void 0,"Did not find corresponding fetcher result");let at=et[it];if(isErrorResult(at)){let ht=findNearestBoundary(d.matches,ut.route.id);rt&&rt[ht.route.id]||(rt=_extends$2({},rt,{[ht.route.id]:at.error})),d.fetchers.delete(st)}else if(isRedirectResult(at))invariant(!1,"Unhandled fetcher revalidation redirect");else if(isDeferredResult(at))invariant(!1,"Unhandled fetcher deferred data");else{let ht={state:"idle",data:at.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};d.fetchers.set(st,ht)}}return{loaderData:nt,errors:rt}}function mergeLoaderData(d,g,$,b){let j=_extends$2({},g);for(let _e of $){let et=_e.route.id;if(g.hasOwnProperty(et)?g[et]!==void 0&&(j[et]=g[et]):d[et]!==void 0&&(j[et]=d[et]),b&&b.hasOwnProperty(et))break}return j}function findNearestBoundary(d,g){return(g?d.slice(0,d.findIndex(b=>b.route.id===g)+1):[...d]).reverse().find(b=>b.route.hasErrorBoundary===!0)||d[0]}function getShortCircuitMatches(d){let g=d.find($=>$.index||!$.path||$.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:g}],route:g}}function getInternalRouterError(d,g){let{pathname:$,routeId:b,method:j,type:_e}=g===void 0?{}:g,et="Unknown Server Error",tt="Unknown @remix-run/router error";return d===400?(et="Bad Request",j&&$&&b?tt="You made a "+j+' request to "'+$+'" but '+('did not provide a `loader` for route "'+b+'", ')+"so there is no way to handle the request.":_e==="defer-action"&&(tt="defer() is not supported in actions")):d===403?(et="Forbidden",tt='Route "'+b+'" does not match URL "'+$+'"'):d===404?(et="Not Found",tt='No route matches URL "'+$+'"'):d===405&&(et="Method Not Allowed",j&&$&&b?tt="You made a "+j.toUpperCase()+' request to "'+$+'" but '+('did not provide an `action` for route "'+b+'", ')+"so there is no way to handle the request.":j&&(tt='Invalid request method "'+j.toUpperCase()+'"')),new ErrorResponse(d||500,et,new Error(tt),!0)}function findRedirect(d){for(let g=d.length-1;g>=0;g--){let $=d[g];if(isRedirectResult($))return $}}function stripHashFromPath(d){let g=typeof d=="string"?parsePath(d):d;return createPath(_extends$2({},g,{hash:""}))}function isHashChangeOnly(d,g){return d.pathname===g.pathname&&d.search===g.search&&d.hash!==g.hash}function isDeferredResult(d){return d.type===ResultType.deferred}function isErrorResult(d){return d.type===ResultType.error}function isRedirectResult(d){return(d&&d.type)===ResultType.redirect}function isResponse(d){return d!=null&&typeof d.status=="number"&&typeof d.statusText=="string"&&typeof d.headers=="object"&&typeof d.body<"u"}function isValidMethod(d){return validRequestMethods.has(d)}function isMutationMethod(d){return validMutationMethods.has(d)}async function resolveDeferredResults(d,g,$,b,j,_e){for(let et=0;et<$.length;et++){let tt=$[et],nt=g[et],rt=d.find(st=>st.route.id===nt.route.id),it=rt!=null&&!isNewRouteInstance(rt,nt)&&(_e&&_e[nt.route.id])!==void 0;isDeferredResult(tt)&&(j||it)&&await resolveDeferredData(tt,b,j).then(st=>{st&&($[et]=st||$[et])})}}async function resolveDeferredData(d,g,$){if($===void 0&&($=!1),!await d.deferredData.resolveData(g)){if($)try{return{type:ResultType.data,data:d.deferredData.unwrappedData}}catch(j){return{type:ResultType.error,error:j}}return{type:ResultType.data,data:d.deferredData.data}}}function hasNakedIndexQuery(d){return new URLSearchParams(d).getAll("index").some(g=>g==="")}function createUseMatchesMatch(d,g){let{route:$,pathname:b,params:j}=d;return{id:$.id,pathname:b,params:j,data:g[$.id],handle:$.handle}}function getTargetMatch(d,g){let $=typeof g=="string"?parsePath(g).search:g.search;if(d[d.length-1].route.index&&hasNakedIndexQuery($||""))return d[d.length-1];let b=getPathContributingMatches(d);return b[b.length-1]}/** + * React Router v6.8.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function _extends$1(){return _extends$1=Object.assign?Object.assign.bind():function(d){for(var g=1;g{j.value=b,j.getSnapshot=g,checkIfSnapshotChanged(j)&&_e({inst:j})},[d,b,g]),useEffect(()=>(checkIfSnapshotChanged(j)&&_e({inst:j}),d(()=>{checkIfSnapshotChanged(j)&&_e({inst:j})})),[d]),useDebugValue(b),b}function checkIfSnapshotChanged(d){const g=d.getSnapshot,$=d.value;try{const b=g();return!is($,b)}catch{return!0}}function useSyncExternalStore$1(d,g,$){return g()}const canUseDOM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",isServerEnvironment=!canUseDOM,shim=isServerEnvironment?useSyncExternalStore$1:useSyncExternalStore$2,useSyncExternalStore="useSyncExternalStore"in React$1?(d=>d.useSyncExternalStore)(React$1):shim,DataRouterContext=reactExports.createContext(null),DataRouterStateContext=reactExports.createContext(null),NavigationContext=reactExports.createContext(null),LocationContext=reactExports.createContext(null),RouteContext=reactExports.createContext({outlet:null,matches:[]}),RouteErrorContext=reactExports.createContext(null);function useHref(d,g){let{relative:$}=g===void 0?{}:g;useInRouterContext()||invariant(!1);let{basename:b,navigator:j}=reactExports.useContext(NavigationContext),{hash:_e,pathname:et,search:tt}=useResolvedPath(d,{relative:$}),nt=et;return b!=="/"&&(nt=et==="/"?b:joinPaths([b,et])),j.createHref({pathname:nt,search:tt,hash:_e})}function useInRouterContext(){return reactExports.useContext(LocationContext)!=null}function useLocation(){return useInRouterContext()||invariant(!1),reactExports.useContext(LocationContext).location}function useNavigate(){useInRouterContext()||invariant(!1);let{basename:d,navigator:g}=reactExports.useContext(NavigationContext),{matches:$}=reactExports.useContext(RouteContext),{pathname:b}=useLocation(),j=JSON.stringify(getPathContributingMatches($).map(tt=>tt.pathnameBase)),_e=reactExports.useRef(!1);return reactExports.useEffect(()=>{_e.current=!0}),reactExports.useCallback(function(tt,nt){if(nt===void 0&&(nt={}),!_e.current)return;if(typeof tt=="number"){g.go(tt);return}let rt=resolveTo(tt,JSON.parse(j),b,nt.relative==="path");d!=="/"&&(rt.pathname=rt.pathname==="/"?d:joinPaths([d,rt.pathname])),(nt.replace?g.replace:g.push)(rt,nt.state,nt)},[d,g,j,b])}const OutletContext=reactExports.createContext(null);function useOutlet(d){let g=reactExports.useContext(RouteContext).outlet;return g&&reactExports.createElement(OutletContext.Provider,{value:d},g)}function useResolvedPath(d,g){let{relative:$}=g===void 0?{}:g,{matches:b}=reactExports.useContext(RouteContext),{pathname:j}=useLocation(),_e=JSON.stringify(getPathContributingMatches(b).map(et=>et.pathnameBase));return reactExports.useMemo(()=>resolveTo(d,JSON.parse(_e),j,$==="path"),[d,_e,j,$])}function useRoutes(d,g){useInRouterContext()||invariant(!1);let{navigator:$}=reactExports.useContext(NavigationContext),b=reactExports.useContext(DataRouterStateContext),{matches:j}=reactExports.useContext(RouteContext),_e=j[j.length-1],et=_e?_e.params:{};_e&&_e.pathname;let tt=_e?_e.pathnameBase:"/";_e&&_e.route;let nt=useLocation(),rt;if(g){var it;let ct=typeof g=="string"?parsePath(g):g;tt==="/"||(it=ct.pathname)!=null&&it.startsWith(tt)||invariant(!1),rt=ct}else rt=nt;let st=rt.pathname||"/",ut=tt==="/"?st:st.slice(tt.length)||"/",at=matchRoutes(d,{pathname:ut}),ht=_renderMatches(at&&at.map(ct=>Object.assign({},ct,{params:Object.assign({},et,ct.params),pathname:joinPaths([tt,$.encodeLocation?$.encodeLocation(ct.pathname).pathname:ct.pathname]),pathnameBase:ct.pathnameBase==="/"?tt:joinPaths([tt,$.encodeLocation?$.encodeLocation(ct.pathnameBase).pathname:ct.pathnameBase])})),j,b||void 0);return g&&ht?reactExports.createElement(LocationContext.Provider,{value:{location:_extends$1({pathname:"/",search:"",hash:"",state:null,key:"default"},rt),navigationType:Action.Pop}},ht):ht}function DefaultErrorElement(){let d=useRouteError(),g=isRouteErrorResponse(d)?d.status+" "+d.statusText:d instanceof Error?d.message:JSON.stringify(d),$=d instanceof Error?d.stack:null,j={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},_e=null;return reactExports.createElement(reactExports.Fragment,null,reactExports.createElement("h2",null,"Unexpected Application Error!"),reactExports.createElement("h3",{style:{fontStyle:"italic"}},g),$?reactExports.createElement("pre",{style:j},$):null,_e)}class RenderErrorBoundary extends reactExports.Component{constructor(g){super(g),this.state={location:g.location,error:g.error}}static getDerivedStateFromError(g){return{error:g}}static getDerivedStateFromProps(g,$){return $.location!==g.location?{error:g.error,location:g.location}:{error:g.error||$.error,location:$.location}}componentDidCatch(g,$){console.error("React Router caught the following error during render",g,$)}render(){return this.state.error?reactExports.createElement(RouteContext.Provider,{value:this.props.routeContext},reactExports.createElement(RouteErrorContext.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function RenderedRoute(d){let{routeContext:g,match:$,children:b}=d,j=reactExports.useContext(DataRouterContext);return j&&j.static&&j.staticContext&&$.route.errorElement&&(j.staticContext._deepestRenderedBoundaryId=$.route.id),reactExports.createElement(RouteContext.Provider,{value:g},b)}function _renderMatches(d,g,$){if(g===void 0&&(g=[]),d==null)if($!=null&&$.errors)d=$.matches;else return null;let b=d,j=$==null?void 0:$.errors;if(j!=null){let _e=b.findIndex(et=>et.route.id&&(j==null?void 0:j[et.route.id]));_e>=0||invariant(!1),b=b.slice(0,Math.min(b.length,_e+1))}return b.reduceRight((_e,et,tt)=>{let nt=et.route.id?j==null?void 0:j[et.route.id]:null,rt=$?et.route.errorElement||reactExports.createElement(DefaultErrorElement,null):null,it=g.concat(b.slice(0,tt+1)),st=()=>reactExports.createElement(RenderedRoute,{match:et,routeContext:{outlet:_e,matches:it}},nt?rt:et.route.element!==void 0?et.route.element:_e);return $&&(et.route.errorElement||tt===0)?reactExports.createElement(RenderErrorBoundary,{location:$.location,component:rt,error:nt,children:st(),routeContext:{outlet:null,matches:it}}):st()},null)}var DataRouterHook$1;(function(d){d.UseBlocker="useBlocker",d.UseRevalidator="useRevalidator"})(DataRouterHook$1||(DataRouterHook$1={}));var DataRouterStateHook$1;(function(d){d.UseLoaderData="useLoaderData",d.UseActionData="useActionData",d.UseRouteError="useRouteError",d.UseNavigation="useNavigation",d.UseRouteLoaderData="useRouteLoaderData",d.UseMatches="useMatches",d.UseRevalidator="useRevalidator"})(DataRouterStateHook$1||(DataRouterStateHook$1={}));function useDataRouterState(d){let g=reactExports.useContext(DataRouterStateContext);return g||invariant(!1),g}function useRouteContext(d){let g=reactExports.useContext(RouteContext);return g||invariant(!1),g}function useCurrentRouteId(d){let g=useRouteContext(),$=g.matches[g.matches.length-1];return $.route.id||invariant(!1),$.route.id}function useLoaderData(){let d=useDataRouterState(DataRouterStateHook$1.UseLoaderData),g=useCurrentRouteId(DataRouterStateHook$1.UseLoaderData);if(d.errors&&d.errors[g]!=null){console.error("You cannot `useLoaderData` in an errorElement (routeId: "+g+")");return}return d.loaderData[g]}function useRouteError(){var d;let g=reactExports.useContext(RouteErrorContext),$=useDataRouterState(DataRouterStateHook$1.UseRouteError),b=useCurrentRouteId(DataRouterStateHook$1.UseRouteError);return g||((d=$.errors)==null?void 0:d[b])}function RouterProvider(d){let{fallbackElement:g,router:$}=d,b=useSyncExternalStore($.subscribe,()=>$.state,()=>$.state),j=reactExports.useMemo(()=>({createHref:$.createHref,encodeLocation:$.encodeLocation,go:et=>$.navigate(et),push:(et,tt,nt)=>$.navigate(et,{state:tt,preventScrollReset:nt==null?void 0:nt.preventScrollReset}),replace:(et,tt,nt)=>$.navigate(et,{replace:!0,state:tt,preventScrollReset:nt==null?void 0:nt.preventScrollReset})}),[$]),_e=$.basename||"/";return reactExports.createElement(reactExports.Fragment,null,reactExports.createElement(DataRouterContext.Provider,{value:{router:$,navigator:j,static:!1,basename:_e}},reactExports.createElement(DataRouterStateContext.Provider,{value:b},reactExports.createElement(Router,{basename:$.basename,location:$.state.location,navigationType:$.state.historyAction,navigator:j},$.state.initialized?reactExports.createElement(Routes,null):g))),null)}function Outlet(d){return useOutlet(d.context)}function Route(d){invariant(!1)}function Router(d){let{basename:g="/",children:$=null,location:b,navigationType:j=Action.Pop,navigator:_e,static:et=!1}=d;useInRouterContext()&&invariant(!1);let tt=g.replace(/^\/*/,"/"),nt=reactExports.useMemo(()=>({basename:tt,navigator:_e,static:et}),[tt,_e,et]);typeof b=="string"&&(b=parsePath(b));let{pathname:rt="/",search:it="",hash:st="",state:ut=null,key:at="default"}=b,ht=reactExports.useMemo(()=>{let ct=stripBasename(rt,tt);return ct==null?null:{pathname:ct,search:it,hash:st,state:ut,key:at}},[tt,rt,it,st,ut,at]);return ht==null?null:reactExports.createElement(NavigationContext.Provider,{value:nt},reactExports.createElement(LocationContext.Provider,{children:$,value:{location:ht,navigationType:j}}))}function Routes(d){let{children:g,location:$}=d,b=reactExports.useContext(DataRouterContext),j=b&&!g?b.router.routes:createRoutesFromChildren(g);return useRoutes(j,$)}var AwaitRenderStatus;(function(d){d[d.pending=0]="pending",d[d.success=1]="success",d[d.error=2]="error"})(AwaitRenderStatus||(AwaitRenderStatus={}));new Promise(()=>{});function createRoutesFromChildren(d,g){g===void 0&&(g=[]);let $=[];return reactExports.Children.forEach(d,(b,j)=>{if(!reactExports.isValidElement(b))return;if(b.type===reactExports.Fragment){$.push.apply($,createRoutesFromChildren(b.props.children,g));return}b.type!==Route&&invariant(!1),!b.props.index||!b.props.children||invariant(!1);let _e=[...g,j],et={id:b.props.id||_e.join("-"),caseSensitive:b.props.caseSensitive,element:b.props.element,index:b.props.index,path:b.props.path,loader:b.props.loader,action:b.props.action,errorElement:b.props.errorElement,hasErrorBoundary:b.props.errorElement!=null,shouldRevalidate:b.props.shouldRevalidate,handle:b.props.handle};b.props.children&&(et.children=createRoutesFromChildren(b.props.children,_e)),$.push(et)}),$}function enhanceManualRouteObjects(d){return d.map(g=>{let $=_extends$1({},g);return $.hasErrorBoundary==null&&($.hasErrorBoundary=$.errorElement!=null),$.children&&($.children=enhanceManualRouteObjects($.children)),$})}/** + * React Router DOM v6.8.0 + * + * Copyright (c) Remix Software Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE.md file in the root directory of this source tree. + * + * @license MIT + */function _extends(){return _extends=Object.assign?Object.assign.bind():function(d){for(var g=1;g=0)&&($[j]=d[j]);return $}function isModifiedEvent(d){return!!(d.metaKey||d.altKey||d.ctrlKey||d.shiftKey)}function shouldProcessLinkClick(d,g){return d.button===0&&(!g||g==="_self")&&!isModifiedEvent(d)}const _excluded=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],_excluded2=["aria-current","caseSensitive","className","end","style","to","children"];function createBrowserRouter(d,g){return createRouter({basename:g==null?void 0:g.basename,history:createBrowserHistory({window:g==null?void 0:g.window}),hydrationData:(g==null?void 0:g.hydrationData)||parseHydrationData(),routes:enhanceManualRouteObjects(d)}).initialize()}function parseHydrationData(){var d;let g=(d=window)==null?void 0:d.__staticRouterHydrationData;return g&&g.errors&&(g=_extends({},g,{errors:deserializeErrors(g.errors)})),g}function deserializeErrors(d){if(!d)return null;let g=Object.entries(d),$={};for(let[b,j]of g)if(j&&j.__type==="RouteErrorResponse")$[b]=new ErrorResponse(j.status,j.statusText,j.data,j.internal===!0);else if(j&&j.__type==="Error"){let _e=new Error(j.message);_e.stack="",$[b]=_e}else $[b]=j;return $}const isBrowser=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Link=reactExports.forwardRef(function(g,$){let{onClick:b,relative:j,reloadDocument:_e,replace:et,state:tt,target:nt,to:rt,preventScrollReset:it}=g,st=_objectWithoutPropertiesLoose(g,_excluded),ut=typeof rt=="string"?rt:createPath(rt),at=/^[a-z+]+:\/\//i.test(ut)||ut.startsWith("//"),ht=ut,ct=!1;if(isBrowser&&at){let pt=new URL(window.location.href),yt=ut.startsWith("//")?new URL(pt.protocol+ut):new URL(ut);yt.origin===pt.origin?ht=yt.pathname+yt.search+yt.hash:ct=!0}let vt=useHref(ht,{relative:j}),ft=useLinkClickHandler(ht,{replace:et,state:tt,target:nt,preventScrollReset:it,relative:j});function gt(pt){b&&b(pt),pt.defaultPrevented||ft(pt)}return reactExports.createElement("a",_extends({},st,{href:at?ut:vt,onClick:ct||_e?b:gt,ref:$,target:nt}))}),NavLink=reactExports.forwardRef(function(g,$){let{"aria-current":b="page",caseSensitive:j=!1,className:_e="",end:et=!1,style:tt,to:nt,children:rt}=g,it=_objectWithoutPropertiesLoose(g,_excluded2),st=useResolvedPath(nt,{relative:it.relative}),ut=useLocation(),at=reactExports.useContext(DataRouterStateContext),{navigator:ht}=reactExports.useContext(NavigationContext),ct=ht.encodeLocation?ht.encodeLocation(st).pathname:st.pathname,vt=ut.pathname,ft=at&&at.navigation&&at.navigation.location?at.navigation.location.pathname:null;j||(vt=vt.toLowerCase(),ft=ft?ft.toLowerCase():null,ct=ct.toLowerCase());let gt=vt===ct||!et&&vt.startsWith(ct)&&vt.charAt(ct.length)==="/",pt=ft!=null&&(ft===ct||!et&&ft.startsWith(ct)&&ft.charAt(ct.length)==="/"),yt=gt?b:void 0,At;typeof _e=="function"?At=_e({isActive:gt,isPending:pt}):At=[_e,gt?"active":null,pt?"pending":null].filter(Boolean).join(" ");let Dt=typeof tt=="function"?tt({isActive:gt,isPending:pt}):tt;return reactExports.createElement(Link,_extends({},it,{"aria-current":yt,className:At,ref:$,style:Dt,to:nt}),typeof rt=="function"?rt({isActive:gt,isPending:pt}):rt)});var DataRouterHook;(function(d){d.UseScrollRestoration="useScrollRestoration",d.UseSubmitImpl="useSubmitImpl",d.UseFetcher="useFetcher"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(d){d.UseFetchers="useFetchers",d.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useLinkClickHandler(d,g){let{target:$,replace:b,state:j,preventScrollReset:_e,relative:et}=g===void 0?{}:g,tt=useNavigate(),nt=useLocation(),rt=useResolvedPath(d,{relative:et});return reactExports.useCallback(it=>{if(shouldProcessLinkClick(it,$)){it.preventDefault();let st=b!==void 0?b:createPath(nt)===createPath(rt);tt(d,{replace:st,state:j,preventScrollReset:_e,relative:et})}},[nt,tt,rt,b,j,$,d,_e,et])}var client={},reactDomExports={},reactDom={get exports(){return reactDomExports},set exports(d){reactDomExports=d}},reactDom_production_min={},schedulerExports={},scheduler={get exports(){return schedulerExports},set exports(d){schedulerExports=d}},scheduler_production_min={};/** + * @license React + * scheduler.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */(function(d){function g(Nt,Lt){var jt=Nt.length;Nt.push(Lt);e:for(;0>>1,Qt=Nt[Yt];if(0>>1;Ytj(pn,jt))lnj(yn,pn)?(Nt[Yt]=yn,Nt[ln]=jt,Yt=ln):(Nt[Yt]=pn,Nt[un]=jt,Yt=un);else if(lnj(yn,jt))Nt[Yt]=yn,Nt[ln]=jt,Yt=ln;else break e}}return Lt}function j(Nt,Lt){var jt=Nt.sortIndex-Lt.sortIndex;return jt!==0?jt:Nt.id-Lt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var _e=performance;d.unstable_now=function(){return _e.now()}}else{var et=Date,tt=et.now();d.unstable_now=function(){return et.now()-tt}}var nt=[],rt=[],it=1,st=null,ut=3,at=!1,ht=!1,ct=!1,vt=typeof setTimeout=="function"?setTimeout:null,ft=typeof clearTimeout=="function"?clearTimeout:null,gt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function pt(Nt){for(var Lt=$(rt);Lt!==null;){if(Lt.callback===null)b(rt);else if(Lt.startTime<=Nt)b(rt),Lt.sortIndex=Lt.expirationTime,g(nt,Lt);else break;Lt=$(rt)}}function yt(Nt){if(ct=!1,pt(Nt),!ht)if($(nt)!==null)ht=!0,Jt(At);else{var Lt=$(rt);Lt!==null&&Xt(yt,Lt.startTime-Nt)}}function At(Nt,Lt){ht=!1,ct&&(ct=!1,ft(Bt),Bt=-1),at=!0;var jt=ut;try{for(pt(Lt),st=$(nt);st!==null&&(!(st.expirationTime>Lt)||Nt&&!_t());){var Yt=st.callback;if(typeof Yt=="function"){st.callback=null,ut=st.priorityLevel;var Qt=Yt(st.expirationTime<=Lt);Lt=d.unstable_now(),typeof Qt=="function"?st.callback=Qt:st===$(nt)&&b(nt),pt(Lt)}else b(nt);st=$(nt)}if(st!==null)var on=!0;else{var un=$(rt);un!==null&&Xt(yt,un.startTime-Lt),on=!1}return on}finally{st=null,ut=jt,at=!1}}var Dt=!1,St=null,Bt=-1,Ot=5,Ct=-1;function _t(){return!(d.unstable_now()-CtNt||125Yt?(Nt.sortIndex=jt,g(rt,Nt),$(nt)===null&&Nt===$(rt)&&(ct?(ft(Bt),Bt=-1):ct=!0,Xt(yt,jt-Yt))):(Nt.sortIndex=Qt,g(nt,Nt),ht||at||(ht=!0,Jt(At))),Nt},d.unstable_shouldYield=_t,d.unstable_wrapCallback=function(Nt){var Lt=ut;return function(){var jt=ut;ut=Lt;try{return Nt.apply(this,arguments)}finally{ut=jt}}}})(scheduler_production_min);(function(d){d.exports=scheduler_production_min})(scheduler);/** + * @license React + * react-dom.production.min.js + * + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var aa=reactExports,ca=schedulerExports;function p$1(d){for(var g="https://reactjs.org/docs/error-decoder.html?invariant="+d,$=1;$"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ja=Object.prototype.hasOwnProperty,ka=/^[: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]*$/,la={},ma={};function oa(d){return ja.call(ma,d)?!0:ja.call(la,d)?!1:ka.test(d)?ma[d]=!0:(la[d]=!0,!1)}function pa(d,g,$,b){if($!==null&&$.type===0)return!1;switch(typeof g){case"function":case"symbol":return!0;case"boolean":return b?!1:$!==null?!$.acceptsBooleans:(d=d.toLowerCase().slice(0,5),d!=="data-"&&d!=="aria-");default:return!1}}function qa(d,g,$,b){if(g===null||typeof g>"u"||pa(d,g,$,b))return!0;if(b)return!1;if($!==null)switch($.type){case 3:return!g;case 4:return g===!1;case 5:return isNaN(g);case 6:return isNaN(g)||1>g}return!1}function v$1(d,g,$,b,j,_e,et){this.acceptsBooleans=g===2||g===3||g===4,this.attributeName=b,this.attributeNamespace=j,this.mustUseProperty=$,this.propertyName=d,this.type=g,this.sanitizeURL=_e,this.removeEmptyString=et}var z={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(d){z[d]=new v$1(d,0,!1,d,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(d){var g=d[0];z[g]=new v$1(g,1,!1,d[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(d){z[d]=new v$1(d,2,!1,d.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(d){z[d]=new v$1(d,2,!1,d,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(d){z[d]=new v$1(d,3,!1,d.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(d){z[d]=new v$1(d,3,!0,d,null,!1,!1)});["capture","download"].forEach(function(d){z[d]=new v$1(d,4,!1,d,null,!1,!1)});["cols","rows","size","span"].forEach(function(d){z[d]=new v$1(d,6,!1,d,null,!1,!1)});["rowSpan","start"].forEach(function(d){z[d]=new v$1(d,5,!1,d.toLowerCase(),null,!1,!1)});var ra=/[\-:]([a-z])/g;function sa(d){return d[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(d){var g=d.replace(ra,sa);z[g]=new v$1(g,1,!1,d,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(d){var g=d.replace(ra,sa);z[g]=new v$1(g,1,!1,d,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(d){var g=d.replace(ra,sa);z[g]=new v$1(g,1,!1,d,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(d){z[d]=new v$1(d,1,!1,d.toLowerCase(),null,!1,!1)});z.xlinkHref=new v$1("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(d){z[d]=new v$1(d,1,!1,d.toLowerCase(),null,!0,!0)});function ta(d,g,$,b){var j=z.hasOwnProperty(g)?z[g]:null;(j!==null?j.type!==0:b||!(2tt||j[et]!==_e[tt]){var nt=` +`+j[et].replace(" at new "," at ");return d.displayName&&nt.includes("")&&(nt=nt.replace("",d.displayName)),nt}while(1<=et&&0<=tt);break}}}finally{Na=!1,Error.prepareStackTrace=$}return(d=d?d.displayName||d.name:"")?Ma(d):""}function Pa(d){switch(d.tag){case 5:return Ma(d.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return d=Oa(d.type,!1),d;case 11:return d=Oa(d.type.render,!1),d;case 1:return d=Oa(d.type,!0),d;default:return""}}function Qa(d){if(d==null)return null;if(typeof d=="function")return d.displayName||d.name||null;if(typeof d=="string")return d;switch(d){case ya:return"Fragment";case wa:return"Portal";case Aa:return"Profiler";case za:return"StrictMode";case Ea:return"Suspense";case Fa:return"SuspenseList"}if(typeof d=="object")switch(d.$$typeof){case Ca:return(d.displayName||"Context")+".Consumer";case Ba:return(d._context.displayName||"Context")+".Provider";case Da:var g=d.render;return d=d.displayName,d||(d=g.displayName||g.name||"",d=d!==""?"ForwardRef("+d+")":"ForwardRef"),d;case Ga:return g=d.displayName||null,g!==null?g:Qa(d.type)||"Memo";case Ha:g=d._payload,d=d._init;try{return Qa(d(g))}catch{}}return null}function Ra(d){var g=d.type;switch(d.tag){case 24:return"Cache";case 9:return(g.displayName||"Context")+".Consumer";case 10:return(g._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return d=g.render,d=d.displayName||d.name||"",g.displayName||(d!==""?"ForwardRef("+d+")":"ForwardRef");case 7:return"Fragment";case 5:return g;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(g);case 8:return g===za?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof g=="function")return g.displayName||g.name||null;if(typeof g=="string")return g}return null}function Sa(d){switch(typeof d){case"boolean":case"number":case"string":case"undefined":return d;case"object":return d;default:return""}}function Ta(d){var g=d.type;return(d=d.nodeName)&&d.toLowerCase()==="input"&&(g==="checkbox"||g==="radio")}function Ua(d){var g=Ta(d)?"checked":"value",$=Object.getOwnPropertyDescriptor(d.constructor.prototype,g),b=""+d[g];if(!d.hasOwnProperty(g)&&typeof $<"u"&&typeof $.get=="function"&&typeof $.set=="function"){var j=$.get,_e=$.set;return Object.defineProperty(d,g,{configurable:!0,get:function(){return j.call(this)},set:function(et){b=""+et,_e.call(this,et)}}),Object.defineProperty(d,g,{enumerable:$.enumerable}),{getValue:function(){return b},setValue:function(et){b=""+et},stopTracking:function(){d._valueTracker=null,delete d[g]}}}}function Va(d){d._valueTracker||(d._valueTracker=Ua(d))}function Wa(d){if(!d)return!1;var g=d._valueTracker;if(!g)return!0;var $=g.getValue(),b="";return d&&(b=Ta(d)?d.checked?"true":"false":d.value),d=b,d!==$?(g.setValue(d),!0):!1}function Xa(d){if(d=d||(typeof document<"u"?document:void 0),typeof d>"u")return null;try{return d.activeElement||d.body}catch{return d.body}}function Ya(d,g){var $=g.checked;return A({},g,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:$??d._wrapperState.initialChecked})}function Za(d,g){var $=g.defaultValue==null?"":g.defaultValue,b=g.checked!=null?g.checked:g.defaultChecked;$=Sa(g.value!=null?g.value:$),d._wrapperState={initialChecked:b,initialValue:$,controlled:g.type==="checkbox"||g.type==="radio"?g.checked!=null:g.value!=null}}function ab(d,g){g=g.checked,g!=null&&ta(d,"checked",g,!1)}function bb(d,g){ab(d,g);var $=Sa(g.value),b=g.type;if($!=null)b==="number"?($===0&&d.value===""||d.value!=$)&&(d.value=""+$):d.value!==""+$&&(d.value=""+$);else if(b==="submit"||b==="reset"){d.removeAttribute("value");return}g.hasOwnProperty("value")?cb(d,g.type,$):g.hasOwnProperty("defaultValue")&&cb(d,g.type,Sa(g.defaultValue)),g.checked==null&&g.defaultChecked!=null&&(d.defaultChecked=!!g.defaultChecked)}function db(d,g,$){if(g.hasOwnProperty("value")||g.hasOwnProperty("defaultValue")){var b=g.type;if(!(b!=="submit"&&b!=="reset"||g.value!==void 0&&g.value!==null))return;g=""+d._wrapperState.initialValue,$||g===d.value||(d.value=g),d.defaultValue=g}$=d.name,$!==""&&(d.name=""),d.defaultChecked=!!d._wrapperState.initialChecked,$!==""&&(d.name=$)}function cb(d,g,$){(g!=="number"||Xa(d.ownerDocument)!==d)&&($==null?d.defaultValue=""+d._wrapperState.initialValue:d.defaultValue!==""+$&&(d.defaultValue=""+$))}var eb=Array.isArray;function fb(d,g,$,b){if(d=d.options,g){g={};for(var j=0;j<$.length;j++)g["$"+$[j]]=!0;for($=0;$"+g.valueOf().toString()+"",g=mb.firstChild;d.firstChild;)d.removeChild(d.firstChild);for(;g.firstChild;)d.appendChild(g.firstChild)}});function ob(d,g){if(g){var $=d.firstChild;if($&&$===d.lastChild&&$.nodeType===3){$.nodeValue=g;return}}d.textContent=g}var pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(d){qb.forEach(function(g){g=g+d.charAt(0).toUpperCase()+d.substring(1),pb[g]=pb[d]})});function rb(d,g,$){return g==null||typeof g=="boolean"||g===""?"":$||typeof g!="number"||g===0||pb.hasOwnProperty(d)&&pb[d]?(""+g).trim():g+"px"}function sb(d,g){d=d.style;for(var $ in g)if(g.hasOwnProperty($)){var b=$.indexOf("--")===0,j=rb($,g[$],b);$==="float"&&($="cssFloat"),b?d.setProperty($,j):d[$]=j}}var tb=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ub(d,g){if(g){if(tb[d]&&(g.children!=null||g.dangerouslySetInnerHTML!=null))throw Error(p$1(137,d));if(g.dangerouslySetInnerHTML!=null){if(g.children!=null)throw Error(p$1(60));if(typeof g.dangerouslySetInnerHTML!="object"||!("__html"in g.dangerouslySetInnerHTML))throw Error(p$1(61))}if(g.style!=null&&typeof g.style!="object")throw Error(p$1(62))}}function vb(d,g){if(d.indexOf("-")===-1)return typeof g.is=="string";switch(d){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 wb=null;function xb(d){return d=d.target||d.srcElement||window,d.correspondingUseElement&&(d=d.correspondingUseElement),d.nodeType===3?d.parentNode:d}var yb=null,zb=null,Ab=null;function Bb(d){if(d=Cb(d)){if(typeof yb!="function")throw Error(p$1(280));var g=d.stateNode;g&&(g=Db(g),yb(d.stateNode,d.type,g))}}function Eb(d){zb?Ab?Ab.push(d):Ab=[d]:zb=d}function Fb(){if(zb){var d=zb,g=Ab;if(Ab=zb=null,Bb(d),g)for(d=0;d>>=0,d===0?32:31-(pc(d)/qc|0)|0}var rc=64,sc=4194304;function tc(d){switch(d&-d){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: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 d&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return d&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return d}}function uc(d,g){var $=d.pendingLanes;if($===0)return 0;var b=0,j=d.suspendedLanes,_e=d.pingedLanes,et=$&268435455;if(et!==0){var tt=et&~j;tt!==0?b=tc(tt):(_e&=et,_e!==0&&(b=tc(_e)))}else et=$&~j,et!==0?b=tc(et):_e!==0&&(b=tc(_e));if(b===0)return 0;if(g!==0&&g!==b&&!(g&j)&&(j=b&-b,_e=g&-g,j>=_e||j===16&&(_e&4194240)!==0))return g;if(b&4&&(b|=$&16),g=d.entangledLanes,g!==0)for(d=d.entanglements,g&=b;0$;$++)g.push(d);return g}function Ac(d,g,$){d.pendingLanes|=g,g!==536870912&&(d.suspendedLanes=0,d.pingedLanes=0),d=d.eventTimes,g=31-oc(g),d[g]=$}function Bc(d,g){var $=d.pendingLanes&~g;d.pendingLanes=g,d.suspendedLanes=0,d.pingedLanes=0,d.expiredLanes&=g,d.mutableReadLanes&=g,d.entangledLanes&=g,g=d.entanglements;var b=d.eventTimes;for(d=d.expirationTimes;0<$;){var j=31-oc($),_e=1<=be),ee=String.fromCharCode(32),fe=!1;function ge(d,g){switch(d){case"keyup":return $d.indexOf(g.keyCode)!==-1;case"keydown":return g.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he(d){return d=d.detail,typeof d=="object"&&"data"in d?d.data:null}var ie=!1;function je(d,g){switch(d){case"compositionend":return he(g);case"keypress":return g.which!==32?null:(fe=!0,ee);case"textInput":return d=g.data,d===ee&&fe?null:d;default:return null}}function ke(d,g){if(ie)return d==="compositionend"||!ae&&ge(d,g)?(d=nd(),md=ld=kd=null,ie=!1,d):null;switch(d){case"paste":return null;case"keypress":if(!(g.ctrlKey||g.altKey||g.metaKey)||g.ctrlKey&&g.altKey){if(g.char&&1=g)return{node:$,offset:g-d};d=b}e:{for(;$;){if($.nextSibling){$=$.nextSibling;break e}$=$.parentNode}$=void 0}$=Je($)}}function Le(d,g){return d&&g?d===g?!0:d&&d.nodeType===3?!1:g&&g.nodeType===3?Le(d,g.parentNode):"contains"in d?d.contains(g):d.compareDocumentPosition?!!(d.compareDocumentPosition(g)&16):!1:!1}function Me(){for(var d=window,g=Xa();g instanceof d.HTMLIFrameElement;){try{var $=typeof g.contentWindow.location.href=="string"}catch{$=!1}if($)d=g.contentWindow;else break;g=Xa(d.document)}return g}function Ne(d){var g=d&&d.nodeName&&d.nodeName.toLowerCase();return g&&(g==="input"&&(d.type==="text"||d.type==="search"||d.type==="tel"||d.type==="url"||d.type==="password")||g==="textarea"||d.contentEditable==="true")}function Oe(d){var g=Me(),$=d.focusedElem,b=d.selectionRange;if(g!==$&&$&&$.ownerDocument&&Le($.ownerDocument.documentElement,$)){if(b!==null&&Ne($)){if(g=b.start,d=b.end,d===void 0&&(d=g),"selectionStart"in $)$.selectionStart=g,$.selectionEnd=Math.min(d,$.value.length);else if(d=(g=$.ownerDocument||document)&&g.defaultView||window,d.getSelection){d=d.getSelection();var j=$.textContent.length,_e=Math.min(b.start,j);b=b.end===void 0?_e:Math.min(b.end,j),!d.extend&&_e>b&&(j=b,b=_e,_e=j),j=Ke($,_e);var et=Ke($,b);j&&et&&(d.rangeCount!==1||d.anchorNode!==j.node||d.anchorOffset!==j.offset||d.focusNode!==et.node||d.focusOffset!==et.offset)&&(g=g.createRange(),g.setStart(j.node,j.offset),d.removeAllRanges(),_e>b?(d.addRange(g),d.extend(et.node,et.offset)):(g.setEnd(et.node,et.offset),d.addRange(g)))}}for(g=[],d=$;d=d.parentNode;)d.nodeType===1&&g.push({element:d,left:d.scrollLeft,top:d.scrollTop});for(typeof $.focus=="function"&&$.focus(),$=0;$=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;function Ue(d,g,$){var b=$.window===$?$.document:$.nodeType===9?$:$.ownerDocument;Te||Qe==null||Qe!==Xa(b)||(b=Qe,"selectionStart"in b&&Ne(b)?b={start:b.selectionStart,end:b.selectionEnd}:(b=(b.ownerDocument&&b.ownerDocument.defaultView||window).getSelection(),b={anchorNode:b.anchorNode,anchorOffset:b.anchorOffset,focusNode:b.focusNode,focusOffset:b.focusOffset}),Se&&Ie(Se,b)||(Se=b,b=oe(Re,"onSelect"),0Tf||(d.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(d,g){Tf++,Sf[Tf]=d.current,d.current=g}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(d,g){var $=d.type.contextTypes;if(!$)return Vf;var b=d.stateNode;if(b&&b.__reactInternalMemoizedUnmaskedChildContext===g)return b.__reactInternalMemoizedMaskedChildContext;var j={},_e;for(_e in $)j[_e]=g[_e];return b&&(d=d.stateNode,d.__reactInternalMemoizedUnmaskedChildContext=g,d.__reactInternalMemoizedMaskedChildContext=j),j}function Zf(d){return d=d.childContextTypes,d!=null}function $f(){E(Wf),E(H)}function ag(d,g,$){if(H.current!==Vf)throw Error(p$1(168));G(H,g),G(Wf,$)}function bg(d,g,$){var b=d.stateNode;if(g=g.childContextTypes,typeof b.getChildContext!="function")return $;b=b.getChildContext();for(var j in b)if(!(j in g))throw Error(p$1(108,Ra(d)||"Unknown",j));return A({},$,b)}function cg(d){return d=(d=d.stateNode)&&d.__reactInternalMemoizedMergedChildContext||Vf,Xf=H.current,G(H,d),G(Wf,Wf.current),!0}function dg(d,g,$){var b=d.stateNode;if(!b)throw Error(p$1(169));$?(d=bg(d,g,Xf),b.__reactInternalMemoizedMergedChildContext=d,E(Wf),E(H),G(H,d)):E(Wf),G(Wf,$)}var eg=null,fg=!1,gg=!1;function hg(d){eg===null?eg=[d]:eg.push(d)}function ig(d){fg=!0,hg(d)}function jg(){if(!gg&&eg!==null){gg=!0;var d=0,g=C;try{var $=eg;for(C=1;d<$.length;d++){var b=$[d];do b=b(!0);while(b!==null)}eg=null,fg=!1}catch(j){throw eg!==null&&(eg=eg.slice(d+1)),ac(fc,jg),j}finally{C=g,gg=!1}}return null}var kg=[],lg=0,mg=null,ng=0,og=[],pg=0,qg=null,rg=1,sg="";function tg(d,g){kg[lg++]=ng,kg[lg++]=mg,mg=d,ng=g}function ug(d,g,$){og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,qg=d;var b=rg;d=sg;var j=32-oc(b)-1;b&=~(1<>=et,j-=et,rg=1<<32-oc(g)+j|$<Bt?(Ot=St,St=null):Ot=St.sibling;var Ct=ut(ft,St,pt[Bt],yt);if(Ct===null){St===null&&(St=Ot);break}d&&St&&Ct.alternate===null&&g(ft,St),gt=_e(Ct,gt,Bt),Dt===null?At=Ct:Dt.sibling=Ct,Dt=Ct,St=Ot}if(Bt===pt.length)return $(ft,St),I&&tg(ft,Bt),At;if(St===null){for(;BtBt?(Ot=St,St=null):Ot=St.sibling;var _t=ut(ft,St,Ct.value,yt);if(_t===null){St===null&&(St=Ot);break}d&&St&&_t.alternate===null&&g(ft,St),gt=_e(_t,gt,Bt),Dt===null?At=_t:Dt.sibling=_t,Dt=_t,St=Ot}if(Ct.done)return $(ft,St),I&&tg(ft,Bt),At;if(St===null){for(;!Ct.done;Bt++,Ct=pt.next())Ct=st(ft,Ct.value,yt),Ct!==null&&(gt=_e(Ct,gt,Bt),Dt===null?At=Ct:Dt.sibling=Ct,Dt=Ct);return I&&tg(ft,Bt),At}for(St=b(ft,St);!Ct.done;Bt++,Ct=pt.next())Ct=at(St,ft,Bt,Ct.value,yt),Ct!==null&&(d&&Ct.alternate!==null&&St.delete(Ct.key===null?Bt:Ct.key),gt=_e(Ct,gt,Bt),Dt===null?At=Ct:Dt.sibling=Ct,Dt=Ct);return d&&St.forEach(function(Tt){return g(ft,Tt)}),I&&tg(ft,Bt),At}function vt(ft,gt,pt,yt){if(typeof pt=="object"&&pt!==null&&pt.type===ya&&pt.key===null&&(pt=pt.props.children),typeof pt=="object"&&pt!==null){switch(pt.$$typeof){case va:e:{for(var At=pt.key,Dt=gt;Dt!==null;){if(Dt.key===At){if(At=pt.type,At===ya){if(Dt.tag===7){$(ft,Dt.sibling),gt=j(Dt,pt.props.children),gt.return=ft,ft=gt;break e}}else if(Dt.elementType===At||typeof At=="object"&&At!==null&&At.$$typeof===Ha&&uh(At)===Dt.type){$(ft,Dt.sibling),gt=j(Dt,pt.props),gt.ref=sh(ft,Dt,pt),gt.return=ft,ft=gt;break e}$(ft,Dt);break}else g(ft,Dt);Dt=Dt.sibling}pt.type===ya?(gt=Ah(pt.props.children,ft.mode,yt,pt.key),gt.return=ft,ft=gt):(yt=yh(pt.type,pt.key,pt.props,null,ft.mode,yt),yt.ref=sh(ft,gt,pt),yt.return=ft,ft=yt)}return et(ft);case wa:e:{for(Dt=pt.key;gt!==null;){if(gt.key===Dt)if(gt.tag===4&>.stateNode.containerInfo===pt.containerInfo&>.stateNode.implementation===pt.implementation){$(ft,gt.sibling),gt=j(gt,pt.children||[]),gt.return=ft,ft=gt;break e}else{$(ft,gt);break}else g(ft,gt);gt=gt.sibling}gt=zh(pt,ft.mode,yt),gt.return=ft,ft=gt}return et(ft);case Ha:return Dt=pt._init,vt(ft,gt,Dt(pt._payload),yt)}if(eb(pt))return ht(ft,gt,pt,yt);if(Ka(pt))return ct(ft,gt,pt,yt);th(ft,pt)}return typeof pt=="string"&&pt!==""||typeof pt=="number"?(pt=""+pt,gt!==null&>.tag===6?($(ft,gt.sibling),gt=j(gt,pt),gt.return=ft,ft=gt):($(ft,gt),gt=xh(pt,ft.mode,yt),gt.return=ft,ft=gt),et(ft)):$(ft,gt)}return vt}var Bh=vh(!0),Ch=vh(!1),Dh={},Eh=Uf(Dh),Fh=Uf(Dh),Gh=Uf(Dh);function Hh(d){if(d===Dh)throw Error(p$1(174));return d}function Ih(d,g){switch(G(Gh,g),G(Fh,d),G(Eh,Dh),d=g.nodeType,d){case 9:case 11:g=(g=g.documentElement)?g.namespaceURI:lb(null,"");break;default:d=d===8?g.parentNode:g,g=d.namespaceURI||null,d=d.tagName,g=lb(g,d)}E(Eh),G(Eh,g)}function Jh(){E(Eh),E(Fh),E(Gh)}function Kh(d){Hh(Gh.current);var g=Hh(Eh.current),$=lb(g,d.type);g!==$&&(G(Fh,d),G(Eh,$))}function Lh(d){Fh.current===d&&(E(Eh),E(Fh))}var M=Uf(0);function Mh(d){for(var g=d;g!==null;){if(g.tag===13){var $=g.memoizedState;if($!==null&&($=$.dehydrated,$===null||$.data==="$?"||$.data==="$!"))return g}else if(g.tag===19&&g.memoizedProps.revealOrder!==void 0){if(g.flags&128)return g}else if(g.child!==null){g.child.return=g,g=g.child;continue}if(g===d)break;for(;g.sibling===null;){if(g.return===null||g.return===d)return null;g=g.return}g.sibling.return=g.return,g=g.sibling}return null}var Nh=[];function Oh(){for(var d=0;d$?$:4,d(!0);var b=Qh.transition;Qh.transition={};try{d(!1),g()}finally{C=$,Qh.transition=b}}function Fi(){return di().memoizedState}function Gi(d,g,$){var b=lh(d);if($={lane:b,action:$,hasEagerState:!1,eagerState:null,next:null},Hi(d))Ii(g,$);else if($=Yg(d,g,$,b),$!==null){var j=L();mh($,d,b,j),Ji($,g,b)}}function ri(d,g,$){var b=lh(d),j={lane:b,action:$,hasEagerState:!1,eagerState:null,next:null};if(Hi(d))Ii(g,j);else{var _e=d.alternate;if(d.lanes===0&&(_e===null||_e.lanes===0)&&(_e=g.lastRenderedReducer,_e!==null))try{var et=g.lastRenderedState,tt=_e(et,$);if(j.hasEagerState=!0,j.eagerState=tt,He(tt,et)){var nt=g.interleaved;nt===null?(j.next=j,Xg(g)):(j.next=nt.next,nt.next=j),g.interleaved=j;return}}catch{}finally{}$=Yg(d,g,j,b),$!==null&&(j=L(),mh($,d,b,j),Ji($,g,b))}}function Hi(d){var g=d.alternate;return d===N$1||g!==null&&g===N$1}function Ii(d,g){Th=Sh=!0;var $=d.pending;$===null?g.next=g:(g.next=$.next,$.next=g),d.pending=g}function Ji(d,g,$){if($&4194240){var b=g.lanes;b&=d.pendingLanes,$|=b,g.lanes=$,Cc(d,$)}}var ai={readContext:Vg,useCallback:Q,useContext:Q,useEffect:Q,useImperativeHandle:Q,useInsertionEffect:Q,useLayoutEffect:Q,useMemo:Q,useReducer:Q,useRef:Q,useState:Q,useDebugValue:Q,useDeferredValue:Q,useTransition:Q,useMutableSource:Q,useSyncExternalStore:Q,useId:Q,unstable_isNewReconciler:!1},Yh={readContext:Vg,useCallback:function(d,g){return ci().memoizedState=[d,g===void 0?null:g],d},useContext:Vg,useEffect:vi,useImperativeHandle:function(d,g,$){return $=$!=null?$.concat([d]):null,ti(4194308,4,yi.bind(null,g,d),$)},useLayoutEffect:function(d,g){return ti(4194308,4,d,g)},useInsertionEffect:function(d,g){return ti(4,2,d,g)},useMemo:function(d,g){var $=ci();return g=g===void 0?null:g,d=d(),$.memoizedState=[d,g],d},useReducer:function(d,g,$){var b=ci();return g=$!==void 0?$(g):g,b.memoizedState=b.baseState=g,d={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:d,lastRenderedState:g},b.queue=d,d=d.dispatch=Gi.bind(null,N$1,d),[b.memoizedState,d]},useRef:function(d){var g=ci();return d={current:d},g.memoizedState=d},useState:qi,useDebugValue:Ai,useDeferredValue:function(d){return ci().memoizedState=d},useTransition:function(){var d=qi(!1),g=d[0];return d=Ei.bind(null,d[1]),ci().memoizedState=d,[g,d]},useMutableSource:function(){},useSyncExternalStore:function(d,g,$){var b=N$1,j=ci();if(I){if($===void 0)throw Error(p$1(407));$=$()}else{if($=g(),R===null)throw Error(p$1(349));Rh&30||ni(b,g,$)}j.memoizedState=$;var _e={value:$,getSnapshot:g};return j.queue=_e,vi(ki.bind(null,b,_e,d),[d]),b.flags|=2048,li(9,mi.bind(null,b,_e,$,g),void 0,null),$},useId:function(){var d=ci(),g=R.identifierPrefix;if(I){var $=sg,b=rg;$=(b&~(1<<32-oc(b)-1)).toString(32)+$,g=":"+g+"R"+$,$=Uh++,0<$&&(g+="H"+$.toString(32)),g+=":"}else $=Vh++,g=":"+g+"r"+$.toString(32)+":";return d.memoizedState=g},unstable_isNewReconciler:!1},Zh={readContext:Vg,useCallback:Bi,useContext:Vg,useEffect:ji,useImperativeHandle:zi,useInsertionEffect:wi,useLayoutEffect:xi,useMemo:Ci,useReducer:fi,useRef:si,useState:function(){return fi(ei)},useDebugValue:Ai,useDeferredValue:function(d){var g=di();return Di(g,O$1.memoizedState,d)},useTransition:function(){var d=fi(ei)[0],g=di().memoizedState;return[d,g]},useMutableSource:hi,useSyncExternalStore:ii,useId:Fi,unstable_isNewReconciler:!1},$h={readContext:Vg,useCallback:Bi,useContext:Vg,useEffect:ji,useImperativeHandle:zi,useInsertionEffect:wi,useLayoutEffect:xi,useMemo:Ci,useReducer:gi,useRef:si,useState:function(){return gi(ei)},useDebugValue:Ai,useDeferredValue:function(d){var g=di();return O$1===null?g.memoizedState=d:Di(g,O$1.memoizedState,d)},useTransition:function(){var d=gi(ei)[0],g=di().memoizedState;return[d,g]},useMutableSource:hi,useSyncExternalStore:ii,useId:Fi,unstable_isNewReconciler:!1};function Ki(d,g){try{var $="",b=g;do $+=Pa(b),b=b.return;while(b);var j=$}catch(_e){j=` +Error generating stack: `+_e.message+` +`+_e.stack}return{value:d,source:g,stack:j,digest:null}}function Li(d,g,$){return{value:d,source:null,stack:$??null,digest:g??null}}function Mi(d,g){try{console.error(g.value)}catch($){setTimeout(function(){throw $})}}var Ni=typeof WeakMap=="function"?WeakMap:Map;function Oi(d,g,$){$=ch(-1,$),$.tag=3,$.payload={element:null};var b=g.value;return $.callback=function(){Pi||(Pi=!0,Qi=b),Mi(d,g)},$}function Ri(d,g,$){$=ch(-1,$),$.tag=3;var b=d.type.getDerivedStateFromError;if(typeof b=="function"){var j=g.value;$.payload=function(){return b(j)},$.callback=function(){Mi(d,g)}}var _e=d.stateNode;return _e!==null&&typeof _e.componentDidCatch=="function"&&($.callback=function(){Mi(d,g),typeof b!="function"&&(Si===null?Si=new Set([this]):Si.add(this));var et=g.stack;this.componentDidCatch(g.value,{componentStack:et!==null?et:""})}),$}function Ti(d,g,$){var b=d.pingCache;if(b===null){b=d.pingCache=new Ni;var j=new Set;b.set(g,j)}else j=b.get(g),j===void 0&&(j=new Set,b.set(g,j));j.has($)||(j.add($),d=Ui.bind(null,d,g,$),g.then(d,d))}function Vi(d){do{var g;if((g=d.tag===13)&&(g=d.memoizedState,g=g!==null?g.dehydrated!==null:!0),g)return d;d=d.return}while(d!==null);return null}function Wi(d,g,$,b,j){return d.mode&1?(d.flags|=65536,d.lanes=j,d):(d===g?d.flags|=65536:(d.flags|=128,$.flags|=131072,$.flags&=-52805,$.tag===1&&($.alternate===null?$.tag=17:(g=ch(-1,1),g.tag=2,dh($,g,1))),$.lanes|=1),d)}var Xi=ua.ReactCurrentOwner,Ug=!1;function Yi(d,g,$,b){g.child=d===null?Ch(g,null,$,b):Bh(g,d.child,$,b)}function Zi(d,g,$,b,j){$=$.render;var _e=g.ref;return Tg(g,j),b=Xh(d,g,$,b,_e,j),$=bi(),d!==null&&!Ug?(g.updateQueue=d.updateQueue,g.flags&=-2053,d.lanes&=~j,$i(d,g,j)):(I&&$&&vg(g),g.flags|=1,Yi(d,g,b,j),g.child)}function aj(d,g,$,b,j){if(d===null){var _e=$.type;return typeof _e=="function"&&!bj(_e)&&_e.defaultProps===void 0&&$.compare===null&&$.defaultProps===void 0?(g.tag=15,g.type=_e,cj(d,g,_e,b,j)):(d=yh($.type,null,b,g,g.mode,j),d.ref=g.ref,d.return=g,g.child=d)}if(_e=d.child,!(d.lanes&j)){var et=_e.memoizedProps;if($=$.compare,$=$!==null?$:Ie,$(et,b)&&d.ref===g.ref)return $i(d,g,j)}return g.flags|=1,d=wh(_e,b),d.ref=g.ref,d.return=g,g.child=d}function cj(d,g,$,b,j){if(d!==null){var _e=d.memoizedProps;if(Ie(_e,b)&&d.ref===g.ref)if(Ug=!1,g.pendingProps=b=_e,(d.lanes&j)!==0)d.flags&131072&&(Ug=!0);else return g.lanes=d.lanes,$i(d,g,j)}return dj(d,g,$,b,j)}function ej(d,g,$){var b=g.pendingProps,j=b.children,_e=d!==null?d.memoizedState:null;if(b.mode==="hidden")if(!(g.mode&1))g.memoizedState={baseLanes:0,cachePool:null,transitions:null},G(fj,gj),gj|=$;else{if(!($&1073741824))return d=_e!==null?_e.baseLanes|$:$,g.lanes=g.childLanes=1073741824,g.memoizedState={baseLanes:d,cachePool:null,transitions:null},g.updateQueue=null,G(fj,gj),gj|=d,null;g.memoizedState={baseLanes:0,cachePool:null,transitions:null},b=_e!==null?_e.baseLanes:$,G(fj,gj),gj|=b}else _e!==null?(b=_e.baseLanes|$,g.memoizedState=null):b=$,G(fj,gj),gj|=b;return Yi(d,g,j,$),g.child}function hj(d,g){var $=g.ref;(d===null&&$!==null||d!==null&&d.ref!==$)&&(g.flags|=512,g.flags|=2097152)}function dj(d,g,$,b,j){var _e=Zf($)?Xf:H.current;return _e=Yf(g,_e),Tg(g,j),$=Xh(d,g,$,b,_e,j),b=bi(),d!==null&&!Ug?(g.updateQueue=d.updateQueue,g.flags&=-2053,d.lanes&=~j,$i(d,g,j)):(I&&b&&vg(g),g.flags|=1,Yi(d,g,$,j),g.child)}function ij(d,g,$,b,j){if(Zf($)){var _e=!0;cg(g)}else _e=!1;if(Tg(g,j),g.stateNode===null)jj(d,g),ph(g,$,b),rh(g,$,b,j),b=!0;else if(d===null){var et=g.stateNode,tt=g.memoizedProps;et.props=tt;var nt=et.context,rt=$.contextType;typeof rt=="object"&&rt!==null?rt=Vg(rt):(rt=Zf($)?Xf:H.current,rt=Yf(g,rt));var it=$.getDerivedStateFromProps,st=typeof it=="function"||typeof et.getSnapshotBeforeUpdate=="function";st||typeof et.UNSAFE_componentWillReceiveProps!="function"&&typeof et.componentWillReceiveProps!="function"||(tt!==b||nt!==rt)&&qh(g,et,b,rt),$g=!1;var ut=g.memoizedState;et.state=ut,gh(g,b,et,j),nt=g.memoizedState,tt!==b||ut!==nt||Wf.current||$g?(typeof it=="function"&&(kh(g,$,it,b),nt=g.memoizedState),(tt=$g||oh(g,$,tt,b,ut,nt,rt))?(st||typeof et.UNSAFE_componentWillMount!="function"&&typeof et.componentWillMount!="function"||(typeof et.componentWillMount=="function"&&et.componentWillMount(),typeof et.UNSAFE_componentWillMount=="function"&&et.UNSAFE_componentWillMount()),typeof et.componentDidMount=="function"&&(g.flags|=4194308)):(typeof et.componentDidMount=="function"&&(g.flags|=4194308),g.memoizedProps=b,g.memoizedState=nt),et.props=b,et.state=nt,et.context=rt,b=tt):(typeof et.componentDidMount=="function"&&(g.flags|=4194308),b=!1)}else{et=g.stateNode,bh(d,g),tt=g.memoizedProps,rt=g.type===g.elementType?tt:Lg(g.type,tt),et.props=rt,st=g.pendingProps,ut=et.context,nt=$.contextType,typeof nt=="object"&&nt!==null?nt=Vg(nt):(nt=Zf($)?Xf:H.current,nt=Yf(g,nt));var at=$.getDerivedStateFromProps;(it=typeof at=="function"||typeof et.getSnapshotBeforeUpdate=="function")||typeof et.UNSAFE_componentWillReceiveProps!="function"&&typeof et.componentWillReceiveProps!="function"||(tt!==st||ut!==nt)&&qh(g,et,b,nt),$g=!1,ut=g.memoizedState,et.state=ut,gh(g,b,et,j);var ht=g.memoizedState;tt!==st||ut!==ht||Wf.current||$g?(typeof at=="function"&&(kh(g,$,at,b),ht=g.memoizedState),(rt=$g||oh(g,$,rt,b,ut,ht,nt)||!1)?(it||typeof et.UNSAFE_componentWillUpdate!="function"&&typeof et.componentWillUpdate!="function"||(typeof et.componentWillUpdate=="function"&&et.componentWillUpdate(b,ht,nt),typeof et.UNSAFE_componentWillUpdate=="function"&&et.UNSAFE_componentWillUpdate(b,ht,nt)),typeof et.componentDidUpdate=="function"&&(g.flags|=4),typeof et.getSnapshotBeforeUpdate=="function"&&(g.flags|=1024)):(typeof et.componentDidUpdate!="function"||tt===d.memoizedProps&&ut===d.memoizedState||(g.flags|=4),typeof et.getSnapshotBeforeUpdate!="function"||tt===d.memoizedProps&&ut===d.memoizedState||(g.flags|=1024),g.memoizedProps=b,g.memoizedState=ht),et.props=b,et.state=ht,et.context=nt,b=rt):(typeof et.componentDidUpdate!="function"||tt===d.memoizedProps&&ut===d.memoizedState||(g.flags|=4),typeof et.getSnapshotBeforeUpdate!="function"||tt===d.memoizedProps&&ut===d.memoizedState||(g.flags|=1024),b=!1)}return kj(d,g,$,b,_e,j)}function kj(d,g,$,b,j,_e){hj(d,g);var et=(g.flags&128)!==0;if(!b&&!et)return j&&dg(g,$,!1),$i(d,g,_e);b=g.stateNode,Xi.current=g;var tt=et&&typeof $.getDerivedStateFromError!="function"?null:b.render();return g.flags|=1,d!==null&&et?(g.child=Bh(g,d.child,null,_e),g.child=Bh(g,null,tt,_e)):Yi(d,g,tt,_e),g.memoizedState=b.state,j&&dg(g,$,!0),g.child}function lj(d){var g=d.stateNode;g.pendingContext?ag(d,g.pendingContext,g.pendingContext!==g.context):g.context&&ag(d,g.context,!1),Ih(d,g.containerInfo)}function mj(d,g,$,b,j){return Ig(),Jg(j),g.flags|=256,Yi(d,g,$,b),g.child}var nj={dehydrated:null,treeContext:null,retryLane:0};function oj(d){return{baseLanes:d,cachePool:null,transitions:null}}function pj(d,g,$){var b=g.pendingProps,j=M.current,_e=!1,et=(g.flags&128)!==0,tt;if((tt=et)||(tt=d!==null&&d.memoizedState===null?!1:(j&2)!==0),tt?(_e=!0,g.flags&=-129):(d===null||d.memoizedState!==null)&&(j|=1),G(M,j&1),d===null)return Eg(g),d=g.memoizedState,d!==null&&(d=d.dehydrated,d!==null)?(g.mode&1?d.data==="$!"?g.lanes=8:g.lanes=1073741824:g.lanes=1,null):(et=b.children,d=b.fallback,_e?(b=g.mode,_e=g.child,et={mode:"hidden",children:et},!(b&1)&&_e!==null?(_e.childLanes=0,_e.pendingProps=et):_e=qj(et,b,0,null),d=Ah(d,b,$,null),_e.return=g,d.return=g,_e.sibling=d,g.child=_e,g.child.memoizedState=oj($),g.memoizedState=nj,d):rj(g,et));if(j=d.memoizedState,j!==null&&(tt=j.dehydrated,tt!==null))return sj(d,g,et,b,tt,j,$);if(_e){_e=b.fallback,et=g.mode,j=d.child,tt=j.sibling;var nt={mode:"hidden",children:b.children};return!(et&1)&&g.child!==j?(b=g.child,b.childLanes=0,b.pendingProps=nt,g.deletions=null):(b=wh(j,nt),b.subtreeFlags=j.subtreeFlags&14680064),tt!==null?_e=wh(tt,_e):(_e=Ah(_e,et,$,null),_e.flags|=2),_e.return=g,b.return=g,b.sibling=_e,g.child=b,b=_e,_e=g.child,et=d.child.memoizedState,et=et===null?oj($):{baseLanes:et.baseLanes|$,cachePool:null,transitions:et.transitions},_e.memoizedState=et,_e.childLanes=d.childLanes&~$,g.memoizedState=nj,b}return _e=d.child,d=_e.sibling,b=wh(_e,{mode:"visible",children:b.children}),!(g.mode&1)&&(b.lanes=$),b.return=g,b.sibling=null,d!==null&&($=g.deletions,$===null?(g.deletions=[d],g.flags|=16):$.push(d)),g.child=b,g.memoizedState=null,b}function rj(d,g){return g=qj({mode:"visible",children:g},d.mode,0,null),g.return=d,d.child=g}function tj(d,g,$,b){return b!==null&&Jg(b),Bh(g,d.child,null,$),d=rj(g,g.pendingProps.children),d.flags|=2,g.memoizedState=null,d}function sj(d,g,$,b,j,_e,et){if($)return g.flags&256?(g.flags&=-257,b=Li(Error(p$1(422))),tj(d,g,et,b)):g.memoizedState!==null?(g.child=d.child,g.flags|=128,null):(_e=b.fallback,j=g.mode,b=qj({mode:"visible",children:b.children},j,0,null),_e=Ah(_e,j,et,null),_e.flags|=2,b.return=g,_e.return=g,b.sibling=_e,g.child=b,g.mode&1&&Bh(g,d.child,null,et),g.child.memoizedState=oj(et),g.memoizedState=nj,_e);if(!(g.mode&1))return tj(d,g,et,null);if(j.data==="$!"){if(b=j.nextSibling&&j.nextSibling.dataset,b)var tt=b.dgst;return b=tt,_e=Error(p$1(419)),b=Li(_e,b,void 0),tj(d,g,et,b)}if(tt=(et&d.childLanes)!==0,Ug||tt){if(b=R,b!==null){switch(et&-et){case 4:j=2;break;case 16:j=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:j=32;break;case 536870912:j=268435456;break;default:j=0}j=j&(b.suspendedLanes|et)?0:j,j!==0&&j!==_e.retryLane&&(_e.retryLane=j,Zg(d,j),mh(b,d,j,-1))}return uj(),b=Li(Error(p$1(421))),tj(d,g,et,b)}return j.data==="$?"?(g.flags|=128,g.child=d.child,g=vj.bind(null,d),j._reactRetry=g,null):(d=_e.treeContext,yg=Lf(j.nextSibling),xg=g,I=!0,zg=null,d!==null&&(og[pg++]=rg,og[pg++]=sg,og[pg++]=qg,rg=d.id,sg=d.overflow,qg=g),g=rj(g,b.children),g.flags|=4096,g)}function wj(d,g,$){d.lanes|=g;var b=d.alternate;b!==null&&(b.lanes|=g),Sg(d.return,g,$)}function xj(d,g,$,b,j){var _e=d.memoizedState;_e===null?d.memoizedState={isBackwards:g,rendering:null,renderingStartTime:0,last:b,tail:$,tailMode:j}:(_e.isBackwards=g,_e.rendering=null,_e.renderingStartTime=0,_e.last=b,_e.tail=$,_e.tailMode=j)}function yj(d,g,$){var b=g.pendingProps,j=b.revealOrder,_e=b.tail;if(Yi(d,g,b.children,$),b=M.current,b&2)b=b&1|2,g.flags|=128;else{if(d!==null&&d.flags&128)e:for(d=g.child;d!==null;){if(d.tag===13)d.memoizedState!==null&&wj(d,$,g);else if(d.tag===19)wj(d,$,g);else if(d.child!==null){d.child.return=d,d=d.child;continue}if(d===g)break e;for(;d.sibling===null;){if(d.return===null||d.return===g)break e;d=d.return}d.sibling.return=d.return,d=d.sibling}b&=1}if(G(M,b),!(g.mode&1))g.memoizedState=null;else switch(j){case"forwards":for($=g.child,j=null;$!==null;)d=$.alternate,d!==null&&Mh(d)===null&&(j=$),$=$.sibling;$=j,$===null?(j=g.child,g.child=null):(j=$.sibling,$.sibling=null),xj(g,!1,j,$,_e);break;case"backwards":for($=null,j=g.child,g.child=null;j!==null;){if(d=j.alternate,d!==null&&Mh(d)===null){g.child=j;break}d=j.sibling,j.sibling=$,$=j,j=d}xj(g,!0,$,null,_e);break;case"together":xj(g,!1,null,null,void 0);break;default:g.memoizedState=null}return g.child}function jj(d,g){!(g.mode&1)&&d!==null&&(d.alternate=null,g.alternate=null,g.flags|=2)}function $i(d,g,$){if(d!==null&&(g.dependencies=d.dependencies),hh|=g.lanes,!($&g.childLanes))return null;if(d!==null&&g.child!==d.child)throw Error(p$1(153));if(g.child!==null){for(d=g.child,$=wh(d,d.pendingProps),g.child=$,$.return=g;d.sibling!==null;)d=d.sibling,$=$.sibling=wh(d,d.pendingProps),$.return=g;$.sibling=null}return g.child}function zj(d,g,$){switch(g.tag){case 3:lj(g),Ig();break;case 5:Kh(g);break;case 1:Zf(g.type)&&cg(g);break;case 4:Ih(g,g.stateNode.containerInfo);break;case 10:var b=g.type._context,j=g.memoizedProps.value;G(Mg,b._currentValue),b._currentValue=j;break;case 13:if(b=g.memoizedState,b!==null)return b.dehydrated!==null?(G(M,M.current&1),g.flags|=128,null):$&g.child.childLanes?pj(d,g,$):(G(M,M.current&1),d=$i(d,g,$),d!==null?d.sibling:null);G(M,M.current&1);break;case 19:if(b=($&g.childLanes)!==0,d.flags&128){if(b)return yj(d,g,$);g.flags|=128}if(j=g.memoizedState,j!==null&&(j.rendering=null,j.tail=null,j.lastEffect=null),G(M,M.current),b)break;return null;case 22:case 23:return g.lanes=0,ej(d,g,$)}return $i(d,g,$)}var Aj,Bj,Cj,Dj;Aj=function(d,g){for(var $=g.child;$!==null;){if($.tag===5||$.tag===6)d.appendChild($.stateNode);else if($.tag!==4&&$.child!==null){$.child.return=$,$=$.child;continue}if($===g)break;for(;$.sibling===null;){if($.return===null||$.return===g)return;$=$.return}$.sibling.return=$.return,$=$.sibling}};Bj=function(){};Cj=function(d,g,$,b){var j=d.memoizedProps;if(j!==b){d=g.stateNode,Hh(Eh.current);var _e=null;switch($){case"input":j=Ya(d,j),b=Ya(d,b),_e=[];break;case"select":j=A({},j,{value:void 0}),b=A({},b,{value:void 0}),_e=[];break;case"textarea":j=gb(d,j),b=gb(d,b),_e=[];break;default:typeof j.onClick!="function"&&typeof b.onClick=="function"&&(d.onclick=Bf)}ub($,b);var et;$=null;for(rt in j)if(!b.hasOwnProperty(rt)&&j.hasOwnProperty(rt)&&j[rt]!=null)if(rt==="style"){var tt=j[rt];for(et in tt)tt.hasOwnProperty(et)&&($||($={}),$[et]="")}else rt!=="dangerouslySetInnerHTML"&&rt!=="children"&&rt!=="suppressContentEditableWarning"&&rt!=="suppressHydrationWarning"&&rt!=="autoFocus"&&(ea.hasOwnProperty(rt)?_e||(_e=[]):(_e=_e||[]).push(rt,null));for(rt in b){var nt=b[rt];if(tt=j!=null?j[rt]:void 0,b.hasOwnProperty(rt)&&nt!==tt&&(nt!=null||tt!=null))if(rt==="style")if(tt){for(et in tt)!tt.hasOwnProperty(et)||nt&&nt.hasOwnProperty(et)||($||($={}),$[et]="");for(et in nt)nt.hasOwnProperty(et)&&tt[et]!==nt[et]&&($||($={}),$[et]=nt[et])}else $||(_e||(_e=[]),_e.push(rt,$)),$=nt;else rt==="dangerouslySetInnerHTML"?(nt=nt?nt.__html:void 0,tt=tt?tt.__html:void 0,nt!=null&&tt!==nt&&(_e=_e||[]).push(rt,nt)):rt==="children"?typeof nt!="string"&&typeof nt!="number"||(_e=_e||[]).push(rt,""+nt):rt!=="suppressContentEditableWarning"&&rt!=="suppressHydrationWarning"&&(ea.hasOwnProperty(rt)?(nt!=null&&rt==="onScroll"&&D("scroll",d),_e||tt===nt||(_e=[])):(_e=_e||[]).push(rt,nt))}$&&(_e=_e||[]).push("style",$);var rt=_e;(g.updateQueue=rt)&&(g.flags|=4)}};Dj=function(d,g,$,b){$!==b&&(g.flags|=4)};function Ej(d,g){if(!I)switch(d.tailMode){case"hidden":g=d.tail;for(var $=null;g!==null;)g.alternate!==null&&($=g),g=g.sibling;$===null?d.tail=null:$.sibling=null;break;case"collapsed":$=d.tail;for(var b=null;$!==null;)$.alternate!==null&&(b=$),$=$.sibling;b===null?g||d.tail===null?d.tail=null:d.tail.sibling=null:b.sibling=null}}function S(d){var g=d.alternate!==null&&d.alternate.child===d.child,$=0,b=0;if(g)for(var j=d.child;j!==null;)$|=j.lanes|j.childLanes,b|=j.subtreeFlags&14680064,b|=j.flags&14680064,j.return=d,j=j.sibling;else for(j=d.child;j!==null;)$|=j.lanes|j.childLanes,b|=j.subtreeFlags,b|=j.flags,j.return=d,j=j.sibling;return d.subtreeFlags|=b,d.childLanes=$,g}function Fj(d,g,$){var b=g.pendingProps;switch(wg(g),g.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return S(g),null;case 1:return Zf(g.type)&&$f(),S(g),null;case 3:return b=g.stateNode,Jh(),E(Wf),E(H),Oh(),b.pendingContext&&(b.context=b.pendingContext,b.pendingContext=null),(d===null||d.child===null)&&(Gg(g)?g.flags|=4:d===null||d.memoizedState.isDehydrated&&!(g.flags&256)||(g.flags|=1024,zg!==null&&(Gj(zg),zg=null))),Bj(d,g),S(g),null;case 5:Lh(g);var j=Hh(Gh.current);if($=g.type,d!==null&&g.stateNode!=null)Cj(d,g,$,b,j),d.ref!==g.ref&&(g.flags|=512,g.flags|=2097152);else{if(!b){if(g.stateNode===null)throw Error(p$1(166));return S(g),null}if(d=Hh(Eh.current),Gg(g)){b=g.stateNode,$=g.type;var _e=g.memoizedProps;switch(b[Of]=g,b[Pf]=_e,d=(g.mode&1)!==0,$){case"dialog":D("cancel",b),D("close",b);break;case"iframe":case"object":case"embed":D("load",b);break;case"video":case"audio":for(j=0;j<\/script>",d=d.removeChild(d.firstChild)):typeof b.is=="string"?d=et.createElement($,{is:b.is}):(d=et.createElement($),$==="select"&&(et=d,b.multiple?et.multiple=!0:b.size&&(et.size=b.size))):d=et.createElementNS(d,$),d[Of]=g,d[Pf]=b,Aj(d,g,!1,!1),g.stateNode=d;e:{switch(et=vb($,b),$){case"dialog":D("cancel",d),D("close",d),j=b;break;case"iframe":case"object":case"embed":D("load",d),j=b;break;case"video":case"audio":for(j=0;jHj&&(g.flags|=128,b=!0,Ej(_e,!1),g.lanes=4194304)}else{if(!b)if(d=Mh(et),d!==null){if(g.flags|=128,b=!0,$=d.updateQueue,$!==null&&(g.updateQueue=$,g.flags|=4),Ej(_e,!0),_e.tail===null&&_e.tailMode==="hidden"&&!et.alternate&&!I)return S(g),null}else 2*B()-_e.renderingStartTime>Hj&&$!==1073741824&&(g.flags|=128,b=!0,Ej(_e,!1),g.lanes=4194304);_e.isBackwards?(et.sibling=g.child,g.child=et):($=_e.last,$!==null?$.sibling=et:g.child=et,_e.last=et)}return _e.tail!==null?(g=_e.tail,_e.rendering=g,_e.tail=g.sibling,_e.renderingStartTime=B(),g.sibling=null,$=M.current,G(M,b?$&1|2:$&1),g):(S(g),null);case 22:case 23:return Ij(),b=g.memoizedState!==null,d!==null&&d.memoizedState!==null!==b&&(g.flags|=8192),b&&g.mode&1?gj&1073741824&&(S(g),g.subtreeFlags&6&&(g.flags|=8192)):S(g),null;case 24:return null;case 25:return null}throw Error(p$1(156,g.tag))}function Jj(d,g){switch(wg(g),g.tag){case 1:return Zf(g.type)&&$f(),d=g.flags,d&65536?(g.flags=d&-65537|128,g):null;case 3:return Jh(),E(Wf),E(H),Oh(),d=g.flags,d&65536&&!(d&128)?(g.flags=d&-65537|128,g):null;case 5:return Lh(g),null;case 13:if(E(M),d=g.memoizedState,d!==null&&d.dehydrated!==null){if(g.alternate===null)throw Error(p$1(340));Ig()}return d=g.flags,d&65536?(g.flags=d&-65537|128,g):null;case 19:return E(M),null;case 4:return Jh(),null;case 10:return Rg(g.type._context),null;case 22:case 23:return Ij(),null;case 24:return null;default:return null}}var Kj=!1,U=!1,Lj=typeof WeakSet=="function"?WeakSet:Set,V=null;function Mj(d,g){var $=d.ref;if($!==null)if(typeof $=="function")try{$(null)}catch(b){W(d,g,b)}else $.current=null}function Nj(d,g,$){try{$()}catch(b){W(d,g,b)}}var Oj=!1;function Pj(d,g){if(Cf=dd,d=Me(),Ne(d)){if("selectionStart"in d)var $={start:d.selectionStart,end:d.selectionEnd};else e:{$=($=d.ownerDocument)&&$.defaultView||window;var b=$.getSelection&&$.getSelection();if(b&&b.rangeCount!==0){$=b.anchorNode;var j=b.anchorOffset,_e=b.focusNode;b=b.focusOffset;try{$.nodeType,_e.nodeType}catch{$=null;break e}var et=0,tt=-1,nt=-1,rt=0,it=0,st=d,ut=null;t:for(;;){for(var at;st!==$||j!==0&&st.nodeType!==3||(tt=et+j),st!==_e||b!==0&&st.nodeType!==3||(nt=et+b),st.nodeType===3&&(et+=st.nodeValue.length),(at=st.firstChild)!==null;)ut=st,st=at;for(;;){if(st===d)break t;if(ut===$&&++rt===j&&(tt=et),ut===_e&&++it===b&&(nt=et),(at=st.nextSibling)!==null)break;st=ut,ut=st.parentNode}st=at}$=tt===-1||nt===-1?null:{start:tt,end:nt}}else $=null}$=$||{start:0,end:0}}else $=null;for(Df={focusedElem:d,selectionRange:$},dd=!1,V=g;V!==null;)if(g=V,d=g.child,(g.subtreeFlags&1028)!==0&&d!==null)d.return=g,V=d;else for(;V!==null;){g=V;try{var ht=g.alternate;if(g.flags&1024)switch(g.tag){case 0:case 11:case 15:break;case 1:if(ht!==null){var ct=ht.memoizedProps,vt=ht.memoizedState,ft=g.stateNode,gt=ft.getSnapshotBeforeUpdate(g.elementType===g.type?ct:Lg(g.type,ct),vt);ft.__reactInternalSnapshotBeforeUpdate=gt}break;case 3:var pt=g.stateNode.containerInfo;pt.nodeType===1?pt.textContent="":pt.nodeType===9&&pt.documentElement&&pt.removeChild(pt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$1(163))}}catch(yt){W(g,g.return,yt)}if(d=g.sibling,d!==null){d.return=g.return,V=d;break}V=g.return}return ht=Oj,Oj=!1,ht}function Qj(d,g,$){var b=g.updateQueue;if(b=b!==null?b.lastEffect:null,b!==null){var j=b=b.next;do{if((j.tag&d)===d){var _e=j.destroy;j.destroy=void 0,_e!==void 0&&Nj(g,$,_e)}j=j.next}while(j!==b)}}function Rj(d,g){if(g=g.updateQueue,g=g!==null?g.lastEffect:null,g!==null){var $=g=g.next;do{if(($.tag&d)===d){var b=$.create;$.destroy=b()}$=$.next}while($!==g)}}function Sj(d){var g=d.ref;if(g!==null){var $=d.stateNode;switch(d.tag){case 5:d=$;break;default:d=$}typeof g=="function"?g(d):g.current=d}}function Tj(d){var g=d.alternate;g!==null&&(d.alternate=null,Tj(g)),d.child=null,d.deletions=null,d.sibling=null,d.tag===5&&(g=d.stateNode,g!==null&&(delete g[Of],delete g[Pf],delete g[of],delete g[Qf],delete g[Rf])),d.stateNode=null,d.return=null,d.dependencies=null,d.memoizedProps=null,d.memoizedState=null,d.pendingProps=null,d.stateNode=null,d.updateQueue=null}function Uj(d){return d.tag===5||d.tag===3||d.tag===4}function Vj(d){e:for(;;){for(;d.sibling===null;){if(d.return===null||Uj(d.return))return null;d=d.return}for(d.sibling.return=d.return,d=d.sibling;d.tag!==5&&d.tag!==6&&d.tag!==18;){if(d.flags&2||d.child===null||d.tag===4)continue e;d.child.return=d,d=d.child}if(!(d.flags&2))return d.stateNode}}function Wj(d,g,$){var b=d.tag;if(b===5||b===6)d=d.stateNode,g?$.nodeType===8?$.parentNode.insertBefore(d,g):$.insertBefore(d,g):($.nodeType===8?(g=$.parentNode,g.insertBefore(d,$)):(g=$,g.appendChild(d)),$=$._reactRootContainer,$!=null||g.onclick!==null||(g.onclick=Bf));else if(b!==4&&(d=d.child,d!==null))for(Wj(d,g,$),d=d.sibling;d!==null;)Wj(d,g,$),d=d.sibling}function Xj(d,g,$){var b=d.tag;if(b===5||b===6)d=d.stateNode,g?$.insertBefore(d,g):$.appendChild(d);else if(b!==4&&(d=d.child,d!==null))for(Xj(d,g,$),d=d.sibling;d!==null;)Xj(d,g,$),d=d.sibling}var X=null,Yj=!1;function Zj(d,g,$){for($=$.child;$!==null;)ak(d,g,$),$=$.sibling}function ak(d,g,$){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,$)}catch{}switch($.tag){case 5:U||Mj($,g);case 6:var b=X,j=Yj;X=null,Zj(d,g,$),X=b,Yj=j,X!==null&&(Yj?(d=X,$=$.stateNode,d.nodeType===8?d.parentNode.removeChild($):d.removeChild($)):X.removeChild($.stateNode));break;case 18:X!==null&&(Yj?(d=X,$=$.stateNode,d.nodeType===8?Kf(d.parentNode,$):d.nodeType===1&&Kf(d,$),bd(d)):Kf(X,$.stateNode));break;case 4:b=X,j=Yj,X=$.stateNode.containerInfo,Yj=!0,Zj(d,g,$),X=b,Yj=j;break;case 0:case 11:case 14:case 15:if(!U&&(b=$.updateQueue,b!==null&&(b=b.lastEffect,b!==null))){j=b=b.next;do{var _e=j,et=_e.destroy;_e=_e.tag,et!==void 0&&(_e&2||_e&4)&&Nj($,g,et),j=j.next}while(j!==b)}Zj(d,g,$);break;case 1:if(!U&&(Mj($,g),b=$.stateNode,typeof b.componentWillUnmount=="function"))try{b.props=$.memoizedProps,b.state=$.memoizedState,b.componentWillUnmount()}catch(tt){W($,g,tt)}Zj(d,g,$);break;case 21:Zj(d,g,$);break;case 22:$.mode&1?(U=(b=U)||$.memoizedState!==null,Zj(d,g,$),U=b):Zj(d,g,$);break;default:Zj(d,g,$)}}function bk(d){var g=d.updateQueue;if(g!==null){d.updateQueue=null;var $=d.stateNode;$===null&&($=d.stateNode=new Lj),g.forEach(function(b){var j=ck.bind(null,d,b);$.has(b)||($.add(b),b.then(j,j))})}}function dk(d,g){var $=g.deletions;if($!==null)for(var b=0;b<$.length;b++){var j=$[b];try{var _e=d,et=g,tt=et;e:for(;tt!==null;){switch(tt.tag){case 5:X=tt.stateNode,Yj=!1;break e;case 3:X=tt.stateNode.containerInfo,Yj=!0;break e;case 4:X=tt.stateNode.containerInfo,Yj=!0;break e}tt=tt.return}if(X===null)throw Error(p$1(160));ak(_e,et,j),X=null,Yj=!1;var nt=j.alternate;nt!==null&&(nt.return=null),j.return=null}catch(rt){W(j,g,rt)}}if(g.subtreeFlags&12854)for(g=g.child;g!==null;)ek(g,d),g=g.sibling}function ek(d,g){var $=d.alternate,b=d.flags;switch(d.tag){case 0:case 11:case 14:case 15:if(dk(g,d),fk(d),b&4){try{Qj(3,d,d.return),Rj(3,d)}catch(ct){W(d,d.return,ct)}try{Qj(5,d,d.return)}catch(ct){W(d,d.return,ct)}}break;case 1:dk(g,d),fk(d),b&512&&$!==null&&Mj($,$.return);break;case 5:if(dk(g,d),fk(d),b&512&&$!==null&&Mj($,$.return),d.flags&32){var j=d.stateNode;try{ob(j,"")}catch(ct){W(d,d.return,ct)}}if(b&4&&(j=d.stateNode,j!=null)){var _e=d.memoizedProps,et=$!==null?$.memoizedProps:_e,tt=d.type,nt=d.updateQueue;if(d.updateQueue=null,nt!==null)try{tt==="input"&&_e.type==="radio"&&_e.name!=null&&ab(j,_e),vb(tt,et);var rt=vb(tt,_e);for(et=0;etj&&(j=et),b&=~_e}if(b=j,b=B()-b,b=(120>b?120:480>b?480:1080>b?1080:1920>b?1920:3e3>b?3e3:4320>b?4320:1960*mk(b/1960))-b,10d?16:d,xk===null)var b=!1;else{if(d=xk,xk=null,yk=0,K&6)throw Error(p$1(331));var j=K;for(K|=4,V=d.current;V!==null;){var _e=V,et=_e.child;if(V.flags&16){var tt=_e.deletions;if(tt!==null){for(var nt=0;ntB()-gk?Lk(d,0):sk|=$),Ek(d,g)}function Zk(d,g){g===0&&(d.mode&1?(g=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):g=1);var $=L();d=Zg(d,g),d!==null&&(Ac(d,g,$),Ek(d,$))}function vj(d){var g=d.memoizedState,$=0;g!==null&&($=g.retryLane),Zk(d,$)}function ck(d,g){var $=0;switch(d.tag){case 13:var b=d.stateNode,j=d.memoizedState;j!==null&&($=j.retryLane);break;case 19:b=d.stateNode;break;default:throw Error(p$1(314))}b!==null&&b.delete(g),Zk(d,$)}var Wk;Wk=function(d,g,$){if(d!==null)if(d.memoizedProps!==g.pendingProps||Wf.current)Ug=!0;else{if(!(d.lanes&$)&&!(g.flags&128))return Ug=!1,zj(d,g,$);Ug=!!(d.flags&131072)}else Ug=!1,I&&g.flags&1048576&&ug(g,ng,g.index);switch(g.lanes=0,g.tag){case 2:var b=g.type;jj(d,g),d=g.pendingProps;var j=Yf(g,H.current);Tg(g,$),j=Xh(null,g,b,d,j,$);var _e=bi();return g.flags|=1,typeof j=="object"&&j!==null&&typeof j.render=="function"&&j.$$typeof===void 0?(g.tag=1,g.memoizedState=null,g.updateQueue=null,Zf(b)?(_e=!0,cg(g)):_e=!1,g.memoizedState=j.state!==null&&j.state!==void 0?j.state:null,ah(g),j.updater=nh,g.stateNode=j,j._reactInternals=g,rh(g,b,d,$),g=kj(null,g,b,!0,_e,$)):(g.tag=0,I&&_e&&vg(g),Yi(null,g,j,$),g=g.child),g;case 16:b=g.elementType;e:{switch(jj(d,g),d=g.pendingProps,j=b._init,b=j(b._payload),g.type=b,j=g.tag=$k(b),d=Lg(b,d),j){case 0:g=dj(null,g,b,d,$);break e;case 1:g=ij(null,g,b,d,$);break e;case 11:g=Zi(null,g,b,d,$);break e;case 14:g=aj(null,g,b,Lg(b.type,d),$);break e}throw Error(p$1(306,b,""))}return g;case 0:return b=g.type,j=g.pendingProps,j=g.elementType===b?j:Lg(b,j),dj(d,g,b,j,$);case 1:return b=g.type,j=g.pendingProps,j=g.elementType===b?j:Lg(b,j),ij(d,g,b,j,$);case 3:e:{if(lj(g),d===null)throw Error(p$1(387));b=g.pendingProps,_e=g.memoizedState,j=_e.element,bh(d,g),gh(g,b,null,$);var et=g.memoizedState;if(b=et.element,_e.isDehydrated)if(_e={element:b,isDehydrated:!1,cache:et.cache,pendingSuspenseBoundaries:et.pendingSuspenseBoundaries,transitions:et.transitions},g.updateQueue.baseState=_e,g.memoizedState=_e,g.flags&256){j=Ki(Error(p$1(423)),g),g=mj(d,g,b,$,j);break e}else if(b!==j){j=Ki(Error(p$1(424)),g),g=mj(d,g,b,$,j);break e}else for(yg=Lf(g.stateNode.containerInfo.firstChild),xg=g,I=!0,zg=null,$=Ch(g,null,b,$),g.child=$;$;)$.flags=$.flags&-3|4096,$=$.sibling;else{if(Ig(),b===j){g=$i(d,g,$);break e}Yi(d,g,b,$)}g=g.child}return g;case 5:return Kh(g),d===null&&Eg(g),b=g.type,j=g.pendingProps,_e=d!==null?d.memoizedProps:null,et=j.children,Ef(b,j)?et=null:_e!==null&&Ef(b,_e)&&(g.flags|=32),hj(d,g),Yi(d,g,et,$),g.child;case 6:return d===null&&Eg(g),null;case 13:return pj(d,g,$);case 4:return Ih(g,g.stateNode.containerInfo),b=g.pendingProps,d===null?g.child=Bh(g,null,b,$):Yi(d,g,b,$),g.child;case 11:return b=g.type,j=g.pendingProps,j=g.elementType===b?j:Lg(b,j),Zi(d,g,b,j,$);case 7:return Yi(d,g,g.pendingProps,$),g.child;case 8:return Yi(d,g,g.pendingProps.children,$),g.child;case 12:return Yi(d,g,g.pendingProps.children,$),g.child;case 10:e:{if(b=g.type._context,j=g.pendingProps,_e=g.memoizedProps,et=j.value,G(Mg,b._currentValue),b._currentValue=et,_e!==null)if(He(_e.value,et)){if(_e.children===j.children&&!Wf.current){g=$i(d,g,$);break e}}else for(_e=g.child,_e!==null&&(_e.return=g);_e!==null;){var tt=_e.dependencies;if(tt!==null){et=_e.child;for(var nt=tt.firstContext;nt!==null;){if(nt.context===b){if(_e.tag===1){nt=ch(-1,$&-$),nt.tag=2;var rt=_e.updateQueue;if(rt!==null){rt=rt.shared;var it=rt.pending;it===null?nt.next=nt:(nt.next=it.next,it.next=nt),rt.pending=nt}}_e.lanes|=$,nt=_e.alternate,nt!==null&&(nt.lanes|=$),Sg(_e.return,$,g),tt.lanes|=$;break}nt=nt.next}}else if(_e.tag===10)et=_e.type===g.type?null:_e.child;else if(_e.tag===18){if(et=_e.return,et===null)throw Error(p$1(341));et.lanes|=$,tt=et.alternate,tt!==null&&(tt.lanes|=$),Sg(et,$,g),et=_e.sibling}else et=_e.child;if(et!==null)et.return=_e;else for(et=_e;et!==null;){if(et===g){et=null;break}if(_e=et.sibling,_e!==null){_e.return=et.return,et=_e;break}et=et.return}_e=et}Yi(d,g,j.children,$),g=g.child}return g;case 9:return j=g.type,b=g.pendingProps.children,Tg(g,$),j=Vg(j),b=b(j),g.flags|=1,Yi(d,g,b,$),g.child;case 14:return b=g.type,j=Lg(b,g.pendingProps),j=Lg(b.type,j),aj(d,g,b,j,$);case 15:return cj(d,g,g.type,g.pendingProps,$);case 17:return b=g.type,j=g.pendingProps,j=g.elementType===b?j:Lg(b,j),jj(d,g),g.tag=1,Zf(b)?(d=!0,cg(g)):d=!1,Tg(g,$),ph(g,b,j),rh(g,b,j,$),kj(null,g,b,!0,d,$);case 19:return yj(d,g,$);case 22:return ej(d,g,$)}throw Error(p$1(156,g.tag))};function Gk(d,g){return ac(d,g)}function al(d,g,$,b){this.tag=d,this.key=$,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=g,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=b,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(d,g,$,b){return new al(d,g,$,b)}function bj(d){return d=d.prototype,!(!d||!d.isReactComponent)}function $k(d){if(typeof d=="function")return bj(d)?1:0;if(d!=null){if(d=d.$$typeof,d===Da)return 11;if(d===Ga)return 14}return 2}function wh(d,g){var $=d.alternate;return $===null?($=Bg(d.tag,g,d.key,d.mode),$.elementType=d.elementType,$.type=d.type,$.stateNode=d.stateNode,$.alternate=d,d.alternate=$):($.pendingProps=g,$.type=d.type,$.flags=0,$.subtreeFlags=0,$.deletions=null),$.flags=d.flags&14680064,$.childLanes=d.childLanes,$.lanes=d.lanes,$.child=d.child,$.memoizedProps=d.memoizedProps,$.memoizedState=d.memoizedState,$.updateQueue=d.updateQueue,g=d.dependencies,$.dependencies=g===null?null:{lanes:g.lanes,firstContext:g.firstContext},$.sibling=d.sibling,$.index=d.index,$.ref=d.ref,$}function yh(d,g,$,b,j,_e){var et=2;if(b=d,typeof d=="function")bj(d)&&(et=1);else if(typeof d=="string")et=5;else e:switch(d){case ya:return Ah($.children,j,_e,g);case za:et=8,j|=8;break;case Aa:return d=Bg(12,$,g,j|2),d.elementType=Aa,d.lanes=_e,d;case Ea:return d=Bg(13,$,g,j),d.elementType=Ea,d.lanes=_e,d;case Fa:return d=Bg(19,$,g,j),d.elementType=Fa,d.lanes=_e,d;case Ia:return qj($,j,_e,g);default:if(typeof d=="object"&&d!==null)switch(d.$$typeof){case Ba:et=10;break e;case Ca:et=9;break e;case Da:et=11;break e;case Ga:et=14;break e;case Ha:et=16,b=null;break e}throw Error(p$1(130,d==null?d:typeof d,""))}return g=Bg(et,$,g,j),g.elementType=d,g.type=b,g.lanes=_e,g}function Ah(d,g,$,b){return d=Bg(7,d,b,g),d.lanes=$,d}function qj(d,g,$,b){return d=Bg(22,d,b,g),d.elementType=Ia,d.lanes=$,d.stateNode={isHidden:!1},d}function xh(d,g,$){return d=Bg(6,d,null,g),d.lanes=$,d}function zh(d,g,$){return g=Bg(4,d.children!==null?d.children:[],d.key,g),g.lanes=$,g.stateNode={containerInfo:d.containerInfo,pendingChildren:null,implementation:d.implementation},g}function bl(d,g,$,b,j){this.tag=g,this.containerInfo=d,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zc(0),this.expirationTimes=zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.identifierPrefix=b,this.onRecoverableError=j,this.mutableSourceEagerHydrationData=null}function cl(d,g,$,b,j,_e,et,tt,nt){return d=new bl(d,g,$,tt,nt),g===1?(g=1,_e===!0&&(g|=8)):g=0,_e=Bg(3,null,null,g),d.current=_e,_e.stateNode=d,_e.memoizedState={element:b,isDehydrated:$,cache:null,transitions:null,pendingSuspenseBoundaries:null},ah(_e),d}function dl(d,g,$){var b=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(g)}catch($){console.error($)}}g(),d.exports=reactDom_production_min})(reactDom);var m$2=reactDomExports;client.createRoot=m$2.createRoot,client.hydrateRoot=m$2.hydrateRoot;const App$1="",navLinkClass=({isActive:d,isPending:g})=>d?"active":g?"pending":"";function App(){return jsxRuntimeExports.jsxs("div",{className:"App",children:[jsxRuntimeExports.jsxs("div",{className:"flex-row nav",children:[jsxRuntimeExports.jsx("div",{className:"nav-item",children:jsxRuntimeExports.jsx(NavLink,{className:navLinkClass,to:"draw/evaporating-cloud",children:"Evaporating Cloud"})}),"| ",jsxRuntimeExports.jsx("div",{className:"nav-item",children:jsxRuntimeExports.jsx(NavLink,{className:navLinkClass,to:"draw/goal-tree",children:"Goal Tree"})}),"| ",jsxRuntimeExports.jsx("div",{className:"nav-item",children:jsxRuntimeExports.jsx(NavLink,{className:navLinkClass,to:"draw/problem-tree",children:"Problem Tree"})}),"| ",jsxRuntimeExports.jsx("div",{className:"nav-item",children:jsxRuntimeExports.jsx(NavLink,{className:navLinkClass,to:"about",children:"About"})})]}),jsxRuntimeExports.jsx(Outlet,{})]})}const index$1="";function ErrorPage(){const d=useRouteError();return console.error(d),jsxRuntimeExports.jsxs("div",{id:"error-page",children:[jsxRuntimeExports.jsx("h1",{children:"Oops!"}),jsxRuntimeExports.jsx("p",{children:"Sorry, an unexpected error has occurred."}),jsxRuntimeExports.jsx("p",{children:jsxRuntimeExports.jsx("i",{children:d.statusText||d.message})})]})}const Editor=({onChange:d,placeholder:g="",rows:$=20,disabled:b=!1,autoFocus:j=!1,text:_e,setText:et,error:tt})=>{React.useEffect(()=>{d(_e)},[_e]);const nt=rt=>{et(rt.target.value),d(rt.target.value)};return jsxRuntimeExports.jsxs("div",{className:"editor",children:[jsxRuntimeExports.jsx("textarea",{style:{width:"100%",height:"100%",resize:"none"},rows:$,value:_e,onChange:nt,placeholder:g,disabled:b,autoFocus:j}),jsxRuntimeExports.jsx("p",{className:`edit-result ${tt?"error":""}`,children:tt})]})},wrapLines=(d,g)=>{const $=d.split(" "),b=[];let j="";return $.forEach((_e,et)=>{j.length+_e.length>g&&(b.push(j),j=""),j+=_e+" ",et===$.length-1&&b.push(j)}),b};function computeResizeTransform(d,g,$,b){const j=d.getBBox({stroke:!0,fill:!0,markers:!0}),_e=j.width+$,et=j.height+b;console.log("bounding h w: ",et,_e);const tt=g.clientWidth,nt=g.clientHeight;console.log("container h w: ",nt,tt);const rt=Math.min(100/_e,100/et);return console.log("zoomScale: ",rt),`scale(${rt},${rt})`}function saveSvgUrl(d){const g=d.outerHTML,$=`\r +`,b=new Blob([$,g],{type:"image/svg+xml;charset=utf-8"});return URL.createObjectURL(b)}const intermediatePoint=(d,g,$)=>{const b=g.x-d.x,j=g.y-d.y,_e=Math.sqrt(b*b+j*j),et=$/_e;return{x:d.x+b*et,y:d.y+j*et}};function midPoint(d,g){return{x:(d.x+g.x)/2,y:(d.y+g.y)/2}}const Injection=({text:d,edge:g,dx:$,dy:b})=>{if(!d)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});const j=wrapLines(d,35),_e=midPoint(g.start,g.end),et=16,tt=_e.x+$,nt=tt-75,rt=_e.y+b,it=b/Math.abs(b),st=rt+j.length*et+7,at=it===1?rt:st,ht=tt;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("text",{x:nt,y:rt,children:j.map((ct,vt)=>jsxRuntimeExports.jsx("tspan",{x:nt,dy:et,children:ct},vt))}),jsxRuntimeExports.jsx("line",{x1:ht,y1:at,x2:_e.x,y2:_e.y,stroke:"#000",strokeDasharray:"4 5",strokeWidth:"2"})]})},CloudEdge=({edge:d})=>jsxRuntimeExports.jsx("line",{x1:d.adjStart.x,y1:d.adjStart.y,x2:d.end.x,y2:d.end.y,stroke:"#000",strokeWidth:"3",markerStart:"url(#startarrow)"}),CloudNode=({text:d,x:g,y:$,width:b,height:j,annotation:_e})=>{const et=wrapLines(d,20),tt=16,nt=12,rt=et.length*tt,it=$+j/2-rt/2-4,st=g+nt;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("rect",{x:g,y:$,rx:"10",ry:"10",width:b,height:j}),jsxRuntimeExports.jsx("text",{x:st,y:it,children:et.map((ut,at)=>jsxRuntimeExports.jsx("tspan",{x:st,dy:tt,children:ut},at))}),jsxRuntimeExports.jsx("circle",{cx:g,cy:$,r:"10",style:{fill:"white",stroke:"black",strokeWidth:"2px"}}),jsxRuntimeExports.jsx("text",{x:g-4,y:$+4,children:_e})]})},drawCloud=d=>{const g={A:"",B:"",C:"",D:"","D'":""},$=new Map;d.statements.filter(_t=>_t.type==="node").forEach(_t=>{g[_t.id]=_t.text}),d.statements.forEach(_t=>{if(_t.type==="edge"){const Tt=_t.fromIds[0],kt=_t.toId,Mt=Tt`${_t.x},${_t.y}`).join(" "),Ct=` + svg { + font-family: "trebuchet ms", verdana, arial, sans-serif; + font-size: 13px; + } + svg text { + fill: black; + } + svg text.annotation { + font-weight: bold; + } + svg rect { + fill: white; + stroke: black; + stroke-width: 2; + } + `;return jsxRuntimeExports.jsxs("svg",{id:"cloudSvg",width:"100%",height:"100%",version:"1.1",preserveAspectRatio:"xMinYMin",viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("style",{children:Ct}),jsxRuntimeExports.jsxs("g",{id:"cloudSvgInner",children:[jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:"0",refY:"1.75",orient:"auto",children:jsxRuntimeExports.jsx("polygon",{points:"0 0, 10 3.5, 0 7",transform:"scale(0.5 0.5)"})}),jsxRuntimeExports.jsx("marker",{id:"startarrow",markerWidth:"10",markerHeight:"7",refX:"5",refY:"1.75",orient:"auto",children:jsxRuntimeExports.jsx("polygon",{points:"10 0, 10 7, 0 3.5",fill:"",transform:"scale(0.5 0.5)"})}),jsxRuntimeExports.jsx("marker",{id:"endarrow",markerWidth:"10",markerHeight:"7",refX:"0",refY:"1.75",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntimeExports.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"",transform:"scale(0.5 0.5)"})})]}),jsxRuntimeExports.jsx(CloudNode,{annotation:"A",text:g.A,x:st.x,y:st.y,width:rt,height:it}),jsxRuntimeExports.jsx(CloudNode,{annotation:"B",text:g.B,x:ut.x,y:ut.y,width:rt,height:it}),jsxRuntimeExports.jsx(CloudNode,{annotation:"C",text:g.C,x:at.x,y:at.y,width:rt,height:it}),jsxRuntimeExports.jsx(CloudNode,{annotation:"D",text:g.D,x:ht.x,y:ht.y,width:rt,height:it}),jsxRuntimeExports.jsx(CloudNode,{annotation:"D'",text:g["D'"],x:ct.x,y:ct.y,width:rt,height:it}),jsxRuntimeExports.jsx(CloudEdge,{edge:vt}),jsxRuntimeExports.jsx(CloudEdge,{edge:ft}),jsxRuntimeExports.jsx(CloudEdge,{edge:gt}),jsxRuntimeExports.jsx(CloudEdge,{edge:pt}),jsxRuntimeExports.jsx(Injection,{text:$["A-B"],edge:vt,dx:-100,dy:-125}),jsxRuntimeExports.jsx(Injection,{text:$["A-C"],edge:ft,dx:-100,dy:125}),jsxRuntimeExports.jsx(Injection,{text:$["B-D"],edge:gt,dx:0,dy:-75}),jsxRuntimeExports.jsx(Injection,{text:$["C-D'"],edge:pt,dx:0,dy:75}),jsxRuntimeExports.jsx(Injection,{text:$["D-D'"],edge:Bt,dx:120,dy:20}),jsxRuntimeExports.jsx("polyline",{points:Ot,markerStart:"url(#startarrow)",markerEnd:"url(#endarrow)",style:{fill:"none",stroke:"black",strokeWidth:3}})]})]})};function createEdge(d,g){const $={start:{x:d.x+d.w,y:d.y+d.h/2},adjStart:{x:0,y:0},end:{x:g.x,y:g.y+g.h/2}};return $.adjStart=intermediatePoint($.start,$.end,16),$}function nodeBottomCenterPont(d){return{x:d.x+d.w/2,y:d.y+d.h}}function nodeTopCenterPont(d){return{x:d.x+d.w/2,y:d.y}}function displacePoint(d,g,$){return{x:d.x+g,y:d.y+$}}function Cloud({ast:d,setSvgElem:g}){return d&&React.useEffect(()=>{const $=document.getElementById("cloudSvgInner"),b=document.getElementById("cloudSvgContainer");$==null||$.setAttribute("transform",computeResizeTransform($,b,10,0)+", translate(-10, 0)"),g(document.getElementById("cloudSvg"))},[d]),jsxRuntimeExports.jsxs("div",{id:"cloudSvgContainer",style:{width:"100%",height:"500"},children:[d&&drawCloud(d),";"]})}var noop$2={value:()=>{}};function dispatch(){for(var d=0,g=arguments.length,$={},b;d=0&&(b=$.slice(j+1),$=$.slice(0,j)),$&&!g.hasOwnProperty($))throw new Error("unknown type: "+$);return{type:$,name:b}})}Dispatch.prototype=dispatch.prototype={constructor:Dispatch,on:function(d,g){var $=this._,b=parseTypenames$1(d+"",$),j,_e=-1,et=b.length;if(arguments.length<2){for(;++_e0)for(var $=new Array(j),b=0,j,_e;b=0&&(g=d.slice(0,$))!=="xmlns"&&(d=d.slice($+1)),namespaces.hasOwnProperty(g)?{space:namespaces[g],local:d}:d}function creatorInherit(d){return function(){var g=this.ownerDocument,$=this.namespaceURI;return $===xhtml&&g.documentElement.namespaceURI===xhtml?g.createElement(d):g.createElementNS($,d)}}function creatorFixed(d){return function(){return this.ownerDocument.createElementNS(d.space,d.local)}}function creator(d){var g=namespace(d);return(g.local?creatorFixed:creatorInherit)(g)}function none(){}function selector(d){return d==null?none:function(){return this.querySelector(d)}}function selection_select(d){typeof d!="function"&&(d=selector(d));for(var g=this._groups,$=g.length,b=new Array($),j=0;j<$;++j)for(var _e=g[j],et=_e.length,tt=b[j]=new Array(et),nt,rt,it=0;it=pt&&(pt=gt+1);!(At=vt[pt])&&++pt=0;)(et=b[j])&&(_e&&et.compareDocumentPosition(_e)^4&&_e.parentNode.insertBefore(et,_e),_e=et);return this}function selection_sort(d){d||(d=ascending);function g(st,ut){return st&&ut?d(st.__data__,ut.__data__):!st-!ut}for(var $=this._groups,b=$.length,j=new Array(b),_e=0;_eg?1:d>=g?0:NaN}function selection_call(){var d=arguments[0];return arguments[0]=this,d.apply(null,arguments),this}function selection_nodes(){return Array.from(this)}function selection_node(){for(var d=this._groups,g=0,$=d.length;g<$;++g)for(var b=d[g],j=0,_e=b.length;j<_e;++j){var et=b[j];if(et)return et}return null}function selection_size(){let d=0;for(const g of this)++d;return d}function selection_empty(){return!this.node()}function selection_each(d){for(var g=this._groups,$=0,b=g.length;$1?this.each((g==null?styleRemove$1:typeof g=="function"?styleFunction$1:styleConstant$1)(d,g,$??"")):styleValue(this.node(),d)}function styleValue(d,g){return d.style.getPropertyValue(g)||defaultView(d).getComputedStyle(d,null).getPropertyValue(g)}function propertyRemove(d){return function(){delete this[d]}}function propertyConstant(d,g){return function(){this[d]=g}}function propertyFunction(d,g){return function(){var $=g.apply(this,arguments);$==null?delete this[d]:this[d]=$}}function selection_property(d,g){return arguments.length>1?this.each((g==null?propertyRemove:typeof g=="function"?propertyFunction:propertyConstant)(d,g)):this.node()[d]}function classArray(d){return d.trim().split(/^|\s+/)}function classList(d){return d.classList||new ClassList(d)}function ClassList(d){this._node=d,this._names=classArray(d.getAttribute("class")||"")}ClassList.prototype={add:function(d){var g=this._names.indexOf(d);g<0&&(this._names.push(d),this._node.setAttribute("class",this._names.join(" ")))},remove:function(d){var g=this._names.indexOf(d);g>=0&&(this._names.splice(g,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(d){return this._names.indexOf(d)>=0}};function classedAdd(d,g){for(var $=classList(d),b=-1,j=g.length;++b=0&&($=g.slice(b+1),g=g.slice(0,b)),{type:g,name:$}})}function onRemove(d){return function(){var g=this.__on;if(g){for(var $=0,b=-1,j=g.length,_e;$>8&15|g>>4&240,g>>4&15|g&240,(g&15)<<4|g&15,1):$===8?rgba(g>>24&255,g>>16&255,g>>8&255,(g&255)/255):$===4?rgba(g>>12&15|g>>8&240,g>>8&15|g>>4&240,g>>4&15|g&240,((g&15)<<4|g&15)/255):null):(g=reRgbInteger.exec(d))?new Rgb(g[1],g[2],g[3],1):(g=reRgbPercent.exec(d))?new Rgb(g[1]*255/100,g[2]*255/100,g[3]*255/100,1):(g=reRgbaInteger.exec(d))?rgba(g[1],g[2],g[3],g[4]):(g=reRgbaPercent.exec(d))?rgba(g[1]*255/100,g[2]*255/100,g[3]*255/100,g[4]):(g=reHslPercent.exec(d))?hsla(g[1],g[2]/100,g[3]/100,1):(g=reHslaPercent.exec(d))?hsla(g[1],g[2]/100,g[3]/100,g[4]):named.hasOwnProperty(d)?rgbn(named[d]):d==="transparent"?new Rgb(NaN,NaN,NaN,0):null}function rgbn(d){return new Rgb(d>>16&255,d>>8&255,d&255,1)}function rgba(d,g,$,b){return b<=0&&(d=g=$=NaN),new Rgb(d,g,$,b)}function rgbConvert(d){return d instanceof Color||(d=color(d)),d?(d=d.rgb(),new Rgb(d.r,d.g,d.b,d.opacity)):new Rgb}function rgb(d,g,$,b){return arguments.length===1?rgbConvert(d):new Rgb(d,g,$,b??1)}function Rgb(d,g,$,b){this.r=+d,this.g=+g,this.b=+$,this.opacity=+b}define(Rgb,rgb,extend(Color,{brighter(d){return d=d==null?brighter:Math.pow(brighter,d),new Rgb(this.r*d,this.g*d,this.b*d,this.opacity)},darker(d){return d=d==null?darker:Math.pow(darker,d),new Rgb(this.r*d,this.g*d,this.b*d,this.opacity)},rgb(){return this},clamp(){return new Rgb(clampi(this.r),clampi(this.g),clampi(this.b),clampa(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:rgb_formatHex,formatHex:rgb_formatHex,formatHex8:rgb_formatHex8,formatRgb:rgb_formatRgb,toString:rgb_formatRgb}));function rgb_formatHex(){return`#${hex$1(this.r)}${hex$1(this.g)}${hex$1(this.b)}`}function rgb_formatHex8(){return`#${hex$1(this.r)}${hex$1(this.g)}${hex$1(this.b)}${hex$1((isNaN(this.opacity)?1:this.opacity)*255)}`}function rgb_formatRgb(){const d=clampa(this.opacity);return`${d===1?"rgb(":"rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${d===1?")":`, ${d})`}`}function clampa(d){return isNaN(d)?1:Math.max(0,Math.min(1,d))}function clampi(d){return Math.max(0,Math.min(255,Math.round(d)||0))}function hex$1(d){return d=clampi(d),(d<16?"0":"")+d.toString(16)}function hsla(d,g,$,b){return b<=0?d=g=$=NaN:$<=0||$>=1?d=g=NaN:g<=0&&(d=NaN),new Hsl(d,g,$,b)}function hslConvert(d){if(d instanceof Hsl)return new Hsl(d.h,d.s,d.l,d.opacity);if(d instanceof Color||(d=color(d)),!d)return new Hsl;if(d instanceof Hsl)return d;d=d.rgb();var g=d.r/255,$=d.g/255,b=d.b/255,j=Math.min(g,$,b),_e=Math.max(g,$,b),et=NaN,tt=_e-j,nt=(_e+j)/2;return tt?(g===_e?et=($-b)/tt+($0&&nt<1?0:et,new Hsl(et,tt,nt,d.opacity)}function hsl(d,g,$,b){return arguments.length===1?hslConvert(d):new Hsl(d,g,$,b??1)}function Hsl(d,g,$,b){this.h=+d,this.s=+g,this.l=+$,this.opacity=+b}define(Hsl,hsl,extend(Color,{brighter(d){return d=d==null?brighter:Math.pow(brighter,d),new Hsl(this.h,this.s,this.l*d,this.opacity)},darker(d){return d=d==null?darker:Math.pow(darker,d),new Hsl(this.h,this.s,this.l*d,this.opacity)},rgb(){var d=this.h%360+(this.h<0)*360,g=isNaN(d)||isNaN(this.s)?0:this.s,$=this.l,b=$+($<.5?$:1-$)*g,j=2*$-b;return new Rgb(hsl2rgb(d>=240?d-240:d+120,j,b),hsl2rgb(d,j,b),hsl2rgb(d<120?d+240:d-120,j,b),this.opacity)},clamp(){return new Hsl(clamph(this.h),clampt(this.s),clampt(this.l),clampa(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const d=clampa(this.opacity);return`${d===1?"hsl(":"hsla("}${clamph(this.h)}, ${clampt(this.s)*100}%, ${clampt(this.l)*100}%${d===1?")":`, ${d})`}`}}));function clamph(d){return d=(d||0)%360,d<0?d+360:d}function clampt(d){return Math.max(0,Math.min(1,d||0))}function hsl2rgb(d,g,$){return(d<60?g+($-g)*d/60:d<180?$:d<240?g+($-g)*(240-d)/60:g)*255}const constant$2=d=>()=>d;function linear(d,g){return function($){return d+$*g}}function exponential(d,g,$){return d=Math.pow(d,$),g=Math.pow(g,$)-d,$=1/$,function(b){return Math.pow(d+b*g,$)}}function gamma(d){return(d=+d)==1?nogamma:function(g,$){return $-g?exponential(g,$,d):constant$2(isNaN(g)?$:g)}}function nogamma(d,g){var $=g-d;return $?linear(d,$):constant$2(isNaN(d)?g:d)}const interpolateRgb=function d(g){var $=gamma(g);function b(j,_e){var et=$((j=rgb(j)).r,(_e=rgb(_e)).r),tt=$(j.g,_e.g),nt=$(j.b,_e.b),rt=nogamma(j.opacity,_e.opacity);return function(it){return j.r=et(it),j.g=tt(it),j.b=nt(it),j.opacity=rt(it),j+""}}return b.gamma=d,b}(1);function interpolateNumber(d,g){return d=+d,g=+g,function($){return d*(1-$)+g*$}}var reA=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,reB=new RegExp(reA.source,"g");function zero(d){return function(){return d}}function one(d){return function(g){return d(g)+""}}function interpolateString(d,g){var $=reA.lastIndex=reB.lastIndex=0,b,j,_e,et=-1,tt=[],nt=[];for(d=d+"",g=g+"";(b=reA.exec(d))&&(j=reB.exec(g));)(_e=j.index)>$&&(_e=g.slice($,_e),tt[et]?tt[et]+=_e:tt[++et]=_e),(b=b[0])===(j=j[0])?tt[et]?tt[et]+=j:tt[++et]=j:(tt[++et]=null,nt.push({i:et,x:interpolateNumber(b,j)})),$=reB.lastIndex;return $180?it+=360:it-rt>180&&(rt+=360),ut.push({i:st.push(j(st)+"rotate(",null,b)-2,x:interpolateNumber(rt,it)})):it&&st.push(j(st)+"rotate("+it+b)}function tt(rt,it,st,ut){rt!==it?ut.push({i:st.push(j(st)+"skewX(",null,b)-2,x:interpolateNumber(rt,it)}):it&&st.push(j(st)+"skewX("+it+b)}function nt(rt,it,st,ut,at,ht){if(rt!==st||it!==ut){var ct=at.push(j(at)+"scale(",null,",",null,")");ht.push({i:ct-4,x:interpolateNumber(rt,st)},{i:ct-2,x:interpolateNumber(it,ut)})}else(st!==1||ut!==1)&&at.push(j(at)+"scale("+st+","+ut+")")}return function(rt,it){var st=[],ut=[];return rt=d(rt),it=d(it),_e(rt.translateX,rt.translateY,it.translateX,it.translateY,st,ut),et(rt.rotate,it.rotate,st,ut),tt(rt.skewX,it.skewX,st,ut),nt(rt.scaleX,rt.scaleY,it.scaleX,it.scaleY,st,ut),rt=it=null,function(at){for(var ht=-1,ct=ut.length,vt;++ht=0&&d._call.call(void 0,g),d=d._next;--frame}function wake(){clockNow=(clockLast=clock.now())+clockSkew,frame=timeout$1=0;try{timerFlush()}finally{frame=0,nap(),clockNow=0}}function poke(){var d=clock.now(),g=d-clockLast;g>pokeDelay&&(clockSkew-=g,clockLast=d)}function nap(){for(var d,g=taskHead,$,b=1/0;g;)g._call?(b>g._time&&(b=g._time),d=g,g=g._next):($=g._next,g._next=null,g=d?d._next=$:taskHead=$);taskTail=d,sleep(b)}function sleep(d){if(!frame){timeout$1&&(timeout$1=clearTimeout(timeout$1));var g=d-clockNow;g>24?(d<1/0&&(timeout$1=setTimeout(wake,d-clock.now()-clockSkew)),interval&&(interval=clearInterval(interval))):(interval||(clockLast=clock.now(),interval=setInterval(poke,pokeDelay)),frame=1,setFrame(wake))}}function timeout(d,g,$){var b=new Timer;return g=g==null?0:+g,b.restart(j=>{b.stop(),d(j+g)},g,$),b}var emptyOn=dispatch("start","end","cancel","interrupt"),emptyTween=[],CREATED=0,SCHEDULED=1,STARTING=2,STARTED=3,RUNNING=4,ENDING=5,ENDED=6;function schedule(d,g,$,b,j,_e){var et=d.__transition;if(!et)d.__transition={};else if($ in et)return;create(d,$,{name:g,index:b,group:j,on:emptyOn,tween:emptyTween,time:_e.time,delay:_e.delay,duration:_e.duration,ease:_e.ease,timer:null,state:CREATED})}function init(d,g){var $=get$1(d,g);if($.state>CREATED)throw new Error("too late; already scheduled");return $}function set(d,g){var $=get$1(d,g);if($.state>STARTED)throw new Error("too late; already running");return $}function get$1(d,g){var $=d.__transition;if(!$||!($=$[g]))throw new Error("transition not found");return $}function create(d,g,$){var b=d.__transition,j;b[g]=$,$.timer=timer(_e,0,$.time);function _e(rt){$.state=SCHEDULED,$.timer.restart(et,$.delay,$.time),$.delay<=rt&&et(rt-$.delay)}function et(rt){var it,st,ut,at;if($.state!==SCHEDULED)return nt();for(it in b)if(at=b[it],at.name===$.name){if(at.state===STARTED)return timeout(et);at.state===RUNNING?(at.state=ENDED,at.timer.stop(),at.on.call("interrupt",d,d.__data__,at.index,at.group),delete b[it]):+itSTARTING&&b.state=0&&(g=g.slice(0,$)),!g||g==="start"})}function onFunction(d,g,$){var b,j,_e=start(g)?init:set;return function(){var et=_e(this,d),tt=et.on;tt!==b&&(j=(b=tt).copy()).on(g,$),et.on=j}}function transition_on(d,g){var $=this._id;return arguments.length<2?get$1(this.node(),$).on.on(d):this.each(onFunction($,d,g))}function removeFunction(d){return function(){var g=this.parentNode;for(var $ in this.__transition)if(+$!==d)return;g&&g.removeChild(this)}}function transition_remove(){return this.on("end.remove",removeFunction(this._id))}function transition_select(d){var g=this._name,$=this._id;typeof d!="function"&&(d=selector(d));for(var b=this._groups,j=b.length,_e=new Array(j),et=0;et=0))throw new Error(`invalid digits: ${d}`);if(g>15)return append;const $=10**g;return function(b){this._+=b[0];for(let j=1,_e=b.length;j<_e;++j)this._+=Math.round(arguments[j]*$)/$+b[j]}}class Path{constructor(g){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=g==null?append:appendRound(g)}moveTo(g,$){this._append`M${this._x0=this._x1=+g},${this._y0=this._y1=+$}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(g,$){this._append`L${this._x1=+g},${this._y1=+$}`}quadraticCurveTo(g,$,b,j){this._append`Q${+g},${+$},${this._x1=+b},${this._y1=+j}`}bezierCurveTo(g,$,b,j,_e,et){this._append`C${+g},${+$},${+b},${+j},${this._x1=+_e},${this._y1=+et}`}arcTo(g,$,b,j,_e){if(g=+g,$=+$,b=+b,j=+j,_e=+_e,_e<0)throw new Error(`negative radius: ${_e}`);let et=this._x1,tt=this._y1,nt=b-g,rt=j-$,it=et-g,st=tt-$,ut=it*it+st*st;if(this._x1===null)this._append`M${this._x1=g},${this._y1=$}`;else if(ut>epsilon)if(!(Math.abs(st*nt-rt*it)>epsilon)||!_e)this._append`L${this._x1=g},${this._y1=$}`;else{let at=b-et,ht=j-tt,ct=nt*nt+rt*rt,vt=at*at+ht*ht,ft=Math.sqrt(ct),gt=Math.sqrt(ut),pt=_e*Math.tan((pi-Math.acos((ct+ut-vt)/(2*ft*gt)))/2),yt=pt/gt,At=pt/ft;Math.abs(yt-1)>epsilon&&this._append`L${g+yt*it},${$+yt*st}`,this._append`A${_e},${_e},0,0,${+(st*at>it*ht)},${this._x1=g+At*nt},${this._y1=$+At*rt}`}}arc(g,$,b,j,_e,et){if(g=+g,$=+$,b=+b,et=!!et,b<0)throw new Error(`negative radius: ${b}`);let tt=b*Math.cos(j),nt=b*Math.sin(j),rt=g+tt,it=$+nt,st=1^et,ut=et?j-_e:_e-j;this._x1===null?this._append`M${rt},${it}`:(Math.abs(this._x1-rt)>epsilon||Math.abs(this._y1-it)>epsilon)&&this._append`L${rt},${it}`,b&&(ut<0&&(ut=ut%tau+tau),ut>tauEpsilon?this._append`A${b},${b},0,1,${st},${g-tt},${$-nt}A${b},${b},0,1,${st},${this._x1=rt},${this._y1=it}`:ut>epsilon&&this._append`A${b},${b},0,${+(ut>=pi)},${st},${this._x1=g+b*Math.cos(_e)},${this._y1=$+b*Math.sin(_e)}`)}rect(g,$,b,j){this._append`M${this._x0=this._x1=+g},${this._y0=this._y1=+$}h${b=+b}v${+j}h${-b}Z`}toString(){return this._}}function responseText(d){if(!d.ok)throw new Error(d.status+" "+d.statusText);return d.text()}function text(d,g){return fetch(d,g).then(responseText)}function parser$2(d){return(g,$)=>text(g,$).then(b=>new DOMParser().parseFromString(b,d))}var svg=parser$2("image/svg+xml");function constant$1(d){return function(){return d}}function withPath(d){let g=3;return d.digits=function($){if(!arguments.length)return g;if($==null)g=null;else{const b=Math.floor($);if(!(b>=0))throw new RangeError(`invalid digits: ${$}`);g=b}return d},()=>new Path(g)}function array(d){return typeof d=="object"&&"length"in d?d:Array.from(d)}function Linear(d){this._context=d}Linear.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(d,g){switch(d=+d,g=+g,this._point){case 0:this._point=1,this._line?this._context.lineTo(d,g):this._context.moveTo(d,g);break;case 1:this._point=2;default:this._context.lineTo(d,g);break}}};function curveLinear(d){return new Linear(d)}function x(d){return d[0]}function y$1(d){return d[1]}function line(d,g){var $=constant$1(!0),b=null,j=curveLinear,_e=null,et=withPath(tt);d=typeof d=="function"?d:d===void 0?x:constant$1(d),g=typeof g=="function"?g:g===void 0?y$1:constant$1(g);function tt(nt){var rt,it=(nt=array(nt)).length,st,ut=!1,at;for(b==null&&(_e=j(at=et())),rt=0;rt<=it;++rt)!(rt0){if(++g>=HOT_COUNT)return arguments[0]}else g=0;return d.apply(void 0,arguments)}}function constant(d){return function(){return d}}var defineProperty=function(){try{var d=getNative(Object,"defineProperty");return d({},"",{}),d}catch{}}();const defineProperty$1=defineProperty;var baseSetToString=defineProperty$1?function(d,g){return defineProperty$1(d,"toString",{configurable:!0,enumerable:!1,value:constant(g),writable:!0})}:identity$1;const baseSetToString$1=baseSetToString;var setToString=shortOut(baseSetToString$1);const setToString$1=setToString;function arrayEach(d,g){for(var $=-1,b=d==null?0:d.length;++$-1}var MAX_SAFE_INTEGER$1=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(d,g){var $=typeof d;return g=g??MAX_SAFE_INTEGER$1,!!g&&($=="number"||$!="symbol"&&reIsUint.test(d))&&d>-1&&d%1==0&&d-1&&d%1==0&&d<=MAX_SAFE_INTEGER}function isArrayLike(d){return d!=null&&isLength(d.length)&&!isFunction(d)}function isIterateeCall(d,g,$){if(!isObject($))return!1;var b=typeof g;return(b=="number"?isArrayLike($)&&isIndex(g,$.length):b=="string"&&g in $)?eq($[g],d):!1}function createAssigner(d){return baseRest(function(g,$){var b=-1,j=$.length,_e=j>1?$[j-1]:void 0,et=j>2?$[2]:void 0;for(_e=d.length>3&&typeof _e=="function"?(j--,_e):void 0,et&&isIterateeCall($[0],$[1],et)&&(_e=j<3?void 0:_e,j=1),g=Object(g);++b-1}function listCacheSet(d,g){var $=this.__data__,b=assocIndexOf($,d);return b<0?(++this.size,$.push([d,g])):$[b][1]=g,this}function ListCache(d){var g=-1,$=d==null?0:d.length;for(this.clear();++g<$;){var b=d[g];this.set(b[0],b[1])}}ListCache.prototype.clear=listCacheClear;ListCache.prototype.delete=listCacheDelete;ListCache.prototype.get=listCacheGet;ListCache.prototype.has=listCacheHas;ListCache.prototype.set=listCacheSet;var Map$1=getNative(root$2,"Map");const Map$2=Map$1;function mapCacheClear(){this.size=0,this.__data__={hash:new Hash,map:new(Map$2||ListCache),string:new Hash}}function isKeyable(d){var g=typeof d;return g=="string"||g=="number"||g=="symbol"||g=="boolean"?d!=="__proto__":d===null}function getMapData(d,g){var $=d.__data__;return isKeyable(g)?$[typeof g=="string"?"string":"hash"]:$.map}function mapCacheDelete(d){var g=getMapData(this,d).delete(d);return this.size-=g?1:0,g}function mapCacheGet(d){return getMapData(this,d).get(d)}function mapCacheHas(d){return getMapData(this,d).has(d)}function mapCacheSet(d,g){var $=getMapData(this,d),b=$.size;return $.set(d,g),this.size+=$.size==b?0:1,this}function MapCache(d){var g=-1,$=d==null?0:d.length;for(this.clear();++g<$;){var b=d[g];this.set(b[0],b[1])}}MapCache.prototype.clear=mapCacheClear;MapCache.prototype.delete=mapCacheDelete;MapCache.prototype.get=mapCacheGet;MapCache.prototype.has=mapCacheHas;MapCache.prototype.set=mapCacheSet;var FUNC_ERROR_TEXT="Expected a function";function memoize(d,g){if(typeof d!="function"||g!=null&&typeof g!="function")throw new TypeError(FUNC_ERROR_TEXT);var $=function(){var b=arguments,j=g?g.apply(this,b):b[0],_e=$.cache;if(_e.has(j))return _e.get(j);var et=d.apply(this,b);return $.cache=_e.set(j,et)||_e,et};return $.cache=new(memoize.Cache||MapCache),$}memoize.Cache=MapCache;var MAX_MEMOIZE_SIZE=500;function memoizeCapped(d){var g=memoize(d,function(b){return $.size===MAX_MEMOIZE_SIZE&&$.clear(),b}),$=g.cache;return g}var rePropName=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,reEscapeChar=/\\(\\)?/g,stringToPath=memoizeCapped(function(d){var g=[];return d.charCodeAt(0)===46&&g.push(""),d.replace(rePropName,function($,b,j,_e){g.push(j?_e.replace(reEscapeChar,"$1"):b||$)}),g});const stringToPath$1=stringToPath;function toString(d){return d==null?"":baseToString(d)}function castPath(d,g){return isArray$1(d)?d:isKey(d,g)?[d]:stringToPath$1(toString(d))}var INFINITY$1=1/0;function toKey(d){if(typeof d=="string"||isSymbol(d))return d;var g=d+"";return g=="0"&&1/d==-INFINITY$1?"-0":g}function baseGet(d,g){g=castPath(g,d);for(var $=0,b=g.length;d!=null&&$0&&$(tt)?g>1?baseFlatten(tt,g-1,$,b,j):arrayPush(j,tt):b||(j[j.length]=tt)}return j}function flatten(d){var g=d==null?0:d.length;return g?baseFlatten(d,1):[]}function flatRest(d){return setToString$1(overRest(d,void 0,flatten),d+"")}var getPrototype=overArg(Object.getPrototypeOf,Object);const getPrototype$1=getPrototype;var objectTag$3="[object Object]",funcProto=Function.prototype,objectProto$7=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$6=objectProto$7.hasOwnProperty,objectCtorString=funcToString.call(Object);function isPlainObject(d){if(!isObjectLike(d)||baseGetTag(d)!=objectTag$3)return!1;var g=getPrototype$1(d);if(g===null)return!0;var $=hasOwnProperty$6.call(g,"constructor")&&g.constructor;return typeof $=="function"&&$ instanceof $&&funcToString.call($)==objectCtorString}function arrayReduce(d,g,$,b){var j=-1,_e=d==null?0:d.length;for(b&&_e&&($=d[++j]);++j<_e;)$=g($,d[j],j,d);return $}function stackClear(){this.__data__=new ListCache,this.size=0}function stackDelete(d){var g=this.__data__,$=g.delete(d);return this.size=g.size,$}function stackGet(d){return this.__data__.get(d)}function stackHas(d){return this.__data__.has(d)}var LARGE_ARRAY_SIZE$1=200;function stackSet(d,g){var $=this.__data__;if($ instanceof ListCache){var b=$.__data__;if(!Map$2||b.lengthtt))return!1;var rt=_e.get(d),it=_e.get(g);if(rt&&it)return rt==g&&it==d;var st=-1,ut=!0,at=$&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(_e.set(d,g),_e.set(g,d);++st2?g[2]:void 0;for(j&&isIterateeCall(g[0],g[1],j)&&(b=1);++$-1?j[_e?g[et]:et]:void 0}}var nativeMax$1=Math.max;function findIndex(d,g,$){var b=d==null?0:d.length;if(!b)return-1;var j=$==null?0:toInteger($);return j<0&&(j=nativeMax$1(b+j,0)),baseFindIndex(d,baseIteratee(g),j)}var find=createFind(findIndex);const find$1=find;function baseMap(d,g){var $=-1,b=isArrayLike(d)?Array(d.length):[];return baseEach$1(d,function(j,_e,et){b[++$]=g(j,_e,et)}),b}function map(d,g){var $=isArray$1(d)?arrayMap:baseMap;return $(d,baseIteratee(g))}function forIn(d,g){return d==null?d:baseFor$1(d,castFunction(g),keysIn)}function forOwn(d,g){return d&&baseForOwn(d,castFunction(g))}function baseGt(d,g){return d>g}var objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function baseHas(d,g){return d!=null&&hasOwnProperty$1.call(d,g)}function has(d,g){return d!=null&&hasPath(d,g,baseHas)}function baseValues(d,g){return arrayMap(g,function($){return d[$]})}function values(d){return d==null?[]:baseValues(d,keys(d))}var mapTag="[object Map]",setTag="[object Set]",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function isEmpty(d){if(d==null)return!0;if(isArrayLike(d)&&(isArray$1(d)||typeof d=="string"||typeof d.splice=="function"||isBuffer$1(d)||isTypedArray$1(d)||isArguments$1(d)))return!d.length;var g=getTag$1(d);if(g==mapTag||g==setTag)return!d.size;if(isPrototype(d))return!baseKeys(d).length;for(var $ in d)if(hasOwnProperty.call(d,$))return!1;return!0}function isUndefined(d){return d===void 0}function baseLt(d,g){return dg||_e&&et&&nt&&!tt&&!rt||b&&et&&nt||!$&&nt||!j)return 1;if(!b&&!_e&&!rt&&d=tt)return nt;var rt=$[b];return nt*(rt=="desc"?-1:1)}}return d.index-g.index}function baseOrderBy(d,g,$){g.length?g=arrayMap(g,function(_e){return isArray$1(_e)?function(et){return baseGet(et,_e.length===1?_e[0]:_e)}:_e}):g=[identity$1];var b=-1;g=arrayMap(g,baseUnary(baseIteratee));var j=baseMap(d,function(_e,et,tt){var nt=arrayMap(g,function(rt){return rt(_e)});return{criteria:nt,index:++b,value:_e}});return baseSortBy(j,function(_e,et){return compareMultiple(_e,et,$)})}function basePick(d,g){return basePickBy(d,g,function($,b){return hasIn(d,b)})}var pick=flatRest(function(d,g){return d==null?{}:basePick(d,g)});const pick$1=pick;var nativeCeil=Math.ceil,nativeMax=Math.max;function baseRange(d,g,$,b){for(var j=-1,_e=nativeMax(nativeCeil((g-d)/($||1)),0),et=Array(_e);_e--;)et[b?_e:++j]=d,d+=$;return et}function createRange(d){return function(g,$,b){return b&&typeof b!="number"&&isIterateeCall(g,$,b)&&($=b=void 0),g=toFinite(g),$===void 0?($=g,g=0):$=toFinite($),b=b===void 0?g<$?1:-1:toFinite(b),baseRange(g,$,b,d)}}var range=createRange();const range$1=range;function baseReduce(d,g,$,b,j){return j(d,function(_e,et,tt){$=b?(b=!1,_e):g($,_e,et,tt)}),$}function reduce(d,g,$){var b=isArray$1(d)?arrayReduce:baseReduce,j=arguments.length<3;return b(d,baseIteratee(g),$,j,baseEach$1)}var sortBy=baseRest(function(d,g){if(d==null)return[];var $=g.length;return $>1&&isIterateeCall(d,g[0],g[1])?g=[]:$>2&&isIterateeCall(g[0],g[1],g[2])&&(g=[g[0]]),baseOrderBy(d,baseFlatten(g,1),[])});const sortBy$1=sortBy;var INFINITY=1/0,createSet=Set$2&&1/setToArray(new Set$2([,-0]))[1]==INFINITY?function(d){return new Set$2(d)}:noop$1;const createSet$1=createSet;var LARGE_ARRAY_SIZE=200;function baseUniq(d,g,$){var b=-1,j=arrayIncludes,_e=d.length,et=!0,tt=[],nt=tt;if($)et=!1,j=arrayIncludesWith;else if(_e>=LARGE_ARRAY_SIZE){var rt=g?null:createSet$1(d);if(rt)return setToArray(rt);et=!1,j=cacheHas,nt=new SetCache}else nt=g?[]:tt;e:for(;++b<_e;){var it=d[b],st=g?g(it):it;if(it=$||it!==0?it:0,et&&st===st){for(var ut=nt.length;ut--;)if(nt[ut]===st)continue e;g&&nt.push(st),tt.push(it)}else j(nt,st,$)||(nt!==tt&&nt.push(st),tt.push(it))}return tt}var union=baseRest(function(d){return baseUniq(baseFlatten(d,1,isArrayLikeObject,!0))});const union$1=union;var idCounter=0;function uniqueId(d){var g=++idCounter;return toString(d)+g}function baseZipObject(d,g,$){for(var b=-1,j=d.length,_e=g.length,et={};++b1?j.setNode(_e,$):j.setNode(_e)}),this}setNode(g,$){return has(this._nodes,g)?(arguments.length>1&&(this._nodes[g]=$),this):(this._nodes[g]=arguments.length>1?$:this._defaultNodeLabelFn(g),this._isCompound&&(this._parent[g]=GRAPH_NODE,this._children[g]={},this._children[GRAPH_NODE][g]=!0),this._in[g]={},this._preds[g]={},this._out[g]={},this._sucs[g]={},++this._nodeCount,this)}node(g){return this._nodes[g]}hasNode(g){return has(this._nodes,g)}removeNode(g){var $=this;if(has(this._nodes,g)){var b=function(j){$.removeEdge($._edgeObjs[j])};delete this._nodes[g],this._isCompound&&(this._removeFromParentsChildList(g),delete this._parent[g],forEach(this.children(g),function(j){$.setParent(j)}),delete this._children[g]),forEach(keys(this._in[g]),b),delete this._in[g],delete this._preds[g],forEach(keys(this._out[g]),b),delete this._out[g],delete this._sucs[g],--this._nodeCount}return this}setParent(g,$){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(isUndefined($))$=GRAPH_NODE;else{$+="";for(var b=$;!isUndefined(b);b=this.parent(b))if(b===g)throw new Error("Setting "+$+" as parent of "+g+" would create a cycle");this.setNode($)}return this.setNode(g),this._removeFromParentsChildList(g),this._parent[g]=$,this._children[$][g]=!0,this}_removeFromParentsChildList(g){delete this._children[this._parent[g]][g]}parent(g){if(this._isCompound){var $=this._parent[g];if($!==GRAPH_NODE)return $}}children(g){if(isUndefined(g)&&(g=GRAPH_NODE),this._isCompound){var $=this._children[g];if($)return keys($)}else{if(g===GRAPH_NODE)return this.nodes();if(this.hasNode(g))return[]}}predecessors(g){var $=this._preds[g];if($)return keys($)}successors(g){var $=this._sucs[g];if($)return keys($)}neighbors(g){var $=this.predecessors(g);if($)return union$1($,this.successors(g))}isLeaf(g){var $;return this.isDirected()?$=this.successors(g):$=this.neighbors(g),$.length===0}filterNodes(g){var $=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});$.setGraph(this.graph());var b=this;forEach(this._nodes,function(et,tt){g(tt)&&$.setNode(tt,et)}),forEach(this._edgeObjs,function(et){$.hasNode(et.v)&&$.hasNode(et.w)&&$.setEdge(et,b.edge(et))});var j={};function _e(et){var tt=b.parent(et);return tt===void 0||$.hasNode(tt)?(j[et]=tt,tt):tt in j?j[tt]:_e(tt)}return this._isCompound&&forEach($.nodes(),function(et){$.setParent(et,_e(et))}),$}setDefaultEdgeLabel(g){return isFunction(g)||(g=constant(g)),this._defaultEdgeLabelFn=g,this}edgeCount(){return this._edgeCount}edges(){return values(this._edgeObjs)}setPath(g,$){var b=this,j=arguments;return reduce(g,function(_e,et){return j.length>1?b.setEdge(_e,et,$):b.setEdge(_e,et),et}),this}setEdge(){var g,$,b,j,_e=!1,et=arguments[0];typeof et=="object"&&et!==null&&"v"in et?(g=et.v,$=et.w,b=et.name,arguments.length===2&&(j=arguments[1],_e=!0)):(g=et,$=arguments[1],b=arguments[3],arguments.length>2&&(j=arguments[2],_e=!0)),g=""+g,$=""+$,isUndefined(b)||(b=""+b);var tt=edgeArgsToId(this._isDirected,g,$,b);if(has(this._edgeLabels,tt))return _e&&(this._edgeLabels[tt]=j),this;if(!isUndefined(b)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(g),this.setNode($),this._edgeLabels[tt]=_e?j:this._defaultEdgeLabelFn(g,$,b);var nt=edgeArgsToObj(this._isDirected,g,$,b);return g=nt.v,$=nt.w,Object.freeze(nt),this._edgeObjs[tt]=nt,incrementOrInitEntry(this._preds[$],g),incrementOrInitEntry(this._sucs[g],$),this._in[$][tt]=nt,this._out[g][tt]=nt,this._edgeCount++,this}edge(g,$,b){var j=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,g,$,b);return this._edgeLabels[j]}hasEdge(g,$,b){var j=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,g,$,b);return has(this._edgeLabels,j)}removeEdge(g,$,b){var j=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,g,$,b),_e=this._edgeObjs[j];return _e&&(g=_e.v,$=_e.w,delete this._edgeLabels[j],delete this._edgeObjs[j],decrementOrRemoveEntry(this._preds[$],g),decrementOrRemoveEntry(this._sucs[g],$),delete this._in[$][j],delete this._out[g][j],this._edgeCount--),this}inEdges(g,$){var b=this._in[g];if(b){var j=values(b);return $?filter(j,function(_e){return _e.v===$}):j}}outEdges(g,$){var b=this._out[g];if(b){var j=values(b);return $?filter(j,function(_e){return _e.w===$}):j}}nodeEdges(g,$){var b=this.inEdges(g,$);if(b)return b.concat(this.outEdges(g,$))}}Graph.prototype._nodeCount=0;Graph.prototype._edgeCount=0;function incrementOrInitEntry(d,g){d[g]?d[g]++:d[g]=1}function decrementOrRemoveEntry(d,g){--d[g]||delete d[g]}function edgeArgsToId(d,g,$,b){var j=""+g,_e=""+$;if(!d&&j>_e){var et=j;j=_e,_e=et}return j+EDGE_KEY_DELIM+_e+EDGE_KEY_DELIM+(isUndefined(b)?DEFAULT_EDGE_NAME:b)}function edgeArgsToObj(d,g,$,b){var j=""+g,_e=""+$;if(!d&&j>_e){var et=j;j=_e,_e=et}var tt={v:j,w:_e};return b&&(tt.name=b),tt}function edgeObjToId(d,g){return edgeArgsToId(d,g.v,g.w,g.name)}class List{constructor(){var g={};g._next=g._prev=g,this._sentinel=g}dequeue(){var g=this._sentinel,$=g._prev;if($!==g)return unlink($),$}enqueue(g){var $=this._sentinel;g._prev&&g._next&&unlink(g),g._next=$._next,$._next._prev=g,$._next=g,g._prev=$}toString(){for(var g=[],$=this._sentinel,b=$._prev;b!==$;)g.push(JSON.stringify(b,filterOutLinks)),b=b._prev;return"["+g.join(", ")+"]"}}function unlink(d){d._prev._next=d._next,d._next._prev=d._prev,delete d._next,delete d._prev}function filterOutLinks(d,g){if(d!=="_next"&&d!=="_prev")return g}var DEFAULT_WEIGHT_FN=constant(1);function greedyFAS(d,g){if(d.nodeCount()<=1)return[];var $=buildState(d,g||DEFAULT_WEIGHT_FN),b=doGreedyFAS($.graph,$.buckets,$.zeroIdx);return flatten(map(b,function(j){return d.outEdges(j.v,j.w)}))}function doGreedyFAS(d,g,$){for(var b=[],j=g[g.length-1],_e=g[0],et;d.nodeCount();){for(;et=_e.dequeue();)removeNode(d,g,$,et);for(;et=j.dequeue();)removeNode(d,g,$,et);if(d.nodeCount()){for(var tt=g.length-2;tt>0;--tt)if(et=g[tt].dequeue(),et){b=b.concat(removeNode(d,g,$,et,!0));break}}}return b}function removeNode(d,g,$,b,j){var _e=j?[]:void 0;return forEach(d.inEdges(b.v),function(et){var tt=d.edge(et),nt=d.node(et.v);j&&_e.push({v:et.v,w:et.w}),nt.out-=tt,assignBucket(g,$,nt)}),forEach(d.outEdges(b.v),function(et){var tt=d.edge(et),nt=et.w,rt=d.node(nt);rt.in-=tt,assignBucket(g,$,rt)}),d.removeNode(b.v),_e}function buildState(d,g){var $=new Graph,b=0,j=0;forEach(d.nodes(),function(tt){$.setNode(tt,{v:tt,in:0,out:0})}),forEach(d.edges(),function(tt){var nt=$.edge(tt.v,tt.w)||0,rt=g(tt),it=nt+rt;$.setEdge(tt.v,tt.w,it),j=Math.max(j,$.node(tt.v).out+=rt),b=Math.max(b,$.node(tt.w).in+=rt)});var _e=range$1(j+b+3).map(function(){return new List}),et=b+1;return forEach($.nodes(),function(tt){assignBucket(_e,et,$.node(tt))}),{graph:$,buckets:_e,zeroIdx:et}}function assignBucket(d,g,$){$.out?$.in?d[$.out-$.in+g].enqueue($):d[d.length-1].enqueue($):d[0].enqueue($)}function run$2(d){var g=d.graph().acyclicer==="greedy"?greedyFAS(d,$(d)):dfsFAS(d);forEach(g,function(b){var j=d.edge(b);d.removeEdge(b),j.forwardName=b.name,j.reversed=!0,d.setEdge(b.w,b.v,j,uniqueId("rev"))});function $(b){return function(j){return b.edge(j).weight}}}function dfsFAS(d){var g=[],$={},b={};function j(_e){has(b,_e)||(b[_e]=!0,$[_e]=!0,forEach(d.outEdges(_e),function(et){has($,et.w)?g.push(et):j(et.w)}),delete $[_e])}return forEach(d.nodes(),j),g}function undo$2(d){forEach(d.edges(),function(g){var $=d.edge(g);if($.reversed){d.removeEdge(g);var b=$.forwardName;delete $.reversed,delete $.forwardName,d.setEdge(g.w,g.v,$,b)}})}function addDummyNode(d,g,$,b){var j;do j=uniqueId(b);while(d.hasNode(j));return $.dummy=g,d.setNode(j,$),j}function simplify(d){var g=new Graph().setGraph(d.graph());return forEach(d.nodes(),function($){g.setNode($,d.node($))}),forEach(d.edges(),function($){var b=g.edge($.v,$.w)||{weight:0,minlen:1},j=d.edge($);g.setEdge($.v,$.w,{weight:b.weight+j.weight,minlen:Math.max(b.minlen,j.minlen)})}),g}function asNonCompoundGraph(d){var g=new Graph({multigraph:d.isMultigraph()}).setGraph(d.graph());return forEach(d.nodes(),function($){d.children($).length||g.setNode($,d.node($))}),forEach(d.edges(),function($){g.setEdge($,d.edge($))}),g}function intersectRect$1(d,g){var $=d.x,b=d.y,j=g.x-$,_e=g.y-b,et=d.width/2,tt=d.height/2;if(!j&&!_e)throw new Error("Not possible to find intersection inside of the rectangle");var nt,rt;return Math.abs(_e)*et>Math.abs(j)*tt?(_e<0&&(tt=-tt),nt=tt*j/_e,rt=tt):(j<0&&(et=-et),nt=et,rt=et*_e/j),{x:$+nt,y:b+rt}}function buildLayerMatrix(d){var g=map(range$1(maxRank(d)+1),function(){return[]});return forEach(d.nodes(),function($){var b=d.node($),j=b.rank;isUndefined(j)||(g[j][b.order]=$)}),g}function normalizeRanks(d){var g=min(map(d.nodes(),function($){return d.node($).rank}));forEach(d.nodes(),function($){var b=d.node($);has(b,"rank")&&(b.rank-=g)})}function removeEmptyRanks(d){var g=min(map(d.nodes(),function(_e){return d.node(_e).rank})),$=[];forEach(d.nodes(),function(_e){var et=d.node(_e).rank-g;$[et]||($[et]=[]),$[et].push(_e)});var b=0,j=d.graph().nodeRankFactor;forEach($,function(_e,et){isUndefined(_e)&&et%j!==0?--b:b&&forEach(_e,function(tt){d.node(tt).rank+=b})})}function addBorderNode$1(d,g,$,b){var j={width:0,height:0};return arguments.length>=4&&(j.rank=$,j.order=b),addDummyNode(d,"border",j,g)}function maxRank(d){return max(map(d.nodes(),function(g){var $=d.node(g).rank;if(!isUndefined($))return $}))}function partition(d,g){var $={lhs:[],rhs:[]};return forEach(d,function(b){g(b)?$.lhs.push(b):$.rhs.push(b)}),$}function time(d,g){var $=now$2();try{return g()}finally{console.log(d+" time: "+(now$2()-$)+"ms")}}function notime(d,g){return g()}function addBorderSegments(d){function g($){var b=d.children($),j=d.node($);if(b.length&&forEach(b,g),has(j,"minRank")){j.borderLeft=[],j.borderRight=[];for(var _e=j.minRank,et=j.maxRank+1;_eet.lim&&(tt=et,nt=!0);var rt=filter(g.edges(),function(it){return nt===isDescendant(d,d.node(it.v),tt)&&nt!==isDescendant(d,d.node(it.w),tt)});return minBy(rt,function(it){return slack(g,it)})}function exchangeEdges(d,g,$,b){var j=$.v,_e=$.w;d.removeEdge(j,_e),d.setEdge(b.v,b.w,{}),initLowLimValues(d),initCutValues(d,g),updateRanks(d,g)}function updateRanks(d,g){var $=find$1(d.nodes(),function(j){return!g.node(j).parent}),b=preorder(d,$);b=b.slice(1),forEach(b,function(j){var _e=d.node(j).parent,et=g.edge(j,_e),tt=!1;et||(et=g.edge(_e,j),tt=!0),g.node(j).rank=g.node(_e).rank+(tt?et.minlen:-et.minlen)})}function isTreeEdge(d,g,$){return d.hasEdge(g,$)}function isDescendant(d,g,$){return $.low<=g.lim&&g.lim<=$.lim}function rank(d){switch(d.graph().ranker){case"network-simplex":networkSimplexRanker(d);break;case"tight-tree":tightTreeRanker(d);break;case"longest-path":longestPathRanker(d);break;default:networkSimplexRanker(d)}}var longestPathRanker=longestPath;function tightTreeRanker(d){longestPath(d),feasibleTree(d)}function networkSimplexRanker(d){networkSimplex(d)}function run(d){var g=addDummyNode(d,"root",{},"_root"),$=treeDepths(d),b=max(values($))-1,j=2*b+1;d.graph().nestingRoot=g,forEach(d.edges(),function(et){d.edge(et).minlen*=j});var _e=sumWeights(d)+1;forEach(d.children(),function(et){dfs(d,g,j,_e,b,$,et)}),d.graph().nodeRankFactor=j}function dfs(d,g,$,b,j,_e,et){var tt=d.children(et);if(!tt.length){et!==g&&d.setEdge(g,et,{weight:0,minlen:$});return}var nt=addBorderNode$1(d,"_bt"),rt=addBorderNode$1(d,"_bb"),it=d.node(et);d.setParent(nt,et),it.borderTop=nt,d.setParent(rt,et),it.borderBottom=rt,forEach(tt,function(st){dfs(d,g,$,b,j,_e,st);var ut=d.node(st),at=ut.borderTop?ut.borderTop:st,ht=ut.borderBottom?ut.borderBottom:st,ct=ut.borderTop?b:2*b,vt=at!==ht?1:j-_e[et]+1;d.setEdge(nt,at,{weight:ct,minlen:vt,nestingEdge:!0}),d.setEdge(ht,rt,{weight:ct,minlen:vt,nestingEdge:!0})}),d.parent(et)||d.setEdge(g,nt,{weight:0,minlen:j+_e[et]})}function treeDepths(d){var g={};function $(b,j){var _e=d.children(b);_e&&_e.length&&forEach(_e,function(et){$(et,j+1)}),g[b]=j}return forEach(d.children(),function(b){$(b,1)}),g}function sumWeights(d){return reduce(d.edges(),function(g,$){return g+d.edge($).weight},0)}function cleanup(d){var g=d.graph();d.removeNode(g.nestingRoot),delete g.nestingRoot,forEach(d.edges(),function($){var b=d.edge($);b.nestingEdge&&d.removeEdge($)})}function addSubgraphConstraints(d,g,$){var b={},j;forEach($,function(_e){for(var et=d.parent(_e),tt,nt;et;){if(tt=d.parent(et),tt?(nt=b[tt],b[tt]=et):(nt=j,j=et),nt&&nt!==et){g.setEdge(nt,et);return}et=tt}})}function buildLayerGraph(d,g,$){var b=createRootNode(d),j=new Graph({compound:!0}).setGraph({root:b}).setDefaultNodeLabel(function(_e){return d.node(_e)});return forEach(d.nodes(),function(_e){var et=d.node(_e),tt=d.parent(_e);(et.rank===g||et.minRank<=g&&g<=et.maxRank)&&(j.setNode(_e),j.setParent(_e,tt||b),forEach(d[$](_e),function(nt){var rt=nt.v===_e?nt.w:nt.v,it=j.edge(rt,_e),st=isUndefined(it)?0:it.weight;j.setEdge(rt,_e,{weight:d.edge(nt).weight+st})}),has(et,"minRank")&&j.setNode(_e,{borderLeft:et.borderLeft[g],borderRight:et.borderRight[g]}))}),j}function createRootNode(d){for(var g;d.hasNode(g=uniqueId("_root")););return g}function crossCount(d,g){for(var $=0,b=1;b0;)it%2&&(st+=tt[it+1]),it=it-1>>1,tt[it]+=rt.weight;nt+=rt.weight*st})),nt}function initOrder(d){var g={},$=filter(d.nodes(),function(tt){return!d.children(tt).length}),b=max(map($,function(tt){return d.node(tt).rank})),j=map(range$1(b+1),function(){return[]});function _e(tt){if(!has(g,tt)){g[tt]=!0;var nt=d.node(tt);j[nt.rank].push(tt),forEach(d.successors(tt),_e)}}var et=sortBy$1($,function(tt){return d.node(tt).rank});return forEach(et,_e),j}function barycenter(d,g){return map(g,function($){var b=d.inEdges($);if(b.length){var j=reduce(b,function(_e,et){var tt=d.edge(et),nt=d.node(et.v);return{sum:_e.sum+tt.weight*nt.order,weight:_e.weight+tt.weight}},{sum:0,weight:0});return{v:$,barycenter:j.sum/j.weight,weight:j.weight}}else return{v:$}})}function resolveConflicts(d,g){var $={};forEach(d,function(j,_e){var et=$[j.v]={indegree:0,in:[],out:[],vs:[j.v],i:_e};isUndefined(j.barycenter)||(et.barycenter=j.barycenter,et.weight=j.weight)}),forEach(g.edges(),function(j){var _e=$[j.v],et=$[j.w];!isUndefined(_e)&&!isUndefined(et)&&(et.indegree++,_e.out.push($[j.w]))});var b=filter($,function(j){return!j.indegree});return doResolveConflicts(b)}function doResolveConflicts(d){var g=[];function $(_e){return function(et){et.merged||(isUndefined(et.barycenter)||isUndefined(_e.barycenter)||et.barycenter>=_e.barycenter)&&mergeEntries(_e,et)}}function b(_e){return function(et){et.in.push(_e),--et.indegree===0&&d.push(et)}}for(;d.length;){var j=d.pop();g.push(j),forEach(j.in.reverse(),$(j)),forEach(j.out,b(j))}return map(filter(g,function(_e){return!_e.merged}),function(_e){return pick$1(_e,["vs","i","barycenter","weight"])})}function mergeEntries(d,g){var $=0,b=0;d.weight&&($+=d.barycenter*d.weight,b+=d.weight),g.weight&&($+=g.barycenter*g.weight,b+=g.weight),d.vs=g.vs.concat(d.vs),d.barycenter=$/b,d.weight=b,d.i=Math.min(g.i,d.i),g.merged=!0}function sort(d,g){var $=partition(d,function(it){return has(it,"barycenter")}),b=$.lhs,j=sortBy$1($.rhs,function(it){return-it.i}),_e=[],et=0,tt=0,nt=0;b.sort(compareWithBias(!!g)),nt=consumeUnsortable(_e,j,nt),forEach(b,function(it){nt+=it.vs.length,_e.push(it.vs),et+=it.barycenter*it.weight,tt+=it.weight,nt=consumeUnsortable(_e,j,nt)});var rt={vs:flatten(_e)};return tt&&(rt.barycenter=et/tt,rt.weight=tt),rt}function consumeUnsortable(d,g,$){for(var b;g.length&&(b=last$1(g)).i<=$;)g.pop(),d.push(b.vs),$++;return $}function compareWithBias(d){return function(g,$){return g.barycenter<$.barycenter?-1:g.barycenter>$.barycenter?1:d?$.i-g.i:g.i-$.i}}function sortSubgraph(d,g,$,b){var j=d.children(g),_e=d.node(g),et=_e?_e.borderLeft:void 0,tt=_e?_e.borderRight:void 0,nt={};et&&(j=filter(j,function(ht){return ht!==et&&ht!==tt}));var rt=barycenter(d,j);forEach(rt,function(ht){if(d.children(ht.v).length){var ct=sortSubgraph(d,ht.v,$,b);nt[ht.v]=ct,has(ct,"barycenter")&&mergeBarycenters(ht,ct)}});var it=resolveConflicts(rt,$);expandSubgraphs(it,nt);var st=sort(it,b);if(et&&(st.vs=flatten([et,st.vs,tt]),d.predecessors(et).length)){var ut=d.node(d.predecessors(et)[0]),at=d.node(d.predecessors(tt)[0]);has(st,"barycenter")||(st.barycenter=0,st.weight=0),st.barycenter=(st.barycenter*st.weight+ut.order+at.order)/(st.weight+2),st.weight+=2}return st}function expandSubgraphs(d,g){forEach(d,function($){$.vs=flatten($.vs.map(function(b){return g[b]?g[b].vs:b}))})}function mergeBarycenters(d,g){isUndefined(d.barycenter)?(d.barycenter=g.barycenter,d.weight=g.weight):(d.barycenter=(d.barycenter*d.weight+g.barycenter*g.weight)/(d.weight+g.weight),d.weight+=g.weight)}function order(d){var g=maxRank(d),$=buildLayerGraphs(d,range$1(1,g+1),"inEdges"),b=buildLayerGraphs(d,range$1(g-1,-1,-1),"outEdges"),j=initOrder(d);assignOrder(d,j);for(var _e=Number.POSITIVE_INFINITY,et,tt=0,nt=0;nt<4;++tt,++nt){sweepLayerGraphs(tt%2?$:b,tt%4>=2),j=buildLayerMatrix(d);var rt=crossCount(d,j);rt<_e&&(nt=0,et=cloneDeep(j),_e=rt)}assignOrder(d,et)}function buildLayerGraphs(d,g,$){return map(g,function(b){return buildLayerGraph(d,b,$)})}function sweepLayerGraphs(d,g){var $=new Graph;forEach(d,function(b){var j=b.graph().root,_e=sortSubgraph(b,j,$,g);forEach(_e.vs,function(et,tt){b.node(et).order=tt}),addSubgraphConstraints(b,$,_e.vs)})}function assignOrder(d,g){forEach(g,function($){forEach($,function(b,j){d.node(b).order=j})})}function parentDummyChains(d){var g=postorder(d);forEach(d.graph().dummyChains,function($){for(var b=d.node($),j=b.edgeObj,_e=findPath(d,g,j.v,j.w),et=_e.path,tt=_e.lca,nt=0,rt=et[nt],it=!0;$!==j.w;){if(b=d.node($),it){for(;(rt=et[nt])!==tt&&d.node(rt).maxRanket||tt>g[nt].lim));for(rt=nt,nt=b;(nt=d.parent(nt))!==rt;)_e.push(nt);return{path:j.concat(_e.reverse()),lca:rt}}function postorder(d){var g={},$=0;function b(j){var _e=$;forEach(d.children(j),b),g[j]={low:_e,lim:$++}}return forEach(d.children(),b),g}function findType1Conflicts(d,g){var $={};function b(j,_e){var et=0,tt=0,nt=j.length,rt=last$1(_e);return forEach(_e,function(it,st){var ut=findOtherInnerSegmentNode(d,it),at=ut?d.node(ut).order:nt;(ut||it===rt)&&(forEach(_e.slice(tt,st+1),function(ht){forEach(d.predecessors(ht),function(ct){var vt=d.node(ct),ft=vt.order;(ftrt)&&addConflict($,ut,it)})})}function j(_e,et){var tt=-1,nt,rt=0;return forEach(et,function(it,st){if(d.node(it).dummy==="border"){var ut=d.predecessors(it);ut.length&&(nt=d.node(ut[0]).order,b(et,rt,st,tt,nt),rt=st,tt=nt)}b(et,rt,et.length,nt,_e.length)}),et}return reduce(g,j),$}function findOtherInnerSegmentNode(d,g){if(d.node(g).dummy)return find$1(d.predecessors(g),function($){return d.node($).dummy})}function addConflict(d,g,$){if(g>$){var b=g;g=$,$=b}var j=d[g];j||(d[g]=j={}),j[$]=!0}function hasConflict(d,g,$){if(g>$){var b=g;g=$,$=b}return has(d[g],$)}function verticalAlignment(d,g,$,b){var j={},_e={},et={};return forEach(g,function(tt){forEach(tt,function(nt,rt){j[nt]=nt,_e[nt]=nt,et[nt]=rt})}),forEach(g,function(tt){var nt=-1;forEach(tt,function(rt){var it=b(rt);if(it.length){it=sortBy$1(it,function(ct){return et[ct]});for(var st=(it.length-1)/2,ut=Math.floor(st),at=Math.ceil(st);ut<=at;++ut){var ht=it[ut];_e[rt]===rt&&nt0}function intersectPolygon(d,g,$){var b=d.x,j=d.y,_e=[],et=Number.POSITIVE_INFINITY,tt=Number.POSITIVE_INFINITY;g.forEach(function(ht){et=Math.min(et,ht.x),tt=Math.min(tt,ht.y)});for(var nt=b-d.width/2-et,rt=j-d.height/2-tt,it=0;it1&&_e.sort(function(ht,ct){var vt=ht.x-$.x,ft=ht.y-$.y,gt=Math.sqrt(vt*vt+ft*ft),pt=ct.x-$.x,yt=ct.y-$.y,At=Math.sqrt(pt*pt+yt*yt);return gtMath.abs(j)*tt?(_e<0&&(tt=-tt),nt=_e===0?0:tt*j/_e,rt=tt):(j<0&&(et=-et),nt=et,rt=j===0?0:et*_e/j),{x:$+nt,y:b+rt}}var shapes={rect,ellipse,circle,diamond};function setShapes(d){shapes=d}function rect(d,g,$){var b=d.insert("rect",":first-child").attr("rx",$.rx).attr("ry",$.ry).attr("x",-g.width/2).attr("y",-g.height/2).attr("width",g.width).attr("height",g.height);return $.intersect=function(j){return intersectRect($,j)},b}function ellipse(d,g,$){var b=g.width/2,j=g.height/2,_e=d.insert("ellipse",":first-child").attr("x",-g.width/2).attr("y",-g.height/2).attr("rx",b).attr("ry",j);return $.intersect=function(et){return intersectEllipse($,b,j,et)},_e}function circle(d,g,$){var b=Math.max(g.width,g.height)/2,j=d.insert("circle",":first-child").attr("x",-g.width/2).attr("y",-g.height/2).attr("r",b);return $.intersect=function(_e){return intersectCircle($,b,_e)},j}function diamond(d,g,$){var b=g.width*Math.SQRT2/2,j=g.height*Math.SQRT2/2,_e=[{x:0,y:-j},{x:-b,y:0},{x:0,y:j},{x:b,y:0}],et=d.insert("polygon",":first-child").attr("points",_e.map(function(tt){return tt.x+","+tt.y}).join(" "));return $.intersect=function(tt){return intersectPolygon($,_e,tt)},et}function render(){var d=function(g,$){preProcessGraph($);var b=createOrSelectGroup(g,"output"),j=createOrSelectGroup(b,"clusters"),_e=createOrSelectGroup(b,"edgePaths"),et=createEdgeLabels(createOrSelectGroup(b,"edgeLabels"),$),tt=createNodes(createOrSelectGroup(b,"nodes"),$,shapes);layout($),positionNodes(tt,$),positionEdgeLabels(et,$),createEdgePaths(_e,$,arrows);var nt=createClusters(j,$);positionClusters(nt,$),postProcessGraph($)};return d.createNodes=function(g){return arguments.length?(setCreateNodes(g),d):createNodes},d.createClusters=function(g){return arguments.length?(setCreateClusters(g),d):createClusters},d.createEdgeLabels=function(g){return arguments.length?(setCreateEdgeLabels(g),d):createEdgeLabels},d.createEdgePaths=function(g){return arguments.length?(setCreateEdgePaths(g),d):createEdgePaths},d.shapes=function(g){return arguments.length?(setShapes(g),d):shapes},d.arrows=function(g){return arguments.length?(setArrows(g),d):arrows},d}var NODE_DEFAULT_ATTRS={paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,rx:0,ry:0,shape:"rect"},EDGE_DEFAULT_ATTRS={arrowhead:"normal",curve:curveLinear};function preProcessGraph(d){d.nodes().forEach(function(g){var $=d.node(g);!has($,"label")&&!d.children(g).length&&($.label=g),has($,"paddingX")&&defaults$1($,{paddingLeft:$.paddingX,paddingRight:$.paddingX}),has($,"paddingY")&&defaults$1($,{paddingTop:$.paddingY,paddingBottom:$.paddingY}),has($,"padding")&&defaults$1($,{paddingLeft:$.padding,paddingRight:$.padding,paddingTop:$.padding,paddingBottom:$.padding}),defaults$1($,NODE_DEFAULT_ATTRS),forEach(["paddingLeft","paddingRight","paddingTop","paddingBottom"],function(b){$[b]=Number($[b])}),has($,"width")&&($._prevWidth=$.width),has($,"height")&&($._prevHeight=$.height)}),d.edges().forEach(function(g){var $=d.edge(g);has($,"label")||($.label=""),defaults$1($,EDGE_DEFAULT_ATTRS)})}function postProcessGraph(d){forEach(d.nodes(),function(g){var $=d.node(g);has($,"_prevWidth")?$.width=$._prevWidth:delete $.width,has($,"_prevHeight")?$.height=$._prevHeight:delete $.height,delete $._prevWidth,delete $._prevHeight})}function createOrSelectGroup(d,g){var $=d.select("g."+g);return $.empty()&&($=d.append("g").attr("class",g)),$}function Tree({semantics:d,setSvgElem:g}){console.log("rendering tree: ",d);const $=new Graph({directed:!0});$.setGraph({}),$.graph().rankdir=(d==null?void 0:d.rankdir)??"TB",$.graph().ranksep=15,$.graph().nodesep=20,$.setDefaultEdgeLabel(function(){return{}});const b=({node:nt,statusPercentage:rt})=>{const it='"trebuchet ms",verdana,arial,sans-serif',st=nt.intermediate?7:13,ut=nt.intermediate?`font: bold ${st}px ${it};`:`font: 300 ${st}px ${it};`,at=nt.intermediate?"ellipse":"rect",ht=at==="rect"?"stroke: black; stroke-width: 1px; rx: 5px; ry: 5px;":"stroke: black; stroke-width: 1px;",ct={label:wrapLines(nt.label,20).join(` +`),shape:at,style:`${ht} fill:#dff8ff;`,labelStyle:ut+"fill: black;"};nt.intermediate&&(ct.width=5,ct.height=5,ct.style=`${ht} fill:white;`),rt!==void 0&&(rt>=70&&(ct.style=`${ht} fill:#95f795;`),rt<70&&rt>30&&(ct.style=`${ht} fill:#fdfdbe;`),rt<=30&&(ct.style=`${ht} fill:#ffb2b2;`)),console.log("creating node ",nt.key),$.setNode(nt.key,ct)};if(React.useEffect(()=>{const rt=select("svg").select("g"),it=render(),st=select("#tree-svg-container");if(!(st!=null&&st.node()))return;it(rt,$),rt.attr("transform",computeResizeTransform(rt.node(),st.node(),13,13)+", translate(13, 13)");const ut=10;rt.selectAll("g.node .annotation-circle").remove(),rt.selectAll("g.node .annotation-label").remove();const at=rt.selectAll("g.node").filter(function(ct){var vt;return(vt=d==null?void 0:d.nodes.get(ct))==null?void 0:vt.annotation});at.append("circle").attr("class","annotation-circle").attr("cx",function(){const ct=this.parentNode;console.log("elem",ct);const vt=ct.getElementsByTagName("rect")[0];return vt?-vt.width.baseVal.value/2:0}).attr("cy",function(){const ct=this.parentNode;console.log("elem",ct);const vt=ct.getElementsByTagName("rect")[0];return vt?-vt.height.baseVal.value/2:0}).attr("r",ut).style("fill","white").style("stroke","black").style("stroke-width","1px");const ht=ct=>ct&&ct.length<2?11:8;at.append("text").attr("class","annotation-label").style("font-size",function(){var ct;return ht((ct=d==null?void 0:d.nodes.get(this.parentNode.__data__))==null?void 0:ct.annotation)+"px"}).attr("x",function(){const ct=this.parentNode;console.log("elem",ct);const vt=ct.getElementsByTagName("rect")[0];return vt?-vt.width.baseVal.value/2:0}).attr("y",function(){const ct=this.parentNode;console.log("elem",ct);const vt=ct.getElementsByTagName("rect")[0];return vt?-vt.height.baseVal.value/2+1.5:0}).attr("r",ut).text(function(){var ct;return(ct=_e.get(this.parentNode.__data__))==null?void 0:ct.annotation}),g(document.getElementById("treeSvg"))},[d]),!d)return jsxRuntimeExports.jsx("div",{children:" No AST "});const j=({from:nt,to:rt})=>{var st,ut;const it=((st=d.nodes.get(nt))==null?void 0:st.intermediate)||((ut=d.nodes.get(rt))==null?void 0:ut.intermediate);$.setEdge(nt,rt,{curve:basis,style:"stroke: gray; fill:none; stroke-width: 1px;",minlen:it?1:2})},{nodes:_e,edges:et}=d;console.log("{nodes, edges}",{nodes:_e,edges:et});for(const[nt,rt]of _e)b({node:rt,statusPercentage:rt.statusPercentage});for(const nt of et)j({from:nt.from,to:nt.to});const tt=` + .annotation-label { + fill: black; + text-anchor: middle; + font-weight: bold; + alignment-baseline: middle; + } + `;return jsxRuntimeExports.jsx("div",{id:"tree-svg-container",style:{width:"100%",height:"500"},children:jsxRuntimeExports.jsxs("svg",{id:"treeSvg",width:"100%",height:"100%",version:"1.1",preserveAspectRatio:"xMinYMin",viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("style",{children:tt}),jsxRuntimeExports.jsx("g",{})]})})}var rafExports={},raf$1={get exports(){return rafExports},set exports(d){rafExports=d}},performanceNowExports={},performanceNow={get exports(){return performanceNowExports},set exports(d){performanceNowExports=d}};(function(){var d,g,$,b,j,_e;typeof performance<"u"&&performance!==null&&performance.now?performanceNow.exports=function(){return performance.now()}:typeof process<"u"&&process!==null&&process.hrtime?(performanceNow.exports=function(){return(d()-j)/1e6},g=process.hrtime,d=function(){var et;return et=g(),et[0]*1e9+et[1]},b=d(),_e=process.uptime()*1e9,j=b-_e):Date.now?(performanceNow.exports=function(){return Date.now()-$},$=Date.now()):(performanceNow.exports=function(){return new Date().getTime()-$},$=new Date().getTime())}).call(commonjsGlobal);var now=performanceNowExports,root=typeof window>"u"?commonjsGlobal:window,vendors=["moz","webkit"],suffix="AnimationFrame",raf=root["request"+suffix],caf=root["cancel"+suffix]||root["cancelRequest"+suffix];for(var i$1=0;!raf&&i$13&&(this.alpha=tt[3]),this.ok=!0}}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r,this.g=this.g<0||isNaN(this.g)?0:this.g>255?255:this.g,this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b,this.alpha=this.alpha<0?0:this.alpha>1||isNaN(this.alpha)?1:this.alpha,this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"},this.toRGBA=function(){return"rgba("+this.r+", "+this.g+", "+this.b+", "+this.alpha+")"},this.toHex=function(){var nt=this.r.toString(16),rt=this.g.toString(16),it=this.b.toString(16);return nt.length==1&&(nt="0"+nt),rt.length==1&&(rt="0"+rt),it.length==1&&(it="0"+it),"#"+nt+rt+it},this.getHelpXML=function(){for(var nt=new Array,rt=0;rt<$.length;rt++)for(var it=$[rt].example,st=0;st "+ct.toRGB()+" -> "+ct.toHex());ht.appendChild(vt),ht.appendChild(ft),at.appendChild(ht)}catch{}return at}};/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */var t=function(d,g){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function($,b){$.__proto__=b}||function($,b){for(var j in b)Object.prototype.hasOwnProperty.call(b,j)&&($[j]=b[j])})(d,g)};function r(d,g){if(typeof g!="function"&&g!==null)throw new TypeError("Class extends value "+String(g)+" is not a constructor or null");function $(){this.constructor=d}t(d,g),d.prototype=g===null?Object.create(g):($.prototype=g.prototype,new $)}function e(d){var g="";Array.isArray(d)||(d=[d]);for(var $=0;$d.phi1&&(d.phi2-=2*n),d.sweepFlag===1&&d.phi2b)return[];if(b===0)return[[d*$/(d*d+g*g),g*$/(d*d+g*g)]];var j=Math.sqrt(b);return[[(d*$+g*j)/(d*d+g*g),(g*$-d*j)/(d*d+g*g)],[(d*$-g*j)/(d*d+g*g),(g*$+d*j)/(d*d+g*g)]]}var u,h=Math.PI/180;function c$1(d,g,$){return(1-$)*d+$*g}function y(d,g,$,b){return d+Math.cos(b/180*n)*g+Math.sin(b/180*n)*$}function p(d,g,$,b){var j=1e-6,_e=g-d,et=$-g,tt=3*_e+3*(b-$)-6*et,nt=6*(et-_e),rt=3*_e;return Math.abs(tt)St&&(at.sweepFlag=+!at.sweepFlag),at})}function et(){return function(tt){var nt={};for(var rt in tt)nt[rt]=tt[rt];return nt}}d.ROUND=function(tt){function nt(rt){return Math.round(rt*tt)/tt}return tt===void 0&&(tt=1e13),a(tt),function(rt){return rt.x1!==void 0&&(rt.x1=nt(rt.x1)),rt.y1!==void 0&&(rt.y1=nt(rt.y1)),rt.x2!==void 0&&(rt.x2=nt(rt.x2)),rt.y2!==void 0&&(rt.y2=nt(rt.y2)),rt.x!==void 0&&(rt.x=nt(rt.x)),rt.y!==void 0&&(rt.y=nt(rt.y)),rt.rX!==void 0&&(rt.rX=nt(rt.rX)),rt.rY!==void 0&&(rt.rY=nt(rt.rY)),rt}},d.TO_ABS=g,d.TO_REL=function(){return j(function(tt,nt,rt){return tt.relative||(tt.x1!==void 0&&(tt.x1-=nt),tt.y1!==void 0&&(tt.y1-=rt),tt.x2!==void 0&&(tt.x2-=nt),tt.y2!==void 0&&(tt.y2-=rt),tt.x!==void 0&&(tt.x-=nt),tt.y!==void 0&&(tt.y-=rt),tt.relative=!0),tt})},d.NORMALIZE_HVZ=function(tt,nt,rt){return tt===void 0&&(tt=!0),nt===void 0&&(nt=!0),rt===void 0&&(rt=!0),j(function(it,st,ut,at,ht){if(isNaN(at)&&!(it.type&_.MOVE_TO))throw new Error("path must start with moveto");return nt&&it.type&_.HORIZ_LINE_TO&&(it.type=_.LINE_TO,it.y=it.relative?0:ut),rt&&it.type&_.VERT_LINE_TO&&(it.type=_.LINE_TO,it.x=it.relative?0:st),tt&&it.type&_.CLOSE_PATH&&(it.type=_.LINE_TO,it.x=it.relative?at-st:at,it.y=it.relative?ht-ut:ht),it.type&_.ARC&&(it.rX===0||it.rY===0)&&(it.type=_.LINE_TO,delete it.rX,delete it.rY,delete it.xRot,delete it.lArcFlag,delete it.sweepFlag),it})},d.NORMALIZE_ST=$,d.QT_TO_C=b,d.INFO=j,d.SANITIZE=function(tt){tt===void 0&&(tt=0),a(tt);var nt=NaN,rt=NaN,it=NaN,st=NaN;return j(function(ut,at,ht,ct,vt){var ft=Math.abs,gt=!1,pt=0,yt=0;if(ut.type&_.SMOOTH_CURVE_TO&&(pt=isNaN(nt)?0:at-nt,yt=isNaN(rt)?0:ht-rt),ut.type&(_.CURVE_TO|_.SMOOTH_CURVE_TO)?(nt=ut.relative?at+ut.x2:ut.x2,rt=ut.relative?ht+ut.y2:ut.y2):(nt=NaN,rt=NaN),ut.type&_.SMOOTH_QUAD_TO?(it=isNaN(it)?at:2*at-it,st=isNaN(st)?ht:2*ht-st):ut.type&_.QUAD_TO?(it=ut.relative?at+ut.x1:ut.x1,st=ut.relative?ht+ut.y1:ut.y2):(it=NaN,st=NaN),ut.type&_.LINE_COMMANDS||ut.type&_.ARC&&(ut.rX===0||ut.rY===0||!ut.lArcFlag)||ut.type&_.CURVE_TO||ut.type&_.SMOOTH_CURVE_TO||ut.type&_.QUAD_TO||ut.type&_.SMOOTH_QUAD_TO){var At=ut.x===void 0?0:ut.relative?ut.x:ut.x-at,Dt=ut.y===void 0?0:ut.relative?ut.y:ut.y-ht;pt=isNaN(it)?ut.x1===void 0?pt:ut.relative?ut.x:ut.x1-at:it-at,yt=isNaN(st)?ut.y1===void 0?yt:ut.relative?ut.y:ut.y1-ht:st-ht;var St=ut.x2===void 0?0:ut.relative?ut.x:ut.x2-at,Bt=ut.y2===void 0?0:ut.relative?ut.y:ut.y2-ht;ft(At)<=tt&&ft(Dt)<=tt&&ft(pt)<=tt&&ft(yt)<=tt&&ft(St)<=tt&&ft(Bt)<=tt&&(gt=!0)}return ut.type&_.CLOSE_PATH&&ft(at-ct)<=tt&&ft(ht-vt)<=tt&&(gt=!0),gt?[]:ut})},d.MATRIX=_e,d.ROTATE=function(tt,nt,rt){nt===void 0&&(nt=0),rt===void 0&&(rt=0),a(tt,nt,rt);var it=Math.sin(tt),st=Math.cos(tt);return _e(st,it,-it,st,nt-nt*st+rt*it,rt-nt*it-rt*st)},d.TRANSLATE=function(tt,nt){return nt===void 0&&(nt=0),a(tt,nt),_e(1,0,0,1,tt,nt)},d.SCALE=function(tt,nt){return nt===void 0&&(nt=tt),a(tt,nt),_e(tt,0,0,nt,0,0)},d.SKEW_X=function(tt){return a(tt),_e(1,0,Math.atan(tt),1,0,0)},d.SKEW_Y=function(tt){return a(tt),_e(1,Math.atan(tt),0,1,0,0)},d.X_AXIS_SYMMETRY=function(tt){return tt===void 0&&(tt=0),a(tt),_e(-1,0,0,1,tt,0)},d.Y_AXIS_SYMMETRY=function(tt){return tt===void 0&&(tt=0),a(tt),_e(1,0,0,-1,0,tt)},d.A_TO_C=function(){return j(function(tt,nt,rt){return _.ARC===tt.type?function(it,st,ut){var at,ht,ct,vt;it.cX||o(it,st,ut);for(var ft=Math.min(it.phi1,it.phi2),gt=Math.max(it.phi1,it.phi2)-ft,pt=Math.ceil(gt/90),yt=new Array(pt),At=st,Dt=ut,St=0;Stst.maxX&&(st.maxX=jt),jtst.maxY&&(st.maxY=jt),jtLt&&vt(m$1(at,ct.x1,ct.x2,ct.x,Lt));for(var yt=0,At=p(ht,ct.y1,ct.y2,ct.y);ytLt&&ft(m$1(ht,ct.y1,ct.y2,ct.y,Lt))}if(ct.type&_.ARC){vt(ct.x),ft(ct.y),o(ct,at,ht);for(var Dt=ct.xRot/180*Math.PI,St=Math.cos(Dt)*ct.rX,Bt=Math.sin(Dt)*ct.rX,Ot=-Math.sin(Dt)*ct.rY,Ct=Math.cos(Dt)*ct.rY,_t=ct.phi1ct.phi2?[ct.phi2+360,ct.phi1+360]:[ct.phi2,ct.phi1],Tt=_t[0],kt=_t[1],Mt=function(jt){var Yt=jt[0],Qt=jt[1],on=180*Math.atan2(Qt,Yt)/Math.PI;return onTt&&LtTt&&Ltit)throw new SyntaxError('Expected positive number, got "'+it+'" at index "'+et+'"')}else if((this.curArgs.length===3||this.curArgs.length===4)&&this.curNumber!=="0"&&this.curNumber!=="1")throw new SyntaxError('Expected a flag, got "'+this.curNumber+'" at index "'+et+'"')}this.curArgs.push(it),this.curArgs.length===N[this.curCommandType]&&(_.HORIZ_LINE_TO===this.curCommandType?_e({type:_.HORIZ_LINE_TO,relative:this.curCommandRelative,x:it}):_.VERT_LINE_TO===this.curCommandType?_e({type:_.VERT_LINE_TO,relative:this.curCommandRelative,y:it}):this.curCommandType===_.MOVE_TO||this.curCommandType===_.LINE_TO||this.curCommandType===_.SMOOTH_QUAD_TO?(_e({type:this.curCommandType,relative:this.curCommandRelative,x:this.curArgs[0],y:this.curArgs[1]}),_.MOVE_TO===this.curCommandType&&(this.curCommandType=_.LINE_TO)):this.curCommandType===_.CURVE_TO?_e({type:_.CURVE_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x2:this.curArgs[2],y2:this.curArgs[3],x:this.curArgs[4],y:this.curArgs[5]}):this.curCommandType===_.SMOOTH_CURVE_TO?_e({type:_.SMOOTH_CURVE_TO,relative:this.curCommandRelative,x2:this.curArgs[0],y2:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===_.QUAD_TO?_e({type:_.QUAD_TO,relative:this.curCommandRelative,x1:this.curArgs[0],y1:this.curArgs[1],x:this.curArgs[2],y:this.curArgs[3]}):this.curCommandType===_.ARC&&_e({type:_.ARC,relative:this.curCommandRelative,rX:this.curArgs[0],rY:this.curArgs[1],xRot:this.curArgs[2],lArcFlag:this.curArgs[3],sweepFlag:this.curArgs[4],x:this.curArgs[5],y:this.curArgs[6]})),this.curNumber="",this.curNumberHasExpDigits=!1,this.curNumberHasExp=!1,this.curNumberHasDecimal=!1,this.canParseCommandOrComma=!0}if(!T(tt))if(tt===","&&this.canParseCommandOrComma)this.canParseCommandOrComma=!1;else if(tt!=="+"&&tt!=="-"&&tt!==".")if(rt)this.curNumber=tt,this.curNumberHasDecimal=!1;else{if(this.curArgs.length!==0)throw new SyntaxError("Unterminated command at index "+et+".");if(!this.canParseCommandOrComma)throw new SyntaxError('Unexpected character "'+tt+'" at index '+et+". Command cannot follow comma");if(this.canParseCommandOrComma=!1,tt!=="z"&&tt!=="Z")if(tt==="h"||tt==="H")this.curCommandType=_.HORIZ_LINE_TO,this.curCommandRelative=tt==="h";else if(tt==="v"||tt==="V")this.curCommandType=_.VERT_LINE_TO,this.curCommandRelative=tt==="v";else if(tt==="m"||tt==="M")this.curCommandType=_.MOVE_TO,this.curCommandRelative=tt==="m";else if(tt==="l"||tt==="L")this.curCommandType=_.LINE_TO,this.curCommandRelative=tt==="l";else if(tt==="c"||tt==="C")this.curCommandType=_.CURVE_TO,this.curCommandRelative=tt==="c";else if(tt==="s"||tt==="S")this.curCommandType=_.SMOOTH_CURVE_TO,this.curCommandRelative=tt==="s";else if(tt==="q"||tt==="Q")this.curCommandType=_.QUAD_TO,this.curCommandRelative=tt==="q";else if(tt==="t"||tt==="T")this.curCommandType=_.SMOOTH_QUAD_TO,this.curCommandRelative=tt==="t";else{if(tt!=="a"&&tt!=="A")throw new SyntaxError('Unexpected character "'+tt+'" at index '+et+".");this.curCommandType=_.ARC,this.curCommandRelative=tt==="a"}else b.push({type:_.CLOSE_PATH}),this.canParseCommandOrComma=!0,this.curCommandType=-1}else this.curNumber=tt,this.curNumberHasDecimal=tt==="."}else this.curNumber+=tt,this.curNumberHasDecimal=!0;else this.curNumber+=tt;else this.curNumber+=tt,this.curNumberHasExp=!0;else this.curNumber+=tt,this.curNumberHasExpDigits=this.curNumberHasExp}return b},g.prototype.transform=function($){return Object.create(this,{parse:{value:function(b,j){j===void 0&&(j=[]);for(var _e=0,et=Object.getPrototypeOf(this).parse.call(this,b);_e>At;if(et[pt+3]=On,On!==0){var Pn=255/On;et[pt]=(jt*yt>>At)*Pn,et[pt+1]=(Yt*yt>>At)*Pn,et[pt+2]=(Qt*yt>>At)*Pn}else et[pt]=et[pt+1]=et[pt+2]=0;jt-=Jt,Yt-=Xt,Qt-=Nt,on-=Lt,Jt-=vt.r,Xt-=vt.g,Nt-=vt.b,Lt-=vt.a;var Cn=Nn+_e+1;Cn=gt+(Cn>At,cn>0?(cn=255/cn,et[rn]=(It*yt>>At)*cn,et[rn+1]=(Wt*yt>>At)*cn,et[rn+2]=(Gt*yt>>At)*cn):et[rn]=et[rn+1]=et[rn+2]=0,It-=$t,Wt-=bt,Gt-=Rt,Zt-=Ut,$t-=vt.r,bt-=vt.g,Rt-=vt.b,Ut-=vt.a,rn=xn+((rn=bn+it)0&&arguments[0]!==void 0?arguments[0]:{};const g={window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:d,createCanvas($,b){return new OffscreenCanvas($,b)},async createImage($){const j=await(await fetch($)).blob();return await createImageBitmap(j)}};return(typeof globalThis.DOMParser<"u"||typeof d>"u")&&Reflect.deleteProperty(g,"DOMParser"),g}function node(d){let{DOMParser:g,canvas:$,fetch:b}=d;return{window:null,ignoreAnimation:!0,ignoreMouse:!0,DOMParser:g,fetch:b,createCanvas:$.createCanvas,createImage:$.loadImage}}var index=Object.freeze({__proto__:null,offscreen,node});function compressSpaces(d){return d.replace(/(?!\u3000)\s+/gm," ")}function trimLeft(d){return d.replace(/^[\n \t]+/,"")}function trimRight(d){return d.replace(/[\n \t]+$/,"")}function toNumbers(d){const g=d.match(/-?(\d+(?:\.\d*(?:[eE][+-]?\d+)?)?|\.\d+)(?=\D|$)/gm);return g?g.map(parseFloat):[]}function toMatrixValue(d){const g=toNumbers(d);return[g[0]||0,g[1]||0,g[2]||0,g[3]||0,g[4]||0,g[5]||0]}const allUppercase=/^[A-Z-]+$/;function normalizeAttributeName(d){return allUppercase.test(d)?d.toLowerCase():d}function parseExternalUrl(d){const g=/url\(('([^']+)'|"([^"]+)"|([^'")]+))\)/.exec(d);return g&&(g[2]||g[3]||g[4])||""}function normalizeColor(d){if(!d.startsWith("rgb"))return d;let g=3;return d.replace(/\d+(\.\d+)?/g,(b,j)=>g--&&j?String(Math.round(parseFloat(b))):b)}const attributeRegex=/(\[[^\]]+\])/g,idRegex=/(#[^\s+>~.[:]+)/g,classRegex=/(\.[^\s+>~.[:]+)/g,pseudoElementRegex=/(::[^\s+>~.[:]+|:first-line|:first-letter|:before|:after)/gi,pseudoClassWithBracketsRegex=/(:[\w-]+\([^)]*\))/gi,pseudoClassRegex=/(:[^\s+>~.[:]+)/g,elementRegex=/([^\s+>~.[:]+)/g;function findSelectorMatch(d,g){const $=g.exec(d);return $?[d.replace(g," "),$.length]:[d,0]}function getSelectorSpecificity(d){const g=[0,0,0];let $=d.replace(/:not\(([^)]*)\)/g," $1 ").replace(/{[\s\S]*/gm," "),b=0;return[$,b]=findSelectorMatch($,attributeRegex),g[1]+=b,[$,b]=findSelectorMatch($,idRegex),g[0]+=b,[$,b]=findSelectorMatch($,classRegex),g[1]+=b,[$,b]=findSelectorMatch($,pseudoElementRegex),g[2]+=b,[$,b]=findSelectorMatch($,pseudoClassWithBracketsRegex),g[1]+=b,[$,b]=findSelectorMatch($,pseudoClassRegex),g[1]+=b,$=$.replace(/[*\s+>~]/g," ").replace(/[#.]/g," "),[$,b]=findSelectorMatch($,elementRegex),g[2]+=b,g.join("")}const PSEUDO_ZERO=1e-8;function vectorMagnitude(d){return Math.sqrt(Math.pow(d[0],2)+Math.pow(d[1],2))}function vectorsRatio(d,g){return(d[0]*g[0]+d[1]*g[1])/(vectorMagnitude(d)*vectorMagnitude(g))}function vectorsAngle(d,g){return(d[0]*g[1]0&&arguments[0]!==void 0?arguments[0]:" ";const{document:$,name:b}=this;return compressSpaces(this.getString()).trim().split(g).map(j=>new Property($,b,j))}hasValue(g){const $=this.value;return $!==null&&$!==""&&(g||$!==0)&&typeof $<"u"}isString(g){const{value:$}=this,b=typeof $=="string";return!b||!g?b:g.test($)}isUrlDefinition(){return this.isString(/^url\(/)}isPixels(){if(!this.hasValue())return!1;const g=this.getString();switch(!0){case g.endsWith("px"):case/^[0-9]+$/.test(g):return!0;default:return!1}}setValue(g){return this.value=g,this}getValue(g){return typeof g>"u"||this.hasValue()?this.value:g}getNumber(g){if(!this.hasValue())return typeof g>"u"?0:parseFloat(g);const{value:$}=this;let b=parseFloat($);return this.isString(/%$/)&&(b/=100),b}getString(g){return typeof g>"u"||this.hasValue()?typeof this.value>"u"?"":String(this.value):String(g)}getColor(g){let $=this.getString(g);return this.isNormalizedColor||(this.isNormalizedColor=!0,$=normalizeColor($),this.value=$),$}getDpi(){return 96}getRem(){return this.document.rootEmSize}getEm(){return this.document.emSize}getUnits(){return this.getString().replace(/[0-9.-]/g,"")}getPixels(g){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(!this.hasValue())return 0;const[b,j]=typeof g=="boolean"?[void 0,g]:[g],{viewPort:_e}=this.document.screen;switch(!0){case this.isString(/vmin$/):return this.getNumber()/100*Math.min(_e.computeSize("x"),_e.computeSize("y"));case this.isString(/vmax$/):return this.getNumber()/100*Math.max(_e.computeSize("x"),_e.computeSize("y"));case this.isString(/vw$/):return this.getNumber()/100*_e.computeSize("x");case this.isString(/vh$/):return this.getNumber()/100*_e.computeSize("y");case this.isString(/rem$/):return this.getNumber()*this.getRem();case this.isString(/em$/):return this.getNumber()*this.getEm();case this.isString(/ex$/):return this.getNumber()*this.getEm()/2;case this.isString(/px$/):return this.getNumber();case this.isString(/pt$/):return this.getNumber()*this.getDpi()*(1/72);case this.isString(/pc$/):return this.getNumber()*15;case this.isString(/cm$/):return this.getNumber()*this.getDpi()/2.54;case this.isString(/mm$/):return this.getNumber()*this.getDpi()/25.4;case this.isString(/in$/):return this.getNumber()*this.getDpi();case(this.isString(/%$/)&&j):return this.getNumber()*this.getEm();case this.isString(/%$/):return this.getNumber()*_e.computeSize(b);default:{const et=this.getNumber();return $&&et<1?et*_e.computeSize(b):et}}}getMilliseconds(){return this.hasValue()?this.isString(/ms$/)?this.getNumber():this.getNumber()*1e3:0}getRadians(){if(!this.hasValue())return 0;switch(!0){case this.isString(/deg$/):return this.getNumber()*(Math.PI/180);case this.isString(/grad$/):return this.getNumber()*(Math.PI/200);case this.isString(/rad$/):return this.getNumber();default:return this.getNumber()*(Math.PI/180)}}getDefinition(){const g=this.getString(),$=/#([^)'"]+)/.exec(g),b=($==null?void 0:$[1])||g;return this.document.definitions[b]}getFillStyleDefinition(g,$){let b=this.getDefinition();if(!b)return null;if(typeof b.createGradient=="function"&&"getBoundingBox"in g)return b.createGradient(this.document.ctx,g,$);if(typeof b.createPattern=="function"){if(b.getHrefAttribute().hasValue()){const j=b.getAttribute("patternTransform");b=b.getHrefAttribute().getDefinition(),b&&j.hasValue()&&b.getAttribute("patternTransform",!0).setValue(j.value)}if(b)return b.createPattern(this.document.ctx,g,$)}return null}getTextBaseline(){if(!this.hasValue())return null;const g=this.getString();return Property.textBaselineMapping[g]||null}addOpacity(g){let $=this.getColor();const b=$.length;let j=0;for(let _e=0;_e1&&arguments[1]!==void 0?arguments[1]:0;const[b=$,j=$]=toNumbers(g);return new Point(b,j)}static parseScale(g){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1;const[b=$,j=b]=toNumbers(g);return new Point(b,j)}static parsePath(g){const $=toNumbers(g),b=$.length,j=[];for(let _e=0;_e0}runEvents(){if(!this.working)return;const{screen:g,events:$,eventElements:b}=this,{style:j}=g.ctx.canvas;let _e;j&&(j.cursor=""),$.forEach((et,tt)=>{let{run:nt}=et;for(_e=b[tt];_e;)nt(_e),_e=_e.parent}),this.events=[],this.eventElements=[]}checkPath(g,$){if(!this.working||!$)return;const{events:b,eventElements:j}=this;b.forEach((_e,et)=>{let{x:tt,y:nt}=_e;!j[et]&&$.isPointInPath&&$.isPointInPath(tt,nt)&&(j[et]=g)})}checkBoundingBox(g,$){if(!this.working||!$)return;const{events:b,eventElements:j}=this;b.forEach((_e,et)=>{let{x:tt,y:nt}=_e;!j[et]&&$.isPointInBox(tt,nt)&&(j[et]=g)})}mapXY(g,$){const{window:b,ctx:j}=this.screen,_e=new Point(g,$);let et=j.canvas;for(;et;)_e.x-=et.offsetLeft,_e.y-=et.offsetTop,et=et.offsetParent;return b!=null&&b.scrollX&&(_e.x+=b.scrollX),b!=null&&b.scrollY&&(_e.y+=b.scrollY),_e}onClick(g){const{x:$,y:b}=this.mapXY(g.clientX,g.clientY);this.events.push({type:"onclick",x:$,y:b,run(j){j.onClick&&j.onClick()}})}onMouseMove(g){const{x:$,y:b}=this.mapXY(g.clientX,g.clientY);this.events.push({type:"onmousemove",x:$,y:b,run(j){j.onMouseMove&&j.onMouseMove()}})}constructor(g){this.screen=g,this.working=!1,this.events=[],this.eventElements=[],this.onClick=this.onClick.bind(this),this.onMouseMove=this.onMouseMove.bind(this)}}const defaultWindow=typeof window<"u"?window:null,defaultFetch$1=typeof fetch<"u"?fetch.bind(void 0):void 0;class Screen{wait(g){this.waits.push(g)}ready(){return this.readyPromise?this.readyPromise:Promise.resolve()}isReady(){if(this.isReadyLock)return!0;const g=this.waits.every($=>$());return g&&(this.waits=[],this.resolveReady&&this.resolveReady()),this.isReadyLock=g,g}setDefaults(g){g.strokeStyle="rgba(0,0,0,0)",g.lineCap="butt",g.lineJoin="miter",g.miterLimit=4}setViewBox(g){let{document:$,ctx:b,aspectRatio:j,width:_e,desiredWidth:et,height:tt,desiredHeight:nt,minX:rt=0,minY:it=0,refX:st,refY:ut,clip:at=!1,clipX:ht=0,clipY:ct=0}=g;const vt=compressSpaces(j).replace(/^defer\s/,""),[ft,gt]=vt.split(" "),pt=ft||"xMidYMid",yt=gt||"meet",At=_e/et,Dt=tt/nt,St=Math.min(At,Dt),Bt=Math.max(At,Dt);let Ot=et,Ct=nt;yt==="meet"&&(Ot*=St,Ct*=St),yt==="slice"&&(Ot*=Bt,Ct*=Bt);const _t=new Property($,"refX",st),Tt=new Property($,"refY",ut),kt=_t.hasValue()&&Tt.hasValue();if(kt&&b.translate(-St*_t.getPixels("x"),-St*Tt.getPixels("y")),at){const Mt=St*ht,Vt=St*ct;b.beginPath(),b.moveTo(Mt,Vt),b.lineTo(_e,Vt),b.lineTo(_e,tt),b.lineTo(Mt,tt),b.closePath(),b.clip()}if(!kt){const Mt=yt==="meet"&&St===Dt,Vt=yt==="slice"&&Bt===Dt,Jt=yt==="meet"&&St===At,Xt=yt==="slice"&&Bt===At;pt.startsWith("xMid")&&(Mt||Vt)&&b.translate(_e/2-Ot/2,0),pt.endsWith("YMid")&&(Jt||Xt)&&b.translate(0,tt/2-Ct/2),pt.startsWith("xMax")&&(Mt||Vt)&&b.translate(_e-Ot,0),pt.endsWith("YMax")&&(Jt||Xt)&&b.translate(0,tt-Ct)}switch(!0){case pt==="none":b.scale(At,Dt);break;case yt==="meet":b.scale(St,St);break;case yt==="slice":b.scale(Bt,Bt);break}b.translate(-rt,-it)}start(g){let{enableRedraw:$=!1,ignoreMouse:b=!1,ignoreAnimation:j=!1,ignoreDimensions:_e=!1,ignoreClear:et=!1,forceRedraw:tt,scaleWidth:nt,scaleHeight:rt,offsetX:it,offsetY:st}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const{mouse:ut}=this,at=1e3/Screen.FRAMERATE;if(this.isReadyLock=!1,this.frameDuration=at,this.readyPromise=new Promise(gt=>{this.resolveReady=gt}),this.isReady()&&this.render(g,_e,et,nt,rt,it,st),!$)return;let ht=Date.now(),ct=ht,vt=0;const ft=()=>{ht=Date.now(),vt=ht-ct,vt>=at&&(ct=ht-vt%at,this.shouldUpdate(j,tt)&&(this.render(g,_e,et,nt,rt,it,st),ut.runEvents())),this.intervalId=rafExports(ft)};b||ut.start(),this.intervalId=rafExports(ft)}stop(){this.intervalId&&(rafExports.cancel(this.intervalId),this.intervalId=null),this.mouse.stop()}shouldUpdate(g,$){if(!g){const{frameDuration:b}=this;if(this.animations.reduce((_e,et)=>et.update(b)||_e,!1))return!0}return!!(typeof $=="function"&&$()||!this.isReadyLock&&this.isReady()||this.mouse.hasEvents())}render(g,$,b,j,_e,et,tt){const{viewPort:nt,ctx:rt,isFirstRender:it}=this,st=rt.canvas;nt.clear(),st.width&&st.height&&nt.setCurrent(st.width,st.height);const ut=g.getStyle("width"),at=g.getStyle("height");!$&&(it||typeof j!="number"&&typeof _e!="number")&&(ut.hasValue()&&(st.width=ut.getPixels("x"),st.style&&(st.style.width="".concat(st.width,"px"))),at.hasValue()&&(st.height=at.getPixels("y"),st.style&&(st.style.height="".concat(st.height,"px"))));let ht=st.clientWidth||st.width,ct=st.clientHeight||st.height;if($&&ut.hasValue()&&at.hasValue()&&(ht=ut.getPixels("x"),ct=at.getPixels("y")),nt.setCurrent(ht,ct),typeof et=="number"&&g.getAttribute("x",!0).setValue(et),typeof tt=="number"&&g.getAttribute("y",!0).setValue(tt),typeof j=="number"||typeof _e=="number"){const vt=toNumbers(g.getAttribute("viewBox").getString());let ft=0,gt=0;if(typeof j=="number"){const yt=g.getStyle("width");yt.hasValue()?ft=yt.getPixels("x")/j:vt[2]&&!isNaN(vt[2])&&(ft=vt[2]/j)}if(typeof _e=="number"){const yt=g.getStyle("height");yt.hasValue()?gt=yt.getPixels("y")/_e:vt[3]&&!isNaN(vt[3])&&(gt=vt[3]/_e)}ft||(ft=gt),gt||(gt=ft),g.getAttribute("width",!0).setValue(j),g.getAttribute("height",!0).setValue(_e);const pt=g.getStyle("transform",!0,!0);pt.setValue("".concat(pt.getString()," scale(").concat(1/ft,", ").concat(1/gt,")"))}b||rt.clearRect(0,0,ht,ct),g.render(rt),it&&(this.isFirstRender=!1)}constructor(g,{fetch:$=defaultFetch$1,window:b=defaultWindow}={}){if(this.ctx=g,this.viewPort=new ViewPort,this.mouse=new Mouse(this),this.animations=[],this.waits=[],this.frameDuration=0,this.isReadyLock=!1,this.isFirstRender=!0,this.intervalId=null,this.window=b,!$)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");this.fetch=$}}Screen.defaultWindow=defaultWindow;Screen.defaultFetch=defaultFetch$1;Screen.FRAMERATE=30;Screen.MAX_VIRTUAL_PIXELS=3e4;const{defaultFetch}=Screen,DefaultDOMParser=typeof DOMParser<"u"?DOMParser:void 0;class Parser{async parse(g){return g.startsWith("<")?this.parseFromString(g):this.load(g)}parseFromString(g){const $=new this.DOMParser;try{return this.checkDocument($.parseFromString(g,"image/svg+xml"))}catch{return this.checkDocument($.parseFromString(g,"text/xml"))}}checkDocument(g){const $=g.getElementsByTagName("parsererror")[0];if($)throw new Error($.textContent||"Unknown parse error");return g}async load(g){const b=await(await this.fetch(g)).text();return this.parseFromString(b)}constructor({fetch:g=defaultFetch,DOMParser:$=DefaultDOMParser}={}){if(!g)throw new Error("Can't find 'fetch' in 'globalThis', please provide it via options");if(!$)throw new Error("Can't find 'DOMParser' in 'globalThis', please provide it via options");this.fetch=g,this.DOMParser=$}}class Translate{apply(g){const{x:$,y:b}=this.point;g.translate($||0,b||0)}unapply(g){const{x:$,y:b}=this.point;g.translate(-1*$||0,-1*b||0)}applyToPoint(g){const{x:$,y:b}=this.point;g.applyTransform([1,0,0,1,$||0,b||0])}constructor(g,$){this.type="translate",this.point=Point.parse($)}}class Rotate{apply(g){const{cx:$,cy:b,originX:j,originY:_e,angle:et}=this,tt=$+j.getPixels("x"),nt=b+_e.getPixels("y");g.translate(tt,nt),g.rotate(et.getRadians()),g.translate(-tt,-nt)}unapply(g){const{cx:$,cy:b,originX:j,originY:_e,angle:et}=this,tt=$+j.getPixels("x"),nt=b+_e.getPixels("y");g.translate(tt,nt),g.rotate(-1*et.getRadians()),g.translate(-tt,-nt)}applyToPoint(g){const{cx:$,cy:b,angle:j}=this,_e=j.getRadians();g.applyTransform([1,0,0,1,$||0,b||0]),g.applyTransform([Math.cos(_e),Math.sin(_e),-Math.sin(_e),Math.cos(_e),0,0]),g.applyTransform([1,0,0,1,-$||0,-b||0])}constructor(g,$,b){this.type="rotate";const j=toNumbers($);this.angle=new Property(g,"angle",j[0]),this.originX=b[0],this.originY=b[1],this.cx=j[1]||0,this.cy=j[2]||0}}class Scale{apply(g){const{scale:{x:$,y:b},originX:j,originY:_e}=this,et=j.getPixels("x"),tt=_e.getPixels("y");g.translate(et,tt),g.scale($,b||$),g.translate(-et,-tt)}unapply(g){const{scale:{x:$,y:b},originX:j,originY:_e}=this,et=j.getPixels("x"),tt=_e.getPixels("y");g.translate(et,tt),g.scale(1/$,1/b||$),g.translate(-et,-tt)}applyToPoint(g){const{x:$,y:b}=this.scale;g.applyTransform([$||0,0,0,b||0,0,0])}constructor(g,$,b){this.type="scale";const j=Point.parseScale($);(j.x===0||j.y===0)&&(j.x=PSEUDO_ZERO,j.y=PSEUDO_ZERO),this.scale=j,this.originX=b[0],this.originY=b[1]}}class Matrix{apply(g){const{originX:$,originY:b,matrix:j}=this,_e=$.getPixels("x"),et=b.getPixels("y");g.translate(_e,et),g.transform(j[0],j[1],j[2],j[3],j[4],j[5]),g.translate(-_e,-et)}unapply(g){const{originX:$,originY:b,matrix:j}=this,_e=j[0],et=j[2],tt=j[4],nt=j[1],rt=j[3],it=j[5],st=0,ut=0,at=1,ht=1/(_e*(rt*at-it*ut)-et*(nt*at-it*st)+tt*(nt*ut-rt*st)),ct=$.getPixels("x"),vt=b.getPixels("y");g.translate(ct,vt),g.transform(ht*(rt*at-it*ut),ht*(it*st-nt*at),ht*(tt*ut-et*at),ht*(_e*at-tt*st),ht*(et*it-tt*rt),ht*(tt*nt-_e*it)),g.translate(-ct,-vt)}applyToPoint(g){g.applyTransform(this.matrix)}constructor(g,$,b){this.type="matrix",this.matrix=toMatrixValue($),this.originX=b[0],this.originY=b[1]}}class Skew extends Matrix{constructor(g,$,b){super(g,$,b),this.type="skew",this.angle=new Property(g,"angle",$)}}class SkewX extends Skew{constructor(g,$,b){super(g,$,b),this.type="skewX",this.matrix=[1,0,Math.tan(this.angle.getRadians()),1,0,0]}}class SkewY extends Skew{constructor(g,$,b){super(g,$,b),this.type="skewY",this.matrix=[1,Math.tan(this.angle.getRadians()),0,1,0,0]}}function parseTransforms(d){return compressSpaces(d).trim().replace(/\)([a-zA-Z])/g,") $1").replace(/\)(\s?,\s?)/g,") ").split(/\s(?=[a-z])/)}function parseTransform(d){const[g="",$=""]=d.split("(");return[g.trim(),$.trim().replace(")","")]}class Transform{static fromElement(g,$){const b=$.getStyle("transform",!1,!0);if(b.hasValue()){const[j,_e=j]=$.getStyle("transform-origin",!1,!0).split();if(j&&_e){const et=[j,_e];return new Transform(g,b.getString(),et)}}return null}apply(g){this.transforms.forEach($=>$.apply(g))}unapply(g){this.transforms.forEach($=>$.unapply(g))}applyToPoint(g){this.transforms.forEach($=>$.applyToPoint(g))}constructor(g,$,b){this.document=g,this.transforms=[],parseTransforms($).forEach(_e=>{if(_e==="none")return;const[et,tt]=parseTransform(_e),nt=Transform.transformTypes[et];nt&&this.transforms.push(new nt(this.document,tt,b))})}}Transform.transformTypes={translate:Translate,rotate:Rotate,scale:Scale,matrix:Matrix,skewX:SkewX,skewY:SkewY};class Element{getAttribute(g){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const b=this.attributes[g];if(!b&&$){const j=new Property(this.document,g,"");return this.attributes[g]=j,j}return b||Property.empty(this.document)}getHrefAttribute(){let g;for(const $ in this.attributes)if($==="href"||$.endsWith(":href")){g=this.attributes[$];break}return g||Property.empty(this.document)}getStyle(g){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const j=this.styles[g];if(j)return j;const _e=this.getAttribute(g);if(_e.hasValue())return this.styles[g]=_e,_e;if(!b){const{parent:et}=this;if(et){const tt=et.getStyle(g);if(tt.hasValue())return tt}}if($){const et=new Property(this.document,g,"");return this.styles[g]=et,et}return Property.empty(this.document)}render(g){if(!(this.getStyle("display").getString()==="none"||this.getStyle("visibility").getString()==="hidden")){if(g.save(),this.getStyle("mask").hasValue()){const $=this.getStyle("mask").getDefinition();$&&(this.applyEffects(g),$.apply(g,this))}else if(this.getStyle("filter").getValue("none")!=="none"){const $=this.getStyle("filter").getDefinition();$&&(this.applyEffects(g),$.apply(g,this))}else this.setContext(g),this.renderChildren(g),this.clearContext(g);g.restore()}}setContext(g){}applyEffects(g){const $=Transform.fromElement(this.document,this);$&&$.apply(g);const b=this.getStyle("clip-path",!1,!0);if(b.hasValue()){const j=b.getDefinition();j&&j.apply(g)}}clearContext(g){}renderChildren(g){this.children.forEach($=>{$.render(g)})}addChild(g){const $=g instanceof Element?g:this.document.createElement(g);$.parent=this,Element.ignoreChildTypes.includes($.type)||this.children.push($)}matchesSelector(g){var $;const{node:b}=this;if(typeof b.matches=="function")return b.matches(g);const j=($=b.getAttribute)===null||$===void 0?void 0:$.call(b,"class");return!j||j===""?!1:j.split(" ").some(_e=>".".concat(_e)===g)}addStylesFromStyleDefinition(){const{styles:g,stylesSpecificity:$}=this.document;let b;for(const j in g)if(!j.startsWith("@")&&this.matchesSelector(j)){const _e=g[j],et=$[j];if(_e)for(const tt in _e){let nt=this.stylesSpecificity[tt];typeof nt>"u"&&(nt="000"),et&&et>=nt&&(b=_e[tt],b&&(this.styles[tt]=b),this.stylesSpecificity[tt]=et)}}}removeStyles(g,$){return $.reduce((j,_e)=>{const et=g.getStyle(_e);if(!et.hasValue())return j;const tt=et.getString();return et.setValue(""),[...j,[_e,tt]]},[])}restoreStyles(g,$){$.forEach(b=>{let[j,_e]=b;g.getStyle(j,!0).setValue(_e)})}isFirstChild(){var g;return((g=this.parent)===null||g===void 0?void 0:g.children.indexOf(this))===0}constructor(g,$,b=!1){if(this.document=g,this.node=$,this.captureTextNodes=b,this.type="",this.attributes={},this.styles={},this.stylesSpecificity={},this.animationFrozen=!1,this.animationFrozenValue="",this.parent=null,this.children=[],!$||$.nodeType!==1)return;Array.from($.attributes).forEach(et=>{const tt=normalizeAttributeName(et.nodeName);this.attributes[tt]=new Property(g,tt,et.value)}),this.addStylesFromStyleDefinition(),this.getAttribute("style").hasValue()&&this.getAttribute("style").getString().split(";").map(tt=>tt.trim()).forEach(tt=>{if(!tt)return;const[nt,rt]=tt.split(":").map(it=>it.trim());nt&&(this.styles[nt]=new Property(g,nt,rt))});const{definitions:j}=g,_e=this.getAttribute("id");_e.hasValue()&&(j[_e.getString()]||(j[_e.getString()]=this)),Array.from($.childNodes).forEach(et=>{if(et.nodeType===1)this.addChild(et);else if(b&&(et.nodeType===3||et.nodeType===4)){const tt=g.createTextNode(et);tt.getText().length>0&&this.addChild(tt)}})}}Element.ignoreChildTypes=["title"];class UnknownElement extends Element{constructor(g,$,b){super(g,$,b)}}function wrapFontFamily(d){const g=d.trim();return/^('|")/.test(g)?g:'"'.concat(g,'"')}function prepareFontFamily(d){return typeof process>"u"?d:d.trim().split(",").map(wrapFontFamily).join(",")}function prepareFontStyle(d){if(!d)return"";const g=d.trim().toLowerCase();switch(g){case"normal":case"italic":case"oblique":case"inherit":case"initial":case"unset":return g;default:return/^oblique\s+(-|)\d+deg$/.test(g)?g:""}}function prepareFontWeight(d){if(!d)return"";const g=d.trim().toLowerCase();switch(g){case"normal":case"bold":case"lighter":case"bolder":case"inherit":case"initial":case"unset":return g;default:return/^[\d.]+$/.test(g)?g:""}}class Font{static parse(){let g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",$=arguments.length>1?arguments[1]:void 0,b="",j="",_e="",et="",tt="";const nt=compressSpaces(g).trim().split(" "),rt={fontSize:!1,fontStyle:!1,fontWeight:!1,fontVariant:!1};return nt.forEach(it=>{switch(!0){case(!rt.fontStyle&&Font.styles.includes(it)):it!=="inherit"&&(b=it),rt.fontStyle=!0;break;case(!rt.fontVariant&&Font.variants.includes(it)):it!=="inherit"&&(j=it),rt.fontStyle=!0,rt.fontVariant=!0;break;case(!rt.fontWeight&&Font.weights.includes(it)):it!=="inherit"&&(_e=it),rt.fontStyle=!0,rt.fontVariant=!0,rt.fontWeight=!0;break;case!rt.fontSize:it!=="inherit"&&(et=it.split("/")[0]||""),rt.fontStyle=!0,rt.fontVariant=!0,rt.fontWeight=!0,rt.fontSize=!0;break;default:it!=="inherit"&&(tt+=it)}}),new Font(b,j,_e,et,tt,$)}toString(){return[prepareFontStyle(this.fontStyle),this.fontVariant,prepareFontWeight(this.fontWeight),this.fontSize,prepareFontFamily(this.fontFamily)].join(" ").trim()}constructor(g,$,b,j,_e,et){const tt=et?typeof et=="string"?Font.parse(et):et:{};this.fontFamily=_e||tt.fontFamily,this.fontSize=j||tt.fontSize,this.fontStyle=g||tt.fontStyle,this.fontWeight=b||tt.fontWeight,this.fontVariant=$||tt.fontVariant}}Font.styles="normal|italic|oblique|inherit";Font.variants="normal|small-caps|inherit";Font.weights="normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900|inherit";class BoundingBox{get x(){return this.x1}get y(){return this.y1}get width(){return this.x2-this.x1}get height(){return this.y2-this.y1}addPoint(g,$){typeof g<"u"&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=g,this.x2=g),gthis.x2&&(this.x2=g)),typeof $<"u"&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=$,this.y2=$),$this.y2&&(this.y2=$))}addX(g){this.addPoint(g,0)}addY(g){this.addPoint(0,g)}addBoundingBox(g){if(!g)return;const{x1:$,y1:b,x2:j,y2:_e}=g;this.addPoint($,b),this.addPoint(j,_e)}sumCubic(g,$,b,j,_e){return Math.pow(1-g,3)*$+3*Math.pow(1-g,2)*g*b+3*(1-g)*Math.pow(g,2)*j+Math.pow(g,3)*_e}bezierCurveAdd(g,$,b,j,_e){const et=6*$-12*b+6*j,tt=-3*$+9*b-9*j+3*_e,nt=3*b-3*$;if(tt===0){if(et===0)return;const ut=-nt/et;01&&arguments[1]!==void 0?arguments[1]:!1;if(!$){const b=this.getStyle("fill"),j=this.getStyle("fill-opacity"),_e=this.getStyle("stroke"),et=this.getStyle("stroke-opacity");if(b.isUrlDefinition()){const at=b.getFillStyleDefinition(this,j);at&&(g.fillStyle=at)}else if(b.hasValue()){b.getString()==="currentColor"&&b.setValue(this.getStyle("color").getColor());const at=b.getColor();at!=="inherit"&&(g.fillStyle=at==="none"?"rgba(0,0,0,0)":at)}if(j.hasValue()){const at=new Property(this.document,"fill",g.fillStyle).addOpacity(j).getColor();g.fillStyle=at}if(_e.isUrlDefinition()){const at=_e.getFillStyleDefinition(this,et);at&&(g.strokeStyle=at)}else if(_e.hasValue()){_e.getString()==="currentColor"&&_e.setValue(this.getStyle("color").getColor());const at=_e.getString();at!=="inherit"&&(g.strokeStyle=at==="none"?"rgba(0,0,0,0)":at)}if(et.hasValue()){const at=new Property(this.document,"stroke",g.strokeStyle).addOpacity(et).getString();g.strokeStyle=at}const tt=this.getStyle("stroke-width");if(tt.hasValue()){const at=tt.getPixels();g.lineWidth=at||PSEUDO_ZERO}const nt=this.getStyle("stroke-linecap"),rt=this.getStyle("stroke-linejoin"),it=this.getStyle("stroke-miterlimit"),st=this.getStyle("stroke-dasharray"),ut=this.getStyle("stroke-dashoffset");if(nt.hasValue()&&(g.lineCap=nt.getString()),rt.hasValue()&&(g.lineJoin=rt.getString()),it.hasValue()&&(g.miterLimit=it.getNumber()),st.hasValue()&&st.getString()!=="none"){const at=toNumbers(st.getString());typeof g.setLineDash<"u"?g.setLineDash(at):typeof g.webkitLineDash<"u"?g.webkitLineDash=at:typeof g.mozDash<"u"&&!(at.length===1&&at[0]===0)&&(g.mozDash=at);const ht=ut.getPixels();typeof g.lineDashOffset<"u"?g.lineDashOffset=ht:typeof g.webkitLineDashOffset<"u"?g.webkitLineDashOffset=ht:typeof g.mozDashOffset<"u"&&(g.mozDashOffset=ht)}}if(this.modifiedEmSizeStack=!1,typeof g.font<"u"){const b=this.getStyle("font"),j=this.getStyle("font-style"),_e=this.getStyle("font-variant"),et=this.getStyle("font-weight"),tt=this.getStyle("font-size"),nt=this.getStyle("font-family"),rt=new Font(j.getString(),_e.getString(),et.getString(),tt.hasValue()?"".concat(tt.getPixels(!0),"px"):"",nt.getString(),Font.parse(b.getString(),g.font));j.setValue(rt.fontStyle),_e.setValue(rt.fontVariant),et.setValue(rt.fontWeight),tt.setValue(rt.fontSize),nt.setValue(rt.fontFamily),g.font=rt.toString(),tt.isPixels()&&(this.document.emSize=tt.getPixels(),this.modifiedEmSizeStack=!0)}$||(this.applyEffects(g),g.globalAlpha=this.calculateOpacity())}clearContext(g){super.clearContext(g),this.modifiedEmSizeStack&&this.document.popEmSize()}constructor(...g){super(...g),this.modifiedEmSizeStack=!1}}class TextElement extends RenderedElement{setContext(g){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;super.setContext(g,$);const b=this.getStyle("dominant-baseline").getTextBaseline()||this.getStyle("alignment-baseline").getTextBaseline();b&&(g.textBaseline=b)}initializeCoordinates(){this.x=0,this.y=0,this.leafTexts=[],this.textChunkStart=0,this.minX=Number.POSITIVE_INFINITY,this.maxX=Number.NEGATIVE_INFINITY}getBoundingBox(g){if(this.type!=="text")return this.getTElementBoundingBox(g);this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(g);let $=null;return this.children.forEach((b,j)=>{const _e=this.getChildBoundingBox(g,this,this,j);$?$.addBoundingBox(_e):$=_e}),$}getFontSize(){const{document:g,parent:$}=this,b=Font.parse(g.ctx.font).fontSize;return $.getStyle("font-size").getNumber(b)}getTElementBoundingBox(g){const $=this.getFontSize();return new BoundingBox(this.x,this.y-$,this.x+this.measureText(g),this.y)}getGlyph(g,$,b){const j=$[b];let _e;if(g.isArabic){var et;const tt=$.length,nt=$[b-1],rt=$[b+1];let it="isolated";(b===0||nt===" ")&&b0&&nt!==" "&&b0&&nt!==" "&&(b===tt-1||rt===" ")&&(it="initial"),_e=((et=g.arabicGlyphs[j])===null||et===void 0?void 0:et[it])||g.glyphs[j]}else _e=g.glyphs[j];return _e||(_e=g.missingGlyph),_e}getText(){return""}getTextFromNode(g){const $=g||this.node,b=Array.from($.parentNode.childNodes),j=b.indexOf($),_e=b.length-1;let et=compressSpaces($.textContent||"");return j===0&&(et=trimLeft(et)),j===_e&&(et=trimRight(et)),et}renderChildren(g){if(this.type!=="text"){this.renderTElementChildren(g);return}this.initializeCoordinates(),this.adjustChildCoordinatesRecursive(g),this.children.forEach((b,j)=>{this.renderChild(g,this,this,j)});const{mouse:$}=this.document.screen;$.isWorking()&&$.checkBoundingBox(this,this.getBoundingBox(g))}renderTElementChildren(g){const{document:$,parent:b}=this,j=this.getText(),_e=b.getStyle("font-family").getDefinition();if(_e){const{unitsPerEm:nt}=_e.fontFace,rt=Font.parse($.ctx.font),it=b.getStyle("font-size").getNumber(rt.fontSize),st=b.getStyle("font-style").getString(rt.fontStyle),ut=it/nt,at=_e.isRTL?j.split("").reverse().join(""):j,ht=toNumbers(b.getAttribute("dx").getString()),ct=at.length;for(let vt=0;vt=this.leafTexts.length)return;const g=this.leafTexts[this.textChunkStart],$=g.getStyle("text-anchor").getString("start"),b=!1;let j=0;$==="start"&&!b||$==="end"&&b?j=g.x-this.minX:$==="end"&&!b||$==="start"&&b?j=g.x-this.maxX:j=g.x-(this.minX+this.maxX)/2;for(let _e=this.textChunkStart;_e{this.adjustChildCoordinatesRecursiveCore(g,this,this,b)}),this.applyAnchoring()}adjustChildCoordinatesRecursiveCore(g,$,b,j){const _e=b.children[j];_e.children.length>0?_e.children.forEach((et,tt)=>{$.adjustChildCoordinatesRecursiveCore(g,$,_e,tt)}):this.adjustChildCoordinates(g,$,b,j)}adjustChildCoordinates(g,$,b,j){const _e=b.children[j];if(typeof _e.measureText!="function")return _e;g.save(),_e.setContext(g,!0);const et=_e.getAttribute("x"),tt=_e.getAttribute("y"),nt=_e.getAttribute("dx"),rt=_e.getAttribute("dy"),it=_e.getStyle("font-family").getDefinition(),st=Boolean(it==null?void 0:it.isRTL);j===0&&(et.hasValue()||et.setValue(_e.getInheritedAttribute("x")),tt.hasValue()||tt.setValue(_e.getInheritedAttribute("y")),nt.hasValue()||nt.setValue(_e.getInheritedAttribute("dx")),rt.hasValue()||rt.setValue(_e.getInheritedAttribute("dy")));const ut=_e.measureText(g);return st&&($.x-=ut),et.hasValue()?($.applyAnchoring(),_e.x=et.getPixels("x"),nt.hasValue()&&(_e.x+=nt.getPixels("x"))):(nt.hasValue()&&($.x+=nt.getPixels("x")),_e.x=$.x),$.x=_e.x,st||($.x+=ut),tt.hasValue()?(_e.y=tt.getPixels("y"),rt.hasValue()&&(_e.y+=rt.getPixels("y"))):(rt.hasValue()&&($.y+=rt.getPixels("y")),_e.y=$.y),$.y=_e.y,$.leafTexts.push(_e),$.minX=Math.min($.minX,_e.x,_e.x+ut),$.maxX=Math.max($.maxX,_e.x,_e.x+ut),_e.clearContext(g),g.restore(),_e}getChildBoundingBox(g,$,b,j){const _e=b.children[j];if(typeof _e.getBoundingBox!="function")return null;const et=_e.getBoundingBox(g);return et&&_e.children.forEach((tt,nt)=>{const rt=$.getChildBoundingBox(g,$,_e,nt);et.addBoundingBox(rt)}),et}renderChild(g,$,b,j){const _e=b.children[j];_e.render(g),_e.children.forEach((et,tt)=>{$.renderChild(g,$,_e,tt)})}measureText(g){const{measureCache:$}=this;if(~$)return $;const b=this.getText(),j=this.measureTargetText(g,b);return this.measureCache=j,j}measureTargetText(g,$){if(!$.length)return 0;const{parent:b}=this,j=b.getStyle("font-family").getDefinition();if(j){const et=this.getFontSize(),tt=j.isRTL?$.split("").reverse().join(""):$,nt=toNumbers(b.getAttribute("dx").getString()),rt=tt.length;let it=0;for(let st=0;st0?"":this.getTextFromNode()}}class TextNode extends TSpanElement{constructor(...g){super(...g),this.type="textNode"}}class PathParser extends _{reset(){this.i=-1,this.command=null,this.previousCommand=null,this.start=new Point(0,0),this.control=new Point(0,0),this.current=new Point(0,0),this.points=[],this.angles=[]}isEnd(){const{i:g,commands:$}=this;return g>=$.length-1}next(){const g=this.commands[++this.i];return this.previousCommand=this.command,this.command=g,g}getPoint(){let g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"x",$=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"y";const b=new Point(this.command[g],this.command[$]);return this.makeAbsolute(b)}getAsControlPoint(g,$){const b=this.getPoint(g,$);return this.control=b,b}getAsCurrentPoint(g,$){const b=this.getPoint(g,$);return this.current=b,b}getReflectedControlPoint(){const g=this.previousCommand.type;if(g!==_.CURVE_TO&&g!==_.SMOOTH_CURVE_TO&&g!==_.QUAD_TO&&g!==_.SMOOTH_QUAD_TO)return this.current;const{current:{x:$,y:b},control:{x:j,y:_e}}=this;return new Point(2*$-j,2*b-_e)}makeAbsolute(g){if(this.command.relative){const{x:$,y:b}=this.current;g.x+=$,g.y+=b}return g}addMarker(g,$,b){const{points:j,angles:_e}=this;b&&_e.length>0&&!_e[_e.length-1]&&(_e[_e.length-1]=j[j.length-1].angleTo(b)),this.addMarkerAngle(g,$?$.angleTo(g):null)}addMarkerAngle(g,$){this.points.push(g),this.angles.push($)}getMarkerPoints(){return this.points}getMarkerAngles(){const{angles:g}=this,$=g.length;for(let b=0;b<$;b++)if(!g[b]){for(let j=b+1;j<$;j++)if(g[j]){g[b]=g[j];break}}return g}constructor(g){super(g.replace(/([+\-.])\s+/gm,"$1").replace(/[^MmZzLlHhVvCcSsQqTtAae\d\s.,+-].*/g,"")),this.control=new Point(0,0),this.start=new Point(0,0),this.current=new Point(0,0),this.command=null,this.commands=this.commands,this.i=-1,this.previousCommand=null,this.points=[],this.angles=[]}}class PathElement extends RenderedElement{path(g){const{pathParser:$}=this,b=new BoundingBox;for($.reset(),g&&g.beginPath();!$.isEnd();)switch($.next().type){case PathParser.MOVE_TO:this.pathM(g,b);break;case PathParser.LINE_TO:this.pathL(g,b);break;case PathParser.HORIZ_LINE_TO:this.pathH(g,b);break;case PathParser.VERT_LINE_TO:this.pathV(g,b);break;case PathParser.CURVE_TO:this.pathC(g,b);break;case PathParser.SMOOTH_CURVE_TO:this.pathS(g,b);break;case PathParser.QUAD_TO:this.pathQ(g,b);break;case PathParser.SMOOTH_QUAD_TO:this.pathT(g,b);break;case PathParser.ARC:this.pathA(g,b);break;case PathParser.CLOSE_PATH:this.pathZ(g,b);break}return b}getBoundingBox(g){return this.path()}getMarkers(){const{pathParser:g}=this,$=g.getMarkerPoints(),b=g.getMarkerAngles();return $.map((_e,et)=>[_e,b[et]])}renderChildren(g){this.path(g),this.document.screen.mouse.checkPath(this,g);const $=this.getStyle("fill-rule");g.fillStyle!==""&&($.getString("inherit")!=="inherit"?g.fill($.getString()):g.fill()),g.strokeStyle!==""&&(this.getAttribute("vector-effect").getString()==="non-scaling-stroke"?(g.save(),g.setTransform(1,0,0,1,0,0),g.stroke(),g.restore()):g.stroke());const b=this.getMarkers();if(b){const j=b.length-1,_e=this.getStyle("marker-start"),et=this.getStyle("marker-mid"),tt=this.getStyle("marker-end");if(_e.isUrlDefinition()){const nt=_e.getDefinition(),[rt,it]=b[0];nt.render(g,rt,it)}if(et.isUrlDefinition()){const nt=et.getDefinition();for(let rt=1;rt1&&(j*=Math.sqrt(ut),_e*=Math.sqrt(ut));let at=(tt===nt?-1:1)*Math.sqrt((Math.pow(j,2)*Math.pow(_e,2)-Math.pow(j,2)*Math.pow(st.y,2)-Math.pow(_e,2)*Math.pow(st.x,2))/(Math.pow(j,2)*Math.pow(st.y,2)+Math.pow(_e,2)*Math.pow(st.x,2)));isNaN(at)&&(at=0);const ht=new Point(at*j*st.y/_e,at*-_e*st.x/j),ct=new Point(($.x+it.x)/2+Math.cos(rt)*ht.x-Math.sin(rt)*ht.y,($.y+it.y)/2+Math.sin(rt)*ht.x+Math.cos(rt)*ht.y),vt=vectorsAngle([1,0],[(st.x-ht.x)/j,(st.y-ht.y)/_e]),ft=[(st.x-ht.x)/j,(st.y-ht.y)/_e],gt=[(-st.x-ht.x)/j,(-st.y-ht.y)/_e];let pt=vectorsAngle(ft,gt);return vectorsRatio(ft,gt)<=-1&&(pt=Math.PI),vectorsRatio(ft,gt)>=1&&(pt=0),{currentPoint:it,rX:j,rY:_e,sweepFlag:nt,xAxisRotation:rt,centp:ct,a1:vt,ad:pt}}pathA(g,$){const{pathParser:b}=this,{currentPoint:j,rX:_e,rY:et,sweepFlag:tt,xAxisRotation:nt,centp:rt,a1:it,ad:st}=PathElement.pathA(b),ut=1-tt?1:-1,at=it+ut*(st/2),ht=new Point(rt.x+_e*Math.cos(at),rt.y+et*Math.sin(at));if(b.addMarkerAngle(ht,at-ut*Math.PI/2),b.addMarkerAngle(j,at-ut*Math.PI),$.addPoint(j.x,j.y),g&&!isNaN(it)&&!isNaN(st)){const ct=_e>et?_e:et,vt=_e>et?1:_e/et,ft=_e>et?et/_e:1;g.translate(rt.x,rt.y),g.rotate(nt),g.scale(vt,ft),g.arc(0,0,ct,it,it+st,Boolean(1-tt)),g.scale(1/vt,1/ft),g.rotate(-nt),g.translate(-rt.x,-rt.y)}}static pathZ(g){g.current=g.start}pathZ(g,$){PathElement.pathZ(this.pathParser),g&&$.x1!==$.x2&&$.y1!==$.y2&&g.closePath()}constructor(g,$,b){super(g,$,b),this.type="path",this.pathParser=new PathParser(this.getAttribute("d").getString())}}class SVGElement extends RenderedElement{setContext(g){var $;const{document:b}=this,{screen:j,window:_e}=b,et=g.canvas;if(j.setDefaults(g),"style"in et&&typeof g.font<"u"&&_e&&typeof _e.getComputedStyle<"u"){g.font=_e.getComputedStyle(et).getPropertyValue("font");const gt=new Property(b,"fontSize",Font.parse(g.font).fontSize);gt.hasValue()&&(b.rootEmSize=gt.getPixels("y"),b.emSize=b.rootEmSize)}this.getAttribute("x").hasValue()||this.getAttribute("x",!0).setValue(0),this.getAttribute("y").hasValue()||this.getAttribute("y",!0).setValue(0);let{width:tt,height:nt}=j.viewPort;this.getStyle("width").hasValue()||this.getStyle("width",!0).setValue("100%"),this.getStyle("height").hasValue()||this.getStyle("height",!0).setValue("100%"),this.getStyle("color").hasValue()||this.getStyle("color",!0).setValue("black");const rt=this.getAttribute("refX"),it=this.getAttribute("refY"),st=this.getAttribute("viewBox"),ut=st.hasValue()?toNumbers(st.getString()):null,at=!this.root&&this.getStyle("overflow").getValue("hidden")!=="visible";let ht=0,ct=0,vt=0,ft=0;ut&&(ht=ut[0],ct=ut[1]),this.root||(tt=this.getStyle("width").getPixels("x"),nt=this.getStyle("height").getPixels("y"),this.type==="marker"&&(vt=ht,ft=ct,ht=0,ct=0)),j.viewPort.setCurrent(tt,nt),this.node&&(!this.parent||(($=this.node.parentNode)===null||$===void 0?void 0:$.nodeName)==="foreignObject")&&this.getStyle("transform",!1,!0).hasValue()&&!this.getStyle("transform-origin",!1,!0).hasValue()&&this.getStyle("transform-origin",!0,!0).setValue("50% 50%"),super.setContext(g),g.translate(this.getAttribute("x").getPixels("x"),this.getAttribute("y").getPixels("y")),ut&&(tt=ut[2],nt=ut[3]),b.setViewBox({ctx:g,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:j.viewPort.width,desiredWidth:tt,height:j.viewPort.height,desiredHeight:nt,minX:ht,minY:ct,refX:rt.getValue(),refY:it.getValue(),clip:at,clipX:vt,clipY:ft}),ut&&(j.viewPort.removeCurrent(),j.viewPort.setCurrent(tt,nt))}clearContext(g){super.clearContext(g),this.document.screen.viewPort.removeCurrent()}resize(g){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g,b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const j=this.getAttribute("width",!0),_e=this.getAttribute("height",!0),et=this.getAttribute("viewBox"),tt=this.getAttribute("style"),nt=j.getNumber(0),rt=_e.getNumber(0);if(b)if(typeof b=="string")this.getAttribute("preserveAspectRatio",!0).setValue(b);else{const it=this.getAttribute("preserveAspectRatio");it.hasValue()&&it.setValue(it.getString().replace(/^\s*(\S.*\S)\s*$/,"$1"))}if(j.setValue(g),_e.setValue($),et.hasValue()||et.setValue("0 0 ".concat(nt||g," ").concat(rt||$)),tt.hasValue()){const it=this.getStyle("width"),st=this.getStyle("height");it.hasValue()&&it.setValue("".concat(g,"px")),st.hasValue()&&st.setValue("".concat($,"px"))}}constructor(...g){super(...g),this.type="svg",this.root=!1}}class RectElement extends PathElement{path(g){const $=this.getAttribute("x").getPixels("x"),b=this.getAttribute("y").getPixels("y"),j=this.getStyle("width",!1,!0).getPixels("x"),_e=this.getStyle("height",!1,!0).getPixels("y"),et=this.getAttribute("rx"),tt=this.getAttribute("ry");let nt=et.getPixels("x"),rt=tt.getPixels("y");if(et.hasValue()&&!tt.hasValue()&&(rt=nt),tt.hasValue()&&!et.hasValue()&&(nt=rt),nt=Math.min(nt,j/2),rt=Math.min(rt,_e/2),g){const it=4*((Math.sqrt(2)-1)/3);g.beginPath(),_e>0&&j>0&&(g.moveTo($+nt,b),g.lineTo($+j-nt,b),g.bezierCurveTo($+j-nt+it*nt,b,$+j,b+rt-it*rt,$+j,b+rt),g.lineTo($+j,b+_e-rt),g.bezierCurveTo($+j,b+_e-rt+it*rt,$+j-nt+it*nt,b+_e,$+j-nt,b+_e),g.lineTo($+nt,b+_e),g.bezierCurveTo($+nt-it*nt,b+_e,$,b+_e-rt+it*rt,$,b+_e-rt),g.lineTo($,b+rt),g.bezierCurveTo($,b+rt-it*rt,$+nt-it*nt,b,$+nt,b),g.closePath())}return new BoundingBox($,b,$+j,b+_e)}getMarkers(){return null}constructor(...g){super(...g),this.type="rect"}}class CircleElement extends PathElement{path(g){const $=this.getAttribute("cx").getPixels("x"),b=this.getAttribute("cy").getPixels("y"),j=this.getAttribute("r").getPixels();return g&&j>0&&(g.beginPath(),g.arc($,b,j,0,Math.PI*2,!1),g.closePath()),new BoundingBox($-j,b-j,$+j,b+j)}getMarkers(){return null}constructor(...g){super(...g),this.type="circle"}}class EllipseElement extends PathElement{path(g){const $=4*((Math.sqrt(2)-1)/3),b=this.getAttribute("rx").getPixels("x"),j=this.getAttribute("ry").getPixels("y"),_e=this.getAttribute("cx").getPixels("x"),et=this.getAttribute("cy").getPixels("y");return g&&b>0&&j>0&&(g.beginPath(),g.moveTo(_e+b,et),g.bezierCurveTo(_e+b,et+$*j,_e+$*b,et+j,_e,et+j),g.bezierCurveTo(_e-$*b,et+j,_e-b,et+$*j,_e-b,et),g.bezierCurveTo(_e-b,et-$*j,_e-$*b,et-j,_e,et-j),g.bezierCurveTo(_e+$*b,et-j,_e+b,et-$*j,_e+b,et),g.closePath()),new BoundingBox(_e-b,et-j,_e+b,et+j)}getMarkers(){return null}constructor(...g){super(...g),this.type="ellipse"}}class LineElement extends PathElement{getPoints(){return[new Point(this.getAttribute("x1").getPixels("x"),this.getAttribute("y1").getPixels("y")),new Point(this.getAttribute("x2").getPixels("x"),this.getAttribute("y2").getPixels("y"))]}path(g){const[{x:$,y:b},{x:j,y:_e}]=this.getPoints();return g&&(g.beginPath(),g.moveTo($,b),g.lineTo(j,_e)),new BoundingBox($,b,j,_e)}getMarkers(){const[g,$]=this.getPoints(),b=g.angleTo($);return[[g,b],[$,b]]}constructor(...g){super(...g),this.type="line"}}class PolylineElement extends PathElement{path(g){const{points:$}=this,[{x:b,y:j}]=$,_e=new BoundingBox(b,j);return g&&(g.beginPath(),g.moveTo(b,j)),$.forEach(et=>{let{x:tt,y:nt}=et;_e.addPoint(tt,nt),g&&g.lineTo(tt,nt)}),_e}getMarkers(){const{points:g}=this,$=g.length-1,b=[];return g.forEach((j,_e)=>{_e!==$&&b.push([j,j.angleTo(g[_e+1])])}),b.length>0&&b.push([g[g.length-1],b[b.length-1][1]]),b}constructor(g,$,b){super(g,$,b),this.type="polyline",this.points=[],this.points=Point.parsePath(this.getAttribute("points").getString())}}class PolygonElement extends PolylineElement{path(g){const $=super.path(g),[{x:b,y:j}]=this.points;return g&&(g.lineTo(b,j),g.closePath()),$}constructor(...g){super(...g),this.type="polygon"}}class PatternElement extends Element{createPattern(g,$,b){const j=this.getStyle("width").getPixels("x",!0),_e=this.getStyle("height").getPixels("y",!0),et=new SVGElement(this.document,null);et.attributes.viewBox=new Property(this.document,"viewBox",this.getAttribute("viewBox").getValue()),et.attributes.width=new Property(this.document,"width","".concat(j,"px")),et.attributes.height=new Property(this.document,"height","".concat(_e,"px")),et.attributes.transform=new Property(this.document,"transform",this.getAttribute("patternTransform").getValue()),et.children=this.children;const tt=this.document.createCanvas(j,_e),nt=tt.getContext("2d"),rt=this.getAttribute("x"),it=this.getAttribute("y");rt.hasValue()&&it.hasValue()&&nt.translate(rt.getPixels("x",!0),it.getPixels("y",!0)),b.hasValue()?this.styles["fill-opacity"]=b:Reflect.deleteProperty(this.styles,"fill-opacity");for(let ut=-1;ut<=1;ut++)for(let at=-1;at<=1;at++)nt.save(),et.attributes.x=new Property(this.document,"x",ut*tt.width),et.attributes.y=new Property(this.document,"y",at*tt.height),et.render(nt),nt.restore();return g.createPattern(tt,"repeat")}constructor(...g){super(...g),this.type="pattern"}}class MarkerElement extends Element{render(g,$,b){if(!$)return;const{x:j,y:_e}=$,et=this.getAttribute("orient").getString("auto"),tt=this.getAttribute("markerUnits").getString("strokeWidth");g.translate(j,_e),et==="auto"&&g.rotate(b),tt==="strokeWidth"&&g.scale(g.lineWidth,g.lineWidth),g.save();const nt=new SVGElement(this.document);nt.type=this.type,nt.attributes.viewBox=new Property(this.document,"viewBox",this.getAttribute("viewBox").getValue()),nt.attributes.refX=new Property(this.document,"refX",this.getAttribute("refX").getValue()),nt.attributes.refY=new Property(this.document,"refY",this.getAttribute("refY").getValue()),nt.attributes.width=new Property(this.document,"width",this.getAttribute("markerWidth").getValue()),nt.attributes.height=new Property(this.document,"height",this.getAttribute("markerHeight").getValue()),nt.attributes.overflow=new Property(this.document,"overflow",this.getAttribute("overflow").getValue()),nt.attributes.fill=new Property(this.document,"fill",this.getAttribute("fill").getColor("black")),nt.attributes.stroke=new Property(this.document,"stroke",this.getAttribute("stroke").getValue("none")),nt.children=this.children,nt.render(g),g.restore(),tt==="strokeWidth"&&g.scale(1/g.lineWidth,1/g.lineWidth),et==="auto"&&g.rotate(-b),g.translate(-j,-_e)}constructor(...g){super(...g),this.type="marker"}}class DefsElement extends Element{render(){}constructor(...g){super(...g),this.type="defs"}}class GElement extends RenderedElement{getBoundingBox(g){const $=new BoundingBox;return this.children.forEach(b=>{$.addBoundingBox(b.getBoundingBox(g))}),$}constructor(...g){super(...g),this.type="g"}}class GradientElement extends Element{getGradientUnits(){return this.getAttribute("gradientUnits").getString("objectBoundingBox")}createGradient(g,$,b){let j=this;this.getHrefAttribute().hasValue()&&(j=this.getHrefAttribute().getDefinition(),this.inheritStopContainer(j));const{stops:_e}=j,et=this.getGradient(g,$);if(!et)return this.addParentOpacity(b,_e[_e.length-1].color);if(_e.forEach(tt=>{et.addColorStop(tt.offset,this.addParentOpacity(b,tt.color))}),this.getAttribute("gradientTransform").hasValue()){const{document:tt}=this,{MAX_VIRTUAL_PIXELS:nt}=Screen,{viewPort:rt}=tt.screen,it=rt.getRoot(),st=new RectElement(tt);st.attributes.x=new Property(tt,"x",-nt/3),st.attributes.y=new Property(tt,"y",-nt/3),st.attributes.width=new Property(tt,"width",nt),st.attributes.height=new Property(tt,"height",nt);const ut=new GElement(tt);ut.attributes.transform=new Property(tt,"transform",this.getAttribute("gradientTransform").getValue()),ut.children=[st];const at=new SVGElement(tt);at.attributes.x=new Property(tt,"x",0),at.attributes.y=new Property(tt,"y",0),at.attributes.width=new Property(tt,"width",it.width),at.attributes.height=new Property(tt,"height",it.height),at.children=[ut];const ht=tt.createCanvas(it.width,it.height),ct=ht.getContext("2d");return ct.fillStyle=et,at.render(ct),ct.createPattern(ht,"no-repeat")}return et}inheritStopContainer(g){this.attributesToInherit.forEach($=>{!this.getAttribute($).hasValue()&&g.getAttribute($).hasValue()&&this.getAttribute($,!0).setValue(g.getAttribute($).getValue())})}addParentOpacity(g,$){return g.hasValue()?new Property(this.document,"color",$).addOpacity(g).getColor():$}constructor(g,$,b){super(g,$,b),this.attributesToInherit=["gradientUnits"],this.stops=[];const{stops:j,children:_e}=this;_e.forEach(et=>{et.type==="stop"&&j.push(et)})}}class LinearGradientElement extends GradientElement{getGradient(g,$){const b=this.getGradientUnits()==="objectBoundingBox",j=b?$.getBoundingBox(g):null;if(b&&!j)return null;!this.getAttribute("x1").hasValue()&&!this.getAttribute("y1").hasValue()&&!this.getAttribute("x2").hasValue()&&!this.getAttribute("y2").hasValue()&&(this.getAttribute("x1",!0).setValue(0),this.getAttribute("y1",!0).setValue(0),this.getAttribute("x2",!0).setValue(1),this.getAttribute("y2",!0).setValue(0));const _e=b?j.x+j.width*this.getAttribute("x1").getNumber():this.getAttribute("x1").getPixels("x"),et=b?j.y+j.height*this.getAttribute("y1").getNumber():this.getAttribute("y1").getPixels("y"),tt=b?j.x+j.width*this.getAttribute("x2").getNumber():this.getAttribute("x2").getPixels("x"),nt=b?j.y+j.height*this.getAttribute("y2").getNumber():this.getAttribute("y2").getPixels("y");return _e===tt&&et===nt?null:g.createLinearGradient(_e,et,tt,nt)}constructor(g,$,b){super(g,$,b),this.type="linearGradient",this.attributesToInherit.push("x1","y1","x2","y2")}}class RadialGradientElement extends GradientElement{getGradient(g,$){const b=this.getGradientUnits()==="objectBoundingBox",j=$.getBoundingBox(g);if(b&&!j)return null;this.getAttribute("cx").hasValue()||this.getAttribute("cx",!0).setValue("50%"),this.getAttribute("cy").hasValue()||this.getAttribute("cy",!0).setValue("50%"),this.getAttribute("r").hasValue()||this.getAttribute("r",!0).setValue("50%");const _e=b?j.x+j.width*this.getAttribute("cx").getNumber():this.getAttribute("cx").getPixels("x"),et=b?j.y+j.height*this.getAttribute("cy").getNumber():this.getAttribute("cy").getPixels("y");let tt=_e,nt=et;this.getAttribute("fx").hasValue()&&(tt=b?j.x+j.width*this.getAttribute("fx").getNumber():this.getAttribute("fx").getPixels("x")),this.getAttribute("fy").hasValue()&&(nt=b?j.y+j.height*this.getAttribute("fy").getNumber():this.getAttribute("fy").getPixels("y"));const rt=b?(j.width+j.height)/2*this.getAttribute("r").getNumber():this.getAttribute("r").getPixels(),it=this.getAttribute("fr").getPixels();return g.createRadialGradient(tt,nt,it,_e,et,rt)}constructor(g,$,b){super(g,$,b),this.type="radialGradient",this.attributesToInherit.push("cx","cy","r","fx","fy","fr")}}class StopElement extends Element{constructor(g,$,b){super(g,$,b),this.type="stop";const j=Math.max(0,Math.min(1,this.getAttribute("offset").getNumber())),_e=this.getStyle("stop-opacity");let et=this.getStyle("stop-color",!0);et.getString()===""&&et.setValue("#000"),_e.hasValue()&&(et=et.addOpacity(_e)),this.offset=j,this.color=et.getColor()}}class AnimateElement extends Element{getProperty(){const g=this.getAttribute("attributeType").getString(),$=this.getAttribute("attributeName").getString();return g==="CSS"?this.parent.getStyle($,!0):this.parent.getAttribute($,!0)}calcValue(){const{initialUnits:g}=this,{progress:$,from:b,to:j}=this.getProgress();let _e=b.getNumber()+(j.getNumber()-b.getNumber())*$;return g==="%"&&(_e*=100),"".concat(_e).concat(g)}update(g){const{parent:$}=this,b=this.getProperty();if(this.initialValue||(this.initialValue=b.getString(),this.initialUnits=b.getUnits()),this.duration>this.maxDuration){const _e=this.getAttribute("fill").getString("remove");if(this.getAttribute("repeatCount").getString()==="indefinite"||this.getAttribute("repeatDur").getString()==="indefinite")this.duration=0;else if(_e==="freeze"&&!this.frozen)this.frozen=!0,$&&b&&($.animationFrozen=!0,$.animationFrozenValue=b.getString());else if(_e==="remove"&&!this.removed)return this.removed=!0,$&&b&&b.setValue($.animationFrozen?$.animationFrozenValue:this.initialValue),!0;return!1}this.duration+=g;let j=!1;if(this.begin{const rt=_e[nt];return tt+(rt-tt)*g}).join(" ")}constructor(...g){super(...g),this.type="animateTransform"}}class FontFaceElement extends Element{constructor(g,$,b){super(g,$,b),this.type="font-face",this.ascent=this.getAttribute("ascent").getNumber(),this.descent=this.getAttribute("descent").getNumber(),this.unitsPerEm=this.getAttribute("units-per-em").getNumber()}}class GlyphElement extends PathElement{constructor(g,$,b){super(g,$,b),this.type="glyph",this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber(),this.unicode=this.getAttribute("unicode").getString(),this.arabicForm=this.getAttribute("arabic-form").getString()}}class MissingGlyphElement extends GlyphElement{constructor(...g){super(...g),this.type="missing-glyph",this.horizAdvX=0}}class FontElement extends Element{render(){}constructor(g,$,b){super(g,$,b),this.type="font",this.isArabic=!1,this.glyphs={},this.arabicGlyphs={},this.isRTL=!1,this.horizAdvX=this.getAttribute("horiz-adv-x").getNumber();const{definitions:j}=g,{children:_e}=this;for(const et of _e)if(et instanceof FontFaceElement){this.fontFace=et;const tt=et.getStyle("font-family");tt.hasValue()&&(j[tt.getString()]=this)}else if(et instanceof MissingGlyphElement)this.missingGlyph=et;else if(et instanceof GlyphElement)if(et.arabicForm){this.isRTL=!0,this.isArabic=!0;const tt=this.arabicGlyphs[et.unicode];typeof tt>"u"?this.arabicGlyphs[et.unicode]={[et.arabicForm]:et}:tt[et.arabicForm]=et}else this.glyphs[et.unicode]=et}}class TRefElement extends TextElement{getText(){const g=this.getHrefAttribute().getDefinition();if(g){const $=g.children[0];if($)return $.getText()}return""}constructor(...g){super(...g),this.type="tref"}}class AElement extends TextElement{getText(){return this.text}renderChildren(g){if(this.hasText){super.renderChildren(g);const{document:$,x:b,y:j}=this,{mouse:_e}=$.screen,et=new Property($,"fontSize",Font.parse($.ctx.font).fontSize);_e.isWorking()&&_e.checkBoundingBox(this,new BoundingBox(b,j-et.getPixels("y"),b+this.measureText(g),j))}else if(this.children.length>0){const $=new GElement(this.document);$.children=this.children,$.parent=this,$.render(g)}}onClick(){const{window:g}=this.document;g&&g.open(this.getHrefAttribute().getString())}onMouseMove(){const g=this.document.ctx;g.canvas.style.cursor="pointer"}constructor(g,$,b){super(g,$,b),this.type="a";const{childNodes:j}=$,_e=j[0],et=j.length>0&&Array.from(j).every(tt=>tt.nodeType===3);this.hasText=et,this.text=et?this.getTextFromNode(_e):""}}class TextPathElement extends TextElement{getText(){return this.text}path(g){const{dataArray:$}=this;g&&g.beginPath(),$.forEach(b=>{let{type:j,points:_e}=b;switch(j){case PathParser.LINE_TO:g&&g.lineTo(_e[0],_e[1]);break;case PathParser.MOVE_TO:g&&g.moveTo(_e[0],_e[1]);break;case PathParser.CURVE_TO:g&&g.bezierCurveTo(_e[0],_e[1],_e[2],_e[3],_e[4],_e[5]);break;case PathParser.QUAD_TO:g&&g.quadraticCurveTo(_e[0],_e[1],_e[2],_e[3]);break;case PathParser.ARC:{const[et,tt,nt,rt,it,st,ut,at]=_e,ht=nt>rt?nt:rt,ct=nt>rt?1:nt/rt,vt=nt>rt?rt/nt:1;g&&(g.translate(et,tt),g.rotate(ut),g.scale(ct,vt),g.arc(0,0,ht,it,it+st,Boolean(1-at)),g.scale(1/ct,1/vt),g.rotate(-ut),g.translate(-et,-tt));break}case PathParser.CLOSE_PATH:g&&g.closePath();break}})}renderChildren(g){this.setTextData(g),g.save();const $=this.parent.getStyle("text-decoration").getString(),b=this.getFontSize(),{glyphInfo:j}=this,_e=g.fillStyle;$==="underline"&&g.beginPath(),j.forEach((et,tt)=>{const{p0:nt,p1:rt,rotation:it,text:st}=et;g.save(),g.translate(nt.x,nt.y),g.rotate(it),g.fillStyle&&g.fillText(st,0,0),g.strokeStyle&&g.strokeText(st,0,0),g.restore(),$==="underline"&&(tt===0&&g.moveTo(nt.x,nt.y+b/8),g.lineTo(rt.x,rt.y+b/5))}),$==="underline"&&(g.lineWidth=b/20,g.strokeStyle=_e,g.stroke(),g.closePath()),g.restore()}getLetterSpacingAt(){let g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return this.letterSpacingCache[g]||0}findSegmentToFitChar(g,$,b,j,_e,et,tt,nt,rt){let it=et,st=this.measureText(g,nt);nt===" "&&$==="justify"&&b-1&&(it+=this.getLetterSpacingAt(rt));const ut=this.textHeight/20,at=this.getEquidistantPointOnPath(it,ut,0),ht=this.getEquidistantPointOnPath(it+st,ut,0),ct={p0:at,p1:ht},vt=at&&ht?Math.atan2(ht.y-at.y,ht.x-at.x):0;if(tt){const ft=Math.cos(Math.PI/2+vt)*tt,gt=Math.cos(-vt)*tt;ct.p0={...at,x:at.x+ft,y:at.y+gt},ct.p1={...ht,x:ht.x+ft,y:ht.y+gt}}return it+=st,{offset:it,segment:ct,rotation:vt}}measureText(g,$){const{measuresCache:b}=this,j=$||this.getText();if(b.has(j))return b.get(j);const _e=this.measureTargetText(g,j);return b.set(j,_e),_e}setTextData(g){if(this.glyphInfo)return;const $=this.getText(),b=$.split(""),j=$.split(" ").length-1,_e=this.parent.getAttribute("dx").split().map(pt=>pt.getPixels("x")),et=this.parent.getAttribute("dy").getPixels("y"),tt=this.parent.getStyle("text-anchor").getString("start"),nt=this.getStyle("letter-spacing"),rt=this.parent.getStyle("letter-spacing");let it=0;!nt.hasValue()||nt.getValue()==="inherit"?it=rt.getPixels():nt.hasValue()&&nt.getValue()!=="initial"&&nt.getValue()!=="unset"&&(it=nt.getPixels());const st=[],ut=$.length;this.letterSpacingCache=st;for(let pt=0;ptAt===0?0:pt+yt||0,0),ht=this.measureText(g),ct=Math.max(ht+at,0);this.textWidth=ht,this.textHeight=this.getFontSize(),this.glyphInfo=[];const vt=this.getPathLength(),ft=this.getStyle("startOffset").getNumber(0)*vt;let gt=0;(tt==="middle"||tt==="center")&&(gt=-ct/2),(tt==="end"||tt==="right")&&(gt=-ct),gt+=ft,b.forEach((pt,yt)=>{const{offset:At,segment:Dt,rotation:St}=this.findSegmentToFitChar(g,tt,ct,vt,j,gt,et,pt,yt);gt=At,!(!Dt.p0||!Dt.p1)&&this.glyphInfo.push({text:b[yt],p0:Dt.p0,p1:Dt.p1,rotation:St})})}parsePathData(g){if(this.pathLength=-1,!g)return[];const $=[],{pathParser:b}=g;for(b.reset();!b.isEnd();){const{current:j}=b,_e=j?j.x:0,et=j?j.y:0,tt=b.next();let nt=tt.type,rt=[];switch(tt.type){case PathParser.MOVE_TO:this.pathM(b,rt);break;case PathParser.LINE_TO:nt=this.pathL(b,rt);break;case PathParser.HORIZ_LINE_TO:nt=this.pathH(b,rt);break;case PathParser.VERT_LINE_TO:nt=this.pathV(b,rt);break;case PathParser.CURVE_TO:this.pathC(b,rt);break;case PathParser.SMOOTH_CURVE_TO:nt=this.pathS(b,rt);break;case PathParser.QUAD_TO:this.pathQ(b,rt);break;case PathParser.SMOOTH_QUAD_TO:nt=this.pathT(b,rt);break;case PathParser.ARC:rt=this.pathA(b);break;case PathParser.CLOSE_PATH:PathElement.pathZ(b);break}tt.type!==PathParser.CLOSE_PATH?$.push({type:nt,points:rt,start:{x:_e,y:et},pathLength:this.calcLength(_e,et,nt,rt)}):$.push({type:PathParser.CLOSE_PATH,points:[],pathLength:0})}return $}pathM(g,$){const{x:b,y:j}=PathElement.pathM(g).point;$.push(b,j)}pathL(g,$){const{x:b,y:j}=PathElement.pathL(g).point;return $.push(b,j),PathParser.LINE_TO}pathH(g,$){const{x:b,y:j}=PathElement.pathH(g).point;return $.push(b,j),PathParser.LINE_TO}pathV(g,$){const{x:b,y:j}=PathElement.pathV(g).point;return $.push(b,j),PathParser.LINE_TO}pathC(g,$){const{point:b,controlPoint:j,currentPoint:_e}=PathElement.pathC(g);$.push(b.x,b.y,j.x,j.y,_e.x,_e.y)}pathS(g,$){const{point:b,controlPoint:j,currentPoint:_e}=PathElement.pathS(g);return $.push(b.x,b.y,j.x,j.y,_e.x,_e.y),PathParser.CURVE_TO}pathQ(g,$){const{controlPoint:b,currentPoint:j}=PathElement.pathQ(g);$.push(b.x,b.y,j.x,j.y)}pathT(g,$){const{controlPoint:b,currentPoint:j}=PathElement.pathT(g);return $.push(b.x,b.y,j.x,j.y),PathParser.QUAD_TO}pathA(g){let{rX:$,rY:b,sweepFlag:j,xAxisRotation:_e,centp:et,a1:tt,ad:nt}=PathElement.pathA(g);return j===0&&nt>0&&(nt-=2*Math.PI),j===1&&nt<0&&(nt+=2*Math.PI),[et.x,et.y,$,b,tt,nt,_e,j]}calcLength(g,$,b,j){let _e=0,et=null,tt=null,nt=0;switch(b){case PathParser.LINE_TO:return this.getLineLength(g,$,j[0],j[1]);case PathParser.CURVE_TO:for(_e=0,et=this.getPointOnCubicBezier(0,g,$,j[0],j[1],j[2],j[3],j[4],j[5]),nt=.01;nt<=1;nt+=.01)tt=this.getPointOnCubicBezier(nt,g,$,j[0],j[1],j[2],j[3],j[4],j[5]),_e+=this.getLineLength(et.x,et.y,tt.x,tt.y),et=tt;return _e;case PathParser.QUAD_TO:for(_e=0,et=this.getPointOnQuadraticBezier(0,g,$,j[0],j[1],j[2],j[3]),nt=.01;nt<=1;nt+=.01)tt=this.getPointOnQuadraticBezier(nt,g,$,j[0],j[1],j[2],j[3]),_e+=this.getLineLength(et.x,et.y,tt.x,tt.y),et=tt;return _e;case PathParser.ARC:{_e=0;const rt=j[4],it=j[5],st=j[4]+it;let ut=Math.PI/180;if(Math.abs(rt-st)st;nt-=ut)tt=this.getPointOnEllipticalArc(j[0],j[1],j[2],j[3],nt,0),_e+=this.getLineLength(et.x,et.y,tt.x,tt.y),et=tt;else for(nt=rt+ut;nt5&&arguments[5]!==void 0?arguments[5]:$,tt=arguments.length>6&&arguments[6]!==void 0?arguments[6]:b;const nt=(_e-b)/(j-$+PSEUDO_ZERO);let rt=Math.sqrt(g*g/(1+nt*nt));j<$&&(rt*=-1);let it=nt*rt,st=null;if(j===$)st={x:et,y:tt+it};else if((tt-b)/(et-$+PSEUDO_ZERO)===nt)st={x:et+rt,y:tt+it};else{let ut=0,at=0;const ht=this.getLineLength($,b,j,_e);if(ht$)return null;const{dataArray:_e}=this;for(const et of _e){if(et&&(et.pathLength<5e-5||b+et.pathLength+5e-5=0&&nt>st)break;j=this.getPointOnEllipticalArc(et.points[0],et.points[1],et.points[2],et.points[3],nt,et.points[6]);break}case PathParser.CURVE_TO:nt=tt/et.pathLength,nt>1&&(nt=1),j=this.getPointOnCubicBezier(nt,et.start.x,et.start.y,et.points[0],et.points[1],et.points[2],et.points[3],et.points[4],et.points[5]);break;case PathParser.QUAD_TO:nt=tt/et.pathLength,nt>1&&(nt=1),j=this.getPointOnQuadraticBezier(nt,et.start.x,et.start.y,et.points[0],et.points[1],et.points[2],et.points[3]);break}if(j)return j;break}return null}getLineLength(g,$,b,j){return Math.sqrt((b-g)*(b-g)+(j-$)*(j-$))}getPathLength(){return this.pathLength===-1&&(this.pathLength=this.dataArray.reduce((g,$)=>$.pathLength>0?g+$.pathLength:g,0)),this.pathLength}getPointOnCubicBezier(g,$,b,j,_e,et,tt,nt,rt){const it=nt*CB1(g)+et*CB2(g)+j*CB3(g)+$*CB4(g),st=rt*CB1(g)+tt*CB2(g)+_e*CB3(g)+b*CB4(g);return{x:it,y:st}}getPointOnQuadraticBezier(g,$,b,j,_e,et,tt){const nt=et*QB1(g)+j*QB2(g)+$*QB3(g),rt=tt*QB1(g)+_e*QB2(g)+b*QB3(g);return{x:nt,y:rt}}getPointOnEllipticalArc(g,$,b,j,_e,et){const tt=Math.cos(et),nt=Math.sin(et),rt={x:b*Math.cos(_e),y:j*Math.sin(_e)};return{x:g+(rt.x*tt-rt.y*nt),y:$+(rt.x*nt+rt.y*tt)}}buildEquidistantCache(g,$){const b=this.getPathLength(),j=$||.25,_e=g||b/100;if(!this.equidistantCache||this.equidistantCache.step!==_e||this.equidistantCache.precision!==j){this.equidistantCache={step:_e,precision:j,points:[]};let et=0;for(let tt=0;tt<=b;tt+=j){const nt=this.getPointOnPath(tt),rt=this.getPointOnPath(tt+j);!nt||!rt||(et+=this.getLineLength(nt.x,nt.y,rt.x,rt.y),et>=_e&&(this.equidistantCache.points.push({x:nt.x,y:nt.y,distance:tt}),et-=_e))}}}getEquidistantPointOnPath(g,$,b){if(this.buildEquidistantCache($,b),g<0||g-this.getPathLength()>5e-5)return null;const j=Math.round(g/this.getPathLength()*(this.equidistantCache.points.length-1));return this.equidistantCache.points[j]||null}constructor(g,$,b){super(g,$,b),this.type="textPath",this.textWidth=0,this.textHeight=0,this.pathLength=-1,this.glyphInfo=null,this.letterSpacingCache=[],this.measuresCache=new Map([["",0]]);const j=this.getHrefAttribute().getDefinition();this.text=this.getTextFromNode(),this.dataArray=this.parsePathData(j)}}const dataUriRegex=/^\s*data:(([^/,;]+\/[^/,;]+)(?:;([^,;=]+=[^,;=]+))?)?(?:;(base64))?,(.*)$/i;class ImageElement extends RenderedElement{async loadImage(g){try{const $=await this.document.createImage(g);this.image=$}catch($){console.error('Error while loading image "'.concat(g,'":'),$)}this.loaded=!0}async loadSvg(g){const $=dataUriRegex.exec(g);if($){const b=$[5];b&&($[4]==="base64"?this.image=atob(b):this.image=decodeURIComponent(b))}else try{const j=await(await this.document.fetch(g)).text();this.image=j}catch(b){console.error('Error while loading image "'.concat(g,'":'),b)}this.loaded=!0}renderChildren(g){const{document:$,image:b,loaded:j}=this,_e=this.getAttribute("x").getPixels("x"),et=this.getAttribute("y").getPixels("y"),tt=this.getStyle("width").getPixels("x"),nt=this.getStyle("height").getPixels("y");if(!(!j||!b||!tt||!nt)){if(g.save(),g.translate(_e,et),typeof b=="string"){const rt=$.canvg.forkString(g,b,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:0,offsetY:0,scaleWidth:tt,scaleHeight:nt}),{documentElement:it}=rt.document;it&&(it.parent=this),rt.render()}else $.setViewBox({ctx:g,aspectRatio:this.getAttribute("preserveAspectRatio").getString(),width:tt,desiredWidth:b.width,height:nt,desiredHeight:b.height}),this.loaded&&(!("complete"in b)||b.complete)&&g.drawImage(b,0,0);g.restore()}}getBoundingBox(){const g=this.getAttribute("x").getPixels("x"),$=this.getAttribute("y").getPixels("y"),b=this.getStyle("width").getPixels("x"),j=this.getStyle("height").getPixels("y");return new BoundingBox(g,$,g+b,$+j)}constructor(g,$,b){super(g,$,b),this.type="image",this.loaded=!1;const j=this.getHrefAttribute().getString();if(!j)return;const _e=j.endsWith(".svg")||/^\s*data:image\/svg\+xml/i.test(j);g.images.push(this),_e?this.loadSvg(j):this.loadImage(j)}}class SymbolElement extends RenderedElement{render(g){}constructor(...g){super(...g),this.type="symbol"}}class SVGFontLoader{async load(g,$){try{const{document:b}=this,_e=(await b.canvg.parser.load($)).getElementsByTagName("font");Array.from(_e).forEach(et=>{const tt=b.createElement(et);b.definitions[g]=tt})}catch(b){console.error('Error while loading font "'.concat($,'":'),b)}this.loaded=!0}constructor(g){this.document=g,this.loaded=!1,g.fonts.push(this)}}class StyleElement extends Element{constructor(g,$,b){super(g,$,b),this.type="style",compressSpaces(Array.from($.childNodes).map(et=>et.textContent).join("").replace(/(\/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,"").replace(/@import.*;/g,"")).split("}").forEach(et=>{const tt=et.trim();if(!tt)return;const nt=tt.split("{"),rt=nt[0].split(","),it=nt[1].split(";");rt.forEach(st=>{const ut=st.trim();if(!ut)return;const at=g.styles[ut]||{};if(it.forEach(ht=>{const ct=ht.indexOf(":"),vt=ht.substr(0,ct).trim(),ft=ht.substr(ct+1,ht.length-ct).trim();vt&&ft&&(at[vt]=new Property(g,vt,ft))}),g.styles[ut]=at,g.stylesSpecificity[ut]=getSelectorSpecificity(ut),ut==="@font-face"){const ht=at["font-family"].getString().replace(/"|'/g,"");at.src.getString().split(",").forEach(vt=>{if(vt.indexOf('format("svg")')>0){const ft=parseExternalUrl(vt);ft&&new SVGFontLoader(g).load(ht,ft)}})}})})}}StyleElement.parseExternalUrl=parseExternalUrl;class UseElement extends RenderedElement{setContext(g){super.setContext(g);const $=this.getAttribute("x"),b=this.getAttribute("y");$.hasValue()&&g.translate($.getPixels("x"),0),b.hasValue()&&g.translate(0,b.getPixels("y"))}path(g){const{element:$}=this;$&&$.path(g)}renderChildren(g){const{document:$,element:b}=this;if(b){let j=b;if(b.type==="symbol"&&(j=new SVGElement($),j.attributes.viewBox=new Property($,"viewBox",b.getAttribute("viewBox").getString()),j.attributes.preserveAspectRatio=new Property($,"preserveAspectRatio",b.getAttribute("preserveAspectRatio").getString()),j.attributes.overflow=new Property($,"overflow",b.getAttribute("overflow").getString()),j.children=b.children,b.styles.opacity=new Property($,"opacity",this.calculateOpacity())),j.type==="svg"){const et=this.getStyle("width",!1,!0),tt=this.getStyle("height",!1,!0);et.hasValue()&&(j.attributes.width=new Property($,"width",et.getString())),tt.hasValue()&&(j.attributes.height=new Property($,"height",tt.getString()))}const _e=j.parent;j.parent=this,j.render(g),j.parent=_e}}getBoundingBox(g){const{element:$}=this;return $?$.getBoundingBox(g):null}elementTransform(){const{document:g,element:$}=this;return $?Transform.fromElement(g,$):null}get element(){return this.cachedElement||(this.cachedElement=this.getHrefAttribute().getDefinition()),this.cachedElement}constructor(...g){super(...g),this.type="use"}}function imGet(d,g,$,b,j,_e){return d[$*b*4+g*4+_e]}function imSet(d,g,$,b,j,_e,et){d[$*b*4+g*4+_e]=et}function m(d,g,$){return d[g]*$}function c(d,g,$,b){return g+Math.cos(d)*$+Math.sin(d)*b}class FeColorMatrixElement extends Element{apply(g,$,b,j,_e){const{includeOpacity:et,matrix:tt}=this,nt=g.getImageData(0,0,j,_e);for(let rt=0;rt<_e;rt++)for(let it=0;it{at.addBoundingBox(ht.getBoundingBox(g))}),j=Math.floor(at.x1),_e=Math.floor(at.y1),et=Math.floor(at.width),tt=Math.floor(at.height)}const nt=this.removeStyles($,MaskElement.ignoreStyles),rt=b.createCanvas(j+et,_e+tt),it=rt.getContext("2d");b.screen.setDefaults(it),this.renderChildren(it),new FeColorMatrixElement(b,{nodeType:1,childNodes:[],attributes:[{nodeName:"type",value:"luminanceToAlpha"},{nodeName:"includeOpacity",value:"true"}]}).apply(it,0,0,j+et,_e+tt);const st=b.createCanvas(j+et,_e+tt),ut=st.getContext("2d");b.screen.setDefaults(ut),$.render(ut),ut.globalCompositeOperation="destination-in",ut.fillStyle=it.createPattern(rt,"no-repeat"),ut.fillRect(0,0,j+et,_e+tt),g.fillStyle=ut.createPattern(st,"no-repeat"),g.fillRect(0,0,j+et,_e+tt),this.restoreStyles($,nt)}render(g){}constructor(...g){super(...g),this.type="mask"}}MaskElement.ignoreStyles=["mask","transform","clip-path"];const noop=()=>{};class ClipPathElement extends Element{apply(g){const{document:$}=this,b=Reflect.getPrototypeOf(g),{beginPath:j,closePath:_e}=g;b&&(b.beginPath=noop,b.closePath=noop),Reflect.apply(j,g,[]),this.children.forEach(et=>{if(!("path"in et))return;let tt="elementTransform"in et?et.elementTransform():null;tt||(tt=Transform.fromElement($,et)),tt&&tt.apply(g),et.path(g),b&&(b.closePath=_e),tt&&tt.unapply(g)}),Reflect.apply(_e,g,[]),g.clip(),b&&(b.beginPath=j,b.closePath=_e)}render(g){}constructor(...g){super(...g),this.type="clipPath"}}class FilterElement extends Element{apply(g,$){const{document:b,children:j}=this,_e="getBoundingBox"in $?$.getBoundingBox(g):null;if(!_e)return;let et=0,tt=0;j.forEach(ft=>{const gt=ft.extraFilterDistance||0;et=Math.max(et,gt),tt=Math.max(tt,gt)});const nt=Math.floor(_e.width),rt=Math.floor(_e.height),it=nt+2*et,st=rt+2*tt;if(it<1||st<1)return;const ut=Math.floor(_e.x),at=Math.floor(_e.y),ht=this.removeStyles($,FilterElement.ignoreStyles),ct=b.createCanvas(it,st),vt=ct.getContext("2d");b.screen.setDefaults(vt),vt.translate(-ut+et,-at+tt),$.render(vt),j.forEach(ft=>{typeof ft.apply=="function"&&ft.apply(vt,0,0,it,st)}),g.drawImage(ct,0,0,it,st,ut-et,at-tt,it,st),this.restoreStyles($,ht)}render(g){}constructor(...g){super(...g),this.type="filter"}}FilterElement.ignoreStyles=["filter","transform","clip-path"];class FeDropShadowElement extends Element{apply(g,$,b,j,_e){}constructor(g,$,b){super(g,$,b),this.type="feDropShadow",this.addStylesFromStyleDefinition()}}class FeMorphologyElement extends Element{apply(g,$,b,j,_e){}constructor(...g){super(...g),this.type="feMorphology"}}class FeCompositeElement extends Element{apply(g,$,b,j,_e){}constructor(...g){super(...g),this.type="feComposite"}}class FeGaussianBlurElement extends Element{apply(g,$,b,j,_e){const{document:et,blurRadius:tt}=this,nt=et.window?et.window.document.body:null,rt=g.canvas;rt.id=et.getUniqueId(),nt&&(rt.style.display="none",nt.appendChild(rt)),processCanvasRGBA(rt,$,b,j,_e,tt),nt&&nt.removeChild(rt)}constructor(g,$,b){super(g,$,b),this.type="feGaussianBlur",this.blurRadius=Math.floor(this.getAttribute("stdDeviation").getNumber()),this.extraFilterDistance=this.blurRadius}}class TitleElement extends Element{constructor(...g){super(...g),this.type="title"}}class DescElement extends Element{constructor(...g){super(...g),this.type="desc"}}const elements={svg:SVGElement,rect:RectElement,circle:CircleElement,ellipse:EllipseElement,line:LineElement,polyline:PolylineElement,polygon:PolygonElement,path:PathElement,pattern:PatternElement,marker:MarkerElement,defs:DefsElement,linearGradient:LinearGradientElement,radialGradient:RadialGradientElement,stop:StopElement,animate:AnimateElement,animateColor:AnimateColorElement,animateTransform:AnimateTransformElement,font:FontElement,"font-face":FontFaceElement,"missing-glyph":MissingGlyphElement,glyph:GlyphElement,text:TextElement,tspan:TSpanElement,tref:TRefElement,a:AElement,textPath:TextPathElement,image:ImageElement,g:GElement,symbol:SymbolElement,style:StyleElement,use:UseElement,mask:MaskElement,clipPath:ClipPathElement,filter:FilterElement,feDropShadow:FeDropShadowElement,feMorphology:FeMorphologyElement,feComposite:FeCompositeElement,feColorMatrix:FeColorMatrixElement,feGaussianBlur:FeGaussianBlurElement,title:TitleElement,desc:DescElement};function createCanvas(d,g){const $=document.createElement("canvas");return $.width=d,$.height=g,$}async function createImage(d){let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;const $=document.createElement("img");return g&&($.crossOrigin="Anonymous"),new Promise((b,j)=>{$.onload=()=>{b($)},$.onerror=(_e,et,tt,nt,rt)=>{j(rt)},$.src=d})}const DEFAULT_EM_SIZE=12;class Document{bindCreateImage(g,$){return typeof $=="boolean"?(b,j)=>g(b,typeof j=="boolean"?j:$):g}get window(){return this.screen.window}get fetch(){return this.screen.fetch}get ctx(){return this.screen.ctx}get emSize(){const{emSizeStack:g}=this;return g[g.length-1]||DEFAULT_EM_SIZE}set emSize(g){const{emSizeStack:$}=this;$.push(g)}popEmSize(){const{emSizeStack:g}=this;g.pop()}getUniqueId(){return"canvg".concat(++this.uniqueId)}isImagesLoaded(){return this.images.every(g=>g.loaded)}isFontsLoaded(){return this.fonts.every(g=>g.loaded)}createDocumentElement(g){const $=this.createElement(g.documentElement);return $.root=!0,$.addStylesFromStyleDefinition(),this.documentElement=$,$}createElement(g){const $=g.nodeName.replace(/^[^:]+:/,""),b=Document.elementTypes[$];return b?new b(this,g):new UnknownElement(this,g)}createTextNode(g){return new TextNode(this,g)}setViewBox(g){this.screen.setViewBox({document:this,...g})}constructor(g,{rootEmSize:$=DEFAULT_EM_SIZE,emSize:b=DEFAULT_EM_SIZE,createCanvas:j=Document.createCanvas,createImage:_e=Document.createImage,anonymousCrossOrigin:et}={}){this.canvg=g,this.definitions={},this.styles={},this.stylesSpecificity={},this.images=[],this.fonts=[],this.emSizeStack=[],this.uniqueId=0,this.screen=g.screen,this.rootEmSize=$,this.emSize=b,this.createCanvas=j,this.createImage=this.bindCreateImage(_e,et),this.screen.wait(()=>this.isImagesLoaded()),this.screen.wait(()=>this.isFontsLoaded())}}Document.createCanvas=createCanvas;Document.createImage=createImage;Document.elementTypes=elements;class Canvg{static async from(g,$){let b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const _e=await new Parser(b).parse($);return new Canvg(g,_e,b)}static fromString(g,$){let b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};const _e=new Parser(b).parseFromString($);return new Canvg(g,_e,b)}fork(g,$){let b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Canvg.from(g,$,{...this.options,...b})}forkString(g,$){let b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return Canvg.fromString(g,$,{...this.options,...b})}ready(){return this.screen.ready()}isReady(){return this.screen.isReady()}async render(){let g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};this.start({enableRedraw:!0,ignoreAnimation:!0,ignoreMouse:!0,...g}),await this.ready(),this.stop()}start(){let g=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const{documentElement:$,screen:b,options:j}=this;b.start($,{enableRedraw:!0,...j,...g})}stop(){this.screen.stop()}resize(g){let $=arguments.length>1&&arguments[1]!==void 0?arguments[1]:g,b=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;this.documentElement.resize(g,$,b)}constructor(g,$,b={}){this.parser=new Parser(b),this.screen=new Screen(g,b),this.options=b;const j=new Document(this,b),_e=j.createDocumentElement($);this.document=j,this.documentElement=_e}}const preset=index.offscreen();async function toPng(d){const{width:g,height:$,svg:b}=d;console.log("svg",b);const j=new OffscreenCanvas(g,$),_e=j.getContext("2d");await(await Canvg.from(_e,b.outerHTML,preset)).render();const tt=await j.convertToBlob();return URL.createObjectURL(tt)}function Diagram({ast:d,semantics:g,diagramType:$}){const[b,j]=React.useState(null),[_e,et]=React.useState(null),[tt,nt]=React.useState(null),rt=async()=>{tt?(j(saveSvgUrl(tt)),et(await toPng({svg:tt,width:tt.clientWidth*2,height:tt.clientHeight*2}))):(j(null),et(null))},it=async st=>{nt(st),j(null),et(null)};return jsxRuntimeExports.jsxs("div",{children:[b&&_e?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{}):jsxRuntimeExports.jsx("button",{onClick:rt,children:"Export"}),b&&_e&&jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("a",{href:b,download:`${$}.svg`,children:"Download SVG"}),jsxRuntimeExports.jsx("span",{children:" | "}),jsxRuntimeExports.jsx("a",{href:_e,download:`${$}.png`,children:"PNG"})]}),$==="evaporating-cloud"&&jsxRuntimeExports.jsx(Cloud,{ast:d,setSvgElem:it}),$==="goal-tree"&&jsxRuntimeExports.jsx(Tree,{semantics:g,setSvgElem:it}),$==="problem-tree"&&jsxRuntimeExports.jsx(Tree,{semantics:g,setSvgElem:it})]})}const exampleGoalTreeText=`Goal: "Make money now and in the future" +CSF_revUp: "Generate more revenue" +CSF_costsDown: "Control costs" +keepCust: "Protect relationship with existing customers" +newCust: "Acquire new customers" + +reduceInfra: "Reduce infrastructure spending" +retain: "Retain employees" +marketSalary: "Keep up with market salaries" + +morale: "Maintain employee morale" +features: "Develop new features" + +newCust <- features + +# This is probably the wrong place for 'retain' +features <- retain + +CSF_revUp <- newCust +CSF_revUp <- keepCust +CSF_costsDown <- reduceInfra +retain <- marketSalary +retain <- morale +`,exampleEvaporatingCloudText=` +A: Maximize business performance + +B: Subordinate all decisions to the financial goal + +C: Ensure people are in a state of optimal performance + +D: Subordinate people's needs to the financial goal + +B <- D: *inject* Psychological flow triggers + +D': Attend to people's needs (& let people work) +`,exampleProblemTreeText=` +UDE_bad: "Bad user experience" +cluttered: "Cluttered interface" +UDE_bad <- cluttered +ux: "Low investment in UX design" +features: "Many features added" +cluttered <- ux && features +`;let GrammarLocation$4=class{constructor(g,$){this.source=g,this.start=$}toString(){return String(this.source)}offset(g){return{line:g.line+this.start.line-1,column:g.line===1?g.column+this.start.column-1:g.column,offset:g.offset+this.start.offset}}static offsetStart(g){return g.source&&typeof g.source.offset=="function"?g.source.offset(g.start):g.start}static offsetEnd(g){return g.source&&typeof g.source.offset=="function"?g.source.offset(g.end):g.end}};var grammarLocation=GrammarLocation$4;const GrammarLocation$3=grammarLocation,setProtoOf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,g){d.__proto__=g}||function(d,g){for(const $ in g)Object.prototype.hasOwnProperty.call(g,$)&&(d[$]=g[$])};let GrammarError$3=class extends Error{constructor(g,$,b){super(g),setProtoOf(this,GrammarError$3.prototype),this.name="GrammarError",this.location=$,b===void 0&&(b=[]),this.diagnostics=b,this.stage=null,this.problems=[["error",g,$,b]]}toString(){let g=super.toString();this.location&&(g+=` + at `,this.location.source!==void 0&&this.location.source!==null&&(g+=`${this.location.source}:`),g+=`${this.location.start.line}:${this.location.start.column}`);for(const $ of this.diagnostics)g+=` + from `,$.location.source!==void 0&&$.location.source!==null&&(g+=`${$.location.source}:`),g+=`${$.location.start.line}:${$.location.start.column}: ${$.message}`;return g}format(g){const $=g.map(({source:_e,text:et})=>({source:_e,text:et!=null?String(et).split(/\r\n|\n|\r/g):[]}));function b(_e,et,tt=""){let nt="";const rt=$.find(({source:ut})=>ut===_e.source),it=_e.start,st=GrammarLocation$3.offsetStart(_e);if(rt){const ut=_e.end,at=rt.text[it.line-1],ct=(it.line===ut.line?ut.column:at.length+1)-it.column||1;tt&&(nt+=` +note: ${tt}`),nt+=` + --> ${_e.source}:${st.line}:${st.column} +${"".padEnd(et)} | +${st.line.toString().padStart(et)} | ${at} +${"".padEnd(et)} | ${"".padEnd(it.column-1)}${"".padEnd(ct,"^")}`}else nt+=` + at ${_e.source}:${st.line}:${st.column}`,tt&&(nt+=`: ${tt}`);return nt}function j(_e,et,tt,nt=[]){let rt=-1/0;tt?rt=nt.reduce((st,{location:ut})=>Math.max(st,GrammarLocation$3.offsetStart(ut).line),tt.start.line):rt=Math.max.apply(null,nt.map(st=>st.location.start.line)),rt=rt.toString().length;let it=`${_e}: ${et}`;tt&&(it+=b(tt,rt));for(const st of nt)it+=b(st.location,rt,st.message);return it}return this.problems.filter(_e=>_e[0]!=="info").map(_e=>j(..._e)).join(` + +`)}};var grammarError=GrammarError$3;const visitor$b={build(d){function g(et,...tt){return d[et.type](et,...tt)}function $(){}function b(et,...tt){return g(et.expression,...tt)}function j(et){return function(tt,...nt){tt[et].forEach(rt=>g(rt,...nt))}}const _e={grammar(et,...tt){et.topLevelInitializer&&g(et.topLevelInitializer,...tt),et.initializer&&g(et.initializer,...tt),et.rules.forEach(nt=>g(nt,...tt))},top_level_initializer:$,initializer:$,rule:b,named:b,choice:j("alternatives"),action:b,sequence:j("elements"),labeled:b,text:b,simple_and:b,simple_not:b,optional:b,zero_or_more:b,one_or_more:b,repeated(et,...tt){return et.delimiter&&g(et.delimiter,...tt),g(et.expression,...tt)},group:b,semantic_and:$,semantic_not:$,rule_ref:$,literal:$,class:$,any:$};return Object.keys(_e).forEach(et=>{Object.prototype.hasOwnProperty.call(d,et)||(d[et]=_e[et])}),g}};var visitor_1=visitor$b;const visitor$a=visitor_1,asts$7={findRule(d,g){for(let $=0;$1&&_e.delimiter&&j(_e.delimiter))},semantic_and:b,semantic_not:b,rule_ref(_e){const et=asts$7.findRule(d,_e.name);return et?j(et):void 0},literal(_e){return _e.value!==""},class:$,any:$});return j(g)}};var asts_1=asts$7;const opcodes={PUSH:0,PUSH_EMPTY_STRING:35,PUSH_UNDEFINED:1,PUSH_NULL:2,PUSH_FAILED:3,PUSH_EMPTY_ARRAY:4,PUSH_CURR_POS:5,POP:6,POP_CURR_POS:7,POP_N:8,NIP:9,APPEND:10,WRAP:11,TEXT:12,PLUCK:36,IF:13,IF_ERROR:14,IF_NOT_ERROR:15,IF_LT:30,IF_GE:31,IF_LT_DYNAMIC:32,IF_GE_DYNAMIC:33,WHILE_NOT_ERROR:16,MATCH_ANY:17,MATCH_STRING:18,MATCH_STRING_IC:19,MATCH_CHAR_CLASS:20,MATCH_REGEXP:20,ACCEPT_N:21,ACCEPT_STRING:22,FAIL:23,LOAD_SAVED_POS:24,UPDATE_SAVED_POS:25,CALL:26,RULE:27,SILENT_FAILS_ON:28,SILENT_FAILS_OFF:29,SOURCE_MAP_PUSH:37,SOURCE_MAP_POP:38,SOURCE_MAP_LABEL_PUSH:39,SOURCE_MAP_LABEL_POP:40};var opcodes_1=opcodes;const visitor$9=visitor_1,asts$6=asts_1,GrammarError$2=grammarError,ALWAYS_MATCH$1=1,SOMETIMES_MATCH$1=0,NEVER_MATCH$1=-1;function inferenceMatchResult$1(d){function g(et){return et.match=SOMETIMES_MATCH$1}function $(et){return _e(et.expression),et.match=ALWAYS_MATCH$1}function b(et){return et.match=_e(et.expression)}function j(et,tt){const nt=et.length;let rt=0,it=0;for(let st=0;st0?NEVER_MATCH$1:SOMETIMES_MATCH$1}const _e=visitor$9.build({rule(et){let tt,nt=0;if(typeof et.match>"u"){et.match=SOMETIMES_MATCH$1;do if(tt=et.match,et.match=_e(et.expression),++nt>6)throw new GrammarError$2("Infinity cycle detected when trying to evaluate node match result",et.location);while(tt!==et.match)}return et.match},named:b,choice(et){return et.match=j(et.alternatives,!0)},action:b,sequence(et){return et.match=j(et.elements,!1)},labeled:b,text:b,simple_and:b,simple_not(et){return et.match=-_e(et.expression)},optional:$,zero_or_more:$,one_or_more:b,repeated(et){const tt=_e(et.expression),nt=et.delimiter?_e(et.delimiter):NEVER_MATCH$1,rt=et.min?et.min:et.max;return rt.type!=="constant"||et.max.type!=="constant"?et.match=SOMETIMES_MATCH$1:et.max.value===0||et.max.value!==null&&rt.value>et.max.value?et.match=NEVER_MATCH$1:tt===NEVER_MATCH$1?et.match=rt.value===0?ALWAYS_MATCH$1:NEVER_MATCH$1:tt===ALWAYS_MATCH$1?et.delimiter&&rt.value>=2?et.match=nt:et.match=ALWAYS_MATCH$1:et.delimiter&&rt.value>=2?et.match=nt===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:et.match=rt.value===0?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:b,semantic_and:g,semantic_not:g,rule_ref(et){const tt=asts$6.findRule(d,et.name);return et.match=_e(tt)},literal(et){const tt=et.value.length===0?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return et.match=tt},class(et){const tt=et.parts.length===0?NEVER_MATCH$1:SOMETIMES_MATCH$1;return et.match=tt},any:g});_e(d)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1;inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1;inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1;const asts$5=asts_1,op$1=opcodes_1,visitor$8=visitor_1,{ALWAYS_MATCH,SOMETIMES_MATCH,NEVER_MATCH}=inferenceMatchResult_1;function generateBytecode$1(d,g){const $=[],b=[],j=[],_e=[],et=[];function tt(Ct){const _t=$.indexOf(Ct);return _t===-1?$.push(Ct)-1:_t}function nt(Ct){const _t={value:Ct.parts,inverted:Ct.inverted,ignoreCase:Ct.ignoreCase},Tt=JSON.stringify(_t),kt=b.findIndex(Mt=>JSON.stringify(Mt)===Tt);return kt===-1?b.push(_t)-1:kt}function rt(Ct){const _t=JSON.stringify(Ct),Tt=j.findIndex(kt=>JSON.stringify(kt)===_t);return Tt===-1?j.push(Ct)-1:Tt}function it(Ct,_t,Tt){const kt={predicate:Ct,params:_t,body:Tt.code,location:Tt.codeLocation},Mt=JSON.stringify(kt),Vt=_e.findIndex(Jt=>JSON.stringify(Jt)===Mt);return Vt===-1?_e.push(kt)-1:Vt}function st(Ct){return et.push(Ct)-1}function ut(Ct){const _t={};return Object.keys(Ct).forEach(Tt=>{_t[Tt]=Ct[Tt]}),_t}function at(Ct,..._t){return Ct.concat(..._t)}function ht(Ct,_t,Tt,kt){return Ct===ALWAYS_MATCH?Tt:Ct===NEVER_MATCH?kt:_t.concat([Tt.length,kt.length],Tt,kt)}function ct(Ct,_t){return Ct.concat([_t.length],_t)}function vt(Ct,_t,Tt,kt){const Mt=Object.keys(Tt).map(Vt=>kt-Tt[Vt]);return[op$1.CALL,Ct,_t,Mt.length].concat(Mt)}function ft(Ct,_t,Tt){const kt=Ct.match|0;return at([op$1.PUSH_CURR_POS],[op$1.SILENT_FAILS_ON],Ot(Ct,{sp:Tt.sp+1,env:ut(Tt.env),action:null}),[op$1.SILENT_FAILS_OFF],ht(_t?-kt:kt,[_t?op$1.IF_ERROR:op$1.IF_NOT_ERROR],at([op$1.POP],[_t?op$1.POP:op$1.POP_CURR_POS],[op$1.PUSH_UNDEFINED]),at([op$1.POP],[_t?op$1.POP_CURR_POS:op$1.POP],[op$1.PUSH_FAILED])))}function gt(Ct,_t,Tt){const kt=it(!0,Object.keys(Tt.env),Ct);return at([op$1.UPDATE_SAVED_POS],vt(kt,0,Tt.env,Tt.sp),ht(Ct.match|0,[op$1.IF],at([op$1.POP],_t?[op$1.PUSH_FAILED]:[op$1.PUSH_UNDEFINED]),at([op$1.POP],_t?[op$1.PUSH_UNDEFINED]:[op$1.PUSH_FAILED])))}function pt(Ct){return ct([op$1.WHILE_NOT_ERROR],at([op$1.APPEND],Ct))}function yt(Ct,_t,Tt,kt){switch(Ct.type){case"constant":return{pre:[],post:[],sp:Tt};case"variable":return Ct.sp=kt+Tt-_t[Ct.value],{pre:[],post:[],sp:Tt};case"function":{Ct.sp=kt;const Mt=it(!0,Object.keys(_t),{code:Ct.value,codeLocation:Ct.codeLocation});return{pre:vt(Mt,0,_t,Tt),post:[op$1.NIP],sp:Tt+1}}default:throw new Error(`Unknown boundary type "${Ct.type}" for the "repeated" node`)}}function At(Ct,_t){if(_t.value!==null){const Tt=_t.type==="constant"?[op$1.IF_GE,_t.value]:[op$1.IF_GE_DYNAMIC,_t.sp];return ht(SOMETIMES_MATCH,Tt,[op$1.PUSH_FAILED],Ct)}return Ct}function Dt(Ct,_t){const Tt=_t.type==="constant"?[op$1.IF_LT,_t.value]:[op$1.IF_LT_DYNAMIC,_t.sp];return at(Ct,ht(SOMETIMES_MATCH,Tt,[op$1.POP,op$1.POP_CURR_POS,op$1.PUSH_FAILED],[op$1.NIP]))}function St(Ct,_t,Tt,kt,Mt){return Ct?at([op$1.PUSH_CURR_POS],Ot(Ct,{sp:kt.sp+Mt+1,env:ut(kt.env),action:null}),ht(Ct.match|0,[op$1.IF_NOT_ERROR],at([op$1.POP],Tt,ht(-_t,[op$1.IF_ERROR],[op$1.POP,op$1.POP_CURR_POS,op$1.PUSH_FAILED],[op$1.NIP])),[op$1.NIP])):Tt}function Bt(Ct){return g&&g.output==="source-and-map"&&Object.entries(Ct).forEach(([_t,Tt])=>{Ct[_t]=function(kt,...Mt){const Vt=Tt(kt,...Mt);return Vt===void 0||!kt.location?Vt:at([op$1.SOURCE_MAP_PUSH,st(kt.location)],Vt,[op$1.SOURCE_MAP_POP])}}),visitor$8.build(Ct)}const Ot=Bt({grammar(Ct){Ct.rules.forEach(Ot),Ct.literals=$,Ct.classes=b,Ct.expectations=j,Ct.functions=_e,Ct.locations=et},rule(Ct){Ct.bytecode=Ot(Ct.expression,{sp:-1,env:{},pluck:[],action:null})},named(Ct,_t){const Tt=Ct.match|0,kt=Tt===NEVER_MATCH?null:rt({type:"rule",value:Ct.name});return at([op$1.SILENT_FAILS_ON],Ot(Ct.expression,_t),[op$1.SILENT_FAILS_OFF],ht(Tt,[op$1.IF_ERROR],[op$1.FAIL,kt],[]))},choice(Ct,_t){function Tt(kt,Mt){const Vt=kt[0].match|0,Jt=Ot(kt[0],{sp:Mt.sp,env:ut(Mt.env),action:null});return Vt===ALWAYS_MATCH?Jt:at(Jt,kt.length>1?ht(SOMETIMES_MATCH,[op$1.IF_ERROR],at([op$1.POP],Tt(kt.slice(1),Mt)),[]):[])}return Tt(Ct.alternatives,_t)},action(Ct,_t){const Tt=ut(_t.env),kt=Ct.expression.type!=="sequence"||Ct.expression.elements.length===0,Mt=Ot(Ct.expression,{sp:_t.sp+(kt?1:0),env:Tt,action:Ct}),Vt=Ct.expression.match|0,Jt=kt&&Vt!==NEVER_MATCH?it(!1,Object.keys(Tt),Ct):null;return kt?at([op$1.PUSH_CURR_POS],Mt,ht(Vt,[op$1.IF_NOT_ERROR],at([op$1.LOAD_SAVED_POS,1],vt(Jt,1,Tt,_t.sp+2)),[]),[op$1.NIP]):Mt},sequence(Ct,_t){function Tt(kt,Mt){if(kt.length>0){const Vt=Ct.elements.length-kt.length+1;return at(Ot(kt[0],{sp:Mt.sp,env:Mt.env,pluck:Mt.pluck,action:null}),ht(kt[0].match|0,[op$1.IF_NOT_ERROR],Tt(kt.slice(1),{sp:Mt.sp+1,env:Mt.env,pluck:Mt.pluck,action:Mt.action}),at(Vt>1?[op$1.POP_N,Vt]:[op$1.POP],[op$1.POP_CURR_POS],[op$1.PUSH_FAILED])))}else{if(Mt.pluck.length>0)return at([op$1.PLUCK,Ct.elements.length+1,Mt.pluck.length],Mt.pluck.map(Vt=>Mt.sp-Vt));if(Mt.action){const Vt=it(!1,Object.keys(Mt.env),Mt.action);return at([op$1.LOAD_SAVED_POS,Ct.elements.length],vt(Vt,Ct.elements.length+1,Mt.env,Mt.sp))}else return at([op$1.WRAP,Ct.elements.length],[op$1.NIP])}}return at([op$1.PUSH_CURR_POS],Tt(Ct.elements,{sp:_t.sp+1,env:_t.env,pluck:[],action:_t.action}))},labeled(Ct,_t){let Tt=_t.env;const kt=Ct.label,Mt=_t.sp+1;kt&&(Tt=ut(_t.env),_t.env[Ct.label]=Mt),Ct.pick&&_t.pluck.push(Mt);const Vt=Ot(Ct.expression,{sp:_t.sp,env:Tt,action:null});return kt&&Ct.labelLocation&&g&&g.output==="source-and-map"?at([op$1.SOURCE_MAP_LABEL_PUSH,Mt,tt(kt),st(Ct.labelLocation)],Vt,[op$1.SOURCE_MAP_LABEL_POP,Mt]):Vt},text(Ct,_t){return at([op$1.PUSH_CURR_POS],Ot(Ct.expression,{sp:_t.sp+1,env:ut(_t.env),action:null}),ht(Ct.match|0,[op$1.IF_NOT_ERROR],at([op$1.POP],[op$1.TEXT]),[op$1.NIP]))},simple_and(Ct,_t){return ft(Ct.expression,!1,_t)},simple_not(Ct,_t){return ft(Ct.expression,!0,_t)},optional(Ct,_t){return at(Ot(Ct.expression,{sp:_t.sp,env:ut(_t.env),action:null}),ht(-(Ct.expression.match|0),[op$1.IF_ERROR],at([op$1.POP],[op$1.PUSH_NULL]),[]))},zero_or_more(Ct,_t){const Tt=Ot(Ct.expression,{sp:_t.sp+1,env:ut(_t.env),action:null});return at([op$1.PUSH_EMPTY_ARRAY],Tt,pt(Tt),[op$1.POP])},one_or_more(Ct,_t){const Tt=Ot(Ct.expression,{sp:_t.sp+1,env:ut(_t.env),action:null});return at([op$1.PUSH_EMPTY_ARRAY],Tt,ht(Ct.expression.match|0,[op$1.IF_NOT_ERROR],at(pt(Tt),[op$1.POP]),at([op$1.POP],[op$1.POP],[op$1.PUSH_FAILED])))},repeated(Ct,_t){const Tt=Ct.min?Ct.min:Ct.max,kt=Tt.type!=="constant"||Tt.value>0,Mt=Ct.max.type!=="constant"&&Ct.max.value!==null,Vt=kt?2:1,Jt=Ct.min?yt(Ct.min,_t.env,_t.sp,2+(Ct.max.type==="function"?1:0)):{pre:[],post:[],sp:_t.sp},Xt=yt(Ct.max,_t.env,Jt.sp,Vt),Nt=Ot(Ct.expression,{sp:Xt.sp+Vt,env:ut(_t.env),action:null}),Lt=Ct.delimiter!==null?Ot(Ct.expression,{sp:Xt.sp+Vt+1,env:ut(_t.env),action:null}):Nt,jt=St(Ct.delimiter,Ct.expression.match|0,Lt,_t,Vt),Yt=At(jt,Ct.max),Qt=Mt?At(Nt,Ct.max):Nt,on=at(kt?[op$1.PUSH_CURR_POS]:[],[op$1.PUSH_EMPTY_ARRAY],Qt,pt(Yt),[op$1.POP]);return at(Jt.pre,Xt.pre,kt?Dt(on,Tt):on,Xt.post,Jt.post)},group(Ct,_t){return Ot(Ct.expression,{sp:_t.sp,env:ut(_t.env),action:null})},semantic_and(Ct,_t){return gt(Ct,!1,_t)},semantic_not(Ct,_t){return gt(Ct,!0,_t)},rule_ref(Ct){return[op$1.RULE,asts$5.indexOfRule(d,Ct.name)]},literal(Ct){if(Ct.value.length>0){const _t=Ct.match|0,kt=_t===SOMETIMES_MATCH||_t===ALWAYS_MATCH&&!Ct.ignoreCase?tt(Ct.ignoreCase?Ct.value.toLowerCase():Ct.value):null,Mt=_t!==ALWAYS_MATCH?rt({type:"literal",value:Ct.value,ignoreCase:Ct.ignoreCase}):null;return ht(_t,Ct.ignoreCase?[op$1.MATCH_STRING_IC,kt]:[op$1.MATCH_STRING,kt],Ct.ignoreCase?[op$1.ACCEPT_N,Ct.value.length]:[op$1.ACCEPT_STRING,kt],[op$1.FAIL,Mt])}return[op$1.PUSH_EMPTY_STRING]},class(Ct){const _t=Ct.match|0,Tt=_t===SOMETIMES_MATCH?nt(Ct):null,kt=_t!==ALWAYS_MATCH?rt({type:"class",value:Ct.parts,inverted:Ct.inverted,ignoreCase:Ct.ignoreCase}):null;return ht(_t,[op$1.MATCH_CHAR_CLASS,Tt],[op$1.ACCEPT_N,1],[op$1.FAIL,kt])},any(Ct){const _t=Ct.match|0,Tt=_t!==ALWAYS_MATCH?rt({type:"any"}):null;return ht(_t,[op$1.MATCH_ANY],[op$1.ACCEPT_N,1],[op$1.FAIL,Tt])}});Ot(d)}var generateBytecode_1=generateBytecode$1,sourceMap={},sourceMapGenerator={},base64Vlq={},base64$3={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$3.encode=function(d){if(0<=d&&d>>=VLQ_BASE_SHIFT,j>0&&(b|=VLQ_CONTINUATION_BIT),$+=base64$2.encode(b);while(j>0);return $};var util$3={};function getArg(d,g,$){if(g in d)return d[g];if(arguments.length===3)return $;throw new Error('"'+g+'" is a required argument.')}util$3.getArg=getArg;const supportsNullProto=function(){return!("__proto__"in Object.create(null))}();function identity(d){return d}function toSetString(d){return isProtoString(d)?"$"+d:d}util$3.toSetString=supportsNullProto?identity:toSetString;function fromSetString(d){return isProtoString(d)?d.slice(1):d}util$3.fromSetString=supportsNullProto?identity:fromSetString;function isProtoString(d){if(!d)return!1;const g=d.length;if(g<9||d.charCodeAt(g-1)!==95||d.charCodeAt(g-2)!==95||d.charCodeAt(g-3)!==111||d.charCodeAt(g-4)!==116||d.charCodeAt(g-5)!==111||d.charCodeAt(g-6)!==114||d.charCodeAt(g-7)!==112||d.charCodeAt(g-8)!==95||d.charCodeAt(g-9)!==95)return!1;for(let $=g-10;$>=0;$--)if(d.charCodeAt($)!==36)return!1;return!0}function strcmp(d,g){return d===g?0:d===null?1:g===null?-1:d>g?1:-1}function compareByGeneratedPositionsInflated(d,g){let $=d.generatedLine-g.generatedLine;return $!==0||($=d.generatedColumn-g.generatedColumn,$!==0)||($=strcmp(d.source,g.source),$!==0)||($=d.originalLine-g.originalLine,$!==0)||($=d.originalColumn-g.originalColumn,$!==0)?$:strcmp(d.name,g.name)}util$3.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(d){return g=>{const $=getURLType(g),b=buildSafeBase(g),j=new URL(g,b);d(j);const _e=j.toString();return $==="absolute"?_e:$==="scheme-relative"?_e.slice(PROTOCOL.length):$==="path-absolute"?_e.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(b,_e)}}function withBase(d,g){return new URL(d,g).toString()}function buildUniqueSegment(d,g){let $=0;do{const b=d+$++;if(g.indexOf(b)===-1)return b}while(!0)}function buildSafeBase(d){const g=d.split("..").length-1,$=buildUniqueSegment("p",d);let b=`${PROTOCOL_AND_HOST}/`;for(let j=0;j0&&!b[b.length-1]&&b.pop();$.length>0&&b.length>0&&$[0]===b[0];)$.shift(),b.shift();return b.map(()=>"..").concat($).join("/")+g.search+g.hash}const ensureDirectory=createSafeHandler(d=>{d.pathname=d.pathname.replace(/\/?$/,"/")}),normalize=createSafeHandler(d=>{});util$3.normalize=normalize;function join(d,g){const $=getURLType(g),b=getURLType(d);if(d=ensureDirectory(d),$==="absolute")return withBase(g,void 0);if(b==="absolute")return withBase(g,d);if($==="scheme-relative")return normalize(g);if(b==="scheme-relative")return withBase(g,withBase(d,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if($==="path-absolute")return normalize(g);if(b==="path-absolute")return withBase(g,withBase(d,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const j=buildSafeBase(g+d),_e=withBase(g,withBase(d,j));return computeRelativeURL(j,_e)}util$3.join=join;function relative(d,g){const $=relativeIfPossible(d,g);return typeof $=="string"?$:normalize(g)}util$3.relative=relative;function relativeIfPossible(d,g){if(getURLType(d)!==getURLType(g))return null;const b=buildSafeBase(d+g),j=new URL(d,b),_e=new URL(g,b);try{new URL("",_e.toString())}catch{return null}return _e.protocol!==j.protocol||_e.user!==j.user||_e.password!==j.password||_e.hostname!==j.hostname||_e.port!==j.port?null:computeRelativeURL(j,_e)}var arraySet={};let ArraySet$1=class{constructor(){this._array=[],this._set=new Map}static fromArray(g,$){const b=new ArraySet$1;for(let j=0,_e=g.length;j<_e;j++)b.add(g[j],$);return b}size(){return this._set.size}add(g,$){const b=this.has(g),j=this._array.length;(!b||$)&&this._array.push(g),b||this._set.set(g,j)}has(g){return this._set.has(g)}indexOf(g){const $=this._set.get(g);if($>=0)return $;throw new Error('"'+g+'" is not in the set.')}at(g){if(g>=0&&g$||b==$&&_e>=j||util$2.compareByGeneratedPositionsInflated(d,g)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(g,$){this._array.forEach(g,$)}add(g){generatedPositionAfter(this._last,g)?(this._last=g,this._array.push(g)):(this._sorted=!1,this._array.push(g))}toArray(){return this._sorted||(this._array.sort(util$2.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$1=util$3,ArraySet=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class{constructor(g){g||(g={}),this._file=util$1.getArg(g,"file",null),this._sourceRoot=util$1.getArg(g,"sourceRoot",null),this._skipValidation=util$1.getArg(g,"skipValidation",!1),this._sources=new ArraySet,this._names=new ArraySet,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(g){const $=g.sourceRoot,b=new SourceMapGenerator$1({file:g.file,sourceRoot:$});return g.eachMapping(function(j){const _e={generated:{line:j.generatedLine,column:j.generatedColumn}};j.source!=null&&(_e.source=j.source,$!=null&&(_e.source=util$1.relative($,_e.source)),_e.original={line:j.originalLine,column:j.originalColumn},j.name!=null&&(_e.name=j.name)),b.addMapping(_e)}),g.sources.forEach(function(j){let _e=j;$!=null&&(_e=util$1.relative($,j)),b._sources.has(_e)||b._sources.add(_e);const et=g.sourceContentFor(j);et!=null&&b.setSourceContent(j,et)}),b}addMapping(g){const $=util$1.getArg(g,"generated"),b=util$1.getArg(g,"original",null);let j=util$1.getArg(g,"source",null),_e=util$1.getArg(g,"name",null);this._skipValidation||this._validateMapping($,b,j,_e),j!=null&&(j=String(j),this._sources.has(j)||this._sources.add(j)),_e!=null&&(_e=String(_e),this._names.has(_e)||this._names.add(_e)),this._mappings.add({generatedLine:$.line,generatedColumn:$.column,originalLine:b&&b.line,originalColumn:b&&b.column,source:j,name:_e})}setSourceContent(g,$){let b=g;this._sourceRoot!=null&&(b=util$1.relative(this._sourceRoot,b)),$!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$1.toSetString(b)]=$):this._sourcesContents&&(delete this._sourcesContents[util$1.toSetString(b)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))}applySourceMap(g,$,b){let j=$;if($==null){if(g.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);j=g.file}const _e=this._sourceRoot;_e!=null&&(j=util$1.relative(_e,j));const et=this._mappings.toArray().length>0?new ArraySet:this._sources,tt=new ArraySet;this._mappings.unsortedForEach(function(nt){if(nt.source===j&&nt.originalLine!=null){const st=g.originalPositionFor({line:nt.originalLine,column:nt.originalColumn});st.source!=null&&(nt.source=st.source,b!=null&&(nt.source=util$1.join(b,nt.source)),_e!=null&&(nt.source=util$1.relative(_e,nt.source)),nt.originalLine=st.line,nt.originalColumn=st.column,st.name!=null&&(nt.name=st.name))}const rt=nt.source;rt!=null&&!et.has(rt)&&et.add(rt);const it=nt.name;it!=null&&!tt.has(it)&&tt.add(it)},this),this._sources=et,this._names=tt,g.sources.forEach(function(nt){const rt=g.sourceContentFor(nt);rt!=null&&(b!=null&&(nt=util$1.join(b,nt)),_e!=null&&(nt=util$1.relative(_e,nt)),this.setSourceContent(nt,rt))},this)}_validateMapping(g,$,b,j){if($&&typeof $.line!="number"&&typeof $.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(g&&"line"in g&&"column"in g&&g.line>0&&g.column>=0&&!$&&!b&&!j)){if(!(g&&"line"in g&&"column"in g&&$&&"line"in $&&"column"in $&&g.line>0&&g.column>=0&&$.line>0&&$.column>=0&&b))throw new Error("Invalid mapping: "+JSON.stringify({generated:g,source:b,original:$,name:j}))}}_serializeMappings(){let g=0,$=1,b=0,j=0,_e=0,et=0,tt="",nt,rt,it,st;const ut=this._mappings.toArray();for(let at=0,ht=ut.length;at0){if(!util$1.compareByGeneratedPositionsInflated(rt,ut[at-1]))continue;nt+=","}nt+=base64VLQ.encode(rt.generatedColumn-g),g=rt.generatedColumn,rt.source!=null&&(st=this._sources.indexOf(rt.source),nt+=base64VLQ.encode(st-et),et=st,nt+=base64VLQ.encode(rt.originalLine-1-j),j=rt.originalLine-1,nt+=base64VLQ.encode(rt.originalColumn-b),b=rt.originalColumn,rt.name!=null&&(it=this._names.indexOf(rt.name),nt+=base64VLQ.encode(it-_e),_e=it)),tt+=nt}return tt}_generateSourcesContent(g,$){return g.map(function(b){if(!this._sourcesContents)return null;$!=null&&(b=util$1.relative($,b));const j=util$1.toSetString(b);return Object.prototype.hasOwnProperty.call(this._sourcesContents,j)?this._sourcesContents[j]:null},this)}toJSON(){const g={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(g.file=this._file),this._sourceRoot!=null&&(g.sourceRoot=this._sourceRoot),this._sourcesContents&&(g.sourcesContent=this._generateSourcesContent(g.sources,g.sourceRoot)),g}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3;sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceNode={};const SourceMapGenerator=sourceMapGenerator.SourceMapGenerator,util=util$3,REGEX_NEWLINE=/(\r?\n)/,NEWLINE_CODE=10,isSourceNode="$$$isSourceNode$$$";let SourceNode$2=class{constructor(g,$,b,j,_e){this.children=[],this.sourceContents={},this.line=g??null,this.column=$??null,this.source=b??null,this.name=_e??null,this[isSourceNode]=!0,j!=null&&this.add(j)}static fromStringWithSourceMap(g,$,b){const j=new SourceNode$2,_e=g.split(REGEX_NEWLINE);let et=0;const tt=function(){const at=ct(),ht=ct()||"";return at+ht;function ct(){return et<_e.length?_e[et++]:void 0}};let nt=1,rt=0,it=null,st;return $.eachMapping(function(at){if(it!==null)if(nt=0;$--)this.prepend(g[$]);else if(g[isSourceNode]||typeof g=="string")this.children.unshift(g);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+g);return this}walk(g){let $;for(let b=0,j=this.children.length;b0){for($=[],b=0;b' at an index ${g}. +Bytecode: ${this.bytecode}`);return this.varName+g}static sourceNode(g,$,b){const j=GrammarLocation$2.offsetStart(g);return new SourceNode$1(j.line,j.column?j.column-1:null,String(g.source),$,b)}push(g){++this.sp>this.maxSp&&(this.maxSp=this.sp);const $=this.labels[this.sp],b=[this.name(this.sp)," = ",g,";"];if($)if(this.sourceMapStack.length){const j=Stack$1.sourceNode($.location,b.splice(0,2),$.label),{parts:_e,location:et}=this.sourceMapPopInternal(),tt=et.start.offset<$.location.end.offset?{start:$.location.end,end:et.end,source:et.source}:et,nt=Stack$1.sourceNode(tt,b.concat(` +`));return this.sourceMapStack.push([_e,_e.length+1,et]),new SourceNode$1(null,null,$.location.source,[j,nt])}else return Stack$1.sourceNode($.location,b.concat(` +`));return b.join("")}pop(g){return g!==void 0?(this.sp-=g,Array.from({length:g},($,b)=>this.name(this.sp+1+b))):this.name(this.sp--)}top(){return this.name(this.sp)}index(g){if(g<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack overflow: attempt to get a variable at a negative index ${g}. +Bytecode: ${this.bytecode}`);return this.name(this.sp-g)}result(){if(this.maxSp<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack is empty, can't get the result. +Bytecode: ${this.bytecode}`);return this.name(0)}defines(){return this.maxSp<0?"":this.type+" "+Array.from({length:this.maxSp+1},(g,$)=>this.name($)).join(", ")+";"}checkedIf(g,$,b){const j=this.sp;if($(),b){const _e=this.sp;if(this.sp=j,b(),_e!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+g+": Branches of a condition can't move the stack pointer differently (before: "+j+", after then: "+_e+", after else: "+this.sp+"). Bytecode: "+this.bytecode)}}checkedLoop(g,$){const b=this.sp;if($(),b!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+g+": Body of a loop can't move the stack pointer (before: "+b+", after: "+this.sp+"). Bytecode: "+this.bytecode)}sourceMapPush(g,$){if(this.sourceMapStack.length){const b=this.sourceMapStack[this.sourceMapStack.length-1];b[2].start.offset===$.start.offset&&b[2].end.offset>$.end.offset&&(b[2]={start:$.end,end:b[2].end,source:b[2].source})}this.sourceMapStack.push([g,g.length,$])}sourceMapPopInternal(){const[g,$,b]=this.sourceMapStack.pop(),j=g.splice($).map(_e=>_e instanceof SourceNode$1?_e:_e+` +`);if(j.length){const _e=GrammarLocation$2.offsetStart(b);g.push(new SourceNode$1(_e.line,_e.column-1,String(b.source),j))}return{parts:g,location:b}}sourceMapPop(g){const{location:$}=this.sourceMapPopInternal();if(this.sourceMapStack.length&&$.end.offset"\\x0"+hex(g)).replace(/[\x10-\x1F\x7F-\xFF]/g,g=>"\\x"+hex(g)).replace(/[\u0100-\u0FFF]/g,g=>"\\u0"+hex(g)).replace(/[\u1000-\uFFFF]/g,g=>"\\u"+hex(g))}utils.stringEscape=stringEscape$1;function regexpClassEscape$1(d){return d.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,g=>"\\x0"+hex(g)).replace(/[\x10-\x1F\x7F-\xFF]/g,g=>"\\x"+hex(g)).replace(/[\u0100-\u0FFF]/g,g=>"\\u0"+hex(g)).replace(/[\u1000-\uFFFF]/g,g=>"\\u"+hex(g))}utils.regexpClassEscape=regexpClassEscape$1;function base64$1(d){const g="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",$=d.length%3,b=d.length-$;let j="";for(let _e=0;_e>2],j+=g[(d[_e]&3)<<4|d[_e+1]>>4],j+=g[(d[_e+1]&15)<<2|d[_e+2]>>6],j+=g[d[_e+2]&63];return $===1?(j+=g[d[b]>>2],j+=g[(d[b]&3)<<4],j+="=="):$===2&&(j+=g[d[b]>>2],j+=g[(d[b]&3)<<4|d[b+1]>>4],j+=g[(d[b+1]&15)<<2],j+="="),j}utils.base64=base64$1;const asts$4=asts_1,op=opcodes_1,Stack=stack,VERSION$1=version,{stringEscape,regexpClassEscape}=utils,{SourceNode}=sourceMap,GrammarLocation$1=grammarLocation;function toSourceNode(d,g,$){const b=GrammarLocation$1.offsetStart(g),j=b.line,_e=b.column-1,et=d.split(` +`);return et.length===1?new SourceNode(j,_e,String(g.source),d,$):new SourceNode(null,null,String(g.source),et.map((tt,nt)=>new SourceNode(j+nt,nt===0?_e:0,String(g.source),nt===et.length-1?tt:[tt,` +`],$)))}function wrapInSourceNode(d,g,$,b,j){if($){const _e=GrammarLocation$1.offsetEnd($);return new SourceNode(null,null,String($.source),[d,toSourceNode(g,$,j),new SourceNode(_e.line,_e.column-1,String($.source),b)])}return new SourceNode(null,null,null,[d,g,b])}function generateJS$1(d,g){function $(ct){let vt=!0,ft=0;function gt(pt){return Array.isArray(pt)?pt.map(gt):pt instanceof SourceNode?(ft++,pt.children=gt(pt.children),ft--,pt):(vt?pt=pt.replace(/^(.+)$/gm," $1"):pt=pt.replace(/\n(\s*\S)/g,` + $1`),vt=!ft||pt.endsWith(` +`),pt)}return gt(ct)}function b(ct){return"peg$c"+ct}function j(ct){return"peg$r"+ct}function _e(ct){return"peg$e"+ct}function et(ct){return"peg$f"+ct}function tt(ct){return"peg$parse"+ct}function nt(){function ct(pt){return'"'+stringEscape(pt)+'"'}function vt(pt){return"/^["+(pt.inverted?"^":"")+pt.value.map(yt=>Array.isArray(yt)?regexpClassEscape(yt[0])+"-"+regexpClassEscape(yt[1]):regexpClassEscape(yt)).join("")+"]/"+(pt.ignoreCase?"i":"")}function ft(pt){switch(pt.type){case"rule":return'peg$otherExpectation("'+stringEscape(pt.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape(pt.value)+'", '+pt.ignoreCase+")";case"class":return"peg$classExpectation(["+pt.value.map(At=>Array.isArray(At)?'["'+stringEscape(At[0])+'", "'+stringEscape(At[1])+'"]':'"'+stringEscape(At)+'"').join(", ")+"], "+pt.inverted+", "+pt.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(pt)+")")}}function gt(pt,yt){return wrapInSourceNode(` + var ${et(yt)} = function(${pt.params.join(", ")}) {`,pt.body,pt.location,"};")}return new SourceNode(null,null,g.grammarSource,[d.literals.map((pt,yt)=>" var "+b(yt)+" = "+ct(pt)+";").concat("",d.classes.map((pt,yt)=>" var "+j(yt)+" = "+vt(pt)+";")).concat("",d.expectations.map((pt,yt)=>" var "+_e(yt)+" = "+ft(pt)+";")).concat("").join(` +`),d.functions.map(gt)])}function rt(ct,vt){const ft=[];return ft.push(""),g.trace&&ft.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+ct+","," location: peg$computeLocation(startPos, startPos, true)","});",""),g.cache&&(ft.push("var key = peg$currPos * "+d.rules.length+" + "+vt+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),g.trace&&ft.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+ct+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+ct+","," location: peg$computeLocation(startPos, startPos, true)"," });","}",""),ft.push(" return cached.result;","}","")),ft}function it(ct,vt){const ft=[];return g.cache&&ft.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+vt+" };"),g.trace&&ft.push("","if ("+vt+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+ct+","," result: "+vt+","," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+ct+","," location: peg$computeLocation(startPos, startPos, true)"," });","}"),ft.push("","return "+vt+";"),ft}function st(ct){const vt=[],ft=new Stack(ct.name,"s","var",ct.bytecode);function gt(yt){let At=0;const Dt=yt.length,St=[];let Bt;function Ot(Tt,kt){const Mt=kt+3,Vt=yt[At+Mt-2],Jt=yt[At+Mt-1];let Xt,Nt;ft.checkedIf(At,()=>{At+=Mt,Xt=gt(yt.slice(At,At+Vt)),At+=Vt},Jt>0?()=>{Nt=gt(yt.slice(At,At+Jt)),At+=Jt}:null),St.push("if ("+Tt+") {"),St.push(...$(Xt)),Jt>0&&(St.push("} else {"),St.push(...$(Nt))),St.push("}")}function Ct(Tt){const Mt=yt[At+2-1];let Vt;ft.checkedLoop(At,()=>{At+=2,Vt=gt(yt.slice(At,At+Mt)),At+=Mt}),St.push("while ("+Tt+") {"),St.push(...$(Vt)),St.push("}")}function _t(Tt){const kt=yt[At+Tt-1];return et(yt[At+1])+"("+yt.slice(At+Tt,At+Tt+kt).map(Mt=>ft.index(Mt)).join(", ")+")"}for(;Atft.index(Vt)).join(", ")} ]`,ft.pop(yt[At+1]),St.push(ft.push(Bt)),At+=Mt;break}case op.IF:Ot(ft.top(),0);break;case op.IF_ERROR:Ot(ft.top()+" === peg$FAILED",0);break;case op.IF_NOT_ERROR:Ot(ft.top()+" !== peg$FAILED",0);break;case op.IF_LT:Ot(ft.top()+".length < "+yt[At+1],1);break;case op.IF_GE:Ot(ft.top()+".length >= "+yt[At+1],1);break;case op.IF_LT_DYNAMIC:Ot(ft.top()+".length < ("+ft.index(yt[At+1])+"|0)",1);break;case op.IF_GE_DYNAMIC:Ot(ft.top()+".length >= ("+ft.index(yt[At+1])+"|0)",1);break;case op.WHILE_NOT_ERROR:Ct(ft.top()+" !== peg$FAILED");break;case op.MATCH_ANY:Ot("input.length > peg$currPos",0);break;case op.MATCH_STRING:Ot(d.literals[yt[At+1]].length>1?"input.substr(peg$currPos, "+d.literals[yt[At+1]].length+") === "+b(yt[At+1]):"input.charCodeAt(peg$currPos) === "+d.literals[yt[At+1]].charCodeAt(0),1);break;case op.MATCH_STRING_IC:Ot("input.substr(peg$currPos, "+d.literals[yt[At+1]].length+").toLowerCase() === "+b(yt[At+1]),1);break;case op.MATCH_CHAR_CLASS:Ot(j(yt[At+1])+".test(input.charAt(peg$currPos))",1);break;case op.ACCEPT_N:St.push(ft.push(yt[At+1]>1?"input.substr(peg$currPos, "+yt[At+1]+")":"input.charAt(peg$currPos)")),St.push(yt[At+1]>1?"peg$currPos += "+yt[At+1]+";":"peg$currPos++;"),At+=2;break;case op.ACCEPT_STRING:St.push(ft.push(b(yt[At+1]))),St.push(d.literals[yt[At+1]].length>1?"peg$currPos += "+d.literals[yt[At+1]].length+";":"peg$currPos++;"),At+=2;break;case op.FAIL:St.push(ft.push("peg$FAILED")),St.push("if (peg$silentFails === 0) { peg$fail("+_e(yt[At+1])+"); }"),At+=2;break;case op.LOAD_SAVED_POS:St.push("peg$savedPos = "+ft.index(yt[At+1])+";"),At+=2;break;case op.UPDATE_SAVED_POS:St.push("peg$savedPos = peg$currPos;"),At++;break;case op.CALL:Bt=_t(4),ft.pop(yt[At+2]),St.push(ft.push(Bt)),At+=4+yt[At+3];break;case op.RULE:St.push(ft.push(tt(d.rules[yt[At+1]].name)+"()")),At+=2;break;case op.SILENT_FAILS_ON:St.push("peg$silentFails++;"),At++;break;case op.SILENT_FAILS_OFF:St.push("peg$silentFails--;"),At++;break;case op.SOURCE_MAP_PUSH:ft.sourceMapPush(St,d.locations[yt[At+1]]),At+=2;break;case op.SOURCE_MAP_POP:{ft.sourceMapPop(),At++;break}case op.SOURCE_MAP_LABEL_PUSH:ft.labels[yt[At+1]]={label:d.literals[yt[At+2]],location:d.locations[yt[At+3]]},At+=4;break;case op.SOURCE_MAP_LABEL_POP:delete ft.labels[yt[At+1]],At+=2;break;default:throw new Error("Invalid opcode: "+yt[At]+".",{rule:ct.name,bytecode:yt})}return St}const pt=gt(ct.bytecode);return vt.push(wrapInSourceNode("function ",tt(ct.name),ct.nameLocation,`() { +`,ct.name)),g.trace&&vt.push(" var startPos = peg$currPos;"),vt.push($(ft.defines())),vt.push(...$(rt('"'+stringEscape(ct.name)+'"',asts$4.indexOfRule(d,ct.name)))),vt.push(...$(pt)),vt.push(...$(it('"'+stringEscape(ct.name)+'"',ft.result()))),vt.push("}"),vt}function ut(ct){return ct.codeLocation?toSourceNode(ct.code,ct.codeLocation,"$"+ct.type):ct.code}function at(){const ct=[];d.topLevelInitializer&&(ct.push(ut(d.topLevelInitializer)),ct.push("")),ct.push("function peg$subclass(child, parent) {"," function C() { this.constructor = child; }"," C.prototype = parent.prototype;"," child.prototype = new C();","}","","function peg$SyntaxError(message, expected, found, location) {"," var self = Error.call(this, message);"," // istanbul ignore next Check is a necessary evil to support older environments"," if (Object.setPrototypeOf) {"," Object.setPrototypeOf(self, peg$SyntaxError.prototype);"," }"," self.expected = expected;"," self.found = found;"," self.location = location;",' self.name = "SyntaxError";'," return self;","}","","peg$subclass(peg$SyntaxError, Error);","","function peg$padEnd(str, targetLength, padString) {",' padString = padString || " ";'," if (str.length > targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;",` var filler = peg$padEnd("", offset_s.line.toString().length, ' ');`," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --> " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',` + filler + " | " + peg$padEnd("", s.column - 1, ' ')`,' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),g.trace&&ct.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");const vt="{ "+g.allowedStartRules.map(gt=>gt+": "+tt(gt)).join(", ")+" }",ft=tt(g.allowedStartRules[0]);return ct.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+vt+";"," var peg$startRuleFunction = "+ft+";","",nt(),""," var peg$currPos = 0;"," var peg$savedPos = 0;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = 0;"," var peg$maxFailExpected = [];"," var peg$silentFails = 0;",""),g.cache&&ct.push(" var peg$resultsCache = {};",""),g.trace&&ct.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),ct.push(" var peg$result;","",' if ("startRule" in options) {'," if (!(options.startRule in peg$startRuleFunctions)) {",` throw new Error("Can't start parsing from rule \\"" + options.startRule + "\\".");`," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," p = pos - 1;"," while (!peg$posDetailsCache[p]) {"," p--;"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),d.rules.forEach(gt=>{ct.push(...$(st(gt))),ct.push("")}),d.initializer&&(ct.push(ut(d.initializer)),ct.push("")),ct.push(" peg$result = peg$startRuleFunction();",""," if (peg$result !== peg$FAILED && peg$currPos === input.length) {"," return peg$result;"," } else {"," if (peg$result !== peg$FAILED && peg$currPos < input.length) {"," peg$fail(peg$endExpectation());"," }",""," throw peg$buildStructuredError("," peg$maxFailExpected,"," peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,"," peg$maxFailPos < input.length"," ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)"," : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)"," );"," }","}"),new SourceNode(null,null,g.grammarSource,ct.map(gt=>gt instanceof SourceNode?gt:gt+` +`))}function ht(ct){function vt(){return[`// Generated by Peggy ${VERSION$1}.`,"//","// https://peggyjs.org/"]}function ft(){return g.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join(` +`):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join(` +`)}const pt={bare(){return[...vt(),"(function() {",' "use strict";',"",ct,"",$("return "+ft()+";"),"})()"]},commonjs(){const yt=Object.keys(g.dependencies),At=vt();return At.push("",'"use strict";',""),yt.length>0&&(yt.forEach(Dt=>{At.push("var "+Dt+' = require("'+stringEscape(g.dependencies[Dt])+'");')}),At.push("")),At.push(ct,"","module.exports = "+ft()+";"),At},es(){const yt=Object.keys(g.dependencies),At=vt();return At.push(""),yt.length>0&&(yt.forEach(Dt=>{At.push("import "+Dt+' from "'+stringEscape(g.dependencies[Dt])+'";')}),At.push("")),At.push(ct,"","export {"," peg$SyntaxError as SyntaxError,",g.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),At},amd(){const yt=Object.keys(g.dependencies),Dt="["+yt.map(Bt=>g.dependencies[Bt]).map(Bt=>'"'+stringEscape(Bt)+'"').join(", ")+"]",St=yt.join(", ");return[...vt(),"define("+Dt+", function("+St+") {",' "use strict";',"",ct,"",$("return "+ft()+";"),"});"]},globals(){return[...vt(),"(function(root) {",' "use strict";',"",ct,"",$("root."+g.exportVar+" = "+ft()+";"),"})(this);"]},umd(){const yt=Object.keys(g.dependencies),At=yt.map(Ct=>g.dependencies[Ct]),Dt="["+At.map(Ct=>'"'+stringEscape(Ct)+'"').join(", ")+"]",St=At.map(Ct=>'require("'+stringEscape(Ct)+'")').join(", "),Bt=yt.join(", "),Ot=vt();return Ot.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+Dt+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+St+");"),g.exportVar!==null&&Ot.push(" } else {"," root."+g.exportVar+" = factory();"),Ot.push(" }","})(this, function("+Bt+") {",' "use strict";',"",ct,"",$("return "+ft()+";"),"});"),Ot}}[g.format]();return new SourceNode(null,null,g.grammarSource,pt.map(yt=>yt instanceof SourceNode?yt:yt+` +`))}d.code=ht(at())}var generateJs=generateJS$1;const asts$3=asts_1,visitor$7=visitor_1;function removeProxyRules$1(d,g,$){function b(et){return et.type==="rule"&&et.expression.type==="rule_ref"}function j(et,tt,nt){visitor$7.build({rule_ref(it){it.name===tt&&(it.name=nt,$.info(`Proxy rule "${tt}" replaced by the rule "${nt}"`,it.location,[{message:"This rule will be used",location:asts$3.findRule(et,nt).nameLocation}]))}})(et)}const _e=[];d.rules.forEach((et,tt)=>{b(et)&&(j(d,et.name,et.expression.name),g.allowedStartRules.indexOf(et.name)===-1&&_e.push(tt))}),_e.reverse(),_e.forEach(et=>{d.rules.splice(et,1)})}var removeProxyRules_1=removeProxyRules$1;const visitor$6=visitor_1;function reportDuplicateLabels$1(d,g,$){function b(et){const tt={};return Object.keys(et).forEach(nt=>{tt[nt]=et[nt]}),tt}function j(et,tt){_e(et.expression,b(tt))}const _e=visitor$6.build({rule(et){_e(et.expression,{})},choice(et,tt){et.alternatives.forEach(nt=>{_e(nt,b(tt))})},action:j,labeled(et,tt){const nt=et.label;nt&&Object.prototype.hasOwnProperty.call(tt,nt)&&$.error(`Label "${et.label}" is already defined`,et.labelLocation,[{message:"Original label location",location:tt[nt]}]),_e(et.expression,tt),tt[et.label]=et.labelLocation},text:j,simple_and:j,simple_not:j,optional:j,zero_or_more:j,one_or_more:j,repeated(et,tt){et.delimiter&&_e(et.delimiter,b(tt)),_e(et.expression,b(tt))},group:j});_e(d)}var reportDuplicateLabels_1=reportDuplicateLabels$1;const visitor$5=visitor_1;function reportDuplicateRules$1(d,g,$){const b={};visitor$5.build({rule(_e){if(Object.prototype.hasOwnProperty.call(b,_e.name)){$.error(`Rule "${_e.name}" is already defined`,_e.nameLocation,[{message:"Original rule location",location:b[_e.name]}]);return}b[_e.name]=_e.nameLocation}})(d)}var reportDuplicateRules_1=reportDuplicateRules$1;const asts$2=asts_1,visitor$4=visitor_1;function reportInfiniteRecursion$1(d,g,$){const b=[],j=[],_e=visitor$4.build({rule(et){b.push(et.name),_e(et.expression),b.pop()},sequence(et){et.elements.every(tt=>(_e(tt),!asts$2.alwaysConsumesOnSuccess(d,tt)))},repeated(et){_e(et.expression),et.delimiter&&!asts$2.alwaysConsumesOnSuccess(d,et.expression)&&_e(et.delimiter)},rule_ref(et){j.push(et);const tt=asts$2.findRule(d,et.name);if(b.indexOf(et.name)!==-1){b.push(et.name),$.error("Possible infinite loop when parsing (left recursion: "+b.join(" -> ")+")",tt.nameLocation,j.map((nt,rt,it)=>({message:rt+1!==it.length?`Step ${rt+1}: call of the rule "${nt.name}" without input consumption`:`Step ${rt+1}: call itself without input consumption - left recursion`,location:nt.location})));return}tt&&_e(tt),j.pop()}});_e(d)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1;const asts$1=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(d,g,$){const b=visitor$3.build({zero_or_more(j){asts$1.alwaysConsumesOnSuccess(d,j.expression)||$.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",j.location)},one_or_more(j){asts$1.alwaysConsumesOnSuccess(d,j.expression)||$.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",j.location)},repeated(j){if(j.delimiter&&b(j.delimiter),!(asts$1.alwaysConsumesOnSuccess(d,j.expression)||j.delimiter&&asts$1.alwaysConsumesOnSuccess(d,j.delimiter)))if(j.max.value===null)$.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",j.location);else{const _e=j.min?j.min:j.max;$.warning(_e.type==="constant"&&j.max.type==="constant"?`An expression may not consume any input and may always match ${j.max.value} times`:"An expression may not consume any input and may always match with a maximum repetition count",j.location)}}});b(d)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1;const asts=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(d,g,$){visitor$2.build({rule_ref(j){asts.findRule(d,j.name)||$.error(`Rule "${j.name}" is not defined`,j.location)}})(d)}var reportUndefinedRules_1=reportUndefinedRules$1;const visitor$1=visitor_1;function reportIncorrectPlucking$1(d,g,$){const b=visitor$1.build({action(j){b(j.expression,j)},labeled(j,_e){j.pick&&_e&&$.error('"@" cannot be used with an action block',j.labelLocation,[{message:"Action block location",location:_e.codeLocation}]),b(j.expression)}});b(d)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1;const GrammarError$1=grammarError;class Defaults{constructor(g){g=typeof g<"u"?g:{},typeof g.error=="function"&&(this.error=g.error),typeof g.warning=="function"&&(this.warning=g.warning),typeof g.info=="function"&&(this.info=g.info)}error(){}warning(){}info(){}}let Session$1=class{constructor(g){this._callbacks=new Defaults(g),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}error(...g){++this.errors,this._firstError===null&&(this._firstError=new GrammarError$1(...g),this._firstError.stage=this.stage,this._firstError.problems=this.problems),this.problems.push(["error",...g]),this._callbacks.error(this.stage,...g)}warning(...g){this.problems.push(["warning",...g]),this._callbacks.warning(this.stage,...g)}info(...g){this.problems.push(["info",...g]),this._callbacks.info(this.stage,...g)}checkErrors(){if(this.errors!==0)throw this._firstError}};var session=Session$1;const generateBytecode=generateBytecode_1,generateJS=generateJs,inferenceMatchResult=inferenceMatchResult_1,removeProxyRules=removeProxyRules_1,reportDuplicateLabels=reportDuplicateLabels_1,reportDuplicateRules=reportDuplicateRules_1,reportInfiniteRecursion=reportInfiniteRecursion_1,reportInfiniteRepetition=reportInfiniteRepetition_1,reportUndefinedRules=reportUndefinedRules_1,reportIncorrectPlucking=reportIncorrectPlucking_1,Session=session,visitor=visitor_1,{base64}=utils;function processOptions(d,g){const $={};return Object.keys(d).forEach(b=>{$[b]=d[b]}),Object.keys(g).forEach(b=>{Object.prototype.hasOwnProperty.call($,b)||($[b]=g[b])}),$}function isSourceMapCapable(d){return typeof d=="string"?d.length>0:d&&typeof d.offset=="function"}const compiler$1={visitor,passes:{check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRecursion,reportInfiniteRepetition,reportIncorrectPlucking],transform:[removeProxyRules,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile(ast,passes,options){if(options=options!==void 0?options:{},options=processOptions(options,{allowedStartRules:[ast.rules[0].name],cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");if(options.allowedStartRules.length===0)throw new Error("Must have at least one start rule");const allRules=ast.rules.map(d=>d.name);if(options.allowedStartRules.some(d=>d==="*"))options.allowedStartRules=allRules;else for(const d of options.allowedStartRules)if(allRules.indexOf(d)===-1)throw new Error(`Unknown start rule "${d}"`);if((options.output==="source-and-map"||options.output==="source-with-inline-map")&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");const session=new Session(options);switch(Object.keys(passes).forEach(d=>{session.stage=d,session.info(`Process stage ${d}`),passes[d].forEach(g=>{session.info(`Process pass ${d}.${g.name}`),g(ast,options,session)}),session.checkErrors()}),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":{if(typeof TextEncoder>"u")throw new Error("TextEncoder is not supported by this platform");const d=ast.code.toStringWithSourceMap(),g=new TextEncoder,$=base64(g.encode(JSON.stringify(d.map.toJSON())));return d.code+`//# sourceMappingURL=data:application/json;charset=utf-8;base64,${$} +`}case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}};var compiler_1=compiler$1;const OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(d,g){function $(){this.constructor=d}$.prototype=g.prototype,d.prototype=new $}function peg$SyntaxError(d,g,$,b){var j=Error.call(this,d);return Object.setPrototypeOf&&Object.setPrototypeOf(j,peg$SyntaxError.prototype),j.expected=g,j.found=$,j.location=b,j.name="SyntaxError",j}peg$subclass(peg$SyntaxError,Error);function peg$padEnd(d,g,$){return $=$||" ",d.length>g?d:(g-=d.length,$+=$.repeat(g),d+$.slice(0,g))}peg$SyntaxError.prototype.format=function(d){var g="Error: "+this.message;if(this.location){var $=null,b;for(b=0;b `+et+` +`+nt+` | +`+_e.line+" | "+rt+` +`+nt+" | "+peg$padEnd("",j.column-1," ")+peg$padEnd("",st,"^")}else g+=` + at `+et}return g};peg$SyntaxError.buildMessage=function(d,g){var $={literal:function(rt){return'"'+j(rt.text)+'"'},class:function(rt){var it=rt.parts.map(function(st){return Array.isArray(st)?_e(st[0])+"-"+_e(st[1]):_e(st)});return"["+(rt.inverted?"^":"")+it.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function(rt){return rt.description}};function b(rt){return rt.charCodeAt(0).toString(16).toUpperCase()}function j(rt){return rt.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(it){return"\\x0"+b(it)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(it){return"\\x"+b(it)})}function _e(rt){return rt.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(it){return"\\x0"+b(it)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(it){return"\\x"+b(it)})}function et(rt){return $[rt.type](rt)}function tt(rt){var it=rt.map(et),st,ut;if(it.sort(),it.length>0){for(st=1,ut=1;st0?{type:"choice",alternatives:[ot].concat(dt),location:nn()}:ot},Yo=function(ot,dt){return dt!==null?{type:"action",expression:ot,code:dt[0],codeLocation:dt[1],location:nn()}:ot},Xo=function(ot,dt){return dt.length>0||ot.type==="labeled"&&ot.pick?{type:"sequence",elements:[ot].concat(dt),location:nn()}:ot},Qo=function(ot,dt,Et){return Et.type.startsWith("semantic_")&&or('"@" cannot be used on a semantic predicate',ot),{type:"labeled",label:dt!==null?dt[0]:null,labelLocation:dt!==null?dt[1]:ot,pick:!0,expression:Et,location:nn()}},Ko=function(ot,dt){return{type:"labeled",label:ot[0],labelLocation:ot[1],expression:dt,location:nn()}},Zo=function(){return nn()},qo=function(ot){return ys.indexOf(ot[0])>=0&&or(`Label can't be a reserved word "${ot[0]}"`,ot[1]),ot},Jo=function(ot,dt){return{type:OPS_TO_PREFIXED_TYPES[ot],expression:dt,location:nn()}},eu=function(ot,dt){return{type:OPS_TO_SUFFIXED_TYPES[dt],expression:ot,location:nn()}},tu=function(ot,dt,Et){let mt=dt[0],wt=dt[1];return wt.type==="constant"&&wt.value===0&&or("The maximum count of repetitions of the rule must be > 0",wt.location),{type:"repeated",min:mt,max:wt,expression:ot,delimiter:Et,location:nn()}},nu=function(ot,dt){return[ot!==null?ot:{type:"constant",value:0},dt!==null?dt:{type:"constant",value:null}]},ru=function(ot){return[null,ot]},iu=function(ot){return{type:"constant",value:ot,location:nn()}},ou=function(ot){return{type:"variable",value:ot[0],location:nn()}},uu=function(ot){return{type:"function",value:ot[0],codeLocation:ot[1],location:nn()}},su=function(ot){return ot.type==="labeled"||ot.type==="sequence"?{type:"group",expression:ot,location:nn()}:ot},au=function(ot){return{type:"rule_ref",name:ot[0],location:nn()}},lu=function(ot,dt){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[ot],code:dt[0],codeLocation:dt[1],location:nn()}},cu=function(ot,dt){return[ot+dt.join(""),nn()]},fu=function(ot,dt){return{type:"literal",value:ot,ignoreCase:dt!==null,location:nn()}},du=function(ot){return ot.join("")},hu=function(ot){return ot.join("")},pu=function(ot,dt,Et){return{type:"class",parts:dt.filter(mt=>mt!==""),inverted:ot!==null,ignoreCase:Et!==null,location:nn()}},gu=function(ot,dt){return ot.charCodeAt(0)>dt.charCodeAt(0)&&or("Invalid character range: "+Du()+"."),[ot,dt]},mu=function(){return""},yu=function(){return"\0"},vu=function(){return"\b"},Eu=function(){return"\f"},Au=function(){return` +`},Cu=function(){return"\r"},xu=function(){return" "},wu=function(){return"\v"},_u=function(ot){return String.fromCharCode(parseInt(ot,16))},Su=function(ot){return String.fromCharCode(parseInt(ot,16))},$u=function(){return{type:"any",location:nn()}},bu=function(ot){return[ot,nn()]},Fu=function(ot){return parseInt(ot,10)},lt=0,Kt=0,rr=[{line:1,column:1}],Rn=0,pr=[],xt=0,ir;if("startRule"in g){if(!(g.startRule in j))throw new Error(`Can't start parsing from rule "`+g.startRule+'".');_e=j[g.startRule]}function Du(){return d.substring(Kt,lt)}function nn(){return ur(Kt,lt)}function or(ot,dt){throw dt=dt!==void 0?dt:ur(Kt,lt),Bu(ot,dt)}function zt(ot,dt){return{type:"literal",text:ot,ignoreCase:dt}}function mn(ot,dt,Et){return{type:"class",parts:ot,inverted:dt,ignoreCase:Et}}function Pu(){return{type:"any"}}function Tu(){return{type:"end"}}function In(ot){return{type:"other",description:ot}}function kr(ot){var dt=rr[ot],Et;if(dt)return dt;for(Et=ot-1;!rr[Et];)Et--;for(dt=rr[Et],dt={line:dt.line,column:dt.column};EtRn&&(Rn=lt,pr=[]),pr.push(ot))}function Bu(ot,dt){return new peg$SyntaxError(ot,null,null,dt)}function ku(ot,dt,Et){return new peg$SyntaxError(peg$SyntaxError.buildMessage(ot,dt),ot,dt,Et)}function Rr(){var ot,dt,Et,mt,wt,Ft;if(ot=lt,en(),dt=lt,Et=Ru(),Et!==$?(mt=en(),dt=Et):(lt=dt,dt=$),dt===$&&(dt=null),Et=lt,mt=Nu(),mt!==$?(wt=en(),Et=mt):(lt=Et,Et=$),Et===$&&(Et=null),mt=[],wt=lt,Ft=Nr(),Ft!==$?(en(),wt=Ft):(lt=wt,wt=$),wt!==$)for(;wt!==$;)mt.push(wt),wt=lt,Ft=Nr(),Ft!==$?(en(),wt=Ft):(lt=wt,wt=$);else mt=$;return mt!==$?(Kt=ot,ot=Uo(dt,Et,mt)):(lt=ot,ot=$),ot}function Ru(){var ot,dt,Et,mt,wt;return ot=lt,d.charCodeAt(lt)===123?(dt=et,lt++):(dt=$,xt===0&&Pt(an)),dt!==$?(Et=Zn(),Et!==$?(d.charCodeAt(lt)===125?(mt=tt,lt++):(mt=$,xt===0&&Pt(gn)),mt!==$?(wt=Sr(),wt!==$?(Kt=ot,ot=Ho(Et)):(lt=ot,ot=$)):(lt=ot,ot=$)):(lt=ot,ot=$)):(lt=ot,ot=$),ot}function Nu(){var ot,dt,Et;return ot=lt,dt=Zn(),dt!==$?(Et=Sr(),Et!==$?(Kt=ot,ot=zo(dt)):(lt=ot,ot=$)):(lt=ot,ot=$),ot}function Nr(){var ot,dt,Et,mt,wt,Ft;return ot=lt,dt=lr(),dt!==$?(en(),Et=lt,mt=Cr(),mt!==$?(en(),Et=mt):(lt=Et,Et=$),Et===$&&(Et=null),d.charCodeAt(lt)===61?(mt=nt,lt++):(mt=$,xt===0&&Pt(_n)),mt!==$?(en(),wt=gr(),wt!==$?(Ft=Sr(),Ft!==$?(Kt=ot,ot=Go(dt,Et,wt)):(lt=ot,ot=$)):(lt=ot,ot=$)):(lt=ot,ot=$)):(lt=ot,ot=$),ot}function gr(){var ot,dt,Et,mt,wt,Ft;if(ot=lt,dt=mr(),dt!==$){for(Et=[],mt=lt,en(),d.charCodeAt(lt)===47?(wt=rt,lt++):(wt=$,xt===0&&Pt(bn)),wt!==$?(en(),Ft=mr(),Ft!==$?mt=Ft:(lt=mt,mt=$)):(lt=mt,mt=$);mt!==$;)Et.push(mt),mt=lt,en(),d.charCodeAt(lt)===47?(wt=rt,lt++):(wt=$,xt===0&&Pt(bn)),wt!==$?(en(),Ft=mr(),Ft!==$?mt=Ft:(lt=mt,mt=$)):(lt=mt,mt=$);Kt=ot,ot=Wo(dt,Et)}else lt=ot,ot=$;return ot}function mr(){var ot,dt,Et,mt;return ot=lt,dt=Ou(),dt!==$?(Et=lt,en(),mt=Zn(),mt!==$?Et=mt:(lt=Et,Et=$),Et===$&&(Et=null),Kt=ot,ot=Yo(dt,Et)):(lt=ot,ot=$),ot}function Ou(){var ot,dt,Et,mt,wt;if(ot=lt,dt=yr(),dt!==$){for(Et=[],mt=lt,en(),wt=yr(),wt!==$?mt=wt:(lt=mt,mt=$);mt!==$;)Et.push(mt),mt=lt,en(),wt=yr(),wt!==$?mt=wt:(lt=mt,mt=$);Kt=ot,ot=Xo(dt,Et)}else lt=ot,ot=$;return ot}function yr(){var ot,dt,Et,mt;return ot=lt,dt=Mu(),dt!==$?(Et=Or(),Et===$&&(Et=null),mt=vr(),mt!==$?(Kt=ot,ot=Qo(dt,Et,mt)):(lt=ot,ot=$)):(lt=ot,ot=$),ot===$&&(ot=lt,dt=Or(),dt!==$?(Et=en(),mt=vr(),mt!==$?(Kt=ot,ot=Ko(dt,mt)):(lt=ot,ot=$)):(lt=ot,ot=$),ot===$&&(ot=vr())),ot}function Mu(){var ot,dt;return ot=lt,d.charCodeAt(lt)===64?(dt=it,lt++):(dt=$,xt===0&&Pt(rn)),dt!==$&&(Kt=ot,dt=Zo()),ot=dt,ot}function Or(){var ot,dt,Et;return ot=lt,dt=lr(),dt!==$?(en(),d.charCodeAt(lt)===58?(Et=st,lt++):(Et=$,xt===0&&Pt(Xn)),Et!==$?(Kt=ot,ot=qo(dt)):(lt=ot,ot=$)):(lt=ot,ot=$),ot}function vr(){var ot,dt,Et;return ot=lt,dt=Lu(),dt!==$?(en(),Et=Mr(),Et!==$?(Kt=ot,ot=Jo(dt,Et)):(lt=ot,ot=$)):(lt=ot,ot=$),ot===$&&(ot=Mr()),ot}function Lu(){var ot;return d.charCodeAt(lt)===36?(ot=ut,lt++):(ot=$,xt===0&&Pt(fn)),ot===$&&(d.charCodeAt(lt)===38?(ot=at,lt++):(ot=$,xt===0&&Pt(An)),ot===$&&(d.charCodeAt(lt)===33?(ot=ht,lt++):(ot=$,xt===0&&Pt(kn)))),ot}function Mr(){var ot,dt,Et;return ot=lt,dt=Ar(),dt!==$?(en(),Et=Iu(),Et!==$?(Kt=ot,ot=eu(dt,Et)):(lt=ot,ot=$)):(lt=ot,ot=$),ot===$&&(ot=ju(),ot===$&&(ot=Ar())),ot}function Iu(){var ot;return d.charCodeAt(lt)===63?(ot=ct,lt++):(ot=$,xt===0&&Pt(zn)),ot===$&&(d.charCodeAt(lt)===42?(ot=vt,lt++):(ot=$,xt===0&&Pt(Qn)),ot===$&&(d.charCodeAt(lt)===43?(ot=ft,lt++):(ot=$,xt===0&&Pt(dr)))),ot}function ju(){var ot,dt,Et,mt,wt,Ft,hn;return ot=lt,dt=Ar(),dt!==$?(en(),d.charCodeAt(lt)===124?(Et=gt,lt++):(Et=$,xt===0&&Pt(qn)),Et!==$?(en(),mt=Vu(),mt!==$?(en(),wt=lt,d.charCodeAt(lt)===44?(Ft=pt,lt++):(Ft=$,xt===0&&Pt(Fn)),Ft!==$?(en(),hn=gr(),hn!==$?(en(),wt=hn):(lt=wt,wt=$)):(lt=wt,wt=$),wt===$&&(wt=null),d.charCodeAt(lt)===124?(Ft=gt,lt++):(Ft=$,xt===0&&Pt(qn)),Ft!==$?(Kt=ot,ot=tu(dt,mt,wt)):(lt=ot,ot=$)):(lt=ot,ot=$)):(lt=ot,ot=$)):(lt=ot,ot=$),ot}function Vu(){var ot,dt,Et,mt;return ot=lt,dt=Er(),dt===$&&(dt=null),en(),d.substr(lt,2)===yt?(Et=yt,lt+=2):(Et=$,xt===0&&Pt(Kn)),Et!==$?(en(),mt=Er(),mt===$&&(mt=null),Kt=ot,ot=nu(dt,mt)):(lt=ot,ot=$),ot===$&&(ot=lt,dt=Er(),dt!==$&&(Kt=ot,dt=ru(dt)),ot=dt),ot}function Er(){var ot,dt;return ot=lt,dt=ns(),dt!==$&&(Kt=ot,dt=iu(dt)),ot=dt,ot===$&&(ot=lt,dt=lr(),dt!==$&&(Kt=ot,dt=ou(dt)),ot=dt,ot===$&&(ot=lt,dt=Zn(),dt!==$&&(Kt=ot,dt=uu(dt)),ot=dt)),ot}function Ar(){var ot,dt,Et,mt;return ot=Xu(),ot===$&&(ot=Qu(),ot===$&&(ot=es(),ot===$&&(ot=Uu(),ot===$&&(ot=Hu(),ot===$&&(ot=lt,d.charCodeAt(lt)===40?(dt=At,lt++):(dt=$,xt===0&&Pt(Jn)),dt!==$?(en(),Et=gr(),Et!==$?(en(),d.charCodeAt(lt)===41?(mt=Dt,lt++):(mt=$,xt===0&&Pt(hr)),mt!==$?(Kt=ot,ot=su(Et)):(lt=ot,ot=$)):(lt=ot,ot=$)):(lt=ot,ot=$)))))),ot}function Uu(){var ot,dt,Et,mt,wt,Ft,hn,Yn;return ot=lt,dt=lr(),dt!==$?(Et=lt,xt++,mt=lt,wt=en(),Ft=lt,hn=Cr(),hn!==$?(Yn=en(),hn=[hn,Yn],Ft=hn):(lt=Ft,Ft=$),Ft===$&&(Ft=null),d.charCodeAt(lt)===61?(hn=nt,lt++):(hn=$,xt===0&&Pt(_n)),hn!==$?(wt=[wt,Ft,hn],mt=wt):(lt=mt,mt=$),xt--,mt===$?Et=void 0:(lt=Et,Et=$),Et!==$?(Kt=ot,ot=au(dt)):(lt=ot,ot=$)):(lt=ot,ot=$),ot}function Hu(){var ot,dt,Et;return ot=lt,dt=zu(),dt!==$?(en(),Et=Zn(),Et!==$?(Kt=ot,ot=lu(dt,Et)):(lt=ot,ot=$)):(lt=ot,ot=$),ot}function zu(){var ot;return d.charCodeAt(lt)===38?(ot=at,lt++):(ot=$,xt===0&&Pt(An)),ot===$&&(d.charCodeAt(lt)===33?(ot=ht,lt++):(ot=$,xt===0&&Pt(kn))),ot}function vn(){var ot;return d.length>lt?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt($r)),ot}function sr(){var ot;return xt++,d.charCodeAt(lt)===9?(ot=St,lt++):(ot=$,xt===0&&Pt(Qr)),ot===$&&(d.charCodeAt(lt)===11?(ot=Bt,lt++):(ot=$,xt===0&&Pt(Kr)),ot===$&&(d.charCodeAt(lt)===12?(ot=Ot,lt++):(ot=$,xt===0&&Pt(Zr)),ot===$&&(d.charCodeAt(lt)===32?(ot=Ct,lt++):(ot=$,xt===0&&Pt(qr)),ot===$&&(d.charCodeAt(lt)===160?(ot=_t,lt++):(ot=$,xt===0&&Pt(Jr)),ot===$&&(d.charCodeAt(lt)===65279?(ot=Tt,lt++):(ot=$,xt===0&&Pt(_i)),ot===$&&(ot=ps())))))),xt--,ot===$&&xt===0&&Pt(Xr),ot}function jn(){var ot;return $n.test(d.charAt(lt))?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt(eo)),ot}function ar(){var ot;return xt++,d.charCodeAt(lt)===10?(ot=kt,lt++):(ot=$,xt===0&&Pt(no)),ot===$&&(d.substr(lt,2)===Mt?(ot=Mt,lt+=2):(ot=$,xt===0&&Pt(ro)),ot===$&&(d.charCodeAt(lt)===13?(ot=Vt,lt++):(ot=$,xt===0&&Pt(io)),ot===$&&(d.charCodeAt(lt)===8232?(ot=Jt,lt++):(ot=$,xt===0&&Pt(oo)),ot===$&&(d.charCodeAt(lt)===8233?(ot=Xt,lt++):(ot=$,xt===0&&Pt(uo)))))),xt--,ot===$&&xt===0&&Pt(to),ot}function Lr(){var ot;return xt++,ot=Gu(),ot===$&&(ot=jr()),xt--,ot===$&&xt===0&&Pt(so),ot}function Gu(){var ot,dt,Et,mt,wt,Ft;if(ot=lt,d.substr(lt,2)===Nt?(dt=Nt,lt+=2):(dt=$,xt===0&&Pt(br)),dt!==$){for(Et=[],mt=lt,wt=lt,xt++,d.substr(lt,2)===Lt?(Ft=Lt,lt+=2):(Ft=$,xt===0&&Pt(Gn)),xt--,Ft===$?wt=void 0:(lt=wt,wt=$),wt!==$?(Ft=vn(),Ft!==$?(wt=[wt,Ft],mt=wt):(lt=mt,mt=$)):(lt=mt,mt=$);mt!==$;)Et.push(mt),mt=lt,wt=lt,xt++,d.substr(lt,2)===Lt?(Ft=Lt,lt+=2):(Ft=$,xt===0&&Pt(Gn)),xt--,Ft===$?wt=void 0:(lt=wt,wt=$),wt!==$?(Ft=vn(),Ft!==$?(wt=[wt,Ft],mt=wt):(lt=mt,mt=$)):(lt=mt,mt=$);d.substr(lt,2)===Lt?(mt=Lt,lt+=2):(mt=$,xt===0&&Pt(Gn)),mt!==$?(dt=[dt,Et,mt],ot=dt):(lt=ot,ot=$)}else lt=ot,ot=$;return ot}function Ir(){var ot,dt,Et,mt,wt,Ft;if(ot=lt,d.substr(lt,2)===Nt?(dt=Nt,lt+=2):(dt=$,xt===0&&Pt(br)),dt!==$){for(Et=[],mt=lt,wt=lt,xt++,d.substr(lt,2)===Lt?(Ft=Lt,lt+=2):(Ft=$,xt===0&&Pt(Gn)),Ft===$&&(Ft=jn()),xt--,Ft===$?wt=void 0:(lt=wt,wt=$),wt!==$?(Ft=vn(),Ft!==$?(wt=[wt,Ft],mt=wt):(lt=mt,mt=$)):(lt=mt,mt=$);mt!==$;)Et.push(mt),mt=lt,wt=lt,xt++,d.substr(lt,2)===Lt?(Ft=Lt,lt+=2):(Ft=$,xt===0&&Pt(Gn)),Ft===$&&(Ft=jn()),xt--,Ft===$?wt=void 0:(lt=wt,wt=$),wt!==$?(Ft=vn(),Ft!==$?(wt=[wt,Ft],mt=wt):(lt=mt,mt=$)):(lt=mt,mt=$);d.substr(lt,2)===Lt?(mt=Lt,lt+=2):(mt=$,xt===0&&Pt(Gn)),mt!==$?(dt=[dt,Et,mt],ot=dt):(lt=ot,ot=$)}else lt=ot,ot=$;return ot}function jr(){var ot,dt,Et,mt,wt,Ft;if(ot=lt,d.substr(lt,2)===jt?(dt=jt,lt+=2):(dt=$,xt===0&&Pt(ao)),dt!==$){for(Et=[],mt=lt,wt=lt,xt++,Ft=jn(),xt--,Ft===$?wt=void 0:(lt=wt,wt=$),wt!==$?(Ft=vn(),Ft!==$?(wt=[wt,Ft],mt=wt):(lt=mt,mt=$)):(lt=mt,mt=$);mt!==$;)Et.push(mt),mt=lt,wt=lt,xt++,Ft=jn(),xt--,Ft===$?wt=void 0:(lt=wt,wt=$),wt!==$?(Ft=vn(),Ft!==$?(wt=[wt,Ft],mt=wt):(lt=mt,mt=$)):(lt=mt,mt=$);dt=[dt,Et],ot=dt}else lt=ot,ot=$;return ot}function lr(){var ot,dt,Et,mt;if(xt++,ot=lt,dt=Vr(),dt!==$){for(Et=[],mt=Ur();mt!==$;)Et.push(mt),mt=Ur();Kt=ot,ot=cu(dt,Et)}else lt=ot,ot=$;return xt--,ot===$&&(dt=$,xt===0&&Pt(lo)),ot}function Vr(){var ot,dt,Et;return ot=Wu(),ot===$&&(d.charCodeAt(lt)===95?(ot=Yt,lt++):(ot=$,xt===0&&Pt(co)),ot===$&&(ot=lt,d.charCodeAt(lt)===92?(dt=Qt,lt++):(dt=$,xt===0&&Pt(Mn)),dt!==$?(Et=Yr(),Et!==$?ot=Et:(lt=ot,ot=$)):(lt=ot,ot=$))),ot}function Ur(){var ot;return ot=Vr(),ot===$&&(d.charCodeAt(lt)===36?(ot=ut,lt++):(ot=$,xt===0&&Pt(fn)),ot===$&&(ot=Yu(),ot===$&&(ot=fs(),ot===$&&(ot=hs(),ot===$&&(d.charCodeAt(lt)===8204?(ot=on,lt++):(ot=$,xt===0&&Pt(fo)),ot===$&&(d.charCodeAt(lt)===8205?(ot=un,lt++):(ot=$,xt===0&&Pt(ho)))))))),ot}function Wu(){var ot;return ot=as(),ot===$&&(ot=rs(),ot===$&&(ot=ss(),ot===$&&(ot=os(),ot===$&&(ot=us(),ot===$&&(ot=ds()))))),ot}function Yu(){var ot;return ot=cs(),ot===$&&(ot=ls()),ot}function Xu(){var ot,dt,Et;return xt++,ot=lt,dt=Cr(),dt!==$?(d.charCodeAt(lt)===105?(Et=pn,lt++):(Et=$,xt===0&&Pt(Fr)),Et===$&&(Et=null),Kt=ot,ot=fu(dt,Et)):(lt=ot,ot=$),xt--,ot===$&&(dt=$,xt===0&&Pt(po)),ot}function Cr(){var ot,dt,Et,mt;if(xt++,ot=lt,d.charCodeAt(lt)===34?(dt=ln,lt++):(dt=$,xt===0&&Pt(er)),dt!==$){for(Et=[],mt=Hr();mt!==$;)Et.push(mt),mt=Hr();d.charCodeAt(lt)===34?(mt=ln,lt++):(mt=$,xt===0&&Pt(er)),mt!==$?(Kt=ot,ot=du(Et)):(lt=ot,ot=$)}else lt=ot,ot=$;if(ot===$)if(ot=lt,d.charCodeAt(lt)===39?(dt=yn,lt++):(dt=$,xt===0&&Pt(tr)),dt!==$){for(Et=[],mt=zr();mt!==$;)Et.push(mt),mt=zr();d.charCodeAt(lt)===39?(mt=yn,lt++):(mt=$,xt===0&&Pt(tr)),mt!==$?(Kt=ot,ot=hu(Et)):(lt=ot,ot=$)}else lt=ot,ot=$;return xt--,ot===$&&(dt=$,xt===0&&Pt(go)),ot}function Hr(){var ot,dt,Et,mt;return ot=lt,dt=lt,Et=lt,xt++,d.charCodeAt(lt)===34?(mt=ln,lt++):(mt=$,xt===0&&Pt(er)),mt===$&&(d.charCodeAt(lt)===92?(mt=Qt,lt++):(mt=$,xt===0&&Pt(Mn)),mt===$&&(mt=jn())),xt--,mt===$?Et=void 0:(lt=Et,Et=$),Et!==$?(mt=vn(),mt!==$?(Et=[Et,mt],dt=Et):(lt=dt,dt=$)):(lt=dt,dt=$),dt!==$?ot=d.substring(ot,lt):ot=dt,ot===$&&(ot=lt,d.charCodeAt(lt)===92?(dt=Qt,lt++):(dt=$,xt===0&&Pt(Mn)),dt!==$?(Et=wr(),Et!==$?ot=Et:(lt=ot,ot=$)):(lt=ot,ot=$),ot===$&&(ot=xr())),ot}function zr(){var ot,dt,Et,mt;return ot=lt,dt=lt,Et=lt,xt++,d.charCodeAt(lt)===39?(mt=yn,lt++):(mt=$,xt===0&&Pt(tr)),mt===$&&(d.charCodeAt(lt)===92?(mt=Qt,lt++):(mt=$,xt===0&&Pt(Mn)),mt===$&&(mt=jn())),xt--,mt===$?Et=void 0:(lt=Et,Et=$),Et!==$?(mt=vn(),mt!==$?(Et=[Et,mt],dt=Et):(lt=dt,dt=$)):(lt=dt,dt=$),dt!==$?ot=d.substring(ot,lt):ot=dt,ot===$&&(ot=lt,d.charCodeAt(lt)===92?(dt=Qt,lt++):(dt=$,xt===0&&Pt(Mn)),dt!==$?(Et=wr(),Et!==$?ot=Et:(lt=ot,ot=$)):(lt=ot,ot=$),ot===$&&(ot=xr())),ot}function Qu(){var ot,dt,Et,mt,wt,Ft;if(xt++,ot=lt,d.charCodeAt(lt)===91?(dt=Dn,lt++):(dt=$,xt===0&&Pt(yo)),dt!==$){for(d.charCodeAt(lt)===94?(Et=Vn,lt++):(Et=$,xt===0&&Pt(vo)),Et===$&&(Et=null),mt=[],wt=Gr(),wt===$&&(wt=cr());wt!==$;)mt.push(wt),wt=Gr(),wt===$&&(wt=cr());d.charCodeAt(lt)===93?(wt=Sn,lt++):(wt=$,xt===0&&Pt(Dr)),wt!==$?(d.charCodeAt(lt)===105?(Ft=pn,lt++):(Ft=$,xt===0&&Pt(Fr)),Ft===$&&(Ft=null),Kt=ot,ot=pu(Et,mt,Ft)):(lt=ot,ot=$)}else lt=ot,ot=$;return xt--,ot===$&&(dt=$,xt===0&&Pt(mo)),ot}function Gr(){var ot,dt,Et,mt;return ot=lt,dt=cr(),dt!==$?(d.charCodeAt(lt)===45?(Et=Nn,lt++):(Et=$,xt===0&&Pt(Eo)),Et!==$?(mt=cr(),mt!==$?(Kt=ot,ot=gu(dt,mt)):(lt=ot,ot=$)):(lt=ot,ot=$)):(lt=ot,ot=$),ot}function cr(){var ot,dt,Et,mt;return ot=lt,dt=lt,Et=lt,xt++,d.charCodeAt(lt)===93?(mt=Sn,lt++):(mt=$,xt===0&&Pt(Dr)),mt===$&&(d.charCodeAt(lt)===92?(mt=Qt,lt++):(mt=$,xt===0&&Pt(Mn)),mt===$&&(mt=jn())),xt--,mt===$?Et=void 0:(lt=Et,Et=$),Et!==$?(mt=vn(),mt!==$?(Et=[Et,mt],dt=Et):(lt=dt,dt=$)):(lt=dt,dt=$),dt!==$?ot=d.substring(ot,lt):ot=dt,ot===$&&(ot=lt,d.charCodeAt(lt)===92?(dt=Qt,lt++):(dt=$,xt===0&&Pt(Mn)),dt!==$?(Et=wr(),Et!==$?ot=Et:(lt=ot,ot=$)):(lt=ot,ot=$),ot===$&&(ot=xr())),ot}function xr(){var ot,dt,Et;return ot=lt,d.charCodeAt(lt)===92?(dt=Qt,lt++):(dt=$,xt===0&&Pt(Mn)),dt!==$?(Et=ar(),Et!==$?(Kt=ot,ot=mu()):(lt=ot,ot=$)):(lt=ot,ot=$),ot}function wr(){var ot,dt,Et,mt;return ot=Ku(),ot===$&&(ot=lt,d.charCodeAt(lt)===48?(dt=On,lt++):(dt=$,xt===0&&Pt(Ao)),dt!==$?(Et=lt,xt++,mt=fr(),xt--,mt===$?Et=void 0:(lt=Et,Et=$),Et!==$?(Kt=ot,ot=yu()):(lt=ot,ot=$)):(lt=ot,ot=$),ot===$&&(ot=Ju(),ot===$&&(ot=Yr()))),ot}function Ku(){var ot;return ot=Wr(),ot===$&&(ot=Zu()),ot}function Wr(){var ot,dt;return d.charCodeAt(lt)===39?(ot=yn,lt++):(ot=$,xt===0&&Pt(tr)),ot===$&&(d.charCodeAt(lt)===34?(ot=ln,lt++):(ot=$,xt===0&&Pt(er)),ot===$&&(d.charCodeAt(lt)===92?(ot=Qt,lt++):(ot=$,xt===0&&Pt(Mn)),ot===$&&(ot=lt,d.charCodeAt(lt)===98?(dt=Pn,lt++):(dt=$,xt===0&&Pt(Co)),dt!==$&&(Kt=ot,dt=vu()),ot=dt,ot===$&&(ot=lt,d.charCodeAt(lt)===102?(dt=Cn,lt++):(dt=$,xt===0&&Pt(xo)),dt!==$&&(Kt=ot,dt=Eu()),ot=dt,ot===$&&(ot=lt,d.charCodeAt(lt)===110?(dt=Ln,lt++):(dt=$,xt===0&&Pt(wo)),dt!==$&&(Kt=ot,dt=Au()),ot=dt,ot===$&&(ot=lt,d.charCodeAt(lt)===114?(dt=Un,lt++):(dt=$,xt===0&&Pt(_o)),dt!==$&&(Kt=ot,dt=Cu()),ot=dt,ot===$&&(ot=lt,d.charCodeAt(lt)===116?(dt=Hn,lt++):(dt=$,xt===0&&Pt(So)),dt!==$&&(Kt=ot,dt=xu()),ot=dt,ot===$&&(ot=lt,d.charCodeAt(lt)===118?(dt=Tn,lt++):(dt=$,xt===0&&Pt($o)),dt!==$&&(Kt=ot,dt=wu()),ot=dt)))))))),ot}function Zu(){var ot,dt,Et,mt;return ot=lt,dt=lt,Et=lt,xt++,mt=qu(),mt===$&&(mt=jn()),xt--,mt===$?Et=void 0:(lt=Et,Et=$),Et!==$?(mt=vn(),mt!==$?(Et=[Et,mt],dt=Et):(lt=dt,dt=$)):(lt=dt,dt=$),dt!==$?ot=d.substring(ot,lt):ot=dt,ot}function qu(){var ot;return ot=Wr(),ot===$&&(ot=fr(),ot===$&&(d.charCodeAt(lt)===120?(ot=Bn,lt++):(ot=$,xt===0&&Pt(Pr)),ot===$&&(d.charCodeAt(lt)===117?(ot=xn,lt++):(ot=$,xt===0&&Pt(Tr))))),ot}function Ju(){var ot,dt,Et,mt,wt,Ft;return ot=lt,d.charCodeAt(lt)===120?(dt=Bn,lt++):(dt=$,xt===0&&Pt(Pr)),dt!==$?(Et=lt,mt=lt,wt=Wn(),wt!==$?(Ft=Wn(),Ft!==$?(wt=[wt,Ft],mt=wt):(lt=mt,mt=$)):(lt=mt,mt=$),mt!==$?Et=d.substring(Et,lt):Et=mt,Et!==$?(Kt=ot,ot=_u(Et)):(lt=ot,ot=$)):(lt=ot,ot=$),ot}function Yr(){var ot,dt,Et,mt,wt,Ft,hn,Yn;return ot=lt,d.charCodeAt(lt)===117?(dt=xn,lt++):(dt=$,xt===0&&Pt(Tr)),dt!==$?(Et=lt,mt=lt,wt=Wn(),wt!==$?(Ft=Wn(),Ft!==$?(hn=Wn(),hn!==$?(Yn=Wn(),Yn!==$?(wt=[wt,Ft,hn,Yn],mt=wt):(lt=mt,mt=$)):(lt=mt,mt=$)):(lt=mt,mt=$)):(lt=mt,mt=$),mt!==$?Et=d.substring(Et,lt):Et=mt,Et!==$?(Kt=ot,ot=Su(Et)):(lt=ot,ot=$)):(lt=ot,ot=$),ot}function fr(){var ot;return cn.test(d.charAt(lt))?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt(bo)),ot}function Wn(){var ot;return $t.test(d.charAt(lt))?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt(Fo)),ot}function es(){var ot,dt;return ot=lt,d.charCodeAt(lt)===46?(dt=En,lt++):(dt=$,xt===0&&Pt(Do)),dt!==$&&(Kt=ot,dt=$u()),ot=dt,ot}function Zn(){var ot,dt,Et,mt;return xt++,ot=lt,d.charCodeAt(lt)===123?(dt=et,lt++):(dt=$,xt===0&&Pt(an)),dt!==$?(Et=ts(),d.charCodeAt(lt)===125?(mt=tt,lt++):(mt=$,xt===0&&Pt(gn)),mt!==$?ot=Et:(lt=ot,ot=$)):(lt=ot,ot=$),xt--,ot===$&&(dt=$,xt===0&&Pt(Po)),ot}function ts(){var ot,dt;return ot=lt,dt=_r(),Kt=ot,dt=bu(dt),ot=dt,ot}function _r(){var ot,dt,Et,mt,wt,Ft;if(ot=lt,dt=[],Et=[],mt=lt,wt=lt,xt++,bt.test(d.charAt(lt))?(Ft=d.charAt(lt),lt++):(Ft=$,xt===0&&Pt(nr)),xt--,Ft===$?wt=void 0:(lt=wt,wt=$),wt!==$?(Ft=vn(),Ft!==$?(wt=[wt,Ft],mt=wt):(lt=mt,mt=$)):(lt=mt,mt=$),mt!==$)for(;mt!==$;)Et.push(mt),mt=lt,wt=lt,xt++,bt.test(d.charAt(lt))?(Ft=d.charAt(lt),lt++):(Ft=$,xt===0&&Pt(nr)),xt--,Ft===$?wt=void 0:(lt=wt,wt=$),wt!==$?(Ft=vn(),Ft!==$?(wt=[wt,Ft],mt=wt):(lt=mt,mt=$)):(lt=mt,mt=$);else Et=$;for(Et===$&&(Et=lt,d.charCodeAt(lt)===123?(mt=et,lt++):(mt=$,xt===0&&Pt(an)),mt!==$?(wt=_r(),d.charCodeAt(lt)===125?(Ft=tt,lt++):(Ft=$,xt===0&&Pt(gn)),Ft!==$?(mt=[mt,wt,Ft],Et=mt):(lt=Et,Et=$)):(lt=Et,Et=$));Et!==$;){if(dt.push(Et),Et=[],mt=lt,wt=lt,xt++,bt.test(d.charAt(lt))?(Ft=d.charAt(lt),lt++):(Ft=$,xt===0&&Pt(nr)),xt--,Ft===$?wt=void 0:(lt=wt,wt=$),wt!==$?(Ft=vn(),Ft!==$?(wt=[wt,Ft],mt=wt):(lt=mt,mt=$)):(lt=mt,mt=$),mt!==$)for(;mt!==$;)Et.push(mt),mt=lt,wt=lt,xt++,bt.test(d.charAt(lt))?(Ft=d.charAt(lt),lt++):(Ft=$,xt===0&&Pt(nr)),xt--,Ft===$?wt=void 0:(lt=wt,wt=$),wt!==$?(Ft=vn(),Ft!==$?(wt=[wt,Ft],mt=wt):(lt=mt,mt=$)):(lt=mt,mt=$);else Et=$;Et===$&&(Et=lt,d.charCodeAt(lt)===123?(mt=et,lt++):(mt=$,xt===0&&Pt(an)),mt!==$?(wt=_r(),d.charCodeAt(lt)===125?(Ft=tt,lt++):(Ft=$,xt===0&&Pt(gn)),Ft!==$?(mt=[mt,wt,Ft],Et=mt):(lt=Et,Et=$)):(lt=Et,Et=$))}return ot=d.substring(ot,lt),ot}function ns(){var ot,dt,Et,mt;if(ot=lt,dt=lt,Et=[],mt=fr(),mt!==$)for(;mt!==$;)Et.push(mt),mt=fr();else Et=$;return Et!==$?dt=d.substring(dt,lt):dt=Et,dt!==$&&(Kt=ot,dt=Fu(dt)),ot=dt,ot}function rs(){var ot;return Rt.test(d.charAt(lt))?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt(To)),ot}function os(){var ot;return Ut.test(d.charAt(lt))?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt(Bo)),ot}function us(){var ot;return It.test(d.charAt(lt))?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt(ko)),ot}function ss(){var ot;return Wt.test(d.charAt(lt))?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt(Ro)),ot}function as(){var ot;return Gt.test(d.charAt(lt))?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt(No)),ot}function ls(){var ot;return Zt.test(d.charAt(lt))?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt(Oo)),ot}function cs(){var ot;return Ht.test(d.charAt(lt))?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt(Mo)),ot}function fs(){var ot;return sn.test(d.charAt(lt))?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt(Lo)),ot}function ds(){var ot;return qt.test(d.charAt(lt))?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt(Io)),ot}function hs(){var ot;return tn.test(d.charAt(lt))?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt(jo)),ot}function ps(){var ot;return dn.test(d.charAt(lt))?(ot=d.charAt(lt),lt++):(ot=$,xt===0&&Pt(Vo)),ot}function en(){var ot,dt;for(ot=[],dt=sr(),dt===$&&(dt=ar(),dt===$&&(dt=Lr()));dt!==$;)ot.push(dt),dt=sr(),dt===$&&(dt=ar(),dt===$&&(dt=Lr()));return ot}function gs(){var ot,dt;for(ot=[],dt=sr(),dt===$&&(dt=Ir());dt!==$;)ot.push(dt),dt=sr(),dt===$&&(dt=Ir());return ot}function Sr(){var ot,dt,Et,mt;if(ot=[],dt=lt,Et=en(),d.charCodeAt(lt)===59?(mt=wn,lt++):(mt=$,xt===0&&Pt(Br)),mt!==$?(Et=[Et,mt],dt=Et):(lt=dt,dt=$),dt!==$)for(;dt!==$;)ot.push(dt),dt=lt,Et=en(),d.charCodeAt(lt)===59?(mt=wn,lt++):(mt=$,xt===0&&Pt(Br)),mt!==$?(Et=[Et,mt],dt=Et):(lt=dt,dt=$);else ot=$;return ot===$&&(ot=lt,dt=gs(),Et=jr(),Et===$&&(Et=null),mt=ar(),mt!==$?(dt=[dt,Et,mt],ot=dt):(lt=ot,ot=$),ot===$&&(ot=lt,dt=en(),Et=ms(),Et!==$?(dt=[dt,Et],ot=dt):(lt=ot,ot=$))),ot}function ms(){var ot,dt;return ot=lt,xt++,d.length>lt?(dt=d.charAt(lt),lt++):(dt=$,xt===0&&Pt($r)),xt--,dt===$?ot=void 0:(lt=ot,ot=$),ot}const ys=g.reservedWords||[];if(ir=_e(),ir!==$&<===d.length)return ir;throw ir!==$&<{et[tt]=_e[tt].slice()}),et}const b="plugins"in g?g.plugins:[],j={parser:peg.parser,passes:$(peg.compiler.passes),reservedWords:peg.RESERVED_WORDS.slice()};return b.forEach(_e=>{_e.use(j,g)}),peg.compiler.compile(j.parser.parse(d,{grammarSource:g.grammarSource,reservedWords:j.reservedWords}),j.passes,g)}};var peg_1=peg;const tocLangGrammarUrl="data:application/octet-stream;base64,ewogIGZ1bmN0aW9uIG1ha2VJbnRlZ2VyKG8pIHsKICAgIHJldHVybiBwYXJzZUludChvLmpvaW4oIiIpLCAxMCk7CiAgfQp9CgpzdGFydAogID0gc3RhdGVtZW50OnN0YXRlbWVudD8gbW9yZVN0YXRlbWVudHM6KEVPTCBfIEBzdGF0ZW1lbnQpKiBFT0w/IF8KewogIGNvbnN0IHN0YXRlbWVudHMgPSBzdGF0ZW1lbnQgPyBbc3RhdGVtZW50LCAuLi5tb3JlU3RhdGVtZW50c10gOiBtb3JlU3RhdGVtZW50czsKICByZXR1cm4gewogICAgc3RhdGVtZW50czogc3RhdGVtZW50cwogIH07Cn0KCnN0YXRlbWVudCA9IGNvbW1lbnRMaW5lIC8gbm9kZVN0YXRlbWVudCAvIGVkZ2VTdGF0ZW1lbnQKCmNvbW1lbnRMaW5lID0gXyAiIyIgdGV4dDooW15cblxyXSopCnsKICByZXR1cm4gewogICAgdHlwZTogImNvbW1lbnQiLAogICAgdGV4dDogdGV4dC5qb2luKCIiKQogIH07Cn0KCm5vZGVTdGF0ZW1lbnQgPSBfIGlkZW50OmlkZW50IF8gbGFiZWw6Y29sb25MYWJlbCBfIHBhcmFtczpwYXJhbUJsb2NrPyBfCiAgewogICAgcmV0dXJuIHsKICAgICAgdHlwZTogIm5vZGUiLAogICAgICBpZDogaWRlbnQsCiAgICAgIHRleHQ6IGxhYmVsLAogICAgICBwYXJhbXM6IHBhcmFtcyB8fCB7fQogICAgfTsKICB9Cgpjb2xvbkxhYmVsID0gIjoiIF9fIGxhYmVsOmxhYmVsCiAgewogICAgcmV0dXJuIGxhYmVsCiAgfQoKZWRnZVN0YXRlbWVudCA9IGxlZnRFZGdlU3RhdGVtZW50IC8gcmlnaHRFZGdlU3RhdGVtZW50CgpsZWZ0RWRnZVN0YXRlbWVudCA9IF8gIHRvSWQ6aWRlbnQgXyAiPC0iIF8gZnJvbUlkczppZGVudHwuLiwgXyAiJiYiIF98IF8gbGFiZWw6Y29sb25MYWJlbD8KICB7CiAgICByZXR1cm4gewogICAgICB0eXBlOiAiZWRnZSIsCiAgICAgIHRvSWQ6IHRvSWQsCiAgICAgIHRleHQ6IGxhYmVsIHx8IHVuZGVmaW5lZCwKICAgICAgZnJvbUlkczogZnJvbUlkcwogICAgfTsKICB9CgpyaWdodEVkZ2VTdGF0ZW1lbnQgPSBfICBmcm9tSWQ6aWRlbnQgXyAiLT4iIF8gdG9JZDppZGVudCBfIGxhYmVsOmNvbG9uTGFiZWw/CiAgewogICAgcmV0dXJuIHsKICAgICAgdHlwZTogImVkZ2UiLAogICAgICB0b0lkOiB0b0lkLAogICAgICB0ZXh0OiBsYWJlbCB8fCB1bmRlZmluZWQsCiAgICAgIGZyb21JZHM6IFtmcm9tSWRdCiAgICB9OwogIH0KCnBhcmFtQmxvY2sgPSAieyIgIF8gRU9MPyBfIHBhcmFtczpwYXJhbXwuLiwgXyAiRU9MIiBffCAifSIgCnsKCXJldHVybiBPYmplY3QuZnJvbUVudHJpZXMocGFyYW1zKTsKfQoKcGFyYW0gPSBpZGVudDppZGVudCBfICc6JyBfIGV4cHJlc3Npb246ZXhwcmVzc2lvbiBfIEVPTD8gXwp7CglyZXR1cm4gW2lkZW50LCBleHByZXNzaW9uXTsKfQoKZXhwcmVzc2lvbiA9IHRleHQ6c3RyaW5nIC8gbnVtOihbMC05XSspCnsgcmV0dXJuIG51bSAhPT0gdW5kZWZpbmVkID8gbWFrZUludGVnZXIobnVtKSA6IHRleHQuam9pbigiIik7IH0KCmlkZW50ID0gaWQ6KFthLXpBLVowLTlfJ10rKQp7IHJldHVybiBpZC5qb2luKCIiKTsgfQoKbGFiZWwgPSBzdHI6c3RyaW5nIC8gdGV4dDooW157XG5dKikKeyByZXR1cm4gdGV4dC5qb2luKCIiKTsgfQoKc3RyaW5nID0gIlwiIiB0ZXh0OihbXiJdKikgIlwiIgp7IHJldHVybiB0ZXh0LmpvaW4oIiIpOyB9CgpFT0wKICA9IFsgXHRdKiBbXG5ccl0rCgpfICJvcHRpb25hbCB3aGl0ZXNwYWNlIgogID0gWyBcdF0qCgpfXyAid2hpdGVzcGFjZSIKICA9IFsgXHRdKwo=",loadFile=async d=>await(await fetch(d)).text(),tocLangParserPromise=loadFile(tocLangGrammarUrl).then(d=>peg_1.generate(d)),parsersPromise=Promise.all([tocLangParserPromise]).then(([d])=>({"evaporating-cloud":d,"goal-tree":d,"problem-tree":d})),goalTreeNodeType=d=>{if(d.type!="node")return null;const g=d.id.toLowerCase();return g==="goal"?"goal":g.startsWith("csf_")?"csf":"nc"},parseGoalTreeSemantics=d=>{const g=new Map;g.set("goal",{key:"goal",label:"",annotation:"G"});const $=[],b=goalTreeNodeType,j=d.statements.find(_e=>b(_e)=="goal");return j&&(g.get("goal").label=j.text),d.statements.filter(_e=>_e.type==="node"&&b(_e)==="nc").forEach(_e=>{g.set(_e.id,{key:_e.id,label:_e.text,statusPercentage:_e.params.status})}),d.statements.filter(_e=>_e.type==="node"&&b(_e)==="csf").forEach(_e=>{g.set(_e.id,{key:_e.id,label:_e.text,annotation:"CSF",statusPercentage:_e.params.status}),$.push({from:_e.id,to:"goal"})}),d.statements.filter(_e=>_e.type==="edge").forEach(_e=>{const et=_e.toId;if(!g.has(et))throw new Error(`Node ${et} not found`);if(_e.fromIds.length!==1)throw new Error("Edges must have exactly one 'from' node in a Goal Tree");const tt=_e.fromIds[0];if(!g.has(tt))throw new Error(`Requirement ${tt} not found`);$.push({from:tt,to:et})}),{nodes:g,edges:$,rankdir:"BT"}},parseProblemTreeSemantics=d=>{const g=new Map,$=[],b=j=>{const _e=/^(UDE|FOL|DE)/i;if(j.match(_e))return j.match(_e)[0].toUpperCase()};return d.statements.filter(j=>j.type==="node").forEach(j=>{g.set(j.id,{annotation:b(j.id),key:j.id,label:j.text})}),d.statements.filter(j=>j.type==="edge").forEach(j=>{const _e=j.toId;let et=_e;if(j.fromIds.length>1){const tt=j.fromIds.join("_")+"_cause_"+_e;et=tt,g.set(tt,{key:tt,label:"AND",intermediate:!0}),$.push({from:tt,to:_e})}for(const tt of j.fromIds){if(!g.has(tt))throw new Error(`Cause ${tt} not declared`);if(!g.has(_e))throw new Error(`Effect ${_e} not declared`);$.push({from:tt,to:et})}}),{nodes:g,edges:$,rankdir:"BT"}},parseTextToAst=async(d,g)=>(await parsersPromise)[d].parse(g);async function loader({params:d}){const g={"evaporating-cloud":exampleEvaporatingCloudText,"goal-tree":exampleGoalTreeText,"problem-tree":exampleProblemTreeText};return{diagramType:d.diagramType,example:g[d.diagramType]}}function Draw(){const{diagramType:d,example:g}=useLoaderData();console.log("diagramType",d);const[$,b]=React.useState(null),[j,_e]=React.useState(null),[et,tt]=React.useState(""),[nt,rt]=React.useState();React.useEffect(()=>{rt(g)},[d]);const it=async st=>{try{const ut=await parseTextToAst(d,st);_e(d==="goal-tree"?parseGoalTreeSemantics(ut):d==="problem-tree"?parseProblemTreeSemantics(ut):null),console.log(ut),b(ut),tt("")}catch(ut){console.error(ut),tt(ut.toString())}};return jsxRuntimeExports.jsxs("div",{className:"flex-row",children:[jsxRuntimeExports.jsx("div",{className:"flex-1",children:jsxRuntimeExports.jsx(Editor,{onChange:it,rows:20,text:nt,setText:rt,error:et})}),jsxRuntimeExports.jsx("div",{className:"flex-1",children:jsxRuntimeExports.jsx(Diagram,{ast:$,semantics:j,diagramType:d})})]})}function About(d){return jsxRuntimeExports.jsxs("div",{id:"about-page",children:[jsxRuntimeExports.jsx("h1",{children:"TOC-Lang"}),jsxRuntimeExports.jsxs("p",{children:["Generate"," ",jsxRuntimeExports.jsx("a",{href:"https://en.wikipedia.org/wiki/Theory_of_constraints",children:"Theory of Constraints"})," ","diagrams from text-based notation. Learn more"," ",jsxRuntimeExports.jsx("a",{href:"https://github.com/raymyers/toc-lang/",children:"on GitHub!"})]})]})}const router=createBrowserRouter([{path:"/",element:jsxRuntimeExports.jsx(App,{}),errorElement:jsxRuntimeExports.jsx(ErrorPage,{}),children:[{index:!0,loader:async()=>redirect("/draw/goal-tree")},{path:"draw/:diagramType",element:jsxRuntimeExports.jsx(Draw,{}),loader},{path:"about",element:jsxRuntimeExports.jsx(About,{})}]}],{basename:"/toc-lang"}),rootResetElt=document.getElementById("root-reset");rootResetElt&&client.createRoot(rootResetElt).render(jsxRuntimeExports.jsx(React.StrictMode,{children:jsxRuntimeExports.jsx(RouterProvider,{router})}))});export default Es(); diff --git a/assets/index-95333218.js b/assets/index-95333218.js deleted file mode 100644 index dee2c00..0000000 --- a/assets/index-95333218.js +++ /dev/null @@ -1,175 +0,0 @@ -var rs=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports);var us=rs((exports,module)=>{function _mergeNamespaces(e,i){for(var o=0;oa[s]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))a(s);new MutationObserver(s=>{for(const c of s)if(c.type==="childList")for(const d of c.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&a(d)}).observe(document,{childList:!0,subtree:!0});function o(s){const c={};return s.integrity&&(c.integrity=s.integrity),s.referrerpolicy&&(c.referrerPolicy=s.referrerpolicy),s.crossorigin==="use-credentials"?c.credentials="include":s.crossorigin==="anonymous"?c.credentials="omit":c.credentials="same-origin",c}function a(s){if(s.ep)return;s.ep=!0;const c=o(s);fetch(s.href,c)}})();function getDefaultExportFromCjs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var jsxRuntimeExports={},jsxRuntime={get exports(){return jsxRuntimeExports},set exports(e){jsxRuntimeExports=e}},reactJsxRuntime_production_min={},reactExports={},react={get exports(){return reactExports},set exports(e){reactExports=e}},react_production_min={};/** - * @license React - * react.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var l$1=Symbol.for("react.element"),n$1=Symbol.for("react.portal"),p$2=Symbol.for("react.fragment"),q$1=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),t=Symbol.for("react.provider"),u=Symbol.for("react.context"),v$1=Symbol.for("react.forward_ref"),w=Symbol.for("react.suspense"),x$1=Symbol.for("react.memo"),y$1=Symbol.for("react.lazy"),z$1=Symbol.iterator;function A$1(e){return e===null||typeof e!="object"?null:(e=z$1&&e[z$1]||e["@@iterator"],typeof e=="function"?e:null)}var B$1={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C$1=Object.assign,D$1={};function E$1(e,i,o){this.props=e,this.context=i,this.refs=D$1,this.updater=o||B$1}E$1.prototype.isReactComponent={};E$1.prototype.setState=function(e,i){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,i,"setState")};E$1.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function F(){}F.prototype=E$1.prototype;function G$1(e,i,o){this.props=e,this.context=i,this.refs=D$1,this.updater=o||B$1}var H$1=G$1.prototype=new F;H$1.constructor=G$1;C$1(H$1,E$1.prototype);H$1.isPureReactComponent=!0;var I$1=Array.isArray,J=Object.prototype.hasOwnProperty,K$1={current:null},L$1={key:!0,ref:!0,__self:!0,__source:!0};function M$1(e,i,o){var a,s={},c=null,d=null;if(i!=null)for(a in i.ref!==void 0&&(d=i.ref),i.key!==void 0&&(c=""+i.key),i)J.call(i,a)&&!L$1.hasOwnProperty(a)&&(s[a]=i[a]);var h=arguments.length-2;if(h===1)s.children=o;else if(1"u")throw new Error(i)}function createKey(){return Math.random().toString(36).substr(2,8)}function getHistoryState(e,i){return{usr:e.state,key:e.key,idx:i}}function createLocation(e,i,o,a){return o===void 0&&(o=null),_extends$2({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof i=="string"?parsePath(i):i,{state:o,key:i&&i.key||a||createKey()})}function createPath(e){let{pathname:i="/",search:o="",hash:a=""}=e;return o&&o!=="?"&&(i+=o.charAt(0)==="?"?o:"?"+o),a&&a!=="#"&&(i+=a.charAt(0)==="#"?a:"#"+a),i}function parsePath(e){let i={};if(e){let o=e.indexOf("#");o>=0&&(i.hash=e.substr(o),e=e.substr(0,o));let a=e.indexOf("?");a>=0&&(i.search=e.substr(a),e=e.substr(0,a)),e&&(i.pathname=e)}return i}function getUrlBasedHistory(e,i,o,a){a===void 0&&(a={});let{window:s=document.defaultView,v5Compat:c=!1}=a,d=s.history,h=Action.Pop,g=null,$=b();$==null&&($=0,d.replaceState(_extends$2({},d.state,{idx:$}),""));function b(){return(d.state||{idx:null}).idx}function et(){h=Action.Pop;let pt=b(),rt=pt==null?null:pt-$;$=pt,g&&g({action:h,location:it.location,delta:rt})}function _e(pt,rt){h=Action.Push;let ot=createLocation(it.location,pt,rt);o&&o(ot,pt),$=b()+1;let st=getHistoryState(ot,$),ct=it.createHref(ot);try{d.pushState(st,"",ct)}catch{s.location.assign(ct)}c&&g&&g({action:h,location:it.location,delta:1})}function nt(pt,rt){h=Action.Replace;let ot=createLocation(it.location,pt,rt);o&&o(ot,pt),$=b();let st=getHistoryState(ot,$),ct=it.createHref(ot);d.replaceState(st,"",ct),c&&g&&g({action:h,location:it.location,delta:0})}function lt(pt){let rt=s.location.origin!=="null"?s.location.origin:s.location.href,ot=typeof pt=="string"?pt:createPath(pt);return invariant(rt,"No window.location.(origin|href) available to create URL for href: "+ot),new URL(ot,rt)}let it={get action(){return h},get location(){return e(s,d)},listen(pt){if(g)throw new Error("A history only accepts one active listener");return s.addEventListener(PopStateEventType,et),g=pt,()=>{s.removeEventListener(PopStateEventType,et),g=null}},createHref(pt){return i(s,pt)},createURL:lt,encodeLocation(pt){let rt=lt(pt);return{pathname:rt.pathname,search:rt.search,hash:rt.hash}},push:_e,replace:nt,go(pt){return d.go(pt)}};return it}var ResultType;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(ResultType||(ResultType={}));function isIndexRoute(e){return e.index===!0}function convertRoutesToDataRoutes(e,i,o){return i===void 0&&(i=[]),o===void 0&&(o=new Set),e.map((a,s)=>{let c=[...i,s],d=typeof a.id=="string"?a.id:c.join("-");return invariant(a.index!==!0||!a.children,"Cannot specify children on an index route"),invariant(!o.has(d),'Found a route id collision on id "'+d+`". Route id's must be globally unique within Data Router usages`),o.add(d),isIndexRoute(a)?_extends$2({},a,{id:d}):_extends$2({},a,{id:d,children:a.children?convertRoutesToDataRoutes(a.children,c,o):void 0})})}function matchRoutes(e,i,o){o===void 0&&(o="/");let a=typeof i=="string"?parsePath(i):i,s=stripBasename(a.pathname||"/",o);if(s==null)return null;let c=flattenRoutes(e);rankRouteBranches(c);let d=null;for(let h=0;d==null&&h{let g={relativePath:h===void 0?c.path||"":h,caseSensitive:c.caseSensitive===!0,childrenIndex:d,route:c};g.relativePath.startsWith("/")&&(invariant(g.relativePath.startsWith(a),'Absolute route path "'+g.relativePath+'" nested under path '+('"'+a+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),g.relativePath=g.relativePath.slice(a.length));let $=joinPaths([a,g.relativePath]),b=o.concat(g);c.children&&c.children.length>0&&(invariant(c.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+$+'".')),flattenRoutes(c.children,i,b,$)),!(c.path==null&&!c.index)&&i.push({path:$,score:computeScore($,c.index),routesMeta:b})};return e.forEach((c,d)=>{var h;if(c.path===""||!((h=c.path)!=null&&h.includes("?")))s(c,d);else for(let g of explodeOptionalSegments(c.path))s(c,d,g)}),i}function explodeOptionalSegments(e){let i=e.split("/");if(i.length===0)return[];let[o,...a]=i,s=o.endsWith("?"),c=o.replace(/\?$/,"");if(a.length===0)return s?[c,""]:[c];let d=explodeOptionalSegments(a.join("/")),h=[];return h.push(...d.map(g=>g===""?c:[c,g].join("/"))),s&&h.push(...d),h.map(g=>e.startsWith("/")&&g===""?"/":g)}function rankRouteBranches(e){e.sort((i,o)=>i.score!==o.score?o.score-i.score:compareIndexes(i.routesMeta.map(a=>a.childrenIndex),o.routesMeta.map(a=>a.childrenIndex)))}const paramRe=/^:\w+$/,dynamicSegmentValue=3,indexRouteValue=2,emptySegmentValue=1,staticSegmentValue=10,splatPenalty=-2,isSplat=e=>e==="*";function computeScore(e,i){let o=e.split("/"),a=o.length;return o.some(isSplat)&&(a+=splatPenalty),i&&(a+=indexRouteValue),o.filter(s=>!isSplat(s)).reduce((s,c)=>s+(paramRe.test(c)?dynamicSegmentValue:c===""?emptySegmentValue:staticSegmentValue),a)}function compareIndexes(e,i){return e.length===i.length&&e.slice(0,-1).every((a,s)=>a===i[s])?e[e.length-1]-i[i.length-1]:0}function matchRouteBranch(e,i){let{routesMeta:o}=e,a={},s="/",c=[];for(let d=0;d{if(b==="*"){let _e=h[et]||"";d=c.slice(0,c.length-_e.length).replace(/(.)\/+$/,"$1")}return $[b]=safelyDecodeURIComponent(h[et]||"",b),$},{}),pathname:c,pathnameBase:d,pattern:e}}function compilePath(e,i,o){i===void 0&&(i=!1),o===void 0&&(o=!0),warning(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let a=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,(d,h)=>(a.push(h),"/([^\\/]+)"));return e.endsWith("*")?(a.push("*"),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):o?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,i?void 0:"i"),a]}function safelyDecodeURI(e){try{return decodeURI(e)}catch(i){return warning(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+i+").")),e}}function safelyDecodeURIComponent(e,i){try{return decodeURIComponent(e)}catch(o){return warning(!1,'The value for the URL param "'+i+'" will not be decoded because'+(' the string "'+e+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+o+").")),e}}function stripBasename(e,i){if(i==="/")return e;if(!e.toLowerCase().startsWith(i.toLowerCase()))return null;let o=i.endsWith("/")?i.length-1:i.length,a=e.charAt(o);return a&&a!=="/"?null:e.slice(o)||"/"}function warning(e,i){if(!e){typeof console<"u"&&console.warn(i);try{throw new Error(i)}catch{}}}function resolvePath(e,i){i===void 0&&(i="/");let{pathname:o,search:a="",hash:s=""}=typeof e=="string"?parsePath(e):e;return{pathname:o?o.startsWith("/")?o:resolvePathname(o,i):i,search:normalizeSearch(a),hash:normalizeHash(s)}}function resolvePathname(e,i){let o=i.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?o.length>1&&o.pop():s!=="."&&o.push(s)}),o.length>1?o.join("/"):"/"}function getInvalidPathError(e,i,o,a){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+i+"` field ["+JSON.stringify(a)+"]. Please separate it out to the ")+("`to."+o+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function getPathContributingMatches(e){return e.filter((i,o)=>o===0||i.route.path&&i.route.path.length>0)}function resolveTo(e,i,o,a){a===void 0&&(a=!1);let s;typeof e=="string"?s=parsePath(e):(s=_extends$2({},e),invariant(!s.pathname||!s.pathname.includes("?"),getInvalidPathError("?","pathname","search",s)),invariant(!s.pathname||!s.pathname.includes("#"),getInvalidPathError("#","pathname","hash",s)),invariant(!s.search||!s.search.includes("#"),getInvalidPathError("#","search","hash",s)));let c=e===""||s.pathname==="",d=c?"/":s.pathname,h;if(a||d==null)h=o;else{let et=i.length-1;if(d.startsWith("..")){let _e=d.split("/");for(;_e[0]==="..";)_e.shift(),et-=1;s.pathname=_e.join("/")}h=et>=0?i[et]:"/"}let g=resolvePath(s,h),$=d&&d!=="/"&&d.endsWith("/"),b=(c||d===".")&&o.endsWith("/");return!g.pathname.endsWith("/")&&($||b)&&(g.pathname+="/"),g}const joinPaths=e=>e.join("/").replace(/\/\/+/g,"/"),normalizePathname=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),normalizeSearch=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,normalizeHash=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;class AbortedDeferredError extends Error{}class DeferredData{constructor(i,o){this.pendingKeysSet=new Set,this.subscribers=new Set,this.deferredKeys=[],invariant(i&&typeof i=="object"&&!Array.isArray(i),"defer() only accepts plain objects");let a;this.abortPromise=new Promise((c,d)=>a=d),this.controller=new AbortController;let s=()=>a(new AbortedDeferredError("Deferred data aborted"));this.unlistenAbortSignal=()=>this.controller.signal.removeEventListener("abort",s),this.controller.signal.addEventListener("abort",s),this.data=Object.entries(i).reduce((c,d)=>{let[h,g]=d;return Object.assign(c,{[h]:this.trackPromise(h,g)})},{}),this.done&&this.unlistenAbortSignal(),this.init=o}trackPromise(i,o){if(!(o instanceof Promise))return o;this.deferredKeys.push(i),this.pendingKeysSet.add(i);let a=Promise.race([o,this.abortPromise]).then(s=>this.onSettle(a,i,null,s),s=>this.onSettle(a,i,s));return a.catch(()=>{}),Object.defineProperty(a,"_tracked",{get:()=>!0}),a}onSettle(i,o,a,s){return this.controller.signal.aborted&&a instanceof AbortedDeferredError?(this.unlistenAbortSignal(),Object.defineProperty(i,"_error",{get:()=>a}),Promise.reject(a)):(this.pendingKeysSet.delete(o),this.done&&this.unlistenAbortSignal(),a?(Object.defineProperty(i,"_error",{get:()=>a}),this.emit(!1,o),Promise.reject(a)):(Object.defineProperty(i,"_data",{get:()=>s}),this.emit(!1,o),s))}emit(i,o){this.subscribers.forEach(a=>a(i,o))}subscribe(i){return this.subscribers.add(i),()=>this.subscribers.delete(i)}cancel(){this.controller.abort(),this.pendingKeysSet.forEach((i,o)=>this.pendingKeysSet.delete(o)),this.emit(!0)}async resolveData(i){let o=!1;if(!this.done){let a=()=>this.cancel();i.addEventListener("abort",a),o=await new Promise(s=>{this.subscribe(c=>{i.removeEventListener("abort",a),(c||this.done)&&s(c)})})}return o}get done(){return this.pendingKeysSet.size===0}get unwrappedData(){return invariant(this.data!==null&&this.done,"Can only unwrap data on initialized and settled deferreds"),Object.entries(this.data).reduce((i,o)=>{let[a,s]=o;return Object.assign(i,{[a]:unwrapTrackedPromise(s)})},{})}get pendingKeys(){return Array.from(this.pendingKeysSet)}}function isTrackedPromise(e){return e instanceof Promise&&e._tracked===!0}function unwrapTrackedPromise(e){if(!isTrackedPromise(e))return e;if(e._error)throw e._error;return e._data}const redirect=function(i,o){o===void 0&&(o=302);let a=o;typeof a=="number"?a={status:a}:typeof a.status>"u"&&(a.status=302);let s=new Headers(a.headers);return s.set("Location",i),new Response(null,_extends$2({},a,{headers:s}))};class ErrorResponse{constructor(i,o,a,s){s===void 0&&(s=!1),this.status=i,this.statusText=o||"",this.internal=s,a instanceof Error?(this.data=a.toString(),this.error=a):this.data=a}}function isRouteErrorResponse(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const validMutationMethodsArr=["post","put","patch","delete"],validMutationMethods=new Set(validMutationMethodsArr),validRequestMethodsArr=["get",...validMutationMethodsArr],validRequestMethods=new Set(validRequestMethodsArr),redirectStatusCodes=new Set([301,302,303,307,308]),redirectPreserveMethodStatusCodes=new Set([307,308]),IDLE_NAVIGATION={state:"idle",location:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},IDLE_FETCHER={state:"idle",data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},IDLE_BLOCKER={state:"unblocked",proceed:void 0,reset:void 0,location:void 0},isBrowser$1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",isServer=!isBrowser$1;function createRouter(e){invariant(e.routes.length>0,"You must provide a non-empty routes array to createRouter");let i=convertRoutesToDataRoutes(e.routes),o=null,a=new Set,s=null,c=null,d=null,h=e.hydrationData!=null,g=matchRoutes(i,e.history.location,e.basename),$=null;if(g==null){let vt=getInternalRouterError(404,{pathname:e.history.location.pathname}),{matches:yt,route:_t}=getShortCircuitMatches(i);g=yt,$={[_t.id]:vt}}let b=!g.some(vt=>vt.route.loader)||e.hydrationData!=null,et,_e={historyAction:e.history.action,location:e.history.location,matches:g,initialized:b,navigation:IDLE_NAVIGATION,restoreScrollPosition:e.hydrationData!=null?!1:null,preventScrollReset:!1,revalidation:"idle",loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||$,fetchers:new Map,blockers:new Map},nt=Action.Pop,lt=!1,it,pt=!1,rt=!1,ot=[],st=[],ct=new Map,ft=0,wt=-1,xt=new Map,$t=new Set,Dt=new Map,dt=new Map,mt=null,Ct=new Map,St=!1;function bt(){return o=e.history.listen(vt=>{let{action:yt,location:_t,delta:Rt}=vt;if(St){St=!1;return}warning(mt!=null&&Rt===null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let Bt=bn({currentLocation:_e.location,nextLocation:_t,historyAction:yt});if(Bt&&Rt!=null){St=!0,e.history.go(Rt*-1),yn(Bt,{state:"blocked",location:_t,proceed(){yn(Bt,{state:"proceeding",proceed:void 0,reset:void 0,location:_t}),e.history.go(Rt)},reset(){En(Bt),zt({blockers:new Map(et.state.blockers)})}});return}return Vt(yt,_t)}),_e.initialized||Vt(Action.Pop,_e.location),et}function Mt(){o&&o(),a.clear(),it&&it.abort(),_e.fetchers.forEach((vt,yt)=>Bn(yt)),_e.blockers.forEach((vt,yt)=>En(yt))}function Yt(vt){return a.add(vt),()=>a.delete(vt)}function zt(vt){_e=_extends$2({},_e,vt),a.forEach(yt=>yt(_e))}function Ft(vt,yt){var _t,Rt;let Bt=_e.actionData!=null&&_e.navigation.formMethod!=null&&isMutationMethod(_e.navigation.formMethod)&&_e.navigation.state==="loading"&&((_t=vt.state)==null?void 0:_t._isRedirect)!==!0,Nt;yt.actionData?Object.keys(yt.actionData).length>0?Nt=yt.actionData:Nt=null:Bt?Nt=_e.actionData:Nt=null;let It=yt.loaderData?mergeLoaderData(_e.loaderData,yt.loaderData,yt.matches||[],yt.errors):_e.loaderData;for(let[Pt]of Ct)En(Pt);let Ut=lt===!0||_e.navigation.formMethod!=null&&isMutationMethod(_e.navigation.formMethod)&&((Rt=vt.state)==null?void 0:Rt._isRedirect)!==!0;zt(_extends$2({},yt,{actionData:Nt,loaderData:It,historyAction:nt,location:vt,initialized:!0,navigation:IDLE_NAVIGATION,revalidation:"idle",restoreScrollPosition:jn(vt,yt.matches||_e.matches),preventScrollReset:Ut,blockers:new Map(_e.blockers)})),pt||nt===Action.Pop||(nt===Action.Push?e.history.push(vt,vt.state):nt===Action.Replace&&e.history.replace(vt,vt.state)),nt=Action.Pop,lt=!1,pt=!1,rt=!1,ot=[],st=[]}async function kt(vt,yt){if(typeof vt=="number"){e.history.go(vt);return}let{path:_t,submission:Rt,error:Bt}=normalizeNavigateOptions(vt,yt),Nt=_e.location,It=createLocation(_e.location,_t,yt&&yt.state);It=_extends$2({},It,e.history.encodeLocation(It));let Ut=yt&&yt.replace!=null?yt.replace:void 0,Pt=Action.Push;Ut===!0?Pt=Action.Replace:Ut===!1||Rt!=null&&isMutationMethod(Rt.formMethod)&&Rt.formAction===_e.location.pathname+_e.location.search&&(Pt=Action.Replace);let Xt=yt&&"preventScrollReset"in yt?yt.preventScrollReset===!0:void 0,jt=bn({currentLocation:Nt,nextLocation:It,historyAction:Pt});if(jt){yn(jt,{state:"blocked",location:It,proceed(){yn(jt,{state:"proceeding",proceed:void 0,reset:void 0,location:It}),kt(vt,yt)},reset(){En(jt),zt({blockers:new Map(_e.blockers)})}});return}return await Vt(Pt,It,{submission:Rt,pendingError:Bt,preventScrollReset:Xt,replace:yt&&yt.replace})}function Lt(){if(xn(),zt({revalidation:"loading"}),_e.navigation.state!=="submitting"){if(_e.navigation.state==="idle"){Vt(_e.historyAction,_e.location,{startUninterruptedRevalidation:!0});return}Vt(nt||_e.historyAction,_e.navigation.location,{overrideNavigation:_e.navigation})}}async function Vt(vt,yt,_t){it&&it.abort(),it=null,nt=vt,pt=(_t&&_t.startUninterruptedRevalidation)===!0,rr(_e.location,_e.matches),lt=(_t&&_t.preventScrollReset)===!0;let Rt=_t&&_t.overrideNavigation,Bt=matchRoutes(i,yt,e.basename);if(!Bt){let Kt=getInternalRouterError(404,{pathname:yt.pathname}),{matches:nn,route:Jt}=getShortCircuitMatches(i);Rn(),Ft(yt,{matches:nn,loaderData:{},errors:{[Jt.id]:Kt}});return}if(isHashChangeOnly(_e.location,yt)&&!(_t&&_t.submission&&isMutationMethod(_t.submission.formMethod))){Ft(yt,{matches:Bt});return}it=new AbortController;let Nt=createClientSideRequest(e.history,yt,it.signal,_t&&_t.submission),It,Ut;if(_t&&_t.pendingError)Ut={[findNearestBoundary(Bt).route.id]:_t.pendingError};else if(_t&&_t.submission&&isMutationMethod(_t.submission.formMethod)){let Kt=await Gt(Nt,yt,_t.submission,Bt,{replace:_t.replace});if(Kt.shortCircuited)return;It=Kt.pendingActionData,Ut=Kt.pendingActionError,Rt=_extends$2({state:"loading",location:yt},_t.submission),Nt=new Request(Nt.url,{signal:Nt.signal})}let{shortCircuited:Pt,loaderData:Xt,errors:jt}=await on(Nt,yt,Bt,Rt,_t&&_t.submission,_t&&_t.replace,It,Ut);Pt||(it=null,Ft(yt,_extends$2({matches:Bt},It?{actionData:It}:{},{loaderData:Xt,errors:jt})))}async function Gt(vt,yt,_t,Rt,Bt){xn();let Nt=_extends$2({state:"submitting",location:yt},_t);zt({navigation:Nt});let It,Ut=getTargetMatch(Rt,yt);if(!Ut.route.action)It={type:ResultType.error,error:getInternalRouterError(405,{method:vt.method,pathname:yt.pathname,routeId:Ut.route.id})};else if(It=await callLoaderOrAction("action",vt,Ut,Rt,et.basename),vt.signal.aborted)return{shortCircuited:!0};if(isRedirectResult(It)){let Pt;return Bt&&Bt.replace!=null?Pt=Bt.replace:Pt=It.location===_e.location.pathname+_e.location.search,await vn(_e,It,{submission:_t,replace:Pt}),{shortCircuited:!0}}if(isErrorResult(It)){let Pt=findNearestBoundary(Rt,Ut.route.id);return(Bt&&Bt.replace)!==!0&&(nt=Action.Push),{pendingActionData:{},pendingActionError:{[Pt.route.id]:It.error}}}if(isDeferredResult(It))throw getInternalRouterError(400,{type:"defer-action"});return{pendingActionData:{[Ut.route.id]:It.data}}}async function on(vt,yt,_t,Rt,Bt,Nt,It,Ut){let Pt=Rt;Pt||(Pt=_extends$2({state:"loading",location:yt,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},Bt));let Xt=Bt||(Pt.formMethod&&Pt.formAction&&Pt.formData&&Pt.formEncType?{formMethod:Pt.formMethod,formAction:Pt.formAction,formData:Pt.formData,formEncType:Pt.formEncType}:void 0),[jt,Kt]=getMatchesToLoad(e.history,_e,_t,Xt,yt,rt,ot,st,It,Ut,Dt);if(Rn(Zt=>!(_t&&_t.some(rn=>rn.route.id===Zt))||jt&&jt.some(rn=>rn.route.id===Zt)),jt.length===0&&Kt.length===0)return Ft(yt,_extends$2({matches:_t,loaderData:{},errors:Ut||null},It?{actionData:It}:{})),{shortCircuited:!0};if(!pt){Kt.forEach(rn=>{let cn=_e.fetchers.get(rn.key),wn={state:"loading",data:cn&&cn.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(rn.key,wn)});let Zt=It||_e.actionData;zt(_extends$2({navigation:Pt},Zt?Object.keys(Zt).length===0?{actionData:null}:{actionData:Zt}:{},Kt.length>0?{fetchers:new Map(_e.fetchers)}:{}))}wt=++ft,Kt.forEach(Zt=>ct.set(Zt.key,it));let{results:nn,loaderResults:Jt,fetcherResults:ln}=await Ln(_e.matches,_t,jt,Kt,vt);if(vt.signal.aborted)return{shortCircuited:!0};Kt.forEach(Zt=>ct.delete(Zt.key));let An=findRedirect(nn);if(An)return await vn(_e,An,{replace:Nt}),{shortCircuited:!0};let{loaderData:Cn,errors:hn}=processLoaderData(_e,_t,jt,Jt,Ut,Kt,ln,dt);dt.forEach((Zt,rn)=>{Zt.subscribe(cn=>{(cn||Zt.done)&&dt.delete(rn)})}),tr();let kn=On(wt);return _extends$2({loaderData:Cn,errors:hn},kn||Kt.length>0?{fetchers:new Map(_e.fetchers)}:{})}function un(vt){return _e.fetchers.get(vt)||IDLE_FETCHER}function pn(vt,yt,_t,Rt){if(isServer)throw new Error("router.fetch() was called during the server render, but it shouldn't be. You are likely calling a useFetcher() method in the body of your component. Try moving it to a useEffect or a callback.");ct.has(vt)&&_n(vt);let Bt=matchRoutes(i,_t,e.basename);if(!Bt){Dn(vt,yt,getInternalRouterError(404,{pathname:_t}));return}let{path:Nt,submission:It}=normalizeNavigateOptions(_t,Rt,!0),Ut=getTargetMatch(Bt,Nt);if(lt=(Rt&&Rt.preventScrollReset)===!0,It&&isMutationMethod(It.formMethod)){en(vt,yt,Nt,Ut,Bt,It);return}Dt.set(vt,{routeId:yt,path:Nt,match:Ut,matches:Bt}),an(vt,yt,Nt,Ut,Bt,It)}async function en(vt,yt,_t,Rt,Bt,Nt){if(xn(),Dt.delete(vt),!Rt.route.action){let sn=getInternalRouterError(405,{method:Nt.formMethod,pathname:_t,routeId:yt});Dn(vt,yt,sn);return}let It=_e.fetchers.get(vt),Ut=_extends$2({state:"submitting"},Nt,{data:It&&It.data," _hasFetcherDoneAnything ":!0});_e.fetchers.set(vt,Ut),zt({fetchers:new Map(_e.fetchers)});let Pt=new AbortController,Xt=createClientSideRequest(e.history,_t,Pt.signal,Nt);ct.set(vt,Pt);let jt=await callLoaderOrAction("action",Xt,Rt,Bt,et.basename);if(Xt.signal.aborted){ct.get(vt)===Pt&&ct.delete(vt);return}if(isRedirectResult(jt)){ct.delete(vt),$t.add(vt);let sn=_extends$2({state:"loading"},Nt,{data:void 0," _hasFetcherDoneAnything ":!0});return _e.fetchers.set(vt,sn),zt({fetchers:new Map(_e.fetchers)}),vn(_e,jt,{isFetchActionRedirect:!0})}if(isErrorResult(jt)){Dn(vt,yt,jt.error);return}if(isDeferredResult(jt))throw getInternalRouterError(400,{type:"defer-action"});let Kt=_e.navigation.location||_e.location,nn=createClientSideRequest(e.history,Kt,Pt.signal),Jt=_e.navigation.state!=="idle"?matchRoutes(i,_e.navigation.location,e.basename):_e.matches;invariant(Jt,"Didn't find any matches after fetcher action");let ln=++ft;xt.set(vt,ln);let An=_extends$2({state:"loading",data:jt.data},Nt,{" _hasFetcherDoneAnything ":!0});_e.fetchers.set(vt,An);let[Cn,hn]=getMatchesToLoad(e.history,_e,Jt,Nt,Kt,rt,ot,st,{[Rt.route.id]:jt.data},void 0,Dt);hn.filter(sn=>sn.key!==vt).forEach(sn=>{let Pn=sn.key,Hn=_e.fetchers.get(Pn),ir={state:"loading",data:Hn&&Hn.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(Pn,ir),ct.set(Pn,Pt)}),zt({fetchers:new Map(_e.fetchers)});let{results:kn,loaderResults:Zt,fetcherResults:rn}=await Ln(_e.matches,Jt,Cn,hn,nn);if(Pt.signal.aborted)return;xt.delete(vt),ct.delete(vt),hn.forEach(sn=>ct.delete(sn.key));let cn=findRedirect(kn);if(cn)return vn(_e,cn);let{loaderData:wn,errors:Tn}=processLoaderData(_e,_e.matches,Cn,Zt,void 0,hn,rn,dt),ur={state:"idle",data:jt.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(vt,ur);let Un=On(ln);_e.navigation.state==="loading"&&ln>wt?(invariant(nt,"Expected pending action"),it&&it.abort(),Ft(_e.navigation.location,{matches:Jt,loaderData:wn,errors:Tn,fetchers:new Map(_e.fetchers)})):(zt(_extends$2({errors:Tn,loaderData:mergeLoaderData(_e.loaderData,wn,Jt,Tn)},Un?{fetchers:new Map(_e.fetchers)}:{})),rt=!1)}async function an(vt,yt,_t,Rt,Bt,Nt){let It=_e.fetchers.get(vt),Ut=_extends$2({state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},Nt,{data:It&&It.data," _hasFetcherDoneAnything ":!0});_e.fetchers.set(vt,Ut),zt({fetchers:new Map(_e.fetchers)});let Pt=new AbortController,Xt=createClientSideRequest(e.history,_t,Pt.signal);ct.set(vt,Pt);let jt=await callLoaderOrAction("loader",Xt,Rt,Bt,et.basename);if(isDeferredResult(jt)&&(jt=await resolveDeferredData(jt,Xt.signal,!0)||jt),ct.get(vt)===Pt&&ct.delete(vt),Xt.signal.aborted)return;if(isRedirectResult(jt)){await vn(_e,jt);return}if(isErrorResult(jt)){let nn=findNearestBoundary(_e.matches,yt);_e.fetchers.delete(vt),zt({fetchers:new Map(_e.fetchers),errors:{[nn.route.id]:jt.error}});return}invariant(!isDeferredResult(jt),"Unhandled fetcher deferred data");let Kt={state:"idle",data:jt.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(vt,Kt),zt({fetchers:new Map(_e.fetchers)})}async function vn(vt,yt,_t){var Rt;let{submission:Bt,replace:Nt,isFetchActionRedirect:It}=_t===void 0?{}:_t;yt.revalidate&&(rt=!0);let Ut=createLocation(vt.location,yt.location,_extends$2({_isRedirect:!0},It?{_isFetchActionRedirect:!0}:{}));if(invariant(Ut,"Expected a location on the redirect navigation"),isBrowser$1&&typeof((Rt=window)==null?void 0:Rt.location)<"u"){let Jt=e.history.createURL(yt.location).origin;if(window.location.origin!==Jt){Nt?window.location.replace(yt.location):window.location.assign(yt.location);return}}it=null;let Pt=Nt===!0?Action.Replace:Action.Push,{formMethod:Xt,formAction:jt,formEncType:Kt,formData:nn}=vt.navigation;!Bt&&Xt&&jt&&nn&&Kt&&(Bt={formMethod:Xt,formAction:jt,formEncType:Kt,formData:nn}),redirectPreserveMethodStatusCodes.has(yt.status)&&Bt&&isMutationMethod(Bt.formMethod)?await Vt(Pt,Ut,{submission:_extends$2({},Bt,{formAction:yt.location}),preventScrollReset:lt}):await Vt(Pt,Ut,{overrideNavigation:{state:"loading",location:Ut,formMethod:Bt?Bt.formMethod:void 0,formAction:Bt?Bt.formAction:void 0,formEncType:Bt?Bt.formEncType:void 0,formData:Bt?Bt.formData:void 0},preventScrollReset:lt})}async function Ln(vt,yt,_t,Rt,Bt){let Nt=await Promise.all([..._t.map(Pt=>callLoaderOrAction("loader",Bt,Pt,yt,et.basename)),...Rt.map(Pt=>callLoaderOrAction("loader",createClientSideRequest(e.history,Pt.path,Bt.signal),Pt.match,Pt.matches,et.basename))]),It=Nt.slice(0,_t.length),Ut=Nt.slice(_t.length);return await Promise.all([resolveDeferredResults(vt,_t,It,Bt.signal,!1,_e.loaderData),resolveDeferredResults(vt,Rt.map(Pt=>Pt.match),Ut,Bt.signal,!0)]),{results:Nt,loaderResults:It,fetcherResults:Ut}}function xn(){rt=!0,ot.push(...Rn()),Dt.forEach((vt,yt)=>{ct.has(yt)&&(st.push(yt),_n(yt))})}function Dn(vt,yt,_t){let Rt=findNearestBoundary(_e.matches,yt);Bn(vt),zt({errors:{[Rt.route.id]:_t},fetchers:new Map(_e.fetchers)})}function Bn(vt){ct.has(vt)&&_n(vt),Dt.delete(vt),xt.delete(vt),$t.delete(vt),_e.fetchers.delete(vt)}function _n(vt){let yt=ct.get(vt);invariant(yt,"Expected fetch controller: "+vt),yt.abort(),ct.delete(vt)}function Nn(vt){for(let yt of vt){let Rt={state:"idle",data:un(yt).data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(yt,Rt)}}function tr(){let vt=[];for(let yt of $t){let _t=_e.fetchers.get(yt);invariant(_t,"Expected fetcher: "+yt),_t.state==="loading"&&($t.delete(yt),vt.push(yt))}Nn(vt)}function On(vt){let yt=[];for(let[_t,Rt]of xt)if(Rt0}function nr(vt,yt){let _t=_e.blockers.get(vt)||IDLE_BLOCKER;return Ct.get(vt)!==yt&&(Ct.set(vt,yt),mt==null?mt=vt:vt!==mt&&warning(!1,"A router only supports one blocker at a time")),_t}function En(vt){_e.blockers.delete(vt),Ct.delete(vt),mt===vt&&(mt=null)}function yn(vt,yt){let _t=_e.blockers.get(vt)||IDLE_BLOCKER;invariant(_t.state==="unblocked"&&yt.state==="blocked"||_t.state==="blocked"&&yt.state==="blocked"||_t.state==="blocked"&&yt.state==="proceeding"||_t.state==="blocked"&&yt.state==="unblocked"||_t.state==="proceeding"&&yt.state==="unblocked","Invalid blocker state transition: "+_t.state+" -> "+yt.state),_e.blockers.set(vt,yt),zt({blockers:new Map(_e.blockers)})}function bn(vt){let{currentLocation:yt,nextLocation:_t,historyAction:Rt}=vt;if(mt==null)return;let Bt=Ct.get(mt);invariant(Bt,"Could not find a function for the active blocker");let Nt=_e.blockers.get(mt);if(!(Nt&&Nt.state==="proceeding")&&Bt({currentLocation:yt,nextLocation:_t,historyAction:Rt}))return mt}function Rn(vt){let yt=[];return dt.forEach((_t,Rt)=>{(!vt||vt(Rt))&&(_t.cancel(),yt.push(Rt),dt.delete(Rt))}),yt}function Mn(vt,yt,_t){if(s=vt,d=yt,c=_t||(Rt=>Rt.key),!h&&_e.navigation===IDLE_NAVIGATION){h=!0;let Rt=jn(_e.location,_e.matches);Rt!=null&&zt({restoreScrollPosition:Rt})}return()=>{s=null,d=null,c=null}}function rr(vt,yt){if(s&&c&&d){let _t=yt.map(Bt=>createUseMatchesMatch(Bt,_e.loaderData)),Rt=c(vt,_t)||vt.key;s[Rt]=d()}}function jn(vt,yt){if(s&&c&&d){let _t=yt.map(Nt=>createUseMatchesMatch(Nt,_e.loaderData)),Rt=c(vt,_t)||vt.key,Bt=s[Rt];if(typeof Bt=="number")return Bt}return null}return et={get basename(){return e.basename},get state(){return _e},get routes(){return i},initialize:bt,subscribe:Yt,enableScrollRestoration:Mn,navigate:kt,fetch:pn,revalidate:Lt,createHref:vt=>e.history.createHref(vt),encodeLocation:vt=>e.history.encodeLocation(vt),getFetcher:un,deleteFetcher:Bn,dispose:Mt,getBlocker:nr,deleteBlocker:En,_internalFetchControllers:ct,_internalActiveDeferreds:dt},et}function isSubmissionNavigation(e){return e!=null&&"formData"in e}function normalizeNavigateOptions(e,i,o){o===void 0&&(o=!1);let a=typeof e=="string"?e:createPath(e);if(!i||!isSubmissionNavigation(i))return{path:a};if(i.formMethod&&!isValidMethod(i.formMethod))return{path:a,error:getInternalRouterError(405,{method:i.formMethod})};let s;if(i.formData&&(s={formMethod:i.formMethod||"get",formAction:stripHashFromPath(a),formEncType:i&&i.formEncType||"application/x-www-form-urlencoded",formData:i.formData},isMutationMethod(s.formMethod)))return{path:a,submission:s};let c=parsePath(a),d=convertFormDataToSearchParams(i.formData);return o&&c.search&&hasNakedIndexQuery(c.search)&&d.append("index",""),c.search="?"+d,{path:createPath(c),submission:s}}function getLoaderMatchesUntilBoundary(e,i){let o=e;if(i){let a=e.findIndex(s=>s.route.id===i);a>=0&&(o=e.slice(0,a))}return o}function getMatchesToLoad(e,i,o,a,s,c,d,h,g,$,b){let et=$?Object.values($)[0]:g?Object.values(g)[0]:void 0,_e=e.createURL(i.location),nt=e.createURL(s),lt=c||_e.toString()===nt.toString()||_e.search!==nt.search,it=$?Object.keys($)[0]:void 0,rt=getLoaderMatchesUntilBoundary(o,it).filter((st,ct)=>{if(st.route.loader==null)return!1;if(isNewLoader(i.loaderData,i.matches[ct],st)||d.some(xt=>xt===st.route.id))return!0;let ft=i.matches[ct],wt=st;return shouldRevalidateLoader(st,_extends$2({currentUrl:_e,currentParams:ft.params,nextUrl:nt,nextParams:wt.params},a,{actionResult:et,defaultShouldRevalidate:lt||isNewRouteInstance(ft,wt)}))}),ot=[];return b&&b.forEach((st,ct)=>{if(o.some(ft=>ft.route.id===st.routeId))h.includes(ct)?ot.push(_extends$2({key:ct},st)):shouldRevalidateLoader(st.match,_extends$2({currentUrl:_e,currentParams:i.matches[i.matches.length-1].params,nextUrl:nt,nextParams:o[o.length-1].params},a,{actionResult:et,defaultShouldRevalidate:lt}))&&ot.push(_extends$2({key:ct},st));else return}),[rt,ot]}function isNewLoader(e,i,o){let a=!i||o.route.id!==i.route.id,s=e[o.route.id]===void 0;return a||s}function isNewRouteInstance(e,i){let o=e.route.path;return e.pathname!==i.pathname||o!=null&&o.endsWith("*")&&e.params["*"]!==i.params["*"]}function shouldRevalidateLoader(e,i){if(e.route.shouldRevalidate){let o=e.route.shouldRevalidate(i);if(typeof o=="boolean")return o}return i.defaultShouldRevalidate}async function callLoaderOrAction(e,i,o,a,s,c,d,h){s===void 0&&(s="/"),c===void 0&&(c=!1),d===void 0&&(d=!1);let g,$,b,et=new Promise((nt,lt)=>b=lt),_e=()=>b();i.signal.addEventListener("abort",_e);try{let nt=o.route[e];invariant(nt,"Could not find the "+e+' to run on the "'+o.route.id+'" route'),$=await Promise.race([nt({request:i,params:o.params,context:h}),et]),invariant($!==void 0,"You defined "+(e==="action"?"an action":"a loader")+" for route "+('"'+o.route.id+"\" but didn't return anything from your `"+e+"` ")+"function. Please return a value or `null`.")}catch(nt){g=ResultType.error,$=nt}finally{i.signal.removeEventListener("abort",_e)}if(isResponse($)){let nt=$.status;if(redirectStatusCodes.has(nt)){let pt=$.headers.get("Location");if(invariant(pt,"Redirects returned/thrown from loaders/actions must have a Location header"),/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(pt)){if(!c){let ot=new URL(i.url),st=pt.startsWith("//")?new URL(ot.protocol+pt):new URL(pt);st.origin===ot.origin&&(pt=st.pathname+st.search+st.hash)}}else{let ot=a.slice(0,a.indexOf(o)+1),st=getPathContributingMatches(ot).map(ft=>ft.pathnameBase),ct=resolveTo(pt,st,new URL(i.url).pathname);if(invariant(createPath(ct),"Unable to resolve redirect location: "+pt),s){let ft=ct.pathname;ct.pathname=ft==="/"?s:joinPaths([s,ft])}pt=createPath(ct)}if(c)throw $.headers.set("Location",pt),$;return{type:ResultType.redirect,status:nt,location:pt,revalidate:$.headers.get("X-Remix-Revalidate")!==null}}if(d)throw{type:g||ResultType.data,response:$};let lt,it=$.headers.get("Content-Type");return it&&/\bapplication\/json\b/.test(it)?lt=await $.json():lt=await $.text(),g===ResultType.error?{type:g,error:new ErrorResponse(nt,$.statusText,lt),headers:$.headers}:{type:ResultType.data,data:lt,statusCode:$.status,headers:$.headers}}return g===ResultType.error?{type:g,error:$}:$ instanceof DeferredData?{type:ResultType.deferred,deferredData:$}:{type:ResultType.data,data:$}}function createClientSideRequest(e,i,o,a){let s=e.createURL(stripHashFromPath(i)).toString(),c={signal:o};if(a&&isMutationMethod(a.formMethod)){let{formMethod:d,formEncType:h,formData:g}=a;c.method=d.toUpperCase(),c.body=h==="application/x-www-form-urlencoded"?convertFormDataToSearchParams(g):g}return new Request(s,c)}function convertFormDataToSearchParams(e){let i=new URLSearchParams;for(let[o,a]of e.entries())i.append(o,a instanceof File?a.name:a);return i}function processRouteLoaderData(e,i,o,a,s){let c={},d=null,h,g=!1,$={};return o.forEach((b,et)=>{let _e=i[et].route.id;if(invariant(!isRedirectResult(b),"Cannot handle redirect results in processLoaderData"),isErrorResult(b)){let nt=findNearestBoundary(e,_e),lt=b.error;a&&(lt=Object.values(a)[0],a=void 0),d=d||{},d[nt.route.id]==null&&(d[nt.route.id]=lt),c[_e]=void 0,g||(g=!0,h=isRouteErrorResponse(b.error)?b.error.status:500),b.headers&&($[_e]=b.headers)}else isDeferredResult(b)?(s.set(_e,b.deferredData),c[_e]=b.deferredData.data):c[_e]=b.data,b.statusCode!=null&&b.statusCode!==200&&!g&&(h=b.statusCode),b.headers&&($[_e]=b.headers)}),a&&(d=a,c[Object.keys(a)[0]]=void 0),{loaderData:c,errors:d,statusCode:h||200,loaderHeaders:$}}function processLoaderData(e,i,o,a,s,c,d,h){let{loaderData:g,errors:$}=processRouteLoaderData(i,o,a,s,h);for(let b=0;ba.route.id===i)+1):[...e]).reverse().find(a=>a.route.hasErrorBoundary===!0)||e[0]}function getShortCircuitMatches(e){let i=e.find(o=>o.index||!o.path||o.path==="/")||{id:"__shim-error-route__"};return{matches:[{params:{},pathname:"",pathnameBase:"",route:i}],route:i}}function getInternalRouterError(e,i){let{pathname:o,routeId:a,method:s,type:c}=i===void 0?{}:i,d="Unknown Server Error",h="Unknown @remix-run/router error";return e===400?(d="Bad Request",s&&o&&a?h="You made a "+s+' request to "'+o+'" but '+('did not provide a `loader` for route "'+a+'", ')+"so there is no way to handle the request.":c==="defer-action"&&(h="defer() is not supported in actions")):e===403?(d="Forbidden",h='Route "'+a+'" does not match URL "'+o+'"'):e===404?(d="Not Found",h='No route matches URL "'+o+'"'):e===405&&(d="Method Not Allowed",s&&o&&a?h="You made a "+s.toUpperCase()+' request to "'+o+'" but '+('did not provide an `action` for route "'+a+'", ')+"so there is no way to handle the request.":s&&(h='Invalid request method "'+s.toUpperCase()+'"')),new ErrorResponse(e||500,d,new Error(h),!0)}function findRedirect(e){for(let i=e.length-1;i>=0;i--){let o=e[i];if(isRedirectResult(o))return o}}function stripHashFromPath(e){let i=typeof e=="string"?parsePath(e):e;return createPath(_extends$2({},i,{hash:""}))}function isHashChangeOnly(e,i){return e.pathname===i.pathname&&e.search===i.search&&e.hash!==i.hash}function isDeferredResult(e){return e.type===ResultType.deferred}function isErrorResult(e){return e.type===ResultType.error}function isRedirectResult(e){return(e&&e.type)===ResultType.redirect}function isResponse(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.headers=="object"&&typeof e.body<"u"}function isValidMethod(e){return validRequestMethods.has(e)}function isMutationMethod(e){return validMutationMethods.has(e)}async function resolveDeferredResults(e,i,o,a,s,c){for(let d=0;det.route.id===g.route.id),b=$!=null&&!isNewRouteInstance($,g)&&(c&&c[g.route.id])!==void 0;isDeferredResult(h)&&(s||b)&&await resolveDeferredData(h,a,s).then(et=>{et&&(o[d]=et||o[d])})}}async function resolveDeferredData(e,i,o){if(o===void 0&&(o=!1),!await e.deferredData.resolveData(i)){if(o)try{return{type:ResultType.data,data:e.deferredData.unwrappedData}}catch(s){return{type:ResultType.error,error:s}}return{type:ResultType.data,data:e.deferredData.data}}}function hasNakedIndexQuery(e){return new URLSearchParams(e).getAll("index").some(i=>i==="")}function createUseMatchesMatch(e,i){let{route:o,pathname:a,params:s}=e;return{id:o.id,pathname:a,params:s,data:i[o.id],handle:o.handle}}function getTargetMatch(e,i){let o=typeof i=="string"?parsePath(i).search:i.search;if(e[e.length-1].route.index&&hasNakedIndexQuery(o||""))return e[e.length-1];let a=getPathContributingMatches(e);return a[a.length-1]}/** - * React Router v6.8.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function _extends$1(){return _extends$1=Object.assign?Object.assign.bind():function(e){for(var i=1;i{s.value=a,s.getSnapshot=i,checkIfSnapshotChanged(s)&&c({inst:s})},[e,a,i]),useEffect(()=>(checkIfSnapshotChanged(s)&&c({inst:s}),e(()=>{checkIfSnapshotChanged(s)&&c({inst:s})})),[e]),useDebugValue(a),a}function checkIfSnapshotChanged(e){const i=e.getSnapshot,o=e.value;try{const a=i();return!is(o,a)}catch{return!0}}function useSyncExternalStore$1(e,i,o){return i()}const canUseDOM=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",isServerEnvironment=!canUseDOM,shim=isServerEnvironment?useSyncExternalStore$1:useSyncExternalStore$2,useSyncExternalStore="useSyncExternalStore"in React$1?(e=>e.useSyncExternalStore)(React$1):shim,DataRouterContext=reactExports.createContext(null),DataRouterStateContext=reactExports.createContext(null),NavigationContext=reactExports.createContext(null),LocationContext=reactExports.createContext(null),RouteContext=reactExports.createContext({outlet:null,matches:[]}),RouteErrorContext=reactExports.createContext(null);function useHref(e,i){let{relative:o}=i===void 0?{}:i;useInRouterContext()||invariant(!1);let{basename:a,navigator:s}=reactExports.useContext(NavigationContext),{hash:c,pathname:d,search:h}=useResolvedPath(e,{relative:o}),g=d;return a!=="/"&&(g=d==="/"?a:joinPaths([a,d])),s.createHref({pathname:g,search:h,hash:c})}function useInRouterContext(){return reactExports.useContext(LocationContext)!=null}function useLocation(){return useInRouterContext()||invariant(!1),reactExports.useContext(LocationContext).location}function useNavigate(){useInRouterContext()||invariant(!1);let{basename:e,navigator:i}=reactExports.useContext(NavigationContext),{matches:o}=reactExports.useContext(RouteContext),{pathname:a}=useLocation(),s=JSON.stringify(getPathContributingMatches(o).map(h=>h.pathnameBase)),c=reactExports.useRef(!1);return reactExports.useEffect(()=>{c.current=!0}),reactExports.useCallback(function(h,g){if(g===void 0&&(g={}),!c.current)return;if(typeof h=="number"){i.go(h);return}let $=resolveTo(h,JSON.parse(s),a,g.relative==="path");e!=="/"&&($.pathname=$.pathname==="/"?e:joinPaths([e,$.pathname])),(g.replace?i.replace:i.push)($,g.state,g)},[e,i,s,a])}const OutletContext=reactExports.createContext(null);function useOutlet(e){let i=reactExports.useContext(RouteContext).outlet;return i&&reactExports.createElement(OutletContext.Provider,{value:e},i)}function useResolvedPath(e,i){let{relative:o}=i===void 0?{}:i,{matches:a}=reactExports.useContext(RouteContext),{pathname:s}=useLocation(),c=JSON.stringify(getPathContributingMatches(a).map(d=>d.pathnameBase));return reactExports.useMemo(()=>resolveTo(e,JSON.parse(c),s,o==="path"),[e,c,s,o])}function useRoutes(e,i){useInRouterContext()||invariant(!1);let{navigator:o}=reactExports.useContext(NavigationContext),a=reactExports.useContext(DataRouterStateContext),{matches:s}=reactExports.useContext(RouteContext),c=s[s.length-1],d=c?c.params:{};c&&c.pathname;let h=c?c.pathnameBase:"/";c&&c.route;let g=useLocation(),$;if(i){var b;let it=typeof i=="string"?parsePath(i):i;h==="/"||(b=it.pathname)!=null&&b.startsWith(h)||invariant(!1),$=it}else $=g;let et=$.pathname||"/",_e=h==="/"?et:et.slice(h.length)||"/",nt=matchRoutes(e,{pathname:_e}),lt=_renderMatches(nt&&nt.map(it=>Object.assign({},it,{params:Object.assign({},d,it.params),pathname:joinPaths([h,o.encodeLocation?o.encodeLocation(it.pathname).pathname:it.pathname]),pathnameBase:it.pathnameBase==="/"?h:joinPaths([h,o.encodeLocation?o.encodeLocation(it.pathnameBase).pathname:it.pathnameBase])})),s,a||void 0);return i&<?reactExports.createElement(LocationContext.Provider,{value:{location:_extends$1({pathname:"/",search:"",hash:"",state:null,key:"default"},$),navigationType:Action.Pop}},lt):lt}function DefaultErrorElement(){let e=useRouteError(),i=isRouteErrorResponse(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),o=e instanceof Error?e.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"},c=null;return reactExports.createElement(reactExports.Fragment,null,reactExports.createElement("h2",null,"Unexpected Application Error!"),reactExports.createElement("h3",{style:{fontStyle:"italic"}},i),o?reactExports.createElement("pre",{style:s},o):null,c)}class RenderErrorBoundary extends reactExports.Component{constructor(i){super(i),this.state={location:i.location,error:i.error}}static getDerivedStateFromError(i){return{error:i}}static getDerivedStateFromProps(i,o){return o.location!==i.location?{error:i.error,location:i.location}:{error:i.error||o.error,location:o.location}}componentDidCatch(i,o){console.error("React Router caught the following error during render",i,o)}render(){return this.state.error?reactExports.createElement(RouteContext.Provider,{value:this.props.routeContext},reactExports.createElement(RouteErrorContext.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function RenderedRoute(e){let{routeContext:i,match:o,children:a}=e,s=reactExports.useContext(DataRouterContext);return s&&s.static&&s.staticContext&&o.route.errorElement&&(s.staticContext._deepestRenderedBoundaryId=o.route.id),reactExports.createElement(RouteContext.Provider,{value:i},a)}function _renderMatches(e,i,o){if(i===void 0&&(i=[]),e==null)if(o!=null&&o.errors)e=o.matches;else return null;let a=e,s=o==null?void 0:o.errors;if(s!=null){let c=a.findIndex(d=>d.route.id&&(s==null?void 0:s[d.route.id]));c>=0||invariant(!1),a=a.slice(0,Math.min(a.length,c+1))}return a.reduceRight((c,d,h)=>{let g=d.route.id?s==null?void 0:s[d.route.id]:null,$=o?d.route.errorElement||reactExports.createElement(DefaultErrorElement,null):null,b=i.concat(a.slice(0,h+1)),et=()=>reactExports.createElement(RenderedRoute,{match:d,routeContext:{outlet:c,matches:b}},g?$:d.route.element!==void 0?d.route.element:c);return o&&(d.route.errorElement||h===0)?reactExports.createElement(RenderErrorBoundary,{location:o.location,component:$,error:g,children:et(),routeContext:{outlet:null,matches:b}}):et()},null)}var DataRouterHook$1;(function(e){e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator"})(DataRouterHook$1||(DataRouterHook$1={}));var DataRouterStateHook$1;(function(e){e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator"})(DataRouterStateHook$1||(DataRouterStateHook$1={}));function useDataRouterState(e){let i=reactExports.useContext(DataRouterStateContext);return i||invariant(!1),i}function useRouteContext(e){let i=reactExports.useContext(RouteContext);return i||invariant(!1),i}function useCurrentRouteId(e){let i=useRouteContext(),o=i.matches[i.matches.length-1];return o.route.id||invariant(!1),o.route.id}function useLoaderData(){let e=useDataRouterState(DataRouterStateHook$1.UseLoaderData),i=useCurrentRouteId(DataRouterStateHook$1.UseLoaderData);if(e.errors&&e.errors[i]!=null){console.error("You cannot `useLoaderData` in an errorElement (routeId: "+i+")");return}return e.loaderData[i]}function useRouteError(){var e;let i=reactExports.useContext(RouteErrorContext),o=useDataRouterState(DataRouterStateHook$1.UseRouteError),a=useCurrentRouteId(DataRouterStateHook$1.UseRouteError);return i||((e=o.errors)==null?void 0:e[a])}function RouterProvider(e){let{fallbackElement:i,router:o}=e,a=useSyncExternalStore(o.subscribe,()=>o.state,()=>o.state),s=reactExports.useMemo(()=>({createHref:o.createHref,encodeLocation:o.encodeLocation,go:d=>o.navigate(d),push:(d,h,g)=>o.navigate(d,{state:h,preventScrollReset:g==null?void 0:g.preventScrollReset}),replace:(d,h,g)=>o.navigate(d,{replace:!0,state:h,preventScrollReset:g==null?void 0:g.preventScrollReset})}),[o]),c=o.basename||"/";return reactExports.createElement(reactExports.Fragment,null,reactExports.createElement(DataRouterContext.Provider,{value:{router:o,navigator:s,static:!1,basename:c}},reactExports.createElement(DataRouterStateContext.Provider,{value:a},reactExports.createElement(Router,{basename:o.basename,location:o.state.location,navigationType:o.state.historyAction,navigator:s},o.state.initialized?reactExports.createElement(Routes,null):i))),null)}function Outlet(e){return useOutlet(e.context)}function Route(e){invariant(!1)}function Router(e){let{basename:i="/",children:o=null,location:a,navigationType:s=Action.Pop,navigator:c,static:d=!1}=e;useInRouterContext()&&invariant(!1);let h=i.replace(/^\/*/,"/"),g=reactExports.useMemo(()=>({basename:h,navigator:c,static:d}),[h,c,d]);typeof a=="string"&&(a=parsePath(a));let{pathname:$="/",search:b="",hash:et="",state:_e=null,key:nt="default"}=a,lt=reactExports.useMemo(()=>{let it=stripBasename($,h);return it==null?null:{pathname:it,search:b,hash:et,state:_e,key:nt}},[h,$,b,et,_e,nt]);return lt==null?null:reactExports.createElement(NavigationContext.Provider,{value:g},reactExports.createElement(LocationContext.Provider,{children:o,value:{location:lt,navigationType:s}}))}function Routes(e){let{children:i,location:o}=e,a=reactExports.useContext(DataRouterContext),s=a&&!i?a.router.routes:createRoutesFromChildren(i);return useRoutes(s,o)}var AwaitRenderStatus;(function(e){e[e.pending=0]="pending",e[e.success=1]="success",e[e.error=2]="error"})(AwaitRenderStatus||(AwaitRenderStatus={}));new Promise(()=>{});function createRoutesFromChildren(e,i){i===void 0&&(i=[]);let o=[];return reactExports.Children.forEach(e,(a,s)=>{if(!reactExports.isValidElement(a))return;if(a.type===reactExports.Fragment){o.push.apply(o,createRoutesFromChildren(a.props.children,i));return}a.type!==Route&&invariant(!1),!a.props.index||!a.props.children||invariant(!1);let c=[...i,s],d={id:a.props.id||c.join("-"),caseSensitive:a.props.caseSensitive,element:a.props.element,index:a.props.index,path:a.props.path,loader:a.props.loader,action:a.props.action,errorElement:a.props.errorElement,hasErrorBoundary:a.props.errorElement!=null,shouldRevalidate:a.props.shouldRevalidate,handle:a.props.handle};a.props.children&&(d.children=createRoutesFromChildren(a.props.children,c)),o.push(d)}),o}function enhanceManualRouteObjects(e){return e.map(i=>{let o=_extends$1({},i);return o.hasErrorBoundary==null&&(o.hasErrorBoundary=o.errorElement!=null),o.children&&(o.children=enhanceManualRouteObjects(o.children)),o})}/** - * React Router DOM v6.8.0 - * - * Copyright (c) Remix Software Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE.md file in the root directory of this source tree. - * - * @license MIT - */function _extends(){return _extends=Object.assign?Object.assign.bind():function(e){for(var i=1;i=0)&&(o[s]=e[s]);return o}function isModifiedEvent(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function shouldProcessLinkClick(e,i){return e.button===0&&(!i||i==="_self")&&!isModifiedEvent(e)}const _excluded=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset"],_excluded2=["aria-current","caseSensitive","className","end","style","to","children"];function createBrowserRouter(e,i){return createRouter({basename:i==null?void 0:i.basename,history:createBrowserHistory({window:i==null?void 0:i.window}),hydrationData:(i==null?void 0:i.hydrationData)||parseHydrationData(),routes:enhanceManualRouteObjects(e)}).initialize()}function parseHydrationData(){var e;let i=(e=window)==null?void 0:e.__staticRouterHydrationData;return i&&i.errors&&(i=_extends({},i,{errors:deserializeErrors(i.errors)})),i}function deserializeErrors(e){if(!e)return null;let i=Object.entries(e),o={};for(let[a,s]of i)if(s&&s.__type==="RouteErrorResponse")o[a]=new ErrorResponse(s.status,s.statusText,s.data,s.internal===!0);else if(s&&s.__type==="Error"){let c=new Error(s.message);c.stack="",o[a]=c}else o[a]=s;return o}const isBrowser=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Link=reactExports.forwardRef(function(i,o){let{onClick:a,relative:s,reloadDocument:c,replace:d,state:h,target:g,to:$,preventScrollReset:b}=i,et=_objectWithoutPropertiesLoose(i,_excluded),_e=typeof $=="string"?$:createPath($),nt=/^[a-z+]+:\/\//i.test(_e)||_e.startsWith("//"),lt=_e,it=!1;if(isBrowser&&nt){let st=new URL(window.location.href),ct=_e.startsWith("//")?new URL(st.protocol+_e):new URL(_e);ct.origin===st.origin?lt=ct.pathname+ct.search+ct.hash:it=!0}let pt=useHref(lt,{relative:s}),rt=useLinkClickHandler(lt,{replace:d,state:h,target:g,preventScrollReset:b,relative:s});function ot(st){a&&a(st),st.defaultPrevented||rt(st)}return reactExports.createElement("a",_extends({},et,{href:nt?_e:pt,onClick:it||c?a:ot,ref:o,target:g}))}),NavLink=reactExports.forwardRef(function(i,o){let{"aria-current":a="page",caseSensitive:s=!1,className:c="",end:d=!1,style:h,to:g,children:$}=i,b=_objectWithoutPropertiesLoose(i,_excluded2),et=useResolvedPath(g,{relative:b.relative}),_e=useLocation(),nt=reactExports.useContext(DataRouterStateContext),{navigator:lt}=reactExports.useContext(NavigationContext),it=lt.encodeLocation?lt.encodeLocation(et).pathname:et.pathname,pt=_e.pathname,rt=nt&&nt.navigation&&nt.navigation.location?nt.navigation.location.pathname:null;s||(pt=pt.toLowerCase(),rt=rt?rt.toLowerCase():null,it=it.toLowerCase());let ot=pt===it||!d&&pt.startsWith(it)&&pt.charAt(it.length)==="/",st=rt!=null&&(rt===it||!d&&rt.startsWith(it)&&rt.charAt(it.length)==="/"),ct=ot?a:void 0,ft;typeof c=="function"?ft=c({isActive:ot,isPending:st}):ft=[c,ot?"active":null,st?"pending":null].filter(Boolean).join(" ");let wt=typeof h=="function"?h({isActive:ot,isPending:st}):h;return reactExports.createElement(Link,_extends({},b,{"aria-current":ct,className:ft,ref:o,style:wt,to:g}),typeof $=="function"?$({isActive:ot,isPending:st}):$)});var DataRouterHook;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmitImpl="useSubmitImpl",e.UseFetcher="useFetcher"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(e){e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useLinkClickHandler(e,i){let{target:o,replace:a,state:s,preventScrollReset:c,relative:d}=i===void 0?{}:i,h=useNavigate(),g=useLocation(),$=useResolvedPath(e,{relative:d});return reactExports.useCallback(b=>{if(shouldProcessLinkClick(b,o)){b.preventDefault();let et=a!==void 0?a:createPath(g)===createPath($);h(e,{replace:et,state:s,preventScrollReset:c,relative:d})}},[g,h,$,a,s,o,e,c,d])}var client={},reactDomExports={},reactDom={get exports(){return reactDomExports},set exports(e){reactDomExports=e}},reactDom_production_min={},schedulerExports={},scheduler={get exports(){return schedulerExports},set exports(e){schedulerExports=e}},scheduler_production_min={};/** - * @license React - * scheduler.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */(function(e){function i(Ft,kt){var Lt=Ft.length;Ft.push(kt);e:for(;0>>1,Gt=Ft[Vt];if(0>>1;Vts(pn,Lt))ens(an,pn)?(Ft[Vt]=an,Ft[en]=Lt,Vt=en):(Ft[Vt]=pn,Ft[un]=Lt,Vt=un);else if(ens(an,Lt))Ft[Vt]=an,Ft[en]=Lt,Vt=en;else break e}}return kt}function s(Ft,kt){var Lt=Ft.sortIndex-kt.sortIndex;return Lt!==0?Lt:Ft.id-kt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var c=performance;e.unstable_now=function(){return c.now()}}else{var d=Date,h=d.now();e.unstable_now=function(){return d.now()-h}}var g=[],$=[],b=1,et=null,_e=3,nt=!1,lt=!1,it=!1,pt=typeof setTimeout=="function"?setTimeout:null,rt=typeof clearTimeout=="function"?clearTimeout:null,ot=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function st(Ft){for(var kt=o($);kt!==null;){if(kt.callback===null)a($);else if(kt.startTime<=Ft)a($),kt.sortIndex=kt.expirationTime,i(g,kt);else break;kt=o($)}}function ct(Ft){if(it=!1,st(Ft),!lt)if(o(g)!==null)lt=!0,Yt(ft);else{var kt=o($);kt!==null&&zt(ct,kt.startTime-Ft)}}function ft(Ft,kt){lt=!1,it&&(it=!1,rt($t),$t=-1),nt=!0;var Lt=_e;try{for(st(kt),et=o(g);et!==null&&(!(et.expirationTime>kt)||Ft&&!mt());){var Vt=et.callback;if(typeof Vt=="function"){et.callback=null,_e=et.priorityLevel;var Gt=Vt(et.expirationTime<=kt);kt=e.unstable_now(),typeof Gt=="function"?et.callback=Gt:et===o(g)&&a(g),st(kt)}else a(g);et=o(g)}if(et!==null)var on=!0;else{var un=o($);un!==null&&zt(ct,un.startTime-kt),on=!1}return on}finally{et=null,_e=Lt,nt=!1}}var wt=!1,xt=null,$t=-1,Dt=5,dt=-1;function mt(){return!(e.unstable_now()-dtFt||125Vt?(Ft.sortIndex=Lt,i($,Ft),o(g)===null&&Ft===o($)&&(it?(rt($t),$t=-1):it=!0,zt(ct,Lt-Vt))):(Ft.sortIndex=Gt,i(g,Ft),lt||nt||(lt=!0,Yt(ft))),Ft},e.unstable_shouldYield=mt,e.unstable_wrapCallback=function(Ft){var kt=_e;return function(){var Lt=_e;_e=kt;try{return Ft.apply(this,arguments)}finally{_e=Lt}}}})(scheduler_production_min);(function(e){e.exports=scheduler_production_min})(scheduler);/** - * @license React - * react-dom.production.min.js - * - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var aa=reactExports,ca=schedulerExports;function p(e){for(var i="https://reactjs.org/docs/error-decoder.html?invariant="+e,o=1;o"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ja=Object.prototype.hasOwnProperty,ka=/^[: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]*$/,la={},ma={};function oa(e){return ja.call(ma,e)?!0:ja.call(la,e)?!1:ka.test(e)?ma[e]=!0:(la[e]=!0,!1)}function pa(e,i,o,a){if(o!==null&&o.type===0)return!1;switch(typeof i){case"function":case"symbol":return!0;case"boolean":return a?!1:o!==null?!o.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function qa(e,i,o,a){if(i===null||typeof i>"u"||pa(e,i,o,a))return!0;if(a)return!1;if(o!==null)switch(o.type){case 3:return!i;case 4:return i===!1;case 5:return isNaN(i);case 6:return isNaN(i)||1>i}return!1}function v(e,i,o,a,s,c,d){this.acceptsBooleans=i===2||i===3||i===4,this.attributeName=a,this.attributeNamespace=s,this.mustUseProperty=o,this.propertyName=e,this.type=i,this.sanitizeURL=c,this.removeEmptyString=d}var z={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){z[e]=new v(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var i=e[0];z[i]=new v(i,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){z[e]=new v(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){z[e]=new v(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){z[e]=new v(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){z[e]=new v(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){z[e]=new v(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){z[e]=new v(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){z[e]=new v(e,5,!1,e.toLowerCase(),null,!1,!1)});var ra=/[\-:]([a-z])/g;function sa(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var i=e.replace(ra,sa);z[i]=new v(i,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var i=e.replace(ra,sa);z[i]=new v(i,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var i=e.replace(ra,sa);z[i]=new v(i,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){z[e]=new v(e,1,!1,e.toLowerCase(),null,!1,!1)});z.xlinkHref=new v("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){z[e]=new v(e,1,!1,e.toLowerCase(),null,!0,!0)});function ta(e,i,o,a){var s=z.hasOwnProperty(i)?z[i]:null;(s!==null?s.type!==0:a||!(2h||s[d]!==c[h]){var g=` -`+s[d].replace(" at new "," at ");return e.displayName&&g.includes("")&&(g=g.replace("",e.displayName)),g}while(1<=d&&0<=h);break}}}finally{Na=!1,Error.prepareStackTrace=o}return(e=e?e.displayName||e.name:"")?Ma(e):""}function Pa(e){switch(e.tag){case 5:return Ma(e.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return e=Oa(e.type,!1),e;case 11:return e=Oa(e.type.render,!1),e;case 1:return e=Oa(e.type,!0),e;default:return""}}function Qa(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case ya:return"Fragment";case wa:return"Portal";case Aa:return"Profiler";case za:return"StrictMode";case Ea:return"Suspense";case Fa:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case Ca:return(e.displayName||"Context")+".Consumer";case Ba:return(e._context.displayName||"Context")+".Provider";case Da:var i=e.render;return e=e.displayName,e||(e=i.displayName||i.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case Ga:return i=e.displayName||null,i!==null?i:Qa(e.type)||"Memo";case Ha:i=e._payload,e=e._init;try{return Qa(e(i))}catch{}}return null}function Ra(e){var i=e.type;switch(e.tag){case 24:return"Cache";case 9:return(i.displayName||"Context")+".Consumer";case 10:return(i._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=i.render,e=e.displayName||e.name||"",i.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return i;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(i);case 8:return i===za?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof i=="function")return i.displayName||i.name||null;if(typeof i=="string")return i}return null}function Sa(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Ta(e){var i=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(i==="checkbox"||i==="radio")}function Ua(e){var i=Ta(e)?"checked":"value",o=Object.getOwnPropertyDescriptor(e.constructor.prototype,i),a=""+e[i];if(!e.hasOwnProperty(i)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var s=o.get,c=o.set;return Object.defineProperty(e,i,{configurable:!0,get:function(){return s.call(this)},set:function(d){a=""+d,c.call(this,d)}}),Object.defineProperty(e,i,{enumerable:o.enumerable}),{getValue:function(){return a},setValue:function(d){a=""+d},stopTracking:function(){e._valueTracker=null,delete e[i]}}}}function Va(e){e._valueTracker||(e._valueTracker=Ua(e))}function Wa(e){if(!e)return!1;var i=e._valueTracker;if(!i)return!0;var o=i.getValue(),a="";return e&&(a=Ta(e)?e.checked?"true":"false":e.value),e=a,e!==o?(i.setValue(e),!0):!1}function Xa(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ya(e,i){var o=i.checked;return A({},i,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??e._wrapperState.initialChecked})}function Za(e,i){var o=i.defaultValue==null?"":i.defaultValue,a=i.checked!=null?i.checked:i.defaultChecked;o=Sa(i.value!=null?i.value:o),e._wrapperState={initialChecked:a,initialValue:o,controlled:i.type==="checkbox"||i.type==="radio"?i.checked!=null:i.value!=null}}function ab(e,i){i=i.checked,i!=null&&ta(e,"checked",i,!1)}function bb(e,i){ab(e,i);var o=Sa(i.value),a=i.type;if(o!=null)a==="number"?(o===0&&e.value===""||e.value!=o)&&(e.value=""+o):e.value!==""+o&&(e.value=""+o);else if(a==="submit"||a==="reset"){e.removeAttribute("value");return}i.hasOwnProperty("value")?cb(e,i.type,o):i.hasOwnProperty("defaultValue")&&cb(e,i.type,Sa(i.defaultValue)),i.checked==null&&i.defaultChecked!=null&&(e.defaultChecked=!!i.defaultChecked)}function db(e,i,o){if(i.hasOwnProperty("value")||i.hasOwnProperty("defaultValue")){var a=i.type;if(!(a!=="submit"&&a!=="reset"||i.value!==void 0&&i.value!==null))return;i=""+e._wrapperState.initialValue,o||i===e.value||(e.value=i),e.defaultValue=i}o=e.name,o!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,o!==""&&(e.name=o)}function cb(e,i,o){(i!=="number"||Xa(e.ownerDocument)!==e)&&(o==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+o&&(e.defaultValue=""+o))}var eb=Array.isArray;function fb(e,i,o,a){if(e=e.options,i){i={};for(var s=0;s"+i.valueOf().toString()+"",i=mb.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;i.firstChild;)e.appendChild(i.firstChild)}});function ob(e,i){if(i){var o=e.firstChild;if(o&&o===e.lastChild&&o.nodeType===3){o.nodeValue=i;return}}e.textContent=i}var pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(e){qb.forEach(function(i){i=i+e.charAt(0).toUpperCase()+e.substring(1),pb[i]=pb[e]})});function rb(e,i,o){return i==null||typeof i=="boolean"||i===""?"":o||typeof i!="number"||i===0||pb.hasOwnProperty(e)&&pb[e]?(""+i).trim():i+"px"}function sb(e,i){e=e.style;for(var o in i)if(i.hasOwnProperty(o)){var a=o.indexOf("--")===0,s=rb(o,i[o],a);o==="float"&&(o="cssFloat"),a?e.setProperty(o,s):e[o]=s}}var tb=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ub(e,i){if(i){if(tb[e]&&(i.children!=null||i.dangerouslySetInnerHTML!=null))throw Error(p(137,e));if(i.dangerouslySetInnerHTML!=null){if(i.children!=null)throw Error(p(60));if(typeof i.dangerouslySetInnerHTML!="object"||!("__html"in i.dangerouslySetInnerHTML))throw Error(p(61))}if(i.style!=null&&typeof i.style!="object")throw Error(p(62))}}function vb(e,i){if(e.indexOf("-")===-1)return typeof i.is=="string";switch(e){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 wb=null;function xb(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var yb=null,zb=null,Ab=null;function Bb(e){if(e=Cb(e)){if(typeof yb!="function")throw Error(p(280));var i=e.stateNode;i&&(i=Db(i),yb(e.stateNode,e.type,i))}}function Eb(e){zb?Ab?Ab.push(e):Ab=[e]:zb=e}function Fb(){if(zb){var e=zb,i=Ab;if(Ab=zb=null,Bb(e),i)for(e=0;e>>=0,e===0?32:31-(pc(e)/qc|0)|0}var rc=64,sc=4194304;function tc(e){switch(e&-e){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: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&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function uc(e,i){var o=e.pendingLanes;if(o===0)return 0;var a=0,s=e.suspendedLanes,c=e.pingedLanes,d=o&268435455;if(d!==0){var h=d&~s;h!==0?a=tc(h):(c&=d,c!==0&&(a=tc(c)))}else d=o&~s,d!==0?a=tc(d):c!==0&&(a=tc(c));if(a===0)return 0;if(i!==0&&i!==a&&!(i&s)&&(s=a&-a,c=i&-i,s>=c||s===16&&(c&4194240)!==0))return i;if(a&4&&(a|=o&16),i=e.entangledLanes,i!==0)for(e=e.entanglements,i&=a;0o;o++)i.push(e);return i}function Ac(e,i,o){e.pendingLanes|=i,i!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,i=31-oc(i),e[i]=o}function Bc(e,i){var o=e.pendingLanes&~i;e.pendingLanes=i,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=i,e.mutableReadLanes&=i,e.entangledLanes&=i,i=e.entanglements;var a=e.eventTimes;for(e=e.expirationTimes;0=be),ee=String.fromCharCode(32),fe=!1;function ge(e,i){switch(e){case"keyup":return $d.indexOf(i.keyCode)!==-1;case"keydown":return i.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ie=!1;function je(e,i){switch(e){case"compositionend":return he(i);case"keypress":return i.which!==32?null:(fe=!0,ee);case"textInput":return e=i.data,e===ee&&fe?null:e;default:return null}}function ke(e,i){if(ie)return e==="compositionend"||!ae&&ge(e,i)?(e=nd(),md=ld=kd=null,ie=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(i.ctrlKey||i.altKey||i.metaKey)||i.ctrlKey&&i.altKey){if(i.char&&1=i)return{node:o,offset:i-e};e=a}e:{for(;o;){if(o.nextSibling){o=o.nextSibling;break e}o=o.parentNode}o=void 0}o=Je(o)}}function Le(e,i){return e&&i?e===i?!0:e&&e.nodeType===3?!1:i&&i.nodeType===3?Le(e,i.parentNode):"contains"in e?e.contains(i):e.compareDocumentPosition?!!(e.compareDocumentPosition(i)&16):!1:!1}function Me(){for(var e=window,i=Xa();i instanceof e.HTMLIFrameElement;){try{var o=typeof i.contentWindow.location.href=="string"}catch{o=!1}if(o)e=i.contentWindow;else break;i=Xa(e.document)}return i}function Ne(e){var i=e&&e.nodeName&&e.nodeName.toLowerCase();return i&&(i==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||i==="textarea"||e.contentEditable==="true")}function Oe(e){var i=Me(),o=e.focusedElem,a=e.selectionRange;if(i!==o&&o&&o.ownerDocument&&Le(o.ownerDocument.documentElement,o)){if(a!==null&&Ne(o)){if(i=a.start,e=a.end,e===void 0&&(e=i),"selectionStart"in o)o.selectionStart=i,o.selectionEnd=Math.min(e,o.value.length);else if(e=(i=o.ownerDocument||document)&&i.defaultView||window,e.getSelection){e=e.getSelection();var s=o.textContent.length,c=Math.min(a.start,s);a=a.end===void 0?c:Math.min(a.end,s),!e.extend&&c>a&&(s=a,a=c,c=s),s=Ke(o,c);var d=Ke(o,a);s&&d&&(e.rangeCount!==1||e.anchorNode!==s.node||e.anchorOffset!==s.offset||e.focusNode!==d.node||e.focusOffset!==d.offset)&&(i=i.createRange(),i.setStart(s.node,s.offset),e.removeAllRanges(),c>a?(e.addRange(i),e.extend(d.node,d.offset)):(i.setEnd(d.node,d.offset),e.addRange(i)))}}for(i=[],e=o;e=e.parentNode;)e.nodeType===1&&i.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof o.focus=="function"&&o.focus(),o=0;o=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;function Ue(e,i,o){var a=o.window===o?o.document:o.nodeType===9?o:o.ownerDocument;Te||Qe==null||Qe!==Xa(a)||(a=Qe,"selectionStart"in a&&Ne(a)?a={start:a.selectionStart,end:a.selectionEnd}:(a=(a.ownerDocument&&a.ownerDocument.defaultView||window).getSelection(),a={anchorNode:a.anchorNode,anchorOffset:a.anchorOffset,focusNode:a.focusNode,focusOffset:a.focusOffset}),Se&&Ie(Se,a)||(Se=a,a=oe(Re,"onSelect"),0Tf||(e.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(e,i){Tf++,Sf[Tf]=e.current,e.current=i}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(e,i){var o=e.type.contextTypes;if(!o)return Vf;var a=e.stateNode;if(a&&a.__reactInternalMemoizedUnmaskedChildContext===i)return a.__reactInternalMemoizedMaskedChildContext;var s={},c;for(c in o)s[c]=i[c];return a&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=i,e.__reactInternalMemoizedMaskedChildContext=s),s}function Zf(e){return e=e.childContextTypes,e!=null}function $f(){E(Wf),E(H)}function ag(e,i,o){if(H.current!==Vf)throw Error(p(168));G(H,i),G(Wf,o)}function bg(e,i,o){var a=e.stateNode;if(i=i.childContextTypes,typeof a.getChildContext!="function")return o;a=a.getChildContext();for(var s in a)if(!(s in i))throw Error(p(108,Ra(e)||"Unknown",s));return A({},o,a)}function cg(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Vf,Xf=H.current,G(H,e),G(Wf,Wf.current),!0}function dg(e,i,o){var a=e.stateNode;if(!a)throw Error(p(169));o?(e=bg(e,i,Xf),a.__reactInternalMemoizedMergedChildContext=e,E(Wf),E(H),G(H,e)):E(Wf),G(Wf,o)}var eg=null,fg=!1,gg=!1;function hg(e){eg===null?eg=[e]:eg.push(e)}function ig(e){fg=!0,hg(e)}function jg(){if(!gg&&eg!==null){gg=!0;var e=0,i=C;try{var o=eg;for(C=1;e>=d,s-=d,rg=1<<32-oc(i)+s|o<$t?(Dt=xt,xt=null):Dt=xt.sibling;var dt=_e(rt,xt,st[$t],ct);if(dt===null){xt===null&&(xt=Dt);break}e&&xt&&dt.alternate===null&&i(rt,xt),ot=c(dt,ot,$t),wt===null?ft=dt:wt.sibling=dt,wt=dt,xt=Dt}if($t===st.length)return o(rt,xt),I&&tg(rt,$t),ft;if(xt===null){for(;$t$t?(Dt=xt,xt=null):Dt=xt.sibling;var mt=_e(rt,xt,dt.value,ct);if(mt===null){xt===null&&(xt=Dt);break}e&&xt&&mt.alternate===null&&i(rt,xt),ot=c(mt,ot,$t),wt===null?ft=mt:wt.sibling=mt,wt=mt,xt=Dt}if(dt.done)return o(rt,xt),I&&tg(rt,$t),ft;if(xt===null){for(;!dt.done;$t++,dt=st.next())dt=et(rt,dt.value,ct),dt!==null&&(ot=c(dt,ot,$t),wt===null?ft=dt:wt.sibling=dt,wt=dt);return I&&tg(rt,$t),ft}for(xt=a(rt,xt);!dt.done;$t++,dt=st.next())dt=nt(xt,rt,$t,dt.value,ct),dt!==null&&(e&&dt.alternate!==null&&xt.delete(dt.key===null?$t:dt.key),ot=c(dt,ot,$t),wt===null?ft=dt:wt.sibling=dt,wt=dt);return e&&xt.forEach(function(Ct){return i(rt,Ct)}),I&&tg(rt,$t),ft}function pt(rt,ot,st,ct){if(typeof st=="object"&&st!==null&&st.type===ya&&st.key===null&&(st=st.props.children),typeof st=="object"&&st!==null){switch(st.$$typeof){case va:e:{for(var ft=st.key,wt=ot;wt!==null;){if(wt.key===ft){if(ft=st.type,ft===ya){if(wt.tag===7){o(rt,wt.sibling),ot=s(wt,st.props.children),ot.return=rt,rt=ot;break e}}else if(wt.elementType===ft||typeof ft=="object"&&ft!==null&&ft.$$typeof===Ha&&uh(ft)===wt.type){o(rt,wt.sibling),ot=s(wt,st.props),ot.ref=sh(rt,wt,st),ot.return=rt,rt=ot;break e}o(rt,wt);break}else i(rt,wt);wt=wt.sibling}st.type===ya?(ot=Ah(st.props.children,rt.mode,ct,st.key),ot.return=rt,rt=ot):(ct=yh(st.type,st.key,st.props,null,rt.mode,ct),ct.ref=sh(rt,ot,st),ct.return=rt,rt=ct)}return d(rt);case wa:e:{for(wt=st.key;ot!==null;){if(ot.key===wt)if(ot.tag===4&&ot.stateNode.containerInfo===st.containerInfo&&ot.stateNode.implementation===st.implementation){o(rt,ot.sibling),ot=s(ot,st.children||[]),ot.return=rt,rt=ot;break e}else{o(rt,ot);break}else i(rt,ot);ot=ot.sibling}ot=zh(st,rt.mode,ct),ot.return=rt,rt=ot}return d(rt);case Ha:return wt=st._init,pt(rt,ot,wt(st._payload),ct)}if(eb(st))return lt(rt,ot,st,ct);if(Ka(st))return it(rt,ot,st,ct);th(rt,st)}return typeof st=="string"&&st!==""||typeof st=="number"?(st=""+st,ot!==null&&ot.tag===6?(o(rt,ot.sibling),ot=s(ot,st),ot.return=rt,rt=ot):(o(rt,ot),ot=xh(st,rt.mode,ct),ot.return=rt,rt=ot),d(rt)):o(rt,ot)}return pt}var Bh=vh(!0),Ch=vh(!1),Dh={},Eh=Uf(Dh),Fh=Uf(Dh),Gh=Uf(Dh);function Hh(e){if(e===Dh)throw Error(p(174));return e}function Ih(e,i){switch(G(Gh,i),G(Fh,e),G(Eh,Dh),e=i.nodeType,e){case 9:case 11:i=(i=i.documentElement)?i.namespaceURI:lb(null,"");break;default:e=e===8?i.parentNode:i,i=e.namespaceURI||null,e=e.tagName,i=lb(i,e)}E(Eh),G(Eh,i)}function Jh(){E(Eh),E(Fh),E(Gh)}function Kh(e){Hh(Gh.current);var i=Hh(Eh.current),o=lb(i,e.type);i!==o&&(G(Fh,e),G(Eh,o))}function Lh(e){Fh.current===e&&(E(Eh),E(Fh))}var M=Uf(0);function Mh(e){for(var i=e;i!==null;){if(i.tag===13){var o=i.memoizedState;if(o!==null&&(o=o.dehydrated,o===null||o.data==="$?"||o.data==="$!"))return i}else if(i.tag===19&&i.memoizedProps.revealOrder!==void 0){if(i.flags&128)return i}else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===e)break;for(;i.sibling===null;){if(i.return===null||i.return===e)return null;i=i.return}i.sibling.return=i.return,i=i.sibling}return null}var Nh=[];function Oh(){for(var e=0;eo?o:4,e(!0);var a=Qh.transition;Qh.transition={};try{e(!1),i()}finally{C=o,Qh.transition=a}}function Fi(){return di().memoizedState}function Gi(e,i,o){var a=lh(e);if(o={lane:a,action:o,hasEagerState:!1,eagerState:null,next:null},Hi(e))Ii(i,o);else if(o=Yg(e,i,o,a),o!==null){var s=L();mh(o,e,a,s),Ji(o,i,a)}}function ri(e,i,o){var a=lh(e),s={lane:a,action:o,hasEagerState:!1,eagerState:null,next:null};if(Hi(e))Ii(i,s);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=i.lastRenderedReducer,c!==null))try{var d=i.lastRenderedState,h=c(d,o);if(s.hasEagerState=!0,s.eagerState=h,He(h,d)){var g=i.interleaved;g===null?(s.next=s,Xg(i)):(s.next=g.next,g.next=s),i.interleaved=s;return}}catch{}finally{}o=Yg(e,i,s,a),o!==null&&(s=L(),mh(o,e,a,s),Ji(o,i,a))}}function Hi(e){var i=e.alternate;return e===N||i!==null&&i===N}function Ii(e,i){Th=Sh=!0;var o=e.pending;o===null?i.next=i:(i.next=o.next,o.next=i),e.pending=i}function Ji(e,i,o){if(o&4194240){var a=i.lanes;a&=e.pendingLanes,o|=a,i.lanes=o,Cc(e,o)}}var ai={readContext:Vg,useCallback:Q,useContext:Q,useEffect:Q,useImperativeHandle:Q,useInsertionEffect:Q,useLayoutEffect:Q,useMemo:Q,useReducer:Q,useRef:Q,useState:Q,useDebugValue:Q,useDeferredValue:Q,useTransition:Q,useMutableSource:Q,useSyncExternalStore:Q,useId:Q,unstable_isNewReconciler:!1},Yh={readContext:Vg,useCallback:function(e,i){return ci().memoizedState=[e,i===void 0?null:i],e},useContext:Vg,useEffect:vi,useImperativeHandle:function(e,i,o){return o=o!=null?o.concat([e]):null,ti(4194308,4,yi.bind(null,i,e),o)},useLayoutEffect:function(e,i){return ti(4194308,4,e,i)},useInsertionEffect:function(e,i){return ti(4,2,e,i)},useMemo:function(e,i){var o=ci();return i=i===void 0?null:i,e=e(),o.memoizedState=[e,i],e},useReducer:function(e,i,o){var a=ci();return i=o!==void 0?o(i):i,a.memoizedState=a.baseState=i,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},a.queue=e,e=e.dispatch=Gi.bind(null,N,e),[a.memoizedState,e]},useRef:function(e){var i=ci();return e={current:e},i.memoizedState=e},useState:qi,useDebugValue:Ai,useDeferredValue:function(e){return ci().memoizedState=e},useTransition:function(){var e=qi(!1),i=e[0];return e=Ei.bind(null,e[1]),ci().memoizedState=e,[i,e]},useMutableSource:function(){},useSyncExternalStore:function(e,i,o){var a=N,s=ci();if(I){if(o===void 0)throw Error(p(407));o=o()}else{if(o=i(),R===null)throw Error(p(349));Rh&30||ni(a,i,o)}s.memoizedState=o;var c={value:o,getSnapshot:i};return s.queue=c,vi(ki.bind(null,a,c,e),[e]),a.flags|=2048,li(9,mi.bind(null,a,c,o,i),void 0,null),o},useId:function(){var e=ci(),i=R.identifierPrefix;if(I){var o=sg,a=rg;o=(a&~(1<<32-oc(a)-1)).toString(32)+o,i=":"+i+"R"+o,o=Uh++,0<\/script>",e=e.removeChild(e.firstChild)):typeof a.is=="string"?e=d.createElement(o,{is:a.is}):(e=d.createElement(o),o==="select"&&(d=e,a.multiple?d.multiple=!0:a.size&&(d.size=a.size))):e=d.createElementNS(e,o),e[Of]=i,e[Pf]=a,Aj(e,i,!1,!1),i.stateNode=e;e:{switch(d=vb(o,a),o){case"dialog":D("cancel",e),D("close",e),s=a;break;case"iframe":case"object":case"embed":D("load",e),s=a;break;case"video":case"audio":for(s=0;sHj&&(i.flags|=128,a=!0,Ej(c,!1),i.lanes=4194304)}else{if(!a)if(e=Mh(d),e!==null){if(i.flags|=128,a=!0,o=e.updateQueue,o!==null&&(i.updateQueue=o,i.flags|=4),Ej(c,!0),c.tail===null&&c.tailMode==="hidden"&&!d.alternate&&!I)return S(i),null}else 2*B()-c.renderingStartTime>Hj&&o!==1073741824&&(i.flags|=128,a=!0,Ej(c,!1),i.lanes=4194304);c.isBackwards?(d.sibling=i.child,i.child=d):(o=c.last,o!==null?o.sibling=d:i.child=d,c.last=d)}return c.tail!==null?(i=c.tail,c.rendering=i,c.tail=i.sibling,c.renderingStartTime=B(),i.sibling=null,o=M.current,G(M,a?o&1|2:o&1),i):(S(i),null);case 22:case 23:return Ij(),a=i.memoizedState!==null,e!==null&&e.memoizedState!==null!==a&&(i.flags|=8192),a&&i.mode&1?gj&1073741824&&(S(i),i.subtreeFlags&6&&(i.flags|=8192)):S(i),null;case 24:return null;case 25:return null}throw Error(p(156,i.tag))}function Jj(e,i){switch(wg(i),i.tag){case 1:return Zf(i.type)&&$f(),e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 3:return Jh(),E(Wf),E(H),Oh(),e=i.flags,e&65536&&!(e&128)?(i.flags=e&-65537|128,i):null;case 5:return Lh(i),null;case 13:if(E(M),e=i.memoizedState,e!==null&&e.dehydrated!==null){if(i.alternate===null)throw Error(p(340));Ig()}return e=i.flags,e&65536?(i.flags=e&-65537|128,i):null;case 19:return E(M),null;case 4:return Jh(),null;case 10:return Rg(i.type._context),null;case 22:case 23:return Ij(),null;case 24:return null;default:return null}}var Kj=!1,U=!1,Lj=typeof WeakSet=="function"?WeakSet:Set,V=null;function Mj(e,i){var o=e.ref;if(o!==null)if(typeof o=="function")try{o(null)}catch(a){W(e,i,a)}else o.current=null}function Nj(e,i,o){try{o()}catch(a){W(e,i,a)}}var Oj=!1;function Pj(e,i){if(Cf=dd,e=Me(),Ne(e)){if("selectionStart"in e)var o={start:e.selectionStart,end:e.selectionEnd};else e:{o=(o=e.ownerDocument)&&o.defaultView||window;var a=o.getSelection&&o.getSelection();if(a&&a.rangeCount!==0){o=a.anchorNode;var s=a.anchorOffset,c=a.focusNode;a=a.focusOffset;try{o.nodeType,c.nodeType}catch{o=null;break e}var d=0,h=-1,g=-1,$=0,b=0,et=e,_e=null;t:for(;;){for(var nt;et!==o||s!==0&&et.nodeType!==3||(h=d+s),et!==c||a!==0&&et.nodeType!==3||(g=d+a),et.nodeType===3&&(d+=et.nodeValue.length),(nt=et.firstChild)!==null;)_e=et,et=nt;for(;;){if(et===e)break t;if(_e===o&&++$===s&&(h=d),_e===c&&++b===a&&(g=d),(nt=et.nextSibling)!==null)break;et=_e,_e=et.parentNode}et=nt}o=h===-1||g===-1?null:{start:h,end:g}}else o=null}o=o||{start:0,end:0}}else o=null;for(Df={focusedElem:e,selectionRange:o},dd=!1,V=i;V!==null;)if(i=V,e=i.child,(i.subtreeFlags&1028)!==0&&e!==null)e.return=i,V=e;else for(;V!==null;){i=V;try{var lt=i.alternate;if(i.flags&1024)switch(i.tag){case 0:case 11:case 15:break;case 1:if(lt!==null){var it=lt.memoizedProps,pt=lt.memoizedState,rt=i.stateNode,ot=rt.getSnapshotBeforeUpdate(i.elementType===i.type?it:Lg(i.type,it),pt);rt.__reactInternalSnapshotBeforeUpdate=ot}break;case 3:var st=i.stateNode.containerInfo;st.nodeType===1?st.textContent="":st.nodeType===9&&st.documentElement&&st.removeChild(st.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163))}}catch(ct){W(i,i.return,ct)}if(e=i.sibling,e!==null){e.return=i.return,V=e;break}V=i.return}return lt=Oj,Oj=!1,lt}function Qj(e,i,o){var a=i.updateQueue;if(a=a!==null?a.lastEffect:null,a!==null){var s=a=a.next;do{if((s.tag&e)===e){var c=s.destroy;s.destroy=void 0,c!==void 0&&Nj(i,o,c)}s=s.next}while(s!==a)}}function Rj(e,i){if(i=i.updateQueue,i=i!==null?i.lastEffect:null,i!==null){var o=i=i.next;do{if((o.tag&e)===e){var a=o.create;o.destroy=a()}o=o.next}while(o!==i)}}function Sj(e){var i=e.ref;if(i!==null){var o=e.stateNode;switch(e.tag){case 5:e=o;break;default:e=o}typeof i=="function"?i(e):i.current=e}}function Tj(e){var i=e.alternate;i!==null&&(e.alternate=null,Tj(i)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(i=e.stateNode,i!==null&&(delete i[Of],delete i[Pf],delete i[of],delete i[Qf],delete i[Rf])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function Uj(e){return e.tag===5||e.tag===3||e.tag===4}function Vj(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||Uj(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function Wj(e,i,o){var a=e.tag;if(a===5||a===6)e=e.stateNode,i?o.nodeType===8?o.parentNode.insertBefore(e,i):o.insertBefore(e,i):(o.nodeType===8?(i=o.parentNode,i.insertBefore(e,o)):(i=o,i.appendChild(e)),o=o._reactRootContainer,o!=null||i.onclick!==null||(i.onclick=Bf));else if(a!==4&&(e=e.child,e!==null))for(Wj(e,i,o),e=e.sibling;e!==null;)Wj(e,i,o),e=e.sibling}function Xj(e,i,o){var a=e.tag;if(a===5||a===6)e=e.stateNode,i?o.insertBefore(e,i):o.appendChild(e);else if(a!==4&&(e=e.child,e!==null))for(Xj(e,i,o),e=e.sibling;e!==null;)Xj(e,i,o),e=e.sibling}var X=null,Yj=!1;function Zj(e,i,o){for(o=o.child;o!==null;)ak(e,i,o),o=o.sibling}function ak(e,i,o){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,o)}catch{}switch(o.tag){case 5:U||Mj(o,i);case 6:var a=X,s=Yj;X=null,Zj(e,i,o),X=a,Yj=s,X!==null&&(Yj?(e=X,o=o.stateNode,e.nodeType===8?e.parentNode.removeChild(o):e.removeChild(o)):X.removeChild(o.stateNode));break;case 18:X!==null&&(Yj?(e=X,o=o.stateNode,e.nodeType===8?Kf(e.parentNode,o):e.nodeType===1&&Kf(e,o),bd(e)):Kf(X,o.stateNode));break;case 4:a=X,s=Yj,X=o.stateNode.containerInfo,Yj=!0,Zj(e,i,o),X=a,Yj=s;break;case 0:case 11:case 14:case 15:if(!U&&(a=o.updateQueue,a!==null&&(a=a.lastEffect,a!==null))){s=a=a.next;do{var c=s,d=c.destroy;c=c.tag,d!==void 0&&(c&2||c&4)&&Nj(o,i,d),s=s.next}while(s!==a)}Zj(e,i,o);break;case 1:if(!U&&(Mj(o,i),a=o.stateNode,typeof a.componentWillUnmount=="function"))try{a.props=o.memoizedProps,a.state=o.memoizedState,a.componentWillUnmount()}catch(h){W(o,i,h)}Zj(e,i,o);break;case 21:Zj(e,i,o);break;case 22:o.mode&1?(U=(a=U)||o.memoizedState!==null,Zj(e,i,o),U=a):Zj(e,i,o);break;default:Zj(e,i,o)}}function bk(e){var i=e.updateQueue;if(i!==null){e.updateQueue=null;var o=e.stateNode;o===null&&(o=e.stateNode=new Lj),i.forEach(function(a){var s=ck.bind(null,e,a);o.has(a)||(o.add(a),a.then(s,s))})}}function dk(e,i){var o=i.deletions;if(o!==null)for(var a=0;as&&(s=d),a&=~c}if(a=s,a=B()-a,a=(120>a?120:480>a?480:1080>a?1080:1920>a?1920:3e3>a?3e3:4320>a?4320:1960*mk(a/1960))-a,10e?16:e,xk===null)var a=!1;else{if(e=xk,xk=null,yk=0,K&6)throw Error(p(331));var s=K;for(K|=4,V=e.current;V!==null;){var c=V,d=c.child;if(V.flags&16){var h=c.deletions;if(h!==null){for(var g=0;gB()-gk?Lk(e,0):sk|=o),Ek(e,i)}function Zk(e,i){i===0&&(e.mode&1?(i=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):i=1);var o=L();e=Zg(e,i),e!==null&&(Ac(e,i,o),Ek(e,o))}function vj(e){var i=e.memoizedState,o=0;i!==null&&(o=i.retryLane),Zk(e,o)}function ck(e,i){var o=0;switch(e.tag){case 13:var a=e.stateNode,s=e.memoizedState;s!==null&&(o=s.retryLane);break;case 19:a=e.stateNode;break;default:throw Error(p(314))}a!==null&&a.delete(i),Zk(e,o)}var Wk;Wk=function(e,i,o){if(e!==null)if(e.memoizedProps!==i.pendingProps||Wf.current)Ug=!0;else{if(!(e.lanes&o)&&!(i.flags&128))return Ug=!1,zj(e,i,o);Ug=!!(e.flags&131072)}else Ug=!1,I&&i.flags&1048576&&ug(i,ng,i.index);switch(i.lanes=0,i.tag){case 2:var a=i.type;jj(e,i),e=i.pendingProps;var s=Yf(i,H.current);Tg(i,o),s=Xh(null,i,a,e,s,o);var c=bi();return i.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(i.tag=1,i.memoizedState=null,i.updateQueue=null,Zf(a)?(c=!0,cg(i)):c=!1,i.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,ah(i),s.updater=nh,i.stateNode=s,s._reactInternals=i,rh(i,a,e,o),i=kj(null,i,a,!0,c,o)):(i.tag=0,I&&c&&vg(i),Yi(null,i,s,o),i=i.child),i;case 16:a=i.elementType;e:{switch(jj(e,i),e=i.pendingProps,s=a._init,a=s(a._payload),i.type=a,s=i.tag=$k(a),e=Lg(a,e),s){case 0:i=dj(null,i,a,e,o);break e;case 1:i=ij(null,i,a,e,o);break e;case 11:i=Zi(null,i,a,e,o);break e;case 14:i=aj(null,i,a,Lg(a.type,e),o);break e}throw Error(p(306,a,""))}return i;case 0:return a=i.type,s=i.pendingProps,s=i.elementType===a?s:Lg(a,s),dj(e,i,a,s,o);case 1:return a=i.type,s=i.pendingProps,s=i.elementType===a?s:Lg(a,s),ij(e,i,a,s,o);case 3:e:{if(lj(i),e===null)throw Error(p(387));a=i.pendingProps,c=i.memoizedState,s=c.element,bh(e,i),gh(i,a,null,o);var d=i.memoizedState;if(a=d.element,c.isDehydrated)if(c={element:a,isDehydrated:!1,cache:d.cache,pendingSuspenseBoundaries:d.pendingSuspenseBoundaries,transitions:d.transitions},i.updateQueue.baseState=c,i.memoizedState=c,i.flags&256){s=Ki(Error(p(423)),i),i=mj(e,i,a,o,s);break e}else if(a!==s){s=Ki(Error(p(424)),i),i=mj(e,i,a,o,s);break e}else for(yg=Lf(i.stateNode.containerInfo.firstChild),xg=i,I=!0,zg=null,o=Ch(i,null,a,o),i.child=o;o;)o.flags=o.flags&-3|4096,o=o.sibling;else{if(Ig(),a===s){i=$i(e,i,o);break e}Yi(e,i,a,o)}i=i.child}return i;case 5:return Kh(i),e===null&&Eg(i),a=i.type,s=i.pendingProps,c=e!==null?e.memoizedProps:null,d=s.children,Ef(a,s)?d=null:c!==null&&Ef(a,c)&&(i.flags|=32),hj(e,i),Yi(e,i,d,o),i.child;case 6:return e===null&&Eg(i),null;case 13:return pj(e,i,o);case 4:return Ih(i,i.stateNode.containerInfo),a=i.pendingProps,e===null?i.child=Bh(i,null,a,o):Yi(e,i,a,o),i.child;case 11:return a=i.type,s=i.pendingProps,s=i.elementType===a?s:Lg(a,s),Zi(e,i,a,s,o);case 7:return Yi(e,i,i.pendingProps,o),i.child;case 8:return Yi(e,i,i.pendingProps.children,o),i.child;case 12:return Yi(e,i,i.pendingProps.children,o),i.child;case 10:e:{if(a=i.type._context,s=i.pendingProps,c=i.memoizedProps,d=s.value,G(Mg,a._currentValue),a._currentValue=d,c!==null)if(He(c.value,d)){if(c.children===s.children&&!Wf.current){i=$i(e,i,o);break e}}else for(c=i.child,c!==null&&(c.return=i);c!==null;){var h=c.dependencies;if(h!==null){d=c.child;for(var g=h.firstContext;g!==null;){if(g.context===a){if(c.tag===1){g=ch(-1,o&-o),g.tag=2;var $=c.updateQueue;if($!==null){$=$.shared;var b=$.pending;b===null?g.next=g:(g.next=b.next,b.next=g),$.pending=g}}c.lanes|=o,g=c.alternate,g!==null&&(g.lanes|=o),Sg(c.return,o,i),h.lanes|=o;break}g=g.next}}else if(c.tag===10)d=c.type===i.type?null:c.child;else if(c.tag===18){if(d=c.return,d===null)throw Error(p(341));d.lanes|=o,h=d.alternate,h!==null&&(h.lanes|=o),Sg(d,o,i),d=c.sibling}else d=c.child;if(d!==null)d.return=c;else for(d=c;d!==null;){if(d===i){d=null;break}if(c=d.sibling,c!==null){c.return=d.return,d=c;break}d=d.return}c=d}Yi(e,i,s.children,o),i=i.child}return i;case 9:return s=i.type,a=i.pendingProps.children,Tg(i,o),s=Vg(s),a=a(s),i.flags|=1,Yi(e,i,a,o),i.child;case 14:return a=i.type,s=Lg(a,i.pendingProps),s=Lg(a.type,s),aj(e,i,a,s,o);case 15:return cj(e,i,i.type,i.pendingProps,o);case 17:return a=i.type,s=i.pendingProps,s=i.elementType===a?s:Lg(a,s),jj(e,i),i.tag=1,Zf(a)?(e=!0,cg(i)):e=!1,Tg(i,o),ph(i,a,s),rh(i,a,s,o),kj(null,i,a,!0,e,o);case 19:return yj(e,i,o);case 22:return ej(e,i,o)}throw Error(p(156,i.tag))};function Gk(e,i){return ac(e,i)}function al(e,i,o,a){this.tag=e,this.key=o,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=i,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=a,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(e,i,o,a){return new al(e,i,o,a)}function bj(e){return e=e.prototype,!(!e||!e.isReactComponent)}function $k(e){if(typeof e=="function")return bj(e)?1:0;if(e!=null){if(e=e.$$typeof,e===Da)return 11;if(e===Ga)return 14}return 2}function wh(e,i){var o=e.alternate;return o===null?(o=Bg(e.tag,i,e.key,e.mode),o.elementType=e.elementType,o.type=e.type,o.stateNode=e.stateNode,o.alternate=e,e.alternate=o):(o.pendingProps=i,o.type=e.type,o.flags=0,o.subtreeFlags=0,o.deletions=null),o.flags=e.flags&14680064,o.childLanes=e.childLanes,o.lanes=e.lanes,o.child=e.child,o.memoizedProps=e.memoizedProps,o.memoizedState=e.memoizedState,o.updateQueue=e.updateQueue,i=e.dependencies,o.dependencies=i===null?null:{lanes:i.lanes,firstContext:i.firstContext},o.sibling=e.sibling,o.index=e.index,o.ref=e.ref,o}function yh(e,i,o,a,s,c){var d=2;if(a=e,typeof e=="function")bj(e)&&(d=1);else if(typeof e=="string")d=5;else e:switch(e){case ya:return Ah(o.children,s,c,i);case za:d=8,s|=8;break;case Aa:return e=Bg(12,o,i,s|2),e.elementType=Aa,e.lanes=c,e;case Ea:return e=Bg(13,o,i,s),e.elementType=Ea,e.lanes=c,e;case Fa:return e=Bg(19,o,i,s),e.elementType=Fa,e.lanes=c,e;case Ia:return qj(o,s,c,i);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case Ba:d=10;break e;case Ca:d=9;break e;case Da:d=11;break e;case Ga:d=14;break e;case Ha:d=16,a=null;break e}throw Error(p(130,e==null?e:typeof e,""))}return i=Bg(d,o,i,s),i.elementType=e,i.type=a,i.lanes=c,i}function Ah(e,i,o,a){return e=Bg(7,e,a,i),e.lanes=o,e}function qj(e,i,o,a){return e=Bg(22,e,a,i),e.elementType=Ia,e.lanes=o,e.stateNode={isHidden:!1},e}function xh(e,i,o){return e=Bg(6,e,null,i),e.lanes=o,e}function zh(e,i,o){return i=Bg(4,e.children!==null?e.children:[],e.key,i),i.lanes=o,i.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},i}function bl(e,i,o,a,s){this.tag=i,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zc(0),this.expirationTimes=zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.identifierPrefix=a,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function cl(e,i,o,a,s,c,d,h,g){return e=new bl(e,i,o,h,g),i===1?(i=1,c===!0&&(i|=8)):i=0,c=Bg(3,null,null,i),e.current=c,c.stateNode=e,c.memoizedState={element:a,isDehydrated:o,cache:null,transitions:null,pendingSuspenseBoundaries:null},ah(c),e}function dl(e,i,o){var a=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(o){console.error(o)}}i(),e.exports=reactDom_production_min})(reactDom);var m=reactDomExports;client.createRoot=m.createRoot,client.hydrateRoot=m.hydrateRoot;const App$1="",navLinkClass=({isActive:e,isPending:i})=>e?"active":i?"pending":"";function App(){return jsxRuntimeExports.jsxs("div",{className:"App",children:[jsxRuntimeExports.jsxs("div",{className:"flex-row nav",children:[jsxRuntimeExports.jsx("div",{className:"nav-item",children:jsxRuntimeExports.jsx(NavLink,{className:navLinkClass,to:"draw/evaporating-cloud",children:"Evaporating Cloud"})}),"| ",jsxRuntimeExports.jsx("div",{className:"nav-item",children:jsxRuntimeExports.jsx(NavLink,{className:navLinkClass,to:"draw/goal-tree",children:"Goal Tree"})}),"| ",jsxRuntimeExports.jsx("div",{className:"nav-item",children:jsxRuntimeExports.jsx(NavLink,{className:navLinkClass,to:"draw/problem-tree",children:"Problem Tree"})}),"| ",jsxRuntimeExports.jsx("div",{className:"nav-item",children:jsxRuntimeExports.jsx(NavLink,{className:navLinkClass,to:"about",children:"About"})})]}),jsxRuntimeExports.jsx(Outlet,{})]})}const index="";function ErrorPage(){const e=useRouteError();return console.error(e),jsxRuntimeExports.jsxs("div",{id:"error-page",children:[jsxRuntimeExports.jsx("h1",{children:"Oops!"}),jsxRuntimeExports.jsx("p",{children:"Sorry, an unexpected error has occurred."}),jsxRuntimeExports.jsx("p",{children:jsxRuntimeExports.jsx("i",{children:e.statusText||e.message})})]})}const Editor=({onChange:e,placeholder:i="",rows:o=20,disabled:a=!1,autoFocus:s=!1,text:c,setText:d,error:h})=>{React.useEffect(()=>{e(c)},[c]);const g=$=>{d($.target.value),e($.target.value)};return jsxRuntimeExports.jsxs("div",{className:"editor",children:[jsxRuntimeExports.jsx("textarea",{style:{width:"100%",height:"100%",resize:"none"},rows:o,value:c,onChange:g,placeholder:i,disabled:a,autoFocus:s}),jsxRuntimeExports.jsx("p",{className:`edit-result ${h?"error":""}`,children:h})]})},wrapLines=(e,i)=>{const o=e.split(" "),a=[];let s="";return o.forEach((c,d)=>{s.length+c.length>i&&(a.push(s),s=""),s+=c+" ",d===o.length-1&&a.push(s)}),a};function computeResizeTransform(e,i,o,a){const s=e.getBBox({stroke:!0,fill:!0,markers:!0}),c=s.width+o,d=s.height+a;console.log("bounding h w: ",d,c);const h=i.clientWidth,g=i.clientHeight;console.log("container h w: ",g,h);const $=Math.min(100/c,100/d);return console.log("zoomScale: ",$),`scale(${$},${$})`}function saveSvgUrl(e){const i=e.outerHTML,o=`\r -`,a=new Blob([o,i],{type:"image/svg+xml;charset=utf-8"});return URL.createObjectURL(a)}const intermediatePoint=(e,i,o)=>{const a=i.x-e.x,s=i.y-e.y,c=Math.sqrt(a*a+s*s),d=o/c;return{x:e.x+a*d,y:e.y+s*d}},CloudNode=({text:e,x:i,y:o,width:a,height:s,annotation:c})=>{const d=wrapLines(e,20),h=16,g=12,$=d.length*h,b=o+s/2-$/2-4,et=i+g;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("rect",{x:i,y:o,rx:"10",ry:"10",width:a,height:s}),jsxRuntimeExports.jsx("text",{x:et,y:b,children:d.map((_e,nt)=>jsxRuntimeExports.jsx("tspan",{x:et,dy:h,children:_e},nt))}),jsxRuntimeExports.jsx("circle",{cx:i,cy:o,r:"10",style:{fill:"white",stroke:"black",strokeWidth:"2px"}}),jsxRuntimeExports.jsx("text",{x:i-4,y:o+4,children:c})]})},CloudEdge=({edge:e})=>jsxRuntimeExports.jsx("line",{x1:e.adjStart.x,y1:e.adjStart.y,x2:e.end.x,y2:e.end.y,stroke:"#000",strokeWidth:"3",markerStart:"url(#startarrow)"}),Injection=({text:e,edge:i,dx:o,dy:a})=>{if(!e)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{});const s=wrapLines(e,35),c=midPoint(i.start,i.end),d=16,h=c.x+o,g=h-75,$=c.y+a,b=a/Math.abs(a),et=$+s.length*d+7,nt=b===1?$:et,lt=h;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("text",{x:g,y:$,children:s.map((it,pt)=>jsxRuntimeExports.jsx("tspan",{x:g,dy:d,children:it},pt))}),jsxRuntimeExports.jsx("line",{x1:lt,y1:nt,x2:c.x,y2:c.y,stroke:"#000",strokeDasharray:"4 5",strokeWidth:"2"})]})};function Cloud({ast:e,setSvgElem:i}){const o={A:"",B:"",C:"",D:"","D'":""},a=new Map;e&&(e.statements.filter(Ct=>Ct.type==="label").forEach(Ct=>{o[Ct.id]=Ct.text}),e.statements.forEach(Ct=>{if(Ct.type==="edgeLabel"){const St=Ct.id1`${Ct.x},${Ct.y}`).join(" ");React.useEffect(()=>{const Ct=document.getElementById("cloudSvgInner"),St=document.getElementById("cloudSvgContainer");Ct==null||Ct.setAttribute("transform",computeResizeTransform(Ct,St,10,0)+", translate(-10, 0)"),i(document.getElementById("cloudSvg"))},[e]);const mt=` - svg { - font-family: "trebuchet ms", verdana, arial, sans-serif; - font-size: 13px; - } - svg text { - fill: black; - } - svg text.annotation { - font-weight: bold; - } - svg rect { - fill: white; - stroke: black; - stroke-width: 2; - } - `;return jsxRuntimeExports.jsx("div",{id:"cloudSvgContainer",style:{width:"100%",height:"500"},children:jsxRuntimeExports.jsxs("svg",{id:"cloudSvg",width:"100%",height:"100%",version:"1.1",preserveAspectRatio:"xMinYMin",viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("style",{children:mt}),jsxRuntimeExports.jsxs("g",{id:"cloudSvgInner",children:[jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsx("marker",{id:"arrowhead",markerWidth:"10",markerHeight:"7",refX:"0",refY:"1.75",orient:"auto",children:jsxRuntimeExports.jsx("polygon",{points:"0 0, 10 3.5, 0 7",transform:"scale(0.5 0.5)"})}),jsxRuntimeExports.jsx("marker",{id:"startarrow",markerWidth:"10",markerHeight:"7",refX:"5",refY:"1.75",orient:"auto",children:jsxRuntimeExports.jsx("polygon",{points:"10 0, 10 7, 0 3.5",fill:"",transform:"scale(0.5 0.5)"})}),jsxRuntimeExports.jsx("marker",{id:"endarrow",markerWidth:"10",markerHeight:"7",refX:"0",refY:"1.75",orient:"auto",markerUnits:"strokeWidth",children:jsxRuntimeExports.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"",transform:"scale(0.5 0.5)"})})]}),jsxRuntimeExports.jsx(CloudNode,{annotation:"A",text:o.A,x:_e.x,y:_e.y,width:b,height:et}),jsxRuntimeExports.jsx(CloudNode,{annotation:"B",text:o.B,x:nt.x,y:nt.y,width:b,height:et}),jsxRuntimeExports.jsx(CloudNode,{annotation:"C",text:o.C,x:lt.x,y:lt.y,width:b,height:et}),jsxRuntimeExports.jsx(CloudNode,{annotation:"D",text:o.D,x:it.x,y:it.y,width:b,height:et}),jsxRuntimeExports.jsx(CloudNode,{annotation:"D'",text:o["D'"],x:pt.x,y:pt.y,width:b,height:et}),jsxRuntimeExports.jsx(CloudEdge,{edge:rt}),jsxRuntimeExports.jsx(CloudEdge,{edge:ot}),jsxRuntimeExports.jsx(CloudEdge,{edge:st}),jsxRuntimeExports.jsx(CloudEdge,{edge:ct}),jsxRuntimeExports.jsx(Injection,{text:a["A-B"],edge:rt,dx:-100,dy:-125}),jsxRuntimeExports.jsx(Injection,{text:a["A-C"],edge:ot,dx:-100,dy:125}),jsxRuntimeExports.jsx(Injection,{text:a["B-D"],edge:st,dx:0,dy:-75}),jsxRuntimeExports.jsx(Injection,{text:a["C-D'"],edge:ct,dx:0,dy:75}),jsxRuntimeExports.jsx(Injection,{text:a["D-D'"],edge:Dt,dx:120,dy:20}),jsxRuntimeExports.jsx("polyline",{points:dt,markerStart:"url(#startarrow)",markerEnd:"url(#endarrow)",style:{fill:"none",stroke:"black",strokeWidth:3}})]})]})})}function createEdge(e,i){const o={start:{x:e.x+e.w,y:e.y+e.h/2},adjStart:{x:0,y:0},end:{x:i.x,y:i.y+i.h/2}};return o.adjStart=intermediatePoint(o.start,o.end,16),o}function nodeBottomCenterPont(e){return{x:e.x+e.w/2,y:e.y+e.h}}function nodeTopCenterPont(e){return{x:e.x+e.w/2,y:e.y}}function midPoint(e,i){return{x:(e.x+i.x)/2,y:(e.y+i.y)/2}}function displacePoint(e,i,o){return{x:e.x+i,y:e.y+o}}var noop$1={value:()=>{}};function dispatch(){for(var e=0,i=arguments.length,o={},a;e=0&&(a=o.slice(s+1),o=o.slice(0,s)),o&&!i.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:a}})}Dispatch.prototype=dispatch.prototype={constructor:Dispatch,on:function(e,i){var o=this._,a=parseTypenames$1(e+"",o),s,c=-1,d=a.length;if(arguments.length<2){for(;++c0)for(var o=new Array(s),a=0,s,c;a=0&&(i=e.slice(0,o))!=="xmlns"&&(e=e.slice(o+1)),namespaces.hasOwnProperty(i)?{space:namespaces[i],local:e}:e}function creatorInherit(e){return function(){var i=this.ownerDocument,o=this.namespaceURI;return o===xhtml&&i.documentElement.namespaceURI===xhtml?i.createElement(e):i.createElementNS(o,e)}}function creatorFixed(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function creator(e){var i=namespace(e);return(i.local?creatorFixed:creatorInherit)(i)}function none(){}function selector(e){return e==null?none:function(){return this.querySelector(e)}}function selection_select(e){typeof e!="function"&&(e=selector(e));for(var i=this._groups,o=i.length,a=new Array(o),s=0;s=st&&(st=ot+1);!(ft=pt[st])&&++st=0;)(d=a[s])&&(c&&d.compareDocumentPosition(c)^4&&c.parentNode.insertBefore(d,c),c=d);return this}function selection_sort(e){e||(e=ascending);function i(et,_e){return et&&_e?e(et.__data__,_e.__data__):!et-!_e}for(var o=this._groups,a=o.length,s=new Array(a),c=0;ci?1:e>=i?0:NaN}function selection_call(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function selection_nodes(){return Array.from(this)}function selection_node(){for(var e=this._groups,i=0,o=e.length;i1?this.each((i==null?styleRemove$1:typeof i=="function"?styleFunction$1:styleConstant$1)(e,i,o??"")):styleValue(this.node(),e)}function styleValue(e,i){return e.style.getPropertyValue(i)||defaultView(e).getComputedStyle(e,null).getPropertyValue(i)}function propertyRemove(e){return function(){delete this[e]}}function propertyConstant(e,i){return function(){this[e]=i}}function propertyFunction(e,i){return function(){var o=i.apply(this,arguments);o==null?delete this[e]:this[e]=o}}function selection_property(e,i){return arguments.length>1?this.each((i==null?propertyRemove:typeof i=="function"?propertyFunction:propertyConstant)(e,i)):this.node()[e]}function classArray(e){return e.trim().split(/^|\s+/)}function classList(e){return e.classList||new ClassList(e)}function ClassList(e){this._node=e,this._names=classArray(e.getAttribute("class")||"")}ClassList.prototype={add:function(e){var i=this._names.indexOf(e);i<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var i=this._names.indexOf(e);i>=0&&(this._names.splice(i,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function classedAdd(e,i){for(var o=classList(e),a=-1,s=i.length;++a=0&&(o=i.slice(a+1),i=i.slice(0,a)),{type:i,name:o}})}function onRemove(e){return function(){var i=this.__on;if(i){for(var o=0,a=-1,s=i.length,c;o>8&15|i>>4&240,i>>4&15|i&240,(i&15)<<4|i&15,1):o===8?rgba(i>>24&255,i>>16&255,i>>8&255,(i&255)/255):o===4?rgba(i>>12&15|i>>8&240,i>>8&15|i>>4&240,i>>4&15|i&240,((i&15)<<4|i&15)/255):null):(i=reRgbInteger.exec(e))?new Rgb(i[1],i[2],i[3],1):(i=reRgbPercent.exec(e))?new Rgb(i[1]*255/100,i[2]*255/100,i[3]*255/100,1):(i=reRgbaInteger.exec(e))?rgba(i[1],i[2],i[3],i[4]):(i=reRgbaPercent.exec(e))?rgba(i[1]*255/100,i[2]*255/100,i[3]*255/100,i[4]):(i=reHslPercent.exec(e))?hsla(i[1],i[2]/100,i[3]/100,1):(i=reHslaPercent.exec(e))?hsla(i[1],i[2]/100,i[3]/100,i[4]):named.hasOwnProperty(e)?rgbn(named[e]):e==="transparent"?new Rgb(NaN,NaN,NaN,0):null}function rgbn(e){return new Rgb(e>>16&255,e>>8&255,e&255,1)}function rgba(e,i,o,a){return a<=0&&(e=i=o=NaN),new Rgb(e,i,o,a)}function rgbConvert(e){return e instanceof Color||(e=color(e)),e?(e=e.rgb(),new Rgb(e.r,e.g,e.b,e.opacity)):new Rgb}function rgb(e,i,o,a){return arguments.length===1?rgbConvert(e):new Rgb(e,i,o,a??1)}function Rgb(e,i,o,a){this.r=+e,this.g=+i,this.b=+o,this.opacity=+a}define(Rgb,rgb,extend(Color,{brighter(e){return e=e==null?brighter:Math.pow(brighter,e),new Rgb(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?darker:Math.pow(darker,e),new Rgb(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Rgb(clampi(this.r),clampi(this.g),clampi(this.b),clampa(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:rgb_formatHex,formatHex:rgb_formatHex,formatHex8:rgb_formatHex8,formatRgb:rgb_formatRgb,toString:rgb_formatRgb}));function rgb_formatHex(){return`#${hex$1(this.r)}${hex$1(this.g)}${hex$1(this.b)}`}function rgb_formatHex8(){return`#${hex$1(this.r)}${hex$1(this.g)}${hex$1(this.b)}${hex$1((isNaN(this.opacity)?1:this.opacity)*255)}`}function rgb_formatRgb(){const e=clampa(this.opacity);return`${e===1?"rgb(":"rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${e===1?")":`, ${e})`}`}function clampa(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function clampi(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function hex$1(e){return e=clampi(e),(e<16?"0":"")+e.toString(16)}function hsla(e,i,o,a){return a<=0?e=i=o=NaN:o<=0||o>=1?e=i=NaN:i<=0&&(e=NaN),new Hsl(e,i,o,a)}function hslConvert(e){if(e instanceof Hsl)return new Hsl(e.h,e.s,e.l,e.opacity);if(e instanceof Color||(e=color(e)),!e)return new Hsl;if(e instanceof Hsl)return e;e=e.rgb();var i=e.r/255,o=e.g/255,a=e.b/255,s=Math.min(i,o,a),c=Math.max(i,o,a),d=NaN,h=c-s,g=(c+s)/2;return h?(i===c?d=(o-a)/h+(o0&&g<1?0:d,new Hsl(d,h,g,e.opacity)}function hsl(e,i,o,a){return arguments.length===1?hslConvert(e):new Hsl(e,i,o,a??1)}function Hsl(e,i,o,a){this.h=+e,this.s=+i,this.l=+o,this.opacity=+a}define(Hsl,hsl,extend(Color,{brighter(e){return e=e==null?brighter:Math.pow(brighter,e),new Hsl(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?darker:Math.pow(darker,e),new Hsl(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,i=isNaN(e)||isNaN(this.s)?0:this.s,o=this.l,a=o+(o<.5?o:1-o)*i,s=2*o-a;return new Rgb(hsl2rgb(e>=240?e-240:e+120,s,a),hsl2rgb(e,s,a),hsl2rgb(e<120?e+240:e-120,s,a),this.opacity)},clamp(){return new Hsl(clamph(this.h),clampt(this.s),clampt(this.l),clampa(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=clampa(this.opacity);return`${e===1?"hsl(":"hsla("}${clamph(this.h)}, ${clampt(this.s)*100}%, ${clampt(this.l)*100}%${e===1?")":`, ${e})`}`}}));function clamph(e){return e=(e||0)%360,e<0?e+360:e}function clampt(e){return Math.max(0,Math.min(1,e||0))}function hsl2rgb(e,i,o){return(e<60?i+(o-i)*e/60:e<180?o:e<240?i+(o-i)*(240-e)/60:i)*255}const constant$2=e=>()=>e;function linear(e,i){return function(o){return e+o*i}}function exponential(e,i,o){return e=Math.pow(e,o),i=Math.pow(i,o)-e,o=1/o,function(a){return Math.pow(e+a*i,o)}}function gamma(e){return(e=+e)==1?nogamma:function(i,o){return o-i?exponential(i,o,e):constant$2(isNaN(i)?o:i)}}function nogamma(e,i){var o=i-e;return o?linear(e,o):constant$2(isNaN(e)?i:e)}const interpolateRgb=function e(i){var o=gamma(i);function a(s,c){var d=o((s=rgb(s)).r,(c=rgb(c)).r),h=o(s.g,c.g),g=o(s.b,c.b),$=nogamma(s.opacity,c.opacity);return function(b){return s.r=d(b),s.g=h(b),s.b=g(b),s.opacity=$(b),s+""}}return a.gamma=e,a}(1);function interpolateNumber(e,i){return e=+e,i=+i,function(o){return e*(1-o)+i*o}}var reA=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,reB=new RegExp(reA.source,"g");function zero(e){return function(){return e}}function one(e){return function(i){return e(i)+""}}function interpolateString(e,i){var o=reA.lastIndex=reB.lastIndex=0,a,s,c,d=-1,h=[],g=[];for(e=e+"",i=i+"";(a=reA.exec(e))&&(s=reB.exec(i));)(c=s.index)>o&&(c=i.slice(o,c),h[d]?h[d]+=c:h[++d]=c),(a=a[0])===(s=s[0])?h[d]?h[d]+=s:h[++d]=s:(h[++d]=null,g.push({i:d,x:interpolateNumber(a,s)})),o=reB.lastIndex;return o180?b+=360:b-$>180&&($+=360),_e.push({i:et.push(s(et)+"rotate(",null,a)-2,x:interpolateNumber($,b)})):b&&et.push(s(et)+"rotate("+b+a)}function h($,b,et,_e){$!==b?_e.push({i:et.push(s(et)+"skewX(",null,a)-2,x:interpolateNumber($,b)}):b&&et.push(s(et)+"skewX("+b+a)}function g($,b,et,_e,nt,lt){if($!==et||b!==_e){var it=nt.push(s(nt)+"scale(",null,",",null,")");lt.push({i:it-4,x:interpolateNumber($,et)},{i:it-2,x:interpolateNumber(b,_e)})}else(et!==1||_e!==1)&&nt.push(s(nt)+"scale("+et+","+_e+")")}return function($,b){var et=[],_e=[];return $=e($),b=e(b),c($.translateX,$.translateY,b.translateX,b.translateY,et,_e),d($.rotate,b.rotate,et,_e),h($.skewX,b.skewX,et,_e),g($.scaleX,$.scaleY,b.scaleX,b.scaleY,et,_e),$=b=null,function(nt){for(var lt=-1,it=_e.length,pt;++lt=0&&e._call.call(void 0,i),e=e._next;--frame}function wake(){clockNow=(clockLast=clock.now())+clockSkew,frame=timeout$1=0;try{timerFlush()}finally{frame=0,nap(),clockNow=0}}function poke(){var e=clock.now(),i=e-clockLast;i>pokeDelay&&(clockSkew-=i,clockLast=e)}function nap(){for(var e,i=taskHead,o,a=1/0;i;)i._call?(a>i._time&&(a=i._time),e=i,i=i._next):(o=i._next,i._next=null,i=e?e._next=o:taskHead=o);taskTail=e,sleep(a)}function sleep(e){if(!frame){timeout$1&&(timeout$1=clearTimeout(timeout$1));var i=e-clockNow;i>24?(e<1/0&&(timeout$1=setTimeout(wake,e-clock.now()-clockSkew)),interval&&(interval=clearInterval(interval))):(interval||(clockLast=clock.now(),interval=setInterval(poke,pokeDelay)),frame=1,setFrame(wake))}}function timeout(e,i,o){var a=new Timer;return i=i==null?0:+i,a.restart(s=>{a.stop(),e(s+i)},i,o),a}var emptyOn=dispatch("start","end","cancel","interrupt"),emptyTween=[],CREATED=0,SCHEDULED=1,STARTING=2,STARTED=3,RUNNING=4,ENDING=5,ENDED=6;function schedule(e,i,o,a,s,c){var d=e.__transition;if(!d)e.__transition={};else if(o in d)return;create(e,o,{name:i,index:a,group:s,on:emptyOn,tween:emptyTween,time:c.time,delay:c.delay,duration:c.duration,ease:c.ease,timer:null,state:CREATED})}function init(e,i){var o=get$1(e,i);if(o.state>CREATED)throw new Error("too late; already scheduled");return o}function set(e,i){var o=get$1(e,i);if(o.state>STARTED)throw new Error("too late; already running");return o}function get$1(e,i){var o=e.__transition;if(!o||!(o=o[i]))throw new Error("transition not found");return o}function create(e,i,o){var a=e.__transition,s;a[i]=o,o.timer=timer(c,0,o.time);function c($){o.state=SCHEDULED,o.timer.restart(d,o.delay,o.time),o.delay<=$&&d($-o.delay)}function d($){var b,et,_e,nt;if(o.state!==SCHEDULED)return g();for(b in a)if(nt=a[b],nt.name===o.name){if(nt.state===STARTED)return timeout(d);nt.state===RUNNING?(nt.state=ENDED,nt.timer.stop(),nt.on.call("interrupt",e,e.__data__,nt.index,nt.group),delete a[b]):+bSTARTING&&a.state=0&&(i=i.slice(0,o)),!i||i==="start"})}function onFunction(e,i,o){var a,s,c=start(i)?init:set;return function(){var d=c(this,e),h=d.on;h!==a&&(s=(a=h).copy()).on(i,o),d.on=s}}function transition_on(e,i){var o=this._id;return arguments.length<2?get$1(this.node(),o).on.on(e):this.each(onFunction(o,e,i))}function removeFunction(e){return function(){var i=this.parentNode;for(var o in this.__transition)if(+o!==e)return;i&&i.removeChild(this)}}function transition_remove(){return this.on("end.remove",removeFunction(this._id))}function transition_select(e){var i=this._name,o=this._id;typeof e!="function"&&(e=selector(e));for(var a=this._groups,s=a.length,c=new Array(s),d=0;d=0))throw new Error(`invalid digits: ${e}`);if(i>15)return append;const o=10**i;return function(a){this._+=a[0];for(let s=1,c=a.length;sepsilon)if(!(Math.abs(et*g-$*b)>epsilon)||!c)this._append`L${this._x1=i},${this._y1=o}`;else{let nt=a-d,lt=s-h,it=g*g+$*$,pt=nt*nt+lt*lt,rt=Math.sqrt(it),ot=Math.sqrt(_e),st=c*Math.tan((pi-Math.acos((it+_e-pt)/(2*rt*ot)))/2),ct=st/ot,ft=st/rt;Math.abs(ct-1)>epsilon&&this._append`L${i+ct*b},${o+ct*et}`,this._append`A${c},${c},0,0,${+(et*nt>b*lt)},${this._x1=i+ft*g},${this._y1=o+ft*$}`}}arc(i,o,a,s,c,d){if(i=+i,o=+o,a=+a,d=!!d,a<0)throw new Error(`negative radius: ${a}`);let h=a*Math.cos(s),g=a*Math.sin(s),$=i+h,b=o+g,et=1^d,_e=d?s-c:c-s;this._x1===null?this._append`M${$},${b}`:(Math.abs(this._x1-$)>epsilon||Math.abs(this._y1-b)>epsilon)&&this._append`L${$},${b}`,a&&(_e<0&&(_e=_e%tau+tau),_e>tauEpsilon?this._append`A${a},${a},0,1,${et},${i-h},${o-g}A${a},${a},0,1,${et},${this._x1=$},${this._y1=b}`:_e>epsilon&&this._append`A${a},${a},0,${+(_e>=pi)},${et},${this._x1=i+a*Math.cos(c)},${this._y1=o+a*Math.sin(c)}`)}rect(i,o,a,s){this._append`M${this._x0=this._x1=+i},${this._y0=this._y1=+o}h${a=+a}v${+s}h${-a}Z`}toString(){return this._}}function responseText(e){if(!e.ok)throw new Error(e.status+" "+e.statusText);return e.text()}function text(e,i){return fetch(e,i).then(responseText)}function parser$2(e){return(i,o)=>text(i,o).then(a=>new DOMParser().parseFromString(a,e))}var svg=parser$2("image/svg+xml");function constant$1(e){return function(){return e}}function withPath(e){let i=3;return e.digits=function(o){if(!arguments.length)return i;if(o==null)i=null;else{const a=Math.floor(o);if(!(a>=0))throw new RangeError(`invalid digits: ${o}`);i=a}return e},()=>new Path(i)}function array(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function Linear(e){this._context=e}Linear.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,i){switch(e=+e,i=+i,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,i):this._context.moveTo(e,i);break;case 1:this._point=2;default:this._context.lineTo(e,i);break}}};function curveLinear(e){return new Linear(e)}function x(e){return e[0]}function y(e){return e[1]}function line(e,i){var o=constant$1(!0),a=null,s=curveLinear,c=null,d=withPath(h);e=typeof e=="function"?e:e===void 0?x:constant$1(e),i=typeof i=="function"?i:i===void 0?y:constant$1(i);function h(g){var $,b=(g=array(g)).length,et,_e=!1,nt;for(a==null&&(c=s(nt=d())),$=0;$<=b;++$)!($0){if(++i>=HOT_COUNT)return arguments[0]}else i=0;return e.apply(void 0,arguments)}}function constant(e){return function(){return e}}var defineProperty=function(){try{var e=getNative(Object,"defineProperty");return e({},"",{}),e}catch{}}();const defineProperty$1=defineProperty;var baseSetToString=defineProperty$1?function(e,i){return defineProperty$1(e,"toString",{configurable:!0,enumerable:!1,value:constant(i),writable:!0})}:identity$1;const baseSetToString$1=baseSetToString;var setToString=shortOut(baseSetToString$1);const setToString$1=setToString;function arrayEach(e,i){for(var o=-1,a=e==null?0:e.length;++o-1}var MAX_SAFE_INTEGER$1=9007199254740991,reIsUint=/^(?:0|[1-9]\d*)$/;function isIndex(e,i){var o=typeof e;return i=i??MAX_SAFE_INTEGER$1,!!i&&(o=="number"||o!="symbol"&&reIsUint.test(e))&&e>-1&&e%1==0&&e-1&&e%1==0&&e<=MAX_SAFE_INTEGER}function isArrayLike(e){return e!=null&&isLength(e.length)&&!isFunction(e)}function isIterateeCall(e,i,o){if(!isObject(o))return!1;var a=typeof i;return(a=="number"?isArrayLike(o)&&isIndex(i,o.length):a=="string"&&i in o)?eq(o[i],e):!1}function createAssigner(e){return baseRest(function(i,o){var a=-1,s=o.length,c=s>1?o[s-1]:void 0,d=s>2?o[2]:void 0;for(c=e.length>3&&typeof c=="function"?(s--,c):void 0,d&&isIterateeCall(o[0],o[1],d)&&(c=s<3?void 0:c,s=1),i=Object(i);++a-1}function listCacheSet(e,i){var o=this.__data__,a=assocIndexOf(o,e);return a<0?(++this.size,o.push([e,i])):o[a][1]=i,this}function ListCache(e){var i=-1,o=e==null?0:e.length;for(this.clear();++i0&&o(h)?i>1?baseFlatten(h,i-1,o,a,s):arrayPush(s,h):a||(s[s.length]=h)}return s}function flatten(e){var i=e==null?0:e.length;return i?baseFlatten(e,1):[]}function flatRest(e){return setToString$1(overRest(e,void 0,flatten),e+"")}var getPrototype=overArg(Object.getPrototypeOf,Object);const getPrototype$1=getPrototype;var objectTag$3="[object Object]",funcProto=Function.prototype,objectProto$7=Object.prototype,funcToString=funcProto.toString,hasOwnProperty$6=objectProto$7.hasOwnProperty,objectCtorString=funcToString.call(Object);function isPlainObject(e){if(!isObjectLike(e)||baseGetTag(e)!=objectTag$3)return!1;var i=getPrototype$1(e);if(i===null)return!0;var o=hasOwnProperty$6.call(i,"constructor")&&i.constructor;return typeof o=="function"&&o instanceof o&&funcToString.call(o)==objectCtorString}function arrayReduce(e,i,o,a){var s=-1,c=e==null?0:e.length;for(a&&c&&(o=e[++s]);++sh))return!1;var $=c.get(e),b=c.get(i);if($&&b)return $==i&&b==e;var et=-1,_e=!0,nt=o&COMPARE_UNORDERED_FLAG$3?new SetCache:void 0;for(c.set(e,i),c.set(i,e);++et2?i[2]:void 0;for(s&&isIterateeCall(i[0],i[1],s)&&(a=1);++o-1?s[c?i[d]:d]:void 0}}var nativeMax$1=Math.max;function findIndex(e,i,o){var a=e==null?0:e.length;if(!a)return-1;var s=o==null?0:toInteger(o);return s<0&&(s=nativeMax$1(a+s,0)),baseFindIndex(e,baseIteratee(i),s)}var find=createFind(findIndex);const find$1=find;function baseMap(e,i){var o=-1,a=isArrayLike(e)?Array(e.length):[];return baseEach$1(e,function(s,c,d){a[++o]=i(s,c,d)}),a}function map(e,i){var o=isArray$1(e)?arrayMap:baseMap;return o(e,baseIteratee(i))}function forIn(e,i){return e==null?e:baseFor$1(e,castFunction(i),keysIn)}function forOwn(e,i){return e&&baseForOwn(e,castFunction(i))}function baseGt(e,i){return e>i}var objectProto$1=Object.prototype,hasOwnProperty$1=objectProto$1.hasOwnProperty;function baseHas(e,i){return e!=null&&hasOwnProperty$1.call(e,i)}function has(e,i){return e!=null&&hasPath(e,i,baseHas)}function baseValues(e,i){return arrayMap(i,function(o){return e[o]})}function values(e){return e==null?[]:baseValues(e,keys(e))}var mapTag="[object Map]",setTag="[object Set]",objectProto=Object.prototype,hasOwnProperty=objectProto.hasOwnProperty;function isEmpty(e){if(e==null)return!0;if(isArrayLike(e)&&(isArray$1(e)||typeof e=="string"||typeof e.splice=="function"||isBuffer$1(e)||isTypedArray$1(e)||isArguments$1(e)))return!e.length;var i=getTag$1(e);if(i==mapTag||i==setTag)return!e.size;if(isPrototype(e))return!baseKeys(e).length;for(var o in e)if(hasOwnProperty.call(e,o))return!1;return!0}function isUndefined(e){return e===void 0}function baseLt(e,i){return ei||c&&d&&g&&!h&&!$||a&&d&&g||!o&&g||!s)return 1;if(!a&&!c&&!$&&e=h)return g;var $=o[a];return g*($=="desc"?-1:1)}}return e.index-i.index}function baseOrderBy(e,i,o){i.length?i=arrayMap(i,function(c){return isArray$1(c)?function(d){return baseGet(d,c.length===1?c[0]:c)}:c}):i=[identity$1];var a=-1;i=arrayMap(i,baseUnary(baseIteratee));var s=baseMap(e,function(c,d,h){var g=arrayMap(i,function($){return $(c)});return{criteria:g,index:++a,value:c}});return baseSortBy(s,function(c,d){return compareMultiple(c,d,o)})}function basePick(e,i){return basePickBy(e,i,function(o,a){return hasIn(e,a)})}var pick=flatRest(function(e,i){return e==null?{}:basePick(e,i)});const pick$1=pick;var nativeCeil=Math.ceil,nativeMax=Math.max;function baseRange(e,i,o,a){for(var s=-1,c=nativeMax(nativeCeil((i-e)/(o||1)),0),d=Array(c);c--;)d[a?c:++s]=e,e+=o;return d}function createRange(e){return function(i,o,a){return a&&typeof a!="number"&&isIterateeCall(i,o,a)&&(o=a=void 0),i=toFinite(i),o===void 0?(o=i,i=0):o=toFinite(o),a=a===void 0?i1&&isIterateeCall(e,i[0],i[1])?i=[]:o>2&&isIterateeCall(i[0],i[1],i[2])&&(i=[i[0]]),baseOrderBy(e,baseFlatten(i,1),[])});const sortBy$1=sortBy;var INFINITY=1/0,createSet=Set$2&&1/setToArray(new Set$2([,-0]))[1]==INFINITY?function(e){return new Set$2(e)}:noop;const createSet$1=createSet;var LARGE_ARRAY_SIZE=200;function baseUniq(e,i,o){var a=-1,s=arrayIncludes,c=e.length,d=!0,h=[],g=h;if(o)d=!1,s=arrayIncludesWith;else if(c>=LARGE_ARRAY_SIZE){var $=i?null:createSet$1(e);if($)return setToArray($);d=!1,s=cacheHas,g=new SetCache}else g=i?[]:h;e:for(;++a1?s.setNode(c,o):s.setNode(c)}),this}setNode(i,o){return has(this._nodes,i)?(arguments.length>1&&(this._nodes[i]=o),this):(this._nodes[i]=arguments.length>1?o:this._defaultNodeLabelFn(i),this._isCompound&&(this._parent[i]=GRAPH_NODE,this._children[i]={},this._children[GRAPH_NODE][i]=!0),this._in[i]={},this._preds[i]={},this._out[i]={},this._sucs[i]={},++this._nodeCount,this)}node(i){return this._nodes[i]}hasNode(i){return has(this._nodes,i)}removeNode(i){var o=this;if(has(this._nodes,i)){var a=function(s){o.removeEdge(o._edgeObjs[s])};delete this._nodes[i],this._isCompound&&(this._removeFromParentsChildList(i),delete this._parent[i],forEach(this.children(i),function(s){o.setParent(s)}),delete this._children[i]),forEach(keys(this._in[i]),a),delete this._in[i],delete this._preds[i],forEach(keys(this._out[i]),a),delete this._out[i],delete this._sucs[i],--this._nodeCount}return this}setParent(i,o){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(isUndefined(o))o=GRAPH_NODE;else{o+="";for(var a=o;!isUndefined(a);a=this.parent(a))if(a===i)throw new Error("Setting "+o+" as parent of "+i+" would create a cycle");this.setNode(o)}return this.setNode(i),this._removeFromParentsChildList(i),this._parent[i]=o,this._children[o][i]=!0,this}_removeFromParentsChildList(i){delete this._children[this._parent[i]][i]}parent(i){if(this._isCompound){var o=this._parent[i];if(o!==GRAPH_NODE)return o}}children(i){if(isUndefined(i)&&(i=GRAPH_NODE),this._isCompound){var o=this._children[i];if(o)return keys(o)}else{if(i===GRAPH_NODE)return this.nodes();if(this.hasNode(i))return[]}}predecessors(i){var o=this._preds[i];if(o)return keys(o)}successors(i){var o=this._sucs[i];if(o)return keys(o)}neighbors(i){var o=this.predecessors(i);if(o)return union$1(o,this.successors(i))}isLeaf(i){var o;return this.isDirected()?o=this.successors(i):o=this.neighbors(i),o.length===0}filterNodes(i){var o=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});o.setGraph(this.graph());var a=this;forEach(this._nodes,function(d,h){i(h)&&o.setNode(h,d)}),forEach(this._edgeObjs,function(d){o.hasNode(d.v)&&o.hasNode(d.w)&&o.setEdge(d,a.edge(d))});var s={};function c(d){var h=a.parent(d);return h===void 0||o.hasNode(h)?(s[d]=h,h):h in s?s[h]:c(h)}return this._isCompound&&forEach(o.nodes(),function(d){o.setParent(d,c(d))}),o}setDefaultEdgeLabel(i){return isFunction(i)||(i=constant(i)),this._defaultEdgeLabelFn=i,this}edgeCount(){return this._edgeCount}edges(){return values(this._edgeObjs)}setPath(i,o){var a=this,s=arguments;return reduce(i,function(c,d){return s.length>1?a.setEdge(c,d,o):a.setEdge(c,d),d}),this}setEdge(){var i,o,a,s,c=!1,d=arguments[0];typeof d=="object"&&d!==null&&"v"in d?(i=d.v,o=d.w,a=d.name,arguments.length===2&&(s=arguments[1],c=!0)):(i=d,o=arguments[1],a=arguments[3],arguments.length>2&&(s=arguments[2],c=!0)),i=""+i,o=""+o,isUndefined(a)||(a=""+a);var h=edgeArgsToId(this._isDirected,i,o,a);if(has(this._edgeLabels,h))return c&&(this._edgeLabels[h]=s),this;if(!isUndefined(a)&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(i),this.setNode(o),this._edgeLabels[h]=c?s:this._defaultEdgeLabelFn(i,o,a);var g=edgeArgsToObj(this._isDirected,i,o,a);return i=g.v,o=g.w,Object.freeze(g),this._edgeObjs[h]=g,incrementOrInitEntry(this._preds[o],i),incrementOrInitEntry(this._sucs[i],o),this._in[o][h]=g,this._out[i][h]=g,this._edgeCount++,this}edge(i,o,a){var s=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,i,o,a);return this._edgeLabels[s]}hasEdge(i,o,a){var s=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,i,o,a);return has(this._edgeLabels,s)}removeEdge(i,o,a){var s=arguments.length===1?edgeObjToId(this._isDirected,arguments[0]):edgeArgsToId(this._isDirected,i,o,a),c=this._edgeObjs[s];return c&&(i=c.v,o=c.w,delete this._edgeLabels[s],delete this._edgeObjs[s],decrementOrRemoveEntry(this._preds[o],i),decrementOrRemoveEntry(this._sucs[i],o),delete this._in[o][s],delete this._out[i][s],this._edgeCount--),this}inEdges(i,o){var a=this._in[i];if(a){var s=values(a);return o?filter(s,function(c){return c.v===o}):s}}outEdges(i,o){var a=this._out[i];if(a){var s=values(a);return o?filter(s,function(c){return c.w===o}):s}}nodeEdges(i,o){var a=this.inEdges(i,o);if(a)return a.concat(this.outEdges(i,o))}}Graph.prototype._nodeCount=0;Graph.prototype._edgeCount=0;function incrementOrInitEntry(e,i){e[i]?e[i]++:e[i]=1}function decrementOrRemoveEntry(e,i){--e[i]||delete e[i]}function edgeArgsToId(e,i,o,a){var s=""+i,c=""+o;if(!e&&s>c){var d=s;s=c,c=d}return s+EDGE_KEY_DELIM+c+EDGE_KEY_DELIM+(isUndefined(a)?DEFAULT_EDGE_NAME:a)}function edgeArgsToObj(e,i,o,a){var s=""+i,c=""+o;if(!e&&s>c){var d=s;s=c,c=d}var h={v:s,w:c};return a&&(h.name=a),h}function edgeObjToId(e,i){return edgeArgsToId(e,i.v,i.w,i.name)}class List{constructor(){var i={};i._next=i._prev=i,this._sentinel=i}dequeue(){var i=this._sentinel,o=i._prev;if(o!==i)return unlink(o),o}enqueue(i){var o=this._sentinel;i._prev&&i._next&&unlink(i),i._next=o._next,o._next._prev=i,o._next=i,i._prev=o}toString(){for(var i=[],o=this._sentinel,a=o._prev;a!==o;)i.push(JSON.stringify(a,filterOutLinks)),a=a._prev;return"["+i.join(", ")+"]"}}function unlink(e){e._prev._next=e._next,e._next._prev=e._prev,delete e._next,delete e._prev}function filterOutLinks(e,i){if(e!=="_next"&&e!=="_prev")return i}var DEFAULT_WEIGHT_FN=constant(1);function greedyFAS(e,i){if(e.nodeCount()<=1)return[];var o=buildState(e,i||DEFAULT_WEIGHT_FN),a=doGreedyFAS(o.graph,o.buckets,o.zeroIdx);return flatten(map(a,function(s){return e.outEdges(s.v,s.w)}))}function doGreedyFAS(e,i,o){for(var a=[],s=i[i.length-1],c=i[0],d;e.nodeCount();){for(;d=c.dequeue();)removeNode(e,i,o,d);for(;d=s.dequeue();)removeNode(e,i,o,d);if(e.nodeCount()){for(var h=i.length-2;h>0;--h)if(d=i[h].dequeue(),d){a=a.concat(removeNode(e,i,o,d,!0));break}}}return a}function removeNode(e,i,o,a,s){var c=s?[]:void 0;return forEach(e.inEdges(a.v),function(d){var h=e.edge(d),g=e.node(d.v);s&&c.push({v:d.v,w:d.w}),g.out-=h,assignBucket(i,o,g)}),forEach(e.outEdges(a.v),function(d){var h=e.edge(d),g=d.w,$=e.node(g);$.in-=h,assignBucket(i,o,$)}),e.removeNode(a.v),c}function buildState(e,i){var o=new Graph,a=0,s=0;forEach(e.nodes(),function(h){o.setNode(h,{v:h,in:0,out:0})}),forEach(e.edges(),function(h){var g=o.edge(h.v,h.w)||0,$=i(h),b=g+$;o.setEdge(h.v,h.w,b),s=Math.max(s,o.node(h.v).out+=$),a=Math.max(a,o.node(h.w).in+=$)});var c=range$1(s+a+3).map(function(){return new List}),d=a+1;return forEach(o.nodes(),function(h){assignBucket(c,d,o.node(h))}),{graph:o,buckets:c,zeroIdx:d}}function assignBucket(e,i,o){o.out?o.in?e[o.out-o.in+i].enqueue(o):e[e.length-1].enqueue(o):e[0].enqueue(o)}function run$2(e){var i=e.graph().acyclicer==="greedy"?greedyFAS(e,o(e)):dfsFAS(e);forEach(i,function(a){var s=e.edge(a);e.removeEdge(a),s.forwardName=a.name,s.reversed=!0,e.setEdge(a.w,a.v,s,uniqueId("rev"))});function o(a){return function(s){return a.edge(s).weight}}}function dfsFAS(e){var i=[],o={},a={};function s(c){has(a,c)||(a[c]=!0,o[c]=!0,forEach(e.outEdges(c),function(d){has(o,d.w)?i.push(d):s(d.w)}),delete o[c])}return forEach(e.nodes(),s),i}function undo$2(e){forEach(e.edges(),function(i){var o=e.edge(i);if(o.reversed){e.removeEdge(i);var a=o.forwardName;delete o.reversed,delete o.forwardName,e.setEdge(i.w,i.v,o,a)}})}function addDummyNode(e,i,o,a){var s;do s=uniqueId(a);while(e.hasNode(s));return o.dummy=i,e.setNode(s,o),s}function simplify(e){var i=new Graph().setGraph(e.graph());return forEach(e.nodes(),function(o){i.setNode(o,e.node(o))}),forEach(e.edges(),function(o){var a=i.edge(o.v,o.w)||{weight:0,minlen:1},s=e.edge(o);i.setEdge(o.v,o.w,{weight:a.weight+s.weight,minlen:Math.max(a.minlen,s.minlen)})}),i}function asNonCompoundGraph(e){var i=new Graph({multigraph:e.isMultigraph()}).setGraph(e.graph());return forEach(e.nodes(),function(o){e.children(o).length||i.setNode(o,e.node(o))}),forEach(e.edges(),function(o){i.setEdge(o,e.edge(o))}),i}function intersectRect$1(e,i){var o=e.x,a=e.y,s=i.x-o,c=i.y-a,d=e.width/2,h=e.height/2;if(!s&&!c)throw new Error("Not possible to find intersection inside of the rectangle");var g,$;return Math.abs(c)*d>Math.abs(s)*h?(c<0&&(h=-h),g=h*s/c,$=h):(s<0&&(d=-d),g=d,$=d*c/s),{x:o+g,y:a+$}}function buildLayerMatrix(e){var i=map(range$1(maxRank(e)+1),function(){return[]});return forEach(e.nodes(),function(o){var a=e.node(o),s=a.rank;isUndefined(s)||(i[s][a.order]=o)}),i}function normalizeRanks(e){var i=min(map(e.nodes(),function(o){return e.node(o).rank}));forEach(e.nodes(),function(o){var a=e.node(o);has(a,"rank")&&(a.rank-=i)})}function removeEmptyRanks(e){var i=min(map(e.nodes(),function(c){return e.node(c).rank})),o=[];forEach(e.nodes(),function(c){var d=e.node(c).rank-i;o[d]||(o[d]=[]),o[d].push(c)});var a=0,s=e.graph().nodeRankFactor;forEach(o,function(c,d){isUndefined(c)&&d%s!==0?--a:a&&forEach(c,function(h){e.node(h).rank+=a})})}function addBorderNode$1(e,i,o,a){var s={width:0,height:0};return arguments.length>=4&&(s.rank=o,s.order=a),addDummyNode(e,"border",s,i)}function maxRank(e){return max(map(e.nodes(),function(i){var o=e.node(i).rank;if(!isUndefined(o))return o}))}function partition(e,i){var o={lhs:[],rhs:[]};return forEach(e,function(a){i(a)?o.lhs.push(a):o.rhs.push(a)}),o}function time(e,i){var o=now$1();try{return i()}finally{console.log(e+" time: "+(now$1()-o)+"ms")}}function notime(e,i){return i()}function addBorderSegments(e){function i(o){var a=e.children(o),s=e.node(o);if(a.length&&forEach(a,i),has(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(var c=s.minRank,d=s.maxRank+1;cd.lim&&(h=d,g=!0);var $=filter(i.edges(),function(b){return g===isDescendant(e,e.node(b.v),h)&&g!==isDescendant(e,e.node(b.w),h)});return minBy($,function(b){return slack(i,b)})}function exchangeEdges(e,i,o,a){var s=o.v,c=o.w;e.removeEdge(s,c),e.setEdge(a.v,a.w,{}),initLowLimValues(e),initCutValues(e,i),updateRanks(e,i)}function updateRanks(e,i){var o=find$1(e.nodes(),function(s){return!i.node(s).parent}),a=preorder(e,o);a=a.slice(1),forEach(a,function(s){var c=e.node(s).parent,d=i.edge(s,c),h=!1;d||(d=i.edge(c,s),h=!0),i.node(s).rank=i.node(c).rank+(h?d.minlen:-d.minlen)})}function isTreeEdge(e,i,o){return e.hasEdge(i,o)}function isDescendant(e,i,o){return o.low<=i.lim&&i.lim<=o.lim}function rank(e){switch(e.graph().ranker){case"network-simplex":networkSimplexRanker(e);break;case"tight-tree":tightTreeRanker(e);break;case"longest-path":longestPathRanker(e);break;default:networkSimplexRanker(e)}}var longestPathRanker=longestPath;function tightTreeRanker(e){longestPath(e),feasibleTree(e)}function networkSimplexRanker(e){networkSimplex(e)}function run(e){var i=addDummyNode(e,"root",{},"_root"),o=treeDepths(e),a=max(values(o))-1,s=2*a+1;e.graph().nestingRoot=i,forEach(e.edges(),function(d){e.edge(d).minlen*=s});var c=sumWeights(e)+1;forEach(e.children(),function(d){dfs(e,i,s,c,a,o,d)}),e.graph().nodeRankFactor=s}function dfs(e,i,o,a,s,c,d){var h=e.children(d);if(!h.length){d!==i&&e.setEdge(i,d,{weight:0,minlen:o});return}var g=addBorderNode$1(e,"_bt"),$=addBorderNode$1(e,"_bb"),b=e.node(d);e.setParent(g,d),b.borderTop=g,e.setParent($,d),b.borderBottom=$,forEach(h,function(et){dfs(e,i,o,a,s,c,et);var _e=e.node(et),nt=_e.borderTop?_e.borderTop:et,lt=_e.borderBottom?_e.borderBottom:et,it=_e.borderTop?a:2*a,pt=nt!==lt?1:s-c[d]+1;e.setEdge(g,nt,{weight:it,minlen:pt,nestingEdge:!0}),e.setEdge(lt,$,{weight:it,minlen:pt,nestingEdge:!0})}),e.parent(d)||e.setEdge(i,g,{weight:0,minlen:s+c[d]})}function treeDepths(e){var i={};function o(a,s){var c=e.children(a);c&&c.length&&forEach(c,function(d){o(d,s+1)}),i[a]=s}return forEach(e.children(),function(a){o(a,1)}),i}function sumWeights(e){return reduce(e.edges(),function(i,o){return i+e.edge(o).weight},0)}function cleanup(e){var i=e.graph();e.removeNode(i.nestingRoot),delete i.nestingRoot,forEach(e.edges(),function(o){var a=e.edge(o);a.nestingEdge&&e.removeEdge(o)})}function addSubgraphConstraints(e,i,o){var a={},s;forEach(o,function(c){for(var d=e.parent(c),h,g;d;){if(h=e.parent(d),h?(g=a[h],a[h]=d):(g=s,s=d),g&&g!==d){i.setEdge(g,d);return}d=h}})}function buildLayerGraph(e,i,o){var a=createRootNode(e),s=new Graph({compound:!0}).setGraph({root:a}).setDefaultNodeLabel(function(c){return e.node(c)});return forEach(e.nodes(),function(c){var d=e.node(c),h=e.parent(c);(d.rank===i||d.minRank<=i&&i<=d.maxRank)&&(s.setNode(c),s.setParent(c,h||a),forEach(e[o](c),function(g){var $=g.v===c?g.w:g.v,b=s.edge($,c),et=isUndefined(b)?0:b.weight;s.setEdge($,c,{weight:e.edge(g).weight+et})}),has(d,"minRank")&&s.setNode(c,{borderLeft:d.borderLeft[i],borderRight:d.borderRight[i]}))}),s}function createRootNode(e){for(var i;e.hasNode(i=uniqueId("_root")););return i}function crossCount(e,i){for(var o=0,a=1;a0;)b%2&&(et+=h[b+1]),b=b-1>>1,h[b]+=$.weight;g+=$.weight*et})),g}function initOrder(e){var i={},o=filter(e.nodes(),function(h){return!e.children(h).length}),a=max(map(o,function(h){return e.node(h).rank})),s=map(range$1(a+1),function(){return[]});function c(h){if(!has(i,h)){i[h]=!0;var g=e.node(h);s[g.rank].push(h),forEach(e.successors(h),c)}}var d=sortBy$1(o,function(h){return e.node(h).rank});return forEach(d,c),s}function barycenter(e,i){return map(i,function(o){var a=e.inEdges(o);if(a.length){var s=reduce(a,function(c,d){var h=e.edge(d),g=e.node(d.v);return{sum:c.sum+h.weight*g.order,weight:c.weight+h.weight}},{sum:0,weight:0});return{v:o,barycenter:s.sum/s.weight,weight:s.weight}}else return{v:o}})}function resolveConflicts(e,i){var o={};forEach(e,function(s,c){var d=o[s.v]={indegree:0,in:[],out:[],vs:[s.v],i:c};isUndefined(s.barycenter)||(d.barycenter=s.barycenter,d.weight=s.weight)}),forEach(i.edges(),function(s){var c=o[s.v],d=o[s.w];!isUndefined(c)&&!isUndefined(d)&&(d.indegree++,c.out.push(o[s.w]))});var a=filter(o,function(s){return!s.indegree});return doResolveConflicts(a)}function doResolveConflicts(e){var i=[];function o(c){return function(d){d.merged||(isUndefined(d.barycenter)||isUndefined(c.barycenter)||d.barycenter>=c.barycenter)&&mergeEntries(c,d)}}function a(c){return function(d){d.in.push(c),--d.indegree===0&&e.push(d)}}for(;e.length;){var s=e.pop();i.push(s),forEach(s.in.reverse(),o(s)),forEach(s.out,a(s))}return map(filter(i,function(c){return!c.merged}),function(c){return pick$1(c,["vs","i","barycenter","weight"])})}function mergeEntries(e,i){var o=0,a=0;e.weight&&(o+=e.barycenter*e.weight,a+=e.weight),i.weight&&(o+=i.barycenter*i.weight,a+=i.weight),e.vs=i.vs.concat(e.vs),e.barycenter=o/a,e.weight=a,e.i=Math.min(i.i,e.i),i.merged=!0}function sort(e,i){var o=partition(e,function(b){return has(b,"barycenter")}),a=o.lhs,s=sortBy$1(o.rhs,function(b){return-b.i}),c=[],d=0,h=0,g=0;a.sort(compareWithBias(!!i)),g=consumeUnsortable(c,s,g),forEach(a,function(b){g+=b.vs.length,c.push(b.vs),d+=b.barycenter*b.weight,h+=b.weight,g=consumeUnsortable(c,s,g)});var $={vs:flatten(c)};return h&&($.barycenter=d/h,$.weight=h),$}function consumeUnsortable(e,i,o){for(var a;i.length&&(a=last(i)).i<=o;)i.pop(),e.push(a.vs),o++;return o}function compareWithBias(e){return function(i,o){return i.barycentero.barycenter?1:e?o.i-i.i:i.i-o.i}}function sortSubgraph(e,i,o,a){var s=e.children(i),c=e.node(i),d=c?c.borderLeft:void 0,h=c?c.borderRight:void 0,g={};d&&(s=filter(s,function(lt){return lt!==d&<!==h}));var $=barycenter(e,s);forEach($,function(lt){if(e.children(lt.v).length){var it=sortSubgraph(e,lt.v,o,a);g[lt.v]=it,has(it,"barycenter")&&mergeBarycenters(lt,it)}});var b=resolveConflicts($,o);expandSubgraphs(b,g);var et=sort(b,a);if(d&&(et.vs=flatten([d,et.vs,h]),e.predecessors(d).length)){var _e=e.node(e.predecessors(d)[0]),nt=e.node(e.predecessors(h)[0]);has(et,"barycenter")||(et.barycenter=0,et.weight=0),et.barycenter=(et.barycenter*et.weight+_e.order+nt.order)/(et.weight+2),et.weight+=2}return et}function expandSubgraphs(e,i){forEach(e,function(o){o.vs=flatten(o.vs.map(function(a){return i[a]?i[a].vs:a}))})}function mergeBarycenters(e,i){isUndefined(e.barycenter)?(e.barycenter=i.barycenter,e.weight=i.weight):(e.barycenter=(e.barycenter*e.weight+i.barycenter*i.weight)/(e.weight+i.weight),e.weight+=i.weight)}function order(e){var i=maxRank(e),o=buildLayerGraphs(e,range$1(1,i+1),"inEdges"),a=buildLayerGraphs(e,range$1(i-1,-1,-1),"outEdges"),s=initOrder(e);assignOrder(e,s);for(var c=Number.POSITIVE_INFINITY,d,h=0,g=0;g<4;++h,++g){sweepLayerGraphs(h%2?o:a,h%4>=2),s=buildLayerMatrix(e);var $=crossCount(e,s);$d||h>i[g].lim));for($=g,g=a;(g=e.parent(g))!==$;)c.push(g);return{path:s.concat(c.reverse()),lca:$}}function postorder(e){var i={},o=0;function a(s){var c=o;forEach(e.children(s),a),i[s]={low:c,lim:o++}}return forEach(e.children(),a),i}function findType1Conflicts(e,i){var o={};function a(s,c){var d=0,h=0,g=s.length,$=last(c);return forEach(c,function(b,et){var _e=findOtherInnerSegmentNode(e,b),nt=_e?e.node(_e).order:g;(_e||b===$)&&(forEach(c.slice(h,et+1),function(lt){forEach(e.predecessors(lt),function(it){var pt=e.node(it),rt=pt.order;(rt$)&&addConflict(o,_e,b)})})}function s(c,d){var h=-1,g,$=0;return forEach(d,function(b,et){if(e.node(b).dummy==="border"){var _e=e.predecessors(b);_e.length&&(g=e.node(_e[0]).order,a(d,$,et,h,g),$=et,h=g)}a(d,$,d.length,g,c.length)}),d}return reduce(i,s),o}function findOtherInnerSegmentNode(e,i){if(e.node(i).dummy)return find$1(e.predecessors(i),function(o){return e.node(o).dummy})}function addConflict(e,i,o){if(i>o){var a=i;i=o,o=a}var s=e[i];s||(e[i]=s={}),s[o]=!0}function hasConflict(e,i,o){if(i>o){var a=i;i=o,o=a}return has(e[i],o)}function verticalAlignment(e,i,o,a){var s={},c={},d={};return forEach(i,function(h){forEach(h,function(g,$){s[g]=g,c[g]=g,d[g]=$})}),forEach(i,function(h){var g=-1;forEach(h,function($){var b=a($);if(b.length){b=sortBy$1(b,function(it){return d[it]});for(var et=(b.length-1)/2,_e=Math.floor(et),nt=Math.ceil(et);_e<=nt;++_e){var lt=b[_e];c[$]===$&&g0}function intersectPolygon(e,i,o){var a=e.x,s=e.y,c=[],d=Number.POSITIVE_INFINITY,h=Number.POSITIVE_INFINITY;i.forEach(function(lt){d=Math.min(d,lt.x),h=Math.min(h,lt.y)});for(var g=a-e.width/2-d,$=s-e.height/2-h,b=0;b1&&c.sort(function(lt,it){var pt=lt.x-o.x,rt=lt.y-o.y,ot=Math.sqrt(pt*pt+rt*rt),st=it.x-o.x,ct=it.y-o.y,ft=Math.sqrt(st*st+ct*ct);return otMath.abs(s)*h?(c<0&&(h=-h),g=c===0?0:h*s/c,$=h):(s<0&&(d=-d),g=d,$=s===0?0:d*c/s),{x:o+g,y:a+$}}var shapes={rect,ellipse,circle,diamond};function setShapes(e){shapes=e}function rect(e,i,o){var a=e.insert("rect",":first-child").attr("rx",o.rx).attr("ry",o.ry).attr("x",-i.width/2).attr("y",-i.height/2).attr("width",i.width).attr("height",i.height);return o.intersect=function(s){return intersectRect(o,s)},a}function ellipse(e,i,o){var a=i.width/2,s=i.height/2,c=e.insert("ellipse",":first-child").attr("x",-i.width/2).attr("y",-i.height/2).attr("rx",a).attr("ry",s);return o.intersect=function(d){return intersectEllipse(o,a,s,d)},c}function circle(e,i,o){var a=Math.max(i.width,i.height)/2,s=e.insert("circle",":first-child").attr("x",-i.width/2).attr("y",-i.height/2).attr("r",a);return o.intersect=function(c){return intersectCircle(o,a,c)},s}function diamond(e,i,o){var a=i.width*Math.SQRT2/2,s=i.height*Math.SQRT2/2,c=[{x:0,y:-s},{x:-a,y:0},{x:0,y:s},{x:a,y:0}],d=e.insert("polygon",":first-child").attr("points",c.map(function(h){return h.x+","+h.y}).join(" "));return o.intersect=function(h){return intersectPolygon(o,c,h)},d}function render(){var e=function(i,o){preProcessGraph(o);var a=createOrSelectGroup(i,"output"),s=createOrSelectGroup(a,"clusters"),c=createOrSelectGroup(a,"edgePaths"),d=createEdgeLabels(createOrSelectGroup(a,"edgeLabels"),o),h=createNodes(createOrSelectGroup(a,"nodes"),o,shapes);layout(o),positionNodes(h,o),positionEdgeLabels(d,o),createEdgePaths(c,o,arrows);var g=createClusters(s,o);positionClusters(g,o),postProcessGraph(o)};return e.createNodes=function(i){return arguments.length?(setCreateNodes(i),e):createNodes},e.createClusters=function(i){return arguments.length?(setCreateClusters(i),e):createClusters},e.createEdgeLabels=function(i){return arguments.length?(setCreateEdgeLabels(i),e):createEdgeLabels},e.createEdgePaths=function(i){return arguments.length?(setCreateEdgePaths(i),e):createEdgePaths},e.shapes=function(i){return arguments.length?(setShapes(i),e):shapes},e.arrows=function(i){return arguments.length?(setArrows(i),e):arrows},e}var NODE_DEFAULT_ATTRS={paddingLeft:10,paddingRight:10,paddingTop:10,paddingBottom:10,rx:0,ry:0,shape:"rect"},EDGE_DEFAULT_ATTRS={arrowhead:"normal",curve:curveLinear};function preProcessGraph(e){e.nodes().forEach(function(i){var o=e.node(i);!has(o,"label")&&!e.children(i).length&&(o.label=i),has(o,"paddingX")&&defaults$1(o,{paddingLeft:o.paddingX,paddingRight:o.paddingX}),has(o,"paddingY")&&defaults$1(o,{paddingTop:o.paddingY,paddingBottom:o.paddingY}),has(o,"padding")&&defaults$1(o,{paddingLeft:o.padding,paddingRight:o.padding,paddingTop:o.padding,paddingBottom:o.padding}),defaults$1(o,NODE_DEFAULT_ATTRS),forEach(["paddingLeft","paddingRight","paddingTop","paddingBottom"],function(a){o[a]=Number(o[a])}),has(o,"width")&&(o._prevWidth=o.width),has(o,"height")&&(o._prevHeight=o.height)}),e.edges().forEach(function(i){var o=e.edge(i);has(o,"label")||(o.label=""),defaults$1(o,EDGE_DEFAULT_ATTRS)})}function postProcessGraph(e){forEach(e.nodes(),function(i){var o=e.node(i);has(o,"_prevWidth")?o.width=o._prevWidth:delete o.width,has(o,"_prevHeight")?o.height=o._prevHeight:delete o.height,delete o._prevWidth,delete o._prevHeight})}function createOrSelectGroup(e,i){var o=e.select("g."+i);return o.empty()&&(o=e.append("g").attr("class",i)),o}function Tree({semantics:e,setSvgElem:i}){console.log("rendering tree: ",e);const o=new Graph({directed:!0});o.setGraph({}),o.graph().rankdir=(e==null?void 0:e.rankdir)??"TB",o.graph().ranksep=15,o.graph().nodesep=20,o.setDefaultEdgeLabel(function(){return{}});const a=({node:g,statusPercentage:$})=>{const b='"trebuchet ms",verdana,arial,sans-serif',et=g.intermediate?7:13,_e=g.intermediate?`font: bold ${et}px ${b};`:`font: 300 ${et}px ${b};`,nt=g.intermediate?"ellipse":"rect",lt=nt==="rect"?"stroke: black; stroke-width: 1px; rx: 5px; ry: 5px;":"stroke: black; stroke-width: 1px;",it={label:wrapLines(g.label,20).join(` -`),shape:nt,style:`${lt} fill:#dff8ff;`,labelStyle:_e+"fill: black;"};g.intermediate&&(it.width=5,it.height=5,it.style=`${lt} fill:white;`),$!==void 0&&($>=70&&(it.style=`${lt} fill:#95f795;`),$<70&&$>30&&(it.style=`${lt} fill:#fdfdbe;`),$<=30&&(it.style=`${lt} fill:#ffb2b2;`)),console.log("creating node ",g.key),o.setNode(g.key,it)};if(React.useEffect(()=>{const $=select("svg").select("g"),b=render(),et=select("#tree-svg-container");if(!(et!=null&&et.node()))return;b($,o),$.attr("transform",computeResizeTransform($.node(),et.node(),13,13)+", translate(13, 13)");const _e=10;$.selectAll("g.node .annotation-circle").remove(),$.selectAll("g.node .annotation-label").remove();const nt=$.selectAll("g.node").filter(function(it){var pt;return(pt=e==null?void 0:e.nodes.get(it))==null?void 0:pt.annotation});nt.append("circle").attr("class","annotation-circle").attr("cx",function(){const it=this.parentNode;console.log("elem",it);const pt=it.getElementsByTagName("rect")[0];return pt?-pt.width.baseVal.value/2:0}).attr("cy",function(){const it=this.parentNode;console.log("elem",it);const pt=it.getElementsByTagName("rect")[0];return pt?-pt.height.baseVal.value/2:0}).attr("r",_e).style("fill","white").style("stroke","black").style("stroke-width","1px");const lt=it=>it&&it.length<2?11:8;nt.append("text").attr("class","annotation-label").style("font-size",function(){var it;return lt((it=e==null?void 0:e.nodes.get(this.parentNode.__data__))==null?void 0:it.annotation)+"px"}).attr("x",function(){const it=this.parentNode;console.log("elem",it);const pt=it.getElementsByTagName("rect")[0];return pt?-pt.width.baseVal.value/2:0}).attr("y",function(){const it=this.parentNode;console.log("elem",it);const pt=it.getElementsByTagName("rect")[0];return pt?-pt.height.baseVal.value/2+1.5:0}).attr("r",_e).text(function(){var it;return(it=c.get(this.parentNode.__data__))==null?void 0:it.annotation}),i(document.getElementById("treeSvg"))},[e]),!e)return jsxRuntimeExports.jsx("div",{children:" No AST "});const s=({from:g,to:$})=>{var et,_e;const b=((et=e.nodes.get(g))==null?void 0:et.intermediate)||((_e=e.nodes.get($))==null?void 0:_e.intermediate);o.setEdge(g,$,{curve:basis,style:"stroke: gray; fill:none; stroke-width: 1px;",minlen:b?1:2})},{nodes:c,edges:d}=e;console.log("{nodes, edges}",{nodes:c,edges:d});for(const[g,$]of c)a({node:$,statusPercentage:$.statusPercentage});for(const g of d)s({from:g.from,to:g.to});const h=` - .annotation-label { - fill: black; - text-anchor: middle; - font-weight: bold; - alignment-baseline: middle; - } - `;return jsxRuntimeExports.jsx("div",{id:"tree-svg-container",style:{width:"100%",height:"500"},children:jsxRuntimeExports.jsxs("svg",{id:"treeSvg",width:"100%",height:"100%",version:"1.1",preserveAspectRatio:"xMinYMin",viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("style",{children:h}),jsxRuntimeExports.jsx("g",{})]})})}function Diagram({ast:e,semantics:i,diagramType:o}){const[a,s]=React.useState(null),c=d=>{s(d?saveSvgUrl(d):null)};return jsxRuntimeExports.jsxs("div",{children:[a&&jsxRuntimeExports.jsx("a",{href:a,download:`${o}.svg`,children:"Download SVG"}),o==="evaporating-cloud"&&jsxRuntimeExports.jsx(Cloud,{ast:e,setSvgElem:c}),o==="goal-tree"&&jsxRuntimeExports.jsx(Tree,{semantics:i,setSvgElem:c}),o==="problem-tree"&&jsxRuntimeExports.jsx(Tree,{semantics:i,setSvgElem:c})]})}const exampleGoalTreeText=`Goal: "Make money now and in the future" -CSF_revUp: "Generate more revenue" -CSF_costsDown: "Control costs" -keepCust: "Protect relationship with existing customers" -newCust: "Acquire new customers" - -reduceInfra: "Reduce infrastructure spending" -retain: "Retain employees" -marketSalary: "Keep up with market salaries" - -morale: "Maintain employee morale" -features: "Develop new features" - -newCust <- features - -# This is probably the wrong place for 'retain' -features <- retain - -CSF_revUp <- newCust -CSF_revUp <- keepCust -CSF_costsDown <- reduceInfra -retain <- marketSalary -retain <- morale -`,exampleEvaporatingCloudText=` -A: Maximize business performance - -B: Subordinate all decisions to the financial goal - -C: Ensure people are in a state of optimal performance - -D: Subordinate people's needs to the financial goal - -B <- D: *inject* Psychological flow triggers - -D': Attend to people's needs (& let people work) -`,exampleProblemTreeText=` -UDE_bad: "Bad user experience" -cluttered: "Cluttered interface" -UDE_bad <- cluttered -ux: "Low investment in UX design" -features: "Many features added" -cluttered <- ux && features -`;let GrammarLocation$4=class{constructor(i,o){this.source=i,this.start=o}toString(){return String(this.source)}offset(i){return{line:i.line+this.start.line-1,column:i.line===1?i.column+this.start.column-1:i.column,offset:i.offset+this.start.offset}}static offsetStart(i){return i.source&&typeof i.source.offset=="function"?i.source.offset(i.start):i.start}static offsetEnd(i){return i.source&&typeof i.source.offset=="function"?i.source.offset(i.end):i.end}};var grammarLocation=GrammarLocation$4;const GrammarLocation$3=grammarLocation,setProtoOf=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,i){e.__proto__=i}||function(e,i){for(const o in i)Object.prototype.hasOwnProperty.call(i,o)&&(e[o]=i[o])};let GrammarError$3=class extends Error{constructor(i,o,a){super(i),setProtoOf(this,GrammarError$3.prototype),this.name="GrammarError",this.location=o,a===void 0&&(a=[]),this.diagnostics=a,this.stage=null,this.problems=[["error",i,o,a]]}toString(){let i=super.toString();this.location&&(i+=` - at `,this.location.source!==void 0&&this.location.source!==null&&(i+=`${this.location.source}:`),i+=`${this.location.start.line}:${this.location.start.column}`);for(const o of this.diagnostics)i+=` - from `,o.location.source!==void 0&&o.location.source!==null&&(i+=`${o.location.source}:`),i+=`${o.location.start.line}:${o.location.start.column}: ${o.message}`;return i}format(i){const o=i.map(({source:c,text:d})=>({source:c,text:d!=null?String(d).split(/\r\n|\n|\r/g):[]}));function a(c,d,h=""){let g="";const $=o.find(({source:_e})=>_e===c.source),b=c.start,et=GrammarLocation$3.offsetStart(c);if($){const _e=c.end,nt=$.text[b.line-1],it=(b.line===_e.line?_e.column:nt.length+1)-b.column||1;h&&(g+=` -note: ${h}`),g+=` - --> ${c.source}:${et.line}:${et.column} -${"".padEnd(d)} | -${et.line.toString().padStart(d)} | ${nt} -${"".padEnd(d)} | ${"".padEnd(b.column-1)}${"".padEnd(it,"^")}`}else g+=` - at ${c.source}:${et.line}:${et.column}`,h&&(g+=`: ${h}`);return g}function s(c,d,h,g=[]){let $=-1/0;h?$=g.reduce((et,{location:_e})=>Math.max(et,GrammarLocation$3.offsetStart(_e).line),h.start.line):$=Math.max.apply(null,g.map(et=>et.location.start.line)),$=$.toString().length;let b=`${c}: ${d}`;h&&(b+=a(h,$));for(const et of g)b+=a(et.location,$,et.message);return b}return this.problems.filter(c=>c[0]!=="info").map(c=>s(...c)).join(` - -`)}};var grammarError=GrammarError$3;const visitor$b={build(e){function i(d,...h){return e[d.type](d,...h)}function o(){}function a(d,...h){return i(d.expression,...h)}function s(d){return function(h,...g){h[d].forEach($=>i($,...g))}}const c={grammar(d,...h){d.topLevelInitializer&&i(d.topLevelInitializer,...h),d.initializer&&i(d.initializer,...h),d.rules.forEach(g=>i(g,...h))},top_level_initializer:o,initializer:o,rule:a,named:a,choice:s("alternatives"),action:a,sequence:s("elements"),labeled:a,text:a,simple_and:a,simple_not:a,optional:a,zero_or_more:a,one_or_more:a,repeated(d,...h){return d.delimiter&&i(d.delimiter,...h),i(d.expression,...h)},group:a,semantic_and:o,semantic_not:o,rule_ref:o,literal:o,class:o,any:o};return Object.keys(c).forEach(d=>{Object.prototype.hasOwnProperty.call(e,d)||(e[d]=c[d])}),i}};var visitor_1=visitor$b;const visitor$a=visitor_1,asts$7={findRule(e,i){for(let o=0;o1&&c.delimiter&&s(c.delimiter))},semantic_and:a,semantic_not:a,rule_ref(c){const d=asts$7.findRule(e,c.name);return d?s(d):void 0},literal(c){return c.value!==""},class:o,any:o});return s(i)}};var asts_1=asts$7;const opcodes={PUSH:0,PUSH_EMPTY_STRING:35,PUSH_UNDEFINED:1,PUSH_NULL:2,PUSH_FAILED:3,PUSH_EMPTY_ARRAY:4,PUSH_CURR_POS:5,POP:6,POP_CURR_POS:7,POP_N:8,NIP:9,APPEND:10,WRAP:11,TEXT:12,PLUCK:36,IF:13,IF_ERROR:14,IF_NOT_ERROR:15,IF_LT:30,IF_GE:31,IF_LT_DYNAMIC:32,IF_GE_DYNAMIC:33,WHILE_NOT_ERROR:16,MATCH_ANY:17,MATCH_STRING:18,MATCH_STRING_IC:19,MATCH_CHAR_CLASS:20,MATCH_REGEXP:20,ACCEPT_N:21,ACCEPT_STRING:22,FAIL:23,LOAD_SAVED_POS:24,UPDATE_SAVED_POS:25,CALL:26,RULE:27,SILENT_FAILS_ON:28,SILENT_FAILS_OFF:29,SOURCE_MAP_PUSH:37,SOURCE_MAP_POP:38,SOURCE_MAP_LABEL_PUSH:39,SOURCE_MAP_LABEL_POP:40};var opcodes_1=opcodes;const visitor$9=visitor_1,asts$6=asts_1,GrammarError$2=grammarError,ALWAYS_MATCH$1=1,SOMETIMES_MATCH$1=0,NEVER_MATCH$1=-1;function inferenceMatchResult$1(e){function i(d){return d.match=SOMETIMES_MATCH$1}function o(d){return c(d.expression),d.match=ALWAYS_MATCH$1}function a(d){return d.match=c(d.expression)}function s(d,h){const g=d.length;let $=0,b=0;for(let et=0;et0?NEVER_MATCH$1:SOMETIMES_MATCH$1}const c=visitor$9.build({rule(d){let h,g=0;if(typeof d.match>"u"){d.match=SOMETIMES_MATCH$1;do if(h=d.match,d.match=c(d.expression),++g>6)throw new GrammarError$2("Infinity cycle detected when trying to evaluate node match result",d.location);while(h!==d.match)}return d.match},named:a,choice(d){return d.match=s(d.alternatives,!0)},action:a,sequence(d){return d.match=s(d.elements,!1)},labeled:a,text:a,simple_and:a,simple_not(d){return d.match=-c(d.expression)},optional:o,zero_or_more:o,one_or_more:a,repeated(d){const h=c(d.expression),g=d.delimiter?c(d.delimiter):NEVER_MATCH$1,$=d.min?d.min:d.max;return $.type!=="constant"||d.max.type!=="constant"?d.match=SOMETIMES_MATCH$1:d.max.value===0||d.max.value!==null&&$.value>d.max.value?d.match=NEVER_MATCH$1:h===NEVER_MATCH$1?d.match=$.value===0?ALWAYS_MATCH$1:NEVER_MATCH$1:h===ALWAYS_MATCH$1?d.delimiter&&$.value>=2?d.match=g:d.match=ALWAYS_MATCH$1:d.delimiter&&$.value>=2?d.match=g===NEVER_MATCH$1?NEVER_MATCH$1:SOMETIMES_MATCH$1:d.match=$.value===0?ALWAYS_MATCH$1:SOMETIMES_MATCH$1},group:a,semantic_and:i,semantic_not:i,rule_ref(d){const h=asts$6.findRule(e,d.name);return d.match=c(h)},literal(d){const h=d.value.length===0?ALWAYS_MATCH$1:SOMETIMES_MATCH$1;return d.match=h},class(d){const h=d.parts.length===0?NEVER_MATCH$1:SOMETIMES_MATCH$1;return d.match=h},any:i});c(e)}inferenceMatchResult$1.ALWAYS_MATCH=ALWAYS_MATCH$1;inferenceMatchResult$1.SOMETIMES_MATCH=SOMETIMES_MATCH$1;inferenceMatchResult$1.NEVER_MATCH=NEVER_MATCH$1;var inferenceMatchResult_1=inferenceMatchResult$1;const asts$5=asts_1,op$1=opcodes_1,visitor$8=visitor_1,{ALWAYS_MATCH,SOMETIMES_MATCH,NEVER_MATCH}=inferenceMatchResult_1;function generateBytecode$1(e,i){const o=[],a=[],s=[],c=[],d=[];function h(dt){const mt=o.indexOf(dt);return mt===-1?o.push(dt)-1:mt}function g(dt){const mt={value:dt.parts,inverted:dt.inverted,ignoreCase:dt.ignoreCase},Ct=JSON.stringify(mt),St=a.findIndex(bt=>JSON.stringify(bt)===Ct);return St===-1?a.push(mt)-1:St}function $(dt){const mt=JSON.stringify(dt),Ct=s.findIndex(St=>JSON.stringify(St)===mt);return Ct===-1?s.push(dt)-1:Ct}function b(dt,mt,Ct){const St={predicate:dt,params:mt,body:Ct.code,location:Ct.codeLocation},bt=JSON.stringify(St),Mt=c.findIndex(Yt=>JSON.stringify(Yt)===bt);return Mt===-1?c.push(St)-1:Mt}function et(dt){return d.push(dt)-1}function _e(dt){const mt={};return Object.keys(dt).forEach(Ct=>{mt[Ct]=dt[Ct]}),mt}function nt(dt,...mt){return dt.concat(...mt)}function lt(dt,mt,Ct,St){return dt===ALWAYS_MATCH?Ct:dt===NEVER_MATCH?St:mt.concat([Ct.length,St.length],Ct,St)}function it(dt,mt){return dt.concat([mt.length],mt)}function pt(dt,mt,Ct,St){const bt=Object.keys(Ct).map(Mt=>St-Ct[Mt]);return[op$1.CALL,dt,mt,bt.length].concat(bt)}function rt(dt,mt,Ct){const St=dt.match|0;return nt([op$1.PUSH_CURR_POS],[op$1.SILENT_FAILS_ON],Dt(dt,{sp:Ct.sp+1,env:_e(Ct.env),action:null}),[op$1.SILENT_FAILS_OFF],lt(mt?-St:St,[mt?op$1.IF_ERROR:op$1.IF_NOT_ERROR],nt([op$1.POP],[mt?op$1.POP:op$1.POP_CURR_POS],[op$1.PUSH_UNDEFINED]),nt([op$1.POP],[mt?op$1.POP_CURR_POS:op$1.POP],[op$1.PUSH_FAILED])))}function ot(dt,mt,Ct){const St=b(!0,Object.keys(Ct.env),dt);return nt([op$1.UPDATE_SAVED_POS],pt(St,0,Ct.env,Ct.sp),lt(dt.match|0,[op$1.IF],nt([op$1.POP],mt?[op$1.PUSH_FAILED]:[op$1.PUSH_UNDEFINED]),nt([op$1.POP],mt?[op$1.PUSH_UNDEFINED]:[op$1.PUSH_FAILED])))}function st(dt){return it([op$1.WHILE_NOT_ERROR],nt([op$1.APPEND],dt))}function ct(dt,mt,Ct,St){switch(dt.type){case"constant":return{pre:[],post:[],sp:Ct};case"variable":return dt.sp=St+Ct-mt[dt.value],{pre:[],post:[],sp:Ct};case"function":{dt.sp=St;const bt=b(!0,Object.keys(mt),{code:dt.value,codeLocation:dt.codeLocation});return{pre:pt(bt,0,mt,Ct),post:[op$1.NIP],sp:Ct+1}}default:throw new Error(`Unknown boundary type "${dt.type}" for the "repeated" node`)}}function ft(dt,mt){if(mt.value!==null){const Ct=mt.type==="constant"?[op$1.IF_GE,mt.value]:[op$1.IF_GE_DYNAMIC,mt.sp];return lt(SOMETIMES_MATCH,Ct,[op$1.PUSH_FAILED],dt)}return dt}function wt(dt,mt){const Ct=mt.type==="constant"?[op$1.IF_LT,mt.value]:[op$1.IF_LT_DYNAMIC,mt.sp];return nt(dt,lt(SOMETIMES_MATCH,Ct,[op$1.POP,op$1.POP_CURR_POS,op$1.PUSH_FAILED],[op$1.NIP]))}function xt(dt,mt,Ct,St,bt){return dt?nt([op$1.PUSH_CURR_POS],Dt(dt,{sp:St.sp+bt+1,env:_e(St.env),action:null}),lt(dt.match|0,[op$1.IF_NOT_ERROR],nt([op$1.POP],Ct,lt(-mt,[op$1.IF_ERROR],[op$1.POP,op$1.POP_CURR_POS,op$1.PUSH_FAILED],[op$1.NIP])),[op$1.NIP])):Ct}function $t(dt){return i&&i.output==="source-and-map"&&Object.entries(dt).forEach(([mt,Ct])=>{dt[mt]=function(St,...bt){const Mt=Ct(St,...bt);return Mt===void 0||!St.location?Mt:nt([op$1.SOURCE_MAP_PUSH,et(St.location)],Mt,[op$1.SOURCE_MAP_POP])}}),visitor$8.build(dt)}const Dt=$t({grammar(dt){dt.rules.forEach(Dt),dt.literals=o,dt.classes=a,dt.expectations=s,dt.functions=c,dt.locations=d},rule(dt){dt.bytecode=Dt(dt.expression,{sp:-1,env:{},pluck:[],action:null})},named(dt,mt){const Ct=dt.match|0,St=Ct===NEVER_MATCH?null:$({type:"rule",value:dt.name});return nt([op$1.SILENT_FAILS_ON],Dt(dt.expression,mt),[op$1.SILENT_FAILS_OFF],lt(Ct,[op$1.IF_ERROR],[op$1.FAIL,St],[]))},choice(dt,mt){function Ct(St,bt){const Mt=St[0].match|0,Yt=Dt(St[0],{sp:bt.sp,env:_e(bt.env),action:null});return Mt===ALWAYS_MATCH?Yt:nt(Yt,St.length>1?lt(SOMETIMES_MATCH,[op$1.IF_ERROR],nt([op$1.POP],Ct(St.slice(1),bt)),[]):[])}return Ct(dt.alternatives,mt)},action(dt,mt){const Ct=_e(mt.env),St=dt.expression.type!=="sequence"||dt.expression.elements.length===0,bt=Dt(dt.expression,{sp:mt.sp+(St?1:0),env:Ct,action:dt}),Mt=dt.expression.match|0,Yt=St&&Mt!==NEVER_MATCH?b(!1,Object.keys(Ct),dt):null;return St?nt([op$1.PUSH_CURR_POS],bt,lt(Mt,[op$1.IF_NOT_ERROR],nt([op$1.LOAD_SAVED_POS,1],pt(Yt,1,Ct,mt.sp+2)),[]),[op$1.NIP]):bt},sequence(dt,mt){function Ct(St,bt){if(St.length>0){const Mt=dt.elements.length-St.length+1;return nt(Dt(St[0],{sp:bt.sp,env:bt.env,pluck:bt.pluck,action:null}),lt(St[0].match|0,[op$1.IF_NOT_ERROR],Ct(St.slice(1),{sp:bt.sp+1,env:bt.env,pluck:bt.pluck,action:bt.action}),nt(Mt>1?[op$1.POP_N,Mt]:[op$1.POP],[op$1.POP_CURR_POS],[op$1.PUSH_FAILED])))}else{if(bt.pluck.length>0)return nt([op$1.PLUCK,dt.elements.length+1,bt.pluck.length],bt.pluck.map(Mt=>bt.sp-Mt));if(bt.action){const Mt=b(!1,Object.keys(bt.env),bt.action);return nt([op$1.LOAD_SAVED_POS,dt.elements.length],pt(Mt,dt.elements.length+1,bt.env,bt.sp))}else return nt([op$1.WRAP,dt.elements.length],[op$1.NIP])}}return nt([op$1.PUSH_CURR_POS],Ct(dt.elements,{sp:mt.sp+1,env:mt.env,pluck:[],action:mt.action}))},labeled(dt,mt){let Ct=mt.env;const St=dt.label,bt=mt.sp+1;St&&(Ct=_e(mt.env),mt.env[dt.label]=bt),dt.pick&&mt.pluck.push(bt);const Mt=Dt(dt.expression,{sp:mt.sp,env:Ct,action:null});return St&&dt.labelLocation&&i&&i.output==="source-and-map"?nt([op$1.SOURCE_MAP_LABEL_PUSH,bt,h(St),et(dt.labelLocation)],Mt,[op$1.SOURCE_MAP_LABEL_POP,bt]):Mt},text(dt,mt){return nt([op$1.PUSH_CURR_POS],Dt(dt.expression,{sp:mt.sp+1,env:_e(mt.env),action:null}),lt(dt.match|0,[op$1.IF_NOT_ERROR],nt([op$1.POP],[op$1.TEXT]),[op$1.NIP]))},simple_and(dt,mt){return rt(dt.expression,!1,mt)},simple_not(dt,mt){return rt(dt.expression,!0,mt)},optional(dt,mt){return nt(Dt(dt.expression,{sp:mt.sp,env:_e(mt.env),action:null}),lt(-(dt.expression.match|0),[op$1.IF_ERROR],nt([op$1.POP],[op$1.PUSH_NULL]),[]))},zero_or_more(dt,mt){const Ct=Dt(dt.expression,{sp:mt.sp+1,env:_e(mt.env),action:null});return nt([op$1.PUSH_EMPTY_ARRAY],Ct,st(Ct),[op$1.POP])},one_or_more(dt,mt){const Ct=Dt(dt.expression,{sp:mt.sp+1,env:_e(mt.env),action:null});return nt([op$1.PUSH_EMPTY_ARRAY],Ct,lt(dt.expression.match|0,[op$1.IF_NOT_ERROR],nt(st(Ct),[op$1.POP]),nt([op$1.POP],[op$1.POP],[op$1.PUSH_FAILED])))},repeated(dt,mt){const Ct=dt.min?dt.min:dt.max,St=Ct.type!=="constant"||Ct.value>0,bt=dt.max.type!=="constant"&&dt.max.value!==null,Mt=St?2:1,Yt=dt.min?ct(dt.min,mt.env,mt.sp,2+(dt.max.type==="function"?1:0)):{pre:[],post:[],sp:mt.sp},zt=ct(dt.max,mt.env,Yt.sp,Mt),Ft=Dt(dt.expression,{sp:zt.sp+Mt,env:_e(mt.env),action:null}),kt=dt.delimiter!==null?Dt(dt.expression,{sp:zt.sp+Mt+1,env:_e(mt.env),action:null}):Ft,Lt=xt(dt.delimiter,dt.expression.match|0,kt,mt,Mt),Vt=ft(Lt,dt.max),Gt=bt?ft(Ft,dt.max):Ft,on=nt(St?[op$1.PUSH_CURR_POS]:[],[op$1.PUSH_EMPTY_ARRAY],Gt,st(Vt),[op$1.POP]);return nt(Yt.pre,zt.pre,St?wt(on,Ct):on,zt.post,Yt.post)},group(dt,mt){return Dt(dt.expression,{sp:mt.sp,env:_e(mt.env),action:null})},semantic_and(dt,mt){return ot(dt,!1,mt)},semantic_not(dt,mt){return ot(dt,!0,mt)},rule_ref(dt){return[op$1.RULE,asts$5.indexOfRule(e,dt.name)]},literal(dt){if(dt.value.length>0){const mt=dt.match|0,St=mt===SOMETIMES_MATCH||mt===ALWAYS_MATCH&&!dt.ignoreCase?h(dt.ignoreCase?dt.value.toLowerCase():dt.value):null,bt=mt!==ALWAYS_MATCH?$({type:"literal",value:dt.value,ignoreCase:dt.ignoreCase}):null;return lt(mt,dt.ignoreCase?[op$1.MATCH_STRING_IC,St]:[op$1.MATCH_STRING,St],dt.ignoreCase?[op$1.ACCEPT_N,dt.value.length]:[op$1.ACCEPT_STRING,St],[op$1.FAIL,bt])}return[op$1.PUSH_EMPTY_STRING]},class(dt){const mt=dt.match|0,Ct=mt===SOMETIMES_MATCH?g(dt):null,St=mt!==ALWAYS_MATCH?$({type:"class",value:dt.parts,inverted:dt.inverted,ignoreCase:dt.ignoreCase}):null;return lt(mt,[op$1.MATCH_CHAR_CLASS,Ct],[op$1.ACCEPT_N,1],[op$1.FAIL,St])},any(dt){const mt=dt.match|0,Ct=mt!==ALWAYS_MATCH?$({type:"any"}):null;return lt(mt,[op$1.MATCH_ANY],[op$1.ACCEPT_N,1],[op$1.FAIL,Ct])}});Dt(e)}var generateBytecode_1=generateBytecode$1,sourceMap={},sourceMapGenerator={},base64Vlq={},base64$3={};const intToCharMap="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");base64$3.encode=function(e){if(0<=e&&e>>=VLQ_BASE_SHIFT,s>0&&(a|=VLQ_CONTINUATION_BIT),o+=base64$2.encode(a);while(s>0);return o};var util$3={};function getArg(e,i,o){if(i in e)return e[i];if(arguments.length===3)return o;throw new Error('"'+i+'" is a required argument.')}util$3.getArg=getArg;const supportsNullProto=function(){return!("__proto__"in Object.create(null))}();function identity(e){return e}function toSetString(e){return isProtoString(e)?"$"+e:e}util$3.toSetString=supportsNullProto?identity:toSetString;function fromSetString(e){return isProtoString(e)?e.slice(1):e}util$3.fromSetString=supportsNullProto?identity:fromSetString;function isProtoString(e){if(!e)return!1;const i=e.length;if(i<9||e.charCodeAt(i-1)!==95||e.charCodeAt(i-2)!==95||e.charCodeAt(i-3)!==111||e.charCodeAt(i-4)!==116||e.charCodeAt(i-5)!==111||e.charCodeAt(i-6)!==114||e.charCodeAt(i-7)!==112||e.charCodeAt(i-8)!==95||e.charCodeAt(i-9)!==95)return!1;for(let o=i-10;o>=0;o--)if(e.charCodeAt(o)!==36)return!1;return!0}function strcmp(e,i){return e===i?0:e===null?1:i===null?-1:e>i?1:-1}function compareByGeneratedPositionsInflated(e,i){let o=e.generatedLine-i.generatedLine;return o!==0||(o=e.generatedColumn-i.generatedColumn,o!==0)||(o=strcmp(e.source,i.source),o!==0)||(o=e.originalLine-i.originalLine,o!==0)||(o=e.originalColumn-i.originalColumn,o!==0)?o:strcmp(e.name,i.name)}util$3.compareByGeneratedPositionsInflated=compareByGeneratedPositionsInflated;const PROTOCOL="http:",PROTOCOL_AND_HOST=`${PROTOCOL}//host`;function createSafeHandler(e){return i=>{const o=getURLType(i),a=buildSafeBase(i),s=new URL(i,a);e(s);const c=s.toString();return o==="absolute"?c:o==="scheme-relative"?c.slice(PROTOCOL.length):o==="path-absolute"?c.slice(PROTOCOL_AND_HOST.length):computeRelativeURL(a,c)}}function withBase(e,i){return new URL(e,i).toString()}function buildUniqueSegment(e,i){let o=0;do{const a=e+o++;if(i.indexOf(a)===-1)return a}while(!0)}function buildSafeBase(e){const i=e.split("..").length-1,o=buildUniqueSegment("p",e);let a=`${PROTOCOL_AND_HOST}/`;for(let s=0;s0&&!a[a.length-1]&&a.pop();o.length>0&&a.length>0&&o[0]===a[0];)o.shift(),a.shift();return a.map(()=>"..").concat(o).join("/")+i.search+i.hash}const ensureDirectory=createSafeHandler(e=>{e.pathname=e.pathname.replace(/\/?$/,"/")}),normalize=createSafeHandler(e=>{});util$3.normalize=normalize;function join(e,i){const o=getURLType(i),a=getURLType(e);if(e=ensureDirectory(e),o==="absolute")return withBase(i,void 0);if(a==="absolute")return withBase(i,e);if(o==="scheme-relative")return normalize(i);if(a==="scheme-relative")return withBase(i,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL.length);if(o==="path-absolute")return normalize(i);if(a==="path-absolute")return withBase(i,withBase(e,PROTOCOL_AND_HOST)).slice(PROTOCOL_AND_HOST.length);const s=buildSafeBase(i+e),c=withBase(i,withBase(e,s));return computeRelativeURL(s,c)}util$3.join=join;function relative(e,i){const o=relativeIfPossible(e,i);return typeof o=="string"?o:normalize(i)}util$3.relative=relative;function relativeIfPossible(e,i){if(getURLType(e)!==getURLType(i))return null;const a=buildSafeBase(e+i),s=new URL(e,a),c=new URL(i,a);try{new URL("",c.toString())}catch{return null}return c.protocol!==s.protocol||c.user!==s.user||c.password!==s.password||c.hostname!==s.hostname||c.port!==s.port?null:computeRelativeURL(s,c)}var arraySet={};let ArraySet$1=class{constructor(){this._array=[],this._set=new Map}static fromArray(i,o){const a=new ArraySet$1;for(let s=0,c=i.length;s=0)return o;throw new Error('"'+i+'" is not in the set.')}at(i){if(i>=0&&io||a==o&&c>=s||util$2.compareByGeneratedPositionsInflated(e,i)<=0}let MappingList$1=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(i,o){this._array.forEach(i,o)}add(i){generatedPositionAfter(this._last,i)?(this._last=i,this._array.push(i)):(this._sorted=!1,this._array.push(i))}toArray(){return this._sorted||(this._array.sort(util$2.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}};mappingList.MappingList=MappingList$1;const base64VLQ=base64Vlq,util$1=util$3,ArraySet=arraySet.ArraySet,MappingList=mappingList.MappingList;let SourceMapGenerator$1=class{constructor(i){i||(i={}),this._file=util$1.getArg(i,"file",null),this._sourceRoot=util$1.getArg(i,"sourceRoot",null),this._skipValidation=util$1.getArg(i,"skipValidation",!1),this._sources=new ArraySet,this._names=new ArraySet,this._mappings=new MappingList,this._sourcesContents=null}static fromSourceMap(i){const o=i.sourceRoot,a=new SourceMapGenerator$1({file:i.file,sourceRoot:o});return i.eachMapping(function(s){const c={generated:{line:s.generatedLine,column:s.generatedColumn}};s.source!=null&&(c.source=s.source,o!=null&&(c.source=util$1.relative(o,c.source)),c.original={line:s.originalLine,column:s.originalColumn},s.name!=null&&(c.name=s.name)),a.addMapping(c)}),i.sources.forEach(function(s){let c=s;o!=null&&(c=util$1.relative(o,s)),a._sources.has(c)||a._sources.add(c);const d=i.sourceContentFor(s);d!=null&&a.setSourceContent(s,d)}),a}addMapping(i){const o=util$1.getArg(i,"generated"),a=util$1.getArg(i,"original",null);let s=util$1.getArg(i,"source",null),c=util$1.getArg(i,"name",null);this._skipValidation||this._validateMapping(o,a,s,c),s!=null&&(s=String(s),this._sources.has(s)||this._sources.add(s)),c!=null&&(c=String(c),this._names.has(c)||this._names.add(c)),this._mappings.add({generatedLine:o.line,generatedColumn:o.column,originalLine:a&&a.line,originalColumn:a&&a.column,source:s,name:c})}setSourceContent(i,o){let a=i;this._sourceRoot!=null&&(a=util$1.relative(this._sourceRoot,a)),o!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[util$1.toSetString(a)]=o):this._sourcesContents&&(delete this._sourcesContents[util$1.toSetString(a)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))}applySourceMap(i,o,a){let s=o;if(o==null){if(i.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);s=i.file}const c=this._sourceRoot;c!=null&&(s=util$1.relative(c,s));const d=this._mappings.toArray().length>0?new ArraySet:this._sources,h=new ArraySet;this._mappings.unsortedForEach(function(g){if(g.source===s&&g.originalLine!=null){const et=i.originalPositionFor({line:g.originalLine,column:g.originalColumn});et.source!=null&&(g.source=et.source,a!=null&&(g.source=util$1.join(a,g.source)),c!=null&&(g.source=util$1.relative(c,g.source)),g.originalLine=et.line,g.originalColumn=et.column,et.name!=null&&(g.name=et.name))}const $=g.source;$!=null&&!d.has($)&&d.add($);const b=g.name;b!=null&&!h.has(b)&&h.add(b)},this),this._sources=d,this._names=h,i.sources.forEach(function(g){const $=i.sourceContentFor(g);$!=null&&(a!=null&&(g=util$1.join(a,g)),c!=null&&(g=util$1.relative(c,g)),this.setSourceContent(g,$))},this)}_validateMapping(i,o,a,s){if(o&&typeof o.line!="number"&&typeof o.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(i&&"line"in i&&"column"in i&&i.line>0&&i.column>=0&&!o&&!a&&!s)){if(!(i&&"line"in i&&"column"in i&&o&&"line"in o&&"column"in o&&i.line>0&&i.column>=0&&o.line>0&&o.column>=0&&a))throw new Error("Invalid mapping: "+JSON.stringify({generated:i,source:a,original:o,name:s}))}}_serializeMappings(){let i=0,o=1,a=0,s=0,c=0,d=0,h="",g,$,b,et;const _e=this._mappings.toArray();for(let nt=0,lt=_e.length;nt0){if(!util$1.compareByGeneratedPositionsInflated($,_e[nt-1]))continue;g+=","}g+=base64VLQ.encode($.generatedColumn-i),i=$.generatedColumn,$.source!=null&&(et=this._sources.indexOf($.source),g+=base64VLQ.encode(et-d),d=et,g+=base64VLQ.encode($.originalLine-1-s),s=$.originalLine-1,g+=base64VLQ.encode($.originalColumn-a),a=$.originalColumn,$.name!=null&&(b=this._names.indexOf($.name),g+=base64VLQ.encode(b-c),c=b)),h+=g}return h}_generateSourcesContent(i,o){return i.map(function(a){if(!this._sourcesContents)return null;o!=null&&(a=util$1.relative(o,a));const s=util$1.toSetString(a);return Object.prototype.hasOwnProperty.call(this._sourcesContents,s)?this._sourcesContents[s]:null},this)}toJSON(){const i={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(i.file=this._file),this._sourceRoot!=null&&(i.sourceRoot=this._sourceRoot),this._sourcesContents&&(i.sourcesContent=this._generateSourcesContent(i.sources,i.sourceRoot)),i}toString(){return JSON.stringify(this.toJSON())}};SourceMapGenerator$1.prototype._version=3;sourceMapGenerator.SourceMapGenerator=SourceMapGenerator$1;var sourceNode={};const SourceMapGenerator=sourceMapGenerator.SourceMapGenerator,util=util$3,REGEX_NEWLINE=/(\r?\n)/,NEWLINE_CODE=10,isSourceNode="$$$isSourceNode$$$";let SourceNode$2=class{constructor(i,o,a,s,c){this.children=[],this.sourceContents={},this.line=i??null,this.column=o??null,this.source=a??null,this.name=c??null,this[isSourceNode]=!0,s!=null&&this.add(s)}static fromStringWithSourceMap(i,o,a){const s=new SourceNode$2,c=i.split(REGEX_NEWLINE);let d=0;const h=function(){const nt=it(),lt=it()||"";return nt+lt;function it(){return d=0;o--)this.prepend(i[o]);else if(i[isSourceNode]||typeof i=="string")this.children.unshift(i);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+i);return this}walk(i){let o;for(let a=0,s=this.children.length;a0){for(o=[],a=0;a' at an index ${i}. -Bytecode: ${this.bytecode}`);return this.varName+i}static sourceNode(i,o,a){const s=GrammarLocation$2.offsetStart(i);return new SourceNode$1(s.line,s.column?s.column-1:null,String(i.source),o,a)}push(i){++this.sp>this.maxSp&&(this.maxSp=this.sp);const o=this.labels[this.sp],a=[this.name(this.sp)," = ",i,";"];if(o)if(this.sourceMapStack.length){const s=Stack$1.sourceNode(o.location,a.splice(0,2),o.label),{parts:c,location:d}=this.sourceMapPopInternal(),h=d.start.offsetthis.name(this.sp+1+a))):this.name(this.sp--)}top(){return this.name(this.sp)}index(i){if(i<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack overflow: attempt to get a variable at a negative index ${i}. -Bytecode: ${this.bytecode}`);return this.name(this.sp-i)}result(){if(this.maxSp<0)throw new RangeError(`Rule '${this.ruleName}': The variable stack is empty, can't get the result. -Bytecode: ${this.bytecode}`);return this.name(0)}defines(){return this.maxSp<0?"":this.type+" "+Array.from({length:this.maxSp+1},(i,o)=>this.name(o)).join(", ")+";"}checkedIf(i,o,a){const s=this.sp;if(o(),a){const c=this.sp;if(this.sp=s,a(),c!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+i+": Branches of a condition can't move the stack pointer differently (before: "+s+", after then: "+c+", after else: "+this.sp+"). Bytecode: "+this.bytecode)}}checkedLoop(i,o){const a=this.sp;if(o(),a!==this.sp)throw new Error("Rule '"+this.ruleName+"', position "+i+": Body of a loop can't move the stack pointer (before: "+a+", after: "+this.sp+"). Bytecode: "+this.bytecode)}sourceMapPush(i,o){if(this.sourceMapStack.length){const a=this.sourceMapStack[this.sourceMapStack.length-1];a[2].start.offset===o.start.offset&&a[2].end.offset>o.end.offset&&(a[2]={start:o.end,end:a[2].end,source:a[2].source})}this.sourceMapStack.push([i,i.length,o])}sourceMapPopInternal(){const[i,o,a]=this.sourceMapStack.pop(),s=i.splice(o).map(c=>c instanceof SourceNode$1?c:c+` -`);if(s.length){const c=GrammarLocation$2.offsetStart(a);i.push(new SourceNode$1(c.line,c.column-1,String(a.source),s))}return{parts:i,location:a}}sourceMapPop(i){const{location:o}=this.sourceMapPopInternal();if(this.sourceMapStack.length&&o.end.offset"\\x0"+hex(i)).replace(/[\x10-\x1F\x7F-\xFF]/g,i=>"\\x"+hex(i)).replace(/[\u0100-\u0FFF]/g,i=>"\\u0"+hex(i)).replace(/[\u1000-\uFFFF]/g,i=>"\\u"+hex(i))}utils.stringEscape=stringEscape$1;function regexpClassEscape$1(e){return e.replace(/\\/g,"\\\\").replace(/\//g,"\\/").replace(/]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\v/g,"\\v").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,i=>"\\x0"+hex(i)).replace(/[\x10-\x1F\x7F-\xFF]/g,i=>"\\x"+hex(i)).replace(/[\u0100-\u0FFF]/g,i=>"\\u0"+hex(i)).replace(/[\u1000-\uFFFF]/g,i=>"\\u"+hex(i))}utils.regexpClassEscape=regexpClassEscape$1;function base64$1(e){const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=e.length%3,a=e.length-o;let s="";for(let c=0;c>2],s+=i[(e[c]&3)<<4|e[c+1]>>4],s+=i[(e[c+1]&15)<<2|e[c+2]>>6],s+=i[e[c+2]&63];return o===1?(s+=i[e[a]>>2],s+=i[(e[a]&3)<<4],s+="=="):o===2&&(s+=i[e[a]>>2],s+=i[(e[a]&3)<<4|e[a+1]>>4],s+=i[(e[a+1]&15)<<2],s+="="),s}utils.base64=base64$1;const asts$4=asts_1,op=opcodes_1,Stack=stack,VERSION$1=version,{stringEscape,regexpClassEscape}=utils,{SourceNode}=sourceMap,GrammarLocation$1=grammarLocation;function toSourceNode(e,i,o){const a=GrammarLocation$1.offsetStart(i),s=a.line,c=a.column-1,d=e.split(` -`);return d.length===1?new SourceNode(s,c,String(i.source),e,o):new SourceNode(null,null,String(i.source),d.map((h,g)=>new SourceNode(s+g,g===0?c:0,String(i.source),g===d.length-1?h:[h,` -`],o)))}function wrapInSourceNode(e,i,o,a,s){if(o){const c=GrammarLocation$1.offsetEnd(o);return new SourceNode(null,null,String(o.source),[e,toSourceNode(i,o,s),new SourceNode(c.line,c.column-1,String(o.source),a)])}return new SourceNode(null,null,null,[e,i,a])}function generateJS$1(e,i){function o(it){let pt=!0,rt=0;function ot(st){return Array.isArray(st)?st.map(ot):st instanceof SourceNode?(rt++,st.children=ot(st.children),rt--,st):(pt?st=st.replace(/^(.+)$/gm," $1"):st=st.replace(/\n(\s*\S)/g,` - $1`),pt=!rt||st.endsWith(` -`),st)}return ot(it)}function a(it){return"peg$c"+it}function s(it){return"peg$r"+it}function c(it){return"peg$e"+it}function d(it){return"peg$f"+it}function h(it){return"peg$parse"+it}function g(){function it(st){return'"'+stringEscape(st)+'"'}function pt(st){return"/^["+(st.inverted?"^":"")+st.value.map(ct=>Array.isArray(ct)?regexpClassEscape(ct[0])+"-"+regexpClassEscape(ct[1]):regexpClassEscape(ct)).join("")+"]/"+(st.ignoreCase?"i":"")}function rt(st){switch(st.type){case"rule":return'peg$otherExpectation("'+stringEscape(st.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape(st.value)+'", '+st.ignoreCase+")";case"class":return"peg$classExpectation(["+st.value.map(ft=>Array.isArray(ft)?'["'+stringEscape(ft[0])+'", "'+stringEscape(ft[1])+'"]':'"'+stringEscape(ft)+'"').join(", ")+"], "+st.inverted+", "+st.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(st)+")")}}function ot(st,ct){return wrapInSourceNode(` - var ${d(ct)} = function(${st.params.join(", ")}) {`,st.body,st.location,"};")}return new SourceNode(null,null,i.grammarSource,[e.literals.map((st,ct)=>" var "+a(ct)+" = "+it(st)+";").concat("",e.classes.map((st,ct)=>" var "+s(ct)+" = "+pt(st)+";")).concat("",e.expectations.map((st,ct)=>" var "+c(ct)+" = "+rt(st)+";")).concat("").join(` -`),e.functions.map(ot)])}function $(it,pt){const rt=[];return rt.push(""),i.trace&&rt.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+it+","," location: peg$computeLocation(startPos, startPos, true)","});",""),i.cache&&(rt.push("var key = peg$currPos * "+e.rules.length+" + "+pt+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),i.trace&&rt.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+it+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+it+","," location: peg$computeLocation(startPos, startPos, true)"," });","}",""),rt.push(" return cached.result;","}","")),rt}function b(it,pt){const rt=[];return i.cache&&rt.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+pt+" };"),i.trace&&rt.push("","if ("+pt+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+it+","," result: "+pt+","," location: peg$computeLocation(startPos, peg$currPos, true)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+it+","," location: peg$computeLocation(startPos, startPos, true)"," });","}"),rt.push("","return "+pt+";"),rt}function et(it){const pt=[],rt=new Stack(it.name,"s","var",it.bytecode);function ot(ct){let ft=0;const wt=ct.length,xt=[];let $t;function Dt(Ct,St){const bt=St+3,Mt=ct[ft+bt-2],Yt=ct[ft+bt-1];let zt,Ft;rt.checkedIf(ft,()=>{ft+=bt,zt=ot(ct.slice(ft,ft+Mt)),ft+=Mt},Yt>0?()=>{Ft=ot(ct.slice(ft,ft+Yt)),ft+=Yt}:null),xt.push("if ("+Ct+") {"),xt.push(...o(zt)),Yt>0&&(xt.push("} else {"),xt.push(...o(Ft))),xt.push("}")}function dt(Ct){const bt=ct[ft+2-1];let Mt;rt.checkedLoop(ft,()=>{ft+=2,Mt=ot(ct.slice(ft,ft+bt)),ft+=bt}),xt.push("while ("+Ct+") {"),xt.push(...o(Mt)),xt.push("}")}function mt(Ct){const St=ct[ft+Ct-1];return d(ct[ft+1])+"("+ct.slice(ft+Ct,ft+Ct+St).map(bt=>rt.index(bt)).join(", ")+")"}for(;ftrt.index(Mt)).join(", ")} ]`,rt.pop(ct[ft+1]),xt.push(rt.push($t)),ft+=bt;break}case op.IF:Dt(rt.top(),0);break;case op.IF_ERROR:Dt(rt.top()+" === peg$FAILED",0);break;case op.IF_NOT_ERROR:Dt(rt.top()+" !== peg$FAILED",0);break;case op.IF_LT:Dt(rt.top()+".length < "+ct[ft+1],1);break;case op.IF_GE:Dt(rt.top()+".length >= "+ct[ft+1],1);break;case op.IF_LT_DYNAMIC:Dt(rt.top()+".length < ("+rt.index(ct[ft+1])+"|0)",1);break;case op.IF_GE_DYNAMIC:Dt(rt.top()+".length >= ("+rt.index(ct[ft+1])+"|0)",1);break;case op.WHILE_NOT_ERROR:dt(rt.top()+" !== peg$FAILED");break;case op.MATCH_ANY:Dt("input.length > peg$currPos",0);break;case op.MATCH_STRING:Dt(e.literals[ct[ft+1]].length>1?"input.substr(peg$currPos, "+e.literals[ct[ft+1]].length+") === "+a(ct[ft+1]):"input.charCodeAt(peg$currPos) === "+e.literals[ct[ft+1]].charCodeAt(0),1);break;case op.MATCH_STRING_IC:Dt("input.substr(peg$currPos, "+e.literals[ct[ft+1]].length+").toLowerCase() === "+a(ct[ft+1]),1);break;case op.MATCH_CHAR_CLASS:Dt(s(ct[ft+1])+".test(input.charAt(peg$currPos))",1);break;case op.ACCEPT_N:xt.push(rt.push(ct[ft+1]>1?"input.substr(peg$currPos, "+ct[ft+1]+")":"input.charAt(peg$currPos)")),xt.push(ct[ft+1]>1?"peg$currPos += "+ct[ft+1]+";":"peg$currPos++;"),ft+=2;break;case op.ACCEPT_STRING:xt.push(rt.push(a(ct[ft+1]))),xt.push(e.literals[ct[ft+1]].length>1?"peg$currPos += "+e.literals[ct[ft+1]].length+";":"peg$currPos++;"),ft+=2;break;case op.FAIL:xt.push(rt.push("peg$FAILED")),xt.push("if (peg$silentFails === 0) { peg$fail("+c(ct[ft+1])+"); }"),ft+=2;break;case op.LOAD_SAVED_POS:xt.push("peg$savedPos = "+rt.index(ct[ft+1])+";"),ft+=2;break;case op.UPDATE_SAVED_POS:xt.push("peg$savedPos = peg$currPos;"),ft++;break;case op.CALL:$t=mt(4),rt.pop(ct[ft+2]),xt.push(rt.push($t)),ft+=4+ct[ft+3];break;case op.RULE:xt.push(rt.push(h(e.rules[ct[ft+1]].name)+"()")),ft+=2;break;case op.SILENT_FAILS_ON:xt.push("peg$silentFails++;"),ft++;break;case op.SILENT_FAILS_OFF:xt.push("peg$silentFails--;"),ft++;break;case op.SOURCE_MAP_PUSH:rt.sourceMapPush(xt,e.locations[ct[ft+1]]),ft+=2;break;case op.SOURCE_MAP_POP:{rt.sourceMapPop(),ft++;break}case op.SOURCE_MAP_LABEL_PUSH:rt.labels[ct[ft+1]]={label:e.literals[ct[ft+2]],location:e.locations[ct[ft+3]]},ft+=4;break;case op.SOURCE_MAP_LABEL_POP:delete rt.labels[ct[ft+1]],ft+=2;break;default:throw new Error("Invalid opcode: "+ct[ft]+".",{rule:it.name,bytecode:ct})}return xt}const st=ot(it.bytecode);return pt.push(wrapInSourceNode("function ",h(it.name),it.nameLocation,`() { -`,it.name)),i.trace&&pt.push(" var startPos = peg$currPos;"),pt.push(o(rt.defines())),pt.push(...o($('"'+stringEscape(it.name)+'"',asts$4.indexOfRule(e,it.name)))),pt.push(...o(st)),pt.push(...o(b('"'+stringEscape(it.name)+'"',rt.result()))),pt.push("}"),pt}function _e(it){return it.codeLocation?toSourceNode(it.code,it.codeLocation,"$"+it.type):it.code}function nt(){const it=[];e.topLevelInitializer&&(it.push(_e(e.topLevelInitializer)),it.push("")),it.push("function peg$subclass(child, parent) {"," function C() { this.constructor = child; }"," C.prototype = parent.prototype;"," child.prototype = new C();","}","","function peg$SyntaxError(message, expected, found, location) {"," var self = Error.call(this, message);"," // istanbul ignore next Check is a necessary evil to support older environments"," if (Object.setPrototypeOf) {"," Object.setPrototypeOf(self, peg$SyntaxError.prototype);"," }"," self.expected = expected;"," self.found = found;"," self.location = location;",' self.name = "SyntaxError";'," return self;","}","","peg$subclass(peg$SyntaxError, Error);","","function peg$padEnd(str, targetLength, padString) {",' padString = padString || " ";'," if (str.length > targetLength) { return str; }"," targetLength -= str.length;"," padString += padString.repeat(targetLength);"," return str + padString.slice(0, targetLength);","}","","peg$SyntaxError.prototype.format = function(sources) {",' var str = "Error: " + this.message;'," if (this.location) {"," var src = null;"," var k;"," for (k = 0; k < sources.length; k++) {"," if (sources[k].source === this.location.source) {"," src = sources[k].text.split(/\\r\\n|\\n|\\r/g);"," break;"," }"," }"," var s = this.location.start;",' var offset_s = (this.location.source && (typeof this.location.source.offset === "function"))'," ? this.location.source.offset(s)"," : s;",' var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;'," if (src) {"," var e = this.location.end;",` var filler = peg$padEnd("", offset_s.line.toString().length, ' ');`," var line = src[s.line - 1];"," var last = s.line === e.line ? e.column : line.length + 1;"," var hatLen = (last - s.column) || 1;",' str += "\\n --> " + loc + "\\n"',' + filler + " |\\n"',' + offset_s.line + " | " + line + "\\n"',` + filler + " | " + peg$padEnd("", s.column - 1, ' ')`,' + peg$padEnd("", hatLen, "^");'," } else {",' str += "\\n at " + loc;'," }"," }"," return str;","};","","peg$SyntaxError.buildMessage = function(expected, found) {"," var DESCRIBE_EXPECTATION_FNS = {"," literal: function(expectation) {",' return "\\"" + literalEscape(expectation.text) + "\\"";'," },",""," class: function(expectation) {"," var escapedParts = expectation.parts.map(function(part) {"," return Array.isArray(part)",' ? classEscape(part[0]) + "-" + classEscape(part[1])'," : classEscape(part);"," });","",' return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";'," },",""," any: function() {",' return "any character";'," },",""," end: function() {",' return "end of input";'," },",""," other: function(expectation) {"," return expectation.description;"," }"," };",""," function hex(ch) {"," return ch.charCodeAt(0).toString(16).toUpperCase();"," }",""," function literalEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/"/g, "\\\\\\"")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function classEscape(s) {"," return s",' .replace(/\\\\/g, "\\\\\\\\")',' .replace(/\\]/g, "\\\\]")',' .replace(/\\^/g, "\\\\^")',' .replace(/-/g, "\\\\-")',' .replace(/\\0/g, "\\\\0")',' .replace(/\\t/g, "\\\\t")',' .replace(/\\n/g, "\\\\n")',' .replace(/\\r/g, "\\\\r")',' .replace(/[\\x00-\\x0F]/g, function(ch) { return "\\\\x0" + hex(ch); })',' .replace(/[\\x10-\\x1F\\x7F-\\x9F]/g, function(ch) { return "\\\\x" + hex(ch); });'," }",""," function describeExpectation(expectation) {"," return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);"," }",""," function describeExpected(expected) {"," var descriptions = expected.map(describeExpectation);"," var i, j;",""," descriptions.sort();",""," if (descriptions.length > 0) {"," for (i = 1, j = 1; i < descriptions.length; i++) {"," if (descriptions[i - 1] !== descriptions[i]) {"," descriptions[j] = descriptions[i];"," j++;"," }"," }"," descriptions.length = j;"," }",""," switch (descriptions.length) {"," case 1:"," return descriptions[0];",""," case 2:",' return descriptions[0] + " or " + descriptions[1];',""," default:",' return descriptions.slice(0, -1).join(", ")',' + ", or "'," + descriptions[descriptions.length - 1];"," }"," }",""," function describeFound(found) {",' return found ? "\\"" + literalEscape(found) + "\\"" : "end of input";'," }","",' return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";',"};",""),i.trace&&it.push("function peg$DefaultTracer() {"," this.indentLevel = 0;","}","","peg$DefaultTracer.prototype.trace = function(event) {"," var that = this;",""," function log(event) {"," function repeat(string, n) {",' var result = "", i;',""," for (i = 0; i < n; i++) {"," result += string;"," }",""," return result;"," }",""," function pad(string, length) {",' return string + repeat(" ", length - string.length);'," }","",' if (typeof console === "object") {'," console.log(",' event.location.start.line + ":" + event.location.start.column + "-"',' + event.location.end.line + ":" + event.location.end.column + " "',' + pad(event.type, 10) + " "',' + repeat(" ", that.indentLevel) + event.rule'," );"," }"," }",""," switch (event.type) {",' case "rule.enter":'," log(event);"," this.indentLevel++;"," break;","",' case "rule.match":'," this.indentLevel--;"," log(event);"," break;","",' case "rule.fail":'," this.indentLevel--;"," log(event);"," break;",""," default:",' throw new Error("Invalid event type: " + event.type + ".");'," }","};","");const pt="{ "+i.allowedStartRules.map(ot=>ot+": "+h(ot)).join(", ")+" }",rt=h(i.allowedStartRules[0]);return it.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+pt+";"," var peg$startRuleFunction = "+rt+";","",g(),""," var peg$currPos = 0;"," var peg$savedPos = 0;"," var peg$posDetailsCache = [{ line: 1, column: 1 }];"," var peg$maxFailPos = 0;"," var peg$maxFailExpected = [];"," var peg$silentFails = 0;",""),i.cache&&it.push(" var peg$resultsCache = {};",""),i.trace&&it.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),it.push(" var peg$result;","",' if ("startRule" in options) {'," if (!(options.startRule in peg$startRuleFunctions)) {",` throw new Error("Can't start parsing from rule \\"" + options.startRule + "\\".");`," }",""," peg$startRuleFunction = peg$startRuleFunctions[options.startRule];"," }",""," function text() {"," return input.substring(peg$savedPos, peg$currPos);"," }",""," function offset() {"," return peg$savedPos;"," }",""," function range() {"," return {"," source: peg$source,"," start: peg$savedPos,"," end: peg$currPos"," };"," }",""," function location() {"," return peg$computeLocation(peg$savedPos, peg$currPos);"," }",""," function expected(description, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildStructuredError("," [peg$otherExpectation(description)],"," input.substring(peg$savedPos, peg$currPos),"," location"," );"," }",""," function error(message, location) {"," location = location !== undefined"," ? location"," : peg$computeLocation(peg$savedPos, peg$currPos);",""," throw peg$buildSimpleError(message, location);"," }",""," function peg$literalExpectation(text, ignoreCase) {",' return { type: "literal", text: text, ignoreCase: ignoreCase };'," }",""," function peg$classExpectation(parts, inverted, ignoreCase) {",' return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };'," }",""," function peg$anyExpectation() {",' return { type: "any" };'," }",""," function peg$endExpectation() {",' return { type: "end" };'," }",""," function peg$otherExpectation(description) {",' return { type: "other", description: description };'," }",""," function peg$computePosDetails(pos) {"," var details = peg$posDetailsCache[pos];"," var p;",""," if (details) {"," return details;"," } else {"," p = pos - 1;"," while (!peg$posDetailsCache[p]) {"," p--;"," }",""," details = peg$posDetailsCache[p];"," details = {"," line: details.line,"," column: details.column"," };",""," while (p < pos) {"," if (input.charCodeAt(p) === 10) {"," details.line++;"," details.column = 1;"," } else {"," details.column++;"," }",""," p++;"," }",""," peg$posDetailsCache[pos] = details;",""," return details;"," }"," }",""," function peg$computeLocation(startPos, endPos, offset) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," var res = {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };",' if (offset && peg$source && (typeof peg$source.offset === "function")) {'," res.start = peg$source.offset(res.start);"," res.end = peg$source.offset(res.end);"," }"," return res;"," }",""," function peg$fail(expected) {"," if (peg$currPos < peg$maxFailPos) { return; }",""," if (peg$currPos > peg$maxFailPos) {"," peg$maxFailPos = peg$currPos;"," peg$maxFailExpected = [];"," }",""," peg$maxFailExpected.push(expected);"," }",""," function peg$buildSimpleError(message, location) {"," return new peg$SyntaxError(message, null, null, location);"," }",""," function peg$buildStructuredError(expected, found, location) {"," return new peg$SyntaxError("," peg$SyntaxError.buildMessage(expected, found),"," expected,"," found,"," location"," );"," }",""),e.rules.forEach(ot=>{it.push(...o(et(ot))),it.push("")}),e.initializer&&(it.push(_e(e.initializer)),it.push("")),it.push(" peg$result = peg$startRuleFunction();",""," if (peg$result !== peg$FAILED && peg$currPos === input.length) {"," return peg$result;"," } else {"," if (peg$result !== peg$FAILED && peg$currPos < input.length) {"," peg$fail(peg$endExpectation());"," }",""," throw peg$buildStructuredError("," peg$maxFailExpected,"," peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,"," peg$maxFailPos < input.length"," ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)"," : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)"," );"," }","}"),new SourceNode(null,null,i.grammarSource,it.map(ot=>ot instanceof SourceNode?ot:ot+` -`))}function lt(it){function pt(){return[`// Generated by Peggy ${VERSION$1}.`,"//","// https://peggyjs.org/"]}function rt(){return i.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join(` -`):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join(` -`)}const st={bare(){return[...pt(),"(function() {",' "use strict";',"",it,"",o("return "+rt()+";"),"})()"]},commonjs(){const ct=Object.keys(i.dependencies),ft=pt();return ft.push("",'"use strict";',""),ct.length>0&&(ct.forEach(wt=>{ft.push("var "+wt+' = require("'+stringEscape(i.dependencies[wt])+'");')}),ft.push("")),ft.push(it,"","module.exports = "+rt()+";"),ft},es(){const ct=Object.keys(i.dependencies),ft=pt();return ft.push(""),ct.length>0&&(ct.forEach(wt=>{ft.push("import "+wt+' from "'+stringEscape(i.dependencies[wt])+'";')}),ft.push("")),ft.push(it,"","export {"," peg$SyntaxError as SyntaxError,",i.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),ft},amd(){const ct=Object.keys(i.dependencies),wt="["+ct.map($t=>i.dependencies[$t]).map($t=>'"'+stringEscape($t)+'"').join(", ")+"]",xt=ct.join(", ");return[...pt(),"define("+wt+", function("+xt+") {",' "use strict";',"",it,"",o("return "+rt()+";"),"});"]},globals(){return[...pt(),"(function(root) {",' "use strict";',"",it,"",o("root."+i.exportVar+" = "+rt()+";"),"})(this);"]},umd(){const ct=Object.keys(i.dependencies),ft=ct.map(dt=>i.dependencies[dt]),wt="["+ft.map(dt=>'"'+stringEscape(dt)+'"').join(", ")+"]",xt=ft.map(dt=>'require("'+stringEscape(dt)+'")').join(", "),$t=ct.join(", "),Dt=pt();return Dt.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+wt+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+xt+");"),i.exportVar!==null&&Dt.push(" } else {"," root."+i.exportVar+" = factory();"),Dt.push(" }","})(this, function("+$t+") {",' "use strict";',"",it,"",o("return "+rt()+";"),"});"),Dt}}[i.format]();return new SourceNode(null,null,i.grammarSource,st.map(ct=>ct instanceof SourceNode?ct:ct+` -`))}e.code=lt(nt())}var generateJs=generateJS$1;const asts$3=asts_1,visitor$7=visitor_1;function removeProxyRules$1(e,i,o){function a(d){return d.type==="rule"&&d.expression.type==="rule_ref"}function s(d,h,g){visitor$7.build({rule_ref(b){b.name===h&&(b.name=g,o.info(`Proxy rule "${h}" replaced by the rule "${g}"`,b.location,[{message:"This rule will be used",location:asts$3.findRule(d,g).nameLocation}]))}})(d)}const c=[];e.rules.forEach((d,h)=>{a(d)&&(s(e,d.name,d.expression.name),i.allowedStartRules.indexOf(d.name)===-1&&c.push(h))}),c.reverse(),c.forEach(d=>{e.rules.splice(d,1)})}var removeProxyRules_1=removeProxyRules$1;const visitor$6=visitor_1;function reportDuplicateLabels$1(e,i,o){function a(d){const h={};return Object.keys(d).forEach(g=>{h[g]=d[g]}),h}function s(d,h){c(d.expression,a(h))}const c=visitor$6.build({rule(d){c(d.expression,{})},choice(d,h){d.alternatives.forEach(g=>{c(g,a(h))})},action:s,labeled(d,h){const g=d.label;g&&Object.prototype.hasOwnProperty.call(h,g)&&o.error(`Label "${d.label}" is already defined`,d.labelLocation,[{message:"Original label location",location:h[g]}]),c(d.expression,h),h[d.label]=d.labelLocation},text:s,simple_and:s,simple_not:s,optional:s,zero_or_more:s,one_or_more:s,repeated(d,h){d.delimiter&&c(d.delimiter,a(h)),c(d.expression,a(h))},group:s});c(e)}var reportDuplicateLabels_1=reportDuplicateLabels$1;const visitor$5=visitor_1;function reportDuplicateRules$1(e,i,o){const a={};visitor$5.build({rule(c){if(Object.prototype.hasOwnProperty.call(a,c.name)){o.error(`Rule "${c.name}" is already defined`,c.nameLocation,[{message:"Original rule location",location:a[c.name]}]);return}a[c.name]=c.nameLocation}})(e)}var reportDuplicateRules_1=reportDuplicateRules$1;const asts$2=asts_1,visitor$4=visitor_1;function reportInfiniteRecursion$1(e,i,o){const a=[],s=[],c=visitor$4.build({rule(d){a.push(d.name),c(d.expression),a.pop()},sequence(d){d.elements.every(h=>(c(h),!asts$2.alwaysConsumesOnSuccess(e,h)))},repeated(d){c(d.expression),d.delimiter&&!asts$2.alwaysConsumesOnSuccess(e,d.expression)&&c(d.delimiter)},rule_ref(d){s.push(d);const h=asts$2.findRule(e,d.name);if(a.indexOf(d.name)!==-1){a.push(d.name),o.error("Possible infinite loop when parsing (left recursion: "+a.join(" -> ")+")",h.nameLocation,s.map((g,$,b)=>({message:$+1!==b.length?`Step ${$+1}: call of the rule "${g.name}" without input consumption`:`Step ${$+1}: call itself without input consumption - left recursion`,location:g.location})));return}h&&c(h),s.pop()}});c(e)}var reportInfiniteRecursion_1=reportInfiniteRecursion$1;const asts$1=asts_1,visitor$3=visitor_1;function reportInfiniteRepetition$1(e,i,o){const a=visitor$3.build({zero_or_more(s){asts$1.alwaysConsumesOnSuccess(e,s.expression)||o.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",s.location)},one_or_more(s){asts$1.alwaysConsumesOnSuccess(e,s.expression)||o.error("Possible infinite loop when parsing (repetition used with an expression that may not consume any input)",s.location)},repeated(s){if(s.delimiter&&a(s.delimiter),!(asts$1.alwaysConsumesOnSuccess(e,s.expression)||s.delimiter&&asts$1.alwaysConsumesOnSuccess(e,s.delimiter)))if(s.max.value===null)o.error("Possible infinite loop when parsing (unbounded range repetition used with an expression that may not consume any input)",s.location);else{const c=s.min?s.min:s.max;o.warning(c.type==="constant"&&s.max.type==="constant"?`An expression may not consume any input and may always match ${s.max.value} times`:"An expression may not consume any input and may always match with a maximum repetition count",s.location)}}});a(e)}var reportInfiniteRepetition_1=reportInfiniteRepetition$1;const asts=asts_1,visitor$2=visitor_1;function reportUndefinedRules$1(e,i,o){visitor$2.build({rule_ref(s){asts.findRule(e,s.name)||o.error(`Rule "${s.name}" is not defined`,s.location)}})(e)}var reportUndefinedRules_1=reportUndefinedRules$1;const visitor$1=visitor_1;function reportIncorrectPlucking$1(e,i,o){const a=visitor$1.build({action(s){a(s.expression,s)},labeled(s,c){s.pick&&c&&o.error('"@" cannot be used with an action block',s.labelLocation,[{message:"Action block location",location:c.codeLocation}]),a(s.expression)}});a(e)}var reportIncorrectPlucking_1=reportIncorrectPlucking$1;const GrammarError$1=grammarError;class Defaults{constructor(i){i=typeof i<"u"?i:{},typeof i.error=="function"&&(this.error=i.error),typeof i.warning=="function"&&(this.warning=i.warning),typeof i.info=="function"&&(this.info=i.info)}error(){}warning(){}info(){}}let Session$1=class{constructor(i){this._callbacks=new Defaults(i),this._firstError=null,this.errors=0,this.problems=[],this.stage=null}error(...i){++this.errors,this._firstError===null&&(this._firstError=new GrammarError$1(...i),this._firstError.stage=this.stage,this._firstError.problems=this.problems),this.problems.push(["error",...i]),this._callbacks.error(this.stage,...i)}warning(...i){this.problems.push(["warning",...i]),this._callbacks.warning(this.stage,...i)}info(...i){this.problems.push(["info",...i]),this._callbacks.info(this.stage,...i)}checkErrors(){if(this.errors!==0)throw this._firstError}};var session=Session$1;const generateBytecode=generateBytecode_1,generateJS=generateJs,inferenceMatchResult=inferenceMatchResult_1,removeProxyRules=removeProxyRules_1,reportDuplicateLabels=reportDuplicateLabels_1,reportDuplicateRules=reportDuplicateRules_1,reportInfiniteRecursion=reportInfiniteRecursion_1,reportInfiniteRepetition=reportInfiniteRepetition_1,reportUndefinedRules=reportUndefinedRules_1,reportIncorrectPlucking=reportIncorrectPlucking_1,Session=session,visitor=visitor_1,{base64}=utils;function processOptions(e,i){const o={};return Object.keys(e).forEach(a=>{o[a]=e[a]}),Object.keys(i).forEach(a=>{Object.prototype.hasOwnProperty.call(o,a)||(o[a]=i[a])}),o}function isSourceMapCapable(e){return typeof e=="string"?e.length>0:e&&typeof e.offset=="function"}const compiler$1={visitor,passes:{check:[reportUndefinedRules,reportDuplicateRules,reportDuplicateLabels,reportInfiniteRecursion,reportInfiniteRepetition,reportIncorrectPlucking],transform:[removeProxyRules,inferenceMatchResult],generate:[generateBytecode,generateJS]},compile(ast,passes,options){if(options=options!==void 0?options:{},options=processOptions(options,{allowedStartRules:[ast.rules[0].name],cache:!1,dependencies:{},exportVar:null,format:"bare",output:"parser",trace:!1}),!Array.isArray(options.allowedStartRules))throw new Error("allowedStartRules must be an array");if(options.allowedStartRules.length===0)throw new Error("Must have at least one start rule");const allRules=ast.rules.map(e=>e.name);if(options.allowedStartRules.some(e=>e==="*"))options.allowedStartRules=allRules;else for(const e of options.allowedStartRules)if(allRules.indexOf(e)===-1)throw new Error(`Unknown start rule "${e}"`);if((options.output==="source-and-map"||options.output==="source-with-inline-map")&&!isSourceMapCapable(options.grammarSource))throw new Error("Must provide grammarSource (as a string or GrammarLocation) in order to generate source maps");const session=new Session(options);switch(Object.keys(passes).forEach(e=>{session.stage=e,session.info(`Process stage ${e}`),passes[e].forEach(i=>{session.info(`Process pass ${e}.${i.name}`),i(ast,options,session)}),session.checkErrors()}),options.output){case"parser":return eval(ast.code.toString());case"source":return ast.code.toString();case"source-and-map":return ast.code;case"source-with-inline-map":{if(typeof TextEncoder>"u")throw new Error("TextEncoder is not supported by this platform");const e=ast.code.toStringWithSourceMap(),i=new TextEncoder,o=base64(i.encode(JSON.stringify(e.map.toJSON())));return e.code+`//# sourceMappingURL=data:application/json;charset=utf-8;base64,${o} -`}case"ast":return ast;default:throw new Error("Invalid output format: "+options.output+".")}}};var compiler_1=compiler$1;const OPS_TO_PREFIXED_TYPES={$:"text","&":"simple_and","!":"simple_not"},OPS_TO_SUFFIXED_TYPES={"?":"optional","*":"zero_or_more","+":"one_or_more"},OPS_TO_SEMANTIC_PREDICATE_TYPES={"&":"semantic_and","!":"semantic_not"};function peg$subclass(e,i){function o(){this.constructor=e}o.prototype=i.prototype,e.prototype=new o}function peg$SyntaxError(e,i,o,a){var s=Error.call(this,e);return Object.setPrototypeOf&&Object.setPrototypeOf(s,peg$SyntaxError.prototype),s.expected=i,s.found=o,s.location=a,s.name="SyntaxError",s}peg$subclass(peg$SyntaxError,Error);function peg$padEnd(e,i,o){return o=o||" ",e.length>i?e:(i-=e.length,o+=o.repeat(i),e+o.slice(0,i))}peg$SyntaxError.prototype.format=function(e){var i="Error: "+this.message;if(this.location){var o=null,a;for(a=0;a `+d+` -`+g+` | -`+c.line+" | "+$+` -`+g+" | "+peg$padEnd("",s.column-1," ")+peg$padEnd("",et,"^")}else i+=` - at `+d}return i};peg$SyntaxError.buildMessage=function(e,i){var o={literal:function($){return'"'+s($.text)+'"'},class:function($){var b=$.parts.map(function(et){return Array.isArray(et)?c(et[0])+"-"+c(et[1]):c(et)});return"["+($.inverted?"^":"")+b.join("")+"]"},any:function(){return"any character"},end:function(){return"end of input"},other:function($){return $.description}};function a($){return $.charCodeAt(0).toString(16).toUpperCase()}function s($){return $.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(b){return"\\x0"+a(b)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(b){return"\\x"+a(b)})}function c($){return $.replace(/\\/g,"\\\\").replace(/\]/g,"\\]").replace(/\^/g,"\\^").replace(/-/g,"\\-").replace(/\0/g,"\\0").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/[\x00-\x0F]/g,function(b){return"\\x0"+a(b)}).replace(/[\x10-\x1F\x7F-\x9F]/g,function(b){return"\\x"+a(b)})}function d($){return o[$.type]($)}function h($){var b=$.map(d),et,_e;if(b.sort(),b.length>0){for(et=1,_e=1;et0?{type:"choice",alternatives:[_].concat(tt),location:Wt()}:_},Mu=function(_,tt){return tt!==null?{type:"action",expression:_,code:tt[0],codeLocation:tt[1],location:Wt()}:_},ju=function(_,tt){return tt.length>0||_.type==="labeled"&&_.pick?{type:"sequence",elements:[_].concat(tt),location:Wt()}:_},Uu=function(_,tt,at){return at.type.startsWith("semantic_")&&Yn('"@" cannot be used on a semantic predicate',_),{type:"labeled",label:tt!==null?tt[0]:null,labelLocation:tt!==null?tt[1]:_,pick:!0,expression:at,location:Wt()}},Hu=function(_,tt){return{type:"labeled",label:_[0],labelLocation:_[1],expression:tt,location:Wt()}},Vu=function(){return Wt()},Gu=function(_){return ns.indexOf(_[0])>=0&&Yn(`Label can't be a reserved word "${_[0]}"`,_[1]),_},zu=function(_,tt){return{type:OPS_TO_PREFIXED_TYPES[_],expression:tt,location:Wt()}},Wu=function(_,tt){return{type:OPS_TO_SUFFIXED_TYPES[tt],expression:_,location:Wt()}},Ku=function(_,tt,at){let ut=tt[0],gt=tt[1];return gt.type==="constant"&>.value===0&&Yn("The maximum count of repetitions of the rule must be > 0",gt.location),{type:"repeated",min:ut,max:gt,expression:_,delimiter:at,location:Wt()}},Yu=function(_,tt){return[_!==null?_:{type:"constant",value:0},tt!==null?tt:{type:"constant",value:null}]},Zu=function(_){return[null,_]},Xu=function(_){return{type:"constant",value:_,location:Wt()}},Qu=function(_){return{type:"variable",value:_[0],location:Wt()}},Ju=function(_){return{type:"function",value:_[0],codeLocation:_[1],location:Wt()}},qu=function(_){return _.type==="labeled"||_.type==="sequence"?{type:"group",expression:_,location:Wt()}:_},_i=function(_){return{type:"rule_ref",name:_[0],location:Wt()}},eo=function(_,tt){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[_],code:tt[0],codeLocation:tt[1],location:Wt()}},to=function(_,tt){return[_+tt.join(""),Wt()]},no=function(_,tt){return{type:"literal",value:_,ignoreCase:tt!==null,location:Wt()}},ro=function(_){return _.join("")},uo=function(_){return _.join("")},io=function(_,tt,at){return{type:"class",parts:tt.filter(ut=>ut!==""),inverted:_!==null,ignoreCase:at!==null,location:Wt()}},oo=function(_,tt){return _.charCodeAt(0)>tt.charCodeAt(0)&&Yn("Invalid character range: "+Co()+"."),[_,tt]},ao=function(){return""},so=function(){return"\0"},lo=function(){return"\b"},co=function(){return"\f"},fo=function(){return` -`},po=function(){return"\r"},ho=function(){return" "},go=function(){return"\v"},mo=function(_){return String.fromCharCode(parseInt(_,16))},vo=function(_){return String.fromCharCode(parseInt(_,16))},Eo=function(){return{type:"any",location:Wt()}},yo=function(_){return[_,Wt()]},Ao=function(_){return parseInt(_,10)},j=0,Ot=0,Wn=[{line:1,column:1}],fn=0,or=[],ht=0,Kn;if("startRule"in i){if(!(i.startRule in s))throw new Error(`Can't start parsing from rule "`+i.startRule+'".');c=s[i.startRule]}function Co(){return e.substring(Ot,j)}function Wt(){return Zn(Ot,j)}function Yn(_,tt){throw tt=tt!==void 0?tt:Zn(Ot,j),wo(_,tt)}function Tt(_,tt){return{type:"literal",text:_,ignoreCase:tt}}function qt(_,tt,at){return{type:"class",parts:_,inverted:tt,ignoreCase:at}}function xo(){return{type:"any"}}function _o(){return{type:"end"}}function gn(_){return{type:"other",description:_}}function $r(_){var tt=Wn[_],at;if(tt)return tt;for(at=_-1;!Wn[at];)at--;for(tt=Wn[at],tt={line:tt.line,column:tt.column};at<_;)e.charCodeAt(at)===10?(tt.line++,tt.column=1):tt.column++,at++;return Wn[_]=tt,tt}function Zn(_,tt,at){var ut=$r(_),gt=$r(tt),Et={source:a,start:{offset:_,line:ut.line,column:ut.column},end:{offset:tt,line:gt.line,column:gt.column}};return at&&a&&typeof a.offset=="function"&&(Et.start=a.offset(Et.start),Et.end=a.offset(Et.end)),Et}function At(_){jfn&&(fn=j,or=[]),or.push(_))}function wo(_,tt){return new peg$SyntaxError(_,null,null,tt)}function $o(_,tt,at){return new peg$SyntaxError(peg$SyntaxError.buildMessage(_,tt),_,tt,at)}function Sr(){var _,tt,at,ut,gt,Et;if(_=j,Ht(),tt=j,at=So(),at!==o?(ut=Ht(),tt=at):(j=tt,tt=o),tt===o&&(tt=null),at=j,ut=Fo(),ut!==o?(gt=Ht(),at=ut):(j=at,at=o),at===o&&(at=null),ut=[],gt=j,Et=Fr(),Et!==o?(Ht(),gt=Et):(j=gt,gt=o),gt!==o)for(;gt!==o;)ut.push(gt),gt=j,Et=Fr(),Et!==o?(Ht(),gt=Et):(j=gt,gt=o);else ut=o;return ut!==o?(Ot=_,_=Pu(tt,at,ut)):(j=_,_=o),_}function So(){var _,tt,at,ut,gt;return _=j,e.charCodeAt(j)===123?(tt=d,j++):(tt=o,ht===0&&At(Jt)),tt!==o?(at=In(),at!==o?(e.charCodeAt(j)===125?(ut=h,j++):(ut=o,ht===0&&At(ln)),ut!==o?(gt=vr(),gt!==o?(Ot=_,_=Iu(at)):(j=_,_=o)):(j=_,_=o)):(j=_,_=o)):(j=_,_=o),_}function Fo(){var _,tt,at;return _=j,tt=In(),tt!==o?(at=vr(),at!==o?(Ot=_,_=Lu(tt)):(j=_,_=o)):(j=_,_=o),_}function Fr(){var _,tt,at,ut,gt,Et;return _=j,tt=Jn(),tt!==o?(Ht(),at=j,ut=pr(),ut!==o?(Ht(),at=ut):(j=at,at=o),at===o&&(at=null),e.charCodeAt(j)===61?(ut=g,j++):(ut=o,ht===0&&At(An)),ut!==o?(Ht(),gt=ar(),gt!==o?(Et=vr(),Et!==o?(Ot=_,_=Nu(tt,at,gt)):(j=_,_=o)):(j=_,_=o)):(j=_,_=o)):(j=_,_=o),_}function ar(){var _,tt,at,ut,gt,Et;if(_=j,tt=sr(),tt!==o){for(at=[],ut=j,Ht(),e.charCodeAt(j)===47?(gt=$,j++):(gt=o,ht===0&&At(Cn)),gt!==o?(Ht(),Et=sr(),Et!==o?ut=Et:(j=ut,ut=o)):(j=ut,ut=o);ut!==o;)at.push(ut),ut=j,Ht(),e.charCodeAt(j)===47?(gt=$,j++):(gt=o,ht===0&&At(Cn)),gt!==o?(Ht(),Et=sr(),Et!==o?ut=Et:(j=ut,ut=o)):(j=ut,ut=o);Ot=_,_=Ou(tt,at)}else j=_,_=o;return _}function sr(){var _,tt,at,ut;return _=j,tt=Do(),tt!==o?(at=j,Ht(),ut=In(),ut!==o?at=ut:(j=at,at=o),at===o&&(at=null),Ot=_,_=Mu(tt,at)):(j=_,_=o),_}function Do(){var _,tt,at,ut,gt;if(_=j,tt=lr(),tt!==o){for(at=[],ut=j,Ht(),gt=lr(),gt!==o?ut=gt:(j=ut,ut=o);ut!==o;)at.push(ut),ut=j,Ht(),gt=lr(),gt!==o?ut=gt:(j=ut,ut=o);Ot=_,_=ju(tt,at)}else j=_,_=o;return _}function lr(){var _,tt,at,ut;return _=j,tt=Bo(),tt!==o?(at=Dr(),at===o&&(at=null),ut=cr(),ut!==o?(Ot=_,_=Uu(tt,at,ut)):(j=_,_=o)):(j=_,_=o),_===o&&(_=j,tt=Dr(),tt!==o?(at=Ht(),ut=cr(),ut!==o?(Ot=_,_=Hu(tt,ut)):(j=_,_=o)):(j=_,_=o),_===o&&(_=cr())),_}function Bo(){var _,tt;return _=j,e.charCodeAt(j)===64?(tt=b,j++):(tt=o,ht===0&&At(hn)),tt!==o&&(Ot=_,tt=Vu()),_=tt,_}function Dr(){var _,tt,at;return _=j,tt=Jn(),tt!==o?(Ht(),e.charCodeAt(j)===58?(at=et,j++):(at=o,ht===0&&At(kn)),at!==o?(Ot=_,_=Gu(tt)):(j=_,_=o)):(j=_,_=o),_}function cr(){var _,tt,at;return _=j,tt=bo(),tt!==o?(Ht(),at=Br(),at!==o?(Ot=_,_=zu(tt,at)):(j=_,_=o)):(j=_,_=o),_===o&&(_=Br()),_}function bo(){var _;return e.charCodeAt(j)===36?(_=_e,j++):(_=o,ht===0&&At(Zt)),_===o&&(e.charCodeAt(j)===38?(_=nt,j++):(_=o,ht===0&&At(rn)),_===o&&(e.charCodeAt(j)===33?(_=lt,j++):(_=o,ht===0&&At(cn)))),_}function Br(){var _,tt,at;return _=j,tt=dr(),tt!==o?(Ht(),at=Ro(),at!==o?(Ot=_,_=Wu(tt,at)):(j=_,_=o)):(j=_,_=o),_===o&&(_=ko(),_===o&&(_=dr())),_}function Ro(){var _;return e.charCodeAt(j)===63?(_=it,j++):(_=o,ht===0&&At(wn)),_===o&&(e.charCodeAt(j)===42?(_=pt,j++):(_=o,ht===0&&At(Tn)),_===o&&(e.charCodeAt(j)===43?(_=rt,j++):(_=o,ht===0&&At(ur)))),_}function ko(){var _,tt,at,ut,gt,Et,Qt;return _=j,tt=dr(),tt!==o?(Ht(),e.charCodeAt(j)===124?(at=ot,j++):(at=o,ht===0&&At(Un)),at!==o?(Ht(),ut=To(),ut!==o?(Ht(),gt=j,e.charCodeAt(j)===44?(Et=st,j++):(Et=o,ht===0&&At(sn)),Et!==o?(Ht(),Qt=ar(),Qt!==o?(Ht(),gt=Qt):(j=gt,gt=o)):(j=gt,gt=o),gt===o&&(gt=null),e.charCodeAt(j)===124?(Et=ot,j++):(Et=o,ht===0&&At(Un)),Et!==o?(Ot=_,_=Ku(tt,ut,gt)):(j=_,_=o)):(j=_,_=o)):(j=_,_=o)):(j=_,_=o),_}function To(){var _,tt,at,ut;return _=j,tt=fr(),tt===o&&(tt=null),Ht(),e.substr(j,2)===ct?(at=ct,j+=2):(at=o,ht===0&&At(Pn)),at!==o?(Ht(),ut=fr(),ut===o&&(ut=null),Ot=_,_=Yu(tt,ut)):(j=_,_=o),_===o&&(_=j,tt=fr(),tt!==o&&(Ot=_,tt=Zu(tt)),_=tt),_}function fr(){var _,tt;return _=j,tt=Yo(),tt!==o&&(Ot=_,tt=Xu(tt)),_=tt,_===o&&(_=j,tt=Jn(),tt!==o&&(Ot=_,tt=Qu(tt)),_=tt,_===o&&(_=j,tt=In(),tt!==o&&(Ot=_,tt=Ju(tt)),_=tt)),_}function dr(){var _,tt,at,ut;return _=jo(),_===o&&(_=Uo(),_===o&&(_=Wo(),_===o&&(_=Po(),_===o&&(_=Io(),_===o&&(_=j,e.charCodeAt(j)===40?(tt=ft,j++):(tt=o,ht===0&&At(Hn)),tt!==o?(Ht(),at=ar(),at!==o?(Ht(),e.charCodeAt(j)===41?(ut=wt,j++):(ut=o,ht===0&&At(ir)),ut!==o?(Ot=_,_=qu(at)):(j=_,_=o)):(j=_,_=o)):(j=_,_=o)))))),_}function Po(){var _,tt,at,ut,gt,Et,Qt,Fn;return _=j,tt=Jn(),tt!==o?(at=j,ht++,ut=j,gt=Ht(),Et=j,Qt=pr(),Qt!==o?(Fn=Ht(),Qt=[Qt,Fn],Et=Qt):(j=Et,Et=o),Et===o&&(Et=null),e.charCodeAt(j)===61?(Qt=g,j++):(Qt=o,ht===0&&At(An)),Qt!==o?(gt=[gt,Et,Qt],ut=gt):(j=ut,ut=o),ht--,ut===o?at=void 0:(j=at,at=o),at!==o?(Ot=_,_=_i(tt)):(j=_,_=o)):(j=_,_=o),_}function Io(){var _,tt,at;return _=j,tt=Lo(),tt!==o?(Ht(),at=In(),at!==o?(Ot=_,_=eo(tt,at)):(j=_,_=o)):(j=_,_=o),_}function Lo(){var _;return e.charCodeAt(j)===38?(_=nt,j++):(_=o,ht===0&&At(rn)),_===o&&(e.charCodeAt(j)===33?(_=lt,j++):(_=o,ht===0&&At(cn))),_}function tn(){var _;return e.length>j?(_=e.charAt(j),j++):(_=o,ht===0&&At(Er)),_}function Xn(){var _;return ht++,e.charCodeAt(j)===9?(_=xt,j++):(_=o,ht===0&&At(Ur)),_===o&&(e.charCodeAt(j)===11?(_=$t,j++):(_=o,ht===0&&At(Hr)),_===o&&(e.charCodeAt(j)===12?(_=Dt,j++):(_=o,ht===0&&At(Vr)),_===o&&(e.charCodeAt(j)===32?(_=dt,j++):(_=o,ht===0&&At(Gr)),_===o&&(e.charCodeAt(j)===160?(_=mt,j++):(_=o,ht===0&&At(zr)),_===o&&(e.charCodeAt(j)===65279?(_=Ct,j++):(_=o,ht===0&&At(Wr)),_===o&&(_=ba())))))),ht--,_===o&&ht===0&&At(jr),_}function mn(){var _;return rr.test(e.charAt(j))?(_=e.charAt(j),j++):(_=o,ht===0&&At(Kr)),_}function Qn(){var _;return ht++,e.charCodeAt(j)===10?(_=St,j++):(_=o,ht===0&&At(Zr)),_===o&&(e.substr(j,2)===bt?(_=bt,j+=2):(_=o,ht===0&&At(Xr)),_===o&&(e.charCodeAt(j)===13?(_=Mt,j++):(_=o,ht===0&&At(Qr)),_===o&&(e.charCodeAt(j)===8232?(_=Yt,j++):(_=o,ht===0&&At(Jr)),_===o&&(e.charCodeAt(j)===8233?(_=zt,j++):(_=o,ht===0&&At(qr)))))),ht--,_===o&&ht===0&&At(Yr),_}function br(){var _;return ht++,_=No(),_===o&&(_=kr()),ht--,_===o&&ht===0&&At(eu),_}function No(){var _,tt,at,ut,gt,Et;if(_=j,e.substr(j,2)===Ft?(tt=Ft,j+=2):(tt=o,ht===0&&At(yr)),tt!==o){for(at=[],ut=j,gt=j,ht++,e.substr(j,2)===kt?(Et=kt,j+=2):(Et=o,ht===0&&At($n)),ht--,Et===o?gt=void 0:(j=gt,gt=o),gt!==o?(Et=tn(),Et!==o?(gt=[gt,Et],ut=gt):(j=ut,ut=o)):(j=ut,ut=o);ut!==o;)at.push(ut),ut=j,gt=j,ht++,e.substr(j,2)===kt?(Et=kt,j+=2):(Et=o,ht===0&&At($n)),ht--,Et===o?gt=void 0:(j=gt,gt=o),gt!==o?(Et=tn(),Et!==o?(gt=[gt,Et],ut=gt):(j=ut,ut=o)):(j=ut,ut=o);e.substr(j,2)===kt?(ut=kt,j+=2):(ut=o,ht===0&&At($n)),ut!==o?(tt=[tt,at,ut],_=tt):(j=_,_=o)}else j=_,_=o;return _}function Rr(){var _,tt,at,ut,gt,Et;if(_=j,e.substr(j,2)===Ft?(tt=Ft,j+=2):(tt=o,ht===0&&At(yr)),tt!==o){for(at=[],ut=j,gt=j,ht++,e.substr(j,2)===kt?(Et=kt,j+=2):(Et=o,ht===0&&At($n)),Et===o&&(Et=mn()),ht--,Et===o?gt=void 0:(j=gt,gt=o),gt!==o?(Et=tn(),Et!==o?(gt=[gt,Et],ut=gt):(j=ut,ut=o)):(j=ut,ut=o);ut!==o;)at.push(ut),ut=j,gt=j,ht++,e.substr(j,2)===kt?(Et=kt,j+=2):(Et=o,ht===0&&At($n)),Et===o&&(Et=mn()),ht--,Et===o?gt=void 0:(j=gt,gt=o),gt!==o?(Et=tn(),Et!==o?(gt=[gt,Et],ut=gt):(j=ut,ut=o)):(j=ut,ut=o);e.substr(j,2)===kt?(ut=kt,j+=2):(ut=o,ht===0&&At($n)),ut!==o?(tt=[tt,at,ut],_=tt):(j=_,_=o)}else j=_,_=o;return _}function kr(){var _,tt,at,ut,gt,Et;if(_=j,e.substr(j,2)===Lt?(tt=Lt,j+=2):(tt=o,ht===0&&At(tu)),tt!==o){for(at=[],ut=j,gt=j,ht++,Et=mn(),ht--,Et===o?gt=void 0:(j=gt,gt=o),gt!==o?(Et=tn(),Et!==o?(gt=[gt,Et],ut=gt):(j=ut,ut=o)):(j=ut,ut=o);ut!==o;)at.push(ut),ut=j,gt=j,ht++,Et=mn(),ht--,Et===o?gt=void 0:(j=gt,gt=o),gt!==o?(Et=tn(),Et!==o?(gt=[gt,Et],ut=gt):(j=ut,ut=o)):(j=ut,ut=o);tt=[tt,at],_=tt}else j=_,_=o;return _}function Jn(){var _,tt,at,ut;if(ht++,_=j,tt=Tr(),tt!==o){for(at=[],ut=Pr();ut!==o;)at.push(ut),ut=Pr();Ot=_,_=to(tt,at)}else j=_,_=o;return ht--,_===o&&(tt=o,ht===0&&At(nu)),_}function Tr(){var _,tt,at;return _=Oo(),_===o&&(e.charCodeAt(j)===95?(_=Vt,j++):(_=o,ht===0&&At(ru)),_===o&&(_=j,e.charCodeAt(j)===92?(tt=Gt,j++):(tt=o,ht===0&&At(dn)),tt!==o?(at=Mr(),at!==o?_=at:(j=_,_=o)):(j=_,_=o))),_}function Pr(){var _;return _=Tr(),_===o&&(e.charCodeAt(j)===36?(_=_e,j++):(_=o,ht===0&&At(Zt)),_===o&&(_=Mo(),_===o&&(_=xa(),_===o&&(_=$a(),_===o&&(e.charCodeAt(j)===8204?(_=on,j++):(_=o,ht===0&&At(uu)),_===o&&(e.charCodeAt(j)===8205?(_=un,j++):(_=o,ht===0&&At(iu)))))))),_}function Oo(){var _;return _=qo(),_===o&&(_=Zo(),_===o&&(_=Jo(),_===o&&(_=Xo(),_===o&&(_=Qo(),_===o&&(_=_a()))))),_}function Mo(){var _;return _=ga(),_===o&&(_=na()),_}function jo(){var _,tt,at;return ht++,_=j,tt=pr(),tt!==o?(e.charCodeAt(j)===105?(at=pn,j++):(at=o,ht===0&&At(Ar)),at===o&&(at=null),Ot=_,_=no(tt,at)):(j=_,_=o),ht--,_===o&&(tt=o,ht===0&&At(ou)),_}function pr(){var _,tt,at,ut;if(ht++,_=j,e.charCodeAt(j)===34?(tt=en,j++):(tt=o,ht===0&&At(Vn)),tt!==o){for(at=[],ut=Ir();ut!==o;)at.push(ut),ut=Ir();e.charCodeAt(j)===34?(ut=en,j++):(ut=o,ht===0&&At(Vn)),ut!==o?(Ot=_,_=ro(at)):(j=_,_=o)}else j=_,_=o;if(_===o)if(_=j,e.charCodeAt(j)===39?(tt=an,j++):(tt=o,ht===0&&At(Gn)),tt!==o){for(at=[],ut=Lr();ut!==o;)at.push(ut),ut=Lr();e.charCodeAt(j)===39?(ut=an,j++):(ut=o,ht===0&&At(Gn)),ut!==o?(Ot=_,_=uo(at)):(j=_,_=o)}else j=_,_=o;return ht--,_===o&&(tt=o,ht===0&&At(au)),_}function Ir(){var _,tt,at,ut;return _=j,tt=j,at=j,ht++,e.charCodeAt(j)===34?(ut=en,j++):(ut=o,ht===0&&At(Vn)),ut===o&&(e.charCodeAt(j)===92?(ut=Gt,j++):(ut=o,ht===0&&At(dn)),ut===o&&(ut=mn())),ht--,ut===o?at=void 0:(j=at,at=o),at!==o?(ut=tn(),ut!==o?(at=[at,ut],tt=at):(j=tt,tt=o)):(j=tt,tt=o),tt!==o?_=e.substring(_,j):_=tt,_===o&&(_=j,e.charCodeAt(j)===92?(tt=Gt,j++):(tt=o,ht===0&&At(dn)),tt!==o?(at=gr(),at!==o?_=at:(j=_,_=o)):(j=_,_=o),_===o&&(_=hr())),_}function Lr(){var _,tt,at,ut;return _=j,tt=j,at=j,ht++,e.charCodeAt(j)===39?(ut=an,j++):(ut=o,ht===0&&At(Gn)),ut===o&&(e.charCodeAt(j)===92?(ut=Gt,j++):(ut=o,ht===0&&At(dn)),ut===o&&(ut=mn())),ht--,ut===o?at=void 0:(j=at,at=o),at!==o?(ut=tn(),ut!==o?(at=[at,ut],tt=at):(j=tt,tt=o)):(j=tt,tt=o),tt!==o?_=e.substring(_,j):_=tt,_===o&&(_=j,e.charCodeAt(j)===92?(tt=Gt,j++):(tt=o,ht===0&&At(dn)),tt!==o?(at=gr(),at!==o?_=at:(j=_,_=o)):(j=_,_=o),_===o&&(_=hr())),_}function Uo(){var _,tt,at,ut,gt,Et;if(ht++,_=j,e.charCodeAt(j)===91?(tt=vn,j++):(tt=o,ht===0&&At(lu)),tt!==o){for(e.charCodeAt(j)===94?(at=Ln,j++):(at=o,ht===0&&At(cu)),at===o&&(at=null),ut=[],gt=Nr(),gt===o&&(gt=qn());gt!==o;)ut.push(gt),gt=Nr(),gt===o&&(gt=qn());e.charCodeAt(j)===93?(gt=xn,j++):(gt=o,ht===0&&At(Cr)),gt!==o?(e.charCodeAt(j)===105?(Et=pn,j++):(Et=o,ht===0&&At(Ar)),Et===o&&(Et=null),Ot=_,_=io(at,ut,Et)):(j=_,_=o)}else j=_,_=o;return ht--,_===o&&(tt=o,ht===0&&At(su)),_}function Nr(){var _,tt,at,ut;return _=j,tt=qn(),tt!==o?(e.charCodeAt(j)===45?(at=Dn,j++):(at=o,ht===0&&At(fu)),at!==o?(ut=qn(),ut!==o?(Ot=_,_=oo(tt,ut)):(j=_,_=o)):(j=_,_=o)):(j=_,_=o),_}function qn(){var _,tt,at,ut;return _=j,tt=j,at=j,ht++,e.charCodeAt(j)===93?(ut=xn,j++):(ut=o,ht===0&&At(Cr)),ut===o&&(e.charCodeAt(j)===92?(ut=Gt,j++):(ut=o,ht===0&&At(dn)),ut===o&&(ut=mn())),ht--,ut===o?at=void 0:(j=at,at=o),at!==o?(ut=tn(),ut!==o?(at=[at,ut],tt=at):(j=tt,tt=o)):(j=tt,tt=o),tt!==o?_=e.substring(_,j):_=tt,_===o&&(_=j,e.charCodeAt(j)===92?(tt=Gt,j++):(tt=o,ht===0&&At(dn)),tt!==o?(at=gr(),at!==o?_=at:(j=_,_=o)):(j=_,_=o),_===o&&(_=hr())),_}function hr(){var _,tt,at;return _=j,e.charCodeAt(j)===92?(tt=Gt,j++):(tt=o,ht===0&&At(dn)),tt!==o?(at=Qn(),at!==o?(Ot=_,_=ao()):(j=_,_=o)):(j=_,_=o),_}function gr(){var _,tt,at,ut;return _=Ho(),_===o&&(_=j,e.charCodeAt(j)===48?(tt=Bn,j++):(tt=o,ht===0&&At(du)),tt!==o?(at=j,ht++,ut=er(),ht--,ut===o?at=void 0:(j=at,at=o),at!==o?(Ot=_,_=so()):(j=_,_=o)):(j=_,_=o),_===o&&(_=zo(),_===o&&(_=Mr()))),_}function Ho(){var _;return _=Or(),_===o&&(_=Vo()),_}function Or(){var _,tt;return e.charCodeAt(j)===39?(_=an,j++):(_=o,ht===0&&At(Gn)),_===o&&(e.charCodeAt(j)===34?(_=en,j++):(_=o,ht===0&&At(Vn)),_===o&&(e.charCodeAt(j)===92?(_=Gt,j++):(_=o,ht===0&&At(dn)),_===o&&(_=j,e.charCodeAt(j)===98?(tt=_n,j++):(tt=o,ht===0&&At(pu)),tt!==o&&(Ot=_,tt=lo()),_=tt,_===o&&(_=j,e.charCodeAt(j)===102?(tt=Nn,j++):(tt=o,ht===0&&At(hu)),tt!==o&&(Ot=_,tt=co()),_=tt,_===o&&(_=j,e.charCodeAt(j)===110?(tt=tr,j++):(tt=o,ht===0&&At(gu)),tt!==o&&(Ot=_,tt=fo()),_=tt,_===o&&(_=j,e.charCodeAt(j)===114?(tt=On,j++):(tt=o,ht===0&&At(mu)),tt!==o&&(Ot=_,tt=po()),_=tt,_===o&&(_=j,e.charCodeAt(j)===116?(tt=nr,j++):(tt=o,ht===0&&At(vu)),tt!==o&&(Ot=_,tt=ho()),_=tt,_===o&&(_=j,e.charCodeAt(j)===118?(tt=En,j++):(tt=o,ht===0&&At(Eu)),tt!==o&&(Ot=_,tt=go()),_=tt)))))))),_}function Vo(){var _,tt,at,ut;return _=j,tt=j,at=j,ht++,ut=Go(),ut===o&&(ut=mn()),ht--,ut===o?at=void 0:(j=at,at=o),at!==o?(ut=tn(),ut!==o?(at=[at,ut],tt=at):(j=tt,tt=o)):(j=tt,tt=o),tt!==o?_=e.substring(_,j):_=tt,_}function Go(){var _;return _=Or(),_===o&&(_=er(),_===o&&(e.charCodeAt(j)===120?(_=yn,j++):(_=o,ht===0&&At(xr)),_===o&&(e.charCodeAt(j)===117?(_=bn,j++):(_=o,ht===0&&At(_r))))),_}function zo(){var _,tt,at,ut,gt,Et;return _=j,e.charCodeAt(j)===120?(tt=yn,j++):(tt=o,ht===0&&At(xr)),tt!==o?(at=j,ut=j,gt=Sn(),gt!==o?(Et=Sn(),Et!==o?(gt=[gt,Et],ut=gt):(j=ut,ut=o)):(j=ut,ut=o),ut!==o?at=e.substring(at,j):at=ut,at!==o?(Ot=_,_=mo(at)):(j=_,_=o)):(j=_,_=o),_}function Mr(){var _,tt,at,ut,gt,Et,Qt,Fn;return _=j,e.charCodeAt(j)===117?(tt=bn,j++):(tt=o,ht===0&&At(_r)),tt!==o?(at=j,ut=j,gt=Sn(),gt!==o?(Et=Sn(),Et!==o?(Qt=Sn(),Qt!==o?(Fn=Sn(),Fn!==o?(gt=[gt,Et,Qt,Fn],ut=gt):(j=ut,ut=o)):(j=ut,ut=o)):(j=ut,ut=o)):(j=ut,ut=o),ut!==o?at=e.substring(at,j):at=ut,at!==o?(Ot=_,_=vo(at)):(j=_,_=o)):(j=_,_=o),_}function er(){var _;return jn.test(e.charAt(j))?(_=e.charAt(j),j++):(_=o,ht===0&&At(yu)),_}function Sn(){var _;return vt.test(e.charAt(j))?(_=e.charAt(j),j++):(_=o,ht===0&&At(Au)),_}function Wo(){var _,tt;return _=j,e.charCodeAt(j)===46?(tt=Rn,j++):(tt=o,ht===0&&At(Cu)),tt!==o&&(Ot=_,tt=Eo()),_=tt,_}function In(){var _,tt,at,ut;return ht++,_=j,e.charCodeAt(j)===123?(tt=d,j++):(tt=o,ht===0&&At(Jt)),tt!==o?(at=Ko(),e.charCodeAt(j)===125?(ut=h,j++):(ut=o,ht===0&&At(ln)),ut!==o?_=at:(j=_,_=o)):(j=_,_=o),ht--,_===o&&(tt=o,ht===0&&At(xu)),_}function Ko(){var _,tt;return _=j,tt=mr(),Ot=_,tt=yo(tt),_=tt,_}function mr(){var _,tt,at,ut,gt,Et;if(_=j,tt=[],at=[],ut=j,gt=j,ht++,yt.test(e.charAt(j))?(Et=e.charAt(j),j++):(Et=o,ht===0&&At(zn)),ht--,Et===o?gt=void 0:(j=gt,gt=o),gt!==o?(Et=tn(),Et!==o?(gt=[gt,Et],ut=gt):(j=ut,ut=o)):(j=ut,ut=o),ut!==o)for(;ut!==o;)at.push(ut),ut=j,gt=j,ht++,yt.test(e.charAt(j))?(Et=e.charAt(j),j++):(Et=o,ht===0&&At(zn)),ht--,Et===o?gt=void 0:(j=gt,gt=o),gt!==o?(Et=tn(),Et!==o?(gt=[gt,Et],ut=gt):(j=ut,ut=o)):(j=ut,ut=o);else at=o;for(at===o&&(at=j,e.charCodeAt(j)===123?(ut=d,j++):(ut=o,ht===0&&At(Jt)),ut!==o?(gt=mr(),e.charCodeAt(j)===125?(Et=h,j++):(Et=o,ht===0&&At(ln)),Et!==o?(ut=[ut,gt,Et],at=ut):(j=at,at=o)):(j=at,at=o));at!==o;){if(tt.push(at),at=[],ut=j,gt=j,ht++,yt.test(e.charAt(j))?(Et=e.charAt(j),j++):(Et=o,ht===0&&At(zn)),ht--,Et===o?gt=void 0:(j=gt,gt=o),gt!==o?(Et=tn(),Et!==o?(gt=[gt,Et],ut=gt):(j=ut,ut=o)):(j=ut,ut=o),ut!==o)for(;ut!==o;)at.push(ut),ut=j,gt=j,ht++,yt.test(e.charAt(j))?(Et=e.charAt(j),j++):(Et=o,ht===0&&At(zn)),ht--,Et===o?gt=void 0:(j=gt,gt=o),gt!==o?(Et=tn(),Et!==o?(gt=[gt,Et],ut=gt):(j=ut,ut=o)):(j=ut,ut=o);else at=o;at===o&&(at=j,e.charCodeAt(j)===123?(ut=d,j++):(ut=o,ht===0&&At(Jt)),ut!==o?(gt=mr(),e.charCodeAt(j)===125?(Et=h,j++):(Et=o,ht===0&&At(ln)),Et!==o?(ut=[ut,gt,Et],at=ut):(j=at,at=o)):(j=at,at=o))}return _=e.substring(_,j),_}function Yo(){var _,tt,at,ut;if(_=j,tt=j,at=[],ut=er(),ut!==o)for(;ut!==o;)at.push(ut),ut=er();else at=o;return at!==o?tt=e.substring(tt,j):tt=at,tt!==o&&(Ot=_,tt=Ao(tt)),_=tt,_}function Zo(){var _;return _t.test(e.charAt(j))?(_=e.charAt(j),j++):(_=o,ht===0&&At(_u)),_}function Xo(){var _;return Rt.test(e.charAt(j))?(_=e.charAt(j),j++):(_=o,ht===0&&At(wu)),_}function Qo(){var _;return Bt.test(e.charAt(j))?(_=e.charAt(j),j++):(_=o,ht===0&&At($u)),_}function Jo(){var _;return Nt.test(e.charAt(j))?(_=e.charAt(j),j++):(_=o,ht===0&&At(Su)),_}function qo(){var _;return It.test(e.charAt(j))?(_=e.charAt(j),j++):(_=o,ht===0&&At(Fu)),_}function na(){var _;return Ut.test(e.charAt(j))?(_=e.charAt(j),j++):(_=o,ht===0&&At(Du)),_}function ga(){var _;return Pt.test(e.charAt(j))?(_=e.charAt(j),j++):(_=o,ht===0&&At(Bu)),_}function xa(){var _;return Xt.test(e.charAt(j))?(_=e.charAt(j),j++):(_=o,ht===0&&At(bu)),_}function _a(){var _;return jt.test(e.charAt(j))?(_=e.charAt(j),j++):(_=o,ht===0&&At(Ru)),_}function $a(){var _;return Kt.test(e.charAt(j))?(_=e.charAt(j),j++):(_=o,ht===0&&At(ku)),_}function ba(){var _;return nn.test(e.charAt(j))?(_=e.charAt(j),j++):(_=o,ht===0&&At(Tu)),_}function Ht(){var _,tt;for(_=[],tt=Xn(),tt===o&&(tt=Qn(),tt===o&&(tt=br()));tt!==o;)_.push(tt),tt=Xn(),tt===o&&(tt=Qn(),tt===o&&(tt=br()));return _}function es(){var _,tt;for(_=[],tt=Xn(),tt===o&&(tt=Rr());tt!==o;)_.push(tt),tt=Xn(),tt===o&&(tt=Rr());return _}function vr(){var _,tt,at,ut;if(_=[],tt=j,at=Ht(),e.charCodeAt(j)===59?(ut=Mn,j++):(ut=o,ht===0&&At(wr)),ut!==o?(at=[at,ut],tt=at):(j=tt,tt=o),tt!==o)for(;tt!==o;)_.push(tt),tt=j,at=Ht(),e.charCodeAt(j)===59?(ut=Mn,j++):(ut=o,ht===0&&At(wr)),ut!==o?(at=[at,ut],tt=at):(j=tt,tt=o);else _=o;return _===o&&(_=j,tt=es(),at=kr(),at===o&&(at=null),ut=Qn(),ut!==o?(tt=[tt,at,ut],_=tt):(j=_,_=o),_===o&&(_=j,tt=Ht(),at=ts(),at!==o?(tt=[tt,at],_=tt):(j=_,_=o))),_}function ts(){var _,tt;return _=j,ht++,e.length>j?(tt=e.charAt(j),j++):(tt=o,ht===0&&At(Er)),ht--,tt===o?_=void 0:(j=_,_=o),_}const ns=i.reservedWords||[];if(Kn=c(),Kn!==o&&j===e.length)return Kn;throw Kn!==o&&j{d[h]=c[h].slice()}),d}const a="plugins"in i?i.plugins:[],s={parser:peg.parser,passes:o(peg.compiler.passes),reservedWords:peg.RESERVED_WORDS.slice()};return a.forEach(c=>{c.use(s,i)}),peg.compiler.compile(s.parser.parse(e,{grammarSource:i.grammarSource,reservedWords:s.reservedWords}),s.passes,i)}};var peg_1=peg;const goalTreeGrammarUrl="data:application/octet-stream;base64,CnsKICBmdW5jdGlvbiBtYWtlSW50ZWdlcihvKSB7CiAgICByZXR1cm4gcGFyc2VJbnQoby5qb2luKCIiKSwgMTApOwogIH0KfQoKc3RhcnQKICA9IHN0YXRlbWVudDpzdGF0ZW1lbnQ/IG1vcmVTdGF0ZW1lbnRzOihFT0wgQHN0YXRlbWVudCkqIEVPTD8gXwp7CiAgY29uc3Qgc3RhdGVtZW50cyA9IHN0YXRlbWVudCA/IFtzdGF0ZW1lbnQsIC4uLm1vcmVTdGF0ZW1lbnRzXSA6IG1vcmVTdGF0ZW1lbnRzOwogIHJldHVybiB7CiAgICBnb2FsOiBzdGF0ZW1lbnRzLmZpbmQocyA9PiBzLnR5cGUgPT09ICJub2RlIiAmJiBzLm5vZGVUeXBlID09PSAiZ29hbCIpIHx8IG51bGwsCiAgICBzdGF0ZW1lbnRzOiBzdGF0ZW1lbnRzCiAgfTsKfQoKc3RhdGVtZW50ID0gY29tbWVudExpbmUgLyBub2RlU3RhdGVtZW50IC8gZWRnZVN0YXRlbWVudAoKY29tbWVudExpbmUgPSBfICIjIiB0ZXh0OihbXlxuXHJdKikKewogIHJldHVybiB7CiAgICB0eXBlOiAiY29tbWVudCIsCiAgICB0ZXh0OiB0ZXh0LmpvaW4oIiIpCiAgfTsKfQoKbm9kZVN0YXRlbWVudCA9IF8gaWRlbnQ6aWRlbnQgXyAnOicgXyB0ZXh0OmxhYmVsIF8gcGFyYW1zOm5vZGVQYXJhbXM/CiAgewogICAgY29uc3QgbG93ZXJJZCA9IGlkZW50LnRvTG93ZXJDYXNlKCk7CiAgICBjb25zdCBub2RlVHlwZSA9ICdnb2FsJyA9PT0gbG93ZXJJZCA/ICdnb2FsJyA6IGxvd2VySWQuc3RhcnRzV2l0aCgnY3NmXycpID8gJ2NzZicgOiAnbmMnOwogICAgcmV0dXJuIHsKICAgICAgdHlwZTogIm5vZGUiLAogICAgICBub2RlVHlwZTogbm9kZVR5cGUsCiAgICAgIGlkOiBpZGVudCwKICAgICAgdGV4dDogdGV4dCwKICAgICAgcGFyYW1zOiBwYXJhbXMgfHwge30KICAgIH07CiAgfQogIApub2RlUGFyYW1zID0gInsiIG5vZGVQYXJhbTpub2RlUGFyYW0gbW9yZU5vZGVQYXJhbXM6KEVPTCBAbm9kZVBhcmFtKSogJywnPyAifSIgCnsKCXJldHVybiBPYmplY3QuZnJvbUVudHJpZXMoW25vZGVQYXJhbSwgLi4ubW9yZU5vZGVQYXJhbXNdKTsKfQoKbm9kZVBhcmFtID0gXyBFT0w/IF8gaWRlbnQ6aWRlbnQgXyAnOicgXyBleHByZXNzaW9uOmV4cHJlc3Npb24gXyBFT0w/IF8KewoJcmV0dXJuIFtpZGVudCwgZXhwcmVzc2lvbl07Cn0KZWRnZVN0YXRlbWVudCA9IF8gdG9JZDppZGVudCBfICc8LScgXyBmcm9tSWQ6aWRlbnQKICB7CiAgICByZXR1cm4gewogICAgICB0eXBlOiAiZWRnZSIsCiAgICAgIHRvSWQ6IHRvSWQsCiAgICAgIGZyb21JZDogZnJvbUlkCiAgICB9OwogIH0KCnJlcXVpcmVtZW50cwogID0gXyBpZGVudDppZGVudCB0YWlsOihfICJhbmQiIF8gQGlkZW50KSoKICB7CiAgICByZXR1cm4gW2lkZW50LCAuLi50YWlsXTsKICB9CgpleHByZXNzaW9uID0gdGV4dDpzdHJpbmcgLyBudW06KFswLTldKykKeyByZXR1cm4gbnVtICE9PSB1bmRlZmluZWQgPyBtYWtlSW50ZWdlcihudW0pIDogdGV4dC5qb2luKCIiKTsgfQoKaWRlbnQgPSBpZDooW2EtekEtWjAtOV9dKykKeyByZXR1cm4gaWQuam9pbigiIik7IH0KCmxhYmVsID0gc3RyaW5nIC8gdGV4dDooW157XG5dKikKeyByZXR1cm4gdGV4dC5qb2luKCIiKTsgfQoKc3RyaW5nID0gIlwiIiB0ZXh0OihbXiJdKikgIlwiIgp7IHJldHVybiB0ZXh0LmpvaW4oIiIpOyB9CgpFT0wKICA9IFsgXHRdKiBbXG5ccl0rCgpfICJ3aGl0ZXNwYWNlIgogID0gWyBcdF0q",evaporatingCloudGrammarUrl="data:application/octet-stream;base64,CnN0YXJ0CiAgPSBzdGF0ZW1lbnQ6c3RhdGVtZW50PyBtb3JlU3RhdGVtZW50czooRU9MIEBzdGF0ZW1lbnQpKiBFT0w/IF8KewogIGlmICghc3RhdGVtZW50KSByZXR1cm4geyBzdGF0ZW1lbnRzOiBtb3JlU3RhdGVtZW50cyB9OwogIHJldHVybiB7CiAgICBzdGF0ZW1lbnRzOiBbc3RhdGVtZW50LCAuLi5tb3JlU3RhdGVtZW50c10KICB9Owp9CgpzdGF0ZW1lbnQgPSBjb21tZW50TGluZSAvIGxhYmVsU3RhdGVtZW50IC8gcmVsYXRpb25TdGF0ZW1lbnQKCmNvbW1lbnRMaW5lID0gXyAiIyIgdGV4dDooW15cblxyXSopCnsKICByZXR1cm4gewogICAgdHlwZTogImNvbW1lbnQiLAogICAgdGV4dDogdGV4dC5qb2luKCIiKQogIH07Cn0KCmxhYmVsU3RhdGVtZW50ID0gXyBpZGVudDppZGVudCBfICI6IiBfIGxhYmVsOmxhYmVsCiAgewogICAgcmV0dXJuIHsKICAgICAgdHlwZTogImxhYmVsIiwKICAgICAgaWQ6IGlkZW50LAogICAgICB0ZXh0OiBsYWJlbAogICAgfTsKICB9CgpyZWxhdGlvblN0YXRlbWVudCA9IAogIF8gaWRlbnQxOmlkZW50IF8gZGlyZWN0aW9uOmRpcmVjdGlvbiBfIGlkZW50MjppZGVudCBfICc6JyBfIGxhYmVsOmxhYmVsCiAgewogICAgcmV0dXJuIHsKICAgICAgdHlwZTogImVkZ2VMYWJlbCIsCiAgICAgIGlkMTogaWRlbnQxLAogICAgICBpZDI6IGlkZW50MiwKICAgICAgdGV4dDogbGFiZWwKICAgIH07CiAgfQoKbGFiZWwgPSBzdHJpbmcgLyB0ZXh0OihbXntcbl0qKQp7IHJldHVybiB0ZXh0LmpvaW4oIiIpOyB9CgoKaWRlbnQgPSBpZDooW2EtekEtWjAtOSddKykKeyByZXR1cm4gaWQuam9pbigiIik7IH0KCnN0cmluZyA9ICJcIiIgdGV4dDooW14iXSopICJcIiIKeyByZXR1cm4gdGV4dC5qb2luKCIiKTsgfQoKZGlyZWN0aW9uID0gIjwtIiAiPiI/IC8gIi0+IgoKRU9MCiAgPSBbIFx0XSogW1xuXHJdKwoKXyAid2hpdGVzcGFjZSIKICA9IFsgXHRdKgogIAog",problemTreeGrammarUrl="data:application/octet-stream;base64,c3RhcnQKICA9IHN0YXRlbWVudDpzdGF0ZW1lbnQ/IG1vcmVTdGF0ZW1lbnRzOihFT0wgXyBAc3RhdGVtZW50KSogRU9MPyBfCnsKICBjb25zdCBzdGF0ZW1lbnRzID0gc3RhdGVtZW50ID8gW3N0YXRlbWVudCwgLi4ubW9yZVN0YXRlbWVudHNdIDogbW9yZVN0YXRlbWVudHM7CiAgcmV0dXJuIHsKICAgIHN0YXRlbWVudHM6IHN0YXRlbWVudHMKICB9Owp9CgpzdGF0ZW1lbnQgPSBjb21tZW50TGluZSAvIG5vZGVTdGF0ZW1lbnQgLyBlZGdlU3RhdGVtZW50Cgpjb21tZW50TGluZSA9IF8gIiMiIHRleHQ6KFteXG5ccl0qKQp7CiAgcmV0dXJuIHsKICAgIHR5cGU6ICJjb21tZW50IiwKICAgIHRleHQ6IHRleHQuam9pbigiIikKICB9Owp9Cgpub2RlU3RhdGVtZW50ID0gXyBpZGVudDppZGVudCBfICI6IiBfXyBsYWJlbDpsYWJlbAogIHsKICAgIHJldHVybiB7CiAgICAgIHR5cGU6ICJub2RlIiwKICAgICAgaWQ6IGlkZW50LAogICAgICB0ZXh0OiBsYWJlbAogICAgfTsKICB9CmVkZ2VTdGF0ZW1lbnQgPSBfICB0b0lkOmlkZW50IF8gIjwtIiBfIGZyb21JZHM6aWRlbnR8Li4sIF8gIiYmIiBffAogIHsKICAgIHJldHVybiB7CiAgICAgIHR5cGU6ICJlZGdlIiwKICAgICAgdG9JZDogdG9JZCwKICAgICAgZnJvbUlkczogZnJvbUlkcwogICAgfTsKICB9CgppZGVudCA9IGlkOihbYS16QS1aMC05X10rKQp7IHJldHVybiBpZC5qb2luKCIiKTsgfQoKbGFiZWwgPSBzdHI6c3RyaW5nIC8gdGV4dDooW157XG5dKikKeyByZXR1cm4gdGV4dC5qb2luKCIiKTsgfQoKc3RyaW5nID0gIlwiIiB0ZXh0OihbXiJdKikgIlwiIgp7IHJldHVybiB0ZXh0LmpvaW4oIiIpOyB9CgpFT0wKICA9IFsgXHRdKiBbXG5ccl0rCgpfICJvcHRpb25hbCB3aGl0ZXNwYWNlIgogID0gWyBcdF0qCgpfXyAid2hpdGVzcGFjZSIKICA9IFsgXHRdKwo=",loadFile=async e=>await(await fetch(e)).text(),evaporatingCloudParserPromise=loadFile(evaporatingCloudGrammarUrl).then(e=>peg_1.generate(e)),goalTreeParserPromise=loadFile(goalTreeGrammarUrl).then(e=>peg_1.generate(e)),problemTreeParserPromise=loadFile(problemTreeGrammarUrl).then(e=>peg_1.generate(e)),parsersPromise=Promise.all([evaporatingCloudParserPromise,goalTreeParserPromise,problemTreeParserPromise]).then(([e,i,o])=>({"evaporating-cloud":e,"goal-tree":i,"problem-tree":o})),parseGoalTreeSemantics=e=>{const i=new Map;i.set("goal",{key:"goal",label:"",annotation:"G"});const o=[];return e.goal&&(i.get("goal").label=e.goal.text,i.get("goal").statusPercentage=e.goal.params.status),e.statements.filter(a=>a.type==="node"&&a.nodeType==="nc").forEach(a=>{i.set(a.id,{key:a.id,label:a.text,statusPercentage:a.params.status})}),e.statements.filter(a=>a.type==="node"&&a.nodeType==="csf").forEach(a=>{i.set(a.id,{key:a.id,label:a.text,annotation:"CSF",statusPercentage:a.params.status}),o.push({from:a.id,to:"goal"})}),e.statements.filter(a=>a.type==="edge").forEach(a=>{const s=a.toId;if(!i.has(s))throw new Error(`Node ${s} not found`);const c=a.fromId;if(!i.has(c))throw new Error(`Requirement ${c} not found`);o.push({from:c,to:s})}),{nodes:i,edges:o,rankdir:"BT"}},parseProblemTreeSemantics=e=>{const i=new Map,o=[],a=s=>{const c=/^(UDE|FOL|DE)/i;if(s.match(c))return s.match(c)[0].toUpperCase()};return e.statements.filter(s=>s.type==="node").forEach(s=>{i.set(s.id,{annotation:a(s.id),key:s.id,label:s.text})}),e.statements.filter(s=>s.type==="edge").forEach(s=>{const c=s.toId;let d=c;if(s.fromIds.length>1){const h=s.fromIds.join("_")+"_cause_"+c;d=h,i.set(h,{key:h,label:"AND",intermediate:!0}),o.push({from:h,to:c})}for(const h of s.fromIds){if(!i.has(h))throw new Error(`Cause ${h} not declared`);if(!i.has(c))throw new Error(`Effect ${c} not declared`);o.push({from:h,to:d})}}),{nodes:i,edges:o,rankdir:"BT"}},parseTextToAst=async(e,i)=>(await parsersPromise)[e].parse(i);async function loader({params:e}){const i={"evaporating-cloud":exampleEvaporatingCloudText,"goal-tree":exampleGoalTreeText,"problem-tree":exampleProblemTreeText};return{diagramType:e.diagramType,example:i[e.diagramType]}}function Draw(){const{diagramType:e,example:i}=useLoaderData();console.log("diagramType",e);const[o,a]=React.useState(null),[s,c]=React.useState(null),[d,h]=React.useState(""),[g,$]=React.useState();React.useEffect(()=>{$(i)},[e]);const b=async et=>{try{const _e=await parseTextToAst(e,et);c(e==="goal-tree"?parseGoalTreeSemantics(_e):e==="problem-tree"?parseProblemTreeSemantics(_e):null),console.log(_e),a(_e),h("")}catch(_e){console.error(_e),h(_e.toString())}};return jsxRuntimeExports.jsxs("div",{className:"flex-row",children:[jsxRuntimeExports.jsx("div",{className:"flex-1",children:jsxRuntimeExports.jsx(Editor,{onChange:b,rows:20,text:g,setText:$,error:d})}),jsxRuntimeExports.jsx("div",{className:"flex-1",children:jsxRuntimeExports.jsx(Diagram,{ast:o,semantics:s,diagramType:e})})]})}function About(e){return jsxRuntimeExports.jsxs("div",{id:"about-page",children:[jsxRuntimeExports.jsx("h1",{children:"TOC-Lang"}),jsxRuntimeExports.jsxs("p",{children:["Generate"," ",jsxRuntimeExports.jsx("a",{href:"https://en.wikipedia.org/wiki/Theory_of_constraints",children:"Theory of Constraints"})," ","diagrams from text-based notation. Learn more"," ",jsxRuntimeExports.jsx("a",{href:"https://github.com/raymyers/toc-lang/",children:"on GitHub!"})]})]})}const router=createBrowserRouter([{path:"/",element:jsxRuntimeExports.jsx(App,{}),errorElement:jsxRuntimeExports.jsx(ErrorPage,{}),children:[{index:!0,loader:async()=>redirect("/draw/goal-tree")},{path:"draw/:diagramType",element:jsxRuntimeExports.jsx(Draw,{}),loader},{path:"about",element:jsxRuntimeExports.jsx(About,{})}]}],{basename:"/toc-lang"}),rootResetElt=document.getElementById("root-reset");rootResetElt&&client.createRoot(rootResetElt).render(jsxRuntimeExports.jsx(React.StrictMode,{children:jsxRuntimeExports.jsx(RouterProvider,{router})}))});export default us(); diff --git a/index.html b/index.html index 6d1a899..167bcb0 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ TOC-Lang (Preview) - +