@meetploy/emulator 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,176 +0,0 @@
1
- var Rx=i=>{throw TypeError(i)};var Um=(i,e,t)=>e.has(i)||Rx("Cannot "+t);var R=(i,e,t)=>(Um(i,e,"read from private field"),t?t.call(i):e.get(i)),ye=(i,e,t)=>e.has(i)?Rx("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,t),oe=(i,e,t,n)=>(Um(i,e,"write to private field"),n?n.call(i,t):e.set(i,t),t),Te=(i,e,t)=>(Um(i,e,"access private method"),t);var Ic=(i,e,t,n)=>({set _(r){oe(i,e,r,t)},get _(){return R(i,e,n)}});function qO(i,e){for(var t=0;t<e.length;t++){const n=e[t];if(typeof n!="string"&&!Array.isArray(n)){for(const r in n)if(r!=="default"&&!(r in i)){const a=Object.getOwnPropertyDescriptor(n,r);a&&Object.defineProperty(i,r,a.get?a:{enumerable:!0,get:()=>n[r]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))n(r);new MutationObserver(r=>{for(const a of r)if(a.type==="childList")for(const o of a.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&n(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const a={};return r.integrity&&(a.integrity=r.integrity),r.referrerPolicy&&(a.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?a.credentials="include":r.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function n(r){if(r.ep)return;r.ep=!0;const a=t(r);fetch(r.href,a)}})();function VO(i){return i&&i.__esModule&&Object.prototype.hasOwnProperty.call(i,"default")?i.default:i}var Pm={exports:{}},No={};/**
2
- * @license React
3
- * react-jsx-runtime.production.js
4
- *
5
- * Copyright (c) Meta Platforms, Inc. and affiliates.
6
- *
7
- * This source code is licensed under the MIT license found in the
8
- * LICENSE file in the root directory of this source tree.
9
- */var Dx;function QO(){if(Dx)return No;Dx=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(n,r,a){var o=null;if(a!==void 0&&(o=""+a),r.key!==void 0&&(o=""+r.key),"key"in r){a={};for(var c in r)c!=="key"&&(a[c]=r[c])}else a=r;return r=a.ref,{$$typeof:i,type:n,key:o,ref:r!==void 0?r:null,props:a}}return No.Fragment=e,No.jsx=t,No.jsxs=t,No}var Nx;function IO(){return Nx||(Nx=1,Pm.exports=QO()),Pm.exports}var S=IO(),ka=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(i){return this.listeners.add(i),this.onSubscribe(),()=>{this.listeners.delete(i),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},Xr=typeof window>"u"||"Deno"in globalThis;function Pn(){}function GO(i,e){return typeof i=="function"?i(e):i}function Tp(i){return typeof i=="number"&&i>=0&&i!==1/0}function cw(i,e){return Math.max(i+(e||0)-Date.now(),0)}function Xl(i,e){return typeof i=="function"?i(e):i}function ti(i,e){return typeof i=="function"?i(e):i}function Bx(i,e){const{type:t="all",exact:n,fetchStatus:r,predicate:a,queryKey:o,stale:c}=i;if(o){if(n){if(e.queryHash!==Ug(o,e.options))return!1}else if(!Jo(e.queryKey,o))return!1}if(t!=="all"){const h=e.isActive();if(t==="active"&&!h||t==="inactive"&&h)return!1}return!(typeof c=="boolean"&&e.isStale()!==c||r&&r!==e.state.fetchStatus||a&&!a(e))}function Lx(i,e){const{exact:t,status:n,predicate:r,mutationKey:a}=i;if(a){if(!e.options.mutationKey)return!1;if(t){if(Wr(e.options.mutationKey)!==Wr(a))return!1}else if(!Jo(e.options.mutationKey,a))return!1}return!(n&&e.state.status!==n||r&&!r(e))}function Ug(i,e){return((e==null?void 0:e.queryKeyHashFn)||Wr)(i)}function Wr(i){return JSON.stringify(i,(e,t)=>Op(t)?Object.keys(t).sort().reduce((n,r)=>(n[r]=t[r],n),{}):t)}function Jo(i,e){return i===e?!0:typeof i!=typeof e?!1:i&&e&&typeof i=="object"&&typeof e=="object"?Object.keys(e).every(t=>Jo(i[t],e[t])):!1}function fw(i,e){if(i===e)return i;const t=jx(i)&&jx(e);if(t||Op(i)&&Op(e)){const n=t?i:Object.keys(i),r=n.length,a=t?e:Object.keys(e),o=a.length,c=t?[]:{};let h=0;for(let d=0;d<o;d++){const p=t?d:a[d];(!t&&n.includes(p)||t)&&i[p]===void 0&&e[p]===void 0?(c[p]=void 0,h++):(c[p]=fw(i[p],e[p]),c[p]===i[p]&&i[p]!==void 0&&h++)}return r===o&&h===r?i:c}return e}function Ef(i,e){if(!e||Object.keys(i).length!==Object.keys(e).length)return!1;for(const t in i)if(i[t]!==e[t])return!1;return!0}function jx(i){return Array.isArray(i)&&i.length===Object.keys(i).length}function Op(i){if(!zx(i))return!1;const e=i.constructor;if(e===void 0)return!0;const t=e.prototype;return!(!zx(t)||!t.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(i)!==Object.prototype)}function zx(i){return Object.prototype.toString.call(i)==="[object Object]"}function FO(i){return new Promise(e=>{setTimeout(e,i)})}function Mp(i,e,t){return typeof t.structuralSharing=="function"?t.structuralSharing(i,e):t.structuralSharing!==!1?fw(i,e):e}function YO(i,e,t=0){const n=[...i,e];return t&&n.length>t?n.slice(1):n}function KO(i,e,t=0){const n=[e,...i];return t&&n.length>t?n.slice(0,-1):n}var Pg=Symbol();function hw(i,e){return!i.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!i.queryFn||i.queryFn===Pg?()=>Promise.reject(new Error(`Missing queryFn: '${i.queryHash}'`)):i.queryFn}var Ur,Is,na,ew,XO=(ew=class extends ka{constructor(){super();ye(this,Ur);ye(this,Is);ye(this,na);oe(this,na,e=>{if(!Xr&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}})}onSubscribe(){R(this,Is)||this.setEventListener(R(this,na))}onUnsubscribe(){var e;this.hasListeners()||((e=R(this,Is))==null||e.call(this),oe(this,Is,void 0))}setEventListener(e){var t;oe(this,na,e),(t=R(this,Is))==null||t.call(this),oe(this,Is,e(n=>{typeof n=="boolean"?this.setFocused(n):this.onFocus()}))}setFocused(e){R(this,Ur)!==e&&(oe(this,Ur,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){var e;return typeof R(this,Ur)=="boolean"?R(this,Ur):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Ur=new WeakMap,Is=new WeakMap,na=new WeakMap,ew),qg=new XO,ia,Gs,sa,tw,WO=(tw=class extends ka{constructor(){super();ye(this,ia,!0);ye(this,Gs);ye(this,sa);oe(this,sa,e=>{if(!Xr&&window.addEventListener){const t=()=>e(!0),n=()=>e(!1);return window.addEventListener("online",t,!1),window.addEventListener("offline",n,!1),()=>{window.removeEventListener("online",t),window.removeEventListener("offline",n)}}})}onSubscribe(){R(this,Gs)||this.setEventListener(R(this,sa))}onUnsubscribe(){var e;this.hasListeners()||((e=R(this,Gs))==null||e.call(this),oe(this,Gs,void 0))}setEventListener(e){var t;oe(this,sa,e),(t=R(this,Gs))==null||t.call(this),oe(this,Gs,e(this.setOnline.bind(this)))}setOnline(e){R(this,ia)!==e&&(oe(this,ia,e),this.listeners.forEach(n=>{n(e)}))}isOnline(){return R(this,ia)}},ia=new WeakMap,Gs=new WeakMap,sa=new WeakMap,tw),Rf=new WO;function Ep(){let i,e;const t=new Promise((r,a)=>{i=r,e=a});t.status="pending",t.catch(()=>{});function n(r){Object.assign(t,r),delete t.resolve,delete t.reject}return t.resolve=r=>{n({status:"fulfilled",value:r}),i(r)},t.reject=r=>{n({status:"rejected",reason:r}),e(r)},t}function $O(i){return Math.min(1e3*2**i,3e4)}function dw(i){return(i??"online")==="online"?Rf.isOnline():!0}var mw=class extends Error{constructor(i){super("CancelledError"),this.revert=i==null?void 0:i.revert,this.silent=i==null?void 0:i.silent}};function qm(i){return i instanceof mw}function pw(i){let e=!1,t=0,n=!1,r;const a=Ep(),o=k=>{var A;n||(b(new mw(k)),(A=i.abort)==null||A.call(i))},c=()=>{e=!0},h=()=>{e=!1},d=()=>qg.isFocused()&&(i.networkMode==="always"||Rf.isOnline())&&i.canRun(),p=()=>dw(i.networkMode)&&i.canRun(),y=k=>{var A;n||(n=!0,(A=i.onSuccess)==null||A.call(i,k),r==null||r(),a.resolve(k))},b=k=>{var A;n||(n=!0,(A=i.onError)==null||A.call(i,k),r==null||r(),a.reject(k))},v=()=>new Promise(k=>{var A;r=O=>{(n||d())&&k(O)},(A=i.onPause)==null||A.call(i)}).then(()=>{var k;r=void 0,n||(k=i.onContinue)==null||k.call(i)}),w=()=>{if(n)return;let k;const A=t===0?i.initialPromise:void 0;try{k=A??i.fn()}catch(O){k=Promise.reject(O)}Promise.resolve(k).then(y).catch(O=>{var Q;if(n)return;const D=i.retry??(Xr?0:3),B=i.retryDelay??$O,V=typeof B=="function"?B(t,O):B,j=D===!0||typeof D=="number"&&t<D||typeof D=="function"&&D(t,O);if(e||!j){b(O);return}t++,(Q=i.onFail)==null||Q.call(i,t,O),FO(V).then(()=>d()?void 0:v()).then(()=>{e?b(O):w()})})};return{promise:a,cancel:o,continue:()=>(r==null||r(),a),cancelRetry:c,continueRetry:h,canStart:p,start:()=>(p()?w():v().then(w),a)}}var ZO=i=>setTimeout(i,0);function JO(){let i=[],e=0,t=c=>{c()},n=c=>{c()},r=ZO;const a=c=>{e?i.push(c):r(()=>{t(c)})},o=()=>{const c=i;i=[],c.length&&r(()=>{n(()=>{c.forEach(h=>{t(h)})})})};return{batch:c=>{let h;e++;try{h=c()}finally{e--,e||o()}return h},batchCalls:c=>(...h)=>{a(()=>{c(...h)})},schedule:a,setNotifyFunction:c=>{t=c},setBatchNotifyFunction:c=>{n=c},setScheduler:c=>{r=c}}}var xt=JO(),Pr,nw,gw=(nw=class{constructor(){ye(this,Pr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),Tp(this.gcTime)&&oe(this,Pr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(i){this.gcTime=Math.max(this.gcTime||0,i??(Xr?1/0:300*1e3))}clearGcTimeout(){R(this,Pr)&&(clearTimeout(R(this,Pr)),oe(this,Pr,void 0))}},Pr=new WeakMap,nw),ra,la,Un,qr,Pt,mu,Vr,Jn,Ki,iw,eM=(iw=class extends gw{constructor(e){super();ye(this,Jn);ye(this,ra);ye(this,la);ye(this,Un);ye(this,qr);ye(this,Pt);ye(this,mu);ye(this,Vr);oe(this,Vr,!1),oe(this,mu,e.defaultOptions),this.setOptions(e.options),this.observers=[],oe(this,qr,e.client),oe(this,Un,R(this,qr).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,oe(this,ra,tM(this.options)),this.state=e.state??R(this,ra),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=R(this,Pt))==null?void 0:e.promise}setOptions(e){this.options={...R(this,mu),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&R(this,Un).remove(this)}setData(e,t){const n=Mp(this.state.data,e,this.options);return Te(this,Jn,Ki).call(this,{data:n,type:"success",dataUpdatedAt:t==null?void 0:t.updatedAt,manual:t==null?void 0:t.manual}),n}setState(e,t){Te(this,Jn,Ki).call(this,{type:"setState",state:e,setStateOptions:t})}cancel(e){var n,r;const t=(n=R(this,Pt))==null?void 0:n.promise;return(r=R(this,Pt))==null||r.cancel(e),t?t.then(Pn).catch(Pn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(R(this,ra))}isActive(){return this.observers.some(e=>ti(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Pg||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!cw(this.state.dataUpdatedAt,e)}onFocus(){var t;const e=this.observers.find(n=>n.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(t=R(this,Pt))==null||t.continue()}onOnline(){var t;const e=this.observers.find(n=>n.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(t=R(this,Pt))==null||t.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),R(this,Un).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(R(this,Pt)&&(R(this,Vr)?R(this,Pt).cancel({revert:!0}):R(this,Pt).cancelRetry()),this.scheduleGc()),R(this,Un).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Te(this,Jn,Ki).call(this,{type:"invalidate"})}fetch(e,t){var h,d,p;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(t!=null&&t.cancelRefetch))this.cancel({silent:!0});else if(R(this,Pt))return R(this,Pt).continueRetry(),R(this,Pt).promise}if(e&&this.setOptions(e),!this.options.queryFn){const y=this.observers.find(b=>b.options.queryFn);y&&this.setOptions(y.options)}const n=new AbortController,r=y=>{Object.defineProperty(y,"signal",{enumerable:!0,get:()=>(oe(this,Vr,!0),n.signal)})},a=()=>{const y=hw(this.options,t),b={client:R(this,qr),queryKey:this.queryKey,meta:this.meta};return r(b),oe(this,Vr,!1),this.options.persister?this.options.persister(y,b,this):y(b)},o={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:R(this,qr),state:this.state,fetchFn:a};r(o),(h=this.options.behavior)==null||h.onFetch(o,this),oe(this,la,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((d=o.fetchOptions)==null?void 0:d.meta))&&Te(this,Jn,Ki).call(this,{type:"fetch",meta:(p=o.fetchOptions)==null?void 0:p.meta});const c=y=>{var b,v,w,k;qm(y)&&y.silent||Te(this,Jn,Ki).call(this,{type:"error",error:y}),qm(y)||((v=(b=R(this,Un).config).onError)==null||v.call(b,y,this),(k=(w=R(this,Un).config).onSettled)==null||k.call(w,this.state.data,y,this)),this.scheduleGc()};return oe(this,Pt,pw({initialPromise:t==null?void 0:t.initialPromise,fn:o.fetchFn,abort:n.abort.bind(n),onSuccess:y=>{var b,v,w,k;if(y===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(y)}catch(A){c(A);return}(v=(b=R(this,Un).config).onSuccess)==null||v.call(b,y,this),(k=(w=R(this,Un).config).onSettled)==null||k.call(w,y,this.state.error,this),this.scheduleGc()},onError:c,onFail:(y,b)=>{Te(this,Jn,Ki).call(this,{type:"failed",failureCount:y,error:b})},onPause:()=>{Te(this,Jn,Ki).call(this,{type:"pause"})},onContinue:()=>{Te(this,Jn,Ki).call(this,{type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0})),R(this,Pt).start()}},ra=new WeakMap,la=new WeakMap,Un=new WeakMap,qr=new WeakMap,Pt=new WeakMap,mu=new WeakMap,Vr=new WeakMap,Jn=new WeakSet,Ki=function(e){const t=n=>{switch(e.type){case"failed":return{...n,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...n,fetchStatus:"paused"};case"continue":return{...n,fetchStatus:"fetching"};case"fetch":return{...n,...yw(n.data,this.options),fetchMeta:e.meta??null};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const r=e.error;return qm(r)&&r.revert&&R(this,la)?{...R(this,la),fetchStatus:"idle"}:{...n,error:r,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),xt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),R(this,Un).notify({query:this,type:"updated",action:e})})},iw);function yw(i,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:dw(e.networkMode)?"fetching":"paused",...i===void 0&&{error:null,status:"pending"}}}function tM(i){const e=typeof i.initialData=="function"?i.initialData():i.initialData,t=e!==void 0,n=t?typeof i.initialDataUpdatedAt=="function"?i.initialDataUpdatedAt():i.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:t?n??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:t?"success":"pending",fetchStatus:"idle"}}var wi,sw,nM=(sw=class extends ka{constructor(e={}){super();ye(this,wi);this.config=e,oe(this,wi,new Map)}build(e,t,n){const r=t.queryKey,a=t.queryHash??Ug(r,t);let o=this.get(a);return o||(o=new eM({client:e,queryKey:r,queryHash:a,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(o)),o}add(e){R(this,wi).has(e.queryHash)||(R(this,wi).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=R(this,wi).get(e.queryHash);t&&(e.destroy(),t===e&&R(this,wi).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){xt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return R(this,wi).get(e)}getAll(){return[...R(this,wi).values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Bx(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>Bx(e,n)):t}notify(e){xt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){xt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){xt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},wi=new WeakMap,sw),ki,Ft,Qr,Ci,Hs,rw,iM=(rw=class extends gw{constructor(e){super();ye(this,Ci);ye(this,ki);ye(this,Ft);ye(this,Qr);this.mutationId=e.mutationId,oe(this,Ft,e.mutationCache),oe(this,ki,[]),this.state=e.state||bw(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){R(this,ki).includes(e)||(R(this,ki).push(e),this.clearGcTimeout(),R(this,Ft).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){oe(this,ki,R(this,ki).filter(t=>t!==e)),this.scheduleGc(),R(this,Ft).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){R(this,ki).length||(this.state.status==="pending"?this.scheduleGc():R(this,Ft).remove(this))}continue(){var e;return((e=R(this,Qr))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var a,o,c,h,d,p,y,b,v,w,k,A,O,D,B,V,j,Q,I,q;const t=()=>{Te(this,Ci,Hs).call(this,{type:"continue"})};oe(this,Qr,pw({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(Y,te)=>{Te(this,Ci,Hs).call(this,{type:"failed",failureCount:Y,error:te})},onPause:()=>{Te(this,Ci,Hs).call(this,{type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>R(this,Ft).canRun(this)}));const n=this.state.status==="pending",r=!R(this,Qr).canStart();try{if(n)t();else{Te(this,Ci,Hs).call(this,{type:"pending",variables:e,isPaused:r}),await((o=(a=R(this,Ft).config).onMutate)==null?void 0:o.call(a,e,this));const te=await((h=(c=this.options).onMutate)==null?void 0:h.call(c,e));te!==this.state.context&&Te(this,Ci,Hs).call(this,{type:"pending",context:te,variables:e,isPaused:r})}const Y=await R(this,Qr).start();return await((p=(d=R(this,Ft).config).onSuccess)==null?void 0:p.call(d,Y,e,this.state.context,this)),await((b=(y=this.options).onSuccess)==null?void 0:b.call(y,Y,e,this.state.context)),await((w=(v=R(this,Ft).config).onSettled)==null?void 0:w.call(v,Y,null,this.state.variables,this.state.context,this)),await((A=(k=this.options).onSettled)==null?void 0:A.call(k,Y,null,e,this.state.context)),Te(this,Ci,Hs).call(this,{type:"success",data:Y}),Y}catch(Y){try{throw await((D=(O=R(this,Ft).config).onError)==null?void 0:D.call(O,Y,e,this.state.context,this)),await((V=(B=this.options).onError)==null?void 0:V.call(B,Y,e,this.state.context)),await((Q=(j=R(this,Ft).config).onSettled)==null?void 0:Q.call(j,void 0,Y,this.state.variables,this.state.context,this)),await((q=(I=this.options).onSettled)==null?void 0:q.call(I,void 0,Y,e,this.state.context)),Y}finally{Te(this,Ci,Hs).call(this,{type:"error",error:Y})}}finally{R(this,Ft).runNext(this)}}},ki=new WeakMap,Ft=new WeakMap,Qr=new WeakMap,Ci=new WeakSet,Hs=function(e){const t=n=>{switch(e.type){case"failed":return{...n,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...n,isPaused:!0};case"continue":return{...n,isPaused:!1};case"pending":return{...n,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...n,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...n,data:void 0,error:e.error,failureCount:n.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=t(this.state),xt.batch(()=>{R(this,ki).forEach(n=>{n.onMutationUpdate(e)}),R(this,Ft).notify({mutation:this,type:"updated",action:e})})},rw);function bw(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Wi,ei,pu,lw,sM=(lw=class extends ka{constructor(e={}){super();ye(this,Wi);ye(this,ei);ye(this,pu);this.config=e,oe(this,Wi,new Set),oe(this,ei,new Map),oe(this,pu,0)}build(e,t,n){const r=new iM({mutationCache:this,mutationId:++Ic(this,pu)._,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){R(this,Wi).add(e);const t=Gc(e);if(typeof t=="string"){const n=R(this,ei).get(t);n?n.push(e):R(this,ei).set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(R(this,Wi).delete(e)){const t=Gc(e);if(typeof t=="string"){const n=R(this,ei).get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&R(this,ei).delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Gc(e);if(typeof t=="string"){const n=R(this,ei).get(t),r=n==null?void 0:n.find(a=>a.state.status==="pending");return!r||r===e}else return!0}runNext(e){var n;const t=Gc(e);if(typeof t=="string"){const r=(n=R(this,ei).get(t))==null?void 0:n.find(a=>a!==e&&a.state.isPaused);return(r==null?void 0:r.continue())??Promise.resolve()}else return Promise.resolve()}clear(){xt.batch(()=>{R(this,Wi).forEach(e=>{this.notify({type:"removed",mutation:e})}),R(this,Wi).clear(),R(this,ei).clear()})}getAll(){return Array.from(R(this,Wi))}find(e){const t={exact:!0,...e};return this.getAll().find(n=>Lx(t,n))}findAll(e={}){return this.getAll().filter(t=>Lx(e,t))}notify(e){xt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return xt.batch(()=>Promise.all(e.map(t=>t.continue().catch(Pn))))}},Wi=new WeakMap,ei=new WeakMap,pu=new WeakMap,lw);function Gc(i){var e;return(e=i.options.scope)==null?void 0:e.id}function _x(i){return{onFetch:(e,t)=>{var p,y,b,v,w;const n=e.options,r=(b=(y=(p=e.fetchOptions)==null?void 0:p.meta)==null?void 0:y.fetchMore)==null?void 0:b.direction,a=((v=e.state.data)==null?void 0:v.pages)||[],o=((w=e.state.data)==null?void 0:w.pageParams)||[];let c={pages:[],pageParams:[]},h=0;const d=async()=>{let k=!1;const A=B=>{Object.defineProperty(B,"signal",{enumerable:!0,get:()=>(e.signal.aborted?k=!0:e.signal.addEventListener("abort",()=>{k=!0}),e.signal)})},O=hw(e.options,e.fetchOptions),D=async(B,V,j)=>{if(k)return Promise.reject();if(V==null&&B.pages.length)return Promise.resolve(B);const Q={client:e.client,queryKey:e.queryKey,pageParam:V,direction:j?"backward":"forward",meta:e.options.meta};A(Q);const I=await O(Q),{maxPages:q}=e.options,Y=j?KO:YO;return{pages:Y(B.pages,I,q),pageParams:Y(B.pageParams,V,q)}};if(r&&a.length){const B=r==="backward",V=B?rM:Hx,j={pages:a,pageParams:o},Q=V(n,j);c=await D(j,Q,B)}else{const B=i??a.length;do{const V=h===0?o[0]??n.initialPageParam:Hx(n,c);if(h>0&&V==null)break;c=await D(c,V),h++}while(h<B)}return c};e.options.persister?e.fetchFn=()=>{var k,A;return(A=(k=e.options).persister)==null?void 0:A.call(k,d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},t)}:e.fetchFn=d}}}function Hx(i,{pages:e,pageParams:t}){const n=e.length-1;return e.length>0?i.getNextPageParam(e[n],e,t[n],t):void 0}function rM(i,{pages:e,pageParams:t}){var n;return e.length>0?(n=i.getPreviousPageParam)==null?void 0:n.call(i,e[0],e,t[0],t):void 0}var at,Fs,Ys,aa,oa,Ks,ua,ca,aw,lM=(aw=class{constructor(i={}){ye(this,at);ye(this,Fs);ye(this,Ys);ye(this,aa);ye(this,oa);ye(this,Ks);ye(this,ua);ye(this,ca);oe(this,at,i.queryCache||new nM),oe(this,Fs,i.mutationCache||new sM),oe(this,Ys,i.defaultOptions||{}),oe(this,aa,new Map),oe(this,oa,new Map),oe(this,Ks,0)}mount(){Ic(this,Ks)._++,R(this,Ks)===1&&(oe(this,ua,qg.subscribe(async i=>{i&&(await this.resumePausedMutations(),R(this,at).onFocus())})),oe(this,ca,Rf.subscribe(async i=>{i&&(await this.resumePausedMutations(),R(this,at).onOnline())})))}unmount(){var i,e;Ic(this,Ks)._--,R(this,Ks)===0&&((i=R(this,ua))==null||i.call(this),oe(this,ua,void 0),(e=R(this,ca))==null||e.call(this),oe(this,ca,void 0))}isFetching(i){return R(this,at).findAll({...i,fetchStatus:"fetching"}).length}isMutating(i){return R(this,Fs).findAll({...i,status:"pending"}).length}getQueryData(i){var t;const e=this.defaultQueryOptions({queryKey:i});return(t=R(this,at).get(e.queryHash))==null?void 0:t.state.data}ensureQueryData(i){const e=this.defaultQueryOptions(i),t=R(this,at).build(this,e),n=t.state.data;return n===void 0?this.fetchQuery(i):(i.revalidateIfStale&&t.isStaleByTime(Xl(e.staleTime,t))&&this.prefetchQuery(e),Promise.resolve(n))}getQueriesData(i){return R(this,at).findAll(i).map(({queryKey:e,state:t})=>{const n=t.data;return[e,n]})}setQueryData(i,e,t){const n=this.defaultQueryOptions({queryKey:i}),r=R(this,at).get(n.queryHash),a=r==null?void 0:r.state.data,o=GO(e,a);if(o!==void 0)return R(this,at).build(this,n).setData(o,{...t,manual:!0})}setQueriesData(i,e,t){return xt.batch(()=>R(this,at).findAll(i).map(({queryKey:n})=>[n,this.setQueryData(n,e,t)]))}getQueryState(i){var t;const e=this.defaultQueryOptions({queryKey:i});return(t=R(this,at).get(e.queryHash))==null?void 0:t.state}removeQueries(i){const e=R(this,at);xt.batch(()=>{e.findAll(i).forEach(t=>{e.remove(t)})})}resetQueries(i,e){const t=R(this,at);return xt.batch(()=>(t.findAll(i).forEach(n=>{n.reset()}),this.refetchQueries({type:"active",...i},e)))}cancelQueries(i,e={}){const t={revert:!0,...e},n=xt.batch(()=>R(this,at).findAll(i).map(r=>r.cancel(t)));return Promise.all(n).then(Pn).catch(Pn)}invalidateQueries(i,e={}){return xt.batch(()=>(R(this,at).findAll(i).forEach(t=>{t.invalidate()}),(i==null?void 0:i.refetchType)==="none"?Promise.resolve():this.refetchQueries({...i,type:(i==null?void 0:i.refetchType)??(i==null?void 0:i.type)??"active"},e)))}refetchQueries(i,e={}){const t={...e,cancelRefetch:e.cancelRefetch??!0},n=xt.batch(()=>R(this,at).findAll(i).filter(r=>!r.isDisabled()).map(r=>{let a=r.fetch(void 0,t);return t.throwOnError||(a=a.catch(Pn)),r.state.fetchStatus==="paused"?Promise.resolve():a}));return Promise.all(n).then(Pn)}fetchQuery(i){const e=this.defaultQueryOptions(i);e.retry===void 0&&(e.retry=!1);const t=R(this,at).build(this,e);return t.isStaleByTime(Xl(e.staleTime,t))?t.fetch(e):Promise.resolve(t.state.data)}prefetchQuery(i){return this.fetchQuery(i).then(Pn).catch(Pn)}fetchInfiniteQuery(i){return i.behavior=_x(i.pages),this.fetchQuery(i)}prefetchInfiniteQuery(i){return this.fetchInfiniteQuery(i).then(Pn).catch(Pn)}ensureInfiniteQueryData(i){return i.behavior=_x(i.pages),this.ensureQueryData(i)}resumePausedMutations(){return Rf.isOnline()?R(this,Fs).resumePausedMutations():Promise.resolve()}getQueryCache(){return R(this,at)}getMutationCache(){return R(this,Fs)}getDefaultOptions(){return R(this,Ys)}setDefaultOptions(i){oe(this,Ys,i)}setQueryDefaults(i,e){R(this,aa).set(Wr(i),{queryKey:i,defaultOptions:e})}getQueryDefaults(i){const e=[...R(this,aa).values()],t={};return e.forEach(n=>{Jo(i,n.queryKey)&&Object.assign(t,n.defaultOptions)}),t}setMutationDefaults(i,e){R(this,oa).set(Wr(i),{mutationKey:i,defaultOptions:e})}getMutationDefaults(i){const e=[...R(this,oa).values()],t={};return e.forEach(n=>{Jo(i,n.mutationKey)&&Object.assign(t,n.defaultOptions)}),t}defaultQueryOptions(i){if(i._defaulted)return i;const e={...R(this,Ys).queries,...this.getQueryDefaults(i.queryKey),...i,_defaulted:!0};return e.queryHash||(e.queryHash=Ug(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Pg&&(e.enabled=!1),e}defaultMutationOptions(i){return i!=null&&i._defaulted?i:{...R(this,Ys).mutations,...(i==null?void 0:i.mutationKey)&&this.getMutationDefaults(i.mutationKey),...i,_defaulted:!0}}clear(){R(this,at).clear(),R(this,Fs).clear()}},at=new WeakMap,Fs=new WeakMap,Ys=new WeakMap,aa=new WeakMap,oa=new WeakMap,Ks=new WeakMap,ua=new WeakMap,ca=new WeakMap,aw),sn,je,gu,Yt,Ir,fa,Xs,Ws,yu,ha,da,Gr,Fr,$s,ma,qe,Vo,Rp,Dp,Np,Bp,Lp,jp,zp,vw,ow,aM=(ow=class extends ka{constructor(e,t){super();ye(this,qe);ye(this,sn);ye(this,je);ye(this,gu);ye(this,Yt);ye(this,Ir);ye(this,fa);ye(this,Xs);ye(this,Ws);ye(this,yu);ye(this,ha);ye(this,da);ye(this,Gr);ye(this,Fr);ye(this,$s);ye(this,ma,new Set);this.options=t,oe(this,sn,e),oe(this,Ws,null),oe(this,Xs,Ep()),this.options.experimental_prefetchInRender||R(this,Xs).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(R(this,je).addObserver(this),Ux(R(this,je),this.options)?Te(this,qe,Vo).call(this):this.updateResult(),Te(this,qe,Bp).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return _p(R(this,je),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return _p(R(this,je),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Te(this,qe,Lp).call(this),Te(this,qe,jp).call(this),R(this,je).removeObserver(this)}setOptions(e){const t=this.options,n=R(this,je);if(this.options=R(this,sn).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof ti(this.options.enabled,R(this,je))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Te(this,qe,zp).call(this),R(this,je).setOptions(this.options),t._defaulted&&!Ef(this.options,t)&&R(this,sn).getQueryCache().notify({type:"observerOptionsUpdated",query:R(this,je),observer:this});const r=this.hasListeners();r&&Px(R(this,je),n,this.options,t)&&Te(this,qe,Vo).call(this),this.updateResult(),r&&(R(this,je)!==n||ti(this.options.enabled,R(this,je))!==ti(t.enabled,R(this,je))||Xl(this.options.staleTime,R(this,je))!==Xl(t.staleTime,R(this,je)))&&Te(this,qe,Rp).call(this);const a=Te(this,qe,Dp).call(this);r&&(R(this,je)!==n||ti(this.options.enabled,R(this,je))!==ti(t.enabled,R(this,je))||a!==R(this,$s))&&Te(this,qe,Np).call(this,a)}getOptimisticResult(e){const t=R(this,sn).getQueryCache().build(R(this,sn),e),n=this.createResult(t,e);return uM(this,n)&&(oe(this,Yt,n),oe(this,fa,this.options),oe(this,Ir,R(this,je).state)),n}getCurrentResult(){return R(this,Yt)}trackResult(e,t){const n={};return Object.keys(e).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(r),t==null||t(r),e[r])})}),n}trackProp(e){R(this,ma).add(e)}getCurrentQuery(){return R(this,je)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=R(this,sn).defaultQueryOptions(e),n=R(this,sn).getQueryCache().build(R(this,sn),t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return Te(this,qe,Vo).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),R(this,Yt)))}createResult(e,t){var Y;const n=R(this,je),r=this.options,a=R(this,Yt),o=R(this,Ir),c=R(this,fa),d=e!==n?e.state:R(this,gu),{state:p}=e;let y={...p},b=!1,v;if(t._optimisticResults){const te=this.hasListeners(),le=!te&&Ux(e,t),ne=te&&Px(e,n,t,r);(le||ne)&&(y={...y,...yw(p.data,e.options)}),t._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:w,errorUpdatedAt:k,status:A}=y;v=y.data;let O=!1;if(t.placeholderData!==void 0&&v===void 0&&A==="pending"){let te;a!=null&&a.isPlaceholderData&&t.placeholderData===(c==null?void 0:c.placeholderData)?(te=a.data,O=!0):te=typeof t.placeholderData=="function"?t.placeholderData((Y=R(this,da))==null?void 0:Y.state.data,R(this,da)):t.placeholderData,te!==void 0&&(A="success",v=Mp(a==null?void 0:a.data,te,t),b=!0)}if(t.select&&v!==void 0&&!O)if(a&&v===(o==null?void 0:o.data)&&t.select===R(this,yu))v=R(this,ha);else try{oe(this,yu,t.select),v=t.select(v),v=Mp(a==null?void 0:a.data,v,t),oe(this,ha,v),oe(this,Ws,null)}catch(te){oe(this,Ws,te)}R(this,Ws)&&(w=R(this,Ws),v=R(this,ha),k=Date.now(),A="error");const D=y.fetchStatus==="fetching",B=A==="pending",V=A==="error",j=B&&D,Q=v!==void 0,q={status:A,fetchStatus:y.fetchStatus,isPending:B,isSuccess:A==="success",isError:V,isInitialLoading:j,isLoading:j,data:v,dataUpdatedAt:y.dataUpdatedAt,error:w,errorUpdatedAt:k,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:y.dataUpdateCount>0||y.errorUpdateCount>0,isFetchedAfterMount:y.dataUpdateCount>d.dataUpdateCount||y.errorUpdateCount>d.errorUpdateCount,isFetching:D,isRefetching:D&&!B,isLoadingError:V&&!Q,isPaused:y.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:V&&Q,isStale:Vg(e,t),refetch:this.refetch,promise:R(this,Xs)};if(this.options.experimental_prefetchInRender){const te=xe=>{q.status==="error"?xe.reject(q.error):q.data!==void 0&&xe.resolve(q.data)},le=()=>{const xe=oe(this,Xs,q.promise=Ep());te(xe)},ne=R(this,Xs);switch(ne.status){case"pending":e.queryHash===n.queryHash&&te(ne);break;case"fulfilled":(q.status==="error"||q.data!==ne.value)&&le();break;case"rejected":(q.status!=="error"||q.error!==ne.reason)&&le();break}}return q}updateResult(){const e=R(this,Yt),t=this.createResult(R(this,je),this.options);if(oe(this,Ir,R(this,je).state),oe(this,fa,this.options),R(this,Ir).data!==void 0&&oe(this,da,R(this,je)),Ef(t,e))return;oe(this,Yt,t);const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,a=typeof r=="function"?r():r;if(a==="all"||!a&&!R(this,ma).size)return!0;const o=new Set(a??R(this,ma));return this.options.throwOnError&&o.add("error"),Object.keys(R(this,Yt)).some(c=>{const h=c;return R(this,Yt)[h]!==e[h]&&o.has(h)})};Te(this,qe,vw).call(this,{listeners:n()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Te(this,qe,Bp).call(this)}},sn=new WeakMap,je=new WeakMap,gu=new WeakMap,Yt=new WeakMap,Ir=new WeakMap,fa=new WeakMap,Xs=new WeakMap,Ws=new WeakMap,yu=new WeakMap,ha=new WeakMap,da=new WeakMap,Gr=new WeakMap,Fr=new WeakMap,$s=new WeakMap,ma=new WeakMap,qe=new WeakSet,Vo=function(e){Te(this,qe,zp).call(this);let t=R(this,je).fetch(this.options,e);return e!=null&&e.throwOnError||(t=t.catch(Pn)),t},Rp=function(){Te(this,qe,Lp).call(this);const e=Xl(this.options.staleTime,R(this,je));if(Xr||R(this,Yt).isStale||!Tp(e))return;const n=cw(R(this,Yt).dataUpdatedAt,e)+1;oe(this,Gr,setTimeout(()=>{R(this,Yt).isStale||this.updateResult()},n))},Dp=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(R(this,je)):this.options.refetchInterval)??!1},Np=function(e){Te(this,qe,jp).call(this),oe(this,$s,e),!(Xr||ti(this.options.enabled,R(this,je))===!1||!Tp(R(this,$s))||R(this,$s)===0)&&oe(this,Fr,setInterval(()=>{(this.options.refetchIntervalInBackground||qg.isFocused())&&Te(this,qe,Vo).call(this)},R(this,$s)))},Bp=function(){Te(this,qe,Rp).call(this),Te(this,qe,Np).call(this,Te(this,qe,Dp).call(this))},Lp=function(){R(this,Gr)&&(clearTimeout(R(this,Gr)),oe(this,Gr,void 0))},jp=function(){R(this,Fr)&&(clearInterval(R(this,Fr)),oe(this,Fr,void 0))},zp=function(){const e=R(this,sn).getQueryCache().build(R(this,sn),this.options);if(e===R(this,je))return;const t=R(this,je);oe(this,je,e),oe(this,gu,e.state),this.hasListeners()&&(t==null||t.removeObserver(this),e.addObserver(this))},vw=function(e){xt.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(R(this,Yt))}),R(this,sn).getQueryCache().notify({query:R(this,je),type:"observerResultsUpdated"})})},ow);function oM(i,e){return ti(e.enabled,i)!==!1&&i.state.data===void 0&&!(i.state.status==="error"&&e.retryOnMount===!1)}function Ux(i,e){return oM(i,e)||i.state.data!==void 0&&_p(i,e,e.refetchOnMount)}function _p(i,e,t){if(ti(e.enabled,i)!==!1){const n=typeof t=="function"?t(i):t;return n==="always"||n!==!1&&Vg(i,e)}return!1}function Px(i,e,t,n){return(i!==e||ti(n.enabled,i)===!1)&&(!t.suspense||i.state.status!=="error")&&Vg(i,t)}function Vg(i,e){return ti(e.enabled,i)!==!1&&i.isStaleByTime(Xl(e.staleTime,i))}function uM(i,e){return!Ef(i.getCurrentResult(),e)}var Zs,Js,rn,$i,is,gf,Hp,uw,cM=(uw=class extends ka{constructor(t,n){super();ye(this,is);ye(this,Zs);ye(this,Js);ye(this,rn);ye(this,$i);oe(this,Zs,t),this.setOptions(n),this.bindMethods(),Te(this,is,gf).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){var r;const n=this.options;this.options=R(this,Zs).defaultMutationOptions(t),Ef(this.options,n)||R(this,Zs).getMutationCache().notify({type:"observerOptionsUpdated",mutation:R(this,rn),observer:this}),n!=null&&n.mutationKey&&this.options.mutationKey&&Wr(n.mutationKey)!==Wr(this.options.mutationKey)?this.reset():((r=R(this,rn))==null?void 0:r.state.status)==="pending"&&R(this,rn).setOptions(this.options)}onUnsubscribe(){var t;this.hasListeners()||(t=R(this,rn))==null||t.removeObserver(this)}onMutationUpdate(t){Te(this,is,gf).call(this),Te(this,is,Hp).call(this,t)}getCurrentResult(){return R(this,Js)}reset(){var t;(t=R(this,rn))==null||t.removeObserver(this),oe(this,rn,void 0),Te(this,is,gf).call(this),Te(this,is,Hp).call(this)}mutate(t,n){var r;return oe(this,$i,n),(r=R(this,rn))==null||r.removeObserver(this),oe(this,rn,R(this,Zs).getMutationCache().build(R(this,Zs),this.options)),R(this,rn).addObserver(this),R(this,rn).execute(t)}},Zs=new WeakMap,Js=new WeakMap,rn=new WeakMap,$i=new WeakMap,is=new WeakSet,gf=function(){var n;const t=((n=R(this,rn))==null?void 0:n.state)??bw();oe(this,Js,{...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset})},Hp=function(t){xt.batch(()=>{var n,r,a,o,c,h,d,p;if(R(this,$i)&&this.hasListeners()){const y=R(this,Js).variables,b=R(this,Js).context;(t==null?void 0:t.type)==="success"?((r=(n=R(this,$i)).onSuccess)==null||r.call(n,t.data,y,b),(o=(a=R(this,$i)).onSettled)==null||o.call(a,t.data,null,y,b)):(t==null?void 0:t.type)==="error"&&((h=(c=R(this,$i)).onError)==null||h.call(c,t.error,y,b),(p=(d=R(this,$i)).onSettled)==null||p.call(d,void 0,t.error,y,b))}this.listeners.forEach(y=>{y(R(this,Js))})})},uw),Vm={exports:{}},Ae={};/**
10
- * @license React
11
- * react.production.js
12
- *
13
- * Copyright (c) Meta Platforms, Inc. and affiliates.
14
- *
15
- * This source code is licensed under the MIT license found in the
16
- * LICENSE file in the root directory of this source tree.
17
- */var qx;function fM(){if(qx)return Ae;qx=1;var i=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),n=Symbol.for("react.strict_mode"),r=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),o=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),y=Symbol.iterator;function b(E){return E===null||typeof E!="object"?null:(E=y&&E[y]||E["@@iterator"],typeof E=="function"?E:null)}var v={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,k={};function A(E,X,ie){this.props=E,this.context=X,this.refs=k,this.updater=ie||v}A.prototype.isReactComponent={},A.prototype.setState=function(E,X){if(typeof E!="object"&&typeof E!="function"&&E!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,E,X,"setState")},A.prototype.forceUpdate=function(E){this.updater.enqueueForceUpdate(this,E,"forceUpdate")};function O(){}O.prototype=A.prototype;function D(E,X,ie){this.props=E,this.context=X,this.refs=k,this.updater=ie||v}var B=D.prototype=new O;B.constructor=D,w(B,A.prototype),B.isPureReactComponent=!0;var V=Array.isArray,j={H:null,A:null,T:null,S:null,V:null},Q=Object.prototype.hasOwnProperty;function I(E,X,ie,Z,re,Ce){return ie=Ce.ref,{$$typeof:i,type:E,key:X,ref:ie!==void 0?ie:null,props:Ce}}function q(E,X){return I(E.type,X,void 0,void 0,void 0,E.props)}function Y(E){return typeof E=="object"&&E!==null&&E.$$typeof===i}function te(E){var X={"=":"=0",":":"=2"};return"$"+E.replace(/[=:]/g,function(ie){return X[ie]})}var le=/\/+/g;function ne(E,X){return typeof E=="object"&&E!==null&&E.key!=null?te(""+E.key):X.toString(36)}function xe(){}function ke(E){switch(E.status){case"fulfilled":return E.value;case"rejected":throw E.reason;default:switch(typeof E.status=="string"?E.then(xe,xe):(E.status="pending",E.then(function(X){E.status==="pending"&&(E.status="fulfilled",E.value=X)},function(X){E.status==="pending"&&(E.status="rejected",E.reason=X)})),E.status){case"fulfilled":return E.value;case"rejected":throw E.reason}}throw E}function me(E,X,ie,Z,re){var Ce=typeof E;(Ce==="undefined"||Ce==="boolean")&&(E=null);var be=!1;if(E===null)be=!0;else switch(Ce){case"bigint":case"string":case"number":be=!0;break;case"object":switch(E.$$typeof){case i:case e:be=!0;break;case p:return be=E._init,me(be(E._payload),X,ie,Z,re)}}if(be)return re=re(E),be=Z===""?"."+ne(E,0):Z,V(re)?(ie="",be!=null&&(ie=be.replace(le,"$&/")+"/"),me(re,X,ie,"",function(mn){return mn})):re!=null&&(Y(re)&&(re=q(re,ie+(re.key==null||E&&E.key===re.key?"":(""+re.key).replace(le,"$&/")+"/")+be)),X.push(re)),1;be=0;var Le=Z===""?".":Z+":";if(V(E))for(var Xe=0;Xe<E.length;Xe++)Z=E[Xe],Ce=Le+ne(Z,Xe),be+=me(Z,X,ie,Ce,re);else if(Xe=b(E),typeof Xe=="function")for(E=Xe.call(E),Xe=0;!(Z=E.next()).done;)Z=Z.value,Ce=Le+ne(Z,Xe++),be+=me(Z,X,ie,Ce,re);else if(Ce==="object"){if(typeof E.then=="function")return me(ke(E),X,ie,Z,re);throw X=String(E),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(E).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return be}function H(E,X,ie){if(E==null)return E;var Z=[],re=0;return me(E,Z,"","",function(Ce){return X.call(ie,Ce,re++)}),Z}function K(E){if(E._status===-1){var X=E._result;X=X(),X.then(function(ie){(E._status===0||E._status===-1)&&(E._status=1,E._result=ie)},function(ie){(E._status===0||E._status===-1)&&(E._status=2,E._result=ie)}),E._status===-1&&(E._status=0,E._result=X)}if(E._status===1)return E._result.default;throw E._result}var W=typeof reportError=="function"?reportError:function(E){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof E=="object"&&E!==null&&typeof E.message=="string"?String(E.message):String(E),error:E});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",E);return}console.error(E)};function ge(){}return Ae.Children={map:H,forEach:function(E,X,ie){H(E,function(){X.apply(this,arguments)},ie)},count:function(E){var X=0;return H(E,function(){X++}),X},toArray:function(E){return H(E,function(X){return X})||[]},only:function(E){if(!Y(E))throw Error("React.Children.only expected to receive a single React element child.");return E}},Ae.Component=A,Ae.Fragment=t,Ae.Profiler=r,Ae.PureComponent=D,Ae.StrictMode=n,Ae.Suspense=h,Ae.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=j,Ae.__COMPILER_RUNTIME={__proto__:null,c:function(E){return j.H.useMemoCache(E)}},Ae.cache=function(E){return function(){return E.apply(null,arguments)}},Ae.cloneElement=function(E,X,ie){if(E==null)throw Error("The argument must be a React element, but you passed "+E+".");var Z=w({},E.props),re=E.key,Ce=void 0;if(X!=null)for(be in X.ref!==void 0&&(Ce=void 0),X.key!==void 0&&(re=""+X.key),X)!Q.call(X,be)||be==="key"||be==="__self"||be==="__source"||be==="ref"&&X.ref===void 0||(Z[be]=X[be]);var be=arguments.length-2;if(be===1)Z.children=ie;else if(1<be){for(var Le=Array(be),Xe=0;Xe<be;Xe++)Le[Xe]=arguments[Xe+2];Z.children=Le}return I(E.type,re,void 0,void 0,Ce,Z)},Ae.createContext=function(E){return E={$$typeof:o,_currentValue:E,_currentValue2:E,_threadCount:0,Provider:null,Consumer:null},E.Provider=E,E.Consumer={$$typeof:a,_context:E},E},Ae.createElement=function(E,X,ie){var Z,re={},Ce=null;if(X!=null)for(Z in X.key!==void 0&&(Ce=""+X.key),X)Q.call(X,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(re[Z]=X[Z]);var be=arguments.length-2;if(be===1)re.children=ie;else if(1<be){for(var Le=Array(be),Xe=0;Xe<be;Xe++)Le[Xe]=arguments[Xe+2];re.children=Le}if(E&&E.defaultProps)for(Z in be=E.defaultProps,be)re[Z]===void 0&&(re[Z]=be[Z]);return I(E,Ce,void 0,void 0,null,re)},Ae.createRef=function(){return{current:null}},Ae.forwardRef=function(E){return{$$typeof:c,render:E}},Ae.isValidElement=Y,Ae.lazy=function(E){return{$$typeof:p,_payload:{_status:-1,_result:E},_init:K}},Ae.memo=function(E,X){return{$$typeof:d,type:E,compare:X===void 0?null:X}},Ae.startTransition=function(E){var X=j.T,ie={};j.T=ie;try{var Z=E(),re=j.S;re!==null&&re(ie,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(ge,W)}catch(Ce){W(Ce)}finally{j.T=X}},Ae.unstable_useCacheRefresh=function(){return j.H.useCacheRefresh()},Ae.use=function(E){return j.H.use(E)},Ae.useActionState=function(E,X,ie){return j.H.useActionState(E,X,ie)},Ae.useCallback=function(E,X){return j.H.useCallback(E,X)},Ae.useContext=function(E){return j.H.useContext(E)},Ae.useDebugValue=function(){},Ae.useDeferredValue=function(E,X){return j.H.useDeferredValue(E,X)},Ae.useEffect=function(E,X,ie){var Z=j.H;if(typeof ie=="function")throw Error("useEffect CRUD overload is not enabled in this build of React.");return Z.useEffect(E,X)},Ae.useId=function(){return j.H.useId()},Ae.useImperativeHandle=function(E,X,ie){return j.H.useImperativeHandle(E,X,ie)},Ae.useInsertionEffect=function(E,X){return j.H.useInsertionEffect(E,X)},Ae.useLayoutEffect=function(E,X){return j.H.useLayoutEffect(E,X)},Ae.useMemo=function(E,X){return j.H.useMemo(E,X)},Ae.useOptimistic=function(E,X){return j.H.useOptimistic(E,X)},Ae.useReducer=function(E,X,ie){return j.H.useReducer(E,X,ie)},Ae.useRef=function(E){return j.H.useRef(E)},Ae.useState=function(E){return j.H.useState(E)},Ae.useSyncExternalStore=function(E,X,ie){return j.H.useSyncExternalStore(E,X,ie)},Ae.useTransition=function(){return j.H.useTransition()},Ae.version="19.1.2",Ae}var Vx;function Qg(){return Vx||(Vx=1,Vm.exports=fM()),Vm.exports}var T=Qg();const Us=VO(T),xw=qO({__proto__:null,default:Us},[T]);var Sw=T.createContext(void 0),ww=i=>{const e=T.useContext(Sw);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},hM=({client:i,children:e})=>(T.useEffect(()=>(i.mount(),()=>{i.unmount()}),[i]),S.jsx(Sw.Provider,{value:i,children:e})),kw=T.createContext(!1),dM=()=>T.useContext(kw);kw.Provider;function mM(){let i=!1;return{clearReset:()=>{i=!1},reset:()=>{i=!0},isReset:()=>i}}var pM=T.createContext(mM()),gM=()=>T.useContext(pM);function Cw(i,e){return typeof i=="function"?i(...e):!!i}function Up(){}var yM=(i,e)=>{(i.suspense||i.throwOnError||i.experimental_prefetchInRender)&&(e.isReset()||(i.retryOnMount=!1))},bM=i=>{T.useEffect(()=>{i.clearReset()},[i])},vM=({result:i,errorResetBoundary:e,throwOnError:t,query:n,suspense:r})=>i.isError&&!e.isReset()&&!i.isFetching&&n&&(r&&i.data===void 0||Cw(t,[i.error,n])),xM=i=>{const e=i.staleTime;i.suspense&&(i.staleTime=typeof e=="function"?(...t)=>Math.max(e(...t),1e3):Math.max(e??1e3,1e3),typeof i.gcTime=="number"&&(i.gcTime=Math.max(i.gcTime,1e3)))},SM=(i,e)=>i.isLoading&&i.isFetching&&!e,wM=(i,e)=>(i==null?void 0:i.suspense)&&e.isPending,Qx=(i,e,t)=>e.fetchOptimistic(i).catch(()=>{t.clearReset()});function kM(i,e,t){var y,b,v,w,k;const n=ww(),r=dM(),a=gM(),o=n.defaultQueryOptions(i);(b=(y=n.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||b.call(y,o),o._optimisticResults=r?"isRestoring":"optimistic",xM(o),yM(o,a),bM(a);const c=!n.getQueryCache().get(o.queryHash),[h]=T.useState(()=>new e(n,o)),d=h.getOptimisticResult(o),p=!r&&i.subscribed!==!1;if(T.useSyncExternalStore(T.useCallback(A=>{const O=p?h.subscribe(xt.batchCalls(A)):Up;return h.updateResult(),O},[h,p]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),T.useEffect(()=>{h.setOptions(o)},[o,h]),wM(o,d))throw Qx(o,h,a);if(vM({result:d,errorResetBoundary:a,throwOnError:o.throwOnError,query:n.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw d.error;if((w=(v=n.getDefaultOptions().queries)==null?void 0:v._experimental_afterQuery)==null||w.call(v,o,d),o.experimental_prefetchInRender&&!Xr&&SM(d,r)){const A=c?Qx(o,h,a):(k=n.getQueryCache().get(o.queryHash))==null?void 0:k.promise;A==null||A.catch(Up).finally(()=>{h.updateResult()})}return o.notifyOnChangeProps?d:h.trackResult(d)}function Ei(i,e){return kM(i,aM)}function CM(i,e){const t=ww(),[n]=T.useState(()=>new cM(t,i));T.useEffect(()=>{n.setOptions(i)},[n,i]);const r=T.useSyncExternalStore(T.useCallback(o=>n.subscribe(xt.batchCalls(o)),[n]),()=>n.getCurrentResult(),()=>n.getCurrentResult()),a=T.useCallback((o,c)=>{n.mutate(o,c).catch(Up)},[n]);if(r.error&&Cw(n.options.throwOnError,[r.error]))throw r.error;return{...r,mutate:a,mutateAsync:r.mutate}}var Qm={exports:{}},Bo={},Im={exports:{}},Gm={};/**
18
- * @license React
19
- * scheduler.production.js
20
- *
21
- * Copyright (c) Meta Platforms, Inc. and affiliates.
22
- *
23
- * This source code is licensed under the MIT license found in the
24
- * LICENSE file in the root directory of this source tree.
25
- */var Ix;function AM(){return Ix||(Ix=1,(function(i){function e(H,K){var W=H.length;H.push(K);e:for(;0<W;){var ge=W-1>>>1,E=H[ge];if(0<r(E,K))H[ge]=K,H[W]=E,W=ge;else break e}}function t(H){return H.length===0?null:H[0]}function n(H){if(H.length===0)return null;var K=H[0],W=H.pop();if(W!==K){H[0]=W;e:for(var ge=0,E=H.length,X=E>>>1;ge<X;){var ie=2*(ge+1)-1,Z=H[ie],re=ie+1,Ce=H[re];if(0>r(Z,W))re<E&&0>r(Ce,Z)?(H[ge]=Ce,H[re]=W,ge=re):(H[ge]=Z,H[ie]=W,ge=ie);else if(re<E&&0>r(Ce,W))H[ge]=Ce,H[re]=W,ge=re;else break e}}return K}function r(H,K){var W=H.sortIndex-K.sortIndex;return W!==0?W:H.id-K.id}if(i.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;i.unstable_now=function(){return a.now()}}else{var o=Date,c=o.now();i.unstable_now=function(){return o.now()-c}}var h=[],d=[],p=1,y=null,b=3,v=!1,w=!1,k=!1,A=!1,O=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;function V(H){for(var K=t(d);K!==null;){if(K.callback===null)n(d);else if(K.startTime<=H)n(d),K.sortIndex=K.expirationTime,e(h,K);else break;K=t(d)}}function j(H){if(k=!1,V(H),!w)if(t(h)!==null)w=!0,Q||(Q=!0,ne());else{var K=t(d);K!==null&&me(j,K.startTime-H)}}var Q=!1,I=-1,q=5,Y=-1;function te(){return A?!0:!(i.unstable_now()-Y<q)}function le(){if(A=!1,Q){var H=i.unstable_now();Y=H;var K=!0;try{e:{w=!1,k&&(k=!1,D(I),I=-1),v=!0;var W=b;try{t:{for(V(H),y=t(h);y!==null&&!(y.expirationTime>H&&te());){var ge=y.callback;if(typeof ge=="function"){y.callback=null,b=y.priorityLevel;var E=ge(y.expirationTime<=H);if(H=i.unstable_now(),typeof E=="function"){y.callback=E,V(H),K=!0;break t}y===t(h)&&n(h),V(H)}else n(h);y=t(h)}if(y!==null)K=!0;else{var X=t(d);X!==null&&me(j,X.startTime-H),K=!1}}break e}finally{y=null,b=W,v=!1}K=void 0}}finally{K?ne():Q=!1}}}var ne;if(typeof B=="function")ne=function(){B(le)};else if(typeof MessageChannel<"u"){var xe=new MessageChannel,ke=xe.port2;xe.port1.onmessage=le,ne=function(){ke.postMessage(null)}}else ne=function(){O(le,0)};function me(H,K){I=O(function(){H(i.unstable_now())},K)}i.unstable_IdlePriority=5,i.unstable_ImmediatePriority=1,i.unstable_LowPriority=4,i.unstable_NormalPriority=3,i.unstable_Profiling=null,i.unstable_UserBlockingPriority=2,i.unstable_cancelCallback=function(H){H.callback=null},i.unstable_forceFrameRate=function(H){0>H||125<H?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):q=0<H?Math.floor(1e3/H):5},i.unstable_getCurrentPriorityLevel=function(){return b},i.unstable_next=function(H){switch(b){case 1:case 2:case 3:var K=3;break;default:K=b}var W=b;b=K;try{return H()}finally{b=W}},i.unstable_requestPaint=function(){A=!0},i.unstable_runWithPriority=function(H,K){switch(H){case 1:case 2:case 3:case 4:case 5:break;default:H=3}var W=b;b=H;try{return K()}finally{b=W}},i.unstable_scheduleCallback=function(H,K,W){var ge=i.unstable_now();switch(typeof W=="object"&&W!==null?(W=W.delay,W=typeof W=="number"&&0<W?ge+W:ge):W=ge,H){case 1:var E=-1;break;case 2:E=250;break;case 5:E=1073741823;break;case 4:E=1e4;break;default:E=5e3}return E=W+E,H={id:p++,callback:K,priorityLevel:H,startTime:W,expirationTime:E,sortIndex:-1},W>ge?(H.sortIndex=W,e(d,H),t(h)===null&&H===t(d)&&(k?(D(I),I=-1):k=!0,me(j,W-ge))):(H.sortIndex=E,e(h,H),w||v||(w=!0,Q||(Q=!0,ne()))),H},i.unstable_shouldYield=te,i.unstable_wrapCallback=function(H){var K=b;return function(){var W=b;b=K;try{return H.apply(this,arguments)}finally{b=W}}}})(Gm)),Gm}var Gx;function TM(){return Gx||(Gx=1,Im.exports=AM()),Im.exports}var Fm={exports:{}},Ut={};/**
26
- * @license React
27
- * react-dom.production.js
28
- *
29
- * Copyright (c) Meta Platforms, Inc. and affiliates.
30
- *
31
- * This source code is licensed under the MIT license found in the
32
- * LICENSE file in the root directory of this source tree.
33
- */var Fx;function OM(){if(Fx)return Ut;Fx=1;var i=Qg();function e(h){var d="https://react.dev/errors/"+h;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+h+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function t(){}var n={d:{f:t,r:function(){throw Error(e(522))},D:t,C:t,L:t,m:t,X:t,S:t,M:t},p:0,findDOMNode:null},r=Symbol.for("react.portal");function a(h,d,p){var y=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:r,key:y==null?null:""+y,children:h,containerInfo:d,implementation:p}}var o=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(h,d){if(h==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return Ut.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=n,Ut.createPortal=function(h,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(e(299));return a(h,d,null,p)},Ut.flushSync=function(h){var d=o.T,p=n.p;try{if(o.T=null,n.p=2,h)return h()}finally{o.T=d,n.p=p,n.d.f()}},Ut.preconnect=function(h,d){typeof h=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,n.d.C(h,d))},Ut.prefetchDNS=function(h){typeof h=="string"&&n.d.D(h)},Ut.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var p=d.as,y=c(p,d.crossOrigin),b=typeof d.integrity=="string"?d.integrity:void 0,v=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?n.d.S(h,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:y,integrity:b,fetchPriority:v}):p==="script"&&n.d.X(h,{crossOrigin:y,integrity:b,fetchPriority:v,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},Ut.preinitModule=function(h,d){if(typeof h=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=c(d.as,d.crossOrigin);n.d.M(h,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&n.d.M(h)},Ut.preload=function(h,d){if(typeof h=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,y=c(p,d.crossOrigin);n.d.L(h,p,{crossOrigin:y,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},Ut.preloadModule=function(h,d){if(typeof h=="string")if(d){var p=c(d.as,d.crossOrigin);n.d.m(h,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else n.d.m(h)},Ut.requestFormReset=function(h){n.d.r(h)},Ut.unstable_batchedUpdates=function(h,d){return h(d)},Ut.useFormState=function(h,d,p){return o.H.useFormState(h,d,p)},Ut.useFormStatus=function(){return o.H.useHostTransitionStatus()},Ut.version="19.1.2",Ut}var Yx;function Aw(){if(Yx)return Fm.exports;Yx=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}return i(),Fm.exports=OM(),Fm.exports}/**
34
- * @license React
35
- * react-dom-client.production.js
36
- *
37
- * Copyright (c) Meta Platforms, Inc. and affiliates.
38
- *
39
- * This source code is licensed under the MIT license found in the
40
- * LICENSE file in the root directory of this source tree.
41
- */var Kx;function MM(){if(Kx)return Bo;Kx=1;var i=TM(),e=Qg(),t=Aw();function n(s){var l="https://react.dev/errors/"+s;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)l+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+s+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function a(s){var l=s,u=s;if(s.alternate)for(;l.return;)l=l.return;else{s=l;do l=s,(l.flags&4098)!==0&&(u=l.return),s=l.return;while(s)}return l.tag===3?u:null}function o(s){if(s.tag===13){var l=s.memoizedState;if(l===null&&(s=s.alternate,s!==null&&(l=s.memoizedState)),l!==null)return l.dehydrated}return null}function c(s){if(a(s)!==s)throw Error(n(188))}function h(s){var l=s.alternate;if(!l){if(l=a(s),l===null)throw Error(n(188));return l!==s?null:s}for(var u=s,f=l;;){var m=u.return;if(m===null)break;var g=m.alternate;if(g===null){if(f=m.return,f!==null){u=f;continue}break}if(m.child===g.child){for(g=m.child;g;){if(g===u)return c(m),s;if(g===f)return c(m),l;g=g.sibling}throw Error(n(188))}if(u.return!==f.return)u=m,f=g;else{for(var x=!1,C=m.child;C;){if(C===u){x=!0,u=m,f=g;break}if(C===f){x=!0,f=m,u=g;break}C=C.sibling}if(!x){for(C=g.child;C;){if(C===u){x=!0,u=g,f=m;break}if(C===f){x=!0,f=g,u=m;break}C=C.sibling}if(!x)throw Error(n(189))}}if(u.alternate!==f)throw Error(n(190))}if(u.tag!==3)throw Error(n(188));return u.stateNode.current===u?s:l}function d(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s;for(s=s.child;s!==null;){if(l=d(s),l!==null)return l;s=s.sibling}return null}var p=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),v=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),O=Symbol.for("react.provider"),D=Symbol.for("react.consumer"),B=Symbol.for("react.context"),V=Symbol.for("react.forward_ref"),j=Symbol.for("react.suspense"),Q=Symbol.for("react.suspense_list"),I=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),Y=Symbol.for("react.activity"),te=Symbol.for("react.memo_cache_sentinel"),le=Symbol.iterator;function ne(s){return s===null||typeof s!="object"?null:(s=le&&s[le]||s["@@iterator"],typeof s=="function"?s:null)}var xe=Symbol.for("react.client.reference");function ke(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===xe?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case w:return"Fragment";case A:return"Profiler";case k:return"StrictMode";case j:return"Suspense";case Q:return"SuspenseList";case Y:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case v:return"Portal";case B:return(s.displayName||"Context")+".Provider";case D:return(s._context.displayName||"Context")+".Consumer";case V:var l=s.render;return s=s.displayName,s||(s=l.displayName||l.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case I:return l=s.displayName||null,l!==null?l:ke(s.type)||"Memo";case q:l=s._payload,s=s._init;try{return ke(s(l))}catch{}}return null}var me=Array.isArray,H=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,K=t.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,W={pending:!1,data:null,method:null,action:null},ge=[],E=-1;function X(s){return{current:s}}function ie(s){0>E||(s.current=ge[E],ge[E]=null,E--)}function Z(s,l){E++,ge[E]=s.current,s.current=l}var re=X(null),Ce=X(null),be=X(null),Le=X(null);function Xe(s,l){switch(Z(be,l),Z(Ce,s),Z(re,null),l.nodeType){case 9:case 11:s=(s=l.documentElement)&&(s=s.namespaceURI)?sx(s):0;break;default:if(s=l.tagName,l=l.namespaceURI)l=sx(l),s=rx(l,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}ie(re),Z(re,s)}function mn(){ie(re),ie(Ce),ie(be)}function cs(s){s.memoizedState!==null&&Z(Le,s);var l=re.current,u=rx(l,s.type);l!==u&&(Z(Ce,s),Z(re,u))}function fs(s){Ce.current===s&&(ie(re),ie(Ce)),Le.current===s&&(ie(Le),Oo._currentValue=W)}var hs=Object.prototype.hasOwnProperty,Th=i.unstable_scheduleCallback,Oh=i.unstable_cancelCallback,vA=i.unstable_shouldYield,xA=i.unstable_requestPaint,hi=i.unstable_now,SA=i.unstable_getCurrentPriorityLevel,H0=i.unstable_ImmediatePriority,U0=i.unstable_UserBlockingPriority,Ru=i.unstable_NormalPriority,wA=i.unstable_LowPriority,P0=i.unstable_IdlePriority,kA=i.log,CA=i.unstable_setDisableYieldValue,La=null,pn=null;function ds(s){if(typeof kA=="function"&&CA(s),pn&&typeof pn.setStrictMode=="function")try{pn.setStrictMode(La,s)}catch{}}var gn=Math.clz32?Math.clz32:OA,AA=Math.log,TA=Math.LN2;function OA(s){return s>>>=0,s===0?32:31-(AA(s)/TA|0)|0}var Du=256,Nu=4194304;function hr(s){var l=s&42;if(l!==0)return l;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return s&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Bu(s,l,u){var f=s.pendingLanes;if(f===0)return 0;var m=0,g=s.suspendedLanes,x=s.pingedLanes;s=s.warmLanes;var C=f&134217727;return C!==0?(f=C&~g,f!==0?m=hr(f):(x&=C,x!==0?m=hr(x):u||(u=C&~s,u!==0&&(m=hr(u))))):(C=f&~g,C!==0?m=hr(C):x!==0?m=hr(x):u||(u=f&~s,u!==0&&(m=hr(u)))),m===0?0:l!==0&&l!==m&&(l&g)===0&&(g=m&-m,u=l&-l,g>=u||g===32&&(u&4194048)!==0)?l:m}function ja(s,l){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&l)===0}function MA(s,l){switch(s){case 1:case 2:case 4:case 8:case 64:return l+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return l+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function q0(){var s=Du;return Du<<=1,(Du&4194048)===0&&(Du=256),s}function V0(){var s=Nu;return Nu<<=1,(Nu&62914560)===0&&(Nu=4194304),s}function Mh(s){for(var l=[],u=0;31>u;u++)l.push(s);return l}function za(s,l){s.pendingLanes|=l,l!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function EA(s,l,u,f,m,g){var x=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var C=s.entanglements,M=s.expirationTimes,_=s.hiddenUpdates;for(u=x&~u;0<u;){var G=31-gn(u),$=1<<G;C[G]=0,M[G]=-1;var U=_[G];if(U!==null)for(_[G]=null,G=0;G<U.length;G++){var P=U[G];P!==null&&(P.lane&=-536870913)}u&=~$}f!==0&&Q0(s,f,0),g!==0&&m===0&&s.tag!==0&&(s.suspendedLanes|=g&~(x&~l))}function Q0(s,l,u){s.pendingLanes|=l,s.suspendedLanes&=~l;var f=31-gn(l);s.entangledLanes|=l,s.entanglements[f]=s.entanglements[f]|1073741824|u&4194090}function I0(s,l){var u=s.entangledLanes|=l;for(s=s.entanglements;u;){var f=31-gn(u),m=1<<f;m&l|s[f]&l&&(s[f]|=l),u&=~m}}function Eh(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function Rh(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function G0(){var s=K.p;return s!==0?s:(s=window.event,s===void 0?32:Cx(s.type))}function RA(s,l){var u=K.p;try{return K.p=s,l()}finally{K.p=u}}var ms=Math.random().toString(36).slice(2),_t="__reactFiber$"+ms,Zt="__reactProps$"+ms,nl="__reactContainer$"+ms,Dh="__reactEvents$"+ms,DA="__reactListeners$"+ms,NA="__reactHandles$"+ms,F0="__reactResources$"+ms,_a="__reactMarker$"+ms;function Nh(s){delete s[_t],delete s[Zt],delete s[Dh],delete s[DA],delete s[NA]}function il(s){var l=s[_t];if(l)return l;for(var u=s.parentNode;u;){if(l=u[nl]||u[_t]){if(u=l.alternate,l.child!==null||u!==null&&u.child!==null)for(s=ux(s);s!==null;){if(u=s[_t])return u;s=ux(s)}return l}s=u,u=s.parentNode}return null}function sl(s){if(s=s[_t]||s[nl]){var l=s.tag;if(l===5||l===6||l===13||l===26||l===27||l===3)return s}return null}function Ha(s){var l=s.tag;if(l===5||l===26||l===27||l===6)return s.stateNode;throw Error(n(33))}function rl(s){var l=s[F0];return l||(l=s[F0]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function kt(s){s[_a]=!0}var Y0=new Set,K0={};function dr(s,l){ll(s,l),ll(s+"Capture",l)}function ll(s,l){for(K0[s]=l,s=0;s<l.length;s++)Y0.add(l[s])}var BA=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),X0={},W0={};function LA(s){return hs.call(W0,s)?!0:hs.call(X0,s)?!1:BA.test(s)?W0[s]=!0:(X0[s]=!0,!1)}function Lu(s,l,u){if(LA(l))if(u===null)s.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":s.removeAttribute(l);return;case"boolean":var f=l.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){s.removeAttribute(l);return}}s.setAttribute(l,""+u)}}function ju(s,l,u){if(u===null)s.removeAttribute(l);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(l);return}s.setAttribute(l,""+u)}}function Ni(s,l,u,f){if(f===null)s.removeAttribute(u);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(u);return}s.setAttributeNS(l,u,""+f)}}var Bh,$0;function al(s){if(Bh===void 0)try{throw Error()}catch(u){var l=u.stack.trim().match(/\n( *(at )?)/);Bh=l&&l[1]||"",$0=-1<u.stack.indexOf(`
42
- at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
43
- `+Bh+s+$0}var Lh=!1;function jh(s,l){if(!s||Lh)return"";Lh=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(l){var $=function(){throw Error()};if(Object.defineProperty($.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct($,[])}catch(P){var U=P}Reflect.construct(s,[],$)}else{try{$.call()}catch(P){U=P}s.call($.prototype)}}else{try{throw Error()}catch(P){U=P}($=s())&&typeof $.catch=="function"&&$.catch(function(){})}}catch(P){if(P&&U&&typeof P.stack=="string")return[P.stack,U.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var g=f.DetermineComponentFrameRoot(),x=g[0],C=g[1];if(x&&C){var M=x.split(`
44
- `),_=C.split(`
45
- `);for(m=f=0;f<M.length&&!M[f].includes("DetermineComponentFrameRoot");)f++;for(;m<_.length&&!_[m].includes("DetermineComponentFrameRoot");)m++;if(f===M.length||m===_.length)for(f=M.length-1,m=_.length-1;1<=f&&0<=m&&M[f]!==_[m];)m--;for(;1<=f&&0<=m;f--,m--)if(M[f]!==_[m]){if(f!==1||m!==1)do if(f--,m--,0>m||M[f]!==_[m]){var G=`
46
- `+M[f].replace(" at new "," at ");return s.displayName&&G.includes("<anonymous>")&&(G=G.replace("<anonymous>",s.displayName)),G}while(1<=f&&0<=m);break}}}finally{Lh=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?al(u):""}function jA(s){switch(s.tag){case 26:case 27:case 5:return al(s.type);case 16:return al("Lazy");case 13:return al("Suspense");case 19:return al("SuspenseList");case 0:case 15:return jh(s.type,!1);case 11:return jh(s.type.render,!1);case 1:return jh(s.type,!0);case 31:return al("Activity");default:return""}}function Z0(s){try{var l="";do l+=jA(s),s=s.return;while(s);return l}catch(u){return`
47
- Error generating stack: `+u.message+`
48
- `+u.stack}}function Rn(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function J0(s){var l=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function zA(s){var l=J0(s)?"checked":"value",u=Object.getOwnPropertyDescriptor(s.constructor.prototype,l),f=""+s[l];if(!s.hasOwnProperty(l)&&typeof u<"u"&&typeof u.get=="function"&&typeof u.set=="function"){var m=u.get,g=u.set;return Object.defineProperty(s,l,{configurable:!0,get:function(){return m.call(this)},set:function(x){f=""+x,g.call(this,x)}}),Object.defineProperty(s,l,{enumerable:u.enumerable}),{getValue:function(){return f},setValue:function(x){f=""+x},stopTracking:function(){s._valueTracker=null,delete s[l]}}}}function zu(s){s._valueTracker||(s._valueTracker=zA(s))}function ey(s){if(!s)return!1;var l=s._valueTracker;if(!l)return!0;var u=l.getValue(),f="";return s&&(f=J0(s)?s.checked?"true":"false":s.value),s=f,s!==u?(l.setValue(s),!0):!1}function _u(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var _A=/[\n"\\]/g;function Dn(s){return s.replace(_A,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function zh(s,l,u,f,m,g,x,C){s.name="",x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?s.type=x:s.removeAttribute("type"),l!=null?x==="number"?(l===0&&s.value===""||s.value!=l)&&(s.value=""+Rn(l)):s.value!==""+Rn(l)&&(s.value=""+Rn(l)):x!=="submit"&&x!=="reset"||s.removeAttribute("value"),l!=null?_h(s,x,Rn(l)):u!=null?_h(s,x,Rn(u)):f!=null&&s.removeAttribute("value"),m==null&&g!=null&&(s.defaultChecked=!!g),m!=null&&(s.checked=m&&typeof m!="function"&&typeof m!="symbol"),C!=null&&typeof C!="function"&&typeof C!="symbol"&&typeof C!="boolean"?s.name=""+Rn(C):s.removeAttribute("name")}function ty(s,l,u,f,m,g,x,C){if(g!=null&&typeof g!="function"&&typeof g!="symbol"&&typeof g!="boolean"&&(s.type=g),l!=null||u!=null){if(!(g!=="submit"&&g!=="reset"||l!=null))return;u=u!=null?""+Rn(u):"",l=l!=null?""+Rn(l):u,C||l===s.value||(s.value=l),s.defaultValue=l}f=f??m,f=typeof f!="function"&&typeof f!="symbol"&&!!f,s.checked=C?s.checked:!!f,s.defaultChecked=!!f,x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"&&(s.name=x)}function _h(s,l,u){l==="number"&&_u(s.ownerDocument)===s||s.defaultValue===""+u||(s.defaultValue=""+u)}function ol(s,l,u,f){if(s=s.options,l){l={};for(var m=0;m<u.length;m++)l["$"+u[m]]=!0;for(u=0;u<s.length;u++)m=l.hasOwnProperty("$"+s[u].value),s[u].selected!==m&&(s[u].selected=m),m&&f&&(s[u].defaultSelected=!0)}else{for(u=""+Rn(u),l=null,m=0;m<s.length;m++){if(s[m].value===u){s[m].selected=!0,f&&(s[m].defaultSelected=!0);return}l!==null||s[m].disabled||(l=s[m])}l!==null&&(l.selected=!0)}}function ny(s,l,u){if(l!=null&&(l=""+Rn(l),l!==s.value&&(s.value=l),u==null)){s.defaultValue!==l&&(s.defaultValue=l);return}s.defaultValue=u!=null?""+Rn(u):""}function iy(s,l,u,f){if(l==null){if(f!=null){if(u!=null)throw Error(n(92));if(me(f)){if(1<f.length)throw Error(n(93));f=f[0]}u=f}u==null&&(u=""),l=u}u=Rn(l),s.defaultValue=u,f=s.textContent,f===u&&f!==""&&f!==null&&(s.value=f)}function ul(s,l){if(l){var u=s.firstChild;if(u&&u===s.lastChild&&u.nodeType===3){u.nodeValue=l;return}}s.textContent=l}var HA=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function sy(s,l,u){var f=l.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?f?s.setProperty(l,""):l==="float"?s.cssFloat="":s[l]="":f?s.setProperty(l,u):typeof u!="number"||u===0||HA.has(l)?l==="float"?s.cssFloat=u:s[l]=(""+u).trim():s[l]=u+"px"}function ry(s,l,u){if(l!=null&&typeof l!="object")throw Error(n(62));if(s=s.style,u!=null){for(var f in u)!u.hasOwnProperty(f)||l!=null&&l.hasOwnProperty(f)||(f.indexOf("--")===0?s.setProperty(f,""):f==="float"?s.cssFloat="":s[f]="");for(var m in l)f=l[m],l.hasOwnProperty(m)&&u[m]!==f&&sy(s,m,f)}else for(var g in l)l.hasOwnProperty(g)&&sy(s,g,l[g])}function Hh(s){if(s.indexOf("-")===-1)return!1;switch(s){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 UA=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),PA=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Hu(s){return PA.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}var Uh=null;function Ph(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var cl=null,fl=null;function ly(s){var l=sl(s);if(l&&(s=l.stateNode)){var u=s[Zt]||null;e:switch(s=l.stateNode,l.type){case"input":if(zh(s,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),l=u.name,u.type==="radio"&&l!=null){for(u=s;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Dn(""+l)+'"][type="radio"]'),l=0;l<u.length;l++){var f=u[l];if(f!==s&&f.form===s.form){var m=f[Zt]||null;if(!m)throw Error(n(90));zh(f,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(l=0;l<u.length;l++)f=u[l],f.form===s.form&&ey(f)}break e;case"textarea":ny(s,u.value,u.defaultValue);break e;case"select":l=u.value,l!=null&&ol(s,!!u.multiple,l,!1)}}}var qh=!1;function ay(s,l,u){if(qh)return s(l,u);qh=!0;try{var f=s(l);return f}finally{if(qh=!1,(cl!==null||fl!==null)&&(kc(),cl&&(l=cl,s=fl,fl=cl=null,ly(l),s)))for(l=0;l<s.length;l++)ly(s[l])}}function Ua(s,l){var u=s.stateNode;if(u===null)return null;var f=u[Zt]||null;if(f===null)return null;u=f[l];e:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(s=s.type,f=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!f;break e;default:s=!1}if(s)return null;if(u&&typeof u!="function")throw Error(n(231,l,typeof u));return u}var Bi=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Vh=!1;if(Bi)try{var Pa={};Object.defineProperty(Pa,"passive",{get:function(){Vh=!0}}),window.addEventListener("test",Pa,Pa),window.removeEventListener("test",Pa,Pa)}catch{Vh=!1}var ps=null,Qh=null,Uu=null;function oy(){if(Uu)return Uu;var s,l=Qh,u=l.length,f,m="value"in ps?ps.value:ps.textContent,g=m.length;for(s=0;s<u&&l[s]===m[s];s++);var x=u-s;for(f=1;f<=x&&l[u-f]===m[g-f];f++);return Uu=m.slice(s,1<f?1-f:void 0)}function Pu(s){var l=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&l===13&&(s=13)):s=l,s===10&&(s=13),32<=s||s===13?s:0}function qu(){return!0}function uy(){return!1}function Jt(s){function l(u,f,m,g,x){this._reactName=u,this._targetInst=m,this.type=f,this.nativeEvent=g,this.target=x,this.currentTarget=null;for(var C in s)s.hasOwnProperty(C)&&(u=s[C],this[C]=u?u(g):g[C]);return this.isDefaultPrevented=(g.defaultPrevented!=null?g.defaultPrevented:g.returnValue===!1)?qu:uy,this.isPropagationStopped=uy,this}return p(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=qu)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=qu)},persist:function(){},isPersistent:qu}),l}var mr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vu=Jt(mr),qa=p({},mr,{view:0,detail:0}),qA=Jt(qa),Ih,Gh,Va,Qu=p({},qa,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Yh,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Va&&(Va&&s.type==="mousemove"?(Ih=s.screenX-Va.screenX,Gh=s.screenY-Va.screenY):Gh=Ih=0,Va=s),Ih)},movementY:function(s){return"movementY"in s?s.movementY:Gh}}),cy=Jt(Qu),VA=p({},Qu,{dataTransfer:0}),QA=Jt(VA),IA=p({},qa,{relatedTarget:0}),Fh=Jt(IA),GA=p({},mr,{animationName:0,elapsedTime:0,pseudoElement:0}),FA=Jt(GA),YA=p({},mr,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),KA=Jt(YA),XA=p({},mr,{data:0}),fy=Jt(XA),WA={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},$A={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},ZA={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function JA(s){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(s):(s=ZA[s])?!!l[s]:!1}function Yh(){return JA}var eT=p({},qa,{key:function(s){if(s.key){var l=WA[s.key]||s.key;if(l!=="Unidentified")return l}return s.type==="keypress"?(s=Pu(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?$A[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Yh,charCode:function(s){return s.type==="keypress"?Pu(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?Pu(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),tT=Jt(eT),nT=p({},Qu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),hy=Jt(nT),iT=p({},qa,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Yh}),sT=Jt(iT),rT=p({},mr,{propertyName:0,elapsedTime:0,pseudoElement:0}),lT=Jt(rT),aT=p({},Qu,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),oT=Jt(aT),uT=p({},mr,{newState:0,oldState:0}),cT=Jt(uT),fT=[9,13,27,32],Kh=Bi&&"CompositionEvent"in window,Qa=null;Bi&&"documentMode"in document&&(Qa=document.documentMode);var hT=Bi&&"TextEvent"in window&&!Qa,dy=Bi&&(!Kh||Qa&&8<Qa&&11>=Qa),my=" ",py=!1;function gy(s,l){switch(s){case"keyup":return fT.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function yy(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var hl=!1;function dT(s,l){switch(s){case"compositionend":return yy(l);case"keypress":return l.which!==32?null:(py=!0,my);case"textInput":return s=l.data,s===my&&py?null:s;default:return null}}function mT(s,l){if(hl)return s==="compositionend"||!Kh&&gy(s,l)?(s=oy(),Uu=Qh=ps=null,hl=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(l.ctrlKey||l.altKey||l.metaKey)||l.ctrlKey&&l.altKey){if(l.char&&1<l.char.length)return l.char;if(l.which)return String.fromCharCode(l.which)}return null;case"compositionend":return dy&&l.locale!=="ko"?null:l.data;default:return null}}var pT={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function by(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l==="input"?!!pT[s.type]:l==="textarea"}function vy(s,l,u,f){cl?fl?fl.push(f):fl=[f]:cl=f,l=Ec(l,"onChange"),0<l.length&&(u=new Vu("onChange","change",null,u,f),s.push({event:u,listeners:l}))}var Ia=null,Ga=null;function gT(s){Jv(s,0)}function Iu(s){var l=Ha(s);if(ey(l))return s}function xy(s,l){if(s==="change")return l}var Sy=!1;if(Bi){var Xh;if(Bi){var Wh="oninput"in document;if(!Wh){var wy=document.createElement("div");wy.setAttribute("oninput","return;"),Wh=typeof wy.oninput=="function"}Xh=Wh}else Xh=!1;Sy=Xh&&(!document.documentMode||9<document.documentMode)}function ky(){Ia&&(Ia.detachEvent("onpropertychange",Cy),Ga=Ia=null)}function Cy(s){if(s.propertyName==="value"&&Iu(Ga)){var l=[];vy(l,Ga,s,Ph(s)),ay(gT,l)}}function yT(s,l,u){s==="focusin"?(ky(),Ia=l,Ga=u,Ia.attachEvent("onpropertychange",Cy)):s==="focusout"&&ky()}function bT(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return Iu(Ga)}function vT(s,l){if(s==="click")return Iu(l)}function xT(s,l){if(s==="input"||s==="change")return Iu(l)}function ST(s,l){return s===l&&(s!==0||1/s===1/l)||s!==s&&l!==l}var yn=typeof Object.is=="function"?Object.is:ST;function Fa(s,l){if(yn(s,l))return!0;if(typeof s!="object"||s===null||typeof l!="object"||l===null)return!1;var u=Object.keys(s),f=Object.keys(l);if(u.length!==f.length)return!1;for(f=0;f<u.length;f++){var m=u[f];if(!hs.call(l,m)||!yn(s[m],l[m]))return!1}return!0}function Ay(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function Ty(s,l){var u=Ay(s);s=0;for(var f;u;){if(u.nodeType===3){if(f=s+u.textContent.length,s<=l&&f>=l)return{node:u,offset:l-s};s=f}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=Ay(u)}}function Oy(s,l){return s&&l?s===l?!0:s&&s.nodeType===3?!1:l&&l.nodeType===3?Oy(s,l.parentNode):"contains"in s?s.contains(l):s.compareDocumentPosition?!!(s.compareDocumentPosition(l)&16):!1:!1}function My(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var l=_u(s.document);l instanceof s.HTMLIFrameElement;){try{var u=typeof l.contentWindow.location.href=="string"}catch{u=!1}if(u)s=l.contentWindow;else break;l=_u(s.document)}return l}function $h(s){var l=s&&s.nodeName&&s.nodeName.toLowerCase();return l&&(l==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||l==="textarea"||s.contentEditable==="true")}var wT=Bi&&"documentMode"in document&&11>=document.documentMode,dl=null,Zh=null,Ya=null,Jh=!1;function Ey(s,l,u){var f=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Jh||dl==null||dl!==_u(f)||(f=dl,"selectionStart"in f&&$h(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),Ya&&Fa(Ya,f)||(Ya=f,f=Ec(Zh,"onSelect"),0<f.length&&(l=new Vu("onSelect","select",null,l,u),s.push({event:l,listeners:f}),l.target=dl)))}function pr(s,l){var u={};return u[s.toLowerCase()]=l.toLowerCase(),u["Webkit"+s]="webkit"+l,u["Moz"+s]="moz"+l,u}var ml={animationend:pr("Animation","AnimationEnd"),animationiteration:pr("Animation","AnimationIteration"),animationstart:pr("Animation","AnimationStart"),transitionrun:pr("Transition","TransitionRun"),transitionstart:pr("Transition","TransitionStart"),transitioncancel:pr("Transition","TransitionCancel"),transitionend:pr("Transition","TransitionEnd")},ed={},Ry={};Bi&&(Ry=document.createElement("div").style,"AnimationEvent"in window||(delete ml.animationend.animation,delete ml.animationiteration.animation,delete ml.animationstart.animation),"TransitionEvent"in window||delete ml.transitionend.transition);function gr(s){if(ed[s])return ed[s];if(!ml[s])return s;var l=ml[s],u;for(u in l)if(l.hasOwnProperty(u)&&u in Ry)return ed[s]=l[u];return s}var Dy=gr("animationend"),Ny=gr("animationiteration"),By=gr("animationstart"),kT=gr("transitionrun"),CT=gr("transitionstart"),AT=gr("transitioncancel"),Ly=gr("transitionend"),jy=new Map,td="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");td.push("scrollEnd");function Wn(s,l){jy.set(s,l),dr(l,[s])}var zy=new WeakMap;function Nn(s,l){if(typeof s=="object"&&s!==null){var u=zy.get(s);return u!==void 0?u:(l={value:s,source:l,stack:Z0(l)},zy.set(s,l),l)}return{value:s,source:l,stack:Z0(l)}}var Bn=[],pl=0,nd=0;function Gu(){for(var s=pl,l=nd=pl=0;l<s;){var u=Bn[l];Bn[l++]=null;var f=Bn[l];Bn[l++]=null;var m=Bn[l];Bn[l++]=null;var g=Bn[l];if(Bn[l++]=null,f!==null&&m!==null){var x=f.pending;x===null?m.next=m:(m.next=x.next,x.next=m),f.pending=m}g!==0&&_y(u,m,g)}}function Fu(s,l,u,f){Bn[pl++]=s,Bn[pl++]=l,Bn[pl++]=u,Bn[pl++]=f,nd|=f,s.lanes|=f,s=s.alternate,s!==null&&(s.lanes|=f)}function id(s,l,u,f){return Fu(s,l,u,f),Yu(s)}function gl(s,l){return Fu(s,null,null,l),Yu(s)}function _y(s,l,u){s.lanes|=u;var f=s.alternate;f!==null&&(f.lanes|=u);for(var m=!1,g=s.return;g!==null;)g.childLanes|=u,f=g.alternate,f!==null&&(f.childLanes|=u),g.tag===22&&(s=g.stateNode,s===null||s._visibility&1||(m=!0)),s=g,g=g.return;return s.tag===3?(g=s.stateNode,m&&l!==null&&(m=31-gn(u),s=g.hiddenUpdates,f=s[m],f===null?s[m]=[l]:f.push(l),l.lane=u|536870912),g):null}function Yu(s){if(50<vo)throw vo=0,um=null,Error(n(185));for(var l=s.return;l!==null;)s=l,l=s.return;return s.tag===3?s.stateNode:null}var yl={};function TT(s,l,u,f){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=l,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function bn(s,l,u,f){return new TT(s,l,u,f)}function sd(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Li(s,l){var u=s.alternate;return u===null?(u=bn(s.tag,l,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=l,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,l=s.dependencies,u.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function Hy(s,l){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=l,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,l=u.dependencies,s.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),s}function Ku(s,l,u,f,m,g){var x=0;if(f=s,typeof s=="function")sd(s)&&(x=1);else if(typeof s=="string")x=MO(s,u,re.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case Y:return s=bn(31,u,l,m),s.elementType=Y,s.lanes=g,s;case w:return yr(u.children,m,g,l);case k:x=8,m|=24;break;case A:return s=bn(12,u,l,m|2),s.elementType=A,s.lanes=g,s;case j:return s=bn(13,u,l,m),s.elementType=j,s.lanes=g,s;case Q:return s=bn(19,u,l,m),s.elementType=Q,s.lanes=g,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case O:case B:x=10;break e;case D:x=9;break e;case V:x=11;break e;case I:x=14;break e;case q:x=16,f=null;break e}x=29,u=Error(n(130,s===null?"null":typeof s,"")),f=null}return l=bn(x,u,l,m),l.elementType=s,l.type=f,l.lanes=g,l}function yr(s,l,u,f){return s=bn(7,s,f,l),s.lanes=u,s}function rd(s,l,u){return s=bn(6,s,null,l),s.lanes=u,s}function ld(s,l,u){return l=bn(4,s.children!==null?s.children:[],s.key,l),l.lanes=u,l.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},l}var bl=[],vl=0,Xu=null,Wu=0,Ln=[],jn=0,br=null,ji=1,zi="";function vr(s,l){bl[vl++]=Wu,bl[vl++]=Xu,Xu=s,Wu=l}function Uy(s,l,u){Ln[jn++]=ji,Ln[jn++]=zi,Ln[jn++]=br,br=s;var f=ji;s=zi;var m=32-gn(f)-1;f&=~(1<<m),u+=1;var g=32-gn(l)+m;if(30<g){var x=m-m%5;g=(f&(1<<x)-1).toString(32),f>>=x,m-=x,ji=1<<32-gn(l)+m|u<<m|f,zi=g+s}else ji=1<<g|u<<m|f,zi=s}function ad(s){s.return!==null&&(vr(s,1),Uy(s,1,0))}function od(s){for(;s===Xu;)Xu=bl[--vl],bl[vl]=null,Wu=bl[--vl],bl[vl]=null;for(;s===br;)br=Ln[--jn],Ln[jn]=null,zi=Ln[--jn],Ln[jn]=null,ji=Ln[--jn],Ln[jn]=null}var Gt=null,rt=null,Ue=!1,xr=null,di=!1,ud=Error(n(519));function Sr(s){var l=Error(n(418,""));throw Wa(Nn(l,s)),ud}function Py(s){var l=s.stateNode,u=s.type,f=s.memoizedProps;switch(l[_t]=s,l[Zt]=f,u){case"dialog":Ne("cancel",l),Ne("close",l);break;case"iframe":case"object":case"embed":Ne("load",l);break;case"video":case"audio":for(u=0;u<So.length;u++)Ne(So[u],l);break;case"source":Ne("error",l);break;case"img":case"image":case"link":Ne("error",l),Ne("load",l);break;case"details":Ne("toggle",l);break;case"input":Ne("invalid",l),ty(l,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0),zu(l);break;case"select":Ne("invalid",l);break;case"textarea":Ne("invalid",l),iy(l,f.value,f.defaultValue,f.children),zu(l)}u=f.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||l.textContent===""+u||f.suppressHydrationWarning===!0||ix(l.textContent,u)?(f.popover!=null&&(Ne("beforetoggle",l),Ne("toggle",l)),f.onScroll!=null&&Ne("scroll",l),f.onScrollEnd!=null&&Ne("scrollend",l),f.onClick!=null&&(l.onclick=Rc),l=!0):l=!1,l||Sr(s)}function qy(s){for(Gt=s.return;Gt;)switch(Gt.tag){case 5:case 13:di=!1;return;case 27:case 3:di=!0;return;default:Gt=Gt.return}}function Ka(s){if(s!==Gt)return!1;if(!Ue)return qy(s),Ue=!0,!1;var l=s.tag,u;if((u=l!==3&&l!==27)&&((u=l===5)&&(u=s.type,u=!(u!=="form"&&u!=="button")||Am(s.type,s.memoizedProps)),u=!u),u&&rt&&Sr(s),qy(s),l===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(n(317));e:{for(s=s.nextSibling,l=0;s;){if(s.nodeType===8)if(u=s.data,u==="/$"){if(l===0){rt=Zn(s.nextSibling);break e}l--}else u!=="$"&&u!=="$!"&&u!=="$?"||l++;s=s.nextSibling}rt=null}}else l===27?(l=rt,Ds(s.type)?(s=Em,Em=null,rt=s):rt=l):rt=Gt?Zn(s.stateNode.nextSibling):null;return!0}function Xa(){rt=Gt=null,Ue=!1}function Vy(){var s=xr;return s!==null&&(nn===null?nn=s:nn.push.apply(nn,s),xr=null),s}function Wa(s){xr===null?xr=[s]:xr.push(s)}var cd=X(null),wr=null,_i=null;function gs(s,l,u){Z(cd,l._currentValue),l._currentValue=u}function Hi(s){s._currentValue=cd.current,ie(cd)}function fd(s,l,u){for(;s!==null;){var f=s.alternate;if((s.childLanes&l)!==l?(s.childLanes|=l,f!==null&&(f.childLanes|=l)):f!==null&&(f.childLanes&l)!==l&&(f.childLanes|=l),s===u)break;s=s.return}}function hd(s,l,u,f){var m=s.child;for(m!==null&&(m.return=s);m!==null;){var g=m.dependencies;if(g!==null){var x=m.child;g=g.firstContext;e:for(;g!==null;){var C=g;g=m;for(var M=0;M<l.length;M++)if(C.context===l[M]){g.lanes|=u,C=g.alternate,C!==null&&(C.lanes|=u),fd(g.return,u,s),f||(x=null);break e}g=C.next}}else if(m.tag===18){if(x=m.return,x===null)throw Error(n(341));x.lanes|=u,g=x.alternate,g!==null&&(g.lanes|=u),fd(x,u,s),x=null}else x=m.child;if(x!==null)x.return=m;else for(x=m;x!==null;){if(x===s){x=null;break}if(m=x.sibling,m!==null){m.return=x.return,x=m;break}x=x.return}m=x}}function $a(s,l,u,f){s=null;for(var m=l,g=!1;m!==null;){if(!g){if((m.flags&524288)!==0)g=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var x=m.alternate;if(x===null)throw Error(n(387));if(x=x.memoizedProps,x!==null){var C=m.type;yn(m.pendingProps.value,x.value)||(s!==null?s.push(C):s=[C])}}else if(m===Le.current){if(x=m.alternate,x===null)throw Error(n(387));x.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(s!==null?s.push(Oo):s=[Oo])}m=m.return}s!==null&&hd(l,s,u,f),l.flags|=262144}function $u(s){for(s=s.firstContext;s!==null;){if(!yn(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function kr(s){wr=s,_i=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function Ht(s){return Qy(wr,s)}function Zu(s,l){return wr===null&&kr(s),Qy(s,l)}function Qy(s,l){var u=l._currentValue;if(l={context:l,memoizedValue:u,next:null},_i===null){if(s===null)throw Error(n(308));_i=l,s.dependencies={lanes:0,firstContext:l},s.flags|=524288}else _i=_i.next=l;return u}var OT=typeof AbortController<"u"?AbortController:function(){var s=[],l=this.signal={aborted:!1,addEventListener:function(u,f){s.push(f)}};this.abort=function(){l.aborted=!0,s.forEach(function(u){return u()})}},MT=i.unstable_scheduleCallback,ET=i.unstable_NormalPriority,gt={$$typeof:B,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function dd(){return{controller:new OT,data:new Map,refCount:0}}function Za(s){s.refCount--,s.refCount===0&&MT(ET,function(){s.controller.abort()})}var Ja=null,md=0,xl=0,Sl=null;function RT(s,l){if(Ja===null){var u=Ja=[];md=0,xl=gm(),Sl={status:"pending",value:void 0,then:function(f){u.push(f)}}}return md++,l.then(Iy,Iy),l}function Iy(){if(--md===0&&Ja!==null){Sl!==null&&(Sl.status="fulfilled");var s=Ja;Ja=null,xl=0,Sl=null;for(var l=0;l<s.length;l++)(0,s[l])()}}function DT(s,l){var u=[],f={status:"pending",value:null,reason:null,then:function(m){u.push(m)}};return s.then(function(){f.status="fulfilled",f.value=l;for(var m=0;m<u.length;m++)(0,u[m])(l)},function(m){for(f.status="rejected",f.reason=m,m=0;m<u.length;m++)(0,u[m])(void 0)}),f}var Gy=H.S;H.S=function(s,l){typeof l=="object"&&l!==null&&typeof l.then=="function"&&RT(s,l),Gy!==null&&Gy(s,l)};var Cr=X(null);function pd(){var s=Cr.current;return s!==null?s:Ze.pooledCache}function Ju(s,l){l===null?Z(Cr,Cr.current):Z(Cr,l.pool)}function Fy(){var s=pd();return s===null?null:{parent:gt._currentValue,pool:s}}var eo=Error(n(460)),Yy=Error(n(474)),ec=Error(n(542)),gd={then:function(){}};function Ky(s){return s=s.status,s==="fulfilled"||s==="rejected"}function tc(){}function Xy(s,l,u){switch(u=s[u],u===void 0?s.push(l):u!==l&&(l.then(tc,tc),l=u),l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,$y(s),s;default:if(typeof l.status=="string")l.then(tc,tc);else{if(s=Ze,s!==null&&100<s.shellSuspendCounter)throw Error(n(482));s=l,s.status="pending",s.then(function(f){if(l.status==="pending"){var m=l;m.status="fulfilled",m.value=f}},function(f){if(l.status==="pending"){var m=l;m.status="rejected",m.reason=f}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw s=l.reason,$y(s),s}throw to=l,eo}}var to=null;function Wy(){if(to===null)throw Error(n(459));var s=to;return to=null,s}function $y(s){if(s===eo||s===ec)throw Error(n(483))}var ys=!1;function yd(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function bd(s,l){s=s.updateQueue,l.updateQueue===s&&(l.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function bs(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function vs(s,l,u){var f=s.updateQueue;if(f===null)return null;if(f=f.shared,(Ve&2)!==0){var m=f.pending;return m===null?l.next=l:(l.next=m.next,m.next=l),f.pending=l,l=Yu(s),_y(s,null,u),l}return Fu(s,f,l,u),Yu(s)}function no(s,l,u){if(l=l.updateQueue,l!==null&&(l=l.shared,(u&4194048)!==0)){var f=l.lanes;f&=s.pendingLanes,u|=f,l.lanes=u,I0(s,u)}}function vd(s,l){var u=s.updateQueue,f=s.alternate;if(f!==null&&(f=f.updateQueue,u===f)){var m=null,g=null;if(u=u.firstBaseUpdate,u!==null){do{var x={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};g===null?m=g=x:g=g.next=x,u=u.next}while(u!==null);g===null?m=g=l:g=g.next=l}else m=g=l;u={baseState:f.baseState,firstBaseUpdate:m,lastBaseUpdate:g,shared:f.shared,callbacks:f.callbacks},s.updateQueue=u;return}s=u.lastBaseUpdate,s===null?u.firstBaseUpdate=l:s.next=l,u.lastBaseUpdate=l}var xd=!1;function io(){if(xd){var s=Sl;if(s!==null)throw s}}function so(s,l,u,f){xd=!1;var m=s.updateQueue;ys=!1;var g=m.firstBaseUpdate,x=m.lastBaseUpdate,C=m.shared.pending;if(C!==null){m.shared.pending=null;var M=C,_=M.next;M.next=null,x===null?g=_:x.next=_,x=M;var G=s.alternate;G!==null&&(G=G.updateQueue,C=G.lastBaseUpdate,C!==x&&(C===null?G.firstBaseUpdate=_:C.next=_,G.lastBaseUpdate=M))}if(g!==null){var $=m.baseState;x=0,G=_=M=null,C=g;do{var U=C.lane&-536870913,P=U!==C.lane;if(P?(ze&U)===U:(f&U)===U){U!==0&&U===xl&&(xd=!0),G!==null&&(G=G.next={lane:0,tag:C.tag,payload:C.payload,callback:null,next:null});e:{var we=s,ve=C;U=l;var Fe=u;switch(ve.tag){case 1:if(we=ve.payload,typeof we=="function"){$=we.call(Fe,$,U);break e}$=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=ve.payload,U=typeof we=="function"?we.call(Fe,$,U):we,U==null)break e;$=p({},$,U);break e;case 2:ys=!0}}U=C.callback,U!==null&&(s.flags|=64,P&&(s.flags|=8192),P=m.callbacks,P===null?m.callbacks=[U]:P.push(U))}else P={lane:U,tag:C.tag,payload:C.payload,callback:C.callback,next:null},G===null?(_=G=P,M=$):G=G.next=P,x|=U;if(C=C.next,C===null){if(C=m.shared.pending,C===null)break;P=C,C=P.next,P.next=null,m.lastBaseUpdate=P,m.shared.pending=null}}while(!0);G===null&&(M=$),m.baseState=M,m.firstBaseUpdate=_,m.lastBaseUpdate=G,g===null&&(m.shared.lanes=0),Os|=x,s.lanes=x,s.memoizedState=$}}function Zy(s,l){if(typeof s!="function")throw Error(n(191,s));s.call(l)}function Jy(s,l){var u=s.callbacks;if(u!==null)for(s.callbacks=null,s=0;s<u.length;s++)Zy(u[s],l)}var wl=X(null),nc=X(0);function eb(s,l){s=Gi,Z(nc,s),Z(wl,l),Gi=s|l.baseLanes}function Sd(){Z(nc,Gi),Z(wl,wl.current)}function wd(){Gi=nc.current,ie(wl),ie(nc)}var xs=0,Oe=null,Ie=null,dt=null,ic=!1,kl=!1,Ar=!1,sc=0,ro=0,Cl=null,NT=0;function ut(){throw Error(n(321))}function kd(s,l){if(l===null)return!1;for(var u=0;u<l.length&&u<s.length;u++)if(!yn(s[u],l[u]))return!1;return!0}function Cd(s,l,u,f,m,g){return xs=g,Oe=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,H.H=s===null||s.memoizedState===null?_b:Hb,Ar=!1,g=u(f,m),Ar=!1,kl&&(g=nb(l,u,f,m)),tb(s),g}function tb(s){H.H=cc;var l=Ie!==null&&Ie.next!==null;if(xs=0,dt=Ie=Oe=null,ic=!1,ro=0,Cl=null,l)throw Error(n(300));s===null||Ct||(s=s.dependencies,s!==null&&$u(s)&&(Ct=!0))}function nb(s,l,u,f){Oe=s;var m=0;do{if(kl&&(Cl=null),ro=0,kl=!1,25<=m)throw Error(n(301));if(m+=1,dt=Ie=null,s.updateQueue!=null){var g=s.updateQueue;g.lastEffect=null,g.events=null,g.stores=null,g.memoCache!=null&&(g.memoCache.index=0)}H.H=UT,g=l(u,f)}while(kl);return g}function BT(){var s=H.H,l=s.useState()[0];return l=typeof l.then=="function"?lo(l):l,s=s.useState()[0],(Ie!==null?Ie.memoizedState:null)!==s&&(Oe.flags|=1024),l}function Ad(){var s=sc!==0;return sc=0,s}function Td(s,l,u){l.updateQueue=s.updateQueue,l.flags&=-2053,s.lanes&=~u}function Od(s){if(ic){for(s=s.memoizedState;s!==null;){var l=s.queue;l!==null&&(l.pending=null),s=s.next}ic=!1}xs=0,dt=Ie=Oe=null,kl=!1,ro=sc=0,Cl=null}function en(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return dt===null?Oe.memoizedState=dt=s:dt=dt.next=s,dt}function mt(){if(Ie===null){var s=Oe.alternate;s=s!==null?s.memoizedState:null}else s=Ie.next;var l=dt===null?Oe.memoizedState:dt.next;if(l!==null)dt=l,Ie=s;else{if(s===null)throw Oe.alternate===null?Error(n(467)):Error(n(310));Ie=s,s={memoizedState:Ie.memoizedState,baseState:Ie.baseState,baseQueue:Ie.baseQueue,queue:Ie.queue,next:null},dt===null?Oe.memoizedState=dt=s:dt=dt.next=s}return dt}function Md(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function lo(s){var l=ro;return ro+=1,Cl===null&&(Cl=[]),s=Xy(Cl,s,l),l=Oe,(dt===null?l.memoizedState:dt.next)===null&&(l=l.alternate,H.H=l===null||l.memoizedState===null?_b:Hb),s}function rc(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return lo(s);if(s.$$typeof===B)return Ht(s)}throw Error(n(438,String(s)))}function Ed(s){var l=null,u=Oe.updateQueue;if(u!==null&&(l=u.memoCache),l==null){var f=Oe.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(l={data:f.data.map(function(m){return m.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),u===null&&(u=Md(),Oe.updateQueue=u),u.memoCache=l,u=l.data[l.index],u===void 0)for(u=l.data[l.index]=Array(s),f=0;f<s;f++)u[f]=te;return l.index++,u}function Ui(s,l){return typeof l=="function"?l(s):l}function lc(s){var l=mt();return Rd(l,Ie,s)}function Rd(s,l,u){var f=s.queue;if(f===null)throw Error(n(311));f.lastRenderedReducer=u;var m=s.baseQueue,g=f.pending;if(g!==null){if(m!==null){var x=m.next;m.next=g.next,g.next=x}l.baseQueue=m=g,f.pending=null}if(g=s.baseState,m===null)s.memoizedState=g;else{l=m.next;var C=x=null,M=null,_=l,G=!1;do{var $=_.lane&-536870913;if($!==_.lane?(ze&$)===$:(xs&$)===$){var U=_.revertLane;if(U===0)M!==null&&(M=M.next={lane:0,revertLane:0,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null}),$===xl&&(G=!0);else if((xs&U)===U){_=_.next,U===xl&&(G=!0);continue}else $={lane:0,revertLane:_.revertLane,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},M===null?(C=M=$,x=g):M=M.next=$,Oe.lanes|=U,Os|=U;$=_.action,Ar&&u(g,$),g=_.hasEagerState?_.eagerState:u(g,$)}else U={lane:$,revertLane:_.revertLane,action:_.action,hasEagerState:_.hasEagerState,eagerState:_.eagerState,next:null},M===null?(C=M=U,x=g):M=M.next=U,Oe.lanes|=$,Os|=$;_=_.next}while(_!==null&&_!==l);if(M===null?x=g:M.next=C,!yn(g,s.memoizedState)&&(Ct=!0,G&&(u=Sl,u!==null)))throw u;s.memoizedState=g,s.baseState=x,s.baseQueue=M,f.lastRenderedState=g}return m===null&&(f.lanes=0),[s.memoizedState,f.dispatch]}function Dd(s){var l=mt(),u=l.queue;if(u===null)throw Error(n(311));u.lastRenderedReducer=s;var f=u.dispatch,m=u.pending,g=l.memoizedState;if(m!==null){u.pending=null;var x=m=m.next;do g=s(g,x.action),x=x.next;while(x!==m);yn(g,l.memoizedState)||(Ct=!0),l.memoizedState=g,l.baseQueue===null&&(l.baseState=g),u.lastRenderedState=g}return[g,f]}function ib(s,l,u){var f=Oe,m=mt(),g=Ue;if(g){if(u===void 0)throw Error(n(407));u=u()}else u=l();var x=!yn((Ie||m).memoizedState,u);x&&(m.memoizedState=u,Ct=!0),m=m.queue;var C=lb.bind(null,f,m,s);if(ao(2048,8,C,[s]),m.getSnapshot!==l||x||dt!==null&&dt.memoizedState.tag&1){if(f.flags|=2048,Al(9,ac(),rb.bind(null,f,m,u,l),null),Ze===null)throw Error(n(349));g||(xs&124)!==0||sb(f,l,u)}return u}function sb(s,l,u){s.flags|=16384,s={getSnapshot:l,value:u},l=Oe.updateQueue,l===null?(l=Md(),Oe.updateQueue=l,l.stores=[s]):(u=l.stores,u===null?l.stores=[s]:u.push(s))}function rb(s,l,u,f){l.value=u,l.getSnapshot=f,ab(l)&&ob(s)}function lb(s,l,u){return u(function(){ab(l)&&ob(s)})}function ab(s){var l=s.getSnapshot;s=s.value;try{var u=l();return!yn(s,u)}catch{return!0}}function ob(s){var l=gl(s,2);l!==null&&kn(l,s,2)}function Nd(s){var l=en();if(typeof s=="function"){var u=s;if(s=u(),Ar){ds(!0);try{u()}finally{ds(!1)}}}return l.memoizedState=l.baseState=s,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ui,lastRenderedState:s},l}function ub(s,l,u,f){return s.baseState=u,Rd(s,Ie,typeof f=="function"?f:Ui)}function LT(s,l,u,f,m){if(uc(s))throw Error(n(485));if(s=l.action,s!==null){var g={payload:m,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(x){g.listeners.push(x)}};H.T!==null?u(!0):g.isTransition=!1,f(g),u=l.pending,u===null?(g.next=l.pending=g,cb(l,g)):(g.next=u.next,l.pending=u.next=g)}}function cb(s,l){var u=l.action,f=l.payload,m=s.state;if(l.isTransition){var g=H.T,x={};H.T=x;try{var C=u(m,f),M=H.S;M!==null&&M(x,C),fb(s,l,C)}catch(_){Bd(s,l,_)}finally{H.T=g}}else try{g=u(m,f),fb(s,l,g)}catch(_){Bd(s,l,_)}}function fb(s,l,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(f){hb(s,l,f)},function(f){return Bd(s,l,f)}):hb(s,l,u)}function hb(s,l,u){l.status="fulfilled",l.value=u,db(l),s.state=u,l=s.pending,l!==null&&(u=l.next,u===l?s.pending=null:(u=u.next,l.next=u,cb(s,u)))}function Bd(s,l,u){var f=s.pending;if(s.pending=null,f!==null){f=f.next;do l.status="rejected",l.reason=u,db(l),l=l.next;while(l!==f)}s.action=null}function db(s){s=s.listeners;for(var l=0;l<s.length;l++)(0,s[l])()}function mb(s,l){return l}function pb(s,l){if(Ue){var u=Ze.formState;if(u!==null){e:{var f=Oe;if(Ue){if(rt){t:{for(var m=rt,g=di;m.nodeType!==8;){if(!g){m=null;break t}if(m=Zn(m.nextSibling),m===null){m=null;break t}}g=m.data,m=g==="F!"||g==="F"?m:null}if(m){rt=Zn(m.nextSibling),f=m.data==="F!";break e}}Sr(f)}f=!1}f&&(l=u[0])}}return u=en(),u.memoizedState=u.baseState=l,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:mb,lastRenderedState:l},u.queue=f,u=Lb.bind(null,Oe,f),f.dispatch=u,f=Nd(!1),g=Hd.bind(null,Oe,!1,f.queue),f=en(),m={state:l,dispatch:null,action:s,pending:null},f.queue=m,u=LT.bind(null,Oe,m,g,u),m.dispatch=u,f.memoizedState=s,[l,u,!1]}function gb(s){var l=mt();return yb(l,Ie,s)}function yb(s,l,u){if(l=Rd(s,l,mb)[0],s=lc(Ui)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var f=lo(l)}catch(x){throw x===eo?ec:x}else f=l;l=mt();var m=l.queue,g=m.dispatch;return u!==l.memoizedState&&(Oe.flags|=2048,Al(9,ac(),jT.bind(null,m,u),null)),[f,g,s]}function jT(s,l){s.action=l}function bb(s){var l=mt(),u=Ie;if(u!==null)return yb(l,u,s);mt(),l=l.memoizedState,u=mt();var f=u.queue.dispatch;return u.memoizedState=s,[l,f,!1]}function Al(s,l,u,f){return s={tag:s,create:u,deps:f,inst:l,next:null},l=Oe.updateQueue,l===null&&(l=Md(),Oe.updateQueue=l),u=l.lastEffect,u===null?l.lastEffect=s.next=s:(f=u.next,u.next=s,s.next=f,l.lastEffect=s),s}function ac(){return{destroy:void 0,resource:void 0}}function vb(){return mt().memoizedState}function oc(s,l,u,f){var m=en();f=f===void 0?null:f,Oe.flags|=s,m.memoizedState=Al(1|l,ac(),u,f)}function ao(s,l,u,f){var m=mt();f=f===void 0?null:f;var g=m.memoizedState.inst;Ie!==null&&f!==null&&kd(f,Ie.memoizedState.deps)?m.memoizedState=Al(l,g,u,f):(Oe.flags|=s,m.memoizedState=Al(1|l,g,u,f))}function xb(s,l){oc(8390656,8,s,l)}function Sb(s,l){ao(2048,8,s,l)}function wb(s,l){return ao(4,2,s,l)}function kb(s,l){return ao(4,4,s,l)}function Cb(s,l){if(typeof l=="function"){s=s();var u=l(s);return function(){typeof u=="function"?u():l(null)}}if(l!=null)return s=s(),l.current=s,function(){l.current=null}}function Ab(s,l,u){u=u!=null?u.concat([s]):null,ao(4,4,Cb.bind(null,l,s),u)}function Ld(){}function Tb(s,l){var u=mt();l=l===void 0?null:l;var f=u.memoizedState;return l!==null&&kd(l,f[1])?f[0]:(u.memoizedState=[s,l],s)}function Ob(s,l){var u=mt();l=l===void 0?null:l;var f=u.memoizedState;if(l!==null&&kd(l,f[1]))return f[0];if(f=s(),Ar){ds(!0);try{s()}finally{ds(!1)}}return u.memoizedState=[f,l],f}function jd(s,l,u){return u===void 0||(xs&1073741824)!==0?s.memoizedState=l:(s.memoizedState=u,s=Rv(),Oe.lanes|=s,Os|=s,u)}function Mb(s,l,u,f){return yn(u,l)?u:wl.current!==null?(s=jd(s,u,f),yn(s,l)||(Ct=!0),s):(xs&42)===0?(Ct=!0,s.memoizedState=u):(s=Rv(),Oe.lanes|=s,Os|=s,l)}function Eb(s,l,u,f,m){var g=K.p;K.p=g!==0&&8>g?g:8;var x=H.T,C={};H.T=C,Hd(s,!1,l,u);try{var M=m(),_=H.S;if(_!==null&&_(C,M),M!==null&&typeof M=="object"&&typeof M.then=="function"){var G=DT(M,f);oo(s,l,G,wn(s))}else oo(s,l,f,wn(s))}catch($){oo(s,l,{then:function(){},status:"rejected",reason:$},wn())}finally{K.p=g,H.T=x}}function zT(){}function zd(s,l,u,f){if(s.tag!==5)throw Error(n(476));var m=Rb(s).queue;Eb(s,m,l,W,u===null?zT:function(){return Db(s),u(f)})}function Rb(s){var l=s.memoizedState;if(l!==null)return l;l={memoizedState:W,baseState:W,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ui,lastRenderedState:W},next:null};var u={};return l.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Ui,lastRenderedState:u},next:null},s.memoizedState=l,s=s.alternate,s!==null&&(s.memoizedState=l),l}function Db(s){var l=Rb(s).next.queue;oo(s,l,{},wn())}function _d(){return Ht(Oo)}function Nb(){return mt().memoizedState}function Bb(){return mt().memoizedState}function _T(s){for(var l=s.return;l!==null;){switch(l.tag){case 24:case 3:var u=wn();s=bs(u);var f=vs(l,s,u);f!==null&&(kn(f,l,u),no(f,l,u)),l={cache:dd()},s.payload=l;return}l=l.return}}function HT(s,l,u){var f=wn();u={lane:f,revertLane:0,action:u,hasEagerState:!1,eagerState:null,next:null},uc(s)?jb(l,u):(u=id(s,l,u,f),u!==null&&(kn(u,s,f),zb(u,l,f)))}function Lb(s,l,u){var f=wn();oo(s,l,u,f)}function oo(s,l,u,f){var m={lane:f,revertLane:0,action:u,hasEagerState:!1,eagerState:null,next:null};if(uc(s))jb(l,m);else{var g=s.alternate;if(s.lanes===0&&(g===null||g.lanes===0)&&(g=l.lastRenderedReducer,g!==null))try{var x=l.lastRenderedState,C=g(x,u);if(m.hasEagerState=!0,m.eagerState=C,yn(C,x))return Fu(s,l,m,0),Ze===null&&Gu(),!1}catch{}finally{}if(u=id(s,l,m,f),u!==null)return kn(u,s,f),zb(u,l,f),!0}return!1}function Hd(s,l,u,f){if(f={lane:2,revertLane:gm(),action:f,hasEagerState:!1,eagerState:null,next:null},uc(s)){if(l)throw Error(n(479))}else l=id(s,u,f,2),l!==null&&kn(l,s,2)}function uc(s){var l=s.alternate;return s===Oe||l!==null&&l===Oe}function jb(s,l){kl=ic=!0;var u=s.pending;u===null?l.next=l:(l.next=u.next,u.next=l),s.pending=l}function zb(s,l,u){if((u&4194048)!==0){var f=l.lanes;f&=s.pendingLanes,u|=f,l.lanes=u,I0(s,u)}}var cc={readContext:Ht,use:rc,useCallback:ut,useContext:ut,useEffect:ut,useImperativeHandle:ut,useLayoutEffect:ut,useInsertionEffect:ut,useMemo:ut,useReducer:ut,useRef:ut,useState:ut,useDebugValue:ut,useDeferredValue:ut,useTransition:ut,useSyncExternalStore:ut,useId:ut,useHostTransitionStatus:ut,useFormState:ut,useActionState:ut,useOptimistic:ut,useMemoCache:ut,useCacheRefresh:ut},_b={readContext:Ht,use:rc,useCallback:function(s,l){return en().memoizedState=[s,l===void 0?null:l],s},useContext:Ht,useEffect:xb,useImperativeHandle:function(s,l,u){u=u!=null?u.concat([s]):null,oc(4194308,4,Cb.bind(null,l,s),u)},useLayoutEffect:function(s,l){return oc(4194308,4,s,l)},useInsertionEffect:function(s,l){oc(4,2,s,l)},useMemo:function(s,l){var u=en();l=l===void 0?null:l;var f=s();if(Ar){ds(!0);try{s()}finally{ds(!1)}}return u.memoizedState=[f,l],f},useReducer:function(s,l,u){var f=en();if(u!==void 0){var m=u(l);if(Ar){ds(!0);try{u(l)}finally{ds(!1)}}}else m=l;return f.memoizedState=f.baseState=m,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:m},f.queue=s,s=s.dispatch=HT.bind(null,Oe,s),[f.memoizedState,s]},useRef:function(s){var l=en();return s={current:s},l.memoizedState=s},useState:function(s){s=Nd(s);var l=s.queue,u=Lb.bind(null,Oe,l);return l.dispatch=u,[s.memoizedState,u]},useDebugValue:Ld,useDeferredValue:function(s,l){var u=en();return jd(u,s,l)},useTransition:function(){var s=Nd(!1);return s=Eb.bind(null,Oe,s.queue,!0,!1),en().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,l,u){var f=Oe,m=en();if(Ue){if(u===void 0)throw Error(n(407));u=u()}else{if(u=l(),Ze===null)throw Error(n(349));(ze&124)!==0||sb(f,l,u)}m.memoizedState=u;var g={value:u,getSnapshot:l};return m.queue=g,xb(lb.bind(null,f,g,s),[s]),f.flags|=2048,Al(9,ac(),rb.bind(null,f,g,u,l),null),u},useId:function(){var s=en(),l=Ze.identifierPrefix;if(Ue){var u=zi,f=ji;u=(f&~(1<<32-gn(f)-1)).toString(32)+u,l="«"+l+"R"+u,u=sc++,0<u&&(l+="H"+u.toString(32)),l+="»"}else u=NT++,l="«"+l+"r"+u.toString(32)+"»";return s.memoizedState=l},useHostTransitionStatus:_d,useFormState:pb,useActionState:pb,useOptimistic:function(s){var l=en();l.memoizedState=l.baseState=s;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=u,l=Hd.bind(null,Oe,!0,u),u.dispatch=l,[s,l]},useMemoCache:Ed,useCacheRefresh:function(){return en().memoizedState=_T.bind(null,Oe)}},Hb={readContext:Ht,use:rc,useCallback:Tb,useContext:Ht,useEffect:Sb,useImperativeHandle:Ab,useInsertionEffect:wb,useLayoutEffect:kb,useMemo:Ob,useReducer:lc,useRef:vb,useState:function(){return lc(Ui)},useDebugValue:Ld,useDeferredValue:function(s,l){var u=mt();return Mb(u,Ie.memoizedState,s,l)},useTransition:function(){var s=lc(Ui)[0],l=mt().memoizedState;return[typeof s=="boolean"?s:lo(s),l]},useSyncExternalStore:ib,useId:Nb,useHostTransitionStatus:_d,useFormState:gb,useActionState:gb,useOptimistic:function(s,l){var u=mt();return ub(u,Ie,s,l)},useMemoCache:Ed,useCacheRefresh:Bb},UT={readContext:Ht,use:rc,useCallback:Tb,useContext:Ht,useEffect:Sb,useImperativeHandle:Ab,useInsertionEffect:wb,useLayoutEffect:kb,useMemo:Ob,useReducer:Dd,useRef:vb,useState:function(){return Dd(Ui)},useDebugValue:Ld,useDeferredValue:function(s,l){var u=mt();return Ie===null?jd(u,s,l):Mb(u,Ie.memoizedState,s,l)},useTransition:function(){var s=Dd(Ui)[0],l=mt().memoizedState;return[typeof s=="boolean"?s:lo(s),l]},useSyncExternalStore:ib,useId:Nb,useHostTransitionStatus:_d,useFormState:bb,useActionState:bb,useOptimistic:function(s,l){var u=mt();return Ie!==null?ub(u,Ie,s,l):(u.baseState=s,[s,u.queue.dispatch])},useMemoCache:Ed,useCacheRefresh:Bb},Tl=null,uo=0;function fc(s){var l=uo;return uo+=1,Tl===null&&(Tl=[]),Xy(Tl,s,l)}function co(s,l){l=l.props.ref,s.ref=l!==void 0?l:null}function hc(s,l){throw l.$$typeof===y?Error(n(525)):(s=Object.prototype.toString.call(l),Error(n(31,s==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":s)))}function Ub(s){var l=s._init;return l(s._payload)}function Pb(s){function l(L,N){if(s){var z=L.deletions;z===null?(L.deletions=[N],L.flags|=16):z.push(N)}}function u(L,N){if(!s)return null;for(;N!==null;)l(L,N),N=N.sibling;return null}function f(L){for(var N=new Map;L!==null;)L.key!==null?N.set(L.key,L):N.set(L.index,L),L=L.sibling;return N}function m(L,N){return L=Li(L,N),L.index=0,L.sibling=null,L}function g(L,N,z){return L.index=z,s?(z=L.alternate,z!==null?(z=z.index,z<N?(L.flags|=67108866,N):z):(L.flags|=67108866,N)):(L.flags|=1048576,N)}function x(L){return s&&L.alternate===null&&(L.flags|=67108866),L}function C(L,N,z,F){return N===null||N.tag!==6?(N=rd(z,L.mode,F),N.return=L,N):(N=m(N,z),N.return=L,N)}function M(L,N,z,F){var ue=z.type;return ue===w?G(L,N,z.props.children,F,z.key):N!==null&&(N.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===q&&Ub(ue)===N.type)?(N=m(N,z.props),co(N,z),N.return=L,N):(N=Ku(z.type,z.key,z.props,null,L.mode,F),co(N,z),N.return=L,N)}function _(L,N,z,F){return N===null||N.tag!==4||N.stateNode.containerInfo!==z.containerInfo||N.stateNode.implementation!==z.implementation?(N=ld(z,L.mode,F),N.return=L,N):(N=m(N,z.children||[]),N.return=L,N)}function G(L,N,z,F,ue){return N===null||N.tag!==7?(N=yr(z,L.mode,F,ue),N.return=L,N):(N=m(N,z),N.return=L,N)}function $(L,N,z){if(typeof N=="string"&&N!==""||typeof N=="number"||typeof N=="bigint")return N=rd(""+N,L.mode,z),N.return=L,N;if(typeof N=="object"&&N!==null){switch(N.$$typeof){case b:return z=Ku(N.type,N.key,N.props,null,L.mode,z),co(z,N),z.return=L,z;case v:return N=ld(N,L.mode,z),N.return=L,N;case q:var F=N._init;return N=F(N._payload),$(L,N,z)}if(me(N)||ne(N))return N=yr(N,L.mode,z,null),N.return=L,N;if(typeof N.then=="function")return $(L,fc(N),z);if(N.$$typeof===B)return $(L,Zu(L,N),z);hc(L,N)}return null}function U(L,N,z,F){var ue=N!==null?N.key:null;if(typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint")return ue!==null?null:C(L,N,""+z,F);if(typeof z=="object"&&z!==null){switch(z.$$typeof){case b:return z.key===ue?M(L,N,z,F):null;case v:return z.key===ue?_(L,N,z,F):null;case q:return ue=z._init,z=ue(z._payload),U(L,N,z,F)}if(me(z)||ne(z))return ue!==null?null:G(L,N,z,F,null);if(typeof z.then=="function")return U(L,N,fc(z),F);if(z.$$typeof===B)return U(L,N,Zu(L,z),F);hc(L,z)}return null}function P(L,N,z,F,ue){if(typeof F=="string"&&F!==""||typeof F=="number"||typeof F=="bigint")return L=L.get(z)||null,C(N,L,""+F,ue);if(typeof F=="object"&&F!==null){switch(F.$$typeof){case b:return L=L.get(F.key===null?z:F.key)||null,M(N,L,F,ue);case v:return L=L.get(F.key===null?z:F.key)||null,_(N,L,F,ue);case q:var Ee=F._init;return F=Ee(F._payload),P(L,N,z,F,ue)}if(me(F)||ne(F))return L=L.get(z)||null,G(N,L,F,ue,null);if(typeof F.then=="function")return P(L,N,z,fc(F),ue);if(F.$$typeof===B)return P(L,N,z,Zu(N,F),ue);hc(N,F)}return null}function we(L,N,z,F){for(var ue=null,Ee=null,de=N,Se=N=0,Tt=null;de!==null&&Se<z.length;Se++){de.index>Se?(Tt=de,de=null):Tt=de.sibling;var _e=U(L,de,z[Se],F);if(_e===null){de===null&&(de=Tt);break}s&&de&&_e.alternate===null&&l(L,de),N=g(_e,N,Se),Ee===null?ue=_e:Ee.sibling=_e,Ee=_e,de=Tt}if(Se===z.length)return u(L,de),Ue&&vr(L,Se),ue;if(de===null){for(;Se<z.length;Se++)de=$(L,z[Se],F),de!==null&&(N=g(de,N,Se),Ee===null?ue=de:Ee.sibling=de,Ee=de);return Ue&&vr(L,Se),ue}for(de=f(de);Se<z.length;Se++)Tt=P(de,L,Se,z[Se],F),Tt!==null&&(s&&Tt.alternate!==null&&de.delete(Tt.key===null?Se:Tt.key),N=g(Tt,N,Se),Ee===null?ue=Tt:Ee.sibling=Tt,Ee=Tt);return s&&de.forEach(function(zs){return l(L,zs)}),Ue&&vr(L,Se),ue}function ve(L,N,z,F){if(z==null)throw Error(n(151));for(var ue=null,Ee=null,de=N,Se=N=0,Tt=null,_e=z.next();de!==null&&!_e.done;Se++,_e=z.next()){de.index>Se?(Tt=de,de=null):Tt=de.sibling;var zs=U(L,de,_e.value,F);if(zs===null){de===null&&(de=Tt);break}s&&de&&zs.alternate===null&&l(L,de),N=g(zs,N,Se),Ee===null?ue=zs:Ee.sibling=zs,Ee=zs,de=Tt}if(_e.done)return u(L,de),Ue&&vr(L,Se),ue;if(de===null){for(;!_e.done;Se++,_e=z.next())_e=$(L,_e.value,F),_e!==null&&(N=g(_e,N,Se),Ee===null?ue=_e:Ee.sibling=_e,Ee=_e);return Ue&&vr(L,Se),ue}for(de=f(de);!_e.done;Se++,_e=z.next())_e=P(de,L,Se,_e.value,F),_e!==null&&(s&&_e.alternate!==null&&de.delete(_e.key===null?Se:_e.key),N=g(_e,N,Se),Ee===null?ue=_e:Ee.sibling=_e,Ee=_e);return s&&de.forEach(function(PO){return l(L,PO)}),Ue&&vr(L,Se),ue}function Fe(L,N,z,F){if(typeof z=="object"&&z!==null&&z.type===w&&z.key===null&&(z=z.props.children),typeof z=="object"&&z!==null){switch(z.$$typeof){case b:e:{for(var ue=z.key;N!==null;){if(N.key===ue){if(ue=z.type,ue===w){if(N.tag===7){u(L,N.sibling),F=m(N,z.props.children),F.return=L,L=F;break e}}else if(N.elementType===ue||typeof ue=="object"&&ue!==null&&ue.$$typeof===q&&Ub(ue)===N.type){u(L,N.sibling),F=m(N,z.props),co(F,z),F.return=L,L=F;break e}u(L,N);break}else l(L,N);N=N.sibling}z.type===w?(F=yr(z.props.children,L.mode,F,z.key),F.return=L,L=F):(F=Ku(z.type,z.key,z.props,null,L.mode,F),co(F,z),F.return=L,L=F)}return x(L);case v:e:{for(ue=z.key;N!==null;){if(N.key===ue)if(N.tag===4&&N.stateNode.containerInfo===z.containerInfo&&N.stateNode.implementation===z.implementation){u(L,N.sibling),F=m(N,z.children||[]),F.return=L,L=F;break e}else{u(L,N);break}else l(L,N);N=N.sibling}F=ld(z,L.mode,F),F.return=L,L=F}return x(L);case q:return ue=z._init,z=ue(z._payload),Fe(L,N,z,F)}if(me(z))return we(L,N,z,F);if(ne(z)){if(ue=ne(z),typeof ue!="function")throw Error(n(150));return z=ue.call(z),ve(L,N,z,F)}if(typeof z.then=="function")return Fe(L,N,fc(z),F);if(z.$$typeof===B)return Fe(L,N,Zu(L,z),F);hc(L,z)}return typeof z=="string"&&z!==""||typeof z=="number"||typeof z=="bigint"?(z=""+z,N!==null&&N.tag===6?(u(L,N.sibling),F=m(N,z),F.return=L,L=F):(u(L,N),F=rd(z,L.mode,F),F.return=L,L=F),x(L)):u(L,N)}return function(L,N,z,F){try{uo=0;var ue=Fe(L,N,z,F);return Tl=null,ue}catch(de){if(de===eo||de===ec)throw de;var Ee=bn(29,de,null,L.mode);return Ee.lanes=F,Ee.return=L,Ee}finally{}}}var Ol=Pb(!0),qb=Pb(!1),zn=X(null),mi=null;function Ss(s){var l=s.alternate;Z(yt,yt.current&1),Z(zn,s),mi===null&&(l===null||wl.current!==null||l.memoizedState!==null)&&(mi=s)}function Vb(s){if(s.tag===22){if(Z(yt,yt.current),Z(zn,s),mi===null){var l=s.alternate;l!==null&&l.memoizedState!==null&&(mi=s)}}else ws()}function ws(){Z(yt,yt.current),Z(zn,zn.current)}function Pi(s){ie(zn),mi===s&&(mi=null),ie(yt)}var yt=X(0);function dc(s){for(var l=s;l!==null;){if(l.tag===13){var u=l.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||u.data==="$?"||Mm(u)))return l}else if(l.tag===19&&l.memoizedProps.revealOrder!==void 0){if((l.flags&128)!==0)return l}else if(l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}function Ud(s,l,u,f){l=s.memoizedState,u=u(f,l),u=u==null?l:p({},l,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}var Pd={enqueueSetState:function(s,l,u){s=s._reactInternals;var f=wn(),m=bs(f);m.payload=l,u!=null&&(m.callback=u),l=vs(s,m,f),l!==null&&(kn(l,s,f),no(l,s,f))},enqueueReplaceState:function(s,l,u){s=s._reactInternals;var f=wn(),m=bs(f);m.tag=1,m.payload=l,u!=null&&(m.callback=u),l=vs(s,m,f),l!==null&&(kn(l,s,f),no(l,s,f))},enqueueForceUpdate:function(s,l){s=s._reactInternals;var u=wn(),f=bs(u);f.tag=2,l!=null&&(f.callback=l),l=vs(s,f,u),l!==null&&(kn(l,s,u),no(l,s,u))}};function Qb(s,l,u,f,m,g,x){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(f,g,x):l.prototype&&l.prototype.isPureReactComponent?!Fa(u,f)||!Fa(m,g):!0}function Ib(s,l,u,f){s=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(u,f),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(u,f),l.state!==s&&Pd.enqueueReplaceState(l,l.state,null)}function Tr(s,l){var u=l;if("ref"in l){u={};for(var f in l)f!=="ref"&&(u[f]=l[f])}if(s=s.defaultProps){u===l&&(u=p({},u));for(var m in s)u[m]===void 0&&(u[m]=s[m])}return u}var mc=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)};function Gb(s){mc(s)}function Fb(s){console.error(s)}function Yb(s){mc(s)}function pc(s,l){try{var u=s.onUncaughtError;u(l.value,{componentStack:l.stack})}catch(f){setTimeout(function(){throw f})}}function Kb(s,l,u){try{var f=s.onCaughtError;f(u.value,{componentStack:u.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function qd(s,l,u){return u=bs(u),u.tag=3,u.payload={element:null},u.callback=function(){pc(s,l)},u}function Xb(s){return s=bs(s),s.tag=3,s}function Wb(s,l,u,f){var m=u.type.getDerivedStateFromError;if(typeof m=="function"){var g=f.value;s.payload=function(){return m(g)},s.callback=function(){Kb(l,u,f)}}var x=u.stateNode;x!==null&&typeof x.componentDidCatch=="function"&&(s.callback=function(){Kb(l,u,f),typeof m!="function"&&(Ms===null?Ms=new Set([this]):Ms.add(this));var C=f.stack;this.componentDidCatch(f.value,{componentStack:C!==null?C:""})})}function PT(s,l,u,f,m){if(u.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(l=u.alternate,l!==null&&$a(l,u,m,!0),u=zn.current,u!==null){switch(u.tag){case 13:return mi===null?fm():u.alternate===null&&lt===0&&(lt=3),u.flags&=-257,u.flags|=65536,u.lanes=m,f===gd?u.flags|=16384:(l=u.updateQueue,l===null?u.updateQueue=new Set([f]):l.add(f),dm(s,f,m)),!1;case 22:return u.flags|=65536,f===gd?u.flags|=16384:(l=u.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([f])},u.updateQueue=l):(u=l.retryQueue,u===null?l.retryQueue=new Set([f]):u.add(f)),dm(s,f,m)),!1}throw Error(n(435,u.tag))}return dm(s,f,m),fm(),!1}if(Ue)return l=zn.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=m,f!==ud&&(s=Error(n(422),{cause:f}),Wa(Nn(s,u)))):(f!==ud&&(l=Error(n(423),{cause:f}),Wa(Nn(l,u))),s=s.current.alternate,s.flags|=65536,m&=-m,s.lanes|=m,f=Nn(f,u),m=qd(s.stateNode,f,m),vd(s,m),lt!==4&&(lt=2)),!1;var g=Error(n(520),{cause:f});if(g=Nn(g,u),bo===null?bo=[g]:bo.push(g),lt!==4&&(lt=2),l===null)return!0;f=Nn(f,u),u=l;do{switch(u.tag){case 3:return u.flags|=65536,s=m&-m,u.lanes|=s,s=qd(u.stateNode,f,s),vd(u,s),!1;case 1:if(l=u.type,g=u.stateNode,(u.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||g!==null&&typeof g.componentDidCatch=="function"&&(Ms===null||!Ms.has(g))))return u.flags|=65536,m&=-m,u.lanes|=m,m=Xb(m),Wb(m,s,u,f),vd(u,m),!1}u=u.return}while(u!==null);return!1}var $b=Error(n(461)),Ct=!1;function Et(s,l,u,f){l.child=s===null?qb(l,null,u,f):Ol(l,s.child,u,f)}function Zb(s,l,u,f,m){u=u.render;var g=l.ref;if("ref"in f){var x={};for(var C in f)C!=="ref"&&(x[C]=f[C])}else x=f;return kr(l),f=Cd(s,l,u,x,g,m),C=Ad(),s!==null&&!Ct?(Td(s,l,m),qi(s,l,m)):(Ue&&C&&ad(l),l.flags|=1,Et(s,l,f,m),l.child)}function Jb(s,l,u,f,m){if(s===null){var g=u.type;return typeof g=="function"&&!sd(g)&&g.defaultProps===void 0&&u.compare===null?(l.tag=15,l.type=g,ev(s,l,g,f,m)):(s=Ku(u.type,null,f,l,l.mode,m),s.ref=l.ref,s.return=l,l.child=s)}if(g=s.child,!Xd(s,m)){var x=g.memoizedProps;if(u=u.compare,u=u!==null?u:Fa,u(x,f)&&s.ref===l.ref)return qi(s,l,m)}return l.flags|=1,s=Li(g,f),s.ref=l.ref,s.return=l,l.child=s}function ev(s,l,u,f,m){if(s!==null){var g=s.memoizedProps;if(Fa(g,f)&&s.ref===l.ref)if(Ct=!1,l.pendingProps=f=g,Xd(s,m))(s.flags&131072)!==0&&(Ct=!0);else return l.lanes=s.lanes,qi(s,l,m)}return Vd(s,l,u,f,m)}function tv(s,l,u){var f=l.pendingProps,m=f.children,g=s!==null?s.memoizedState:null;if(f.mode==="hidden"){if((l.flags&128)!==0){if(f=g!==null?g.baseLanes|u:u,s!==null){for(m=l.child=s.child,g=0;m!==null;)g=g|m.lanes|m.childLanes,m=m.sibling;l.childLanes=g&~f}else l.childLanes=0,l.child=null;return nv(s,l,f,u)}if((u&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},s!==null&&Ju(l,g!==null?g.cachePool:null),g!==null?eb(l,g):Sd(),Vb(l);else return l.lanes=l.childLanes=536870912,nv(s,l,g!==null?g.baseLanes|u:u,u)}else g!==null?(Ju(l,g.cachePool),eb(l,g),ws(),l.memoizedState=null):(s!==null&&Ju(l,null),Sd(),ws());return Et(s,l,m,u),l.child}function nv(s,l,u,f){var m=pd();return m=m===null?null:{parent:gt._currentValue,pool:m},l.memoizedState={baseLanes:u,cachePool:m},s!==null&&Ju(l,null),Sd(),Vb(l),s!==null&&$a(s,l,f,!0),null}function gc(s,l){var u=l.ref;if(u===null)s!==null&&s.ref!==null&&(l.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(n(284));(s===null||s.ref!==u)&&(l.flags|=4194816)}}function Vd(s,l,u,f,m){return kr(l),u=Cd(s,l,u,f,void 0,m),f=Ad(),s!==null&&!Ct?(Td(s,l,m),qi(s,l,m)):(Ue&&f&&ad(l),l.flags|=1,Et(s,l,u,m),l.child)}function iv(s,l,u,f,m,g){return kr(l),l.updateQueue=null,u=nb(l,f,u,m),tb(s),f=Ad(),s!==null&&!Ct?(Td(s,l,g),qi(s,l,g)):(Ue&&f&&ad(l),l.flags|=1,Et(s,l,u,g),l.child)}function sv(s,l,u,f,m){if(kr(l),l.stateNode===null){var g=yl,x=u.contextType;typeof x=="object"&&x!==null&&(g=Ht(x)),g=new u(f,g),l.memoizedState=g.state!==null&&g.state!==void 0?g.state:null,g.updater=Pd,l.stateNode=g,g._reactInternals=l,g=l.stateNode,g.props=f,g.state=l.memoizedState,g.refs={},yd(l),x=u.contextType,g.context=typeof x=="object"&&x!==null?Ht(x):yl,g.state=l.memoizedState,x=u.getDerivedStateFromProps,typeof x=="function"&&(Ud(l,u,x,f),g.state=l.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof g.getSnapshotBeforeUpdate=="function"||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(x=g.state,typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount(),x!==g.state&&Pd.enqueueReplaceState(g,g.state,null),so(l,f,g,m),io(),g.state=l.memoizedState),typeof g.componentDidMount=="function"&&(l.flags|=4194308),f=!0}else if(s===null){g=l.stateNode;var C=l.memoizedProps,M=Tr(u,C);g.props=M;var _=g.context,G=u.contextType;x=yl,typeof G=="object"&&G!==null&&(x=Ht(G));var $=u.getDerivedStateFromProps;G=typeof $=="function"||typeof g.getSnapshotBeforeUpdate=="function",C=l.pendingProps!==C,G||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(C||_!==x)&&Ib(l,g,f,x),ys=!1;var U=l.memoizedState;g.state=U,so(l,f,g,m),io(),_=l.memoizedState,C||U!==_||ys?(typeof $=="function"&&(Ud(l,u,$,f),_=l.memoizedState),(M=ys||Qb(l,u,M,f,U,_,x))?(G||typeof g.UNSAFE_componentWillMount!="function"&&typeof g.componentWillMount!="function"||(typeof g.componentWillMount=="function"&&g.componentWillMount(),typeof g.UNSAFE_componentWillMount=="function"&&g.UNSAFE_componentWillMount()),typeof g.componentDidMount=="function"&&(l.flags|=4194308)):(typeof g.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=f,l.memoizedState=_),g.props=f,g.state=_,g.context=x,f=M):(typeof g.componentDidMount=="function"&&(l.flags|=4194308),f=!1)}else{g=l.stateNode,bd(s,l),x=l.memoizedProps,G=Tr(u,x),g.props=G,$=l.pendingProps,U=g.context,_=u.contextType,M=yl,typeof _=="object"&&_!==null&&(M=Ht(_)),C=u.getDerivedStateFromProps,(_=typeof C=="function"||typeof g.getSnapshotBeforeUpdate=="function")||typeof g.UNSAFE_componentWillReceiveProps!="function"&&typeof g.componentWillReceiveProps!="function"||(x!==$||U!==M)&&Ib(l,g,f,M),ys=!1,U=l.memoizedState,g.state=U,so(l,f,g,m),io();var P=l.memoizedState;x!==$||U!==P||ys||s!==null&&s.dependencies!==null&&$u(s.dependencies)?(typeof C=="function"&&(Ud(l,u,C,f),P=l.memoizedState),(G=ys||Qb(l,u,G,f,U,P,M)||s!==null&&s.dependencies!==null&&$u(s.dependencies))?(_||typeof g.UNSAFE_componentWillUpdate!="function"&&typeof g.componentWillUpdate!="function"||(typeof g.componentWillUpdate=="function"&&g.componentWillUpdate(f,P,M),typeof g.UNSAFE_componentWillUpdate=="function"&&g.UNSAFE_componentWillUpdate(f,P,M)),typeof g.componentDidUpdate=="function"&&(l.flags|=4),typeof g.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof g.componentDidUpdate!="function"||x===s.memoizedProps&&U===s.memoizedState||(l.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||x===s.memoizedProps&&U===s.memoizedState||(l.flags|=1024),l.memoizedProps=f,l.memoizedState=P),g.props=f,g.state=P,g.context=M,f=G):(typeof g.componentDidUpdate!="function"||x===s.memoizedProps&&U===s.memoizedState||(l.flags|=4),typeof g.getSnapshotBeforeUpdate!="function"||x===s.memoizedProps&&U===s.memoizedState||(l.flags|=1024),f=!1)}return g=f,gc(s,l),f=(l.flags&128)!==0,g||f?(g=l.stateNode,u=f&&typeof u.getDerivedStateFromError!="function"?null:g.render(),l.flags|=1,s!==null&&f?(l.child=Ol(l,s.child,null,m),l.child=Ol(l,null,u,m)):Et(s,l,u,m),l.memoizedState=g.state,s=l.child):s=qi(s,l,m),s}function rv(s,l,u,f){return Xa(),l.flags|=256,Et(s,l,u,f),l.child}var Qd={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Id(s){return{baseLanes:s,cachePool:Fy()}}function Gd(s,l,u){return s=s!==null?s.childLanes&~u:0,l&&(s|=_n),s}function lv(s,l,u){var f=l.pendingProps,m=!1,g=(l.flags&128)!==0,x;if((x=g)||(x=s!==null&&s.memoizedState===null?!1:(yt.current&2)!==0),x&&(m=!0,l.flags&=-129),x=(l.flags&32)!==0,l.flags&=-33,s===null){if(Ue){if(m?Ss(l):ws(),Ue){var C=rt,M;if(M=C){e:{for(M=C,C=di;M.nodeType!==8;){if(!C){C=null;break e}if(M=Zn(M.nextSibling),M===null){C=null;break e}}C=M}C!==null?(l.memoizedState={dehydrated:C,treeContext:br!==null?{id:ji,overflow:zi}:null,retryLane:536870912,hydrationErrors:null},M=bn(18,null,null,0),M.stateNode=C,M.return=l,l.child=M,Gt=l,rt=null,M=!0):M=!1}M||Sr(l)}if(C=l.memoizedState,C!==null&&(C=C.dehydrated,C!==null))return Mm(C)?l.lanes=32:l.lanes=536870912,null;Pi(l)}return C=f.children,f=f.fallback,m?(ws(),m=l.mode,C=yc({mode:"hidden",children:C},m),f=yr(f,m,u,null),C.return=l,f.return=l,C.sibling=f,l.child=C,m=l.child,m.memoizedState=Id(u),m.childLanes=Gd(s,x,u),l.memoizedState=Qd,f):(Ss(l),Fd(l,C))}if(M=s.memoizedState,M!==null&&(C=M.dehydrated,C!==null)){if(g)l.flags&256?(Ss(l),l.flags&=-257,l=Yd(s,l,u)):l.memoizedState!==null?(ws(),l.child=s.child,l.flags|=128,l=null):(ws(),m=f.fallback,C=l.mode,f=yc({mode:"visible",children:f.children},C),m=yr(m,C,u,null),m.flags|=2,f.return=l,m.return=l,f.sibling=m,l.child=f,Ol(l,s.child,null,u),f=l.child,f.memoizedState=Id(u),f.childLanes=Gd(s,x,u),l.memoizedState=Qd,l=m);else if(Ss(l),Mm(C)){if(x=C.nextSibling&&C.nextSibling.dataset,x)var _=x.dgst;x=_,f=Error(n(419)),f.stack="",f.digest=x,Wa({value:f,source:null,stack:null}),l=Yd(s,l,u)}else if(Ct||$a(s,l,u,!1),x=(u&s.childLanes)!==0,Ct||x){if(x=Ze,x!==null&&(f=u&-u,f=(f&42)!==0?1:Eh(f),f=(f&(x.suspendedLanes|u))!==0?0:f,f!==0&&f!==M.retryLane))throw M.retryLane=f,gl(s,f),kn(x,s,f),$b;C.data==="$?"||fm(),l=Yd(s,l,u)}else C.data==="$?"?(l.flags|=192,l.child=s.child,l=null):(s=M.treeContext,rt=Zn(C.nextSibling),Gt=l,Ue=!0,xr=null,di=!1,s!==null&&(Ln[jn++]=ji,Ln[jn++]=zi,Ln[jn++]=br,ji=s.id,zi=s.overflow,br=l),l=Fd(l,f.children),l.flags|=4096);return l}return m?(ws(),m=f.fallback,C=l.mode,M=s.child,_=M.sibling,f=Li(M,{mode:"hidden",children:f.children}),f.subtreeFlags=M.subtreeFlags&65011712,_!==null?m=Li(_,m):(m=yr(m,C,u,null),m.flags|=2),m.return=l,f.return=l,f.sibling=m,l.child=f,f=m,m=l.child,C=s.child.memoizedState,C===null?C=Id(u):(M=C.cachePool,M!==null?(_=gt._currentValue,M=M.parent!==_?{parent:_,pool:_}:M):M=Fy(),C={baseLanes:C.baseLanes|u,cachePool:M}),m.memoizedState=C,m.childLanes=Gd(s,x,u),l.memoizedState=Qd,f):(Ss(l),u=s.child,s=u.sibling,u=Li(u,{mode:"visible",children:f.children}),u.return=l,u.sibling=null,s!==null&&(x=l.deletions,x===null?(l.deletions=[s],l.flags|=16):x.push(s)),l.child=u,l.memoizedState=null,u)}function Fd(s,l){return l=yc({mode:"visible",children:l},s.mode),l.return=s,s.child=l}function yc(s,l){return s=bn(22,s,null,l),s.lanes=0,s.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},s}function Yd(s,l,u){return Ol(l,s.child,null,u),s=Fd(l,l.pendingProps.children),s.flags|=2,l.memoizedState=null,s}function av(s,l,u){s.lanes|=l;var f=s.alternate;f!==null&&(f.lanes|=l),fd(s.return,l,u)}function Kd(s,l,u,f,m){var g=s.memoizedState;g===null?s.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:f,tail:u,tailMode:m}:(g.isBackwards=l,g.rendering=null,g.renderingStartTime=0,g.last=f,g.tail=u,g.tailMode=m)}function ov(s,l,u){var f=l.pendingProps,m=f.revealOrder,g=f.tail;if(Et(s,l,f.children,u),f=yt.current,(f&2)!==0)f=f&1|2,l.flags|=128;else{if(s!==null&&(s.flags&128)!==0)e:for(s=l.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&av(s,u,l);else if(s.tag===19)av(s,u,l);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===l)break e;for(;s.sibling===null;){if(s.return===null||s.return===l)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}f&=1}switch(Z(yt,f),m){case"forwards":for(u=l.child,m=null;u!==null;)s=u.alternate,s!==null&&dc(s)===null&&(m=u),u=u.sibling;u=m,u===null?(m=l.child,l.child=null):(m=u.sibling,u.sibling=null),Kd(l,!1,m,u,g);break;case"backwards":for(u=null,m=l.child,l.child=null;m!==null;){if(s=m.alternate,s!==null&&dc(s)===null){l.child=m;break}s=m.sibling,m.sibling=u,u=m,m=s}Kd(l,!0,u,null,g);break;case"together":Kd(l,!1,null,null,void 0);break;default:l.memoizedState=null}return l.child}function qi(s,l,u){if(s!==null&&(l.dependencies=s.dependencies),Os|=l.lanes,(u&l.childLanes)===0)if(s!==null){if($a(s,l,u,!1),(u&l.childLanes)===0)return null}else return null;if(s!==null&&l.child!==s.child)throw Error(n(153));if(l.child!==null){for(s=l.child,u=Li(s,s.pendingProps),l.child=u,u.return=l;s.sibling!==null;)s=s.sibling,u=u.sibling=Li(s,s.pendingProps),u.return=l;u.sibling=null}return l.child}function Xd(s,l){return(s.lanes&l)!==0?!0:(s=s.dependencies,!!(s!==null&&$u(s)))}function qT(s,l,u){switch(l.tag){case 3:Xe(l,l.stateNode.containerInfo),gs(l,gt,s.memoizedState.cache),Xa();break;case 27:case 5:cs(l);break;case 4:Xe(l,l.stateNode.containerInfo);break;case 10:gs(l,l.type,l.memoizedProps.value);break;case 13:var f=l.memoizedState;if(f!==null)return f.dehydrated!==null?(Ss(l),l.flags|=128,null):(u&l.child.childLanes)!==0?lv(s,l,u):(Ss(l),s=qi(s,l,u),s!==null?s.sibling:null);Ss(l);break;case 19:var m=(s.flags&128)!==0;if(f=(u&l.childLanes)!==0,f||($a(s,l,u,!1),f=(u&l.childLanes)!==0),m){if(f)return ov(s,l,u);l.flags|=128}if(m=l.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),Z(yt,yt.current),f)break;return null;case 22:case 23:return l.lanes=0,tv(s,l,u);case 24:gs(l,gt,s.memoizedState.cache)}return qi(s,l,u)}function uv(s,l,u){if(s!==null)if(s.memoizedProps!==l.pendingProps)Ct=!0;else{if(!Xd(s,u)&&(l.flags&128)===0)return Ct=!1,qT(s,l,u);Ct=(s.flags&131072)!==0}else Ct=!1,Ue&&(l.flags&1048576)!==0&&Uy(l,Wu,l.index);switch(l.lanes=0,l.tag){case 16:e:{s=l.pendingProps;var f=l.elementType,m=f._init;if(f=m(f._payload),l.type=f,typeof f=="function")sd(f)?(s=Tr(f,s),l.tag=1,l=sv(null,l,f,s,u)):(l.tag=0,l=Vd(null,l,f,s,u));else{if(f!=null){if(m=f.$$typeof,m===V){l.tag=11,l=Zb(null,l,f,s,u);break e}else if(m===I){l.tag=14,l=Jb(null,l,f,s,u);break e}}throw l=ke(f)||f,Error(n(306,l,""))}}return l;case 0:return Vd(s,l,l.type,l.pendingProps,u);case 1:return f=l.type,m=Tr(f,l.pendingProps),sv(s,l,f,m,u);case 3:e:{if(Xe(l,l.stateNode.containerInfo),s===null)throw Error(n(387));f=l.pendingProps;var g=l.memoizedState;m=g.element,bd(s,l),so(l,f,null,u);var x=l.memoizedState;if(f=x.cache,gs(l,gt,f),f!==g.cache&&hd(l,[gt],u,!0),io(),f=x.element,g.isDehydrated)if(g={element:f,isDehydrated:!1,cache:x.cache},l.updateQueue.baseState=g,l.memoizedState=g,l.flags&256){l=rv(s,l,f,u);break e}else if(f!==m){m=Nn(Error(n(424)),l),Wa(m),l=rv(s,l,f,u);break e}else{switch(s=l.stateNode.containerInfo,s.nodeType){case 9:s=s.body;break;default:s=s.nodeName==="HTML"?s.ownerDocument.body:s}for(rt=Zn(s.firstChild),Gt=l,Ue=!0,xr=null,di=!0,u=qb(l,null,f,u),l.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling}else{if(Xa(),f===m){l=qi(s,l,u);break e}Et(s,l,f,u)}l=l.child}return l;case 26:return gc(s,l),s===null?(u=dx(l.type,null,l.pendingProps,null))?l.memoizedState=u:Ue||(u=l.type,s=l.pendingProps,f=Dc(be.current).createElement(u),f[_t]=l,f[Zt]=s,Dt(f,u,s),kt(f),l.stateNode=f):l.memoizedState=dx(l.type,s.memoizedProps,l.pendingProps,s.memoizedState),null;case 27:return cs(l),s===null&&Ue&&(f=l.stateNode=cx(l.type,l.pendingProps,be.current),Gt=l,di=!0,m=rt,Ds(l.type)?(Em=m,rt=Zn(f.firstChild)):rt=m),Et(s,l,l.pendingProps.children,u),gc(s,l),s===null&&(l.flags|=4194304),l.child;case 5:return s===null&&Ue&&((m=f=rt)&&(f=pO(f,l.type,l.pendingProps,di),f!==null?(l.stateNode=f,Gt=l,rt=Zn(f.firstChild),di=!1,m=!0):m=!1),m||Sr(l)),cs(l),m=l.type,g=l.pendingProps,x=s!==null?s.memoizedProps:null,f=g.children,Am(m,g)?f=null:x!==null&&Am(m,x)&&(l.flags|=32),l.memoizedState!==null&&(m=Cd(s,l,BT,null,null,u),Oo._currentValue=m),gc(s,l),Et(s,l,f,u),l.child;case 6:return s===null&&Ue&&((s=u=rt)&&(u=gO(u,l.pendingProps,di),u!==null?(l.stateNode=u,Gt=l,rt=null,s=!0):s=!1),s||Sr(l)),null;case 13:return lv(s,l,u);case 4:return Xe(l,l.stateNode.containerInfo),f=l.pendingProps,s===null?l.child=Ol(l,null,f,u):Et(s,l,f,u),l.child;case 11:return Zb(s,l,l.type,l.pendingProps,u);case 7:return Et(s,l,l.pendingProps,u),l.child;case 8:return Et(s,l,l.pendingProps.children,u),l.child;case 12:return Et(s,l,l.pendingProps.children,u),l.child;case 10:return f=l.pendingProps,gs(l,l.type,f.value),Et(s,l,f.children,u),l.child;case 9:return m=l.type._context,f=l.pendingProps.children,kr(l),m=Ht(m),f=f(m),l.flags|=1,Et(s,l,f,u),l.child;case 14:return Jb(s,l,l.type,l.pendingProps,u);case 15:return ev(s,l,l.type,l.pendingProps,u);case 19:return ov(s,l,u);case 31:return f=l.pendingProps,u=l.mode,f={mode:f.mode,children:f.children},s===null?(u=yc(f,u),u.ref=l.ref,l.child=u,u.return=l,l=u):(u=Li(s.child,f),u.ref=l.ref,l.child=u,u.return=l,l=u),l;case 22:return tv(s,l,u);case 24:return kr(l),f=Ht(gt),s===null?(m=pd(),m===null&&(m=Ze,g=dd(),m.pooledCache=g,g.refCount++,g!==null&&(m.pooledCacheLanes|=u),m=g),l.memoizedState={parent:f,cache:m},yd(l),gs(l,gt,m)):((s.lanes&u)!==0&&(bd(s,l),so(l,null,null,u),io()),m=s.memoizedState,g=l.memoizedState,m.parent!==f?(m={parent:f,cache:f},l.memoizedState=m,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=m),gs(l,gt,f)):(f=g.cache,gs(l,gt,f),f!==m.cache&&hd(l,[gt],u,!0))),Et(s,l,l.pendingProps.children,u),l.child;case 29:throw l.pendingProps}throw Error(n(156,l.tag))}function Vi(s){s.flags|=4}function cv(s,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!bx(l)){if(l=zn.current,l!==null&&((ze&4194048)===ze?mi!==null:(ze&62914560)!==ze&&(ze&536870912)===0||l!==mi))throw to=gd,Yy;s.flags|=8192}}function bc(s,l){l!==null&&(s.flags|=4),s.flags&16384&&(l=s.tag!==22?V0():536870912,s.lanes|=l,Dl|=l)}function fo(s,l){if(!Ue)switch(s.tailMode){case"hidden":l=s.tail;for(var u=null;l!==null;)l.alternate!==null&&(u=l),l=l.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var f=null;u!==null;)u.alternate!==null&&(f=u),u=u.sibling;f===null?l||s.tail===null?s.tail=null:s.tail.sibling=null:f.sibling=null}}function st(s){var l=s.alternate!==null&&s.alternate.child===s.child,u=0,f=0;if(l)for(var m=s.child;m!==null;)u|=m.lanes|m.childLanes,f|=m.subtreeFlags&65011712,f|=m.flags&65011712,m.return=s,m=m.sibling;else for(m=s.child;m!==null;)u|=m.lanes|m.childLanes,f|=m.subtreeFlags,f|=m.flags,m.return=s,m=m.sibling;return s.subtreeFlags|=f,s.childLanes=u,l}function VT(s,l,u){var f=l.pendingProps;switch(od(l),l.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return st(l),null;case 1:return st(l),null;case 3:return u=l.stateNode,f=null,s!==null&&(f=s.memoizedState.cache),l.memoizedState.cache!==f&&(l.flags|=2048),Hi(gt),mn(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(Ka(l)?Vi(l):s===null||s.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,Vy())),st(l),null;case 26:return u=l.memoizedState,s===null?(Vi(l),u!==null?(st(l),cv(l,u)):(st(l),l.flags&=-16777217)):u?u!==s.memoizedState?(Vi(l),st(l),cv(l,u)):(st(l),l.flags&=-16777217):(s.memoizedProps!==f&&Vi(l),st(l),l.flags&=-16777217),null;case 27:fs(l),u=be.current;var m=l.type;if(s!==null&&l.stateNode!=null)s.memoizedProps!==f&&Vi(l);else{if(!f){if(l.stateNode===null)throw Error(n(166));return st(l),null}s=re.current,Ka(l)?Py(l):(s=cx(m,f,u),l.stateNode=s,Vi(l))}return st(l),null;case 5:if(fs(l),u=l.type,s!==null&&l.stateNode!=null)s.memoizedProps!==f&&Vi(l);else{if(!f){if(l.stateNode===null)throw Error(n(166));return st(l),null}if(s=re.current,Ka(l))Py(l);else{switch(m=Dc(be.current),s){case 1:s=m.createElementNS("http://www.w3.org/2000/svg",u);break;case 2:s=m.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;default:switch(u){case"svg":s=m.createElementNS("http://www.w3.org/2000/svg",u);break;case"math":s=m.createElementNS("http://www.w3.org/1998/Math/MathML",u);break;case"script":s=m.createElement("div"),s.innerHTML="<script><\/script>",s=s.removeChild(s.firstChild);break;case"select":s=typeof f.is=="string"?m.createElement("select",{is:f.is}):m.createElement("select"),f.multiple?s.multiple=!0:f.size&&(s.size=f.size);break;default:s=typeof f.is=="string"?m.createElement(u,{is:f.is}):m.createElement(u)}}s[_t]=l,s[Zt]=f;e:for(m=l.child;m!==null;){if(m.tag===5||m.tag===6)s.appendChild(m.stateNode);else if(m.tag!==4&&m.tag!==27&&m.child!==null){m.child.return=m,m=m.child;continue}if(m===l)break e;for(;m.sibling===null;){if(m.return===null||m.return===l)break e;m=m.return}m.sibling.return=m.return,m=m.sibling}l.stateNode=s;e:switch(Dt(s,u,f),u){case"button":case"input":case"select":case"textarea":s=!!f.autoFocus;break e;case"img":s=!0;break e;default:s=!1}s&&Vi(l)}}return st(l),l.flags&=-16777217,null;case 6:if(s&&l.stateNode!=null)s.memoizedProps!==f&&Vi(l);else{if(typeof f!="string"&&l.stateNode===null)throw Error(n(166));if(s=be.current,Ka(l)){if(s=l.stateNode,u=l.memoizedProps,f=null,m=Gt,m!==null)switch(m.tag){case 27:case 5:f=m.memoizedProps}s[_t]=l,s=!!(s.nodeValue===u||f!==null&&f.suppressHydrationWarning===!0||ix(s.nodeValue,u)),s||Sr(l)}else s=Dc(s).createTextNode(f),s[_t]=l,l.stateNode=s}return st(l),null;case 13:if(f=l.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(m=Ka(l),f!==null&&f.dehydrated!==null){if(s===null){if(!m)throw Error(n(318));if(m=l.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(n(317));m[_t]=l}else Xa(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;st(l),m=!1}else m=Vy(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=m),m=!0;if(!m)return l.flags&256?(Pi(l),l):(Pi(l),null)}if(Pi(l),(l.flags&128)!==0)return l.lanes=u,l;if(u=f!==null,s=s!==null&&s.memoizedState!==null,u){f=l.child,m=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(m=f.alternate.memoizedState.cachePool.pool);var g=null;f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(g=f.memoizedState.cachePool.pool),g!==m&&(f.flags|=2048)}return u!==s&&u&&(l.child.flags|=8192),bc(l,l.updateQueue),st(l),null;case 4:return mn(),s===null&&xm(l.stateNode.containerInfo),st(l),null;case 10:return Hi(l.type),st(l),null;case 19:if(ie(yt),m=l.memoizedState,m===null)return st(l),null;if(f=(l.flags&128)!==0,g=m.rendering,g===null)if(f)fo(m,!1);else{if(lt!==0||s!==null&&(s.flags&128)!==0)for(s=l.child;s!==null;){if(g=dc(s),g!==null){for(l.flags|=128,fo(m,!1),s=g.updateQueue,l.updateQueue=s,bc(l,s),l.subtreeFlags=0,s=u,u=l.child;u!==null;)Hy(u,s),u=u.sibling;return Z(yt,yt.current&1|2),l.child}s=s.sibling}m.tail!==null&&hi()>Sc&&(l.flags|=128,f=!0,fo(m,!1),l.lanes=4194304)}else{if(!f)if(s=dc(g),s!==null){if(l.flags|=128,f=!0,s=s.updateQueue,l.updateQueue=s,bc(l,s),fo(m,!0),m.tail===null&&m.tailMode==="hidden"&&!g.alternate&&!Ue)return st(l),null}else 2*hi()-m.renderingStartTime>Sc&&u!==536870912&&(l.flags|=128,f=!0,fo(m,!1),l.lanes=4194304);m.isBackwards?(g.sibling=l.child,l.child=g):(s=m.last,s!==null?s.sibling=g:l.child=g,m.last=g)}return m.tail!==null?(l=m.tail,m.rendering=l,m.tail=l.sibling,m.renderingStartTime=hi(),l.sibling=null,s=yt.current,Z(yt,f?s&1|2:s&1),l):(st(l),null);case 22:case 23:return Pi(l),wd(),f=l.memoizedState!==null,s!==null?s.memoizedState!==null!==f&&(l.flags|=8192):f&&(l.flags|=8192),f?(u&536870912)!==0&&(l.flags&128)===0&&(st(l),l.subtreeFlags&6&&(l.flags|=8192)):st(l),u=l.updateQueue,u!==null&&bc(l,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),f=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(f=l.memoizedState.cachePool.pool),f!==u&&(l.flags|=2048),s!==null&&ie(Cr),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),l.memoizedState.cache!==u&&(l.flags|=2048),Hi(gt),st(l),null;case 25:return null;case 30:return null}throw Error(n(156,l.tag))}function QT(s,l){switch(od(l),l.tag){case 1:return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 3:return Hi(gt),mn(),s=l.flags,(s&65536)!==0&&(s&128)===0?(l.flags=s&-65537|128,l):null;case 26:case 27:case 5:return fs(l),null;case 13:if(Pi(l),s=l.memoizedState,s!==null&&s.dehydrated!==null){if(l.alternate===null)throw Error(n(340));Xa()}return s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 19:return ie(yt),null;case 4:return mn(),null;case 10:return Hi(l.type),null;case 22:case 23:return Pi(l),wd(),s!==null&&ie(Cr),s=l.flags,s&65536?(l.flags=s&-65537|128,l):null;case 24:return Hi(gt),null;case 25:return null;default:return null}}function fv(s,l){switch(od(l),l.tag){case 3:Hi(gt),mn();break;case 26:case 27:case 5:fs(l);break;case 4:mn();break;case 13:Pi(l);break;case 19:ie(yt);break;case 10:Hi(l.type);break;case 22:case 23:Pi(l),wd(),s!==null&&ie(Cr);break;case 24:Hi(gt)}}function ho(s,l){try{var u=l.updateQueue,f=u!==null?u.lastEffect:null;if(f!==null){var m=f.next;u=m;do{if((u.tag&s)===s){f=void 0;var g=u.create,x=u.inst;f=g(),x.destroy=f}u=u.next}while(u!==m)}}catch(C){We(l,l.return,C)}}function ks(s,l,u){try{var f=l.updateQueue,m=f!==null?f.lastEffect:null;if(m!==null){var g=m.next;f=g;do{if((f.tag&s)===s){var x=f.inst,C=x.destroy;if(C!==void 0){x.destroy=void 0,m=l;var M=u,_=C;try{_()}catch(G){We(m,M,G)}}}f=f.next}while(f!==g)}}catch(G){We(l,l.return,G)}}function hv(s){var l=s.updateQueue;if(l!==null){var u=s.stateNode;try{Jy(l,u)}catch(f){We(s,s.return,f)}}}function dv(s,l,u){u.props=Tr(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(f){We(s,l,f)}}function mo(s,l){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var f=s.stateNode;break;case 30:f=s.stateNode;break;default:f=s.stateNode}typeof u=="function"?s.refCleanup=u(f):u.current=f}}catch(m){We(s,l,m)}}function pi(s,l){var u=s.ref,f=s.refCleanup;if(u!==null)if(typeof f=="function")try{f()}catch(m){We(s,l,m)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(m){We(s,l,m)}else u.current=null}function mv(s){var l=s.type,u=s.memoizedProps,f=s.stateNode;try{e:switch(l){case"button":case"input":case"select":case"textarea":u.autoFocus&&f.focus();break e;case"img":u.src?f.src=u.src:u.srcSet&&(f.srcset=u.srcSet)}}catch(m){We(s,s.return,m)}}function Wd(s,l,u){try{var f=s.stateNode;cO(f,s.type,u,l),f[Zt]=l}catch(m){We(s,s.return,m)}}function pv(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Ds(s.type)||s.tag===4}function $d(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||pv(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Ds(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Zd(s,l,u){var f=s.tag;if(f===5||f===6)s=s.stateNode,l?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(s,l):(l=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,l.appendChild(s),u=u._reactRootContainer,u!=null||l.onclick!==null||(l.onclick=Rc));else if(f!==4&&(f===27&&Ds(s.type)&&(u=s.stateNode,l=null),s=s.child,s!==null))for(Zd(s,l,u),s=s.sibling;s!==null;)Zd(s,l,u),s=s.sibling}function vc(s,l,u){var f=s.tag;if(f===5||f===6)s=s.stateNode,l?u.insertBefore(s,l):u.appendChild(s);else if(f!==4&&(f===27&&Ds(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(vc(s,l,u),s=s.sibling;s!==null;)vc(s,l,u),s=s.sibling}function gv(s){var l=s.stateNode,u=s.memoizedProps;try{for(var f=s.type,m=l.attributes;m.length;)l.removeAttributeNode(m[0]);Dt(l,f,u),l[_t]=s,l[Zt]=u}catch(g){We(s,s.return,g)}}var Qi=!1,ct=!1,Jd=!1,yv=typeof WeakSet=="function"?WeakSet:Set,At=null;function IT(s,l){if(s=s.containerInfo,km=_c,s=My(s),$h(s)){if("selectionStart"in s)var u={start:s.selectionStart,end:s.selectionEnd};else e:{u=(u=s.ownerDocument)&&u.defaultView||window;var f=u.getSelection&&u.getSelection();if(f&&f.rangeCount!==0){u=f.anchorNode;var m=f.anchorOffset,g=f.focusNode;f=f.focusOffset;try{u.nodeType,g.nodeType}catch{u=null;break e}var x=0,C=-1,M=-1,_=0,G=0,$=s,U=null;t:for(;;){for(var P;$!==u||m!==0&&$.nodeType!==3||(C=x+m),$!==g||f!==0&&$.nodeType!==3||(M=x+f),$.nodeType===3&&(x+=$.nodeValue.length),(P=$.firstChild)!==null;)U=$,$=P;for(;;){if($===s)break t;if(U===u&&++_===m&&(C=x),U===g&&++G===f&&(M=x),(P=$.nextSibling)!==null)break;$=U,U=$.parentNode}$=P}u=C===-1||M===-1?null:{start:C,end:M}}else u=null}u=u||{start:0,end:0}}else u=null;for(Cm={focusedElem:s,selectionRange:u},_c=!1,At=l;At!==null;)if(l=At,s=l.child,(l.subtreeFlags&1024)!==0&&s!==null)s.return=l,At=s;else for(;At!==null;){switch(l=At,g=l.alternate,s=l.flags,l.tag){case 0:break;case 11:case 15:break;case 1:if((s&1024)!==0&&g!==null){s=void 0,u=l,m=g.memoizedProps,g=g.memoizedState,f=u.stateNode;try{var we=Tr(u.type,m,u.elementType===u.type);s=f.getSnapshotBeforeUpdate(we,g),f.__reactInternalSnapshotBeforeUpdate=s}catch(ve){We(u,u.return,ve)}}break;case 3:if((s&1024)!==0){if(s=l.stateNode.containerInfo,u=s.nodeType,u===9)Om(s);else if(u===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Om(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(n(163))}if(s=l.sibling,s!==null){s.return=l.return,At=s;break}At=l.return}}function bv(s,l,u){var f=u.flags;switch(u.tag){case 0:case 11:case 15:Cs(s,u),f&4&&ho(5,u);break;case 1:if(Cs(s,u),f&4)if(s=u.stateNode,l===null)try{s.componentDidMount()}catch(x){We(u,u.return,x)}else{var m=Tr(u.type,l.memoizedProps);l=l.memoizedState;try{s.componentDidUpdate(m,l,s.__reactInternalSnapshotBeforeUpdate)}catch(x){We(u,u.return,x)}}f&64&&hv(u),f&512&&mo(u,u.return);break;case 3:if(Cs(s,u),f&64&&(s=u.updateQueue,s!==null)){if(l=null,u.child!==null)switch(u.child.tag){case 27:case 5:l=u.child.stateNode;break;case 1:l=u.child.stateNode}try{Jy(s,l)}catch(x){We(u,u.return,x)}}break;case 27:l===null&&f&4&&gv(u);case 26:case 5:Cs(s,u),l===null&&f&4&&mv(u),f&512&&mo(u,u.return);break;case 12:Cs(s,u);break;case 13:Cs(s,u),f&4&&Sv(s,u),f&64&&(s=u.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(u=JT.bind(null,u),yO(s,u))));break;case 22:if(f=u.memoizedState!==null||Qi,!f){l=l!==null&&l.memoizedState!==null||ct,m=Qi;var g=ct;Qi=f,(ct=l)&&!g?As(s,u,(u.subtreeFlags&8772)!==0):Cs(s,u),Qi=m,ct=g}break;case 30:break;default:Cs(s,u)}}function vv(s){var l=s.alternate;l!==null&&(s.alternate=null,vv(l)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(l=s.stateNode,l!==null&&Nh(l)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var nt=null,tn=!1;function Ii(s,l,u){for(u=u.child;u!==null;)xv(s,l,u),u=u.sibling}function xv(s,l,u){if(pn&&typeof pn.onCommitFiberUnmount=="function")try{pn.onCommitFiberUnmount(La,u)}catch{}switch(u.tag){case 26:ct||pi(u,l),Ii(s,l,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:ct||pi(u,l);var f=nt,m=tn;Ds(u.type)&&(nt=u.stateNode,tn=!1),Ii(s,l,u),ko(u.stateNode),nt=f,tn=m;break;case 5:ct||pi(u,l);case 6:if(f=nt,m=tn,nt=null,Ii(s,l,u),nt=f,tn=m,nt!==null)if(tn)try{(nt.nodeType===9?nt.body:nt.nodeName==="HTML"?nt.ownerDocument.body:nt).removeChild(u.stateNode)}catch(g){We(u,l,g)}else try{nt.removeChild(u.stateNode)}catch(g){We(u,l,g)}break;case 18:nt!==null&&(tn?(s=nt,ox(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,u.stateNode),Do(s)):ox(nt,u.stateNode));break;case 4:f=nt,m=tn,nt=u.stateNode.containerInfo,tn=!0,Ii(s,l,u),nt=f,tn=m;break;case 0:case 11:case 14:case 15:ct||ks(2,u,l),ct||ks(4,u,l),Ii(s,l,u);break;case 1:ct||(pi(u,l),f=u.stateNode,typeof f.componentWillUnmount=="function"&&dv(u,l,f)),Ii(s,l,u);break;case 21:Ii(s,l,u);break;case 22:ct=(f=ct)||u.memoizedState!==null,Ii(s,l,u),ct=f;break;default:Ii(s,l,u)}}function Sv(s,l){if(l.memoizedState===null&&(s=l.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{Do(s)}catch(u){We(l,l.return,u)}}function GT(s){switch(s.tag){case 13:case 19:var l=s.stateNode;return l===null&&(l=s.stateNode=new yv),l;case 22:return s=s.stateNode,l=s._retryCache,l===null&&(l=s._retryCache=new yv),l;default:throw Error(n(435,s.tag))}}function em(s,l){var u=GT(s);l.forEach(function(f){var m=eO.bind(null,s,f);u.has(f)||(u.add(f),f.then(m,m))})}function vn(s,l){var u=l.deletions;if(u!==null)for(var f=0;f<u.length;f++){var m=u[f],g=s,x=l,C=x;e:for(;C!==null;){switch(C.tag){case 27:if(Ds(C.type)){nt=C.stateNode,tn=!1;break e}break;case 5:nt=C.stateNode,tn=!1;break e;case 3:case 4:nt=C.stateNode.containerInfo,tn=!0;break e}C=C.return}if(nt===null)throw Error(n(160));xv(g,x,m),nt=null,tn=!1,g=m.alternate,g!==null&&(g.return=null),m.return=null}if(l.subtreeFlags&13878)for(l=l.child;l!==null;)wv(l,s),l=l.sibling}var $n=null;function wv(s,l){var u=s.alternate,f=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:vn(l,s),xn(s),f&4&&(ks(3,s,s.return),ho(3,s),ks(5,s,s.return));break;case 1:vn(l,s),xn(s),f&512&&(ct||u===null||pi(u,u.return)),f&64&&Qi&&(s=s.updateQueue,s!==null&&(f=s.callbacks,f!==null&&(u=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=u===null?f:u.concat(f))));break;case 26:var m=$n;if(vn(l,s),xn(s),f&512&&(ct||u===null||pi(u,u.return)),f&4){var g=u!==null?u.memoizedState:null;if(f=s.memoizedState,u===null)if(f===null)if(s.stateNode===null){e:{f=s.type,u=s.memoizedProps,m=m.ownerDocument||m;t:switch(f){case"title":g=m.getElementsByTagName("title")[0],(!g||g[_a]||g[_t]||g.namespaceURI==="http://www.w3.org/2000/svg"||g.hasAttribute("itemprop"))&&(g=m.createElement(f),m.head.insertBefore(g,m.querySelector("head > title"))),Dt(g,f,u),g[_t]=s,kt(g),f=g;break e;case"link":var x=gx("link","href",m).get(f+(u.href||""));if(x){for(var C=0;C<x.length;C++)if(g=x[C],g.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&g.getAttribute("rel")===(u.rel==null?null:u.rel)&&g.getAttribute("title")===(u.title==null?null:u.title)&&g.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){x.splice(C,1);break t}}g=m.createElement(f),Dt(g,f,u),m.head.appendChild(g);break;case"meta":if(x=gx("meta","content",m).get(f+(u.content||""))){for(C=0;C<x.length;C++)if(g=x[C],g.getAttribute("content")===(u.content==null?null:""+u.content)&&g.getAttribute("name")===(u.name==null?null:u.name)&&g.getAttribute("property")===(u.property==null?null:u.property)&&g.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&g.getAttribute("charset")===(u.charSet==null?null:u.charSet)){x.splice(C,1);break t}}g=m.createElement(f),Dt(g,f,u),m.head.appendChild(g);break;default:throw Error(n(468,f))}g[_t]=s,kt(g),f=g}s.stateNode=f}else yx(m,s.type,s.stateNode);else s.stateNode=px(m,f,s.memoizedProps);else g!==f?(g===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):g.count--,f===null?yx(m,s.type,s.stateNode):px(m,f,s.memoizedProps)):f===null&&s.stateNode!==null&&Wd(s,s.memoizedProps,u.memoizedProps)}break;case 27:vn(l,s),xn(s),f&512&&(ct||u===null||pi(u,u.return)),u!==null&&f&4&&Wd(s,s.memoizedProps,u.memoizedProps);break;case 5:if(vn(l,s),xn(s),f&512&&(ct||u===null||pi(u,u.return)),s.flags&32){m=s.stateNode;try{ul(m,"")}catch(P){We(s,s.return,P)}}f&4&&s.stateNode!=null&&(m=s.memoizedProps,Wd(s,m,u!==null?u.memoizedProps:m)),f&1024&&(Jd=!0);break;case 6:if(vn(l,s),xn(s),f&4){if(s.stateNode===null)throw Error(n(162));f=s.memoizedProps,u=s.stateNode;try{u.nodeValue=f}catch(P){We(s,s.return,P)}}break;case 3:if(Lc=null,m=$n,$n=Nc(l.containerInfo),vn(l,s),$n=m,xn(s),f&4&&u!==null&&u.memoizedState.isDehydrated)try{Do(l.containerInfo)}catch(P){We(s,s.return,P)}Jd&&(Jd=!1,kv(s));break;case 4:f=$n,$n=Nc(s.stateNode.containerInfo),vn(l,s),xn(s),$n=f;break;case 12:vn(l,s),xn(s);break;case 13:vn(l,s),xn(s),s.child.flags&8192&&s.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(lm=hi()),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,em(s,f)));break;case 22:m=s.memoizedState!==null;var M=u!==null&&u.memoizedState!==null,_=Qi,G=ct;if(Qi=_||m,ct=G||M,vn(l,s),ct=G,Qi=_,xn(s),f&8192)e:for(l=s.stateNode,l._visibility=m?l._visibility&-2:l._visibility|1,m&&(u===null||M||Qi||ct||Or(s)),u=null,l=s;;){if(l.tag===5||l.tag===26){if(u===null){M=u=l;try{if(g=M.stateNode,m)x=g.style,typeof x.setProperty=="function"?x.setProperty("display","none","important"):x.display="none";else{C=M.stateNode;var $=M.memoizedProps.style,U=$!=null&&$.hasOwnProperty("display")?$.display:null;C.style.display=U==null||typeof U=="boolean"?"":(""+U).trim()}}catch(P){We(M,M.return,P)}}}else if(l.tag===6){if(u===null){M=l;try{M.stateNode.nodeValue=m?"":M.memoizedProps}catch(P){We(M,M.return,P)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===s)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===s)break e;for(;l.sibling===null;){if(l.return===null||l.return===s)break e;u===l&&(u=null),l=l.return}u===l&&(u=null),l.sibling.return=l.return,l=l.sibling}f&4&&(f=s.updateQueue,f!==null&&(u=f.retryQueue,u!==null&&(f.retryQueue=null,em(s,u))));break;case 19:vn(l,s),xn(s),f&4&&(f=s.updateQueue,f!==null&&(s.updateQueue=null,em(s,f)));break;case 30:break;case 21:break;default:vn(l,s),xn(s)}}function xn(s){var l=s.flags;if(l&2){try{for(var u,f=s.return;f!==null;){if(pv(f)){u=f;break}f=f.return}if(u==null)throw Error(n(160));switch(u.tag){case 27:var m=u.stateNode,g=$d(s);vc(s,g,m);break;case 5:var x=u.stateNode;u.flags&32&&(ul(x,""),u.flags&=-33);var C=$d(s);vc(s,C,x);break;case 3:case 4:var M=u.stateNode.containerInfo,_=$d(s);Zd(s,_,M);break;default:throw Error(n(161))}}catch(G){We(s,s.return,G)}s.flags&=-3}l&4096&&(s.flags&=-4097)}function kv(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var l=s;kv(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),s=s.sibling}}function Cs(s,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)bv(s,l.alternate,l),l=l.sibling}function Or(s){for(s=s.child;s!==null;){var l=s;switch(l.tag){case 0:case 11:case 14:case 15:ks(4,l,l.return),Or(l);break;case 1:pi(l,l.return);var u=l.stateNode;typeof u.componentWillUnmount=="function"&&dv(l,l.return,u),Or(l);break;case 27:ko(l.stateNode);case 26:case 5:pi(l,l.return),Or(l);break;case 22:l.memoizedState===null&&Or(l);break;case 30:Or(l);break;default:Or(l)}s=s.sibling}}function As(s,l,u){for(u=u&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var f=l.alternate,m=s,g=l,x=g.flags;switch(g.tag){case 0:case 11:case 15:As(m,g,u),ho(4,g);break;case 1:if(As(m,g,u),f=g,m=f.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(_){We(f,f.return,_)}if(f=g,m=f.updateQueue,m!==null){var C=f.stateNode;try{var M=m.shared.hiddenCallbacks;if(M!==null)for(m.shared.hiddenCallbacks=null,m=0;m<M.length;m++)Zy(M[m],C)}catch(_){We(f,f.return,_)}}u&&x&64&&hv(g),mo(g,g.return);break;case 27:gv(g);case 26:case 5:As(m,g,u),u&&f===null&&x&4&&mv(g),mo(g,g.return);break;case 12:As(m,g,u);break;case 13:As(m,g,u),u&&x&4&&Sv(m,g);break;case 22:g.memoizedState===null&&As(m,g,u),mo(g,g.return);break;case 30:break;default:As(m,g,u)}l=l.sibling}}function tm(s,l){var u=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),s=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(s=l.memoizedState.cachePool.pool),s!==u&&(s!=null&&s.refCount++,u!=null&&Za(u))}function nm(s,l){s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&Za(s))}function gi(s,l,u,f){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)Cv(s,l,u,f),l=l.sibling}function Cv(s,l,u,f){var m=l.flags;switch(l.tag){case 0:case 11:case 15:gi(s,l,u,f),m&2048&&ho(9,l);break;case 1:gi(s,l,u,f);break;case 3:gi(s,l,u,f),m&2048&&(s=null,l.alternate!==null&&(s=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==s&&(l.refCount++,s!=null&&Za(s)));break;case 12:if(m&2048){gi(s,l,u,f),s=l.stateNode;try{var g=l.memoizedProps,x=g.id,C=g.onPostCommit;typeof C=="function"&&C(x,l.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(M){We(l,l.return,M)}}else gi(s,l,u,f);break;case 13:gi(s,l,u,f);break;case 23:break;case 22:g=l.stateNode,x=l.alternate,l.memoizedState!==null?g._visibility&2?gi(s,l,u,f):po(s,l):g._visibility&2?gi(s,l,u,f):(g._visibility|=2,Ml(s,l,u,f,(l.subtreeFlags&10256)!==0)),m&2048&&tm(x,l);break;case 24:gi(s,l,u,f),m&2048&&nm(l.alternate,l);break;default:gi(s,l,u,f)}}function Ml(s,l,u,f,m){for(m=m&&(l.subtreeFlags&10256)!==0,l=l.child;l!==null;){var g=s,x=l,C=u,M=f,_=x.flags;switch(x.tag){case 0:case 11:case 15:Ml(g,x,C,M,m),ho(8,x);break;case 23:break;case 22:var G=x.stateNode;x.memoizedState!==null?G._visibility&2?Ml(g,x,C,M,m):po(g,x):(G._visibility|=2,Ml(g,x,C,M,m)),m&&_&2048&&tm(x.alternate,x);break;case 24:Ml(g,x,C,M,m),m&&_&2048&&nm(x.alternate,x);break;default:Ml(g,x,C,M,m)}l=l.sibling}}function po(s,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var u=s,f=l,m=f.flags;switch(f.tag){case 22:po(u,f),m&2048&&tm(f.alternate,f);break;case 24:po(u,f),m&2048&&nm(f.alternate,f);break;default:po(u,f)}l=l.sibling}}var go=8192;function El(s){if(s.subtreeFlags&go)for(s=s.child;s!==null;)Av(s),s=s.sibling}function Av(s){switch(s.tag){case 26:El(s),s.flags&go&&s.memoizedState!==null&&RO($n,s.memoizedState,s.memoizedProps);break;case 5:El(s);break;case 3:case 4:var l=$n;$n=Nc(s.stateNode.containerInfo),El(s),$n=l;break;case 22:s.memoizedState===null&&(l=s.alternate,l!==null&&l.memoizedState!==null?(l=go,go=16777216,El(s),go=l):El(s));break;default:El(s)}}function Tv(s){var l=s.alternate;if(l!==null&&(s=l.child,s!==null)){l.child=null;do l=s.sibling,s.sibling=null,s=l;while(s!==null)}}function yo(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var u=0;u<l.length;u++){var f=l[u];At=f,Mv(f,s)}Tv(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)Ov(s),s=s.sibling}function Ov(s){switch(s.tag){case 0:case 11:case 15:yo(s),s.flags&2048&&ks(9,s,s.return);break;case 3:yo(s);break;case 12:yo(s);break;case 22:var l=s.stateNode;s.memoizedState!==null&&l._visibility&2&&(s.return===null||s.return.tag!==13)?(l._visibility&=-3,xc(s)):yo(s);break;default:yo(s)}}function xc(s){var l=s.deletions;if((s.flags&16)!==0){if(l!==null)for(var u=0;u<l.length;u++){var f=l[u];At=f,Mv(f,s)}Tv(s)}for(s=s.child;s!==null;){switch(l=s,l.tag){case 0:case 11:case 15:ks(8,l,l.return),xc(l);break;case 22:u=l.stateNode,u._visibility&2&&(u._visibility&=-3,xc(l));break;default:xc(l)}s=s.sibling}}function Mv(s,l){for(;At!==null;){var u=At;switch(u.tag){case 0:case 11:case 15:ks(8,u,l);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var f=u.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:Za(u.memoizedState.cache)}if(f=u.child,f!==null)f.return=u,At=f;else e:for(u=s;At!==null;){f=At;var m=f.sibling,g=f.return;if(vv(f),f===u){At=null;break e}if(m!==null){m.return=g,At=m;break e}At=g}}}var FT={getCacheForType:function(s){var l=Ht(gt),u=l.data.get(s);return u===void 0&&(u=s(),l.data.set(s,u)),u}},YT=typeof WeakMap=="function"?WeakMap:Map,Ve=0,Ze=null,De=null,ze=0,Qe=0,Sn=null,Ts=!1,Rl=!1,im=!1,Gi=0,lt=0,Os=0,Mr=0,sm=0,_n=0,Dl=0,bo=null,nn=null,rm=!1,lm=0,Sc=1/0,wc=null,Ms=null,Rt=0,Es=null,Nl=null,Bl=0,am=0,om=null,Ev=null,vo=0,um=null;function wn(){if((Ve&2)!==0&&ze!==0)return ze&-ze;if(H.T!==null){var s=xl;return s!==0?s:gm()}return G0()}function Rv(){_n===0&&(_n=(ze&536870912)===0||Ue?q0():536870912);var s=zn.current;return s!==null&&(s.flags|=32),_n}function kn(s,l,u){(s===Ze&&(Qe===2||Qe===9)||s.cancelPendingCommit!==null)&&(Ll(s,0),Rs(s,ze,_n,!1)),za(s,u),((Ve&2)===0||s!==Ze)&&(s===Ze&&((Ve&2)===0&&(Mr|=u),lt===4&&Rs(s,ze,_n,!1)),yi(s))}function Dv(s,l,u){if((Ve&6)!==0)throw Error(n(327));var f=!u&&(l&124)===0&&(l&s.expiredLanes)===0||ja(s,l),m=f?WT(s,l):hm(s,l,!0),g=f;do{if(m===0){Rl&&!f&&Rs(s,l,0,!1);break}else{if(u=s.current.alternate,g&&!KT(u)){m=hm(s,l,!1),g=!1;continue}if(m===2){if(g=l,s.errorRecoveryDisabledLanes&g)var x=0;else x=s.pendingLanes&-536870913,x=x!==0?x:x&536870912?536870912:0;if(x!==0){l=x;e:{var C=s;m=bo;var M=C.current.memoizedState.isDehydrated;if(M&&(Ll(C,x).flags|=256),x=hm(C,x,!1),x!==2){if(im&&!M){C.errorRecoveryDisabledLanes|=g,Mr|=g,m=4;break e}g=nn,nn=m,g!==null&&(nn===null?nn=g:nn.push.apply(nn,g))}m=x}if(g=!1,m!==2)continue}}if(m===1){Ll(s,0),Rs(s,l,0,!0);break}e:{switch(f=s,g=m,g){case 0:case 1:throw Error(n(345));case 4:if((l&4194048)!==l)break;case 6:Rs(f,l,_n,!Ts);break e;case 2:nn=null;break;case 3:case 5:break;default:throw Error(n(329))}if((l&62914560)===l&&(m=lm+300-hi(),10<m)){if(Rs(f,l,_n,!Ts),Bu(f,0,!0)!==0)break e;f.timeoutHandle=lx(Nv.bind(null,f,u,nn,wc,rm,l,_n,Mr,Dl,Ts,g,2,-0,0),m);break e}Nv(f,u,nn,wc,rm,l,_n,Mr,Dl,Ts,g,0,-0,0)}}break}while(!0);yi(s)}function Nv(s,l,u,f,m,g,x,C,M,_,G,$,U,P){if(s.timeoutHandle=-1,$=l.subtreeFlags,($&8192||($&16785408)===16785408)&&(To={stylesheets:null,count:0,unsuspend:EO},Av(l),$=DO(),$!==null)){s.cancelPendingCommit=$(Uv.bind(null,s,l,g,u,f,m,x,C,M,G,1,U,P)),Rs(s,g,x,!_);return}Uv(s,l,g,u,f,m,x,C,M)}function KT(s){for(var l=s;;){var u=l.tag;if((u===0||u===11||u===15)&&l.flags&16384&&(u=l.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var f=0;f<u.length;f++){var m=u[f],g=m.getSnapshot;m=m.value;try{if(!yn(g(),m))return!1}catch{return!1}}if(u=l.child,l.subtreeFlags&16384&&u!==null)u.return=l,l=u;else{if(l===s)break;for(;l.sibling===null;){if(l.return===null||l.return===s)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function Rs(s,l,u,f){l&=~sm,l&=~Mr,s.suspendedLanes|=l,s.pingedLanes&=~l,f&&(s.warmLanes|=l),f=s.expirationTimes;for(var m=l;0<m;){var g=31-gn(m),x=1<<g;f[g]=-1,m&=~x}u!==0&&Q0(s,u,l)}function kc(){return(Ve&6)===0?(xo(0),!1):!0}function cm(){if(De!==null){if(Qe===0)var s=De.return;else s=De,_i=wr=null,Od(s),Tl=null,uo=0,s=De;for(;s!==null;)fv(s.alternate,s),s=s.return;De=null}}function Ll(s,l){var u=s.timeoutHandle;u!==-1&&(s.timeoutHandle=-1,hO(u)),u=s.cancelPendingCommit,u!==null&&(s.cancelPendingCommit=null,u()),cm(),Ze=s,De=u=Li(s.current,null),ze=l,Qe=0,Sn=null,Ts=!1,Rl=ja(s,l),im=!1,Dl=_n=sm=Mr=Os=lt=0,nn=bo=null,rm=!1,(l&8)!==0&&(l|=l&32);var f=s.entangledLanes;if(f!==0)for(s=s.entanglements,f&=l;0<f;){var m=31-gn(f),g=1<<m;l|=s[m],f&=~g}return Gi=l,Gu(),u}function Bv(s,l){Oe=null,H.H=cc,l===eo||l===ec?(l=Wy(),Qe=3):l===Yy?(l=Wy(),Qe=4):Qe=l===$b?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,Sn=l,De===null&&(lt=1,pc(s,Nn(l,s.current)))}function Lv(){var s=H.H;return H.H=cc,s===null?cc:s}function jv(){var s=H.A;return H.A=FT,s}function fm(){lt=4,Ts||(ze&4194048)!==ze&&zn.current!==null||(Rl=!0),(Os&134217727)===0&&(Mr&134217727)===0||Ze===null||Rs(Ze,ze,_n,!1)}function hm(s,l,u){var f=Ve;Ve|=2;var m=Lv(),g=jv();(Ze!==s||ze!==l)&&(wc=null,Ll(s,l)),l=!1;var x=lt;e:do try{if(Qe!==0&&De!==null){var C=De,M=Sn;switch(Qe){case 8:cm(),x=6;break e;case 3:case 2:case 9:case 6:zn.current===null&&(l=!0);var _=Qe;if(Qe=0,Sn=null,jl(s,C,M,_),u&&Rl){x=0;break e}break;default:_=Qe,Qe=0,Sn=null,jl(s,C,M,_)}}XT(),x=lt;break}catch(G){Bv(s,G)}while(!0);return l&&s.shellSuspendCounter++,_i=wr=null,Ve=f,H.H=m,H.A=g,De===null&&(Ze=null,ze=0,Gu()),x}function XT(){for(;De!==null;)zv(De)}function WT(s,l){var u=Ve;Ve|=2;var f=Lv(),m=jv();Ze!==s||ze!==l?(wc=null,Sc=hi()+500,Ll(s,l)):Rl=ja(s,l);e:do try{if(Qe!==0&&De!==null){l=De;var g=Sn;t:switch(Qe){case 1:Qe=0,Sn=null,jl(s,l,g,1);break;case 2:case 9:if(Ky(g)){Qe=0,Sn=null,_v(l);break}l=function(){Qe!==2&&Qe!==9||Ze!==s||(Qe=7),yi(s)},g.then(l,l);break e;case 3:Qe=7;break e;case 4:Qe=5;break e;case 7:Ky(g)?(Qe=0,Sn=null,_v(l)):(Qe=0,Sn=null,jl(s,l,g,7));break;case 5:var x=null;switch(De.tag){case 26:x=De.memoizedState;case 5:case 27:var C=De;if(!x||bx(x)){Qe=0,Sn=null;var M=C.sibling;if(M!==null)De=M;else{var _=C.return;_!==null?(De=_,Cc(_)):De=null}break t}}Qe=0,Sn=null,jl(s,l,g,5);break;case 6:Qe=0,Sn=null,jl(s,l,g,6);break;case 8:cm(),lt=6;break e;default:throw Error(n(462))}}$T();break}catch(G){Bv(s,G)}while(!0);return _i=wr=null,H.H=f,H.A=m,Ve=u,De!==null?0:(Ze=null,ze=0,Gu(),lt)}function $T(){for(;De!==null&&!vA();)zv(De)}function zv(s){var l=uv(s.alternate,s,Gi);s.memoizedProps=s.pendingProps,l===null?Cc(s):De=l}function _v(s){var l=s,u=l.alternate;switch(l.tag){case 15:case 0:l=iv(u,l,l.pendingProps,l.type,void 0,ze);break;case 11:l=iv(u,l,l.pendingProps,l.type.render,l.ref,ze);break;case 5:Od(l);default:fv(u,l),l=De=Hy(l,Gi),l=uv(u,l,Gi)}s.memoizedProps=s.pendingProps,l===null?Cc(s):De=l}function jl(s,l,u,f){_i=wr=null,Od(l),Tl=null,uo=0;var m=l.return;try{if(PT(s,m,l,u,ze)){lt=1,pc(s,Nn(u,s.current)),De=null;return}}catch(g){if(m!==null)throw De=m,g;lt=1,pc(s,Nn(u,s.current)),De=null;return}l.flags&32768?(Ue||f===1?s=!0:Rl||(ze&536870912)!==0?s=!1:(Ts=s=!0,(f===2||f===9||f===3||f===6)&&(f=zn.current,f!==null&&f.tag===13&&(f.flags|=16384))),Hv(l,s)):Cc(l)}function Cc(s){var l=s;do{if((l.flags&32768)!==0){Hv(l,Ts);return}s=l.return;var u=VT(l.alternate,l,Gi);if(u!==null){De=u;return}if(l=l.sibling,l!==null){De=l;return}De=l=s}while(l!==null);lt===0&&(lt=5)}function Hv(s,l){do{var u=QT(s.alternate,s);if(u!==null){u.flags&=32767,De=u;return}if(u=s.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!l&&(s=s.sibling,s!==null)){De=s;return}De=s=u}while(s!==null);lt=6,De=null}function Uv(s,l,u,f,m,g,x,C,M){s.cancelPendingCommit=null;do Ac();while(Rt!==0);if((Ve&6)!==0)throw Error(n(327));if(l!==null){if(l===s.current)throw Error(n(177));if(g=l.lanes|l.childLanes,g|=nd,EA(s,u,g,x,C,M),s===Ze&&(De=Ze=null,ze=0),Nl=l,Es=s,Bl=u,am=g,om=m,Ev=f,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,tO(Ru,function(){return Iv(),null})):(s.callbackNode=null,s.callbackPriority=0),f=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||f){f=H.T,H.T=null,m=K.p,K.p=2,x=Ve,Ve|=4;try{IT(s,l,u)}finally{Ve=x,K.p=m,H.T=f}}Rt=1,Pv(),qv(),Vv()}}function Pv(){if(Rt===1){Rt=0;var s=Es,l=Nl,u=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||u){u=H.T,H.T=null;var f=K.p;K.p=2;var m=Ve;Ve|=4;try{wv(l,s);var g=Cm,x=My(s.containerInfo),C=g.focusedElem,M=g.selectionRange;if(x!==C&&C&&C.ownerDocument&&Oy(C.ownerDocument.documentElement,C)){if(M!==null&&$h(C)){var _=M.start,G=M.end;if(G===void 0&&(G=_),"selectionStart"in C)C.selectionStart=_,C.selectionEnd=Math.min(G,C.value.length);else{var $=C.ownerDocument||document,U=$&&$.defaultView||window;if(U.getSelection){var P=U.getSelection(),we=C.textContent.length,ve=Math.min(M.start,we),Fe=M.end===void 0?ve:Math.min(M.end,we);!P.extend&&ve>Fe&&(x=Fe,Fe=ve,ve=x);var L=Ty(C,ve),N=Ty(C,Fe);if(L&&N&&(P.rangeCount!==1||P.anchorNode!==L.node||P.anchorOffset!==L.offset||P.focusNode!==N.node||P.focusOffset!==N.offset)){var z=$.createRange();z.setStart(L.node,L.offset),P.removeAllRanges(),ve>Fe?(P.addRange(z),P.extend(N.node,N.offset)):(z.setEnd(N.node,N.offset),P.addRange(z))}}}}for($=[],P=C;P=P.parentNode;)P.nodeType===1&&$.push({element:P,left:P.scrollLeft,top:P.scrollTop});for(typeof C.focus=="function"&&C.focus(),C=0;C<$.length;C++){var F=$[C];F.element.scrollLeft=F.left,F.element.scrollTop=F.top}}_c=!!km,Cm=km=null}finally{Ve=m,K.p=f,H.T=u}}s.current=l,Rt=2}}function qv(){if(Rt===2){Rt=0;var s=Es,l=Nl,u=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||u){u=H.T,H.T=null;var f=K.p;K.p=2;var m=Ve;Ve|=4;try{bv(s,l.alternate,l)}finally{Ve=m,K.p=f,H.T=u}}Rt=3}}function Vv(){if(Rt===4||Rt===3){Rt=0,xA();var s=Es,l=Nl,u=Bl,f=Ev;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?Rt=5:(Rt=0,Nl=Es=null,Qv(s,s.pendingLanes));var m=s.pendingLanes;if(m===0&&(Ms=null),Rh(u),l=l.stateNode,pn&&typeof pn.onCommitFiberRoot=="function")try{pn.onCommitFiberRoot(La,l,void 0,(l.current.flags&128)===128)}catch{}if(f!==null){l=H.T,m=K.p,K.p=2,H.T=null;try{for(var g=s.onRecoverableError,x=0;x<f.length;x++){var C=f[x];g(C.value,{componentStack:C.stack})}}finally{H.T=l,K.p=m}}(Bl&3)!==0&&Ac(),yi(s),m=s.pendingLanes,(u&4194090)!==0&&(m&42)!==0?s===um?vo++:(vo=0,um=s):vo=0,xo(0)}}function Qv(s,l){(s.pooledCacheLanes&=l)===0&&(l=s.pooledCache,l!=null&&(s.pooledCache=null,Za(l)))}function Ac(s){return Pv(),qv(),Vv(),Iv()}function Iv(){if(Rt!==5)return!1;var s=Es,l=am;am=0;var u=Rh(Bl),f=H.T,m=K.p;try{K.p=32>u?32:u,H.T=null,u=om,om=null;var g=Es,x=Bl;if(Rt=0,Nl=Es=null,Bl=0,(Ve&6)!==0)throw Error(n(331));var C=Ve;if(Ve|=4,Ov(g.current),Cv(g,g.current,x,u),Ve=C,xo(0,!1),pn&&typeof pn.onPostCommitFiberRoot=="function")try{pn.onPostCommitFiberRoot(La,g)}catch{}return!0}finally{K.p=m,H.T=f,Qv(s,l)}}function Gv(s,l,u){l=Nn(u,l),l=qd(s.stateNode,l,2),s=vs(s,l,2),s!==null&&(za(s,2),yi(s))}function We(s,l,u){if(s.tag===3)Gv(s,s,u);else for(;l!==null;){if(l.tag===3){Gv(l,s,u);break}else if(l.tag===1){var f=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(Ms===null||!Ms.has(f))){s=Nn(u,s),u=Xb(2),f=vs(l,u,2),f!==null&&(Wb(u,f,l,s),za(f,2),yi(f));break}}l=l.return}}function dm(s,l,u){var f=s.pingCache;if(f===null){f=s.pingCache=new YT;var m=new Set;f.set(l,m)}else m=f.get(l),m===void 0&&(m=new Set,f.set(l,m));m.has(u)||(im=!0,m.add(u),s=ZT.bind(null,s,l,u),l.then(s,s))}function ZT(s,l,u){var f=s.pingCache;f!==null&&f.delete(l),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,Ze===s&&(ze&u)===u&&(lt===4||lt===3&&(ze&62914560)===ze&&300>hi()-lm?(Ve&2)===0&&Ll(s,0):sm|=u,Dl===ze&&(Dl=0)),yi(s)}function Fv(s,l){l===0&&(l=V0()),s=gl(s,l),s!==null&&(za(s,l),yi(s))}function JT(s){var l=s.memoizedState,u=0;l!==null&&(u=l.retryLane),Fv(s,u)}function eO(s,l){var u=0;switch(s.tag){case 13:var f=s.stateNode,m=s.memoizedState;m!==null&&(u=m.retryLane);break;case 19:f=s.stateNode;break;case 22:f=s.stateNode._retryCache;break;default:throw Error(n(314))}f!==null&&f.delete(l),Fv(s,u)}function tO(s,l){return Th(s,l)}var Tc=null,zl=null,mm=!1,Oc=!1,pm=!1,Er=0;function yi(s){s!==zl&&s.next===null&&(zl===null?Tc=zl=s:zl=zl.next=s),Oc=!0,mm||(mm=!0,iO())}function xo(s,l){if(!pm&&Oc){pm=!0;do for(var u=!1,f=Tc;f!==null;){if(s!==0){var m=f.pendingLanes;if(m===0)var g=0;else{var x=f.suspendedLanes,C=f.pingedLanes;g=(1<<31-gn(42|s)+1)-1,g&=m&~(x&~C),g=g&201326741?g&201326741|1:g?g|2:0}g!==0&&(u=!0,Wv(f,g))}else g=ze,g=Bu(f,f===Ze?g:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(g&3)===0||ja(f,g)||(u=!0,Wv(f,g));f=f.next}while(u);pm=!1}}function nO(){Yv()}function Yv(){Oc=mm=!1;var s=0;Er!==0&&(fO()&&(s=Er),Er=0);for(var l=hi(),u=null,f=Tc;f!==null;){var m=f.next,g=Kv(f,l);g===0?(f.next=null,u===null?Tc=m:u.next=m,m===null&&(zl=u)):(u=f,(s!==0||(g&3)!==0)&&(Oc=!0)),f=m}xo(s)}function Kv(s,l){for(var u=s.suspendedLanes,f=s.pingedLanes,m=s.expirationTimes,g=s.pendingLanes&-62914561;0<g;){var x=31-gn(g),C=1<<x,M=m[x];M===-1?((C&u)===0||(C&f)!==0)&&(m[x]=MA(C,l)):M<=l&&(s.expiredLanes|=C),g&=~C}if(l=Ze,u=ze,u=Bu(s,s===l?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f=s.callbackNode,u===0||s===l&&(Qe===2||Qe===9)||s.cancelPendingCommit!==null)return f!==null&&f!==null&&Oh(f),s.callbackNode=null,s.callbackPriority=0;if((u&3)===0||ja(s,u)){if(l=u&-u,l===s.callbackPriority)return l;switch(f!==null&&Oh(f),Rh(u)){case 2:case 8:u=U0;break;case 32:u=Ru;break;case 268435456:u=P0;break;default:u=Ru}return f=Xv.bind(null,s),u=Th(u,f),s.callbackPriority=l,s.callbackNode=u,l}return f!==null&&f!==null&&Oh(f),s.callbackPriority=2,s.callbackNode=null,2}function Xv(s,l){if(Rt!==0&&Rt!==5)return s.callbackNode=null,s.callbackPriority=0,null;var u=s.callbackNode;if(Ac()&&s.callbackNode!==u)return null;var f=ze;return f=Bu(s,s===Ze?f:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),f===0?null:(Dv(s,f,l),Kv(s,hi()),s.callbackNode!=null&&s.callbackNode===u?Xv.bind(null,s):null)}function Wv(s,l){if(Ac())return null;Dv(s,l,!0)}function iO(){dO(function(){(Ve&6)!==0?Th(H0,nO):Yv()})}function gm(){return Er===0&&(Er=q0()),Er}function $v(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:Hu(""+s)}function Zv(s,l){var u=l.ownerDocument.createElement("input");return u.name=l.name,u.value=l.value,s.id&&u.setAttribute("form",s.id),l.parentNode.insertBefore(u,l),s=new FormData(s),u.parentNode.removeChild(u),s}function sO(s,l,u,f,m){if(l==="submit"&&u&&u.stateNode===m){var g=$v((m[Zt]||null).action),x=f.submitter;x&&(l=(l=x[Zt]||null)?$v(l.formAction):x.getAttribute("formAction"),l!==null&&(g=l,x=null));var C=new Vu("action","action",null,f,m);s.push({event:C,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Er!==0){var M=x?Zv(m,x):new FormData(m);zd(u,{pending:!0,data:M,method:m.method,action:g},null,M)}}else typeof g=="function"&&(C.preventDefault(),M=x?Zv(m,x):new FormData(m),zd(u,{pending:!0,data:M,method:m.method,action:g},g,M))},currentTarget:m}]})}}for(var ym=0;ym<td.length;ym++){var bm=td[ym],rO=bm.toLowerCase(),lO=bm[0].toUpperCase()+bm.slice(1);Wn(rO,"on"+lO)}Wn(Dy,"onAnimationEnd"),Wn(Ny,"onAnimationIteration"),Wn(By,"onAnimationStart"),Wn("dblclick","onDoubleClick"),Wn("focusin","onFocus"),Wn("focusout","onBlur"),Wn(kT,"onTransitionRun"),Wn(CT,"onTransitionStart"),Wn(AT,"onTransitionCancel"),Wn(Ly,"onTransitionEnd"),ll("onMouseEnter",["mouseout","mouseover"]),ll("onMouseLeave",["mouseout","mouseover"]),ll("onPointerEnter",["pointerout","pointerover"]),ll("onPointerLeave",["pointerout","pointerover"]),dr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),dr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),dr("onBeforeInput",["compositionend","keypress","textInput","paste"]),dr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),dr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),dr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var So="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),aO=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(So));function Jv(s,l){l=(l&4)!==0;for(var u=0;u<s.length;u++){var f=s[u],m=f.event;f=f.listeners;e:{var g=void 0;if(l)for(var x=f.length-1;0<=x;x--){var C=f[x],M=C.instance,_=C.currentTarget;if(C=C.listener,M!==g&&m.isPropagationStopped())break e;g=C,m.currentTarget=_;try{g(m)}catch(G){mc(G)}m.currentTarget=null,g=M}else for(x=0;x<f.length;x++){if(C=f[x],M=C.instance,_=C.currentTarget,C=C.listener,M!==g&&m.isPropagationStopped())break e;g=C,m.currentTarget=_;try{g(m)}catch(G){mc(G)}m.currentTarget=null,g=M}}}}function Ne(s,l){var u=l[Dh];u===void 0&&(u=l[Dh]=new Set);var f=s+"__bubble";u.has(f)||(ex(l,s,2,!1),u.add(f))}function vm(s,l,u){var f=0;l&&(f|=4),ex(u,s,f,l)}var Mc="_reactListening"+Math.random().toString(36).slice(2);function xm(s){if(!s[Mc]){s[Mc]=!0,Y0.forEach(function(u){u!=="selectionchange"&&(aO.has(u)||vm(u,!1,s),vm(u,!0,s))});var l=s.nodeType===9?s:s.ownerDocument;l===null||l[Mc]||(l[Mc]=!0,vm("selectionchange",!1,l))}}function ex(s,l,u,f){switch(Cx(l)){case 2:var m=LO;break;case 8:m=jO;break;default:m=Lm}u=m.bind(null,l,u,s),m=void 0,!Vh||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(m=!0),f?m!==void 0?s.addEventListener(l,u,{capture:!0,passive:m}):s.addEventListener(l,u,!0):m!==void 0?s.addEventListener(l,u,{passive:m}):s.addEventListener(l,u,!1)}function Sm(s,l,u,f,m){var g=f;if((l&1)===0&&(l&2)===0&&f!==null)e:for(;;){if(f===null)return;var x=f.tag;if(x===3||x===4){var C=f.stateNode.containerInfo;if(C===m)break;if(x===4)for(x=f.return;x!==null;){var M=x.tag;if((M===3||M===4)&&x.stateNode.containerInfo===m)return;x=x.return}for(;C!==null;){if(x=il(C),x===null)return;if(M=x.tag,M===5||M===6||M===26||M===27){f=g=x;continue e}C=C.parentNode}}f=f.return}ay(function(){var _=g,G=Ph(u),$=[];e:{var U=jy.get(s);if(U!==void 0){var P=Vu,we=s;switch(s){case"keypress":if(Pu(u)===0)break e;case"keydown":case"keyup":P=tT;break;case"focusin":we="focus",P=Fh;break;case"focusout":we="blur",P=Fh;break;case"beforeblur":case"afterblur":P=Fh;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":P=cy;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":P=QA;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":P=sT;break;case Dy:case Ny:case By:P=FA;break;case Ly:P=lT;break;case"scroll":case"scrollend":P=qA;break;case"wheel":P=oT;break;case"copy":case"cut":case"paste":P=KA;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":P=hy;break;case"toggle":case"beforetoggle":P=cT}var ve=(l&4)!==0,Fe=!ve&&(s==="scroll"||s==="scrollend"),L=ve?U!==null?U+"Capture":null:U;ve=[];for(var N=_,z;N!==null;){var F=N;if(z=F.stateNode,F=F.tag,F!==5&&F!==26&&F!==27||z===null||L===null||(F=Ua(N,L),F!=null&&ve.push(wo(N,F,z))),Fe)break;N=N.return}0<ve.length&&(U=new P(U,we,null,u,G),$.push({event:U,listeners:ve}))}}if((l&7)===0){e:{if(U=s==="mouseover"||s==="pointerover",P=s==="mouseout"||s==="pointerout",U&&u!==Uh&&(we=u.relatedTarget||u.fromElement)&&(il(we)||we[nl]))break e;if((P||U)&&(U=G.window===G?G:(U=G.ownerDocument)?U.defaultView||U.parentWindow:window,P?(we=u.relatedTarget||u.toElement,P=_,we=we?il(we):null,we!==null&&(Fe=a(we),ve=we.tag,we!==Fe||ve!==5&&ve!==27&&ve!==6)&&(we=null)):(P=null,we=_),P!==we)){if(ve=cy,F="onMouseLeave",L="onMouseEnter",N="mouse",(s==="pointerout"||s==="pointerover")&&(ve=hy,F="onPointerLeave",L="onPointerEnter",N="pointer"),Fe=P==null?U:Ha(P),z=we==null?U:Ha(we),U=new ve(F,N+"leave",P,u,G),U.target=Fe,U.relatedTarget=z,F=null,il(G)===_&&(ve=new ve(L,N+"enter",we,u,G),ve.target=z,ve.relatedTarget=Fe,F=ve),Fe=F,P&&we)t:{for(ve=P,L=we,N=0,z=ve;z;z=_l(z))N++;for(z=0,F=L;F;F=_l(F))z++;for(;0<N-z;)ve=_l(ve),N--;for(;0<z-N;)L=_l(L),z--;for(;N--;){if(ve===L||L!==null&&ve===L.alternate)break t;ve=_l(ve),L=_l(L)}ve=null}else ve=null;P!==null&&tx($,U,P,ve,!1),we!==null&&Fe!==null&&tx($,Fe,we,ve,!0)}}e:{if(U=_?Ha(_):window,P=U.nodeName&&U.nodeName.toLowerCase(),P==="select"||P==="input"&&U.type==="file")var ue=xy;else if(by(U))if(Sy)ue=xT;else{ue=bT;var Ee=yT}else P=U.nodeName,!P||P.toLowerCase()!=="input"||U.type!=="checkbox"&&U.type!=="radio"?_&&Hh(_.elementType)&&(ue=xy):ue=vT;if(ue&&(ue=ue(s,_))){vy($,ue,u,G);break e}Ee&&Ee(s,U,_),s==="focusout"&&_&&U.type==="number"&&_.memoizedProps.value!=null&&_h(U,"number",U.value)}switch(Ee=_?Ha(_):window,s){case"focusin":(by(Ee)||Ee.contentEditable==="true")&&(dl=Ee,Zh=_,Ya=null);break;case"focusout":Ya=Zh=dl=null;break;case"mousedown":Jh=!0;break;case"contextmenu":case"mouseup":case"dragend":Jh=!1,Ey($,u,G);break;case"selectionchange":if(wT)break;case"keydown":case"keyup":Ey($,u,G)}var de;if(Kh)e:{switch(s){case"compositionstart":var Se="onCompositionStart";break e;case"compositionend":Se="onCompositionEnd";break e;case"compositionupdate":Se="onCompositionUpdate";break e}Se=void 0}else hl?gy(s,u)&&(Se="onCompositionEnd"):s==="keydown"&&u.keyCode===229&&(Se="onCompositionStart");Se&&(dy&&u.locale!=="ko"&&(hl||Se!=="onCompositionStart"?Se==="onCompositionEnd"&&hl&&(de=oy()):(ps=G,Qh="value"in ps?ps.value:ps.textContent,hl=!0)),Ee=Ec(_,Se),0<Ee.length&&(Se=new fy(Se,s,null,u,G),$.push({event:Se,listeners:Ee}),de?Se.data=de:(de=yy(u),de!==null&&(Se.data=de)))),(de=hT?dT(s,u):mT(s,u))&&(Se=Ec(_,"onBeforeInput"),0<Se.length&&(Ee=new fy("onBeforeInput","beforeinput",null,u,G),$.push({event:Ee,listeners:Se}),Ee.data=de)),sO($,s,_,u,G)}Jv($,l)})}function wo(s,l,u){return{instance:s,listener:l,currentTarget:u}}function Ec(s,l){for(var u=l+"Capture",f=[];s!==null;){var m=s,g=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||g===null||(m=Ua(s,u),m!=null&&f.unshift(wo(s,m,g)),m=Ua(s,l),m!=null&&f.push(wo(s,m,g))),s.tag===3)return f;s=s.return}return[]}function _l(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function tx(s,l,u,f,m){for(var g=l._reactName,x=[];u!==null&&u!==f;){var C=u,M=C.alternate,_=C.stateNode;if(C=C.tag,M!==null&&M===f)break;C!==5&&C!==26&&C!==27||_===null||(M=_,m?(_=Ua(u,g),_!=null&&x.unshift(wo(u,_,M))):m||(_=Ua(u,g),_!=null&&x.push(wo(u,_,M)))),u=u.return}x.length!==0&&s.push({event:l,listeners:x})}var oO=/\r\n?/g,uO=/\u0000|\uFFFD/g;function nx(s){return(typeof s=="string"?s:""+s).replace(oO,`
49
- `).replace(uO,"")}function ix(s,l){return l=nx(l),nx(s)===l}function Rc(){}function Ge(s,l,u,f,m,g){switch(u){case"children":typeof f=="string"?l==="body"||l==="textarea"&&f===""||ul(s,f):(typeof f=="number"||typeof f=="bigint")&&l!=="body"&&ul(s,""+f);break;case"className":ju(s,"class",f);break;case"tabIndex":ju(s,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":ju(s,u,f);break;case"style":ry(s,f,g);break;case"data":if(l!=="object"){ju(s,"data",f);break}case"src":case"href":if(f===""&&(l!=="a"||u!=="href")){s.removeAttribute(u);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(u);break}f=Hu(""+f),s.setAttribute(u,f);break;case"action":case"formAction":if(typeof f=="function"){s.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof g=="function"&&(u==="formAction"?(l!=="input"&&Ge(s,l,"name",m.name,m,null),Ge(s,l,"formEncType",m.formEncType,m,null),Ge(s,l,"formMethod",m.formMethod,m,null),Ge(s,l,"formTarget",m.formTarget,m,null)):(Ge(s,l,"encType",m.encType,m,null),Ge(s,l,"method",m.method,m,null),Ge(s,l,"target",m.target,m,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){s.removeAttribute(u);break}f=Hu(""+f),s.setAttribute(u,f);break;case"onClick":f!=null&&(s.onclick=Rc);break;case"onScroll":f!=null&&Ne("scroll",s);break;case"onScrollEnd":f!=null&&Ne("scrollend",s);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(n(61));if(u=f.__html,u!=null){if(m.children!=null)throw Error(n(60));s.innerHTML=u}}break;case"multiple":s.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":s.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){s.removeAttribute("xlink:href");break}u=Hu(""+f),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(u,""+f):s.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(u,""):s.removeAttribute(u);break;case"capture":case"download":f===!0?s.setAttribute(u,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?s.setAttribute(u,f):s.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?s.setAttribute(u,f):s.removeAttribute(u);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?s.removeAttribute(u):s.setAttribute(u,f);break;case"popover":Ne("beforetoggle",s),Ne("toggle",s),Lu(s,"popover",f);break;case"xlinkActuate":Ni(s,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Ni(s,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Ni(s,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Ni(s,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Ni(s,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Ni(s,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Ni(s,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Ni(s,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Ni(s,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":Lu(s,"is",f);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=UA.get(u)||u,Lu(s,u,f))}}function wm(s,l,u,f,m,g){switch(u){case"style":ry(s,f,g);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(n(61));if(u=f.__html,u!=null){if(m.children!=null)throw Error(n(60));s.innerHTML=u}}break;case"children":typeof f=="string"?ul(s,f):(typeof f=="number"||typeof f=="bigint")&&ul(s,""+f);break;case"onScroll":f!=null&&Ne("scroll",s);break;case"onScrollEnd":f!=null&&Ne("scrollend",s);break;case"onClick":f!=null&&(s.onclick=Rc);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!K0.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(m=u.endsWith("Capture"),l=u.slice(2,m?u.length-7:void 0),g=s[Zt]||null,g=g!=null?g[u]:null,typeof g=="function"&&s.removeEventListener(l,g,m),typeof f=="function")){typeof g!="function"&&g!==null&&(u in s?s[u]=null:s.hasAttribute(u)&&s.removeAttribute(u)),s.addEventListener(l,f,m);break e}u in s?s[u]=f:f===!0?s.setAttribute(u,""):Lu(s,u,f)}}}function Dt(s,l,u){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ne("error",s),Ne("load",s);var f=!1,m=!1,g;for(g in u)if(u.hasOwnProperty(g)){var x=u[g];if(x!=null)switch(g){case"src":f=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Ge(s,l,g,x,u,null)}}m&&Ge(s,l,"srcSet",u.srcSet,u,null),f&&Ge(s,l,"src",u.src,u,null);return;case"input":Ne("invalid",s);var C=g=x=m=null,M=null,_=null;for(f in u)if(u.hasOwnProperty(f)){var G=u[f];if(G!=null)switch(f){case"name":m=G;break;case"type":x=G;break;case"checked":M=G;break;case"defaultChecked":_=G;break;case"value":g=G;break;case"defaultValue":C=G;break;case"children":case"dangerouslySetInnerHTML":if(G!=null)throw Error(n(137,l));break;default:Ge(s,l,f,G,u,null)}}ty(s,g,C,M,_,x,m,!1),zu(s);return;case"select":Ne("invalid",s),f=x=g=null;for(m in u)if(u.hasOwnProperty(m)&&(C=u[m],C!=null))switch(m){case"value":g=C;break;case"defaultValue":x=C;break;case"multiple":f=C;default:Ge(s,l,m,C,u,null)}l=g,u=x,s.multiple=!!f,l!=null?ol(s,!!f,l,!1):u!=null&&ol(s,!!f,u,!0);return;case"textarea":Ne("invalid",s),g=m=f=null;for(x in u)if(u.hasOwnProperty(x)&&(C=u[x],C!=null))switch(x){case"value":f=C;break;case"defaultValue":m=C;break;case"children":g=C;break;case"dangerouslySetInnerHTML":if(C!=null)throw Error(n(91));break;default:Ge(s,l,x,C,u,null)}iy(s,f,m,g),zu(s);return;case"option":for(M in u)if(u.hasOwnProperty(M)&&(f=u[M],f!=null))switch(M){case"selected":s.selected=f&&typeof f!="function"&&typeof f!="symbol";break;default:Ge(s,l,M,f,u,null)}return;case"dialog":Ne("beforetoggle",s),Ne("toggle",s),Ne("cancel",s),Ne("close",s);break;case"iframe":case"object":Ne("load",s);break;case"video":case"audio":for(f=0;f<So.length;f++)Ne(So[f],s);break;case"image":Ne("error",s),Ne("load",s);break;case"details":Ne("toggle",s);break;case"embed":case"source":case"link":Ne("error",s),Ne("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(_ in u)if(u.hasOwnProperty(_)&&(f=u[_],f!=null))switch(_){case"children":case"dangerouslySetInnerHTML":throw Error(n(137,l));default:Ge(s,l,_,f,u,null)}return;default:if(Hh(l)){for(G in u)u.hasOwnProperty(G)&&(f=u[G],f!==void 0&&wm(s,l,G,f,u,void 0));return}}for(C in u)u.hasOwnProperty(C)&&(f=u[C],f!=null&&Ge(s,l,C,f,u,null))}function cO(s,l,u,f){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,g=null,x=null,C=null,M=null,_=null,G=null;for(P in u){var $=u[P];if(u.hasOwnProperty(P)&&$!=null)switch(P){case"checked":break;case"value":break;case"defaultValue":M=$;default:f.hasOwnProperty(P)||Ge(s,l,P,null,f,$)}}for(var U in f){var P=f[U];if($=u[U],f.hasOwnProperty(U)&&(P!=null||$!=null))switch(U){case"type":g=P;break;case"name":m=P;break;case"checked":_=P;break;case"defaultChecked":G=P;break;case"value":x=P;break;case"defaultValue":C=P;break;case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(n(137,l));break;default:P!==$&&Ge(s,l,U,P,f,$)}}zh(s,x,C,M,_,G,g,m);return;case"select":P=x=C=U=null;for(g in u)if(M=u[g],u.hasOwnProperty(g)&&M!=null)switch(g){case"value":break;case"multiple":P=M;default:f.hasOwnProperty(g)||Ge(s,l,g,null,f,M)}for(m in f)if(g=f[m],M=u[m],f.hasOwnProperty(m)&&(g!=null||M!=null))switch(m){case"value":U=g;break;case"defaultValue":C=g;break;case"multiple":x=g;default:g!==M&&Ge(s,l,m,g,f,M)}l=C,u=x,f=P,U!=null?ol(s,!!u,U,!1):!!f!=!!u&&(l!=null?ol(s,!!u,l,!0):ol(s,!!u,u?[]:"",!1));return;case"textarea":P=U=null;for(C in u)if(m=u[C],u.hasOwnProperty(C)&&m!=null&&!f.hasOwnProperty(C))switch(C){case"value":break;case"children":break;default:Ge(s,l,C,null,f,m)}for(x in f)if(m=f[x],g=u[x],f.hasOwnProperty(x)&&(m!=null||g!=null))switch(x){case"value":U=m;break;case"defaultValue":P=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(n(91));break;default:m!==g&&Ge(s,l,x,m,f,g)}ny(s,U,P);return;case"option":for(var we in u)if(U=u[we],u.hasOwnProperty(we)&&U!=null&&!f.hasOwnProperty(we))switch(we){case"selected":s.selected=!1;break;default:Ge(s,l,we,null,f,U)}for(M in f)if(U=f[M],P=u[M],f.hasOwnProperty(M)&&U!==P&&(U!=null||P!=null))switch(M){case"selected":s.selected=U&&typeof U!="function"&&typeof U!="symbol";break;default:Ge(s,l,M,U,f,P)}return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ve in u)U=u[ve],u.hasOwnProperty(ve)&&U!=null&&!f.hasOwnProperty(ve)&&Ge(s,l,ve,null,f,U);for(_ in f)if(U=f[_],P=u[_],f.hasOwnProperty(_)&&U!==P&&(U!=null||P!=null))switch(_){case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(n(137,l));break;default:Ge(s,l,_,U,f,P)}return;default:if(Hh(l)){for(var Fe in u)U=u[Fe],u.hasOwnProperty(Fe)&&U!==void 0&&!f.hasOwnProperty(Fe)&&wm(s,l,Fe,void 0,f,U);for(G in f)U=f[G],P=u[G],!f.hasOwnProperty(G)||U===P||U===void 0&&P===void 0||wm(s,l,G,U,f,P);return}}for(var L in u)U=u[L],u.hasOwnProperty(L)&&U!=null&&!f.hasOwnProperty(L)&&Ge(s,l,L,null,f,U);for($ in f)U=f[$],P=u[$],!f.hasOwnProperty($)||U===P||U==null&&P==null||Ge(s,l,$,U,f,P)}var km=null,Cm=null;function Dc(s){return s.nodeType===9?s:s.ownerDocument}function sx(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function rx(s,l){if(s===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&l==="foreignObject"?0:s}function Am(s,l){return s==="textarea"||s==="noscript"||typeof l.children=="string"||typeof l.children=="number"||typeof l.children=="bigint"||typeof l.dangerouslySetInnerHTML=="object"&&l.dangerouslySetInnerHTML!==null&&l.dangerouslySetInnerHTML.__html!=null}var Tm=null;function fO(){var s=window.event;return s&&s.type==="popstate"?s===Tm?!1:(Tm=s,!0):(Tm=null,!1)}var lx=typeof setTimeout=="function"?setTimeout:void 0,hO=typeof clearTimeout=="function"?clearTimeout:void 0,ax=typeof Promise=="function"?Promise:void 0,dO=typeof queueMicrotask=="function"?queueMicrotask:typeof ax<"u"?function(s){return ax.resolve(null).then(s).catch(mO)}:lx;function mO(s){setTimeout(function(){throw s})}function Ds(s){return s==="head"}function ox(s,l){var u=l,f=0,m=0;do{var g=u.nextSibling;if(s.removeChild(u),g&&g.nodeType===8)if(u=g.data,u==="/$"){if(0<f&&8>f){u=f;var x=s.ownerDocument;if(u&1&&ko(x.documentElement),u&2&&ko(x.body),u&4)for(u=x.head,ko(u),x=u.firstChild;x;){var C=x.nextSibling,M=x.nodeName;x[_a]||M==="SCRIPT"||M==="STYLE"||M==="LINK"&&x.rel.toLowerCase()==="stylesheet"||u.removeChild(x),x=C}}if(m===0){s.removeChild(g),Do(l);return}m--}else u==="$"||u==="$?"||u==="$!"?m++:f=u.charCodeAt(0)-48;else f=0;u=g}while(u);Do(l)}function Om(s){var l=s.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var u=l;switch(l=l.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":Om(u),Nh(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}s.removeChild(u)}}function pO(s,l,u,f){for(;s.nodeType===1;){var m=u;if(s.nodeName.toLowerCase()!==l.toLowerCase()){if(!f&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(f){if(!s[_a])switch(l){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(g=s.getAttribute("rel"),g==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(g!==m.rel||s.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||s.getAttribute("title")!==(m.title==null?null:m.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(g=s.getAttribute("src"),(g!==(m.src==null?null:m.src)||s.getAttribute("type")!==(m.type==null?null:m.type)||s.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&g&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(l==="input"&&s.type==="hidden"){var g=m.name==null?null:""+m.name;if(m.type==="hidden"&&s.getAttribute("name")===g)return s}else return s;if(s=Zn(s.nextSibling),s===null)break}return null}function gO(s,l,u){if(l==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!u||(s=Zn(s.nextSibling),s===null))return null;return s}function Mm(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState==="complete"}function yO(s,l){var u=s.ownerDocument;if(s.data!=="$?"||u.readyState==="complete")l();else{var f=function(){l(),u.removeEventListener("DOMContentLoaded",f)};u.addEventListener("DOMContentLoaded",f),s._reactRetry=f}}function Zn(s){for(;s!=null;s=s.nextSibling){var l=s.nodeType;if(l===1||l===3)break;if(l===8){if(l=s.data,l==="$"||l==="$!"||l==="$?"||l==="F!"||l==="F")break;if(l==="/$")return null}}return s}var Em=null;function ux(s){s=s.previousSibling;for(var l=0;s;){if(s.nodeType===8){var u=s.data;if(u==="$"||u==="$!"||u==="$?"){if(l===0)return s;l--}else u==="/$"&&l++}s=s.previousSibling}return null}function cx(s,l,u){switch(l=Dc(u),s){case"html":if(s=l.documentElement,!s)throw Error(n(452));return s;case"head":if(s=l.head,!s)throw Error(n(453));return s;case"body":if(s=l.body,!s)throw Error(n(454));return s;default:throw Error(n(451))}}function ko(s){for(var l=s.attributes;l.length;)s.removeAttributeNode(l[0]);Nh(s)}var Hn=new Map,fx=new Set;function Nc(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Fi=K.d;K.d={f:bO,r:vO,D:xO,C:SO,L:wO,m:kO,X:AO,S:CO,M:TO};function bO(){var s=Fi.f(),l=kc();return s||l}function vO(s){var l=sl(s);l!==null&&l.tag===5&&l.type==="form"?Db(l):Fi.r(s)}var Hl=typeof document>"u"?null:document;function hx(s,l,u){var f=Hl;if(f&&typeof l=="string"&&l){var m=Dn(l);m='link[rel="'+s+'"][href="'+m+'"]',typeof u=="string"&&(m+='[crossorigin="'+u+'"]'),fx.has(m)||(fx.add(m),s={rel:s,crossOrigin:u,href:l},f.querySelector(m)===null&&(l=f.createElement("link"),Dt(l,"link",s),kt(l),f.head.appendChild(l)))}}function xO(s){Fi.D(s),hx("dns-prefetch",s,null)}function SO(s,l){Fi.C(s,l),hx("preconnect",s,l)}function wO(s,l,u){Fi.L(s,l,u);var f=Hl;if(f&&s&&l){var m='link[rel="preload"][as="'+Dn(l)+'"]';l==="image"&&u&&u.imageSrcSet?(m+='[imagesrcset="'+Dn(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(m+='[imagesizes="'+Dn(u.imageSizes)+'"]')):m+='[href="'+Dn(s)+'"]';var g=m;switch(l){case"style":g=Ul(s);break;case"script":g=Pl(s)}Hn.has(g)||(s=p({rel:"preload",href:l==="image"&&u&&u.imageSrcSet?void 0:s,as:l},u),Hn.set(g,s),f.querySelector(m)!==null||l==="style"&&f.querySelector(Co(g))||l==="script"&&f.querySelector(Ao(g))||(l=f.createElement("link"),Dt(l,"link",s),kt(l),f.head.appendChild(l)))}}function kO(s,l){Fi.m(s,l);var u=Hl;if(u&&s){var f=l&&typeof l.as=="string"?l.as:"script",m='link[rel="modulepreload"][as="'+Dn(f)+'"][href="'+Dn(s)+'"]',g=m;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":g=Pl(s)}if(!Hn.has(g)&&(s=p({rel:"modulepreload",href:s},l),Hn.set(g,s),u.querySelector(m)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(Ao(g)))return}f=u.createElement("link"),Dt(f,"link",s),kt(f),u.head.appendChild(f)}}}function CO(s,l,u){Fi.S(s,l,u);var f=Hl;if(f&&s){var m=rl(f).hoistableStyles,g=Ul(s);l=l||"default";var x=m.get(g);if(!x){var C={loading:0,preload:null};if(x=f.querySelector(Co(g)))C.loading=5;else{s=p({rel:"stylesheet",href:s,"data-precedence":l},u),(u=Hn.get(g))&&Rm(s,u);var M=x=f.createElement("link");kt(M),Dt(M,"link",s),M._p=new Promise(function(_,G){M.onload=_,M.onerror=G}),M.addEventListener("load",function(){C.loading|=1}),M.addEventListener("error",function(){C.loading|=2}),C.loading|=4,Bc(x,l,f)}x={type:"stylesheet",instance:x,count:1,state:C},m.set(g,x)}}}function AO(s,l){Fi.X(s,l);var u=Hl;if(u&&s){var f=rl(u).hoistableScripts,m=Pl(s),g=f.get(m);g||(g=u.querySelector(Ao(m)),g||(s=p({src:s,async:!0},l),(l=Hn.get(m))&&Dm(s,l),g=u.createElement("script"),kt(g),Dt(g,"link",s),u.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},f.set(m,g))}}function TO(s,l){Fi.M(s,l);var u=Hl;if(u&&s){var f=rl(u).hoistableScripts,m=Pl(s),g=f.get(m);g||(g=u.querySelector(Ao(m)),g||(s=p({src:s,async:!0,type:"module"},l),(l=Hn.get(m))&&Dm(s,l),g=u.createElement("script"),kt(g),Dt(g,"link",s),u.head.appendChild(g)),g={type:"script",instance:g,count:1,state:null},f.set(m,g))}}function dx(s,l,u,f){var m=(m=be.current)?Nc(m):null;if(!m)throw Error(n(446));switch(s){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(l=Ul(u.href),u=rl(m).hoistableStyles,f=u.get(l),f||(f={type:"style",instance:null,count:0,state:null},u.set(l,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){s=Ul(u.href);var g=rl(m).hoistableStyles,x=g.get(s);if(x||(m=m.ownerDocument||m,x={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},g.set(s,x),(g=m.querySelector(Co(s)))&&!g._p&&(x.instance=g,x.state.loading=5),Hn.has(s)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},Hn.set(s,u),g||OO(m,s,u,x.state))),l&&f===null)throw Error(n(528,""));return x}if(l&&f!==null)throw Error(n(529,""));return null;case"script":return l=u.async,u=u.src,typeof u=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=Pl(u),u=rl(m).hoistableScripts,f=u.get(l),f||(f={type:"script",instance:null,count:0,state:null},u.set(l,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(n(444,s))}}function Ul(s){return'href="'+Dn(s)+'"'}function Co(s){return'link[rel="stylesheet"]['+s+"]"}function mx(s){return p({},s,{"data-precedence":s.precedence,precedence:null})}function OO(s,l,u,f){s.querySelector('link[rel="preload"][as="style"]['+l+"]")?f.loading=1:(l=s.createElement("link"),f.preload=l,l.addEventListener("load",function(){return f.loading|=1}),l.addEventListener("error",function(){return f.loading|=2}),Dt(l,"link",u),kt(l),s.head.appendChild(l))}function Pl(s){return'[src="'+Dn(s)+'"]'}function Ao(s){return"script[async]"+s}function px(s,l,u){if(l.count++,l.instance===null)switch(l.type){case"style":var f=s.querySelector('style[data-href~="'+Dn(u.href)+'"]');if(f)return l.instance=f,kt(f),f;var m=p({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return f=(s.ownerDocument||s).createElement("style"),kt(f),Dt(f,"style",m),Bc(f,u.precedence,s),l.instance=f;case"stylesheet":m=Ul(u.href);var g=s.querySelector(Co(m));if(g)return l.state.loading|=4,l.instance=g,kt(g),g;f=mx(u),(m=Hn.get(m))&&Rm(f,m),g=(s.ownerDocument||s).createElement("link"),kt(g);var x=g;return x._p=new Promise(function(C,M){x.onload=C,x.onerror=M}),Dt(g,"link",f),l.state.loading|=4,Bc(g,u.precedence,s),l.instance=g;case"script":return g=Pl(u.src),(m=s.querySelector(Ao(g)))?(l.instance=m,kt(m),m):(f=u,(m=Hn.get(g))&&(f=p({},u),Dm(f,m)),s=s.ownerDocument||s,m=s.createElement("script"),kt(m),Dt(m,"link",f),s.head.appendChild(m),l.instance=m);case"void":return null;default:throw Error(n(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(f=l.instance,l.state.loading|=4,Bc(f,u.precedence,s));return l.instance}function Bc(s,l,u){for(var f=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=f.length?f[f.length-1]:null,g=m,x=0;x<f.length;x++){var C=f[x];if(C.dataset.precedence===l)g=C;else if(g!==m)break}g?g.parentNode.insertBefore(s,g.nextSibling):(l=u.nodeType===9?u.head:u,l.insertBefore(s,l.firstChild))}function Rm(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.title==null&&(s.title=l.title)}function Dm(s,l){s.crossOrigin==null&&(s.crossOrigin=l.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=l.referrerPolicy),s.integrity==null&&(s.integrity=l.integrity)}var Lc=null;function gx(s,l,u){if(Lc===null){var f=new Map,m=Lc=new Map;m.set(u,f)}else m=Lc,f=m.get(u),f||(f=new Map,m.set(u,f));if(f.has(s))return f;for(f.set(s,null),u=u.getElementsByTagName(s),m=0;m<u.length;m++){var g=u[m];if(!(g[_a]||g[_t]||s==="link"&&g.getAttribute("rel")==="stylesheet")&&g.namespaceURI!=="http://www.w3.org/2000/svg"){var x=g.getAttribute(l)||"";x=s+x;var C=f.get(x);C?C.push(g):f.set(x,[g])}}return f}function yx(s,l,u){s=s.ownerDocument||s,s.head.insertBefore(u,l==="title"?s.querySelector("head > title"):null)}function MO(s,l,u){if(u===1||l.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof l.precedence!="string"||typeof l.href!="string"||l.href==="")break;return!0;case"link":if(typeof l.rel!="string"||typeof l.href!="string"||l.href===""||l.onLoad||l.onError)break;switch(l.rel){case"stylesheet":return s=l.disabled,typeof l.precedence=="string"&&s==null;default:return!0}case"script":if(l.async&&typeof l.async!="function"&&typeof l.async!="symbol"&&!l.onLoad&&!l.onError&&l.src&&typeof l.src=="string")return!0}return!1}function bx(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}var To=null;function EO(){}function RO(s,l,u){if(To===null)throw Error(n(475));var f=To;if(l.type==="stylesheet"&&(typeof u.media!="string"||matchMedia(u.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var m=Ul(u.href),g=s.querySelector(Co(m));if(g){s=g._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(f.count++,f=jc.bind(f),s.then(f,f)),l.state.loading|=4,l.instance=g,kt(g);return}g=s.ownerDocument||s,u=mx(u),(m=Hn.get(m))&&Rm(u,m),g=g.createElement("link"),kt(g);var x=g;x._p=new Promise(function(C,M){x.onload=C,x.onerror=M}),Dt(g,"link",u),l.instance=g}f.stylesheets===null&&(f.stylesheets=new Map),f.stylesheets.set(l,s),(s=l.state.preload)&&(l.state.loading&3)===0&&(f.count++,l=jc.bind(f),s.addEventListener("load",l),s.addEventListener("error",l))}}function DO(){if(To===null)throw Error(n(475));var s=To;return s.stylesheets&&s.count===0&&Nm(s,s.stylesheets),0<s.count?function(l){var u=setTimeout(function(){if(s.stylesheets&&Nm(s,s.stylesheets),s.unsuspend){var f=s.unsuspend;s.unsuspend=null,f()}},6e4);return s.unsuspend=l,function(){s.unsuspend=null,clearTimeout(u)}}:null}function jc(){if(this.count--,this.count===0){if(this.stylesheets)Nm(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var zc=null;function Nm(s,l){s.stylesheets=null,s.unsuspend!==null&&(s.count++,zc=new Map,l.forEach(NO,s),zc=null,jc.call(s))}function NO(s,l){if(!(l.state.loading&4)){var u=zc.get(s);if(u)var f=u.get(null);else{u=new Map,zc.set(s,u);for(var m=s.querySelectorAll("link[data-precedence],style[data-precedence]"),g=0;g<m.length;g++){var x=m[g];(x.nodeName==="LINK"||x.getAttribute("media")!=="not all")&&(u.set(x.dataset.precedence,x),f=x)}f&&u.set(null,f)}m=l.instance,x=m.getAttribute("data-precedence"),g=u.get(x)||f,g===f&&u.set(null,m),u.set(x,m),this.count++,f=jc.bind(this),m.addEventListener("load",f),m.addEventListener("error",f),g?g.parentNode.insertBefore(m,g.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(m,s.firstChild)),l.state.loading|=4}}var Oo={$$typeof:B,Provider:null,Consumer:null,_currentValue:W,_currentValue2:W,_threadCount:0};function BO(s,l,u,f,m,g,x,C){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Mh(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Mh(0),this.hiddenUpdates=Mh(null),this.identifierPrefix=f,this.onUncaughtError=m,this.onCaughtError=g,this.onRecoverableError=x,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=C,this.incompleteTransitions=new Map}function vx(s,l,u,f,m,g,x,C,M,_,G,$){return s=new BO(s,l,u,x,C,M,_,$),l=1,g===!0&&(l|=24),g=bn(3,null,null,l),s.current=g,g.stateNode=s,l=dd(),l.refCount++,s.pooledCache=l,l.refCount++,g.memoizedState={element:f,isDehydrated:u,cache:l},yd(g),s}function xx(s){return s?(s=yl,s):yl}function Sx(s,l,u,f,m,g){m=xx(m),f.context===null?f.context=m:f.pendingContext=m,f=bs(l),f.payload={element:u},g=g===void 0?null:g,g!==null&&(f.callback=g),u=vs(s,f,l),u!==null&&(kn(u,s,l),no(u,s,l))}function wx(s,l){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u<l?u:l}}function Bm(s,l){wx(s,l),(s=s.alternate)&&wx(s,l)}function kx(s){if(s.tag===13){var l=gl(s,67108864);l!==null&&kn(l,s,67108864),Bm(s,67108864)}}var _c=!0;function LO(s,l,u,f){var m=H.T;H.T=null;var g=K.p;try{K.p=2,Lm(s,l,u,f)}finally{K.p=g,H.T=m}}function jO(s,l,u,f){var m=H.T;H.T=null;var g=K.p;try{K.p=8,Lm(s,l,u,f)}finally{K.p=g,H.T=m}}function Lm(s,l,u,f){if(_c){var m=jm(f);if(m===null)Sm(s,l,f,Hc,u),Ax(s,f);else if(_O(m,s,l,u,f))f.stopPropagation();else if(Ax(s,f),l&4&&-1<zO.indexOf(s)){for(;m!==null;){var g=sl(m);if(g!==null)switch(g.tag){case 3:if(g=g.stateNode,g.current.memoizedState.isDehydrated){var x=hr(g.pendingLanes);if(x!==0){var C=g;for(C.pendingLanes|=2,C.entangledLanes|=2;x;){var M=1<<31-gn(x);C.entanglements[1]|=M,x&=~M}yi(g),(Ve&6)===0&&(Sc=hi()+500,xo(0))}}break;case 13:C=gl(g,2),C!==null&&kn(C,g,2),kc(),Bm(g,2)}if(g=jm(f),g===null&&Sm(s,l,f,Hc,u),g===m)break;m=g}m!==null&&f.stopPropagation()}else Sm(s,l,f,null,u)}}function jm(s){return s=Ph(s),zm(s)}var Hc=null;function zm(s){if(Hc=null,s=il(s),s!==null){var l=a(s);if(l===null)s=null;else{var u=l.tag;if(u===13){if(s=o(l),s!==null)return s;s=null}else if(u===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;s=null}else l!==s&&(s=null)}}return Hc=s,null}function Cx(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(SA()){case H0:return 2;case U0:return 8;case Ru:case wA:return 32;case P0:return 268435456;default:return 32}default:return 32}}var _m=!1,Ns=null,Bs=null,Ls=null,Mo=new Map,Eo=new Map,js=[],zO="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Ax(s,l){switch(s){case"focusin":case"focusout":Ns=null;break;case"dragenter":case"dragleave":Bs=null;break;case"mouseover":case"mouseout":Ls=null;break;case"pointerover":case"pointerout":Mo.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Eo.delete(l.pointerId)}}function Ro(s,l,u,f,m,g){return s===null||s.nativeEvent!==g?(s={blockedOn:l,domEventName:u,eventSystemFlags:f,nativeEvent:g,targetContainers:[m]},l!==null&&(l=sl(l),l!==null&&kx(l)),s):(s.eventSystemFlags|=f,l=s.targetContainers,m!==null&&l.indexOf(m)===-1&&l.push(m),s)}function _O(s,l,u,f,m){switch(l){case"focusin":return Ns=Ro(Ns,s,l,u,f,m),!0;case"dragenter":return Bs=Ro(Bs,s,l,u,f,m),!0;case"mouseover":return Ls=Ro(Ls,s,l,u,f,m),!0;case"pointerover":var g=m.pointerId;return Mo.set(g,Ro(Mo.get(g)||null,s,l,u,f,m)),!0;case"gotpointercapture":return g=m.pointerId,Eo.set(g,Ro(Eo.get(g)||null,s,l,u,f,m)),!0}return!1}function Tx(s){var l=il(s.target);if(l!==null){var u=a(l);if(u!==null){if(l=u.tag,l===13){if(l=o(u),l!==null){s.blockedOn=l,RA(s.priority,function(){if(u.tag===13){var f=wn();f=Eh(f);var m=gl(u,f);m!==null&&kn(m,u,f),Bm(u,f)}});return}}else if(l===3&&u.stateNode.current.memoizedState.isDehydrated){s.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Uc(s){if(s.blockedOn!==null)return!1;for(var l=s.targetContainers;0<l.length;){var u=jm(s.nativeEvent);if(u===null){u=s.nativeEvent;var f=new u.constructor(u.type,u);Uh=f,u.target.dispatchEvent(f),Uh=null}else return l=sl(u),l!==null&&kx(l),s.blockedOn=u,!1;l.shift()}return!0}function Ox(s,l,u){Uc(s)&&u.delete(l)}function HO(){_m=!1,Ns!==null&&Uc(Ns)&&(Ns=null),Bs!==null&&Uc(Bs)&&(Bs=null),Ls!==null&&Uc(Ls)&&(Ls=null),Mo.forEach(Ox),Eo.forEach(Ox)}function Pc(s,l){s.blockedOn===l&&(s.blockedOn=null,_m||(_m=!0,i.unstable_scheduleCallback(i.unstable_NormalPriority,HO)))}var qc=null;function Mx(s){qc!==s&&(qc=s,i.unstable_scheduleCallback(i.unstable_NormalPriority,function(){qc===s&&(qc=null);for(var l=0;l<s.length;l+=3){var u=s[l],f=s[l+1],m=s[l+2];if(typeof f!="function"){if(zm(f||u)===null)continue;break}var g=sl(u);g!==null&&(s.splice(l,3),l-=3,zd(g,{pending:!0,data:m,method:u.method,action:f},f,m))}}))}function Do(s){function l(M){return Pc(M,s)}Ns!==null&&Pc(Ns,s),Bs!==null&&Pc(Bs,s),Ls!==null&&Pc(Ls,s),Mo.forEach(l),Eo.forEach(l);for(var u=0;u<js.length;u++){var f=js[u];f.blockedOn===s&&(f.blockedOn=null)}for(;0<js.length&&(u=js[0],u.blockedOn===null);)Tx(u),u.blockedOn===null&&js.shift();if(u=(s.ownerDocument||s).$$reactFormReplay,u!=null)for(f=0;f<u.length;f+=3){var m=u[f],g=u[f+1],x=m[Zt]||null;if(typeof g=="function")x||Mx(u);else if(x){var C=null;if(g&&g.hasAttribute("formAction")){if(m=g,x=g[Zt]||null)C=x.formAction;else if(zm(m)!==null)continue}else C=x.action;typeof C=="function"?u[f+1]=C:(u.splice(f,3),f-=3),Mx(u)}}}function Hm(s){this._internalRoot=s}Vc.prototype.render=Hm.prototype.render=function(s){var l=this._internalRoot;if(l===null)throw Error(n(409));var u=l.current,f=wn();Sx(u,f,s,l,null,null)},Vc.prototype.unmount=Hm.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var l=s.containerInfo;Sx(s.current,2,null,s,null,null),kc(),l[nl]=null}};function Vc(s){this._internalRoot=s}Vc.prototype.unstable_scheduleHydration=function(s){if(s){var l=G0();s={blockedOn:null,target:s,priority:l};for(var u=0;u<js.length&&l!==0&&l<js[u].priority;u++);js.splice(u,0,s),u===0&&Tx(s)}};var Ex=e.version;if(Ex!=="19.1.2")throw Error(n(527,Ex,"19.1.2"));K.findDOMNode=function(s){var l=s._reactInternals;if(l===void 0)throw typeof s.render=="function"?Error(n(188)):(s=Object.keys(s).join(","),Error(n(268,s)));return s=h(l),s=s!==null?d(s):null,s=s===null?null:s.stateNode,s};var UO={bundleType:0,version:"19.1.2",rendererPackageName:"react-dom",currentDispatcherRef:H,reconcilerVersion:"19.1.2"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Qc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Qc.isDisabled&&Qc.supportsFiber)try{La=Qc.inject(UO),pn=Qc}catch{}}return Bo.createRoot=function(s,l){if(!r(s))throw Error(n(299));var u=!1,f="",m=Gb,g=Fb,x=Yb,C=null;return l!=null&&(l.unstable_strictMode===!0&&(u=!0),l.identifierPrefix!==void 0&&(f=l.identifierPrefix),l.onUncaughtError!==void 0&&(m=l.onUncaughtError),l.onCaughtError!==void 0&&(g=l.onCaughtError),l.onRecoverableError!==void 0&&(x=l.onRecoverableError),l.unstable_transitionCallbacks!==void 0&&(C=l.unstable_transitionCallbacks)),l=vx(s,1,!1,null,null,u,f,m,g,x,C,null),s[nl]=l.current,xm(s),new Hm(l)},Bo.hydrateRoot=function(s,l,u){if(!r(s))throw Error(n(299));var f=!1,m="",g=Gb,x=Fb,C=Yb,M=null,_=null;return u!=null&&(u.unstable_strictMode===!0&&(f=!0),u.identifierPrefix!==void 0&&(m=u.identifierPrefix),u.onUncaughtError!==void 0&&(g=u.onUncaughtError),u.onCaughtError!==void 0&&(x=u.onCaughtError),u.onRecoverableError!==void 0&&(C=u.onRecoverableError),u.unstable_transitionCallbacks!==void 0&&(M=u.unstable_transitionCallbacks),u.formState!==void 0&&(_=u.formState)),l=vx(s,1,!0,l,u??null,f,m,g,x,C,M,_),l.context=xx(null),u=l.current,f=wn(),f=Eh(f),m=bs(f),m.callback=null,vs(u,m,f),u=f,l.current.lanes=u,za(l,u),yi(l),s[nl]=l.current,xm(s),new Vc(l)},Bo.version="19.1.2",Bo}var Xx;function EM(){if(Xx)return Qm.exports;Xx=1;function i(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(i)}catch(e){console.error(e)}}return i(),Qm.exports=MM(),Qm.exports}var RM=EM(),Lo={},Wx;function DM(){if(Wx)return Lo;Wx=1,Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.parse=o,Lo.serialize=d;const i=/^[\u0021-\u003A\u003C\u003E-\u007E]+$/,e=/^[\u0021-\u003A\u003C-\u007E]*$/,t=/^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i,n=/^[\u0020-\u003A\u003D-\u007E]*$/,r=Object.prototype.toString,a=(()=>{const b=function(){};return b.prototype=Object.create(null),b})();function o(b,v){const w=new a,k=b.length;if(k<2)return w;const A=(v==null?void 0:v.decode)||p;let O=0;do{const D=b.indexOf("=",O);if(D===-1)break;const B=b.indexOf(";",O),V=B===-1?k:B;if(D>V){O=b.lastIndexOf(";",D-1)+1;continue}const j=c(b,O,D),Q=h(b,D,j),I=b.slice(j,Q);if(w[I]===void 0){let q=c(b,D+1,V),Y=h(b,V,q);const te=A(b.slice(q,Y));w[I]=te}O=V+1}while(O<k);return w}function c(b,v,w){do{const k=b.charCodeAt(v);if(k!==32&&k!==9)return v}while(++v<w);return w}function h(b,v,w){for(;v>w;){const k=b.charCodeAt(--v);if(k!==32&&k!==9)return v+1}return w}function d(b,v,w){const k=(w==null?void 0:w.encode)||encodeURIComponent;if(!i.test(b))throw new TypeError(`argument name is invalid: ${b}`);const A=k(v);if(!e.test(A))throw new TypeError(`argument val is invalid: ${v}`);let O=b+"="+A;if(!w)return O;if(w.maxAge!==void 0){if(!Number.isInteger(w.maxAge))throw new TypeError(`option maxAge is invalid: ${w.maxAge}`);O+="; Max-Age="+w.maxAge}if(w.domain){if(!t.test(w.domain))throw new TypeError(`option domain is invalid: ${w.domain}`);O+="; Domain="+w.domain}if(w.path){if(!n.test(w.path))throw new TypeError(`option path is invalid: ${w.path}`);O+="; Path="+w.path}if(w.expires){if(!y(w.expires)||!Number.isFinite(w.expires.valueOf()))throw new TypeError(`option expires is invalid: ${w.expires}`);O+="; Expires="+w.expires.toUTCString()}if(w.httpOnly&&(O+="; HttpOnly"),w.secure&&(O+="; Secure"),w.partitioned&&(O+="; Partitioned"),w.priority)switch(typeof w.priority=="string"?w.priority.toLowerCase():void 0){case"low":O+="; Priority=Low";break;case"medium":O+="; Priority=Medium";break;case"high":O+="; Priority=High";break;default:throw new TypeError(`option priority is invalid: ${w.priority}`)}if(w.sameSite)switch(typeof w.sameSite=="string"?w.sameSite.toLowerCase():w.sameSite){case!0:case"strict":O+="; SameSite=Strict";break;case"lax":O+="; SameSite=Lax";break;case"none":O+="; SameSite=None";break;default:throw new TypeError(`option sameSite is invalid: ${w.sameSite}`)}return O}function p(b){if(b.indexOf("%")===-1)return b;try{return decodeURIComponent(b)}catch{return b}}function y(b){return r.call(b)==="[object Date]"}return Lo}DM();var $x="popstate";function NM(i={}){function e(n,r){let{pathname:a,search:o,hash:c}=n.location;return Pp("",{pathname:a,search:o,hash:c},r.state&&r.state.usr||null,r.state&&r.state.key||"default")}function t(n,r){return typeof r=="string"?r:eu(r)}return LM(e,t,null,i)}function it(i,e){if(i===!1||i===null||typeof i>"u")throw new Error(e)}function ri(i,e){if(!i){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function BM(){return Math.random().toString(36).substring(2,10)}function Zx(i,e){return{usr:i.state,key:i.key,idx:e}}function Pp(i,e,t=null,n){return{pathname:typeof i=="string"?i:i.pathname,search:"",hash:"",...typeof e=="string"?Ca(e):e,state:t,key:e&&e.key||n||BM()}}function eu({pathname:i="/",search:e="",hash:t=""}){return e&&e!=="?"&&(i+=e.charAt(0)==="?"?e:"?"+e),t&&t!=="#"&&(i+=t.charAt(0)==="#"?t:"#"+t),i}function Ca(i){let e={};if(i){let t=i.indexOf("#");t>=0&&(e.hash=i.substring(t),i=i.substring(0,t));let n=i.indexOf("?");n>=0&&(e.search=i.substring(n),i=i.substring(0,n)),i&&(e.pathname=i)}return e}function LM(i,e,t,n={}){let{window:r=document.defaultView,v5Compat:a=!1}=n,o=r.history,c="POP",h=null,d=p();d==null&&(d=0,o.replaceState({...o.state,idx:d},""));function p(){return(o.state||{idx:null}).idx}function y(){c="POP";let A=p(),O=A==null?null:A-d;d=A,h&&h({action:c,location:k.location,delta:O})}function b(A,O){c="PUSH";let D=Pp(k.location,A,O);d=p()+1;let B=Zx(D,d),V=k.createHref(D);try{o.pushState(B,"",V)}catch(j){if(j instanceof DOMException&&j.name==="DataCloneError")throw j;r.location.assign(V)}a&&h&&h({action:c,location:k.location,delta:1})}function v(A,O){c="REPLACE";let D=Pp(k.location,A,O);d=p();let B=Zx(D,d),V=k.createHref(D);o.replaceState(B,"",V),a&&h&&h({action:c,location:k.location,delta:0})}function w(A){return jM(A)}let k={get action(){return c},get location(){return i(r,o)},listen(A){if(h)throw new Error("A history only accepts one active listener");return r.addEventListener($x,y),h=A,()=>{r.removeEventListener($x,y),h=null}},createHref(A){return e(r,A)},createURL:w,encodeLocation(A){let O=w(A);return{pathname:O.pathname,search:O.search,hash:O.hash}},push:b,replace:v,go(A){return o.go(A)}};return k}function jM(i,e=!1){let t="http://localhost";typeof window<"u"&&(t=window.location.origin!=="null"?window.location.origin:window.location.href),it(t,"No window.location.(origin|href) available to create URL");let n=typeof i=="string"?i:eu(i);return n=n.replace(/ $/,"%20"),!e&&n.startsWith("//")&&(n=t+n),new URL(n,t)}function Tw(i,e,t="/"){return zM(i,e,t,!1)}function zM(i,e,t,n){let r=typeof e=="string"?Ca(e):e,a=ss(r.pathname||"/",t);if(a==null)return null;let o=Ow(i);_M(o);let c=null;for(let h=0;c==null&&h<o.length;++h){let d=KM(a);c=FM(o[h],d,n)}return c}function Ow(i,e=[],t=[],n=""){let r=(a,o,c)=>{let h={relativePath:c===void 0?a.path||"":c,caseSensitive:a.caseSensitive===!0,childrenIndex:o,route:a};h.relativePath.startsWith("/")&&(it(h.relativePath.startsWith(n),`Absolute route path "${h.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),h.relativePath=h.relativePath.slice(n.length));let d=ns([n,h.relativePath]),p=t.concat(h);a.children&&a.children.length>0&&(it(a.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${d}".`),Ow(a.children,e,p,d)),!(a.path==null&&!a.index)&&e.push({path:d,score:IM(d,a.index),routesMeta:p})};return i.forEach((a,o)=>{var c;if(a.path===""||!((c=a.path)!=null&&c.includes("?")))r(a,o);else for(let h of Mw(a.path))r(a,o,h)}),e}function Mw(i){let e=i.split("/");if(e.length===0)return[];let[t,...n]=e,r=t.endsWith("?"),a=t.replace(/\?$/,"");if(n.length===0)return r?[a,""]:[a];let o=Mw(n.join("/")),c=[];return c.push(...o.map(h=>h===""?a:[a,h].join("/"))),r&&c.push(...o),c.map(h=>i.startsWith("/")&&h===""?"/":h)}function _M(i){i.sort((e,t)=>e.score!==t.score?t.score-e.score:GM(e.routesMeta.map(n=>n.childrenIndex),t.routesMeta.map(n=>n.childrenIndex)))}var HM=/^:[\w-]+$/,UM=3,PM=2,qM=1,VM=10,QM=-2,Jx=i=>i==="*";function IM(i,e){let t=i.split("/"),n=t.length;return t.some(Jx)&&(n+=QM),e&&(n+=PM),t.filter(r=>!Jx(r)).reduce((r,a)=>r+(HM.test(a)?UM:a===""?qM:VM),n)}function GM(i,e){return i.length===e.length&&i.slice(0,-1).every((n,r)=>n===e[r])?i[i.length-1]-e[e.length-1]:0}function FM(i,e,t=!1){let{routesMeta:n}=i,r={},a="/",o=[];for(let c=0;c<n.length;++c){let h=n[c],d=c===n.length-1,p=a==="/"?e:e.slice(a.length)||"/",y=Df({path:h.relativePath,caseSensitive:h.caseSensitive,end:d},p),b=h.route;if(!y&&d&&t&&!n[n.length-1].route.index&&(y=Df({path:h.relativePath,caseSensitive:h.caseSensitive,end:!1},p)),!y)return null;Object.assign(r,y.params),o.push({params:r,pathname:ns([a,y.pathname]),pathnameBase:ZM(ns([a,y.pathnameBase])),route:b}),y.pathnameBase!=="/"&&(a=ns([a,y.pathnameBase]))}return o}function Df(i,e){typeof i=="string"&&(i={path:i,caseSensitive:!1,end:!0});let[t,n]=YM(i.path,i.caseSensitive,i.end),r=e.match(t);if(!r)return null;let a=r[0],o=a.replace(/(.)\/+$/,"$1"),c=r.slice(1);return{params:n.reduce((d,{paramName:p,isOptional:y},b)=>{if(p==="*"){let w=c[b]||"";o=a.slice(0,a.length-w.length).replace(/(.)\/+$/,"$1")}const v=c[b];return y&&!v?d[p]=void 0:d[p]=(v||"").replace(/%2F/g,"/"),d},{}),pathname:a,pathnameBase:o,pattern:i}}function YM(i,e=!1,t=!0){ri(i==="*"||!i.endsWith("*")||i.endsWith("/*"),`Route path "${i}" will be treated as if it were "${i.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${i.replace(/\*$/,"/*")}".`);let n=[],r="^"+i.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,c,h)=>(n.push({paramName:c,isOptional:h!=null}),h?"/?([^\\/]+)?":"/([^\\/]+)"));return i.endsWith("*")?(n.push({paramName:"*"}),r+=i==="*"||i==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):t?r+="\\/*$":i!==""&&i!=="/"&&(r+="(?:(?=\\/|$))"),[new RegExp(r,e?void 0:"i"),n]}function KM(i){try{return i.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return ri(!1,`The URL path "${i}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${e}).`),i}}function ss(i,e){if(e==="/")return i;if(!i.toLowerCase().startsWith(e.toLowerCase()))return null;let t=e.endsWith("/")?e.length-1:e.length,n=i.charAt(t);return n&&n!=="/"?null:i.slice(t)||"/"}function XM(i,e="/"){let{pathname:t,search:n="",hash:r=""}=typeof i=="string"?Ca(i):i;return{pathname:t?t.startsWith("/")?t:WM(t,e):e,search:JM(n),hash:eE(r)}}function WM(i,e){let t=e.replace(/\/+$/,"").split("/");return i.split("/").forEach(r=>{r===".."?t.length>1&&t.pop():r!=="."&&t.push(r)}),t.length>1?t.join("/"):"/"}function Ym(i,e,t,n){return`Cannot include a '${i}' character in a manually specified \`to.${e}\` field [${JSON.stringify(n)}]. Please separate it out to the \`to.${t}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function $M(i){return i.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function Ig(i){let e=$M(i);return e.map((t,n)=>n===e.length-1?t.pathname:t.pathnameBase)}function Gg(i,e,t,n=!1){let r;typeof i=="string"?r=Ca(i):(r={...i},it(!r.pathname||!r.pathname.includes("?"),Ym("?","pathname","search",r)),it(!r.pathname||!r.pathname.includes("#"),Ym("#","pathname","hash",r)),it(!r.search||!r.search.includes("#"),Ym("#","search","hash",r)));let a=i===""||r.pathname==="",o=a?"/":r.pathname,c;if(o==null)c=t;else{let y=e.length-1;if(!n&&o.startsWith("..")){let b=o.split("/");for(;b[0]==="..";)b.shift(),y-=1;r.pathname=b.join("/")}c=y>=0?e[y]:"/"}let h=XM(r,c),d=o&&o!=="/"&&o.endsWith("/"),p=(a||o===".")&&t.endsWith("/");return!h.pathname.endsWith("/")&&(d||p)&&(h.pathname+="/"),h}var ns=i=>i.join("/").replace(/\/\/+/g,"/"),ZM=i=>i.replace(/\/+$/,"").replace(/^\/*/,"/"),JM=i=>!i||i==="?"?"":i.startsWith("?")?i:"?"+i,eE=i=>!i||i==="#"?"":i.startsWith("#")?i:"#"+i;function tE(i){return i!=null&&typeof i.status=="number"&&typeof i.statusText=="string"&&typeof i.internal=="boolean"&&"data"in i}var Ew=["POST","PUT","PATCH","DELETE"];new Set(Ew);var nE=["GET",...Ew];new Set(nE);var Aa=T.createContext(null);Aa.displayName="DataRouter";var sh=T.createContext(null);sh.displayName="DataRouterState";var Rw=T.createContext({isTransitioning:!1});Rw.displayName="ViewTransition";var iE=T.createContext(new Map);iE.displayName="Fetchers";var sE=T.createContext(null);sE.displayName="Await";var oi=T.createContext(null);oi.displayName="Navigation";var bu=T.createContext(null);bu.displayName="Location";var ui=T.createContext({outlet:null,matches:[],isDataRoute:!1});ui.displayName="Route";var Fg=T.createContext(null);Fg.displayName="RouteError";function rE(i,{relative:e}={}){it(Ta(),"useHref() may be used only in the context of a <Router> component.");let{basename:t,navigator:n}=T.useContext(oi),{hash:r,pathname:a,search:o}=vu(i,{relative:e}),c=a;return t!=="/"&&(c=a==="/"?t:ns([t,a])),n.createHref({pathname:c,search:o,hash:r})}function Ta(){return T.useContext(bu)!=null}function as(){return it(Ta(),"useLocation() may be used only in the context of a <Router> component."),T.useContext(bu).location}var Dw="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function Nw(i){T.useContext(oi).static||T.useLayoutEffect(i)}function Bw(){let{isDataRoute:i}=T.useContext(ui);return i?bE():lE()}function lE(){it(Ta(),"useNavigate() may be used only in the context of a <Router> component.");let i=T.useContext(Aa),{basename:e,navigator:t}=T.useContext(oi),{matches:n}=T.useContext(ui),{pathname:r}=as(),a=JSON.stringify(Ig(n)),o=T.useRef(!1);return Nw(()=>{o.current=!0}),T.useCallback((h,d={})=>{if(ri(o.current,Dw),!o.current)return;if(typeof h=="number"){t.go(h);return}let p=Gg(h,JSON.parse(a),r,d.relative==="path");i==null&&e!=="/"&&(p.pathname=p.pathname==="/"?e:ns([e,p.pathname])),(d.replace?t.replace:t.push)(p,d.state,d)},[e,t,a,r,i])}T.createContext(null);function rh(){let{matches:i}=T.useContext(ui),e=i[i.length-1];return e?e.params:{}}function vu(i,{relative:e}={}){let{matches:t}=T.useContext(ui),{pathname:n}=as(),r=JSON.stringify(Ig(t));return T.useMemo(()=>Gg(i,JSON.parse(r),n,e==="path"),[i,r,n,e])}function aE(i,e){return Lw(i,e)}function Lw(i,e,t,n){var O;it(Ta(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:r}=T.useContext(oi),{matches:a}=T.useContext(ui),o=a[a.length-1],c=o?o.params:{},h=o?o.pathname:"/",d=o?o.pathnameBase:"/",p=o&&o.route;{let D=p&&p.path||"";jw(h,!p||D.endsWith("*")||D.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${h}" (under <Route path="${D}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
50
-
51
- Please change the parent <Route path="${D}"> to <Route path="${D==="/"?"*":`${D}/*`}">.`)}let y=as(),b;if(e){let D=typeof e=="string"?Ca(e):e;it(d==="/"||((O=D.pathname)==null?void 0:O.startsWith(d)),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${d}" but pathname "${D.pathname}" was given in the \`location\` prop.`),b=D}else b=y;let v=b.pathname||"/",w=v;if(d!=="/"){let D=d.replace(/^\//,"").split("/");w="/"+v.replace(/^\//,"").split("/").slice(D.length).join("/")}let k=Tw(i,{pathname:w});ri(p||k!=null,`No routes matched location "${b.pathname}${b.search}${b.hash}" `),ri(k==null||k[k.length-1].route.element!==void 0||k[k.length-1].route.Component!==void 0||k[k.length-1].route.lazy!==void 0,`Matched leaf route at location "${b.pathname}${b.search}${b.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let A=hE(k&&k.map(D=>Object.assign({},D,{params:Object.assign({},c,D.params),pathname:ns([d,r.encodeLocation?r.encodeLocation(D.pathname).pathname:D.pathname]),pathnameBase:D.pathnameBase==="/"?d:ns([d,r.encodeLocation?r.encodeLocation(D.pathnameBase).pathname:D.pathnameBase])})),a,t,n);return e&&A?T.createElement(bu.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...b},navigationType:"POP"}},A):A}function oE(){let i=yE(),e=tE(i)?`${i.status} ${i.statusText}`:i instanceof Error?i.message:JSON.stringify(i),t=i instanceof Error?i.stack:null,n="rgba(200,200,200, 0.5)",r={padding:"0.5rem",backgroundColor:n},a={padding:"2px 4px",backgroundColor:n},o=null;return console.error("Error handled by React Router default ErrorBoundary:",i),o=T.createElement(T.Fragment,null,T.createElement("p",null,"💿 Hey developer 👋"),T.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",T.createElement("code",{style:a},"ErrorBoundary")," or"," ",T.createElement("code",{style:a},"errorElement")," prop on your route.")),T.createElement(T.Fragment,null,T.createElement("h2",null,"Unexpected Application Error!"),T.createElement("h3",{style:{fontStyle:"italic"}},e),t?T.createElement("pre",{style:r},t):null,o)}var uE=T.createElement(oE,null),cE=class extends T.Component{constructor(i){super(i),this.state={location:i.location,revalidation:i.revalidation,error:i.error}}static getDerivedStateFromError(i){return{error:i}}static getDerivedStateFromProps(i,e){return e.location!==i.location||e.revalidation!=="idle"&&i.revalidation==="idle"?{error:i.error,location:i.location,revalidation:i.revalidation}:{error:i.error!==void 0?i.error:e.error,location:e.location,revalidation:i.revalidation||e.revalidation}}componentDidCatch(i,e){console.error("React Router caught the following error during render",i,e)}render(){return this.state.error!==void 0?T.createElement(ui.Provider,{value:this.props.routeContext},T.createElement(Fg.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function fE({routeContext:i,match:e,children:t}){let n=T.useContext(Aa);return n&&n.static&&n.staticContext&&(e.route.errorElement||e.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=e.route.id),T.createElement(ui.Provider,{value:i},t)}function hE(i,e=[],t=null,n=null){if(i==null){if(!t)return null;if(t.errors)i=t.matches;else if(e.length===0&&!t.initialized&&t.matches.length>0)i=t.matches;else return null}let r=i,a=t==null?void 0:t.errors;if(a!=null){let h=r.findIndex(d=>d.route.id&&(a==null?void 0:a[d.route.id])!==void 0);it(h>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(",")}`),r=r.slice(0,Math.min(r.length,h+1))}let o=!1,c=-1;if(t)for(let h=0;h<r.length;h++){let d=r[h];if((d.route.HydrateFallback||d.route.hydrateFallbackElement)&&(c=h),d.route.id){let{loaderData:p,errors:y}=t,b=d.route.loader&&!p.hasOwnProperty(d.route.id)&&(!y||y[d.route.id]===void 0);if(d.route.lazy||b){o=!0,c>=0?r=r.slice(0,c+1):r=[r[0]];break}}}return r.reduceRight((h,d,p)=>{let y,b=!1,v=null,w=null;t&&(y=a&&d.route.id?a[d.route.id]:void 0,v=d.route.errorElement||uE,o&&(c<0&&p===0?(jw("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),b=!0,w=null):c===p&&(b=!0,w=d.route.hydrateFallbackElement||null)));let k=e.concat(r.slice(0,p+1)),A=()=>{let O;return y?O=v:b?O=w:d.route.Component?O=T.createElement(d.route.Component,null):d.route.element?O=d.route.element:O=h,T.createElement(fE,{match:d,routeContext:{outlet:h,matches:k,isDataRoute:t!=null},children:O})};return t&&(d.route.ErrorBoundary||d.route.errorElement||p===0)?T.createElement(cE,{location:t.location,revalidation:t.revalidation,component:v,error:y,children:A(),routeContext:{outlet:null,matches:k,isDataRoute:!0}}):A()},null)}function Yg(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function dE(i){let e=T.useContext(Aa);return it(e,Yg(i)),e}function mE(i){let e=T.useContext(sh);return it(e,Yg(i)),e}function pE(i){let e=T.useContext(ui);return it(e,Yg(i)),e}function Kg(i){let e=pE(i),t=e.matches[e.matches.length-1];return it(t.route.id,`${i} can only be used on routes that contain a unique "id"`),t.route.id}function gE(){return Kg("useRouteId")}function yE(){var n;let i=T.useContext(Fg),e=mE("useRouteError"),t=Kg("useRouteError");return i!==void 0?i:(n=e.errors)==null?void 0:n[t]}function bE(){let{router:i}=dE("useNavigate"),e=Kg("useNavigate"),t=T.useRef(!1);return Nw(()=>{t.current=!0}),T.useCallback(async(r,a={})=>{ri(t.current,Dw),t.current&&(typeof r=="number"?i.navigate(r):await i.navigate(r,{fromRouteId:e,...a}))},[i,e])}var e1={};function jw(i,e,t){!e&&!e1[i]&&(e1[i]=!0,ri(!1,t))}T.memo(vE);function vE({routes:i,future:e,state:t}){return Lw(i,void 0,t,e)}function Km({to:i,replace:e,state:t,relative:n}){it(Ta(),"<Navigate> may be used only in the context of a <Router> component.");let{static:r}=T.useContext(oi);ri(!r,"<Navigate> must not be used on the initial render in a <StaticRouter>. This is a no-op, but you should modify your code so the <Navigate> is only ever rendered in response to some user interaction or state change.");let{matches:a}=T.useContext(ui),{pathname:o}=as(),c=Bw(),h=Gg(i,Ig(a),o,n==="path"),d=JSON.stringify(h);return T.useEffect(()=>{c(JSON.parse(d),{replace:e,state:t,relative:n})},[c,d,n,e,t]),null}function Ql(i){it(!1,"A <Route> is only ever to be used as the child of <Routes> element, never rendered directly. Please wrap your <Route> in a <Routes>.")}function xE({basename:i="/",children:e=null,location:t,navigationType:n="POP",navigator:r,static:a=!1}){it(!Ta(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let o=i.replace(/^\/*/,"/"),c=T.useMemo(()=>({basename:o,navigator:r,static:a,future:{}}),[o,r,a]);typeof t=="string"&&(t=Ca(t));let{pathname:h="/",search:d="",hash:p="",state:y=null,key:b="default"}=t,v=T.useMemo(()=>{let w=ss(h,o);return w==null?null:{location:{pathname:w,search:d,hash:p,state:y,key:b},navigationType:n}},[o,h,d,p,y,b,n]);return ri(v!=null,`<Router basename="${o}"> is not able to match the URL "${h}${d}${p}" because it does not start with the basename, so the <Router> won't render anything.`),v==null?null:T.createElement(oi.Provider,{value:c},T.createElement(bu.Provider,{children:e,value:v}))}function SE({children:i,location:e}){return aE(qp(i),e)}function qp(i,e=[]){let t=[];return T.Children.forEach(i,(n,r)=>{if(!T.isValidElement(n))return;let a=[...e,r];if(n.type===T.Fragment){t.push.apply(t,qp(n.props.children,a));return}it(n.type===Ql,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),it(!n.props.index||!n.props.children,"An index route cannot have child routes.");let o={id:n.props.id||a.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(o.children=qp(n.props.children,a)),t.push(o)}),t}var yf="get",bf="application/x-www-form-urlencoded";function lh(i){return i!=null&&typeof i.tagName=="string"}function wE(i){return lh(i)&&i.tagName.toLowerCase()==="button"}function kE(i){return lh(i)&&i.tagName.toLowerCase()==="form"}function CE(i){return lh(i)&&i.tagName.toLowerCase()==="input"}function AE(i){return!!(i.metaKey||i.altKey||i.ctrlKey||i.shiftKey)}function TE(i,e){return i.button===0&&(!e||e==="_self")&&!AE(i)}var Fc=null;function OE(){if(Fc===null)try{new FormData(document.createElement("form"),0),Fc=!1}catch{Fc=!0}return Fc}var ME=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Xm(i){return i!=null&&!ME.has(i)?(ri(!1,`"${i}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${bf}"`),null):i}function EE(i,e){let t,n,r,a,o;if(kE(i)){let c=i.getAttribute("action");n=c?ss(c,e):null,t=i.getAttribute("method")||yf,r=Xm(i.getAttribute("enctype"))||bf,a=new FormData(i)}else if(wE(i)||CE(i)&&(i.type==="submit"||i.type==="image")){let c=i.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let h=i.getAttribute("formaction")||c.getAttribute("action");if(n=h?ss(h,e):null,t=i.getAttribute("formmethod")||c.getAttribute("method")||yf,r=Xm(i.getAttribute("formenctype"))||Xm(c.getAttribute("enctype"))||bf,a=new FormData(c,i),!OE()){let{name:d,type:p,value:y}=i;if(p==="image"){let b=d?`${d}.`:"";a.append(`${b}x`,"0"),a.append(`${b}y`,"0")}else d&&a.append(d,y)}}else{if(lh(i))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');t=yf,n=null,r=bf,o=i}return a&&r==="text/plain"&&(o=a,a=void 0),{action:n,method:t.toLowerCase(),encType:r,formData:a,body:o}}function Xg(i,e){if(i===!1||i===null||typeof i>"u")throw new Error(e)}async function RE(i,e){if(i.id in e)return e[i.id];try{let t=await import(i.module);return e[i.id]=t,t}catch(t){return console.error(`Error loading route module \`${i.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function DE(i){return i==null?!1:i.href==null?i.rel==="preload"&&typeof i.imageSrcSet=="string"&&typeof i.imageSizes=="string":typeof i.rel=="string"&&typeof i.href=="string"}async function NE(i,e,t){let n=await Promise.all(i.map(async r=>{let a=e.routes[r.route.id];if(a){let o=await RE(a,t);return o.links?o.links():[]}return[]}));return zE(n.flat(1).filter(DE).filter(r=>r.rel==="stylesheet"||r.rel==="preload").map(r=>r.rel==="stylesheet"?{...r,rel:"prefetch",as:"style"}:{...r,rel:"prefetch"}))}function t1(i,e,t,n,r,a){let o=(h,d)=>t[d]?h.route.id!==t[d].route.id:!0,c=(h,d)=>{var p;return t[d].pathname!==h.pathname||((p=t[d].route.path)==null?void 0:p.endsWith("*"))&&t[d].params["*"]!==h.params["*"]};return a==="assets"?e.filter((h,d)=>o(h,d)||c(h,d)):a==="data"?e.filter((h,d)=>{var y;let p=n.routes[h.route.id];if(!p||!p.hasLoader)return!1;if(o(h,d)||c(h,d))return!0;if(h.route.shouldRevalidate){let b=h.route.shouldRevalidate({currentUrl:new URL(r.pathname+r.search+r.hash,window.origin),currentParams:((y=t[0])==null?void 0:y.params)||{},nextUrl:new URL(i,window.origin),nextParams:h.params,defaultShouldRevalidate:!0});if(typeof b=="boolean")return b}return!0}):[]}function BE(i,e,{includeHydrateFallback:t}={}){return LE(i.map(n=>{let r=e.routes[n.route.id];if(!r)return[];let a=[r.module];return r.clientActionModule&&(a=a.concat(r.clientActionModule)),r.clientLoaderModule&&(a=a.concat(r.clientLoaderModule)),t&&r.hydrateFallbackModule&&(a=a.concat(r.hydrateFallbackModule)),r.imports&&(a=a.concat(r.imports)),a}).flat(1))}function LE(i){return[...new Set(i)]}function jE(i){let e={},t=Object.keys(i).sort();for(let n of t)e[n]=i[n];return e}function zE(i,e){let t=new Set;return new Set(e),i.reduce((n,r)=>{let a=JSON.stringify(jE(r));return t.has(a)||(t.add(a),n.push({key:a,link:r})),n},[])}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");var _E=new Set([100,101,204,205]);function HE(i,e){let t=typeof i=="string"?new URL(i,typeof window>"u"?"server://singlefetch/":window.location.origin):i;return t.pathname==="/"?t.pathname="_root.data":e&&ss(t.pathname,e)==="/"?t.pathname=`${e.replace(/\/$/,"")}/_root.data`:t.pathname=`${t.pathname.replace(/\/$/,"")}.data`,t}function zw(){let i=T.useContext(Aa);return Xg(i,"You must render this element inside a <DataRouterContext.Provider> element"),i}function UE(){let i=T.useContext(sh);return Xg(i,"You must render this element inside a <DataRouterStateContext.Provider> element"),i}var Wg=T.createContext(void 0);Wg.displayName="FrameworkContext";function _w(){let i=T.useContext(Wg);return Xg(i,"You must render this element inside a <HydratedRouter> element"),i}function PE(i,e){let t=T.useContext(Wg),[n,r]=T.useState(!1),[a,o]=T.useState(!1),{onFocus:c,onBlur:h,onMouseEnter:d,onMouseLeave:p,onTouchStart:y}=e,b=T.useRef(null);T.useEffect(()=>{if(i==="render"&&o(!0),i==="viewport"){let k=O=>{O.forEach(D=>{o(D.isIntersecting)})},A=new IntersectionObserver(k,{threshold:.5});return b.current&&A.observe(b.current),()=>{A.disconnect()}}},[i]),T.useEffect(()=>{if(n){let k=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(k)}}},[n]);let v=()=>{r(!0)},w=()=>{r(!1),o(!1)};return t?i!=="intent"?[a,b,{}]:[a,b,{onFocus:jo(c,v),onBlur:jo(h,w),onMouseEnter:jo(d,v),onMouseLeave:jo(p,w),onTouchStart:jo(y,v)}]:[!1,b,{}]}function jo(i,e){return t=>{i&&i(t),t.defaultPrevented||e(t)}}function qE({page:i,...e}){let{router:t}=zw(),n=T.useMemo(()=>Tw(t.routes,i,t.basename),[t.routes,i,t.basename]);return n?T.createElement(QE,{page:i,matches:n,...e}):null}function VE(i){let{manifest:e,routeModules:t}=_w(),[n,r]=T.useState([]);return T.useEffect(()=>{let a=!1;return NE(i,e,t).then(o=>{a||r(o)}),()=>{a=!0}},[i,e,t]),n}function QE({page:i,matches:e,...t}){let n=as(),{manifest:r,routeModules:a}=_w(),{basename:o}=zw(),{loaderData:c,matches:h}=UE(),d=T.useMemo(()=>t1(i,e,h,r,n,"data"),[i,e,h,r,n]),p=T.useMemo(()=>t1(i,e,h,r,n,"assets"),[i,e,h,r,n]),y=T.useMemo(()=>{if(i===n.pathname+n.search+n.hash)return[];let w=new Set,k=!1;if(e.forEach(O=>{var B;let D=r.routes[O.route.id];!D||!D.hasLoader||(!d.some(V=>V.route.id===O.route.id)&&O.route.id in c&&((B=a[O.route.id])!=null&&B.shouldRevalidate)||D.hasClientLoader?k=!0:w.add(O.route.id))}),w.size===0)return[];let A=HE(i,o);return k&&w.size>0&&A.searchParams.set("_routes",e.filter(O=>w.has(O.route.id)).map(O=>O.route.id).join(",")),[A.pathname+A.search]},[o,c,n,r,d,e,i,a]),b=T.useMemo(()=>BE(p,r),[p,r]),v=VE(p);return T.createElement(T.Fragment,null,y.map(w=>T.createElement("link",{key:w,rel:"prefetch",as:"fetch",href:w,...t})),b.map(w=>T.createElement("link",{key:w,rel:"modulepreload",href:w,...t})),v.map(({key:w,link:k})=>T.createElement("link",{key:w,...k})))}function IE(...i){return e=>{i.forEach(t=>{typeof t=="function"?t(e):t!=null&&(t.current=e)})}}var Hw=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{Hw&&(window.__reactRouterVersion="7.6.1")}catch{}function GE({basename:i,children:e,window:t}){let n=T.useRef();n.current==null&&(n.current=NM({window:t,v5Compat:!0}));let r=n.current,[a,o]=T.useState({action:r.action,location:r.location}),c=T.useCallback(h=>{T.startTransition(()=>o(h))},[o]);return T.useLayoutEffect(()=>r.listen(c),[r,c]),T.createElement(xE,{basename:i,children:e,location:a.location,navigationType:a.action,navigator:r})}var Uw=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,er=T.forwardRef(function({onClick:e,discover:t="render",prefetch:n="none",relative:r,reloadDocument:a,replace:o,state:c,target:h,to:d,preventScrollReset:p,viewTransition:y,...b},v){let{basename:w}=T.useContext(oi),k=typeof d=="string"&&Uw.test(d),A,O=!1;if(typeof d=="string"&&k&&(A=d,Hw))try{let Y=new URL(window.location.href),te=d.startsWith("//")?new URL(Y.protocol+d):new URL(d),le=ss(te.pathname,w);te.origin===Y.origin&&le!=null?d=le+te.search+te.hash:O=!0}catch{ri(!1,`<Link to="${d}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let D=rE(d,{relative:r}),[B,V,j]=PE(n,b),Q=XE(d,{replace:o,state:c,target:h,preventScrollReset:p,relative:r,viewTransition:y});function I(Y){e&&e(Y),Y.defaultPrevented||Q(Y)}let q=T.createElement("a",{...b,...j,href:A||D,onClick:O||a?e:I,ref:IE(v,V),target:h,"data-discover":!k&&t==="render"?"true":void 0});return B&&!k?T.createElement(T.Fragment,null,q,T.createElement(qE,{page:D})):q});er.displayName="Link";var FE=T.forwardRef(function({"aria-current":e="page",caseSensitive:t=!1,className:n="",end:r=!1,style:a,to:o,viewTransition:c,children:h,...d},p){let y=vu(o,{relative:d.relative}),b=as(),v=T.useContext(sh),{navigator:w,basename:k}=T.useContext(oi),A=v!=null&&eR(y)&&c===!0,O=w.encodeLocation?w.encodeLocation(y).pathname:y.pathname,D=b.pathname,B=v&&v.navigation&&v.navigation.location?v.navigation.location.pathname:null;t||(D=D.toLowerCase(),B=B?B.toLowerCase():null,O=O.toLowerCase()),B&&k&&(B=ss(B,k)||B);const V=O!=="/"&&O.endsWith("/")?O.length-1:O.length;let j=D===O||!r&&D.startsWith(O)&&D.charAt(V)==="/",Q=B!=null&&(B===O||!r&&B.startsWith(O)&&B.charAt(O.length)==="/"),I={isActive:j,isPending:Q,isTransitioning:A},q=j?e:void 0,Y;typeof n=="function"?Y=n(I):Y=[n,j?"active":null,Q?"pending":null,A?"transitioning":null].filter(Boolean).join(" ");let te=typeof a=="function"?a(I):a;return T.createElement(er,{...d,"aria-current":q,className:Y,ref:p,style:te,to:o,viewTransition:c},typeof h=="function"?h(I):h)});FE.displayName="NavLink";var YE=T.forwardRef(({discover:i="render",fetcherKey:e,navigate:t,reloadDocument:n,replace:r,state:a,method:o=yf,action:c,onSubmit:h,relative:d,preventScrollReset:p,viewTransition:y,...b},v)=>{let w=ZE(),k=JE(c,{relative:d}),A=o.toLowerCase()==="get"?"get":"post",O=typeof c=="string"&&Uw.test(c),D=B=>{if(h&&h(B),B.defaultPrevented)return;B.preventDefault();let V=B.nativeEvent.submitter,j=(V==null?void 0:V.getAttribute("formmethod"))||o;w(V||B.currentTarget,{fetcherKey:e,method:j,navigate:t,replace:r,state:a,relative:d,preventScrollReset:p,viewTransition:y})};return T.createElement("form",{ref:v,method:A,action:k,onSubmit:n?h:D,...b,"data-discover":!O&&i==="render"?"true":void 0})});YE.displayName="Form";function KE(i){return`${i} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function Pw(i){let e=T.useContext(Aa);return it(e,KE(i)),e}function XE(i,{target:e,replace:t,state:n,preventScrollReset:r,relative:a,viewTransition:o}={}){let c=Bw(),h=as(),d=vu(i,{relative:a});return T.useCallback(p=>{if(TE(p,e)){p.preventDefault();let y=t!==void 0?t:eu(h)===eu(d);c(i,{replace:y,state:n,preventScrollReset:r,relative:a,viewTransition:o})}},[h,c,d,t,n,e,i,r,a,o])}var WE=0,$E=()=>`__${String(++WE)}__`;function ZE(){let{router:i}=Pw("useSubmit"),{basename:e}=T.useContext(oi),t=gE();return T.useCallback(async(n,r={})=>{let{action:a,method:o,encType:c,formData:h,body:d}=EE(n,e);if(r.navigate===!1){let p=r.fetcherKey||$E();await i.fetch(p,t,r.action||a,{preventScrollReset:r.preventScrollReset,formData:h,body:d,formMethod:r.method||o,formEncType:r.encType||c,flushSync:r.flushSync})}else await i.navigate(r.action||a,{preventScrollReset:r.preventScrollReset,formData:h,body:d,formMethod:r.method||o,formEncType:r.encType||c,replace:r.replace,state:r.state,fromRouteId:t,flushSync:r.flushSync,viewTransition:r.viewTransition})},[i,e,t])}function JE(i,{relative:e}={}){let{basename:t}=T.useContext(oi),n=T.useContext(ui);it(n,"useFormAction must be used inside a RouteContext");let[r]=n.matches.slice(-1),a={...vu(i||".",{relative:e})},o=as();if(i==null){a.search=o.search;let c=new URLSearchParams(a.search),h=c.getAll("index");if(h.some(p=>p==="")){c.delete("index"),h.filter(y=>y).forEach(y=>c.append("index",y));let p=c.toString();a.search=p?`?${p}`:""}}return(!i||i===".")&&r.route.index&&(a.search=a.search?a.search.replace(/^\?/,"?index&"):"?index"),t!=="/"&&(a.pathname=a.pathname==="/"?t:ns([t,a.pathname])),eu(a)}function eR(i,e={}){let t=T.useContext(Rw);it(t!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=Pw("useViewTransitionState"),r=vu(i,{relative:e.relative});if(!t.isTransitioning)return!1;let a=ss(t.currentLocation.pathname,n)||t.currentLocation.pathname,o=ss(t.nextLocation.pathname,n)||t.nextLocation.pathname;return Df(r.pathname,o)!=null||Df(r.pathname,a)!=null}[..._E];Aw();/**
52
- * @license lucide-react v0.488.0 - ISC
53
- *
54
- * This source code is licensed under the ISC license.
55
- * See the LICENSE file in the root directory of this source tree.
56
- */const tR=i=>i.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),nR=i=>i.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),n1=i=>{const e=nR(i);return e.charAt(0).toUpperCase()+e.slice(1)},qw=(...i)=>i.filter((e,t,n)=>!!e&&e.trim()!==""&&n.indexOf(e)===t).join(" ").trim();/**
57
- * @license lucide-react v0.488.0 - ISC
58
- *
59
- * This source code is licensed under the ISC license.
60
- * See the LICENSE file in the root directory of this source tree.
61
- */var iR={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
62
- * @license lucide-react v0.488.0 - ISC
63
- *
64
- * This source code is licensed under the ISC license.
65
- * See the LICENSE file in the root directory of this source tree.
66
- */const sR=T.forwardRef(({color:i="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:n,className:r="",children:a,iconNode:o,...c},h)=>T.createElement("svg",{ref:h,...iR,width:e,height:e,stroke:i,strokeWidth:n?Number(t)*24/Number(e):t,className:qw("lucide",r),...c},[...o.map(([d,p])=>T.createElement(d,p)),...Array.isArray(a)?a:[a]]));/**
67
- * @license lucide-react v0.488.0 - ISC
68
- *
69
- * This source code is licensed under the ISC license.
70
- * See the LICENSE file in the root directory of this source tree.
71
- */const wt=(i,e)=>{const t=T.forwardRef(({className:n,...r},a)=>T.createElement(sR,{ref:a,iconNode:e,className:qw(`lucide-${tR(n1(i))}`,`lucide-${i}`,n),...r}));return t.displayName=n1(i),t};/**
72
- * @license lucide-react v0.488.0 - ISC
73
- *
74
- * This source code is licensed under the ISC license.
75
- * See the LICENSE file in the root directory of this source tree.
76
- */const rR=[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]],lR=wt("arrow-left",rR);/**
77
- * @license lucide-react v0.488.0 - ISC
78
- *
79
- * This source code is licensed under the ISC license.
80
- * See the LICENSE file in the root directory of this source tree.
81
- */const aR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]],Vw=wt("ban",aR);/**
82
- * @license lucide-react v0.488.0 - ISC
83
- *
84
- * This source code is licensed under the ISC license.
85
- * See the LICENSE file in the root directory of this source tree.
86
- */const oR=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],uR=wt("chevron-down",oR);/**
87
- * @license lucide-react v0.488.0 - ISC
88
- *
89
- * This source code is licensed under the ISC license.
90
- * See the LICENSE file in the root directory of this source tree.
91
- */const cR=[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]],fR=wt("chevron-left",cR);/**
92
- * @license lucide-react v0.488.0 - ISC
93
- *
94
- * This source code is licensed under the ISC license.
95
- * See the LICENSE file in the root directory of this source tree.
96
- */const hR=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Qw=wt("chevron-right",hR);/**
97
- * @license lucide-react v0.488.0 - ISC
98
- *
99
- * This source code is licensed under the ISC license.
100
- * See the LICENSE file in the root directory of this source tree.
101
- */const dR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],mR=wt("circle-alert",dR);/**
102
- * @license lucide-react v0.488.0 - ISC
103
- *
104
- * This source code is licensed under the ISC license.
105
- * See the LICENSE file in the root directory of this source tree.
106
- */const pR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],xu=wt("circle-check",pR);/**
107
- * @license lucide-react v0.488.0 - ISC
108
- *
109
- * This source code is licensed under the ISC license.
110
- * See the LICENSE file in the root directory of this source tree.
111
- */const gR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],Su=wt("circle-x",gR);/**
112
- * @license lucide-react v0.488.0 - ISC
113
- *
114
- * This source code is licensed under the ISC license.
115
- * See the LICENSE file in the root directory of this source tree.
116
- */const yR=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],wu=wt("clock",yR);/**
117
- * @license lucide-react v0.488.0 - ISC
118
- *
119
- * This source code is licensed under the ISC license.
120
- * See the LICENSE file in the root directory of this source tree.
121
- */const bR=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]],vR=wt("columns-3",bR);/**
122
- * @license lucide-react v0.488.0 - ISC
123
- *
124
- * This source code is licensed under the ISC license.
125
- * See the LICENSE file in the root directory of this source tree.
126
- */const xR=[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]],SR=wt("database",xR);/**
127
- * @license lucide-react v0.488.0 - ISC
128
- *
129
- * This source code is licensed under the ISC license.
130
- * See the LICENSE file in the root directory of this source tree.
131
- */const wR=[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]],kR=wt("git-branch",wR);/**
132
- * @license lucide-react v0.488.0 - ISC
133
- *
134
- * This source code is licensed under the ISC license.
135
- * See the LICENSE file in the root directory of this source tree.
136
- */const CR=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],AR=wt("inbox",CR);/**
137
- * @license lucide-react v0.488.0 - ISC
138
- *
139
- * This source code is licensed under the ISC license.
140
- * See the LICENSE file in the root directory of this source tree.
141
- */const TR=[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]],OR=wt("key",TR);/**
142
- * @license lucide-react v0.488.0 - ISC
143
- *
144
- * This source code is licensed under the ISC license.
145
- * See the LICENSE file in the root directory of this source tree.
146
- */const MR=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Vt=wt("loader-circle",MR);/**
147
- * @license lucide-react v0.488.0 - ISC
148
- *
149
- * This source code is licensed under the ISC license.
150
- * See the LICENSE file in the root directory of this source tree.
151
- */const ER=[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M20 14v4",key:"1hm744"}],["path",{d:"M20 22v.01",key:"12bgn6"}]],RR=wt("mail-warning",ER);/**
152
- * @license lucide-react v0.488.0 - ISC
153
- *
154
- * This source code is licensed under the ISC license.
155
- * See the LICENSE file in the root directory of this source tree.
156
- */const DR=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],NR=wt("play",DR);/**
157
- * @license lucide-react v0.488.0 - ISC
158
- *
159
- * This source code is licensed under the ISC license.
160
- * See the LICENSE file in the root directory of this source tree.
161
- */const BR=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Iw=wt("refresh-cw",BR);/**
162
- * @license lucide-react v0.488.0 - ISC
163
- *
164
- * This source code is licensed under the ISC license.
165
- * See the LICENSE file in the root directory of this source tree.
166
- */const LR=[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]],Gw=wt("table",LR);function i1(i,e){if(typeof i=="function")return i(e);i!=null&&(i.current=e)}function Fw(...i){return e=>{let t=!1;const n=i.map(r=>{const a=i1(r,e);return!t&&typeof a=="function"&&(t=!0),a});if(t)return()=>{for(let r=0;r<n.length;r++){const a=n[r];typeof a=="function"?a():i1(i[r],null)}}}}function li(...i){return T.useCallback(Fw(...i),i)}function Nf(i){const e=jR(i),t=T.forwardRef((n,r)=>{const{children:a,...o}=n,c=T.Children.toArray(a),h=c.find(_R);if(h){const d=h.props.children,p=c.map(y=>y===h?T.Children.count(d)>1?T.Children.only(null):T.isValidElement(d)?d.props.children:null:y);return S.jsx(e,{...o,ref:r,children:T.isValidElement(d)?T.cloneElement(d,void 0,p):null})}return S.jsx(e,{...o,ref:r,children:a})});return t.displayName=`${i}.Slot`,t}var Yw=Nf("Slot");function jR(i){const e=T.forwardRef((t,n)=>{const{children:r,...a}=t;if(T.isValidElement(r)){const o=UR(r),c=HR(a,r.props);return r.type!==T.Fragment&&(c.ref=n?Fw(n,o):o),T.cloneElement(r,c)}return T.Children.count(r)>1?T.Children.only(null):null});return e.displayName=`${i}.SlotClone`,e}var zR=Symbol("radix.slottable");function _R(i){return T.isValidElement(i)&&typeof i.type=="function"&&"__radixId"in i.type&&i.type.__radixId===zR}function HR(i,e){const t={...e};for(const n in e){const r=i[n],a=e[n];/^on[A-Z]/.test(n)?r&&a?t[n]=(...c)=>{const h=a(...c);return r(...c),h}:r&&(t[n]=r):n==="style"?t[n]={...r,...a}:n==="className"&&(t[n]=[r,a].filter(Boolean).join(" "))}return{...i,...t}}function UR(i){var n,r;let e=(n=Object.getOwnPropertyDescriptor(i.props,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?i.ref:(e=(r=Object.getOwnPropertyDescriptor(i,"ref"))==null?void 0:r.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?i.props.ref:i.props.ref||i.ref)}function Kw(i){var e,t,n="";if(typeof i=="string"||typeof i=="number")n+=i;else if(typeof i=="object")if(Array.isArray(i)){var r=i.length;for(e=0;e<r;e++)i[e]&&(t=Kw(i[e]))&&(n&&(n+=" "),n+=t)}else for(t in i)i[t]&&(n&&(n+=" "),n+=t);return n}function PR(){for(var i,e,t=0,n="",r=arguments.length;t<r;t++)(i=arguments[t])&&(e=Kw(i))&&(n&&(n+=" "),n+=e);return n}const s1=i=>typeof i=="boolean"?`${i}`:i===0?"0":i,r1=PR,Xw=(i,e)=>t=>{var n;if((e==null?void 0:e.variants)==null)return r1(i,t==null?void 0:t.class,t==null?void 0:t.className);const{variants:r,defaultVariants:a}=e,o=Object.keys(r).map(d=>{const p=t==null?void 0:t[d],y=a==null?void 0:a[d];if(p===null)return null;const b=s1(p)||s1(y);return r[d][b]}),c=t&&Object.entries(t).reduce((d,p)=>{let[y,b]=p;return b===void 0||(d[y]=b),d},{}),h=e==null||(n=e.compoundVariants)===null||n===void 0?void 0:n.reduce((d,p)=>{let{class:y,className:b,...v}=p;return Object.entries(v).every(w=>{let[k,A]=w;return Array.isArray(A)?A.includes({...a,...c}[k]):{...a,...c}[k]===A})?[...d,y,b]:d},[]);return r1(i,o,h,t==null?void 0:t.class,t==null?void 0:t.className)};function Ww(i){var e,t,n="";if(typeof i=="string"||typeof i=="number")n+=i;else if(typeof i=="object")if(Array.isArray(i))for(e=0;e<i.length;e++)i[e]&&(t=Ww(i[e]))&&(n&&(n+=" "),n+=t);else for(e in i)i[e]&&(n&&(n+=" "),n+=e);return n}function qR(){for(var i,e,t=0,n="";t<arguments.length;)(i=arguments[t++])&&(e=Ww(i))&&(n&&(n+=" "),n+=e);return n}const $g="-",VR=i=>{const e=IR(i),{conflictingClassGroups:t,conflictingClassGroupModifiers:n}=i;return{getClassGroupId:o=>{const c=o.split($g);return c[0]===""&&c.length!==1&&c.shift(),$w(c,e)||QR(o)},getConflictingClassGroupIds:(o,c)=>{const h=t[o]||[];return c&&n[o]?[...h,...n[o]]:h}}},$w=(i,e)=>{var o;if(i.length===0)return e.classGroupId;const t=i[0],n=e.nextPart.get(t),r=n?$w(i.slice(1),n):void 0;if(r)return r;if(e.validators.length===0)return;const a=i.join($g);return(o=e.validators.find(({validator:c})=>c(a)))==null?void 0:o.classGroupId},l1=/^\[(.+)\]$/,QR=i=>{if(l1.test(i)){const e=l1.exec(i)[1],t=e==null?void 0:e.substring(0,e.indexOf(":"));if(t)return"arbitrary.."+t}},IR=i=>{const{theme:e,classGroups:t}=i,n={nextPart:new Map,validators:[]};for(const r in t)Vp(t[r],n,r,e);return n},Vp=(i,e,t,n)=>{i.forEach(r=>{if(typeof r=="string"){const a=r===""?e:a1(e,r);a.classGroupId=t;return}if(typeof r=="function"){if(GR(r)){Vp(r(n),e,t,n);return}e.validators.push({validator:r,classGroupId:t});return}Object.entries(r).forEach(([a,o])=>{Vp(o,a1(e,a),t,n)})})},a1=(i,e)=>{let t=i;return e.split($g).forEach(n=>{t.nextPart.has(n)||t.nextPart.set(n,{nextPart:new Map,validators:[]}),t=t.nextPart.get(n)}),t},GR=i=>i.isThemeGetter,FR=i=>{if(i<1)return{get:()=>{},set:()=>{}};let e=0,t=new Map,n=new Map;const r=(a,o)=>{t.set(a,o),e++,e>i&&(e=0,n=t,t=new Map)};return{get(a){let o=t.get(a);if(o!==void 0)return o;if((o=n.get(a))!==void 0)return r(a,o),o},set(a,o){t.has(a)?t.set(a,o):r(a,o)}}},Qp="!",Ip=":",YR=Ip.length,KR=i=>{const{prefix:e,experimentalParseClassName:t}=i;let n=r=>{const a=[];let o=0,c=0,h=0,d;for(let w=0;w<r.length;w++){let k=r[w];if(o===0&&c===0){if(k===Ip){a.push(r.slice(h,w)),h=w+YR;continue}if(k==="/"){d=w;continue}}k==="["?o++:k==="]"?o--:k==="("?c++:k===")"&&c--}const p=a.length===0?r:r.substring(h),y=XR(p),b=y!==p,v=d&&d>h?d-h:void 0;return{modifiers:a,hasImportantModifier:b,baseClassName:y,maybePostfixModifierPosition:v}};if(e){const r=e+Ip,a=n;n=o=>o.startsWith(r)?a(o.substring(r.length)):{isExternal:!0,modifiers:[],hasImportantModifier:!1,baseClassName:o,maybePostfixModifierPosition:void 0}}if(t){const r=n;n=a=>t({className:a,parseClassName:r})}return n},XR=i=>i.endsWith(Qp)?i.substring(0,i.length-1):i.startsWith(Qp)?i.substring(1):i,WR=i=>{const e=Object.fromEntries(i.orderSensitiveModifiers.map(n=>[n,!0]));return n=>{if(n.length<=1)return n;const r=[];let a=[];return n.forEach(o=>{o[0]==="["||e[o]?(r.push(...a.sort(),o),a=[]):a.push(o)}),r.push(...a.sort()),r}},$R=i=>({cache:FR(i.cacheSize),parseClassName:KR(i),sortModifiers:WR(i),...VR(i)}),ZR=/\s+/,JR=(i,e)=>{const{parseClassName:t,getClassGroupId:n,getConflictingClassGroupIds:r,sortModifiers:a}=e,o=[],c=i.trim().split(ZR);let h="";for(let d=c.length-1;d>=0;d-=1){const p=c[d],{isExternal:y,modifiers:b,hasImportantModifier:v,baseClassName:w,maybePostfixModifierPosition:k}=t(p);if(y){h=p+(h.length>0?" "+h:h);continue}let A=!!k,O=n(A?w.substring(0,k):w);if(!O){if(!A){h=p+(h.length>0?" "+h:h);continue}if(O=n(w),!O){h=p+(h.length>0?" "+h:h);continue}A=!1}const D=a(b).join(":"),B=v?D+Qp:D,V=B+O;if(o.includes(V))continue;o.push(V);const j=r(O,A);for(let Q=0;Q<j.length;++Q){const I=j[Q];o.push(B+I)}h=p+(h.length>0?" "+h:h)}return h};function eD(){let i=0,e,t,n="";for(;i<arguments.length;)(e=arguments[i++])&&(t=Zw(e))&&(n&&(n+=" "),n+=t);return n}const Zw=i=>{if(typeof i=="string")return i;let e,t="";for(let n=0;n<i.length;n++)i[n]&&(e=Zw(i[n]))&&(t&&(t+=" "),t+=e);return t};function tD(i,...e){let t,n,r,a=o;function o(h){const d=e.reduce((p,y)=>y(p),i());return t=$R(d),n=t.cache.get,r=t.cache.set,a=c,c(h)}function c(h){const d=n(h);if(d)return d;const p=JR(h,t);return r(h,p),p}return function(){return a(eD.apply(null,arguments))}}const bt=i=>{const e=t=>t[i]||[];return e.isThemeGetter=!0,e},Jw=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ek=/^\((?:(\w[\w-]*):)?(.+)\)$/i,nD=/^\d+\/\d+$/,iD=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sD=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,rD=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,lD=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,aD=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ql=i=>nD.test(i),Me=i=>!!i&&!Number.isNaN(Number(i)),_s=i=>!!i&&Number.isInteger(Number(i)),Wm=i=>i.endsWith("%")&&Me(i.slice(0,-1)),Yi=i=>iD.test(i),oD=()=>!0,uD=i=>sD.test(i)&&!rD.test(i),tk=()=>!1,cD=i=>lD.test(i),fD=i=>aD.test(i),hD=i=>!ce(i)&&!fe(i),dD=i=>Oa(i,sk,tk),ce=i=>Jw.test(i),Rr=i=>Oa(i,rk,uD),$m=i=>Oa(i,bD,Me),o1=i=>Oa(i,nk,tk),mD=i=>Oa(i,ik,fD),Yc=i=>Oa(i,lk,cD),fe=i=>ek.test(i),zo=i=>Ma(i,rk),pD=i=>Ma(i,vD),u1=i=>Ma(i,nk),gD=i=>Ma(i,sk),yD=i=>Ma(i,ik),Kc=i=>Ma(i,lk,!0),Oa=(i,e,t)=>{const n=Jw.exec(i);return n?n[1]?e(n[1]):t(n[2]):!1},Ma=(i,e,t=!1)=>{const n=ek.exec(i);return n?n[1]?e(n[1]):t:!1},nk=i=>i==="position"||i==="percentage",ik=i=>i==="image"||i==="url",sk=i=>i==="length"||i==="size"||i==="bg-size",rk=i=>i==="length",bD=i=>i==="number",vD=i=>i==="family-name",lk=i=>i==="shadow",xD=()=>{const i=bt("color"),e=bt("font"),t=bt("text"),n=bt("font-weight"),r=bt("tracking"),a=bt("leading"),o=bt("breakpoint"),c=bt("container"),h=bt("spacing"),d=bt("radius"),p=bt("shadow"),y=bt("inset-shadow"),b=bt("text-shadow"),v=bt("drop-shadow"),w=bt("blur"),k=bt("perspective"),A=bt("aspect"),O=bt("ease"),D=bt("animate"),B=()=>["auto","avoid","all","avoid-page","page","left","right","column"],V=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],j=()=>[...V(),fe,ce],Q=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto","contain","none"],q=()=>[fe,ce,h],Y=()=>[ql,"full","auto",...q()],te=()=>[_s,"none","subgrid",fe,ce],le=()=>["auto",{span:["full",_s,fe,ce]},_s,fe,ce],ne=()=>[_s,"auto",fe,ce],xe=()=>["auto","min","max","fr",fe,ce],ke=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],me=()=>["start","end","center","stretch","center-safe","end-safe"],H=()=>["auto",...q()],K=()=>[ql,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...q()],W=()=>[i,fe,ce],ge=()=>[...V(),u1,o1,{position:[fe,ce]}],E=()=>["no-repeat",{repeat:["","x","y","space","round"]}],X=()=>["auto","cover","contain",gD,dD,{size:[fe,ce]}],ie=()=>[Wm,zo,Rr],Z=()=>["","none","full",d,fe,ce],re=()=>["",Me,zo,Rr],Ce=()=>["solid","dashed","dotted","double"],be=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Le=()=>[Me,Wm,u1,o1],Xe=()=>["","none",w,fe,ce],mn=()=>["none",Me,fe,ce],cs=()=>["none",Me,fe,ce],fs=()=>[Me,fe,ce],hs=()=>[ql,"full",...q()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Yi],breakpoint:[Yi],color:[oD],container:[Yi],"drop-shadow":[Yi],ease:["in","out","in-out"],font:[hD],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Yi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Yi],shadow:[Yi],spacing:["px",Me],text:[Yi],"text-shadow":[Yi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",ql,ce,fe,A]}],container:["container"],columns:[{columns:[Me,ce,fe,c]}],"break-after":[{"break-after":B()}],"break-before":[{"break-before":B()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:j()}],overflow:[{overflow:Q()}],"overflow-x":[{"overflow-x":Q()}],"overflow-y":[{"overflow-y":Q()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:Y()}],"inset-x":[{"inset-x":Y()}],"inset-y":[{"inset-y":Y()}],start:[{start:Y()}],end:[{end:Y()}],top:[{top:Y()}],right:[{right:Y()}],bottom:[{bottom:Y()}],left:[{left:Y()}],visibility:["visible","invisible","collapse"],z:[{z:[_s,"auto",fe,ce]}],basis:[{basis:[ql,"full","auto",c,...q()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Me,ql,"auto","initial","none",ce]}],grow:[{grow:["",Me,fe,ce]}],shrink:[{shrink:["",Me,fe,ce]}],order:[{order:[_s,"first","last","none",fe,ce]}],"grid-cols":[{"grid-cols":te()}],"col-start-end":[{col:le()}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":te()}],"row-start-end":[{row:le()}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":xe()}],"auto-rows":[{"auto-rows":xe()}],gap:[{gap:q()}],"gap-x":[{"gap-x":q()}],"gap-y":[{"gap-y":q()}],"justify-content":[{justify:[...ke(),"normal"]}],"justify-items":[{"justify-items":[...me(),"normal"]}],"justify-self":[{"justify-self":["auto",...me()]}],"align-content":[{content:["normal",...ke()]}],"align-items":[{items:[...me(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...me(),{baseline:["","last"]}]}],"place-content":[{"place-content":ke()}],"place-items":[{"place-items":[...me(),"baseline"]}],"place-self":[{"place-self":["auto",...me()]}],p:[{p:q()}],px:[{px:q()}],py:[{py:q()}],ps:[{ps:q()}],pe:[{pe:q()}],pt:[{pt:q()}],pr:[{pr:q()}],pb:[{pb:q()}],pl:[{pl:q()}],m:[{m:H()}],mx:[{mx:H()}],my:[{my:H()}],ms:[{ms:H()}],me:[{me:H()}],mt:[{mt:H()}],mr:[{mr:H()}],mb:[{mb:H()}],ml:[{ml:H()}],"space-x":[{"space-x":q()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":q()}],"space-y-reverse":["space-y-reverse"],size:[{size:K()}],w:[{w:[c,"screen",...K()]}],"min-w":[{"min-w":[c,"screen","none",...K()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[o]},...K()]}],h:[{h:["screen",...K()]}],"min-h":[{"min-h":["screen","none",...K()]}],"max-h":[{"max-h":["screen",...K()]}],"font-size":[{text:["base",t,zo,Rr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[n,fe,$m]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Wm,ce]}],"font-family":[{font:[pD,ce,e]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[r,fe,ce]}],"line-clamp":[{"line-clamp":[Me,"none",fe,$m]}],leading:[{leading:[a,...q()]}],"list-image":[{"list-image":["none",fe,ce]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",fe,ce]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Ce(),"wavy"]}],"text-decoration-thickness":[{decoration:[Me,"from-font","auto",fe,Rr]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[Me,"auto",fe,ce]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:q()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",fe,ce]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",fe,ce]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ge()}],"bg-repeat":[{bg:E()}],"bg-size":[{bg:X()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},_s,fe,ce],radial:["",fe,ce],conic:[_s,fe,ce]},yD,mD]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:Z()}],"rounded-s":[{"rounded-s":Z()}],"rounded-e":[{"rounded-e":Z()}],"rounded-t":[{"rounded-t":Z()}],"rounded-r":[{"rounded-r":Z()}],"rounded-b":[{"rounded-b":Z()}],"rounded-l":[{"rounded-l":Z()}],"rounded-ss":[{"rounded-ss":Z()}],"rounded-se":[{"rounded-se":Z()}],"rounded-ee":[{"rounded-ee":Z()}],"rounded-es":[{"rounded-es":Z()}],"rounded-tl":[{"rounded-tl":Z()}],"rounded-tr":[{"rounded-tr":Z()}],"rounded-br":[{"rounded-br":Z()}],"rounded-bl":[{"rounded-bl":Z()}],"border-w":[{border:re()}],"border-w-x":[{"border-x":re()}],"border-w-y":[{"border-y":re()}],"border-w-s":[{"border-s":re()}],"border-w-e":[{"border-e":re()}],"border-w-t":[{"border-t":re()}],"border-w-r":[{"border-r":re()}],"border-w-b":[{"border-b":re()}],"border-w-l":[{"border-l":re()}],"divide-x":[{"divide-x":re()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":re()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...Ce(),"hidden","none"]}],"divide-style":[{divide:[...Ce(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...Ce(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Me,fe,ce]}],"outline-w":[{outline:["",Me,zo,Rr]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",p,Kc,Yc]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",y,Kc,Yc]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:re()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[Me,Rr]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":re()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",b,Kc,Yc]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[Me,fe,ce]}],"mix-blend":[{"mix-blend":[...be(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":be()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Me]}],"mask-image-linear-from-pos":[{"mask-linear-from":Le()}],"mask-image-linear-to-pos":[{"mask-linear-to":Le()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":Le()}],"mask-image-t-to-pos":[{"mask-t-to":Le()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":Le()}],"mask-image-r-to-pos":[{"mask-r-to":Le()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":Le()}],"mask-image-b-to-pos":[{"mask-b-to":Le()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":Le()}],"mask-image-l-to-pos":[{"mask-l-to":Le()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":Le()}],"mask-image-x-to-pos":[{"mask-x-to":Le()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":Le()}],"mask-image-y-to-pos":[{"mask-y-to":Le()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[fe,ce]}],"mask-image-radial-from-pos":[{"mask-radial-from":Le()}],"mask-image-radial-to-pos":[{"mask-radial-to":Le()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":V()}],"mask-image-conic-pos":[{"mask-conic":[Me]}],"mask-image-conic-from-pos":[{"mask-conic-from":Le()}],"mask-image-conic-to-pos":[{"mask-conic-to":Le()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ge()}],"mask-repeat":[{mask:E()}],"mask-size":[{mask:X()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",fe,ce]}],filter:[{filter:["","none",fe,ce]}],blur:[{blur:Xe()}],brightness:[{brightness:[Me,fe,ce]}],contrast:[{contrast:[Me,fe,ce]}],"drop-shadow":[{"drop-shadow":["","none",v,Kc,Yc]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",Me,fe,ce]}],"hue-rotate":[{"hue-rotate":[Me,fe,ce]}],invert:[{invert:["",Me,fe,ce]}],saturate:[{saturate:[Me,fe,ce]}],sepia:[{sepia:["",Me,fe,ce]}],"backdrop-filter":[{"backdrop-filter":["","none",fe,ce]}],"backdrop-blur":[{"backdrop-blur":Xe()}],"backdrop-brightness":[{"backdrop-brightness":[Me,fe,ce]}],"backdrop-contrast":[{"backdrop-contrast":[Me,fe,ce]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Me,fe,ce]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Me,fe,ce]}],"backdrop-invert":[{"backdrop-invert":["",Me,fe,ce]}],"backdrop-opacity":[{"backdrop-opacity":[Me,fe,ce]}],"backdrop-saturate":[{"backdrop-saturate":[Me,fe,ce]}],"backdrop-sepia":[{"backdrop-sepia":["",Me,fe,ce]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":q()}],"border-spacing-x":[{"border-spacing-x":q()}],"border-spacing-y":[{"border-spacing-y":q()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",fe,ce]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Me,"initial",fe,ce]}],ease:[{ease:["linear","initial",O,fe,ce]}],delay:[{delay:[Me,fe,ce]}],animate:[{animate:["none",D,fe,ce]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[k,fe,ce]}],"perspective-origin":[{"perspective-origin":j()}],rotate:[{rotate:mn()}],"rotate-x":[{"rotate-x":mn()}],"rotate-y":[{"rotate-y":mn()}],"rotate-z":[{"rotate-z":mn()}],scale:[{scale:cs()}],"scale-x":[{"scale-x":cs()}],"scale-y":[{"scale-y":cs()}],"scale-z":[{"scale-z":cs()}],"scale-3d":["scale-3d"],skew:[{skew:fs()}],"skew-x":[{"skew-x":fs()}],"skew-y":[{"skew-y":fs()}],transform:[{transform:[fe,ce,"","none","gpu","cpu"]}],"transform-origin":[{origin:j()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:hs()}],"translate-x":[{"translate-x":hs()}],"translate-y":[{"translate-y":hs()}],"translate-z":[{"translate-z":hs()}],"translate-none":["translate-none"],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",fe,ce]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":q()}],"scroll-mx":[{"scroll-mx":q()}],"scroll-my":[{"scroll-my":q()}],"scroll-ms":[{"scroll-ms":q()}],"scroll-me":[{"scroll-me":q()}],"scroll-mt":[{"scroll-mt":q()}],"scroll-mr":[{"scroll-mr":q()}],"scroll-mb":[{"scroll-mb":q()}],"scroll-ml":[{"scroll-ml":q()}],"scroll-p":[{"scroll-p":q()}],"scroll-px":[{"scroll-px":q()}],"scroll-py":[{"scroll-py":q()}],"scroll-ps":[{"scroll-ps":q()}],"scroll-pe":[{"scroll-pe":q()}],"scroll-pt":[{"scroll-pt":q()}],"scroll-pr":[{"scroll-pr":q()}],"scroll-pb":[{"scroll-pb":q()}],"scroll-pl":[{"scroll-pl":q()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",fe,ce]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[Me,zo,Rr,$m]}],stroke:[{stroke:["none",...W()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},SD=tD(xD);function tt(...i){return SD(qR(i))}const wD=Xw("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] cursor-pointer",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function Ji({className:i,variant:e,size:t,asChild:n=!1,...r}){const a=n?Yw:"button";return S.jsx(a,{"data-slot":"button",className:tt(wD({variant:e,size:t,className:i})),...r})}const kD="";async function os(i,e){const t=await fetch(`${kD}${i}`,{...e,headers:{"Content-Type":"application/json",...e==null?void 0:e.headers}});if(!t.ok){const n=await t.text();throw new Error(n||`Request failed: ${t.status}`)}return t.json()}async function ak(){return os("/api/config")}async function CD(i,e){return os(`/api/db/${i}/query`,{method:"POST",body:JSON.stringify({query:e})})}async function AD(i){return os(`/api/db/${i}/tables`)}async function TD(i,e,t,n){return os(`/api/db/${i}/tables/${e}?limit=${t}&offset=${n}`)}async function ok(i){return os(`/api/db/${i}/schema`)}async function OD(i){return os(`/api/queue/${i}/metrics`)}async function MD(i,e=10){return os(`/api/queue/${i}/messages?limit=${e}`)}async function ED(i,e=20){return os(`/api/workflow/${i}/executions?limit=${e}`)}async function RD(i,e){return os(`/api/workflow/${i}/executions/${e}`)}let Gp=[],uk=[];(()=>{let i="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<i.length;e++)(e%2?uk:Gp).push(t=t+i[e])})();function DD(i){if(i<768)return!1;for(let e=0,t=Gp.length;;){let n=e+t>>1;if(i<Gp[n])t=n;else if(i>=uk[n])e=n+1;else return!0;if(e==t)return!1}}function c1(i){return i>=127462&&i<=127487}const f1=8205;function ND(i,e,t=!0,n=!0){return(t?ck:BD)(i,e,n)}function ck(i,e,t){if(e==i.length)return e;e&&fk(i.charCodeAt(e))&&hk(i.charCodeAt(e-1))&&e--;let n=Zm(i,e);for(e+=h1(n);e<i.length;){let r=Zm(i,e);if(n==f1||r==f1||t&&DD(r))e+=h1(r),n=r;else if(c1(r)){let a=0,o=e-2;for(;o>=0&&c1(Zm(i,o));)a++,o-=2;if(a%2==0)break;e+=2}else break}return e}function BD(i,e,t){for(;e>0;){let n=ck(i,e-2,t);if(n<e)return n;e--}return 0}function Zm(i,e){let t=i.charCodeAt(e);if(!hk(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return fk(n)?(t-55296<<10)+(n-56320)+65536:t}function fk(i){return i>=56320&&i<57344}function hk(i){return i>=55296&&i<56320}function h1(i){return i<65536?1:2}class He{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=pa(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),Ai.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=pa(this,e,t);let n=[];return this.decompose(e,t,n,0),Ai.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new Yo(this),a=new Yo(e);for(let o=t,c=t;;){if(r.next(o),a.next(o),o=0,r.lineBreak!=a.lineBreak||r.done!=a.done||r.value!=a.value)return!1;if(c+=r.value.length,r.done||c>=n)return!0}}iter(e=1){return new Yo(this,e)}iterRange(e,t=this.length){return new dk(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new mk(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?He.empty:e.length<=32?new ft(e):Ai.from(ft.split(e,[]))}}class ft extends He{constructor(e,t=LD(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let a=0;;a++){let o=this.text[a],c=r+o.length;if((t?n:c)>=e)return new jD(r,c,n,o);r=c+1,n++}}decompose(e,t,n,r){let a=e<=0&&t>=this.length?this:new ft(d1(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=n.pop(),c=vf(a.text,o.text.slice(),0,a.length);if(c.length<=32)n.push(new ft(c,o.length+a.length));else{let h=c.length>>1;n.push(new ft(c.slice(0,h)),new ft(c.slice(h)))}}else n.push(a)}replace(e,t,n){if(!(n instanceof ft))return super.replace(e,t,n);[e,t]=pa(this,e,t);let r=vf(this.text,vf(n.text,d1(this.text,0,e)),t),a=this.length+n.length-(t-e);return r.length<=32?new ft(r,a):Ai.from(ft.split(r,[]),a)}sliceString(e,t=this.length,n=`
167
- `){[e,t]=pa(this,e,t);let r="";for(let a=0,o=0;a<=t&&o<this.text.length;o++){let c=this.text[o],h=a+c.length;a>e&&o&&(r+=n),e<h&&t>a&&(r+=c.slice(Math.max(0,e-a),t-a)),a=h+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],r=-1;for(let a of e)n.push(a),r+=a.length+1,n.length==32&&(t.push(new ft(n,r)),n=[],r=-1);return r>-1&&t.push(new ft(n,r)),t}}class Ai extends He{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let n of e)this.lines+=n.lines}lineInner(e,t,n,r){for(let a=0;;a++){let o=this.children[a],c=r+o.length,h=n+o.lines-1;if((t?h:c)>=e)return o.lineInner(e,t,n,r);r=c+1,n=h+1}}decompose(e,t,n,r){for(let a=0,o=0;o<=t&&a<this.children.length;a++){let c=this.children[a],h=o+c.length;if(e<=h&&t>=o){let d=r&((o<=e?1:0)|(h>=t?2:0));o>=e&&h<=t&&!d?n.push(c):c.decompose(e-o,t-o,n,d)}o=h+1}}replace(e,t,n){if([e,t]=pa(this,e,t),n.lines<this.lines)for(let r=0,a=0;r<this.children.length;r++){let o=this.children[r],c=a+o.length;if(e>=a&&t<=c){let h=o.replace(e-a,t-a,n),d=this.lines-o.lines+h.lines;if(h.lines<d>>4&&h.lines>d>>6){let p=this.children.slice();return p[r]=h,new Ai(p,this.length-(t-e)+n.length)}return super.replace(a,c,h)}a=c+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n=`
168
- `){[e,t]=pa(this,e,t);let r="";for(let a=0,o=0;a<this.children.length&&o<=t;a++){let c=this.children[a],h=o+c.length;o>e&&a&&(r+=n),e<h&&t>o&&(r+=c.sliceString(e-o,t-o,n)),o=h+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Ai))return 0;let n=0,[r,a,o,c]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,a+=t){if(r==o||a==c)return n;let h=this.children[r],d=e.children[a];if(h!=d)return n+h.scanIdentical(d,t);n+=h.length+1}}static from(e,t=e.reduce((n,r)=>n+r.length+1,-1)){let n=0;for(let v of e)n+=v.lines;if(n<32){let v=[];for(let w of e)w.flatten(v);return new ft(v,t)}let r=Math.max(32,n>>5),a=r<<1,o=r>>1,c=[],h=0,d=-1,p=[];function y(v){let w;if(v.lines>a&&v instanceof Ai)for(let k of v.children)y(k);else v.lines>o&&(h>o||!h)?(b(),c.push(v)):v instanceof ft&&h&&(w=p[p.length-1])instanceof ft&&v.lines+w.lines<=32?(h+=v.lines,d+=v.length+1,p[p.length-1]=new ft(w.text.concat(v.text),w.length+1+v.length)):(h+v.lines>r&&b(),h+=v.lines,d+=v.length+1,p.push(v))}function b(){h!=0&&(c.push(p.length==1?p[0]:Ai.from(p,d)),d=-1,h=p.length=0)}for(let v of e)y(v);return b(),c.length==1?c[0]:new Ai(c,t)}}He.empty=new ft([""],0);function LD(i){let e=-1;for(let t of i)e+=t.length+1;return e}function vf(i,e,t=0,n=1e9){for(let r=0,a=0,o=!0;a<i.length&&r<=n;a++){let c=i[a],h=r+c.length;h>=t&&(h>n&&(c=c.slice(0,n-r)),r<t&&(c=c.slice(t-r)),o?(e[e.length-1]+=c,o=!1):e.push(c)),r=h+1}return e}function d1(i,e,t){return vf(i,[""],e,t)}class Yo{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof ft?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],a=this.offsets[n],o=a>>1,c=r instanceof ft?r.text.length:r.children.length;if(o==(t>0?c:0)){if(n==0)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((a&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
169
- `,this;e--}else if(r instanceof ft){let h=r.text[o+(t<0?-1:0)];if(this.offsets[n]+=t,h.length>Math.max(0,e))return this.value=e==0?h:t>0?h.slice(e):h.slice(0,h.length-e),this;e-=h.length}else{let h=r.children[o+(t<0?-1:0)];e>h.length?(e-=h.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(h),this.offsets.push(t>0?1:(h instanceof ft?h.text.length:h.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class dk{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Yo(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class mk{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(He.prototype[Symbol.iterator]=function(){return this.iter()},Yo.prototype[Symbol.iterator]=dk.prototype[Symbol.iterator]=mk.prototype[Symbol.iterator]=function(){return this});class jD{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}}function pa(i,e,t){return e=Math.max(0,Math.min(i.length,e)),[e,Math.max(e,Math.min(i.length,t))]}function Lt(i,e,t=!0,n=!0){return ND(i,e,t,n)}function zD(i){return i>=56320&&i<57344}function _D(i){return i>=55296&&i<56320}function Br(i,e){let t=i.charCodeAt(e);if(!_D(t)||e+1==i.length)return t;let n=i.charCodeAt(e+1);return zD(n)?(t-55296<<10)+(n-56320)+65536:t}function HD(i){return i<=65535?String.fromCharCode(i):(i-=65536,String.fromCharCode((i>>10)+55296,(i&1023)+56320))}function Il(i){return i<65536?1:2}const Fp=/\r\n?|\n/;var Mn=(function(i){return i[i.Simple=0]="Simple",i[i.TrackDel=1]="TrackDel",i[i.TrackBefore=2]="TrackBefore",i[i.TrackAfter=3]="TrackAfter",i})(Mn||(Mn={}));class Ri{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let a=this.sections[t++],o=this.sections[t++];o<0?(e(n,r,a),r+=a):r+=o,n+=a}}iterChangedRanges(e,t=!1){Yp(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];r<0?e.push(n,r):e.push(r,n)}return new Ri(e)}composeDesc(e){return this.empty?e:e.empty?this:pk(this,e)}mapDesc(e,t=!1){return e.empty?this:Kp(this,e,t)}mapPos(e,t=-1,n=Mn.Simple){let r=0,a=0;for(let o=0;o<this.sections.length;){let c=this.sections[o++],h=this.sections[o++],d=r+c;if(h<0){if(d>e)return a+(e-r);a+=c}else{if(n!=Mn.Simple&&d>=e&&(n==Mn.TrackDel&&r<e&&d>e||n==Mn.TrackBefore&&r<e||n==Mn.TrackAfter&&d>e))return null;if(d>e||d==e&&t<0&&!c)return e==r||t<0?a:a+h;a+=h}r=d}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return a}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let a=this.sections[n++],o=this.sections[n++],c=r+a;if(o>=0&&r<=t&&c>=e)return r<e&&c>t?"cover":!0;r=c}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+n+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Ri(e)}static create(e){return new Ri(e)}}class vt extends Ri{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Yp(this,(t,n,r,a,o)=>e=e.replace(r,r+(n-t),o),!1),e}mapDesc(e,t=!1){return Kp(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let r=0,a=0;r<t.length;r+=2){let o=t[r],c=t[r+1];if(c>=0){t[r]=c,t[r+1]=o;let h=r>>1;for(;n.length<h;)n.push(He.empty);n.push(o?e.slice(a,a+o):He.empty)}a+=o}return new vt(t,n)}compose(e){return this.empty?e:e.empty?this:pk(this,e,!0)}map(e,t=!1){return e.empty?this:Kp(this,e,t,!0)}iterChanges(e,t=!1){Yp(this,e,t)}get desc(){return Ri.create(this.sections)}filter(e){let t=[],n=[],r=[],a=new tu(this);e:for(let o=0,c=0;;){let h=o==e.length?1e9:e[o++];for(;c<h||c==h&&a.len==0;){if(a.done)break e;let p=Math.min(a.len,h-c);qt(r,p,-1);let y=a.ins==-1?-1:a.off==0?a.ins:0;qt(t,p,y),y>0&&tr(n,t,a.text),a.forward(p),c+=p}let d=e[o++];for(;c<d;){if(a.done)break e;let p=Math.min(a.len,d-c);qt(t,p,-1),qt(r,p,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(p),c+=p}}return{changes:new vt(t,n),filtered:Ri.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,n){let r=[],a=[],o=0,c=null;function h(p=!1){if(!p&&!r.length)return;o<t&&qt(r,t-o,-1);let y=new vt(r,a);c=c?c.compose(y.map(c)):y,r=[],a=[],o=0}function d(p){if(Array.isArray(p))for(let y of p)d(y);else if(p instanceof vt){if(p.length!=t)throw new RangeError(`Mismatched change set length (got ${p.length}, expected ${t})`);h(),c=c?c.compose(p.map(c)):p}else{let{from:y,to:b=y,insert:v}=p;if(y>b||y<0||b>t)throw new RangeError(`Invalid change range ${y} to ${b} (in doc of length ${t})`);let w=v?typeof v=="string"?He.of(v.split(n||Fp)):v:He.empty,k=w.length;if(y==b&&k==0)return;y<o&&h(),y>o&&qt(r,y-o,-1),qt(r,b-y,k),tr(a,r,w),o=b}}return d(e),h(!c),c}static empty(e){return new vt(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let r=0;r<e.length;r++){let a=e[r];if(typeof a=="number")t.push(a,-1);else{if(!Array.isArray(a)||typeof a[0]!="number"||a.some((o,c)=>c&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(a.length==1)t.push(a[0],0);else{for(;n.length<r;)n.push(He.empty);n[r]=He.of(a.slice(1)),t.push(a[0],n[r].length)}}}return new vt(t,n)}static createSet(e,t){return new vt(e,t)}}function qt(i,e,t,n=!1){if(e==0&&t<=0)return;let r=i.length-2;r>=0&&t<=0&&t==i[r+1]?i[r]+=e:r>=0&&e==0&&i[r]==0?i[r+1]+=t:n?(i[r]+=e,i[r+1]+=t):i.push(e,t)}function tr(i,e,t){if(t.length==0)return;let n=e.length-2>>1;if(n<i.length)i[i.length-1]=i[i.length-1].append(t);else{for(;i.length<n;)i.push(He.empty);i.push(t)}}function Yp(i,e,t){let n=i.inserted;for(let r=0,a=0,o=0;o<i.sections.length;){let c=i.sections[o++],h=i.sections[o++];if(h<0)r+=c,a+=c;else{let d=r,p=a,y=He.empty;for(;d+=c,p+=h,h&&n&&(y=y.append(n[o-2>>1])),!(t||o==i.sections.length||i.sections[o+1]<0);)c=i.sections[o++],h=i.sections[o++];e(r,d,a,p,y),r=d,a=p}}}function Kp(i,e,t,n=!1){let r=[],a=n?[]:null,o=new tu(i),c=new tu(e);for(let h=-1;;){if(o.done&&c.len||c.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&c.ins==-1){let d=Math.min(o.len,c.len);qt(r,d,-1),o.forward(d),c.forward(d)}else if(c.ins>=0&&(o.ins<0||h==o.i||o.off==0&&(c.len<o.len||c.len==o.len&&!t))){let d=c.len;for(qt(r,c.ins,-1);d;){let p=Math.min(o.len,d);o.ins>=0&&h<o.i&&o.len<=p&&(qt(r,0,o.ins),a&&tr(a,r,o.text),h=o.i),o.forward(p),d-=p}c.next()}else if(o.ins>=0){let d=0,p=o.len;for(;p;)if(c.ins==-1){let y=Math.min(p,c.len);d+=y,p-=y,c.forward(y)}else if(c.ins==0&&c.len<p)p-=c.len,c.next();else break;qt(r,d,h<o.i?o.ins:0),a&&h<o.i&&tr(a,r,o.text),h=o.i,o.forward(o.len-p)}else{if(o.done&&c.done)return a?vt.createSet(r,a):Ri.create(r);throw new Error("Mismatched change set lengths")}}}function pk(i,e,t=!1){let n=[],r=t?[]:null,a=new tu(i),o=new tu(e);for(let c=!1;;){if(a.done&&o.done)return r?vt.createSet(n,r):Ri.create(n);if(a.ins==0)qt(n,a.len,0,c),a.next();else if(o.len==0&&!o.done)qt(n,0,o.ins,c),r&&tr(r,n,o.text),o.next();else{if(a.done||o.done)throw new Error("Mismatched change set lengths");{let h=Math.min(a.len2,o.len),d=n.length;if(a.ins==-1){let p=o.ins==-1?-1:o.off?0:o.ins;qt(n,h,p,c),r&&p&&tr(r,n,o.text)}else o.ins==-1?(qt(n,a.off?0:a.len,h,c),r&&tr(r,n,a.textBit(h))):(qt(n,a.off?0:a.len,o.off?0:o.ins,c),r&&!o.off&&tr(r,n,o.text));c=(a.ins>h||o.ins>=0&&o.len>h)&&(c||n.length>d),a.forward2(h),o.forward(h)}}}}class tu{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?He.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?He.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class _r{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let n,r;return this.empty?n=r=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),n==this.from&&r==this.to?this:new _r(n,r,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return ee.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return ee.range(this.anchor,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return ee.range(e.anchor,e.head)}static create(e,t,n){return new _r(e,t,n)}}class ee{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:ee.create(this.ranges.map(n=>n.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new ee([this.main],0)}addRange(e,t=!0){return ee.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let n=this.ranges.slice();return n[t]=e,ee.create(n,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new ee(e.ranges.map(t=>_r.fromJSON(t)),e.main)}static single(e,t=e){return new ee([ee.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let n=0,r=0;r<e.length;r++){let a=e[r];if(a.empty?a.from<=n:a.from<n)return ee.normalized(e.slice(),t);n=a.to}return new ee(e,t)}static cursor(e,t=0,n,r){return _r.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n))|(r??16777215)<<6)}static range(e,t,n,r){let a=(n??16777215)<<6|(r==null?7:Math.min(6,r));return t<e?_r.create(t,e,48|a):_r.create(e,t,(t>e?8:0)|a)}static normalized(e,t=0){let n=e[t];e.sort((r,a)=>r.from-a.from),t=e.indexOf(n);for(let r=1;r<e.length;r++){let a=e[r],o=e[r-1];if(a.empty?a.from<=o.to:a.from<o.to){let c=o.from,h=Math.max(a.to,o.to);r<=t&&t--,e.splice(--r,2,a.anchor>a.head?ee.range(h,c):ee.range(c,h))}}return new ee(e,t)}}function gk(i,e){for(let t of i.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Zg=0;class he{constructor(e,t,n,r,a){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=Zg++,this.default=e([]),this.extensions=typeof a=="function"?a(this):a}get reader(){return this}static define(e={}){return new he(e.combine||(t=>t),e.compareInput||((t,n)=>t===n),e.compare||(e.combine?(t,n)=>t===n:Jg),!!e.static,e.enables)}of(e){return new xf([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new xf(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new xf(e,this,2,t)}from(e,t){return t||(t=n=>n),this.compute([e],n=>t(n.field(e)))}}function Jg(i,e){return i==e||i.length==e.length&&i.every((t,n)=>t===e[n])}class xf{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=Zg++}dynamicSlot(e){var t;let n=this.value,r=this.facet.compareInput,a=this.id,o=e[a]>>1,c=this.type==2,h=!1,d=!1,p=[];for(let y of this.dependencies)y=="doc"?h=!0:y=="selection"?d=!0:(((t=e[y.id])!==null&&t!==void 0?t:1)&1)==0&&p.push(e[y.id]);return{create(y){return y.values[o]=n(y),1},update(y,b){if(h&&b.docChanged||d&&(b.docChanged||b.selection)||Xp(y,p)){let v=n(y);if(c?!m1(v,y.values[o],r):!r(v,y.values[o]))return y.values[o]=v,1}return 0},reconfigure:(y,b)=>{let v,w=b.config.address[a];if(w!=null){let k=Lf(b,w);if(this.dependencies.every(A=>A instanceof he?b.facet(A)===y.facet(A):A instanceof Yn?b.field(A,!1)==y.field(A,!1):!0)||(c?m1(v=n(y),k,r):r(v=n(y),k)))return y.values[o]=k,0}else v=n(y);return y.values[o]=v,1}}}}function m1(i,e,t){if(i.length!=e.length)return!1;for(let n=0;n<i.length;n++)if(!t(i[n],e[n]))return!1;return!0}function Xp(i,e){let t=!1;for(let n of e)Ko(i,n)&1&&(t=!0);return t}function UD(i,e,t){let n=t.map(h=>i[h.id]),r=t.map(h=>h.type),a=n.filter(h=>!(h&1)),o=i[e.id]>>1;function c(h){let d=[];for(let p=0;p<n.length;p++){let y=Lf(h,n[p]);if(r[p]==2)for(let b of y)d.push(b);else d.push(y)}return e.combine(d)}return{create(h){for(let d of n)Ko(h,d);return h.values[o]=c(h),1},update(h,d){if(!Xp(h,a))return 0;let p=c(h);return e.compare(p,h.values[o])?0:(h.values[o]=p,1)},reconfigure(h,d){let p=Xp(h,n),y=d.config.facets[e.id],b=d.facet(e);if(y&&!p&&Jg(t,y))return h.values[o]=b,0;let v=c(h);return e.compare(v,b)?(h.values[o]=b,0):(h.values[o]=v,1)}}}const Xc=he.define({static:!0});class Yn{constructor(e,t,n,r,a){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=a,this.provides=void 0}static define(e){let t=new Yn(Zg++,e.create,e.update,e.compare||((n,r)=>n===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Xc).find(n=>n.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:n=>(n.values[t]=this.create(n),1),update:(n,r)=>{let a=n.values[t],o=this.updateF(a,r);return this.compareF(a,o)?0:(n.values[t]=o,1)},reconfigure:(n,r)=>{let a=n.facet(Xc),o=r.facet(Xc),c;return(c=a.find(h=>h.field==this))&&c!=o.find(h=>h.field==this)?(n.values[t]=c.create(n),1):r.config.address[this.id]!=null?(n.values[t]=r.field(this),0):(n.values[t]=this.create(n),1)}}}init(e){return[this,Xc.of({field:this,create:e})]}get extension(){return this}}const zr={lowest:4,low:3,default:2,high:1,highest:0};function _o(i){return e=>new yk(e,i)}const Ea={highest:_o(zr.highest),high:_o(zr.high),default:_o(zr.default),low:_o(zr.low),lowest:_o(zr.lowest)};class yk{constructor(e,t){this.inner=e,this.prec=t}}class Ra{of(e){return new Wp(this,e)}reconfigure(e){return Ra.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Wp{constructor(e,t){this.compartment=e,this.inner=t}}class Bf{constructor(e,t,n,r,a,o){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=a,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,n){let r=[],a=Object.create(null),o=new Map;for(let b of PD(e,t,o))b instanceof Yn?r.push(b):(a[b.facet.id]||(a[b.facet.id]=[])).push(b);let c=Object.create(null),h=[],d=[];for(let b of r)c[b.id]=d.length<<1,d.push(v=>b.slot(v));let p=n==null?void 0:n.config.facets;for(let b in a){let v=a[b],w=v[0].facet,k=p&&p[b]||[];if(v.every(A=>A.type==0))if(c[w.id]=h.length<<1|1,Jg(k,v))h.push(n.facet(w));else{let A=w.combine(v.map(O=>O.value));h.push(n&&w.compare(A,n.facet(w))?n.facet(w):A)}else{for(let A of v)A.type==0?(c[A.id]=h.length<<1|1,h.push(A.value)):(c[A.id]=d.length<<1,d.push(O=>A.dynamicSlot(O)));c[w.id]=d.length<<1,d.push(A=>UD(A,w,v))}}let y=d.map(b=>b(c));return new Bf(e,o,y,c,h,a)}}function PD(i,e,t){let n=[[],[],[],[],[]],r=new Map;function a(o,c){let h=r.get(o);if(h!=null){if(h<=c)return;let d=n[h].indexOf(o);d>-1&&n[h].splice(d,1),o instanceof Wp&&t.delete(o.compartment)}if(r.set(o,c),Array.isArray(o))for(let d of o)a(d,c);else if(o instanceof Wp){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(o.compartment)||o.inner;t.set(o.compartment,d),a(d,c)}else if(o instanceof yk)a(o.inner,o.prec);else if(o instanceof Yn)n[c].push(o),o.provides&&a(o.provides,c);else if(o instanceof xf)n[c].push(o),o.facet.extensions&&a(o.facet.extensions,zr.default);else{let d=o.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(d,c)}}return a(i,zr.default),n.reduce((o,c)=>o.concat(c))}function Ko(i,e){if(e&1)return 2;let t=e>>1,n=i.status[t];if(n==4)throw new Error("Cyclic dependency between fields and/or facets");if(n&2)return n;i.status[t]=4;let r=i.computeSlot(i,i.config.dynamicSlots[t]);return i.status[t]=2|r}function Lf(i,e){return e&1?i.config.staticValues[e>>1]:i.values[e>>1]}const bk=he.define(),$p=he.define({combine:i=>i.some(e=>e),static:!0}),vk=he.define({combine:i=>i.length?i[0]:void 0,static:!0}),xk=he.define(),Sk=he.define(),wk=he.define(),kk=he.define({combine:i=>i.length?i[0]:!1});class us{constructor(e,t){this.type=e,this.value=t}static define(){return new qD}}class qD{of(e){return new us(this,e)}}class VD{constructor(e){this.map=e}of(e){return new Ye(this,e)}}class Ye{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Ye(this.type,t)}is(e){return this.type==e}static define(e={}){return new VD(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let a=r.map(t);a&&n.push(a)}return n}}Ye.reconfigure=Ye.define();Ye.appendConfig=Ye.define();class St{constructor(e,t,n,r,a,o){this.startState=e,this.changes=t,this.selection=n,this.effects=r,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,n&&gk(n,t.newLength),a.some(c=>c.type==St.time)||(this.annotations=a.concat(St.time.of(Date.now())))}static create(e,t,n,r,a,o){return new St(e,t,n,r,a,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(St.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}St.time=us.define();St.userEvent=us.define();St.addToHistory=us.define();St.remote=us.define();function QD(i,e){let t=[];for(let n=0,r=0;;){let a,o;if(n<i.length&&(r==e.length||e[r]>=i[n]))a=i[n++],o=i[n++];else if(r<e.length)a=e[r++],o=e[r++];else return t;!t.length||t[t.length-1]<a?t.push(a,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function Ck(i,e,t){var n;let r,a,o;return t?(r=e.changes,a=vt.empty(e.changes.length),o=i.changes.compose(e.changes)):(r=e.changes.map(i.changes),a=i.changes.mapDesc(e.changes,!0),o=i.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(a):(n=i.selection)===null||n===void 0?void 0:n.map(r),effects:Ye.mapEffects(i.effects,r).concat(Ye.mapEffects(e.effects,a)),annotations:i.annotations.length?i.annotations.concat(e.annotations):e.annotations,scrollIntoView:i.scrollIntoView||e.scrollIntoView}}function Zp(i,e,t){let n=e.selection,r=Wl(e.annotations);return e.userEvent&&(r=r.concat(St.userEvent.of(e.userEvent))),{changes:e.changes instanceof vt?e.changes:vt.of(e.changes||[],t,i.facet(vk)),selection:n&&(n instanceof ee?n:ee.single(n.anchor,n.head)),effects:Wl(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function Ak(i,e,t){let n=Zp(i,e.length?e[0]:{},i.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let a=1;a<e.length;a++){e[a].filter===!1&&(t=!1);let o=!!e[a].sequential;n=Ck(n,Zp(i,e[a],o?n.changes.newLength:i.doc.length),o)}let r=St.create(i,n.changes,n.selection,n.effects,n.annotations,n.scrollIntoView);return GD(t?ID(r):r)}function ID(i){let e=i.startState,t=!0;for(let r of e.facet(xk)){let a=r(i);if(a===!1){t=!1;break}Array.isArray(a)&&(t=t===!0?a:QD(t,a))}if(t!==!0){let r,a;if(t===!1)a=i.changes.invertedDesc,r=vt.empty(e.doc.length);else{let o=i.changes.filter(t);r=o.changes,a=o.filtered.mapDesc(o.changes).invertedDesc}i=St.create(e,r,i.selection&&i.selection.map(a),Ye.mapEffects(i.effects,a),i.annotations,i.scrollIntoView)}let n=e.facet(Sk);for(let r=n.length-1;r>=0;r--){let a=n[r](i);a instanceof St?i=a:Array.isArray(a)&&a.length==1&&a[0]instanceof St?i=a[0]:i=Ak(e,Wl(a),!1)}return i}function GD(i){let e=i.startState,t=e.facet(wk),n=i;for(let r=t.length-1;r>=0;r--){let a=t[r](i);a&&Object.keys(a).length&&(n=Ck(n,Zp(e,a,i.changes.newLength),!0))}return n==i?i:St.create(e,i.changes,i.selection,n.effects,n.annotations,n.scrollIntoView)}const FD=[];function Wl(i){return i==null?FD:Array.isArray(i)?i:[i]}var es=(function(i){return i[i.Word=0]="Word",i[i.Space=1]="Space",i[i.Other=2]="Other",i})(es||(es={}));const YD=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Jp;try{Jp=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function KD(i){if(Jp)return Jp.test(i);for(let e=0;e<i.length;e++){let t=i[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||YD.test(t)))return!0}return!1}function XD(i){return e=>{if(!/\S/.test(e))return es.Space;if(KD(e))return es.Word;for(let t=0;t<i.length;t++)if(e.indexOf(i[t])>-1)return es.Word;return es.Other}}class Pe{constructor(e,t,n,r,a,o){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=a,o&&(o._state=this);for(let c=0;c<this.config.dynamicSlots.length;c++)Ko(this,c<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw new RangeError("Field is not present in this state");return}return Ko(this,n),Lf(this,n)}update(...e){return Ak(this,e,!0)}applyTransaction(e){let t=this.config,{base:n,compartments:r}=t;for(let c of e.effects)c.is(Ra.reconfigure)?(t&&(r=new Map,t.compartments.forEach((h,d)=>r.set(d,h)),t=null),r.set(c.value.compartment,c.value.extension)):c.is(Ye.reconfigure)?(t=null,n=c.value):c.is(Ye.appendConfig)&&(t=null,n=Wl(n).concat(c.value));let a;t?a=e.startState.values.slice():(t=Bf.resolve(n,r,this),a=new Pe(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(h,d)=>d.reconfigure(h,this),null).values);let o=e.startState.facet($p)?e.newSelection:e.newSelection.asSingle();new Pe(t,e.newDoc,o,a,(c,h)=>h.update(c,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:ee.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),a=[n.range],o=Wl(n.effects);for(let c=1;c<t.ranges.length;c++){let h=e(t.ranges[c]),d=this.changes(h.changes),p=d.map(r);for(let b=0;b<c;b++)a[b]=a[b].map(p);let y=r.mapDesc(d,!0);a.push(h.range.map(y)),r=r.compose(p),o=Ye.mapEffects(o,p).concat(Ye.mapEffects(Wl(h.effects),y))}return{changes:r,selection:ee.create(a,t.mainIndex),effects:o}}changes(e=[]){return e instanceof vt?e:vt.of(e,this.doc.length,this.facet(Pe.lineSeparator))}toText(e){return He.of(e.split(this.facet(Pe.lineSeparator)||Fp))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Ko(this,t),Lf(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof Yn&&this.config.address[r.id]!=null&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(e,t={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(n){for(let a in n)if(Object.prototype.hasOwnProperty.call(e,a)){let o=n[a],c=e[a];r.push(o.init(h=>o.spec.fromJSON(c,h)))}}return Pe.create({doc:e.doc,selection:ee.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=Bf.resolve(e.extensions||[],new Map),n=e.doc instanceof He?e.doc:He.of((e.doc||"").split(t.staticFacet(Pe.lineSeparator)||Fp)),r=e.selection?e.selection instanceof ee?e.selection:ee.single(e.selection.anchor,e.selection.head):ee.single(0);return gk(r,n.length),t.staticFacet($p)||(r=r.asSingle()),new Pe(t,n,r,t.dynamicSlots.map(()=>null),(a,o)=>o.create(a),null)}get tabSize(){return this.facet(Pe.tabSize)}get lineBreak(){return this.facet(Pe.lineSeparator)||`
170
- `}get readOnly(){return this.facet(kk)}phrase(e,...t){for(let n of this.facet(Pe.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let a=+(r||1);return!a||a>t.length?n:t[a-1]})),e}languageDataAt(e,t,n=-1){let r=[];for(let a of this.facet(bk))for(let o of a(this,t,n))Object.prototype.hasOwnProperty.call(o,e)&&r.push(o[e]);return r}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return XD(t.length?t[0]:"")}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),a=this.charCategorizer(e),o=e-n,c=e-n;for(;o>0;){let h=Lt(t,o,!1);if(a(t.slice(h,o))!=es.Word)break;o=h}for(;c<r;){let h=Lt(t,c);if(a(t.slice(c,h))!=es.Word)break;c=h}return o==c?null:ee.range(o+n,c+n)}}Pe.allowMultipleSelections=$p;Pe.tabSize=he.define({combine:i=>i.length?i[0]:4});Pe.lineSeparator=vk;Pe.readOnly=kk;Pe.phrases=he.define({compare(i,e){let t=Object.keys(i),n=Object.keys(e);return t.length==n.length&&t.every(r=>i[r]==e[r])}});Pe.languageData=bk;Pe.changeFilter=xk;Pe.transactionFilter=Sk;Pe.transactionExtender=wk;Ra.reconfigure=Ye.define();function Da(i,e,t={}){let n={};for(let r of i)for(let a of Object.keys(r)){let o=r[a],c=n[a];if(c===void 0)n[a]=o;else if(!(c===o||o===void 0))if(Object.hasOwnProperty.call(t,a))n[a]=t[a](c,o);else throw new Error("Config merge conflict for field "+a)}for(let r in e)n[r]===void 0&&(n[r]=e[r]);return n}class sr{eq(e){return this==e}range(e,t=e){return eg.create(e,t,this)}}sr.prototype.startSide=sr.prototype.endSide=0;sr.prototype.point=!1;sr.prototype.mapMode=Mn.TrackDel;function e0(i,e){return i==e||i.constructor==e.constructor&&i.eq(e)}let eg=class Tk{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new Tk(e,t,n)}};function tg(i,e){return i.from-e.from||i.value.startSide-e.value.startSide}class t0{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,r=0){let a=n?this.to:this.from;for(let o=r,c=a.length;;){if(o==c)return o;let h=o+c>>1,d=a[h]-e||(n?this.value[h].endSide:this.value[h].startSide)-t;if(h==o)return d>=0?o:c;d>=0?c=h:o=h+1}}between(e,t,n,r){for(let a=this.findIndex(t,-1e9,!0),o=this.findIndex(n,1e9,!1,a);a<o;a++)if(r(this.from[a]+e,this.to[a]+e,this.value[a])===!1)return!1}map(e,t){let n=[],r=[],a=[],o=-1,c=-1;for(let h=0;h<this.value.length;h++){let d=this.value[h],p=this.from[h]+e,y=this.to[h]+e,b,v;if(p==y){let w=t.mapPos(p,d.startSide,d.mapMode);if(w==null||(b=v=w,d.startSide!=d.endSide&&(v=t.mapPos(p,d.endSide),v<b)))continue}else if(b=t.mapPos(p,d.startSide),v=t.mapPos(y,d.endSide),b>v||b==v&&d.startSide>0&&d.endSide<=0)continue;(v-b||d.endSide-d.startSide)<0||(o<0&&(o=b),d.point&&(c=Math.max(c,v-b)),n.push(d),r.push(b-o),a.push(v-o))}return{mapped:n.length?new t0(r,a,n,c):null,pos:o}}}class Be{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(e,t,n,r){return new Be(e,t,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:r=0,filterTo:a=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(n&&(t=t.slice().sort(tg)),this.isEmpty)return t.length?Be.of(t):this;let c=new Ok(this,null,-1).goto(0),h=0,d=[],p=new ga;for(;c.value||h<t.length;)if(h<t.length&&(c.from-t[h].from||c.startSide-t[h].value.startSide)>=0){let y=t[h++];p.addInner(y.from,y.to,y.value)||d.push(y)}else c.rangeIndex==1&&c.chunkIndex<this.chunk.length&&(h==t.length||this.chunkEnd(c.chunkIndex)<t[h].from)&&(!o||r>this.chunkEnd(c.chunkIndex)||a<this.chunkPos[c.chunkIndex])&&p.addChunk(this.chunkPos[c.chunkIndex],this.chunk[c.chunkIndex])?c.nextChunk():((!o||r>c.to||a<c.from||o(c.from,c.to,c.value))&&(p.addInner(c.from,c.to,c.value)||d.push(eg.create(c.from,c.to,c.value))),c.next());return p.finishInner(this.nextLayer.isEmpty&&!d.length?Be.empty:this.nextLayer.update({add:d,filter:o,filterFrom:r,filterTo:a}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],n=[],r=-1;for(let o=0;o<this.chunk.length;o++){let c=this.chunkPos[o],h=this.chunk[o],d=e.touchesRange(c,c+h.length);if(d===!1)r=Math.max(r,h.maxPoint),t.push(h),n.push(e.mapPos(c));else if(d===!0){let{mapped:p,pos:y}=h.map(c,e);p&&(r=Math.max(r,p.maxPoint),t.push(p),n.push(y))}}let a=this.nextLayer.map(e);return t.length==0?a:new Be(n,t,a||Be.empty,r)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let a=this.chunkPos[r],o=this.chunk[r];if(t>=a&&e<=a+o.length&&o.between(a,e-a,t-a,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return nu.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return nu.from(e).goto(t)}static compare(e,t,n,r,a=-1){let o=e.filter(y=>y.maxPoint>0||!y.isEmpty&&y.maxPoint>=a),c=t.filter(y=>y.maxPoint>0||!y.isEmpty&&y.maxPoint>=a),h=p1(o,c,n),d=new Ho(o,h,a),p=new Ho(c,h,a);n.iterGaps((y,b,v)=>g1(d,y,p,b,v,r)),n.empty&&n.length==0&&g1(d,0,p,0,0,r)}static eq(e,t,n=0,r){r==null&&(r=999999999);let a=e.filter(p=>!p.isEmpty&&t.indexOf(p)<0),o=t.filter(p=>!p.isEmpty&&e.indexOf(p)<0);if(a.length!=o.length)return!1;if(!a.length)return!0;let c=p1(a,o),h=new Ho(a,c,0).goto(n),d=new Ho(o,c,0).goto(n);for(;;){if(h.to!=d.to||!ng(h.active,d.active)||h.point&&(!d.point||!e0(h.point,d.point)))return!1;if(h.to>r)return!0;h.next(),d.next()}}static spans(e,t,n,r,a=-1){let o=new Ho(e,null,a).goto(t),c=t,h=o.openStart;for(;;){let d=Math.min(o.to,n);if(o.point){let p=o.activeForPoint(o.to),y=o.pointFrom<t?p.length+1:o.point.startSide<0?p.length:Math.min(p.length,h);r.point(c,d,o.point,p,y,o.pointRank),h=Math.min(o.openEnd(d),p.length)}else d>c&&(r.span(c,d,o.active,h),h=o.openEnd(d));if(o.to>n)return h+(o.point&&o.to>n?1:0);c=o.to,o.next()}}static of(e,t=!1){let n=new ga;for(let r of e instanceof eg?[e]:t?WD(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return Be.empty;let t=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=Be.empty;r=r.nextLayer)t=new Be(r.chunkPos,r.chunk,t,Math.max(r.maxPoint,t.maxPoint));return t}}Be.empty=new Be([],[],null,-1);function WD(i){if(i.length>1)for(let e=i[0],t=1;t<i.length;t++){let n=i[t];if(tg(e,n)>0)return i.slice().sort(tg);e=n}return i}Be.empty.nextLayer=Be.empty;class ga{finishChunk(e){this.chunks.push(new t0(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new ga)).add(e,t,n)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return r<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(Be.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Be.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function p1(i,e,t){let n=new Map;for(let a of i)for(let o=0;o<a.chunk.length;o++)a.chunk[o].maxPoint<=0&&n.set(a.chunk[o],a.chunkPos[o]);let r=new Set;for(let a of e)for(let o=0;o<a.chunk.length;o++){let c=n.get(a.chunk[o]);c!=null&&(t?t.mapPos(c):c)==a.chunkPos[o]&&!(t!=null&&t.touchesRange(c,c+a.chunk[o].length))&&r.add(a.chunk[o])}return r}class Ok{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let r=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(r)||this.layer.chunkEnd(this.chunkIndex)<e||r.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class nu{constructor(e){this.heap=e}static from(e,t=null,n=-1){let r=[];for(let a=0;a<e.length;a++)for(let o=e[a];!o.isEmpty;o=o.nextLayer)o.maxPoint>=n&&r.push(new Ok(o,t,n,a));return r.length==1?r[0]:new nu(r)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let n=this.heap.length>>1;n>=0;n--)Jm(this.heap,n);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let n=this.heap.length>>1;n>=0;n--)Jm(this.heap,n);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Jm(this.heap,0)}}}function Jm(i,e){for(let t=i[e];;){let n=(e<<1)+1;if(n>=i.length)break;let r=i[n];if(n+1<i.length&&r.compare(i[n+1])>=0&&(r=i[n+1],n++),t.compare(r)<0)break;i[n]=t,i[e]=r,e=n}}class Ho{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=nu.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Wc(this.active,e),Wc(this.activeTo,e),Wc(this.activeRank,e),this.minActive=y1(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:a}=this.cursor;for(;t<this.activeRank.length&&(a-this.activeRank[t]||r-this.activeTo[t])>0;)t++;$c(this.active,t,n),$c(this.activeTo,t,r),$c(this.activeRank,t,a),e&&$c(e,t,this.cursor.from),this.minActive=y1(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&Wc(n,r)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let a=this.cursor.value;if(!a.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=a,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=a.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(n){this.openStart=0;for(let r=n.length-1;r>=0&&n[r]<e;r--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function g1(i,e,t,n,r,a){i.goto(e),t.goto(n);let o=n+r,c=n,h=n-e,d=!!a.boundChange;for(let p=!1;;){let y=i.to+h-t.to,b=y||i.endSide-t.endSide,v=b<0?i.to+h:t.to,w=Math.min(v,o);if(i.point||t.point?(i.point&&t.point&&e0(i.point,t.point)&&ng(i.activeForPoint(i.to),t.activeForPoint(t.to))||a.comparePoint(c,w,i.point,t.point),p=!1):(p&&a.boundChange(c),w>c&&!ng(i.active,t.active)&&a.compareRange(c,w,i.active,t.active),d&&w<o&&(y||i.openEnd(v)!=t.openEnd(v))&&(p=!0)),v>o)break;c=v,b<=0&&i.next(),b>=0&&t.next()}}function ng(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(i[t]!=e[t]&&!e0(i[t],e[t]))return!1;return!0}function Wc(i,e){for(let t=e,n=i.length-1;t<n;t++)i[t]=i[t+1];i.pop()}function $c(i,e,t){for(let n=i.length-1;n>=e;n--)i[n+1]=i[n];i[e]=t}function y1(i,e){let t=-1,n=1e9;for(let r=0;r<e.length;r++)(e[r]-n||i[r].endSide-i[t].endSide)<0&&(t=r,n=e[r]);return t}function ah(i,e,t=i.length){let n=0;for(let r=0;r<t&&r<i.length;)i.charCodeAt(r)==9?(n+=e-n%e,r++):(n++,r=Lt(i,r));return n}function $D(i,e,t,n){for(let r=0,a=0;;){if(a>=e)return r;if(r==i.length)break;a+=i.charCodeAt(r)==9?t-a%t:1,r=Lt(i,r)}return i.length}const ig="ͼ",b1=typeof Symbol>"u"?"__"+ig:Symbol.for(ig),sg=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),v1=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class rr{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function a(o,c,h,d){let p=[],y=/^@(\w+)\b/.exec(o[0]),b=y&&y[1]=="keyframes";if(y&&c==null)return h.push(o[0]+";");for(let v in c){let w=c[v];if(/&/.test(v))a(v.split(/,\s*/).map(k=>o.map(A=>k.replace(/&/,A))).reduce((k,A)=>k.concat(A)),w,h);else if(w&&typeof w=="object"){if(!y)throw new RangeError("The value of a property ("+v+") should be a primitive value.");a(r(v),w,p,b)}else w!=null&&p.push(v.replace(/_.*/,"").replace(/[A-Z]/g,k=>"-"+k.toLowerCase())+": "+w+";")}(p.length||b)&&h.push((n&&!y&&!d?o.map(n):o).join(", ")+" {"+p.join(" ")+"}")}for(let o in e)a(r(o),e[o],this.rules)}getRules(){return this.rules.join(`
171
- `)}static newName(){let e=v1[b1]||1;return v1[b1]=e+1,ig+e.toString(36)}static mount(e,t,n){let r=e[sg],a=n&&n.nonce;r?a&&r.setNonce(a):r=new ZD(e,a),r.mount(Array.isArray(t)?t:[t],e)}}let x1=new Map;class ZD{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let a=x1.get(n);if(a)return e[sg]=a;this.sheet=new r.CSSStyleSheet,x1.set(n,this)}else this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[sg]=this}mount(e,t){let n=this.sheet,r=0,a=0;for(let o=0;o<e.length;o++){let c=e[o],h=this.modules.indexOf(c);if(h<a&&h>-1&&(this.modules.splice(h,1),a--,h=-1),h==-1){if(this.modules.splice(a++,0,c),n)for(let d=0;d<c.rules.length;d++)n.insertRule(c.rules[d],r++)}else{for(;a<h;)r+=this.modules[a++].rules.length;r+=c.rules.length,a++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let h=0;h<this.modules.length;h++)o+=this.modules[h].getRules()+`
172
- `;this.styleTag.textContent=o;let c=t.head||t;this.styleTag.parentNode!=c&&c.insertBefore(this.styleTag,c.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var lr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},iu={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},JD=typeof navigator<"u"&&/Mac/.test(navigator.platform),eN=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Bt=0;Bt<10;Bt++)lr[48+Bt]=lr[96+Bt]=String(Bt);for(var Bt=1;Bt<=24;Bt++)lr[Bt+111]="F"+Bt;for(var Bt=65;Bt<=90;Bt++)lr[Bt]=String.fromCharCode(Bt+32),iu[Bt]=String.fromCharCode(Bt);for(var ep in lr)iu.hasOwnProperty(ep)||(iu[ep]=lr[ep]);function tN(i){var e=JD&&i.metaKey&&i.shiftKey&&!i.ctrlKey&&!i.altKey||eN&&i.shiftKey&&i.key&&i.key.length==1||i.key=="Unidentified",t=!e&&i.key||(i.shiftKey?iu:lr)[i.keyCode]||i.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}let Kt=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},rg=typeof document<"u"?document:{documentElement:{style:{}}};const lg=/Edge\/(\d+)/.exec(Kt.userAgent),Mk=/MSIE \d/.test(Kt.userAgent),ag=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Kt.userAgent),oh=!!(Mk||ag||lg),S1=!oh&&/gecko\/(\d+)/i.test(Kt.userAgent),tp=!oh&&/Chrome\/(\d+)/.exec(Kt.userAgent),nN="webkitFontSmoothing"in rg.documentElement.style,og=!oh&&/Apple Computer/.test(Kt.vendor),w1=og&&(/Mobile\/\w+/.test(Kt.userAgent)||Kt.maxTouchPoints>2);var ae={mac:w1||/Mac/.test(Kt.platform),windows:/Win/.test(Kt.platform),linux:/Linux|X11/.test(Kt.platform),ie:oh,ie_version:Mk?rg.documentMode||6:ag?+ag[1]:lg?+lg[1]:0,gecko:S1,gecko_version:S1?+(/Firefox\/(\d+)/.exec(Kt.userAgent)||[0,0])[1]:0,chrome:!!tp,chrome_version:tp?+tp[1]:0,ios:w1,android:/Android\b/.test(Kt.userAgent),webkit_version:nN?+(/\bAppleWebKit\/(\d+)/.exec(Kt.userAgent)||[0,0])[1]:0,safari:og,safari_version:og?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Kt.userAgent)||[0,0])[1]:0,tabSize:rg.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function n0(i,e){for(let t in i)t=="class"&&e.class?e.class+=" "+i.class:t=="style"&&e.style?e.style+=";"+i.style:e[t]=i[t];return e}const jf=Object.create(null);function i0(i,e,t){if(i==e)return!0;i||(i=jf),e||(e=jf);let n=Object.keys(i),r=Object.keys(e);if(n.length-0!=r.length-0)return!1;for(let a of n)if(a!=t&&(r.indexOf(a)==-1||i[a]!==e[a]))return!1;return!0}function iN(i,e){for(let t=i.attributes.length-1;t>=0;t--){let n=i.attributes[t].name;e[n]==null&&i.removeAttribute(n)}for(let t in e){let n=e[t];t=="style"?i.style.cssText=n:i.getAttribute(t)!=n&&i.setAttribute(t,n)}}function k1(i,e,t){let n=!1;if(e)for(let r in e)t&&r in t||(n=!0,r=="style"?i.style.cssText="":i.removeAttribute(r));if(t)for(let r in t)e&&e[r]==t[r]||(n=!0,r=="style"?i.style.cssText=t[r]:i.setAttribute(r,t[r]));return n}function sN(i){let e=Object.create(null);for(let t=0;t<i.attributes.length;t++){let n=i.attributes[t];e[n.name]=n.value}return e}class Na{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var jt=(function(i){return i[i.Text=0]="Text",i[i.WidgetBefore=1]="WidgetBefore",i[i.WidgetAfter=2]="WidgetAfter",i[i.WidgetRange=3]="WidgetRange",i})(jt||(jt={}));class Ke extends sr{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new ku(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new $r(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:a,end:o}=Ek(e,t);n=(a?t?-3e8:-1:5e8)-1,r=(o?t?2e8:1:-6e8)+1}return new $r(e,n,r,t,e.widget||null,!0)}static line(e){return new Cu(e)}static set(e,t=!1){return Be.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Ke.none=Be.empty;class ku extends Ke{constructor(e){let{start:t,end:n}=Ek(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?n0(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||jf}eq(e){return this==e||e instanceof ku&&this.tagName==e.tagName&&i0(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}ku.prototype.point=!1;class Cu extends Ke{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Cu&&this.spec.class==e.spec.class&&i0(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Cu.prototype.mapMode=Mn.TrackBefore;Cu.prototype.point=!0;class $r extends Ke{constructor(e,t,n,r,a,o){super(t,n,a,e),this.block=r,this.isReplace=o,this.mapMode=r?t<=0?Mn.TrackBefore:Mn.TrackAfter:Mn.TrackDel}get type(){return this.startSide!=this.endSide?jt.WidgetRange:this.startSide<=0?jt.WidgetBefore:jt.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof $r&&rN(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}$r.prototype.point=!0;function Ek(i,e=!1){let{inclusiveStart:t,inclusiveEnd:n}=i;return t==null&&(t=i.inclusive),n==null&&(n=i.inclusive),{start:t??e,end:n??e}}function rN(i,e){return i==e||!!(i&&e&&i.compare(e))}function $l(i,e,t,n=0){let r=t.length-1;r>=0&&t[r]+n>=i?t[r]=Math.max(t[r],e):t.push(i,e)}class su extends sr{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof su&&this.tagName==e.tagName&&i0(this.attributes,e.attributes)}static create(e){return new su(e.tagName,e.attributes||jf)}static set(e,t=!1){return Be.of(e,t)}}su.prototype.startSide=su.prototype.endSide=-1;function ru(i){let e;return i.nodeType==11?e=i.getSelection?i:i.ownerDocument:e=i,e.getSelection()}function ug(i,e){return e?i==e||i.contains(e.nodeType!=1?e.parentNode:e):!1}function Sf(i,e){if(!e.anchorNode)return!1;try{return ug(i,e.anchorNode)}catch{return!1}}function wf(i){return i.nodeType==3?lu(i,0,i.nodeValue.length).getClientRects():i.nodeType==1?i.getClientRects():[]}function Xo(i,e,t,n){return t?C1(i,e,t,n,-1)||C1(i,e,t,n,1):!1}function ar(i){for(var e=0;;e++)if(i=i.previousSibling,!i)return e}function zf(i){return i.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(i.nodeName)}function C1(i,e,t,n,r){for(;;){if(i==t&&e==n)return!0;if(e==(r<0?0:rs(i))){if(i.nodeName=="DIV")return!1;let a=i.parentNode;if(!a||a.nodeType!=1)return!1;e=ar(i)+(r<0?0:1),i=a}else if(i.nodeType==1){if(i=i.childNodes[e+(r<0?-1:0)],i.nodeType==1&&i.contentEditable=="false")return!1;e=r<0?rs(i):0}else return!1}}function rs(i){return i.nodeType==3?i.nodeValue.length:i.childNodes.length}function _f(i,e){let t=e?i.left:i.right;return{left:t,right:t,top:i.top,bottom:i.bottom}}function lN(i){let e=i.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:i.innerWidth,top:0,bottom:i.innerHeight}}function Rk(i,e){let t=e.width/i.offsetWidth,n=e.height/i.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-i.offsetWidth)<1)&&(t=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(e.height-i.offsetHeight)<1)&&(n=1),{scaleX:t,scaleY:n}}function aN(i,e,t,n,r,a,o,c){let h=i.ownerDocument,d=h.defaultView||window;for(let p=i,y=!1;p&&!y;)if(p.nodeType==1){let b,v=p==h.body,w=1,k=1;if(v)b=lN(d);else{if(/^(fixed|sticky)$/.test(getComputedStyle(p).position)&&(y=!0),p.scrollHeight<=p.clientHeight&&p.scrollWidth<=p.clientWidth){p=p.assignedSlot||p.parentNode;continue}let D=p.getBoundingClientRect();({scaleX:w,scaleY:k}=Rk(p,D)),b={left:D.left,right:D.left+p.clientWidth*w,top:D.top,bottom:D.top+p.clientHeight*k}}let A=0,O=0;if(r=="nearest")e.top<b.top?(O=e.top-(b.top+o),t>0&&e.bottom>b.bottom+O&&(O=e.bottom-b.bottom+o)):e.bottom>b.bottom&&(O=e.bottom-b.bottom+o,t<0&&e.top-O<b.top&&(O=e.top-(b.top+o)));else{let D=e.bottom-e.top,B=b.bottom-b.top;O=(r=="center"&&D<=B?e.top+D/2-B/2:r=="start"||r=="center"&&t<0?e.top-o:e.bottom-B+o)-b.top}if(n=="nearest"?e.left<b.left?(A=e.left-(b.left+a),t>0&&e.right>b.right+A&&(A=e.right-b.right+a)):e.right>b.right&&(A=e.right-b.right+a,t<0&&e.left<b.left+A&&(A=e.left-(b.left+a))):A=(n=="center"?e.left+(e.right-e.left)/2-(b.right-b.left)/2:n=="start"==c?e.left-a:e.right-(b.right-b.left)+a)-b.left,A||O)if(v)d.scrollBy(A,O);else{let D=0,B=0;if(O){let V=p.scrollTop;p.scrollTop+=O/k,B=(p.scrollTop-V)*k}if(A){let V=p.scrollLeft;p.scrollLeft+=A/w,D=(p.scrollLeft-V)*w}e={left:e.left-D,top:e.top-B,right:e.right-D,bottom:e.bottom-B},D&&Math.abs(D-A)<1&&(n="nearest"),B&&Math.abs(B-O)<1&&(r="nearest")}if(v)break;(e.top<b.top||e.bottom>b.bottom||e.left<b.left||e.right>b.right)&&(e={left:Math.max(e.left,b.left),right:Math.min(e.right,b.right),top:Math.max(e.top,b.top),bottom:Math.min(e.bottom,b.bottom)}),p=p.assignedSlot||p.parentNode}else if(p.nodeType==11)p=p.host;else break}function oN(i){let e=i.ownerDocument,t,n;for(let r=i.parentNode;r&&!(r==e.body||t&&n);)if(r.nodeType==1)!n&&r.scrollHeight>r.clientHeight&&(n=r),!t&&r.scrollWidth>r.clientWidth&&(t=r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;return{x:t,y:n}}class uN{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?rs(t):0),n,Math.min(e.focusOffset,n?rs(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}}let Lr=null;ae.safari&&ae.safari_version>=26&&(Lr=!1);function Dk(i){if(i.setActive)return i.setActive();if(Lr)return i.focus(Lr);let e=[];for(let t=i;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(i.focus(Lr==null?{get preventScroll(){return Lr={preventScroll:!0},!0}}:void 0),!Lr){Lr=!1;for(let t=0;t<e.length;){let n=e[t++],r=e[t++],a=e[t++];n.scrollTop!=r&&(n.scrollTop=r),n.scrollLeft!=a&&(n.scrollLeft=a)}}}let A1;function lu(i,e,t=e){let n=A1||(A1=document.createRange());return n.setEnd(i,t),n.setStart(i,e),n}function Zl(i,e,t,n){let r={key:e,code:e,keyCode:t,which:t,cancelable:!0};n&&({altKey:r.altKey,ctrlKey:r.ctrlKey,shiftKey:r.shiftKey,metaKey:r.metaKey}=n);let a=new KeyboardEvent("keydown",r);a.synthetic=!0,i.dispatchEvent(a);let o=new KeyboardEvent("keyup",r);return o.synthetic=!0,i.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function cN(i){for(;i;){if(i&&(i.nodeType==9||i.nodeType==11&&i.host))return i;i=i.assignedSlot||i.parentNode}return null}function fN(i,e){let t=e.focusNode,n=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=n)return!1;for(n=Math.min(n,rs(t));;)if(n){if(t.nodeType!=1)return!1;let r=t.childNodes[n-1];r.contentEditable=="false"?n--:(t=r,n=rs(t))}else{if(t==i)return!0;n=ar(t),t=t.parentNode}}function Nk(i){return i.scrollTop>Math.max(1,i.scrollHeight-i.clientHeight-4)}function Bk(i,e){for(let t=i,n=e;;){if(t.nodeType==3&&n>0)return{node:t,offset:n};if(t.nodeType==1&&n>0){if(t.contentEditable=="false")return null;t=t.childNodes[n-1],n=rs(t)}else if(t.parentNode&&!zf(t))n=ar(t),t=t.parentNode;else return null}}function Lk(i,e){for(let t=i,n=e;;){if(t.nodeType==3&&n<t.nodeValue.length)return{node:t,offset:n};if(t.nodeType==1&&n<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[n],n=0}else if(t.parentNode&&!zf(t))n=ar(t)+1,t=t.parentNode;else return null}}class ii{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new ii(e.parentNode,ar(e),t)}static after(e,t){return new ii(e.parentNode,ar(e)+1,t)}}var et=(function(i){return i[i.LTR=0]="LTR",i[i.RTL=1]="RTL",i})(et||(et={}));const Zr=et.LTR,s0=et.RTL;function jk(i){let e=[];for(let t=0;t<i.length;t++)e.push(1<<+i[t]);return e}const hN=jk("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),dN=jk("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),cg=Object.create(null),bi=[];for(let i of["()","[]","{}"]){let e=i.charCodeAt(0),t=i.charCodeAt(1);cg[e]=t,cg[t]=-e}function zk(i){return i<=247?hN[i]:1424<=i&&i<=1524?2:1536<=i&&i<=1785?dN[i-1536]:1774<=i&&i<=2220?4:8192<=i&&i<=8204?256:64336<=i&&i<=65023?4:1}const mN=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class ts{get dir(){return this.level%2?s0:Zr}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let a=-1;for(let o=0;o<e.length;o++){let c=e[o];if(c.from<=t&&c.to>=t){if(c.level==n)return o;(a<0||(r!=0?r<0?c.from<t:c.to>t:e[a].level>c.level))&&(a=o)}}if(a<0)throw new RangeError("Index out of range");return a}}function _k(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++){let n=i[t],r=e[t];if(n.from!=r.from||n.to!=r.to||n.direction!=r.direction||!_k(n.inner,r.inner))return!1}return!0}const $e=[];function pN(i,e,t,n,r){for(let a=0;a<=n.length;a++){let o=a?n[a-1].to:e,c=a<n.length?n[a].from:t,h=a?256:r;for(let d=o,p=h,y=h;d<c;d++){let b=zk(i.charCodeAt(d));b==512?b=p:b==8&&y==4&&(b=16),$e[d]=b==4?2:b,b&7&&(y=b),p=b}for(let d=o,p=h,y=h;d<c;d++){let b=$e[d];if(b==128)d<c-1&&p==$e[d+1]&&p&24?b=$e[d]=p:$e[d]=256;else if(b==64){let v=d+1;for(;v<c&&$e[v]==64;)v++;let w=d&&p==8||v<t&&$e[v]==8?y==1?1:8:256;for(let k=d;k<v;k++)$e[k]=w;d=v-1}else b==8&&y==1&&($e[d]=1);p=b,b&7&&(y=b)}}}function gN(i,e,t,n,r){let a=r==1?2:1;for(let o=0,c=0,h=0;o<=n.length;o++){let d=o?n[o-1].to:e,p=o<n.length?n[o].from:t;for(let y=d,b,v,w;y<p;y++)if(v=cg[b=i.charCodeAt(y)])if(v<0){for(let k=c-3;k>=0;k-=3)if(bi[k+1]==-v){let A=bi[k+2],O=A&2?r:A&4?A&1?a:r:0;O&&($e[y]=$e[bi[k]]=O),c=k;break}}else{if(bi.length==189)break;bi[c++]=y,bi[c++]=b,bi[c++]=h}else if((w=$e[y])==2||w==1){let k=w==r;h=k?0:1;for(let A=c-3;A>=0;A-=3){let O=bi[A+2];if(O&2)break;if(k)bi[A+2]|=2;else{if(O&4)break;bi[A+2]|=4}}}}}function yN(i,e,t,n){for(let r=0,a=n;r<=t.length;r++){let o=r?t[r-1].to:i,c=r<t.length?t[r].from:e;for(let h=o;h<c;){let d=$e[h];if(d==256){let p=h+1;for(;;)if(p==c){if(r==t.length)break;p=t[r++].to,c=r<t.length?t[r].from:e}else if($e[p]==256)p++;else break;let y=a==1,b=(p<e?$e[p]:n)==1,v=y==b?y?1:2:n;for(let w=p,k=r,A=k?t[k-1].to:i;w>h;)w==A&&(w=t[--k].from,A=k?t[k-1].to:i),$e[--w]=v;h=p}else a=d,h++}}}function fg(i,e,t,n,r,a,o){let c=n%2?2:1;if(n%2==r%2)for(let h=e,d=0;h<t;){let p=!0,y=!1;if(d==a.length||h<a[d].from){let k=$e[h];k!=c&&(p=!1,y=k==16)}let b=!p&&c==1?[]:null,v=p?n:n+1,w=h;e:for(;;)if(d<a.length&&w==a[d].from){if(y)break e;let k=a[d];if(!p)for(let A=k.to,O=d+1;;){if(A==t)break e;if(O<a.length&&a[O].from==A)A=a[O++].to;else{if($e[A]==c)break e;break}}if(d++,b)b.push(k);else{k.from>h&&o.push(new ts(h,k.from,v));let A=k.direction==Zr!=!(v%2);hg(i,A?n+1:n,r,k.inner,k.from,k.to,o),h=k.to}w=k.to}else{if(w==t||(p?$e[w]!=c:$e[w]==c))break;w++}b?fg(i,h,w,n+1,r,b,o):h<w&&o.push(new ts(h,w,v)),h=w}else for(let h=t,d=a.length;h>e;){let p=!0,y=!1;if(!d||h>a[d-1].to){let k=$e[h-1];k!=c&&(p=!1,y=k==16)}let b=!p&&c==1?[]:null,v=p?n:n+1,w=h;e:for(;;)if(d&&w==a[d-1].to){if(y)break e;let k=a[--d];if(!p)for(let A=k.from,O=d;;){if(A==e)break e;if(O&&a[O-1].to==A)A=a[--O].from;else{if($e[A-1]==c)break e;break}}if(b)b.push(k);else{k.to<h&&o.push(new ts(k.to,h,v));let A=k.direction==Zr!=!(v%2);hg(i,A?n+1:n,r,k.inner,k.from,k.to,o),h=k.from}w=k.from}else{if(w==e||(p?$e[w-1]!=c:$e[w-1]==c))break;w--}b?fg(i,w,h,n+1,r,b,o):w<h&&o.push(new ts(w,h,v)),h=w}}function hg(i,e,t,n,r,a,o){let c=e%2?2:1;pN(i,r,a,n,c),gN(i,r,a,n,c),yN(r,a,n,c),fg(i,r,a,e,t,n,o)}function bN(i,e,t){if(!i)return[new ts(0,0,e==s0?1:0)];if(e==Zr&&!t.length&&!mN.test(i))return Hk(i.length);if(t.length)for(;i.length>$e.length;)$e[$e.length]=256;let n=[],r=e==Zr?0:1;return hg(i,r,r,t,0,i.length,n),n}function Hk(i){return[new ts(0,i,0)]}let Uk="";function vN(i,e,t,n,r){var a;let o=n.head-i.from,c=ts.find(e,o,(a=n.bidiLevel)!==null&&a!==void 0?a:-1,n.assoc),h=e[c],d=h.side(r,t);if(o==d){let b=c+=r?1:-1;if(b<0||b>=e.length)return null;h=e[c=b],o=h.side(!r,t),d=h.side(r,t)}let p=Lt(i.text,o,h.forward(r,t));(p<h.from||p>h.to)&&(p=d),Uk=i.text.slice(Math.min(o,p),Math.max(o,p));let y=c==(r?e.length-1:0)?null:e[c+(r?1:-1)];return y&&p==d&&y.level+(r?0:1)<h.level?ee.cursor(y.side(!r,t)+i.from,y.forward(r,t)?1:-1,y.level):ee.cursor(p+i.from,h.forward(r,t)?-1:1,h.level)}function xN(i,e,t){for(let n=e;n<t;n++){let r=zk(i.charCodeAt(n));if(r==1)return Zr;if(r==2||r==4)return s0}return Zr}const Pk=he.define(),qk=he.define(),Vk=he.define(),Qk=he.define(),dg=he.define(),Ik=he.define(),Gk=he.define(),r0=he.define(),l0=he.define(),Fk=he.define({combine:i=>i.some(e=>e)}),Yk=he.define({combine:i=>i.some(e=>e)}),Kk=he.define();class Jl{constructor(e,t="nearest",n="nearest",r=5,a=5,o=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=a,this.isSnapshot=o}map(e){return e.empty?this:new Jl(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new Jl(ee.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Zc=Ye.define({map:(i,e)=>i.map(e)}),Xk=Ye.define();function En(i,e,t){let n=i.facet(Qk);n.length?n[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const Zi=he.define({combine:i=>i.length?i[0]:!0});let SN=0;const Gl=he.define({combine(i){return i.filter((e,t)=>{for(let n=0;n<t;n++)if(i[n].plugin==e.plugin)return!1;return!0})}});class fn{constructor(e,t,n,r,a){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=a(this),this.extension=this.baseExtensions.concat(Gl.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(Gl.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:n,eventObservers:r,provide:a,decorations:o}=t||{};return new fn(SN++,e,n,r,c=>{let h=[];return o&&h.push(uh.of(d=>{let p=d.plugin(c);return p?o(p):Ke.none})),a&&h.push(a(c)),h})}static fromClass(e,t){return fn.define((n,r)=>new e(n,r),t)}}class np{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(n){if(En(t.state,n,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){En(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(n){En(e.state,n,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const Wk=he.define(),a0=he.define(),uh=he.define(),$k=he.define(),o0=he.define(),Au=he.define(),Zk=he.define();function T1(i,e){let t=i.state.facet(Zk);if(!t.length)return t;let n=t.map(a=>a instanceof Function?a(i):a),r=[];return Be.spans(n,e.from,e.to,{point(){},span(a,o,c,h){let d=a-e.from,p=o-e.from,y=r;for(let b=c.length-1;b>=0;b--,h--){let v=c[b].spec.bidiIsolate,w;if(v==null&&(v=xN(e.text,d,p)),h>0&&y.length&&(w=y[y.length-1]).to==d&&w.direction==v)w.to=p,y=w.inner;else{let k={from:d,to:p,direction:v,inner:[]};y.push(k),y=k.inner}}}}),r}const Jk=he.define();function u0(i){let e=0,t=0,n=0,r=0;for(let a of i.state.facet(Jk)){let o=a(i);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(n=Math.max(n,o.top)),o.bottom!=null&&(r=Math.max(r,o.bottom)))}return{left:e,right:t,top:n,bottom:r}}const Qo=he.define();class Vn{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(e){return new Vn(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(e,t){if(t.length==0)return e;let n=[];for(let r=0,a=0,o=0;;){let c=r<e.length?e[r].fromB:1e9,h=a<t.length?t[a]:1e9,d=Math.min(c,h);if(d==1e9)break;let p=d+o,y=d,b=p;for(;;)if(a<t.length&&t[a]<=y){let v=t[a+1];a+=2,y=Math.max(y,v);for(let w=r;w<e.length&&e[w].fromB<=y;w++)o=e[w].toA-e[w].toB;b=Math.max(b,v+o)}else if(r<e.length&&e[r].fromB<=y){let v=e[r++];y=Math.max(y,v.toB),b=Math.max(b,v.toA),o=v.toA-v.toB}else break;n.push(new Vn(p,b,d,y))}return n}}class Hf{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=vt.empty(this.startState.doc.length);for(let a of n)this.changes=this.changes.compose(a.changes);let r=[];this.changes.iterChangedRanges((a,o,c,h)=>r.push(new Vn(a,o,c,h))),this.changedRanges=r}static create(e,t,n){return new Hf(e,t,n)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const wN=[];class pt{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return wN}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&iN(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let n=t;for(let r of this.children){if(r==e)return n;n+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let n=ar(this.dom),r=this.length?e>0:t>0;return new ii(this.parent.dom,n+(r?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof fh)return e;return null}static get(e){return e.cmTile}}class ch extends pt{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,n=null,r,a=(e==null?void 0:e.node)==t?e:null,o=0;for(let c of this.children){if(c.sync(e),o+=c.length+c.breakAfter,r=n?n.nextSibling:t.firstChild,a&&r!=c.dom&&(a.written=!0),c.dom.parentNode==t)for(;r&&r!=c.dom;)r=O1(r);else t.insertBefore(c.dom,r);n=c.dom}for(r=n?n.nextSibling:t.firstChild,a&&r&&(a.written=!0);r;)r=O1(r);this.length=o}}function O1(i){let e=i.nextSibling;return i.parentNode.removeChild(i),e}class fh extends ch{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=pt.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,a=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&a++,r=t.pop()}else{let o=n.children[r++];if(o instanceof ir)t.push(r),n=o,r=0;else{let c=a+o.length,h=e(o,a);if(h!==void 0)return h;a=c+o.breakAfter}}}resolveBlock(e,t){let n,r=-1,a,o=-1;if(this.blockTiles((c,h)=>{let d=h+c.length;if(e>=h&&e<=d){if(c.isWidget()&&t>=-1&&t<=1){if(c.flags&32)return!0;c.flags&16&&(n=void 0)}(h<e||e==d&&(t<-1?c.length:c.covers(1)))&&(!n||!c.isWidget()&&n.isWidget())&&(n=c,r=e-h),(d>e||e==h&&(t>1?c.length:c.covers(-1)))&&(!a||!c.isWidget()&&a.isWidget())&&(a=c,o=e-h)}}),!n&&!a)throw new Error("No tile at position "+e);return n&&t<0||!a?{tile:n,offset:r}:{tile:a,offset:o}}}class ir extends ch{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let n=new ir(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class ya extends ch{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,n){let r=new ya(t||document.createElement("div"),e);return(!t||!n)&&(r.flags|=4),r}get domAttrs(){return this.attrs}resolveInline(e,t,n){let r=null,a=-1,o=null,c=-1;function h(p,y){for(let b=0,v=0;b<p.children.length&&v<=y;b++){let w=p.children[b],k=v+w.length;k>=y&&(w.isComposite()?h(w,y-v):(!o||o.isHidden&&(t>0||n&&CN(o,w)))&&(k>y||w.flags&32)?(o=w,c=y-v):(v<y||w.flags&16&&!w.isHidden)&&(r=w,a=y-v)),v=k}}h(this,e);let d=(t<0?r:o)||r||o;return d?{tile:d,offset:d==r?a:c}:null}coordsIn(e,t){let n=this.resolveInline(e,t,!0);return n?n.tile.coordsIn(Math.max(0,n.offset),t):kN(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:r,offset:a}=n;if(this.dom.contains(r.dom))return r.isText()?new ii(r.dom,Math.min(r.dom.nodeValue.length,a)):r.domPosFor(a,r.flags&16?1:r.flags&32?-1:t);let o=n.tile.parent,c=!1;for(let h of o.children){if(c)return new ii(h.dom,0);h==n.tile&&(c=!0)}}return new ii(this.dom,0)}}function kN(i){let e=i.dom.lastChild;if(!e)return i.dom.getBoundingClientRect();let t=wf(e);return t[t.length-1]||null}function CN(i,e){let t=i.coordsIn(0,1),n=e.coordsIn(0,1);return t&&n&&n.top<t.bottom}class an extends ch{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let n=new an(t||document.createElement(e.tagName),e);return t||(n.flags|=4),n}}class Hr extends pt{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let n=this.dom.nodeValue.length;e>n&&(e=n);let r=e,a=e,o=0;e==0&&t<0||e==n&&t>=0?ae.chrome||ae.gecko||(e?(r--,o=1):a<n&&(a++,o=-1)):t<0?r--:a<n&&a++;let c=lu(this.dom,r,a).getClientRects();if(!c.length)return null;let h=c[(o?o<0:t>=0)?0:c.length-1];return ae.safari&&!o&&h.width==0&&(h=Array.prototype.find.call(c,d=>d.width)||h),o?_f(h,o<0):h||null}static of(e,t){let n=new Hr(t||document.createTextNode(e),e);return t||(n.flags|=2),n}}class Jr extends pt{constructor(e,t,n,r){super(e,t,r),this.widget=n}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return _f(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let a=this.dom.getClientRects(),o=null;if(!a.length)return null;let c=this.flags&16?!0:this.flags&32?!1:e>0;for(let h=c?a.length-1:0;o=a[h],!(e>0?h==0:h==a.length-1||o.top<o.bottom);h+=c?-1:1);return _f(o,!c)}}get overrideDOMText(){if(!this.length)return He.empty;let{root:e}=this;if(!e)return He.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,n,r,a){return a||(a=e.toDOM(t),e.editable||(a.contentEditable="false")),new Jr(a,n,e,r)}}class Uf extends pt{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return He.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class AN{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:a,beforeBreak:o,parents:c}=this;for(;e||t>0;)if(r.isComposite())if(o){if(!e)break;n&&n.break(),e--,o=!1}else if(a==r.children.length){if(!e&&!c.length)break;n&&n.leave(r),o=!!r.breakAfter,{tile:r,index:a}=c.pop(),a++}else{let h=r.children[a],d=h.breakAfter;(t>0?h.length<=e:h.length<e)&&(!n||n.skip(h,0,h.length)!==!1||!h.isComposite)?(o=!!d,a++,e-=h.length):(c.push({tile:r,index:a}),r=h,a=0,n&&h.isComposite()&&n.enter(h))}else if(a==r.length)o=!!r.breakAfter,{tile:r,index:a}=c.pop(),a++;else if(e){let h=Math.min(e,r.length-a);n&&n.skip(r,a,a+h),e-=h,a+=h}else break;return this.tile=r,this.index=a,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class TN{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}}class ON{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){var a;this.flushBuffer();let o=this.ensureMarks(t,n),c=o.lastChild;if(c&&c.isText()&&!(c.flags&8)){this.cache.reused.set(c,2);let h=o.children[o.children.length-1]=new Hr(c.dom,c.text+e);h.parent=o}else o.append(r||Hr.of(e,(a=this.cache.find(Hr))===null||a===void 0?void 0:a.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?ip(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let c=t.marks.length-1;c>=0;c--){let h=t.marks[c],d=r.lastChild;if(d instanceof an&&d.mark.eq(h.mark))d.dom!=h.dom&&d.setDOM(ip(h.dom)),r=d;else{if(this.cache.reused.get(h)){let y=pt.get(h.dom);y&&y.setDOM(ip(h.dom))}let p=an.of(h.mark,h.dom);r.append(p),r=p}this.cache.reused.set(h,2)}let a=pt.get(e.text);a&&this.cache.reused.set(a,2);let o=new Hr(e.text,e.text.nodeValue);o.flags|=8,r.append(o)}addInlineWidget(e,t,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let a=this.ensureMarks(t,n);!r&&!(e.flags&16)&&a.append(this.getBuffer(1)),a.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var n;e||(e=eC);let r=ya.start(e,t||((n=this.cache.find(ya))===null||n===void 0?void 0:n.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=r)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var n;let r=this.curLine;for(let a=e.length-1;a>=0;a--){let o=e[a],c;if(t>0&&(c=r.lastChild)&&c instanceof an&&c.mark.eq(o))r=c,t--;else{let h=an.of(o,(n=this.cache.find(an,d=>d.mark.eq(o)))===null||n===void 0?void 0:n.dom);r.append(h),r=h,t=0}}return r}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!M1(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(ae.ios&&M1(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(sp,0,32)||new Jr(sp.toDOM(),0,sp,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=new TN(e.from,e.to,e.value,e.rank),n=this.wrappers.length;for(;n>0&&(this.wrappers[n-1].rank-t.rank||this.wrappers[n-1].to-t.to)<0;)n--;this.wrappers.splice(n,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let n of this.wrappers){let r=t.lastChild;if(n.from<this.pos&&r instanceof ir&&r.wrapper.eq(n.wrapper))t=r;else{let a=ir.of(n.wrapper,(e=this.cache.find(ir,o=>o.wrapper.eq(n.wrapper)))===null||e===void 0?void 0:e.dom);t.append(a),t=a}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),n=this.cache.find(Uf,void 0,1);return n&&(n.flags=t),n||new Uf(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class MN{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:r,lineBreak:a,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=r;let c=this.textOff=Math.min(e,r.length);return a?null:r.slice(0,c)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}}const Pf=[Jr,ya,Hr,an,Uf,ir,fh];for(let i=0;i<Pf.length;i++)Pf[i].bucket=i;class EN{constructor(e){this.view=e,this.buckets=Pf.map(()=>[]),this.index=Pf.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,a=this.buckets[r],o=this.index[r];for(let c=a.length-1;c>=0;c--){let h=(c+o)%a.length,d=a[h];if((!t||t(d))&&!this.reused.has(d))return a.splice(h,1),h<o&&this.index[r]--,this.reused.set(d,n),d}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let a=0,o=0;;a++){if(a==r.length){if(o)return null;o=1,a=0}let c=r[a];if(!this.reused.has(c)&&(o==0?c.widget.compare(e):c.widget.constructor==e.constructor&&e.updateDOM(c.dom,this.view)))return r.splice(a,1),a<this.index[0]&&this.index[0]--,c.widget==e&&c.length==t&&(c.flags&497)==n?(this.reused.set(c,1),c):(this.reused.set(c,2),new Jr(c.dom,t,e,c.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class RN{constructor(e,t,n,r,a){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=a,this.openWidget=!1,this.openMarks=0,this.cache=new EN(e),this.text=new MN(e.state.doc),this.builder=new ON(this.cache,new fh(e,e.contentDOM),Be.iter(n)),this.cache.reused.set(t,2),this.old=new AN(t),this.reuseWalker={skip:(o,c,h)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,a=0,o=0;;){let c=o<e.length?e[o++]:null,h=c?c.fromA:this.old.root.length;if(h>r){let d=h-r;this.preserve(d,!o,!c),r=h,a+=d}if(!c)break;t&&c.fromA<=t.range.fromA&&c.toA>=t.range.toA?(this.forward(c.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(a,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,c.toA),this.emit(t.range.toB,c.toB)):(this.forward(c.fromA,c.toA),this.emit(a,c.toB)),a=c.toB,r=c.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=BN(this.old),a=this.openMarks;this.old.advance(e,n?1:-1,{skip:(o,c,h)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(h-c);else{let d=h>0||c<o.length?Jr.of(o.widget,this.view,h-c,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);d.flags&256?(d.flags&=-2,this.builder.addBlockWidget(d)):(this.builder.ensureLine(null),this.builder.addInlineWidget(d,r,a),a=r.length)}else if(o.isText())this.builder.ensureLine(null),!c&&h==o.length?this.builder.addText(o.text,r,a,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(c,h),r,a)),a=r.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof Uf)this.cache.add(o);else if(o instanceof an)this.builder.ensureLine(null),this.builder.addMark(o,r,a),this.cache.reused.set(o,1),a=r.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof an&&r.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?r.length&&(r.length=a=0):o instanceof an&&(r.shift(),a=Math.min(a,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,a=0,o=Be.spans(this.decorations,e,t,{point:(c,h,d,p,y,b)=>{if(d instanceof $r){if(this.disallowBlockEffectsFor[b]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(h>this.view.state.doc.lineAt(c).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(a=p.length,y>p.length)r.continueWidget(h-c);else{let v=d.widget||(d.block?ba.block:ba.inline),w=DN(d),k=this.cache.findWidget(v,h-c,w)||Jr.of(v,this.view,h-c,w);d.block?(d.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(k)):(r.ensureLine(n),r.addInlineWidget(k,p,y))}n=null}else n=NN(n,d);h>c&&this.text.skip(h-c)},span:(c,h,d,p)=>{for(let y=c;y<h;){let b=this.text.next(Math.min(512,h-y));b==null?(r.addLineStartIfNotCovered(n),r.addBreak(),y++):(r.ensureLine(n),r.addText(b,d,p),y+=b.length),n=null}}});r.addLineStartIfNotCovered(n),this.openWidget=o>a,this.openMarks=o}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let a=pt.get(r);if(r==this.view.contentDOM)break;a instanceof an?t.push(a):a!=null&&a.isLine()?n=a:r.nodeName=="DIV"&&!n&&r!=this.view.contentDOM?n=new ya(r,eC):t.push(an.of(new ku({tagName:r.nodeName.toLowerCase(),attributes:sN(r)}),r))}return{line:n,marks:t}}}function M1(i,e){let t=n=>{for(let r of n.children)if((e?r.isText():r.length)||t(r))return!0;return!1};return t(i)}function DN(i){let e=i.isReplace?(i.startSide<0?64:0)|(i.endSide>0?128:0):i.startSide>0?32:16;return i.block&&(e|=256),e}const eC={class:"cm-line"};function NN(i,e){let t=e.spec.attributes,n=e.spec.class;return!t&&!n||(i||(i={class:"cm-line"}),t&&n0(t,i),n&&(i.class+=" "+n)),i}function BN(i){let e=[];for(let t=i.parents.length;t>1;t--){let n=t==i.parents.length?i.tile:i.parents[t].tile;n instanceof an&&e.push(n.mark)}return e}function ip(i){let e=pt.get(i);return e&&e.setDOM(i.cloneNode()),i}class ba extends Na{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}ba.inline=new ba("span");ba.block=new ba("div");const sp=new class extends Na{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class E1{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Ke.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new fh(e,e.contentDOM),this.updateInner([new Vn(0,0,0,e.state.doc.length)],null)}update(e){var t;let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:p,toA:y})=>y<this.minWidthFrom||p>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let r=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?r=this.domChanged.newSel.head:!VN(e.changes,this.hasComposition)&&!e.selectionSet&&(r=e.state.selection.main.head));let a=r>-1?jN(this.view,e.changes,r):null;if(this.domChanged=null,this.hasComposition){let{from:p,to:y}=this.hasComposition;n=new Vn(p,y,e.changes.mapPos(p,-1),e.changes.mapPos(y,1)).addToSet(n.slice())}this.hasComposition=a?{from:a.range.fromB,to:a.range.toB}:null,(ae.ie||ae.chrome)&&!a&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,c=this.blockWrappers;this.updateDeco();let h=HN(o,this.decorations,e.changes);h.length&&(n=Vn.extendWithRanges(n,h));let d=PN(c,this.blockWrappers,e.changes);return d.length&&(n=Vn.extendWithRanges(n,d)),a&&!n.some(p=>p.fromA<=a.range.fromA&&p.toA>=a.range.toA)&&(n=a.range.addToSet(n.slice())),this.tile.flags&2&&n.length==0?!1:(this.updateInner(n,a),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let o=this.tile,c=new RN(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);this.tile=c.run(e,t),mg(o,c.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let a=ae.chrome||ae.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(a),a&&(a.written||n.selectionRange.focusNode!=a.node||!this.tile.dom.contains(a.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let a of this.tile.children)a.isWidget()&&a.widget instanceof rp&&r.push(a.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let n of t.effects)n.is(Xk)&&(this.editContextFormatting=n.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,a=r==n,o=!a&&!(this.view.state.facet(Zi)||n.tabIndex>-1)&&Sf(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(a||t||o))return;let c=this.forceSelection;this.forceSelection=!1;let h=this.view.state.selection.main,d,p;if(h.empty?p=d=this.inlineDOMNearPos(h.anchor,h.assoc||1):(p=this.inlineDOMNearPos(h.head,h.head==h.from?1:-1),d=this.inlineDOMNearPos(h.anchor,h.anchor==h.from?1:-1)),ae.gecko&&h.empty&&!this.hasComposition&&LN(d)){let b=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(b,d.node.childNodes[d.offset]||null)),d=p=new ii(b,0),c=!0}let y=this.view.observer.selectionRange;(c||!y.focusNode||(!Xo(d.node,d.offset,y.anchorNode,y.anchorOffset)||!Xo(p.node,p.offset,y.focusNode,y.focusOffset))&&!this.suppressWidgetCursorChange(y,h))&&(this.view.observer.ignore(()=>{ae.android&&ae.chrome&&n.contains(y.focusNode)&&qN(y.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let b=ru(this.view.root);if(b)if(h.empty){if(ae.gecko){let v=zN(d.node,d.offset);if(v&&v!=3){let w=(v==1?Bk:Lk)(d.node,d.offset);w&&(d=new ii(w.node,w.offset))}}b.collapse(d.node,d.offset),h.bidiLevel!=null&&b.caretBidiLevel!==void 0&&(b.caretBidiLevel=h.bidiLevel)}else if(b.extend){b.collapse(d.node,d.offset);try{b.extend(p.node,p.offset)}catch{}}else{let v=document.createRange();h.anchor>h.head&&([d,p]=[p,d]),v.setEnd(p.node,p.offset),v.setStart(d.node,d.offset),b.removeAllRanges(),b.addRange(v)}o&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(d,p)),this.impreciseAnchor=d.precise?null:new ii(y.anchorNode,y.anchorOffset),this.impreciseHead=p.precise?null:new ii(y.focusNode,y.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Xo(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=ru(e.root),{anchorNode:r,anchorOffset:a}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let c=o.posAtStart;if(t.head==c||t.head==c+o.length)return;let h=this.coordsAt(t.head,-1),d=this.coordsAt(t.head,1);if(!h||!d||h.bottom>d.top)return;let p=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(p.node,p.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let y=e.observer.selectionRange;e.docView.posFromDOM(y.anchorNode,y.anchorOffset)!=t.from&&n.collapse(r,a)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let a;if(e==n.dom)a=n.dom.childNodes[t];else{let o=rs(e)==0?0:t==0?-1:1;for(;;){let c=e.parentNode;if(c==n.dom)break;o==0&&c.firstChild!=c.lastChild&&(e==c.firstChild?o=-1:o=1),e=c}o<0?a=e:a=e.nextSibling}if(a==n.dom.firstChild)return r;for(;a&&!pt.get(a);)a=a.nextSibling;if(!a)return r+n.length;for(let o=0,c=r;;o++){let h=n.children[o];if(h.dom==a)return c;c+=h.length+h.breakAfter}}else return n.isText()?e==n.dom?r+t:r+(t?n.length:0):r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(e,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,a=!1,o,c=-1,h=!1;return this.tile.blockTiles((d,p)=>{if(d.isWidget()){if(d.flags&32&&p>=e)return!0;d.flags&16&&(a=!0)}else{let y=p+d.length;if(p<=e&&(n=d,r=e-p,a=y<e),y>=e&&!o&&(o=d,c=e-p,h=p>e),p>e&&o)return!0}}),!n&&!o?this.domAtPos(e,t):(a&&o?n=null:h&&n&&(o=null),n&&t<0||!o?n.domIn(r,t):o.domIn(c,t))}coordsAt(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.widget instanceof rp?null:n.coordsInWidget(r,t,!0):n.coordsIn(r,t)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(a,o){if(a.isComposite())for(let c of a.children){if(c.length>=o){let h=r(c,o);if(h)return h}if(o-=c.length,o<0)break}else if(a.isText()&&o<a.length){let c=Lt(a.text,o);if(c==o)return null;let h=lu(a.dom,o,c).getClientRects();for(let d=0;d<h.length;d++){let p=h[d];if(d==h.length-1||p.top<p.bottom&&p.left<p.right)return p}}return null}return r(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,a=this.view.contentDOM.clientWidth,o=a>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,c=-1,h=this.view.textDirection==et.LTR,d=0,p=(y,b,v)=>{for(let w=0;w<y.children.length&&!(b>r);w++){let k=y.children[w],A=b+k.length,O=k.dom.getBoundingClientRect(),{height:D}=O;if(v&&!w&&(d+=O.top-v.top),k instanceof ir)A>n&&p(k,b,O);else if(b>=n&&(d>0&&t.push(-d),t.push(D+d),d=0,o)){let B=k.dom.lastChild,V=B?wf(B):[];if(V.length){let j=V[V.length-1],Q=h?j.right-O.left:O.right-j.left;Q>c&&(c=Q,this.minWidth=a,this.minWidthFrom=b,this.minWidthTo=A)}}v&&w==y.children.length-1&&(d+=v.bottom-O.bottom),b=A+k.breakAfter}};return p(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?et.RTL:et.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let c=0,h;for(let d of o.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let p=wf(d.dom);if(p.length!=1)return;c+=p[0].width,h=p[0].height}if(c)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:c/o.length,textHeight:h}}});if(e)return e;let t=document.createElement("div"),n,r,a;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=wf(t.firstChild)[0];n=t.getBoundingClientRect().height,r=o&&o.width?o.width/27:7,a=o&&o.height?o.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:a}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let a=r==t.viewports.length?null:t.viewports[r],o=a?a.from-1:this.view.state.doc.length;if(o>n){let c=(t.lineBlockAt(o).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(Ke.replace({widget:new rp(c),block:!0,inclusive:!0,isBlockGap:!0}).range(n,o))}if(!a)break;n=a.to+1}return Ke.set(e)}updateDeco(){let e=1,t=this.view.state.facet(uh).map(a=>(this.dynamicDecorationMap[e++]=typeof a=="function")?a(this.view):a),n=!1,r=this.view.state.facet(o0).map((a,o)=>{let c=typeof a=="function";return c&&(n=!0),c?a(this.view):a});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(Be.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet($k).map(a=>typeof a=="function"?a(this.view):a)}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(Kk))try{if(d(this.view,e.range,e))return!0}catch(p){En(this.view.state,p,"scroll handler")}let{range:t}=e,n=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let a=u0(this.view),o={left:n.left-a.left,top:n.top-a.top,right:n.right+a.right,bottom:n.bottom+a.bottom},{offsetWidth:c,offsetHeight:h}=this.view.scrollDOM;aN(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,c),-c),Math.max(Math.min(e.yMargin,h),-h),this.view.textDirection==et.LTR)}lineHasWidget(e){let t=n=>n.isWidget()||n.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){mg(this.tile)}}function mg(i,e){let t=e==null?void 0:e.get(i);if(t!=1){t==null&&i.destroy();for(let n of i.children)mg(n,e)}}function LN(i){return i.node.nodeType==1&&i.node.firstChild&&(i.offset==0||i.node.childNodes[i.offset-1].contentEditable=="false")&&(i.offset==i.node.childNodes.length||i.node.childNodes[i.offset].contentEditable=="false")}function tC(i,e){let t=i.observer.selectionRange;if(!t.focusNode)return null;let n=Bk(t.focusNode,t.focusOffset),r=Lk(t.focusNode,t.focusOffset),a=n||r;if(r&&n&&r.node!=n.node){let c=pt.get(r.node);if(!c||c.isText()&&c.text!=r.node.nodeValue)a=r;else if(i.docView.lastCompositionAfterCursor){let h=pt.get(n.node);!h||h.isText()&&h.text!=n.node.nodeValue||(a=r)}}if(i.docView.lastCompositionAfterCursor=a!=n,!a)return null;let o=e-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function jN(i,e,t){let n=tC(i,t);if(!n)return null;let{node:r,from:a,to:o}=n,c=r.nodeValue;if(/[\n\r]/.test(c)||i.state.doc.sliceString(n.from,n.to)!=c)return null;let h=e.invertedDesc;return{range:new Vn(h.mapPos(a),h.mapPos(o),a,o),text:r}}function zN(i,e){return i.nodeType!=1?0:(e&&i.childNodes[e-1].contentEditable=="false"?1:0)|(e<i.childNodes.length&&i.childNodes[e].contentEditable=="false"?2:0)}let _N=class{constructor(){this.changes=[]}compareRange(e,t){$l(e,t,this.changes)}comparePoint(e,t){$l(e,t,this.changes)}boundChange(e){$l(e,e,this.changes)}};function HN(i,e,t){let n=new _N;return Be.compare(i,e,t,n),n.changes}class UN{constructor(){this.changes=[]}compareRange(e,t){$l(e,t,this.changes)}comparePoint(){}boundChange(e){$l(e,e,this.changes)}}function PN(i,e,t){let n=new UN;return Be.compare(i,e,t,n),n.changes}function qN(i,e){for(let t=i;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function VN(i,e){let t=!1;return e&&i.iterChangedRanges((n,r)=>{n<e.to&&r>e.from&&(t=!0)}),t}class rp extends Na{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function QN(i,e,t=1){let n=i.charCategorizer(e),r=i.doc.lineAt(e),a=e-r.from;if(r.length==0)return ee.cursor(e);a==0?t=1:a==r.length&&(t=-1);let o=a,c=a;t<0?o=Lt(r.text,a,!1):c=Lt(r.text,a);let h=n(r.text.slice(o,c));for(;o>0;){let d=Lt(r.text,o,!1);if(n(r.text.slice(d,o))!=h)break;o=d}for(;c<r.length;){let d=Lt(r.text,c);if(n(r.text.slice(c,d))!=h)break;c=d}return ee.range(o+r.from,c+r.from)}function IN(i,e,t,n,r){let a=Math.round((n-e.left)*i.defaultCharacterWidth);if(i.lineWrapping&&t.height>i.defaultLineHeight*1.5){let c=i.viewState.heightOracle.textHeight,h=Math.floor((r-t.top-(i.defaultLineHeight-c)*.5)/c);a+=h*i.viewState.heightOracle.lineLength}let o=i.state.sliceDoc(t.from,t.to);return t.from+$D(o,a,i.state.tabSize)}function pg(i,e,t){let n=i.lineBlockAt(e);if(Array.isArray(n.type)){let r;for(let a of n.type){if(a.from>e)break;if(!(a.to<e)){if(a.from<e&&a.to>e)return a;(!r||a.type==jt.Text&&(r.type!=a.type||(t<0?a.from<e:a.to>e)))&&(r=a)}}return r||n}return n}function GN(i,e,t,n){let r=pg(i,e.head,e.assoc||-1),a=!n||r.type!=jt.Text||!(i.lineWrapping||r.widgetLineBreaks)?null:i.coordsAtPos(e.assoc<0&&e.head>r.from?e.head-1:e.head);if(a){let o=i.dom.getBoundingClientRect(),c=i.textDirectionAt(r.from),h=i.posAtCoords({x:t==(c==et.LTR)?o.right-1:o.left+1,y:(a.top+a.bottom)/2});if(h!=null)return ee.cursor(h,t?-1:1)}return ee.cursor(t?r.to:r.from,t?-1:1)}function R1(i,e,t,n){let r=i.state.doc.lineAt(e.head),a=i.bidiSpans(r),o=i.textDirectionAt(r.from);for(let c=e,h=null;;){let d=vN(r,a,o,c,t),p=Uk;if(!d){if(r.number==(t?i.state.doc.lines:1))return c;p=`
173
- `,r=i.state.doc.line(r.number+(t?1:-1)),a=i.bidiSpans(r),d=i.visualLineSide(r,!t)}if(h){if(!h(p))return c}else{if(!n)return d;h=n(p)}c=d}}function FN(i,e,t){let n=i.state.charCategorizer(e),r=n(t);return a=>{let o=n(a);return r==es.Space&&(r=o),r==o}}function YN(i,e,t,n){let r=e.head,a=t?1:-1;if(r==(t?i.state.doc.length:0))return ee.cursor(r,e.assoc);let o=e.goalColumn,c,h=i.contentDOM.getBoundingClientRect(),d=i.coordsAtPos(r,e.assoc||-1),p=i.documentTop;if(d)o==null&&(o=d.left-h.left),c=a<0?d.top:d.bottom;else{let v=i.viewState.lineBlockAt(r);o==null&&(o=Math.min(h.right-h.left,i.defaultCharacterWidth*(r-v.from))),c=(a<0?v.top:v.bottom)+p}let y=h.left+o,b=n??i.viewState.heightOracle.textHeight>>1;for(let v=0;;v+=10){let w=c+(b+v)*a,k=gg(i,{x:y,y:w},!1,a);return ee.cursor(k.pos,k.assoc,void 0,o)}}function Wo(i,e,t){for(;;){let n=0;for(let r of i)r.between(e-1,e+1,(a,o,c)=>{if(e>a&&e<o){let h=n||t||(e-a<o-e?-1:1);e=h<0?a:o,n=h}});if(!n)return e}}function nC(i,e){let t=null;for(let n=0;n<e.ranges.length;n++){let r=e.ranges[n],a=null;if(r.empty){let o=Wo(i,r.from,0);o!=r.from&&(a=ee.cursor(o,-1))}else{let o=Wo(i,r.from,-1),c=Wo(i,r.to,1);(o!=r.from||c!=r.to)&&(a=ee.range(r.from==r.anchor?o:c,r.from==r.head?o:c))}a&&(t||(t=e.ranges.slice()),t[n]=a)}return t?ee.create(t,e.mainIndex):e}function lp(i,e,t){let n=Wo(i.state.facet(Au).map(r=>r(i)),t.from,e.head>t.from?-1:1);return n==t.from?t:ee.cursor(n,n<t.from?1:-1)}class Ti{constructor(e,t){this.pos=e,this.assoc=t}}function gg(i,e,t,n){let r=i.contentDOM.getBoundingClientRect(),a=r.top+i.viewState.paddingTop,{x:o,y:c}=e,h=c-a,d;for(;;){if(h<0)return new Ti(0,1);if(h>i.viewState.docHeight)return new Ti(i.state.doc.length,-1);if(d=i.elementAtHeight(h),n==null)break;if(d.type==jt.Text){let b=i.docView.coordsAt(n<0?d.from:d.to,n);if(b&&(n<0?b.top<=h+a:b.bottom>=h+a))break}let y=i.viewState.heightOracle.textHeight/2;h=n>0?d.bottom+y:d.top-y}if(i.viewport.from>=d.to||i.viewport.to<=d.from){if(t)return null;if(d.type==jt.Text){let y=IN(i,r,d,o,c);return new Ti(y,y==d.from?1:-1)}}if(d.type!=jt.Text)return h<(d.top+d.bottom)/2?new Ti(d.from,1):new Ti(d.to,-1);let p=i.docView.lineAt(d.from,2);return(!p||p.length!=d.length)&&(p=i.docView.lineAt(d.from,-2)),iC(i,p,d.from,o,c)}function iC(i,e,t,n,r){let a=-1,o=null,c=1e9,h=1e9,d=r,p=r,y=(b,v)=>{for(let w=0;w<b.length;w++){let k=b[w];if(k.top==k.bottom)continue;let A=k.left>n?k.left-n:k.right<n?n-k.right:0,O=k.top>r?k.top-r:k.bottom<r?r-k.bottom:0;k.top<=p&&k.bottom>=d&&(d=Math.min(k.top,d),p=Math.max(k.bottom,p),O=0),(a<0||(O-h||A-c)<0)&&(a>=0&&h&&c<A&&o.top<=p-2&&o.bottom>=d+2?h=0:(a=v,c=A,h=O,o=k))}};if(e.isText()){for(let v=0;v<e.length;){let w=Lt(e.text,v);if(y(lu(e.dom,v,w).getClientRects(),v),!c&&!h)break;v=w}return n>(o.left+o.right)/2==(D1(i,a+t)==et.LTR)?new Ti(t+Lt(e.text,a),-1):new Ti(t+a,1)}else{if(!e.length)return new Ti(t,1);for(let k=0;k<e.children.length;k++){let A=e.children[k];if(A.flags&48)continue;let O=(A.dom.nodeType==1?A.dom:lu(A.dom,0,A.length)).getClientRects();if(y(O,k),!c&&!h)break}let b=e.children[a],v=e.posBefore(b,t);return b.isComposite()||b.isText()?iC(i,b,v,Math.max(o.left,Math.min(o.right,n)),r):n>(o.left+o.right)/2==(D1(i,a+t)==et.LTR)?new Ti(v+b.length,-1):new Ti(v,1)}}function D1(i,e){let t=i.state.doc.lineAt(e);return i.bidiSpans(t)[ts.find(i.bidiSpans(t),e-t.from,-1,1)].dir}const Io="￿";class KN{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(Pe.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Io}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let a=this.text.length;this.readNode(r);let o=pt.get(r),c=r.nextSibling;if(c==t){o!=null&&o.breakAfter&&!c&&n!=this.view.contentDOM&&this.lineBreak();break}let h=pt.get(c);(o&&h?o.breakAfter:(o?o.breakAfter:zf(r))||zf(c)&&(r.nodeName!="BR"||o!=null&&o.isWidget())&&this.text.length>a)&&!WN(c,t)&&this.lineBreak(),r=c}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let a=-1,o=1,c;if(this.lineSeparator?(a=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(c=r.exec(t))&&(a=c.index,o=c[0].length),this.append(t.slice(n,a<0?t.length:a)),a<0)break;if(this.lineBreak(),o>1)for(let h of this.points)h.node==e&&h.pos>this.text.length&&(h.pos-=o-1);n=a+o}}readNode(e){let t=pt.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let r=n.iter();!r.next().done;)r.lineBreak?this.lineBreak():this.append(r.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(XN(e,n.node,n.offset)?t:0))}}function XN(i,e,t){for(;;){if(!e||t<rs(e))return!1;if(e==i)return!0;t=ar(e)+1,e=e.parentNode}}function WN(i,e){let t;for(;!(i==e||!i);i=i.nextSibling){let n=pt.get(i);if(!(n!=null&&n.isWidget()))return!1;n&&(t||(t=[])).push(n)}if(t)for(let n of t){let r=n.overrideDOMText;if(r!=null&&r.length)return!1}return!0}class N1{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class $N{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:a,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=sC(e.docView.tile,t,n,0))){let c=a||o?[]:JN(e),h=new KN(c,e);h.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=h.text,this.newSel=e3(c,this.bounds.from)}else{let c=e.observer.selectionRange,h=a&&a.node==c.focusNode&&a.offset==c.focusOffset||!ug(e.contentDOM,c.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(c.focusNode,c.focusOffset),d=o&&o.node==c.anchorNode&&o.offset==c.anchorOffset||!ug(e.contentDOM,c.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(c.anchorNode,c.anchorOffset),p=e.viewport;if((ae.ios||ae.chrome)&&e.state.selection.main.empty&&h!=d&&(p.from>0||p.to<e.state.doc.length)){let y=Math.min(h,d),b=Math.max(h,d),v=p.from-y,w=p.to-b;(v==0||v==1||y==0)&&(w==0||w==-1||b==e.state.doc.length)&&(h=0,d=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(ee.range(d,h)):this.newSel=ee.single(d,h)}}}function sC(i,e,t,n){if(i.isComposite()){let r=-1,a=-1,o=-1,c=-1;for(let h=0,d=n,p=n;h<i.children.length;h++){let y=i.children[h],b=d+y.length;if(d<e&&b>t)return sC(y,e,t,d);if(b>=e&&r==-1&&(r=h,a=d),d>t&&y.dom.parentNode==i.dom){o=h,c=p;break}p=b,d=b+y.breakAfter}return{from:a,to:c<0?n+i.length:c,startDOM:(r?i.children[r-1].dom.nextSibling:null)||i.dom.firstChild,endDOM:o<i.children.length&&o>=0?i.children[o].dom:null}}else return i.isText()?{from:n,to:n+i.length,startDOM:i.dom,endDOM:i.dom.nextSibling}:null}function rC(i,e){let t,{newSel:n}=e,r=i.state.selection.main,a=i.inputState.lastKeyTime>Date.now()-100?i.inputState.lastKeyCode:-1;if(e.bounds){let{from:o,to:c}=e.bounds,h=r.from,d=null;(a===8||ae.android&&e.text.length<c-o)&&(h=r.to,d="end");let p=lC(i.state.doc.sliceString(o,c,Io),e.text,h-o,d);p&&(ae.chrome&&a==13&&p.toB==p.from+2&&e.text.slice(p.from,p.toB)==Io+Io&&p.toB--,t={from:o+p.from,to:o+p.toA,insert:He.of(e.text.slice(p.from,p.toB).split(Io))})}else n&&(!i.hasFocus&&i.state.facet(Zi)||n.main.eq(r))&&(n=null);if(!t&&!n)return!1;if(!t&&e.typeOver&&!r.empty&&n&&n.main.empty?t={from:r.from,to:r.to,insert:i.state.doc.slice(r.from,r.to)}:(ae.mac||ae.android)&&t&&t.from==t.to&&t.from==r.head-1&&/^\. ?$/.test(t.insert.toString())&&i.contentDOM.getAttribute("autocorrect")=="off"?(n&&t.insert.length==2&&(n=ee.single(n.main.anchor-1,n.main.head-1)),t={from:t.from,to:t.to,insert:He.of([t.insert.toString().replace("."," ")])}):t&&t.from>=r.from&&t.to<=r.to&&(t.from!=r.from||t.to!=r.to)&&r.to-r.from-(t.to-t.from)<=4?t={from:r.from,to:r.to,insert:i.state.doc.slice(r.from,t.from).append(t.insert).append(i.state.doc.slice(t.to,r.to))}:i.state.doc.lineAt(r.from).to<r.to&&i.docView.lineHasWidget(r.to)&&i.inputState.insertingTextAt>Date.now()-50?t={from:r.from,to:r.to,insert:i.state.toText(i.inputState.insertingText)}:ae.chrome&&t&&t.from==t.to&&t.from==r.head&&t.insert.toString()==`
174
- `&&i.lineWrapping&&(n&&(n=ee.single(n.main.anchor-1,n.main.head-1)),t={from:r.from,to:r.to,insert:He.of([" "])}),t)return c0(i,t,n,a);if(n&&!n.main.eq(r)){let o=!1,c="select";return i.inputState.lastSelectionTime>Date.now()-50&&(i.inputState.lastSelectionOrigin=="select"&&(o=!0),c=i.inputState.lastSelectionOrigin,c=="select.pointer"&&(n=nC(i.state.facet(Au).map(h=>h(i)),n))),i.dispatch({selection:n,scrollIntoView:o,userEvent:c}),!0}else return!1}function c0(i,e,t,n=-1){if(ae.ios&&i.inputState.flushIOSKey(e))return!0;let r=i.state.selection.main;if(ae.android&&(e.to==r.to&&(e.from==r.from||e.from==r.from-1&&i.state.sliceDoc(e.from,r.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&Zl(i.contentDOM,"Enter",13)||(e.from==r.from-1&&e.to==r.to&&e.insert.length==0||n==8&&e.insert.length<e.to-e.from&&e.to>r.head)&&Zl(i.contentDOM,"Backspace",8)||e.from==r.from&&e.to==r.to+1&&e.insert.length==0&&Zl(i.contentDOM,"Delete",46)))return!0;let a=e.insert.toString();i.inputState.composing>=0&&i.inputState.composing++;let o,c=()=>o||(o=ZN(i,e,t));return i.state.facet(Ik).some(h=>h(i,e.from,e.to,a,c))||i.dispatch(c()),!0}function ZN(i,e,t){let n,r=i.state,a=r.selection.main,o=-1;if(e.from==e.to&&e.from<a.from||e.from>a.to){let h=e.from<a.from?-1:1,d=h<0?a.from:a.to,p=Wo(r.facet(Au).map(y=>y(i)),d,h);e.from==p&&(o=p)}if(o>-1)n={changes:e,selection:ee.cursor(e.from+e.insert.length,-1)};else if(e.from>=a.from&&e.to<=a.to&&e.to-e.from>=(a.to-a.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&i.inputState.composing<0){let h=a.from<e.from?r.sliceDoc(a.from,e.from):"",d=a.to>e.to?r.sliceDoc(e.to,a.to):"";n=r.replaceSelection(i.state.toText(h+e.insert.sliceString(0,void 0,i.state.lineBreak)+d))}else{let h=r.changes(e),d=t&&t.main.to<=h.newLength?t.main:void 0;if(r.selection.ranges.length>1&&(i.inputState.composing>=0||i.inputState.compositionPendingChange)&&e.to<=a.to+10&&e.to>=a.to-10){let p=i.state.sliceDoc(e.from,e.to),y,b=t&&tC(i,t.main.head);if(b){let w=e.insert.length-(e.to-e.from);y={from:b.from,to:b.to-w}}else y=i.state.doc.lineAt(a.head);let v=a.to-e.to;n=r.changeByRange(w=>{if(w.from==a.from&&w.to==a.to)return{changes:h,range:d||w.map(h)};let k=w.to-v,A=k-p.length;if(i.state.sliceDoc(A,k)!=p||k>=y.from&&A<=y.to)return{range:w};let O=r.changes({from:A,to:k,insert:e.insert}),D=w.to-a.to;return{changes:O,range:d?ee.range(Math.max(0,d.anchor+D),Math.max(0,d.head+D)):w.map(O)}})}else n={changes:h,selection:d&&r.selection.replaceRange(d)}}let c="input.type";return(i.composing||i.inputState.compositionPendingChange&&i.inputState.compositionEndedAt>Date.now()-50)&&(i.inputState.compositionPendingChange=!1,c+=".compose",i.inputState.compositionFirstChange&&(c+=".start",i.inputState.compositionFirstChange=!1)),r.update(n,{userEvent:c,scrollIntoView:!0})}function lC(i,e,t,n){let r=Math.min(i.length,e.length),a=0;for(;a<r&&i.charCodeAt(a)==e.charCodeAt(a);)a++;if(a==r&&i.length==e.length)return null;let o=i.length,c=e.length;for(;o>0&&c>0&&i.charCodeAt(o-1)==e.charCodeAt(c-1);)o--,c--;if(n=="end"){let h=Math.max(0,a-Math.min(o,c));t-=o+h-a}if(o<a&&i.length<e.length){let h=t<=a&&t>=o?a-t:0;a-=h,c=a+(c-o),o=a}else if(c<a){let h=t<=a&&t>=c?a-t:0;a-=h,o=a+(o-c),c=a}return{from:a,toA:o,toB:c}}function JN(i){let e=[];if(i.root.activeElement!=i.contentDOM)return e;let{anchorNode:t,anchorOffset:n,focusNode:r,focusOffset:a}=i.observer.selectionRange;return t&&(e.push(new N1(t,n)),(r!=t||a!=n)&&e.push(new N1(r,a))),e}function e3(i,e){if(i.length==0)return null;let t=i[0].pos,n=i.length==2?i[1].pos:t;return t>-1&&n>-1?ee.single(t+e,n+e):null}class t3{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ae.safari&&e.contentDOM.addEventListener("input",()=>null),ae.gecko&&g3(e.contentDOM.ownerDocument)}handleEvent(e){!u3(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let r of n.observers)r(this.view,t);for(let r of n.handlers){if(t.defaultPrevented)break;if(r(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=n3(e),n=this.handlers,r=this.view.contentDOM;for(let a in t)if(a!="scroll"){let o=!t[a].handlers.length,c=n[a];c&&o!=!c.handlers.length&&(r.removeEventListener(a,this.handleEvent),c=null),c||r.addEventListener(a,this.handleEvent,{passive:o})}for(let a in n)a!="scroll"&&!t[a]&&r.removeEventListener(a,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&oC.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),ae.android&&ae.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return ae.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=aC.find(n=>n.keyCode==e.keyCode))&&!e.ctrlKey||i3.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,Zl(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:ae.safari&&!ae.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function B1(i,e){return(t,n)=>{try{return e.call(i,n,t)}catch(r){En(t.state,r)}}}function n3(i){let e=Object.create(null);function t(n){return e[n]||(e[n]={observers:[],handlers:[]})}for(let n of i){let r=n.spec,a=r&&r.plugin.domEventHandlers,o=r&&r.plugin.domEventObservers;if(a)for(let c in a){let h=a[c];h&&t(c).handlers.push(B1(n.value,h))}if(o)for(let c in o){let h=o[c];h&&t(c).observers.push(B1(n.value,h))}}for(let n in ai)t(n).handlers.push(ai[n]);for(let n in Fn)t(n).observers.push(Fn[n]);return e}const aC=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],i3="dthko",oC=[16,17,18,20,91,92,224,225],Jc=6;function ef(i){return Math.max(0,i)*.7+8}function s3(i,e){return Math.max(Math.abs(i.clientX-e.clientX),Math.abs(i.clientY-e.clientY))}class r3{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=oN(e.contentDOM),this.atoms=e.state.facet(Au).map(o=>o(e));let a=e.contentDOM.ownerDocument;a.addEventListener("mousemove",this.move=this.move.bind(this)),a.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Pe.allowMultipleSelections)&&l3(e,t),this.dragging=o3(e,t)&&fC(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&s3(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,a=0,o=this.view.win.innerWidth,c=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:a,bottom:c}=this.scrollParents.y.getBoundingClientRect());let h=u0(this.view);e.clientX-h.left<=r+Jc?t=-ef(r-e.clientX):e.clientX+h.right>=o-Jc&&(t=ef(e.clientX-o)),e.clientY-h.top<=a+Jc?n=-ef(a-e.clientY):e.clientY+h.bottom>=c-Jc&&(n=ef(e.clientY-c)),this.setScrollSpeed(t,n)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,n=nC(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function l3(i,e){let t=i.state.facet(Pk);return t.length?t[0](e):ae.mac?e.metaKey:e.ctrlKey}function a3(i,e){let t=i.state.facet(qk);return t.length?t[0](e):ae.mac?!e.altKey:!e.ctrlKey}function o3(i,e){let{main:t}=i.state.selection;if(t.empty)return!1;let n=ru(i.root);if(!n||n.rangeCount==0)return!0;let r=n.getRangeAt(0).getClientRects();for(let a=0;a<r.length;a++){let o=r[a];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function u3(i,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,n;t!=i.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(n=pt.get(t))&&n.isWidget()&&!n.isHidden&&n.widget.ignoreEvent(e))return!1;return!0}const ai=Object.create(null),Fn=Object.create(null),uC=ae.ie&&ae.ie_version<15||ae.ios&&ae.webkit_version<604;function c3(i){let e=i.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{i.focus(),t.remove(),cC(i,t.value)},50)}function hh(i,e,t){for(let n of i.facet(e))t=n(t,i);return t}function cC(i,e){e=hh(i.state,r0,e);let{state:t}=i,n,r=1,a=t.toText(e),o=a.lines==t.selection.ranges.length;if(yg!=null&&t.selection.ranges.every(h=>h.empty)&&yg==a.toString()){let h=-1;n=t.changeByRange(d=>{let p=t.doc.lineAt(d.from);if(p.from==h)return{range:d};h=p.from;let y=t.toText((o?a.line(r++).text:e)+t.lineBreak);return{changes:{from:p.from,insert:y},range:ee.cursor(d.from+y.length)}})}else o?n=t.changeByRange(h=>{let d=a.line(r++);return{changes:{from:h.from,to:h.to,insert:d.text},range:ee.cursor(h.from+d.length)}}):n=t.replaceSelection(a);i.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}Fn.scroll=i=>{i.inputState.lastScrollTop=i.scrollDOM.scrollTop,i.inputState.lastScrollLeft=i.scrollDOM.scrollLeft};ai.keydown=(i,e)=>(i.inputState.setSelectionOrigin("select"),e.keyCode==27&&i.inputState.tabFocusMode!=0&&(i.inputState.tabFocusMode=Date.now()+2e3),!1);Fn.touchstart=(i,e)=>{i.inputState.lastTouchTime=Date.now(),i.inputState.setSelectionOrigin("select.pointer")};Fn.touchmove=i=>{i.inputState.setSelectionOrigin("select.pointer")};ai.mousedown=(i,e)=>{if(i.observer.flush(),i.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let n of i.state.facet(Vk))if(t=n(i,e),t)break;if(!t&&e.button==0&&(t=h3(i,e)),t){let n=!i.hasFocus;i.inputState.startMouseSelection(new r3(i,e,t,n)),n&&i.observer.ignore(()=>{Dk(i.contentDOM);let a=i.root.activeElement;a&&!a.contains(i.contentDOM)&&a.blur()});let r=i.inputState.mouseSelection;if(r)return r.start(e),r.dragging===!1}else i.inputState.setSelectionOrigin("select.pointer");return!1};function L1(i,e,t,n){if(n==1)return ee.cursor(e,t);if(n==2)return QN(i.state,e,t);{let r=i.docView.lineAt(e,t),a=i.state.doc.lineAt(r?r.posAtEnd:e),o=r?r.posAtStart:a.from,c=r?r.posAtEnd:a.to;return c<i.state.doc.length&&c==a.to&&c++,ee.range(o,c)}}const f3=ae.ie&&ae.ie_version<=11;let j1=null,z1=0,_1=0;function fC(i){if(!f3)return i.detail;let e=j1,t=_1;return j1=i,_1=Date.now(),z1=!e||t>Date.now()-400&&Math.abs(e.clientX-i.clientX)<2&&Math.abs(e.clientY-i.clientY)<2?(z1+1)%3:1}function h3(i,e){let t=i.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),n=fC(e),r=i.state.selection;return{update(a){a.docChanged&&(t.pos=a.changes.mapPos(t.pos),r=r.map(a.changes))},get(a,o,c){let h=i.posAndSideAtCoords({x:a.clientX,y:a.clientY},!1),d,p=L1(i,h.pos,h.assoc,n);if(t.pos!=h.pos&&!o){let y=L1(i,t.pos,t.assoc,n),b=Math.min(y.from,p.from),v=Math.max(y.to,p.to);p=b<p.from?ee.range(b,v):ee.range(v,b)}return o?r.replaceRange(r.main.extend(p.from,p.to)):c&&n==1&&r.ranges.length>1&&(d=d3(r,h.pos))?d:c?r.addRange(p):ee.create([p])}}}function d3(i,e){for(let t=0;t<i.ranges.length;t++){let{from:n,to:r}=i.ranges[t];if(n<=e&&r>=e)return ee.create(i.ranges.slice(0,t).concat(i.ranges.slice(t+1)),i.mainIndex==t?0:i.mainIndex-(i.mainIndex>t?1:0))}return null}ai.dragstart=(i,e)=>{let{selection:{main:t}}=i.state;if(e.target.draggable){let r=i.docView.tile.nearest(e.target);if(r&&r.isWidget()){let a=r.posAtStart,o=a+r.length;(a>=t.to||o<=t.from)&&(t=ee.range(a,o))}}let{inputState:n}=i;return n.mouseSelection&&(n.mouseSelection.dragging=!0),n.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",hh(i.state,l0,i.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};ai.dragend=i=>(i.inputState.draggedContent=null,!1);function H1(i,e,t,n){if(t=hh(i.state,r0,t),!t)return;let r=i.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:a}=i.inputState,o=n&&a&&a3(i,e)?{from:a.from,to:a.to}:null,c={from:r,insert:t},h=i.state.changes(o?[o,c]:c);i.focus(),i.dispatch({changes:h,selection:{anchor:h.mapPos(r,-1),head:h.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"}),i.inputState.draggedContent=null}ai.drop=(i,e)=>{if(!e.dataTransfer)return!1;if(i.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let n=Array(t.length),r=0,a=()=>{++r==t.length&&H1(i,e,n.filter(o=>o!=null).join(i.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let c=new FileReader;c.onerror=a,c.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(c.result)||(n[o]=c.result),a()},c.readAsText(t[o])}return!0}else{let n=e.dataTransfer.getData("Text");if(n)return H1(i,e,n,!0),!0}return!1};ai.paste=(i,e)=>{if(i.state.readOnly)return!0;i.observer.flush();let t=uC?null:e.clipboardData;return t?(cC(i,t.getData("text/plain")||t.getData("text/uri-list")),!0):(c3(i),!1)};function m3(i,e){let t=i.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.value=e,n.focus(),n.selectionEnd=e.length,n.selectionStart=0,setTimeout(()=>{n.remove(),i.focus()},50)}function p3(i){let e=[],t=[],n=!1;for(let r of i.selection.ranges)r.empty||(e.push(i.sliceDoc(r.from,r.to)),t.push(r));if(!e.length){let r=-1;for(let{from:a}of i.selection.ranges){let o=i.doc.lineAt(a);o.number>r&&(e.push(o.text),t.push({from:o.from,to:Math.min(i.doc.length,o.to+1)})),r=o.number}n=!0}return{text:hh(i,l0,e.join(i.lineBreak)),ranges:t,linewise:n}}let yg=null;ai.copy=ai.cut=(i,e)=>{let{text:t,ranges:n,linewise:r}=p3(i.state);if(!t&&!r)return!1;yg=r?t:null,e.type=="cut"&&!i.state.readOnly&&i.dispatch({changes:n,scrollIntoView:!0,userEvent:"delete.cut"});let a=uC?null:e.clipboardData;return a?(a.clearData(),a.setData("text/plain",t),!0):(m3(i,t),!1)};const hC=us.define();function dC(i,e){let t=[];for(let n of i.facet(Gk)){let r=n(i,e);r&&t.push(r)}return t.length?i.update({effects:t,annotations:hC.of(!0)}):null}function mC(i){setTimeout(()=>{let e=i.hasFocus;if(e!=i.inputState.notifiedFocused){let t=dC(i.state,e);t?i.dispatch(t):i.update([])}},10)}Fn.focus=i=>{i.inputState.lastFocusTime=Date.now(),!i.scrollDOM.scrollTop&&(i.inputState.lastScrollTop||i.inputState.lastScrollLeft)&&(i.scrollDOM.scrollTop=i.inputState.lastScrollTop,i.scrollDOM.scrollLeft=i.inputState.lastScrollLeft),mC(i)};Fn.blur=i=>{i.observer.clearSelectionRange(),mC(i)};Fn.compositionstart=Fn.compositionupdate=i=>{i.observer.editContext||(i.inputState.compositionFirstChange==null&&(i.inputState.compositionFirstChange=!0),i.inputState.composing<0&&(i.inputState.composing=0))};Fn.compositionend=i=>{i.observer.editContext||(i.inputState.composing=-1,i.inputState.compositionEndedAt=Date.now(),i.inputState.compositionPendingKey=!0,i.inputState.compositionPendingChange=i.observer.pendingRecords().length>0,i.inputState.compositionFirstChange=null,ae.chrome&&ae.android?i.observer.flushSoon():i.inputState.compositionPendingChange?Promise.resolve().then(()=>i.observer.flush()):setTimeout(()=>{i.inputState.composing<0&&i.docView.hasComposition&&i.update([])},50))};Fn.contextmenu=i=>{i.inputState.lastContextMenu=Date.now()};ai.beforeinput=(i,e)=>{var t,n;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(i.inputState.insertingText=e.data,i.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&i.observer.editContext){let a=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(a&&o.length){let c=o[0],h=i.posAtDOM(c.startContainer,c.startOffset),d=i.posAtDOM(c.endContainer,c.endOffset);return c0(i,{from:h,to:d,insert:i.state.toText(a)},null),!0}}let r;if(ae.chrome&&ae.android&&(r=aC.find(a=>a.inputType==e.inputType))&&(i.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let a=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>a+10&&i.hasFocus&&(i.contentDOM.blur(),i.focus())},100)}return ae.ios&&e.inputType=="deleteContentForward"&&i.observer.flushSoon(),ae.safari&&e.inputType=="insertText"&&i.inputState.composing>=0&&setTimeout(()=>Fn.compositionend(i,e),20),!1};const U1=new Set;function g3(i){U1.has(i)||(U1.add(i),i.addEventListener("copy",()=>{}),i.addEventListener("cut",()=>{}))}const P1=["pre-wrap","normal","pre-line","break-spaces"];let va=!1;function q1(){va=!1}class y3{constructor(e){this.lineWrapping=e,this.doc=He.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return P1.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,n,r,a,o){let c=P1.indexOf(e)>-1,h=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=c||Math.abs(n-this.charWidth)>.1;if(this.lineWrapping=c,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=a,h){this.heightSamples={};for(let d=0;d<o.length;d++){let p=o[d];p<0?d++:this.heightSamples[Math.floor(p*10)]=!0}}return h}}class b3{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class ni{constructor(e,t,n,r,a){this.from=e,this.length=t,this.top=n,this.height=r,this._content=a}get type(){return typeof this._content=="number"?jt.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof $r?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new ni(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var Je=(function(i){return i[i.ByPos=0]="ByPos",i[i.ByHeight=1]="ByHeight",i[i.ByPosNoHeight=2]="ByPosNoHeight",i})(Je||(Je={}));const kf=.001;class $t{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>kf&&(va=!0),this.height=e)}replace(e,t,n){return $t.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let a=this,o=n.doc;for(let c=r.length-1;c>=0;c--){let{fromA:h,toA:d,fromB:p,toB:y}=r[c],b=a.lineAt(h,Je.ByPosNoHeight,n.setDoc(t),0,0),v=b.to>=d?b:a.lineAt(d,Je.ByPosNoHeight,n,0,0);for(y+=v.to-d,d=v.to;c>0&&b.from<=r[c-1].toA;)h=r[c-1].fromA,p=r[c-1].fromB,c--,h<b.from&&(b=a.lineAt(h,Je.ByPosNoHeight,n,0,0));p+=b.from-h,h=b.from;let w=f0.build(n.setDoc(o),e,p,y);a=qf(a,a.replace(h,d,w))}return a.updateHeight(n,0)}static empty(){return new An(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,n=e.length,r=0,a=0;for(;;)if(t==n)if(r>a*2){let c=e[t-1];c.break?e.splice(--t,1,c.left,null,c.right):e.splice(--t,1,c.left,c.right),n+=1+c.break,r-=c.size}else if(a>r*2){let c=e[n];c.break?e.splice(n,1,c.left,null,c.right):e.splice(n,1,c.left,c.right),n+=2+c.break,a-=c.size}else break;else if(r<a){let c=e[t++];c&&(r+=c.size)}else{let c=e[--n];c&&(a+=c.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,n++),new x3($t.of(e.slice(0,t)),o,$t.of(e.slice(n)))}}function qf(i,e){return i==e?i:(i.constructor!=e.constructor&&(va=!0),e)}$t.prototype.size=1;const v3=Ke.replace({});class pC extends $t{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new ni(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new ni(r,0,n,this.spaceAbove,v3):this.mainBlock(n,r)}lineAt(e,t,n,r,a){let o=this.mainBlock(r,a);return this.spaceAbove?this.blockAt(0,n,r,a).join(o):o}forEachLine(e,t,n,r,a,o){e<=a+this.length&&t>=a&&o(this.lineAt(0,Je.ByPos,n,r,a))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}}class An extends pC{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new ni(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,n){let r=n[0];return n.length==1&&(r instanceof An||r instanceof Nt&&r.flags&4)&&Math.abs(this.length-r.length)<10?(r instanceof Nt?r=new An(r.length,this.height,this.spaceAbove):r.height=this.height,this.outdated||(r.outdated=!1),r):$t.of(n)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Nt extends $t{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,a=r-n+1,o,c=0;if(e.lineWrapping){let h=Math.min(this.height,e.lineHeight*a);o=h/a,this.length>a+1&&(c=(this.height-h)/(this.length-a-1))}else o=this.height/a;return{firstLine:n,lastLine:r,perLine:o,perChar:c}}blockAt(e,t,n,r){let{firstLine:a,lastLine:o,perLine:c,perChar:h}=this.heightMetrics(t,r);if(t.lineWrapping){let d=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),p=t.doc.lineAt(d),y=c+p.length*h,b=Math.max(n,e-y/2);return new ni(p.from,p.length,b,y,0)}else{let d=Math.max(0,Math.min(o-a,Math.floor((e-n)/c))),{from:p,length:y}=t.doc.line(a+d);return new ni(p,y,n+c*d,c,0)}}lineAt(e,t,n,r,a){if(t==Je.ByHeight)return this.blockAt(e,n,r,a);if(t==Je.ByPosNoHeight){let{from:v,to:w}=n.doc.lineAt(e);return new ni(v,w-v,0,0,0)}let{firstLine:o,perLine:c,perChar:h}=this.heightMetrics(n,a),d=n.doc.lineAt(e),p=c+d.length*h,y=d.number-o,b=r+c*y+h*(d.from-a-y);return new ni(d.from,d.length,Math.max(r,Math.min(b,r+this.height-p)),p,0)}forEachLine(e,t,n,r,a,o){e=Math.max(e,a),t=Math.min(t,a+this.length);let{firstLine:c,perLine:h,perChar:d}=this.heightMetrics(n,a);for(let p=e,y=r;p<=t;){let b=n.doc.lineAt(p);if(p==e){let w=b.number-c;y+=h*w+d*(e-a-w)}let v=h+d*b.length;o(new ni(b.from,b.length,y,v,0)),y+=v,p=b.to+1}}replace(e,t,n){let r=this.length-t;if(r>0){let a=n[n.length-1];a instanceof Nt?n[n.length-1]=new Nt(a.length+r):n.push(null,new Nt(r-1))}if(e>0){let a=n[0];a instanceof Nt?n[0]=new Nt(e+a.length):n.unshift(new Nt(e-1),null)}return $t.of(n)}decomposeLeft(e,t){t.push(new Nt(e-1),null)}decomposeRight(e,t){t.push(null,new Nt(this.length-e-1))}updateHeight(e,t=0,n=!1,r){let a=t+this.length;if(r&&r.from<=t+this.length&&r.more){let o=[],c=Math.max(t,r.from),h=-1;for(r.from>t&&o.push(new Nt(r.from-t-1).updateHeight(e,t));c<=a&&r.more;){let p=e.doc.lineAt(c).length;o.length&&o.push(null);let y=r.heights[r.index++],b=0;y<0&&(b=-y,y=r.heights[r.index++]),h==-1?h=y:Math.abs(y-h)>=kf&&(h=-2);let v=new An(p,y,b);v.outdated=!1,o.push(v),c+=p+1}c<=a&&o.push(null,new Nt(a-c).updateHeight(e,c));let d=$t.of(o);return(h<0||Math.abs(d.height-this.height)>=kf||Math.abs(h-this.heightMetrics(e,t).perLine)>=kf)&&(va=!0),qf(this,d)}else(n||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class x3 extends $t{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,r){let a=n+this.left.height;return e<a?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,a,r+this.left.length+this.break)}lineAt(e,t,n,r,a){let o=r+this.left.height,c=a+this.left.length+this.break,h=t==Je.ByHeight?e<o:e<c,d=h?this.left.lineAt(e,t,n,r,a):this.right.lineAt(e,t,n,o,c);if(this.break||(h?d.to<c:d.from>c))return d;let p=t==Je.ByPosNoHeight?Je.ByPosNoHeight:Je.ByPos;return h?d.join(this.right.lineAt(c,p,n,o,c)):this.left.lineAt(c,p,n,r,a).join(d)}forEachLine(e,t,n,r,a,o){let c=r+this.left.height,h=a+this.left.length+this.break;if(this.break)e<h&&this.left.forEachLine(e,t,n,r,a,o),t>=h&&this.right.forEachLine(e,t,n,c,h,o);else{let d=this.lineAt(h,Je.ByPos,n,r,a);e<d.from&&this.left.forEachLine(e,d.from-1,n,r,a,o),d.to>=e&&d.from<=t&&o(d),t>d.to&&this.right.forEachLine(d.to+1,t,n,c,h,o)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let a=[];e>0&&this.decomposeLeft(e,a);let o=a.length;for(let c of n)a.push(c);if(e>0&&V1(a,o-1),t<this.length){let c=a.length;this.decomposeRight(t,a),V1(a,c)}return $t.of(a)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?$t.of(this.break?[e,null,t]:[e,t]):(this.left=qf(this.left,e),this.right=qf(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,r){let{left:a,right:o}=this,c=t+a.length+this.break,h=null;return r&&r.from<=t+a.length&&r.more?h=a=a.updateHeight(e,t,n,r):a.updateHeight(e,t,n),r&&r.from<=c+o.length&&r.more?h=o=o.updateHeight(e,c,n,r):o.updateHeight(e,c,n),h?this.balanced(a,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function V1(i,e){let t,n;i[e]==null&&(t=i[e-1])instanceof Nt&&(n=i[e+1])instanceof Nt&&i.splice(e-1,3,new Nt(t.length+1+n.length))}const S3=5;class f0{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let n=Math.min(t,this.lineEnd),r=this.nodes[this.nodes.length-1];r instanceof An?r.length+=n-this.pos:(n>this.pos||!this.isCovered)&&this.nodes.push(new An(n-this.pos,-1,0)),this.writtenTo=n,t>n&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,a=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let o=t-e;n.block?this.addBlock(new pC(o,r,n)):(o||a||r>=S3)&&this.addLineDeco(r,a,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new An(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new Nt(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof An)return e;let t=new An(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof An)&&!this.isCovered?this.nodes.push(new An(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let r of this.nodes)r instanceof An&&r.updateHeight(this.oracle,n),n+=r?r.length:1;return this.nodes}static build(e,t,n,r){let a=new f0(n,e);return Be.spans(t,n,r,a,0),a.finish(n)}}function w3(i,e,t){let n=new k3;return Be.compare(i,e,t,n,0),n.changes}class k3{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&$l(e,t,this.changes,5)}}function C3(i,e){let t=i.getBoundingClientRect(),n=i.ownerDocument,r=n.defaultView||window,a=Math.max(0,t.left),o=Math.min(r.innerWidth,t.right),c=Math.max(0,t.top),h=Math.min(r.innerHeight,t.bottom);for(let d=i.parentNode;d&&d!=n.body;)if(d.nodeType==1){let p=d,y=window.getComputedStyle(p);if((p.scrollHeight>p.clientHeight||p.scrollWidth>p.clientWidth)&&y.overflow!="visible"){let b=p.getBoundingClientRect();a=Math.max(a,b.left),o=Math.min(o,b.right),c=Math.max(c,b.top),h=Math.min(d==i.parentNode?r.innerHeight:h,b.bottom)}d=y.position=="absolute"||y.position=="fixed"?p.offsetParent:p.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:a-t.left,right:Math.max(a,o)-t.left,top:c-(t.top+e),bottom:Math.max(c,h)-(t.top+e)}}function A3(i){let e=i.getBoundingClientRect(),t=i.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function T3(i,e){let t=i.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class ap{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],a=t[n];if(r.from!=a.from||r.to!=a.to||r.size!=a.size)return!1}return!0}draw(e,t){return Ke.replace({widget:new O3(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class O3 extends Na{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class Q1{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!1,this.scaleX=1,this.scaleY=1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=I1,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=et.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let t=e.facet(a0).some(n=>typeof n!="function"&&n.class=="cm-lineWrapping");this.heightOracle=new y3(t),this.stateDeco=G1(e),this.heightMap=$t.empty().applyChanges(this.stateDeco,He.empty,this.heightOracle.setDoc(e.doc),[new Vn(0,0,0,e.doc.length)]);for(let n=0;n<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());n++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ke.set(this.lineGaps.map(n=>n.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:a,to:o})=>r>=a&&r<=o)){let{from:a,to:o}=this.lineBlockAt(r);e.push(new tf(a,o))}}return this.viewports=e.sort((n,r)=>n.from-r.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?I1:new h0(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Go(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=G1(this.state);let r=e.changedRanges,a=Vn.extendWithRanges(r,w3(n,this.stateDeco,e?e.changes:vt.empty(this.state.doc.length))),o=this.heightMap.height,c=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);q1(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),a),(this.heightMap.height!=o||va)&&(e.flags|=2),c?(this.scrollAnchorPos=e.changes.mapPos(c.from,-1),this.scrollAnchorHeight=c.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let h=a.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<h.from||t.range.head>h.to)||!this.viewportIsAppropriate(h))&&(h=this.getViewport(0,t));let d=h.from!=this.viewport.from||h.to!=this.viewport.to;this.viewport=h,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Yk)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,a=n.whiteSpace;this.defaultTextDirection=n.direction=="rtl"?et.RTL:et.LTR;let o=this.heightOracle.mustRefreshForWrapping(a)||this.mustMeasureContent,c=t.getBoundingClientRect(),h=o||this.mustMeasureContent||this.contentDOMHeight!=c.height;this.contentDOMHeight=c.height,this.mustMeasureContent=!1;let d=0,p=0;if(c.width&&c.height){let{scaleX:V,scaleY:j}=Rk(t,c);(V>.005&&Math.abs(this.scaleX-V)>.005||j>.005&&Math.abs(this.scaleY-j)>.005)&&(this.scaleX=V,this.scaleY=j,d|=16,o=h=!0)}let y=(parseInt(n.paddingTop)||0)*this.scaleY,b=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=y||this.paddingBottom!=b)&&(this.paddingTop=y,this.paddingBottom=b,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(h=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let v=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=v&&(this.scrollAnchorHeight=-1,this.scrollTop=v),this.scrolledToBottom=Nk(e.scrollDOM);let w=(this.printing?T3:C3)(t,this.paddingTop),k=w.top-this.pixelViewport.top,A=w.bottom-this.pixelViewport.bottom;this.pixelViewport=w;let O=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(O!=this.inView&&(this.inView=O,O&&(h=!0)),!this.inView&&!this.scrollTarget&&!A3(e.dom))return 0;let D=c.width;if((this.contentDOMWidth!=D||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=c.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),h){let V=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(V)&&(o=!0),o||r.lineWrapping&&Math.abs(D-this.contentDOMWidth)>r.charWidth){let{lineHeight:j,charWidth:Q,textHeight:I}=e.docView.measureTextSize();o=j>0&&r.refresh(a,j,Q,I,Math.max(5,D/Q),V),o&&(e.docView.minWidth=0,d|=16)}k>0&&A>0?p=Math.max(k,A):k<0&&A<0&&(p=Math.min(k,A)),q1();for(let j of this.viewports){let Q=j.from==this.viewport.from?V:e.docView.measureVisibleLineHeights(j);this.heightMap=(o?$t.empty().applyChanges(this.stateDeco,He.empty,this.heightOracle,[new Vn(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,o,new b3(j.from,Q))}va&&(d|=2)}let B=!this.viewportIsAppropriate(this.viewport,p)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return B&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(p,this.scrollTarget),d|=this.updateForViewport()),(d&2||B)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,a=this.heightOracle,{visibleTop:o,visibleBottom:c}=this,h=new tf(r.lineAt(o-n*1e3,Je.ByHeight,a,0,0).from,r.lineAt(c+(1-n)*1e3,Je.ByHeight,a,0,0).to);if(t){let{head:d}=t.range;if(d<h.from||d>h.to){let p=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),y=r.lineAt(d,Je.ByPos,a,0,0),b;t.y=="center"?b=(y.top+y.bottom)/2-p/2:t.y=="start"||t.y=="nearest"&&d<h.from?b=y.top:b=y.bottom-p,h=new tf(r.lineAt(b-1e3/2,Je.ByHeight,a,0,0).from,r.lineAt(b+p+1e3/2,Je.ByHeight,a,0,0).to)}}return h}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new tf(this.heightMap.lineAt(n,Je.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Je.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Je.ByPos,this.heightOracle,0,0),{bottom:a}=this.heightMap.lineAt(t,Je.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:c}=this;return(e==0||r<=o-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||a>=c+Math.max(10,Math.min(n,250)))&&r>o-2*1e3&&a<c+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new ap(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,a=r>>1,o=r<<1;if(this.defaultTextDirection!=et.LTR&&!n)return[];let c=[],h=(p,y,b,v)=>{if(y-p<a)return;let w=this.state.selection.main,k=[w.from];w.empty||k.push(w.to);for(let O of k)if(O>p&&O<y){h(p,O-10,b,v),h(O+10,y,b,v);return}let A=E3(e,O=>O.from>=b.from&&O.to<=b.to&&Math.abs(O.from-p)<a&&Math.abs(O.to-y)<a&&!k.some(D=>O.from<D&&O.to>D));if(!A){if(y<b.to&&t&&n&&t.visibleRanges.some(B=>B.from<=y&&B.to>=y)){let B=t.moveToLineBoundary(ee.cursor(y),!1,!0).head;B>p&&(y=B)}let O=this.gapSize(b,p,y,v),D=n||O<2e6?O:2e6;A=new ap(p,y,O,D)}c.push(A)},d=p=>{if(p.length<o||p.type!=jt.Text)return;let y=M3(p.from,p.to,this.stateDeco);if(y.total<o)return;let b=this.scrollTarget?this.scrollTarget.range.head:null,v,w;if(n){let k=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,A,O;if(b!=null){let D=sf(y,b),B=((this.visibleBottom-this.visibleTop)/2+k)/p.height;A=D-B,O=D+B}else A=(this.visibleTop-p.top-k)/p.height,O=(this.visibleBottom-p.top+k)/p.height;v=nf(y,A),w=nf(y,O)}else{let k=y.total*this.heightOracle.charWidth,A=r*this.heightOracle.charWidth,O=0;if(k>2e6)for(let Q of e)Q.from>=p.from&&Q.from<p.to&&Q.size!=Q.displaySize&&Q.from*this.heightOracle.charWidth+O<this.pixelViewport.left&&(O=Q.size-Q.displaySize);let D=this.pixelViewport.left+O,B=this.pixelViewport.right+O,V,j;if(b!=null){let Q=sf(y,b),I=((B-D)/2+A)/k;V=Q-I,j=Q+I}else V=(D-A)/k,j=(B+A)/k;v=nf(y,V),w=nf(y,j)}v>p.from&&h(p.from,v,p,y),w<p.to&&h(w,p.to,p,y)};for(let p of this.viewportLines)Array.isArray(p.type)?p.type.forEach(d):d(p);return c}gapSize(e,t,n,r){let a=sf(r,n)-sf(r,t);return this.heightOracle.lineWrapping?e.height*a:r.total*this.heightOracle.charWidth*a}updateLineGaps(e){ap.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Ke.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];Be.spans(t,this.viewport.from,this.viewport.to,{span(a,o){n.push({from:a,to:o})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let a=0;a<n.length&&!(r&8);a++){let o=this.visibleRanges[a],c=n[a];(o.from!=c.from||o.to!=c.to)&&(r|=4,e&&e.mapPos(o.from,-1)==c.from&&e.mapPos(o.to,1)==c.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Go(this.heightMap.lineAt(e,Je.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Go(this.heightMap.lineAt(this.scaler.fromDOM(e),Je.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Go(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}let tf=class{constructor(e,t){this.from=e,this.to=t}};function M3(i,e,t){let n=[],r=i,a=0;return Be.spans(t,i,e,{span(){},point(o,c){o>r&&(n.push({from:r,to:o}),a+=o-r),r=c}},20),r<e&&(n.push({from:r,to:e}),a+=e-r),{total:a,ranges:n}}function nf({total:i,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let n=Math.floor(i*t);for(let r=0;;r++){let{from:a,to:o}=e[r],c=o-a;if(n<=c)return a+n;n-=c}}function sf(i,e){let t=0;for(let{from:n,to:r}of i.ranges){if(e<=r){t+=e-n;break}t+=r-n}return t/i.total}function E3(i,e){for(let t of i)if(e(t))return t}const I1={toDOM(i){return i},fromDOM(i){return i},scale:1,eq(i){return i==this}};function G1(i){let e=i.facet(uh).filter(n=>typeof n!="function"),t=i.facet(o0).filter(n=>typeof n!="function");return t.length&&e.push(Be.join(t)),e}class h0{constructor(e,t,n){let r=0,a=0,o=0;this.viewports=n.map(({from:c,to:h})=>{let d=t.lineAt(c,Je.ByPos,e,0,0).top,p=t.lineAt(h,Je.ByPos,e,0,0).bottom;return r+=p-d,{from:c,to:h,top:d,bottom:p,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let c of this.viewports)c.domTop=o+(c.top-a)*this.scale,o=c.domBottom=c.domTop+(c.bottom-c.top),a=c.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let a=t<this.viewports.length?this.viewports[t]:null;if(!a||e<a.top)return r+(e-n)*this.scale;if(e<=a.bottom)return a.domTop+(e-a.top);n=a.bottom,r=a.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let a=t<this.viewports.length?this.viewports[t]:null;if(!a||e<a.domTop)return n+(e-r)/this.scale;if(e<=a.domBottom)return a.top+(e-a.domTop);n=a.bottom,r=a.domBottom}}eq(e){return e instanceof h0?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,n)=>t.from==e.viewports[n].from&&t.to==e.viewports[n].to):!1}}function Go(i,e){if(e.scale==1)return i;let t=e.toDOM(i.top),n=e.toDOM(i.bottom);return new ni(i.from,i.length,t,n-t,Array.isArray(i._content)?i._content.map(r=>Go(r,e)):i._content)}const rf=he.define({combine:i=>i.join(" ")}),bg=he.define({combine:i=>i.indexOf(!0)>-1}),vg=rr.newName(),gC=rr.newName(),yC=rr.newName(),bC={"&light":"."+gC,"&dark":"."+yC};function xg(i,e,t){return new rr(e,{finish(n){return/&/.test(n)?n.replace(/&\w*/,r=>{if(r=="&")return i;if(!t||!t[r])throw new RangeError(`Unsupported selector: ${r}`);return t[r]}):i+" "+n}})}const R3=xg("."+vg,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},bC),D3={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},op=ae.ie&&ae.ie_version<=11;class N3{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new uN,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let n of t)this.queue.push(n);(ae.ie&&ae.ie_version<=11||ae.ios&&e.composing)&&t.some(n=>n.type=="childList"&&n.removedNodes.length||n.type=="characterData"&&n.oldValue.length>n.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&ae.android&&e.constructor.EDIT_CONTEXT!==!1&&!(ae.chrome&&ae.chrome_version<126)&&(this.editContext=new L3(e),e.state.facet(Zi)&&(e.contentDOM.editContext=this.editContext.editContext)),op&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(Zi)?n.root.activeElement!=this.dom:!Sf(this.dom,r))return;let a=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);if(a&&a.isWidget()&&a.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(ae.ie&&ae.ie_version<=11||ae.android&&ae.chrome)&&!n.state.selection.main.empty&&r.focusNode&&Xo(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=ru(e.root);if(!t)return!1;let n=ae.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&B3(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=Sf(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&fN(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(n.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let n of this.scrollTargets)n.removeEventListener("scroll",this.onScroll);for(let n of this.scrollTargets=t)n.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,D3),op&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),op&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var n;if(!this.delayedAndroidKey){let r=()=>{let a=this.delayedAndroidKey;a&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=a.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&a.force&&Zl(this.dom,a.key,a.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(r)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((n=this.delayedAndroidKey)===null||n===void 0)&&n.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let a of e){let o=this.readMutation(a);o&&(o.typeOver&&(r=!0),t==-1?{from:t,to:n}=o:(t=Math.min(o.from,t),n=Math.max(o.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&Sf(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let a=new $N(this.view,e,t,n);return this.view.docView.domChanged={newSel:a.newSel?a.newSel.main:null},a}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,r=rC(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let n=F1(t,e.previousSibling||e.target.previousSibling,-1),r=F1(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(Zi)!=e.state.facet(Zi)&&(e.view.contentDOM.editContext=e.state.facet(Zi)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(n=this.resizeScroll)===null||n===void 0||n.disconnect();for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function F1(i,e,t){for(;e;){let n=pt.get(e);if(n&&n.parent==i)return n;let r=e.parentNode;e=r!=i.dom?r:t>0?e.nextSibling:e.previousSibling}return null}function Y1(i,e){let t=e.startContainer,n=e.startOffset,r=e.endContainer,a=e.endOffset,o=i.docView.domAtPos(i.state.selection.main.anchor,1);return Xo(o.node,o.offset,r,a)&&([t,n,r,a]=[r,a,t,n]),{anchorNode:t,anchorOffset:n,focusNode:r,focusOffset:a}}function B3(i,e){if(e.getComposedRanges){let r=e.getComposedRanges(i.root)[0];if(r)return Y1(i,r)}let t=null;function n(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return i.contentDOM.addEventListener("beforeinput",n,!0),i.dom.ownerDocument.execCommand("indent"),i.contentDOM.removeEventListener("beforeinput",n,!0),t?Y1(i,t):null}class L3{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=n=>{let r=e.state.selection.main,{anchor:a,head:o}=r,c=this.toEditorPos(n.updateRangeStart),h=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:c,drifted:!1});let d=h-c>n.text.length;c==this.from&&a<this.from?c=a:h==this.to&&a>this.to&&(h=a);let p=lC(e.state.sliceDoc(c,h),n.text,(d?r.from:r.to)-c,d?"end":null);if(!p){let b=ee.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));b.main.eq(r)||e.dispatch({selection:b,userEvent:"select"});return}let y={from:p.from+c,to:p.toA+c,insert:He.of(n.text.slice(p.from,p.toB).split(`
175
- `))};if((ae.mac||ae.android)&&y.from==o-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(y={from:c,to:h,insert:He.of([n.text.replace("."," ")])}),this.pendingContextChange=y,!e.state.readOnly){let b=this.to-this.from+(y.to-y.from+y.insert.length);c0(e,y,ee.single(this.toEditorPos(n.selectionStart,b),this.toEditorPos(n.selectionEnd,b)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),y.from<y.to&&!y.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],a=null;for(let o=this.toEditorPos(n.rangeStart),c=this.toEditorPos(n.rangeEnd);o<c;o++){let h=e.coordsForChar(o);a=h&&new DOMRect(h.left,h.top,h.right-h.left,h.bottom-h.top)||a||new DOMRect,r.push(a)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=n=>{let r=[];for(let a of n.getTextFormats()){let o=a.underlineStyle,c=a.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(c)){let h=this.toEditorPos(a.rangeStart),d=this.toEditorPos(a.rangeEnd);if(h<d){let p=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(c)?1:2}px`;r.push(Ke.mark({attributes:{style:p}}).range(h,d))}}}e.dispatch({effects:Xk.of(Ke.set(r))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:n}=this.composing;this.composing=null,n&&this.reset(e.state)}};for(let n in this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:n=>{this.editContext.updateControlBounds(n.contentDOM.getBoundingClientRect());let r=ru(n.root);r&&r.rangeCount&&this.editContext.updateSelectionBounds(r.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((a,o,c,h,d)=>{if(n)return;let p=d.length-(o-a);if(r&&o>=r.to)if(r.from==a&&r.to==o&&r.insert.eq(d)){r=this.pendingContextChange=null,t+=p,this.to+=p;return}else r=null,this.revertPending(e.state);if(a+=t,o+=t,o<=this.from)this.from+=p,this.to+=p;else if(a<this.to){if(a<this.from||o>this.to||this.to-this.from+d.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(a),this.toContextPos(o),d.toString()),this.to+=p}t+=p}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(r=>!r.isUserEvent("input.type")&&r.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class pe{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:n}=e;this.dispatchTransactions=e.dispatchTransactions||n&&(r=>r.forEach(a=>n(a,this)))||(r=>this.update(r)),this.dispatch=this.dispatch.bind(this),this._root=e.root||cN(e.parent)||document,this.viewState=new Q1(e.state||Pe.create(e)),e.scrollTo&&e.scrollTo.is(Zc)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(Gl).map(r=>new np(r));for(let r of this.plugins)r.update(this);this.observer=new N3(this),this.inputState=new t3(this),this.inputState.ensureHandlers(this.plugins),this.docView=new E1(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=!0,this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof St?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,n=!1,r,a=this.state;for(let b of e){if(b.startState!=a)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");a=b.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,c=0,h=null;e.some(b=>b.annotation(hC))?(this.inputState.notifiedFocused=o,c=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,h=dC(a,o),h||(c=1));let d=this.observer.delayedAndroidKey,p=null;if(d?(this.observer.clearDelayedAndroidKey(),p=this.observer.readChange(),(p&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(p=null)):this.observer.clear(),a.facet(Pe.phrases)!=this.state.facet(Pe.phrases))return this.setState(a);r=Hf.create(this,a,e),r.flags|=c;let y=this.viewState.scrollTarget;try{this.updateState=2;for(let b of e){if(y&&(y=y.map(b.changes)),b.scrollIntoView){let{main:v}=b.state.selection;y=new Jl(v.empty?v:ee.cursor(v.head,v.head>v.anchor?-1:1))}for(let v of b.effects)v.is(Zc)&&(y=v.value.clip(this.state))}this.viewState.update(r,y),this.bidiCache=Vf.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),t=this.docView.update(r),this.state.facet(Qo)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(b=>b.isUserEvent("select.pointer")))}finally{this.updateState=0}if(r.startState.facet(rf)!=r.state.facet(rf)&&(this.viewState.mustMeasureContent=!0),(t||n||y||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!r.empty)for(let b of this.state.facet(dg))try{b(r)}catch(v){En(this.state,v,"update listener")}(h||p)&&Promise.resolve().then(()=>{h&&this.state==h.startState&&this.dispatch(h),p&&!rC(this,p)&&d.force&&Zl(this.contentDOM,d.key,d.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let n of this.plugins)n.destroy(this);this.viewState=new Q1(e),this.plugins=e.facet(Gl).map(n=>new np(n)),this.pluginMap.clear();for(let n of this.plugins)n.update(this);this.docView.destroy(),this.docView=new E1(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(Gl),n=e.state.facet(Gl);if(t!=n){let r=[];for(let a of n){let o=t.indexOf(a);if(o<0)r.push(new np(a));else{let c=this.plugins[o];c.mustUpdate=e,r.push(c)}}for(let a of this.plugins)a.mustUpdate!=e&&a.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let r of this.plugins)r.mustUpdate=e;for(let r=0;r<this.plugins.length;r++)this.plugins[r].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(n){En(this.state,n,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,r=n.scrollTop*this.scaleY,{scrollAnchorPos:a,scrollAnchorHeight:o}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let c=0;;c++){if(o<0)if(Nk(n))a=-1,o=this.viewState.heightMap.height;else{let v=this.viewState.scrollAnchorAt(r);a=v.from,o=v.top}this.updateState=1;let h=this.viewState.measure(this);if(!h&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(c>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let d=[];h&4||([this.measureRequests,d]=[d,this.measureRequests]);let p=d.map(v=>{try{return v.read(this)}catch(w){return En(this.state,w),K1}}),y=Hf.create(this,this.state,[]),b=!1;y.flags|=h,t?t.flags|=h:t=y,this.updateState=2,y.empty||(this.updatePlugins(y),this.inputState.update(y),this.updateAttrs(),b=this.docView.update(y),b&&this.docViewUpdate());for(let v=0;v<d.length;v++)if(p[v]!=K1)try{let w=d[v];w.write&&w.write(p[v],this)}catch(w){En(this.state,w)}if(b&&this.docView.updateSelection(!0),!y.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let w=(a<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(a).top)-o;if(w>1||w<-1){r=r+w,n.scrollTop=r/this.scaleY,o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let c of this.state.facet(dg))c(t)}get themeClasses(){return vg+" "+(this.state.facet(bg)?yC:gC)+" "+this.state.facet(rf)}updateAttrs(){let e=X1(this,Wk,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(Zi)?"true":"false",class:"cm-content",style:`${ae.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),X1(this,a0,t);let n=this.observer.ignore(()=>{let r=k1(this.contentDOM,this.contentAttrs,t),a=k1(this.dom,this.editorAttrs,e);return r||a});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let r of n.effects)if(r.is(pe.announce)){t&&(this.announceDOM.textContent=""),t=!1;let a=this.announceDOM.appendChild(document.createElement("div"));a.textContent=r.value}}mountStyles(){this.styleModules=this.state.facet(Qo);let e=this.state.facet(pe.cspNonce);rr.mount(this.root,this.styleModules.concat(R3).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(n=>n.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return lp(this,e,R1(this,e,t,n))}moveByGroup(e,t){return lp(this,e,R1(this,e,t,n=>FN(this,e.head,n)))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),a=n[t?n.length-1:0];return ee.cursor(a.side(t,r)+e.from,a.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return GN(this,e,t,n)}moveVertically(e,t,n){return lp(this,e,YN(this,e,t,n))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let n=gg(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),gg(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),a=this.bidiSpans(r),o=a[ts.find(a,e-r.from,-1,t)];return _f(n,o.dir==et.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(Fk)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>j3)return Hk(e.length);let t=this.textDirectionAt(e.from),n;for(let a of this.bidiCache)if(a.from==e.from&&a.dir==t&&(a.fresh||_k(a.isolates,n=T1(this,e))))return a.order;n||(n=T1(this,e));let r=bN(e.text,t,n);return this.bidiCache.push(new Vf(e.from,e.to,t,n,!0,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ae.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Dk(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Zc.of(new Jl(typeof e=="number"?ee.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Zc.of(new Jl(ee.cursor(n.from),"start","start",n.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return fn.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return fn.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=rr.newName(),r=[rf.of(n),Qo.of(xg(`.${n}`,e))];return t&&t.dark&&r.push(bg.of(!0)),r}static baseTheme(e){return Ea.lowest(Qo.of(xg("."+vg,e,bC)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),r=n&&pt.get(n)||pt.get(e);return((t=r==null?void 0:r.root)===null||t===void 0?void 0:t.view)||null}}pe.styleModule=Qo;pe.inputHandler=Ik;pe.clipboardInputFilter=r0;pe.clipboardOutputFilter=l0;pe.scrollHandler=Kk;pe.focusChangeEffect=Gk;pe.perLineTextDirection=Fk;pe.exceptionSink=Qk;pe.updateListener=dg;pe.editable=Zi;pe.mouseSelectionStyle=Vk;pe.dragMovesSelection=qk;pe.clickAddsSelectionRange=Pk;pe.decorations=uh;pe.blockWrappers=$k;pe.outerDecorations=o0;pe.atomicRanges=Au;pe.bidiIsolatedRanges=Zk;pe.scrollMargins=Jk;pe.darkTheme=bg;pe.cspNonce=he.define({combine:i=>i.length?i[0]:""});pe.contentAttributes=a0;pe.editorAttributes=Wk;pe.lineWrapping=pe.contentAttributes.of({class:"cm-lineWrapping"});pe.announce=Ye.define();const j3=4096,K1={};class Vf{constructor(e,t,n,r,a,o){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=a,this.order=o}static update(e,t){if(t.empty&&!e.some(a=>a.fresh))return e;let n=[],r=e.length?e[e.length-1].dir:et.LTR;for(let a=Math.max(0,e.length-10);a<e.length;a++){let o=e[a];o.dir==r&&!t.touchesRange(o.from,o.to)&&n.push(new Vf(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return n}}function X1(i,e,t){for(let n=i.state.facet(e),r=n.length-1;r>=0;r--){let a=n[r],o=typeof a=="function"?a(i):a;o&&n0(o,t)}return t}const z3=ae.mac?"mac":ae.windows?"win":ae.linux?"linux":"key";function _3(i,e){const t=i.split(/-(?!$)/);let n=t[t.length-1];n=="Space"&&(n=" ");let r,a,o,c;for(let h=0;h<t.length-1;++h){const d=t[h];if(/^(cmd|meta|m)$/i.test(d))c=!0;else if(/^a(lt)?$/i.test(d))r=!0;else if(/^(c|ctrl|control)$/i.test(d))a=!0;else if(/^s(hift)?$/i.test(d))o=!0;else if(/^mod$/i.test(d))e=="mac"?c=!0:a=!0;else throw new Error("Unrecognized modifier name: "+d)}return r&&(n="Alt-"+n),a&&(n="Ctrl-"+n),c&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function lf(i,e,t){return e.altKey&&(i="Alt-"+i),e.ctrlKey&&(i="Ctrl-"+i),e.metaKey&&(i="Meta-"+i),t!==!1&&e.shiftKey&&(i="Shift-"+i),i}const H3=Ea.default(pe.domEventHandlers({keydown(i,e){return V3(U3(e.state),i,e,"editor")}})),Qf=he.define({enables:H3}),W1=new WeakMap;function U3(i){let e=i.facet(Qf),t=W1.get(e);return t||W1.set(e,t=q3(e.reduce((n,r)=>n.concat(r),[]))),t}let Vs=null;const P3=4e3;function q3(i,e=z3){let t=Object.create(null),n=Object.create(null),r=(o,c)=>{let h=n[o];if(h==null)n[o]=c;else if(h!=c)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},a=(o,c,h,d,p)=>{var y,b;let v=t[o]||(t[o]=Object.create(null)),w=c.split(/ (?!$)/).map(O=>_3(O,e));for(let O=1;O<w.length;O++){let D=w.slice(0,O).join(" ");r(D,!0),v[D]||(v[D]={preventDefault:!0,stopPropagation:!1,run:[B=>{let V=Vs={view:B,prefix:D,scope:o};return setTimeout(()=>{Vs==V&&(Vs=null)},P3),!0}]})}let k=w.join(" ");r(k,!1);let A=v[k]||(v[k]={preventDefault:!1,stopPropagation:!1,run:((b=(y=v._any)===null||y===void 0?void 0:y.run)===null||b===void 0?void 0:b.slice())||[]});h&&A.run.push(h),d&&(A.preventDefault=!0),p&&(A.stopPropagation=!0)};for(let o of i){let c=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let d of c){let p=t[d]||(t[d]=Object.create(null));p._any||(p._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:y}=o;for(let b in p)p[b].run.push(v=>y(v,Sg))}let h=o[e]||o.key;if(h)for(let d of c)a(d,h,o.run,o.preventDefault,o.stopPropagation),o.shift&&a(d,"Shift-"+h,o.shift,o.preventDefault,o.stopPropagation)}return t}let Sg=null;function V3(i,e,t,n){Sg=e;let r=tN(e),a=Br(r,0),o=Il(a)==r.length&&r!=" ",c="",h=!1,d=!1,p=!1;Vs&&Vs.view==t&&Vs.scope==n&&(c=Vs.prefix+" ",oC.indexOf(e.keyCode)<0&&(d=!0,Vs=null));let y=new Set,b=A=>{if(A){for(let O of A.run)if(!y.has(O)&&(y.add(O),O(t)))return A.stopPropagation&&(p=!0),!0;A.preventDefault&&(A.stopPropagation&&(p=!0),d=!0)}return!1},v=i[n],w,k;return v&&(b(v[c+lf(r,e,!o)])?h=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ae.windows&&e.ctrlKey&&e.altKey)&&!(ae.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(w=lr[e.keyCode])&&w!=r?(b(v[c+lf(w,e,!0)])||e.shiftKey&&(k=iu[e.keyCode])!=r&&k!=w&&b(v[c+lf(k,e,!1)]))&&(h=!0):o&&e.shiftKey&&b(v[c+lf(r,e,!0)])&&(h=!0),!h&&b(v._any)&&(h=!0)),d&&(h=!0),h&&p&&e.stopPropagation(),Sg=null,h}class Tu{constructor(e,t,n,r,a){this.className=e,this.left=t,this.top=n,this.width=r,this.height=a}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let r=e.coordsAtPos(n.head,n.assoc||1);if(!r)return[];let a=vC(e);return[new Tu(t,r.left-a.left,r.top-a.top,null,r.bottom-r.top)]}else return Q3(e,t,n)}}function vC(i){let e=i.scrollDOM.getBoundingClientRect();return{left:(i.textDirection==et.LTR?e.left:e.right-i.scrollDOM.clientWidth*i.scaleX)-i.scrollDOM.scrollLeft*i.scaleX,top:e.top-i.scrollDOM.scrollTop*i.scaleY}}function $1(i,e,t,n){let r=i.coordsAtPos(e,t*2);if(!r)return n;let a=i.dom.getBoundingClientRect(),o=(r.top+r.bottom)/2,c=i.posAtCoords({x:a.left+1,y:o}),h=i.posAtCoords({x:a.right-1,y:o});return c==null||h==null?n:{from:Math.max(n.from,Math.min(c,h)),to:Math.min(n.to,Math.max(c,h))}}function Q3(i,e,t){if(t.to<=i.viewport.from||t.from>=i.viewport.to)return[];let n=Math.max(t.from,i.viewport.from),r=Math.min(t.to,i.viewport.to),a=i.textDirection==et.LTR,o=i.contentDOM,c=o.getBoundingClientRect(),h=vC(i),d=o.querySelector(".cm-line"),p=d&&window.getComputedStyle(d),y=c.left+(p?parseInt(p.paddingLeft)+Math.min(0,parseInt(p.textIndent)):0),b=c.right-(p?parseInt(p.paddingRight):0),v=pg(i,n,1),w=pg(i,r,-1),k=v.type==jt.Text?v:null,A=w.type==jt.Text?w:null;if(k&&(i.lineWrapping||v.widgetLineBreaks)&&(k=$1(i,n,1,k)),A&&(i.lineWrapping||w.widgetLineBreaks)&&(A=$1(i,r,-1,A)),k&&A&&k.from==A.from&&k.to==A.to)return D(B(t.from,t.to,k));{let j=k?B(t.from,null,k):V(v,!1),Q=A?B(null,t.to,A):V(w,!0),I=[];return(k||v).to<(A||w).from-(k&&A?1:0)||v.widgetLineBreaks>1&&j.bottom+i.defaultLineHeight/2<Q.top?I.push(O(y,j.bottom,b,Q.top)):j.bottom<Q.top&&i.elementAtHeight((j.bottom+Q.top)/2).type==jt.Text&&(j.bottom=Q.top=(j.bottom+Q.top)/2),D(j).concat(I).concat(D(Q))}function O(j,Q,I,q){return new Tu(e,j-h.left,Q-h.top,I-j,q-Q)}function D({top:j,bottom:Q,horizontal:I}){let q=[];for(let Y=0;Y<I.length;Y+=2)q.push(O(I[Y],j,I[Y+1],Q));return q}function B(j,Q,I){let q=1e9,Y=-1e9,te=[];function le(ke,me,H,K,W){let ge=i.coordsAtPos(ke,ke==I.to?-2:2),E=i.coordsAtPos(H,H==I.from?2:-2);!ge||!E||(q=Math.min(ge.top,E.top,q),Y=Math.max(ge.bottom,E.bottom,Y),W==et.LTR?te.push(a&&me?y:ge.left,a&&K?b:E.right):te.push(!a&&K?y:E.left,!a&&me?b:ge.right))}let ne=j??I.from,xe=Q??I.to;for(let ke of i.visibleRanges)if(ke.to>ne&&ke.from<xe)for(let me=Math.max(ke.from,ne),H=Math.min(ke.to,xe);;){let K=i.state.doc.lineAt(me);for(let W of i.bidiSpans(K)){let ge=W.from+K.from,E=W.to+K.from;if(ge>=H)break;E>me&&le(Math.max(ge,me),j==null&&ge<=ne,Math.min(E,H),Q==null&&E>=xe,W.dir)}if(me=K.to+1,me>=H)break}return te.length==0&&le(ne,j==null,xe,Q==null,i.textDirection),{top:q,bottom:Y,horizontal:te}}function V(j,Q){let I=c.top+(Q?j.top:j.bottom);return{top:I,bottom:I,horizontal:[]}}}function I3(i,e){return i.constructor==e.constructor&&i.eq(e)}class G3{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Cf)!=e.state.facet(Cf)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,n=e.facet(Cf);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,n)=>!I3(t,this.drawn[n]))){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let r=t.nextSibling;t.remove(),t=r}this.drawn=e,ae.safari&&ae.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Cf=he.define();function xC(i){return[fn.define(e=>new G3(e,i)),Cf.of(i)]}const au=he.define({combine(i){return Da(i,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function F3(i={}){return[au.of(i),Y3,K3,X3,Yk.of(!0)]}function SC(i){return i.startState.facet(au)!=i.state.facet(au)}const Y3=xC({above:!0,markers(i){let{state:e}=i,t=e.facet(au),n=[];for(let r of e.selection.ranges){let a=r==e.selection.main;if(r.empty||t.drawRangeCursor){let o=a?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",c=r.empty?r:ee.cursor(r.head,r.head>r.anchor?-1:1);for(let h of Tu.forRange(i,o,c))n.push(h)}}return n},update(i,e){i.transactions.some(n=>n.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=SC(i);return t&&Z1(i.state,e),i.docChanged||i.selectionSet||t},mount(i,e){Z1(e.state,i)},class:"cm-cursorLayer"});function Z1(i,e){e.style.animationDuration=i.facet(au).cursorBlinkRate+"ms"}const K3=xC({above:!1,markers(i){return i.state.selection.ranges.map(e=>e.empty?[]:Tu.forRange(i,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(i,e){return i.docChanged||i.selectionSet||i.viewportChanged||SC(i)},class:"cm-selectionLayer"}),X3=Ea.highest(pe.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),wC=Ye.define({map(i,e){return i==null?null:e.mapPos(i)}}),Fo=Yn.define({create(){return null},update(i,e){return i!=null&&(i=e.changes.mapPos(i)),e.effects.reduce((t,n)=>n.is(wC)?n.value:t,i)}}),W3=fn.fromClass(class{constructor(i){this.view=i,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(i){var e;let t=i.state.field(Fo);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(i.startState.field(Fo)!=t||i.docChanged||i.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:i}=this,e=i.state.field(Fo),t=e!=null&&i.coordsAtPos(e);if(!t)return null;let n=i.scrollDOM.getBoundingClientRect();return{left:t.left-n.left+i.scrollDOM.scrollLeft*i.scaleX,top:t.top-n.top+i.scrollDOM.scrollTop*i.scaleY,height:t.bottom-t.top}}drawCursor(i){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;i?(this.cursor.style.left=i.left/e+"px",this.cursor.style.top=i.top/t+"px",this.cursor.style.height=i.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(i){this.view.state.field(Fo)!=i&&this.view.dispatch({effects:wC.of(i)})}},{eventObservers:{dragover(i){this.setDropPos(this.view.posAtCoords({x:i.clientX,y:i.clientY}))},dragleave(i){(i.target==this.view.contentDOM||!this.view.contentDOM.contains(i.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function $3(){return[Fo,W3]}function Z3(){return e4}const J3=Ke.line({class:"cm-activeLine"}),e4=fn.fromClass(class{constructor(i){this.decorations=this.getDeco(i)}update(i){(i.docChanged||i.selectionSet)&&(this.decorations=this.getDeco(i.view))}getDeco(i){let e=-1,t=[];for(let n of i.state.selection.ranges){let r=i.lineBlockAt(n.head);r.from>e&&(t.push(J3.range(r.from)),e=r.from)}return Ke.set(t)}},{decorations:i=>i.decorations}),af="-10000px";class t4{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let a=null;this.tooltipViews=this.tooltips.map(o=>a=n(o,a))}update(e,t){var n;let r=e.state.facet(this.facet),a=r.filter(h=>h);if(r===this.input){for(let h of this.tooltipViews)h.update&&h.update(e);return!1}let o=[],c=t?[]:null;for(let h=0;h<a.length;h++){let d=a[h],p=-1;if(d){for(let y=0;y<this.tooltips.length;y++){let b=this.tooltips[y];b&&b.create==d.create&&(p=y)}if(p<0)o[h]=this.createTooltipView(d,h?o[h-1]:null),c&&(c[h]=!!d.above);else{let y=o[h]=this.tooltipViews[p];c&&(c[h]=t[p]),y.update&&y.update(e)}}}for(let h of this.tooltipViews)o.indexOf(h)<0&&(this.removeTooltipView(h),(n=h.destroy)===null||n===void 0||n.call(h));return t&&(c.forEach((h,d)=>t[d]=h),t.length=c.length),this.input=r,this.tooltips=a,this.tooltipViews=o,!0}}function n4(i){let e=i.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const up=he.define({combine:i=>{var e,t,n;return{position:ae.ios?"absolute":((e=i.find(r=>r.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=i.find(r=>r.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((n=i.find(r=>r.tooltipSpace))===null||n===void 0?void 0:n.tooltipSpace)||n4}}}),J1=new WeakMap,kC=fn.fromClass(class{constructor(i){this.view=i,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=i.state.facet(up);this.position=e.position,this.parent=e.parent,this.classes=i.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new t4(i,CC,(t,n)=>this.createTooltip(t,n),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),i.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let i of this.manager.tooltipViews)this.intersectionObserver.observe(i.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(i){i.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(i,this.above);e&&this.observeIntersection();let t=e||i.geometryChanged,n=i.state.facet(up);if(n.position!=this.position&&!this.madeAbsolute){this.position=n.position;for(let r of this.manager.tooltipViews)r.dom.style.position=this.position;t=!0}if(n.parent!=this.parent){this.parent&&this.container.remove(),this.parent=n.parent,this.createContainer();for(let r of this.manager.tooltipViews)this.container.appendChild(r.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(i,e){let t=i.create(this.view),n=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),i.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let r=document.createElement("div");r.className="cm-tooltip-arrow",t.dom.appendChild(r)}return t.dom.style.position=this.position,t.dom.style.top=af,t.dom.style.left="0px",this.container.insertBefore(t.dom,n),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var i,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let n of this.manager.tooltipViews)n.dom.remove(),(i=n.destroy)===null||i===void 0||i.call(n);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let i=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:a}=this.manager.tooltipViews[0];if(ae.safari){let o=a.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!a.offsetParent&&a.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let a=this.parent.getBoundingClientRect();a.width&&a.height&&(i=a.width/this.parent.offsetWidth,e=a.height/this.parent.offsetHeight)}else({scaleX:i,scaleY:e}=this.view.viewState);let n=this.view.scrollDOM.getBoundingClientRect(),r=u0(this.view);return{visible:{left:n.left+r.left,top:n.top+r.top,right:n.right-r.right,bottom:n.bottom-r.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((a,o)=>{let c=this.manager.tooltipViews[o];return c.getCoords?c.getCoords(a.pos):this.view.coordsAtPos(a.pos)}),size:this.manager.tooltipViews.map(({dom:a})=>a.getBoundingClientRect()),space:this.view.state.facet(up).tooltipSpace(this.view),scaleX:i,scaleY:e,makeAbsolute:t}}writeMeasure(i){var e;if(i.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let c of this.manager.tooltipViews)c.dom.style.position="absolute"}let{visible:t,space:n,scaleX:r,scaleY:a}=i,o=[];for(let c=0;c<this.manager.tooltips.length;c++){let h=this.manager.tooltips[c],d=this.manager.tooltipViews[c],{dom:p}=d,y=i.pos[c],b=i.size[c];if(!y||h.clip!==!1&&(y.bottom<=Math.max(t.top,n.top)||y.top>=Math.min(t.bottom,n.bottom)||y.right<Math.max(t.left,n.left)-.1||y.left>Math.min(t.right,n.right)+.1)){p.style.top=af;continue}let v=h.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,w=v?7:0,k=b.right-b.left,A=(e=J1.get(d))!==null&&e!==void 0?e:b.bottom-b.top,O=d.offset||s4,D=this.view.textDirection==et.LTR,B=b.width>n.right-n.left?D?n.left:n.right-b.width:D?Math.max(n.left,Math.min(y.left-(v?14:0)+O.x,n.right-k)):Math.min(Math.max(n.left,y.left-k+(v?14:0)-O.x),n.right-k),V=this.above[c];!h.strictSide&&(V?y.top-A-w-O.y<n.top:y.bottom+A+w+O.y>n.bottom)&&V==n.bottom-y.bottom>y.top-n.top&&(V=this.above[c]=!V);let j=(V?y.top-n.top:n.bottom-y.bottom)-w;if(j<A&&d.resize!==!1){if(j<this.view.defaultLineHeight){p.style.top=af;continue}J1.set(d,A),p.style.height=(A=j)/a+"px"}else p.style.height&&(p.style.height="");let Q=V?y.top-A-w-O.y:y.bottom+w+O.y,I=B+k;if(d.overlap!==!0)for(let q of o)q.left<I&&q.right>B&&q.top<Q+A&&q.bottom>Q&&(Q=V?q.top-A-2-w:q.bottom+w+2);if(this.position=="absolute"?(p.style.top=(Q-i.parent.top)/a+"px",eS(p,(B-i.parent.left)/r)):(p.style.top=Q/a+"px",eS(p,B/r)),v){let q=y.left+(D?O.x:-O.x)-(B+14-7);v.style.left=q/r+"px"}d.overlap!==!0&&o.push({left:B,top:Q,right:I,bottom:Q+A}),p.classList.toggle("cm-tooltip-above",V),p.classList.toggle("cm-tooltip-below",!V),d.positioned&&d.positioned(i.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let i of this.manager.tooltipViews)i.dom.style.top=af}},{eventObservers:{scroll(){this.maybeMeasure()}}});function eS(i,e){let t=parseInt(i.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(i.style.left=e+"px")}const i4=pe.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),s4={x:0,y:0},CC=he.define({enables:[kC,i4]});function AC(i,e){let t=i.plugin(kC);if(!t)return null;let n=t.manager.tooltips.indexOf(e);return n<0?null:t.manager.tooltipViews[n]}class ls extends sr{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}ls.prototype.elementClass="";ls.prototype.toDOM=void 0;ls.prototype.mapMode=Mn.TrackBefore;ls.prototype.startSide=ls.prototype.endSide=-1;ls.prototype.point=!0;const Af=he.define(),r4=he.define(),l4={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>Be.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},$o=he.define();function a4(i){return[TC(),$o.of({...l4,...i})]}const tS=he.define({combine:i=>i.some(e=>e)});function TC(i){return[o4]}const o4=fn.fromClass(class{constructor(i){this.view=i,this.domAfter=null,this.prevViewport=i.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=i.state.facet($o).map(e=>new iS(i,e)),this.fixed=!i.state.facet(tS);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),i.scrollDOM.insertBefore(this.dom,i.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(i){if(this.updateGutters(i)){let e=this.prevViewport,t=i.view.viewport,n=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(n<(t.to-t.from)*.8)}if(i.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(tS)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=i.view.viewport}syncGutters(i){let e=this.dom.nextSibling;i&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=Be.iter(this.view.state.facet(Af),this.view.viewport.from),n=[],r=this.gutters.map(a=>new u4(a,this.view.viewport,-this.view.documentPadding.top));for(let a of this.view.viewportLineBlocks)if(n.length&&(n=[]),Array.isArray(a.type)){let o=!0;for(let c of a.type)if(c.type==jt.Text&&o){wg(t,n,c.from);for(let h of r)h.line(this.view,c,n);o=!1}else if(c.widget)for(let h of r)h.widget(this.view,c)}else if(a.type==jt.Text){wg(t,n,a.from);for(let o of r)o.line(this.view,a,n)}else if(a.widget)for(let o of r)o.widget(this.view,a);for(let a of r)a.finish();i&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(i){let e=i.startState.facet($o),t=i.state.facet($o),n=i.docChanged||i.heightChanged||i.viewportChanged||!Be.eq(i.startState.facet(Af),i.state.facet(Af),i.view.viewport.from,i.view.viewport.to);if(e==t)for(let r of this.gutters)r.update(i)&&(n=!0);else{n=!0;let r=[];for(let a of t){let o=e.indexOf(a);o<0?r.push(new iS(this.view,a)):(this.gutters[o].update(i),r.push(this.gutters[o]))}for(let a of this.gutters)a.dom.remove(),r.indexOf(a)<0&&a.destroy();for(let a of r)a.config.side=="after"?this.getDOMAfter().appendChild(a.dom):this.dom.appendChild(a.dom);this.gutters=r}return n}destroy(){for(let i of this.gutters)i.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:i=>pe.scrollMargins.of(e=>{let t=e.plugin(i);if(!t||t.gutters.length==0||!t.fixed)return null;let n=t.dom.offsetWidth*e.scaleX,r=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==et.LTR?{left:n,right:r}:{right:n,left:r}})});function nS(i){return Array.isArray(i)?i:[i]}function wg(i,e,t){for(;i.value&&i.from<=t;)i.from==t&&e.push(i.value),i.next()}class u4{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=Be.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:r}=this,a=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==r.elements.length){let c=new OC(e,o,a,n);r.elements.push(c),r.dom.appendChild(c.dom)}else r.elements[this.i].update(e,o,a,n);this.height=t.bottom,this.i++}line(e,t,n){let r=[];wg(this.cursor,r,t.from),n.length&&(r=r.concat(n));let a=this.gutter.config.lineMarker(e,t,r);a&&r.unshift(a);let o=this.gutter;r.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,r)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t),r=n?[n]:null;for(let a of e.state.facet(r4)){let o=a(e,t.widget,t);o&&(r||(r=[])).push(o)}r&&this.addElement(e,t,r)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class iS{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,r=>{let a=r.target,o;if(a!=this.dom&&this.dom.contains(a)){for(;a.parentNode!=this.dom;)a=a.parentNode;let h=a.getBoundingClientRect();o=(h.top+h.bottom)/2}else o=r.clientY;let c=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[n](e,c,r)&&r.preventDefault()});this.markers=nS(t.markers(e)),t.initialSpacer&&(this.spacer=new OC(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=nS(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let r=this.config.updateSpacer(this.spacer.markers[0],e);r!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[r])}let n=e.view.viewport;return!Be.eq(this.markers,t,n.from,n.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class OC{constructor(e,t,n,r){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,r)}update(e,t,n,r){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),c4(this.markers,r)||this.setMarkers(e,r)}setMarkers(e,t){let n="cm-gutterElement",r=this.dom.firstChild;for(let a=0,o=0;;){let c=o,h=a<t.length?t[a++]:null,d=!1;if(h){let p=h.elementClass;p&&(n+=" "+p);for(let y=o;y<this.markers.length;y++)if(this.markers[y].compare(h)){c=y,d=!0;break}}else c=this.markers.length;for(;o<c;){let p=this.markers[o++];if(p.toDOM){p.destroy(r);let y=r.nextSibling;r.remove(),r=y}}if(!h)break;h.toDOM&&(d?r=r.nextSibling:this.dom.insertBefore(h.toDOM(e),r)),d&&o++}this.dom.className=n,this.markers=t}destroy(){this.setMarkers(null,[])}}function c4(i,e){if(i.length!=e.length)return!1;for(let t=0;t<i.length;t++)if(!i[t].compare(e[t]))return!1;return!0}const f4=he.define(),h4=he.define(),Fl=he.define({combine(i){return Da(i,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let r in t){let a=n[r],o=t[r];n[r]=a?(c,h,d)=>a(c,h,d)||o(c,h,d):o}return n}})}});class cp extends ls{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function fp(i,e){return i.state.facet(Fl).formatNumber(e,i.state)}const d4=$o.compute([Fl],i=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(f4)},lineMarker(e,t,n){return n.some(r=>r.toDOM)?null:new cp(fp(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,n)=>{for(let r of e.state.facet(h4)){let a=r(e,t,n);if(a)return a}return null},lineMarkerChange:e=>e.startState.facet(Fl)!=e.state.facet(Fl),initialSpacer(e){return new cp(fp(e,sS(e.state.doc.lines)))},updateSpacer(e,t){let n=fp(t.view,sS(t.view.state.doc.lines));return n==e.number?e:new cp(n)},domEventHandlers:i.facet(Fl).domEventHandlers,side:"before"}));function m4(i={}){return[Fl.of(i),TC(),d4]}function sS(i){let e=9;for(;e<i;)e=e*10+9;return e}const p4=new class extends ls{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},g4=Af.compute(["selection"],i=>{let e=[],t=-1;for(let n of i.selection.ranges){let r=i.doc.lineAt(n.head).from;r>t&&(t=r,e.push(p4.range(r)))}return Be.of(e)});function y4(){return g4}const MC=1024;let b4=0;class hp{constructor(e,t){this.from=e,this.to=t}}class Re{constructor(e={}){this.id=b4++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=hn.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}}Re.closedBy=new Re({deserialize:i=>i.split(" ")});Re.openedBy=new Re({deserialize:i=>i.split(" ")});Re.group=new Re({deserialize:i=>i.split(" ")});Re.isolate=new Re({deserialize:i=>{if(i&&i!="rtl"&&i!="ltr"&&i!="auto")throw new RangeError("Invalid value for isolate: "+i);return i||"auto"}});Re.contextHash=new Re({perNode:!0});Re.lookAhead=new Re({perNode:!0});Re.mounted=new Re({perNode:!0});class Zo{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[Re.mounted.id]}}const v4=Object.create(null);class hn{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(e){let t=e.props&&e.props.length?Object.create(null):v4,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),r=new hn(e.name||"",t,e.id,n);if(e.props){for(let a of e.props)if(Array.isArray(a)||(a=a(r)),a){if(a[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[a[0].id]=a[1]}}return r}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(Re.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(" "))t[r]=e[n];return n=>{for(let r=n.prop(Re.group),a=-1;a<(r?r.length:0);a++){let o=t[a<0?n.name:r[a]];if(o)return o}}}}hn.none=new hn("",Object.create(null),0,8);class d0{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let n of this.types){let r=null;for(let a of e){let o=a(n);if(o){r||(r=Object.assign({},n.props));let c=o[1],h=o[0];h.combine&&h.id in r&&(c=h.combine(r[h.id],c)),r[h.id]=c}}t.push(r?new hn(n.name,r,n.id,n.flags):n)}return new d0(t)}}const of=new WeakMap,rS=new WeakMap;var ot;(function(i){i[i.ExcludeBuffers=1]="ExcludeBuffers",i[i.IncludeAnonymous=2]="IncludeAnonymous",i[i.IgnoreMounts=4]="IgnoreMounts",i[i.IgnoreOverlays=8]="IgnoreOverlays",i[i.EnterBracketed=16]="EnterBracketed"})(ot||(ot={}));class ht{constructor(e,t,n,r,a){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,a&&a.length){this.props=Object.create(null);for(let[o,c]of a)this.props[typeof o=="number"?o:o.id]=c}}toString(){let e=Zo.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let n of this.children){let r=n.toString();r&&(t&&(t+=","),t+=r)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new Cg(this.topNode,e)}cursorAt(e,t=0,n=0){let r=of.get(this)||this.topNode,a=new Cg(r);return a.moveTo(e,t),of.set(this,a._tree),a}get topNode(){return new Gn(this,0,0,null)}resolve(e,t=0){let n=ou(of.get(this)||this.topNode,e,t,!1);return of.set(this,n),n}resolveInner(e,t=0){let n=ou(rS.get(this)||this.topNode,e,t,!0);return rS.set(this,n),n}resolveStack(e,t=0){return w4(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:a=this.length}=e,o=e.mode||0,c=(o&ot.IncludeAnonymous)>0;for(let h=this.cursor(o|ot.IncludeAnonymous);;){let d=!1;if(h.from<=a&&h.to>=r&&(!c&&h.type.isAnonymous||t(h)!==!1)){if(h.firstChild())continue;d=!0}for(;d&&n&&(c||!h.type.isAnonymous)&&n(h),!h.nextSibling();){if(!h.parent())return;d=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:g0(hn.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new ht(this.type,t,n,r,this.propValues),e.makeTree||((t,n,r)=>new ht(hn.none,t,n,r)))}static build(e){return k4(e)}}ht.empty=new ht(hn.none,[],[],0);class m0{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new m0(this.buffer,this.index)}}class or{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return hn.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],a=r.name;if(/\W/.test(a)&&!r.isError&&(a=JSON.stringify(a)),e+=4,n==e)return a;let o=[];for(;e<n;)o.push(this.childString(e)),e=this.buffer[e+3];return a+"("+o.join(",")+")"}findChild(e,t,n,r,a){let{buffer:o}=this,c=-1;for(let h=e;h!=t&&!(EC(a,r,o[h+1],o[h+2])&&(c=h,n>0));h=o[h+3]);return c}slice(e,t,n){let r=this.buffer,a=new Uint16Array(t-e),o=0;for(let c=e,h=0;c<t;){a[h++]=r[c++],a[h++]=r[c++]-n;let d=a[h++]=r[c++]-n;a[h++]=r[c++]-e,o=Math.max(o,d)}return new or(a,o,this.set)}}function EC(i,e,t,n){switch(i){case-2:return t<e;case-1:return n>=e&&t<e;case 0:return t<e&&n>e;case 1:return t<=e&&n>e;case 2:return n>e;case 4:return!0}}function ou(i,e,t,n){for(var r;i.from==i.to||(t<1?i.from>=e:i.from>e)||(t>-1?i.to<=e:i.to<e);){let o=!n&&i instanceof Gn&&i.index<0?null:i.parent;if(!o)return i;i=o}let a=n?0:ot.IgnoreOverlays;if(n)for(let o=i,c=o.parent;c;o=c,c=o.parent)o instanceof Gn&&o.index<0&&((r=c.enter(e,t,a))===null||r===void 0?void 0:r.from)!=o.from&&(i=c);for(;;){let o=i.enter(e,t,a);if(!o)return i;i=o}}class RC{cursor(e=0){return new Cg(this,e)}getChild(e,t=null,n=null){let r=lS(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return lS(this,e,t,n)}resolve(e,t=0){return ou(this,e,t,!1)}resolveInner(e,t=0){return ou(this,e,t,!0)}matchContext(e){return kg(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let r=t.lastChild;if(!r||r.to!=t.to)break;r.type.isError&&r.from==r.to?(n=t,t=r.prevSibling):t=r}return n}get node(){return this}get next(){return this.parent}}class Gn extends RC{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,n,r,a=0){var o;for(let c=this;;){for(let{children:h,positions:d}=c._tree,p=t>0?h.length:-1;e!=p;e+=t){let y=h[e],b=d[e]+c.from;if(!(!(a&ot.EnterBracketed&&y instanceof ht&&((o=Zo.get(y))===null||o===void 0?void 0:o.overlay)===null&&(b>=n||b+y.length<=n))&&!EC(r,n,b,b+y.length))){if(y instanceof or){if(a&ot.ExcludeBuffers)continue;let v=y.findChild(0,y.buffer.length,t,n-b,r);if(v>-1)return new nr(new x4(c,y,e,b),null,v)}else if(a&ot.IncludeAnonymous||!y.type.isAnonymous||p0(y)){let v;if(!(a&ot.IgnoreMounts)&&(v=Zo.get(y))&&!v.overlay)return new Gn(v.tree,b,e,c);let w=new Gn(y,b,e,c);return a&ot.IncludeAnonymous||!w.type.isAnonymous?w:w.nextChild(t<0?y.children.length-1:0,t,n,r,a)}}}if(a&ot.IncludeAnonymous||!c.type.isAnonymous||(c.index>=0?e=c.index+t:e=t<0?-1:c._parent._tree.children.length,c=c._parent,!c))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,n=0){let r;if(!(n&ot.IgnoreOverlays)&&(r=Zo.get(this._tree))&&r.overlay){let a=e-this.from,o=n&ot.EnterBracketed&&r.bracketed;for(let{from:c,to:h}of r.overlay)if((t>0||o?c<=a:c<a)&&(t<0||o?h>=a:h>a))return new Gn(r.tree,r.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function lS(i,e,t,n){let r=i.cursor(),a=[];if(!r.firstChild())return a;if(t!=null){for(let o=!1;!o;)if(o=r.type.is(t),!r.nextSibling())return a}for(;;){if(n!=null&&r.type.is(n))return a;if(r.type.is(e)&&a.push(r.node),!r.nextSibling())return n==null?a:[]}}function kg(i,e,t=e.length-1){for(let n=i;t>=0;n=n.parent){if(!n)return!1;if(!n.type.isAnonymous){if(e[t]&&e[t]!=n.name)return!1;t--}}return!0}class x4{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}}class nr extends RC{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:r}=this.context,a=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.context.start,n);return a<0?null:new nr(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,n=0){if(n&ot.ExcludeBuffers)return null;let{buffer:r}=this.context,a=r.findChild(this.index+4,r.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return a<0?null:new nr(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new nr(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new nr(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,a=n.buffer[this.index+3];if(a>r){let o=n.buffer[this.index+1];e.push(n.slice(r,a,o)),t.push(0)}return new ht(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function DC(i){if(!i.length)return null;let e=0,t=i[0];for(let a=1;a<i.length;a++){let o=i[a];(o.from>t.from||o.to<t.to)&&(t=o,e=a)}let n=t instanceof Gn&&t.index<0?null:t.parent,r=i.slice();return n?r[e]=n:r.splice(e,1),new S4(r,t)}class S4{constructor(e,t){this.heads=e,this.node=t}get next(){return DC(this.heads)}}function w4(i,e,t){let n=i.resolveInner(e,t),r=null;for(let a=n instanceof Gn?n:n.context.parent;a;a=a.parent)if(a.index<0){let o=a.parent;(r||(r=[n])).push(o.resolve(e,t)),a=o}else{let o=Zo.get(a.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let c=new Gn(o.tree,o.overlay[0].from+a.from,-1,a);(r||(r=[n])).push(ou(c,e,t,!1))}}return r?DC(r):n}class Cg{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~ot.EnterBracketed,e instanceof Gn)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let n=e._parent;n;n=n._parent)this.stack.unshift(n.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof Gn?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,a=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return a<0?!1:(this.stack.push(this.index),this.yieldBuf(a))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&ot.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ot.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ot.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let r=n<0?0:this.stack[n]+4;if(this.index!=r)return this.yieldBuf(t.findChild(r,this.index,-1,0,4))}else{let r=t.buffer[this.index+3];if(r<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(r)}return n<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let a=0;a<this.index;a++)if(r.buffer.buffer[a+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let a=t+e,o=e<0?-1:n._tree.children.length;a!=o;a+=e){let c=n._tree.children[a];if(this.mode&ot.IncludeAnonymous||c instanceof or||!c.type.isAnonymous||p0(c))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)e:for(let r=this.index,a=this.stack.length;a>=0;){for(let o=e;o;o=o._parent)if(o.index==r){if(r==this.index)return o;t=o,n=a+1;break e}r=this.stack[--a]}for(let r=n;r<this.stack.length;r++)t=new nr(this.buffer,t,this.stack[r]);return this.bufferNode=new nr(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return kg(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,a=this.stack.length-1;r>=0;a--){if(a<0)return kg(this._tree,e,r);let o=n[t.buffer[this.stack[a]]];if(!o.isAnonymous){if(e[r]&&e[r]!=o.name)return!1;r--}}return!0}}function p0(i){return i.children.some(e=>e instanceof or||!e.type.isAnonymous||p0(e))}function k4(i){var e;let{buffer:t,nodeSet:n,maxBufferLength:r=MC,reused:a=[],minRepeatType:o=n.types.length}=i,c=Array.isArray(t)?new m0(t,t.length):t,h=n.types,d=0,p=0;function y(j,Q,I,q,Y,te){let{id:le,start:ne,end:xe,size:ke}=c,me=p,H=d;if(ke<0)if(c.next(),ke==-1){let X=a[le];I.push(X),q.push(ne-j);return}else if(ke==-3){d=le;return}else if(ke==-4){p=le;return}else throw new RangeError(`Unrecognized record size: ${ke}`);let K=h[le],W,ge,E=ne-j;if(xe-ne<=r&&(ge=A(c.pos-Q,Y))){let X=new Uint16Array(ge.size-ge.skip),ie=c.pos-ge.size,Z=X.length;for(;c.pos>ie;)Z=O(ge.start,X,Z);W=new or(X,xe-ge.start,n),E=ge.start-j}else{let X=c.pos-ke;c.next();let ie=[],Z=[],re=le>=o?le:-1,Ce=0,be=xe;for(;c.pos>X;)re>=0&&c.id==re&&c.size>=0?(c.end<=be-r&&(w(ie,Z,ne,Ce,c.end,be,re,me,H),Ce=ie.length,be=c.end),c.next()):te>2500?b(ne,X,ie,Z):y(ne,X,ie,Z,re,te+1);if(re>=0&&Ce>0&&Ce<ie.length&&w(ie,Z,ne,Ce,ne,be,re,me,H),ie.reverse(),Z.reverse(),re>-1&&Ce>0){let Le=v(K,H);W=g0(K,ie,Z,0,ie.length,0,xe-ne,Le,Le)}else W=k(K,ie,Z,xe-ne,me-xe,H)}I.push(W),q.push(E)}function b(j,Q,I,q){let Y=[],te=0,le=-1;for(;c.pos>Q;){let{id:ne,start:xe,end:ke,size:me}=c;if(me>4)c.next();else{if(le>-1&&xe<le)break;le<0&&(le=ke-r),Y.push(ne,xe,ke),te++,c.next()}}if(te){let ne=new Uint16Array(te*4),xe=Y[Y.length-2];for(let ke=Y.length-3,me=0;ke>=0;ke-=3)ne[me++]=Y[ke],ne[me++]=Y[ke+1]-xe,ne[me++]=Y[ke+2]-xe,ne[me++]=me;I.push(new or(ne,Y[2]-xe,n)),q.push(xe-j)}}function v(j,Q){return(I,q,Y)=>{let te=0,le=I.length-1,ne,xe;if(le>=0&&(ne=I[le])instanceof ht){if(!le&&ne.type==j&&ne.length==Y)return ne;(xe=ne.prop(Re.lookAhead))&&(te=q[le]+ne.length+xe)}return k(j,I,q,Y,te,Q)}}function w(j,Q,I,q,Y,te,le,ne,xe){let ke=[],me=[];for(;j.length>q;)ke.push(j.pop()),me.push(Q.pop()+I-Y);j.push(k(n.types[le],ke,me,te-Y,ne-te,xe)),Q.push(Y-I)}function k(j,Q,I,q,Y,te,le){if(te){let ne=[Re.contextHash,te];le=le?[ne].concat(le):[ne]}if(Y>25){let ne=[Re.lookAhead,Y];le=le?[ne].concat(le):[ne]}return new ht(j,Q,I,q,le)}function A(j,Q){let I=c.fork(),q=0,Y=0,te=0,le=I.end-r,ne={size:0,start:0,skip:0};e:for(let xe=I.pos-j;I.pos>xe;){let ke=I.size;if(I.id==Q&&ke>=0){ne.size=q,ne.start=Y,ne.skip=te,te+=4,q+=4,I.next();continue}let me=I.pos-ke;if(ke<0||me<xe||I.start<le)break;let H=I.id>=o?4:0,K=I.start;for(I.next();I.pos>me;){if(I.size<0)if(I.size==-3||I.size==-4)H+=4;else break e;else I.id>=o&&(H+=4);I.next()}Y=K,q+=ke,te+=H}return(Q<0||q==j)&&(ne.size=q,ne.start=Y,ne.skip=te),ne.size>4?ne:void 0}function O(j,Q,I){let{id:q,start:Y,end:te,size:le}=c;if(c.next(),le>=0&&q<o){let ne=I;if(le>4){let xe=c.pos-(le-4);for(;c.pos>xe;)I=O(j,Q,I)}Q[--I]=ne,Q[--I]=te-j,Q[--I]=Y-j,Q[--I]=q}else le==-3?d=q:le==-4&&(p=q);return I}let D=[],B=[];for(;c.pos>0;)y(i.start||0,i.bufferStart||0,D,B,-1,0);let V=(e=i.length)!==null&&e!==void 0?e:D.length?B[0]+D[0].length:0;return new ht(h[i.topID],D.reverse(),B.reverse(),V)}const aS=new WeakMap;function Tf(i,e){if(!i.isAnonymous||e instanceof or||e.type!=i)return 1;let t=aS.get(e);if(t==null){t=1;for(let n of e.children){if(n.type!=i||!(n instanceof ht)){t=1;break}t+=Tf(i,n)}aS.set(e,t)}return t}function g0(i,e,t,n,r,a,o,c,h){let d=0;for(let w=n;w<r;w++)d+=Tf(i,e[w]);let p=Math.ceil(d*1.5/8),y=[],b=[];function v(w,k,A,O,D){for(let B=A;B<O;){let V=B,j=k[B],Q=Tf(i,w[B]);for(B++;B<O;B++){let I=Tf(i,w[B]);if(Q+I>=p)break;Q+=I}if(B==V+1){if(Q>p){let I=w[V];v(I.children,I.positions,0,I.children.length,k[V]+D);continue}y.push(w[V])}else{let I=k[B-1]+w[B-1].length-j;y.push(g0(i,w,k,V,B,j,I,null,h))}b.push(j+D-a)}}return v(e,t,n,r,0),(c||h)(y,b,o)}class Yr{constructor(e,t,n,r,a=!1,o=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=(a?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],n=!1){let r=[new Yr(0,e.length,e,0,!1,n)];for(let a of t)a.to>e.length&&r.push(a);return r}static applyChanges(e,t,n=128){if(!t.length)return e;let r=[],a=1,o=e.length?e[0]:null;for(let c=0,h=0,d=0;;c++){let p=c<t.length?t[c]:null,y=p?p.fromA:1e9;if(y-h>=n)for(;o&&o.from<y;){let b=o;if(h>=b.from||y<=b.to||d){let v=Math.max(b.from,h)-d,w=Math.min(b.to,y)-d;b=v>=w?null:new Yr(v,w,b.tree,b.offset+d,c>0,!!p)}if(b&&r.push(b),o.to>y)break;o=a<e.length?e[a++]:null}if(!p)break;h=p.toA,d=p.toA-p.toB}return r}}class NC{startParse(e,t,n){return typeof e=="string"&&(e=new C4(e)),n=n?n.length?n.map(r=>new hp(r.from,r.to)):[new hp(0,0)]:[new hp(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let a=r.advance();if(a)return a}}}class C4{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new Re({perNode:!0});let A4=0;class qn{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=A4++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let n=typeof e=="string"?e:"?";if(e instanceof qn&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let r=new qn(n,[],null,[]);if(r.set.push(r),t)for(let a of t.set)r.set.push(a);return r}static defineModifier(e){let t=new If(e);return n=>n.modified.indexOf(t)>-1?n:If.get(n.base||n,n.modified.concat(t).sort((r,a)=>r.id-a.id))}}let T4=0;class If{constructor(e){this.name=e,this.instances=[],this.id=T4++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find(c=>c.base==e&&O4(t,c.modified));if(n)return n;let r=[],a=new qn(e.name,r,e,t);for(let c of t)c.instances.push(a);let o=M4(t);for(let c of e.set)if(!c.modified.length)for(let h of o)r.push(If.get(c,h));return a}}function O4(i,e){return i.length==e.length&&i.every((t,n)=>t==e[n])}function M4(i){let e=[[]];for(let t=0;t<i.length;t++)for(let n=0,r=e.length;n<r;n++)e.push(e[n].concat(i[t]));return e.sort((t,n)=>n.length-t.length)}function BC(i){let e=Object.create(null);for(let t in i){let n=i[t];Array.isArray(n)||(n=[n]);for(let r of t.split(" "))if(r){let a=[],o=2,c=r;for(let y=0;;){if(c=="..."&&y>0&&y+3==r.length){o=1;break}let b=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(c);if(!b)throw new RangeError("Invalid path: "+r);if(a.push(b[0]=="*"?"":b[0][0]=='"'?JSON.parse(b[0]):b[0]),y+=b[0].length,y==r.length)break;let v=r[y++];if(y==r.length&&v=="!"){o=0;break}if(v!="/")throw new RangeError("Invalid path: "+r);c=r.slice(y)}let h=a.length-1,d=a[h];if(!d)throw new RangeError("Invalid path: "+r);let p=new uu(n,o,h>0?a.slice(0,h):null);e[d]=p.sort(e[d])}}return LC.add(e)}const LC=new Re({combine(i,e){let t,n,r;for(;i||e;){if(!i||e&&i.depth>=e.depth?(r=e,e=e.next):(r=i,i=i.next),t&&t.mode==r.mode&&!r.context&&!t.context)continue;let a=new uu(r.tags,r.mode,r.context);t?t.next=a:n=a,t=a}return n}});class uu{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}uu.empty=new uu([],2,null);function jC(i,e){let t=Object.create(null);for(let a of i)if(!Array.isArray(a.tag))t[a.tag.id]=a.class;else for(let o of a.tag)t[o.id]=a.class;let{scope:n,all:r=null}=e||{};return{style:a=>{let o=r;for(let c of a)for(let h of c.set){let d=t[h.id];if(d){o=o?o+" "+d:d;break}}return o},scope:n}}function E4(i,e){let t=null;for(let n of i){let r=n.style(e);r&&(t=t?t+" "+r:r)}return t}function R4(i,e,t,n=0,r=i.length){let a=new D4(n,Array.isArray(e)?e:[e],t);a.highlightRange(i.cursor(),n,r,"",a.highlighters),a.flush(r)}class D4{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,a){let{type:o,from:c,to:h}=e;if(c>=n||h<=t)return;o.isTop&&(a=this.highlighters.filter(v=>!v.scope||v.scope(o)));let d=r,p=N4(e)||uu.empty,y=E4(a,p.tags);if(y&&(d&&(d+=" "),d+=y,p.mode==1&&(r+=(r?" ":"")+y)),this.startSpan(Math.max(t,c),d),p.opaque)return;let b=e.tree&&e.tree.prop(Re.mounted);if(b&&b.overlay){let v=e.node.enter(b.overlay[0].from+c,1),w=this.highlighters.filter(A=>!A.scope||A.scope(b.tree.type)),k=e.firstChild();for(let A=0,O=c;;A++){let D=A<b.overlay.length?b.overlay[A]:null,B=D?D.from+c:h,V=Math.max(t,O),j=Math.min(n,B);if(V<j&&k)for(;e.from<j&&(this.highlightRange(e,V,j,r,a),this.startSpan(Math.min(j,e.to),d),!(e.to>=B||!e.nextSibling())););if(!D||B>n)break;O=D.to+c,O>t&&(this.highlightRange(v.cursor(),Math.max(t,D.from+c),Math.min(n,O),"",w),this.startSpan(Math.min(n,O),d))}k&&e.parent()}else if(e.firstChild()){b&&(r="");do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,a),this.startSpan(Math.min(n,e.to),d)}while(e.nextSibling());e.parent()}}}function N4(i){let e=i.type.prop(LC);for(;e&&e.context&&!i.matchContext(e.context);)e=e.next;return e||null}const se=qn.define,uf=se(),Ps=se(),oS=se(Ps),uS=se(Ps),qs=se(),cf=se(qs),dp=se(qs),Si=se(),Dr=se(Si),vi=se(),xi=se(),Ag=se(),Uo=se(Ag),ff=se(),J={comment:uf,lineComment:se(uf),blockComment:se(uf),docComment:se(uf),name:Ps,variableName:se(Ps),typeName:oS,tagName:se(oS),propertyName:uS,attributeName:se(uS),className:se(Ps),labelName:se(Ps),namespace:se(Ps),macroName:se(Ps),literal:qs,string:cf,docString:se(cf),character:se(cf),attributeValue:se(cf),number:dp,integer:se(dp),float:se(dp),bool:se(qs),regexp:se(qs),escape:se(qs),color:se(qs),url:se(qs),keyword:vi,self:se(vi),null:se(vi),atom:se(vi),unit:se(vi),modifier:se(vi),operatorKeyword:se(vi),controlKeyword:se(vi),definitionKeyword:se(vi),moduleKeyword:se(vi),operator:xi,derefOperator:se(xi),arithmeticOperator:se(xi),logicOperator:se(xi),bitwiseOperator:se(xi),compareOperator:se(xi),updateOperator:se(xi),definitionOperator:se(xi),typeOperator:se(xi),controlOperator:se(xi),punctuation:Ag,separator:se(Ag),bracket:Uo,angleBracket:se(Uo),squareBracket:se(Uo),paren:se(Uo),brace:se(Uo),content:Si,heading:Dr,heading1:se(Dr),heading2:se(Dr),heading3:se(Dr),heading4:se(Dr),heading5:se(Dr),heading6:se(Dr),contentSeparator:se(Si),list:se(Si),quote:se(Si),emphasis:se(Si),strong:se(Si),link:se(Si),monospace:se(Si),strikethrough:se(Si),inserted:se(),deleted:se(),changed:se(),invalid:se(),meta:ff,documentMeta:se(ff),annotation:se(ff),processingInstruction:se(ff),definition:qn.defineModifier("definition"),constant:qn.defineModifier("constant"),function:qn.defineModifier("function"),standard:qn.defineModifier("standard"),local:qn.defineModifier("local"),special:qn.defineModifier("special")};for(let i in J){let e=J[i];e instanceof qn&&(e.name=i)}jC([{tag:J.link,class:"tok-link"},{tag:J.heading,class:"tok-heading"},{tag:J.emphasis,class:"tok-emphasis"},{tag:J.strong,class:"tok-strong"},{tag:J.keyword,class:"tok-keyword"},{tag:J.atom,class:"tok-atom"},{tag:J.bool,class:"tok-bool"},{tag:J.url,class:"tok-url"},{tag:J.labelName,class:"tok-labelName"},{tag:J.inserted,class:"tok-inserted"},{tag:J.deleted,class:"tok-deleted"},{tag:J.literal,class:"tok-literal"},{tag:J.string,class:"tok-string"},{tag:J.number,class:"tok-number"},{tag:[J.regexp,J.escape,J.special(J.string)],class:"tok-string2"},{tag:J.variableName,class:"tok-variableName"},{tag:J.local(J.variableName),class:"tok-variableName tok-local"},{tag:J.definition(J.variableName),class:"tok-variableName tok-definition"},{tag:J.special(J.variableName),class:"tok-variableName2"},{tag:J.definition(J.propertyName),class:"tok-propertyName tok-definition"},{tag:J.typeName,class:"tok-typeName"},{tag:J.namespace,class:"tok-namespace"},{tag:J.className,class:"tok-className"},{tag:J.macroName,class:"tok-macroName"},{tag:J.propertyName,class:"tok-propertyName"},{tag:J.operator,class:"tok-operator"},{tag:J.comment,class:"tok-comment"},{tag:J.meta,class:"tok-meta"},{tag:J.invalid,class:"tok-invalid"},{tag:J.punctuation,class:"tok-punctuation"}]);var mp;const Yl=new Re;function B4(i){return he.define({combine:i?e=>e.concat(i):void 0})}const L4=new Re;class si{constructor(e,t,n=[],r=""){this.data=e,this.name=r,Pe.prototype.hasOwnProperty("tree")||Object.defineProperty(Pe.prototype,"tree",{get(){return Qt(this)}}),this.parser=t,this.extension=[ur.of(this),Pe.languageData.of((a,o,c)=>{let h=cS(a,o,c),d=h.type.prop(Yl);if(!d)return[];let p=a.facet(d),y=h.type.prop(L4);if(y){let b=h.resolve(o-h.from,c);for(let v of y)if(v.test(b,a)){let w=a.facet(v.facet);return v.type=="replace"?w:w.concat(p)}}return p})].concat(n)}isActiveAt(e,t,n=-1){return cS(e,t,n).type.prop(Yl)==this.data}findRegions(e){let t=e.facet(ur);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(a,o)=>{if(a.prop(Yl)==this.data){n.push({from:o,to:o+a.length});return}let c=a.prop(Re.mounted);if(c){if(c.tree.prop(Yl)==this.data){if(c.overlay)for(let h of c.overlay)n.push({from:h.from+o,to:h.to+o});else n.push({from:o,to:o+a.length});return}else if(c.overlay){let h=n.length;if(r(c.tree,c.overlay[0].from+o),n.length>h)return}}for(let h=0;h<a.children.length;h++){let d=a.children[h];d instanceof ht&&r(d,a.positions[h]+o)}};return r(Qt(e),0),n}get allowsNesting(){return!0}}si.setState=Ye.define();function cS(i,e,t){let n=i.facet(ur),r=Qt(i).topNode;if(!n||n.allowsNesting)for(let a=r;a;a=a.enter(e,t,ot.ExcludeBuffers|ot.EnterBracketed))a.type.isTop&&(r=a);return r}class Gf extends si{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(e){let t=B4(e.languageData);return new Gf(t,e.parser.configure({props:[Yl.add(n=>n.isTop?t:void 0)]}),e.name)}configure(e,t){return new Gf(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Qt(i){let e=i.field(si.state,!1);return e?e.tree:ht.empty}class j4{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let Po=null;class Ff{constructor(e,t,n=[],r,a,o,c,h){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=a,this.viewport=o,this.skipped=c,this.scheduleOn=h,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new Ff(e,t,[],ht.empty,0,n,[],null)}startParse(){return this.parser.startParse(new j4(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=ht.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var n;if(typeof e=="number"){let r=Date.now()+e;e=()=>Date.now()>r}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let r=this.parse.advance();if(r)if(this.fragments=this.withoutTempSkipped(Yr.addTree(r,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(n=this.parse.stoppedAt)!==null&&n!==void 0?n:this.state.doc.length,this.tree=r,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Yr.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Po;Po=this;try{return e()}finally{Po=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=fS(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:r,treeLen:a,viewport:o,skipped:c}=this;if(this.takeTree(),!e.empty){let h=[];if(e.iterChangedRanges((d,p,y,b)=>h.push({fromA:d,toA:p,fromB:y,toB:b})),n=Yr.applyChanges(n,h),r=ht.empty,a=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){c=[];for(let d of this.skipped){let p=e.mapPos(d.from,1),y=e.mapPos(d.to,-1);p<y&&c.push({from:p,to:y})}}}return new Ff(this.parser,t,n,r,a,o,c,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let n=0;n<this.skipped.length;n++){let{from:r,to:a}=this.skipped[n];r<e.to&&a>e.from&&(this.fragments=fS(this.fragments,r,a),this.skipped.splice(n--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends NC{createParse(t,n,r){let a=r[0].from,o=r[r.length-1].to;return{parsedPos:a,advance(){let h=Po;if(h){for(let d of r)h.tempSkipped.push(d);e&&(h.scheduleOn=h.scheduleOn?Promise.all([h.scheduleOn,e]):e)}return this.parsedPos=o,new ht(hn.none,[],[],o-a)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Po}}function fS(i,e,t){return Yr.applyChanges(i,[{fromA:e,toA:t,fromB:e,toB:t}])}class xa{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new xa(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=Ff.create(e.facet(ur).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new xa(n)}}si.state=Yn.define({create:xa.init,update(i,e){for(let t of e.effects)if(t.is(si.setState))return t.value;return e.startState.facet(ur)!=e.state.facet(ur)?xa.init(e.state):i.apply(e)}});let zC=i=>{let e=setTimeout(()=>i(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(zC=i=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(i,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const pp=typeof navigator<"u"&&(!((mp=navigator.scheduling)===null||mp===void 0)&&mp.isInputPending)?()=>navigator.scheduling.isInputPending():null,z4=fn.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(si.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(si.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=zC(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,a=n.field(si.state);if(a.tree==a.context.tree&&a.context.isDone(r+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!pp?Math.max(25,e.timeRemaining()-5):1e9),c=a.context.treeLen<r&&n.doc.length>r+1e3,h=a.context.work(()=>pp&&pp()||Date.now()>o,r+(c?0:1e5));this.chunkBudget-=Date.now()-t,(h||this.chunkBudget<=0)&&(a.context.takeTree(),this.view.dispatch({effects:si.setState.of(new xa(a.context))})),this.chunkBudget>0&&!(h&&!c)&&this.scheduleWork(),this.checkAsyncSchedule(a.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>En(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),ur=he.define({combine(i){return i.length?i[0]:null},enables:i=>[si.state,z4,pe.contentAttributes.compute([i],e=>{let t=e.facet(i);return t&&t.name?{"data-language":t.name}:{}})]});class _4{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const H4=he.define(),y0=he.define({combine:i=>{if(!i.length)return" ";let e=i[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(i[0]));return e}});function Yf(i){let e=i.facet(y0);return e.charCodeAt(0)==9?i.tabSize*e.length:e.length}function cu(i,e){let t="",n=i.tabSize,r=i.facet(y0)[0];if(r==" "){for(;e>=n;)t+=" ",e-=n;r=" "}for(let a=0;a<e;a++)t+=r;return t}function b0(i,e){i instanceof Pe&&(i=new dh(i));for(let n of i.state.facet(H4)){let r=n(i,e);if(r!==void 0)return r}let t=Qt(i.state);return t.length>=e?U4(i,t,e):null}class dh{constructor(e,t={}){this.state=e,this.options=t,this.unit=Yf(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:a}=this.options;return r!=null&&r>=n.from&&r<=n.to?a&&r==e?{text:"",from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),a=this.countColumn(n,e-r),o=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return o>-1&&(a+=o-this.countColumn(n,n.search(/\S|$/))),a}countColumn(e,t=e.length){return ah(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),a=this.options.overrideIndentation;if(a){let o=a(r);if(o>-1)return o}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const _C=new Re;function U4(i,e,t){let n=e.resolveStack(t),r=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(r!=n.node){let a=[];for(let o=r;o&&!(o.from<n.node.from||o.to>n.node.to||o.from==n.node.from&&o.type==n.node.type);o=o.parent)a.push(o);for(let o=a.length-1;o>=0;o--)n={node:a[o],next:n}}return HC(n,i,t)}function HC(i,e,t){for(let n=i;n;n=n.next){let r=q4(n.node);if(r)return r(v0.create(e,t,n))}return 0}function P4(i){return i.pos==i.options.simulateBreak&&i.options.simulateDoubleBreak}function q4(i){let e=i.type.prop(_C);if(e)return e;let t=i.firstChild,n;if(t&&(n=t.type.prop(Re.closedBy))){let r=i.lastChild,a=r&&n.indexOf(r.name)>-1;return o=>G4(o,!0,1,void 0,a&&!P4(o)?r.from:void 0)}return i.parent==null?V4:null}function V4(){return 0}class v0 extends dh{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new v0(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(Q4(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return HC(this.context.next,this.base,this.pos)}}function Q4(i,e){for(let t=e;t;t=t.parent)if(i==t)return!0;return!1}function I4(i){let e=i.node,t=e.childAfter(e.from),n=e.lastChild;if(!t)return null;let r=i.options.simulateBreak,a=i.state.doc.lineAt(t.from),o=r==null||r<=a.from?a.to:Math.min(a.to,r);for(let c=t.to;;){let h=e.childAfter(c);if(!h||h==n)return null;if(!h.type.isSkipped){if(h.from>=o)return null;let d=/^ */.exec(a.text.slice(t.to-a.from))[0].length;return{from:t.from,to:t.to+d}}c=h.to}}function G4(i,e,t,n,r){let a=i.textAfter,o=a.match(/^\s*/)[0].length,c=n&&a.slice(o,o+n.length)==n||r==i.pos+o,h=I4(i);return h?c?i.column(h.from):i.column(h.to):i.baseIndent+(c?0:i.unit*t)}function F4({except:i,units:e=1}={}){return t=>{let n=i&&i.test(t.textAfter);return t.baseIndent+(n?0:e*t.unit)}}const Y4=200;function K4(){return Pe.transactionFilter.of(i=>{if(!i.docChanged||!i.isUserEvent("input.type")&&!i.isUserEvent("input.complete"))return i;let e=i.startState.languageDataAt("indentOnInput",i.startState.selection.main.head);if(!e.length)return i;let t=i.newDoc,{head:n}=i.newSelection.main,r=t.lineAt(n);if(n>r.from+Y4)return i;let a=t.sliceString(r.from,n);if(!e.some(d=>d.test(a)))return i;let{state:o}=i,c=-1,h=[];for(let{head:d}of o.selection.ranges){let p=o.doc.lineAt(d);if(p.from==c)continue;c=p.from;let y=b0(o,p.from);if(y==null)continue;let b=/^\s*/.exec(p.text)[0],v=cu(o,y);b!=v&&h.push({from:p.from,to:p.from+b.length,insert:v})}return h.length?[i,{changes:h,sequential:!0}]:i})}const X4=he.define(),UC=new Re;function W4(i,e,t){let n=Qt(i);if(n.length<t)return null;let r=n.resolveStack(t,1),a=null;for(let o=r;o;o=o.next){let c=o.node;if(c.to<=t||c.from>t)continue;if(a&&c.from<e)break;let h=c.type.prop(UC);if(h&&(c.to<n.length-50||n.length==i.doc.length||!$4(c))){let d=h(c,i);d&&d.from<=t&&d.from>=e&&d.to>t&&(a=d)}}return a}function $4(i){let e=i.lastChild;return e&&e.to==i.to&&e.type.isError}function hS(i,e,t){for(let n of i.facet(X4)){let r=n(i,e,t);if(r)return r}return W4(i,e,t)}function PC(i,e){let t=e.mapPos(i.from,1),n=e.mapPos(i.to,-1);return t>=n?void 0:{from:t,to:n}}const qC=Ye.define({map:PC}),x0=Ye.define({map:PC}),Kf=Yn.define({create(){return Ke.none},update(i,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,n)=>i=dS(i,t,n)),i=i.map(e.changes);for(let t of e.effects)if(t.is(qC)&&!Z4(i,t.value.from,t.value.to)){let{preparePlaceholder:n}=e.state.facet(VC),r=n?Ke.replace({widget:new tB(n(e.state,t.value))}):mS;i=i.update({add:[r.range(t.value.from,t.value.to)]})}else t.is(x0)&&(i=i.update({filter:(n,r)=>t.value.from!=n||t.value.to!=r,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(i=dS(i,e.selection.main.head)),i},provide:i=>pe.decorations.from(i),toJSON(i,e){let t=[];return i.between(0,e.doc.length,(n,r)=>{t.push(n,r)}),t},fromJSON(i){if(!Array.isArray(i)||i.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<i.length;){let n=i[t++],r=i[t++];if(typeof n!="number"||typeof r!="number")throw new RangeError("Invalid JSON for fold state");e.push(mS.range(n,r))}return Ke.set(e,!0)}});function dS(i,e,t=e){let n=!1;return i.between(e,t,(r,a)=>{r<t&&a>e&&(n=!0)}),n?i.update({filterFrom:e,filterTo:t,filter:(r,a)=>r>=t||a<=e}):i}function Tg(i,e,t){var n;let r=null;return(n=i.field(Kf,!1))===null||n===void 0||n.between(e,t,(a,o)=>{(!r||r.from>a)&&(r={from:a,to:o})}),r}function Z4(i,e,t){let n=!1;return i.between(e,e,(r,a)=>{r==e&&a==t&&(n=!0)}),n}const J4={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},VC=he.define({combine(i){return Da(i,J4)}});function eB(i){return[Kf,sB]}function QC(i,e){let{state:t}=i,n=t.facet(VC),r=o=>{let c=i.lineBlockAt(i.posAtDOM(o.target)),h=Tg(i.state,c.from,c.to);h&&i.dispatch({effects:x0.of(h)}),o.preventDefault()};if(n.placeholderDOM)return n.placeholderDOM(i,r,e);let a=document.createElement("span");return a.textContent=n.placeholderText,a.setAttribute("aria-label",t.phrase("folded code")),a.title=t.phrase("unfold"),a.className="cm-foldPlaceholder",a.onclick=r,a}const mS=Ke.replace({widget:new class extends Na{toDOM(i){return QC(i,null)}}});class tB extends Na{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return QC(e,this.value)}}const nB={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class gp extends ls{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function iB(i={}){let e={...nB,...i},t=new gp(e,!0),n=new gp(e,!1),r=fn.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(ur)!=o.state.facet(ur)||o.startState.field(Kf,!1)!=o.state.field(Kf,!1)||Qt(o.startState)!=Qt(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let c=new ga;for(let h of o.viewportLineBlocks){let d=Tg(o.state,h.from,h.to)?n:hS(o.state,h.from,h.to)?t:null;d&&c.add(h.from,h.from,d)}return c.finish()}}),{domEventHandlers:a}=e;return[r,a4({class:"cm-foldGutter",markers(o){var c;return((c=o.plugin(r))===null||c===void 0?void 0:c.markers)||Be.empty},initialSpacer(){return new gp(e,!1)},domEventHandlers:{...a,click:(o,c,h)=>{if(a.click&&a.click(o,c,h))return!0;let d=Tg(o.state,c.from,c.to);if(d)return o.dispatch({effects:x0.of(d)}),!0;let p=hS(o.state,c.from,c.to);return p?(o.dispatch({effects:qC.of(p)}),!0):!1}}}),eB()]}const sB=pe.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class mh{constructor(e,t){this.specs=e;let n;function r(c){let h=rr.newName();return(n||(n=Object.create(null)))["."+h]=c,h}const a=typeof t.all=="string"?t.all:t.all?r(t.all):void 0,o=t.scope;this.scope=o instanceof si?c=>c.prop(Yl)==o.data:o?c=>c==o:void 0,this.style=jC(e.map(c=>({tag:c.tag,class:c.class||r(Object.assign({},c,{tag:null}))})),{all:a}).style,this.module=n?new rr(n):null,this.themeType=t.themeType}static define(e,t){return new mh(e,t||{})}}const Og=he.define(),IC=he.define({combine(i){return i.length?[i[0]]:null}});function yp(i){let e=i.facet(Og);return e.length?e:i.facet(IC)}function rB(i,e){let t=[aB],n;return i instanceof mh&&(i.module&&t.push(pe.styleModule.of(i.module)),n=i.themeType),e!=null&&e.fallback?t.push(IC.of(i)):n?t.push(Og.computeN([pe.darkTheme],r=>r.facet(pe.darkTheme)==(n=="dark")?[i]:[])):t.push(Og.of(i)),t}class lB{constructor(e){this.markCache=Object.create(null),this.tree=Qt(e.state),this.decorations=this.buildDeco(e,yp(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Qt(e.state),n=yp(e.state),r=n!=yp(e.startState),{viewport:a}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<a.to&&!r&&t.type==this.tree.type&&o>=a.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=a.to)}buildDeco(e,t){if(!t||!this.tree.length)return Ke.none;let n=new ga;for(let{from:r,to:a}of e.visibleRanges)R4(this.tree,t,(o,c,h)=>{n.add(o,c,this.markCache[h]||(this.markCache[h]=Ke.mark({class:h})))},r,a);return n.finish()}}const aB=Ea.high(fn.fromClass(lB,{decorations:i=>i.decorations})),oB=mh.define([{tag:J.meta,color:"#404740"},{tag:J.link,textDecoration:"underline"},{tag:J.heading,textDecoration:"underline",fontWeight:"bold"},{tag:J.emphasis,fontStyle:"italic"},{tag:J.strong,fontWeight:"bold"},{tag:J.strikethrough,textDecoration:"line-through"},{tag:J.keyword,color:"#708"},{tag:[J.atom,J.bool,J.url,J.contentSeparator,J.labelName],color:"#219"},{tag:[J.literal,J.inserted],color:"#164"},{tag:[J.string,J.deleted],color:"#a11"},{tag:[J.regexp,J.escape,J.special(J.string)],color:"#e40"},{tag:J.definition(J.variableName),color:"#00f"},{tag:J.local(J.variableName),color:"#30a"},{tag:[J.typeName,J.namespace],color:"#085"},{tag:J.className,color:"#167"},{tag:[J.special(J.variableName),J.macroName],color:"#256"},{tag:J.definition(J.propertyName),color:"#00c"},{tag:J.comment,color:"#940"},{tag:J.invalid,color:"#f00"}]),uB=pe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),GC=1e4,FC="()[]{}",YC=he.define({combine(i){return Da(i,{afterCursor:!0,brackets:FC,maxScanDistance:GC,renderMatch:hB})}}),cB=Ke.mark({class:"cm-matchingBracket"}),fB=Ke.mark({class:"cm-nonmatchingBracket"});function hB(i){let e=[],t=i.matched?cB:fB;return e.push(t.range(i.start.from,i.start.to)),i.end&&e.push(t.range(i.end.from,i.end.to)),e}const dB=Yn.define({create(){return Ke.none},update(i,e){if(!e.docChanged&&!e.selection)return i;let t=[],n=e.state.facet(YC);for(let r of e.state.selection.ranges){if(!r.empty)continue;let a=Oi(e.state,r.head,-1,n)||r.head>0&&Oi(e.state,r.head-1,1,n)||n.afterCursor&&(Oi(e.state,r.head,1,n)||r.head<e.state.doc.length&&Oi(e.state,r.head+1,-1,n));a&&(t=t.concat(n.renderMatch(a,e.state)))}return Ke.set(t,!0)},provide:i=>pe.decorations.from(i)}),mB=[dB,uB];function pB(i={}){return[YC.of(i),mB]}const gB=new Re;function Mg(i,e,t){let n=i.prop(e<0?Re.openedBy:Re.closedBy);if(n)return n;if(i.name.length==1){let r=t.indexOf(i.name);if(r>-1&&r%2==(e<0?1:0))return[t[r+e]]}return null}function Eg(i){let e=i.type.prop(gB);return e?e(i.node):i}function Oi(i,e,t,n={}){let r=n.maxScanDistance||GC,a=n.brackets||FC,o=Qt(i),c=o.resolveInner(e,t);for(let h=c;h;h=h.parent){let d=Mg(h.type,t,a);if(d&&h.from<h.to){let p=Eg(h);if(p&&(t>0?e>=p.from&&e<p.to:e>p.from&&e<=p.to))return yB(i,e,t,h,p,d,a)}}return bB(i,e,t,o,c.type,r,a)}function yB(i,e,t,n,r,a,o){let c=n.parent,h={from:r.from,to:r.to},d=0,p=c==null?void 0:c.cursor();if(p&&(t<0?p.childBefore(n.from):p.childAfter(n.to)))do if(t<0?p.to<=n.from:p.from>=n.to){if(d==0&&a.indexOf(p.type.name)>-1&&p.from<p.to){let y=Eg(p);return{start:h,end:y?{from:y.from,to:y.to}:void 0,matched:!0}}else if(Mg(p.type,t,o))d++;else if(Mg(p.type,-t,o)){if(d==0){let y=Eg(p);return{start:h,end:y&&y.from<y.to?{from:y.from,to:y.to}:void 0,matched:!1}}d--}}while(t<0?p.prevSibling():p.nextSibling());return{start:h,matched:!1}}function bB(i,e,t,n,r,a,o){let c=t<0?i.sliceDoc(e-1,e):i.sliceDoc(e,e+1),h=o.indexOf(c);if(h<0||h%2==0!=t>0)return null;let d={from:t<0?e-1:e,to:t>0?e+1:e},p=i.doc.iterRange(e,t>0?i.doc.length:0),y=0;for(let b=0;!p.next().done&&b<=a;){let v=p.value;t<0&&(b+=v.length);let w=e+b*t;for(let k=t>0?0:v.length-1,A=t>0?v.length:-1;k!=A;k+=t){let O=o.indexOf(v[k]);if(!(O<0||n.resolveInner(w+k,1).type!=r))if(O%2==0==t>0)y++;else{if(y==1)return{start:d,end:{from:w+k,to:w+k+1},matched:O>>1==h>>1};y--}}t>0&&(b+=v.length)}return p.done?{start:d,matched:!1}:null}const vB=Object.create(null),pS=[hn.none],gS=[],yS=Object.create(null),xB=Object.create(null);for(let[i,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])xB[i]=SB(vB,e);function bp(i,e){gS.indexOf(i)>-1||(gS.push(i),console.warn(e))}function SB(i,e){let t=[];for(let c of e.split(" ")){let h=[];for(let d of c.split(".")){let p=i[d]||J[d];p?typeof p=="function"?h.length?h=h.map(p):bp(d,`Modifier ${d} used at start of tag`):h.length?bp(d,`Tag ${d} used as modifier`):h=Array.isArray(p)?p:[p]:bp(d,`Unknown highlighting tag ${d}`)}for(let d of h)t.push(d)}if(!t.length)return 0;let n=e.replace(/ /g,"_"),r=n+" "+t.map(c=>c.id),a=yS[r];if(a)return a.id;let o=yS[r]=hn.define({id:pS.length,name:n,props:[BC({[n]:t})]});return pS.push(o),o.id}et.RTL,et.LTR;class KC{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Qt(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),a=r.search(WC(e,!1));return a<0?null:{from:n+a,to:this.pos,text:r.slice(a)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}}function bS(i){let e=Object.keys(i).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function wB(i){let e=Object.create(null),t=Object.create(null);for(let{label:r}of i){e[r[0]]=!0;for(let a=1;a<r.length;a++)t[r[a]]=!0}let n=bS(e)+bS(t)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function XC(i){let e=i.map(r=>typeof r=="string"?{label:r}:r),[t,n]=e.every(r=>/^\w+$/.test(r.label))?[/\w*$/,/\w+$/]:wB(e);return r=>{let a=r.matchBefore(n);return a||r.explicit?{from:a?a.from:r.pos,options:e,validFor:t}:null}}function kB(i,e){return t=>{for(let n=Qt(t.state).resolveInner(t.pos,-1);n;n=n.parent){if(i.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(t)}}class vS{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}}function Kr(i){return i.selection.main.from}function WC(i,e){var t;let{source:n}=i,r=e&&n[0]!="^",a=n[n.length-1]!="$";return!r&&!a?i:new RegExp(`${r?"^":""}(?:${n})${a?"$":""}`,(t=i.flags)!==null&&t!==void 0?t:i.ignoreCase?"i":"")}const $C=us.define();function CB(i,e,t,n){let{main:r}=i.selection,a=t-r.from,o=n-r.from;return{...i.changeByRange(c=>{if(c!=r&&t!=n&&i.sliceDoc(c.from+a,c.from+o)!=i.sliceDoc(t,n))return{range:c};let h=i.toText(e);return{changes:{from:c.from+a,to:n==r.from?c.to:c.from+o,insert:h},range:ee.cursor(c.from+a+h.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const xS=new WeakMap;function AB(i){if(!Array.isArray(i))return i;let e=xS.get(i);return e||xS.set(i,e=XC(i)),e}const Xf=Ye.define(),fu=Ye.define();class TB{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let n=Br(e,t),r=Il(n);this.chars.push(n);let a=e.slice(t,t+r),o=a.toUpperCase();this.folded.push(Br(o==a?a.toLowerCase():o,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:a,byWord:o}=this;if(t.length==1){let D=Br(e,0),B=Il(D),V=B==e.length?0:-100;if(D!=t[0])if(D==n[0])V+=-200;else return null;return this.ret(V,[0,B])}let c=e.indexOf(this.pattern);if(c==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let h=t.length,d=0;if(c<0){for(let D=0,B=Math.min(e.length,200);D<B&&d<h;){let V=Br(e,D);(V==t[d]||V==n[d])&&(r[d++]=D),D+=Il(V)}if(d<h)return null}let p=0,y=0,b=!1,v=0,w=-1,k=-1,A=/[a-z]/.test(e),O=!0;for(let D=0,B=Math.min(e.length,200),V=0;D<B&&y<h;){let j=Br(e,D);c<0&&(p<h&&j==t[p]&&(a[p++]=D),v<h&&(j==t[v]||j==n[v]?(v==0&&(w=D),k=D+1,v++):v=0));let Q,I=j<255?j>=48&&j<=57||j>=97&&j<=122?2:j>=65&&j<=90?1:0:(Q=HD(j))!=Q.toLowerCase()?1:Q!=Q.toUpperCase()?2:0;(!D||I==1&&A||V==0&&I!=0)&&(t[y]==j||n[y]==j&&(b=!0)?o[y++]=D:o.length&&(O=!1)),V=I,D+=Il(j)}return y==h&&o[0]==0&&O?this.result(-100+(b?-200:0),o,e):v==h&&w==0?this.ret(-200-e.length+(k==e.length?0:-100),[0,k]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):v==h?this.ret(-900-e.length,[w,k]):y==h?this.result(-100+(b?-200:0)+-700+(O?0:-1100),o,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],a=0;for(let o of t){let c=o+(this.astral?Il(Br(n,o)):1);a&&r[a-1]==o?r[a-1]=c:(r[a++]=o,r[a++]=c)}return this.ret(e-n.length,r)}}class OB{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}}const Mt=he.define({combine(i){return Da(i,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:MB,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>n=>SS(e(n),t(n)),optionClass:(e,t)=>n=>SS(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function SS(i,e){return i?e?i+" "+e:i:e}function MB(i,e,t,n,r,a){let o=i.textDirection==et.RTL,c=o,h=!1,d="top",p,y,b=e.left-r.left,v=r.right-e.right,w=n.right-n.left,k=n.bottom-n.top;if(c&&b<Math.min(w,v)?c=!1:!c&&v<Math.min(w,b)&&(c=!0),w<=(c?b:v))p=Math.max(r.top,Math.min(t.top,r.bottom-k))-e.top,y=Math.min(400,c?b:v);else{h=!0,y=Math.min(400,(o?e.right:r.right-e.left)-30);let D=r.bottom-e.bottom;D>=k||D>e.top?p=t.bottom-e.top:(d="bottom",p=e.bottom-t.top)}let A=(e.bottom-e.top)/a.offsetHeight,O=(e.right-e.left)/a.offsetWidth;return{style:`${d}: ${p/A}px; max-width: ${y/O}px`,class:"cm-completionInfo-"+(h?o?"left-narrow":"right-narrow":c?"left":"right")}}function EB(i){let e=i.addToOptions.slice();return i.icons&&e.push({render(t){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),t.type&&n.classList.add(...t.type.split(/\s+/g).map(r=>"cm-completionIcon-"+r)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(t,n,r,a){let o=document.createElement("span");o.className="cm-completionLabel";let c=t.displayLabel||t.label,h=0;for(let d=0;d<a.length;){let p=a[d++],y=a[d++];p>h&&o.appendChild(document.createTextNode(c.slice(h,p)));let b=o.appendChild(document.createElement("span"));b.appendChild(document.createTextNode(c.slice(p,y))),b.className="cm-completionMatchedText",h=y}return h<c.length&&o.appendChild(document.createTextNode(c.slice(h))),o},position:50},{render(t){if(!t.detail)return null;let n=document.createElement("span");return n.className="cm-completionDetail",n.textContent=t.detail,n},position:80}),e.sort((t,n)=>t.position-n.position).map(t=>t.render)}function vp(i,e,t){if(i<=t)return{from:0,to:i};if(e<0&&(e=0),e<=i>>1){let r=Math.floor(e/t);return{from:r*t,to:(r+1)*t}}let n=Math.floor((i-e)/t);return{from:i-(n+1)*t,to:i-n*t}}class RB{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:h=>this.placeInfo(h),key:this},this.space=null,this.currentClass="";let r=e.state.field(t),{options:a,selected:o}=r.open,c=e.state.facet(Mt);this.optionContent=EB(c),this.optionClass=c.optionClass,this.tooltipClass=c.tooltipClass,this.range=vp(a.length,o,c.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",h=>{let{options:d}=e.state.field(t).open;for(let p=h.target,y;p&&p!=this.dom;p=p.parentNode)if(p.nodeName=="LI"&&(y=/-(\d+)$/.exec(p.id))&&+y[1]<d.length){this.applyCompletion(e,d[+y[1]]),h.preventDefault();return}}),this.dom.addEventListener("focusout",h=>{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(Mt).closeOnBlur&&h.relatedTarget!=e.contentDOM&&e.dispatch({effects:fu.of(null)})}),this.showOptions(a,r.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let n=e.state.field(this.stateField),r=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=r){let{options:a,selected:o,disabled:c}=n.open;(!r.open||r.open.options!=a)&&(this.range=vp(a.length,o,e.state.facet(Mt).maxRenderedOptions),this.showOptions(a,n.id)),this.updateSel(),c!=((t=r.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!c)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of t.split(" "))n&&this.dom.classList.add(n);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=vp(t.options.length,t.selected,this.view.state.facet(Mt).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:a}=r;if(!a)return;let o=typeof a=="string"?document.createTextNode(a):a(r);if(!o)return;"then"in o?o.then(c=>{c&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(c,r)}).catch(c=>En(this.view.state,c,"completion info")):(this.addInfoPane(o,r),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:r,destroy:a}=e;n.appendChild(r),this.infoDestroy=a||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!="LI"||!n.id?r--:r==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return t&&NB(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),a=this.space;if(!a){let o=this.dom.ownerDocument.documentElement;a={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return r.top>Math.min(a.bottom,t.bottom)-10||r.bottom<Math.max(a.top,t.top)+10?null:this.view.state.facet(Mt).positionInfo(this.view,t,r,n,a,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,n){const r=document.createElement("ul");r.id=t,r.setAttribute("role","listbox"),r.setAttribute("aria-expanded","true"),r.setAttribute("aria-label",this.view.state.phrase("Completions")),r.addEventListener("mousedown",o=>{o.target==r&&o.preventDefault()});let a=null;for(let o=n.from;o<n.to;o++){let{completion:c,match:h}=e[o],{section:d}=c;if(d){let b=typeof d=="string"?d:d.name;if(b!=a&&(o>n.from||n.from==0))if(a=b,typeof d!="string"&&d.header)r.appendChild(d.header(d));else{let v=r.appendChild(document.createElement("completion-section"));v.textContent=b}}const p=r.appendChild(document.createElement("li"));p.id=t+"-"+o,p.setAttribute("role","option");let y=this.optionClass(c);y&&(p.className=y);for(let b of this.optionContent){let v=b(c,this.view.state,this.view,h);v&&p.appendChild(v)}}return n.from&&r.classList.add("cm-completionListIncompleteTop"),n.to<e.length&&r.classList.add("cm-completionListIncompleteBottom"),r}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function DB(i,e){return t=>new RB(t,i,e)}function NB(i,e){let t=i.getBoundingClientRect(),n=e.getBoundingClientRect(),r=t.height/i.offsetHeight;n.top<t.top?i.scrollTop-=(t.top-n.top)/r:n.bottom>t.bottom&&(i.scrollTop+=(n.bottom-t.bottom)/r)}function wS(i){return(i.boost||0)*100+(i.apply?10:0)+(i.info?5:0)+(i.type?1:0)}function BB(i,e){let t=[],n=null,r=null,a=p=>{t.push(p);let{section:y}=p.completion;if(y){n||(n=[]);let b=typeof y=="string"?y:y.name;n.some(v=>v.name==b)||n.push(typeof y=="string"?{name:b}:y)}},o=e.facet(Mt);for(let p of i)if(p.hasResult()){let y=p.result.getMatch;if(p.result.filter===!1)for(let b of p.result.options)a(new vS(b,p.source,y?y(b):[],1e9-t.length));else{let b=e.sliceDoc(p.from,p.to),v,w=o.filterStrict?new OB(b):new TB(b);for(let k of p.result.options)if(v=w.match(k.label)){let A=k.displayLabel?y?y(k,v.matched):[]:v.matched,O=v.score+(k.boost||0);if(a(new vS(k,p.source,A,O)),typeof k.section=="object"&&k.section.rank==="dynamic"){let{name:D}=k.section;r||(r=Object.create(null)),r[D]=Math.max(O,r[D]||-1e9)}}}}if(n){let p=Object.create(null),y=0,b=(v,w)=>(v.rank==="dynamic"&&w.rank==="dynamic"?r[w.name]-r[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof w.rank=="number"?w.rank:1e9)||(v.name<w.name?-1:1);for(let v of n.sort(b))y-=1e5,p[v.name]=y;for(let v of t){let{section:w}=v.completion;w&&(v.score+=p[typeof w=="string"?w:w.name])}}let c=[],h=null,d=o.compareCompletions;for(let p of t.sort((y,b)=>b.score-y.score||d(y.completion,b.completion))){let y=p.completion;!h||h.label!=y.label||h.detail!=y.detail||h.type!=null&&y.type!=null&&h.type!=y.type||h.apply!=y.apply||h.boost!=y.boost?c.push(p):wS(p.completion)>wS(h)&&(c[c.length-1]=p),h=p.completion}return c}class Kl{constructor(e,t,n,r,a,o){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=a,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new Kl(this.options,kS(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,r,a,o){if(r&&!o&&e.some(d=>d.isPending))return r.setDisabled();let c=BB(e,t);if(!c.length)return r&&e.some(d=>d.isPending)?r.setDisabled():null;let h=t.facet(Mt).selectOnOpen?0:-1;if(r&&r.selected!=h&&r.selected!=-1){let d=r.options[r.selected].completion;for(let p=0;p<c.length;p++)if(c[p].completion==d){h=p;break}}return new Kl(c,kS(n,h),{pos:e.reduce((d,p)=>p.hasResult()?Math.min(d,p.from):d,1e8),create:UB,above:a.aboveCursor},r?r.timestamp:Date.now(),h,!1)}map(e){return new Kl(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new Kl(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Wf{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new Wf(_B,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,n=t.facet(Mt),a=(n.override||t.languageDataAt("autocomplete",Kr(t)).map(AB)).map(h=>(this.active.find(p=>p.source==h)||new Qn(h,this.active.some(p=>p.state!=0)?1:0)).update(e,n));a.length==this.active.length&&a.every((h,d)=>h==this.active[d])&&(a=this.active);let o=this.open,c=e.effects.some(h=>h.is(S0));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||a.some(h=>h.hasResult()&&e.changes.touchesRange(h.from,h.to))||!LB(a,this.active)||c?o=Kl.build(a,t,this.id,o,n,c):o&&o.disabled&&!a.some(h=>h.isPending)&&(o=null),!o&&a.every(h=>!h.isPending)&&a.some(h=>h.hasResult())&&(a=a.map(h=>h.hasResult()?new Qn(h.source,0):h));for(let h of e.effects)h.is(JC)&&(o=o&&o.setSelected(h.value,this.id));return a==this.active&&o==this.open?this:new Wf(a,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?jB:zB}}function LB(i,e){if(i==e)return!0;for(let t=0,n=0;;){for(;t<i.length&&!i[t].hasResult();)t++;for(;n<e.length&&!e[n].hasResult();)n++;let r=t==i.length,a=n==e.length;if(r||a)return r==a;if(i[t++].result!=e[n++].result)return!1}}const jB={"aria-autocomplete":"list"},zB={};function kS(i,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":i};return e>-1&&(t["aria-activedescendant"]=i+"-"+e),t}const _B=[];function ZC(i,e){if(i.isUserEvent("input.complete")){let n=i.annotation($C);if(n&&e.activateOnCompletion(n))return 12}let t=i.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:i.isUserEvent("delete.backward")?2:i.selection?8:i.docChanged?16:0}class Qn{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let n=ZC(e,t),r=this;(n&8||n&16&&this.touches(e))&&(r=new Qn(r.source,0)),n&4&&r.state==0&&(r=new Qn(this.source,1)),r=r.updateFor(e,n);for(let a of e.effects)if(a.is(Xf))r=new Qn(r.source,1,a.value);else if(a.is(fu))r=new Qn(r.source,0);else if(a.is(S0))for(let o of a.value)o.source==r.source&&(r=o);return r}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Kr(e.state))}}class ea extends Qn{constructor(e,t,n,r,a,o){super(e,3,t),this.limit=n,this.result=r,this.from=a,this.to=o}hasResult(){return!0}updateFor(e,t){var n;if(!(t&3))return this.map(e.changes);let r=this.result;r.map&&!e.changes.empty&&(r=r.map(r,e.changes));let a=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),c=Kr(e.state);if(c>o||!r||t&2&&(Kr(e.startState)==this.from||c<this.limit))return new Qn(this.source,t&4?1:0);let h=e.changes.mapPos(this.limit);return HB(r.validFor,e.state,a,o)?new ea(this.source,this.explicit,h,r,a,o):r.update&&(r=r.update(r,a,o,new KC(e.state,c,!1)))?new ea(this.source,this.explicit,h,r,r.from,(n=r.to)!==null&&n!==void 0?n:Kr(e.state)):new Qn(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new ea(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Qn(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function HB(i,e,t,n){if(!i)return!1;let r=e.sliceDoc(t,n);return typeof i=="function"?i(r,t,n,e):WC(i,!0).test(r)}const S0=Ye.define({map(i,e){return i.map(t=>t.map(e))}}),JC=Ye.define(),ln=Yn.define({create(){return Wf.start()},update(i,e){return i.update(e)},provide:i=>[CC.from(i,e=>e.tooltip),pe.contentAttributes.from(i,e=>e.attrs)]});function w0(i,e){const t=e.completion.apply||e.completion.label;let n=i.state.field(ln).active.find(r=>r.source==e.source);return n instanceof ea?(typeof t=="string"?i.dispatch({...CB(i.state,t,n.from,n.to),annotations:$C.of(e.completion)}):t(i,e.completion,n.from,n.to),!0):!1}const UB=DB(ln,w0);function hf(i,e="option"){return t=>{let n=t.state.field(ln,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<t.state.facet(Mt).interactionDelay)return!1;let r=1,a;e=="page"&&(a=AC(t,n.open.tooltip))&&(r=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector("li").offsetHeight)-1));let{length:o}=n.open.options,c=n.open.selected>-1?n.open.selected+r*(i?1:-1):i?0:o-1;return c<0?c=e=="page"?0:o-1:c>=o&&(c=e=="page"?o-1:0),t.dispatch({effects:JC.of(c)}),!0}}const PB=i=>{let e=i.state.field(ln,!1);return i.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<i.state.facet(Mt).interactionDelay?!1:w0(i,e.open.options[e.open.selected])},xp=i=>i.state.field(ln,!1)?(i.dispatch({effects:Xf.of(!0)}),!0):!1,qB=i=>{let e=i.state.field(ln,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(i.dispatch({effects:fu.of(null)}),!0)};class VB{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const QB=50,IB=1e3,GB=fn.fromClass(class{constructor(i){this.view=i,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of i.state.field(ln).active)e.isPending&&this.startQuery(e)}update(i){let e=i.state.field(ln),t=i.state.facet(Mt);if(!i.selectionSet&&!i.docChanged&&i.startState.field(ln)==e)return;let n=i.transactions.some(a=>{let o=ZC(a,t);return o&8||(a.selection||a.docChanged)&&!(o&3)});for(let a=0;a<this.running.length;a++){let o=this.running[a];if(n||o.context.abortOnDocChange&&i.docChanged||o.updates.length+i.transactions.length>QB&&Date.now()-o.time>IB){for(let c of o.context.abortListeners)try{c()}catch(h){En(this.view.state,h)}o.context.abortListeners=null,this.running.splice(a--,1)}else o.updates.push(...i.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),i.transactions.some(a=>a.effects.some(o=>o.is(Xf)))&&(this.pendingStart=!0);let r=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(a=>a.isPending&&!this.running.some(o=>o.active.source==a.source))?setTimeout(()=>this.startUpdate(),r):-1,this.composing!=0)for(let a of i.transactions)a.isUserEvent("input.type")?this.composing=2:this.composing==2&&a.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:i}=this.view,e=i.field(ln);for(let t of e.active)t.isPending&&!this.running.some(n=>n.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Mt).updateSyncTime))}startQuery(i){let{state:e}=this.view,t=Kr(e),n=new KC(e,t,i.explicit,this.view),r=new VB(i,n);this.running.push(r),Promise.resolve(i.source(n)).then(a=>{r.context.aborted||(r.done=a||null,this.scheduleAccept())},a=>{this.view.dispatch({effects:fu.of(null)}),En(this.view.state,a)})}scheduleAccept(){this.running.every(i=>i.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Mt).updateSyncTime))}accept(){var i;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Mt),n=this.view.state.field(ln);for(let r=0;r<this.running.length;r++){let a=this.running[r];if(a.done===void 0)continue;if(this.running.splice(r--,1),a.done){let c=Kr(a.updates.length?a.updates[0].startState:this.view.state),h=Math.min(c,a.done.from+(a.active.explicit?0:1)),d=new ea(a.active.source,a.active.explicit,h,a.done,a.done.from,(i=a.done.to)!==null&&i!==void 0?i:c);for(let p of a.updates)d=d.update(p,t);if(d.hasResult()){e.push(d);continue}}let o=n.active.find(c=>c.source==a.active.source);if(o&&o.isPending)if(a.done==null){let c=new Qn(a.active.source,0);for(let h of a.updates)c=c.update(h,t);c.isPending||e.push(c)}else this.startQuery(o)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:S0.of(e)})}},{eventHandlers:{blur(i){let e=this.view.state.field(ln,!1);if(e&&e.tooltip&&this.view.state.facet(Mt).closeOnBlur){let t=e.open&&AC(this.view,e.open.tooltip);(!t||!t.dom.contains(i.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:fu.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Xf.of(!1)}),20),this.composing=0}}}),FB=typeof navigator=="object"&&/Win/.test(navigator.platform),YB=Ea.highest(pe.domEventHandlers({keydown(i,e){let t=e.state.field(ln,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||i.key.length>1||i.ctrlKey&&!(FB&&i.altKey)||i.metaKey)return!1;let n=t.open.options[t.open.selected],r=t.active.find(o=>o.source==n.source),a=n.completion.commitCharacters||r.result.commitCharacters;return a&&a.indexOf(i.key)>-1&&w0(e,n),!1}})),KB=pe.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),e2=new class extends sr{};e2.startSide=1;e2.endSide=-1;function XB(i={}){return[YB,ln,Mt.of(i),GB,$B,KB]}const WB=[{key:"Ctrl-Space",run:xp},{mac:"Alt-`",run:xp},{mac:"Alt-i",run:xp},{key:"Escape",run:qB},{key:"ArrowDown",run:hf(!0)},{key:"ArrowUp",run:hf(!1)},{key:"PageDown",run:hf(!0,"page")},{key:"PageUp",run:hf(!1,"page")},{key:"Enter",run:PB}],$B=Ea.highest(Qf.computeN([Mt],i=>i.facet(Mt).defaultKeymap?[WB]:[])),ZB=i=>{let{state:e}=i,t=e.doc.lineAt(e.selection.main.from),n=C0(i.state,t.from);return n.line?JB(i):n.block?tL(i):!1};function k0(i,e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=i(e,t);return r?(n(t.update(r)),!0):!1}}const JB=k0(sL,0),eL=k0(t2,0),tL=k0((i,e)=>t2(i,e,iL(e)),0);function C0(i,e){let t=i.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const qo=50;function nL(i,{open:e,close:t},n,r){let a=i.sliceDoc(n-qo,n),o=i.sliceDoc(r,r+qo),c=/\s*$/.exec(a)[0].length,h=/^\s*/.exec(o)[0].length,d=a.length-c;if(a.slice(d-e.length,d)==e&&o.slice(h,h+t.length)==t)return{open:{pos:n-c,margin:c&&1},close:{pos:r+h,margin:h&&1}};let p,y;r-n<=2*qo?p=y=i.sliceDoc(n,r):(p=i.sliceDoc(n,n+qo),y=i.sliceDoc(r-qo,r));let b=/^\s*/.exec(p)[0].length,v=/\s*$/.exec(y)[0].length,w=y.length-v-t.length;return p.slice(b,b+e.length)==e&&y.slice(w,w+t.length)==t?{open:{pos:n+b+e.length,margin:/\s/.test(p.charAt(b+e.length))?1:0},close:{pos:r-v-t.length,margin:/\s/.test(y.charAt(w-1))?1:0}}:null}function iL(i){let e=[];for(let t of i.selection.ranges){let n=i.doc.lineAt(t.from),r=t.to<=n.to?n:i.doc.lineAt(t.to);r.from>n.from&&r.from==t.to&&(r=t.to==n.to+1?n:i.doc.lineAt(t.to-1));let a=e.length-1;a>=0&&e[a].to>n.from?e[a].to=r.to:e.push({from:n.from+/^\s*/.exec(n.text)[0].length,to:r.to})}return e}function t2(i,e,t=e.selection.ranges){let n=t.map(a=>C0(e,a.from).block);if(!n.every(a=>a))return null;let r=t.map((a,o)=>nL(e,n[o],a.from,a.to));if(i!=2&&!r.every(a=>a))return{changes:e.changes(t.map((a,o)=>r[o]?[]:[{from:a.from,insert:n[o].open+" "},{from:a.to,insert:" "+n[o].close}]))};if(i!=1&&r.some(a=>a)){let a=[];for(let o=0,c;o<r.length;o++)if(c=r[o]){let h=n[o],{open:d,close:p}=c;a.push({from:d.pos-h.open.length,to:d.pos+d.margin},{from:p.pos-p.margin,to:p.pos+h.close.length})}return{changes:a}}return null}function sL(i,e,t=e.selection.ranges){let n=[],r=-1;for(let{from:a,to:o}of t){let c=n.length,h=1e9,d=C0(e,a).line;if(d){for(let p=a;p<=o;){let y=e.doc.lineAt(p);if(y.from>r&&(a==o||o>y.from)){r=y.from;let b=/^\s*/.exec(y.text)[0].length,v=b==y.length,w=y.text.slice(b,b+d.length)==d?b:-1;b<y.text.length&&b<h&&(h=b),n.push({line:y,comment:w,token:d,indent:b,empty:v,single:!1})}p=y.to+1}if(h<1e9)for(let p=c;p<n.length;p++)n[p].indent<n[p].line.text.length&&(n[p].indent=h);n.length==c+1&&(n[c].single=!0)}}if(i!=2&&n.some(a=>a.comment<0&&(!a.empty||a.single))){let a=[];for(let{line:c,token:h,indent:d,empty:p,single:y}of n)(y||!p)&&a.push({from:c.from+d,insert:h+" "});let o=e.changes(a);return{changes:o,selection:e.selection.map(o,1)}}else if(i!=1&&n.some(a=>a.comment>=0)){let a=[];for(let{line:o,comment:c,token:h}of n)if(c>=0){let d=o.from+c,p=d+h.length;o.text[p-o.from]==" "&&p++,a.push({from:d,to:p})}return{changes:a}}return null}const Rg=us.define(),rL=us.define(),lL=he.define(),n2=he.define({combine(i){return Da(i,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),i2=Yn.define({create(){return Mi.empty},update(i,e){let t=e.state.facet(n2),n=e.annotation(Rg);if(n){let h=cn.fromTransaction(e,n.selection),d=n.side,p=d==0?i.undone:i.done;return h?p=$f(p,p.length,t.minDepth,h):p=l2(p,e.startState.selection),new Mi(d==0?n.rest:p,d==0?p:n.rest)}let r=e.annotation(rL);if((r=="full"||r=="before")&&(i=i.isolate()),e.annotation(St.addToHistory)===!1)return e.changes.empty?i:i.addMapping(e.changes.desc);let a=cn.fromTransaction(e),o=e.annotation(St.time),c=e.annotation(St.userEvent);return a?i=i.addChanges(a,o,c,t,e):e.selection&&(i=i.addSelection(e.startState.selection,o,c,t.newGroupDelay)),(r=="full"||r=="after")&&(i=i.isolate()),i},toJSON(i){return{done:i.done.map(e=>e.toJSON()),undone:i.undone.map(e=>e.toJSON())}},fromJSON(i){return new Mi(i.done.map(cn.fromJSON),i.undone.map(cn.fromJSON))}});function aL(i={}){return[i2,n2.of(i),pe.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?s2:e.inputType=="historyRedo"?Dg:null;return n?(e.preventDefault(),n(t)):!1}})]}function ph(i,e){return function({state:t,dispatch:n}){if(!e&&t.readOnly)return!1;let r=t.field(i2,!1);if(!r)return!1;let a=r.pop(i,t,e);return a?(n(a),!0):!1}}const s2=ph(0,!1),Dg=ph(1,!1),oL=ph(0,!0),uL=ph(1,!0);class cn{constructor(e,t,n,r,a){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=a}setSelAfter(e){return new cn(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map(r=>r.toJSON())}}static fromJSON(e){return new cn(e.changes&&vt.fromJSON(e.changes),[],e.mapped&&Ri.fromJSON(e.mapped),e.startSelection&&ee.fromJSON(e.startSelection),e.selectionsAfter.map(ee.fromJSON))}static fromTransaction(e,t){let n=In;for(let r of e.startState.facet(lL)){let a=r(e);a.length&&(n=n.concat(a))}return!n.length&&e.changes.empty?null:new cn(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,In)}static selection(e){return new cn(void 0,In,void 0,void 0,e)}}function $f(i,e,t,n){let r=e+1>t+20?e-t-1:0,a=i.slice(r,e);return a.push(n),a}function cL(i,e){let t=[],n=!1;return i.iterChangedRanges((r,a)=>t.push(r,a)),e.iterChangedRanges((r,a,o,c)=>{for(let h=0;h<t.length;){let d=t[h++],p=t[h++];c>=d&&o<=p&&(n=!0)}}),n}function fL(i,e){return i.ranges.length==e.ranges.length&&i.ranges.filter((t,n)=>t.empty!=e.ranges[n].empty).length===0}function r2(i,e){return i.length?e.length?i.concat(e):i:e}const In=[],hL=200;function l2(i,e){if(i.length){let t=i[i.length-1],n=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-hL));return n.length&&n[n.length-1].eq(e)?i:(n.push(e),$f(i,i.length-1,1e9,t.setSelAfter(n)))}else return[cn.selection([e])]}function dL(i){let e=i[i.length-1],t=i.slice();return t[i.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function Sp(i,e){if(!i.length)return i;let t=i.length,n=In;for(;t;){let r=mL(i[t-1],e,n);if(r.changes&&!r.changes.empty||r.effects.length){let a=i.slice(0,t);return a[t-1]=r,a}else e=r.mapped,t--,n=r.selectionsAfter}return n.length?[cn.selection(n)]:In}function mL(i,e,t){let n=r2(i.selectionsAfter.length?i.selectionsAfter.map(c=>c.map(e)):In,t);if(!i.changes)return cn.selection(n);let r=i.changes.map(e),a=e.mapDesc(i.changes,!0),o=i.mapped?i.mapped.composeDesc(a):a;return new cn(r,Ye.mapEffects(i.effects,e),o,i.startSelection.map(a),n)}const pL=/^(input\.type|delete)($|\.)/;class Mi{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new Mi(this.done,this.undone):this}addChanges(e,t,n,r,a){let o=this.done,c=o[o.length-1];return c&&c.changes&&!c.changes.empty&&e.changes&&(!n||pL.test(n))&&(!c.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(a,cL(c.changes,e.changes))||n=="input.type.compose")?o=$f(o,o.length-1,r.minDepth,new cn(e.changes.compose(c.changes),r2(Ye.mapEffects(e.effects,c.changes),c.effects),c.mapped,c.startSelection,In)):o=$f(o,o.length,r.minDepth,e),new Mi(o,In,t,n)}addSelection(e,t,n,r){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:In;return a.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&fL(a[a.length-1],e)?this:new Mi(l2(this.done,e),this.undone,t,n)}addMapping(e){return new Mi(Sp(this.done,e),Sp(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let a=r[r.length-1],o=a.selectionsAfter[0]||t.selection;if(n&&a.selectionsAfter.length)return t.update({selection:a.selectionsAfter[a.selectionsAfter.length-1],annotations:Rg.of({side:e,rest:dL(r),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(a.changes){let c=r.length==1?In:r.slice(0,r.length-1);return a.mapped&&(c=Sp(c,a.mapped)),t.update({changes:a.changes,selection:a.startSelection,effects:a.effects,annotations:Rg.of({side:e,rest:c,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}Mi.empty=new Mi(In,In);const gL=[{key:"Mod-z",run:s2,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Dg,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Dg,preventDefault:!0},{key:"Mod-u",run:oL,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:uL,preventDefault:!0}];function Ba(i,e){return ee.create(i.ranges.map(e),i.mainIndex)}function ci(i,e){return i.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function fi({state:i,dispatch:e},t){let n=Ba(i.selection,t);return n.eq(i.selection,!0)?!1:(e(ci(i,n)),!0)}function gh(i,e){return ee.cursor(e?i.to:i.from)}function a2(i,e){return fi(i,t=>t.empty?i.moveByChar(t,e):gh(t,e))}function It(i){return i.textDirectionAt(i.state.selection.main.head)==et.LTR}const o2=i=>a2(i,!It(i)),u2=i=>a2(i,It(i));function c2(i,e){return fi(i,t=>t.empty?i.moveByGroup(t,e):gh(t,e))}const yL=i=>c2(i,!It(i)),bL=i=>c2(i,It(i));function vL(i,e,t){if(e.type.prop(t))return!0;let n=e.to-e.from;return n&&(n>2||/[^\s,.;:]/.test(i.sliceDoc(e.from,e.to)))||e.firstChild}function yh(i,e,t){let n=Qt(i).resolveInner(e.head),r=t?Re.closedBy:Re.openedBy;for(let h=e.head;;){let d=t?n.childAfter(h):n.childBefore(h);if(!d)break;vL(i,d,r)?n=d:h=t?d.to:d.from}let a=n.type.prop(r),o,c;return a&&(o=t?Oi(i,n.from,1):Oi(i,n.to,-1))&&o.matched?c=t?o.end.to:o.end.from:c=t?n.to:n.from,ee.cursor(c,t?-1:1)}const xL=i=>fi(i,e=>yh(i.state,e,!It(i))),SL=i=>fi(i,e=>yh(i.state,e,It(i)));function f2(i,e){return fi(i,t=>{if(!t.empty)return gh(t,e);let n=i.moveVertically(t,e);return n.head!=t.head?n:i.moveToLineBoundary(t,e)})}const h2=i=>f2(i,!1),d2=i=>f2(i,!0);function m2(i){let e=i.scrollDOM.clientHeight<i.scrollDOM.scrollHeight-2,t=0,n=0,r;if(e){for(let a of i.state.facet(pe.scrollMargins)){let o=a(i);o!=null&&o.top&&(t=Math.max(o==null?void 0:o.top,t)),o!=null&&o.bottom&&(n=Math.max(o==null?void 0:o.bottom,n))}r=i.scrollDOM.clientHeight-t-n}else r=(i.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:n,selfScroll:e,height:Math.max(i.defaultLineHeight,r-5)}}function p2(i,e){let t=m2(i),{state:n}=i,r=Ba(n.selection,o=>o.empty?i.moveVertically(o,e,t.height):gh(o,e));if(r.eq(n.selection))return!1;let a;if(t.selfScroll){let o=i.coordsAtPos(n.selection.main.head),c=i.scrollDOM.getBoundingClientRect(),h=c.top+t.marginTop,d=c.bottom-t.marginBottom;o&&o.top>h&&o.bottom<d&&(a=pe.scrollIntoView(r.main.head,{y:"start",yMargin:o.top-h}))}return i.dispatch(ci(n,r),{effects:a}),!0}const CS=i=>p2(i,!1),Ng=i=>p2(i,!0);function fr(i,e,t){let n=i.lineBlockAt(e.head),r=i.moveToLineBoundary(e,t);if(r.head==e.head&&r.head!=(t?n.to:n.from)&&(r=i.moveToLineBoundary(e,t,!1)),!t&&r.head==n.from&&n.length){let a=/^\s*/.exec(i.state.sliceDoc(n.from,Math.min(n.from+100,n.to)))[0].length;a&&e.head!=n.from+a&&(r=ee.cursor(n.from+a))}return r}const wL=i=>fi(i,e=>fr(i,e,!0)),kL=i=>fi(i,e=>fr(i,e,!1)),CL=i=>fi(i,e=>fr(i,e,!It(i))),AL=i=>fi(i,e=>fr(i,e,It(i))),TL=i=>fi(i,e=>ee.cursor(i.lineBlockAt(e.head).from,1)),OL=i=>fi(i,e=>ee.cursor(i.lineBlockAt(e.head).to,-1));function ML(i,e,t){let n=!1,r=Ba(i.selection,a=>{let o=Oi(i,a.head,-1)||Oi(i,a.head,1)||a.head>0&&Oi(i,a.head-1,1)||a.head<i.doc.length&&Oi(i,a.head+1,-1);if(!o||!o.end)return a;n=!0;let c=o.start.from==a.head?o.end.to:o.end.from;return ee.cursor(c)});return n?(e(ci(i,r)),!0):!1}const EL=({state:i,dispatch:e})=>ML(i,e);function Kn(i,e){let t=Ba(i.state.selection,n=>{let r=e(n);return ee.range(n.anchor,r.head,r.goalColumn,r.bidiLevel||void 0)});return t.eq(i.state.selection)?!1:(i.dispatch(ci(i.state,t)),!0)}function g2(i,e){return Kn(i,t=>i.moveByChar(t,e))}const y2=i=>g2(i,!It(i)),b2=i=>g2(i,It(i));function v2(i,e){return Kn(i,t=>i.moveByGroup(t,e))}const RL=i=>v2(i,!It(i)),DL=i=>v2(i,It(i)),NL=i=>Kn(i,e=>yh(i.state,e,!It(i))),BL=i=>Kn(i,e=>yh(i.state,e,It(i)));function x2(i,e){return Kn(i,t=>i.moveVertically(t,e))}const S2=i=>x2(i,!1),w2=i=>x2(i,!0);function k2(i,e){return Kn(i,t=>i.moveVertically(t,e,m2(i).height))}const AS=i=>k2(i,!1),TS=i=>k2(i,!0),LL=i=>Kn(i,e=>fr(i,e,!0)),jL=i=>Kn(i,e=>fr(i,e,!1)),zL=i=>Kn(i,e=>fr(i,e,!It(i))),_L=i=>Kn(i,e=>fr(i,e,It(i))),HL=i=>Kn(i,e=>ee.cursor(i.lineBlockAt(e.head).from)),UL=i=>Kn(i,e=>ee.cursor(i.lineBlockAt(e.head).to)),OS=({state:i,dispatch:e})=>(e(ci(i,{anchor:0})),!0),MS=({state:i,dispatch:e})=>(e(ci(i,{anchor:i.doc.length})),!0),ES=({state:i,dispatch:e})=>(e(ci(i,{anchor:i.selection.main.anchor,head:0})),!0),RS=({state:i,dispatch:e})=>(e(ci(i,{anchor:i.selection.main.anchor,head:i.doc.length})),!0),PL=({state:i,dispatch:e})=>(e(i.update({selection:{anchor:0,head:i.doc.length},userEvent:"select"})),!0),qL=({state:i,dispatch:e})=>{let t=bh(i).map(({from:n,to:r})=>ee.range(n,Math.min(r+1,i.doc.length)));return e(i.update({selection:ee.create(t),userEvent:"select"})),!0},VL=({state:i,dispatch:e})=>{let t=Ba(i.selection,n=>{let r=Qt(i),a=r.resolveStack(n.from,1);if(n.empty){let o=r.resolveStack(n.from,-1);o.node.from>=a.node.from&&o.node.to<=a.node.to&&(a=o)}for(let o=a;o;o=o.next){let{node:c}=o;if((c.from<n.from&&c.to>=n.to||c.to>n.to&&c.from<=n.from)&&o.next)return ee.range(c.to,c.from)}return n});return t.eq(i.selection)?!1:(e(ci(i,t)),!0)};function C2(i,e){let{state:t}=i,n=t.selection,r=t.selection.ranges.slice();for(let a of t.selection.ranges){let o=t.doc.lineAt(a.head);if(e?o.to<i.state.doc.length:o.from>0)for(let c=a;;){let h=i.moveVertically(c,e);if(h.head<o.from||h.head>o.to){r.some(d=>d.head==h.head)||r.push(h);break}else{if(h.head==c.head)break;c=h}}}return r.length==n.ranges.length?!1:(i.dispatch(ci(t,ee.create(r,r.length-1))),!0)}const QL=i=>C2(i,!1),IL=i=>C2(i,!0),GL=({state:i,dispatch:e})=>{let t=i.selection,n=null;return t.ranges.length>1?n=ee.create([t.main]):t.main.empty||(n=ee.create([ee.cursor(t.main.head)])),n?(e(ci(i,n)),!0):!1};function Ou(i,e){if(i.state.readOnly)return!1;let t="delete.selection",{state:n}=i,r=n.changeByRange(a=>{let{from:o,to:c}=a;if(o==c){let h=e(a);h<o?(t="delete.backward",h=df(i,h,!1)):h>o&&(t="delete.forward",h=df(i,h,!0)),o=Math.min(o,h),c=Math.max(c,h)}else o=df(i,o,!1),c=df(i,c,!0);return o==c?{range:a}:{changes:{from:o,to:c},range:ee.cursor(o,o<a.head?-1:1)}});return r.changes.empty?!1:(i.dispatch(n.update(r,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?pe.announce.of(n.phrase("Selection deleted")):void 0})),!0)}function df(i,e,t){if(i instanceof pe)for(let n of i.state.facet(pe.atomicRanges).map(r=>r(i)))n.between(e,e,(r,a)=>{r<e&&a>e&&(e=t?a:r)});return e}const A2=(i,e,t)=>Ou(i,n=>{let r=n.from,{state:a}=i,o=a.doc.lineAt(r),c,h;if(t&&!e&&r>o.from&&r<o.from+200&&!/[^ \t]/.test(c=o.text.slice(0,r-o.from))){if(c[c.length-1]==" ")return r-1;let d=ah(c,a.tabSize),p=d%Yf(a)||Yf(a);for(let y=0;y<p&&c[c.length-1-y]==" ";y++)r--;h=r}else h=Lt(o.text,r-o.from,e,e)+o.from,h==r&&o.number!=(e?a.doc.lines:1)?h+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(h-o.from,r-o.from))&&(h=Lt(o.text,h-o.from,!1,!1)+o.from);return h}),Bg=i=>A2(i,!1,!0),T2=i=>A2(i,!0,!1),O2=(i,e)=>Ou(i,t=>{let n=t.head,{state:r}=i,a=r.doc.lineAt(n),o=r.charCategorizer(n);for(let c=null;;){if(n==(e?a.to:a.from)){n==t.head&&a.number!=(e?r.doc.lines:1)&&(n+=e?1:-1);break}let h=Lt(a.text,n-a.from,e)+a.from,d=a.text.slice(Math.min(n,h)-a.from,Math.max(n,h)-a.from),p=o(d);if(c!=null&&p!=c)break;(d!=" "||n!=t.head)&&(c=p),n=h}return n}),M2=i=>O2(i,!1),FL=i=>O2(i,!0),YL=i=>Ou(i,e=>{let t=i.lineBlockAt(e.head).to;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)}),KL=i=>Ou(i,e=>{let t=i.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),XL=i=>Ou(i,e=>{let t=i.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(i.state.doc.length,e.head+1)}),WL=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:He.of(["",""])},range:ee.cursor(n.from)}));return e(i.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},$L=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=i.changeByRange(n=>{if(!n.empty||n.from==0||n.from==i.doc.length)return{range:n};let r=n.from,a=i.doc.lineAt(r),o=r==a.from?r-1:Lt(a.text,r-a.from,!1)+a.from,c=r==a.to?r+1:Lt(a.text,r-a.from,!0)+a.from;return{changes:{from:o,to:c,insert:i.doc.slice(r,c).append(i.doc.slice(o,r))},range:ee.cursor(c)}});return t.changes.empty?!1:(e(i.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function bh(i){let e=[],t=-1;for(let n of i.selection.ranges){let r=i.doc.lineAt(n.from),a=i.doc.lineAt(n.to);if(!n.empty&&n.to==a.from&&(a=i.doc.lineAt(n.to-1)),t>=r.number){let o=e[e.length-1];o.to=a.to,o.ranges.push(n)}else e.push({from:r.from,to:a.to,ranges:[n]});t=a.number+1}return e}function E2(i,e,t){if(i.readOnly)return!1;let n=[],r=[];for(let a of bh(i)){if(t?a.to==i.doc.length:a.from==0)continue;let o=i.doc.lineAt(t?a.to+1:a.from-1),c=o.length+1;if(t){n.push({from:a.to,to:o.to},{from:a.from,insert:o.text+i.lineBreak});for(let h of a.ranges)r.push(ee.range(Math.min(i.doc.length,h.anchor+c),Math.min(i.doc.length,h.head+c)))}else{n.push({from:o.from,to:a.from},{from:a.to,insert:i.lineBreak+o.text});for(let h of a.ranges)r.push(ee.range(h.anchor-c,h.head-c))}}return n.length?(e(i.update({changes:n,scrollIntoView:!0,selection:ee.create(r,i.selection.mainIndex),userEvent:"move.line"})),!0):!1}const ZL=({state:i,dispatch:e})=>E2(i,e,!1),JL=({state:i,dispatch:e})=>E2(i,e,!0);function R2(i,e,t){if(i.readOnly)return!1;let n=[];for(let a of bh(i))t?n.push({from:a.from,insert:i.doc.slice(a.from,a.to)+i.lineBreak}):n.push({from:a.to,insert:i.lineBreak+i.doc.slice(a.from,a.to)});let r=i.changes(n);return e(i.update({changes:r,selection:i.selection.map(r,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const ej=({state:i,dispatch:e})=>R2(i,e,!1),tj=({state:i,dispatch:e})=>R2(i,e,!0),nj=i=>{if(i.state.readOnly)return!1;let{state:e}=i,t=e.changes(bh(e).map(({from:r,to:a})=>(r>0?r--:a<e.doc.length&&a++,{from:r,to:a}))),n=Ba(e.selection,r=>{let a;if(i.lineWrapping){let o=i.lineBlockAt(r.head),c=i.coordsAtPos(r.head,r.assoc||1);c&&(a=o.bottom+i.documentTop-c.bottom+i.defaultLineHeight/2)}return i.moveVertically(r,!0,a)}).map(t);return i.dispatch({changes:t,selection:n,scrollIntoView:!0,userEvent:"delete.line"}),!0};function ij(i,e){if(/\(\)|\[\]|\{\}/.test(i.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Qt(i).resolveInner(e),n=t.childBefore(e),r=t.childAfter(e),a;return n&&r&&n.to<=e&&r.from>=e&&(a=n.type.prop(Re.closedBy))&&a.indexOf(r.name)>-1&&i.doc.lineAt(n.to).from==i.doc.lineAt(r.from).from&&!/\S/.test(i.sliceDoc(n.to,r.from))?{from:n.to,to:r.from}:null}const DS=D2(!1),sj=D2(!0);function D2(i){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(r=>{let{from:a,to:o}=r,c=e.doc.lineAt(a),h=!i&&a==o&&ij(e,a);i&&(a=o=(o<=c.to?c:e.doc.lineAt(o)).to);let d=new dh(e,{simulateBreak:a,simulateDoubleBreak:!!h}),p=b0(d,a);for(p==null&&(p=ah(/^\s*/.exec(e.doc.lineAt(a).text)[0],e.tabSize));o<c.to&&/\s/.test(c.text[o-c.from]);)o++;h?{from:a,to:o}=h:a>c.from&&a<c.from+100&&!/\S/.test(c.text.slice(0,a))&&(a=c.from);let y=["",cu(e,p)];return h&&y.push(cu(e,d.lineIndent(c.from,-1))),{changes:{from:a,to:o,insert:He.of(y)},range:ee.cursor(a+1+y[1].length)}});return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}}function A0(i,e){let t=-1;return i.changeByRange(n=>{let r=[];for(let o=n.from;o<=n.to;){let c=i.doc.lineAt(o);c.number>t&&(n.empty||n.to>c.from)&&(e(c,r,n),t=c.number),o=c.to+1}let a=i.changes(r);return{changes:r,range:ee.range(a.mapPos(n.anchor,1),a.mapPos(n.head,1))}})}const rj=({state:i,dispatch:e})=>{if(i.readOnly)return!1;let t=Object.create(null),n=new dh(i,{overrideIndentation:a=>{let o=t[a];return o??-1}}),r=A0(i,(a,o,c)=>{let h=b0(n,a.from);if(h==null)return;/\S/.test(a.text)||(h=0);let d=/^\s*/.exec(a.text)[0],p=cu(i,h);(d!=p||c.from<a.from+d.length)&&(t[a.from]=h,o.push({from:a.from,to:a.from+d.length,insert:p}))});return r.changes.empty||e(i.update(r,{userEvent:"indent"})),!0},lj=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(A0(i,(t,n)=>{n.push({from:t.from,insert:i.facet(y0)})}),{userEvent:"input.indent"})),!0),aj=({state:i,dispatch:e})=>i.readOnly?!1:(e(i.update(A0(i,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let a=ah(r,i.tabSize),o=0,c=cu(i,Math.max(0,a-Yf(i)));for(;o<r.length&&o<c.length&&r.charCodeAt(o)==c.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+r.length,insert:c.slice(o)})}),{userEvent:"delete.dedent"})),!0),oj=i=>(i.setTabFocusMode(),!0),uj=[{key:"Ctrl-b",run:o2,shift:y2,preventDefault:!0},{key:"Ctrl-f",run:u2,shift:b2},{key:"Ctrl-p",run:h2,shift:S2},{key:"Ctrl-n",run:d2,shift:w2},{key:"Ctrl-a",run:TL,shift:HL},{key:"Ctrl-e",run:OL,shift:UL},{key:"Ctrl-d",run:T2},{key:"Ctrl-h",run:Bg},{key:"Ctrl-k",run:YL},{key:"Ctrl-Alt-h",run:M2},{key:"Ctrl-o",run:WL},{key:"Ctrl-t",run:$L},{key:"Ctrl-v",run:Ng}],cj=[{key:"ArrowLeft",run:o2,shift:y2,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:yL,shift:RL,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:CL,shift:zL,preventDefault:!0},{key:"ArrowRight",run:u2,shift:b2,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:bL,shift:DL,preventDefault:!0},{mac:"Cmd-ArrowRight",run:AL,shift:_L,preventDefault:!0},{key:"ArrowUp",run:h2,shift:S2,preventDefault:!0},{mac:"Cmd-ArrowUp",run:OS,shift:ES},{mac:"Ctrl-ArrowUp",run:CS,shift:AS},{key:"ArrowDown",run:d2,shift:w2,preventDefault:!0},{mac:"Cmd-ArrowDown",run:MS,shift:RS},{mac:"Ctrl-ArrowDown",run:Ng,shift:TS},{key:"PageUp",run:CS,shift:AS},{key:"PageDown",run:Ng,shift:TS},{key:"Home",run:kL,shift:jL,preventDefault:!0},{key:"Mod-Home",run:OS,shift:ES},{key:"End",run:wL,shift:LL,preventDefault:!0},{key:"Mod-End",run:MS,shift:RS},{key:"Enter",run:DS,shift:DS},{key:"Mod-a",run:PL},{key:"Backspace",run:Bg,shift:Bg,preventDefault:!0},{key:"Delete",run:T2,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:M2,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:FL,preventDefault:!0},{mac:"Mod-Backspace",run:KL,preventDefault:!0},{mac:"Mod-Delete",run:XL,preventDefault:!0}].concat(uj.map(i=>({mac:i.key,run:i.run,shift:i.shift}))),fj=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:xL,shift:NL},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:SL,shift:BL},{key:"Alt-ArrowUp",run:ZL},{key:"Shift-Alt-ArrowUp",run:ej},{key:"Alt-ArrowDown",run:JL},{key:"Shift-Alt-ArrowDown",run:tj},{key:"Mod-Alt-ArrowUp",run:QL},{key:"Mod-Alt-ArrowDown",run:IL},{key:"Escape",run:GL},{key:"Mod-Enter",run:sj},{key:"Alt-l",mac:"Ctrl-l",run:qL},{key:"Mod-i",run:VL,preventDefault:!0},{key:"Mod-[",run:aj},{key:"Mod-]",run:lj},{key:"Mod-Alt-\\",run:rj},{key:"Shift-Mod-k",run:nj},{key:"Shift-Mod-\\",run:EL},{key:"Mod-/",run:ZB},{key:"Alt-A",run:eL},{key:"Ctrl-m",mac:"Shift-Alt-m",run:oj}].concat(cj);var NS={};class Zf{constructor(e,t,n,r,a,o,c,h,d,p=0,y){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=a,this.score=o,this.buffer=c,this.bufferBase=h,this.curContext=d,this.lookAhead=p,this.parent=y}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let r=e.parser.context;return new Zf(e,[],t,n,n,0,[],0,r?new BS(r,r.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,r=e&65535,{parser:a}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),c=a.dynamicPrecedence(r);if(c&&(this.score+=c),n==0){this.pushState(a.getGoto(this.state,r,!0),this.reducePos),r<a.minRepeatTerm&&this.storeNode(r,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(r,this.reducePos);return}let h=this.stack.length-(n-1)*3-(e&262144?6:0),d=h?this.stack[h-2]:this.p.ranges[0].from,p=this.reducePos-d;p>=2e3&&!(!((t=this.p.parser.nodeSet.types[r])===null||t===void 0)&&t.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=p):this.p.lastBigReductionSize<p&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=d,this.p.lastBigReductionSize=p));let y=h?this.stack[h-1]:0,b=this.bufferBase+this.buffer.length-y;if(r<a.minRepeatTerm||e&131072){let v=a.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(r,d,v,b+4,!0)}if(e&262144)this.state=this.stack[h];else{let v=this.stack[h-3];this.state=a.getGoto(v,r,!0)}for(;this.stack.length>h;)this.stack.pop();this.reduceContext(r,d)}storeNode(e,t,n,r=4,a=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,c=this.buffer.length;if(c==0&&o.parent&&(c=o.bufferBase-o.parent.bufferBase,o=o.parent),c>0&&o.buffer[c-4]==0&&o.buffer[c-1]>-1){if(t==n)return;if(o.buffer[c-2]>=t){o.buffer[c-2]=n;return}}}if(!a||this.pos==n)this.buffer.push(e,t,n,r);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let c=!1;for(let h=o;h>0&&this.buffer[h-2]>n;h-=4)if(this.buffer[h-1]>=0){c=!0;break}if(c)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,r>4&&(r-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=n,this.buffer[o+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let a=e,{parser:o}=this.p;this.pos=r,!o.stateFlag(a,1)&&(r>n||t<=o.maxNode)&&(this.reducePos=r),this.pushState(a,Math.min(n,this.reducePos)),this.shiftContext(t,n),t<=o.maxNode&&this.buffer.push(t,n,r,4)}else this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4)}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),r=e.bufferBase+t;for(;e&&r==e.bufferBase;)e=e.parent;return new Zf(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,r,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new hj(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if((n&65536)==0)return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let r=[];for(let a=0,o;a<t.length;a+=2)(o=t[a+1])!=this.state&&this.p.parser.hasAction(o,e)&&r.push(t[a],o);if(this.stack.length<120)for(let a=0;r.length<8&&a<t.length;a+=2){let o=t[a+1];r.some((c,h)=>h&1&&c==o)||r.push(t[a],o)}t=r}let n=[];for(let r=0;r<t.length&&n.length<4;r+=2){let a=t[r+1];if(a==this.state)continue;let o=this.split();o.pushState(a,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[r],this.pos),o.reducePos=this.pos,o.score-=200,n.push(o)}return n}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let n=t>>19,r=t&65535,a=this.stack.length-n*3;if(a<0||e.getGoto(this.stack[a],r,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,a)=>{if(!t.includes(r))return t.push(r),e.allActions(r,o=>{if(!(o&393216))if(o&65536){let c=(o>>19)-a;if(c>1){let h=o&65535,d=this.stack.length-c*3;if(d>=0&&e.getGoto(this.stack[d],h,!1)>=0)return c<<19|65536|h}}else{let c=n(o,a+1);if(c!=null)return c}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new BS(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class BS{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class hj{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let r=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=r}}class Jf{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Jf(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Jf(this.stack,this.pos,this.index)}}function mf(i,e=Uint16Array){if(typeof i!="string")return i;let t=null;for(let n=0,r=0;n<i.length;){let a=0;for(;;){let o=i.charCodeAt(n++),c=!1;if(o==126){a=65535;break}o>=92&&o--,o>=34&&o--;let h=o-32;if(h>=46&&(h-=46,c=!0),a+=h,c)break;a*=46}t?t[r++]=a:t=new e(a)}return t}class Of{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const LS=new Of;class dj{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=LS,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,a=this.pos+e;for(;a<n.from;){if(!r)return null;let o=this.ranges[--r];a-=n.from-o.to,n=o}for(;t<0?a>n.to:a>=n.to;){if(r==this.ranges.length-1)return null;let o=this.ranges[++r];a+=o.from-n.to,n=o}return a}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t<this.chunk.length)n=this.pos+e,r=this.chunk.charCodeAt(t);else{let a=this.resolveOffset(e,1);if(a==null)return-1;if(n=a,n>=this.chunk2Pos&&n<this.chunk2Pos+this.chunk2.length)r=this.chunk2.charCodeAt(n-this.chunk2Pos);else{let o=this.rangeIndex,c=this.range;for(;c.to<=n;)c=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=n),n+this.chunk2.length>c.to&&(this.chunk2=this.chunk2.slice(0,c.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=n}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=LS,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}}class ta{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;pj(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}ta.prototype.contextual=ta.prototype.fallback=ta.prototype.extend=!1;ta.prototype.fallback=ta.prototype.extend=!1;class mj{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function pj(i,e,t,n,r,a){let o=0,c=1<<n,{dialect:h}=t.p.parser;e:for(;(c&i[o])!=0;){let d=i[o+1];for(let v=o+3;v<d;v+=2)if((i[v+1]&c)>0){let w=i[v];if(h.allows(w)&&(e.token.value==-1||e.token.value==w||gj(w,e.token.value,r,a))){e.acceptToken(w);break}}let p=e.next,y=0,b=i[o+2];if(e.next<0&&b>y&&i[d+b*3-3]==65535){o=i[d+b*3-1];continue e}for(;y<b;){let v=y+b>>1,w=d+v+(v<<1),k=i[w],A=i[w+1]||65536;if(p<k)b=v;else if(p>=A)y=v+1;else{o=i[w+2],e.advance();continue e}}break}}function jS(i,e,t){for(let n=e,r;(r=i[n])!=65535;n++)if(r==t)return n-e;return-1}function gj(i,e,t,n){let r=jS(t,n,e);return r<0||jS(t,n,i)<r}const Cn=typeof process<"u"&&NS&&/\bparse\b/.test(NS.LOG);let wp=null;function zS(i,e,t){let n=i.cursor(ot.IncludeAnonymous);for(n.moveTo(e);;)if(!(t<0?n.childBefore(e):n.childAfter(e)))for(;;){if((t<0?n.to<e:n.from>e)&&!n.type.isError)return t<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(i.length,Math.max(n.from+1,e+25));if(t<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return t<0?0:i.length}}class yj{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?zS(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?zS(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let n=this.trees[t],r=this.index[t];if(r==n.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let a=n.children[r],o=this.start[t]+n.positions[r];if(o>e)return this.nextStart=o,null;if(a instanceof ht){if(o==e){if(o<this.safeFrom)return null;let c=o+a.length;if(c<=this.safeTo){let h=a.prop(Re.lookAhead);if(!h||c+h<this.fragment.to)return a}}this.index[t]++,o+a.length>=Math.max(this.safeFrom,e)&&(this.trees.push(a),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+a.length}}}class bj{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Of)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:a}=r,o=r.stateSlot(e.state,3),c=e.curContext?e.curContext.hash:0,h=0;for(let d=0;d<a.length;d++){if((1<<d&o)==0)continue;let p=a[d],y=this.tokens[d];if(!(n&&!p.fallback)&&((p.contextual||y.start!=e.pos||y.mask!=o||y.context!=c)&&(this.updateCachedToken(y,p,e),y.mask=o,y.context=c),y.lookAhead>y.end+25&&(h=Math.max(y.lookAhead,h)),y.value!=0)){let b=t;if(y.extended>-1&&(t=this.addActions(e,y.extended,y.end,t)),t=this.addActions(e,y.value,y.end,t),!p.extend&&(n=y,t>b))break}}for(;this.actions.length>t;)this.actions.pop();return h&&e.setLookAhead(h),!n&&e.pos==this.stream.end&&(n=new Of,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Of,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:a}=n.p;for(let o=0;o<a.specialized.length;o++)if(a.specialized[o]==e.value){let c=a.specializers[o](this.stream.read(e.start,e.end),n);if(c>=0&&n.p.parser.dialect.allows(c>>1)){(c&1)==0?e.value=c>>1:e.extended=c>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let a=0;a<r;a+=3)if(this.actions[a]==e)return r;return this.actions[r++]=e,this.actions[r++]=t,this.actions[r++]=n,r}addActions(e,t,n,r){let{state:a}=e,{parser:o}=e.p,{data:c}=o;for(let h=0;h<2;h++)for(let d=o.stateSlot(a,h?2:1);;d+=3){if(c[d]==65535)if(c[d+1]==1)d=Xi(c,d+2);else{r==0&&c[d+1]==2&&(r=this.putAction(Xi(c,d+2),t,n,r));break}c[d]==t&&(r=this.putAction(Xi(c,d+1),t,n,r))}return r}}class vj{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new dj(t,r),this.tokens=new bj(e,this.stream),this.topTerm=e.top[1];let{from:a}=r[0];this.stacks=[Zf.start(this,e.top[0],a)],this.fragments=n.length&&this.stream.end-a>e.bufferLength*4?new yj(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,a;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let c=e[o];for(;;){if(this.tokens.mainToken=null,c.pos>t)n.push(c);else{if(this.advanceStack(c,n,e))continue;{r||(r=[],a=[]),r.push(c);let h=this.tokens.getMainToken(c);a.push(h.value,h.end)}}break}}if(!n.length){let o=r&&Sj(r);if(o)return Cn&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Cn&&r&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&r){let o=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,a,n);if(o)return Cn&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((c,h)=>h.score-c.score);n.length>o;)n.pop();n.some(c=>c.reducePos>t)&&this.recovering--}else if(n.length>1){e:for(let o=0;o<n.length-1;o++){let c=n[o];for(let h=o+1;h<n.length;h++){let d=n[h];if(c.sameState(d)||c.buffer.length>500&&d.buffer.length>500)if((c.score-d.score||c.buffer.length-d.buffer.length)>0)n.splice(h--,1);else{n.splice(o--,1);continue e}}}n.length>12&&(n.sort((o,c)=>c.score-o.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let o=1;o<n.length;o++)n[o].pos<this.minStackPos&&(this.minStackPos=n[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,n){let r=e.pos,{parser:a}=this,o=Cn?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.curContext&&e.curContext.tracker.strict,p=d?e.curContext.hash:0;for(let y=this.fragments.nodeAt(r);y;){let b=this.parser.nodeSet.types[y.type.id]==y.type?a.getGoto(e.state,y.type.id):-1;if(b>-1&&y.length&&(!d||(y.prop(Re.contextHash)||0)==p))return e.useNode(y,b),Cn&&console.log(o+this.stackID(e)+` (via reuse of ${a.getName(y.type.id)})`),!0;if(!(y instanceof ht)||y.children.length==0||y.positions[0]>0)break;let v=y.children[0];if(v instanceof ht&&y.positions[0]==0)y=v;else break}}let c=a.stateSlot(e.state,4);if(c>0)return e.reduce(c),Cn&&console.log(o+this.stackID(e)+` (via always-reduce ${a.getName(c&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let h=this.tokens.getActions(e);for(let d=0;d<h.length;){let p=h[d++],y=h[d++],b=h[d++],v=d==h.length||!n,w=v?e:e.split(),k=this.tokens.mainToken;if(w.apply(p,y,k?k.start:w.pos,b),Cn&&console.log(o+this.stackID(w)+` (via ${(p&65536)==0?"shift":`reduce of ${a.getName(p&65535)}`} for ${a.getName(y)} @ ${r}${w==e?"":", split"})`),v)return!0;w.pos>r?t.push(w):n.push(w)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return _S(e,t),!0}}runRecovery(e,t,n){let r=null,a=!1;for(let o=0;o<e.length;o++){let c=e[o],h=t[o<<1],d=t[(o<<1)+1],p=Cn?this.stackID(c)+" -> ":"";if(c.deadEnd&&(a||(a=!0,c.restart(),Cn&&console.log(p+this.stackID(c)+" (restarted)"),this.advanceFully(c,n))))continue;let y=c.split(),b=p;for(let v=0;v<10&&y.forceReduce()&&(Cn&&console.log(b+this.stackID(y)+" (via force-reduce)"),!this.advanceFully(y,n));v++)Cn&&(b=this.stackID(y)+" -> ");for(let v of c.recoverByInsert(h))Cn&&console.log(p+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,n);this.stream.end>c.pos?(d==c.pos&&(d++,h=0),c.recoverByDelete(h,d),Cn&&console.log(p+this.stackID(c)+` (via recover-delete ${this.parser.getName(h)})`),_S(c,n)):(!r||r.score<y.score)&&(r=y)}return r}stackToTree(e){return e.close(),ht.build({buffer:Jf.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(wp||(wp=new WeakMap)).get(e);return t||wp.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function _S(i,e){for(let t=0;t<e.length;t++){let n=e[t];if(n.pos==i.pos&&n.sameState(i)){e[t].score<i.score&&(e[t]=i);return}}e.push(i)}class xj{constructor(e,t,n){this.source=e,this.flags=t,this.disabled=n}allows(e){return!this.disabled||this.disabled[e]==0}}class eh extends NC{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let c=0;c<e.repeatNodeCount;c++)t.push("");let n=Object.keys(e.topRules).map(c=>e.topRules[c][1]),r=[];for(let c=0;c<t.length;c++)r.push([]);function a(c,h,d){r[c].push([h,h.deserialize(String(d))])}if(e.nodeProps)for(let c of e.nodeProps){let h=c[0];typeof h=="string"&&(h=Re[h]);for(let d=1;d<c.length;){let p=c[d++];if(p>=0)a(p,h,c[d++]);else{let y=c[d+-p];for(let b=-p;b>0;b--)a(c[d++],h,y);d++}}}this.nodeSet=new d0(t.map((c,h)=>hn.define({name:h>=this.minRepeatTerm?void 0:c,id:h,props:r[h],top:n.indexOf(h)>-1,error:h==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(h)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=MC;let o=mf(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let c=0;c<this.specializerSpecs.length;c++)this.specialized[c]=this.specializerSpecs[c].term;this.specializers=this.specializerSpecs.map(HS),this.states=mf(e.states,Uint32Array),this.data=mf(e.stateData),this.goto=mf(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(c=>typeof c=="number"?new ta(o,c):c),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new vj(this,e,t,n);for(let a of this.wrappers)r=a(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let a=r[t+1];;){let o=r[a++],c=o&1,h=r[a++];if(c&&n)return h;for(let d=a+(o>>1);a<d;a++)if(r[a]==e)return h;if(c)return-1}}hasAction(e,t){let n=this.data;for(let r=0;r<2;r++)for(let a=this.stateSlot(e,r?2:1),o;;a+=3){if((o=n[a])==65535)if(n[a+1]==1)o=n[a=Xi(n,a+2)];else{if(n[a+1]==2)return Xi(n,a+2);break}if(o==t||o==0)return Xi(n,a+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,n=>n==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let a=this.stateSlot(e,1);r==null;a+=3){if(this.data[a]==65535)if(this.data[a+1]==1)a=Xi(this.data,a+2);else break;r=t(Xi(this.data,a+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Xi(this.data,n+2);else break;if((this.data[n+2]&1)==0){let r=this.data[n+1];t.some((a,o)=>o&1&&a==r)||t.push(this.data[n],r)}}return t}configure(e){let t=Object.assign(Object.create(eh.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(n=>{let r=e.tokenizers.find(a=>a.from==n);return r?r.to:n})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((n,r)=>{let a=e.specializers.find(c=>c.from==n.external);if(!a)return n;let o=Object.assign(Object.assign({},n),{external:a.to});return t.specializers[r]=HS(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let a of e.split(" ")){let o=t.indexOf(a);o>=0&&(n[o]=!0)}let r=null;for(let a=0;a<t.length;a++)if(!n[a])for(let o=this.dialects[t[a]],c;(c=this.data[o++])!=65535;)(r||(r=new Uint8Array(this.maxTerm+1)))[c]=1;return new xj(e,n,r)}static deserialize(e){return new eh(e)}}function Xi(i,e){return i[e]|i[e+1]<<16}function Sj(i){let e=null;for(let t of i){let n=t.p.stoppedAt;(t.pos==t.p.stream.end||n!=null&&t.pos>n)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function HS(i){if(i.external){let e=i.extend?1:0;return(t,n)=>i.external(t,n)<<1|e}return i.get}const wj=36,US=1,kj=2,Vl=3,kp=4,Cj=5,Aj=6,Tj=7,Oj=8,Mj=9,Ej=10,Rj=11,Dj=12,Nj=13,Bj=14,Lj=15,jj=16,zj=17,PS=18,_j=19,N2=20,B2=21,qS=22,Hj=23,Uj=24;function Lg(i){return i>=65&&i<=90||i>=97&&i<=122||i>=48&&i<=57}function Pj(i){return i>=48&&i<=57||i>=97&&i<=102||i>=65&&i<=70}function jr(i,e,t){for(let n=!1;;){if(i.next<0)return;if(i.next==e&&!n){i.advance();return}n=t&&!n&&i.next==92,i.advance()}}function qj(i,e){e:for(;;){if(i.next<0)return;if(i.next==36){i.advance();for(let t=0;t<e.length;t++){if(i.next!=e.charCodeAt(t))continue e;i.advance()}if(i.next==36){i.advance();return}}else i.advance()}}function Vj(i,e){let t="[{<(".indexOf(String.fromCharCode(e)),n=t<0?e:"]}>)".charCodeAt(t);for(;;){if(i.next<0)return;if(i.next==n&&i.peek(1)==39){i.advance(2);return}i.advance()}}function jg(i,e){for(;!(i.next!=95&&!Lg(i.next));)e!=null&&(e+=String.fromCharCode(i.next)),i.advance();return e}function Qj(i){if(i.next==39||i.next==34||i.next==96){let e=i.next;i.advance(),jr(i,e,!1)}else jg(i)}function VS(i,e){for(;i.next==48||i.next==49;)i.advance();e&&i.next==e&&i.advance()}function QS(i,e){for(;;){if(i.next==46){if(e)break;e=!0}else if(i.next<48||i.next>57)break;i.advance()}if(i.next==69||i.next==101)for(i.advance(),(i.next==43||i.next==45)&&i.advance();i.next>=48&&i.next<=57;)i.advance()}function IS(i){for(;!(i.next<0||i.next==10);)i.advance()}function Nr(i,e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)==i)return!0;return!1}const Cp=` \r
176
- `;function L2(i,e,t){let n=Object.create(null);n.true=n.false=Cj,n.null=n.unknown=Aj;for(let r of i.split(" "))r&&(n[r]=N2);for(let r of e.split(" "))r&&(n[r]=B2);for(let r of(t||"").split(" "))r&&(n[r]=Uj);return n}const j2="array binary bit boolean char character clob date decimal double float int integer interval large national nchar nclob numeric object precision real smallint time timestamp varchar varying ",z2="absolute action add after all allocate alter and any are as asc assertion at authorization before begin between both breadth by call cascade cascaded case cast catalog check close collate collation column commit condition connect connection constraint constraints constructor continue corresponding count create cross cube current current_date current_default_transform_group current_transform_group_for_type current_path current_role current_time current_timestamp current_user cursor cycle data day deallocate declare default deferrable deferred delete depth deref desc describe descriptor deterministic diagnostics disconnect distinct do domain drop dynamic each else elseif end end-exec equals escape except exception exec execute exists exit external fetch first for foreign found from free full function general get global go goto grant group grouping handle having hold hour identity if immediate in indicator initially inner inout input insert intersect into is isolation join key language last lateral leading leave left level like limit local localtime localtimestamp locator loop map match method minute modifies module month names natural nesting new next no none not of old on only open option or order ordinality out outer output overlaps pad parameter partial path prepare preserve primary prior privileges procedure public read reads recursive redo ref references referencing relative release repeat resignal restrict result return returns revoke right role rollback rollup routine row rows savepoint schema scroll search second section select session session_user set sets signal similar size some space specific specifictype sql sqlexception sqlstate sqlwarning start state static system_user table temporary then timezone_hour timezone_minute to trailing transaction translation treat trigger under undo union unique unnest until update usage user using value values view when whenever where while with without work write year zone ",zg={backslashEscapes:!1,hashComments:!1,spaceAfterDashes:!1,slashComments:!1,doubleQuotedStrings:!1,doubleDollarQuotedStrings:!1,unquotedBitLiterals:!1,treatBitsAsBytes:!1,charSetCasts:!1,plsqlQuotingMechanism:!1,operatorChars:"*+-%<>!=&|~^/",specialVar:"?",identifierQuotes:'"',caseInsensitiveIdentifiers:!1,words:L2(z2,j2)};function Ij(i,e,t,n){let r={};for(let a in zg)r[a]=(i.hasOwnProperty(a)?i:zg)[a];return e&&(r.words=L2(e,t||"",n)),r}function _2(i){return new mj(e=>{var t;let{next:n}=e;if(e.advance(),Nr(n,Cp)){for(;Nr(e.next,Cp);)e.advance();e.acceptToken(wj)}else if(n==36&&i.doubleDollarQuotedStrings){let r=jg(e,"");e.next==36&&(e.advance(),qj(e,r),e.acceptToken(Vl))}else if(n==39||n==34&&i.doubleQuotedStrings)jr(e,n,i.backslashEscapes),e.acceptToken(Vl);else if(n==35&&i.hashComments||n==47&&e.next==47&&i.slashComments)IS(e),e.acceptToken(US);else if(n==45&&e.next==45&&(!i.spaceAfterDashes||e.peek(1)==32))IS(e),e.acceptToken(US);else if(n==47&&e.next==42){e.advance();for(let r=1;;){let a=e.next;if(e.next<0)break;if(e.advance(),a==42&&e.next==47){if(r--,e.advance(),!r)break}else a==47&&e.next==42&&(r++,e.advance())}e.acceptToken(kj)}else if((n==101||n==69)&&e.next==39)e.advance(),jr(e,39,!0),e.acceptToken(Vl);else if((n==110||n==78)&&e.next==39&&i.charSetCasts)e.advance(),jr(e,39,i.backslashEscapes),e.acceptToken(Vl);else if(n==95&&i.charSetCasts)for(let r=0;;r++){if(e.next==39&&r>1){e.advance(),jr(e,39,i.backslashEscapes),e.acceptToken(Vl);break}if(!Lg(e.next))break;e.advance()}else if(i.plsqlQuotingMechanism&&(n==113||n==81)&&e.next==39&&e.peek(1)>0&&!Nr(e.peek(1),Cp)){let r=e.peek(1);e.advance(2),Vj(e,r),e.acceptToken(Vl)}else if(Nr(n,i.identifierQuotes)){const r=n==91?93:n;jr(e,r,!1),e.acceptToken(_j)}else if(n==40)e.acceptToken(Tj);else if(n==41)e.acceptToken(Oj);else if(n==123)e.acceptToken(Mj);else if(n==125)e.acceptToken(Ej);else if(n==91)e.acceptToken(Rj);else if(n==93)e.acceptToken(Dj);else if(n==59)e.acceptToken(Nj);else if(i.unquotedBitLiterals&&n==48&&e.next==98)e.advance(),VS(e),e.acceptToken(qS);else if((n==98||n==66)&&(e.next==39||e.next==34)){const r=e.next;e.advance(),i.treatBitsAsBytes?(jr(e,r,i.backslashEscapes),e.acceptToken(Hj)):(VS(e,r),e.acceptToken(qS))}else if(n==48&&(e.next==120||e.next==88)||(n==120||n==88)&&e.next==39){let r=e.next==39;for(e.advance();Pj(e.next);)e.advance();r&&e.next==39&&e.advance(),e.acceptToken(kp)}else if(n==46&&e.next>=48&&e.next<=57)QS(e,!0),e.acceptToken(kp);else if(n==46)e.acceptToken(Bj);else if(n>=48&&n<=57)QS(e,!1),e.acceptToken(kp);else if(Nr(n,i.operatorChars)){for(;Nr(e.next,i.operatorChars);)e.advance();e.acceptToken(Lj)}else if(Nr(n,i.specialVar))e.next==n&&e.advance(),Qj(e),e.acceptToken(zj);else if(n==58||n==44)e.acceptToken(jj);else if(Lg(n)){let r=jg(e,String.fromCharCode(n));e.acceptToken(e.next==46||e.peek(-r.length-1)==46?PS:(t=i.words[r.toLowerCase()])!==null&&t!==void 0?t:PS)}})}const H2=_2(zg),Gj=eh.deserialize({version:14,states:"%vQ]QQOOO#wQRO'#DSO$OQQO'#CwO%eQQO'#CxO%lQQO'#CyO%sQQO'#CzOOQQ'#DS'#DSOOQQ'#C}'#C}O'UQRO'#C{OOQQ'#Cv'#CvOOQQ'#C|'#C|Q]QQOOQOQQOOO'`QQO'#DOO(xQRO,59cO)PQQO,59cO)UQQO'#DSOOQQ,59d,59dO)cQQO,59dOOQQ,59e,59eO)jQQO,59eOOQQ,59f,59fO)qQQO,59fOOQQ-E6{-E6{OOQQ,59b,59bOOQQ-E6z-E6zOOQQ,59j,59jOOQQ-E6|-E6|O+VQRO1G.}O+^QQO,59cOOQQ1G/O1G/OOOQQ1G/P1G/POOQQ1G/Q1G/QP+kQQO'#C}O+rQQO1G.}O)PQQO,59cO,PQQO'#Cw",stateData:",[~OtOSPOSQOS~ORUOSUOTUOUUOVROXSOZTO]XO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O^]ORvXSvXTvXUvXVvXXvXZvX]vX_vX`vXavXbvXcvXdvXevXfvXgvXhvX~OsvX~P!jOa_Ob_Oc_O~ORUOSUOTUOUUOVROXSOZTO^tO_UO`UOa`Ob`Oc`OdUOeUOfUOgUOhUO~OWaO~P$ZOYcO~P$ZO[eO~P$ZORUOSUOTUOUUOVROXSOZTO^QO_UO`UOaPObPOcPOdUOeUOfUOgUOhUO~O]hOsoX~P%zOajObjOcjO~O^]ORkaSkaTkaUkaVkaXkaZka]ka_ka`kaakabkackadkaekafkagkahka~Oska~P'kO^]O~OWvXYvX[vX~P!jOWnO~P$ZOYoO~P$ZO[pO~P$ZO^]ORkiSkiTkiUkiVkiXkiZki]ki_ki`kiakibkickidkiekifkigkihki~Oski~P)xOWkaYka[ka~P'kO]hO~P$ZOWkiYki[ki~P)xOasObsOcsO~O",goto:"#hwPPPPPPPPPPPPPPPPPPPPPPPPPPx||||!Y!^!d!xPPP#[TYOZeUORSTWZbdfqT[OZQZORiZSWOZQbRQdSQfTZgWbdfqQ^PWk^lmrQl_Qm`RrseVORSTWZbdfq",nodeNames:"⚠ LineComment BlockComment String Number Bool Null ( ) { } [ ] ; . Operator Punctuation SpecialVar Identifier QuotedIdentifier Keyword Type Bits Bytes Builtin Script Statement CompositeIdentifier Parens Braces Brackets Statement",maxTerm:38,nodeProps:[["isolate",-4,1,2,3,19,""]],skippedNodes:[0,1,2],repeatNodeCount:3,tokenData:"RORO",tokenizers:[0,H2],topRules:{Script:[0,25]},tokenPrec:0});function _g(i){let e=i.cursor().moveTo(i.from,-1);for(;/Comment/.test(e.name);)e.moveTo(e.from,-1);return e.node}function hu(i,e){let t=i.sliceString(e.from,e.to),n=/^([`'"\[])(.*)([`'"\]])$/.exec(t);return n?n[2]:t}function th(i){return i&&(i.name=="Identifier"||i.name=="QuotedIdentifier")}function Fj(i,e){if(e.name=="CompositeIdentifier"){let t=[];for(let n=e.firstChild;n;n=n.nextSibling)th(n)&&t.push(hu(i,n));return t}return[hu(i,e)]}function GS(i,e){for(let t=[];;){if(!e||e.name!=".")return t;let n=_g(e);if(!th(n))return t;t.unshift(hu(i,n)),e=_g(n)}}function Yj(i,e){let t=Qt(i).resolveInner(e,-1),n=Xj(i.doc,t);return t.name=="Identifier"||t.name=="QuotedIdentifier"||t.name=="Keyword"?{from:t.from,quoted:t.name=="QuotedIdentifier"?i.doc.sliceString(t.from,t.from+1):null,parents:GS(i.doc,_g(t)),aliases:n}:t.name=="."?{from:e,quoted:null,parents:GS(i.doc,t),aliases:n}:{from:e,quoted:null,parents:[],empty:!0,aliases:n}}const Kj=new Set("where group having order union intersect except all distinct limit offset fetch for".split(" "));function Xj(i,e){let t;for(let r=e;!t;r=r.parent){if(!r)return null;r.name=="Statement"&&(t=r)}let n=null;for(let r=t.firstChild,a=!1,o=null;r;r=r.nextSibling){let c=r.name=="Keyword"?i.sliceString(r.from,r.to).toLowerCase():null,h=null;if(!a)a=c=="from";else if(c=="as"&&o&&th(r.nextSibling))h=hu(i,r.nextSibling);else{if(c&&Kj.has(c))break;o&&th(r)&&(h=hu(i,r))}h&&(n||(n=Object.create(null)),n[h]=Fj(i,o)),o=/Identifier$/.test(r.name)?r:null}return n}function Wj(i,e,t){return t.map(n=>({...n,label:n.label[0]==i?n.label:i+n.label+e,apply:void 0}))}const $j=/^\w*$/,Zj=/^[`'"\[]?\w*[`'"\]]?$/;function FS(i){return i.self&&typeof i.self.label=="string"}class T0{constructor(e,t){this.idQuote=e,this.idCaseInsensitive=t,this.list=[],this.children=void 0}child(e){let t=this.children||(this.children=Object.create(null)),n=t[e];return n||(e&&!this.list.some(r=>r.label==e)&&this.list.push(YS(e,"type",this.idQuote,this.idCaseInsensitive)),t[e]=new T0(this.idQuote,this.idCaseInsensitive))}maybeChild(e){return this.children?this.children[e]:null}addCompletion(e){let t=this.list.findIndex(n=>n.label==e.label);t>-1?this.list[t]=e:this.list.push(e)}addCompletions(e){for(let t of e)this.addCompletion(typeof t=="string"?YS(t,"property",this.idQuote,this.idCaseInsensitive):t)}addNamespace(e){Array.isArray(e)?this.addCompletions(e):FS(e)?this.addNamespace(e.children):this.addNamespaceObject(e)}addNamespaceObject(e){for(let t of Object.keys(e)){let n=e[t],r=null,a=t.replace(/\\?\./g,c=>c=="."?"\0":c).split("\0"),o=this;FS(n)&&(r=n.self,n=n.children);for(let c=0;c<a.length;c++)r&&c==a.length-1&&o.addCompletion(r),o=o.child(a[c].replace(/\\\./g,"."));o.addNamespace(n)}}}function YS(i,e,t,n){return new RegExp("^[a-z_][a-z_\\d]*$",n?"i":"").test(i)?{label:i,type:e}:{label:i,type:e,apply:t+i+U2(t)}}function U2(i){return i==="["?"]":i}function Jj(i,e,t,n,r,a){var o;let c=((o=a==null?void 0:a.spec.identifierQuotes)===null||o===void 0?void 0:o[0])||'"',h=new T0(c,!!(a!=null&&a.spec.caseInsensitiveIdentifiers)),d=r?h.child(r):null;return h.addNamespace(i),e&&(d||h).addCompletions(e),t&&h.addCompletions(t),d&&h.addCompletions(d.list),n&&h.addCompletions((d||h).child(n).list),p=>{let{parents:y,from:b,quoted:v,empty:w,aliases:k}=Yj(p.state,p.pos);if(w&&!p.explicit)return null;k&&y.length==1&&(y=k[y[0]]||y);let A=h;for(let D of y){for(;!A.children||!A.children[D];)if(A==h&&d)A=d;else if(A==d&&n)A=A.child(n);else return null;let B=A.maybeChild(D);if(!B)return null;A=B}let O=A.list;if(A==h&&k&&(O=O.concat(Object.keys(k).map(D=>({label:D,type:"constant"})))),v){let D=v[0],B=U2(D),V=p.state.sliceDoc(p.pos,p.pos+1)==B;return{from:b,to:V?p.pos+1:void 0,options:Wj(D,B,O),validFor:Zj}}else return{from:b,options:O,validFor:$j}}}function e5(i){return i==B2?"type":i==N2?"keyword":"variable"}function t5(i,e,t){let n=Object.keys(i).map(r=>t(e?r.toUpperCase():r,e5(i[r])));return kB(["QuotedIdentifier","String","LineComment","BlockComment","."],XC(n))}let n5=Gj.configure({props:[_C.add({Statement:F4()}),UC.add({Statement(i,e){return{from:Math.min(i.from+100,e.doc.lineAt(i.from).to),to:i.to}},BlockComment(i){return{from:i.from+2,to:i.to-2}}}),BC({Keyword:J.keyword,Type:J.typeName,Builtin:J.standard(J.name),Bits:J.number,Bytes:J.string,Bool:J.bool,Null:J.null,Number:J.number,String:J.string,Identifier:J.name,QuotedIdentifier:J.special(J.string),SpecialVar:J.special(J.name),LineComment:J.lineComment,BlockComment:J.blockComment,Operator:J.operator,"Semi Punctuation":J.punctuation,"( )":J.paren,"{ }":J.brace,"[ ]":J.squareBracket})]});class du{constructor(e,t,n){this.dialect=e,this.language=t,this.spec=n}get extension(){return this.language.extension}configureLanguage(e,t){return new du(this.dialect,this.language.configure(e,t),this.spec)}static define(e){let t=Ij(e,e.keywords,e.types,e.builtin),n=Gf.define({name:"sql",parser:n5.configure({tokenizers:[{from:H2,to:_2(t)}]}),languageData:{commentTokens:{line:"--",block:{open:"/*",close:"*/"}},closeBrackets:{brackets:["(","[","{","'",'"',"`"]}}});return new du(t,n,e)}}function i5(i,e){return{label:i,type:e,boost:-1}}function s5(i,e=!1,t){return t5(i.dialect.words,e,t||i5)}function r5(i){return i.schema?Jj(i.schema,i.tables,i.schemas,i.defaultTable,i.defaultSchema,i.dialect||O0):()=>null}function l5(i){return i.schema?(i.dialect||O0).language.data.of({autocomplete:r5(i)}):[]}function KS(i={}){let e=i.dialect||O0;return new _4(e.language,[l5(i),e.language.data.of({autocomplete:s5(e,i.upperCaseKeywords,i.keywordCompletion)})])}const O0=du.define({}),XS=du.define({keywords:z2+"abort analyze attach autoincrement conflict database detach exclusive fail glob ignore index indexed instead isnull notnull offset plan pragma query raise regexp reindex rename replace temp vacuum virtual",types:j2+"bool blob long longblob longtext medium mediumblob mediumint mediumtext tinyblob tinyint tinytext text bigint int2 int8 unsigned signed real",builtin:"auth backup bail changes clone databases dbinfo dump echo eqp explain fullschema headers help import imposter indexes iotrace lint load log mode nullvalue once print prompt quit restore save scanstats separator shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width",operatorChars:"*+-%<>!=&|/~",identifierQuotes:'`"',specialVar:"@:?$"}),WS=new Ra,a5=new Ra;function o5({value:i,onChange:e,onExecute:t,schema:n=[],placeholder:r="SELECT * FROM users LIMIT 10;",className:a}){const o=T.useRef(null),c=T.useRef(null),h=T.useRef(e),d=T.useRef(t);T.useEffect(()=>{h.current=e},[e]),T.useEffect(()=>{d.current=t},[t]);const p=T.useMemo(()=>{const b={};for(const v of n)v.name.startsWith("_litestream_")||(b[v.name]=v.columns.map(w=>w.name));return b},[n]);T.useEffect(()=>{if(!o.current)return;const b=Pe.create({doc:i,extensions:[m4(),y4(),Z3(),aL(),iB(),F3(),$3(),K4(),pB(),rB(oB,{fallback:!0}),XB({defaultKeymap:!0}),WS.of(KS({dialect:XS,schema:p,upperCaseKeywords:!0})),Qf.of([...fj,...gL]),a5.of(Qf.of([{key:"Mod-Enter",run:()=>{var w;return(w=d.current)==null||w.call(d),!0}}])),pe.updateListener.of(w=>{w.docChanged&&h.current(w.state.doc.toString())}),pe.theme({"&":{height:"200px",fontSize:"14px"},".cm-scroller":{overflow:"auto",fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace'},".cm-content":{caretColor:"var(--color-foreground)"},"&.cm-focused .cm-cursor":{borderLeftColor:"var(--color-foreground)"},"&.cm-focused .cm-selectionBackground, ::selection":{backgroundColor:"var(--color-accent)"},".cm-gutters":{backgroundColor:"var(--color-muted)",color:"var(--color-muted-foreground)",border:"none",borderRight:"1px solid var(--color-border)"},".cm-activeLineGutter":{backgroundColor:"var(--color-accent)"},".cm-activeLine":{backgroundColor:"color-mix(in srgb, var(--color-accent) 50%, transparent)"},".cm-tooltip.cm-tooltip-autocomplete":{backgroundColor:"var(--color-popover)",border:"1px solid var(--color-border)",borderRadius:"6px"},".cm-tooltip.cm-tooltip-autocomplete > ul":{fontFamily:'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace',fontSize:"13px"},".cm-tooltip.cm-tooltip-autocomplete > ul > li":{padding:"4px 8px"},".cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"var(--color-accent)",color:"var(--color-accent-foreground)"},".cm-placeholder":{color:"var(--color-muted-foreground)"}}),pe.contentAttributes.of({"aria-label":"SQL Editor"})]}),v=new pe({state:b,parent:o.current});return c.current=v,()=>{v.destroy(),c.current=null}},[]),T.useEffect(()=>{const b=c.current;b&&b.dispatch({effects:WS.reconfigure(KS({dialect:XS,schema:p,upperCaseKeywords:!0}))})},[p]),T.useEffect(()=>{const b=c.current;if(!b)return;const v=b.state.doc.toString();i!==v&&b.dispatch({changes:{from:0,to:v.length,insert:i}})},[i]);const y=T.useCallback(b=>{const v=c.current;if(!v)return;const{from:w,to:k}=v.state.selection.main;v.dispatch({changes:{from:w,to:k,insert:b},selection:{anchor:w+b.length}}),v.focus()},[]);return T.useEffect(()=>{o.current&&(o.current.insertText=y)},[y]),S.jsx("div",{ref:o,className:`overflow-hidden rounded-md border bg-background ${a??""}`,"data-placeholder":r})}function Xt({className:i,...e}){return S.jsx("div",{"data-slot":"card",className:tt("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",i),...e})}function on({className:i,...e}){return S.jsx("div",{"data-slot":"card-header",className:tt("@container/card-header has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6 grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6",i),...e})}function un({className:i,...e}){return S.jsx("div",{"data-slot":"card-title",className:tt("font-semibold leading-none",i),...e})}function el({className:i,...e}){return S.jsx("div",{"data-slot":"card-description",className:tt("text-muted-foreground text-sm",i),...e})}function Wt({className:i,...e}){return S.jsx("div",{"data-slot":"card-content",className:tt("px-6",i),...e})}function vh({className:i,...e}){return S.jsx("table",{"data-slot":"table",className:tt("w-full caption-bottom text-sm",i),...e})}function xh({className:i,...e}){return S.jsx("thead",{"data-slot":"table-header",className:tt("[&_tr]:border-b",i),...e})}function Sh({className:i,...e}){return S.jsx("tbody",{"data-slot":"table-body",className:tt("[&_tr:last-child]:border-0",i),...e})}function cr({className:i,...e}){return S.jsx("tr",{"data-slot":"table-row",className:tt("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors",i),...e})}function Tn({className:i,...e}){return S.jsx("th",{"data-slot":"table-head",className:tt("text-foreground h-10 whitespace-nowrap px-2 text-left align-middle font-medium [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",i),...e})}function On({className:i,...e}){return S.jsx("td",{"data-slot":"table-cell",className:tt("whitespace-nowrap p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",i),...e})}function u5(i){return i===null?"NULL":i===void 0?"":typeof i=="object"?JSON.stringify(i):String(i)}function c5({results:i,meta:e,error:t}){if(t)return S.jsxs(Xt,{className:"border-destructive/50",children:[S.jsx(on,{children:S.jsx(un,{className:"text-destructive",children:"Query Error"})}),S.jsx(Wt,{children:S.jsx("p",{className:"font-mono text-sm text-destructive",children:t})})]});const n=i.length>0?Object.keys(i[0]):[];return S.jsxs(Xt,{children:[S.jsxs(on,{children:[S.jsx(un,{children:"Results"}),S.jsxs(el,{className:"flex items-center gap-4",children:[S.jsxs("span",{children:[i.length," row(s)"]}),S.jsxs("span",{children:[e.duration.toFixed(2),"ms"]}),e.rows_written>0&&S.jsxs("span",{children:[e.rows_written," row(s) affected"]})]})]}),S.jsx(Wt,{children:i.length>0?S.jsx("div",{className:"overflow-x-auto rounded-md border",children:S.jsxs(vh,{children:[S.jsx(xh,{children:S.jsx(cr,{children:n.map(r=>S.jsx(Tn,{className:"font-mono",children:r},r))})}),S.jsx(Sh,{children:i.map((r,a)=>S.jsx(cr,{children:n.map(o=>S.jsx(On,{className:"font-mono text-sm",children:u5(r[o])},o))},a))})]})}):S.jsx("p",{className:"text-center text-muted-foreground",children:"Query executed successfully. No rows returned."})})]})}function zt(i,e,{checkForDefaultPrevented:t=!0}={}){return function(r){if(i==null||i(r),t===!1||!r.defaultPrevented)return e==null?void 0:e(r)}}function Mu(i,e=[]){let t=[];function n(a,o){const c=T.createContext(o),h=t.length;t=[...t,o];const d=y=>{var O;const{scope:b,children:v,...w}=y,k=((O=b==null?void 0:b[i])==null?void 0:O[h])||c,A=T.useMemo(()=>w,Object.values(w));return S.jsx(k.Provider,{value:A,children:v})};d.displayName=a+"Provider";function p(y,b){var k;const v=((k=b==null?void 0:b[i])==null?void 0:k[h])||c,w=T.useContext(v);if(w)return w;if(o!==void 0)return o;throw new Error(`\`${y}\` must be used within \`${a}\``)}return[d,p]}const r=()=>{const a=t.map(o=>T.createContext(o));return function(c){const h=(c==null?void 0:c[i])||a;return T.useMemo(()=>({[`__scope${i}`]:{...c,[i]:h}}),[c,h])}};return r.scopeName=i,[n,f5(r,...e)]}function f5(...i){const e=i[0];if(i.length===1)return e;const t=()=>{const n=i.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(a){const o=n.reduce((c,{useScope:h,scopeName:d})=>{const y=h(a)[`__scope${d}`];return{...c,...y}},{});return T.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return t.scopeName=e.scopeName,t}var Sa=globalThis!=null&&globalThis.document?T.useLayoutEffect:()=>{},h5=xw[" useInsertionEffect ".trim().toString()]||Sa;function M0({prop:i,defaultProp:e,onChange:t=()=>{},caller:n}){const[r,a,o]=d5({defaultProp:e,onChange:t}),c=i!==void 0,h=c?i:r;{const p=T.useRef(i!==void 0);T.useEffect(()=>{const y=p.current;y!==c&&console.warn(`${n} is changing from ${y?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=c},[c,n])}const d=T.useCallback(p=>{var y;if(c){const b=m5(p)?p(i):p;b!==i&&((y=o.current)==null||y.call(o,b))}else a(p)},[c,i,a,o]);return[h,d]}function d5({defaultProp:i,onChange:e}){const[t,n]=T.useState(i),r=T.useRef(t),a=T.useRef(e);return h5(()=>{a.current=e},[e]),T.useEffect(()=>{var o;r.current!==t&&((o=a.current)==null||o.call(a,t),r.current=t)},[t,r]),[t,n,a]}function m5(i){return typeof i=="function"}var p5=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],dn=p5.reduce((i,e)=>{const t=Nf(`Primitive.${e}`),n=T.forwardRef((r,a)=>{const{asChild:o,...c}=r,h=o?t:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),S.jsx(h,{...c,ref:a})});return n.displayName=`Primitive.${e}`,{...i,[e]:n}},{});function g5(i,e){return T.useReducer((t,n)=>e[t][n]??t,i)}var tl=i=>{const{present:e,children:t}=i,n=y5(e),r=typeof t=="function"?t({present:n.isPresent}):T.Children.only(t),a=li(n.ref,b5(r));return typeof t=="function"||n.isPresent?T.cloneElement(r,{ref:a}):null};tl.displayName="Presence";function y5(i){const[e,t]=T.useState(),n=T.useRef(null),r=T.useRef(i),a=T.useRef("none"),o=i?"mounted":"unmounted",[c,h]=g5(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return T.useEffect(()=>{const d=pf(n.current);a.current=c==="mounted"?d:"none"},[c]),Sa(()=>{const d=n.current,p=r.current;if(p!==i){const b=a.current,v=pf(d);i?h("MOUNT"):v==="none"||(d==null?void 0:d.display)==="none"?h("UNMOUNT"):h(p&&b!==v?"ANIMATION_OUT":"UNMOUNT"),r.current=i}},[i,h]),Sa(()=>{if(e){let d;const p=e.ownerDocument.defaultView??window,y=v=>{const k=pf(n.current).includes(CSS.escape(v.animationName));if(v.target===e&&k&&(h("ANIMATION_END"),!r.current)){const A=e.style.animationFillMode;e.style.animationFillMode="forwards",d=p.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=A)})}},b=v=>{v.target===e&&(a.current=pf(n.current))};return e.addEventListener("animationstart",b),e.addEventListener("animationcancel",y),e.addEventListener("animationend",y),()=>{p.clearTimeout(d),e.removeEventListener("animationstart",b),e.removeEventListener("animationcancel",y),e.removeEventListener("animationend",y)}}else h("ANIMATION_END")},[e,h]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:T.useCallback(d=>{n.current=d?getComputedStyle(d):null,t(d)},[])}}function pf(i){return(i==null?void 0:i.animationName)||"none"}function b5(i){var n,r;let e=(n=Object.getOwnPropertyDescriptor(i.props,"ref"))==null?void 0:n.get,t=e&&"isReactWarning"in e&&e.isReactWarning;return t?i.ref:(e=(r=Object.getOwnPropertyDescriptor(i,"ref"))==null?void 0:r.get,t=e&&"isReactWarning"in e&&e.isReactWarning,t?i.props.ref:i.props.ref||i.ref)}var v5=xw[" useId ".trim().toString()]||(()=>{}),x5=0;function E0(i){const[e,t]=T.useState(v5());return Sa(()=>{t(n=>n??String(x5++))},[i]),i||(e?`radix-${e}`:"")}var wh="Collapsible",[S5,qz]=Mu(wh),[w5,R0]=S5(wh),P2=T.forwardRef((i,e)=>{const{__scopeCollapsible:t,open:n,defaultOpen:r,disabled:a,onOpenChange:o,...c}=i,[h,d]=M0({prop:n,defaultProp:r??!1,onChange:o,caller:wh});return S.jsx(w5,{scope:t,disabled:a,contentId:E0(),open:h,onOpenToggle:T.useCallback(()=>d(p=>!p),[d]),children:S.jsx(dn.div,{"data-state":N0(h),"data-disabled":a?"":void 0,...c,ref:e})})});P2.displayName=wh;var q2="CollapsibleTrigger",V2=T.forwardRef((i,e)=>{const{__scopeCollapsible:t,...n}=i,r=R0(q2,t);return S.jsx(dn.button,{type:"button","aria-controls":r.contentId,"aria-expanded":r.open||!1,"data-state":N0(r.open),"data-disabled":r.disabled?"":void 0,disabled:r.disabled,...n,ref:e,onClick:zt(i.onClick,r.onOpenToggle)})});V2.displayName=q2;var D0="CollapsibleContent",Q2=T.forwardRef((i,e)=>{const{forceMount:t,...n}=i,r=R0(D0,i.__scopeCollapsible);return S.jsx(tl,{present:t||r.open,children:({present:a})=>S.jsx(k5,{...n,ref:e,present:a})})});Q2.displayName=D0;var k5=T.forwardRef((i,e)=>{const{__scopeCollapsible:t,present:n,children:r,...a}=i,o=R0(D0,t),[c,h]=T.useState(n),d=T.useRef(null),p=li(e,d),y=T.useRef(0),b=y.current,v=T.useRef(0),w=v.current,k=o.open||c,A=T.useRef(k),O=T.useRef(void 0);return T.useEffect(()=>{const D=requestAnimationFrame(()=>A.current=!1);return()=>cancelAnimationFrame(D)},[]),Sa(()=>{const D=d.current;if(D){O.current=O.current||{transitionDuration:D.style.transitionDuration,animationName:D.style.animationName},D.style.transitionDuration="0s",D.style.animationName="none";const B=D.getBoundingClientRect();y.current=B.height,v.current=B.width,A.current||(D.style.transitionDuration=O.current.transitionDuration,D.style.animationName=O.current.animationName),h(n)}},[o.open,n]),S.jsx(dn.div,{"data-state":N0(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!k,...a,ref:p,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":w?`${w}px`:void 0,...i.style},children:k&&r})});function N0(i){return i?"open":"closed"}var C5=P2;const A5=C5,T5=V2,O5=Q2;function Qs(i){const e=T.useRef(i);return T.useEffect(()=>{e.current=i}),T.useMemo(()=>(...t)=>{var n;return(n=e.current)==null?void 0:n.call(e,...t)},[])}var M5=T.createContext(void 0);function B0(i){const e=T.useContext(M5);return i||e||"ltr"}function E5(i,[e,t]){return Math.min(t,Math.max(e,i))}function R5(i,e){return T.useReducer((t,n)=>e[t][n]??t,i)}var L0="ScrollArea",[I2,Vz]=Mu(L0),[D5,Xn]=I2(L0),G2=T.forwardRef((i,e)=>{const{__scopeScrollArea:t,type:n="hover",dir:r,scrollHideDelay:a=600,...o}=i,[c,h]=T.useState(null),[d,p]=T.useState(null),[y,b]=T.useState(null),[v,w]=T.useState(null),[k,A]=T.useState(null),[O,D]=T.useState(0),[B,V]=T.useState(0),[j,Q]=T.useState(!1),[I,q]=T.useState(!1),Y=li(e,le=>h(le)),te=B0(r);return S.jsx(D5,{scope:t,type:n,dir:te,scrollHideDelay:a,scrollArea:c,viewport:d,onViewportChange:p,content:y,onContentChange:b,scrollbarX:v,onScrollbarXChange:w,scrollbarXEnabled:j,onScrollbarXEnabledChange:Q,scrollbarY:k,onScrollbarYChange:A,scrollbarYEnabled:I,onScrollbarYEnabledChange:q,onCornerWidthChange:D,onCornerHeightChange:V,children:S.jsx(dn.div,{dir:te,...o,ref:Y,style:{position:"relative","--radix-scroll-area-corner-width":O+"px","--radix-scroll-area-corner-height":B+"px",...i.style}})})});G2.displayName=L0;var F2="ScrollAreaViewport",Y2=T.forwardRef((i,e)=>{const{__scopeScrollArea:t,children:n,nonce:r,...a}=i,o=Xn(F2,t),c=T.useRef(null),h=li(e,c,o.onViewportChange);return S.jsxs(S.Fragment,{children:[S.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),S.jsx(dn.div,{"data-radix-scroll-area-viewport":"",...a,ref:h,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...i.style},children:S.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:n})})]})});Y2.displayName=F2;var Di="ScrollAreaScrollbar",K2=T.forwardRef((i,e)=>{const{forceMount:t,...n}=i,r=Xn(Di,i.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=r,c=i.orientation==="horizontal";return T.useEffect(()=>(c?a(!0):o(!0),()=>{c?a(!1):o(!1)}),[c,a,o]),r.type==="hover"?S.jsx(N5,{...n,ref:e,forceMount:t}):r.type==="scroll"?S.jsx(B5,{...n,ref:e,forceMount:t}):r.type==="auto"?S.jsx(X2,{...n,ref:e,forceMount:t}):r.type==="always"?S.jsx(j0,{...n,ref:e}):null});K2.displayName=Di;var N5=T.forwardRef((i,e)=>{const{forceMount:t,...n}=i,r=Xn(Di,i.__scopeScrollArea),[a,o]=T.useState(!1);return T.useEffect(()=>{const c=r.scrollArea;let h=0;if(c){const d=()=>{window.clearTimeout(h),o(!0)},p=()=>{h=window.setTimeout(()=>o(!1),r.scrollHideDelay)};return c.addEventListener("pointerenter",d),c.addEventListener("pointerleave",p),()=>{window.clearTimeout(h),c.removeEventListener("pointerenter",d),c.removeEventListener("pointerleave",p)}}},[r.scrollArea,r.scrollHideDelay]),S.jsx(tl,{present:t||a,children:S.jsx(X2,{"data-state":a?"visible":"hidden",...n,ref:e})})}),B5=T.forwardRef((i,e)=>{const{forceMount:t,...n}=i,r=Xn(Di,i.__scopeScrollArea),a=i.orientation==="horizontal",o=Ch(()=>h("SCROLL_END"),100),[c,h]=R5("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return T.useEffect(()=>{if(c==="idle"){const d=window.setTimeout(()=>h("HIDE"),r.scrollHideDelay);return()=>window.clearTimeout(d)}},[c,r.scrollHideDelay,h]),T.useEffect(()=>{const d=r.viewport,p=a?"scrollLeft":"scrollTop";if(d){let y=d[p];const b=()=>{const v=d[p];y!==v&&(h("SCROLL"),o()),y=v};return d.addEventListener("scroll",b),()=>d.removeEventListener("scroll",b)}},[r.viewport,a,h,o]),S.jsx(tl,{present:t||c!=="hidden",children:S.jsx(j0,{"data-state":c==="hidden"?"hidden":"visible",...n,ref:e,onPointerEnter:zt(i.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:zt(i.onPointerLeave,()=>h("POINTER_LEAVE"))})})}),X2=T.forwardRef((i,e)=>{const t=Xn(Di,i.__scopeScrollArea),{forceMount:n,...r}=i,[a,o]=T.useState(!1),c=i.orientation==="horizontal",h=Ch(()=>{if(t.viewport){const d=t.viewport.offsetWidth<t.viewport.scrollWidth,p=t.viewport.offsetHeight<t.viewport.scrollHeight;o(c?d:p)}},10);return wa(t.viewport,h),wa(t.content,h),S.jsx(tl,{present:n||a,children:S.jsx(j0,{"data-state":a?"visible":"hidden",...r,ref:e})})}),j0=T.forwardRef((i,e)=>{const{orientation:t="vertical",...n}=i,r=Xn(Di,i.__scopeScrollArea),a=T.useRef(null),o=T.useRef(0),[c,h]=T.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=eA(c.viewport,c.content),p={...n,sizes:c,onSizesChange:h,hasThumb:d>0&&d<1,onThumbChange:b=>a.current=b,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:b=>o.current=b};function y(b,v){return U5(b,o.current,c,v)}return t==="horizontal"?S.jsx(L5,{...p,ref:e,onThumbPositionChange:()=>{if(r.viewport&&a.current){const b=r.viewport.scrollLeft,v=$S(b,c,r.dir);a.current.style.transform=`translate3d(${v}px, 0, 0)`}},onWheelScroll:b=>{r.viewport&&(r.viewport.scrollLeft=b)},onDragScroll:b=>{r.viewport&&(r.viewport.scrollLeft=y(b,r.dir))}}):t==="vertical"?S.jsx(j5,{...p,ref:e,onThumbPositionChange:()=>{if(r.viewport&&a.current){const b=r.viewport.scrollTop,v=$S(b,c);a.current.style.transform=`translate3d(0, ${v}px, 0)`}},onWheelScroll:b=>{r.viewport&&(r.viewport.scrollTop=b)},onDragScroll:b=>{r.viewport&&(r.viewport.scrollTop=y(b))}}):null}),L5=T.forwardRef((i,e)=>{const{sizes:t,onSizesChange:n,...r}=i,a=Xn(Di,i.__scopeScrollArea),[o,c]=T.useState(),h=T.useRef(null),d=li(e,h,a.onScrollbarXChange);return T.useEffect(()=>{h.current&&c(getComputedStyle(h.current))},[h]),S.jsx($2,{"data-orientation":"horizontal",...r,ref:d,sizes:t,style:{bottom:0,left:a.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:a.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":kh(t)+"px",...i.style},onThumbPointerDown:p=>i.onThumbPointerDown(p.x),onDragScroll:p=>i.onDragScroll(p.x),onWheelScroll:(p,y)=>{if(a.viewport){const b=a.viewport.scrollLeft+p.deltaX;i.onWheelScroll(b),nA(b,y)&&p.preventDefault()}},onResize:()=>{h.current&&a.viewport&&o&&n({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:ih(o.paddingLeft),paddingEnd:ih(o.paddingRight)}})}})}),j5=T.forwardRef((i,e)=>{const{sizes:t,onSizesChange:n,...r}=i,a=Xn(Di,i.__scopeScrollArea),[o,c]=T.useState(),h=T.useRef(null),d=li(e,h,a.onScrollbarYChange);return T.useEffect(()=>{h.current&&c(getComputedStyle(h.current))},[h]),S.jsx($2,{"data-orientation":"vertical",...r,ref:d,sizes:t,style:{top:0,right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":kh(t)+"px",...i.style},onThumbPointerDown:p=>i.onThumbPointerDown(p.y),onDragScroll:p=>i.onDragScroll(p.y),onWheelScroll:(p,y)=>{if(a.viewport){const b=a.viewport.scrollTop+p.deltaY;i.onWheelScroll(b),nA(b,y)&&p.preventDefault()}},onResize:()=>{h.current&&a.viewport&&o&&n({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:ih(o.paddingTop),paddingEnd:ih(o.paddingBottom)}})}})}),[z5,W2]=I2(Di),$2=T.forwardRef((i,e)=>{const{__scopeScrollArea:t,sizes:n,hasThumb:r,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:c,onThumbPositionChange:h,onDragScroll:d,onWheelScroll:p,onResize:y,...b}=i,v=Xn(Di,t),[w,k]=T.useState(null),A=li(e,Y=>k(Y)),O=T.useRef(null),D=T.useRef(""),B=v.viewport,V=n.content-n.viewport,j=Qs(p),Q=Qs(h),I=Ch(y,10);function q(Y){if(O.current){const te=Y.clientX-O.current.left,le=Y.clientY-O.current.top;d({x:te,y:le})}}return T.useEffect(()=>{const Y=te=>{const le=te.target;(w==null?void 0:w.contains(le))&&j(te,V)};return document.addEventListener("wheel",Y,{passive:!1}),()=>document.removeEventListener("wheel",Y,{passive:!1})},[B,w,V,j]),T.useEffect(Q,[n,Q]),wa(w,I),wa(v.content,I),S.jsx(z5,{scope:t,scrollbar:w,hasThumb:r,onThumbChange:Qs(a),onThumbPointerUp:Qs(o),onThumbPositionChange:Q,onThumbPointerDown:Qs(c),children:S.jsx(dn.div,{...b,ref:A,style:{position:"absolute",...b.style},onPointerDown:zt(i.onPointerDown,Y=>{Y.button===0&&(Y.target.setPointerCapture(Y.pointerId),O.current=w.getBoundingClientRect(),D.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",v.viewport&&(v.viewport.style.scrollBehavior="auto"),q(Y))}),onPointerMove:zt(i.onPointerMove,q),onPointerUp:zt(i.onPointerUp,Y=>{const te=Y.target;te.hasPointerCapture(Y.pointerId)&&te.releasePointerCapture(Y.pointerId),document.body.style.webkitUserSelect=D.current,v.viewport&&(v.viewport.style.scrollBehavior=""),O.current=null})})})}),nh="ScrollAreaThumb",Z2=T.forwardRef((i,e)=>{const{forceMount:t,...n}=i,r=W2(nh,i.__scopeScrollArea);return S.jsx(tl,{present:t||r.hasThumb,children:S.jsx(_5,{ref:e,...n})})}),_5=T.forwardRef((i,e)=>{const{__scopeScrollArea:t,style:n,...r}=i,a=Xn(nh,t),o=W2(nh,t),{onThumbPositionChange:c}=o,h=li(e,y=>o.onThumbChange(y)),d=T.useRef(void 0),p=Ch(()=>{d.current&&(d.current(),d.current=void 0)},100);return T.useEffect(()=>{const y=a.viewport;if(y){const b=()=>{if(p(),!d.current){const v=P5(y,c);d.current=v,c()}};return c(),y.addEventListener("scroll",b),()=>y.removeEventListener("scroll",b)}},[a.viewport,p,c]),S.jsx(dn.div,{"data-state":o.hasThumb?"visible":"hidden",...r,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...n},onPointerDownCapture:zt(i.onPointerDownCapture,y=>{const v=y.target.getBoundingClientRect(),w=y.clientX-v.left,k=y.clientY-v.top;o.onThumbPointerDown({x:w,y:k})}),onPointerUp:zt(i.onPointerUp,o.onThumbPointerUp)})});Z2.displayName=nh;var z0="ScrollAreaCorner",J2=T.forwardRef((i,e)=>{const t=Xn(z0,i.__scopeScrollArea),n=!!(t.scrollbarX&&t.scrollbarY);return t.type!=="scroll"&&n?S.jsx(H5,{...i,ref:e}):null});J2.displayName=z0;var H5=T.forwardRef((i,e)=>{const{__scopeScrollArea:t,...n}=i,r=Xn(z0,t),[a,o]=T.useState(0),[c,h]=T.useState(0),d=!!(a&&c);return wa(r.scrollbarX,()=>{var y;const p=((y=r.scrollbarX)==null?void 0:y.offsetHeight)||0;r.onCornerHeightChange(p),h(p)}),wa(r.scrollbarY,()=>{var y;const p=((y=r.scrollbarY)==null?void 0:y.offsetWidth)||0;r.onCornerWidthChange(p),o(p)}),d?S.jsx(dn.div,{...n,ref:e,style:{width:a,height:c,position:"absolute",right:r.dir==="ltr"?0:void 0,left:r.dir==="rtl"?0:void 0,bottom:0,...i.style}}):null});function ih(i){return i?parseInt(i,10):0}function eA(i,e){const t=i/e;return isNaN(t)?0:t}function kh(i){const e=eA(i.viewport,i.content),t=i.scrollbar.paddingStart+i.scrollbar.paddingEnd,n=(i.scrollbar.size-t)*e;return Math.max(n,18)}function U5(i,e,t,n="ltr"){const r=kh(t),a=r/2,o=e||a,c=r-o,h=t.scrollbar.paddingStart+o,d=t.scrollbar.size-t.scrollbar.paddingEnd-c,p=t.content-t.viewport,y=n==="ltr"?[0,p]:[p*-1,0];return tA([h,d],y)(i)}function $S(i,e,t="ltr"){const n=kh(e),r=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,a=e.scrollbar.size-r,o=e.content-e.viewport,c=a-n,h=t==="ltr"?[0,o]:[o*-1,0],d=E5(i,h);return tA([0,o],[0,c])(d)}function tA(i,e){return t=>{if(i[0]===i[1]||e[0]===e[1])return e[0];const n=(e[1]-e[0])/(i[1]-i[0]);return e[0]+n*(t-i[0])}}function nA(i,e){return i>0&&i<e}var P5=(i,e=()=>{})=>{let t={left:i.scrollLeft,top:i.scrollTop},n=0;return(function r(){const a={left:i.scrollLeft,top:i.scrollTop},o=t.left!==a.left,c=t.top!==a.top;(o||c)&&e(),t=a,n=window.requestAnimationFrame(r)})(),()=>window.cancelAnimationFrame(n)};function Ch(i,e){const t=Qs(i),n=T.useRef(0);return T.useEffect(()=>()=>window.clearTimeout(n.current),[]),T.useCallback(()=>{window.clearTimeout(n.current),n.current=window.setTimeout(t,e)},[t,e])}function wa(i,e){const t=Qs(e);Sa(()=>{let n=0;if(i){const r=new ResizeObserver(()=>{cancelAnimationFrame(n),n=window.requestAnimationFrame(t)});return r.observe(i),()=>{window.cancelAnimationFrame(n),r.unobserve(i)}}},[i,t])}var q5=G2,V5=Y2,Q5=J2;function I5({className:i,children:e,...t}){return S.jsxs(q5,{"data-slot":"scroll-area",className:tt("relative",i),...t,children:[S.jsx(V5,{"data-slot":"scroll-area-viewport",className:"focus-visible:ring-ring/50 size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:outline-1",children:e}),S.jsx(G5,{}),S.jsx(Q5,{})]})}function G5({className:i,orientation:e="vertical",...t}){return S.jsx(K2,{"data-slot":"scroll-area-scrollbar",orientation:e,className:tt("flex touch-none p-px transition-colors select-none",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent",i),...t,children:S.jsx(Z2,{"data-slot":"scroll-area-thumb",className:"bg-border relative flex-1 rounded-full"})})}function F5({column:i,onInsertText:e}){return S.jsxs("button",{onClick:()=>e==null?void 0:e(i.name),className:"flex w-full items-center gap-2 rounded px-2 py-1 text-left text-xs hover:bg-muted",title:`Click to insert "${i.name}"`,children:[i.primaryKey?S.jsx(OR,{className:"h-3 w-3 shrink-0 text-yellow-500"}):S.jsx(vR,{className:"h-3 w-3 shrink-0 text-muted-foreground"}),S.jsx("span",{className:"truncate font-mono",children:i.name}),S.jsxs("span",{className:"ml-auto truncate text-muted-foreground",children:[i.type,i.notNull&&!i.primaryKey&&" NOT NULL"]})]})}function Y5({table:i,onInsertText:e}){const[t,n]=T.useState(!1);return S.jsxs(A5,{open:t,onOpenChange:n,children:[S.jsxs(T5,{className:"flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-left text-sm hover:bg-muted",children:[t?S.jsx(uR,{className:"h-4 w-4 shrink-0"}):S.jsx(Qw,{className:"h-4 w-4 shrink-0"}),S.jsx(Gw,{className:"h-4 w-4 shrink-0 text-blue-500"}),S.jsx("span",{className:"truncate font-medium cursor-pointer",onClick:r=>{r.stopPropagation(),e==null||e(i.name)},title:`Click to insert "${i.name}"`,children:i.name}),S.jsxs("span",{className:"ml-auto text-xs text-muted-foreground",children:[i.columns.length," cols"]})]}),S.jsx(O5,{children:S.jsx("div",{className:"ml-4 border-l pl-2",children:i.columns.map(r=>S.jsx(F5,{column:r,onInsertText:e},r.name))})})]})}function K5({bindingName:i,onInsertText:e}){const{data:t,isLoading:n,refetch:r}=Ei({queryKey:["schema",i],queryFn:()=>ok(i),staleTime:3e4}),o=((t==null?void 0:t.tables)||[]).filter(c=>!c.name.startsWith("_litestream_"));return S.jsxs("div",{className:"flex h-full flex-col border-l bg-card",children:[S.jsxs("div",{className:"flex items-center justify-between border-b px-3 py-2",children:[S.jsx("h3",{className:"text-sm font-semibold",children:"Tables"}),S.jsx(Ji,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>r(),disabled:n,children:S.jsx(Iw,{className:tt("h-4 w-4",n&&"animate-spin")})})]}),S.jsx(I5,{className:"flex-1",children:S.jsx("div",{className:"p-2",children:n?S.jsx("p",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"Loading schema..."}):o.length===0?S.jsx("p",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No tables found"}):S.jsx("div",{className:"space-y-0.5",children:o.map(c=>S.jsx(Y5,{table:c,onInsertText:e},c.name))})})}),S.jsx("div",{className:"border-t px-3 py-2 text-xs text-muted-foreground",children:"Click table/column names to insert"})]})}function X5(i){const e=i+"CollectionProvider",[t,n]=Mu(e),[r,a]=t(e,{collectionRef:{current:null},itemMap:new Map}),o=k=>{const{scope:A,children:O}=k,D=Us.useRef(null),B=Us.useRef(new Map).current;return S.jsx(r,{scope:A,itemMap:B,collectionRef:D,children:O})};o.displayName=e;const c=i+"CollectionSlot",h=Nf(c),d=Us.forwardRef((k,A)=>{const{scope:O,children:D}=k,B=a(c,O),V=li(A,B.collectionRef);return S.jsx(h,{ref:V,children:D})});d.displayName=c;const p=i+"CollectionItemSlot",y="data-radix-collection-item",b=Nf(p),v=Us.forwardRef((k,A)=>{const{scope:O,children:D,...B}=k,V=Us.useRef(null),j=li(A,V),Q=a(p,O);return Us.useEffect(()=>(Q.itemMap.set(V,{ref:V,...B}),()=>void Q.itemMap.delete(V))),S.jsx(b,{[y]:"",ref:j,children:D})});v.displayName=p;function w(k){const A=a(i+"CollectionConsumer",k);return Us.useCallback(()=>{const D=A.collectionRef.current;if(!D)return[];const B=Array.from(D.querySelectorAll(`[${y}]`));return Array.from(A.itemMap.values()).sort((Q,I)=>B.indexOf(Q.ref.current)-B.indexOf(I.ref.current))},[A.collectionRef,A.itemMap])}return[{Provider:o,Slot:d,ItemSlot:v},w,n]}var Ap="rovingFocusGroup.onEntryFocus",W5={bubbles:!1,cancelable:!0},Eu="RovingFocusGroup",[Hg,iA,$5]=X5(Eu),[Z5,sA]=Mu(Eu,[$5]),[J5,ez]=Z5(Eu),rA=T.forwardRef((i,e)=>S.jsx(Hg.Provider,{scope:i.__scopeRovingFocusGroup,children:S.jsx(Hg.Slot,{scope:i.__scopeRovingFocusGroup,children:S.jsx(tz,{...i,ref:e})})}));rA.displayName=Eu;var tz=T.forwardRef((i,e)=>{const{__scopeRovingFocusGroup:t,orientation:n,loop:r=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:c,onCurrentTabStopIdChange:h,onEntryFocus:d,preventScrollOnEntryFocus:p=!1,...y}=i,b=T.useRef(null),v=li(e,b),w=B0(a),[k,A]=M0({prop:o,defaultProp:c??null,onChange:h,caller:Eu}),[O,D]=T.useState(!1),B=Qs(d),V=iA(t),j=T.useRef(!1),[Q,I]=T.useState(0);return T.useEffect(()=>{const q=b.current;if(q)return q.addEventListener(Ap,B),()=>q.removeEventListener(Ap,B)},[B]),S.jsx(J5,{scope:t,orientation:n,dir:w,loop:r,currentTabStopId:k,onItemFocus:T.useCallback(q=>A(q),[A]),onItemShiftTab:T.useCallback(()=>D(!0),[]),onFocusableItemAdd:T.useCallback(()=>I(q=>q+1),[]),onFocusableItemRemove:T.useCallback(()=>I(q=>q-1),[]),children:S.jsx(dn.div,{tabIndex:O||Q===0?-1:0,"data-orientation":n,...y,ref:v,style:{outline:"none",...i.style},onMouseDown:zt(i.onMouseDown,()=>{j.current=!0}),onFocus:zt(i.onFocus,q=>{const Y=!j.current;if(q.target===q.currentTarget&&Y&&!O){const te=new CustomEvent(Ap,W5);if(q.currentTarget.dispatchEvent(te),!te.defaultPrevented){const le=V().filter(H=>H.focusable),ne=le.find(H=>H.active),xe=le.find(H=>H.id===k),me=[ne,xe,...le].filter(Boolean).map(H=>H.ref.current);oA(me,p)}}j.current=!1}),onBlur:zt(i.onBlur,()=>D(!1))})})}),lA="RovingFocusGroupItem",aA=T.forwardRef((i,e)=>{const{__scopeRovingFocusGroup:t,focusable:n=!0,active:r=!1,tabStopId:a,children:o,...c}=i,h=E0(),d=a||h,p=ez(lA,t),y=p.currentTabStopId===d,b=iA(t),{onFocusableItemAdd:v,onFocusableItemRemove:w,currentTabStopId:k}=p;return T.useEffect(()=>{if(n)return v(),()=>w()},[n,v,w]),S.jsx(Hg.ItemSlot,{scope:t,id:d,focusable:n,active:r,children:S.jsx(dn.span,{tabIndex:y?0:-1,"data-orientation":p.orientation,...c,ref:e,onMouseDown:zt(i.onMouseDown,A=>{n?p.onItemFocus(d):A.preventDefault()}),onFocus:zt(i.onFocus,()=>p.onItemFocus(d)),onKeyDown:zt(i.onKeyDown,A=>{if(A.key==="Tab"&&A.shiftKey){p.onItemShiftTab();return}if(A.target!==A.currentTarget)return;const O=sz(A,p.orientation,p.dir);if(O!==void 0){if(A.metaKey||A.ctrlKey||A.altKey||A.shiftKey)return;A.preventDefault();let B=b().filter(V=>V.focusable).map(V=>V.ref.current);if(O==="last")B.reverse();else if(O==="prev"||O==="next"){O==="prev"&&B.reverse();const V=B.indexOf(A.currentTarget);B=p.loop?rz(B,V+1):B.slice(V+1)}setTimeout(()=>oA(B))}}),children:typeof o=="function"?o({isCurrentTabStop:y,hasTabStop:k!=null}):o})})});aA.displayName=lA;var nz={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iz(i,e){return e!=="rtl"?i:i==="ArrowLeft"?"ArrowRight":i==="ArrowRight"?"ArrowLeft":i}function sz(i,e,t){const n=iz(i.key,t);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(n))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(n)))return nz[n]}function oA(i,e=!1){const t=document.activeElement;for(const n of i)if(n===t||(n.focus({preventScroll:e}),document.activeElement!==t))return}function rz(i,e){return i.map((t,n)=>i[(e+n)%i.length])}var lz=rA,az=aA,Ah="Tabs",[oz,Qz]=Mu(Ah,[sA]),uA=sA(),[uz,_0]=oz(Ah),cA=T.forwardRef((i,e)=>{const{__scopeTabs:t,value:n,onValueChange:r,defaultValue:a,orientation:o="horizontal",dir:c,activationMode:h="automatic",...d}=i,p=B0(c),[y,b]=M0({prop:n,onChange:r,defaultProp:a??"",caller:Ah});return S.jsx(uz,{scope:t,baseId:E0(),value:y,onValueChange:b,orientation:o,dir:p,activationMode:h,children:S.jsx(dn.div,{dir:p,"data-orientation":o,...d,ref:e})})});cA.displayName=Ah;var fA="TabsList",hA=T.forwardRef((i,e)=>{const{__scopeTabs:t,loop:n=!0,...r}=i,a=_0(fA,t),o=uA(t);return S.jsx(lz,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:n,children:S.jsx(dn.div,{role:"tablist","aria-orientation":a.orientation,...r,ref:e})})});hA.displayName=fA;var dA="TabsTrigger",mA=T.forwardRef((i,e)=>{const{__scopeTabs:t,value:n,disabled:r=!1,...a}=i,o=_0(dA,t),c=uA(t),h=yA(o.baseId,n),d=bA(o.baseId,n),p=n===o.value;return S.jsx(az,{asChild:!0,...c,focusable:!r,active:p,children:S.jsx(dn.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":d,"data-state":p?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:h,...a,ref:e,onMouseDown:zt(i.onMouseDown,y=>{!r&&y.button===0&&y.ctrlKey===!1?o.onValueChange(n):y.preventDefault()}),onKeyDown:zt(i.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&o.onValueChange(n)}),onFocus:zt(i.onFocus,()=>{const y=o.activationMode!=="manual";!p&&!r&&y&&o.onValueChange(n)})})})});mA.displayName=dA;var pA="TabsContent",gA=T.forwardRef((i,e)=>{const{__scopeTabs:t,value:n,forceMount:r,children:a,...o}=i,c=_0(pA,t),h=yA(c.baseId,n),d=bA(c.baseId,n),p=n===c.value,y=T.useRef(p);return T.useEffect(()=>{const b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),S.jsx(tl,{present:r||p,children:({present:b})=>S.jsx(dn.div,{"data-state":p?"active":"inactive","data-orientation":c.orientation,role:"tabpanel","aria-labelledby":h,hidden:!b,id:d,tabIndex:0,...o,ref:e,style:{...i.style,animationDuration:y.current?"0s":void 0},children:b&&a})})});gA.displayName=pA;function yA(i,e){return`${i}-trigger-${e}`}function bA(i,e){return`${i}-content-${e}`}var cz=cA,fz=hA,hz=mA,dz=gA;function mz({className:i,...e}){return S.jsx(cz,{"data-slot":"tabs",className:tt("flex flex-col gap-2",i),...e})}function pz({className:i,...e}){return S.jsx(fz,{"data-slot":"tabs-list",className:tt("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-[3px]",i),...e})}function ZS({className:i,...e}){return S.jsx(hz,{"data-slot":"tabs-trigger",className:tt("cursor-pointer data-[state=active]:bg-background dark:data-[state=active]:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring dark:data-[state=active]:border-input dark:data-[state=active]:bg-input/30 text-foreground dark:text-muted-foreground inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-2 py-1 text-sm font-medium transition-[color,box-shadow] focus-visible:outline-1 focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",i),...e})}function JS({className:i,...e}){return S.jsx(dz,{"data-slot":"tabs-content",className:tt("flex-1 outline-none",i),...e})}function gz(i){return i===null?"NULL":i===void 0?"":typeof i=="object"?JSON.stringify(i):String(i)}function yz(){var ne,xe,ke,me,H;const{binding:i}=rh(),e=i||"",[t,n]=T.useState("query"),[r,a]=T.useState(""),[o,c]=T.useState(null),[h,d]=T.useState(null),[p,y]=T.useState(null),[b,v]=T.useState(0),w=50,k=T.useRef(null),O=((ne=Ei({queryKey:["schema",e],queryFn:()=>ok(e),staleTime:3e4,enabled:!!e}).data)==null?void 0:ne.tables)||[],D=T.useCallback(K=>{var W;(W=k.current)!=null&&W.insertText?k.current.insertText(K):a(ge=>ge+K)},[]),B=CM({mutationFn:K=>CD(e,K),onSuccess:K=>{c(K),d(null)},onError:K=>{d(K instanceof Error?K.message:"Failed to execute query"),c(null)}}),V=()=>{r.trim()&&B.mutate(r)},j=Ei({queryKey:["tables",e],queryFn:()=>AD(e),staleTime:0,gcTime:0,enabled:!!e}),Q=Ei({queryKey:["tableData",e,p,w,b],queryFn:()=>TD(e,p,w,b),staleTime:0,gcTime:0,enabled:!!e&&!!p}),I=((xe=j.data)==null?void 0:xe.tables)||[],q=((ke=Q.data)==null?void 0:ke.data)||[],Y=((me=Q.data)==null?void 0:me.columns)||[],te=((H=Q.data)==null?void 0:H.total)||0,le=K=>{y(K),v(0)};return S.jsx("div",{className:"flex flex-col",children:S.jsxs("div",{className:"flex-1 space-y-4 pt-6",children:[S.jsxs("h2",{className:"text-3xl font-bold tracking-tight",children:["Database: ",e]}),S.jsxs(mz,{value:t,onValueChange:n,children:[S.jsxs(pz,{children:[S.jsx(ZS,{value:"query",children:"SQL Editor"}),S.jsx(ZS,{value:"tables",children:"Tables"})]}),S.jsx(JS,{value:"query",className:"mt-4",children:S.jsxs("div",{className:"grid grid-cols-1 gap-0 lg:grid-cols-[1fr_280px]",children:[S.jsxs("div",{className:"space-y-4",children:[S.jsxs(Xt,{children:[S.jsxs(on,{children:[S.jsx(un,{children:"SQL Query"}),S.jsx(el,{children:"Execute SQL queries against your database"})]}),S.jsxs(Wt,{className:"space-y-4",children:[S.jsx("div",{ref:k,children:S.jsx(o5,{value:r,onChange:a,onExecute:V,schema:O,placeholder:"SELECT * FROM users LIMIT 10;"})}),S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsx("span",{className:"text-xs text-muted-foreground",children:"Press Cmd/Ctrl + Enter to execute"}),S.jsxs(Ji,{onClick:V,disabled:B.isPending||!r.trim(),children:[S.jsx(NR,{className:"mr-2 h-4 w-4"}),B.isPending?"Executing...":"Execute"]})]})]})]}),h&&S.jsx(Xt,{className:"border-destructive/50",children:S.jsx(Wt,{className:"pt-6",children:S.jsx("p",{className:"font-mono text-sm text-destructive",children:h})})}),o&&S.jsx(c5,{results:o.results,meta:o.meta,error:o.error})]}),S.jsx("div",{className:"hidden h-[500px] lg:block",children:S.jsx(K5,{bindingName:e,onInsertText:D})})]})}),S.jsx(JS,{value:"tables",className:"mt-4",children:S.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-4",children:[S.jsxs(Xt,{className:"md:col-span-1",children:[S.jsxs(on,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[S.jsx(un,{className:"text-base",children:"Tables"}),S.jsx(Ji,{variant:"ghost",size:"icon",onClick:()=>j.refetch(),className:"h-8 w-8",children:S.jsx(Iw,{className:"h-4 w-4"})})]}),S.jsx(Wt,{children:j.isLoading?S.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading..."}):I.length===0?S.jsx("p",{className:"text-sm text-muted-foreground",children:"No tables found"}):S.jsx("div",{className:"space-y-1",children:I.map(K=>S.jsxs("button",{onClick:()=>le(K.name),className:`flex w-full items-center gap-2 rounded-md px-3 py-2 text-left text-sm transition-colors hover:bg-muted ${p===K.name?"bg-muted font-medium":""}`,children:[S.jsx(Gw,{className:"h-4 w-4 shrink-0"}),S.jsx("span",{className:"truncate",children:K.name})]},K.name))})})]}),S.jsxs(Xt,{className:"md:col-span-3",children:[S.jsxs(on,{children:[S.jsx(un,{children:p||"Select a Table"}),p&&S.jsxs(el,{children:[te," total rows"]})]}),S.jsx(Wt,{children:p?Q.isLoading?S.jsx("div",{className:"flex items-center justify-center py-8",children:S.jsx(Vt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):q.length===0?S.jsx("p",{className:"py-8 text-center text-muted-foreground",children:"No data in this table"}):S.jsxs("div",{className:"space-y-4",children:[S.jsx("div",{className:"overflow-x-auto rounded-md border",children:S.jsxs(vh,{children:[S.jsx(xh,{children:S.jsx(cr,{children:Y.map(K=>S.jsx(Tn,{className:"font-mono",children:K},K))})}),S.jsx(Sh,{children:q.map((K,W)=>S.jsx(cr,{children:Y.map(ge=>S.jsx(On,{className:"font-mono text-sm",children:gz(K[ge])},ge))},W))})]})}),S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("span",{className:"text-sm text-muted-foreground",children:["Showing ",b+1," - ",Math.min(b+w,te)," of ",te]}),S.jsxs("div",{className:"flex gap-2",children:[S.jsxs(Ji,{variant:"outline",size:"sm",disabled:b===0,onClick:()=>v(Math.max(0,b-w)),children:[S.jsx(fR,{className:"mr-1 h-4 w-4"}),"Previous"]}),S.jsxs(Ji,{variant:"outline",size:"sm",disabled:b+w>=te,onClick:()=>v(b+w),children:["Next",S.jsx(Qw,{className:"ml-1 h-4 w-4"})]})]})]})]}):S.jsx("p",{className:"py-8 text-center text-muted-foreground",children:"Select a table from the list to view its data"})})]})]})})]})]})})}const bz=Xw("inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none transition-[color,box-shadow] overflow-hidden",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground [a&]:hover:bg-primary/90",secondary:"border-transparent bg-secondary text-secondary-foreground [a&]:hover:bg-secondary/90",destructive:"border-transparent bg-destructive text-white [a&]:hover:bg-destructive/90",outline:"text-foreground [a&]:hover:bg-accent [a&]:hover:text-accent-foreground"}},defaultVariants:{variant:"default"}});function Ot({className:i,variant:e,asChild:t=!1,...n}){const r=t?Yw:"span";return S.jsx(r,{"data-slot":"badge",className:tt(bz({variant:e}),i),...n})}function vz({status:i}){switch(i){case"PENDING":return S.jsxs(Ot,{variant:"outline",className:"gap-1",children:[S.jsx(wu,{className:"h-3 w-3"}),"Pending"]});case"PROCESSING":return S.jsxs(Ot,{variant:"outline",className:"gap-1 border-blue-500 text-blue-500",children:[S.jsx(Vt,{className:"h-3 w-3 animate-spin"}),"Processing"]});case"ACKNOWLEDGED":return S.jsxs(Ot,{variant:"outline",className:"gap-1 border-green-500 text-green-500",children:[S.jsx(xu,{className:"h-3 w-3"}),"Acknowledged"]});case"FAILED":return S.jsxs(Ot,{variant:"outline",className:"gap-1 border-red-500 text-red-500",children:[S.jsx(Su,{className:"h-3 w-3"}),"Failed"]});case"DEAD_LETTER":return S.jsxs(Ot,{variant:"outline",className:"gap-1 border-orange-500 text-orange-500",children:[S.jsx(mR,{className:"h-3 w-3"}),"Dead Letter"]});default:return S.jsx(Ot,{variant:"outline",children:i})}}function xz({metrics:i,isLoading:e}){return S.jsxs("div",{className:"grid gap-4 md:grid-cols-5",children:[S.jsxs(Xt,{children:[S.jsxs(on,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[S.jsx(un,{className:"text-sm font-medium",children:"Pending"}),S.jsx(wu,{className:"h-4 w-4 text-muted-foreground"})]}),S.jsx(Wt,{children:S.jsx("div",{className:"text-2xl font-bold",children:e?S.jsx(Vt,{className:"h-5 w-5 animate-spin"}):(i==null?void 0:i.pending)??0})})]}),S.jsxs(Xt,{children:[S.jsxs(on,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[S.jsx(un,{className:"text-sm font-medium",children:"Processing"}),S.jsx(Vt,{className:"h-4 w-4 text-muted-foreground"})]}),S.jsx(Wt,{children:S.jsx("div",{className:"text-2xl font-bold",children:e?S.jsx(Vt,{className:"h-5 w-5 animate-spin"}):(i==null?void 0:i.processing)??0})})]}),S.jsxs(Xt,{children:[S.jsxs(on,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[S.jsx(un,{className:"text-sm font-medium",children:"Acknowledged"}),S.jsx(xu,{className:"h-4 w-4 text-green-500"})]}),S.jsx(Wt,{children:S.jsx("div",{className:"text-2xl font-bold",children:e?S.jsx(Vt,{className:"h-5 w-5 animate-spin"}):(i==null?void 0:i.acknowledged)??0})})]}),S.jsxs(Xt,{children:[S.jsxs(on,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[S.jsx(un,{className:"text-sm font-medium",children:"Failed"}),S.jsx(Su,{className:"h-4 w-4 text-red-500"})]}),S.jsx(Wt,{children:S.jsx("div",{className:"text-2xl font-bold",children:e?S.jsx(Vt,{className:"h-5 w-5 animate-spin"}):(i==null?void 0:i.failed)??0})})]}),S.jsxs(Xt,{children:[S.jsxs(on,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[S.jsx(un,{className:"text-sm font-medium",children:"Dead Letter"}),S.jsx(RR,{className:"h-4 w-4 text-orange-500"})]}),S.jsx(Wt,{children:S.jsx("div",{className:"text-2xl font-bold",children:e?S.jsx(Vt,{className:"h-5 w-5 animate-spin"}):(i==null?void 0:i.deadLetter)??0})})]})]})}function Sz({messages:i,isLoading:e}){return S.jsxs(Xt,{children:[S.jsxs(on,{children:[S.jsx(un,{children:"Recent Messages"}),S.jsx(el,{children:"Latest messages in this queue (auto-refreshes every 5 seconds)"})]}),S.jsx(Wt,{children:e?S.jsx("div",{className:"flex items-center justify-center py-8",children:S.jsx(Vt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):i!=null&&i.length?S.jsxs(vh,{children:[S.jsx(xh,{children:S.jsxs(cr,{children:[S.jsx(Tn,{children:"ID"}),S.jsx(Tn,{children:"Status"}),S.jsx(Tn,{children:"Payload"}),S.jsx(Tn,{children:"Attempt"}),S.jsx(Tn,{children:"Created"})]})}),S.jsx(Sh,{children:i.map(t=>S.jsxs(cr,{children:[S.jsxs(On,{className:"font-mono text-xs",children:[t.id.slice(0,8),"..."]}),S.jsx(On,{children:S.jsx(vz,{status:t.status})}),S.jsx(On,{className:"max-w-[200px] truncate font-mono text-xs",children:JSON.stringify(t.payload)}),S.jsx(On,{children:t.attempt}),S.jsx(On,{className:"text-xs text-muted-foreground",children:new Date(t.createdAt).toLocaleString()})]},t.id))})]}):S.jsx("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:"No messages in this queue"})})]})}function wz(){const{binding:i}=rh(),e=i||"",{data:t,isLoading:n}=Ei({queryKey:["queueMetrics",e],queryFn:()=>OD(e),enabled:!!e,refetchInterval:5e3}),{data:r,isLoading:a}=Ei({queryKey:["queueMessages",e],queryFn:()=>MD(e,10),enabled:!!e,refetchInterval:5e3});return S.jsx("div",{className:"flex flex-col",children:S.jsxs("div",{className:"flex-1 space-y-4 pt-6",children:[S.jsxs("h2",{className:"text-3xl font-bold tracking-tight",children:["Queue: ",e]}),S.jsx(xz,{metrics:t==null?void 0:t.metrics,isLoading:n}),S.jsx(Sz,{messages:r==null?void 0:r.messages,isLoading:a})]})})}function kz({status:i}){switch(i){case"PENDING":return S.jsxs(Ot,{variant:"outline",className:"gap-1",children:[S.jsx(wu,{className:"h-3 w-3"}),"Pending"]});case"RUNNING":return S.jsxs(Ot,{variant:"outline",className:"gap-1 border-blue-500 text-blue-500",children:[S.jsx(Vt,{className:"h-3 w-3 animate-spin"}),"Running"]});case"COMPLETED":return S.jsxs(Ot,{variant:"outline",className:"gap-1 border-green-500 text-green-500",children:[S.jsx(xu,{className:"h-3 w-3"}),"Completed"]});case"FAILED":return S.jsxs(Ot,{variant:"outline",className:"gap-1 border-red-500 text-red-500",children:[S.jsx(Su,{className:"h-3 w-3"}),"Failed"]});case"CANCELLED":return S.jsxs(Ot,{variant:"outline",className:"gap-1 border-gray-500 text-gray-500",children:[S.jsx(Vw,{className:"h-3 w-3"}),"Cancelled"]});default:return S.jsx(Ot,{variant:"outline",children:i})}}function Mf(i){return i===null?"-":i<1e3?`${i}ms`:i<6e4?`${(i/1e3).toFixed(1)}s`:`${(i/6e4).toFixed(1)}m`}function Cz({status:i}){switch(i){case"COMPLETED":return S.jsx(xu,{className:"h-5 w-5 text-green-500"});case"RUNNING":return S.jsx(Vt,{className:"h-5 w-5 text-blue-500 animate-spin"});case"FAILED":return S.jsx(Su,{className:"h-5 w-5 text-red-500"});case"PENDING":default:return S.jsx(wu,{className:"h-5 w-5 text-gray-400"})}}function Az(i){switch(i){case"COMPLETED":return"bg-green-500";case"RUNNING":return"bg-blue-500";case"FAILED":return"bg-red-500";case"PENDING":default:return"bg-gray-300 dark:bg-gray-600"}}function Tz({steps:i}){if(i.length===0)return S.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No steps recorded for this execution"});const e=i.reduce((t,n)=>t+(n.durationMs||0),0);return S.jsxs("div",{className:"space-y-4",children:[e>0&&S.jsxs("div",{className:"mb-6",children:[S.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground mb-2",children:[S.jsx("span",{children:"Total Duration"}),S.jsx("span",{children:Mf(e)})]}),S.jsx("div",{className:"h-3 bg-muted rounded-full overflow-hidden flex",children:i.map((t,n)=>{const r=t.durationMs?t.durationMs/e*100:0;return S.jsx("div",{className:tt(Az(t.status),"h-full transition-all",n>0&&"border-l border-background"),style:{width:`${r}%`},title:`${t.stepName}: ${Mf(t.durationMs)}`},t.id)})})]}),S.jsx("div",{className:"relative",children:i.map((t,n)=>S.jsxs("div",{className:"relative pb-6 last:pb-0",children:[n<i.length-1&&S.jsx("div",{className:tt("absolute left-[9px] top-6 w-0.5 h-full -ml-px",t.status==="COMPLETED"?"bg-green-200 dark:bg-green-900":"bg-muted")}),S.jsxs("div",{className:"flex gap-4",children:[S.jsx("div",{className:"flex-shrink-0 relative z-10 bg-background",children:S.jsx(Cz,{status:t.status})}),S.jsxs("div",{className:"flex-1 min-w-0",children:[S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{className:"flex items-center gap-2",children:[S.jsx("span",{className:"font-medium",children:t.stepName}),S.jsxs("span",{className:"text-xs text-muted-foreground",children:["(Step ",t.stepIndex+1,")"]})]}),S.jsx("span",{className:"text-sm font-mono text-muted-foreground",children:Mf(t.durationMs)})]}),t.errorMessage&&S.jsx("div",{className:"mt-2 p-2 rounded bg-red-50 dark:bg-red-950 text-red-700 dark:text-red-300 text-sm font-mono",children:t.errorMessage}),t.output&&t.status==="COMPLETED"&&S.jsxs("details",{className:"mt-2",children:[S.jsx("summary",{className:"text-xs text-muted-foreground cursor-pointer hover:text-foreground",children:"View output"}),S.jsx("pre",{className:"mt-1 p-2 rounded bg-muted text-xs font-mono overflow-x-auto",children:JSON.stringify(t.output,null,2)})]}),S.jsx("div",{className:"mt-1 text-xs text-muted-foreground",children:new Date(t.createdAt).toLocaleString()})]})]})]},t.id))})]})}function Oz(){const{binding:i,executionId:e}=rh(),t=i||"",n=e||"",{data:r,isLoading:a}=Ei({queryKey:["workflowExecution",t,n],queryFn:()=>RD(t,n),enabled:!!t&&!!n,refetchInterval:5e3}),o=r==null?void 0:r.execution,c=(r==null?void 0:r.steps)||[];return S.jsx("div",{className:"flex flex-col",children:S.jsxs("div",{className:"flex-1 space-y-4 pt-6",children:[S.jsxs("div",{className:"flex items-center gap-4",children:[S.jsx(er,{to:`/workflows/${t}`,children:S.jsxs(Ji,{variant:"ghost",size:"sm",children:[S.jsx(lR,{className:"mr-2 h-4 w-4"}),"Back"]})}),S.jsxs("h2",{className:"text-3xl font-bold tracking-tight",children:["Execution: ",n.slice(0,8),"..."]})]}),a?S.jsx("div",{className:"flex items-center justify-center py-8",children:S.jsx(Vt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):o?S.jsxs(S.Fragment,{children:[S.jsxs(Xt,{children:[S.jsx(on,{children:S.jsxs("div",{className:"flex items-center justify-between",children:[S.jsxs("div",{children:[S.jsx(un,{children:"Execution Details"}),S.jsx(el,{children:o.startedAt?`Started ${new Date(o.startedAt).toLocaleString()}`:"Not started yet"})]}),S.jsx(kz,{status:o.status})]})}),S.jsxs(Wt,{children:[S.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[S.jsxs("div",{children:[S.jsx("p",{className:"text-sm text-muted-foreground",children:"Duration"}),S.jsx("p",{className:"font-mono",children:Mf(o.durationMs)})]}),S.jsxs("div",{children:[S.jsx("p",{className:"text-sm text-muted-foreground",children:"Steps Completed"}),S.jsxs("p",{className:"font-mono",children:[o.stepsCompleted," / ",o.stepsCount]})]}),S.jsxs("div",{children:[S.jsx("p",{className:"text-sm text-muted-foreground",children:"Created"}),S.jsx("p",{className:"font-mono text-sm",children:new Date(o.createdAt).toLocaleString()})]}),o.completedAt&&S.jsxs("div",{children:[S.jsx("p",{className:"text-sm text-muted-foreground",children:"Completed"}),S.jsx("p",{className:"font-mono text-sm",children:new Date(o.completedAt).toLocaleString()})]})]}),o.errorMessage&&S.jsx("div",{className:"mt-4 p-3 rounded bg-red-50 dark:bg-red-950 text-red-700 dark:text-red-300 text-sm font-mono",children:o.errorMessage})]})]}),S.jsxs(Xt,{children:[S.jsxs(on,{children:[S.jsx(un,{children:"Steps"}),S.jsx(el,{children:"Workflow step execution timeline"})]}),S.jsx(Wt,{children:S.jsx(Tz,{steps:c})})]})]}):S.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Execution not found"})]})})}function Mz({status:i}){switch(i){case"PENDING":return S.jsxs(Ot,{variant:"outline",className:"gap-1",children:[S.jsx(wu,{className:"h-3 w-3"}),"Pending"]});case"RUNNING":return S.jsxs(Ot,{variant:"outline",className:"gap-1 border-blue-500 text-blue-500",children:[S.jsx(Vt,{className:"h-3 w-3 animate-spin"}),"Running"]});case"COMPLETED":return S.jsxs(Ot,{variant:"outline",className:"gap-1 border-green-500 text-green-500",children:[S.jsx(xu,{className:"h-3 w-3"}),"Completed"]});case"FAILED":return S.jsxs(Ot,{variant:"outline",className:"gap-1 border-red-500 text-red-500",children:[S.jsx(Su,{className:"h-3 w-3"}),"Failed"]});case"CANCELLED":return S.jsxs(Ot,{variant:"outline",className:"gap-1 border-gray-500 text-gray-500",children:[S.jsx(Vw,{className:"h-3 w-3"}),"Cancelled"]});default:return S.jsx(Ot,{variant:"outline",children:i})}}function Ez(i){return i===null?"-":i<1e3?`${i}ms`:i<6e4?`${(i/1e3).toFixed(1)}s`:`${(i/6e4).toFixed(1)}m`}function Rz({executions:i,isLoading:e,bindingName:t}){return S.jsxs(Xt,{children:[S.jsxs(on,{children:[S.jsx(un,{children:"Recent Executions"}),S.jsx(el,{children:"Workflow executions (auto-refreshes every 5 seconds)"})]}),S.jsx(Wt,{children:e?S.jsx("div",{className:"flex items-center justify-center py-8",children:S.jsx(Vt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):i!=null&&i.length?S.jsxs(vh,{children:[S.jsx(xh,{children:S.jsxs(cr,{children:[S.jsx(Tn,{children:"ID"}),S.jsx(Tn,{children:"Status"}),S.jsx(Tn,{children:"Steps"}),S.jsx(Tn,{children:"Duration"}),S.jsx(Tn,{children:"Started"}),S.jsx(Tn,{})]})}),S.jsx(Sh,{children:i.map(n=>S.jsxs(cr,{children:[S.jsxs(On,{className:"font-mono text-xs",children:[n.id.slice(0,8),"..."]}),S.jsx(On,{children:S.jsx(Mz,{status:n.status})}),S.jsx(On,{children:S.jsxs("span",{className:"text-sm",children:[n.stepsCompleted,"/",n.stepsCount]})}),S.jsx(On,{className:"text-sm",children:Ez(n.durationMs)}),S.jsx(On,{className:"text-xs text-muted-foreground",children:n.startedAt?new Date(n.startedAt).toLocaleString():"-"}),S.jsx(On,{children:S.jsx(er,{to:`/workflows/${t}/${n.id}`,className:"flex items-center text-sm text-primary hover:underline",children:"View"})})]},n.id))})]}):S.jsx("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:"No executions for this workflow"})})]})}function Dz(){const{binding:i}=rh(),e=i||"",{data:t,isLoading:n}=Ei({queryKey:["workflowExecutions",e],queryFn:()=>ED(e,20),enabled:!!e,refetchInterval:5e3});return S.jsx("div",{className:"flex flex-col",children:S.jsxs("div",{className:"flex-1 space-y-4 pt-6",children:[S.jsxs("h2",{className:"text-3xl font-bold tracking-tight",children:["Workflow: ",e]}),S.jsx(Rz,{executions:t==null?void 0:t.executions,isLoading:n,bindingName:e})]})})}function Nz(){const i=as(),{data:e,isLoading:t}=Ei({queryKey:["config"],queryFn:ak,staleTime:6e4}),n=e!=null&&e.db?Object.keys(e.db):[],r=e!=null&&e.queue?Object.keys(e.queue):[],a=e!=null&&e.workflow?Object.keys(e.workflow):[];return S.jsxs("aside",{className:"fixed inset-y-0 left-0 z-10 w-64 flex-col border-r bg-background",children:[S.jsx("div",{className:"flex h-14 items-center border-b px-4",children:S.jsxs(er,{to:"/",className:"flex items-center gap-2 font-semibold",children:[S.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground",children:"P"}),S.jsx("span",{children:"Ploy Dev"})]})}),S.jsx("nav",{className:"flex-1 overflow-auto p-4",children:t?S.jsx("div",{className:"flex items-center justify-center py-8",children:S.jsx(Vt,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):S.jsxs("div",{className:"space-y-6",children:[n.length>0&&S.jsxs("div",{children:[S.jsx("h3",{className:"mb-2 px-2 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Database"}),S.jsx("div",{className:"space-y-1",children:n.map(o=>{const c=i.pathname===`/db/${o}`;return S.jsx(er,{to:`/db/${o}`,children:S.jsxs(Ji,{variant:c?"secondary":"ghost",className:tt("w-full justify-start",c&&"bg-muted"),children:[S.jsx(SR,{className:"mr-2 h-4 w-4"}),o]})},o)})})]}),r.length>0&&S.jsxs("div",{children:[S.jsx("h3",{className:"mb-2 px-2 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Queues"}),S.jsx("div",{className:"space-y-1",children:r.map(o=>{const c=i.pathname===`/queues/${o}`;return S.jsx(er,{to:`/queues/${o}`,children:S.jsxs(Ji,{variant:c?"secondary":"ghost",className:tt("w-full justify-start",c&&"bg-muted"),children:[S.jsx(AR,{className:"mr-2 h-4 w-4"}),o]})},o)})})]}),a.length>0&&S.jsxs("div",{children:[S.jsx("h3",{className:"mb-2 px-2 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Workflows"}),S.jsx("div",{className:"space-y-1",children:a.map(o=>{const c=i.pathname.startsWith(`/workflows/${o}`);return S.jsx(er,{to:`/workflows/${o}`,children:S.jsxs(Ji,{variant:c?"secondary":"ghost",className:tt("w-full justify-start",c&&"bg-muted"),children:[S.jsx(kR,{className:"mr-2 h-4 w-4"}),o]})},o)})})]}),n.length===0&&r.length===0&&a.length===0&&S.jsx("div",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:"No bindings configured in ploy.yaml"})]})})]})}function Bz(){const{data:i,isLoading:e}=Ei({queryKey:["config"],queryFn:ak,staleTime:6e4});if(!e&&i){const t=i.db?Object.keys(i.db):[],n=i.queue?Object.keys(i.queue):[],r=i.workflow?Object.keys(i.workflow):[];if(t.length>0)return S.jsx(Km,{to:`/db/${t[0]}`,replace:!0});if(n.length>0)return S.jsx(Km,{to:`/queues/${n[0]}`,replace:!0});if(r.length>0)return S.jsx(Km,{to:`/workflows/${r[0]}`,replace:!0})}return S.jsxs("div",{className:"flex flex-col items-center justify-center h-full",children:[S.jsx("h1",{className:"text-2xl font-bold mb-4",children:"Ploy Dev Dashboard"}),e?S.jsx(Vt,{className:"h-6 w-6 animate-spin text-muted-foreground"}):S.jsx("p",{className:"text-muted-foreground",children:"Configure database, queue, or workflow bindings in ploy.yaml to get started."})]})}function Lz(){return S.jsxs("div",{className:"min-h-screen bg-background",children:[S.jsx(Nz,{}),S.jsx("main",{className:"pl-64",children:S.jsx("div",{className:"container mx-auto px-6 py-4",children:S.jsxs(SE,{children:[S.jsx(Ql,{path:"/",element:S.jsx(Bz,{})}),S.jsx(Ql,{path:"/db/:binding",element:S.jsx(yz,{})}),S.jsx(Ql,{path:"/queues/:binding",element:S.jsx(wz,{})}),S.jsx(Ql,{path:"/workflows/:binding",element:S.jsx(Dz,{})}),S.jsx(Ql,{path:"/workflows/:binding/:executionId",element:S.jsx(Oz,{})})]})})})]})}const jz=new lM({defaultOptions:{queries:{refetchOnWindowFocus:!1,retry:1}}});RM.createRoot(document.getElementById("root")).render(S.jsx(T.StrictMode,{children:S.jsx(hM,{client:jz,children:S.jsx(GE,{children:S.jsx(Lz,{})})})}));