@sudocode-ai/local-server 0.1.4 → 0.1.6

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,568 +0,0 @@
1
- import{j as h,P as gn,c as Gp,a as xw,b as vw,d as Bu,D as ww,C as kw,e as Sw,u as Ln,f as $u,g as wh,R as Ew,A as Cw,h as Nt,i as Nw,O as Jp,k as _w,l as Zp,T as Yp,m as Xp,n as Tw,o as Aw,S as G_,p as J_,q as Bs,r as Z_,s as Y_,t as X_,v as Q_,w as eT,F as tT,x as nT,y as Mw,W as rT,z as Rw}from"./ui-vendor-_cxVHaqZ.js";import{e as sT,g as tl,a as x,u as iT,L as Qp,O as oT,d as at,b as Ts,f as cr,r as Ow,c as aT,R as lT,h as em,B as cT,i as uT,j as Br,N as dT}from"./react-vendor-LX0UoTxg.js";(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var Al={},nb;function fT(){if(nb)return Al;nb=1;var e=sT();return Al.createRoot=e.createRoot,Al.hydrateRoot=e.hydrateRoot,Al}var hT=fT();const pT=tl(hT);var Ro=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},mT={setTimeout:(e,t)=>setTimeout(e,t),clearTimeout:e=>clearTimeout(e),setInterval:(e,t)=>setInterval(e,t),clearInterval:e=>clearInterval(e)},gT=class{#e=mT;#t=!1;setTimeoutProvider(e){this.#e=e}setTimeout(e,t){return this.#e.setTimeout(e,t)}clearTimeout(e){this.#e.clearTimeout(e)}setInterval(e,t){return this.#e.setInterval(e,t)}clearInterval(e){this.#e.clearInterval(e)}},oi=new gT;function bT(e){setTimeout(e,0)}var vi=typeof window>"u"||"Deno"in globalThis;function wn(){}function yT(e,t){return typeof e=="function"?e(t):e}function kh(e){return typeof e=="number"&&e>=0&&e!==1/0}function Iw(e,t){return Math.max(e+(t||0)-Date.now(),0)}function Is(e,t){return typeof e=="function"?e(t):e}function Qn(e,t){return typeof e=="function"?e(t):e}function rb(e,t){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:a}=e;if(o){if(r){if(t.queryHash!==tm(o,t.options))return!1}else if(!Ta(t.queryKey,o))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof a=="boolean"&&t.isStale()!==a||s&&s!==t.state.fetchStatus||i&&!i(t))}function sb(e,t){const{exact:n,status:r,predicate:s,mutationKey:i}=e;if(i){if(!t.options.mutationKey)return!1;if(n){if(wi(t.options.mutationKey)!==wi(i))return!1}else if(!Ta(t.options.mutationKey,i))return!1}return!(r&&t.state.status!==r||s&&!s(t))}function tm(e,t){return(t?.queryKeyHashFn||wi)(e)}function wi(e){return JSON.stringify(e,(t,n)=>Sh(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function Ta(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ta(e[n],t[n])):!1}var xT=Object.prototype.hasOwnProperty;function Dw(e,t){if(e===t)return e;const n=ib(e)&&ib(t);if(!n&&!(Sh(e)&&Sh(t)))return t;const s=(n?e:Object.keys(e)).length,i=n?t:Object.keys(t),o=i.length,a=n?new Array(o):{};let l=0;for(let c=0;c<o;c++){const u=n?c:i[c],d=e[u],f=t[u];if(d===f){a[u]=d,(n?c<s:xT.call(e,u))&&l++;continue}if(d===null||f===null||typeof d!="object"||typeof f!="object"){a[u]=f;continue}const p=Dw(d,f);a[u]=p,p===d&&l++}return s===o&&l===s?e:a}function vc(e,t){if(!t||Object.keys(e).length!==Object.keys(t).length)return!1;for(const n in e)if(e[n]!==t[n])return!1;return!0}function ib(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function Sh(e){if(!ob(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!ob(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function ob(e){return Object.prototype.toString.call(e)==="[object Object]"}function vT(e){return new Promise(t=>{oi.setTimeout(t,e)})}function Eh(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Dw(e,t):t}function wT(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function kT(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var nm=Symbol();function Lw(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===nm?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function Pw(e,t){return typeof e=="function"?e(...t):!!e}var ST=class extends Ro{#e;#t;#n;constructor(){super(),this.#n=e=>{if(!vi&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#e!==e&&(this.#e=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#e=="boolean"?this.#e:globalThis.document?.visibilityState!=="hidden"}},rm=new ST;function Ch(){let e,t;const n=new Promise((s,i)=>{e=s,t=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),e(s)},n.reject=s=>{r({status:"rejected",reason:s}),t(s)},n}var ET=bT;function CT(){let e=[],t=0,n=a=>{a()},r=a=>{a()},s=ET;const i=a=>{t?e.push(a):s(()=>{n(a)})},o=()=>{const a=e;e=[],a.length&&s(()=>{r(()=>{a.forEach(l=>{n(l)})})})};return{batch:a=>{let l;t++;try{l=a()}finally{t--,t||o()}return l},batchCalls:a=>(...l)=>{i(()=>{a(...l)})},schedule:i,setNotifyFunction:a=>{n=a},setBatchNotifyFunction:a=>{r=a},setScheduler:a=>{s=a}}}var qt=CT(),NT=class extends Ro{#e=!0;#t;#n;constructor(){super(),this.#n=e=>{if(!vi&&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(){this.#t||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#t?.(),this.#t=void 0)}setEventListener(e){this.#n=e,this.#t?.(),this.#t=e(this.setOnline.bind(this))}setOnline(e){this.#e!==e&&(this.#e=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#e}},wc=new NT;function _T(e){return Math.min(1e3*2**e,3e4)}function jw(e){return(e??"online")==="online"?wc.isOnline():!0}var Nh=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function zw(e){let t=!1,n=0,r;const s=Ch(),i=()=>s.status!=="pending",o=g=>{if(!i()){const b=new Nh(g);f(b),e.onCancel?.(b)}},a=()=>{t=!0},l=()=>{t=!1},c=()=>rm.isFocused()&&(e.networkMode==="always"||wc.isOnline())&&e.canRun(),u=()=>jw(e.networkMode)&&e.canRun(),d=g=>{i()||(r?.(),s.resolve(g))},f=g=>{i()||(r?.(),s.reject(g))},p=()=>new Promise(g=>{r=b=>{(i()||c())&&g(b)},e.onPause?.()}).then(()=>{r=void 0,i()||e.onContinue?.()}),m=()=>{if(i())return;let g;const b=n===0?e.initialPromise:void 0;try{g=b??e.fn()}catch(y){g=Promise.reject(y)}Promise.resolve(g).then(d).catch(y=>{if(i())return;const w=e.retry??(vi?0:3),v=e.retryDelay??_T,E=typeof v=="function"?v(n,y):v,N=w===!0||typeof w=="number"&&n<w||typeof w=="function"&&w(n,y);if(t||!N){f(y);return}n++,e.onFail?.(n,y),vT(E).then(()=>c()?void 0:p()).then(()=>{t?f(y):m()})})};return{promise:s,status:()=>s.status,cancel:o,continue:()=>(r?.(),s),cancelRetry:a,continueRetry:l,canStart:u,start:()=>(u()?m():p().then(m),s)}}var Fw=class{#e;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),kh(this.gcTime)&&(this.#e=oi.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(vi?1/0:300*1e3))}clearGcTimeout(){this.#e&&(oi.clearTimeout(this.#e),this.#e=void 0)}},TT=class extends Fw{#e;#t;#n;#s;#r;#o;#a;constructor(e){super(),this.#a=!1,this.#o=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#s=e.client,this.#n=this.#s.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#e=ab(this.options),this.state=e.state??this.#e,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#r?.promise}setOptions(e){if(this.options={...this.#o,...e},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const t=ab(this.options);t.data!==void 0&&(this.setData(t.data,{updatedAt:t.dataUpdatedAt,manual:!0}),this.#e=t)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=Eh(this.state.data,e,this.options);return this.#i({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#i({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#r?.promise;return this.#r?.cancel(e),t?t.then(wn).catch(wn):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#e)}isActive(){return this.observers.some(e=>Qn(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===nm||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Is(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!Iw(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#r?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#r?.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(t=>t!==e),this.observers.length||(this.#r&&(this.#a?this.#r.cancel({revert:!0}):this.#r.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#i({type:"invalidate"})}async fetch(e,t){if(this.state.fetchStatus!=="idle"&&this.#r?.status()!=="rejected"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#r)return this.#r.continueRetry(),this.#r.promise}if(e&&this.setOptions(e),!this.options.queryFn){const a=this.observers.find(l=>l.options.queryFn);a&&this.setOptions(a.options)}const n=new AbortController,r=a=>{Object.defineProperty(a,"signal",{enumerable:!0,get:()=>(this.#a=!0,n.signal)})},s=()=>{const a=Lw(this.options,t),c=(()=>{const u={client:this.#s,queryKey:this.queryKey,meta:this.meta};return r(u),u})();return this.#a=!1,this.options.persister?this.options.persister(a,c,this):a(c)},o=(()=>{const a={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#s,state:this.state,fetchFn:s};return r(a),a})();this.options.behavior?.onFetch(o,this),this.#t=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==o.fetchOptions?.meta)&&this.#i({type:"fetch",meta:o.fetchOptions?.meta}),this.#r=zw({initialPromise:t?.initialPromise,fn:o.fetchFn,onCancel:a=>{a instanceof Nh&&a.revert&&this.setState({...this.#t,fetchStatus:"idle"}),n.abort()},onFail:(a,l)=>{this.#i({type:"failed",failureCount:a,error:l})},onPause:()=>{this.#i({type:"pause"})},onContinue:()=>{this.#i({type:"continue"})},retry:o.options.retry,retryDelay:o.options.retryDelay,networkMode:o.options.networkMode,canRun:()=>!0});try{const a=await this.#r.start();if(a===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(a),this.#n.config.onSuccess?.(a,this),this.#n.config.onSettled?.(a,this.state.error,this),a}catch(a){if(a instanceof Nh){if(a.silent)return this.#r.promise;if(a.revert){if(this.state.data===void 0)throw a;return this.state.data}}throw this.#i({type:"error",error:a}),this.#n.config.onError?.(a,this),this.#n.config.onSettled?.(this.state.data,a,this),a}finally{this.scheduleGc()}}#i(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,...Bw(n.data,this.options),fetchMeta:e.meta??null};case"success":const r={...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}};return this.#t=e.manual?r:void 0,r;case"error":const s=e.error;return{...n,error:s,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),qt.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function Bw(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:jw(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ab(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,r=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var AT=class extends Ro{constructor(e,t){super(),this.options=t,this.#e=e,this.#i=null,this.#a=Ch(),this.bindMethods(),this.setOptions(t)}#e;#t=void 0;#n=void 0;#s=void 0;#r;#o;#a;#i;#m;#f;#h;#c;#u;#l;#p=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),lb(this.#t,this.options)?this.#d():this.updateResult(),this.#x())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return _h(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return _h(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#w(),this.#t.removeObserver(this)}setOptions(e){const t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Qn(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#k(),this.#t.setOptions(this.options),t._defaulted&&!vc(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&cb(this.#t,n,this.options,t)&&this.#d(),this.updateResult(),r&&(this.#t!==n||Qn(this.options.enabled,this.#t)!==Qn(t.enabled,this.#t)||Is(this.options.staleTime,this.#t)!==Is(t.staleTime,this.#t))&&this.#g();const s=this.#b();r&&(this.#t!==n||Qn(this.options.enabled,this.#t)!==Qn(t.enabled,this.#t)||s!==this.#l)&&this.#y(s)}getOptimisticResult(e){const t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return RT(this,n)&&(this.#s=n,this.#o=this.options,this.#r=this.#t.state),n}getCurrentResult(){return this.#s}trackResult(e,t){return new Proxy(e,{get:(n,r)=>(this.trackProp(r),t?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#a.status==="pending"&&this.#a.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(n,r))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#s))}#d(e){this.#k();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(wn)),t}#g(){this.#v();const e=Is(this.options.staleTime,this.#t);if(vi||this.#s.isStale||!kh(e))return;const n=Iw(this.#s.dataUpdatedAt,e)+1;this.#c=oi.setTimeout(()=>{this.#s.isStale||this.updateResult()},n)}#b(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#y(e){this.#w(),this.#l=e,!(vi||Qn(this.options.enabled,this.#t)===!1||!kh(this.#l)||this.#l===0)&&(this.#u=oi.setInterval(()=>{(this.options.refetchIntervalInBackground||rm.isFocused())&&this.#d()},this.#l))}#x(){this.#g(),this.#y(this.#b())}#v(){this.#c&&(oi.clearTimeout(this.#c),this.#c=void 0)}#w(){this.#u&&(oi.clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#t,r=this.options,s=this.#s,i=this.#r,o=this.#o,l=e!==n?e.state:this.#n,{state:c}=e;let u={...c},d=!1,f;if(t._optimisticResults){const A=this.hasListeners(),R=!A&&lb(e,t),T=A&&cb(e,n,t,r);(R||T)&&(u={...u,...Bw(c.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:p,errorUpdatedAt:m,status:g}=u;f=u.data;let b=!1;if(t.placeholderData!==void 0&&f===void 0&&g==="pending"){let A;s?.isPlaceholderData&&t.placeholderData===o?.placeholderData?(A=s.data,b=!0):A=typeof t.placeholderData=="function"?t.placeholderData(this.#h?.state.data,this.#h):t.placeholderData,A!==void 0&&(g="success",f=Eh(s?.data,A,t),d=!0)}if(t.select&&f!==void 0&&!b)if(s&&f===i?.data&&t.select===this.#m)f=this.#f;else try{this.#m=t.select,f=t.select(f),f=Eh(s?.data,f,t),this.#f=f,this.#i=null}catch(A){this.#i=A}this.#i&&(p=this.#i,f=this.#f,m=Date.now(),g="error");const y=u.fetchStatus==="fetching",w=g==="pending",v=g==="error",E=w&&y,N=f!==void 0,C={status:g,fetchStatus:u.fetchStatus,isPending:w,isSuccess:g==="success",isError:v,isInitialLoading:E,isLoading:E,data:f,dataUpdatedAt:u.dataUpdatedAt,error:p,errorUpdatedAt:m,failureCount:u.fetchFailureCount,failureReason:u.fetchFailureReason,errorUpdateCount:u.errorUpdateCount,isFetched:u.dataUpdateCount>0||u.errorUpdateCount>0,isFetchedAfterMount:u.dataUpdateCount>l.dataUpdateCount||u.errorUpdateCount>l.errorUpdateCount,isFetching:y,isRefetching:y&&!w,isLoadingError:v&&!N,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:v&&N,isStale:sm(e,t),refetch:this.refetch,promise:this.#a,isEnabled:Qn(t.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const A=I=>{C.status==="error"?I.reject(C.error):C.data!==void 0&&I.resolve(C.data)},R=()=>{const I=this.#a=C.promise=Ch();A(I)},T=this.#a;switch(T.status){case"pending":e.queryHash===n.queryHash&&A(T);break;case"fulfilled":(C.status==="error"||C.data!==T.value)&&R();break;case"rejected":(C.status!=="error"||C.error!==T.reason)&&R();break}}return C}updateResult(){const e=this.#s,t=this.createResult(this.#t,this.options);if(this.#r=this.#t.state,this.#o=this.options,this.#r.data!==void 0&&(this.#h=this.#t),vc(t,e))return;this.#s=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,s=typeof r=="function"?r():r;if(s==="all"||!s&&!this.#p.size)return!0;const i=new Set(s??this.#p);return this.options.throwOnError&&i.add("error"),Object.keys(this.#s).some(o=>{const a=o;return this.#s[a]!==e[a]&&i.has(a)})};this.#S({listeners:n()})}#k(){const e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;const t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#x()}#S(e){qt.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#s)}),this.#e.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function MT(e,t){return Qn(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function lb(e,t){return MT(e,t)||e.state.data!==void 0&&_h(e,t,t.refetchOnMount)}function _h(e,t,n){if(Qn(t.enabled,e)!==!1&&Is(t.staleTime,e)!=="static"){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&sm(e,t)}return!1}function cb(e,t,n,r){return(e!==t||Qn(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&sm(e,n)}function sm(e,t){return Qn(t.enabled,e)!==!1&&e.isStaleByTime(Is(t.staleTime,e))}function RT(e,t){return!vc(e.getCurrentResult(),t)}function ub(e){return{onFetch:(t,n)=>{const r=t.options,s=t.fetchOptions?.meta?.fetchMore?.direction,i=t.state.data?.pages||[],o=t.state.data?.pageParams||[];let a={pages:[],pageParams:[]},l=0;const c=async()=>{let u=!1;const d=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},f=Lw(t.options,t.fetchOptions),p=async(m,g,b)=>{if(u)return Promise.reject();if(g==null&&m.pages.length)return Promise.resolve(m);const w=(()=>{const k={client:t.client,queryKey:t.queryKey,pageParam:g,direction:b?"backward":"forward",meta:t.options.meta};return d(k),k})(),v=await f(w),{maxPages:E}=t.options,N=b?kT:wT;return{pages:N(m.pages,v,E),pageParams:N(m.pageParams,g,E)}};if(s&&i.length){const m=s==="backward",g=m?OT:db,b={pages:i,pageParams:o},y=g(r,b);a=await p(b,y,m)}else{const m=e??i.length;do{const g=l===0?o[0]??r.initialPageParam:db(r,a);if(l>0&&g==null)break;a=await p(a,g),l++}while(l<m)}return a};t.options.persister?t.fetchFn=()=>t.options.persister?.(c,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n):t.fetchFn=c}}}function db(e,{pages:t,pageParams:n}){const r=t.length-1;return t.length>0?e.getNextPageParam(t[r],t,n[r],n):void 0}function OT(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var IT=class extends Fw{#e;#t;#n;#s;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||$w(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#n.remove(this))}continue(){return this.#s?.continue()??this.execute(this.state.variables)}async execute(e){const t=()=>{this.#r({type:"continue"})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#s=zw({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(new Error("No mutationFn found")),onFail:(i,o)=>{this.#r({type:"failed",failureCount:i,error:o})},onPause:()=>{this.#r({type:"pause"})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});const r=this.state.status==="pending",s=!this.#s.canStart();try{if(r)t();else{this.#r({type:"pending",variables:e,isPaused:s}),await this.#n.config.onMutate?.(e,this,n);const o=await this.options.onMutate?.(e,n);o!==this.state.context&&this.#r({type:"pending",context:o,variables:e,isPaused:s})}const i=await this.#s.start();return await this.#n.config.onSuccess?.(i,e,this.state.context,this,n),await this.options.onSuccess?.(i,e,this.state.context,n),await this.#n.config.onSettled?.(i,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(i,null,e,this.state.context,n),this.#r({type:"success",data:i}),i}catch(i){try{throw await this.#n.config.onError?.(i,e,this.state.context,this,n),await this.options.onError?.(i,e,this.state.context,n),await this.#n.config.onSettled?.(void 0,i,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(void 0,i,e,this.state.context,n),i}finally{this.#r({type:"error",error:i})}}finally{this.#n.runNext(this)}}#r(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),qt.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:"updated",action:e})})}};function $w(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var DT=class extends Ro{constructor(e={}){super(),this.config=e,this.#e=new Set,this.#t=new Map,this.#n=0}#e;#t;#n;build(e,t,n){const r=new IT({client:e,mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#e.add(e);const t=Ml(e);if(typeof t=="string"){const n=this.#t.get(t);n?n.push(e):this.#t.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#e.delete(e)){const t=Ml(e);if(typeof t=="string"){const n=this.#t.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#t.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=Ml(e);if(typeof t=="string"){const r=this.#t.get(t)?.find(s=>s.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=Ml(e);return typeof t=="string"?this.#t.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){qt.batch(()=>{this.#e.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#e.clear(),this.#t.clear()})}getAll(){return Array.from(this.#e)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>sb(t,n))}findAll(e={}){return this.getAll().filter(t=>sb(e,t))}notify(e){qt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return qt.batch(()=>Promise.all(e.map(t=>t.continue().catch(wn))))}};function Ml(e){return e.options.scope?.id}var LT=class extends Ro{#e;#t=void 0;#n;#s;constructor(t,n){super(),this.#e=t,this.setOptions(n),this.bindMethods(),this.#r()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#e.defaultMutationOptions(t),vc(this.options,n)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&wi(n.mutationKey)!==wi(this.options.mutationKey)?this.reset():this.#n?.state.status==="pending"&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(t){this.#r(),this.#o(t)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#r(),this.#o()}mutate(t,n){return this.#s=n,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(t)}#r(){const t=this.#n?.state??$w();this.#t={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#o(t){qt.batch(()=>{if(this.#s&&this.hasListeners()){const n=this.#t.variables,r=this.#t.context,s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};t?.type==="success"?(this.#s.onSuccess?.(t.data,n,r,s),this.#s.onSettled?.(t.data,null,n,r,s)):t?.type==="error"&&(this.#s.onError?.(t.error,n,r,s),this.#s.onSettled?.(void 0,t.error,n,r,s))}this.listeners.forEach(n=>{n(this.#t)})})}},PT=class extends Ro{constructor(e={}){super(),this.config=e,this.#e=new Map}#e;build(e,t,n){const r=t.queryKey,s=t.queryHash??tm(r,t);let i=this.get(s);return i||(i=new TT({client:e,queryKey:r,queryHash:s,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(i)),i}add(e){this.#e.has(e.queryHash)||(this.#e.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#e.get(e.queryHash);t&&(e.destroy(),t===e&&this.#e.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){qt.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#e.get(e)}getAll(){return[...this.#e.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>rb(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>rb(e,n)):t}notify(e){qt.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){qt.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){qt.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},jT=class{#e;#t;#n;#s;#r;#o;#a;#i;constructor(e={}){this.#e=e.queryCache||new PT,this.#t=e.mutationCache||new DT,this.#n=e.defaultOptions||{},this.#s=new Map,this.#r=new Map,this.#o=0}mount(){this.#o++,this.#o===1&&(this.#a=rm.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onFocus())}),this.#i=wc.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#e.onOnline())}))}unmount(){this.#o--,this.#o===0&&(this.#a?.(),this.#a=void 0,this.#i?.(),this.#i=void 0)}isFetching(e){return this.#e.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#t.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#e.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(Is(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#e.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),i=this.#e.get(r.queryHash)?.state.data,o=yT(t,i);if(o!==void 0)return this.#e.build(this,r).setData(o,{...n,manual:!0})}setQueriesData(e,t,n){return qt.batch(()=>this.#e.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#e.get(t.queryHash)?.state}removeQueries(e){const t=this.#e;qt.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#e;return qt.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=qt.batch(()=>this.#e.findAll(e).map(s=>s.cancel(n)));return Promise.all(r).then(wn).catch(wn)}invalidateQueries(e,t={}){return qt.batch(()=>(this.#e.findAll(e).forEach(n=>{n.invalidate()}),e?.refetchType==="none"?Promise.resolve():this.refetchQueries({...e,type:e?.refetchType??e?.type??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},r=qt.batch(()=>this.#e.findAll(e).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(wn)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(wn)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#e.build(this,t);return n.isStaleByTime(Is(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(wn).catch(wn)}fetchInfiniteQuery(e){return e.behavior=ub(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(wn).catch(wn)}ensureInfiniteQueryData(e){return e.behavior=ub(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return wc.isOnline()?this.#t.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#e}getMutationCache(){return this.#t}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#s.set(wi(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#s.values()],n={};return t.forEach(r=>{Ta(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#r.set(wi(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{Ta(e,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...this.#n.queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=tm(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===nm&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#e.clear(),this.#t.clear()}},Uw=x.createContext(void 0),rs=e=>{const t=x.useContext(Uw);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},zT=({client:e,children:t})=>(x.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),h.jsx(Uw.Provider,{value:e,children:t})),Hw=x.createContext(!1),FT=()=>x.useContext(Hw);Hw.Provider;function BT(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var $T=x.createContext(BT()),UT=()=>x.useContext($T),HT=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},VT=e=>{x.useEffect(()=>{e.clearReset()},[e])},qT=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:s})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(s&&e.data===void 0||Pw(n,[e.error,r])),WT=e=>{if(e.suspense){const n=s=>s==="static"?s:Math.max(s??1e3,1e3),r=e.staleTime;e.staleTime=typeof r=="function"?(...s)=>n(r(...s)):n(r),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},KT=(e,t)=>e.isLoading&&e.isFetching&&!t,GT=(e,t)=>e?.suspense&&t.isPending,fb=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function JT(e,t,n){const r=FT(),s=UT(),i=rs(),o=i.defaultQueryOptions(e);i.getDefaultOptions().queries?._experimental_beforeQuery?.(o),o._optimisticResults=r?"isRestoring":"optimistic",WT(o),HT(o,s),VT(s);const a=!i.getQueryCache().get(o.queryHash),[l]=x.useState(()=>new t(i,o)),c=l.getOptimisticResult(o),u=!r&&e.subscribed!==!1;if(x.useSyncExternalStore(x.useCallback(d=>{const f=u?l.subscribe(qt.batchCalls(d)):wn;return l.updateResult(),f},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),x.useEffect(()=>{l.setOptions(o)},[o,l]),GT(o,c))throw fb(o,l,s);if(qT({result:c,errorResetBoundary:s,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw c.error;return i.getDefaultOptions().queries?._experimental_afterQuery?.(o,c),o.experimental_prefetchInRender&&!vi&&KT(c,r)&&(a?fb(o,l,s):i.getQueryCache().get(o.queryHash)?.promise)?.catch(wn).finally(()=>{l.updateResult()}),o.notifyOnChangeProps?c:l.trackResult(c)}function nl(e,t){return JT(e,AT)}function or(e,t){const n=rs(),[r]=x.useState(()=>new LT(n,e));x.useEffect(()=>{r.setOptions(e)},[r,e]);const s=x.useSyncExternalStore(x.useCallback(o=>r.subscribe(qt.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=x.useCallback((o,a)=>{r.mutate(o,a).catch(wn)},[r]);if(s.error&&Pw(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}const Vw=x.createContext(void 0);function ZT({children:e}){const[t,n]=x.useState(()=>localStorage.getItem("theme")||"system"),[r,s]=x.useState(()=>t==="system"?window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t==="dark"?"dark":"light");return x.useEffect(()=>{const i=window.document.documentElement;if(i.classList.remove("light","dark"),t==="system"){const o=window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light";i.classList.add(o),s(o)}else i.classList.add(t),s(t)},[t]),x.useEffect(()=>{localStorage.setItem("theme",t)},[t]),x.useEffect(()=>{const i=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>{if(t==="system"){const a=i.matches?"dark":"light";s(a),window.document.documentElement.classList.remove("light","dark"),window.document.documentElement.classList.add(a)}};return i.addEventListener("change",o),()=>i.removeEventListener("change",o)},[t]),h.jsx(Vw.Provider,{value:{theme:t,setTheme:n,actualTheme:r},children:e})}function YT(){const e=x.useContext(Vw);if(e===void 0)throw new Error("useTheme must be used within a ThemeProvider");return e}const qw=x.createContext(null);function XT({children:e,url:t="",reconnect:n=!0,reconnectInterval:r=5e3}){const s=x.useRef(null),i=x.useRef(null),o=x.useRef(new Map),a=x.useRef(new Set),l=x.useRef(new Set),[c,u]=x.useState(!1),[d,f]=x.useState(null),p=x.useCallback(()=>{if(s.current?.readyState===WebSocket.OPEN)return;const E="/ws",N=window.location.protocol==="https:"?"wss:":"ws:",k=E.startsWith("/")?`${N}//${window.location.host}${E}${t}`:`${E}${t}`;console.log("[WebSocket] Connecting to:",k);try{s.current=new WebSocket(k),s.current.onopen=()=>{console.log("[WebSocket] Connected"),u(!0),l.current.forEach(C=>{if(s.current?.readyState===WebSocket.OPEN){const A=QT(C);A&&(s.current.send(JSON.stringify(A)),console.log("[WebSocket] Resubscribed to:",C))}}),a.current=new Set(l.current),l.current.clear()},s.current.onmessage=C=>{try{const A=JSON.parse(C.data);console.log("[WebSocket] Message received:",A.type),f(A),o.current.forEach(R=>{try{R(A)}catch(T){console.error("[WebSocket] Handler error:",T)}})}catch(A){console.error("[WebSocket] Failed to parse message:",A)}},s.current.onerror=C=>{console.error("[WebSocket] Error:",C)},s.current.onclose=()=>{console.log("[WebSocket] Disconnected"),u(!1),l.current=new Set(a.current),n&&(i.current=setTimeout(()=>{console.log("[WebSocket] Attempting to reconnect..."),p()},r))}}catch(C){console.error("[WebSocket] Connection failed:",C)}},[t,n,r]),m=x.useCallback(()=>{i.current&&(clearTimeout(i.current),i.current=null),s.current&&(s.current.onclose=null,s.current.close(),s.current=null),u(!1),a.current.clear(),l.current.clear()},[]),g=x.useCallback((E,N)=>{const k=N?`${E}:${N}`:`${E}:*`;if(a.current.add(k),s.current?.readyState===WebSocket.OPEN){const C={type:"subscribe",entity_type:E,entity_id:N};s.current.send(JSON.stringify(C)),console.log("[WebSocket] Subscribed to:",k)}else l.current.add(k)},[]),b=x.useCallback((E,N)=>{const k=N?`${E}:${N}`:`${E}:*`;if(a.current.delete(k),l.current.delete(k),s.current?.readyState===WebSocket.OPEN){const C={type:"unsubscribe",entity_type:E,entity_id:N};s.current.send(JSON.stringify(C)),console.log("[WebSocket] Unsubscribed from:",k)}},[]),y=x.useCallback((E,N)=>{o.current.set(E,N)},[]),w=x.useCallback(E=>{o.current.delete(E)},[]);x.useEffect(()=>(p(),()=>{m()}),[p,m]);const v={connected:c,lastMessage:d,subscribe:g,unsubscribe:b,addMessageHandler:y,removeMessageHandler:w};return h.jsx(qw.Provider,{value:v,children:e})}function Uu(){const e=x.useContext(qw);if(!e)throw new Error("useWebSocketContext must be used within a WebSocketProvider");return e}function QT(e){if(e==="all")return{type:"subscribe",entity_type:"all"};const[t,n]=e.split(":");return t==="issue"||t==="spec"?{type:"subscribe",entity_type:t,entity_id:n==="*"?void 0:n}:null}/**
2
- * @license lucide-react v0.344.0 - ISC
3
- *
4
- * This source code is licensed under the ISC license.
5
- * See the LICENSE file in the root directory of this source tree.
6
- */var eA={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"};/**
7
- * @license lucide-react v0.344.0 - ISC
8
- *
9
- * This source code is licensed under the ISC license.
10
- * See the LICENSE file in the root directory of this source tree.
11
- */const tA=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase().trim(),Ne=(e,t)=>{const n=x.forwardRef(({color:r="currentColor",size:s=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:a="",children:l,...c},u)=>x.createElement("svg",{ref:u,...eA,width:s,height:s,stroke:r,strokeWidth:o?Number(i)*24/Number(s):i,className:["lucide",`lucide-${tA(e)}`,a].join(" "),...c},[...t.map(([d,f])=>x.createElement(d,f)),...Array.isArray(l)?l:[l]]));return n.displayName=`${e}`,n};/**
12
- * @license lucide-react v0.344.0 - ISC
13
- *
14
- * This source code is licensed under the ISC license.
15
- * See the LICENSE file in the root directory of this source tree.
16
- */const ki=Ne("AlertCircle",[["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"}]]);/**
17
- * @license lucide-react v0.344.0 - ISC
18
- *
19
- * This source code is licensed under the ISC license.
20
- * See the LICENSE file in the root directory of this source tree.
21
- */const im=Ne("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
22
- * @license lucide-react v0.344.0 - ISC
23
- *
24
- * This source code is licensed under the ISC license.
25
- * See the LICENSE file in the root directory of this source tree.
26
- */const Oo=Ne("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
27
- * @license lucide-react v0.344.0 - ISC
28
- *
29
- * This source code is licensed under the ISC license.
30
- * See the LICENSE file in the root directory of this source tree.
31
- */const Hu=Ne("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
32
- * @license lucide-react v0.344.0 - ISC
33
- *
34
- * This source code is licensed under the ISC license.
35
- * See the LICENSE file in the root directory of this source tree.
36
- */const nA=Ne("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
37
- * @license lucide-react v0.344.0 - ISC
38
- *
39
- * This source code is licensed under the ISC license.
40
- * See the LICENSE file in the root directory of this source tree.
41
- */const rA=Ne("Bold",[["path",{d:"M14 12a4 4 0 0 0 0-8H6v8",key:"v2sylx"}],["path",{d:"M15 20a4 4 0 0 0 0-8H6v8Z",key:"1ef5ya"}]]);/**
42
- * @license lucide-react v0.344.0 - ISC
43
- *
44
- * This source code is licensed under the ISC license.
45
- * See the LICENSE file in the root directory of this source tree.
46
- */const om=Ne("CheckCircle2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
47
- * @license lucide-react v0.344.0 - ISC
48
- *
49
- * This source code is licensed under the ISC license.
50
- * See the LICENSE file in the root directory of this source tree.
51
- */const Ww=Ne("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
52
- * @license lucide-react v0.344.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 Aa=Ne("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
57
- * @license lucide-react v0.344.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
- */const am=Ne("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
62
- * @license lucide-react v0.344.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 sA=Ne("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
67
- * @license lucide-react v0.344.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 Ma=Ne("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
72
- * @license lucide-react v0.344.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 rl=Ne("Code2",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
77
- * @license lucide-react v0.344.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 iA=Ne("CodeSquare",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m10 10-2 2 2 2",key:"p6et6i"}],["path",{d:"m14 14 2-2-2-2",key:"m075q2"}]]);/**
82
- * @license lucide-react v0.344.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 oA=Ne("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
87
- * @license lucide-react v0.344.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 aA=Ne("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]);/**
92
- * @license lucide-react v0.344.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 lA=Ne("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
97
- * @license lucide-react v0.344.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 ss=Ne("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
102
- * @license lucide-react v0.344.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 lm=Ne("GitBranch",[["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"}]]);/**
107
- * @license lucide-react v0.344.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 cA=Ne("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/**
112
- * @license lucide-react v0.344.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 uA=Ne("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/**
117
- * @license lucide-react v0.344.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 dA=Ne("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
122
- * @license lucide-react v0.344.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 fA=Ne("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/**
127
- * @license lucide-react v0.344.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 hb=Ne("HelpCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
132
- * @license lucide-react v0.344.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 hA=Ne("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
137
- * @license lucide-react v0.344.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 pA=Ne("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
142
- * @license lucide-react v0.344.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 mA=Ne("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
147
- * @license lucide-react v0.344.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 Kw=Ne("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
152
- * @license lucide-react v0.344.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 gA=Ne("ListOrdered",[["line",{x1:"10",x2:"21",y1:"6",y2:"6",key:"76qw6h"}],["line",{x1:"10",x2:"21",y1:"12",y2:"12",key:"16nom4"}],["line",{x1:"10",x2:"21",y1:"18",y2:"18",key:"u3jurt"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
157
- * @license lucide-react v0.344.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 bA=Ne("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
162
- * @license lucide-react v0.344.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 yA=Ne("List",[["line",{x1:"8",x2:"21",y1:"6",y2:"6",key:"7ey8pc"}],["line",{x1:"8",x2:"21",y1:"12",y2:"12",key:"rjfblc"}],["line",{x1:"8",x2:"21",y1:"18",y2:"18",key:"c3b1m8"}],["line",{x1:"3",x2:"3.01",y1:"6",y2:"6",key:"1g7gq3"}],["line",{x1:"3",x2:"3.01",y1:"12",y2:"12",key:"1pjlvk"}],["line",{x1:"3",x2:"3.01",y1:"18",y2:"18",key:"28t2mc"}]]);/**
167
- * @license lucide-react v0.344.0 - ISC
168
- *
169
- * This source code is licensed under the ISC license.
170
- * See the LICENSE file in the root directory of this source tree.
171
- */const Ds=Ne("Loader2",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
172
- * @license lucide-react v0.344.0 - ISC
173
- *
174
- * This source code is licensed under the ISC license.
175
- * See the LICENSE file in the root directory of this source tree.
176
- */const xA=Ne("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
177
- * @license lucide-react v0.344.0 - ISC
178
- *
179
- * This source code is licensed under the ISC license.
180
- * See the LICENSE file in the root directory of this source tree.
181
- */const vA=Ne("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
182
- * @license lucide-react v0.344.0 - ISC
183
- *
184
- * This source code is licensed under the ISC license.
185
- * See the LICENSE file in the root directory of this source tree.
186
- */const wA=Ne("MessageSquareOff",[["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M3.6 3.6c-.4.3-.6.8-.6 1.4v16l4-4h10",key:"pwpm4a"}]]);/**
187
- * @license lucide-react v0.344.0 - ISC
188
- *
189
- * This source code is licensed under the ISC license.
190
- * See the LICENSE file in the root directory of this source tree.
191
- */const cm=Ne("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
192
- * @license lucide-react v0.344.0 - ISC
193
- *
194
- * This source code is licensed under the ISC license.
195
- * See the LICENSE file in the root directory of this source tree.
196
- */const Vu=Ne("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
197
- * @license lucide-react v0.344.0 - ISC
198
- *
199
- * This source code is licensed under the ISC license.
200
- * See the LICENSE file in the root directory of this source tree.
201
- */const kA=Ne("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
202
- * @license lucide-react v0.344.0 - ISC
203
- *
204
- * This source code is licensed under the ISC license.
205
- * See the LICENSE file in the root directory of this source tree.
206
- */const Gw=Ne("PauseCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/**
207
- * @license lucide-react v0.344.0 - ISC
208
- *
209
- * This source code is licensed under the ISC license.
210
- * See the LICENSE file in the root directory of this source tree.
211
- */const SA=Ne("Play",[["polygon",{points:"5 3 19 12 5 21 5 3",key:"191637"}]]);/**
212
- * @license lucide-react v0.344.0 - ISC
213
- *
214
- * This source code is licensed under the ISC license.
215
- * See the LICENSE file in the root directory of this source tree.
216
- */const Si=Ne("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
217
- * @license lucide-react v0.344.0 - ISC
218
- *
219
- * This source code is licensed under the ISC license.
220
- * See the LICENSE file in the root directory of this source tree.
221
- */const EA=Ne("Quote",[["path",{d:"M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z",key:"4rm80e"}],["path",{d:"M15 21c3 0 7-1 7-8V5c0-1.25-.757-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2h.75c0 2.25.25 4-2.75 4v3c0 1 0 1 1 1z",key:"10za9r"}]]);/**
222
- * @license lucide-react v0.344.0 - ISC
223
- *
224
- * This source code is licensed under the ISC license.
225
- * See the LICENSE file in the root directory of this source tree.
226
- */const CA=Ne("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/**
227
- * @license lucide-react v0.344.0 - ISC
228
- *
229
- * This source code is licensed under the ISC license.
230
- * See the LICENSE file in the root directory of this source tree.
231
- */const qu=Ne("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
232
- * @license lucide-react v0.344.0 - ISC
233
- *
234
- * This source code is licensed under the ISC license.
235
- * See the LICENSE file in the root directory of this source tree.
236
- */const pb=Ne("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
237
- * @license lucide-react v0.344.0 - ISC
238
- *
239
- * This source code is licensed under the ISC license.
240
- * See the LICENSE file in the root directory of this source tree.
241
- */const Jw=Ne("Signal",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]]);/**
242
- * @license lucide-react v0.344.0 - ISC
243
- *
244
- * This source code is licensed under the ISC license.
245
- * See the LICENSE file in the root directory of this source tree.
246
- */const mb=Ne("StopCircle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{width:"6",height:"6",x:"9",y:"9",key:"1wrtvo"}]]);/**
247
- * @license lucide-react v0.344.0 - ISC
248
- *
249
- * This source code is licensed under the ISC license.
250
- * See the LICENSE file in the root directory of this source tree.
251
- */const NA=Ne("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/**
252
- * @license lucide-react v0.344.0 - ISC
253
- *
254
- * This source code is licensed under the ISC license.
255
- * See the LICENSE file in the root directory of this source tree.
256
- */const _A=Ne("Table",[["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"}]]);/**
257
- * @license lucide-react v0.344.0 - ISC
258
- *
259
- * This source code is licensed under the ISC license.
260
- * See the LICENSE file in the root directory of this source tree.
261
- */const Io=Ne("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
262
- * @license lucide-react v0.344.0 - ISC
263
- *
264
- * This source code is licensed under the ISC license.
265
- * See the LICENSE file in the root directory of this source tree.
266
- */const TA=Ne("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/**
267
- * @license lucide-react v0.344.0 - ISC
268
- *
269
- * This source code is licensed under the ISC license.
270
- * See the LICENSE file in the root directory of this source tree.
271
- */const AA=Ne("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/**
272
- * @license lucide-react v0.344.0 - ISC
273
- *
274
- * This source code is licensed under the ISC license.
275
- * See the LICENSE file in the root directory of this source tree.
276
- */const ao=Ne("XCircle",[["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"}]]);/**
277
- * @license lucide-react v0.344.0 - ISC
278
- *
279
- * This source code is licensed under the ISC license.
280
- * See the LICENSE file in the root directory of this source tree.
281
- */const da=Ne("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Zw(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(n=Zw(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Yw(){for(var e,t,n=0,r="",s=arguments.length;n<s;n++)(e=arguments[n])&&(t=Zw(e))&&(r&&(r+=" "),r+=t);return r}const um="-",MA=e=>{const t=OA(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:o=>{const a=o.split(um);return a[0]===""&&a.length!==1&&a.shift(),Xw(a,t)||RA(o)},getConflictingClassGroupIds:(o,a)=>{const l=n[o]||[];return a&&r[o]?[...l,...r[o]]:l}}},Xw=(e,t)=>{if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),s=r?Xw(e.slice(1),r):void 0;if(s)return s;if(t.validators.length===0)return;const i=e.join(um);return t.validators.find(({validator:o})=>o(i))?.classGroupId},gb=/^\[(.+)\]$/,RA=e=>{if(gb.test(e)){const t=gb.exec(e)[1],n=t?.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},OA=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return DA(Object.entries(e.classGroups),n).forEach(([i,o])=>{Th(o,r,i,t)}),r},Th=(e,t,n,r)=>{e.forEach(s=>{if(typeof s=="string"){const i=s===""?t:bb(t,s);i.classGroupId=n;return}if(typeof s=="function"){if(IA(s)){Th(s(r),t,n,r);return}t.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,o])=>{Th(o,bb(t,i),n,r)})})},bb=(e,t)=>{let n=e;return t.split(um).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},IA=e=>e.isThemeGetter,DA=(e,t)=>t?e.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?t+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,a])=>[t+o,a])):i);return[n,s]}):e,LA=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const s=(i,o)=>{n.set(i,o),t++,t>e&&(t=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return s(i,o),o},set(i,o){n.has(i)?n.set(i,o):s(i,o)}}},Qw="!",PA=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,s=t[0],i=t.length,o=a=>{const l=[];let c=0,u=0,d;for(let b=0;b<a.length;b++){let y=a[b];if(c===0){if(y===s&&(r||a.slice(b,b+i)===t)){l.push(a.slice(u,b)),u=b+i;continue}if(y==="/"){d=b;continue}}y==="["?c++:y==="]"&&c--}const f=l.length===0?a:a.substring(u),p=f.startsWith(Qw),m=p?f.substring(1):f,g=d&&d>u?d-u:void 0;return{modifiers:l,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}};return n?a=>n({className:a,parseClassName:o}):o},jA=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},zA=e=>({cache:LA(e.cacheSize),parseClassName:PA(e),...MA(e)}),FA=/\s+/,BA=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=t,i=[],o=e.trim().split(FA);let a="";for(let l=o.length-1;l>=0;l-=1){const c=o[l],{modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(c);let m=!!p,g=r(m?f.substring(0,p):f);if(!g){if(!m){a=c+(a.length>0?" "+a:a);continue}if(g=r(f),!g){a=c+(a.length>0?" "+a:a);continue}m=!1}const b=jA(u).join(":"),y=d?b+Qw:b,w=y+g;if(i.includes(w))continue;i.push(w);const v=s(g,m);for(let E=0;E<v.length;++E){const N=v[E];i.push(y+N)}a=c+(a.length>0?" "+a:a)}return a};function $A(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=e0(t))&&(r&&(r+=" "),r+=n);return r}const e0=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=e0(e[r]))&&(n&&(n+=" "),n+=t);return n};function UA(e,...t){let n,r,s,i=o;function o(l){const c=t.reduce((u,d)=>d(u),e());return n=zA(c),r=n.cache.get,s=n.cache.set,i=a,a(l)}function a(l){const c=r(l);if(c)return c;const u=BA(l,n);return s(l,u),u}return function(){return i($A.apply(null,arguments))}}const kt=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},t0=/^\[(?:([a-z-]+):)?(.+)\]$/i,HA=/^\d+\/\d+$/,VA=new Set(["px","full","screen"]),qA=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,WA=/\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$/,KA=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,GA=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,JA=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,$r=e=>lo(e)||VA.has(e)||HA.test(e),hs=e=>Do(e,"length",rM),lo=e=>!!e&&!Number.isNaN(Number(e)),Qd=e=>Do(e,"number",lo),qo=e=>!!e&&Number.isInteger(Number(e)),ZA=e=>e.endsWith("%")&&lo(e.slice(0,-1)),Fe=e=>t0.test(e),ps=e=>qA.test(e),YA=new Set(["length","size","percentage"]),XA=e=>Do(e,YA,n0),QA=e=>Do(e,"position",n0),eM=new Set(["image","url"]),tM=e=>Do(e,eM,iM),nM=e=>Do(e,"",sM),Wo=()=>!0,Do=(e,t,n)=>{const r=t0.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},rM=e=>WA.test(e)&&!KA.test(e),n0=()=>!1,sM=e=>GA.test(e),iM=e=>JA.test(e),oM=()=>{const e=kt("colors"),t=kt("spacing"),n=kt("blur"),r=kt("brightness"),s=kt("borderColor"),i=kt("borderRadius"),o=kt("borderSpacing"),a=kt("borderWidth"),l=kt("contrast"),c=kt("grayscale"),u=kt("hueRotate"),d=kt("invert"),f=kt("gap"),p=kt("gradientColorStops"),m=kt("gradientColorStopPositions"),g=kt("inset"),b=kt("margin"),y=kt("opacity"),w=kt("padding"),v=kt("saturate"),E=kt("scale"),N=kt("sepia"),k=kt("skew"),C=kt("space"),A=kt("translate"),R=()=>["auto","contain","none"],T=()=>["auto","hidden","clip","visible","scroll"],I=()=>["auto",Fe,t],O=()=>[Fe,t],j=()=>["",$r,hs],L=()=>["auto",lo,Fe],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],q=()=>["solid","dashed","dotted","double","none"],te=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],le=()=>["","0",Fe],_=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ae=()=>[lo,Fe];return{cacheSize:500,separator:":",theme:{colors:[Wo],spacing:[$r,hs],blur:["none","",ps,Fe],brightness:ae(),borderColor:[e],borderRadius:["none","","full",ps,Fe],borderSpacing:O(),borderWidth:j(),contrast:ae(),grayscale:le(),hueRotate:ae(),invert:le(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[ZA,hs],inset:I(),margin:I(),opacity:ae(),padding:O(),saturate:ae(),scale:ae(),sepia:le(),skew:ae(),space:O(),translate:O()},classGroups:{aspect:[{aspect:["auto","square","video",Fe]}],container:["container"],columns:[{columns:[ps]}],"break-after":[{"break-after":_()}],"break-before":[{"break-before":_()}],"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"],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:[...F(),Fe]}],overflow:[{overflow:T()}],"overflow-x":[{"overflow-x":T()}],"overflow-y":[{"overflow-y":T()}],overscroll:[{overscroll:R()}],"overscroll-x":[{"overscroll-x":R()}],"overscroll-y":[{"overscroll-y":R()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",qo,Fe]}],basis:[{basis:I()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Fe]}],grow:[{grow:le()}],shrink:[{shrink:le()}],order:[{order:["first","last","none",qo,Fe]}],"grid-cols":[{"grid-cols":[Wo]}],"col-start-end":[{col:["auto",{span:["full",qo,Fe]},Fe]}],"col-start":[{"col-start":L()}],"col-end":[{"col-end":L()}],"grid-rows":[{"grid-rows":[Wo]}],"row-start-end":[{row:["auto",{span:[qo,Fe]},Fe]}],"row-start":[{"row-start":L()}],"row-end":[{"row-end":L()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Fe]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Fe]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[C]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[C]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Fe,t]}],"min-w":[{"min-w":[Fe,t,"min","max","fit"]}],"max-w":[{"max-w":[Fe,t,"none","full","min","max","fit","prose",{screen:[ps]},ps]}],h:[{h:[Fe,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Fe,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Fe,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Fe,t,"auto","min","max","fit"]}],"font-size":[{text:["base",ps,hs]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Qd]}],"font-family":[{font:[Wo]}],"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:["tighter","tight","normal","wide","wider","widest",Fe]}],"line-clamp":[{"line-clamp":["none",lo,Qd]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",$r,Fe]}],"list-image":[{"list-image":["none",Fe]}],"list-style-type":[{list:["none","disc","decimal",Fe]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...q(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",$r,hs]}],"underline-offset":[{"underline-offset":["auto",$r,Fe]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:O()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Fe]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Fe]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...F(),QA]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",XA]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},tM]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...q(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}],"divide-style":[{divide:q()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...q()]}],"outline-offset":[{"outline-offset":[$r,Fe]}],"outline-w":[{outline:[$r,hs]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:j()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[$r,hs]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",ps,nM]}],"shadow-color":[{shadow:[Wo]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...te(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":te()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",ps,Fe]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[v]}],sepia:[{sepia:[N]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[v]}],"backdrop-sepia":[{"backdrop-sepia":[N]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Fe]}],duration:[{duration:ae()}],ease:[{ease:["linear","in","out","in-out",Fe]}],delay:[{delay:ae()}],animate:[{animate:["none","spin","ping","pulse","bounce",Fe]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[qo,Fe]}],"translate-x":[{"translate-x":[A]}],"translate-y":[{"translate-y":[A]}],"skew-x":[{"skew-x":[k]}],"skew-y":[{"skew-y":[k]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Fe]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],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]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[$r,hs,Qd]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"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-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-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"],"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"]}}},aM=UA(oM);function Te(...e){return aM(Yw(e))}var r0=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),lM="VisuallyHidden",s0=x.forwardRef((e,t)=>h.jsx(gn.span,{...e,ref:t,style:{...r0,...e.style}}));s0.displayName=lM;var cM=s0,[Wu]=Gp("Tooltip",[Bu]),Ku=Bu(),i0="TooltipProvider",uM=700,Ah="tooltip.open",[dM,dm]=Wu(i0),o0=e=>{const{__scopeTooltip:t,delayDuration:n=uM,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=e,o=x.useRef(!0),a=x.useRef(!1),l=x.useRef(0);return x.useEffect(()=>{const c=l.current;return()=>window.clearTimeout(c)},[]),h.jsx(dM,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:x.useCallback(()=>{window.clearTimeout(l.current),o.current=!1},[]),onClose:x.useCallback(()=>{window.clearTimeout(l.current),l.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:a,onPointerInTransitChange:x.useCallback(c=>{a.current=c},[]),disableHoverableContent:s,children:i})};o0.displayName=i0;var Ra="Tooltip",[fM,sl]=Wu(Ra),a0=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:a}=e,l=dm(Ra,e.__scopeTooltip),c=Ku(t),[u,d]=x.useState(null),f=$u(),p=x.useRef(0),m=o??l.disableHoverableContent,g=a??l.delayDuration,b=x.useRef(!1),[y,w]=wh({prop:r,defaultProp:s??!1,onChange:C=>{C?(l.onOpen(),document.dispatchEvent(new CustomEvent(Ah))):l.onClose(),i?.(C)},caller:Ra}),v=x.useMemo(()=>y?b.current?"delayed-open":"instant-open":"closed",[y]),E=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,b.current=!1,w(!0)},[w]),N=x.useCallback(()=>{window.clearTimeout(p.current),p.current=0,w(!1)},[w]),k=x.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{b.current=!0,w(!0),p.current=0},g)},[g,w]);return x.useEffect(()=>()=>{p.current&&(window.clearTimeout(p.current),p.current=0)},[]),h.jsx(Ew,{...c,children:h.jsx(fM,{scope:t,contentId:f,open:y,stateAttribute:v,trigger:u,onTriggerChange:d,onTriggerEnter:x.useCallback(()=>{l.isOpenDelayedRef.current?k():E()},[l.isOpenDelayedRef,k,E]),onTriggerLeave:x.useCallback(()=>{m?N():(window.clearTimeout(p.current),p.current=0)},[N,m]),onOpen:E,onClose:N,disableHoverableContent:m,children:n})})};a0.displayName=Ra;var Mh="TooltipTrigger",l0=x.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=sl(Mh,n),i=dm(Mh,n),o=Ku(n),a=x.useRef(null),l=Ln(t,a,s.onTriggerChange),c=x.useRef(!1),u=x.useRef(!1),d=x.useCallback(()=>c.current=!1,[]);return x.useEffect(()=>()=>document.removeEventListener("pointerup",d),[d]),h.jsx(Cw,{asChild:!0,...o,children:h.jsx(gn.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:l,onPointerMove:Nt(e.onPointerMove,f=>{f.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),u.current=!0)}),onPointerLeave:Nt(e.onPointerLeave,()=>{s.onTriggerLeave(),u.current=!1}),onPointerDown:Nt(e.onPointerDown,()=>{s.open&&s.onClose(),c.current=!0,document.addEventListener("pointerup",d,{once:!0})}),onFocus:Nt(e.onFocus,()=>{c.current||s.onOpen()}),onBlur:Nt(e.onBlur,s.onClose),onClick:Nt(e.onClick,s.onClose)})})});l0.displayName=Mh;var fm="TooltipPortal",[hM,pM]=Wu(fm,{forceMount:void 0}),c0=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:s}=e,i=sl(fm,t);return h.jsx(hM,{scope:t,forceMount:n,children:h.jsx(xw,{present:n||i.open,children:h.jsx(vw,{asChild:!0,container:s,children:r})})})};c0.displayName=fm;var xo="TooltipContent",u0=x.forwardRef((e,t)=>{const n=pM(xo,e.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=e,o=sl(xo,e.__scopeTooltip);return h.jsx(xw,{present:r||o.open,children:o.disableHoverableContent?h.jsx(d0,{side:s,...i,ref:t}):h.jsx(mM,{side:s,...i,ref:t})})}),mM=x.forwardRef((e,t)=>{const n=sl(xo,e.__scopeTooltip),r=dm(xo,e.__scopeTooltip),s=x.useRef(null),i=Ln(t,s),[o,a]=x.useState(null),{trigger:l,onClose:c}=n,u=s.current,{onPointerInTransitChange:d}=r,f=x.useCallback(()=>{a(null),d(!1)},[d]),p=x.useCallback((m,g)=>{const b=m.currentTarget,y={x:m.clientX,y:m.clientY},w=vM(y,b.getBoundingClientRect()),v=wM(y,w),E=kM(g.getBoundingClientRect()),N=EM([...v,...E]);a(N),d(!0)},[d]);return x.useEffect(()=>()=>f(),[f]),x.useEffect(()=>{if(l&&u){const m=b=>p(b,u),g=b=>p(b,l);return l.addEventListener("pointerleave",m),u.addEventListener("pointerleave",g),()=>{l.removeEventListener("pointerleave",m),u.removeEventListener("pointerleave",g)}}},[l,u,p,f]),x.useEffect(()=>{if(o){const m=g=>{const b=g.target,y={x:g.clientX,y:g.clientY},w=l?.contains(b)||u?.contains(b),v=!SM(y,o);w?f():v&&(f(),c())};return document.addEventListener("pointermove",m),()=>document.removeEventListener("pointermove",m)}},[l,u,o,c,f]),h.jsx(d0,{...e,ref:i})}),[gM,bM]=Wu(Ra,{isInside:!1}),yM=Sw("TooltipContent"),d0=x.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...a}=e,l=sl(xo,n),c=Ku(n),{onClose:u}=l;return x.useEffect(()=>(document.addEventListener(Ah,u),()=>document.removeEventListener(Ah,u)),[u]),x.useEffect(()=>{if(l.trigger){const d=f=>{f.target?.contains(l.trigger)&&u()};return window.addEventListener("scroll",d,{capture:!0}),()=>window.removeEventListener("scroll",d,{capture:!0})}},[l.trigger,u]),h.jsx(ww,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:d=>d.preventDefault(),onDismiss:u,children:h.jsxs(kw,{"data-state":l.stateAttribute,...c,...a,ref:t,style:{...a.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[h.jsx(yM,{children:r}),h.jsx(gM,{scope:n,isInside:!0,children:h.jsx(cM,{id:l.contentId,role:"tooltip",children:s||r})})]})})});u0.displayName=xo;var f0="TooltipArrow",xM=x.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,s=Ku(n);return bM(f0,n).isInside?null:h.jsx(Nw,{...s,...r,ref:t})});xM.displayName=f0;function vM(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),s=Math.abs(t.right-e.x),i=Math.abs(t.left-e.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function wM(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function kM(e){const{top:t,right:n,bottom:r,left:s}=e;return[{x:s,y:t},{x:n,y:t},{x:n,y:r},{x:s,y:r}]}function SM(e,t){const{x:n,y:r}=e;let s=!1;for(let i=0,o=t.length-1;i<t.length;o=i++){const a=t[i],l=t[o],c=a.x,u=a.y,d=l.x,f=l.y;u>r!=f>r&&n<(d-c)*(r-u)/(f-u)+c&&(s=!s)}return s}function EM(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),CM(t)}function CM(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const s=e[r];for(;t.length>=2;){const i=t[t.length-1],o=t[t.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))t.pop();else break}t.push(s)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var NM=o0,_M=a0,TM=l0,AM=c0,h0=u0;const Ei=NM,rr=_M,sr=TM,Un=x.forwardRef(({className:e,sideOffset:t=4,...n},r)=>h.jsx(AM,{children:h.jsx(h0,{ref:r,sideOffset:t,className:Te("z-50 origin-[--radix-tooltip-content-transform-origin] overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",e),...n})}));Un.displayName=h0.displayName;const Bi=Tw,MM=Aw,RM=_w,p0=x.forwardRef(({className:e,...t},n)=>h.jsx(Jp,{ref:n,className:Te("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t}));p0.displayName=Jp.displayName;const qs=x.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(RM,{children:[h.jsx(p0,{}),h.jsx(Zp,{ref:r,className:Te("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...n,children:t})]}));qs.displayName=Zp.displayName;const Ws=({className:e,...t})=>h.jsx("div",{className:Te("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});Ws.displayName="DialogHeader";const hm=({className:e,...t})=>h.jsx("div",{className:Te("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});hm.displayName="DialogFooter";const Ks=x.forwardRef(({className:e,...t},n)=>h.jsx(Yp,{ref:n,className:Te("text-lg font-semibold leading-none tracking-tight",e),...t}));Ks.displayName=Yp.displayName;const Gu=x.forwardRef(({className:e,...t},n)=>h.jsx(Xp,{ref:n,className:Te("text-sm text-muted-foreground",e),...t}));Gu.displayName=Xp.displayName;function m0(e,t){return function(){return e.apply(t,arguments)}}const{toString:OM}=Object.prototype,{getPrototypeOf:pm}=Object,{iterator:Ju,toStringTag:g0}=Symbol,Zu=(e=>t=>{const n=OM.call(t);return e[n]||(e[n]=n.slice(8,-1).toLowerCase())})(Object.create(null)),wr=e=>(e=e.toLowerCase(),t=>Zu(t)===e),Yu=e=>t=>typeof t===e,{isArray:Lo}=Array,vo=Yu("undefined");function il(e){return e!==null&&!vo(e)&&e.constructor!==null&&!vo(e.constructor)&&On(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const b0=wr("ArrayBuffer");function IM(e){let t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(e):t=e&&e.buffer&&b0(e.buffer),t}const DM=Yu("string"),On=Yu("function"),y0=Yu("number"),ol=e=>e!==null&&typeof e=="object",LM=e=>e===!0||e===!1,oc=e=>{if(Zu(e)!=="object")return!1;const t=pm(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(g0 in e)&&!(Ju in e)},PM=e=>{if(!ol(e)||il(e))return!1;try{return Object.keys(e).length===0&&Object.getPrototypeOf(e)===Object.prototype}catch{return!1}},jM=wr("Date"),zM=wr("File"),FM=wr("Blob"),BM=wr("FileList"),$M=e=>ol(e)&&On(e.pipe),UM=e=>{let t;return e&&(typeof FormData=="function"&&e instanceof FormData||On(e.append)&&((t=Zu(e))==="formdata"||t==="object"&&On(e.toString)&&e.toString()==="[object FormData]"))},HM=wr("URLSearchParams"),[VM,qM,WM,KM]=["ReadableStream","Request","Response","Headers"].map(wr),GM=e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"");function al(e,t,{allOwnKeys:n=!1}={}){if(e===null||typeof e>"u")return;let r,s;if(typeof e!="object"&&(e=[e]),Lo(e))for(r=0,s=e.length;r<s;r++)t.call(null,e[r],r,e);else{if(il(e))return;const i=n?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let a;for(r=0;r<o;r++)a=i[r],t.call(null,e[a],a,e)}}function x0(e,t){if(il(e))return null;t=t.toLowerCase();const n=Object.keys(e);let r=n.length,s;for(;r-- >0;)if(s=n[r],t===s.toLowerCase())return s;return null}const ai=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:global,v0=e=>!vo(e)&&e!==ai;function Rh(){const{caseless:e,skipUndefined:t}=v0(this)&&this||{},n={},r=(s,i)=>{const o=e&&x0(n,i)||i;oc(n[o])&&oc(s)?n[o]=Rh(n[o],s):oc(s)?n[o]=Rh({},s):Lo(s)?n[o]=s.slice():(!t||!vo(s))&&(n[o]=s)};for(let s=0,i=arguments.length;s<i;s++)arguments[s]&&al(arguments[s],r);return n}const JM=(e,t,n,{allOwnKeys:r}={})=>(al(t,(s,i)=>{n&&On(s)?e[i]=m0(s,n):e[i]=s},{allOwnKeys:r}),e),ZM=e=>(e.charCodeAt(0)===65279&&(e=e.slice(1)),e),YM=(e,t,n,r)=>{e.prototype=Object.create(t.prototype,r),e.prototype.constructor=e,Object.defineProperty(e,"super",{value:t.prototype}),n&&Object.assign(e.prototype,n)},XM=(e,t,n,r)=>{let s,i,o;const a={};if(t=t||{},e==null)return t;do{for(s=Object.getOwnPropertyNames(e),i=s.length;i-- >0;)o=s[i],(!r||r(o,e,t))&&!a[o]&&(t[o]=e[o],a[o]=!0);e=n!==!1&&pm(e)}while(e&&(!n||n(e,t))&&e!==Object.prototype);return t},QM=(e,t,n)=>{e=String(e),(n===void 0||n>e.length)&&(n=e.length),n-=t.length;const r=e.indexOf(t,n);return r!==-1&&r===n},eR=e=>{if(!e)return null;if(Lo(e))return e;let t=e.length;if(!y0(t))return null;const n=new Array(t);for(;t-- >0;)n[t]=e[t];return n},tR=(e=>t=>e&&t instanceof e)(typeof Uint8Array<"u"&&pm(Uint8Array)),nR=(e,t)=>{const r=(e&&e[Ju]).call(e);let s;for(;(s=r.next())&&!s.done;){const i=s.value;t.call(e,i[0],i[1])}},rR=(e,t)=>{let n;const r=[];for(;(n=e.exec(t))!==null;)r.push(n);return r},sR=wr("HTMLFormElement"),iR=e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,function(n,r,s){return r.toUpperCase()+s}),yb=(({hasOwnProperty:e})=>(t,n)=>e.call(t,n))(Object.prototype),oR=wr("RegExp"),w0=(e,t)=>{const n=Object.getOwnPropertyDescriptors(e),r={};al(n,(s,i)=>{let o;(o=t(s,i,e))!==!1&&(r[i]=o||s)}),Object.defineProperties(e,r)},aR=e=>{w0(e,(t,n)=>{if(On(e)&&["arguments","caller","callee"].indexOf(n)!==-1)return!1;const r=e[n];if(On(r)){if(t.enumerable=!1,"writable"in t){t.writable=!1;return}t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+n+"'")})}})},lR=(e,t)=>{const n={},r=s=>{s.forEach(i=>{n[i]=!0})};return Lo(e)?r(e):r(String(e).split(t)),n},cR=()=>{},uR=(e,t)=>e!=null&&Number.isFinite(e=+e)?e:t;function dR(e){return!!(e&&On(e.append)&&e[g0]==="FormData"&&e[Ju])}const fR=e=>{const t=new Array(10),n=(r,s)=>{if(ol(r)){if(t.indexOf(r)>=0)return;if(il(r))return r;if(!("toJSON"in r)){t[s]=r;const i=Lo(r)?[]:{};return al(r,(o,a)=>{const l=n(o,s+1);!vo(l)&&(i[a]=l)}),t[s]=void 0,i}}return r};return n(e,0)},hR=wr("AsyncFunction"),pR=e=>e&&(ol(e)||On(e))&&On(e.then)&&On(e.catch),k0=((e,t)=>e?setImmediate:t?((n,r)=>(ai.addEventListener("message",({source:s,data:i})=>{s===ai&&i===n&&r.length&&r.shift()()},!1),s=>{r.push(s),ai.postMessage(n,"*")}))(`axios@${Math.random()}`,[]):n=>setTimeout(n))(typeof setImmediate=="function",On(ai.postMessage)),mR=typeof queueMicrotask<"u"?queueMicrotask.bind(ai):typeof process<"u"&&process.nextTick||k0,gR=e=>e!=null&&On(e[Ju]),z={isArray:Lo,isArrayBuffer:b0,isBuffer:il,isFormData:UM,isArrayBufferView:IM,isString:DM,isNumber:y0,isBoolean:LM,isObject:ol,isPlainObject:oc,isEmptyObject:PM,isReadableStream:VM,isRequest:qM,isResponse:WM,isHeaders:KM,isUndefined:vo,isDate:jM,isFile:zM,isBlob:FM,isRegExp:oR,isFunction:On,isStream:$M,isURLSearchParams:HM,isTypedArray:tR,isFileList:BM,forEach:al,merge:Rh,extend:JM,trim:GM,stripBOM:ZM,inherits:YM,toFlatObject:XM,kindOf:Zu,kindOfTest:wr,endsWith:QM,toArray:eR,forEachEntry:nR,matchAll:rR,isHTMLForm:sR,hasOwnProperty:yb,hasOwnProp:yb,reduceDescriptors:w0,freezeMethods:aR,toObjectSet:lR,toCamelCase:iR,noop:cR,toFiniteNumber:uR,findKey:x0,global:ai,isContextDefined:v0,isSpecCompliantForm:dR,toJSONObject:fR,isAsyncFn:hR,isThenable:pR,setImmediate:k0,asap:mR,isIterable:gR};function ze(e,t,n,r,s){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=e,this.name="AxiosError",t&&(this.code=t),n&&(this.config=n),r&&(this.request=r),s&&(this.response=s,this.status=s.status?s.status:null)}z.inherits(ze,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:z.toJSONObject(this.config),code:this.code,status:this.status}}});const S0=ze.prototype,E0={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach(e=>{E0[e]={value:e}});Object.defineProperties(ze,E0);Object.defineProperty(S0,"isAxiosError",{value:!0});ze.from=(e,t,n,r,s,i)=>{const o=Object.create(S0);z.toFlatObject(e,o,function(u){return u!==Error.prototype},c=>c!=="isAxiosError");const a=e&&e.message?e.message:"Error",l=t==null&&e?e.code:t;return ze.call(o,a,l,n,r,s),e&&o.cause==null&&Object.defineProperty(o,"cause",{value:e,configurable:!0}),o.name=e&&e.name||"Error",i&&Object.assign(o,i),o};const bR=null;function Oh(e){return z.isPlainObject(e)||z.isArray(e)}function C0(e){return z.endsWith(e,"[]")?e.slice(0,-2):e}function xb(e,t,n){return e?e.concat(t).map(function(s,i){return s=C0(s),!n&&i?"["+s+"]":s}).join(n?".":""):t}function yR(e){return z.isArray(e)&&!e.some(Oh)}const xR=z.toFlatObject(z,{},null,function(t){return/^is[A-Z]/.test(t)});function Xu(e,t,n){if(!z.isObject(e))throw new TypeError("target must be an object");t=t||new FormData,n=z.toFlatObject(n,{metaTokens:!0,dots:!1,indexes:!1},!1,function(g,b){return!z.isUndefined(b[g])});const r=n.metaTokens,s=n.visitor||u,i=n.dots,o=n.indexes,l=(n.Blob||typeof Blob<"u"&&Blob)&&z.isSpecCompliantForm(t);if(!z.isFunction(s))throw new TypeError("visitor must be a function");function c(m){if(m===null)return"";if(z.isDate(m))return m.toISOString();if(z.isBoolean(m))return m.toString();if(!l&&z.isBlob(m))throw new ze("Blob is not supported. Use a Buffer instead.");return z.isArrayBuffer(m)||z.isTypedArray(m)?l&&typeof Blob=="function"?new Blob([m]):Buffer.from(m):m}function u(m,g,b){let y=m;if(m&&!b&&typeof m=="object"){if(z.endsWith(g,"{}"))g=r?g:g.slice(0,-2),m=JSON.stringify(m);else if(z.isArray(m)&&yR(m)||(z.isFileList(m)||z.endsWith(g,"[]"))&&(y=z.toArray(m)))return g=C0(g),y.forEach(function(v,E){!(z.isUndefined(v)||v===null)&&t.append(o===!0?xb([g],E,i):o===null?g:g+"[]",c(v))}),!1}return Oh(m)?!0:(t.append(xb(b,g,i),c(m)),!1)}const d=[],f=Object.assign(xR,{defaultVisitor:u,convertValue:c,isVisitable:Oh});function p(m,g){if(!z.isUndefined(m)){if(d.indexOf(m)!==-1)throw Error("Circular reference detected in "+g.join("."));d.push(m),z.forEach(m,function(y,w){(!(z.isUndefined(y)||y===null)&&s.call(t,y,z.isString(w)?w.trim():w,g,f))===!0&&p(y,g?g.concat(w):[w])}),d.pop()}}if(!z.isObject(e))throw new TypeError("data must be an object");return p(e),t}function vb(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,function(r){return t[r]})}function mm(e,t){this._pairs=[],e&&Xu(e,this,t)}const N0=mm.prototype;N0.append=function(t,n){this._pairs.push([t,n])};N0.toString=function(t){const n=t?function(r){return t.call(this,r,vb)}:vb;return this._pairs.map(function(s){return n(s[0])+"="+n(s[1])},"").join("&")};function vR(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function _0(e,t,n){if(!t)return e;const r=n&&n.encode||vR;z.isFunction(n)&&(n={serialize:n});const s=n&&n.serialize;let i;if(s?i=s(t,n):i=z.isURLSearchParams(t)?t.toString():new mm(t,n).toString(r),i){const o=e.indexOf("#");o!==-1&&(e=e.slice(0,o)),e+=(e.indexOf("?")===-1?"?":"&")+i}return e}class wb{constructor(){this.handlers=[]}use(t,n,r){return this.handlers.push({fulfilled:t,rejected:n,synchronous:r?r.synchronous:!1,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){z.forEach(this.handlers,function(r){r!==null&&t(r)})}}const T0={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},wR=typeof URLSearchParams<"u"?URLSearchParams:mm,kR=typeof FormData<"u"?FormData:null,SR=typeof Blob<"u"?Blob:null,ER={isBrowser:!0,classes:{URLSearchParams:wR,FormData:kR,Blob:SR},protocols:["http","https","file","blob","url","data"]},gm=typeof window<"u"&&typeof document<"u",Ih=typeof navigator=="object"&&navigator||void 0,CR=gm&&(!Ih||["ReactNative","NativeScript","NS"].indexOf(Ih.product)<0),NR=typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope&&typeof self.importScripts=="function",_R=gm&&window.location.href||"http://localhost",TR=Object.freeze(Object.defineProperty({__proto__:null,hasBrowserEnv:gm,hasStandardBrowserEnv:CR,hasStandardBrowserWebWorkerEnv:NR,navigator:Ih,origin:_R},Symbol.toStringTag,{value:"Module"})),un={...TR,...ER};function AR(e,t){return Xu(e,new un.classes.URLSearchParams,{visitor:function(n,r,s,i){return un.isNode&&z.isBuffer(n)?(this.append(r,n.toString("base64")),!1):i.defaultVisitor.apply(this,arguments)},...t})}function MR(e){return z.matchAll(/\w+|\[(\w*)]/g,e).map(t=>t[0]==="[]"?"":t[1]||t[0])}function RR(e){const t={},n=Object.keys(e);let r;const s=n.length;let i;for(r=0;r<s;r++)i=n[r],t[i]=e[i];return t}function A0(e){function t(n,r,s,i){let o=n[i++];if(o==="__proto__")return!0;const a=Number.isFinite(+o),l=i>=n.length;return o=!o&&z.isArray(s)?s.length:o,l?(z.hasOwnProp(s,o)?s[o]=[s[o],r]:s[o]=r,!a):((!s[o]||!z.isObject(s[o]))&&(s[o]=[]),t(n,r,s[o],i)&&z.isArray(s[o])&&(s[o]=RR(s[o])),!a)}if(z.isFormData(e)&&z.isFunction(e.entries)){const n={};return z.forEachEntry(e,(r,s)=>{t(MR(r),s,n,0)}),n}return null}function OR(e,t,n){if(z.isString(e))try{return(t||JSON.parse)(e),z.trim(e)}catch(r){if(r.name!=="SyntaxError")throw r}return(n||JSON.stringify)(e)}const ll={transitional:T0,adapter:["xhr","http","fetch"],transformRequest:[function(t,n){const r=n.getContentType()||"",s=r.indexOf("application/json")>-1,i=z.isObject(t);if(i&&z.isHTMLForm(t)&&(t=new FormData(t)),z.isFormData(t))return s?JSON.stringify(A0(t)):t;if(z.isArrayBuffer(t)||z.isBuffer(t)||z.isStream(t)||z.isFile(t)||z.isBlob(t)||z.isReadableStream(t))return t;if(z.isArrayBufferView(t))return t.buffer;if(z.isURLSearchParams(t))return n.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return AR(t,this.formSerializer).toString();if((a=z.isFileList(t))||r.indexOf("multipart/form-data")>-1){const l=this.env&&this.env.FormData;return Xu(a?{"files[]":t}:t,l&&new l,this.formSerializer)}}return i||s?(n.setContentType("application/json",!1),OR(t)):t}],transformResponse:[function(t){const n=this.transitional||ll.transitional,r=n&&n.forcedJSONParsing,s=this.responseType==="json";if(z.isResponse(t)||z.isReadableStream(t))return t;if(t&&z.isString(t)&&(r&&!this.responseType||s)){const o=!(n&&n.silentJSONParsing)&&s;try{return JSON.parse(t,this.parseReviver)}catch(a){if(o)throw a.name==="SyntaxError"?ze.from(a,ze.ERR_BAD_RESPONSE,this,null,this.response):a}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:un.classes.FormData,Blob:un.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};z.forEach(["delete","get","head","post","put","patch"],e=>{ll.headers[e]={}});const IR=z.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),DR=e=>{const t={};let n,r,s;return e&&e.split(`
282
- `).forEach(function(o){s=o.indexOf(":"),n=o.substring(0,s).trim().toLowerCase(),r=o.substring(s+1).trim(),!(!n||t[n]&&IR[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},kb=Symbol("internals");function Ko(e){return e&&String(e).trim().toLowerCase()}function ac(e){return e===!1||e==null?e:z.isArray(e)?e.map(ac):String(e)}function LR(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}const PR=e=>/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim());function ef(e,t,n,r,s){if(z.isFunction(r))return r.call(this,t,n);if(s&&(t=n),!!z.isString(t)){if(z.isString(r))return t.indexOf(r)!==-1;if(z.isRegExp(r))return r.test(t)}}function jR(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function zR(e,t){const n=z.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(s,i,o){return this[r].call(this,t,s,i,o)},configurable:!0})})}let In=class{constructor(t){t&&this.set(t)}set(t,n,r){const s=this;function i(a,l,c){const u=Ko(l);if(!u)throw new Error("header name must be a non-empty string");const d=z.findKey(s,u);(!d||s[d]===void 0||c===!0||c===void 0&&s[d]!==!1)&&(s[d||l]=ac(a))}const o=(a,l)=>z.forEach(a,(c,u)=>i(c,u,l));if(z.isPlainObject(t)||t instanceof this.constructor)o(t,n);else if(z.isString(t)&&(t=t.trim())&&!PR(t))o(DR(t),n);else if(z.isObject(t)&&z.isIterable(t)){let a={},l,c;for(const u of t){if(!z.isArray(u))throw TypeError("Object iterator must return a key-value pair");a[c=u[0]]=(l=a[c])?z.isArray(l)?[...l,u[1]]:[l,u[1]]:u[1]}o(a,n)}else t!=null&&i(n,t,r);return this}get(t,n){if(t=Ko(t),t){const r=z.findKey(this,t);if(r){const s=this[r];if(!n)return s;if(n===!0)return LR(s);if(z.isFunction(n))return n.call(this,s,r);if(z.isRegExp(n))return n.exec(s);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=Ko(t),t){const r=z.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||ef(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let s=!1;function i(o){if(o=Ko(o),o){const a=z.findKey(r,o);a&&(!n||ef(r,r[a],a,n))&&(delete r[a],s=!0)}}return z.isArray(t)?t.forEach(i):i(t),s}clear(t){const n=Object.keys(this);let r=n.length,s=!1;for(;r--;){const i=n[r];(!t||ef(this,this[i],i,t,!0))&&(delete this[i],s=!0)}return s}normalize(t){const n=this,r={};return z.forEach(this,(s,i)=>{const o=z.findKey(r,i);if(o){n[o]=ac(s),delete n[i];return}const a=t?jR(i):String(i).trim();a!==i&&delete n[i],n[a]=ac(s),r[a]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return z.forEach(this,(r,s)=>{r!=null&&r!==!1&&(n[s]=t&&z.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(`
283
- `)}getSetCookie(){return this.get("set-cookie")||[]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(s=>r.set(s)),r}static accessor(t){const r=(this[kb]=this[kb]={accessors:{}}).accessors,s=this.prototype;function i(o){const a=Ko(o);r[a]||(zR(s,o),r[a]=!0)}return z.isArray(t)?t.forEach(i):i(t),this}};In.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);z.reduceDescriptors(In.prototype,({value:e},t)=>{let n=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(r){this[n]=r}}});z.freezeMethods(In);function tf(e,t){const n=this||ll,r=t||n,s=In.from(r.headers);let i=r.data;return z.forEach(e,function(a){i=a.call(n,i,s.normalize(),t?t.status:void 0)}),s.normalize(),i}function M0(e){return!!(e&&e.__CANCEL__)}function Po(e,t,n){ze.call(this,e??"canceled",ze.ERR_CANCELED,t,n),this.name="CanceledError"}z.inherits(Po,ze,{__CANCEL__:!0});function R0(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new ze("Request failed with status code "+n.status,[ze.ERR_BAD_REQUEST,ze.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function FR(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function BR(e,t){e=e||10;const n=new Array(e),r=new Array(e);let s=0,i=0,o;return t=t!==void 0?t:1e3,function(l){const c=Date.now(),u=r[i];o||(o=c),n[s]=l,r[s]=c;let d=i,f=0;for(;d!==s;)f+=n[d++],d=d%e;if(s=(s+1)%e,s===i&&(i=(i+1)%e),c-o<t)return;const p=u&&c-u;return p?Math.round(f*1e3/p):void 0}}function $R(e,t){let n=0,r=1e3/t,s,i;const o=(c,u=Date.now())=>{n=u,s=null,i&&(clearTimeout(i),i=null),e(...c)};return[(...c)=>{const u=Date.now(),d=u-n;d>=r?o(c,u):(s=c,i||(i=setTimeout(()=>{i=null,o(s)},r-d)))},()=>s&&o(s)]}const kc=(e,t,n=3)=>{let r=0;const s=BR(50,250);return $R(i=>{const o=i.loaded,a=i.lengthComputable?i.total:void 0,l=o-r,c=s(l),u=o<=a;r=o;const d={loaded:o,total:a,progress:a?o/a:void 0,bytes:l,rate:c||void 0,estimated:c&&a&&u?(a-o)/c:void 0,event:i,lengthComputable:a!=null,[t?"download":"upload"]:!0};e(d)},n)},Sb=(e,t)=>{const n=e!=null;return[r=>t[0]({lengthComputable:n,total:e,loaded:r}),t[1]]},Eb=e=>(...t)=>z.asap(()=>e(...t)),UR=un.hasStandardBrowserEnv?((e,t)=>n=>(n=new URL(n,un.origin),e.protocol===n.protocol&&e.host===n.host&&(t||e.port===n.port)))(new URL(un.origin),un.navigator&&/(msie|trident)/i.test(un.navigator.userAgent)):()=>!0,HR=un.hasStandardBrowserEnv?{write(e,t,n,r,s,i){const o=[e+"="+encodeURIComponent(t)];z.isNumber(n)&&o.push("expires="+new Date(n).toGMTString()),z.isString(r)&&o.push("path="+r),z.isString(s)&&o.push("domain="+s),i===!0&&o.push("secure"),document.cookie=o.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function VR(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function qR(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}function O0(e,t,n){let r=!VR(t);return e&&(r||n==!1)?qR(e,t):t}const Cb=e=>e instanceof In?{...e}:e;function Ci(e,t){t=t||{};const n={};function r(c,u,d,f){return z.isPlainObject(c)&&z.isPlainObject(u)?z.merge.call({caseless:f},c,u):z.isPlainObject(u)?z.merge({},u):z.isArray(u)?u.slice():u}function s(c,u,d,f){if(z.isUndefined(u)){if(!z.isUndefined(c))return r(void 0,c,d,f)}else return r(c,u,d,f)}function i(c,u){if(!z.isUndefined(u))return r(void 0,u)}function o(c,u){if(z.isUndefined(u)){if(!z.isUndefined(c))return r(void 0,c)}else return r(void 0,u)}function a(c,u,d){if(d in t)return r(c,u);if(d in e)return r(void 0,c)}const l={url:i,method:i,data:i,baseURL:o,transformRequest:o,transformResponse:o,paramsSerializer:o,timeout:o,timeoutMessage:o,withCredentials:o,withXSRFToken:o,adapter:o,responseType:o,xsrfCookieName:o,xsrfHeaderName:o,onUploadProgress:o,onDownloadProgress:o,decompress:o,maxContentLength:o,maxBodyLength:o,beforeRedirect:o,transport:o,httpAgent:o,httpsAgent:o,cancelToken:o,socketPath:o,responseEncoding:o,validateStatus:a,headers:(c,u,d)=>s(Cb(c),Cb(u),d,!0)};return z.forEach(Object.keys({...e,...t}),function(u){const d=l[u]||s,f=d(e[u],t[u],u);z.isUndefined(f)&&d!==a||(n[u]=f)}),n}const I0=e=>{const t=Ci({},e);let{data:n,withXSRFToken:r,xsrfHeaderName:s,xsrfCookieName:i,headers:o,auth:a}=t;if(t.headers=o=In.from(o),t.url=_0(O0(t.baseURL,t.url,t.allowAbsoluteUrls),e.params,e.paramsSerializer),a&&o.set("Authorization","Basic "+btoa((a.username||"")+":"+(a.password?unescape(encodeURIComponent(a.password)):""))),z.isFormData(n)){if(un.hasStandardBrowserEnv||un.hasStandardBrowserWebWorkerEnv)o.setContentType(void 0);else if(z.isFunction(n.getHeaders)){const l=n.getHeaders(),c=["content-type","content-length"];Object.entries(l).forEach(([u,d])=>{c.includes(u.toLowerCase())&&o.set(u,d)})}}if(un.hasStandardBrowserEnv&&(r&&z.isFunction(r)&&(r=r(t)),r||r!==!1&&UR(t.url))){const l=s&&i&&HR.read(i);l&&o.set(s,l)}return t},WR=typeof XMLHttpRequest<"u",KR=WR&&function(e){return new Promise(function(n,r){const s=I0(e);let i=s.data;const o=In.from(s.headers).normalize();let{responseType:a,onUploadProgress:l,onDownloadProgress:c}=s,u,d,f,p,m;function g(){p&&p(),m&&m(),s.cancelToken&&s.cancelToken.unsubscribe(u),s.signal&&s.signal.removeEventListener("abort",u)}let b=new XMLHttpRequest;b.open(s.method.toUpperCase(),s.url,!0),b.timeout=s.timeout;function y(){if(!b)return;const v=In.from("getAllResponseHeaders"in b&&b.getAllResponseHeaders()),N={data:!a||a==="text"||a==="json"?b.responseText:b.response,status:b.status,statusText:b.statusText,headers:v,config:e,request:b};R0(function(C){n(C),g()},function(C){r(C),g()},N),b=null}"onloadend"in b?b.onloadend=y:b.onreadystatechange=function(){!b||b.readyState!==4||b.status===0&&!(b.responseURL&&b.responseURL.indexOf("file:")===0)||setTimeout(y)},b.onabort=function(){b&&(r(new ze("Request aborted",ze.ECONNABORTED,e,b)),b=null)},b.onerror=function(E){const N=E&&E.message?E.message:"Network Error",k=new ze(N,ze.ERR_NETWORK,e,b);k.event=E||null,r(k),b=null},b.ontimeout=function(){let E=s.timeout?"timeout of "+s.timeout+"ms exceeded":"timeout exceeded";const N=s.transitional||T0;s.timeoutErrorMessage&&(E=s.timeoutErrorMessage),r(new ze(E,N.clarifyTimeoutError?ze.ETIMEDOUT:ze.ECONNABORTED,e,b)),b=null},i===void 0&&o.setContentType(null),"setRequestHeader"in b&&z.forEach(o.toJSON(),function(E,N){b.setRequestHeader(N,E)}),z.isUndefined(s.withCredentials)||(b.withCredentials=!!s.withCredentials),a&&a!=="json"&&(b.responseType=s.responseType),c&&([f,m]=kc(c,!0),b.addEventListener("progress",f)),l&&b.upload&&([d,p]=kc(l),b.upload.addEventListener("progress",d),b.upload.addEventListener("loadend",p)),(s.cancelToken||s.signal)&&(u=v=>{b&&(r(!v||v.type?new Po(null,e,b):v),b.abort(),b=null)},s.cancelToken&&s.cancelToken.subscribe(u),s.signal&&(s.signal.aborted?u():s.signal.addEventListener("abort",u)));const w=FR(s.url);if(w&&un.protocols.indexOf(w)===-1){r(new ze("Unsupported protocol "+w+":",ze.ERR_BAD_REQUEST,e));return}b.send(i||null)})},GR=(e,t)=>{const{length:n}=e=e?e.filter(Boolean):[];if(t||n){let r=new AbortController,s;const i=function(c){if(!s){s=!0,a();const u=c instanceof Error?c:this.reason;r.abort(u instanceof ze?u:new Po(u instanceof Error?u.message:u))}};let o=t&&setTimeout(()=>{o=null,i(new ze(`timeout ${t} of ms exceeded`,ze.ETIMEDOUT))},t);const a=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach(c=>{c.unsubscribe?c.unsubscribe(i):c.removeEventListener("abort",i)}),e=null)};e.forEach(c=>c.addEventListener("abort",i));const{signal:l}=r;return l.unsubscribe=()=>z.asap(a),l}},JR=function*(e,t){let n=e.byteLength;if(n<t){yield e;return}let r=0,s;for(;r<n;)s=r+t,yield e.slice(r,s),r=s},ZR=async function*(e,t){for await(const n of YR(e))yield*JR(n,t)},YR=async function*(e){if(e[Symbol.asyncIterator]){yield*e;return}const t=e.getReader();try{for(;;){const{done:n,value:r}=await t.read();if(n)break;yield r}}finally{await t.cancel()}},Nb=(e,t,n,r)=>{const s=ZR(e,t);let i=0,o,a=l=>{o||(o=!0,r&&r(l))};return new ReadableStream({async pull(l){try{const{done:c,value:u}=await s.next();if(c){a(),l.close();return}let d=u.byteLength;if(n){let f=i+=d;n(f)}l.enqueue(new Uint8Array(u))}catch(c){throw a(c),c}},cancel(l){return a(l),s.return()}},{highWaterMark:2})},_b=64*1024,{isFunction:Rl}=z,XR=(({Request:e,Response:t})=>({Request:e,Response:t}))(z.global),{ReadableStream:Tb,TextEncoder:Ab}=z.global,Mb=(e,...t)=>{try{return!!e(...t)}catch{return!1}},QR=e=>{e=z.merge.call({skipUndefined:!0},XR,e);const{fetch:t,Request:n,Response:r}=e,s=t?Rl(t):typeof fetch=="function",i=Rl(n),o=Rl(r);if(!s)return!1;const a=s&&Rl(Tb),l=s&&(typeof Ab=="function"?(m=>g=>m.encode(g))(new Ab):async m=>new Uint8Array(await new n(m).arrayBuffer())),c=i&&a&&Mb(()=>{let m=!1;const g=new n(un.origin,{body:new Tb,method:"POST",get duplex(){return m=!0,"half"}}).headers.has("Content-Type");return m&&!g}),u=o&&a&&Mb(()=>z.isReadableStream(new r("").body)),d={stream:u&&(m=>m.body)};s&&["text","arrayBuffer","blob","formData","stream"].forEach(m=>{!d[m]&&(d[m]=(g,b)=>{let y=g&&g[m];if(y)return y.call(g);throw new ze(`Response type '${m}' is not supported`,ze.ERR_NOT_SUPPORT,b)})});const f=async m=>{if(m==null)return 0;if(z.isBlob(m))return m.size;if(z.isSpecCompliantForm(m))return(await new n(un.origin,{method:"POST",body:m}).arrayBuffer()).byteLength;if(z.isArrayBufferView(m)||z.isArrayBuffer(m))return m.byteLength;if(z.isURLSearchParams(m)&&(m=m+""),z.isString(m))return(await l(m)).byteLength},p=async(m,g)=>{const b=z.toFiniteNumber(m.getContentLength());return b??f(g)};return async m=>{let{url:g,method:b,data:y,signal:w,cancelToken:v,timeout:E,onDownloadProgress:N,onUploadProgress:k,responseType:C,headers:A,withCredentials:R="same-origin",fetchOptions:T}=I0(m),I=t||fetch;C=C?(C+"").toLowerCase():"text";let O=GR([w,v&&v.toAbortSignal()],E),j=null;const L=O&&O.unsubscribe&&(()=>{O.unsubscribe()});let F;try{if(k&&c&&b!=="get"&&b!=="head"&&(F=await p(A,y))!==0){let ae=new n(g,{method:"POST",body:y,duplex:"half"}),me;if(z.isFormData(y)&&(me=ae.headers.get("content-type"))&&A.setContentType(me),ae.body){const[S,B]=Sb(F,kc(Eb(k)));y=Nb(ae.body,_b,S,B)}}z.isString(R)||(R=R?"include":"omit");const q=i&&"credentials"in n.prototype,te={...T,signal:O,method:b.toUpperCase(),headers:A.normalize().toJSON(),body:y,duplex:"half",credentials:q?R:void 0};j=i&&new n(g,te);let K=await(i?I(j,T):I(g,te));const le=u&&(C==="stream"||C==="response");if(u&&(N||le&&L)){const ae={};["status","statusText","headers"].forEach($=>{ae[$]=K[$]});const me=z.toFiniteNumber(K.headers.get("content-length")),[S,B]=N&&Sb(me,kc(Eb(N),!0))||[];K=new r(Nb(K.body,_b,S,()=>{B&&B(),L&&L()}),ae)}C=C||"text";let _=await d[z.findKey(d,C)||"text"](K,m);return!le&&L&&L(),await new Promise((ae,me)=>{R0(ae,me,{data:_,headers:In.from(K.headers),status:K.status,statusText:K.statusText,config:m,request:j})})}catch(q){throw L&&L(),q&&q.name==="TypeError"&&/Load failed|fetch/i.test(q.message)?Object.assign(new ze("Network Error",ze.ERR_NETWORK,m,j),{cause:q.cause||q}):ze.from(q,q&&q.code,m,j)}}},eO=new Map,D0=e=>{let t=e?e.env:{};const{fetch:n,Request:r,Response:s}=t,i=[r,s,n];let o=i.length,a=o,l,c,u=eO;for(;a--;)l=i[a],c=u.get(l),c===void 0&&u.set(l,c=a?new Map:QR(t)),u=c;return c};D0();const Dh={http:bR,xhr:KR,fetch:{get:D0}};z.forEach(Dh,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Rb=e=>`- ${e}`,tO=e=>z.isFunction(e)||e===null||e===!1,L0={getAdapter:(e,t)=>{e=z.isArray(e)?e:[e];const{length:n}=e;let r,s;const i={};for(let o=0;o<n;o++){r=e[o];let a;if(s=r,!tO(r)&&(s=Dh[(a=String(r)).toLowerCase()],s===void 0))throw new ze(`Unknown adapter '${a}'`);if(s&&(z.isFunction(s)||(s=s.get(t))))break;i[a||"#"+o]=s}if(!s){const o=Object.entries(i).map(([l,c])=>`adapter ${l} `+(c===!1?"is not supported by the environment":"is not available in the build"));let a=n?o.length>1?`since :
284
- `+o.map(Rb).join(`
285
- `):" "+Rb(o[0]):"as no adapter specified";throw new ze("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return s},adapters:Dh};function nf(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Po(null,e)}function Ob(e){return nf(e),e.headers=In.from(e.headers),e.data=tf.call(e,e.transformRequest),["post","put","patch"].indexOf(e.method)!==-1&&e.headers.setContentType("application/x-www-form-urlencoded",!1),L0.getAdapter(e.adapter||ll.adapter,e)(e).then(function(r){return nf(e),r.data=tf.call(e,e.transformResponse,r),r.headers=In.from(r.headers),r},function(r){return M0(r)||(nf(e),r&&r.response&&(r.response.data=tf.call(e,e.transformResponse,r.response),r.response.headers=In.from(r.response.headers))),Promise.reject(r)})}const P0="1.12.2",Qu={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Qu[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Ib={};Qu.transitional=function(t,n,r){function s(i,o){return"[Axios v"+P0+"] Transitional option '"+i+"'"+o+(r?". "+r:"")}return(i,o,a)=>{if(t===!1)throw new ze(s(o," has been removed"+(n?" in "+n:"")),ze.ERR_DEPRECATED);return n&&!Ib[o]&&(Ib[o]=!0,console.warn(s(o," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(i,o,a):!0}};Qu.spelling=function(t){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${t}`),!0)};function nO(e,t,n){if(typeof e!="object")throw new ze("options must be an object",ze.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let s=r.length;for(;s-- >0;){const i=r[s],o=t[i];if(o){const a=e[i],l=a===void 0||o(a,i,e);if(l!==!0)throw new ze("option "+i+" must be "+l,ze.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ze("Unknown option "+i,ze.ERR_BAD_OPTION)}}const lc={assertOptions:nO,validators:Qu},_r=lc.validators;let fi=class{constructor(t){this.defaults=t||{},this.interceptors={request:new wb,response:new wb}}async request(t,n){try{return await this._request(t,n)}catch(r){if(r instanceof Error){let s={};Error.captureStackTrace?Error.captureStackTrace(s):s=new Error;const i=s.stack?s.stack.replace(/^.+\n/,""):"";try{r.stack?i&&!String(r.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(r.stack+=`
286
- `+i):r.stack=i}catch{}}throw r}}_request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=Ci(this.defaults,n);const{transitional:r,paramsSerializer:s,headers:i}=n;r!==void 0&&lc.assertOptions(r,{silentJSONParsing:_r.transitional(_r.boolean),forcedJSONParsing:_r.transitional(_r.boolean),clarifyTimeoutError:_r.transitional(_r.boolean)},!1),s!=null&&(z.isFunction(s)?n.paramsSerializer={serialize:s}:lc.assertOptions(s,{encode:_r.function,serialize:_r.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),lc.assertOptions(n,{baseUrl:_r.spelling("baseURL"),withXsrfToken:_r.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let o=i&&z.merge(i.common,i[n.method]);i&&z.forEach(["delete","get","head","post","put","patch","common"],m=>{delete i[m]}),n.headers=In.concat(o,i);const a=[];let l=!0;this.interceptors.request.forEach(function(g){typeof g.runWhen=="function"&&g.runWhen(n)===!1||(l=l&&g.synchronous,a.unshift(g.fulfilled,g.rejected))});const c=[];this.interceptors.response.forEach(function(g){c.push(g.fulfilled,g.rejected)});let u,d=0,f;if(!l){const m=[Ob.bind(this),void 0];for(m.unshift(...a),m.push(...c),f=m.length,u=Promise.resolve(n);d<f;)u=u.then(m[d++],m[d++]);return u}f=a.length;let p=n;for(;d<f;){const m=a[d++],g=a[d++];try{p=m(p)}catch(b){g.call(this,b);break}}try{u=Ob.call(this,p)}catch(m){return Promise.reject(m)}for(d=0,f=c.length;d<f;)u=u.then(c[d++],c[d++]);return u}getUri(t){t=Ci(this.defaults,t);const n=O0(t.baseURL,t.url,t.allowAbsoluteUrls);return _0(n,t.params,t.paramsSerializer)}};z.forEach(["delete","get","head","options"],function(t){fi.prototype[t]=function(n,r){return this.request(Ci(r||{},{method:t,url:n,data:(r||{}).data}))}});z.forEach(["post","put","patch"],function(t){function n(r){return function(i,o,a){return this.request(Ci(a||{},{method:t,headers:r?{"Content-Type":"multipart/form-data"}:{},url:i,data:o}))}}fi.prototype[t]=n(),fi.prototype[t+"Form"]=n(!0)});let rO=class j0{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const r=this;this.promise.then(s=>{if(!r._listeners)return;let i=r._listeners.length;for(;i-- >0;)r._listeners[i](s);r._listeners=null}),this.promise.then=s=>{let i;const o=new Promise(a=>{r.subscribe(a),i=a}).then(s);return o.cancel=function(){r.unsubscribe(i)},o},t(function(i,o,a){r.reason||(r.reason=new Po(i,o,a),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=r=>{t.abort(r)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new j0(function(s){t=s}),cancel:t}}};function sO(e){return function(n){return e.apply(null,n)}}function iO(e){return z.isObject(e)&&e.isAxiosError===!0}const Lh={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(Lh).forEach(([e,t])=>{Lh[t]=e});function z0(e){const t=new fi(e),n=m0(fi.prototype.request,t);return z.extend(n,fi.prototype,t,{allOwnKeys:!0}),z.extend(n,t,null,{allOwnKeys:!0}),n.create=function(s){return z0(Ci(e,s))},n}const Dt=z0(ll);Dt.Axios=fi;Dt.CanceledError=Po;Dt.CancelToken=rO;Dt.isCancel=M0;Dt.VERSION=P0;Dt.toFormData=Xu;Dt.AxiosError=ze;Dt.Cancel=Dt.CanceledError;Dt.all=function(t){return Promise.all(t)};Dt.spread=sO;Dt.isAxiosError=iO;Dt.mergeConfig=Ci;Dt.AxiosHeaders=In;Dt.formToJSON=e=>A0(z.isHTMLForm(e)?new FormData(e):e);Dt.getAdapter=L0.getAdapter;Dt.HttpStatusCode=Lh;Dt.default=Dt;const{Axios:x7,AxiosError:v7,CanceledError:w7,isCancel:k7,CancelToken:S7,VERSION:E7,all:C7,Cancel:N7,isAxiosError:_7,spread:T7,toFormData:A7,AxiosHeaders:M7,HttpStatusCode:R7,formToJSON:O7,getAdapter:I7,mergeConfig:D7}=Dt;function oO({isOpen:e,onClose:t}){const{theme:n,setTheme:r}=YT(),[s,i]=x.useState(null),o=()=>{r(n==="dark"?"light":"dark")};return x.useEffect(()=>{e&&(async()=>{try{const l=await Dt.get("/api/version");i(l.data)}catch(l){console.error("Failed to fetch version information:",l)}})()},[e]),h.jsx(Bi,{open:e,onOpenChange:t,children:h.jsxs(qs,{className:"max-w-md",children:[h.jsx(Ws,{children:h.jsx(Ks,{children:"Settings"})}),h.jsxs("div",{className:"space-y-6 py-4",children:[h.jsxs("div",{className:"space-y-3",children:[h.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Appearance"}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-muted-foreground",children:"Theme"}),h.jsx("button",{onClick:o,className:Te("flex items-center gap-2 rounded-lg px-3 py-2 text-sm font-medium transition-colors","bg-accent text-foreground hover:bg-accent/80"),children:n==="dark"?h.jsxs(h.Fragment,{children:[h.jsx(NA,{className:"h-4 w-4"}),h.jsx("span",{children:"Light Mode"})]}):h.jsxs(h.Fragment,{children:[h.jsx(kA,{className:"h-4 w-4"}),h.jsx("span",{children:"Dark Mode"})]})})]})]}),h.jsxs("div",{className:"space-y-3",children:[h.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Version"}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-muted-foreground",children:"CLI"}),h.jsx("span",{className:"text-sm text-foreground font-mono",children:s?.cli??"Loading..."})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-muted-foreground",children:"Server"}),h.jsx("span",{className:"text-sm text-foreground font-mono",children:s?.server??"Loading..."})]}),h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"text-sm text-muted-foreground",children:"Frontend"}),h.jsx("span",{className:"text-sm text-foreground font-mono",children:s?.frontend??"Loading..."})]})]})]})]})]})})}function aO({isOpen:e,onClose:t}){const n=[{title:"Docs",description:"Learn how to use sudocode",url:"https://docs.sudocode.ai",icon:ss},{title:"GitHub Issues",description:"Report bugs or request features",url:"https://github.com/sudocode-ai/sudocode/issues",icon:cA},{title:"Discord Community",description:"Join our community for help and discussion",url:"https://discord.gg/T3kR4EzQ6V",icon:vA}];return h.jsx(Bi,{open:e,onOpenChange:t,children:h.jsxs(qs,{className:"max-w-md",children:[h.jsx(Ws,{children:h.jsx(Ks,{children:"Resources"})}),h.jsx("div",{className:"space-y-3 py-4",children:n.map(r=>{const s=r.icon;return h.jsxs("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",className:Te("flex items-start gap-3 rounded-lg border border-border p-4 transition-colors","hover:border-accent-foreground/20 hover:bg-accent"),children:[h.jsx(s,{className:"h-5 w-5 flex-shrink-0 text-muted-foreground"}),h.jsxs("div",{className:"min-w-0 flex-1",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h3",{className:"text-sm font-medium text-foreground",children:r.title}),h.jsx(lA,{className:"h-3 w-3 text-muted-foreground"})]}),h.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:r.description})]})]},r.url)})})]})})}function lO({open:e,collapsed:t,onClose:n}){const r=iT(),[s,i]=x.useState(!1),[o,a]=x.useState(!1),l=u=>r.pathname.startsWith(u),c=[{path:"/issues",label:"Issues",icon:bA},{path:"/specs",label:"Specs",icon:ss}];return h.jsxs(Ei,{delayDuration:300,children:[e&&h.jsx("div",{className:"fixed inset-0 z-40 bg-black/50 md:hidden",onClick:n,"aria-hidden":"true"}),h.jsxs("aside",{className:Te("fixed inset-y-0 left-0 z-50 flex flex-col border-r border-border bg-background transition-all duration-300 md:sticky md:top-0 md:z-30 md:h-screen md:translate-x-0",e?"translate-x-0":"-translate-x-full",t?"w-16":"w-64"),children:[h.jsx("div",{className:"hidden h-16 items-center justify-center md:flex",children:h.jsx("img",{src:"/logo.png",alt:"Logo",className:Te("h-10 w-10 rounded-md transition-all duration-300")})}),h.jsxs("div",{className:"flex h-16 items-center justify-between border-b border-border px-4 md:hidden",children:[h.jsx("img",{src:"/logo.png",alt:"Logo",className:"h-8 w-8 rounded-md"}),h.jsx("button",{onClick:n,className:"rounded-md p-2 text-muted-foreground hover:bg-accent hover:text-foreground","aria-label":"Close menu",children:h.jsx(da,{className:"h-5 w-5"})})]}),h.jsx("nav",{className:Te("flex-1 space-y-1 p-2",t?"px-2":"px-3"),children:c.map(u=>{const d=u.icon,f=l(u.path),p=h.jsxs(Qp,{to:u.path,onClick:n,className:Te("flex items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium transition-colors",f?"bg-primary text-primary-foreground":"text-muted-foreground hover:bg-accent hover:text-foreground",t&&"justify-center px-2"),children:[h.jsx(d,{className:"h-5 w-5 flex-shrink-0"+(f?" text-white":"")}),!t&&h.jsx("span",{children:u.label})]},u.path);return t?h.jsxs(rr,{children:[h.jsx(sr,{asChild:!0,children:p}),h.jsx(Un,{side:"right",children:u.label})]},u.path):p})}),h.jsx("div",{children:h.jsxs("div",{className:Te("space-y-1 p-2",t?"px-2":"px-3"),children:[t?h.jsxs(rr,{children:[h.jsx(sr,{asChild:!0,children:h.jsx("button",{onClick:()=>a(!0),className:Te("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",t&&"justify-center px-2"),"aria-label":"Help",children:h.jsx(hb,{className:"h-5 w-5 flex-shrink-0"})})}),h.jsx(Un,{side:"right",children:"Help"})]}):h.jsxs("button",{onClick:()=>a(!0),className:Te("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"),"aria-label":"Help",children:[h.jsx(hb,{className:"h-5 w-5 flex-shrink-0"}),h.jsx("span",{children:"Help"})]}),t?h.jsxs(rr,{children:[h.jsx(sr,{asChild:!0,children:h.jsx("button",{onClick:()=>i(!0),className:Te("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",t&&"justify-center px-2"),"aria-label":"Settings",children:h.jsx(pb,{className:"h-5 w-5 flex-shrink-0"})})}),h.jsx(Un,{side:"right",children:"Settings"})]}):h.jsxs("button",{onClick:()=>i(!0),className:Te("flex w-full items-center gap-3 rounded-lg px-3 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"),"aria-label":"Settings",children:[h.jsx(pb,{className:"h-5 w-5 flex-shrink-0"}),h.jsx("span",{children:"Settings"})]})]})})]}),h.jsx(aO,{isOpen:o,onClose:()=>a(!1)}),h.jsx(oO,{isOpen:s,onClose:()=>i(!1)})]})}function cO(){const[e,t]=x.useState(!1);return h.jsxs("div",{className:"flex h-screen overflow-hidden bg-background",children:[!e&&h.jsx("button",{onClick:()=>t(!0),className:"fixed left-4 top-4 z-40 inline-flex rounded-md bg-background p-2 text-muted-foreground shadow-lg ring-1 ring-border hover:bg-accent hover:text-foreground md:hidden","aria-label":"Toggle menu",children:h.jsx(xA,{className:"h-5 w-5"})}),h.jsx(lO,{open:e,collapsed:!0,onClose:()=>t(!1)}),h.jsx("main",{className:"flex-1 overflow-y-auto",children:h.jsx(oT,{})})]})}const cl=Dt.create({baseURL:"/api",timeout:3e4,headers:{"Content-Type":"application/json"}});cl.interceptors.response.use(e=>{const t=e.data;if(!t.success){const n=new Error(t.message||"API request failed");throw n.response={data:t.error_data,status:e.status},n}return t.data},e=>{if(console.error("API Error:",e),!e.response)throw new Error("Network error: Please check your connection");const t=e.response.status;throw t===404?new Error("Resource not found"):t===500?new Error("Server error: Please try again later"):e});const br=e=>cl.get(e),hi=(e,t)=>cl.post(e,t),bm=(e,t)=>cl.put(e,t),wo=(e,t)=>cl.delete(e,t?{data:t}:void 0),ro={getAll:e=>{const t=e!==void 0?`?archived=${e}`:"";return br(`/issues${t}`)},getById:e=>br(`/issues/${e}`),create:e=>hi("/issues",e),update:(e,t)=>bm(`/issues/${e}`,t),delete:e=>wo(`/issues/${e}`)},so={getAll:e=>{const t=e!==void 0?`?archived=${e}`:"";return br(`/specs${t}`)},getById:e=>br(`/specs/${e}`),create:e=>hi("/specs",e),update:(e,t)=>bm(`/specs/${e}`,t),delete:e=>wo(`/specs/${e}`),getFeedback:e=>br(`/feedback?spec_id=${e}`)},co={getForEntity:(e,t)=>br(`/relationships/${t}/${e}`),create:e=>hi("/relationships",e),delete:e=>wo("/relationships",e)},rf={getForSpec:e=>br(`/feedback?spec_id=${e}`),getById:e=>br(`/feedback/${e}`),create:e=>hi("/feedback",e),update:(e,t)=>bm(`/feedback/${e}`,t),delete:e=>wo(`/feedback/${e}`)},Xn={prepare:(e,t)=>hi(`/issues/${e}/executions/prepare`,t),create:(e,t)=>hi(`/issues/${e}/executions`,t),getById:e=>br(`/executions/${e}`),list:e=>br(`/issues/${e}/executions`),createFollowUp:(e,t)=>hi(`/executions/${e}/follow-up`,t),cancel:e=>wo(`/executions/${e}`),worktreeExists:e=>br(`/executions/${e}/worktree`),deleteWorktree:e=>wo(`/executions/${e}/worktree`)};function ed(e){const t=rs(),{connected:n,subscribe:r,unsubscribe:s,addMessageHandler:i,removeMessageHandler:o}=Uu(),a=nl({queryKey:e!==void 0?["issues",{archived:e}]:["issues"],queryFn:()=>ro.getAll(e)}),l=x.useCallback(m=>{(m.type==="issue_created"||m.type==="issue_updated"||m.type==="issue_deleted")&&t.invalidateQueries({queryKey:["issues"]})},[t]);x.useEffect(()=>{const m="useIssues";return i(m,l),n&&r("issue"),()=>{o(m),s("issue")}},[n,r,s,i,o,l]);const c=or({mutationFn:({id:m,data:g})=>ro.update(m,g),onMutate:async({id:m,data:g})=>{await t.cancelQueries({queryKey:["issues"]});const b=t.getQueryData(["issues"]);return t.setQueryData(["issues"],y=>y?.map(w=>w.id===m?{...w,...g}:w)),{previousIssues:b}},onError:(m,g,b)=>{b?.previousIssues&&t.setQueryData(["issues"],b.previousIssues)},onSettled:()=>{t.invalidateQueries({queryKey:["issues"]})}}),u=or({mutationFn:ro.create,onSuccess:()=>{t.invalidateQueries({queryKey:["issues"]})}}),d=or({mutationFn:ro.delete,onSuccess:()=>{t.invalidateQueries({queryKey:["issues"]})}}),f=m=>c.mutate({id:m,data:{archived:!0}}),p=m=>c.mutate({id:m,data:{archived:!1}});return{issues:a.data??[],isLoading:a.isLoading,isError:a.isError,error:a.error,updateIssue:c.mutate,updateIssueAsync:c.mutateAsync,createIssue:u.mutate,createIssueAsync:u.mutateAsync,deleteIssue:d.mutate,deleteIssueAsync:d.mutateAsync,archiveIssue:f,unarchiveIssue:p,isUpdating:c.isPending,isCreating:u.isPending,isDeleting:d.isPending}}function uO(e){return nl({queryKey:["issues",e],queryFn:()=>ro.getById(e),enabled:!!e})}function dO(){const e=rs();return or({mutationFn:({id:t,status:n})=>ro.update(t,{status:n}),onMutate:async({id:t,status:n})=>{await e.cancelQueries({queryKey:["issues"]});const r=e.getQueryData(["issues"]);return e.setQueryData(["issues"],s=>s?.map(i=>i.id===t?{...i,status:n}:i)),{previousIssues:r}},onError:(t,n,r)=>{r?.previousIssues&&e.setQueryData(["issues"],r.previousIssues)},onSettled:()=>{e.invalidateQueries({queryKey:["issues"]})}})}const It=x.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:Te("bg-card text-card-foreground",e),...t}));It.displayName="Card";const fO=x.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:Te("flex flex-col space-y-1.5 p-6",e),...t}));fO.displayName="CardHeader";const hO=x.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:Te("text-2xl font-semibold leading-none tracking-tight",e),...t}));hO.displayName="CardTitle";const pO=x.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:Te("text-sm text-muted-foreground",e),...t}));pO.displayName="CardDescription";const mO=x.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:Te("p-6 pt-0",e),...t}));mO.displayName="CardContent";const gO=x.forwardRef(({className:e,...t},n)=>h.jsx("div",{ref:n,className:Te("flex items-center p-6 pt-0",e),...t}));gO.displayName="CardFooter";const Db=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,Lb=Yw,F0=(e,t)=>n=>{var r;if(t?.variants==null)return Lb(e,n?.class,n?.className);const{variants:s,defaultVariants:i}=t,o=Object.keys(s).map(c=>{const u=n?.[c],d=i?.[c];if(u===null)return null;const f=Db(u)||Db(d);return s[c][f]}),a=n&&Object.entries(n).reduce((c,u)=>{let[d,f]=u;return f===void 0||(c[d]=f),c},{}),l=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,u)=>{let{class:d,className:f,...p}=u;return Object.entries(p).every(m=>{let[g,b]=m;return Array.isArray(b)?b.includes({...i,...a}[g]):{...i,...a}[g]===b})?[...c,d,f]:c},[]);return Lb(e,o,l,n?.class,n?.className)},bO=F0("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",issue:"border-blue-500/20 bg-blue-500/10 text-blue-600 dark:text-blue-400 hover:bg-blue-500/20",spec:"border-purple-500/20 bg-purple-500/10 text-purple-600 dark:text-purple-400 hover:bg-purple-500/20"}},defaultVariants:{variant:"default"}});function st({className:e,variant:t,...n}){return h.jsx("div",{className:Te(bO({variant:t}),e),...n})}const td=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function jo(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function ym(e){return"nodeType"in e}function Tn(e){var t,n;return e?jo(e)?e:ym(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function xm(e){const{Document:t}=Tn(e);return e instanceof t}function ul(e){return jo(e)?!1:e instanceof Tn(e).HTMLElement}function B0(e){return e instanceof Tn(e).SVGElement}function zo(e){return e?jo(e)?e.document:ym(e)?xm(e)?e:ul(e)||B0(e)?e.ownerDocument:document:document:document}const es=td?x.useLayoutEffect:x.useEffect;function nd(e){const t=x.useRef(e);return es(()=>{t.current=e}),x.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function yO(){const e=x.useRef(null),t=x.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=x.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Oa(e,t){t===void 0&&(t=[e]);const n=x.useRef(e);return es(()=>{n.current!==e&&(n.current=e)},t),n}function dl(e,t){const n=x.useRef();return x.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Sc(e){const t=nd(e),n=x.useRef(null),r=x.useCallback(s=>{s!==n.current&&t?.(s,n.current),n.current=s},[]);return[n,r]}function Ec(e){const t=x.useRef();return x.useEffect(()=>{t.current=e},[e]),t.current}let sf={};function rd(e,t){return x.useMemo(()=>{if(t)return t;const n=sf[e]==null?0:sf[e]+1;return sf[e]=n,e+"-"+n},[e,t])}function $0(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((i,o)=>{const a=Object.entries(o);for(const[l,c]of a){const u=i[l];u!=null&&(i[l]=u+e*c)}return i},{...t})}}const uo=$0(1),Cc=$0(-1);function xO(e){return"clientX"in e&&"clientY"in e}function vm(e){if(!e)return!1;const{KeyboardEvent:t}=Tn(e.target);return t&&e instanceof t}function vO(e){if(!e)return!1;const{TouchEvent:t}=Tn(e.target);return t&&e instanceof t}function Nc(e){if(vO(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return xO(e)?{x:e.clientX,y:e.clientY}:null}const Ia=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Ia.Translate.toString(e),Ia.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Pb="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function wO(e){return e.matches(Pb)?e:e.querySelector(Pb)}const kO={display:"none"};function SO(e){let{id:t,value:n}=e;return at.createElement("div",{id:t,style:kO},n)}function EO(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return at.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function CO(){const[e,t]=x.useState("");return{announce:x.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const U0=x.createContext(null);function NO(e){const t=x.useContext(U0);x.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function _O(){const[e]=x.useState(()=>new Set),t=x.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[x.useCallback(r=>{let{type:s,event:i}=r;e.forEach(o=>{var a;return(a=o[s])==null?void 0:a.call(o,i)})},[e]),t]}const TO={draggable:`
287
- To pick up a draggable item, press the space bar.
288
- While dragging, use the arrow keys to move the item.
289
- Press space again to drop the item in its new position, or press escape to cancel.
290
- `},AO={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function MO(e){let{announcements:t=AO,container:n,hiddenTextDescribedById:r,screenReaderInstructions:s=TO}=e;const{announce:i,announcement:o}=CO(),a=rd("DndLiveRegion"),[l,c]=x.useState(!1);if(x.useEffect(()=>{c(!0)},[]),NO(x.useMemo(()=>({onDragStart(d){let{active:f}=d;i(t.onDragStart({active:f}))},onDragMove(d){let{active:f,over:p}=d;t.onDragMove&&i(t.onDragMove({active:f,over:p}))},onDragOver(d){let{active:f,over:p}=d;i(t.onDragOver({active:f,over:p}))},onDragEnd(d){let{active:f,over:p}=d;i(t.onDragEnd({active:f,over:p}))},onDragCancel(d){let{active:f,over:p}=d;i(t.onDragCancel({active:f,over:p}))}}),[i,t])),!l)return null;const u=at.createElement(at.Fragment,null,at.createElement(SO,{id:r,value:s.draggable}),at.createElement(EO,{id:a,announcement:o}));return n?Ts.createPortal(u,n):u}var Vt;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(Vt||(Vt={}));function _c(){}function RO(e,t){return x.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function OO(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return x.useMemo(()=>[...t].filter(r=>r!=null),[...t])}const vr=Object.freeze({x:0,y:0});function IO(e,t){const n=Nc(e);if(!n)return"0 0";const r={x:(n.x-t.left)/t.width*100,y:(n.y-t.top)/t.height*100};return r.x+"% "+r.y+"%"}function DO(e,t){let{data:{value:n}}=e,{data:{value:r}}=t;return r-n}function LO(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function PO(e,t){const n=Math.max(t.top,e.top),r=Math.max(t.left,e.left),s=Math.min(t.left+t.width,e.left+e.width),i=Math.min(t.top+t.height,e.top+e.height),o=s-r,a=i-n;if(r<s&&n<i){const l=t.width*t.height,c=e.width*e.height,u=o*a,d=u/(l+c-u);return Number(d.toFixed(4))}return 0}const H0=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:r}=e;const s=[];for(const i of r){const{id:o}=i,a=n.get(o);if(a){const l=PO(a,t);l>0&&s.push({id:o,data:{droppableContainer:i,value:l}})}}return s.sort(DO)};function jO(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function V0(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:vr}function zO(e){return function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];return s.reduce((o,a)=>({...o,top:o.top+e*a.y,bottom:o.bottom+e*a.y,left:o.left+e*a.x,right:o.right+e*a.x}),{...n})}}const FO=zO(1);function q0(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function BO(e,t,n){const r=q0(t);if(!r)return e;const{scaleX:s,scaleY:i,x:o,y:a}=r,l=e.left-o-(1-s)*parseFloat(n),c=e.top-a-(1-i)*parseFloat(n.slice(n.indexOf(" ")+1)),u=s?e.width/s:e.width,d=i?e.height/i:e.height;return{width:u,height:d,top:c,right:l+u,bottom:c+d,left:l}}const $O={ignoreTransform:!1};function fl(e,t){t===void 0&&(t=$O);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:c,transformOrigin:u}=Tn(e).getComputedStyle(e);c&&(n=BO(n,c,u))}const{top:r,left:s,width:i,height:o,bottom:a,right:l}=n;return{top:r,left:s,width:i,height:o,bottom:a,right:l}}function jb(e){return fl(e,{ignoreTransform:!0})}function UO(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function HO(e,t){return t===void 0&&(t=Tn(e).getComputedStyle(e)),t.position==="fixed"}function VO(e,t){t===void 0&&(t=Tn(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(s=>{const i=t[s];return typeof i=="string"?n.test(i):!1})}function wm(e,t){const n=[];function r(s){if(t!=null&&n.length>=t||!s)return n;if(xm(s)&&s.scrollingElement!=null&&!n.includes(s.scrollingElement))return n.push(s.scrollingElement),n;if(!ul(s)||B0(s)||n.includes(s))return n;const i=Tn(e).getComputedStyle(s);return s!==e&&VO(s,i)&&n.push(s),HO(s,i)?n:r(s.parentNode)}return e?r(e):n}function W0(e){const[t]=wm(e,1);return t??null}function of(e){return!td||!e?null:jo(e)?e:ym(e)?xm(e)||e===zo(e).scrollingElement?window:ul(e)?e:null:null}function K0(e){return jo(e)?e.scrollX:e.scrollLeft}function G0(e){return jo(e)?e.scrollY:e.scrollTop}function Ph(e){return{x:K0(e),y:G0(e)}}var Zt;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Zt||(Zt={}));function J0(e){return!td||!e?!1:e===document.scrollingElement}function Z0(e){const t={x:0,y:0},n=J0(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},r={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},s=e.scrollTop<=t.y,i=e.scrollLeft<=t.x,o=e.scrollTop>=r.y,a=e.scrollLeft>=r.x;return{isTop:s,isLeft:i,isBottom:o,isRight:a,maxScroll:r,minScroll:t}}const qO={x:.2,y:.2};function WO(e,t,n,r,s){let{top:i,left:o,right:a,bottom:l}=n;r===void 0&&(r=10),s===void 0&&(s=qO);const{isTop:c,isBottom:u,isLeft:d,isRight:f}=Z0(e),p={x:0,y:0},m={x:0,y:0},g={height:t.height*s.y,width:t.width*s.x};return!c&&i<=t.top+g.height?(p.y=Zt.Backward,m.y=r*Math.abs((t.top+g.height-i)/g.height)):!u&&l>=t.bottom-g.height&&(p.y=Zt.Forward,m.y=r*Math.abs((t.bottom-g.height-l)/g.height)),!f&&a>=t.right-g.width?(p.x=Zt.Forward,m.x=r*Math.abs((t.right-g.width-a)/g.width)):!d&&o<=t.left+g.width&&(p.x=Zt.Backward,m.x=r*Math.abs((t.left+g.width-o)/g.width)),{direction:p,speed:m}}function KO(e){if(e===document.scrollingElement){const{innerWidth:i,innerHeight:o}=window;return{top:0,left:0,right:i,bottom:o,width:i,height:o}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function Y0(e){return e.reduce((t,n)=>uo(t,Ph(n)),vr)}function GO(e){return e.reduce((t,n)=>t+K0(n),0)}function JO(e){return e.reduce((t,n)=>t+G0(n),0)}function X0(e,t){if(t===void 0&&(t=fl),!e)return;const{top:n,left:r,bottom:s,right:i}=t(e);W0(e)&&(s<=0||i<=0||n>=window.innerHeight||r>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const ZO=[["x",["left","right"],GO],["y",["top","bottom"],JO]];class km{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const r=wm(n),s=Y0(r);this.rect={...t},this.width=t.width,this.height=t.height;for(const[i,o,a]of ZO)for(const l of o)Object.defineProperty(this,l,{get:()=>{const c=a(r),u=s[i]-c;return this.rect[l]+u},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class fa{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})},this.target=t}add(t,n,r){var s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function YO(e){const{EventTarget:t}=Tn(e);return e instanceof t?e:zo(e)}function af(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var er;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(er||(er={}));function zb(e){e.preventDefault()}function XO(e){e.stopPropagation()}var dt;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(dt||(dt={}));const Q0={start:[dt.Space,dt.Enter],cancel:[dt.Esc],end:[dt.Space,dt.Enter,dt.Tab]},QO=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case dt.Right:return{...n,x:n.x+25};case dt.Left:return{...n,x:n.x-25};case dt.Down:return{...n,y:n.y+25};case dt.Up:return{...n,y:n.y-25}}};class ek{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new fa(zo(n)),this.windowListeners=new fa(Tn(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(er.Resize,this.handleCancel),this.windowListeners.add(er.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(er.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,r=t.node.current;r&&X0(r),n(vr)}handleKeyDown(t){if(vm(t)){const{active:n,context:r,options:s}=this.props,{keyboardCodes:i=Q0,coordinateGetter:o=QO,scrollBehavior:a="smooth"}=s,{code:l}=t;if(i.end.includes(l)){this.handleEnd(t);return}if(i.cancel.includes(l)){this.handleCancel(t);return}const{collisionRect:c}=r.current,u=c?{x:c.left,y:c.top}:vr;this.referenceCoordinates||(this.referenceCoordinates=u);const d=o(t,{active:n,context:r.current,currentCoordinates:u});if(d){const f=Cc(d,u),p={x:0,y:0},{scrollableAncestors:m}=r.current;for(const g of m){const b=t.code,{isTop:y,isRight:w,isLeft:v,isBottom:E,maxScroll:N,minScroll:k}=Z0(g),C=KO(g),A={x:Math.min(b===dt.Right?C.right-C.width/2:C.right,Math.max(b===dt.Right?C.left:C.left+C.width/2,d.x)),y:Math.min(b===dt.Down?C.bottom-C.height/2:C.bottom,Math.max(b===dt.Down?C.top:C.top+C.height/2,d.y))},R=b===dt.Right&&!w||b===dt.Left&&!v,T=b===dt.Down&&!E||b===dt.Up&&!y;if(R&&A.x!==d.x){const I=g.scrollLeft+f.x,O=b===dt.Right&&I<=N.x||b===dt.Left&&I>=k.x;if(O&&!f.y){g.scrollTo({left:I,behavior:a});return}O?p.x=g.scrollLeft-I:p.x=b===dt.Right?g.scrollLeft-N.x:g.scrollLeft-k.x,p.x&&g.scrollBy({left:-p.x,behavior:a});break}else if(T&&A.y!==d.y){const I=g.scrollTop+f.y,O=b===dt.Down&&I<=N.y||b===dt.Up&&I>=k.y;if(O&&!f.x){g.scrollTo({top:I,behavior:a});return}O?p.y=g.scrollTop-I:p.y=b===dt.Down?g.scrollTop-N.y:g.scrollTop-k.y,p.y&&g.scrollBy({top:-p.y,behavior:a});break}}this.handleMove(t,uo(Cc(d,this.referenceCoordinates),p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}ek.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:r=Q0,onActivation:s}=t,{active:i}=n;const{code:o}=e.nativeEvent;if(r.start.includes(o)){const a=i.activatorNode.current;return a&&e.target!==a?!1:(e.preventDefault(),s?.({event:e.nativeEvent}),!0)}return!1}}];function Fb(e){return!!(e&&"distance"in e)}function Bb(e){return!!(e&&"delay"in e)}class Sm{constructor(t,n,r){var s;r===void 0&&(r=YO(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:i}=t,{target:o}=i;this.props=t,this.events=n,this.document=zo(o),this.documentListeners=new fa(this.document),this.listeners=new fa(r),this.windowListeners=new fa(Tn(o)),this.initialCoordinates=(s=Nc(i))!=null?s:vr,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:r}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(er.Resize,this.handleCancel),this.windowListeners.add(er.DragStart,zb),this.windowListeners.add(er.VisibilityChange,this.handleCancel),this.windowListeners.add(er.ContextMenu,zb),this.documentListeners.add(er.Keydown,this.handleKeydown),n){if(r!=null&&r({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(Bb(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(Fb(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:r,onPending:s}=this.props;s(r,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(er.Click,XO,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(er.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:r,initialCoordinates:s,props:i}=this,{onMove:o,options:{activationConstraint:a}}=i;if(!s)return;const l=(n=Nc(t))!=null?n:vr,c=Cc(s,l);if(!r&&a){if(Fb(a)){if(a.tolerance!=null&&af(c,a.tolerance))return this.handleCancel();if(af(c,a.distance))return this.handleStart()}if(Bb(a)&&af(c,a.tolerance))return this.handleCancel();this.handlePending(a,c);return}t.cancelable&&t.preventDefault(),o(l)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===dt.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const eI={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class Em extends Sm{constructor(t){const{event:n}=t,r=zo(n.target);super(t,eI,r)}}Em.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return!n.isPrimary||n.button!==0?!1:(r?.({event:n}),!0)}}];const tI={move:{name:"mousemove"},end:{name:"mouseup"}};var jh;(function(e){e[e.RightClick=2]="RightClick"})(jh||(jh={}));class nI extends Sm{constructor(t){super(t,tI,zo(t.event.target))}}nI.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;return n.button===jh.RightClick?!1:(r?.({event:n}),!0)}}];const lf={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class rI extends Sm{constructor(t){super(t,lf)}static setup(){return window.addEventListener(lf.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(lf.move.name,t)};function t(){}}}rI.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:r}=t;const{touches:s}=n;return s.length>1?!1:(r?.({event:n}),!0)}}];var ha;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ha||(ha={}));var Tc;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Tc||(Tc={}));function sI(e){let{acceleration:t,activator:n=ha.Pointer,canScroll:r,draggingRect:s,enabled:i,interval:o=5,order:a=Tc.TreeOrder,pointerCoordinates:l,scrollableAncestors:c,scrollableAncestorRects:u,delta:d,threshold:f}=e;const p=oI({delta:d,disabled:!i}),[m,g]=yO(),b=x.useRef({x:0,y:0}),y=x.useRef({x:0,y:0}),w=x.useMemo(()=>{switch(n){case ha.Pointer:return l?{top:l.y,bottom:l.y,left:l.x,right:l.x}:null;case ha.DraggableRect:return s}},[n,s,l]),v=x.useRef(null),E=x.useCallback(()=>{const k=v.current;if(!k)return;const C=b.current.x*y.current.x,A=b.current.y*y.current.y;k.scrollBy(C,A)},[]),N=x.useMemo(()=>a===Tc.TreeOrder?[...c].reverse():c,[a,c]);x.useEffect(()=>{if(!i||!c.length||!w){g();return}for(const k of N){if(r?.(k)===!1)continue;const C=c.indexOf(k),A=u[C];if(!A)continue;const{direction:R,speed:T}=WO(k,A,w,t,f);for(const I of["x","y"])p[I][R[I]]||(T[I]=0,R[I]=0);if(T.x>0||T.y>0){g(),v.current=k,m(E,o),b.current=T,y.current=R;return}}b.current={x:0,y:0},y.current={x:0,y:0},g()},[t,E,r,g,i,o,JSON.stringify(w),JSON.stringify(p),m,c,N,u,JSON.stringify(f)])}const iI={x:{[Zt.Backward]:!1,[Zt.Forward]:!1},y:{[Zt.Backward]:!1,[Zt.Forward]:!1}};function oI(e){let{delta:t,disabled:n}=e;const r=Ec(t);return dl(s=>{if(n||!r||!s)return iI;const i={x:Math.sign(t.x-r.x),y:Math.sign(t.y-r.y)};return{x:{[Zt.Backward]:s.x[Zt.Backward]||i.x===-1,[Zt.Forward]:s.x[Zt.Forward]||i.x===1},y:{[Zt.Backward]:s.y[Zt.Backward]||i.y===-1,[Zt.Forward]:s.y[Zt.Forward]||i.y===1}}},[n,t,r])}function aI(e,t){const n=t!=null?e.get(t):void 0,r=n?n.node.current:null;return dl(s=>{var i;return t==null?null:(i=r??s)!=null?i:null},[r,t])}function lI(e,t){return x.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,i=s.activators.map(o=>({eventName:o.eventName,handler:t(o.handler,r)}));return[...n,...i]},[]),[e,t])}var Da;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Da||(Da={}));var zh;(function(e){e.Optimized="optimized"})(zh||(zh={}));const $b=new Map;function cI(e,t){let{dragging:n,dependencies:r,config:s}=t;const[i,o]=x.useState(null),{frequency:a,measure:l,strategy:c}=s,u=x.useRef(e),d=b(),f=Oa(d),p=x.useCallback(function(y){y===void 0&&(y=[]),!f.current&&o(w=>w===null?y:w.concat(y.filter(v=>!w.includes(v))))},[f]),m=x.useRef(null),g=dl(y=>{if(d&&!n)return $b;if(!y||y===$b||u.current!==e||i!=null){const w=new Map;for(let v of e){if(!v)continue;if(i&&i.length>0&&!i.includes(v.id)&&v.rect.current){w.set(v.id,v.rect.current);continue}const E=v.node.current,N=E?new km(l(E),E):null;v.rect.current=N,N&&w.set(v.id,N)}return w}return y},[e,i,n,d,l]);return x.useEffect(()=>{u.current=e},[e]),x.useEffect(()=>{d||p()},[n,d]),x.useEffect(()=>{i&&i.length>0&&o(null)},[JSON.stringify(i)]),x.useEffect(()=>{d||typeof a!="number"||m.current!==null||(m.current=setTimeout(()=>{p(),m.current=null},a))},[a,d,p,...r]),{droppableRects:g,measureDroppableContainers:p,measuringScheduled:i!=null};function b(){switch(c){case Da.Always:return!1;case Da.BeforeDragging:return n;default:return!n}}}function Cm(e,t){return dl(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function uI(e,t){return Cm(e,t)}function dI(e){let{callback:t,disabled:n}=e;const r=nd(t),s=x.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:i}=window;return new i(r)},[r,n]);return x.useEffect(()=>()=>s?.disconnect(),[s]),s}function sd(e){let{callback:t,disabled:n}=e;const r=nd(t),s=x.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:i}=window;return new i(r)},[n]);return x.useEffect(()=>()=>s?.disconnect(),[s]),s}function fI(e){return new km(fl(e),e)}function Ub(e,t,n){t===void 0&&(t=fI);const[r,s]=x.useState(null);function i(){s(l=>{if(!e)return null;if(e.isConnected===!1){var c;return(c=l??n)!=null?c:null}const u=t(e);return JSON.stringify(l)===JSON.stringify(u)?l:u})}const o=dI({callback(l){if(e)for(const c of l){const{type:u,target:d}=c;if(u==="childList"&&d instanceof HTMLElement&&d.contains(e)){i();break}}}}),a=sd({callback:i});return es(()=>{i(),e?(a?.observe(e),o?.observe(document.body,{childList:!0,subtree:!0})):(a?.disconnect(),o?.disconnect())},[e]),r}function hI(e){const t=Cm(e);return V0(e,t)}const Hb=[];function pI(e){const t=x.useRef(e),n=dl(r=>e?r&&r!==Hb&&e&&t.current&&e.parentNode===t.current.parentNode?r:wm(e):Hb,[e]);return x.useEffect(()=>{t.current=e},[e]),n}function mI(e){const[t,n]=x.useState(null),r=x.useRef(e),s=x.useCallback(i=>{const o=of(i.target);o&&n(a=>a?(a.set(o,Ph(o)),new Map(a)):null)},[]);return x.useEffect(()=>{const i=r.current;if(e!==i){o(i);const a=e.map(l=>{const c=of(l);return c?(c.addEventListener("scroll",s,{passive:!0}),[c,Ph(c)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),r.current=e}return()=>{o(e),o(i)};function o(a){a.forEach(l=>{const c=of(l);c?.removeEventListener("scroll",s)})}},[s,e]),x.useMemo(()=>e.length?t?Array.from(t.values()).reduce((i,o)=>uo(i,o),vr):Y0(e):vr,[e,t])}function Vb(e,t){t===void 0&&(t=[]);const n=x.useRef(null);return x.useEffect(()=>{n.current=null},t),x.useEffect(()=>{const r=e!==vr;r&&!n.current&&(n.current=e),!r&&n.current&&(n.current=null)},[e]),n.current?Cc(e,n.current):vr}function gI(e){x.useEffect(()=>{if(!td)return;const t=e.map(n=>{let{sensor:r}=n;return r.setup==null?void 0:r.setup()});return()=>{for(const n of t)n?.()}},e.map(t=>{let{sensor:n}=t;return n}))}function bI(e,t){return x.useMemo(()=>e.reduce((n,r)=>{let{eventName:s,handler:i}=r;return n[s]=o=>{i(o,t)},n},{}),[e,t])}function tk(e){return x.useMemo(()=>e?UO(e):null,[e])}const qb=[];function yI(e,t){t===void 0&&(t=fl);const[n]=e,r=tk(n?Tn(n):null),[s,i]=x.useState(qb);function o(){i(()=>e.length?e.map(l=>J0(l)?r:new km(t(l),l)):qb)}const a=sd({callback:o});return es(()=>{a?.disconnect(),o(),e.forEach(l=>a?.observe(l))},[e]),s}function nk(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ul(t)?t:e}function xI(e){let{measure:t}=e;const[n,r]=x.useState(null),s=x.useCallback(c=>{for(const{target:u}of c)if(ul(u)){r(d=>{const f=t(u);return d?{...d,width:f.width,height:f.height}:f});break}},[t]),i=sd({callback:s}),o=x.useCallback(c=>{const u=nk(c);i?.disconnect(),u&&i?.observe(u),r(u?t(u):null)},[t,i]),[a,l]=Sc(o);return x.useMemo(()=>({nodeRef:a,rect:n,setRef:l}),[n,a,l])}const vI=[{sensor:Em,options:{}},{sensor:ek,options:{}}],wI={current:{}},cc={draggable:{measure:jb},droppable:{measure:jb,strategy:Da.WhileDragging,frequency:zh.Optimized},dragOverlay:{measure:fl}};class pa extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const kI={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new pa,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:_c},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:cc,measureDroppableContainers:_c,windowRect:null,measuringScheduled:!1},rk={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:_c,draggableNodes:new Map,over:null,measureDroppableContainers:_c},hl=x.createContext(rk),sk=x.createContext(kI);function SI(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new pa}}}function EI(e,t){switch(t.type){case Vt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case Vt.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case Vt.DragEnd:case Vt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case Vt.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new pa(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case Vt.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,i=e.droppable.containers.get(n);if(!i||r!==i.key)return e;const o=new pa(e.droppable.containers);return o.set(n,{...i,disabled:s}),{...e,droppable:{...e.droppable,containers:o}}}case Vt.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const i=new pa(e.droppable.containers);return i.delete(n),{...e,droppable:{...e.droppable,containers:i}}}default:return e}}function CI(e){let{disabled:t}=e;const{active:n,activatorEvent:r,draggableNodes:s}=x.useContext(hl),i=Ec(r),o=Ec(n?.id);return x.useEffect(()=>{if(!t&&!r&&i&&o!=null){if(!vm(i)||document.activeElement===i.target)return;const a=s.get(o);if(!a)return;const{activatorNode:l,node:c}=a;if(!l.current&&!c.current)return;requestAnimationFrame(()=>{for(const u of[l.current,c.current]){if(!u)continue;const d=wO(u);if(d){d.focus();break}}})}},[r,t,s,o,i]),null}function ik(e,t){let{transform:n,...r}=t;return e!=null&&e.length?e.reduce((s,i)=>i({transform:s,...r}),n):n}function NI(e){return x.useMemo(()=>({draggable:{...cc.draggable,...e?.draggable},droppable:{...cc.droppable,...e?.droppable},dragOverlay:{...cc.dragOverlay,...e?.dragOverlay}}),[e?.draggable,e?.droppable,e?.dragOverlay])}function _I(e){let{activeNode:t,measure:n,initialRect:r,config:s=!0}=e;const i=x.useRef(!1),{x:o,y:a}=typeof s=="boolean"?{x:s,y:s}:s;es(()=>{if(!o&&!a||!t){i.current=!1;return}if(i.current||!r)return;const c=t?.node.current;if(!c||c.isConnected===!1)return;const u=n(c),d=V0(u,r);if(o||(d.x=0),a||(d.y=0),i.current=!0,Math.abs(d.x)>0||Math.abs(d.y)>0){const f=W0(c);f&&f.scrollBy({top:d.y,left:d.x})}},[t,o,a,r,n])}const id=x.createContext({...vr,scaleX:1,scaleY:1});var ys;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(ys||(ys={}));const TI=x.memo(function(t){var n,r,s,i;let{id:o,accessibility:a,autoScroll:l=!0,children:c,sensors:u=vI,collisionDetection:d=H0,measuring:f,modifiers:p,...m}=t;const g=x.useReducer(EI,void 0,SI),[b,y]=g,[w,v]=_O(),[E,N]=x.useState(ys.Uninitialized),k=E===ys.Initialized,{draggable:{active:C,nodes:A,translate:R},droppable:{containers:T}}=b,I=C!=null?A.get(C):null,O=x.useRef({initial:null,translated:null}),j=x.useMemo(()=>{var $t;return C!=null?{id:C,data:($t=I?.data)!=null?$t:wI,rect:O}:null},[C,I]),L=x.useRef(null),[F,q]=x.useState(null),[te,K]=x.useState(null),le=Oa(m,Object.values(m)),_=rd("DndDescribedBy",o),ae=x.useMemo(()=>T.getEnabled(),[T]),me=NI(f),{droppableRects:S,measureDroppableContainers:B,measuringScheduled:$}=cI(ae,{dragging:k,dependencies:[R.x,R.y],config:me.droppable}),D=aI(A,C),P=x.useMemo(()=>te?Nc(te):null,[te]),W=Gd(),fe=uI(D,me.draggable.measure);_I({activeNode:C!=null?A.get(C):null,config:W.layoutShiftCompensation,initialRect:fe,measure:me.draggable.measure});const ee=Ub(D,me.draggable.measure,fe),be=Ub(D?D.parentElement:null),Me=x.useRef({activatorEvent:null,active:null,activeNode:D,collisionRect:null,collisions:null,droppableRects:S,draggableNodes:A,draggingNode:null,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),Le=T.getNodeFor((n=Me.current.over)==null?void 0:n.id),Ke=xI({measure:me.dragOverlay.measure}),ce=(r=Ke.nodeRef.current)!=null?r:D,ne=k?(s=Ke.rect)!=null?s:ee:null,et=!!(Ke.nodeRef.current&&Ke.rect),We=hI(et?null:ee),ie=tk(ce?Tn(ce):null),je=pI(k?Le??D:null),it=yI(je),tt=ik(p,{transform:{x:R.x-We.x,y:R.y-We.y,scaleX:1,scaleY:1},activatorEvent:te,active:j,activeNodeRect:ee,containerNodeRect:be,draggingNodeRect:ne,over:Me.current.over,overlayNodeRect:Ke.rect,scrollableAncestors:je,scrollableAncestorRects:it,windowRect:ie}),Gn=P?uo(P,R):null,jn=mI(je),us=Vb(jn),U=Vb(jn,[ee]),G=uo(tt,us),Se=ne?FO(ne,tt):null,Ie=j&&Se?d({active:j,collisionRect:Se,droppableRects:S,droppableContainers:ae,pointerCoordinates:Gn}):null,Ze=LO(Ie,"id"),[Ct,An]=x.useState(null),zn=et?tt:uo(tt,U),Sr=jO(zn,(i=Ct?.rect)!=null?i:null,ee),dr=x.useRef(null),Jt=x.useCallback(($t,Pt)=>{let{sensor:M,options:H}=Pt;if(L.current==null)return;const X=A.get(L.current);if(!X)return;const ye=$t.nativeEvent,nt=new M({active:L.current,activeNode:X,event:ye,options:H,context:Me,onAbort(re){if(!A.get(re))return;const{onDragAbort:xe}=le.current,ct={id:re};xe?.(ct),w({type:"onDragAbort",event:ct})},onPending(re,ue,xe,ct){if(!A.get(re))return;const{onDragPending:fr}=le.current,Jn={id:re,constraint:ue,initialCoordinates:xe,offset:ct};fr?.(Jn),w({type:"onDragPending",event:Jn})},onStart(re){const ue=L.current;if(ue==null)return;const xe=A.get(ue);if(!xe)return;const{onDragStart:ct}=le.current,mt={activatorEvent:ye,active:{id:ue,data:xe.data,rect:O}};Ts.unstable_batchedUpdates(()=>{ct?.(mt),N(ys.Initializing),y({type:Vt.DragStart,initialCoordinates:re,active:ue}),w({type:"onDragStart",event:mt}),q(dr.current),K(ye)})},onMove(re){y({type:Vt.DragMove,coordinates:re})},onEnd:lt(Vt.DragEnd),onCancel:lt(Vt.DragCancel)});dr.current=nt;function lt(re){return async function(){const{active:xe,collisions:ct,over:mt,scrollAdjustedTranslate:fr}=Me.current;let Jn=null;if(xe&&fr){const{cancelDrop:zr}=le.current;Jn={activatorEvent:ye,active:xe,collisions:ct,delta:fr,over:mt},re===Vt.DragEnd&&typeof zr=="function"&&await Promise.resolve(zr(Jn))&&(re=Vt.DragCancel)}L.current=null,Ts.unstable_batchedUpdates(()=>{y({type:re}),N(ys.Uninitialized),An(null),q(null),K(null),dr.current=null;const zr=re===Vt.DragEnd?"onDragEnd":"onDragCancel";if(Jn){const Vo=le.current[zr];Vo?.(Jn),w({type:zr,event:Jn})}})}}},[A]),Er=x.useCallback(($t,Pt)=>(M,H)=>{const X=M.nativeEvent,ye=A.get(H);if(L.current!==null||!ye||X.dndKit||X.defaultPrevented)return;const nt={active:ye};$t(M,Pt.options,nt)===!0&&(X.dndKit={capturedBy:Pt.sensor},L.current=H,Jt(M,Pt))},[A,Jt]),on=lI(u,Er);gI(u),es(()=>{ee&&E===ys.Initializing&&N(ys.Initialized)},[ee,E]),x.useEffect(()=>{const{onDragMove:$t}=le.current,{active:Pt,activatorEvent:M,collisions:H,over:X}=Me.current;if(!Pt||!M)return;const ye={active:Pt,activatorEvent:M,collisions:H,delta:{x:G.x,y:G.y},over:X};Ts.unstable_batchedUpdates(()=>{$t?.(ye),w({type:"onDragMove",event:ye})})},[G.x,G.y]),x.useEffect(()=>{const{active:$t,activatorEvent:Pt,collisions:M,droppableContainers:H,scrollAdjustedTranslate:X}=Me.current;if(!$t||L.current==null||!Pt||!X)return;const{onDragOver:ye}=le.current,nt=H.get(Ze),lt=nt&&nt.rect.current?{id:nt.id,rect:nt.rect.current,data:nt.data,disabled:nt.disabled}:null,re={active:$t,activatorEvent:Pt,collisions:M,delta:{x:X.x,y:X.y},over:lt};Ts.unstable_batchedUpdates(()=>{An(lt),ye?.(re),w({type:"onDragOver",event:re})})},[Ze]),es(()=>{Me.current={activatorEvent:te,active:j,activeNode:D,collisionRect:Se,collisions:Ie,droppableRects:S,draggableNodes:A,draggingNode:ce,draggingNodeRect:ne,droppableContainers:T,over:Ct,scrollableAncestors:je,scrollAdjustedTranslate:G},O.current={initial:ne,translated:Se}},[j,D,Ie,Se,A,ce,ne,S,T,Ct,je,G]),sI({...W,delta:R,draggingRect:Se,pointerCoordinates:Gn,scrollableAncestors:je,scrollableAncestorRects:it});const kl=x.useMemo(()=>({active:j,activeNode:D,activeNodeRect:ee,activatorEvent:te,collisions:Ie,containerNodeRect:be,dragOverlay:Ke,draggableNodes:A,droppableContainers:T,droppableRects:S,over:Ct,measureDroppableContainers:B,scrollableAncestors:je,scrollableAncestorRects:it,measuringConfiguration:me,measuringScheduled:$,windowRect:ie}),[j,D,ee,te,Ie,be,Ke,A,T,S,Ct,B,je,it,me,$,ie]),Sl=x.useMemo(()=>({activatorEvent:te,activators:on,active:j,activeNodeRect:ee,ariaDescribedById:{draggable:_},dispatch:y,draggableNodes:A,over:Ct,measureDroppableContainers:B}),[te,on,j,ee,y,_,A,Ct,B]);return at.createElement(U0.Provider,{value:v},at.createElement(hl.Provider,{value:Sl},at.createElement(sk.Provider,{value:kl},at.createElement(id.Provider,{value:Sr},c)),at.createElement(CI,{disabled:a?.restoreFocus===!1})),at.createElement(MO,{...a,hiddenTextDescribedById:_}));function Gd(){const $t=F?.autoScrollEnabled===!1,Pt=typeof l=="object"?l.enabled===!1:l===!1,M=k&&!$t&&!Pt;return typeof l=="object"?{...l,enabled:M}:{enabled:M}}}),AI=x.createContext(null),Wb="button",MI="Draggable";function RI(e){let{id:t,data:n,disabled:r=!1,attributes:s}=e;const i=rd(MI),{activators:o,activatorEvent:a,active:l,activeNodeRect:c,ariaDescribedById:u,draggableNodes:d,over:f}=x.useContext(hl),{role:p=Wb,roleDescription:m="draggable",tabIndex:g=0}=s??{},b=l?.id===t,y=x.useContext(b?id:AI),[w,v]=Sc(),[E,N]=Sc(),k=bI(o,t),C=Oa(n);es(()=>(d.set(t,{id:t,key:i,node:w,activatorNode:E,data:C}),()=>{const R=d.get(t);R&&R.key===i&&d.delete(t)}),[d,t]);const A=x.useMemo(()=>({role:p,tabIndex:g,"aria-disabled":r,"aria-pressed":b&&p===Wb?!0:void 0,"aria-roledescription":m,"aria-describedby":u.draggable}),[r,p,g,b,m,u.draggable]);return{active:l,activatorEvent:a,activeNodeRect:c,attributes:A,isDragging:b,listeners:r?void 0:k,node:w,over:f,setNodeRef:v,setActivatorNodeRef:N,transform:y}}function OI(){return x.useContext(sk)}const II="Droppable",DI={timeout:25};function LI(e){let{data:t,disabled:n=!1,id:r,resizeObserverConfig:s}=e;const i=rd(II),{active:o,dispatch:a,over:l,measureDroppableContainers:c}=x.useContext(hl),u=x.useRef({disabled:n}),d=x.useRef(!1),f=x.useRef(null),p=x.useRef(null),{disabled:m,updateMeasurementsFor:g,timeout:b}={...DI,...s},y=Oa(g??r),w=x.useCallback(()=>{if(!d.current){d.current=!0;return}p.current!=null&&clearTimeout(p.current),p.current=setTimeout(()=>{c(Array.isArray(y.current)?y.current:[y.current]),p.current=null},b)},[b]),v=sd({callback:w,disabled:m||!o}),E=x.useCallback((A,R)=>{v&&(R&&(v.unobserve(R),d.current=!1),A&&v.observe(A))},[v]),[N,k]=Sc(E),C=Oa(t);return x.useEffect(()=>{!v||!N.current||(v.disconnect(),d.current=!1,v.observe(N.current))},[N,v]),x.useEffect(()=>(a({type:Vt.RegisterDroppable,element:{id:r,key:i,disabled:n,node:N,rect:f,data:C}}),()=>a({type:Vt.UnregisterDroppable,key:i,id:r})),[r]),x.useEffect(()=>{n!==u.current.disabled&&(a({type:Vt.SetDroppableDisabled,id:r,key:i,disabled:n}),u.current.disabled=n)},[r,i,n,a]),{active:o,rect:f,isOver:l?.id===r,node:N,over:l,setNodeRef:k}}function PI(e){let{animation:t,children:n}=e;const[r,s]=x.useState(null),[i,o]=x.useState(null),a=Ec(n);return!n&&!r&&a&&s(a),es(()=>{if(!i)return;const l=r?.key,c=r?.props.id;if(l==null||c==null){s(null);return}Promise.resolve(t(c,i)).then(()=>{s(null)})},[t,r,i]),at.createElement(at.Fragment,null,n,r?x.cloneElement(r,{ref:o}):null)}const jI={x:0,y:0,scaleX:1,scaleY:1};function zI(e){let{children:t}=e;return at.createElement(hl.Provider,{value:rk},at.createElement(id.Provider,{value:jI},t))}const FI={position:"fixed",touchAction:"none"},BI=e=>vm(e)?"transform 250ms ease":void 0,$I=x.forwardRef((e,t)=>{let{as:n,activatorEvent:r,adjustScale:s,children:i,className:o,rect:a,style:l,transform:c,transition:u=BI}=e;if(!a)return null;const d=s?c:{...c,scaleX:1,scaleY:1},f={...FI,width:a.width,height:a.height,top:a.top,left:a.left,transform:Ia.Transform.toString(d),transformOrigin:s&&r?IO(r,a):void 0,transition:typeof u=="function"?u(r):u,...l};return at.createElement(n,{className:o,style:f,ref:t},i)}),UI=e=>t=>{let{active:n,dragOverlay:r}=t;const s={},{styles:i,className:o}=e;if(i!=null&&i.active)for(const[a,l]of Object.entries(i.active))l!==void 0&&(s[a]=n.node.style.getPropertyValue(a),n.node.style.setProperty(a,l));if(i!=null&&i.dragOverlay)for(const[a,l]of Object.entries(i.dragOverlay))l!==void 0&&r.node.style.setProperty(a,l);return o!=null&&o.active&&n.node.classList.add(o.active),o!=null&&o.dragOverlay&&r.node.classList.add(o.dragOverlay),function(){for(const[l,c]of Object.entries(s))n.node.style.setProperty(l,c);o!=null&&o.active&&n.node.classList.remove(o.active)}},HI=e=>{let{transform:{initial:t,final:n}}=e;return[{transform:Ia.Transform.toString(t)},{transform:Ia.Transform.toString(n)}]},VI={duration:250,easing:"ease",keyframes:HI,sideEffects:UI({styles:{active:{opacity:"0"}}})};function qI(e){let{config:t,draggableNodes:n,droppableContainers:r,measuringConfiguration:s}=e;return nd((i,o)=>{if(t===null)return;const a=n.get(i);if(!a)return;const l=a.node.current;if(!l)return;const c=nk(o);if(!c)return;const{transform:u}=Tn(o).getComputedStyle(o),d=q0(u);if(!d)return;const f=typeof t=="function"?t:WI(t);return X0(l,s.draggable.measure),f({active:{id:i,data:a.data,node:l,rect:s.draggable.measure(l)},draggableNodes:n,dragOverlay:{node:o,rect:s.dragOverlay.measure(c)},droppableContainers:r,measuringConfiguration:s,transform:d})})}function WI(e){const{duration:t,easing:n,sideEffects:r,keyframes:s}={...VI,...e};return i=>{let{active:o,dragOverlay:a,transform:l,...c}=i;if(!t)return;const u={x:a.rect.left-o.rect.left,y:a.rect.top-o.rect.top},d={scaleX:l.scaleX!==1?o.rect.width*l.scaleX/a.rect.width:1,scaleY:l.scaleY!==1?o.rect.height*l.scaleY/a.rect.height:1},f={x:l.x-u.x,y:l.y-u.y,...d},p=s({...c,active:o,dragOverlay:a,transform:{initial:l,final:f}}),[m]=p,g=p[p.length-1];if(JSON.stringify(m)===JSON.stringify(g))return;const b=r?.({active:o,dragOverlay:a,...c}),y=a.node.animate(p,{duration:t,easing:n,fill:"forwards"});return new Promise(w=>{y.onfinish=()=>{b?.(),w()}})}}let Kb=0;function KI(e){return x.useMemo(()=>{if(e!=null)return Kb++,Kb},[e])}const GI=at.memo(e=>{let{adjustScale:t=!1,children:n,dropAnimation:r,style:s,transition:i,modifiers:o,wrapperElement:a="div",className:l,zIndex:c=999}=e;const{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggableNodes:m,droppableContainers:g,dragOverlay:b,over:y,measuringConfiguration:w,scrollableAncestors:v,scrollableAncestorRects:E,windowRect:N}=OI(),k=x.useContext(id),C=KI(d?.id),A=ik(o,{activatorEvent:u,active:d,activeNodeRect:f,containerNodeRect:p,draggingNodeRect:b.rect,over:y,overlayNodeRect:b.rect,scrollableAncestors:v,scrollableAncestorRects:E,transform:k,windowRect:N}),R=Cm(f),T=qI({config:r,draggableNodes:m,droppableContainers:g,measuringConfiguration:w}),I=R?b.setRef:void 0;return at.createElement(zI,null,at.createElement(PI,{animation:T},d&&C?at.createElement($I,{key:C,id:d.id,ref:I,as:a,activatorEvent:u,adjustScale:t,className:l,transition:i,rect:R,style:{zIndex:c,...s},transform:A},n):null))}),Nm=F0("inline-flex items-center justify-center whitespace-nowrap text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring/40 disabled:pointer-events-none disabled:opacity-50 disabled:cursor-not-allowed rounded-md",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90 border border-primary dark:border-primary/50 dark:text-white",destructive:"border border-destructive text-destructive hover:bg-destructive/10 dark:hover:bg-destructive/20",outline:"border border-input bg-background text-foreground hover:bg-accent hover:text-accent-foreground dark:border-input/50 dark:hover:bg-accent/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80 border border-secondary dark:border-secondary/50",ghost:"text-foreground hover:bg-accent/50 hover:text-accent-foreground dark:hover:bg-accent/30",link:"text-foreground hover:underline dark:text-foreground/90",icon:"bg-transparent rounded text-muted-foreground hover:text-foreground dark:hover:text-foreground/90"},size:{default:"h-10 px-4 py-2",xs:"h-8 px-2 text-xs",sm:"h-9 px-3",lg:"h-11 px-8",icon:"h-10 w-10"}},compoundVariants:[{variant:"icon",class:"p-0 h-4"}],defaultVariants:{variant:"default",size:"default"}}),oe=x.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...s},i)=>{const o=r?G_:"button";return h.jsx(o,{className:Te(Nm({variant:t,size:n,className:e})),ref:i,...s})});oe.displayName="Button";const JI=({id:e,children:t,className:n,"data-column-id":r,collapsed:s=!1})=>{const{isOver:i,setNodeRef:o}=LI({id:e});return h.jsx("div",{className:Te("flex h-full min-h-40 flex-col transition-all",i?"outline-primary":"outline-border",s&&"min-w-0",n),ref:o,"data-column-id":r,children:t})},ZI=({id:e,name:t,index:n,parent:r,children:s,className:i,onClick:o,tabIndex:a,forwardedRef:l,onKeyDown:c,isOpen:u})=>{const{attributes:d,listeners:f,setNodeRef:p,isDragging:m}=RI({id:e,data:{index:n,parent:r}}),g=x.useRef(!1);x.useEffect(()=>{if(m)g.current=!0;else if(g.current){const w=setTimeout(()=>{g.current=!1},100);return()=>clearTimeout(w)}},[m]);const b=w=>{p(w),typeof l=="function"?l(w):l&&typeof l=="object"&&(l.current=w)},y=w=>{if(g.current){w.preventDefault(),w.stopPropagation();return}o?.()};return h.jsx(It,{className:Te("flex-col space-y-2 border-b p-3 outline-none",m&&"cursor-grabbing opacity-50",u&&"ring-2 ring-inset ring-secondary-foreground",i),...f,...d,ref:b,tabIndex:a,onClick:y,onKeyDown:c,"data-issue-id":e,children:s??h.jsx("p",{className:"m-0 text-sm font-medium",children:t})})},YI=({children:e,className:t,collapsed:n=!1})=>h.jsx("div",{className:Te("flex flex-1 flex-col overflow-y-auto",n&&"hidden",t),children:e}),XI=e=>"children"in e?e.children:e.collapsed??!1?h.jsx(It,{className:Te("sticky top-0 z-20 flex flex-col flex-1 shrink-0 items-center justify-center border-b border-dashed p-3","bg-background",e.className),style:{backgroundImage:`linear-gradient(hsl(var(${e.color}) / 0.03), hsl(var(${e.color}) / 0.03))`},children:h.jsxs("div",{className:"flex items-center gap-2 whitespace-nowrap cursor-pointer hover:opacity-80 transition-opacity",style:{writingMode:"vertical-rl",transform:"rotate(180deg)"},onClick:e.onToggleCollapse,children:[h.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:`hsl(var(${e.color}))`}}),h.jsx("p",{className:"m-0 text-sm",children:e.name}),e.count!==void 0&&h.jsx(st,{variant:"secondary",children:e.count})]})}):h.jsxs(It,{className:Te("sticky top-0 z-20 flex flex shrink-0 items-center gap-2 gap-2 border-b border-dashed p-3","bg-background",e.className),style:{backgroundImage:`linear-gradient(hsl(var(${e.color}) / 0.03), hsl(var(${e.color}) / 0.03))`},children:[h.jsxs("span",{className:"flex flex-1 items-center gap-2 cursor-pointer hover:opacity-80 transition-opacity",onClick:e.onToggleCollapse,children:[h.jsx("div",{className:"h-2 w-2 rounded-full",style:{backgroundColor:`hsl(var(${e.color}))`}}),h.jsx("p",{className:"m-0 text-sm",children:e.name}),e.count!==void 0&&h.jsx(st,{variant:"secondary",children:e.count})]}),h.jsxs("span",{className:"flex items-center gap-1",children:[e.onArchiveAll&&h.jsx(Ei,{children:h.jsxs(rr,{children:[h.jsx(sr,{asChild:!0,children:h.jsx(oe,{variant:"ghost",className:"m-0 h-0 p-0 text-foreground/50 hover:text-foreground",onClick:n=>{n.stopPropagation(),e.onArchiveAll?.()},"aria-label":"Archive All",children:h.jsx(Oo,{className:"h-4 w-4"})})}),h.jsx(Un,{side:"top",children:"Archive All"})]})}),e.onAddIssue&&h.jsx(Ei,{children:h.jsxs(rr,{children:[h.jsx(sr,{asChild:!0,children:h.jsx(oe,{variant:"ghost",className:"m-0 h-0 p-0 text-foreground/50 hover:text-foreground",onClick:n=>{n.stopPropagation(),e.onAddIssue?.()},"aria-label":"Add Issue",children:h.jsx(Si,{className:"h-4 w-4"})})}),h.jsx(Un,{side:"top",children:"Add Issue"})]})})]})]});function QI(e,t,n,r){const s={...e};return t.top+e.y<=n.top?s.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(s.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?s.x=n.left-t.left:t.right+e.x+r>=n.left+n.width&&(s.x=n.left+n.width-t.right-r),{...s,x:s.x}}const eD=e=>{const{draggingNodeRect:t,transform:n,scrollableAncestorRects:r}=e,s=r[0];return!t||!s?n:QI(n,t,s,16)},tD=({children:e,onDragEnd:t,className:n,renderDragOverlay:r,collapsedColumns:s=new Set,totalColumns:i=0})=>{const[o,a]=x.useState(null),l=OO(RO(Em,{activationConstraint:{distance:8}})),c=(()=>{if(i===0)return"auto-cols-[minmax(200px,400px)]";const u=[];return(Array.isArray(e)?e:[e]).forEach(f=>{const p=f?.key;p&&s.has(p)?u.push("48px"):u.push("minmax(200px, 1fr)")}),u.join(" ")})();return h.jsxs(TI,{collisionDetection:H0,onDragStart:u=>a(u.active.id),onDragEnd:u=>{a(null),t(u)},onDragCancel:()=>a(null),sensors:l,modifiers:[eD],children:[h.jsx("div",{className:Te("inline-grid h-full grid-flow-col divide-x border-x transition-all",n),style:{gridTemplateColumns:c},children:e}),h.jsx(GI,{dropAnimation:null,children:o&&r?r(o):null})]})},nD={0:"bg-red-600 dark:bg-red-700",1:"bg-orange-600 dark:bg-orange-700",2:"bg-yellow-600 dark:bg-yellow-700",3:"bg-blue-600 dark:bg-blue-700",4:"bg-gray-600 dark:bg-gray-700"},rD={0:"P0",1:"P1",2:"P2",3:"P3",4:"P4"};function Gb({issue:e,index:t,status:n,onViewDetails:r,isOpen:s}){const i=cr(),o=x.useCallback(()=>{r?r(e):i(`/issues/${e.id}`)},[e,r,i]),a=x.useRef(null);return x.useEffect(()=>{if(!s||!a.current)return;const l=a.current;requestAnimationFrame(()=>{l.scrollIntoView({block:"center",inline:"nearest",behavior:"smooth"})})},[s]),h.jsx(ZI,{id:e.id,name:e.title,index:t,parent:n,onClick:o,isOpen:s,forwardedRef:a,className:e.archived?"opacity-60":"",children:h.jsxs("div",{className:"flex min-w-0 flex-1 flex-col items-start gap-2",children:[h.jsxs("div",{className:"flex w-full items-center justify-between gap-2",children:[h.jsx("div",{className:"text-xs text-muted-foreground",children:e.id}),e.priority!==void 0&&e.priority<=3&&h.jsx("span",{className:`shrink-0 rounded-full px-2 py-0.5 text-xs text-white ${nD[e.priority]}`,children:rD[e.priority]})]}),h.jsx("h4",{className:"text-md line-clamp-2 min-w-0 flex-1 font-medium",children:e.title}),e.content&&h.jsx("p",{className:"line-clamp-2 break-words text-xs text-muted-foreground",children:(()=>{const l=e.content.replace(/^#+ /gm,"").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/\[(.+?)\]\(.+?\)/g,"$1").replace(/`(.+?)`/g,"$1").trim();return l.length>100?`${l.substring(0,100)}...`:l})()})]})},e.id)}const Jb=["blocked","open","in_progress","needs_review","closed"],sD={open:"Open",in_progress:"In Progress",blocked:"Blocked",needs_review:"Needs Review",closed:"Closed"},iD={open:"--chart-3",in_progress:"--chart-2",blocked:"--chart-1",needs_review:"--chart-4",closed:"--chart-5"};function oD({groupedIssues:e,onDragEnd:t,onViewIssueDetails:n,selectedIssue:r,onArchiveAllClosed:s,collapsedColumns:i=new Set,onToggleColumnCollapse:o}){const a=l=>{if(!l)return null;for(const[c,u]of Object.entries(e)){const d=u.find(f=>f.id===l);if(d){const f=u.indexOf(d);return h.jsx(Gb,{issue:d,index:f,status:c,onViewDetails:n,isOpen:!1})}}return null};return h.jsx(tD,{onDragEnd:t,renderDragOverlay:a,collapsedColumns:i,totalColumns:Jb.length,children:Jb.map(l=>{const c=e[l]||[],u=i.has(l);return h.jsxs(JI,{id:l,"data-column-id":l,collapsed:u,children:[h.jsx(XI,{name:sD[l],color:iD[l],count:c.length,onArchiveAll:l==="closed"?s:void 0,collapsed:u,onToggleCollapse:o?()=>o(l):void 0}),h.jsx(YI,{collapsed:u,children:c.map((d,f)=>h.jsx(Gb,{issue:d,index:f,status:l,onViewDetails:n,isOpen:r?.id===d.id},d.id))})]},l)})})}const Ac=x.memo(oD);function sn(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function aD(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}const Ol=43200,Zb=1440;let lD={};function cD(){return lD}function Yb(e){const t=sn(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function uc(e,t){const n=sn(e),r=sn(t),s=n.getTime()-r.getTime();return s<0?-1:s>0?1:s}function uD(e){return aD(e,Date.now())}function dD(e,t){const n=sn(e),r=sn(t),s=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return s*12+i}function fD(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function hD(e,t){return+sn(e)-+sn(t)}function pD(e){const t=sn(e);return t.setHours(23,59,59,999),t}function mD(e){const t=sn(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function gD(e){const t=sn(e);return+pD(t)==+mD(t)}function bD(e,t){const n=sn(e),r=sn(t),s=uc(n,r),i=Math.abs(dD(n,r));let o;if(i<1)o=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-s*i);let a=uc(n,r)===-s;gD(sn(e))&&i===1&&uc(e,r)===1&&(a=!1),o=s*(i-Number(a))}return o===0?0:o}function yD(e,t,n){const r=hD(e,t)/1e3;return fD(n?.roundingMethod)(r)}const xD={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},vD=(e,t,n)=>{let r;const s=xD[e];return typeof s=="string"?r=s:t===1?r=s.one:r=s.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function cf(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const wD={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},kD={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},SD={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},ED={date:cf({formats:wD,defaultWidth:"full"}),time:cf({formats:kD,defaultWidth:"full"}),dateTime:cf({formats:SD,defaultWidth:"full"})},CD={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},ND=(e,t,n,r)=>CD[e];function Go(e){return(t,n)=>{const r=n?.context?String(n.context):"standalone";let s;if(r==="formatting"&&e.formattingValues){const o=e.defaultFormattingWidth||e.defaultWidth,a=n?.width?String(n.width):o;s=e.formattingValues[a]||e.formattingValues[o]}else{const o=e.defaultWidth,a=n?.width?String(n.width):e.defaultWidth;s=e.values[a]||e.values[o]}const i=e.argumentCallback?e.argumentCallback(t):t;return s[i]}}const _D={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},TD={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},AD={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},MD={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},RD={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},OD={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},ID=(e,t)=>{const n=Number(e),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},DD={ordinalNumber:ID,era:Go({values:_D,defaultWidth:"wide"}),quarter:Go({values:TD,defaultWidth:"wide",argumentCallback:e=>e-1}),month:Go({values:AD,defaultWidth:"wide"}),day:Go({values:MD,defaultWidth:"wide"}),dayPeriod:Go({values:RD,defaultWidth:"wide",formattingValues:OD,defaultFormattingWidth:"wide"})};function Jo(e){return(t,n={})=>{const r=n.width,s=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],i=t.match(s);if(!i)return null;const o=i[0],a=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(a)?PD(a,d=>d.test(o)):LD(a,d=>d.test(o));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=t.slice(o.length);return{value:c,rest:u}}}function LD(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function PD(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function jD(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const s=r[0],i=t.match(e.parsePattern);if(!i)return null;let o=e.valueCallback?e.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const a=t.slice(s.length);return{value:o,rest:a}}}const zD=/^(\d+)(th|st|nd|rd)?/i,FD=/\d+/i,BD={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},$D={any:[/^b/i,/^(a|c)/i]},UD={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},HD={any:[/1/i,/2/i,/3/i,/4/i]},VD={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},qD={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},WD={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},KD={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},GD={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},JD={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ZD={ordinalNumber:jD({matchPattern:zD,parsePattern:FD,valueCallback:e=>parseInt(e,10)}),era:Jo({matchPatterns:BD,defaultMatchWidth:"wide",parsePatterns:$D,defaultParseWidth:"any"}),quarter:Jo({matchPatterns:UD,defaultMatchWidth:"wide",parsePatterns:HD,defaultParseWidth:"any",valueCallback:e=>e+1}),month:Jo({matchPatterns:VD,defaultMatchWidth:"wide",parsePatterns:qD,defaultParseWidth:"any"}),day:Jo({matchPatterns:WD,defaultMatchWidth:"wide",parsePatterns:KD,defaultParseWidth:"any"}),dayPeriod:Jo({matchPatterns:GD,defaultMatchWidth:"any",parsePatterns:JD,defaultParseWidth:"any"})},YD={code:"en-US",formatDistance:vD,formatLong:ED,formatRelative:ND,localize:DD,match:ZD,options:{weekStartsOn:0,firstWeekContainsDate:1}};function XD(e,t,n){const r=cD(),s=n?.locale??r.locale??YD,i=2520,o=uc(e,t);if(isNaN(o))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:o});let l,c;o>0?(l=sn(t),c=sn(e)):(l=sn(e),c=sn(t));const u=yD(c,l),d=(Yb(c)-Yb(l))/1e3,f=Math.round((u-d)/60);let p;if(f<2)return n?.includeSeconds?u<5?s.formatDistance("lessThanXSeconds",5,a):u<10?s.formatDistance("lessThanXSeconds",10,a):u<20?s.formatDistance("lessThanXSeconds",20,a):u<40?s.formatDistance("halfAMinute",0,a):u<60?s.formatDistance("lessThanXMinutes",1,a):s.formatDistance("xMinutes",1,a):f===0?s.formatDistance("lessThanXMinutes",1,a):s.formatDistance("xMinutes",f,a);if(f<45)return s.formatDistance("xMinutes",f,a);if(f<90)return s.formatDistance("aboutXHours",1,a);if(f<Zb){const m=Math.round(f/60);return s.formatDistance("aboutXHours",m,a)}else{if(f<i)return s.formatDistance("xDays",1,a);if(f<Ol){const m=Math.round(f/Zb);return s.formatDistance("xDays",m,a)}else if(f<Ol*2)return p=Math.round(f/Ol),s.formatDistance("aboutXMonths",p,a)}if(p=bD(c,l),p<12){const m=Math.round(f/Ol);return s.formatDistance("xMonths",m,a)}else{const m=p%12,g=Math.trunc(p/12);return m<3?s.formatDistance("aboutXYears",g,a):m<9?s.formatDistance("overXYears",g,a):s.formatDistance("almostXYears",g+1,a)}}function Mc(e,t){return XD(e,uD(e),t)}const is=x.forwardRef(({className:e,type:t,...n},r)=>h.jsx("input",{type:t,className:Te("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:r,...n}));is.displayName="Input";function Xb(e,[t,n]){return Math.min(n,Math.max(t,e))}function QD(e){const t=x.useRef({value:e,previous:e});return x.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var eL=[" ","Enter","ArrowUp","ArrowDown"],tL=[" ","Enter"],Ni="Select",[od,ad,nL]=J_(Ni),[Fo]=Gp(Ni,[nL,Bu]),ld=Bu(),[rL,Gs]=Fo(Ni),[sL,iL]=Fo(Ni),ok=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:a,onValueChange:l,dir:c,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,g=ld(t),[b,y]=x.useState(null),[w,v]=x.useState(null),[E,N]=x.useState(!1),k=nT(c),[C,A]=wh({prop:r,defaultProp:s??!1,onChange:i,caller:Ni}),[R,T]=wh({prop:o,defaultProp:a,onChange:l,caller:Ni}),I=x.useRef(null),O=b?m||!!b.closest("form"):!0,[j,L]=x.useState(new Set),F=Array.from(j).map(q=>q.props.value).join(";");return h.jsx(Ew,{...g,children:h.jsxs(rL,{required:p,scope:t,trigger:b,onTriggerChange:y,valueNode:w,onValueNodeChange:v,valueNodeHasChildren:E,onValueNodeHasChildrenChange:N,contentId:$u(),value:R,onValueChange:T,open:C,onOpenChange:A,dir:k,triggerPointerDownPosRef:I,disabled:f,children:[h.jsx(od.Provider,{scope:t,children:h.jsx(sL,{scope:e.__scopeSelect,onNativeOptionAdd:x.useCallback(q=>{L(te=>new Set(te).add(q))},[]),onNativeOptionRemove:x.useCallback(q=>{L(te=>{const K=new Set(te);return K.delete(q),K})},[]),children:n})}),O?h.jsxs(Mk,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:R,onChange:q=>T(q.target.value),disabled:f,form:m,children:[R===void 0?h.jsx("option",{value:""}):null,Array.from(j)]},F):null]})})};ok.displayName=Ni;var ak="SelectTrigger",lk=x.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...s}=e,i=ld(n),o=Gs(ak,n),a=o.disabled||r,l=Ln(t,o.onTriggerChange),c=ad(n),u=x.useRef("touch"),[d,f,p]=Ok(g=>{const b=c().filter(v=>!v.disabled),y=b.find(v=>v.value===o.value),w=Ik(b,g,y);w!==void 0&&o.onValueChange(w.value)}),m=g=>{a||(o.onOpenChange(!0),p()),g&&(o.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return h.jsx(Cw,{asChild:!0,...i,children:h.jsx(gn.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Rk(o.value)?"":void 0,...s,ref:l,onClick:Nt(s.onClick,g=>{g.currentTarget.focus(),u.current!=="mouse"&&m(g)}),onPointerDown:Nt(s.onPointerDown,g=>{u.current=g.pointerType;const b=g.target;b.hasPointerCapture(g.pointerId)&&b.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(m(g),g.preventDefault())}),onKeyDown:Nt(s.onKeyDown,g=>{const b=d.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&f(g.key),!(b&&g.key===" ")&&eL.includes(g.key)&&(m(),g.preventDefault())})})})});lk.displayName=ak;var ck="SelectValue",uk=x.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...a}=e,l=Gs(ck,n),{onValueNodeHasChildrenChange:c}=l,u=i!==void 0,d=Ln(t,l.onValueNodeChange);return Bs(()=>{c(u)},[c,u]),h.jsx(gn.span,{...a,ref:d,style:{pointerEvents:"none"},children:Rk(l.value)?h.jsx(h.Fragment,{children:o}):i})});uk.displayName=ck;var oL="SelectIcon",dk=x.forwardRef((e,t)=>{const{__scopeSelect:n,children:r,...s}=e;return h.jsx(gn.span,{"aria-hidden":!0,...s,ref:t,children:r||"▼"})});dk.displayName=oL;var aL="SelectPortal",fk=e=>h.jsx(vw,{asChild:!0,...e});fk.displayName=aL;var _i="SelectContent",hk=x.forwardRef((e,t)=>{const n=Gs(_i,e.__scopeSelect),[r,s]=x.useState();if(Bs(()=>{s(new DocumentFragment)},[]),!n.open){const i=r;return i?Ts.createPortal(h.jsx(pk,{scope:e.__scopeSelect,children:h.jsx(od.Slot,{scope:e.__scopeSelect,children:h.jsx("div",{children:e.children})})}),i):null}return h.jsx(mk,{...e,ref:t})});hk.displayName=_i;var pr=10,[pk,Js]=Fo(_i),lL="SelectContentImpl",cL=eT("SelectContent.RemoveScroll"),mk=x.forwardRef((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:g,avoidCollisions:b,...y}=e,w=Gs(_i,n),[v,E]=x.useState(null),[N,k]=x.useState(null),C=Ln(t,P=>E(P)),[A,R]=x.useState(null),[T,I]=x.useState(null),O=ad(n),[j,L]=x.useState(!1),F=x.useRef(!1);x.useEffect(()=>{if(v)return Y_(v)},[v]),X_();const q=x.useCallback(P=>{const[W,...fe]=O().map(Me=>Me.ref.current),[ee]=fe.slice(-1),be=document.activeElement;for(const Me of P)if(Me===be||(Me?.scrollIntoView({block:"nearest"}),Me===W&&N&&(N.scrollTop=0),Me===ee&&N&&(N.scrollTop=N.scrollHeight),Me?.focus(),document.activeElement!==be))return},[O,N]),te=x.useCallback(()=>q([A,v]),[q,A,v]);x.useEffect(()=>{j&&te()},[j,te]);const{onOpenChange:K,triggerPointerDownPosRef:le}=w;x.useEffect(()=>{if(v){let P={x:0,y:0};const W=ee=>{P={x:Math.abs(Math.round(ee.pageX)-(le.current?.x??0)),y:Math.abs(Math.round(ee.pageY)-(le.current?.y??0))}},fe=ee=>{P.x<=10&&P.y<=10?ee.preventDefault():v.contains(ee.target)||K(!1),document.removeEventListener("pointermove",W),le.current=null};return le.current!==null&&(document.addEventListener("pointermove",W),document.addEventListener("pointerup",fe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",W),document.removeEventListener("pointerup",fe,{capture:!0})}}},[v,K,le]),x.useEffect(()=>{const P=()=>K(!1);return window.addEventListener("blur",P),window.addEventListener("resize",P),()=>{window.removeEventListener("blur",P),window.removeEventListener("resize",P)}},[K]);const[_,ae]=Ok(P=>{const W=O().filter(be=>!be.disabled),fe=W.find(be=>be.ref.current===document.activeElement),ee=Ik(W,P,fe);ee&&setTimeout(()=>ee.ref.current.focus())}),me=x.useCallback((P,W,fe)=>{const ee=!F.current&&!fe;(w.value!==void 0&&w.value===W||ee)&&(R(P),ee&&(F.current=!0))},[w.value]),S=x.useCallback(()=>v?.focus(),[v]),B=x.useCallback((P,W,fe)=>{const ee=!F.current&&!fe;(w.value!==void 0&&w.value===W||ee)&&I(P)},[w.value]),$=r==="popper"?Fh:gk,D=$===Fh?{side:a,sideOffset:l,align:c,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:g,avoidCollisions:b}:{};return h.jsx(pk,{scope:n,content:v,viewport:N,onViewportChange:k,itemRefCallback:me,selectedItem:A,onItemLeave:S,itemTextRefCallback:B,focusSelectedItem:te,selectedItemText:T,position:r,isPositioned:j,searchRef:_,children:h.jsx(Q_,{as:cL,allowPinchZoom:!0,children:h.jsx(tT,{asChild:!0,trapped:w.open,onMountAutoFocus:P=>{P.preventDefault()},onUnmountAutoFocus:Nt(s,P=>{w.trigger?.focus({preventScroll:!0}),P.preventDefault()}),children:h.jsx(ww,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:P=>P.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:h.jsx($,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:P=>P.preventDefault(),...y,...D,onPlaced:()=>L(!0),ref:C,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:Nt(y.onKeyDown,P=>{const W=P.ctrlKey||P.altKey||P.metaKey;if(P.key==="Tab"&&P.preventDefault(),!W&&P.key.length===1&&ae(P.key),["ArrowUp","ArrowDown","Home","End"].includes(P.key)){let ee=O().filter(be=>!be.disabled).map(be=>be.ref.current);if(["ArrowUp","End"].includes(P.key)&&(ee=ee.slice().reverse()),["ArrowUp","ArrowDown"].includes(P.key)){const be=P.target,Me=ee.indexOf(be);ee=ee.slice(Me+1)}setTimeout(()=>q(ee)),P.preventDefault()}})})})})})})});mk.displayName=lL;var uL="SelectItemAlignedPosition",gk=x.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:r,...s}=e,i=Gs(_i,n),o=Js(_i,n),[a,l]=x.useState(null),[c,u]=x.useState(null),d=Ln(t,C=>u(C)),f=ad(n),p=x.useRef(!1),m=x.useRef(!0),{viewport:g,selectedItem:b,selectedItemText:y,focusSelectedItem:w}=o,v=x.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&c&&g&&b&&y){const C=i.trigger.getBoundingClientRect(),A=c.getBoundingClientRect(),R=i.valueNode.getBoundingClientRect(),T=y.getBoundingClientRect();if(i.dir!=="rtl"){const be=T.left-A.left,Me=R.left-be,Le=C.left-Me,Ke=C.width+Le,ce=Math.max(Ke,A.width),ne=window.innerWidth-pr,et=Xb(Me,[pr,Math.max(pr,ne-ce)]);a.style.minWidth=Ke+"px",a.style.left=et+"px"}else{const be=A.right-T.right,Me=window.innerWidth-R.right-be,Le=window.innerWidth-C.right-Me,Ke=C.width+Le,ce=Math.max(Ke,A.width),ne=window.innerWidth-pr,et=Xb(Me,[pr,Math.max(pr,ne-ce)]);a.style.minWidth=Ke+"px",a.style.right=et+"px"}const I=f(),O=window.innerHeight-pr*2,j=g.scrollHeight,L=window.getComputedStyle(c),F=parseInt(L.borderTopWidth,10),q=parseInt(L.paddingTop,10),te=parseInt(L.borderBottomWidth,10),K=parseInt(L.paddingBottom,10),le=F+q+j+K+te,_=Math.min(b.offsetHeight*5,le),ae=window.getComputedStyle(g),me=parseInt(ae.paddingTop,10),S=parseInt(ae.paddingBottom,10),B=C.top+C.height/2-pr,$=O-B,D=b.offsetHeight/2,P=b.offsetTop+D,W=F+q+P,fe=le-W;if(W<=B){const be=I.length>0&&b===I[I.length-1].ref.current;a.style.bottom="0px";const Me=c.clientHeight-g.offsetTop-g.offsetHeight,Le=Math.max($,D+(be?S:0)+Me+te),Ke=W+Le;a.style.height=Ke+"px"}else{const be=I.length>0&&b===I[0].ref.current;a.style.top="0px";const Le=Math.max(B,F+g.offsetTop+(be?me:0)+D)+fe;a.style.height=Le+"px",g.scrollTop=W-B+g.offsetTop}a.style.margin=`${pr}px 0`,a.style.minHeight=_+"px",a.style.maxHeight=O+"px",r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,i.trigger,i.valueNode,a,c,g,b,y,i.dir,r]);Bs(()=>v(),[v]);const[E,N]=x.useState();Bs(()=>{c&&N(window.getComputedStyle(c).zIndex)},[c]);const k=x.useCallback(C=>{C&&m.current===!0&&(v(),w?.(),m.current=!1)},[v,w]);return h.jsx(fL,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:p,onScrollButtonChange:k,children:h.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:E},children:h.jsx(gn.div,{...s,ref:d,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});gk.displayName=uL;var dL="SelectPopperPosition",Fh=x.forwardRef((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=pr,...i}=e,o=ld(n);return h.jsx(kw,{...o,...i,ref:t,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Fh.displayName=dL;var[fL,_m]=Fo(_i,{}),Bh="SelectViewport",bk=x.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:r,...s}=e,i=Js(Bh,n),o=_m(Bh,n),a=Ln(t,i.onViewportChange),l=x.useRef(0);return h.jsxs(h.Fragment,{children:[h.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),h.jsx(od.Slot,{scope:n,children:h.jsx(gn.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Nt(s.onScroll,c=>{const u=c.currentTarget,{contentWrapper:d,shouldExpandOnScrollRef:f}=o;if(f?.current&&d){const p=Math.abs(l.current-u.scrollTop);if(p>0){const m=window.innerHeight-pr*2,g=parseFloat(d.style.minHeight),b=parseFloat(d.style.height),y=Math.max(g,b);if(y<m){const w=y+p,v=Math.min(m,w),E=w-v;d.style.height=v+"px",d.style.bottom==="0px"&&(u.scrollTop=E>0?E:0,d.style.justifyContent="flex-end")}}}l.current=u.scrollTop})})})]})});bk.displayName=Bh;var yk="SelectGroup",[hL,pL]=Fo(yk),mL=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=$u();return h.jsx(hL,{scope:n,id:s,children:h.jsx(gn.div,{role:"group","aria-labelledby":s,...r,ref:t})})});mL.displayName=yk;var xk="SelectLabel",vk=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=pL(xk,n);return h.jsx(gn.div,{id:s.id,...r,ref:t})});vk.displayName=xk;var Rc="SelectItem",[gL,wk]=Fo(Rc),kk=x.forwardRef((e,t)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=e,a=Gs(Rc,n),l=Js(Rc,n),c=a.value===r,[u,d]=x.useState(i??""),[f,p]=x.useState(!1),m=Ln(t,w=>l.itemRefCallback?.(w,r,s)),g=$u(),b=x.useRef("touch"),y=()=>{s||(a.onValueChange(r),a.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return h.jsx(gL,{scope:n,value:r,disabled:s,textId:g,isSelected:c,onItemTextChange:x.useCallback(w=>{d(v=>v||(w?.textContent??"").trim())},[]),children:h.jsx(od.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:h.jsx(gn.div,{role:"option","aria-labelledby":g,"data-highlighted":f?"":void 0,"aria-selected":c&&f,"data-state":c?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:m,onFocus:Nt(o.onFocus,()=>p(!0)),onBlur:Nt(o.onBlur,()=>p(!1)),onClick:Nt(o.onClick,()=>{b.current!=="mouse"&&y()}),onPointerUp:Nt(o.onPointerUp,()=>{b.current==="mouse"&&y()}),onPointerDown:Nt(o.onPointerDown,w=>{b.current=w.pointerType}),onPointerMove:Nt(o.onPointerMove,w=>{b.current=w.pointerType,s?l.onItemLeave?.():b.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Nt(o.onPointerLeave,w=>{w.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:Nt(o.onKeyDown,w=>{l.searchRef?.current!==""&&w.key===" "||(tL.includes(w.key)&&y(),w.key===" "&&w.preventDefault())})})})})});kk.displayName=Rc;var ra="SelectItemText",Sk=x.forwardRef((e,t)=>{const{__scopeSelect:n,className:r,style:s,...i}=e,o=Gs(ra,n),a=Js(ra,n),l=wk(ra,n),c=iL(ra,n),[u,d]=x.useState(null),f=Ln(t,y=>d(y),l.onItemTextChange,y=>a.itemTextRefCallback?.(y,l.value,l.disabled)),p=u?.textContent,m=x.useMemo(()=>h.jsx("option",{value:l.value,disabled:l.disabled,children:p},l.value),[l.disabled,l.value,p]),{onNativeOptionAdd:g,onNativeOptionRemove:b}=c;return Bs(()=>(g(m),()=>b(m)),[g,b,m]),h.jsxs(h.Fragment,{children:[h.jsx(gn.span,{id:l.textId,...i,ref:f}),l.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Ts.createPortal(i.children,o.valueNode):null]})});Sk.displayName=ra;var Ek="SelectItemIndicator",Ck=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return wk(Ek,n).isSelected?h.jsx(gn.span,{"aria-hidden":!0,...r,ref:t}):null});Ck.displayName=Ek;var $h="SelectScrollUpButton",Nk=x.forwardRef((e,t)=>{const n=Js($h,e.__scopeSelect),r=_m($h,e.__scopeSelect),[s,i]=x.useState(!1),o=Ln(t,r.onScrollButtonChange);return Bs(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollTop>0;i(c)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?h.jsx(Tk,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});Nk.displayName=$h;var Uh="SelectScrollDownButton",_k=x.forwardRef((e,t)=>{const n=Js(Uh,e.__scopeSelect),r=_m(Uh,e.__scopeSelect),[s,i]=x.useState(!1),o=Ln(t,r.onScrollButtonChange);return Bs(()=>{if(n.viewport&&n.isPositioned){let a=function(){const c=l.scrollHeight-l.clientHeight,u=Math.ceil(l.scrollTop)<c;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),s?h.jsx(Tk,{...e,ref:o,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});_k.displayName=Uh;var Tk=x.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=e,i=Js("SelectScrollButton",n),o=x.useRef(null),a=ad(n),l=x.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return x.useEffect(()=>()=>l(),[l]),Bs(()=>{a().find(u=>u.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),h.jsx(gn.div,{"aria-hidden":!0,...s,ref:t,style:{flexShrink:0,...s.style},onPointerDown:Nt(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Nt(s.onPointerMove,()=>{i.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Nt(s.onPointerLeave,()=>{l()})})}),bL="SelectSeparator",Ak=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e;return h.jsx(gn.div,{"aria-hidden":!0,...r,ref:t})});Ak.displayName=bL;var Hh="SelectArrow",yL=x.forwardRef((e,t)=>{const{__scopeSelect:n,...r}=e,s=ld(n),i=Gs(Hh,n),o=Js(Hh,n);return i.open&&o.position==="popper"?h.jsx(Nw,{...s,...r,ref:t}):null});yL.displayName=Hh;var xL="SelectBubbleInput",Mk=x.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{const s=x.useRef(null),i=Ln(r,s),o=QD(t);return x.useEffect(()=>{const a=s.current;if(!a)return;const l=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(l,"value").set;if(o!==t&&u){const d=new Event("change",{bubbles:!0});u.call(a,t),a.dispatchEvent(d)}},[o,t]),h.jsx(gn.select,{...n,style:{...r0,...n.style},ref:i,defaultValue:t})});Mk.displayName=xL;function Rk(e){return e===""||e===void 0}function Ok(e){const t=Z_(e),n=x.useRef(""),r=x.useRef(0),s=x.useCallback(o=>{const a=n.current+o;t(a),(function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))})(a)},[t]),i=x.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return x.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function Ik(e,t,n){const s=t.length>1&&Array.from(t).every(c=>c===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let o=vL(e,Math.max(i,0));s.length===1&&(o=o.filter(c=>c!==n));const l=o.find(c=>c.textValue.toLowerCase().startsWith(s.toLowerCase()));return l!==n?l:void 0}function vL(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var wL=ok,Dk=lk,kL=uk,SL=dk,EL=fk,Lk=hk,CL=bk,Pk=vk,jk=kk,NL=Sk,_L=Ck,zk=Nk,Fk=_k,Bk=Ak;const Sn=wL,En=kL,dn=x.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(Dk,{ref:r,className:Te("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",e),...n,children:[t,h.jsx(SL,{asChild:!0,children:h.jsx(Aa,{className:"h-4 w-4 opacity-50"})})]}));dn.displayName=Dk.displayName;const $k=x.forwardRef(({className:e,...t},n)=>h.jsx(zk,{ref:n,className:Te("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(am,{className:"h-4 w-4"})}));$k.displayName=zk.displayName;const Uk=x.forwardRef(({className:e,...t},n)=>h.jsx(Fk,{ref:n,className:Te("flex cursor-default items-center justify-center py-1",e),...t,children:h.jsx(Aa,{className:"h-4 w-4"})}));Uk.displayName=Fk.displayName;const fn=x.forwardRef(({className:e,children:t,position:n="popper",...r},s)=>h.jsx(EL,{children:h.jsxs(Lk,{ref:s,className:Te("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",e),position:n,...r,children:[h.jsx($k,{}),h.jsx(CL,{className:Te("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),h.jsx(Uk,{})]})}));fn.displayName=Lk.displayName;const TL=x.forwardRef(({className:e,...t},n)=>h.jsx(Pk,{ref:n,className:Te("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));TL.displayName=Pk.displayName;const xt=x.forwardRef(({className:e,children:t,...n},r)=>h.jsxs(jk,{ref:r,className:Te("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",e),...n,children:[h.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:h.jsx(_L,{children:h.jsx(Ww,{className:"h-4 w-4"})})}),h.jsx(NL,{children:t})]}));xt.displayName=jk.displayName;const AL=x.forwardRef(({className:e,...t},n)=>h.jsx(Bk,{ref:n,className:Te("-mx-1 my-1 h-px bg-muted",e),...t}));AL.displayName=Bk.displayName;var Hk="AlertDialog",[ML]=Gp(Hk,[Mw]),as=Mw(),Vk=e=>{const{__scopeAlertDialog:t,...n}=e,r=as(t);return h.jsx(Tw,{...r,...n,modal:!0})};Vk.displayName=Hk;var RL="AlertDialogTrigger",OL=x.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=as(n);return h.jsx(Aw,{...s,...r,ref:t})});OL.displayName=RL;var IL="AlertDialogPortal",qk=e=>{const{__scopeAlertDialog:t,...n}=e,r=as(t);return h.jsx(_w,{...r,...n})};qk.displayName=IL;var DL="AlertDialogOverlay",Wk=x.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=as(n);return h.jsx(Jp,{...s,...r,ref:t})});Wk.displayName=DL;var fo="AlertDialogContent",[LL,PL]=ML(fo),jL=Sw("AlertDialogContent"),Kk=x.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:r,...s}=e,i=as(n),o=x.useRef(null),a=Ln(t,o),l=x.useRef(null);return h.jsx(rT,{contentName:fo,titleName:Gk,docsSlug:"alert-dialog",children:h.jsx(LL,{scope:n,cancelRef:l,children:h.jsxs(Zp,{role:"alertdialog",...i,...s,ref:a,onOpenAutoFocus:Nt(s.onOpenAutoFocus,c=>{c.preventDefault(),l.current?.focus({preventScroll:!0})}),onPointerDownOutside:c=>c.preventDefault(),onInteractOutside:c=>c.preventDefault(),children:[h.jsx(jL,{children:r}),h.jsx(FL,{contentRef:o})]})})})});Kk.displayName=fo;var Gk="AlertDialogTitle",Jk=x.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=as(n);return h.jsx(Yp,{...s,...r,ref:t})});Jk.displayName=Gk;var Zk="AlertDialogDescription",Yk=x.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=as(n);return h.jsx(Xp,{...s,...r,ref:t})});Yk.displayName=Zk;var zL="AlertDialogAction",Xk=x.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,s=as(n);return h.jsx(Rw,{...s,...r,ref:t})});Xk.displayName=zL;var Qk="AlertDialogCancel",eS=x.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...r}=e,{cancelRef:s}=PL(Qk,n),i=as(n),o=Ln(t,s);return h.jsx(Rw,{...i,...r,ref:o})});eS.displayName=Qk;var FL=({contentRef:e})=>{const t=`\`${fo}\` requires a description for the component to be accessible for screen reader users.
291
-
292
- You can add a description to the \`${fo}\` by passing a \`${Zk}\` component as a child, which also benefits sighted users by adding visible context to the dialog.
293
-
294
- Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${fo}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.
295
-
296
- For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return x.useEffect(()=>{document.getElementById(e.current?.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},BL=Vk,$L=qk,tS=Wk,nS=Kk,rS=Xk,sS=eS,iS=Jk,oS=Yk;const Tm=BL,UL=$L,aS=x.forwardRef(({className:e,...t},n)=>h.jsx(tS,{className:Te("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",e),...t,ref:n}));aS.displayName=tS.displayName;const cd=x.forwardRef(({className:e,...t},n)=>h.jsxs(UL,{children:[h.jsx(aS,{}),h.jsx(nS,{ref:n,className:Te("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",e),...t})]}));cd.displayName=nS.displayName;const ud=({className:e,...t})=>h.jsx("div",{className:Te("flex flex-col space-y-2 text-center sm:text-left",e),...t});ud.displayName="AlertDialogHeader";const dd=({className:e,...t})=>h.jsx("div",{className:Te("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});dd.displayName="AlertDialogFooter";const fd=x.forwardRef(({className:e,...t},n)=>h.jsx(iS,{ref:n,className:Te("text-lg font-semibold",e),...t}));fd.displayName=iS.displayName;const hd=x.forwardRef(({className:e,...t},n)=>h.jsx(oS,{ref:n,className:Te("text-sm text-muted-foreground",e),...t}));hd.displayName=oS.displayName;const pd=x.forwardRef(({className:e,...t},n)=>h.jsx(rS,{ref:n,className:Te(Nm(),e),...t}));pd.displayName=rS.displayName;const md=x.forwardRef(({className:e,...t},n)=>h.jsx(sS,{ref:n,className:Te(Nm({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));md.displayName=sS.displayName;function lS({issue:e,isOpen:t,onClose:n,onConfirm:r,isDeleting:s=!1}){return e?h.jsx(Tm,{open:t,onOpenChange:n,children:h.jsxs(cd,{children:[h.jsxs(ud,{children:[h.jsx(fd,{children:"Delete Issue"}),h.jsxs(hd,{children:["Are you sure you want to delete ",h.jsx("strong",{children:e.title})," (",e.id,")?",h.jsx("br",{}),"This action cannot be undone."]})]}),h.jsxs(dd,{children:[h.jsx(md,{disabled:s,children:"Cancel"}),h.jsx(pd,{onClick:r,disabled:s,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s?"Deleting...":"Delete"})]})]})}):null}const cS={blocks:"Blocks",related:"Related to","discovered-from":"Discovered from",implements:"Implements",references:"References","depends-on":"Depends on"},HL={blocks:"bg-red-600 dark:bg-red-700",related:"bg-blue-600 dark:bg-blue-700","discovered-from":"bg-purple-600 dark:bg-purple-700",implements:"bg-green-600 dark:bg-green-700",references:"bg-gray-600 dark:bg-gray-700","depends-on":"bg-orange-600 dark:bg-orange-700"};function VL(e){return{blocks:"Blocked by",related:"Related to","discovered-from":"Led to discovery of",implements:"Implemented by",references:"Referenced by","depends-on":"Required by"}[e]}function qL(e,t){const n=Array.isArray(e)?e:[];return{outgoing:n.filter(r=>r.from_id===t),incoming:n.filter(r=>r.to_id===t)}}function uS({relationships:e,currentEntityId:t,currentEntityType:n,onNavigate:r,onDelete:s,showEmpty:i=!0,showGroupHeaders:o=!0}){const a=qL(e,t);if(e.length===0&&i)return h.jsx("div",{className:"py-8 text-center text-sm text-muted-foreground",children:"No relationships yet"});if(e.length===0)return null;const l=(c,u)=>{const d=u==="outgoing",f=d?c.to_id:c.from_id,p=d?c.to_type:c.from_type,m=d?cS[c.relationship_type]:VL(c.relationship_type),g=HL[c.relationship_type],b=()=>p==="issue"?`/issues/${f}`:`/specs/${f}`,y=()=>p==="issue"?h.jsx(lm,{className:"h-3 w-3"}):h.jsx(ss,{className:"h-3 w-3"}),w=()=>p==="issue"?"issue":"spec";return h.jsxs(It,{className:"group flex items-center gap-2 p-2 transition-colors hover:bg-accent/50",children:[h.jsx("span",{className:`shrink-0 rounded-full px-2 py-1 text-xs font-medium text-white ${g}`,children:m}),h.jsx(nA,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),h.jsx(Qp,{to:b(),className:"min-w-0 flex-1 no-underline",children:h.jsxs(st,{variant:w(),className:"inline-flex items-center gap-1",children:[y(),f]})}),s&&h.jsxs(rr,{children:[h.jsx(sr,{asChild:!0,children:h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>s(c),className:"h-6 w-6 shrink-0 p-0 opacity-0 transition-opacity group-hover:opacity-100","aria-label":"Remove relationship",title:"Remove relationship",children:h.jsx(Io,{className:"h-3 w-3"})})}),h.jsx(Un,{children:"Remove relationship"})]})]},`${c.from_id}-${c.to_id}-${c.relationship_type}`)};if(!o){const c=[...a.outgoing.map(u=>({rel:u,direction:"outgoing"})),...a.incoming.map(u=>({rel:u,direction:"incoming"}))];return h.jsx(Ei,{delayDuration:300,children:h.jsx("div",{className:"space-y-2",children:c.map(({rel:u,direction:d})=>l(u,d))})})}return h.jsx(Ei,{delayDuration:300,children:h.jsxs("div",{className:"space-y-4",children:[a.outgoing.length>0&&h.jsxs("div",{children:[h.jsxs("h4",{className:"mb-2 text-sm font-medium text-muted-foreground",children:["Outgoing (",a.outgoing.length,")"]}),h.jsx("div",{className:"space-y-2",children:a.outgoing.map(c=>l(c,"outgoing"))})]}),a.incoming.length>0&&h.jsxs("div",{children:[h.jsxs("h4",{className:"mb-2 text-sm font-medium text-muted-foreground",children:["Incoming (",a.incoming.length,")"]}),h.jsx("div",{className:"space-y-2",children:a.incoming.map(c=>l(c,"incoming"))})]})]})})}var WL="Label",dS=x.forwardRef((e,t)=>h.jsx(gn.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));dS.displayName=WL;var fS=dS;const Ht=x.forwardRef(({className:e,...t},n)=>h.jsx(fS,{ref:n,className:Te("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",e),...t}));Ht.displayName=fS.displayName;const KL=["blocks","related","discovered-from","implements","references","depends-on"];function hS({fromId:e,fromType:t,onSubmit:n,onCancel:r,inline:s=!1}){const[i,o]=x.useState(""),[a,l]=x.useState("issue"),[c,u]=x.useState("related"),[d,f]=x.useState(!1),p=async g=>{if(g.preventDefault(),!!i.trim()){f(!0);try{await n(i.trim(),a,c),o(""),l("issue"),u("related")}finally{f(!1)}}},m=h.jsxs("form",{onSubmit:p,className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ht,{htmlFor:"target-id",children:"Target Entity"}),h.jsxs("div",{className:"flex gap-2",children:[h.jsxs(Sn,{value:a,onValueChange:g=>l(g),children:[h.jsx(dn,{className:"w-[120px]",children:h.jsx(En,{})}),h.jsxs(fn,{children:[h.jsx(xt,{value:"issue",children:"Issue"}),h.jsx(xt,{value:"spec",children:"Spec"})]})]}),h.jsx(is,{id:"target-id",placeholder:a==="issue"?"i-x7k9":"s-14sh",value:i,onChange:g=>o(g.target.value),className:"flex-1",disabled:d})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ht,{htmlFor:"relationship-type",children:"Relationship Type"}),h.jsxs(Sn,{value:c,onValueChange:g=>u(g),children:[h.jsx(dn,{id:"relationship-type",children:h.jsx(En,{})}),h.jsx(fn,{children:KL.map(g=>h.jsx(xt,{value:g,children:cS[g]},g))})]})]}),h.jsxs("div",{className:"flex justify-end gap-2",children:[r&&h.jsx(oe,{type:"button",variant:"outline",onClick:r,disabled:d,children:"Cancel"}),h.jsx(oe,{type:"submit",disabled:!i.trim()||d,children:"Create"})]})]});return s?m:h.jsx(It,{className:"p-4",children:m})}const gd=x.forwardRef(({className:e,...t},n)=>h.jsx("textarea",{className:Te("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",e),ref:n,...t}));gd.displayName="Textarea";function GL({issueId:e,open:t,onStart:n,onCancel:r}){const[s,i]=x.useState(!0),[o,a]=x.useState(null),[l,c]=x.useState(""),[u,d]=x.useState({mode:"worktree",cleanupMode:"manual"}),[f,p]=x.useState(!1);x.useEffect(()=>{if(!t)return;(async()=>{i(!0);try{const E=await Xn.prepare(e);a(E),c(E.renderedPrompt),d({...u,...E.defaultConfig})}catch(E){console.error("Failed to prepare execution:",E)}finally{i(!1)}})()},[t,e]);const m=v=>{d({...u,...v})},g=()=>{n(u,l)},b=o?.errors&&o.errors.length>0,y=o?.warnings&&o.warnings.length>0,w=!s&&!b&&l.trim().length>0;return h.jsx(Bi,{open:t,onOpenChange:r,children:h.jsxs(qs,{className:"max-h-[90vh] max-w-3xl overflow-y-auto",children:[h.jsxs(Ws,{children:[h.jsx(Ks,{children:"Configure Agent Execution"}),h.jsx(Gu,{children:"Configure settings and review the prompt before starting the agent."})]}),s?h.jsx("div",{className:"py-8 text-center text-muted-foreground",children:"Loading template..."}):h.jsxs("div",{className:"space-y-6",children:[b&&h.jsx("div",{className:"rounded-lg border border-destructive bg-destructive/10 p-3",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx(ki,{className:"mt-0.5 h-5 w-5 text-destructive"}),h.jsxs("div",{className:"flex-1 space-y-1",children:[h.jsx("p",{className:"text-sm font-medium text-destructive",children:"Errors"}),o.errors.map((v,E)=>h.jsx("p",{className:"text-sm text-destructive/90",children:v},E))]})]})}),y&&h.jsx("div",{className:"rounded-lg border border-yellow-500 bg-yellow-500/10 p-3",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx(pA,{className:"mt-0.5 h-5 w-5 text-yellow-600"}),h.jsxs("div",{className:"flex-1 space-y-1",children:[h.jsx("p",{className:"text-sm font-medium text-yellow-600",children:"Warnings"}),o.warnings.map((v,E)=>h.jsx("p",{className:"text-sm text-yellow-600/90",children:v},E))]})]})}),o&&((o.relatedSpecs?.length??0)>0||(o.relatedFeedback?.length??0)>0)&&h.jsxs("div",{className:"rounded-lg border bg-muted/50 p-3",children:[h.jsx("p",{className:"mb-2 text-sm font-medium",children:"Context Included"}),h.jsxs("div",{className:"space-y-1 text-sm text-muted-foreground",children:[(o.relatedSpecs?.length??0)>0&&h.jsxs("p",{children:["• ",o.relatedSpecs.length," related spec(s)"]}),(o.relatedFeedback?.length??0)>0&&h.jsxs("p",{children:["• ",o.relatedFeedback.length," feedback item(s)"]})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ht,{htmlFor:"mode",children:"Execution Mode"}),h.jsxs(Sn,{value:u.mode,onValueChange:v=>m({mode:v}),children:[h.jsx(dn,{id:"mode",children:h.jsx(En,{})}),h.jsxs(fn,{children:[h.jsx(xt,{value:"worktree",children:"Worktree (Recommended) - Isolated git worktree"}),h.jsx(xt,{value:"local",children:"Local - Run in current directory"})]})]})]}),u.mode==="worktree"&&o?.availableBranches&&h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ht,{htmlFor:"baseBranch",children:"Base Branch"}),h.jsxs(Sn,{value:u.baseBranch,onValueChange:v=>m({baseBranch:v}),children:[h.jsx(dn,{id:"baseBranch",children:h.jsx(En,{placeholder:"Select base branch"})}),h.jsx(fn,{children:o.availableBranches.map(v=>h.jsx(xt,{value:v,children:v},v))})]})]}),o?.availableModels&&h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ht,{htmlFor:"model",children:"Model"}),h.jsxs(Sn,{value:u.model,onValueChange:v=>m({model:v}),children:[h.jsx(dn,{id:"model",children:h.jsx(En,{placeholder:"Select model"})}),h.jsx(fn,{children:o.availableModels.map(v=>h.jsx(xt,{value:v,children:v},v))})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ht,{htmlFor:"cleanup",children:"Cleanup Mode"}),h.jsxs(Sn,{value:u.cleanupMode,onValueChange:v=>m({cleanupMode:v}),children:[h.jsx(dn,{id:"cleanup",children:h.jsx(En,{})}),h.jsxs(fn,{children:[h.jsx(xt,{value:"auto",children:"Auto - Clean up after completion"}),h.jsx(xt,{value:"manual",children:"Manual - Keep for review"}),h.jsx(xt,{value:"never",children:"Never - Persist permanently"})]})]})]}),h.jsxs("button",{type:"button",onClick:()=>p(!f),className:"text-sm text-muted-foreground hover:text-foreground",children:[f?"▼":"▶"," Advanced Options"]}),f&&h.jsxs("div",{className:"space-y-4 border-l-2 border-muted pl-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ht,{htmlFor:"timeout",children:"Timeout (ms)"}),h.jsx("input",{id:"timeout",type:"number",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:u.timeout??"",onChange:v=>m({timeout:v.target.value?parseInt(v.target.value):void 0}),placeholder:"No timeout"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ht,{htmlFor:"maxTokens",children:"Max Tokens"}),h.jsx("input",{id:"maxTokens",type:"number",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:u.maxTokens??"",onChange:v=>m({maxTokens:v.target.value?parseInt(v.target.value):void 0}),placeholder:"Model default"})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ht,{htmlFor:"temperature",children:"Temperature"}),h.jsx("input",{id:"temperature",type:"number",step:"0.1",min:"0",max:"2",className:"flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm",value:u.temperature??"",onChange:v=>m({temperature:v.target.value?parseFloat(v.target.value):void 0}),placeholder:"Model default"})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ht,{htmlFor:"prompt",children:"Prompt"}),h.jsx(gd,{id:"prompt",value:l,onChange:v=>c(v.target.value),rows:12,className:"font-mono text-sm",placeholder:"Edit the generated prompt..."}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"Review and edit the generated prompt before starting the agent."})]})]}),h.jsxs(hm,{children:[h.jsx(oe,{variant:"outline",onClick:r,children:"Cancel"}),h.jsx(oe,{onClick:g,disabled:!w,children:"Start Agent"})]})]})})}const JL={preparing:{label:"Preparing",variant:"secondary",icon:h.jsx(Ma,{className:"h-3 w-3"})},pending:{label:"Pending",variant:"secondary",icon:h.jsx(Ma,{className:"h-3 w-3"})},running:{label:"Running",variant:"default",icon:h.jsx(Ds,{className:"h-3 w-3 animate-spin"})},paused:{label:"Paused",variant:"outline",icon:h.jsx(Gw,{className:"h-3 w-3"})},completed:{label:"Completed",variant:"default",icon:h.jsx(om,{className:"h-3 w-3"})},failed:{label:"Failed",variant:"destructive",icon:h.jsx(ao,{className:"h-3 w-3"})},cancelled:{label:"Cancelled",variant:"secondary",icon:h.jsx(mb,{className:"h-3 w-3"})},stopped:{label:"Stopped",variant:"secondary",icon:h.jsx(mb,{className:"h-3 w-3"})}};function ZL(e){if(!e)return"N/A";const t=new Date(e),r=new Date().getTime()-t.getTime(),s=Math.floor(r/6e4),i=Math.floor(r/36e5),o=Math.floor(r/864e5);return s<1?"Just now":s<60?`${s}m ago`:i<24?`${i}h ago`:o<7?`${o}d ago`:t.toLocaleDateString()}function YL(e,t=8){return e.substring(0,t)}function XL({issueId:e}){const t=cr(),[n,r]=x.useState([]),[s,i]=x.useState(!0),[o,a]=x.useState(null);x.useEffect(()=>{(async()=>{i(!0),a(null);try{const d=(await Xn.list(e)).sort((f,p)=>new Date(p.created_at).getTime()-new Date(f.created_at).getTime());r(d)}catch(u){console.error("Failed to fetch executions:",u),a("Failed to load execution history")}finally{i(!1)}})()},[e]);const l=c=>{t(`/executions/${c}`)};return s?h.jsxs("div",{className:"space-y-2",children:[h.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Execution History"}),h.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading executions..."})]}):o?h.jsxs("div",{className:"space-y-2",children:[h.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Execution History"}),h.jsx("div",{className:"rounded-lg border border-destructive/50 bg-destructive/10 p-3 text-sm text-destructive",children:o})]}):n.length===0?h.jsxs("div",{className:"space-y-2",children:[h.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Execution History"}),h.jsxs(It,{className:"p-6 text-center",children:[h.jsx("p",{className:"text-sm text-muted-foreground",children:"No executions yet"}),h.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:'Click "Run Agent" to start your first execution'})]})]}):h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Execution History"}),h.jsx(st,{variant:"secondary",children:n.length})]}),h.jsx("div",{className:"space-y-2",children:n.map(c=>{const u=JL[c.status]||{label:c.status,variant:"outline",icon:h.jsx(Ma,{className:"h-3 w-3"})},d=c.completed_at||c.started_at||c.created_at;let f=[];if(c.files_changed)try{f=typeof c.files_changed=="string"?JSON.parse(c.files_changed):c.files_changed}catch(p){console.error("Failed to parse files_changed:",p)}return h.jsx(It,{className:"cursor-pointer p-3 transition-colors hover:bg-accent",onClick:()=>l(c.id),children:h.jsx("div",{className:"flex items-start justify-between gap-3",children:h.jsxs("div",{className:"flex-1 space-y-1",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("code",{className:"font-mono text-xs text-muted-foreground",children:YL(c.id)}),h.jsxs(st,{variant:u.variant,className:"gap-1",children:[u.icon,u.label]})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[h.jsx("span",{children:c.model}),h.jsx("span",{children:"•"}),h.jsx("span",{className:"capitalize",children:c.mode}),h.jsx("span",{children:"•"}),h.jsx("span",{children:ZL(d)})]}),c.error&&h.jsxs("div",{className:"line-clamp-1 text-xs text-destructive",children:["Error: ",c.error]}),f.length>0&&h.jsxs("div",{className:"text-xs text-muted-foreground",children:[f.length," file(s) changed"]})]})})},c.id)})})]})}function QL(){const e=rs(),t=or({mutationFn:r=>co.create(r),onSuccess:()=>{e.invalidateQueries({queryKey:["issue-relationships"]})}}),n=or({mutationFn:r=>co.delete(r),onSuccess:()=>{e.invalidateQueries({queryKey:["issue-relationships"]})}});return{createRelationship:t.mutate,createRelationshipAsync:t.mutateAsync,deleteRelationship:n.mutate,deleteRelationshipAsync:n.mutateAsync,isCreating:t.isPending,isDeleting:n.isPending}}var uf={exports:{}},df={};/**
297
- * @license React
298
- * use-sync-external-store-shim.production.js
299
- *
300
- * Copyright (c) Meta Platforms, Inc. and affiliates.
301
- *
302
- * This source code is licensed under the MIT license found in the
303
- * LICENSE file in the root directory of this source tree.
304
- */var Qb;function eP(){if(Qb)return df;Qb=1;var e=Ow();function t(d,f){return d===f&&(d!==0||1/d===1/f)||d!==d&&f!==f}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,i=e.useLayoutEffect,o=e.useDebugValue;function a(d,f){var p=f(),m=r({inst:{value:p,getSnapshot:f}}),g=m[0].inst,b=m[1];return i(function(){g.value=p,g.getSnapshot=f,l(g)&&b({inst:g})},[d,p,f]),s(function(){return l(g)&&b({inst:g}),d(function(){l(g)&&b({inst:g})})},[d]),o(p),p}function l(d){var f=d.getSnapshot;d=d.value;try{var p=f();return!n(d,p)}catch{return!0}}function c(d,f){return f()}var u=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?c:a;return df.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:u,df}var ey;function pS(){return ey||(ey=1,uf.exports=eP()),uf.exports}var mS=pS();function tn(e){this.content=e}tn.prototype={constructor:tn,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return t==-1?void 0:this.content[t+1]},update:function(e,t,n){var r=n&&n!=e?this.remove(n):this,s=r.find(e),i=r.content.slice();return s==-1?i.push(n||e,t):(i[s+1]=t,n&&(i[s]=n)),new tn(i)},remove:function(e){var t=this.find(e);if(t==-1)return this;var n=this.content.slice();return n.splice(t,2),new tn(n)},addToStart:function(e,t){return new tn([e,t].concat(this.remove(e).content))},addToEnd:function(e,t){var n=this.remove(e).content.slice();return n.push(e,t),new tn(n)},addBefore:function(e,t,n){var r=this.remove(t),s=r.content.slice(),i=r.find(e);return s.splice(i==-1?s.length:i,0,t,n),new tn(s)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return e=tn.from(e),e.size?new tn(e.content.concat(this.subtract(e).content)):this},append:function(e){return e=tn.from(e),e.size?new tn(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var t=this;e=tn.from(e);for(var n=0;n<e.content.length;n+=2)t=t.remove(e.content[n]);return t},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}};tn.from=function(e){if(e instanceof tn)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new tn(t)};function gS(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let s=e.child(r),i=t.child(r);if(s==i){n+=s.nodeSize;continue}if(!s.sameMarkup(i))return n;if(s.isText&&s.text!=i.text){for(let o=0;s.text[o]==i.text[o];o++)n++;return n}if(s.content.size||i.content.size){let o=gS(s.content,i.content,n+1);if(o!=null)return o}n+=s.nodeSize}}function bS(e,t,n,r){for(let s=e.childCount,i=t.childCount;;){if(s==0||i==0)return s==i?null:{a:n,b:r};let o=e.child(--s),a=t.child(--i),l=o.nodeSize;if(o==a){n-=l,r-=l;continue}if(!o.sameMarkup(a))return{a:n,b:r};if(o.isText&&o.text!=a.text){let c=0,u=Math.min(o.text.length,a.text.length);for(;c<u&&o.text[o.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(o.content.size||a.content.size){let c=bS(o.content,a.content,n-1,r-1);if(c)return c}n-=l,r-=l}}class V{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,n,r,s=0,i){for(let o=0,a=0;a<n;o++){let l=this.content[o],c=a+l.nodeSize;if(c>t&&r(l,s+a,i||null,o)!==!1&&l.content.size){let u=a+1;l.nodesBetween(Math.max(0,t-u),Math.min(l.content.size,n-u),r,s+u)}a=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,s){let i="",o=!0;return this.nodesBetween(t,n,(a,l)=>{let c=a.isText?a.text.slice(Math.max(t,l)-l,n-l):a.isLeaf?s?typeof s=="function"?s(a):s:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(o?o=!1:i+=r),i+=c},0),i}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,s=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(s[s.length-1]=n.withText(n.text+r.text),i=1);i<t.content.length;i++)s.push(t.content[i]);return new V(s,this.size+t.size)}cut(t,n=this.size){if(t==0&&n==this.size)return this;let r=[],s=0;if(n>t)for(let i=0,o=0;o<n;i++){let a=this.content[i],l=o+a.nodeSize;l>t&&((o<t||l>n)&&(a.isText?a=a.cut(Math.max(0,t-o),Math.min(a.text.length,n-o)):a=a.cut(Math.max(0,t-o-1),Math.min(a.content.size,n-o-1))),r.push(a),s+=a.nodeSize),o=l}return new V(r,s)}cutByIndex(t,n){return t==n?V.empty:t==0&&n==this.content.length?this:new V(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let s=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return s[t]=n,new V(s,i)}addToStart(t){return new V([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new V(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(t.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(t){let n=this.content[t];if(!n)throw new RangeError("Index "+t+" out of range for "+this);return n}maybeChild(t){return this.content[t]||null}forEach(t){for(let n=0,r=0;n<this.content.length;n++){let s=this.content[n];t(s,r,n),r+=s.nodeSize}}findDiffStart(t,n=0){return gS(this,t,n)}findDiffEnd(t,n=this.size,r=t.size){return bS(this,t,n,r)}findIndex(t){if(t==0)return Il(0,t);if(t==this.size)return Il(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let s=this.child(n),i=r+s.nodeSize;if(i>=t)return i==t?Il(n+1,i):Il(n,r);r=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return V.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new V(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return V.empty;let n,r=0;for(let s=0;s<t.length;s++){let i=t[s];r+=i.nodeSize,s&&i.isText&&t[s-1].sameMarkup(i)?(n||(n=t.slice(0,s)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new V(n||t,r)}static from(t){if(!t)return V.empty;if(t instanceof V)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new V([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}V.empty=new V([],0);const ff={index:0,offset:0};function Il(e,t){return ff.index=e,ff.offset=t,ff}function Oc(e,t){if(e===t)return!0;if(!(e&&typeof e=="object")||!(t&&typeof t=="object"))return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!Oc(e[r],t[r]))return!1}else{for(let r in e)if(!(r in t)||!Oc(e[r],t[r]))return!1;for(let r in t)if(!(r in e))return!1}return!0}let ht=class Vh{constructor(t,n){this.type=t,this.attrs=n}addToSet(t){let n,r=!1;for(let s=0;s<t.length;s++){let i=t[s];if(this.eq(i))return t;if(this.type.excludes(i.type))n||(n=t.slice(0,s));else{if(i.type.excludes(this.type))return t;!r&&i.type.rank>this.type.rank&&(n||(n=t.slice(0,s)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return t.slice(0,n).concat(t.slice(n+1));return t}isInSet(t){for(let n=0;n<t.length;n++)if(this.eq(t[n]))return!0;return!1}eq(t){return this==t||this.type==t.type&&Oc(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let s=r.create(n.attrs);return r.checkAttrs(s.attrs),s}static sameSet(t,n){if(t==n)return!0;if(t.length!=n.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(n[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return Vh.none;if(t instanceof Vh)return[t];let n=t.slice();return n.sort((r,s)=>r.type.rank-s.type.rank),n}};ht.none=[];class Ic extends Error{}class se{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=xS(this.content,t+this.openStart,n);return r&&new se(r,this.openStart,this.openEnd)}removeBetween(t,n){return new se(yS(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return se.empty;let r=n.openStart||0,s=n.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new se(V.fromJSON(t,n.content),r,s)}static maxOpen(t,n=!0){let r=0,s=0;for(let i=t.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=t.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)s++;return new se(t,r,s)}}se.empty=new se(V.empty,0,0);function yS(e,t,n){let{index:r,offset:s}=e.findIndex(t),i=e.maybeChild(r),{index:o,offset:a}=e.findIndex(n);if(s==t||i.isText){if(a!=n&&!e.child(o).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(yS(i.content,t-s-1,n-s-1)))}function xS(e,t,n,r){let{index:s,offset:i}=e.findIndex(t),o=e.maybeChild(s);if(i==t||o.isText)return r&&!r.canReplace(s,s,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=xS(o.content,t-i-1,n,o);return a&&e.replaceChild(s,o.copy(a))}function tP(e,t,n){if(n.openStart>e.depth)throw new Ic("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Ic("Inconsistent open depths");return vS(e,t,n,0)}function vS(e,t,n,r){let s=e.index(r),i=e.node(r);if(s==t.index(r)&&r<e.depth-n.openStart){let o=vS(e,t,n,r+1);return i.copy(i.content.replaceChild(s,o))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&e.depth==r&&t.depth==r){let o=e.parent,a=o.content;return mi(o,a.cut(0,e.parentOffset).append(n.content).append(a.cut(t.parentOffset)))}else{let{start:o,end:a}=nP(n,e);return mi(i,kS(e,o,a,t,r))}else return mi(i,Dc(e,t,r))}function wS(e,t){if(!t.type.compatibleContent(e.type))throw new Ic("Cannot join "+t.type.name+" onto "+e.type.name)}function qh(e,t,n){let r=e.node(n);return wS(r,t.node(n)),r}function pi(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function ma(e,t,n,r){let s=(t||e).node(n),i=0,o=t?t.index(n):s.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(pi(e.nodeAfter,r),i++));for(let a=i;a<o;a++)pi(s.child(a),r);t&&t.depth==n&&t.textOffset&&pi(t.nodeBefore,r)}function mi(e,t){return e.type.checkContent(t),e.copy(t)}function kS(e,t,n,r,s){let i=e.depth>s&&qh(e,t,s+1),o=r.depth>s&&qh(n,r,s+1),a=[];return ma(null,e,s,a),i&&o&&t.index(s)==n.index(s)?(wS(i,o),pi(mi(i,kS(e,t,n,r,s+1)),a)):(i&&pi(mi(i,Dc(e,t,s+1)),a),ma(t,n,s,a),o&&pi(mi(o,Dc(n,r,s+1)),a)),ma(r,null,s,a),new V(a)}function Dc(e,t,n){let r=[];if(ma(null,e,n,r),e.depth>n){let s=qh(e,t,n+1);pi(mi(s,Dc(e,t,n+1)),r)}return ma(t,null,n,r),new V(r)}function nP(e,t){let n=t.depth-e.openStart,s=t.node(n).copy(e.content);for(let i=n-1;i>=0;i--)s=t.node(i).copy(V.from(s));return{start:s.resolveNoCache(e.openStart+n),end:s.resolveNoCache(s.content.size-e.openEnd-n)}}class La{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=t.child(n);return r?t.child(n).cut(r):s}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],s=n==0?0:this.path[n*3-1]+1;for(let i=0;i<t;i++)s+=r.child(i).nodeSize;return s}marks(){let t=this.parent,n=this.index();if(t.content.size==0)return ht.none;if(this.textOffset)return t.child(n).marks;let r=t.maybeChild(n-1),s=t.maybeChild(n);if(!r){let a=r;r=s,s=a}let i=r.marks;for(var o=0;o<i.length;o++)i[o].type.spec.inclusive===!1&&(!s||!i[o].isInSet(s.marks))&&(i=i[o--].removeFromSet(i));return i}marksAcross(t){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,s=t.parent.maybeChild(t.index());for(var i=0;i<r.length;i++)r[i].type.spec.inclusive===!1&&(!s||!r[i].isInSet(s.marks))&&(r=r[i--].removeFromSet(r));return r}sharedDepth(t){for(let n=this.depth;n>0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new Lc(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let n=1;n<=this.depth;n++)t+=(t?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return t+":"+this.parentOffset}static resolve(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],s=0,i=n;for(let o=t;;){let{index:a,offset:l}=o.content.findIndex(i),c=i-l;if(r.push(o,a,s+l),!c||(o=o.child(a),o.isText))break;i=c-1,s+=l+1}return new La(n,r,i)}static resolveCached(t,n){let r=ty.get(t);if(r)for(let i=0;i<r.elts.length;i++){let o=r.elts[i];if(o.pos==n)return o}else ty.set(t,r=new rP);let s=r.elts[r.i]=La.resolve(t,n);return r.i=(r.i+1)%sP,s}}class rP{constructor(){this.elts=[],this.i=0}}const sP=12,ty=new WeakMap;class Lc{constructor(t,n,r){this.$from=t,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const iP=Object.create(null);let Ls=class Wh{constructor(t,n,r,s=ht.none){this.type=t,this.attrs=n,this.marks=s,this.content=r||V.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,n,r,s=0){this.content.nodesBetween(t,n,r,s,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,n,r,s){return this.content.textBetween(t,n,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,n,r){return this.type==t&&Oc(this.attrs,n||t.defaultAttrs||iP)&&ht.sameSet(this.marks,r||ht.none)}copy(t=null){return t==this.content?this:new Wh(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new Wh(this.type,this.attrs,this.content,t)}cut(t,n=this.content.size){return t==0&&n==this.content.size?this:this.copy(this.content.cut(t,n))}slice(t,n=this.content.size,r=!1){if(t==n)return se.empty;let s=this.resolve(t),i=this.resolve(n),o=r?0:s.sharedDepth(n),a=s.start(o),c=s.node(o).content.cut(s.pos-a,i.pos-a);return new se(c,s.depth-o,i.depth-o)}replace(t,n,r){return tP(this.resolve(t),this.resolve(n),r)}nodeAt(t){for(let n=this;;){let{index:r,offset:s}=n.content.findIndex(t);if(n=n.maybeChild(r),!n)return null;if(s==t||n.isText)return n;t-=s+1}}childAfter(t){let{index:n,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(n),index:n,offset:r};let s=this.content.child(n-1);return{node:s,index:n-1,offset:r-s.nodeSize}}resolve(t){return La.resolveCached(this,t)}resolveNoCache(t){return La.resolve(this,t)}rangeHasMark(t,n,r){let s=!1;return n>t&&this.nodesBetween(t,n,i=>(r.isInSet(i.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),SS(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=V.empty,s=0,i=r.childCount){let o=this.contentMatchAt(t).matchFragment(r,s,i),a=o&&o.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=s;l<i;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(t,n,r,s){if(s&&!this.type.allowsMarks(s))return!1;let i=this.contentMatchAt(t).matchType(r),o=i&&i.matchFragment(this.content,n);return o?o.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=ht.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!ht.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let s=V.fromJSON(t,n.content),i=t.nodeType(n.type).create(n.attrs,s,r);return i.type.checkAttrs(i.attrs),i}};Ls.prototype.text=void 0;class Pc extends Ls{constructor(t,n,r,s){if(super(t,n,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):SS(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new Pc(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new Pc(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function SS(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class Ti{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new oP(t,n);if(r.next==null)return Ti.empty;let s=ES(r);r.next&&r.err("Unexpected trailing text");let i=hP(fP(s));return pP(i,r),i}matchType(t){for(let n=0;n<this.next.length;n++)if(this.next[n].type==t)return this.next[n].next;return null}matchFragment(t,n=0,r=t.childCount){let s=this;for(let i=n;s&&i<r;i++)s=s.matchType(t.child(i).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:n}=this.next[t];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(t){for(let n=0;n<this.next.length;n++)for(let r=0;r<t.next.length;r++)if(this.next[n].type==t.next[r].type)return!0;return!1}fillBefore(t,n=!1,r=0){let s=[this];function i(o,a){let l=o.matchFragment(t,r);if(l&&(!n||l.validEnd))return V.from(a.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:u,next:d}=o.next[c];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(d)==-1){s.push(d);let f=i(d,a.concat(u));if(f)return f}}return null}return i(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let n=this.computeWrapping(t);return this.wrapCache.push(t,n),n}computeWrapping(t){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),i=s.match;if(i.matchType(t)){let o=[];for(let a=s;a.type;a=a.via)o.push(a.type);return o.reverse()}for(let o=0;o<i.next.length;o++){let{type:a,next:l}=i.next[o];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!s.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:s}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let s=0;s<r.next.length;s++)t.indexOf(r.next[s].next)==-1&&n(r.next[s].next)}return n(this),t.map((r,s)=>{let i=s+(r.validEnd?"*":" ")+" ";for(let o=0;o<r.next.length;o++)i+=(o?", ":"")+r.next[o].type.name+"->"+t.indexOf(r.next[o].next);return i}).join(`
305
- `)}}Ti.empty=new Ti(!0);class oP{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function ES(e){let t=[];do t.push(aP(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function aP(e){let t=[];do t.push(lP(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function lP(e){let t=dP(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=cP(e,t);else break;return t}function ny(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function cP(e,t){let n=ny(e),r=n;return e.eat(",")&&(e.next!="}"?r=ny(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function uP(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let s=[];for(let i in n){let o=n[i];o.isInGroup(t)&&s.push(o)}return s.length==0&&e.err("No node type or group '"+t+"' found"),s}function dP(e){if(e.eat("(")){let t=ES(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=uP(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function fP(e){let t=[[]];return s(i(e,0),n()),t;function n(){return t.push([])-1}function r(o,a,l){let c={term:l,to:a};return t[o].push(c),c}function s(o,a){o.forEach(l=>l.to=a)}function i(o,a){if(o.type=="choice")return o.exprs.reduce((l,c)=>l.concat(i(c,a)),[]);if(o.type=="seq")for(let l=0;;l++){let c=i(o.exprs[l],a);if(l==o.exprs.length-1)return c;s(c,a=n())}else if(o.type=="star"){let l=n();return r(a,l),s(i(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return s(i(o.expr,a),l),s(i(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(a)].concat(i(o.expr,a));if(o.type=="range"){let l=a;for(let c=0;c<o.min;c++){let u=n();s(i(o.expr,l),u),l=u}if(o.max==-1)s(i(o.expr,l),l);else for(let c=o.min;c<o.max;c++){let u=n();r(l,u),s(i(o.expr,l),u),l=u}return[r(l)]}else{if(o.type=="name")return[r(a,void 0,o.value)];throw new Error("Unknown expr type")}}}}function CS(e,t){return t-e}function ry(e,t){let n=[];return r(t),n.sort(CS);function r(s){let i=e[s];if(i.length==1&&!i[0].term)return r(i[0].to);n.push(s);for(let o=0;o<i.length;o++){let{term:a,to:l}=i[o];!a&&n.indexOf(l)==-1&&r(l)}}}function hP(e){let t=Object.create(null);return n(ry(e,0));function n(r){let s=[];r.forEach(o=>{e[o].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let u=0;u<s.length;u++)s[u][0]==a&&(c=s[u][1]);ry(e,l).forEach(u=>{c||s.push([a,c=[]]),c.indexOf(u)==-1&&c.push(u)})})});let i=t[r.join(",")]=new Ti(r.indexOf(e.length-1)>-1);for(let o=0;o<s.length;o++){let a=s[o][1].sort(CS);i.next.push({type:s[o][0],next:t[a.join(",")]||n(a)})}return i}}function pP(e,t){for(let n=0,r=[e];n<r.length;n++){let s=r[n],i=!s.validEnd,o=[];for(let a=0;a<s.next.length;a++){let{type:l,next:c}=s.next[a];o.push(l.name),i&&!(l.isText||l.hasRequiredAttrs())&&(i=!1),r.indexOf(c)==-1&&r.push(c)}i&&t.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function NS(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function _S(e,t){let n=Object.create(null);for(let r in e){let s=t&&t[r];if(s===void 0){let i=e[r];if(i.hasDefault)s=i.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=s}return n}function TS(e,t,n,r){for(let s in t)if(!(s in e))throw new RangeError(`Unsupported attribute ${s} for ${n} of type ${s}`);for(let s in e){let i=e[s];i.validate&&i.validate(t[s])}}function AS(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new gP(e,r,t[r]);return n}let sy=class MS{constructor(t,n,r){this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=AS(t,r.attrs),this.defaultAttrs=NS(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Ti.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:_S(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Ls(this,this.computeAttrs(t),V.from(n),ht.setFrom(r))}createChecked(t=null,n,r){return n=V.from(n),this.checkContent(n),new Ls(this,this.computeAttrs(t),n,ht.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=V.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let s=this.contentMatch.matchFragment(n),i=s&&s.fillBefore(V.empty,!0);return i?new Ls(this,t,n.append(i),ht.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){TS(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;n<t.length;n++)if(!this.allowsMarkType(t[n].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let n;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?n&&n.push(t[r]):n||(n=t.slice(0,r));return n?n.length?n:ht.none:t}static compile(t,n){let r=Object.create(null);t.forEach((i,o)=>r[i]=new MS(i,n,o));let s=n.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function mP(e,t,n){let r=n.split("|");return s=>{let i=s===null?"null":typeof s;if(r.indexOf(i)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${i}`)}}class gP{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?mP(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class bd{constructor(t,n,r,s){this.name=t,this.rank=n,this.schema=r,this.spec=s,this.attrs=AS(t,s.attrs),this.excluded=null;let i=NS(this.attrs);this.instance=i?new ht(this,i):null}create(t=null){return!t&&this.instance?this.instance:new ht(this,_S(this.attrs,t))}static compile(t,n){let r=Object.create(null),s=0;return t.forEach((i,o)=>r[i]=new bd(i,s++,n,o)),r}removeFromSet(t){for(var n=0;n<t.length;n++)t[n].type==this&&(t=t.slice(0,n).concat(t.slice(n+1)),n--);return t}isInSet(t){for(let n=0;n<t.length;n++)if(t[n].type==this)return t[n]}checkAttrs(t){TS(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}}let RS=class{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let s in t)n[s]=t[s];n.nodes=tn.from(t.nodes),n.marks=tn.from(t.marks||{}),this.nodes=sy.compile(this.spec.nodes,this),this.marks=bd.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let i=this.nodes[s],o=i.spec.content||"",a=i.spec.marks;if(i.contentMatch=r[o]||(r[o]=Ti.parse(o,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=a=="_"?null:a?iy(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let s in this.marks){let i=this.marks[s],o=i.spec.excludes;i.excluded=o==null?[i]:o==""?[]:iy(this,o.split(" "))}this.nodeFromJSON=s=>Ls.fromJSON(this,s),this.markFromJSON=s=>ht.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,s){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof sy){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,s)}text(t,n){let r=this.nodes.text;return new Pc(r,r.defaultAttrs,t,ht.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}};function iy(e,t){let n=[];for(let r=0;r<t.length;r++){let s=t[r],i=e.marks[s],o=i;if(i)n.push(i);else for(let a in e.marks){let l=e.marks[a];(s=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(s)>-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function bP(e){return e.tag!=null}function yP(e){return e.style!=null}class Ps{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(s=>{if(bP(s))this.tags.push(s);else if(yP(s)){let i=/[^=]*/.exec(s.style)[0];r.indexOf(i)<0&&r.push(i),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let i=t.nodes[s.node];return i.contentMatch.matchType(i)})}parse(t,n={}){let r=new ay(this,n,!1);return r.addAll(t,ht.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new ay(this,n,!0);return r.addAll(t,ht.none,n.from,n.to),se.maxOpen(r.finish())}matchTag(t,n,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let i=this.tags[s];if(wP(t,i.tag)&&(i.namespace===void 0||t.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let o=i.getAttrs(t);if(o===!1)continue;i.attrs=o||void 0}return i}}}matchStyle(t,n,r,s){for(let i=s?this.styles.indexOf(s)+1:0;i<this.styles.length;i++){let o=this.styles[i],a=o.style;if(!(a.indexOf(t)!=0||o.context&&!r.matchesContext(o.context)||a.length>t.length&&(a.charCodeAt(t.length)!=61||a.slice(t.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(t){let n=[];function r(s){let i=s.priority==null?50:s.priority,o=0;for(;o<n.length;o++){let a=n[o];if((a.priority==null?50:a.priority)<i)break}n.splice(o,0,s)}for(let s in t.marks){let i=t.marks[s].spec.parseDOM;i&&i.forEach(o=>{r(o=ly(o)),o.mark||o.ignore||o.clearMark||(o.mark=s)})}for(let s in t.nodes){let i=t.nodes[s].spec.parseDOM;i&&i.forEach(o=>{r(o=ly(o)),o.node||o.ignore||o.mark||(o.node=s)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Ps(t,Ps.schemaRules(t)))}}const OS={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},xP={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},IS={ol:!0,ul:!0},Pa=1,Kh=2,ga=4;function oy(e,t,n){return t!=null?(t?Pa:0)|(t==="full"?Kh:0):e&&e.whitespace=="pre"?Pa|Kh:n&~ga}class Dl{constructor(t,n,r,s,i,o){this.type=t,this.attrs=n,this.marks=r,this.solid=s,this.options=o,this.content=[],this.activeMarks=ht.none,this.match=i||(o&ga?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(V.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(t.type))?(this.match=r,s):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Pa)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-s[0].length))}}let n=V.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(V.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!OS.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class ay{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=n.topNode,i,o=oy(null,n.preserveWhitespace,0)|(r?ga:0);s?i=new Dl(s.type,s.attrs,ht.none,!0,n.topMatch||s.type.contentMatch,o):r?i=new Dl(null,null,ht.none,!0,null,o):i=new Dl(t.schema.topNodeType,null,ht.none,!0,null,o),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,s=this.top,i=s.options&Kh?"full":this.localPreserveWS||(s.options&Pa)>0,{schema:o}=this.parser;if(i==="full"||s.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(i)if(i==="full")r=r.replace(/\r\n?/g,`
306
- `);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let a=r.split(/\r?\n|\r/);for(let l=0;l<a.length;l++)l&&this.insertNode(o.linebreakReplacement.create(),n,!0),a[l]&&this.insertNode(o.text(a[l]),n,!/\S/.test(a[l]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],l=t.previousSibling;(!a||l&&l.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(o.text(r),n,!/\S/.test(r)),this.findInText(t)}else this.findInside(t)}addElement(t,n,r){let s=this.localPreserveWS,i=this.top;(t.tagName=="PRE"||/pre/.test(t.style&&t.style.whiteSpace))&&(this.localPreserveWS=!0);let o=t.nodeName.toLowerCase(),a;IS.hasOwnProperty(o)&&this.parser.normalizeLists&&vP(t);let l=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(a=this.parser.matchTag(t,this,r));e:if(l?l.ignore:xP.hasOwnProperty(o))this.findInside(t),this.ignoreFallback(t,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(t=l.skip);let c,u=this.needsBlock;if(OS.hasOwnProperty(o))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),c=!0,i.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,n);break e}let d=l&&l.skip?n:this.readStyles(t,n);d&&this.addAll(t,d),c&&this.sync(i),this.needsBlock=u}else{let c=this.readStyles(t,n);c&&this.addElementByRule(t,l,c,l.consuming===!1?a:void 0)}this.localPreserveWS=s}leafFallback(t,n){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
307
- `),n)}ignoreFallback(t,n){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(t,n){let r=t.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let i=this.parser.matchedStyles[s],o=r.getPropertyValue(i);if(o)for(let a=void 0;;){let l=this.parser.matchStyle(i,o,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(c=>!l.clearMark(c)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(t,n,r,s){let i,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,t.nodeName=="BR")||this.leafFallback(t,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(i=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(o&&o.isLeaf)this.findInside(t);else if(s)this.addElement(t,r,s);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=t;typeof n.contentElement=="string"?l=t.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(t):n.contentElement&&(l=n.contentElement),this.findAround(t,l,!0),this.addAll(l,r),this.findAround(t,l,!1)}i&&this.sync(a)&&this.open--}addAll(t,n,r,s){let i=r||0;for(let o=r?t.childNodes[r]:t.firstChild,a=s==null?null:t.childNodes[s];o!=a;o=o.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(o,n);this.findAtPoint(t,i)}findPlace(t,n,r){let s,i;for(let o=this.open,a=0;o>=0;o--){let l=this.nodes[o],c=l.findWrapping(t);if(c&&(!s||s.length>c.length+a)&&(s=c,i=l,!c.length))break;if(l.solid){if(r)break;a+=2}}if(!s)return null;this.sync(i);for(let o=0;o<s.length;o++)n=this.enterInner(s[o],null,n,!1);return n}insertNode(t,n,r){if(t.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let s=this.findPlace(t,n,r);if(s){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(t.type));let o=ht.none;for(let a of s.concat(t.marks))(i.type?i.type.allowsMarkType(a.type):cy(a.type,t.type))&&(o=a.addToSet(o));return i.content.push(t.mark(o)),!0}return!1}enter(t,n,r,s){let i=this.findPlace(t.create(n),r,!1);return i&&(i=this.enterInner(t,n,r,!0,s)),i}enterInner(t,n,r,s=!1,i){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(t);let a=oy(t,i,o.options);o.options&ga&&o.content.length==0&&(a|=ga);let l=ht.none;return r=r.filter(c=>(o.type?o.type.allowsMarkType(c.type):cy(c.type,t))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Dl(t,n,l,s,null,a)),this.open++,r}closeExtra(t=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Pa)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let s=r.length-1;s>=0;s--)t+=r[s].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&t.nodeType==1&&t.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(t,n,r){if(t!=n&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&t.nodeType==1&&t.contains(this.find[s].node)&&n.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==t&&(this.find[n].pos=this.currentPos-(t.nodeValue.length-this.find[n].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(s?0:1),o=(a,l)=>{for(;a>=0;a--){let c=n[a];if(c==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(o(a-1,l))return!0;return!1}else{let u=l>0||l==0&&s?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!u||u.name!=c&&!u.isInGroup(c))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function vP(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&IS.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function wP(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ly(e){let t={};for(let n in e)t[n]=e[n];return t}function cy(e,t){let n=t.schema.nodes;for(let r in n){let s=n[r];if(!s.allowsMarkType(e))continue;let i=[],o=a=>{i.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:u}=a.edge(l);if(c==t||i.indexOf(u)<0&&o(u))return!0}};if(o(s.contentMatch))return!0}}class $i{constructor(t,n){this.nodes=t,this.marks=n}serializeFragment(t,n={},r){r||(r=hf(n).createDocumentFragment());let s=r,i=[];return t.forEach(o=>{if(i.length||o.marks.length){let a=0,l=0;for(;a<i.length&&l<o.marks.length;){let c=o.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(i[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<i.length;)s=i.pop()[1];for(;l<o.marks.length;){let c=o.marks[l++],u=this.serializeMark(c,o.isInline,n);u&&(i.push([c,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(o,n))}),r}serializeNodeInner(t,n){let{dom:r,contentDOM:s}=dc(hf(n),this.nodes[t.type.name](t),null,t.attrs);if(s){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,n,s)}return r}serializeNode(t,n={}){let r=this.serializeNodeInner(t,n);for(let s=t.marks.length-1;s>=0;s--){let i=this.serializeMark(t.marks[s],t.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(t,n,r={}){let s=this.marks[t.type.name];return s&&dc(hf(r),s(t,n),null,t.attrs)}static renderSpec(t,n,r=null,s){return dc(t,n,r,s)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new $i(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=uy(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return uy(t.marks)}}function uy(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function hf(e){return e.document||window.document}const dy=new WeakMap;function kP(e){let t=dy.get(e);return t===void 0&&dy.set(e,t=SP(e)),t}function SP(e){let t=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let s=0;s<r.length;s++)n(r[s]);else for(let s in r)n(r[s])}return n(e),t}function dc(e,t,n,r){if(typeof t=="string")return{dom:e.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let s=t[0],i;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(i=kP(r))&&i.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let o=s.indexOf(" ");o>0&&(n=s.slice(0,o),s=s.slice(o+1));let a,l=n?e.createElementNS(n,s):e.createElement(s),c=t[1],u=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){u=2;for(let d in c)if(c[d]!=null){let f=d.indexOf(" ");f>0?l.setAttributeNS(d.slice(0,f),d.slice(f+1),c[d]):d=="style"&&l.style?l.style.cssText=c[d]:l.setAttribute(d,c[d])}}for(let d=u;d<t.length;d++){let f=t[d];if(f===0){if(d<t.length-1||d>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:m}=dc(e,f,n,r);if(l.appendChild(p),m){if(a)throw new RangeError("Multiple content holes");a=m}}}return{dom:l,contentDOM:a}}const DS=65535,LS=Math.pow(2,16);function EP(e,t){return e+t*LS}function fy(e){return e&DS}function CP(e){return(e-(e&DS))/LS}const PS=1,jS=2,fc=4,zS=8;class Gh{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&zS)>0}get deletedBefore(){return(this.delInfo&(PS|fc))>0}get deletedAfter(){return(this.delInfo&(jS|fc))>0}get deletedAcross(){return(this.delInfo&fc)>0}}class Hn{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&Hn.empty)return Hn.empty}recover(t){let n=0,r=fy(t);if(!this.inverted)for(let s=0;s<r;s++)n+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+n+CP(t)}mapResult(t,n=1){return this._map(t,n,!1)}map(t,n=1){return this._map(t,n,!0)}_map(t,n,r){let s=0,i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?s:0);if(l>t)break;let c=this.ranges[a+i],u=this.ranges[a+o],d=l+c;if(t<=d){let f=c?t==l?-1:t==d?1:n:n,p=l+s+(f<0?0:u);if(r)return p;let m=t==(n<0?l:d)?null:EP(a/3,t-l),g=t==l?jS:t==d?PS:fc;return(n<0?t!=l:t!=d)&&(g|=zS),new Gh(p,g,m)}s+=u-c}return r?t+s:new Gh(t+s,0,null)}touches(t,n){let r=0,s=fy(n),i=this.inverted?2:1,o=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let c=this.ranges[a+i],u=l+c;if(t<=u&&a==s*3)return!0;r+=this.ranges[a+o]-c}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,i=0;s<this.ranges.length;s+=3){let o=this.ranges[s],a=o-(this.inverted?i:0),l=o+(this.inverted?0:i),c=this.ranges[s+n],u=this.ranges[s+r];t(a,a+c,l,l+u),i+=u-c}}invert(){return new Hn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?Hn.empty:new Hn(t<0?[0,-t,0]:[0,0,t])}}Hn.empty=new Hn([]);class ja{constructor(t,n,r=0,s=t?t.length:0){this.mirror=n,this.from=r,this.to=s,this._maps=t||[],this.ownData=!(t||n)}get maps(){return this._maps}slice(t=0,n=this.maps.length){return new ja(this._maps,this.mirror,t,n)}appendMap(t,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(t),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(t){for(let n=0,r=this._maps.length;n<t._maps.length;n++){let s=t.getMirror(n);this.appendMap(t._maps[n],s!=null&&s<n?r+s:void 0)}}getMirror(t){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==t)return this.mirror[n+(n%2?-1:1)]}}setMirror(t,n){this.mirror||(this.mirror=[]),this.mirror.push(t,n)}appendMappingInverted(t){for(let n=t.maps.length-1,r=this._maps.length+t._maps.length;n>=0;n--){let s=t.getMirror(n);this.appendMap(t._maps[n].invert(),s!=null&&s>n?r-s-1:void 0)}}invert(){let t=new ja;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;r<this.to;r++)t=this._maps[r].map(t,n);return t}mapResult(t,n=1){return this._map(t,n,!1)}_map(t,n,r){let s=0;for(let i=this.from;i<this.to;i++){let o=this._maps[i],a=o.mapResult(t,n);if(a.recover!=null){let l=this.getMirror(i);if(l!=null&&l>i&&l<this.to){i=l,t=this._maps[l].recover(a.recover);continue}}s|=a.delInfo,t=a.pos}return r?t:new Gh(t,s,null)}}const pf=Object.create(null);class bn{getMap(){return Hn.empty}merge(t){return null}static fromJSON(t,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=pf[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in pf)throw new RangeError("Duplicate use of step JSON ID "+t);return pf[t]=n,n.prototype.jsonID=t,n}}class Ft{constructor(t,n){this.doc=t,this.failed=n}static ok(t){return new Ft(t,null)}static fail(t){return new Ft(null,t)}static fromReplace(t,n,r,s){try{return Ft.ok(t.replace(n,r,s))}catch(i){if(i instanceof Ic)return Ft.fail(i.message);throw i}}}function Am(e,t,n){let r=[];for(let s=0;s<e.childCount;s++){let i=e.child(s);i.content.size&&(i=i.copy(Am(i.content,t,i))),i.isInline&&(i=t(i,n,s)),r.push(i)}return V.fromArray(r)}class As extends bn{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=t.resolve(this.from),s=r.node(r.sharedDepth(this.to)),i=new se(Am(n.content,(o,a)=>!o.isAtom||!a.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),s),n.openStart,n.openEnd);return Ft.fromReplace(t,this.from,this.to,i)}invert(){return new gr(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new As(n.pos,r.pos,this.mark)}merge(t){return t instanceof As&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new As(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new As(n.from,n.to,t.markFromJSON(n.mark))}}bn.jsonID("addMark",As);class gr extends bn{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new se(Am(n.content,s=>s.mark(this.mark.removeFromSet(s.marks)),t),n.openStart,n.openEnd);return Ft.fromReplace(t,this.from,this.to,r)}invert(){return new As(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new gr(n.pos,r.pos,this.mark)}merge(t){return t instanceof gr&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new gr(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new gr(n.from,n.to,t.markFromJSON(n.mark))}}bn.jsonID("removeMark",gr);class Ms extends bn{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Ft.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Ft.fromReplace(t,this.pos,this.pos+1,new se(V.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let s=0;s<n.marks.length;s++)if(!n.marks[s].isInSet(r))return new Ms(this.pos,n.marks[s]);return new Ms(this.pos,this.mark)}}return new Ai(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Ms(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ms(n.pos,t.markFromJSON(n.mark))}}bn.jsonID("addNodeMark",Ms);class Ai extends bn{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return Ft.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Ft.fromReplace(t,this.pos,this.pos+1,new se(V.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ms(this.pos,this.mark)}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new Ai(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ai(n.pos,t.markFromJSON(n.mark))}}bn.jsonID("removeNodeMark",Ai);class Yt extends bn{constructor(t,n,r,s=!1){super(),this.from=t,this.to=n,this.slice=r,this.structure=s}apply(t){return this.structure&&Jh(t,this.from,this.to)?Ft.fail("Structure replace would overwrite content"):Ft.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new Hn([this.from,this.to-this.from,this.slice.size])}invert(t){return new Yt(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Yt(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(t){if(!(t instanceof Yt)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let n=this.slice.size+t.slice.size==0?se.empty:new se(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new Yt(this.from,this.to+(t.to-t.from),n,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let n=this.slice.size+t.slice.size==0?se.empty:new se(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new Yt(t.from,this.to,n,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Yt(n.from,n.to,se.fromJSON(t,n.slice),!!n.structure)}}bn.jsonID("replace",Yt);class Xt extends bn{constructor(t,n,r,s,i,o,a=!1){super(),this.from=t,this.to=n,this.gapFrom=r,this.gapTo=s,this.slice=i,this.insert=o,this.structure=a}apply(t){if(this.structure&&(Jh(t,this.from,this.gapFrom)||Jh(t,this.gapTo,this.to)))return Ft.fail("Structure gap-replace would overwrite content");let n=t.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Ft.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Ft.fromReplace(t,this.from,this.to,r):Ft.fail("Content does not fit in gap")}getMap(){return new Hn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let n=this.gapTo-this.gapFrom;return new Xt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),s=this.from==this.gapFrom?n.pos:t.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||s<n.pos||i>r.pos?null:new Xt(n.pos,r.pos,s,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Xt(n.from,n.to,n.gapFrom,n.gapTo,se.fromJSON(t,n.slice),n.insert,!!n.structure)}}bn.jsonID("replaceAround",Xt);function Jh(e,t,n){let r=e.resolve(t),s=n-t,i=r.depth;for(;s>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,s--;if(s>0){let o=r.node(i).maybeChild(r.indexAfter(i));for(;s>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,s--}}return!1}function NP(e,t,n,r){let s=[],i=[],o,a;e.doc.nodesBetween(t,n,(l,c,u)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&u.type.allowsMarkType(r.type)){let f=Math.max(c,t),p=Math.min(c+l.nodeSize,n),m=r.addToSet(d);for(let g=0;g<d.length;g++)d[g].isInSet(m)||(o&&o.to==f&&o.mark.eq(d[g])?o.to=p:s.push(o=new gr(f,p,d[g])));a&&a.to==f?a.to=p:i.push(a=new As(f,p,r))}}),s.forEach(l=>e.step(l)),i.forEach(l=>e.step(l))}function _P(e,t,n,r){let s=[],i=0;e.doc.nodesBetween(t,n,(o,a)=>{if(!o.isInline)return;i++;let l=null;if(r instanceof bd){let c=o.marks,u;for(;u=r.isInSet(c);)(l||(l=[])).push(u),c=u.removeFromSet(c)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let c=Math.min(a+o.nodeSize,n);for(let u=0;u<l.length;u++){let d=l[u],f;for(let p=0;p<s.length;p++){let m=s[p];m.step==i-1&&d.eq(s[p].style)&&(f=m)}f?(f.to=c,f.step=i):s.push({style:d,from:Math.max(a,t),to:c,step:i})}}}),s.forEach(o=>e.step(new gr(o.from,o.to,o.style)))}function Mm(e,t,n,r=n.contentMatch,s=!0){let i=e.doc.nodeAt(t),o=[],a=t+1;for(let l=0;l<i.childCount;l++){let c=i.child(l),u=a+c.nodeSize,d=r.matchType(c.type);if(!d)o.push(new Yt(a,u,se.empty));else{r=d;for(let f=0;f<c.marks.length;f++)n.allowsMarkType(c.marks[f].type)||e.step(new gr(a,u,c.marks[f]));if(s&&c.isText&&n.whitespace!="pre"){let f,p=/\r?\n|\r/g,m;for(;f=p.exec(c.text);)m||(m=new se(V.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),o.push(new Yt(a+f.index,a+f.index+f[0].length,m))}}a=u}if(!r.validEnd){let l=r.fillBefore(V.empty,!0);e.replace(a,a,new se(l,0,0))}for(let l=o.length-1;l>=0;l--)e.step(o[l])}function TP(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Bo(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth;;--r){let s=e.$from.node(r),i=e.$from.index(r),o=e.$to.indexAfter(r);if(r<e.depth&&s.canReplace(i,o,n))return r;if(r==0||s.type.spec.isolating||!TP(s,i,o))break}return null}function AP(e,t,n){let{$from:r,$to:s,depth:i}=t,o=r.before(i+1),a=s.after(i+1),l=o,c=a,u=V.empty,d=0;for(let m=i,g=!1;m>n;m--)g||r.index(m)>0?(g=!0,u=V.from(r.node(m).copy(u)),d++):l--;let f=V.empty,p=0;for(let m=i,g=!1;m>n;m--)g||s.after(m+1)<s.end(m)?(g=!0,f=V.from(s.node(m).copy(f)),p++):c++;e.step(new Xt(l,c,o,a,new se(u.append(f),d,p),u.size-d,!0))}function Rm(e,t,n=null,r=e){let s=MP(e,t),i=s&&RP(r,t);return i?s.map(hy).concat({type:t,attrs:n}).concat(i.map(hy)):null}function hy(e){return{type:e,attrs:null}}function MP(e,t){let{parent:n,startIndex:r,endIndex:s}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let o=i.length?i[0]:t;return n.canReplaceWith(r,s,o)?i:null}function RP(e,t){let{parent:n,startIndex:r,endIndex:s}=e,i=n.child(r),o=t.contentMatch.findWrapping(i.type);if(!o)return null;let l=(o.length?o[o.length-1]:t).contentMatch;for(let c=r;l&&c<s;c++)l=l.matchType(n.child(c).type);return!l||!l.validEnd?null:o}function OP(e,t,n){let r=V.empty;for(let o=n.length-1;o>=0;o--){if(r.size){let a=n[o].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=V.from(n[o].type.create(n[o].attrs,r))}let s=t.start,i=t.end;e.step(new Xt(s,i,s,i,new se(r,0,0),n.length,!0))}function IP(e,t,n,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(o,a)=>{let l=typeof s=="function"?s(o):s;if(o.isTextblock&&!o.hasMarkup(r,l)&&DP(e.doc,e.mapping.slice(i).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!m?c=!1:!p&&m&&(c=!0)}c===!1&&BS(e,o,a,i),Mm(e,e.mapping.slice(i).map(a,1),r,void 0,c===null);let u=e.mapping.slice(i),d=u.map(a,1),f=u.map(a+o.nodeSize,1);return e.step(new Xt(d,f,d+1,f-1,new se(V.from(r.create(l,null,o.marks)),0,0),1,!0)),c===!0&&FS(e,o,a,i),!1}})}function FS(e,t,n,r){t.forEach((s,i)=>{if(s.isText){let o,a=/\r?\n|\r/g;for(;o=a.exec(s.text);){let l=e.mapping.slice(r).map(n+1+i+o.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}})}function BS(e,t,n,r){t.forEach((s,i)=>{if(s.type==s.type.schema.linebreakReplacement){let o=e.mapping.slice(r).map(n+1+i);e.replaceWith(o,o+1,t.type.schema.text(`
308
- `))}})}function DP(e,t,n){let r=e.resolve(t),s=r.index();return r.parent.canReplaceWith(s,s+1,n)}function LP(e,t,n,r,s){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let o=n.create(r,null,s||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,o);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Xt(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new se(V.from(o),0,0),1,!0))}function Yr(e,t,n=1,r){let s=e.resolve(t),i=s.depth-n,o=r&&r[r.length-1]||s.parent;if(i<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!o.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let c=s.depth-1,u=n-2;c>i;c--,u--){let d=s.node(c),f=s.index(c);if(d.type.spec.isolating)return!1;let p=d.content.cutByIndex(f,d.childCount),m=r&&r[u+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||d;if(!d.canReplace(f+1,d.childCount)||!g.type.validContent(p))return!1}let a=s.indexAfter(i),l=r&&r[0];return s.node(i).canReplaceWith(a,a,l?l.type:s.node(i+1).type)}function PP(e,t,n=1,r){let s=e.doc.resolve(t),i=V.empty,o=V.empty;for(let a=s.depth,l=s.depth-n,c=n-1;a>l;a--,c--){i=V.from(s.node(a).copy(i));let u=r&&r[c];o=V.from(u?u.type.create(u.attrs,o):s.node(a).copy(o))}e.step(new Yt(t,t,new se(i.append(o),n,n),!0))}function Zs(e,t){let n=e.resolve(t),r=n.index();return $S(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function jP(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let s=0;s<t.childCount;s++){let i=t.child(s),o=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(o),!n||!e.type.allowsMarks(i.marks))return!1}return n.validEnd}function $S(e,t){return!!(e&&t&&!e.isLeaf&&jP(e,t))}function yd(e,t,n=-1){let r=e.resolve(t);for(let s=r.depth;;s--){let i,o,a=r.index(s);if(s==r.depth?(i=r.nodeBefore,o=r.nodeAfter):n>0?(i=r.node(s+1),a++,o=r.node(s).maybeChild(a)):(i=r.node(s).maybeChild(a-1),o=r.node(s+1)),i&&!i.isTextblock&&$S(i,o)&&r.node(s).canReplace(a,a+1))return t;if(s==0)break;t=n<0?r.before(s):r.after(s)}}function zP(e,t,n){let r=null,{linebreakReplacement:s}=e.doc.type.schema,i=e.doc.resolve(t-n),o=i.node().type;if(s&&o.inlineContent){let u=o.whitespace=="pre",d=!!o.contentMatch.matchType(s);u&&!d?r=!1:!u&&d&&(r=!0)}let a=e.steps.length;if(r===!1){let u=e.doc.resolve(t+n);BS(e,u.node(),u.before(),a)}o.inlineContent&&Mm(e,t+n-1,o,i.node().contentMatchAt(i.index()),r==null);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new Yt(c,l.map(t+n,-1),se.empty,!0)),r===!0){let u=e.doc.resolve(c);FS(e,u.node(),u.before(),e.steps.length)}return e}function FP(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let i=r.index(s);if(r.node(s).canReplaceWith(i,i,n))return r.before(s+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let i=r.indexAfter(s);if(r.node(s).canReplaceWith(i,i,n))return r.after(s+1);if(i<r.node(s).childCount)return null}return null}function US(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let s=n.content;for(let i=0;i<n.openStart;i++)s=s.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let o=r.depth;o>=0;o--){let a=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(a>0?1:0),c=r.node(o),u=!1;if(i==1)u=c.canReplace(l,l,s);else{let d=c.contentMatchAt(l).findWrapping(s.firstChild.type);u=d&&c.canReplaceWith(l,l,d[0])}if(u)return a==0?r.pos:a<0?r.before(o+1):r.after(o+1)}return null}function xd(e,t,n=t,r=se.empty){if(t==n&&!r.size)return null;let s=e.resolve(t),i=e.resolve(n);return HS(s,i,r)?new Yt(t,n,r):new BP(s,i,r).fit()}function HS(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class BP{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=V.empty;for(let s=0;s<=t.depth;s++){let i=t.node(s);this.frontier.push({type:i.type,match:i.contentMatchAt(t.indexAfter(s))})}for(let s=t.depth;s>0;s--)this.placed=V.from(t.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(t<0?this.$to:r.doc.resolve(t));if(!s)return null;let i=this.placed,o=r.depth,a=s.depth;for(;o&&a&&i.childCount==1;)i=i.firstChild.content,o--,a--;let l=new se(i,o,a);return t>-1?new Xt(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Yt(r.pos,s.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<t;r++){let i=n.firstChild;if(n.childCount>1&&(s=0),i.type.spec.isolating&&s<=r){t=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let s,i=null;r?(i=mf(this.unplaced.content,r-1).firstChild,s=i.content):s=this.unplaced.content;let o=s.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],u,d=null;if(n==1&&(o?c.matchType(o.type)||(d=c.fillBefore(V.from(o),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:d};if(n==2&&o&&(u=c.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:u};if(i&&c.matchType(i.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,s=mf(t,n);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new se(t,n+1,Math.max(r,s.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,s=mf(t,n);if(s.childCount<=1&&n>0){let i=t.size-n<=n+s.size;this.unplaced=new se(sa(t,n-1,1),n-1,i?n-1:r)}else this.unplaced=new se(sa(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:s,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let o=this.unplaced,a=r?r.content:o.content,l=o.openStart-t,c=0,u=[],{match:d,type:f}=this.frontier[n];if(s){for(let g=0;g<s.childCount;g++)u.push(s.child(g));d=d.matchFragment(s)}let p=a.size+t-(o.content.size-o.openEnd);for(;c<a.childCount;){let g=a.child(c),b=d.matchType(g.type);if(!b)break;c++,(c>1||l==0||g.content.size)&&(d=b,u.push(VS(g.mark(f.allowedMarks(g.marks)),c==1?l:0,c==a.childCount?p:-1)))}let m=c==a.childCount;m||(p=-1),this.placed=ia(this.placed,n,V.from(u)),this.frontier[n].match=d,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,b=a;g<p;g++){let y=b.lastChild;this.frontier.push({type:y.type,match:y.contentMatchAt(y.childCount)}),b=y.content}this.unplaced=m?t==0?se.empty:new se(sa(o.content,t-1,1),t-1,p<0?o.openEnd:t-1):new se(sa(o.content,t,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],n;if(!t.type.isTextblock||!gf(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:s}=this.frontier[n],i=n<t.depth&&t.end(n+1)==t.pos+(t.depth-(n+1)),o=gf(t,n,s,r,i);if(o){for(let a=n-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],u=gf(t,a,c,l,!0);if(!u||u.childCount)continue e}return{depth:n,fit:o,move:i?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=ia(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let s=t.node(r),i=s.type.contentMatch.fillBefore(s.content,!0,t.index(r));this.openFrontierNode(s.type,s.attrs,i)}return t}openFrontierNode(t,n=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(t),this.placed=ia(this.placed,this.depth,V.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(V.empty,!0);n.childCount&&(this.placed=ia(this.placed,this.frontier.length,n))}}function sa(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(sa(e.firstChild.content,t-1,n)))}function ia(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(ia(e.lastChild.content,t-1,n)))}function mf(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function VS(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,VS(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(V.empty,!0)))),e.copy(r)}function gf(e,t,n,r,s){let i=e.node(t),o=s?e.indexAfter(t):e.index(t);if(o==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,o);return a&&!$P(n,i.content,o)?a:null}function $P(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}function UP(e){return e.spec.defining||e.spec.definingForContent}function HP(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let s=e.doc.resolve(t),i=e.doc.resolve(n);if(HS(s,i,r))return e.step(new Yt(t,n,r));let o=WS(s,e.doc.resolve(n));o[o.length-1]==0&&o.pop();let a=-(s.depth+1);o.unshift(a);for(let f=s.depth,p=s.pos-1;f>0;f--,p--){let m=s.node(f).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(f)>-1?a=f:s.before(f)==p&&o.splice(1,0,-f)}let l=o.indexOf(a),c=[],u=r.openStart;for(let f=r.content,p=0;;p++){let m=f.firstChild;if(c.push(m),p==r.openStart)break;f=m.content}for(let f=u-1;f>=0;f--){let p=c[f],m=UP(p.type);if(m&&!p.sameMarkup(s.node(Math.abs(a)-1)))u=f;else if(m||!p.type.isTextblock)break}for(let f=r.openStart;f>=0;f--){let p=(f+u+1)%(r.openStart+1),m=c[p];if(m)for(let g=0;g<o.length;g++){let b=o[(g+l)%o.length],y=!0;b<0&&(y=!1,b=-b);let w=s.node(b-1),v=s.index(b-1);if(w.canReplaceWith(v,v,m.type,m.marks))return e.replace(s.before(b),y?i.after(b):n,new se(qS(r.content,0,r.openStart,p),p,r.openEnd))}}let d=e.steps.length;for(let f=o.length-1;f>=0&&(e.replace(t,n,r),!(e.steps.length>d));f--){let p=o[f];p<0||(t=s.before(p),n=i.after(p))}}function qS(e,t,n,r,s){if(t<n){let i=e.firstChild;e=e.replaceChild(0,i.copy(qS(i.content,t+1,n,r,i)))}if(t>r){let i=s.contentMatchAt(0),o=i.fillBefore(e).append(e);e=o.append(i.matchFragment(o).fillBefore(V.empty,!0))}return e}function VP(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let s=FP(e.doc,t,r.type);s!=null&&(t=n=s)}e.replaceRange(t,n,new se(V.from(r),0,0))}function qP(e,t,n){let r=e.doc.resolve(t),s=e.doc.resolve(n),i=WS(r,s);for(let o=0;o<i.length;o++){let a=i[o],l=o==i.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return e.delete(r.start(a),s.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),s.indexAfter(a-1))))return e.delete(r.before(a),s.after(a))}for(let o=1;o<=r.depth&&o<=s.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&s.end(o)-n!=s.depth-o&&r.start(o-1)==s.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),s.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}function WS(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let s=r;s>=0;s--){let i=e.start(s);if(i<e.pos-(e.depth-s)||t.end(s)>t.pos+(t.depth-s)||e.node(s).type.spec.isolating||t.node(s).type.spec.isolating)break;(i==t.start(s)||s==e.depth&&s==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&s&&t.start(s-1)==i-1)&&n.push(s)}return n}class ho extends bn{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return Ft.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let s=n.type.create(r,null,n.marks);return Ft.fromReplace(t,this.pos,this.pos+1,new se(V.from(s),0,n.isLeaf?0:1))}getMap(){return Hn.empty}invert(t){return new ho(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new ho(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ho(n.pos,n.attr,n.value)}}bn.jsonID("attr",ho);class za extends bn{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return Ft.ok(r)}getMap(){return Hn.empty}invert(t){return new za(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new za(n.attr,n.value)}}bn.jsonID("docAttr",za);let ko=class extends Error{};ko=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};ko.prototype=Object.create(Error.prototype);ko.prototype.constructor=ko;ko.prototype.name="TransformError";class Om{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new ja}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new ko(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=se.empty){let s=xd(this.doc,t,n,r);return s&&this.step(s),this}replaceWith(t,n,r){return this.replace(t,n,new se(V.from(r),0,0))}delete(t,n){return this.replace(t,n,se.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return HP(this,t,n,r),this}replaceRangeWith(t,n,r){return VP(this,t,n,r),this}deleteRange(t,n){return qP(this,t,n),this}lift(t,n){return AP(this,t,n),this}join(t,n=1){return zP(this,t,n),this}wrap(t,n){return OP(this,t,n),this}setBlockType(t,n=t,r,s=null){return IP(this,t,n,r,s),this}setNodeMarkup(t,n,r=null,s){return LP(this,t,n,r,s),this}setNodeAttribute(t,n,r){return this.step(new ho(t,n,r)),this}setDocAttribute(t,n){return this.step(new za(t,n)),this}addNodeMark(t,n){return this.step(new Ms(t,n)),this}removeNodeMark(t,n){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n instanceof ht)n.isInSet(r.marks)&&this.step(new Ai(t,n));else{let s=r.marks,i,o=[];for(;i=n.isInSet(s);)o.push(new Ai(t,i)),s=i.removeFromSet(s);for(let a=o.length-1;a>=0;a--)this.step(o[a])}return this}split(t,n=1,r){return PP(this,t,n,r),this}addMark(t,n,r){return NP(this,t,n,r),this}removeMark(t,n,r){return _P(this,t,n,r),this}clearIncompatible(t,n,r){return Mm(this,t,n,r),this}}const bf=Object.create(null);class Re{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new KS(t.min(n),t.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let n=0;n<t.length;n++)if(t[n].$from.pos!=t[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,n=se.empty){let r=n.content.lastChild,s=null;for(let a=0;a<n.openEnd;a++)s=r,r=r.lastChild;let i=t.steps.length,o=this.ranges;for(let a=0;a<o.length;a++){let{$from:l,$to:c}=o[a],u=t.mapping.slice(i);t.replaceRange(u.map(l.pos),u.map(c.pos),a?se.empty:n),a==0&&gy(t,i,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(t,n){let r=t.steps.length,s=this.ranges;for(let i=0;i<s.length;i++){let{$from:o,$to:a}=s[i],l=t.mapping.slice(r),c=l.map(o.pos),u=l.map(a.pos);i?t.deleteRange(c,u):(t.replaceRangeWith(c,u,n),gy(t,r,n.isInline?-1:1))}}static findFrom(t,n,r=!1){let s=t.parent.inlineContent?new Ce(t):Gi(t.node(0),t.parent,t.pos,t.index(),n,r);if(s)return s;for(let i=t.depth-1;i>=0;i--){let o=n<0?Gi(t.node(0),t.node(i),t.before(i+1),t.index(i),n,r):Gi(t.node(0),t.node(i),t.after(i+1),t.index(i)+1,n,r);if(o)return o}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new qn(t.node(0))}static atStart(t){return Gi(t,t,0,0,1)||new qn(t)}static atEnd(t){return Gi(t,t,t.content.size,t.childCount,-1)||new qn(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=bf[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in bf)throw new RangeError("Duplicate use of selection JSON ID "+t);return bf[t]=n,n.prototype.jsonID=t,n}getBookmark(){return Ce.between(this.$anchor,this.$head).getBookmark()}}Re.prototype.visible=!0;class KS{constructor(t,n){this.$from=t,this.$to=n}}let py=!1;function my(e){!py&&!e.parent.inlineContent&&(py=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class Ce extends Re{constructor(t,n=t){my(t),my(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Re.near(r);let s=t.resolve(n.map(this.anchor));return new Ce(s.parent.inlineContent?s:r,r)}replace(t,n=se.empty){if(super.replace(t,n),n==se.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof Ce&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new vd(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Ce(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let s=t.resolve(n);return new this(s,r==n?s:t.resolve(r))}static between(t,n,r){let s=t.pos-n.pos;if((!r||s)&&(r=s>=0?1:-1),!n.parent.inlineContent){let i=Re.findFrom(n,r,!0)||Re.findFrom(n,-r,!0);if(i)n=i.$head;else return Re.near(n,r)}return t.parent.inlineContent||(s==0?t=n:(t=(Re.findFrom(t,-r,!0)||Re.findFrom(t,r,!0)).$anchor,t.pos<n.pos!=s<0&&(t=n))),new Ce(t,n)}}Re.jsonID("text",Ce);class vd{constructor(t,n){this.anchor=t,this.head=n}map(t){return new vd(t.map(this.anchor),t.map(this.head))}resolve(t){return Ce.between(t.resolve(this.anchor),t.resolve(this.head))}}class we extends Re{constructor(t){let n=t.nodeAfter,r=t.node(0).resolve(t.pos+n.nodeSize);super(t,r),this.node=n}map(t,n){let{deleted:r,pos:s}=n.mapResult(this.anchor),i=t.resolve(s);return r?Re.near(i):new we(i)}content(){return new se(V.from(this.node),0,0)}eq(t){return t instanceof we&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Im(this.anchor)}static fromJSON(t,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new we(t.resolve(n.anchor))}static create(t,n){return new we(t.resolve(n))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}}we.prototype.visible=!1;Re.jsonID("node",we);class Im{constructor(t){this.anchor=t}map(t){let{deleted:n,pos:r}=t.mapResult(this.anchor);return n?new vd(r,r):new Im(r)}resolve(t){let n=t.resolve(this.anchor),r=n.nodeAfter;return r&&we.isSelectable(r)?new we(n):Re.near(n)}}class qn extends Re{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,n=se.empty){if(n==se.empty){t.delete(0,t.doc.content.size);let r=Re.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,n)}toJSON(){return{type:"all"}}static fromJSON(t){return new qn(t)}map(t){return new qn(t)}eq(t){return t instanceof qn}getBookmark(){return WP}}Re.jsonID("all",qn);const WP={map(){return this},resolve(e){return new qn(e)}};function Gi(e,t,n,r,s,i=!1){if(t.inlineContent)return Ce.create(e,n);for(let o=r-(s>0?0:1);s>0?o<t.childCount:o>=0;o+=s){let a=t.child(o);if(a.isAtom){if(!i&&we.isSelectable(a))return we.create(e,n-(s<0?a.nodeSize:0))}else{let l=Gi(e,a,n+s,s<0?a.childCount:0,s,i);if(l)return l}n+=a.nodeSize*s}return null}function gy(e,t,n){let r=e.steps.length-1;if(r<t)return;let s=e.steps[r];if(!(s instanceof Yt||s instanceof Xt))return;let i=e.mapping.maps[r],o;i.forEach((a,l,c,u)=>{o==null&&(o=u)}),e.setSelection(Re.near(e.doc.resolve(o),n))}const by=1,Ll=2,yy=4;class KP extends Om{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|by)&~Ll,this.storedMarks=null,this}get selectionSet(){return(this.updated&by)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=Ll,this}ensureMarks(t){return ht.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ll)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~Ll,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||ht.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let s=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(s.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),!t)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let o=this.doc.resolve(n);i=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,s.text(t,i)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(Re.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=yy,this}get scrolledIntoView(){return(this.updated&yy)>0}}function xy(e,t){return!t||!e?e:e.bind(t)}class oa{constructor(t,n,r){this.name=t,this.init=xy(n.init,r),this.apply=xy(n.apply,r)}}const GP=[new oa("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new oa("selection",{init(e,t){return e.selection||Re.atStart(t.doc)},apply(e){return e.selection}}),new oa("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new oa("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class yf{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=GP.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new oa(r.key,r.spec.state,r))})}}class io{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let n=[t],r=this.applyInner(t),s=null;for(;;){let i=!1;for(let o=0;o<this.config.plugins.length;o++){let a=this.config.plugins[o];if(a.spec.appendTransaction){let l=s?s[o].n:0,c=s?s[o].state:this,u=l<n.length&&a.spec.appendTransaction.call(a,l?n.slice(l):n,c,r);if(u&&r.filterTransaction(u,o)){if(u.setMeta("appendedTransaction",t),!s){s=[];for(let d=0;d<this.config.plugins.length;d++)s.push(d<o?{state:r,n:n.length}:{state:this,n:0})}n.push(u),r=r.applyInner(u),i=!0}s&&(s[o]={state:r,n:n.length})}}if(!i)return{state:r,transactions:n}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new io(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let i=r[s];n[i.name]=i.apply(t,this[i.name],this,n)}return n}get tr(){return new KP(this)}static create(t){let n=new yf(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new io(n);for(let s=0;s<n.fields.length;s++)r[n.fields[s].name]=n.fields[s].init(t,r);return r}reconfigure(t){let n=new yf(this.schema,t.plugins),r=n.fields,s=new io(n);for(let i=0;i<r.length;i++){let o=r[i].name;s[o]=this.hasOwnProperty(o)?this[o]:r[i].init(t,s)}return s}toJSON(t){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=t[r],i=s.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(s,this[s.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let s=new yf(t.schema,t.plugins),i=new io(s);return s.fields.forEach(o=>{if(o.name=="doc")i.doc=Ls.fromJSON(t.schema,n.doc);else if(o.name=="selection")i.selection=Re.fromJSON(i.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==o.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[o.name]=c.fromJSON.call(l,t,n[a],i);return}}i[o.name]=o.init(t,i)}}),i}}function GS(e,t,n){for(let r in e){let s=e[r];s instanceof Function?s=s.bind(t):r=="handleDOMEvents"&&(s=GS(s,t,{})),n[r]=s}return n}class Et{constructor(t){this.spec=t,this.props={},t.props&&GS(t.props,this,this.props),this.key=t.key?t.key.key:JS("plugin")}getState(t){return t[this.key]}}const xf=Object.create(null);function JS(e){return e in xf?e+"$"+ ++xf[e]:(xf[e]=0,e+"$")}class Lt{constructor(t="key"){this.key=JS(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const Dm=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function ZS(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const YS=(e,t,n)=>{let r=ZS(e,n);if(!r)return!1;let s=Lm(r);if(!s){let o=r.blockRange(),a=o&&Bo(o);return a==null?!1:(t&&t(e.tr.lift(o,a).scrollIntoView()),!0)}let i=s.nodeBefore;if(oE(e,s,t,-1))return!0;if(r.parent.content.size==0&&(So(i,"end")||we.isSelectable(i)))for(let o=r.depth;;o--){let a=xd(e.doc,r.before(o),r.after(o),se.empty);if(a&&a.slice.size<a.to-a.from){if(t){let l=e.tr.step(a);l.setSelection(So(i,"end")?Re.findFrom(l.doc.resolve(l.mapping.map(s.pos,-1)),-1):we.create(l.doc,s.pos-i.nodeSize)),t(l.scrollIntoView())}return!0}if(o==1||r.node(o-1).childCount>1)break}return i.isAtom&&s.depth==r.depth-1?(t&&t(e.tr.delete(s.pos-i.nodeSize,s.pos).scrollIntoView()),!0):!1},JP=(e,t,n)=>{let r=ZS(e,n);if(!r)return!1;let s=Lm(r);return s?XS(e,s,t):!1},ZP=(e,t,n)=>{let r=eE(e,n);if(!r)return!1;let s=Pm(r);return s?XS(e,s,t):!1};function XS(e,t,n){let r=t.nodeBefore,s=r,i=t.pos-1;for(;!s.isTextblock;i--){if(s.type.spec.isolating)return!1;let u=s.lastChild;if(!u)return!1;s=u}let o=t.nodeAfter,a=o,l=t.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let u=a.firstChild;if(!u)return!1;a=u}let c=xd(e.doc,i,l,se.empty);if(!c||c.from!=i||c instanceof Yt&&c.slice.size>=l-i)return!1;if(n){let u=e.tr.step(c);u.setSelection(Ce.create(u.doc,i)),n(u.scrollIntoView())}return!0}function So(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const QS=(e,t,n)=>{let{$head:r,empty:s}=e.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=Lm(r)}let o=i&&i.nodeBefore;return!o||!we.isSelectable(o)?!1:(t&&t(e.tr.setSelection(we.create(e.doc,i.pos-o.nodeSize)).scrollIntoView()),!0)};function Lm(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function eE(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const tE=(e,t,n)=>{let r=eE(e,n);if(!r)return!1;let s=Pm(r);if(!s)return!1;let i=s.nodeAfter;if(oE(e,s,t,1))return!0;if(r.parent.content.size==0&&(So(i,"start")||we.isSelectable(i))){let o=xd(e.doc,r.before(),r.after(),se.empty);if(o&&o.slice.size<o.to-o.from){if(t){let a=e.tr.step(o);a.setSelection(So(i,"start")?Re.findFrom(a.doc.resolve(a.mapping.map(s.pos)),1):we.create(a.doc,a.mapping.map(s.pos))),t(a.scrollIntoView())}return!0}}return i.isAtom&&s.depth==r.depth-1?(t&&t(e.tr.delete(s.pos,s.pos+i.nodeSize).scrollIntoView()),!0):!1},nE=(e,t,n)=>{let{$head:r,empty:s}=e.selection,i=r;if(!s)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=Pm(r)}let o=i&&i.nodeAfter;return!o||!we.isSelectable(o)?!1:(t&&t(e.tr.setSelection(we.create(e.doc,i.pos)).scrollIntoView()),!0)};function Pm(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const YP=(e,t)=>{let n=e.selection,r=n instanceof we,s;if(r){if(n.node.isTextblock||!Zs(e.doc,n.from))return!1;s=n.from}else if(s=yd(e.doc,n.from,-1),s==null)return!1;if(t){let i=e.tr.join(s);r&&i.setSelection(we.create(i.doc,s-e.doc.resolve(s).nodeBefore.nodeSize)),t(i.scrollIntoView())}return!0},XP=(e,t)=>{let n=e.selection,r;if(n instanceof we){if(n.node.isTextblock||!Zs(e.doc,n.to))return!1;r=n.to}else if(r=yd(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},QP=(e,t)=>{let{$from:n,$to:r}=e.selection,s=n.blockRange(r),i=s&&Bo(s);return i==null?!1:(t&&t(e.tr.lift(s,i).scrollIntoView()),!0)},rE=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(`
309
- `).scrollIntoView()),!0)};function jm(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const e2=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let s=n.node(-1),i=n.indexAfter(-1),o=jm(s.contentMatchAt(i));if(!o||!s.canReplaceWith(i,i,o))return!1;if(t){let a=n.after(),l=e.tr.replaceWith(a,a,o.createAndFill());l.setSelection(Re.near(l.doc.resolve(a),1)),t(l.scrollIntoView())}return!0},sE=(e,t)=>{let n=e.selection,{$from:r,$to:s}=n;if(n instanceof qn||r.parent.inlineContent||s.parent.inlineContent)return!1;let i=jm(s.parent.contentMatchAt(s.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let o=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,a=e.tr.insert(o,i.createAndFill());a.setSelection(Ce.create(a.doc,o+1)),t(a.scrollIntoView())}return!0},iE=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Yr(e.doc,i))return t&&t(e.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),s=r&&Bo(r);return s==null?!1:(t&&t(e.tr.lift(r,s).scrollIntoView()),!0)};function t2(e){return(t,n)=>{let{$from:r,$to:s}=t.selection;if(t.selection instanceof we&&t.selection.node.isBlock)return!r.parentOffset||!Yr(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let i=[],o,a,l=!1,c=!1;for(let p=r.depth;;p--)if(r.node(p).isBlock){l=r.end(p)==r.pos+(r.depth-p),c=r.start(p)==r.pos-(r.depth-p),a=jm(r.node(p-1).contentMatchAt(r.indexAfter(p-1))),i.unshift(l&&a?{type:a}:null),o=p;break}else{if(p==1)return!1;i.unshift(null)}let u=t.tr;(t.selection instanceof Ce||t.selection instanceof qn)&&u.deleteSelection();let d=u.mapping.map(r.pos),f=Yr(u.doc,d,i.length,i);if(f||(i[0]=a?{type:a}:null,f=Yr(u.doc,d,i.length,i)),!f)return!1;if(u.split(d,i.length,i),!l&&c&&r.node(o).type!=a){let p=u.mapping.map(r.before(o)),m=u.doc.resolve(p);a&&r.node(o-1).canReplaceWith(m.index(),m.index()+1,a)&&u.setNodeMarkup(u.mapping.map(r.before(o)),a)}return n&&n(u.scrollIntoView()),!0}}const n2=t2(),r2=(e,t)=>{let{$from:n,to:r}=e.selection,s,i=n.sharedDepth(r);return i==0?!1:(s=n.before(i),t&&t(e.tr.setSelection(we.create(e.doc,s))),!0)};function s2(e,t,n){let r=t.nodeBefore,s=t.nodeAfter,i=t.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(i,i+1)||!(s.isTextblock||Zs(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function oE(e,t,n,r){let s=t.nodeBefore,i=t.nodeAfter,o,a,l=s.type.spec.isolating||i.type.spec.isolating;if(!l&&s2(e,t,n))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(o=(a=s.contentMatchAt(s.childCount)).findWrapping(i.type))&&a.matchType(o[0]||i.type).validEnd){if(n){let p=t.pos+i.nodeSize,m=V.empty;for(let y=o.length-1;y>=0;y--)m=V.from(o[y].create(null,m));m=V.from(s.copy(m));let g=e.tr.step(new Xt(t.pos-1,p,t.pos,p,new se(m,1,0),o.length,!0)),b=g.doc.resolve(p+2*o.length);b.nodeAfter&&b.nodeAfter.type==s.type&&Zs(g.doc,b.pos)&&g.join(b.pos),n(g.scrollIntoView())}return!0}let u=i.type.spec.isolating||r>0&&l?null:Re.findFrom(t,1),d=u&&u.$from.blockRange(u.$to),f=d&&Bo(d);if(f!=null&&f>=t.depth)return n&&n(e.tr.lift(d,f).scrollIntoView()),!0;if(c&&So(i,"start",!0)&&So(s,"end")){let p=s,m=[];for(;m.push(p),!p.isTextblock;)p=p.lastChild;let g=i,b=1;for(;!g.isTextblock;g=g.firstChild)b++;if(p.canReplace(p.childCount,p.childCount,g.content)){if(n){let y=V.empty;for(let v=m.length-1;v>=0;v--)y=V.from(m[v].copy(y));let w=e.tr.step(new Xt(t.pos-m.length,t.pos+i.nodeSize,t.pos+b,t.pos+i.nodeSize-b,new se(y,m.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function aE(e){return function(t,n){let r=t.selection,s=e<0?r.$from:r.$to,i=s.depth;for(;s.node(i).isInline;){if(!i)return!1;i--}return s.node(i).isTextblock?(n&&n(t.tr.setSelection(Ce.create(t.doc,e<0?s.start(i):s.end(i)))),!0):!1}}const i2=aE(-1),o2=aE(1);function a2(e,t=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i),a=o&&Rm(o,e,t);return a?(r&&r(n.tr.wrap(o,a).scrollIntoView()),!0):!1}}function vy(e,t=null){return function(n,r){let s=!1;for(let i=0;i<n.selection.ranges.length&&!s;i++){let{$from:{pos:o},$to:{pos:a}}=n.selection.ranges[i];n.doc.nodesBetween(o,a,(l,c)=>{if(s)return!1;if(!(!l.isTextblock||l.hasMarkup(e,t)))if(l.type==e)s=!0;else{let u=n.doc.resolve(c),d=u.index();s=u.parent.canReplaceWith(d,d+1,e)}})}if(!s)return!1;if(r){let i=n.tr;for(let o=0;o<n.selection.ranges.length;o++){let{$from:{pos:a},$to:{pos:l}}=n.selection.ranges[o];i.setBlockType(a,l,e,t)}r(i.scrollIntoView())}return!0}}function zm(...e){return function(t,n,r){for(let s=0;s<e.length;s++)if(e[s](t,n,r))return!0;return!1}}zm(Dm,YS,QS);zm(Dm,tE,nE);zm(rE,sE,iE,n2);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function l2(e,t=null){return function(n,r){let{$from:s,$to:i}=n.selection,o=s.blockRange(i);if(!o)return!1;let a=r?n.tr:null;return c2(a,o,e,t)?(r&&r(a.scrollIntoView()),!0):!1}}function c2(e,t,n,r=null){let s=!1,i=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let l=o.resolve(t.start-2);i=new Lc(l,l,t.depth),t.endIndex<t.parent.childCount&&(t=new Lc(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),s=!0}let a=Rm(i,n,r,t);return a?(e&&u2(e,t,a,s,n),!0):!1}function u2(e,t,n,r,s){let i=V.empty;for(let u=n.length-1;u>=0;u--)i=V.from(n[u].type.create(n[u].attrs,i));e.step(new Xt(t.start-(r?2:0),t.end,t.start,t.end,new se(i,0,0),n.length,!0));let o=0;for(let u=0;u<n.length;u++)n[u].type==s&&(o=u+1);let a=n.length-o,l=t.start+n.length-(r?2:0),c=t.parent;for(let u=t.startIndex,d=t.endIndex,f=!0;u<d;u++,f=!1)!f&&Yr(e.doc,l,a)&&(e.split(l,a),l+=2*a),l+=c.child(u).nodeSize;return e}function d2(e){return function(t,n){let{$from:r,$to:s}=t.selection,i=r.blockRange(s,o=>o.childCount>0&&o.firstChild.type==e);return i?n?r.node(i.depth-1).type==e?f2(t,n,e,i):h2(t,n,i):!0:!1}}function f2(e,t,n,r){let s=e.tr,i=r.end,o=r.$to.end(r.depth);i<o&&(s.step(new Xt(i-1,o,i,o,new se(V.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Lc(s.doc.resolve(r.$from.pos),s.doc.resolve(o),r.depth));const a=Bo(r);if(a==null)return!1;s.lift(r,a);let l=s.doc.resolve(s.mapping.map(i,-1)-1);return Zs(s.doc,l.pos)&&l.nodeBefore.type==l.nodeAfter.type&&s.join(l.pos),t(s.scrollIntoView()),!0}function h2(e,t,n){let r=e.tr,s=n.parent;for(let p=n.end,m=n.endIndex-1,g=n.startIndex;m>g;m--)p-=s.child(m).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),o=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==s.childCount,c=i.node(-1),u=i.index(-1);if(!c.canReplace(u+(a?0:1),u+1,o.content.append(l?V.empty:V.from(s))))return!1;let d=i.pos,f=d+o.nodeSize;return r.step(new Xt(d-(a?1:0),f+(l?1:0),d+1,f-1,new se((a?V.empty:V.from(s.copy(V.empty))).append(l?V.empty:V.from(s.copy(V.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}function p2(e){return function(t,n){let{$from:r,$to:s}=t.selection,i=r.blockRange(s,c=>c.childCount>0&&c.firstChild.type==e);if(!i)return!1;let o=i.startIndex;if(o==0)return!1;let a=i.parent,l=a.child(o-1);if(l.type!=e)return!1;if(n){let c=l.lastChild&&l.lastChild.type==a.type,u=V.from(c?e.create():null),d=new se(V.from(e.create(null,V.from(a.type.create(null,u)))),c?3:1,0),f=i.start,p=i.end;n(t.tr.step(new Xt(f-(c?3:1),p,f,p,d,1,!0)).scrollIntoView())}return!0}}const nn=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Eo=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let Zh=null;const Gr=function(e,t,n){let r=Zh||(Zh=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},m2=function(){Zh=null},Mi=function(e,t,n,r){return n&&(wy(e,t,n,r,-1)||wy(e,t,n,r,1))},g2=/^(img|br|input|textarea|hr)$/i;function wy(e,t,n,r,s){for(var i;;){if(e==n&&t==r)return!0;if(t==(s<0?0:ir(e))){let o=e.parentNode;if(!o||o.nodeType!=1||pl(e)||g2.test(e.nodeName)||e.contentEditable=="false")return!1;t=nn(e)+(s<0?0:1),e=o}else if(e.nodeType==1){let o=e.childNodes[t+(s<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((i=o.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)t+=s;else return!1;else e=o,t=s<0?ir(e):0}else return!1}}function ir(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function b2(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=ir(e)}else if(e.parentNode&&!pl(e))t=nn(e),e=e.parentNode;else return null}}function y2(e,t){for(;;){if(e.nodeType==3&&t<e.nodeValue.length)return e;if(e.nodeType==1&&t<e.childNodes.length){if(e.contentEditable=="false")return null;e=e.childNodes[t],t=0}else if(e.parentNode&&!pl(e))t=nn(e)+1,e=e.parentNode;else return null}}function x2(e,t,n){for(let r=t==0,s=t==ir(e);r||s;){if(e==n)return!0;let i=nn(e);if(e=e.parentNode,!e)return!1;r=r&&i==0,s=s&&i==ir(e)}}function pl(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const wd=function(e){return e.focusNode&&Mi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function ii(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}function v2(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}function w2(e,t,n){if(e.caretPositionFromPoint)try{let r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(ir(r.offsetNode),r.offset)}}catch{}if(e.caretRangeFromPoint){let r=e.caretRangeFromPoint(t,n);if(r)return{node:r.startContainer,offset:Math.min(ir(r.startContainer),r.startOffset)}}}const Dr=typeof navigator<"u"?navigator:null,ky=typeof document<"u"?document:null,Ys=Dr&&Dr.userAgent||"",Yh=/Edge\/(\d+)/.exec(Ys),lE=/MSIE \d/.exec(Ys),Xh=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ys),Dn=!!(lE||Xh||Yh),js=lE?document.documentMode:Xh?+Xh[1]:Yh?+Yh[1]:0,ar=!Dn&&/gecko\/(\d+)/i.test(Ys);ar&&+(/Firefox\/(\d+)/.exec(Ys)||[0,0])[1];const Qh=!Dn&&/Chrome\/(\d+)/.exec(Ys),hn=!!Qh,cE=Qh?+Qh[1]:0,Cn=!Dn&&!!Dr&&/Apple Computer/.test(Dr.vendor),Co=Cn&&(/Mobile\/\w+/.test(Ys)||!!Dr&&Dr.maxTouchPoints>2),tr=Co||(Dr?/Mac/.test(Dr.platform):!1),k2=Dr?/Win/.test(Dr.platform):!1,Zr=/Android \d/.test(Ys),ml=!!ky&&"webkitFontSmoothing"in ky.documentElement.style,S2=ml?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function E2(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Ur(e,t){return typeof e=="number"?e:e[t]}function C2(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function Sy(e,t,n){let r=e.someProp("scrollThreshold")||0,s=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=Eo(o);continue}let a=o,l=a==i.body,c=l?E2(i):C2(a),u=0,d=0;if(t.top<c.top+Ur(r,"top")?d=-(c.top-t.top+Ur(s,"top")):t.bottom>c.bottom-Ur(r,"bottom")&&(d=t.bottom-t.top>c.bottom-c.top?t.top+Ur(s,"top")-c.top:t.bottom-c.bottom+Ur(s,"bottom")),t.left<c.left+Ur(r,"left")?u=-(c.left-t.left+Ur(s,"left")):t.right>c.right-Ur(r,"right")&&(u=t.right-c.right+Ur(s,"right")),u||d)if(l)i.defaultView.scrollBy(u,d);else{let p=a.scrollLeft,m=a.scrollTop;d&&(a.scrollTop+=d),u&&(a.scrollLeft+=u);let g=a.scrollLeft-p,b=a.scrollTop-m;t={left:t.left-g,top:t.top-b,right:t.right-g,bottom:t.bottom-b}}let f=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(f))break;o=f=="absolute"?o.offsetParent:Eo(o)}}function N2(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,s;for(let i=(t.left+t.right)/2,o=n+1;o<Math.min(innerHeight,t.bottom);o+=5){let a=e.root.elementFromPoint(i,o);if(!a||a==e.dom||!e.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=n-20){r=a,s=l.top;break}}return{refDOM:r,refTop:s,stack:uE(e.dom)}}function uE(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Eo(r));return t}function _2({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;dE(n,r==0?0:r-t)}function dE(e,t){for(let n=0;n<e.length;n++){let{dom:r,top:s,left:i}=e[n];r.scrollTop!=s+t&&(r.scrollTop=s+t),r.scrollLeft!=i&&(r.scrollLeft=i)}}let Hi=null;function T2(e){if(e.setActive)return e.setActive();if(Hi)return e.focus(Hi);let t=uE(e);e.focus(Hi==null?{get preventScroll(){return Hi={preventScroll:!0},!0}}:void 0),Hi||(Hi=!1,dE(t,0))}function fE(e,t){let n,r=2e8,s,i=0,o=t.top,a=t.top,l,c;for(let u=e.firstChild,d=0;u;u=u.nextSibling,d++){let f;if(u.nodeType==1)f=u.getClientRects();else if(u.nodeType==3)f=Gr(u).getClientRects();else continue;for(let p=0;p<f.length;p++){let m=f[p];if(m.top<=o&&m.bottom>=a){o=Math.max(m.bottom,o),a=Math.min(m.top,a);let g=m.left>t.left?m.left-t.left:m.right<t.left?t.left-m.right:0;if(g<r){n=u,r=g,s=g&&n.nodeType==3?{left:m.right<t.left?m.right:m.left,top:t.top}:t,u.nodeType==1&&g&&(i=d+(t.left>=(m.left+m.right)/2?1:0));continue}}else m.top>t.top&&!l&&m.left<=t.left&&m.right>=t.left&&(l=u,c={left:Math.max(m.left,Math.min(m.right,t.left)),top:m.top});!n&&(t.left>=m.right&&t.top>=m.top||t.left>=m.left&&t.top>=m.bottom)&&(i=d+1)}}return!n&&l&&(n=l,s=c,r=0),n&&n.nodeType==3?A2(n,s):!n||r&&n.nodeType==1?{node:e,offset:i}:fE(n,s)}function A2(e,t){let n=e.nodeValue.length,r=document.createRange();for(let s=0;s<n;s++){r.setEnd(e,s+1),r.setStart(e,s);let i=bs(r,1);if(i.top!=i.bottom&&Fm(t,i))return{node:e,offset:s+(t.left>=(i.left+i.right)/2?1:0)}}return{node:e,offset:0}}function Fm(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function M2(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}function R2(e,t,n){let{node:r,offset:s}=fE(t,n),i=-1;if(r.nodeType==1&&!r.firstChild){let o=r.getBoundingClientRect();i=o.left!=o.right&&n.left>(o.left+o.right)/2?1:-1}return e.docView.posFromDOM(r,s,i)}function O2(e,t,n,r){let s=-1;for(let i=t,o=!1;i!=e.dom;){let a=e.docView.nearestDesc(i,!0),l;if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?s=a.posBefore:(!o&&l.right<r.left||l.bottom<r.top)&&(s=a.posAfter),o=!0),!a.contentDOM&&s<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return s>-1?s:e.docView.posFromDOM(t,n,-1)}function hE(e,t,n){let r=e.childNodes.length;if(r&&n.top<n.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=s;;){let o=e.childNodes[i];if(o.nodeType==1){let a=o.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(Fm(t,c))return hE(o,t,c)}}if((i=(i+1)%r)==s)break}return e}function I2(e,t){let n=e.dom.ownerDocument,r,s=0,i=w2(n,t.left,t.top);i&&({node:r,offset:s}=i);let o=(e.root.elementFromPoint?e.root:n).elementFromPoint(t.left,t.top),a;if(!o||!e.dom.contains(o.nodeType!=1?o.parentNode:o)){let c=e.dom.getBoundingClientRect();if(!Fm(t,c)||(o=hE(e.dom,t,c),!o))return null}if(Cn)for(let c=o;r&&c;c=Eo(c))c.draggable&&(r=void 0);if(o=M2(o,t),r){if(ar&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let u=r.childNodes[s],d;u.nodeName=="IMG"&&(d=u.getBoundingClientRect()).right<=t.left&&d.bottom>t.top&&s++}let c;ml&&s&&r.nodeType==1&&(c=r.childNodes[s-1]).nodeType==1&&c.contentEditable=="false"&&c.getBoundingClientRect().top>=t.top&&s--,r==e.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?a=e.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(a=O2(e,r,s,t))}a==null&&(a=R2(e,o,t));let l=e.docView.nearestDesc(o,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function Ey(e){return e.top<e.bottom||e.left<e.right}function bs(e,t){let n=e.getClientRects();if(n.length){let r=n[t<0?0:n.length-1];if(Ey(r))return r}return Array.prototype.find.call(n,Ey)||e.getBoundingClientRect()}const D2=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function pE(e,t,n){let{node:r,offset:s,atom:i}=e.docView.domFromPos(t,n<0?-1:1),o=ml||ar;if(r.nodeType==3)if(o&&(D2.test(r.nodeValue)||(n<0?!s:s==r.nodeValue.length))){let l=bs(Gr(r,s,s),n);if(ar&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=bs(Gr(r,s-1,s-1),-1);if(c.top==l.top){let u=bs(Gr(r,s,s+1),-1);if(u.top!=l.top)return Zo(u,u.left<c.left)}}return l}else{let l=s,c=s,u=n<0?1:-1;return n<0&&!s?(c++,u=-1):n>=0&&s==r.nodeValue.length?(l--,u=1):n<0?l--:c++,Zo(bs(Gr(r,l,c),u),u<0)}if(!e.state.doc.resolve(t-(i||0)).parent.inlineContent){if(i==null&&s&&(n<0||s==ir(r))){let l=r.childNodes[s-1];if(l.nodeType==1)return vf(l.getBoundingClientRect(),!1)}if(i==null&&s<ir(r)){let l=r.childNodes[s];if(l.nodeType==1)return vf(l.getBoundingClientRect(),!0)}return vf(r.getBoundingClientRect(),n>=0)}if(i==null&&s&&(n<0||s==ir(r))){let l=r.childNodes[s-1],c=l.nodeType==3?Gr(l,ir(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Zo(bs(c,1),!1)}if(i==null&&s<ir(r)){let l=r.childNodes[s];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?Gr(l,0,o?0:1):l.nodeType==1?l:null:null;if(c)return Zo(bs(c,-1),!0)}return Zo(bs(r.nodeType==3?Gr(r):r,-n),n>=0)}function Zo(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function vf(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function mE(e,t,n){let r=e.state,s=e.root.activeElement;r!=t&&e.updateState(t),s!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),s!=e.dom&&s&&s.focus()}}function L2(e,t,n){let r=t.selection,s=n=="up"?r.$from:r.$to;return mE(e,t,()=>{let{node:i}=e.docView.domFromPos(s.pos,n=="up"?-1:1);for(;;){let a=e.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let o=pE(e,s.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=Gr(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let u=l[c];if(u.bottom>u.top+1&&(n=="up"?o.top-u.top>(u.bottom-o.top)*2:u.bottom-o.bottom>(o.bottom-u.top)*2))return!1}}return!0})}const P2=/[\u0590-\u08ac]/;function j2(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,i=!s,o=s==r.parent.content.size,a=e.domSelection();return a?!P2.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:o:mE(e,t,()=>{let{focusNode:l,focusOffset:c,anchorNode:u,anchorOffset:d}=e.domSelectionRange(),f=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:m,focusOffset:g}=e.domSelectionRange(),b=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&c==g;try{a.collapse(u,d),l&&(l!=u||c!=d)&&a.extend&&a.extend(l,c)}catch{}return f!=null&&(a.caretBidiLevel=f),b}):r.pos==r.start()||r.pos==r.end()}let Cy=null,Ny=null,_y=!1;function z2(e,t,n){return Cy==t&&Ny==n?_y:(Cy=t,Ny=n,_y=n=="up"||n=="down"?L2(e,t,n):j2(e,t,n))}const lr=0,Ty=1,li=2,Lr=3;class gl{constructor(t,n,r,s){this.parent=t,this.children=n,this.dom=r,this.contentDOM=s,this.dirty=lr,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;n<this.children.length;n++)t+=this.children[n].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let n=0,r=this.posAtStart;;n++){let s=this.children[n];if(s==t)return r;r+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,n,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(r<0){let i,o;if(t==this.contentDOM)i=t.childNodes[n-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.previousSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(o)+o.size:this.posAtStart}else{let i,o;if(t==this.contentDOM)i=t.childNodes[n];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;i=t.nextSibling}for(;i&&!((o=i.pmViewDesc)&&o.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(o):this.posAtEnd}let s;if(t==this.dom&&this.contentDOM)s=n>nn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=t;;i=i.parentNode){if(i==this.dom){s=!1;break}if(i.previousSibling)break}if(s==null&&n==t.childNodes.length)for(let i=t;;i=i.parentNode){if(i==this.dom){s=!0;break}if(i.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,s=t;s;s=s.parentNode){let i=this.getDesc(s),o;if(i&&(!n||i.node))if(r&&(o=i.nodeDOM)&&!(o.nodeType==1?o.contains(t.nodeType==1?t:t.parentNode):o==t))r=!1;else return i}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let s=t;s;s=s.parentNode){let i=this.getDesc(s);if(i)return i.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;n<this.children.length;n++){let s=this.children[n],i=r+s.size;if(r==t&&i!=r){for(;!s.border&&s.children.length;)for(let o=0;o<s.children.length;o++){let a=s.children[o];if(a.size){s=a;break}}return s}if(t<i)return s.descAt(t-r-s.border);r=i}}domFromPos(t,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,s=0;for(let i=0;r<this.children.length;r++){let o=this.children[r],a=i+o.size;if(a>t||o instanceof bE){s=t-i;break}i=a}if(s)return this.children[r].domFromPos(s-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof gE&&i.side>=0;r--);if(n<=0){let i,o=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,o=!1);return i&&n&&o&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?nn(i.dom)+1:0}}else{let i,o=!0;for(;i=r<this.children.length?this.children[r]:null,!(!i||i.dom.parentNode==this.contentDOM);r++,o=!1);return i&&o&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?nn(i.dom):this.contentDOM.childNodes.length}}}parseRange(t,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,i=-1;for(let o=r,a=0;;a++){let l=this.children[a],c=o+l.size;if(s==-1&&t<=c){let u=o+l.border;if(t>=u&&n<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,n,u);t=o;for(let d=a;d>0;d--){let f=this.children[d-1];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(1)){s=nn(f.dom)+1;break}t-=f.size}s==-1&&(s=0)}if(s>-1&&(c>n||a==this.children.length-1)){n=c;for(let u=a+1;u<this.children.length;u++){let d=this.children[u];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(-1)){i=nn(d.dom);break}n+=d.size}i==-1&&(i=this.contentDOM.childNodes.length);break}o=c}return{node:this.contentDOM,from:t,to:n,fromOffset:s,toOffset:i}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[t<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(t)}domAfterPos(t){let{node:n,offset:r}=this.domFromPos(t,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+t);return n.childNodes[r]}setSelection(t,n,r,s=!1){let i=Math.min(t,n),o=Math.max(t,n);for(let p=0,m=0;p<this.children.length;p++){let g=this.children[p],b=m+g.size;if(i>m&&o<b)return g.setSelection(t-m-g.border,n-m-g.border,r,s);m=b}let a=this.domFromPos(t,t?-1:1),l=n==t?a:this.domFromPos(n,n?-1:1),c=r.root.getSelection(),u=r.domSelectionRange(),d=!1;if((ar||Cn)&&t==n){let{node:p,offset:m}=a;if(p.nodeType==3){if(d=!!(m&&p.nodeValue[m-1]==`
310
- `),d&&m==p.nodeValue.length)for(let g=p,b;g;g=g.parentNode){if(b=g.nextSibling){b.nodeName=="BR"&&(a=l={node:b.parentNode,offset:nn(b)+1});break}let y=g.pmViewDesc;if(y&&y.node&&y.node.isBlock)break}}else{let g=p.childNodes[m-1];d=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(ar&&u.focusNode&&u.focusNode!=l.node&&u.focusNode.nodeType==1){let p=u.focusNode.childNodes[u.focusOffset];p&&p.contentEditable=="false"&&(s=!0)}if(!(s||d&&Cn)&&Mi(a.node,a.offset,u.anchorNode,u.anchorOffset)&&Mi(l.node,l.offset,u.focusNode,u.focusOffset))return;let f=!1;if((c.extend||t==n)&&!(d&&ar)){c.collapse(a.node,a.offset);try{t!=n&&c.extend(l.node,l.offset),f=!0}catch{}}if(!f){if(t>n){let m=a;a=l,l=m}let p=document.createRange();p.setEnd(l.node,l.offset),p.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(p)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,s=0;s<this.children.length;s++){let i=this.children[s],o=r+i.size;if(r==o?t<=o&&n>=r:t<o&&n>r){let a=r+i.border,l=o-i.border;if(t>=a&&n<=l){this.dirty=t==r||n==o?li:Ty,t==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Lr:i.markDirty(t-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?li:Lr}r=o}this.dirty=li}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?li:Ty;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(t){return!1}}class gE extends gl{constructor(t,n,r,s){let i,o=n.type.toDOM;if(typeof o=="function"&&(o=o(r,()=>{if(!i)return s;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(o.nodeType!=1){let a=document.createElement("span");a.appendChild(o),o=a}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(t,[],o,null),this.widget=n,this.widget=n,i=this}matchesWidget(t){return this.dirty==lr&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class F2 extends gl{constructor(t,n,r,s){super(t,[],n,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class Ri extends gl{constructor(t,n,r,s,i){super(t,[],r,s),this.mark=n,this.spec=i}static create(t,n,r,s){let i=s.nodeViews[n.type.name],o=i&&i(n,s,r);return(!o||!o.dom)&&(o=$i.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Ri(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&Lr||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=Lr&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=lr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=lr}}slice(t,n,r){let s=Ri.create(this.parent,this.mark,!0,r),i=this.children,o=this.size;n<o&&(i=tp(i,n,o,r)),t>0&&(i=tp(i,0,t,r));for(let a=0;a<i.length;a++)i[a].parent=s;return s.children=i,s}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class zs extends gl{constructor(t,n,r,s,i,o,a,l,c){super(t,[],i,o),this.node=n,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=a}static create(t,n,r,s,i,o){let a=i.nodeViews[n.type.name],l,c=a&&a(n,i,()=>{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,s),u=c&&c.dom,d=c&&c.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:d}=$i.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!d&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let f=u;return u=vE(u,r,n),c?l=new B2(t,n,r,s,u,d||null,f,c,i,o+1):n.isText?new kd(t,n,r,s,u,f,i):new zs(t,n,r,s,u,d||null,f,i,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>V.empty)}return t}matchesNode(t,n,r){return this.dirty==lr&&t.eq(this.node)&&jc(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,s=n,i=t.composing?this.localCompositionInfo(t,n):null,o=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new U2(this,o&&o.node,t);q2(this.node,this.innerDeco,(c,u,d)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,t):c.type.side>=0&&!d&&l.syncToMarks(u==this.node.childCount?ht.none:this.node.child(u).marks,r,t),l.placeWidget(c,t,s)},(c,u,d,f)=>{l.syncToMarks(c.marks,r,t);let p;l.findNodeMatch(c,u,d,f)||a&&t.state.selection.from>s&&t.state.selection.to<s+c.nodeSize&&(p=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(c,u,d,p,t)||l.updateNextNode(c,u,d,t,f,s)||l.addNode(c,u,d,t,s),s+=c.nodeSize}),l.syncToMarks([],r,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==li)&&(o&&this.protectLocalComposition(t,o),yE(this.contentDOM,this.children,t),Co&&W2(this.dom))}localCompositionInfo(t,n){let{from:r,to:s}=t.state.selection;if(!(t.state.selection instanceof Ce)||r<n||s>n+this.node.content.size)return null;let i=t.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let o=i.nodeValue,a=K2(this.node.content,o,r-n,s-n);return a<0?null:{node:i,pos:a,text:o}}else return{node:i,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:s}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let o=new F2(this,i,n,s);t.input.compositionNodes.push(o),this.children=tp(this.children,r,r+s.length,t,o)}update(t,n,r,s){return this.dirty==Lr||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,s),!0)}updateInner(t,n,r,s){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=lr}updateOuterDeco(t){if(jc(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=xE(this.dom,this.nodeDOM,ep(this.outerDeco,this.node,n),ep(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Ay(e,t,n,r,s){vE(r,t,e);let i=new zs(void 0,e,t,n,r,r,r,s,0);return i.contentDOM&&i.updateChildren(s,0),i}class kd extends zs{constructor(t,n,r,s,i,o,a){super(t,n,r,s,i,null,o,a,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,s){return this.dirty==Lr||this.dirty!=lr&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=lr||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=t,this.dirty=lr,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let s=this.node.cut(t,n),i=document.createTextNode(s.text);return new kd(this.parent,s,this.outerDeco,this.innerDeco,i,i,r)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Lr)}get domAtom(){return!1}isText(t){return this.node.text==t}}class bE extends gl{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==lr&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class B2 extends zs{constructor(t,n,r,s,i,o,a,l,c,u){super(t,n,r,s,i,o,a,c,u),this.spec=l}update(t,n,r,s){if(this.dirty==Lr)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let i=this.spec.update(t,n,r);return i&&this.updateInner(t,n,r,s),i}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,s){this.spec.setSelection?this.spec.setSelection(t,n,r.root):super.setSelection(t,n,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function yE(e,t,n){let r=e.firstChild,s=!1;for(let i=0;i<t.length;i++){let o=t[i],a=o.dom;if(a.parentNode==e){for(;a!=r;)r=My(r),s=!0;r=r.nextSibling}else s=!0,e.insertBefore(a,r);if(o instanceof Ri){let l=r?r.previousSibling:e.lastChild;yE(o.contentDOM,o.children,n),r=l?l.nextSibling:e.firstChild}}for(;r;)r=My(r),s=!0;s&&n.trackWrites==e&&(n.trackWrites=null)}const ba=function(e){e&&(this.nodeName=e)};ba.prototype=Object.create(null);const ci=[new ba];function ep(e,t,n){if(e.length==0)return ci;let r=n?ci[0]:new ba,s=[r];for(let i=0;i<e.length;i++){let o=e[i].type.attrs;if(o){o.nodeName&&s.push(r=new ba(o.nodeName));for(let a in o){let l=o[a];l!=null&&(n&&s.length==1&&s.push(r=new ba(t.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return s}function xE(e,t,n,r){if(n==ci&&r==ci)return t;let s=t;for(let i=0;i<r.length;i++){let o=r[i],a=n[i];if(i){let l;a&&a.nodeName==o.nodeName&&s!=e&&(l=s.parentNode)&&l.nodeName.toLowerCase()==o.nodeName||(l=document.createElement(o.nodeName),l.pmIsDeco=!0,l.appendChild(s),a=ci[0]),s=l}$2(s,a||ci[0],o)}return s}function $2(e,t,n){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&e.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=t[r]&&e.setAttribute(r,n[r]);if(t.class!=n.class){let r=t.class?t.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<r.length;i++)s.indexOf(r[i])==-1&&e.classList.remove(r[i]);for(let i=0;i<s.length;i++)r.indexOf(s[i])==-1&&e.classList.add(s[i]);e.classList.length==0&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(t.style);)e.style.removeProperty(s[1])}n.style&&(e.style.cssText+=n.style)}}function vE(e,t,n){return xE(e,e,ci,ep(t,n,e.nodeType!=1))}function jc(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function My(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}class U2{constructor(t,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=H2(t.node.content,t)}destroyBetween(t,n){if(t!=n){for(let r=t;r<n;r++)this.top.children[r].destroy();this.top.children.splice(t,n-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,n,r){let s=0,i=this.stack.length>>1,o=Math.min(i,t.length);for(;s<o&&(s==i-1?this.top:this.stack[s+1<<1]).matchesMark(t[s])&&t[s].type.spec.spanning!==!1;)s++;for(;s<i;)this.destroyRest(),this.top.dirty=lr,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<t.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++){let c=this.top.children[l];if(c.matchesMark(t[i])&&!this.isLocked(c.dom)){a=l;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Ri.create(this.top,t[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(t,n,r,s){let i=-1,o;if(s>=this.preMatch.index&&(o=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&o.matchesNode(t,n,r))i=this.top.children.indexOf(o,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(t,n,r)&&!this.preMatch.matched.has(c)){i=a;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(t,n,r,s,i){let o=this.top.children[s];return o.dirty==Lr&&o.dom==o.contentDOM&&(o.dirty=li),o.update(t,n,r,i)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(t){for(;;){let n=t.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}t=n}}updateNextNode(t,n,r,s,i,o){for(let a=this.index;a<this.top.children.length;a++){let l=this.top.children[a];if(l instanceof zs){let c=this.preMatch.matched.get(l);if(c!=null&&c!=i)return!1;let u=l.dom,d,f=this.isLocked(u)&&!(t.isText&&l.node&&l.node.isText&&l.nodeDOM.nodeValue==t.text&&l.dirty!=Lr&&jc(n,l.outerDeco));if(!f&&l.update(t,n,r,s))return this.destroyBetween(this.index,a),l.dom!=u&&(this.changed=!0),this.index++,!0;if(!f&&(d=this.recreateWrapper(l,t,n,r,s,o)))return this.destroyBetween(this.index,a),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=li,d.updateChildren(s,o+1),d.dirty=lr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(t,n,r,s,i,o){if(t.dirty||n.isAtom||!t.children.length||!t.node.content.eq(n.content)||!jc(r,t.outerDeco)||!s.eq(t.innerDeco))return null;let a=zs.create(this.top,n,r,s,i,o);if(a.contentDOM){a.children=t.children,t.children=[];for(let l of a.children)l.parent=a}return t.destroy(),a}addNode(t,n,r,s,i){let o=zs.create(this.top,t,n,r,s,i);o.contentDOM&&o.updateChildren(s,i+1),this.top.children.splice(this.index++,0,o),this.changed=!0}placeWidget(t,n,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(t)&&(t==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let i=new gE(this.top,t,n,r);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],n=this.top;for(;t instanceof Ri;)n=t,t=n.children[n.children.length-1];(!t||!(t instanceof kd)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((Cn||hn)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(t,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new bE(this.top,[],r,null);n!=this.top?n.children.push(s):n.children.splice(this.index++,0,s),this.changed=!0}}isLocked(t){return this.lock&&(t==this.lock||t.nodeType==1&&t.contains(this.lock.parentNode))}}function H2(e,t){let n=t,r=n.children.length,s=e.childCount,i=new Map,o=[];e:for(;s>0;){let a;for(;;)if(r){let c=n.children[r-1];if(c instanceof Ri)n=c,r=c.children.length;else{a=c,r--;break}}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=e.child(s-1))break;--s,i.set(a,s),o.push(a)}}return{index:s,matched:i,matches:o.reverse()}}function V2(e,t){return e.type.side-t.type.side}function q2(e,t,n,r){let s=t.locals(e),i=0;if(s.length==0){for(let c=0;c<e.childCount;c++){let u=e.child(c);r(u,s,t.forChild(i,u),c),i+=u.nodeSize}return}let o=0,a=[],l=null;for(let c=0;;){let u,d;for(;o<s.length&&s[o].to==i;){let b=s[o++];b.widget&&(u?(d||(d=[u])).push(b):u=b)}if(u)if(d){d.sort(V2);for(let b=0;b<d.length;b++)n(d[b],c,!!l)}else n(u,c,!!l);let f,p;if(l)p=-1,f=l,l=null;else if(c<e.childCount)p=c,f=e.child(c++);else break;for(let b=0;b<a.length;b++)a[b].to<=i&&a.splice(b--,1);for(;o<s.length&&s[o].from<=i&&s[o].to>i;)a.push(s[o++]);let m=i+f.nodeSize;if(f.isText){let b=m;o<s.length&&s[o].from<b&&(b=s[o].from);for(let y=0;y<a.length;y++)a[y].to<b&&(b=a[y].to);b<m&&(l=f.cut(b-i),f=f.cut(0,b-i),m=b,p=-1)}else for(;o<s.length&&s[o].to<m;)o++;let g=f.isInline&&!f.isLeaf?a.filter(b=>!b.inline):a.slice();r(f,g,t.forChild(i,f),p),i=m}}function W2(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function K2(e,t,n,r){for(let s=0,i=0;s<e.childCount&&i<=r;){let o=e.child(s++),a=i;if(i+=o.nodeSize,!o.isText)continue;let l=o.text;for(;s<e.childCount;){let c=e.child(s++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;let c=a<r?l.lastIndexOf(t,r-a-1):-1;if(c>=0&&c+t.length+a>=n)return a+c;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}function tp(e,t,n,r,s){let i=[];for(let o=0,a=0;o<e.length;o++){let l=e[o],c=a,u=a+=l.size;c>=n||u<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),s&&(i.push(s),s=void 0),u>n&&i.push(l.slice(n-c,l.size,r)))}return i}function Bm(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let s=e.docView.nearestDesc(n.focusNode),i=s&&s.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let a=r.resolve(o),l,c;if(wd(n)){for(l=o;s&&!s.node;)s=s.parent;let d=s.node;if(s&&d.isAtom&&we.isSelectable(d)&&s.parent&&!(d.isInline&&x2(n.focusNode,n.focusOffset,s.dom))){let f=s.posBefore;c=new we(o==f?a:r.resolve(f))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let d=o,f=o;for(let p=0;p<n.rangeCount;p++){let m=n.getRangeAt(p);d=Math.min(d,e.docView.posFromDOM(m.startContainer,m.startOffset,1)),f=Math.max(f,e.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(d<0)return null;[l,o]=f==e.state.selection.anchor?[f,d]:[d,f],a=r.resolve(o)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}let u=r.resolve(l);if(!c){let d=t=="pointer"||e.state.selection.head<a.pos&&!i?1:-1;c=$m(e,u,a,d)}return c}function wE(e){return e.editable?e.hasFocus():SE(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function Xr(e,t=!1){let n=e.state.selection;if(kE(e,n),!!wE(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&hn){let r=e.domSelectionRange(),s=e.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&Mi(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){e.input.mouseDown.delayedSelectionSync=!0,e.domObserver.setCurSelection();return}}if(e.domObserver.disconnectSelection(),e.cursorWrapper)J2(e);else{let{anchor:r,head:s}=n,i,o;Ry&&!(n instanceof Ce)&&(n.$from.parent.inlineContent||(i=Oy(e,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(o=Oy(e,n.to))),e.docView.setSelection(r,s,e,t),Ry&&(i&&Iy(i),o&&Iy(o)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&G2(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Ry=Cn||hn&&cE<63;function Oy(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),s=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(Cn&&s&&s.contentEditable=="false")return wf(s);if((!s||s.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(s)return wf(s);if(i)return wf(i)}}function wf(e){return e.contentEditable="true",Cn&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Iy(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function G2(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,s=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=s)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!wE(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function J2(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName=="IMG";r?t.collapse(n.parentNode,nn(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Dn&&js<=11&&(n.disabled=!0,n.disabled=!1)}function kE(e,t){if(t instanceof we){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Dy(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Dy(e)}function Dy(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function $m(e,t,n,r){return e.someProp("createSelectionBetween",s=>s(e,t,n))||Ce.between(t,n,r)}function Ly(e){return e.editable&&!e.hasFocus()?!1:SE(e)}function SE(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function Z2(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return Mi(t.node,t.offset,n.anchorNode,n.anchorOffset)}function np(e,t){let{$anchor:n,$head:r}=e.selection,s=t>0?n.max(r):n.min(r),i=s.parent.inlineContent?s.depth?e.doc.resolve(t>0?s.after():s.before()):null:s;return i&&Re.findFrom(i,t)}function xs(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function Py(e,t,n){let r=e.state.selection;if(r instanceof Ce)if(n.indexOf("s")>-1){let{$head:s}=r,i=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let o=e.state.doc.resolve(s.pos+i.nodeSize*(t<0?-1:1));return xs(e,new Ce(r.$anchor,o))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let s=np(e.state,t);return s&&s instanceof we?xs(e,s):!1}else if(!(tr&&n.indexOf("m")>-1)){let s=r.$head,i=s.textOffset?null:t<0?s.nodeBefore:s.nodeAfter,o;if(!i||i.isText)return!1;let a=t<0?s.pos-i.nodeSize:s.pos;return i.isAtom||(o=e.docView.descAt(a))&&!o.contentDOM?we.isSelectable(i)?xs(e,new we(t<0?e.state.doc.resolve(s.pos-i.nodeSize):s)):ml?xs(e,new Ce(e.state.doc.resolve(t<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof we&&r.node.isInline)return xs(e,new Ce(t>0?r.$to:r.$from));{let s=np(e.state,t);return s?xs(e,s):!1}}}function zc(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function ya(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Vi(e,t){return t<0?Y2(e):X2(e)}function Y2(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let s,i,o=!1;for(ar&&n.nodeType==1&&r<zc(n)&&ya(n.childNodes[r],-1)&&(o=!0);;)if(r>0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(ya(a,-1))s=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(EE(n))break;{let a=n.previousSibling;for(;a&&ya(a,-1);)s=n.parentNode,i=nn(a),a=a.previousSibling;if(a)n=a,r=zc(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}o?rp(e,n,r):s&&rp(e,s,i)}function X2(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let s=zc(n),i,o;for(;;)if(r<s){if(n.nodeType!=1)break;let a=n.childNodes[r];if(ya(a,1))i=n,o=++r;else break}else{if(EE(n))break;{let a=n.nextSibling;for(;a&&ya(a,1);)i=a.parentNode,o=nn(a)+1,a=a.nextSibling;if(a)n=a,r=0,s=zc(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}i&&rp(e,i,o)}function EE(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function Q2(e,t){for(;e&&t==e.childNodes.length&&!pl(e);)t=nn(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=0}}function ej(e,t){for(;e&&!t&&!pl(e);)t=nn(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;e=n,t=e.childNodes.length}}function rp(e,t,n){if(t.nodeType!=3){let i,o;(o=Q2(t,n))?(t=o,n=0):(i=ej(t,n))&&(t=i,n=i.nodeValue.length)}let r=e.domSelection();if(!r)return;if(wd(r)){let i=document.createRange();i.setEnd(t,n),i.setStart(t,n),r.removeAllRanges(),r.addRange(i)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:s}=e;setTimeout(()=>{e.state==s&&Xr(e)},50)}function jy(e,t){let n=e.state.doc.resolve(t);if(!(hn||k2)&&n.parent.inlineContent){let s=e.coordsAtPos(t);if(t>n.start()){let i=e.coordsAtPos(t-1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left<s.left?"ltr":"rtl"}if(t<n.end()){let i=e.coordsAtPos(t+1),o=(i.top+i.bottom)/2;if(o>s.top&&o<s.bottom&&Math.abs(i.left-s.left)>1)return i.left>s.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function zy(e,t,n){let r=e.state.selection;if(r instanceof Ce&&!r.empty||n.indexOf("s")>-1||tr&&n.indexOf("m")>-1)return!1;let{$from:s,$to:i}=r;if(!s.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let o=np(e.state,t);if(o&&o instanceof we)return xs(e,o)}if(!s.parent.inlineContent){let o=t<0?s:i,a=r instanceof qn?Re.near(o,t):Re.findFrom(o,t);return a?xs(e,a):!1}return!1}function Fy(e,t){if(!(e.state.selection instanceof Ce))return!0;let{$head:n,$anchor:r,empty:s}=e.state.selection;if(!n.sameParent(r))return!0;if(!s)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let o=e.state.tr;return t<0?o.delete(n.pos-i.nodeSize,n.pos):o.delete(n.pos,n.pos+i.nodeSize),e.dispatch(o),!0}return!1}function By(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function tj(e){if(!Cn||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;By(e,r,"true"),setTimeout(()=>By(e,r,"false"),20)}return!1}function nj(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function rj(e,t){let n=t.keyCode,r=nj(t);if(n==8||tr&&n==72&&r=="c")return Fy(e,-1)||Vi(e,-1);if(n==46&&!t.shiftKey||tr&&n==68&&r=="c")return Fy(e,1)||Vi(e,1);if(n==13||n==27)return!0;if(n==37||tr&&n==66&&r=="c"){let s=n==37?jy(e,e.state.selection.from)=="ltr"?-1:1:-1;return Py(e,s,r)||Vi(e,s)}else if(n==39||tr&&n==70&&r=="c"){let s=n==39?jy(e,e.state.selection.from)=="ltr"?1:-1:1;return Py(e,s,r)||Vi(e,s)}else{if(n==38||tr&&n==80&&r=="c")return zy(e,-1,r)||Vi(e,-1);if(n==40||tr&&n==78&&r=="c")return tj(e)||zy(e,1,r)||Vi(e,1);if(r==(tr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Um(e,t){e.someProp("transformCopied",p=>{t=p(t,e)});let n=[],{content:r,openStart:s,openEnd:i}=t;for(;s>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let o=e.someProp("clipboardSerializer")||$i.fromSchema(e.state.schema),a=ME(),l=a.createElement("div");l.appendChild(o.serializeFragment(r,{document:a}));let c=l.firstChild,u,d=0;for(;c&&c.nodeType==1&&(u=AE[c.nodeName.toLowerCase()]);){for(let p=u.length-1;p>=0;p--){let m=a.createElement(u[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),d++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${s} ${i}${d?` -${d}`:""} ${JSON.stringify(n)}`);let f=e.someProp("clipboardTextSerializer",p=>p(t,e))||t.content.textBetween(0,t.content.size,`
311
-
312
- `);return{dom:l,text:f,slice:t}}function CE(e,t,n,r,s){let i=s.parent.type.spec.code,o,a;if(!n&&!t)return null;let l=!!t&&(r||i||!n);if(l){if(e.someProp("transformPastedText",f=>{t=f(t,i||r,e)}),i)return a=new se(V.from(e.state.schema.text(t.replace(/\r\n?/g,`
313
- `))),0,0),e.someProp("transformPasted",f=>{a=f(a,e,!0)}),a;let d=e.someProp("clipboardTextParser",f=>f(t,s,r,e));if(d)a=d;else{let f=s.marks(),{schema:p}=e.state,m=$i.fromSchema(p);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(g=>{let b=o.appendChild(document.createElement("p"));g&&b.appendChild(m.serializeNode(p.text(g,f)))})}}else e.someProp("transformPastedHTML",d=>{n=d(n,e)}),o=aj(n),ml&&lj(o);let c=o&&o.querySelector("[data-pm-slice]"),u=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let d=+u[3];d>0;d--){let f=o.firstChild;for(;f&&f.nodeType!=1;)f=f.nextSibling;if(!f)break;o=f}if(a||(a=(e.someProp("clipboardParser")||e.someProp("domParser")||Ps.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||u),context:s,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!sj.test(f.parentNode.nodeName)?{ignore:!0}:null}})),u)a=cj($y(a,+u[1],+u[2]),u[4]);else if(a=se.maxOpen(ij(a.content,s),!0),a.openStart||a.openEnd){let d=0,f=0;for(let p=a.content.firstChild;d<a.openStart&&!p.type.spec.isolating;d++,p=p.firstChild);for(let p=a.content.lastChild;f<a.openEnd&&!p.type.spec.isolating;f++,p=p.lastChild);a=$y(a,d,f)}return e.someProp("transformPasted",d=>{a=d(a,e,l)}),a}const sj=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function ij(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let s=t.node(n).contentMatchAt(t.index(n)),i,o=[];if(e.forEach(a=>{if(!o)return;let l=s.findWrapping(a.type),c;if(!l)return o=null;if(c=o.length&&i.length&&_E(l,i,a,o[o.length-1],0))o[o.length-1]=c;else{o.length&&(o[o.length-1]=TE(o[o.length-1],i.length));let u=NE(a,l);o.push(u),s=s.matchType(u.type),i=l}}),o)return V.from(o)}return e}function NE(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,V.from(e));return e}function _E(e,t,n,r,s){if(s<e.length&&s<t.length&&e[s]==t[s]){let i=_E(e,t,n,r.lastChild,s+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(s==e.length-1?n.type:e[s+1]))return r.copy(r.content.append(V.from(NE(n,e,s+1))))}}function TE(e,t){if(t==0)return e;let n=e.content.replaceChild(e.childCount-1,TE(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(V.empty,!0);return e.copy(n.append(r))}function sp(e,t,n,r,s,i){let o=t<0?e.firstChild:e.lastChild,a=o.content;return e.childCount>1&&(i=0),s<r-1&&(a=sp(a,t,n,r,s+1,i)),s>=n&&(a=t<0?o.contentMatchAt(0).fillBefore(a,i<=s).append(a):a.append(o.contentMatchAt(o.childCount).fillBefore(V.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(a))}function $y(e,t,n){return t<e.openStart&&(e=new se(sp(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new se(sp(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const AE={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Uy=null;function ME(){return Uy||(Uy=document.implementation.createHTMLDocument("title"))}let kf=null;function oj(e){let t=window.trustedTypes;return t?(kf||(kf=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),kf.createHTML(e)):e}function aj(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=ME().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),s;if((s=r&&AE[r[1].toLowerCase()])&&(e=s.map(i=>"<"+i+">").join("")+e+s.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=oj(e),s)for(let i=0;i<s.length;i++)n=n.querySelector(s[i])||n;return n}function lj(e){let t=e.querySelectorAll(hn?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}function cj(e,t){if(!e.size)return e;let n=e.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return e}let{content:s,openStart:i,openEnd:o}=e;for(let a=r.length-2;a>=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;s=V.from(l.create(r[a+1],s)),i++,o++}return new se(s,i,o)}const Nn={},_n={},uj={touchstart:!0,touchmove:!0};class dj{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function fj(e){for(let t in Nn){let n=Nn[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{pj(e,r)&&!Hm(e,r)&&(e.editable||!(r.type in _n))&&n(e,r)},uj[t]?{passive:!0}:void 0)}Cn&&e.dom.addEventListener("input",()=>null),ip(e)}function Rs(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function hj(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function ip(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>Hm(e,r))})}function Hm(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function pj(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function mj(e,t){!Hm(e,t)&&Nn[t.type]&&(e.editable||!(t.type in _n))&&Nn[t.type](e,t)}_n.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!OE(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(Zr&&hn&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),Co&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",s=>s(e,ii(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||rj(e,n)?n.preventDefault():Rs(e,"key")};_n.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};_n.keypress=(e,t)=>{let n=t;if(OE(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||tr&&n.metaKey)return;if(e.someProp("handleKeyPress",s=>s(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof Ce)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(n.charCode),i=()=>e.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!e.someProp("handleTextInput",o=>o(e,r.$from.pos,r.$to.pos,s,i))&&e.dispatch(i()),n.preventDefault()}};function Sd(e){return{left:e.clientX,top:e.clientY}}function gj(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function Vm(e,t,n,r,s){if(r==-1)return!1;let i=e.state.doc.resolve(r);for(let o=i.depth+1;o>0;o--)if(e.someProp(t,a=>o>i.depth?a(e,n,i.nodeAfter,i.before(o),s,!0):a(e,n,i.node(o),i.before(o),s,!1)))return!0;return!1}function po(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);r.setMeta("pointer",!0),e.dispatch(r)}function bj(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&we.isSelectable(r)?(po(e,new we(n)),!0):!1}function yj(e,t){if(t==-1)return!1;let n=e.state.selection,r,s;n instanceof we&&(r=n.node);let i=e.state.doc.resolve(t);for(let o=i.depth+1;o>0;o--){let a=o>i.depth?i.nodeAfter:i.node(o);if(we.isSelectable(a)){r&&n.$from.depth>0&&o>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?s=i.before(n.$from.depth):s=i.before(o);break}}return s!=null?(po(e,we.create(e.state.doc,s)),!0):!1}function xj(e,t,n,r,s){return Vm(e,"handleClickOn",t,n,r)||e.someProp("handleClick",i=>i(e,t,r))||(s?yj(e,n):bj(e,n))}function vj(e,t,n,r){return Vm(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",s=>s(e,t,r))}function wj(e,t,n,r){return Vm(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",s=>s(e,t,r))||kj(e,n,r)}function kj(e,t,n){if(n.button!=0)return!1;let r=e.state.doc;if(t==-1)return r.inlineContent?(po(e,Ce.create(r,0,r.content.size)),!0):!1;let s=r.resolve(t);for(let i=s.depth+1;i>0;i--){let o=i>s.depth?s.nodeAfter:s.node(i),a=s.before(i);if(o.inlineContent)po(e,Ce.create(r,a+1,a+1+o.content.size));else if(we.isSelectable(o))po(e,we.create(r,a));else continue;return!0}}function qm(e){return Fc(e)}const RE=tr?"metaKey":"ctrlKey";Nn.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=qm(e),s=Date.now(),i="singleClick";s-e.input.lastClick.time<500&&gj(n,e.input.lastClick)&&!n[RE]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?i="doubleClick":e.input.lastClick.type=="doubleClick"&&(i="tripleClick")),e.input.lastClick={time:s,x:n.clientX,y:n.clientY,type:i,button:n.button};let o=e.posAtCoords(Sd(n));o&&(i=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new Sj(e,o,n,!!r)):(i=="doubleClick"?vj:wj)(e,o.pos,o.inside,n)?n.preventDefault():Rs(e,"pointer"))};class Sj{constructor(t,n,r,s){this.view=t,this.pos=n,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[RE],this.allowDefault=r.shiftKey;let i,o;if(n.inside>-1)i=t.state.doc.nodeAt(n.inside),o=n.inside;else{let u=t.state.doc.resolve(n.pos);i=u.parent,o=u.depth?u.before():0}const a=s?null:r.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:c}=t.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||c instanceof we&&c.from<=o&&c.to>o)&&(this.mightDrag={node:i,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&ar&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Rs(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Xr(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Sd(t))),this.updateAllowDefault(t),this.allowDefault||!n?Rs(this.view,"pointer"):xj(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||Cn&&this.mightDrag&&!this.mightDrag.node.isAtom||hn&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(po(this.view,Re.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):Rs(this.view,"pointer")}move(t){this.updateAllowDefault(t),Rs(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}Nn.touchstart=e=>{e.input.lastTouch=Date.now(),qm(e),Rs(e,"pointer")};Nn.touchmove=e=>{e.input.lastTouch=Date.now(),Rs(e,"pointer")};Nn.contextmenu=e=>qm(e);function OE(e,t){return e.composing?!0:Cn&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const Ej=Zr?5e3:-1;_n.compositionstart=_n.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof Ce&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))e.markCursor=e.state.storedMarks||n.marks(),Fc(e,!0),e.markCursor=null;else if(Fc(e,!t.selection.empty),ar&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let s=r.focusNode,i=r.focusOffset;s&&s.nodeType==1&&i!=0;){let o=i<0?s.lastChild:s.childNodes[i-1];if(!o)break;if(o.nodeType==3){let a=e.domSelection();a&&a.collapse(o,o.nodeValue.length);break}else s=o,i=-1}}e.input.composing=!0}IE(e,Ej)};_n.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,IE(e,20))};function IE(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Fc(e),t))}function DE(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Nj());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Cj(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=b2(t.focusNode,t.focusOffset),r=y2(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let s=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!s||!s.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function Nj(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function Fc(e,t=!1){if(!(Zr&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),DE(e),t||e.docView&&e.docView.dirty){let n=Bm(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function _j(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const Fa=Dn&&js<15||Co&&S2<604;Nn.copy=_n.cut=(e,t)=>{let n=t,r=e.state.selection,s=n.type=="cut";if(r.empty)return;let i=Fa?null:n.clipboardData,o=r.content(),{dom:a,text:l}=Um(e,o);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):_j(e,a),s&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Tj(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function Aj(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Ba(e,r.value,null,s,t):Ba(e,r.textContent,r.innerHTML,s,t)},50)}function Ba(e,t,n,r,s){let i=CE(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",l=>l(e,s,i||se.empty)))return!0;if(!i)return!1;let o=Tj(i),a=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function LE(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}_n.paste=(e,t)=>{let n=t;if(e.composing&&!Zr)return;let r=Fa?null:n.clipboardData,s=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&Ba(e,LE(r),r.getData("text/html"),s,n)?n.preventDefault():Aj(e,n)};class PE{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}}const Mj=tr?"altKey":"ctrlKey";function jE(e,t){let n=e.someProp("dragCopies",r=>!r(t));return n??!t[Mj]}Nn.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let s=e.state.selection,i=s.empty?null:e.posAtCoords(Sd(n)),o;if(!(i&&i.pos>=s.from&&i.pos<=(s instanceof we?s.to-1:s.to))){if(r&&r.mightDrag)o=we.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let d=e.docView.nearestDesc(n.target,!0);d&&d.node.type.spec.draggable&&d!=e.docView&&(o=we.create(e.state.doc,d.posBefore))}}let a=(o||e.state.selection).content(),{dom:l,text:c,slice:u}=Um(e,a);(!n.dataTransfer.files.length||!hn||cE>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Fa?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Fa||n.dataTransfer.setData("text/plain",c),e.dragging=new PE(u,jE(e,n),o)};Nn.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};_n.dragover=_n.dragenter=(e,t)=>t.preventDefault();_n.drop=(e,t)=>{let n=t,r=e.dragging;if(e.dragging=null,!n.dataTransfer)return;let s=e.posAtCoords(Sd(n));if(!s)return;let i=e.state.doc.resolve(s.pos),o=r&&r.slice;o?e.someProp("transformPasted",m=>{o=m(o,e,!1)}):o=CE(e,LE(n.dataTransfer),Fa?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&jE(e,n));if(e.someProp("handleDrop",m=>m(e,n,o||se.empty,a))){n.preventDefault();return}if(!o)return;n.preventDefault();let l=o?US(e.state.doc,i.pos,o):i.pos;l==null&&(l=i.pos);let c=e.state.tr;if(a){let{node:m}=r;m?m.replace(c):c.deleteSelection()}let u=c.mapping.map(l),d=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,f=c.doc;if(d?c.replaceRangeWith(u,u,o.content.firstChild):c.replaceRange(u,u,o),c.doc.eq(f))return;let p=c.doc.resolve(u);if(d&&we.isSelectable(o.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(o.content.firstChild))c.setSelection(new we(p));else{let m=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((g,b,y,w)=>m=w),c.setSelection($m(e,p,c.doc.resolve(m)))}e.focus(),e.dispatch(c.setMeta("uiEvent","drop"))};Nn.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Xr(e)},20))};Nn.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};Nn.beforeinput=(e,t)=>{if(hn&&Zr&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",i=>i(e,ii(8,"Backspace")))))return;let{$cursor:s}=e.state.selection;s&&s.pos>0&&e.dispatch(e.state.tr.delete(s.pos-1,s.pos).scrollIntoView())},50)}};for(let e in _n)Nn[e]=_n[e];function $a(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Bc{constructor(t,n){this.toDOM=t,this.spec=n||gi,this.side=this.spec.side||0}map(t,n,r,s){let{pos:i,deleted:o}=t.mapResult(n.from+s,this.side<0?-1:1);return o?null:new Wt(i-r,i-r,this)}valid(){return!0}eq(t){return this==t||t instanceof Bc&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&$a(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class Fs{constructor(t,n){this.attrs=t,this.spec=n||gi}map(t,n,r,s){let i=t.map(n.from+s,this.spec.inclusiveStart?-1:1)-r,o=t.map(n.to+s,this.spec.inclusiveEnd?1:-1)-r;return i>=o?null:new Wt(i,o,this)}valid(t,n){return n.from<n.to}eq(t){return this==t||t instanceof Fs&&$a(this.attrs,t.attrs)&&$a(this.spec,t.spec)}static is(t){return t.type instanceof Fs}destroy(){}}class Wm{constructor(t,n){this.attrs=t,this.spec=n||gi}map(t,n,r,s){let i=t.mapResult(n.from+s,1);if(i.deleted)return null;let o=t.mapResult(n.to+s,-1);return o.deleted||o.pos<=i.pos?null:new Wt(i.pos-r,o.pos-r,this)}valid(t,n){let{index:r,offset:s}=t.content.findIndex(n.from),i;return s==n.from&&!(i=t.child(r)).isText&&s+i.nodeSize==n.to}eq(t){return this==t||t instanceof Wm&&$a(this.attrs,t.attrs)&&$a(this.spec,t.spec)}destroy(){}}class Wt{constructor(t,n,r){this.from=t,this.to=n,this.type=r}copy(t,n){return new Wt(t,n,this.type)}eq(t,n=0){return this.type.eq(t.type)&&this.from+n==t.from&&this.to+n==t.to}map(t,n,r){return this.type.map(t,this,n,r)}static widget(t,n,r){return new Wt(t,t,new Bc(n,r))}static inline(t,n,r,s){return new Wt(t,n,new Fs(r,s))}static node(t,n,r,s){return new Wt(t,n,new Wm(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof Fs}get widget(){return this.type instanceof Bc}}const Ji=[],gi={};class ft{constructor(t,n){this.local=t.length?t:Ji,this.children=n.length?n:Ji}static create(t,n){return n.length?$c(n,t,0,gi):cn}find(t,n,r){let s=[];return this.findInner(t??0,n??1e9,s,0,r),s}findInner(t,n,r,s,i){for(let o=0;o<this.local.length;o++){let a=this.local[o];a.from<=n&&a.to>=t&&(!i||i(a.spec))&&r.push(a.copy(a.from+s,a.to+s))}for(let o=0;o<this.children.length;o+=3)if(this.children[o]<n&&this.children[o+1]>t){let a=this.children[o]+1;this.children[o+2].findInner(t-a,n-a,r,s+a,i)}}map(t,n,r){return this==cn||t.maps.length==0?this:this.mapInner(t,n,0,0,r||gi)}mapInner(t,n,r,s,i){let o;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(t,r,s);l&&l.type.valid(n,l)?(o||(o=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?Rj(this.children,o||[],t,n,r,s,i):o?new ft(o.sort(bi),Ji):cn}add(t,n){return n.length?this==cn?ft.create(t,n):this.addInner(t,n,0):this}addInner(t,n,r){let s,i=0;t.forEach((a,l)=>{let c=l+r,u;if(u=FE(n,a,c)){for(s||(s=this.children.slice());i<s.length&&s[i]<l;)i+=3;s[i]==l?s[i+2]=s[i+2].addInner(a,u,c+1):s.splice(i,0,l,l+a.nodeSize,$c(u,a,c+1,gi)),i+=3}});let o=zE(i?BE(n):n,-r);for(let a=0;a<o.length;a++)o[a].type.valid(t,o[a])||o.splice(a--,1);return new ft(o.length?this.local.concat(o).sort(bi):this.local,s||this.children)}remove(t){return t.length==0||this==cn?this:this.removeInner(t,0)}removeInner(t,n){let r=this.children,s=this.local;for(let i=0;i<r.length;i+=3){let o,a=r[i]+n,l=r[i+1]+n;for(let u=0,d;u<t.length;u++)(d=t[u])&&d.from>a&&d.to<l&&(t[u]=null,(o||(o=[])).push(d));if(!o)continue;r==this.children&&(r=this.children.slice());let c=r[i+2].removeInner(o,a+1);c!=cn?r[i+2]=c:(r.splice(i,3),i-=3)}if(s.length){for(let i=0,o;i<t.length;i++)if(o=t[i])for(let a=0;a<s.length;a++)s[a].eq(o,n)&&(s==this.local&&(s=this.local.slice()),s.splice(a--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new ft(s,r):cn}forChild(t,n){if(this==cn)return this;if(n.isLeaf)return ft.empty;let r,s;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=t){this.children[a]==t&&(r=this.children[a+2]);break}let i=t+1,o=i+n.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<o&&l.to>i&&l.type instanceof Fs){let c=Math.max(i,l.from)-i,u=Math.min(o,l.to)-i;c<u&&(s||(s=[])).push(l.copy(c,u))}}if(s){let a=new ft(s.sort(bi),Ji);return r?new Ss([a,r]):a}return r||cn}eq(t){if(this==t)return!0;if(!(t instanceof ft)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=t.children[n]||this.children[n+1]!=t.children[n+1]||!this.children[n+2].eq(t.children[n+2]))return!1;return!0}locals(t){return Km(this.localsInner(t))}localsInner(t){if(this==cn)return Ji;if(t.inlineContent||!this.local.some(Fs.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof Fs||n.push(this.local[r]);return n}forEachSet(t){t(this)}}ft.empty=new ft([],[]);ft.removeOverlap=Km;const cn=ft.empty;class Ss{constructor(t){this.members=t}map(t,n){const r=this.members.map(s=>s.map(t,n,gi));return Ss.from(r)}forChild(t,n){if(n.isLeaf)return ft.empty;let r=[];for(let s=0;s<this.members.length;s++){let i=this.members[s].forChild(t,n);i!=cn&&(i instanceof Ss?r=r.concat(i.members):r.push(i))}return Ss.from(r)}eq(t){if(!(t instanceof Ss)||t.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}locals(t){let n,r=!0;for(let s=0;s<this.members.length;s++){let i=this.members[s].localsInner(t);if(i.length)if(!n)n=i;else{r&&(n=n.slice(),r=!1);for(let o=0;o<i.length;o++)n.push(i[o])}}return n?Km(r?n:n.sort(bi)):Ji}static from(t){switch(t.length){case 0:return cn;case 1:return t[0];default:return new Ss(t.every(n=>n instanceof ft)?t:t.reduce((n,r)=>n.concat(r instanceof ft?r:r.members),[]))}}forEachSet(t){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(t)}}function Rj(e,t,n,r,s,i,o){let a=e.slice();for(let c=0,u=i;c<n.maps.length;c++){let d=0;n.maps[c].forEach((f,p,m,g)=>{let b=g-m-(p-f);for(let y=0;y<a.length;y+=3){let w=a[y+1];if(w<0||f>w+u-d)continue;let v=a[y]+u-d;p>=v?a[y+1]=f<=v?-2:-1:f>=u&&b&&(a[y]+=b,a[y+1]+=b)}d+=b}),u=n.maps[c].map(u,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let u=n.map(e[c]+i),d=u-s;if(d<0||d>=r.content.size){l=!0;continue}let f=n.map(e[c+1]+i,-1),p=f-s,{index:m,offset:g}=r.content.findIndex(d),b=r.maybeChild(m);if(b&&g==d&&g+b.nodeSize==p){let y=a[c+2].mapInner(n,b,u+1,e[c]+i+1,o);y!=cn?(a[c]=d,a[c+1]=p,a[c+2]=y):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=Oj(a,e,t,n,s,i,o),u=$c(c,r,0,o);t=u.local;for(let d=0;d<a.length;d+=3)a[d+1]<0&&(a.splice(d,3),d-=3);for(let d=0,f=0;d<u.children.length;d+=3){let p=u.children[d];for(;f<a.length&&a[f]<p;)f+=3;a.splice(f,0,u.children[d],u.children[d+1],u.children[d+2])}}return new ft(t.sort(bi),a)}function zE(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let s=e[r];n.push(new Wt(s.from+t,s.to+t,s.type))}return n}function Oj(e,t,n,r,s,i,o){function a(l,c){for(let u=0;u<l.local.length;u++){let d=l.local[u].map(r,s,c);d?n.push(d):o.onRemove&&o.onRemove(l.local[u].spec)}for(let u=0;u<l.children.length;u+=3)a(l.children[u+2],l.children[u]+c+1)}for(let l=0;l<e.length;l+=3)e[l+1]==-1&&a(e[l+2],t[l]+i+1);return n}function FE(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,s=null;for(let i=0,o;i<e.length;i++)(o=e[i])&&o.from>n&&o.to<r&&((s||(s=[])).push(o),e[i]=null);return s}function BE(e){let t=[];for(let n=0;n<e.length;n++)e[n]!=null&&t.push(e[n]);return t}function $c(e,t,n,r){let s=[],i=!1;t.forEach((a,l)=>{let c=FE(e,a,l+n);if(c){i=!0;let u=$c(c,a,n+l+1,r);u!=cn&&s.push(l,l+a.nodeSize,u)}});let o=zE(i?BE(e):e,-n).sort(bi);for(let a=0;a<o.length;a++)o[a].type.valid(t,o[a])||(r.onRemove&&r.onRemove(o[a].spec),o.splice(a--,1));return o.length||s.length?new ft(o,s):cn}function bi(e,t){return e.from-t.from||e.to-t.to}function Km(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let s=n+1;s<t.length;s++){let i=t[s];if(i.from==r.from){i.to!=r.to&&(t==e&&(t=e.slice()),t[s]=i.copy(i.from,r.to),Hy(t,s+1,i.copy(r.to,i.to)));continue}else{i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),Hy(t,s,r.copy(i.from,r.to)));break}}}return t}function Hy(e,t,n){for(;t<e.length&&bi(n,e[t])>0;)t++;e.splice(t,0,n)}function Sf(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=cn&&t.push(r)}),e.cursorWrapper&&t.push(ft.create(e.state.doc,[e.cursorWrapper.deco])),Ss.from(t)}const Ij={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Dj=Dn&&js<=11;class Lj{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class Pj{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Lj,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);Dn&&js<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),Dj&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Ij)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ly(this.view)){if(this.suppressingSelectionUpdates)return Xr(this.view);if(Dn&&js<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&Mi(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let i=t.focusNode;i;i=Eo(i))n.add(i);for(let i=t.anchorNode;i;i=Eo(i))if(n.has(i)){r=i;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ly(t)&&!this.ignoreSelectionChange(r),i=-1,o=-1,a=!1,l=[];if(t.editable)for(let u=0;u<n.length;u++){let d=this.registerMutation(n[u],l);d&&(i=i<0?d.from:Math.min(d.from,i),o=o<0?d.to:Math.max(d.to,o),d.typeOver&&(a=!0))}if(ar&&l.length){let u=l.filter(d=>d.nodeName=="BR");if(u.length==2){let[d,f]=u;d.parentNode&&d.parentNode.parentNode==f.parentNode?f.remove():d.remove()}else{let{focusNode:d}=this.currentSelection;for(let f of u){let p=f.parentNode;p&&p.nodeName=="LI"&&(!d||Fj(t,d)!=p)&&f.remove()}}}let c=null;i<0&&s&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)<Date.now()-300&&wd(r)&&(c=Bm(t))&&c.eq(Re.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,Xr(t),this.currentSelection.set(r),t.scrollToSelection()):(i>-1||s)&&(i>-1&&(t.docView.markDirty(i,o),jj(t)),this.handleDOMChange(i,o,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Xr(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let u=0;u<t.addedNodes.length;u++){let d=t.addedNodes[u];n.push(d),d.nodeType==3&&(this.lastChangedTextNode=d)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let s=t.previousSibling,i=t.nextSibling;if(Dn&&js<=11&&t.addedNodes.length)for(let u=0;u<t.addedNodes.length;u++){let{previousSibling:d,nextSibling:f}=t.addedNodes[u];(!d||Array.prototype.indexOf.call(t.addedNodes,d)<0)&&(s=d),(!f||Array.prototype.indexOf.call(t.addedNodes,f)<0)&&(i=f)}let o=s&&s.parentNode==t.target?nn(s)+1:0,a=r.localPosFromDOM(t.target,o,-1),l=i&&i.parentNode==t.target?nn(i):t.target.childNodes.length,c=r.localPosFromDOM(t.target,l,1);return{from:a,to:c}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=t.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue})}}let Vy=new WeakMap,qy=!1;function jj(e){if(!Vy.has(e)&&(Vy.set(e,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace)!==-1)){if(e.requiresGeckoHackNode=ar,qy)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),qy=!0}}function Wy(e,t){let n=t.startContainer,r=t.startOffset,s=t.endContainer,i=t.endOffset,o=e.domAtPos(e.state.selection.anchor);return Mi(o.node,o.offset,s,i)&&([n,r,s,i]=[s,i,n,r]),{anchorNode:n,anchorOffset:r,focusNode:s,focusOffset:i}}function zj(e,t){if(t.getComposedRanges){let s=t.getComposedRanges(e.root)[0];if(s)return Wy(e,s)}let n;function r(s){s.preventDefault(),s.stopImmediatePropagation(),n=s.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",r,!0),n?Wy(e,n):null}function Fj(e,t){for(let n=t.parentNode;n&&n!=e.dom;n=n.parentNode){let r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Bj(e,t,n){let{node:r,fromOffset:s,toOffset:i,from:o,to:a}=e.docView.parseRange(t,n),l=e.domSelectionRange(),c,u=l.anchorNode;if(u&&e.dom.contains(u.nodeType==1?u:u.parentNode)&&(c=[{node:u,offset:l.anchorOffset}],wd(l)||c.push({node:l.focusNode,offset:l.focusOffset})),hn&&e.input.lastKeyCode===8)for(let b=i;b>s;b--){let y=r.childNodes[b-1],w=y.pmViewDesc;if(y.nodeName=="BR"&&!w){i=b;break}if(!w||w.size)break}let d=e.state.doc,f=e.someProp("domParser")||Ps.fromSchema(e.state.schema),p=d.resolve(o),m=null,g=f.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:s,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:$j,context:p});if(c&&c[0].pos!=null){let b=c[0].pos,y=c[1]&&c[1].pos;y==null&&(y=b),m={anchor:b+o,head:y+o}}return{doc:g,sel:m,from:o,to:a}}function $j(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(Cn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||Cn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Uj=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Hj(e,t,n,r,s){let i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let C=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,A=Bm(e,C);if(A&&!e.state.selection.eq(A)){if(hn&&Zr&&e.input.lastKeyCode===13&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",T=>T(e,ii(13,"Enter"))))return;let R=e.state.tr.setSelection(A);C=="pointer"?R.setMeta("pointer",!0):C=="key"&&R.scrollIntoView(),i&&R.setMeta("composition",i),e.dispatch(R)}return}let o=e.state.doc.resolve(t),a=o.sharedDepth(n);t=o.before(a+1),n=e.state.doc.resolve(n).after(a+1);let l=e.state.selection,c=Bj(e,t,n),u=e.state.doc,d=u.slice(c.from,c.to),f,p;e.input.lastKeyCode===8&&Date.now()-100<e.input.lastKeyCodeTime?(f=e.state.selection.to,p="end"):(f=e.state.selection.from,p="start"),e.input.lastKeyCode=null;let m=Wj(d.content,c.doc.content,c.from,f,p);if(m&&e.input.domChangeCount++,(Co&&e.input.lastIOSEnter>Date.now()-225||Zr)&&s.some(C=>C.nodeType==1&&!Uj.test(C.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",C=>C(e,ii(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof Ce&&!l.empty&&l.$head.sameParent(l.$anchor)&&!e.composing&&!(c.sel&&c.sel.anchor!=c.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(c.sel){let C=Ky(e,e.state.doc,c.sel);if(C&&!C.eq(e.state.selection)){let A=e.state.tr.setSelection(C);i&&A.setMeta("composition",i),e.dispatch(A)}}return}e.state.selection.from<e.state.selection.to&&m.start==m.endB&&e.state.selection instanceof Ce&&(m.start>e.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=c.from?m.start=e.state.selection.from:m.endA<e.state.selection.to&&m.endA>=e.state.selection.to-2&&e.state.selection.to<=c.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),Dn&&js<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>c.from&&c.doc.textBetween(m.start-c.from-1,m.start-c.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let g=c.doc.resolveNoCache(m.start-c.from),b=c.doc.resolveNoCache(m.endB-c.from),y=u.resolve(m.start),w=g.sameParent(b)&&g.parent.inlineContent&&y.end()>=m.endA;if((Co&&e.input.lastIOSEnter>Date.now()-225&&(!w||s.some(C=>C.nodeName=="DIV"||C.nodeName=="P"))||!w&&g.pos<c.doc.content.size&&(!g.sameParent(b)||!g.parent.inlineContent)&&g.pos<b.pos&&!/\S/.test(c.doc.textBetween(g.pos,b.pos,"","")))&&e.someProp("handleKeyDown",C=>C(e,ii(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&qj(u,m.start,m.endA,g,b)&&e.someProp("handleKeyDown",C=>C(e,ii(8,"Backspace")))){Zr&&hn&&e.domObserver.suppressSelectionUpdates();return}hn&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),Zr&&!w&&g.start()!=b.start()&&b.parentOffset==0&&g.depth==b.depth&&c.sel&&c.sel.anchor==c.sel.head&&c.sel.head==m.endA&&(m.endB-=2,b=c.doc.resolveNoCache(m.endB-c.from),setTimeout(()=>{e.someProp("handleKeyDown",function(C){return C(e,ii(13,"Enter"))})},20));let v=m.start,E=m.endA,N=C=>{let A=C||e.state.tr.replace(v,E,c.doc.slice(m.start-c.from,m.endB-c.from));if(c.sel){let R=Ky(e,A.doc,c.sel);R&&!(hn&&e.composing&&R.empty&&(m.start!=m.endB||e.input.lastChromeDelete<Date.now()-100)&&(R.head==v||R.head==A.mapping.map(E)-1)||Dn&&R.empty&&R.head==v)&&A.setSelection(R)}return i&&A.setMeta("composition",i),A.scrollIntoView()},k;if(w)if(g.pos==b.pos){Dn&&js<=11&&g.parentOffset==0&&(e.domObserver.suppressSelectionUpdates(),setTimeout(()=>Xr(e),20));let C=N(e.state.tr.delete(v,E)),A=u.resolve(m.start).marksAcross(u.resolve(m.endA));A&&C.ensureMarks(A),e.dispatch(C)}else if(m.endA==m.endB&&(k=Vj(g.parent.content.cut(g.parentOffset,b.parentOffset),y.parent.content.cut(y.parentOffset,m.endA-y.start())))){let C=N(e.state.tr);k.type=="add"?C.addMark(v,E,k.mark):C.removeMark(v,E,k.mark),e.dispatch(C)}else if(g.parent.child(g.index()).isText&&g.index()==b.index()-(b.textOffset?0:1)){let C=g.parent.textBetween(g.parentOffset,b.parentOffset),A=()=>N(e.state.tr.insertText(C,v,E));e.someProp("handleTextInput",R=>R(e,v,E,C,A))||e.dispatch(A())}else e.dispatch(N());else e.dispatch(N())}function Ky(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:$m(e,t.resolve(n.anchor),t.resolve(n.head))}function Vj(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,s=n,i=r,o,a,l;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(s.length==1&&i.length==0)a=s[0],o="add",l=u=>u.mark(a.addToSet(u.marks));else if(s.length==0&&i.length==1)a=i[0],o="remove",l=u=>u.mark(a.removeFromSet(u.marks));else return null;let c=[];for(let u=0;u<t.childCount;u++)c.push(l(t.child(u)));if(V.from(c).eq(e))return{mark:a,type:o}}function qj(e,t,n,r,s){if(n-t<=s.pos-r.pos||Ef(r,!0,!1)<s.pos)return!1;let i=e.resolve(t);if(!r.parent.isTextblock){let a=i.nodeAfter;return a!=null&&n==t+a.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let o=e.resolve(Ef(i,!0,!0));return!o.parent.isTextblock||o.pos>n||Ef(o,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(o.parent.content)}function Ef(e,t,n){let r=e.depth,s=t?e.end():e.pos;for(;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,s++,t=!1;if(n){let i=e.node(r).maybeChild(e.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,s++}return s}function Wj(e,t,n,r,s){let i=e.findDiffStart(t,n);if(i==null)return null;let{a:o,b:a}=e.findDiffEnd(t,n+e.size,n+t.size);if(s=="end"){let l=Math.max(0,i-Math.min(o,a));r-=o+l-i}if(o<i&&e.size<t.size){let l=r<=i&&r>=o?i-r:0;i-=l,i&&i<t.size&&Gy(t.textBetween(i-1,i+1))&&(i+=l?1:-1),a=i+(a-o),o=i}else if(a<i){let l=r<=i&&r>=a?i-r:0;i-=l,i&&i<e.size&&Gy(e.textBetween(i-1,i+1))&&(i+=l?1:-1),o=i+(o-a),a=i}return{start:i,endA:o,endB:a}}function Gy(e){if(e.length!=2)return!1;let t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}class $E{constructor(t,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new dj,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(Qy),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=Yy(this),Zy(this),this.nodeViews=Xy(this),this.docView=Ay(this.state.doc,Jy(this),Sf(this),this.dom,this),this.domObserver=new Pj(this,(r,s,i,o)=>Hj(this,r,s,i,o)),this.domObserver.start(),fj(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&ip(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(Qy),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let s=this.state,i=!1,o=!1;t.storedMarks&&this.composing&&(DE(this),o=!0),this.state=t;let a=s.plugins!=t.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=Xy(this);Gj(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&ip(this),this.editable=Yy(this),Zy(this);let l=Sf(this),c=Jy(this),u=s.plugins!=t.plugins&&!s.doc.eq(t.doc)?"reset":t.scrollToSelection>s.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(t.doc,c,l);(d||!t.selection.eq(s.selection))&&(o=!0);let f=u=="preserve"&&o&&this.dom.style.overflowAnchor==null&&N2(this);if(o){this.domObserver.stop();let p=d&&(Dn||hn)&&!this.composing&&!s.selection.empty&&!t.selection.empty&&Kj(s.selection,t.selection);if(d){let m=hn?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Cj(this)),(i||!this.docView.update(t.doc,c,l,this))&&(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Ay(t.doc,c,l,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Z2(this))?Xr(this,p):(kE(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,s),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():f&&_2(f)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof we){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Sy(this,n.getBoundingClientRect(),t)}else Sy(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,t)}}updateDraggedNode(t,n){let r=t.node,s=-1;if(this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let i=r.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==r.node&&(s=i)}this.dragging=new PE(t.slice,t.move,s<0?void 0:we.create(this.state.doc,s))}someProp(t,n){let r=this._props&&this._props[t],s;if(r!=null&&(s=n?n(r):r))return s;for(let o=0;o<this.directPlugins.length;o++){let a=this.directPlugins[o].props[t];if(a!=null&&(s=n?n(a):a))return s}let i=this.state.plugins;if(i)for(let o=0;o<i.length;o++){let a=i[o].props[t];if(a!=null&&(s=n?n(a):a))return s}}hasFocus(){if(Dn){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&T2(this.dom),Xr(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return I2(this,t)}coordsAtPos(t,n=1){return pE(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let s=this.docView.posFromDOM(t,n,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(t,n){return z2(this,n||this.state,t)}pasteHTML(t,n){return Ba(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return Ba(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return Um(this,t)}destroy(){this.docView&&(hj(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Sf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,m2())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return mj(this,t)}domSelectionRange(){let t=this.domSelection();return t?Cn&&this.root.nodeType===11&&v2(this.dom.ownerDocument)==this.dom&&zj(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}$E.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function Jy(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[Wt.node(0,e.state.doc.content.size,t)]}function Zy(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Wt.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Yy(e){return!e.someProp("editable",t=>t(e.state)===!1)}function Kj(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function Xy(e){let t=Object.create(null);function n(r){for(let s in r)Object.prototype.hasOwnProperty.call(t,s)||(t[s]=r[s])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function Gj(e,t){let n=0,r=0;for(let s in e){if(e[s]!=t[s])return!0;n++}for(let s in t)r++;return n!=r}function Qy(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var $s={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:"'"},Uc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Jj=typeof navigator<"u"&&/Mac/.test(navigator.platform),Zj=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var rn=0;rn<10;rn++)$s[48+rn]=$s[96+rn]=String(rn);for(var rn=1;rn<=24;rn++)$s[rn+111]="F"+rn;for(var rn=65;rn<=90;rn++)$s[rn]=String.fromCharCode(rn+32),Uc[rn]=String.fromCharCode(rn);for(var Cf in $s)Uc.hasOwnProperty(Cf)||(Uc[Cf]=$s[Cf]);function Yj(e){var t=Jj&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Zj&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Uc:$s)[e.keyCode]||e.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Xj=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Qj=typeof navigator<"u"&&/Win/.test(navigator.platform);function ez(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<t.length-1;a++){let l=t[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))Xj?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(n="Alt-"+n),s&&(n="Ctrl-"+n),o&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function tz(e){let t=Object.create(null);for(let n in e)t[ez(n)]=e[n];return t}function Nf(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function nz(e){return new Et({props:{handleKeyDown:Gm(e)}})}function Gm(e){let t=tz(e);return function(n,r){let s=Yj(r),i,o=t[Nf(s,r)];if(o&&o(n.state,n.dispatch,n))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let a=t[Nf(s,r,!1)];if(a&&a(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Qj&&r.ctrlKey&&r.altKey)&&(i=$s[r.keyCode])&&i!=s){let a=t[Nf(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var rz=Object.defineProperty,Jm=(e,t)=>{for(var n in t)rz(e,n,{get:t[n],enumerable:!0})};function Ed(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:s}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return s},get tr(){return r=n.selection,s=n.doc,i=n.storedMarks,n}}}var Cd=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:s}=n,i=this.buildProps(s);return Object.fromEntries(Object.entries(e).map(([o,a])=>[o,(...c)=>{const u=a(...c)(i);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o=[],a=!!e,l=e||s.tr,c=()=>(!a&&t&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(l),o.every(d=>d===!0)),u={...Object.fromEntries(Object.entries(n).map(([d,f])=>[d,(...m)=>{const g=this.buildProps(l,t),b=f(...m)(g);return o.push(b),u}])),run:c};return u}createCan(e){const{rawCommands:t,state:n}=this,r=!1,s=e||n.tr,i=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...c)=>l(...c)({...i,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:s}=this,{view:i}=r,o={tr:e,editor:r,view:i,state:Ed({state:s,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([a,l])=>[a,(...c)=>l(...c)(o)]))}};return o}},UE={};Jm(UE,{blur:()=>sz,clearContent:()=>iz,clearNodes:()=>oz,command:()=>az,createParagraphNear:()=>lz,cut:()=>cz,deleteCurrentNode:()=>uz,deleteNode:()=>dz,deleteRange:()=>fz,deleteSelection:()=>hz,enter:()=>pz,exitCode:()=>mz,extendMarkRange:()=>gz,first:()=>bz,focus:()=>yz,forEach:()=>xz,insertContent:()=>vz,insertContentAt:()=>Sz,joinBackward:()=>Nz,joinDown:()=>Cz,joinForward:()=>_z,joinItemBackward:()=>Tz,joinItemForward:()=>Az,joinTextblockBackward:()=>Mz,joinTextblockForward:()=>Rz,joinUp:()=>Ez,keyboardShortcut:()=>Iz,lift:()=>Dz,liftEmptyBlock:()=>Lz,liftListItem:()=>Pz,newlineInCode:()=>jz,resetAttributes:()=>zz,scrollIntoView:()=>Fz,selectAll:()=>Bz,selectNodeBackward:()=>$z,selectNodeForward:()=>Uz,selectParentNode:()=>Hz,selectTextblockEnd:()=>Vz,selectTextblockStart:()=>qz,setContent:()=>Wz,setMark:()=>cF,setMeta:()=>uF,setNode:()=>dF,setNodeSelection:()=>fF,setTextSelection:()=>hF,sinkListItem:()=>pF,splitBlock:()=>mF,splitListItem:()=>gF,toggleList:()=>bF,toggleMark:()=>yF,toggleNode:()=>xF,toggleWrap:()=>vF,undoInputRule:()=>wF,unsetAllMarks:()=>kF,unsetMark:()=>SF,updateAttributes:()=>EF,wrapIn:()=>CF,wrapInList:()=>NF});var sz=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),iz=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),oz=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:s}=r;return n&&s.forEach(({$from:i,$to:o})=>{e.doc.nodesBetween(i.pos,o.pos,(a,l)=>{if(a.type.isText)return;const{doc:c,mapping:u}=t,d=c.resolve(u.map(l)),f=c.resolve(u.map(l+a.nodeSize)),p=d.blockRange(f);if(!p)return;const m=Bo(p);if(a.type.isTextblock){const{defaultType:g}=d.parent.contentMatchAt(d.index());t.setNodeMarkup(p.start,g)}(m||m===0)&&t.lift(p,m)})}),!0},az=e=>t=>e(t),lz=()=>({state:e,dispatch:t})=>sE(e,t),cz=(e,t)=>({editor:n,tr:r})=>{const{state:s}=n,i=s.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const o=r.mapping.map(t);return r.insert(o,i.content),r.setSelection(new Ce(r.doc.resolve(Math.max(o-1,0)))),!0},uz=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const s=e.selection.$anchor;for(let i=s.depth;i>0;i-=1)if(s.node(i).type===r.type){if(t){const a=s.before(i),l=s.after(i);e.delete(a,l).scrollIntoView()}return!0}return!1};function Bt(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var dz=e=>({tr:t,state:n,dispatch:r})=>{const s=Bt(e,n.schema),i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===s){if(r){const l=i.before(o),c=i.after(o);t.delete(l,c).scrollIntoView()}return!0}return!1},fz=e=>({tr:t,dispatch:n})=>{const{from:r,to:s}=e;return n&&t.delete(r,s),!0},hz=()=>({state:e,dispatch:t})=>Dm(e,t),pz=()=>({commands:e})=>e.keyboardShortcut("Enter"),mz=()=>({state:e,dispatch:t})=>e2(e,t);function Zm(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function Hc(e,t,n={strict:!0}){const r=Object.keys(t);return r.length?r.every(s=>n.strict?t[s]===e[s]:Zm(t[s])?t[s].test(e[s]):t[s]===e[s]):!0}function HE(e,t,n={}){return e.find(r=>r.type===t&&Hc(Object.fromEntries(Object.keys(n).map(s=>[s,r.attrs[s]])),n))}function ex(e,t,n={}){return!!HE(e,t,n)}function Ym(e,t,n){var r;if(!e||!t)return;let s=e.parent.childAfter(e.parentOffset);if((!s.node||!s.node.marks.some(u=>u.type===t))&&(s=e.parent.childBefore(e.parentOffset)),!s.node||!s.node.marks.some(u=>u.type===t)||(n=n||((r=s.node.marks[0])==null?void 0:r.attrs),!HE([...s.node.marks],t,n)))return;let o=s.index,a=e.start()+s.offset,l=o+1,c=a+s.node.nodeSize;for(;o>0&&ex([...e.parent.child(o-1).marks],t,n);)o-=1,a-=e.parent.child(o).nodeSize;for(;l<e.parent.childCount&&ex([...e.parent.child(l).marks],t,n);)c+=e.parent.child(l).nodeSize,l+=1;return{from:a,to:c}}function ls(e,t){if(typeof e=="string"){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var gz=(e,t={})=>({tr:n,state:r,dispatch:s})=>{const i=ls(e,r.schema),{doc:o,selection:a}=n,{$from:l,from:c,to:u}=a;if(s){const d=Ym(l,i,t);if(d&&d.from<=c&&d.to>=u){const f=Ce.create(o,d.from,d.to);n.setSelection(f)}}return!0},bz=e=>t=>{const n=typeof e=="function"?e(t):e;for(let r=0;r<n.length;r+=1)if(n[r](t))return!0;return!1};function VE(e){return e instanceof Ce}function ui(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function qE(e,t=null){if(!t)return null;const n=Re.atStart(e),r=Re.atEnd(e);if(t==="start"||t===!0)return n;if(t==="end")return r;const s=n.from,i=r.to;return t==="all"?Ce.create(e,ui(0,s,i),ui(e.content.size,s,i)):Ce.create(e,ui(t,s,i),ui(t,s,i))}function WE(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Nd(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var yz=(e=null,t={})=>({editor:n,view:r,tr:s,dispatch:i})=>{t={scrollIntoView:!0,...t};const o=()=>{(Nd()||WE())&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&e===null||e===!1)return!0;if(i&&e===null&&!VE(n.state.selection))return o(),!0;const a=qE(s.doc,e)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||s.setSelection(a),l&&s.storedMarks&&s.setStoredMarks(s.storedMarks),o()),!0},xz=(e,t)=>n=>e.every((r,s)=>t(r,{...n,index:s})),vz=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),KE=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&KE(r)}return e};function Pl(e){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,"text/html").body;return KE(n)}function Ua(e,t,n){if(e instanceof Ls||e instanceof V)return e;n={slice:!0,parseOptions:{},...n};const r=typeof e=="object"&&e!==null,s=typeof e=="string";if(r)try{if(Array.isArray(e)&&e.length>0)return V.fromArray(e.map(a=>t.nodeFromJSON(a)));const o=t.nodeFromJSON(e);return n.errorOnInvalidContent&&o.check(),o}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",i),Ua("",t,n)}if(s){if(n.errorOnInvalidContent){let o=!1,a="";const l=new RS({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(o=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(n.slice?Ps.fromSchema(l).parseSlice(Pl(e),n.parseOptions):Ps.fromSchema(l).parse(Pl(e),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}const i=Ps.fromSchema(t);return n.slice?i.parseSlice(Pl(e),n.parseOptions).content:i.parse(Pl(e),n.parseOptions)}return Ua("",t,n)}function wz(e,t,n){const r=e.steps.length-1;if(r<t)return;const s=e.steps[r];if(!(s instanceof Yt||s instanceof Xt))return;const i=e.mapping.maps[r];let o=0;i.forEach((a,l,c,u)=>{o===0&&(o=u)}),e.setSelection(Re.near(e.doc.resolve(o),n))}var kz=e=>!("type"in e),Sz=(e,t,n)=>({tr:r,dispatch:s,editor:i})=>{var o;if(s){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let a;const l=b=>{i.emit("contentError",{editor:i,error:b,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Ua(t,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(b){l(b)}try{a=Ua(t,i.schema,{parseOptions:c,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:i.options.enableContentCheck})}catch(b){return l(b),!1}let{from:u,to:d}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},f=!0,p=!0;if((kz(a)?a:[a]).forEach(b=>{b.check(),f=f?b.isText&&b.marks.length===0:!1,p=p?b.isBlock:!1}),u===d&&p){const{parent:b}=r.doc.resolve(u);b.isTextblock&&!b.type.spec.code&&!b.childCount&&(u-=1,d+=1)}let g;if(f){if(Array.isArray(t))g=t.map(b=>b.text||"").join("");else if(t instanceof V){let b="";t.forEach(y=>{y.text&&(b+=y.text)}),g=b}else typeof t=="object"&&t&&t.text?g=t.text:g=t;r.insertText(g,u,d)}else{g=a;const b=r.doc.resolve(u),y=b.node(),w=b.parentOffset===0,v=y.isText||y.isTextblock,E=y.content.size>0;w&&v&&E&&(u=Math.max(0,u-1)),r.replaceWith(u,d,g)}n.updateSelection&&wz(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:g}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:g})}return!0},Ez=()=>({state:e,dispatch:t})=>YP(e,t),Cz=()=>({state:e,dispatch:t})=>XP(e,t),Nz=()=>({state:e,dispatch:t})=>YS(e,t),_z=()=>({state:e,dispatch:t})=>tE(e,t),Tz=()=>({state:e,dispatch:t,tr:n})=>{try{const r=yd(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Az=()=>({state:e,dispatch:t,tr:n})=>{try{const r=yd(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Mz=()=>({state:e,dispatch:t})=>JP(e,t),Rz=()=>({state:e,dispatch:t})=>ZP(e,t);function GE(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Oz(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let r,s,i,o;for(let a=0;a<t.length-1;a+=1){const l=t[a];if(/^(cmd|meta|m)$/i.test(l))o=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))s=!0;else if(/^s(hift)?$/i.test(l))i=!0;else if(/^mod$/i.test(l))Nd()||GE()?o=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(n=`Alt-${n}`),s&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var Iz=e=>({editor:t,view:n,tr:r,dispatch:s})=>{const i=Oz(e).split(/-(?!$)/),o=i.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",c=>c(n,a))});return l?.steps.forEach(c=>{const u=c.map(r.mapping);u&&s&&r.maybeStep(u)}),!0};function Us(e,t,n={}){const{from:r,to:s,empty:i}=e.selection,o=t?Bt(t,e.schema):null,a=[];e.doc.nodesBetween(r,s,(d,f)=>{if(d.isText)return;const p=Math.max(r,f),m=Math.min(s,f+d.nodeSize);a.push({node:d,from:p,to:m})});const l=s-r,c=a.filter(d=>o?o.name===d.node.type.name:!0).filter(d=>Hc(d.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((d,f)=>d+f.to-f.from,0)>=l}var Dz=(e,t={})=>({state:n,dispatch:r})=>{const s=Bt(e,n.schema);return Us(n,s,t)?QP(n,r):!1},Lz=()=>({state:e,dispatch:t})=>iE(e,t),Pz=e=>({state:t,dispatch:n})=>{const r=Bt(e,t.schema);return d2(r)(t,n)},jz=()=>({state:e,dispatch:t})=>rE(e,t);function _d(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function tx(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,s)=>(n.includes(s)||(r[s]=e[s]),r),{})}var zz=(e,t)=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=_d(typeof e=="string"?e:e.name,r.schema);return a?(a==="node"&&(i=Bt(e,r.schema)),a==="mark"&&(o=ls(e,r.schema)),s&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,u)=>{i&&i===c.type&&n.setNodeMarkup(u,void 0,tx(c.attrs,t)),o&&c.marks.length&&c.marks.forEach(d=>{o===d.type&&n.addMark(u,u+c.nodeSize,o.create(tx(d.attrs,t)))})})}),!0):!1},Fz=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),Bz=()=>({tr:e,dispatch:t})=>{if(t){const n=new qn(e.doc);e.setSelection(n)}return!0},$z=()=>({state:e,dispatch:t})=>QS(e,t),Uz=()=>({state:e,dispatch:t})=>nE(e,t),Hz=()=>({state:e,dispatch:t})=>r2(e,t),Vz=()=>({state:e,dispatch:t})=>o2(e,t),qz=()=>({state:e,dispatch:t})=>i2(e,t);function op(e,t,n={},r={}){return Ua(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Wz=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:s,tr:i,dispatch:o,commands:a})=>{const{doc:l}=i;if(r.preserveWhitespace!=="full"){const c=op(e,s.schema,r,{errorOnInvalidContent:t??s.options.enableContentCheck});return o&&i.replaceWith(0,l.content.size,c).setMeta("preventUpdate",!n),!0}return o&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:t??s.options.enableContentCheck})};function JE(e,t){const n=ls(t,e.schema),{from:r,to:s,empty:i}=e.selection,o=[];i?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,s,l=>{o.push(...l.marks)});const a=o.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function ZE(e,t){const n=new Om(e);return t.forEach(r=>{r.steps.forEach(s=>{n.step(s)})}),n}function Kz(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function ap(e,t){const n=[];return e.descendants((r,s)=>{t(r)&&n.push({node:r,pos:s})}),n}function Gz(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(s,i)=>{n(s)&&r.push({node:s,pos:i})}),r}function YE(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function Td(e){return t=>YE(t.$from,e)}function ke(e,t,n){return e.config[t]===void 0&&e.parent?ke(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?ke(e.parent,t,n):null}):e.config[t]}function Xm(e){return e.map(t=>{const n={name:t.name,options:t.options,storage:t.storage},r=ke(t,"addExtensions",n);return r?[t,...Xm(r())]:t}).flat(10)}function Qm(e,t){const n=$i.fromSchema(t).serializeFragment(e),s=document.implementation.createHTMLDocument().createElement("div");return s.appendChild(n),s.innerHTML}function XE(e){return typeof e=="function"}function rt(e,t=void 0,...n){return XE(e)?t?e.bind(t)(...n):e(...n):e}function Jz(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Ha(e){const t=e.filter(s=>s.type==="extension"),n=e.filter(s=>s.type==="node"),r=e.filter(s=>s.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function QE(e){const t=[],{nodeExtensions:n,markExtensions:r}=Ha(e),s=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage,extensions:s},l=ke(o,"addGlobalAttributes",a);if(!l)return;l().forEach(u=>{u.types.forEach(d=>{Object.entries(u.attributes).forEach(([f,p])=>{t.push({type:d,name:f,attribute:{...i,...p}})})})})}),s.forEach(o=>{const a={name:o.name,options:o.options,storage:o.storage},l=ke(o,"addAttributes",a);if(!l)return;const c=l();Object.entries(c).forEach(([u,d])=>{const f={...i,...d};typeof f?.default=="function"&&(f.default=f.default()),f?.isRequired&&f?.default===void 0&&delete f.default,t.push({type:o.name,name:u,attribute:f})})}),t}function wt(...e){return e.filter(t=>!!t).reduce((t,n)=>{const r={...t};return Object.entries(n).forEach(([s,i])=>{if(!r[s]){r[s]=i;return}if(s==="class"){const a=i?String(i).split(" "):[],l=r[s]?r[s].split(" "):[],c=a.filter(u=>!l.includes(u));r[s]=[...l,...c].join(" ")}else if(s==="style"){const a=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],l=r[s]?r[s].split(";").map(u=>u.trim()).filter(Boolean):[],c=new Map;l.forEach(u=>{const[d,f]=u.split(":").map(p=>p.trim());c.set(d,f)}),a.forEach(u=>{const[d,f]=u.split(":").map(p=>p.trim());c.set(d,f)}),r[s]=Array.from(c.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else r[s]=i}),r},{})}function Va(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>wt(n,r),{})}function Zz(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function nx(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;const s=t.reduce((i,o)=>{const a=o.attribute.parseHTML?o.attribute.parseHTML(n):Zz(n.getAttribute(o.name));return a==null?i:{...i,[o.name]:a}},{});return{...r,...s}}}}function rx(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&Jz(n)?!1:n!=null))}function Yz(e,t){var n;const r=QE(e),{nodeExtensions:s,markExtensions:i}=Ha(e),o=(n=s.find(c=>ke(c,"topNode")))==null?void 0:n.name,a=Object.fromEntries(s.map(c=>{const u=r.filter(y=>y.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:t},f=e.reduce((y,w)=>{const v=ke(w,"extendNodeSchema",d);return{...y,...v?v(c):{}}},{}),p=rx({...f,content:rt(ke(c,"content",d)),marks:rt(ke(c,"marks",d)),group:rt(ke(c,"group",d)),inline:rt(ke(c,"inline",d)),atom:rt(ke(c,"atom",d)),selectable:rt(ke(c,"selectable",d)),draggable:rt(ke(c,"draggable",d)),code:rt(ke(c,"code",d)),whitespace:rt(ke(c,"whitespace",d)),linebreakReplacement:rt(ke(c,"linebreakReplacement",d)),defining:rt(ke(c,"defining",d)),isolating:rt(ke(c,"isolating",d)),attrs:Object.fromEntries(u.map(y=>{var w,v;return[y.name,{default:(w=y?.attribute)==null?void 0:w.default,validate:(v=y?.attribute)==null?void 0:v.validate}]}))}),m=rt(ke(c,"parseHTML",d));m&&(p.parseDOM=m.map(y=>nx(y,u)));const g=ke(c,"renderHTML",d);g&&(p.toDOM=y=>g({node:y,HTMLAttributes:Va(y,u)}));const b=ke(c,"renderText",d);return b&&(p.toText=b),[c.name,p]})),l=Object.fromEntries(i.map(c=>{const u=r.filter(b=>b.type===c.name),d={name:c.name,options:c.options,storage:c.storage,editor:t},f=e.reduce((b,y)=>{const w=ke(y,"extendMarkSchema",d);return{...b,...w?w(c):{}}},{}),p=rx({...f,inclusive:rt(ke(c,"inclusive",d)),excludes:rt(ke(c,"excludes",d)),group:rt(ke(c,"group",d)),spanning:rt(ke(c,"spanning",d)),code:rt(ke(c,"code",d)),attrs:Object.fromEntries(u.map(b=>{var y,w;return[b.name,{default:(y=b?.attribute)==null?void 0:y.default,validate:(w=b?.attribute)==null?void 0:w.validate}]}))}),m=rt(ke(c,"parseHTML",d));m&&(p.parseDOM=m.map(b=>nx(b,u)));const g=ke(c,"renderHTML",d);return g&&(p.toDOM=b=>g({mark:b,HTMLAttributes:Va(b,u)})),[c.name,p]}));return new RS({topNode:o,nodes:a,marks:l})}function Xz(e){const t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}function eg(e){return e.sort((n,r)=>{const s=ke(n,"priority")||100,i=ke(r,"priority")||100;return s>i?-1:s<i?1:0})}function eC(e){const t=eg(Xm(e)),n=Xz(t.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),t}function tC(e,t,n){const{from:r,to:s}=t,{blockSeparator:i=`
314
-
315
- `,textSerializers:o={}}=n||{};let a="";return e.nodesBetween(r,s,(l,c,u,d)=>{var f;l.isBlock&&c>r&&(a+=i);const p=o?.[l.type.name];if(p)return u&&(a+=p({node:l,pos:c,parent:u,index:d,range:t})),!1;l.isText&&(a+=(f=l?.text)==null?void 0:f.slice(Math.max(r,c)-c,s-c))}),a}function Qz(e,t){const n={from:0,to:e.content.size};return tC(e,n,t)}function nC(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}function eF(e,t){const n=Bt(t,e.schema),{from:r,to:s}=e.selection,i=[];e.doc.nodesBetween(r,s,a=>{i.push(a)});const o=i.reverse().find(a=>a.type.name===n.name);return o?{...o.attrs}:{}}function rC(e,t){const n=_d(typeof t=="string"?t:t.name,e.schema);return n==="node"?eF(e,t):n==="mark"?JE(e,t):{}}function tF(e,t=JSON.stringify){const n={};return e.filter(r=>{const s=t(r);return Object.prototype.hasOwnProperty.call(n,s)?!1:n[s]=!0})}function nF(e){const t=tF(e);return t.length===1?t:t.filter((n,r)=>!t.filter((i,o)=>o!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function sC(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((s,i)=>{const o=[];if(s.ranges.length)s.forEach((a,l)=>{o.push({from:a,to:l})});else{const{from:a,to:l}=n[i];if(a===void 0||l===void 0)return;o.push({from:a,to:l})}o.forEach(({from:a,to:l})=>{const c=t.slice(i).map(a,-1),u=t.slice(i).map(l),d=t.invert().map(c,-1),f=t.invert().map(u);r.push({oldRange:{from:d,to:f},newRange:{from:c,to:u}})})}),nF(r)}function tg(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(s=>{const i=n.resolve(e),o=Ym(i,s.type);o&&r.push({mark:s,...o})}):n.nodesBetween(e,t,(s,i)=>{!s||s?.nodeSize===void 0||r.push(...s.marks.map(o=>({from:i,to:i+s.nodeSize,mark:o})))}),r}var rF=(e,t,n,r=20)=>{const s=e.doc.resolve(n);let i=r,o=null;for(;i>0&&o===null;){const a=s.node(i);a?.type.name===t?o=a:i-=1}return[o,i]};function _f(e,t){return t.nodes[e]||t.marks[e]||null}function hc(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const s=e.find(i=>i.type===t&&i.name===r);return s?s.attribute.keepOnSplit:!1}))}var sF=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(s,i,o,a)=>{var l,c;const u=((c=(l=s.type.spec).toText)==null?void 0:c.call(l,{node:s,pos:i,parent:o,index:a}))||s.textContent||"%leaf%";n+=s.isAtom&&!s.isText?u:u.slice(0,Math.max(0,r-i))}),n};function lp(e,t,n={}){const{empty:r,ranges:s}=e.selection,i=t?ls(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Hc(d.attrs,n,{strict:!1}));let o=0;const a=[];if(s.forEach(({$from:d,$to:f})=>{const p=d.pos,m=f.pos;e.doc.nodesBetween(p,m,(g,b)=>{if(!g.isText&&!g.marks.length)return;const y=Math.max(p,b),w=Math.min(m,b+g.nodeSize),v=w-y;o+=v,a.push(...g.marks.map(E=>({mark:E,from:y,to:w})))})}),o===0)return!1;const l=a.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Hc(d.mark.attrs,n,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),c=a.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(l>0?l+c:l)>=o}function iF(e,t,n={}){if(!t)return Us(e,null,n)||lp(e,null,n);const r=_d(t,e.schema);return r==="node"?Us(e,t,n):r==="mark"?lp(e,t,n):!1}var oF=(e,t)=>{const{$from:n,$to:r,$anchor:s}=e.selection;if(t){const i=Td(a=>a.type.name===t)(e.selection);if(!i)return!1;const o=e.doc.resolve(i.pos+1);return s.pos+1===o.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},aF=e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function sx(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function ix(e,t){const{nodeExtensions:n}=Ha(t),r=n.find(o=>o.name===e);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},i=rt(ke(r,"group",s));return typeof i!="string"?!1:i.split(" ").includes("list")}function Ad(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return/^\s*$/m.test((r=e.text)!=null?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let s=!0;return e.content.forEach(i=>{s!==!1&&(Ad(i,{ignoreWhitespace:n,checkChildren:t})||(s=!1))}),s}return!1}function iC(e){return e instanceof we}function lF(e,t,n){var r;const{selection:s}=t;let i=null;if(VE(s)&&(i=s.$cursor),i){const a=(r=e.storedMarks)!=null?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(a)||!a.some(c=>c.type.excludes(n)))}const{ranges:o}=s;return o.some(({$from:a,$to:l})=>{let c=a.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(a.pos,l.pos,(u,d,f)=>{if(c)return!1;if(u.isInline){const p=!f||f.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(n));c=p&&m}return!c}),c})}var cF=(e,t={})=>({tr:n,state:r,dispatch:s})=>{const{selection:i}=n,{empty:o,ranges:a}=i,l=ls(e,r.schema);if(s)if(o){const c=JE(r,l);n.addStoredMark(l.create({...c,...t}))}else a.forEach(c=>{const u=c.$from.pos,d=c.$to.pos;r.doc.nodesBetween(u,d,(f,p)=>{const m=Math.max(p,u),g=Math.min(p+f.nodeSize,d);f.marks.find(y=>y.type===l)?f.marks.forEach(y=>{l===y.type&&n.addMark(m,g,l.create({...y.attrs,...t}))}):n.addMark(m,g,l.create(t))})});return lF(r,n,l)},uF=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),dF=(e,t={})=>({state:n,dispatch:r,chain:s})=>{const i=Bt(e,n.schema);let o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:a})=>vy(i,{...o,...t})(n)?!0:a.clearNodes()).command(({state:a})=>vy(i,{...o,...t})(a,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},fF=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,s=ui(e,0,r.content.size),i=we.create(r,s);t.setSelection(i)}return!0},hF=e=>({tr:t,dispatch:n})=>{if(n){const{doc:r}=t,{from:s,to:i}=typeof e=="number"?{from:e,to:e}:e,o=Ce.atStart(r).from,a=Ce.atEnd(r).to,l=ui(s,o,a),c=ui(i,o,a),u=Ce.create(r,l,c);t.setSelection(u)}return!0},pF=e=>({state:t,dispatch:n})=>{const r=Bt(e,t.schema);return p2(r)(t,n)};function ox(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(s=>t?.includes(s.type.name));e.tr.ensureMarks(r)}}var mF=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:s})=>{const{selection:i,doc:o}=t,{$from:a,$to:l}=i,c=s.extensionManager.attributes,u=hc(c,a.node().type.name,a.node().attrs);if(i instanceof we&&i.node.isBlock)return!a.parentOffset||!Yr(o,a.pos)?!1:(r&&(e&&ox(n,s.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,f=a.depth===0?void 0:Kz(a.node(-1).contentMatchAt(a.indexAfter(-1)));let p=d&&f?[{type:f,attrs:u}]:void 0,m=Yr(t.doc,t.mapping.map(a.pos),1,p);if(!p&&!m&&Yr(t.doc,t.mapping.map(a.pos),1,f?[{type:f}]:void 0)&&(m=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(m&&(i instanceof Ce&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,p),f&&!d&&!a.parentOffset&&a.parent.type!==f)){const g=t.mapping.map(a.before()),b=t.doc.resolve(g);a.node(-1).canReplaceWith(b.index(),b.index()+1,f)&&t.setNodeMarkup(t.mapping.map(a.before()),f)}e&&ox(n,s.extensionManager.splittableMarks),t.scrollIntoView()}return m},gF=(e,t={})=>({tr:n,state:r,dispatch:s,editor:i})=>{var o;const a=Bt(e,r.schema),{$from:l,$to:c}=r.selection,u=r.selection.node;if(u&&u.isBlock||l.depth<2||!l.sameParent(c))return!1;const d=l.node(-1);if(d.type!==a)return!1;const f=i.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(s){let y=V.empty;const w=l.index(-1)?1:l.index(-2)?2:3;for(let A=l.depth-w;A>=l.depth-3;A-=1)y=V.from(l.node(A).copy(y));const v=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,E={...hc(f,l.node().type.name,l.node().attrs),...t},N=((o=a.contentMatch.defaultType)==null?void 0:o.createAndFill(E))||void 0;y=y.append(V.from(a.createAndFill(null,N)||void 0));const k=l.before(l.depth-(w-1));n.replace(k,l.after(-v),new se(y,4-w,0));let C=-1;n.doc.nodesBetween(k,n.doc.content.size,(A,R)=>{if(C>-1)return!1;A.isTextblock&&A.content.size===0&&(C=R+1)}),C>-1&&n.setSelection(Ce.near(n.doc.resolve(C))),n.scrollIntoView()}return!0}const p=c.pos===l.end()?d.contentMatchAt(0).defaultType:null,m={...hc(f,d.type.name,d.attrs),...t},g={...hc(f,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,c.pos);const b=p?[{type:a,attrs:m},{type:p,attrs:g}]:[{type:a,attrs:m}];if(!Yr(n.doc,l.pos,2))return!1;if(s){const{selection:y,storedMarks:w}=r,{splittableMarks:v}=i.extensionManager,E=w||y.$to.parentOffset&&y.$from.marks();if(n.split(l.pos,2,b).scrollIntoView(),!E||!s)return!0;const N=E.filter(k=>v.includes(k.type.name));n.ensureMarks(N)}return!0},Tf=(e,t)=>{const n=Td(o=>o.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const s=e.doc.nodeAt(r);return n.node.type===s?.type&&Zs(e.doc,n.pos)&&e.join(n.pos),!0},Af=(e,t)=>{const n=Td(o=>o.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const s=e.doc.nodeAt(r);return n.node.type===s?.type&&Zs(e.doc,r)&&e.join(r),!0},bF=(e,t,n,r={})=>({editor:s,tr:i,state:o,dispatch:a,chain:l,commands:c,can:u})=>{const{extensions:d,splittableMarks:f}=s.extensionManager,p=Bt(e,o.schema),m=Bt(t,o.schema),{selection:g,storedMarks:b}=o,{$from:y,$to:w}=g,v=y.blockRange(w),E=b||g.$to.parentOffset&&g.$from.marks();if(!v)return!1;const N=Td(k=>ix(k.type.name,d))(g);if(v.depth>=1&&N&&v.depth-N.depth<=1){if(N.node.type===p)return c.liftListItem(m);if(ix(N.node.type.name,d)&&p.validContent(N.node.content)&&a)return l().command(()=>(i.setNodeMarkup(N.pos,p),!0)).command(()=>Tf(i,p)).command(()=>Af(i,p)).run()}return!n||!E||!a?l().command(()=>u().wrapInList(p,r)?!0:c.clearNodes()).wrapInList(p,r).command(()=>Tf(i,p)).command(()=>Af(i,p)).run():l().command(()=>{const k=u().wrapInList(p,r),C=E.filter(A=>f.includes(A.type.name));return i.ensureMarks(C),k?!0:c.clearNodes()}).wrapInList(p,r).command(()=>Tf(i,p)).command(()=>Af(i,p)).run()},yF=(e,t={},n={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:i=!1}=n,o=ls(e,r.schema);return lp(r,o,t)?s.unsetMark(o,{extendEmptyMarkRange:i}):s.setMark(o,t)},xF=(e,t,n={})=>({state:r,commands:s})=>{const i=Bt(e,r.schema),o=Bt(t,r.schema),a=Us(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?s.setNode(o,l):s.setNode(i,{...l,...n})},vF=(e,t={})=>({state:n,commands:r})=>{const s=Bt(e,n.schema);return Us(n,s,t)?r.lift(s):r.wrapIn(s,t)},wF=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const s=n[r];let i;if(s.spec.isInputRules&&(i=s.getState(e))){if(t){const o=e.tr,a=i.transform;for(let l=a.steps.length-1;l>=0;l-=1)o.step(a.steps[l].invert(a.docs[l]));if(i.text){const l=o.doc.resolve(i.from).marks();o.replaceWith(i.from,i.to,e.schema.text(i.text,l))}else o.delete(i.from,i.to)}return!0}}return!1},kF=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:s}=n;return r||t&&s.forEach(i=>{e.removeMark(i.$from.pos,i.$to.pos)}),!0},SF=(e,t={})=>({tr:n,state:r,dispatch:s})=>{var i;const{extendEmptyMarkRange:o=!1}=t,{selection:a}=n,l=ls(e,r.schema),{$from:c,empty:u,ranges:d}=a;if(!s)return!0;if(u&&o){let{from:f,to:p}=a;const m=(i=c.marks().find(b=>b.type===l))==null?void 0:i.attrs,g=Ym(c,l,m);g&&(f=g.from,p=g.to),n.removeMark(f,p,l)}else d.forEach(f=>{n.removeMark(f.$from.pos,f.$to.pos,l)});return n.removeStoredMark(l),!0},EF=(e,t={})=>({tr:n,state:r,dispatch:s})=>{let i=null,o=null;const a=_d(typeof e=="string"?e:e.name,r.schema);return a?(a==="node"&&(i=Bt(e,r.schema)),a==="mark"&&(o=ls(e,r.schema)),s&&n.selection.ranges.forEach(l=>{const c=l.$from.pos,u=l.$to.pos;let d,f,p,m;n.selection.empty?r.doc.nodesBetween(c,u,(g,b)=>{i&&i===g.type&&(p=Math.max(b,c),m=Math.min(b+g.nodeSize,u),d=b,f=g)}):r.doc.nodesBetween(c,u,(g,b)=>{b<c&&i&&i===g.type&&(p=Math.max(b,c),m=Math.min(b+g.nodeSize,u),d=b,f=g),b>=c&&b<=u&&(i&&i===g.type&&n.setNodeMarkup(b,void 0,{...g.attrs,...t}),o&&g.marks.length&&g.marks.forEach(y=>{if(o===y.type){const w=Math.max(b,c),v=Math.min(b+g.nodeSize,u);n.addMark(w,v,o.create({...y.attrs,...t}))}}))}),f&&(d!==void 0&&n.setNodeMarkup(d,void 0,{...f.attrs,...t}),o&&f.marks.length&&f.marks.forEach(g=>{o===g.type&&n.addMark(p,m,o.create({...g.attrs,...t}))}))}),!0):!1},CF=(e,t={})=>({state:n,dispatch:r})=>{const s=Bt(e,n.schema);return a2(s,t)(n,r)},NF=(e,t={})=>({state:n,dispatch:r})=>{const s=Bt(e,n.schema);return l2(s,t)(n,r)},_F=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(r=>r.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(r=>r!==t):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},Md=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=(t=e.undoable)!=null?t:!0}},TF=(e,t)=>{if(Zm(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function jl(e){var t;const{editor:n,from:r,to:s,text:i,rules:o,plugin:a}=e,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(t=c.nodeBefore||c.nodeAfter)!=null&&t.marks.find(f=>f.type.spec.code))return!1;let u=!1;const d=sF(c)+i;return o.forEach(f=>{if(u)return;const p=TF(d,f.find);if(!p)return;const m=l.state.tr,g=Ed({state:l.state,transaction:m}),b={from:r-(p[0].length-i.length),to:s},{commands:y,chain:w,can:v}=new Cd({editor:n,state:g});f.handler({state:g,range:b,match:p,commands:y,chain:w,can:v})===null||!m.steps.length||(f.undoable&&m.setMeta(a,{transform:m,from:r,to:s,text:i}),l.dispatch(m),u=!0)}),u}function AF(e){const{editor:t,rules:n}=e,r=new Et({state:{init(){return null},apply(s,i,o){const a=s.getMeta(r);if(a)return a;const l=s.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:u}=l;typeof u=="string"?u=u:u=Qm(V.from(u),o.schema);const{from:d}=l,f=d+u.length;jl({editor:t,from:d,to:f,text:u,rules:n,plugin:r})}),s.selectionSet||s.docChanged?null:i}},props:{handleTextInput(s,i,o,a){return jl({editor:t,from:i,to:o,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:i}=s.state.selection;i&&jl({editor:t,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(s,i){if(i.key!=="Enter")return!1;const{$cursor:o}=s.state.selection;return o?jl({editor:t,from:o.pos,to:o.pos,text:`
316
- `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function MF(e){return Object.prototype.toString.call(e).slice(8,-1)}function zl(e){return MF(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function oC(e,t){const n={...e};return zl(e)&&zl(t)&&Object.keys(t).forEach(r=>{zl(t[r])&&zl(e[r])?n[r]=oC(e[r],t[r]):n[r]=t[r]}),n}var ng=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...rt(ke(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...rt(ke(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>oC(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Xs=class aC extends ng{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n=typeof t=="function"?t():t;return new aC(n)}static handleExit({editor:t,mark:n}){const{tr:r}=t.state,s=t.state.selection.$from;if(s.pos===s.end()){const o=s.marks();if(!!!o.find(c=>c?.type.name===n.name))return!1;const l=o.find(c=>c?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",s.pos),t.view.dispatch(r),!0}return!1}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}};function RF(e){return typeof e=="number"}var OF=class{constructor(e){this.find=e.find,this.handler=e.handler}},IF=(e,t,n)=>{if(Zm(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(s=>{const i=[s.text];return i.index=s.index,i.input=e,i.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(s.replaceWith)),i}):[]};function DF(e){const{editor:t,state:n,from:r,to:s,rule:i,pasteEvent:o,dropEvent:a}=e,{commands:l,chain:c,can:u}=new Cd({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,s,(p,m)=>{var g,b,y,w,v;if((b=(g=p.type)==null?void 0:g.spec)!=null&&b.code||!(p.isText||p.isTextblock||p.isInline))return;const E=(v=(w=(y=p.content)==null?void 0:y.size)!=null?w:p.nodeSize)!=null?v:0,N=Math.max(r,m),k=Math.min(s,m+E);if(N>=k)return;const C=p.isText?p.text||"":p.textBetween(N-m,k-m,void 0,"");IF(C,i.find,o).forEach(R=>{if(R.index===void 0)return;const T=N+R.index+1,I=T+R[0].length,O={from:n.tr.mapping.map(T),to:n.tr.mapping.map(I)},j=i.handler({state:n,range:O,match:R,commands:l,chain:c,can:u,pasteEvent:o,dropEvent:a});d.push(j)})}),d.every(p=>p!==null)}var Fl=null,LF=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData("text/html",e),n};function PF(e){const{editor:t,rules:n}=e;let r=null,s=!1,i=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a;try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}const l=({state:u,from:d,to:f,rule:p,pasteEvt:m})=>{const g=u.tr,b=Ed({state:u,transaction:g});if(!(!DF({editor:t,state:b,from:Math.max(d-1,0),to:f.b-1,rule:p,pasteEvent:m,dropEvent:a})||!g.steps.length)){try{a=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{a=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return n.map(u=>new Et({view(d){const f=m=>{var g;r=(g=d.dom.parentElement)!=null&&g.contains(m.target)?d.dom.parentElement:null,r&&(Fl=t)},p=()=>{Fl&&(Fl=null)};return window.addEventListener("dragstart",f),window.addEventListener("dragend",p),{destroy(){window.removeEventListener("dragstart",f),window.removeEventListener("dragend",p)}}},props:{handleDOMEvents:{drop:(d,f)=>{if(i=r===d.dom.parentElement,a=f,!i){const p=Fl;p?.isEditable&&setTimeout(()=>{const m=p.state.selection;m&&p.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(d,f)=>{var p;const m=(p=f.clipboardData)==null?void 0:p.getData("text/html");return o=f,s=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(d,f,p)=>{const m=d[0],g=m.getMeta("uiEvent")==="paste"&&!s,b=m.getMeta("uiEvent")==="drop"&&!i,y=m.getMeta("applyPasteRules"),w=!!y;if(!g&&!b&&!w)return;if(w){let{text:N}=y;typeof N=="string"?N=N:N=Qm(V.from(N),p.schema);const{from:k}=y,C=k+N.length,A=LF(N);return l({rule:u,state:p,from:k,to:{b:C},pasteEvt:A})}const v=f.doc.content.findDiffStart(p.doc.content),E=f.doc.content.findDiffEnd(p.doc.content);if(!(!RF(v)||!E||v===E.b))return l({rule:u,state:p,from:v,to:E,pasteEvt:o})}}))}var Rd=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=eC(e),this.schema=Yz(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:_f(t.name,this.schema)},r=ke(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){const{editor:e}=this;return eg([...this.extensions].reverse()).flatMap(r=>{const s={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:_f(r.name,this.schema)},i=[],o=ke(r,"addKeyboardShortcuts",s);let a={};if(r.type==="mark"&&ke(r,"exitable",s)&&(a.ArrowRight=()=>Xs.handleExit({editor:e,mark:r})),o){const f=Object.fromEntries(Object.entries(o()).map(([p,m])=>[p,()=>m({editor:e})]));a={...a,...f}}const l=nz(a);i.push(l);const c=ke(r,"addInputRules",s);if(sx(r,e.options.enableInputRules)&&c){const f=c();if(f&&f.length){const p=AF({editor:e,rules:f}),m=Array.isArray(p)?p:[p];i.push(...m)}}const u=ke(r,"addPasteRules",s);if(sx(r,e.options.enablePasteRules)&&u){const f=u();if(f&&f.length){const p=PF({editor:e,rules:f});i.push(...p)}}const d=ke(r,"addProseMirrorPlugins",s);if(d){const f=d();i.push(...f)}return i})}get attributes(){return QE(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=Ha(this.extensions);return Object.fromEntries(t.filter(n=>!!ke(n,"addNodeView")).map(n=>{const r=this.attributes.filter(l=>l.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Bt(n.name,this.schema)},i=ke(n,"addNodeView",s);if(!i)return[];const o=i();if(!o)return[];const a=(l,c,u,d,f)=>{const p=Va(l,r);return o({node:l,view:c,getPos:u,decorations:d,innerDecorations:f,editor:e,extension:n,HTMLAttributes:p})};return[n.name,a]}))}get markViews(){const{editor:e}=this,{markExtensions:t}=Ha(this.extensions);return Object.fromEntries(t.filter(n=>!!ke(n,"addMarkView")).map(n=>{const r=this.attributes.filter(a=>a.type===n.name),s={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:ls(n.name,this.schema)},i=ke(n,"addMarkView",s);if(!i)return[];const o=(a,l,c)=>{const u=Va(a,r);return i()({mark:a,view:l,inline:c,editor:e,extension:n,HTMLAttributes:u,updateAttributes:d=>{JF(a,e,d)}})};return[n.name,o]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(t=>[t.name,t.storage])),e.forEach(t=>{var n;const r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:_f(t.name,this.schema)};t.type==="mark"&&((n=rt(ke(t,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(t.name);const s=ke(t,"onBeforeCreate",r),i=ke(t,"onCreate",r),o=ke(t,"onUpdate",r),a=ke(t,"onSelectionUpdate",r),l=ke(t,"onTransaction",r),c=ke(t,"onFocus",r),u=ke(t,"onBlur",r),d=ke(t,"onDestroy",r);s&&this.editor.on("beforeCreate",s),i&&this.editor.on("create",i),o&&this.editor.on("update",o),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),u&&this.editor.on("blur",u),d&&this.editor.on("destroy",d)})}};Rd.resolve=eC;Rd.sort=eg;Rd.flatten=Xm;var jF={};Jm(jF,{ClipboardTextSerializer:()=>cC,Commands:()=>uC,Delete:()=>dC,Drop:()=>fC,Editable:()=>hC,FocusEvents:()=>mC,Keymap:()=>gC,Paste:()=>bC,Tabindex:()=>yC,focusEventsPluginKey:()=>pC});var _t=class lC extends ng{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n=typeof t=="function"?t():t;return new lC(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}},cC=_t.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Et({key:new Lt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:s}=t,{ranges:i}=s,o=Math.min(...i.map(u=>u.$from.pos)),a=Math.max(...i.map(u=>u.$to.pos)),l=nC(n);return tC(r,{from:o,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),uC=_t.create({name:"commands",addCommands(){return{...UE}}}),dC=_t.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,s;const i=()=>{var o,a,l,c;if((c=(l=(a=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:a.filterTransaction)==null?void 0:l.call(a,e))!=null?c:e.getMeta("y-sync$"))return;const u=ZE(e.before,[e,...t]);sC(u).forEach(p=>{u.mapping.mapResult(p.oldRange.from).deletedAfter&&u.mapping.mapResult(p.oldRange.to).deletedBefore&&u.before.nodesBetween(p.oldRange.from,p.oldRange.to,(m,g)=>{const b=g+m.nodeSize-2,y=p.oldRange.from<=g&&b<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:b,newFrom:u.mapping.map(g),newTo:u.mapping.map(b),deletedRange:p.oldRange,newRange:p.newRange,partial:!y,editor:this.editor,transaction:e,combinedTransform:u})})});const f=u.mapping;u.steps.forEach((p,m)=>{var g,b;if(p instanceof gr){const y=f.slice(m).map(p.from,-1),w=f.slice(m).map(p.to),v=f.invert().map(y,-1),E=f.invert().map(w),N=(g=u.doc.nodeAt(y-1))==null?void 0:g.marks.some(C=>C.eq(p.mark)),k=(b=u.doc.nodeAt(w))==null?void 0:b.marks.some(C=>C.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:v,to:E},newRange:{from:y,to:w},partial:!!(k||N),editor:this.editor,transaction:e,combinedTransform:u})}})};(s=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||s?setTimeout(i,0):i()}}),fC=_t.create({name:"drop",addProseMirrorPlugins(){return[new Et({key:new Lt("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),hC=_t.create({name:"editable",addProseMirrorPlugins(){return[new Et({key:new Lt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),pC=new Lt("focusEvents"),mC=_t.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new Et({key:pC,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),gC=_t.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:a})=>{const{selection:l,doc:c}=a,{empty:u,$anchor:d}=l,{pos:f,parent:p}=d,m=d.parent.isTextblock&&f>0?a.doc.resolve(f-1):d,g=m.parent.type.spec.isolating,b=d.pos-d.parentOffset,y=g&&m.parent.childCount===1?b===d.pos:Re.atStart(c).from===f;return!u||!p.type.isTextblock||p.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},s={...r},i={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Nd()||GE()?i:s},addProseMirrorPlugins(){return[new Et({key:new Lt("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(g=>g.getMeta("composition")))return;const r=e.some(g=>g.docChanged)&&!t.doc.eq(n.doc),s=e.some(g=>g.getMeta("preventClearDocument"));if(!r||s)return;const{empty:i,from:o,to:a}=t.selection,l=Re.atStart(t.doc).from,c=Re.atEnd(t.doc).to;if(i||!(o===l&&a===c)||!Ad(n.doc))return;const f=n.tr,p=Ed({state:n,transaction:f}),{commands:m}=new Cd({editor:this.editor,state:p});if(m.clearNodes(),!!f.steps.length)return f}})]}}),bC=_t.create({name:"paste",addProseMirrorPlugins(){return[new Et({key:new Lt("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),yC=_t.create({name:"tabindex",addProseMirrorPlugins(){return[new Et({key:new Lt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),zF=class Zi{constructor(t,n,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=n,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return(t=this.actualDepth)!=null?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new Zi(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new Zi(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new Zi(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const s=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,o=this.pos+r+(i?0:1);if(o<0||o>this.resolvedPos.doc.nodeSize-2)return;const a=this.resolvedPos.doc.resolve(o);if(!s&&a.depth<=this.depth)return;const l=new Zi(a,this.editor,s,s?n:null);s&&(l.actualDepth=this.depth+1),t.push(new Zi(a,this.editor,s,s?n:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,n={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===t)if(Object.keys(n).length>0){const i=s.node.attrs,o=Object.keys(n);for(let a=0;a<o.length;a+=1){const l=o[a];if(i[l]!==n[l])break}}else r=s;s=s.parent}return r}querySelector(t,n={}){return this.querySelectorAll(t,n,!0)[0]||null}querySelectorAll(t,n={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const i=Object.keys(n);return this.children.forEach(o=>{r&&s.length>0||(o.node.type.name===t&&i.every(l=>n[l]===o.node.attrs[l])&&s.push(o),!(r&&s.length>0)&&(s=s.concat(o.querySelectorAll(t,n,r))))}),s}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}},FF=`.ProseMirror {
317
- position: relative;
318
- }
319
-
320
- .ProseMirror {
321
- word-wrap: break-word;
322
- white-space: pre-wrap;
323
- white-space: break-spaces;
324
- -webkit-font-variant-ligatures: none;
325
- font-variant-ligatures: none;
326
- font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
327
- }
328
-
329
- .ProseMirror [contenteditable="false"] {
330
- white-space: normal;
331
- }
332
-
333
- .ProseMirror [contenteditable="false"] [contenteditable="true"] {
334
- white-space: pre-wrap;
335
- }
336
-
337
- .ProseMirror pre {
338
- white-space: pre-wrap;
339
- }
340
-
341
- img.ProseMirror-separator {
342
- display: inline !important;
343
- border: none !important;
344
- margin: 0 !important;
345
- width: 0 !important;
346
- height: 0 !important;
347
- }
348
-
349
- .ProseMirror-gapcursor {
350
- display: none;
351
- pointer-events: none;
352
- position: absolute;
353
- margin: 0;
354
- }
355
-
356
- .ProseMirror-gapcursor:after {
357
- content: "";
358
- display: block;
359
- position: absolute;
360
- top: -2px;
361
- width: 20px;
362
- border-top: 1px solid black;
363
- animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
364
- }
365
-
366
- @keyframes ProseMirror-cursor-blink {
367
- to {
368
- visibility: hidden;
369
- }
370
- }
371
-
372
- .ProseMirror-hideselection *::selection {
373
- background: transparent;
374
- }
375
-
376
- .ProseMirror-hideselection *::-moz-selection {
377
- background: transparent;
378
- }
379
-
380
- .ProseMirror-hideselection * {
381
- caret-color: transparent;
382
- }
383
-
384
- .ProseMirror-focused .ProseMirror-gapcursor {
385
- display: block;
386
- }`;function BF(e,t,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return t&&s.setAttribute("nonce",t),s.setAttribute("data-tiptap-style",""),s.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(s),s}var $F=class extends _F{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:s,moved:i})=>this.options.onDrop(r,s,i)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=qE(t,this.options.autofocus);this.editorState=io.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=BF(FF,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=XE(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(s=>{const i=typeof s=="string"?`${s}$`:s.key;n=n.filter(o=>!o.key.startsWith(i))}),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const r=[...this.options.enableCoreExtensions?[hC,cC.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),uC,mC,gC,yC,fC,bC,dC].filter(s=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[s.name]!==!1:!0):[],...this.options.extensions].filter(s=>["extension","node","mark"].includes(s?.type));this.extensionManager=new Rd(r,this)}createCommandManager(){this.commandManager=new Cd({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=op(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),e=op(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){var t;this.editorView=new $E(e,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)==null?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.prependClass(),this.injectCSS();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(c=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(c)});return}const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),s=n.includes(e),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!s)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const o=n.findLast(c=>c.getMeta("focus")||c.getMeta("blur")),a=o?.getMeta("focus"),l=o?.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(e.getMeta("preventUpdate")||!n.some(c=>c.docChanged)||i.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return rC(this.state,e)}isActive(e,t){const n=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return iF(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Qm(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
387
-
388
- `,textSerializers:n={}}=e||{};return Qz(this.state.doc,{blockSeparator:t,textSerializers:{...nC(this.schema),...n}})}get isEmpty(){return Ad(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new zF(t,this)}get $doc(){return this.$pos(0)}};function No(e){return new Md({find:e.find,handler:({state:t,range:n,match:r})=>{const s=rt(e.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:i}=t,o=r[r.length-1],a=r[0];if(o){const l=a.search(/\S/),c=n.from+a.indexOf(o),u=c+o.length;if(tg(n.from,n.to,t.doc).filter(p=>p.mark.type.excluded.find(g=>g===e.type&&g!==p.mark.type)).filter(p=>p.to>c).length)return null;u<n.to&&i.delete(u,n.to),c>n.from&&i.delete(n.from+l,c);const f=n.from+l+o.length;i.addMark(n.from+l,f,e.type.create(s||{})),i.removeStoredMark(e.type)}},undoable:e.undoable})}function xC(e){return new Md({find:e.find,handler:({state:t,range:n,match:r})=>{const s=rt(e.getAttributes,void 0,r)||{},{tr:i}=t,o=n.from;let a=n.to;const l=e.type.create(s);if(r[1]){const c=r[0].lastIndexOf(r[1]);let u=o+c;u>a?u=a:a=u+r[1].length;const d=r[0][r[0].length-1];i.insertText(d,o+r[0].length-1),i.replaceWith(u,a,l)}else if(r[0]){const c=e.type.isInline?o:o-1;i.insert(c,e.type.create(s)).delete(i.mapping.map(o),i.mapping.map(a))}i.scrollIntoView()},undoable:e.undoable})}function cp(e){return new Md({find:e.find,handler:({state:t,range:n,match:r})=>{const s=t.doc.resolve(n.from),i=rt(e.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)},undoable:e.undoable})}function _o(e){return new Md({find:e.find,handler:({state:t,range:n,match:r,chain:s})=>{const i=rt(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),l=o.doc.resolve(n.from).blockRange(),c=l&&Rm(l,e.type,i);if(!c)return null;if(o.wrap(l,c),e.keepMarks&&e.editor){const{selection:d,storedMarks:f}=t,{splittableMarks:p}=e.editor.extensionManager,m=f||d.$to.parentOffset&&d.$from.marks();if(m){const g=m.filter(b=>p.includes(b.type.name));o.ensureMarks(g)}}if(e.keepAttributes){const d=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(d,i).run()}const u=o.doc.resolve(n.from-1).nodeBefore;u&&u.type===e.type&&Zs(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,u))&&o.join(n.from-1)},undoable:e.undoable})}function UF(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof we){const i=r.index();return r.parent.canReplaceWith(i,i+1,t)}let s=r.depth;for(;s>=0;){const i=r.index(s);if(r.node(s).contentMatchAt(i).matchType(t))return!0;s-=1}return!1}var HF={};Jm(HF,{createAtomBlockMarkdownSpec:()=>VF,createBlockMarkdownSpec:()=>qF,createInlineMarkdownSpec:()=>GF,parseAttributes:()=>rg,parseIndentedBlocks:()=>up,renderNestedMarkdownContent:()=>ig,serializeAttributes:()=>sg});function rg(e){if(!e?.trim())return{};const t={},n=[],r=e.replace(/["']([^"']*)["']/g,c=>(n.push(c),`__QUOTED_${n.length-1}__`)),s=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(s){const c=s.map(u=>u.trim().slice(1));t.class=c.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(t.id=i[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,c,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),p=n[f];p&&(t[c]=p.slice(1,-1))});const l=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(t[u]=!0)}),t}function sg(e){if(!e||Object.keys(e).length===0)return"";const t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(r=>t.push(`.${r}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?t.push(n):r!==!1&&r!=null&&t.push(`${n}="${String(r)}"`))}),t.join(" ")}function VF(e){const{nodeName:t,name:n,parseAttributes:r=rg,serializeAttributes:s=sg,defaultAttributes:i={},requiredAttributes:o=[],allowedAttributes:a}=e,l=n||t,c=u=>{if(!a)return u;const d={};return a.forEach(f=>{f in u&&(d[f]=u[f])}),d};return{parseMarkdown:(u,d)=>{const f={...i,...u.attributes};return d.createNode(t,f,[])},markdownTokenizer:{name:t,level:"block",start(u){var d;const f=new RegExp(`^:::${l}(?:\\s|$)`,"m"),p=(d=u.match(f))==null?void 0:d.index;return p!==void 0?p:-1},tokenize(u,d,f){const p=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(p);if(!m)return;const g=m[1]||"",b=r(g);if(!o.find(w=>!(w in b)))return{type:t,raw:m[0],attributes:b}}},renderMarkdown:u=>{const d=c(u.attrs||{}),f=s(d),p=f?` {${f}}`:"";return`:::${l}${p} :::`}}}function qF(e){const{nodeName:t,name:n,getContent:r,parseAttributes:s=rg,serializeAttributes:i=sg,defaultAttributes:o={},content:a="block",allowedAttributes:l}=e,c=n||t,u=d=>{if(!l)return d;const f={};return l.forEach(p=>{p in d&&(f[p]=d[p])}),f};return{parseMarkdown:(d,f)=>{let p;if(r){const g=r(d);p=typeof g=="string"?[{type:"text",text:g}]:g}else a==="block"?p=f.parseChildren(d.tokens||[]):p=f.parseInline(d.tokens||[]);const m={...o,...d.attributes};return f.createNode(t,m,p)},markdownTokenizer:{name:t,level:"block",start(d){var f;const p=new RegExp(`^:::${c}`,"m"),m=(f=d.match(p))==null?void 0:f.index;return m!==void 0?m:-1},tokenize(d,f,p){var m;const g=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),b=d.match(g);if(!b)return;const[y,w=""]=b,v=s(w);let E=1;const N=y.length;let k="";const C=/^:::([\w-]*)(\s.*)?/gm,A=d.slice(N);for(C.lastIndex=0;;){const R=C.exec(A);if(R===null)break;const T=R.index,I=R[1];if(!((m=R[2])!=null&&m.endsWith(":::"))){if(I)E+=1;else if(E-=1,E===0){const O=A.slice(0,T);k=O.trim();const j=d.slice(0,N+T+R[0].length);let L=[];if(k)if(a==="block")for(L=p.blockTokens(O),L.forEach(F=>{F.text&&(!F.tokens||F.tokens.length===0)&&(F.tokens=p.inlineTokens(F.text))});L.length>0;){const F=L[L.length-1];if(F.type==="paragraph"&&(!F.text||F.text.trim()===""))L.pop();else break}else L=p.inlineTokens(k);return{type:t,raw:j,attributes:v,content:k,tokens:L}}}}}},renderMarkdown:(d,f)=>{const p=u(d.attrs||{}),m=i(p),g=m?` {${m}}`:"",b=f.renderChildren(d.content||[],`
389
-
390
- `);return`:::${c}${g}
391
-
392
- ${b}
393
-
394
- :::`}}}function WF(e){if(!e.trim())return{};const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;r!==null;){const[,s,i,o]=r;t[s]=i||o,r=n.exec(e)}return t}function KF(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t}="${n}"`).join(" ")}function GF(e){const{nodeName:t,name:n,getContent:r,parseAttributes:s=WF,serializeAttributes:i=KF,defaultAttributes:o={},selfClosing:a=!1,allowedAttributes:l}=e,c=n||t,u=f=>{if(!l)return f;const p={};return l.forEach(m=>{m in f&&(p[m]=f[m])}),p},d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(f,p)=>{const m={...o,...f.attributes};if(a)return p.createNode(t,m);const g=r?r(f):f.content||"";return g?p.createNode(t,m,[p.createTextNode(g)]):p.createNode(t,m,[])},markdownTokenizer:{name:t,level:"inline",start(f){const p=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),m=f.match(p),g=m?.index;return g!==void 0?g:-1},tokenize(f,p,m){const g=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),b=f.match(g);if(!b)return;let y="",w="";if(a){const[,E]=b;w=E}else{const[,E,N]=b;w=E,y=N||""}const v=s(w.trim());return{type:t,raw:b[0],content:y.trim(),attributes:v}}},renderMarkdown:f=>{let p="";r?p=r(f):f.content&&f.content.length>0&&(p=f.content.filter(y=>y.type==="text").map(y=>y.text).join(""));const m=u(f.attrs||{}),g=i(m),b=g?` ${g}`:"";return a?`[${c}${b}]`:`[${c}${b}]${p}[/${c}]`}}}function up(e,t,n){var r,s,i,o;const a=e.split(`
395
- `),l=[];let c="",u=0;const d=t.baseIndentSize||2;for(;u<a.length;){const f=a[u],p=f.match(t.itemPattern);if(!p){if(l.length>0)break;if(f.trim()===""){u+=1;continue}else return}const m=t.extractItemData(p),{indentLevel:g,mainContent:b}=m;c=`${c}${f}
396
- `;const y=[b];for(u+=1;u<a.length;){const N=a[u];if(N.trim()===""){const C=a.slice(u+1).findIndex(T=>T.trim()!=="");if(C===-1)break;if((((s=(r=a[u+1+C].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:s.length)||0)>g){y.push(N),c=`${c}${N}
397
- `,u+=1;continue}else break}if((((o=(i=N.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:o.length)||0)>g)y.push(N),c=`${c}${N}
398
- `,u+=1;else break}let w;const v=y.slice(1);if(v.length>0){const N=v.map(k=>k.slice(g+d)).join(`
399
- `);N.trim()&&(t.customNestedParser?w=t.customNestedParser(N):w=n.blockTokens(N))}const E=t.createToken(m,w);l.push(E)}if(l.length!==0)return{items:l,raw:c.trim()}}function ig(e,t,n,r){if(!e||!Array.isArray(e.content))return"";const s=typeof n=="function"?n(r):n,[i,...o]=e.content,a=t.renderChildren([i]),l=[`${s}${a}`];return o&&o.length>0&&o.forEach(c=>{const u=t.renderChildren([c]);if(u){const d=u.split(`
400
- `).map(f=>f?t.indent(f):"").join(`
401
- `);l.push(d)}}),l.join(`
402
- `)}function JF(e,t,n={}){const{state:r}=t,{doc:s,tr:i}=r,o=e;s.descendants((a,l)=>{const c=i.mapping.map(l),u=i.mapping.map(l)+a.nodeSize;let d=null;if(a.marks.forEach(p=>{if(p!==o)return!1;d=p}),!d)return;let f=!1;if(Object.keys(n).forEach(p=>{n[p]!==d.attrs[p]&&(f=!0)}),f){const p=e.type.create({...e.attrs,...n});i.removeMark(c,u,e.type),i.addMark(c,u,p)}}),i.docChanged&&t.view.dispatch(i)}var Kt=class vC extends ng{constructor(){super(...arguments),this.type="node"}static create(t={}){const n=typeof t=="function"?t():t;return new vC(n)}configure(t){return super.configure(t)}extend(t){const n=typeof t=="function"?t():t;return super.extend(n)}},ZF=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,n,r,s,i,o,a;const{view:l}=this.editor,c=e.target,u=c.nodeType===3?(t=c.parentElement)==null?void 0:t.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(c)||!u)return;let d=0,f=0;if(this.dom!==u){const w=this.dom.getBoundingClientRect(),v=u.getBoundingClientRect(),E=(s=e.offsetX)!=null?s:(r=e.nativeEvent)==null?void 0:r.offsetX,N=(o=e.offsetY)!=null?o:(i=e.nativeEvent)==null?void 0:i.offsetY;d=v.x-w.x+E,f=v.y-w.y+N}const p=this.dom.cloneNode(!0);try{const w=this.dom.getBoundingClientRect();p.style.width=`${Math.round(w.width)}px`,p.style.height=`${Math.round(w.height)}px`,p.style.boxSizing="border-box",p.style.pointerEvents="none"}catch{}let m=null;try{m=document.createElement("div"),m.style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.pointerEvents="none",m.appendChild(p),document.body.appendChild(m),(a=e.dataTransfer)==null||a.setDragImage(p,d,f)}finally{m&&setTimeout(()=>{try{m?.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const b=we.create(l.state.doc,g),y=l.state.tr.setSelection(b);l.dispatch(y)}stopEvent(e){var t;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:e});const n=e.target;if(!(this.dom.contains(n)&&!((t=this.contentDOM)!=null&&t.contains(n))))return!1;const s=e.type.startsWith("drag"),i=e.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!i&&!s)return!0;const{isEditable:a}=this.editor,{isDragging:l}=this,c=!!this.node.type.spec.draggable,u=we.isSelectable(this.node),d=e.type==="copy",f=e.type==="paste",p=e.type==="cut",m=e.type==="mousedown";if(!c&&u&&s&&e.target===this.dom&&e.preventDefault(),c&&s&&!l&&e.target===this.dom)return e.preventDefault(),!1;if(c&&a&&!l&&m){const g=n.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(l||i||d||f||p||m&&u)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type==="selection"||this.dom.contains(e.target)&&e.type==="childList"&&(Nd()||WE())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===e.target&&e.type==="attributes"?!0:!this.contentDOM.contains(e.target)}updateAttributes(e){this.editor.commands.command(({tr:t})=>{const n=this.getPos();return typeof n!="number"?!1:(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){const e=this.getPos();if(typeof e!="number")return;const t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function Oi(e){return new OF({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:s})=>{const i=rt(e.getAttributes,void 0,r,s);if(i===!1||i===null)return null;const{tr:o}=t,a=r[r.length-1],l=r[0];let c=n.to;if(a){const u=l.search(/\S/),d=n.from+l.indexOf(a),f=d+a.length;if(tg(n.from,n.to,t.doc).filter(m=>m.mark.type.excluded.find(b=>b===e.type&&b!==m.mark.type)).filter(m=>m.to>d).length)return null;f<n.to&&o.delete(f,n.to),d>n.from&&o.delete(n.from+u,d),c=n.from+u+a.length,o.addMark(n.from+u,c,e.type.create(i||{})),o.removeStoredMark(e.type)}}})}var Mf,ax;function YF(){return ax||(ax=1,Mf=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,s,i;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(s=r;s--!==0;)if(!e(t[s],n[s]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(s of t.entries())if(!n.has(s[0]))return!1;for(s of t.entries())if(!e(s[1],n.get(s[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(s of t.entries())if(!n.has(s[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(r=t.length,r!=n.length)return!1;for(s=r;s--!==0;)if(t[s]!==n[s])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(i=Object.keys(t),r=i.length,r!==Object.keys(n).length)return!1;for(s=r;s--!==0;)if(!Object.prototype.hasOwnProperty.call(n,i[s]))return!1;for(s=r;s--!==0;){var o=i[s];if(!(o==="_owner"&&t.$$typeof)&&!e(t[o],n[o]))return!1}return!0}return t!==t&&n!==n}),Mf}var XF=YF();const QF=tl(XF);var Rf={exports:{}},Of={};/**
403
- * @license React
404
- * use-sync-external-store-shim/with-selector.production.js
405
- *
406
- * Copyright (c) Meta Platforms, Inc. and affiliates.
407
- *
408
- * This source code is licensed under the MIT license found in the
409
- * LICENSE file in the root directory of this source tree.
410
- */var lx;function eB(){if(lx)return Of;lx=1;var e=Ow(),t=pS();function n(c,u){return c===u&&(c!==0||1/c===1/u)||c!==c&&u!==u}var r=typeof Object.is=="function"?Object.is:n,s=t.useSyncExternalStore,i=e.useRef,o=e.useEffect,a=e.useMemo,l=e.useDebugValue;return Of.useSyncExternalStoreWithSelector=function(c,u,d,f,p){var m=i(null);if(m.current===null){var g={hasValue:!1,value:null};m.current=g}else g=m.current;m=a(function(){function y(k){if(!w){if(w=!0,v=k,k=f(k),p!==void 0&&g.hasValue){var C=g.value;if(p(C,k))return E=C}return E=k}if(C=E,r(v,k))return C;var A=f(k);return p!==void 0&&p(C,A)?(v=k,C):(v=k,E=A)}var w=!1,v,E,N=d===void 0?null:d;return[function(){return y(u())},N===null?void 0:function(){return y(N())}]},[u,d,f,p]);var b=s(c,m[0],m[1]);return o(function(){g.hasValue=!0,g.value=b},[b]),l(b),b},Of}var cx;function tB(){return cx||(cx=1,Rf.exports=eB()),Rf.exports}var nB=tB(),rB=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},sB=({contentComponent:e})=>{const t=mS.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return h.jsx(h.Fragment,{children:Object.values(t)})};function iB(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:aT.createPortal(r.reactElement,r.element,n)},e.forEach(s=>s())},removeRenderer(n){const r={...t};delete r[n],t=r,e.forEach(s=>s())}}}var oB=class extends at.Component{constructor(e){var t;super(e),this.editorContentRef=at.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((t=e.editor)!=null&&t.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const t=this.editorContentRef.current;t.append(e.view.dom),e.setOptions({element:t}),e.contentComponent=iB(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(n=>n.hasContentComponentInitialized?n:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var e;const t=this.props.editor;if(t){this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null;try{if(!((e=t.view.dom)!=null&&e.firstChild))return;const n=document.createElement("div");n.append(t.view.dom),t.setOptions({element:n})}catch{}}}render(){const{editor:e,innerRef:t,...n}=this.props;return h.jsxs(h.Fragment,{children:[h.jsx("div",{ref:rB(t,this.editorContentRef),...n}),e?.contentComponent&&h.jsx(sB,{contentComponent:e.contentComponent})]})}},aB=x.forwardRef((e,t)=>{const n=at.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return at.createElement(oB,{key:n,innerRef:t,...e})}),lB=at.memo(aB),cB=typeof window<"u"?x.useLayoutEffect:x.useEffect,uB=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){const t=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",t),()=>{n.off("transaction",t)}}}};function dB(e){var t;const[n]=x.useState(()=>new uB(e.editor)),r=nB.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!=null?t:QF);return cB(()=>n.watch(e.editor),[e.editor,n]),x.useDebugValue(r),r}var fB=!1,dp=typeof window>"u",hB=dp||!!(typeof window<"u"&&window.next),pB=class wC{constructor(t){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=t,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(t){this.editor=t,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?dp||hB?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const t={...this.options.current,onBeforeCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onBeforeCreate)==null?void 0:i.call(s,...r)},onBlur:(...r)=>{var s,i;return(i=(s=this.options.current).onBlur)==null?void 0:i.call(s,...r)},onCreate:(...r)=>{var s,i;return(i=(s=this.options.current).onCreate)==null?void 0:i.call(s,...r)},onDestroy:(...r)=>{var s,i;return(i=(s=this.options.current).onDestroy)==null?void 0:i.call(s,...r)},onFocus:(...r)=>{var s,i;return(i=(s=this.options.current).onFocus)==null?void 0:i.call(s,...r)},onSelectionUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onSelectionUpdate)==null?void 0:i.call(s,...r)},onTransaction:(...r)=>{var s,i;return(i=(s=this.options.current).onTransaction)==null?void 0:i.call(s,...r)},onUpdate:(...r)=>{var s,i;return(i=(s=this.options.current).onUpdate)==null?void 0:i.call(s,...r)},onContentError:(...r)=>{var s,i;return(i=(s=this.options.current).onContentError)==null?void 0:i.call(s,...r)},onDrop:(...r)=>{var s,i;return(i=(s=this.options.current).onDrop)==null?void 0:i.call(s,...r)},onPaste:(...r)=>{var s,i;return(i=(s=this.options.current).onPaste)==null?void 0:i.call(s,...r)},onDelete:(...r)=>{var s,i;return(i=(s=this.options.current).onDelete)==null?void 0:i.call(s,...r)}};return new $F(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}static compareOptions(t,n){return Object.keys(t).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&t.extensions&&n.extensions?t.extensions.length!==n.extensions.length?!1:t.extensions.every((s,i)=>{var o;return s===((o=n.extensions)==null?void 0:o[i])}):t[r]===n[r])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?wC.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(t){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=t;return}if(this.previousDeps.length===t.length&&this.previousDeps.every((r,s)=>r===t[s]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=t}scheduleDestroy(){const t=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===t&&this.setEditor(null))},1)}};function mB(e={},t=[]){const n=x.useRef(e);n.current=e;const[r]=x.useState(()=>new pB(n)),s=mS.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return x.useDebugValue(s),x.useEffect(r.onRender(t)),dB({editor:s,selector:({transactionNumber:i})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&i===0?0:i+1}),s}var gB=x.createContext({editor:null});gB.Consumer;var kC=x.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),SC=()=>x.useContext(kC);function bB({as:e="div",...t}){const{nodeViewContentRef:n,nodeViewContentChildren:r}=SC();return h.jsx(e,{...t,ref:n,"data-node-view-content":"",style:{whiteSpace:"pre-wrap",...t.style},children:r})}var EC=at.forwardRef((e,t)=>{const{onDragStart:n}=SC(),r=e.as||"div";return h.jsx(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});function ux(e){return!!(typeof e=="function"&&e.prototype&&e.prototype.isReactComponent)}function dx(e){return!!(typeof e=="object"&&e.$$typeof&&(e.$$typeof.toString()==="Symbol(react.forward_ref)"||e.$$typeof.description==="react.forward_ref"))}function yB(e){return!!(typeof e=="object"&&e.$$typeof&&(e.$$typeof.toString()==="Symbol(react.memo)"||e.$$typeof.description==="react.memo"))}function xB(e){if(ux(e)||dx(e))return!0;if(yB(e)){const t=e.type;if(t)return ux(t)||dx(t)}return!1}function vB(){try{if(x.version)return parseInt(x.version.split(".")[0],10)>=19}catch{}return!1}var wB=class{constructor(e,{editor:t,props:n={},as:r="div",className:s=""}){this.ref=null,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),s&&this.element.classList.add(...s.split(" ")),this.editor.isInitialized?Ts.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.render()})}render(){var e;const t=this.component,n=this.props,r=this.editor,s=vB(),i=xB(t),o={...n};o.ref&&!(s||i)&&delete o.ref,!o.ref&&(s||i)&&(o.ref=a=>{this.ref=a}),this.reactElement=h.jsx(t,{...o}),(e=r?.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){this.props={...this.props,...e},this.render()}destroy(){var e;const t=this.editor;(e=t?.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}};at.createContext({markViewContentRef:()=>{}});var kB=class extends ZF{constructor(e,t,n){if(super(e,t,n),!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}mount(){const e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(l={})=>this.updateAttributes(l),deleteNode:()=>this.deleteNode(),ref:x.createRef()};if(!this.component.displayName){const l=c=>c.charAt(0).toUpperCase()+c.substring(1);this.component.displayName=l(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:l=>{l&&this.contentDOMElement&&l.firstChild!==this.contentDOMElement&&(l.hasAttribute("data-node-view-wrapper")&&l.removeAttribute("data-node-view-wrapper"),l.appendChild(this.contentDOMElement))}},s=this.component,i=x.memo(l=>h.jsx(kC.Provider,{value:r,children:x.createElement(s,l)}));i.displayName="ReactNodeView";let o=this.node.isInline?"span":"div";this.options.as&&(o=this.options.as);const{className:a=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new wB(i,{editor:this.editor,props:e,as:o,className:`node-${this.node.type.name} ${a}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var e;if(this.renderer.element.firstElementChild&&!((e=this.renderer.element.firstElementChild)!=null&&e.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(e,t,n){const r=s=>{this.renderer.updateProps(s),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const s=this.node,i=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.options.update({oldNode:s,oldDecorations:i,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n})})}return e===this.node&&this.decorations===t&&this.innerDecorations===n||(this.node=e,this.decorations=t,this.innerDecorations=n,r({node:e,decorations:t,innerDecorations:n})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs=="function"){const t=this.editor.extensionManager.attributes,n=Va(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function CC(e,t){return n=>n.editor.contentComponent?new kB(e,n,t):{}}var Vc=(e,t)=>{if(e==="slot")return 0;if(e instanceof Function)return e(t);const{children:n,...r}=t??{};if(e==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},SB=/^\s*>\s$/,EB=Kt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return Vc("blockquote",{...wt(this.options.HTMLAttributes,e),children:Vc("slot",{})})},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";const n=[];return e.content.forEach(s=>{const o=t.renderChildren(s).split(`
411
- `).map(a=>`> ${a}`).join(`
412
- `);n.push(o)}),n.flatMap(s=>[s,"> "]).slice(0,-1).join(`
413
- `)},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[_o({find:SB,type:this.type})]}}),CB=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,NB=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,_B=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,TB=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,AB=Xs.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return Vc("strong",{...wt(this.options.HTMLAttributes,e),children:Vc("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[No({find:CB,type:this.type}),No({find:_B,type:this.type})]},addPasteRules(){return[Oi({find:NB,type:this.type}),Oi({find:TB,type:this.type})]}}),MB=/(^|[^`])`([^`]+)`(?!`)$/,RB=/(^|[^`])`([^`]+)`(?!`)/g,OB=Xs.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",wt(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[No({find:MB,type:this.type})]},addPasteRules(){return[Oi({find:RB,type:this.type})]}}),If=4,IB=/^```([a-z]+)?[\s\n]$/,DB=/^~~~([a-z]+)?[\s\n]$/,NC=Kt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:If,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;const i=[...((t=e.firstElementChild)==null?void 0:t.classList)||[]].filter(o=>o.startsWith(n)).map(o=>o.replace(n,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",wt(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n;return((n=e.raw)==null?void 0:n.startsWith("```"))===!1&&e.codeBlockStyle!=="indented"?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r="";const s=((n=e.attrs)==null?void 0:n.language)||"";return e.content?r=[`\`\`\`${s}`,t.renderChildren(e.content),"```"].join(`
414
- `):r=`\`\`\`${s}
415
-
416
- \`\`\``,r},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=(t=this.options.tabSize)!=null?t:If,{state:r}=e,{selection:s}=r,{$from:i,empty:o}=s;if(i.parent.type!==this.type)return!1;const a=" ".repeat(n);return o?e.commands.insertContent(a):e.commands.command(({tr:l})=>{const{from:c,to:u}=s,p=r.doc.textBetween(c,u,`
417
- `,`
418
- `).split(`
419
- `).map(m=>a+m).join(`
420
- `);return l.replaceWith(c,u,r.schema.text(p)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=(t=this.options.tabSize)!=null?t:If,{state:r}=e,{selection:s}=r,{$from:i,empty:o}=s;return i.parent.type!==this.type?!1:o?e.commands.command(({tr:a})=>{var l;const{pos:c}=i,u=i.start(),d=i.end(),p=r.doc.textBetween(u,d,`
421
- `,`
422
- `).split(`
423
- `);let m=0,g=0;const b=c-u;for(let k=0;k<p.length;k+=1){if(g+p[k].length>=b){m=k;break}g+=p[k].length+1}const w=((l=p[m].match(/^ */))==null?void 0:l[0])||"",v=Math.min(w.length,n);if(v===0)return!0;let E=u;for(let k=0;k<m;k+=1)E+=p[k].length+1;return a.delete(E,E+v),c-E<=v&&a.setSelection(Ce.create(a.doc,E)),!0}):e.commands.command(({tr:a})=>{const{from:l,to:c}=s,f=r.doc.textBetween(l,c,`
424
- `,`
425
- `).split(`
426
- `).map(p=>{var m;const g=((m=p.match(/^ */))==null?void 0:m[0])||"",b=Math.min(g.length,n);return p.slice(b)}).join(`
427
- `);return a.replaceWith(l,c,r.schema.text(f)),!0})},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,o=r.parent.textContent.endsWith(`
428
-
429
- `);return!i||!o?!1:e.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:s,empty:i}=n;if(!i||s.parent.type!==this.type||!(s.parentOffset===s.parent.nodeSize-2))return!1;const a=s.after();return a===void 0?!1:r.nodeAt(a)?e.commands.command(({tr:c})=>(c.setSelection(Re.near(r.resolve(a))),!0)):e.commands.exitCode()}}},addInputRules(){return[cp({find:IB,type:this.type,getAttributes:e=>({language:e[1]})}),cp({find:DB,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new Et({key:new Lt("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,i=s?.mode;if(!n||!i)return!1;const{tr:o,schema:a}=e.state,l=a.text(n.replace(/\r\n?/g,`
430
- `));return o.replaceSelectionWith(this.type.create({language:i},l)),o.selection.$from.parent.type!==this.type&&o.setSelection(Ce.near(o.doc.resolve(Math.max(0,o.selection.from-2)))),o.setMeta("paste",!0),e.dispatch(o),!0}}})]}}),LB=NC,PB=Kt.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
431
-
432
- `):""}),jB=Kt.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",wt(this.options.HTMLAttributes,e)]},renderText(){return`
433
- `},renderMarkdown:(e,t)=>t.indent(`
434
- `),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:s,storedMarks:i}=n;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:o}=this.options,{splittableMarks:a}=r.extensionManager,l=i||s.$to.parentOffset&&s.$from.marks();return t().insertContent({type:this.name}).command(({tr:c,dispatch:u})=>{if(u&&l&&o){const d=l.filter(f=>a.includes(f.type.name));c.ensureMarks(d)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),zB=Kt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,wt(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;const r=(n=e.attrs)!=null&&n.level?parseInt(e.attrs.level,10):1,s="#".repeat(r);return e.content?`${s} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>cp({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),FB=Kt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",wt(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!UF(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,s=e();return iC(n)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({state:i,tr:o,dispatch:a})=>{if(a){const{$to:l}=o.selection,c=l.end();if(l.nodeAfter)l.nodeAfter.isTextblock?o.setSelection(Ce.create(o.doc,l.pos+1)):l.nodeAfter.isBlock?o.setSelection(we.create(o.doc,l.pos)):o.setSelection(Ce.create(o.doc,l.pos));else{const u=i.schema.nodes[this.options.nextNodeType]||l.parent.type.contentMatch.defaultType,d=u?.create();d&&(o.insert(c,d),o.setSelection(Ce.create(o.doc,c+1)))}o.scrollIntoView()}return!0}).run()}}},addInputRules(){return[xC({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),BB=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,$B=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,UB=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,HB=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,VB=Xs.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",wt(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[No({find:BB,type:this.type}),No({find:UB,type:this.type})]},addPasteRules(){return[Oi({find:$B,type:this.type}),Oi({find:HB,type:this.type})]}});const qB="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",WB="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",fp="numeric",hp="ascii",pp="alpha",xa="asciinumeric",aa="alphanumeric",mp="domain",_C="emoji",KB="scheme",GB="slashscheme",Df="whitespace";function JB(e,t){return e in t||(t[e]=[]),t[e]}function di(e,t,n){t[fp]&&(t[xa]=!0,t[aa]=!0),t[hp]&&(t[xa]=!0,t[pp]=!0),t[xa]&&(t[aa]=!0),t[pp]&&(t[aa]=!0),t[aa]&&(t[mp]=!0),t[_C]&&(t[mp]=!0);for(const r in t){const s=JB(r,n);s.indexOf(e)<0&&s.push(e)}}function ZB(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}function Rn(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Rn.groups={};Rn.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let r=0;r<t.jr.length;r++){const s=t.jr[r][0],i=t.jr[r][1];if(i&&s.test(e))return i}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let s=0;s<e.length;s++)this.tt(e[s],t,n,r)},tr(e,t,n,r){r=r||Rn.groups;let s;return t&&t.j?s=t:(s=new Rn(t),n&&r&&di(t,n,r)),this.jr.push([e,s]),s},ts(e,t,n,r){let s=this;const i=e.length;if(!i)return s;for(let o=0;o<i-1;o++)s=s.tt(e[o]);return s.tt(e[i-1],t,n,r)},tt(e,t,n,r){r=r||Rn.groups;const s=this;if(t&&t.j)return s.j[e]=t,t;const i=t;let o,a=s.go(e);if(a?(o=new Rn,Object.assign(o.j,a.j),o.jr.push.apply(o.jr,a.jr),o.jd=a.jd,o.t=a.t):o=new Rn,i){if(r)if(o.t&&typeof o.t=="string"){const l=Object.assign(ZB(o.t,r),n);di(i,l,r)}else n&&di(i,n,r);o.t=i}return s.j[e]=o,o}};const $e=(e,t,n,r,s)=>e.ta(t,n,r,s),At=(e,t,n,r,s)=>e.tr(t,n,r,s),fx=(e,t,n,r,s)=>e.ts(t,n,r,s),J=(e,t,n,r,s)=>e.tt(t,n,r,s),qr="WORD",gp="UWORD",TC="ASCIINUMERICAL",AC="ALPHANUMERICAL",qa="LOCALHOST",bp="TLD",yp="UTLD",pc="SCHEME",Yi="SLASH_SCHEME",og="NUM",xp="WS",ag="NL",va="OPENBRACE",wa="CLOSEBRACE",qc="OPENBRACKET",Wc="CLOSEBRACKET",Kc="OPENPAREN",Gc="CLOSEPAREN",Jc="OPENANGLEBRACKET",Zc="CLOSEANGLEBRACKET",Yc="FULLWIDTHLEFTPAREN",Xc="FULLWIDTHRIGHTPAREN",Qc="LEFTCORNERBRACKET",eu="RIGHTCORNERBRACKET",tu="LEFTWHITECORNERBRACKET",nu="RIGHTWHITECORNERBRACKET",ru="FULLWIDTHLESSTHAN",su="FULLWIDTHGREATERTHAN",iu="AMPERSAND",ou="APOSTROPHE",au="ASTERISK",vs="AT",lu="BACKSLASH",cu="BACKTICK",uu="CARET",Es="COLON",lg="COMMA",du="DOLLAR",Ar="DOT",fu="EQUALS",cg="EXCLAMATION",Yn="HYPHEN",ka="PERCENT",hu="PIPE",pu="PLUS",mu="POUND",Sa="QUERY",ug="QUOTE",MC="FULLWIDTHMIDDLEDOT",dg="SEMI",Mr="SLASH",Ea="TILDE",gu="UNDERSCORE",RC="EMOJI",bu="SYM";var OC=Object.freeze({__proto__:null,ALPHANUMERICAL:AC,AMPERSAND:iu,APOSTROPHE:ou,ASCIINUMERICAL:TC,ASTERISK:au,AT:vs,BACKSLASH:lu,BACKTICK:cu,CARET:uu,CLOSEANGLEBRACKET:Zc,CLOSEBRACE:wa,CLOSEBRACKET:Wc,CLOSEPAREN:Gc,COLON:Es,COMMA:lg,DOLLAR:du,DOT:Ar,EMOJI:RC,EQUALS:fu,EXCLAMATION:cg,FULLWIDTHGREATERTHAN:su,FULLWIDTHLEFTPAREN:Yc,FULLWIDTHLESSTHAN:ru,FULLWIDTHMIDDLEDOT:MC,FULLWIDTHRIGHTPAREN:Xc,HYPHEN:Yn,LEFTCORNERBRACKET:Qc,LEFTWHITECORNERBRACKET:tu,LOCALHOST:qa,NL:ag,NUM:og,OPENANGLEBRACKET:Jc,OPENBRACE:va,OPENBRACKET:qc,OPENPAREN:Kc,PERCENT:ka,PIPE:hu,PLUS:pu,POUND:mu,QUERY:Sa,QUOTE:ug,RIGHTCORNERBRACKET:eu,RIGHTWHITECORNERBRACKET:nu,SCHEME:pc,SEMI:dg,SLASH:Mr,SLASH_SCHEME:Yi,SYM:bu,TILDE:Ea,TLD:bp,UNDERSCORE:gu,UTLD:yp,UWORD:gp,WORD:qr,WS:xp});const Hr=/[a-z]/,Yo=new RegExp("\\p{L}","u"),Lf=new RegExp("\\p{Emoji}","u"),Vr=/\d/,Pf=/\s/,hx="\r",jf=`
435
- `,YB="️",XB="‍",zf="";let Bl=null,$l=null;function QB(e=[]){const t={};Rn.groups=t;const n=new Rn;Bl==null&&(Bl=px(qB)),$l==null&&($l=px(WB)),J(n,"'",ou),J(n,"{",va),J(n,"}",wa),J(n,"[",qc),J(n,"]",Wc),J(n,"(",Kc),J(n,")",Gc),J(n,"<",Jc),J(n,">",Zc),J(n,"(",Yc),J(n,")",Xc),J(n,"「",Qc),J(n,"」",eu),J(n,"『",tu),J(n,"』",nu),J(n,"<",ru),J(n,">",su),J(n,"&",iu),J(n,"*",au),J(n,"@",vs),J(n,"`",cu),J(n,"^",uu),J(n,":",Es),J(n,",",lg),J(n,"$",du),J(n,".",Ar),J(n,"=",fu),J(n,"!",cg),J(n,"-",Yn),J(n,"%",ka),J(n,"|",hu),J(n,"+",pu),J(n,"#",mu),J(n,"?",Sa),J(n,'"',ug),J(n,"/",Mr),J(n,";",dg),J(n,"~",Ea),J(n,"_",gu),J(n,"\\",lu),J(n,"・",MC);const r=At(n,Vr,og,{[fp]:!0});At(r,Vr,r);const s=At(r,Hr,TC,{[xa]:!0}),i=At(r,Yo,AC,{[aa]:!0}),o=At(n,Hr,qr,{[hp]:!0});At(o,Vr,s),At(o,Hr,o),At(s,Vr,s),At(s,Hr,s);const a=At(n,Yo,gp,{[pp]:!0});At(a,Hr),At(a,Vr,i),At(a,Yo,a),At(i,Vr,i),At(i,Hr),At(i,Yo,i);const l=J(n,jf,ag,{[Df]:!0}),c=J(n,hx,xp,{[Df]:!0}),u=At(n,Pf,xp,{[Df]:!0});J(n,zf,u),J(c,jf,l),J(c,zf,u),At(c,Pf,u),J(u,hx),J(u,jf),At(u,Pf,u),J(u,zf,u);const d=At(n,Lf,RC,{[_C]:!0});J(d,"#"),At(d,Lf,d),J(d,YB,d);const f=J(d,XB);J(f,"#"),At(f,Lf,d);const p=[[Hr,o],[Vr,s]],m=[[Hr,null],[Yo,a],[Vr,i]];for(let g=0;g<Bl.length;g++)ms(n,Bl[g],bp,qr,p);for(let g=0;g<$l.length;g++)ms(n,$l[g],yp,gp,m);di(bp,{tld:!0,ascii:!0},t),di(yp,{utld:!0,alpha:!0},t),ms(n,"file",pc,qr,p),ms(n,"mailto",pc,qr,p),ms(n,"http",Yi,qr,p),ms(n,"https",Yi,qr,p),ms(n,"ftp",Yi,qr,p),ms(n,"ftps",Yi,qr,p),di(pc,{scheme:!0,ascii:!0},t),di(Yi,{slashscheme:!0,ascii:!0},t),e=e.sort((g,b)=>g[0]>b[0]?1:-1);for(let g=0;g<e.length;g++){const b=e[g][0],w=e[g][1]?{[KB]:!0}:{[GB]:!0};b.indexOf("-")>=0?w[mp]=!0:Hr.test(b)?Vr.test(b)?w[xa]=!0:w[hp]=!0:w[fp]=!0,fx(n,b,b,w)}return fx(n,"localhost",qa,{ascii:!0}),n.jd=new Rn(bu),{start:n,tokens:Object.assign({groups:t},OC)}}function IC(e,t){const n=e$(t.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,s=[];let i=0,o=0;for(;o<r;){let a=e,l=null,c=0,u=null,d=-1,f=-1;for(;o<r&&(l=a.go(n[o]));)a=l,a.accepts()?(d=0,f=0,u=a):d>=0&&(d+=n[o].length,f++),c+=n[o].length,i+=n[o].length,o++;i-=d,o-=f,c-=d,s.push({t:u.t,v:t.slice(i-c,i),s:i-c,e:i})}return s}function e$(e){const t=[],n=e.length;let r=0;for(;r<n;){let s=e.charCodeAt(r),i,o=s<55296||s>56319||r+1===n||(i=e.charCodeAt(r+1))<56320||i>57343?e[r]:e.slice(r,r+2);t.push(o),r+=o.length}return t}function ms(e,t,n,r,s){let i;const o=t.length;for(let a=0;a<o-1;a++){const l=t[a];e.j[l]?i=e.j[l]:(i=new Rn(r),i.jr=s.slice(),e.j[l]=i),e=i}return i=new Rn(n),i.jr=s.slice(),e.j[t[o-1]]=i,i}function px(e){const t=[],n=[];let r=0,s="0123456789";for(;r<e.length;){let i=0;for(;s.indexOf(e[r+i])>=0;)i++;if(i>0){t.push(n.join(""));for(let o=parseInt(e.substring(r,r+i),10);o>0;o--)n.pop();r+=i}else n.push(e[r]),r++}return t}const Wa={defaultProtocol:"http",events:null,format:mx,formatHref:mx,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function fg(e,t=null){let n=Object.assign({},Wa);e&&(n=Object.assign(n,e instanceof fg?e.o:e));const r=n.ignoreTags,s=[];for(let i=0;i<r.length;i++)s.push(r[i].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=s}fg.prototype={o:Wa,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=t!=null;let s=this.o[e];return s&&(typeof s=="object"?(s=n.t in s?s[n.t]:Wa[e],typeof s=="function"&&r&&(s=s(t,n))):typeof s=="function"&&r&&(s=s(t,n.t,n)),s)},getObj(e,t,n){let r=this.o[e];return typeof r=="function"&&t!=null&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}};function mx(e){return e}function DC(e,t){this.t="token",this.v=e,this.tk=t}DC.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Wa.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),s=e.get("tagName",n,t),i=this.toFormattedString(e),o={},a=e.get("className",n,t),l=e.get("target",n,t),c=e.get("rel",n,t),u=e.getObj("attributes",n,t),d=e.getObj("events",n,t);return o.href=r,a&&(o.class=a),l&&(o.target=l),c&&(o.rel=c),u&&Object.assign(o,u),{tagName:s,attributes:o,content:i,eventListeners:d}}};function Od(e,t){class n extends DC{constructor(s,i){super(s,i),this.t=e}}for(const r in t)n.prototype[r]=t[r];return n.t=e,n}const gx=Od("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),bx=Od("text"),t$=Od("nl"),Ul=Od("url",{isLink:!0,toHref(e=Wa.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==qa&&e[1].t===Es}}),Zn=e=>new Rn(e);function n$({groups:e}){const t=e.domain.concat([iu,au,vs,lu,cu,uu,du,fu,Yn,og,ka,hu,pu,mu,Mr,bu,Ea,gu]),n=[ou,Es,lg,Ar,cg,ka,Sa,ug,dg,Jc,Zc,va,wa,Wc,qc,Kc,Gc,Yc,Xc,Qc,eu,tu,nu,ru,su],r=[iu,ou,au,lu,cu,uu,du,fu,Yn,va,wa,ka,hu,pu,mu,Sa,Mr,bu,Ea,gu],s=Zn(),i=J(s,Ea);$e(i,r,i),$e(i,e.domain,i);const o=Zn(),a=Zn(),l=Zn();$e(s,e.domain,o),$e(s,e.scheme,a),$e(s,e.slashscheme,l),$e(o,r,i),$e(o,e.domain,o);const c=J(o,vs);J(i,vs,c),J(a,vs,c),J(l,vs,c);const u=J(i,Ar);$e(u,r,i),$e(u,e.domain,i);const d=Zn();$e(c,e.domain,d),$e(d,e.domain,d);const f=J(d,Ar);$e(f,e.domain,d);const p=Zn(gx);$e(f,e.tld,p),$e(f,e.utld,p),J(c,qa,p);const m=J(d,Yn);J(m,Yn,m),$e(m,e.domain,d),$e(p,e.domain,d),J(p,Ar,f),J(p,Yn,m);const g=J(p,Es);$e(g,e.numeric,gx);const b=J(o,Yn),y=J(o,Ar);J(b,Yn,b),$e(b,e.domain,o),$e(y,r,i),$e(y,e.domain,o);const w=Zn(Ul);$e(y,e.tld,w),$e(y,e.utld,w),$e(w,e.domain,o),$e(w,r,i),J(w,Ar,y),J(w,Yn,b),J(w,vs,c);const v=J(w,Es),E=Zn(Ul);$e(v,e.numeric,E);const N=Zn(Ul),k=Zn();$e(N,t,N),$e(N,n,k),$e(k,t,N),$e(k,n,k),J(w,Mr,N),J(E,Mr,N);const C=J(a,Es),A=J(l,Es),R=J(A,Mr),T=J(R,Mr);$e(a,e.domain,o),J(a,Ar,y),J(a,Yn,b),$e(l,e.domain,o),J(l,Ar,y),J(l,Yn,b),$e(C,e.domain,N),J(C,Mr,N),J(C,Sa,N),$e(T,e.domain,N),$e(T,t,N),J(T,Mr,N);const I=[[va,wa],[qc,Wc],[Kc,Gc],[Jc,Zc],[Yc,Xc],[Qc,eu],[tu,nu],[ru,su]];for(let O=0;O<I.length;O++){const[j,L]=I[O],F=J(N,j);J(k,j,F),J(F,L,N);const q=Zn(Ul);$e(F,t,q);const te=Zn();$e(F,n),$e(q,t,q),$e(q,n,te),$e(te,t,q),$e(te,n,te),J(q,L,N),J(te,L,N)}return J(s,qa,w),J(s,ag,t$),{start:s,tokens:OC}}function r$(e,t,n){let r=n.length,s=0,i=[],o=[];for(;s<r;){let a=e,l=null,c=null,u=0,d=null,f=-1;for(;s<r&&!(l=a.go(n[s].t));)o.push(n[s++]);for(;s<r&&(c=l||a.go(n[s].t));)l=null,a=c,a.accepts()?(f=0,d=a):f>=0&&f++,s++,u++;if(f<0)s-=u,s<r&&(o.push(n[s]),s++);else{o.length>0&&(i.push(Ff(bx,t,o)),o=[]),s-=f,u-=f;const p=d.t,m=n.slice(s-u,s);i.push(Ff(p,t,m))}}return o.length>0&&i.push(Ff(bx,t,o)),i}function Ff(e,t,n){const r=n[0].s,s=n[n.length-1].e,i=t.slice(r,s);return new e(i,n)}const s$=typeof console<"u"&&console&&console.warn||(()=>{}),i$="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",St={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function o$(){return Rn.groups={},St.scanner=null,St.parser=null,St.tokenQueue=[],St.pluginQueue=[],St.customSchemes=[],St.initialized=!1,St}function yx(e,t=!1){if(St.initialized&&s$(`linkifyjs: already initialized - will not register custom scheme "${e}" ${i$}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))throw new Error(`linkifyjs: incorrect scheme format.
436
- 1. Must only contain digits, lowercase ASCII letters or "-"
437
- 2. Cannot start or end with "-"
438
- 3. "-" cannot repeat`);St.customSchemes.push([e,t])}function a$(){St.scanner=QB(St.customSchemes);for(let e=0;e<St.tokenQueue.length;e++)St.tokenQueue[e][1]({scanner:St.scanner});St.parser=n$(St.scanner.tokens);for(let e=0;e<St.pluginQueue.length;e++)St.pluginQueue[e][1]({scanner:St.scanner,parser:St.parser});return St.initialized=!0,St}function hg(e){return St.initialized||a$(),r$(St.parser.start,e,IC(St.scanner.start,e))}hg.scan=IC;function LC(e,t=null,n=null){if(t&&typeof t=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new fg(n),s=hg(e),i=[];for(let o=0;o<s.length;o++){const a=s[o];a.isLink&&(!t||a.t===t)&&r.check(a)&&i.push(a.toFormattedObject(r))}return i}var pg="[\0-   ᠎ -\u2029  ]",l$=new RegExp(pg),c$=new RegExp(`${pg}$`),u$=new RegExp(pg,"g");function d$(e){return e.length===1?e[0].isLink:e.length===3&&e[1].isLink?["()","[]"].includes(e[0].value+e[2].value):!1}function f$(e){return new Et({key:new Lt("autolink"),appendTransaction:(t,n,r)=>{const s=t.some(c=>c.docChanged)&&!n.doc.eq(r.doc),i=t.some(c=>c.getMeta("preventAutolink"));if(!s||i)return;const{tr:o}=r,a=ZE(n.doc,[...t]);if(sC(a).forEach(({newRange:c})=>{const u=Gz(r.doc,c,p=>p.isTextblock);let d,f;if(u.length>1)d=u[0],f=r.doc.textBetween(d.pos,d.pos+d.node.nodeSize,void 0," ");else if(u.length){const p=r.doc.textBetween(c.from,c.to," "," ");if(!c$.test(p))return;d=u[0],f=r.doc.textBetween(d.pos,c.to,void 0," ")}if(d&&f){const p=f.split(l$).filter(Boolean);if(p.length<=0)return!1;const m=p[p.length-1],g=d.pos+f.lastIndexOf(m);if(!m)return!1;const b=hg(m).map(y=>y.toObject(e.defaultProtocol));if(!d$(b))return!1;b.filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>e.validate(y.value)).filter(y=>e.shouldAutoLink(y.value)).forEach(y=>{tg(y.from,y.to,r.doc).some(w=>w.mark.type===e.type)||o.addMark(y.from,y.to,e.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function h$(e){return new Et({key:new Lt("handleClickLink"),props:{handleClick:(t,n,r)=>{var s,i;if(r.button!==0||!t.editable)return!1;let o=null;if(r.target instanceof HTMLAnchorElement)o=r.target;else{let u=r.target;const d=[];for(;u.nodeName!=="DIV";)d.push(u),u=u.parentNode;o=d.find(f=>f.nodeName==="A")}if(!o)return!1;const a=rC(t.state,e.type.name),l=(s=o?.href)!=null?s:a.href,c=(i=o?.target)!=null?i:a.target;return e.enableClickSelection&&e.editor.commands.extendMarkRange(e.type.name),o&&l?(window.open(l,c),!0):!1}}})}function p$(e){return new Et({key:new Lt("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:s}=e,{state:i}=t,{selection:o}=i,{empty:a}=o;if(a)return!1;let l="";r.content.forEach(u=>{l+=u.textContent});const c=LC(l,{defaultProtocol:e.defaultProtocol}).find(u=>u.isLink&&u.value===l);return!l||!c||s!==void 0&&!s(c.href)?!1:e.editor.commands.setMark(e.type,{href:c.href})}}})}function ni(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&n.push(s)}),!e||e.replace(u$,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var m$=Xs.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{if(typeof e=="string"){yx(e);return}yx(e.scheme,e.optionalSlashes)})},onDestroy(){o$()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!ni(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:n=>!!ni(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!ni(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",wt(this.options.HTMLAttributes,e),0]:["a",wt(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n;const r=((n=e.attrs)==null?void 0:n.href)||"";return`[${t.renderChildren(e)}](${r})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:r=>!!ni(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!ni(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Oi({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,s=LC(e).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:o=>!!ni(o,n),protocols:n,defaultProtocol:r}));s.length&&s.forEach(i=>{this.options.shouldAutoLink(i.value)&&t.push({text:i.value,data:{href:i.href},index:i.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)==null?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(f$({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!ni(s,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&e.push(h$({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(p$({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e}}),g$=Object.defineProperty,b$=(e,t)=>{for(var n in t)g$(e,n,{get:t[n],enumerable:!0})},y$="listItem",xx="textStyle",vx=/^\s*([-+*])\s$/,PC=Kt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",wt(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>e.type!=="list"||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
439
- `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(y$,this.editor.getAttributes(xx)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=_o({find:vx,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=_o({find:vx,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(xx),editor:this.editor})),[e]}}),jC=Kt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",wt(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{if(e.type!=="list_item")return[];let n=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(s=>s.type==="paragraph"))n=t.parseChildren(e.tokens);else{const s=e.tokens[0];if(s&&s.type==="text"&&s.tokens&&s.tokens.length>0){if(n=[{type:"paragraph",content:t.parseInline(s.tokens)}],e.tokens.length>1){const o=e.tokens.slice(1),a=t.parseChildren(o);n.push(...a)}}else n=t.parseChildren(e.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(e,t,n)=>ig(e,t,r=>r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${r.index+1}. `:"- ",n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),x$={};b$(x$,{findListItemPos:()=>bl,getNextListDepth:()=>mg,handleBackspace:()=>vp,handleDelete:()=>wp,hasListBefore:()=>zC,hasListItemAfter:()=>v$,hasListItemBefore:()=>FC,listItemHasSubList:()=>BC,nextListIsDeeper:()=>$C,nextListIsHigher:()=>UC});var bl=(e,t)=>{const{$from:n}=t.selection,r=Bt(e,t.schema);let s=null,i=n.depth,o=n.pos,a=null;for(;i>0&&a===null;)s=n.node(i),s.type===r?a=i:(i-=1,o-=1);return a===null?null:{$pos:t.doc.resolve(o),depth:a}},mg=(e,t)=>{const n=bl(e,t);if(!n)return!1;const[,r]=rF(t,e,n.$pos.pos+4);return r},zC=(e,t,n)=>{const{$anchor:r}=e.selection,s=Math.max(0,r.pos-2),i=e.doc.resolve(s).node();return!(!i||!n.includes(i.type.name))},FC=(e,t)=>{var n;const{$anchor:r}=t.selection,s=t.doc.resolve(r.pos-2);return!(s.index()===0||((n=s.nodeBefore)==null?void 0:n.type.name)!==e)},BC=(e,t,n)=>{if(!n)return!1;const r=Bt(e,t.schema);let s=!1;return n.descendants(i=>{i.type===r&&(s=!0)}),s},vp=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!Us(e.state,t)&&zC(e.state,t,n)){const{$anchor:a}=e.state.selection,l=e.state.doc.resolve(a.before()-1),c=[];l.node().descendants((f,p)=>{f.type.name===t&&c.push({node:f,pos:p})});const u=c.at(-1);if(!u)return!1;const d=e.state.doc.resolve(l.start()+u.pos+1);return e.chain().cut({from:a.start()-1,to:a.end()+1},d.end()).joinForward().run()}if(!Us(e.state,t)||!aF(e.state))return!1;const r=bl(t,e.state);if(!r)return!1;const i=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),o=BC(t,e.state,i);return FC(t,e.state)&&!o?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},$C=(e,t)=>{const n=mg(e,t),r=bl(e,t);return!r||!n?!1:n>r.depth},UC=(e,t)=>{const n=mg(e,t),r=bl(e,t);return!r||!n?!1:n<r.depth},wp=(e,t)=>{if(!Us(e.state,t)||!oF(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:s}=n;return!n.empty&&r.sameParent(s)?!1:$C(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():UC(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward()},v$=(e,t)=>{var n;const{$anchor:r}=t.selection,s=t.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((n=s.nodeAfter)==null?void 0:n.type.name)!==e)},HC=_t.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&wp(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{e.state.schema.nodes[n]!==void 0&&wp(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&vp(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{e.state.schema.nodes[n]!==void 0&&vp(e,n,r)&&(t=!0)}),t}}}}),wx=/^(\s*)(\d+)\.\s+(.*)$/,w$=/^\s/;function k$(e){const t=[];let n=0,r=0;for(;n<e.length;){const s=e[n],i=s.match(wx);if(!i)break;const[,o,a,l]=i,c=o.length;let u=l,d=n+1;const f=[s];for(;d<e.length;){const p=e[d];if(p.match(wx))break;if(p.trim()==="")f.push(p),u+=`
440
- `,d+=1;else if(p.match(w$))f.push(p),u+=`
441
- ${p.slice(c+2)}`,d+=1;else break}t.push({indent:c,number:parseInt(a,10),content:u.trim(),raw:f.join(`
442
- `)}),r=d,n=d}return[t,r]}function VC(e,t,n){var r;const s=[];let i=0;for(;i<e.length;){const o=e[i];if(o.indent===t){const a=o.content.split(`
443
- `),l=((r=a[0])==null?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const u=a.slice(1).join(`
444
- `).trim();if(u){const p=n.blockTokens(u);c.push(...p)}let d=i+1;const f=[];for(;d<e.length&&e[d].indent>t;)f.push(e[d]),d+=1;if(f.length>0){const p=Math.min(...f.map(g=>g.indent)),m=VC(f,p,n);c.push({type:"list",ordered:!0,start:f[0].number,items:m,raw:f.map(g=>g.raw).join(`
445
- `)})}s.push({type:"list_item",raw:o.raw,tokens:c}),i=d}else i+=1}return s}function S$(e,t){return e.map(n=>{if(n.type!=="list_item")return t.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(s=>{if(s.type==="paragraph"||s.type==="list"||s.type==="blockquote"||s.type==="code")r.push(...t.parseChildren([s]));else if(s.type==="text"&&s.tokens){const i=t.parseChildren([s]);r.push({type:"paragraph",content:i})}else{const i=t.parseChildren([s]);i.length>0&&r.push(...i)}}),{type:"listItem",content:r}})}var E$="listItem",kx="textStyle",Sx=/^(\d+)\.\s$/,qC=Kt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",wt(this.options.HTMLAttributes,n),0]:["ol",wt(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{if(e.type!=="list"||!e.ordered)return[];const n=e.start||1,r=e.items?S$(e.items,t):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
446
- `):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),n=t?.index;return n!==void 0?n:-1},tokenize:(e,t,n)=>{var r;const s=e.split(`
447
- `),[i,o]=k$(s);if(i.length===0)return;const a=VC(i,0,n);return a.length===0?void 0:{type:"list",ordered:!0,start:((r=i[0])==null?void 0:r.number)||1,items:a,raw:s.slice(0,o).join(`
448
- `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(E$,this.editor.getAttributes(kx)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=_o({find:Sx,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=_o({find:Sx,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(kx)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),C$=/^\s*(\[([( |x])?\])\s$/,N$=Kt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return t===""||t==="true"},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",wt(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;const s=`- [${(n=e.attrs)!=null&&n.checked?"x":" "}] `;return ig(e,t,s)},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const s=document.createElement("li"),i=document.createElement("label"),o=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=u=>{var d,f;a.ariaLabel=((f=(d=this.options.a11y)==null?void 0:d.checkboxLabel)==null?void 0:f.call(d,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return c(e),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:d}=u.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:f})=>{const p=n();if(typeof p!="number")return!1;const m=f.doc.nodeAt(p);return f.setNodeMarkup(p,void 0,{...m?.attrs,checked:d}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,d)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,d])=>{s.setAttribute(u,d)}),s.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,i.append(a,o),s.append(i,l),Object.entries(t).forEach(([u,d])=>{s.setAttribute(u,d)}),{dom:s,contentDOM:l,update:u=>u.type!==this.type?!1:(s.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,c(u),!0)}}},addInputRules(){return[_o({find:C$,type:this.type,getAttributes:e=>({checked:e[e.length-1]==="x"})})]}}),_$=Kt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",wt(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,`
449
- `):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const n=(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:t.index;return n!==void 0?n:-1},tokenize(e,t,n){const r=i=>{const o=up(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:a=>({indentLevel:a[1].length,mainContent:a[4],checked:a[3].toLowerCase()==="x"}),createToken:(a,l)=>({type:"taskItem",raw:"",mainContent:a.mainContent,indentLevel:a.indentLevel,checked:a.checked,text:a.mainContent,tokens:n.inlineTokens(a.mainContent),nestedTokens:l}),customNestedParser:r},n);return o?[{type:"taskList",raw:o.raw,items:o.items}]:n.blockTokens(i)},s=up(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,o)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:o}),customNestedParser:r},n);if(s)return{type:"taskList",raw:s.raw,items:s.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),T$=_t.create({name:"listKit",addExtensions(){const e=[];return this.options.bulletList!==!1&&e.push(PC.configure(this.options.bulletList)),this.options.listItem!==!1&&e.push(jC.configure(this.options.listItem)),this.options.listKeymap!==!1&&e.push(HC.configure(this.options.listKeymap)),this.options.orderedList!==!1&&e.push(qC.configure(this.options.orderedList)),this.options.taskItem!==!1&&e.push(N$.configure(this.options.taskItem)),this.options.taskList!==!1&&e.push(_$.configure(this.options.taskList)),e}}),A$=Kt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",wt(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];return n.length===1&&n[0].type==="image"?t.parseChildren([n[0]]):t.createNode("paragraph",void 0,t.parseInline(n))},renderMarkdown:(e,t)=>!e||!Array.isArray(e.content)?"":t.renderChildren(e.content),addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),M$=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,R$=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,O$=Xs.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",wt(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[No({find:M$,type:this.type})]},addPasteRules(){return[Oi({find:R$,type:this.type})]}}),I$=Kt.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),D$=Xs.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["u",wt(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,t,n){const s=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!s)return;const i=s[2].trim();return{type:"underline",raw:s[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function L$(e={}){return new Et({view(t){return new P$(t,e)}})}class P${constructor(t,n){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let i=o=>{this[s](o)};return t.dom.addEventListener(s,i),{name:s,handler:i}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r,s=this.editorView.dom,i=s.getBoundingClientRect(),o=i.width/s.offsetWidth,a=i.height/s.offsetHeight;if(n){let d=t.nodeBefore,f=t.nodeAfter;if(d||f){let p=this.editorView.nodeDOM(this.cursorPos-(d?d.nodeSize:0));if(p){let m=p.getBoundingClientRect(),g=d?m.bottom:m.top;d&&f&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let b=this.width/2*a;r={left:m.left,right:m.right,top:g-b,bottom:g+b}}}}if(!r){let d=this.editorView.coordsAtPos(this.cursorPos),f=this.width/2*o;r={left:d.left-f,right:d.left+f,top:d.top,bottom:d.bottom}}let l=this.editorView.dom.offsetParent;this.element||(this.element=l.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let c,u;if(!l||l==document.body&&getComputedStyle(l).position=="static")c=-pageXOffset,u=-pageYOffset;else{let d=l.getBoundingClientRect(),f=d.width/l.offsetWidth,p=d.height/l.offsetHeight;c=d.left-l.scrollLeft*f,u=d.top-l.scrollTop*p}this.element.style.left=(r.left-c)/o+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/o+"px",this.element.style.height=(r.bottom-r.top)/a+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),s=r&&r.type.spec.disableDropCursor,i=typeof s=="function"?s(this.editorView,n,t):s;if(n&&!i){let o=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=US(this.editorView.state.doc,o,this.editorView.dragging.slice);a!=null&&(o=a)}this.setCursor(o),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}class Mt extends Re{constructor(t){super(t,t)}map(t,n){let r=t.resolve(n.map(this.head));return Mt.valid(r)?new Mt(r):Re.near(r)}content(){return se.empty}eq(t){return t instanceof Mt&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Mt(t.resolve(n.pos))}getBookmark(){return new gg(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!j$(t)||!z$(t))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let s=n.contentMatchAt(t.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(t,n,r=!1){e:for(;;){if(!r&&Mt.valid(t))return t;let s=t.pos,i=null;for(let o=t.depth;;o--){let a=t.node(o);if(n>0?t.indexAfter(o)<a.childCount:t.index(o)>0){i=a.child(n>0?t.indexAfter(o):t.index(o)-1);break}else if(o==0)return null;s+=n;let l=t.doc.resolve(s);if(Mt.valid(l))return l}for(;;){let o=n>0?i.firstChild:i.lastChild;if(!o){if(i.isAtom&&!i.isText&&!we.isSelectable(i)){t=t.doc.resolve(s+i.nodeSize*n),r=!1;continue e}break}i=o,s+=n;let a=t.doc.resolve(s);if(Mt.valid(a))return a}return null}}}Mt.prototype.visible=!1;Mt.findFrom=Mt.findGapCursorFrom;Re.jsonID("gapcursor",Mt);class gg{constructor(t){this.pos=t}map(t){return new gg(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return Mt.valid(n)?new Mt(n):Re.near(n)}}function WC(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function j$(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||WC(s.type))return!0;if(s.inlineContent)return!1}}return!0}function z$(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(n);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||WC(s.type))return!0;if(s.inlineContent)return!1}}return!0}function F$(){return new Et({props:{decorations:H$,createSelectionBetween(e,t,n){return t.pos==n.pos&&Mt.valid(n)?new Mt(n):null},handleClick:$$,handleKeyDown:B$,handleDOMEvents:{beforeinput:U$}}})}const B$=Gm({ArrowLeft:Hl("horiz",-1),ArrowRight:Hl("horiz",1),ArrowUp:Hl("vert",-1),ArrowDown:Hl("vert",1)});function Hl(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,s,i){let o=r.selection,a=t>0?o.$to:o.$from,l=o.empty;if(o instanceof Ce){if(!i.endOfTextblock(n)||a.depth==0)return!1;l=!1,a=r.doc.resolve(t>0?a.after():a.before())}let c=Mt.findGapCursorFrom(a,t,l);return c?(s&&s(r.tr.setSelection(new Mt(c))),!0):!1}}function $$(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Mt.valid(r))return!1;let s=e.posAtCoords({left:n.clientX,top:n.clientY});return s&&s.inside>-1&&we.isSelectable(e.state.doc.nodeAt(s.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Mt(r))),!0)}function U$(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof Mt))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let s=V.empty;for(let o=r.length-1;o>=0;o--)s=V.from(r[o].createAndFill(null,s));let i=e.state.tr.replace(n.pos,n.pos,new se(s,0,0));return i.setSelection(Ce.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function H$(e){if(!(e.selection instanceof Mt))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",ft.create(e.doc,[Wt.widget(e.selection.head,t,{key:"gapcursor"})])}var yu=200,Qt=function(){};Qt.prototype.append=function(t){return t.length?(t=Qt.from(t),!this.length&&t||t.length<yu&&this.leafAppend(t)||this.length<yu&&t.leafPrepend(this)||this.appendInner(t)):this};Qt.prototype.prepend=function(t){return t.length?Qt.from(t).append(this):this};Qt.prototype.appendInner=function(t){return new V$(this,t)};Qt.prototype.slice=function(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.length),t>=n?Qt.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};Qt.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};Qt.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};Qt.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var s=[];return this.forEach(function(i,o){return s.push(t(i,o))},n,r),s};Qt.from=function(t){return t instanceof Qt?t:t&&t.length?new KC(t):Qt.empty};var KC=(function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(s,i){return s==0&&i==this.length?this:new t(this.values.slice(s,i))},t.prototype.getInner=function(s){return this.values[s]},t.prototype.forEachInner=function(s,i,o,a){for(var l=i;l<o;l++)if(s(this.values[l],a+l)===!1)return!1},t.prototype.forEachInvertedInner=function(s,i,o,a){for(var l=i-1;l>=o;l--)if(s(this.values[l],a+l)===!1)return!1},t.prototype.leafAppend=function(s){if(this.length+s.length<=yu)return new t(this.values.concat(s.flatten()))},t.prototype.leafPrepend=function(s){if(this.length+s.length<=yu)return new t(s.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t})(Qt);Qt.empty=new KC([]);var V$=(function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,s,i,o){var a=this.left.length;if(s<a&&this.left.forEachInner(r,s,Math.min(i,a),o)===!1||i>a&&this.right.forEachInner(r,Math.max(s-a,0),Math.min(this.length,i)-a,o+a)===!1)return!1},t.prototype.forEachInvertedInner=function(r,s,i,o){var a=this.left.length;if(s>a&&this.right.forEachInvertedInner(r,s-a,Math.max(i,a)-a,o+a)===!1||i<a&&this.left.forEachInvertedInner(r,Math.min(s,a),i,o)===!1)return!1},t.prototype.sliceInner=function(r,s){if(r==0&&s==this.length)return this;var i=this.left.length;return s<=i?this.left.slice(r,s):r>=i?this.right.slice(r-i,s-i):this.left.slice(r,i).append(this.right.slice(0,s-i))},t.prototype.leafAppend=function(r){var s=this.right.leafAppend(r);if(s)return new t(this.left,s)},t.prototype.leafPrepend=function(r){var s=this.left.leafPrepend(r);if(s)return new t(s,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t})(Qt);const q$=500;class mr{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,i;n&&(s=this.remapping(r,this.items.length),i=s.maps.length);let o=t.tr,a,l,c=[],u=[];return this.items.forEach((d,f)=>{if(!d.step){s||(s=this.remapping(r,f+1),i=s.maps.length),i--,u.push(d);return}if(s){u.push(new Rr(d.map));let p=d.step.map(s.slice(i)),m;p&&o.maybeStep(p).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],c.push(new Rr(m,void 0,void 0,c.length+u.length))),i--,m&&s.appendMap(m,i)}else o.maybeStep(d.step);if(d.selection)return a=s?d.selection.map(s.slice(i)):d.selection,l=new mr(this.items.slice(0,r).append(u.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:a}}addTransform(t,n,r,s){let i=[],o=this.eventCount,a=this.items,l=!s&&a.length?a.get(a.length-1):null;for(let u=0;u<t.steps.length;u++){let d=t.steps[u].invert(t.docs[u]),f=new Rr(t.mapping.maps[u],d,n),p;(p=l&&l.merge(f))&&(f=p,u?i.pop():a=a.slice(0,a.length-1)),i.push(f),n&&(o++,n=void 0),s||(l=f)}let c=o-r.depth;return c>K$&&(a=W$(a,c),o-=c),new mr(a.append(i),o)}remapping(t,n){let r=new ja;return this.items.forEach((s,i)=>{let o=s.mirrorOffset!=null&&i-s.mirrorOffset>=t?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,o)},t,n),r}addMaps(t){return this.eventCount==0?this:new mr(this.items.append(t.map(n=>new Rr(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-n),i=t.mapping,o=t.steps.length,a=this.eventCount;this.items.forEach(f=>{f.selection&&a--},s);let l=n;this.items.forEach(f=>{let p=i.getMirror(--l);if(p==null)return;o=Math.min(o,p);let m=i.maps[p];if(f.step){let g=t.steps[p].invert(t.docs[p]),b=f.selection&&f.selection.map(i.slice(l+1,p));b&&a++,r.push(new Rr(m,g,b))}else r.push(new Rr(m))},s);let c=[];for(let f=n;f<o;f++)c.push(new Rr(i.maps[f]));let u=this.items.slice(0,s).append(c).append(r),d=new mr(u,a);return d.emptyItemCount()>q$&&(d=d.compress(this.items.length-r.length)),d}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,s=[],i=0;return this.items.forEach((o,a)=>{if(a>=t)s.push(o),o.selection&&i++;else if(o.step){let l=o.step.map(n.slice(r)),c=l&&l.getMap();if(r--,c&&n.appendMap(c,r),l){let u=o.selection&&o.selection.map(n.slice(r));u&&i++;let d=new Rr(c.invert(),l,u),f,p=s.length-1;(f=s.length&&s[p].merge(d))?s[p]=f:s.push(d)}}else o.map&&r--},this.items.length,0),new mr(Qt.from(s.reverse()),i)}}mr.empty=new mr(Qt.empty,0);function W$(e,t){let n;return e.forEach((r,s)=>{if(r.selection&&t--==0)return n=s,!1}),e.slice(n)}class Rr{constructor(t,n,r,s){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=s}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new Rr(n.getMap().invert(),n,this.selection)}}}class ws{constructor(t,n,r,s,i){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=s,this.prevComposition=i}}const K$=20;function G$(e,t,n,r){let s=n.getMeta(yi),i;if(s)return s.historyState;n.getMeta(Y$)&&(e=new ws(e.done,e.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(o&&o.getMeta(yi))return o.getMeta(yi).redo?new ws(e.done.addTransform(n,void 0,r,mc(t)),e.undone,Ex(n.mapping.maps),e.prevTime,e.prevComposition):new ws(e.done,e.undone.addTransform(n,void 0,r,mc(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=e.prevTime==0||!o&&e.prevComposition!=a&&(e.prevTime<(n.time||0)-r.newGroupDelay||!J$(n,e.prevRanges)),c=o?Bf(e.prevRanges,n.mapping):Ex(n.mapping.maps);return new ws(e.done.addTransform(n,l?t.selection.getBookmark():void 0,r,mc(t)),mr.empty,c,n.time,a??e.prevComposition)}else return(i=n.getMeta("rebased"))?new ws(e.done.rebased(n,i),e.undone.rebased(n,i),Bf(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new ws(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),Bf(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function J$(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,s)=>{for(let i=0;i<t.length;i+=2)r<=t[i+1]&&s>=t[i]&&(n=!0)}),n}function Ex(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,s,i,o)=>t.push(i,o));return t}function Bf(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let s=t.map(e[r],1),i=t.map(e[r+1],-1);s<=i&&n.push(s,i)}return n}function Z$(e,t,n){let r=mc(t),s=yi.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let o=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),s,r),l=new ws(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(o).setMeta(yi,{redo:n,historyState:l})}let $f=!1,Cx=null;function mc(e){let t=e.plugins;if(Cx!=t){$f=!1,Cx=t;for(let n=0;n<t.length;n++)if(t[n].spec.historyPreserveItems){$f=!0;break}}return $f}const yi=new Lt("history"),Y$=new Lt("closeHistory");function X$(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new Et({key:yi,state:{init(){return new ws(mr.empty,mr.empty,null,0,-1)},apply(t,n,r){return G$(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(t,n){let r=n.inputType,s=r=="historyUndo"?JC:r=="historyRedo"?ZC:null;return s?(n.preventDefault(),s(t.state,t.dispatch)):!1}}}})}function GC(e,t){return(n,r)=>{let s=yi.getState(n);if(!s||(e?s.undone:s.done).eventCount==0)return!1;if(r){let i=Z$(s,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const JC=GC(!1,!0),ZC=GC(!0,!0);_t.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(t=>t!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{const t=e?.node||this.editor.state.doc;if((e?.mode||this.options.mode)==="textSize"){const r=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(r)}return t.nodeSize},this.storage.words=e=>{const t=e?.node||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new Et({key:new Lt("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const s=this.options.limit;if(s==null||s===0){e=!0;return}const i=this.storage.characters({node:r.doc});if(i>s){const o=i-s,a=0,l=o;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const c=r.tr.deleteRange(a,l);return e=!0,c}e=!0},filterTransaction:(t,n)=>{const r=this.options.limit;if(!t.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:n.doc}),i=this.storage.characters({node:t.doc});if(i<=r||s>r&&i>r&&i<=s)return!0;if(s>r&&i>r&&i>s||!t.getMeta("paste"))return!1;const a=t.selection.$head.pos,l=i-r,c=a-l,u=a;return t.deleteRange(c,u),!(this.storage.characters({node:t.doc})>r)}})]}});var Q$=_t.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[L$(this.options)]}});_t.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Et({key:new Lt("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:s}=t,i=[];if(!n||!r)return ft.create(e,[]);let o=0;this.options.mode==="deepest"&&e.descendants((l,c)=>{if(l.isText)return;if(!(s>=c&&s<=c+l.nodeSize-1))return!1;o+=1});let a=0;return e.descendants((l,c)=>{if(l.isText||!(s>=c&&s<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&o-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";i.push(Wt.node(c,c+l.nodeSize,{class:this.options.className}))}),ft.create(e,i)}}})]}});var e4=_t.create({name:"gapCursor",addProseMirrorPlugins(){return[F$()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=rt(ke(e,"allowGapCursor",n)))!=null?t:null}}}),t4=_t.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Et({key:new Lt("placeholder"),props:{decorations:({doc:e,selection:t})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,s=[];if(!n)return null;const i=this.editor.isEmpty;return e.descendants((o,a)=>{const l=r>=a&&r<=a+o.nodeSize,c=!o.isLeaf&&Ad(o);if((l||!this.options.showOnlyCurrent)&&c){const u=[this.options.emptyNodeClass];i&&u.push(this.options.emptyEditorClass);const d=Wt.node(a,a+o.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:o,pos:a,hasAnchor:l}):this.options.placeholder});s.push(d)}return this.options.includeChildren}),ft.create(e,s)}}})]}});_t.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new Et({key:new Lt("selection"),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||iC(n.selection)||e.view.dragging?null:ft.create(n.doc,[Wt.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});function Nx({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||t?.type===e}var n4=_t.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var e;const t=new Lt(this.name),n=((e=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:e.name)||this.options.node||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,s])=>s).filter(s=>(this.options.notAfter||[]).concat(n).includes(s.name));return[new Et({key:t,appendTransaction:(s,i,o)=>{const{doc:a,tr:l,schema:c}=o,u=t.getState(o),d=a.content.size,f=c.nodes[n];if(u)return l.insert(d,f.create())},state:{init:(s,i)=>{const o=i.tr.doc.lastChild;return!Nx({node:o,types:r})},apply:(s,i)=>{if(!s.docChanged)return i;const o=s.doc.lastChild;return!Nx({node:o,types:r})}}})]}}),r4=_t.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>JC(e,t),redo:()=>({state:e,dispatch:t})=>ZC(e,t)}},addProseMirrorPlugins(){return[X$(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),s4=_t.create({name:"starterKit",addExtensions(){var e,t,n,r;const s=[];return this.options.bold!==!1&&s.push(AB.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(EB.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(PC.configure(this.options.bulletList)),this.options.code!==!1&&s.push(OB.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(NC.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(PB.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(Q$.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(e4.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(jB.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(zB.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(r4.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(FB.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(VB.configure(this.options.italic)),this.options.listItem!==!1&&s.push(jC.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(HC.configure((e=this.options)==null?void 0:e.listKeymap)),this.options.link!==!1&&s.push(m$.configure((t=this.options)==null?void 0:t.link)),this.options.orderedList!==!1&&s.push(qC.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(A$.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(O$.configure(this.options.strike)),this.options.text!==!1&&s.push(I$.configure(this.options.text)),this.options.underline!==!1&&s.push(D$.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&s.push(n4.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),i4=s4,Uf,_x;function o4(){if(_x)return Uf;_x=1;function e(M){return M instanceof Map?M.clear=M.delete=M.set=function(){throw new Error("map is read-only")}:M instanceof Set&&(M.add=M.clear=M.delete=function(){throw new Error("set is read-only")}),Object.freeze(M),Object.getOwnPropertyNames(M).forEach(H=>{const X=M[H],ye=typeof X;(ye==="object"||ye==="function")&&!Object.isFrozen(X)&&e(X)}),M}class t{constructor(H){H.data===void 0&&(H.data={}),this.data=H.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function n(M){return M.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;")}function r(M,...H){const X=Object.create(null);for(const ye in M)X[ye]=M[ye];return H.forEach(function(ye){for(const nt in ye)X[nt]=ye[nt]}),X}const s="</span>",i=M=>!!M.scope,o=(M,{prefix:H})=>{if(M.startsWith("language:"))return M.replace("language:","language-");if(M.includes(".")){const X=M.split(".");return[`${H}${X.shift()}`,...X.map((ye,nt)=>`${ye}${"_".repeat(nt+1)}`)].join(" ")}return`${H}${M}`};class a{constructor(H,X){this.buffer="",this.classPrefix=X.classPrefix,H.walk(this)}addText(H){this.buffer+=n(H)}openNode(H){if(!i(H))return;const X=o(H.scope,{prefix:this.classPrefix});this.span(X)}closeNode(H){i(H)&&(this.buffer+=s)}value(){return this.buffer}span(H){this.buffer+=`<span class="${H}">`}}const l=(M={})=>{const H={children:[]};return Object.assign(H,M),H};class c{constructor(){this.rootNode=l(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(H){this.top.children.push(H)}openNode(H){const X=l({scope:H});this.add(X),this.stack.push(X)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(H){return this.constructor._walk(H,this.rootNode)}static _walk(H,X){return typeof X=="string"?H.addText(X):X.children&&(H.openNode(X),X.children.forEach(ye=>this._walk(H,ye)),H.closeNode(X)),H}static _collapse(H){typeof H!="string"&&H.children&&(H.children.every(X=>typeof X=="string")?H.children=[H.children.join("")]:H.children.forEach(X=>{c._collapse(X)}))}}class u extends c{constructor(H){super(),this.options=H}addText(H){H!==""&&this.add(H)}startScope(H){this.openNode(H)}endScope(){this.closeNode()}__addSublanguage(H,X){const ye=H.root;X&&(ye.scope=`language:${X}`),this.add(ye)}toHTML(){return new a(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function d(M){return M?typeof M=="string"?M:M.source:null}function f(M){return g("(?=",M,")")}function p(M){return g("(?:",M,")*")}function m(M){return g("(?:",M,")?")}function g(...M){return M.map(X=>d(X)).join("")}function b(M){const H=M[M.length-1];return typeof H=="object"&&H.constructor===Object?(M.splice(M.length-1,1),H):{}}function y(...M){return"("+(b(M).capture?"":"?:")+M.map(ye=>d(ye)).join("|")+")"}function w(M){return new RegExp(M.toString()+"|").exec("").length-1}function v(M,H){const X=M&&M.exec(H);return X&&X.index===0}const E=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function N(M,{joinWith:H}){let X=0;return M.map(ye=>{X+=1;const nt=X;let lt=d(ye),re="";for(;lt.length>0;){const ue=E.exec(lt);if(!ue){re+=lt;break}re+=lt.substring(0,ue.index),lt=lt.substring(ue.index+ue[0].length),ue[0][0]==="\\"&&ue[1]?re+="\\"+String(Number(ue[1])+nt):(re+=ue[0],ue[0]==="("&&X++)}return re}).map(ye=>`(${ye})`).join(H)}const k=/\b\B/,C="[a-zA-Z]\\w*",A="[a-zA-Z_]\\w*",R="\\b\\d+(\\.\\d+)?",T="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",I="\\b(0b[01]+)",O="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",j=(M={})=>{const H=/^#![ ]*\//;return M.binary&&(M.begin=g(H,/.*\b/,M.binary,/\b.*/)),r({scope:"meta",begin:H,end:/$/,relevance:0,"on:begin":(X,ye)=>{X.index!==0&&ye.ignoreMatch()}},M)},L={begin:"\\\\[\\s\\S]",relevance:0},F={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[L]},q={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[L]},te={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},K=function(M,H,X={}){const ye=r({scope:"comment",begin:M,end:H,contains:[]},X);ye.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const nt=y("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return ye.contains.push({begin:g(/[ ]+/,"(",nt,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ye},le=K("//","$"),_=K("/\\*","\\*/"),ae=K("#","$"),me={scope:"number",begin:R,relevance:0},S={scope:"number",begin:T,relevance:0},B={scope:"number",begin:I,relevance:0},$={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[L,{begin:/\[/,end:/\]/,relevance:0,contains:[L]}]},D={scope:"title",begin:C,relevance:0},P={scope:"title",begin:A,relevance:0},W={begin:"\\.\\s*"+A,relevance:0};var ee=Object.freeze({__proto__:null,APOS_STRING_MODE:F,BACKSLASH_ESCAPE:L,BINARY_NUMBER_MODE:B,BINARY_NUMBER_RE:I,COMMENT:K,C_BLOCK_COMMENT_MODE:_,C_LINE_COMMENT_MODE:le,C_NUMBER_MODE:S,C_NUMBER_RE:T,END_SAME_AS_BEGIN:function(M){return Object.assign(M,{"on:begin":(H,X)=>{X.data._beginMatch=H[1]},"on:end":(H,X)=>{X.data._beginMatch!==H[1]&&X.ignoreMatch()}})},HASH_COMMENT_MODE:ae,IDENT_RE:C,MATCH_NOTHING_RE:k,METHOD_GUARD:W,NUMBER_MODE:me,NUMBER_RE:R,PHRASAL_WORDS_MODE:te,QUOTE_STRING_MODE:q,REGEXP_MODE:$,RE_STARTERS_RE:O,SHEBANG:j,TITLE_MODE:D,UNDERSCORE_IDENT_RE:A,UNDERSCORE_TITLE_MODE:P});function be(M,H){M.input[M.index-1]==="."&&H.ignoreMatch()}function Me(M,H){M.className!==void 0&&(M.scope=M.className,delete M.className)}function Le(M,H){H&&M.beginKeywords&&(M.begin="\\b("+M.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",M.__beforeBegin=be,M.keywords=M.keywords||M.beginKeywords,delete M.beginKeywords,M.relevance===void 0&&(M.relevance=0))}function Ke(M,H){Array.isArray(M.illegal)&&(M.illegal=y(...M.illegal))}function ce(M,H){if(M.match){if(M.begin||M.end)throw new Error("begin & end are not supported with match");M.begin=M.match,delete M.match}}function ne(M,H){M.relevance===void 0&&(M.relevance=1)}const et=(M,H)=>{if(!M.beforeMatch)return;if(M.starts)throw new Error("beforeMatch cannot be used with starts");const X=Object.assign({},M);Object.keys(M).forEach(ye=>{delete M[ye]}),M.keywords=X.keywords,M.begin=g(X.beforeMatch,f(X.begin)),M.starts={relevance:0,contains:[Object.assign(X,{endsParent:!0})]},M.relevance=0,delete X.beforeMatch},We=["of","and","for","in","not","or","if","then","parent","list","value"],ie="keyword";function je(M,H,X=ie){const ye=Object.create(null);return typeof M=="string"?nt(X,M.split(" ")):Array.isArray(M)?nt(X,M):Object.keys(M).forEach(function(lt){Object.assign(ye,je(M[lt],H,lt))}),ye;function nt(lt,re){H&&(re=re.map(ue=>ue.toLowerCase())),re.forEach(function(ue){const xe=ue.split("|");ye[xe[0]]=[lt,it(xe[0],xe[1])]})}}function it(M,H){return H?Number(H):tt(M)?0:1}function tt(M){return We.includes(M.toLowerCase())}const Gn={},jn=M=>{console.error(M)},us=(M,...H)=>{console.log(`WARN: ${M}`,...H)},U=(M,H)=>{Gn[`${M}/${H}`]||(console.log(`Deprecated as of ${M}. ${H}`),Gn[`${M}/${H}`]=!0)},G=new Error;function Se(M,H,{key:X}){let ye=0;const nt=M[X],lt={},re={};for(let ue=1;ue<=H.length;ue++)re[ue+ye]=nt[ue],lt[ue+ye]=!0,ye+=w(H[ue-1]);M[X]=re,M[X]._emit=lt,M[X]._multi=!0}function Ie(M){if(Array.isArray(M.begin)){if(M.skip||M.excludeBegin||M.returnBegin)throw jn("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),G;if(typeof M.beginScope!="object"||M.beginScope===null)throw jn("beginScope must be object"),G;Se(M,M.begin,{key:"beginScope"}),M.begin=N(M.begin,{joinWith:""})}}function Ze(M){if(Array.isArray(M.end)){if(M.skip||M.excludeEnd||M.returnEnd)throw jn("skip, excludeEnd, returnEnd not compatible with endScope: {}"),G;if(typeof M.endScope!="object"||M.endScope===null)throw jn("endScope must be object"),G;Se(M,M.end,{key:"endScope"}),M.end=N(M.end,{joinWith:""})}}function Ct(M){M.scope&&typeof M.scope=="object"&&M.scope!==null&&(M.beginScope=M.scope,delete M.scope)}function An(M){Ct(M),typeof M.beginScope=="string"&&(M.beginScope={_wrap:M.beginScope}),typeof M.endScope=="string"&&(M.endScope={_wrap:M.endScope}),Ie(M),Ze(M)}function zn(M){function H(re,ue){return new RegExp(d(re),"m"+(M.case_insensitive?"i":"")+(M.unicodeRegex?"u":"")+(ue?"g":""))}class X{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(ue,xe){xe.position=this.position++,this.matchIndexes[this.matchAt]=xe,this.regexes.push([xe,ue]),this.matchAt+=w(ue)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const ue=this.regexes.map(xe=>xe[1]);this.matcherRe=H(N(ue,{joinWith:"|"}),!0),this.lastIndex=0}exec(ue){this.matcherRe.lastIndex=this.lastIndex;const xe=this.matcherRe.exec(ue);if(!xe)return null;const ct=xe.findIndex((fr,Jn)=>Jn>0&&fr!==void 0),mt=this.matchIndexes[ct];return xe.splice(0,ct),Object.assign(xe,mt)}}class ye{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(ue){if(this.multiRegexes[ue])return this.multiRegexes[ue];const xe=new X;return this.rules.slice(ue).forEach(([ct,mt])=>xe.addRule(ct,mt)),xe.compile(),this.multiRegexes[ue]=xe,xe}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(ue,xe){this.rules.push([ue,xe]),xe.type==="begin"&&this.count++}exec(ue){const xe=this.getMatcher(this.regexIndex);xe.lastIndex=this.lastIndex;let ct=xe.exec(ue);if(this.resumingScanAtSamePosition()&&!(ct&&ct.index===this.lastIndex)){const mt=this.getMatcher(0);mt.lastIndex=this.lastIndex+1,ct=mt.exec(ue)}return ct&&(this.regexIndex+=ct.position+1,this.regexIndex===this.count&&this.considerAll()),ct}}function nt(re){const ue=new ye;return re.contains.forEach(xe=>ue.addRule(xe.begin,{rule:xe,type:"begin"})),re.terminatorEnd&&ue.addRule(re.terminatorEnd,{type:"end"}),re.illegal&&ue.addRule(re.illegal,{type:"illegal"}),ue}function lt(re,ue){const xe=re;if(re.isCompiled)return xe;[Me,ce,An,et].forEach(mt=>mt(re,ue)),M.compilerExtensions.forEach(mt=>mt(re,ue)),re.__beforeBegin=null,[Le,Ke,ne].forEach(mt=>mt(re,ue)),re.isCompiled=!0;let ct=null;return typeof re.keywords=="object"&&re.keywords.$pattern&&(re.keywords=Object.assign({},re.keywords),ct=re.keywords.$pattern,delete re.keywords.$pattern),ct=ct||/\w+/,re.keywords&&(re.keywords=je(re.keywords,M.case_insensitive)),xe.keywordPatternRe=H(ct,!0),ue&&(re.begin||(re.begin=/\B|\b/),xe.beginRe=H(xe.begin),!re.end&&!re.endsWithParent&&(re.end=/\B|\b/),re.end&&(xe.endRe=H(xe.end)),xe.terminatorEnd=d(xe.end)||"",re.endsWithParent&&ue.terminatorEnd&&(xe.terminatorEnd+=(re.end?"|":"")+ue.terminatorEnd)),re.illegal&&(xe.illegalRe=H(re.illegal)),re.contains||(re.contains=[]),re.contains=[].concat(...re.contains.map(function(mt){return dr(mt==="self"?re:mt)})),re.contains.forEach(function(mt){lt(mt,xe)}),re.starts&&lt(re.starts,ue),xe.matcher=nt(xe),xe}if(M.compilerExtensions||(M.compilerExtensions=[]),M.contains&&M.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return M.classNameAliases=r(M.classNameAliases||{}),lt(M)}function Sr(M){return M?M.endsWithParent||Sr(M.starts):!1}function dr(M){return M.variants&&!M.cachedVariants&&(M.cachedVariants=M.variants.map(function(H){return r(M,{variants:null},H)})),M.cachedVariants?M.cachedVariants:Sr(M)?r(M,{starts:M.starts?r(M.starts):null}):Object.isFrozen(M)?r(M):M}var Jt="11.11.1";class Er extends Error{constructor(H,X){super(H),this.name="HTMLInjectionError",this.html=X}}const on=n,kl=r,Sl=Symbol("nomatch"),Gd=7,$t=function(M){const H=Object.create(null),X=Object.create(null),ye=[];let nt=!0;const lt="Could not find the language '{}', did you forget to load/include a language module?",re={disableAutodetect:!0,name:"Plain text",contains:[]};let ue={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function xe(Q){return ue.noHighlightRe.test(Q)}function ct(Q){let Ee=Q.className+" ";Ee+=Q.parentNode?Q.parentNode.className:"";const Je=ue.languageDetectRe.exec(Ee);if(Je){const gt=ds(Je[1]);return gt||(us(lt.replace("{}",Je[1])),us("Falling back to no-highlight mode for this block.",Q)),gt?Je[1]:"no-highlight"}return Ee.split(/\s+/).find(gt=>xe(gt)||ds(gt))}function mt(Q,Ee,Je){let gt="",Ut="";typeof Ee=="object"?(gt=Q,Je=Ee.ignoreIllegals,Ut=Ee.language):(U("10.7.0","highlight(lang, code, ...args) has been deprecated."),U("10.7.0",`Please use highlight(code, options) instead.
450
- https://github.com/highlightjs/highlight.js/issues/2277`),Ut=Q,gt=Ee),Je===void 0&&(Je=!0);const hr={code:gt,language:Ut};Cl("before:highlight",hr);const fs=hr.result?hr.result:fr(hr.language,hr.code,Je);return fs.code=hr.code,Cl("after:highlight",fs),fs}function fr(Q,Ee,Je,gt){const Ut=Object.create(null);function hr(de,ve){return de.keywords[ve]}function fs(){if(!Pe.keywords){en.addText(bt);return}let de=0;Pe.keywordPatternRe.lastIndex=0;let ve=Pe.keywordPatternRe.exec(bt),Ve="";for(;ve;){Ve+=bt.substring(de,ve.index);const ot=Nr.case_insensitive?ve[0].toLowerCase():ve[0],an=hr(Pe,ot);if(an){const[Fr,W_]=an;if(en.addText(Ve),Ve="",Ut[ot]=(Ut[ot]||0)+1,Ut[ot]<=Gd&&(Tl+=W_),Fr.startsWith("_"))Ve+=ve[0];else{const K_=Nr.classNameAliases[Fr]||Fr;Cr(ve[0],K_)}}else Ve+=ve[0];de=Pe.keywordPatternRe.lastIndex,ve=Pe.keywordPatternRe.exec(bt)}Ve+=bt.substring(de),en.addText(Ve)}function Nl(){if(bt==="")return;let de=null;if(typeof Pe.subLanguage=="string"){if(!H[Pe.subLanguage]){en.addText(bt);return}de=fr(Pe.subLanguage,bt,!0,tb[Pe.subLanguage]),tb[Pe.subLanguage]=de._top}else de=zr(bt,Pe.subLanguage.length?Pe.subLanguage:null);Pe.relevance>0&&(Tl+=de.relevance),en.__addSublanguage(de._emitter,de.language)}function Fn(){Pe.subLanguage!=null?Nl():fs(),bt=""}function Cr(de,ve){de!==""&&(en.startScope(ve),en.addText(de),en.endScope())}function Yg(de,ve){let Ve=1;const ot=ve.length-1;for(;Ve<=ot;){if(!de._emit[Ve]){Ve++;continue}const an=Nr.classNameAliases[de[Ve]]||de[Ve],Fr=ve[Ve];an?Cr(Fr,an):(bt=Fr,fs(),bt=""),Ve++}}function Xg(de,ve){return de.scope&&typeof de.scope=="string"&&en.openNode(Nr.classNameAliases[de.scope]||de.scope),de.beginScope&&(de.beginScope._wrap?(Cr(bt,Nr.classNameAliases[de.beginScope._wrap]||de.beginScope._wrap),bt=""):de.beginScope._multi&&(Yg(de.beginScope,ve),bt="")),Pe=Object.create(de,{parent:{value:Pe}}),Pe}function Qg(de,ve,Ve){let ot=v(de.endRe,Ve);if(ot){if(de["on:end"]){const an=new t(de);de["on:end"](ve,an),an.isMatchIgnored&&(ot=!1)}if(ot){for(;de.endsParent&&de.parent;)de=de.parent;return de}}if(de.endsWithParent)return Qg(de.parent,ve,Ve)}function $_(de){return Pe.matcher.regexIndex===0?(bt+=de[0],1):(Xd=!0,0)}function U_(de){const ve=de[0],Ve=de.rule,ot=new t(Ve),an=[Ve.__beforeBegin,Ve["on:begin"]];for(const Fr of an)if(Fr&&(Fr(de,ot),ot.isMatchIgnored))return $_(ve);return Ve.skip?bt+=ve:(Ve.excludeBegin&&(bt+=ve),Fn(),!Ve.returnBegin&&!Ve.excludeBegin&&(bt=ve)),Xg(Ve,de),Ve.returnBegin?0:ve.length}function H_(de){const ve=de[0],Ve=Ee.substring(de.index),ot=Qg(Pe,de,Ve);if(!ot)return Sl;const an=Pe;Pe.endScope&&Pe.endScope._wrap?(Fn(),Cr(ve,Pe.endScope._wrap)):Pe.endScope&&Pe.endScope._multi?(Fn(),Yg(Pe.endScope,de)):an.skip?bt+=ve:(an.returnEnd||an.excludeEnd||(bt+=ve),Fn(),an.excludeEnd&&(bt=ve));do Pe.scope&&en.closeNode(),!Pe.skip&&!Pe.subLanguage&&(Tl+=Pe.relevance),Pe=Pe.parent;while(Pe!==ot.parent);return ot.starts&&Xg(ot.starts,de),an.returnEnd?0:ve.length}function V_(){const de=[];for(let ve=Pe;ve!==Nr;ve=ve.parent)ve.scope&&de.unshift(ve.scope);de.forEach(ve=>en.openNode(ve))}let _l={};function eb(de,ve){const Ve=ve&&ve[0];if(bt+=de,Ve==null)return Fn(),0;if(_l.type==="begin"&&ve.type==="end"&&_l.index===ve.index&&Ve===""){if(bt+=Ee.slice(ve.index,ve.index+1),!nt){const ot=new Error(`0 width match regex (${Q})`);throw ot.languageName=Q,ot.badRule=_l.rule,ot}return 1}if(_l=ve,ve.type==="begin")return U_(ve);if(ve.type==="illegal"&&!Je){const ot=new Error('Illegal lexeme "'+Ve+'" for mode "'+(Pe.scope||"<unnamed>")+'"');throw ot.mode=Pe,ot}else if(ve.type==="end"){const ot=H_(ve);if(ot!==Sl)return ot}if(ve.type==="illegal"&&Ve==="")return bt+=`
451
- `,1;if(Yd>1e5&&Yd>ve.index*3)throw new Error("potential infinite loop, way more iterations than matches");return bt+=Ve,Ve.length}const Nr=ds(Q);if(!Nr)throw jn(lt.replace("{}",Q)),new Error('Unknown language: "'+Q+'"');const q_=zn(Nr);let Zd="",Pe=gt||q_;const tb={},en=new ue.__emitter(ue);V_();let bt="",Tl=0,ti=0,Yd=0,Xd=!1;try{if(Nr.__emitTokens)Nr.__emitTokens(Ee,en);else{for(Pe.matcher.considerAll();;){Yd++,Xd?Xd=!1:Pe.matcher.considerAll(),Pe.matcher.lastIndex=ti;const de=Pe.matcher.exec(Ee);if(!de)break;const ve=Ee.substring(ti,de.index),Ve=eb(ve,de);ti=de.index+Ve}eb(Ee.substring(ti))}return en.finalize(),Zd=en.toHTML(),{language:Q,value:Zd,relevance:Tl,illegal:!1,_emitter:en,_top:Pe}}catch(de){if(de.message&&de.message.includes("Illegal"))return{language:Q,value:on(Ee),illegal:!0,relevance:0,_illegalBy:{message:de.message,index:ti,context:Ee.slice(ti-100,ti+100),mode:de.mode,resultSoFar:Zd},_emitter:en};if(nt)return{language:Q,value:on(Ee),illegal:!1,relevance:0,errorRaised:de,_emitter:en,_top:Pe};throw de}}function Jn(Q){const Ee={value:on(Q),illegal:!1,relevance:0,_top:re,_emitter:new ue.__emitter(ue)};return Ee._emitter.addText(Q),Ee}function zr(Q,Ee){Ee=Ee||ue.languages||Object.keys(H);const Je=Jn(Q),gt=Ee.filter(ds).filter(Zg).map(Fn=>fr(Fn,Q,!1));gt.unshift(Je);const Ut=gt.sort((Fn,Cr)=>{if(Fn.relevance!==Cr.relevance)return Cr.relevance-Fn.relevance;if(Fn.language&&Cr.language){if(ds(Fn.language).supersetOf===Cr.language)return 1;if(ds(Cr.language).supersetOf===Fn.language)return-1}return 0}),[hr,fs]=Ut,Nl=hr;return Nl.secondBest=fs,Nl}function Vo(Q,Ee,Je){const gt=Ee&&X[Ee]||Je;Q.classList.add("hljs"),Q.classList.add(`language-${gt}`)}function Jd(Q){let Ee=null;const Je=ct(Q);if(xe(Je))return;if(Cl("before:highlightElement",{el:Q,language:Je}),Q.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",Q);return}if(Q.children.length>0&&(ue.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(Q)),ue.throwUnescapedHTML))throw new Er("One of your code blocks includes unescaped HTML.",Q.innerHTML);Ee=Q;const gt=Ee.textContent,Ut=Je?mt(gt,{language:Je,ignoreIllegals:!0}):zr(gt);Q.innerHTML=Ut.value,Q.dataset.highlighted="yes",Vo(Q,Je,Ut.language),Q.result={language:Ut.language,re:Ut.relevance,relevance:Ut.relevance},Ut.secondBest&&(Q.secondBest={language:Ut.secondBest.language,relevance:Ut.secondBest.relevance}),Cl("after:highlightElement",{el:Q,result:Ut,text:gt})}function R_(Q){ue=kl(ue,Q)}const O_=()=>{El(),U("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function I_(){El(),U("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Gg=!1;function El(){function Q(){El()}if(document.readyState==="loading"){Gg||window.addEventListener("DOMContentLoaded",Q,!1),Gg=!0;return}document.querySelectorAll(ue.cssSelector).forEach(Jd)}function D_(Q,Ee){let Je=null;try{Je=Ee(M)}catch(gt){if(jn("Language definition for '{}' could not be registered.".replace("{}",Q)),nt)jn(gt);else throw gt;Je=re}Je.name||(Je.name=Q),H[Q]=Je,Je.rawDefinition=Ee.bind(null,M),Je.aliases&&Jg(Je.aliases,{languageName:Q})}function L_(Q){delete H[Q];for(const Ee of Object.keys(X))X[Ee]===Q&&delete X[Ee]}function P_(){return Object.keys(H)}function ds(Q){return Q=(Q||"").toLowerCase(),H[Q]||H[X[Q]]}function Jg(Q,{languageName:Ee}){typeof Q=="string"&&(Q=[Q]),Q.forEach(Je=>{X[Je.toLowerCase()]=Ee})}function Zg(Q){const Ee=ds(Q);return Ee&&!Ee.disableAutodetect}function j_(Q){Q["before:highlightBlock"]&&!Q["before:highlightElement"]&&(Q["before:highlightElement"]=Ee=>{Q["before:highlightBlock"](Object.assign({block:Ee.el},Ee))}),Q["after:highlightBlock"]&&!Q["after:highlightElement"]&&(Q["after:highlightElement"]=Ee=>{Q["after:highlightBlock"](Object.assign({block:Ee.el},Ee))})}function z_(Q){j_(Q),ye.push(Q)}function F_(Q){const Ee=ye.indexOf(Q);Ee!==-1&&ye.splice(Ee,1)}function Cl(Q,Ee){const Je=Q;ye.forEach(function(gt){gt[Je]&&gt[Je](Ee)})}function B_(Q){return U("10.7.0","highlightBlock will be removed entirely in v12.0"),U("10.7.0","Please use highlightElement now."),Jd(Q)}Object.assign(M,{highlight:mt,highlightAuto:zr,highlightAll:El,highlightElement:Jd,highlightBlock:B_,configure:R_,initHighlighting:O_,initHighlightingOnLoad:I_,registerLanguage:D_,unregisterLanguage:L_,listLanguages:P_,getLanguage:ds,registerAliases:Jg,autoDetection:Zg,inherit:kl,addPlugin:z_,removePlugin:F_}),M.debugMode=function(){nt=!1},M.safeMode=function(){nt=!0},M.versionString=Jt,M.regex={concat:g,lookahead:f,either:y,optional:m,anyNumberOfTimes:p};for(const Q in ee)typeof ee[Q]=="object"&&e(ee[Q]);return Object.assign(M,ee),M},Pt=$t({});return Pt.newInstance=()=>$t({}),Uf=Pt,Pt.HighlightJS=Pt,Pt.default=Pt,Uf}var a4=o4();const YC=tl(a4);function XC(e,t=[]){return e.flatMap(n=>{const r=[...t,...n.properties?n.properties.className:[]];return n.children?XC(n.children,r):{text:n.value,classes:r}})}function Tx(e){return e.value||e.children||[]}function l4(e){return!!YC.getLanguage(e)}function Ax({doc:e,name:t,lowlight:n,defaultLanguage:r}){const s=[];return ap(e,i=>i.type.name===t).forEach(i=>{var o;let a=i.pos+1;const l=i.node.attrs.language||r,c=n.listLanguages(),u=l&&(c.includes(l)||l4(l)||(o=n.registered)!=null&&o.call(n,l))?Tx(n.highlight(l,i.node.textContent)):Tx(n.highlightAuto(i.node.textContent));XC(u).forEach(d=>{const f=a+d.text.length;if(d.classes.length){const p=Wt.inline(a,f,{class:d.classes.join(" ")});s.push(p)}a=f})}),ft.create(e,s)}function c4(e){return typeof e=="function"}function u4({name:e,lowlight:t,defaultLanguage:n}){if(!["highlight","highlightAuto","listLanguages"].every(s=>c4(t[s])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const r=new Et({key:new Lt("lowlight"),state:{init:(s,{doc:i})=>Ax({doc:i,name:e,lowlight:t,defaultLanguage:n}),apply:(s,i,o,a)=>{const l=o.selection.$head.parent.type.name,c=a.selection.$head.parent.type.name,u=ap(o.doc,f=>f.type.name===e),d=ap(a.doc,f=>f.type.name===e);return s.docChanged&&([l,c].includes(e)||d.length!==u.length||s.steps.some(f=>f.from!==void 0&&f.to!==void 0&&u.some(p=>p.pos>=f.from&&p.pos+p.node.nodeSize<=f.to)))?Ax({doc:s.doc,name:e,lowlight:t,defaultLanguage:n}):i.map(s.mapping,s.doc)}},props:{decorations(s){return r.getState(s)}}});return r}var d4=LB.extend({addOptions(){var e;return{...(e=this.parent)==null?void 0:e.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var e;return[...((e=this.parent)==null?void 0:e.call(this))||[],u4({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),f4=d4,h4=t4;function p4(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],b=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],E={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},N={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},k=[N,d,a,n,e.C_BLOCK_COMMENT_MODE,u,c],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:E,contains:k.concat([{begin:/\(/,end:/\)/,keywords:E,contains:k.concat(["self"]),relevance:0}]),relevance:0},A={className:"function",begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:E,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:E,relevance:0},{begin:p,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:E,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(C,A,N,k,[d,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:E,contains:["self",a]},{begin:e.IDENT_RE+"::",keywords:E},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function m4(e){const t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=p4(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function g4(e){const t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const s={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},i=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},a={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,s]};s.contains.push(a);const l={match:/\\"/},c={className:"string",begin:/'/,end:/'/},u={match:/\\'/},d={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},f=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],p=e.SHEBANG({binary:`(${f.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},g=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],b=["true","false"],y={match:/(\/[a-z._-]+)+/},w=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],v=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],E=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],N=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:g,literal:b,built_in:[...w,...v,"set","shopt",...E,...N]},contains:[p,e.SHEBANG(),m,d,i,o,y,a,l,c,u,n]}}function b4(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",o="("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",a={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",b={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},y=[d,a,n,e.C_BLOCK_COMMENT_MODE,u,c],w={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:b,contains:y.concat([{begin:/\(/,end:/\)/,keywords:b,contains:y.concat(["self"]),relevance:0}]),relevance:0},v={begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:b,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:b,relevance:0},{begin:p,returnBegin:!0,contains:[e.inherit(f,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:b,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,d]};return{name:"C",aliases:["h"],keywords:b,disableAutodetect:!0,illegal:"</",contains:[].concat(w,v,y,[d,{begin:e.IDENT_RE+"::",keywords:b},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:d,strings:c,keywords:b}}}function y4(e){const t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",s="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+t.optional(s)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",a={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},c={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},d={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(c,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},f={className:"title",begin:t.optional(s)+e.IDENT_RE,relevance:0},p=t.optional(s)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],g=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],b=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],y=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],E={type:g,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:b},N={className:"function.dispatch",relevance:0,keywords:{_hint:y},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},k=[N,d,a,n,e.C_BLOCK_COMMENT_MODE,u,c],C={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:E,contains:k.concat([{begin:/\(/,end:/\)/,keywords:E,contains:k.concat(["self"]),relevance:0}]),relevance:0},A={className:"function",begin:"("+o+"[\\*&\\s]+)+"+p,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:E,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:E,relevance:0},{begin:p,returnBegin:!0,contains:[f],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[c,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,c,u,a,{begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,c,u,a]}]},a,n,e.C_BLOCK_COMMENT_MODE,d]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:E,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(C,A,N,k,[d,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:E,contains:["self",a]},{begin:e.IDENT_RE+"::",keywords:E},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function x4(e){const t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],s=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],i=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:s.concat(i),built_in:t,literal:r},a=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},c={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},u={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},d=e.inherit(u,{illegal:/\n/}),f={className:"subst",begin:/\{/,end:/\}/,keywords:o},p=e.inherit(f,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,p]},g={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]},b=e.inherit(g,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},p]});f.contains=[g,m,u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,l,e.C_BLOCK_COMMENT_MODE],p.contains=[b,m,d,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,l,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const y={variants:[c,g,m,u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},w={begin:"<",end:">",contains:[{beginKeywords:"in out"},a]},v=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",E={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},y,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},a,w,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[a,w,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+v+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,w],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[y,l,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},E]}}const v4=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),w4=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],k4=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],S4=[...w4,...k4],E4=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),C4=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),N4=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),_4=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function T4(e){const t=e.regex,n=v4(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},s="and or not only",i=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",a=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+C4.join("|")+")"},{begin:":(:)?("+N4.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+_4.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...a,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...a,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:i},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:s,attribute:E4.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...a,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+S4.join("|")+")\\b"}]}}function A4(e){const t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function M4(e){const i={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:i,illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"string",variants:[e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[e.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:i,illegal:/["']/}]}]}}function R4(e){const t=e.regex,n=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[e.HASH_COMMENT_MODE,e.QUOTE_STRING_MODE,e.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:t.concat(n,t.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function O4(e){const t=e.regex,n={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:e.NUMBER_RE}]},r=e.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const s={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},i={className:"literal",begin:/\bon|off|true|false|yes|no\b/},o={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},a={begin:/\[/,end:/\]/,contains:[r,i,s,o,n,"self"],relevance:0},l=/[A-Za-z0-9_-]+/,c=/"(\\"|[^"])*"/,u=/'[^']*'/,d=t.either(l,c,u),f=t.concat(d,"(\\s*\\.\\s*",d,")*",t.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:f,className:"attr",starts:{end:/$/,contains:[r,a,i,s,o,n]}}]}}var Xi="[0-9](_*[0-9])*",Vl=`\\.(${Xi})`,ql="[0-9a-fA-F](_*[0-9a-fA-F])*",Mx={className:"number",variants:[{begin:`(\\b(${Xi})((${Vl})|\\.)?|(${Vl}))[eE][+-]?(${Xi})[fFdD]?\\b`},{begin:`\\b(${Xi})((${Vl})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Vl})[fFdD]?\\b`},{begin:`\\b(${Xi})[fFdD]\\b`},{begin:`\\b0[xX]((${ql})\\.?|(${ql})?\\.(${ql}))[pP][+-]?(${Xi})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${ql})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function QC(e,t,n){return n===-1?"":e.replace(t,r=>QC(e,t,n-1))}function I4(e){const t=e.regex,n="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=n+QC("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},c={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},u={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[u,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[c,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,Mx,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},Mx,c]}}const Rx="[A-Za-z$_][0-9A-Za-z$_]*",D4=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],L4=["true","false","null","undefined","NaN","Infinity"],e1=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],t1=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],n1=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],P4=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],j4=[].concat(n1,e1,t1);function z4(e){const t=e.regex,n=(K,{after:le})=>{const _="</"+K[0].slice(1);return K.input.indexOf(_,le)!==-1},r=Rx,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(K,le)=>{const _=K[0].length+K.index,ae=K.input[_];if(ae==="<"||ae===","){le.ignoreMatch();return}ae===">"&&(n(K,{after:_})||le.ignoreMatch());let me;const S=K.input.substring(_);if(me=S.match(/^\s*=/)){le.ignoreMatch();return}if((me=S.match(/^\s+extends\s+/))&&me.index===0){le.ignoreMatch();return}}},a={$pattern:Rx,keyword:D4,literal:L4,built_in:j4,"variable.language":P4},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},w={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,b,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(v)});const E=[].concat(w,f.contains),N=E.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(E)}]),k={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N},C={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},A={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...e1,...t1]}},R={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[k],illegal:/%/},I={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function O(K){return t.concat("(?!",K.join("|"),")")}const j={match:t.concat(/\b/,O([...n1,"super","import"].map(K=>`${K}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},k]},q="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",te={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(q)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[k]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:A},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),R,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,b,w,{match:/\$\d+/},d,A,{scope:"attr",match:r+t.lookahead(":"),relevance:0},te,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,e.REGEXP_MODE,{className:"function",begin:q,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},T,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[k,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[k]},j,I,C,F,{match:/\$[(.]/}]}}function F4(e){const t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],s={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,s,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Qi="[0-9](_*[0-9])*",Wl=`\\.(${Qi})`,Kl="[0-9a-fA-F](_*[0-9a-fA-F])*",B4={className:"number",variants:[{begin:`(\\b(${Qi})((${Wl})|\\.)?|(${Wl}))[eE][+-]?(${Qi})[fFdD]?\\b`},{begin:`\\b(${Qi})((${Wl})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Wl})[fFdD]?\\b`},{begin:`\\b(${Qi})[fFdD]\\b`},{begin:`\\b0[xX]((${Kl})\\.?|(${Kl})?\\.(${Kl}))[pP][+-]?(${Qi})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Kl})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function $4(e){const t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},s={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},i={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[i,s]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,i,s]}]};s.contains.push(o);const a={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(o,{className:"string"}),"self"]}]},c=B4,u=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),d={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},f=d;return f.variants[1].contains=[d],d.variants[1].contains=[f],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,u,n,r,a,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[d,e.C_LINE_COMMENT_MODE,u],relevance:0},e.C_LINE_COMMENT_MODE,u,a,l,o,e.C_NUMBER_MODE]},u]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},a,l]},o,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
452
- `},c]}}const U4=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),H4=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],V4=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],q4=[...H4,...V4],W4=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),r1=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),s1=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),K4=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),G4=r1.concat(s1).sort().reverse();function J4(e){const t=U4(e),n=G4,r="and or not only",s="[\\w-]+",i="("+s+"|@\\{"+s+"\\})",o=[],a=[],l=function(v){return{className:"string",begin:"~?"+v+".*?"+v}},c=function(v,E,N){return{className:v,begin:E,relevance:N}},u={$pattern:/[a-z-]+/,keyword:r,attribute:W4.join(" ")},d={begin:"\\(",end:"\\)",contains:a,keywords:u,relevance:0};a.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,l("'"),l('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,d,c("variable","@@?"+s,10),c("variable","@\\{"+s+"\\}"),c("built_in","~?`[^`]*?`"),{className:"attribute",begin:s+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);const f=a.concat({begin:/\{/,end:/\}/,contains:o}),p={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(a)},m={begin:i+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+K4.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:a}}]},g={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:u,returnEnd:!0,contains:a,relevance:0}},b={className:"variable",variants:[{begin:"@"+s+"\\s*:",relevance:15},{begin:"@"+s}],starts:{end:"[;}]",returnEnd:!0,contains:f}},y={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:i,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,p,c("keyword","all\\b"),c("variable","@\\{"+s+"\\}"),{begin:"\\b("+q4.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,c("selector-tag",i,0),c("selector-id","#"+i),c("selector-class","\\."+i,0),c("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+r1.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+s1.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:f},{begin:"!important"},t.FUNCTION_DISPATCH]},w={begin:s+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[y]};return o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,g,b,w,m,y,p,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function Z4(e){const t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},s=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:s.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:s}].concat(s)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function Y4(e){const t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},n={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,t]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[t,n]},s={begin:"^"+e.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},i={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},o={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[t]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[e.HASH_COMMENT_MODE,t,n,r,s,i,o]}}function X4(e){const t=e.regex,n={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},s={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},i={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},a=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,a,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},c={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},d=e.inherit(c,{contains:[]}),f=e.inherit(u,{contains:[]});c.contains.push(f),u.contains.push(d);let p=[n,l];return[c,u,d,f].forEach(y=>{y.contains=y.contains.concat(p)}),p=p.concat(c,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:p},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:p}]}]},n,i,c,u,{className:"quote",begin:"^>\\s+",contains:p,end:"$"},s,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function Q4(e){const t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,a={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},l={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:a,illegal:"</",contains:[t,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,e.C_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function e3(e){const t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,s={$pattern:/[\w.]+/,keyword:n.join(" ")},i={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:s},o={begin:/->\{/,end:/\}/},a={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[a]},c={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[e.BACKSLASH_ESCAPE,i,l],d=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],f=(g,b,y="\\1")=>{const w=y==="\\1"?y:t.concat(y,b);return t.concat(t.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,w,/(?:\\.|[^\\\/])*?/,y,r)},p=(g,b,y)=>t.concat(t.concat("(?:",g,")"),b,/(?:\\.|[^\\\/])*?/,y,r),m=[l,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:u,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},c,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:f("s|tr|y",t.either(...d,{capture:!0}))},{begin:f("s|tr|y","\\(","\\)")},{begin:f("s|tr|y","\\[","\\]")},{begin:f("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:p("(?:m|qr)?",/\//,/\//)},{begin:p("m|qr",t.either(...d,{capture:!0}),/\1/)},{begin:p("m|qr",/\(/,/\)/)},{begin:p("m|qr",/\[/,/\]/)},{begin:p("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,a]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,a,c]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return i.contains=m,o.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:s,contains:m}}function t3(e){const t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),s=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),i=t.concat(/[A-Z]+/,n),o={scope:"variable",match:"\\$+"+r},a={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},c=e.inherit(e.APOS_STRING_MODE,{illegal:null}),u=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(l)}),d={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(L,F)=>{F.data._beginMatch=L[1]||L[2]},"on:end":(L,F)=>{F.data._beginMatch!==L[1]&&F.ignoreMatch()}},f=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),p=`[
453
- ]`,m={scope:"string",variants:[u,c,d,f]},g={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},b=["false","null","true"],y=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],w=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],E={keyword:y,literal:(L=>{const F=[];return L.forEach(q=>{F.push(q),q.toLowerCase()===q?F.push(q.toUpperCase()):F.push(q.toLowerCase())}),F})(b),built_in:w},N=L=>L.map(F=>F.replace(/\|\d+$/,"")),k={variants:[{match:[/new/,t.concat(p,"+"),t.concat("(?!",N(w).join("\\b|"),"\\b)"),s],scope:{1:"keyword",4:"title.class"}}]},C=t.concat(r,"\\b(?!\\()"),A={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[s,t.concat(/::/,t.lookahead(/(?!class\b)/)),C],scope:{1:"title.class",3:"variable.constant"}},{match:[s,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[s,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},R={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},T={relevance:0,begin:/\(/,end:/\)/,keywords:E,contains:[R,o,A,e.C_BLOCK_COMMENT_MODE,m,g,k]},I={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",N(y).join("\\b|"),"|",N(w).join("\\b|"),"\\b)"),r,t.concat(p,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[T]};T.contains.push(I);const O=[R,A,e.C_BLOCK_COMMENT_MODE,m,g,k],j={begin:t.concat(/#\[\s*\\?/,t.either(s,i)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:b,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:b,keyword:["new","array"]},contains:["self",...O]},...O,{scope:"meta",variants:[{match:s},{match:i}]}]};return{case_insensitive:!1,keywords:E,contains:[j,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},a,{scope:"variable.language",match:/\$this\b/},o,I,A,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},k,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:E,contains:["self",j,o,A,e.C_BLOCK_COMMENT_MODE,m,g]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},m,g]}}function n3(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function r3(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function s3(e){const t=e.regex,n=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],a={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},c={className:"subst",begin:/\{/,end:/\}/,keywords:a,illegal:/#/},u={begin:/\{\{/,relevance:0},d={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l,u,c]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,u,c]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,u,c]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},f="[0-9](_?[0-9])*",p=`(\\b(${f}))?\\.(${f})|\\b(${f})\\.`,m=`\\b|${r.join("|")}`,g={className:"number",relevance:0,variants:[{begin:`(\\b(${f})|(${p}))[eE][+-]?(${f})[jJ]?(?=${m})`},{begin:`(${p})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${f})[jJ](?=${m})`}]},b={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:a,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},y={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:["self",l,g,d,e.HASH_COMMENT_MODE]}]};return c.contains=[d,g,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:a,illegal:/(<\/|\?)|=>/,contains:[l,g,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},d,b,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[y]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[g,y,d]}]}}function i3(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function o3(e){const t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),s=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,i=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[s,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[i,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:s},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:i},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function a3(e){const t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),s=t.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},a={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},c=[e.COMMENT("#","$",{contains:[a]}),e.COMMENT("^=begin","^=end",{contains:[a],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:o},d={className:"string",contains:[e.BACKSLASH_ESCAPE,u],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,u]})]}]},f="[1-9](_?[0-9])*|0",p="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${f})(\\.(${p}))?([eE][+-]?(${p})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},g={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},k=[d,{variants:[{match:[/class\s+/,s,/\s+<\s+/,s]},{match:[/\b(class|module)\s+/,s]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,s],scope:{2:"title.class"},keywords:o},{relevance:0,match:[s,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[d,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,u],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,c),relevance:0}].concat(l,c);u.contains=k,g.contains=k;const T=[{begin:/^\s*=>/,starts:{end:"$",contains:k}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:k}}];return c.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(T).concat(c).concat(k)}}function l3(e){const t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),s=t.concat(n,e.IDENT_RE),i={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,s,t.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",a=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],c=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],u=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:u,keyword:a,literal:l,built_in:c},illegal:"</",contains:[e.C_LINE_COMMENT_MODE,e.COMMENT("/\\*","\\*/",{contains:["self"]}),e.inherit(e.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+o},{begin:"\\b0o([0-7_]+)"+o},{begin:"\\b0x([A-Fa-f0-9_]+)"+o},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+o}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:e.IDENT_RE+"::",keywords:{keyword:"Self",built_in:c,type:u}},{className:"punctuation",begin:"->"},i]}}const c3=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),u3=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],d3=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],f3=[...u3,...d3],h3=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),p3=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),m3=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),g3=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function b3(e){const t=c3(e),n=m3,r=p3,s="@[a-z-]+",i="and or not only",a={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+f3.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},a,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+g3.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,a,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:s,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:h3.join(" ")},contains:[{begin:s,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},a,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function y3(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function x3(e){const t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},s={begin:/"/,end:/"/,contains:[{match:/""/}]},i=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],a=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],c=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],d=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],f=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],p=u,m=[...c,...l].filter(N=>!u.includes(N)),g={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},b={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},y={match:t.concat(/\b/,t.either(...p),/\s*\(/),relevance:0,keywords:{built_in:p}};function w(N){return t.concat(/\b/,t.either(...N.map(k=>k.replace(/\s+/,"\\s+"))),/\b/)}const v={scope:"keyword",match:w(f),relevance:0};function E(N,{exceptions:k,when:C}={}){const A=C;return k=k||[],N.map(R=>R.match(/\|\d+$/)||k.includes(R)?R:A(R)?`${R}|0`:R)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:E(m,{when:N=>N.length<3}),literal:i,type:a,built_in:d},contains:[{scope:"type",match:w(o)},v,y,g,r,s,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,b]}}function i1(e){return e?typeof e=="string"?e:e.source:null}function Xo(e){return ut("(?=",e,")")}function ut(...e){return e.map(n=>i1(n)).join("")}function v3(e){const t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function vn(...e){return"("+(v3(e).capture?"":"?:")+e.map(r=>i1(r)).join("|")+")"}const bg=e=>ut(/\b/,e,/\w$/.test(e)?/\b/:/\B/),w3=["Protocol","Type"].map(bg),Ox=["init","self"].map(bg),k3=["Any","Self"],Hf=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Ix=["false","nil","true"],S3=["assignment","associativity","higherThan","left","lowerThan","none","right"],E3=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Dx=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],o1=vn(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),a1=vn(o1,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),Vf=ut(o1,a1,"*"),l1=vn(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),xu=vn(l1,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),Tr=ut(l1,xu,"*"),Gl=ut(/[A-Z]/,xu,"*"),C3=["attached","autoclosure",ut(/convention\(/,vn("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",ut(/objc\(/,Tr,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],N3=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function _3(e){const t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],s={match:[/\./,vn(...w3,...Ox)],className:{2:"keyword"}},i={match:ut(/\./,vn(...Hf)),relevance:0},o=Hf.filter(ne=>typeof ne=="string").concat(["_|0"]),a=Hf.filter(ne=>typeof ne!="string").concat(k3).map(bg),l={variants:[{className:"keyword",match:vn(...a,...Ox)}]},c={$pattern:vn(/\b\w+/,/#\w+/),keyword:o.concat(E3),literal:Ix},u=[s,i,l],d={match:ut(/\./,vn(...Dx)),relevance:0},f={className:"built_in",match:ut(/\b/,vn(...Dx),/(?=\()/)},p=[d,f],m={match:/->/,relevance:0},g={className:"operator",relevance:0,variants:[{match:Vf},{match:`\\.(\\.|${a1})+`}]},b=[m,g],y="([0-9]_*)+",w="([0-9a-fA-F]_*)+",v={className:"number",relevance:0,variants:[{match:`\\b(${y})(\\.(${y}))?([eE][+-]?(${y}))?\\b`},{match:`\\b0x(${w})(\\.(${w}))?([pP][+-]?(${y}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},E=(ne="")=>({className:"subst",variants:[{match:ut(/\\/,ne,/[0\\tnr"']/)},{match:ut(/\\/,ne,/u\{[0-9a-fA-F]{1,8}\}/)}]}),N=(ne="")=>({className:"subst",match:ut(/\\/,ne,/[\t ]*(?:[\r\n]|\r\n)/)}),k=(ne="")=>({className:"subst",label:"interpol",begin:ut(/\\/,ne,/\(/),end:/\)/}),C=(ne="")=>({begin:ut(ne,/"""/),end:ut(/"""/,ne),contains:[E(ne),N(ne),k(ne)]}),A=(ne="")=>({begin:ut(ne,/"/),end:ut(/"/,ne),contains:[E(ne),k(ne)]}),R={className:"string",variants:[C(),C("#"),C("##"),C("###"),A(),A("#"),A("##"),A("###")]},T=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],I={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:T},O=ne=>{const et=ut(ne,/\//),We=ut(/\//,ne);return{begin:et,end:We,contains:[...T,{scope:"comment",begin:`#(?!.*${We})`,end:/$/}]}},j={scope:"regexp",variants:[O("###"),O("##"),O("#"),I]},L={match:ut(/`/,Tr,/`/)},F={className:"variable",match:/\$\d+/},q={className:"variable",match:`\\$${xu}+`},te=[L,F,q],K={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:N3,contains:[...b,v,R]}]}},le={scope:"keyword",match:ut(/@/,vn(...C3),Xo(vn(/\(/,/\s+/)))},_={scope:"meta",match:ut(/@/,Tr)},ae=[K,le,_],me={match:Xo(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:ut(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,xu,"+")},{className:"type",match:Gl,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:ut(/\s+&\s+/,Xo(Gl)),relevance:0}]},S={begin:/</,end:/>/,keywords:c,contains:[...r,...u,...ae,m,me]};me.contains.push(S);const B={match:ut(Tr,/\s*:/),keywords:"_|0",relevance:0},$={begin:/\(/,end:/\)/,relevance:0,keywords:c,contains:["self",B,...r,j,...u,...p,...b,v,R,...te,...ae,me]},D={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,me]},P={begin:vn(Xo(ut(Tr,/\s*:/)),Xo(ut(Tr,/\s+/,Tr,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:Tr}]},W={begin:/\(/,end:/\)/,keywords:c,contains:[P,...r,...u,...b,v,R,...ae,me,$],endsParent:!0,illegal:/["']/},fe={match:[/(func|macro)/,/\s+/,vn(L.match,Tr,Vf)],className:{1:"keyword",3:"title.function"},contains:[D,W,t],illegal:[/\[/,/%/]},ee={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[D,W,t],illegal:/\[|%/},be={match:[/operator/,/\s+/,Vf],className:{1:"keyword",3:"title"}},Me={begin:[/precedencegroup/,/\s+/,Gl],className:{1:"keyword",3:"title"},contains:[me],keywords:[...S3,...Ix],end:/}/},Le={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},Ke={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ce={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,Tr,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:c,contains:[D,...u,{begin:/:/,end:/\{/,keywords:c,contains:[{scope:"title.class.inherited",match:Gl},...u],relevance:0}]};for(const ne of R.variants){const et=ne.contains.find(ie=>ie.label==="interpol");et.keywords=c;const We=[...u,...p,...b,v,R,...te];et.contains=[...We,{begin:/\(/,end:/\)/,contains:["self",...We]}]}return{name:"Swift",keywords:c,contains:[...r,fe,ee,Le,Ke,ce,be,Me,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},j,...u,...p,...b,v,R,...te,...ae,me,$]}}const vu="[A-Za-z$_][0-9A-Za-z$_]*",c1=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],u1=["true","false","null","undefined","NaN","Infinity"],d1=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],f1=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],h1=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],p1=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],m1=[].concat(h1,d1,f1);function T3(e){const t=e.regex,n=(K,{after:le})=>{const _="</"+K[0].slice(1);return K.input.indexOf(_,le)!==-1},r=vu,s={begin:"<>",end:"</>"},i=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(K,le)=>{const _=K[0].length+K.index,ae=K.input[_];if(ae==="<"||ae===","){le.ignoreMatch();return}ae===">"&&(n(K,{after:_})||le.ignoreMatch());let me;const S=K.input.substring(_);if(me=S.match(/^\s*=/)){le.ignoreMatch();return}if((me=S.match(/^\s+extends\s+/))&&me.index===0){le.ignoreMatch();return}}},a={$pattern:vu,keyword:c1,literal:u1,built_in:m1,"variable.language":p1},l="[0-9](_?[0-9])*",c=`\\.(${l})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",d={className:"number",variants:[{begin:`(\\b(${u})((${c})|\\.)?|(${c}))[eE][+-]?(${l})\\b`},{begin:`\\b(${u})\\b((${c})\\b|\\.)?|(${c})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},f={className:"subst",begin:"\\$\\{",end:"\\}",keywords:a,contains:[]},p={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:"css"}},g={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,f],subLanguage:"graphql"}},b={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,f]},w={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},v=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,b,{match:/\$\d+/},d];f.contains=v.concat({begin:/\{/,end:/\}/,keywords:a,contains:["self"].concat(v)});const E=[].concat(w,f.contains),N=E.concat([{begin:/(\s*)\(/,end:/\)/,keywords:a,contains:["self"].concat(E)}]),k={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N},C={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},A={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...d1,...f1]}},R={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},T={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[k],illegal:/%/},I={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function O(K){return t.concat("(?!",K.join("|"),")")}const j={match:t.concat(/\b/,O([...h1,"super","import"].map(K=>`${K}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},F={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},k]},q="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",te={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(q)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[k]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:a,exports:{PARAMS_CONTAINS:N,CLASS_REFERENCE:A},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),R,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,p,m,g,b,w,{match:/\$\d+/},d,A,{scope:"attr",match:r+t.lookahead(":"),relevance:0},te,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,e.REGEXP_MODE,{className:"function",begin:q,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:a,contains:N}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:s.begin,end:s.end},{match:i},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},T,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[k,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[k]},j,I,C,F,{match:/\$[(.]/}]}}function A3(e){const t=e.regex,n=T3(e),r=vu,s=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],i={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:s},contains:[n.exports.CLASS_REFERENCE]},a={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],c={$pattern:vu,keyword:c1.concat(l),literal:u1,built_in:m1.concat(s),"variable.language":p1},u={className:"meta",begin:"@"+r},d=(g,b,y)=>{const w=g.contains.findIndex(v=>v.label===b);if(w===-1)throw new Error("can not find mode to replace");g.contains.splice(w,1,y)};Object.assign(n.keywords,c),n.exports.PARAMS_CONTAINS.push(u);const f=n.contains.find(g=>g.scope==="attr"),p=Object.assign({},f,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,f,p]),n.contains=n.contains.concat([u,i,o,p]),d(n,"shebang",e.SHEBANG()),d(n,"use_strict",a);const m=n.contains.find(g=>g.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function M3(e){const t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},s=/\d{1,2}\/\d{1,2}\/\d{4}/,i=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,a=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:t.concat(/# */,t.either(i,s),/ *#/)},{begin:t.concat(/# */,a,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(i,s),/ +/,t.either(o,a),/ *#/)}]},c={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:"label",begin:/^\w+:/},d=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),f=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,l,c,u,d,f,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[f]}]}}function R3(e){e.regex;const t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");const n=e.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],s={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},i={className:"variable",begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},a={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},c={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},i,o,s,e.QUOTE_STRING_MODE,l,c,a]}}function O3(e){const t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,s={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},i={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(i,{begin:/\(/,end:/\)/}),a=e.inherit(e.APOS_STRING_MODE,{className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),c={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[s]},{begin:/'/,end:/'/,contains:[s]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[i,l,a,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[i,o,l,a]}]}]},e.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},s,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[c],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[c],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(/</,t.lookahead(t.concat(n,t.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:c}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function I3(e){const t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},s={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},i={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,s]},a=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),f={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},p={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},m={begin:/\{/,end:/\}/,contains:[p],illegal:"\\n",relevance:0},g={begin:"\\[",end:"\\]",contains:[p],illegal:"\\n",relevance:0},b=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},f,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,g,i,o],y=[...b];return y.pop(),y.push(a),p.contains=y,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:b}}const D3={arduino:m4,bash:g4,c:b4,cpp:y4,csharp:x4,css:T4,diff:A4,go:M4,graphql:R4,ini:O4,java:I4,javascript:z4,json:F4,kotlin:$4,less:J4,lua:Z4,makefile:Y4,markdown:X4,objectivec:Q4,perl:e3,php:t3,"php-template":n3,plaintext:r3,python:s3,"python-repl":i3,r:o3,ruby:a3,rust:l3,scss:b3,shell:y3,sql:x3,swift:_3,typescript:A3,vbnet:M3,wasm:R3,xml:O3,yaml:I3};const Lx={},L3="hljs-";function P3(e){const t=YC.newInstance();return e&&i(e),{highlight:n,highlightAuto:r,listLanguages:s,register:i,registerAlias:o,registered:a};function n(l,c,u){const d=u||Lx,f=typeof d.prefix=="string"?d.prefix:L3;if(!t.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");t.configure({__emitter:j3,classPrefix:f});const p=t.highlight(c,{ignoreIllegals:!0,language:l});if(p.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:p.errorRaised});const m=p._emitter.root,g=m.data;return g.language=p.language,g.relevance=p.relevance,m}function r(l,c){const d=(c||Lx).subset||s();let f=-1,p=0,m;for(;++f<d.length;){const g=d[f];if(!t.getLanguage(g))continue;const b=n(g,l,c);b.data&&b.data.relevance!==void 0&&b.data.relevance>p&&(p=b.data.relevance,m=b)}return m||{type:"root",children:[],data:{language:void 0,relevance:p}}}function s(){return t.listLanguages()}function i(l,c){if(typeof l=="string")t.registerLanguage(l,c);else{let u;for(u in l)Object.hasOwn(l,u)&&t.registerLanguage(u,l[u])}}function o(l,c){if(typeof l=="string")t.registerAliases(typeof c=="string"?c:[...c],{languageName:l});else{let u;for(u in l)if(Object.hasOwn(l,u)){const d=l[u];t.registerAliases(typeof d=="string"?d:[...d],{languageName:u})}}}function a(l){return!!t.getLanguage(l)}}class j3{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;const n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){const r=this.stack[this.stack.length-1],s=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:s}):r.children.push(...s)}openNode(t){const n=this,r=t.split(".").map(function(o,a){return a?o+"_".repeat(a):n.options.classPrefix+o}),s=this.stack[this.stack.length-1],i={type:"element",tagName:"span",properties:{className:r},children:[]};s.children.push(i),this.stack.push(i)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}function Px(e){if(e)throw e}var qf,jx;function z3(){if(jx)return qf;jx=1;var e=Object.prototype.hasOwnProperty,t=Object.prototype.toString,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,s=function(c){return typeof Array.isArray=="function"?Array.isArray(c):t.call(c)==="[object Array]"},i=function(c){if(!c||t.call(c)!=="[object Object]")return!1;var u=e.call(c,"constructor"),d=c.constructor&&c.constructor.prototype&&e.call(c.constructor.prototype,"isPrototypeOf");if(c.constructor&&!u&&!d)return!1;var f;for(f in c);return typeof f>"u"||e.call(c,f)},o=function(c,u){n&&u.name==="__proto__"?n(c,u.name,{enumerable:!0,configurable:!0,value:u.newValue,writable:!0}):c[u.name]=u.newValue},a=function(c,u){if(u==="__proto__")if(e.call(c,u)){if(r)return r(c,u).value}else return;return c[u]};return qf=function l(){var c,u,d,f,p,m,g=arguments[0],b=1,y=arguments.length,w=!1;for(typeof g=="boolean"&&(w=g,g=arguments[1]||{},b=2),(g==null||typeof g!="object"&&typeof g!="function")&&(g={});b<y;++b)if(c=arguments[b],c!=null)for(u in c)d=a(g,u),f=a(c,u),g!==f&&(w&&f&&(i(f)||(p=s(f)))?(p?(p=!1,m=d&&s(d)?d:[]):m=d&&i(d)?d:{},o(g,{name:u,newValue:l(w,m,f)})):typeof f<"u"&&o(g,{name:u,newValue:f}));return g},qf}var F3=z3();const Wf=tl(F3);function kp(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function B3(){const e=[],t={run:n,use:r};return t;function n(...s){let i=-1;const o=s.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);a(null,...s);function a(l,...c){const u=e[++i];let d=-1;if(l){o(l);return}for(;++d<s.length;)(c[d]===null||c[d]===void 0)&&(c[d]=s[d]);s=c,u?$3(u,a)(...c):o(null,...c)}}function r(s){if(typeof s!="function")throw new TypeError("Expected `middelware` to be a function, not "+s);return e.push(s),t}}function $3(e,t){let n;return r;function r(...o){const a=e.length>o.length;let l;a&&o.push(s);try{l=e.apply(this,o)}catch(c){const u=c;if(a&&n)throw u;return s(u)}a||(l&&l.then&&typeof l.then=="function"?l.then(i,s):l instanceof Error?s(l):i(l))}function s(o,...a){n||(n=!0,t(o,...a))}function i(o){s(null,o)}}function Ca(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?zx(e.position):"start"in e||"end"in e?zx(e):"line"in e||"column"in e?Sp(e):""}function Sp(e){return Fx(e&&e.line)+":"+Fx(e&&e.column)}function zx(e){return Sp(e&&e.start)+"-"+Sp(e&&e.end)}function Fx(e){return e&&typeof e=="number"?e:1}class yn extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let s="",i={},o=!1;if(n&&("line"in n&&"column"in n?i={place:n}:"start"in n&&"end"in n?i={place:n}:"type"in n?i={ancestors:[n],place:n.position}:i={...n}),typeof t=="string"?s=t:!i.cause&&t&&(o=!0,s=t.message,i.cause=t),!i.ruleId&&!i.source&&typeof r=="string"){const l=r.indexOf(":");l===-1?i.ruleId=r:(i.source=r.slice(0,l),i.ruleId=r.slice(l+1))}if(!i.place&&i.ancestors&&i.ancestors){const l=i.ancestors[i.ancestors.length-1];l&&(i.place=l.position)}const a=i.place&&"start"in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=a?a.column:void 0,this.fatal=void 0,this.file="",this.message=s,this.line=a?a.line:void 0,this.name=Ca(i.place)||"1:1",this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=o&&i.cause&&typeof i.cause.stack=="string"?i.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}yn.prototype.file="";yn.prototype.name="";yn.prototype.reason="";yn.prototype.message="";yn.prototype.stack="";yn.prototype.column=void 0;yn.prototype.line=void 0;yn.prototype.ancestors=void 0;yn.prototype.cause=void 0;yn.prototype.fatal=void 0;yn.prototype.place=void 0;yn.prototype.ruleId=void 0;yn.prototype.source=void 0;const Or={basename:U3,dirname:H3,extname:V3,join:q3,sep:"/"};function U3(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');yl(e);let n=0,r=-1,s=e.length,i;if(t===void 0||t.length===0||t.length>e.length){for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else r<0&&(i=!0,r=s+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,a=t.length-1;for(;s--;)if(e.codePointAt(s)===47){if(i){n=s+1;break}}else o<0&&(i=!0,o=s+1),a>-1&&(e.codePointAt(s)===t.codePointAt(a--)?a<0&&(r=s):(a=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function H3(e){if(yl(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function V3(e){yl(e);let t=e.length,n=-1,r=0,s=-1,i=0,o;for(;t--;){const a=e.codePointAt(t);if(a===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),a===46?s<0?s=t:i!==1&&(i=1):s>-1&&(i=-1)}return s<0||n<0||i===0||i===1&&s===n-1&&s===r+1?"":e.slice(s,n)}function q3(...e){let t=-1,n;for(;++t<e.length;)yl(e[t]),e[t]&&(n=n===void 0?e[t]:n+"/"+e[t]);return n===void 0?".":W3(n)}function W3(e){yl(e);const t=e.codePointAt(0)===47;let n=K3(e,!t);return n.length===0&&!t&&(n="."),n.length>0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function K3(e,t){let n="",r=0,s=-1,i=0,o=-1,a,l;for(;++o<=e.length;){if(o<e.length)a=e.codePointAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||i===1))if(s!==o-1&&i===2){if(n.length<2||r!==2||n.codePointAt(n.length-1)!==46||n.codePointAt(n.length-2)!==46){if(n.length>2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),s=o,i=0;continue}}else if(n.length>0){n="",r=0,s=o,i=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(s+1,o):n=e.slice(s+1,o),r=o-s-1;s=o,i=0}else a===46&&i>-1?i++:i=-1}return n}function yl(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}const G3={cwd:J3};function J3(){return"/"}function Ep(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function Z3(e){if(typeof e=="string")e=new URL(e);else if(!Ep(e)){const t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){const t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return Y3(e)}function Y3(e){if(e.hostname!==""){const r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}const t=e.pathname;let n=-1;for(;++n<t.length;)if(t.codePointAt(n)===37&&t.codePointAt(n+1)===50){const r=t.codePointAt(n+2);if(r===70||r===102){const s=new TypeError("File URL path must not include encoded / characters");throw s.code="ERR_INVALID_FILE_URL_PATH",s}}return decodeURIComponent(t)}const Kf=["history","path","basename","stem","extname","dirname"];class g1{constructor(t){let n;t?Ep(t)?n={path:t}:typeof t=="string"||X3(t)?n={value:t}:n=t:n={},this.cwd="cwd"in n?"":G3.cwd(),this.data={},this.history=[],this.messages=[],this.value,this.map,this.result,this.stored;let r=-1;for(;++r<Kf.length;){const i=Kf[r];i in n&&n[i]!==void 0&&n[i]!==null&&(this[i]=i==="history"?[...n[i]]:n[i])}let s;for(s in n)Kf.includes(s)||(this[s]=n[s])}get basename(){return typeof this.path=="string"?Or.basename(this.path):void 0}set basename(t){Jf(t,"basename"),Gf(t,"basename"),this.path=Or.join(this.dirname||"",t)}get dirname(){return typeof this.path=="string"?Or.dirname(this.path):void 0}set dirname(t){Bx(this.basename,"dirname"),this.path=Or.join(t||"",this.basename)}get extname(){return typeof this.path=="string"?Or.extname(this.path):void 0}set extname(t){if(Gf(t,"extname"),Bx(this.dirname,"extname"),t){if(t.codePointAt(0)!==46)throw new Error("`extname` must start with `.`");if(t.includes(".",1))throw new Error("`extname` cannot contain multiple dots")}this.path=Or.join(this.dirname,this.stem+(t||""))}get path(){return this.history[this.history.length-1]}set path(t){Ep(t)&&(t=Z3(t)),Jf(t,"path"),this.path!==t&&this.history.push(t)}get stem(){return typeof this.path=="string"?Or.basename(this.path,this.extname):void 0}set stem(t){Jf(t,"stem"),Gf(t,"stem"),this.path=Or.join(this.dirname||"",t+(this.extname||""))}fail(t,n,r){const s=this.message(t,n,r);throw s.fatal=!0,s}info(t,n,r){const s=this.message(t,n,r);return s.fatal=void 0,s}message(t,n,r){const s=new yn(t,n,r);return this.path&&(s.name=this.path+":"+s.name,s.file=this.path),s.fatal=!1,this.messages.push(s),s}toString(t){return this.value===void 0?"":typeof this.value=="string"?this.value:new TextDecoder(t||void 0).decode(this.value)}}function Gf(e,t){if(e&&e.includes(Or.sep))throw new Error("`"+t+"` cannot be a path: did not expect `"+Or.sep+"`")}function Jf(e,t){if(!e)throw new Error("`"+t+"` cannot be empty")}function Bx(e,t){if(!e)throw new Error("Setting `"+t+"` requires `path` to be set too")}function X3(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const Q3=(function(e){const r=this.constructor.prototype,s=r[e],i=function(){return s.apply(i,arguments)};return Object.setPrototypeOf(i,r),i}),eU={}.hasOwnProperty;class yg extends Q3{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=B3()}copy(){const t=new yg;let n=-1;for(;++n<this.attachers.length;){const r=this.attachers[n];t.use(...r)}return t.data(Wf(!0,{},this.namespace)),t}data(t,n){return typeof t=="string"?arguments.length===2?(Xf("data",this.frozen),this.namespace[t]=n,this):eU.call(this.namespace,t)&&this.namespace[t]||void 0:t?(Xf("data",this.frozen),this.namespace=t,this):this.namespace}freeze(){if(this.frozen)return this;const t=this;for(;++this.freezeIndex<this.attachers.length;){const[n,...r]=this.attachers[this.freezeIndex];if(r[0]===!1)continue;r[0]===!0&&(r[0]=void 0);const s=n.call(t,...r);typeof s=="function"&&this.transformers.use(s)}return this.frozen=!0,this.freezeIndex=Number.POSITIVE_INFINITY,this}parse(t){this.freeze();const n=Jl(t),r=this.parser||this.Parser;return Zf("parse",r),r(String(n),n)}process(t,n){const r=this;return this.freeze(),Zf("process",this.parser||this.Parser),Yf("process",this.compiler||this.Compiler),n?s(void 0,n):new Promise(s);function s(i,o){const a=Jl(t),l=r.parse(a);r.run(l,a,function(u,d,f){if(u||!d||!f)return c(u);const p=d,m=r.stringify(p,f);nU(m)?f.value=m:f.result=m,c(u,f)});function c(u,d){u||!d?o(u):i?i(d):n(void 0,d)}}}processSync(t){let n=!1,r;return this.freeze(),Zf("processSync",this.parser||this.Parser),Yf("processSync",this.compiler||this.Compiler),this.process(t,s),Ux("processSync","process",n),r;function s(i,o){n=!0,Px(i),r=o}}run(t,n,r){$x(t),this.freeze();const s=this.transformers;return!r&&typeof n=="function"&&(r=n,n=void 0),r?i(void 0,r):new Promise(i);function i(o,a){const l=Jl(n);s.run(t,l,c);function c(u,d,f){const p=d||t;u?a(u):o?o(p):r(void 0,p,f)}}}runSync(t,n){let r=!1,s;return this.run(t,n,i),Ux("runSync","run",r),s;function i(o,a){Px(o),s=a,r=!0}}stringify(t,n){this.freeze();const r=Jl(n),s=this.compiler||this.Compiler;return Yf("stringify",s),$x(t),s(t,r)}use(t,...n){const r=this.attachers,s=this.namespace;if(Xf("use",this.frozen),t!=null)if(typeof t=="function")l(t,n);else if(typeof t=="object")Array.isArray(t)?a(t):o(t);else throw new TypeError("Expected usable value, not `"+t+"`");return this;function i(c){if(typeof c=="function")l(c,[]);else if(typeof c=="object")if(Array.isArray(c)){const[u,...d]=c;l(u,d)}else o(c);else throw new TypeError("Expected usable value, not `"+c+"`")}function o(c){if(!("plugins"in c)&&!("settings"in c))throw new Error("Expected usable value but received an empty preset, which is probably a mistake: presets typically come with `plugins` and sometimes with `settings`, but this has neither");a(c.plugins),c.settings&&(s.settings=Wf(!0,s.settings,c.settings))}function a(c){let u=-1;if(c!=null)if(Array.isArray(c))for(;++u<c.length;){const d=c[u];i(d)}else throw new TypeError("Expected a list of plugins, not `"+c+"`")}function l(c,u){let d=-1,f=-1;for(;++d<r.length;)if(r[d][0]===c){f=d;break}if(f===-1)r.push([c,...u]);else if(u.length>0){let[p,...m]=u;const g=r[f][1];kp(g)&&kp(p)&&(p=Wf(!0,g,p)),r[f]=[c,p,...m]}}}}const b1=new yg().freeze();function Zf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function Yf(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function Xf(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function $x(e){if(!kp(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Ux(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Jl(e){return tU(e)?e:new g1(e)}function tU(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function nU(e){return typeof e=="string"||rU(e)}function rU(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}const sU={};function xg(e,t){const n=sU,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,s=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return y1(e,r,s)}function y1(e,t,n){if(iU(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return Hx(e.children,t,n)}return Array.isArray(e)?Hx(e,t,n):""}function Hx(e,t,n){const r=[];let s=-1;for(;++s<e.length;)r[s]=y1(e[s],t,n);return r.join("")}function iU(e){return!!(e&&typeof e=="object")}const Vx=document.createElement("i");function vg(e){const t="&"+e+";";Vx.innerHTML=t;const n=Vx.textContent;return n.charCodeAt(n.length-1)===59&&e!=="semi"||n===t?!1:n}function Wn(e,t,n,r){const s=e.length;let i=0,o;if(t<0?t=-t>s?0:s+t:t=t>s?s:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);i<r.length;)o=r.slice(i,i+1e4),o.unshift(t,0),e.splice(...o),i+=1e4,t+=1e4}function nr(e,t){return e.length>0?(Wn(e,e.length,0,t),e):t}const qx={}.hasOwnProperty;function x1(e){const t={};let n=-1;for(;++n<e.length;)oU(t,e[n]);return t}function oU(e,t){let n;for(n in t){const s=(qx.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n];let o;if(i)for(o in i){qx.call(s,o)||(s[o]=[]);const a=i[o];aU(s[o],Array.isArray(a)?a:a?[a]:[])}}}function aU(e,t){let n=-1;const r=[];for(;++n<t.length;)(t[n].add==="after"?e:r).push(t[n]);Wn(e,0,0,r)}function v1(e,t){const n=Number.parseInt(e,t);return n<9||n===11||n>13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"�":String.fromCodePoint(n)}function yr(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const kn=Qs(/[A-Za-z]/),pn=Qs(/[\dA-Za-z]/),lU=Qs(/[#-'*+\--9=?A-Z^-~]/);function wu(e){return e!==null&&(e<32||e===127)}const Cp=Qs(/\d/),cU=Qs(/[\dA-Fa-f]/),uU=Qs(/[!-/:-@[-`{-~]/);function _e(e){return e!==null&&e<-2}function pt(e){return e!==null&&(e<0||e===32)}function Ge(e){return e===-2||e===-1||e===32}const Id=Qs(new RegExp("\\p{P}|\\p{S}","u")),Ii=Qs(/\s/);function Qs(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function $o(e){const t=[];let n=-1,r=0,s=0;for(;++n<e.length;){const i=e.charCodeAt(n);let o="";if(i===37&&pn(e.charCodeAt(n+1))&&pn(e.charCodeAt(n+2)))s=2;else if(i<128)/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(i))||(o=String.fromCharCode(i));else if(i>55295&&i<57344){const a=e.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(o=String.fromCharCode(i,a),s=1):o="�"}else o=String.fromCharCode(i);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+s+1,o=""),s&&(n+=s,s=0)}return t.join("")+e.slice(r)}function Ye(e,t,n,r){const s=r?r-1:Number.POSITIVE_INFINITY;let i=0;return o;function o(l){return Ge(l)?(e.enter(n),a(l)):t(l)}function a(l){return Ge(l)&&i++<s?(e.consume(l),a):(e.exit(n),t(l))}}const dU={tokenize:fU};function fU(e){const t=e.attempt(this.parser.constructs.contentInitial,r,s);let n;return t;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),Ye(e,t,"linePrefix")}function s(a){return e.enter("paragraph"),i(a)}function i(a){const l=e.enter("chunkText",{contentType:"text",previous:n});return n&&(n.next=l),n=l,o(a)}function o(a){if(a===null){e.exit("chunkText"),e.exit("paragraph"),e.consume(a);return}return _e(a)?(e.consume(a),e.exit("chunkText"),i):(e.consume(a),o)}}const hU={tokenize:pU},Wx={tokenize:mU};function pU(e){const t=this,n=[];let r=0,s,i,o;return a;function a(v){if(r<n.length){const E=n[r];return t.containerState=E[1],e.attempt(E[0].continuation,l,c)(v)}return c(v)}function l(v){if(r++,t.containerState._closeFlow){t.containerState._closeFlow=void 0,s&&w();const E=t.events.length;let N=E,k;for(;N--;)if(t.events[N][0]==="exit"&&t.events[N][1].type==="chunkFlow"){k=t.events[N][1].end;break}y(r);let C=E;for(;C<t.events.length;)t.events[C][1].end={...k},C++;return Wn(t.events,N+1,0,t.events.slice(E)),t.events.length=C,c(v)}return a(v)}function c(v){if(r===n.length){if(!s)return f(v);if(s.currentConstruct&&s.currentConstruct.concrete)return m(v);t.interrupt=!!(s.currentConstruct&&!s._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(Wx,u,d)(v)}function u(v){return s&&w(),y(r),f(v)}function d(v){return t.parser.lazy[t.now().line]=r!==n.length,o=t.now().offset,m(v)}function f(v){return t.containerState={},e.attempt(Wx,p,m)(v)}function p(v){return r++,n.push([t.currentConstruct,t.containerState]),f(v)}function m(v){if(v===null){s&&w(),y(0),e.consume(v);return}return s=s||t.parser.flow(t.now()),e.enter("chunkFlow",{_tokenizer:s,contentType:"flow",previous:i}),g(v)}function g(v){if(v===null){b(e.exit("chunkFlow"),!0),y(0),e.consume(v);return}return _e(v)?(e.consume(v),b(e.exit("chunkFlow")),r=0,t.interrupt=void 0,a):(e.consume(v),g)}function b(v,E){const N=t.sliceStream(v);if(E&&N.push(null),v.previous=i,i&&(i.next=v),i=v,s.defineSkip(v.start),s.write(N),t.parser.lazy[v.start.line]){let k=s.events.length;for(;k--;)if(s.events[k][1].start.offset<o&&(!s.events[k][1].end||s.events[k][1].end.offset>o))return;const C=t.events.length;let A=C,R,T;for(;A--;)if(t.events[A][0]==="exit"&&t.events[A][1].type==="chunkFlow"){if(R){T=t.events[A][1].end;break}R=!0}for(y(r),k=C;k<t.events.length;)t.events[k][1].end={...T},k++;Wn(t.events,A+1,0,t.events.slice(C)),t.events.length=k}}function y(v){let E=n.length;for(;E-- >v;){const N=n[E];t.containerState=N[1],N[0].exit.call(t,e)}n.length=v}function w(){s.write([null]),i=void 0,s=void 0,t.containerState._closeFlow=void 0}}function mU(e,t,n){return Ye(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function To(e){if(e===null||pt(e)||Ii(e))return 1;if(Id(e))return 2}function Dd(e,t,n){const r=[];let s=-1;for(;++s<e.length;){const i=e[s].resolveAll;i&&!r.includes(i)&&(t=i(t,n),r.push(i))}return t}const Np={name:"attention",resolveAll:gU,tokenize:bU};function gU(e,t){let n=-1,r,s,i,o,a,l,c,u;for(;++n<e.length;)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){for(r=n;r--;)if(e[r][0]==="exit"&&e[r][1].type==="attentionSequence"&&e[r][1]._open&&t.sliceSerialize(e[r][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[r][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[r][1].end.offset-e[r][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;l=e[r][1].end.offset-e[r][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;const d={...e[r][1].end},f={...e[n][1].start};Kx(d,-l),Kx(f,l),o={type:l>1?"strongSequence":"emphasisSequence",start:d,end:{...e[r][1].end}},a={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:f},i={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},s={type:l>1?"strong":"emphasis",start:{...o.start},end:{...a.end}},e[r][1].end={...o.start},e[n][1].start={...a.end},c=[],e[r][1].end.offset-e[r][1].start.offset&&(c=nr(c,[["enter",e[r][1],t],["exit",e[r][1],t]])),c=nr(c,[["enter",s,t],["enter",o,t],["exit",o,t],["enter",i,t]]),c=nr(c,Dd(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),c=nr(c,[["exit",i,t],["enter",a,t],["exit",a,t],["exit",s,t]]),e[n][1].end.offset-e[n][1].start.offset?(u=2,c=nr(c,[["enter",e[n][1],t],["exit",e[n][1],t]])):u=0,Wn(e,r-1,n-r+3,c),n=r+c.length-u-2;break}}for(n=-1;++n<e.length;)e[n][1].type==="attentionSequence"&&(e[n][1].type="data");return e}function bU(e,t){const n=this.parser.constructs.attentionMarkers.null,r=this.previous,s=To(r);let i;return o;function o(l){return i=l,e.enter("attentionSequence"),a(l)}function a(l){if(l===i)return e.consume(l),a;const c=e.exit("attentionSequence"),u=To(l),d=!u||u===2&&s||n.includes(l),f=!s||s===2&&u||n.includes(r);return c._open=!!(i===42?d:d&&(s||!f)),c._close=!!(i===42?f:f&&(u||!d)),t(l)}}function Kx(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}const yU={name:"autolink",tokenize:xU};function xU(e,t,n){let r=0;return s;function s(p){return e.enter("autolink"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.enter("autolinkProtocol"),i}function i(p){return kn(p)?(e.consume(p),o):p===64?n(p):c(p)}function o(p){return p===43||p===45||p===46||pn(p)?(r=1,a(p)):c(p)}function a(p){return p===58?(e.consume(p),r=0,l):(p===43||p===45||p===46||pn(p))&&r++<32?(e.consume(p),a):(r=0,c(p))}function l(p){return p===62?(e.exit("autolinkProtocol"),e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):p===null||p===32||p===60||wu(p)?n(p):(e.consume(p),l)}function c(p){return p===64?(e.consume(p),u):lU(p)?(e.consume(p),c):n(p)}function u(p){return pn(p)?d(p):n(p)}function d(p){return p===46?(e.consume(p),r=0,u):p===62?(e.exit("autolinkProtocol").type="autolinkEmail",e.enter("autolinkMarker"),e.consume(p),e.exit("autolinkMarker"),e.exit("autolink"),t):f(p)}function f(p){if((p===45||pn(p))&&r++<63){const m=p===45?f:d;return e.consume(p),m}return n(p)}}const xl={partial:!0,tokenize:vU};function vU(e,t,n){return r;function r(i){return Ge(i)?Ye(e,s,"linePrefix")(i):s(i)}function s(i){return i===null||_e(i)?t(i):n(i)}}const w1={continuation:{tokenize:kU},exit:SU,name:"blockQuote",tokenize:wU};function wU(e,t,n){const r=this;return s;function s(o){if(o===62){const a=r.containerState;return a.open||(e.enter("blockQuote",{_container:!0}),a.open=!0),e.enter("blockQuotePrefix"),e.enter("blockQuoteMarker"),e.consume(o),e.exit("blockQuoteMarker"),i}return n(o)}function i(o){return Ge(o)?(e.enter("blockQuotePrefixWhitespace"),e.consume(o),e.exit("blockQuotePrefixWhitespace"),e.exit("blockQuotePrefix"),t):(e.exit("blockQuotePrefix"),t(o))}}function kU(e,t,n){const r=this;return s;function s(o){return Ge(o)?Ye(e,i,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(o):i(o)}function i(o){return e.attempt(w1,t,n)(o)}}function SU(e){e.exit("blockQuote")}const k1={name:"characterEscape",tokenize:EU};function EU(e,t,n){return r;function r(i){return e.enter("characterEscape"),e.enter("escapeMarker"),e.consume(i),e.exit("escapeMarker"),s}function s(i){return uU(i)?(e.enter("characterEscapeValue"),e.consume(i),e.exit("characterEscapeValue"),e.exit("characterEscape"),t):n(i)}}const S1={name:"characterReference",tokenize:CU};function CU(e,t,n){const r=this;let s=0,i,o;return a;function a(d){return e.enter("characterReference"),e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),l}function l(d){return d===35?(e.enter("characterReferenceMarkerNumeric"),e.consume(d),e.exit("characterReferenceMarkerNumeric"),c):(e.enter("characterReferenceValue"),i=31,o=pn,u(d))}function c(d){return d===88||d===120?(e.enter("characterReferenceMarkerHexadecimal"),e.consume(d),e.exit("characterReferenceMarkerHexadecimal"),e.enter("characterReferenceValue"),i=6,o=cU,u):(e.enter("characterReferenceValue"),i=7,o=Cp,u(d))}function u(d){if(d===59&&s){const f=e.exit("characterReferenceValue");return o===pn&&!vg(r.sliceSerialize(f))?n(d):(e.enter("characterReferenceMarker"),e.consume(d),e.exit("characterReferenceMarker"),e.exit("characterReference"),t)}return o(d)&&s++<i?(e.consume(d),u):n(d)}}const Gx={partial:!0,tokenize:_U},Jx={concrete:!0,name:"codeFenced",tokenize:NU};function NU(e,t,n){const r=this,s={partial:!0,tokenize:N};let i=0,o=0,a;return l;function l(k){return c(k)}function c(k){const C=r.events[r.events.length-1];return i=C&&C[1].type==="linePrefix"?C[2].sliceSerialize(C[1],!0).length:0,a=k,e.enter("codeFenced"),e.enter("codeFencedFence"),e.enter("codeFencedFenceSequence"),u(k)}function u(k){return k===a?(o++,e.consume(k),u):o<3?n(k):(e.exit("codeFencedFenceSequence"),Ge(k)?Ye(e,d,"whitespace")(k):d(k))}function d(k){return k===null||_e(k)?(e.exit("codeFencedFence"),r.interrupt?t(k):e.check(Gx,g,E)(k)):(e.enter("codeFencedFenceInfo"),e.enter("chunkString",{contentType:"string"}),f(k))}function f(k){return k===null||_e(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),d(k)):Ge(k)?(e.exit("chunkString"),e.exit("codeFencedFenceInfo"),Ye(e,p,"whitespace")(k)):k===96&&k===a?n(k):(e.consume(k),f)}function p(k){return k===null||_e(k)?d(k):(e.enter("codeFencedFenceMeta"),e.enter("chunkString",{contentType:"string"}),m(k))}function m(k){return k===null||_e(k)?(e.exit("chunkString"),e.exit("codeFencedFenceMeta"),d(k)):k===96&&k===a?n(k):(e.consume(k),m)}function g(k){return e.attempt(s,E,b)(k)}function b(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),y}function y(k){return i>0&&Ge(k)?Ye(e,w,"linePrefix",i+1)(k):w(k)}function w(k){return k===null||_e(k)?e.check(Gx,g,E)(k):(e.enter("codeFlowValue"),v(k))}function v(k){return k===null||_e(k)?(e.exit("codeFlowValue"),w(k)):(e.consume(k),v)}function E(k){return e.exit("codeFenced"),t(k)}function N(k,C,A){let R=0;return T;function T(F){return k.enter("lineEnding"),k.consume(F),k.exit("lineEnding"),I}function I(F){return k.enter("codeFencedFence"),Ge(F)?Ye(k,O,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):O(F)}function O(F){return F===a?(k.enter("codeFencedFenceSequence"),j(F)):A(F)}function j(F){return F===a?(R++,k.consume(F),j):R>=o?(k.exit("codeFencedFenceSequence"),Ge(F)?Ye(k,L,"whitespace")(F):L(F)):A(F)}function L(F){return F===null||_e(F)?(k.exit("codeFencedFence"),C(F)):A(F)}}}function _U(e,t,n){const r=this;return s;function s(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}const Qf={name:"codeIndented",tokenize:AU},TU={partial:!0,tokenize:MU};function AU(e,t,n){const r=this;return s;function s(c){return e.enter("codeIndented"),Ye(e,i,"linePrefix",5)(c)}function i(c){const u=r.events[r.events.length-1];return u&&u[1].type==="linePrefix"&&u[2].sliceSerialize(u[1],!0).length>=4?o(c):n(c)}function o(c){return c===null?l(c):_e(c)?e.attempt(TU,o,l)(c):(e.enter("codeFlowValue"),a(c))}function a(c){return c===null||_e(c)?(e.exit("codeFlowValue"),o(c)):(e.consume(c),a)}function l(c){return e.exit("codeIndented"),t(c)}}function MU(e,t,n){const r=this;return s;function s(o){return r.parser.lazy[r.now().line]?n(o):_e(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),s):Ye(e,i,"linePrefix",5)(o)}function i(o){const a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):_e(o)?s(o):n(o)}}const RU={name:"codeText",previous:IU,resolve:OU,tokenize:DU};function OU(e){let t=e.length-4,n=3,r,s;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r<t;)if(e[r][1].type==="codeTextData"){e[n][1].type="codeTextPadding",e[t][1].type="codeTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)s===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(s=r):(r===t||e[r][1].type==="lineEnding")&&(e[s][1].type="codeTextData",r!==s+2&&(e[s][1].end=e[r-1][1].end,e.splice(s+2,r-s-2),t-=r-s-2,r=s+2),s=void 0);return e}function IU(e){return e!==96||this.events[this.events.length-1][1].type==="characterEscape"}function DU(e,t,n){let r=0,s,i;return o;function o(d){return e.enter("codeText"),e.enter("codeTextSequence"),a(d)}function a(d){return d===96?(e.consume(d),r++,a):(e.exit("codeTextSequence"),l(d))}function l(d){return d===null?n(d):d===32?(e.enter("space"),e.consume(d),e.exit("space"),l):d===96?(i=e.enter("codeTextSequence"),s=0,u(d)):_e(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),l):(e.enter("codeTextData"),c(d))}function c(d){return d===null||d===32||d===96||_e(d)?(e.exit("codeTextData"),l(d)):(e.consume(d),c)}function u(d){return d===96?(e.consume(d),s++,u):s===r?(e.exit("codeTextSequence"),e.exit("codeText"),t(d)):(i.type="codeTextData",c(d))}}class LU{constructor(t){this.left=t?[...t]:[],this.right=[]}get(t){if(t<0||t>=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return t<this.left.length?this.left[t]:this.right[this.right.length-t+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(t,n){const r=n??Number.POSITIVE_INFINITY;return r<this.left.length?this.left.slice(t,r):t>this.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){const s=n||0;this.setCursor(Math.trunc(t));const i=this.right.splice(this.right.length-s,Number.POSITIVE_INFINITY);return r&&Qo(this.left,r),i.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Qo(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Qo(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t<this.left.length){const n=this.left.splice(t,Number.POSITIVE_INFINITY);Qo(this.right,n.reverse())}else{const n=this.right.splice(this.left.length+this.right.length-t,Number.POSITIVE_INFINITY);Qo(this.left,n.reverse())}}}function Qo(e,t){let n=0;if(t.length<1e4)e.push(...t);else for(;n<t.length;)e.push(...t.slice(n,n+1e4)),n+=1e4}function E1(e){const t={};let n=-1,r,s,i,o,a,l,c;const u=new LU(e);for(;++n<u.length;){for(;n in t;)n=t[n];if(r=u.get(n),n&&r[1].type==="chunkFlow"&&u.get(n-1)[1].type==="listItemPrefix"&&(l=r[1]._tokenizer.events,i=0,i<l.length&&l[i][1].type==="lineEndingBlank"&&(i+=2),i<l.length&&l[i][1].type==="content"))for(;++i<l.length&&l[i][1].type!=="content";)l[i][1].type==="chunkText"&&(l[i][1]._isInFirstContentOfListItem=!0,i++);if(r[0]==="enter")r[1].contentType&&(Object.assign(t,PU(u,n)),n=t[n],c=!0);else if(r[1]._container){for(i=n,s=void 0;i--;)if(o=u.get(i),o[1].type==="lineEnding"||o[1].type==="lineEndingBlank")o[0]==="enter"&&(s&&(u.get(s)[1].type="lineEndingBlank"),o[1].type="lineEnding",s=i);else if(!(o[1].type==="linePrefix"||o[1].type==="listItemIndent"))break;s&&(r[1].end={...u.get(s)[1].start},a=u.slice(s,n),a.unshift(r),u.splice(s,n-s+1,a))}}return Wn(e,0,Number.POSITIVE_INFINITY,u.slice(0)),!c}function PU(e,t){const n=e.get(t)[1],r=e.get(t)[2];let s=t-1;const i=[];let o=n._tokenizer;o||(o=r.parser[n.contentType](n.start),n._contentTypeTextTrailing&&(o._contentTypeTextTrailing=!0));const a=o.events,l=[],c={};let u,d,f=-1,p=n,m=0,g=0;const b=[g];for(;p;){for(;e.get(++s)[1]!==p;);i.push(s),p._tokenizer||(u=r.sliceStream(p),p.next||u.push(null),d&&o.defineSkip(p.start),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=!0),o.write(u),p._isInFirstContentOfListItem&&(o._gfmTasklistFirstContentOfListItem=void 0)),d=p,p=p.next}for(p=n;++f<a.length;)a[f][0]==="exit"&&a[f-1][0]==="enter"&&a[f][1].type===a[f-1][1].type&&a[f][1].start.line!==a[f][1].end.line&&(g=f+1,b.push(g),p._tokenizer=void 0,p.previous=void 0,p=p.next);for(o.events=[],p?(p._tokenizer=void 0,p.previous=void 0):b.pop(),f=b.length;f--;){const y=a.slice(b[f],b[f+1]),w=i.pop();l.push([w,w+y.length-1]),e.splice(w,2,y)}for(l.reverse(),f=-1;++f<l.length;)c[m+l[f][0]]=m+l[f][1],m+=l[f][1]-l[f][0]-1;return c}const jU={resolve:FU,tokenize:BU},zU={partial:!0,tokenize:$U};function FU(e){return E1(e),e}function BU(e,t){let n;return r;function r(a){return e.enter("content"),n=e.enter("chunkContent",{contentType:"content"}),s(a)}function s(a){return a===null?i(a):_e(a)?e.check(zU,o,i)(a):(e.consume(a),s)}function i(a){return e.exit("chunkContent"),e.exit("content"),t(a)}function o(a){return e.consume(a),e.exit("chunkContent"),n.next=e.enter("chunkContent",{contentType:"content",previous:n}),n=n.next,s}}function $U(e,t,n){const r=this;return s;function s(o){return e.exit("chunkContent"),e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),Ye(e,i,"linePrefix")}function i(o){if(o===null||_e(o))return n(o);const a=r.events[r.events.length-1];return!r.parser.constructs.disable.null.includes("codeIndented")&&a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function C1(e,t,n,r,s,i,o,a,l){const c=l||Number.POSITIVE_INFINITY;let u=0;return d;function d(y){return y===60?(e.enter(r),e.enter(s),e.enter(i),e.consume(y),e.exit(i),f):y===null||y===32||y===41||wu(y)?n(y):(e.enter(r),e.enter(o),e.enter(a),e.enter("chunkString",{contentType:"string"}),g(y))}function f(y){return y===62?(e.enter(i),e.consume(y),e.exit(i),e.exit(s),e.exit(r),t):(e.enter(a),e.enter("chunkString",{contentType:"string"}),p(y))}function p(y){return y===62?(e.exit("chunkString"),e.exit(a),f(y)):y===null||y===60||_e(y)?n(y):(e.consume(y),y===92?m:p)}function m(y){return y===60||y===62||y===92?(e.consume(y),p):p(y)}function g(y){return!u&&(y===null||y===41||pt(y))?(e.exit("chunkString"),e.exit(a),e.exit(o),e.exit(r),t(y)):u<c&&y===40?(e.consume(y),u++,g):y===41?(e.consume(y),u--,g):y===null||y===32||y===40||wu(y)?n(y):(e.consume(y),y===92?b:g)}function b(y){return y===40||y===41||y===92?(e.consume(y),g):g(y)}}function N1(e,t,n,r,s,i){const o=this;let a=0,l;return c;function c(p){return e.enter(r),e.enter(s),e.consume(p),e.exit(s),e.enter(i),u}function u(p){return a>999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in o.parser.constructs?n(p):p===93?(e.exit(i),e.enter(s),e.consume(p),e.exit(s),e.exit(r),t):_e(p)?(e.enter("lineEnding"),e.consume(p),e.exit("lineEnding"),u):(e.enter("chunkString",{contentType:"string"}),d(p))}function d(p){return p===null||p===91||p===93||_e(p)||a++>999?(e.exit("chunkString"),u(p)):(e.consume(p),l||(l=!Ge(p)),p===92?f:d)}function f(p){return p===91||p===92||p===93?(e.consume(p),a++,d):d(p)}}function _1(e,t,n,r,s,i){let o;return a;function a(f){return f===34||f===39||f===40?(e.enter(r),e.enter(s),e.consume(f),e.exit(s),o=f===40?41:f,l):n(f)}function l(f){return f===o?(e.enter(s),e.consume(f),e.exit(s),e.exit(r),t):(e.enter(i),c(f))}function c(f){return f===o?(e.exit(i),l(o)):f===null?n(f):_e(f)?(e.enter("lineEnding"),e.consume(f),e.exit("lineEnding"),Ye(e,c,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),u(f))}function u(f){return f===o||f===null||_e(f)?(e.exit("chunkString"),c(f)):(e.consume(f),f===92?d:u)}function d(f){return f===o||f===92?(e.consume(f),u):u(f)}}function Na(e,t){let n;return r;function r(s){return _e(s)?(e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),n=!0,r):Ge(s)?Ye(e,r,n?"linePrefix":"lineSuffix")(s):t(s)}}const UU={name:"definition",tokenize:VU},HU={partial:!0,tokenize:qU};function VU(e,t,n){const r=this;let s;return i;function i(p){return e.enter("definition"),o(p)}function o(p){return N1.call(r,e,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return s=yr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(e.enter("definitionMarker"),e.consume(p),e.exit("definitionMarker"),l):n(p)}function l(p){return pt(p)?Na(e,c)(p):c(p)}function c(p){return C1(e,u,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function u(p){return e.attempt(HU,d,d)(p)}function d(p){return Ge(p)?Ye(e,f,"whitespace")(p):f(p)}function f(p){return p===null||_e(p)?(e.exit("definition"),r.parser.defined.push(s),t(p)):n(p)}}function qU(e,t,n){return r;function r(a){return pt(a)?Na(e,s)(a):n(a)}function s(a){return _1(e,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Ge(a)?Ye(e,o,"whitespace")(a):o(a)}function o(a){return a===null||_e(a)?t(a):n(a)}}const WU={name:"hardBreakEscape",tokenize:KU};function KU(e,t,n){return r;function r(i){return e.enter("hardBreakEscape"),e.consume(i),s}function s(i){return _e(i)?(e.exit("hardBreakEscape"),t(i)):n(i)}}const GU={name:"headingAtx",resolve:JU,tokenize:ZU};function JU(e,t){let n=e.length-2,r=3,s,i;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(s={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},i={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},Wn(e,r,n-r+1,[["enter",s,t],["enter",i,t],["exit",i,t],["exit",s,t]])),e}function ZU(e,t,n){let r=0;return s;function s(u){return e.enter("atxHeading"),i(u)}function i(u){return e.enter("atxHeadingSequence"),o(u)}function o(u){return u===35&&r++<6?(e.consume(u),o):u===null||pt(u)?(e.exit("atxHeadingSequence"),a(u)):n(u)}function a(u){return u===35?(e.enter("atxHeadingSequence"),l(u)):u===null||_e(u)?(e.exit("atxHeading"),t(u)):Ge(u)?Ye(e,a,"whitespace")(u):(e.enter("atxHeadingText"),c(u))}function l(u){return u===35?(e.consume(u),l):(e.exit("atxHeadingSequence"),a(u))}function c(u){return u===null||u===35||pt(u)?(e.exit("atxHeadingText"),a(u)):(e.consume(u),c)}}const YU=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],Zx=["pre","script","style","textarea"],XU={concrete:!0,name:"htmlFlow",resolveTo:tH,tokenize:nH},QU={partial:!0,tokenize:sH},eH={partial:!0,tokenize:rH};function tH(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function nH(e,t,n){const r=this;let s,i,o,a,l;return c;function c(S){return u(S)}function u(S){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(S),d}function d(S){return S===33?(e.consume(S),f):S===47?(e.consume(S),i=!0,g):S===63?(e.consume(S),s=3,r.interrupt?t:_):kn(S)?(e.consume(S),o=String.fromCharCode(S),b):n(S)}function f(S){return S===45?(e.consume(S),s=2,p):S===91?(e.consume(S),s=5,a=0,m):kn(S)?(e.consume(S),s=4,r.interrupt?t:_):n(S)}function p(S){return S===45?(e.consume(S),r.interrupt?t:_):n(S)}function m(S){const B="CDATA[";return S===B.charCodeAt(a++)?(e.consume(S),a===B.length?r.interrupt?t:O:m):n(S)}function g(S){return kn(S)?(e.consume(S),o=String.fromCharCode(S),b):n(S)}function b(S){if(S===null||S===47||S===62||pt(S)){const B=S===47,$=o.toLowerCase();return!B&&!i&&Zx.includes($)?(s=1,r.interrupt?t(S):O(S)):YU.includes(o.toLowerCase())?(s=6,B?(e.consume(S),y):r.interrupt?t(S):O(S)):(s=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(S):i?w(S):v(S))}return S===45||pn(S)?(e.consume(S),o+=String.fromCharCode(S),b):n(S)}function y(S){return S===62?(e.consume(S),r.interrupt?t:O):n(S)}function w(S){return Ge(S)?(e.consume(S),w):T(S)}function v(S){return S===47?(e.consume(S),T):S===58||S===95||kn(S)?(e.consume(S),E):Ge(S)?(e.consume(S),v):T(S)}function E(S){return S===45||S===46||S===58||S===95||pn(S)?(e.consume(S),E):N(S)}function N(S){return S===61?(e.consume(S),k):Ge(S)?(e.consume(S),N):v(S)}function k(S){return S===null||S===60||S===61||S===62||S===96?n(S):S===34||S===39?(e.consume(S),l=S,C):Ge(S)?(e.consume(S),k):A(S)}function C(S){return S===l?(e.consume(S),l=null,R):S===null||_e(S)?n(S):(e.consume(S),C)}function A(S){return S===null||S===34||S===39||S===47||S===60||S===61||S===62||S===96||pt(S)?N(S):(e.consume(S),A)}function R(S){return S===47||S===62||Ge(S)?v(S):n(S)}function T(S){return S===62?(e.consume(S),I):n(S)}function I(S){return S===null||_e(S)?O(S):Ge(S)?(e.consume(S),I):n(S)}function O(S){return S===45&&s===2?(e.consume(S),q):S===60&&s===1?(e.consume(S),te):S===62&&s===4?(e.consume(S),ae):S===63&&s===3?(e.consume(S),_):S===93&&s===5?(e.consume(S),le):_e(S)&&(s===6||s===7)?(e.exit("htmlFlowData"),e.check(QU,me,j)(S)):S===null||_e(S)?(e.exit("htmlFlowData"),j(S)):(e.consume(S),O)}function j(S){return e.check(eH,L,me)(S)}function L(S){return e.enter("lineEnding"),e.consume(S),e.exit("lineEnding"),F}function F(S){return S===null||_e(S)?j(S):(e.enter("htmlFlowData"),O(S))}function q(S){return S===45?(e.consume(S),_):O(S)}function te(S){return S===47?(e.consume(S),o="",K):O(S)}function K(S){if(S===62){const B=o.toLowerCase();return Zx.includes(B)?(e.consume(S),ae):O(S)}return kn(S)&&o.length<8?(e.consume(S),o+=String.fromCharCode(S),K):O(S)}function le(S){return S===93?(e.consume(S),_):O(S)}function _(S){return S===62?(e.consume(S),ae):S===45&&s===2?(e.consume(S),_):O(S)}function ae(S){return S===null||_e(S)?(e.exit("htmlFlowData"),me(S)):(e.consume(S),ae)}function me(S){return e.exit("htmlFlow"),t(S)}}function rH(e,t,n){const r=this;return s;function s(o){return _e(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):n(o)}function i(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function sH(e,t,n){return r;function r(s){return e.enter("lineEnding"),e.consume(s),e.exit("lineEnding"),e.attempt(xl,t,n)}}const iH={name:"htmlText",tokenize:oH};function oH(e,t,n){const r=this;let s,i,o;return a;function a(_){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(_),l}function l(_){return _===33?(e.consume(_),c):_===47?(e.consume(_),N):_===63?(e.consume(_),v):kn(_)?(e.consume(_),A):n(_)}function c(_){return _===45?(e.consume(_),u):_===91?(e.consume(_),i=0,m):kn(_)?(e.consume(_),w):n(_)}function u(_){return _===45?(e.consume(_),p):n(_)}function d(_){return _===null?n(_):_===45?(e.consume(_),f):_e(_)?(o=d,te(_)):(e.consume(_),d)}function f(_){return _===45?(e.consume(_),p):d(_)}function p(_){return _===62?q(_):_===45?f(_):d(_)}function m(_){const ae="CDATA[";return _===ae.charCodeAt(i++)?(e.consume(_),i===ae.length?g:m):n(_)}function g(_){return _===null?n(_):_===93?(e.consume(_),b):_e(_)?(o=g,te(_)):(e.consume(_),g)}function b(_){return _===93?(e.consume(_),y):g(_)}function y(_){return _===62?q(_):_===93?(e.consume(_),y):g(_)}function w(_){return _===null||_===62?q(_):_e(_)?(o=w,te(_)):(e.consume(_),w)}function v(_){return _===null?n(_):_===63?(e.consume(_),E):_e(_)?(o=v,te(_)):(e.consume(_),v)}function E(_){return _===62?q(_):v(_)}function N(_){return kn(_)?(e.consume(_),k):n(_)}function k(_){return _===45||pn(_)?(e.consume(_),k):C(_)}function C(_){return _e(_)?(o=C,te(_)):Ge(_)?(e.consume(_),C):q(_)}function A(_){return _===45||pn(_)?(e.consume(_),A):_===47||_===62||pt(_)?R(_):n(_)}function R(_){return _===47?(e.consume(_),q):_===58||_===95||kn(_)?(e.consume(_),T):_e(_)?(o=R,te(_)):Ge(_)?(e.consume(_),R):q(_)}function T(_){return _===45||_===46||_===58||_===95||pn(_)?(e.consume(_),T):I(_)}function I(_){return _===61?(e.consume(_),O):_e(_)?(o=I,te(_)):Ge(_)?(e.consume(_),I):R(_)}function O(_){return _===null||_===60||_===61||_===62||_===96?n(_):_===34||_===39?(e.consume(_),s=_,j):_e(_)?(o=O,te(_)):Ge(_)?(e.consume(_),O):(e.consume(_),L)}function j(_){return _===s?(e.consume(_),s=void 0,F):_===null?n(_):_e(_)?(o=j,te(_)):(e.consume(_),j)}function L(_){return _===null||_===34||_===39||_===60||_===61||_===96?n(_):_===47||_===62||pt(_)?R(_):(e.consume(_),L)}function F(_){return _===47||_===62||pt(_)?R(_):n(_)}function q(_){return _===62?(e.consume(_),e.exit("htmlTextData"),e.exit("htmlText"),t):n(_)}function te(_){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(_),e.exit("lineEnding"),K}function K(_){return Ge(_)?Ye(e,le,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(_):le(_)}function le(_){return e.enter("htmlTextData"),o(_)}}const wg={name:"labelEnd",resolveAll:uH,resolveTo:dH,tokenize:fH},aH={tokenize:hH},lH={tokenize:pH},cH={tokenize:mH};function uH(e){let t=-1;const n=[];for(;++t<e.length;){const r=e[t][1];if(n.push(e[t]),r.type==="labelImage"||r.type==="labelLink"||r.type==="labelEnd"){const s=r.type==="labelImage"?4:2;r.type="data",t+=s}}return e.length!==n.length&&Wn(e,0,e.length,n),e}function dH(e,t){let n=e.length,r=0,s,i,o,a;for(;n--;)if(s=e[n][1],i){if(s.type==="link"||s.type==="labelLink"&&s._inactive)break;e[n][0]==="enter"&&s.type==="labelLink"&&(s._inactive=!0)}else if(o){if(e[n][0]==="enter"&&(s.type==="labelImage"||s.type==="labelLink")&&!s._balanced&&(i=n,s.type!=="labelLink")){r=2;break}}else s.type==="labelEnd"&&(o=n);const l={type:e[i][1].type==="labelLink"?"link":"image",start:{...e[i][1].start},end:{...e[e.length-1][1].end}},c={type:"label",start:{...e[i][1].start},end:{...e[o][1].end}},u={type:"labelText",start:{...e[i+r+2][1].end},end:{...e[o-2][1].start}};return a=[["enter",l,t],["enter",c,t]],a=nr(a,e.slice(i+1,i+r+3)),a=nr(a,[["enter",u,t]]),a=nr(a,Dd(t.parser.constructs.insideSpan.null,e.slice(i+r+4,o-3),t)),a=nr(a,[["exit",u,t],e[o-2],e[o-1],["exit",c,t]]),a=nr(a,e.slice(o+1)),a=nr(a,[["exit",l,t]]),Wn(e,i,e.length,a),e}function fH(e,t,n){const r=this;let s=r.events.length,i,o;for(;s--;)if((r.events[s][1].type==="labelImage"||r.events[s][1].type==="labelLink")&&!r.events[s][1]._balanced){i=r.events[s][1];break}return a;function a(f){return i?i._inactive?d(f):(o=r.parser.defined.includes(yr(r.sliceSerialize({start:i.end,end:r.now()}))),e.enter("labelEnd"),e.enter("labelMarker"),e.consume(f),e.exit("labelMarker"),e.exit("labelEnd"),l):n(f)}function l(f){return f===40?e.attempt(aH,u,o?u:d)(f):f===91?e.attempt(lH,u,o?c:d)(f):o?u(f):d(f)}function c(f){return e.attempt(cH,u,d)(f)}function u(f){return t(f)}function d(f){return i._balanced=!0,n(f)}}function hH(e,t,n){return r;function r(d){return e.enter("resource"),e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),s}function s(d){return pt(d)?Na(e,i)(d):i(d)}function i(d){return d===41?u(d):C1(e,o,a,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(d)}function o(d){return pt(d)?Na(e,l)(d):u(d)}function a(d){return n(d)}function l(d){return d===34||d===39||d===40?_1(e,c,n,"resourceTitle","resourceTitleMarker","resourceTitleString")(d):u(d)}function c(d){return pt(d)?Na(e,u)(d):u(d)}function u(d){return d===41?(e.enter("resourceMarker"),e.consume(d),e.exit("resourceMarker"),e.exit("resource"),t):n(d)}}function pH(e,t,n){const r=this;return s;function s(a){return N1.call(r,e,i,o,"reference","referenceMarker","referenceString")(a)}function i(a){return r.parser.defined.includes(yr(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)))?t(a):n(a)}function o(a){return n(a)}}function mH(e,t,n){return r;function r(i){return e.enter("reference"),e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),s}function s(i){return i===93?(e.enter("referenceMarker"),e.consume(i),e.exit("referenceMarker"),e.exit("reference"),t):n(i)}}const gH={name:"labelStartImage",resolveAll:wg.resolveAll,tokenize:bH};function bH(e,t,n){const r=this;return s;function s(a){return e.enter("labelImage"),e.enter("labelImageMarker"),e.consume(a),e.exit("labelImageMarker"),i}function i(a){return a===91?(e.enter("labelMarker"),e.consume(a),e.exit("labelMarker"),e.exit("labelImage"),o):n(a)}function o(a){return a===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(a):t(a)}}const yH={name:"labelStartLink",resolveAll:wg.resolveAll,tokenize:xH};function xH(e,t,n){const r=this;return s;function s(o){return e.enter("labelLink"),e.enter("labelMarker"),e.consume(o),e.exit("labelMarker"),e.exit("labelLink"),i}function i(o){return o===94&&"_hiddenFootnoteSupport"in r.parser.constructs?n(o):t(o)}}const eh={name:"lineEnding",tokenize:vH};function vH(e,t){return n;function n(r){return e.enter("lineEnding"),e.consume(r),e.exit("lineEnding"),Ye(e,t,"linePrefix")}}const gc={name:"thematicBreak",tokenize:wH};function wH(e,t,n){let r=0,s;return i;function i(c){return e.enter("thematicBreak"),o(c)}function o(c){return s=c,a(c)}function a(c){return c===s?(e.enter("thematicBreakSequence"),l(c)):r>=3&&(c===null||_e(c))?(e.exit("thematicBreak"),t(c)):n(c)}function l(c){return c===s?(e.consume(c),r++,l):(e.exit("thematicBreakSequence"),Ge(c)?Ye(e,a,"whitespace")(c):a(c))}}const Mn={continuation:{tokenize:CH},exit:_H,name:"list",tokenize:EH},kH={partial:!0,tokenize:TH},SH={partial:!0,tokenize:NH};function EH(e,t,n){const r=this,s=r.events[r.events.length-1];let i=s&&s[1].type==="linePrefix"?s[2].sliceSerialize(s[1],!0).length:0,o=0;return a;function a(p){const m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Cp(p)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),p===42||p===45?e.check(gc,n,c)(p):c(p);if(!r.interrupt||p===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(p)}return n(p)}function l(p){return Cp(p)&&++o<10?(e.consume(p),l):(!r.interrupt||o<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(e.exit("listItemValue"),c(p)):n(p)}function c(p){return e.enter("listItemMarker"),e.consume(p),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,e.check(xl,r.interrupt?n:u,e.attempt(kH,f,d))}function u(p){return r.containerState.initialBlankLine=!0,i++,f(p)}function d(p){return Ge(p)?(e.enter("listItemPrefixWhitespace"),e.consume(p),e.exit("listItemPrefixWhitespace"),f):n(p)}function f(p){return r.containerState.size=i+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(p)}}function CH(e,t,n){const r=this;return r.containerState._closeFlow=void 0,e.check(xl,s,i);function s(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,Ye(e,t,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!Ge(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(SH,t,o)(a))}function o(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,Ye(e,e.attempt(Mn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function NH(e,t,n){const r=this;return Ye(e,s,"listItemIndent",r.containerState.size+1);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(i):n(i)}}function _H(e){e.exit(this.containerState.type)}function TH(e,t,n){const r=this;return Ye(e,s,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function s(i){const o=r.events[r.events.length-1];return!Ge(i)&&o&&o[1].type==="listItemPrefixWhitespace"?t(i):n(i)}}const Yx={name:"setextUnderline",resolveTo:AH,tokenize:MH};function AH(e,t){let n=e.length,r,s,i;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(s=n)}else e[n][1].type==="content"&&e.splice(n,1),!i&&e[n][1].type==="definition"&&(i=n);const o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[s][1].type="setextHeadingText",i?(e.splice(s,0,["enter",o,t]),e.splice(i+1,0,["exit",e[r][1],t]),e[r][1].end={...e[i][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function MH(e,t,n){const r=this;let s;return i;function i(c){let u=r.events.length,d;for(;u--;)if(r.events[u][1].type!=="lineEnding"&&r.events[u][1].type!=="linePrefix"&&r.events[u][1].type!=="content"){d=r.events[u][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||d)?(e.enter("setextHeadingLine"),s=c,o(c)):n(c)}function o(c){return e.enter("setextHeadingLineSequence"),a(c)}function a(c){return c===s?(e.consume(c),a):(e.exit("setextHeadingLineSequence"),Ge(c)?Ye(e,l,"lineSuffix")(c):l(c))}function l(c){return c===null||_e(c)?(e.exit("setextHeadingLine"),t(c)):n(c)}}const RH={tokenize:OH};function OH(e){const t=this,n=e.attempt(xl,r,e.attempt(this.parser.constructs.flowInitial,s,Ye(e,e.attempt(this.parser.constructs.flow,s,e.attempt(jU,s)),"linePrefix")));return n;function r(i){if(i===null){e.consume(i);return}return e.enter("lineEndingBlank"),e.consume(i),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function s(i){if(i===null){e.consume(i);return}return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),t.currentConstruct=void 0,n}}const IH={resolveAll:A1()},DH=T1("string"),LH=T1("text");function T1(e){return{resolveAll:A1(e==="text"?PH:void 0),tokenize:t};function t(n){const r=this,s=this.parser.constructs[e],i=n.attempt(s,o,a);return o;function o(u){return c(u)?i(u):a(u)}function a(u){if(u===null){n.consume(u);return}return n.enter("data"),n.consume(u),l}function l(u){return c(u)?(n.exit("data"),i(u)):(n.consume(u),l)}function c(u){if(u===null)return!0;const d=s[u];let f=-1;if(d)for(;++f<d.length;){const p=d[f];if(!p.previous||p.previous.call(r,r.previous))return!0}return!1}}}function A1(e){return t;function t(n,r){let s=-1,i;for(;++s<=n.length;)i===void 0?n[s]&&n[s][1].type==="data"&&(i=s,s++):(!n[s]||n[s][1].type!=="data")&&(s!==i+2&&(n[i][1].end=n[s-1][1].end,n.splice(i+2,s-i-2),s=i+2),i=void 0);return e?e(n,r):n}}function PH(e,t){let n=0;for(;++n<=e.length;)if((n===e.length||e[n][1].type==="lineEnding")&&e[n-1][1].type==="data"){const r=e[n-1][1],s=t.sliceStream(r);let i=s.length,o=-1,a=0,l;for(;i--;){const c=s[i];if(typeof c=="string"){for(o=c.length;c.charCodeAt(o-1)===32;)a++,o--;if(o)break;o=-1}else if(c===-2)l=!0,a++;else if(c!==-1){i++;break}}if(t._contentTypeTextTrailing&&n===e.length&&(a=0),a){const c={type:n===e.length||l||a<2?"lineSuffix":"hardBreakTrailing",start:{_bufferIndex:i?o:r.start._bufferIndex+o,_index:r.start._index+i,line:r.end.line,column:r.end.column-a,offset:r.end.offset-a},end:{...r.end}};r.end={...c.start},r.start.offset===r.end.offset?Object.assign(r,c):(e.splice(n,0,["enter",c,t],["exit",c,t]),n+=2)}n++}return e}const jH={42:Mn,43:Mn,45:Mn,48:Mn,49:Mn,50:Mn,51:Mn,52:Mn,53:Mn,54:Mn,55:Mn,56:Mn,57:Mn,62:w1},zH={91:UU},FH={[-2]:Qf,[-1]:Qf,32:Qf},BH={35:GU,42:gc,45:[Yx,gc],60:XU,61:Yx,95:gc,96:Jx,126:Jx},$H={38:S1,92:k1},UH={[-5]:eh,[-4]:eh,[-3]:eh,33:gH,38:S1,42:Np,60:[yU,iH],91:yH,92:[WU,k1],93:wg,95:Np,96:RU},HH={null:[Np,IH]},VH={null:[42,95]},qH={null:[]},WH=Object.freeze(Object.defineProperty({__proto__:null,attentionMarkers:VH,contentInitial:zH,disable:qH,document:jH,flow:BH,flowInitial:FH,insideSpan:HH,string:$H,text:UH},Symbol.toStringTag,{value:"Module"}));function KH(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0};const s={},i=[];let o=[],a=[];const l={attempt:C(N),check:C(k),consume:w,enter:v,exit:E,interrupt:C(k,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:m,parser:e,previous:null,sliceSerialize:f,sliceStream:p,write:d};let u=t.tokenize.call(c,l);return t.resolveAll&&i.push(t),c;function d(I){return o=nr(o,I),b(),o[o.length-1]!==null?[]:(A(t,0),c.events=Dd(i,c.events,c),c.events)}function f(I,O){return JH(p(I),O)}function p(I){return GH(o,I)}function m(){const{_bufferIndex:I,_index:O,line:j,column:L,offset:F}=r;return{_bufferIndex:I,_index:O,line:j,column:L,offset:F}}function g(I){s[I.line]=I.column,T()}function b(){let I;for(;r._index<o.length;){const O=o[r._index];if(typeof O=="string")for(I=r._index,r._bufferIndex<0&&(r._bufferIndex=0);r._index===I&&r._bufferIndex<O.length;)y(O.charCodeAt(r._bufferIndex));else y(O)}}function y(I){u=u(I)}function w(I){_e(I)?(r.line++,r.column=1,r.offset+=I===-3?2:1,T()):I!==-1&&(r.column++,r.offset++),r._bufferIndex<0?r._index++:(r._bufferIndex++,r._bufferIndex===o[r._index].length&&(r._bufferIndex=-1,r._index++)),c.previous=I}function v(I,O){const j=O||{};return j.type=I,j.start=m(),c.events.push(["enter",j,c]),a.push(j),j}function E(I){const O=a.pop();return O.end=m(),c.events.push(["exit",O,c]),O}function N(I,O){A(I,O.from)}function k(I,O){O.restore()}function C(I,O){return j;function j(L,F,q){let te,K,le,_;return Array.isArray(L)?me(L):"tokenize"in L?me([L]):ae(L);function ae(D){return P;function P(W){const fe=W!==null&&D[W],ee=W!==null&&D.null,be=[...Array.isArray(fe)?fe:fe?[fe]:[],...Array.isArray(ee)?ee:ee?[ee]:[]];return me(be)(W)}}function me(D){return te=D,K=0,D.length===0?q:S(D[K])}function S(D){return P;function P(W){return _=R(),le=D,D.partial||(c.currentConstruct=D),D.name&&c.parser.constructs.disable.null.includes(D.name)?$():D.tokenize.call(O?Object.assign(Object.create(c),O):c,l,B,$)(W)}}function B(D){return I(le,_),F}function $(D){return _.restore(),++K<te.length?S(te[K]):q}}}function A(I,O){I.resolveAll&&!i.includes(I)&&i.push(I),I.resolve&&Wn(c.events,O,c.events.length-O,I.resolve(c.events.slice(O),c)),I.resolveTo&&(c.events=I.resolveTo(c.events,c))}function R(){const I=m(),O=c.previous,j=c.currentConstruct,L=c.events.length,F=Array.from(a);return{from:L,restore:q};function q(){r=I,c.previous=O,c.currentConstruct=j,c.events.length=L,a=F,T()}}function T(){r.line in s&&r.column<2&&(r.column=s[r.line],r.offset+=s[r.line]-1)}}function GH(e,t){const n=t.start._index,r=t.start._bufferIndex,s=t.end._index,i=t.end._bufferIndex;let o;if(n===s)o=[e[n].slice(r,i)];else{if(o=e.slice(n,s),r>-1){const a=o[0];typeof a=="string"?o[0]=a.slice(r):o.shift()}i>0&&o.push(e[s].slice(0,i))}return o}function JH(e,t){let n=-1;const r=[];let s;for(;++n<e.length;){const i=e[n];let o;if(typeof i=="string")o=i;else switch(i){case-5:{o="\r";break}case-4:{o=`
454
- `;break}case-3:{o=`\r
455
- `;break}case-2:{o=t?" ":" ";break}case-1:{if(!t&&s)continue;o=" ";break}default:o=String.fromCharCode(i)}s=i===-2,r.push(o)}return r.join("")}function ZH(e){const r={constructs:x1([WH,...(e||{}).extensions||[]]),content:s(dU),defined:[],document:s(hU),flow:s(RH),lazy:{},string:s(DH),text:s(LH)};return r;function s(i){return o;function o(a){return KH(r,i,a)}}}function YH(e){for(;!E1(e););return e}const Xx=/[\0\t\n\r]/g;function XH(){let e=1,t="",n=!0,r;return s;function s(i,o,a){const l=[];let c,u,d,f,p;for(i=t+(typeof i=="string"?i.toString():new TextDecoder(o||void 0).decode(i)),d=0,t="",n&&(i.charCodeAt(0)===65279&&d++,n=void 0);d<i.length;){if(Xx.lastIndex=d,c=Xx.exec(i),f=c&&c.index!==void 0?c.index:i.length,p=i.charCodeAt(f),!c){t=i.slice(d);break}if(p===10&&d===f&&r)l.push(-3),r=void 0;else switch(r&&(l.push(-5),r=void 0),d<f&&(l.push(i.slice(d,f)),e+=f-d),p){case 0:{l.push(65533),e++;break}case 9:{for(u=Math.ceil(e/4)*4,l.push(-2);e++<u;)l.push(-1);break}case 10:{l.push(-4),e=1;break}default:r=!0,e=1}d=f+1}return a&&(r&&l.push(-5),t&&l.push(t),l.push(null)),l}}const QH=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function eV(e){return e.replace(QH,tV)}function tV(e,t,n){if(t)return t;if(n.charCodeAt(0)===35){const s=n.charCodeAt(1),i=s===120||s===88;return v1(n.slice(i?2:1),i?16:10)}return vg(n)||e}const M1={}.hasOwnProperty;function nV(e,t,n){return typeof t!="string"&&(n=t,t=void 0),rV(n)(YH(ZH(n).document().write(XH()(e,t,!0))))}function rV(e){const t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(ie),autolinkProtocol:R,autolinkEmail:R,atxHeading:i(ce),blockQuote:i(ee),characterEscape:R,characterReference:R,codeFenced:i(be),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(be,o),codeText:i(Me,o),codeTextData:R,data:R,codeFlowValue:R,definition:i(Le),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(Ke),hardBreakEscape:i(ne),hardBreakTrailing:i(ne),htmlFlow:i(et,o),htmlFlowData:R,htmlText:i(et,o),htmlTextData:R,image:i(We),label:o,link:i(ie),listItem:i(it),listItemValue:f,listOrdered:i(je,d),listUnordered:i(je),paragraph:i(tt),reference:S,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(ce),strong:i(Gn),thematicBreak:i(us)},exit:{atxHeading:l(),atxHeadingSequence:N,autolink:l(),autolinkEmail:fe,autolinkProtocol:W,blockQuote:l(),characterEscapeValue:T,characterReferenceMarkerHexadecimal:$,characterReferenceMarkerNumeric:$,characterReferenceValue:D,characterReference:P,codeFenced:l(b),codeFencedFence:g,codeFencedFenceInfo:p,codeFencedFenceMeta:m,codeFlowValue:T,codeIndented:l(y),codeText:l(F),codeTextData:T,data:T,definition:l(),definitionDestinationString:E,definitionLabelString:w,definitionTitleString:v,emphasis:l(),hardBreakEscape:l(O),hardBreakTrailing:l(O),htmlFlow:l(j),htmlFlowData:T,htmlText:l(L),htmlTextData:T,image:l(te),label:le,labelText:K,lineEnding:I,link:l(q),listItem:l(),listOrdered:l(),listUnordered:l(),paragraph:l(),referenceString:B,resourceDestinationString:_,resourceTitleString:ae,resource:me,setextHeading:l(A),setextHeadingLineSequence:C,setextHeadingText:k,strong:l(),thematicBreak:l()}};R1(t,(e||{}).mdastExtensions||[]);const n={};return r;function r(U){let G={type:"root",children:[]};const Se={stack:[G],tokenStack:[],config:t,enter:a,exit:c,buffer:o,resume:u,data:n},Ie=[];let Ze=-1;for(;++Ze<U.length;)if(U[Ze][1].type==="listOrdered"||U[Ze][1].type==="listUnordered")if(U[Ze][0]==="enter")Ie.push(Ze);else{const Ct=Ie.pop();Ze=s(U,Ct,Ze)}for(Ze=-1;++Ze<U.length;){const Ct=t[U[Ze][0]];M1.call(Ct,U[Ze][1].type)&&Ct[U[Ze][1].type].call(Object.assign({sliceSerialize:U[Ze][2].sliceSerialize},Se),U[Ze][1])}if(Se.tokenStack.length>0){const Ct=Se.tokenStack[Se.tokenStack.length-1];(Ct[1]||Qx).call(Se,void 0,Ct[0])}for(G.position={start:gs(U.length>0?U[0][1].start:{line:1,column:1,offset:0}),end:gs(U.length>0?U[U.length-2][1].end:{line:1,column:1,offset:0})},Ze=-1;++Ze<t.transforms.length;)G=t.transforms[Ze](G)||G;return G}function s(U,G,Se){let Ie=G-1,Ze=-1,Ct=!1,An,zn,Sr,dr;for(;++Ie<=Se;){const Jt=U[Ie];switch(Jt[1].type){case"listUnordered":case"listOrdered":case"blockQuote":{Jt[0]==="enter"?Ze++:Ze--,dr=void 0;break}case"lineEndingBlank":{Jt[0]==="enter"&&(An&&!dr&&!Ze&&!Sr&&(Sr=Ie),dr=void 0);break}case"linePrefix":case"listItemValue":case"listItemMarker":case"listItemPrefix":case"listItemPrefixWhitespace":break;default:dr=void 0}if(!Ze&&Jt[0]==="enter"&&Jt[1].type==="listItemPrefix"||Ze===-1&&Jt[0]==="exit"&&(Jt[1].type==="listUnordered"||Jt[1].type==="listOrdered")){if(An){let Er=Ie;for(zn=void 0;Er--;){const on=U[Er];if(on[1].type==="lineEnding"||on[1].type==="lineEndingBlank"){if(on[0]==="exit")continue;zn&&(U[zn][1].type="lineEndingBlank",Ct=!0),on[1].type="lineEnding",zn=Er}else if(!(on[1].type==="linePrefix"||on[1].type==="blockQuotePrefix"||on[1].type==="blockQuotePrefixWhitespace"||on[1].type==="blockQuoteMarker"||on[1].type==="listItemIndent"))break}Sr&&(!zn||Sr<zn)&&(An._spread=!0),An.end=Object.assign({},zn?U[zn][1].start:Jt[1].end),U.splice(zn||Ie,0,["exit",An,Jt[2]]),Ie++,Se++}if(Jt[1].type==="listItemPrefix"){const Er={type:"listItem",_spread:!1,start:Object.assign({},Jt[1].start),end:void 0};An=Er,U.splice(Ie,0,["enter",Er,Jt[2]]),Ie++,Se++,Sr=void 0,dr=!0}}}return U[G][1]._spread=Ct,Se}function i(U,G){return Se;function Se(Ie){a.call(this,U(Ie),Ie),G&&G.call(this,Ie)}}function o(){this.stack.push({type:"fragment",children:[]})}function a(U,G,Se){this.stack[this.stack.length-1].children.push(U),this.stack.push(U),this.tokenStack.push([G,Se||void 0]),U.position={start:gs(G.start),end:void 0}}function l(U){return G;function G(Se){U&&U.call(this,Se),c.call(this,Se)}}function c(U,G){const Se=this.stack.pop(),Ie=this.tokenStack.pop();if(Ie)Ie[0].type!==U.type&&(G?G.call(this,U,Ie[0]):(Ie[1]||Qx).call(this,U,Ie[0]));else throw new Error("Cannot close `"+U.type+"` ("+Ca({start:U.start,end:U.end})+"): it’s not open");Se.position.end=gs(U.end)}function u(){return xg(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function f(U){if(this.data.expectingFirstListItemValue){const G=this.stack[this.stack.length-2];G.start=Number.parseInt(this.sliceSerialize(U),10),this.data.expectingFirstListItemValue=void 0}}function p(){const U=this.resume(),G=this.stack[this.stack.length-1];G.lang=U}function m(){const U=this.resume(),G=this.stack[this.stack.length-1];G.meta=U}function g(){this.data.flowCodeInside||(this.buffer(),this.data.flowCodeInside=!0)}function b(){const U=this.resume(),G=this.stack[this.stack.length-1];G.value=U.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function y(){const U=this.resume(),G=this.stack[this.stack.length-1];G.value=U.replace(/(\r?\n|\r)$/g,"")}function w(U){const G=this.resume(),Se=this.stack[this.stack.length-1];Se.label=G,Se.identifier=yr(this.sliceSerialize(U)).toLowerCase()}function v(){const U=this.resume(),G=this.stack[this.stack.length-1];G.title=U}function E(){const U=this.resume(),G=this.stack[this.stack.length-1];G.url=U}function N(U){const G=this.stack[this.stack.length-1];if(!G.depth){const Se=this.sliceSerialize(U).length;G.depth=Se}}function k(){this.data.setextHeadingSlurpLineEnding=!0}function C(U){const G=this.stack[this.stack.length-1];G.depth=this.sliceSerialize(U).codePointAt(0)===61?1:2}function A(){this.data.setextHeadingSlurpLineEnding=void 0}function R(U){const Se=this.stack[this.stack.length-1].children;let Ie=Se[Se.length-1];(!Ie||Ie.type!=="text")&&(Ie=jn(),Ie.position={start:gs(U.start),end:void 0},Se.push(Ie)),this.stack.push(Ie)}function T(U){const G=this.stack.pop();G.value+=this.sliceSerialize(U),G.position.end=gs(U.end)}function I(U){const G=this.stack[this.stack.length-1];if(this.data.atHardBreak){const Se=G.children[G.children.length-1];Se.position.end=gs(U.end),this.data.atHardBreak=void 0;return}!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(G.type)&&(R.call(this,U),T.call(this,U))}function O(){this.data.atHardBreak=!0}function j(){const U=this.resume(),G=this.stack[this.stack.length-1];G.value=U}function L(){const U=this.resume(),G=this.stack[this.stack.length-1];G.value=U}function F(){const U=this.resume(),G=this.stack[this.stack.length-1];G.value=U}function q(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=G,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function te(){const U=this.stack[this.stack.length-1];if(this.data.inReference){const G=this.data.referenceType||"shortcut";U.type+="Reference",U.referenceType=G,delete U.url,delete U.title}else delete U.identifier,delete U.label;this.data.referenceType=void 0}function K(U){const G=this.sliceSerialize(U),Se=this.stack[this.stack.length-2];Se.label=eV(G),Se.identifier=yr(G).toLowerCase()}function le(){const U=this.stack[this.stack.length-1],G=this.resume(),Se=this.stack[this.stack.length-1];if(this.data.inReference=!0,Se.type==="link"){const Ie=U.children;Se.children=Ie}else Se.alt=G}function _(){const U=this.resume(),G=this.stack[this.stack.length-1];G.url=U}function ae(){const U=this.resume(),G=this.stack[this.stack.length-1];G.title=U}function me(){this.data.inReference=void 0}function S(){this.data.referenceType="collapsed"}function B(U){const G=this.resume(),Se=this.stack[this.stack.length-1];Se.label=G,Se.identifier=yr(this.sliceSerialize(U)).toLowerCase(),this.data.referenceType="full"}function $(U){this.data.characterReferenceType=U.type}function D(U){const G=this.sliceSerialize(U),Se=this.data.characterReferenceType;let Ie;Se?(Ie=v1(G,Se==="characterReferenceMarkerNumeric"?10:16),this.data.characterReferenceType=void 0):Ie=vg(G);const Ze=this.stack[this.stack.length-1];Ze.value+=Ie}function P(U){const G=this.stack.pop();G.position.end=gs(U.end)}function W(U){T.call(this,U);const G=this.stack[this.stack.length-1];G.url=this.sliceSerialize(U)}function fe(U){T.call(this,U);const G=this.stack[this.stack.length-1];G.url="mailto:"+this.sliceSerialize(U)}function ee(){return{type:"blockquote",children:[]}}function be(){return{type:"code",lang:null,meta:null,value:""}}function Me(){return{type:"inlineCode",value:""}}function Le(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function Ke(){return{type:"emphasis",children:[]}}function ce(){return{type:"heading",depth:0,children:[]}}function ne(){return{type:"break"}}function et(){return{type:"html",value:""}}function We(){return{type:"image",title:null,url:"",alt:null}}function ie(){return{type:"link",title:null,url:"",children:[]}}function je(U){return{type:"list",ordered:U.type==="listOrdered",start:null,spread:U._spread,children:[]}}function it(U){return{type:"listItem",spread:U._spread,checked:null,children:[]}}function tt(){return{type:"paragraph",children:[]}}function Gn(){return{type:"strong",children:[]}}function jn(){return{type:"text",value:""}}function us(){return{type:"thematicBreak"}}}function gs(e){return{line:e.line,column:e.column,offset:e.offset}}function R1(e,t){let n=-1;for(;++n<t.length;){const r=t[n];Array.isArray(r)?R1(e,r):sV(e,r)}}function sV(e,t){let n;for(n in t)if(M1.call(t,n))switch(n){case"canContainEols":{const r=t[n];r&&e[n].push(...r);break}case"transforms":{const r=t[n];r&&e[n].push(...r);break}case"enter":case"exit":{const r=t[n];r&&Object.assign(e[n],r);break}}}function Qx(e,t){throw e?new Error("Cannot close `"+e.type+"` ("+Ca({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Ca({start:t.start,end:t.end})+") is open"):new Error("Cannot close document, a token (`"+t.type+"`, "+Ca({start:t.start,end:t.end})+") is still open")}function O1(e){const t=this;t.parser=n;function n(r){return nV(r,{...t.data("settings"),...e,extensions:t.data("micromarkExtensions")||[],mdastExtensions:t.data("fromMarkdownExtensions")||[]})}}function ku(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function iV(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}const Ld=(function(e){if(e==null)return cV;if(typeof e=="function")return Pd(e);if(typeof e=="object")return Array.isArray(e)?oV(e):aV(e);if(typeof e=="string")return lV(e);throw new Error("Expected function, string, or object as test")});function oV(e){const t=[];let n=-1;for(;++n<e.length;)t[n]=Ld(e[n]);return Pd(r);function r(...s){let i=-1;for(;++i<t.length;)if(t[i].apply(this,s))return!0;return!1}}function aV(e){const t=e;return Pd(n);function n(r){const s=r;let i;for(i in e)if(s[i]!==t[i])return!1;return!0}}function lV(e){return Pd(t);function t(n){return n&&n.type===e}}function Pd(e){return t;function t(n,r,s){return!!(uV(n)&&e.call(this,n,typeof r=="number"?r:void 0,s||void 0))}}function cV(){return!0}function uV(e){return e!==null&&typeof e=="object"&&"type"in e}const I1=[],dV=!0,_p=!1,fV="skip";function D1(e,t,n,r){let s;typeof t=="function"&&typeof n!="function"?(r=n,n=t):s=t;const i=Ld(s),o=r?-1:1;a(e,void 0,[])();function a(l,c,u){const d=l&&typeof l=="object"?l:{};if(typeof d.type=="string"){const p=typeof d.tagName=="string"?d.tagName:typeof d.name=="string"?d.name:void 0;Object.defineProperty(f,"name",{value:"node ("+(l.type+(p?"<"+p+">":""))+")"})}return f;function f(){let p=I1,m,g,b;if((!t||i(l,c,u[u.length-1]||void 0))&&(p=hV(n(l,u)),p[0]===_p))return p;if("children"in l&&l.children){const y=l;if(y.children&&p[0]!==fV)for(g=(r?y.children.length:-1)+o,b=u.concat(y);g>-1&&g<y.children.length;){const w=y.children[g];if(m=a(w,g,b)(),m[0]===_p)return m;g=typeof m[1]=="number"?m[1]:g+o}}return p}}}function hV(e){return Array.isArray(e)?e:typeof e=="number"?[dV,e]:e==null?I1:[e]}function pV(e,t,n){const s=Ld((n||{}).ignore||[]),i=mV(t);let o=-1;for(;++o<i.length;)D1(e,"text",a);function a(c,u){let d=-1,f;for(;++d<u.length;){const p=u[d],m=f?f.children:void 0;if(s(p,m?m.indexOf(p):void 0,f))return;f=p}if(f)return l(c,u)}function l(c,u){const d=u[u.length-1],f=i[o][0],p=i[o][1];let m=0;const b=d.children.indexOf(c);let y=!1,w=[];f.lastIndex=0;let v=f.exec(c.value);for(;v;){const E=v.index,N={index:v.index,input:v.input,stack:[...u,c]};let k=p(...v,N);if(typeof k=="string"&&(k=k.length>0?{type:"text",value:k}:void 0),k===!1?f.lastIndex=E+1:(m!==E&&w.push({type:"text",value:c.value.slice(m,E)}),Array.isArray(k)?w.push(...k):k&&w.push(k),m=E+v[0].length,y=!0),!f.global)break;v=f.exec(c.value)}return y?(m<c.value.length&&w.push({type:"text",value:c.value.slice(m)}),d.children.splice(b,1,...w)):w=[c],b+w.length}}function mV(e){const t=[];if(!Array.isArray(e))throw new TypeError("Expected find and replace tuple or list of tuples");const n=!e[0]||Array.isArray(e[0])?e:[e];let r=-1;for(;++r<n.length;){const s=n[r];t.push([gV(s[0]),bV(s[1])])}return t}function gV(e){return typeof e=="string"?new RegExp(iV(e),"g"):e}function bV(e){return typeof e=="function"?e:function(){return e}}const th="phrasing",nh=["autolink","link","image","label"];function yV(){return{transforms:[CV],enter:{literalAutolink:vV,literalAutolinkEmail:rh,literalAutolinkHttp:rh,literalAutolinkWww:rh},exit:{literalAutolink:EV,literalAutolinkEmail:SV,literalAutolinkHttp:wV,literalAutolinkWww:kV}}}function xV(){return{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:th,notInConstruct:nh},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:th,notInConstruct:nh},{character:":",before:"[ps]",after:"\\/",inConstruct:th,notInConstruct:nh}]}}function vV(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function rh(e){this.config.enter.autolinkProtocol.call(this,e)}function wV(e){this.config.exit.autolinkProtocol.call(this,e)}function kV(e){this.config.exit.data.call(this,e);const t=this.stack[this.stack.length-1];t.type,t.url="http://"+this.sliceSerialize(e)}function SV(e){this.config.exit.autolinkEmail.call(this,e)}function EV(e){this.exit(e)}function CV(e){pV(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,NV],[new RegExp("(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)","gu"),_V]],{ignore:["link","linkReference"]})}function NV(e,t,n,r,s){let i="";if(!L1(s)||(/^w/i.test(t)&&(n=t+n,t="",i="http://"),!TV(n)))return!1;const o=AV(n+r);if(!o[0])return!1;const a={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};return o[1]?[a,{type:"text",value:o[1]}]:a}function _V(e,t,n,r){return!L1(r,!0)||/[-\d_]$/.test(n)?!1:{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function TV(e){const t=e.split(".");return!(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))}function AV(e){const t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")");const s=ku(e,"(");let i=ku(e,")");for(;r!==-1&&s>i;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),i++;return[e,n]}function L1(e,t){const n=e.input.charCodeAt(e.index-1);return(e.index===0||Ii(n)||Id(n))&&(!t||n!==47)}P1.peek=zV;function MV(){this.buffer()}function RV(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function OV(){this.buffer()}function IV(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function DV(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=yr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function LV(e){this.exit(e)}function PV(e){const t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=yr(this.sliceSerialize(e)).toLowerCase(),n.label=t}function jV(e){this.exit(e)}function zV(){return"["}function P1(e,t,n,r){const s=n.createTracker(r);let i=s.move("[^");const o=n.enter("footnoteReference"),a=n.enter("reference");return i+=s.move(n.safe(n.associationId(e),{after:"]",before:i})),a(),o(),i+=s.move("]"),i}function FV(){return{enter:{gfmFootnoteCallString:MV,gfmFootnoteCall:RV,gfmFootnoteDefinitionLabelString:OV,gfmFootnoteDefinition:IV},exit:{gfmFootnoteCallString:DV,gfmFootnoteCall:LV,gfmFootnoteDefinitionLabelString:PV,gfmFootnoteDefinition:jV}}}function BV(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:P1},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,s,i,o){const a=i.createTracker(o);let l=a.move("[^");const c=i.enter("footnoteDefinition"),u=i.enter("label");return l+=a.move(i.safe(i.associationId(r),{before:l,after:"]"})),u(),l+=a.move("]:"),r.children&&r.children.length>0&&(a.shift(4),l+=a.move((t?`
456
- `:" ")+i.indentLines(i.containerFlow(r,a.current()),t?j1:$V))),c(),l}}function $V(e,t,n){return t===0?e:j1(e,t,n)}function j1(e,t,n){return(n?"":" ")+e}const UV=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];z1.peek=KV;function HV(){return{canContainEols:["delete"],enter:{strikethrough:qV},exit:{strikethrough:WV}}}function VV(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:UV}],handlers:{delete:z1}}}function qV(e){this.enter({type:"delete",children:[]},e)}function WV(e){this.exit(e)}function z1(e,t,n,r){const s=n.createTracker(r),i=n.enter("strikethrough");let o=s.move("~~");return o+=n.containerPhrasing(e,{...s.current(),before:o,after:"~"}),o+=s.move("~~"),i(),o}function KV(){return"~"}function GV(e){return e.length}function JV(e,t){const n=t||{},r=(n.align||[]).concat(),s=n.stringLength||GV,i=[],o=[],a=[],l=[];let c=0,u=-1;for(;++u<e.length;){const g=[],b=[];let y=-1;for(e[u].length>c&&(c=e[u].length);++y<e[u].length;){const w=ZV(e[u][y]);if(n.alignDelimiters!==!1){const v=s(w);b[y]=v,(l[y]===void 0||v>l[y])&&(l[y]=v)}g.push(w)}o[u]=g,a[u]=b}let d=-1;if(typeof r=="object"&&"length"in r)for(;++d<c;)i[d]=ev(r[d]);else{const g=ev(r);for(;++d<c;)i[d]=g}d=-1;const f=[],p=[];for(;++d<c;){const g=i[d];let b="",y="";g===99?(b=":",y=":"):g===108?b=":":g===114&&(y=":");let w=n.alignDelimiters===!1?1:Math.max(1,l[d]-b.length-y.length);const v=b+"-".repeat(w)+y;n.alignDelimiters!==!1&&(w=b.length+w+y.length,w>l[d]&&(l[d]=w),p[d]=w),f[d]=v}o.splice(1,0,f),a.splice(1,0,p),u=-1;const m=[];for(;++u<o.length;){const g=o[u],b=a[u];d=-1;const y=[];for(;++d<c;){const w=g[d]||"";let v="",E="";if(n.alignDelimiters!==!1){const N=l[d]-(b[d]||0),k=i[d];k===114?v=" ".repeat(N):k===99?N%2?(v=" ".repeat(N/2+.5),E=" ".repeat(N/2-.5)):(v=" ".repeat(N/2),E=v):E=" ".repeat(N)}n.delimiterStart!==!1&&!d&&y.push("|"),n.padding!==!1&&!(n.alignDelimiters===!1&&w==="")&&(n.delimiterStart!==!1||d)&&y.push(" "),n.alignDelimiters!==!1&&y.push(v),y.push(w),n.alignDelimiters!==!1&&y.push(E),n.padding!==!1&&y.push(" "),(n.delimiterEnd!==!1||d!==c-1)&&y.push("|")}m.push(n.delimiterEnd===!1?y.join("").replace(/ +$/,""):y.join(""))}return m.join(`
457
- `)}function ZV(e){return e==null?"":String(e)}function ev(e){const t=typeof e=="string"?e.codePointAt(0):0;return t===67||t===99?99:t===76||t===108?108:t===82||t===114?114:0}const tv={}.hasOwnProperty;function YV(e,t){const n=t||{};function r(s,...i){let o=r.invalid;const a=r.handlers;if(s&&tv.call(s,e)){const l=String(s[e]);o=tv.call(a,l)?a[l]:r.unknown}if(o)return o.call(this,s,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}function XV(e,t,n,r){const s=n.enter("blockquote"),i=n.createTracker(r);i.move("> "),i.shift(2);const o=n.indentLines(n.containerFlow(e,i.current()),QV);return s(),o}function QV(e,t,n){return">"+(n?"":" ")+e}function e5(e,t){return nv(e,t.inConstruct,!0)&&!nv(e,t.notInConstruct,!1)}function nv(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r<t.length;)if(e.includes(t[r]))return!0;return!1}function rv(e,t,n,r){let s=-1;for(;++s<n.unsafe.length;)if(n.unsafe[s].character===`
458
- `&&e5(n.stack,n.unsafe[s]))return/[ \t]/.test(r.before)?"":" ";return`\\
459
- `}function t5(e,t){const n=String(e);let r=n.indexOf(t),s=r,i=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===s?++i>o&&(o=i):i=1,s=r+t.length,r=n.indexOf(t,s);return o}function n5(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function r5(e){const t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function s5(e,t,n,r){const s=r5(n),i=e.value||"",o=s==="`"?"GraveAccent":"Tilde";if(n5(e,n)){const d=n.enter("codeIndented"),f=n.indentLines(i,i5);return d(),f}const a=n.createTracker(r),l=s.repeat(Math.max(t5(i,s)+1,3)),c=n.enter("codeFenced");let u=a.move(l);if(e.lang){const d=n.enter(`codeFencedLang${o}`);u+=a.move(n.safe(e.lang,{before:u,after:" ",encode:["`"],...a.current()})),d()}if(e.lang&&e.meta){const d=n.enter(`codeFencedMeta${o}`);u+=a.move(" "),u+=a.move(n.safe(e.meta,{before:u,after:`
460
- `,encode:["`"],...a.current()})),d()}return u+=a.move(`
461
- `),i&&(u+=a.move(i+`
462
- `)),u+=a.move(l),c(),u}function i5(e,t,n){return(n?"":" ")+e}function kg(e){const t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function o5(e,t,n,r){const s=kg(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("definition");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("[");return c+=l.move(n.safe(n.associationId(e),{before:c,after:"]",...l.current()})),c+=l.move("]: "),a(),!e.url||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":`
463
- `,...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+s),c+=l.move(n.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),a()),o(),c}function a5(e){const t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Ka(e){return"&#x"+e.toString(16).toUpperCase()+";"}function Su(e,t,n){const r=To(e),s=To(t);return r===void 0?s===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:s===void 0?{inside:!1,outside:!1}:s===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}F1.peek=l5;function F1(e,t,n,r){const s=a5(n),i=n.enter("emphasis"),o=n.createTracker(r),a=o.move(s);let l=o.move(n.containerPhrasing(e,{after:s,before:a,...o.current()}));const c=l.charCodeAt(0),u=Su(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=Ka(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=Su(r.after.charCodeAt(0),d,s);f.inside&&(l=l.slice(0,-1)+Ka(d));const p=o.move(s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function l5(e,t,n){return n.options.emphasis||"*"}function Sg(e,t,n,r){let s,i,o;typeof t=="function"&&typeof n!="function"?(i=void 0,o=t,s=n):(i=t,o=n,s=r),D1(e,i,a,s);function a(l,c){const u=c[c.length-1],d=u?u.children.indexOf(l):void 0;return o(l,d,u)}}function c5(e,t){let n=!1;return Sg(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,_p}),!!((!e.depth||e.depth<3)&&xg(e)&&(t.options.setext||n))}function u5(e,t,n,r){const s=Math.max(Math.min(6,e.depth||1),1),i=n.createTracker(r);if(c5(e,n)){const u=n.enter("headingSetext"),d=n.enter("phrasing"),f=n.containerPhrasing(e,{...i.current(),before:`
464
- `,after:`
465
- `});return d(),u(),f+`
466
- `+(s===1?"=":"-").repeat(f.length-(Math.max(f.lastIndexOf("\r"),f.lastIndexOf(`
467
- `))+1))}const o="#".repeat(s),a=n.enter("headingAtx"),l=n.enter("phrasing");i.move(o+" ");let c=n.containerPhrasing(e,{before:"# ",after:`
468
- `,...i.current()});return/^[\t ]/.test(c)&&(c=Ka(c.charCodeAt(0))+c.slice(1)),c=c?o+" "+c:o,n.options.closeAtx&&(c+=" "+o),l(),a(),c}B1.peek=d5;function B1(e){return e.value||""}function d5(){return"<"}$1.peek=f5;function $1(e,t,n,r){const s=kg(n),i=s==='"'?"Quote":"Apostrophe",o=n.enter("image");let a=n.enter("label");const l=n.createTracker(r);let c=l.move("![");return c+=l.move(n.safe(e.alt,{before:c,after:"]",...l.current()})),c+=l.move("]("),a(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(a=n.enter("destinationLiteral"),c+=l.move("<"),c+=l.move(n.safe(e.url,{before:c,after:">",...l.current()})),c+=l.move(">")):(a=n.enter("destinationRaw"),c+=l.move(n.safe(e.url,{before:c,after:e.title?" ":")",...l.current()}))),a(),e.title&&(a=n.enter(`title${i}`),c+=l.move(" "+s),c+=l.move(n.safe(e.title,{before:c,after:s,...l.current()})),c+=l.move(s),a()),c+=l.move(")"),o(),c}function f5(){return"!"}U1.peek=h5;function U1(e,t,n,r){const s=e.referenceType,i=n.enter("imageReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("![");const c=n.safe(e.alt,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=u,i(),s==="full"||!c||c!==d?l+=a.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function h5(){return"!"}H1.peek=p5;function H1(e,t,n){let r=e.value||"",s="`",i=-1;for(;new RegExp("(^|[^`])"+s+"([^`]|$)").test(r);)s+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++i<n.unsafe.length;){const o=n.unsafe[i],a=n.compilePattern(o);let l;if(o.atBreak)for(;l=a.exec(r);){let c=l.index;r.charCodeAt(c)===10&&r.charCodeAt(c-1)===13&&c--,r=r.slice(0,c)+" "+r.slice(l.index+1)}}return s+r+s}function p5(){return"`"}function V1(e,t){const n=xg(e);return!!(!t.options.resourceLink&&e.url&&!e.title&&e.children&&e.children.length===1&&e.children[0].type==="text"&&(n===e.url||"mailto:"+n===e.url)&&/^[a-z][a-z+.-]+:/i.test(e.url)&&!/[\0- <>\u007F]/.test(e.url))}q1.peek=m5;function q1(e,t,n,r){const s=kg(n),i=s==='"'?"Quote":"Apostrophe",o=n.createTracker(r);let a,l;if(V1(e,n)){const u=n.stack;n.stack=[],a=n.enter("autolink");let d=o.move("<");return d+=o.move(n.containerPhrasing(e,{before:d,after:">",...o.current()})),d+=o.move(">"),a(),n.stack=u,d}a=n.enter("link"),l=n.enter("label");let c=o.move("[");return c+=o.move(n.containerPhrasing(e,{before:c,after:"](",...o.current()})),c+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),c+=o.move("<"),c+=o.move(n.safe(e.url,{before:c,after:">",...o.current()})),c+=o.move(">")):(l=n.enter("destinationRaw"),c+=o.move(n.safe(e.url,{before:c,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${i}`),c+=o.move(" "+s),c+=o.move(n.safe(e.title,{before:c,after:s,...o.current()})),c+=o.move(s),l()),c+=o.move(")"),a(),c}function m5(e,t,n){return V1(e,n)?"<":"["}W1.peek=g5;function W1(e,t,n,r){const s=e.referenceType,i=n.enter("linkReference");let o=n.enter("label");const a=n.createTracker(r);let l=a.move("[");const c=n.containerPhrasing(e,{before:l,after:"]",...a.current()});l+=a.move(c+"]["),o();const u=n.stack;n.stack=[],o=n.enter("reference");const d=n.safe(n.associationId(e),{before:l,after:"]",...a.current()});return o(),n.stack=u,i(),s==="full"||!c||c!==d?l+=a.move(d+"]"):s==="shortcut"?l=l.slice(0,-1):l+=a.move("]"),l}function g5(){return"["}function Eg(e){const t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function b5(e){const t=Eg(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function y5(e){const t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function K1(e){const t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function x5(e,t,n,r){const s=n.enter("list"),i=n.bulletCurrent;let o=e.ordered?y5(n):Eg(n);const a=e.ordered?o==="."?")":".":b5(n);let l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){const u=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&u&&(!u.children||!u.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),K1(n)===o&&u){let d=-1;for(;++d<e.children.length;){const f=e.children[d];if(f&&f.type==="listItem"&&f.children&&f.children[0]&&f.children[0].type==="thematicBreak"){l=!0;break}}}}l&&(o=a),n.bulletCurrent=o;const c=n.containerFlow(e,r);return n.bulletLastUsed=o,n.bulletCurrent=i,s(),c}function v5(e){const t=e.options.listItemIndent||"one";if(t!=="tab"&&t!=="one"&&t!=="mixed")throw new Error("Cannot serialize items with `"+t+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return t}function w5(e,t,n,r){const s=v5(n);let i=n.bulletCurrent||Eg(n);t&&t.type==="list"&&t.ordered&&(i=(typeof t.start=="number"&&t.start>-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+i);let o=i.length+1;(s==="tab"||s==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);const a=n.createTracker(r);a.move(i+" ".repeat(o-i.length)),a.shift(o);const l=n.enter("listItem"),c=n.indentLines(n.containerFlow(e,a.current()),u);return l(),c;function u(d,f,p){return f?(p?"":" ".repeat(o))+d:(p?i:i+" ".repeat(o-i.length))+d}}function k5(e,t,n,r){const s=n.enter("paragraph"),i=n.enter("phrasing"),o=n.containerPhrasing(e,r);return i(),s(),o}const S5=Ld(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function E5(e,t,n,r){return(e.children.some(function(o){return S5(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function C5(e){const t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}G1.peek=N5;function G1(e,t,n,r){const s=C5(n),i=n.enter("strong"),o=n.createTracker(r),a=o.move(s+s);let l=o.move(n.containerPhrasing(e,{after:s,before:a,...o.current()}));const c=l.charCodeAt(0),u=Su(r.before.charCodeAt(r.before.length-1),c,s);u.inside&&(l=Ka(c)+l.slice(1));const d=l.charCodeAt(l.length-1),f=Su(r.after.charCodeAt(0),d,s);f.inside&&(l=l.slice(0,-1)+Ka(d));const p=o.move(s+s);return i(),n.attentionEncodeSurroundingInfo={after:f.outside,before:u.outside},a+l+p}function N5(e,t,n){return n.options.strong||"*"}function _5(e,t,n,r){return n.safe(e.value,r)}function T5(e){const t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function A5(e,t,n){const r=(K1(n)+(n.options.ruleSpaces?" ":"")).repeat(T5(n));return n.options.ruleSpaces?r.slice(0,-1):r}const J1={blockquote:XV,break:rv,code:s5,definition:o5,emphasis:F1,hardBreak:rv,heading:u5,html:B1,image:$1,imageReference:U1,inlineCode:H1,link:q1,linkReference:W1,list:x5,listItem:w5,paragraph:k5,root:E5,strong:G1,text:_5,thematicBreak:A5};function M5(){return{enter:{table:R5,tableData:sv,tableHeader:sv,tableRow:I5},exit:{codeText:D5,table:O5,tableData:sh,tableHeader:sh,tableRow:sh}}}function R5(e){const t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function O5(e){this.exit(e),this.data.inTable=void 0}function I5(e){this.enter({type:"tableRow",children:[]},e)}function sh(e){this.exit(e)}function sv(e){this.enter({type:"tableCell",children:[]},e)}function D5(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,L5));const n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function L5(e,t){return t==="|"?t:e}function P5(e){const t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,s=t.stringLength,i=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:`
469
- `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:f,table:o,tableCell:l,tableRow:a}};function o(p,m,g,b){return c(u(p,g,b),p.align)}function a(p,m,g,b){const y=d(p,g,b),w=c([y]);return w.slice(0,w.indexOf(`
470
- `))}function l(p,m,g,b){const y=g.enter("tableCell"),w=g.enter("phrasing"),v=g.containerPhrasing(p,{...b,before:i,after:i});return w(),y(),v}function c(p,m){return JV(p,{align:m,alignDelimiters:r,padding:n,stringLength:s})}function u(p,m,g){const b=p.children;let y=-1;const w=[],v=m.enter("table");for(;++y<b.length;)w[y]=d(b[y],m,g);return v(),w}function d(p,m,g){const b=p.children;let y=-1;const w=[],v=m.enter("tableRow");for(;++y<b.length;)w[y]=l(b[y],p,m,g);return v(),w}function f(p,m,g){let b=J1.inlineCode(p,m,g);return g.stack.includes("tableCell")&&(b=b.replace(/\|/g,"\\$&")),b}}function j5(){return{exit:{taskListCheckValueChecked:iv,taskListCheckValueUnchecked:iv,paragraph:F5}}}function z5(){return{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:B5}}}function iv(e){const t=this.stack[this.stack.length-2];t.type,t.checked=e.type==="taskListCheckValueChecked"}function F5(e){const t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked=="boolean"){const n=this.stack[this.stack.length-1];n.type;const r=n.children[0];if(r&&r.type==="text"){const s=t.children;let i=-1,o;for(;++i<s.length;){const a=s[i];if(a.type==="paragraph"){o=a;break}}o===n&&(r.value=r.value.slice(1),r.value.length===0?n.children.shift():n.position&&r.position&&typeof r.position.start.offset=="number"&&(r.position.start.column++,r.position.start.offset++,n.position.start=Object.assign({},r.position.start)))}}this.exit(e)}function B5(e,t,n,r){const s=e.children[0],i=typeof e.checked=="boolean"&&s&&s.type==="paragraph",o="["+(e.checked?"x":" ")+"] ",a=n.createTracker(r);i&&a.move(o);let l=J1.listItem(e,t,n,{...r,...a.current()});return i&&(l=l.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,c)),l;function c(u){return u+o}}function $5(){return[yV(),FV(),HV(),M5(),j5()]}function U5(e){return{extensions:[xV(),BV(e),VV(),P5(e),z5()]}}const H5={tokenize:J5,partial:!0},Z1={tokenize:Z5,partial:!0},Y1={tokenize:Y5,partial:!0},X1={tokenize:X5,partial:!0},V5={tokenize:Q5,partial:!0},Q1={name:"wwwAutolink",tokenize:K5,previous:tN},eN={name:"protocolAutolink",tokenize:G5,previous:nN},cs={name:"emailAutolink",tokenize:W5,previous:rN},Pr={};function q5(){return{text:Pr}}let ri=48;for(;ri<123;)Pr[ri]=cs,ri++,ri===58?ri=65:ri===91&&(ri=97);Pr[43]=cs;Pr[45]=cs;Pr[46]=cs;Pr[95]=cs;Pr[72]=[cs,eN];Pr[104]=[cs,eN];Pr[87]=[cs,Q1];Pr[119]=[cs,Q1];function W5(e,t,n){const r=this;let s,i;return o;function o(d){return!Tp(d)||!rN.call(r,r.previous)||Cg(r.events)?n(d):(e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),a(d))}function a(d){return Tp(d)?(e.consume(d),a):d===64?(e.consume(d),l):n(d)}function l(d){return d===46?e.check(V5,u,c)(d):d===45||d===95||pn(d)?(i=!0,e.consume(d),l):u(d)}function c(d){return e.consume(d),s=!0,l}function u(d){return i&&s&&kn(r.previous)?(e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d)):n(d)}}function K5(e,t,n){const r=this;return s;function s(o){return o!==87&&o!==119||!tN.call(r,r.previous)||Cg(r.events)?n(o):(e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(H5,e.attempt(Z1,e.attempt(Y1,i),n),n)(o))}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function G5(e,t,n){const r=this;let s="",i=!1;return o;function o(d){return(d===72||d===104)&&nN.call(r,r.previous)&&!Cg(r.events)?(e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),s+=String.fromCodePoint(d),e.consume(d),a):n(d)}function a(d){if(kn(d)&&s.length<5)return s+=String.fromCodePoint(d),e.consume(d),a;if(d===58){const f=s.toLowerCase();if(f==="http"||f==="https")return e.consume(d),l}return n(d)}function l(d){return d===47?(e.consume(d),i?c:(i=!0,l)):n(d)}function c(d){return d===null||wu(d)||pt(d)||Ii(d)||Id(d)?n(d):e.attempt(Z1,e.attempt(Y1,u),n)(d)}function u(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function J5(e,t,n){let r=0;return s;function s(o){return(o===87||o===119)&&r<3?(r++,e.consume(o),s):o===46&&r===3?(e.consume(o),i):n(o)}function i(o){return o===null?n(o):t(o)}}function Z5(e,t,n){let r,s,i;return o;function o(c){return c===46||c===95?e.check(X1,l,a)(c):c===null||pt(c)||Ii(c)||c!==45&&Id(c)?l(c):(i=!0,e.consume(c),o)}function a(c){return c===95?r=!0:(s=r,r=void 0),e.consume(c),o}function l(c){return s||r||!i?n(c):t(c)}}function Y5(e,t){let n=0,r=0;return s;function s(o){return o===40?(n++,e.consume(o),s):o===41&&r<n?i(o):o===33||o===34||o===38||o===39||o===41||o===42||o===44||o===46||o===58||o===59||o===60||o===63||o===93||o===95||o===126?e.check(X1,t,i)(o):o===null||pt(o)||Ii(o)?t(o):(e.consume(o),s)}function i(o){return o===41&&r++,e.consume(o),s}}function X5(e,t,n){return r;function r(a){return a===33||a===34||a===39||a===41||a===42||a===44||a===46||a===58||a===59||a===63||a===95||a===126?(e.consume(a),r):a===38?(e.consume(a),i):a===93?(e.consume(a),s):a===60||a===null||pt(a)||Ii(a)?t(a):n(a)}function s(a){return a===null||a===40||a===91||pt(a)||Ii(a)?t(a):r(a)}function i(a){return kn(a)?o(a):n(a)}function o(a){return a===59?(e.consume(a),r):kn(a)?(e.consume(a),o):n(a)}}function Q5(e,t,n){return r;function r(i){return e.consume(i),s}function s(i){return pn(i)?n(i):t(i)}}function tN(e){return e===null||e===40||e===42||e===95||e===91||e===93||e===126||pt(e)}function nN(e){return!kn(e)}function rN(e){return!(e===47||Tp(e))}function Tp(e){return e===43||e===45||e===46||e===95||pn(e)}function Cg(e){let t=e.length,n=!1;for(;t--;){const r=e[t][1];if((r.type==="labelLink"||r.type==="labelImage")&&!r._balanced){n=!0;break}if(r._gfmAutolinkLiteralWalkedInto){n=!1;break}}return e.length>0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}const eq={tokenize:lq,partial:!0};function tq(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:iq,continuation:{tokenize:oq},exit:aq}},text:{91:{name:"gfmFootnoteCall",tokenize:sq},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:nq,resolveTo:rq}}}}function nq(e,t,n){const r=this;let s=r.events.length;const i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let o;for(;s--;){const l=r.events[s][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return a;function a(l){if(!o||!o._balanced)return n(l);const c=yr(r.sliceSerialize({start:o.end,end:r.now()}));return c.codePointAt(0)!==94||!i.includes(c.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function rq(e,t){let n=e.length;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";const r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},s={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};s.end.column++,s.end.offset++,s.end._bufferIndex++;const i={type:"gfmFootnoteCallString",start:Object.assign({},s.end),end:Object.assign({},e[e.length-1][1].start)},o={type:"chunkString",contentType:"string",start:Object.assign({},i.start),end:Object.assign({},i.end)},a=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",s,t],["exit",s,t],["enter",i,t],["enter",o,t],["exit",o,t],["exit",i,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...a),e}function sq(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i=0,o;return a;function a(d){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),l}function l(d){return d!==94?n(d):(e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",c)}function c(d){if(i>999||d===93&&!o||d===null||d===91||pt(d))return n(d);if(d===93){e.exit("chunkString");const f=e.exit("gfmFootnoteCallString");return s.includes(yr(r.sliceSerialize(f)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(d)}return pt(d)||(o=!0),i++,e.consume(d),d===92?u:c}function u(d){return d===91||d===92||d===93?(e.consume(d),i++,c):c(d)}}function iq(e,t,n){const r=this,s=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]);let i,o=0,a;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),c}function c(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",u):n(m)}function u(m){if(o>999||m===93&&!a||m===null||m===91||pt(m))return n(m);if(m===93){e.exit("chunkString");const g=e.exit("gfmFootnoteDefinitionLabelString");return i=yr(r.sliceSerialize(g)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),f}return pt(m)||(a=!0),o++,e.consume(m),m===92?d:u}function d(m){return m===91||m===92||m===93?(e.consume(m),o++,u):u(m)}function f(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),s.includes(i)||s.push(i),Ye(e,p,"gfmFootnoteDefinitionWhitespace")):n(m)}function p(m){return t(m)}}function oq(e,t,n){return e.check(xl,t,e.attempt(eq,t,n))}function aq(e){e.exit("gfmFootnoteDefinition")}function lq(e,t,n){const r=this;return Ye(e,s,"gfmFootnoteDefinitionIndent",5);function s(i){const o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(i):n(i)}}function cq(e){let n=(e||{}).singleTilde;const r={name:"strikethrough",tokenize:i,resolveAll:s};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function s(o,a){let l=-1;for(;++l<o.length;)if(o[l][0]==="enter"&&o[l][1].type==="strikethroughSequenceTemporary"&&o[l][1]._close){let c=l;for(;c--;)if(o[c][0]==="exit"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._open&&o[l][1].end.offset-o[l][1].start.offset===o[c][1].end.offset-o[c][1].start.offset){o[l][1].type="strikethroughSequence",o[c][1].type="strikethroughSequence";const u={type:"strikethrough",start:Object.assign({},o[c][1].start),end:Object.assign({},o[l][1].end)},d={type:"strikethroughText",start:Object.assign({},o[c][1].end),end:Object.assign({},o[l][1].start)},f=[["enter",u,a],["enter",o[c][1],a],["exit",o[c][1],a],["enter",d,a]],p=a.parser.constructs.insideSpan.null;p&&Wn(f,f.length,0,Dd(p,o.slice(c+1,l),a)),Wn(f,f.length,0,[["exit",d,a],["enter",o[l][1],a],["exit",o[l][1],a],["exit",u,a]]),Wn(o,c-1,l-c+3,f),l=c+f.length-2;break}}for(l=-1;++l<o.length;)o[l][1].type==="strikethroughSequenceTemporary"&&(o[l][1].type="data");return o}function i(o,a,l){const c=this.previous,u=this.events;let d=0;return f;function f(m){return c===126&&u[u.length-1][1].type!=="characterEscape"?l(m):(o.enter("strikethroughSequenceTemporary"),p(m))}function p(m){const g=To(c);if(m===126)return d>1?l(m):(o.consume(m),d++,p);if(d<2&&!n)return l(m);const b=o.exit("strikethroughSequenceTemporary"),y=To(m);return b._open=!y||y===2&&!!g,b._close=!g||g===2&&!!y,a(m)}}}class uq{constructor(){this.map=[]}add(t,n,r){dq(this,t,n,r)}consume(t){if(this.map.sort(function(i,o){return i[0]-o[0]}),this.map.length===0)return;let n=this.map.length;const r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let s=r.pop();for(;s;){for(const i of s)t.push(i);s=r.pop()}this.map.length=0}}function dq(e,t,n,r){let s=0;if(!(n===0&&r.length===0)){for(;s<e.map.length;){if(e.map[s][0]===t){e.map[s][1]+=n,e.map[s][2].push(...r);return}s+=1}e.map.push([t,n,r])}}function fq(e,t){let n=!1;const r=[];for(;t<e.length;){const s=e[t];if(n){if(s[0]==="enter")s[1].type==="tableContent"&&r.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none");else if(s[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){const i=r.length-1;r[i]=r[i]==="left"?"center":"right"}}else if(s[1].type==="tableDelimiterRow")break}else s[0]==="enter"&&s[1].type==="tableDelimiterRow"&&(n=!0);t+=1}return r}function hq(){return{flow:{null:{name:"table",tokenize:pq,resolveAll:mq}}}}function pq(e,t,n){const r=this;let s=0,i=0,o;return a;function a(T){let I=r.events.length-1;for(;I>-1;){const L=r.events[I][1].type;if(L==="lineEnding"||L==="linePrefix")I--;else break}const O=I>-1?r.events[I][1].type:null,j=O==="tableHead"||O==="tableRow"?k:l;return j===k&&r.parser.lazy[r.now().line]?n(T):j(T)}function l(T){return e.enter("tableHead"),e.enter("tableRow"),c(T)}function c(T){return T===124||(o=!0,i+=1),u(T)}function u(T){return T===null?n(T):_e(T)?i>1?(i=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(T),e.exit("lineEnding"),p):n(T):Ge(T)?Ye(e,u,"whitespace")(T):(i+=1,o&&(o=!1,s+=1),T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),o=!0,u):(e.enter("data"),d(T)))}function d(T){return T===null||T===124||pt(T)?(e.exit("data"),u(T)):(e.consume(T),T===92?f:d)}function f(T){return T===92||T===124?(e.consume(T),d):d(T)}function p(T){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(T):(e.enter("tableDelimiterRow"),o=!1,Ge(T)?Ye(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):m(T))}function m(T){return T===45||T===58?b(T):T===124?(o=!0,e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),g):N(T)}function g(T){return Ge(T)?Ye(e,b,"whitespace")(T):b(T)}function b(T){return T===58?(i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),y):T===45?(i+=1,y(T)):T===null||_e(T)?E(T):N(T)}function y(T){return T===45?(e.enter("tableDelimiterFiller"),w(T)):N(T)}function w(T){return T===45?(e.consume(T),w):T===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(T),e.exit("tableDelimiterMarker"),v):(e.exit("tableDelimiterFiller"),v(T))}function v(T){return Ge(T)?Ye(e,E,"whitespace")(T):E(T)}function E(T){return T===124?m(T):T===null||_e(T)?!o||s!==i?N(T):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(T)):N(T)}function N(T){return n(T)}function k(T){return e.enter("tableRow"),C(T)}function C(T){return T===124?(e.enter("tableCellDivider"),e.consume(T),e.exit("tableCellDivider"),C):T===null||_e(T)?(e.exit("tableRow"),t(T)):Ge(T)?Ye(e,C,"whitespace")(T):(e.enter("data"),A(T))}function A(T){return T===null||T===124||pt(T)?(e.exit("data"),C(T)):(e.consume(T),T===92?R:A)}function R(T){return T===92||T===124?(e.consume(T),A):A(T)}}function mq(e,t){let n=-1,r=!0,s=0,i=[0,0,0,0],o=[0,0,0,0],a=!1,l=0,c,u,d;const f=new uq;for(;++n<e.length;){const p=e[n],m=p[1];p[0]==="enter"?m.type==="tableHead"?(a=!1,l!==0&&(ov(f,t,l,c,u),u=void 0,l=0),c={type:"table",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",c,t]])):m.type==="tableRow"||m.type==="tableDelimiterRow"?(r=!0,d=void 0,i=[0,0,0,0],o=[0,n+1,0,0],a&&(a=!1,u={type:"tableBody",start:Object.assign({},m.start),end:Object.assign({},m.end)},f.add(n,0,[["enter",u,t]])),s=m.type==="tableDelimiterRow"?2:u?3:1):s&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")?(r=!1,o[2]===0&&(i[1]!==0&&(o[0]=o[1],d=Zl(f,t,i,s,void 0,d),i=[0,0,0,0]),o[2]=n)):m.type==="tableCellDivider"&&(r?r=!1:(i[1]!==0&&(o[0]=o[1],d=Zl(f,t,i,s,void 0,d)),i=o,o=[i[1],n,0,0])):m.type==="tableHead"?(a=!0,l=n):m.type==="tableRow"||m.type==="tableDelimiterRow"?(l=n,i[1]!==0?(o[0]=o[1],d=Zl(f,t,i,s,n,d)):o[1]!==0&&(d=Zl(f,t,o,s,n,d)),s=0):s&&(m.type==="data"||m.type==="tableDelimiterMarker"||m.type==="tableDelimiterFiller")&&(o[3]=n)}for(l!==0&&ov(f,t,l,c,u),f.consume(t.events),n=-1;++n<t.events.length;){const p=t.events[n];p[0]==="enter"&&p[1].type==="table"&&(p[1]._align=fq(t.events,n))}return e}function Zl(e,t,n,r,s,i){const o=r===1?"tableHeader":r===2?"tableDelimiter":"tableData",a="tableContent";n[0]!==0&&(i.end=Object.assign({},eo(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]));const l=eo(t.events,n[1]);if(i={type:o,start:Object.assign({},l),end:Object.assign({},l)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){const c=eo(t.events,n[2]),u=eo(t.events,n[3]),d={type:a,start:Object.assign({},c),end:Object.assign({},u)};if(e.add(n[2],0,[["enter",d,t]]),r!==2){const f=t.events[n[2]],p=t.events[n[3]];if(f[1].end=Object.assign({},p[1].end),f[1].type="chunkText",f[1].contentType="text",n[3]>n[2]+1){const m=n[2]+1,g=n[3]-n[2]-1;e.add(m,g,[])}}e.add(n[3]+1,0,[["exit",d,t]])}return s!==void 0&&(i.end=Object.assign({},eo(t.events,s)),e.add(s,0,[["exit",i,t]]),i=void 0),i}function ov(e,t,n,r,s){const i=[],o=eo(t.events,n);s&&(s.end=Object.assign({},o),i.push(["exit",s,t])),r.end=Object.assign({},o),i.push(["exit",r,t]),e.add(n+1,0,i)}function eo(e,t){const n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}const gq={name:"tasklistCheck",tokenize:yq};function bq(){return{text:{91:gq}}}function yq(e,t,n){const r=this;return s;function s(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),i)}function i(l){return pt(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),a):n(l)}function a(l){return _e(l)?t(l):Ge(l)?e.check({tokenize:xq},t,n)(l):n(l)}}function xq(e,t,n){return Ye(e,r,"whitespace");function r(s){return s===null?n(s):t(s)}}function vq(e){return x1([q5(),tq(),cq(e),hq(),bq()])}const wq={};function sN(e){const t=this,n=e||wq,r=t.data(),s=r.micromarkExtensions||(r.micromarkExtensions=[]),i=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);s.push(vq(n)),i.push($5()),o.push(U5(n))}function kq(e,t){const n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function Sq(e,t){const n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:`
471
- `}]}function Eq(e,t){const n=t.value?t.value+`
472
- `:"",r={};t.lang&&(r.className=["language-"+t.lang]);let s={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(s.data={meta:t.meta}),e.patch(t,s),s=e.applyData(t,s),s={type:"element",tagName:"pre",properties:{},children:[s]},e.patch(t,s),s}function Cq(e,t){const n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Nq(e,t){const n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function _q(e,t){const n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),s=$o(r.toLowerCase()),i=e.footnoteOrder.indexOf(r);let o,a=e.footnoteCounts.get(r);a===void 0?(a=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=i+1,a+=1,e.footnoteCounts.set(r,a);const l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+s,id:n+"fnref-"+s+(a>1?"-"+a:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);const c={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,c),e.applyData(t,c)}function Tq(e,t){const n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Aq(e,t){if(e.options.allowDangerousHtml){const n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function iN(e,t){const n=t.referenceType;let r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];const s=e.all(t),i=s[0];i&&i.type==="text"?i.value="["+i.value:s.unshift({type:"text",value:"["});const o=s[s.length-1];return o&&o.type==="text"?o.value+=r:s.push({type:"text",value:r}),s}function Mq(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return iN(e,t);const s={src:$o(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"img",properties:s,children:[]};return e.patch(t,i),e.applyData(t,i)}function Rq(e,t){const n={src:$o(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function Oq(e,t){const n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);const r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function Iq(e,t){const n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return iN(e,t);const s={href:$o(r.url||"")};r.title!==null&&r.title!==void 0&&(s.title=r.title);const i={type:"element",tagName:"a",properties:s,children:e.all(t)};return e.patch(t,i),e.applyData(t,i)}function Dq(e,t){const n={href:$o(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);const r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function Lq(e,t,n){const r=e.all(t),s=n?Pq(n):oN(t),i={},o=[];if(typeof t.checked=="boolean"){const u=r[0];let d;u&&u.type==="element"&&u.tagName==="p"?d=u:(d={type:"element",tagName:"p",properties:{},children:[]},r.unshift(d)),d.children.length>0&&d.children.unshift({type:"text",value:" "}),d.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a<r.length;){const u=r[a];(s||a!==0||u.type!=="element"||u.tagName!=="p")&&o.push({type:"text",value:`
473
- `}),u.type==="element"&&u.tagName==="p"&&!s?o.push(...u.children):o.push(u)}const l=r[r.length-1];l&&(s||l.type!=="element"||l.tagName!=="p")&&o.push({type:"text",value:`
474
- `});const c={type:"element",tagName:"li",properties:i,children:o};return e.patch(t,c),e.applyData(t,c)}function Pq(e){let t=!1;if(e.type==="list"){t=e.spread||!1;const n=e.children;let r=-1;for(;!t&&++r<n.length;)t=oN(n[r])}return t}function oN(e){const t=e.spread;return t??e.children.length>1}function jq(e,t){const n={},r=e.all(t);let s=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++s<r.length;){const o=r[s];if(o.type==="element"&&o.tagName==="li"&&o.properties&&Array.isArray(o.properties.className)&&o.properties.className.includes("task-list-item")){n.className=["contains-task-list"];break}}const i={type:"element",tagName:t.ordered?"ol":"ul",properties:n,children:e.wrap(r,!0)};return e.patch(t,i),e.applyData(t,i)}function zq(e,t){const n={type:"element",tagName:"p",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function Fq(e,t){const n={type:"root",children:e.wrap(e.all(t))};return e.patch(t,n),e.applyData(t,n)}function Bq(e,t){const n={type:"element",tagName:"strong",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const aN=lN("end"),Ng=lN("start");function lN(e){return t;function t(n){const r=n&&n.position&&n.position[e]||{};if(typeof r.line=="number"&&r.line>0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function $q(e){const t=Ng(e),n=aN(e);if(t&&n)return{start:t,end:n}}function Uq(e,t){const n=e.all(t),r=n.shift(),s=[];if(r){const o={type:"element",tagName:"thead",properties:{},children:e.wrap([r],!0)};e.patch(t.children[0],o),s.push(o)}if(n.length>0){const o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},a=Ng(t.children[1]),l=aN(t.children[t.children.length-1]);a&&l&&(o.position={start:a,end:l}),s.push(o)}const i={type:"element",tagName:"table",properties:{},children:e.wrap(s,!0)};return e.patch(t,i),e.applyData(t,i)}function Hq(e,t,n){const r=n?n.children:void 0,i=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,a=o?o.length:t.children.length;let l=-1;const c=[];for(;++l<a;){const d=t.children[l],f={},p=o?o[l]:void 0;p&&(f.align=p);let m={type:"element",tagName:i,properties:f,children:[]};d&&(m.children=e.all(d),e.patch(d,m),m=e.applyData(d,m)),c.push(m)}const u={type:"element",tagName:"tr",properties:{},children:e.wrap(c,!0)};return e.patch(t,u),e.applyData(t,u)}function Vq(e,t){const n={type:"element",tagName:"td",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}const av=9,lv=32;function qq(e){const t=String(e),n=/\r?\n|\r/g;let r=n.exec(t),s=0;const i=[];for(;r;)i.push(cv(t.slice(s,r.index),s>0,!0),r[0]),s=r.index+r[0].length,r=n.exec(t);return i.push(cv(t.slice(s),s>0,!1)),i.join("")}function cv(e,t,n){let r=0,s=e.length;if(t){let i=e.codePointAt(r);for(;i===av||i===lv;)r++,i=e.codePointAt(r)}if(n){let i=e.codePointAt(s-1);for(;i===av||i===lv;)s--,i=e.codePointAt(s-1)}return s>r?e.slice(r,s):""}function Wq(e,t){const n={type:"text",value:qq(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Kq(e,t){const n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}const Gq={blockquote:kq,break:Sq,code:Eq,delete:Cq,emphasis:Nq,footnoteReference:_q,heading:Tq,html:Aq,imageReference:Mq,image:Rq,inlineCode:Oq,linkReference:Iq,link:Dq,listItem:Lq,list:jq,paragraph:zq,root:Fq,strong:Bq,table:Uq,tableCell:Vq,tableRow:Hq,text:Wq,thematicBreak:Kq,toml:Yl,yaml:Yl,definition:Yl,footnoteDefinition:Yl};function Yl(){}const cN=-1,jd=0,_a=1,Eu=2,_g=3,Tg=4,Ag=5,Mg=6,uN=7,dN=8,uv=typeof self=="object"?self:globalThis,Jq=(e,t)=>{const n=(s,i)=>(e.set(i,s),s),r=s=>{if(e.has(s))return e.get(s);const[i,o]=t[s];switch(i){case jd:case cN:return n(o,s);case _a:{const a=n([],s);for(const l of o)a.push(r(l));return a}case Eu:{const a=n({},s);for(const[l,c]of o)a[r(l)]=r(c);return a}case _g:return n(new Date(o),s);case Tg:{const{source:a,flags:l}=o;return n(new RegExp(a,l),s)}case Ag:{const a=n(new Map,s);for(const[l,c]of o)a.set(r(l),r(c));return a}case Mg:{const a=n(new Set,s);for(const l of o)a.add(r(l));return a}case uN:{const{name:a,message:l}=o;return n(new uv[a](l),s)}case dN:return n(BigInt(o),s);case"BigInt":return n(Object(BigInt(o)),s);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{const{buffer:a}=new Uint8Array(o);return n(new DataView(a),o)}}return n(new uv[i](o),s)};return r},dv=e=>Jq(new Map,e)(0),qi="",{toString:Zq}={},{keys:Yq}=Object,ea=e=>{const t=typeof e;if(t!=="object"||!e)return[jd,t];const n=Zq.call(e).slice(8,-1);switch(n){case"Array":return[_a,qi];case"Object":return[Eu,qi];case"Date":return[_g,qi];case"RegExp":return[Tg,qi];case"Map":return[Ag,qi];case"Set":return[Mg,qi];case"DataView":return[_a,n]}return n.includes("Array")?[_a,n]:n.includes("Error")?[uN,n]:[Eu,n]},Xl=([e,t])=>e===jd&&(t==="function"||t==="symbol"),Xq=(e,t,n,r)=>{const s=(o,a)=>{const l=r.push(o)-1;return n.set(a,l),l},i=o=>{if(n.has(o))return n.get(o);let[a,l]=ea(o);switch(a){case jd:{let u=o;switch(l){case"bigint":a=dN,u=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);u=null;break;case"undefined":return s([cN],o)}return s([a,u],o)}case _a:{if(l){let f=o;return l==="DataView"?f=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(f=new Uint8Array(o)),s([l,[...f]],o)}const u=[],d=s([a,u],o);for(const f of o)u.push(i(f));return d}case Eu:{if(l)switch(l){case"BigInt":return s([l,o.toString()],o);case"Boolean":case"Number":case"String":return s([l,o.valueOf()],o)}if(t&&"toJSON"in o)return i(o.toJSON());const u=[],d=s([a,u],o);for(const f of Yq(o))(e||!Xl(ea(o[f])))&&u.push([i(f),i(o[f])]);return d}case _g:return s([a,o.toISOString()],o);case Tg:{const{source:u,flags:d}=o;return s([a,{source:u,flags:d}],o)}case Ag:{const u=[],d=s([a,u],o);for(const[f,p]of o)(e||!(Xl(ea(f))||Xl(ea(p))))&&u.push([i(f),i(p)]);return d}case Mg:{const u=[],d=s([a,u],o);for(const f of o)(e||!Xl(ea(f)))&&u.push(i(f));return d}}const{message:c}=o;return s([a,{name:l,message:c}],o)};return i},fv=(e,{json:t,lossy:n}={})=>{const r=[];return Xq(!(t||n),!!t,new Map,r)(e),r},Cu=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?dv(fv(e,t)):structuredClone(e):(e,t)=>dv(fv(e,t));function Qq(e,t){const n=[{type:"text",value:"↩"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function e9(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function t9(e){const t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||Qq,r=e.options.footnoteBackLabel||e9,s=e.options.footnoteLabel||"Footnotes",i=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},a=[];let l=-1;for(;++l<e.footnoteOrder.length;){const c=e.footnoteById.get(e.footnoteOrder[l]);if(!c)continue;const u=e.all(c),d=String(c.identifier).toUpperCase(),f=$o(d.toLowerCase());let p=0;const m=[],g=e.footnoteCounts.get(d);for(;g!==void 0&&++p<=g;){m.length>0&&m.push({type:"text",value:" "});let w=typeof n=="string"?n:n(l,p);typeof w=="string"&&(w={type:"text",value:w}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+f+(p>1?"-"+p:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,p),className:["data-footnote-backref"]},children:Array.isArray(w)?w:[w]})}const b=u[u.length-1];if(b&&b.type==="element"&&b.tagName==="p"){const w=b.children[b.children.length-1];w&&w.type==="text"?w.value+=" ":b.children.push({type:"text",value:" "}),b.children.push(...m)}else u.push(...m);const y={type:"element",tagName:"li",properties:{id:t+"fn-"+f},children:e.wrap(u,!0)};e.patch(c,y),a.push(y)}if(a.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:i,properties:{...Cu(o),id:"footnote-label"},children:[{type:"text",value:s}]},{type:"text",value:`
475
- `},{type:"element",tagName:"ol",properties:{},children:e.wrap(a,!0)},{type:"text",value:`
476
- `}]}}const Ap={}.hasOwnProperty,n9={};function r9(e,t){const n=t||n9,r=new Map,s=new Map,i=new Map,o={...Gq,...n.handlers},a={all:c,applyData:i9,definitionById:r,footnoteById:s,footnoteCounts:i,footnoteOrder:[],handlers:o,one:l,options:n,patch:s9,wrap:a9};return Sg(e,function(u){if(u.type==="definition"||u.type==="footnoteDefinition"){const d=u.type==="definition"?r:s,f=String(u.identifier).toUpperCase();d.has(f)||d.set(f,u)}}),a;function l(u,d){const f=u.type,p=a.handlers[f];if(Ap.call(a.handlers,f)&&p)return p(a,u,d);if(a.options.passThrough&&a.options.passThrough.includes(f)){if("children"in u){const{children:g,...b}=u,y=Cu(b);return y.children=a.all(u),y}return Cu(u)}return(a.options.unknownHandler||o9)(a,u,d)}function c(u){const d=[];if("children"in u){const f=u.children;let p=-1;for(;++p<f.length;){const m=a.one(f[p],u);if(m){if(p&&f[p-1].type==="break"&&(!Array.isArray(m)&&m.type==="text"&&(m.value=hv(m.value)),!Array.isArray(m)&&m.type==="element")){const g=m.children[0];g&&g.type==="text"&&(g.value=hv(g.value))}Array.isArray(m)?d.push(...m):d.push(m)}}}return d}}function s9(e,t){e.position&&(t.position=$q(e))}function i9(e,t){let n=t;if(e&&e.data){const r=e.data.hName,s=e.data.hChildren,i=e.data.hProperties;if(typeof r=="string")if(n.type==="element")n.tagName=r;else{const o="children"in n?n.children:[n];n={type:"element",tagName:r,properties:{},children:o}}n.type==="element"&&i&&Object.assign(n.properties,Cu(i)),"children"in n&&n.children&&s!==null&&s!==void 0&&(n.children=s)}return n}function o9(e,t){const n=t.data||{},r="value"in t&&!(Ap.call(n,"hProperties")||Ap.call(n,"hChildren"))?{type:"text",value:t.value}:{type:"element",tagName:"div",properties:{},children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function a9(e,t){const n=[];let r=-1;for(t&&n.push({type:"text",value:`
477
- `});++r<e.length;)r&&n.push({type:"text",value:`
478
- `}),n.push(e[r]);return t&&e.length>0&&n.push({type:"text",value:`
479
- `}),n}function hv(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function pv(e,t){const n=r9(e,t),r=n.one(e,void 0),s=t9(n),i=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return s&&i.children.push({type:"text",value:`
480
- `},s),i}function fN(e,t){return e&&"run"in e?async function(n,r){const s=pv(n,{file:r,...t});await e.run(s,r)}:function(n,r){return pv(n,{file:r,...e||t})}}const l9=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class vl{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}vl.prototype.normal={};vl.prototype.property={};vl.prototype.space=void 0;function hN(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new vl(n,r,t)}function Mp(e){return e.toLowerCase()}class Pn{constructor(t,n){this.attribute=n,this.property=t}}Pn.prototype.attribute="";Pn.prototype.booleanish=!1;Pn.prototype.boolean=!1;Pn.prototype.commaOrSpaceSeparated=!1;Pn.prototype.commaSeparated=!1;Pn.prototype.defined=!1;Pn.prototype.mustUseProperty=!1;Pn.prototype.number=!1;Pn.prototype.overloadedBoolean=!1;Pn.prototype.property="";Pn.prototype.spaceSeparated=!1;Pn.prototype.space=void 0;let c9=0;const Be=Ui(),jt=Ui(),Rp=Ui(),Z=Ui(),yt=Ui(),mo=Ui(),Bn=Ui();function Ui(){return 2**++c9}const Op=Object.freeze(Object.defineProperty({__proto__:null,boolean:Be,booleanish:jt,commaOrSpaceSeparated:Bn,commaSeparated:mo,number:Z,overloadedBoolean:Rp,spaceSeparated:yt},Symbol.toStringTag,{value:"Module"})),ih=Object.keys(Op);class Rg extends Pn{constructor(t,n,r,s){let i=-1;if(super(t,n),mv(this,"space",s),typeof r=="number")for(;++i<ih.length;){const o=ih[i];mv(this,ih[i],(r&Op[o])===Op[o])}}}Rg.prototype.defined=!0;function mv(e,t,n){n&&(e[t]=n)}function Uo(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const i=new Rg(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(i.mustUseProperty=!0),t[r]=i,n[Mp(r)]=r,n[Mp(i.attribute)]=r}return new vl(t,n,e.space)}const pN=Uo({properties:{ariaActiveDescendant:null,ariaAtomic:jt,ariaAutoComplete:null,ariaBusy:jt,ariaChecked:jt,ariaColCount:Z,ariaColIndex:Z,ariaColSpan:Z,ariaControls:yt,ariaCurrent:null,ariaDescribedBy:yt,ariaDetails:null,ariaDisabled:jt,ariaDropEffect:yt,ariaErrorMessage:null,ariaExpanded:jt,ariaFlowTo:yt,ariaGrabbed:jt,ariaHasPopup:null,ariaHidden:jt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:yt,ariaLevel:Z,ariaLive:null,ariaModal:jt,ariaMultiLine:jt,ariaMultiSelectable:jt,ariaOrientation:null,ariaOwns:yt,ariaPlaceholder:null,ariaPosInSet:Z,ariaPressed:jt,ariaReadOnly:jt,ariaRelevant:null,ariaRequired:jt,ariaRoleDescription:yt,ariaRowCount:Z,ariaRowIndex:Z,ariaRowSpan:Z,ariaSelected:jt,ariaSetSize:Z,ariaSort:null,ariaValueMax:Z,ariaValueMin:Z,ariaValueNow:Z,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function mN(e,t){return t in e?e[t]:t}function gN(e,t){return mN(e,t.toLowerCase())}const u9=Uo({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:mo,acceptCharset:yt,accessKey:yt,action:null,allow:null,allowFullScreen:Be,allowPaymentRequest:Be,allowUserMedia:Be,alt:null,as:null,async:Be,autoCapitalize:null,autoComplete:yt,autoFocus:Be,autoPlay:Be,blocking:yt,capture:null,charSet:null,checked:Be,cite:null,className:yt,cols:Z,colSpan:null,content:null,contentEditable:jt,controls:Be,controlsList:yt,coords:Z|mo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Be,defer:Be,dir:null,dirName:null,disabled:Be,download:Rp,draggable:jt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Be,formTarget:null,headers:yt,height:Z,hidden:Rp,high:Z,href:null,hrefLang:null,htmlFor:yt,httpEquiv:yt,id:null,imageSizes:null,imageSrcSet:null,inert:Be,inputMode:null,integrity:null,is:null,isMap:Be,itemId:null,itemProp:yt,itemRef:yt,itemScope:Be,itemType:yt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Be,low:Z,manifest:null,max:null,maxLength:Z,media:null,method:null,min:null,minLength:Z,multiple:Be,muted:Be,name:null,nonce:null,noModule:Be,noValidate:Be,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Be,optimum:Z,pattern:null,ping:yt,placeholder:null,playsInline:Be,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Be,referrerPolicy:null,rel:yt,required:Be,reversed:Be,rows:Z,rowSpan:Z,sandbox:yt,scope:null,scoped:Be,seamless:Be,selected:Be,shadowRootClonable:Be,shadowRootDelegatesFocus:Be,shadowRootMode:null,shape:null,size:Z,sizes:null,slot:null,span:Z,spellCheck:jt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Z,step:null,style:null,tabIndex:Z,target:null,title:null,translate:null,type:null,typeMustMatch:Be,useMap:null,value:jt,width:Z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:yt,axis:null,background:null,bgColor:null,border:Z,borderColor:null,bottomMargin:Z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Be,declare:Be,event:null,face:null,frame:null,frameBorder:null,hSpace:Z,leftMargin:Z,link:null,longDesc:null,lowSrc:null,marginHeight:Z,marginWidth:Z,noResize:Be,noHref:Be,noShade:Be,noWrap:Be,object:null,profile:null,prompt:null,rev:null,rightMargin:Z,rules:null,scheme:null,scrolling:jt,standby:null,summary:null,text:null,topMargin:Z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Z,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Be,disableRemotePlayback:Be,prefix:null,property:null,results:Z,security:null,unselectable:null},space:"html",transform:gN}),d9=Uo({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Bn,accentHeight:Z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Z,amplitude:Z,arabicForm:null,ascent:Z,attributeName:null,attributeType:null,azimuth:Z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Z,by:null,calcMode:null,capHeight:Z,className:yt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Z,diffuseConstant:Z,direction:null,display:null,dur:null,divisor:Z,dominantBaseline:null,download:Be,dx:null,dy:null,edgeMode:null,editable:null,elevation:Z,enableBackground:null,end:null,event:null,exponent:Z,externalResourcesRequired:null,fill:null,fillOpacity:Z,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:mo,g2:mo,glyphName:mo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Z,horizOriginX:Z,horizOriginY:Z,id:null,ideographic:Z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Z,k:Z,k1:Z,k2:Z,k3:Z,k4:Z,kernelMatrix:Bn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Z,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Z,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Z,overlineThickness:Z,paintOrder:null,panose1:null,path:null,pathLength:Z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:yt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Z,pointsAtY:Z,pointsAtZ:Z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Bn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Bn,rev:Bn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Bn,requiredFeatures:Bn,requiredFonts:Bn,requiredFormats:Bn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Z,specularExponent:Z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Z,strikethroughThickness:Z,string:null,stroke:null,strokeDashArray:Bn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Z,strokeOpacity:Z,strokeWidth:null,style:null,surfaceScale:Z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Bn,tabIndex:Z,tableValues:null,target:null,targetX:Z,targetY:Z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Bn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Z,underlineThickness:Z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Z,values:null,vAlphabetic:Z,vMathematical:Z,vectorEffect:null,vHanging:Z,vIdeographic:Z,version:null,vertAdvY:Z,vertOriginX:Z,vertOriginY:Z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:mN}),bN=Uo({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),yN=Uo({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:gN}),xN=Uo({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),f9={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},h9=/[A-Z]/g,gv=/-[a-z]/g,p9=/^data[-\w.:]+$/i;function vN(e,t){const n=Mp(t);let r=t,s=Pn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&p9.test(t)){if(t.charAt(4)==="-"){const i=t.slice(5).replace(gv,g9);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{const i=t.slice(4);if(!gv.test(i)){let o=i.replace(h9,m9);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=Rg}return new s(r,t)}function m9(e){return"-"+e.toLowerCase()}function g9(e){return e.charAt(1).toUpperCase()}const wN=hN([pN,u9,bN,yN,xN],"html"),wl=hN([pN,d9,bN,yN,xN],"svg"),b9=/["&'<>`]/g,y9=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,x9=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,v9=/[|\\{}()[\]^$+*?.]/g,bv=new WeakMap;function w9(e,t){if(e=e.replace(t.subset?k9(t.subset):b9,r),t.subset||t.escapeOnly)return e;return e.replace(y9,n).replace(x9,r);function n(s,i,o){return t.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),t)}function r(s,i,o){return t.format(s.charCodeAt(0),o.charCodeAt(i+1),t)}}function k9(e){let t=bv.get(e);return t||(t=S9(e),bv.set(e,t)),t}function S9(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(v9,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const E9=/[\dA-Fa-f]/;function C9(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!E9.test(String.fromCharCode(t))?r:r+";"}const N9=/\d/;function _9(e,t,n){const r="&#"+String(e);return n&&t&&!N9.test(String.fromCharCode(t))?r:r+";"}const T9=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"],oh={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},A9=["cent","copy","divide","gt","lt","not","para","times"],kN={}.hasOwnProperty,Ip={};let Ql;for(Ql in oh)kN.call(oh,Ql)&&(Ip[oh[Ql]]=Ql);const M9=/[^\dA-Za-z]/;function R9(e,t,n,r){const s=String.fromCharCode(e);if(kN.call(Ip,s)){const i=Ip[s],o="&"+i;return n&&T9.includes(i)&&!A9.includes(i)&&(!r||t&&t!==61&&M9.test(String.fromCharCode(t)))?o:o+";"}return""}function O9(e,t,n){let r=C9(e,t,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=R9(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const i=_9(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function go(e,t){return w9(e,Object.assign({format:O9},t))}const I9=/^>|^->|<!--|-->|--!>|<!-$/g,D9=[">"],L9=["<",">"];function P9(e,t,n,r){return r.settings.bogusComments?"<?"+go(e.value,Object.assign({},r.settings.characterReferences,{subset:D9}))+">":"<!--"+e.value.replace(I9,s)+"-->";function s(i){return go(i,Object.assign({},r.settings.characterReferences,{subset:L9}))}}function j9(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function SN(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function EN(e){return e.join(" ").trim()}const z9=/[ \t\n\f\r]/g;function zd(e){return typeof e=="object"?e.type==="text"?yv(e.value):!1:yv(e)}function yv(e){return e.replace(z9,"")===""}const Gt=NN(1),CN=NN(-1),F9=[];function NN(e){return t;function t(n,r,s){const i=n?n.children:F9;let o=(r||0)+e,a=i[o];if(!s)for(;a&&zd(a);)o+=e,a=i[o];return a}}const B9={}.hasOwnProperty;function _N(e){return t;function t(n,r,s){return B9.call(e,n.tagName)&&e[n.tagName](n,r,s)}}const Og=_N({body:U9,caption:ah,colgroup:ah,dd:W9,dt:q9,head:ah,html:$9,li:V9,optgroup:K9,option:G9,p:H9,rp:xv,rt:xv,tbody:Z9,td:vv,tfoot:Y9,th:vv,thead:J9,tr:X9});function ah(e,t,n){const r=Gt(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&zd(r.value.charAt(0)))}function $9(e,t,n){const r=Gt(n,t);return!r||r.type!=="comment"}function U9(e,t,n){const r=Gt(n,t);return!r||r.type!=="comment"}function H9(e,t,n){const r=Gt(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function V9(e,t,n){const r=Gt(n,t);return!r||r.type==="element"&&r.tagName==="li"}function q9(e,t,n){const r=Gt(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function W9(e,t,n){const r=Gt(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function xv(e,t,n){const r=Gt(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function K9(e,t,n){const r=Gt(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function G9(e,t,n){const r=Gt(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function J9(e,t,n){const r=Gt(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Z9(e,t,n){const r=Gt(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Y9(e,t,n){return!Gt(n,t)}function X9(e,t,n){const r=Gt(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function vv(e,t,n){const r=Gt(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Q9=_N({body:nW,colgroup:rW,head:tW,html:eW,tbody:sW});function eW(e){const t=Gt(e,-1);return!t||t.type!=="comment"}function tW(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function nW(e){const t=Gt(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&zd(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function rW(e,t,n){const r=CN(n,t),s=Gt(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Og(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function sW(e,t,n){const r=CN(n,t),s=Gt(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Og(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const ec={name:[[`
481
- \f\r &/=>`.split(""),`
482
- \f\r "&'/=>\``.split("")],[`\0
483
- \f\r "&'/<=>`.split(""),`\0
484
- \f\r "&'/<=>\``.split("")]],unquoted:[[`
485
- \f\r &>`.split(""),`\0
486
- \f\r "&'<=>\``.split("")],[`\0
487
- \f\r "&'<=>\``.split(""),`\0
488
- \f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function iW(e,t,n,r){const s=r.schema,i=s.space==="svg"?!1:r.settings.omitOptionalTags;let o=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const a=[];let l;s.space==="html"&&e.tagName==="svg"&&(r.schema=wl);const c=oW(r,e.properties),u=r.all(s.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=s,u&&(o=!1),(c||!i||!Q9(e,t,n))&&(a.push("<",e.tagName,c?" "+c:""),o&&(s.space==="svg"||r.settings.closeSelfClosing)&&(l=c.charAt(c.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!o&&(!i||!Og(e,t,n))&&a.push("</"+e.tagName+">"),a.join("")}function oW(e,t){const n=[];let r=-1,s;if(t){for(s in t)if(t[s]!==null&&t[s]!==void 0){const i=aW(e,s,t[s]);i&&n.push(i)}}for(;++r<n.length;){const i=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&i!=='"'&&i!=="'"&&(n[r]+=" ")}return n.join("")}function aW(e,t,n){const r=vN(e.schema,t),s=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,i=e.settings.allowDangerousCharacters?0:1;let o=e.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const l=go(r.attribute,Object.assign({},e.settings.characterReferences,{subset:ec.name[s][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?SN:EN)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?l:(e.settings.preferUnquoted&&(a=go(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:ec.unquoted[s][i]}))),a!==n&&(e.settings.quoteSmart&&ku(n,o)>ku(n,e.alternative)&&(o=e.alternative),a=o+go(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?ec.single:ec.double)[s][i],attribute:!0}))+o),l+(a&&"="+a))}const lW=["<","&"];function TN(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:go(e.value,Object.assign({},r.settings.characterReferences,{subset:lW}))}function cW(e,t,n,r){return r.settings.allowDangerousHtml?e.value:TN(e,t,n,r)}function uW(e,t,n,r){return r.all(e)}const dW=YV("type",{invalid:fW,unknown:hW,handlers:{comment:P9,doctype:j9,element:iW,raw:cW,root:uW,text:TN}});function fW(e){throw new Error("Expected node, not `"+e+"`")}function hW(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const pW={},mW={},gW=[];function bW(e,t){const n=t||pW,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:yW,all:xW,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||l9,characterReferences:n.characterReferences||mW,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?wl:wN,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function yW(e,t,n){return dW(e,t,n,this)}function xW(e){const t=[],n=e&&e.children||gW;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}function vW(e){const t=this,n={...t.data("settings"),...e};t.compiler=r;function r(s){return bW(s,n)}}function wW(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)n.hasOwnProperty(r)&&(e[r]=n[r])}return e}function Dp(e,t){return Array(t+1).join(e)}function AN(e){return e.replace(/^\n*/,"")}function MN(e){for(var t=e.length;t>0&&e[t-1]===`
489
- `;)t--;return e.substring(0,t)}function RN(e){return MN(AN(e))}var kW=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function Ig(e){return Dg(e,kW)}var ON=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function IN(e){return Dg(e,ON)}function SW(e){return LN(e,ON)}var DN=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function EW(e){return Dg(e,DN)}function CW(e){return LN(e,DN)}function Dg(e,t){return t.indexOf(e.nodeName)>=0}function LN(e,t){return e.getElementsByTagName&&t.some(function(n){return e.getElementsByTagName(n).length})}var xn={};xn.paragraph={filter:"p",replacement:function(e){return`
490
-
491
- `+e+`
492
-
493
- `}};xn.lineBreak={filter:"br",replacement:function(e,t,n){return n.br+`
494
- `}};xn.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(e,t,n){var r=Number(t.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var s=Dp(r===1?"=":"-",e.length);return`
495
-
496
- `+e+`
497
- `+s+`
498
-
499
- `}else return`
500
-
501
- `+Dp("#",r)+" "+e+`
502
-
503
- `}};xn.blockquote={filter:"blockquote",replacement:function(e){return e=RN(e).replace(/^/gm,"> "),`
504
-
505
- `+e+`
506
-
507
- `}};xn.list={filter:["ul","ol"],replacement:function(e,t){var n=t.parentNode;return n.nodeName==="LI"&&n.lastElementChild===t?`
508
- `+e:`
509
-
510
- `+e+`
511
-
512
- `}};xn.listItem={filter:"li",replacement:function(e,t,n){var r=n.bulletListMarker+" ",s=t.parentNode;if(s.nodeName==="OL"){var i=s.getAttribute("start"),o=Array.prototype.indexOf.call(s.children,t);r=(i?Number(i)+o:o+1)+". "}var a=/\n$/.test(e);return e=RN(e)+(a?`
513
- `:""),e=e.replace(/\n/gm,`
514
- `+" ".repeat(r.length)),r+e+(t.nextSibling?`
515
- `:"")}};xn.indentedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="indented"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){return`
516
-
517
- `+t.firstChild.textContent.replace(/\n/g,`
518
- `)+`
519
-
520
- `}};xn.fencedCodeBlock={filter:function(e,t){return t.codeBlockStyle==="fenced"&&e.nodeName==="PRE"&&e.firstChild&&e.firstChild.nodeName==="CODE"},replacement:function(e,t,n){for(var r=t.firstChild.getAttribute("class")||"",s=(r.match(/language-(\S+)/)||[null,""])[1],i=t.firstChild.textContent,o=n.fence.charAt(0),a=3,l=new RegExp("^"+o+"{3,}","gm"),c;c=l.exec(i);)c[0].length>=a&&(a=c[0].length+1);var u=Dp(o,a);return`
521
-
522
- `+u+s+`
523
- `+i.replace(/\n$/,"")+`
524
- `+u+`
525
-
526
- `}};xn.horizontalRule={filter:"hr",replacement:function(e,t,n){return`
527
-
528
- `+n.hr+`
529
-
530
- `}};xn.inlineLink={filter:function(e,t){return t.linkStyle==="inlined"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t){var n=t.getAttribute("href");n&&(n=n.replace(/([()])/g,"\\$1"));var r=Nu(t.getAttribute("title"));return r&&(r=' "'+r.replace(/"/g,'\\"')+'"'),"["+e+"]("+n+r+")"}};xn.referenceLink={filter:function(e,t){return t.linkStyle==="referenced"&&e.nodeName==="A"&&e.getAttribute("href")},replacement:function(e,t,n){var r=t.getAttribute("href"),s=Nu(t.getAttribute("title"));s&&(s=' "'+s+'"');var i,o;switch(n.linkReferenceStyle){case"collapsed":i="["+e+"][]",o="["+e+"]: "+r+s;break;case"shortcut":i="["+e+"]",o="["+e+"]: "+r+s;break;default:var a=this.references.length+1;i="["+e+"]["+a+"]",o="["+a+"]: "+r+s}return this.references.push(o),i},references:[],append:function(e){var t="";return this.references.length&&(t=`
531
-
532
- `+this.references.join(`
533
- `)+`
534
-
535
- `,this.references=[]),t}};xn.emphasis={filter:["em","i"],replacement:function(e,t,n){return e.trim()?n.emDelimiter+e+n.emDelimiter:""}};xn.strong={filter:["strong","b"],replacement:function(e,t,n){return e.trim()?n.strongDelimiter+e+n.strongDelimiter:""}};xn.code={filter:function(e){var t=e.previousSibling||e.nextSibling,n=e.parentNode.nodeName==="PRE"&&!t;return e.nodeName==="CODE"&&!n},replacement:function(e){if(!e)return"";e=e.replace(/\r?\n|\r/g," ");for(var t=/^`|^ .*?[^ ].* $|`$/.test(e)?" ":"",n="`",r=e.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+t+e+t+n}};xn.image={filter:"img",replacement:function(e,t){var n=Nu(t.getAttribute("alt")),r=t.getAttribute("src")||"",s=Nu(t.getAttribute("title")),i=s?' "'+s+'"':"";return r?"!["+n+"]("+r+i+")":""}};function Nu(e){return e?e.replace(/(\n+\s*)+/g,`
536
- `):""}function PN(e){this.options=e,this._keep=[],this._remove=[],this.blankRule={replacement:e.blankReplacement},this.keepReplacement=e.keepReplacement,this.defaultRule={replacement:e.defaultReplacement},this.array=[];for(var t in e.rules)this.array.push(e.rules[t])}PN.prototype={add:function(e,t){this.array.unshift(t)},keep:function(e){this._keep.unshift({filter:e,replacement:this.keepReplacement})},remove:function(e){this._remove.unshift({filter:e,replacement:function(){return""}})},forNode:function(e){if(e.isBlank)return this.blankRule;var t;return(t=lh(this.array,e,this.options))||(t=lh(this._keep,e,this.options))||(t=lh(this._remove,e,this.options))?t:this.defaultRule},forEach:function(e){for(var t=0;t<this.array.length;t++)e(this.array[t],t)}};function lh(e,t,n){for(var r=0;r<e.length;r++){var s=e[r];if(NW(s,t,n))return s}}function NW(e,t,n){var r=e.filter;if(typeof r=="string"){if(r===t.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(t.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(e,t,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function _W(e){var t=e.element,n=e.isBlock,r=e.isVoid,s=e.isPre||function(d){return d.nodeName==="PRE"};if(!(!t.firstChild||s(t))){for(var i=null,o=!1,a=null,l=wv(a,t,s);l!==t;){if(l.nodeType===3||l.nodeType===4){var c=l.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!o&&c[0]===" "&&(c=c.substr(1)),!c){l=ch(l);continue}l.data=c,i=l}else if(l.nodeType===1)n(l)||l.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,o=!1):r(l)||s(l)?(i=null,o=!0):i&&(o=!1);else{l=ch(l);continue}var u=wv(a,l,s);a=l,l=u}i&&(i.data=i.data.replace(/ $/,""),i.data||ch(i))}}function ch(e){var t=e.nextSibling||e.parentNode;return e.parentNode.removeChild(e),t}function wv(e,t,n){return e&&e.parentNode===t||n(t)?t.nextSibling||t.parentNode:t.firstChild||t.nextSibling||t.parentNode}var Lg=typeof window<"u"?window:{};function TW(){var e=Lg.DOMParser,t=!1;try{new e().parseFromString("","text/html")&&(t=!0)}catch{}return t}function AW(){var e=function(){};return MW()?e.prototype.parseFromString=function(t){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(t),n.close(),n}:e.prototype.parseFromString=function(t){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(t),n.close(),n},e}function MW(){var e=!1;try{document.implementation.createHTMLDocument("").open()}catch{Lg.ActiveXObject&&(e=!0)}return e}var RW=TW()?Lg.DOMParser:AW();function OW(e,t){var n;if(typeof e=="string"){var r=IW().parseFromString('<x-turndown id="turndown-root">'+e+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=e.cloneNode(!0);return _W({element:n,isBlock:Ig,isVoid:IN,isPre:t.preformattedCode?DW:null}),n}var uh;function IW(){return uh=uh||new RW,uh}function DW(e){return e.nodeName==="PRE"||e.nodeName==="CODE"}function LW(e,t){return e.isBlock=Ig(e),e.isCode=e.nodeName==="CODE"||e.parentNode.isCode,e.isBlank=PW(e),e.flankingWhitespace=jW(e,t),e}function PW(e){return!IN(e)&&!EW(e)&&/^\s*$/i.test(e.textContent)&&!SW(e)&&!CW(e)}function jW(e,t){if(e.isBlock||t.preformattedCode&&e.isCode)return{leading:"",trailing:""};var n=zW(e.textContent);return n.leadingAscii&&kv("left",e,t)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&kv("right",e,t)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function zW(e){var t=e.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:t[1],leadingAscii:t[2],leadingNonAscii:t[3],trailing:t[4],trailingNonAscii:t[5],trailingAscii:t[6]}}function kv(e,t,n){var r,s,i;return e==="left"?(r=t.previousSibling,s=/ $/):(r=t.nextSibling,s=/^ /),r&&(r.nodeType===3?i=s.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!Ig(r)&&(i=s.test(r.textContent))),i}var FW=Array.prototype.reduce,BW=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function _u(e){if(!(this instanceof _u))return new _u(e);var t={rules:xn,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:" ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`
537
-
538
- `:""},keepReplacement:function(n,r){return r.isBlock?`
539
-
540
- `+r.outerHTML+`
541
-
542
- `:r.outerHTML},defaultReplacement:function(n,r){return r.isBlock?`
543
-
544
- `+n+`
545
-
546
- `:n}};this.options=wW({},t,e),this.rules=new PN(this.options)}_u.prototype={turndown:function(e){if(!HW(e))throw new TypeError(e+" is not a string, or an element/document/fragment node.");if(e==="")return"";var t=jN.call(this,new OW(e,this.options));return $W.call(this,t)},use:function(e){if(Array.isArray(e))for(var t=0;t<e.length;t++)this.use(e[t]);else if(typeof e=="function")e(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(e,t){return this.rules.add(e,t),this},keep:function(e){return this.rules.keep(e),this},remove:function(e){return this.rules.remove(e),this},escape:function(e){return BW.reduce(function(t,n){return t.replace(n[0],n[1])},e)}};function jN(e){var t=this;return FW.call(e.childNodes,function(n,r){r=new LW(r,t.options);var s="";return r.nodeType===3?s=r.isCode?r.nodeValue:t.escape(r.nodeValue):r.nodeType===1&&(s=UW.call(t,r)),zN(n,s)},"")}function $W(e){var t=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(e=zN(e,n.append(t.options)))}),e.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function UW(e){var t=this.rules.forNode(e),n=jN.call(this,e),r=e.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+t.replacement(n,e,this.options)+r.trailing}function zN(e,t){var n=MN(e),r=AN(t),s=Math.max(e.length-n.length,t.length-r.length),i=`
547
-
548
- `.substring(0,s);return n+i+r}function HW(e){return e!=null&&(typeof e=="string"||e.nodeType&&(e.nodeType===1||e.nodeType===9||e.nodeType===11))}function VW(e){if(!e)return[];const t=e.split(`
549
- `),n=[];let r=!1,s=!1,i=!1;for(let o=0;o<t.length;o++){const l=t[o].trim();if(l.startsWith("```"))if(r=!r,r){n.push(o+1),i=!0,s=!1;continue}else{s=!1;continue}if(r)continue;if(!l){s=!1;continue}const c=/^#{1,6}\s/.test(l),u=/^[-*+]\s/.test(l),d=/^\d+\.\s/.test(l),f=l.startsWith(">"),p=/^[-*_]{3,}$/.test(l);if(u||d){s||(n.push(o+1),i=!0,s=!0);continue}s=!1,(c||f||p||!i||!t[o-1]?.trim())&&(n.push(o+1),i=!0)}return n}var Lp,Pp;if(typeof WeakMap<"u"){let e=new WeakMap;Lp=t=>e.get(t),Pp=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;Lp=r=>{for(let s=0;s<e.length;s+=2)if(e[s]==r)return e[s+1]},Pp=(r,s)=>(n==10&&(n=0),e[n++]=r,e[n++]=s)}var Ot=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,s=t/this.width|0;let i=r+1,o=s+1;for(let a=1;i<this.width&&this.map[t+a]==n;a++)i++;for(let a=1;o<this.height&&this.map[t+this.width*a]==n;a++)o++;return{left:r,top:s,right:i,bottom:o}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:s,top:i,bottom:o}=this.findCell(e);return t=="horiz"?(n<0?r==0:s==this.width)?null:this.map[i*this.width+(n<0?r-1:s)]:(n<0?i==0:o==this.height)?null:this.map[r+this.width*(n<0?i-1:o)]}rectBetween(e,t){const{left:n,right:r,top:s,bottom:i}=this.findCell(e),{left:o,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,o),top:Math.min(s,l),right:Math.max(r,a),bottom:Math.max(i,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let s=e.left;s<e.right;s++){const i=r*this.width+s,o=this.map[i];n[o]||(n[o]=!0,!(s==e.left&&s&&this.map[i-1]==o||r==e.top&&r&&this.map[i-this.width]==o)&&t.push(o))}return t}positionAt(e,t,n){for(let r=0,s=0;;r++){const i=s+n.child(r).nodeSize;if(r==e){let o=t+e*this.width;const a=(e+1)*this.width;for(;o<a&&this.map[o]<s;)o++;return o==a?i-1:this.map[o]}s=i}}static get(e){return Lp(e)||Pp(e,qW(e))}};function qW(e){if(e.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+e.type.name);const t=WW(e),n=e.childCount,r=[];let s=0,i=null;const o=[];for(let c=0,u=t*n;c<u;c++)r[c]=0;for(let c=0,u=0;c<n;c++){const d=e.child(c);u++;for(let m=0;;m++){for(;s<r.length&&r[s]!=0;)s++;if(m==d.childCount)break;const g=d.child(m),{colspan:b,rowspan:y,colwidth:w}=g.attrs;for(let v=0;v<y;v++){if(v+c>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:u,n:y-v});break}const E=s+v*t;for(let N=0;N<b;N++){r[E+N]==0?r[E+N]=u:(i||(i=[])).push({type:"collision",row:c,pos:u,n:b-N});const k=w&&w[N];if(k){const C=(E+N)%t*2,A=o[C];A==null||A!=k&&o[C+1]==1?(o[C]=k,o[C+1]=1):A==k&&o[C+1]++}}}s+=b,u+=g.nodeSize}const f=(c+1)*t;let p=0;for(;s<f;)r[s++]==0&&p++;p&&(i||(i=[])).push({type:"missing",row:c,n:p}),u++}(t===0||n===0)&&(i||(i=[])).push({type:"zero_sized"});const a=new Ot(t,n,r,i);let l=!1;for(let c=0;!l&&c<o.length;c+=2)o[c]!=null&&o[c+1]<n&&(l=!0);return l&&KW(a,o,e),a}function WW(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const s=e.child(r);let i=0;if(n)for(let o=0;o<r;o++){const a=e.child(o);for(let l=0;l<a.childCount;l++){const c=a.child(l);o+c.attrs.rowspan>r&&(i+=c.attrs.colspan)}}for(let o=0;o<s.childCount;o++){const a=s.child(o);i+=a.attrs.colspan,a.attrs.rowspan>1&&(n=!0)}t==-1?t=i:t!=i&&(t=Math.max(t,i))}return t}function KW(e,t,n){e.problems||(e.problems=[]);const r={};for(let s=0;s<e.map.length;s++){const i=e.map[s];if(r[i])continue;r[i]=!0;const o=n.nodeAt(i);if(!o)throw new RangeError(`No cell with offset ${i} found`);let a=null;const l=o.attrs;for(let c=0;c<l.colspan;c++){const u=(s+c)%e.width,d=t[u*2];d!=null&&(!l.colwidth||l.colwidth[c]!=d)&&((a||(a=GW(l)))[c]=d)}a&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}function GW(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function mn(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],s=r.spec.tableRole;s&&(t[s]=r)}}return t}var Cs=new Lt("selectingCells");function Ho(e){for(let t=e.depth-1;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function JW(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if(n==="cell"||n==="header_cell")return e.node(t)}return null}function kr(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function Fd(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=Ho(t.$head)||ZW(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function ZW(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if(r=="cell"||r=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function jp(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function YW(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function Pg(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function FN(e,t,n){const r=e.node(-1),s=Ot.get(r),i=e.start(-1),o=s.nextCell(e.pos-i,t,n);return o==null?null:e.node(0).resolve(i+o)}function Di(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function BN(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;s<n;s++)r.colwidth.splice(t,0,0)}return r}function XW(e,t,n){const r=mn(t.type.schema).header_cell;for(let s=0;s<e.height;s++)if(t.nodeAt(e.map[n+s*e.width]).type!=r)return!1;return!0}var vt=class Wr extends Re{constructor(t,n=t){const r=t.node(-1),s=Ot.get(r),i=t.start(-1),o=s.rectBetween(t.pos-i,n.pos-i),a=t.node(0),l=s.cellsInRect(o).filter(u=>u!=n.pos-i);l.unshift(n.pos-i);const c=l.map(u=>{const d=r.nodeAt(u);if(!d)throw RangeError(`No cell with offset ${u} found`);const f=i+u+1;return new KS(a.resolve(f),a.resolve(f+d.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=t,this.$headCell=n}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),s=t.resolve(n.map(this.$headCell.pos));if(jp(r)&&jp(s)&&Pg(r,s)){const i=this.$anchorCell.node(-1)!=r.node(-1);return i&&this.isRowSelection()?Wr.rowSelection(r,s):i&&this.isColSelection()?Wr.colSelection(r,s):new Wr(r,s)}return Ce.between(r,s)}content(){const t=this.$anchorCell.node(-1),n=Ot.get(t),r=this.$anchorCell.start(-1),s=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),i={},o=[];for(let l=s.top;l<s.bottom;l++){const c=[];for(let u=l*n.width+s.left,d=s.left;d<s.right;d++,u++){const f=n.map[u];if(i[f])continue;i[f]=!0;const p=n.findCell(f);let m=t.nodeAt(f);if(!m)throw RangeError(`No cell with offset ${f} found`);const g=s.left-p.left,b=p.right-s.right;if(g>0||b>0){let y=m.attrs;if(g>0&&(y=Di(y,0,g)),b>0&&(y=Di(y,y.colspan-b,b)),p.left<s.left){if(m=m.type.createAndFill(y),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(y)}`)}else m=m.type.create(y,m.content)}if(p.top<s.top||p.bottom>s.bottom){const y={...m.attrs,rowspan:Math.min(p.bottom,s.bottom)-Math.max(p.top,s.top)};p.top<s.top?m=m.type.createAndFill(y):m=m.type.create(y,m.content)}c.push(m)}o.push(t.child(l).copy(V.from(c)))}const a=this.isColSelection()&&this.isRowSelection()?t:o;return new se(V.from(a),1,1)}replace(t,n=se.empty){const r=t.steps.length,s=this.ranges;for(let o=0;o<s.length;o++){const{$from:a,$to:l}=s[o],c=t.mapping.slice(r);t.replace(c.map(a.pos),c.map(l.pos),o?se.empty:n)}const i=Re.findFrom(t.doc.resolve(t.mapping.slice(r).map(this.to)),-1);i&&t.setSelection(i)}replaceWith(t,n){this.replace(t,new se(V.from(n),0,0))}forEachCell(t){const n=this.$anchorCell.node(-1),r=Ot.get(n),s=this.$anchorCell.start(-1),i=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let o=0;o<i.length;o++)t(n.nodeAt(i[o]),s+i[o])}isColSelection(){const t=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(t,n)>0)return!1;const r=t+this.$anchorCell.nodeAfter.attrs.rowspan,s=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),s=Ot.get(r),i=t.start(-1),o=s.findCell(t.pos-i),a=s.findCell(n.pos-i),l=t.node(0);return o.top<=a.top?(o.top>0&&(t=l.resolve(i+s.map[o.left])),a.bottom<s.height&&(n=l.resolve(i+s.map[s.width*(s.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(i+s.map[a.left])),o.bottom<s.height&&(t=l.resolve(i+s.map[s.width*(s.height-1)+o.right-1]))),new Wr(t,n)}isRowSelection(){const t=this.$anchorCell.node(-1),n=Ot.get(t),r=this.$anchorCell.start(-1),s=n.colCount(this.$anchorCell.pos-r),i=n.colCount(this.$headCell.pos-r);if(Math.min(s,i)>0)return!1;const o=s+this.$anchorCell.nodeAfter.attrs.colspan,a=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(o,a)==n.width}eq(t){return t instanceof Wr&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),s=Ot.get(r),i=t.start(-1),o=s.findCell(t.pos-i),a=s.findCell(n.pos-i),l=t.node(0);return o.left<=a.left?(o.left>0&&(t=l.resolve(i+s.map[o.top*s.width])),a.right<s.width&&(n=l.resolve(i+s.map[s.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(i+s.map[a.top*s.width])),o.right<s.width&&(t=l.resolve(i+s.map[s.width*(o.top+1)-1]))),new Wr(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new Wr(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new Wr(t.resolve(n),t.resolve(r))}getBookmark(){return new QW(this.$anchorCell.pos,this.$headCell.pos)}};vt.prototype.visible=!1;Re.jsonID("cell",vt);var QW=class $N{constructor(t,n){this.anchor=t,this.head=n}map(t){return new $N(t.map(this.anchor),t.map(this.head))}resolve(t){const n=t.resolve(this.anchor),r=t.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Pg(n,r)?new vt(n,r):Re.near(r,1)}};function e6(e){if(!(e.selection instanceof vt))return null;const t=[];return e.selection.forEachCell((n,r)=>{t.push(Wt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ft.create(e.doc,t)}function t6({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,s=e.depth;for(;s>=0&&!(e.after(s+1)<e.end(s));s--,n++);for(let i=t.depth;i>=0&&!(t.before(i+1)>t.start(i));i--,r--);return n==r&&/row|table/.test(e.node(s).type.spec.tableRole)}function n6({$from:e,$to:t}){let n,r;for(let s=e.depth;s>0;s--){const i=e.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){n=i;break}}for(let s=t.depth;s>0;s--){const i=t.node(s);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){r=i;break}}return n!==r&&t.parentOffset===0}function r6(e,t,n){const r=(t||e).selection,s=(t||e).doc;let i,o;if(r instanceof we&&(o=r.node.type.spec.tableRole)){if(o=="cell"||o=="header_cell")i=vt.create(s,r.from);else if(o=="row"){const a=s.resolve(r.from+1);i=vt.rowSelection(a,a)}else if(!n){const a=Ot.get(r.node),l=r.from+1,c=l+a.map[a.width*a.height-1];i=vt.create(s,l+1,c)}}else r instanceof Ce&&t6(r)?i=Ce.create(s,r.from):r instanceof Ce&&n6(r)&&(i=Ce.create(s,r.$from.start(),r.$from.end()));return i&&(t||(t=e.tr)).setSelection(i),t}var s6=new Lt("fix-tables");function UN(e,t,n,r){const s=e.childCount,i=t.childCount;e:for(let o=0,a=0;o<i;o++){const l=t.child(o);for(let c=a,u=Math.min(s,o+3);c<u;c++)if(e.child(c)==l){a=c+1,n+=l.nodeSize;continue e}r(l,n),a<s&&e.child(a).sameMarkup(l)?UN(e.child(a),l,n+1,r):l.nodesBetween(0,l.content.size,r,n+1),n+=l.nodeSize}}function HN(e,t){let n;const r=(s,i)=>{s.type.spec.tableRole=="table"&&(n=i6(e,s,i,n))};return t?t.doc!=e.doc&&UN(t.doc,e.doc,0,r):e.doc.descendants(r),n}function i6(e,t,n,r){const s=Ot.get(t);if(!s.problems)return r;r||(r=e.tr);const i=[];for(let l=0;l<s.height;l++)i.push(0);for(let l=0;l<s.problems.length;l++){const c=s.problems[l];if(c.type=="collision"){const u=t.nodeAt(c.pos);if(!u)continue;const d=u.attrs;for(let f=0;f<d.rowspan;f++)i[c.row+f]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Di(d,d.colspan-c.n,c.n))}else if(c.type=="missing")i[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const u=t.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const u=t.nodeAt(c.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...u.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const u=r.mapping.map(n);r.delete(u,u+t.nodeSize)}}let o,a;for(let l=0;l<i.length;l++)i[l]&&(o==null&&(o=l),a=l);for(let l=0,c=n+1;l<s.height;l++){const u=t.child(l),d=c+u.nodeSize,f=i[l];if(f>0){let p="cell";u.firstChild&&(p=u.firstChild.type.spec.tableRole);const m=[];for(let b=0;b<f;b++){const y=mn(e.schema)[p].createAndFill();y&&m.push(y)}const g=(l==0||o==l-1)&&a==l?c+1:d-1;r.insert(r.mapping.map(g),m)}c=d}return r.setMeta(s6,{fixTables:!0})}function jr(e){const t=e.selection,n=Fd(e),r=n.node(-1),s=n.start(-1),i=Ot.get(r);return{...t instanceof vt?i.rectBetween(t.$anchorCell.pos-s,t.$headCell.pos-s):i.findCell(n.pos-s),tableStart:s,map:i,table:r}}function VN(e,{map:t,tableStart:n,table:r},s){let i=s>0?-1:0;XW(t,r,s+i)&&(i=s==0||s==t.width?null:0);for(let o=0;o<t.height;o++){const a=o*t.width+s;if(s>0&&s<t.width&&t.map[a-1]==t.map[a]){const l=t.map[a],c=r.nodeAt(l);e.setNodeMarkup(e.mapping.map(n+l),null,BN(c.attrs,s-t.colCount(l))),o+=c.attrs.rowspan-1}else{const l=i==null?mn(r.type.schema).cell:r.nodeAt(t.map[a+i]).type,c=t.positionAt(o,s,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function o6(e,t){if(!kr(e))return!1;if(t){const n=jr(e);t(VN(e.tr,n,n.left))}return!0}function a6(e,t){if(!kr(e))return!1;if(t){const n=jr(e);t(VN(e.tr,n,n.right))}return!0}function l6(e,{map:t,table:n,tableStart:r},s){const i=e.mapping.maps.length;for(let o=0;o<t.height;){const a=o*t.width+s,l=t.map[a],c=n.nodeAt(l),u=c.attrs;if(s>0&&t.map[a-1]==l||s<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(i).map(r+l),null,Di(u,s-t.colCount(l)));else{const d=e.mapping.slice(i).map(r+l);e.delete(d,d+c.nodeSize)}o+=u.rowspan}}function c6(e,t){if(!kr(e))return!1;if(t){const n=jr(e),r=e.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let s=n.right-1;l6(r,n,s),s!=n.left;s--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=Ot.get(i)}t(r)}return!0}function u6(e,t,n){var r;const s=mn(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if(((r=t.nodeAt(e.map[i+n*e.width]))==null?void 0:r.type)!=s)return!1;return!0}function qN(e,{map:t,tableStart:n,table:r},s){var i;let o=n;for(let c=0;c<s;c++)o+=r.child(c).nodeSize;const a=[];let l=s>0?-1:0;u6(t,r,s+l)&&(l=s==0||s==t.height?null:0);for(let c=0,u=t.width*s;c<t.width;c++,u++)if(s>0&&s<t.height&&t.map[u]==t.map[u-t.width]){const d=t.map[u],f=r.nodeAt(d).attrs;e.setNodeMarkup(n+d,null,{...f,rowspan:f.rowspan+1}),c+=f.colspan-1}else{const d=l==null?mn(r.type.schema).cell:(i=r.nodeAt(t.map[u+l*t.width]))==null?void 0:i.type,f=d?.createAndFill();f&&a.push(f)}return e.insert(o,mn(r.type.schema).row.create(null,a)),e}function d6(e,t){if(!kr(e))return!1;if(t){const n=jr(e);t(qN(e.tr,n,n.top))}return!0}function f6(e,t){if(!kr(e))return!1;if(t){const n=jr(e);t(qN(e.tr,n,n.bottom))}return!0}function h6(e,{map:t,table:n,tableStart:r},s){let i=0;for(let c=0;c<s;c++)i+=n.child(c).nodeSize;const o=i+n.child(s).nodeSize,a=e.mapping.maps.length;e.delete(i+r,o+r);const l=new Set;for(let c=0,u=s*t.width;c<t.width;c++,u++){const d=t.map[u];if(!l.has(d)){if(l.add(d),s>0&&d==t.map[u-t.width]){const f=n.nodeAt(d).attrs;e.setNodeMarkup(e.mapping.slice(a).map(d+r),null,{...f,rowspan:f.rowspan-1}),c+=f.colspan-1}else if(s<t.height&&d==t.map[u+t.width]){const f=n.nodeAt(d),p=f.attrs,m=f.type.create({...p,rowspan:f.attrs.rowspan-1},f.content),g=t.positionAt(s+1,c,n);e.insert(e.mapping.slice(a).map(r+g),m),c+=p.colspan-1}}}}function p6(e,t){if(!kr(e))return!1;if(t){const n=jr(e),r=e.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let s=n.bottom-1;h6(r,n,s),s!=n.top;s--){const i=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!i)throw RangeError("No table found");n.table=i,n.map=Ot.get(n.table)}t(r)}return!0}function Sv(e){const t=e.content;return t.childCount==1&&t.child(0).isTextblock&&t.child(0).childCount==0}function m6({width:e,height:t,map:n},r){let s=r.top*e+r.left,i=s,o=(r.bottom-1)*e+r.left,a=s+(r.right-r.left-1);for(let l=r.top;l<r.bottom;l++){if(r.left>0&&n[i]==n[i-1]||r.right<e&&n[a]==n[a+1])return!0;i+=e,a+=e}for(let l=r.left;l<r.right;l++){if(r.top>0&&n[s]==n[s-e]||r.bottom<t&&n[o]==n[o+e])return!0;s++,o++}return!1}function Ev(e,t){const n=e.selection;if(!(n instanceof vt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=jr(e),{map:s}=r;if(m6(s,r))return!1;if(t){const i=e.tr,o={};let a=V.empty,l,c;for(let u=r.top;u<r.bottom;u++)for(let d=r.left;d<r.right;d++){const f=s.map[u*s.width+d],p=r.table.nodeAt(f);if(!(o[f]||!p))if(o[f]=!0,l==null)l=f,c=p;else{Sv(p)||(a=a.append(p.content));const m=i.mapping.map(f+r.tableStart);i.delete(m,m+p.nodeSize)}}if(l==null||c==null)return!0;if(i.setNodeMarkup(l+r.tableStart,null,{...BN(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),a.size){const u=l+1+c.content.size,d=Sv(c)?l+1:u;i.replaceWith(d+r.tableStart,u+r.tableStart,a)}i.setSelection(new vt(i.doc.resolve(l+r.tableStart))),t(i)}return!0}function Cv(e,t){const n=mn(e.schema);return g6(({node:r})=>n[r.type.spec.tableRole])(e,t)}function g6(e){return(t,n)=>{var r;const s=t.selection;let i,o;if(s instanceof vt){if(s.$anchorCell.pos!=s.$headCell.pos)return!1;i=s.$anchorCell.nodeAfter,o=s.$anchorCell.pos}else{if(i=JW(s.$from),!i)return!1;o=(r=Ho(s.$from))==null?void 0:r.pos}if(i==null||o==null||i.attrs.colspan==1&&i.attrs.rowspan==1)return!1;if(n){let a=i.attrs;const l=[],c=a.colwidth;a.rowspan>1&&(a={...a,rowspan:1}),a.colspan>1&&(a={...a,colspan:1});const u=jr(t),d=t.tr;for(let p=0;p<u.right-u.left;p++)l.push(c?{...a,colwidth:c&&c[p]?[c[p]]:null}:a);let f;for(let p=u.top;p<u.bottom;p++){let m=u.map.positionAt(p,u.left,u.table);p==u.top&&(m+=i.nodeSize);for(let g=u.left,b=0;g<u.right;g++,b++)g==u.left&&p==u.top||d.insert(f=d.mapping.map(m+u.tableStart,1),e({node:i,row:p,col:g}).createAndFill(l[b]))}d.setNodeMarkup(o,e({node:i,row:u.top,col:u.left}),l[0]),s instanceof vt&&d.setSelection(new vt(d.doc.resolve(s.$anchorCell.pos),f?d.doc.resolve(f):void 0)),n(d)}return!0}}function b6(e,t){return function(n,r){if(!kr(n))return!1;const s=Fd(n);if(s.nodeAfter.attrs[e]===t)return!1;if(r){const i=n.tr;n.selection instanceof vt?n.selection.forEachCell((o,a)=>{o.attrs[e]!==t&&i.setNodeMarkup(a,null,{...o.attrs,[e]:t})}):i.setNodeMarkup(s.pos,null,{...s.nodeAfter.attrs,[e]:t}),r(i)}return!0}}function y6(e){return function(t,n){if(!kr(t))return!1;if(n){const r=mn(t.schema),s=jr(t),i=t.tr,o=s.map.cellsInRect(e=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:e=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),a=o.map(l=>s.table.nodeAt(l));for(let l=0;l<o.length;l++)a[l].type==r.header_cell&&i.setNodeMarkup(s.tableStart+o[l],r.cell,a[l].attrs);if(i.steps.length==0)for(let l=0;l<o.length;l++)i.setNodeMarkup(s.tableStart+o[l],r.header_cell,a[l].attrs);n(i)}return!0}}function Nv(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:e=="row"?t.map.width:1,bottom:e=="column"?t.map.height:1});for(let s=0;s<r.length;s++){const i=t.table.nodeAt(r[s]);if(i&&i.type!==n.header_cell)return!1}return!0}function Ga(e,t){return t=t||{useDeprecatedLogic:!1},t.useDeprecatedLogic?y6(e):function(n,r){if(!kr(n))return!1;if(r){const s=mn(n.schema),i=jr(n),o=n.tr,a=Nv("row",i,s),l=Nv("column",i,s),u=(e==="column"?a:e==="row"?l:!1)?1:0,d=e=="column"?{left:0,top:u,right:1,bottom:i.map.height}:e=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,f=e=="column"?l?s.cell:s.header_cell:e=="row"?a?s.cell:s.header_cell:s.cell;i.map.cellsInRect(d).forEach(p=>{const m=p+i.tableStart,g=o.doc.nodeAt(m);g&&o.setNodeMarkup(m,f,g.attrs)}),r(o)}return!0}}Ga("row",{useDeprecatedLogic:!0});Ga("column",{useDeprecatedLogic:!0});var x6=Ga("cell",{useDeprecatedLogic:!0});function v6(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let r=e.index(-1)-1,s=e.before();r>=0;r--){const i=e.node(-1).child(r),o=i.lastChild;if(o)return s-1-o.nodeSize;s-=i.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const n=e.node(-1);for(let r=e.indexAfter(-1),s=e.after();r<n.childCount;r++){const i=n.child(r);if(i.childCount)return s+1;s+=i.nodeSize}}return null}function _v(e){return function(t,n){if(!kr(t))return!1;const r=v6(Fd(t),e);if(r==null)return!1;if(n){const s=t.doc.resolve(r);n(t.tr.setSelection(Ce.between(s,YW(s))).scrollIntoView())}return!0}}function w6(e,t){const n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function tc(e,t){const n=e.selection;if(!(n instanceof vt))return!1;if(t){const r=e.tr,s=mn(e.schema).cell.createAndFill().content;n.forEachCell((i,o)=>{i.content.eq(s)||r.replace(r.mapping.map(o+1),r.mapping.map(o+i.nodeSize-1),new se(s,0,0))}),r.docChanged&&t(r)}return!0}function k6(e){if(!e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;t.childCount==1&&(n>0&&r>0||t.child(0).type.spec.tableRole=="table");)n--,r--,t=t.child(0).content;const s=t.child(0),i=s.type.spec.tableRole,o=s.type.schema,a=[];if(i=="row")for(let l=0;l<t.childCount;l++){let c=t.child(l).content;const u=l?0:Math.max(0,n-1),d=l<t.childCount-1?0:Math.max(0,r-1);(u||d)&&(c=zp(mn(o).row,new se(c,u,d)).content),a.push(c)}else if(i=="cell"||i=="header_cell")a.push(n||r?zp(mn(o).row,new se(t,n,r)).content:t);else return null;return S6(o,a)}function S6(e,t){const n=[];for(let s=0;s<t.length;s++){const i=t[s];for(let o=i.childCount-1;o>=0;o--){const{rowspan:a,colspan:l}=i.child(o).attrs;for(let c=s;c<s+a;c++)n[c]=(n[c]||0)+l}}let r=0;for(let s=0;s<n.length;s++)r=Math.max(r,n[s]);for(let s=0;s<n.length;s++)if(s>=t.length&&t.push(V.empty),n[s]<r){const i=mn(e).cell.createAndFill(),o=[];for(let a=n[s];a<r;a++)o.push(i);t[s]=t[s].append(V.from(o))}return{height:t.length,width:r,rows:t}}function zp(e,t){const n=e.createAndFill();return new Om(n).replace(0,n.content.size,t).doc}function E6({width:e,height:t,rows:n},r,s){if(e!=r){const i=[],o=[];for(let a=0;a<n.length;a++){const l=n[a],c=[];for(let u=i[a]||0,d=0;u<r;d++){let f=l.child(d%l.childCount);u+f.attrs.colspan>r&&(f=f.type.createChecked(Di(f.attrs,f.attrs.colspan,u+f.attrs.colspan-r),f.content)),c.push(f),u+=f.attrs.colspan;for(let p=1;p<f.attrs.rowspan;p++)i[a+p]=(i[a+p]||0)+f.attrs.colspan}o.push(V.from(c))}n=o,e=r}if(t!=s){const i=[];for(let o=0,a=0;o<s;o++,a++){const l=[],c=n[a%t];for(let u=0;u<c.childCount;u++){let d=c.child(u);o+d.attrs.rowspan>s&&(d=d.type.create({...d.attrs,rowspan:Math.max(1,s-d.attrs.rowspan)},d.content)),l.push(d)}i.push(V.from(l))}n=i,t=s}return{width:e,height:t,rows:n}}function C6(e,t,n,r,s,i,o){const a=e.doc.type.schema,l=mn(a);let c,u;if(s>t.width)for(let d=0,f=0;d<t.height;d++){const p=n.child(d);f+=p.nodeSize;const m=[];let g;p.lastChild==null||p.lastChild.type==l.cell?g=c||(c=l.cell.createAndFill()):g=u||(u=l.header_cell.createAndFill());for(let b=t.width;b<s;b++)m.push(g);e.insert(e.mapping.slice(o).map(f-1+r),m)}if(i>t.height){const d=[];for(let m=0,g=(t.height-1)*t.width;m<Math.max(t.width,s);m++){const b=m>=t.width?!1:n.nodeAt(t.map[g+m]).type==l.header_cell;d.push(b?u||(u=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const f=l.row.create(null,V.from(d)),p=[];for(let m=t.height;m<i;m++)p.push(f);e.insert(e.mapping.slice(o).map(r+n.nodeSize-2),p)}return!!(c||u)}function Tv(e,t,n,r,s,i,o,a){if(o==0||o==t.height)return!1;let l=!1;for(let c=s;c<i;c++){const u=o*t.width+c,d=t.map[u];if(t.map[u-t.width]==d){l=!0;const f=n.nodeAt(d),{top:p,left:m}=t.findCell(d);e.setNodeMarkup(e.mapping.slice(a).map(d+r),null,{...f.attrs,rowspan:o-p}),e.insert(e.mapping.slice(a).map(t.positionAt(o,m,n)),f.type.createAndFill({...f.attrs,rowspan:p+f.attrs.rowspan-o})),c+=f.attrs.colspan-1}}return l}function Av(e,t,n,r,s,i,o,a){if(o==0||o==t.width)return!1;let l=!1;for(let c=s;c<i;c++){const u=c*t.width+o,d=t.map[u];if(t.map[u-1]==d){l=!0;const f=n.nodeAt(d),p=t.colCount(d),m=e.mapping.slice(a).map(d+r);e.setNodeMarkup(m,null,Di(f.attrs,o-p,f.attrs.colspan-(o-p))),e.insert(m+f.nodeSize,f.type.createAndFill(Di(f.attrs,0,o-p))),c+=f.attrs.rowspan-1}}return l}function Mv(e,t,n,r,s){let i=n?e.doc.nodeAt(n-1):e.doc;if(!i)throw new Error("No table found");let o=Ot.get(i);const{top:a,left:l}=r,c=l+s.width,u=a+s.height,d=e.tr;let f=0;function p(){if(i=n?d.doc.nodeAt(n-1):d.doc,!i)throw new Error("No table found");o=Ot.get(i),f=d.mapping.maps.length}C6(d,o,i,n,c,u,f)&&p(),Tv(d,o,i,n,l,c,a,f)&&p(),Tv(d,o,i,n,l,c,u,f)&&p(),Av(d,o,i,n,a,u,l,f)&&p(),Av(d,o,i,n,a,u,c,f)&&p();for(let m=a;m<u;m++){const g=o.positionAt(m,l,i),b=o.positionAt(m,c,i);d.replace(d.mapping.slice(f).map(g+n),d.mapping.slice(f).map(b+n),new se(s.rows[m-a],0,0))}p(),d.setSelection(new vt(d.doc.resolve(n+o.positionAt(a,l,i)),d.doc.resolve(n+o.positionAt(u-1,c-1,i)))),t(d)}var N6=Gm({ArrowLeft:nc("horiz",-1),ArrowRight:nc("horiz",1),ArrowUp:nc("vert",-1),ArrowDown:nc("vert",1),"Shift-ArrowLeft":rc("horiz",-1),"Shift-ArrowRight":rc("horiz",1),"Shift-ArrowUp":rc("vert",-1),"Shift-ArrowDown":rc("vert",1),Backspace:tc,"Mod-Backspace":tc,Delete:tc,"Mod-Delete":tc});function bc(e,t,n){return n.eq(e.selection)?!1:(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function nc(e,t){return(n,r,s)=>{if(!s)return!1;const i=n.selection;if(i instanceof vt)return bc(n,r,Re.near(i.$headCell,t));if(e!="horiz"&&!i.empty)return!1;const o=WN(s,e,t);if(o==null)return!1;if(e=="horiz")return bc(n,r,Re.near(n.doc.resolve(i.head+t),t));{const a=n.doc.resolve(o),l=FN(a,e,t);let c;return l?c=Re.near(l,1):t<0?c=Re.near(n.doc.resolve(a.before(-1)),-1):c=Re.near(n.doc.resolve(a.after(-1)),1),bc(n,r,c)}}}function rc(e,t){return(n,r,s)=>{if(!s)return!1;const i=n.selection;let o;if(i instanceof vt)o=i;else{const l=WN(s,e,t);if(l==null)return!1;o=new vt(n.doc.resolve(l))}const a=FN(o.$headCell,e,t);return a?bc(n,r,new vt(o.$anchorCell,a)):!1}}function _6(e,t){const n=e.state.doc,r=Ho(n.resolve(t));return r?(e.dispatch(e.state.tr.setSelection(new vt(r))),!0):!1}function T6(e,t,n){if(!kr(e.state))return!1;let r=k6(n);const s=e.state.selection;if(s instanceof vt){r||(r={width:1,height:1,rows:[V.from(zp(mn(e.state.schema).cell,n))]});const i=s.$anchorCell.node(-1),o=s.$anchorCell.start(-1),a=Ot.get(i).rectBetween(s.$anchorCell.pos-o,s.$headCell.pos-o);return r=E6(r,a.right-a.left,a.bottom-a.top),Mv(e.state,e.dispatch,o,a,r),!0}else if(r){const i=Fd(e.state),o=i.start(-1);return Mv(e.state,e.dispatch,o,Ot.get(i.node(-1)).findCell(i.pos-o),r),!0}else return!1}function A6(e,t){var n;if(t.ctrlKey||t.metaKey)return;const r=Rv(e,t.target);let s;if(t.shiftKey&&e.state.selection instanceof vt)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&(s=Ho(e.state.selection.$anchor))!=null&&((n=dh(e,t))==null?void 0:n.pos)!=s.pos)i(s,t),t.preventDefault();else if(!r)return;function i(l,c){let u=dh(e,c);const d=Cs.getState(e.state)==null;if(!u||!Pg(l,u))if(d)u=l;else return;const f=new vt(l,u);if(d||!e.state.selection.eq(f)){const p=e.state.tr.setSelection(f);d&&p.setMeta(Cs,l.pos),e.dispatch(p)}}function o(){e.root.removeEventListener("mouseup",o),e.root.removeEventListener("dragstart",o),e.root.removeEventListener("mousemove",a),Cs.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(Cs,-1))}function a(l){const c=l,u=Cs.getState(e.state);let d;if(u!=null)d=e.state.doc.resolve(u);else if(Rv(e,c.target)!=r&&(d=dh(e,t),!d))return o();d&&i(d,c)}e.root.addEventListener("mouseup",o),e.root.addEventListener("dragstart",o),e.root.addEventListener("mousemove",a)}function WN(e,t,n){if(!(e.state.selection instanceof Ce))return null;const{$head:r}=e.state.selection;for(let s=r.depth-1;s>=0;s--){const i=r.node(s);if((n<0?r.index(s):r.indexAfter(s))!=(n<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const a=r.before(s),l=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(l)?a:null}}return null}function Rv(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function dh(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});return n&&n?Ho(e.state.doc.resolve(n.pos)):null}var M6=class{constructor(t,n){this.node=t,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Fp(t,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,Fp(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function Fp(e,t,n,r,s,i){var o;let a=0,l=!0,c=t.firstChild;const u=e.firstChild;if(u){for(let d=0,f=0;d<u.childCount;d++){const{colspan:p,colwidth:m}=u.child(d).attrs;for(let g=0;g<p;g++,f++){const b=s==f?i:m&&m[g],y=b?b+"px":"";if(a+=b||r,b||(l=!1),c)c.style.width!=y&&(c.style.width=y),c=c.nextSibling;else{const w=document.createElement("col");w.style.width=y,t.appendChild(w)}}}for(;c;){const d=c.nextSibling;(o=c.parentNode)==null||o.removeChild(c),c=d}l?(n.style.width=a+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=a+"px")}}var Vn=new Lt("tableColumnResizing");function R6({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=M6,lastColumnResizable:s=!0}={}){const i=new Et({key:Vn,state:{init(o,a){var l,c;const u=(c=(l=i.spec)==null?void 0:l.props)==null?void 0:c.nodeViews,d=mn(a.schema).table.name;return r&&u&&(u[d]=(f,p)=>new r(f,n,p)),new O6(-1,!1)},apply(o,a){return a.apply(o)}},props:{attributes:o=>{const a=Vn.getState(o);return a&&a.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(o,a)=>{I6(o,a,e,s)},mouseleave:o=>{D6(o)},mousedown:(o,a)=>{L6(o,a,t,n)}},decorations:o=>{const a=Vn.getState(o);if(a&&a.activeHandle>-1)return B6(o,a.activeHandle)},nodeViews:{}}});return i}var O6=class yc{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,r=t.getMeta(Vn);if(r&&r.setHandle!=null)return new yc(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new yc(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let s=t.mapping.map(n.activeHandle,-1);return jp(t.doc.resolve(s))||(s=-1),new yc(s,n.dragging)}return n}};function I6(e,t,n,r){if(!e.editable)return;const s=Vn.getState(e.state);if(s&&!s.dragging){const i=j6(t.target);let o=-1;if(i){const{left:a,right:l}=i.getBoundingClientRect();t.clientX-a<=n?o=Ov(e,t,"left",n):l-t.clientX<=n&&(o=Ov(e,t,"right",n))}if(o!=s.activeHandle){if(!r&&o!==-1){const a=e.state.doc.resolve(o),l=a.node(-1),c=Ot.get(l),u=a.start(-1);if(c.colCount(a.pos-u)+a.nodeAfter.attrs.colspan-1==c.width-1)return}KN(e,o)}}}function D6(e){if(!e.editable)return;const t=Vn.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&KN(e,-1)}function L6(e,t,n,r){var s;if(!e.editable)return!1;const i=(s=e.dom.ownerDocument.defaultView)!=null?s:window,o=Vn.getState(e.state);if(!o||o.activeHandle==-1||o.dragging)return!1;const a=e.state.doc.nodeAt(o.activeHandle),l=P6(e,o.activeHandle,a.attrs);e.dispatch(e.state.tr.setMeta(Vn,{setDragging:{startX:t.clientX,startWidth:l}}));function c(d){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",u);const f=Vn.getState(e.state);f?.dragging&&(z6(e,f.activeHandle,Iv(f.dragging,d,n)),e.dispatch(e.state.tr.setMeta(Vn,{setDragging:null})))}function u(d){if(!d.which)return c(d);const f=Vn.getState(e.state);if(f&&f.dragging){const p=Iv(f.dragging,d,n);Dv(e,f.activeHandle,p,r)}}return Dv(e,o.activeHandle,l,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",u),t.preventDefault(),!0}function P6(e,t,{colspan:n,colwidth:r}){const s=r&&r[r.length-1];if(s)return s;const i=e.domAtPos(t);let a=i.node.childNodes[i.offset].offsetWidth,l=n;if(r)for(let c=0;c<n;c++)r[c]&&(a-=r[c],l--);return a/l}function j6(e){for(;e&&e.nodeName!="TD"&&e.nodeName!="TH";)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}function Ov(e,t,n,r){const s=n=="right"?-r:r,i=e.posAtCoords({left:t.clientX+s,top:t.clientY});if(!i)return-1;const{pos:o}=i,a=Ho(e.state.doc.resolve(o));if(!a)return-1;if(n=="right")return a.pos;const l=Ot.get(a.node(-1)),c=a.start(-1),u=l.map.indexOf(a.pos-c);return u%l.width==0?-1:c+l.map[u-1]}function Iv(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function KN(e,t){e.dispatch(e.state.tr.setMeta(Vn,{setHandle:t}))}function z6(e,t,n){const r=e.state.doc.resolve(t),s=r.node(-1),i=Ot.get(s),o=r.start(-1),a=i.colCount(r.pos-o)+r.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let c=0;c<i.height;c++){const u=c*i.width+a;if(c&&i.map[u]==i.map[u-i.width])continue;const d=i.map[u],f=s.nodeAt(d).attrs,p=f.colspan==1?0:a-i.colCount(d);if(f.colwidth&&f.colwidth[p]==n)continue;const m=f.colwidth?f.colwidth.slice():F6(f.colspan);m[p]=n,l.setNodeMarkup(o+d,null,{...f,colwidth:m})}l.docChanged&&e.dispatch(l)}function Dv(e,t,n,r){const s=e.state.doc.resolve(t),i=s.node(-1),o=s.start(-1),a=Ot.get(i).colCount(s.pos-o)+s.nodeAfter.attrs.colspan-1;let l=e.domAtPos(s.start(-1)).node;for(;l&&l.nodeName!="TABLE";)l=l.parentNode;l&&Fp(i,l.firstChild,l,r,a,n)}function F6(e){return Array(e).fill(0)}function B6(e,t){var n;const r=[],s=e.doc.resolve(t),i=s.node(-1);if(!i)return ft.empty;const o=Ot.get(i),a=s.start(-1),l=o.colCount(s.pos-a)+s.nodeAfter.attrs.colspan-1;for(let c=0;c<o.height;c++){const u=l+c*o.width;if((l==o.width-1||o.map[u]!=o.map[u+1])&&(c==0||o.map[u]!=o.map[u-o.width])){const d=o.map[u],f=a+d+i.nodeAt(d).nodeSize-1,p=document.createElement("div");p.className="column-resize-handle",(n=Vn.getState(e))!=null&&n.dragging&&r.push(Wt.node(a+d,a+d+i.nodeAt(d).nodeSize,{class:"column-resize-dragging"})),r.push(Wt.widget(f,p))}}return ft.create(e.doc,r)}function $6({allowTableNodeSelection:e=!1}={}){return new Et({key:Cs,state:{init(){return null},apply(t,n){const r=t.getMeta(Cs);if(r!=null)return r==-1?null:r;if(n==null||!t.docChanged)return n;const{deleted:s,pos:i}=t.mapping.mapResult(n);return s?null:i}},props:{decorations:e6,handleDOMEvents:{mousedown:A6},createSelectionBetween(t){return Cs.getState(t.state)!=null?t.state.selection:null},handleTripleClick:_6,handleKeyDown:N6,handlePaste:T6},appendTransaction(t,n,r){return r6(r,HN(r,n),e)}})}var GN=Kt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{var t,n;const r=e.getAttribute("colwidth"),s=r?r.split(",").map(i=>parseInt(i,10)):null;if(!s){const i=(t=e.closest("table"))==null?void 0:t.querySelectorAll("colgroup > col"),o=Array.from(((n=e.parentElement)==null?void 0:n.children)||[]).indexOf(e);if(o&&o>-1&&i&&i[o]){const a=i[o].getAttribute("width");return a?[parseInt(a,10)]:null}}return s}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",wt(this.options.HTMLAttributes,e),0]}}),JN=Kt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",wt(this.options.HTMLAttributes,e),0]}}),ZN=Kt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",wt(this.options.HTMLAttributes,e),0]}});function Bp(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function Lv(e,t,n,r,s,i){var o;let a=0,l=!0,c=t.firstChild;const u=e.firstChild;if(u!==null)for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:p,colwidth:m}=u.child(d).attrs;for(let g=0;g<p;g+=1,f+=1){const b=s===f?i:m&&m[g],y=b?`${b}px`:"";if(a+=b||r,b||(l=!1),c){if(c.style.width!==y){const[w,v]=Bp(r,b);c.style.setProperty(w,v)}c=c.nextSibling}else{const w=document.createElement("col"),[v,E]=Bp(r,b);w.style.setProperty(v,E),t.appendChild(w)}}}for(;c;){const d=c.nextSibling;(o=c.parentNode)==null||o.removeChild(c),c=d}l?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}var U6=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Lv(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,Lv(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){const t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!!(n&&!r&&(e.type==="attributes"||e.type==="childList"||e.type==="characterData"))}};function H6(e,t,n,r){let s=0,i=!0;const o=[],a=e.firstChild;if(!a)return{};for(let d=0,f=0;d<a.childCount;d+=1){const{colspan:p,colwidth:m}=a.child(d).attrs;for(let g=0;g<p;g+=1,f+=1){const b=n===f?r:m&&m[g];s+=b||t,b||(i=!1);const[y,w]=Bp(t,b);o.push(["col",{style:`${y}: ${w}`}])}}const l=i?`${s}px`:"",c=i?"":`${s}px`;return{colgroup:["colgroup",{},...o],tableWidth:l,tableMinWidth:c}}function Pv(e,t){return e.createAndFill()}function V6(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;const t={};return Object.keys(e.nodes).forEach(n=>{const r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}function q6(e,t,n,r,s){const i=V6(e),o=[],a=[];for(let c=0;c<n;c+=1){const u=Pv(i.cell);if(u&&a.push(u),r){const d=Pv(i.header_cell);d&&o.push(d)}}const l=[];for(let c=0;c<t;c+=1)l.push(i.row.createChecked(null,r&&c===0?o:a));return i.table.createChecked(null,l)}function W6(e){return e instanceof vt}var sc=({editor:e})=>{const{selection:t}=e.state;if(!W6(t))return!1;let n=0;const r=YE(t.ranges[0].$from,i=>i.type.name==="table");return r?.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1},K6="";function G6(e){return(e||"").replace(/\s+/g," ").trim()}function J6(e,t,n={}){var r;const s=(r=n.cellLineSeparator)!=null?r:K6;if(!e||!e.content||e.content.length===0)return"";const i=[];e.content.forEach(m=>{const g=[];m.content&&m.content.forEach(b=>{let y="";b.content&&Array.isArray(b.content)&&b.content.length>1?y=b.content.map(N=>t.renderChildren(N)).join(s):y=b.content?t.renderChildren(b.content):"";const w=G6(y),v=b.type==="tableHeader";g.push({text:w,isHeader:v})}),i.push(g)});const o=i.reduce((m,g)=>Math.max(m,g.length),0);if(o===0)return"";const a=new Array(o).fill(0);i.forEach(m=>{var g;for(let b=0;b<o;b+=1){const w=(((g=m[b])==null?void 0:g.text)||"").length;w>a[b]&&(a[b]=w),a[b]<3&&(a[b]=3)}});const l=(m,g)=>m+" ".repeat(Math.max(0,g-m.length)),c=i[0],u=c.some(m=>m.isHeader);let d=`
550
- `;const f=new Array(o).fill(0).map((m,g)=>u&&c[g]&&c[g].text||"");return d+=`| ${f.map((m,g)=>l(m,a[g])).join(" | ")} |
551
- `,d+=`| ${a.map(m=>"-".repeat(Math.max(3,m))).join(" | ")} |
552
- `,(u?i.slice(1):i).forEach(m=>{d+=`| ${new Array(o).fill(0).map((g,b)=>l(m[b]&&m[b].text||"",a[b])).join(" | ")} |
553
- `}),d}var Z6=J6,YN=Kt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:U6,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:e,HTMLAttributes:t}){const{colgroup:n,tableWidth:r,tableMinWidth:s}=H6(e,this.options.cellMinWidth);return["table",wt(this.options.HTMLAttributes,t,{style:r?`width: ${r}`:`min-width: ${s}`}),n,["tbody",0]]},parseMarkdown:(e,t)=>{const n=[];if(e.header){const r=[];e.header.forEach(s=>{r.push(t.createNode("tableHeader",{},[{type:"paragraph",content:t.parseInline(s.tokens)}]))}),n.push(t.createNode("tableRow",{},r))}return e.rows&&e.rows.forEach(r=>{const s=[];r.forEach(i=>{s.push(t.createNode("tableCell",{},[{type:"paragraph",content:t.parseInline(i.tokens)}]))}),n.push(t.createNode("tableRow",{},s))}),t.createNode("table",void 0,n)},renderMarkdown:(e,t)=>Z6(e,t),addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:s,editor:i})=>{const o=q6(i.schema,e,t,n);if(s){const a=r.selection.from+1;r.replaceSelectionWith(o).scrollIntoView().setSelection(Ce.near(r.doc.resolve(a)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>o6(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>a6(e,t),deleteColumn:()=>({state:e,dispatch:t})=>c6(e,t),addRowBefore:()=>({state:e,dispatch:t})=>d6(e,t),addRowAfter:()=>({state:e,dispatch:t})=>f6(e,t),deleteRow:()=>({state:e,dispatch:t})=>p6(e,t),deleteTable:()=>({state:e,dispatch:t})=>w6(e,t),mergeCells:()=>({state:e,dispatch:t})=>Ev(e,t),splitCell:()=>({state:e,dispatch:t})=>Cv(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>Ga("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>Ga("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>x6(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>Ev(e,t)?!0:Cv(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>b6(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>_v(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>_v(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&HN(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){const r=vt.create(t.doc,e.anchorCell,e.headCell);t.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:sc,"Mod-Backspace":sc,Delete:sc,"Mod-Delete":sc}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[R6({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],$6({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){const t={name:e.name,options:e.options,storage:e.storage};return{tableRole:rt(ke(e,"tableRole",t))}}});_t.create({name:"tableKit",addExtensions(){const e=[];return this.options.table!==!1&&e.push(YN.configure(this.options.table)),this.options.tableCell!==!1&&e.push(GN.configure(this.options.tableCell)),this.options.tableHeader!==!1&&e.push(JN.configure(this.options.tableHeader)),this.options.tableRow!==!1&&e.push(ZN.configure(this.options.tableRow)),e}});var Y6=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,X6=Kt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",wt(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,r,s,i,o;const a=(n=(t=e.attrs)==null?void 0:t.src)!=null?n:"",l=(s=(r=e.attrs)==null?void 0:r.alt)!=null?s:"",c=(o=(i=e.attrs)==null?void 0:i.title)!=null?o:"";return c?`![${l}](${a} "${c}")`:`![${l}](${a})`},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[xC({find:Y6,type:this.type,getAttributes:e=>{const[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),Q6=X6;function eK({editor:e,getPos:t}){const n=()=>{const o=t();if(typeof o=="number")try{const a=e.state.doc.resolve(o+1);let l=o+1;return a.node(a.depth).descendants((u,d)=>u.type.name==="tableCell"||u.type.name==="tableHeader"?(l=o+1+d+1,!1):!0),e.chain().focus().setTextSelection(l).run(),!0}catch(a){return console.error("Failed to select table cell:",a),!1}return!1},r=()=>{if(console.log("addRowBelow called"),n()){const o=e.chain().focus().addRowAfter().run();console.log("addRowAfter result:",o)}},s=()=>{if(console.log("addColumnRight called"),n()){const o=e.chain().focus().addColumnAfter().run();console.log("addColumnAfter result:",o)}},i=()=>{if(console.log("deleteTable called"),n()){const o=e.chain().focus().deleteTable().run();console.log("deleteTable result:",o)}};return h.jsxs(EC,{className:"group relative my-4 inline-block",children:[h.jsx("div",{className:"pointer-events-none absolute bottom-0 right-0 top-0 flex flex-col justify-center opacity-0 transition-opacity group-hover:opacity-100",children:h.jsx("div",{className:"pointer-events-auto flex flex-col gap-1",children:h.jsx(oe,{size:"sm",variant:"ghost",onClick:s,className:"h-5 w-5 bg-background/30 p-0 backdrop-blur-sm hover:bg-background/60",type:"button",children:h.jsx(Si,{className:"h-3 w-3"})})})}),h.jsx("div",{className:"pointer-events-none absolute -bottom-6 left-0 right-0 flex justify-center gap-2 opacity-0 transition-opacity group-hover:opacity-100",children:h.jsxs("div",{className:"pointer-events-auto flex gap-1",children:[h.jsx(oe,{size:"sm",variant:"ghost",onClick:r,className:"h-5 bg-background/30 px-2 text-xs backdrop-blur-sm hover:bg-background/60",type:"button",children:h.jsx(Si,{className:"h-3 w-3"})}),h.jsx(oe,{size:"sm",variant:"ghost",onClick:i,className:"h-5 bg-background/30 px-2 text-xs text-destructive backdrop-blur-sm hover:bg-background/60 hover:text-destructive",type:"button",children:h.jsx(Io,{className:"h-3 w-3"})})]})}),h.jsx(bB,{as:"table",className:"w-full table-auto border-collapse"})]})}function tK({node:e}){const{entityId:t,entityType:n,displayText:r,relationshipType:s}=e.attrs,i=()=>n==="issue"?`/issues/${t}`:`/specs/${t}`,o=()=>n==="issue"?h.jsx(lm,{className:"h-3 w-3"}):h.jsx(ss,{className:"h-3 w-3"}),a=()=>n==="issue"?"issue":"spec",l=r||t;return h.jsxs(EC,{as:"span",className:"inline-block",children:[h.jsx(Qp,{to:i(),className:"no-underline",contentEditable:!1,children:h.jsxs(st,{variant:a(),className:"inline-flex items-center gap-1",children:[o(),l]})}),s&&h.jsx("span",{className:"ml-1 text-xs text-muted-foreground",contentEditable:!1,children:s})]})}const nK=Kt.create({name:"entityMention",addOptions(){return{HTMLAttributes:{}}},inline:!0,group:"inline",atom:!0,addAttributes(){return{entityId:{default:null,parseHTML:e=>e.getAttribute("data-entity-id"),renderHTML:e=>e.entityId?{"data-entity-id":e.entityId}:{}},entityType:{default:null,parseHTML:e=>e.getAttribute("data-entity-type"),renderHTML:e=>e.entityType?{"data-entity-type":e.entityType}:{}},displayText:{default:null,parseHTML:e=>e.getAttribute("data-display-text"),renderHTML:e=>e.displayText?{"data-display-text":e.displayText}:{}},relationshipType:{default:null,parseHTML:e=>e.getAttribute("data-relationship-type"),renderHTML:e=>e.relationshipType?{"data-relationship-type":e.relationshipType}:{}}}},parseHTML(){return[{tag:"span[data-entity-id]"}]},renderHTML({node:e,HTMLAttributes:t}){return["span",wt({"data-entity-id":e.attrs.entityId},{"data-entity-type":e.attrs.entityType},this.options.HTMLAttributes,t),e.attrs.entityId]},addNodeView(){return CC(tK)},addCommands(){return{setEntityMention:e=>({commands:t})=>{const n=e.startsWith("ISSUE-")||e.startsWith("i-")?"issue":"spec";return t.insertContent({type:this.name,attrs:{entityId:e,entityType:n}})}}}}),rK=Xs.create({name:"feedbackHighlight",addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{feedbackId:{default:null,parseHTML:e=>e.getAttribute("data-feedback-id"),renderHTML:e=>e.feedbackId?{"data-feedback-id":e.feedbackId}:{}}}},parseHTML(){return[{tag:"mark[data-feedback-id]"}]},renderHTML({HTMLAttributes:e}){return["mark",{...this.options.HTMLAttributes,...e,class:"feedback-highlight bg-yellow-100 cursor-pointer hover:bg-yellow-200 transition-colors"},0]},addCommands(){return{setFeedbackHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleFeedbackHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetFeedbackHighlight:()=>({commands:e})=>e.unsetMark(this.name)}}});function sK(e){return e.replace(new RegExp("(?<!\\\\)\\[\\[((?:[is]-[0-9a-z]{4,8})|(?:[A-Z]+-\\d+))(?:\\|([^\\]]+))?\\]\\](?:\\{\\s*([^}]+)\\s*\\})?","g"),(t,n,r,s)=>{const i=n.startsWith("ISSUE-")||n.startsWith("i-")?"issue":"spec",o=r?.trim(),a=s?.trim();return`<span ${[`data-entity-id="${n}"`,`data-entity-type="${i}"`,o?`data-display-text="${fh(o)}"`:"",a?`data-relationship-type="${fh(a)}"`:""].filter(Boolean).join(" ")}>${fh(o||n)}</span>`})}function fh(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}const iK=P3(D3);function jv(){const e=new _u({headingStyle:"atx",codeBlockStyle:"fenced",bulletListMarker:"-",hr:"---",emDelimiter:"_",strongDelimiter:"**"});return e.addRule("strikethrough",{filter:["del","s"],replacement:t=>`~~${t}~~`}),e.addRule("table",{filter:"table",replacement:t=>`
554
- `+t+`
555
- `}),e.addRule("tableRow",{filter:"tr",replacement:(t,n)=>{const r="|"+t+`
556
- `,s=n.querySelectorAll("th");if(s.length>0){const i="|"+Array.from(s).map(()=>" --- |").join("")+`
557
- `;return r+i}return r}}),e.addRule("tableCell",{filter:["th","td"],replacement:t=>" "+t.trim()+" |"}),e.addRule("listItem",{filter:"li",replacement:(t,n)=>{t=t.trim().replace(/\n\n/g,`
558
- `);const r=n.parentNode;return r?(/ol/i.test(r.nodeName)?"1. ":"- ")+t.replace(/\n/g,`
559
- `)+`
560
- `:t}}),e.addRule("entityMention",{filter:t=>t.nodeName==="SPAN"&&t.hasAttribute("data-entity-id"),replacement:(t,n)=>{const r=n,s=r.getAttribute("data-entity-id"),i=r.getAttribute("data-display-text"),o=r.getAttribute("data-relationship-type");if(!s)return t;let a=`[[${s}`;return i&&(a+=`|${i}`),a+="]]",o&&(a+=`{ ${o} }`),a}}),e}const oK=_t.create({name:"tabHandler",addKeyboardShortcuts(){return{Tab:()=>{const{state:e}=this.editor,{$from:t}=e.selection,n=t.node(t.depth-1);return n&&n.type.name==="listItem"?this.editor.commands.sinkListItem("listItem"):this.editor.commands.insertContent(" ")},"Shift-Tab":()=>{const{state:e}=this.editor,{$from:t}=e.selection,n=t.node(t.depth-1);return n&&n.type.name==="listItem"?this.editor.commands.liftListItem("listItem"):!1}}}}),aK=_t.create({name:"lineNumbers",addGlobalAttributes(){return[{types:["heading","paragraph","codeBlock","blockquote","orderedList","bulletList"],attributes:{lineNumber:{default:null,parseHTML:e=>e.getAttribute("data-line-number"),renderHTML:e=>e.lineNumber?{"data-line-number":e.lineNumber}:{}}}}]}});function Bd({content:e,editable:t=!1,onSave:n,onChange:r,onCancel:s,className:i="",showToolbar:o=!1,feedback:a=[],onFeedbackClick:l,showLineNumbers:c=!1,selectedLine:u,onLineClick:d,placeholder:f}){const[p,m]=x.useState(""),[g,b]=x.useState(!1),y=x.useRef(!1),w=x.useRef(""),v=mB({extensions:[i4.configure({heading:{levels:[1,2,3,4,5,6],HTMLAttributes:{class:"font-bold"}},codeBlock:!1,code:{HTMLAttributes:{class:"bg-muted/50 rounded px-1.5 py-0.5 font-mono text-sm"}},blockquote:{HTMLAttributes:{class:"border-l-4 border-primary/50 pl-4 italic text-muted-foreground my-4"}},bulletList:!1,orderedList:!1,listItem:!1,listKeymap:!1}),f4.configure({lowlight:iK,HTMLAttributes:{class:"bg-muted/50 rounded-md p-4 font-mono text-sm my-4 overflow-x-auto"}}),h4.configure({placeholder:f,emptyEditorClass:"is-editor-empty"}),YN.extend({addNodeView(){return CC(eK)}}).configure({resizable:!0,HTMLAttributes:{class:"border-collapse table-auto w-full"}}),ZN,JN.configure({HTMLAttributes:{class:"border border-border bg-muted/50 px-4 py-2 text-left font-bold"}}),GN.configure({HTMLAttributes:{class:"border border-border px-4 py-2"}}),Q6.configure({HTMLAttributes:{class:"max-w-full h-auto rounded-md my-4"}}),T$,oK,aK,nK,rK],editable:t,content:p,onUpdate:({editor:A})=>{if(!y.current&&(b(!0),r)){const R=A.getHTML(),I=jv().turndown(R);I!==w.current&&(w.current=I,r(I))}}});x.useEffect(()=>{if(!e){m("");return}const A=sK(e);b1().use(O1).use(sN).use(fN,{allowDangerousHtml:!0}).use(vW,{allowDangerousHtml:!0}).process(A).then(R=>{m(String(R))}).catch(R=>{console.error("Failed to convert markdown to HTML:",R),m(`<pre>${e}</pre>`)})},[e]),x.useEffect(()=>{v&&p&&(v.isFocused||(y.current=!0,v.commands.setContent(p),b(!1),w.current=e,setTimeout(()=>{y.current=!1},100)))},[p,v,e]),x.useEffect(()=>{v&&v.setEditable(t)},[t,v]),x.useEffect(()=>{if(!v||!l)return;const A=T=>{const O=T.target.closest("[data-feedback-id]");if(O){const j=O.getAttribute("data-feedback-id");j&&l(j)}},R=v.view.dom;return R.addEventListener("click",A),()=>{R.removeEventListener("click",A)}},[v,l]),x.useEffect(()=>{if(!v||!c||!e)return;const A=()=>{const T=VW(e),{state:I}=v,{tr:O}=I;let j=0;I.doc.descendants((L,F,q)=>{if(q===I.doc&&L.isBlock){const te=T[j]||j+1;return O.setNodeMarkup(F,void 0,{...L.attrs,lineNumber:String(te)}),j++,!1}return!0}),O.docChanged&&v.view.dispatch(O)},R=setTimeout(()=>{A()},100);return()=>{clearTimeout(R)}},[v,c,e]),x.useEffect(()=>{if(!v||!c)return;const A=T=>{const O=T.target.closest(".ProseMirror > *");if(!O)return;const j=parseInt(O.getAttribute("data-line-number")||"0");j>0&&d&&d(j)},R=v.view.dom;return R.addEventListener("click",A),()=>{R.removeEventListener("click",A)}},[v,c,d]),x.useEffect(()=>{if(!v||!c)return;const A=v.view.dom.querySelectorAll(".ProseMirror > *");A.forEach(R=>R.classList.remove("selected-line")),u&&u>0&&A.forEach(R=>{parseInt(R.getAttribute("data-line-number")||"0")===u&&R.classList.add("selected-line")})},[v,c,u]);const E=()=>{if(!v||!n)return;const A=v.getHTML(),T=jv().turndown(A);n(T),b(!1)},N=()=>{v&&(v.commands.setContent(p),b(!1)),s?.()},k=()=>{const A=window.prompt("Enter image URL:");A&&v&&v.chain().focus().setImage({src:A}).run()},C=()=>{v&&v.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run()};return v?h.jsxs("div",{className:i,children:[t&&o&&h.jsxs("div",{className:"flex flex-wrap items-center gap-1 border-b border-border bg-muted/30 px-4 py-2",children:[h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleBold().run(),className:v.isActive("bold")?"bg-muted":"",type:"button",children:h.jsx(rA,{className:"h-4 w-4"})}),h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleItalic().run(),className:v.isActive("italic")?"bg-muted":"",type:"button",children:h.jsx(mA,{className:"h-4 w-4"})}),h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleCode().run(),className:v.isActive("code")?"bg-muted":"",type:"button",children:h.jsx(oA,{className:"h-4 w-4"})}),h.jsx("div",{className:"mx-1 h-6 w-px bg-border"}),h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleHeading({level:1}).run(),className:v.isActive("heading",{level:1})?"bg-muted":"",type:"button",children:h.jsx(uA,{className:"h-4 w-4"})}),h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleHeading({level:2}).run(),className:v.isActive("heading",{level:2})?"bg-muted":"",type:"button",children:h.jsx(dA,{className:"h-4 w-4"})}),h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleHeading({level:3}).run(),className:v.isActive("heading",{level:3})?"bg-muted":"",type:"button",children:h.jsx(fA,{className:"h-4 w-4"})}),h.jsx("div",{className:"mx-1 h-6 w-px bg-border"}),h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleBulletList().run(),className:v.isActive("bulletList")?"bg-muted":"",type:"button",children:h.jsx(yA,{className:"h-4 w-4"})}),h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleOrderedList().run(),className:v.isActive("orderedList")?"bg-muted":"",type:"button",children:h.jsx(gA,{className:"h-4 w-4"})}),h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleBlockquote().run(),className:v.isActive("blockquote")?"bg-muted":"",type:"button",children:h.jsx(EA,{className:"h-4 w-4"})}),h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().toggleCodeBlock().run(),className:v.isActive("codeBlock")?"bg-muted":"",type:"button",children:h.jsx(iA,{className:"h-4 w-4"})}),h.jsx("div",{className:"mx-1 h-6 w-px bg-border"}),h.jsx(oe,{variant:"ghost",size:"sm",onClick:C,className:v.isActive("table")?"bg-muted":"",type:"button",children:h.jsx(_A,{className:"h-4 w-4"})}),h.jsx(oe,{variant:"ghost",size:"sm",onClick:k,type:"button",children:h.jsx(hA,{className:"h-4 w-4"})}),h.jsx("div",{className:"mx-1 h-6 w-px bg-border"}),h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().undo().run(),disabled:!v.can().undo(),type:"button",children:h.jsx(TA,{className:"h-4 w-4"})}),h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>v.chain().focus().redo().run(),disabled:!v.can().redo(),type:"button",children:h.jsx(CA,{className:"h-4 w-4"})}),h.jsx("div",{className:"flex-1"}),h.jsx(oe,{variant:"outline",size:"sm",onClick:N,type:"button",children:"Cancel"}),h.jsx(oe,{variant:"default",size:"sm",onClick:E,disabled:!g,type:"button",children:"Save"})]}),h.jsx("div",{className:`p-6 ${c?"tiptap-with-line-numbers":""}`,children:h.jsx(lB,{editor:v,className:"tiptap-editor prose prose-sm dark:prose-invert max-w-none"})})]}):h.jsx("div",{className:i,children:h.jsxs("div",{className:"animate-pulse",children:[h.jsx("div",{className:"mb-2 h-4 w-3/4 rounded bg-muted"}),h.jsx("div",{className:"mb-2 h-4 w-1/2 rounded bg-muted"}),h.jsx("div",{className:"h-4 w-5/6 rounded bg-muted"})]})})}const zv="sudocode:details:viewMode",Fv="sudocode:issue:descriptionCollapsed",lK=[{value:"open",label:"Open"},{value:"in_progress",label:"In Progress"},{value:"blocked",label:"Blocked"},{value:"needs_review",label:"Needs Review"},{value:"closed",label:"Closed"}],cK=[{value:"0",label:"Critical (P0)"},{value:"1",label:"High (P1)"},{value:"2",label:"Medium (P2)"},{value:"3",label:"Low (P3)"},{value:"4",label:"None (P4)"}];function jg({issue:e,onClose:t,onUpdate:n,onDelete:r,onArchive:s,onUnarchive:i,isUpdating:o=!1,isDeleting:a=!1,showOpenDetail:l=!1,hideTopControls:c=!1,viewMode:u,onViewModeChange:d,showViewToggleInline:f=!0}){const p=cr(),[m,g]=x.useState(e.title),[b,y]=x.useState(e.content||""),[w,v]=x.useState(e.status),[E,N]=x.useState(()=>{const ie=localStorage.getItem(zv);return ie!==null?JSON.parse(ie):"formatted"}),[k,C]=x.useState(()=>{const ie=localStorage.getItem(Fv);return ie!==null?JSON.parse(ie):!1}),A=x.useRef(null),R=u??E,T=ie=>{d?d(ie):N(ie)},[I,O]=x.useState(e.priority),[j,L]=x.useState(!1),[F,q]=x.useState(!1),[te,K]=x.useState([]),[le,_]=x.useState(!1),[ae,me]=x.useState(!1),[S,B]=x.useState(!1),$=x.useRef(null),D=x.useRef(null),{createRelationshipAsync:P,deleteRelationshipAsync:W}=QL(),fe=x.useRef(n),ee=x.useRef({title:m,content:b,status:w,priority:I,hasChanges:S});x.useEffect(()=>{fe.current=n},[n]),x.useEffect(()=>{ee.current={title:m,content:b,status:w,priority:I,hasChanges:S}},[m,b,w,I,S]),x.useEffect(()=>{D.current&&(clearTimeout(D.current),D.current=null),B(!1)},[e.id]),x.useEffect(()=>{u||localStorage.setItem(zv,JSON.stringify(E))},[E,u]),x.useEffect(()=>{localStorage.setItem(Fv,JSON.stringify(k))},[k]),x.useEffect(()=>{g(e.title),y(e.content||""),v(e.status),O(e.priority),B(!1)},[e]),x.useEffect(()=>{(async()=>{me(!0);try{const je=await co.getForEntity(e.id,"issue");let it=[];if(Array.isArray(je))it=je;else if(je&&typeof je=="object"&&"outgoing"in je&&"incoming"in je){const tt=je;it=[...tt.outgoing||[],...tt.incoming||[]]}K(it)}catch(je){console.error("Failed to fetch relationships:",je),K([])}finally{me(!1)}})()},[e.id]),x.useEffect(()=>{const ie=je=>{if(!$.current||!t)return;const it=je.target;if($.current.contains(it))return;const tt=it;if(tt.closest("[data-issue-id]")||tt.closest("[data-panel-resize-handle-id]")||tt.classList?.contains("cursor-col-resize"))return;const us=tt.closest('[role="dialog"]'),U=tt.closest('[role="alertdialog"]'),G=tt.closest('[role="listbox"]'),Se=tt.closest("[data-radix-popper-content-wrapper]");if(us||U||G||Se)return;const Ie=tt.closest(".ProseMirror"),Ze=tt.closest(".tiptap-editor"),Ct=tt.closest("[data-tippy-root]"),An=tt.closest(".tippy-box");Ie||Ze||Ct||An||t()};return document.addEventListener("mousedown",ie),()=>{document.removeEventListener("mousedown",ie)}},[t]),x.useEffect(()=>{const ie=je=>{t&&(j||F||le||je.key==="Escape"&&t())};return document.addEventListener("keydown",ie),()=>{document.removeEventListener("keydown",ie)}},[t,j,F,le]),x.useEffect(()=>{if(!(!S||!fe.current))return D.current&&clearTimeout(D.current),D.current=setTimeout(()=>{fe.current?.({title:m,content:b,status:w,priority:I}),B(!1)},1e3),()=>{D.current&&clearTimeout(D.current)}},[m,b,w,I,S]),x.useEffect(()=>()=>{const{hasChanges:ie,title:je,content:it,status:tt,priority:Gn}=ee.current;ie&&fe.current&&fe.current({title:je,content:it,status:tt,priority:Gn})},[]),x.useEffect(()=>{if(R==="markdown"&&A.current){const ie=A.current;ie.style.height="auto",ie.style.height=`${ie.scrollHeight}px`}},[b,R]);const be=ie=>{g(ie),B(!0)},Me=ie=>{y(ie),B(!0)},Le=ie=>{v(ie),B(!0)},Ke=ie=>{O(ie),B(!0)},ce=()=>{r?.(),L(!1)},ne=async(ie,je,it)=>{try{const tt=await P({from_id:e.id,from_type:"issue",to_id:ie,to_type:je,relationship_type:it});K([...te,tt]),_(!1)}catch(tt){console.error("Failed to create relationship:",tt)}},et=async ie=>{try{await W({from_id:ie.from_id,from_type:ie.from_type,to_id:ie.to_id,to_type:ie.to_type,relationship_type:ie.relationship_type}),K(te.filter(je=>!(je.from_id===ie.from_id&&je.to_id===ie.to_id&&je.relationship_type===ie.relationship_type)))}catch(je){console.error("Failed to delete relationship:",je)}},We=async(ie,je)=>{try{const it=await Xn.create(e.id,{config:ie,prompt:je});q(!1),p(`/executions/${it.id}`)}catch(it){console.error("Failed to create execution:",it)}};return h.jsx(Ei,{delayDuration:300,children:h.jsxs("div",{className:"flex h-full flex-col",ref:$,children:[!c&&h.jsxs("div",{className:"flex items-center justify-between px-6 py-3",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[t&&h.jsxs(rr,{children:[h.jsx(sr,{asChild:!0,children:h.jsx("button",{onClick:t,className:"text-muted-foreground hover:text-foreground","aria-label":"Back",children:h.jsx(Hu,{className:"h-4 w-4"})})}),h.jsx(Un,{children:"Close (ESC)"})]}),l&&h.jsxs(rr,{children:[h.jsx(sr,{asChild:!0,children:h.jsx("button",{onClick:()=>p(`/issues/${e.id}`),className:"text-muted-foreground hover:text-foreground","aria-label":"Open in full page",children:h.jsx(aA,{className:"h-4 w-4"})})}),h.jsx(Un,{children:"Open in full page"})]})]}),h.jsxs("div",{className:"flex items-center gap-4",children:[f&&h.jsxs("div",{className:"mr-4 flex gap-1 rounded-md border border-border bg-muted/30 p-1",children:[h.jsxs(oe,{variant:R==="formatted"?"outline":"ghost",size:"sm",onClick:()=>T("formatted"),className:`h-7 rounded-sm ${R==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[h.jsx(ss,{className:"mr-2 h-4 w-4"}),"Formatted"]}),h.jsxs(oe,{variant:R==="markdown"?"outline":"ghost",size:"sm",onClick:()=>T("markdown"),className:`h-7 rounded-sm ${R==="markdown"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[h.jsx(rl,{className:"mr-2 h-4 w-4"}),"Markdown"]})]}),(s||i)&&h.jsxs(rr,{children:[h.jsx(sr,{asChild:!0,children:h.jsx("button",{onClick:()=>e.archived?i?.(e.id):s?.(e.id),className:"text-muted-foreground hover:text-foreground","aria-label":e.archived?"Unarchive":"Archive",disabled:o,children:e.archived?h.jsx(im,{className:"h-4 w-4"}):h.jsx(Oo,{className:"h-4 w-4"})})}),h.jsx(Un,{children:e.archived?"Unarchive":"Archive"})]}),r&&h.jsxs(rr,{children:[h.jsx(sr,{asChild:!0,children:h.jsx("button",{onClick:()=>L(!0),className:"text-muted-foreground hover:text-destructive","aria-label":"Delete",disabled:o||a,children:h.jsx(Io,{className:"h-4 w-4"})})}),h.jsx(Un,{children:"Delete issue"})]})]})]}),h.jsx("div",{className:`flex-1 overflow-y-auto px-6 ${c?"py-4":"py-3"}`,children:h.jsxs("div",{className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2 pb-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(st,{variant:"issue",className:"font-mono",children:e.id}),n&&h.jsx("div",{className:"text-xs italic text-muted-foreground",children:o?"Saving...":S?"Unsaved changes...":"All changes saved"})]}),h.jsx(is,{value:m,onChange:ie=>be(ie.target.value),placeholder:"Issue title...",disabled:o,className:"border-none bg-transparent px-0 text-2xl font-semibold shadow-none focus-visible:ring-0"})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(sA,{className:"h-4 w-4 text-muted-foreground"}),h.jsxs(Sn,{value:w,onValueChange:ie=>Le(ie),disabled:o,children:[h.jsx(dn,{className:"h-8 w-auto gap-3 rounded-md border-none bg-accent px-3 shadow-none hover:bg-accent/80",children:h.jsx(En,{placeholder:"Status"})}),h.jsx(fn,{children:lK.map(ie=>h.jsx(xt,{value:ie.value,children:ie.label},ie.value))})]})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Jw,{className:"h-4 w-4 text-muted-foreground"}),h.jsxs(Sn,{value:String(I),onValueChange:ie=>Ke(parseInt(ie)),disabled:o,children:[h.jsx(dn,{className:"h-8 w-auto gap-3 rounded-md border-none bg-accent px-3 shadow-none hover:bg-accent/80",children:h.jsx(En,{placeholder:"Priority"})}),h.jsx(fn,{children:cK.map(ie=>h.jsx(xt,{value:ie.value,children:ie.label},ie.value))})]})]}),e.parent_id&&h.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[h.jsx(lm,{className:"h-4 w-4"}),h.jsx("span",{children:e.parent_id})]}),h.jsx("div",{className:"ml-auto text-xs text-muted-foreground",children:e.closed_at?`Closed ${Mc(new Date(e.closed_at.endsWith("Z")?e.closed_at:e.closed_at+"Z"),{addSuffix:!0})}`:`Updated ${Mc(new Date(e.updated_at.endsWith("Z")?e.updated_at:e.updated_at+"Z"),{addSuffix:!0})}`})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsxs("div",{className:"flex items-center gap-1",children:[h.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Relationships"}),h.jsx(st,{variant:"secondary",children:te.length})]}),h.jsxs(oe,{variant:"outline",size:"xs",onClick:()=>_(!le),className:"h-6",children:[h.jsx(Si,{className:"mr-1 h-4 w-4"}),"Add"]})]}),le&&h.jsx("div",{className:"rounded-lg border p-4",children:h.jsx(hS,{fromId:e.id,fromType:"issue",onSubmit:ne,onCancel:()=>_(!1)})}),ae?h.jsx("div",{className:"py-4 text-center text-sm text-muted-foreground",children:"Loading relationships..."}):h.jsx(uS,{relationships:te,currentEntityId:e.id,currentEntityType:"issue",onDelete:et,showEmpty:!1,showGroupHeaders:!1})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Description"}),h.jsx(oe,{variant:"ghost",size:"xs",onClick:()=>C(!k),className:"h-6 gap-1 text-muted-foreground",children:k?h.jsxs(h.Fragment,{children:[h.jsx(Aa,{className:"h-4 w-4"}),"Expand"]}):h.jsxs(h.Fragment,{children:[h.jsx(am,{className:"h-4 w-4"}),"Collapse"]})})]}),h.jsxs("div",{className:"relative",children:[h.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-in-out ${k?"max-h-[200px] cursor-pointer 2xl:max-h-[300px]":""}`,onClick:()=>{k&&C(!1)},children:h.jsx(It,{className:"overflow-hidden rounded-md border",children:R==="formatted"?h.jsx(Bd,{content:b,editable:!k,onChange:Me,onCancel:()=>{y(e.content||""),B(!1)},className:"min-h-[200px]",placeholder:"Issue description..."}):h.jsx("div",{className:"p-4",children:h.jsx("textarea",{ref:A,value:b,onChange:ie=>Me(ie.target.value),placeholder:"Issue description in markdown...",className:"w-full resize-none border-none bg-transparent font-mono text-sm leading-6 outline-none focus:ring-0",spellCheck:!1,disabled:k,style:{minHeight:"200px"}})})})}),k&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:"pointer-events-none absolute bottom-0 left-0 right-0 h-16 bg-gradient-to-t from-background to-transparent"}),h.jsx("div",{className:"absolute bottom-2 left-1/2 -translate-x-1/2",children:h.jsxs(oe,{variant:"outline",size:"sm",onClick:ie=>{ie.stopPropagation(),C(!1)},className:"gap-1 shadow-sm",children:[h.jsx(Aa,{className:"h-4 w-4"}),"Expand"]})})]})]})]}),e.assignee&&h.jsx("div",{className:"border-t pt-4",children:h.jsxs("div",{className:"text-sm",children:[h.jsx("span",{className:"text-muted-foreground",children:"Assignee: "}),h.jsx("span",{children:e.assignee})]})}),h.jsx(XL,{issueId:e.id})]})}),h.jsx("div",{className:"border-t bg-background px-6 py-3",children:h.jsx("div",{className:"flex items-center justify-end gap-3",children:h.jsxs(rr,{children:[h.jsx(sr,{asChild:!0,children:h.jsxs(oe,{onClick:()=>q(!0),disabled:e.archived||o,variant:"default",size:"xs",className:"gap-2",children:[h.jsx(SA,{className:"h-4 w-4"}),"Run Agent"]})}),h.jsx(Un,{children:"Configure and start agent execution"})]})})}),h.jsx(lS,{issue:e,isOpen:j,onClose:()=>L(!1),onConfirm:ce,isDeleting:a}),h.jsx(GL,{issueId:e.id,open:F,onStart:We,onCancel:()=>q(!1)})]})})}const Bv="sudocode:issueEditor:viewMode",uK=[{value:"open",label:"Open"},{value:"in_progress",label:"In Progress"},{value:"blocked",label:"Blocked"},{value:"needs_review",label:"Needs Review"},{value:"closed",label:"Closed"}],dK=[{value:"0",label:"Critical (P0)"},{value:"1",label:"High (P1)"},{value:"2",label:"Medium (P2)"},{value:"3",label:"Low (P3)"},{value:"4",label:"None (P4)"}];function fK({issue:e,onSave:t,onCancel:n,isLoading:r=!1}){const[s,i]=x.useState(e?.title||""),[o,a]=x.useState(e?.content||""),[l,c]=x.useState(e?.status||"open"),[u,d]=x.useState(e?.priority??2),[f,p]=x.useState({}),[m,g]=x.useState(()=>{const v=localStorage.getItem(Bv);return v!==null?JSON.parse(v):"formatted"}),b=x.useRef(null);x.useEffect(()=>{e&&(i(e.title),a(e.content||""),c(e.status),d(e.priority))},[e]),x.useEffect(()=>{localStorage.setItem(Bv,JSON.stringify(m))},[m]),x.useEffect(()=>{if(m==="markdown"&&b.current){const v=b.current;v.style.height="auto",v.style.height=`${v.scrollHeight}px`}},[o,m]);const y=()=>{const v={};return s.trim()?s.length>200&&(v.title="Title must be less than 200 characters"):v.title="Title is required",p(v),Object.keys(v).length===0},w=v=>{v.preventDefault(),y()&&t({title:s,content:o,status:l,priority:u})};return h.jsxs("form",{onSubmit:w,className:"space-y-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsxs(Ht,{htmlFor:"title",children:["Title ",h.jsx("span",{className:"text-destructive",children:"*"})]}),h.jsx(is,{id:"title",value:s,onChange:v=>i(v.target.value),placeholder:"Enter issue title...",className:f.title?"border-destructive":"",disabled:r}),f.title&&h.jsx("p",{className:"text-sm text-destructive",children:f.title})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx(Ht,{htmlFor:"content",children:"Details"}),h.jsxs("div",{className:"flex gap-1 rounded-md border border-border bg-muted/30 p-1",children:[h.jsxs(oe,{variant:m==="formatted"?"outline":"ghost",size:"sm",onClick:()=>g("formatted"),className:`h-7 rounded-sm ${m==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,type:"button",children:[h.jsx(ss,{className:"mr-2 h-4 w-4"}),"Formatted"]}),h.jsxs(oe,{variant:m==="markdown"?"outline":"ghost",size:"sm",onClick:()=>g("markdown"),className:`h-7 rounded-sm ${m==="markdown"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,type:"button",children:[h.jsx(rl,{className:"mr-2 h-4 w-4"}),"Markdown"]})]})]}),h.jsx(It,{className:"overflow-hidden rounded-md border",children:m==="formatted"?h.jsx(Bd,{content:o,editable:!0,onChange:v=>a(v),onSave:v=>a(v),onCancel:()=>{e&&a(e.content||"")},className:"min-h-[300px]",placeholder:"Issue description..."}):h.jsx("div",{className:"p-4",children:h.jsx("textarea",{ref:b,value:o,onChange:v=>a(v.target.value),placeholder:"Issue description in markdown...",className:"w-full resize-none border-none bg-transparent font-mono text-sm leading-6 outline-none focus:ring-0",spellCheck:!1,style:{minHeight:"300px"},disabled:r})})})]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ht,{htmlFor:"status",children:"Status"}),h.jsxs(Sn,{value:l,onValueChange:v=>c(v),disabled:r,children:[h.jsx(dn,{id:"status",children:h.jsx(En,{placeholder:"Select status"})}),h.jsx(fn,{children:uK.map(v=>h.jsx(xt,{value:v.value,children:v.label},v.value))})]})]}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ht,{htmlFor:"priority",children:"Priority"}),h.jsxs(Sn,{value:String(u),onValueChange:v=>d(parseInt(v)),disabled:r,children:[h.jsx(dn,{id:"priority",children:h.jsx(En,{placeholder:"Select priority"})}),h.jsx(fn,{children:dK.map(v=>h.jsx(xt,{value:v.value,children:v.label},v.value))})]})]})]}),h.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[h.jsx(oe,{type:"button",variant:"outline",onClick:n,disabled:r,children:"Cancel"}),h.jsx(oe,{type:"submit",disabled:r,children:r?"Saving...":e?"Update Issue":"Create Issue"})]})]})}function hK({isOpen:e,onClose:t,onCreate:n,isCreating:r=!1,defaultStatus:s}){const[i,o]=x.useState(!1),a=c=>{n(c),o(!1)},l=()=>{i&&!window.confirm("You have unsaved changes. Are you sure you want to close?")||(o(!1),t())};return h.jsx(Bi,{open:e,onOpenChange:l,children:h.jsxs(qs,{className:"max-h-[90vh] max-w-2xl overflow-y-auto",children:[h.jsx(Ws,{children:h.jsx(Ks,{children:"Create New Issue"})}),h.jsx(fK,{issue:s?{status:s,priority:2}:null,onSave:a,onCancel:l,isLoading:r})]})})}const $d=x.createContext(null);$d.displayName="PanelGroupContext";const Rt={group:"data-panel-group",groupDirection:"data-panel-group-direction",groupId:"data-panel-group-id",panel:"data-panel",panelCollapsible:"data-panel-collapsible",panelId:"data-panel-id",panelSize:"data-panel-size",resizeHandle:"data-resize-handle",resizeHandleActive:"data-resize-handle-active",resizeHandleEnabled:"data-panel-resize-handle-enabled",resizeHandleId:"data-panel-resize-handle-id",resizeHandleState:"data-resize-handle-state"},zg=10,xi=x.useLayoutEffect,$v=lT.useId,pK=typeof $v=="function"?$v:()=>null;let mK=0;function Fg(e=null){const t=pK(),n=x.useRef(e||t||null);return n.current===null&&(n.current=""+mK++),e??n.current}function XN({children:e,className:t="",collapsedSize:n,collapsible:r,defaultSize:s,forwardedRef:i,id:o,maxSize:a,minSize:l,onCollapse:c,onExpand:u,onResize:d,order:f,style:p,tagName:m="div",...g}){const b=x.useContext($d);if(b===null)throw Error("Panel components must be rendered within a PanelGroup container");const{collapsePanel:y,expandPanel:w,getPanelSize:v,getPanelStyle:E,groupId:N,isPanelCollapsed:k,reevaluatePanelConstraints:C,registerPanel:A,resizePanel:R,unregisterPanel:T}=b,I=Fg(o),O=x.useRef({callbacks:{onCollapse:c,onExpand:u,onResize:d},constraints:{collapsedSize:n,collapsible:r,defaultSize:s,maxSize:a,minSize:l},id:I,idIsFromProps:o!==void 0,order:f});x.useRef({didLogMissingDefaultSizeWarning:!1}),xi(()=>{const{callbacks:L,constraints:F}=O.current,q={...F};O.current.id=I,O.current.idIsFromProps=o!==void 0,O.current.order=f,L.onCollapse=c,L.onExpand=u,L.onResize=d,F.collapsedSize=n,F.collapsible=r,F.defaultSize=s,F.maxSize=a,F.minSize=l,(q.collapsedSize!==F.collapsedSize||q.collapsible!==F.collapsible||q.maxSize!==F.maxSize||q.minSize!==F.minSize)&&C(O.current,q)}),xi(()=>{const L=O.current;return A(L),()=>{T(L)}},[f,I,A,T]),x.useImperativeHandle(i,()=>({collapse:()=>{y(O.current)},expand:L=>{w(O.current,L)},getId(){return I},getSize(){return v(O.current)},isCollapsed(){return k(O.current)},isExpanded(){return!k(O.current)},resize:L=>{R(O.current,L)}}),[y,w,v,k,I,R]);const j=E(O.current,s);return x.createElement(m,{...g,children:e,className:t,id:I,style:{...j,...p},[Rt.groupId]:N,[Rt.panel]:"",[Rt.panelCollapsible]:r||void 0,[Rt.panelId]:I,[Rt.panelSize]:parseFloat(""+j.flexGrow).toFixed(1)})}const Ja=x.forwardRef((e,t)=>x.createElement(XN,{...e,forwardedRef:t}));XN.displayName="Panel";Ja.displayName="forwardRef(Panel)";let $p=null,xc=-1,Ns=null;function gK(e,t,n){const r=(t&r_)!==0,s=(t&s_)!==0,i=(t&i_)!==0,o=(t&o_)!==0;if(t){if(r)return i?"se-resize":o?"ne-resize":"e-resize";if(s)return i?"sw-resize":o?"nw-resize":"w-resize";if(i)return"s-resize";if(o)return"n-resize"}switch(e){case"horizontal":return"ew-resize";case"intersection":return"move";case"vertical":return"ns-resize"}}function bK(){Ns!==null&&(document.head.removeChild(Ns),$p=null,Ns=null,xc=-1)}function hh(e,t,n){var r,s;const i=gK(e,t);if($p!==i){if($p=i,Ns===null&&(Ns=document.createElement("style"),document.head.appendChild(Ns)),xc>=0){var o;(o=Ns.sheet)===null||o===void 0||o.removeRule(xc)}xc=(r=(s=Ns.sheet)===null||s===void 0?void 0:s.insertRule(`*{cursor: ${i} !important;}`))!==null&&r!==void 0?r:-1}}function QN(e){return e.type==="keydown"}function e_(e){return e.type.startsWith("pointer")}function t_(e){return e.type.startsWith("mouse")}function Ud(e){if(e_(e)){if(e.isPrimary)return{x:e.clientX,y:e.clientY}}else if(t_(e))return{x:e.clientX,y:e.clientY};return{x:1/0,y:1/0}}function yK(){if(typeof matchMedia=="function")return matchMedia("(pointer:coarse)").matches?"coarse":"fine"}function xK(e,t,n){return e.x<t.x+t.width&&e.x+e.width>t.x&&e.y<t.y+t.height&&e.y+e.height>t.y}function vK(e,t){if(e===t)throw new Error("Cannot compare node with itself");const n={a:Vv(e),b:Vv(t)};let r;for(;n.a.at(-1)===n.b.at(-1);)e=n.a.pop(),t=n.b.pop(),r=e;Ue(r,"Stacking order can only be calculated for elements with a common ancestor");const s={a:Hv(Uv(n.a)),b:Hv(Uv(n.b))};if(s.a===s.b){const i=r.childNodes,o={a:n.a.at(-1),b:n.b.at(-1)};let a=i.length;for(;a--;){const l=i[a];if(l===o.a)return 1;if(l===o.b)return-1}}return Math.sign(s.a-s.b)}const wK=/\b(?:position|zIndex|opacity|transform|webkitTransform|mixBlendMode|filter|webkitFilter|isolation)\b/;function kK(e){var t;const n=getComputedStyle((t=n_(e))!==null&&t!==void 0?t:e).display;return n==="flex"||n==="inline-flex"}function SK(e){const t=getComputedStyle(e);return!!(t.position==="fixed"||t.zIndex!=="auto"&&(t.position!=="static"||kK(e))||+t.opacity<1||"transform"in t&&t.transform!=="none"||"webkitTransform"in t&&t.webkitTransform!=="none"||"mixBlendMode"in t&&t.mixBlendMode!=="normal"||"filter"in t&&t.filter!=="none"||"webkitFilter"in t&&t.webkitFilter!=="none"||"isolation"in t&&t.isolation==="isolate"||wK.test(t.willChange)||t.webkitOverflowScrolling==="touch")}function Uv(e){let t=e.length;for(;t--;){const n=e[t];if(Ue(n,"Missing node"),SK(n))return n}return null}function Hv(e){return e&&Number(getComputedStyle(e).zIndex)||0}function Vv(e){const t=[];for(;e;)t.push(e),e=n_(e);return t}function n_(e){const{parentNode:t}=e;return t&&t instanceof ShadowRoot?t.host:t}const r_=1,s_=2,i_=4,o_=8,EK=yK()==="coarse";let xr=[],bo=!1,_s=new Map,Hd=new Map;const Za=new Set;function CK(e,t,n,r,s){var i;const{ownerDocument:o}=t,a={direction:n,element:t,hitAreaMargins:r,setResizeHandlerState:s},l=(i=_s.get(o))!==null&&i!==void 0?i:0;return _s.set(o,l+1),Za.add(a),Tu(),function(){var u;Hd.delete(e),Za.delete(a);const d=(u=_s.get(o))!==null&&u!==void 0?u:1;if(_s.set(o,d-1),Tu(),d===1&&_s.delete(o),xr.includes(a)){const f=xr.indexOf(a);f>=0&&xr.splice(f,1),Vd(),s("up",!0,null)}}}function NK(e){const{target:t}=e,{x:n,y:r}=Ud(e);bo=!0,Bg({target:t,x:n,y:r}),Tu(),xr.length>0&&(Au("down",e),Vd(),e.preventDefault(),a_(t)||e.stopImmediatePropagation())}function ph(e){const{x:t,y:n}=Ud(e);if(bo&&e.type!=="pointerleave"&&e.buttons===0&&(bo=!1,Au("up",e)),!bo){const{target:r}=e;Bg({target:r,x:t,y:n})}Au("move",e),Vd(),xr.length>0&&e.preventDefault()}function mh(e){const{target:t}=e,{x:n,y:r}=Ud(e);Hd.clear(),bo=!1,xr.length>0&&(e.preventDefault(),a_(t)||e.stopImmediatePropagation()),Au("up",e),Bg({target:t,x:n,y:r}),Vd(),Tu()}function a_(e){let t=e;for(;t;){if(t.hasAttribute(Rt.resizeHandle))return!0;t=t.parentElement}return!1}function Bg({target:e,x:t,y:n}){xr.splice(0);let r=null;(e instanceof HTMLElement||e instanceof SVGElement)&&(r=e),Za.forEach(s=>{const{element:i,hitAreaMargins:o}=s,a=i.getBoundingClientRect(),{bottom:l,left:c,right:u,top:d}=a,f=EK?o.coarse:o.fine;if(t>=c-f&&t<=u+f&&n>=d-f&&n<=l+f){if(r!==null&&document.contains(r)&&i!==r&&!i.contains(r)&&!r.contains(i)&&vK(r,i)>0){let m=r,g=!1;for(;m&&!m.contains(i);){if(xK(m.getBoundingClientRect(),a)){g=!0;break}m=m.parentElement}if(g)return}xr.push(s)}})}function gh(e,t){Hd.set(e,t)}function Vd(){let e=!1,t=!1;xr.forEach(r=>{const{direction:s}=r;s==="horizontal"?e=!0:t=!0});let n=0;Hd.forEach(r=>{n|=r}),e&&t?hh("intersection",n):e?hh("horizontal",n):t?hh("vertical",n):bK()}let bh;function Tu(){var e;(e=bh)===null||e===void 0||e.abort(),bh=new AbortController;const t={capture:!0,signal:bh.signal};Za.size&&(bo?(xr.length>0&&_s.forEach((n,r)=>{const{body:s}=r;n>0&&(s.addEventListener("contextmenu",mh,t),s.addEventListener("pointerleave",ph,t),s.addEventListener("pointermove",ph,t))}),_s.forEach((n,r)=>{const{body:s}=r;s.addEventListener("pointerup",mh,t),s.addEventListener("pointercancel",mh,t)})):_s.forEach((n,r)=>{const{body:s}=r;n>0&&(s.addEventListener("pointerdown",NK,t),s.addEventListener("pointermove",ph,t))}))}function Au(e,t){Za.forEach(n=>{const{setResizeHandlerState:r}=n,s=xr.includes(n);r(e,s,t)})}function _K(){const[e,t]=x.useState(0);return x.useCallback(()=>t(n=>n+1),[])}function Ue(e,t){if(!e)throw console.error(t),Error(t)}function Li(e,t,n=zg){return e.toFixed(n)===t.toFixed(n)?0:e>t?1:-1}function Jr(e,t,n=zg){return Li(e,t,n)===0}function $n(e,t,n){return Li(e,t,n)===0}function TK(e,t,n){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){const s=e[r],i=t[r];if(!$n(s,i,n))return!1}return!0}function oo({panelConstraints:e,panelIndex:t,size:n}){const r=e[t];Ue(r!=null,`Panel constraints not found for index ${t}`);let{collapsedSize:s=0,collapsible:i,maxSize:o=100,minSize:a=0}=r;if(Li(n,a)<0)if(i){const l=(s+a)/2;Li(n,l)<0?n=s:n=a}else n=a;return n=Math.min(o,n),n=parseFloat(n.toFixed(zg)),n}function la({delta:e,initialLayout:t,panelConstraints:n,pivotIndices:r,prevLayout:s,trigger:i}){if($n(e,0))return t;const o=[...t],[a,l]=r;Ue(a!=null,"Invalid first pivot index"),Ue(l!=null,"Invalid second pivot index");let c=0;if(i==="keyboard"){{const d=e<0?l:a,f=n[d];Ue(f,`Panel constraints not found for index ${d}`);const{collapsedSize:p=0,collapsible:m,minSize:g=0}=f;if(m){const b=t[d];if(Ue(b!=null,`Previous layout not found for panel index ${d}`),$n(b,p)){const y=g-b;Li(y,Math.abs(e))>0&&(e=e<0?0-y:y)}}}{const d=e<0?a:l,f=n[d];Ue(f,`No panel constraints found for index ${d}`);const{collapsedSize:p=0,collapsible:m,minSize:g=0}=f;if(m){const b=t[d];if(Ue(b!=null,`Previous layout not found for panel index ${d}`),$n(b,g)){const y=b-p;Li(y,Math.abs(e))>0&&(e=e<0?0-y:y)}}}}{const d=e<0?1:-1;let f=e<0?l:a,p=0;for(;;){const g=t[f];Ue(g!=null,`Previous layout not found for panel index ${f}`);const y=oo({panelConstraints:n,panelIndex:f,size:100})-g;if(p+=y,f+=d,f<0||f>=n.length)break}const m=Math.min(Math.abs(e),Math.abs(p));e=e<0?0-m:m}{let f=e<0?a:l;for(;f>=0&&f<n.length;){const p=Math.abs(e)-Math.abs(c),m=t[f];Ue(m!=null,`Previous layout not found for panel index ${f}`);const g=m-p,b=oo({panelConstraints:n,panelIndex:f,size:g});if(!$n(m,b)&&(c+=m-b,o[f]=b,c.toFixed(3).localeCompare(Math.abs(e).toFixed(3),void 0,{numeric:!0})>=0))break;e<0?f--:f++}}if(TK(s,o))return s;{const d=e<0?l:a,f=t[d];Ue(f!=null,`Previous layout not found for panel index ${d}`);const p=f+c,m=oo({panelConstraints:n,panelIndex:d,size:p});if(o[d]=m,!$n(m,p)){let g=p-m,y=e<0?l:a;for(;y>=0&&y<n.length;){const w=o[y];Ue(w!=null,`Previous layout not found for panel index ${y}`);const v=w+g,E=oo({panelConstraints:n,panelIndex:y,size:v});if($n(w,E)||(g-=E-w,o[y]=E),$n(g,0))break;e>0?y--:y++}}}const u=o.reduce((d,f)=>f+d,0);return $n(u,100)?o:s}function AK({layout:e,panelsArray:t,pivotIndices:n}){let r=0,s=100,i=0,o=0;const a=n[0];Ue(a!=null,"No pivot index found"),t.forEach((d,f)=>{const{constraints:p}=d,{maxSize:m=100,minSize:g=0}=p;f===a?(r=g,s=m):(i+=g,o+=m)});const l=Math.min(s,100-i),c=Math.max(r,100-o),u=e[a];return{valueMax:l,valueMin:c,valueNow:u}}function Ya(e,t=document){return Array.from(t.querySelectorAll(`[${Rt.resizeHandleId}][data-panel-group-id="${e}"]`))}function l_(e,t,n=document){const s=Ya(e,n).findIndex(i=>i.getAttribute(Rt.resizeHandleId)===t);return s??null}function c_(e,t,n){const r=l_(e,t,n);return r!=null?[r,r+1]:[-1,-1]}function MK(e){return e instanceof HTMLElement?!0:typeof e=="object"&&e!==null&&"tagName"in e&&"getAttribute"in e}function u_(e,t=document){if(MK(t)&&t.dataset.panelGroupId==e)return t;const n=t.querySelector(`[data-panel-group][data-panel-group-id="${e}"]`);return n||null}function qd(e,t=document){const n=t.querySelector(`[${Rt.resizeHandleId}="${e}"]`);return n||null}function RK(e,t,n,r=document){var s,i,o,a;const l=qd(t,r),c=Ya(e,r),u=l?c.indexOf(l):-1,d=(s=(i=n[u])===null||i===void 0?void 0:i.id)!==null&&s!==void 0?s:null,f=(o=(a=n[u+1])===null||a===void 0?void 0:a.id)!==null&&o!==void 0?o:null;return[d,f]}function OK({committedValuesRef:e,eagerValuesRef:t,groupId:n,layout:r,panelDataArray:s,panelGroupElement:i,setLayout:o}){x.useRef({didWarnAboutMissingResizeHandle:!1}),xi(()=>{if(!i)return;const a=Ya(n,i);for(let l=0;l<s.length-1;l++){const{valueMax:c,valueMin:u,valueNow:d}=AK({layout:r,panelsArray:s,pivotIndices:[l,l+1]}),f=a[l];if(f!=null){const p=s[l];Ue(p,`No panel data found for index "${l}"`),f.setAttribute("aria-controls",p.id),f.setAttribute("aria-valuemax",""+Math.round(c)),f.setAttribute("aria-valuemin",""+Math.round(u)),f.setAttribute("aria-valuenow",d!=null?""+Math.round(d):"")}}return()=>{a.forEach((l,c)=>{l.removeAttribute("aria-controls"),l.removeAttribute("aria-valuemax"),l.removeAttribute("aria-valuemin"),l.removeAttribute("aria-valuenow")})}},[n,r,s,i]),x.useEffect(()=>{if(!i)return;const a=t.current;Ue(a,"Eager values not found");const{panelDataArray:l}=a,c=u_(n,i);Ue(c!=null,`No group found for id "${n}"`);const u=Ya(n,i);Ue(u,`No resize handles found for group id "${n}"`);const d=u.map(f=>{const p=f.getAttribute(Rt.resizeHandleId);Ue(p,"Resize handle element has no handle id attribute");const[m,g]=RK(n,p,l,i);if(m==null||g==null)return()=>{};const b=y=>{if(!y.defaultPrevented)switch(y.key){case"Enter":{y.preventDefault();const w=l.findIndex(v=>v.id===m);if(w>=0){const v=l[w];Ue(v,`No panel data found for index ${w}`);const E=r[w],{collapsedSize:N=0,collapsible:k,minSize:C=0}=v.constraints;if(E!=null&&k){const A=la({delta:$n(E,N)?C-N:N-E,initialLayout:r,panelConstraints:l.map(R=>R.constraints),pivotIndices:c_(n,p,i),prevLayout:r,trigger:"keyboard"});r!==A&&o(A)}}break}}};return f.addEventListener("keydown",b),()=>{f.removeEventListener("keydown",b)}});return()=>{d.forEach(f=>f())}},[i,e,t,n,r,s,o])}function qv(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function d_(e,t){const n=e==="horizontal",{x:r,y:s}=Ud(t);return n?r:s}function IK(e,t,n,r,s){const i=n==="horizontal",o=qd(t,s);Ue(o,`No resize handle element found for id "${t}"`);const a=o.getAttribute(Rt.groupId);Ue(a,"Resize handle element has no group id attribute");let{initialCursorPosition:l}=r;const c=d_(n,e),u=u_(a,s);Ue(u,`No group element found for id "${a}"`);const d=u.getBoundingClientRect(),f=i?d.width:d.height;return(c-l)/f*100}function DK(e,t,n,r,s,i){if(QN(e)){const o=n==="horizontal";let a=0;e.shiftKey?a=100:s!=null?a=s:a=10;let l=0;switch(e.key){case"ArrowDown":l=o?0:a;break;case"ArrowLeft":l=o?-a:0;break;case"ArrowRight":l=o?a:0;break;case"ArrowUp":l=o?0:-a;break;case"End":l=100;break;case"Home":l=-100;break}return l}else return r==null?0:IK(e,t,n,r,i)}function LK({panelDataArray:e}){const t=Array(e.length),n=e.map(i=>i.constraints);let r=0,s=100;for(let i=0;i<e.length;i++){const o=n[i];Ue(o,`Panel constraints not found for index ${i}`);const{defaultSize:a}=o;a!=null&&(r++,t[i]=a,s-=a)}for(let i=0;i<e.length;i++){const o=n[i];Ue(o,`Panel constraints not found for index ${i}`);const{defaultSize:a}=o;if(a!=null)continue;const l=e.length-r,c=s/l;r++,t[i]=c,s-=c}return t}function Wi(e,t,n){t.forEach((r,s)=>{const i=e[s];Ue(i,`Panel data not found for index ${s}`);const{callbacks:o,constraints:a,id:l}=i,{collapsedSize:c=0,collapsible:u}=a,d=n[l];if(d==null||r!==d){n[l]=r;const{onCollapse:f,onExpand:p,onResize:m}=o;m&&m(r,d),u&&(f||p)&&(p&&(d==null||Jr(d,c))&&!Jr(r,c)&&p(),f&&(d==null||!Jr(d,c))&&Jr(r,c)&&f())}})}function ic(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n])return!1;return!0}function PK({defaultSize:e,dragState:t,layout:n,panelData:r,panelIndex:s,precision:i=3}){const o=n[s];let a;return o==null?a=e!=null?e.toFixed(i):"1":r.length===1?a="1":a=o.toFixed(i),{flexBasis:0,flexGrow:a,flexShrink:1,overflow:"hidden",pointerEvents:t!==null?"none":void 0}}function jK(e,t=10){let n=null;return(...s)=>{n!==null&&clearTimeout(n),n=setTimeout(()=>{e(...s)},t)}}function Wv(e){try{if(typeof localStorage<"u")e.getItem=t=>localStorage.getItem(t),e.setItem=(t,n)=>{localStorage.setItem(t,n)};else throw new Error("localStorage not supported in this environment")}catch(t){console.error(t),e.getItem=()=>null,e.setItem=()=>{}}}function f_(e){return`react-resizable-panels:${e}`}function h_(e){return e.map(t=>{const{constraints:n,id:r,idIsFromProps:s,order:i}=t;return s?r:i?`${i}:${JSON.stringify(n)}`:JSON.stringify(n)}).sort((t,n)=>t.localeCompare(n)).join(",")}function p_(e,t){try{const n=f_(e),r=t.getItem(n);if(r){const s=JSON.parse(r);if(typeof s=="object"&&s!=null)return s}}catch{}return null}function zK(e,t,n){var r,s;const i=(r=p_(e,n))!==null&&r!==void 0?r:{},o=h_(t);return(s=i[o])!==null&&s!==void 0?s:null}function FK(e,t,n,r,s){var i;const o=f_(e),a=h_(t),l=(i=p_(e,s))!==null&&i!==void 0?i:{};l[a]={expandToSizes:Object.fromEntries(n.entries()),layout:r};try{s.setItem(o,JSON.stringify(l))}catch(c){console.error(c)}}function Kv({layout:e,panelConstraints:t}){const n=[...e],r=n.reduce((i,o)=>i+o,0);if(n.length!==t.length)throw Error(`Invalid ${t.length} panel layout: ${n.map(i=>`${i}%`).join(", ")}`);if(!$n(r,100)&&n.length>0)for(let i=0;i<t.length;i++){const o=n[i];Ue(o!=null,`No layout data found for index ${i}`);const a=100/r*o;n[i]=a}let s=0;for(let i=0;i<t.length;i++){const o=n[i];Ue(o!=null,`No layout data found for index ${i}`);const a=oo({panelConstraints:t,panelIndex:i,size:o});o!=a&&(s+=o-a,n[i]=a)}if(!$n(s,0))for(let i=0;i<t.length;i++){const o=n[i];Ue(o!=null,`No layout data found for index ${i}`);const a=o+s,l=oo({panelConstraints:t,panelIndex:i,size:a});if(o!==l&&(s-=l-o,n[i]=l,$n(s,0)))break}return n}const BK=100,ca={getItem:e=>(Wv(ca),ca.getItem(e)),setItem:(e,t)=>{Wv(ca),ca.setItem(e,t)}},Gv={};function m_({autoSaveId:e=null,children:t,className:n="",direction:r,forwardedRef:s,id:i=null,onLayout:o=null,keyboardResizeBy:a=null,storage:l=ca,style:c,tagName:u="div",...d}){const f=Fg(i),p=x.useRef(null),[m,g]=x.useState(null),[b,y]=x.useState([]),w=_K(),v=x.useRef({}),E=x.useRef(new Map),N=x.useRef(0),k=x.useRef({autoSaveId:e,direction:r,dragState:m,id:f,keyboardResizeBy:a,onLayout:o,storage:l}),C=x.useRef({layout:b,panelDataArray:[],panelDataArrayChanged:!1});x.useRef({didLogIdAndOrderWarning:!1,didLogPanelConstraintsWarning:!1,prevPanelIds:[]}),x.useImperativeHandle(s,()=>({getId:()=>k.current.id,getLayout:()=>{const{layout:S}=C.current;return S},setLayout:S=>{const{onLayout:B}=k.current,{layout:$,panelDataArray:D}=C.current,P=Kv({layout:S,panelConstraints:D.map(W=>W.constraints)});qv($,P)||(y(P),C.current.layout=P,B&&B(P),Wi(D,P,v.current))}}),[]),xi(()=>{k.current.autoSaveId=e,k.current.direction=r,k.current.dragState=m,k.current.id=f,k.current.onLayout=o,k.current.storage=l}),OK({committedValuesRef:k,eagerValuesRef:C,groupId:f,layout:b,panelDataArray:C.current.panelDataArray,setLayout:y,panelGroupElement:p.current}),x.useEffect(()=>{const{panelDataArray:S}=C.current;if(e){if(b.length===0||b.length!==S.length)return;let B=Gv[e];B==null&&(B=jK(FK,BK),Gv[e]=B);const $=[...S],D=new Map(E.current);B(e,$,D,b,l)}},[e,b,l]),x.useEffect(()=>{});const A=x.useCallback(S=>{const{onLayout:B}=k.current,{layout:$,panelDataArray:D}=C.current;if(S.constraints.collapsible){const P=D.map(be=>be.constraints),{collapsedSize:W=0,panelSize:fe,pivotIndices:ee}=si(D,S,$);if(Ue(fe!=null,`Panel size not found for panel "${S.id}"`),!Jr(fe,W)){E.current.set(S.id,fe);const Me=to(D,S)===D.length-1?fe-W:W-fe,Le=la({delta:Me,initialLayout:$,panelConstraints:P,pivotIndices:ee,prevLayout:$,trigger:"imperative-api"});ic($,Le)||(y(Le),C.current.layout=Le,B&&B(Le),Wi(D,Le,v.current))}}},[]),R=x.useCallback((S,B)=>{const{onLayout:$}=k.current,{layout:D,panelDataArray:P}=C.current;if(S.constraints.collapsible){const W=P.map(Ke=>Ke.constraints),{collapsedSize:fe=0,panelSize:ee=0,minSize:be=0,pivotIndices:Me}=si(P,S,D),Le=B??be;if(Jr(ee,fe)){const Ke=E.current.get(S.id),ce=Ke!=null&&Ke>=Le?Ke:Le,et=to(P,S)===P.length-1?ee-ce:ce-ee,We=la({delta:et,initialLayout:D,panelConstraints:W,pivotIndices:Me,prevLayout:D,trigger:"imperative-api"});ic(D,We)||(y(We),C.current.layout=We,$&&$(We),Wi(P,We,v.current))}}},[]),T=x.useCallback(S=>{const{layout:B,panelDataArray:$}=C.current,{panelSize:D}=si($,S,B);return Ue(D!=null,`Panel size not found for panel "${S.id}"`),D},[]),I=x.useCallback((S,B)=>{const{panelDataArray:$}=C.current,D=to($,S);return PK({defaultSize:B,dragState:m,layout:b,panelData:$,panelIndex:D})},[m,b]),O=x.useCallback(S=>{const{layout:B,panelDataArray:$}=C.current,{collapsedSize:D=0,collapsible:P,panelSize:W}=si($,S,B);return Ue(W!=null,`Panel size not found for panel "${S.id}"`),P===!0&&Jr(W,D)},[]),j=x.useCallback(S=>{const{layout:B,panelDataArray:$}=C.current,{collapsedSize:D=0,collapsible:P,panelSize:W}=si($,S,B);return Ue(W!=null,`Panel size not found for panel "${S.id}"`),!P||Li(W,D)>0},[]),L=x.useCallback(S=>{const{panelDataArray:B}=C.current;B.push(S),B.sort(($,D)=>{const P=$.order,W=D.order;return P==null&&W==null?0:P==null?-1:W==null?1:P-W}),C.current.panelDataArrayChanged=!0,w()},[w]);xi(()=>{if(C.current.panelDataArrayChanged){C.current.panelDataArrayChanged=!1;const{autoSaveId:S,onLayout:B,storage:$}=k.current,{layout:D,panelDataArray:P}=C.current;let W=null;if(S){const ee=zK(S,P,$);ee&&(E.current=new Map(Object.entries(ee.expandToSizes)),W=ee.layout)}W==null&&(W=LK({panelDataArray:P}));const fe=Kv({layout:W,panelConstraints:P.map(ee=>ee.constraints)});qv(D,fe)||(y(fe),C.current.layout=fe,B&&B(fe),Wi(P,fe,v.current))}}),xi(()=>{const S=C.current;return()=>{S.layout=[]}},[]);const F=x.useCallback(S=>{let B=!1;const $=p.current;return $&&window.getComputedStyle($,null).getPropertyValue("direction")==="rtl"&&(B=!0),function(P){P.preventDefault();const W=p.current;if(!W)return()=>null;const{direction:fe,dragState:ee,id:be,keyboardResizeBy:Me,onLayout:Le}=k.current,{layout:Ke,panelDataArray:ce}=C.current,{initialLayout:ne}=ee??{},et=c_(be,S,W);let We=DK(P,S,fe,ee,Me,W);const ie=fe==="horizontal";ie&&B&&(We=-We);const je=ce.map(Gn=>Gn.constraints),it=la({delta:We,initialLayout:ne??Ke,panelConstraints:je,pivotIndices:et,prevLayout:Ke,trigger:QN(P)?"keyboard":"mouse-or-touch"}),tt=!ic(Ke,it);(e_(P)||t_(P))&&N.current!=We&&(N.current=We,!tt&&We!==0?ie?gh(S,We<0?r_:s_):gh(S,We<0?i_:o_):gh(S,0)),tt&&(y(it),C.current.layout=it,Le&&Le(it),Wi(ce,it,v.current))}},[]),q=x.useCallback((S,B)=>{const{onLayout:$}=k.current,{layout:D,panelDataArray:P}=C.current,W=P.map(Ke=>Ke.constraints),{panelSize:fe,pivotIndices:ee}=si(P,S,D);Ue(fe!=null,`Panel size not found for panel "${S.id}"`);const Me=to(P,S)===P.length-1?fe-B:B-fe,Le=la({delta:Me,initialLayout:D,panelConstraints:W,pivotIndices:ee,prevLayout:D,trigger:"imperative-api"});ic(D,Le)||(y(Le),C.current.layout=Le,$&&$(Le),Wi(P,Le,v.current))},[]),te=x.useCallback((S,B)=>{const{layout:$,panelDataArray:D}=C.current,{collapsedSize:P=0,collapsible:W}=B,{collapsedSize:fe=0,collapsible:ee,maxSize:be=100,minSize:Me=0}=S.constraints,{panelSize:Le}=si(D,S,$);Le!=null&&(W&&ee&&Jr(Le,P)?Jr(P,fe)||q(S,fe):Le<Me?q(S,Me):Le>be&&q(S,be))},[q]),K=x.useCallback((S,B)=>{const{direction:$}=k.current,{layout:D}=C.current;if(!p.current)return;const P=qd(S,p.current);Ue(P,`Drag handle element not found for id "${S}"`);const W=d_($,B);g({dragHandleId:S,dragHandleRect:P.getBoundingClientRect(),initialCursorPosition:W,initialLayout:D})},[]),le=x.useCallback(()=>{g(null)},[]),_=x.useCallback(S=>{const{panelDataArray:B}=C.current,$=to(B,S);$>=0&&(B.splice($,1),delete v.current[S.id],C.current.panelDataArrayChanged=!0,w())},[w]),ae=x.useMemo(()=>({collapsePanel:A,direction:r,dragState:m,expandPanel:R,getPanelSize:T,getPanelStyle:I,groupId:f,isPanelCollapsed:O,isPanelExpanded:j,reevaluatePanelConstraints:te,registerPanel:L,registerResizeHandle:F,resizePanel:q,startDragging:K,stopDragging:le,unregisterPanel:_,panelGroupElement:p.current}),[A,m,r,R,T,I,f,O,j,te,L,F,q,K,le,_]),me={display:"flex",flexDirection:r==="horizontal"?"row":"column",height:"100%",overflow:"hidden",width:"100%"};return x.createElement($d.Provider,{value:ae},x.createElement(u,{...d,children:t,className:n,id:i,ref:p,style:{...me,...c},[Rt.group]:"",[Rt.groupDirection]:r,[Rt.groupId]:f}))}const $g=x.forwardRef((e,t)=>x.createElement(m_,{...e,forwardedRef:t}));m_.displayName="PanelGroup";$g.displayName="forwardRef(PanelGroup)";function to(e,t){return e.findIndex(n=>n===t||n.id===t.id)}function si(e,t,n){const r=to(e,t),i=r===e.length-1?[r-1,r]:[r,r+1],o=n[r];return{...t.constraints,panelSize:o,pivotIndices:i}}function $K({disabled:e,handleId:t,resizeHandler:n,panelGroupElement:r}){x.useEffect(()=>{if(e||n==null||r==null)return;const s=qd(t,r);if(s==null)return;const i=o=>{if(!o.defaultPrevented)switch(o.key){case"ArrowDown":case"ArrowLeft":case"ArrowRight":case"ArrowUp":case"End":case"Home":{o.preventDefault(),n(o);break}case"F6":{o.preventDefault();const a=s.getAttribute(Rt.groupId);Ue(a,`No group element found for id "${a}"`);const l=Ya(a,r),c=l_(a,t,r);Ue(c!==null,`No resize element found for id "${t}"`);const u=o.shiftKey?c>0?c-1:l.length-1:c+1<l.length?c+1:0;l[u].focus();break}}};return s.addEventListener("keydown",i),()=>{s.removeEventListener("keydown",i)}},[r,e,t,n])}function Ug({children:e=null,className:t="",disabled:n=!1,hitAreaMargins:r,id:s,onBlur:i,onClick:o,onDragging:a,onFocus:l,onPointerDown:c,onPointerUp:u,style:d={},tabIndex:f=0,tagName:p="div",...m}){var g,b;const y=x.useRef(null),w=x.useRef({onClick:o,onDragging:a,onPointerDown:c,onPointerUp:u});x.useEffect(()=>{w.current.onClick=o,w.current.onDragging=a,w.current.onPointerDown=c,w.current.onPointerUp=u});const v=x.useContext($d);if(v===null)throw Error("PanelResizeHandle components must be rendered within a PanelGroup container");const{direction:E,groupId:N,registerResizeHandle:k,startDragging:C,stopDragging:A,panelGroupElement:R}=v,T=Fg(s),[I,O]=x.useState("inactive"),[j,L]=x.useState(!1),[F,q]=x.useState(null),te=x.useRef({state:I});xi(()=>{te.current.state=I}),x.useEffect(()=>{if(n)q(null);else{const ae=k(T);q(()=>ae)}},[n,T,k]);const K=(g=r?.coarse)!==null&&g!==void 0?g:15,le=(b=r?.fine)!==null&&b!==void 0?b:5;x.useEffect(()=>{if(n||F==null)return;const ae=y.current;Ue(ae,"Element ref not attached");let me=!1;return CK(T,ae,E,{coarse:K,fine:le},(B,$,D)=>{if(!$){O("inactive");return}switch(B){case"down":{O("drag"),me=!1,Ue(D,'Expected event to be defined for "down" action'),C(T,D);const{onDragging:P,onPointerDown:W}=w.current;P?.(!0),W?.();break}case"move":{const{state:P}=te.current;me=!0,P!=="drag"&&O("hover"),Ue(D,'Expected event to be defined for "move" action'),F(D);break}case"up":{O("hover"),A();const{onClick:P,onDragging:W,onPointerUp:fe}=w.current;W?.(!1),fe?.(),me||P?.();break}}})},[K,E,n,le,k,T,F,C,A]),$K({disabled:n,handleId:T,resizeHandler:F,panelGroupElement:R});const _={touchAction:"none",userSelect:"none"};return x.createElement(p,{...m,children:e,className:t,id:s,onBlur:()=>{L(!1),i?.()},onFocus:()=>{L(!0),l?.()},ref:y,role:"separator",style:{..._,...d},tabIndex:f,[Rt.groupDirection]:E,[Rt.groupId]:N,[Rt.resizeHandle]:"",[Rt.resizeHandleActive]:I==="drag"?"pointer":j?"keyboard":void 0,[Rt.resizeHandleEnabled]:!n,[Rt.resizeHandleId]:T,[Rt.resizeHandleState]:I})}Ug.displayName="PanelResizeHandle";const Jv="sudocode:issues:sortOption";function UK(){const e=cr(),{issues:t,isLoading:n,isError:r,error:s,createIssueAsync:i,updateIssue:o,deleteIssue:a,archiveIssue:l,unarchiveIssue:c,isCreating:u,isUpdating:d,isDeleting:f}=ed(),p=dO(),[m,g]=x.useState(),[b,y]=x.useState(!1),[w,v]=x.useState(),[E,N]=x.useState(!1),[k,C]=x.useState(""),[A,R]=x.useState(()=>{try{const D=localStorage.getItem(Jv);if(D&&["priority","newest","last-updated"].includes(D))return D}catch(D){console.error("Failed to load sort preference from localStorage:",D)}return"priority"}),[T,I]=x.useState(()=>{try{const D=localStorage.getItem("issuesPage.collapsedColumns");if(D){const P=JSON.parse(D);return new Set(P)}}catch{}return new Set}),O=x.useCallback(D=>{const P=D;R(P);try{localStorage.setItem(Jv,P)}catch(W){console.error("Failed to save sort preference to localStorage:",W)}},[]),j=x.useMemo(()=>{const D=k?t.filter(W=>{const fe=k.toLowerCase();return W.title.toLowerCase().includes(fe)||W.content&&W.content.toLowerCase().includes(fe)}):t,P={open:[],in_progress:[],blocked:[],needs_review:[],closed:[]};return D.forEach(W=>{const fe=W.status.toLowerCase();P[fe]?P[fe].push(W):P.open.push(W)}),Object.keys(P).forEach(W=>{P[W].sort((ee,be)=>{switch(A){case"priority":return ee.priority!==be.priority?ee.priority-be.priority:new Date(be.created_at).getTime()-new Date(ee.created_at).getTime();case"newest":return new Date(be.created_at).getTime()-new Date(ee.created_at).getTime();case"last-updated":return new Date(be.updated_at).getTime()-new Date(ee.updated_at).getTime();default:return 0}})}),P},[t,k,A]),L=x.useCallback(D=>{const{active:P,over:W}=D;if(!W||!P.data.current)return;const fe=P.id,ee=W.id,be=t.find(Me=>Me.id===fe);!be||be.status===ee||p.mutate({id:fe,status:ee})},[t,p]),F=x.useCallback(D=>{g(D)},[]),q=x.useCallback(()=>{g(void 0)},[]),te=x.useCallback(D=>{v(D),y(!0)},[]),K=x.useCallback(async D=>{try{await i(D),y(!1),v(void 0)}catch(P){console.error("Failed to create issue:",P)}},[i]),le=x.useCallback(D=>{m&&o({id:m.id,data:D})},[m,o]),_=x.useCallback(()=>{m&&(a(m.id),g(void 0))},[m,a]),ae=x.useCallback(D=>{l(D)},[l]),me=x.useCallback(D=>{c(D)},[c]),S=x.useCallback(()=>{N(!0)},[]),B=x.useCallback(()=>{(j.closed||[]).forEach(P=>{l(P.id)}),N(!1)},[j.closed,l]),$=x.useCallback(D=>{I(P=>{const W=new Set(P);W.has(D)?W.delete(D):W.add(D);try{localStorage.setItem("issuesPage.collapsedColumns",JSON.stringify(Array.from(W)))}catch{}return W})},[]);return n?h.jsx("div",{className:"flex items-center justify-center p-8",children:h.jsx("p",{className:"text-muted-foreground",children:"Loading issues..."})}):r?h.jsx("div",{className:"flex items-center justify-center p-8",children:h.jsxs("p",{className:"text-destructive",children:["Error loading issues: ",s?.message||"Unknown error"]})}):h.jsxs("div",{className:"flex h-screen flex-col",children:[h.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Issues"}),h.jsx(st,{variant:"secondary",children:t.length})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("div",{className:"relative",children:[h.jsx(qu,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),h.jsx(is,{type:"text",placeholder:"Filter issues...",value:k,onChange:D=>C(D.target.value),className:"h-9 w-64 pl-8"})]}),h.jsxs(Sn,{value:A,onValueChange:O,children:[h.jsx(dn,{className:"h-9 w-[100px]",children:h.jsx(En,{})}),h.jsxs(fn,{children:[h.jsx(xt,{value:"priority",children:"Priority"}),h.jsx(xt,{value:"newest",children:"Newest"}),h.jsx(xt,{value:"last-updated",children:"Updated"})]})]}),h.jsxs(oe,{onClick:()=>e("/issues/archived"),variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-foreground",children:[h.jsx(Oo,{className:"h-4 w-4"}),"Archived"]}),h.jsxs(oe,{onClick:()=>te(),variant:"default",size:"sm",className:"text-primary-foreground hover:bg-primary/90",children:[h.jsx(Si,{className:"mr-2 h-4 w-4"}),"Create Issue"]})]})]}),h.jsx("div",{className:"flex flex-1 overflow-hidden",children:m?h.jsxs($g,{direction:"horizontal",className:"h-full min-h-0",onLayout:D=>{if(D.length===2)try{localStorage.setItem("issuesPage.panelSizes",JSON.stringify(D))}catch{}},children:[h.jsx(Ja,{id:"kanban",order:1,defaultSize:(()=>{try{const D=localStorage.getItem("issuesPage.panelSizes");if(D){const P=JSON.parse(D);if(Array.isArray(P)&&P.length===2)return P[0]}}catch{}return 66})(),minSize:30,className:"min-h-0 min-w-0 overflow-auto",children:h.jsx(Ac,{groupedIssues:j,onDragEnd:L,onViewIssueDetails:F,selectedIssue:m,onArchiveAllClosed:S,collapsedColumns:T,onToggleColumnCollapse:$})}),h.jsxs(Ug,{className:"group relative z-30 w-1 cursor-col-resize touch-none bg-border focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-1 focus-visible:ring-offset-background",children:[h.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-border"}),h.jsxs("div",{className:"pointer-events-none absolute left-1/2 top-1/2 flex -translate-x-1/2 -translate-y-1/2 flex-col items-center gap-1 rounded-full border border-border bg-muted/90 px-1.5 py-3 opacity-70 shadow-sm transition-opacity group-hover:opacity-100 group-focus:opacity-100",children:[h.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground"}),h.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground"}),h.jsx("span",{className:"h-1 w-1 rounded-full bg-muted-foreground"})]})]}),h.jsx(Ja,{id:"details",order:2,defaultSize:(()=>{try{const D=localStorage.getItem("issuesPage.panelSizes");if(D){const P=JSON.parse(D);if(Array.isArray(P)&&P.length===2)return P[1]}}catch{}return 34})(),minSize:20,className:"min-h-0 min-w-0 overflow-hidden border-l bg-background shadow-lg",children:h.jsx(jg,{issue:m,onClose:q,onUpdate:le,onDelete:_,onArchive:ae,onUnarchive:me,isUpdating:d,isDeleting:f,showOpenDetail:!0})})]}):h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(Ac,{groupedIssues:j,onDragEnd:L,onViewIssueDetails:F,selectedIssue:m,onArchiveAllClosed:S,collapsedColumns:T,onToggleColumnCollapse:$})})}),h.jsx(hK,{isOpen:b,onClose:()=>{y(!1),v(void 0)},onCreate:K,isCreating:u,defaultStatus:w}),h.jsx(Tm,{open:E,onOpenChange:N,children:h.jsxs(cd,{children:[h.jsxs(ud,{children:[h.jsx(fd,{children:"Archive All Closed Issues?"}),h.jsxs(hd,{children:["This will archive all ",j.closed?.length||0," closed issues. You can view archived issues later from the Archived Issues page."]})]}),h.jsxs(dd,{children:[h.jsx(md,{children:"Cancel"}),h.jsx(pd,{onClick:B,children:"Archive All"})]})]})})]})}const Zv="sudocode:details:viewMode";function HK(){const{id:e}=em(),t=cr(),{data:n,isLoading:r,isError:s}=uO(e||""),{updateIssue:i,deleteIssue:o,archiveIssue:a,unarchiveIssue:l,isUpdating:c,isDeleting:u}=ed(),[d,f]=x.useState(!1),[p,m]=x.useState(()=>{const v=localStorage.getItem(Zv);return v!==null?JSON.parse(v):"formatted"}),g=v=>{e&&i({id:e,data:v})},b=()=>{e&&(o(e),t("/issues"))},y=v=>{a(v),t("/issues")},w=v=>{l(v),t("/issues")};return x.useEffect(()=>{localStorage.setItem(Zv,JSON.stringify(p))},[p]),r?h.jsx("div",{className:"flex items-center justify-center p-12",children:h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"mx-auto mb-4 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),h.jsx("p",{className:"text-muted-foreground",children:"Loading issue..."})]})}):s||!n?h.jsx("div",{className:"flex items-center justify-center p-12",children:h.jsxs("div",{className:"text-center",children:[h.jsx("h2",{className:"mb-2 text-2xl font-bold",children:"Issue not found"}),h.jsx("p",{className:"mb-4 text-muted-foreground",children:"The issue you're looking for doesn't exist or has been deleted."}),h.jsx(oe,{onClick:()=>t("/issues"),children:"Back to Issues"})]})}):h.jsxs("div",{className:"flex h-screen flex-col",children:[h.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-4",children:[h.jsx("div",{className:"flex items-center gap-4",children:h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>t("/issues"),children:"← Back to Issues"})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("div",{className:"mr-4 flex gap-1 rounded-md border border-border bg-muted/30 p-1",children:[h.jsxs(oe,{variant:p==="formatted"?"outline":"ghost",size:"sm",onClick:()=>m("formatted"),className:`h-7 rounded-sm ${p==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[h.jsx(ss,{className:"mr-2 h-4 w-4"}),"Formatted"]}),h.jsxs(oe,{variant:p==="markdown"?"outline":"ghost",size:"sm",onClick:()=>m("markdown"),className:`h-7 rounded-sm ${p==="markdown"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[h.jsx(rl,{className:"mr-2 h-4 w-4"}),"Markdown"]})]}),n.archived?h.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>w(n.id),disabled:c,children:[h.jsx(im,{className:"mr-2 h-4 w-4"}),"Unarchive"]}):h.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>y(n.id),disabled:c,children:[h.jsx(Oo,{className:"mr-2 h-4 w-4"}),"Archive"]}),h.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>f(!0),disabled:c||u,children:[h.jsx(Io,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]}),h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(jg,{issue:n,onUpdate:g,isUpdating:c,isDeleting:u,hideTopControls:!0,viewMode:p,onViewModeChange:m,showViewToggleInline:!1})}),h.jsx(lS,{issue:n,isOpen:d,onClose:()=>f(!1),onConfirm:b,isDeleting:u})]})}function Wd(e){const t=rs(),{connected:n,subscribe:r,unsubscribe:s,addMessageHandler:i,removeMessageHandler:o}=Uu(),a=nl({queryKey:e!==void 0?["specs",{archived:e}]:["specs"],queryFn:()=>so.getAll(e)}),l=x.useCallback(m=>{(m.type==="spec_created"||m.type==="spec_updated"||m.type==="spec_deleted")&&t.invalidateQueries({queryKey:["specs"]})},[t]);x.useEffect(()=>{const m="useSpecs";return i(m,l),n&&r("spec"),()=>{o(m),s("spec")}},[n,r,s,i,o,l]);const c=or({mutationFn:({id:m,data:g})=>so.update(m,g),onMutate:async({id:m,data:g})=>{await t.cancelQueries({queryKey:["specs"]});const b=t.getQueryData(["specs"]);return t.setQueryData(["specs"],y=>y?.map(w=>w.id===m?{...w,...g}:w)),{previousSpecs:b}},onError:(m,g,b)=>{b?.previousSpecs&&t.setQueryData(["specs"],b.previousSpecs)},onSettled:()=>{t.invalidateQueries({queryKey:["specs"]})}}),u=or({mutationFn:so.create,onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]})}}),d=or({mutationFn:so.delete,onSuccess:()=>{t.invalidateQueries({queryKey:["specs"]})}}),f=m=>c.mutate({id:m,data:{archived:!0}}),p=m=>c.mutate({id:m,data:{archived:!1}});return{specs:a.data??[],isLoading:a.isLoading,isError:a.isError,error:a.error,updateSpec:c.mutate,updateSpecAsync:c.mutateAsync,createSpec:u.mutate,createSpecAsync:u.mutateAsync,deleteSpec:d.mutate,archiveSpec:f,unarchiveSpec:p,isUpdating:c.isPending,isCreating:u.isPending}}function VK(e){const t=rs(),{connected:n,subscribe:r,unsubscribe:s,addMessageHandler:i,removeMessageHandler:o}=Uu(),a=nl({queryKey:["specs",e],queryFn:()=>so.getById(e),enabled:!!e}),l=x.useCallback(c=>{c.type==="spec_updated"&&c.data.id===e&&t.invalidateQueries({queryKey:["specs",e]})},[e,t]);return x.useEffect(()=>{if(!e)return;const c=`useSpec-${e}`;return i(c,l),n&&r("spec",e),()=>{o(c),s("spec",e)}},[n,e,r,s,i,o,l]),{spec:a.data,isLoading:a.isLoading,isError:a.isError,error:a.error}}function qK(e){const t=rs(),{connected:n,subscribe:r,unsubscribe:s,addMessageHandler:i,removeMessageHandler:o}=Uu(),a=nl({queryKey:["feedback",e],queryFn:()=>so.getFeedback(e),enabled:!!e}),l=x.useCallback(c=>{(c.type==="feedback_created"||c.type==="feedback_updated"||c.type==="feedback_deleted")&&t.invalidateQueries({queryKey:["feedback",e]})},[e,t]);return x.useEffect(()=>{if(!e)return;const c=`useSpecFeedback-${e}`;return i(c,l),n&&r("all"),()=>{o(c),s("all")}},[n,e,r,s,i,o,l]),{feedback:a.data??[],isLoading:a.isLoading,isError:a.isError,error:a.error}}const WK={0:"bg-red-600 dark:bg-red-700",1:"bg-orange-600 dark:bg-orange-700",2:"bg-yellow-600 dark:bg-yellow-700",3:"bg-blue-600 dark:bg-blue-700",4:"bg-gray-600 dark:bg-gray-700"},KK={0:"P0",1:"P1",2:"P2",3:"P3",4:"P4"};function GK({spec:e,onClick:t}){const n=x.useCallback(()=>{t?.(e)},[e,t]),r=e.content?e.content.slice(0,200)+(e.content.length>200?"...":""):"";return h.jsx(It,{className:`cursor-pointer border border-border p-4 transition-shadow hover:shadow-md ${e.archived?"opacity-60":""}`,onClick:n,children:h.jsxs("div",{className:"flex flex-col gap-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("div",{className:"flex items-center gap-2",children:h.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:e.id})}),e.priority!==void 0&&e.priority<=3&&h.jsx("span",{className:`shrink-0 rounded-full px-2 py-0.5 text-xs text-white ${WK[e.priority]}`,children:KK[e.priority]})]}),h.jsx("h3",{className:"line-clamp-2 text-lg font-semibold",children:e.title}),r&&h.jsx("p",{className:"line-clamp-3 text-sm text-muted-foreground",children:r}),h.jsx("div",{className:"flex flex-col gap-2",children:e.file_path&&h.jsx("p",{className:"truncate font-mono text-xs text-muted-foreground",children:e.file_path})})]})})}function g_({specs:e,loading:t=!1,emptyMessage:n="No specs found"}){const r=cr(),s=i=>{r(`/specs/${i.id}`)};return t?h.jsx("div",{className:"flex items-center justify-center p-12",children:h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"mx-auto mb-4 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),h.jsx("p",{className:"text-muted-foreground",children:"Loading specs..."})]})}):!e||e.length===0?h.jsx("div",{className:"flex items-center justify-center p-12",children:h.jsxs("div",{className:"text-center",children:[h.jsx("p",{className:"text-lg text-muted-foreground",children:n}),h.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Create a new spec to get started"})]})}):h.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(i=>h.jsx(GK,{spec:i,onClick:s},i.id))})}const Yv="sudocode:specEditor:viewMode";function JK({spec:e,onSave:t,onCancel:n}){const{createSpecAsync:r,updateSpecAsync:s,isCreating:i}=Wd(),[o,a]=x.useState(e?.title||""),[l,c]=x.useState(e?.content||""),[u,d]=x.useState(e?.priority??3),[f,p]=x.useState(null),[m,g]=x.useState(()=>{const w=localStorage.getItem(Yv);return w!==null?JSON.parse(w):"formatted"}),b=x.useRef(null);x.useEffect(()=>{localStorage.setItem(Yv,JSON.stringify(m))},[m]),x.useEffect(()=>{if(m==="markdown"&&b.current){const w=b.current;w.style.height="auto",w.style.height=`${w.scrollHeight}px`}},[l,m]);const y=async w=>{if(w.preventDefault(),p(null),!o.trim()){p("Title is required");return}try{const v={title:o.trim(),content:l.trim()||void 0,priority:u};if(e){const E=await s({id:e.id,data:v});t?.(E)}else{const E=await r(v);t?.(E)}}catch(v){p(v instanceof Error?v.message:"Failed to save spec")}};return h.jsx(It,{className:"p-6",children:h.jsx("form",{onSubmit:y,children:h.jsxs("div",{className:"space-y-4",children:[h.jsx("div",{children:h.jsx("h2",{className:"mb-4 text-2xl font-bold",children:e?"Edit Spec":"New Spec"})}),f&&h.jsx("div",{className:"rounded-md bg-destructive/10 p-3 text-sm text-destructive",children:f}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"title",className:"mb-2 block text-sm font-medium",children:"Title *"}),h.jsx("input",{id:"title",type:"text",value:o,onChange:w=>a(w.target.value),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",placeholder:"Enter spec title"})]}),h.jsxs("div",{children:[h.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[h.jsx("label",{htmlFor:"content",className:"text-sm font-medium",children:"Content"}),h.jsxs("div",{className:"flex gap-1 rounded-md border border-border bg-muted/30 p-1",children:[h.jsxs(oe,{variant:m==="formatted"?"outline":"ghost",size:"sm",onClick:()=>g("formatted"),className:`h-7 rounded-sm ${m==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,type:"button",children:[h.jsx(ss,{className:"mr-2 h-4 w-4"}),"Formatted"]}),h.jsxs(oe,{variant:m==="markdown"?"outline":"ghost",size:"sm",onClick:()=>g("markdown"),className:`h-7 rounded-sm ${m==="markdown"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,type:"button",children:[h.jsx(rl,{className:"mr-2 h-4 w-4"}),"Markdown"]})]})]}),h.jsx(It,{className:"overflow-hidden rounded-md border",children:m==="formatted"?h.jsx(Bd,{content:l,editable:!0,onChange:w=>c(w),onSave:w=>c(w),onCancel:()=>{e&&c(e.content||"")},className:"min-h-[300px]",placeholder:"Spec content (markdown supported)..."}):h.jsx("div",{className:"p-4",children:h.jsx("textarea",{ref:b,id:"content",value:l,onChange:w=>c(w.target.value),className:"w-full resize-none border-none bg-transparent font-mono text-sm leading-6 outline-none focus:ring-0",placeholder:"Spec content (markdown supported)...",spellCheck:!1,style:{minHeight:"300px"},disabled:i})})})]}),h.jsxs("div",{children:[h.jsx("label",{htmlFor:"priority",className:"mb-2 block text-sm font-medium",children:"Priority"}),h.jsxs("select",{id:"priority",value:u,onChange:w=>d(Number(w.target.value)),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm",children:[h.jsx("option",{value:0,children:"Critical (0)"}),h.jsx("option",{value:1,children:"High (1)"}),h.jsx("option",{value:2,children:"Medium (2)"}),h.jsx("option",{value:3,children:"Low (3)"}),h.jsx("option",{value:4,children:"None (4)"})]})]}),h.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[n&&h.jsx(oe,{type:"button",variant:"outline",onClick:n,disabled:i,children:"Cancel"}),h.jsx(oe,{type:"submit",disabled:i,children:i?"Saving...":e?"Update":"Create"})]})]})})})}const Xv="sudocode:specs:sortOption";function ZK(){const{specs:e,isLoading:t}=Wd(),[n,r]=x.useState(!1),[s,i]=x.useState(""),[o,a]=x.useState(()=>{try{const f=localStorage.getItem(Xv);if(f&&["priority","newest","last-updated"].includes(f))return f}catch(f){console.error("Failed to load sort preference from localStorage:",f)}return"priority"}),l=cr(),c=f=>{r(!1),l(`/specs/${f.id}`)},u=f=>{const p=f;a(p);try{localStorage.setItem(Xv,p)}catch(m){console.error("Failed to save sort preference to localStorage:",m)}},d=x.useMemo(()=>[...s?e.filter(m=>{const g=s.toLowerCase();return m.title.toLowerCase().includes(g)||m.content&&m.content.toLowerCase().includes(g)}):e].sort((m,g)=>{switch(o){case"priority":return m.priority!==g.priority?m.priority-g.priority:new Date(g.created_at).getTime()-new Date(m.created_at).getTime();case"newest":return new Date(g.created_at).getTime()-new Date(m.created_at).getTime();case"last-updated":return new Date(g.updated_at).getTime()-new Date(m.updated_at).getTime();default:return 0}}),[e,s,o]);return n?h.jsx("div",{className:"flex-1 p-8",children:h.jsx(JK,{onSave:c,onCancel:()=>r(!1)})}):h.jsxs("div",{className:"flex h-screen flex-col",children:[h.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Specs"}),h.jsx(st,{variant:"secondary",children:e.length})]}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsxs("div",{className:"relative",children:[h.jsx(qu,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),h.jsx(is,{type:"text",placeholder:"Filter specs...",value:s,onChange:f=>i(f.target.value),className:"h-9 w-64 pl-8"})]}),h.jsxs(oe,{onClick:()=>l("/specs/archived"),variant:"ghost",size:"sm",className:"gap-1 text-muted-foreground hover:text-foreground",children:[h.jsx(Oo,{className:"h-4 w-4"}),"Archived"]}),h.jsxs(oe,{onClick:()=>r(!0),variant:"default",size:"sm",className:"text-primary-foreground hover:bg-primary/90",children:[h.jsx(Si,{className:"mr-2 h-4 w-4"}),"Create Spec"]})]})]}),h.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden px-8 py-4",children:[h.jsx("div",{className:"mb-4 flex justify-end",children:h.jsxs(Sn,{value:o,onValueChange:u,children:[h.jsx(dn,{className:"h-9 w-[180px]",children:h.jsx(En,{})}),h.jsxs(fn,{children:[h.jsx(xt,{value:"priority",children:"Priority"}),h.jsx(xt,{value:"newest",children:"Newest"}),h.jsx(xt,{value:"last-updated",children:"Last Updated"})]})]})}),h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(g_,{specs:d,loading:t})})]})]})}function YK(e){const t=rs(),n=or({mutationFn:i=>rf.create(i),onSuccess:()=>{t.invalidateQueries({queryKey:["feedback",e]})}}),r=or({mutationFn:({id:i,data:o})=>rf.update(i,o),onMutate:async({id:i,data:o})=>{await t.cancelQueries({queryKey:["feedback",e]});const a=t.getQueryData(["feedback",e]);return t.setQueryData(["feedback",e],l=>l?.map(c=>{if(c.id!==i)return c;const u={};return o.content!==void 0&&(u.content=o.content),o.feedback_type!==void 0&&(u.feedback_type=o.feedback_type),o.dismissed!==void 0&&(u.dismissed=o.dismissed),o.anchor!==void 0&&(u.anchor=typeof o.anchor=="string"?o.anchor:JSON.stringify(o.anchor)),{...c,...u}})),{previousFeedback:a}},onError:(i,o,a)=>{a?.previousFeedback&&t.setQueryData(["feedback",e],a.previousFeedback)},onSettled:()=>{t.invalidateQueries({queryKey:["feedback",e]})}}),s=or({mutationFn:i=>rf.delete(i),onMutate:async i=>{await t.cancelQueries({queryKey:["feedback",e]});const o=t.getQueryData(["feedback",e]);return t.setQueryData(["feedback",e],a=>a?.filter(l=>l.id!==i)),{previousFeedback:o}},onError:(i,o,a)=>{a?.previousFeedback&&t.setQueryData(["feedback",e],a.previousFeedback)},onSettled:()=>{t.invalidateQueries({queryKey:["feedback",e]})}});return{createFeedback:n.mutate,createFeedbackAsync:n.mutateAsync,updateFeedback:r.mutate,updateFeedbackAsync:r.mutateAsync,deleteFeedback:s.mutate,deleteFeedbackAsync:s.mutateAsync,isCreating:n.isPending,isUpdating:r.isPending,isDeleting:s.isPending}}function XK({type:e,count:t=1,onClick:n,className:r=""}){const s=()=>{switch(e){case"comment":return h.jsx(Vu,{className:"h-3 w-3"});case"suggestion":return h.jsx(Kw,{className:"h-3 w-3"});case"request":return h.jsx(ki,{className:"h-3 w-3"})}},i=()=>{switch(e){case"comment":return"bg-blue-600 hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-800";case"suggestion":return"bg-yellow-600 hover:bg-yellow-700 dark:bg-yellow-700 dark:hover:bg-yellow-800";case"request":return"bg-orange-600 hover:bg-orange-700 dark:bg-orange-700 dark:hover:bg-orange-800"}};return h.jsxs("button",{onClick:n,className:`inline-flex items-center gap-1 rounded-full px-2 py-0.5 text-xs font-medium text-white transition-colors ${i()} ${r}`,title:`${t} ${e}${t>1?"s":""}`,children:[s(),t>1&&h.jsx("span",{children:t})]})}function QK({content:e,showLineNumbers:t=!0,highlightLines:n=[],feedback:r=[],selectedLine:s,onLineClick:i,onTextSelect:o,onFeedbackClick:a,editable:l=!1,onChange:c,className:u=""}){const d=x.useRef(null),f=x.useMemo(()=>e.split(`
561
- `),[e]),p=x.useMemo(()=>{const y=new Map;return r.forEach(w=>{try{const v=w.anchor?JSON.parse(w.anchor):null;if(v?.line_number){const E=y.get(v.line_number)||[];y.set(v.line_number,[...E,w])}}catch(v){console.error("Failed to parse feedback anchor:",v)}}),y},[r]),m=y=>{i?.(y)},g=y=>{if(!o)return;const v=window.getSelection()?.toString().trim();v&&v.length>0&&o(v,y)},b=y=>{c?.(y.target.value)};return x.useEffect(()=>{if(l&&d.current){const y=d.current;y.style.height="auto",y.style.height=`${y.scrollHeight}px`}},[e,l]),h.jsx(It,{className:`overflow-hidden ${u}`,children:h.jsx("div",{className:"relative",children:l?h.jsx("div",{className:"px-4 py-4",children:h.jsx("textarea",{ref:d,value:e,onChange:b,className:"w-full resize-none border-none bg-transparent font-mono text-sm leading-6 outline-none focus:ring-0",spellCheck:!1})}):h.jsx("div",{className:`grid overflow-x-auto ${t?"grid-cols-[auto_1fr]":"grid-cols-1"}`,children:f.flatMap((y,w)=>{const v=w+1,E=p.get(v)||[],N=[];return t&&N.push(h.jsx("div",{className:`select-none border-r border-border bg-muted/30 px-4 py-1 text-right font-mono text-xs leading-6 text-muted-foreground transition-colors hover:bg-primary/10 ${n.includes(v)?"font-bold text-primary":""} ${s===v?"bg-primary/20":""}`,"data-line-number":v,onClick:()=>m(v),children:v},`line-${w}`)),N.push(h.jsx("div",{className:`group relative px-4 py-1 font-mono text-sm leading-6 ${n.includes(v)?"bg-primary/10":""} ${s===v?"bg-primary/20":""}`,"data-line":v,children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx("pre",{className:"m-0 inline flex-1 cursor-pointer whitespace-pre-wrap break-words font-mono transition-colors hover:bg-muted/30",onClick:()=>m(v),onMouseUp:()=>g(v),children:y||" "}),E.length>0&&h.jsx("div",{className:"flex flex-wrap gap-1",children:Array.from(new Set(E.map(k=>k.feedback_type))).map(k=>{const C=E.filter(A=>A.feedback_type===k);return h.jsx(XK,{type:k,count:C.length,onClick:()=>a?.(C[0])},k)})})]})},`content-${w}`)),N})})})})}function eG({content:e,feedback:t=[],selectedLine:n,onLineClick:r,onTextSelect:s,onFeedbackClick:i,onChange:o,viewMode:a="formatted",onViewModeChange:l,className:c=""}){return h.jsx(It,{className:`overflow-hidden ${c}`,children:a==="formatted"?h.jsx(Bd,{content:e,editable:!0,onChange:o,onCancel:()=>{},showLineNumbers:!1,selectedLine:n,onLineClick:r,placeholder:"Spec content..."}):h.jsx(QK,{content:e,feedback:t,selectedLine:n,onLineClick:r,onTextSelect:s,onFeedbackClick:i,showLineNumbers:!1,editable:!0,onChange:o})})}const tG=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nG=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,rG={};function Qv(e,t){return(rG.jsx?nG:tG).test(e)}var Ki={},yh,ew;function sG(){if(ew)return yh;ew=1;var e=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,t=/\n/g,n=/^\s*/,r=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,s=/^:\s*/,i=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,o=/^[;\s]*/,a=/^\s+|\s+$/g,l=`
562
- `,c="/",u="*",d="",f="comment",p="declaration";yh=function(g,b){if(typeof g!="string")throw new TypeError("First argument must be a string");if(!g)return[];b=b||{};var y=1,w=1;function v(j){var L=j.match(t);L&&(y+=L.length);var F=j.lastIndexOf(l);w=~F?j.length-F:w+j.length}function E(){var j={line:y,column:w};return function(L){return L.position=new N(j),A(),L}}function N(j){this.start=j,this.end={line:y,column:w},this.source=b.source}N.prototype.content=g;function k(j){var L=new Error(b.source+":"+y+":"+w+": "+j);if(L.reason=j,L.filename=b.source,L.line=y,L.column=w,L.source=g,!b.silent)throw L}function C(j){var L=j.exec(g);if(L){var F=L[0];return v(F),g=g.slice(F.length),L}}function A(){C(n)}function R(j){var L;for(j=j||[];L=T();)L!==!1&&j.push(L);return j}function T(){var j=E();if(!(c!=g.charAt(0)||u!=g.charAt(1))){for(var L=2;d!=g.charAt(L)&&(u!=g.charAt(L)||c!=g.charAt(L+1));)++L;if(L+=2,d===g.charAt(L-1))return k("End of comment missing");var F=g.slice(2,L-2);return w+=2,v(F),g=g.slice(L),w+=2,j({type:f,comment:F})}}function I(){var j=E(),L=C(r);if(L){if(T(),!C(s))return k("property missing ':'");var F=C(i),q=j({type:p,property:m(L[0].replace(e,d)),value:F?m(F[0].replace(e,d)):d});return C(o),q}}function O(){var j=[];R(j);for(var L;L=I();)L!==!1&&(j.push(L),R(j));return j}return A(),O()};function m(g){return g?g.replace(a,d):d}return yh}var tw;function iG(){if(tw)return Ki;tw=1;var e=Ki&&Ki.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ki,"__esModule",{value:!0}),Ki.default=n;const t=e(sG());function n(r,s){let i=null;if(!r||typeof r!="string")return i;const o=(0,t.default)(r),a=typeof s=="function";return o.forEach(l=>{if(l.type!=="declaration")return;const{property:c,value:u}=l;a?s(c,u,l):u&&(i=i||{},i[c]=u)}),i}return Ki}var ta={},nw;function oG(){if(nw)return ta;nw=1,Object.defineProperty(ta,"__esModule",{value:!0}),ta.camelCase=void 0;var e=/^--[a-zA-Z0-9_-]+$/,t=/-([a-z])/g,n=/^[^-]+$/,r=/^-(webkit|moz|ms|o|khtml)-/,s=/^-(ms)-/,i=function(c){return!c||n.test(c)||e.test(c)},o=function(c,u){return u.toUpperCase()},a=function(c,u){return"".concat(u,"-")},l=function(c,u){return u===void 0&&(u={}),i(c)?c:(c=c.toLowerCase(),u.reactCompat?c=c.replace(s,a):c=c.replace(r,a),c.replace(t,o))};return ta.camelCase=l,ta}var na,rw;function aG(){if(rw)return na;rw=1;var e=na&&na.__importDefault||function(s){return s&&s.__esModule?s:{default:s}},t=e(iG()),n=oG();function r(s,i){var o={};return!s||typeof s!="string"||(0,t.default)(s,function(a,l){a&&l&&(o[(0,n.camelCase)(a,i)]=l)}),o}return r.default=r,na=r,na}var lG=aG();const cG=tl(lG),Hg={}.hasOwnProperty,uG=new Map,dG=/[A-Z]/g,fG=new Set(["table","tbody","thead","tfoot","tr"]),hG=new Set(["td","th"]),b_="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function pG(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const n=t.filePath||void 0;let r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=kG(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=wG(n,t.jsx,t.jsxs)}const s={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?wl:wN,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},i=y_(s,e,void 0);return i&&typeof i!="string"?i:s.create(e,s.Fragment,{children:i||void 0},void 0)}function y_(e,t,n){if(t.type==="element")return mG(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return gG(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return yG(e,t,n);if(t.type==="mdxjsEsm")return bG(e,t);if(t.type==="root")return xG(e,t,n);if(t.type==="text")return vG(e,t)}function mG(e,t,n){const r=e.schema;let s=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(s=wl,e.schema=s),e.ancestors.push(t);const i=v_(e,t.tagName,!1),o=SG(e,t);let a=qg(e,t);return fG.has(t.tagName)&&(a=a.filter(function(l){return typeof l=="string"?!zd(l):!0})),x_(e,o,i,t),Vg(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function gG(e,t){if(t.data&&t.data.estree&&e.evaluater){const r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}Xa(e,t.position)}function bG(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);Xa(e,t.position)}function yG(e,t,n){const r=e.schema;let s=r;t.name==="svg"&&r.space==="html"&&(s=wl,e.schema=s),e.ancestors.push(t);const i=t.name===null?e.Fragment:v_(e,t.name,!0),o=EG(e,t),a=qg(e,t);return x_(e,o,i,t),Vg(o,a),e.ancestors.pop(),e.schema=r,e.create(t,i,o,n)}function xG(e,t,n){const r={};return Vg(r,qg(e,t)),e.create(t,e.Fragment,r,n)}function vG(e,t){return t.value}function x_(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function Vg(e,t){if(t.length>0){const n=t.length>1?t:t[0];n&&(e.children=n)}}function wG(e,t,n){return r;function r(s,i,o,a){const c=Array.isArray(o.children)?n:t;return a?c(i,o,a):c(i,o)}}function kG(e,t){return n;function n(r,s,i,o){const a=Array.isArray(i.children),l=Ng(r);return t(s,i,o,a,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function SG(e,t){const n={};let r,s;for(s in t.properties)if(s!=="children"&&Hg.call(t.properties,s)){const i=CG(e,s,t.properties[s]);if(i){const[o,a]=i;e.tableCellAlignToStyle&&o==="align"&&typeof a=="string"&&hG.has(t.tagName)?r=a:n[o]=a}}if(r){const i=n.style||(n.style={});i[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function EG(e,t){const n={};for(const r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){const i=r.data.estree.body[0];i.type;const o=i.expression;o.type;const a=o.properties[0];a.type,Object.assign(n,e.evaluater.evaluateExpression(a.argument))}else Xa(e,t.position);else{const s=r.name;let i;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){const a=r.value.data.estree.body[0];a.type,i=e.evaluater.evaluateExpression(a.expression)}else Xa(e,t.position);else i=r.value===null?!0:r.value;n[s]=i}return n}function qg(e,t){const n=[];let r=-1;const s=e.passKeys?new Map:uG;for(;++r<t.children.length;){const i=t.children[r];let o;if(e.passKeys){const l=i.type==="element"?i.tagName:i.type==="mdxJsxFlowElement"||i.type==="mdxJsxTextElement"?i.name:void 0;if(l){const c=s.get(l)||0;o=l+"-"+c,s.set(l,c+1)}}const a=y_(e,i,o);a!==void 0&&n.push(a)}return n}function CG(e,t,n){const r=vN(e.schema,t);if(!(n==null||typeof n=="number"&&Number.isNaN(n))){if(Array.isArray(n)&&(n=r.commaSeparated?SN(n):EN(n)),r.property==="style"){let s=typeof n=="object"?n:NG(e,String(n));return e.stylePropertyNameCase==="css"&&(s=_G(s)),["style",s]}return[e.elementAttributeNameCase==="react"&&r.space?f9[r.property]||r.property:r.attribute,n]}}function NG(e,t){try{return cG(t,{reactCompat:!0})}catch(n){if(e.ignoreInvalidStyle)return{};const r=n,s=new yn("Cannot parse `style` attribute",{ancestors:e.ancestors,cause:r,ruleId:"style",source:"hast-util-to-jsx-runtime"});throw s.file=e.filePath||void 0,s.url=b_+"#cannot-parse-style-attribute",s}}function v_(e,t,n){let r;if(!n)r={type:"Literal",value:t};else if(t.includes(".")){const s=t.split(".");let i=-1,o;for(;++i<s.length;){const a=Qv(s[i])?{type:"Identifier",name:s[i]}:{type:"Literal",value:s[i]};o=o?{type:"MemberExpression",object:o,property:a,computed:!!(i&&a.type==="Literal"),optional:!1}:a}r=o}else r=Qv(t)&&!/^[a-z]/.test(t)?{type:"Identifier",name:t}:{type:"Literal",value:t};if(r.type==="Literal"){const s=r.value;return Hg.call(e.components,s)?e.components[s]:s}if(e.evaluater)return e.evaluater.evaluateExpression(r);Xa(e)}function Xa(e,t){const n=new yn("Cannot handle MDX estrees without `createEvaluater`",{ancestors:e.ancestors,place:t,ruleId:"mdx-estree",source:"hast-util-to-jsx-runtime"});throw n.file=e.filePath||void 0,n.url=b_+"#cannot-handle-mdx-estrees-without-createevaluater",n}function _G(e){const t={};let n;for(n in e)Hg.call(e,n)&&(t[TG(n)]=e[n]);return t}function TG(e){let t=e.replace(dG,AG);return t.slice(0,3)==="ms-"&&(t="-"+t),t}function AG(e){return"-"+e.toLowerCase()}const xh={action:["form"],cite:["blockquote","del","ins","q"],data:["object"],formAction:["button","input"],href:["a","area","base","link"],icon:["menuitem"],itemId:null,manifest:["html"],ping:["a","area"],poster:["video"],src:["audio","embed","iframe","img","input","script","source","track","video"]},MG="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",sw=[],iw={allowDangerousHtml:!0},RG=/^(https?|ircs?|mailto|xmpp)$/i,OG=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function w_(e){const t=IG(e),n=DG(e);return LG(t.runSync(t.parse(n),n),e)}function IG(e){const t=e.rehypePlugins||sw,n=e.remarkPlugins||sw,r=e.remarkRehypeOptions?{...e.remarkRehypeOptions,...iw}:iw;return b1().use(O1).use(n).use(fN,r).use(t)}function DG(e){const t=e.children||"",n=new g1;return typeof t=="string"&&(n.value=t),n}function LG(e,t){const n=t.allowedElements,r=t.allowElement,s=t.components,i=t.disallowedElements,o=t.skipHtml,a=t.unwrapDisallowed,l=t.urlTransform||PG;for(const u of OG)Object.hasOwn(t,u.from)&&(""+u.from+(u.to?"use `"+u.to+"` instead":"remove it")+MG+u.id,void 0);return t.className&&(e={type:"element",tagName:"div",properties:{className:t.className},children:e.type==="root"?e.children:[e]}),Sg(e,c),pG(e,{Fragment:h.Fragment,components:s,ignoreInvalidStyle:!0,jsx:h.jsx,jsxs:h.jsxs,passKeys:!0,passNode:!0});function c(u,d,f){if(u.type==="raw"&&f&&typeof d=="number")return o?f.children.splice(d,1):f.children[d]={type:"text",value:u.value},d;if(u.type==="element"){let p;for(p in xh)if(Object.hasOwn(xh,p)&&Object.hasOwn(u.properties,p)){const m=u.properties[p],g=xh[p];(g===null||g.includes(u.tagName))&&(u.properties[p]=l(String(m||""),p,u))}}if(u.type==="element"){let p=n?!n.includes(u.tagName):i?i.includes(u.tagName):!1;if(!p&&r&&typeof d=="number"&&(p=!r(u,d,f)),p&&f&&typeof d=="number")return a&&u.children?f.children.splice(d,1,...u.children):f.children.splice(d,1),d}}}function PG(e){const t=e.indexOf(":"),n=e.indexOf("?"),r=e.indexOf("#"),s=e.indexOf("/");return t===-1||s!==-1&&t>s||n!==-1&&t>n||r!==-1&&t>r||RG.test(e.slice(0,t))?e:""}function jG({feedback:e,onDismiss:t,onDelete:n,onClick:r,className:s="",maxHeight:i=200,isCompact:o=!1}){const[a,l]=x.useState(!1),[c,u]=x.useState(!o),d=cr();let f=null;try{e.anchor&&(f=JSON.parse(e.anchor))}catch(b){console.error("Failed to parse feedback anchor:",b)}const p=b=>{switch(b){case"comment":return h.jsx(Vu,{className:"h-4 w-4"});case"suggestion":return h.jsx(Kw,{className:"h-4 w-4"});case"request":return h.jsx(ki,{className:"h-4 w-4"})}},m=b=>{switch(b){case"comment":return"text-blue-600 bg-blue-50";case"suggestion":return"text-yellow-600 bg-yellow-50";case"request":return"text-orange-600 bg-orange-50"}},g=()=>f?f.line_number?`L${f.line_number}`:f.section_heading?`§ ${f.section_heading}`:f.text_snippet?`"${f.text_snippet.slice(0,30)}${f.text_snippet.length>30?"...":""}"`:null:null;return h.jsx(It,{className:`relative cursor-pointer rounded-lg border-2 bg-card shadow-sm transition-all hover:border-primary/30 hover:shadow-lg ${e.dismissed?"opacity-60":""} ${s}`,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onClick:r,children:h.jsxs("div",{className:"p-3",children:[h.jsxs("div",{className:"mb-2",children:[h.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:`flex-shrink-0 rounded-full p-1.5 ${m(e.feedback_type)}`,title:e.feedback_type,children:p(e.feedback_type)}),h.jsx("button",{className:"text-xs font-medium text-foreground hover:text-primary hover:underline",onClick:b=>{b.stopPropagation(),d(`/issues/${e.issue_id}`)},children:e.issue_id})]}),(t||n)&&h.jsxs("div",{className:"flex flex-shrink-0 gap-1 transition-opacity duration-150",style:{opacity:a?1:0},children:[!e.dismissed&&t&&h.jsx(oe,{variant:"ghost",size:"sm",onClick:b=>{b.stopPropagation(),t(e.id)},title:"Dismiss",className:"h-6 w-6 p-0",children:h.jsx(Ww,{className:"h-3 w-3"})}),e.dismissed&&t&&h.jsx(oe,{variant:"ghost",size:"sm",onClick:b=>{b.stopPropagation(),t(e.id)},title:"Restore",className:"h-6 w-6 p-0",children:h.jsx(da,{className:"h-3 w-3"})}),n&&h.jsx(oe,{variant:"ghost",size:"sm",onClick:b=>{b.stopPropagation(),n(e.id)},title:"Delete",className:"h-6 w-6 p-0",children:h.jsx(Io,{className:"h-3 w-3"})})]})]}),h.jsxs("div",{className:"ml-9 flex items-center gap-2 text-xs text-muted-foreground",children:[f&&g()&&h.jsxs(h.Fragment,{children:[h.jsx("span",{className:"flex-shrink-0",children:g()}),h.jsx("span",{className:"flex-shrink-0",children:"•"})]}),h.jsx("span",{className:"flex-shrink-0",children:Mc(new Date(e.created_at.endsWith("Z")?e.created_at:e.created_at+"Z"),{addSuffix:!0})})]})]}),h.jsx("div",{className:"prose prose-sm dark:prose-invert text-sm text-foreground max-w-none",style:{maxHeight:c?`${i}px`:"3rem",overflowY:"auto",overflowX:"hidden"},children:h.jsx(w_,{remarkPlugins:[sN],components:{p:({children:b})=>h.jsx("p",{className:"my-1",children:b}),h1:({children:b})=>h.jsx("h1",{className:"text-lg font-bold my-1",children:b}),h2:({children:b})=>h.jsx("h2",{className:"text-base font-bold my-1",children:b}),h3:({children:b})=>h.jsx("h3",{className:"text-sm font-bold my-1",children:b}),ul:({children:b})=>h.jsx("ul",{className:"my-1 pl-4",children:b}),ol:({children:b})=>h.jsx("ol",{className:"my-1 pl-4",children:b}),li:({children:b})=>h.jsx("li",{className:"my-0.5",children:b}),code:({children:b,className:y})=>!y?h.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-xs",children:b}):h.jsx("code",{className:`block rounded bg-muted p-2 font-mono text-xs my-1 ${y||""}`,children:b}),pre:({children:b})=>h.jsx("pre",{className:"my-1",children:b}),blockquote:({children:b})=>h.jsx("blockquote",{className:"border-l-2 border-muted-foreground/30 pl-2 my-1 italic",children:b}),a:({href:b,children:y})=>h.jsx("a",{href:b,className:"text-primary underline hover:text-primary/80",target:"_blank",rel:"noopener noreferrer",onClick:w=>w.stopPropagation(),children:y}),strong:({children:b})=>h.jsx("strong",{className:"font-semibold",children:b}),em:({children:b})=>h.jsx("em",{className:"italic",children:b})},children:e.content})}),e.content.length>100&&h.jsx("button",{className:"mt-1 text-xs text-primary hover:underline",onClick:b=>{b.stopPropagation(),u(!c)},children:c?"Show less":"Show more"})]})})}function zG({positions:e,cardHeight:t=120,minSpacing:n=8}){return x.useMemo(()=>{const r=new Map,s=Array.from(e.entries()).map(([o,a])=>({id:o,idealTop:a})).sort((o,a)=>o.idealTop-a.idealTop),i=[];for(const o of s){let a=o.idealTop,l=!0;for(;l;){l=!1;for(const u of i){const d=u.actualTop+u.height+n,f=a+t;if(a<d&&f>u.actualTop){a=d,l=!0;break}}}const c={id:o.id,idealTop:o.idealTop,actualTop:a,height:t};i.push(c),r.set(o.id,c)}return r},[e,t,n])}const ow="sudocode:specs:showRelationshipsCollapsed";function FG(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function BG({feedback:e,positions:t,onFeedbackClick:n,onDismiss:r,onDelete:s,addFeedbackButton:i,className:o="",relationships:a,currentEntityId:l,onDeleteRelationship:c,onCreateRelationship:u}){const d=x.useRef(null),[f,p]=x.useState(!1),[m,g]=x.useState(()=>{const v=localStorage.getItem(ow);return v!==null?JSON.parse(v):!1}),b=(v,E,N)=>{u&&(u(v,E,N),p(!1))};x.useEffect(()=>{localStorage.setItem(ow,JSON.stringify(m))},[m]);const y=x.useMemo(()=>{const v=new Map,E=16;return e.forEach(N=>{const k=FG(N.anchor);if(!k||!k.line_number)v.set(N.id,E);else{const C=t.get(N.id);C!==void 0&&v.set(N.id,Math.max(C,E))}}),v},[e,t]),w=zG({positions:y,cardHeight:130,minSpacing:0});return h.jsxs("div",{className:`flex h-full w-80 flex-col bg-background md:w-96 lg:w-[28rem] xl:w-[32rem] ${o}`,children:[l&&h.jsxs("div",{className:"p-2",children:[h.jsxs("div",{className:"mb-2 flex cursor-pointer items-center justify-between rounded-md border p-2",onClick:()=>g(!m),children:[h.jsxs("div",{className:"flex items-center gap-2",children:[m?h.jsx(Aa,{className:"h-4 w-4 text-muted-foreground"}):h.jsx(am,{className:"h-4 w-4 text-muted-foreground"}),h.jsx("h3",{className:"text-sm font-medium text-muted-foreground",children:"Relationships"}),a&&a.length>0&&h.jsx(st,{variant:"secondary",children:a.length})]}),u&&h.jsxs(oe,{variant:"outline",size:"xs",onClick:v=>{v.stopPropagation(),p(!0)},className:"h-6",children:[h.jsx(Si,{className:"mr-1 h-4 w-4"}),"Add"]})]}),!m&&a&&a.length>0&&h.jsx(uS,{relationships:a,currentEntityId:l,currentEntityType:"spec",onDelete:c,showEmpty:!1,showGroupHeaders:!1})]}),h.jsx(Bi,{open:f,onOpenChange:p,children:h.jsxs(qs,{children:[h.jsx(Ws,{children:h.jsx(Ks,{children:"Add Relationship"})}),l&&h.jsx(hS,{fromId:l,fromType:"spec",onSubmit:b,onCancel:()=>p(!1)})]})}),i&&h.jsx("div",{className:"p-2",children:i}),h.jsx("div",{className:"relative min-h-full flex-1",children:h.jsxs("div",{ref:d,className:"relative w-full pt-4",children:[e.map(v=>{const E=w.get(v.id);return E?h.jsx("div",{className:"absolute w-full px-1",style:{top:`${E.actualTop}px`,zIndex:10},children:h.jsx(jG,{feedback:v,onClick:()=>n?.(v),onDismiss:r?()=>r(v.id):void 0,onDelete:s?()=>s(v.id):void 0,maxHeight:200,isCompact:!1})},v.id):null}),e.length>0&&h.jsx("div",{style:{height:`${Math.max(...Array.from(w.values()).map(v=>v.actualTop+v.height))+100}px`,pointerEvents:"none"}})]})})]})}function $G({issues:e=[],selectedIssueId:t,onIssueSelect:n,issueId:r,lineNumber:s,textSnippet:i,onSubmit:o,onCancel:a,className:l=""}){const[c,u]=x.useState("comment"),[d,f]=x.useState(""),[p,m]=x.useState(!1),g=t||r,b=async y=>{if(y.preventDefault(),!!d.trim()){m(!0);try{let w;(s||i)&&(w={line_number:s,text_snippet:i,anchor_status:"valid",last_verified_at:new Date().toISOString()}),await o({type:c,content:d.trim(),anchor:w}),f(""),u("comment")}finally{m(!1)}}};return h.jsxs("form",{onSubmit:b,className:`space-y-4 ${l}`,children:[(s||i)&&h.jsxs("div",{className:"rounded-md bg-muted/50 p-2 text-sm",children:[s&&h.jsxs("div",{className:"font-medium",children:["Line ",s]}),i&&h.jsxs("div",{className:"text-muted-foreground",children:['"',i.slice(0,60),i.length>60?"...":"",'"']})]}),e.length>0&&n&&h.jsxs("div",{children:[h.jsx(Ht,{htmlFor:"issue-select",children:"Issue"}),h.jsxs(Sn,{value:g,onValueChange:n,children:[h.jsx(dn,{id:"issue-select",children:h.jsx(En,{placeholder:"Select an issue..."})}),h.jsx(fn,{children:e.map(y=>h.jsxs(xt,{value:y.id,children:[y.id,": ",y.title]},y.id))})]})]}),h.jsxs("div",{children:[h.jsx(Ht,{htmlFor:"feedback-type",children:"Type"}),h.jsxs(Sn,{value:c,onValueChange:y=>u(y),children:[h.jsx(dn,{id:"feedback-type",children:h.jsx(En,{})}),h.jsxs(fn,{children:[h.jsx(xt,{value:"comment",children:"Comment"}),h.jsx(xt,{value:"suggestion",children:"Suggestion"}),h.jsx(xt,{value:"request",children:"Request"})]})]})]}),h.jsxs("div",{children:[h.jsx(Ht,{htmlFor:"feedback-content",children:"Content"}),h.jsx(gd,{id:"feedback-content",placeholder:"Enter your feedback...",value:d,onChange:y=>f(y.target.value),rows:4,required:!0,className:"resize-none"})]}),h.jsxs("div",{className:"flex gap-2",children:[h.jsx(oe,{type:"submit",disabled:!d.trim()||!g||p,children:p?"Adding...":"Add Feedback"}),h.jsx(oe,{type:"button",variant:"outline",onClick:a,children:"Cancel"})]})]})}function UG({issues:e,lineNumber:t,textSnippet:n,onSubmit:r,triggerButton:s}){const[i,o]=x.useState(!1),[a,l]=x.useState(),c=async u=>{a&&(await r({issueId:a,...u}),o(!1),l(void 0))};return h.jsxs(Bi,{open:i,onOpenChange:o,children:[h.jsx(MM,{asChild:!0,children:s||h.jsxs(oe,{variant:"outline",size:"sm",children:[h.jsx(cm,{className:"mr-2 h-4 w-4"}),"Add Feedback"]})}),h.jsxs(qs,{className:"sm:max-w-[500px]",children:[h.jsxs(Ws,{children:[h.jsx(Ks,{children:"Add Feedback"}),h.jsxs(Gu,{children:["Add a comment, suggestion, or request to this spec.",t&&` Anchored to line ${t}.`]})]}),h.jsx($G,{issues:e,selectedIssueId:a,onIssueSelect:l,lineNumber:t,textSnippet:n,onSubmit:c,onCancel:()=>o(!1)})]})]})}function HG(e,t){let n=null;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>e(...r),t)}}function VG(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function qG(e,t){const[n,r]=x.useState(new Map),s=x.useRef(null),i=x.useRef(null);return x.useEffect(()=>{const o=()=>{const u=new Map,d=t.current;if(!d){r(u);return}e.forEach(f=>{const p=VG(f.anchor);if(!p)return;let m=d.querySelector(`[data-feedback-id="${f.id}"]`);if(!m&&p.line_number!==void 0&&(m=d.querySelector(`[data-line-number="${p.line_number}"]`),!m)){const g=Array.from(d.querySelectorAll("[data-line-number]"));if(g.length>0&&p.line_number>0){let b=null,y=0;for(const w of g){const v=parseInt(w.getAttribute("data-line-number")||"0");v>0&&v<=p.line_number&&v>y&&(y=v,b=w)}m=b||g[0]}}if(m){let g=0,b=m;for(;b&&b!==d;)g+=b.offsetTop,b=b.offsetParent;u.set(f.id,g)}}),r(u)},a=()=>{i.current!==null&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(o)},l=HG(o,100),c=t.current;return c?.addEventListener("scroll",a,{passive:!0}),window.addEventListener("resize",l),s.current=setTimeout(o,50),()=>{c?.removeEventListener("scroll",a),window.removeEventListener("resize",l),s.current&&clearTimeout(s.current),i.current!==null&&cancelAnimationFrame(i.current)}},[e,t]),n}const WG=[{value:"0",label:"Critical (P0)"},{value:"1",label:"High (P1)"},{value:"2",label:"Medium (P2)"},{value:"3",label:"Low (P3)"},{value:"4",label:"None (P4)"}],aw="sudocode:specs:showFeedbackPanel",lw="sudocode:details:viewMode";function KG(){const{id:e}=em(),t=cr(),{spec:n,isLoading:r,isError:s}=VK(e||""),{feedback:i}=qK(e||""),{issues:o}=ed(),{updateSpec:a,isUpdating:l,archiveSpec:c,unarchiveSpec:u}=Wd(),{createFeedback:d,updateFeedback:f,deleteFeedback:p}=YK(e||""),[m,g]=x.useState(null),[b,y]=x.useState(null),[w,v]=x.useState(()=>{const ce=localStorage.getItem(aw);return ce!==null?JSON.parse(ce):!0}),[E,N]=x.useState(()=>{const ce=localStorage.getItem(lw);return ce!==null?JSON.parse(ce):"formatted"}),[k,C]=x.useState(""),[A,R]=x.useState(""),[T,I]=x.useState(2),[O,j]=x.useState(!1),[L,F]=x.useState([]),[q,te]=x.useState(!1),K=x.useRef(null),le=x.useRef(a),_=x.useRef({title:k,content:A,priority:T,hasChanges:O}),ae=x.useRef(e),me=x.useRef(null),S=qG(i,me);if(x.useEffect(()=>{le.current=a},[a]),x.useEffect(()=>{_.current={title:k,content:A,priority:T,hasChanges:O}},[k,A,T,O]),x.useEffect(()=>{ae.current=e},[e]),x.useEffect(()=>{K.current&&(clearTimeout(K.current),K.current=null),j(!1)},[e]),x.useEffect(()=>{n&&(C(n.title),R(n.content||""),I(n.priority??2),j(!1))},[n]),x.useEffect(()=>{(async()=>{if(e){te(!0);try{const ne=await co.getForEntity(e,"spec");let et=[];if(Array.isArray(ne))et=ne;else if(ne&&typeof ne=="object"&&"outgoing"in ne&&"incoming"in ne){const We=ne;et=[...We.outgoing||[],...We.incoming||[]]}F(et)}catch(ne){console.error("Failed to fetch relationships:",ne),F([])}finally{te(!1)}}})()},[e]),x.useEffect(()=>{if(!(!O||!e))return K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{le.current({id:e,data:{title:k,content:A,priority:T}}),j(!1)},1e3),()=>{K.current&&clearTimeout(K.current)}},[k,A,T,O]),x.useEffect(()=>()=>{const{hasChanges:ce,title:ne,content:et,priority:We}=_.current,ie=ae.current;ce&&ie&&le.current&&le.current({id:ie,data:{title:ne,content:et,priority:We}})},[]),x.useEffect(()=>{localStorage.setItem(aw,JSON.stringify(w))},[w]),x.useEffect(()=>{localStorage.setItem(lw,JSON.stringify(E))},[E]),r)return h.jsx("div",{className:"flex items-center justify-center p-12",children:h.jsxs("div",{className:"text-center",children:[h.jsx("div",{className:"mx-auto mb-4 h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),h.jsx("p",{className:"text-muted-foreground",children:"Loading spec..."})]})});if(s||!n)return h.jsx("div",{className:"flex items-center justify-center p-12",children:h.jsxs("div",{className:"text-center",children:[h.jsx("h2",{className:"mb-2 text-2xl font-bold",children:"Spec not found"}),h.jsx("p",{className:"mb-4 text-muted-foreground",children:"The spec you're looking for doesn't exist or has been deleted."}),h.jsx(oe,{onClick:()=>t("/specs"),children:"Back to Specs"})]})});const B=ce=>{g(ce),y(null),v(!0)},$=(ce,ne)=>{y(ce),g(ne),v(!0)},D=ce=>{try{const ne=ce.anchor?JSON.parse(ce.anchor):null;ne?.line_number&&g(ne.line_number)}catch(ne){console.error("Failed to parse feedback anchor:",ne)}},P=ce=>{C(ce),j(!0)},W=ce=>{R(ce),j(!0)},fe=ce=>{I(ce),j(!0)},ee=ce=>{const ne=i.find(et=>et.id===ce);ne&&f({id:ce,data:{dismissed:!ne.dismissed}})},be=ce=>{p(ce)},Me=async ce=>{if(!e){console.error("Cannot create feedback without spec ID");return}await d({spec_id:e,issue_id:ce.issueId,feedback_type:ce.type,content:ce.content,anchor:ce.anchor})},Le=async ce=>{try{await co.delete({from_id:ce.from_id,from_type:ce.from_type,to_id:ce.to_id,to_type:ce.to_type,relationship_type:ce.relationship_type}),F(L.filter(ne=>!(ne.from_id===ce.from_id&&ne.to_id===ce.to_id&&ne.relationship_type===ce.relationship_type)))}catch(ne){console.error("Failed to delete relationship:",ne)}},Ke=async(ce,ne,et)=>{if(e)try{const We=await co.create({from_id:e,from_type:"spec",to_id:ce,to_type:ne,relationship_type:et});F([...L,We])}catch(We){console.error("Failed to create relationship:",We)}};return h.jsxs("div",{className:"flex h-screen flex-col",children:[h.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-4",children:[h.jsx("div",{className:"flex items-center gap-4",children:h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>t("/specs"),children:"← Back to Specs"})}),h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("div",{className:"flex items-center gap-2",children:h.jsxs("div",{className:"inline-flex rounded-md border border-border bg-muted/30 p-1",children:[h.jsxs(oe,{variant:E==="formatted"?"outline":"ghost",size:"sm",onClick:()=>N("formatted"),className:`h-7 rounded-sm ${E==="formatted"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[h.jsx(ss,{className:"mr-2 h-4 w-4"}),"Formatted"]}),h.jsxs(oe,{variant:E==="source"?"outline":"ghost",size:"sm",onClick:()=>N("source"),className:`h-7 rounded-sm ${E==="source"?"shadow-sm":"text-muted-foreground hover:bg-muted"}`,children:[h.jsx(rl,{className:"mr-2 h-4 w-4"}),"Markdown"]})]})}),h.jsx(Ei,{children:h.jsxs(rr,{children:[h.jsx(sr,{asChild:!0,children:h.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>v(!w),children:[w?h.jsx(wA,{className:"h-4 w-4"}):h.jsx(Vu,{className:"h-4 w-4"}),i.length>0&&h.jsx("span",{className:"ml-2 rounded-full bg-primary px-2 py-0.5 text-xs text-primary-foreground",children:i.length})]})}),h.jsx(Un,{children:h.jsxs("p",{children:[w?"Hide":"Show"," feedback"]})})]})}),n.archived?h.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>u(n.id),disabled:l,children:[h.jsx(im,{className:"mr-2 h-4 w-4"}),"Unarchive"]}):h.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>c(n.id),disabled:l,children:[h.jsx(Oo,{className:"mr-2 h-4 w-4"}),"Archive"]})]})]}),h.jsx("div",{ref:me,className:"flex flex-1 overflow-auto xl:justify-center",children:h.jsxs("div",{className:"flex w-full xl:max-w-[1600px]",children:[h.jsx("div",{className:"flex-1 px-6 py-4 lg:px-12 xl:px-16",children:h.jsxs("div",{className:"mx-auto max-w-4xl space-y-3",children:[h.jsxs("div",{className:"space-y-2 pb-3",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsx("span",{className:"font-mono text-sm text-muted-foreground",children:n.id}),h.jsx("div",{className:"text-xs italic text-muted-foreground",children:l?"Saving...":O?"Unsaved changes...":"All changes saved"})]}),h.jsx(is,{value:k,onChange:ce=>P(ce.target.value),disabled:l,placeholder:"Spec title...",className:"border-none bg-transparent px-0 text-2xl font-semibold shadow-none focus-visible:ring-0"})]}),h.jsxs("div",{className:"flex flex-wrap items-center gap-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(Jw,{className:"h-4 w-4 text-muted-foreground"}),h.jsxs(Sn,{value:String(T),onValueChange:ce=>fe(parseInt(ce)),disabled:l,children:[h.jsx(dn,{className:"h-8 w-auto gap-3 rounded-md border-none bg-accent px-3 shadow-none hover:bg-accent/80",children:h.jsx(En,{placeholder:"Priority"})}),h.jsx(fn,{children:WG.map(ce=>h.jsx(xt,{value:ce.value,children:ce.label},ce.value))})]})]}),h.jsx("div",{className:"ml-auto flex items-center gap-4 text-xs text-muted-foreground",children:n.updated_at&&h.jsxs("div",{className:"ml-auto flex items-center text-xs text-muted-foreground",children:["Updated ",Mc(new Date(n.updated_at.endsWith("Z")?n.updated_at:n.updated_at+"Z"),{addSuffix:!0})]})})]}),A!==void 0?h.jsx(eG,{content:A,feedback:i,selectedLine:m,onLineClick:B,onTextSelect:$,onFeedbackClick:D,onChange:W,viewMode:E,onViewModeChange:N}):h.jsx(It,{className:"p-8 text-center",children:h.jsx("p",{className:"text-muted-foreground",children:"No content available for this spec."})})]})}),w&&h.jsx(BG,{feedback:i,positions:S,relationships:L,currentEntityId:e,onFeedbackClick:D,onDismiss:ee,onDelete:be,onDeleteRelationship:Le,onCreateRelationship:Ke,addFeedbackButton:h.jsx("div",{className:"flex justify-center",children:h.jsx(UG,{issues:o,lineNumber:m||void 0,onSubmit:Me,triggerButton:h.jsxs(oe,{variant:"secondary",size:"sm",children:[h.jsx(cm,{className:"mr-2 h-4 w-4"}),"Add Feedback"]})})})})]})})]})}function GG(){const e=cr(),{issues:t,isLoading:n,isError:r,error:s,updateIssue:i,deleteIssue:o,unarchiveIssue:a,isUpdating:l,isDeleting:c}=ed(!0),[u,d]=x.useState(),[f,p]=x.useState(""),m=x.useMemo(()=>{const E=f?t.filter(k=>{const C=f.toLowerCase();return k.title.toLowerCase().includes(C)||k.content&&k.content.toLowerCase().includes(C)}):t,N={open:[],in_progress:[],blocked:[],needs_review:[],closed:[]};return E.forEach(k=>{const C=k.status.toLowerCase();N[C]?N[C].push(k):N.open.push(k)}),Object.keys(N).forEach(k=>{const C=k;C==="closed"?N[C].sort((A,R)=>{const T=A.closed_at?new Date(A.closed_at).getTime():0;return(R.closed_at?new Date(R.closed_at).getTime():0)-T}):N[C].sort((A,R)=>A.priority!==R.priority?A.priority-R.priority:new Date(A.created_at).getTime()-new Date(R.created_at).getTime())}),N},[t,f]),g=x.useCallback(E=>{d(E)},[]),b=x.useCallback(()=>{d(void 0)},[]),y=x.useCallback(E=>{u&&i({id:u.id,data:E})},[u,i]),w=x.useCallback(()=>{u&&(o(u.id),d(void 0))},[u,o]),v=x.useCallback(E=>{a(E)},[a]);return n?h.jsx("div",{className:"flex items-center justify-center p-8",children:h.jsx("p",{className:"text-muted-foreground",children:"Loading archived issues..."})}):r?h.jsx("div",{className:"flex items-center justify-center p-8",children:h.jsxs("p",{className:"text-destructive",children:["Error loading archived issues: ",s?.message||"Unknown error"]})}):h.jsxs("div",{className:"flex h-screen flex-col",children:[h.jsxs("div",{className:"flex items-center justify-between border-b bg-background p-4",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>e("/issues"),className:"h-8 w-8 p-0",children:h.jsx(Hu,{className:"h-4 w-4"})}),h.jsxs("div",{children:[h.jsx("h1",{className:"text-2xl font-bold",children:"Archived Issues"}),h.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.length," archived issues"]})]})]}),h.jsxs("div",{className:"relative",children:[h.jsx(qu,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),h.jsx(is,{type:"text",placeholder:"Filter issues...",value:f,onChange:E=>p(E.target.value),className:"h-9 w-64 pl-8"})]})]}),h.jsx("div",{className:"flex flex-1 overflow-hidden",children:u?h.jsxs($g,{direction:"horizontal",className:"h-full min-h-0",onLayout:E=>{if(E.length===2)try{localStorage.setItem("archivedIssuesPage.panelSizes",JSON.stringify(E))}catch{}},children:[h.jsx(Ja,{id:"kanban",order:1,defaultSize:(()=>{try{const E=localStorage.getItem("archivedIssuesPage.panelSizes");if(E){const N=JSON.parse(E);if(Array.isArray(N)&&N.length===2)return N[0]}}catch{}return 66})(),minSize:30,className:"min-w-0 min-h-0 overflow-auto",children:h.jsx(Ac,{groupedIssues:m,onDragEnd:()=>{},onViewIssueDetails:g,selectedIssue:u})}),h.jsxs(Ug,{className:"relative z-30 w-1 bg-border cursor-col-resize group touch-none focus:outline-none focus-visible:ring-2 focus-visible:ring-ring/60 focus-visible:ring-offset-1 focus-visible:ring-offset-background",children:[h.jsx("div",{className:"pointer-events-none absolute inset-y-0 left-1/2 -translate-x-1/2 w-px bg-border"}),h.jsxs("div",{className:"pointer-events-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 flex flex-col items-center gap-1 bg-muted/90 border border-border rounded-full px-1.5 py-3 opacity-70 group-hover:opacity-100 group-focus:opacity-100 transition-opacity shadow-sm",children:[h.jsx("span",{className:"w-1 h-1 rounded-full bg-muted-foreground"}),h.jsx("span",{className:"w-1 h-1 rounded-full bg-muted-foreground"}),h.jsx("span",{className:"w-1 h-1 rounded-full bg-muted-foreground"})]})]}),h.jsx(Ja,{id:"details",order:2,defaultSize:(()=>{try{const E=localStorage.getItem("archivedIssuesPage.panelSizes");if(E){const N=JSON.parse(E);if(Array.isArray(N)&&N.length===2)return N[1]}}catch{}return 34})(),minSize:20,className:"min-w-0 min-h-0 overflow-hidden border-l bg-background shadow-lg",children:h.jsx(jg,{issue:u,onClose:b,onUpdate:y,onDelete:w,onUnarchive:v,isUpdating:l,isDeleting:c})})]}):h.jsx("div",{className:"flex-1 overflow-auto",children:h.jsx(Ac,{groupedIssues:m,onDragEnd:()=>{},onViewIssueDetails:g,selectedIssue:u})})})]})}function JG(){const{specs:e,isLoading:t}=Wd(!0),n=cr(),[r,s]=x.useState(""),i=r?e.filter(o=>{const a=r.toLowerCase();return o.title.toLowerCase().includes(a)||o.content&&o.content.toLowerCase().includes(a)}):e;return h.jsxs("div",{className:"flex-1 p-8",children:[h.jsxs("div",{className:"mb-6 flex items-center justify-between",children:[h.jsxs("div",{children:[h.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[h.jsx(oe,{variant:"ghost",size:"sm",onClick:()=>n("/specs"),className:"h-8 w-8 p-0",children:h.jsx(Hu,{className:"h-4 w-4"})}),h.jsx("h1",{className:"text-3xl font-bold",children:"Archived Specs"})]}),h.jsx("p",{className:"text-muted-foreground ml-10",children:t?"Loading...":`${e.length} archived spec${e.length!==1?"s":""}`})]}),h.jsxs("div",{className:"relative",children:[h.jsx(qu,{className:"absolute left-2 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),h.jsx(is,{type:"text",placeholder:"Filter specs...",value:r,onChange:o=>s(o.target.value),className:"h-9 w-64 pl-8"})]})]}),h.jsx(g_,{specs:i,loading:t})]})}var Qe;(function(e){e.assertEqual=s=>{};function t(s){}e.assertIs=t;function n(s){throw new Error}e.assertNever=n,e.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},e.getValidEnumValues=s=>{const i=e.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(const a of i)o[a]=s[a];return e.objectValues(o)},e.objectValues=s=>e.objectKeys(s).map(function(i){return s[i]}),e.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},e.find=(s,i)=>{for(const o of s)if(i(o))return o},e.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}e.joinValues=r,e.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(Qe||(Qe={}));var cw;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(cw||(cw={}));const pe=Qe.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ks=e=>{switch(typeof e){case"undefined":return pe.undefined;case"string":return pe.string;case"number":return Number.isNaN(e)?pe.nan:pe.number;case"boolean":return pe.boolean;case"function":return pe.function;case"bigint":return pe.bigint;case"symbol":return pe.symbol;case"object":return Array.isArray(e)?pe.array:e===null?pe.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?pe.promise:typeof Map<"u"&&e instanceof Map?pe.map:typeof Set<"u"&&e instanceof Set?pe.set:typeof Date<"u"&&e instanceof Date?pe.date:pe.object;default:return pe.unknown}},Y=Qe.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class ts extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=t}format(t){const n=t||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let a=r,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(a[c]=a[c]||{_errors:[]},a[c]._errors.push(n(o))):a[c]=a[c]||{_errors:[]},a=a[c],l++}}};return s(this),r}static assert(t){if(!(t instanceof ts))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Qe.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(t(s))}else r.push(t(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ts.create=e=>new ts(e);const Up=(e,t)=>{let n;switch(e.code){case Y.invalid_type:e.received===pe.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case Y.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,Qe.jsonStringifyReplacer)}`;break;case Y.unrecognized_keys:n=`Unrecognized key(s) in object: ${Qe.joinValues(e.keys,", ")}`;break;case Y.invalid_union:n="Invalid input";break;case Y.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${Qe.joinValues(e.options)}`;break;case Y.invalid_enum_value:n=`Invalid enum value. Expected ${Qe.joinValues(e.options)}, received '${e.received}'`;break;case Y.invalid_arguments:n="Invalid function arguments";break;case Y.invalid_return_type:n="Invalid function return type";break;case Y.invalid_date:n="Invalid date";break;case Y.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:Qe.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case Y.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case Y.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:n="Invalid input";break;case Y.custom:n="Invalid input";break;case Y.invalid_intersection_types:n="Intersection results could not be merged";break;case Y.not_multiple_of:n=`Number must be a multiple of ${e.multipleOf}`;break;case Y.not_finite:n="Number must be finite";break;default:n=t.defaultError,Qe.assertNever(e)}return{message:n}};let ZG=Up;function YG(){return ZG}const XG=e=>{const{data:t,path:n,errorMaps:r,issueData:s}=e,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let a="";const l=r.filter(c=>!!c).slice().reverse();for(const c of l)a=c(o,{data:t,defaultError:a}).message;return{...s,path:i,message:a}};function he(e,t){const n=YG(),r=XG({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===Up?void 0:Up].filter(s=>!!s)});e.common.issues.push(r)}class Kn{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const r=[];for(const s of n){if(s.status==="aborted")return Oe;s.status==="dirty"&&t.dirty(),r.push(s.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return Kn.mergeObjectSync(t,r)}static mergeObjectSync(t,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return Oe;i.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:t.value,value:r}}}const Oe=Object.freeze({status:"aborted"}),ua=e=>({status:"dirty",value:e}),ur=e=>({status:"valid",value:e}),uw=e=>e.status==="aborted",dw=e=>e.status==="dirty",Ao=e=>e.status==="valid",Mu=e=>typeof Promise<"u"&&e instanceof Promise;var ge;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(ge||(ge={}));class Hs{constructor(t,n,r,s){this._cachedPath=[],this.parent=t,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const fw=(e,t)=>{if(Ao(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ts(e.common.issues);return this._error=n,this._error}}};function qe(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:r,description:s}=e;if(t&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:s}:{errorMap:(o,a)=>{const{message:l}=e;return o.code==="invalid_enum_value"?{message:l??a.defaultError}:typeof a.data>"u"?{message:l??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:l??n??a.defaultError}},description:s}}class Xe{get description(){return this._def.description}_getType(t){return ks(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:ks(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new Kn,ctx:{common:t.parent.common,data:t.data,parsedType:ks(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Mu(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const r=this.safeParse(t,n);if(r.success)return r.data;throw r.error}safeParse(t,n){const r={common:{issues:[],async:n?.async??!1,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ks(t)},s=this._parseSync({data:t,path:r.path,parent:r});return fw(r,s)}"~validate"(t){const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ks(t)};if(!this["~standard"].async)try{const r=this._parseSync({data:t,path:[],parent:n});return Ao(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:n}).then(r=>Ao(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(t,n){const r=await this.safeParseAsync(t,n);if(r.success)return r.data;throw r.error}async safeParseAsync(t,n){const r={common:{issues:[],contextualErrorMap:n?.errorMap,async:!0},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ks(t)},s=this._parse({data:t,path:r.path,parent:r}),i=await(Mu(s)?s:Promise.resolve(s));return fw(r,i)}refine(t,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=t(s),a=()=>i.addIssue({code:Y.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(a(),!1)):o?!0:(a(),!1)})}refinement(t,n){return this._refinement((r,s)=>t(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(t){return new zi({schema:this,typeName:De.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return Qr.create(this,this._def)}nullable(){return Fi.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Ir.create(this)}promise(){return Pu.create(this,this._def)}or(t){return Ou.create([this,t],this._def)}and(t){return Iu.create(this,t,this._def)}transform(t){return new zi({...qe(this._def),schema:this,typeName:De.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new ju({...qe(this._def),innerType:this,defaultValue:n,typeName:De.ZodDefault})}brand(){return new C_({typeName:De.ZodBranded,type:this,...qe(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new zu({...qe(this._def),innerType:this,catchValue:n,typeName:De.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Kg.create(this,t)}readonly(){return Fu.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const QG=/^c[^\s-]{8,}$/i,e8=/^[0-9a-z]+$/,t8=/^[0-9A-HJKMNP-TV-Z]{26}$/i,n8=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,r8=/^[a-z0-9_-]{21}$/i,s8=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,i8=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,o8=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,a8="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let vh;const l8=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,c8=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,u8=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,d8=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,f8=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,h8=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,k_="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",p8=new RegExp(`^${k_}$`);function S_(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function m8(e){return new RegExp(`^${S_(e)}$`)}function g8(e){let t=`${k_}T${S_(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function b8(e,t){return!!((t==="v4"||!t)&&l8.test(e)||(t==="v6"||!t)&&u8.test(e))}function y8(e,t){if(!s8.test(e))return!1;try{const[n]=e.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||t&&s.alg!==t)}catch{return!1}}function x8(e,t){return!!((t==="v4"||!t)&&c8.test(e)||(t==="v6"||!t)&&d8.test(e))}class Os extends Xe{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==pe.string){const i=this._getOrReturnCtx(t);return he(i,{code:Y.invalid_type,expected:pe.string,received:i.parsedType}),Oe}const r=new Kn;let s;for(const i of this._def.checks)if(i.kind==="min")t.data.length<i.value&&(s=this._getOrReturnCtx(t,s),he(s,{code:Y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")t.data.length>i.value&&(s=this._getOrReturnCtx(t,s),he(s,{code:Y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=t.data.length>i.value,a=t.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(t,s),o?he(s,{code:Y.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):a&&he(s,{code:Y.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")o8.test(t.data)||(s=this._getOrReturnCtx(t,s),he(s,{validation:"email",code:Y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")vh||(vh=new RegExp(a8,"u")),vh.test(t.data)||(s=this._getOrReturnCtx(t,s),he(s,{validation:"emoji",code:Y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")n8.test(t.data)||(s=this._getOrReturnCtx(t,s),he(s,{validation:"uuid",code:Y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")r8.test(t.data)||(s=this._getOrReturnCtx(t,s),he(s,{validation:"nanoid",code:Y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")QG.test(t.data)||(s=this._getOrReturnCtx(t,s),he(s,{validation:"cuid",code:Y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")e8.test(t.data)||(s=this._getOrReturnCtx(t,s),he(s,{validation:"cuid2",code:Y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")t8.test(t.data)||(s=this._getOrReturnCtx(t,s),he(s,{validation:"ulid",code:Y.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(t.data)}catch{s=this._getOrReturnCtx(t,s),he(s,{validation:"url",code:Y.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(t.data)||(s=this._getOrReturnCtx(t,s),he(s,{validation:"regex",code:Y.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?t.data=t.data.trim():i.kind==="includes"?t.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(t,s),he(s,{code:Y.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?t.data=t.data.toLowerCase():i.kind==="toUpperCase"?t.data=t.data.toUpperCase():i.kind==="startsWith"?t.data.startsWith(i.value)||(s=this._getOrReturnCtx(t,s),he(s,{code:Y.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?t.data.endsWith(i.value)||(s=this._getOrReturnCtx(t,s),he(s,{code:Y.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?g8(i).test(t.data)||(s=this._getOrReturnCtx(t,s),he(s,{code:Y.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?p8.test(t.data)||(s=this._getOrReturnCtx(t,s),he(s,{code:Y.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?m8(i).test(t.data)||(s=this._getOrReturnCtx(t,s),he(s,{code:Y.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?i8.test(t.data)||(s=this._getOrReturnCtx(t,s),he(s,{validation:"duration",code:Y.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?b8(t.data,i.version)||(s=this._getOrReturnCtx(t,s),he(s,{validation:"ip",code:Y.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?y8(t.data,i.alg)||(s=this._getOrReturnCtx(t,s),he(s,{validation:"jwt",code:Y.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?x8(t.data,i.version)||(s=this._getOrReturnCtx(t,s),he(s,{validation:"cidr",code:Y.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?f8.test(t.data)||(s=this._getOrReturnCtx(t,s),he(s,{validation:"base64",code:Y.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?h8.test(t.data)||(s=this._getOrReturnCtx(t,s),he(s,{validation:"base64url",code:Y.invalid_string,message:i.message}),r.dirty()):Qe.assertNever(i);return{status:r.value,value:t.data}}_regex(t,n,r){return this.refinement(s=>t.test(s),{validation:n,code:Y.invalid_string,...ge.errToObj(r)})}_addCheck(t){return new Os({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...ge.errToObj(t)})}url(t){return this._addCheck({kind:"url",...ge.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...ge.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...ge.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...ge.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...ge.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...ge.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...ge.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...ge.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...ge.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...ge.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...ge.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...ge.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:t?.offset??!1,local:t?.local??!1,...ge.errToObj(t?.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof t?.precision>"u"?null:t?.precision,...ge.errToObj(t?.message)})}duration(t){return this._addCheck({kind:"duration",...ge.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...ge.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n?.position,...ge.errToObj(n?.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...ge.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...ge.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...ge.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...ge.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...ge.errToObj(n)})}nonempty(t){return this.min(1,ge.errToObj(t))}trim(){return new Os({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Os({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Os({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Os.create=e=>new Os({checks:[],typeName:De.ZodString,coerce:e?.coerce??!1,...qe(e)});function v8(e,t){const n=(e.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(e.toFixed(s).replace(".","")),o=Number.parseInt(t.toFixed(s).replace(".",""));return i%o/10**s}class Mo extends Xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==pe.number){const i=this._getOrReturnCtx(t);return he(i,{code:Y.invalid_type,expected:pe.number,received:i.parsedType}),Oe}let r;const s=new Kn;for(const i of this._def.checks)i.kind==="int"?Qe.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),he(r,{code:Y.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),he(r,{code:Y.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),he(r,{code:Y.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?v8(t.data,i.value)!==0&&(r=this._getOrReturnCtx(t,r),he(r,{code:Y.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),he(r,{code:Y.not_finite,message:i.message}),s.dirty()):Qe.assertNever(i);return{status:s.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,ge.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ge.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ge.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ge.toString(n))}setLimit(t,n,r,s){return new Mo({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ge.toString(s)}]})}_addCheck(t){return new Mo({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:ge.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:ge.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ge.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:ge.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:ge.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:ge.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Qe.isInteger(t.value))}get isFinite(){let t=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(n)&&Number.isFinite(t)}}Mo.create=e=>new Mo({checks:[],typeName:De.ZodNumber,coerce:e?.coerce||!1,...qe(e)});class Qa extends Xe{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==pe.bigint)return this._getInvalidInput(t);let r;const s=new Kn;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?t.data<i.value:t.data<=i.value)&&(r=this._getOrReturnCtx(t,r),he(r,{code:Y.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?t.data>i.value:t.data>=i.value)&&(r=this._getOrReturnCtx(t,r),he(r,{code:Y.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?t.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),he(r,{code:Y.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):Qe.assertNever(i);return{status:s.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return he(n,{code:Y.invalid_type,expected:pe.bigint,received:n.parsedType}),Oe}gte(t,n){return this.setLimit("min",t,!0,ge.toString(n))}gt(t,n){return this.setLimit("min",t,!1,ge.toString(n))}lte(t,n){return this.setLimit("max",t,!0,ge.toString(n))}lt(t,n){return this.setLimit("max",t,!1,ge.toString(n))}setLimit(t,n,r,s){return new Qa({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:r,message:ge.toString(s)}]})}_addCheck(t){return new Qa({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:ge.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:ge.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:ge.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:ge.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t}}Qa.create=e=>new Qa({checks:[],typeName:De.ZodBigInt,coerce:e?.coerce??!1,...qe(e)});class hw extends Xe{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==pe.boolean){const r=this._getOrReturnCtx(t);return he(r,{code:Y.invalid_type,expected:pe.boolean,received:r.parsedType}),Oe}return ur(t.data)}}hw.create=e=>new hw({typeName:De.ZodBoolean,coerce:e?.coerce||!1,...qe(e)});class Ru extends Xe{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==pe.date){const i=this._getOrReturnCtx(t);return he(i,{code:Y.invalid_type,expected:pe.date,received:i.parsedType}),Oe}if(Number.isNaN(t.data.getTime())){const i=this._getOrReturnCtx(t);return he(i,{code:Y.invalid_date}),Oe}const r=new Kn;let s;for(const i of this._def.checks)i.kind==="min"?t.data.getTime()<i.value&&(s=this._getOrReturnCtx(t,s),he(s,{code:Y.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?t.data.getTime()>i.value&&(s=this._getOrReturnCtx(t,s),he(s,{code:Y.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):Qe.assertNever(i);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Ru({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:ge.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:ge.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.value<t)&&(t=n.value);return t!=null?new Date(t):null}}Ru.create=e=>new Ru({checks:[],coerce:e?.coerce||!1,typeName:De.ZodDate,...qe(e)});class pw extends Xe{_parse(t){if(this._getType(t)!==pe.symbol){const r=this._getOrReturnCtx(t);return he(r,{code:Y.invalid_type,expected:pe.symbol,received:r.parsedType}),Oe}return ur(t.data)}}pw.create=e=>new pw({typeName:De.ZodSymbol,...qe(e)});class Hp extends Xe{_parse(t){if(this._getType(t)!==pe.undefined){const r=this._getOrReturnCtx(t);return he(r,{code:Y.invalid_type,expected:pe.undefined,received:r.parsedType}),Oe}return ur(t.data)}}Hp.create=e=>new Hp({typeName:De.ZodUndefined,...qe(e)});class Vp extends Xe{_parse(t){if(this._getType(t)!==pe.null){const r=this._getOrReturnCtx(t);return he(r,{code:Y.invalid_type,expected:pe.null,received:r.parsedType}),Oe}return ur(t.data)}}Vp.create=e=>new Vp({typeName:De.ZodNull,...qe(e)});class qp extends Xe{constructor(){super(...arguments),this._any=!0}_parse(t){return ur(t.data)}}qp.create=e=>new qp({typeName:De.ZodAny,...qe(e)});class mw extends Xe{constructor(){super(...arguments),this._unknown=!0}_parse(t){return ur(t.data)}}mw.create=e=>new mw({typeName:De.ZodUnknown,...qe(e)});class Vs extends Xe{_parse(t){const n=this._getOrReturnCtx(t);return he(n,{code:Y.invalid_type,expected:pe.never,received:n.parsedType}),Oe}}Vs.create=e=>new Vs({typeName:De.ZodNever,...qe(e)});class gw extends Xe{_parse(t){if(this._getType(t)!==pe.undefined){const r=this._getOrReturnCtx(t);return he(r,{code:Y.invalid_type,expected:pe.void,received:r.parsedType}),Oe}return ur(t.data)}}gw.create=e=>new gw({typeName:De.ZodVoid,...qe(e)});class Ir extends Xe{_parse(t){const{ctx:n,status:r}=this._processInputParams(t),s=this._def;if(n.parsedType!==pe.array)return he(n,{code:Y.invalid_type,expected:pe.array,received:n.parsedType}),Oe;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(he(n,{code:o?Y.too_big:Y.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(he(n,{code:Y.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(he(n,{code:Y.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new Hs(n,o,n.path,a)))).then(o=>Kn.mergeArray(r,o));const i=[...n.data].map((o,a)=>s.type._parseSync(new Hs(n,o,n.path,a)));return Kn.mergeArray(r,i)}get element(){return this._def.type}min(t,n){return new Ir({...this._def,minLength:{value:t,message:ge.toString(n)}})}max(t,n){return new Ir({...this._def,maxLength:{value:t,message:ge.toString(n)}})}length(t,n){return new Ir({...this._def,exactLength:{value:t,message:ge.toString(n)}})}nonempty(t){return this.min(1,t)}}Ir.create=(e,t)=>new Ir({type:e,minLength:null,maxLength:null,exactLength:null,typeName:De.ZodArray,...qe(t)});function no(e){if(e instanceof zt){const t={};for(const n in e.shape){const r=e.shape[n];t[n]=Qr.create(no(r))}return new zt({...e._def,shape:()=>t})}else return e instanceof Ir?new Ir({...e._def,type:no(e.element)}):e instanceof Qr?Qr.create(no(e.unwrap())):e instanceof Fi?Fi.create(no(e.unwrap())):e instanceof Pi?Pi.create(e.items.map(t=>no(t))):e}class zt extends Xe{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=Qe.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==pe.object){const c=this._getOrReturnCtx(t);return he(c,{code:Y.invalid_type,expected:pe.object,received:c.parsedType}),Oe}const{status:r,ctx:s}=this._processInputParams(t),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Vs&&this._def.unknownKeys==="strip"))for(const c in s.data)o.includes(c)||a.push(c);const l=[];for(const c of o){const u=i[c],d=s.data[c];l.push({key:{status:"valid",value:c},value:u._parse(new Hs(s,d,s.path,c)),alwaysSet:c in s.data})}if(this._def.catchall instanceof Vs){const c=this._def.unknownKeys;if(c==="passthrough")for(const u of a)l.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(c==="strict")a.length>0&&(he(s,{code:Y.unrecognized_keys,keys:a}),r.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const u of a){const d=s.data[u];l.push({key:{status:"valid",value:u},value:c._parse(new Hs(s,d,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const c=[];for(const u of l){const d=await u.key,f=await u.value;c.push({key:d,value:f,alwaysSet:u.alwaysSet})}return c}).then(c=>Kn.mergeObjectSync(r,c)):Kn.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return ge.errToObj,new zt({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(n,r)=>{const s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:ge.errToObj(t).message??s}:{message:s}}}:{}})}strip(){return new zt({...this._def,unknownKeys:"strip"})}passthrough(){return new zt({...this._def,unknownKeys:"passthrough"})}extend(t){return new zt({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new zt({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:De.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new zt({...this._def,catchall:t})}pick(t){const n={};for(const r of Qe.objectKeys(t))t[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new zt({...this._def,shape:()=>n})}omit(t){const n={};for(const r of Qe.objectKeys(this.shape))t[r]||(n[r]=this.shape[r]);return new zt({...this._def,shape:()=>n})}deepPartial(){return no(this)}partial(t){const n={};for(const r of Qe.objectKeys(this.shape)){const s=this.shape[r];t&&!t[r]?n[r]=s:n[r]=s.optional()}return new zt({...this._def,shape:()=>n})}required(t){const n={};for(const r of Qe.objectKeys(this.shape))if(t&&!t[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof Qr;)i=i._def.innerType;n[r]=i}return new zt({...this._def,shape:()=>n})}keyof(){return E_(Qe.objectKeys(this.shape))}}zt.create=(e,t)=>new zt({shape:()=>e,unknownKeys:"strip",catchall:Vs.create(),typeName:De.ZodObject,...qe(t)});zt.strictCreate=(e,t)=>new zt({shape:()=>e,unknownKeys:"strict",catchall:Vs.create(),typeName:De.ZodObject,...qe(t)});zt.lazycreate=(e,t)=>new zt({shape:e,unknownKeys:"strip",catchall:Vs.create(),typeName:De.ZodObject,...qe(t)});class Ou extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=this._def.options;function s(i){for(const a of i)if(a.result.status==="valid")return a.result;for(const a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(a=>new ts(a.ctx.common.issues));return he(n,{code:Y.invalid_union,unionErrors:o}),Oe}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const l of r){const c={...n,common:{...n.common,issues:[]},parent:null},u=l._parseSync({data:n.data,path:n.path,parent:c});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const a=o.map(l=>new ts(l));return he(n,{code:Y.invalid_union,unionErrors:a}),Oe}}get options(){return this._def.options}}Ou.create=(e,t)=>new Ou({options:e,typeName:De.ZodUnion,...qe(t)});const Kr=e=>e instanceof Kp?Kr(e.schema):e instanceof zi?Kr(e.innerType()):e instanceof Du?[e.value]:e instanceof ji?e.options:e instanceof Lu?Qe.objectValues(e.enum):e instanceof ju?Kr(e._def.innerType):e instanceof Hp?[void 0]:e instanceof Vp?[null]:e instanceof Qr?[void 0,...Kr(e.unwrap())]:e instanceof Fi?[null,...Kr(e.unwrap())]:e instanceof C_||e instanceof Fu?Kr(e.unwrap()):e instanceof zu?Kr(e._def.innerType):[];class Wg extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==pe.object)return he(n,{code:Y.invalid_type,expected:pe.object,received:n.parsedType}),Oe;const r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(he(n,{code:Y.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),Oe)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,n,r){const s=new Map;for(const i of n){const o=Kr(i.shape[t]);if(!o.length)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(const a of o){if(s.has(a))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(a)}`);s.set(a,i)}}return new Wg({typeName:De.ZodDiscriminatedUnion,discriminator:t,options:n,optionsMap:s,...qe(r)})}}function Wp(e,t){const n=ks(e),r=ks(t);if(e===t)return{valid:!0,data:e};if(n===pe.object&&r===pe.object){const s=Qe.objectKeys(t),i=Qe.objectKeys(e).filter(a=>s.indexOf(a)!==-1),o={...e,...t};for(const a of i){const l=Wp(e[a],t[a]);if(!l.valid)return{valid:!1};o[a]=l.data}return{valid:!0,data:o}}else if(n===pe.array&&r===pe.array){if(e.length!==t.length)return{valid:!1};const s=[];for(let i=0;i<e.length;i++){const o=e[i],a=t[i],l=Wp(o,a);if(!l.valid)return{valid:!1};s.push(l.data)}return{valid:!0,data:s}}else return n===pe.date&&r===pe.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}class Iu extends Xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=(i,o)=>{if(uw(i)||uw(o))return Oe;const a=Wp(i.value,o.value);return a.valid?((dw(i)||dw(o))&&n.dirty(),{status:n.value,value:a.data}):(he(r,{code:Y.invalid_intersection_types}),Oe)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Iu.create=(e,t,n)=>new Iu({left:e,right:t,typeName:De.ZodIntersection,...qe(n)});class Pi extends Xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==pe.array)return he(r,{code:Y.invalid_type,expected:pe.array,received:r.parsedType}),Oe;if(r.data.length<this._def.items.length)return he(r,{code:Y.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Oe;!this._def.rest&&r.data.length>this._def.items.length&&(he(r,{code:Y.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,a)=>{const l=this._def.items[a]||this._def.rest;return l?l._parse(new Hs(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>Kn.mergeArray(n,o)):Kn.mergeArray(n,i)}get items(){return this._def.items}rest(t){return new Pi({...this._def,rest:t})}}Pi.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Pi({items:e,typeName:De.ZodTuple,rest:null,...qe(t)})};class bw extends Xe{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==pe.map)return he(r,{code:Y.invalid_type,expected:pe.map,received:r.parsedType}),Oe;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,l],c)=>({key:s._parse(new Hs(r,a,r.path,[c,"key"])),value:i._parse(new Hs(r,l,r.path,[c,"value"]))}));if(r.common.async){const a=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,u=await l.value;if(c.status==="aborted"||u.status==="aborted")return Oe;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}})}else{const a=new Map;for(const l of o){const c=l.key,u=l.value;if(c.status==="aborted"||u.status==="aborted")return Oe;(c.status==="dirty"||u.status==="dirty")&&n.dirty(),a.set(c.value,u.value)}return{status:n.value,value:a}}}}bw.create=(e,t,n)=>new bw({valueType:t,keyType:e,typeName:De.ZodMap,...qe(n)});class el extends Xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.parsedType!==pe.set)return he(r,{code:Y.invalid_type,expected:pe.set,received:r.parsedType}),Oe;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(he(r,{code:Y.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(he(r,{code:Y.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const u of l){if(u.status==="aborted")return Oe;u.status==="dirty"&&n.dirty(),c.add(u.value)}return{status:n.value,value:c}}const a=[...r.data.values()].map((l,c)=>i._parse(new Hs(r,l,r.path,c)));return r.common.async?Promise.all(a).then(l=>o(l)):o(a)}min(t,n){return new el({...this._def,minSize:{value:t,message:ge.toString(n)}})}max(t,n){return new el({...this._def,maxSize:{value:t,message:ge.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}el.create=(e,t)=>new el({valueType:e,minSize:null,maxSize:null,typeName:De.ZodSet,...qe(t)});class Kp extends Xe{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Kp.create=(e,t)=>new Kp({getter:e,typeName:De.ZodLazy,...qe(t)});class Du extends Xe{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return he(n,{received:n.data,code:Y.invalid_literal,expected:this._def.value}),Oe}return{status:"valid",value:t.data}}get value(){return this._def.value}}Du.create=(e,t)=>new Du({value:e,typeName:De.ZodLiteral,...qe(t)});function E_(e,t){return new ji({values:e,typeName:De.ZodEnum,...qe(t)})}class ji extends Xe{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),r=this._def.values;return he(n,{expected:Qe.joinValues(r),received:n.parsedType,code:Y.invalid_type}),Oe}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),r=this._def.values;return he(n,{received:n.data,code:Y.invalid_enum_value,options:r}),Oe}return ur(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return ji.create(t,{...this._def,...n})}exclude(t,n=this._def){return ji.create(this.options.filter(r=>!t.includes(r)),{...this._def,...n})}}ji.create=E_;class Lu extends Xe{_parse(t){const n=Qe.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==pe.string&&r.parsedType!==pe.number){const s=Qe.objectValues(n);return he(r,{expected:Qe.joinValues(s),received:r.parsedType,code:Y.invalid_type}),Oe}if(this._cache||(this._cache=new Set(Qe.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const s=Qe.objectValues(n);return he(r,{received:r.data,code:Y.invalid_enum_value,options:s}),Oe}return ur(t.data)}get enum(){return this._def.values}}Lu.create=(e,t)=>new Lu({values:e,typeName:De.ZodNativeEnum,...qe(t)});class Pu extends Xe{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==pe.promise&&n.common.async===!1)return he(n,{code:Y.invalid_type,expected:pe.promise,received:n.parsedType}),Oe;const r=n.parsedType===pe.promise?n.data:Promise.resolve(n.data);return ur(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Pu.create=(e,t)=>new Pu({type:e,typeName:De.ZodPromise,...qe(t)});class zi extends Xe{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===De.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:r}=this._processInputParams(t),s=this._def.effect||null,i={addIssue:o=>{he(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return Oe;const l=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return l.status==="aborted"?Oe:l.status==="dirty"||n.value==="dirty"?ua(l.value):l});{if(n.value==="aborted")return Oe;const a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?Oe:a.status==="dirty"||n.value==="dirty"?ua(a.value):a}}if(s.type==="refinement"){const o=a=>{const l=s.refinement(a,i);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?Oe:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?Oe:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ao(o))return Oe;const a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>Ao(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):Oe);Qe.assertNever(s)}}zi.create=(e,t,n)=>new zi({schema:e,typeName:De.ZodEffects,effect:t,...qe(n)});zi.createWithPreprocess=(e,t,n)=>new zi({schema:t,effect:{type:"preprocess",transform:e},typeName:De.ZodEffects,...qe(n)});class Qr extends Xe{_parse(t){return this._getType(t)===pe.undefined?ur(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Qr.create=(e,t)=>new Qr({innerType:e,typeName:De.ZodOptional,...qe(t)});class Fi extends Xe{_parse(t){return this._getType(t)===pe.null?ur(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}Fi.create=(e,t)=>new Fi({innerType:e,typeName:De.ZodNullable,...qe(t)});class ju extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t);let r=n.data;return n.parsedType===pe.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}ju.create=(e,t)=>new ju({innerType:e,typeName:De.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...qe(t)});class zu extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Mu(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new ts(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ts(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}zu.create=(e,t)=>new zu({innerType:e,typeName:De.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...qe(t)});class yw extends Xe{_parse(t){if(this._getType(t)!==pe.nan){const r=this._getOrReturnCtx(t);return he(r,{code:Y.invalid_type,expected:pe.nan,received:r.parsedType}),Oe}return{status:"valid",value:t.data}}}yw.create=e=>new yw({typeName:De.ZodNaN,...qe(e)});class C_ extends Xe{_parse(t){const{ctx:n}=this._processInputParams(t),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Kg extends Xe{_parse(t){const{status:n,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?Oe:i.status==="dirty"?(n.dirty(),ua(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?Oe:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(t,n){return new Kg({in:t,out:n,typeName:De.ZodPipeline})}}class Fu extends Xe{_parse(t){const n=this._def.innerType._parse(t),r=s=>(Ao(s)&&(s.value=Object.freeze(s.value)),s);return Mu(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Fu.create=(e,t)=>new Fu({innerType:e,typeName:De.ZodReadonly,...qe(t)});var De;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(De||(De={}));const Ae=Os.create,w8=Mo.create,ns=qp.create;Vs.create;const yo=Ir.create,ei=zt.create,N_=Ou.create,__=Wg.create;Iu.create;Pi.create;const He=Du.create;ji.create;const k8=Lu.create;Pu.create;Qr.create;Fi.create;var S8=ei({name:Ae(),arguments:Ae()}),E8=ei({id:Ae(),type:He("function"),function:S8}),Kd=ei({id:Ae(),role:Ae(),content:Ae().optional(),name:Ae().optional()}),C8=Kd.extend({role:He("developer"),content:Ae()}),N8=Kd.extend({role:He("system"),content:Ae()}),_8=Kd.extend({role:He("assistant"),content:Ae().optional(),toolCalls:yo(E8).optional()}),T8=Kd.extend({role:He("user"),content:Ae()}),A8=ei({id:Ae(),content:Ae(),role:He("tool"),toolCallId:Ae(),error:Ae().optional()}),T_=__("role",[C8,N8,_8,T8,A8]);N_([He("developer"),He("system"),He("assistant"),He("user"),He("tool")]);var M8=ei({description:Ae(),value:Ae()}),R8=ei({name:Ae(),description:Ae(),parameters:ns()});ei({threadId:Ae(),runId:Ae(),state:ns(),messages:yo(T_),tools:yo(R8),context:yo(M8),forwardedProps:ns()});var O8=ns(),A_=N_([He("developer"),He("system"),He("assistant"),He("user")]),ln=(e=>(e.TEXT_MESSAGE_START="TEXT_MESSAGE_START",e.TEXT_MESSAGE_CONTENT="TEXT_MESSAGE_CONTENT",e.TEXT_MESSAGE_END="TEXT_MESSAGE_END",e.TEXT_MESSAGE_CHUNK="TEXT_MESSAGE_CHUNK",e.THINKING_TEXT_MESSAGE_START="THINKING_TEXT_MESSAGE_START",e.THINKING_TEXT_MESSAGE_CONTENT="THINKING_TEXT_MESSAGE_CONTENT",e.THINKING_TEXT_MESSAGE_END="THINKING_TEXT_MESSAGE_END",e.TOOL_CALL_START="TOOL_CALL_START",e.TOOL_CALL_ARGS="TOOL_CALL_ARGS",e.TOOL_CALL_END="TOOL_CALL_END",e.TOOL_CALL_CHUNK="TOOL_CALL_CHUNK",e.TOOL_CALL_RESULT="TOOL_CALL_RESULT",e.THINKING_START="THINKING_START",e.THINKING_END="THINKING_END",e.STATE_SNAPSHOT="STATE_SNAPSHOT",e.STATE_DELTA="STATE_DELTA",e.MESSAGES_SNAPSHOT="MESSAGES_SNAPSHOT",e.RAW="RAW",e.CUSTOM="CUSTOM",e.RUN_STARTED="RUN_STARTED",e.RUN_FINISHED="RUN_FINISHED",e.RUN_ERROR="RUN_ERROR",e.STEP_STARTED="STEP_STARTED",e.STEP_FINISHED="STEP_FINISHED",e))(ln||{}),Tt=ei({type:k8(ln),timestamp:w8().optional(),rawEvent:ns().optional()}),I8=Tt.extend({type:He("TEXT_MESSAGE_START"),messageId:Ae(),role:A_.default("assistant")}),M_=Tt.extend({type:He("TEXT_MESSAGE_CONTENT"),messageId:Ae(),delta:Ae().refine(e=>e.length>0,"Delta must not be an empty string")}),D8=Tt.extend({type:He("TEXT_MESSAGE_END"),messageId:Ae()}),L8=Tt.extend({type:He("TEXT_MESSAGE_CHUNK"),messageId:Ae().optional(),role:A_.optional(),delta:Ae().optional()}),P8=Tt.extend({type:He("THINKING_TEXT_MESSAGE_START")}),j8=M_.omit({messageId:!0,type:!0}).extend({type:He("THINKING_TEXT_MESSAGE_CONTENT")}),z8=Tt.extend({type:He("THINKING_TEXT_MESSAGE_END")}),F8=Tt.extend({type:He("TOOL_CALL_START"),toolCallId:Ae(),toolCallName:Ae(),parentMessageId:Ae().optional()}),B8=Tt.extend({type:He("TOOL_CALL_ARGS"),toolCallId:Ae(),delta:Ae()}),$8=Tt.extend({type:He("TOOL_CALL_END"),toolCallId:Ae()}),U8=Tt.extend({messageId:Ae(),type:He("TOOL_CALL_RESULT"),toolCallId:Ae(),content:Ae(),role:He("tool").optional()}),H8=Tt.extend({type:He("TOOL_CALL_CHUNK"),toolCallId:Ae().optional(),toolCallName:Ae().optional(),parentMessageId:Ae().optional(),delta:Ae().optional()}),V8=Tt.extend({type:He("THINKING_START"),title:Ae().optional()}),q8=Tt.extend({type:He("THINKING_END")}),W8=Tt.extend({type:He("STATE_SNAPSHOT"),snapshot:O8}),K8=Tt.extend({type:He("STATE_DELTA"),delta:yo(ns())}),G8=Tt.extend({type:He("MESSAGES_SNAPSHOT"),messages:yo(T_)}),J8=Tt.extend({type:He("RAW"),event:ns(),source:Ae().optional()}),Z8=Tt.extend({type:He("CUSTOM"),name:Ae(),value:ns()}),Y8=Tt.extend({type:He("RUN_STARTED"),threadId:Ae(),runId:Ae()}),X8=Tt.extend({type:He("RUN_FINISHED"),threadId:Ae(),runId:Ae(),result:ns().optional()}),Q8=Tt.extend({type:He("RUN_ERROR"),message:Ae(),code:Ae().optional()}),e7=Tt.extend({type:He("STEP_STARTED"),stepName:Ae()}),t7=Tt.extend({type:He("STEP_FINISHED"),stepName:Ae()});__("type",[I8,M_,D8,L8,V8,q8,P8,j8,z8,F8,B8,$8,H8,U8,W8,K8,G8,J8,Z8,Y8,X8,Q8,e7,t7]);function n7(e){const{executionId:t,autoConnect:n=!0,reconnectOnError:r=!1,endpoint:s,onEvent:i}=e,[o,a]=x.useState("idle"),[l,c]=x.useState({runId:null,threadId:null,status:"idle",currentStep:null,error:null,startTime:null,endTime:null}),[u,d]=x.useState(new Map),[f,p]=x.useState(new Map),[m,g]=x.useState({}),[b,y]=x.useState(null),w=x.useRef(null),v=x.useRef(null),E=x.useRef(i),N=x.useRef(!1);x.useEffect(()=>{E.current=i},[i]);const k=x.useCallback(S=>{c(B=>({...B,runId:S.runId,threadId:S.threadId,status:"running",startTime:S.timestamp||Date.now()})),E.current?.onRunStarted?.(S)},[]),C=x.useCallback(S=>{c(B=>({...B,status:"completed",endTime:S.timestamp||Date.now()})),E.current?.onRunFinished?.(S),N.current=!0,w.current&&(w.current.close(),w.current=null,a("disconnected"))},[]),A=x.useCallback(S=>{c(B=>({...B,status:"error",error:S.message,endTime:S.timestamp||Date.now()})),y(new Error(S.message)),E.current?.onRunError?.(S),N.current=!0,w.current&&(w.current.close(),w.current=null,a("disconnected"))},[]),R=x.useCallback(S=>{c(B=>({...B,currentStep:S.stepName})),E.current?.onStepStarted?.(S)},[]),T=x.useCallback(S=>{E.current?.onStepFinished?.(S)},[]),I=x.useCallback(S=>{d(B=>{const $=new Map(B);return $.set(S.messageId,{messageId:S.messageId,role:S.role||"assistant",content:"",complete:!1,timestamp:S.timestamp||Date.now()}),$})},[]),O=x.useCallback(S=>{d(B=>{const $=new Map(B),D=$.get(S.messageId);if(D){const P={...D,content:D.content+S.delta};$.set(S.messageId,P),E.current?.onMessage?.(P)}return $})},[]),j=x.useCallback(S=>{d(B=>{const $=new Map(B),D=$.get(S.messageId);if(D){const P={...D,complete:!0};$.set(S.messageId,P),E.current?.onMessage?.(P)}return $})},[]),L=x.useCallback(S=>{p(B=>{const $=new Map(B);return $.set(S.toolCallId,{toolCallId:S.toolCallId,toolCallName:S.toolCallName,args:"",status:"started",startTime:S.timestamp||Date.now()}),$}),E.current?.onToolCallStart?.(S)},[]),F=x.useCallback(S=>{p(B=>{const $=new Map(B),D=$.get(S.toolCallId);return D&&$.set(S.toolCallId,{...D,args:D.args+S.delta,status:"executing"}),$})},[]),q=x.useCallback(S=>{p(B=>{const $=new Map(B),D=$.get(S.toolCallId);return D&&$.set(S.toolCallId,{...D,endTime:S.timestamp||Date.now()}),$}),E.current?.onToolCallEnd?.(S)},[]),te=x.useCallback(S=>{p(B=>{const $=new Map(B),D=$.get(S.toolCallId);return D&&$.set(S.toolCallId,{...D,result:S.content,status:"completed"}),$})},[]),K=x.useCallback(S=>{g(S.snapshot),E.current?.onStateUpdate?.(S.snapshot)},[]),le=x.useCallback(S=>{g(B=>{let $={...B};for(const D of S.delta)if(D.op==="replace"){const P=D.path.slice(1);$={...$,[P]:D.value}}else if(D.op==="add"){const P=D.path.slice(1);$={...$,[P]:D.value}}return E.current?.onStateUpdate?.($),$})},[]),_=x.useCallback(()=>{if(N.current){console.debug("[SSE] Skipping connection - execution already completed");return}if(w.current){console.warn("EventSource already connected");return}const S=s||`/api/executions/${t}/stream`;console.debug("[SSE]. Connecting to SSE stream",{executionId:t,url:S,timestamp:new Date().toISOString()}),a("connecting"),y(null);try{const B=new EventSource(S);w.current=B,B.onopen=()=>{console.debug("[SSE]. SSE connection established",{executionId:t,timestamp:new Date().toISOString()}),a("connected")},B.onerror=$=>{if(console.error("EventSource error:",$),N.current){ae();return}a("error"),y(new Error("SSE connection error")),r&&v.current===null&&(console.debug("[SSE] Reconnecting in 3 seconds..."),v.current=setTimeout(()=>{v.current=null,ae(),_()},3e3))},B.addEventListener(ln.RUN_STARTED,$=>{k(JSON.parse($.data))}),B.addEventListener(ln.RUN_FINISHED,$=>{C(JSON.parse($.data))}),B.addEventListener(ln.RUN_ERROR,$=>{A(JSON.parse($.data))}),B.addEventListener(ln.STEP_STARTED,$=>{R(JSON.parse($.data))}),B.addEventListener(ln.STEP_FINISHED,$=>{T(JSON.parse($.data))}),B.addEventListener(ln.TEXT_MESSAGE_START,$=>{I(JSON.parse($.data))}),B.addEventListener(ln.TEXT_MESSAGE_CONTENT,$=>{O(JSON.parse($.data))}),B.addEventListener(ln.TEXT_MESSAGE_END,$=>{j(JSON.parse($.data))}),B.addEventListener(ln.TOOL_CALL_START,$=>{L(JSON.parse($.data))}),B.addEventListener(ln.TOOL_CALL_ARGS,$=>{F(JSON.parse($.data))}),B.addEventListener(ln.TOOL_CALL_END,$=>{q(JSON.parse($.data))}),B.addEventListener(ln.TOOL_CALL_RESULT,$=>{te(JSON.parse($.data))}),B.addEventListener(ln.STATE_SNAPSHOT,$=>{K(JSON.parse($.data))}),B.addEventListener(ln.STATE_DELTA,$=>{le(JSON.parse($.data))})}catch(B){console.error("Failed to create EventSource:",B),a("error"),y(B instanceof Error?B:new Error("Unknown error"))}},[t,s,r,k,C,A,R,T,I,O,j,L,F,q,te,K,le]),ae=x.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null),w.current&&(w.current.close(),w.current=null,a("disconnected"))},[]),me=x.useCallback(()=>{N.current=!1,ae(),_()},[ae,_]);return x.useEffect(()=>(n&&_(),()=>{v.current&&(clearTimeout(v.current),v.current=null),w.current&&(w.current.close(),w.current=null,a("disconnected"))}),[n,t]),{connectionStatus:o,execution:l,messages:u,toolCalls:f,state:m,error:b,connect:_,disconnect:ae,reconnect:me,isConnected:o==="connected"}}function r7(e,t){const n=[],r=Date.now();switch(e.type){case"assistant":{const s=e.message?.content||[];for(const i of s)if(i.type==="text"&&i.text)n.push({type:"CUSTOM",timestamp:r,name:"TEXT_MESSAGE_CONTENT",value:{content:i.text}});else if(i.type==="tool_use"){const o=i.id||`tool-${Date.now()}`;n.push({type:"TOOL_CALL_START",timestamp:r,toolCallId:o,toolCallName:i.name||"unknown"},{type:"TOOL_CALL_ARGS",timestamp:r,toolCallId:o,delta:JSON.stringify(i.input||{})})}break}case"tool_result":{const s=e.result?.tool_use_id||"unknown",o=(e.result?.content||[]).find(a=>a.type==="text")?.text||"";n.push({type:"TOOL_CALL_END",timestamp:r,toolCallId:s},{type:"TOOL_CALL_RESULT",timestamp:r,messageId:`msg-${s}`,toolCallId:s,content:o});break}case"result":{if(e.usage){const s=e.usage;n.push({type:"CUSTOM",timestamp:r,name:"USAGE_UPDATE",value:{inputTokens:s.input_tokens||0,outputTokens:s.output_tokens||0,cacheTokens:s.cache_read_input_tokens||0,totalTokens:(s.input_tokens||0)+(s.output_tokens||0)}})}break}case"error":{n.push({type:"RUN_ERROR",timestamp:r,message:e.error?.message||"Unknown error",errorType:e.error?.type});break}}return n}async function s7(e){const t=[];let n=0;for(let r=0;r<e.length;r++){const s=e[r].trim();if(s)try{const i=JSON.parse(s),o=r7(i,n);t.push(...o),n+=o.length}catch(i){console.warn(`[parseExecutionLogs] Failed to parse log line ${r+1}:`,i instanceof Error?i.message:String(i))}}return t}function i7(e){const[t,n]=x.useState([]),[r,s]=x.useState(!0),[i,o]=x.useState(null),[a,l]=x.useState(null);return x.useEffect(()=>{s(!0),o(null),n([]),l(null);const c=new AbortController;async function u(){try{const d=await fetch(`/api/executions/${e}/logs`,{signal:c.signal});if(!d.ok)throw d.status===404?new Error(`Execution not found: ${e}`):new Error(`Failed to fetch execution logs: ${d.status} ${d.statusText}`);const f=await d.json();if(!f.success)throw new Error(f.message||"Failed to fetch execution logs");const p=await s7(f.data.logs);n(p),l(f.data.metadata)}catch(d){if(d instanceof Error&&d.name==="AbortError")return;const f=d instanceof Error?d:new Error("Unknown error fetching execution logs");o(f),console.error("[useExecutionLogs] Error:",f)}finally{c.signal.aborted||s(!1)}}return u(),()=>{c.abort()}},[e]),{events:t,loading:r,error:i,metadata:a}}function o7({messages:e,toolCalls:t,renderMarkdown:n=!0,className:r=""}){const s=x.useMemo(()=>{const i=[];return e.forEach(o=>{i.push({type:"message",timestamp:o.timestamp,data:o})}),t.forEach(o=>{i.push({type:"tool_call",timestamp:o.startTime,data:o})}),i.sort((o,a)=>o.timestamp-a.timestamp)},[e,t]);return s.length===0?null:h.jsx("div",{className:`space-y-3 ${r}`,children:s.map(i=>{if(i.type==="message"){const o=i.data;return h.jsxs("div",{className:"flex gap-3 items-start",children:[h.jsx("div",{className:"mt-1 flex-shrink-0",children:h.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-primary/10",children:h.jsx(Vu,{className:"h-4 w-4 text-primary"})})}),h.jsxs("div",{className:"flex-1 min-w-0",children:[h.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[h.jsx(st,{variant:"outline",className:"text-xs",children:o.role}),!o.complete&&h.jsx(Ds,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),h.jsx("div",{className:"rounded-lg bg-muted/50 p-3 text-sm",children:n?h.jsx(w_,{className:"prose prose-sm max-w-none dark:prose-invert",components:{p:({children:a})=>h.jsx("p",{className:"mb-2 last:mb-0",children:a}),code:({inline:a,children:l,...c})=>a?h.jsx("code",{className:"bg-background px-1 py-0.5 rounded text-xs",...c,children:l}):h.jsx("pre",{className:"bg-background p-2 rounded overflow-x-auto",children:h.jsx("code",{...c,children:l})}),ul:({children:a})=>h.jsx("ul",{className:"list-disc pl-4 mb-2",children:a}),ol:({children:a})=>h.jsx("ol",{className:"list-decimal pl-4 mb-2",children:a}),li:({children:a})=>h.jsx("li",{className:"mb-1",children:a}),a:({children:a,href:l})=>h.jsx("a",{href:l,className:"text-primary hover:underline",target:"_blank",rel:"noopener noreferrer",children:a})},children:o.content}):h.jsx("div",{className:"whitespace-pre-wrap",children:o.content})})]})]},`msg-${o.messageId}`)}else{const o=i.data;return h.jsxs("div",{className:"flex gap-3 items-start",children:[h.jsx("div",{className:"mt-1 flex-shrink-0",children:h.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-blue-500/10",children:h.jsx(AA,{className:"h-4 w-4 text-blue-500"})})}),h.jsx("div",{className:"flex-1 min-w-0",children:h.jsxs("div",{className:"rounded-lg border bg-card p-3 text-sm",children:[h.jsxs("div",{className:"flex items-center justify-between mb-2",children:[h.jsxs("div",{className:"flex items-center gap-2",children:[h.jsx("span",{className:"font-medium",children:o.toolCallName}),h.jsx(st,{variant:o.status==="completed"?"default":o.status==="error"?"destructive":"secondary",className:"text-xs",children:o.status})]}),o.endTime&&h.jsxs("span",{className:"text-xs text-muted-foreground",children:[((o.endTime-o.startTime)/1e3).toFixed(2),"s"]})]}),o.args&&h.jsxs("details",{className:"mt-2",children:[h.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground hover:text-foreground",children:"Arguments"}),h.jsx("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto",children:o.args})]}),o.result&&h.jsxs("details",{className:"mt-2",open:o.status==="completed",children:[h.jsx("summary",{className:"cursor-pointer text-xs text-muted-foreground hover:text-foreground",children:"Result"}),h.jsx("pre",{className:"mt-1 text-xs bg-muted/50 p-2 rounded overflow-x-auto max-h-40",children:o.result})]}),o.error&&h.jsx("div",{className:"mt-2 text-xs text-destructive bg-destructive/10 p-2 rounded",children:o.error})]})})]},`tool-${o.toolCallId}`)}})})}function a7({executionId:e,execution:t,onComplete:n,onError:r,className:s=""}){const i=x.useMemo(()=>t?["preparing","pending","running","paused"].includes(t.status):!0,[t]),o=n7({executionId:e,autoConnect:i}),a=i7(e),{connectionStatus:l,execution:c,messages:u,toolCalls:d,state:f,error:p,isConnected:m}=x.useMemo(()=>{if(i)return{connectionStatus:o.connectionStatus,execution:o.execution,messages:o.messages,toolCalls:o.toolCalls,state:o.state,error:o.error,isConnected:o.isConnected};{const v=new Map,E=new Map,N={};return a.events&&a.events.forEach(k=>{if(k.type==="TEXT_MESSAGE_CONTENT"||k.name==="TEXT_MESSAGE_CONTENT"){const C=k.value||k;v.set(v.size,{id:v.size,content:C.content||C.text,timestamp:k.timestamp||Date.now()})}else if(k.type==="TOOL_CALL_START"||k.name==="TOOL_CALL_START"){const C=k.value||k;E.set(C.toolCallId,{id:C.toolCallId,name:C.name,status:"running",timestamp:k.timestamp||Date.now()})}else if(k.type==="TOOL_CALL_RESULT"||k.name==="TOOL_CALL_RESULT"){const C=k.value||k,A=E.get(C.toolCallId);A&&E.set(C.toolCallId,{...A,status:"completed",result:C.result})}}),{connectionStatus:a.loading?"connecting":a.error?"error":"connected",execution:{status:t?.status||"completed",runId:e,currentStep:void 0,error:a.error?.message,startTime:void 0,endTime:void 0},messages:v,toolCalls:E,state:N,error:a.error,isConnected:!1}}},[i,o,a,e,t]);x.useEffect(()=>{c.status==="completed"&&n&&n()},[c.status,n]),x.useEffect(()=>{p&&r&&r(p)},[p,r]);const g=d.size,b=Array.from(d.values()).filter(v=>v.status==="completed").length,y=u.size,w=()=>l==="connecting"?h.jsxs(st,{variant:"outline",className:"flex items-center gap-1",children:[h.jsx(Ds,{className:"h-3 w-3 animate-spin"}),"Connecting..."]}):l==="error"||c.status==="error"?h.jsxs(st,{variant:"destructive",className:"flex items-center gap-1",children:[h.jsx(ao,{className:"h-3 w-3"}),"Error"]}):c.status==="completed"?h.jsxs(st,{variant:"default",className:"flex items-center gap-1 bg-green-600",children:[h.jsx(om,{className:"h-3 w-3"}),"Completed"]}):c.status==="running"?h.jsxs(st,{variant:"default",className:"flex items-center gap-1",children:[h.jsx(Ds,{className:"h-3 w-3 animate-spin"}),"Running"]}):h.jsxs(st,{variant:"secondary",className:"flex items-center gap-1",children:[h.jsx(ki,{className:"h-3 w-3"}),"Idle"]});return l==="connecting"&&c.status==="idle"?h.jsx(It,{className:`p-6 ${s}`,children:h.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[h.jsx(Ds,{className:"h-4 w-4 animate-spin"}),h.jsx("span",{children:"Connecting to execution stream..."})]})}):h.jsxs(It,{className:`flex flex-col ${s}`,children:[h.jsxs("div",{className:"border-b px-6 py-4",children:[h.jsxs("div",{className:"flex items-center justify-between",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("h3",{className:"font-semibold",children:"Execution Monitor"}),w()]}),h.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[c.runId&&h.jsxs("span",{className:"font-mono text-xs",children:["Run: ",c.runId.slice(0,8)]}),m&&h.jsx(st,{variant:"outline",className:"text-xs",children:"Live"})]})]}),c.currentStep&&h.jsxs("div",{className:"mt-3 text-sm text-muted-foreground",children:[h.jsx("span",{className:"font-medium",children:"Current step:"})," ",c.currentStep]}),f.progress!==void 0&&f.totalSteps&&h.jsxs("div",{className:"mt-3",children:[h.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground mb-1",children:[h.jsx("span",{children:"Progress"}),h.jsxs("span",{children:[f.progress," / ",f.totalSteps]})]}),h.jsx("div",{className:"h-2 bg-secondary rounded-full overflow-hidden",children:h.jsx("div",{className:"h-full bg-primary transition-all duration-300",style:{width:`${f.progress/f.totalSteps*100}%`}})})]})]}),h.jsxs("div",{className:"flex-1 overflow-auto px-6 py-4",children:[(p||c.error)&&h.jsx("div",{className:"rounded-md bg-destructive/10 border border-destructive/20 p-4 mb-4",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx(ao,{className:"h-5 w-5 text-destructive mt-0.5"}),h.jsxs("div",{className:"flex-1",children:[h.jsx("h4",{className:"font-semibold text-destructive",children:"Error"}),h.jsx("p",{className:"text-sm text-destructive/90 mt-1",children:c.error||p?.message})]})]})}),(y>0||g>0)&&h.jsx(o7,{messages:u,toolCalls:d,renderMarkdown:!0}),y===0&&g===0&&!p&&!c.error&&h.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center text-muted-foreground",children:[h.jsx(ki,{className:"h-8 w-8 mb-2"}),h.jsx("p",{className:"text-sm",children:"No execution activity yet"}),h.jsx("p",{className:"text-xs mt-1",children:m?"Waiting for events...":"Connecting..."})]})]}),h.jsx("div",{className:"border-t px-6 py-3 bg-muted/30",children:h.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsxs("span",{children:[h.jsx("span",{className:"font-medium",children:g})," tool calls"]}),h.jsxs("span",{children:[h.jsx("span",{className:"font-medium",children:b})," completed"]}),h.jsxs("span",{children:[h.jsx("span",{className:"font-medium",children:y})," messages"]})]}),f.tokenUsage&&h.jsxs("div",{className:"flex items-center gap-4",children:[h.jsxs("span",{children:[h.jsx("span",{className:"font-medium",children:f.tokenUsage})," tokens"]}),f.cost&&h.jsx("span",{children:h.jsxs("span",{className:"font-medium",children:["$",f.cost.toFixed(4)]})})]}),c.startTime&&c.endTime&&h.jsxs("span",{children:["Duration:"," ",h.jsxs("span",{className:"font-medium",children:[((c.endTime-c.startTime)/1e3).toFixed(2),"s"]})]})]})})]})}function l7({open:e,onSubmit:t,onCancel:n}){const[r,s]=x.useState(""),[i,o]=x.useState(!1),[a,l]=x.useState(null),c=async()=>{if(r.trim().length===0){l("Feedback cannot be empty");return}o(!0),l(null);try{await t(r.trim()),s(""),l(null)}catch(p){l(p instanceof Error?p.message:"Failed to submit feedback")}finally{o(!1)}},u=()=>{i||(s(""),l(null),n())},d=p=>{!p&&!i&&u()},f=r.trim().length>0&&!i;return h.jsx(Bi,{open:e,onOpenChange:d,children:h.jsxs(qs,{className:"max-w-2xl",children:[h.jsxs(Ws,{children:[h.jsx(Ks,{children:"Continue Execution"}),h.jsx(Gu,{children:"Provide additional feedback to continue the agent's work in the same environment."})]}),h.jsxs("div",{className:"space-y-4",children:[a&&h.jsx("div",{className:"rounded-lg border border-destructive bg-destructive/10 p-3",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx(ki,{className:"h-5 w-5 text-destructive mt-0.5 flex-shrink-0"}),h.jsx("p",{className:"text-sm text-destructive",children:a})]})}),h.jsxs("div",{className:"space-y-2",children:[h.jsx(Ht,{htmlFor:"feedback",children:"Feedback"}),h.jsx(gd,{id:"feedback",value:r,onChange:p=>s(p.target.value),rows:8,placeholder:`Provide feedback or additional instructions for the agent.
563
-
564
- Examples:
565
- • "Please add error handling for edge cases"
566
- • "Can you explain the approach you took?"
567
- • "Also add tests for this functionality"`,className:"resize-none",disabled:i}),h.jsx("p",{className:"text-xs text-muted-foreground",children:"The agent will continue working in the same environment with this feedback."})]})]}),h.jsxs(hm,{children:[h.jsx(oe,{variant:"outline",onClick:u,disabled:i,children:"Cancel"}),h.jsx(oe,{onClick:c,disabled:!f,children:i?"Submitting...":"Continue"})]})]})})}function c7({worktreePath:e,isOpen:t,onClose:n,onConfirm:r,isDeleting:s=!1}){return e?h.jsx(Tm,{open:t,onOpenChange:n,children:h.jsxs(cd,{children:[h.jsxs(ud,{children:[h.jsx(fd,{children:"Delete Worktree"}),h.jsxs(hd,{children:["Are you sure you want to delete the worktree? This action cannot be undone.",h.jsx("br",{}),h.jsx("br",{}),h.jsx("strong",{children:"Worktree path:"}),h.jsx("br",{}),h.jsx("code",{className:"text-xs",children:e})]})]}),h.jsxs(dd,{children:[h.jsx(md,{disabled:s,children:"Cancel"}),h.jsx(pd,{onClick:r,disabled:s,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:s?"Deleting...":"Delete"})]})]})}):null}function u7({executionId:e,onFollowUpCreated:t}){const[n,r]=x.useState(null),[s,i]=x.useState(!0),[o,a]=x.useState(null),[l,c]=x.useState(!1),[u,d]=x.useState(!1),[f,p]=x.useState(!1),[m,g]=x.useState(!1),[b,y]=x.useState(!1);x.useEffect(()=>{(async()=>{i(!0),a(null);try{const O=await Xn.getById(e);if(r(O),O.worktree_path)try{const j=await Xn.worktreeExists(e);y(j.exists)}catch(j){console.error("Failed to check worktree status:",j),y(!1)}}catch(O){a(O instanceof Error?O.message:"Failed to load execution")}finally{i(!1)}})()},[e]);const w=x.useCallback(async()=>{try{const I=await Xn.getById(e);if(r(I),I.worktree_path)try{const O=await Xn.worktreeExists(e);y(O.exists)}catch(O){console.error("Failed to check worktree status:",O),y(!1)}}catch(I){console.error("Failed to reload execution:",I)}},[e]),v=x.useCallback(I=>{a(I.message)},[]),E=async()=>{if(n){p(!0);try{await Xn.cancel(e);const I=await Xn.getById(e);r(I)}catch(I){a(I instanceof Error?I.message:"Failed to cancel execution")}finally{p(!1)}}},N=async I=>{const O=await Xn.createFollowUp(e,{feedback:I});c(!1),t&&t(O.id)},k=async()=>{if(!(!n||!n.worktree_path)){g(!0);try{await Xn.deleteWorktree(e),y(!1);const I=await Xn.getById(e);r(I),d(!1)}catch(I){a(I instanceof Error?I.message:"Failed to delete worktree")}finally{g(!1)}}},C=I=>{switch(I){case"preparing":return h.jsxs(st,{variant:"secondary",className:"flex items-center gap-1",children:[h.jsx(Ma,{className:"h-3 w-3"}),"Preparing"]});case"pending":return h.jsxs(st,{variant:"secondary",className:"flex items-center gap-1",children:[h.jsx(Ma,{className:"h-3 w-3"}),"Pending"]});case"running":return h.jsxs(st,{variant:"default",className:"flex items-center gap-1",children:[h.jsx(Ds,{className:"h-3 w-3 animate-spin"}),"Running"]});case"paused":return h.jsxs(st,{variant:"outline",className:"flex items-center gap-1",children:[h.jsx(Gw,{className:"h-3 w-3"}),"Paused"]});case"completed":return h.jsxs(st,{variant:"default",className:"flex items-center gap-1 bg-green-600",children:[h.jsx(om,{className:"h-3 w-3"}),"Completed"]});case"failed":return h.jsxs(st,{variant:"destructive",className:"flex items-center gap-1",children:[h.jsx(ao,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return h.jsxs(st,{variant:"secondary",className:"flex items-center gap-1",children:[h.jsx(da,{className:"h-3 w-3"}),"Cancelled"]});case"stopped":return h.jsxs(st,{variant:"secondary",className:"flex items-center gap-1",children:[h.jsx(da,{className:"h-3 w-3"}),"Stopped"]});default:return h.jsxs(st,{variant:"secondary",className:"flex items-center gap-1",children:[h.jsx(ki,{className:"h-3 w-3"}),String(I).charAt(0).toUpperCase()+String(I).slice(1)]})}};if(s)return h.jsx(It,{className:"p-6",children:h.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[h.jsx(Ds,{className:"h-4 w-4 animate-spin"}),h.jsx("span",{children:"Loading execution..."})]})});if(o||!n)return h.jsx(It,{className:"p-6",children:h.jsxs("div",{className:"flex items-start gap-2 text-destructive",children:[h.jsx(ao,{className:"mt-0.5 h-5 w-5"}),h.jsxs("div",{children:[h.jsx("h4",{className:"font-semibold",children:"Error Loading Execution"}),h.jsx("p",{className:"mt-1 text-sm",children:o||"Execution not found"})]})]})});const A=n.status==="running",R=n.status==="completed"||n.status==="failed"||n.status==="stopped",T=n.worktree_path&&b;return h.jsxs("div",{className:"space-y-4",children:[h.jsx(It,{className:"p-6",children:h.jsxs("div",{className:"flex items-start justify-between",children:[h.jsxs("div",{className:"flex-1 space-y-3",children:[h.jsxs("div",{className:"flex items-center gap-3",children:[h.jsx("h2",{className:"text-xl font-semibold",children:"Execution"}),C(n.status)]}),h.jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground",children:"ID:"}),h.jsx("span",{className:"ml-2 font-mono",children:n.id})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground",children:"Issue:"}),h.jsx("span",{className:"ml-2 font-mono",children:n.issue_id})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground",children:"Mode:"}),h.jsx("span",{className:"ml-2 capitalize",children:n.mode})]}),h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground",children:"Model:"}),h.jsx("span",{className:"ml-2",children:n.model})]}),n.target_branch&&h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground",children:"Base Branch:"}),h.jsx("span",{className:"ml-2 font-mono",children:n.target_branch})]}),n.worktree_path&&h.jsxs("div",{children:[h.jsx("span",{className:"text-muted-foreground",children:"Worktree:"}),h.jsx("span",{className:"ml-2 font-mono text-xs",children:n.worktree_path}),b?h.jsx(st,{variant:"secondary",className:"ml-2 text-xs",children:"exists"}):h.jsx(st,{variant:"outline",className:"ml-2 text-xs text-muted-foreground",children:"deleted"})]})]}),h.jsxs("div",{className:"flex gap-4 text-xs text-muted-foreground",children:[n.created_at&&h.jsxs("div",{children:["Created:"," ",new Date(n.created_at).toLocaleString("en-US",{dateStyle:"short",timeStyle:"short"})]}),n.started_at&&h.jsxs("div",{children:["Started:"," ",new Date(n.started_at).toLocaleString("en-US",{dateStyle:"short",timeStyle:"short"})]}),n.completed_at&&h.jsxs("div",{children:["Completed:"," ",new Date(n.completed_at).toLocaleString("en-US",{dateStyle:"short",timeStyle:"short"})]})]}),n.error&&h.jsx("div",{className:"rounded-md border border-destructive/20 bg-destructive/10 p-3 text-sm",children:h.jsxs("div",{className:"flex items-start gap-2",children:[h.jsx(ao,{className:"mt-0.5 h-4 w-4 text-destructive"}),h.jsxs("div",{children:[h.jsx("h5",{className:"font-medium text-destructive",children:"Execution Error"}),h.jsx("p",{className:"mt-1 text-destructive/90",children:n.error})]})]})})]}),h.jsxs("div",{className:"ml-4 flex gap-2",children:[A&&h.jsx(oe,{variant:"destructive",size:"sm",onClick:E,disabled:f,children:f?h.jsxs(h.Fragment,{children:[h.jsx(Ds,{className:"mr-2 h-4 w-4 animate-spin"}),"Cancelling..."]}):h.jsxs(h.Fragment,{children:[h.jsx(da,{className:"mr-2 h-4 w-4"}),"Cancel"]})}),R&&h.jsxs(oe,{variant:"default",size:"sm",onClick:()=>c(!0),children:[h.jsx(cm,{className:"mr-2 h-4 w-4"}),"Follow Up"]}),T&&h.jsxs(oe,{variant:"outline",size:"sm",onClick:()=>d(!0),disabled:m,children:[h.jsx(Io,{className:"mr-2 h-4 w-4"}),"Delete Worktree"]})]})]})}),(n.status==="running"||n.status==="preparing"||n.status==="pending"||n.status==="paused"||n.status==="completed"||n.status==="failed"||n.status==="cancelled"||n.status==="stopped")&&h.jsx(a7,{executionId:e,execution:n,onComplete:w,onError:v}),h.jsx(l7,{open:l,onSubmit:N,onCancel:()=>c(!1)}),h.jsx(c7,{worktreePath:n.worktree_path,isOpen:u,onClose:()=>d(!1),onConfirm:k,isDeleting:m})]})}function d7(){const{id:e}=em(),t=cr();if(!e)return h.jsx("div",{className:"flex items-center justify-center p-12",children:h.jsxs("div",{className:"text-center",children:[h.jsx("h2",{className:"mb-2 text-2xl font-bold",children:"Invalid Execution"}),h.jsx("p",{className:"mb-4 text-muted-foreground",children:"No execution ID provided."}),h.jsx(oe,{onClick:()=>t("/issues"),children:"Back to Issues"})]})});const n=r=>{t(`/executions/${r}`)};return h.jsxs("div",{className:"flex h-screen flex-col",children:[h.jsx("div",{className:"flex items-center justify-between border-b bg-background p-4",children:h.jsx("div",{className:"flex items-center gap-4",children:h.jsxs(oe,{variant:"ghost",size:"sm",onClick:()=>t(-1),children:[h.jsx(Hu,{className:"mr-2 h-4 w-4"}),"Back"]})})}),h.jsx("div",{className:"flex-1 overflow-auto p-6",children:h.jsx(u7,{executionId:e,onFollowUpCreated:n})})]})}const f7=new jT({defaultOptions:{queries:{staleTime:3e4,gcTime:36e5,refetchOnWindowFocus:!1,retry:1}}});function h7(){return h.jsx(zT,{client:f7,children:h.jsx(XT,{children:h.jsx(ZT,{children:h.jsx(cT,{children:h.jsx(uT,{children:h.jsxs(Br,{path:"/",element:h.jsx(cO,{}),children:[h.jsx(Br,{index:!0,element:h.jsx(dT,{to:"/issues",replace:!0})}),h.jsx(Br,{path:"issues",element:h.jsx(UK,{})}),h.jsx(Br,{path:"issues/archived",element:h.jsx(GG,{})}),h.jsx(Br,{path:"issues/:id",element:h.jsx(HK,{})}),h.jsx(Br,{path:"specs",element:h.jsx(ZK,{})}),h.jsx(Br,{path:"specs/archived",element:h.jsx(JG,{})}),h.jsx(Br,{path:"specs/:id",element:h.jsx(KG,{})}),h.jsx(Br,{path:"executions/:id",element:h.jsx(d7,{})})]})})})})})})}pT.createRoot(document.getElementById("root")).render(h.jsx(at.StrictMode,{children:h.jsx(h7,{})}));
568
- //# sourceMappingURL=index-DKAuvfy4.js.map