diff --git a/assets/index-1e5f174b.js b/assets/index-a486ec53.js similarity index 94% rename from assets/index-1e5f174b.js rename to assets/index-a486ec53.js index 85cc5ac..77978a6 100644 --- a/assets/index-1e5f174b.js +++ b/assets/index-a486ec53.js @@ -23,7 +23,7 @@ var Wo=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports);var Ko=Wo((export * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(e){for(var i=1;i"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 dt=b(),ut=dt==null?null:dt-_;_=dt,g&&g({action:h,location:ot.location,delta:ut})}function _e(dt,ut){h=Action.Push;let tt=createLocation(ot.location,dt,ut);o&&o(tt,dt),_=b()+1;let rt=getHistoryState(tt,_),at=ot.createHref(tt);try{d.pushState(rt,"",at)}catch{s.location.assign(at)}c&&g&&g({action:h,location:ot.location,delta:1})}function it(dt,ut){h=Action.Replace;let tt=createLocation(ot.location,dt,ut);o&&o(tt,dt),_=b();let rt=getHistoryState(tt,_),at=ot.createHref(tt);d.replaceState(rt,"",at),c&&g&&g({action:h,location:ot.location,delta:0})}function ct(dt){let ut=s.location.origin!=="null"?s.location.origin:s.location.href,tt=typeof dt=="string"?dt:createPath(dt);return invariant(ut,"No window.location.(origin|href) available to create URL for href: "+tt),new URL(tt,ut)}let ot={get action(){return h},get location(){return e(s,d)},listen(dt){if(g)throw new Error("A history only accepts one active listener");return s.addEventListener(PopStateEventType,et),g=dt,()=>{s.removeEventListener(PopStateEventType,et),g=null}},createHref(dt){return i(s,dt)},createURL:ct,encodeLocation(dt){let ut=ct(dt);return{pathname:ut.pathname,search:ut.search,hash:ut.hash}},push:_e,replace:it,go(dt){return d.go(dt)}};return ot}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 gt=getInternalRouterError(404,{pathname:e.history.location.pathname}),{matches:Et,route:Ct}=getShortCircuitMatches(i);g=Et,_={[Ct.id]:gt}}let b=!g.some(gt=>gt.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},it=Action.Pop,ct=!1,ot,dt=!1,ut=!1,tt=[],rt=[],at=new Map,ft=0,vt=-1,mt=new Map,xt=new Set,Rt=new Map,Ft=new Map,Mt=null,Pt=new Map,Ut=!1;function Kt(){return o=e.history.listen(gt=>{let{action:Et,location:Ct,delta:$t}=gt;if(Ut){Ut=!1;return}warning(Mt!=null&&$t===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 _t=Mn({currentLocation:_e.location,nextLocation:Ct,historyAction:Et});if(_t&&$t!=null){Ut=!0,e.history.go($t*-1),Cn(_t,{state:"blocked",location:Ct,proceed(){Cn(_t,{state:"proceeding",proceed:void 0,reset:void 0,location:Ct}),e.history.go($t)},reset(){vn(_t),Vt({blockers:new Map(et.state.blockers)})}});return}return Ot(Et,Ct)}),_e.initialized||Ot(Action.Pop,_e.location),et}function Yt(){o&&o(),a.clear(),ot&&ot.abort(),_e.fetchers.forEach((gt,Et)=>Rn(Et)),_e.blockers.forEach((gt,Et)=>vn(Et))}function zt(gt){return a.add(gt),()=>a.delete(gt)}function Vt(gt){_e=_extends$2({},_e,gt),a.forEach(Et=>Et(_e))}function wt(gt,Et){var Ct,$t;let _t=_e.actionData!=null&&_e.navigation.formMethod!=null&&isMutationMethod(_e.navigation.formMethod)&&_e.navigation.state==="loading"&&((Ct=gt.state)==null?void 0:Ct._isRedirect)!==!0,kt;Et.actionData?Object.keys(Et.actionData).length>0?kt=Et.actionData:kt=null:_t?kt=_e.actionData:kt=null;let bt=Et.loaderData?mergeLoaderData(_e.loaderData,Et.loaderData,Et.matches||[],Et.errors):_e.loaderData;for(let[Dt]of Pt)vn(Dt);let Nt=ct===!0||_e.navigation.formMethod!=null&&isMutationMethod(_e.navigation.formMethod)&&(($t=gt.state)==null?void 0:$t._isRedirect)!==!0;Vt(_extends$2({},Et,{actionData:kt,loaderData:bt,historyAction:it,location:gt,initialized:!0,navigation:IDLE_NAVIGATION,revalidation:"idle",restoreScrollPosition:jn(gt,Et.matches||_e.matches),preventScrollReset:Nt,blockers:new Map(_e.blockers)})),dt||it===Action.Pop||(it===Action.Push?e.history.push(gt,gt.state):it===Action.Replace&&e.history.replace(gt,gt.state)),it=Action.Pop,ct=!1,dt=!1,ut=!1,tt=[],rt=[]}async function St(gt,Et){if(typeof gt=="number"){e.history.go(gt);return}let{path:Ct,submission:$t,error:_t}=normalizeNavigateOptions(gt,Et),kt=_e.location,bt=createLocation(_e.location,Ct,Et&&Et.state);bt=_extends$2({},bt,e.history.encodeLocation(bt));let Nt=Et&&Et.replace!=null?Et.replace:void 0,Dt=Action.Push;Nt===!0?Dt=Action.Replace:Nt===!1||$t!=null&&isMutationMethod($t.formMethod)&&$t.formAction===_e.location.pathname+_e.location.search&&(Dt=Action.Replace);let Zt=Et&&"preventScrollReset"in Et?Et.preventScrollReset===!0:void 0,It=Mn({currentLocation:kt,nextLocation:bt,historyAction:Dt});if(It){Cn(It,{state:"blocked",location:bt,proceed(){Cn(It,{state:"proceeding",proceed:void 0,reset:void 0,location:bt}),St(gt,Et)},reset(){vn(It),Vt({blockers:new Map(_e.blockers)})}});return}return await Ot(Dt,bt,{submission:$t,pendingError:_t,preventScrollReset:Zt,replace:Et&&Et.replace})}function Tt(){if(Bn(),Vt({revalidation:"loading"}),_e.navigation.state!=="submitting"){if(_e.navigation.state==="idle"){Ot(_e.historyAction,_e.location,{startUninterruptedRevalidation:!0});return}Ot(it||_e.historyAction,_e.navigation.location,{overrideNavigation:_e.navigation})}}async function Ot(gt,Et,Ct){ot&&ot.abort(),ot=null,it=gt,dt=(Ct&&Ct.startUninterruptedRevalidation)===!0,xn(_e.location,_e.matches),ct=(Ct&&Ct.preventScrollReset)===!0;let $t=Ct&&Ct.overrideNavigation,_t=matchRoutes(i,Et,e.basename);if(!_t){let jt=getInternalRouterError(404,{pathname:Et.pathname}),{matches:qt,route:en}=getShortCircuitMatches(i);Tn(),wt(Et,{matches:qt,loaderData:{},errors:{[en.id]:jt}});return}if(isHashChangeOnly(_e.location,Et)&&!(Ct&&Ct.submission&&isMutationMethod(Ct.submission.formMethod))){wt(Et,{matches:_t});return}ot=new AbortController;let kt=createClientSideRequest(e.history,Et,ot.signal,Ct&&Ct.submission),bt,Nt;if(Ct&&Ct.pendingError)Nt={[findNearestBoundary(_t).route.id]:Ct.pendingError};else if(Ct&&Ct.submission&&isMutationMethod(Ct.submission.formMethod)){let jt=await Gt(kt,Et,Ct.submission,_t,{replace:Ct.replace});if(jt.shortCircuited)return;bt=jt.pendingActionData,Nt=jt.pendingActionError,$t=_extends$2({state:"loading",location:Et},Ct.submission),kt=new Request(kt.url,{signal:kt.signal})}let{shortCircuited:Dt,loaderData:Zt,errors:It}=await un(kt,Et,_t,$t,Ct&&Ct.submission,Ct&&Ct.replace,bt,Nt);Dt||(ot=null,wt(Et,_extends$2({matches:_t},bt?{actionData:bt}:{},{loaderData:Zt,errors:It})))}async function Gt(gt,Et,Ct,$t,_t){Bn();let kt=_extends$2({state:"submitting",location:Et},Ct);Vt({navigation:kt});let bt,Nt=getTargetMatch($t,Et);if(!Nt.route.action)bt={type:ResultType.error,error:getInternalRouterError(405,{method:gt.method,pathname:Et.pathname,routeId:Nt.route.id})};else if(bt=await callLoaderOrAction("action",gt,Nt,$t,et.basename),gt.signal.aborted)return{shortCircuited:!0};if(isRedirectResult(bt)){let Dt;return _t&&_t.replace!=null?Dt=_t.replace:Dt=bt.location===_e.location.pathname+_e.location.search,await mn(_e,bt,{submission:Ct,replace:Dt}),{shortCircuited:!0}}if(isErrorResult(bt)){let Dt=findNearestBoundary($t,Nt.route.id);return(_t&&_t.replace)!==!0&&(it=Action.Push),{pendingActionData:{},pendingActionError:{[Dt.route.id]:bt.error}}}if(isDeferredResult(bt))throw getInternalRouterError(400,{type:"defer-action"});return{pendingActionData:{[Nt.route.id]:bt.data}}}async function un(gt,Et,Ct,$t,_t,kt,bt,Nt){let Dt=$t;Dt||(Dt=_extends$2({state:"loading",location:Et,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},_t));let Zt=_t||(Dt.formMethod&&Dt.formAction&&Dt.formData&&Dt.formEncType?{formMethod:Dt.formMethod,formAction:Dt.formAction,formData:Dt.formData,formEncType:Dt.formEncType}:void 0),[It,jt]=getMatchesToLoad(e.history,_e,Ct,Zt,Et,ut,tt,rt,bt,Nt,Rt);if(Tn(Xt=>!(Ct&&Ct.some(rn=>rn.route.id===Xt))||It&&It.some(rn=>rn.route.id===Xt)),It.length===0&&jt.length===0)return wt(Et,_extends$2({matches:Ct,loaderData:{},errors:Nt||null},bt?{actionData:bt}:{})),{shortCircuited:!0};if(!dt){jt.forEach(rn=>{let fn=_e.fetchers.get(rn.key),$n={state:"loading",data:fn&&fn.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(rn.key,$n)});let Xt=bt||_e.actionData;Vt(_extends$2({navigation:Dt},Xt?Object.keys(Xt).length===0?{actionData:null}:{actionData:Xt}:{},jt.length>0?{fetchers:new Map(_e.fetchers)}:{}))}vt=++ft,jt.forEach(Xt=>at.set(Xt.key,ot));let{results:qt,loaderResults:en,fetcherResults:En}=await Ln(_e.matches,Ct,It,jt,gt);if(gt.signal.aborted)return{shortCircuited:!0};jt.forEach(Xt=>at.delete(Xt.key));let wn=findRedirect(qt);if(wn)return await mn(_e,wn,{replace:kt}),{shortCircuited:!0};let{loaderData:An,errors:cn}=processLoaderData(_e,Ct,It,en,Nt,jt,En,Ft);Ft.forEach((Xt,rn)=>{Xt.subscribe(fn=>{(fn||Xt.done)&&Ft.delete(rn)})}),qn();let _n=kn(vt);return _extends$2({loaderData:An,errors:cn},_n||jt.length>0?{fetchers:new Map(_e.fetchers)}:{})}function Qt(gt){return _e.fetchers.get(gt)||IDLE_FETCHER}function gn(gt,Et,Ct,$t){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.");at.has(gt)&&yn(gt);let _t=matchRoutes(i,Ct,e.basename);if(!_t){bn(gt,Et,getInternalRouterError(404,{pathname:Ct}));return}let{path:kt,submission:bt}=normalizeNavigateOptions(Ct,$t,!0),Nt=getTargetMatch(_t,kt);if(ct=($t&&$t.preventScrollReset)===!0,bt&&isMutationMethod(bt.formMethod)){on(gt,Et,kt,Nt,_t,bt);return}Rt.set(gt,{routeId:Et,path:kt,match:Nt,matches:_t}),ln(gt,Et,kt,Nt,_t,bt)}async function on(gt,Et,Ct,$t,_t,kt){if(Bn(),Rt.delete(gt),!$t.route.action){let an=getInternalRouterError(405,{method:kt.formMethod,pathname:Ct,routeId:Et});bn(gt,Et,an);return}let bt=_e.fetchers.get(gt),Nt=_extends$2({state:"submitting"},kt,{data:bt&&bt.data," _hasFetcherDoneAnything ":!0});_e.fetchers.set(gt,Nt),Vt({fetchers:new Map(_e.fetchers)});let Dt=new AbortController,Zt=createClientSideRequest(e.history,Ct,Dt.signal,kt);at.set(gt,Dt);let It=await callLoaderOrAction("action",Zt,$t,_t,et.basename);if(Zt.signal.aborted){at.get(gt)===Dt&&at.delete(gt);return}if(isRedirectResult(It)){at.delete(gt),xt.add(gt);let an=_extends$2({state:"loading"},kt,{data:void 0," _hasFetcherDoneAnything ":!0});return _e.fetchers.set(gt,an),Vt({fetchers:new Map(_e.fetchers)}),mn(_e,It,{isFetchActionRedirect:!0})}if(isErrorResult(It)){bn(gt,Et,It.error);return}if(isDeferredResult(It))throw getInternalRouterError(400,{type:"defer-action"});let jt=_e.navigation.location||_e.location,qt=createClientSideRequest(e.history,jt,Dt.signal),en=_e.navigation.state!=="idle"?matchRoutes(i,_e.navigation.location,e.basename):_e.matches;invariant(en,"Didn't find any matches after fetcher action");let En=++ft;mt.set(gt,En);let wn=_extends$2({state:"loading",data:It.data},kt,{" _hasFetcherDoneAnything ":!0});_e.fetchers.set(gt,wn);let[An,cn]=getMatchesToLoad(e.history,_e,en,kt,jt,ut,tt,rt,{[$t.route.id]:It.data},void 0,Rt);cn.filter(an=>an.key!==gt).forEach(an=>{let In=an.key,Hn=_e.fetchers.get(In),nr={state:"loading",data:Hn&&Hn.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(In,nr),at.set(In,Dt)}),Vt({fetchers:new Map(_e.fetchers)});let{results:_n,loaderResults:Xt,fetcherResults:rn}=await Ln(_e.matches,en,An,cn,qt);if(Dt.signal.aborted)return;mt.delete(gt),at.delete(gt),cn.forEach(an=>at.delete(an.key));let fn=findRedirect(_n);if(fn)return mn(_e,fn);let{loaderData:$n,errors:Pn}=processLoaderData(_e,_e.matches,An,Xt,void 0,cn,rn,Ft),Vn={state:"idle",data:It.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(gt,Vn);let tr=kn(En);_e.navigation.state==="loading"&&En>vt?(invariant(it,"Expected pending action"),ot&&ot.abort(),wt(_e.navigation.location,{matches:en,loaderData:$n,errors:Pn,fetchers:new Map(_e.fetchers)})):(Vt(_extends$2({errors:Pn,loaderData:mergeLoaderData(_e.loaderData,$n,en,Pn)},tr?{fetchers:new Map(_e.fetchers)}:{})),ut=!1)}async function ln(gt,Et,Ct,$t,_t,kt){let bt=_e.fetchers.get(gt),Nt=_extends$2({state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},kt,{data:bt&&bt.data," _hasFetcherDoneAnything ":!0});_e.fetchers.set(gt,Nt),Vt({fetchers:new Map(_e.fetchers)});let Dt=new AbortController,Zt=createClientSideRequest(e.history,Ct,Dt.signal);at.set(gt,Dt);let It=await callLoaderOrAction("loader",Zt,$t,_t,et.basename);if(isDeferredResult(It)&&(It=await resolveDeferredData(It,Zt.signal,!0)||It),at.get(gt)===Dt&&at.delete(gt),Zt.signal.aborted)return;if(isRedirectResult(It)){await mn(_e,It);return}if(isErrorResult(It)){let qt=findNearestBoundary(_e.matches,Et);_e.fetchers.delete(gt),Vt({fetchers:new Map(_e.fetchers),errors:{[qt.route.id]:It.error}});return}invariant(!isDeferredResult(It),"Unhandled fetcher deferred data");let jt={state:"idle",data:It.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(gt,jt),Vt({fetchers:new Map(_e.fetchers)})}async function mn(gt,Et,Ct){var $t;let{submission:_t,replace:kt,isFetchActionRedirect:bt}=Ct===void 0?{}:Ct;Et.revalidate&&(ut=!0);let Nt=createLocation(gt.location,Et.location,_extends$2({_isRedirect:!0},bt?{_isFetchActionRedirect:!0}:{}));if(invariant(Nt,"Expected a location on the redirect navigation"),isBrowser$1&&typeof(($t=window)==null?void 0:$t.location)<"u"){let en=e.history.createURL(Et.location).origin;if(window.location.origin!==en){kt?window.location.replace(Et.location):window.location.assign(Et.location);return}}ot=null;let Dt=kt===!0?Action.Replace:Action.Push,{formMethod:Zt,formAction:It,formEncType:jt,formData:qt}=gt.navigation;!_t&&Zt&&It&&qt&&jt&&(_t={formMethod:Zt,formAction:It,formEncType:jt,formData:qt}),redirectPreserveMethodStatusCodes.has(Et.status)&&_t&&isMutationMethod(_t.formMethod)?await Ot(Dt,Nt,{submission:_extends$2({},_t,{formAction:Et.location}),preventScrollReset:ct}):await Ot(Dt,Nt,{overrideNavigation:{state:"loading",location:Nt,formMethod:_t?_t.formMethod:void 0,formAction:_t?_t.formAction:void 0,formEncType:_t?_t.formEncType:void 0,formData:_t?_t.formData:void 0},preventScrollReset:ct})}async function Ln(gt,Et,Ct,$t,_t){let kt=await Promise.all([...Ct.map(Dt=>callLoaderOrAction("loader",_t,Dt,Et,et.basename)),...$t.map(Dt=>callLoaderOrAction("loader",createClientSideRequest(e.history,Dt.path,_t.signal),Dt.match,Dt.matches,et.basename))]),bt=kt.slice(0,Ct.length),Nt=kt.slice(Ct.length);return await Promise.all([resolveDeferredResults(gt,Ct,bt,_t.signal,!1,_e.loaderData),resolveDeferredResults(gt,$t.map(Dt=>Dt.match),Nt,_t.signal,!0)]),{results:kt,loaderResults:bt,fetcherResults:Nt}}function Bn(){ut=!0,tt.push(...Tn()),Rt.forEach((gt,Et)=>{at.has(Et)&&(rt.push(Et),yn(Et))})}function bn(gt,Et,Ct){let $t=findNearestBoundary(_e.matches,Et);Rn(gt),Vt({errors:{[$t.route.id]:Ct},fetchers:new Map(_e.fetchers)})}function Rn(gt){at.has(gt)&&yn(gt),Rt.delete(gt),mt.delete(gt),xt.delete(gt),_e.fetchers.delete(gt)}function yn(gt){let Et=at.get(gt);invariant(Et,"Expected fetch controller: "+gt),Et.abort(),at.delete(gt)}function Nn(gt){for(let Et of gt){let $t={state:"idle",data:Qt(Et).data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(Et,$t)}}function qn(){let gt=[];for(let Et of xt){let Ct=_e.fetchers.get(Et);invariant(Ct,"Expected fetcher: "+Et),Ct.state==="loading"&&(xt.delete(Et),gt.push(Et))}Nn(gt)}function kn(gt){let Et=[];for(let[Ct,$t]of mt)if($t0}function On(gt,Et){let Ct=_e.blockers.get(gt)||IDLE_BLOCKER;return Pt.get(gt)!==Et&&(Pt.set(gt,Et),Mt==null?Mt=gt:gt!==Mt&&warning(!1,"A router only supports one blocker at a time")),Ct}function vn(gt){_e.blockers.delete(gt),Pt.delete(gt),Mt===gt&&(Mt=null)}function Cn(gt,Et){let Ct=_e.blockers.get(gt)||IDLE_BLOCKER;invariant(Ct.state==="unblocked"&&Et.state==="blocked"||Ct.state==="blocked"&&Et.state==="blocked"||Ct.state==="blocked"&&Et.state==="proceeding"||Ct.state==="blocked"&&Et.state==="unblocked"||Ct.state==="proceeding"&&Et.state==="unblocked","Invalid blocker state transition: "+Ct.state+" -> "+Et.state),_e.blockers.set(gt,Et),Vt({blockers:new Map(_e.blockers)})}function Mn(gt){let{currentLocation:Et,nextLocation:Ct,historyAction:$t}=gt;if(Mt==null)return;let _t=Pt.get(Mt);invariant(_t,"Could not find a function for the active blocker");let kt=_e.blockers.get(Mt);if(!(kt&&kt.state==="proceeding")&&_t({currentLocation:Et,nextLocation:Ct,historyAction:$t}))return Mt}function Tn(gt){let Et=[];return Ft.forEach((Ct,$t)=>{(!gt||gt($t))&&(Ct.cancel(),Et.push($t),Ft.delete($t))}),Et}function er(gt,Et,Ct){if(s=gt,d=Et,c=Ct||($t=>$t.key),!h&&_e.navigation===IDLE_NAVIGATION){h=!0;let $t=jn(_e.location,_e.matches);$t!=null&&Vt({restoreScrollPosition:$t})}return()=>{s=null,d=null,c=null}}function xn(gt,Et){if(s&&c&&d){let Ct=Et.map(_t=>createUseMatchesMatch(_t,_e.loaderData)),$t=c(gt,Ct)||gt.key;s[$t]=d()}}function jn(gt,Et){if(s&&c&&d){let Ct=Et.map(kt=>createUseMatchesMatch(kt,_e.loaderData)),$t=c(gt,Ct)||gt.key,_t=s[$t];if(typeof _t=="number")return _t}return null}return et={get basename(){return e.basename},get state(){return _e},get routes(){return i},initialize:Kt,subscribe:zt,enableScrollRestoration:er,navigate:St,fetch:gn,revalidate:Tt,createHref:gt=>e.history.createHref(gt),encodeLocation:gt=>e.history.encodeLocation(gt),getFetcher:Qt,deleteFetcher:Rn,dispose:Yt,getBlocker:On,deleteBlocker:vn,_internalFetchControllers:at,_internalActiveDeferreds:Ft},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),it=e.createURL(s),ct=c||_e.toString()===it.toString()||_e.search!==it.search,ot=_?Object.keys(_)[0]:void 0,ut=getLoaderMatchesUntilBoundary(o,ot).filter((rt,at)=>{if(rt.route.loader==null)return!1;if(isNewLoader(i.loaderData,i.matches[at],rt)||d.some(mt=>mt===rt.route.id))return!0;let ft=i.matches[at],vt=rt;return shouldRevalidateLoader(rt,_extends$2({currentUrl:_e,currentParams:ft.params,nextUrl:it,nextParams:vt.params},a,{actionResult:et,defaultShouldRevalidate:ct||isNewRouteInstance(ft,vt)}))}),tt=[];return b&&b.forEach((rt,at)=>{if(o.some(ft=>ft.route.id===rt.routeId))h.includes(at)?tt.push(_extends$2({key:at},rt)):shouldRevalidateLoader(rt.match,_extends$2({currentUrl:_e,currentParams:i.matches[i.matches.length-1].params,nextUrl:it,nextParams:o[o.length-1].params},a,{actionResult:et,defaultShouldRevalidate:ct}))&&tt.push(_extends$2({key:at},rt));else return}),[ut,tt]}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((it,ct)=>b=ct),_e=()=>b();i.signal.addEventListener("abort",_e);try{let it=o.route[e];invariant(it,"Could not find the "+e+' to run on the "'+o.route.id+'" route'),_=await Promise.race([it({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(it){g=ResultType.error,_=it}finally{i.signal.removeEventListener("abort",_e)}if(isResponse(_)){let it=_.status;if(redirectStatusCodes.has(it)){let dt=_.headers.get("Location");if(invariant(dt,"Redirects returned/thrown from loaders/actions must have a Location header"),/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(dt)){if(!c){let tt=new URL(i.url),rt=dt.startsWith("//")?new URL(tt.protocol+dt):new URL(dt);rt.origin===tt.origin&&(dt=rt.pathname+rt.search+rt.hash)}}else{let tt=a.slice(0,a.indexOf(o)+1),rt=getPathContributingMatches(tt).map(ft=>ft.pathnameBase),at=resolveTo(dt,rt,new URL(i.url).pathname);if(invariant(createPath(at),"Unable to resolve redirect location: "+dt),s){let ft=at.pathname;at.pathname=ft==="/"?s:joinPaths([s,ft])}dt=createPath(at)}if(c)throw _.headers.set("Location",dt),_;return{type:ResultType.redirect,status:it,location:dt,revalidate:_.headers.get("X-Remix-Revalidate")!==null}}if(d)throw{type:g||ResultType.data,response:_};let ct,ot=_.headers.get("Content-Type");return ot&&/\bapplication\/json\b/.test(ot)?ct=await _.json():ct=await _.text(),g===ResultType.error?{type:g,error:new ErrorResponse(it,_.statusText,ct),headers:_.headers}:{type:ResultType.data,data:ct,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 it=findNearestBoundary(e,_e),ct=b.error;a&&(ct=Object.values(a)[0],a=void 0),d=d||{},d[it.route.id]==null&&(d[it.route.id]=ct),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]}/** + */function _extends$2(){return _extends$2=Object.assign?Object.assign.bind():function(e){for(var i=1;i"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 dt=b(),ut=dt==null?null:dt-_;_=dt,g&&g({action:h,location:ot.location,delta:ut})}function _e(dt,ut){h=Action.Push;let tt=createLocation(ot.location,dt,ut);o&&o(tt,dt),_=b()+1;let rt=getHistoryState(tt,_),at=ot.createHref(tt);try{d.pushState(rt,"",at)}catch{s.location.assign(at)}c&&g&&g({action:h,location:ot.location,delta:1})}function it(dt,ut){h=Action.Replace;let tt=createLocation(ot.location,dt,ut);o&&o(tt,dt),_=b();let rt=getHistoryState(tt,_),at=ot.createHref(tt);d.replaceState(rt,"",at),c&&g&&g({action:h,location:ot.location,delta:0})}function ct(dt){let ut=s.location.origin!=="null"?s.location.origin:s.location.href,tt=typeof dt=="string"?dt:createPath(dt);return invariant(ut,"No window.location.(origin|href) available to create URL for href: "+tt),new URL(tt,ut)}let ot={get action(){return h},get location(){return e(s,d)},listen(dt){if(g)throw new Error("A history only accepts one active listener");return s.addEventListener(PopStateEventType,et),g=dt,()=>{s.removeEventListener(PopStateEventType,et),g=null}},createHref(dt){return i(s,dt)},createURL:ct,encodeLocation(dt){let ut=ct(dt);return{pathname:ut.pathname,search:ut.search,hash:ut.hash}},push:_e,replace:it,go(dt){return d.go(dt)}};return ot}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 gt=getInternalRouterError(404,{pathname:e.history.location.pathname}),{matches:Et,route:Ct}=getShortCircuitMatches(i);g=Et,_={[Ct.id]:gt}}let b=!g.some(gt=>gt.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},it=Action.Pop,ct=!1,ot,dt=!1,ut=!1,tt=[],rt=[],at=new Map,ft=0,vt=-1,mt=new Map,xt=new Set,kt=new Map,Ft=new Map,Mt=null,Pt=new Map,Ht=!1;function Kt(){return o=e.history.listen(gt=>{let{action:Et,location:Ct,delta:$t}=gt;if(Ht){Ht=!1;return}warning(Mt!=null&&$t===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 _t=Mn({currentLocation:_e.location,nextLocation:Ct,historyAction:Et});if(_t&&$t!=null){Ht=!0,e.history.go($t*-1),Cn(_t,{state:"blocked",location:Ct,proceed(){Cn(_t,{state:"proceeding",proceed:void 0,reset:void 0,location:Ct}),e.history.go($t)},reset(){vn(_t),Vt({blockers:new Map(et.state.blockers)})}});return}return Ot(Et,Ct)}),_e.initialized||Ot(Action.Pop,_e.location),et}function Yt(){o&&o(),a.clear(),ot&&ot.abort(),_e.fetchers.forEach((gt,Et)=>kn(Et)),_e.blockers.forEach((gt,Et)=>vn(Et))}function zt(gt){return a.add(gt),()=>a.delete(gt)}function Vt(gt){_e=_extends$2({},_e,gt),a.forEach(Et=>Et(_e))}function wt(gt,Et){var Ct,$t;let _t=_e.actionData!=null&&_e.navigation.formMethod!=null&&isMutationMethod(_e.navigation.formMethod)&&_e.navigation.state==="loading"&&((Ct=gt.state)==null?void 0:Ct._isRedirect)!==!0,Rt;Et.actionData?Object.keys(Et.actionData).length>0?Rt=Et.actionData:Rt=null:_t?Rt=_e.actionData:Rt=null;let bt=Et.loaderData?mergeLoaderData(_e.loaderData,Et.loaderData,Et.matches||[],Et.errors):_e.loaderData;for(let[Dt]of Pt)vn(Dt);let Nt=ct===!0||_e.navigation.formMethod!=null&&isMutationMethod(_e.navigation.formMethod)&&(($t=gt.state)==null?void 0:$t._isRedirect)!==!0;Vt(_extends$2({},Et,{actionData:Rt,loaderData:bt,historyAction:it,location:gt,initialized:!0,navigation:IDLE_NAVIGATION,revalidation:"idle",restoreScrollPosition:jn(gt,Et.matches||_e.matches),preventScrollReset:Nt,blockers:new Map(_e.blockers)})),dt||it===Action.Pop||(it===Action.Push?e.history.push(gt,gt.state):it===Action.Replace&&e.history.replace(gt,gt.state)),it=Action.Pop,ct=!1,dt=!1,ut=!1,tt=[],rt=[]}async function St(gt,Et){if(typeof gt=="number"){e.history.go(gt);return}let{path:Ct,submission:$t,error:_t}=normalizeNavigateOptions(gt,Et),Rt=_e.location,bt=createLocation(_e.location,Ct,Et&&Et.state);bt=_extends$2({},bt,e.history.encodeLocation(bt));let Nt=Et&&Et.replace!=null?Et.replace:void 0,Dt=Action.Push;Nt===!0?Dt=Action.Replace:Nt===!1||$t!=null&&isMutationMethod($t.formMethod)&&$t.formAction===_e.location.pathname+_e.location.search&&(Dt=Action.Replace);let Zt=Et&&"preventScrollReset"in Et?Et.preventScrollReset===!0:void 0,It=Mn({currentLocation:Rt,nextLocation:bt,historyAction:Dt});if(It){Cn(It,{state:"blocked",location:bt,proceed(){Cn(It,{state:"proceeding",proceed:void 0,reset:void 0,location:bt}),St(gt,Et)},reset(){vn(It),Vt({blockers:new Map(_e.blockers)})}});return}return await Ot(Dt,bt,{submission:$t,pendingError:_t,preventScrollReset:Zt,replace:Et&&Et.replace})}function Tt(){if(Bn(),Vt({revalidation:"loading"}),_e.navigation.state!=="submitting"){if(_e.navigation.state==="idle"){Ot(_e.historyAction,_e.location,{startUninterruptedRevalidation:!0});return}Ot(it||_e.historyAction,_e.navigation.location,{overrideNavigation:_e.navigation})}}async function Ot(gt,Et,Ct){ot&&ot.abort(),ot=null,it=gt,dt=(Ct&&Ct.startUninterruptedRevalidation)===!0,xn(_e.location,_e.matches),ct=(Ct&&Ct.preventScrollReset)===!0;let $t=Ct&&Ct.overrideNavigation,_t=matchRoutes(i,Et,e.basename);if(!_t){let jt=getInternalRouterError(404,{pathname:Et.pathname}),{matches:qt,route:en}=getShortCircuitMatches(i);Tn(),wt(Et,{matches:qt,loaderData:{},errors:{[en.id]:jt}});return}if(isHashChangeOnly(_e.location,Et)&&!(Ct&&Ct.submission&&isMutationMethod(Ct.submission.formMethod))){wt(Et,{matches:_t});return}ot=new AbortController;let Rt=createClientSideRequest(e.history,Et,ot.signal,Ct&&Ct.submission),bt,Nt;if(Ct&&Ct.pendingError)Nt={[findNearestBoundary(_t).route.id]:Ct.pendingError};else if(Ct&&Ct.submission&&isMutationMethod(Ct.submission.formMethod)){let jt=await Gt(Rt,Et,Ct.submission,_t,{replace:Ct.replace});if(jt.shortCircuited)return;bt=jt.pendingActionData,Nt=jt.pendingActionError,$t=_extends$2({state:"loading",location:Et},Ct.submission),Rt=new Request(Rt.url,{signal:Rt.signal})}let{shortCircuited:Dt,loaderData:Zt,errors:It}=await un(Rt,Et,_t,$t,Ct&&Ct.submission,Ct&&Ct.replace,bt,Nt);Dt||(ot=null,wt(Et,_extends$2({matches:_t},bt?{actionData:bt}:{},{loaderData:Zt,errors:It})))}async function Gt(gt,Et,Ct,$t,_t){Bn();let Rt=_extends$2({state:"submitting",location:Et},Ct);Vt({navigation:Rt});let bt,Nt=getTargetMatch($t,Et);if(!Nt.route.action)bt={type:ResultType.error,error:getInternalRouterError(405,{method:gt.method,pathname:Et.pathname,routeId:Nt.route.id})};else if(bt=await callLoaderOrAction("action",gt,Nt,$t,et.basename),gt.signal.aborted)return{shortCircuited:!0};if(isRedirectResult(bt)){let Dt;return _t&&_t.replace!=null?Dt=_t.replace:Dt=bt.location===_e.location.pathname+_e.location.search,await mn(_e,bt,{submission:Ct,replace:Dt}),{shortCircuited:!0}}if(isErrorResult(bt)){let Dt=findNearestBoundary($t,Nt.route.id);return(_t&&_t.replace)!==!0&&(it=Action.Push),{pendingActionData:{},pendingActionError:{[Dt.route.id]:bt.error}}}if(isDeferredResult(bt))throw getInternalRouterError(400,{type:"defer-action"});return{pendingActionData:{[Nt.route.id]:bt.data}}}async function un(gt,Et,Ct,$t,_t,Rt,bt,Nt){let Dt=$t;Dt||(Dt=_extends$2({state:"loading",location:Et,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},_t));let Zt=_t||(Dt.formMethod&&Dt.formAction&&Dt.formData&&Dt.formEncType?{formMethod:Dt.formMethod,formAction:Dt.formAction,formData:Dt.formData,formEncType:Dt.formEncType}:void 0),[It,jt]=getMatchesToLoad(e.history,_e,Ct,Zt,Et,ut,tt,rt,bt,Nt,kt);if(Tn(Xt=>!(Ct&&Ct.some(rn=>rn.route.id===Xt))||It&&It.some(rn=>rn.route.id===Xt)),It.length===0&&jt.length===0)return wt(Et,_extends$2({matches:Ct,loaderData:{},errors:Nt||null},bt?{actionData:bt}:{})),{shortCircuited:!0};if(!dt){jt.forEach(rn=>{let fn=_e.fetchers.get(rn.key),$n={state:"loading",data:fn&&fn.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(rn.key,$n)});let Xt=bt||_e.actionData;Vt(_extends$2({navigation:Dt},Xt?Object.keys(Xt).length===0?{actionData:null}:{actionData:Xt}:{},jt.length>0?{fetchers:new Map(_e.fetchers)}:{}))}vt=++ft,jt.forEach(Xt=>at.set(Xt.key,ot));let{results:qt,loaderResults:en,fetcherResults:En}=await Ln(_e.matches,Ct,It,jt,gt);if(gt.signal.aborted)return{shortCircuited:!0};jt.forEach(Xt=>at.delete(Xt.key));let wn=findRedirect(qt);if(wn)return await mn(_e,wn,{replace:Rt}),{shortCircuited:!0};let{loaderData:yn,errors:cn}=processLoaderData(_e,Ct,It,en,Nt,jt,En,Ft);Ft.forEach((Xt,rn)=>{Xt.subscribe(fn=>{(fn||Xt.done)&&Ft.delete(rn)})}),qn();let _n=Rn(vt);return _extends$2({loaderData:yn,errors:cn},_n||jt.length>0?{fetchers:new Map(_e.fetchers)}:{})}function Qt(gt){return _e.fetchers.get(gt)||IDLE_FETCHER}function gn(gt,Et,Ct,$t){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.");at.has(gt)&&An(gt);let _t=matchRoutes(i,Ct,e.basename);if(!_t){bn(gt,Et,getInternalRouterError(404,{pathname:Ct}));return}let{path:Rt,submission:bt}=normalizeNavigateOptions(Ct,$t,!0),Nt=getTargetMatch(_t,Rt);if(ct=($t&&$t.preventScrollReset)===!0,bt&&isMutationMethod(bt.formMethod)){on(gt,Et,Rt,Nt,_t,bt);return}kt.set(gt,{routeId:Et,path:Rt,match:Nt,matches:_t}),ln(gt,Et,Rt,Nt,_t,bt)}async function on(gt,Et,Ct,$t,_t,Rt){if(Bn(),kt.delete(gt),!$t.route.action){let an=getInternalRouterError(405,{method:Rt.formMethod,pathname:Ct,routeId:Et});bn(gt,Et,an);return}let bt=_e.fetchers.get(gt),Nt=_extends$2({state:"submitting"},Rt,{data:bt&&bt.data," _hasFetcherDoneAnything ":!0});_e.fetchers.set(gt,Nt),Vt({fetchers:new Map(_e.fetchers)});let Dt=new AbortController,Zt=createClientSideRequest(e.history,Ct,Dt.signal,Rt);at.set(gt,Dt);let It=await callLoaderOrAction("action",Zt,$t,_t,et.basename);if(Zt.signal.aborted){at.get(gt)===Dt&&at.delete(gt);return}if(isRedirectResult(It)){at.delete(gt),xt.add(gt);let an=_extends$2({state:"loading"},Rt,{data:void 0," _hasFetcherDoneAnything ":!0});return _e.fetchers.set(gt,an),Vt({fetchers:new Map(_e.fetchers)}),mn(_e,It,{isFetchActionRedirect:!0})}if(isErrorResult(It)){bn(gt,Et,It.error);return}if(isDeferredResult(It))throw getInternalRouterError(400,{type:"defer-action"});let jt=_e.navigation.location||_e.location,qt=createClientSideRequest(e.history,jt,Dt.signal),en=_e.navigation.state!=="idle"?matchRoutes(i,_e.navigation.location,e.basename):_e.matches;invariant(en,"Didn't find any matches after fetcher action");let En=++ft;mt.set(gt,En);let wn=_extends$2({state:"loading",data:It.data},Rt,{" _hasFetcherDoneAnything ":!0});_e.fetchers.set(gt,wn);let[yn,cn]=getMatchesToLoad(e.history,_e,en,Rt,jt,ut,tt,rt,{[$t.route.id]:It.data},void 0,kt);cn.filter(an=>an.key!==gt).forEach(an=>{let In=an.key,Un=_e.fetchers.get(In),nr={state:"loading",data:Un&&Un.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(In,nr),at.set(In,Dt)}),Vt({fetchers:new Map(_e.fetchers)});let{results:_n,loaderResults:Xt,fetcherResults:rn}=await Ln(_e.matches,en,yn,cn,qt);if(Dt.signal.aborted)return;mt.delete(gt),at.delete(gt),cn.forEach(an=>at.delete(an.key));let fn=findRedirect(_n);if(fn)return mn(_e,fn);let{loaderData:$n,errors:Pn}=processLoaderData(_e,_e.matches,yn,Xt,void 0,cn,rn,Ft),Vn={state:"idle",data:It.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(gt,Vn);let tr=Rn(En);_e.navigation.state==="loading"&&En>vt?(invariant(it,"Expected pending action"),ot&&ot.abort(),wt(_e.navigation.location,{matches:en,loaderData:$n,errors:Pn,fetchers:new Map(_e.fetchers)})):(Vt(_extends$2({errors:Pn,loaderData:mergeLoaderData(_e.loaderData,$n,en,Pn)},tr?{fetchers:new Map(_e.fetchers)}:{})),ut=!1)}async function ln(gt,Et,Ct,$t,_t,Rt){let bt=_e.fetchers.get(gt),Nt=_extends$2({state:"loading",formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0},Rt,{data:bt&&bt.data," _hasFetcherDoneAnything ":!0});_e.fetchers.set(gt,Nt),Vt({fetchers:new Map(_e.fetchers)});let Dt=new AbortController,Zt=createClientSideRequest(e.history,Ct,Dt.signal);at.set(gt,Dt);let It=await callLoaderOrAction("loader",Zt,$t,_t,et.basename);if(isDeferredResult(It)&&(It=await resolveDeferredData(It,Zt.signal,!0)||It),at.get(gt)===Dt&&at.delete(gt),Zt.signal.aborted)return;if(isRedirectResult(It)){await mn(_e,It);return}if(isErrorResult(It)){let qt=findNearestBoundary(_e.matches,Et);_e.fetchers.delete(gt),Vt({fetchers:new Map(_e.fetchers),errors:{[qt.route.id]:It.error}});return}invariant(!isDeferredResult(It),"Unhandled fetcher deferred data");let jt={state:"idle",data:It.data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(gt,jt),Vt({fetchers:new Map(_e.fetchers)})}async function mn(gt,Et,Ct){var $t;let{submission:_t,replace:Rt,isFetchActionRedirect:bt}=Ct===void 0?{}:Ct;Et.revalidate&&(ut=!0);let Nt=createLocation(gt.location,Et.location,_extends$2({_isRedirect:!0},bt?{_isFetchActionRedirect:!0}:{}));if(invariant(Nt,"Expected a location on the redirect navigation"),isBrowser$1&&typeof(($t=window)==null?void 0:$t.location)<"u"){let en=e.history.createURL(Et.location).origin;if(window.location.origin!==en){Rt?window.location.replace(Et.location):window.location.assign(Et.location);return}}ot=null;let Dt=Rt===!0?Action.Replace:Action.Push,{formMethod:Zt,formAction:It,formEncType:jt,formData:qt}=gt.navigation;!_t&&Zt&&It&&qt&&jt&&(_t={formMethod:Zt,formAction:It,formEncType:jt,formData:qt}),redirectPreserveMethodStatusCodes.has(Et.status)&&_t&&isMutationMethod(_t.formMethod)?await Ot(Dt,Nt,{submission:_extends$2({},_t,{formAction:Et.location}),preventScrollReset:ct}):await Ot(Dt,Nt,{overrideNavigation:{state:"loading",location:Nt,formMethod:_t?_t.formMethod:void 0,formAction:_t?_t.formAction:void 0,formEncType:_t?_t.formEncType:void 0,formData:_t?_t.formData:void 0},preventScrollReset:ct})}async function Ln(gt,Et,Ct,$t,_t){let Rt=await Promise.all([...Ct.map(Dt=>callLoaderOrAction("loader",_t,Dt,Et,et.basename)),...$t.map(Dt=>callLoaderOrAction("loader",createClientSideRequest(e.history,Dt.path,_t.signal),Dt.match,Dt.matches,et.basename))]),bt=Rt.slice(0,Ct.length),Nt=Rt.slice(Ct.length);return await Promise.all([resolveDeferredResults(gt,Ct,bt,_t.signal,!1,_e.loaderData),resolveDeferredResults(gt,$t.map(Dt=>Dt.match),Nt,_t.signal,!0)]),{results:Rt,loaderResults:bt,fetcherResults:Nt}}function Bn(){ut=!0,tt.push(...Tn()),kt.forEach((gt,Et)=>{at.has(Et)&&(rt.push(Et),An(Et))})}function bn(gt,Et,Ct){let $t=findNearestBoundary(_e.matches,Et);kn(gt),Vt({errors:{[$t.route.id]:Ct},fetchers:new Map(_e.fetchers)})}function kn(gt){at.has(gt)&&An(gt),kt.delete(gt),mt.delete(gt),xt.delete(gt),_e.fetchers.delete(gt)}function An(gt){let Et=at.get(gt);invariant(Et,"Expected fetch controller: "+gt),Et.abort(),at.delete(gt)}function Nn(gt){for(let Et of gt){let $t={state:"idle",data:Qt(Et).data,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0," _hasFetcherDoneAnything ":!0};_e.fetchers.set(Et,$t)}}function qn(){let gt=[];for(let Et of xt){let Ct=_e.fetchers.get(Et);invariant(Ct,"Expected fetcher: "+Et),Ct.state==="loading"&&(xt.delete(Et),gt.push(Et))}Nn(gt)}function Rn(gt){let Et=[];for(let[Ct,$t]of mt)if($t0}function On(gt,Et){let Ct=_e.blockers.get(gt)||IDLE_BLOCKER;return Pt.get(gt)!==Et&&(Pt.set(gt,Et),Mt==null?Mt=gt:gt!==Mt&&warning(!1,"A router only supports one blocker at a time")),Ct}function vn(gt){_e.blockers.delete(gt),Pt.delete(gt),Mt===gt&&(Mt=null)}function Cn(gt,Et){let Ct=_e.blockers.get(gt)||IDLE_BLOCKER;invariant(Ct.state==="unblocked"&&Et.state==="blocked"||Ct.state==="blocked"&&Et.state==="blocked"||Ct.state==="blocked"&&Et.state==="proceeding"||Ct.state==="blocked"&&Et.state==="unblocked"||Ct.state==="proceeding"&&Et.state==="unblocked","Invalid blocker state transition: "+Ct.state+" -> "+Et.state),_e.blockers.set(gt,Et),Vt({blockers:new Map(_e.blockers)})}function Mn(gt){let{currentLocation:Et,nextLocation:Ct,historyAction:$t}=gt;if(Mt==null)return;let _t=Pt.get(Mt);invariant(_t,"Could not find a function for the active blocker");let Rt=_e.blockers.get(Mt);if(!(Rt&&Rt.state==="proceeding")&&_t({currentLocation:Et,nextLocation:Ct,historyAction:$t}))return Mt}function Tn(gt){let Et=[];return Ft.forEach((Ct,$t)=>{(!gt||gt($t))&&(Ct.cancel(),Et.push($t),Ft.delete($t))}),Et}function er(gt,Et,Ct){if(s=gt,d=Et,c=Ct||($t=>$t.key),!h&&_e.navigation===IDLE_NAVIGATION){h=!0;let $t=jn(_e.location,_e.matches);$t!=null&&Vt({restoreScrollPosition:$t})}return()=>{s=null,d=null,c=null}}function xn(gt,Et){if(s&&c&&d){let Ct=Et.map(_t=>createUseMatchesMatch(_t,_e.loaderData)),$t=c(gt,Ct)||gt.key;s[$t]=d()}}function jn(gt,Et){if(s&&c&&d){let Ct=Et.map(Rt=>createUseMatchesMatch(Rt,_e.loaderData)),$t=c(gt,Ct)||gt.key,_t=s[$t];if(typeof _t=="number")return _t}return null}return et={get basename(){return e.basename},get state(){return _e},get routes(){return i},initialize:Kt,subscribe:zt,enableScrollRestoration:er,navigate:St,fetch:gn,revalidate:Tt,createHref:gt=>e.history.createHref(gt),encodeLocation:gt=>e.history.encodeLocation(gt),getFetcher:Qt,deleteFetcher:kn,dispose:Yt,getBlocker:On,deleteBlocker:vn,_internalFetchControllers:at,_internalActiveDeferreds:Ft},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),it=e.createURL(s),ct=c||_e.toString()===it.toString()||_e.search!==it.search,ot=_?Object.keys(_)[0]:void 0,ut=getLoaderMatchesUntilBoundary(o,ot).filter((rt,at)=>{if(rt.route.loader==null)return!1;if(isNewLoader(i.loaderData,i.matches[at],rt)||d.some(mt=>mt===rt.route.id))return!0;let ft=i.matches[at],vt=rt;return shouldRevalidateLoader(rt,_extends$2({currentUrl:_e,currentParams:ft.params,nextUrl:it,nextParams:vt.params},a,{actionResult:et,defaultShouldRevalidate:ct||isNewRouteInstance(ft,vt)}))}),tt=[];return b&&b.forEach((rt,at)=>{if(o.some(ft=>ft.route.id===rt.routeId))h.includes(at)?tt.push(_extends$2({key:at},rt)):shouldRevalidateLoader(rt.match,_extends$2({currentUrl:_e,currentParams:i.matches[i.matches.length-1].params,nextUrl:it,nextParams:o[o.length-1].params},a,{actionResult:et,defaultShouldRevalidate:ct}))&&tt.push(_extends$2({key:at},rt));else return}),[ut,tt]}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((it,ct)=>b=ct),_e=()=>b();i.signal.addEventListener("abort",_e);try{let it=o.route[e];invariant(it,"Could not find the "+e+' to run on the "'+o.route.id+'" route'),_=await Promise.race([it({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(it){g=ResultType.error,_=it}finally{i.signal.removeEventListener("abort",_e)}if(isResponse(_)){let it=_.status;if(redirectStatusCodes.has(it)){let dt=_.headers.get("Location");if(invariant(dt,"Redirects returned/thrown from loaders/actions must have a Location header"),/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i.test(dt)){if(!c){let tt=new URL(i.url),rt=dt.startsWith("//")?new URL(tt.protocol+dt):new URL(dt);rt.origin===tt.origin&&(dt=rt.pathname+rt.search+rt.hash)}}else{let tt=a.slice(0,a.indexOf(o)+1),rt=getPathContributingMatches(tt).map(ft=>ft.pathnameBase),at=resolveTo(dt,rt,new URL(i.url).pathname);if(invariant(createPath(at),"Unable to resolve redirect location: "+dt),s){let ft=at.pathname;at.pathname=ft==="/"?s:joinPaths([s,ft])}dt=createPath(at)}if(c)throw _.headers.set("Location",dt),_;return{type:ResultType.redirect,status:it,location:dt,revalidate:_.headers.get("X-Remix-Revalidate")!==null}}if(d)throw{type:g||ResultType.data,response:_};let ct,ot=_.headers.get("Content-Type");return ot&&/\bapplication\/json\b/.test(ot)?ct=await _.json():ct=await _.text(),g===ResultType.error?{type:g,error:new ErrorResponse(it,_.statusText,ct),headers:_.headers}:{type:ResultType.data,data:ct,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 it=findNearestBoundary(e,_e),ct=b.error;a&&(ct=Object.values(a)[0],a=void 0),d=d||{},d[it.route.id]==null&&(d[it.route.id]=ct),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. @@ -49,7 +49,7 @@ var Wo=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports);var Ko=Wo((export * * 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(wt,St){var Tt=wt.length;wt.push(St);e:for(;0>>1,Gt=wt[Ot];if(0>>1;Ots(gn,Tt))ons(ln,gn)?(wt[Ot]=ln,wt[on]=Tt,Ot=on):(wt[Ot]=gn,wt[Qt]=Tt,Ot=Qt);else if(ons(ln,Tt))wt[Ot]=ln,wt[on]=Tt,Ot=on;else break e}}return St}function s(wt,St){var Tt=wt.sortIndex-St.sortIndex;return Tt!==0?Tt:wt.id-St.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,it=!1,ct=!1,ot=!1,dt=typeof setTimeout=="function"?setTimeout:null,ut=typeof clearTimeout=="function"?clearTimeout:null,tt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function rt(wt){for(var St=o(_);St!==null;){if(St.callback===null)a(_);else if(St.startTime<=wt)a(_),St.sortIndex=St.expirationTime,i(g,St);else break;St=o(_)}}function at(wt){if(ot=!1,rt(wt),!ct)if(o(g)!==null)ct=!0,zt(ft);else{var St=o(_);St!==null&&Vt(at,St.startTime-wt)}}function ft(wt,St){ct=!1,ot&&(ot=!1,ut(xt),xt=-1),it=!0;var Tt=_e;try{for(rt(St),et=o(g);et!==null&&(!(et.expirationTime>St)||wt&&!Mt());){var Ot=et.callback;if(typeof Ot=="function"){et.callback=null,_e=et.priorityLevel;var Gt=Ot(et.expirationTime<=St);St=e.unstable_now(),typeof Gt=="function"?et.callback=Gt:et===o(g)&&a(g),rt(St)}else a(g);et=o(g)}if(et!==null)var un=!0;else{var Qt=o(_);Qt!==null&&Vt(at,Qt.startTime-St),un=!1}return un}finally{et=null,_e=Tt,it=!1}}var vt=!1,mt=null,xt=-1,Rt=5,Ft=-1;function Mt(){return!(e.unstable_now()-Ftwt||125Ot?(wt.sortIndex=Tt,i(_,wt),o(g)===null&&wt===o(_)&&(ot?(ut(xt),xt=-1):ot=!0,Vt(at,Tt-Ot))):(wt.sortIndex=Gt,i(g,wt),ct||it||(ct=!0,zt(ft))),wt},e.unstable_shouldYield=Mt,e.unstable_wrapCallback=function(wt){var St=_e;return function(){var Tt=_e;_e=St;try{return wt.apply(this,arguments)}finally{_e=Tt}}}})(scheduler_production_min);(function(e){e.exports=scheduler_production_min})(scheduler);/** + */(function(e){function i(wt,St){var Tt=wt.length;wt.push(St);e:for(;0>>1,Gt=wt[Ot];if(0>>1;Ots(gn,Tt))ons(ln,gn)?(wt[Ot]=ln,wt[on]=Tt,Ot=on):(wt[Ot]=gn,wt[Qt]=Tt,Ot=Qt);else if(ons(ln,Tt))wt[Ot]=ln,wt[on]=Tt,Ot=on;else break e}}return St}function s(wt,St){var Tt=wt.sortIndex-St.sortIndex;return Tt!==0?Tt:wt.id-St.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,it=!1,ct=!1,ot=!1,dt=typeof setTimeout=="function"?setTimeout:null,ut=typeof clearTimeout=="function"?clearTimeout:null,tt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function rt(wt){for(var St=o(_);St!==null;){if(St.callback===null)a(_);else if(St.startTime<=wt)a(_),St.sortIndex=St.expirationTime,i(g,St);else break;St=o(_)}}function at(wt){if(ot=!1,rt(wt),!ct)if(o(g)!==null)ct=!0,zt(ft);else{var St=o(_);St!==null&&Vt(at,St.startTime-wt)}}function ft(wt,St){ct=!1,ot&&(ot=!1,ut(xt),xt=-1),it=!0;var Tt=_e;try{for(rt(St),et=o(g);et!==null&&(!(et.expirationTime>St)||wt&&!Mt());){var Ot=et.callback;if(typeof Ot=="function"){et.callback=null,_e=et.priorityLevel;var Gt=Ot(et.expirationTime<=St);St=e.unstable_now(),typeof Gt=="function"?et.callback=Gt:et===o(g)&&a(g),rt(St)}else a(g);et=o(g)}if(et!==null)var un=!0;else{var Qt=o(_);Qt!==null&&Vt(at,Qt.startTime-St),un=!1}return un}finally{et=null,_e=Tt,it=!1}}var vt=!1,mt=null,xt=-1,kt=5,Ft=-1;function Mt(){return!(e.unstable_now()-Ftwt||125Ot?(wt.sortIndex=Tt,i(_,wt),o(g)===null&&wt===o(_)&&(ot?(ut(xt),xt=-1):ot=!0,Vt(at,Tt-Ot))):(wt.sortIndex=Gt,i(g,wt),ct||it||(ct=!0,zt(ft))),wt},e.unstable_shouldYield=Mt,e.unstable_wrapCallback=function(wt){var St=_e;return function(){var Tt=_e;_e=St;try{return wt.apply(this,arguments)}finally{_e=Tt}}}})(scheduler_production_min);(function(e){e.exports=scheduler_production_min})(scheduler);/** * @license React * react-dom.production.min.js * @@ -62,10 +62,10 @@ var Wo=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports);var Ko=Wo((export `),c=a.stack.split(` `),d=s.length-1,h=c.length-1;1<=d&&0<=h&&s[d]!==c[h];)h--;for(;1<=d&&0<=h;d--,h--)if(s[d]!==c[h]){if(d!==1||h!==1)do if(d--,h--,0>h||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<xt?(Rt=mt,mt=null):Rt=mt.sibling;var Ft=_e(ut,mt,rt[xt],at);if(Ft===null){mt===null&&(mt=Rt);break}e&&mt&&Ft.alternate===null&&i(ut,mt),tt=c(Ft,tt,xt),vt===null?ft=Ft:vt.sibling=Ft,vt=Ft,mt=Rt}if(xt===rt.length)return o(ut,mt),I&&tg(ut,xt),ft;if(mt===null){for(;xtxt?(Rt=mt,mt=null):Rt=mt.sibling;var Mt=_e(ut,mt,Ft.value,at);if(Mt===null){mt===null&&(mt=Rt);break}e&&mt&&Mt.alternate===null&&i(ut,mt),tt=c(Mt,tt,xt),vt===null?ft=Mt:vt.sibling=Mt,vt=Mt,mt=Rt}if(Ft.done)return o(ut,mt),I&&tg(ut,xt),ft;if(mt===null){for(;!Ft.done;xt++,Ft=rt.next())Ft=et(ut,Ft.value,at),Ft!==null&&(tt=c(Ft,tt,xt),vt===null?ft=Ft:vt.sibling=Ft,vt=Ft);return I&&tg(ut,xt),ft}for(mt=a(ut,mt);!Ft.done;xt++,Ft=rt.next())Ft=it(mt,ut,xt,Ft.value,at),Ft!==null&&(e&&Ft.alternate!==null&&mt.delete(Ft.key===null?xt:Ft.key),tt=c(Ft,tt,xt),vt===null?ft=Ft:vt.sibling=Ft,vt=Ft);return e&&mt.forEach(function(Pt){return i(ut,Pt)}),I&&tg(ut,xt),ft}function dt(ut,tt,rt,at){if(typeof rt=="object"&&rt!==null&&rt.type===ya&&rt.key===null&&(rt=rt.props.children),typeof rt=="object"&&rt!==null){switch(rt.$$typeof){case va:e:{for(var ft=rt.key,vt=tt;vt!==null;){if(vt.key===ft){if(ft=rt.type,ft===ya){if(vt.tag===7){o(ut,vt.sibling),tt=s(vt,rt.props.children),tt.return=ut,ut=tt;break e}}else if(vt.elementType===ft||typeof ft=="object"&&ft!==null&&ft.$$typeof===Ha&&uh(ft)===vt.type){o(ut,vt.sibling),tt=s(vt,rt.props),tt.ref=sh(ut,vt,rt),tt.return=ut,ut=tt;break e}o(ut,vt);break}else i(ut,vt);vt=vt.sibling}rt.type===ya?(tt=Ah(rt.props.children,ut.mode,at,rt.key),tt.return=ut,ut=tt):(at=yh(rt.type,rt.key,rt.props,null,ut.mode,at),at.ref=sh(ut,tt,rt),at.return=ut,ut=at)}return d(ut);case wa:e:{for(vt=rt.key;tt!==null;){if(tt.key===vt)if(tt.tag===4&&tt.stateNode.containerInfo===rt.containerInfo&&tt.stateNode.implementation===rt.implementation){o(ut,tt.sibling),tt=s(tt,rt.children||[]),tt.return=ut,ut=tt;break e}else{o(ut,tt);break}else i(ut,tt);tt=tt.sibling}tt=zh(rt,ut.mode,at),tt.return=ut,ut=tt}return d(ut);case Ha:return vt=rt._init,dt(ut,tt,vt(rt._payload),at)}if(eb(rt))return ct(ut,tt,rt,at);if(Ka(rt))return ot(ut,tt,rt,at);th(ut,rt)}return typeof rt=="string"&&rt!==""||typeof rt=="number"?(rt=""+rt,tt!==null&&tt.tag===6?(o(ut,tt.sibling),tt=s(tt,rt),tt.return=ut,ut=tt):(o(ut,tt),tt=xh(rt,ut.mode,at),tt.return=ut,ut=tt),d(ut)):o(ut,tt)}return dt}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++,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<xt?(kt=mt,mt=null):kt=mt.sibling;var Ft=_e(ut,mt,rt[xt],at);if(Ft===null){mt===null&&(mt=kt);break}e&&mt&&Ft.alternate===null&&i(ut,mt),tt=c(Ft,tt,xt),vt===null?ft=Ft:vt.sibling=Ft,vt=Ft,mt=kt}if(xt===rt.length)return o(ut,mt),I&&tg(ut,xt),ft;if(mt===null){for(;xtxt?(kt=mt,mt=null):kt=mt.sibling;var Mt=_e(ut,mt,Ft.value,at);if(Mt===null){mt===null&&(mt=kt);break}e&&mt&&Mt.alternate===null&&i(ut,mt),tt=c(Mt,tt,xt),vt===null?ft=Mt:vt.sibling=Mt,vt=Mt,mt=kt}if(Ft.done)return o(ut,mt),I&&tg(ut,xt),ft;if(mt===null){for(;!Ft.done;xt++,Ft=rt.next())Ft=et(ut,Ft.value,at),Ft!==null&&(tt=c(Ft,tt,xt),vt===null?ft=Ft:vt.sibling=Ft,vt=Ft);return I&&tg(ut,xt),ft}for(mt=a(ut,mt);!Ft.done;xt++,Ft=rt.next())Ft=it(mt,ut,xt,Ft.value,at),Ft!==null&&(e&&Ft.alternate!==null&&mt.delete(Ft.key===null?xt:Ft.key),tt=c(Ft,tt,xt),vt===null?ft=Ft:vt.sibling=Ft,vt=Ft);return e&&mt.forEach(function(Pt){return i(ut,Pt)}),I&&tg(ut,xt),ft}function dt(ut,tt,rt,at){if(typeof rt=="object"&&rt!==null&&rt.type===ya&&rt.key===null&&(rt=rt.props.children),typeof rt=="object"&&rt!==null){switch(rt.$$typeof){case va:e:{for(var ft=rt.key,vt=tt;vt!==null;){if(vt.key===ft){if(ft=rt.type,ft===ya){if(vt.tag===7){o(ut,vt.sibling),tt=s(vt,rt.props.children),tt.return=ut,ut=tt;break e}}else if(vt.elementType===ft||typeof ft=="object"&&ft!==null&&ft.$$typeof===Ha&&uh(ft)===vt.type){o(ut,vt.sibling),tt=s(vt,rt.props),tt.ref=sh(ut,vt,rt),tt.return=ut,ut=tt;break e}o(ut,vt);break}else i(ut,vt);vt=vt.sibling}rt.type===ya?(tt=Ah(rt.props.children,ut.mode,at,rt.key),tt.return=ut,ut=tt):(at=yh(rt.type,rt.key,rt.props,null,ut.mode,at),at.ref=sh(ut,tt,rt),at.return=ut,ut=at)}return d(ut);case wa:e:{for(vt=rt.key;tt!==null;){if(tt.key===vt)if(tt.tag===4&&tt.stateNode.containerInfo===rt.containerInfo&&tt.stateNode.implementation===rt.implementation){o(ut,tt.sibling),tt=s(tt,rt.children||[]),tt.return=ut,ut=tt;break e}else{o(ut,tt);break}else i(ut,tt);tt=tt.sibling}tt=zh(rt,ut.mode,at),tt.return=ut,ut=tt}return d(ut);case Ha:return vt=rt._init,dt(ut,tt,vt(rt._payload),at)}if(eb(rt))return ct(ut,tt,rt,at);if(Ka(rt))return ot(ut,tt,rt,at);th(ut,rt)}return typeof rt=="string"&&rt!==""||typeof rt=="number"?(rt=""+rt,tt!==null&&tt.tag===6?(o(ut,tt.sibling),tt=s(tt,rt),tt.return=ut,ut=tt):(o(ut,tt),tt=xh(rt,ut.mode,at),tt.return=ut,ut=tt),d(ut)):o(ut,tt)}return dt}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 it;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),(it=et.firstChild)!==null;)_e=et,et=it;for(;;){if(et===e)break t;if(_e===o&&++_===s&&(h=d),_e===c&&++b===a&&(g=d),(it=et.nextSibling)!==null)break;et=_e,_e=et.parentNode}et=it}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 ct=i.alternate;if(i.flags&1024)switch(i.tag){case 0:case 11:case 15:break;case 1:if(ct!==null){var ot=ct.memoizedProps,dt=ct.memoizedState,ut=i.stateNode,tt=ut.getSnapshotBeforeUpdate(i.elementType===i.type?ot:Lg(i.type,ot),dt);ut.__reactInternalSnapshotBeforeUpdate=tt}break;case 3:var rt=i.stateNode.containerInfo;rt.nodeType===1?rt.textContent="":rt.nodeType===9&&rt.documentElement&&rt.removeChild(rt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163))}}catch(at){W(i,i.return,at)}if(e=i.sibling,e!==null){e.return=i.return,V=e;break}V=i.return}return ct=Oj,Oj=!1,ct}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,it)=>jsxRuntimeExports.jsx("tspan",{x:et,dy:h,children:_e},it))}),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,it=b===1?_:et,ct=h;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("text",{x:g,y:_,children:s.map((ot,dt)=>jsxRuntimeExports.jsx("tspan",{x:g,dy:d,children:ot},dt))}),jsxRuntimeExports.jsx("line",{x1:ct,y1:it,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(Pt=>Pt.type==="label").forEach(Pt=>{o[Pt.id]=Pt.text}),e.statements.forEach(Pt=>{if(Pt.type==="edgeLabel"){const Ut=Pt.id1`${Pt.x},${Pt.y}`).join(" ");React.useEffect(()=>{const Pt=document.getElementById("cloudSvgInner"),Ut=document.getElementById("cloudSvgContainer");Pt==null||Pt.setAttribute("transform",computeResizeTransform(Pt,Ut,10,0)+", translate(-10, 0)"),i(document.getElementById("cloudSvg"))},[e]);const Mt=` +`,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,it)=>jsxRuntimeExports.jsx("tspan",{x:et,dy:h,children:_e},it))}),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,it=b===1?_:et,ct=h;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("text",{x:g,y:_,children:s.map((ot,dt)=>jsxRuntimeExports.jsx("tspan",{x:g,dy:d,children:ot},dt))}),jsxRuntimeExports.jsx("line",{x1:ct,y1:it,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(Pt=>Pt.type==="label").forEach(Pt=>{o[Pt.id]=Pt.text}),e.statements.forEach(Pt=>{if(Pt.type==="edgeLabel"){const Ht=Pt.id1`${Pt.x},${Pt.y}`).join(" ");React.useEffect(()=>{const Pt=document.getElementById("cloudSvgInner"),Ht=document.getElementById("cloudSvgContainer");Pt==null||Pt.setAttribute("transform",computeResizeTransform(Pt,Ht,10,0)+", translate(-10, 0)"),i(document.getElementById("cloudSvg"))},[e]);const Mt=` svg { font-family: "trebuchet ms", verdana, arial, sans-serif; font-size: 13px; @@ -81,7 +81,7 @@ Error generating stack: `+c.message+` 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:it.x,y:it.y,width:b,height:et}),jsxRuntimeExports.jsx(CloudNode,{annotation:"C",text:o.C,x:ct.x,y:ct.y,width:b,height:et}),jsxRuntimeExports.jsx(CloudNode,{annotation:"D",text:o.D,x:ot.x,y:ot.y,width:b,height:et}),jsxRuntimeExports.jsx(CloudNode,{annotation:"D'",text:o["D'"],x:dt.x,y:dt.y,width:b,height:et}),jsxRuntimeExports.jsx(CloudEdge,{edge:ut}),jsxRuntimeExports.jsx(CloudEdge,{edge:tt}),jsxRuntimeExports.jsx(CloudEdge,{edge:rt}),jsxRuntimeExports.jsx(CloudEdge,{edge:at}),jsxRuntimeExports.jsx(Injection,{text:a["A-B"],edge:ut,dx:-100,dy:-125}),jsxRuntimeExports.jsx(Injection,{text:a["A-C"],edge:tt,dx:-100,dy:125}),jsxRuntimeExports.jsx(Injection,{text:a["B-D"],edge:rt,dx:0,dy:-75}),jsxRuntimeExports.jsx(Injection,{text:a["C-D'"],edge:at,dx:0,dy:75}),jsxRuntimeExports.jsx(Injection,{text:a["D-D'"],edge:Rt,dx:120,dy:20}),jsxRuntimeExports.jsx("polyline",{points:Ft,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=rt&&(rt=tt+1);!(ft=dt[rt])&&++rt=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,it,ct){if(_!==et||b!==_e){var ot=it.push(s(it)+"scale(",null,",",null,")");ct.push({i:ot-4,x:interpolateNumber(_,et)},{i:ot-2,x:interpolateNumber(b,_e)})}else(et!==1||_e!==1)&&it.push(s(it)+"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(it){for(var ct=-1,ot=_e.length,dt;++ct=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,it;if(o.state!==SCHEDULED)return g();for(b in a)if(it=a[b],it.name===o.name){if(it.state===STARTED)return timeout(d);it.state===RUNNING?(it.state=ENDED,it.timer.stop(),it.on.call("interrupt",e,e.__data__,it.index,it.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 it=a-d,ct=s-h,ot=g*g+_*_,dt=it*it+ct*ct,ut=Math.sqrt(ot),tt=Math.sqrt(_e),rt=c*Math.tan((pi-Math.acos((ot+_e-dt)/(2*ut*tt)))/2),at=rt/tt,ft=rt/ut;Math.abs(at-1)>epsilon&&this._append`L${i+at*b},${o+at*et}`,this._append`A${c},${c},0,0,${+(et*it>b*ct)},${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,it;for(a==null&&(c=s(it=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,it=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),it=_e.borderTop?_e.borderTop:et,ct=_e.borderBottom?_e.borderBottom:et,ot=_e.borderTop?a:2*a,dt=it!==ct?1:s-c[d]+1;e.setEdge(g,it,{weight:ot,minlen:dt,nestingEdge:!0}),e.setEdge(ct,_,{weight:ot,minlen:dt,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(ct){return ct!==d&&ct!==h}));var _=barycenter(e,s);forEach(_,function(ct){if(e.children(ct.v).length){var ot=sortSubgraph(e,ct.v,o,a);g[ct.v]=ot,has(ot,"barycenter")&&mergeBarycenters(ct,ot)}});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]),it=e.node(e.predecessors(h)[0]);has(et,"barycenter")||(et.barycenter=0,et.weight=0),et.barycenter=(et.barycenter*et.weight+_e.order+it.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),it=_e?e.node(_e).order:g;(_e||b===_)&&(forEach(c.slice(h,et+1),function(ct){forEach(e.predecessors(ct),function(ot){var dt=e.node(ot),ut=dt.order;(ut_)&&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(ot){return d[ot]});for(var et=(b.length-1)/2,_e=Math.floor(et),it=Math.ceil(et);_e<=it;++_e){var ct=b[_e];c[_]===_&&g{}};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=rt&&(rt=tt+1);!(ft=dt[rt])&&++rt=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,it,ct){if(_!==et||b!==_e){var ot=it.push(s(it)+"scale(",null,",",null,")");ct.push({i:ot-4,x:interpolateNumber(_,et)},{i:ot-2,x:interpolateNumber(b,_e)})}else(et!==1||_e!==1)&&it.push(s(it)+"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(it){for(var ct=-1,ot=_e.length,dt;++ct=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,it;if(o.state!==SCHEDULED)return g();for(b in a)if(it=a[b],it.name===o.name){if(it.state===STARTED)return timeout(d);it.state===RUNNING?(it.state=ENDED,it.timer.stop(),it.on.call("interrupt",e,e.__data__,it.index,it.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 it=a-d,ct=s-h,ot=g*g+_*_,dt=it*it+ct*ct,ut=Math.sqrt(ot),tt=Math.sqrt(_e),rt=c*Math.tan((pi-Math.acos((ot+_e-dt)/(2*ut*tt)))/2),at=rt/tt,ft=rt/ut;Math.abs(at-1)>epsilon&&this._append`L${i+at*b},${o+at*et}`,this._append`A${c},${c},0,0,${+(et*it>b*ct)},${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,it;for(a==null&&(c=s(it=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,it=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),it=_e.borderTop?_e.borderTop:et,ct=_e.borderBottom?_e.borderBottom:et,ot=_e.borderTop?a:2*a,dt=it!==ct?1:s-c[d]+1;e.setEdge(g,it,{weight:ot,minlen:dt,nestingEdge:!0}),e.setEdge(ct,_,{weight:ot,minlen:dt,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(ct){return ct!==d&&ct!==h}));var _=barycenter(e,s);forEach(_,function(ct){if(e.children(ct.v).length){var ot=sortSubgraph(e,ct.v,o,a);g[ct.v]=ot,has(ot,"barycenter")&&mergeBarycenters(ct,ot)}});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]),it=e.node(e.predecessors(h)[0]);has(et,"barycenter")||(et.barycenter=0,et.weight=0),et.barycenter=(et.barycenter*et.weight+_e.order+it.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),it=_e?e.node(_e).order:g;(_e||b===_)&&(forEach(c.slice(h,et+1),function(ct){forEach(e.predecessors(ct),function(ot){var dt=e.node(ot),ut=dt.order;(ut_)&&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(ot){return d[ot]});for(var et=(b.length-1)/2,_e=Math.floor(et),it=Math.ceil(et);_e<=it;++_e){var ct=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(ct){d=Math.min(d,ct.x),h=Math.min(h,ct.y)});for(var g=a-e.width/2-d,_=s-e.height/2-h,b=0;b1&&c.sort(function(ct,ot){var dt=ct.x-o.x,ut=ct.y-o.y,tt=Math.sqrt(dt*dt+ut*ut),rt=ot.x-o.x,at=ot.y-o.y,ft=Math.sqrt(rt*rt+at*at);return ttMath.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};`,it=g.intermediate?"ellipse":"rect",ct=it==="rect"?"stroke: black; stroke-width: 1px; rx: 5px; ry: 5px;":"stroke: black; stroke-width: 1px;",ot={label:wrapLines(g.label,20).join(` `),shape:it,style:`${ct} fill:#dff8ff;`,labelStyle:_e+"fill: black;"};g.intermediate&&(ot.width=5,ot.height=5,ot.style=`${ct} fill:white;`),_!==void 0&&(_>=70&&(ot.style=`${ct} fill:#95f795;`),_<70&&_>30&&(ot.style=`${ct} fill:#fdfdbe;`),_<=30&&(ot.style=`${ct} fill:#ffb2b2;`)),console.log("creating node ",g.key),o.setNode(g.key,ot)};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 it=_.selectAll("g.node").filter(function(ot){var dt;return(dt=e==null?void 0:e.nodes.get(ot))==null?void 0:dt.annotation});it.append("circle").attr("class","annotation-circle").attr("cx",function(){const ot=this.parentNode;console.log("elem",ot);const dt=ot.getElementsByTagName("rect")[0];return dt?-dt.width.baseVal.value/2:0}).attr("cy",function(){const ot=this.parentNode;console.log("elem",ot);const dt=ot.getElementsByTagName("rect")[0];return dt?-dt.height.baseVal.value/2:0}).attr("r",_e).style("fill","white").style("stroke","black").style("stroke-width","1px");const ct=ot=>ot&&ot.length<2?11:8;it.append("text").attr("class","annotation-label").style("font-size",function(){var ot;return ct((ot=e==null?void 0:e.nodes.get(this.parentNode.__data__))==null?void 0:ot.annotation)+"px"}).attr("x",function(){const ot=this.parentNode;console.log("elem",ot);const dt=ot.getElementsByTagName("rect")[0];return dt?-dt.width.baseVal.value/2:0}).attr("y",function(){const ot=this.parentNode;console.log("elem",ot);const dt=ot.getElementsByTagName("rect")[0];return dt?-dt.height.baseVal.value/2+1.5:0}).attr("r",_e).text(function(){var ot;return(ot=c.get(this.parentNode.__data__))==null?void 0:ot.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=` @@ -147,20 +147,20 @@ ${"".padEnd(d)} | ${"".padEnd(b.column-1)}${"".padEnd(ct,"^")}`}else g+=` `);return c.length===1?new SourceNode(a,s,i.source,e,o):new SourceNode(null,null,i.source,c.map((d,h)=>new SourceNode(a+h,h===0?s:0,i.source,h===c.length-1?d:[d,` `],o)))}function wrapInSourceNode(e,i,o,a,s){return o?new SourceNode(null,null,o.source,[e,toSourceNode(i,o,s),new SourceNode(o.end.line,o.end.column-1,o.source,a)]):new SourceNode(null,null,null,[e,i,a])}function generateJS$1(e,i){function o(ot){return ot instanceof SourceNode?ot:ot.replace(/^(.+)$/gm," $1")}function a(ot){return"peg$c"+ot}function s(ot){return"peg$r"+ot}function c(ot){return"peg$e"+ot}function d(ot){return"peg$f"+ot}function h(ot){return"peg$parse"+ot}function g(){function ot(rt){return'"'+stringEscape(rt)+'"'}function dt(rt){return"/^["+(rt.inverted?"^":"")+rt.value.map(at=>Array.isArray(at)?regexpClassEscape(at[0])+"-"+regexpClassEscape(at[1]):regexpClassEscape(at)).join("")+"]/"+(rt.ignoreCase?"i":"")}function ut(rt){switch(rt.type){case"rule":return'peg$otherExpectation("'+stringEscape(rt.value)+'")';case"literal":return'peg$literalExpectation("'+stringEscape(rt.value)+'", '+rt.ignoreCase+")";case"class":return"peg$classExpectation(["+rt.value.map(ft=>Array.isArray(ft)?'["'+stringEscape(ft[0])+'", "'+stringEscape(ft[1])+'"]':'"'+stringEscape(ft)+'"').join(", ")+"], "+rt.inverted+", "+rt.ignoreCase+")";case"any":return"peg$anyExpectation()";default:throw new Error("Unknown expectation type ("+JSON.stringify(rt)+")")}}function tt(rt,at){return wrapInSourceNode(` var ${d(at)} = function(${rt.params.join(", ")}) {`,rt.body,rt.location,"};")}return new SourceNode(null,null,i.grammarSource,[e.literals.map((rt,at)=>" var "+a(at)+" = "+ot(rt)+";").concat("",e.classes.map((rt,at)=>" var "+s(at)+" = "+dt(rt)+";")).concat("",e.expectations.map((rt,at)=>" var "+c(at)+" = "+ut(rt)+";")).concat("").join(` -`),e.functions.map(tt)])}function _(ot,dt){const ut=[];return ut.push(""),i.trace&&ut.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+ot+","," location: peg$computeLocation(startPos, startPos)","});",""),i.cache&&(ut.push("var key = peg$currPos * "+e.rules.length+" + "+dt+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),i.trace&&ut.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+ot+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+ot+","," location: peg$computeLocation(startPos, startPos)"," });","}",""),ut.push(" return cached.result;","}","")),ut}function b(ot,dt){const ut=[];return i.cache&&ut.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+dt+" };"),i.trace&&ut.push("","if ("+dt+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+ot+","," result: "+dt+","," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+ot+","," location: peg$computeLocation(startPos, startPos)"," });","}"),ut.push("","return "+dt+";"),ut}function et(ot){const dt=[],ut=new Stack(ot.name,"s","var");function tt(at){let ft=0;const vt=at.length,mt=[];let xt;function Rt(Pt,Ut){const Kt=Ut+3,Yt=at[ft+Kt-2],zt=at[ft+Kt-1];let Vt,wt;ut.checkedIf(ft,()=>{ft+=Kt,Vt=tt(at.slice(ft,ft+Yt)),ft+=Yt},zt>0?()=>{wt=tt(at.slice(ft,ft+zt)),ft+=zt}:null),mt.push("if ("+Pt+") {"),mt.push(...Vt.map(o)),zt>0&&(mt.push("} else {"),mt.push(...wt.map(o))),mt.push("}")}function Ft(Pt){const Kt=at[ft+2-1];let Yt;ut.checkedLoop(ft,()=>{ft+=2,Yt=tt(at.slice(ft,ft+Kt)),ft+=Kt}),mt.push("while ("+Pt+") {"),mt.push(...Yt.map(o)),mt.push("}")}function Mt(){const Ut=at[ft+4-1],Kt=d(at[ft+1])+"("+at.slice(ft+4,ft+4+Ut).map(Yt=>ut.index(Yt)).join(", ")+")";ut.pop(at[ft+2]),mt.push(ut.push(Kt)),ft+=4+Ut}for(;ftut.index(Yt)).join(", ")} ]`,ut.pop(at[ft+1]),mt.push(ut.push(xt)),ft+=Kt;break}case op.IF:Rt(ut.top(),0);break;case op.IF_ERROR:Rt(ut.top()+" === peg$FAILED",0);break;case op.IF_NOT_ERROR:Rt(ut.top()+" !== peg$FAILED",0);break;case op.WHILE_NOT_ERROR:Ft(ut.top()+" !== peg$FAILED");break;case op.MATCH_ANY:Rt("input.length > peg$currPos",0);break;case op.MATCH_STRING:Rt(e.literals[at[ft+1]].length>1?"input.substr(peg$currPos, "+e.literals[at[ft+1]].length+") === "+a(at[ft+1]):"input.charCodeAt(peg$currPos) === "+e.literals[at[ft+1]].charCodeAt(0),1);break;case op.MATCH_STRING_IC:Rt("input.substr(peg$currPos, "+e.literals[at[ft+1]].length+").toLowerCase() === "+a(at[ft+1]),1);break;case op.MATCH_CHAR_CLASS:Rt(s(at[ft+1])+".test(input.charAt(peg$currPos))",1);break;case op.ACCEPT_N:mt.push(ut.push(at[ft+1]>1?"input.substr(peg$currPos, "+at[ft+1]+")":"input.charAt(peg$currPos)")),mt.push(at[ft+1]>1?"peg$currPos += "+at[ft+1]+";":"peg$currPos++;"),ft+=2;break;case op.ACCEPT_STRING:mt.push(ut.push(a(at[ft+1]))),mt.push(e.literals[at[ft+1]].length>1?"peg$currPos += "+e.literals[at[ft+1]].length+";":"peg$currPos++;"),ft+=2;break;case op.FAIL:mt.push(ut.push("peg$FAILED")),mt.push("if (peg$silentFails === 0) { peg$fail("+c(at[ft+1])+"); }"),ft+=2;break;case op.LOAD_SAVED_POS:mt.push("peg$savedPos = "+ut.index(at[ft+1])+";"),ft+=2;break;case op.UPDATE_SAVED_POS:mt.push("peg$savedPos = peg$currPos;"),ft++;break;case op.CALL:Mt();break;case op.RULE:mt.push(ut.push(h(e.rules[at[ft+1]].name)+"()")),ft+=2;break;case op.SILENT_FAILS_ON:mt.push("peg$silentFails++;"),ft++;break;case op.SILENT_FAILS_OFF:mt.push("peg$silentFails--;"),ft++;break;default:throw new Error("Invalid opcode: "+at[ft]+".")}return mt}const rt=tt(ot.bytecode);return dt.push(wrapInSourceNode(" function ",h(ot.name),ot.nameLocation,`() { +`),e.functions.map(tt)])}function _(ot,dt){const ut=[];return ut.push(""),i.trace&&ut.push("peg$tracer.trace({",' type: "rule.enter",'," rule: "+ot+","," location: peg$computeLocation(startPos, startPos)","});",""),i.cache&&(ut.push("var key = peg$currPos * "+e.rules.length+" + "+dt+";","var cached = peg$resultsCache[key];","","if (cached) {"," peg$currPos = cached.nextPos;",""),i.trace&&ut.push("if (cached.result !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+ot+","," result: cached.result,"," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+ot+","," location: peg$computeLocation(startPos, startPos)"," });","}",""),ut.push(" return cached.result;","}","")),ut}function b(ot,dt){const ut=[];return i.cache&&ut.push("","peg$resultsCache[key] = { nextPos: peg$currPos, result: "+dt+" };"),i.trace&&ut.push("","if ("+dt+" !== peg$FAILED) {"," peg$tracer.trace({",' type: "rule.match",'," rule: "+ot+","," result: "+dt+","," location: peg$computeLocation(startPos, peg$currPos)"," });","} else {"," peg$tracer.trace({",' type: "rule.fail",'," rule: "+ot+","," location: peg$computeLocation(startPos, startPos)"," });","}"),ut.push("","return "+dt+";"),ut}function et(ot){const dt=[],ut=new Stack(ot.name,"s","var");function tt(at){let ft=0;const vt=at.length,mt=[];let xt;function kt(Pt,Ht){const Kt=Ht+3,Yt=at[ft+Kt-2],zt=at[ft+Kt-1];let Vt,wt;ut.checkedIf(ft,()=>{ft+=Kt,Vt=tt(at.slice(ft,ft+Yt)),ft+=Yt},zt>0?()=>{wt=tt(at.slice(ft,ft+zt)),ft+=zt}:null),mt.push("if ("+Pt+") {"),mt.push(...Vt.map(o)),zt>0&&(mt.push("} else {"),mt.push(...wt.map(o))),mt.push("}")}function Ft(Pt){const Kt=at[ft+2-1];let Yt;ut.checkedLoop(ft,()=>{ft+=2,Yt=tt(at.slice(ft,ft+Kt)),ft+=Kt}),mt.push("while ("+Pt+") {"),mt.push(...Yt.map(o)),mt.push("}")}function Mt(){const Ht=at[ft+4-1],Kt=d(at[ft+1])+"("+at.slice(ft+4,ft+4+Ht).map(Yt=>ut.index(Yt)).join(", ")+")";ut.pop(at[ft+2]),mt.push(ut.push(Kt)),ft+=4+Ht}for(;ftut.index(Yt)).join(", ")} ]`,ut.pop(at[ft+1]),mt.push(ut.push(xt)),ft+=Kt;break}case op.IF:kt(ut.top(),0);break;case op.IF_ERROR:kt(ut.top()+" === peg$FAILED",0);break;case op.IF_NOT_ERROR:kt(ut.top()+" !== peg$FAILED",0);break;case op.WHILE_NOT_ERROR:Ft(ut.top()+" !== peg$FAILED");break;case op.MATCH_ANY:kt("input.length > peg$currPos",0);break;case op.MATCH_STRING:kt(e.literals[at[ft+1]].length>1?"input.substr(peg$currPos, "+e.literals[at[ft+1]].length+") === "+a(at[ft+1]):"input.charCodeAt(peg$currPos) === "+e.literals[at[ft+1]].charCodeAt(0),1);break;case op.MATCH_STRING_IC:kt("input.substr(peg$currPos, "+e.literals[at[ft+1]].length+").toLowerCase() === "+a(at[ft+1]),1);break;case op.MATCH_CHAR_CLASS:kt(s(at[ft+1])+".test(input.charAt(peg$currPos))",1);break;case op.ACCEPT_N:mt.push(ut.push(at[ft+1]>1?"input.substr(peg$currPos, "+at[ft+1]+")":"input.charAt(peg$currPos)")),mt.push(at[ft+1]>1?"peg$currPos += "+at[ft+1]+";":"peg$currPos++;"),ft+=2;break;case op.ACCEPT_STRING:mt.push(ut.push(a(at[ft+1]))),mt.push(e.literals[at[ft+1]].length>1?"peg$currPos += "+e.literals[at[ft+1]].length+";":"peg$currPos++;"),ft+=2;break;case op.FAIL:mt.push(ut.push("peg$FAILED")),mt.push("if (peg$silentFails === 0) { peg$fail("+c(at[ft+1])+"); }"),ft+=2;break;case op.LOAD_SAVED_POS:mt.push("peg$savedPos = "+ut.index(at[ft+1])+";"),ft+=2;break;case op.UPDATE_SAVED_POS:mt.push("peg$savedPos = peg$currPos;"),ft++;break;case op.CALL:Mt();break;case op.RULE:mt.push(ut.push(h(e.rules[at[ft+1]].name)+"()")),ft+=2;break;case op.SILENT_FAILS_ON:mt.push("peg$silentFails++;"),ft++;break;case op.SILENT_FAILS_OFF:mt.push("peg$silentFails--;"),ft++;break;default:throw new Error("Invalid opcode: "+at[ft]+".")}return mt}const rt=tt(ot.bytecode);return dt.push(wrapInSourceNode(" function ",h(ot.name),ot.nameLocation,`() { `,ot.name)),i.trace&&dt.push(" var startPos = peg$currPos;"),dt.push(o(ut.defines())),dt.push(..._('"'+stringEscape(ot.name)+'"',asts$4.indexOfRule(e,ot.name)).map(o)),dt.push(...rt.map(o)),dt.push(...b('"'+stringEscape(ot.name)+'"',ut.result()).map(o)),dt.push("}"),dt}function _e(ot){return ot.codeLocation?toSourceNode(ot.code,ot.codeLocation,"$"+ot.type):ot.code}function it(){const ot=[];e.topLevelInitializer&&(ot.push(_e(e.topLevelInitializer)),ot.push("")),ot.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 loc = this.location.source + ":" + s.line + ":" + s.column;'," if (src) {"," var e = this.location.end;",` var filler = peg$padEnd("", 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"',' + 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&&ot.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 dt="{ "+i.allowedStartRules.map(tt=>tt+": "+h(tt)).join(", ")+" }",ut=h(i.allowedStartRules[0]);return ot.push("function peg$parse(input, options) {"," options = options !== undefined ? options : {};",""," var peg$FAILED = {};"," var peg$source = options.grammarSource;",""," var peg$startRuleFunctions = "+dt+";"," var peg$startRuleFunction = "+ut+";","",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&&ot.push(" var peg$resultsCache = {};",""),i.trace&&ot.push(' var peg$tracer = "tracer" in options ? options.tracer : new peg$DefaultTracer();',""),ot.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) {"," var startPosDetails = peg$computePosDetails(startPos);"," var endPosDetails = peg$computePosDetails(endPos);",""," return {"," source: peg$source,"," start: {"," offset: startPos,"," line: startPosDetails.line,"," column: startPosDetails.column"," },"," end: {"," offset: endPos,"," line: endPosDetails.line,"," column: endPosDetails.column"," }"," };"," }",""," 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(tt=>{ot.push(...et(tt).map(o)),ot.push("")}),e.initializer&&(ot.push(_e(e.initializer)),ot.push("")),ot.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,ot.map(tt=>tt instanceof SourceNode?tt:tt+` `))}function ct(ot){function dt(){return[`// Generated by Peggy ${VERSION$1}.`,"//","// https://peggyjs.org/"]}function ut(){return i.trace?["{"," SyntaxError: peg$SyntaxError,"," DefaultTracer: peg$DefaultTracer,"," parse: peg$parse","}"].join(` `):["{"," SyntaxError: peg$SyntaxError,"," parse: peg$parse","}"].join(` -`)}const rt={bare(){return[...dt(),"(function() {",' "use strict";',"",ot,"",o("return "+ut()+";"),"})()"]},commonjs(){const at=Object.keys(i.dependencies),ft=dt();return ft.push("",'"use strict";',""),at.length>0&&(at.forEach(vt=>{ft.push("var "+vt+' = require("'+stringEscape(i.dependencies[vt])+'");')}),ft.push("")),ft.push(ot,"","module.exports = "+ut()+";"),ft},es(){const at=Object.keys(i.dependencies),ft=dt();return ft.push(""),at.length>0&&(at.forEach(vt=>{ft.push("import "+vt+' from "'+stringEscape(i.dependencies[vt])+'";')}),ft.push("")),ft.push(ot,"","export {"," peg$SyntaxError as SyntaxError,",i.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),ft},amd(){const at=Object.keys(i.dependencies),vt="["+at.map(xt=>i.dependencies[xt]).map(xt=>'"'+stringEscape(xt)+'"').join(", ")+"]",mt=at.join(", ");return[...dt(),"define("+vt+", function("+mt+") {",' "use strict";',"",ot,"",o("return "+ut()+";"),"});"]},globals(){return[...dt(),"(function(root) {",' "use strict";',"",ot,"",o("root."+i.exportVar+" = "+ut()+";"),"})(this);"]},umd(){const at=Object.keys(i.dependencies),ft=at.map(Ft=>i.dependencies[Ft]),vt="["+ft.map(Ft=>'"'+stringEscape(Ft)+'"').join(", ")+"]",mt=ft.map(Ft=>'require("'+stringEscape(Ft)+'")').join(", "),xt=at.join(", "),Rt=dt();return Rt.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+vt+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+mt+");"),i.exportVar!==null&&Rt.push(" } else {"," root."+i.exportVar+" = factory();"),Rt.push(" }","})(this, function("+xt+") {",' "use strict";',"",ot,"",o("return "+ut()+";"),"});"),Rt}}[i.format]();return new SourceNode(null,null,i.grammarSource,rt.map(at=>at instanceof SourceNode?at:at+` +`)}const rt={bare(){return[...dt(),"(function() {",' "use strict";',"",ot,"",o("return "+ut()+";"),"})()"]},commonjs(){const at=Object.keys(i.dependencies),ft=dt();return ft.push("",'"use strict";',""),at.length>0&&(at.forEach(vt=>{ft.push("var "+vt+' = require("'+stringEscape(i.dependencies[vt])+'");')}),ft.push("")),ft.push(ot,"","module.exports = "+ut()+";"),ft},es(){const at=Object.keys(i.dependencies),ft=dt();return ft.push(""),at.length>0&&(at.forEach(vt=>{ft.push("import "+vt+' from "'+stringEscape(i.dependencies[vt])+'";')}),ft.push("")),ft.push(ot,"","export {"," peg$SyntaxError as SyntaxError,",i.trace?" peg$DefaultTracer as DefaultTracer,":""," peg$parse as parse","};"),ft},amd(){const at=Object.keys(i.dependencies),vt="["+at.map(xt=>i.dependencies[xt]).map(xt=>'"'+stringEscape(xt)+'"').join(", ")+"]",mt=at.join(", ");return[...dt(),"define("+vt+", function("+mt+") {",' "use strict";',"",ot,"",o("return "+ut()+";"),"});"]},globals(){return[...dt(),"(function(root) {",' "use strict";',"",ot,"",o("root."+i.exportVar+" = "+ut()+";"),"})(this);"]},umd(){const at=Object.keys(i.dependencies),ft=at.map(Ft=>i.dependencies[Ft]),vt="["+ft.map(Ft=>'"'+stringEscape(Ft)+'"').join(", ")+"]",mt=ft.map(Ft=>'require("'+stringEscape(Ft)+'")').join(", "),xt=at.join(", "),kt=dt();return kt.push("(function(root, factory) {",' if (typeof define === "function" && define.amd) {'," define("+vt+", factory);",' } else if (typeof module === "object" && module.exports) {'," module.exports = factory("+mt+");"),i.exportVar!==null&&kt.push(" } else {"," root."+i.exportVar+" = factory();"),kt.push(" }","})(this, function("+xt+") {",' "use strict";',"",ot,"",o("return "+ut()+";"),"});"),kt}}[i.format]();return new SourceNode(null,null,i.grammarSource,rt.map(at=>at instanceof SourceNode?at:at+` `))}e.code=ct(it())}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,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)))},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){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)}})(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;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}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);for(const e of options.allowedStartRules)if(allRules.indexOf(e)===-1)throw new Error(`Unknown start rule "${e}"`);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;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 `+c+` `+h+` | `+s.line+" | "+g+` `+h+" | "+peg$padEnd("",s.column-1," ")+peg$padEnd("",b,"^")}else i+=` - at `+c}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){for(et=1,_e=1;et0?{type:"choice",alternatives:[$].concat(nt),location:Wt()}:$},ku=function($,nt){return nt!==null?{type:"action",expression:$,code:nt[0],codeLocation:nt[1],location:Wt()}:$},Tu=function($,nt){return nt.length>0||$.type==="labeled"&&$.pick?{type:"sequence",elements:[$].concat(nt),location:Wt()}:$},Pu=function($,nt,lt){return lt.type.startsWith("semantic_")&&ur('"@" cannot be used on a semantic predicate',$),{type:"labeled",label:nt!==null?nt[0]:null,labelLocation:nt!==null?nt[1]:$,pick:!0,expression:lt,location:Wt()}},Iu=function($,nt){return{type:"labeled",label:$[0],labelLocation:$[1],expression:nt,location:Wt()}},Lu=function(){return Wt()},Nu=function($){return Go.indexOf($[0])>=0&&ur(`Label can't be a reserved word "${$[0]}"`,$[1]),$},Ou=function($,nt){return{type:OPS_TO_PREFIXED_TYPES[$],expression:nt,location:Wt()}},Mu=function($,nt){return{type:OPS_TO_SUFFIXED_TYPES[nt],expression:$,location:Wt()}},ju=function($){return $.type==="labeled"||$.type==="sequence"?{type:"group",expression:$,location:Wt()}:$},Vu=function($){return{type:"rule_ref",name:$[0],location:Wt()}},Hu=function($,nt){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[$],code:nt[0],codeLocation:nt[1],location:Wt()}},Uu=function($,nt){return[$+nt.join(""),Wt()]},zu=function($,nt){return{type:"literal",value:$,ignoreCase:nt!==null,location:Wt()}},Gu=function($){return $.join("")},Wu=function($){return $.join("")},Ku=function($,nt,lt){return{type:"class",parts:nt.filter(st=>st!==""),inverted:$!==null,ignoreCase:lt!==null,location:Wt()}},Yu=function($,nt){return $.charCodeAt(0)>nt.charCodeAt(0)&&ur("Invalid character range: "+oo()+"."),[$,nt]},Xu=function(){return""},Zu=function(){return"\0"},Qu=function(){return"\b"},Ju=function(){return"\f"},qu=function(){return` -`},_i=function(){return"\r"},eo=function(){return" "},to=function(){return"\v"},no=function($){return String.fromCharCode(parseInt($,16))},ro=function($){return String.fromCharCode(parseInt($,16))},uo=function(){return{type:"any",location:Wt()}},io=function($){return[$,Wt()]},j=0,Lt=0,Wn=[{line:1,column:1}],sn=0,rr=[],pt=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 oo(){return e.substring(Lt,j)}function Wt(){return Yn(Lt,j)}function ur($,nt){throw nt=nt!==void 0?nt:Yn(Lt,j),lo($,nt)}function Bt($,nt){return{type:"literal",text:$,ignoreCase:nt}}function Jt($,nt,lt){return{type:"class",parts:$,inverted:nt,ignoreCase:lt}}function ao(){return{type:"any"}}function so(){return{type:"end"}}function pn($){return{type:"other",description:$}}function Ar($){var nt=Wn[$],lt;if(nt)return nt;for(lt=$-1;!Wn[lt];)lt--;for(nt=Wn[lt],nt={line:nt.line,column:nt.column};lt<$;)e.charCodeAt(lt)===10?(nt.line++,nt.column=1):nt.column++,lt++;return Wn[$]=nt,nt}function Yn($,nt){var lt=Ar($),st=Ar(nt);return{source:a,start:{offset:$,line:lt.line,column:lt.column},end:{offset:nt,line:st.line,column:st.column}}}function At($){jsn&&(sn=j,rr=[]),rr.push($))}function lo($,nt){return new peg$SyntaxError($,null,null,nt)}function co($,nt,lt){return new peg$SyntaxError(peg$SyntaxError.buildMessage($,nt),$,nt,lt)}function yr(){var $,nt,lt,st,ht,yt;if($=j,Ht(),nt=j,lt=fo(),lt!==o?(st=Ht(),nt=lt):(j=nt,nt=o),nt===o&&(nt=null),lt=j,st=po(),st!==o?(ht=Ht(),lt=st):(j=lt,lt=o),lt===o&&(lt=null),st=[],ht=j,yt=Cr(),yt!==o?(Ht(),ht=yt):(j=ht,ht=o),ht!==o)for(;ht!==o;)st.push(ht),ht=j,yt=Cr(),yt!==o?(Ht(),ht=yt):(j=ht,ht=o);else st=o;return st!==o?(Lt=$,$=Su(nt,lt,st)):(j=$,$=o),$}function fo(){var $,nt,lt,st,ht;return $=j,e.charCodeAt(j)===123?(nt=d,j++):(nt=o,pt===0&&At(It)),nt!==o?(lt=Jn(),lt!==o?(e.charCodeAt(j)===125?(st=h,j++):(st=o,pt===0&&At(jt)),st!==o?(ht=pr(),ht!==o?(Lt=$,$=Du(lt)):(j=$,$=o)):(j=$,$=o)):(j=$,$=o)):(j=$,$=o),$}function po(){var $,nt,lt;return $=j,nt=Jn(),nt!==o?(lt=pr(),lt!==o?(Lt=$,$=Bu(nt)):(j=$,$=o)):(j=$,$=o),$}function Cr(){var $,nt,lt,st,ht,yt;return $=j,nt=sr(),nt!==o?(Ht(),lt=j,st=lr(),st!==o?(Ht(),lt=st):(j=lt,lt=o),lt===o&&(lt=null),e.charCodeAt(j)===61?(st=g,j++):(st=o,pt===0&&At(qt)),st!==o?(Ht(),ht=xr(),ht!==o?(yt=pr(),yt!==o?(Lt=$,$=bu(nt,lt,ht)):(j=$,$=o)):(j=$,$=o)):(j=$,$=o)):(j=$,$=o),$}function xr(){var $,nt,lt,st,ht,yt;if($=j,nt=ir(),nt!==o){for(lt=[],st=j,Ht(),e.charCodeAt(j)===47?(ht=_,j++):(ht=o,pt===0&&At(en)),ht!==o?(Ht(),yt=ir(),yt!==o?st=yt:(j=st,st=o)):(j=st,st=o);st!==o;)lt.push(st),st=j,Ht(),e.charCodeAt(j)===47?(ht=_,j++):(ht=o,pt===0&&At(en)),ht!==o?(Ht(),yt=ir(),yt!==o?st=yt:(j=st,st=o)):(j=st,st=o);Lt=$,$=Ru(nt,lt)}else j=$,$=o;return $}function ir(){var $,nt,lt,st;return $=j,nt=ho(),nt!==o?(lt=j,Ht(),st=Jn(),st!==o?lt=st:(j=lt,lt=o),lt===o&&(lt=null),Lt=$,$=ku(nt,lt)):(j=$,$=o),$}function ho(){var $,nt,lt,st,ht;if($=j,nt=or(),nt!==o){for(lt=[],st=j,Ht(),ht=or(),ht!==o?st=ht:(j=st,st=o);st!==o;)lt.push(st),st=j,Ht(),ht=or(),ht!==o?st=ht:(j=st,st=o);Lt=$,$=Tu(nt,lt)}else j=$,$=o;return $}function or(){var $,nt,lt,st;return $=j,nt=go(),nt!==o?(lt=wr(),lt===o&&(lt=null),st=ar(),st!==o?(Lt=$,$=Pu(nt,lt,st)):(j=$,$=o)):(j=$,$=o),$===o&&($=j,nt=wr(),nt!==o?(lt=Ht(),st=ar(),st!==o?(Lt=$,$=Iu(nt,st)):(j=$,$=o)):(j=$,$=o),$===o&&($=ar())),$}function go(){var $,nt;return $=j,e.charCodeAt(j)===64?(nt=b,j++):(nt=o,pt===0&&At(En)),nt!==o&&(Lt=$,nt=Lu()),$=nt,$}function wr(){var $,nt,lt;return $=j,nt=sr(),nt!==o?(Ht(),e.charCodeAt(j)===58?(lt=et,j++):(lt=o,pt===0&&At(wn)),lt!==o?(Lt=$,$=Nu(nt)):(j=$,$=o)):(j=$,$=o),$}function ar(){var $,nt,lt;return $=j,nt=mo(),nt!==o?(Ht(),lt=_r(),lt!==o?(Lt=$,$=Ou(nt,lt)):(j=$,$=o)):(j=$,$=o),$===o&&($=_r()),$}function mo(){var $;return e.charCodeAt(j)===36?($=_e,j++):($=o,pt===0&&At(An)),$===o&&(e.charCodeAt(j)===38?($=it,j++):($=o,pt===0&&At(cn)),$===o&&(e.charCodeAt(j)===33?($=ct,j++):($=o,pt===0&&At(_n)))),$}function _r(){var $,nt,lt;return $=j,nt=$r(),nt!==o?(Ht(),lt=vo(),lt!==o?(Lt=$,$=Mu(nt,lt)):(j=$,$=o)):(j=$,$=o),$===o&&($=$r()),$}function vo(){var $;return e.charCodeAt(j)===63?($=ot,j++):($=o,pt===0&&At(Xt)),$===o&&(e.charCodeAt(j)===42?($=dt,j++):($=o,pt===0&&At(rn)),$===o&&(e.charCodeAt(j)===43?($=ut,j++):($=o,pt===0&&At(fn)))),$}function $r(){var $,nt,lt,st;return $=_o(),$===o&&($=$o(),$===o&&($=bo(),$===o&&($=Eo(),$===o&&($=Ao(),$===o&&($=j,e.charCodeAt(j)===40?(nt=tt,j++):(nt=o,pt===0&&At($n)),nt!==o?(Ht(),lt=xr(),lt!==o?(Ht(),e.charCodeAt(j)===41?(st=rt,j++):(st=o,pt===0&&At(Pn)),st!==o?(Lt=$,$=ju(lt)):(j=$,$=o)):(j=$,$=o)):(j=$,$=o)))))),$}function Eo(){var $,nt,lt,st,ht,yt,nn,Dn;return $=j,nt=sr(),nt!==o?(lt=j,pt++,st=j,ht=Ht(),yt=j,nn=lr(),nn!==o?(Dn=Ht(),nn=[nn,Dn],yt=nn):(j=yt,yt=o),yt===o&&(yt=null),e.charCodeAt(j)===61?(nn=g,j++):(nn=o,pt===0&&At(qt)),nn!==o?(ht=[ht,yt,nn],st=ht):(j=st,st=o),pt--,st===o?lt=void 0:(j=lt,lt=o),lt!==o?(Lt=$,$=Vu(nt)):(j=$,$=o)):(j=$,$=o),$}function Ao(){var $,nt,lt;return $=j,nt=yo(),nt!==o?(Ht(),lt=Jn(),lt!==o?(Lt=$,$=Hu(nt,lt)):(j=$,$=o)):(j=$,$=o),$}function yo(){var $;return e.charCodeAt(j)===38?($=it,j++):($=o,pt===0&&At(cn)),$===o&&(e.charCodeAt(j)===33?($=ct,j++):($=o,pt===0&&At(_n))),$}function tn(){var $;return e.length>j?($=e.charAt(j),j++):($=o,pt===0&&At(Vn)),$}function Xn(){var $;return pt++,e.charCodeAt(j)===9?($=at,j++):($=o,pt===0&&At(an)),$===o&&(e.charCodeAt(j)===11?($=ft,j++):($=o,pt===0&&At(In)),$===o&&(e.charCodeAt(j)===12?($=vt,j++):($=o,pt===0&&At(Hn)),$===o&&(e.charCodeAt(j)===32?($=mt,j++):($=o,pt===0&&At(nr)),$===o&&(e.charCodeAt(j)===160?($=xt,j++):($=o,pt===0&&At(Nr)),$===o&&(e.charCodeAt(j)===65279?($=Rt,j++):($=o,pt===0&&At(Or)),$===o&&($=Ho())))))),pt--,$===o&&pt===0&&At(tr),$}function hn(){var $;return Mn.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&At(Mr)),$}function Zn(){var $;return pt++,e.charCodeAt(j)===10?($=Ft,j++):($=o,pt===0&&At(Vr)),$===o&&(e.substr(j,2)===Mt?($=Mt,j+=2):($=o,pt===0&&At(Hr)),$===o&&(e.charCodeAt(j)===13?($=Pt,j++):($=o,pt===0&&At(Ur)),$===o&&(e.charCodeAt(j)===8232?($=Ut,j++):($=o,pt===0&&At(zr)),$===o&&(e.charCodeAt(j)===8233?($=Kt,j++):($=o,pt===0&&At(Gr)))))),pt--,$===o&&pt===0&&At(jr),$}function Fr(){var $;return pt++,$=Co(),$===o&&($=Dr()),pt--,$===o&&pt===0&&At(Wr),$}function Co(){var $,nt,lt,st,ht,yt;if($=j,e.substr(j,2)===Yt?(nt=Yt,j+=2):(nt=o,pt===0&&At(hr)),nt!==o){for(lt=[],st=j,ht=j,pt++,e.substr(j,2)===zt?(yt=zt,j+=2):(yt=o,pt===0&&At(Fn)),pt--,yt===o?ht=void 0:(j=ht,ht=o),ht!==o?(yt=tn(),yt!==o?(ht=[ht,yt],st=ht):(j=st,st=o)):(j=st,st=o);st!==o;)lt.push(st),st=j,ht=j,pt++,e.substr(j,2)===zt?(yt=zt,j+=2):(yt=o,pt===0&&At(Fn)),pt--,yt===o?ht=void 0:(j=ht,ht=o),ht!==o?(yt=tn(),yt!==o?(ht=[ht,yt],st=ht):(j=st,st=o)):(j=st,st=o);e.substr(j,2)===zt?(st=zt,j+=2):(st=o,pt===0&&At(Fn)),st!==o?(nt=[nt,lt,st],$=nt):(j=$,$=o)}else j=$,$=o;return $}function Sr(){var $,nt,lt,st,ht,yt;if($=j,e.substr(j,2)===Yt?(nt=Yt,j+=2):(nt=o,pt===0&&At(hr)),nt!==o){for(lt=[],st=j,ht=j,pt++,e.substr(j,2)===zt?(yt=zt,j+=2):(yt=o,pt===0&&At(Fn)),yt===o&&(yt=hn()),pt--,yt===o?ht=void 0:(j=ht,ht=o),ht!==o?(yt=tn(),yt!==o?(ht=[ht,yt],st=ht):(j=st,st=o)):(j=st,st=o);st!==o;)lt.push(st),st=j,ht=j,pt++,e.substr(j,2)===zt?(yt=zt,j+=2):(yt=o,pt===0&&At(Fn)),yt===o&&(yt=hn()),pt--,yt===o?ht=void 0:(j=ht,ht=o),ht!==o?(yt=tn(),yt!==o?(ht=[ht,yt],st=ht):(j=st,st=o)):(j=st,st=o);e.substr(j,2)===zt?(st=zt,j+=2):(st=o,pt===0&&At(Fn)),st!==o?(nt=[nt,lt,st],$=nt):(j=$,$=o)}else j=$,$=o;return $}function Dr(){var $,nt,lt,st,ht,yt;if($=j,e.substr(j,2)===Vt?(nt=Vt,j+=2):(nt=o,pt===0&&At(Kr)),nt!==o){for(lt=[],st=j,ht=j,pt++,yt=hn(),pt--,yt===o?ht=void 0:(j=ht,ht=o),ht!==o?(yt=tn(),yt!==o?(ht=[ht,yt],st=ht):(j=st,st=o)):(j=st,st=o);st!==o;)lt.push(st),st=j,ht=j,pt++,yt=hn(),pt--,yt===o?ht=void 0:(j=ht,ht=o),ht!==o?(yt=tn(),yt!==o?(ht=[ht,yt],st=ht):(j=st,st=o)):(j=st,st=o);nt=[nt,lt],$=nt}else j=$,$=o;return $}function sr(){var $,nt,lt,st;if(pt++,$=j,nt=Br(),nt!==o){for(lt=[],st=br();st!==o;)lt.push(st),st=br();Lt=$,$=Uu(nt,lt)}else j=$,$=o;return pt--,$===o&&(nt=o,pt===0&&At(Yr)),$}function Br(){var $,nt,lt;return $=xo(),$===o&&(e.charCodeAt(j)===36?($=_e,j++):($=o,pt===0&&At(An)),$===o&&(e.charCodeAt(j)===95?($=wt,j++):($=o,pt===0&&At(Xr)),$===o&&($=j,e.charCodeAt(j)===92?(nt=St,j++):(nt=o,pt===0&&At(dn)),nt!==o?(lt=Ir(),lt!==o?$=lt:(j=$,$=o)):(j=$,$=o)))),$}function br(){var $;return $=Br(),$===o&&($=wo(),$===o&&($=Mo(),$===o&&($=Vo(),$===o&&(e.charCodeAt(j)===8204?($=Tt,j++):($=o,pt===0&&At(Zr)),$===o&&(e.charCodeAt(j)===8205?($=Ot,j++):($=o,pt===0&&At(Qr))))))),$}function xo(){var $;return $=Lo(),$===o&&($=ko(),$===o&&($=Io(),$===o&&($=To(),$===o&&($=Po(),$===o&&($=jo()))))),$}function wo(){var $;return $=Oo(),$===o&&($=No()),$}function _o(){var $,nt,lt;return pt++,$=j,nt=lr(),nt!==o?(e.charCodeAt(j)===105?(lt=Gt,j++):(lt=o,pt===0&&At(gr)),lt===o&&(lt=null),Lt=$,$=zu(nt,lt)):(j=$,$=o),pt--,$===o&&(nt=o,pt===0&&At(Jr)),$}function lr(){var $,nt,lt,st;if(pt++,$=j,e.charCodeAt(j)===34?(nt=un,j++):(nt=o,pt===0&&At(Un)),nt!==o){for(lt=[],st=Rr();st!==o;)lt.push(st),st=Rr();e.charCodeAt(j)===34?(st=un,j++):(st=o,pt===0&&At(Un)),st!==o?(Lt=$,$=Gu(lt)):(j=$,$=o)}else j=$,$=o;if($===o)if($=j,e.charCodeAt(j)===39?(nt=Qt,j++):(nt=o,pt===0&&At(zn)),nt!==o){for(lt=[],st=kr();st!==o;)lt.push(st),st=kr();e.charCodeAt(j)===39?(st=Qt,j++):(st=o,pt===0&&At(zn)),st!==o?(Lt=$,$=Wu(lt)):(j=$,$=o)}else j=$,$=o;return pt--,$===o&&(nt=o,pt===0&&At(qr)),$}function Rr(){var $,nt,lt,st;return $=j,nt=j,lt=j,pt++,e.charCodeAt(j)===34?(st=un,j++):(st=o,pt===0&&At(Un)),st===o&&(e.charCodeAt(j)===92?(st=St,j++):(st=o,pt===0&&At(dn)),st===o&&(st=hn())),pt--,st===o?lt=void 0:(j=lt,lt=o),lt!==o?(st=tn(),st!==o?(lt=[lt,st],nt=lt):(j=nt,nt=o)):(j=nt,nt=o),nt!==o?$=e.substring($,j):$=nt,$===o&&($=j,e.charCodeAt(j)===92?(nt=St,j++):(nt=o,pt===0&&At(dn)),nt!==o?(lt=fr(),lt!==o?$=lt:(j=$,$=o)):(j=$,$=o),$===o&&($=cr())),$}function kr(){var $,nt,lt,st;return $=j,nt=j,lt=j,pt++,e.charCodeAt(j)===39?(st=Qt,j++):(st=o,pt===0&&At(zn)),st===o&&(e.charCodeAt(j)===92?(st=St,j++):(st=o,pt===0&&At(dn)),st===o&&(st=hn())),pt--,st===o?lt=void 0:(j=lt,lt=o),lt!==o?(st=tn(),st!==o?(lt=[lt,st],nt=lt):(j=nt,nt=o)):(j=nt,nt=o),nt!==o?$=e.substring($,j):$=nt,$===o&&($=j,e.charCodeAt(j)===92?(nt=St,j++):(nt=o,pt===0&&At(dn)),nt!==o?(lt=fr(),lt!==o?$=lt:(j=$,$=o)):(j=$,$=o),$===o&&($=cr())),$}function $o(){var $,nt,lt,st,ht,yt;if(pt++,$=j,e.charCodeAt(j)===91?(nt=gn,j++):(nt=o,pt===0&&At(tu)),nt!==o){for(e.charCodeAt(j)===94?(lt=on,j++):(lt=o,pt===0&&At(nu)),lt===o&&(lt=null),st=[],ht=Tr(),ht===o&&(ht=Qn());ht!==o;)st.push(ht),ht=Tr(),ht===o&&(ht=Qn());e.charCodeAt(j)===93?(ht=ln,j++):(ht=o,pt===0&&At(mr)),ht!==o?(e.charCodeAt(j)===105?(yt=Gt,j++):(yt=o,pt===0&&At(gr)),yt===o&&(yt=null),Lt=$,$=Ku(lt,st,yt)):(j=$,$=o)}else j=$,$=o;return pt--,$===o&&(nt=o,pt===0&&At(eu)),$}function Tr(){var $,nt,lt,st;return $=j,nt=Qn(),nt!==o?(e.charCodeAt(j)===45?(lt=mn,j++):(lt=o,pt===0&&At(ru)),lt!==o?(st=Qn(),st!==o?(Lt=$,$=Yu(nt,st)):(j=$,$=o)):(j=$,$=o)):(j=$,$=o),$}function Qn(){var $,nt,lt,st;return $=j,nt=j,lt=j,pt++,e.charCodeAt(j)===93?(st=ln,j++):(st=o,pt===0&&At(mr)),st===o&&(e.charCodeAt(j)===92?(st=St,j++):(st=o,pt===0&&At(dn)),st===o&&(st=hn())),pt--,st===o?lt=void 0:(j=lt,lt=o),lt!==o?(st=tn(),st!==o?(lt=[lt,st],nt=lt):(j=nt,nt=o)):(j=nt,nt=o),nt!==o?$=e.substring($,j):$=nt,$===o&&($=j,e.charCodeAt(j)===92?(nt=St,j++):(nt=o,pt===0&&At(dn)),nt!==o?(lt=fr(),lt!==o?$=lt:(j=$,$=o)):(j=$,$=o),$===o&&($=cr())),$}function cr(){var $,nt,lt;return $=j,e.charCodeAt(j)===92?(nt=St,j++):(nt=o,pt===0&&At(dn)),nt!==o?(lt=Zn(),lt!==o?(Lt=$,$=Xu()):(j=$,$=o)):(j=$,$=o),$}function fr(){var $,nt,lt,st;return $=Fo(),$===o&&($=j,e.charCodeAt(j)===48?(nt=Ln,j++):(nt=o,pt===0&&At(uu)),nt!==o?(lt=j,pt++,st=Lr(),pt--,st===o?lt=void 0:(j=lt,lt=o),lt!==o?(Lt=$,$=Zu()):(j=$,$=o)):(j=$,$=o),$===o&&($=Bo(),$===o&&($=Ir()))),$}function Fo(){var $;return $=Pr(),$===o&&($=So()),$}function Pr(){var $,nt;return e.charCodeAt(j)===39?($=Qt,j++):($=o,pt===0&&At(zn)),$===o&&(e.charCodeAt(j)===34?($=un,j++):($=o,pt===0&&At(Un)),$===o&&(e.charCodeAt(j)===92?($=St,j++):($=o,pt===0&&At(dn)),$===o&&($=j,e.charCodeAt(j)===98?(nt=Bn,j++):(nt=o,pt===0&&At(iu)),nt!==o&&(Lt=$,nt=Qu()),$=nt,$===o&&($=j,e.charCodeAt(j)===102?(nt=bn,j++):(nt=o,pt===0&&At(ou)),nt!==o&&(Lt=$,nt=Ju()),$=nt,$===o&&($=j,e.charCodeAt(j)===110?(nt=Rn,j++):(nt=o,pt===0&&At(au)),nt!==o&&(Lt=$,nt=qu()),$=nt,$===o&&($=j,e.charCodeAt(j)===114?(nt=yn,j++):(nt=o,pt===0&&At(su)),nt!==o&&(Lt=$,nt=_i()),$=nt,$===o&&($=j,e.charCodeAt(j)===116?(nt=Nn,j++):(nt=o,pt===0&&At(lu)),nt!==o&&(Lt=$,nt=eo()),$=nt,$===o&&($=j,e.charCodeAt(j)===118?(nt=qn,j++):(nt=o,pt===0&&At(cu)),nt!==o&&(Lt=$,nt=to()),$=nt)))))))),$}function So(){var $,nt,lt,st;return $=j,nt=j,lt=j,pt++,st=Do(),st===o&&(st=hn()),pt--,st===o?lt=void 0:(j=lt,lt=o),lt!==o?(st=tn(),st!==o?(lt=[lt,st],nt=lt):(j=nt,nt=o)):(j=nt,nt=o),nt!==o?$=e.substring($,j):$=nt,$}function Do(){var $;return $=Pr(),$===o&&($=Lr(),$===o&&(e.charCodeAt(j)===120?($=kn,j++):($=o,pt===0&&At(vr)),$===o&&(e.charCodeAt(j)===117?($=On,j++):($=o,pt===0&&At(Er))))),$}function Bo(){var $,nt,lt,st,ht,yt;return $=j,e.charCodeAt(j)===120?(nt=kn,j++):(nt=o,pt===0&&At(vr)),nt!==o?(lt=j,st=j,ht=Sn(),ht!==o?(yt=Sn(),yt!==o?(ht=[ht,yt],st=ht):(j=st,st=o)):(j=st,st=o),st!==o?lt=e.substring(lt,j):lt=st,lt!==o?(Lt=$,$=no(lt)):(j=$,$=o)):(j=$,$=o),$}function Ir(){var $,nt,lt,st,ht,yt,nn,Dn;return $=j,e.charCodeAt(j)===117?(nt=On,j++):(nt=o,pt===0&&At(Er)),nt!==o?(lt=j,st=j,ht=Sn(),ht!==o?(yt=Sn(),yt!==o?(nn=Sn(),nn!==o?(Dn=Sn(),Dn!==o?(ht=[ht,yt,nn,Dn],st=ht):(j=st,st=o)):(j=st,st=o)):(j=st,st=o)):(j=st,st=o),st!==o?lt=e.substring(lt,j):lt=st,lt!==o?(Lt=$,$=ro(lt)):(j=$,$=o)):(j=$,$=o),$}function Lr(){var $;return Tn.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&At(fu)),$}function Sn(){var $;return er.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&At(du)),$}function bo(){var $,nt;return $=j,e.charCodeAt(j)===46?(nt=vn,j++):(nt=o,pt===0&&At(pu)),nt!==o&&(Lt=$,nt=uo()),$=nt,$}function Jn(){var $,nt,lt,st;return pt++,$=j,e.charCodeAt(j)===123?(nt=d,j++):(nt=o,pt===0&&At(It)),nt!==o?(lt=Ro(),e.charCodeAt(j)===125?(st=h,j++):(st=o,pt===0&&At(jt)),st!==o?$=lt:(j=$,$=o)):(j=$,$=o),pt--,$===o&&(nt=o,pt===0&&At(hu)),$}function Ro(){var $,nt;return $=j,nt=dr(),Lt=$,nt=io(nt),$=nt,$}function dr(){var $,nt,lt,st,ht,yt;if($=j,nt=[],lt=[],st=j,ht=j,pt++,xn.test(e.charAt(j))?(yt=e.charAt(j),j++):(yt=o,pt===0&&At(Gn)),pt--,yt===o?ht=void 0:(j=ht,ht=o),ht!==o?(yt=tn(),yt!==o?(ht=[ht,yt],st=ht):(j=st,st=o)):(j=st,st=o),st!==o)for(;st!==o;)lt.push(st),st=j,ht=j,pt++,xn.test(e.charAt(j))?(yt=e.charAt(j),j++):(yt=o,pt===0&&At(Gn)),pt--,yt===o?ht=void 0:(j=ht,ht=o),ht!==o?(yt=tn(),yt!==o?(ht=[ht,yt],st=ht):(j=st,st=o)):(j=st,st=o);else lt=o;for(lt===o&&(lt=j,e.charCodeAt(j)===123?(st=d,j++):(st=o,pt===0&&At(It)),st!==o?(ht=dr(),e.charCodeAt(j)===125?(yt=h,j++):(yt=o,pt===0&&At(jt)),yt!==o?(st=[st,ht,yt],lt=st):(j=lt,lt=o)):(j=lt,lt=o));lt!==o;){if(nt.push(lt),lt=[],st=j,ht=j,pt++,xn.test(e.charAt(j))?(yt=e.charAt(j),j++):(yt=o,pt===0&&At(Gn)),pt--,yt===o?ht=void 0:(j=ht,ht=o),ht!==o?(yt=tn(),yt!==o?(ht=[ht,yt],st=ht):(j=st,st=o)):(j=st,st=o),st!==o)for(;st!==o;)lt.push(st),st=j,ht=j,pt++,xn.test(e.charAt(j))?(yt=e.charAt(j),j++):(yt=o,pt===0&&At(Gn)),pt--,yt===o?ht=void 0:(j=ht,ht=o),ht!==o?(yt=tn(),yt!==o?(ht=[ht,yt],st=ht):(j=st,st=o)):(j=st,st=o);else lt=o;lt===o&&(lt=j,e.charCodeAt(j)===123?(st=d,j++):(st=o,pt===0&&At(It)),st!==o?(ht=dr(),e.charCodeAt(j)===125?(yt=h,j++):(yt=o,pt===0&&At(jt)),yt!==o?(st=[st,ht,yt],lt=st):(j=lt,lt=o)):(j=lt,lt=o))}return $=e.substring($,j),$}function ko(){var $;return jn.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&At(gu)),$}function To(){var $;return gt.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&At(mu)),$}function Po(){var $;return Et.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&At(vu)),$}function Io(){var $;return Ct.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&At(Eu)),$}function Lo(){var $;return $t.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&At(Au)),$}function No(){var $;return _t.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&At(yu)),$}function Oo(){var $;return kt.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&At(Cu)),$}function Mo(){var $;return bt.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&At(xu)),$}function jo(){var $;return Nt.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&At(wu)),$}function Vo(){var $;return Dt.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&At(_u)),$}function Ho(){var $;return Zt.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&At($u)),$}function Ht(){var $,nt;for($=[],nt=Xn(),nt===o&&(nt=Zn(),nt===o&&(nt=Fr()));nt!==o;)$.push(nt),nt=Xn(),nt===o&&(nt=Zn(),nt===o&&(nt=Fr()));return $}function Uo(){var $,nt;for($=[],nt=Xn(),nt===o&&(nt=Sr());nt!==o;)$.push(nt),nt=Xn(),nt===o&&(nt=Sr());return $}function pr(){var $,nt,lt,st;return $=j,nt=Ht(),e.charCodeAt(j)===59?(lt=Cn,j++):(lt=o,pt===0&&At(Fu)),lt!==o?(nt=[nt,lt],$=nt):(j=$,$=o),$===o&&($=j,nt=Uo(),lt=Dr(),lt===o&&(lt=null),st=Zn(),st!==o?(nt=[nt,lt,st],$=nt):(j=$,$=o),$===o&&($=j,nt=Ht(),lt=zo(),lt!==o?(nt=[nt,lt],$=nt):(j=$,$=o))),$}function zo(){var $,nt;return $=j,pt++,e.length>j?(nt=e.charAt(j),j++):(nt=o,pt===0&&At(Vn)),pt--,nt===o?$=void 0:(j=$,$=o),$}const Go=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/IFtzdGF0ZW1lbnQsIC4uLm1vcmVTdGF0ZW1lbnRzXSA6IG1vcmVTdGF0ZW1lbnRzOwogIHJldHVybiB7CiAgICBnb2FsOiBzdGF0ZW1lbnRzLmZpbmQocyA9PiBzLnR5cGUgPT09ICJub2RlIiAmJiBzLm5vZGVUeXBlID09PSAiZ29hbCIpIHx8IG51bGwsCiAgICBzdGF0ZW1lbnRzOiBzdGF0ZW1lbnRzCiAgfTsKfQoKc3RhdGVtZW50ID0gY29tbWVudExpbmUgLyBub2RlU3RhdGVtZW50IC8gZWRnZVN0YXRlbWVudCAvIHN0YXR1c1N0YXRlbWVudAoKY29tbWVudExpbmUgPSBfICIjIiB0ZXh0OihbXlxuXHJdKikKewogIHJldHVybiB7CiAgICB0eXBlOiAiY29tbWVudCIsCiAgICB0ZXh0OiB0ZXh0LmpvaW4oIiIpCiAgfTsKfQoKbm9kZVN0YXRlbWVudCA9IF8gaWRlbnQ6aWRlbnQgXyAnOicgXyB0ZXh0OmxhYmVsIF8gcGFyYW1zOm5vZGVQYXJhbXM/CiAgewogICAgY29uc3QgbG93ZXJJZCA9IGlkZW50LnRvTG93ZXJDYXNlKCk7CiAgICBjb25zdCBub2RlVHlwZSA9ICdnb2FsJyA9PT0gbG93ZXJJZCA/ICdnb2FsJyA6IGxvd2VySWQuc3RhcnRzV2l0aCgnY3NmXycpID8gJ2NzZicgOiAnbmMnOwogICAgcmV0dXJuIHsKICAgICAgdHlwZTogIm5vZGUiLAogICAgICBub2RlVHlwZTogbm9kZVR5cGUsCiAgICAgIGlkOiBpZGVudCwKICAgICAgdGV4dDogdGV4dCwKICAgICAgcGFyYW1zOiBwYXJhbXMgfHwge30KICAgIH07CiAgfQogIApub2RlUGFyYW1zID0gInsiIG5vZGVQYXJhbTpub2RlUGFyYW0gbW9yZU5vZGVQYXJhbXM6KEVPTCBAbm9kZVBhcmFtKSogJywnPyAifSIgCnsKCXJldHVybiBPYmplY3QuZnJvbUVudHJpZXMoW25vZGVQYXJhbSwgLi4ubW9yZU5vZGVQYXJhbXNdKTsKfQoKbm9kZVBhcmFtID0gXyBFT0w/IF8gaWRlbnQ6aWRlbnQgXyAnOicgXyBleHByZXNzaW9uOmV4cHJlc3Npb24gXyBFT0w/IF8KewoJcmV0dXJuIFtpZGVudCwgZXhwcmVzc2lvbl07Cn0KZWRnZVN0YXRlbWVudCA9IF8gdG9JZDppZGVudCBfICc8LScgXyBmcm9tSWQ6aWRlbnQKICB7CiAgICByZXR1cm4gewogICAgICB0eXBlOiAiZWRnZSIsCiAgICAgIHRvSWQ6IHRvSWQsCiAgICAgIGZyb21JZDogZnJvbUlkCiAgICB9OwogIH0KCnN0YXR1c1N0YXRlbWVudCA9IF8gaWRlbnQ6aWRlbnQgXyAiaGFzIiBfICJzdGF0dXMiIF8gcGVyY2VudGFnZTpwZXJjZW50YWdlCiAgewogICAgcmV0dXJuIHsKICAgICAgdHlwZTogInN0YXR1cyIsCiAgICAgIGlkOiBpZGVudCwKICAgICAgcGVyY2VudGFnZTogcGVyY2VudGFnZQogICAgfTsKfQoKcmVxdWlyZW1lbnRzCiAgPSBfIGlkZW50OmlkZW50IHRhaWw6KF8gImFuZCIgXyBAaWRlbnQpKgogIHsKICAgIHJldHVybiBbaWRlbnQsIC4uLnRhaWxdOwogIH0KCmV4cHJlc3Npb24gPSB0ZXh0OnN0cmluZyAvIG51bTooWzAtOV0rKQp7IHJldHVybiBudW0gIT09IHVuZGVmaW5lZCA/IHBhcnNlSW50KG51bS5qb2luKCIiKSkgOiB0ZXh0LmpvaW4oIiIpOyB9CgppZGVudCA9IGlkOihbYS16QS1aMC05X10rKQp7IHJldHVybiBpZC5qb2luKCIiKTsgfQoKbGFiZWwgPSBzdHJpbmcgLyB0ZXh0OihbXntcbl0qKQp7IHJldHVybiB0ZXh0LmpvaW4oIiIpOyB9CgpzdHJpbmcgPSAiXCIiIHRleHQ6KFteIl0qKSAiXCIiCnsgcmV0dXJuIHRleHQuam9pbigiIik7IH0KCnBlcmNlbnRhZ2UgCiAgICA9IF8gZGlnaXRzOihbMC05XSspIiUiIF8geyByZXR1cm4gbWFrZUludGVnZXIoZGlnaXRzKTsgfQogIAoKRU9MCiAgPSBbIFx0XSogW1xuXHJdKwoKXyAid2hpdGVzcGFjZSIKICA9IFsgXHRdKg==",evaporatingCloudGrammarUrl="data:application/octet-stream;base64,CnN0YXJ0CiAgPSBzdGF0ZW1lbnQ6c3RhdGVtZW50PyBtb3JlU3RhdGVtZW50czooRU9MIEBzdGF0ZW1lbnQpKiBFT0w/IF8KewogIGlmICghc3RhdGVtZW50KSByZXR1cm4geyBzdGF0ZW1lbnRzOiBtb3JlU3RhdGVtZW50cyB9OwogIHJldHVybiB7CiAgICBzdGF0ZW1lbnRzOiBbc3RhdGVtZW50LCAuLi5tb3JlU3RhdGVtZW50c10KICB9Owp9CgpzdGF0ZW1lbnQgPSBjb21tZW50TGluZSAvIGxhYmVsU3RhdGVtZW50IC8gcmVsYXRpb25TdGF0ZW1lbnQKCmNvbW1lbnRMaW5lID0gXyAiIyIgdGV4dDooW15cblxyXSopCnsKICByZXR1cm4gewogICAgdHlwZTogImNvbW1lbnQiLAogICAgdGV4dDogdGV4dC5qb2luKCIiKQogIH07Cn0KCmxhYmVsU3RhdGVtZW50ID0gXyBpZGVudDppZGVudCBfICI6IiBfIGxhYmVsOmxhYmVsCiAgewogICAgcmV0dXJuIHsKICAgICAgdHlwZTogImxhYmVsIiwKICAgICAgaWQ6IGlkZW50LAogICAgICB0ZXh0OiBsYWJlbAogICAgfTsKICB9CgpyZWxhdGlvblN0YXRlbWVudCA9IAogIF8gaWRlbnQxOmlkZW50IF8gZGlyZWN0aW9uOmRpcmVjdGlvbiBfIGlkZW50MjppZGVudCBfICc6JyBfIGxhYmVsOmxhYmVsCiAgewogICAgcmV0dXJuIHsKICAgICAgdHlwZTogImVkZ2VMYWJlbCIsCiAgICAgIGlkMTogaWRlbnQxLAogICAgICBpZDI6IGlkZW50MiwKICAgICAgdGV4dDogbGFiZWwKICAgIH07CiAgfQoKbGFiZWwgPSBzdHJpbmcgLyB0ZXh0OihbXntcbl0qKQp7IHJldHVybiB0ZXh0LmpvaW4oIiIpOyB9CgoKaWRlbnQgPSBpZDooW2EtekEtWjAtOSddKykKeyByZXR1cm4gaWQuam9pbigiIik7IH0KCnN0cmluZyA9ICJcIiIgdGV4dDooW14iXSopICJcIiIKeyByZXR1cm4gdGV4dC5qb2luKCIiKTsgfQoKZGlyZWN0aW9uID0gIjwtIiAiPiI/IC8gIi0+IgoKRU9MCiAgPSBbIFx0XSogW1xuXHJdKwoKXyAid2hpdGVzcGFjZSIKICA9IFsgXHRdKgogIAog",problemTreeGrammarUrl="data:application/octet-stream;base64,c3RhcnQKICA9IHN0YXRlbWVudDpzdGF0ZW1lbnQ/IG1vcmVTdGF0ZW1lbnRzOihFT0wgXyBAc3RhdGVtZW50KSogRU9MPyBfCnsKICBjb25zdCBzdGF0ZW1lbnRzID0gc3RhdGVtZW50ID8gW3N0YXRlbWVudCwgLi4ubW9yZVN0YXRlbWVudHNdIDogbW9yZVN0YXRlbWVudHM7CiAgcmV0dXJuIHsKICAgIHN0YXRlbWVudHM6IHN0YXRlbWVudHMKICB9Owp9CgpzdGF0ZW1lbnQgPSBjb21tZW50TGluZSAvIGxhYmVsU3RhdGVtZW50IC8gY2F1c2VTdGF0ZW1lbnQKCmNvbW1lbnRMaW5lID0gXyAiIyIgdGV4dDooW15cblxyXSopCnsKICByZXR1cm4gewogICAgdHlwZTogImNvbW1lbnQiLAogICAgdGV4dDogdGV4dC5qb2luKCIiKQogIH07Cn0KCmxhYmVsU3RhdGVtZW50ID0gXyB0eXBlOigiQyIgLyAiVURFIiAvICJERSIgLyAiRk9MIikgX18gaWRlbnQ6aWRlbnQgX18gImlzIiBfXyBzdHI6c3RyaW5nCiAgewogICAgcmV0dXJuIHsKICAgICAgdHlwZSwKICAgICAgaWQ6IGlkZW50LAogICAgICB0ZXh0OiBzdHIKICAgIH07CiAgfQpjYXVzZVN0YXRlbWVudCA9IF8gIGlkZW50czppZGVudExpc3QgX18gImNhdXNlIiAicyI/IF9fIGVmZmVjdElkOmlkZW50CiAgewogICAgcmV0dXJuIHsKICAgICAgdHlwZTogImNhdXNlIiwKICAgICAgY2F1c2VzOiBpZGVudHMsCiAgICAgIGVmZmVjdElkOiBlZmZlY3RJZAogICAgfTsKICB9CgppZGVudExpc3QKICA9IGlkZW50OmlkZW50IHRhaWw6KF9fICJhbmQiIF9fIEBpZGVudCkqCiAgewogICAgcmV0dXJuIFtpZGVudCwgLi4udGFpbF07CiAgfQoKaWRlbnQgPSBpZDooW2EtekEtWjAtOV0rKQp7IHJldHVybiBpZC5qb2luKCIiKTsgfQoKc3RyaW5nID0gIlwiIiB0ZXh0OihbXiJdKikgIlwiIgp7IHJldHVybiB0ZXh0LmpvaW4oIiIpOyB9CgpwZXJjZW50YWdlIAogICAgPSBfIGRpZ2l0czooWzAtOV0rKSIlIiBfIHsgcmV0dXJuIG1ha2VJbnRlZ2VyKGRpZ2l0cyk7IH0KICAKCkVPTAogID0gWyBcdF0qIFtcblxyXSsKCl8gIm9wdGlvbmFsIHdoaXRlc3BhY2UiCiAgPSBbIFx0XSoKCl9fICJ3aGl0ZXNwYWNlIgogID0gWyBcdF0r",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),e.statements.filter(a=>a.type==="node"&&a.nodeType==="nc").forEach(a=>{i.set(a.id,{key:a.id,label:a.text})}),e.statements.filter(a=>a.type==="node"&&a.nodeType==="csf").forEach(a=>{i.set(a.id,{key:a.id,label:a.text,annotation:"CSF"}),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})}),e.statements.filter(a=>a.type==="status").forEach(a=>{const s=a.id,c=i.get(s);if(!c)throw new Error(`Node ${s} not found`);c.statusPercentage=a.percentage}),{nodes:i,edges:o,rankdir:"BT"}},parseProblemTreeSemantics=e=>{const i=new Map,o=[];return e.statements.filter(a=>a.type==="UDE"||a.type==="DE"||a.type==="FOL").forEach(a=>{i.set(a.id,{annotation:a.type,key:a.id,label:a.text})}),e.statements.filter(a=>a.type==="C").forEach(a=>{i.set(a.id,{key:a.id,label:a.text})}),e.statements.filter(a=>a.type==="cause").forEach(a=>{const s=a.effectId;let c=s;if(a.causes.length>1){const d=a.causes.join("_")+"_cause_"+s;c=d,i.set(d,{key:d,label:"AND",intermediate:!0}),o.push({from:d,to:s})}for(const d of a.causes){if(!i.has(d))throw new Error(`Cause ${d} not declared`);if(!i.has(s))throw new Error(`Effect ${s} not declared`);o.push({from:d,to:c})}}),{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 Ko(); +`,!1),Ur=Bt(`\r +`,!1),Hr=Bt("\r",!1),zr=Bt("\u2028",!1),Gr=Bt("\u2029",!1),Wr=pn("comment"),hr=Bt("/*",!1),Fn=Bt("*/",!1),Kr=Bt("//",!1),Yr=pn("identifier"),Xr=Bt("_",!1),dn=Bt("\\",!1),Zr=Bt("‌",!1),Qr=Bt("‍",!1),Jr=pn("literal"),gr=Bt("i",!1),qr=pn("string"),Hn=Bt('"',!1),zn=Bt("'",!1),eu=pn("character class"),tu=Bt("[",!1),nu=Bt("^",!1),mr=Bt("]",!1),ru=Bt("-",!1),uu=Bt("0",!1),iu=Bt("b",!1),ou=Bt("f",!1),au=Bt("n",!1),su=Bt("r",!1),lu=Bt("t",!1),cu=Bt("v",!1),vr=Bt("x",!1),Er=Bt("u",!1),fu=Jt([["0","9"]],!1,!1),du=Jt([["0","9"],["a","f"]],!1,!0),pu=Bt(".",!1),hu=pn("code block"),Gn=Jt(["{","}"],!1,!1),gu=Jt([["a","z"],"µ",["ß","ö"],["ø","ÿ"],"ā","ă","ą","ć","ĉ","ċ","č","ď","đ","ē","ĕ","ė","ę","ě","ĝ","ğ","ġ","ģ","ĥ","ħ","ĩ","ī","ĭ","į","ı","ij","ĵ",["ķ","ĸ"],"ĺ","ļ","ľ","ŀ","ł","ń","ņ",["ň","ʼn"],"ŋ","ō","ŏ","ő","œ","ŕ","ŗ","ř","ś","ŝ","ş","š","ţ","ť","ŧ","ũ","ū","ŭ","ů","ű","ų","ŵ","ŷ","ź","ż",["ž","ƀ"],"ƃ","ƅ","ƈ",["ƌ","ƍ"],"ƒ","ƕ",["ƙ","ƛ"],"ƞ","ơ","ƣ","ƥ","ƨ",["ƪ","ƫ"],"ƭ","ư","ƴ","ƶ",["ƹ","ƺ"],["ƽ","ƿ"],"dž","lj","nj","ǎ","ǐ","ǒ","ǔ","ǖ","ǘ","ǚ",["ǜ","ǝ"],"ǟ","ǡ","ǣ","ǥ","ǧ","ǩ","ǫ","ǭ",["ǯ","ǰ"],"dz","ǵ","ǹ","ǻ","ǽ","ǿ","ȁ","ȃ","ȅ","ȇ","ȉ","ȋ","ȍ","ȏ","ȑ","ȓ","ȕ","ȗ","ș","ț","ȝ","ȟ","ȡ","ȣ","ȥ","ȧ","ȩ","ȫ","ȭ","ȯ","ȱ",["ȳ","ȹ"],"ȼ",["ȿ","ɀ"],"ɂ","ɇ","ɉ","ɋ","ɍ",["ɏ","ʓ"],["ʕ","ʯ"],"ͱ","ͳ","ͷ",["ͻ","ͽ"],"ΐ",["ά","ώ"],["ϐ","ϑ"],["ϕ","ϗ"],"ϙ","ϛ","ϝ","ϟ","ϡ","ϣ","ϥ","ϧ","ϩ","ϫ","ϭ",["ϯ","ϳ"],"ϵ","ϸ",["ϻ","ϼ"],["а","џ"],"ѡ","ѣ","ѥ","ѧ","ѩ","ѫ","ѭ","ѯ","ѱ","ѳ","ѵ","ѷ","ѹ","ѻ","ѽ","ѿ","ҁ","ҋ","ҍ","ҏ","ґ","ғ","ҕ","җ","ҙ","қ","ҝ","ҟ","ҡ","ң","ҥ","ҧ","ҩ","ҫ","ҭ","ү","ұ","ҳ","ҵ","ҷ","ҹ","һ","ҽ","ҿ","ӂ","ӄ","ӆ","ӈ","ӊ","ӌ",["ӎ","ӏ"],"ӑ","ӓ","ӕ","ӗ","ә","ӛ","ӝ","ӟ","ӡ","ӣ","ӥ","ӧ","ө","ӫ","ӭ","ӯ","ӱ","ӳ","ӵ","ӷ","ӹ","ӻ","ӽ","ӿ","ԁ","ԃ","ԅ","ԇ","ԉ","ԋ","ԍ","ԏ","ԑ","ԓ","ԕ","ԗ","ԙ","ԛ","ԝ","ԟ","ԡ","ԣ","ԥ","ԧ","ԩ","ԫ","ԭ","ԯ",["ա","և"],["ᏸ","ᏽ"],["ᴀ","ᴫ"],["ᵫ","ᵷ"],["ᵹ","ᶚ"],"ḁ","ḃ","ḅ","ḇ","ḉ","ḋ","ḍ","ḏ","ḑ","ḓ","ḕ","ḗ","ḙ","ḛ","ḝ","ḟ","ḡ","ḣ","ḥ","ḧ","ḩ","ḫ","ḭ","ḯ","ḱ","ḳ","ḵ","ḷ","ḹ","ḻ","ḽ","ḿ","ṁ","ṃ","ṅ","ṇ","ṉ","ṋ","ṍ","ṏ","ṑ","ṓ","ṕ","ṗ","ṙ","ṛ","ṝ","ṟ","ṡ","ṣ","ṥ","ṧ","ṩ","ṫ","ṭ","ṯ","ṱ","ṳ","ṵ","ṷ","ṹ","ṻ","ṽ","ṿ","ẁ","ẃ","ẅ","ẇ","ẉ","ẋ","ẍ","ẏ","ẑ","ẓ",["ẕ","ẝ"],"ẟ","ạ","ả","ấ","ầ","ẩ","ẫ","ậ","ắ","ằ","ẳ","ẵ","ặ","ẹ","ẻ","ẽ","ế","ề","ể","ễ","ệ","ỉ","ị","ọ","ỏ","ố","ồ","ổ","ỗ","ộ","ớ","ờ","ở","ỡ","ợ","ụ","ủ","ứ","ừ","ử","ữ","ự","ỳ","ỵ","ỷ","ỹ","ỻ","ỽ",["ỿ","ἇ"],["ἐ","ἕ"],["ἠ","ἧ"],["ἰ","ἷ"],["ὀ","ὅ"],["ὐ","ὗ"],["ὠ","ὧ"],["ὰ","ώ"],["ᾀ","ᾇ"],["ᾐ","ᾗ"],["ᾠ","ᾧ"],["ᾰ","ᾴ"],["ᾶ","ᾷ"],"ι",["ῂ","ῄ"],["ῆ","ῇ"],["ῐ","ΐ"],["ῖ","ῗ"],["ῠ","ῧ"],["ῲ","ῴ"],["ῶ","ῷ"],"ℊ",["ℎ","ℏ"],"ℓ","ℯ","ℴ","ℹ",["ℼ","ℽ"],["ⅆ","ⅉ"],"ⅎ","ↄ",["ⰰ","ⱞ"],"ⱡ",["ⱥ","ⱦ"],"ⱨ","ⱪ","ⱬ","ⱱ",["ⱳ","ⱴ"],["ⱶ","ⱻ"],"ⲁ","ⲃ","ⲅ","ⲇ","ⲉ","ⲋ","ⲍ","ⲏ","ⲑ","ⲓ","ⲕ","ⲗ","ⲙ","ⲛ","ⲝ","ⲟ","ⲡ","ⲣ","ⲥ","ⲧ","ⲩ","ⲫ","ⲭ","ⲯ","ⲱ","ⲳ","ⲵ","ⲷ","ⲹ","ⲻ","ⲽ","ⲿ","ⳁ","ⳃ","ⳅ","ⳇ","ⳉ","ⳋ","ⳍ","ⳏ","ⳑ","ⳓ","ⳕ","ⳗ","ⳙ","ⳛ","ⳝ","ⳟ","ⳡ",["ⳣ","ⳤ"],"ⳬ","ⳮ","ⳳ",["ⴀ","ⴥ"],"ⴧ","ⴭ","ꙁ","ꙃ","ꙅ","ꙇ","ꙉ","ꙋ","ꙍ","ꙏ","ꙑ","ꙓ","ꙕ","ꙗ","ꙙ","ꙛ","ꙝ","ꙟ","ꙡ","ꙣ","ꙥ","ꙧ","ꙩ","ꙫ","ꙭ","ꚁ","ꚃ","ꚅ","ꚇ","ꚉ","ꚋ","ꚍ","ꚏ","ꚑ","ꚓ","ꚕ","ꚗ","ꚙ","ꚛ","ꜣ","ꜥ","ꜧ","ꜩ","ꜫ","ꜭ",["ꜯ","ꜱ"],"ꜳ","ꜵ","ꜷ","ꜹ","ꜻ","ꜽ","ꜿ","ꝁ","ꝃ","ꝅ","ꝇ","ꝉ","ꝋ","ꝍ","ꝏ","ꝑ","ꝓ","ꝕ","ꝗ","ꝙ","ꝛ","ꝝ","ꝟ","ꝡ","ꝣ","ꝥ","ꝧ","ꝩ","ꝫ","ꝭ","ꝯ",["ꝱ","ꝸ"],"ꝺ","ꝼ","ꝿ","ꞁ","ꞃ","ꞅ","ꞇ","ꞌ","ꞎ","ꞑ",["ꞓ","ꞕ"],"ꞗ","ꞙ","ꞛ","ꞝ","ꞟ","ꞡ","ꞣ","ꞥ","ꞧ","ꞩ","ꞵ","ꞷ","ꟺ",["ꬰ","ꭚ"],["ꭠ","ꭥ"],["ꭰ","ꮿ"],["ff","st"],["ﬓ","ﬗ"],["a","z"]],!1,!1),mu=Jt([["ʰ","ˁ"],["ˆ","ˑ"],["ˠ","ˤ"],"ˬ","ˮ","ʹ","ͺ","ՙ","ـ",["ۥ","ۦ"],["ߴ","ߵ"],"ߺ","ࠚ","ࠤ","ࠨ","ॱ","ๆ","ໆ","ჼ","ៗ","ᡃ","ᪧ",["ᱸ","ᱽ"],["ᴬ","ᵪ"],"ᵸ",["ᶛ","ᶿ"],"ⁱ","ⁿ",["ₐ","ₜ"],["ⱼ","ⱽ"],"ⵯ","ⸯ","々",["〱","〵"],"〻",["ゝ","ゞ"],["ー","ヾ"],"ꀕ",["ꓸ","ꓽ"],"ꘌ","ꙿ",["ꚜ","ꚝ"],["ꜗ","ꜟ"],"ꝰ","ꞈ",["ꟸ","ꟹ"],"ꧏ","ꧦ","ꩰ","ꫝ",["ꫳ","ꫴ"],["ꭜ","ꭟ"],"ー",["゙","゚"]],!1,!1),vu=Jt(["ª","º","ƻ",["ǀ","ǃ"],"ʔ",["א","ת"],["װ","ײ"],["ؠ","ؿ"],["ف","ي"],["ٮ","ٯ"],["ٱ","ۓ"],"ە",["ۮ","ۯ"],["ۺ","ۼ"],"ۿ","ܐ",["ܒ","ܯ"],["ݍ","ޥ"],"ޱ",["ߊ","ߪ"],["ࠀ","ࠕ"],["ࡀ","ࡘ"],["ࢠ","ࢴ"],["ऄ","ह"],"ऽ","ॐ",["क़","ॡ"],["ॲ","ঀ"],["অ","ঌ"],["এ","ঐ"],["ও","ন"],["প","র"],"ল",["শ","হ"],"ঽ","ৎ",["ড়","ঢ়"],["য়","ৡ"],["ৰ","ৱ"],["ਅ","ਊ"],["ਏ","ਐ"],["ਓ","ਨ"],["ਪ","ਰ"],["ਲ","ਲ਼"],["ਵ","ਸ਼"],["ਸ","ਹ"],["ਖ਼","ੜ"],"ਫ਼",["ੲ","ੴ"],["અ","ઍ"],["એ","ઑ"],["ઓ","ન"],["પ","ર"],["લ","ળ"],["વ","હ"],"ઽ","ૐ",["ૠ","ૡ"],"ૹ",["ଅ","ଌ"],["ଏ","ଐ"],["ଓ","ନ"],["ପ","ର"],["ଲ","ଳ"],["ଵ","ହ"],"ଽ",["ଡ଼","ଢ଼"],["ୟ","ୡ"],"ୱ","ஃ",["அ","ஊ"],["எ","ஐ"],["ஒ","க"],["ங","ச"],"ஜ",["ஞ","ட"],["ண","த"],["ந","ப"],["ம","ஹ"],"ௐ",["అ","ఌ"],["ఎ","ఐ"],["ఒ","న"],["ప","హ"],"ఽ",["ౘ","ౚ"],["ౠ","ౡ"],["ಅ","ಌ"],["ಎ","ಐ"],["ಒ","ನ"],["ಪ","ಳ"],["ವ","ಹ"],"ಽ","ೞ",["ೠ","ೡ"],["ೱ","ೲ"],["അ","ഌ"],["എ","ഐ"],["ഒ","ഺ"],"ഽ","ൎ",["ൟ","ൡ"],["ൺ","ൿ"],["අ","ඖ"],["ක","න"],["ඳ","ර"],"ල",["ව","ෆ"],["ก","ะ"],["า","ำ"],["เ","ๅ"],["ກ","ຂ"],"ຄ",["ງ","ຈ"],"ຊ","ຍ",["ດ","ທ"],["ນ","ຟ"],["ມ","ຣ"],"ລ","ວ",["ສ","ຫ"],["ອ","ະ"],["າ","ຳ"],"ຽ",["ເ","ໄ"],["ໜ","ໟ"],"ༀ",["ཀ","ཇ"],["ཉ","ཬ"],["ྈ","ྌ"],["က","ဪ"],"ဿ",["ၐ","ၕ"],["ၚ","ၝ"],"ၡ",["ၥ","ၦ"],["ၮ","ၰ"],["ၵ","ႁ"],"ႎ",["ა","ჺ"],["ჽ","ቈ"],["ቊ","ቍ"],["ቐ","ቖ"],"ቘ",["ቚ","ቝ"],["በ","ኈ"],["ኊ","ኍ"],["ነ","ኰ"],["ኲ","ኵ"],["ኸ","ኾ"],"ዀ",["ዂ","ዅ"],["ወ","ዖ"],["ዘ","ጐ"],["ጒ","ጕ"],["ጘ","ፚ"],["ᎀ","ᎏ"],["ᐁ","ᙬ"],["ᙯ","ᙿ"],["ᚁ","ᚚ"],["ᚠ","ᛪ"],["ᛱ","ᛸ"],["ᜀ","ᜌ"],["ᜎ","ᜑ"],["ᜠ","ᜱ"],["ᝀ","ᝑ"],["ᝠ","ᝬ"],["ᝮ","ᝰ"],["ក","ឳ"],"ៜ",["ᠠ","ᡂ"],["ᡄ","ᡷ"],["ᢀ","ᢨ"],"ᢪ",["ᢰ","ᣵ"],["ᤀ","ᤞ"],["ᥐ","ᥭ"],["ᥰ","ᥴ"],["ᦀ","ᦫ"],["ᦰ","ᧉ"],["ᨀ","ᨖ"],["ᨠ","ᩔ"],["ᬅ","ᬳ"],["ᭅ","ᭋ"],["ᮃ","ᮠ"],["ᮮ","ᮯ"],["ᮺ","ᯥ"],["ᰀ","ᰣ"],["ᱍ","ᱏ"],["ᱚ","ᱷ"],["ᳩ","ᳬ"],["ᳮ","ᳱ"],["ᳵ","ᳶ"],["ℵ","ℸ"],["ⴰ","ⵧ"],["ⶀ","ⶖ"],["ⶠ","ⶦ"],["ⶨ","ⶮ"],["ⶰ","ⶶ"],["ⶸ","ⶾ"],["ⷀ","ⷆ"],["ⷈ","ⷎ"],["ⷐ","ⷖ"],["ⷘ","ⷞ"],"〆","〼",["ぁ","ゖ"],"ゟ",["ァ","ヺ"],"ヿ",["ㄅ","ㄭ"],["ㄱ","ㆎ"],["ㆠ","ㆺ"],["ㇰ","ㇿ"],["㐀","䶵"],["一","鿕"],["ꀀ","ꀔ"],["ꀖ","ꒌ"],["ꓐ","ꓷ"],["ꔀ","ꘋ"],["ꘐ","ꘟ"],["ꘪ","ꘫ"],"ꙮ",["ꚠ","ꛥ"],"ꞏ","ꟷ",["ꟻ","ꠁ"],["ꠃ","ꠅ"],["ꠇ","ꠊ"],["ꠌ","ꠢ"],["ꡀ","ꡳ"],["ꢂ","ꢳ"],["ꣲ","ꣷ"],"ꣻ","ꣽ",["ꤊ","ꤥ"],["ꤰ","ꥆ"],["ꥠ","ꥼ"],["ꦄ","ꦲ"],["ꧠ","ꧤ"],["ꧧ","ꧯ"],["ꧺ","ꧾ"],["ꨀ","ꨨ"],["ꩀ","ꩂ"],["ꩄ","ꩋ"],["ꩠ","ꩯ"],["ꩱ","ꩶ"],"ꩺ",["ꩾ","ꪯ"],"ꪱ",["ꪵ","ꪶ"],["ꪹ","ꪽ"],"ꫀ","ꫂ",["ꫛ","ꫜ"],["ꫠ","ꫪ"],"ꫲ",["ꬁ","ꬆ"],["ꬉ","ꬎ"],["ꬑ","ꬖ"],["ꬠ","ꬦ"],["ꬨ","ꬮ"],["ꯀ","ꯢ"],["가","힣"],["ힰ","ퟆ"],["ퟋ","ퟻ"],["豈","舘"],["並","龎"],"יִ",["ײַ","ﬨ"],["שׁ","זּ"],["טּ","לּ"],"מּ",["נּ","סּ"],["ףּ","פּ"],["צּ","ﮱ"],["ﯓ","ﴽ"],["ﵐ","ﶏ"],["ﶒ","ﷇ"],["ﷰ","ﷻ"],["ﹰ","ﹴ"],["ﹶ","ﻼ"],["ヲ","ッ"],["ア","ン"],["ᅠ","ᄒ"],["ᅡ","ᅦ"],["ᅧ","ᅬ"],["ᅭ","ᅲ"],["ᅳ","ᅵ"]],!1,!1),Eu=Jt(["Dž","Lj","Nj","Dz",["ᾈ","ᾏ"],["ᾘ","ᾟ"],["ᾨ","ᾯ"],"ᾼ","ῌ","ῼ"],!1,!1),yu=Jt([["A","Z"],["À","Ö"],["Ø","Þ"],"Ā","Ă","Ą","Ć","Ĉ","Ċ","Č","Ď","Đ","Ē","Ĕ","Ė","Ę","Ě","Ĝ","Ğ","Ġ","Ģ","Ĥ","Ħ","Ĩ","Ī","Ĭ","Į","İ","IJ","Ĵ","Ķ","Ĺ","Ļ","Ľ","Ŀ","Ł","Ń","Ņ","Ň","Ŋ","Ō","Ŏ","Ő","Œ","Ŕ","Ŗ","Ř","Ś","Ŝ","Ş","Š","Ţ","Ť","Ŧ","Ũ","Ū","Ŭ","Ů","Ű","Ų","Ŵ","Ŷ",["Ÿ","Ź"],"Ż","Ž",["Ɓ","Ƃ"],"Ƅ",["Ɔ","Ƈ"],["Ɖ","Ƌ"],["Ǝ","Ƒ"],["Ɠ","Ɣ"],["Ɩ","Ƙ"],["Ɯ","Ɲ"],["Ɵ","Ơ"],"Ƣ","Ƥ",["Ʀ","Ƨ"],"Ʃ","Ƭ",["Ʈ","Ư"],["Ʊ","Ƴ"],"Ƶ",["Ʒ","Ƹ"],"Ƽ","DŽ","LJ","NJ","Ǎ","Ǐ","Ǒ","Ǔ","Ǖ","Ǘ","Ǚ","Ǜ","Ǟ","Ǡ","Ǣ","Ǥ","Ǧ","Ǩ","Ǫ","Ǭ","Ǯ","DZ","Ǵ",["Ƕ","Ǹ"],"Ǻ","Ǽ","Ǿ","Ȁ","Ȃ","Ȅ","Ȇ","Ȉ","Ȋ","Ȍ","Ȏ","Ȑ","Ȓ","Ȕ","Ȗ","Ș","Ț","Ȝ","Ȟ","Ƞ","Ȣ","Ȥ","Ȧ","Ȩ","Ȫ","Ȭ","Ȯ","Ȱ","Ȳ",["Ⱥ","Ȼ"],["Ƚ","Ⱦ"],"Ɂ",["Ƀ","Ɇ"],"Ɉ","Ɋ","Ɍ","Ɏ","Ͱ","Ͳ","Ͷ","Ϳ","Ά",["Έ","Ί"],"Ό",["Ύ","Ώ"],["Α","Ρ"],["Σ","Ϋ"],"Ϗ",["ϒ","ϔ"],"Ϙ","Ϛ","Ϝ","Ϟ","Ϡ","Ϣ","Ϥ","Ϧ","Ϩ","Ϫ","Ϭ","Ϯ","ϴ","Ϸ",["Ϲ","Ϻ"],["Ͻ","Я"],"Ѡ","Ѣ","Ѥ","Ѧ","Ѩ","Ѫ","Ѭ","Ѯ","Ѱ","Ѳ","Ѵ","Ѷ","Ѹ","Ѻ","Ѽ","Ѿ","Ҁ","Ҋ","Ҍ","Ҏ","Ґ","Ғ","Ҕ","Җ","Ҙ","Қ","Ҝ","Ҟ","Ҡ","Ң","Ҥ","Ҧ","Ҩ","Ҫ","Ҭ","Ү","Ұ","Ҳ","Ҵ","Ҷ","Ҹ","Һ","Ҽ","Ҿ",["Ӏ","Ӂ"],"Ӄ","Ӆ","Ӈ","Ӊ","Ӌ","Ӎ","Ӑ","Ӓ","Ӕ","Ӗ","Ә","Ӛ","Ӝ","Ӟ","Ӡ","Ӣ","Ӥ","Ӧ","Ө","Ӫ","Ӭ","Ӯ","Ӱ","Ӳ","Ӵ","Ӷ","Ӹ","Ӻ","Ӽ","Ӿ","Ԁ","Ԃ","Ԅ","Ԇ","Ԉ","Ԋ","Ԍ","Ԏ","Ԑ","Ԓ","Ԕ","Ԗ","Ԙ","Ԛ","Ԝ","Ԟ","Ԡ","Ԣ","Ԥ","Ԧ","Ԩ","Ԫ","Ԭ","Ԯ",["Ա","Ֆ"],["Ⴀ","Ⴥ"],"Ⴧ","Ⴭ",["Ꭰ","Ᏽ"],"Ḁ","Ḃ","Ḅ","Ḇ","Ḉ","Ḋ","Ḍ","Ḏ","Ḑ","Ḓ","Ḕ","Ḗ","Ḙ","Ḛ","Ḝ","Ḟ","Ḡ","Ḣ","Ḥ","Ḧ","Ḩ","Ḫ","Ḭ","Ḯ","Ḱ","Ḳ","Ḵ","Ḷ","Ḹ","Ḻ","Ḽ","Ḿ","Ṁ","Ṃ","Ṅ","Ṇ","Ṉ","Ṋ","Ṍ","Ṏ","Ṑ","Ṓ","Ṕ","Ṗ","Ṙ","Ṛ","Ṝ","Ṟ","Ṡ","Ṣ","Ṥ","Ṧ","Ṩ","Ṫ","Ṭ","Ṯ","Ṱ","Ṳ","Ṵ","Ṷ","Ṹ","Ṻ","Ṽ","Ṿ","Ẁ","Ẃ","Ẅ","Ẇ","Ẉ","Ẋ","Ẍ","Ẏ","Ẑ","Ẓ","Ẕ","ẞ","Ạ","Ả","Ấ","Ầ","Ẩ","Ẫ","Ậ","Ắ","Ằ","Ẳ","Ẵ","Ặ","Ẹ","Ẻ","Ẽ","Ế","Ề","Ể","Ễ","Ệ","Ỉ","Ị","Ọ","Ỏ","Ố","Ồ","Ổ","Ỗ","Ộ","Ớ","Ờ","Ở","Ỡ","Ợ","Ụ","Ủ","Ứ","Ừ","Ử","Ữ","Ự","Ỳ","Ỵ","Ỷ","Ỹ","Ỻ","Ỽ","Ỿ",["Ἀ","Ἇ"],["Ἐ","Ἕ"],["Ἠ","Ἧ"],["Ἰ","Ἷ"],["Ὀ","Ὅ"],"Ὑ","Ὓ","Ὕ","Ὗ",["Ὠ","Ὧ"],["Ᾰ","Ά"],["Ὲ","Ή"],["Ῐ","Ί"],["Ῠ","Ῥ"],["Ὸ","Ώ"],"ℂ","ℇ",["ℋ","ℍ"],["ℐ","ℒ"],"ℕ",["ℙ","ℝ"],"ℤ","Ω","ℨ",["K","ℭ"],["ℰ","ℳ"],["ℾ","ℿ"],"ⅅ","Ↄ",["Ⰰ","Ⱞ"],"Ⱡ",["Ɫ","Ɽ"],"Ⱨ","Ⱪ","Ⱬ",["Ɑ","Ɒ"],"Ⱳ","Ⱶ",["Ȿ","Ⲁ"],"Ⲃ","Ⲅ","Ⲇ","Ⲉ","Ⲋ","Ⲍ","Ⲏ","Ⲑ","Ⲓ","Ⲕ","Ⲗ","Ⲙ","Ⲛ","Ⲝ","Ⲟ","Ⲡ","Ⲣ","Ⲥ","Ⲧ","Ⲩ","Ⲫ","Ⲭ","Ⲯ","Ⲱ","Ⲳ","Ⲵ","Ⲷ","Ⲹ","Ⲻ","Ⲽ","Ⲿ","Ⳁ","Ⳃ","Ⳅ","Ⳇ","Ⳉ","Ⳋ","Ⳍ","Ⳏ","Ⳑ","Ⳓ","Ⳕ","Ⳗ","Ⳙ","Ⳛ","Ⳝ","Ⳟ","Ⳡ","Ⳣ","Ⳬ","Ⳮ","Ⳳ","Ꙁ","Ꙃ","Ꙅ","Ꙇ","Ꙉ","Ꙋ","Ꙍ","Ꙏ","Ꙑ","Ꙓ","Ꙕ","Ꙗ","Ꙙ","Ꙛ","Ꙝ","Ꙟ","Ꙡ","Ꙣ","Ꙥ","Ꙧ","Ꙩ","Ꙫ","Ꙭ","Ꚁ","Ꚃ","Ꚅ","Ꚇ","Ꚉ","Ꚋ","Ꚍ","Ꚏ","Ꚑ","Ꚓ","Ꚕ","Ꚗ","Ꚙ","Ꚛ","Ꜣ","Ꜥ","Ꜧ","Ꜩ","Ꜫ","Ꜭ","Ꜯ","Ꜳ","Ꜵ","Ꜷ","Ꜹ","Ꜻ","Ꜽ","Ꜿ","Ꝁ","Ꝃ","Ꝅ","Ꝇ","Ꝉ","Ꝋ","Ꝍ","Ꝏ","Ꝑ","Ꝓ","Ꝕ","Ꝗ","Ꝙ","Ꝛ","Ꝝ","Ꝟ","Ꝡ","Ꝣ","Ꝥ","Ꝧ","Ꝩ","Ꝫ","Ꝭ","Ꝯ","Ꝺ","Ꝼ",["Ᵹ","Ꝿ"],"Ꞁ","Ꞃ","Ꞅ","Ꞇ","Ꞌ","Ɥ","Ꞑ","Ꞓ","Ꞗ","Ꞙ","Ꞛ","Ꞝ","Ꞟ","Ꞡ","Ꞣ","Ꞥ","Ꞧ","Ꞩ",["Ɦ","Ɬ"],["Ʞ","Ꞵ"],"Ꞷ",["A","Z"]],!1,!1),Au=Jt(["ः","ऻ",["ा","ी"],["ॉ","ौ"],["ॎ","ॏ"],["ং","ঃ"],["া","ী"],["ে","ৈ"],["ো","ৌ"],"ৗ","ਃ",["ਾ","ੀ"],"ઃ",["ા","ી"],"ૉ",["ો","ૌ"],["ଂ","ଃ"],"ା","ୀ",["େ","ୈ"],["ୋ","ୌ"],"ୗ",["ா","ி"],["ு","ூ"],["ெ","ை"],["ொ","ௌ"],"ௗ",["ఁ","ః"],["ు","ౄ"],["ಂ","ಃ"],"ಾ",["ೀ","ೄ"],["ೇ","ೈ"],["ೊ","ೋ"],["ೕ","ೖ"],["ം","ഃ"],["ാ","ീ"],["െ","ൈ"],["ൊ","ൌ"],"ൗ",["ං","ඃ"],["ා","ෑ"],["ෘ","ෟ"],["ෲ","ෳ"],["༾","༿"],"ཿ",["ါ","ာ"],"ေ","း",["ျ","ြ"],["ၖ","ၗ"],["ၢ","ၤ"],["ၧ","ၭ"],["ႃ","ႄ"],["ႇ","ႌ"],"ႏ",["ႚ","ႜ"],"ា",["ើ","ៅ"],["ះ","ៈ"],["ᤣ","ᤦ"],["ᤩ","ᤫ"],["ᤰ","ᤱ"],["ᤳ","ᤸ"],["ᨙ","ᨚ"],"ᩕ","ᩗ","ᩡ",["ᩣ","ᩤ"],["ᩭ","ᩲ"],"ᬄ","ᬵ","ᬻ",["ᬽ","ᭁ"],["ᭃ","᭄"],"ᮂ","ᮡ",["ᮦ","ᮧ"],"᮪","ᯧ",["ᯪ","ᯬ"],"ᯮ",["᯲","᯳"],["ᰤ","ᰫ"],["ᰴ","ᰵ"],"᳡",["ᳲ","ᳳ"],["〮","〯"],["ꠣ","ꠤ"],"ꠧ",["ꢀ","ꢁ"],["ꢴ","ꣃ"],["ꥒ","꥓"],"ꦃ",["ꦴ","ꦵ"],["ꦺ","ꦻ"],["ꦽ","꧀"],["ꨯ","ꨰ"],["ꨳ","ꨴ"],"ꩍ","ꩻ","ꩽ","ꫫ",["ꫮ","ꫯ"],"ꫵ",["ꯣ","ꯤ"],["ꯦ","ꯧ"],["ꯩ","ꯪ"],"꯬"],!1,!1),Cu=Jt([["̀","ͯ"],["҃","҇"],["֑","ֽ"],"ֿ",["ׁ","ׂ"],["ׄ","ׅ"],"ׇ",["ؐ","ؚ"],["ً","ٟ"],"ٰ",["ۖ","ۜ"],["۟","ۤ"],["ۧ","ۨ"],["۪","ۭ"],"ܑ",["ܰ","݊"],["ަ","ް"],["߫","߳"],["ࠖ","࠙"],["ࠛ","ࠣ"],["ࠥ","ࠧ"],["ࠩ","࠭"],["࡙","࡛"],["ࣣ","ं"],"ऺ","़",["ु","ै"],"्",["॑","ॗ"],["ॢ","ॣ"],"ঁ","়",["ু","ৄ"],"্",["ৢ","ৣ"],["ਁ","ਂ"],"਼",["ੁ","ੂ"],["ੇ","ੈ"],["ੋ","੍"],"ੑ",["ੰ","ੱ"],"ੵ",["ઁ","ં"],"઼",["ુ","ૅ"],["ે","ૈ"],"્",["ૢ","ૣ"],"ଁ","଼","ି",["ୁ","ୄ"],"୍","ୖ",["ୢ","ୣ"],"ஂ","ீ","்","ఀ",["ా","ీ"],["ె","ై"],["ొ","్"],["ౕ","ౖ"],["ౢ","ౣ"],"ಁ","಼","ಿ","ೆ",["ೌ","್"],["ೢ","ೣ"],"ഁ",["ു","ൄ"],"്",["ൢ","ൣ"],"්",["ි","ු"],"ූ","ั",["ิ","ฺ"],["็","๎"],"ັ",["ິ","ູ"],["ົ","ຼ"],["່","ໍ"],["༘","༙"],"༵","༷","༹",["ཱ","ཾ"],["ྀ","྄"],["྆","྇"],["ྍ","ྗ"],["ྙ","ྼ"],"࿆",["ိ","ူ"],["ဲ","့"],["္","်"],["ွ","ှ"],["ၘ","ၙ"],["ၞ","ၠ"],["ၱ","ၴ"],"ႂ",["ႅ","ႆ"],"ႍ","ႝ",["፝","፟"],["ᜒ","᜔"],["ᜲ","᜴"],["ᝒ","ᝓ"],["ᝲ","ᝳ"],["឴","឵"],["ិ","ួ"],"ំ",["៉","៓"],"៝",["᠋","᠍"],"ᢩ",["ᤠ","ᤢ"],["ᤧ","ᤨ"],"ᤲ",["᤹","᤻"],["ᨗ","ᨘ"],"ᨛ","ᩖ",["ᩘ","ᩞ"],"᩠","ᩢ",["ᩥ","ᩬ"],["ᩳ","᩼"],"᩿",["᪰","᪽"],["ᬀ","ᬃ"],"᬴",["ᬶ","ᬺ"],"ᬼ","ᭂ",["᭫","᭳"],["ᮀ","ᮁ"],["ᮢ","ᮥ"],["ᮨ","ᮩ"],["᮫","ᮭ"],"᯦",["ᯨ","ᯩ"],"ᯭ",["ᯯ","ᯱ"],["ᰬ","ᰳ"],["ᰶ","᰷"],["᳐","᳒"],["᳔","᳠"],["᳢","᳨"],"᳭","᳴",["᳸","᳹"],["᷀","᷵"],["᷼","᷿"],["⃐","⃜"],"⃡",["⃥","⃰"],["⳯","⳱"],"⵿",["ⷠ","ⷿ"],["〪","〭"],["゙","゚"],"꙯",["ꙴ","꙽"],["ꚞ","ꚟ"],["꛰","꛱"],"ꠂ","꠆","ꠋ",["ꠥ","ꠦ"],"꣄",["꣠","꣱"],["ꤦ","꤭"],["ꥇ","ꥑ"],["ꦀ","ꦂ"],"꦳",["ꦶ","ꦹ"],"ꦼ","ꧥ",["ꨩ","ꨮ"],["ꨱ","ꨲ"],["ꨵ","ꨶ"],"ꩃ","ꩌ","ꩼ","ꪰ",["ꪲ","ꪴ"],["ꪷ","ꪸ"],["ꪾ","꪿"],"꫁",["ꫬ","ꫭ"],"꫶","ꯥ","ꯨ","꯭","ﬞ",["︀","️"],["︠","︯"]],!1,!1),xu=Jt([["0","9"],["٠","٩"],["۰","۹"],["߀","߉"],["०","९"],["০","৯"],["੦","੯"],["૦","૯"],["୦","୯"],["௦","௯"],["౦","౯"],["೦","೯"],["൦","൯"],["෦","෯"],["๐","๙"],["໐","໙"],["༠","༩"],["၀","၉"],["႐","႙"],["០","៩"],["᠐","᠙"],["᥆","᥏"],["᧐","᧙"],["᪀","᪉"],["᪐","᪙"],["᭐","᭙"],["᮰","᮹"],["᱀","᱉"],["᱐","᱙"],["꘠","꘩"],["꣐","꣙"],["꤀","꤉"],["꧐","꧙"],["꧰","꧹"],["꩐","꩙"],["꯰","꯹"],["0","9"]],!1,!1),wu=Jt([["ᛮ","ᛰ"],["Ⅰ","ↂ"],["ↅ","ↈ"],"〇",["〡","〩"],["〸","〺"],["ꛦ","ꛯ"]],!1,!1),_u=Jt(["_",["‿","⁀"],"⁔",["︳","︴"],["﹍","﹏"],"_"],!1,!1),$u=Jt([" "," "," ",[" "," "]," "," "," "],!1,!1),Fu=Bt(";",!1),Su=function($,nt,lt){return{type:"grammar",topLevelInitializer:$,initializer:nt,rules:lt,location:Wt()}},Du=function($){return{type:"top_level_initializer",code:$[0],codeLocation:$[1],location:Wt()}},Bu=function($){return{type:"initializer",code:$[0],codeLocation:$[1],location:Wt()}},bu=function($,nt,lt){return{type:"rule",name:$[0],nameLocation:$[1],expression:nt!==null?{type:"named",name:nt,expression:lt,location:Wt()}:lt,location:Wt()}},ku=function($,nt){return nt.length>0?{type:"choice",alternatives:[$].concat(nt),location:Wt()}:$},Ru=function($,nt){return nt!==null?{type:"action",expression:$,code:nt[0],codeLocation:nt[1],location:Wt()}:$},Tu=function($,nt){return nt.length>0||$.type==="labeled"&&$.pick?{type:"sequence",elements:[$].concat(nt),location:Wt()}:$},Pu=function($,nt,lt){return lt.type.startsWith("semantic_")&&ur('"@" cannot be used on a semantic predicate',$),{type:"labeled",label:nt!==null?nt[0]:null,labelLocation:nt!==null?nt[1]:$,pick:!0,expression:lt,location:Wt()}},Iu=function($,nt){return{type:"labeled",label:$[0],labelLocation:$[1],expression:nt,location:Wt()}},Lu=function(){return Wt()},Nu=function($){return Go.indexOf($[0])>=0&&ur(`Label can't be a reserved word "${$[0]}"`,$[1]),$},Ou=function($,nt){return{type:OPS_TO_PREFIXED_TYPES[$],expression:nt,location:Wt()}},Mu=function($,nt){return{type:OPS_TO_SUFFIXED_TYPES[nt],expression:$,location:Wt()}},ju=function($){return $.type==="labeled"||$.type==="sequence"?{type:"group",expression:$,location:Wt()}:$},Vu=function($){return{type:"rule_ref",name:$[0],location:Wt()}},Uu=function($,nt){return{type:OPS_TO_SEMANTIC_PREDICATE_TYPES[$],code:nt[0],codeLocation:nt[1],location:Wt()}},Hu=function($,nt){return[$+nt.join(""),Wt()]},zu=function($,nt){return{type:"literal",value:$,ignoreCase:nt!==null,location:Wt()}},Gu=function($){return $.join("")},Wu=function($){return $.join("")},Ku=function($,nt,lt){return{type:"class",parts:nt.filter(st=>st!==""),inverted:$!==null,ignoreCase:lt!==null,location:Wt()}},Yu=function($,nt){return $.charCodeAt(0)>nt.charCodeAt(0)&&ur("Invalid character range: "+oo()+"."),[$,nt]},Xu=function(){return""},Zu=function(){return"\0"},Qu=function(){return"\b"},Ju=function(){return"\f"},qu=function(){return` +`},_i=function(){return"\r"},eo=function(){return" "},to=function(){return"\v"},no=function($){return String.fromCharCode(parseInt($,16))},ro=function($){return String.fromCharCode(parseInt($,16))},uo=function(){return{type:"any",location:Wt()}},io=function($){return[$,Wt()]},j=0,Lt=0,Wn=[{line:1,column:1}],sn=0,rr=[],pt=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 oo(){return e.substring(Lt,j)}function Wt(){return Yn(Lt,j)}function ur($,nt){throw nt=nt!==void 0?nt:Yn(Lt,j),lo($,nt)}function Bt($,nt){return{type:"literal",text:$,ignoreCase:nt}}function Jt($,nt,lt){return{type:"class",parts:$,inverted:nt,ignoreCase:lt}}function ao(){return{type:"any"}}function so(){return{type:"end"}}function pn($){return{type:"other",description:$}}function yr($){var nt=Wn[$],lt;if(nt)return nt;for(lt=$-1;!Wn[lt];)lt--;for(nt=Wn[lt],nt={line:nt.line,column:nt.column};lt<$;)e.charCodeAt(lt)===10?(nt.line++,nt.column=1):nt.column++,lt++;return Wn[$]=nt,nt}function Yn($,nt){var lt=yr($),st=yr(nt);return{source:a,start:{offset:$,line:lt.line,column:lt.column},end:{offset:nt,line:st.line,column:st.column}}}function yt($){jsn&&(sn=j,rr=[]),rr.push($))}function lo($,nt){return new peg$SyntaxError($,null,null,nt)}function co($,nt,lt){return new peg$SyntaxError(peg$SyntaxError.buildMessage($,nt),$,nt,lt)}function Ar(){var $,nt,lt,st,ht,At;if($=j,Ut(),nt=j,lt=fo(),lt!==o?(st=Ut(),nt=lt):(j=nt,nt=o),nt===o&&(nt=null),lt=j,st=po(),st!==o?(ht=Ut(),lt=st):(j=lt,lt=o),lt===o&&(lt=null),st=[],ht=j,At=Cr(),At!==o?(Ut(),ht=At):(j=ht,ht=o),ht!==o)for(;ht!==o;)st.push(ht),ht=j,At=Cr(),At!==o?(Ut(),ht=At):(j=ht,ht=o);else st=o;return st!==o?(Lt=$,$=Su(nt,lt,st)):(j=$,$=o),$}function fo(){var $,nt,lt,st,ht;return $=j,e.charCodeAt(j)===123?(nt=d,j++):(nt=o,pt===0&&yt(It)),nt!==o?(lt=Jn(),lt!==o?(e.charCodeAt(j)===125?(st=h,j++):(st=o,pt===0&&yt(jt)),st!==o?(ht=pr(),ht!==o?(Lt=$,$=Du(lt)):(j=$,$=o)):(j=$,$=o)):(j=$,$=o)):(j=$,$=o),$}function po(){var $,nt,lt;return $=j,nt=Jn(),nt!==o?(lt=pr(),lt!==o?(Lt=$,$=Bu(nt)):(j=$,$=o)):(j=$,$=o),$}function Cr(){var $,nt,lt,st,ht,At;return $=j,nt=sr(),nt!==o?(Ut(),lt=j,st=lr(),st!==o?(Ut(),lt=st):(j=lt,lt=o),lt===o&&(lt=null),e.charCodeAt(j)===61?(st=g,j++):(st=o,pt===0&&yt(qt)),st!==o?(Ut(),ht=xr(),ht!==o?(At=pr(),At!==o?(Lt=$,$=bu(nt,lt,ht)):(j=$,$=o)):(j=$,$=o)):(j=$,$=o)):(j=$,$=o),$}function xr(){var $,nt,lt,st,ht,At;if($=j,nt=ir(),nt!==o){for(lt=[],st=j,Ut(),e.charCodeAt(j)===47?(ht=_,j++):(ht=o,pt===0&&yt(en)),ht!==o?(Ut(),At=ir(),At!==o?st=At:(j=st,st=o)):(j=st,st=o);st!==o;)lt.push(st),st=j,Ut(),e.charCodeAt(j)===47?(ht=_,j++):(ht=o,pt===0&&yt(en)),ht!==o?(Ut(),At=ir(),At!==o?st=At:(j=st,st=o)):(j=st,st=o);Lt=$,$=ku(nt,lt)}else j=$,$=o;return $}function ir(){var $,nt,lt,st;return $=j,nt=ho(),nt!==o?(lt=j,Ut(),st=Jn(),st!==o?lt=st:(j=lt,lt=o),lt===o&&(lt=null),Lt=$,$=Ru(nt,lt)):(j=$,$=o),$}function ho(){var $,nt,lt,st,ht;if($=j,nt=or(),nt!==o){for(lt=[],st=j,Ut(),ht=or(),ht!==o?st=ht:(j=st,st=o);st!==o;)lt.push(st),st=j,Ut(),ht=or(),ht!==o?st=ht:(j=st,st=o);Lt=$,$=Tu(nt,lt)}else j=$,$=o;return $}function or(){var $,nt,lt,st;return $=j,nt=go(),nt!==o?(lt=wr(),lt===o&&(lt=null),st=ar(),st!==o?(Lt=$,$=Pu(nt,lt,st)):(j=$,$=o)):(j=$,$=o),$===o&&($=j,nt=wr(),nt!==o?(lt=Ut(),st=ar(),st!==o?(Lt=$,$=Iu(nt,st)):(j=$,$=o)):(j=$,$=o),$===o&&($=ar())),$}function go(){var $,nt;return $=j,e.charCodeAt(j)===64?(nt=b,j++):(nt=o,pt===0&&yt(En)),nt!==o&&(Lt=$,nt=Lu()),$=nt,$}function wr(){var $,nt,lt;return $=j,nt=sr(),nt!==o?(Ut(),e.charCodeAt(j)===58?(lt=et,j++):(lt=o,pt===0&&yt(wn)),lt!==o?(Lt=$,$=Nu(nt)):(j=$,$=o)):(j=$,$=o),$}function ar(){var $,nt,lt;return $=j,nt=mo(),nt!==o?(Ut(),lt=_r(),lt!==o?(Lt=$,$=Ou(nt,lt)):(j=$,$=o)):(j=$,$=o),$===o&&($=_r()),$}function mo(){var $;return e.charCodeAt(j)===36?($=_e,j++):($=o,pt===0&&yt(yn)),$===o&&(e.charCodeAt(j)===38?($=it,j++):($=o,pt===0&&yt(cn)),$===o&&(e.charCodeAt(j)===33?($=ct,j++):($=o,pt===0&&yt(_n)))),$}function _r(){var $,nt,lt;return $=j,nt=$r(),nt!==o?(Ut(),lt=vo(),lt!==o?(Lt=$,$=Mu(nt,lt)):(j=$,$=o)):(j=$,$=o),$===o&&($=$r()),$}function vo(){var $;return e.charCodeAt(j)===63?($=ot,j++):($=o,pt===0&&yt(Xt)),$===o&&(e.charCodeAt(j)===42?($=dt,j++):($=o,pt===0&&yt(rn)),$===o&&(e.charCodeAt(j)===43?($=ut,j++):($=o,pt===0&&yt(fn)))),$}function $r(){var $,nt,lt,st;return $=_o(),$===o&&($=$o(),$===o&&($=bo(),$===o&&($=Eo(),$===o&&($=yo(),$===o&&($=j,e.charCodeAt(j)===40?(nt=tt,j++):(nt=o,pt===0&&yt($n)),nt!==o?(Ut(),lt=xr(),lt!==o?(Ut(),e.charCodeAt(j)===41?(st=rt,j++):(st=o,pt===0&&yt(Pn)),st!==o?(Lt=$,$=ju(lt)):(j=$,$=o)):(j=$,$=o)):(j=$,$=o)))))),$}function Eo(){var $,nt,lt,st,ht,At,nn,Dn;return $=j,nt=sr(),nt!==o?(lt=j,pt++,st=j,ht=Ut(),At=j,nn=lr(),nn!==o?(Dn=Ut(),nn=[nn,Dn],At=nn):(j=At,At=o),At===o&&(At=null),e.charCodeAt(j)===61?(nn=g,j++):(nn=o,pt===0&&yt(qt)),nn!==o?(ht=[ht,At,nn],st=ht):(j=st,st=o),pt--,st===o?lt=void 0:(j=lt,lt=o),lt!==o?(Lt=$,$=Vu(nt)):(j=$,$=o)):(j=$,$=o),$}function yo(){var $,nt,lt;return $=j,nt=Ao(),nt!==o?(Ut(),lt=Jn(),lt!==o?(Lt=$,$=Uu(nt,lt)):(j=$,$=o)):(j=$,$=o),$}function Ao(){var $;return e.charCodeAt(j)===38?($=it,j++):($=o,pt===0&&yt(cn)),$===o&&(e.charCodeAt(j)===33?($=ct,j++):($=o,pt===0&&yt(_n))),$}function tn(){var $;return e.length>j?($=e.charAt(j),j++):($=o,pt===0&&yt(Vn)),$}function Xn(){var $;return pt++,e.charCodeAt(j)===9?($=at,j++):($=o,pt===0&&yt(an)),$===o&&(e.charCodeAt(j)===11?($=ft,j++):($=o,pt===0&&yt(In)),$===o&&(e.charCodeAt(j)===12?($=vt,j++):($=o,pt===0&&yt(Un)),$===o&&(e.charCodeAt(j)===32?($=mt,j++):($=o,pt===0&&yt(nr)),$===o&&(e.charCodeAt(j)===160?($=xt,j++):($=o,pt===0&&yt(Nr)),$===o&&(e.charCodeAt(j)===65279?($=kt,j++):($=o,pt===0&&yt(Or)),$===o&&($=Uo())))))),pt--,$===o&&pt===0&&yt(tr),$}function hn(){var $;return Mn.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&yt(Mr)),$}function Zn(){var $;return pt++,e.charCodeAt(j)===10?($=Ft,j++):($=o,pt===0&&yt(Vr)),$===o&&(e.substr(j,2)===Mt?($=Mt,j+=2):($=o,pt===0&&yt(Ur)),$===o&&(e.charCodeAt(j)===13?($=Pt,j++):($=o,pt===0&&yt(Hr)),$===o&&(e.charCodeAt(j)===8232?($=Ht,j++):($=o,pt===0&&yt(zr)),$===o&&(e.charCodeAt(j)===8233?($=Kt,j++):($=o,pt===0&&yt(Gr)))))),pt--,$===o&&pt===0&&yt(jr),$}function Fr(){var $;return pt++,$=Co(),$===o&&($=Dr()),pt--,$===o&&pt===0&&yt(Wr),$}function Co(){var $,nt,lt,st,ht,At;if($=j,e.substr(j,2)===Yt?(nt=Yt,j+=2):(nt=o,pt===0&&yt(hr)),nt!==o){for(lt=[],st=j,ht=j,pt++,e.substr(j,2)===zt?(At=zt,j+=2):(At=o,pt===0&&yt(Fn)),pt--,At===o?ht=void 0:(j=ht,ht=o),ht!==o?(At=tn(),At!==o?(ht=[ht,At],st=ht):(j=st,st=o)):(j=st,st=o);st!==o;)lt.push(st),st=j,ht=j,pt++,e.substr(j,2)===zt?(At=zt,j+=2):(At=o,pt===0&&yt(Fn)),pt--,At===o?ht=void 0:(j=ht,ht=o),ht!==o?(At=tn(),At!==o?(ht=[ht,At],st=ht):(j=st,st=o)):(j=st,st=o);e.substr(j,2)===zt?(st=zt,j+=2):(st=o,pt===0&&yt(Fn)),st!==o?(nt=[nt,lt,st],$=nt):(j=$,$=o)}else j=$,$=o;return $}function Sr(){var $,nt,lt,st,ht,At;if($=j,e.substr(j,2)===Yt?(nt=Yt,j+=2):(nt=o,pt===0&&yt(hr)),nt!==o){for(lt=[],st=j,ht=j,pt++,e.substr(j,2)===zt?(At=zt,j+=2):(At=o,pt===0&&yt(Fn)),At===o&&(At=hn()),pt--,At===o?ht=void 0:(j=ht,ht=o),ht!==o?(At=tn(),At!==o?(ht=[ht,At],st=ht):(j=st,st=o)):(j=st,st=o);st!==o;)lt.push(st),st=j,ht=j,pt++,e.substr(j,2)===zt?(At=zt,j+=2):(At=o,pt===0&&yt(Fn)),At===o&&(At=hn()),pt--,At===o?ht=void 0:(j=ht,ht=o),ht!==o?(At=tn(),At!==o?(ht=[ht,At],st=ht):(j=st,st=o)):(j=st,st=o);e.substr(j,2)===zt?(st=zt,j+=2):(st=o,pt===0&&yt(Fn)),st!==o?(nt=[nt,lt,st],$=nt):(j=$,$=o)}else j=$,$=o;return $}function Dr(){var $,nt,lt,st,ht,At;if($=j,e.substr(j,2)===Vt?(nt=Vt,j+=2):(nt=o,pt===0&&yt(Kr)),nt!==o){for(lt=[],st=j,ht=j,pt++,At=hn(),pt--,At===o?ht=void 0:(j=ht,ht=o),ht!==o?(At=tn(),At!==o?(ht=[ht,At],st=ht):(j=st,st=o)):(j=st,st=o);st!==o;)lt.push(st),st=j,ht=j,pt++,At=hn(),pt--,At===o?ht=void 0:(j=ht,ht=o),ht!==o?(At=tn(),At!==o?(ht=[ht,At],st=ht):(j=st,st=o)):(j=st,st=o);nt=[nt,lt],$=nt}else j=$,$=o;return $}function sr(){var $,nt,lt,st;if(pt++,$=j,nt=Br(),nt!==o){for(lt=[],st=br();st!==o;)lt.push(st),st=br();Lt=$,$=Hu(nt,lt)}else j=$,$=o;return pt--,$===o&&(nt=o,pt===0&&yt(Yr)),$}function Br(){var $,nt,lt;return $=xo(),$===o&&(e.charCodeAt(j)===36?($=_e,j++):($=o,pt===0&&yt(yn)),$===o&&(e.charCodeAt(j)===95?($=wt,j++):($=o,pt===0&&yt(Xr)),$===o&&($=j,e.charCodeAt(j)===92?(nt=St,j++):(nt=o,pt===0&&yt(dn)),nt!==o?(lt=Ir(),lt!==o?$=lt:(j=$,$=o)):(j=$,$=o)))),$}function br(){var $;return $=Br(),$===o&&($=wo(),$===o&&($=Mo(),$===o&&($=Vo(),$===o&&(e.charCodeAt(j)===8204?($=Tt,j++):($=o,pt===0&&yt(Zr)),$===o&&(e.charCodeAt(j)===8205?($=Ot,j++):($=o,pt===0&&yt(Qr))))))),$}function xo(){var $;return $=Lo(),$===o&&($=Ro(),$===o&&($=Io(),$===o&&($=To(),$===o&&($=Po(),$===o&&($=jo()))))),$}function wo(){var $;return $=Oo(),$===o&&($=No()),$}function _o(){var $,nt,lt;return pt++,$=j,nt=lr(),nt!==o?(e.charCodeAt(j)===105?(lt=Gt,j++):(lt=o,pt===0&&yt(gr)),lt===o&&(lt=null),Lt=$,$=zu(nt,lt)):(j=$,$=o),pt--,$===o&&(nt=o,pt===0&&yt(Jr)),$}function lr(){var $,nt,lt,st;if(pt++,$=j,e.charCodeAt(j)===34?(nt=un,j++):(nt=o,pt===0&&yt(Hn)),nt!==o){for(lt=[],st=kr();st!==o;)lt.push(st),st=kr();e.charCodeAt(j)===34?(st=un,j++):(st=o,pt===0&&yt(Hn)),st!==o?(Lt=$,$=Gu(lt)):(j=$,$=o)}else j=$,$=o;if($===o)if($=j,e.charCodeAt(j)===39?(nt=Qt,j++):(nt=o,pt===0&&yt(zn)),nt!==o){for(lt=[],st=Rr();st!==o;)lt.push(st),st=Rr();e.charCodeAt(j)===39?(st=Qt,j++):(st=o,pt===0&&yt(zn)),st!==o?(Lt=$,$=Wu(lt)):(j=$,$=o)}else j=$,$=o;return pt--,$===o&&(nt=o,pt===0&&yt(qr)),$}function kr(){var $,nt,lt,st;return $=j,nt=j,lt=j,pt++,e.charCodeAt(j)===34?(st=un,j++):(st=o,pt===0&&yt(Hn)),st===o&&(e.charCodeAt(j)===92?(st=St,j++):(st=o,pt===0&&yt(dn)),st===o&&(st=hn())),pt--,st===o?lt=void 0:(j=lt,lt=o),lt!==o?(st=tn(),st!==o?(lt=[lt,st],nt=lt):(j=nt,nt=o)):(j=nt,nt=o),nt!==o?$=e.substring($,j):$=nt,$===o&&($=j,e.charCodeAt(j)===92?(nt=St,j++):(nt=o,pt===0&&yt(dn)),nt!==o?(lt=fr(),lt!==o?$=lt:(j=$,$=o)):(j=$,$=o),$===o&&($=cr())),$}function Rr(){var $,nt,lt,st;return $=j,nt=j,lt=j,pt++,e.charCodeAt(j)===39?(st=Qt,j++):(st=o,pt===0&&yt(zn)),st===o&&(e.charCodeAt(j)===92?(st=St,j++):(st=o,pt===0&&yt(dn)),st===o&&(st=hn())),pt--,st===o?lt=void 0:(j=lt,lt=o),lt!==o?(st=tn(),st!==o?(lt=[lt,st],nt=lt):(j=nt,nt=o)):(j=nt,nt=o),nt!==o?$=e.substring($,j):$=nt,$===o&&($=j,e.charCodeAt(j)===92?(nt=St,j++):(nt=o,pt===0&&yt(dn)),nt!==o?(lt=fr(),lt!==o?$=lt:(j=$,$=o)):(j=$,$=o),$===o&&($=cr())),$}function $o(){var $,nt,lt,st,ht,At;if(pt++,$=j,e.charCodeAt(j)===91?(nt=gn,j++):(nt=o,pt===0&&yt(tu)),nt!==o){for(e.charCodeAt(j)===94?(lt=on,j++):(lt=o,pt===0&&yt(nu)),lt===o&&(lt=null),st=[],ht=Tr(),ht===o&&(ht=Qn());ht!==o;)st.push(ht),ht=Tr(),ht===o&&(ht=Qn());e.charCodeAt(j)===93?(ht=ln,j++):(ht=o,pt===0&&yt(mr)),ht!==o?(e.charCodeAt(j)===105?(At=Gt,j++):(At=o,pt===0&&yt(gr)),At===o&&(At=null),Lt=$,$=Ku(lt,st,At)):(j=$,$=o)}else j=$,$=o;return pt--,$===o&&(nt=o,pt===0&&yt(eu)),$}function Tr(){var $,nt,lt,st;return $=j,nt=Qn(),nt!==o?(e.charCodeAt(j)===45?(lt=mn,j++):(lt=o,pt===0&&yt(ru)),lt!==o?(st=Qn(),st!==o?(Lt=$,$=Yu(nt,st)):(j=$,$=o)):(j=$,$=o)):(j=$,$=o),$}function Qn(){var $,nt,lt,st;return $=j,nt=j,lt=j,pt++,e.charCodeAt(j)===93?(st=ln,j++):(st=o,pt===0&&yt(mr)),st===o&&(e.charCodeAt(j)===92?(st=St,j++):(st=o,pt===0&&yt(dn)),st===o&&(st=hn())),pt--,st===o?lt=void 0:(j=lt,lt=o),lt!==o?(st=tn(),st!==o?(lt=[lt,st],nt=lt):(j=nt,nt=o)):(j=nt,nt=o),nt!==o?$=e.substring($,j):$=nt,$===o&&($=j,e.charCodeAt(j)===92?(nt=St,j++):(nt=o,pt===0&&yt(dn)),nt!==o?(lt=fr(),lt!==o?$=lt:(j=$,$=o)):(j=$,$=o),$===o&&($=cr())),$}function cr(){var $,nt,lt;return $=j,e.charCodeAt(j)===92?(nt=St,j++):(nt=o,pt===0&&yt(dn)),nt!==o?(lt=Zn(),lt!==o?(Lt=$,$=Xu()):(j=$,$=o)):(j=$,$=o),$}function fr(){var $,nt,lt,st;return $=Fo(),$===o&&($=j,e.charCodeAt(j)===48?(nt=Ln,j++):(nt=o,pt===0&&yt(uu)),nt!==o?(lt=j,pt++,st=Lr(),pt--,st===o?lt=void 0:(j=lt,lt=o),lt!==o?(Lt=$,$=Zu()):(j=$,$=o)):(j=$,$=o),$===o&&($=Bo(),$===o&&($=Ir()))),$}function Fo(){var $;return $=Pr(),$===o&&($=So()),$}function Pr(){var $,nt;return e.charCodeAt(j)===39?($=Qt,j++):($=o,pt===0&&yt(zn)),$===o&&(e.charCodeAt(j)===34?($=un,j++):($=o,pt===0&&yt(Hn)),$===o&&(e.charCodeAt(j)===92?($=St,j++):($=o,pt===0&&yt(dn)),$===o&&($=j,e.charCodeAt(j)===98?(nt=Bn,j++):(nt=o,pt===0&&yt(iu)),nt!==o&&(Lt=$,nt=Qu()),$=nt,$===o&&($=j,e.charCodeAt(j)===102?(nt=bn,j++):(nt=o,pt===0&&yt(ou)),nt!==o&&(Lt=$,nt=Ju()),$=nt,$===o&&($=j,e.charCodeAt(j)===110?(nt=kn,j++):(nt=o,pt===0&&yt(au)),nt!==o&&(Lt=$,nt=qu()),$=nt,$===o&&($=j,e.charCodeAt(j)===114?(nt=An,j++):(nt=o,pt===0&&yt(su)),nt!==o&&(Lt=$,nt=_i()),$=nt,$===o&&($=j,e.charCodeAt(j)===116?(nt=Nn,j++):(nt=o,pt===0&&yt(lu)),nt!==o&&(Lt=$,nt=eo()),$=nt,$===o&&($=j,e.charCodeAt(j)===118?(nt=qn,j++):(nt=o,pt===0&&yt(cu)),nt!==o&&(Lt=$,nt=to()),$=nt)))))))),$}function So(){var $,nt,lt,st;return $=j,nt=j,lt=j,pt++,st=Do(),st===o&&(st=hn()),pt--,st===o?lt=void 0:(j=lt,lt=o),lt!==o?(st=tn(),st!==o?(lt=[lt,st],nt=lt):(j=nt,nt=o)):(j=nt,nt=o),nt!==o?$=e.substring($,j):$=nt,$}function Do(){var $;return $=Pr(),$===o&&($=Lr(),$===o&&(e.charCodeAt(j)===120?($=Rn,j++):($=o,pt===0&&yt(vr)),$===o&&(e.charCodeAt(j)===117?($=On,j++):($=o,pt===0&&yt(Er))))),$}function Bo(){var $,nt,lt,st,ht,At;return $=j,e.charCodeAt(j)===120?(nt=Rn,j++):(nt=o,pt===0&&yt(vr)),nt!==o?(lt=j,st=j,ht=Sn(),ht!==o?(At=Sn(),At!==o?(ht=[ht,At],st=ht):(j=st,st=o)):(j=st,st=o),st!==o?lt=e.substring(lt,j):lt=st,lt!==o?(Lt=$,$=no(lt)):(j=$,$=o)):(j=$,$=o),$}function Ir(){var $,nt,lt,st,ht,At,nn,Dn;return $=j,e.charCodeAt(j)===117?(nt=On,j++):(nt=o,pt===0&&yt(Er)),nt!==o?(lt=j,st=j,ht=Sn(),ht!==o?(At=Sn(),At!==o?(nn=Sn(),nn!==o?(Dn=Sn(),Dn!==o?(ht=[ht,At,nn,Dn],st=ht):(j=st,st=o)):(j=st,st=o)):(j=st,st=o)):(j=st,st=o),st!==o?lt=e.substring(lt,j):lt=st,lt!==o?(Lt=$,$=ro(lt)):(j=$,$=o)):(j=$,$=o),$}function Lr(){var $;return Tn.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&yt(fu)),$}function Sn(){var $;return er.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&yt(du)),$}function bo(){var $,nt;return $=j,e.charCodeAt(j)===46?(nt=vn,j++):(nt=o,pt===0&&yt(pu)),nt!==o&&(Lt=$,nt=uo()),$=nt,$}function Jn(){var $,nt,lt,st;return pt++,$=j,e.charCodeAt(j)===123?(nt=d,j++):(nt=o,pt===0&&yt(It)),nt!==o?(lt=ko(),e.charCodeAt(j)===125?(st=h,j++):(st=o,pt===0&&yt(jt)),st!==o?$=lt:(j=$,$=o)):(j=$,$=o),pt--,$===o&&(nt=o,pt===0&&yt(hu)),$}function ko(){var $,nt;return $=j,nt=dr(),Lt=$,nt=io(nt),$=nt,$}function dr(){var $,nt,lt,st,ht,At;if($=j,nt=[],lt=[],st=j,ht=j,pt++,xn.test(e.charAt(j))?(At=e.charAt(j),j++):(At=o,pt===0&&yt(Gn)),pt--,At===o?ht=void 0:(j=ht,ht=o),ht!==o?(At=tn(),At!==o?(ht=[ht,At],st=ht):(j=st,st=o)):(j=st,st=o),st!==o)for(;st!==o;)lt.push(st),st=j,ht=j,pt++,xn.test(e.charAt(j))?(At=e.charAt(j),j++):(At=o,pt===0&&yt(Gn)),pt--,At===o?ht=void 0:(j=ht,ht=o),ht!==o?(At=tn(),At!==o?(ht=[ht,At],st=ht):(j=st,st=o)):(j=st,st=o);else lt=o;for(lt===o&&(lt=j,e.charCodeAt(j)===123?(st=d,j++):(st=o,pt===0&&yt(It)),st!==o?(ht=dr(),e.charCodeAt(j)===125?(At=h,j++):(At=o,pt===0&&yt(jt)),At!==o?(st=[st,ht,At],lt=st):(j=lt,lt=o)):(j=lt,lt=o));lt!==o;){if(nt.push(lt),lt=[],st=j,ht=j,pt++,xn.test(e.charAt(j))?(At=e.charAt(j),j++):(At=o,pt===0&&yt(Gn)),pt--,At===o?ht=void 0:(j=ht,ht=o),ht!==o?(At=tn(),At!==o?(ht=[ht,At],st=ht):(j=st,st=o)):(j=st,st=o),st!==o)for(;st!==o;)lt.push(st),st=j,ht=j,pt++,xn.test(e.charAt(j))?(At=e.charAt(j),j++):(At=o,pt===0&&yt(Gn)),pt--,At===o?ht=void 0:(j=ht,ht=o),ht!==o?(At=tn(),At!==o?(ht=[ht,At],st=ht):(j=st,st=o)):(j=st,st=o);else lt=o;lt===o&&(lt=j,e.charCodeAt(j)===123?(st=d,j++):(st=o,pt===0&&yt(It)),st!==o?(ht=dr(),e.charCodeAt(j)===125?(At=h,j++):(At=o,pt===0&&yt(jt)),At!==o?(st=[st,ht,At],lt=st):(j=lt,lt=o)):(j=lt,lt=o))}return $=e.substring($,j),$}function Ro(){var $;return jn.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&yt(gu)),$}function To(){var $;return gt.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&yt(mu)),$}function Po(){var $;return Et.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&yt(vu)),$}function Io(){var $;return Ct.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&yt(Eu)),$}function Lo(){var $;return $t.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&yt(yu)),$}function No(){var $;return _t.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&yt(Au)),$}function Oo(){var $;return Rt.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&yt(Cu)),$}function Mo(){var $;return bt.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&yt(xu)),$}function jo(){var $;return Nt.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&yt(wu)),$}function Vo(){var $;return Dt.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&yt(_u)),$}function Uo(){var $;return Zt.test(e.charAt(j))?($=e.charAt(j),j++):($=o,pt===0&&yt($u)),$}function Ut(){var $,nt;for($=[],nt=Xn(),nt===o&&(nt=Zn(),nt===o&&(nt=Fr()));nt!==o;)$.push(nt),nt=Xn(),nt===o&&(nt=Zn(),nt===o&&(nt=Fr()));return $}function Ho(){var $,nt;for($=[],nt=Xn(),nt===o&&(nt=Sr());nt!==o;)$.push(nt),nt=Xn(),nt===o&&(nt=Sr());return $}function pr(){var $,nt,lt,st;return $=j,nt=Ut(),e.charCodeAt(j)===59?(lt=Cn,j++):(lt=o,pt===0&&yt(Fu)),lt!==o?(nt=[nt,lt],$=nt):(j=$,$=o),$===o&&($=j,nt=Ho(),lt=Dr(),lt===o&&(lt=null),st=Zn(),st!==o?(nt=[nt,lt,st],$=nt):(j=$,$=o),$===o&&($=j,nt=Ut(),lt=zo(),lt!==o?(nt=[nt,lt],$=nt):(j=$,$=o))),$}function zo(){var $,nt;return $=j,pt++,e.length>j?(nt=e.charAt(j),j++):(nt=o,pt===0&&yt(Vn)),pt--,nt===o?$=void 0:(j=$,$=o),$}const Go=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/IG1vcmVTdGF0ZW1lbnRzOihFT0wgXyBAc3RhdGVtZW50KSogRU9MPyBfCnsKICBjb25zdCBzdGF0ZW1lbnRzID0gc3RhdGVtZW50ID8gW3N0YXRlbWVudCwgLi4ubW9yZVN0YXRlbWVudHNdIDogbW9yZVN0YXRlbWVudHM7CiAgcmV0dXJuIHsKICAgIHN0YXRlbWVudHM6IHN0YXRlbWVudHMKICB9Owp9CgpzdGF0ZW1lbnQgPSBjb21tZW50TGluZSAvIGxhYmVsU3RhdGVtZW50IC8gY2F1c2VTdGF0ZW1lbnQKCmNvbW1lbnRMaW5lID0gXyAiIyIgdGV4dDooW15cblxyXSopCnsKICByZXR1cm4gewogICAgdHlwZTogImNvbW1lbnQiLAogICAgdGV4dDogdGV4dC5qb2luKCIiKQogIH07Cn0KCmxhYmVsU3RhdGVtZW50ID0gXyB0eXBlOigiQyIgLyAiVURFIiAvICJERSIgLyAiRk9MIikgX18gaWRlbnQ6aWRlbnQgX18gImlzIiBfXyBzdHI6c3RyaW5nCiAgewogICAgcmV0dXJuIHsKICAgICAgdHlwZSwKICAgICAgaWQ6IGlkZW50LAogICAgICB0ZXh0OiBzdHIKICAgIH07CiAgfQpjYXVzZVN0YXRlbWVudCA9IF8gIGlkZW50czppZGVudExpc3QgX18gImNhdXNlIiAicyI/IF9fIGVmZmVjdElkOmlkZW50CiAgewogICAgcmV0dXJuIHsKICAgICAgdHlwZTogImNhdXNlIiwKICAgICAgY2F1c2VzOiBpZGVudHMsCiAgICAgIGVmZmVjdElkOiBlZmZlY3RJZAogICAgfTsKICB9CgppZGVudExpc3QKICA9IGlkZW50OmlkZW50IHRhaWw6KF9fICJhbmQiIF9fIEBpZGVudCkqCiAgewogICAgcmV0dXJuIFtpZGVudCwgLi4udGFpbF07CiAgfQoKaWRlbnQgPSBpZDooW2EtekEtWjAtOV0rKQp7IHJldHVybiBpZC5qb2luKCIiKTsgfQoKc3RyaW5nID0gIlwiIiB0ZXh0OihbXiJdKikgIlwiIgp7IHJldHVybiB0ZXh0LmpvaW4oIiIpOyB9CgpwZXJjZW50YWdlIAogICAgPSBfIGRpZ2l0czooWzAtOV0rKSIlIiBfIHsgcmV0dXJuIG1ha2VJbnRlZ2VyKGRpZ2l0cyk7IH0KICAKCkVPTAogID0gWyBcdF0qIFtcblxyXSsKCl8gIm9wdGlvbmFsIHdoaXRlc3BhY2UiCiAgPSBbIFx0XSoKCl9fICJ3aGl0ZXNwYWNlIgogID0gWyBcdF0r",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=[];return e.statements.filter(a=>a.type==="UDE"||a.type==="DE"||a.type==="FOL").forEach(a=>{i.set(a.id,{annotation:a.type,key:a.id,label:a.text})}),e.statements.filter(a=>a.type==="C").forEach(a=>{i.set(a.id,{key:a.id,label:a.text})}),e.statements.filter(a=>a.type==="cause").forEach(a=>{const s=a.effectId;let c=s;if(a.causes.length>1){const d=a.causes.join("_")+"_cause_"+s;c=d,i.set(d,{key:d,label:"AND",intermediate:!0}),o.push({from:d,to:s})}for(const d of a.causes){if(!i.has(d))throw new Error(`Cause ${d} not declared`);if(!i.has(s))throw new Error(`Effect ${s} not declared`);o.push({from:d,to:c})}}),{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 Ko(); diff --git a/index.html b/index.html index a9f5ab2..25a09b4 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ TOC-Lang (Preview) - +