local-operator-ui 0.22.6 → 0.22.7
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.
- package/out/main/index.js +106 -38
- package/out/preload/index.js +15 -0
- package/out/renderer/assets/{_basePickBy-5PC2GeIh.js → _basePickBy-DhQNxtlD.js} +1 -1
- package/out/renderer/assets/{_baseUniq-BoGuN3va.js → _baseUniq-CX_YBd6Y.js} +1 -1
- package/out/renderer/assets/{agent-details-page-KYNvYgtg.js → agent-details-page-o4gHsKUa.js} +1 -1
- package/out/renderer/assets/{agent-hub-page-IeRJGTiW.js → agent-hub-page-BzDj9IWf.js} +1 -1
- package/out/renderer/assets/{agents-page-xpFBrylt.js → agents-page-fMYF44vi.js} +2 -2
- package/out/renderer/assets/{architectureDiagram-IEHRJDOE-DRDXINWP.js → architectureDiagram-IEHRJDOE-LYdT4n0-.js} +1 -1
- package/out/renderer/assets/{blockDiagram-JOT3LUYC-DXnyqjvO.js → blockDiagram-JOT3LUYC-Djo9sUfE.js} +1 -1
- package/out/renderer/assets/{c4Diagram-VJAJSXHY-UEHcSwEf.js → c4Diagram-VJAJSXHY-Uw8QTBf1.js} +1 -1
- package/out/renderer/assets/channel-CcIHiTMf.js +1 -0
- package/out/renderer/assets/{chunk-4BMEZGHF-D3Ftb1P7.js → chunk-4BMEZGHF-BIOsyZUb.js} +1 -1
- package/out/renderer/assets/{chunk-A2AXSNBT-BP85q3Rq.js → chunk-A2AXSNBT-DgGsJjzO.js} +1 -1
- package/out/renderer/assets/{chunk-AEK57VVT-CPtPA1vv.js → chunk-AEK57VVT-BIKbqRlZ.js} +1 -1
- package/out/renderer/assets/{chunk-D6G4REZN-DO3RYYNI.js → chunk-D6G4REZN-67ezHJSD.js} +1 -1
- package/out/renderer/assets/{chunk-RZ5BOZE2-VaoNIlgb.js → chunk-RZ5BOZE2-DcomjUhS.js} +1 -1
- package/out/renderer/assets/{chunk-XZIHB7SX-DqAcX5hU.js → chunk-XZIHB7SX-BUmWwWrV.js} +1 -1
- package/out/renderer/assets/{classDiagram-GIVACNV2-Dzcs_gQH.js → classDiagram-GIVACNV2-Doib00-b.js} +1 -1
- package/out/renderer/assets/{classDiagram-v2-COTLJTTW-Dzcs_gQH.js → classDiagram-v2-COTLJTTW-Doib00-b.js} +1 -1
- package/out/renderer/assets/clone-B0pGWNff.js +1 -0
- package/out/renderer/assets/{compact-pagination-DtGwWpQi.js → compact-pagination-DKIAGx25.js} +1 -1
- package/out/renderer/assets/{dagre-OKDRZEBW-ByqKlvOa.js → dagre-OKDRZEBW-D5JBej5q.js} +1 -1
- package/out/renderer/assets/{diagram-SSKATNLV-syHs2azV.js → diagram-SSKATNLV-roVanCAj.js} +1 -1
- package/out/renderer/assets/{diagram-VNBRO52H-D0PpBwkL.js → diagram-VNBRO52H-mWjYHL69.js} +1 -1
- package/out/renderer/assets/{erDiagram-Q7BY3M3F-Ei9TuWVt.js → erDiagram-Q7BY3M3F-leIAVVl8.js} +1 -1
- package/out/renderer/assets/{flowDiagram-4HSFHLVR-DStpc2Ni.js → flowDiagram-4HSFHLVR-BR2OLvUd.js} +1 -1
- package/out/renderer/assets/{ganttDiagram-APWFNJXF-BNdpt-L7.js → ganttDiagram-APWFNJXF-BxJlkxvE.js} +1 -1
- package/out/renderer/assets/{gitGraphDiagram-7IBYFJ6S-BQppdVg4.js → gitGraphDiagram-7IBYFJ6S-CGUHtfkZ.js} +1 -1
- package/out/renderer/assets/{graph-BdjWtgGJ.js → graph-4LKx2VDu.js} +1 -1
- package/out/renderer/assets/{index-IUMywSkL.js → index-B-nr8aEh.js} +1 -1
- package/out/renderer/assets/{index-DlmQkmZo.js → index-BpIvhA0p.js} +4 -4
- package/out/renderer/assets/{index-NgXBxtHb.js → index-CD9V9hPM.js} +1 -1
- package/out/renderer/assets/{infoDiagram-PH2N3AL5-ap1SKt0n.js → infoDiagram-PH2N3AL5-CeUS0GfM.js} +1 -1
- package/out/renderer/assets/{journeyDiagram-U35MCT3I-ReYp3pT6.js → journeyDiagram-U35MCT3I-_X3MTxbJ.js} +1 -1
- package/out/renderer/assets/{kanban-definition-NDS4AKOZ-BDUYkeYQ.js → kanban-definition-NDS4AKOZ-hUWYLG65.js} +1 -1
- package/out/renderer/assets/{layout-CTQBSLKi.js → layout-vfaUtLsA.js} +1 -1
- package/out/renderer/assets/{legacy-agents-page-CBSEm_b5.js → legacy-agents-page-iWsZC-8m.js} +1 -1
- package/out/renderer/assets/{mermaid.core-DrmL1aAj.js → mermaid.core-DNwsi5g_.js} +5 -5
- package/out/renderer/assets/{mindmap-definition-ALO5MXBD-BsQnqWMD.js → mindmap-definition-ALO5MXBD-DMokx6cp.js} +1 -1
- package/out/renderer/assets/{parseISO-CJ7lROWe.js → parseISO-C2gtJ6YV.js} +1 -1
- package/out/renderer/assets/{pieDiagram-IB7DONF6-C_XqX6bd.js → pieDiagram-IB7DONF6-C6Cy5b3h.js} +1 -1
- package/out/renderer/assets/{quadrantDiagram-7GDLP6J5-BW1LvBRR.js → quadrantDiagram-7GDLP6J5-BOaducXa.js} +1 -1
- package/out/renderer/assets/{radar-MK3ICKWK-C72JNblS.js → radar-MK3ICKWK-BI7fIfLl.js} +1 -1
- package/out/renderer/assets/{radient-auth-buttons-DHQoi-1W.js → radient-auth-buttons-DL7NotAd.js} +1 -1
- package/out/renderer/assets/{requirementDiagram-KVF5MWMF-Dvw-aN3-.js → requirementDiagram-KVF5MWMF-gVZyn5do.js} +1 -1
- package/out/renderer/assets/{sankeyDiagram-QLVOVGJD-C4rKO3jz.js → sankeyDiagram-QLVOVGJD-BUG1W9hs.js} +1 -1
- package/out/renderer/assets/{schedules-page-DH6hSFoy.js → schedules-page-DI3d_Jms.js} +1 -1
- package/out/renderer/assets/{sequenceDiagram-X6HHIX6F-DjYZLsQI.js → sequenceDiagram-X6HHIX6F-COMD731i.js} +1 -1
- package/out/renderer/assets/{settings-page-CDKRmauZ.js → settings-page-CvFjZpKU.js} +35 -35
- package/out/renderer/assets/{stateDiagram-DGXRK772-oU8ucH_b.js → stateDiagram-DGXRK772-BOfqY0wc.js} +1 -1
- package/out/renderer/assets/{stateDiagram-v2-YXO3MK2T-DUMMBq1h.js → stateDiagram-v2-YXO3MK2T-Chyd_KPN.js} +1 -1
- package/out/renderer/assets/{timeline-definition-BDJGKUSR-CcF5y4Vf.js → timeline-definition-BDJGKUSR-CCZIm-XN.js} +1 -1
- package/out/renderer/assets/{use-agent-like-mutation-vohL1s3H.js → use-agent-like-mutation-BSnvivNQ.js} +1 -1
- package/out/renderer/assets/{xychartDiagram-VJFVF3MP-BWbReuaT.js → xychartDiagram-VJFVF3MP-Cl5zMzgu.js} +1 -1
- package/out/renderer/index.html +1 -1
- package/package.json +3 -2
- package/out/renderer/assets/channel-D7FjSz8q.js +0 -1
- package/out/renderer/assets/clone-uACF1X6F.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./mermaid.core-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./mermaid.core-DNwsi5g_.js","./icon-fSzO-fSj.js","./icon-DzTfuNUy.css","./step-DMJAOHzS.js","./katex-BCx1q_2Y.css","./index-B-nr8aEh.js","./index-CD9V9hPM.js","./pug-DukmZTjD.js","./javascript-qCveANmP.js","./agent-details-page-o4gHsKUa.js","./square-pen-Cy0qQPr_.js","./use-agent-like-mutation-BSnvivNQ.js","./agent-hub-page-BzDj9IWf.js","./compact-pagination-DKIAGx25.js","./page-header-qm7Wt7L1.js","./agents-page-fMYF44vi.js","./schedules-page-DI3d_Jms.js","./parseISO-C2gtJ6YV.js","./settings-page-CvFjZpKU.js","./radient-auth-buttons-DL7NotAd.js","./band-CquvqAHh.js","./init-Dmth1JHB.js","./ordinal-DILIJJjt.js","./linear-BfLTrHPc.js","./time-BOTM2Tp0.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
import{r as w,j as O,m as me,a2 as TX,a as Le,a5 as Ise,B as we,c as N,ab as QC,ac as EC,ad as C_e,ae as wy,af as Q_e,ag as PX,ah as DF,a3 as E_e,ai as R_e,a1 as A_e,D as X_e,A as po,X as Ts,z as RC,L as zi,I as Kr,T as DO,S as pr,Y as Tl,aj as Nse,h as qn,ak as UL,g as pt,y as D_e,f as ol,Z as WL,x as Fse,s as dg,C as Eh,al as IF,am as hg,W as I_e,n as pS,o as Ov,p as gS,q as is,t as Hg,an as Mse,a8 as zse,b as q2,P as Lse,v as qse,w as Use,M as yy,N as xy,O as Sy,Q as $y,U as ky,ao as A0,i as NF,V as N_e,H as U2,ap as GE,aq as F_e,u as fg,ar as M_e,d as Wse,e as jse,as as z_e,at as L_e,au as q_e,av as U_e,E as _X,aw as Gse,ax as jL,l as W_e,k as j_e,R as G_e}from"./icon-fSzO-fSj.js";var d1=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(){}},Og=typeof window>"u"||"Deno"in globalThis;function jl(){}function V_e(e,t){return typeof e=="function"?e(t):e}function CX(e){return typeof e=="number"&&e>=0&&e!==1/0}function Vse(e,t){return Math.max(e+(t||0)-Date.now(),0)}function X0(e,t){return typeof e=="function"?e(t):e}function qc(e,t){return typeof e=="function"?e(t):e}function GL(e,t){const{type:n="all",exact:r,fetchStatus:i,predicate:s,queryKey:a,stale:o}=e;if(a){if(r){if(t.queryHash!==FF(a,t.options))return!1}else if(!Ty(t.queryKey,a))return!1}if(n!=="all"){const l=t.isActive();if(n==="active"&&!l||n==="inactive"&&l)return!1}return!(typeof o=="boolean"&&t.isStale()!==o||i&&i!==t.state.fetchStatus||s&&!s(t))}function VL(e,t){const{exact:n,status:r,predicate:i,mutationKey:s}=e;if(s){if(!t.options.mutationKey)return!1;if(n){if(pg(t.options.mutationKey)!==pg(s))return!1}else if(!Ty(t.options.mutationKey,s))return!1}return!(r&&t.state.status!==r||i&&!i(t))}function FF(e,t){return(t?.queryKeyHashFn||pg)(e)}function pg(e){return JSON.stringify(e,(t,n)=>QX(n)?Object.keys(n).sort().reduce((r,i)=>(r[i]=n[i],r),{}):n)}function Ty(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>Ty(e[n],t[n])):!1}function Yse(e,t){if(e===t)return e;const n=YL(e)&&YL(t);if(n||QX(e)&&QX(t)){const r=n?e:Object.keys(e),i=r.length,s=n?t:Object.keys(t),a=s.length,o=n?[]:{};let l=0;for(let c=0;c<a;c++){const u=n?c:s[c];(!n&&r.includes(u)||n)&&e[u]===void 0&&t[u]===void 0?(o[u]=void 0,l++):(o[u]=Yse(e[u],t[u]),o[u]===e[u]&&e[u]!==void 0&&l++)}return i===a&&l===i?e:o}return t}function W2(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 YL(e){return Array.isArray(e)&&e.length===Object.keys(e).length}function QX(e){if(!BL(e))return!1;const t=e.constructor;if(t===void 0)return!0;const n=t.prototype;return!(!BL(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(e)!==Object.prototype)}function BL(e){return Object.prototype.toString.call(e)==="[object Object]"}function Y_e(e){return new Promise(t=>{setTimeout(t,e)})}function EX(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?Yse(e,t):t}function MF(e){return e}function B_e(e,t,n=0){const r=[...e,t];return n&&r.length>n?r.slice(1):r}function Z_e(e,t,n=0){const r=[t,...e];return n&&r.length>n?r.slice(0,-1):r}var zF=Symbol();function Bse(e,t){return!e.queryFn&&t?.initialPromise?()=>t.initialPromise:!e.queryFn||e.queryFn===zF?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}var H_e=class extends d1{#t;#e;#n;constructor(){super(),this.#n=e=>{if(!Og&&window.addEventListener){const t=()=>e();return window.addEventListener("visibilitychange",t,!1),()=>{window.removeEventListener("visibilitychange",t)}}}}onSubscribe(){this.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(t=>{typeof t=="boolean"?this.setFocused(t):this.onFocus()})}setFocused(e){this.#t!==e&&(this.#t=e,this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(t=>{t(e)})}isFocused(){return typeof this.#t=="boolean"?this.#t:globalThis.document?.visibilityState!=="hidden"}},LF=new H_e,K_e=class extends d1{#t=!0;#e;#n;constructor(){super(),this.#n=e=>{if(!Og&&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.#e||this.setEventListener(this.#n)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(e){this.#n=e,this.#e?.(),this.#e=e(this.setOnline.bind(this))}setOnline(e){this.#t!==e&&(this.#t=e,this.listeners.forEach(n=>{n(e)}))}isOnline(){return this.#t}},j2=new K_e;function RX(){let e,t;const n=new Promise((i,s)=>{e=i,t=s});n.status="pending",n.catch(()=>{});function r(i){Object.assign(n,i),delete n.resolve,delete n.reject}return n.resolve=i=>{r({status:"fulfilled",value:i}),e(i)},n.reject=i=>{r({status:"rejected",reason:i}),t(i)},n}function J_e(e){return Math.min(1e3*2**e,3e4)}function Zse(e){return(e??"online")==="online"?j2.isOnline():!0}var Hse=class extends Error{constructor(e){super("CancelledError"),this.revert=e?.revert,this.silent=e?.silent}};function VE(e){return e instanceof Hse}function Kse(e){let t=!1,n=0,r=!1,i;const s=RX(),a=g=>{r||(h(new Hse(g)),e.abort?.())},o=()=>{t=!0},l=()=>{t=!1},c=()=>LF.isFocused()&&(e.networkMode==="always"||j2.isOnline())&&e.canRun(),u=()=>Zse(e.networkMode)&&e.canRun(),d=g=>{r||(r=!0,e.onSuccess?.(g),i?.(),s.resolve(g))},h=g=>{r||(r=!0,e.onError?.(g),i?.(),s.reject(g))},f=()=>new Promise(g=>{i=m=>{(r||c())&&g(m)},e.onPause?.()}).then(()=>{i=void 0,r||e.onContinue?.()}),p=()=>{if(r)return;let g;const m=n===0?e.initialPromise:void 0;try{g=m??e.fn()}catch(v){g=Promise.reject(v)}Promise.resolve(g).then(d).catch(v=>{if(r)return;const b=e.retry??(Og?0:3),y=e.retryDelay??J_e,T=typeof y=="function"?y(n,v):y,x=b===!0||typeof b=="number"&&n<b||typeof b=="function"&&b(n,v);if(t||!x){h(v);return}n++,e.onFail?.(n,v),Y_e(T).then(()=>c()?void 0:f()).then(()=>{t?h(v):p()})})};return{promise:s,cancel:a,continue:()=>(i?.(),s),cancelRetry:o,continueRetry:l,canStart:u,start:()=>(u()?p():f().then(p),s)}}var eCe=e=>setTimeout(e,0);function tCe(){let e=[],t=0,n=o=>{o()},r=o=>{o()},i=eCe;const s=o=>{t?e.push(o):i(()=>{n(o)})},a=()=>{const o=e;e=[],o.length&&i(()=>{r(()=>{o.forEach(l=>{n(l)})})})};return{batch:o=>{let l;t++;try{l=o()}finally{t--,t||a()}return l},batchCalls:o=>(...l)=>{s(()=>{o(...l)})},schedule:s,setNotifyFunction:o=>{n=o},setBatchNotifyFunction:o=>{r=o},setScheduler:o=>{i=o}}}var As=tCe(),Jse=class{#t;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),CX(this.gcTime)&&(this.#t=setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(Og?1/0:5*60*1e3))}clearGcTimeout(){this.#t&&(clearTimeout(this.#t),this.#t=void 0)}},nCe=class extends Jse{#t;#e;#n;#r;#i;#a;#o;constructor(e){super(),this.#o=!1,this.#a=e.defaultOptions,this.setOptions(e.options),this.observers=[],this.#r=e.client,this.#n=this.#r.getQueryCache(),this.queryKey=e.queryKey,this.queryHash=e.queryHash,this.#t=rCe(this.options),this.state=e.state??this.#t,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(e){this.options={...this.#a,...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#n.remove(this)}setData(e,t){const n=EX(this.state.data,e,this.options);return this.#s({data:n,type:"success",dataUpdatedAt:t?.updatedAt,manual:t?.manual}),n}setState(e,t){this.#s({type:"setState",state:e,setStateOptions:t})}cancel(e){const t=this.#i?.promise;return this.#i?.cancel(e),t?t.then(jl).catch(jl):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#t)}isActive(){return this.observers.some(e=>qc(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===zF||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(e=0){return this.state.isInvalidated||this.state.data===void 0||!Vse(this.state.dataUpdatedAt,e)}onFocus(){this.observers.find(t=>t.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(t=>t.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.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.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#n.notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#s({type:"invalidate"})}fetch(e,t){if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&t?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(e&&this.setOptions(e),!this.options.queryFn){const o=this.observers.find(l=>l.options.queryFn);o&&this.setOptions(o.options)}const n=new AbortController,r=o=>{Object.defineProperty(o,"signal",{enumerable:!0,get:()=>(this.#o=!0,n.signal)})},i=()=>{const o=Bse(this.options,t),l={client:this.#r,queryKey:this.queryKey,meta:this.meta};return r(l),this.#o=!1,this.options.persister?this.options.persister(o,l,this):o(l)},s={fetchOptions:t,options:this.options,queryKey:this.queryKey,client:this.#r,state:this.state,fetchFn:i};r(s),this.options.behavior?.onFetch(s,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==s.fetchOptions?.meta)&&this.#s({type:"fetch",meta:s.fetchOptions?.meta});const a=o=>{VE(o)&&o.silent||this.#s({type:"error",error:o}),VE(o)||(this.#n.config.onError?.(o,this),this.#n.config.onSettled?.(this.state.data,o,this)),this.scheduleGc()};return this.#i=Kse({initialPromise:t?.initialPromise,fn:s.fetchFn,abort:n.abort.bind(n),onSuccess:o=>{if(o===void 0){a(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(o)}catch(l){a(l);return}this.#n.config.onSuccess?.(o,this),this.#n.config.onSettled?.(o,this.state.error,this),this.scheduleGc()},onError:a,onFail:(o,l)=>{this.#s({type:"failed",failureCount:o,error:l})},onPause:()=>{this.#s({type:"pause"})},onContinue:()=>{this.#s({type:"continue"})},retry:s.options.retry,retryDelay:s.options.retryDelay,networkMode:s.options.networkMode,canRun:()=>!0}),this.#i.start()}#s(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,...eae(n.data,this.options),fetchMeta:e.meta??null};case"success":return{...n,data:e.data,dataUpdateCount:n.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const r=e.error;return VE(r)&&r.revert&&this.#e?{...this.#e,fetchStatus:"idle"}:{...n,error:r,errorUpdateCount:n.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:n.fetchFailureCount+1,fetchFailureReason:r,fetchStatus:"idle",status:"error"};case"invalidate":return{...n,isInvalidated:!0};case"setState":return{...n,...e.state}}};this.state=t(this.state),As.batch(()=>{this.observers.forEach(n=>{n.onQueryUpdate()}),this.#n.notify({query:this,type:"updated",action:e})})}};function eae(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Zse(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function rCe(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 iCe=class extends d1{constructor(e={}){super(),this.config=e,this.#t=new Map}#t;build(e,t,n){const r=t.queryKey,i=t.queryHash??FF(r,t);let s=this.get(i);return s||(s=new nCe({client:e,queryKey:r,queryHash:i,options:e.defaultQueryOptions(t),state:n,defaultOptions:e.getQueryDefaults(r)}),this.add(s)),s}add(e){this.#t.has(e.queryHash)||(this.#t.set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const t=this.#t.get(e.queryHash);t&&(e.destroy(),t===e&&this.#t.delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){As.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return this.#t.get(e)}getAll(){return[...this.#t.values()]}find(e){const t={exact:!0,...e};return this.getAll().find(n=>GL(t,n))}findAll(e={}){const t=this.getAll();return Object.keys(e).length>0?t.filter(n=>GL(e,n)):t}notify(e){As.batch(()=>{this.listeners.forEach(t=>{t(e)})})}onFocus(){As.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){As.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},sCe=class extends Jse{#t;#e;#n;constructor(e){super(),this.mutationId=e.mutationId,this.#e=e.mutationCache,this.#t=[],this.state=e.state||tae(),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.#e.notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#e.notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status==="pending"?this.scheduleGc():this.#e.remove(this))}continue(){return this.#n?.continue()??this.execute(this.state.variables)}async execute(e){this.#n=Kse({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(r,i)=>{this.#r({type:"failed",failureCount:r,error:i})},onPause:()=>{this.#r({type:"pause"})},onContinue:()=>{this.#r({type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#e.canRun(this)});const t=this.state.status==="pending",n=!this.#n.canStart();try{if(!t){this.#r({type:"pending",variables:e,isPaused:n}),await this.#e.config.onMutate?.(e,this);const i=await this.options.onMutate?.(e);i!==this.state.context&&this.#r({type:"pending",context:i,variables:e,isPaused:n})}const r=await this.#n.start();return await this.#e.config.onSuccess?.(r,e,this.state.context,this),await this.options.onSuccess?.(r,e,this.state.context),await this.#e.config.onSettled?.(r,null,this.state.variables,this.state.context,this),await this.options.onSettled?.(r,null,e,this.state.context),this.#r({type:"success",data:r}),r}catch(r){try{throw await this.#e.config.onError?.(r,e,this.state.context,this),await this.options.onError?.(r,e,this.state.context),await this.#e.config.onSettled?.(void 0,r,this.state.variables,this.state.context,this),await this.options.onSettled?.(void 0,r,e,this.state.context),r}finally{this.#r({type:"error",error:r})}}finally{this.#e.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),As.batch(()=>{this.#t.forEach(n=>{n.onMutationUpdate(e)}),this.#e.notify({mutation:this,type:"updated",action:e})})}};function tae(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var aCe=class extends d1{constructor(e={}){super(),this.config=e,this.#t=new Set,this.#e=new Map,this.#n=0}#t;#e;#n;build(e,t,n){const r=new sCe({mutationCache:this,mutationId:++this.#n,options:e.defaultMutationOptions(t),state:n});return this.add(r),r}add(e){this.#t.add(e);const t=p$(e);if(typeof t=="string"){const n=this.#e.get(t);n?n.push(e):this.#e.set(t,[e])}this.notify({type:"added",mutation:e})}remove(e){if(this.#t.delete(e)){const t=p$(e);if(typeof t=="string"){const n=this.#e.get(t);if(n)if(n.length>1){const r=n.indexOf(e);r!==-1&&n.splice(r,1)}else n[0]===e&&this.#e.delete(t)}}this.notify({type:"removed",mutation:e})}canRun(e){const t=p$(e);if(typeof t=="string"){const r=this.#e.get(t)?.find(i=>i.state.status==="pending");return!r||r===e}else return!0}runNext(e){const t=p$(e);return typeof t=="string"?this.#e.get(t)?.find(r=>r!==e&&r.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){As.batch(()=>{this.#t.forEach(e=>{this.notify({type:"removed",mutation:e})}),this.#t.clear(),this.#e.clear()})}getAll(){return Array.from(this.#t)}find(e){const t={exact:!0,...e};return this.getAll().find(n=>VL(t,n))}findAll(e={}){return this.getAll().filter(t=>VL(e,t))}notify(e){As.batch(()=>{this.listeners.forEach(t=>{t(e)})})}resumePausedMutations(){const e=this.getAll().filter(t=>t.state.isPaused);return As.batch(()=>Promise.all(e.map(t=>t.continue().catch(jl))))}};function p$(e){return e.options.scope?.id}function ZL(e){return{onFetch:(t,n)=>{const r=t.options,i=t.fetchOptions?.meta?.fetchMore?.direction,s=t.state.data?.pages||[],a=t.state.data?.pageParams||[];let o={pages:[],pageParams:[]},l=0;const c=async()=>{let u=!1;const d=p=>{Object.defineProperty(p,"signal",{enumerable:!0,get:()=>(t.signal.aborted?u=!0:t.signal.addEventListener("abort",()=>{u=!0}),t.signal)})},h=Bse(t.options,t.fetchOptions),f=async(p,g,m)=>{if(u)return Promise.reject();if(g==null&&p.pages.length)return Promise.resolve(p);const v={client:t.client,queryKey:t.queryKey,pageParam:g,direction:m?"backward":"forward",meta:t.options.meta};d(v);const b=await h(v),{maxPages:y}=t.options,T=m?Z_e:B_e;return{pages:T(p.pages,b,y),pageParams:T(p.pageParams,g,y)}};if(i&&s.length){const p=i==="backward",g=p?oCe:HL,m={pages:s,pageParams:a},v=g(r,m);o=await f(m,v,p)}else{const p=e??s.length;do{const g=l===0?a[0]??r.initialPageParam:HL(r,o);if(l>0&&g==null)break;o=await f(o,g),l++}while(l<p)}return o};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 HL(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 oCe(e,{pages:t,pageParams:n}){return t.length>0?e.getPreviousPageParam?.(t[0],t,n[0],n):void 0}var lCe=class{#t;#e;#n;#r;#i;#a;#o;#s;constructor(e={}){this.#t=e.queryCache||new iCe,this.#e=e.mutationCache||new aCe,this.#n=e.defaultOptions||{},this.#r=new Map,this.#i=new Map,this.#a=0}mount(){this.#a++,this.#a===1&&(this.#o=LF.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onFocus())}),this.#s=j2.subscribe(async e=>{e&&(await this.resumePausedMutations(),this.#t.onOnline())}))}unmount(){this.#a--,this.#a===0&&(this.#o?.(),this.#o=void 0,this.#s?.(),this.#s=void 0)}isFetching(e){return this.#t.findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return this.#e.findAll({...e,status:"pending"}).length}getQueryData(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=this.#t.build(this,t),r=n.state.data;return r===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(X0(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(r))}getQueriesData(e){return this.#t.findAll(e).map(({queryKey:t,state:n})=>{const r=n.data;return[t,r]})}setQueryData(e,t,n){const r=this.defaultQueryOptions({queryKey:e}),s=this.#t.get(r.queryHash)?.state.data,a=V_e(t,s);if(a!==void 0)return this.#t.build(this,r).setData(a,{...n,manual:!0})}setQueriesData(e,t,n){return As.batch(()=>this.#t.findAll(e).map(({queryKey:r})=>[r,this.setQueryData(r,t,n)]))}getQueryState(e){const t=this.defaultQueryOptions({queryKey:e});return this.#t.get(t.queryHash)?.state}removeQueries(e){const t=this.#t;As.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=this.#t;return As.batch(()=>(n.findAll(e).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},r=As.batch(()=>this.#t.findAll(e).map(i=>i.cancel(n)));return Promise.all(r).then(jl).catch(jl)}invalidateQueries(e,t={}){return As.batch(()=>(this.#t.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=As.batch(()=>this.#t.findAll(e).filter(i=>!i.isDisabled()).map(i=>{let s=i.fetch(void 0,n);return n.throwOnError||(s=s.catch(jl)),i.state.fetchStatus==="paused"?Promise.resolve():s}));return Promise.all(r).then(jl)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=this.#t.build(this,t);return n.isStaleByTime(X0(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(jl).catch(jl)}fetchInfiniteQuery(e){return e.behavior=ZL(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(jl).catch(jl)}ensureInfiniteQueryData(e){return e.behavior=ZL(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return j2.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#t}getMutationCache(){return this.#e}getDefaultOptions(){return this.#n}setDefaultOptions(e){this.#n=e}setQueryDefaults(e,t){this.#r.set(pg(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...this.#r.values()],n={};return t.forEach(r=>{Ty(e,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(e,t){this.#i.set(pg(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...this.#i.values()],n={};return t.forEach(r=>{Ty(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=FF(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===zF&&(t.enabled=!1),t}defaultMutationOptions(e){return e?._defaulted?e:{...this.#n.mutations,...e?.mutationKey&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){this.#t.clear(),this.#e.clear()}},cCe=class extends d1{constructor(e,t){super(),this.options=t,this.#t=e,this.#s=null,this.#o=RX(),this.options.experimental_prefetchInRender||this.#o.reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(t)}#t;#e=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#p;#h;#f;#c;#u;#l;#O=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#e.addObserver(this),KL(this.#e,this.options)?this.#d():this.updateResult(),this.#b())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return AX(this.#e,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return AX(this.#e,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#w(),this.#y(),this.#e.removeObserver(this)}setOptions(e){const t=this.options,n=this.#e;if(this.options=this.#t.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof qc(this.options.enabled,this.#e)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#x(),this.#e.setOptions(this.options),t._defaulted&&!W2(this.options,t)&&this.#t.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#e,observer:this});const r=this.hasListeners();r&&JL(this.#e,n,this.options,t)&&this.#d(),this.updateResult(),r&&(this.#e!==n||qc(this.options.enabled,this.#e)!==qc(t.enabled,this.#e)||X0(this.options.staleTime,this.#e)!==X0(t.staleTime,this.#e))&&this.#g();const i=this.#m();r&&(this.#e!==n||qc(this.options.enabled,this.#e)!==qc(t.enabled,this.#e)||i!==this.#l)&&this.#v(i)}getOptimisticResult(e){const t=this.#t.getQueryCache().build(this.#t,e),n=this.createResult(t,e);return dCe(this,n)&&(this.#r=n,this.#a=this.options,this.#i=this.#e.state),n}getCurrentResult(){return this.#r}trackResult(e,t){const n={};return Object.keys(e).forEach(r=>{Object.defineProperty(n,r,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(r),t?.(r),e[r])})}),n}trackProp(e){this.#O.add(e)}getCurrentQuery(){return this.#e}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const t=this.#t.defaultQueryOptions(e),n=this.#t.getQueryCache().build(this.#t,t);return n.fetch().then(()=>this.createResult(n,t))}fetch(e){return this.#d({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#d(e){this.#x();let t=this.#e.fetch(this.options,e);return e?.throwOnError||(t=t.catch(jl)),t}#g(){this.#w();const e=X0(this.options.staleTime,this.#e);if(Og||this.#r.isStale||!CX(e))return;const n=Vse(this.#r.dataUpdatedAt,e)+1;this.#c=setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#m(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#e):this.options.refetchInterval)??!1}#v(e){this.#y(),this.#l=e,!(Og||qc(this.options.enabled,this.#e)===!1||!CX(this.#l)||this.#l===0)&&(this.#u=setInterval(()=>{(this.options.refetchIntervalInBackground||LF.isFocused())&&this.#d()},this.#l))}#b(){this.#g(),this.#v(this.#m())}#w(){this.#c&&(clearTimeout(this.#c),this.#c=void 0)}#y(){this.#u&&(clearInterval(this.#u),this.#u=void 0)}createResult(e,t){const n=this.#e,r=this.options,i=this.#r,s=this.#i,a=this.#a,l=e!==n?e.state:this.#n,{state:c}=e;let u={...c},d=!1,h;if(t._optimisticResults){const Q=this.hasListeners(),C=!Q&&KL(e,t),_=Q&&JL(e,n,t,r);(C||_)&&(u={...u,...eae(c.data,e.options)}),t._optimisticResults==="isRestoring"&&(u.fetchStatus="idle")}let{error:f,errorUpdatedAt:p,status:g}=u;h=u.data;let m=!1;if(t.placeholderData!==void 0&&h===void 0&&g==="pending"){let Q;i?.isPlaceholderData&&t.placeholderData===a?.placeholderData?(Q=i.data,m=!0):Q=typeof t.placeholderData=="function"?t.placeholderData(this.#f?.state.data,this.#f):t.placeholderData,Q!==void 0&&(g="success",h=EX(i?.data,Q,t),d=!0)}if(t.select&&h!==void 0&&!m)if(i&&h===s?.data&&t.select===this.#p)h=this.#h;else try{this.#p=t.select,h=t.select(h),h=EX(i?.data,h,t),this.#h=h,this.#s=null}catch(Q){this.#s=Q}this.#s&&(f=this.#s,h=this.#h,p=Date.now(),g="error");const v=u.fetchStatus==="fetching",b=g==="pending",y=g==="error",T=b&&v,x=h!==void 0,k={status:g,fetchStatus:u.fetchStatus,isPending:b,isSuccess:g==="success",isError:y,isInitialLoading:T,isLoading:T,data:h,dataUpdatedAt:u.dataUpdatedAt,error:f,errorUpdatedAt:p,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:v,isRefetching:v&&!b,isLoadingError:y&&!x,isPaused:u.fetchStatus==="paused",isPlaceholderData:d,isRefetchError:y&&x,isStale:qF(e,t),refetch:this.refetch,promise:this.#o};if(this.options.experimental_prefetchInRender){const Q=R=>{k.status==="error"?R.reject(k.error):k.data!==void 0&&R.resolve(k.data)},C=()=>{const R=this.#o=k.promise=RX();Q(R)},_=this.#o;switch(_.status){case"pending":e.queryHash===n.queryHash&&Q(_);break;case"fulfilled":(k.status==="error"||k.data!==_.value)&&C();break;case"rejected":(k.status!=="error"||k.error!==_.reason)&&C();break}}return k}updateResult(){const e=this.#r,t=this.createResult(this.#e,this.options);if(this.#i=this.#e.state,this.#a=this.options,this.#i.data!==void 0&&(this.#f=this.#e),W2(t,e))return;this.#r=t;const n=()=>{if(!e)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#O.size)return!0;const s=new Set(i??this.#O);return this.options.throwOnError&&s.add("error"),Object.keys(this.#r).some(a=>{const o=a;return this.#r[o]!==e[o]&&s.has(o)})};this.#S({listeners:n()})}#x(){const e=this.#t.getQueryCache().build(this.#t,this.options);if(e===this.#e)return;const t=this.#e;this.#e=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#b()}#S(e){As.batch(()=>{e.listeners&&this.listeners.forEach(t=>{t(this.#r)}),this.#t.getQueryCache().notify({query:this.#e,type:"observerResultsUpdated"})})}};function uCe(e,t){return qc(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function KL(e,t){return uCe(e,t)||e.state.data!==void 0&&AX(e,t,t.refetchOnMount)}function AX(e,t,n){if(qc(t.enabled,e)!==!1){const r=typeof n=="function"?n(e):n;return r==="always"||r!==!1&&qF(e,t)}return!1}function JL(e,t,n,r){return(e!==t||qc(r.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&qF(e,n)}function qF(e,t){return qc(t.enabled,e)!==!1&&e.isStaleByTime(X0(t.staleTime,e))}function dCe(e,t){return!W2(e.getCurrentResult(),t)}var hCe=class extends d1{#t;#e=void 0;#n;#r;constructor(t,n){super(),this.#t=t,this.setOptions(n),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(t){const n=this.options;this.options=this.#t.defaultMutationOptions(t),W2(this.options,n)||this.#t.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#n,observer:this}),n?.mutationKey&&this.options.mutationKey&&pg(n.mutationKey)!==pg(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.#i(),this.#a(t)}getCurrentResult(){return this.#e}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(t,n){return this.#r=n,this.#n?.removeObserver(this),this.#n=this.#t.getMutationCache().build(this.#t,this.options),this.#n.addObserver(this),this.#n.execute(t)}#i(){const t=this.#n?.state??tae();this.#e={...t,isPending:t.status==="pending",isSuccess:t.status==="success",isError:t.status==="error",isIdle:t.status==="idle",mutate:this.mutate,reset:this.reset}}#a(t){As.batch(()=>{if(this.#r&&this.hasListeners()){const n=this.#e.variables,r=this.#e.context;t?.type==="success"?(this.#r.onSuccess?.(t.data,n,r),this.#r.onSettled?.(t.data,null,n,r)):t?.type==="error"&&(this.#r.onError?.(t.error,n,r),this.#r.onSettled?.(void 0,t.error,n,r))}this.listeners.forEach(n=>{n(this.#e)})})}},nae=w.createContext(void 0),Wi=e=>{const t=w.useContext(nae);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},rae=({client:e,children:t})=>(w.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),O.jsx(nae.Provider,{value:e,children:t})),iae=w.createContext(!1),fCe=()=>w.useContext(iae);iae.Provider;function OCe(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var pCe=w.createContext(OCe()),gCe=()=>w.useContext(pCe);function sae(e,t){return typeof e=="function"?e(...t):!!e}function XX(){}var mCe=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},vCe=e=>{w.useEffect(()=>{e.clearReset()},[e])},bCe=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||sae(n,[e.error,r])),wCe=e=>{const t=e.staleTime;e.suspense&&(e.staleTime=typeof t=="function"?(...n)=>Math.max(t(...n),1e3):Math.max(t??1e3,1e3),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3)))},yCe=(e,t)=>e.isLoading&&e.isFetching&&!t,xCe=(e,t)=>e?.suspense&&t.isPending,eq=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function SCe(e,t,n){const r=Wi(),i=fCe(),s=gCe(),a=r.defaultQueryOptions(e);r.getDefaultOptions().queries?._experimental_beforeQuery?.(a),a._optimisticResults=i?"isRestoring":"optimistic",wCe(a),mCe(a,s),vCe(s);const o=!r.getQueryCache().get(a.queryHash),[l]=w.useState(()=>new t(r,a)),c=l.getOptimisticResult(a),u=!i&&e.subscribed!==!1;if(w.useSyncExternalStore(w.useCallback(d=>{const h=u?l.subscribe(As.batchCalls(d)):XX;return l.updateResult(),h},[l,u]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),w.useEffect(()=>{l.setOptions(a)},[a,l]),xCe(a,c))throw eq(a,l,s);if(bCe({result:c,errorResetBoundary:s,throwOnError:a.throwOnError,query:r.getQueryCache().get(a.queryHash),suspense:a.suspense}))throw c.error;return r.getDefaultOptions().queries?._experimental_afterQuery?.(a,c),a.experimental_prefetchInRender&&!Og&&yCe(c,i)&&(o?eq(a,l,s):r.getQueryCache().get(a.queryHash)?.promise)?.catch(XX).finally(()=>{l.updateResult()}),a.notifyOnChangeProps?c:l.trackResult(c)}function hr(e,t){return SCe(e,cCe)}function wo(e,t){const n=Wi(),[r]=w.useState(()=>new hCe(n,e));w.useEffect(()=>{r.setOptions(e)},[r,e]);const i=w.useSyncExternalStore(w.useCallback(a=>r.subscribe(As.batchCalls(a)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),s=w.useCallback((a,o)=>{r.mutate(a,o).catch(XX)},[r]);if(i.error&&sae(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:s,mutateAsync:i.mutate}}const $Ce=function(){const t=typeof document<"u"&&document.createElement("link").relList;return t&&t.supports&&t.supports("modulepreload")?"modulepreload":"preload"}(),kCe=function(e,t){return new URL(e,t).href},tq={},Xe=function(t,n,r){let i=Promise.resolve();if(n&&n.length>0){const a=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),l=o?.nonce||o?.getAttribute("nonce");i=Promise.allSettled(n.map(c=>{if(c=kCe(c,r),c in tq)return;tq[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(!!r)for(let p=a.length-1;p>=0;p--){const g=a[p];if(g.href===c&&(!u||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":$Ce,u||(f.as="script"),f.crossOrigin="",f.href=c,l&&f.setAttribute("nonce",l),document.head.appendChild(f),u)return new Promise((p,g)=>{f.addEventListener("load",p),f.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&s(o.reason);return t().catch(s)})};var Uc,qe=typeof window<"u"?window:void 0,Fo=typeof globalThis<"u"?globalThis:qe,aae=Array.prototype,nq=aae.forEach,rq=aae.indexOf,vl=Fo?.navigator,Bt=Fo?.document,Ao=Fo?.location,DX=Fo?.fetch,IX=Fo!=null&&Fo.XMLHttpRequest&&"withCredentials"in new Fo.XMLHttpRequest?Fo.XMLHttpRequest:void 0,iq=Fo?.AbortController,ys=vl?.userAgent,In=qe??{},th={DEBUG:!1,LIB_VERSION:"1.235.6"},YE="$copy_autocapture",TCe=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];(function(e){e.GZipJS="gzip-js",e.Base64="base64"})(Uc||(Uc={}));var PCe=["fatal","error","warning","log","info","debug"];function or(e,t){return e.indexOf(t)!==-1}var AC=function(e){return e.trim()},UF=function(e){return e.replace(/^\$/,"")},_Ce=Array.isArray,oae=Object.prototype,lae=oae.hasOwnProperty,XC=oae.toString,Bi=_Ce||function(e){return XC.call(e)==="[object Array]"},Bc=e=>typeof e=="function",Zi=e=>e===Object(e)&&!Bi(e),w0=e=>{if(Zi(e)){for(var t in e)if(lae.call(e,t))return!1;return!0}return!1},Mt=e=>e===void 0,ks=e=>XC.call(e)=="[object String]",NX=e=>ks(e)&&e.trim().length===0,IO=e=>e===null,jr=e=>Mt(e)||IO(e),co=e=>XC.call(e)=="[object Number]",lh=e=>XC.call(e)==="[object Boolean]",CCe=e=>e instanceof FormData,QCe=e=>or(TCe,e),cae=e=>{var t={_log:function(n){if(qe&&(th.DEBUG||In.POSTHOG_DEBUG)&&!Mt(qe.console)&&qe.console){for(var r=("__rrweb_original__"in qe.console[n])?qe.console[n].__rrweb_original__:qe.console[n],i=arguments.length,s=new Array(i>1?i-1:0),a=1;a<i;a++)s[a-1]=arguments[a];r(e,...s)}},info:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("log",...r)},warn:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("warn",...r)},error:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];t._log("error",...r)},critical:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];console.error(e,...r)},uninitializedWarning:n=>{t.error("You must initialize PostHog before calling ".concat(n))},createLogger:n=>cae("".concat(e," ").concat(n))};return t},ln=cae("[PostHog.js]"),Va=ln.createLogger,ECe=Va("[ExternalScriptsLoader]"),sq=(e,t,n)=>{if(e.config.disable_external_dependency_loading)return ECe.warn("".concat(t," was requested but loading of external scripts is disabled.")),n("Loading of external scripts is disabled");var r=Bt?.querySelectorAll("script");if(r){for(var i=0;i<r.length;i++)if(r[i].src===t)return n()}var s=()=>{if(!Bt)return n("document not found");var a=Bt.createElement("script");if(a.type="text/javascript",a.crossOrigin="anonymous",a.src=t,a.onload=c=>n(void 0,c),a.onerror=c=>n(c),e.config.prepare_external_dependency_script&&(a=e.config.prepare_external_dependency_script(a)),!a)return n("prepare_external_dependency_script returned null");var o,l=Bt.querySelectorAll("body > script");l.length>0?(o=l[0].parentNode)===null||o===void 0||o.insertBefore(a,l[0]):Bt.body.appendChild(a)};Bt!=null&&Bt.body?s():Bt?.addEventListener("DOMContentLoaded",s)};function aq(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function Be(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?aq(Object(n),!0).forEach(function(r){kt(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):aq(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function kt(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function uae(e,t){if(e==null)return{};var n,r,i=function(a,o){if(a==null)return{};var l,c,u={},d=Object.keys(a);for(c=0;c<d.length;c++)l=d[c],o.indexOf(l)>=0||(u[l]=a[l]);return u}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}In.__PosthogExtensions__=In.__PosthogExtensions__||{},In.__PosthogExtensions__.loadExternalDependency=(e,t,n)=>{var r="/static/".concat(t,".js")+"?v=".concat(e.version);if(t==="remote-config"&&(r="/array/".concat(e.config.token,"/config.js")),t==="toolbar"){var i=3e5,s=Math.floor(Date.now()/i)*i;r="".concat(r,"&t=").concat(s)}var a=e.requestRouter.endpointFor("assets",r);sq(e,a,n)},In.__PosthogExtensions__.loadSiteApp=(e,t,n)=>{var r=e.requestRouter.endpointFor("api",t);sq(e,r,n)};var G2={};function iO(e,t,n){if(Bi(e)){if(nq&&e.forEach===nq)e.forEach(t,n);else if("length"in e&&e.length===+e.length){for(var r=0,i=e.length;r<i;r++)if(r in e&&t.call(n,e[r],r)===G2)return}}}function ni(e,t,n){if(!jr(e)){if(Bi(e))return iO(e,t,n);if(CCe(e)){for(var r of e.entries())if(t.call(n,r[1],r[0])===G2)return}else for(var i in e)if(lae.call(e,i)&&t.call(n,e[i],i)===G2)return}}var ss=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return iO(n,function(i){for(var s in i)i[s]!==void 0&&(e[s]=i[s])}),e},QT=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return iO(n,function(i){iO(i,function(s){e.push(s)})}),e};function ET(e){for(var t=Object.keys(e),n=t.length,r=new Array(n);n--;)r[n]=[t[n],e[t[n]]];return r}var oq=function(e){try{return e()}catch{return}},RCe=function(e){return function(){try{for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return e.apply(this,n)}catch(i){ln.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),ln.critical(i)}}},Py=function(e){var t={};return ni(e,function(n,r){ks(n)&&n.length>0&&(t[r]=n)}),t};function ACe(e,t){return n=e,r=s=>ks(s)&&!IO(t)?s.slice(0,t):s,i=new Set,function s(a,o){return a!==Object(a)?r?r(a,o):a:i.has(a)?void 0:(i.add(a),Bi(a)?(l=[],iO(a,c=>{l.push(s(c))})):(l={},ni(a,(c,u)=>{i.has(c)||(l[u]=s(c,u))})),l);var l}(n);var n,r,i}var XCe=["herokuapp.com","vercel.app","netlify.app"];function DCe(e){var t=e?.hostname;if(!ks(t))return!1;var n=t.split(".").slice(-2).join(".");for(var r of XCe)if(n===r)return!1;return!0}function dae(e,t){for(var n=0;n<e.length;n++)if(t(e[n]))return e[n]}function os(e,t,n,r){var{capture:i=!1,passive:s=!0}=r??{};e?.addEventListener(t,n,{capture:i,passive:s})}var hae="$people_distinct_id",Gb="__alias",Vb="__timers",lq="$autocapture_disabled_server_side",FX="$heatmaps_enabled_server_side",cq="$exception_capture_enabled_server_side",uq="$web_vitals_enabled_server_side",fae="$dead_clicks_enabled_server_side",dq="$web_vitals_allowed_metrics",MX="$session_recording_enabled_server_side",hq="$console_log_recording_enabled_server_side",fq="$session_recording_network_payload_capture",Oq="$session_recording_masking",pq="$session_recording_canvas_recording",gq="$replay_sample_rate",mq="$replay_minimum_duration",vq="$replay_script_config",V2="$sesid",Yb="$session_is_sampled",BE="$session_recording_url_trigger_activated_session",ZE="$session_recording_event_trigger_activated_session",y0="$enabled_feature_flags",RT="$early_access_features",zX="$feature_flag_details",Bb="$stored_person_properties",xp="$stored_group_properties",LX="$surveys",g$="$surveys_activated",Y2="$flag_call_reported",Vd="$user_state",qX="$client_session_props",UX="$capture_rate_limit",WX="$initial_campaign_params",jX="$initial_referrer_info",GX="$initial_person_info",B2="$epp",Oae="__POSTHOG_TOOLBAR__",bq="$posthog_cookieless",ICe=[hae,Gb,"__cmpns",Vb,MX,FX,V2,y0,Vd,RT,zX,xp,Bb,LX,Y2,qX,UX,WX,jX,B2];function wq(e){var t;return e instanceof Element&&(e.id===Oae||!((t=e.closest)===null||t===void 0||!t.call(e,".toolbar-global-fade-container")))}function DC(e){return!!e&&e.nodeType===1}function sO(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function pae(e){return!!e&&e.nodeType===3}function gae(e){return!!e&&e.nodeType===11}function WF(e){return e?AC(e).split(/\s+/):[]}function yq(e){var t=qe?.location.href;return!!(t&&e&&e.some(n=>t.match(n)))}function Z2(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return WF(t)}function mae(e){return jr(e)?null:AC(e).split(/(\s+)/).filter(t=>pv(t)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function IC(e){var t="";return YX(e)&&!wae(e)&&e.childNodes&&e.childNodes.length&&ni(e.childNodes,function(n){var r;pae(n)&&n.textContent&&(t+=(r=mae(n.textContent))!==null&&r!==void 0?r:"")}),AC(t)}function vae(e){return Mt(e.target)?e.srcElement||null:(t=e.target)!==null&&t!==void 0&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var VX=["a","button","form","input","select","textarea","label"];function bae(e){var t=e.parentNode;return!(!t||!DC(t))&&t}function NCe(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,i=arguments.length>4?arguments[4]:void 0;if(!qe||!e||sO(e,"html")||!DC(e)||n!=null&&n.url_allowlist&&!yq(n.url_allowlist)||n!=null&&n.url_ignorelist&&yq(n.url_ignorelist))return!1;if(n!=null&&n.dom_event_allowlist){var s=n.dom_event_allowlist;if(s&&!s.some(f=>t.type===f))return!1}for(var a=!1,o=[e],l=!0,c=e;c.parentNode&&!sO(c,"body");)if(gae(c.parentNode))o.push(c.parentNode.host),c=c.parentNode.host;else{if(!(l=bae(c)))break;if(r||VX.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var u=qe.getComputedStyle(l);u&&u.getPropertyValue("cursor")==="pointer"&&(a=!0)}o.push(l),c=l}if(!function(f,p){var g=p?.element_allowlist;if(Mt(g))return!0;var m=function(y){if(g.some(T=>y.tagName.toLowerCase()===T))return{v:!0}};for(var v of f){var b=m(v);if(typeof b=="object")return b.v}return!1}(o,n)||!function(f,p){var g=p?.css_selector_allowlist;if(Mt(g))return!0;var m=function(y){if(g.some(T=>y.matches(T)))return{v:!0}};for(var v of f){var b=m(v);if(typeof b=="object")return b.v}return!1}(o,n))return!1;var d=qe.getComputedStyle(e);if(d&&d.getPropertyValue("cursor")==="pointer"&&t.type==="click")return!0;var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(i||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(i||["change","click"]).indexOf(t.type)>=0;default:return a?(i||["click"]).indexOf(t.type)>=0:(i||["click"]).indexOf(t.type)>=0&&(VX.indexOf(h)>-1||e.getAttribute("contenteditable")==="true")}}function YX(e){for(var t=e;t.parentNode&&!sO(t,"body");t=t.parentNode){var n=Z2(t);if(or(n,"ph-sensitive")||or(n,"ph-no-capture"))return!1}if(or(Z2(e),"ph-include"))return!0;var r=e.type||"";if(ks(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var i=e.name||e.id||"";return!(ks(i)&&/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(i.replace(/[^a-zA-Z0-9]/g,"")))}function wae(e){return!!(sO(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||sO(e,"select")||sO(e,"textarea")||e.getAttribute("contenteditable")==="true")}var yae="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",FCe=new RegExp("^(?:".concat(yae,")$")),MCe=new RegExp(yae),xae="\\d{3}-?\\d{2}-?\\d{4}",zCe=new RegExp("^(".concat(xae,")$")),LCe=new RegExp("(".concat(xae,")"));function pv(e){var t=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1];return!(jr(e)||ks(e)&&(e=AC(e),(t?FCe:MCe).test((e||"").replace(/[- ]/g,""))||(t?zCe:LCe).test(e)))}function Sae(e){var t=IC(e);return pv(t="".concat(t," ").concat($ae(e)).trim())?t:""}function $ae(e){var t="";return e&&e.childNodes&&e.childNodes.length&&ni(e.childNodes,function(n){var r;if(n&&((r=n.tagName)===null||r===void 0?void 0:r.toLowerCase())==="span")try{var i=IC(n);t="".concat(t," ").concat(i).trim(),n.childNodes&&n.childNodes.length&&(t="".concat(t," ").concat($ae(n)).trim())}catch(s){ln.error("[AutoCapture]",s)}}),t}function qCe(e){return function(t){var n=t.map(r=>{var i,s,a="";if(r.tag_name&&(a+=r.tag_name),r.attr_class)for(var o of(r.attr_class.sort(),r.attr_class))a+=".".concat(o.replace(/"/g,""));var l=Be(Be(Be(Be({},r.text?{text:r.text}:{}),{},{"nth-child":(i=r.nth_child)!==null&&i!==void 0?i:0,"nth-of-type":(s=r.nth_of_type)!==null&&s!==void 0?s:0},r.href?{href:r.href}:{}),r.attr_id?{attr_id:r.attr_id}:{}),r.attributes),c={};return ET(l).sort((u,d)=>{var[h]=u,[f]=d;return h.localeCompare(f)}).forEach(u=>{var[d,h]=u;return c[xq(d.toString())]=xq(h.toString())}),a+=":",a+=ET(l).map(u=>{var[d,h]=u;return"".concat(d,'="').concat(h,'"')}).join("")});return n.join(";")}(function(t){return t.map(n=>{var r,i,s={text:(r=n.$el_text)===null||r===void 0?void 0:r.slice(0,400),tag_name:n.tag_name,href:(i=n.attr__href)===null||i===void 0?void 0:i.slice(0,2048),attr_class:UCe(n),attr_id:n.attr__id,nth_child:n.nth_child,nth_of_type:n.nth_of_type,attributes:{}};return ET(n).filter(a=>{var[o]=a;return o.indexOf("attr__")===0}).forEach(a=>{var[o,l]=a;return s.attributes[o]=l}),s})}(e))}function xq(e){return e.replace(/"|\\"/g,'\\"')}function UCe(e){var t=e.attr__class;return t?Bi(t)?t:WF(t):void 0}class kae{constructor(){this.clicks=[]}isRageClick(t,n,r){var i=this.clicks[this.clicks.length-1];if(i&&Math.abs(t-i.x)+Math.abs(n-i.y)<30&&r-i.timestamp<1e3){if(this.clicks.push({x:t,y:n,timestamp:r}),this.clicks.length===3)return!0}else this.clicks=[{x:t,y:n,timestamp:r}];return!1}}var WCe=["localhost","127.0.0.1"],D0=e=>{var t=Bt?.createElement("a");return Mt(t)?null:(t.href=e,t)},jCe=function(e){var t,n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"&",i=[];return ni(e,function(s,a){Mt(s)||Mt(a)||a==="undefined"||(t=encodeURIComponent((o=>o instanceof File)(s)?s.name:s.toString()),n=encodeURIComponent(a),i[i.length]=n+"="+t)}),i.join(r)},H2=function(e,t){for(var n,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),i=0;i<r.length;i++){var s=r[i].split("=");if(s[0]===t){n=s;break}}if(!Bi(n)||n.length<2)return"";var a=n[1];try{a=decodeURIComponent(a)}catch{ln.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},HE=function(e,t,n){if(!e||!t||!t.length)return e;for(var r=e.split("#"),i=r[0]||"",s=r[1],a=i.split("?"),o=a[1],l=a[0],c=(o||"").split("&"),u=[],d=0;d<c.length;d++){var h=c[d].split("=");Bi(h)&&(t.includes(h[0])?u.push(h[0]+"="+n):u.push(c[d]))}var f=l;return o!=null&&(f+="?"+u.join("&")),s!=null&&(f+="#"+s),f},K2=function(e,t){var n=e.match(new RegExp(t+"=([^&]*)"));return n?n[1]:null},Sq=Va("[AutoCapture]");function KE(e,t){return t.length>e?t.slice(0,e)+"...":t}function GCe(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!DC(t));return t}function VCe(e,t,n,r){var i=e.tagName.toLowerCase(),s={tag_name:i};VX.indexOf(i)>-1&&!n&&(i.toLowerCase()==="a"||i.toLowerCase()==="button"?s.$el_text=KE(1024,Sae(e)):s.$el_text=KE(1024,IC(e)));var a=Z2(e);a.length>0&&(s.classes=a.filter(function(u){return u!==""})),ni(e.attributes,function(u){var d;if((!wae(e)||["name","id","class","aria-label"].indexOf(u.name)!==-1)&&(r==null||!r.includes(u.name))&&!t&&pv(u.value)&&(d=u.name,!ks(d)||d.substring(0,10)!=="_ngcontent"&&d.substring(0,7)!=="_nghost")){var h=u.value;u.name==="class"&&(h=WF(h).join(" ")),s["attr__"+u.name]=KE(1024,h)}});for(var o=1,l=1,c=e;c=GCe(c);)o++,c.tagName===e.tagName&&l++;return s.nth_child=o,s.nth_of_type=l,s}function YCe(e,t){for(var n,r,{e:i,maskAllElementAttributes:s,maskAllText:a,elementAttributeIgnoreList:o,elementsChainAsString:l}=t,c=[e],u=e;u.parentNode&&!sO(u,"body");)gae(u.parentNode)?(c.push(u.parentNode.host),u=u.parentNode.host):(c.push(u.parentNode),u=u.parentNode);var d,h=[],f={},p=!1,g=!1;if(ni(c,T=>{var x=YX(T);T.tagName.toLowerCase()==="a"&&(p=T.getAttribute("href"),p=x&&p&&pv(p)&&p),or(Z2(T),"ph-no-capture")&&(g=!0),h.push(VCe(T,s,a,o));var S=function(k){if(!YX(k))return{};var Q={};return ni(k.attributes,function(C){if(C.name&&C.name.indexOf("data-ph-capture-attribute")===0){var _=C.name.replace("data-ph-capture-attribute-",""),R=C.value;_&&R&&pv(R)&&(Q[_]=R)}}),Q}(T);ss(f,S)}),g)return{props:{},explicitNoCapture:g};if(a||(e.tagName.toLowerCase()==="a"||e.tagName.toLowerCase()==="button"?h[0].$el_text=Sae(e):h[0].$el_text=IC(e)),p){var m,v;h[0].attr__href=p;var b=(m=D0(p))===null||m===void 0?void 0:m.host,y=qe==null||(v=qe.location)===null||v===void 0?void 0:v.host;b&&y&&b!==y&&(d=p)}return{props:ss({$event_type:i.type,$ce_version:1},l?{}:{$elements:h},{$elements_chain:qCe(h)},(n=h[0])!==null&&n!==void 0&&n.$el_text?{$el_text:(r=h[0])===null||r===void 0?void 0:r.$el_text}:{},d&&i.type==="click"?{$external_click_url:d}:{},f)}}let BCe=class{constructor(t){kt(this,"_initialized",!1),kt(this,"_isDisabledServerSide",null),kt(this,"rageclicks",new kae),kt(this,"_elementsChainAsString",!1),this.instance=t,this._elementSelectors=null}get config(){var t,n,r=Zi(this.instance.config.autocapture)?this.instance.config.autocapture:{};return r.url_allowlist=(t=r.url_allowlist)===null||t===void 0?void 0:t.map(i=>new RegExp(i)),r.url_ignorelist=(n=r.url_ignorelist)===null||n===void 0?void 0:n.map(i=>new RegExp(i)),r}_addDomEventHandlers(){if(this.isBrowserSupported()){if(qe&&Bt){var t=r=>{r=r||qe?.event;try{this._captureEvent(r)}catch(i){Sq.error("Failed to capture event",i)}};if(os(Bt,"submit",t,{capture:!0}),os(Bt,"change",t,{capture:!0}),os(Bt,"click",t,{capture:!0}),this.config.capture_copied_text){var n=r=>{r=r||qe?.event,this._captureEvent(r,YE)};os(Bt,"copy",n,{capture:!0}),os(Bt,"cut",n,{capture:!0})}}}else Sq.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}onRemoteConfig(t){t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[lq]:!!t.autocapture_opt_out}),this._isDisabledServerSide=!!t.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(t){this._elementSelectors=t}getElementSelectors(t){var n,r=[];return(n=this._elementSelectors)===null||n===void 0||n.forEach(i=>{var s=Bt?.querySelectorAll(i);s?.forEach(a=>{t===a&&r.push(i)})}),r}get isEnabled(){var t,n,r=(t=this.instance.persistence)===null||t===void 0?void 0:t.props[lq],i=this._isDisabledServerSide;if(IO(i)&&!lh(r)&&!this.instance.config.advanced_disable_decide)return!1;var s=(n=this._isDisabledServerSide)!==null&&n!==void 0?n:!!r;return!!this.instance.config.autocapture&&!s}_captureEvent(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"$autocapture";if(this.isEnabled){var r,i=vae(t);pae(i)&&(i=i.parentNode||null),n==="$autocapture"&&t.type==="click"&&t instanceof MouseEvent&&this.instance.config.rageclick&&(r=this.rageclicks)!==null&&r!==void 0&&r.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._captureEvent(t,"$rageclick");var s=n===YE;if(i&&NCe(i,t,this.config,s,s?["copy","cut"]:void 0)){var{props:a,explicitNoCapture:o}=YCe(i,{e:t,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString});if(o)return!1;var l=this.getElementSelectors(i);if(l&&l.length>0&&(a.$element_selectors=l),n===YE){var c,u=mae(qe==null||(c=qe.getSelection())===null||c===void 0?void 0:c.toString()),d=t.type||"clipboard";if(!u)return!1;a.$selected_content=u,a.$copy_type=d}return this.instance.capture(n,a),!0}}}isBrowserSupported(){return Bc(Bt?.querySelectorAll)}};Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return co(e)&&isFinite(e)&&Math.floor(e)===e});var $q="0123456789abcdef";let ZCe=class BX{constructor(t){if(this.bytes=t,t.length!==16)throw new TypeError("not 128-bit length")}static fromFieldsV7(t,n,r,i){if(!Number.isInteger(t)||!Number.isInteger(n)||!Number.isInteger(r)||!Number.isInteger(i)||t<0||n<0||r<0||i<0||t>0xffffffffffff||n>4095||r>1073741823||i>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=t/Math.pow(2,40),s[1]=t/Math.pow(2,32),s[2]=t/Math.pow(2,24),s[3]=t/Math.pow(2,16),s[4]=t/Math.pow(2,8),s[5]=t,s[6]=112|n>>>8,s[7]=n,s[8]=128|r>>>24,s[9]=r>>>16,s[10]=r>>>8,s[11]=r,s[12]=i>>>24,s[13]=i>>>16,s[14]=i>>>8,s[15]=i,new BX(s)}toString(){for(var t="",n=0;n<this.bytes.length;n++)t=t+$q.charAt(this.bytes[n]>>>4)+$q.charAt(15&this.bytes[n]),n!==3&&n!==5&&n!==7&&n!==9||(t+="-");if(t.length!==36)throw new Error("Invalid UUIDv7 was generated");return t}clone(){return new BX(this.bytes.slice(0))}equals(t){return this.compareTo(t)===0}compareTo(t){for(var n=0;n<16;n++){var r=this.bytes[n]-t.bytes[n];if(r!==0)return Math.sign(r)}return 0}},HCe=class{constructor(){kt(this,"timestamp",0),kt(this,"counter",0),kt(this,"random",new KCe)}generate(){var t=this.generateOrAbort();if(Mt(t)){this.timestamp=0;var n=this.generateOrAbort();if(Mt(n))throw new Error("Could not generate UUID after timestamp reset");return n}return t}generateOrAbort(){var t=Date.now();if(t>this.timestamp)this.timestamp=t,this.resetCounter();else{if(!(t+1e4>this.timestamp))return;this.counter++,this.counter>4398046511103&&(this.timestamp++,this.resetCounter())}return ZCe.fromFieldsV7(this.timestamp,Math.trunc(this.counter/Math.pow(2,30)),this.counter&Math.pow(2,30)-1,this.random.nextUint32())}resetCounter(){this.counter=1024*this.random.nextUint32()+(1023&this.random.nextUint32())}};var kq,Tae=e=>{if(typeof UUIDV7_DENY_WEAK_RNG<"u"&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};qe&&!Mt(qe.crypto)&&crypto.getRandomValues&&(Tae=e=>crypto.getRandomValues(e));let KCe=class{constructor(){kt(this,"buffer",new Uint32Array(8)),kt(this,"cursor",1/0)}nextUint32(){return this.cursor>=this.buffer.length&&(Tae(this.buffer),this.cursor=0),this.buffer[this.cursor++]}};var Uf=()=>JCe().toString(),JCe=()=>(kq||(kq=new HCe)).generate(),eQe="Thu, 01 Jan 1970 00:00:00 GMT",j1="",tQe=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i;function nQe(e,t){if(t){var n=function(i){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Bt;if(j1)return j1;if(!s||["localhost","127.0.0.1"].includes(i))return"";for(var a=i.split("."),o=Math.min(a.length,8),l="dmn_chk_"+Uf(),c=new RegExp("(^|;)\\s*"+l+"=1");!j1&&o--;){var u=a.slice(o).join("."),d=l+"=1;domain=."+u;s.cookie=d,c.test(s.cookie)&&(s.cookie=d+";expires="+eQe,j1=u)}return j1}(e);if(!n){var r=(i=>{var s=i.match(tQe);return s?s[0]:""})(e);r!==n&&ln.info("Warning: cookie subdomain discovery mismatch",r,n),n=r}return n?"; domain=."+n:""}return""}var Af,vh={is_supported:()=>!!Bt,error:function(e){ln.error("cookieStore error: "+e)},get:function(e){if(Bt){try{for(var t=e+"=",n=Bt.cookie.split(";").filter(s=>s.length),r=0;r<n.length;r++){for(var i=n[r];i.charAt(0)==" ";)i=i.substring(1,i.length);if(i.indexOf(t)===0)return decodeURIComponent(i.substring(t.length,i.length))}}catch{}return null}},parse:function(e){var t;try{t=JSON.parse(vh.get(e))||{}}catch{}return t},set:function(e,t,n,r,i){if(Bt)try{var s="",a="",o=nQe(Bt.location.hostname,r);if(n){var l=new Date;l.setTime(l.getTime()+24*n*60*60*1e3),s="; expires="+l.toUTCString()}i&&(a="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+s+"; SameSite=Lax; path=/"+o+a;return c.length>3686.4&&ln.warn("cookieStore warning: large cookie, len="+c.length),Bt.cookie=c,c}catch{return}},remove:function(e,t){try{vh.set(e,"",-1,t)}catch{return}}},JE=null,Es={is_supported:function(){if(!IO(JE))return JE;var e=!0;if(Mt(qe))e=!1;else try{var t="__mplssupport__";Es.set(t,"xyz"),Es.get(t)!=='"xyz"'&&(e=!1),Es.remove(t)}catch{e=!1}return e||ln.error("localStorage unsupported; falling back to cookie store"),JE=e,e},error:function(e){ln.error("localStorage error: "+e)},get:function(e){try{return qe?.localStorage.getItem(e)}catch(t){Es.error(t)}return null},parse:function(e){try{return JSON.parse(Es.get(e))||{}}catch{}return null},set:function(e,t){try{qe?.localStorage.setItem(e,JSON.stringify(t))}catch(n){Es.error(n)}},remove:function(e){try{qe?.localStorage.removeItem(e)}catch(t){Es.error(t)}}},rQe=["distinct_id",V2,Yb,B2,GX],m$=Be(Be({},Es),{},{parse:function(e){try{var t={};try{t=vh.parse(e)||{}}catch{}var n=ss(t,JSON.parse(Es.get(e)||"{}"));return Es.set(e,n),n}catch{}return null},set:function(e,t,n,r,i,s){try{Es.set(e,t,void 0,void 0,s);var a={};rQe.forEach(o=>{t[o]&&(a[o]=t[o])}),Object.keys(a).length&&vh.set(e,a,n,r,i,s)}catch(o){Es.error(o)}},remove:function(e,t){try{qe?.localStorage.removeItem(e),vh.remove(e,t)}catch(n){Es.error(n)}}}),v$={},iQe={is_supported:function(){return!0},error:function(e){ln.error("memoryStorage error: "+e)},get:function(e){return v$[e]||null},parse:function(e){return v$[e]||null},set:function(e,t){v$[e]=t},remove:function(e){delete v$[e]}},rp=null,ua={is_supported:function(){if(!IO(rp))return rp;if(rp=!0,Mt(qe))rp=!1;else try{var e="__support__";ua.set(e,"xyz"),ua.get(e)!=='"xyz"'&&(rp=!1),ua.remove(e)}catch{rp=!1}return rp},error:function(e){ln.error("sessionStorage error: ",e)},get:function(e){try{return qe?.sessionStorage.getItem(e)}catch(t){ua.error(t)}return null},parse:function(e){try{return JSON.parse(ua.get(e))||null}catch{}return null},set:function(e,t){try{qe?.sessionStorage.setItem(e,JSON.stringify(t))}catch(n){ua.error(n)}},remove:function(e){try{qe?.sessionStorage.removeItem(e)}catch(t){ua.error(t)}}};(function(e){e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED"})(Af||(Af={}));let sQe=class{constructor(t){this.instance=t}get config(){return this.instance.config}get consent(){return this.getDnt()?Af.DENIED:this.storedConsent}isOptedOut(){return this.consent===Af.DENIED||this.consent===Af.PENDING&&this.config.opt_out_capturing_by_default}isOptedIn(){return!this.isOptedOut()}optInOut(t){this.storage.set(this.storageKey,t?1:0,this.config.cookie_expiration,this.config.cross_subdomain_cookie,this.config.secure_cookie)}reset(){this.storage.remove(this.storageKey,this.config.cross_subdomain_cookie)}get storageKey(){var{token:t,opt_out_capturing_cookie_prefix:n}=this.instance.config;return(n||"__ph_opt_in_out_")+t}get storedConsent(){var t=this.storage.get(this.storageKey);return t==="1"?Af.GRANTED:t==="0"?Af.DENIED:Af.PENDING}get storage(){if(!this._storage){var t=this.config.opt_out_capturing_persistence_type;this._storage=t==="localStorage"?Es:vh;var n=t==="localStorage"?vh:Es;n.get(this.storageKey)&&(this._storage.get(this.storageKey)||this.optInOut(n.get(this.storageKey)==="1"),n.remove(this.storageKey,this.config.cross_subdomain_cookie))}return this._storage}getDnt(){return!!this.config.respect_dnt&&!!dae([vl?.doNotTrack,vl?.msDoNotTrack,In.doNotTrack],t=>or([!0,1,"1","yes"],t))}};var b$=Va("[Dead Clicks]"),aQe=()=>!0,oQe=e=>{var t,n=!((t=e.instance.persistence)===null||t===void 0||!t.get_property(fae)),r=e.instance.config.capture_dead_clicks;return lh(r)?r:n};let Pae=class{get lazyLoadedDeadClicksAutocapture(){return this._lazyLoadedDeadClicksAutocapture}constructor(t,n,r){this.instance=t,this.isEnabled=n,this.onCapture=r,this.startIfEnabled()}onRemoteConfig(t){this.instance.persistence&&this.instance.persistence.register({[fae]:t?.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.loadScript(()=>{this.start()})}loadScript(t){var n,r,i;(n=In.__PosthogExtensions__)!==null&&n!==void 0&&n.initDeadClicksAutocapture&&t(),(r=In.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"dead-clicks-autocapture",s=>{s?b$.error("failed to load script",s):t()})}start(){var t;if(Bt){if(!this._lazyLoadedDeadClicksAutocapture&&(t=In.__PosthogExtensions__)!==null&&t!==void 0&&t.initDeadClicksAutocapture){var n=Zi(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};n.__onCapture=this.onCapture,this._lazyLoadedDeadClicksAutocapture=In.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,n),this._lazyLoadedDeadClicksAutocapture.start(Bt),b$.info("starting...")}}else b$.error("`document` not found. Cannot start.")}stop(){this._lazyLoadedDeadClicksAutocapture&&(this._lazyLoadedDeadClicksAutocapture.stop(),this._lazyLoadedDeadClicksAutocapture=void 0,b$.info("stopping..."))}};var e5=Va("[ExceptionAutocapture]");let lQe=class{constructor(t){var n;kt(this,"startCapturing",()=>{var r;if(qe&&this.isEnabled&&(r=In.__PosthogExtensions__)!==null&&r!==void 0&&r.errorWrappingFunctions){var i=In.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,s=In.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,a=In.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.unwrapOnError&&this.config.capture_unhandled_errors&&(this.unwrapOnError=i(this.captureException.bind(this))),!this.unwrapUnhandledRejection&&this.config.capture_unhandled_rejections&&(this.unwrapUnhandledRejection=s(this.captureException.bind(this))),!this.unwrapConsoleError&&this.config.capture_console_errors&&(this.unwrapConsoleError=a(this.captureException.bind(this)))}catch(o){e5.error("failed to start",o),this.stopCapturing()}}}),this.instance=t,this.remoteEnabled=!((n=this.instance.persistence)===null||n===void 0||!n.props[cq]),this.config=this.requiredConfig(),this.startIfEnabled()}requiredConfig(){var t=this.instance.config.capture_exceptions,n={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return Zi(t)?n=Be(Be({},n),t):(Mt(t)?this.remoteEnabled:t)&&(n=Be(Be({},n),{},{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),n}get isEnabled(){return this.config.capture_console_errors||this.config.capture_unhandled_errors||this.config.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(e5.info("enabled"),this.loadScript(this.startCapturing))}loadScript(t){var n,r,i;(n=In.__PosthogExtensions__)!==null&&n!==void 0&&n.errorWrappingFunctions&&t(),(r=In.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"exception-autocapture",s=>{if(s)return e5.error("failed to load script",s);t()})}stopCapturing(){var t,n,r;(t=this.unwrapOnError)===null||t===void 0||t.call(this),this.unwrapOnError=void 0,(n=this.unwrapUnhandledRejection)===null||n===void 0||n.call(this),this.unwrapUnhandledRejection=void 0,(r=this.unwrapConsoleError)===null||r===void 0||r.call(this),this.unwrapConsoleError=void 0}onRemoteConfig(t){var n=t.autocaptureExceptions;this.remoteEnabled=!!n||!1,this.config=this.requiredConfig(),this.instance.persistence&&this.instance.persistence.register({[cq]:this.remoteEnabled}),this.startIfEnabled()}captureException(t){var n=this.instance.requestRouter.endpointFor("ui");t.$exception_personURL="".concat(n,"/project/").concat(this.instance.config.token,"/person/").concat(this.instance.get_distinct_id()),this.instance.exceptions.sendExceptionEvent(t)}};function _ae(e){return!Mt(Event)&&Cae(e,Event)}function Cae(e,t){try{return e instanceof t}catch{return!1}}function AT(e,t){return Object.prototype.toString.call(e)==="[object ".concat(t,"]")}function t5(e){return AT(e,"DOMError")}var Tq=/\(error: (.*)\)/,Pq=50,x0="?";function n5(e,t,n,r){var i={platform:"web:javascript",filename:e,function:t==="<anonymous>"?x0:t,in_app:!0};return Mt(n)||(i.lineno=n),Mt(r)||(i.colno=r),i}var cQe=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,uQe=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,dQe=/\((\S*)(?::(\d+))(?::(\d+))\)/,hQe=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,fQe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,OQe=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=t.sort((i,s)=>i[0]-s[0]).map(i=>i[1]);return function(i){for(var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,a=[],o=i.split(`
|
|
3
3
|
`),l=s;l<o.length;l++){var c=o[l];if(!(c.length>1024)){var u=Tq.test(c)?c.replace(Tq,"$1"):c;if(!u.match(/\S*Error: /)){for(var d of r){var h=d(u);if(h){a.push(h);break}}if(a.length>=Pq)break}}}return function(f){if(!f.length)return[];var p=Array.from(f);return p.reverse(),p.slice(0,Pq).map(g=>Be(Be({},g),{},{filename:g.filename||pQe(p).filename,function:g.function||x0}))}(a)}}([30,e=>{var t=cQe.exec(e);if(t){var[,n,r,i]=t;return n5(n,x0,+r,+i)}var s=uQe.exec(e);if(s){if(s[2]&&s[2].indexOf("eval")===0){var a=dQe.exec(s[2]);a&&(s[2]=a[1],s[3]=a[2],s[4]=a[3])}var[o,l]=Cq(s[1]||x0,s[2]);return n5(l,o,s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}}],[50,e=>{var t=hQe.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var n=fQe.exec(t[3]);n&&(t[1]=t[1]||"eval",t[3]=n[1],t[4]=n[2],t[5]="")}var r=t[3],i=t[1]||x0;return[i,r]=Cq(i,r),n5(r,i,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}}]);function pQe(e){return e[e.length-1]||{}}var w$,_q,r5,Cq=(e,t)=>{var n=e.indexOf("safari-extension")!==-1,r=e.indexOf("safari-web-extension")!==-1;return n||r?[e.indexOf("@")!==-1?e.split("@")[0]:x0,n?"safari-extension:".concat(t):"safari-web-extension:".concat(t)]:[e,t]},gQe=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;function jF(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=e.stacktrace||e.stack||"",r=function(a){return a&&mQe.test(a.message)?1:0}(e);try{var i=OQe,s=function(a,o){var l=function(c){var u=globalThis._posthogChunkIds;if(!u)return{};var d=Object.keys(u);return r5&&d.length===_q||(_q=d.length,r5=d.reduce((h,f)=>{w$||(w$={});var p=w$[f];if(p)h[p[0]]=p[1];else for(var g=c(f),m=g.length-1;m>=0;m--){var v=g[m],b=v?.filename,y=u[f];if(b&&y){h[b]=y,w$[f]=[b,y];break}}return h},{})),r5}(o);return a.forEach(c=>{c.filename&&(c.chunk_id=l[c.filename])}),a}(i(n,r),i);return s.slice(0,s.length-t)}catch{}return[]}var mQe=/Minified React error #\d+;/i;function i5(e,t){var n,r,i=jF(e),s=(n=t?.handled)===null||n===void 0||n,a=(r=t?.synthetic)!==null&&r!==void 0&&r;return{$exception_list:[{type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:e.name,value:function(o){var l=o.message;return l.error&&typeof l.error.message=="string"?String(l.error.message):String(l)}(e),stacktrace:{frames:i,type:"raw"},mechanism:{handled:s,synthetic:a}}],$exception_level:"error"}}function s5(e,t){var n,r,i,s=(n=t?.handled)===null||n===void 0||n,a=(r=t?.synthetic)===null||r===void 0||r,o={type:t!=null&&t.overrideExceptionType?t.overrideExceptionType:(i=t?.defaultExceptionType)!==null&&i!==void 0?i:"Error",value:e||t?.defaultExceptionMessage,mechanism:{handled:s,synthetic:a}};if(t!=null&&t.syntheticException){var l=jF(t.syntheticException,1);l.length&&(o.stacktrace={frames:l,type:"raw"})}return{$exception_list:[o],$exception_level:"error"}}function vQe(e){return ks(e)&&!NX(e)&&PCe.indexOf(e)>=0}function bQe(e,t){var n,r,i=(n=t?.handled)===null||n===void 0||n,s=(r=t?.synthetic)===null||r===void 0||r,a=t!=null&&t.overrideExceptionType?t.overrideExceptionType:_ae(e)?e.constructor.name:"Error",o="Non-Error 'exception' captured with keys: ".concat(function(u){var d=arguments.length>1&&arguments[1]!==void 0?arguments[1]:40,h=Object.keys(u);if(h.sort(),!h.length)return"[object has no keys]";for(var f=h.length;f>0;f--){var p=h.slice(0,f).join(", ");if(!(p.length>d))return f===h.length||p.length<=d?p:"".concat(p.slice(0,d),"...")}return""}(e)),l={type:a,value:o,mechanism:{handled:i,synthetic:s}};if(t!=null&&t.syntheticException){var c=jF(t?.syntheticException,1);c.length&&(l.stacktrace={frames:c,type:"raw"})}return{$exception_list:[l],$exception_level:vQe(e.level)?e.level:"error"}}function wQe(e,t){var{error:n,event:r}=e,i={$exception_list:[]},s=n||r;if(t5(s)||function(f){return AT(f,"DOMException")}(s)){var a=s;if(function(f){return"stack"in f}(s))i=i5(s,t);else{var o=a.name||(t5(a)?"DOMError":"DOMException"),l=a.message?"".concat(o,": ").concat(a.message):o,c=t5(a)?"DOMError":"DOMException";i=s5(l,Be(Be({},t),{},{overrideExceptionType:c,defaultExceptionMessage:l}))}return"code"in a&&(i.$exception_DOMException_code="".concat(a.code)),i}if(function(f){return AT(f,"ErrorEvent")}(s)&&s.error)return i5(s.error,t);if(function(f){switch(Object.prototype.toString.call(f)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":return!0;default:return Cae(f,Error)}}(s))return i5(s,t);if(function(f){return AT(f,"Object")}(s)||_ae(s))return bQe(s,t);if(Mt(n)&&ks(r)){var u="Error",d=r,h=r.match(gQe);return h&&(u=h[1],d=h[2]),s5(d,Be(Be({},t),{},{overrideExceptionType:u,defaultExceptionMessage:d}))}return s5(s,t)}function J2(e){var t,n;return((t=JSON.stringify(e,(n=[],function(r,i){if(Zi(i)){for(;n.length>0&&n[n.length-1]!==this;)n.pop();return n.includes(i)?"[Circular]":(n.push(i),i)}return i})))===null||t===void 0?void 0:t.length)||0}function ZX(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:66060288e-1;if(e.size>=t&&e.data.length>1){var n=Math.floor(e.data.length/2),r=e.data.slice(0,n),i=e.data.slice(n);return[ZX({size:J2(r),data:r,sessionId:e.sessionId,windowId:e.windowId}),ZX({size:J2(i),data:i,sessionId:e.sessionId,windowId:e.windowId})].flatMap(s=>s)}return[e]}var Yd=(e=>(e[e.DomContentLoaded=0]="DomContentLoaded",e[e.Load=1]="Load",e[e.FullSnapshot=2]="FullSnapshot",e[e.IncrementalSnapshot=3]="IncrementalSnapshot",e[e.Meta=4]="Meta",e[e.Custom=5]="Custom",e[e.Plugin=6]="Plugin",e))(Yd||{}),Fc=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(Fc||{}),HX="[SessionRecording]",KX="redacted",y$={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],maskRequestFn:e=>e,recordHeaders:!1,recordBody:!1,recordInitialRequests:!1,recordPerformance:!1,performanceEntryTypeToObserve:["first-input","navigation","paint","resource"],payloadSizeLimitBytes:1e6,payloadHostDenyList:[".lr-ingest.io",".ingest.sentry.io",".clarity.ms","analytics.google.com"]},yQe=["authorization","x-forwarded-for","authorization","cookie","set-cookie","x-api-key","x-real-ip","remote-addr","forwarded","proxy-authorization","x-csrf-token","x-csrftoken","x-xsrf-token"],xQe=["password","secret","passwd","api_key","apikey","auth","credentials","mysql_pwd","privatekey","private_key","token"],SQe=["/s/","/e/","/i/"];function Qq(e,t,n,r){if(jr(e))return e;var i=t?.["content-length"]||function(s){return new Blob([s]).size}(e);return ks(i)&&(i=parseInt(i)),i>n?HX+" ".concat(r," body too large to record (").concat(i," bytes)"):e}function Eq(e,t){if(jr(e))return e;var n=e;return pv(n,!1)||(n=HX+" "+t+" body "+KX),ni(xQe,r=>{var i,s;(i=n)!==null&&i!==void 0&&i.length&&((s=n)===null||s===void 0?void 0:s.indexOf(r))!==-1&&(n=HX+" "+t+" body "+KX+" as might contain: "+r)}),n}var $Qe=(e,t)=>{var n,r,i,s={payloadSizeLimitBytes:y$.payloadSizeLimitBytes,performanceEntryTypeToObserve:[...y$.performanceEntryTypeToObserve],payloadHostDenyList:[...t.payloadHostDenyList||[],...y$.payloadHostDenyList]},a=e.session_recording.recordHeaders!==!1&&t.recordHeaders,o=e.session_recording.recordBody!==!1&&t.recordBody,l=e.capture_performance!==!1&&t.recordPerformance,c=(n=s,i=Math.min(1e6,(r=n.payloadSizeLimitBytes)!==null&&r!==void 0?r:1e6),h=>(h!=null&&h.requestBody&&(h.requestBody=Qq(h.requestBody,h.requestHeaders,i,"Request")),h!=null&&h.responseBody&&(h.responseBody=Qq(h.responseBody,h.responseHeaders,i,"Response")),h)),u=h=>{return c(((g,m)=>{var v,b=D0(g.name),y=m.indexOf("http")===0?(v=D0(m))===null||v===void 0?void 0:v.pathname:m;y==="/"&&(y="");var T=b?.pathname.replace(y||"","");if(!(b&&T&&SQe.some(x=>T.indexOf(x)===0)))return g})((p=(f=h).requestHeaders,jr(p)||ni(Object.keys(p??{}),g=>{yQe.includes(g.toLowerCase())&&(p[g]=KX)}),f),e.api_host));var f,p},d=Bc(e.session_recording.maskNetworkRequestFn);return d&&Bc(e.session_recording.maskCapturedNetworkRequestFn)&&ln.warn("Both `maskNetworkRequestFn` and `maskCapturedNetworkRequestFn` are defined. `maskNetworkRequestFn` will be ignored."),d&&(e.session_recording.maskCapturedNetworkRequestFn=h=>{var f=e.session_recording.maskNetworkRequestFn({url:h.name});return Be(Be({},h),{},{name:f?.url})}),s.maskRequestFn=Bc(e.session_recording.maskCapturedNetworkRequestFn)?h=>{var f,p,g,m=u(h);return m&&(f=(p=(g=e.session_recording).maskCapturedNetworkRequestFn)===null||p===void 0?void 0:p.call(g,m))!==null&&f!==void 0?f:void 0}:h=>function(f){if(!Mt(f))return f.requestBody=Eq(f.requestBody,"Request"),f.responseBody=Eq(f.responseBody,"Response"),f}(u(h)),Be(Be(Be({},y$),s),{},{recordHeaders:a,recordBody:o,recordPerformance:l,recordInitialRequests:l})};function nc(e,t,n,r,i){return t>n&&(ln.warn("min cannot be greater than max."),t=n),co(e)?e>n?(r&&ln.warn(r+" cannot be greater than max: "+n+". Using max value instead."),n):e<t?(r&&ln.warn(r+" cannot be less than min: "+t+". Using min value instead."),t):e:(r&&ln.warn(r+" must be a number. using max or fallback. max: "+n+", fallback: "+i),nc(i||n,t,n,r))}let kQe=class{constructor(t){var n,r,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};kt(this,"bucketSize",100),kt(this,"refillRate",10),kt(this,"mutationBuckets",{}),kt(this,"loggedTracker",{}),kt(this,"refillBuckets",()=>{Object.keys(this.mutationBuckets).forEach(s=>{this.mutationBuckets[s]=this.mutationBuckets[s]+this.refillRate,this.mutationBuckets[s]>=this.bucketSize&&delete this.mutationBuckets[s]})}),kt(this,"getNodeOrRelevantParent",s=>{var a=this.rrweb.mirror.getNode(s);if(a?.nodeName!=="svg"&&a instanceof Element){var o=a.closest("svg");if(o)return[this.rrweb.mirror.getId(o),o]}return[s,a]}),kt(this,"numberOfChanges",s=>{var a,o,l,c,u,d,h,f;return((a=(o=s.removes)===null||o===void 0?void 0:o.length)!==null&&a!==void 0?a:0)+((l=(c=s.attributes)===null||c===void 0?void 0:c.length)!==null&&l!==void 0?l:0)+((u=(d=s.texts)===null||d===void 0?void 0:d.length)!==null&&u!==void 0?u:0)+((h=(f=s.adds)===null||f===void 0?void 0:f.length)!==null&&h!==void 0?h:0)}),kt(this,"throttleMutations",s=>{if(s.type!==3||s.data.source!==0)return s;var a=s.data,o=this.numberOfChanges(a);a.attributes&&(a.attributes=a.attributes.filter(c=>{var u,d,h,[f,p]=this.getNodeOrRelevantParent(c.id);return this.mutationBuckets[f]===0?!1:(this.mutationBuckets[f]=(u=this.mutationBuckets[f])!==null&&u!==void 0?u:this.bucketSize,this.mutationBuckets[f]=Math.max(this.mutationBuckets[f]-1,0),this.mutationBuckets[f]===0&&(this.loggedTracker[f]||(this.loggedTracker[f]=!0,(d=(h=this.options).onBlockedNode)===null||d===void 0||d.call(h,f,p))),c)}));var l=this.numberOfChanges(a);return l!==0||o===l?s:void 0}),this.rrweb=t,this.options=i,this.refillRate=nc((n=this.options.refillRate)!==null&&n!==void 0?n:this.refillRate,0,100,"mutation throttling refill rate"),this.bucketSize=nc((r=this.options.bucketSize)!==null&&r!==void 0?r:this.bucketSize,0,100,"mutation throttling bucket size"),setInterval(()=>{this.refillBuckets()},1e3)}};var uc=Uint8Array,Mo=Uint16Array,gv=Uint32Array,GF=new uc([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),VF=new uc([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),Rq=new uc([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Qae=function(e,t){for(var n=new Mo(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];var i=new gv(n[30]);for(r=1;r<30;++r)for(var s=n[r];s<n[r+1];++s)i[s]=s-n[r]<<5|r;return[n,i]},Eae=Qae(GF,2),TQe=Eae[0],JX=Eae[1];TQe[28]=258,JX[258]=28;for(var Aq=Qae(VF,0)[1],Rae=new Mo(32768),vi=0;vi<32768;++vi){var ip=(43690&vi)>>>1|(21845&vi)<<1;ip=(61680&(ip=(52428&ip)>>>2|(13107&ip)<<2))>>>4|(3855&ip)<<4,Rae[vi]=((65280&ip)>>>8|(255&ip)<<8)>>>1}var ww=function(e,t,n){for(var r=e.length,i=0,s=new Mo(t);i<r;++i)++s[e[i]-1];var a,o=new Mo(t);for(i=0;i<t;++i)o[i]=o[i-1]+s[i-1]<<1;for(a=new Mo(r),i=0;i<r;++i)a[i]=Rae[o[e[i]-1]++]>>>15-e[i];return a},gg=new uc(288);for(vi=0;vi<144;++vi)gg[vi]=8;for(vi=144;vi<256;++vi)gg[vi]=9;for(vi=256;vi<280;++vi)gg[vi]=7;for(vi=280;vi<288;++vi)gg[vi]=8;var eP=new uc(32);for(vi=0;vi<32;++vi)eP[vi]=5;var PQe=ww(gg,9),_Qe=ww(eP,5),Aae=function(e){return(e/8>>0)+(7&e&&1)},Xae=function(e,t,n){(n==null||n>e.length)&&(n=e.length);var r=new(e instanceof Mo?Mo:e instanceof gv?gv:uc)(n-t);return r.set(e.subarray(t,n)),r},Dd=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8},G1=function(e,t,n){n<<=7&t;var r=t/8>>0;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},a5=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,s=n.slice();if(!i)return[new uc(0),0];if(i==1){var a=new uc(n[0].s+1);return a[n[0].s]=1,[a,1]}n.sort(function(x,S){return x.f-S.f}),n.push({s:-1,f:25001});var o=n[0],l=n[1],c=0,u=1,d=2;for(n[0]={s:-1,f:o.f+l.f,l:o,r:l};u!=i-1;)o=n[n[c].f<n[d].f?c++:d++],l=n[c!=u&&n[c].f<n[d].f?c++:d++],n[u++]={s:-1,f:o.f+l.f,l:o,r:l};var h=s[0].s;for(r=1;r<i;++r)s[r].s>h&&(h=s[r].s);var f=new Mo(h+1),p=e6(n[u-1],f,0);if(p>t){r=0;var g=0,m=p-t,v=1<<m;for(s.sort(function(x,S){return f[S.s]-f[x.s]||x.f-S.f});r<i;++r){var b=s[r].s;if(!(f[b]>t))break;g+=v-(1<<p-f[b]),f[b]=t}for(g>>>=m;g>0;){var y=s[r].s;f[y]<t?g-=1<<t-f[y]++-1:++r}for(;r>=0&&g;--r){var T=s[r].s;f[T]==t&&(--f[T],++g)}p=t}return[new uc(f),p]},e6=function(e,t,n){return e.s==-1?Math.max(e6(e.l,t,n+1),e6(e.r,t,n+1)):t[e.s]=n},Xq=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Mo(++t),r=0,i=e[0],s=1,a=function(l){n[r++]=l},o=1;o<=t;++o)if(e[o]==i&&o!=t)++s;else{if(!i&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(i),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(i);s=1,i=e[o]}return[n.subarray(0,r),t]},V1=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},t6=function(e,t,n){var r=n.length,i=Aae(t+2);e[i]=255&r,e[i+1]=r>>>8,e[i+2]=255^e[i],e[i+3]=255^e[i+1];for(var s=0;s<r;++s)e[i+s+4]=n[s];return 8*(i+4+r)},Dq=function(e,t,n,r,i,s,a,o,l,c,u){Dd(t,u++,n),++i[256];for(var d=a5(i,15),h=d[0],f=d[1],p=a5(s,15),g=p[0],m=p[1],v=Xq(h),b=v[0],y=v[1],T=Xq(g),x=T[0],S=T[1],k=new Mo(19),Q=0;Q<b.length;++Q)k[31&b[Q]]++;for(Q=0;Q<x.length;++Q)k[31&x[Q]]++;for(var C=a5(k,7),_=C[0],R=C[1],A=19;A>4&&!_[Rq[A-1]];--A);var I,W,G,U,q=c+5<<3,B=V1(i,gg)+V1(s,eP)+a,j=V1(i,h)+V1(s,g)+a+14+3*A+V1(k,_)+(2*k[16]+3*k[17]+7*k[18]);if(q<=B&&q<=j)return t6(t,u,e.subarray(l,l+c));if(Dd(t,u,1+(j<B)),u+=2,j<B){I=ww(h,f),W=h,G=ww(g,m),U=g;var M=ww(_,R);for(Dd(t,u,y-257),Dd(t,u+5,S-1),Dd(t,u+10,A-4),u+=14,Q=0;Q<A;++Q)Dd(t,u+3*Q,_[Rq[Q]]);u+=3*A;for(var K=[b,x],F=0;F<2;++F){var X=K[F];for(Q=0;Q<X.length;++Q){var V=31&X[Q];Dd(t,u,M[V]),u+=_[V],V>15&&(Dd(t,u,X[Q]>>>5&127),u+=X[Q]>>>12)}}}else I=PQe,W=gg,G=_Qe,U=eP;for(Q=0;Q<o;++Q)if(r[Q]>255){V=r[Q]>>>18&31,G1(t,u,I[V+257]),u+=W[V+257],V>7&&(Dd(t,u,r[Q]>>>23&31),u+=GF[V]);var L=31&r[Q];G1(t,u,G[L]),u+=U[L],L>3&&(G1(t,u,r[Q]>>>5&8191),u+=VF[L])}else G1(t,u,I[r[Q]]),u+=W[r[Q]];return G1(t,u,I[256]),u+W[256]},CQe=new gv([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),QQe=function(){for(var e=new gv(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(1&n&&3988292384)^n>>>1;e[t]=n}return e}(),EQe=function(){var e=4294967295;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=QQe[255&n^t[r]]^n>>>8;e=n},d:function(){return 4294967295^e}}},RQe=function(e,t,n,r,i){return function(s,a,o,l,c,u){var d=s.length,h=new uc(l+d+5*(1+Math.floor(d/7e3))+c),f=h.subarray(l,h.length-c),p=0;if(!a||d<8)for(var g=0;g<=d;g+=65535){var m=g+65535;m<d?p=t6(f,p,s.subarray(g,m)):(f[g]=u,p=t6(f,p,s.subarray(g,d)))}else{for(var v=CQe[a-1],b=v>>>13,y=8191&v,T=(1<<o)-1,x=new Mo(32768),S=new Mo(T+1),k=Math.ceil(o/3),Q=2*k,C=function(Oe){return(s[Oe]^s[Oe+1]<<k^s[Oe+2]<<Q)&T},_=new gv(25e3),R=new Mo(288),A=new Mo(32),I=0,W=0,G=(g=0,0),U=0,q=0;g<d;++g){var B=C(g),j=32767&g,M=S[B];if(x[j]=M,S[B]=j,U<=g){var K=d-g;if((I>7e3||G>24576)&&K>423){p=Dq(s,f,0,_,R,A,W,G,q,g-q,p),G=I=W=0,q=g;for(var F=0;F<286;++F)R[F]=0;for(F=0;F<30;++F)A[F]=0}var X=2,V=0,L=y,H=j-M&32767;if(K>2&&B==C(g-H))for(var ue=Math.min(b,K)-1,ae=Math.min(32767,g),de=Math.min(258,K);H<=ae&&--L&&j!=M;){if(s[g+X]==s[g+X-H]){for(var ye=0;ye<de&&s[g+ye]==s[g+ye-H];++ye);if(ye>X){if(X=ye,V=H,ye>ue)break;var ve=Math.min(H,ye-2),ne=0;for(F=0;F<ve;++F){var Ie=g-H+F+32768&32767,Me=Ie-x[Ie]+32768&32767;Me>ne&&(ne=Me,M=Ie)}}}H+=(j=M)-(M=x[j])+32768&32767}if(V){_[G++]=268435456|JX[X]<<18|Aq[V];var nt=31&JX[X],Ge=31&Aq[V];W+=GF[nt]+VF[Ge],++R[257+nt],++A[Ge],U=g+X,++I}else _[G++]=s[g],++R[s[g]]}}p=Dq(s,f,u,_,R,A,W,G,q,g-q,p)}return Xae(h,0,l+Aae(p)+c)}(e,t.level==null?6:t.level,t.mem==null?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,n,r,!0)},n6=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},AQe=function(e,t){var n=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:t.level==9?2:0,e[9]=3,t.mtime!=0&&n6(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),n){e[3]=8;for(var r=0;r<=n.length;++r)e[r+10]=n.charCodeAt(r)}},XQe=function(e){return 10+(e.filename&&e.filename.length+1||0)};function Dae(e,t){t===void 0&&(t={});var n=EQe(),r=e.length;n.p(e);var i=RQe(e,t,XQe(t),8),s=i.length;return AQe(i,t),n6(i,s-8,n.d()),n6(i,s-4,r),i}function Iae(e,t){var n=e.length;if(typeof TextEncoder<"u")return new TextEncoder().encode(e);for(var r=new uc(e.length+(e.length>>>1)),i=0,s=function(c){r[i++]=c},a=0;a<n;++a){if(i+5>r.length){var o=new uc(i+8+(n-a<<1));o.set(r),r=o}var l=e.charCodeAt(a);l<128||t?s(l):l<2048?(s(192|l>>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++a))>>>18),s(128|l>>>12&63),s(128|l>>>6&63),s(128|63&l)):(s(224|l>>>12),s(128|l>>>6&63),s(128|63&l))}return Xae(r,0,i)}function DQe(e,t){return function(n){for(var r=0,i=0;i<n.length;i++)r=(r<<5)-r+n.charCodeAt(i),r|=0;return Math.abs(r)}(e)%100<nc(100*t,0,100)}var Zb="[SessionRecording]",xa=Va(Zb);function x$(){var e,t;return In==null||(e=In.__PosthogExtensions__)===null||e===void 0||(t=e.rrweb)===null||t===void 0?void 0:t.record}var IQe=3e5,NQe=[Fc.MouseMove,Fc.MouseInteraction,Fc.Scroll,Fc.ViewportResize,Fc.Input,Fc.TouchMove,Fc.MediaInteraction,Fc.Drag],Iq=e=>({rrwebMethod:e,enqueuedAt:Date.now(),attempt:1});function sp(e){return function(t,n){for(var r="",i=0;i<t.length;){var s=t[i++];r+=String.fromCharCode(s)}return r}(Dae(Iae(JSON.stringify(e))))}function Nq(e){return e.type===Yd.Custom&&e.data.tag==="sessionIdle"}function Fq(e,t){return t.some(n=>n.matching==="regex"&&new RegExp(n.url).test(e))}let FQe=class{get sessionIdleThresholdMilliseconds(){return this.instance.config.session_recording.session_idle_threshold_ms||3e5}get started(){return this._captureStarted}get sessionManager(){if(!this.instance.sessionManager)throw new Error(Zb+" must be started with a valid sessionManager.");return this.instance.sessionManager}get fullSnapshotIntervalMillis(){var t,n;return this.triggerStatus==="trigger_pending"?6e4:(t=(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.full_snapshot_interval_millis)!==null&&t!==void 0?t:IQe}get isSampled(){var t=this.instance.get_property(Yb);return lh(t)?t:null}get sessionDuration(){var t,n,r=(t=this.buffer)===null||t===void 0?void 0:t.data[((n=this.buffer)===null||n===void 0?void 0:n.data.length)-1],{sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return r?r.timestamp-i:null}get isRecordingEnabled(){var t=!!this.instance.get_property(MX),n=!this.instance.config.disable_session_recording;return qe&&t&&n}get isConsoleLogCaptureEnabled(){var t=!!this.instance.get_property(hq),n=this.instance.config.enable_recording_console_log;return n??t}get canvasRecording(){var t,n,r,i,s,a,o=this.instance.config.session_recording.captureCanvas,l=this.instance.get_property(pq),c=(t=(n=o?.recordCanvas)!==null&&n!==void 0?n:l?.enabled)!==null&&t!==void 0&&t,u=(r=(i=o?.canvasFps)!==null&&i!==void 0?i:l?.fps)!==null&&r!==void 0?r:4,d=(s=(a=o?.canvasQuality)!==null&&a!==void 0?a:l?.quality)!==null&&s!==void 0?s:.4;if(typeof d=="string"){var h=parseFloat(d);d=isNaN(h)?.4:h}return{enabled:c,fps:nc(u,0,12,"canvas recording fps",4),quality:nc(d,0,1,"canvas recording quality",.4)}}get networkPayloadCapture(){var t,n,r=this.instance.get_property(fq),i={recordHeaders:(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.recordHeaders,recordBody:(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.recordBody},s=i?.recordHeaders||r?.recordHeaders,a=i?.recordBody||r?.recordBody,o=Zi(this.instance.config.capture_performance)?this.instance.config.capture_performance.network_timing:this.instance.config.capture_performance,l=!!(lh(o)?o:r?.capturePerformance);return s||a||l?{recordHeaders:s,recordBody:a,recordPerformance:l}:void 0}get masking(){var t,n,r,i,s,a,o=this.instance.get_property(Oq),l={maskAllInputs:(t=this.instance.config.session_recording)===null||t===void 0?void 0:t.maskAllInputs,maskTextSelector:(n=this.instance.config.session_recording)===null||n===void 0?void 0:n.maskTextSelector,blockSelector:(r=this.instance.config.session_recording)===null||r===void 0?void 0:r.blockSelector},c=(i=l?.maskAllInputs)!==null&&i!==void 0?i:o?.maskAllInputs,u=(s=l?.maskTextSelector)!==null&&s!==void 0?s:o?.maskTextSelector,d=(a=l?.blockSelector)!==null&&a!==void 0?a:o?.blockSelector;return Mt(c)&&Mt(u)&&Mt(d)?void 0:{maskAllInputs:c==null||c,maskTextSelector:u,blockSelector:d}}get sampleRate(){var t=this.instance.get_property(gq);return co(t)?t:null}get minimumDuration(){var t=this.instance.get_property(mq);return co(t)?t:null}get status(){return this.receivedDecide?this.isRecordingEnabled?this.isSampled===!1?"disabled":this._urlBlocked?"paused":jr(this._linkedFlag)||this._linkedFlagSeen?this.triggerStatus==="trigger_pending"?"buffering":lh(this.isSampled)?this.isSampled?"sampled":"disabled":"active":"buffering":"disabled":"buffering"}get urlTriggerStatus(){var t;return this._urlTriggers.length===0?"trigger_disabled":((t=this.instance)===null||t===void 0?void 0:t.get_property(BE))===this.sessionId?"trigger_activated":"trigger_pending"}get eventTriggerStatus(){var t;return this._eventTriggers.length===0?"trigger_disabled":((t=this.instance)===null||t===void 0?void 0:t.get_property(ZE))===this.sessionId?"trigger_activated":"trigger_pending"}get triggerStatus(){var t=this.eventTriggerStatus==="trigger_activated"||this.urlTriggerStatus==="trigger_activated",n=this.eventTriggerStatus==="trigger_pending"||this.urlTriggerStatus==="trigger_pending";return t?"trigger_activated":n?"trigger_pending":"trigger_disabled"}constructor(t){if(kt(this,"queuedRRWebEvents",[]),kt(this,"isIdle","unknown"),kt(this,"_linkedFlagSeen",!1),kt(this,"_lastActivityTimestamp",Date.now()),kt(this,"_linkedFlag",null),kt(this,"_removePageViewCaptureHook",void 0),kt(this,"_onSessionIdListener",void 0),kt(this,"_persistDecideOnSessionListener",void 0),kt(this,"_samplingSessionListener",void 0),kt(this,"_urlTriggers",[]),kt(this,"_urlBlocklist",[]),kt(this,"_urlBlocked",!1),kt(this,"_eventTriggers",[]),kt(this,"_removeEventTriggerCaptureHook",void 0),kt(this,"_forceAllowLocalhostNetworkCapture",!1),kt(this,"_onBeforeUnload",()=>{this._flushBuffer()}),kt(this,"_onOffline",()=>{this._tryAddCustomEvent("browser offline",{})}),kt(this,"_onOnline",()=>{this._tryAddCustomEvent("browser online",{})}),kt(this,"_onVisibilityChange",()=>{if(Bt!=null&&Bt.visibilityState){var i="window "+Bt.visibilityState;this._tryAddCustomEvent(i,{})}}),this.instance=t,this._captureStarted=!1,this._endpoint="/s/",this.stopRrweb=void 0,this.receivedDecide=!1,!this.instance.sessionManager)throw xa.error("started without valid sessionManager"),new Error(Zb+" started without valid sessionManager. This is a bug.");if(this.instance.config.__preview_experimental_cookieless_mode)throw new Error(Zb+" cannot be used with __preview_experimental_cookieless_mode.");var{sessionId:n,windowId:r}=this.sessionManager.checkAndGetSessionAndWindowId();this.sessionId=n,this.windowId=r,this.buffer=this.clearBuffer(),this.sessionIdleThresholdMilliseconds>=this.sessionManager.sessionTimeoutMs&&xa.warn("session_idle_threshold_ms (".concat(this.sessionIdleThresholdMilliseconds,") is greater than the session timeout (").concat(this.sessionManager.sessionTimeoutMs,"). Session will never be detected as idle"))}startIfEnabledOrStop(t){this.isRecordingEnabled?(this._startCapture(t),os(qe,"beforeunload",this._onBeforeUnload),os(qe,"offline",this._onOffline),os(qe,"online",this._onOnline),os(qe,"visibilitychange",this._onVisibilityChange),this._setupSampling(),this._addEventTriggerListener(),jr(this._removePageViewCaptureHook)&&(this._removePageViewCaptureHook=this.instance.on("eventCaptured",n=>{try{if(n.event==="$pageview"){var r=n!=null&&n.properties.$current_url?this._maskUrl(n?.properties.$current_url):"";if(!r)return;this._tryAddCustomEvent("$pageview",{href:r})}}catch(i){xa.error("Could not add $pageview to rrweb session",i)}})),this._onSessionIdListener||(this._onSessionIdListener=this.sessionManager.onSessionId((n,r,i)=>{var s,a,o,l;i&&(this._tryAddCustomEvent("$session_id_change",{sessionId:n,windowId:r,changeReason:i}),(s=this.instance)===null||s===void 0||(a=s.persistence)===null||a===void 0||a.unregister(ZE),(o=this.instance)===null||o===void 0||(l=o.persistence)===null||l===void 0||l.unregister(BE))}))):this.stopRecording()}stopRecording(){var t,n,r,i;this._captureStarted&&this.stopRrweb&&(this.stopRrweb(),this.stopRrweb=void 0,this._captureStarted=!1,qe?.removeEventListener("beforeunload",this._onBeforeUnload),qe?.removeEventListener("offline",this._onOffline),qe?.removeEventListener("online",this._onOnline),qe?.removeEventListener("visibilitychange",this._onVisibilityChange),this.clearBuffer(),clearInterval(this._fullSnapshotTimer),(t=this._removePageViewCaptureHook)===null||t===void 0||t.call(this),this._removePageViewCaptureHook=void 0,(n=this._removeEventTriggerCaptureHook)===null||n===void 0||n.call(this),this._removeEventTriggerCaptureHook=void 0,(r=this._onSessionIdListener)===null||r===void 0||r.call(this),this._onSessionIdListener=void 0,(i=this._samplingSessionListener)===null||i===void 0||i.call(this),this._samplingSessionListener=void 0,xa.info("stopped"))}_resetSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.unregister(Yb)}makeSamplingDecision(t){var n,r=this.sessionId!==t,i=this.sampleRate;if(co(i)){var s=this.isSampled,a=r||!lh(s),o=a?DQe(t,i):s;a&&(o?this._reportStarted("sampled"):xa.warn("Sample rate (".concat(i,") has determined that this sessionId (").concat(t,") will not be sent to the server.")),this._tryAddCustomEvent("samplingDecisionMade",{sampleRate:i,isSampled:o})),(n=this.instance.persistence)===null||n===void 0||n.register({[Yb]:o})}else this._resetSampling()}onRemoteConfig(t){var n,r,i,s,a,o;if(this._tryAddCustomEvent("$remote_config_received",t),this._persistRemoteConfig(t),this._linkedFlag=((n=t.sessionRecording)===null||n===void 0?void 0:n.linkedFlag)||null,(r=t.sessionRecording)!==null&&r!==void 0&&r.endpoint&&(this._endpoint=(o=t.sessionRecording)===null||o===void 0?void 0:o.endpoint),this._setupSampling(),!jr(this._linkedFlag)&&!this._linkedFlagSeen){var l=ks(this._linkedFlag)?this._linkedFlag:this._linkedFlag.flag,c=ks(this._linkedFlag)?null:this._linkedFlag.variant;this.instance.onFeatureFlags((u,d)=>{var h=Zi(d)&&l in d,f=c?d[l]===c:h;f&&this._reportStarted("linked_flag_matched",{linkedFlag:l,linkedVariant:c}),this._linkedFlagSeen=f})}(i=t.sessionRecording)!==null&&i!==void 0&&i.urlTriggers&&(this._urlTriggers=t.sessionRecording.urlTriggers),(s=t.sessionRecording)!==null&&s!==void 0&&s.urlBlocklist&&(this._urlBlocklist=t.sessionRecording.urlBlocklist),(a=t.sessionRecording)!==null&&a!==void 0&&a.eventTriggers&&(this._eventTriggers=t.sessionRecording.eventTriggers),this.receivedDecide=!0,this.startIfEnabledOrStop()}_setupSampling(){co(this.sampleRate)&&jr(this._samplingSessionListener)&&(this._samplingSessionListener=this.sessionManager.onSessionId(t=>{this.makeSamplingDecision(t)}))}_persistRemoteConfig(t){if(this.instance.persistence){var n,r=this.instance.persistence,i=()=>{var s,a,o,l,c,u,d,h,f,p=(s=t.sessionRecording)===null||s===void 0?void 0:s.sampleRate,g=jr(p)?null:parseFloat(p);jr(g)&&this._resetSampling();var m=(a=t.sessionRecording)===null||a===void 0?void 0:a.minimumDurationMilliseconds;r.register({[MX]:!!t.sessionRecording,[hq]:(o=t.sessionRecording)===null||o===void 0?void 0:o.consoleLogRecordingEnabled,[fq]:Be({capturePerformance:t.capturePerformance},(l=t.sessionRecording)===null||l===void 0?void 0:l.networkPayloadCapture),[Oq]:(c=t.sessionRecording)===null||c===void 0?void 0:c.masking,[pq]:{enabled:(u=t.sessionRecording)===null||u===void 0?void 0:u.recordCanvas,fps:(d=t.sessionRecording)===null||d===void 0?void 0:d.canvasFps,quality:(h=t.sessionRecording)===null||h===void 0?void 0:h.canvasQuality},[gq]:g,[mq]:Mt(m)?null:m,[vq]:(f=t.sessionRecording)===null||f===void 0?void 0:f.scriptConfig})};i(),(n=this._persistDecideOnSessionListener)===null||n===void 0||n.call(this),this._persistDecideOnSessionListener=this.sessionManager.onSessionId(i)}}log(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"log";(n=this.instance.sessionRecording)===null||n===void 0||n.onRRwebEmit({type:6,data:{plugin:"rrweb/console@1",payload:{level:r,trace:[],payload:[JSON.stringify(t)]}},timestamp:Date.now()})}_startCapture(t){if(!Mt(Object.assign)&&!Mt(Array.from)&&!(this._captureStarted||this.instance.config.disable_session_recording||this.instance.consent.isOptedOut())){var n,r;this._captureStarted=!0,this.sessionManager.checkAndGetSessionAndWindowId(),x$()?this._onScriptLoaded():(n=In.__PosthogExtensions__)===null||n===void 0||(r=n.loadExternalDependency)===null||r===void 0||r.call(n,this.instance,this.scriptName,i=>{if(i)return xa.error("could not load recorder",i);this._onScriptLoaded()}),xa.info("starting"),this.status==="active"&&this._reportStarted(t||"recording_initialized")}}get scriptName(){var t,n,r;return((t=this.instance)===null||t===void 0||(n=t.persistence)===null||n===void 0||(r=n.get_property(vq))===null||r===void 0?void 0:r.script)||"recorder"}isInteractiveEvent(t){var n;return t.type===3&&NQe.indexOf((n=t.data)===null||n===void 0?void 0:n.source)!==-1}_updateWindowAndSessionIds(t){var n=this.isInteractiveEvent(t);n||this.isIdle||t.timestamp-this._lastActivityTimestamp>this.sessionIdleThresholdMilliseconds&&(this.isIdle=!0,clearInterval(this._fullSnapshotTimer),this._tryAddCustomEvent("sessionIdle",{eventTimestamp:t.timestamp,lastActivityTimestamp:this._lastActivityTimestamp,threshold:this.sessionIdleThresholdMilliseconds,bufferLength:this.buffer.data.length,bufferSize:this.buffer.size}),this._flushBuffer());var r=!1;if(n&&(this._lastActivityTimestamp=t.timestamp,this.isIdle)){var i=this.isIdle==="unknown";this.isIdle=!1,i||(this._tryAddCustomEvent("sessionNoLongerIdle",{reason:"user activity",type:t.type}),r=!0)}if(!this.isIdle){var{windowId:s,sessionId:a}=this.sessionManager.checkAndGetSessionAndWindowId(!n,t.timestamp),o=this.sessionId!==a,l=this.windowId!==s;this.windowId=s,this.sessionId=a,o||l?(this.stopRecording(),this.startIfEnabledOrStop("session_id_changed")):r&&this._scheduleFullSnapshot()}}_tryRRWebMethod(t){try{return t.rrwebMethod(),!0}catch(n){return this.queuedRRWebEvents.length<10?this.queuedRRWebEvents.push({enqueuedAt:t.enqueuedAt||Date.now(),attempt:t.attempt++,rrwebMethod:t.rrwebMethod}):xa.warn("could not emit queued rrweb event.",n,t),!1}}_tryAddCustomEvent(t,n){return this._tryRRWebMethod(Iq(()=>x$().addCustomEvent(t,n)))}_tryTakeFullSnapshot(){return this._tryRRWebMethod(Iq(()=>x$().takeFullSnapshot()))}_onScriptLoaded(){var t,n,r,i,s={blockClass:"ph-no-capture",blockSelector:void 0,ignoreClass:"ph-ignore-input",maskTextClass:"ph-mask",maskTextSelector:void 0,maskTextFn:void 0,maskAllInputs:!0,maskInputOptions:{password:!0},maskInputFn:void 0,slimDOMOptions:{},collectFonts:!1,inlineStylesheet:!0,recordCrossOriginIframes:!1},a=this.instance.config.session_recording;for(var[o,l]of Object.entries(a||{}))o in s&&(o==="maskInputOptions"?s.maskInputOptions=Be({password:!0},l):s[o]=l);this.canvasRecording&&this.canvasRecording.enabled&&(s.recordCanvas=!0,s.sampling={canvas:this.canvasRecording.fps},s.dataURLOptions={type:"image/webp",quality:this.canvasRecording.quality}),this.masking&&(s.maskAllInputs=(n=this.masking.maskAllInputs)===null||n===void 0||n,s.maskTextSelector=(r=this.masking.maskTextSelector)!==null&&r!==void 0?r:void 0,s.blockSelector=(i=this.masking.blockSelector)!==null&&i!==void 0?i:void 0);var c=x$();if(c){this.mutationRateLimiter=(t=this.mutationRateLimiter)!==null&&t!==void 0?t:new kQe(c,{refillRate:this.instance.config.session_recording.__mutationRateLimiterRefillRate,bucketSize:this.instance.config.session_recording.__mutationRateLimiterBucketSize,onBlockedNode:(d,h)=>{var f="Too many mutations on node '".concat(d,"'. Rate limiting. This could be due to SVG animations or something similar");xa.info(f,{node:h}),this.log(Zb+" "+f,"warn")}});var u=this._gatherRRWebPlugins();this.stopRrweb=c(Be({emit:d=>{this.onRRwebEmit(d)},plugins:u},s)),this._lastActivityTimestamp=Date.now(),this.isIdle=lh(this.isIdle)?this.isIdle:"unknown",this._tryAddCustomEvent("$session_options",{sessionRecordingOptions:s,activePlugins:u.map(d=>d?.name)}),this._tryAddCustomEvent("$posthog_config",{config:this.instance.config})}else xa.error("onScriptLoaded was called but rrwebRecord is not available. This indicates something has gone wrong.")}_scheduleFullSnapshot(){if(this._fullSnapshotTimer&&clearInterval(this._fullSnapshotTimer),this.isIdle!==!0){var t=this.fullSnapshotIntervalMillis;t&&(this._fullSnapshotTimer=setInterval(()=>{this._tryTakeFullSnapshot()},t))}}_gatherRRWebPlugins(){var t,n,r,i,s=[],a=(t=In.__PosthogExtensions__)===null||t===void 0||(n=t.rrwebPlugins)===null||n===void 0?void 0:n.getRecordConsolePlugin;a&&this.isConsoleLogCaptureEnabled&&s.push(a());var o=(r=In.__PosthogExtensions__)===null||r===void 0||(i=r.rrwebPlugins)===null||i===void 0?void 0:i.getRecordNetworkPlugin;return this.networkPayloadCapture&&Bc(o)&&(!WCe.includes(location.hostname)||this._forceAllowLocalhostNetworkCapture?s.push(o($Qe(this.instance.config,this.networkPayloadCapture))):xa.info("NetworkCapture not started because we are on localhost.")),s}onRRwebEmit(t){var n;if(this._processQueuedEvents(),t&&Zi(t)){if(t.type===Yd.Meta){var r=this._maskUrl(t.data.href);if(this._lastHref=r,!r)return;t.data.href=r}else this._pageViewFallBack();if(this._checkUrlTriggerConditions(),!this._urlBlocked||function(d){return d.type===Yd.Custom&&d.data.tag==="recording paused"}(t)){t.type===Yd.FullSnapshot&&this._scheduleFullSnapshot(),t.type===Yd.FullSnapshot&&this.triggerStatus==="trigger_pending"&&this.clearBuffer();var i=this.mutationRateLimiter?this.mutationRateLimiter.throttleMutations(t):t;if(i){var s=function(d){var h=d;if(h&&Zi(h)&&h.type===6&&Zi(h.data)&&h.data.plugin==="rrweb/console@1"){h.data.payload.payload.length>10&&(h.data.payload.payload=h.data.payload.payload.slice(0,10),h.data.payload.payload.push("...[truncated]"));for(var f=[],p=0;p<h.data.payload.payload.length;p++)h.data.payload.payload[p]&&h.data.payload.payload[p].length>2e3?f.push(h.data.payload.payload[p].slice(0,2e3)+"...[truncated]"):f.push(h.data.payload.payload[p]);return h.data.payload.payload=f,d}return d}(i);if(this._updateWindowAndSessionIds(s),this.isIdle!==!0||Nq(s)){if(Nq(s)){var a=s.data.payload;if(a){var o=a.lastActivityTimestamp,l=a.threshold;s.timestamp=o+l}}var c=(n=this.instance.config.session_recording.compress_events)===null||n===void 0||n?function(d){if(J2(d)<1024)return d;try{if(d.type===Yd.FullSnapshot)return Be(Be({},d),{},{data:sp(d.data),cv:"2024-10"});if(d.type===Yd.IncrementalSnapshot&&d.data.source===Fc.Mutation)return Be(Be({},d),{},{cv:"2024-10",data:Be(Be({},d.data),{},{texts:sp(d.data.texts),attributes:sp(d.data.attributes),removes:sp(d.data.removes),adds:sp(d.data.adds)})});if(d.type===Yd.IncrementalSnapshot&&d.data.source===Fc.StyleSheetRule)return Be(Be({},d),{},{cv:"2024-10",data:Be(Be({},d.data),{},{adds:d.data.adds?sp(d.data.adds):void 0,removes:d.data.removes?sp(d.data.removes):void 0})})}catch(h){xa.error("could not compress event - will use uncompressed event",h)}return d}(s):s,u={$snapshot_bytes:J2(c),$snapshot_data:c,$session_id:this.sessionId,$window_id:this.windowId};this.status!=="disabled"?this._captureSnapshotBuffered(u):this.clearBuffer()}}}}}_pageViewFallBack(){if(!this.instance.config.capture_pageview&&qe){var t=this._maskUrl(qe.location.href);this._lastHref!==t&&(this._tryAddCustomEvent("$url_changed",{href:t}),this._lastHref=t)}}_processQueuedEvents(){if(this.queuedRRWebEvents.length){var t=[...this.queuedRRWebEvents];this.queuedRRWebEvents=[],t.forEach(n=>{Date.now()-n.enqueuedAt<=2e3&&this._tryRRWebMethod(n)})}}_maskUrl(t){var n=this.instance.config.session_recording;if(n.maskNetworkRequestFn){var r,i={url:t};return(r=i=n.maskNetworkRequestFn(i))===null||r===void 0?void 0:r.url}return t}clearBuffer(){return this.buffer={size:0,data:[],sessionId:this.sessionId,windowId:this.windowId},this.buffer}_flushBuffer(){this.flushBufferTimer&&(clearTimeout(this.flushBufferTimer),this.flushBufferTimer=void 0);var t=this.minimumDuration,n=this.sessionDuration,r=co(n)&&n>=0,i=co(t)&&r&&n<t;return this.status==="buffering"||this.status==="paused"||this.status==="disabled"||i?(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3),this.buffer):(this.buffer.data.length>0&&ZX(this.buffer).forEach(s=>{this._captureSnapshot({$snapshot_bytes:s.size,$snapshot_data:s.data,$session_id:s.sessionId,$window_id:s.windowId,$lib:"web",$lib_version:th.LIB_VERSION})}),this.clearBuffer())}_captureSnapshotBuffered(t){var n,r=2+(((n=this.buffer)===null||n===void 0?void 0:n.data.length)||0);!this.isIdle&&(this.buffer.size+t.$snapshot_bytes+r>943718.4||this.buffer.sessionId!==this.sessionId)&&(this.buffer=this._flushBuffer()),this.buffer.size+=t.$snapshot_bytes,this.buffer.data.push(t.$snapshot_data),this.flushBufferTimer||this.isIdle||(this.flushBufferTimer=setTimeout(()=>{this._flushBuffer()},2e3))}_captureSnapshot(t){this.instance.capture("$snapshot",t,{_url:this.instance.requestRouter.endpointFor("api",this._endpoint),_noTruncate:!0,_batchKey:"recordings",skip_client_rate_limiting:!0})}_checkUrlTriggerConditions(){if(qe!==void 0&&qe.location.href){var t=qe.location.href,n=this._urlBlocked,r=Fq(t,this._urlBlocklist);r&&!n?this._pauseRecording():!r&&n&&this._resumeRecording(),Fq(t,this._urlTriggers)&&this._activateTrigger("url")}}_activateTrigger(t){var n,r;this.triggerStatus==="trigger_pending"&&((n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0||r.register({[t==="url"?BE:ZE]:this.sessionId}),this._flushBuffer(),this._reportStarted(t+"_trigger_matched"))}_pauseRecording(){this._urlBlocked||(this._urlBlocked=!0,clearInterval(this._fullSnapshotTimer),xa.info("recording paused due to URL blocker"),this._tryAddCustomEvent("recording paused",{reason:"url blocker"}))}_resumeRecording(){this._urlBlocked&&(this._urlBlocked=!1,this._tryTakeFullSnapshot(),this._scheduleFullSnapshot(),this._tryAddCustomEvent("recording resumed",{reason:"left blocked url"}),xa.info("recording resumed"))}_addEventTriggerListener(){this._eventTriggers.length!==0&&jr(this._removeEventTriggerCaptureHook)&&(this._removeEventTriggerCaptureHook=this.instance.on("eventCaptured",t=>{try{this._eventTriggers.includes(t.event)&&this._activateTrigger("event")}catch(n){xa.error("Could not activate event trigger",n)}}))}overrideLinkedFlag(){this._linkedFlagSeen=!0,this._tryTakeFullSnapshot(),this._reportStarted("linked_flag_overridden")}overrideSampling(){var t;(t=this.instance.persistence)===null||t===void 0||t.register({[Yb]:!0}),this._tryTakeFullSnapshot(),this._reportStarted("sampling_overridden")}overrideTrigger(t){this._activateTrigger(t)}_reportStarted(t,n){this.instance.register_for_session({$session_recording_start_reason:t}),xa.info(t.replace("_"," "),n),or(["recording_initialized","session_id_changed"],t)||this._tryAddCustomEvent(t,n)}get sdkDebugProperties(){var{sessionStartTimestamp:t}=this.sessionManager.checkAndGetSessionAndWindowId(!0);return{$recording_status:this.status,$sdk_debug_replay_internal_buffer_length:this.buffer.data.length,$sdk_debug_replay_internal_buffer_size:this.buffer.size,$sdk_debug_current_session_duration:this.sessionDuration,$sdk_debug_session_start:t}}};var o5=Va("[SegmentIntegration]");function MQe(e,t){var n=e.config.segment;if(!n)return t();(function(r,i){var s=r.config.segment;if(!s)return i();var a=l=>{var c=()=>l.anonymousId()||Uf();r.config.get_device_id=c,l.id()&&(r.register({distinct_id:l.id(),$device_id:c()}),r.persistence.set_property(Vd,"identified")),i()},o=s.user();"then"in o&&Bc(o.then)?o.then(l=>a(l)):a(o)})(e,()=>{n.register((r=>{Promise&&Promise.resolve||o5.warn("This browser does not have Promise support, and can not use the segment integration");var i=(s,a)=>{var o;if(!a)return s;s.event.userId||s.event.anonymousId===r.get_distinct_id()||(o5.info("No userId set, resetting PostHog"),r.reset()),s.event.userId&&s.event.userId!==r.get_distinct_id()&&(o5.info("UserId set, identifying with PostHog"),r.identify(s.event.userId));var l=r._calculate_event_properties(a,(o=s.event.properties)!==null&&o!==void 0?o:{},new Date);return s.event.properties=Object.assign({},l,s.event.properties),s};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:s=>i(s,s.event.event),page:s=>i(s,"$pageview"),identify:s=>i(s,"$identify"),screen:s=>i(s,"$screen")}})(e)).then(()=>{t()})})}var Nae="posthog-js";function Fae(e){var{organization:t,projectId:n,prefix:r,severityAllowList:i=["error"]}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return s=>{var a,o,l,c,u;if(!(i==="*"||i.includes(s.level))||!e.__loaded)return s;s.tags||(s.tags={});var d=e.requestRouter.endpointFor("ui","/project/".concat(e.config.token,"/person/").concat(e.get_distinct_id()));s.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(s.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var h=((a=s.exception)===null||a===void 0?void 0:a.values)||[],f=h.map(g=>Be(Be({},g),{},{stacktrace:g.stacktrace?Be(Be({},g.stacktrace),{},{type:"raw",frames:(g.stacktrace.frames||[]).map(m=>Be(Be({},m),{},{platform:"web:javascript"}))}):void 0})),p={$exception_message:((o=h[0])===null||o===void 0?void 0:o.value)||s.message,$exception_type:(l=h[0])===null||l===void 0?void 0:l.type,$exception_personURL:d,$exception_level:s.level,$exception_list:f,$sentry_event_id:s.event_id,$sentry_exception:s.exception,$sentry_exception_message:((c=h[0])===null||c===void 0?void 0:c.value)||s.message,$sentry_exception_type:(u=h[0])===null||u===void 0?void 0:u.type,$sentry_tags:s.tags};return t&&n&&(p.$sentry_url=(r||"https://sentry.io/organizations/")+t+"/issues/?project="+n+"&query="+s.event_id),e.exceptions.sendExceptionEvent(p),s}}let zQe=class{constructor(t,n,r,i,s){this.name=Nae,this.setupOnce=function(a){a(Fae(t,{organization:n,projectId:r,prefix:i,severityAllowList:s}))}}};var Bd,LQe=qe!=null&&qe.location?K2(qe.location.hash,"__posthog")||K2(location.hash,"state"):null,Mq="_postHogToolbarParams",zq=Va("[Toolbar]");(function(e){e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED"})(Bd||(Bd={}));class qQe{constructor(t){this.instance=t}setToolbarState(t){In.ph_toolbar_state=t}getToolbarState(){var t;return(t=In.ph_toolbar_state)!==null&&t!==void 0?t:Bd.UNINITIALIZED}maybeLoadToolbar(){var t,n,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;if(!qe||!Bt)return!1;r=(t=r)!==null&&t!==void 0?t:qe.location,s=(n=s)!==null&&n!==void 0?n:qe.history;try{if(!i){try{qe.localStorage.setItem("test","test"),qe.localStorage.removeItem("test")}catch{return!1}i=qe?.localStorage}var a,o=LQe||K2(r.hash,"__posthog")||K2(r.hash,"state"),l=o?oq(()=>JSON.parse(atob(decodeURIComponent(o))))||oq(()=>JSON.parse(decodeURIComponent(o))):null;return l&&l.action==="ph_authorize"?((a=l).source="url",a&&Object.keys(a).length>0&&(l.desiredHash?r.hash=l.desiredHash:s?s.replaceState(s.state,"",r.pathname+r.search):r.hash="")):((a=JSON.parse(i.getItem(Mq)||"{}")).source="localstorage",delete a.userIntent),!(!a.token||this.instance.config.token!==a.token)&&(this.loadToolbar(a),!0)}catch{return!1}}_callLoadToolbar(t){var n=In.ph_load_toolbar||In.ph_load_editor;!jr(n)&&Bc(n)?n(t,this.instance):zq.warn("No toolbar load function found")}loadToolbar(t){var n=!(Bt==null||!Bt.getElementById(Oae));if(!qe||n)return!1;var r=this.instance.requestRouter.region==="custom"&&this.instance.config.advanced_disable_toolbar_metrics,i=Be(Be({token:this.instance.config.token},t),{},{apiURL:this.instance.requestRouter.endpointFor("ui")},r?{instrument:!1}:{});if(qe.localStorage.setItem(Mq,JSON.stringify(Be(Be({},i),{},{source:void 0}))),this.getToolbarState()===Bd.LOADED)this._callLoadToolbar(i);else if(this.getToolbarState()===Bd.UNINITIALIZED){var s,a;this.setToolbarState(Bd.LOADING),(s=In.__PosthogExtensions__)===null||s===void 0||(a=s.loadExternalDependency)===null||a===void 0||a.call(s,this.instance,"toolbar",o=>{if(o)return zq.error("[Toolbar] Failed to load",o),void this.setToolbarState(Bd.UNINITIALIZED);this.setToolbarState(Bd.LOADED),this._callLoadToolbar(i)}),os(qe,"turbolinks:load",()=>{this.setToolbarState(Bd.UNINITIALIZED),this.loadToolbar(i)})}return!0}_loadEditor(t){return this.loadToolbar(t)}maybeLoadEditor(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:void 0,n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:void 0,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:void 0;return this.maybeLoadToolbar(t,n,r)}}var UQe=Va("[TracingHeaders]");class WQe{constructor(t){kt(this,"_restoreXHRPatch",void 0),kt(this,"_restoreFetchPatch",void 0),kt(this,"_startCapturing",()=>{var n,r,i,s;Mt(this._restoreXHRPatch)&&((n=In.__PosthogExtensions__)===null||n===void 0||(r=n.tracingHeadersPatchFns)===null||r===void 0||r._patchXHR(this.instance.sessionManager)),Mt(this._restoreFetchPatch)&&((i=In.__PosthogExtensions__)===null||i===void 0||(s=i.tracingHeadersPatchFns)===null||s===void 0||s._patchFetch(this.instance.sessionManager))}),this.instance=t}_loadScript(t){var n,r,i;(n=In.__PosthogExtensions__)!==null&&n!==void 0&&n.tracingHeadersPatchFns&&t(),(r=In.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"tracing-headers",s=>{if(s)return UQe.error("failed to load script",s);t()})}startIfEnabledOrStop(){var t,n;this.instance.config.__add_tracing_headers?this._loadScript(this._startCapturing):((t=this._restoreXHRPatch)===null||t===void 0||t.call(this),(n=this._restoreFetchPatch)===null||n===void 0||n.call(this),this._restoreXHRPatch=void 0,this._restoreFetchPatch=void 0)}}var uf=Va("[Web Vitals]"),Lq=9e5;class jQe{constructor(t){var n;kt(this,"_enabledServerSide",!1),kt(this,"_initialized",!1),kt(this,"buffer",{url:void 0,metrics:[],firstMetricTimestamp:void 0}),kt(this,"_flushToCapture",()=>{clearTimeout(this._delayedFlushTimer),this.buffer.metrics.length!==0&&(this.instance.capture("$web_vitals",this.buffer.metrics.reduce((r,i)=>Be(Be({},r),{},{["$web_vitals_".concat(i.name,"_event")]:Be({},i),["$web_vitals_".concat(i.name,"_value")]:i.value}),{})),this.buffer={url:void 0,metrics:[],firstMetricTimestamp:void 0})}),kt(this,"_addToBuffer",r=>{var i,s=(i=this.instance.sessionManager)===null||i===void 0?void 0:i.checkAndGetSessionAndWindowId(!0);if(Mt(s))uf.error("Could not read session ID. Dropping metrics!");else{this.buffer=this.buffer||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var a=this._currentURL();Mt(a)||(jr(r?.name)||jr(r?.value)?uf.error("Invalid metric received",r):this._maxAllowedValue&&r.value>=this._maxAllowedValue?uf.error("Ignoring metric with value >= "+this._maxAllowedValue,r):(this.buffer.url!==a&&(this._flushToCapture(),this._delayedFlushTimer=setTimeout(this._flushToCapture,this.flushToCaptureTimeoutMs)),Mt(this.buffer.url)&&(this.buffer.url=a),this.buffer.firstMetricTimestamp=Mt(this.buffer.firstMetricTimestamp)?Date.now():this.buffer.firstMetricTimestamp,r.attribution&&r.attribution.interactionTargetElement&&(r.attribution.interactionTargetElement=void 0),this.buffer.metrics.push(Be(Be({},r),{},{$current_url:a,$session_id:s.sessionId,$window_id:s.windowId,timestamp:Date.now()})),this.buffer.metrics.length===this.allowedMetrics.length&&this._flushToCapture()))}}),kt(this,"_startCapturing",()=>{var r,i,s,a,o=In.__PosthogExtensions__;Mt(o)||Mt(o.postHogWebVitalsCallbacks)||({onLCP:r,onCLS:i,onFCP:s,onINP:a}=o.postHogWebVitalsCallbacks),r&&i&&s&&a?(this.allowedMetrics.indexOf("LCP")>-1&&r(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&i(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&s(this._addToBuffer.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&a(this._addToBuffer.bind(this)),this._initialized=!0):uf.error("web vitals callbacks not loaded - not starting")}),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[uq]),this.startIfEnabled()}get allowedMetrics(){var t,n,r=Zi(this.instance.config.capture_performance)?(t=this.instance.config.capture_performance)===null||t===void 0?void 0:t.web_vitals_allowed_metrics:void 0;return Mt(r)?((n=this.instance.persistence)===null||n===void 0?void 0:n.props[dq])||["CLS","FCP","INP","LCP"]:r}get flushToCaptureTimeoutMs(){return(Zi(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get _maxAllowedValue(){var t=Zi(this.instance.config.capture_performance)&&co(this.instance.config.capture_performance.__web_vitals_max_value)?this.instance.config.capture_performance.__web_vitals_max_value:Lq;return 0<t&&t<=6e4?Lq:t}get isEnabled(){var t=Ao?.protocol;if(t!=="http:"&&t!=="https:")return uf.info("Web Vitals are disabled on non-http/https protocols"),!1;var n=Zi(this.instance.config.capture_performance)?this.instance.config.capture_performance.web_vitals:lh(this.instance.config.capture_performance)?this.instance.config.capture_performance:void 0;return lh(n)?n:this._enabledServerSide}startIfEnabled(){this.isEnabled&&!this._initialized&&(uf.info("enabled, starting..."),this.loadScript(this._startCapturing))}onRemoteConfig(t){var n=Zi(t.capturePerformance)&&!!t.capturePerformance.web_vitals,r=Zi(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this.instance.persistence&&(this.instance.persistence.register({[uq]:n}),this.instance.persistence.register({[dq]:r})),this._enabledServerSide=n,this.startIfEnabled()}loadScript(t){var n,r,i;(n=In.__PosthogExtensions__)!==null&&n!==void 0&&n.postHogWebVitalsCallbacks&&t(),(r=In.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"web-vitals",s=>{s?uf.error("failed to load script",s):t()})}_currentURL(){var t=qe?qe.location.href:void 0;return t||uf.error("Could not determine current URL"),t}}var GQe=Va("[Heatmaps]");function qq(e){return Zi(e)&&"clientX"in e&&"clientY"in e&&co(e.clientX)&&co(e.clientY)}class VQe{constructor(t){var n;kt(this,"rageclicks",new kae),kt(this,"_enabledServerSide",!1),kt(this,"_initialized",!1),kt(this,"_flushInterval",null),this.instance=t,this._enabledServerSide=!((n=this.instance.persistence)===null||n===void 0||!n.props[FX])}get flushIntervalMilliseconds(){var t=5e3;return Zi(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(t=this.instance.config.capture_heatmaps.flush_interval_milliseconds),t}get isEnabled(){return Mt(this.instance.config.capture_heatmaps)?Mt(this.instance.config.enable_heatmaps)?this._enabledServerSide:this.instance.config.enable_heatmaps:this.instance.config.capture_heatmaps!==!1}startIfEnabled(){if(this.isEnabled){if(this._initialized)return;GQe.info("starting..."),this._setupListeners(),this._flushInterval=setInterval(this.flush.bind(this),this.flushIntervalMilliseconds)}else{var t,n;clearInterval((t=this._flushInterval)!==null&&t!==void 0?t:void 0),(n=this.deadClicksCapture)===null||n===void 0||n.stop(),this.getAndClearBuffer()}}onRemoteConfig(t){var n=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[FX]:n}),this._enabledServerSide=n,this.startIfEnabled()}getAndClearBuffer(){var t=this.buffer;return this.buffer=void 0,t}_onDeadClick(t){this._onClick(t.originalEvent,"deadclick")}_setupListeners(){qe&&Bt&&(os(qe,"beforeunload",this.flush.bind(this)),os(Bt,"click",t=>this._onClick(t||qe?.event),{capture:!0}),os(Bt,"mousemove",t=>this._onMouseMove(t||qe?.event),{capture:!0}),this.deadClicksCapture=new Pae(this.instance,aQe,this._onDeadClick.bind(this)),this.deadClicksCapture.startIfEnabled(),this._initialized=!0)}_getProperties(t,n){var r=this.instance.scrollManager.scrollY(),i=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),a=function(o,l,c){for(var u=o;u&&DC(u)&&!sO(u,"body");){if(u===c)return!1;if(or(l,qe?.getComputedStyle(u).position))return!0;u=bae(u)}return!1}(vae(t),["fixed","sticky"],s);return{x:t.clientX+(a?0:i),y:t.clientY+(a?0:r),target_fixed:a,type:n}}_onClick(t){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"click";if(!wq(t.target)&&qq(t)){var i=this._getProperties(t,r);(n=this.rageclicks)!==null&&n!==void 0&&n.isRageClick(t.clientX,t.clientY,new Date().getTime())&&this._capture(Be(Be({},i),{},{type:"rageclick"})),this._capture(i)}}_onMouseMove(t){!wq(t.target)&&qq(t)&&(clearTimeout(this._mouseMoveTimeout),this._mouseMoveTimeout=setTimeout(()=>{this._capture(this._getProperties(t,"mousemove"))},500))}_capture(t){if(qe){var n=qe.location.href;this.buffer=this.buffer||{},this.buffer[n]||(this.buffer[n]=[]),this.buffer[n].push(t)}}flush(){this.buffer&&!w0(this.buffer)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}let YQe=class{constructor(t){this._instance=t}doPageView(t,n){var r,i=this._previousPageViewProperties(t,n);return this._currentPageview={pathname:(r=qe?.location.pathname)!==null&&r!==void 0?r:"",pageViewId:n,timestamp:t},this._instance.scrollManager.resetContext(),i}doPageLeave(t){var n;return this._previousPageViewProperties(t,(n=this._currentPageview)===null||n===void 0?void 0:n.pageViewId)}doEvent(){var t;return{$pageview_id:(t=this._currentPageview)===null||t===void 0?void 0:t.pageViewId}}_previousPageViewProperties(t,n){var r=this._currentPageview;if(!r)return{$pageview_id:n};var i={$pageview_id:n,$prev_pageview_id:r.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:a,lastScrollY:o,maxScrollY:l,maxContentHeight:c,lastContentY:u,maxContentY:d}=s;if(!(Mt(a)||Mt(o)||Mt(l)||Mt(c)||Mt(u)||Mt(d))){a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u),d=Math.ceil(d);var h=a<=1?1:nc(o/a,0,1),f=a<=1?1:nc(l/a,0,1),p=c<=1?1:nc(u/c,0,1),g=c<=1?1:nc(d/c,0,1);i=ss(i,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:l,$prev_pageview_max_scroll_percentage:f,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:d,$prev_pageview_max_content_percentage:g})}}return r.pathname&&(i.$prev_pageview_pathname=r.pathname),r.timestamp&&(i.$prev_pageview_duration=(t.getTime()-r.timestamp.getTime())/1e3),i}},BQe=class{constructor(t){this.instance=t}sendExceptionEvent(t){this.instance.capture("$exception",t,{_noTruncate:!0,_batchKey:"exceptionEvent"})}};var dc="Mobile",tP="iOS",Bu="Android",_y="Tablet",Mae=Bu+" "+_y,zae="iPad",Lae="Apple",qae=Lae+" Watch",Cy="Safari",mv="BlackBerry",Uae="Samsung",Wae=Uae+"Browser",jae=Uae+" Internet",mg="Chrome",ZQe=mg+" OS",Gae=mg+" "+tP,YF="Internet Explorer",Vae=YF+" "+dc,BF="Opera",HQe=BF+" Mini",ZF="Edge",Yae="Microsoft "+ZF,I0="Firefox",Bae=I0+" "+tP,Qy="Nintendo",Ey="PlayStation",N0="Xbox",Zae=Bu+" "+dc,Hae=dc+" "+Cy,Hb="Windows",r6=Hb+" Phone",Uq="Nokia",i6="Ouya",Kae="Generic",KQe=Kae+" "+dc.toLowerCase(),Jae=Kae+" "+_y.toLowerCase(),s6="Konqueror",no="(\\d+(\\.\\d+)?)",l5=new RegExp("Version/"+no),JQe=new RegExp(N0,"i"),eEe=new RegExp(Ey+" \\w+","i"),tEe=new RegExp(Qy+" \\w+","i"),HF=new RegExp(mv+"|PlayBook|BB10","i"),nEe={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"},a6,rEe=(e,t)=>t&&or(t,Lae)||function(n){return or(n,Cy)&&!or(n,mg)&&!or(n,Bu)}(e),Wq=function(e,t){return t=t||"",or(e," OPR/")&&or(e,"Mini")?HQe:or(e," OPR/")?BF:HF.test(e)?mv:or(e,"IE"+dc)||or(e,"WPDesktop")?Vae:or(e,Wae)?jae:or(e,ZF)||or(e,"Edg/")?Yae:or(e,"FBIOS")?"Facebook "+dc:or(e,"UCWEB")||or(e,"UCBrowser")?"UC Browser":or(e,"CriOS")?Gae:or(e,"CrMo")||or(e,mg)?mg:or(e,Bu)&&or(e,Cy)?Zae:or(e,"FxiOS")?Bae:or(e.toLowerCase(),s6.toLowerCase())?s6:rEe(e,t)?or(e,dc)?Hae:Cy:or(e,I0)?I0:or(e,"MSIE")||or(e,"Trident/")?YF:or(e,"Gecko")?I0:""},iEe={[Vae]:[new RegExp("rv:"+no)],[Yae]:[new RegExp(ZF+"?\\/"+no)],[mg]:[new RegExp("("+mg+"|CrMo)\\/"+no)],[Gae]:[new RegExp("CriOS\\/"+no)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+no)],[Cy]:[l5],[Hae]:[l5],[BF]:[new RegExp("(Opera|OPR)\\/"+no)],[I0]:[new RegExp(I0+"\\/"+no)],[Bae]:[new RegExp("FxiOS\\/"+no)],[s6]:[new RegExp("Konqueror[:/]?"+no,"i")],[mv]:[new RegExp(mv+" "+no),l5],[Zae]:[new RegExp("android\\s"+no,"i")],[jae]:[new RegExp(Wae+"\\/"+no)],[YF]:[new RegExp("(rv:|MSIE )"+no)],Mozilla:[new RegExp("rv:"+no)]},jq=[[new RegExp(N0+"; "+N0+" (.*?)[);]","i"),e=>[N0,e&&e[1]||""]],[new RegExp(Qy,"i"),[Qy,""]],[new RegExp(Ey,"i"),[Ey,""]],[HF,[mv,""]],[new RegExp(Hb,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[r6,""];if(new RegExp(dc).test(t)&&!/IEMobile\b/.test(t))return[Hb+" "+dc,""];var n=/Windows NT ([0-9.]+)/i.exec(t);if(n&&n[1]){var r=n[1],i=nEe[r]||"";return/arm/i.test(t)&&(i="RT"),[Hb,i]}return[Hb,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[tP,t.join(".")]}return[tP,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=Mt(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Bu+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Bu+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[Bu,t.join(".")]}return[Bu,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var n=[e[1],e[2],e[3]||"0"];t[1]=n.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ZQe,""]],[/Linux|debian/i,["Linux",""]]],Gq=function(e){return tEe.test(e)?Qy:eEe.test(e)?Ey:JQe.test(e)?N0:new RegExp(i6,"i").test(e)?i6:new RegExp("("+r6+"|WPDesktop)","i").test(e)?r6:/iPad/.test(e)?zae:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?qae:HF.test(e)?mv:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Uq,"i").test(e)?Uq:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(dc).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Bu:Mae:Bu:new RegExp("(pda|"+dc+")","i").test(e)?KQe:new RegExp(_y,"i").test(e)&&!new RegExp(_y+" pc","i").test(e)?Jae:""},S$="https?://(.*)",XT=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","irclid","_kx"],sEe=QT(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],XT),c5="<masked>",_i={campaignParams:function(){var{customTrackedParams:e,maskPersonalDataProperties:t,customPersonalDataProperties:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!Bt)return{};var r=t?QT([],XT,n||[]):[];return this._campaignParamsFromUrl(HE(Bt.URL,r,c5),e)},_campaignParamsFromUrl:function(e,t){var n=sEe.concat(t||[]),r={};return ni(n,function(i){var s=H2(e,i);r[i]=s||null}),r},_searchEngine:function(e){return e?e.search(S$+"google.([^/?]*)")===0?"google":e.search(S$+"bing.com")===0?"bing":e.search(S$+"yahoo.com")===0?"yahoo":e.search(S$+"duckduckgo.com")===0?"duckduckgo":null:null},_searchInfoFromReferrer:function(e){var t=_i._searchEngine(e),n=t!="yahoo"?"q":"p",r={};if(!IO(t)){r.$search_engine=t;var i=Bt?H2(Bt.referrer,n):"";i.length&&(r.ph_keyword=i)}return r},searchInfo:function(){var e=Bt?.referrer;return e?this._searchInfoFromReferrer(e):{}},browser:Wq,browserVersion:function(e,t){var n=Wq(e,t),r=iEe[n];if(Mt(r))return null;for(var i=0;i<r.length;i++){var s=r[i],a=e.match(s);if(a)return parseFloat(a[a.length-2])}return null},browserLanguage:function(){return navigator.language||navigator.userLanguage},browserLanguagePrefix:function(){var e=this.browserLanguage();return typeof e=="string"?e.split("-")[0]:void 0},os:function(e){for(var t=0;t<jq.length;t++){var[n,r]=jq[t],i=n.exec(e),s=i&&(Bc(r)?r(i,e):r);if(s)return s}return["",""]},device:Gq,deviceType:function(e){var t=Gq(e);return t===zae||t===Mae||t==="Kobo"||t==="Kindle Fire"||t===Jae?_y:t===Qy||t===N0||t===Ey||t===i6?"Console":t===qae?"Wearable":t?dc:"Desktop"},referrer:function(){return Bt?.referrer||"$direct"},referringDomain:function(){var e;return Bt!=null&&Bt.referrer&&((e=D0(Bt.referrer))===null||e===void 0?void 0:e.host)||"$direct"},referrerInfo:function(){return{$referrer:this.referrer(),$referring_domain:this.referringDomain()}},personInfo:function(){var{maskPersonalDataProperties:e,customPersonalDataProperties:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e?QT([],XT,t||[]):[],r=Ao?.href.substring(0,1e3);return{r:this.referrer().substring(0,1e3),u:r?HE(r,n,c5):void 0}},personPropsFromInfo:function(e){var t,{r:n,u:r}=e,i={$referrer:n,$referring_domain:n==null?void 0:n=="$direct"?"$direct":(t=D0(n))===null||t===void 0?void 0:t.host};if(r){i.$current_url=r;var s=D0(r);i.$host=s?.host,i.$pathname=s?.pathname;var a=this._campaignParamsFromUrl(r);ss(i,a)}if(n){var o=this._searchInfoFromReferrer(n);ss(i,o)}return i},initialPersonPropsFromInfo:function(e){var t=this.personPropsFromInfo(e),n={};return ni(t,function(r,i){n["$initial_".concat(UF(i))]=r}),n},timezone:function(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return}},timezoneOffset:function(){try{return new Date().getTimezoneOffset()}catch{return}},properties:function(){var{maskPersonalDataProperties:e,customPersonalDataProperties:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!ys)return{};var n=e?QT([],XT,t||[]):[],[r,i]=_i.os(ys);return ss(Py({$os:r,$os_version:i,$browser:_i.browser(ys,navigator.vendor),$device:_i.device(ys),$device_type:_i.deviceType(ys),$timezone:_i.timezone(),$timezone_offset:_i.timezoneOffset()}),{$current_url:HE(Ao?.href,n,c5),$host:Ao?.host,$pathname:Ao?.pathname,$raw_user_agent:ys.length>1e3?ys.substring(0,997)+"...":ys,$browser_version:_i.browserVersion(ys,navigator.vendor),$browser_language:_i.browserLanguage(),$browser_language_prefix:_i.browserLanguagePrefix(),$screen_height:qe?.screen.height,$screen_width:qe?.screen.width,$viewport_height:qe?.innerHeight,$viewport_width:qe?.innerWidth,$lib:"web",$lib_version:th.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})},people_properties:function(){if(!ys)return{};var[e,t]=_i.os(ys);return ss(Py({$os:e,$os_version:t,$browser:_i.browser(ys,navigator.vendor)}),{$browser_version:_i.browserVersion(ys,navigator.vendor)})}},Au=Va("[FeatureFlags]"),u5="$active_feature_flags",Em="$override_feature_flags",Vq="$feature_flag_payloads",Y1="$override_feature_flag_payloads",Yq="$feature_flag_request_id",Bq=e=>{var t={};for(var[n,r]of ET(e||{}))r&&(t[n]=r);return t},aEe=e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(n=>{var r;return[n,(r=t[n].variant)!==null&&r!==void 0?r:t[n].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(n=>t[n].enabled).filter(n=>{var r;return(r=t[n].metadata)===null||r===void 0?void 0:r.payload}).map(n=>{var r;return[n,(r=t[n].metadata)===null||r===void 0?void 0:r.payload]}))):Au.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e};(function(e){e.FeatureFlags="feature_flags",e.Recordings="recordings"})(a6||(a6={}));class oEe{constructor(t){kt(this,"_override_warning",!1),kt(this,"_hasLoadedFlags",!1),kt(this,"_requestInFlight",!1),kt(this,"_reloadingDisabled",!1),kt(this,"_additionalReloadRequested",!1),kt(this,"_decideCalled",!1),kt(this,"_flagsLoadedFromRemote",!1),this.instance=t,this.featureFlagEventHandlers=[]}decide(){if(this.instance.config.__preview_remote_config)this._decideCalled=!0;else{var t=!this._reloadDebouncer&&(this.instance.config.advanced_disable_feature_flags||this.instance.config.advanced_disable_feature_flags_on_first_load);this._callDecideEndpoint({disableFlags:t})}}get hasLoadedFlags(){return this._hasLoadedFlags}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var t=this.instance.get_property(zX),n=this.instance.get_property(Em),r=this.instance.get_property(Y1);if(!r&&!n)return t||{};var i=ss({},t||{}),s=[...new Set([...Object.keys(r||{}),...Object.keys(n||{})])];for(var a of s){var o,l,c=i[a],u=n?.[a],d=Mt(u)?(o=c?.enabled)!==null&&o!==void 0&&o:!!u,h=Mt(u)?c.variant:typeof u=="string"?u:void 0,f=r?.[a],p=Be(Be({},c),{},{enabled:d,variant:d?h??c?.variant:void 0});d!==c?.enabled&&(p.original_enabled=c?.enabled),h!==c?.variant&&(p.original_variant=c?.variant),f&&(p.metadata=Be(Be({},c?.metadata),{},{payload:f,original_payload:c==null||(l=c.metadata)===null||l===void 0?void 0:l.payload})),i[a]=p}return this._override_warning||(Au.warn(" Overriding feature flag details!",{flagDetails:t,overriddenPayloads:r,finalDetails:i}),this._override_warning=!0),i}getFlagVariants(){var t=this.instance.get_property(y0),n=this.instance.get_property(Em);if(!n)return t||{};for(var r=ss({},t),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this._override_warning||(Au.warn(" Overriding feature flags!",{enabledFlags:t,overriddenFlags:n,finalFlags:r}),this._override_warning=!0),r}getFlagPayloads(){var t=this.instance.get_property(Vq),n=this.instance.get_property(Y1);if(!n)return t||{};for(var r=ss({},t||{}),i=Object.keys(n),s=0;s<i.length;s++)r[i[s]]=n[i[s]];return this._override_warning||(Au.warn(" Overriding feature flag payloads!",{flagPayloads:t,overriddenPayloads:n,finalPayloads:r}),this._override_warning=!0),r}reloadFeatureFlags(){this._reloadingDisabled||this.instance.config.advanced_disable_feature_flags||this._reloadDebouncer||(this._reloadDebouncer=setTimeout(()=>{this._callDecideEndpoint()},5))}clearDebouncer(){clearTimeout(this._reloadDebouncer),this._reloadDebouncer=void 0}ensureFlagsLoaded(){this._hasLoadedFlags||this._requestInFlight||this._reloadDebouncer||this.reloadFeatureFlags()}setAnonymousDistinctId(t){this.$anon_distinct_id=t}setReloadingPaused(t){this._reloadingDisabled=t}_callDecideEndpoint(t){var n;if(this.clearDebouncer(),!this.instance.config.advanced_disable_decide)if(this._requestInFlight)this._additionalReloadRequested=!0;else{var r={token:this.instance.config.token,distinct_id:this.instance.get_distinct_id(),groups:this.instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:Be(Be({},((n=this.instance.persistence)===null||n===void 0?void 0:n.get_initial_props())||{}),this.instance.get_property(Bb)||{}),group_properties:this.instance.get_property(xp)};(t!=null&&t.disableFlags||this.instance.config.advanced_disable_feature_flags)&&(r.disable_flags=!0);var i=this.instance.config.__preview_flags_v2&&this.instance.config.__preview_remote_config;i&&(r.timezone=_i.timezone()),this._requestInFlight=!0,this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api",i?"/flags/?v=2":"/decide/?v=4"),data:r,compression:this.instance.config.disable_compression?void 0:Uc.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:s=>{var a,o,l,c=!0;s.statusCode===200&&(this._additionalReloadRequested||(this.$anon_distinct_id=void 0),c=!1),this._requestInFlight=!1,this._decideCalled||(this._decideCalled=!0,this.instance._onRemoteConfig((l=s.json)!==null&&l!==void 0?l:{})),r.disable_flags&&!this._additionalReloadRequested||(this._flagsLoadedFromRemote=!c,s.json&&(a=s.json.quotaLimited)!==null&&a!==void 0&&a.includes(a6.FeatureFlags)?Au.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more."):(this.receivedFeatureFlags((o=s.json)!==null&&o!==void 0?o:{},c),this._additionalReloadRequested&&(this._additionalReloadRequested=!1,this._callDecideEndpoint())))}})}}getFeatureFlag(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0){var r=this.getFlagVariants()[t],i="".concat(r),s=this.instance.get_property(Yq)||void 0,a=this.instance.get_property(Y2)||{};if((n.send_event||!("send_event"in n))&&(!(t in a)||!a[t].includes(i))){var o,l,c,u,d,h,f,p,g,m,v;Bi(a[t])?a[t].push(i):a[t]=[i],(o=this.instance.persistence)===null||o===void 0||o.register({[Y2]:a});var b=this.getFeatureFlagDetails(t),y={$feature_flag:t,$feature_flag_response:r,$feature_flag_payload:this.getFeatureFlagPayload(t)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:((l=this.instance.config.bootstrap)===null||l===void 0||(c=l.featureFlags)===null||c===void 0?void 0:c[t])||null,$feature_flag_bootstrapped_payload:((u=this.instance.config.bootstrap)===null||u===void 0||(d=u.featureFlagPayloads)===null||d===void 0?void 0:d[t])||null,$used_bootstrap_value:!this._flagsLoadedFromRemote};Mt(b==null||(h=b.metadata)===null||h===void 0?void 0:h.version)||(y.$feature_flag_version=b.metadata.version);var T,x=(f=b==null||(p=b.reason)===null||p===void 0?void 0:p.description)!==null&&f!==void 0?f:b==null||(g=b.reason)===null||g===void 0?void 0:g.code;x&&(y.$feature_flag_reason=x),b!=null&&(m=b.metadata)!==null&&m!==void 0&&m.id&&(y.$feature_flag_id=b.metadata.id),Mt(b?.original_variant)&&Mt(b?.original_enabled)||(y.$feature_flag_original_response=Mt(b.original_variant)?b.original_enabled:b.original_variant),b!=null&&(v=b.metadata)!==null&&v!==void 0&&v.original_payload&&(y.$feature_flag_original_payload=b==null||(T=b.metadata)===null||T===void 0?void 0:T.original_payload),this.instance.capture("$feature_flag_called",y)}return r}Au.warn('getFeatureFlag for key "'+t+`" failed. Feature flags didn't load in time.`)}getFeatureFlagDetails(t){return this.getFlagsWithDetails()[t]}getFeatureFlagPayload(t){return this.getFlagPayloads()[t]}getRemoteConfigPayload(t,n){var r=this.instance.config.token;this.instance._send_request({method:"POST",url:this.instance.requestRouter.endpointFor("api","/decide/?v=4"),data:{distinct_id:this.instance.get_distinct_id(),token:r},compression:this.instance.config.disable_compression?void 0:Uc.Base64,timeout:this.instance.config.feature_flag_request_timeout_ms,callback:i=>{var s,a=(s=i.json)===null||s===void 0?void 0:s.featureFlagPayloads;n(a?.[t]||void 0)}})}isFeatureEnabled(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(this._hasLoadedFlags||this.getFlags()&&this.getFlags().length>0)return!!this.getFeatureFlag(t,n);Au.warn('isFeatureEnabled for key "'+t+`" failed. Feature flags didn't load in time.`)}addFeatureFlagsHandler(t){this.featureFlagEventHandlers.push(t)}removeFeatureFlagsHandler(t){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(n=>n!==t)}receivedFeatureFlags(t,n){if(this.instance.persistence){this._hasLoadedFlags=!0;var r=this.getFlagVariants(),i=this.getFlagPayloads(),s=this.getFlagsWithDetails();(function(a,o){var l=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},c=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},u=arguments.length>4&&arguments[4]!==void 0?arguments[4]:{},d=aEe(a),h=d.flags,f=d.featureFlags,p=d.featureFlagPayloads;if(f){var g=a.requestId;if(Bi(f)){Au.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var m={};if(f)for(var v=0;v<f.length;v++)m[f[v]]=!0;o&&o.register({[u5]:f,[y0]:m})}else{var b=f,y=p,T=h;a.errorsWhileComputingFlags&&(b=Be(Be({},l),b),y=Be(Be({},c),y),T=Be(Be({},u),T)),o&&o.register(Be({[u5]:Object.keys(Bq(b)),[y0]:b||{},[Vq]:y||{},[zX]:T||{}},g?{[Yq]:g}:{}))}}})(t,this.instance.persistence,r,i,s),this._fireFeatureFlagsCallbacks(n)}}override(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];Au.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:t,suppressWarning:n})}overrideFeatureFlags(t){if(!this.instance.__loaded||!this.instance.persistence)return Au.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(t===!1)return this.instance.persistence.unregister(Em),this.instance.persistence.unregister(Y1),void this._fireFeatureFlagsCallbacks();if(t&&typeof t=="object"&&("flags"in t||"payloads"in t)){var n,r=t;if(this._override_warning=!!((n=r.suppressWarning)!==null&&n!==void 0&&n),"flags"in r){if(r.flags===!1)this.instance.persistence.unregister(Em);else if(r.flags)if(Bi(r.flags)){for(var i={},s=0;s<r.flags.length;s++)i[r.flags[s]]=!0;this.instance.persistence.register({[Em]:i})}else this.instance.persistence.register({[Em]:r.flags})}return"payloads"in r&&(r.payloads===!1?this.instance.persistence.unregister(Y1):r.payloads&&this.instance.persistence.register({[Y1]:r.payloads})),void this._fireFeatureFlagsCallbacks()}this._fireFeatureFlagsCallbacks()}onFeatureFlags(t){if(this.addFeatureFlagsHandler(t),this._hasLoadedFlags){var{flags:n,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();t(n,r)}return()=>this.removeFeatureFlagsHandler(t)}updateEarlyAccessFeatureEnrollment(t,n){var r,i=(this.instance.get_property(RT)||[]).find(l=>l.flagKey===t),s={["$feature_enrollment/".concat(t)]:n},a={$feature_flag:t,$feature_enrollment:n,$set:s};i&&(a.$early_access_feature_name=i.name),this.instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(s,!1);var o=Be(Be({},this.getFlagVariants()),{},{[t]:n});(r=this.instance.persistence)===null||r===void 0||r.register({[u5]:Object.keys(Bq(o)),[y0]:o}),this._fireFeatureFlagsCallbacks()}getEarlyAccessFeatures(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1],r=arguments.length>2?arguments[2]:void 0,i=this.instance.get_property(RT),s=r?"&".concat(r.map(a=>"stage=".concat(a)).join("&")):"";if(i&&!n)return t(i);this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/early_access_features/?token=".concat(this.instance.config.token).concat(s)),method:"GET",callback:a=>{var o;if(a.json){var l=a.json.earlyAccessFeatures;return(o=this.instance.persistence)===null||o===void 0||o.register({[RT]:l}),t(l)}}})}_prepareFeatureFlagsForCallbacks(){var t=this.getFlags(),n=this.getFlagVariants();return{flags:t.filter(r=>n[r]),flagVariants:Object.keys(n).filter(r=>n[r]).reduce((r,i)=>(r[i]=n[i],r),{})}}_fireFeatureFlagsCallbacks(t){var{flags:n,flagVariants:r}=this._prepareFeatureFlagsForCallbacks();this.featureFlagEventHandlers.forEach(i=>i(n,r,{errorsLoading:t}))}setPersonPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(Bb)||{};this.instance.register({[Bb]:Be(Be({},r),t)}),n&&this.instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this.instance.unregister(Bb)}setGroupPropertiesForFlags(t){var n=!(arguments.length>1&&arguments[1]!==void 0)||arguments[1],r=this.instance.get_property(xp)||{};Object.keys(r).length!==0&&Object.keys(r).forEach(i=>{r[i]=Be(Be({},r[i]),t[i]),delete t[i]}),this.instance.register({[xp]:Be(Be({},r),t)}),n&&this.instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(t){if(t){var n=this.instance.get_property(xp)||{};this.instance.register({[xp]:Be(Be({},n),{},{[t]:{}})})}else this.instance.unregister(xp)}}var lEe=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class d5{constructor(t){this.config=t,this.props={},this.campaign_params_saved=!1,this.name=(n=>{var r="";return n.token&&(r=n.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),n.persistence_name?"ph_"+n.persistence_name:"ph_"+r+"_posthog"})(t),this.storage=this.buildStorage(t),this.load(),t.debug&&ln.info("Persistence loaded",t.persistence,Be({},this.props)),this.update_config(t,t),this.save()}buildStorage(t){lEe.indexOf(t.persistence.toLowerCase())===-1&&(ln.critical("Unknown persistence type "+t.persistence+"; falling back to localStorage+cookie"),t.persistence="localStorage+cookie");var n=t.persistence.toLowerCase();return n==="localstorage"&&Es.is_supported()?Es:n==="localstorage+cookie"&&m$.is_supported()?m$:n==="sessionstorage"&&ua.is_supported()?ua:n==="memory"?iQe:n==="cookie"?vh:m$.is_supported()?m$:vh}properties(){var t={};return ni(this.props,function(n,r){if(r===y0&&Zi(n))for(var i=Object.keys(n),s=0;s<i.length;s++)t["$feature/".concat(i[s])]=n[i[s]];else o=r,l=!1,(IO(a=ICe)?l:rq&&a.indexOf===rq?a.indexOf(o)!=-1:(ni(a,function(c){if(l||(l=c===o))return G2}),l))||(t[r]=n);var a,o,l}),t}load(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=ss({},t))}}save(){this.disabled||this.storage.set(this.name,this.props,this.expire_days,this.cross_subdomain,this.secure,this.config.debug)}remove(){this.storage.remove(this.name,!1),this.storage.remove(this.name,!0)}clear(){this.remove(),this.props={}}register_once(t,n,r){if(Zi(t)){Mt(n)&&(n="None"),this.expire_days=Mt(r)?this.default_expiry:r;var i=!1;if(ni(t,(s,a)=>{this.props.hasOwnProperty(a)&&this.props[a]!==n||(this.props[a]=s,i=!0)}),i)return this.save(),!0}return!1}register(t,n){if(Zi(t)){this.expire_days=Mt(n)?this.default_expiry:n;var r=!1;if(ni(t,(i,s)=>{t.hasOwnProperty(s)&&this.props[s]!==i&&(this.props[s]=i,r=!0)}),r)return this.save(),!0}return!1}unregister(t){t in this.props&&(delete this.props[t],this.save())}update_campaign_params(){if(!this.campaign_params_saved){var t=_i.campaignParams({customTrackedParams:this.config.custom_campaign_params,maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties});w0(Py(t))||this.register(t),this.campaign_params_saved=!0}}update_search_keyword(){this.register(_i.searchInfo())}update_referrer_info(){this.register_once(_i.referrerInfo(),void 0)}set_initial_person_info(){this.props[WX]||this.props[jX]||this.register_once({[GX]:_i.personInfo({maskPersonalDataProperties:this.config.mask_personal_data_properties,customPersonalDataProperties:this.config.custom_personal_data_properties})},void 0)}get_referrer_info(){return Py({$referrer:this.props.$referrer,$referring_domain:this.props.$referring_domain})}get_initial_props(){var t={};ni([jX,WX],i=>{var s=this.props[i];s&&ni(s,function(a,o){t["$initial_"+UF(o)]=a})});var n=this.props[GX];if(n){var r=_i.initialPersonPropsFromInfo(n);ss(t,r)}return t}safe_merge(t){return ni(this.props,function(n,r){r in t||(t[r]=n)}),t}update_config(t,n){if(this.default_expiry=this.expire_days=t.cookie_expiration,this.set_disabled(t.disable_persistence),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie),t.persistence!==n.persistence){var r=this.buildStorage(t),i=this.props;this.clear(),this.storage=r,this.props=i,this.save()}}set_disabled(t){this.disabled=t,this.disabled?this.remove():this.save()}set_cross_subdomain(t){t!==this.cross_subdomain&&(this.cross_subdomain=t,this.remove(),this.save())}get_cross_subdomain(){return!!this.cross_subdomain}set_secure(t){t!==this.secure&&(this.secure=t,this.remove(),this.save())}set_event_timer(t,n){var r=this.props[Vb]||{};r[t]=n,this.props[Vb]=r,this.save()}remove_event_timer(t){var n=(this.props[Vb]||{})[t];return Mt(n)||(delete this.props[Vb][t],this.save()),n}get_property(t){return this.props[t]}set_property(t,n){this.props[t]=n,this.save()}}var eoe,Hi,toe,_p,Zq,noe,o6,roe,Hq,l6,Kq,Jq,eU,tU,c6={},ioe=[],cEe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,KF=Array.isArray;function Wf(e,t){for(var n in t)e[n]=t[n];return e}function soe(e){var t=e.parentNode;t&&t.removeChild(e)}function h5(e,t,n,r,i){var s={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:i??++toe,__i:-1,__u:0};return i==null&&Hi.vnode!=null&&Hi.vnode(s),s}function JF(e){return e.children}function DT(e,t){this.props=e,this.context=t}function vv(e,t){if(t==null)return e.__?vv(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?vv(e):null}function aoe(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return aoe(e)}}function u6(e){(!e.__d&&(e.__d=!0)&&_p.push(e)&&!nP.__r++||Zq!==Hi.debounceRendering)&&((Zq=Hi.debounceRendering)||noe)(nP)}function nP(){var e,t,n,r,i,s,a,o,l;for(_p.sort(o6);e=_p.shift();)e.__d&&(t=_p.length,r=void 0,s=(i=(n=e).__v).__e,o=[],l=[],(a=n.__P)&&((r=Wf({},i)).__v=i.__v+1,Hi.vnode&&Hi.vnode(r),coe(a,r,i,n.__n,a.ownerSVGElement!==void 0,32&i.__u?[s]:null,o,s??vv(i),!!(32&i.__u),l),r.__.__k[r.__i]=r,hEe(o,r,l),r.__e!=s&&aoe(r)),_p.length>t&&_p.sort(o6));nP.__r=0}function ooe(e,t,n,r,i,s,a,o,l,c,u){var d,h,f,p,g,m=r&&r.__k||ioe,v=t.length;for(n.__d=l,uEe(n,t,m),l=n.__d,d=0;d<v;d++)(f=n.__k[d])!=null&&typeof f!="boolean"&&typeof f!="function"&&(h=f.__i===-1?c6:m[f.__i]||c6,f.__i=d,coe(e,f,h,i,s,a,o,l,c,u),p=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&e8(h.ref,null,f),u.push(f.ref,f.__c||p,f)),g==null&&p!=null&&(g=p),65536&f.__u||h.__k===f.__k?l=loe(f,l,e):typeof f.type=="function"&&f.__d!==void 0?l=f.__d:p&&(l=p.nextSibling),f.__d=void 0,f.__u&=-196609);n.__d=l,n.__e=g}function uEe(e,t,n){var r,i,s,a,o,l=t.length,c=n.length,u=c,d=0;for(e.__k=[],r=0;r<l;r++)(i=e.__k[r]=(i=t[r])==null||typeof i=="boolean"||typeof i=="function"?null:typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?h5(null,i,null,null,i):KF(i)?h5(JF,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?h5(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i)!=null?(i.__=e,i.__b=e.__b+1,o=dEe(i,n,a=r+d,u),i.__i=o,s=null,o!==-1&&(u--,(s=n[o])&&(s.__u|=131072)),s==null||s.__v===null?(o==-1&&d--,typeof i.type!="function"&&(i.__u|=65536)):o!==a&&(o===a+1?d++:o>a?u>l-a?d+=o-a:d--:d=o<a&&o==a-1?o-a:0,o!==r+d&&(i.__u|=65536))):(s=n[r])&&s.key==null&&s.__e&&(s.__e==e.__d&&(e.__d=vv(s)),d6(s,s,!1),n[r]=null,u--);if(u)for(r=0;r<c;r++)(s=n[r])!=null&&(131072&s.__u)==0&&(s.__e==e.__d&&(e.__d=vv(s)),d6(s,s))}function loe(e,t,n){var r,i;if(typeof e.type=="function"){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=loe(r[i],t,n));return t}return e.__e!=t&&(n.insertBefore(e.__e,t||null),t=e.__e),t&&t.nextSibling}function dEe(e,t,n,r){var i=e.key,s=e.type,a=n-1,o=n+1,l=t[n];if(l===null||l&&i==l.key&&s===l.type)return n;if(r>(l!=null&&(131072&l.__u)==0?1:0))for(;a>=0||o<t.length;){if(a>=0){if((l=t[a])&&(131072&l.__u)==0&&i==l.key&&s===l.type)return a;a--}if(o<t.length){if((l=t[o])&&(131072&l.__u)==0&&i==l.key&&s===l.type)return o;o++}}return-1}function nU(e,t,n){t[0]==="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||cEe.test(t)?n:n+"px"}function $$(e,t,n,r,i){var s;e:if(t==="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||nU(e.style,t,"");if(n)for(t in n)r&&n[t]===r[t]||nU(e.style,t,n[t])}else if(t[0]==="o"&&t[1]==="n")s=t!==(t=t.replace(/(PointerCapture)$|Capture$/,"$1")),t=t.toLowerCase()in e?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+s]=n,n?r?n.u=r.u:(n.u=Date.now(),e.addEventListener(t,s?iU:rU,s)):e.removeEventListener(t,s?iU:rU,s);else{if(i)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!=="width"&&t!=="height"&&t!=="href"&&t!=="list"&&t!=="form"&&t!=="tabIndex"&&t!=="download"&&t!=="rowSpan"&&t!=="colSpan"&&t!=="role"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!=="-"?e.removeAttribute(t):e.setAttribute(t,n))}}function rU(e){var t=this.l[e.type+!1];if(e.t){if(e.t<=t.u)return}else e.t=Date.now();return t(Hi.event?Hi.event(e):e)}function iU(e){return this.l[e.type+!0](Hi.event?Hi.event(e):e)}function coe(e,t,n,r,i,s,a,o,l,c){var u,d,h,f,p,g,m,v,b,y,T,x,S,k,Q,C=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(l=!!(32&n.__u),s=[o=t.__e=n.__e]),(u=Hi.__b)&&u(t);e:if(typeof C=="function")try{if(v=t.props,b=(u=C.contextType)&&r[u.__c],y=u?b?b.props.value:u.__:r,n.__c?m=(d=t.__c=n.__c).__=d.__E:("prototype"in C&&C.prototype.render?t.__c=d=new C(v,y):(t.__c=d=new DT(v,y),d.constructor=C,d.render=OEe),b&&b.sub(d),d.props=v,d.state||(d.state={}),d.context=y,d.__n=r,h=d.__d=!0,d.__h=[],d._sb=[]),d.__s==null&&(d.__s=d.state),C.getDerivedStateFromProps!=null&&(d.__s==d.state&&(d.__s=Wf({},d.__s)),Wf(d.__s,C.getDerivedStateFromProps(v,d.__s))),f=d.props,p=d.state,d.__v=t,h)C.getDerivedStateFromProps==null&&d.componentWillMount!=null&&d.componentWillMount(),d.componentDidMount!=null&&d.__h.push(d.componentDidMount);else{if(C.getDerivedStateFromProps==null&&v!==f&&d.componentWillReceiveProps!=null&&d.componentWillReceiveProps(v,y),!d.__e&&(d.shouldComponentUpdate!=null&&d.shouldComponentUpdate(v,d.__s,y)===!1||t.__v===n.__v)){for(t.__v!==n.__v&&(d.props=v,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.forEach(function(_){_&&(_.__=t)}),T=0;T<d._sb.length;T++)d.__h.push(d._sb[T]);d._sb=[],d.__h.length&&a.push(d);break e}d.componentWillUpdate!=null&&d.componentWillUpdate(v,d.__s,y),d.componentDidUpdate!=null&&d.__h.push(function(){d.componentDidUpdate(f,p,g)})}if(d.context=y,d.props=v,d.__P=e,d.__e=!1,x=Hi.__r,S=0,"prototype"in C&&C.prototype.render){for(d.state=d.__s,d.__d=!1,x&&x(t),u=d.render(d.props,d.state,d.context),k=0;k<d._sb.length;k++)d.__h.push(d._sb[k]);d._sb=[]}else do d.__d=!1,x&&x(t),u=d.render(d.props,d.state,d.context),d.state=d.__s;while(d.__d&&++S<25);d.state=d.__s,d.getChildContext!=null&&(r=Wf(Wf({},r),d.getChildContext())),h||d.getSnapshotBeforeUpdate==null||(g=d.getSnapshotBeforeUpdate(f,p)),ooe(e,KF(Q=u!=null&&u.type===JF&&u.key==null?u.props.children:u)?Q:[Q],t,n,r,i,s,a,o,l,c),d.base=t.__e,t.__u&=-161,d.__h.length&&a.push(d),m&&(d.__E=d.__=null)}catch(_){t.__v=null,l||s!=null?(t.__e=o,t.__u|=l?160:32,s[s.indexOf(o)]=null):(t.__e=n.__e,t.__k=n.__k),Hi.__e(_,t,n)}else s==null&&t.__v===n.__v?(t.__k=n.__k,t.__e=n.__e):t.__e=fEe(n.__e,t,n,r,i,s,a,l,c);(u=Hi.diffed)&&u(t)}function hEe(e,t,n){t.__d=void 0;for(var r=0;r<n.length;r++)e8(n[r],n[++r],n[++r]);Hi.__c&&Hi.__c(t,e),e.some(function(i){try{e=i.__h,i.__h=[],e.some(function(s){s.call(i)})}catch(s){Hi.__e(s,i.__v)}})}function fEe(e,t,n,r,i,s,a,o,l){var c,u,d,h,f,p,g,m=n.props,v=t.props,b=t.type;if(b==="svg"&&(i=!0),s!=null){for(c=0;c<s.length;c++)if((f=s[c])&&"setAttribute"in f==!!b&&(b?f.localName===b:f.nodeType===3)){e=f,s[c]=null;break}}if(e==null){if(b===null)return document.createTextNode(v);e=i?document.createElementNS("http://www.w3.org/2000/svg",b):document.createElement(b,v.is&&v),s=null,o=!1}if(b===null)m===v||o&&e.data===v||(e.data=v);else{if(s=s&&eoe.call(e.childNodes),m=n.props||c6,!o&&s!=null)for(m={},c=0;c<e.attributes.length;c++)m[(f=e.attributes[c]).name]=f.value;for(c in m)f=m[c],c=="children"||(c=="dangerouslySetInnerHTML"?d=f:c==="key"||c in v||$$(e,c,null,f,i));for(c in v)f=v[c],c=="children"?h=f:c=="dangerouslySetInnerHTML"?u=f:c=="value"?p=f:c=="checked"?g=f:c==="key"||o&&typeof f!="function"||m[c]===f||$$(e,c,f,m[c],i);if(u)o||d&&(u.__html===d.__html||u.__html===e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=""),ooe(e,KF(h)?h:[h],t,n,r,i&&b!=="foreignObject",s,a,s?s[0]:n.__k&&vv(n,0),o,l),s!=null)for(c=s.length;c--;)s[c]!=null&&soe(s[c]);o||(c="value",p!==void 0&&(p!==e[c]||b==="progress"&&!p||b==="option"&&p!==m[c])&&$$(e,c,p,m[c],!1),c="checked",g!==void 0&&g!==e[c]&&$$(e,c,g,m[c],!1))}return e}function e8(e,t,n){try{typeof e=="function"?e(t):e.current=t}catch(r){Hi.__e(r,n)}}function d6(e,t,n){var r,i;if(Hi.unmount&&Hi.unmount(e),(r=e.ref)&&(r.current&&r.current!==e.__e||e8(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){Hi.__e(s,t)}r.base=r.__P=null,e.__c=void 0}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&d6(r[i],t,n||typeof e.type!="function");n||e.__e==null||soe(e.__e),e.__=e.__e=e.__d=void 0}function OEe(e,t,n){return this.constructor(e,n)}eoe=ioe.slice,Hi={__e:function(e,t,n,r){for(var i,s,a;t=t.__;)if((i=t.__c)&&!i.__)try{if((s=i.constructor)&&s.getDerivedStateFromError!=null&&(i.setState(s.getDerivedStateFromError(e)),a=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),a=i.__d),a)return i.__E=i}catch(o){e=o}throw e}},toe=0,DT.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Wf({},this.state),typeof e=="function"&&(e=e(Wf({},n),this.props)),e&&Wf(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),u6(this))},DT.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),u6(this))},DT.prototype.render=JF,_p=[],noe=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,o6=function(e,t){return e.__v.__b-t.__v.__b},nP.__r=0,roe=0,function(e){e.Button="button",e.Tab="tab",e.Selector="selector"}(Hq||(Hq={})),function(e){e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger"}(l6||(l6={})),function(e){e.Popover="popover",e.API="api",e.Widget="widget"}(Kq||(Kq={})),function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}(Jq||(Jq={})),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}(eU||(eU={})),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}(tU||(tU={}));var bv=function(e,t){if(!function(n){try{new RegExp(n)}catch{return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch{return!1}},ia=Va("[Surveys]"),sU={icontains:(e,t)=>e.some(n=>t.toLowerCase().includes(n.toLowerCase())),not_icontains:(e,t)=>e.every(n=>!t.toLowerCase().includes(n.toLowerCase())),regex:(e,t)=>e.some(n=>bv(t,n)),not_regex:(e,t)=>e.every(n=>!bv(t,n)),exact:(e,t)=>e.some(n=>t===n),is_not:(e,t)=>e.every(n=>t!==n)};function aU(e){return e??"icontains"}l6.Right;(function(e,t){var n={__c:t="__cC"+roe++,__:e,Consumer:function(r,i){return r.children(i)},Provider:function(r){var i,s;return this.getChildContext||(i=[],(s={})[t]=this,this.getChildContext=function(){return s},this.shouldComponentUpdate=function(a){this.props.value!==a.value&&i.some(function(o){o.__e=!0,u6(o)})},this.sub=function(a){i.push(a);var o=a.componentWillUnmount;a.componentWillUnmount=function(){i.splice(i.indexOf(a),1),o&&o.call(a)}}),r.children}};n.Provider.__=n.Consumer.contextType=n})({isPreviewMode:!1,previewPageIndex:0,onPopupSurveyDismissed:()=>{},isPopup:!0,onPreviewSubmit:()=>{}});let uoe=class{constructor(){kt(this,"events",{}),this.events={}}on(t,n){return this.events[t]||(this.events[t]=[]),this.events[t].push(n),()=>{this.events[t]=this.events[t].filter(r=>r!==n)}}emit(t,n){for(var r of this.events[t]||[])r(n);for(var i of this.events["*"]||[])i(t,n)}},pEe=class o0{constructor(t){kt(this,"_debugEventEmitter",new uoe),kt(this,"checkStep",(n,r)=>this.checkStepEvent(n,r)&&this.checkStepUrl(n,r)&&this.checkStepElement(n,r)),kt(this,"checkStepEvent",(n,r)=>r==null||!r.event||n?.event===r?.event),this.instance=t,this.actionEvents=new Set,this.actionRegistry=new Set}init(){var t;if(!Mt((t=this.instance)===null||t===void 0?void 0:t._addCaptureHook)){var n;(n=this.instance)===null||n===void 0||n._addCaptureHook((r,i)=>{this.on(r,i)})}}register(t){var n,r;if(!Mt((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)&&(t.forEach(a=>{var o,l;(o=this.actionRegistry)===null||o===void 0||o.add(a),(l=a.steps)===null||l===void 0||l.forEach(c=>{var u;(u=this.actionEvents)===null||u===void 0||u.add(c?.event||"")})}),(r=this.instance)!==null&&r!==void 0&&r.autocapture)){var i,s=new Set;t.forEach(a=>{var o;(o=a.steps)===null||o===void 0||o.forEach(l=>{l!=null&&l.selector&&s.add(l?.selector)})}),(i=this.instance)===null||i===void 0||i.autocapture.setElementSelectors(s)}}on(t,n){var r;n!=null&&t.length!=0&&(this.actionEvents.has(t)||this.actionEvents.has(n?.event))&&this.actionRegistry&&((r=this.actionRegistry)===null||r===void 0?void 0:r.size)>0&&this.actionRegistry.forEach(i=>{this.checkAction(n,i)&&this._debugEventEmitter.emit("actionCaptured",i.name)})}_addActionHook(t){this.onAction("actionCaptured",n=>t(n))}checkAction(t,n){if(n?.steps==null)return!1;for(var r of n.steps)if(this.checkStep(t,r))return!0;return!1}onAction(t,n){return this._debugEventEmitter.on(t,n)}checkStepUrl(t,n){if(n!=null&&n.url){var r,i=t==null||(r=t.properties)===null||r===void 0?void 0:r.$current_url;if(!i||typeof i!="string"||!o0.matchString(i,n?.url,n?.url_matching||"contains"))return!1}return!0}static matchString(t,n,r){switch(r){case"regex":return!!qe&&bv(t,n);case"exact":return n===t;case"contains":var i=o0.escapeStringRegexp(n).replace(/_/g,".").replace(/%/g,".*");return bv(t,i);default:return!1}}static escapeStringRegexp(t){return t.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}checkStepElement(t,n){if((n!=null&&n.href||n!=null&&n.tag_name||n!=null&&n.text)&&!this.getElementsList(t).some(s=>!(n!=null&&n.href&&!o0.matchString(s.href||"",n?.href,n?.href_matching||"exact"))&&(n==null||!n.tag_name||s.tag_name===n?.tag_name)&&!(n!=null&&n.text&&!o0.matchString(s.text||"",n?.text,n?.text_matching||"exact")&&!o0.matchString(s.$el_text||"",n?.text,n?.text_matching||"exact"))))return!1;if(n!=null&&n.selector){var r,i=t==null||(r=t.properties)===null||r===void 0?void 0:r.$element_selectors;if(!i||!i.includes(n?.selector))return!1}return!0}getElementsList(t){return t?.properties.$elements==null?[]:t?.properties.$elements}},h6=class doe{constructor(t){this.instance=t,this.eventToSurveys=new Map,this.actionToSurveys=new Map}register(t){var n;Mt((n=this.instance)===null||n===void 0?void 0:n._addCaptureHook)||(this.setupEventBasedSurveys(t),this.setupActionBasedSurveys(t))}setupActionBasedSurveys(t){var n=t.filter(r=>{var i,s,a,o;return((i=r.conditions)===null||i===void 0?void 0:i.actions)&&((s=r.conditions)===null||s===void 0||(a=s.actions)===null||a===void 0||(o=a.values)===null||o===void 0?void 0:o.length)>0});n.length!==0&&(this.actionMatcher==null&&(this.actionMatcher=new pEe(this.instance),this.actionMatcher.init(),this.actionMatcher._addActionHook(r=>{this.onAction(r)})),n.forEach(r=>{var i,s,a,o,l,c,u,d,h,f;r.conditions&&(i=r.conditions)!==null&&i!==void 0&&i.actions&&(s=r.conditions)!==null&&s!==void 0&&(a=s.actions)!==null&&a!==void 0&&a.values&&((o=r.conditions)===null||o===void 0||(l=o.actions)===null||l===void 0||(c=l.values)===null||c===void 0?void 0:c.length)>0&&((u=this.actionMatcher)===null||u===void 0||u.register(r.conditions.actions.values),(d=r.conditions)===null||d===void 0||(h=d.actions)===null||h===void 0||(f=h.values)===null||f===void 0||f.forEach(p=>{if(p&&p.name){var g=this.actionToSurveys.get(p.name);g&&g.push(r.id),this.actionToSurveys.set(p.name,g||[r.id])}}))}))}setupEventBasedSurveys(t){var n;t.filter(r=>{var i,s,a,o;return((i=r.conditions)===null||i===void 0?void 0:i.events)&&((s=r.conditions)===null||s===void 0||(a=s.events)===null||a===void 0||(o=a.values)===null||o===void 0?void 0:o.length)>0}).length!==0&&((n=this.instance)===null||n===void 0||n._addCaptureHook((r,i)=>{this.onEvent(r,i)}),t.forEach(r=>{var i,s,a;(i=r.conditions)===null||i===void 0||(s=i.events)===null||s===void 0||(a=s.values)===null||a===void 0||a.forEach(o=>{if(o&&o.name){var l=this.eventToSurveys.get(o.name);l&&l.push(r.id),this.eventToSurveys.set(o.name,l||[r.id])}})}))}onEvent(t,n){var r,i,s=((r=this.instance)===null||r===void 0||(i=r.persistence)===null||i===void 0?void 0:i.props[g$])||[];if(doe.SURVEY_SHOWN_EVENT_NAME==t&&n&&s.length>0){var a,o=n==null||(a=n.properties)===null||a===void 0?void 0:a.$survey_id;if(o){var l=s.indexOf(o);l>=0&&(s.splice(l,1),this._updateActivatedSurveys(s))}}else this.eventToSurveys.has(t)&&this._updateActivatedSurveys(s.concat(this.eventToSurveys.get(t)||[]))}onAction(t){var n,r,i=((n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0?void 0:r.props[g$])||[];this.actionToSurveys.has(t)&&this._updateActivatedSurveys(i.concat(this.actionToSurveys.get(t)||[]))}_updateActivatedSurveys(t){var n,r;(n=this.instance)===null||n===void 0||(r=n.persistence)===null||r===void 0||r.register({[g$]:[...new Set(t)]})}getSurveys(){var t,n,r=(t=this.instance)===null||t===void 0||(n=t.persistence)===null||n===void 0?void 0:n.props[g$];return r||[]}getEventToSurveys(){return this.eventToSurveys}_getActionMatcher(){return this.actionMatcher}};kt(h6,"SURVEY_SHOWN_EVENT_NAME","survey shown");let gEe=class{constructor(t){kt(this,"_isFetchingSurveys",!1),kt(this,"_isInitializingSurveys",!1),kt(this,"_surveyCallbacks",[]),this.instance=t,this._surveyEventReceiver=null}onRemoteConfig(t){var n=t.surveys;if(jr(n))return ia.warn("Decide not loaded yet. Not loading surveys.");var r=Bi(n);this._hasSurveys=r?n.length>0:n,ia.info("decide response received, hasSurveys: ".concat(this._hasSurveys)),this._hasSurveys&&this.loadIfEnabled()}reset(){localStorage.removeItem("lastSeenSurveyDate");var t=(()=>{for(var n=[],r=0;r<localStorage.length;r++){var i=localStorage.key(r);i!=null&&i.startsWith("seenSurvey_")&&n.push(i)}return n})();t.forEach(n=>localStorage.removeItem(n))}loadIfEnabled(){if(!this._surveyManager)if(this._isInitializingSurveys)ia.info("Already initializing surveys, skipping...");else if(this.instance.config.disable_surveys)ia.info("Disabled. Not loading surveys.");else{var t=In?.__PosthogExtensions__;if(t)if(this._hasSurveys){this._isInitializingSurveys=!0;try{var n=t.generateSurveys;if(n)this._surveyManager=n(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new h6(this.instance),ia.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0});else{var r=t.loadExternalDependency;if(r)r(this.instance,"surveys",s=>{if(s||!t.generateSurveys)return ia.error("Could not load surveys script",s),void(this._isInitializingSurveys=!1);this._surveyManager=t.generateSurveys(this.instance),this._isInitializingSurveys=!1,this._surveyEventReceiver=new h6(this.instance),ia.info("Surveys loaded successfully"),this._notifySurveyCallbacks({isLoaded:!0})});else{var i="PostHog loadExternalDependency extension not found. Cannot load remote config.";ia.error(i),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:i})}}}catch(s){throw ia.error("Error initializing surveys",s),this._isInitializingSurveys=!1,this._notifySurveyCallbacks({isLoaded:!1,error:"Error initializing surveys"}),s}}else ia.info("No surveys to load.");else ia.error("PostHog Extensions not found.")}}onSurveysLoaded(t){return this._surveyCallbacks.push(t),this._surveyManager&&this._notifySurveyCallbacks({isLoaded:!0}),()=>{this._surveyCallbacks=this._surveyCallbacks.filter(n=>n!==t)}}getSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];if(this.instance.config.disable_surveys)return ia.info("Disabled. Not loading surveys."),t([]);var r=this.instance.get_property(LX);if(r&&!n)return t(r,{isLoaded:!0});if(this._isFetchingSurveys)return t([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this._isFetchingSurveys=!0,this.instance._send_request({url:this.instance.requestRouter.endpointFor("api","/api/surveys/?token=".concat(this.instance.config.token)),method:"GET",timeout:this.instance.config.surveys_request_timeout_ms,callback:i=>{var s;this._isFetchingSurveys=!1;var a=i.statusCode;if(a!==200||!i.json){var o="Surveys API could not be loaded, status: ".concat(a);return ia.error(o),t([],{isLoaded:!1,error:o})}var l,c=i.json.surveys||[],u=c.filter(d=>{var h,f,p,g,m,v,b,y,T,x,S,k;return((h=d.conditions)===null||h===void 0?void 0:h.events)&&((f=d.conditions)===null||f===void 0||(p=f.events)===null||p===void 0?void 0:p.values)&&((g=d.conditions)===null||g===void 0||(m=g.events)===null||m===void 0||(v=m.values)===null||v===void 0?void 0:v.length)>0||((b=d.conditions)===null||b===void 0?void 0:b.actions)&&((y=d.conditions)===null||y===void 0||(T=y.actions)===null||T===void 0?void 0:T.values)&&((x=d.conditions)===null||x===void 0||(S=x.actions)===null||S===void 0||(k=S.values)===null||k===void 0?void 0:k.length)>0});return u.length>0&&((l=this._surveyEventReceiver)===null||l===void 0||l.register(u)),(s=this.instance.persistence)===null||s===void 0||s.register({[LX]:c}),t(c,{isLoaded:!0})}})}catch(i){throw this._isFetchingSurveys=!1,i}}_notifySurveyCallbacks(t){for(var n of this._surveyCallbacks)try{t.isLoaded?this.getSurveys(n):n([],t)}catch(r){ia.error("Error in survey callback",r)}}isSurveyFeatureFlagEnabled(t){return!t||this.instance.featureFlags.isFeatureEnabled(t)}getActiveMatchingSurveys(t){var n=arguments.length>1&&arguments[1]!==void 0&&arguments[1];this.getSurveys(r=>{var i,s=r.filter(l=>!(!l.start_date||l.end_date)).filter(l=>{var c;if(!l.conditions)return!0;var u=function(f){var p,g,m;if((p=f.conditions)===null||p===void 0||!p.url)return!0;var v=qe==null||(g=qe.location)===null||g===void 0?void 0:g.href;if(!v)return!1;var b=[f.conditions.url];return sU[aU((m=f.conditions)===null||m===void 0?void 0:m.urlMatchType)](b,v)}(l),d=(c=l.conditions)===null||c===void 0||!c.selector||Bt?.querySelector(l.conditions.selector),h=function(f){var p,g,m;if((p=f.conditions)===null||p===void 0||!p.deviceTypes||((g=f.conditions)===null||g===void 0?void 0:g.deviceTypes.length)===0)return!0;if(!ys)return!1;var v=_i.deviceType(ys);return sU[aU((m=f.conditions)===null||m===void 0?void 0:m.deviceTypesMatchType)](f.conditions.deviceTypes,v)}(l);return u&&d&&h}),a=(i=this._surveyEventReceiver)===null||i===void 0?void 0:i.getSurveys(),o=s.filter(l=>{var c,u,d,h,f,p,g,m,v;if(!(l.linked_flag_key||l.targeting_flag_key||l.internal_targeting_flag_key||(c=l.feature_flag_keys)!==null&&c!==void 0&&c.length))return!0;var b=this.isSurveyFeatureFlagEnabled(l.linked_flag_key),y=this.isSurveyFeatureFlagEnabled(l.targeting_flag_key),T=((u=(d=l.conditions)===null||d===void 0||(h=d.events)===null||h===void 0||(f=h.values)===null||f===void 0?void 0:f.length)!==null&&u!==void 0?u:0)>0,x=((p=(g=l.conditions)===null||g===void 0||(m=g.actions)===null||m===void 0||(v=m.values)===null||v===void 0?void 0:v.length)!==null&&p!==void 0?p:0)>0,S=!T&&!x||a?.includes(l.id),k=this._canActivateRepeatedly(l)||this.isSurveyFeatureFlagEnabled(l.internal_targeting_flag_key),Q=this.checkFlags(l);return b&&y&&k&&S&&Q});return t(o)},n)}checkFlags(t){var n;return(n=t.feature_flag_keys)===null||n===void 0||!n.length||t.feature_flag_keys.every(r=>{var{key:i,value:s}=r;return!i||!s||this.instance.featureFlags.isFeatureEnabled(s)})}_canActivateRepeatedly(t){var n;return jr((n=In.__PosthogExtensions__)===null||n===void 0?void 0:n.canActivateRepeatedly)?(ia.warn("init was not called"),!1):In.__PosthogExtensions__.canActivateRepeatedly(t)}canRenderSurvey(t){if(jr(this._surveyManager))return ia.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var n=null;return this.getSurveys(r=>{var i=r.filter(s=>s.id===t)[0];n=i?Be({},this._surveyManager.canRenderSurvey(i)):{visible:!1,disabledReason:"Survey not found"}}),n}renderSurvey(t,n){jr(this._surveyManager)?ia.warn("init was not called"):this.getSurveys(r=>{var i=r.filter(s=>s.id===t)[0];this._surveyManager.renderSurvey(i,Bt?.querySelector(n))})}};var oU=Va("[RateLimiter]");let mEe=class{constructor(t){var n,r;kt(this,"serverLimits",{}),kt(this,"lastEventRateLimited",!1),kt(this,"checkForLimiting",i=>{var s=i.text;if(s&&s.length)try{(JSON.parse(s).quota_limited||[]).forEach(a=>{oU.info("".concat(a||"events"," is quota limited.")),this.serverLimits[a]=new Date().getTime()+6e4})}catch(a){return void oU.warn('could not rate limit - continuing. Error: "'.concat(a?.message,'"'),{text:s})}}),this.instance=t,this.captureEventsPerSecond=((n=t.config.rate_limiting)===null||n===void 0?void 0:n.events_per_second)||10,this.captureEventsBurstLimit=Math.max(((r=t.config.rate_limiting)===null||r===void 0?void 0:r.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(){var t,n,r,i=arguments.length>0&&arguments[0]!==void 0&&arguments[0],s=new Date().getTime(),a=(t=(n=this.instance.persistence)===null||n===void 0?void 0:n.get_property(UX))!==null&&t!==void 0?t:{tokens:this.captureEventsBurstLimit,last:s};a.tokens+=(s-a.last)/1e3*this.captureEventsPerSecond,a.last=s,a.tokens>this.captureEventsBurstLimit&&(a.tokens=this.captureEventsBurstLimit);var o=a.tokens<1;return o||i||(a.tokens=Math.max(0,a.tokens-1)),!o||this.lastEventRateLimited||i||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to ".concat(this.captureEventsPerSecond," events per second and ").concat(this.captureEventsBurstLimit," events burst limit.")},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,(r=this.instance.persistence)===null||r===void 0||r.set_property(UX,a),{isRateLimited:o,remainingTokens:a.tokens}}isServerRateLimited(t){var n=this.serverLimits[t||"events"]||!1;return n!==!1&&new Date().getTime()<n}};var ap=Va("[RemoteConfig]");let vEe=class{constructor(t){this.instance=t}get remoteConfig(){var t,n;return(t=In._POSTHOG_REMOTE_CONFIG)===null||t===void 0||(n=t[this.instance.config.token])===null||n===void 0?void 0:n.config}_loadRemoteConfigJs(t){var n,r,i;(n=In.__PosthogExtensions__)!==null&&n!==void 0&&n.loadExternalDependency?(r=In.__PosthogExtensions__)===null||r===void 0||(i=r.loadExternalDependency)===null||i===void 0||i.call(r,this.instance,"remote-config",()=>t(this.remoteConfig)):(ap.error("PostHog Extensions not found. Cannot load remote config."),t())}_loadRemoteConfigJSON(t){this.instance._send_request({method:"GET",url:this.instance.requestRouter.endpointFor("assets","/array/".concat(this.instance.config.token,"/config")),callback:n=>{t(n.json)}})}load(){try{if(this.remoteConfig)return ap.info("Using preloaded remote config",this.remoteConfig),void this.onRemoteConfig(this.remoteConfig);if(this.instance.config.advanced_disable_decide)return void ap.warn("Remote config is disabled. Falling back to local config.");this._loadRemoteConfigJs(t=>{if(!t)return ap.info("No config found after loading remote JS config. Falling back to JSON."),void this._loadRemoteConfigJSON(n=>{this.onRemoteConfig(n)});this.onRemoteConfig(t)})}catch(t){ap.error("Error loading remote config",t)}}onRemoteConfig(t){t?this.instance.config.__preview_remote_config?(this.instance._onRemoteConfig(t),t.hasFeatureFlags!==!1&&this.instance.featureFlags.ensureFlagsLoaded()):ap.info("__preview_remote_config is disabled. Logging config instead",t):ap.error("Failed to fetch remote config from PostHog.")}};var bEe=function(e){var t,n,r,i,s="";for(t=n=0,r=(e=(e+"").replace(/\r\n/g,`
|
|
4
4
|
`).replace(/\r/g,`
|
|
@@ -1072,7 +1072,7 @@ l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
1072
1072
|
`,before:f,encode:["$"],...u.current()})),p()}return f+=u.move(`
|
|
1073
1073
|
`),c&&(f+=u.move(c+`
|
|
1074
1074
|
`)),f+=u.move(d),h(),f}function r(s,a,o){let l=s.value||"",c=1;for(t||c++;new RegExp("(^|[^$])"+"\\$".repeat(c)+"([^$]|$)").test(l);)c++;const u="$".repeat(c);/[^ \r\n]/.test(l)&&(/^[ \r\n]/.test(l)&&/[ \r\n]$/.test(l)||/^\$|\$$/.test(l))&&(l=" "+l+" ");let d=-1;for(;++d<o.unsafe.length;){const h=o.unsafe[d];if(!h.atBreak)continue;const f=o.compilePattern(h);let p;for(;p=f.exec(l);){let g=p.index;l.codePointAt(g)===10&&l.codePointAt(g-1)===13&&g--,l=l.slice(0,g)+" "+l.slice(p.index+1)}}return u+l+u}function i(){return"$"}}const zVe={tokenize:LVe,concrete:!0,name:"mathFlow"},VG={tokenize:qVe,partial:!0};function LVe(e,t,n){const r=this,i=r.events[r.events.length-1],s=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0;let a=0;return o;function o(b){return e.enter("mathFlow"),e.enter("mathFlowFence"),e.enter("mathFlowFenceSequence"),l(b)}function l(b){return b===36?(e.consume(b),a++,l):a<2?n(b):(e.exit("mathFlowFenceSequence"),rr(e,c,"whitespace")(b))}function c(b){return b===null||cn(b)?d(b):(e.enter("mathFlowFenceMeta"),e.enter("chunkString",{contentType:"string"}),u(b))}function u(b){return b===null||cn(b)?(e.exit("chunkString"),e.exit("mathFlowFenceMeta"),d(b)):b===36?n(b):(e.consume(b),u)}function d(b){return e.exit("mathFlowFence"),r.interrupt?t(b):e.attempt(VG,h,m)(b)}function h(b){return e.attempt({tokenize:v,partial:!0},m,f)(b)}function f(b){return(s?rr(e,p,"linePrefix",s+1):p)(b)}function p(b){return b===null?m(b):cn(b)?e.attempt(VG,h,m)(b):(e.enter("mathFlowValue"),g(b))}function g(b){return b===null||cn(b)?(e.exit("mathFlowValue"),p(b)):(e.consume(b),g)}function m(b){return e.exit("mathFlow"),t(b)}function v(b,y,T){let x=0;return rr(b,S,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4);function S(C){return b.enter("mathFlowFence"),b.enter("mathFlowFenceSequence"),k(C)}function k(C){return C===36?(x++,b.consume(C),k):x<a?T(C):(b.exit("mathFlowFenceSequence"),rr(b,Q,"whitespace")(C))}function Q(C){return C===null||cn(C)?(b.exit("mathFlowFence"),y(C)):T(C)}}}function qVe(e,t,n){const r=this;return i;function i(a){return a===null?t(a):(e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),s)}function s(a){return r.parser.lazy[r.now().line]?n(a):t(a)}}function UVe(e){let n=(e||{}).singleDollarTextMath;return n==null&&(n=!0),{tokenize:r,resolve:WVe,previous:jVe,name:"mathText"};function r(i,s,a){let o=0,l,c;return u;function u(g){return i.enter("mathText"),i.enter("mathTextSequence"),d(g)}function d(g){return g===36?(i.consume(g),o++,d):o<2&&!n?a(g):(i.exit("mathTextSequence"),h(g))}function h(g){return g===null?a(g):g===36?(c=i.enter("mathTextSequence"),l=0,p(g)):g===32?(i.enter("space"),i.consume(g),i.exit("space"),h):cn(g)?(i.enter("lineEnding"),i.consume(g),i.exit("lineEnding"),h):(i.enter("mathTextData"),f(g))}function f(g){return g===null||g===32||g===36||cn(g)?(i.exit("mathTextData"),h(g)):(i.consume(g),f)}function p(g){return g===36?(i.consume(g),l++,p):l===o?(i.exit("mathTextSequence"),i.exit("mathText"),s(g)):(c.type="mathTextData",f(g))}}}function WVe(e){let t=e.length-4,n=3,r,i;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==="mathTextData"){e[t][1].type="mathTextPadding",e[n][1].type="mathTextPadding",n+=2,t-=2;break}}for(r=n-1,t++;++r<=t;)i===void 0?r!==t&&e[r][1].type!=="lineEnding"&&(i=r):(r===t||e[r][1].type==="lineEnding")&&(e[i][1].type="mathTextData",r!==i+2&&(e[i][1].end=e[r-1][1].end,e.splice(i+2,r-i-2),t-=r-i-2,r=i+2),i=void 0);return e}function jVe(e){return e!==36||this.events[this.events.length-1][1].type==="characterEscape"}function GVe(e){return{flow:{36:zVe},text:{36:UVe(e)}}}const VVe={};function YVe(e){const t=this,n=e||VVe,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),s=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),a=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(GVe(n)),s.push(FVe()),a.push(MVe(n))}const BVe=e=>e.charCodeAt(e.length-1)===13?e.slice(0,-1):e,Rhe=/^[ \t]*$/,ZVe=/^ {0,3}(`{3,}|~{3,})/,Ahe=/^ {0,3}(?:[-*+]|\d{1,9}[.)])(?:[ \t]|$)/,Xhe=/^(?: {4}|\t)/,HVe=/^(?: {2,}|\t)/,KVe=()=>({source:"",cursor:0,blockStart:0,blankRunStart:-1,kind:"none",fence:null,blocks:[],revision:0}),JVe=e=>{e.source="",e.cursor=0,e.blockStart=0,e.blankRunStart=-1,e.kind="none",e.fence=null,e.blocks=[],e.revision+=1},YG=e=>Xhe.test(e)?"indented-code":Ahe.test(e)?"list":"other",eYe=(e,t)=>e==="list"?Ahe.test(t)||HVe.test(t):e==="indented-code"?Xhe.test(t):!1,tYe=(e,t)=>{let n=0;for(;n<3&&e.charCodeAt(n)===32;)n+=1;let r=0;for(;e[n+r]===t.char;)r+=1;return r<t.length?!1:Rhe.test(e.slice(n+r))},nYe=(e,t)=>{(t.length<e.source.length||!t.startsWith(e.source))&&JVe(e),e.source=t;let n=e.cursor;for(;;){const r=t.indexOf(`
|
|
1075
|
-
`,n);if(r===-1)break;const i=BVe(t.slice(n,r));if(e.fence){tYe(i,e.fence)&&(e.fence=null),n=r+1;continue}if(Rhe.test(i)){e.blankRunStart<0&&(e.blankRunStart=n),n=r+1;continue}if(e.blankRunStart>=0){if(e.kind==="none"||!eYe(e.kind,i)){const s=t.slice(e.blockStart,e.blankRunStart);s.trim().length>0&&(e.blocks.push(s),e.revision+=1),e.blockStart=n,e.kind=YG(i)}e.blankRunStart=-1}else e.kind==="none"&&(e.kind=YG(i));if(e.kind!=="indented-code"){const s=ZVe.exec(i);s&&(e.fence={char:s[1][0],length:s[1].length})}n=r+1}e.cursor=n},rYe=e=>{let t=e.length;for(;t>0;){const n=e.charCodeAt(t-1);if(n!==32&&n!==9&&n!==10&&n!==13)break;t-=1}return t},jn="var(--color-ink)",Nd="var(--color-ink-muted)",$u="var(--color-surface)",mf="var(--color-elevated)",Fd="var(--color-sunken)",Sa="var(--color-hairline)",vf="var(--color-control)",Mm="var(--color-accent)",nw="var(--color-accent-wash)",iYe="var(--color-on-accent)",sYe="var(--color-info)",Dhe="var(--color-info-wash)",aYe="var(--color-success)",Ihe="var(--color-success-wash)",oYe="var(--color-warning)",vD="var(--color-warning-wash)",lYe="var(--color-warning-border)",OR="var(--color-danger)",bD="var(--color-danger-wash)",BG=[nw,Dhe,Ihe,vD,bD],bf=e=>getComputedStyle(document.documentElement).getPropertyValue(e).trim(),cYe=()=>{const e={primaryColor:bf("--color-accent"),secondaryColor:bf("--color-success"),tertiaryColor:bf("--color-info"),mainBkg:bf("--color-elevated"),clusterBkg:bf("--color-sunken"),clusterBorder:bf("--color-hairline"),edgeLabelBackground:bf("--color-surface"),quadrant1Fill:bf("--color-accent-wash")};for(const[n,r]of Object.entries(e))r===""&&delete e[n];const t={darkMode:getComputedStyle(document.documentElement).colorScheme.includes("dark"),background:$u,primaryTextColor:jn,primaryBorderColor:vf,secondaryTextColor:jn,secondaryBorderColor:Sa,tertiaryTextColor:jn,tertiaryBorderColor:Sa,lineColor:Nd,arrowheadColor:Nd,textColor:jn,secondBkg:Fd,border1:vf,border2:Sa,labelColor:jn,nodeBkg:mf,nodeBorder:vf,nodeTextColor:jn,defaultLinkColor:Nd,titleColor:jn,noteBkgColor:vD,noteBorderColor:lYe,noteTextColor:jn,actorBkg:mf,actorBorder:vf,actorTextColor:jn,actorLineColor:Sa,signalColor:Nd,signalTextColor:jn,labelBoxBkgColor:mf,labelBoxBorderColor:Sa,labelTextColor:jn,loopTextColor:jn,activationBkgColor:nw,activationBorderColor:Mm,sequenceNumberColor:$u,sectionBkgColor:Fd,sectionBkgColor2:$u,altSectionBkgColor:Fd,excludeBkgColor:Fd,taskBkgColor:nw,taskBorderColor:vf,taskTextColor:jn,taskTextLightColor:jn,taskTextDarkColor:jn,taskTextOutsideColor:jn,taskTextClickableColor:Mm,activeTaskBkgColor:nw,activeTaskBorderColor:Mm,gridColor:Sa,doneTaskBkgColor:Fd,doneTaskBorderColor:Sa,critBkgColor:bD,critBorderColor:OR,todayLineColor:Mm,transitionColor:Nd,transitionLabelColor:jn,stateLabelColor:jn,stateBkg:mf,labelBackgroundColor:$u,compositeBackground:Fd,altBackground:Fd,compositeTitleBackground:mf,compositeBorder:Sa,innerEndBackground:jn,specialStateColor:jn,classText:jn,attributeBackgroundColorOdd:$u,attributeBackgroundColorEven:Fd,rowOdd:$u,rowEven:Fd,errorBkgColor:bD,errorTextColor:OR,pieTitleTextColor:jn,pieSectionTextColor:jn,pieLegendTextColor:jn,pieStrokeColor:$u,pieOuterStrokeColor:Sa,requirementBackground:mf,requirementBorderColor:vf,requirementTextColor:jn,relationColor:Nd,relationLabelBackground:$u,relationLabelColor:jn,branchLabelColor:iYe,commitLabelColor:jn,commitLabelBackground:$u,tagLabelColor:jn,tagLabelBackground:nw,tagLabelBorder:vf,quadrant2Fill:Dhe,quadrant3Fill:Ihe,quadrant4Fill:vD,quadrant2TextFill:jn,quadrant3TextFill:jn,quadrant4TextFill:jn,quadrantPointFill:Mm,archEdgeColor:Nd,archEdgeArrowColor:Nd,archGroupBorderColor:Sa,scaleLabelColor:jn,packet:{startByteColor:jn,endByteColor:jn,labelColor:jn,titleColor:jn,blockStrokeColor:vf,blockFillColor:mf},radar:{axisColor:Nd,axisStrokeWidth:2,axisLabelFontSize:12,curveOpacity:.5,curveStrokeWidth:2,graticuleColor:Sa,graticuleStrokeWidth:1,graticuleOpacity:.3,legendBoxSize:12,legendFontSize:12},xyChart:{backgroundColor:$u,titleColor:jn,xAxisTitleColor:jn,xAxisLabelColor:jn,xAxisTickColor:Sa,xAxisLineColor:Sa,yAxisTitleColor:jn,yAxisLabelColor:jn,yAxisTickColor:Sa,yAxisLineColor:Sa,plotColorPalette:[Mm,sYe,aYe,oYe,OR].join(",")}};for(let n=0;n<5;n++)t[`surface${n}`]=mf,t[`surfacePeer${n}`]=Sa;for(let n=0;n<8;n++)t[`fillType${n}`]=BG[n%BG.length];return{...t,...e}};let pR=null,ZG=null;const uYe=async e=>{pR||(pR=Xe(async()=>{const{default:n}=await import("./mermaid.core-DrmL1aAj.js").then(r=>r.b4);return{default:n}},__vite__mapDeps([0,1,2,3]),import.meta.url).then(({default:n})=>n));const t=await pR;return ZG!==e&&(t.initialize({startOnLoad:!0,theme:"base",securityLevel:"loose",fontFamily:"var(--font-sans)",fontSize:14,suppressErrorRendering:!0,themeVariables:cYe()}),ZG=e),t},HG=({className:e,copied:t,onZoomIn:n,onZoomOut:r,onReset:i,onSave:s,onCopy:a,children:o})=>O.jsxs("div",{className:N("absolute z-10 flex items-center gap-0.5 rounded-md bg-elevated p-1 shadow-overlay",e),children:[O.jsx(pt,{content:"Zoom in",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Zoom in",onClick:n,children:O.jsx(TAe,{})})}),O.jsx(pt,{content:"Zoom out",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Zoom out",onClick:r,children:O.jsx(_Ae,{})})}),O.jsx(pt,{content:"Drag the diagram to pan",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Drag to pan",children:O.jsx(V4e,{})})}),O.jsx(pt,{content:"Reset view",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Reset view",onClick:i,children:O.jsx(m8,{})})}),O.jsx(pt,{content:"Save as SVG",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Save as SVG",onClick:s,children:O.jsx(uO,{})})}),O.jsx(pt,{content:t?"Copied":"Copy mermaid text",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":t?"Copied":"Copy mermaid text",onClick:a,children:O.jsx(em,{className:N(t&&"text-success")})})}),o]}),wD=({title:e,children:t})=>O.jsxs(po,{variant:"danger",role:"alert",className:"my-4",children:[O.jsx(Fse,{children:e}),O.jsx(RC,{children:t})]});class dYe extends w.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Mermaid Error Boundary caught an error:",t,n)}render(){return this.state.hasError?this.props.fallback||O.jsxs(wD,{title:"Mermaid diagram error",children:[this.state.error?.message||"An unexpected error occurred while rendering the diagram"," ","The error was contained within the diagram component."]}):this.props.children}}const hYe=w.memo(({chart:e,id:t})=>{const n=w.useRef(null),r=w.useRef(null),[i,s]=w.useState(null),[a,o]=w.useState(!0),[l,c]=w.useState(""),[u,d]=w.useState(!1),[h,f]=w.useState({scale:1,x:0,y:0}),[p,g]=w.useState({scale:1,x:0,y:0}),[m,v]=w.useState(!1),[b,y]=w.useState({x:0,y:0}),[T,x]=w.useState("idle"),[S,k]=w.useState("idle"),Q=Zn(X=>X.themeName),C=w.useCallback(async()=>{try{if(o(!0),s(null),c(""),!e||typeof e!="string"||e.trim().length===0)throw new Error("Invalid or empty chart content");const X=await uYe(Q),V=t||`mermaid-${Date.now()}-${Math.floor(Math.random()*1e6)}`,{svg:L}=await X.render(V,e);if(!L||typeof L!="string"||L.trim().length===0)throw new Error("Mermaid failed to generate valid SVG output");c(L)}catch(X){console.error("Mermaid rendering error:",X);const V=X instanceof Error?X.message:"Failed to render mermaid diagram";s(V),c("")}finally{o(!1)}},[e,t,Q]);w.useEffect(()=>{C().catch(X=>{console.error("Error in renderDiagram effect:",X),s("Failed to initialize diagram rendering"),o(!1)})},[C]);const _=w.useCallback(()=>{try{if(!l||!r.current)return 1;const V=r.current.getBoundingClientRect(),L=document.createElement("div");L.innerHTML=l;const H=L.querySelector("svg");if(!H)return 1;const ue=H.getBoundingClientRect?.()?.width||Number.parseFloat(H.getAttribute("width")||"0")||H.viewBox?.baseVal?.width||800,ae=H.getBoundingClientRect?.()?.height||Number.parseFloat(H.getAttribute("height")||"0")||H.viewBox?.baseVal?.height||600,de=V.width*.9/ue,ye=V.height*.9/ae;return Math.min(de,ye,1)}catch(X){return console.error("Error calculating fullscreen scale:",X),1}},[l]);w.useEffect(()=>{u&&l&&setTimeout(()=>{try{const X=_();g({scale:X,x:0,y:0})}catch(X){console.error("Error setting fullscreen transform:",X)}},100)},[u,l,_]);const R=w.useCallback((X=!1)=>{try{(X?g:f)(L=>({...L,scale:Math.min(L.scale*1.2,10)}))}catch(V){console.error("Error in zoom in:",V)}},[]),A=w.useCallback((X=!1)=>{try{(X?g:f)(L=>({...L,scale:Math.max(L.scale/1.2,.1)}))}catch(V){console.error("Error in zoom out:",V)}},[]),I=w.useCallback((X=!1)=>{try{const V=X?g:f;if(X){const L=_();V({scale:L,x:0,y:0})}else V({scale:1,x:0,y:0})}catch(V){console.error("Error in reset:",V)}},[_]),W=w.useCallback(()=>{if(l)try{const X=new Blob([l],{type:"image/svg+xml"}),V=URL.createObjectURL(X),L=document.createElement("a");L.href=V,L.download=`mermaid-diagram-${Date.now()}.svg`,document.body.appendChild(L),L.click(),document.body.removeChild(L),URL.revokeObjectURL(V)}catch(X){console.error("Failed to save SVG:",X)}},[l]),G=w.useCallback(async()=>{try{await navigator.clipboard.writeText(e),x("copied"),setTimeout(()=>x("idle"),1200)}catch(X){console.error("Failed to copy Mermaid chart text:",X)}},[e]),U=w.useCallback(async()=>{try{await navigator.clipboard.writeText(e),k("copied"),setTimeout(()=>k("idle"),1200)}catch(X){console.error("Failed to copy Mermaid chart text:",X)}},[e]),q=w.useCallback(X=>{try{v(!0),y({x:X.clientX,y:X.clientY}),X.preventDefault()}catch(V){console.error("Error in mouse down:",V)}},[]),B=w.useCallback((X,V=!1)=>{try{if(!m)return;const L=X.clientX-b.x,H=X.clientY-b.y;(V?g:f)(ae=>({...ae,x:ae.x+L,y:ae.y+H})),y({x:X.clientX,y:X.clientY})}catch(L){console.error("Error in mouse move:",L)}},[m,b]),j=w.useCallback(()=>{try{v(!1)}catch(X){console.error("Error in mouse up:",X)}},[]),M=w.useCallback((X,V=!1)=>{try{X.preventDefault();const L=X.deltaY>0?.9:1.1;(V?g:f)(ue=>({...ue,scale:Math.min(Math.max(ue.scale*L,.1),5)}))}catch(L){console.error("Error in wheel:",L)}},[]),K=w.useCallback(X=>{try{d(X)}catch(V){console.error("Error toggling fullscreen:",V)}},[]);if(i)return O.jsxs(wD,{title:"Mermaid diagram error",children:[i,O.jsx("span",{className:N("mt-2 block text-ink-muted"),children:"Chart"}),O.jsx("span",{className:N("mt-1 block whitespace-pre-wrap font-mono text-mono-sm"),children:e})]});const F=(X=!1)=>{try{const V=X?r:n,L=X?p:h;return O.jsx("div",{ref:V,className:N("mermaid flex w-full items-center justify-center",X?"h-full min-h-full":"h-auto min-h-50",m?"cursor-grabbing":"cursor-grab"),onMouseDown:q,onMouseMove:H=>B(H,X),onMouseUp:j,onMouseLeave:j,onWheel:H=>M(H,X),children:a?O.jsx("div",{className:N("p-4 text-body-sm text-ink-muted"),children:"Loading diagram..."}):l?O.jsx("div",{className:N("flex h-full w-full items-center justify-center"),style:{transform:`translate(${L.x}px, ${L.y}px) scale(${L.scale})`,transformOrigin:"center center"},dangerouslySetInnerHTML:{__html:l}}):null})}catch(V){return console.error("Error rendering diagram content:",V),O.jsx(wD,{title:"Rendering error",children:"Failed to render diagram content."})}};return O.jsxs(O.Fragment,{children:[O.jsxs("div",{className:N("relative flex items-center justify-center overflow-hidden rounded-md bg-surface","[&_svg]:h-auto [&_svg]:min-h-100 [&_svg]:max-w-none [&_svg]:bg-transparent"),children:[F(!1),O.jsx(HG,{className:"top-2 right-2",copied:T==="copied",onZoomIn:()=>R(!1),onZoomOut:()=>A(!1),onReset:()=>I(!1),onSave:W,onCopy:G,children:O.jsx(pt,{content:"Fullscreen",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Open diagram fullscreen",onClick:()=>K(!0),children:O.jsx(X4e,{})})})})]}),O.jsx(FO,{open:u,onClose:()=>K(!1),title:"Mermaid diagram",maxWidth:"xl",fullWidth:!0,dialogProps:{className:"h-[90vh] max-h-[90vh]"},children:O.jsxs("div",{className:N("relative flex h-[80vh] w-full items-center justify-center overflow-hidden","[&_svg]:h-auto [&_svg]:max-h-full [&_svg]:w-auto [&_svg]:max-w-full [&_svg]:bg-transparent"),children:[F(!0),O.jsx(HG,{className:"top-4 right-4",copied:S==="copied",onZoomIn:()=>R(!0),onZoomOut:()=>A(!0),onReset:()=>I(!0),onSave:W,onCopy:U,children:O.jsx(pt,{content:"Close fullscreen",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Close fullscreen",onClick:()=>K(!1),children:O.jsx(Ts,{})})})})]})})]})}),fYe=w.memo(e=>O.jsx(dYe,{children:O.jsx(hYe,{...e})}));let Nhe=!1,gR=null;const OYe=()=>(gR||(gR=Xe(()=>Promise.resolve({}),__vite__mapDeps([4]),import.meta.url).then(e=>(Nhe=!0,e))),gR),pYe=/language-(\w+)/,gYe=/\n$/,mYe=/\$(?!\d)(.+?)\$/,vYe=/\$\$([\s\S]+?)\$\$/,bYe=/\\begin\{([^}]+)\}([\s\S]+?)\\end\{\1\}/,wYe=/\\[a-zA-Z]+(\{[^}]*\})?/,Fhe={a:({href:e,children:t})=>O.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:t}),code:({node:e,className:t,children:n,...r})=>pYe.exec(t??"")?.[1]==="mermaid"?O.jsx(fYe,{chart:String(n).replace(gYe,"")}):O.jsx("code",{className:t,...r,children:n})},yYe=[mQ],xYe=[mQ,YVe],SYe=[],$Ye=[hje],kYe=e=>mYe.test(e)||vYe.test(e)||bYe.test(e)?!0:wYe.test(e)&&(e.includes("\\frac")||e.includes("\\sum")||e.includes("\\int")||e.includes("\\sqrt")),Mhe=e=>w.useMemo(()=>{if(!(!e?.fontSize&&!e?.lineHeight))return{"--md-font-size":e.fontSize,"--md-line-height":e.lineHeight}},[e?.fontSize,e?.lineHeight]),zhe=e=>{const t=w.useMemo(()=>kYe(e),[e]),[n,r]=w.useState(()=>t&&Nhe);return w.useEffect(()=>{if(!t||n)return;let i=!1;return OYe().then(()=>{i||r(!0)}),()=>{i=!0}},[t,n]),{remarkPlugins:n?xYe:yYe,rehypePlugins:n?$Ye:SYe}},rm=w.memo(({content:e,styleProps:t,className:n})=>{const r=w.useMemo(()=>e.trim(),[e]),{remarkPlugins:i,rehypePlugins:s}=zhe(r),a=Mhe(t);return O.jsx("div",{className:N("lo-markdown",n),style:a,children:O.jsx(h7,{remarkPlugins:i,rehypePlugins:s,components:Fhe,children:r})})});rm.displayName="MarkdownRenderer";const Lhe=w.memo(({source:e})=>{const{remarkPlugins:t,rehypePlugins:n}=zhe(e);return O.jsx(h7,{remarkPlugins:t,rehypePlugins:n,components:Fhe,children:e})});Lhe.displayName="StableBlock";const qhe=w.memo(({text:e,animate:t})=>O.jsx("span",{className:t?"lo-stream-chunk":void 0,children:e}));qhe.displayName="ArrivedText";const Uhe=({content:e,styleProps:t,className:n})=>{const r=w.useRef(null);r.current===null&&(r.current=KVe());const i=r.current,s=w.useRef([]),a=w.useRef(0);nYe(i,e);const o=a.current;e.length>o?(o>0&&s.current.push({offset:o,animate:!0}),a.current=e.length):e.length<o&&(s.current=[],a.current=e.length);const{blockStart:l}=i,c=s.current;let u=0;for(;u<c.length&&c[u].offset<=l;)u+=1;u>0&&c.splice(0,u);const d=l+rYe(e.slice(l)),h=[{offset:l,animate:!1}];for(const p of c){if(p.offset>=d)break;h.push(p)}const f=Mhe(t);return O.jsxs("div",{className:N("lo-markdown",n),style:f,children:[i.blocks.map((p,g)=>O.jsx(Lhe,{source:p},g)),d>l&&O.jsx("p",{className:"lo-stream-tail",children:h.map((p,g)=>{const m=h[g+1]?.offset??d;return O.jsx(qhe,{text:e.slice(p.offset,m),animate:p.animate},p.offset)})})]})};Uhe.displayName="StreamingMarkdown";const Whe=({className:e})=>O.jsx("div",{className:N("flex size-7 shrink-0 items-center justify-center rounded-full bg-sunken text-ink-muted",e),children:O.jsx(f1,{size:16,"aria-label":"Assistant"})}),RP="pl-10",hl=({isUser:e,children:t,isSmallView:n,showAvatar:r,className:i})=>e?O.jsx("div",{className:N("flex w-full justify-end",i),children:t}):O.jsxs("div",{className:N("relative w-full",!n&&RP,i),children:[r&&!n&&O.jsx(Whe,{className:"absolute top-0 left-0"}),t]}),jhe=6048e5,TYe=864e5,KG=6e4,Bhn=36e5,Zhn=1e3,JG=525600,eV=43200,tV=1440,nV=Symbol.for("constructDateFrom");function Ih(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&nV in e?e[nV](t):e instanceof Date?new e.constructor(t):new Date(t)}function Pl(e,t){return Ih(t||e,e)}let PYe={};function CS(){return PYe}function ox(e,t){const n=CS(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Pl(e,t?.in),s=i.getDay(),a=(s<r?7:0)+s-r;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function AP(e,t){return ox(e,{...t,weekStartsOn:1})}function Ghe(e,t){const n=Pl(e,t?.in),r=n.getFullYear(),i=Ih(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);const s=AP(i),a=Ih(n,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const o=AP(a);return n.getTime()>=s.getTime()?r+1:n.getTime()>=o.getTime()?r:r-1}function XP(e){const t=Pl(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 Vhe(e,...t){const n=Ih.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function rV(e,t){const n=Pl(e,t?.in);return n.setHours(0,0,0,0),n}function _Ye(e,t,n){const[r,i]=Vhe(n?.in,e,t),s=rV(r),a=rV(i),o=+s-XP(s),l=+a-XP(a);return Math.round((o-l)/TYe)}function CYe(e,t){const n=Ghe(e,t),r=Ih(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),AP(r)}function QYe(e,t){const n=+Pl(e)-+Pl(t);return n<0?-1:n>0?1:n}function EYe(e){return Ih(e,Date.now())}function RYe(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function AYe(e){return!(!RYe(e)&&typeof e!="number"||isNaN(+Pl(e)))}function XYe(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function DYe(e,t){const n=Pl(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const IYe={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"}},NYe=(e,t,n)=>{let r;const i=IYe[e];return typeof i=="string"?r=i:t===1?r=i.one:r=i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function mR(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const FYe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},MYe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},zYe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},LYe={date:mR({formats:FYe,defaultWidth:"full"}),time:mR({formats:MYe,defaultWidth:"full"}),dateTime:mR({formats:zYe,defaultWidth:"full"})},qYe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},UYe=(e,t,n,r)=>qYe[e];function lb(e){return(t,n)=>{const r=n?.context?String(n.context):"standalone";let i;if(r==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,o=n?.width?String(n.width):a;i=e.formattingValues[o]||e.formattingValues[a]}else{const a=e.defaultWidth,o=n?.width?String(n.width):e.defaultWidth;i=e.values[o]||e.values[a]}const s=e.argumentCallback?e.argumentCallback(t):t;return i[s]}}const WYe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},jYe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},GYe={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"]},VYe={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"]},YYe={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"}},BYe={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"}},ZYe=(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"},HYe={ordinalNumber:ZYe,era:lb({values:WYe,defaultWidth:"wide"}),quarter:lb({values:jYe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:lb({values:GYe,defaultWidth:"wide"}),day:lb({values:VYe,defaultWidth:"wide"}),dayPeriod:lb({values:YYe,defaultWidth:"wide",formattingValues:BYe,defaultFormattingWidth:"wide"})};function cb(e){return(t,n={})=>{const r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(i);if(!s)return null;const a=s[0],o=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(o)?JYe(o,d=>d.test(a)):KYe(o,d=>d.test(a));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=t.slice(a.length);return{value:c,rest:u}}}function KYe(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function JYe(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function eBe(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const i=r[0],s=t.match(e.parsePattern);if(!s)return null;let a=e.valueCallback?e.valueCallback(s[0]):s[0];a=n.valueCallback?n.valueCallback(a):a;const o=t.slice(i.length);return{value:a,rest:o}}}const tBe=/^(\d+)(th|st|nd|rd)?/i,nBe=/\d+/i,rBe={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},iBe={any:[/^b/i,/^(a|c)/i]},sBe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},aBe={any:[/1/i,/2/i,/3/i,/4/i]},oBe={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},lBe={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]},cBe={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},uBe={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]},dBe={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},hBe={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}},fBe={ordinalNumber:eBe({matchPattern:tBe,parsePattern:nBe,valueCallback:e=>parseInt(e,10)}),era:cb({matchPatterns:rBe,defaultMatchWidth:"wide",parsePatterns:iBe,defaultParseWidth:"any"}),quarter:cb({matchPatterns:sBe,defaultMatchWidth:"wide",parsePatterns:aBe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:cb({matchPatterns:oBe,defaultMatchWidth:"wide",parsePatterns:lBe,defaultParseWidth:"any"}),day:cb({matchPatterns:cBe,defaultMatchWidth:"wide",parsePatterns:uBe,defaultParseWidth:"any"}),dayPeriod:cb({matchPatterns:dBe,defaultMatchWidth:"any",parsePatterns:hBe,defaultParseWidth:"any"})},Yhe={code:"en-US",formatDistance:NYe,formatLong:LYe,formatRelative:UYe,localize:HYe,match:fBe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function OBe(e,t){const n=Pl(e,t?.in);return _Ye(n,DYe(n))+1}function pBe(e,t){const n=Pl(e,t?.in),r=+AP(n)-+CYe(n);return Math.round(r/jhe)+1}function Bhe(e,t){const n=Pl(e,t?.in),r=n.getFullYear(),i=CS(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=Ih(t?.in||e,0);a.setFullYear(r+1,0,s),a.setHours(0,0,0,0);const o=ox(a,t),l=Ih(t?.in||e,0);l.setFullYear(r,0,s),l.setHours(0,0,0,0);const c=ox(l,t);return+n>=+o?r+1:+n>=+c?r:r-1}function gBe(e,t){const n=CS(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Bhe(e,t),s=Ih(t?.in||e,0);return s.setFullYear(i,0,r),s.setHours(0,0,0,0),ox(s,t)}function mBe(e,t){const n=Pl(e,t?.in),r=+ox(n,t)-+gBe(n,t);return Math.round(r/jhe)+1}function qr(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const wf={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return qr(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):qr(n+1,2)},d(e,t){return qr(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return qr(e.getHours()%12||12,t.length)},H(e,t){return qr(e.getHours(),t.length)},m(e,t){return qr(e.getMinutes(),t.length)},s(e,t){return qr(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return qr(i,t.length)}},zm={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},iV={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return wf.y(e,t)},Y:function(e,t,n,r){const i=Bhe(e,r),s=i>0?i:1-i;if(t==="YY"){const a=s%100;return qr(a,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):qr(s,t.length)},R:function(e,t){const n=Ghe(e);return qr(n,t.length)},u:function(e,t){const n=e.getFullYear();return qr(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return qr(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return qr(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return wf.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return qr(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const i=mBe(e,r);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):qr(i,t.length)},I:function(e,t,n){const r=pBe(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):qr(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):wf.d(e,t)},D:function(e,t,n){const r=OBe(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):qr(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const i=e.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return qr(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const i=e.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return qr(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),i=r===0?7:r;switch(t){case"i":return String(i);case"ii":return qr(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let i;switch(r===12?i=zm.noon:r===0?i=zm.midnight:i=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let i;switch(r>=17?i=zm.evening:r>=12?i=zm.afternoon:r>=4?i=zm.morning:i=zm.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return wf.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):wf.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):qr(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):qr(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):wf.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):wf.s(e,t)},S:function(e,t){return wf.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return aV(r);case"XXXX":case"XX":return Sp(r);case"XXXXX":case"XXX":default:return Sp(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return aV(r);case"xxxx":case"xx":return Sp(r);case"xxxxx":case"xxx":default:return Sp(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+sV(r,":");case"OOOO":default:return"GMT"+Sp(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+sV(r,":");case"zzzz":default:return"GMT"+Sp(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return qr(r,t.length)},T:function(e,t,n){return qr(+e,t.length)}};function sV(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Math.trunc(r/60),s=r%60;return s===0?n+String(i):n+String(i)+t+qr(s,2)}function aV(e,t){return e%60===0?(e>0?"-":"+")+qr(Math.abs(e)/60,2):Sp(e,t)}function Sp(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=qr(Math.trunc(r/60),2),s=qr(r%60,2);return n+i+t+s}const oV=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Zhe=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},vBe=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return oV(e,t);let s;switch(r){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",oV(r,t)).replace("{{time}}",Zhe(i,t))},bBe={p:Zhe,P:vBe},wBe=/^D+$/,yBe=/^Y+$/,xBe=["D","DD","YY","YYYY"];function SBe(e){return wBe.test(e)}function $Be(e){return yBe.test(e)}function kBe(e,t,n){const r=TBe(e,t,n);if(console.warn(r),xBe.includes(e))throw new RangeError(r)}function TBe(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const PBe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,_Be=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,CBe=/^'([^]*?)'?$/,QBe=/''/g,EBe=/[a-zA-Z]/;function vR(e,t,n){const r=CS(),i=n?.locale??r.locale??Yhe,s=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,o=Pl(e,n?.in);if(!AYe(o))throw new RangeError("Invalid time value");let l=t.match(_Be).map(u=>{const d=u[0];if(d==="p"||d==="P"){const h=bBe[d];return h(u,i.formatLong)}return u}).join("").match(PBe).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:RBe(u)};if(iV[d])return{isToken:!0,value:u};if(d.match(EBe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});i.localize.preprocessor&&(l=i.localize.preprocessor(o,l));const c={firstWeekContainsDate:s,weekStartsOn:a,locale:i};return l.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!n?.useAdditionalWeekYearTokens&&$Be(d)||!n?.useAdditionalDayOfYearTokens&&SBe(d))&&kBe(d,t,String(e));const h=iV[d[0]];return h(o,d,i.localize,c)}).join("")}function RBe(e){const t=e.match(CBe);return t?t[1].replace(QBe,"'"):e}function ABe(e,t,n){const r=CS(),i=n?.locale??r.locale??Yhe,s=QYe(e,t);if(isNaN(s))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:s}),[o,l]=Vhe(n?.in,...s>0?[t,e]:[e,t]),c=XYe("round"),u=l.getTime()-o.getTime(),d=u/KG,h=XP(l)-XP(o),f=(u-h)/KG,p=n?.unit;let g;if(d<1?g="second":d<60?g="minute":d<tV?g="hour":f<eV?g="day":f<JG?g="month":g="year",g==="second"){const m=c(u/1e3);return i.formatDistance("xSeconds",m,a)}else if(g==="minute"){const m=c(d);return i.formatDistance("xMinutes",m,a)}else if(g==="hour"){const m=c(d/60);return i.formatDistance("xHours",m,a)}else if(g==="day"){const m=c(f/tV);return i.formatDistance("xDays",m,a)}else if(g==="month"){const m=c(f/eV);return m===12&&p!=="month"?i.formatDistance("xYears",1,a):i.formatDistance("xMonths",m,a)}else{const m=c(f/JG);return i.formatDistance("xYears",m,a)}}function XBe(e,t){return ABe(e,EYe(e),t)}const DBe=e=>{if(!e)return"";try{const t=e instanceof Date?e:new Date(e),n=new Date,r=new Date(n);if(r.setDate(n.getDate()-1),t.toDateString()===n.toDateString())return vR(t,"h:mm a");if(t.toDateString()===r.toDateString())return"Yesterday";const i=new Date(n);return i.setDate(n.getDate()-7),t>i?vR(t,"EEEE"):vR(t,"yyyy-MM-dd")}catch(t){return console.error("Error formatting date:",t),""}},Hhn=e=>{if(!e)return"";try{const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString(navigator.language,{year:"numeric",month:"long",day:"numeric"})}catch(t){return console.error("Error formatting calendar date:",t),""}},IBe=e=>{if(!e)return"";try{const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString(navigator.language,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit"})}catch(t){return console.error("Error formatting calendar date-time:",t),""}},M7=({timestamp:e,className:t})=>O.jsx(pt,{content:IBe(e),side:"bottom",delayDuration:1200,children:O.jsx("span",{className:N("shrink-0 cursor-help whitespace-nowrap text-ink-dim text-meta",t),children:DBe(e)})}),Hhe=({content:e,busy:t=!1,className:n})=>e?O.jsxs("section",{"aria-label":"Question from the agent",className:N("flex gap-3 rounded-md border border-accent bg-accent-wash px-4 py-3",n),children:[O.jsx(F4e,{className:"mt-0.5 size-4 shrink-0 text-accent","aria-hidden":!0}),O.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[O.jsx("p",{className:"font-medium text-accent text-meta",children:t?"Sending your answer…":"Waiting for your answer"}),O.jsx("div",{className:"lo-on-wash text-ink",children:O.jsx(rm,{content:e})})]})]}):null,NBe=({options:e,recommended:t,busy:n=!1,onAnswer:r,requestId:i})=>{if(e.length===0)return null;const s=typeof t=="number"&&Number.isInteger(t)&&t>=0&&t<e.length?t:null;return O.jsx("fieldset",{"aria-label":"Answer options",className:"mt-1 flex min-w-0 max-h-[380px] flex-col gap-2 overflow-y-auto border-0 px-0 py-1",children:e.map((a,o)=>O.jsxs("button",{type:"button",disabled:n,onClick:()=>r(a.label),className:N("flex w-full items-baseline gap-2 rounded-sm border px-3 py-2 text-left","transition-colors duration-fast ease-out-quart","border-control bg-surface hover:bg-elevated active:bg-sunken","disabled:border-hairline disabled:bg-sunken disabled:text-ink-disabled"),children:[o<9&&O.jsxs("span",{"aria-hidden":!0,className:N("shrink-0 font-mono text-mono-sm",n?"text-ink-disabled":"text-ink-dim"),children:[o+1,"."]}),O.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[O.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[O.jsx("span",{className:N("min-w-0 text-body-sm",n?"text-ink-disabled":"text-ink"),children:a.label}),s===o&&O.jsx("span",{className:N("shrink-0 font-medium text-meta",n?"text-ink-disabled":"text-ink"),children:"Recommended"})]}),a.description&&O.jsx("span",{className:N("text-body-sm",n?"text-ink-disabled":"text-ink-muted"),children:a.description})]})]},`${i}-${String(o)}`))})},Khe="data-text-surface",bR=Object.freeze({[Khe]:"true"}),FBe="ml-5",Jhe="self-start mt-0.5",lV="flex min-h-6 w-full items-center gap-1.5 py-0.5 text-left",Nh=({summary:e,children:t,defaultOpen:n=!1,chevron:r="leading",className:i,triggerClassName:s,summaryAlign:a="center",rowClassName:o,disabled:l=!1,triggerLabel:c,triggerTooltip:u,onOpenChange:d})=>{const[h,f]=w.useState(n),p=w.useId(),g=w.useRef(null),m=N("shrink-0",a==="firstLine"&&Jhe),v=a==="firstLine"?"items-start":null,b=w.useRef(!1),y=w.useRef(!1),T=w.useRef(null),x=_=>{for(let R=_ instanceof Element?_:null;R&&R!==g.current;R=R.parentElement)if(R.hasAttribute(Khe))return!0;return!1},S=_=>{if(b.current=x(_.target),y.current=!!window.getSelection()?.toString(),_.detail<=1){T.current=null;return}b.current&&T.current!==null&&(f(T.current),d?.(T.current),T.current=null)},k=_=>{const R=_.detail===0,A=y.current||!!window.getSelection()?.toString();!R&&b.current&&(A||_.detail>1)||(T.current=h,f(!h),d?.(!h))},Q=_=>{if(_.key!=="Escape")return;const R=window.getSelection();!R||R.isCollapsed||g.current?.contains(R.anchorNode)&&R.removeAllRanges()};if(l)return O.jsx("div",{className:i,children:O.jsxs("div",{className:N(lV,v,"text-ink-dim",o),children:[r==="leading"&&O.jsx("span",{className:N("size-3.5",m),"aria-hidden":!0}),O.jsx("span",{className:"min-w-0 flex-1",children:e})]})});const C=h?O.jsx(dg,{className:"size-3.5","aria-hidden":!0}):O.jsx(Eh,{className:"size-3.5","aria-hidden":!0});return O.jsxs("div",{className:i,children:[O.jsx(pt,{content:u,side:"top",children:O.jsxs("button",{type:"button","aria-expanded":h,"aria-controls":p,"aria-label":c,ref:g,onMouseDown:S,onClick:k,onKeyDown:Q,className:N(lV,v,"cursor-pointer select-none","text-ink-dim transition-colors duration-fast ease-out-quart hover:text-ink-muted",o,s),children:[r==="leading"&&O.jsx("span",{className:N("flex text-ink-disabled",m),children:C}),O.jsx("span",{className:"min-w-0 flex-1",children:e}),r==="trailing"&&O.jsx("span",{className:N("flex text-ink-disabled",m),children:C})]})}),h&&O.jsx("div",{id:p,className:N("mt-1 flex flex-col gap-2 pb-1",r==="leading"&&FBe),children:t})]})},efe=({children:e,className:t})=>O.jsx("span",{"aria-hidden":!0,className:N("flex size-3.5 shrink-0 [&_svg]:size-3.5",t),children:e}),z7=({label:e="Reasoning",content:t})=>!Zn(r=>r.showAgentReasoning)||!t?null:O.jsx(Nh,{summary:O.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[O.jsx(efe,{}),O.jsx("span",{className:"truncate",children:O.jsx("span",{className:"text-ink-dim text-meta",children:e})})]}),children:O.jsx(rm,{content:t,className:"[--md-ink:var(--lo-ink-muted)]",styleProps:{fontSize:"var(--text-body-sm)",lineHeight:"var(--text-body-sm--line-height)"}})}),MBe={hunk:"text-ink-muted",added:"text-success",removed:"text-danger",context:"text-ink-dim"},zBe=({line:e})=>O.jsx("span",{className:N(MBe[e.kind],"block"),children:e.text}),LBe=({diff:e,className:t})=>{const n=CFe(e);return O.jsxs("div",{className:N("max-h-[740px] overflow-y-auto overflow-x-hidden rounded-sm border border-hairline bg-sunken p-3 font-mono text-ink text-mono-sm whitespace-pre-wrap break-words",t),children:[n.lines.map((r,i)=>O.jsx(zBe,{line:r},i)),n.hidden>0&&O.jsx("span",{className:"sticky -bottom-3 -mb-3 block bg-sunken pb-3 text-ink-dim",children:QFe(n.hidden)})]})},qBe=({content:e,details:t,className:n})=>O.jsxs("section",{"aria-label":"Security notice",className:N("flex gap-3 border-warning border-l-2 py-0.5 pl-3",n),children:[O.jsx(q3e,{className:"mt-0.5 size-4 shrink-0 text-warning","aria-hidden":!0}),O.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[O.jsx("p",{className:"font-medium text-body-sm text-warning",children:"Blocked a risky action"}),e?O.jsx("p",{className:"text-body-sm text-ink-muted",children:e}):null,t?O.jsx(Nh,{summary:O.jsx("span",{className:"text-meta",children:"Show the reviewed code"}),children:t}):null]})]}),UBe=(e,t=72)=>{let i=e.replace(/```[\s\S]*?```/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/\s+/g," ").trim();if(i.length>t){const s=i.slice(0,t),a=s.lastIndexOf(" ");i=`${s.slice(0,a>32?a:t).trimEnd()}…`}return i.replace(/[.!?…]+$/g,"").trimEnd()},cV=e=>e.startsWith("file://")?e.slice(7):e,WBe={READ:{verb:"Read",runningVerb:"Reading",icon:l8},WRITE:{verb:"Wrote",runningVerb:"Writing",icon:p8},EDIT:{verb:"Edited",runningVerb:"Editing",icon:o3e},CODE:{verb:"Ran code",runningVerb:"Running code",icon:c8},DELEGATE:{verb:"Delegated work",runningVerb:"Delegating work",icon:z3e},DONE:{verb:"Finished",runningVerb:"Finishing",icon:IF},ASK:{verb:"Asked",runningVerb:"Asking",icon:MC},BYE:{verb:"Ended the conversation",runningVerb:"Ending",icon:TRe}},jBe={verb:"Worked on the request",runningVerb:"Working on the request",icon:c8},GBe=(e,t,n,r)=>{const i=e?WBe[e]:jBe;let s;if(t)s=cV(t);else if(n&&n.length>0){const o=n.filter(l=>!l.startsWith("data:"));o.length===1?s=cV(o[0]):o.length>1&&(s=`${o.length} files`)}const a=!s&&r?UBe(r):"";return{verb:i.verb,runningVerb:i.runningVerb,object:s,narration:a||void 0,icon:i.icon}},uV="min-h-5 py-0",VBe=({icon:e,verb:t,object:n,narration:r,running:i,failed:s,wrap:a})=>O.jsxs("span",{className:N("flex min-w-0 gap-2",a?"items-start":"items-center"),"aria-busy":i||void 0,children:[O.jsx(efe,{className:N(s?"text-danger":"text-ink-dim",a&&Jhe),children:e}),O.jsxs("span",{className:N(a?"min-w-0 whitespace-pre-wrap break-words":"truncate"),children:[O.jsxs("span",{...bR,className:N("select-text font-mono text-mono-sm",i?"text-ink-muted":"text-ink-dim",s&&"text-danger"),children:[t,r?":":null]}),n?O.jsxs("span",{...bR,className:"select-text font-mono text-ink-muted text-mono-sm",children:[" ",n]}):null,r?O.jsxs("span",{...bR,className:"select-text text-body-sm text-ink-muted",children:[" ",r]}):null]})]}),DP=({action:e,filePath:t,files:n,narration:r,running:i=!1,failed:s=!1,defaultOpen:a=!1,details:o,className:l,verbOverride:c,object:u,glyph:d,wrap:h,dense:f=!1})=>{const p=GBe(e,t,n,r),g=c??(i?p.runningVerb:p.verb),m=s?hg:p.icon,v=s||!c||!d?O.jsx(m,{}):d,b=O.jsx(VBe,{icon:v,verb:g,object:c?u:p.object,narration:c?r:p.narration,running:i,failed:s,wrap:h}),y=h?"firstLine":"center";return o?O.jsx(Nh,{summary:b,chevron:"leading",summaryAlign:y,defaultOpen:a,className:l,rowClassName:f?uV:void 0,triggerClassName:"-mx-2 rounded-sm px-2 hover:bg-elevated",children:o}):O.jsx(Nh,{disabled:!0,summary:b,summaryAlign:y,className:l,rowClassName:f?uV:void 0})},tfe=8,YBe="… deeper values not shown",BBe="(empty)";function ZBe(e){return`… ${e} more line${e===1?"":"s"}`}const dV=.5;function HBe(e,t,n,r){if(!Number.isFinite(t)||t<=0)return 0;let i=0;for(const s of e){if(s.height<=0)continue;const a=Math.max(1,Math.round(s.height/t));for(let o=1;o<=a;o++)s.top+o*t>n+r&&i++}return i}function nfe(e){return e==null?"null":typeof e=="string"?e.trim()||null:typeof e=="number"||typeof e=="boolean"?String(e):null}function L7(e){return typeof e=="object"&&e!==null}function rfe(e,t,n,r){if(n>tfe){r.push({key:t,value:YBe,depth:n});return}if(L7(e)){for(const[s,a]of Object.entries(e))rfe(a,t?`${t}.${s}`:s,n+1,r);return}const i=nfe(e);i!==null&&r.push({key:t,value:i,depth:n})}function ife(e){if(!e)return[];const t=[];for(const[n,r]of Object.entries(e))rfe(r,n,1,t);return t}const KBe=512;function JBe(e,t){if(t)return!0;if(!e)return!1;let n=KBe;const r=(i,s)=>{if(n--<=0||s>tfe)return!0;if(!L7(i))return nfe(i)!==null;for(const a of Object.values(i))if(r(a,s+1))return!0;return!1};for(const i of Object.values(e))if(r(i,1))return!0;return!1}function eZe(e){if(!e)return null;const t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return null;let n;try{n=JSON.parse(t)}catch{return null}if(!L7(n))return null;const r=ife(n);return r.length>0?r:[{key:"",value:BBe,depth:1}]}const tZe=8,hV="max-h-[240px]",nZe=({line:e})=>O.jsxs("div",{className:N("whitespace-pre-wrap break-words"),style:{paddingInlineStart:(e.depth-1)*tZe},children:[e.key?O.jsxs("span",{className:N("text-ink-dim"),children:[e.key,": "]}):null,O.jsx("span",{className:N("text-ink-muted"),children:e.value})]}),fV=({lines:e,label:t})=>O.jsx("div",{className:N("flex flex-col gap-1"),"data-detail-lines":t,children:e.map((n,r)=>O.jsx(nZe,{line:n},r))});function OV(e){const[t,n]=w.useState(0),[r,i]=w.useState(!1);return w.useLayoutEffect(()=>{const s=e.current;if(!s)return;const a=s.firstElementChild,o=()=>{const c=a??s,u=Number.parseFloat(getComputedStyle(c).lineHeight);if(!Number.isFinite(u)||u<=0){n(0),i(!1);return}const d=s.getBoundingClientRect(),h=c.getBoundingClientRect();i(h.height>d.height+dV);const f=c.children.length>0?Array.from(c.children):[c];n(HBe(f.map(p=>{const g=p.getBoundingClientRect();return{top:g.top,height:g.height}}),u,d.bottom,dV))};o(),s.addEventListener("scroll",o,{passive:!0});const l=new ResizeObserver(o);return l.observe(a??s),()=>{s.removeEventListener("scroll",o),l.disconnect()}}),{lines:t,overflowing:r}}const pV=({lines:e,overflowing:t})=>t?O.jsx("span",{className:N("mt-1 block text-ink-dim"),children:e>0?ZBe(e):" "}):null,rZe=({args:e,output:t,isError:n})=>{const r=ife(e),i=eZe(t),s=w.useRef(null),a=w.useRef(null),o=OV(s),l=OV(a);return r.length===0&&!t?null:O.jsxs("div",{className:N("w-full rounded-sm border border-hairline bg-sunken p-3 font-mono text-mono-sm"),children:[r.length>0&&O.jsxs("div",{"data-detail-section":"input",children:[O.jsx("div",{ref:s,className:N(hV,"overflow-auto"),children:O.jsx(fV,{lines:r,label:"input"})}),O.jsx(pV,{lines:o.lines,overflowing:o.overflowing})]}),t&&O.jsxs("div",{className:N(r.length>0&&"mt-3"),"data-detail-section":"output",children:[O.jsx("span",{className:N("mb-1 block text-meta",n?"text-danger":"text-ink-dim"),children:n?"Error":"Output"}),O.jsx("div",{ref:a,className:N(hV,"overflow-auto"),children:i?O.jsx(fV,{lines:i,label:"result-json"}):O.jsx("pre",{className:N("whitespace-pre font-mono",n?"text-danger":"text-ink"),children:t})}),O.jsx(pV,{lines:l.lines,overflowing:l.overflowing})]})]})},iZe="mcp__",sZe={bash:fAe,read:dO,write:PU,edit:PU,glob:Xy,grep:UC,todo:k4e,wake:zC,list_variables:aP,read_variable:aP,browser:CU,web_search:CU,web_fetch:uO,task:bh,agent:bh,send:v8,peer:O4e};function aZe(e){const t=e.trim().toLowerCase(),n=sZe[t];return n||(t.startsWith(iZe)?g8:I_e)}const oZe=Tl,lZe=Ts,cZe=_oe,gV="min-h-5 py-0",uZe={read:"text-info",mutate:"text-ink-muted",exec:"text-ink-muted",meta:"text-accent",plain:"text-ink-muted"},dZe=(e,t)=>e==="running"?"text-ink":e==="error"?"text-danger":e==="receipt"?"text-ink-muted":uZe[vFe(t)],hZe=({added:e,removed:t})=>e<=0&&t<=0?null:O.jsxs("span",{className:N("hidden shrink-0 gap-1 font-mono text-mono-sm tabular-nums @[34rem]/toolrow:flex"),children:[e>0&&O.jsxs("span",{className:N("text-success"),children:["+",e]}),t>0&&O.jsxs("span",{className:N("text-danger"),children:["-",t]})]}),mV={running:"",success:"succeeded",error:"failed",interrupted:"interrupted",receipt:""},fZe=1e3;function OZe(e){const[t,n]=w.useState(()=>e===null?null:Math.max(0,(Date.now()-e)/1e3));return w.useEffect(()=>{if(e===null){n(null);return}const r=()=>n(Math.max(0,(Date.now()-e)/1e3));r();const i=window.setInterval(r,fZe);return()=>window.clearInterval(i)},[e]),t}const pZe=({outcome:e,durationS:t,startedAt:n})=>{const r=e==="running",i=OZe(r?n??null:null),s=e==="success"?oZe:e==="error"?lZe:e==="interrupted"?cZe:null,a=e==="success"?"text-success":e==="error"?"text-danger":"text-ink-dim",o=r?n==null?"":L8(i??0):pFe(t);return O.jsxs("span",{className:N("flex shrink-0 items-center gap-1.5"),children:[O.jsxs("span",{className:N("flex size-3.5 shrink-0 [&_svg]:size-3.5",a),children:[s?O.jsx(s,{"aria-hidden":!0}):null,mV[e]?O.jsx("span",{className:N("sr-only"),children:mV[e]}):null]}),O.jsx("span",{className:N("w-[5ch] text-right font-mono text-ink-dim text-mono-sm tabular-nums"),children:o})]})},IP=({toolName:e,summary:t,summaryFallback:n=null,outcome:r,durationS:i,startedAt:s=null,added:a=0,removed:o=0,nameColumn:l=tce,details:c,defaultOpen:u=!1,className:d,media:h})=>{const f=r==="running",p=r==="error",g=aZe(e),m=nx(e),v=ece(t,e)?n??"":t,b=O.jsxs("span",{className:N("flex min-w-0 flex-1 items-center gap-2"),children:[O.jsx("span",{"aria-hidden":!0,className:N("flex size-3.5 shrink-0 [&_svg]:size-3.5",f?"text-accent":p?"text-danger":"text-ink-dim"),children:O.jsx(g,{})}),O.jsx("span",{className:N("shrink-0 truncate font-mono text-mono-sm","pr-1",dZe(r,e)),style:{width:`calc(${l}ch + 0.25rem)`},title:m,children:m}),O.jsx("span",{className:N("min-w-0 flex-1 truncate font-mono text-mono-sm",f?"text-ink-muted":"text-ink-dim"),title:v,children:v}),O.jsx(hZe,{added:a,removed:o}),O.jsx(pZe,{outcome:r,durationS:i,startedAt:s})]}),y=f?"bg-elevated":p?"bg-danger-wash":"hover:bg-elevated",T=c?O.jsx(Nh,{summary:b,chevron:"leading",defaultOpen:u,className:N("@container/toolrow",d),rowClassName:gV,triggerClassName:N("-mx-2 rounded-sm px-2",y),children:c}):O.jsx(Nh,{disabled:!0,summary:b,rowClassName:gV,className:N("@container/toolrow",(f||p)&&N("-mx-2 rounded-sm px-2",y),d)});return h?O.jsxs("div",{className:N("flex flex-col"),children:[T,h]}):T},sfe=e=>{const t=w.useCallback(r=>{const i=window.matchMedia(e);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[e]),n=w.useCallback(()=>window.matchMedia(e).matches,[e]);return w.useSyncExternalStore(t,n,()=>!1)},vV=["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"],gZe=80,mZe=1e3,vZe=({activity:e,phase:t,className:n})=>{const[r,i]=w.useState(0),[s,a]=w.useState(0),o=sfe("(prefers-reduced-motion: reduce)"),l=w.useRef(Date.now()),c=w.useRef(t);return c.current!==t&&(c.current=t,l.current=Date.now(),a(0)),w.useEffect(()=>{const u=window.setInterval(()=>a(Math.floor((Date.now()-l.current)/1e3)),mZe);if(o)return i(0),()=>window.clearInterval(u);const d=window.setInterval(()=>i(h=>(h+1)%vV.length),gZe);return()=>{window.clearInterval(d),window.clearInterval(u)}},[o]),O.jsxs("div",{className:N("flex items-center gap-2",n),"data-lo-working-line":!0,"aria-live":"polite",children:[O.jsx("span",{"aria-hidden":!0,className:N("w-[1ch] shrink-0 select-none font-mono text-ink-muted text-mono-sm"),children:vV[r]}),O.jsx("span",{className:N("min-w-0 truncate font-mono text-ink-dim text-mono-sm"),children:e}),O.jsx("span",{"aria-hidden":!0,className:N("w-[6ch] shrink-0 font-mono text-ink-dim text-mono-sm tabular-nums"),children:L8(s)})]})},afe=({children:e,className:t})=>O.jsx("div",{className:N("flex max-w-full items-center justify-center overflow-hidden","min-h-16 min-w-16 rounded-sm border border-hairline bg-sunken",t),children:e}),bZe="could not be displayed. It may have been moved, renamed, or deleted.",wZe="could not be displayed. Its stored copy is not available to this reader.",q7=({name:e,detail:t=bZe,className:n})=>O.jsxs("div",{className:N("flex w-fit max-w-full items-center gap-2.5 rounded-sm border border-hairline bg-sunken px-3 py-2",n),children:[O.jsx(d4e,{className:"size-4 shrink-0 text-ink-dim","aria-hidden":!0}),O.jsxs("span",{className:"min-w-0 text-body-sm text-ink-muted",children:[O.jsx("span",{className:"truncate font-mono text-ink text-mono-sm",children:e}),` ${t}`]})]}),vQ=({filePath:e,tooltip:t="File actions",icon:n,"aria-label":r="File actions",onShowInCanvas:i})=>{const s=async()=>{if(e)try{await navigator.clipboard.writeText(e),us("File path copied to clipboard")}catch(o){console.error("Failed to copy file path: ",o),Kn("Failed to copy file path")}},a=()=>{e&&window.api.openFile(e)};return O.jsxs(pS,{children:[O.jsx(pt,{content:t,children:O.jsx(Ov,{asChild:!0,children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":r,onClick:o=>o.stopPropagation(),children:n??O.jsx(u8,{"aria-hidden":"true"})})})}),O.jsxs(gS,{align:"end",className:"min-w-45",onClick:o=>o.stopPropagation(),children:[i&&O.jsxs(is,{onSelect:i,children:[O.jsx(y4e,{"aria-hidden":"true"}),O.jsx("span",{children:"Show in canvas"})]}),O.jsxs(is,{onSelect:a,children:[O.jsx(O1,{"aria-hidden":"true"}),O.jsx("span",{children:"Open file"})]}),O.jsxs(is,{onSelect:()=>window.api.showItemInFolder(e),children:[O.jsx(Xy,{"aria-hidden":"true"}),O.jsx("span",{children:"Open folder"})]}),O.jsxs(is,{onSelect:s,children:[O.jsx(Coe,{"aria-hidden":"true"}),O.jsx("span",{children:"Copy file path"})]})]})]})},ofe=1024;let yZe=0,ic=class{constructor(t,n){this.from=t,this.to=n}};class En{constructor(t={}){this.id=yZe++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=_s.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}En.closedBy=new En({deserialize:e=>e.split(" ")});En.openedBy=new En({deserialize:e=>e.split(" ")});En.group=new En({deserialize:e=>e.split(" ")});En.isolate=new En({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});En.contextHash=new En({perNode:!0});En.lookAhead=new En({perNode:!0});En.mounted=new En({perNode:!0});class lx{constructor(t,n,r){this.tree=t,this.overlay=n,this.parser=r}static get(t){return t&&t.props&&t.props[En.mounted.id]}}const xZe=Object.create(null);class _s{constructor(t,n,r,i=0){this.name=t,this.props=n,this.id=r,this.flags=i}static define(t){let n=t.props&&t.props.length?Object.create(null):xZe,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new _s(t.name||"",n,t.id,r);if(t.props){for(let s of t.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let n=this.prop(En.group);return n?n.indexOf(t)>-1:!1}return this.id==t}static match(t){let n=Object.create(null);for(let r in t)for(let i of r.split(" "))n[i]=t[r];return r=>{for(let i=r.prop(En.group),s=-1;s<(i?i.length:0);s++){let a=n[s<0?r.name:i[s]];if(a)return a}}}}_s.none=new _s("",Object.create(null),0,8);class k1{constructor(t){this.types=t;for(let n=0;n<t.length;n++)if(t[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let n=[];for(let r of this.types){let i=null;for(let s of t){let a=s(r);a&&(i||(i=Object.assign({},r.props)),i[a[0].id]=a[1])}n.push(i?new _s(r.name,i,r.id,r.flags):r)}return new k1(n)}}const B$=new WeakMap,bV=new WeakMap;var ri;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"})(ri||(ri={}));class ur{constructor(t,n,r,i,s){if(this.type=t,this.children=n,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[a,o]of s)this.props[typeof a=="number"?a:a.id]=o}}toString(){let t=lx.get(this);if(t&&!t.overlay)return t.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(t=0){return new NP(this.topNode,t)}cursorAt(t,n=0,r=0){let i=B$.get(this)||this.topNode,s=new NP(i);return s.moveTo(t,n),B$.set(this,s._tree),s}get topNode(){return new La(this,0,0,null)}resolve(t,n=0){let r=cx(B$.get(this)||this.topNode,t,n,!1);return B$.set(this,r),r}resolveInner(t,n=0){let r=cx(bV.get(this)||this.topNode,t,n,!0);return bV.set(this,r),r}resolveStack(t,n=0){return kZe(this,t,n)}iterate(t){let{enter:n,leave:r,from:i=0,to:s=this.length}=t,a=t.mode||0,o=(a&ri.IncludeAnonymous)>0;for(let l=this.cursor(a|ri.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!o&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(o||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let n in this.props)t.push([+n,this.props[n]]);return t}balance(t={}){return this.children.length<=8?this:j7(_s.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new ur(this.type,n,r,i,this.propValues),t.makeTree||((n,r,i)=>new ur(_s.none,n,r,i)))}static build(t){return TZe(t)}}ur.empty=new ur(_s.none,[],[],0);class U7{constructor(t,n){this.buffer=t,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new U7(this.buffer,this.index)}}class xO{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return _s.none}toString(){let t=[];for(let n=0;n<this.buffer.length;)t.push(this.childString(n)),n=this.buffer[n+3];return t.join(",")}childString(t){let n=this.buffer[t],r=this.buffer[t+3],i=this.set.types[n],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),t+=4,r==t)return s;let a=[];for(;t<r;)a.push(this.childString(t)),t=this.buffer[t+3];return s+"("+a.join(",")+")"}findChild(t,n,r,i,s){let{buffer:a}=this,o=-1;for(let l=t;l!=n&&!(lfe(s,i,a[l+1],a[l+2])&&(o=l,r>0));l=a[l+3]);return o}slice(t,n,r){let i=this.buffer,s=new Uint16Array(n-t),a=0;for(let o=t,l=0;o<n;){s[l++]=i[o++],s[l++]=i[o++]-r;let c=s[l++]=i[o++]-r;s[l++]=i[o++]-t,a=Math.max(a,c)}return new xO(s,a,this.set)}}function lfe(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function cx(e,t,n,r){for(var i;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let a=!r&&e instanceof La&&e.index<0?null:e.parent;if(!a)return e;e=a}let s=r?0:ri.IgnoreOverlays;if(r)for(let a=e,o=a.parent;o;a=o,o=a.parent)a instanceof La&&a.index<0&&((i=o.enter(t,n,s))===null||i===void 0?void 0:i.from)!=a.from&&(e=o);for(;;){let a=e.enter(t,n,s);if(!a)return e;e=a}}class cfe{cursor(t=0){return new NP(this,t)}getChild(t,n=null,r=null){let i=wV(this,t,n,r);return i.length?i[0]:null}getChildren(t,n=null,r=null){return wV(this,t,n,r)}resolve(t,n=0){return cx(this,t,n,!1)}resolveInner(t,n=0){return cx(this,t,n,!0)}matchContext(t){return yD(this.parent,t)}enterUnfinishedNodesBefore(t){let n=this.childBefore(t),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}class La extends cfe{constructor(t,n,r,i){super(),this._tree=t,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,i,s=0){for(let a=this;;){for(let{children:o,positions:l}=a._tree,c=n>0?o.length:-1;t!=c;t+=n){let u=o[t],d=l[t]+a.from;if(lfe(i,r,d,d+u.length)){if(u instanceof xO){if(s&ri.ExcludeBuffers)continue;let h=u.findChild(0,u.buffer.length,n,r-d,i);if(h>-1)return new Ku(new SZe(a,u,t,d),null,h)}else if(s&ri.IncludeAnonymous||!u.type.isAnonymous||W7(u)){let h;if(!(s&ri.IgnoreMounts)&&(h=lx.get(u))&&!h.overlay)return new La(h.tree,d,t,a);let f=new La(u,d,t,a);return s&ri.IncludeAnonymous||!f.type.isAnonymous?f:f.nextChild(n<0?u.children.length-1:0,n,r,i)}}}if(s&ri.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?t=a.index+n:t=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,n,r=0){let i;if(!(r&ri.IgnoreOverlays)&&(i=lx.get(this._tree))&&i.overlay){let s=t-this.from;for(let{from:a,to:o}of i.overlay)if((n>0?a<=s:a<s)&&(n<0?o>=s:o>s))return new La(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function wV(e,t,n,r){let i=e.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let a=!1;!a;)if(a=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(t)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function yD(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class SZe{constructor(t,n,r,i){this.parent=t,this.buffer=n,this.index=r,this.start=i}}class Ku extends cfe{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,n,r){super(),this.context=t,this._parent=n,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}child(t,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return s<0?null:new Ku(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,n,r=0){if(r&ri.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return s<0?null:new Ku(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Ku(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Ku(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let a=r.buffer[this.index+1];t.push(r.slice(i,s,a)),n.push(0)}return new ur(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ufe(e){if(!e.length)return null;let t=0,n=e[0];for(let s=1;s<e.length;s++){let a=e[s];(a.from>n.from||a.to<n.to)&&(n=a,t=s)}let r=n instanceof La&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new $Ze(i,n)}class $Ze{constructor(t,n){this.heads=t,this.node=n}get next(){return ufe(this.heads)}}function kZe(e,t,n){let r=e.resolveInner(t,n),i=null;for(let s=r instanceof La?r:r.context.parent;s;s=s.parent)if(s.index<0){let a=s.parent;(i||(i=[r])).push(a.resolve(t,n)),s=a}else{let a=lx.get(s.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new La(a.tree,a.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(cx(o,t,n,!1))}}return i?ufe(i):r}class NP{get name(){return this.type.name}constructor(t,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof La)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let r=t._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,n){this.index=t;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[t]],this.from=r+i.buffer[t+1],this.to=r+i.buffer[t+2],!0}yield(t){return t?t instanceof La?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,n,r=this.mode){return this.buffer?r&ri.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ri.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&ri.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(t<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let n,r,{buffer:i}=this;if(i){if(t>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let s=n+t,a=t<0?-1:r._tree.children.length;s!=a;s+=t){let o=r._tree.children[s];if(this.mode&ri.IncludeAnonymous||o instanceof xO||!o.type.isAnonymous||W7(o))return!1}return!0}move(t,n){if(n&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,n=0){for(;(this.from==this.to||(n<1?this.from>=t:this.from>t)||(n>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,n););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,n=null,r=0;if(t&&t.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let a=t;a;a=a._parent)if(a.index==i){if(i==this.index)return a;n=a,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)n=new Ku(this.buffer,n,this.stack[i]);return this.bufferNode=new Ku(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(t){if(!this.buffer)return yD(this.node.parent,t);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=t.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return yD(this._tree,t,i);let a=r[n.buffer[this.stack[s]]];if(!a.isAnonymous){if(t[i]&&t[i]!=a.name)return!1;i--}}return!0}}function W7(e){return e.children.some(t=>t instanceof xO||!t.type.isAnonymous||W7(t))}function TZe(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=ofe,reused:s=[],minRepeatType:a=r.types.length}=e,o=Array.isArray(n)?new U7(n,n.length):n,l=r.types,c=0,u=0;function d(x,S,k,Q,C,_){let{id:R,start:A,end:I,size:W}=o,G=u,U=c;for(;W<0;)if(o.next(),W==-1){let K=s[R];k.push(K),Q.push(A-x);return}else if(W==-3){c=R;return}else if(W==-4){u=R;return}else throw new RangeError(`Unrecognized record size: ${W}`);let q=l[R],B,j,M=A-x;if(I-A<=i&&(j=m(o.pos-S,C))){let K=new Uint16Array(j.size-j.skip),F=o.pos-j.size,X=K.length;for(;o.pos>F;)X=v(j.start,K,X);B=new xO(K,I-j.start,r),M=j.start-x}else{let K=o.pos-W;o.next();let F=[],X=[],V=R>=a?R:-1,L=0,H=I;for(;o.pos>K;)V>=0&&o.id==V&&o.size>=0?(o.end<=H-i&&(p(F,X,A,L,o.end,H,V,G,U),L=F.length,H=o.end),o.next()):_>2500?h(A,K,F,X):d(A,K,F,X,V,_+1);if(V>=0&&L>0&&L<F.length&&p(F,X,A,L,A,H,V,G,U),F.reverse(),X.reverse(),V>-1&&L>0){let ue=f(q,U);B=j7(q,F,X,0,F.length,0,I-A,ue,ue)}else B=g(q,F,X,I-A,G-I,U)}k.push(B),Q.push(M)}function h(x,S,k,Q){let C=[],_=0,R=-1;for(;o.pos>S;){let{id:A,start:I,end:W,size:G}=o;if(G>4)o.next();else{if(R>-1&&I<R)break;R<0&&(R=W-i),C.push(A,I,W),_++,o.next()}}if(_){let A=new Uint16Array(_*4),I=C[C.length-2];for(let W=C.length-3,G=0;W>=0;W-=3)A[G++]=C[W],A[G++]=C[W+1]-I,A[G++]=C[W+2]-I,A[G++]=G;k.push(new xO(A,C[2]-I,r)),Q.push(I-x)}}function f(x,S){return(k,Q,C)=>{let _=0,R=k.length-1,A,I;if(R>=0&&(A=k[R])instanceof ur){if(!R&&A.type==x&&A.length==C)return A;(I=A.prop(En.lookAhead))&&(_=Q[R]+A.length+I)}return g(x,k,Q,C,_,S)}}function p(x,S,k,Q,C,_,R,A,I){let W=[],G=[];for(;x.length>Q;)W.push(x.pop()),G.push(S.pop()+k-C);x.push(g(r.types[R],W,G,_-C,A-_,I)),S.push(C-k)}function g(x,S,k,Q,C,_,R){if(_){let A=[En.contextHash,_];R=R?[A].concat(R):[A]}if(C>25){let A=[En.lookAhead,C];R=R?[A].concat(R):[A]}return new ur(x,S,k,Q,R)}function m(x,S){let k=o.fork(),Q=0,C=0,_=0,R=k.end-i,A={size:0,start:0,skip:0};e:for(let I=k.pos-x;k.pos>I;){let W=k.size;if(k.id==S&&W>=0){A.size=Q,A.start=C,A.skip=_,_+=4,Q+=4,k.next();continue}let G=k.pos-W;if(W<0||G<I||k.start<R)break;let U=k.id>=a?4:0,q=k.start;for(k.next();k.pos>G;){if(k.size<0)if(k.size==-3)U+=4;else break e;else k.id>=a&&(U+=4);k.next()}C=q,Q+=W,_+=U}return(S<0||Q==x)&&(A.size=Q,A.start=C,A.skip=_),A.size>4?A:void 0}function v(x,S,k){let{id:Q,start:C,end:_,size:R}=o;if(o.next(),R>=0&&Q<a){let A=k;if(R>4){let I=o.pos-(R-4);for(;o.pos>I;)k=v(x,S,k)}S[--k]=A,S[--k]=_-x,S[--k]=C-x,S[--k]=Q}else R==-3?c=Q:R==-4&&(u=Q);return k}let b=[],y=[];for(;o.pos>0;)d(e.start||0,e.bufferStart||0,b,y,-1,0);let T=(t=e.length)!==null&&t!==void 0?t:b.length?y[0]+b[0].length:0;return new ur(l[e.topID],b.reverse(),y.reverse(),T)}const yV=new WeakMap;function JT(e,t){if(!e.isAnonymous||t instanceof xO||t.type!=e)return 1;let n=yV.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof ur)){n=1;break}n+=JT(e,r)}yV.set(t,n)}return n}function j7(e,t,n,r,i,s,a,o,l){let c=0;for(let p=r;p<i;p++)c+=JT(e,t[p]);let u=Math.ceil(c*1.5/8),d=[],h=[];function f(p,g,m,v,b){for(let y=m;y<v;){let T=y,x=g[y],S=JT(e,p[y]);for(y++;y<v;y++){let k=JT(e,p[y]);if(S+k>=u)break;S+=k}if(y==T+1){if(S>u){let k=p[T];f(k.children,k.positions,0,k.children.length,g[T]+b);continue}d.push(p[T])}else{let k=g[y-1]+p[y-1].length-x;d.push(j7(e,p,g,T,y,x,k,null,l))}h.push(x+b-s)}}return f(t,n,r,i,0),(o||l)(d,h,a)}class G7{constructor(){this.map=new WeakMap}setBuffer(t,n,r){let i=this.map.get(t);i||this.map.set(t,i=new Map),i.set(n,r)}getBuffer(t,n){let r=this.map.get(t);return r&&r.get(n)}set(t,n){t instanceof Ku?this.setBuffer(t.context.buffer,t.index,n):t instanceof La&&this.map.set(t.tree,n)}get(t){return t instanceof Ku?this.getBuffer(t.context.buffer,t.index):t instanceof La?this.map.get(t.tree):void 0}cursorSet(t,n){t.buffer?this.setBuffer(t.buffer.buffer,t.index,n):this.map.set(t.tree,n)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class xh{constructor(t,n,r,i,s=!1,a=!1){this.from=t,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new xh(0,t.length,t,0,!1,r)];for(let s of n)s.to>t.length&&i.push(s);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],s=1,a=t.length?t[0]:null;for(let o=0,l=0,c=0;;o++){let u=o<n.length?n[o]:null,d=u?u.fromA:1e9;if(d-l>=r)for(;a&&a.from<d;){let h=a;if(l>=h.from||d<=h.to||c){let f=Math.max(h.from,l)-c,p=Math.min(h.to,d)-c;h=f>=p?null:new xh(f,p,h.tree,h.offset+c,o>0,!!u)}if(h&&i.push(h),a.to>d)break;a=s<t.length?t[s++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}let bQ=class{startParse(t,n,r){return typeof t=="string"&&(t=new PZe(t)),r=r?r.length?r.map(i=>new ic(i.from,i.to)):[new ic(0,0)]:[new ic(0,t.length)],this.createParse(t,n||[],r)}parse(t,n,r){let i=this.startParse(t,n,r);for(;;){let s=i.advance();if(s)return s}}};class PZe{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,n){return this.string.slice(t,n)}}function $c(e){return(t,n,r,i)=>new CZe(t,e,n,r,i)}class xV{constructor(t,n,r,i,s){this.parser=t,this.parse=n,this.overlay=r,this.target=i,this.from=s}}function SV(e){if(!e.length||e.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class _Ze{constructor(t,n,r,i,s,a,o){this.parser=t,this.predicate=n,this.mounts=r,this.index=i,this.start=s,this.target=a,this.prev=o,this.depth=0,this.ranges=[]}}const xD=new En({perNode:!0});class CZe{constructor(t,n,r,i,s){this.nest=n,this.input=r,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new ur(r.type,r.children,r.positions,r.length,r.propValues.concat([[xD,this.stoppedAt]]))),r}let t=this.inner[this.innerDone],n=t.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),t.target.props);r[En.mounted.id]=new lx(n,t.overlay,t.parser),t.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].from<t&&(t=Math.min(t,this.inner[n].parse.parsedPos));return t}stopAt(t){if(this.stoppedAt=t,this.baseParse)this.baseParse.stopAt(t);else for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].parse.stopAt(t)}startInner(){let t=new RZe(this.fragments),n=null,r=null,i=new NP(new La(this.baseTree,this.ranges[0].from,0,null),ri.IncludeAnonymous|ri.IgnoreMounts);e:for(let s,a;;){let o=!0,l;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)o=!1;else if(t.hasNode(i)){if(n){let c=n.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let d=u.from+c.pos,h=u.to+c.pos;d>=i.from&&h<=i.to&&!n.ranges.some(f=>f.from<h&&f.to>d)&&n.ranges.push({from:d,to:h})}}o=!1}else if(r&&(a=QZe(r.ranges,i.from,i.to)))o=a!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||EZe(i);let c=t.findMounts(i.from,s.parser);if(typeof s.overlay=="function")n=new _Ze(s.parser,s.overlay,c,this.inner.length,i.from,i.tree,n);else{let u=TV(this.ranges,s.overlay||(i.from<i.to?[new ic(i.from,i.to)]:[]));u.length&&SV(u),(u.length||!s.overlay)&&this.inner.push(new xV(s.parser,u.length?s.parser.startParse(this.input,PV(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(d=>new ic(d.from-i.from,d.to-i.from)):null,i.tree,u.length?u[0].from:i.from)),s.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):o=!1}}else if(n&&(l=n.predicate(i))&&(l===!0&&(l=new ic(i.from,i.to)),l.from<l.to)){let c=n.ranges.length-1;c>=0&&n.ranges[c].to==l.from?n.ranges[c]={from:n.ranges[c].from,to:l.to}:n.ranges.push(l)}if(o&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let c=TV(this.ranges,n.ranges);c.length&&(SV(c),this.inner.splice(n.index,0,new xV(n.parser,n.parser.startParse(this.input,PV(n.mounts,c),c),n.ranges.map(u=>new ic(u.from-n.start,u.to-n.start)),n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function QZe(e,t,n){for(let r of e){if(r.from>=n)break;if(r.to>t)return r.from<=t&&r.to>=n?2:1}return 0}function $V(e,t,n,r,i,s){if(t<n){let a=e.buffer[t+1];r.push(e.slice(t,n,a)),i.push(a-s)}}function EZe(e){let{node:t}=e,n=[],r=t.context.buffer;do n.push(e.index),e.parent();while(!e.tree);let i=e.tree,s=i.children.indexOf(r),a=i.children[s],o=a.buffer,l=[s];function c(u,d,h,f,p,g){let m=n[g],v=[],b=[];$V(a,u,m,v,b,f);let y=o[m+1],T=o[m+2];l.push(v.length);let x=g?c(m+4,o[m+3],a.set.types[o[m]],y,T-y,g-1):t.toTree();return v.push(x),b.push(y-f),$V(a,o[m+3],d,v,b,f),new ur(h,v,b,p)}i.children[s]=c(0,o.length,_s.none,0,a.length,n.length-1);for(let u of l){let d=e.tree.children[u],h=e.tree.positions[u];e.yield(new La(d,h+e.from,u,e._tree))}}class kV{constructor(t,n){this.offset=n,this.done=!1,this.cursor=t.cursor(ri.IncludeAnonymous|ri.IgnoreMounts)}moveTo(t){let{cursor:n}=this,r=t-this.offset;for(;!this.done&&n.from<r;)n.to>=t&&n.enter(r,1,ri.IgnoreOverlays|ri.ExcludeBuffers)||n.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==t.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof ur)n=n.children[0];else break}return!1}}let RZe=class{constructor(t){var n;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let r=this.curFrag=t[0];this.curTo=(n=r.tree.prop(xD))!==null&&n!==void 0?n:r.to,this.inner=new kV(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(t=n.tree.prop(xD))!==null&&t!==void 0?t:n.to,this.inner=new kV(n.tree,-n.offset)}}findMounts(t,n){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let s=this.inner.cursor.node;s;s=s.parent){let a=(r=s.tree)===null||r===void 0?void 0:r.prop(En.mounted);if(a&&a.parser==n)for(let o=this.fragI;o<this.fragments.length;o++){let l=this.fragments[o];if(l.from>=s.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:s.from-l.offset,mount:a})}}}return i}};function TV(e,t){let n=null,r=t;for(let i=1,s=0;i<e.length;i++){let a=e[i-1].to,o=e[i].from;for(;s<r.length;s++){let l=r[s];if(l.from>=o)break;l.to<=a||(n||(r=n=t.slice()),l.from<a?(n[s]=new ic(l.from,a),l.to>o&&n.splice(s+1,0,new ic(o,l.to))):l.to>o?n[s--]=new ic(o,l.to):n.splice(s--,1))}}return r}function AZe(e,t,n,r){let i=0,s=0,a=!1,o=!1,l=-1e9,c=[];for(;;){let u=i==e.length?1e9:a?e[i].to:e[i].from,d=s==t.length?1e9:o?t[s].to:t[s].from;if(a!=o){let h=Math.max(l,n),f=Math.min(u,d,r);h<f&&c.push(new ic(h,f))}if(l=Math.min(u,d),l==1e9)break;u==l&&(a?(a=!1,i++):a=!0),d==l&&(o?(o=!1,s++):o=!0)}return c}function PV(e,t){let n=[];for(let{pos:r,mount:i,frag:s}of e){let a=r+(i.overlay?i.overlay[0].from:0),o=a+i.tree.length,l=Math.max(s.from,a),c=Math.min(s.to,o);if(i.overlay){let u=i.overlay.map(h=>new ic(h.from+r,h.to+r)),d=AZe(t,u,l,c);for(let h=0,f=l;;h++){let p=h==d.length,g=p?c:d[h].from;if(g>f&&n.push(new xh(f,g,i.tree,-a,s.from>=f||s.openStart,s.to<=g||s.openEnd)),p)break;f=d[h].to}}else n.push(new xh(l,c,i.tree,-a,s.from>=a||s.openStart,s.to<=o||s.openEnd))}return n}let SD=[],dfe=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?dfe:SD).push(n=n+e[t])})();function XZe(e){if(e<768)return!1;for(let t=0,n=SD.length;;){let r=t+n>>1;if(e<SD[r])n=r;else if(e>=dfe[r])t=r+1;else return!0;if(t==n)return!1}}function _V(e){return e>=127462&&e<=127487}const CV=8205;function DZe(e,t,n=!0,r=!0){return(n?hfe:IZe)(e,t,r)}function hfe(e,t,n){if(t==e.length)return t;t&&ffe(e.charCodeAt(t))&&Ofe(e.charCodeAt(t-1))&&t--;let r=wR(e,t);for(t+=QV(r);t<e.length;){let i=wR(e,t);if(r==CV||i==CV||n&&XZe(i))t+=QV(i),r=i;else if(_V(i)){let s=0,a=t-2;for(;a>=0&&_V(wR(e,a));)s++,a-=2;if(s%2==0)break;t+=2}else break}return t}function IZe(e,t,n){for(;t>0;){let r=hfe(e,t-2,n);if(r<t)return r;t--}return 0}function wR(e,t){let n=e.charCodeAt(t);if(!Ofe(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return ffe(r)?(n-55296<<10)+(r-56320)+65536:n}function ffe(e){return e>=56320&&e<57344}function Ofe(e){return e>=55296&&e<56320}function QV(e){return e<65536?1:2}let Cr=class pfe{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,n,r){[t,n]=Rv(this,t,n);let i=[];return this.decompose(0,t,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),Wu.from(i,this.length-(n-t)+r.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=Rv(this,t,n);let r=[];return this.decompose(t,n,r,0),Wu.from(r,n-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let n=this.scanIdentical(t,1),r=this.length-this.scanIdentical(t,-1),i=new Aw(this),s=new Aw(t);for(let a=n,o=n;;){if(i.next(a),s.next(a),a=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(o+=i.value.length,i.done||o>=r)return!0}}iter(t=1){return new Aw(this,t)}iterRange(t,n=this.length){return new gfe(this,t,n)}iterLines(t,n){let r;if(t==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(t).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new mfe(r)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?pfe.empty:t.length<=32?new rs(t):Wu.from(rs.split(t,[]))}};class rs extends Cr{constructor(t,n=NZe(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,r,i){for(let s=0;;s++){let a=this.text[s],o=i+a.length;if((n?r:o)>=t)return new FZe(i,o,r,a);i=o+1,r++}}decompose(t,n,r,i){let s=t<=0&&n>=this.length?this:new rs(EV(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let a=r.pop(),o=e2(s.text,a.text.slice(),0,s.length);if(o.length<=32)r.push(new rs(o,a.length+s.length));else{let l=o.length>>1;r.push(new rs(o.slice(0,l)),new rs(o.slice(l)))}}else r.push(s)}replace(t,n,r){if(!(r instanceof rs))return super.replace(t,n,r);[t,n]=Rv(this,t,n);let i=e2(this.text,e2(r.text,EV(this.text,0,t)),n),s=this.length+r.length-(n-t);return i.length<=32?new rs(i,s):Wu.from(rs.split(i,[]),s)}sliceString(t,n=this.length,r=`
|
|
1075
|
+
`,n);if(r===-1)break;const i=BVe(t.slice(n,r));if(e.fence){tYe(i,e.fence)&&(e.fence=null),n=r+1;continue}if(Rhe.test(i)){e.blankRunStart<0&&(e.blankRunStart=n),n=r+1;continue}if(e.blankRunStart>=0){if(e.kind==="none"||!eYe(e.kind,i)){const s=t.slice(e.blockStart,e.blankRunStart);s.trim().length>0&&(e.blocks.push(s),e.revision+=1),e.blockStart=n,e.kind=YG(i)}e.blankRunStart=-1}else e.kind==="none"&&(e.kind=YG(i));if(e.kind!=="indented-code"){const s=ZVe.exec(i);s&&(e.fence={char:s[1][0],length:s[1].length})}n=r+1}e.cursor=n},rYe=e=>{let t=e.length;for(;t>0;){const n=e.charCodeAt(t-1);if(n!==32&&n!==9&&n!==10&&n!==13)break;t-=1}return t},jn="var(--color-ink)",Nd="var(--color-ink-muted)",$u="var(--color-surface)",mf="var(--color-elevated)",Fd="var(--color-sunken)",Sa="var(--color-hairline)",vf="var(--color-control)",Mm="var(--color-accent)",nw="var(--color-accent-wash)",iYe="var(--color-on-accent)",sYe="var(--color-info)",Dhe="var(--color-info-wash)",aYe="var(--color-success)",Ihe="var(--color-success-wash)",oYe="var(--color-warning)",vD="var(--color-warning-wash)",lYe="var(--color-warning-border)",OR="var(--color-danger)",bD="var(--color-danger-wash)",BG=[nw,Dhe,Ihe,vD,bD],bf=e=>getComputedStyle(document.documentElement).getPropertyValue(e).trim(),cYe=()=>{const e={primaryColor:bf("--color-accent"),secondaryColor:bf("--color-success"),tertiaryColor:bf("--color-info"),mainBkg:bf("--color-elevated"),clusterBkg:bf("--color-sunken"),clusterBorder:bf("--color-hairline"),edgeLabelBackground:bf("--color-surface"),quadrant1Fill:bf("--color-accent-wash")};for(const[n,r]of Object.entries(e))r===""&&delete e[n];const t={darkMode:getComputedStyle(document.documentElement).colorScheme.includes("dark"),background:$u,primaryTextColor:jn,primaryBorderColor:vf,secondaryTextColor:jn,secondaryBorderColor:Sa,tertiaryTextColor:jn,tertiaryBorderColor:Sa,lineColor:Nd,arrowheadColor:Nd,textColor:jn,secondBkg:Fd,border1:vf,border2:Sa,labelColor:jn,nodeBkg:mf,nodeBorder:vf,nodeTextColor:jn,defaultLinkColor:Nd,titleColor:jn,noteBkgColor:vD,noteBorderColor:lYe,noteTextColor:jn,actorBkg:mf,actorBorder:vf,actorTextColor:jn,actorLineColor:Sa,signalColor:Nd,signalTextColor:jn,labelBoxBkgColor:mf,labelBoxBorderColor:Sa,labelTextColor:jn,loopTextColor:jn,activationBkgColor:nw,activationBorderColor:Mm,sequenceNumberColor:$u,sectionBkgColor:Fd,sectionBkgColor2:$u,altSectionBkgColor:Fd,excludeBkgColor:Fd,taskBkgColor:nw,taskBorderColor:vf,taskTextColor:jn,taskTextLightColor:jn,taskTextDarkColor:jn,taskTextOutsideColor:jn,taskTextClickableColor:Mm,activeTaskBkgColor:nw,activeTaskBorderColor:Mm,gridColor:Sa,doneTaskBkgColor:Fd,doneTaskBorderColor:Sa,critBkgColor:bD,critBorderColor:OR,todayLineColor:Mm,transitionColor:Nd,transitionLabelColor:jn,stateLabelColor:jn,stateBkg:mf,labelBackgroundColor:$u,compositeBackground:Fd,altBackground:Fd,compositeTitleBackground:mf,compositeBorder:Sa,innerEndBackground:jn,specialStateColor:jn,classText:jn,attributeBackgroundColorOdd:$u,attributeBackgroundColorEven:Fd,rowOdd:$u,rowEven:Fd,errorBkgColor:bD,errorTextColor:OR,pieTitleTextColor:jn,pieSectionTextColor:jn,pieLegendTextColor:jn,pieStrokeColor:$u,pieOuterStrokeColor:Sa,requirementBackground:mf,requirementBorderColor:vf,requirementTextColor:jn,relationColor:Nd,relationLabelBackground:$u,relationLabelColor:jn,branchLabelColor:iYe,commitLabelColor:jn,commitLabelBackground:$u,tagLabelColor:jn,tagLabelBackground:nw,tagLabelBorder:vf,quadrant2Fill:Dhe,quadrant3Fill:Ihe,quadrant4Fill:vD,quadrant2TextFill:jn,quadrant3TextFill:jn,quadrant4TextFill:jn,quadrantPointFill:Mm,archEdgeColor:Nd,archEdgeArrowColor:Nd,archGroupBorderColor:Sa,scaleLabelColor:jn,packet:{startByteColor:jn,endByteColor:jn,labelColor:jn,titleColor:jn,blockStrokeColor:vf,blockFillColor:mf},radar:{axisColor:Nd,axisStrokeWidth:2,axisLabelFontSize:12,curveOpacity:.5,curveStrokeWidth:2,graticuleColor:Sa,graticuleStrokeWidth:1,graticuleOpacity:.3,legendBoxSize:12,legendFontSize:12},xyChart:{backgroundColor:$u,titleColor:jn,xAxisTitleColor:jn,xAxisLabelColor:jn,xAxisTickColor:Sa,xAxisLineColor:Sa,yAxisTitleColor:jn,yAxisLabelColor:jn,yAxisTickColor:Sa,yAxisLineColor:Sa,plotColorPalette:[Mm,sYe,aYe,oYe,OR].join(",")}};for(let n=0;n<5;n++)t[`surface${n}`]=mf,t[`surfacePeer${n}`]=Sa;for(let n=0;n<8;n++)t[`fillType${n}`]=BG[n%BG.length];return{...t,...e}};let pR=null,ZG=null;const uYe=async e=>{pR||(pR=Xe(async()=>{const{default:n}=await import("./mermaid.core-DNwsi5g_.js").then(r=>r.b4);return{default:n}},__vite__mapDeps([0,1,2,3]),import.meta.url).then(({default:n})=>n));const t=await pR;return ZG!==e&&(t.initialize({startOnLoad:!0,theme:"base",securityLevel:"loose",fontFamily:"var(--font-sans)",fontSize:14,suppressErrorRendering:!0,themeVariables:cYe()}),ZG=e),t},HG=({className:e,copied:t,onZoomIn:n,onZoomOut:r,onReset:i,onSave:s,onCopy:a,children:o})=>O.jsxs("div",{className:N("absolute z-10 flex items-center gap-0.5 rounded-md bg-elevated p-1 shadow-overlay",e),children:[O.jsx(pt,{content:"Zoom in",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Zoom in",onClick:n,children:O.jsx(TAe,{})})}),O.jsx(pt,{content:"Zoom out",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Zoom out",onClick:r,children:O.jsx(_Ae,{})})}),O.jsx(pt,{content:"Drag the diagram to pan",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Drag to pan",children:O.jsx(V4e,{})})}),O.jsx(pt,{content:"Reset view",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Reset view",onClick:i,children:O.jsx(m8,{})})}),O.jsx(pt,{content:"Save as SVG",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Save as SVG",onClick:s,children:O.jsx(uO,{})})}),O.jsx(pt,{content:t?"Copied":"Copy mermaid text",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":t?"Copied":"Copy mermaid text",onClick:a,children:O.jsx(em,{className:N(t&&"text-success")})})}),o]}),wD=({title:e,children:t})=>O.jsxs(po,{variant:"danger",role:"alert",className:"my-4",children:[O.jsx(Fse,{children:e}),O.jsx(RC,{children:t})]});class dYe extends w.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(t){return{hasError:!0,error:t}}componentDidCatch(t,n){console.error("Mermaid Error Boundary caught an error:",t,n)}render(){return this.state.hasError?this.props.fallback||O.jsxs(wD,{title:"Mermaid diagram error",children:[this.state.error?.message||"An unexpected error occurred while rendering the diagram"," ","The error was contained within the diagram component."]}):this.props.children}}const hYe=w.memo(({chart:e,id:t})=>{const n=w.useRef(null),r=w.useRef(null),[i,s]=w.useState(null),[a,o]=w.useState(!0),[l,c]=w.useState(""),[u,d]=w.useState(!1),[h,f]=w.useState({scale:1,x:0,y:0}),[p,g]=w.useState({scale:1,x:0,y:0}),[m,v]=w.useState(!1),[b,y]=w.useState({x:0,y:0}),[T,x]=w.useState("idle"),[S,k]=w.useState("idle"),Q=Zn(X=>X.themeName),C=w.useCallback(async()=>{try{if(o(!0),s(null),c(""),!e||typeof e!="string"||e.trim().length===0)throw new Error("Invalid or empty chart content");const X=await uYe(Q),V=t||`mermaid-${Date.now()}-${Math.floor(Math.random()*1e6)}`,{svg:L}=await X.render(V,e);if(!L||typeof L!="string"||L.trim().length===0)throw new Error("Mermaid failed to generate valid SVG output");c(L)}catch(X){console.error("Mermaid rendering error:",X);const V=X instanceof Error?X.message:"Failed to render mermaid diagram";s(V),c("")}finally{o(!1)}},[e,t,Q]);w.useEffect(()=>{C().catch(X=>{console.error("Error in renderDiagram effect:",X),s("Failed to initialize diagram rendering"),o(!1)})},[C]);const _=w.useCallback(()=>{try{if(!l||!r.current)return 1;const V=r.current.getBoundingClientRect(),L=document.createElement("div");L.innerHTML=l;const H=L.querySelector("svg");if(!H)return 1;const ue=H.getBoundingClientRect?.()?.width||Number.parseFloat(H.getAttribute("width")||"0")||H.viewBox?.baseVal?.width||800,ae=H.getBoundingClientRect?.()?.height||Number.parseFloat(H.getAttribute("height")||"0")||H.viewBox?.baseVal?.height||600,de=V.width*.9/ue,ye=V.height*.9/ae;return Math.min(de,ye,1)}catch(X){return console.error("Error calculating fullscreen scale:",X),1}},[l]);w.useEffect(()=>{u&&l&&setTimeout(()=>{try{const X=_();g({scale:X,x:0,y:0})}catch(X){console.error("Error setting fullscreen transform:",X)}},100)},[u,l,_]);const R=w.useCallback((X=!1)=>{try{(X?g:f)(L=>({...L,scale:Math.min(L.scale*1.2,10)}))}catch(V){console.error("Error in zoom in:",V)}},[]),A=w.useCallback((X=!1)=>{try{(X?g:f)(L=>({...L,scale:Math.max(L.scale/1.2,.1)}))}catch(V){console.error("Error in zoom out:",V)}},[]),I=w.useCallback((X=!1)=>{try{const V=X?g:f;if(X){const L=_();V({scale:L,x:0,y:0})}else V({scale:1,x:0,y:0})}catch(V){console.error("Error in reset:",V)}},[_]),W=w.useCallback(()=>{if(l)try{const X=new Blob([l],{type:"image/svg+xml"}),V=URL.createObjectURL(X),L=document.createElement("a");L.href=V,L.download=`mermaid-diagram-${Date.now()}.svg`,document.body.appendChild(L),L.click(),document.body.removeChild(L),URL.revokeObjectURL(V)}catch(X){console.error("Failed to save SVG:",X)}},[l]),G=w.useCallback(async()=>{try{await navigator.clipboard.writeText(e),x("copied"),setTimeout(()=>x("idle"),1200)}catch(X){console.error("Failed to copy Mermaid chart text:",X)}},[e]),U=w.useCallback(async()=>{try{await navigator.clipboard.writeText(e),k("copied"),setTimeout(()=>k("idle"),1200)}catch(X){console.error("Failed to copy Mermaid chart text:",X)}},[e]),q=w.useCallback(X=>{try{v(!0),y({x:X.clientX,y:X.clientY}),X.preventDefault()}catch(V){console.error("Error in mouse down:",V)}},[]),B=w.useCallback((X,V=!1)=>{try{if(!m)return;const L=X.clientX-b.x,H=X.clientY-b.y;(V?g:f)(ae=>({...ae,x:ae.x+L,y:ae.y+H})),y({x:X.clientX,y:X.clientY})}catch(L){console.error("Error in mouse move:",L)}},[m,b]),j=w.useCallback(()=>{try{v(!1)}catch(X){console.error("Error in mouse up:",X)}},[]),M=w.useCallback((X,V=!1)=>{try{X.preventDefault();const L=X.deltaY>0?.9:1.1;(V?g:f)(ue=>({...ue,scale:Math.min(Math.max(ue.scale*L,.1),5)}))}catch(L){console.error("Error in wheel:",L)}},[]),K=w.useCallback(X=>{try{d(X)}catch(V){console.error("Error toggling fullscreen:",V)}},[]);if(i)return O.jsxs(wD,{title:"Mermaid diagram error",children:[i,O.jsx("span",{className:N("mt-2 block text-ink-muted"),children:"Chart"}),O.jsx("span",{className:N("mt-1 block whitespace-pre-wrap font-mono text-mono-sm"),children:e})]});const F=(X=!1)=>{try{const V=X?r:n,L=X?p:h;return O.jsx("div",{ref:V,className:N("mermaid flex w-full items-center justify-center",X?"h-full min-h-full":"h-auto min-h-50",m?"cursor-grabbing":"cursor-grab"),onMouseDown:q,onMouseMove:H=>B(H,X),onMouseUp:j,onMouseLeave:j,onWheel:H=>M(H,X),children:a?O.jsx("div",{className:N("p-4 text-body-sm text-ink-muted"),children:"Loading diagram..."}):l?O.jsx("div",{className:N("flex h-full w-full items-center justify-center"),style:{transform:`translate(${L.x}px, ${L.y}px) scale(${L.scale})`,transformOrigin:"center center"},dangerouslySetInnerHTML:{__html:l}}):null})}catch(V){return console.error("Error rendering diagram content:",V),O.jsx(wD,{title:"Rendering error",children:"Failed to render diagram content."})}};return O.jsxs(O.Fragment,{children:[O.jsxs("div",{className:N("relative flex items-center justify-center overflow-hidden rounded-md bg-surface","[&_svg]:h-auto [&_svg]:min-h-100 [&_svg]:max-w-none [&_svg]:bg-transparent"),children:[F(!1),O.jsx(HG,{className:"top-2 right-2",copied:T==="copied",onZoomIn:()=>R(!1),onZoomOut:()=>A(!1),onReset:()=>I(!1),onSave:W,onCopy:G,children:O.jsx(pt,{content:"Fullscreen",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Open diagram fullscreen",onClick:()=>K(!0),children:O.jsx(X4e,{})})})})]}),O.jsx(FO,{open:u,onClose:()=>K(!1),title:"Mermaid diagram",maxWidth:"xl",fullWidth:!0,dialogProps:{className:"h-[90vh] max-h-[90vh]"},children:O.jsxs("div",{className:N("relative flex h-[80vh] w-full items-center justify-center overflow-hidden","[&_svg]:h-auto [&_svg]:max-h-full [&_svg]:w-auto [&_svg]:max-w-full [&_svg]:bg-transparent"),children:[F(!0),O.jsx(HG,{className:"top-4 right-4",copied:S==="copied",onZoomIn:()=>R(!0),onZoomOut:()=>A(!0),onReset:()=>I(!0),onSave:W,onCopy:U,children:O.jsx(pt,{content:"Close fullscreen",children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":"Close fullscreen",onClick:()=>K(!1),children:O.jsx(Ts,{})})})})]})})]})}),fYe=w.memo(e=>O.jsx(dYe,{children:O.jsx(hYe,{...e})}));let Nhe=!1,gR=null;const OYe=()=>(gR||(gR=Xe(()=>Promise.resolve({}),__vite__mapDeps([4]),import.meta.url).then(e=>(Nhe=!0,e))),gR),pYe=/language-(\w+)/,gYe=/\n$/,mYe=/\$(?!\d)(.+?)\$/,vYe=/\$\$([\s\S]+?)\$\$/,bYe=/\\begin\{([^}]+)\}([\s\S]+?)\\end\{\1\}/,wYe=/\\[a-zA-Z]+(\{[^}]*\})?/,Fhe={a:({href:e,children:t})=>O.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",children:t}),code:({node:e,className:t,children:n,...r})=>pYe.exec(t??"")?.[1]==="mermaid"?O.jsx(fYe,{chart:String(n).replace(gYe,"")}):O.jsx("code",{className:t,...r,children:n})},yYe=[mQ],xYe=[mQ,YVe],SYe=[],$Ye=[hje],kYe=e=>mYe.test(e)||vYe.test(e)||bYe.test(e)?!0:wYe.test(e)&&(e.includes("\\frac")||e.includes("\\sum")||e.includes("\\int")||e.includes("\\sqrt")),Mhe=e=>w.useMemo(()=>{if(!(!e?.fontSize&&!e?.lineHeight))return{"--md-font-size":e.fontSize,"--md-line-height":e.lineHeight}},[e?.fontSize,e?.lineHeight]),zhe=e=>{const t=w.useMemo(()=>kYe(e),[e]),[n,r]=w.useState(()=>t&&Nhe);return w.useEffect(()=>{if(!t||n)return;let i=!1;return OYe().then(()=>{i||r(!0)}),()=>{i=!0}},[t,n]),{remarkPlugins:n?xYe:yYe,rehypePlugins:n?$Ye:SYe}},rm=w.memo(({content:e,styleProps:t,className:n})=>{const r=w.useMemo(()=>e.trim(),[e]),{remarkPlugins:i,rehypePlugins:s}=zhe(r),a=Mhe(t);return O.jsx("div",{className:N("lo-markdown",n),style:a,children:O.jsx(h7,{remarkPlugins:i,rehypePlugins:s,components:Fhe,children:r})})});rm.displayName="MarkdownRenderer";const Lhe=w.memo(({source:e})=>{const{remarkPlugins:t,rehypePlugins:n}=zhe(e);return O.jsx(h7,{remarkPlugins:t,rehypePlugins:n,components:Fhe,children:e})});Lhe.displayName="StableBlock";const qhe=w.memo(({text:e,animate:t})=>O.jsx("span",{className:t?"lo-stream-chunk":void 0,children:e}));qhe.displayName="ArrivedText";const Uhe=({content:e,styleProps:t,className:n})=>{const r=w.useRef(null);r.current===null&&(r.current=KVe());const i=r.current,s=w.useRef([]),a=w.useRef(0);nYe(i,e);const o=a.current;e.length>o?(o>0&&s.current.push({offset:o,animate:!0}),a.current=e.length):e.length<o&&(s.current=[],a.current=e.length);const{blockStart:l}=i,c=s.current;let u=0;for(;u<c.length&&c[u].offset<=l;)u+=1;u>0&&c.splice(0,u);const d=l+rYe(e.slice(l)),h=[{offset:l,animate:!1}];for(const p of c){if(p.offset>=d)break;h.push(p)}const f=Mhe(t);return O.jsxs("div",{className:N("lo-markdown",n),style:f,children:[i.blocks.map((p,g)=>O.jsx(Lhe,{source:p},g)),d>l&&O.jsx("p",{className:"lo-stream-tail",children:h.map((p,g)=>{const m=h[g+1]?.offset??d;return O.jsx(qhe,{text:e.slice(p.offset,m),animate:p.animate},p.offset)})})]})};Uhe.displayName="StreamingMarkdown";const Whe=({className:e})=>O.jsx("div",{className:N("flex size-7 shrink-0 items-center justify-center rounded-full bg-sunken text-ink-muted",e),children:O.jsx(f1,{size:16,"aria-label":"Assistant"})}),RP="pl-10",hl=({isUser:e,children:t,isSmallView:n,showAvatar:r,className:i})=>e?O.jsx("div",{className:N("flex w-full justify-end",i),children:t}):O.jsxs("div",{className:N("relative w-full",!n&&RP,i),children:[r&&!n&&O.jsx(Whe,{className:"absolute top-0 left-0"}),t]}),jhe=6048e5,TYe=864e5,KG=6e4,Bhn=36e5,Zhn=1e3,JG=525600,eV=43200,tV=1440,nV=Symbol.for("constructDateFrom");function Ih(e,t){return typeof e=="function"?e(t):e&&typeof e=="object"&&nV in e?e[nV](t):e instanceof Date?new e.constructor(t):new Date(t)}function Pl(e,t){return Ih(t||e,e)}let PYe={};function CS(){return PYe}function ox(e,t){const n=CS(),r=t?.weekStartsOn??t?.locale?.options?.weekStartsOn??n.weekStartsOn??n.locale?.options?.weekStartsOn??0,i=Pl(e,t?.in),s=i.getDay(),a=(s<r?7:0)+s-r;return i.setDate(i.getDate()-a),i.setHours(0,0,0,0),i}function AP(e,t){return ox(e,{...t,weekStartsOn:1})}function Ghe(e,t){const n=Pl(e,t?.in),r=n.getFullYear(),i=Ih(n,0);i.setFullYear(r+1,0,4),i.setHours(0,0,0,0);const s=AP(i),a=Ih(n,0);a.setFullYear(r,0,4),a.setHours(0,0,0,0);const o=AP(a);return n.getTime()>=s.getTime()?r+1:n.getTime()>=o.getTime()?r:r-1}function XP(e){const t=Pl(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 Vhe(e,...t){const n=Ih.bind(null,t.find(r=>typeof r=="object"));return t.map(n)}function rV(e,t){const n=Pl(e,t?.in);return n.setHours(0,0,0,0),n}function _Ye(e,t,n){const[r,i]=Vhe(n?.in,e,t),s=rV(r),a=rV(i),o=+s-XP(s),l=+a-XP(a);return Math.round((o-l)/TYe)}function CYe(e,t){const n=Ghe(e,t),r=Ih(e,0);return r.setFullYear(n,0,4),r.setHours(0,0,0,0),AP(r)}function QYe(e,t){const n=+Pl(e)-+Pl(t);return n<0?-1:n>0?1:n}function EYe(e){return Ih(e,Date.now())}function RYe(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function AYe(e){return!(!RYe(e)&&typeof e!="number"||isNaN(+Pl(e)))}function XYe(e){return t=>{const r=(e?Math[e]:Math.trunc)(t);return r===0?0:r}}function DYe(e,t){const n=Pl(e,t?.in);return n.setFullYear(n.getFullYear(),0,1),n.setHours(0,0,0,0),n}const IYe={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"}},NYe=(e,t,n)=>{let r;const i=IYe[e];return typeof i=="string"?r=i:t===1?r=i.one:r=i.other.replace("{{count}}",t.toString()),n?.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function mR(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const FYe={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},MYe={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},zYe={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},LYe={date:mR({formats:FYe,defaultWidth:"full"}),time:mR({formats:MYe,defaultWidth:"full"}),dateTime:mR({formats:zYe,defaultWidth:"full"})},qYe={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},UYe=(e,t,n,r)=>qYe[e];function lb(e){return(t,n)=>{const r=n?.context?String(n.context):"standalone";let i;if(r==="formatting"&&e.formattingValues){const a=e.defaultFormattingWidth||e.defaultWidth,o=n?.width?String(n.width):a;i=e.formattingValues[o]||e.formattingValues[a]}else{const a=e.defaultWidth,o=n?.width?String(n.width):e.defaultWidth;i=e.values[o]||e.values[a]}const s=e.argumentCallback?e.argumentCallback(t):t;return i[s]}}const WYe={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},jYe={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},GYe={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"]},VYe={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"]},YYe={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"}},BYe={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"}},ZYe=(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"},HYe={ordinalNumber:ZYe,era:lb({values:WYe,defaultWidth:"wide"}),quarter:lb({values:jYe,defaultWidth:"wide",argumentCallback:e=>e-1}),month:lb({values:GYe,defaultWidth:"wide"}),day:lb({values:VYe,defaultWidth:"wide"}),dayPeriod:lb({values:YYe,defaultWidth:"wide",formattingValues:BYe,defaultFormattingWidth:"wide"})};function cb(e){return(t,n={})=>{const r=n.width,i=r&&e.matchPatterns[r]||e.matchPatterns[e.defaultMatchWidth],s=t.match(i);if(!s)return null;const a=s[0],o=r&&e.parsePatterns[r]||e.parsePatterns[e.defaultParseWidth],l=Array.isArray(o)?JYe(o,d=>d.test(a)):KYe(o,d=>d.test(a));let c;c=e.valueCallback?e.valueCallback(l):l,c=n.valueCallback?n.valueCallback(c):c;const u=t.slice(a.length);return{value:c,rest:u}}}function KYe(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function JYe(e,t){for(let n=0;n<e.length;n++)if(t(e[n]))return n}function eBe(e){return(t,n={})=>{const r=t.match(e.matchPattern);if(!r)return null;const i=r[0],s=t.match(e.parsePattern);if(!s)return null;let a=e.valueCallback?e.valueCallback(s[0]):s[0];a=n.valueCallback?n.valueCallback(a):a;const o=t.slice(i.length);return{value:a,rest:o}}}const tBe=/^(\d+)(th|st|nd|rd)?/i,nBe=/\d+/i,rBe={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},iBe={any:[/^b/i,/^(a|c)/i]},sBe={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},aBe={any:[/1/i,/2/i,/3/i,/4/i]},oBe={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},lBe={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]},cBe={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},uBe={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]},dBe={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},hBe={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}},fBe={ordinalNumber:eBe({matchPattern:tBe,parsePattern:nBe,valueCallback:e=>parseInt(e,10)}),era:cb({matchPatterns:rBe,defaultMatchWidth:"wide",parsePatterns:iBe,defaultParseWidth:"any"}),quarter:cb({matchPatterns:sBe,defaultMatchWidth:"wide",parsePatterns:aBe,defaultParseWidth:"any",valueCallback:e=>e+1}),month:cb({matchPatterns:oBe,defaultMatchWidth:"wide",parsePatterns:lBe,defaultParseWidth:"any"}),day:cb({matchPatterns:cBe,defaultMatchWidth:"wide",parsePatterns:uBe,defaultParseWidth:"any"}),dayPeriod:cb({matchPatterns:dBe,defaultMatchWidth:"any",parsePatterns:hBe,defaultParseWidth:"any"})},Yhe={code:"en-US",formatDistance:NYe,formatLong:LYe,formatRelative:UYe,localize:HYe,match:fBe,options:{weekStartsOn:0,firstWeekContainsDate:1}};function OBe(e,t){const n=Pl(e,t?.in);return _Ye(n,DYe(n))+1}function pBe(e,t){const n=Pl(e,t?.in),r=+AP(n)-+CYe(n);return Math.round(r/jhe)+1}function Bhe(e,t){const n=Pl(e,t?.in),r=n.getFullYear(),i=CS(),s=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??i.firstWeekContainsDate??i.locale?.options?.firstWeekContainsDate??1,a=Ih(t?.in||e,0);a.setFullYear(r+1,0,s),a.setHours(0,0,0,0);const o=ox(a,t),l=Ih(t?.in||e,0);l.setFullYear(r,0,s),l.setHours(0,0,0,0);const c=ox(l,t);return+n>=+o?r+1:+n>=+c?r:r-1}function gBe(e,t){const n=CS(),r=t?.firstWeekContainsDate??t?.locale?.options?.firstWeekContainsDate??n.firstWeekContainsDate??n.locale?.options?.firstWeekContainsDate??1,i=Bhe(e,t),s=Ih(t?.in||e,0);return s.setFullYear(i,0,r),s.setHours(0,0,0,0),ox(s,t)}function mBe(e,t){const n=Pl(e,t?.in),r=+ox(n,t)-+gBe(n,t);return Math.round(r/jhe)+1}function qr(e,t){const n=e<0?"-":"",r=Math.abs(e).toString().padStart(t,"0");return n+r}const wf={y(e,t){const n=e.getFullYear(),r=n>0?n:1-n;return qr(t==="yy"?r%100:r,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):qr(n+1,2)},d(e,t){return qr(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(e,t){return qr(e.getHours()%12||12,t.length)},H(e,t){return qr(e.getHours(),t.length)},m(e,t){return qr(e.getMinutes(),t.length)},s(e,t){return qr(e.getSeconds(),t.length)},S(e,t){const n=t.length,r=e.getMilliseconds(),i=Math.trunc(r*Math.pow(10,n-3));return qr(i,t.length)}},zm={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},iV={G:function(e,t,n){const r=e.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(e,t,n){if(t==="yo"){const r=e.getFullYear(),i=r>0?r:1-r;return n.ordinalNumber(i,{unit:"year"})}return wf.y(e,t)},Y:function(e,t,n,r){const i=Bhe(e,r),s=i>0?i:1-i;if(t==="YY"){const a=s%100;return qr(a,2)}return t==="Yo"?n.ordinalNumber(s,{unit:"year"}):qr(s,t.length)},R:function(e,t){const n=Ghe(e);return qr(n,t.length)},u:function(e,t){const n=e.getFullYear();return qr(n,t.length)},Q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return qr(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(e,t,n){const r=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return qr(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(e,t,n){const r=e.getMonth();switch(t){case"M":case"MM":return wf.M(e,t);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(e,t,n){const r=e.getMonth();switch(t){case"L":return String(r+1);case"LL":return qr(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(e,t,n,r){const i=mBe(e,r);return t==="wo"?n.ordinalNumber(i,{unit:"week"}):qr(i,t.length)},I:function(e,t,n){const r=pBe(e);return t==="Io"?n.ordinalNumber(r,{unit:"week"}):qr(r,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):wf.d(e,t)},D:function(e,t,n){const r=OBe(e);return t==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):qr(r,t.length)},E:function(e,t,n){const r=e.getDay();switch(t){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(e,t,n,r){const i=e.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(s);case"ee":return qr(s,2);case"eo":return n.ordinalNumber(s,{unit:"day"});case"eee":return n.day(i,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(i,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(i,{width:"short",context:"formatting"});case"eeee":default:return n.day(i,{width:"wide",context:"formatting"})}},c:function(e,t,n,r){const i=e.getDay(),s=(i-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(s);case"cc":return qr(s,t.length);case"co":return n.ordinalNumber(s,{unit:"day"});case"ccc":return n.day(i,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(i,{width:"narrow",context:"standalone"});case"cccccc":return n.day(i,{width:"short",context:"standalone"});case"cccc":default:return n.day(i,{width:"wide",context:"standalone"})}},i:function(e,t,n){const r=e.getDay(),i=r===0?7:r;switch(t){case"i":return String(i);case"ii":return qr(i,t.length);case"io":return n.ordinalNumber(i,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(e,t,n){const i=e.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},b:function(e,t,n){const r=e.getHours();let i;switch(r===12?i=zm.noon:r===0?i=zm.midnight:i=r/12>=1?"pm":"am",t){case"b":case"bb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},B:function(e,t,n){const r=e.getHours();let i;switch(r>=17?i=zm.evening:r>=12?i=zm.afternoon:r>=4?i=zm.morning:i=zm.night,t){case"B":case"BB":case"BBB":return n.dayPeriod(i,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(i,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(i,{width:"wide",context:"formatting"})}},h:function(e,t,n){if(t==="ho"){let r=e.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return wf.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):wf.H(e,t)},K:function(e,t,n){const r=e.getHours()%12;return t==="Ko"?n.ordinalNumber(r,{unit:"hour"}):qr(r,t.length)},k:function(e,t,n){let r=e.getHours();return r===0&&(r=24),t==="ko"?n.ordinalNumber(r,{unit:"hour"}):qr(r,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):wf.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):wf.s(e,t)},S:function(e,t){return wf.S(e,t)},X:function(e,t,n){const r=e.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return aV(r);case"XXXX":case"XX":return Sp(r);case"XXXXX":case"XXX":default:return Sp(r,":")}},x:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"x":return aV(r);case"xxxx":case"xx":return Sp(r);case"xxxxx":case"xxx":default:return Sp(r,":")}},O:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+sV(r,":");case"OOOO":default:return"GMT"+Sp(r,":")}},z:function(e,t,n){const r=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+sV(r,":");case"zzzz":default:return"GMT"+Sp(r,":")}},t:function(e,t,n){const r=Math.trunc(+e/1e3);return qr(r,t.length)},T:function(e,t,n){return qr(+e,t.length)}};function sV(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=Math.trunc(r/60),s=r%60;return s===0?n+String(i):n+String(i)+t+qr(s,2)}function aV(e,t){return e%60===0?(e>0?"-":"+")+qr(Math.abs(e)/60,2):Sp(e,t)}function Sp(e,t=""){const n=e>0?"-":"+",r=Math.abs(e),i=qr(Math.trunc(r/60),2),s=qr(r%60,2);return n+i+t+s}const oV=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Zhe=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},vBe=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],r=n[1],i=n[2];if(!i)return oV(e,t);let s;switch(r){case"P":s=t.dateTime({width:"short"});break;case"PP":s=t.dateTime({width:"medium"});break;case"PPP":s=t.dateTime({width:"long"});break;case"PPPP":default:s=t.dateTime({width:"full"});break}return s.replace("{{date}}",oV(r,t)).replace("{{time}}",Zhe(i,t))},bBe={p:Zhe,P:vBe},wBe=/^D+$/,yBe=/^Y+$/,xBe=["D","DD","YY","YYYY"];function SBe(e){return wBe.test(e)}function $Be(e){return yBe.test(e)}function kBe(e,t,n){const r=TBe(e,t,n);if(console.warn(r),xBe.includes(e))throw new RangeError(r)}function TBe(e,t,n){const r=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const PBe=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,_Be=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,CBe=/^'([^]*?)'?$/,QBe=/''/g,EBe=/[a-zA-Z]/;function vR(e,t,n){const r=CS(),i=n?.locale??r.locale??Yhe,s=n?.firstWeekContainsDate??n?.locale?.options?.firstWeekContainsDate??r.firstWeekContainsDate??r.locale?.options?.firstWeekContainsDate??1,a=n?.weekStartsOn??n?.locale?.options?.weekStartsOn??r.weekStartsOn??r.locale?.options?.weekStartsOn??0,o=Pl(e,n?.in);if(!AYe(o))throw new RangeError("Invalid time value");let l=t.match(_Be).map(u=>{const d=u[0];if(d==="p"||d==="P"){const h=bBe[d];return h(u,i.formatLong)}return u}).join("").match(PBe).map(u=>{if(u==="''")return{isToken:!1,value:"'"};const d=u[0];if(d==="'")return{isToken:!1,value:RBe(u)};if(iV[d])return{isToken:!0,value:u};if(d.match(EBe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+d+"`");return{isToken:!1,value:u}});i.localize.preprocessor&&(l=i.localize.preprocessor(o,l));const c={firstWeekContainsDate:s,weekStartsOn:a,locale:i};return l.map(u=>{if(!u.isToken)return u.value;const d=u.value;(!n?.useAdditionalWeekYearTokens&&$Be(d)||!n?.useAdditionalDayOfYearTokens&&SBe(d))&&kBe(d,t,String(e));const h=iV[d[0]];return h(o,d,i.localize,c)}).join("")}function RBe(e){const t=e.match(CBe);return t?t[1].replace(QBe,"'"):e}function ABe(e,t,n){const r=CS(),i=n?.locale??r.locale??Yhe,s=QYe(e,t);if(isNaN(s))throw new RangeError("Invalid time value");const a=Object.assign({},n,{addSuffix:n?.addSuffix,comparison:s}),[o,l]=Vhe(n?.in,...s>0?[t,e]:[e,t]),c=XYe("round"),u=l.getTime()-o.getTime(),d=u/KG,h=XP(l)-XP(o),f=(u-h)/KG,p=n?.unit;let g;if(d<1?g="second":d<60?g="minute":d<tV?g="hour":f<eV?g="day":f<JG?g="month":g="year",g==="second"){const m=c(u/1e3);return i.formatDistance("xSeconds",m,a)}else if(g==="minute"){const m=c(d);return i.formatDistance("xMinutes",m,a)}else if(g==="hour"){const m=c(d/60);return i.formatDistance("xHours",m,a)}else if(g==="day"){const m=c(f/tV);return i.formatDistance("xDays",m,a)}else if(g==="month"){const m=c(f/eV);return m===12&&p!=="month"?i.formatDistance("xYears",1,a):i.formatDistance("xMonths",m,a)}else{const m=c(f/JG);return i.formatDistance("xYears",m,a)}}function XBe(e,t){return ABe(e,EYe(e),t)}const DBe=e=>{if(!e)return"";try{const t=e instanceof Date?e:new Date(e),n=new Date,r=new Date(n);if(r.setDate(n.getDate()-1),t.toDateString()===n.toDateString())return vR(t,"h:mm a");if(t.toDateString()===r.toDateString())return"Yesterday";const i=new Date(n);return i.setDate(n.getDate()-7),t>i?vR(t,"EEEE"):vR(t,"yyyy-MM-dd")}catch(t){return console.error("Error formatting date:",t),""}},Hhn=e=>{if(!e)return"";try{const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleDateString(navigator.language,{year:"numeric",month:"long",day:"numeric"})}catch(t){return console.error("Error formatting calendar date:",t),""}},IBe=e=>{if(!e)return"";try{const t=e instanceof Date?e:new Date(e);return Number.isNaN(t.getTime())?"":t.toLocaleString(navigator.language,{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit"})}catch(t){return console.error("Error formatting calendar date-time:",t),""}},M7=({timestamp:e,className:t})=>O.jsx(pt,{content:IBe(e),side:"bottom",delayDuration:1200,children:O.jsx("span",{className:N("shrink-0 cursor-help whitespace-nowrap text-ink-dim text-meta",t),children:DBe(e)})}),Hhe=({content:e,busy:t=!1,className:n})=>e?O.jsxs("section",{"aria-label":"Question from the agent",className:N("flex gap-3 rounded-md border border-accent bg-accent-wash px-4 py-3",n),children:[O.jsx(F4e,{className:"mt-0.5 size-4 shrink-0 text-accent","aria-hidden":!0}),O.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[O.jsx("p",{className:"font-medium text-accent text-meta",children:t?"Sending your answer…":"Waiting for your answer"}),O.jsx("div",{className:"lo-on-wash text-ink",children:O.jsx(rm,{content:e})})]})]}):null,NBe=({options:e,recommended:t,busy:n=!1,onAnswer:r,requestId:i})=>{if(e.length===0)return null;const s=typeof t=="number"&&Number.isInteger(t)&&t>=0&&t<e.length?t:null;return O.jsx("fieldset",{"aria-label":"Answer options",className:"mt-1 flex min-w-0 max-h-[380px] flex-col gap-2 overflow-y-auto border-0 px-0 py-1",children:e.map((a,o)=>O.jsxs("button",{type:"button",disabled:n,onClick:()=>r(a.label),className:N("flex w-full items-baseline gap-2 rounded-sm border px-3 py-2 text-left","transition-colors duration-fast ease-out-quart","border-control bg-surface hover:bg-elevated active:bg-sunken","disabled:border-hairline disabled:bg-sunken disabled:text-ink-disabled"),children:[o<9&&O.jsxs("span",{"aria-hidden":!0,className:N("shrink-0 font-mono text-mono-sm",n?"text-ink-disabled":"text-ink-dim"),children:[o+1,"."]}),O.jsxs("span",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[O.jsxs("span",{className:"flex flex-wrap items-baseline gap-x-2 gap-y-0.5",children:[O.jsx("span",{className:N("min-w-0 text-body-sm",n?"text-ink-disabled":"text-ink"),children:a.label}),s===o&&O.jsx("span",{className:N("shrink-0 font-medium text-meta",n?"text-ink-disabled":"text-ink"),children:"Recommended"})]}),a.description&&O.jsx("span",{className:N("text-body-sm",n?"text-ink-disabled":"text-ink-muted"),children:a.description})]})]},`${i}-${String(o)}`))})},Khe="data-text-surface",bR=Object.freeze({[Khe]:"true"}),FBe="ml-5",Jhe="self-start mt-0.5",lV="flex min-h-6 w-full items-center gap-1.5 py-0.5 text-left",Nh=({summary:e,children:t,defaultOpen:n=!1,chevron:r="leading",className:i,triggerClassName:s,summaryAlign:a="center",rowClassName:o,disabled:l=!1,triggerLabel:c,triggerTooltip:u,onOpenChange:d})=>{const[h,f]=w.useState(n),p=w.useId(),g=w.useRef(null),m=N("shrink-0",a==="firstLine"&&Jhe),v=a==="firstLine"?"items-start":null,b=w.useRef(!1),y=w.useRef(!1),T=w.useRef(null),x=_=>{for(let R=_ instanceof Element?_:null;R&&R!==g.current;R=R.parentElement)if(R.hasAttribute(Khe))return!0;return!1},S=_=>{if(b.current=x(_.target),y.current=!!window.getSelection()?.toString(),_.detail<=1){T.current=null;return}b.current&&T.current!==null&&(f(T.current),d?.(T.current),T.current=null)},k=_=>{const R=_.detail===0,A=y.current||!!window.getSelection()?.toString();!R&&b.current&&(A||_.detail>1)||(T.current=h,f(!h),d?.(!h))},Q=_=>{if(_.key!=="Escape")return;const R=window.getSelection();!R||R.isCollapsed||g.current?.contains(R.anchorNode)&&R.removeAllRanges()};if(l)return O.jsx("div",{className:i,children:O.jsxs("div",{className:N(lV,v,"text-ink-dim",o),children:[r==="leading"&&O.jsx("span",{className:N("size-3.5",m),"aria-hidden":!0}),O.jsx("span",{className:"min-w-0 flex-1",children:e})]})});const C=h?O.jsx(dg,{className:"size-3.5","aria-hidden":!0}):O.jsx(Eh,{className:"size-3.5","aria-hidden":!0});return O.jsxs("div",{className:i,children:[O.jsx(pt,{content:u,side:"top",children:O.jsxs("button",{type:"button","aria-expanded":h,"aria-controls":p,"aria-label":c,ref:g,onMouseDown:S,onClick:k,onKeyDown:Q,className:N(lV,v,"cursor-pointer select-none","text-ink-dim transition-colors duration-fast ease-out-quart hover:text-ink-muted",o,s),children:[r==="leading"&&O.jsx("span",{className:N("flex text-ink-disabled",m),children:C}),O.jsx("span",{className:"min-w-0 flex-1",children:e}),r==="trailing"&&O.jsx("span",{className:N("flex text-ink-disabled",m),children:C})]})}),h&&O.jsx("div",{id:p,className:N("mt-1 flex flex-col gap-2 pb-1",r==="leading"&&FBe),children:t})]})},efe=({children:e,className:t})=>O.jsx("span",{"aria-hidden":!0,className:N("flex size-3.5 shrink-0 [&_svg]:size-3.5",t),children:e}),z7=({label:e="Reasoning",content:t})=>!Zn(r=>r.showAgentReasoning)||!t?null:O.jsx(Nh,{summary:O.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[O.jsx(efe,{}),O.jsx("span",{className:"truncate",children:O.jsx("span",{className:"text-ink-dim text-meta",children:e})})]}),children:O.jsx(rm,{content:t,className:"[--md-ink:var(--lo-ink-muted)]",styleProps:{fontSize:"var(--text-body-sm)",lineHeight:"var(--text-body-sm--line-height)"}})}),MBe={hunk:"text-ink-muted",added:"text-success",removed:"text-danger",context:"text-ink-dim"},zBe=({line:e})=>O.jsx("span",{className:N(MBe[e.kind],"block"),children:e.text}),LBe=({diff:e,className:t})=>{const n=CFe(e);return O.jsxs("div",{className:N("max-h-[740px] overflow-y-auto overflow-x-hidden rounded-sm border border-hairline bg-sunken p-3 font-mono text-ink text-mono-sm whitespace-pre-wrap break-words",t),children:[n.lines.map((r,i)=>O.jsx(zBe,{line:r},i)),n.hidden>0&&O.jsx("span",{className:"sticky -bottom-3 -mb-3 block bg-sunken pb-3 text-ink-dim",children:QFe(n.hidden)})]})},qBe=({content:e,details:t,className:n})=>O.jsxs("section",{"aria-label":"Security notice",className:N("flex gap-3 border-warning border-l-2 py-0.5 pl-3",n),children:[O.jsx(q3e,{className:"mt-0.5 size-4 shrink-0 text-warning","aria-hidden":!0}),O.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[O.jsx("p",{className:"font-medium text-body-sm text-warning",children:"Blocked a risky action"}),e?O.jsx("p",{className:"text-body-sm text-ink-muted",children:e}):null,t?O.jsx(Nh,{summary:O.jsx("span",{className:"text-meta",children:"Show the reviewed code"}),children:t}):null]})]}),UBe=(e,t=72)=>{let i=e.replace(/```[\s\S]*?```/g," ").replace(/\[([^\]]+)\]\([^)]*\)/g,"$1").replace(/\s+/g," ").trim();if(i.length>t){const s=i.slice(0,t),a=s.lastIndexOf(" ");i=`${s.slice(0,a>32?a:t).trimEnd()}…`}return i.replace(/[.!?…]+$/g,"").trimEnd()},cV=e=>e.startsWith("file://")?e.slice(7):e,WBe={READ:{verb:"Read",runningVerb:"Reading",icon:l8},WRITE:{verb:"Wrote",runningVerb:"Writing",icon:p8},EDIT:{verb:"Edited",runningVerb:"Editing",icon:o3e},CODE:{verb:"Ran code",runningVerb:"Running code",icon:c8},DELEGATE:{verb:"Delegated work",runningVerb:"Delegating work",icon:z3e},DONE:{verb:"Finished",runningVerb:"Finishing",icon:IF},ASK:{verb:"Asked",runningVerb:"Asking",icon:MC},BYE:{verb:"Ended the conversation",runningVerb:"Ending",icon:TRe}},jBe={verb:"Worked on the request",runningVerb:"Working on the request",icon:c8},GBe=(e,t,n,r)=>{const i=e?WBe[e]:jBe;let s;if(t)s=cV(t);else if(n&&n.length>0){const o=n.filter(l=>!l.startsWith("data:"));o.length===1?s=cV(o[0]):o.length>1&&(s=`${o.length} files`)}const a=!s&&r?UBe(r):"";return{verb:i.verb,runningVerb:i.runningVerb,object:s,narration:a||void 0,icon:i.icon}},uV="min-h-5 py-0",VBe=({icon:e,verb:t,object:n,narration:r,running:i,failed:s,wrap:a})=>O.jsxs("span",{className:N("flex min-w-0 gap-2",a?"items-start":"items-center"),"aria-busy":i||void 0,children:[O.jsx(efe,{className:N(s?"text-danger":"text-ink-dim",a&&Jhe),children:e}),O.jsxs("span",{className:N(a?"min-w-0 whitespace-pre-wrap break-words":"truncate"),children:[O.jsxs("span",{...bR,className:N("select-text font-mono text-mono-sm",i?"text-ink-muted":"text-ink-dim",s&&"text-danger"),children:[t,r?":":null]}),n?O.jsxs("span",{...bR,className:"select-text font-mono text-ink-muted text-mono-sm",children:[" ",n]}):null,r?O.jsxs("span",{...bR,className:"select-text text-body-sm text-ink-muted",children:[" ",r]}):null]})]}),DP=({action:e,filePath:t,files:n,narration:r,running:i=!1,failed:s=!1,defaultOpen:a=!1,details:o,className:l,verbOverride:c,object:u,glyph:d,wrap:h,dense:f=!1})=>{const p=GBe(e,t,n,r),g=c??(i?p.runningVerb:p.verb),m=s?hg:p.icon,v=s||!c||!d?O.jsx(m,{}):d,b=O.jsx(VBe,{icon:v,verb:g,object:c?u:p.object,narration:c?r:p.narration,running:i,failed:s,wrap:h}),y=h?"firstLine":"center";return o?O.jsx(Nh,{summary:b,chevron:"leading",summaryAlign:y,defaultOpen:a,className:l,rowClassName:f?uV:void 0,triggerClassName:"-mx-2 rounded-sm px-2 hover:bg-elevated",children:o}):O.jsx(Nh,{disabled:!0,summary:b,summaryAlign:y,className:l,rowClassName:f?uV:void 0})},tfe=8,YBe="… deeper values not shown",BBe="(empty)";function ZBe(e){return`… ${e} more line${e===1?"":"s"}`}const dV=.5;function HBe(e,t,n,r){if(!Number.isFinite(t)||t<=0)return 0;let i=0;for(const s of e){if(s.height<=0)continue;const a=Math.max(1,Math.round(s.height/t));for(let o=1;o<=a;o++)s.top+o*t>n+r&&i++}return i}function nfe(e){return e==null?"null":typeof e=="string"?e.trim()||null:typeof e=="number"||typeof e=="boolean"?String(e):null}function L7(e){return typeof e=="object"&&e!==null}function rfe(e,t,n,r){if(n>tfe){r.push({key:t,value:YBe,depth:n});return}if(L7(e)){for(const[s,a]of Object.entries(e))rfe(a,t?`${t}.${s}`:s,n+1,r);return}const i=nfe(e);i!==null&&r.push({key:t,value:i,depth:n})}function ife(e){if(!e)return[];const t=[];for(const[n,r]of Object.entries(e))rfe(r,n,1,t);return t}const KBe=512;function JBe(e,t){if(t)return!0;if(!e)return!1;let n=KBe;const r=(i,s)=>{if(n--<=0||s>tfe)return!0;if(!L7(i))return nfe(i)!==null;for(const a of Object.values(i))if(r(a,s+1))return!0;return!1};for(const i of Object.values(e))if(r(i,1))return!0;return!1}function eZe(e){if(!e)return null;const t=e.trim();if(!t.startsWith("{")&&!t.startsWith("["))return null;let n;try{n=JSON.parse(t)}catch{return null}if(!L7(n))return null;const r=ife(n);return r.length>0?r:[{key:"",value:BBe,depth:1}]}const tZe=8,hV="max-h-[240px]",nZe=({line:e})=>O.jsxs("div",{className:N("whitespace-pre-wrap break-words"),style:{paddingInlineStart:(e.depth-1)*tZe},children:[e.key?O.jsxs("span",{className:N("text-ink-dim"),children:[e.key,": "]}):null,O.jsx("span",{className:N("text-ink-muted"),children:e.value})]}),fV=({lines:e,label:t})=>O.jsx("div",{className:N("flex flex-col gap-1"),"data-detail-lines":t,children:e.map((n,r)=>O.jsx(nZe,{line:n},r))});function OV(e){const[t,n]=w.useState(0),[r,i]=w.useState(!1);return w.useLayoutEffect(()=>{const s=e.current;if(!s)return;const a=s.firstElementChild,o=()=>{const c=a??s,u=Number.parseFloat(getComputedStyle(c).lineHeight);if(!Number.isFinite(u)||u<=0){n(0),i(!1);return}const d=s.getBoundingClientRect(),h=c.getBoundingClientRect();i(h.height>d.height+dV);const f=c.children.length>0?Array.from(c.children):[c];n(HBe(f.map(p=>{const g=p.getBoundingClientRect();return{top:g.top,height:g.height}}),u,d.bottom,dV))};o(),s.addEventListener("scroll",o,{passive:!0});const l=new ResizeObserver(o);return l.observe(a??s),()=>{s.removeEventListener("scroll",o),l.disconnect()}}),{lines:t,overflowing:r}}const pV=({lines:e,overflowing:t})=>t?O.jsx("span",{className:N("mt-1 block text-ink-dim"),children:e>0?ZBe(e):" "}):null,rZe=({args:e,output:t,isError:n})=>{const r=ife(e),i=eZe(t),s=w.useRef(null),a=w.useRef(null),o=OV(s),l=OV(a);return r.length===0&&!t?null:O.jsxs("div",{className:N("w-full rounded-sm border border-hairline bg-sunken p-3 font-mono text-mono-sm"),children:[r.length>0&&O.jsxs("div",{"data-detail-section":"input",children:[O.jsx("div",{ref:s,className:N(hV,"overflow-auto"),children:O.jsx(fV,{lines:r,label:"input"})}),O.jsx(pV,{lines:o.lines,overflowing:o.overflowing})]}),t&&O.jsxs("div",{className:N(r.length>0&&"mt-3"),"data-detail-section":"output",children:[O.jsx("span",{className:N("mb-1 block text-meta",n?"text-danger":"text-ink-dim"),children:n?"Error":"Output"}),O.jsx("div",{ref:a,className:N(hV,"overflow-auto"),children:i?O.jsx(fV,{lines:i,label:"result-json"}):O.jsx("pre",{className:N("whitespace-pre font-mono",n?"text-danger":"text-ink"),children:t})}),O.jsx(pV,{lines:l.lines,overflowing:l.overflowing})]})]})},iZe="mcp__",sZe={bash:fAe,read:dO,write:PU,edit:PU,glob:Xy,grep:UC,todo:k4e,wake:zC,list_variables:aP,read_variable:aP,browser:CU,web_search:CU,web_fetch:uO,task:bh,agent:bh,send:v8,peer:O4e};function aZe(e){const t=e.trim().toLowerCase(),n=sZe[t];return n||(t.startsWith(iZe)?g8:I_e)}const oZe=Tl,lZe=Ts,cZe=_oe,gV="min-h-5 py-0",uZe={read:"text-info",mutate:"text-ink-muted",exec:"text-ink-muted",meta:"text-accent",plain:"text-ink-muted"},dZe=(e,t)=>e==="running"?"text-ink":e==="error"?"text-danger":e==="receipt"?"text-ink-muted":uZe[vFe(t)],hZe=({added:e,removed:t})=>e<=0&&t<=0?null:O.jsxs("span",{className:N("hidden shrink-0 gap-1 font-mono text-mono-sm tabular-nums @[34rem]/toolrow:flex"),children:[e>0&&O.jsxs("span",{className:N("text-success"),children:["+",e]}),t>0&&O.jsxs("span",{className:N("text-danger"),children:["-",t]})]}),mV={running:"",success:"succeeded",error:"failed",interrupted:"interrupted",receipt:""},fZe=1e3;function OZe(e){const[t,n]=w.useState(()=>e===null?null:Math.max(0,(Date.now()-e)/1e3));return w.useEffect(()=>{if(e===null){n(null);return}const r=()=>n(Math.max(0,(Date.now()-e)/1e3));r();const i=window.setInterval(r,fZe);return()=>window.clearInterval(i)},[e]),t}const pZe=({outcome:e,durationS:t,startedAt:n})=>{const r=e==="running",i=OZe(r?n??null:null),s=e==="success"?oZe:e==="error"?lZe:e==="interrupted"?cZe:null,a=e==="success"?"text-success":e==="error"?"text-danger":"text-ink-dim",o=r?n==null?"":L8(i??0):pFe(t);return O.jsxs("span",{className:N("flex shrink-0 items-center gap-1.5"),children:[O.jsxs("span",{className:N("flex size-3.5 shrink-0 [&_svg]:size-3.5",a),children:[s?O.jsx(s,{"aria-hidden":!0}):null,mV[e]?O.jsx("span",{className:N("sr-only"),children:mV[e]}):null]}),O.jsx("span",{className:N("w-[5ch] text-right font-mono text-ink-dim text-mono-sm tabular-nums"),children:o})]})},IP=({toolName:e,summary:t,summaryFallback:n=null,outcome:r,durationS:i,startedAt:s=null,added:a=0,removed:o=0,nameColumn:l=tce,details:c,defaultOpen:u=!1,className:d,media:h})=>{const f=r==="running",p=r==="error",g=aZe(e),m=nx(e),v=ece(t,e)?n??"":t,b=O.jsxs("span",{className:N("flex min-w-0 flex-1 items-center gap-2"),children:[O.jsx("span",{"aria-hidden":!0,className:N("flex size-3.5 shrink-0 [&_svg]:size-3.5",f?"text-accent":p?"text-danger":"text-ink-dim"),children:O.jsx(g,{})}),O.jsx("span",{className:N("shrink-0 truncate font-mono text-mono-sm","pr-1",dZe(r,e)),style:{width:`calc(${l}ch + 0.25rem)`},title:m,children:m}),O.jsx("span",{className:N("min-w-0 flex-1 truncate font-mono text-mono-sm",f?"text-ink-muted":"text-ink-dim"),title:v,children:v}),O.jsx(hZe,{added:a,removed:o}),O.jsx(pZe,{outcome:r,durationS:i,startedAt:s})]}),y=f?"bg-elevated":p?"bg-danger-wash":"hover:bg-elevated",T=c?O.jsx(Nh,{summary:b,chevron:"leading",defaultOpen:u,className:N("@container/toolrow",d),rowClassName:gV,triggerClassName:N("-mx-2 rounded-sm px-2",y),children:c}):O.jsx(Nh,{disabled:!0,summary:b,rowClassName:gV,className:N("@container/toolrow",(f||p)&&N("-mx-2 rounded-sm px-2",y),d)});return h?O.jsxs("div",{className:N("flex flex-col"),children:[T,h]}):T},sfe=e=>{const t=w.useCallback(r=>{const i=window.matchMedia(e);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[e]),n=w.useCallback(()=>window.matchMedia(e).matches,[e]);return w.useSyncExternalStore(t,n,()=>!1)},vV=["⣾","⣽","⣻","⢿","⡿","⣟","⣯","⣷"],gZe=80,mZe=1e3,vZe=({activity:e,phase:t,className:n})=>{const[r,i]=w.useState(0),[s,a]=w.useState(0),o=sfe("(prefers-reduced-motion: reduce)"),l=w.useRef(Date.now()),c=w.useRef(t);return c.current!==t&&(c.current=t,l.current=Date.now(),a(0)),w.useEffect(()=>{const u=window.setInterval(()=>a(Math.floor((Date.now()-l.current)/1e3)),mZe);if(o)return i(0),()=>window.clearInterval(u);const d=window.setInterval(()=>i(h=>(h+1)%vV.length),gZe);return()=>{window.clearInterval(d),window.clearInterval(u)}},[o]),O.jsxs("div",{className:N("flex items-center gap-2",n),"data-lo-working-line":!0,"aria-live":"polite",children:[O.jsx("span",{"aria-hidden":!0,className:N("w-[1ch] shrink-0 select-none font-mono text-ink-muted text-mono-sm"),children:vV[r]}),O.jsx("span",{className:N("min-w-0 truncate font-mono text-ink-dim text-mono-sm"),children:e}),O.jsx("span",{"aria-hidden":!0,className:N("w-[6ch] shrink-0 font-mono text-ink-dim text-mono-sm tabular-nums"),children:L8(s)})]})},afe=({children:e,className:t})=>O.jsx("div",{className:N("flex max-w-full items-center justify-center overflow-hidden","min-h-16 min-w-16 rounded-sm border border-hairline bg-sunken",t),children:e}),bZe="could not be displayed. It may have been moved, renamed, or deleted.",wZe="could not be displayed. Its stored copy is not available to this reader.",q7=({name:e,detail:t=bZe,className:n})=>O.jsxs("div",{className:N("flex w-fit max-w-full items-center gap-2.5 rounded-sm border border-hairline bg-sunken px-3 py-2",n),children:[O.jsx(d4e,{className:"size-4 shrink-0 text-ink-dim","aria-hidden":!0}),O.jsxs("span",{className:"min-w-0 text-body-sm text-ink-muted",children:[O.jsx("span",{className:"truncate font-mono text-ink text-mono-sm",children:e}),` ${t}`]})]}),vQ=({filePath:e,tooltip:t="File actions",icon:n,"aria-label":r="File actions",onShowInCanvas:i})=>{const s=async()=>{if(e)try{await navigator.clipboard.writeText(e),us("File path copied to clipboard")}catch(o){console.error("Failed to copy file path: ",o),Kn("Failed to copy file path")}},a=()=>{e&&window.api.openFile(e)};return O.jsxs(pS,{children:[O.jsx(pt,{content:t,children:O.jsx(Ov,{asChild:!0,children:O.jsx(we,{variant:"ghost",size:"icon-sm","aria-label":r,onClick:o=>o.stopPropagation(),children:n??O.jsx(u8,{"aria-hidden":"true"})})})}),O.jsxs(gS,{align:"end",className:"min-w-45",onClick:o=>o.stopPropagation(),children:[i&&O.jsxs(is,{onSelect:i,children:[O.jsx(y4e,{"aria-hidden":"true"}),O.jsx("span",{children:"Show in canvas"})]}),O.jsxs(is,{onSelect:a,children:[O.jsx(O1,{"aria-hidden":"true"}),O.jsx("span",{children:"Open file"})]}),O.jsxs(is,{onSelect:()=>window.api.showItemInFolder(e),children:[O.jsx(Xy,{"aria-hidden":"true"}),O.jsx("span",{children:"Open folder"})]}),O.jsxs(is,{onSelect:s,children:[O.jsx(Coe,{"aria-hidden":"true"}),O.jsx("span",{children:"Copy file path"})]})]})]})},ofe=1024;let yZe=0,ic=class{constructor(t,n){this.from=t,this.to=n}};class En{constructor(t={}){this.id=yZe++,this.perNode=!!t.perNode,this.deserialize=t.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(t){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof t!="function"&&(t=_s.match(t)),n=>{let r=t(n);return r===void 0?null:[this,r]}}}En.closedBy=new En({deserialize:e=>e.split(" ")});En.openedBy=new En({deserialize:e=>e.split(" ")});En.group=new En({deserialize:e=>e.split(" ")});En.isolate=new En({deserialize:e=>{if(e&&e!="rtl"&&e!="ltr"&&e!="auto")throw new RangeError("Invalid value for isolate: "+e);return e||"auto"}});En.contextHash=new En({perNode:!0});En.lookAhead=new En({perNode:!0});En.mounted=new En({perNode:!0});class lx{constructor(t,n,r){this.tree=t,this.overlay=n,this.parser=r}static get(t){return t&&t.props&&t.props[En.mounted.id]}}const xZe=Object.create(null);class _s{constructor(t,n,r,i=0){this.name=t,this.props=n,this.id=r,this.flags=i}static define(t){let n=t.props&&t.props.length?Object.create(null):xZe,r=(t.top?1:0)|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new _s(t.name||"",n,t.id,r);if(t.props){for(let s of t.props)if(Array.isArray(s)||(s=s(i)),s){if(s[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[s[0].id]=s[1]}}return i}prop(t){return this.props[t.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(t){if(typeof t=="string"){if(this.name==t)return!0;let n=this.prop(En.group);return n?n.indexOf(t)>-1:!1}return this.id==t}static match(t){let n=Object.create(null);for(let r in t)for(let i of r.split(" "))n[i]=t[r];return r=>{for(let i=r.prop(En.group),s=-1;s<(i?i.length:0);s++){let a=n[s<0?r.name:i[s]];if(a)return a}}}}_s.none=new _s("",Object.create(null),0,8);class k1{constructor(t){this.types=t;for(let n=0;n<t.length;n++)if(t[n].id!=n)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...t){let n=[];for(let r of this.types){let i=null;for(let s of t){let a=s(r);a&&(i||(i=Object.assign({},r.props)),i[a[0].id]=a[1])}n.push(i?new _s(r.name,i,r.id,r.flags):r)}return new k1(n)}}const B$=new WeakMap,bV=new WeakMap;var ri;(function(e){e[e.ExcludeBuffers=1]="ExcludeBuffers",e[e.IncludeAnonymous=2]="IncludeAnonymous",e[e.IgnoreMounts=4]="IgnoreMounts",e[e.IgnoreOverlays=8]="IgnoreOverlays"})(ri||(ri={}));class ur{constructor(t,n,r,i,s){if(this.type=t,this.children=n,this.positions=r,this.length=i,this.props=null,s&&s.length){this.props=Object.create(null);for(let[a,o]of s)this.props[typeof a=="number"?a:a.id]=o}}toString(){let t=lx.get(this);if(t&&!t.overlay)return t.tree.toString();let n="";for(let r of this.children){let i=r.toString();i&&(n&&(n+=","),n+=i)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(t=0){return new NP(this.topNode,t)}cursorAt(t,n=0,r=0){let i=B$.get(this)||this.topNode,s=new NP(i);return s.moveTo(t,n),B$.set(this,s._tree),s}get topNode(){return new La(this,0,0,null)}resolve(t,n=0){let r=cx(B$.get(this)||this.topNode,t,n,!1);return B$.set(this,r),r}resolveInner(t,n=0){let r=cx(bV.get(this)||this.topNode,t,n,!0);return bV.set(this,r),r}resolveStack(t,n=0){return kZe(this,t,n)}iterate(t){let{enter:n,leave:r,from:i=0,to:s=this.length}=t,a=t.mode||0,o=(a&ri.IncludeAnonymous)>0;for(let l=this.cursor(a|ri.IncludeAnonymous);;){let c=!1;if(l.from<=s&&l.to>=i&&(!o&&l.type.isAnonymous||n(l)!==!1)){if(l.firstChild())continue;c=!0}for(;c&&r&&(o||!l.type.isAnonymous)&&r(l),!l.nextSibling();){if(!l.parent())return;c=!0}}}prop(t){return t.perNode?this.props?this.props[t.id]:void 0:this.type.prop(t)}get propValues(){let t=[];if(this.props)for(let n in this.props)t.push([+n,this.props[n]]);return t}balance(t={}){return this.children.length<=8?this:j7(_s.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,i)=>new ur(this.type,n,r,i,this.propValues),t.makeTree||((n,r,i)=>new ur(_s.none,n,r,i)))}static build(t){return TZe(t)}}ur.empty=new ur(_s.none,[],[],0);class U7{constructor(t,n){this.buffer=t,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new U7(this.buffer,this.index)}}class xO{constructor(t,n,r){this.buffer=t,this.length=n,this.set=r}get type(){return _s.none}toString(){let t=[];for(let n=0;n<this.buffer.length;)t.push(this.childString(n)),n=this.buffer[n+3];return t.join(",")}childString(t){let n=this.buffer[t],r=this.buffer[t+3],i=this.set.types[n],s=i.name;if(/\W/.test(s)&&!i.isError&&(s=JSON.stringify(s)),t+=4,r==t)return s;let a=[];for(;t<r;)a.push(this.childString(t)),t=this.buffer[t+3];return s+"("+a.join(",")+")"}findChild(t,n,r,i,s){let{buffer:a}=this,o=-1;for(let l=t;l!=n&&!(lfe(s,i,a[l+1],a[l+2])&&(o=l,r>0));l=a[l+3]);return o}slice(t,n,r){let i=this.buffer,s=new Uint16Array(n-t),a=0;for(let o=t,l=0;o<n;){s[l++]=i[o++],s[l++]=i[o++]-r;let c=s[l++]=i[o++]-r;s[l++]=i[o++]-t,a=Math.max(a,c)}return new xO(s,a,this.set)}}function lfe(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function cx(e,t,n,r){for(var i;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let a=!r&&e instanceof La&&e.index<0?null:e.parent;if(!a)return e;e=a}let s=r?0:ri.IgnoreOverlays;if(r)for(let a=e,o=a.parent;o;a=o,o=a.parent)a instanceof La&&a.index<0&&((i=o.enter(t,n,s))===null||i===void 0?void 0:i.from)!=a.from&&(e=o);for(;;){let a=e.enter(t,n,s);if(!a)return e;e=a}}class cfe{cursor(t=0){return new NP(this,t)}getChild(t,n=null,r=null){let i=wV(this,t,n,r);return i.length?i[0]:null}getChildren(t,n=null,r=null){return wV(this,t,n,r)}resolve(t,n=0){return cx(this,t,n,!1)}resolveInner(t,n=0){return cx(this,t,n,!0)}matchContext(t){return yD(this.parent,t)}enterUnfinishedNodesBefore(t){let n=this.childBefore(t),r=this;for(;n;){let i=n.lastChild;if(!i||i.to!=n.to)break;i.type.isError&&i.from==i.to?(r=n,n=i.prevSibling):n=i}return r}get node(){return this}get next(){return this.parent}}class La extends cfe{constructor(t,n,r,i){super(),this._tree=t,this.from=n,this.index=r,this._parent=i}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,i,s=0){for(let a=this;;){for(let{children:o,positions:l}=a._tree,c=n>0?o.length:-1;t!=c;t+=n){let u=o[t],d=l[t]+a.from;if(lfe(i,r,d,d+u.length)){if(u instanceof xO){if(s&ri.ExcludeBuffers)continue;let h=u.findChild(0,u.buffer.length,n,r-d,i);if(h>-1)return new Ku(new SZe(a,u,t,d),null,h)}else if(s&ri.IncludeAnonymous||!u.type.isAnonymous||W7(u)){let h;if(!(s&ri.IgnoreMounts)&&(h=lx.get(u))&&!h.overlay)return new La(h.tree,d,t,a);let f=new La(u,d,t,a);return s&ri.IncludeAnonymous||!f.type.isAnonymous?f:f.nextChild(n<0?u.children.length-1:0,n,r,i)}}}if(s&ri.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?t=a.index+n:t=n<0?-1:a._parent._tree.children.length,a=a._parent,!a))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(t){return this.nextChild(0,1,t,2)}childBefore(t){return this.nextChild(this._tree.children.length-1,-1,t,-2)}enter(t,n,r=0){let i;if(!(r&ri.IgnoreOverlays)&&(i=lx.get(this._tree))&&i.overlay){let s=t-this.from;for(let{from:a,to:o}of i.overlay)if((n>0?a<=s:a<s)&&(n<0?o>=s:o>s))return new La(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let t=this;for(;t.type.isAnonymous&&t._parent;)t=t._parent;return t}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function wV(e,t,n,r){let i=e.cursor(),s=[];if(!i.firstChild())return s;if(n!=null){for(let a=!1;!a;)if(a=i.type.is(n),!i.nextSibling())return s}for(;;){if(r!=null&&i.type.is(r))return s;if(i.type.is(t)&&s.push(i.node),!i.nextSibling())return r==null?s:[]}}function yD(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}class SZe{constructor(t,n,r,i){this.parent=t,this.buffer=n,this.index=r,this.start=i}}class Ku extends cfe{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(t,n,r){super(),this.context=t,this._parent=n,this.index=r,this.type=t.buffer.set.types[t.buffer.buffer[r]]}child(t,n,r){let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return s<0?null:new Ku(this.context,this,s)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(t){return this.child(1,t,2)}childBefore(t){return this.child(-1,t,-2)}enter(t,n,r=0){if(r&ri.ExcludeBuffers)return null;let{buffer:i}=this.context,s=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return s<0?null:new Ku(this.context,this,s)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(t){return this._parent?null:this.context.parent.nextChild(this.context.index+t,t,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new Ku(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new Ku(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let t=[],n=[],{buffer:r}=this.context,i=this.index+4,s=r.buffer[this.index+3];if(s>i){let a=r.buffer[this.index+1];t.push(r.slice(i,s,a)),n.push(0)}return new ur(this.type,t,n,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function ufe(e){if(!e.length)return null;let t=0,n=e[0];for(let s=1;s<e.length;s++){let a=e[s];(a.from>n.from||a.to<n.to)&&(n=a,t=s)}let r=n instanceof La&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new $Ze(i,n)}class $Ze{constructor(t,n){this.heads=t,this.node=n}get next(){return ufe(this.heads)}}function kZe(e,t,n){let r=e.resolveInner(t,n),i=null;for(let s=r instanceof La?r:r.context.parent;s;s=s.parent)if(s.index<0){let a=s.parent;(i||(i=[r])).push(a.resolve(t,n)),s=a}else{let a=lx.get(s.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new La(a.tree,a.overlay[0].from+s.from,-1,s);(i||(i=[r])).push(cx(o,t,n,!1))}}return i?ufe(i):r}class NP{get name(){return this.type.name}constructor(t,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,t instanceof La)this.yieldNode(t);else{this._tree=t.context.parent,this.buffer=t.context;for(let r=t._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=t,this.yieldBuf(t.index)}}yieldNode(t){return t?(this._tree=t,this.type=t.type,this.from=t.from,this.to=t.to,!0):!1}yieldBuf(t,n){this.index=t;let{start:r,buffer:i}=this.buffer;return this.type=n||i.set.types[i.buffer[t]],this.from=r+i.buffer[t+1],this.to=r+i.buffer[t+2],!0}yield(t){return t?t instanceof La?(this.buffer=null,this.yieldNode(t)):(this.buffer=t.context,this.yieldBuf(t.index,t.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(t,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(t<0?this._tree._tree.children.length-1:0,t,n,r,this.mode));let{buffer:i}=this.buffer,s=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.buffer.start,r);return s<0?!1:(this.stack.push(this.index),this.yieldBuf(s))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(t){return this.enterChild(1,t,2)}childBefore(t){return this.enterChild(-1,t,-2)}enter(t,n,r=this.mode){return this.buffer?r&ri.ExcludeBuffers?!1:this.enterChild(1,t,n):this.yield(this._tree.enter(t,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ri.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let t=this.mode&ri.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(t)}sibling(t){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+t,t,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(t<0){let i=r<0?0:this.stack[r]+4;if(this.index!=i)return this.yieldBuf(n.findChild(i,this.index,-1,0,4))}else{let i=n.buffer[this.index+3];if(i<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(i)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+t,t,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(t){let n,r,{buffer:i}=this;if(i){if(t>0){if(this.index<i.buffer.buffer.length)return!1}else for(let s=0;s<this.index;s++)if(i.buffer.buffer[s+3]<this.index)return!1;({index:n,parent:r}=i)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let s=n+t,a=t<0?-1:r._tree.children.length;s!=a;s+=t){let o=r._tree.children[s];if(this.mode&ri.IncludeAnonymous||o instanceof xO||!o.type.isAnonymous||W7(o))return!1}return!0}move(t,n){if(n&&this.enterChild(t,0,4))return!0;for(;;){if(this.sibling(t))return!0;if(this.atLastNode(t)||!this.parent())return!1}}next(t=!0){return this.move(1,t)}prev(t=!0){return this.move(-1,t)}moveTo(t,n=0){for(;(this.from==this.to||(n<1?this.from>=t:this.from>t)||(n>-1?this.to<=t:this.to<t))&&this.parent(););for(;this.enterChild(1,t,n););return this}get node(){if(!this.buffer)return this._tree;let t=this.bufferNode,n=null,r=0;if(t&&t.context==this.buffer)e:for(let i=this.index,s=this.stack.length;s>=0;){for(let a=t;a;a=a._parent)if(a.index==i){if(i==this.index)return a;n=a,r=s+1;break e}i=this.stack[--s]}for(let i=r;i<this.stack.length;i++)n=new Ku(this.buffer,n,this.stack[i]);return this.bufferNode=new Ku(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(t,n){for(let r=0;;){let i=!1;if(this.type.isAnonymous||t(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(i=!0)}for(;;){if(i&&n&&n(this),i=this.type.isAnonymous,!r)return;if(this.nextSibling())break;this.parent(),r--,i=!0}}}matchContext(t){if(!this.buffer)return yD(this.node.parent,t);let{buffer:n}=this.buffer,{types:r}=n.set;for(let i=t.length-1,s=this.stack.length-1;i>=0;s--){if(s<0)return yD(this._tree,t,i);let a=r[n.buffer[this.stack[s]]];if(!a.isAnonymous){if(t[i]&&t[i]!=a.name)return!1;i--}}return!0}}function W7(e){return e.children.some(t=>t instanceof xO||!t.type.isAnonymous||W7(t))}function TZe(e){var t;let{buffer:n,nodeSet:r,maxBufferLength:i=ofe,reused:s=[],minRepeatType:a=r.types.length}=e,o=Array.isArray(n)?new U7(n,n.length):n,l=r.types,c=0,u=0;function d(x,S,k,Q,C,_){let{id:R,start:A,end:I,size:W}=o,G=u,U=c;for(;W<0;)if(o.next(),W==-1){let K=s[R];k.push(K),Q.push(A-x);return}else if(W==-3){c=R;return}else if(W==-4){u=R;return}else throw new RangeError(`Unrecognized record size: ${W}`);let q=l[R],B,j,M=A-x;if(I-A<=i&&(j=m(o.pos-S,C))){let K=new Uint16Array(j.size-j.skip),F=o.pos-j.size,X=K.length;for(;o.pos>F;)X=v(j.start,K,X);B=new xO(K,I-j.start,r),M=j.start-x}else{let K=o.pos-W;o.next();let F=[],X=[],V=R>=a?R:-1,L=0,H=I;for(;o.pos>K;)V>=0&&o.id==V&&o.size>=0?(o.end<=H-i&&(p(F,X,A,L,o.end,H,V,G,U),L=F.length,H=o.end),o.next()):_>2500?h(A,K,F,X):d(A,K,F,X,V,_+1);if(V>=0&&L>0&&L<F.length&&p(F,X,A,L,A,H,V,G,U),F.reverse(),X.reverse(),V>-1&&L>0){let ue=f(q,U);B=j7(q,F,X,0,F.length,0,I-A,ue,ue)}else B=g(q,F,X,I-A,G-I,U)}k.push(B),Q.push(M)}function h(x,S,k,Q){let C=[],_=0,R=-1;for(;o.pos>S;){let{id:A,start:I,end:W,size:G}=o;if(G>4)o.next();else{if(R>-1&&I<R)break;R<0&&(R=W-i),C.push(A,I,W),_++,o.next()}}if(_){let A=new Uint16Array(_*4),I=C[C.length-2];for(let W=C.length-3,G=0;W>=0;W-=3)A[G++]=C[W],A[G++]=C[W+1]-I,A[G++]=C[W+2]-I,A[G++]=G;k.push(new xO(A,C[2]-I,r)),Q.push(I-x)}}function f(x,S){return(k,Q,C)=>{let _=0,R=k.length-1,A,I;if(R>=0&&(A=k[R])instanceof ur){if(!R&&A.type==x&&A.length==C)return A;(I=A.prop(En.lookAhead))&&(_=Q[R]+A.length+I)}return g(x,k,Q,C,_,S)}}function p(x,S,k,Q,C,_,R,A,I){let W=[],G=[];for(;x.length>Q;)W.push(x.pop()),G.push(S.pop()+k-C);x.push(g(r.types[R],W,G,_-C,A-_,I)),S.push(C-k)}function g(x,S,k,Q,C,_,R){if(_){let A=[En.contextHash,_];R=R?[A].concat(R):[A]}if(C>25){let A=[En.lookAhead,C];R=R?[A].concat(R):[A]}return new ur(x,S,k,Q,R)}function m(x,S){let k=o.fork(),Q=0,C=0,_=0,R=k.end-i,A={size:0,start:0,skip:0};e:for(let I=k.pos-x;k.pos>I;){let W=k.size;if(k.id==S&&W>=0){A.size=Q,A.start=C,A.skip=_,_+=4,Q+=4,k.next();continue}let G=k.pos-W;if(W<0||G<I||k.start<R)break;let U=k.id>=a?4:0,q=k.start;for(k.next();k.pos>G;){if(k.size<0)if(k.size==-3)U+=4;else break e;else k.id>=a&&(U+=4);k.next()}C=q,Q+=W,_+=U}return(S<0||Q==x)&&(A.size=Q,A.start=C,A.skip=_),A.size>4?A:void 0}function v(x,S,k){let{id:Q,start:C,end:_,size:R}=o;if(o.next(),R>=0&&Q<a){let A=k;if(R>4){let I=o.pos-(R-4);for(;o.pos>I;)k=v(x,S,k)}S[--k]=A,S[--k]=_-x,S[--k]=C-x,S[--k]=Q}else R==-3?c=Q:R==-4&&(u=Q);return k}let b=[],y=[];for(;o.pos>0;)d(e.start||0,e.bufferStart||0,b,y,-1,0);let T=(t=e.length)!==null&&t!==void 0?t:b.length?y[0]+b[0].length:0;return new ur(l[e.topID],b.reverse(),y.reverse(),T)}const yV=new WeakMap;function JT(e,t){if(!e.isAnonymous||t instanceof xO||t.type!=e)return 1;let n=yV.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof ur)){n=1;break}n+=JT(e,r)}yV.set(t,n)}return n}function j7(e,t,n,r,i,s,a,o,l){let c=0;for(let p=r;p<i;p++)c+=JT(e,t[p]);let u=Math.ceil(c*1.5/8),d=[],h=[];function f(p,g,m,v,b){for(let y=m;y<v;){let T=y,x=g[y],S=JT(e,p[y]);for(y++;y<v;y++){let k=JT(e,p[y]);if(S+k>=u)break;S+=k}if(y==T+1){if(S>u){let k=p[T];f(k.children,k.positions,0,k.children.length,g[T]+b);continue}d.push(p[T])}else{let k=g[y-1]+p[y-1].length-x;d.push(j7(e,p,g,T,y,x,k,null,l))}h.push(x+b-s)}}return f(t,n,r,i,0),(o||l)(d,h,a)}class G7{constructor(){this.map=new WeakMap}setBuffer(t,n,r){let i=this.map.get(t);i||this.map.set(t,i=new Map),i.set(n,r)}getBuffer(t,n){let r=this.map.get(t);return r&&r.get(n)}set(t,n){t instanceof Ku?this.setBuffer(t.context.buffer,t.index,n):t instanceof La&&this.map.set(t.tree,n)}get(t){return t instanceof Ku?this.getBuffer(t.context.buffer,t.index):t instanceof La?this.map.get(t.tree):void 0}cursorSet(t,n){t.buffer?this.setBuffer(t.buffer.buffer,t.index,n):this.map.set(t.tree,n)}cursorGet(t){return t.buffer?this.getBuffer(t.buffer.buffer,t.index):this.map.get(t.tree)}}class xh{constructor(t,n,r,i,s=!1,a=!1){this.from=t,this.to=n,this.tree=r,this.offset=i,this.open=(s?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new xh(0,t.length,t,0,!1,r)];for(let s of n)s.to>t.length&&i.push(s);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],s=1,a=t.length?t[0]:null;for(let o=0,l=0,c=0;;o++){let u=o<n.length?n[o]:null,d=u?u.fromA:1e9;if(d-l>=r)for(;a&&a.from<d;){let h=a;if(l>=h.from||d<=h.to||c){let f=Math.max(h.from,l)-c,p=Math.min(h.to,d)-c;h=f>=p?null:new xh(f,p,h.tree,h.offset+c,o>0,!!u)}if(h&&i.push(h),a.to>d)break;a=s<t.length?t[s++]:null}if(!u)break;l=u.toA,c=u.toA-u.toB}return i}}let bQ=class{startParse(t,n,r){return typeof t=="string"&&(t=new PZe(t)),r=r?r.length?r.map(i=>new ic(i.from,i.to)):[new ic(0,0)]:[new ic(0,t.length)],this.createParse(t,n||[],r)}parse(t,n,r){let i=this.startParse(t,n,r);for(;;){let s=i.advance();if(s)return s}}};class PZe{constructor(t){this.string=t}get length(){return this.string.length}chunk(t){return this.string.slice(t)}get lineChunks(){return!1}read(t,n){return this.string.slice(t,n)}}function $c(e){return(t,n,r,i)=>new CZe(t,e,n,r,i)}class xV{constructor(t,n,r,i,s){this.parser=t,this.parse=n,this.overlay=r,this.target=i,this.from=s}}function SV(e){if(!e.length||e.some(t=>t.from>=t.to))throw new RangeError("Invalid inner parse ranges given: "+JSON.stringify(e))}class _Ze{constructor(t,n,r,i,s,a,o){this.parser=t,this.predicate=n,this.mounts=r,this.index=i,this.start=s,this.target=a,this.prev=o,this.depth=0,this.ranges=[]}}const xD=new En({perNode:!0});class CZe{constructor(t,n,r,i,s){this.nest=n,this.input=r,this.fragments=i,this.ranges=s,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=t}advance(){if(this.baseParse){let r=this.baseParse.advance();if(!r)return null;if(this.baseParse=null,this.baseTree=r,this.startInner(),this.stoppedAt!=null)for(let i of this.inner)i.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let r=this.baseTree;return this.stoppedAt!=null&&(r=new ur(r.type,r.children,r.positions,r.length,r.propValues.concat([[xD,this.stoppedAt]]))),r}let t=this.inner[this.innerDone],n=t.parse.advance();if(n){this.innerDone++;let r=Object.assign(Object.create(null),t.target.props);r[En.mounted.id]=new lx(n,t.overlay,t.parser),t.target.props=r}return null}get parsedPos(){if(this.baseParse)return 0;let t=this.input.length;for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].from<t&&(t=Math.min(t,this.inner[n].parse.parsedPos));return t}stopAt(t){if(this.stoppedAt=t,this.baseParse)this.baseParse.stopAt(t);else for(let n=this.innerDone;n<this.inner.length;n++)this.inner[n].parse.stopAt(t)}startInner(){let t=new RZe(this.fragments),n=null,r=null,i=new NP(new La(this.baseTree,this.ranges[0].from,0,null),ri.IncludeAnonymous|ri.IgnoreMounts);e:for(let s,a;;){let o=!0,l;if(this.stoppedAt!=null&&i.from>=this.stoppedAt)o=!1;else if(t.hasNode(i)){if(n){let c=n.mounts.find(u=>u.frag.from<=i.from&&u.frag.to>=i.to&&u.mount.overlay);if(c)for(let u of c.mount.overlay){let d=u.from+c.pos,h=u.to+c.pos;d>=i.from&&h<=i.to&&!n.ranges.some(f=>f.from<h&&f.to>d)&&n.ranges.push({from:d,to:h})}}o=!1}else if(r&&(a=QZe(r.ranges,i.from,i.to)))o=a!=2;else if(!i.type.isAnonymous&&(s=this.nest(i,this.input))&&(i.from<i.to||!s.overlay)){i.tree||EZe(i);let c=t.findMounts(i.from,s.parser);if(typeof s.overlay=="function")n=new _Ze(s.parser,s.overlay,c,this.inner.length,i.from,i.tree,n);else{let u=TV(this.ranges,s.overlay||(i.from<i.to?[new ic(i.from,i.to)]:[]));u.length&&SV(u),(u.length||!s.overlay)&&this.inner.push(new xV(s.parser,u.length?s.parser.startParse(this.input,PV(c,u),u):s.parser.startParse(""),s.overlay?s.overlay.map(d=>new ic(d.from-i.from,d.to-i.from)):null,i.tree,u.length?u[0].from:i.from)),s.overlay?u.length&&(r={ranges:u,depth:0,prev:r}):o=!1}}else if(n&&(l=n.predicate(i))&&(l===!0&&(l=new ic(i.from,i.to)),l.from<l.to)){let c=n.ranges.length-1;c>=0&&n.ranges[c].to==l.from?n.ranges[c]={from:n.ranges[c].from,to:l.to}:n.ranges.push(l)}if(o&&i.firstChild())n&&n.depth++,r&&r.depth++;else for(;!i.nextSibling();){if(!i.parent())break e;if(n&&!--n.depth){let c=TV(this.ranges,n.ranges);c.length&&(SV(c),this.inner.splice(n.index,0,new xV(n.parser,n.parser.startParse(this.input,PV(n.mounts,c),c),n.ranges.map(u=>new ic(u.from-n.start,u.to-n.start)),n.target,c[0].from))),n=n.prev}r&&!--r.depth&&(r=r.prev)}}}}function QZe(e,t,n){for(let r of e){if(r.from>=n)break;if(r.to>t)return r.from<=t&&r.to>=n?2:1}return 0}function $V(e,t,n,r,i,s){if(t<n){let a=e.buffer[t+1];r.push(e.slice(t,n,a)),i.push(a-s)}}function EZe(e){let{node:t}=e,n=[],r=t.context.buffer;do n.push(e.index),e.parent();while(!e.tree);let i=e.tree,s=i.children.indexOf(r),a=i.children[s],o=a.buffer,l=[s];function c(u,d,h,f,p,g){let m=n[g],v=[],b=[];$V(a,u,m,v,b,f);let y=o[m+1],T=o[m+2];l.push(v.length);let x=g?c(m+4,o[m+3],a.set.types[o[m]],y,T-y,g-1):t.toTree();return v.push(x),b.push(y-f),$V(a,o[m+3],d,v,b,f),new ur(h,v,b,p)}i.children[s]=c(0,o.length,_s.none,0,a.length,n.length-1);for(let u of l){let d=e.tree.children[u],h=e.tree.positions[u];e.yield(new La(d,h+e.from,u,e._tree))}}class kV{constructor(t,n){this.offset=n,this.done=!1,this.cursor=t.cursor(ri.IncludeAnonymous|ri.IgnoreMounts)}moveTo(t){let{cursor:n}=this,r=t-this.offset;for(;!this.done&&n.from<r;)n.to>=t&&n.enter(r,1,ri.IgnoreOverlays|ri.ExcludeBuffers)||n.next(!1)||(this.done=!0)}hasNode(t){if(this.moveTo(t.from),!this.done&&this.cursor.from+this.offset==t.from&&this.cursor.tree)for(let n=this.cursor.tree;;){if(n==t.tree)return!0;if(n.children.length&&n.positions[0]==0&&n.children[0]instanceof ur)n=n.children[0];else break}return!1}}let RZe=class{constructor(t){var n;if(this.fragments=t,this.curTo=0,this.fragI=0,t.length){let r=this.curFrag=t[0];this.curTo=(n=r.tree.prop(xD))!==null&&n!==void 0?n:r.to,this.inner=new kV(r.tree,-r.offset)}else this.curFrag=this.inner=null}hasNode(t){for(;this.curFrag&&t.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=t.from&&this.curTo>=t.to&&this.inner.hasNode(t)}nextFrag(){var t;if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let n=this.curFrag=this.fragments[this.fragI];this.curTo=(t=n.tree.prop(xD))!==null&&t!==void 0?t:n.to,this.inner=new kV(n.tree,-n.offset)}}findMounts(t,n){var r;let i=[];if(this.inner){this.inner.cursor.moveTo(t,1);for(let s=this.inner.cursor.node;s;s=s.parent){let a=(r=s.tree)===null||r===void 0?void 0:r.prop(En.mounted);if(a&&a.parser==n)for(let o=this.fragI;o<this.fragments.length;o++){let l=this.fragments[o];if(l.from>=s.to)break;l.tree==this.curFrag.tree&&i.push({frag:l,pos:s.from-l.offset,mount:a})}}}return i}};function TV(e,t){let n=null,r=t;for(let i=1,s=0;i<e.length;i++){let a=e[i-1].to,o=e[i].from;for(;s<r.length;s++){let l=r[s];if(l.from>=o)break;l.to<=a||(n||(r=n=t.slice()),l.from<a?(n[s]=new ic(l.from,a),l.to>o&&n.splice(s+1,0,new ic(o,l.to))):l.to>o?n[s--]=new ic(o,l.to):n.splice(s--,1))}}return r}function AZe(e,t,n,r){let i=0,s=0,a=!1,o=!1,l=-1e9,c=[];for(;;){let u=i==e.length?1e9:a?e[i].to:e[i].from,d=s==t.length?1e9:o?t[s].to:t[s].from;if(a!=o){let h=Math.max(l,n),f=Math.min(u,d,r);h<f&&c.push(new ic(h,f))}if(l=Math.min(u,d),l==1e9)break;u==l&&(a?(a=!1,i++):a=!0),d==l&&(o?(o=!1,s++):o=!0)}return c}function PV(e,t){let n=[];for(let{pos:r,mount:i,frag:s}of e){let a=r+(i.overlay?i.overlay[0].from:0),o=a+i.tree.length,l=Math.max(s.from,a),c=Math.min(s.to,o);if(i.overlay){let u=i.overlay.map(h=>new ic(h.from+r,h.to+r)),d=AZe(t,u,l,c);for(let h=0,f=l;;h++){let p=h==d.length,g=p?c:d[h].from;if(g>f&&n.push(new xh(f,g,i.tree,-a,s.from>=f||s.openStart,s.to<=g||s.openEnd)),p)break;f=d[h].to}}else n.push(new xh(l,c,i.tree,-a,s.from>=a||s.openStart,s.to<=o||s.openEnd))}return n}let SD=[],dfe=[];(()=>{let e="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?dfe:SD).push(n=n+e[t])})();function XZe(e){if(e<768)return!1;for(let t=0,n=SD.length;;){let r=t+n>>1;if(e<SD[r])n=r;else if(e>=dfe[r])t=r+1;else return!0;if(t==n)return!1}}function _V(e){return e>=127462&&e<=127487}const CV=8205;function DZe(e,t,n=!0,r=!0){return(n?hfe:IZe)(e,t,r)}function hfe(e,t,n){if(t==e.length)return t;t&&ffe(e.charCodeAt(t))&&Ofe(e.charCodeAt(t-1))&&t--;let r=wR(e,t);for(t+=QV(r);t<e.length;){let i=wR(e,t);if(r==CV||i==CV||n&&XZe(i))t+=QV(i),r=i;else if(_V(i)){let s=0,a=t-2;for(;a>=0&&_V(wR(e,a));)s++,a-=2;if(s%2==0)break;t+=2}else break}return t}function IZe(e,t,n){for(;t>0;){let r=hfe(e,t-2,n);if(r<t)return r;t--}return 0}function wR(e,t){let n=e.charCodeAt(t);if(!Ofe(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return ffe(r)?(n-55296<<10)+(r-56320)+65536:n}function ffe(e){return e>=56320&&e<57344}function Ofe(e){return e>=55296&&e<56320}function QV(e){return e<65536?1:2}let Cr=class pfe{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,n,r){[t,n]=Rv(this,t,n);let i=[];return this.decompose(0,t,i,2),r.length&&r.decompose(0,r.length,i,3),this.decompose(n,this.length,i,1),Wu.from(i,this.length-(n-t)+r.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,n=this.length){[t,n]=Rv(this,t,n);let r=[];return this.decompose(t,n,r,0),Wu.from(r,n-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let n=this.scanIdentical(t,1),r=this.length-this.scanIdentical(t,-1),i=new Aw(this),s=new Aw(t);for(let a=n,o=n;;){if(i.next(a),s.next(a),a=0,i.lineBreak!=s.lineBreak||i.done!=s.done||i.value!=s.value)return!1;if(o+=i.value.length,i.done||o>=r)return!0}}iter(t=1){return new Aw(this,t)}iterRange(t,n=this.length){return new gfe(this,t,n)}iterLines(t,n){let r;if(t==null)r=this.iter();else{n==null&&(n=this.lines+1);let i=this.line(t).from;r=this.iterRange(i,Math.max(i,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new mfe(r)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?pfe.empty:t.length<=32?new rs(t):Wu.from(rs.split(t,[]))}};class rs extends Cr{constructor(t,n=NZe(t)){super(),this.text=t,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(t,n,r,i){for(let s=0;;s++){let a=this.text[s],o=i+a.length;if((n?r:o)>=t)return new FZe(i,o,r,a);i=o+1,r++}}decompose(t,n,r,i){let s=t<=0&&n>=this.length?this:new rs(EV(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let a=r.pop(),o=e2(s.text,a.text.slice(),0,s.length);if(o.length<=32)r.push(new rs(o,a.length+s.length));else{let l=o.length>>1;r.push(new rs(o.slice(0,l)),new rs(o.slice(l)))}}else r.push(s)}replace(t,n,r){if(!(r instanceof rs))return super.replace(t,n,r);[t,n]=Rv(this,t,n);let i=e2(this.text,e2(r.text,EV(this.text,0,t)),n),s=this.length+r.length-(n-t);return i.length<=32?new rs(i,s):Wu.from(rs.split(i,[]),s)}sliceString(t,n=this.length,r=`
|
|
1076
1076
|
`){[t,n]=Rv(this,t,n);let i="";for(let s=0,a=0;s<=n&&a<this.text.length;a++){let o=this.text[a],l=s+o.length;s>t&&a&&(i+=r),t<l&&n>s&&(i+=o.slice(Math.max(0,t-s),n-s)),s=l+1}return i}flatten(t){for(let n of this.text)t.push(n)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let s of t)r.push(s),i+=s.length+1,r.length==32&&(n.push(new rs(r,i)),r=[],i=-1);return i>-1&&n.push(new rs(r,i)),n}}class Wu extends Cr{constructor(t,n){super(),this.children=t,this.length=n,this.lines=0;for(let r of t)this.lines+=r.lines}lineInner(t,n,r,i){for(let s=0;;s++){let a=this.children[s],o=i+a.length,l=r+a.lines-1;if((n?l:o)>=t)return a.lineInner(t,n,r,i);i=o+1,r=l+1}}decompose(t,n,r,i){for(let s=0,a=0;a<=n&&s<this.children.length;s++){let o=this.children[s],l=a+o.length;if(t<=l&&n>=a){let c=i&((a<=t?1:0)|(l>=n?2:0));a>=t&&l<=n&&!c?r.push(o):o.decompose(t-a,n-a,r,c)}a=l+1}}replace(t,n,r){if([t,n]=Rv(this,t,n),r.lines<this.lines)for(let i=0,s=0;i<this.children.length;i++){let a=this.children[i],o=s+a.length;if(t>=s&&n<=o){let l=a.replace(t-s,n-s,r),c=this.lines-a.lines+l.lines;if(l.lines<c>>4&&l.lines>c>>6){let u=this.children.slice();return u[i]=l,new Wu(u,this.length-(n-t)+r.length)}return super.replace(s,o,l)}s=o+1}return super.replace(t,n,r)}sliceString(t,n=this.length,r=`
|
|
1077
1077
|
`){[t,n]=Rv(this,t,n);let i="";for(let s=0,a=0;s<this.children.length&&a<=n;s++){let o=this.children[s],l=a+o.length;a>t&&s&&(i+=r),t<l&&n>a&&(i+=o.sliceString(t-a,n-a,r)),a=l+1}return i}flatten(t){for(let n of this.children)n.flatten(t)}scanIdentical(t,n){if(!(t instanceof Wu))return 0;let r=0,[i,s,a,o]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,s+=n){if(i==a||s==o)return r;let l=this.children[i],c=t.children[s];if(l!=c)return r+l.scanIdentical(c,n);r+=l.length+1}}static from(t,n=t.reduce((r,i)=>r+i.length+1,-1)){let r=0;for(let f of t)r+=f.lines;if(r<32){let f=[];for(let p of t)p.flatten(f);return new rs(f,n)}let i=Math.max(32,r>>5),s=i<<1,a=i>>1,o=[],l=0,c=-1,u=[];function d(f){let p;if(f.lines>s&&f instanceof Wu)for(let g of f.children)d(g);else f.lines>a&&(l>a||!l)?(h(),o.push(f)):f instanceof rs&&l&&(p=u[u.length-1])instanceof rs&&f.lines+p.lines<=32?(l+=f.lines,c+=f.length+1,u[u.length-1]=new rs(p.text.concat(f.text),p.length+1+f.length)):(l+f.lines>i&&h(),l+=f.lines,c+=f.length+1,u.push(f))}function h(){l!=0&&(o.push(u.length==1?u[0]:Wu.from(u,c)),c=-1,l=u.length=0)}for(let f of t)d(f);return h(),o.length==1?o[0]:new Wu(o,n)}}Cr.empty=new rs([""],0);function NZe(e){let t=-1;for(let n of e)t+=n.length+1;return t}function e2(e,t,n=0,r=1e9){for(let i=0,s=0,a=!0;s<e.length&&i<=r;s++){let o=e[s],l=i+o.length;l>=n&&(l>r&&(o=o.slice(0,r-i)),i<n&&(o=o.slice(n-i)),a?(t[t.length-1]+=o,a=!1):t.push(o)),i=l+1}return t}function EV(e,t,n){return e2(e,[""],t,n)}class Aw{constructor(t,n=1){this.dir=n,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[n>0?1:(t instanceof rs?t.text.length:t.children.length)<<1]}nextInner(t,n){for(this.done=this.lineBreak=!1;;){let r=this.nodes.length-1,i=this.nodes[r],s=this.offsets[r],a=s>>1,o=i instanceof rs?i.text.length:i.children.length;if(a==(n>0?o:0)){if(r==0)return this.done=!0,this.value="",this;n>0&&this.offsets[r-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(n>0?0:1)){if(this.offsets[r]+=n,t==0)return this.lineBreak=!0,this.value=`
|
|
1078
1078
|
`,this;t--}else if(i instanceof rs){let l=i.text[a+(n<0?-1:0)];if(this.offsets[r]+=n,l.length>Math.max(0,t))return this.value=t==0?l:n>0?l.slice(t):l.slice(0,l.length-t),this;t-=l.length}else{let l=i.children[a+(n<0?-1:0)];t>l.length?(t-=l.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(l),this.offsets.push(n>0?1:(l instanceof rs?l.text.length:l.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}}class gfe{constructor(t,n,r){this.value="",this.done=!1,this.cursor=new Aw(t,n>r?-1:1),this.pos=n>r?t.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(t,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;t>r&&(t=r),r-=t;let{value:i}=this.cursor.next(t);return this.pos+=(i.length+t)*n,this.value=i.length<=r?i:n<0?i.slice(i.length-r):i.slice(0,r),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class mfe{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:n,lineBreak:r,value:i}=this.inner.next(t);return n&&this.afterBreak?(this.value="",this.afterBreak=!1):n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(Cr.prototype[Symbol.iterator]=function(){return this.iter()},Aw.prototype[Symbol.iterator]=gfe.prototype[Symbol.iterator]=mfe.prototype[Symbol.iterator]=function(){return this});let FZe=class{constructor(t,n,r,i){this.from=t,this.to=n,this.number=r,this.text=i}get length(){return this.to-this.from}};function Rv(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function ga(e,t,n=!0,r=!0){return DZe(e,t,n,r)}function MZe(e){return e>=56320&&e<57344}function zZe(e){return e>=55296&&e<56320}function Xo(e,t){let n=e.charCodeAt(t);if(!zZe(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return MZe(r)?(n-55296<<10)+(r-56320)+65536:n}function V7(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function ju(e){return e<65536?1:2}const $D=/\r\n?|\n/;var Oa=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(Oa||(Oa={}));class ld{constructor(t){this.sections=t}get length(){let t=0;for(let n=0;n<this.sections.length;n+=2)t+=this.sections[n];return t}get newLength(){let t=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];t+=r<0?this.sections[n]:r}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let n=0,r=0,i=0;n<this.sections.length;){let s=this.sections[n++],a=this.sections[n++];a<0?(t(r,i,s),i+=s):i+=a,r+=s}}iterChangedRanges(t,n=!1){kD(this,t,n)}get invertedDesc(){let t=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];i<0?t.push(r,i):t.push(i,r)}return new ld(t)}composeDesc(t){return this.empty?t:t.empty?this:vfe(this,t)}mapDesc(t,n=!1){return t.empty?this:TD(this,t,n)}mapPos(t,n=-1,r=Oa.Simple){let i=0,s=0;for(let a=0;a<this.sections.length;){let o=this.sections[a++],l=this.sections[a++],c=i+o;if(l<0){if(c>t)return s+(t-i);s+=o}else{if(r!=Oa.Simple&&c>=t&&(r==Oa.TrackDel&&i<t&&c>t||r==Oa.TrackBefore&&i<t||r==Oa.TrackAfter&&c>t))return null;if(c>t||c==t&&n<0&&!o)return t==i||n<0?s:s+l;s+=l}i=c}if(t>i)throw new RangeError(`Position ${t} is out of range for changeset of length ${i}`);return s}touchesRange(t,n=t){for(let r=0,i=0;r<this.sections.length&&i<=n;){let s=this.sections[r++],a=this.sections[r++],o=i+s;if(a>=0&&i<=n&&o>=t)return i<t&&o>n?"cover":!0;i=o}return!1}toString(){let t="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],i=this.sections[n++];t+=(t?" ":"")+r+(i>=0?":"+i:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ld(t)}static create(t){return new ld(t)}}class Rs extends ld{constructor(t,n){super(t),this.inserted=n}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return kD(this,(n,r,i,s,a)=>t=t.replace(i,i+(r-n),a),!1),t}mapDesc(t,n=!1){return TD(this,t,n,!0)}invert(t){let n=this.sections.slice(),r=[];for(let i=0,s=0;i<n.length;i+=2){let a=n[i],o=n[i+1];if(o>=0){n[i]=o,n[i+1]=a;let l=i>>1;for(;r.length<l;)r.push(Cr.empty);r.push(a?t.slice(s,s+a):Cr.empty)}s+=a}return new Rs(n,r)}compose(t){return this.empty?t:t.empty?this:vfe(this,t,!0)}map(t,n=!1){return t.empty?this:TD(this,t,n,!0)}iterChanges(t,n=!1){kD(this,t,n)}get desc(){return ld.create(this.sections)}filter(t){let n=[],r=[],i=[],s=new ux(this);e:for(let a=0,o=0;;){let l=a==t.length?1e9:t[a++];for(;o<l||o==l&&s.len==0;){if(s.done)break e;let u=Math.min(s.len,l-o);Ra(i,u,-1);let d=s.ins==-1?-1:s.off==0?s.ins:0;Ra(n,u,d),d>0&&Yf(r,n,s.text),s.forward(u),o+=u}let c=t[a++];for(;o<c;){if(s.done)break e;let u=Math.min(s.len,c-o);Ra(n,u,-1),Ra(i,u,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(u),o+=u}}return{changes:new Rs(n,r),filtered:ld.create(i)}}toJSON(){let t=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],i=this.sections[n+1];i<0?t.push(r):i==0?t.push([r]):t.push([r].concat(this.inserted[n>>1].toJSON()))}return t}static of(t,n,r){let i=[],s=[],a=0,o=null;function l(u=!1){if(!u&&!i.length)return;a<n&&Ra(i,n-a,-1);let d=new Rs(i,s);o=o?o.compose(d.map(o)):d,i=[],s=[],a=0}function c(u){if(Array.isArray(u))for(let d of u)c(d);else if(u instanceof Rs){if(u.length!=n)throw new RangeError(`Mismatched change set length (got ${u.length}, expected ${n})`);l(),o=o?o.compose(u.map(o)):u}else{let{from:d,to:h=d,insert:f}=u;if(d>h||d<0||h>n)throw new RangeError(`Invalid change range ${d} to ${h} (in doc of length ${n})`);let p=f?typeof f=="string"?Cr.of(f.split(r||$D)):f:Cr.empty,g=p.length;if(d==h&&g==0)return;d<a&&l(),d>a&&Ra(i,d-a,-1),Ra(i,h-d,g),Yf(s,i,p),a=h}}return c(t),l(!o),o}static empty(t){return new Rs(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let i=0;i<t.length;i++){let s=t[i];if(typeof s=="number")n.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((a,o)=>o&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)n.push(s[0],0);else{for(;r.length<i;)r.push(Cr.empty);r[i]=Cr.of(s.slice(1)),n.push(s[0],r[i].length)}}}return new Rs(n,r)}static createSet(t,n){return new Rs(t,n)}}function Ra(e,t,n,r=!1){if(t==0&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function Yf(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(Cr.empty);e.push(n)}}function kD(e,t,n){let r=e.inserted;for(let i=0,s=0,a=0;a<e.sections.length;){let o=e.sections[a++],l=e.sections[a++];if(l<0)i+=o,s+=o;else{let c=i,u=s,d=Cr.empty;for(;c+=o,u+=l,l&&r&&(d=d.append(r[a-2>>1])),!(n||a==e.sections.length||e.sections[a+1]<0);)o=e.sections[a++],l=e.sections[a++];t(i,c,s,u,d),i=c,s=u}}}function TD(e,t,n,r=!1){let i=[],s=r?[]:null,a=new ux(e),o=new ux(t);for(let l=-1;;){if(a.done&&o.len||o.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&o.ins==-1){let c=Math.min(a.len,o.len);Ra(i,c,-1),a.forward(c),o.forward(c)}else if(o.ins>=0&&(a.ins<0||l==a.i||a.off==0&&(o.len<a.len||o.len==a.len&&!n))){let c=o.len;for(Ra(i,o.ins,-1);c;){let u=Math.min(a.len,c);a.ins>=0&&l<a.i&&a.len<=u&&(Ra(i,0,a.ins),s&&Yf(s,i,a.text),l=a.i),a.forward(u),c-=u}o.next()}else if(a.ins>=0){let c=0,u=a.len;for(;u;)if(o.ins==-1){let d=Math.min(u,o.len);c+=d,u-=d,o.forward(d)}else if(o.ins==0&&o.len<u)u-=o.len,o.next();else break;Ra(i,c,l<a.i?a.ins:0),s&&l<a.i&&Yf(s,i,a.text),l=a.i,a.forward(a.len-u)}else{if(a.done&&o.done)return s?Rs.createSet(i,s):ld.create(i);throw new Error("Mismatched change set lengths")}}}function vfe(e,t,n=!1){let r=[],i=n?[]:null,s=new ux(e),a=new ux(t);for(let o=!1;;){if(s.done&&a.done)return i?Rs.createSet(r,i):ld.create(r);if(s.ins==0)Ra(r,s.len,0,o),s.next();else if(a.len==0&&!a.done)Ra(r,0,a.ins,o),i&&Yf(i,r,a.text),a.next();else{if(s.done||a.done)throw new Error("Mismatched change set lengths");{let l=Math.min(s.len2,a.len),c=r.length;if(s.ins==-1){let u=a.ins==-1?-1:a.off?0:a.ins;Ra(r,l,u,o),i&&u&&Yf(i,r,a.text)}else a.ins==-1?(Ra(r,s.off?0:s.len,l,o),i&&Yf(i,r,s.textBit(l))):(Ra(r,s.off?0:s.len,a.off?0:a.ins,o),i&&!a.off&&Yf(i,r,a.text));o=(s.ins>l||a.ins>=0&&a.len>l)&&(o||r.length>c),s.forward2(l),a.forward(l)}}}}class ux{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length?Cr.empty:t[n]}textBit(t){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!t?Cr.empty:n[r].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}}class Np{constructor(t,n,r){this.from=t,this.to=n,this.flags=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new Np(r,i,this.flags)}extend(t,n=t){if(t<=this.anchor&&n>=this.anchor)return Ve.range(t,n);let r=Math.abs(t-this.anchor)>Math.abs(n-this.anchor)?t:n;return Ve.range(this.anchor,r)}eq(t,n=!1){return this.anchor==t.anchor&&this.head==t.head&&(!n||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return Ve.range(t.anchor,t.head)}static create(t,n,r){return new Np(t,n,r)}}class Ve{constructor(t,n){this.ranges=t,this.mainIndex=n}map(t,n=-1){return t.empty?this:Ve.create(this.ranges.map(r=>r.map(t,n)),this.mainIndex)}eq(t,n=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let r=0;r<this.ranges.length;r++)if(!this.ranges[r].eq(t.ranges[r],n))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new Ve([this.main],0)}addRange(t,n=!0){return Ve.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,Ve.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Ve(t.ranges.map(n=>Np.fromJSON(n)),t.main)}static single(t,n=t){return new Ve([Ve.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,i=0;i<t.length;i++){let s=t[i];if(s.empty?s.from<=r:s.from<r)return Ve.normalized(t.slice(),n);r=s.to}return new Ve(t,n)}static cursor(t,n=0,r,i){return Np.create(t,t,(n==0?0:n<0?8:16)|(r==null?7:Math.min(6,r))|(i??16777215)<<6)}static range(t,n,r,i){let s=(r??16777215)<<6|(i==null?7:Math.min(6,i));return n<t?Np.create(n,t,48|s):Np.create(t,n,(n>t?8:0)|s)}static normalized(t,n=0){let r=t[n];t.sort((i,s)=>i.from-s.from),n=t.indexOf(r);for(let i=1;i<t.length;i++){let s=t[i],a=t[i-1];if(s.empty?s.from<=a.to:s.from<a.to){let o=a.from,l=Math.max(s.to,a.to);i<=n&&n--,t.splice(--i,2,s.anchor>s.head?Ve.range(l,o):Ve.range(o,l))}}return new Ve(t,n)}}function bfe(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let Y7=0;class Ut{constructor(t,n,r,i,s){this.combine=t,this.compareInput=n,this.compare=r,this.isStatic=i,this.id=Y7++,this.default=t([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(t={}){return new Ut(t.combine||(n=>n),t.compareInput||((n,r)=>n===r),t.compare||(t.combine?(n,r)=>n===r:B7),!!t.static,t.enables)}of(t){return new t2([],this,0,t)}compute(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new t2(t,this,1,n)}computeN(t,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new t2(t,this,2,n)}from(t,n){return n||(n=r=>r),this.compute([t],r=>n(r.field(t)))}}function B7(e,t){return e==t||e.length==t.length&&e.every((n,r)=>n===t[r])}class t2{constructor(t,n,r,i){this.dependencies=t,this.facet=n,this.type=r,this.value=i,this.id=Y7++}dynamicSlot(t){var n;let r=this.value,i=this.facet.compareInput,s=this.id,a=t[s]>>1,o=this.type==2,l=!1,c=!1,u=[];for(let d of this.dependencies)d=="doc"?l=!0:d=="selection"?c=!0:(((n=t[d.id])!==null&&n!==void 0?n:1)&1)==0&&u.push(t[d.id]);return{create(d){return d.values[a]=r(d),1},update(d,h){if(l&&h.docChanged||c&&(h.docChanged||h.selection)||PD(d,u)){let f=r(d);if(o?!RV(f,d.values[a],i):!i(f,d.values[a]))return d.values[a]=f,1}return 0},reconfigure:(d,h)=>{let f,p=h.config.address[s];if(p!=null){let g=MP(h,p);if(this.dependencies.every(m=>m instanceof Ut?h.facet(m)===d.facet(m):m instanceof na?h.field(m,!1)==d.field(m,!1):!0)||(o?RV(f=r(d),g,i):i(f=r(d),g)))return d.values[a]=g,0}else f=r(d);return d.values[a]=f,1}}}}function RV(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function PD(e,t){let n=!1;for(let r of t)Xw(e,r)&1&&(n=!0);return n}function LZe(e,t,n){let r=n.map(l=>e[l.id]),i=n.map(l=>l.type),s=r.filter(l=>!(l&1)),a=e[t.id]>>1;function o(l){let c=[];for(let u=0;u<r.length;u++){let d=MP(l,r[u]);if(i[u]==2)for(let h of d)c.push(h);else c.push(d)}return t.combine(c)}return{create(l){for(let c of r)Xw(l,c);return l.values[a]=o(l),1},update(l,c){if(!PD(l,s))return 0;let u=o(l);return t.compare(u,l.values[a])?0:(l.values[a]=u,1)},reconfigure(l,c){let u=PD(l,r),d=c.config.facets[t.id],h=c.facet(t);if(d&&!u&&B7(n,d))return l.values[a]=h,0;let f=o(l);return t.compare(f,h)?(l.values[a]=h,0):(l.values[a]=f,1)}}}const Z$=Ut.define({static:!0});class na{constructor(t,n,r,i,s){this.id=t,this.createF=n,this.updateF=r,this.compareF=i,this.spec=s,this.provides=void 0}static define(t){let n=new na(Y7++,t.create,t.update,t.compare||((r,i)=>r===i),t);return t.provide&&(n.provides=t.provide(n)),n}create(t){let n=t.facet(Z$).find(r=>r.field==this);return(n?.create||this.createF)(t)}slot(t){let n=t[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,i)=>{let s=r.values[n],a=this.updateF(s,i);return this.compareF(s,a)?0:(r.values[n]=a,1)},reconfigure:(r,i)=>{let s=r.facet(Z$),a=i.facet(Z$),o;return(o=s.find(l=>l.field==this))&&o!=a.find(l=>l.field==this)?(r.values[n]=o.create(r),1):i.config.address[this.id]!=null?(r.values[n]=i.field(this),0):(r.values[n]=this.create(r),1)}}}init(t){return[this,Z$.of({field:this,create:t})]}get extension(){return this}}const Qp={lowest:4,low:3,default:2,high:1,highest:0};function ub(e){return t=>new wfe(t,e)}const Kh={highest:ub(Qp.highest),high:ub(Qp.high),default:ub(Qp.default),low:ub(Qp.low),lowest:ub(Qp.lowest)};class wfe{constructor(t,n){this.inner=t,this.prec=n}}class wQ{of(t){return new _D(this,t)}reconfigure(t){return wQ.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class _D{constructor(t,n){this.compartment=t,this.inner=n}}class FP{constructor(t,n,r,i,s,a){for(this.base=t,this.compartments=n,this.dynamicSlots=r,this.address=i,this.staticValues=s,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(t){let n=this.address[t.id];return n==null?t.default:this.staticValues[n>>1]}static resolve(t,n,r){let i=[],s=Object.create(null),a=new Map;for(let h of qZe(t,n,a))h instanceof na?i.push(h):(s[h.facet.id]||(s[h.facet.id]=[])).push(h);let o=Object.create(null),l=[],c=[];for(let h of i)o[h.id]=c.length<<1,c.push(f=>h.slot(f));let u=r?.config.facets;for(let h in s){let f=s[h],p=f[0].facet,g=u&&u[h]||[];if(f.every(m=>m.type==0))if(o[p.id]=l.length<<1|1,B7(g,f))l.push(r.facet(p));else{let m=p.combine(f.map(v=>v.value));l.push(r&&p.compare(m,r.facet(p))?r.facet(p):m)}else{for(let m of f)m.type==0?(o[m.id]=l.length<<1|1,l.push(m.value)):(o[m.id]=c.length<<1,c.push(v=>m.dynamicSlot(v)));o[p.id]=c.length<<1,c.push(m=>LZe(m,p,f))}}let d=c.map(h=>h(o));return new FP(t,a,d,o,l,s)}}function qZe(e,t,n){let r=[[],[],[],[],[]],i=new Map;function s(a,o){let l=i.get(a);if(l!=null){if(l<=o)return;let c=r[l].indexOf(a);c>-1&&r[l].splice(c,1),a instanceof _D&&n.delete(a.compartment)}if(i.set(a,o),Array.isArray(a))for(let c of a)s(c,o);else if(a instanceof _D){if(n.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let c=t.get(a.compartment)||a.inner;n.set(a.compartment,c),s(c,o)}else if(a instanceof wfe)s(a.inner,a.prec);else if(a instanceof na)r[o].push(a),a.provides&&s(a.provides,o);else if(a instanceof t2)r[o].push(a),a.facet.extensions&&s(a.facet.extensions,Qp.default);else{let c=a.extension;if(!c)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(c,o)}}return s(e,Qp.default),r.reduce((a,o)=>a.concat(o))}function Xw(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function MP(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}const yfe=Ut.define(),CD=Ut.define({combine:e=>e.some(t=>t),static:!0}),xfe=Ut.define({combine:e=>e.length?e[0]:void 0,static:!0}),Sfe=Ut.define(),$fe=Ut.define(),kfe=Ut.define(),Tfe=Ut.define({combine:e=>e.length?e[0]:!1});class _d{constructor(t,n){this.type=t,this.value=n}static define(){return new UZe}}class UZe{of(t){return new _d(this,t)}}class WZe{constructor(t){this.map=t}of(t){return new Xn(this,t)}}class Xn{constructor(t,n){this.type=t,this.value=n}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new Xn(this.type,n)}is(t){return this.type==t}static define(t={}){return new WZe(t.map||(n=>n))}static mapEffects(t,n){if(!t.length)return t;let r=[];for(let i of t){let s=i.map(n);s&&r.push(s)}return r}}Xn.reconfigure=Xn.define();Xn.appendConfig=Xn.define();class Ps{constructor(t,n,r,i,s,a){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=s,this.scrollIntoView=a,this._doc=null,this._state=null,r&&bfe(r,n.newLength),s.some(o=>o.type==Ps.time)||(this.annotations=s.concat(Ps.time.of(Date.now())))}static create(t,n,r,i,s,a){return new Ps(t,n,r,i,s,a)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(t){for(let n of this.annotations)if(n.type==t)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(Ps.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]=="."))}}Ps.time=_d.define();Ps.userEvent=_d.define();Ps.addToHistory=_d.define();Ps.remote=_d.define();function jZe(e,t){let n=[];for(let r=0,i=0;;){let s,a;if(r<e.length&&(i==t.length||t[i]>=e[r]))s=e[r++],a=e[r++];else if(i<t.length)s=t[i++],a=t[i++];else return n;!n.length||n[n.length-1]<s?n.push(s,a):n[n.length-1]<a&&(n[n.length-1]=a)}}function Pfe(e,t,n){var r;let i,s,a;return n?(i=t.changes,s=Rs.empty(t.changes.length),a=e.changes.compose(t.changes)):(i=t.changes.map(e.changes),s=e.changes.mapDesc(t.changes,!0),a=e.changes.compose(i)),{changes:a,selection:t.selection?t.selection.map(s):(r=e.selection)===null||r===void 0?void 0:r.map(i),effects:Xn.mapEffects(e.effects,i).concat(Xn.mapEffects(t.effects,s)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function QD(e,t,n){let r=t.selection,i=W0(t.annotations);return t.userEvent&&(i=i.concat(Ps.userEvent.of(t.userEvent))),{changes:t.changes instanceof Rs?t.changes:Rs.of(t.changes||[],n,e.facet(xfe)),selection:r&&(r instanceof Ve?r:Ve.single(r.anchor,r.head)),effects:W0(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function _fe(e,t,n){let r=QD(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let s=1;s<t.length;s++){t[s].filter===!1&&(n=!1);let a=!!t[s].sequential;r=Pfe(r,QD(e,t[s],a?r.changes.newLength:e.doc.length),a)}let i=Ps.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return VZe(n?GZe(i):i)}function GZe(e){let t=e.startState,n=!0;for(let i of t.facet(Sfe)){let s=i(e);if(s===!1){n=!1;break}Array.isArray(s)&&(n=n===!0?s:jZe(n,s))}if(n!==!0){let i,s;if(n===!1)s=e.changes.invertedDesc,i=Rs.empty(t.doc.length);else{let a=e.changes.filter(n);i=a.changes,s=a.filtered.mapDesc(a.changes).invertedDesc}e=Ps.create(t,i,e.selection&&e.selection.map(s),Xn.mapEffects(e.effects,s),e.annotations,e.scrollIntoView)}let r=t.facet($fe);for(let i=r.length-1;i>=0;i--){let s=r[i](e);s instanceof Ps?e=s:Array.isArray(s)&&s.length==1&&s[0]instanceof Ps?e=s[0]:e=_fe(t,W0(s),!1)}return e}function VZe(e){let t=e.startState,n=t.facet(kfe),r=e;for(let i=n.length-1;i>=0;i--){let s=n[i](e);s&&Object.keys(s).length&&(r=Pfe(r,QD(t,s,e.changes.newLength),!0))}return r==e?e:Ps.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}const YZe=[];function W0(e){return e==null?YZe:Array.isArray(e)?e:[e]}var Qi=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(Qi||(Qi={}));const BZe=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ED;try{ED=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function ZZe(e){if(ED)return ED.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>""&&(n.toUpperCase()!=n.toLowerCase()||BZe.test(n)))return!0}return!1}function HZe(e){return t=>{if(!/\S/.test(t))return Qi.Space;if(ZZe(t))return Qi.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return Qi.Word;return Qi.Other}}class dr{constructor(t,n,r,i,s,a){this.config=t,this.doc=n,this.selection=r,this.values=i,this.status=t.statusTemplate.slice(),this.computeSlot=s,a&&(a._state=this);for(let o=0;o<this.config.dynamicSlots.length;o++)Xw(this,o<<1);this.computeSlot=null}field(t,n=!0){let r=this.config.address[t.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return Xw(this,r),MP(this,r)}update(...t){return _fe(this,t,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let o of t.effects)o.is(wQ.reconfigure)?(n&&(i=new Map,n.compartments.forEach((l,c)=>i.set(c,l)),n=null),i.set(o.value.compartment,o.value.extension)):o.is(Xn.reconfigure)?(n=null,r=o.value):o.is(Xn.appendConfig)&&(n=null,r=W0(r).concat(o.value));let s;n?s=t.startState.values.slice():(n=FP.resolve(r,i,this),s=new dr(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,c)=>c.reconfigure(l,this),null).values);let a=t.startState.facet(CD)?t.newSelection:t.newSelection.asSingle();new dr(n,t.newDoc,a,s,(o,l)=>l.update(o,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:t},range:Ve.cursor(n.from+t.length)}))}changeByRange(t){let n=this.selection,r=t(n.ranges[0]),i=this.changes(r.changes),s=[r.range],a=W0(r.effects);for(let o=1;o<n.ranges.length;o++){let l=t(n.ranges[o]),c=this.changes(l.changes),u=c.map(i);for(let h=0;h<o;h++)s[h]=s[h].map(u);let d=i.mapDesc(c,!0);s.push(l.range.map(d)),i=i.compose(u),a=Xn.mapEffects(a,u).concat(Xn.mapEffects(W0(l.effects),d))}return{changes:i,selection:Ve.create(s,n.mainIndex),effects:a}}changes(t=[]){return t instanceof Rs?t:Rs.of(t,this.doc.length,this.facet(dr.lineSeparator))}toText(t){return Cr.of(t.split(this.facet(dr.lineSeparator)||$D))}sliceDoc(t=0,n=this.doc.length){return this.doc.sliceString(t,n,this.lineBreak)}facet(t){let n=this.config.address[t.id];return n==null?t.default:(Xw(this,n),MP(this,n))}toJSON(t){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let r in t){let i=t[r];i instanceof na&&this.config.address[i.id]!=null&&(n[r]=i.spec.toJSON(this.field(t[r]),this))}return n}static fromJSON(t,n={},r){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let i=[];if(r){for(let s in r)if(Object.prototype.hasOwnProperty.call(t,s)){let a=r[s],o=t[s];i.push(a.init(l=>a.spec.fromJSON(o,l)))}}return dr.create({doc:t.doc,selection:Ve.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=FP.resolve(t.extensions||[],new Map),r=t.doc instanceof Cr?t.doc:Cr.of((t.doc||"").split(n.staticFacet(dr.lineSeparator)||$D)),i=t.selection?t.selection instanceof Ve?t.selection:Ve.single(t.selection.anchor,t.selection.head):Ve.single(0);return bfe(i,r.length),n.staticFacet(CD)||(i=i.asSingle()),new dr(n,r,i,n.dynamicSlots.map(()=>null),(s,a)=>a.create(s),null)}get tabSize(){return this.facet(dr.tabSize)}get lineBreak(){return this.facet(dr.lineSeparator)||`
|
|
@@ -1084,7 +1084,7 @@ l0,-`+(n+144)+`c-2,-159.3,-10,-310.7,-24,-454c-53.3,-528,-210,-949.7,
|
|
|
1084
1084
|
`))};if(c.from==this.from&&s<this.from?c.from=s:c.to==this.to&&s>this.to&&(c.to=s),c.from==c.to&&!c.insert.length){let u=Ve.single(this.toEditorPos(r.selectionStart),this.toEditorPos(r.selectionEnd));u.main.eq(i)||t.dispatch({selection:u,userEvent:"select"});return}if((Yt.mac||Yt.android)&&c.from==a-1&&/^\. ?$/.test(r.text)&&t.contentDOM.getAttribute("autocorrect")=="off"&&(c={from:o,to:l,insert:Cr.of([r.text.replace("."," ")])}),this.pendingContextChange=c,!t.state.readOnly){let u=this.to-this.from+(c.to-c.from+c.insert.length);i9(t,c,Ve.single(this.toEditorPos(r.selectionStart,u),this.toEditorPos(r.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(t.state),this.setSelection(t.state))},this.handlers.characterboundsupdate=r=>{let i=[],s=null;for(let a=this.toEditorPos(r.rangeStart),o=this.toEditorPos(r.rangeEnd);a<o;a++){let l=t.coordsForChar(a);s=l&&new DOMRect(l.left,l.top,l.right-l.left,l.bottom-l.top)||s||new DOMRect,i.push(s)}n.updateCharacterBounds(r.rangeStart,i)},this.handlers.textformatupdate=r=>{let i=[];for(let s of r.getTextFormats()){let a=s.underlineStyle,o=s.underlineThickness;if(a!="None"&&o!="None"){let l=this.toEditorPos(s.rangeStart),c=this.toEditorPos(s.rangeEnd);if(l<c){let u=`text-decoration: underline ${a=="Dashed"?"dashed ":a=="Squiggle"?"wavy ":""}${o=="Thin"?1:2}px`;i.push(qt.mark({attributes:{style:u}}).range(l,c))}}}t.dispatch({effects:oOe.of(qt.set(i))})},this.handlers.compositionstart=()=>{t.inputState.composing<0&&(t.inputState.composing=0,t.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(t.inputState.composing=-1,t.inputState.compositionFirstChange=null,this.composing){let{drifted:r}=this.composing;this.composing=null,r&&this.reset(t.state)}};for(let r in this.handlers)n.addEventListener(r,this.handlers[r]);this.measureReq={read:r=>{this.editContext.updateControlBounds(r.contentDOM.getBoundingClientRect());let i=fx(r.root);i&&i.rangeCount&&this.editContext.updateSelectionBounds(i.getRangeAt(0).getBoundingClientRect())}}}applyEdits(t){let n=0,r=!1,i=this.pendingContextChange;return t.changes.iterChanges((s,a,o,l,c)=>{if(r)return;let u=c.length-(a-s);if(i&&a>=i.to)if(i.from==s&&i.to==a&&i.insert.eq(c)){i=this.pendingContextChange=null,n+=u,this.to+=u;return}else i=null,this.revertPending(t.state);if(s+=n,a+=n,a<=this.from)this.from+=u,this.to+=u;else if(s<this.to){if(s<this.from||a>this.to||this.to-this.from+c.length>3e4){r=!0;return}this.editContext.updateText(this.toContextPos(s),this.toContextPos(a),c.toString()),this.to+=u}n+=u}),i&&!r&&this.revertPending(t.state),!r}update(t){let n=this.pendingContextChange,r=t.startState.selection.main;this.composing&&(this.composing.drifted||!t.changes.touchesRange(r.from,r.to)&&t.transactions.some(i=>!i.isUserEvent("input.type")&&i.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=t.changes.mapPos(this.composing.editorBase)):!this.applyEdits(t)||!this.rangeIsValid(t.state)?(this.pendingContextChange=null,this.reset(t.state)):(t.docChanged||t.selectionSet||n)&&this.setSelection(t.state),(t.geometryChanged||t.docChanged||t.selectionSet)&&t.view.requestMeasure(this.measureReq)}resetRange(t){let{head:n}=t.selection.main;this.from=Math.max(0,n-1e4),this.to=Math.min(t.doc.length,n+1e4)}reset(t){this.resetRange(t),this.editContext.updateText(0,this.editContext.text.length,t.doc.sliceString(this.from,this.to)),this.setSelection(t)}revertPending(t){let n=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(n.from),this.toContextPos(n.from+n.insert.length),t.doc.sliceString(n.from,n.to))}setSelection(t){let{main:n}=t.selection,r=this.toContextPos(Math.max(this.from,Math.min(this.to,n.anchor))),i=this.toContextPos(n.head);(this.editContext.selectionStart!=r||this.editContext.selectionEnd!=i)&&this.editContext.updateSelection(r,i)}rangeIsValid(t){let{head:n}=t.selection.main;return!(this.from>0&&n-this.from<500||this.to<t.doc.length&&this.to-n<500||this.to-this.from>1e4*3)}toEditorPos(t,n=this.to-this.from){t=Math.min(t,n);let r=this.composing;return r&&r.drifted?r.editorBase+(t-r.contextBase):t+this.from}toContextPos(t){let n=this.composing;return n&&n.drifted?n.contextBase+(t-n.editorBase):t-this.from}destroy(){for(let t in this.handlers)this.editContext.removeEventListener(t,this.handlers[t])}}class St{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(t={}){var n;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),t.parent&&t.parent.appendChild(this.dom);let{dispatch:r}=t;this.dispatchTransactions=t.dispatchTransactions||r&&(i=>i.forEach(s=>r(s,this)))||(i=>this.update(i)),this.dispatch=this.dispatch.bind(this),this._root=t.root||oHe(t.parent)||document,this.viewState=new dY(t.state||dr.create(t)),t.scrollTo&&t.scrollTo.is(ek)&&(this.viewState.scrollTarget=t.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet($0).map(i=>new $R(i));for(let i of this.plugins)i.update(this);this.observer=new kKe(this),this.inputState=new YHe(this),this.inputState.ensureHandlers(this.plugins),this.docView=new GV(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((n=document.fonts)===null||n===void 0)&&n.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...t){let n=t.length==1&&t[0]instanceof Ps?t:t.length==1&&Array.isArray(t[0])?t[0]:[this.state.update(...t)];this.dispatchTransactions(n,this)}update(t){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,i,s=this.state;for(let h of t){if(h.startState!=s)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");s=h.state}if(this.destroyed){this.viewState.state=s;return}let a=this.hasFocus,o=0,l=null;t.some(h=>h.annotation(wOe))?(this.inputState.notifiedFocused=a,o=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,l=yOe(s,a),l||(o=1));let c=this.observer.delayedAndroidKey,u=null;if(c?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(s.doc)||!this.state.selection.eq(s.selection))&&(u=null)):this.observer.clear(),s.facet(dr.phrases)!=this.state.facet(dr.phrases))return this.setState(s);i=qP.create(this,s,t),i.flags|=o;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let h of t){if(d&&(d=d.map(h.changes)),h.scrollIntoView){let{main:f}=h.state.selection;d=new G0(f.empty?f:Ve.cursor(f.head,f.head>f.anchor?-1:1))}for(let f of h.effects)f.is(ek)&&(d=f.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=WP.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(rw)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(h=>h.isUserEvent("select.pointer")))}finally{this.updateState=0}if(i.startState.facet(ak)!=i.state.facet(ak)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let h of this.state.facet(YD))try{h(i)}catch(f){Lo(this.state,f,"update listener")}(l||u)&&Promise.resolve().then(()=>{l&&this.state==l.startState&&this.dispatch(l),u&&!OOe(this,u)&&c.force&&j0(this.contentDOM,c.key,c.keyCode)})}setState(t){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=t;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new dY(t),this.plugins=t.facet($0).map(r=>new $R(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView.destroy(),this.docView=new GV(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(t){let n=t.startState.facet($0),r=t.state.facet($0);if(n!=r){let i=[];for(let s of r){let a=n.indexOf(s);if(a<0)i.push(new $R(s));else{let o=this.plugins[a];o.mustUpdate=t,i.push(o)}}for(let s of this.plugins)s.mustUpdate!=t&&s.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let i of this.plugins)i.mustUpdate=t;for(let i=0;i<this.plugins.length;i++)this.plugins[i].update(this);n!=r&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let t of this.plugins){let n=t.value;if(n&&n.docViewUpdate)try{n.docViewUpdate(this)}catch(r){Lo(this.state,r,"doc view update listener")}}}measure(t=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,t&&this.observer.forceFlush();let n=null,r=this.scrollDOM,i=r.scrollTop*this.scaleY,{scrollAnchorPos:s,scrollAnchorHeight:a}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let o=0;;o++){if(a<0)if(Dfe(r))s=-1,a=this.viewState.heightMap.height;else{let f=this.viewState.scrollAnchorAt(i);s=f.from,a=f.top}this.updateState=1;let l=this.viewState.measure(this);if(!l&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(o>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let c=[];l&4||([this.measureRequests,c]=[c,this.measureRequests]);let u=c.map(f=>{try{return f.read(this)}catch(p){return Lo(this.state,p),pY}}),d=qP.create(this,this.state,[]),h=!1;d.flags|=l,n?n.flags|=l:n=d,this.updateState=2,d.empty||(this.updatePlugins(d),this.inputState.update(d),this.updateAttrs(),h=this.docView.update(d),h&&this.docViewUpdate());for(let f=0;f<c.length;f++)if(u[f]!=pY)try{let p=c[f];p.write&&p.write(u[f],this)}catch(p){Lo(this.state,p)}if(h&&this.docView.updateSelection(!0),!d.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}else{let p=(s<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(s).top)-a;if(p>1||p<-1){i=i+p,r.scrollTop=i/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let o of this.state.facet(YD))o(n)}get themeClasses(){return JD+" "+(this.state.facet(KD)?kOe:$Oe)+" "+this.state.facet(ak)}updateAttrs(){let t=gY(this,lOe,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(uh)?"true":"false",class:"cm-content",style:`${Yt.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),gY(this,t9,n);let r=this.observer.ignore(()=>{let i=UD(this.contentDOM,this.contentAttrs,n),s=UD(this.dom,this.editorAttrs,t);return i||s});return this.editorAttrs=t,this.contentAttrs=n,r}showAnnouncements(t){let n=!0;for(let r of t)for(let i of r.effects)if(i.is(St.announce)){n&&(this.announceDOM.textContent=""),n=!1;let s=this.announceDOM.appendChild(document.createElement("div"));s.textContent=i.value}}mountStyles(){this.styleModules=this.state.facet(rw);let t=this.state.facet(St.cspNonce);SO.mount(this.root,this.styleModules.concat(SKe).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(t){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),t){if(this.measureRequests.indexOf(t)>-1)return;if(t.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===t.key){this.measureRequests[n]=t;return}}this.measureRequests.push(t)}}plugin(t){let n=this.pluginMap.get(t);return(n===void 0||n&&n.plugin!=t)&&this.pluginMap.set(t,n=this.plugins.find(r=>r.plugin==t)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(t){return this.readMeasured(),this.viewState.elementAtHeight(t)}lineBlockAtHeight(t){return this.readMeasured(),this.viewState.lineBlockAtHeight(t)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(t){return this.viewState.lineBlockAt(t)}get contentHeight(){return this.viewState.contentHeight}moveByChar(t,n,r){return TR(this,t,HV(this,t,n,r))}moveByGroup(t,n){return TR(this,t,HV(this,t,n,r=>MHe(this,t.head,r)))}visualLineSide(t,n){let r=this.bidiSpans(t),i=this.textDirectionAt(t.from),s=r[n?r.length-1:0];return Ve.cursor(s.side(n,i)+t.from,s.forward(!n,i)?1:-1)}moveToLineBoundary(t,n,r=!0){return FHe(this,t,n,r)}moveVertically(t,n,r){return TR(this,t,zHe(this,t,n,r))}domAtPos(t){return this.docView.domAtPos(t)}posAtDOM(t,n=0){return this.docView.posFromDOM(t,n)}posAtCoords(t,n=!0){return this.readMeasured(),fOe(this,t,n)}coordsAtPos(t,n=1){this.readMeasured();let r=this.docView.coordsAt(t,n);if(!r||r.left==r.right)return r;let i=this.state.doc.lineAt(t),s=this.bidiSpans(i),a=s[Zf.find(s,t-i.from,-1,n)];return QS(r,a.dir==wi.LTR==n>0)}coordsForChar(t){return this.readMeasured(),this.docView.coordsForChar(t)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(t){return!this.state.facet(iOe)||t<this.viewport.from||t>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(t))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(t){if(t.length>_Ke)return Zfe(t.length);let n=this.textDirectionAt(t.from),r;for(let s of this.bidiCache)if(s.from==t.from&&s.dir==n&&(s.fresh||Bfe(s.isolates,r=jV(this,t))))return s.order;r||(r=jV(this,t));let i=xHe(t.text,n,r);return this.bidiCache.push(new WP(t.from,t.to,n,r,!0,i)),i}get hasFocus(){var t;return(this.dom.ownerDocument.hasFocus()||Yt.safari&&((t=this.inputState)===null||t===void 0?void 0:t.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{Afe(this.contentDOM),this.docView.updateSelection()})}setRoot(t){this._root!=t&&(this._root=t,this.observer.setWindow((t.nodeType==9?t:t.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let t of this.plugins)t.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(t,n={}){return ek.of(new G0(typeof t=="number"?Ve.cursor(t):t,n.y,n.x,n.yMargin,n.xMargin))}scrollSnapshot(){let{scrollTop:t,scrollLeft:n}=this.scrollDOM,r=this.viewState.scrollAnchorAt(t);return ek.of(new G0(Ve.cursor(r.from),"start","start",r.top-t,n,!0))}setTabFocusMode(t){t==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof t=="boolean"?this.inputState.tabFocusMode=t?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+t)}static domEventHandlers(t){return Ui.define(()=>({}),{eventHandlers:t})}static domEventObservers(t){return Ui.define(()=>({}),{eventObservers:t})}static theme(t,n){let r=SO.newName(),i=[ak.of(r),rw.of(eI(`.${r}`,t))];return n&&n.dark&&i.push(KD.of(!0)),i}static baseTheme(t){return Kh.lowest(rw.of(eI("."+JD,t,TOe)))}static findFromDOM(t){var n;let r=t.querySelector(".cm-content"),i=r&&si.get(r)||si.get(t);return((n=i?.rootView)===null||n===void 0?void 0:n.view)||null}}St.styleModule=rw;St.inputHandler=nOe;St.clipboardInputFilter=J7;St.clipboardOutputFilter=e9;St.scrollHandler=aOe;St.focusChangeEffect=rOe;St.perLineTextDirection=iOe;St.exceptionSink=tOe;St.updateListener=YD;St.editable=uh;St.mouseSelectionStyle=eOe;St.dragMovesSelection=Jfe;St.clickAddsSelectionRange=Kfe;St.decorations=Ox;St.outerDecorations=cOe;St.atomicRanges=n9;St.bidiIsolatedRanges=uOe;St.scrollMargins=dOe;St.darkTheme=KD;St.cspNonce=Ut.define({combine:e=>e.length?e[0]:""});St.contentAttributes=t9;St.editorAttributes=lOe;St.lineWrapping=St.contentAttributes.of({class:"cm-lineWrapping"});St.announce=Xn.define();const _Ke=4096,pY={};class WP{constructor(t,n,r,i,s,a){this.from=t,this.to=n,this.dir=r,this.isolates=i,this.fresh=s,this.order=a}static update(t,n){if(n.empty&&!t.some(s=>s.fresh))return t;let r=[],i=t.length?t[t.length-1].dir:wi.LTR;for(let s=Math.max(0,t.length-10);s<t.length;s++){let a=t[s];a.dir==i&&!n.touchesRange(a.from,a.to)&&r.push(new WP(n.mapPos(a.from,1),n.mapPos(a.to,-1),a.dir,a.isolates,!1,a.order))}return r}}function gY(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let s=r[i],a=typeof s=="function"?s(e):s;a&&qD(a,n)}return n}const CKe=Yt.mac?"mac":Yt.windows?"win":Yt.linux?"linux":"key";function QKe(e,t){const n=e.split(/-(?!$)/);let r=n[n.length-1];r=="Space"&&(r=" ");let i,s,a,o;for(let l=0;l<n.length-1;++l){const c=n[l];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))i=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))a=!0;else if(/^mod$/i.test(c))t=="mac"?o=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return i&&(r="Alt-"+r),s&&(r="Ctrl-"+r),o&&(r="Meta-"+r),a&&(r="Shift-"+r),r}function ok(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n!==!1&&t.shiftKey&&(e="Shift-"+e),e}const EKe=Kh.default(St.domEventHandlers({keydown(e,t){return _Oe(POe(t.state),e,t,"editor")}})),im=Ut.define({enables:EKe}),mY=new WeakMap;function POe(e){let t=e.facet(im),n=mY.get(t);return n||mY.set(t,n=XKe(t.reduce((r,i)=>r.concat(i),[]))),n}function RKe(e,t,n){return _Oe(POe(e.state),t,e,n)}let zf=null;const AKe=4e3;function XKe(e,t=CKe){let n=Object.create(null),r=Object.create(null),i=(a,o)=>{let l=r[a];if(l==null)r[a]=o;else if(l!=o)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},s=(a,o,l,c,u)=>{var d,h;let f=n[a]||(n[a]=Object.create(null)),p=o.split(/ (?!$)/).map(v=>QKe(v,t));for(let v=1;v<p.length;v++){let b=p.slice(0,v).join(" ");i(b,!0),f[b]||(f[b]={preventDefault:!0,stopPropagation:!1,run:[y=>{let T=zf={view:y,prefix:b,scope:a};return setTimeout(()=>{zf==T&&(zf=null)},AKe),!0}]})}let g=p.join(" ");i(g,!1);let m=f[g]||(f[g]={preventDefault:!1,stopPropagation:!1,run:((h=(d=f._any)===null||d===void 0?void 0:d.run)===null||h===void 0?void 0:h.slice())||[]});l&&m.run.push(l),c&&(m.preventDefault=!0),u&&(m.stopPropagation=!0)};for(let a of e){let o=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let c of o){let u=n[c]||(n[c]=Object.create(null));u._any||(u._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:d}=a;for(let h in u)u[h].run.push(f=>d(f,tI))}let l=a[t]||a.key;if(l)for(let c of o)s(c,l,a.run,a.preventDefault,a.stopPropagation),a.shift&&s(c,"Shift-"+l,a.shift,a.preventDefault,a.stopPropagation)}return n}let tI=null;function _Oe(e,t,n,r){tI=t;let i=nHe(t),s=Xo(i,0),a=ju(s)==i.length&&i!=" ",o="",l=!1,c=!1,u=!1;zf&&zf.view==n&&zf.scope==r&&(o=zf.prefix+" ",gOe.indexOf(t.keyCode)<0&&(c=!0,zf=null));let d=new Set,h=m=>{if(m){for(let v of m.run)if(!d.has(v)&&(d.add(v),v(n)))return m.stopPropagation&&(u=!0),!0;m.preventDefault&&(m.stopPropagation&&(u=!0),c=!0)}return!1},f=e[r],p,g;return f&&(h(f[o+ok(i,t,!a)])?l=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Yt.windows&&t.ctrlKey&&t.altKey)&&(p=$O[t.keyCode])&&p!=i?(h(f[o+ok(p,t,!0)])||t.shiftKey&&(g=hx[t.keyCode])!=i&&g!=p&&h(f[o+ok(g,t,!1)]))&&(l=!0):a&&t.shiftKey&&h(f[o+ok(i,t,!0)])&&(l=!0),!l&&h(f._any)&&(l=!0)),c&&(l=!0),l&&u&&t.stopPropagation(),tI=null,l}class AS{constructor(t,n,r,i,s){this.className=t,this.left=n,this.top=r,this.width=i,this.height=s}draw(){let t=document.createElement("div");return t.className=this.className,this.adjust(t),t}update(t,n){return n.className!=this.className?!1:(this.adjust(t),!0)}adjust(t){t.style.left=this.left+"px",t.style.top=this.top+"px",this.width!=null&&(t.style.width=this.width+"px"),t.style.height=this.height+"px"}eq(t){return this.left==t.left&&this.top==t.top&&this.width==t.width&&this.height==t.height&&this.className==t.className}static forRange(t,n,r){if(r.empty){let i=t.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let s=COe(t);return[new AS(n,i.left-s.left,i.top-s.top,null,i.bottom-i.top)]}else return DKe(t,n,r)}}function COe(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==wi.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function vY(e,t,n,r){let i=e.coordsAtPos(t,n*2);if(!i)return r;let s=e.dom.getBoundingClientRect(),a=(i.top+i.bottom)/2,o=e.posAtCoords({x:s.left+1,y:a}),l=e.posAtCoords({x:s.right-1,y:a});return o==null||l==null?r:{from:Math.max(r.from,Math.min(o,l)),to:Math.min(r.to,Math.max(o,l))}}function DKe(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),s=e.textDirection==wi.LTR,a=e.contentDOM,o=a.getBoundingClientRect(),l=COe(e),c=a.querySelector(".cm-line"),u=c&&window.getComputedStyle(c),d=o.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),h=o.right-(u?parseInt(u.paddingRight):0),f=ZD(e,r,1),p=ZD(e,i,-1),g=f.type==go.Text?f:null,m=p.type==go.Text?p:null;if(g&&(e.lineWrapping||f.widgetLineBreaks)&&(g=vY(e,r,1,g)),m&&(e.lineWrapping||p.widgetLineBreaks)&&(m=vY(e,i,-1,m)),g&&m&&g.from==m.from&&g.to==m.to)return b(y(n.from,n.to,g));{let x=g?y(n.from,null,g):T(f,!1),S=m?y(null,n.to,m):T(p,!0),k=[];return(g||f).to<(m||p).from-(g&&m?1:0)||f.widgetLineBreaks>1&&x.bottom+e.defaultLineHeight/2<S.top?k.push(v(d,x.bottom,h,S.top)):x.bottom<S.top&&e.elementAtHeight((x.bottom+S.top)/2).type==go.Text&&(x.bottom=S.top=(x.bottom+S.top)/2),b(x).concat(k).concat(b(S))}function v(x,S,k,Q){return new AS(t,x-l.left,S-l.top,k-x,Q-S)}function b({top:x,bottom:S,horizontal:k}){let Q=[];for(let C=0;C<k.length;C+=2)Q.push(v(k[C],x,k[C+1],S));return Q}function y(x,S,k){let Q=1e9,C=-1e9,_=[];function R(W,G,U,q,B){let j=e.coordsAtPos(W,W==k.to?-2:2),M=e.coordsAtPos(U,U==k.from?2:-2);!j||!M||(Q=Math.min(j.top,M.top,Q),C=Math.max(j.bottom,M.bottom,C),B==wi.LTR?_.push(s&&G?d:j.left,s&&q?h:M.right):_.push(!s&&q?d:M.left,!s&&G?h:j.right))}let A=x??k.from,I=S??k.to;for(let W of e.visibleRanges)if(W.to>A&&W.from<I)for(let G=Math.max(W.from,A),U=Math.min(W.to,I);;){let q=e.state.doc.lineAt(G);for(let B of e.bidiSpans(q)){let j=B.from+q.from,M=B.to+q.from;if(j>=U)break;M>G&&R(Math.max(j,G),x==null&&j<=A,Math.min(M,U),S==null&&M>=I,B.dir)}if(G=q.to+1,G>=U)break}return _.length==0&&R(A,x==null,I,S==null,e.textDirection),{top:Q,bottom:C,horizontal:_}}function T(x,S){let k=o.top+(S?x.top:x.bottom);return{top:k,bottom:k,horizontal:[]}}}function IKe(e,t){return e.constructor==t.constructor&&e.eq(t)}class NKe{constructor(t,n){this.view=t,this.layer=n,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=t.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(t.state),t.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,t)}update(t){t.startState.facet(a2)!=t.state.facet(a2)&&this.setOrder(t.state),(this.layer.update(t,this.dom)||t.geometryChanged)&&(this.scale(),t.view.requestMeasure(this.measureReq))}docViewUpdate(t){this.layer.updateOnDocViewUpdate!==!1&&t.requestMeasure(this.measureReq)}setOrder(t){let n=0,r=t.facet(a2);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:t,scaleY:n}=this.view;(t!=this.scaleX||n!=this.scaleY)&&(this.scaleX=t,this.scaleY=n,this.dom.style.transform=`scale(${1/t}, ${1/n})`)}draw(t){if(t.length!=this.drawn.length||t.some((n,r)=>!IKe(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let i of t)i.update&&n&&i.constructor&&this.drawn[r].constructor&&i.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(i.draw(),n);for(;n;){let i=n.nextSibling;n.remove(),n=i}this.drawn=t}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const a2=Ut.define();function QOe(e){return[Ui.define(t=>new NKe(t,e)),a2.of(e)]}const px=Ut.define({combine(e){return Cd(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(t,n)=>Math.min(t,n),drawRangeCursor:(t,n)=>t||n})}});function FKe(e={}){return[px.of(e),MKe,zKe,LKe,sOe.of(!0)]}function EOe(e){return e.startState.facet(px)!=e.state.facet(px)}const MKe=QOe({above:!0,markers(e){let{state:t}=e,n=t.facet(px),r=[];for(let i of t.selection.ranges){let s=i==t.selection.main;if(i.empty||n.drawRangeCursor){let a=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",o=i.empty?i:Ve.cursor(i.head,i.head>i.anchor?-1:1);for(let l of AS.forRange(e,a,o))r.push(l)}}return r},update(e,t){e.transactions.some(r=>r.selection)&&(t.style.animationName=t.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=EOe(e);return n&&bY(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){bY(t.state,e)},class:"cm-cursorLayer"});function bY(e,t){t.style.animationDuration=e.facet(px).cursorBlinkRate+"ms"}const zKe=QOe({above:!1,markers(e){return e.state.selection.ranges.map(t=>t.empty?[]:AS.forRange(e,"cm-selectionBackground",t)).reduce((t,n)=>t.concat(n))},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||EOe(e)},class:"cm-selectionLayer"}),LKe=Kh.highest(St.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),ROe=Xn.define({map(e,t){return e==null?null:t.mapPos(e)}}),aw=na.define({create(){return null},update(e,t){return e!=null&&(e=t.changes.mapPos(e)),t.effects.reduce((n,r)=>r.is(ROe)?r.value:n,e)}}),qKe=Ui.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(aw);n==null?this.cursor!=null&&((t=this.cursor)===null||t===void 0||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(aw)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(aw),n=t!=null&&e.coordsAtPos(t);if(!n)return null;let r=e.scrollDOM.getBoundingClientRect();return{left:n.left-r.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-r.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(aw)!=e&&this.view.dispatch({effects:ROe.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){(e.target==this.view.contentDOM||!this.view.contentDOM.contains(e.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function UKe(){return[aw,qKe]}function wY(e,t,n,r,i){t.lastIndex=0;for(let s=e.iterRange(n,r),a=n,o;!s.next().done;a+=s.value.length)if(!s.lineBreak)for(;o=t.exec(s.value);)i(a+o.index,o)}function WKe(e,t){let n=e.visibleRanges;if(n.length==1&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let r=[];for(let{from:i,to:s}of n)i=Math.max(e.state.doc.lineAt(i).from,i-t),s=Math.min(e.state.doc.lineAt(s).to,s+t),r.length&&r[r.length-1].to>=i?r[r.length-1].to=s:r.push({from:i,to:s});return r}class jKe{constructor(t){const{regexp:n,decoration:r,decorate:i,boundary:s,maxLength:a=1e3}=t;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,i)this.addMatch=(o,l,c,u)=>i(u,c,c+o[0].length,o,l);else if(typeof r=="function")this.addMatch=(o,l,c,u)=>{let d=r(o,l,c);d&&u(c,c+o[0].length,d)};else if(r)this.addMatch=(o,l,c,u)=>u(c,c+o[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=s,this.maxLength=a}createDeco(t){let n=new Fh,r=n.add.bind(n);for(let{from:i,to:s}of WKe(t,this.maxLength))wY(t.state.doc,this.regexp,i,s,(a,o)=>this.addMatch(o,t,a,r));return n.finish()}updateDeco(t,n){let r=1e9,i=-1;return t.docChanged&&t.changes.iterChanges((s,a,o,l)=>{l>=t.view.viewport.from&&o<=t.view.viewport.to&&(r=Math.min(o,r),i=Math.max(l,i))}),t.viewportMoved||i-r>1e3?this.createDeco(t.view):i>-1?this.updateRange(t.view,n.map(t.changes),r,i):n}updateRange(t,n,r,i){for(let s of t.visibleRanges){let a=Math.max(s.from,r),o=Math.min(s.to,i);if(o>=a){let l=t.state.doc.lineAt(a),c=l.to<o?t.state.doc.lineAt(o):l,u=Math.max(s.from,l.from),d=Math.min(s.to,c.to);if(this.boundary){for(;a>l.from;a--)if(this.boundary.test(l.text[a-1-l.from])){u=a;break}for(;o<c.to;o++)if(this.boundary.test(c.text[o-c.from])){d=o;break}}let h=[],f,p=(g,m,v)=>h.push(v.range(g,m));if(l==c)for(this.regexp.lastIndex=u-l.from;(f=this.regexp.exec(l.text))&&f.index<d-l.from;)this.addMatch(f,t,f.index+l.from,p);else wY(t.state.doc,this.regexp,u,d,(g,m)=>this.addMatch(m,t,g,p));n=n.update({filterFrom:u,filterTo:d,filter:(g,m)=>g<u||m>d,add:h})}}return n}}const nI=/x/.unicode!=null?"gu":"g",GKe=new RegExp(`[\0-\b
|
|
1085
1085
|
--\u2028\u2029\uFEFF-]`,nI),VKe={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let CR=null;function YKe(){var e;if(CR==null&&typeof document<"u"&&document.body){let t=document.body.style;CR=((e=t.tabSize)!==null&&e!==void 0?e:t.MozTabSize)!=null}return CR||!1}const o2=Ut.define({combine(e){let t=Cd(e,{render:null,specialChars:GKe,addSpecialChars:null});return(t.replaceTabs=!YKe())&&(t.specialChars=new RegExp(" |"+t.specialChars.source,nI)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,nI)),t}});function BKe(e={}){return[o2.of(e),ZKe()]}let yY=null;function ZKe(){return yY||(yY=Ui.fromClass(class{constructor(e){this.view=e,this.decorations=qt.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(o2)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new jKe({regexp:e.specialChars,decoration:(t,n,r)=>{let{doc:i}=n.state,s=Xo(t[0],0);if(s==9){let a=i.lineAt(r),o=n.state.tabSize,l=su(a.text,o,r-a.from);return qt.replace({widget:new eJe((o-l%o)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=qt.replace({widget:new JKe(e,s)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(o2);e.startState.facet(o2)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))}const HKe="•";function KKe(e){return e>=32?HKe:e==10?"":String.fromCharCode(9216+e)}class JKe extends hu{constructor(t,n){super(),this.options=t,this.code=n}eq(t){return t.code==this.code}toDOM(t){let n=KKe(this.code),r=t.state.phrase("Control character")+" "+(VKe[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,r,n);if(i)return i;let s=document.createElement("span");return s.textContent=n,s.title=r,s.setAttribute("aria-label",r),s.className="cm-specialChar",s}ignoreEvent(){return!1}}class eJe extends hu{constructor(t){super(),this.width=t}eq(t){return t.width==this.width}toDOM(){let t=document.createElement("span");return t.textContent=" ",t.className="cm-tab",t.style.width=this.width+"px",t}ignoreEvent(){return!1}}function tJe(){return rJe}const nJe=qt.line({class:"cm-activeLine"}),rJe=Ui.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let r of e.state.selection.ranges){let i=e.lineBlockAt(r.head);i.from>t&&(n.push(nJe.range(i.from)),t=i.from)}return qt.set(n)}},{decorations:e=>e.decorations});class iJe extends hu{constructor(t){super(),this.content=t}toDOM(t){let n=document.createElement("span");return n.className="cm-placeholder",n.style.pointerEvents="none",n.appendChild(typeof this.content=="string"?document.createTextNode(this.content):typeof this.content=="function"?this.content(t):this.content.cloneNode(!0)),n.setAttribute("aria-hidden","true"),n}coordsAt(t){let n=t.firstChild?Av(t.firstChild):[];if(!n.length)return null;let r=window.getComputedStyle(t.parentNode),i=QS(n[0],r.direction!="rtl"),s=parseInt(r.lineHeight);return i.bottom-i.top>s*1.5?{left:i.left,right:i.right,top:i.top,bottom:i.top+s}:i}ignoreEvent(){return!1}}function sJe(e){let t=Ui.fromClass(class{constructor(n){this.view=n,this.placeholder=e?qt.set([qt.widget({widget:new iJe(e),side:1}).range(0)]):qt.none}get decorations(){return this.view.state.doc.length?qt.none:this.placeholder}},{decorations:n=>n.decorations});return typeof e=="string"?[t,St.contentAttributes.of({"aria-placeholder":e})]:t}const rI=2e3;function aJe(e,t,n){let r=Math.min(t.line,n.line),i=Math.max(t.line,n.line),s=[];if(t.off>rI||n.off>rI||t.col<0||n.col<0){let a=Math.min(t.off,n.off),o=Math.max(t.off,n.off);for(let l=r;l<=i;l++){let c=e.doc.line(l);c.length<=o&&s.push(Ve.range(c.from+a,c.to+o))}}else{let a=Math.min(t.col,n.col),o=Math.max(t.col,n.col);for(let l=r;l<=i;l++){let c=e.doc.line(l),u=DD(c.text,a,e.tabSize,!0);if(u<0)s.push(Ve.cursor(c.to));else{let d=DD(c.text,o,e.tabSize);s.push(Ve.range(c.from+u,c.from+d))}}}return s}function oJe(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}function xY(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),r=e.state.doc.lineAt(n),i=n-r.from,s=i>rI?-1:i==r.length?oJe(e,t.clientX):su(r.text,e.state.tabSize,n-r.from);return{line:r.number,col:s,off:i}}function lJe(e,t){let n=xY(e,t),r=e.state.selection;return n?{update(i){if(i.docChanged){let s=i.changes.mapPos(i.startState.doc.line(n.line).from),a=i.state.doc.lineAt(s);n={line:a.number,col:n.col,off:Math.min(n.off,a.length)},r=r.map(i.changes)}},get(i,s,a){let o=xY(e,i);if(!o)return r;let l=aJe(e.state,n,o);return l.length?a?Ve.create(l.concat(r.ranges)):Ve.create(l):r}}:null}function cJe(e){let t=n=>n.altKey&&n.button==0;return St.mouseSelectionStyle.of((n,r)=>t(r)?lJe(n,r):null)}const uJe={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},dJe={style:"cursor: crosshair"};function hJe(e={}){let[t,n]=uJe[e.key||"Alt"],r=Ui.fromClass(class{constructor(i){this.view=i,this.isDown=!1}set(i){this.isDown!=i&&(this.isDown=i,this.view.update([]))}},{eventObservers:{keydown(i){this.set(i.keyCode==t||n(i))},keyup(i){(i.keyCode==t||!n(i))&&this.set(!1)},mousemove(i){this.set(n(i))}}});return[r,St.contentAttributes.of(i=>{var s;return!((s=i.plugin(r))===null||s===void 0)&&s.isDown?dJe:null})]}const hb="-10000px";class AOe{constructor(t,n,r,i){this.facet=n,this.createTooltipView=r,this.removeTooltipView=i,this.input=t.state.facet(n),this.tooltips=this.input.filter(a=>a);let s=null;this.tooltipViews=this.tooltips.map(a=>s=r(a,s))}update(t,n){var r;let i=t.state.facet(this.facet),s=i.filter(l=>l);if(i===this.input){for(let l of this.tooltipViews)l.update&&l.update(t);return!1}let a=[],o=n?[]:null;for(let l=0;l<s.length;l++){let c=s[l],u=-1;if(c){for(let d=0;d<this.tooltips.length;d++){let h=this.tooltips[d];h&&h.create==c.create&&(u=d)}if(u<0)a[l]=this.createTooltipView(c,l?a[l-1]:null),o&&(o[l]=!!c.above);else{let d=a[l]=this.tooltipViews[u];o&&(o[l]=n[u]),d.update&&d.update(t)}}}for(let l of this.tooltipViews)a.indexOf(l)<0&&(this.removeTooltipView(l),(r=l.destroy)===null||r===void 0||r.call(l));return n&&(o.forEach((l,c)=>n[c]=l),n.length=o.length),this.input=i,this.tooltips=s,this.tooltipViews=a,!0}}function fJe(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}const QR=Ut.define({combine:e=>{var t,n,r;return{position:Yt.ios?"absolute":((t=e.find(i=>i.position))===null||t===void 0?void 0:t.position)||"fixed",parent:((n=e.find(i=>i.parent))===null||n===void 0?void 0:n.parent)||null,tooltipSpace:((r=e.find(i=>i.tooltipSpace))===null||r===void 0?void 0:r.tooltipSpace)||fJe}}}),SY=new WeakMap,o9=Ui.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(QR);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new AOe(e,l9,(n,r)=>this.createTooltip(n,r),n=>{this.resizeObserver&&this.resizeObserver.unobserve(n.dom),n.dom.remove()}),this.above=this.manager.tooltips.map(n=>!!n.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(n=>{Date.now()>this.lastTransaction-50&&n.length>0&&n[n.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(QR);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let i of this.manager.tooltipViews)i.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let i of this.manager.tooltipViews)this.container.appendChild(i.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add("cm-tooltip"),e.arrow&&!n.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let i=document.createElement("div");i.className="cm-tooltip-arrow",n.dom.appendChild(i)}return n.dom.style.position=this.position,n.dom.style.top=hb,n.dom.style.left="0px",this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener("resize",this.measureSoon);for(let r of this.manager.tooltipViews)r.dom.remove(),(e=r.destroy)===null||e===void 0||e.call(r);this.parent&&this.container.remove(),(t=this.resizeObserver)===null||t===void 0||t.disconnect(),(n=this.intersectionObserver)===null||n===void 0||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:s}=this.manager.tooltipViews[0];if(Yt.gecko)n=s.offsetParent!=this.container.ownerDocument.body;else if(s.style.top==hb&&s.style.left=="0px"){let a=s.getBoundingClientRect();n=Math.abs(a.top+1e4)>1||Math.abs(a.left)>1}}if(n||this.position=="absolute")if(this.parent){let s=this.parent.getBoundingClientRect();s.width&&s.height&&(e=s.width/this.parent.offsetWidth,t=s.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState);let r=this.view.scrollDOM.getBoundingClientRect(),i=r9(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((s,a)=>{let o=this.manager.tooltipViews[a];return o.getCoords?o.getCoords(s.pos):this.view.coordsAtPos(s.pos)}),size:this.manager.tooltipViews.map(({dom:s})=>s.getBoundingClientRect()),space:this.view.state.facet(QR).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let o of this.manager.tooltipViews)o.dom.style.position="absolute"}let{visible:n,space:r,scaleX:i,scaleY:s}=e,a=[];for(let o=0;o<this.manager.tooltips.length;o++){let l=this.manager.tooltips[o],c=this.manager.tooltipViews[o],{dom:u}=c,d=e.pos[o],h=e.size[o];if(!d||l.clip!==!1&&(d.bottom<=Math.max(n.top,r.top)||d.top>=Math.min(n.bottom,r.bottom)||d.right<Math.max(n.left,r.left)-.1||d.left>Math.min(n.right,r.right)+.1)){u.style.top=hb;continue}let f=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,p=f?7:0,g=h.right-h.left,m=(t=SY.get(c))!==null&&t!==void 0?t:h.bottom-h.top,v=c.offset||pJe,b=this.view.textDirection==wi.LTR,y=h.width>r.right-r.left?b?r.left:r.right-h.width:b?Math.max(r.left,Math.min(d.left-(f?14:0)+v.x,r.right-g)):Math.min(Math.max(r.left,d.left-g+(f?14:0)-v.x),r.right-g),T=this.above[o];!l.strictSide&&(T?d.top-m-p-v.y<r.top:d.bottom+m+p+v.y>r.bottom)&&T==r.bottom-d.bottom>d.top-r.top&&(T=this.above[o]=!T);let x=(T?d.top-r.top:r.bottom-d.bottom)-p;if(x<m&&c.resize!==!1){if(x<this.view.defaultLineHeight){u.style.top=hb;continue}SY.set(c,m),u.style.height=(m=x)/s+"px"}else u.style.height&&(u.style.height="");let S=T?d.top-m-p-v.y:d.bottom+p+v.y,k=y+g;if(c.overlap!==!0)for(let Q of a)Q.left<k&&Q.right>y&&Q.top<S+m&&Q.bottom>S&&(S=T?Q.top-m-2-p:Q.bottom+p+2);if(this.position=="absolute"?(u.style.top=(S-e.parent.top)/s+"px",$Y(u,(y-e.parent.left)/i)):(u.style.top=S/s+"px",$Y(u,y/i)),f){let Q=d.left+(b?v.x:-v.x)-(y+14-7);f.style.left=Q/i+"px"}c.overlap!==!0&&a.push({left:y,top:S,right:k,bottom:S+m}),u.classList.toggle("cm-tooltip-above",T),u.classList.toggle("cm-tooltip-below",!T),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=hb}},{eventObservers:{scroll(){this.maybeMeasure()}}});function $Y(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+"px")}const OJe=St.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),pJe={x:0,y:0},l9=Ut.define({enables:[o9,OJe]}),jP=Ut.define({combine:e=>e.reduce((t,n)=>t.concat(n),[])});class SQ{static create(t){return new SQ(t)}constructor(t){this.view=t,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new AOe(t,jP,(n,r)=>this.createHostedView(n,r),n=>n.dom.remove())}createHostedView(t,n){let r=t.create(this.view);return r.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(r.dom,n?n.dom.nextSibling:this.dom.firstChild),this.mounted&&r.mount&&r.mount(this.view),r}mount(t){for(let n of this.manager.tooltipViews)n.mount&&n.mount(t);this.mounted=!0}positioned(t){for(let n of this.manager.tooltipViews)n.positioned&&n.positioned(t)}update(t){this.manager.update(t)}destroy(){var t;for(let n of this.manager.tooltipViews)(t=n.destroy)===null||t===void 0||t.call(n)}passProp(t){let n;for(let r of this.manager.tooltipViews){let i=r[t];if(i!==void 0){if(n===void 0)n=i;else if(n!==i)return}}return n}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const gJe=l9.compute([jP],e=>{let t=e.facet(jP);return t.length===0?null:{pos:Math.min(...t.map(n=>n.pos)),end:Math.max(...t.map(n=>{var r;return(r=n.end)!==null&&r!==void 0?r:n.pos})),create:SQ.create,above:t[0].above,arrow:t.some(n=>n.arrow)}});class mJe{constructor(t,n,r,i,s){this.view=t,this.source=n,this.field=r,this.setHover=i,this.hoverTime=s,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:t.dom,time:0},this.checkHover=this.checkHover.bind(this),t.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),t.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let t=Date.now()-this.lastMove.time;t<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-t):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:t,lastMove:n}=this,r=t.docView.nearest(n.target);if(!r)return;let i,s=1;if(r instanceof Bf)i=r.posAtStart;else{if(i=t.posAtCoords(n),i==null)return;let o=t.coordsAtPos(i);if(!o||n.y<o.top||n.y>o.bottom||n.x<o.left-t.defaultCharacterWidth||n.x>o.right+t.defaultCharacterWidth)return;let l=t.bidiSpans(t.state.doc.lineAt(i)).find(u=>u.from<=i&&u.to>=i),c=l&&l.dir==wi.RTL?-1:1;s=n.x<o.left?-c:c}let a=this.source(t,i,s);if(a?.then){let o=this.pending={pos:i};a.then(l=>{this.pending==o&&(this.pending=null,l&&!(Array.isArray(l)&&!l.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(l)?l:[l])}))},l=>Lo(t.state,l,"hover tooltip"))}else a&&!(Array.isArray(a)&&!a.length)&&t.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])})}get tooltip(){let t=this.view.plugin(o9),n=t?t.manager.tooltips.findIndex(r=>r.create==SQ.create):-1;return n>-1?t.manager.tooltipViews[n]:null}mousemove(t){var n,r;this.lastMove={x:t.clientX,y:t.clientY,target:t.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:i,tooltip:s}=this;if(i.length&&s&&!vJe(s.dom,t)||this.pending){let{pos:a}=i[0]||this.pending,o=(r=(n=i[0])===null||n===void 0?void 0:n.end)!==null&&r!==void 0?r:a;(a==o?this.view.posAtCoords(this.lastMove)!=a:!bJe(this.view,a,o,t.clientX,t.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(t){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:n}=this;if(n.length){let{tooltip:r}=this;r&&r.dom.contains(t.relatedTarget)?this.watchTooltipLeave(r.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(t){let n=r=>{t.removeEventListener("mouseleave",n),this.active.length&&!this.view.dom.contains(r.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};t.addEventListener("mouseleave",n)}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const lk=4;function vJe(e,t){let{left:n,right:r,top:i,bottom:s}=e.getBoundingClientRect(),a;if(a=e.querySelector(".cm-tooltip-arrow")){let o=a.getBoundingClientRect();i=Math.min(o.top,i),s=Math.max(o.bottom,s)}return t.clientX>=n-lk&&t.clientX<=r+lk&&t.clientY>=i-lk&&t.clientY<=s+lk}function bJe(e,t,n,r,i,s){let a=e.scrollDOM.getBoundingClientRect(),o=e.documentTop+e.documentPadding.top+e.contentHeight;if(a.left>r||a.right<r||a.top>i||Math.min(a.bottom,o)<i)return!1;let l=e.posAtCoords({x:r,y:i},!1);return l>=t&&l<=n}function wJe(e,t={}){let n=Xn.define(),r=na.define({create(){return[]},update(i,s){if(i.length&&(t.hideOnChange&&(s.docChanged||s.selection)?i=[]:t.hideOn&&(i=i.filter(a=>!t.hideOn(s,a))),s.docChanged)){let a=[];for(let o of i){let l=s.changes.mapPos(o.pos,-1,Oa.TrackDel);if(l!=null){let c=Object.assign(Object.create(null),o);c.pos=l,c.end!=null&&(c.end=s.changes.mapPos(c.end)),a.push(c)}}i=a}for(let a of s.effects)a.is(n)&&(i=a.value),a.is(yJe)&&(i=[]);return i},provide:i=>jP.from(i)});return{active:r,extension:[r,Ui.define(i=>new mJe(i,e,r,n,t.hoverTime||300)),gJe]}}function XOe(e,t){let n=e.plugin(o9);if(!n)return null;let r=n.manager.tooltips.indexOf(t);return r<0?null:n.manager.tooltipViews[r]}const yJe=Xn.define(),kY=Ut.define({combine(e){let t,n;for(let r of e)t=t||r.topContainer,n=n||r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function gx(e,t){let n=e.plugin(DOe),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}const DOe=Ui.fromClass(class{constructor(e){this.input=e.state.facet(mx),this.specs=this.input.filter(n=>n),this.panels=this.specs.map(n=>n(e));let t=e.state.facet(kY);this.top=new ck(e,!0,t.topContainer),this.bottom=new ck(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(n=>n.top)),this.bottom.sync(this.panels.filter(n=>!n.top));for(let n of this.panels)n.dom.classList.add("cm-panel"),n.mount&&n.mount()}update(e){let t=e.state.facet(kY);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new ck(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new ck(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(mx);if(n!=this.input){let r=n.filter(l=>l),i=[],s=[],a=[],o=[];for(let l of r){let c=this.specs.indexOf(l),u;c<0?(u=l(e.view),o.push(u)):(u=this.panels[c],u.update&&u.update(e)),i.push(u),(u.top?s:a).push(u)}this.specs=r,this.panels=i,this.top.sync(s),this.bottom.sync(a);for(let l of o)l.dom.classList.add("cm-panel"),l.mount&&l.mount()}else for(let r of this.panels)r.update&&r.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>St.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})});class ck{constructor(t,n,r){this.view=t,this.top=n,this.container=r,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(t){for(let n of this.panels)n.destroy&&t.indexOf(n)<0&&n.destroy();this.panels=t,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let n=this.container||this.view.dom;n.insertBefore(this.dom,this.top?n.firstChild:null)}let t=this.dom.firstChild;for(let n of this.panels)if(n.dom.parentNode==this.dom){for(;t!=n.dom;)t=TY(t);t=t.nextSibling}else this.dom.insertBefore(n.dom,t);for(;t;)t=TY(t)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let t of this.classes.split(" "))t&&this.container.classList.remove(t);for(let t of(this.classes=this.view.themeClasses).split(" "))t&&this.container.classList.add(t)}}}function TY(e){let t=e.nextSibling;return e.remove(),t}const mx=Ut.define({enables:DOe});class zh extends Sg{compare(t){return this==t||this.constructor==t.constructor&&this.eq(t)}eq(t){return!1}destroy(t){}}zh.prototype.elementClass="";zh.prototype.toDOM=void 0;zh.prototype.mapMode=Oa.TrackBefore;zh.prototype.startSide=zh.prototype.endSide=-1;zh.prototype.point=!0;const l2=Ut.define(),xJe=Ut.define(),SJe={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>wr.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},Nw=Ut.define();function $Je(e){return[IOe(),Nw.of({...SJe,...e})]}const PY=Ut.define({combine:e=>e.some(t=>t)});function IOe(e){return[kJe]}const kJe=Ui.fromClass(class{constructor(e){this.view=e,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(Nw).map(t=>new CY(e,t));for(let t of this.gutters)this.dom.appendChild(t.dom);this.fixed=!e.state.facet(PY),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,r=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(r<(n.to-n.from)*.8)}e.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px"),this.view.state.facet(PY)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&this.dom.remove();let n=wr.iter(this.view.state.facet(l2),this.view.viewport.from),r=[],i=this.gutters.map(s=>new TJe(s,this.view.viewport,-this.view.documentPadding.top));for(let s of this.view.viewportLineBlocks)if(r.length&&(r=[]),Array.isArray(s.type)){let a=!0;for(let o of s.type)if(o.type==go.Text&&a){iI(n,r,o.from);for(let l of i)l.line(this.view,o,r);a=!1}else if(o.widget)for(let l of i)l.widget(this.view,o)}else if(s.type==go.Text){iI(n,r,s.from);for(let a of i)a.line(this.view,s,r)}else if(s.widget)for(let a of i)a.widget(this.view,s);for(let s of i)s.finish();e&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(e){let t=e.startState.facet(Nw),n=e.state.facet(Nw),r=e.docChanged||e.heightChanged||e.viewportChanged||!wr.eq(e.startState.facet(l2),e.state.facet(l2),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let i of this.gutters)i.update(e)&&(r=!0);else{r=!0;let i=[];for(let s of n){let a=t.indexOf(s);a<0?i.push(new CY(this.view,s)):(this.gutters[a].update(e),i.push(this.gutters[a]))}for(let s of this.gutters)s.dom.remove(),i.indexOf(s)<0&&s.destroy();for(let s of i)this.dom.appendChild(s.dom);this.gutters=i}return r}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove()}},{provide:e=>St.scrollMargins.of(t=>{let n=t.plugin(e);return!n||n.gutters.length==0||!n.fixed?null:t.textDirection==wi.LTR?{left:n.dom.offsetWidth*t.scaleX}:{right:n.dom.offsetWidth*t.scaleX}})});function _Y(e){return Array.isArray(e)?e:[e]}function iI(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class TJe{constructor(t,n,r){this.gutter=t,this.height=r,this.i=0,this.cursor=wr.iter(t.markers,n.from)}addElement(t,n,r){let{gutter:i}=this,s=(n.top-this.height)/t.scaleY,a=n.height/t.scaleY;if(this.i==i.elements.length){let o=new NOe(t,a,s,r);i.elements.push(o),i.dom.appendChild(o.dom)}else i.elements[this.i].update(t,a,s,r);this.height=n.bottom,this.i++}line(t,n,r){let i=[];iI(this.cursor,i,n.from),r.length&&(i=i.concat(r));let s=this.gutter.config.lineMarker(t,n,i);s&&i.unshift(s);let a=this.gutter;i.length==0&&!a.config.renderEmptyElements||this.addElement(t,n,i)}widget(t,n){let r=this.gutter.config.widgetMarker(t,n.widget,n),i=r?[r]:null;for(let s of t.state.facet(xJe)){let a=s(t,n.widget,n);a&&(i||(i=[])).push(a)}i&&this.addElement(t,n,i)}finish(){let t=this.gutter;for(;t.elements.length>this.i;){let n=t.elements.pop();t.dom.removeChild(n.dom),n.destroy()}}}class CY{constructor(t,n){this.view=t,this.config=n,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let r in n.domEventHandlers)this.dom.addEventListener(r,i=>{let s=i.target,a;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let l=s.getBoundingClientRect();a=(l.top+l.bottom)/2}else a=i.clientY;let o=t.lineBlockAtHeight(a-t.documentTop);n.domEventHandlers[r](t,o,i)&&i.preventDefault()});this.markers=_Y(n.markers(t)),n.initialSpacer&&(this.spacer=new NOe(t,0,0,[n.initialSpacer(t)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(t){let n=this.markers;if(this.markers=_Y(this.config.markers(t.view)),this.spacer&&this.config.updateSpacer){let i=this.config.updateSpacer(this.spacer.markers[0],t);i!=this.spacer.markers[0]&&this.spacer.update(t.view,0,0,[i])}let r=t.view.viewport;return!wr.eq(this.markers,n,r.from,r.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(t):!1)}destroy(){for(let t of this.elements)t.destroy()}}class NOe{constructor(t,n,r,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(t,n,r,i)}update(t,n,r,i){this.height!=n&&(this.height=n,this.dom.style.height=n+"px"),this.above!=r&&(this.dom.style.marginTop=(this.above=r)?r+"px":""),PJe(this.markers,i)||this.setMarkers(t,i)}setMarkers(t,n){let r="cm-gutterElement",i=this.dom.firstChild;for(let s=0,a=0;;){let o=a,l=s<n.length?n[s++]:null,c=!1;if(l){let u=l.elementClass;u&&(r+=" "+u);for(let d=a;d<this.markers.length;d++)if(this.markers[d].compare(l)){o=d,c=!0;break}}else o=this.markers.length;for(;a<o;){let u=this.markers[a++];if(u.toDOM){u.destroy(i);let d=i.nextSibling;i.remove(),i=d}}if(!l)break;l.toDOM&&(c?i=i.nextSibling:this.dom.insertBefore(l.toDOM(t),i)),c&&a++}this.dom.className=r,this.markers=n}destroy(){this.setMarkers(null,[])}}function PJe(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].compare(t[n]))return!1;return!0}const _Je=Ut.define(),CJe=Ut.define(),k0=Ut.define({combine(e){return Cd(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(t,n){let r=Object.assign({},t);for(let i in n){let s=r[i],a=n[i];r[i]=s?(o,l,c)=>s(o,l,c)||a(o,l,c):a}return r}})}});class ER extends zh{constructor(t){super(),this.number=t}eq(t){return this.number==t.number}toDOM(){return document.createTextNode(this.number)}}function RR(e,t){return e.state.facet(k0).formatNumber(t,e.state)}const QJe=Nw.compute([k0],e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(t){return t.state.facet(_Je)},lineMarker(t,n,r){return r.some(i=>i.toDOM)?null:new ER(RR(t,t.state.doc.lineAt(n.from).number))},widgetMarker:(t,n,r)=>{for(let i of t.state.facet(CJe)){let s=i(t,n,r);if(s)return s}return null},lineMarkerChange:t=>t.startState.facet(k0)!=t.state.facet(k0),initialSpacer(t){return new ER(RR(t,QY(t.state.doc.lines)))},updateSpacer(t,n){let r=RR(n.view,QY(n.view.state.doc.lines));return r==t.number?t:new ER(r)},domEventHandlers:e.facet(k0).domEventHandlers}));function EJe(e={}){return[k0.of(e),IOe(),QJe]}function QY(e){let t=9;for(;t<e;)t=t*10+9;return t}const RJe=new class extends zh{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},AJe=l2.compute(["selection"],e=>{let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.head).from;i>n&&(n=i,t.push(RJe.range(i)))}return wr.of(t)});function XJe(){return AJe}let DJe=0;class Nt{constructor(t,n,r,i){this.name=t,this.set=n,this.base=r,this.modified=i,this.id=DJe++}toString(){let{name:t}=this;for(let n of this.modified)n.name&&(t=`${n.name}(${t})`);return t}static define(t,n){let r=typeof t=="string"?t:"?";if(t instanceof Nt&&(n=t),n?.base)throw new Error("Can not derive from a modified tag");let i=new Nt(r,[],null,[]);if(i.set.push(i),n)for(let s of n.set)i.set.push(s);return i}static defineModifier(t){let n=new GP(t);return r=>r.modified.indexOf(n)>-1?r:GP.get(r.base||r,r.modified.concat(n).sort((i,s)=>i.id-s.id))}}let IJe=0;class GP{constructor(t){this.name=t,this.instances=[],this.id=IJe++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(o=>o.base==t&&NJe(n,o.modified));if(r)return r;let i=[],s=new Nt(t.name,i,t,n);for(let o of n)o.instances.push(s);let a=FJe(n);for(let o of t.set)if(!o.modified.length)for(let l of a)i.push(GP.get(o,l));return s}}function NJe(e,t){return e.length==t.length&&e.every((n,r)=>n==t[r])}function FJe(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((n,r)=>r.length-n.length)}function Qr(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let i of n.split(" "))if(i){let s=[],a=2,o=i;for(let d=0;;){if(o=="..."&&d>0&&d+3==i.length){a=1;break}let h=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(o);if(!h)throw new RangeError("Invalid path: "+i);if(s.push(h[0]=="*"?"":h[0][0]=='"'?JSON.parse(h[0]):h[0]),d+=h[0].length,d==i.length)break;let f=i[d++];if(d==i.length&&f=="!"){a=0;break}if(f!="/")throw new RangeError("Invalid path: "+i);o=i.slice(d)}let l=s.length-1,c=s[l];if(!c)throw new RangeError("Invalid path: "+i);let u=new VP(r,a,l>0?s.slice(0,l):null);t[c]=u.sort(t[c])}}return FOe.add(t)}const FOe=new En;let VP=class{constructor(t,n,r,i){this.tags=t,this.mode=n,this.context=r,this.next=i}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(t){return!t||t.depth<this.depth?(this.next=t,this):(t.next=this.sort(t.next),t)}get depth(){return this.context?this.context.length:0}};VP.empty=new VP([],2,null);function MOe(e,t){let n=Object.create(null);for(let s of e)if(!Array.isArray(s.tag))n[s.tag.id]=s.class;else for(let a of s.tag)n[a.id]=s.class;let{scope:r,all:i=null}=t||{};return{style:s=>{let a=i;for(let o of s)for(let l of o.set){let c=n[l.id];if(c){a=a?a+" "+c:c;break}}return a},scope:r}}function MJe(e,t){let n=null;for(let r of e){let i=r.style(t);i&&(n=n?n+" "+i:i)}return n}function zJe(e,t,n,r=0,i=e.length){let s=new LJe(r,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),r,i,"",s.highlighters),s.flush(i)}class LJe{constructor(t,n,r){this.at=t,this.highlighters=n,this.span=r,this.class=""}startSpan(t,n){n!=this.class&&(this.flush(t),t>this.at&&(this.at=t),this.class=n)}flush(t){t>this.at&&this.class&&this.span(this.at,t,this.class)}highlightRange(t,n,r,i,s){let{type:a,from:o,to:l}=t;if(o>=r||l<=n)return;a.isTop&&(s=this.highlighters.filter(f=>!f.scope||f.scope(a)));let c=i,u=qJe(t)||VP.empty,d=MJe(s,u.tags);if(d&&(c&&(c+=" "),c+=d,u.mode==1&&(i+=(i?" ":"")+d)),this.startSpan(Math.max(n,o),c),u.opaque)return;let h=t.tree&&t.tree.prop(En.mounted);if(h&&h.overlay){let f=t.node.enter(h.overlay[0].from+o,1),p=this.highlighters.filter(m=>!m.scope||m.scope(h.tree.type)),g=t.firstChild();for(let m=0,v=o;;m++){let b=m<h.overlay.length?h.overlay[m]:null,y=b?b.from+o:l,T=Math.max(n,v),x=Math.min(r,y);if(T<x&&g)for(;t.from<x&&(this.highlightRange(t,T,x,i,s),this.startSpan(Math.min(x,t.to),c),!(t.to>=y||!t.nextSibling())););if(!b||y>r)break;v=b.to+o,v>n&&(this.highlightRange(f.cursor(),Math.max(n,b.from+o),Math.min(r,v),"",p),this.startSpan(Math.min(r,v),c))}g&&t.parent()}else if(t.firstChild()){h&&(i="");do if(!(t.to<=n)){if(t.from>=r)break;this.highlightRange(t,n,r,i,s),this.startSpan(Math.min(r,t.to),c)}while(t.nextSibling());t.parent()}}}function qJe(e){let t=e.type.prop(FOe);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}const Et=Nt.define,uk=Et(),Xf=Et(),EY=Et(Xf),RY=Et(Xf),Df=Et(),dk=Et(Df),AR=Et(Df),Xu=Et(),fp=Et(Xu),Tu=Et(),Pu=Et(),sI=Et(),fb=Et(sI),hk=Et(),P={comment:uk,lineComment:Et(uk),blockComment:Et(uk),docComment:Et(uk),name:Xf,variableName:Et(Xf),typeName:EY,tagName:Et(EY),propertyName:RY,attributeName:Et(RY),className:Et(Xf),labelName:Et(Xf),namespace:Et(Xf),macroName:Et(Xf),literal:Df,string:dk,docString:Et(dk),character:Et(dk),attributeValue:Et(dk),number:AR,integer:Et(AR),float:Et(AR),bool:Et(Df),regexp:Et(Df),escape:Et(Df),color:Et(Df),url:Et(Df),keyword:Tu,self:Et(Tu),null:Et(Tu),atom:Et(Tu),unit:Et(Tu),modifier:Et(Tu),operatorKeyword:Et(Tu),controlKeyword:Et(Tu),definitionKeyword:Et(Tu),moduleKeyword:Et(Tu),operator:Pu,derefOperator:Et(Pu),arithmeticOperator:Et(Pu),logicOperator:Et(Pu),bitwiseOperator:Et(Pu),compareOperator:Et(Pu),updateOperator:Et(Pu),definitionOperator:Et(Pu),typeOperator:Et(Pu),controlOperator:Et(Pu),punctuation:sI,separator:Et(sI),bracket:fb,angleBracket:Et(fb),squareBracket:Et(fb),paren:Et(fb),brace:Et(fb),content:Xu,heading:fp,heading1:Et(fp),heading2:Et(fp),heading3:Et(fp),heading4:Et(fp),heading5:Et(fp),heading6:Et(fp),contentSeparator:Et(Xu),list:Et(Xu),quote:Et(Xu),emphasis:Et(Xu),strong:Et(Xu),link:Et(Xu),monospace:Et(Xu),strikethrough:Et(Xu),inserted:Et(),deleted:Et(),changed:Et(),invalid:Et(),meta:hk,documentMeta:Et(hk),annotation:Et(hk),processingInstruction:Et(hk),definition:Nt.defineModifier("definition"),constant:Nt.defineModifier("constant"),function:Nt.defineModifier("function"),standard:Nt.defineModifier("standard"),local:Nt.defineModifier("local"),special:Nt.defineModifier("special")};for(let e in P){let t=P[e];t instanceof Nt&&(t.name=e)}MOe([{tag:P.link,class:"tok-link"},{tag:P.heading,class:"tok-heading"},{tag:P.emphasis,class:"tok-emphasis"},{tag:P.strong,class:"tok-strong"},{tag:P.keyword,class:"tok-keyword"},{tag:P.atom,class:"tok-atom"},{tag:P.bool,class:"tok-bool"},{tag:P.url,class:"tok-url"},{tag:P.labelName,class:"tok-labelName"},{tag:P.inserted,class:"tok-inserted"},{tag:P.deleted,class:"tok-deleted"},{tag:P.literal,class:"tok-literal"},{tag:P.string,class:"tok-string"},{tag:P.number,class:"tok-number"},{tag:[P.regexp,P.escape,P.special(P.string)],class:"tok-string2"},{tag:P.variableName,class:"tok-variableName"},{tag:P.local(P.variableName),class:"tok-variableName tok-local"},{tag:P.definition(P.variableName),class:"tok-variableName tok-definition"},{tag:P.special(P.variableName),class:"tok-variableName2"},{tag:P.definition(P.propertyName),class:"tok-propertyName tok-definition"},{tag:P.typeName,class:"tok-typeName"},{tag:P.namespace,class:"tok-namespace"},{tag:P.className,class:"tok-className"},{tag:P.macroName,class:"tok-macroName"},{tag:P.propertyName,class:"tok-propertyName"},{tag:P.operator,class:"tok-operator"},{tag:P.comment,class:"tok-comment"},{tag:P.meta,class:"tok-meta"},{tag:P.invalid,class:"tok-invalid"},{tag:P.punctuation,class:"tok-punctuation"}]);var XR;const Hf=new En;function $Q(e){return Ut.define({combine:e?t=>t.concat(e):void 0})}const c9=new En;class wl{constructor(t,n,r=[],i=""){this.data=t,this.name=i,dr.prototype.hasOwnProperty("tree")||Object.defineProperty(dr.prototype,"tree",{get(){return kr(this)}}),this.parser=n,this.extension=[TO.of(this),dr.languageData.of((s,a,o)=>{let l=AY(s,a,o),c=l.type.prop(Hf);if(!c)return[];let u=s.facet(c),d=l.type.prop(c9);if(d){let h=l.resolve(a-l.from,o);for(let f of d)if(f.test(h,s)){let p=s.facet(f.facet);return f.type=="replace"?p:p.concat(u)}}return u})].concat(r)}isActiveAt(t,n,r=-1){return AY(t,n,r).type.prop(Hf)==this.data}findRegions(t){let n=t.facet(TO);if(n?.data==this.data)return[{from:0,to:t.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],i=(s,a)=>{if(s.prop(Hf)==this.data){r.push({from:a,to:a+s.length});return}let o=s.prop(En.mounted);if(o){if(o.tree.prop(Hf)==this.data){if(o.overlay)for(let l of o.overlay)r.push({from:l.from+a,to:l.to+a});else r.push({from:a,to:a+s.length});return}else if(o.overlay){let l=r.length;if(i(o.tree,o.overlay[0].from+a),r.length>l)return}}for(let l=0;l<s.children.length;l++){let c=s.children[l];c instanceof ur&&i(c,s.positions[l]+a)}};return i(kr(t),0),r}get allowsNesting(){return!0}}wl.setState=Xn.define();function AY(e,t,n){let r=e.facet(TO),i=kr(e).topNode;if(!r||r.allowsNesting)for(let s=i;s;s=s.enter(t,n,ri.ExcludeBuffers))s.type.isTop&&(i=s);return i}class $r extends wl{constructor(t,n,r){super(t,n,[],r),this.parser=n}static define(t){let n=$Q(t.languageData);return new $r(n,t.parser.configure({props:[Hf.add(r=>r.isTop?n:void 0)]}),t.name)}configure(t,n){return new $r(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function kr(e){let t=e.field(wl.state,!1);return t?t.tree:ur.empty}class UJe{constructor(t){this.doc=t,this.cursorPos=0,this.string="",this.cursor=t.iter()}get length(){return this.doc.length}syncTo(t){return this.string=this.cursor.next(t-this.cursorPos).value,this.cursorPos=t+this.string.length,this.cursorPos-this.string.length}chunk(t){return this.syncTo(t),this.string}get lineChunks(){return!0}read(t,n){let r=this.cursorPos-this.string.length;return t<r||n>=this.cursorPos?this.doc.sliceString(t,n):this.string.slice(t-r,n-r)}}let Ob=null;class Pg{constructor(t,n,r=[],i,s,a,o,l){this.parser=t,this.state=n,this.fragments=r,this.tree=i,this.treeLen=s,this.viewport=a,this.skipped=o,this.scheduleOn=l,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new Pg(t,n,[],ur.empty,0,r,[],null)}startParse(){return this.parser.startParse(new UJe(this.state.doc),this.fragments)}work(t,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=ur.empty&&this.isDone(n??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof t=="number"){let i=Date.now()+t;t=()=>Date.now()>i}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let i=this.parse.advance();if(i)if(this.fragments=this.withoutTempSkipped(xh.addTree(i,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=i,this.parse=null,this.treeLen<(n??this.state.doc.length))this.parse=this.startParse();else return!0;if(t())return!1}})}takeTree(){let t,n;this.parse&&(t=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&this.parse.stopAt(t),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=t,this.tree=n,this.fragments=this.withoutTempSkipped(xh.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(t){let n=Ob;Ob=this;try{return t()}finally{Ob=n}}withoutTempSkipped(t){for(let n;n=this.tempSkipped.pop();)t=XY(t,n.from,n.to);return t}changes(t,n){let{fragments:r,tree:i,treeLen:s,viewport:a,skipped:o}=this;if(this.takeTree(),!t.empty){let l=[];if(t.iterChangedRanges((c,u,d,h)=>l.push({fromA:c,toA:u,fromB:d,toB:h})),r=xh.applyChanges(r,l),i=ur.empty,s=0,a={from:t.mapPos(a.from,-1),to:t.mapPos(a.to,1)},this.skipped.length){o=[];for(let c of this.skipped){let u=t.mapPos(c.from,1),d=t.mapPos(c.to,-1);u<d&&o.push({from:u,to:d})}}}return new Pg(this.parser,n,r,i,s,a,o,this.scheduleOn)}updateViewport(t){if(this.viewport.from==t.from&&this.viewport.to==t.to)return!1;this.viewport=t;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:i,to:s}=this.skipped[r];i<t.to&&s>t.from&&(this.fragments=XY(this.fragments,i,s),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(t,n){this.skipped.push({from:t,to:n})}static getSkippingParser(t){return new class extends bQ{createParse(n,r,i){let s=i[0].from,a=i[i.length-1].to;return{parsedPos:s,advance(){let l=Ob;if(l){for(let c of i)l.tempSkipped.push(c);t&&(l.scheduleOn=l.scheduleOn?Promise.all([l.scheduleOn,t]):t)}return this.parsedPos=a,new ur(_s.none,[],[],a-s)},stoppedAt:null,stopAt(){}}}}}isDone(t){t=Math.min(t,this.state.doc.length);let n=this.fragments;return this.treeLen>=t&&n.length&&n[0].from==0&&n[0].to>=t}static get(){return Ob}}function XY(e,t,n){return xh.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Nv{constructor(t){this.context=t,this.tree=t.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new Nv(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=Pg.create(t.facet(TO).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new Nv(r)}}wl.state=na.define({create:Nv.init,update(e,t){for(let n of t.effects)if(n.is(wl.setState))return n.value;return t.startState.facet(TO)!=t.state.facet(TO)?Nv.init(t.state):e.apply(t)}});let zOe=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<"u"&&(zOe=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const DR=typeof navigator<"u"&&(!((XR=navigator.scheduling)===null||XR===void 0)&&XR.isInputPending)?()=>navigator.scheduling.isInputPending():null,WJe=Ui.fromClass(class{constructor(t){this.view=t,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(t){let n=this.view.state.field(wl.state).context;(n.updateViewport(t.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),(t.docChanged||t.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:t}=this.view,n=t.field(wl.state);(n.tree!=n.context.tree||!n.context.isDone(t.doc.length))&&(this.working=zOe(this.work))}work(t){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:i}}=this.view,s=r.field(wl.state);if(s.tree==s.context.tree&&s.context.isDone(i+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,t&&!DR?Math.max(25,t.timeRemaining()-5):1e9),o=s.context.treeLen<i&&r.doc.length>i+1e3,l=s.context.work(()=>DR&&DR()||Date.now()>a,i+(o?0:1e5));this.chunkBudget-=Date.now()-n,(l||this.chunkBudget<=0)&&(s.context.takeTree(),this.view.dispatch({effects:wl.setState.of(new Nv(s.context))})),this.chunkBudget>0&&!(l&&!o)&&this.scheduleWork(),this.checkAsyncSchedule(s.context)}checkAsyncSchedule(t){t.scheduleOn&&(this.workScheduled++,t.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Lo(this.view.state,n)).then(()=>this.workScheduled--),t.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),TO=Ut.define({combine(e){return e.length?e[0]:null},enables:e=>[wl.state,WJe,St.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]});class gr{constructor(t,n=[]){this.language=t,this.support=n,this.extension=[t,n]}}class Ce{constructor(t,n,r,i,s,a=void 0){this.name=t,this.alias=n,this.extensions=r,this.filename=i,this.loadFunc=s,this.support=a,this.loading=null}load(){return this.loading||(this.loading=this.loadFunc().then(t=>this.support=t,t=>{throw this.loading=null,t}))}static of(t){let{load:n,support:r}=t;if(!n){if(!r)throw new RangeError("Must pass either 'load' or 'support' to LanguageDescription.of");n=()=>Promise.resolve(r)}return new Ce(t.name,(t.alias||[]).concat(t.name).map(i=>i.toLowerCase()),t.extensions||[],t.filename,n,r)}static matchFilename(t,n){for(let i of t)if(i.filename&&i.filename.test(n))return i;let r=/\.([^.]+)$/.exec(n);if(r){for(let i of t)if(i.extensions.indexOf(r[1])>-1)return i}return null}static matchLanguageName(t,n,r=!0){n=n.toLowerCase();for(let i of t)if(i.alias.some(s=>s==n))return i;if(r)for(let i of t)for(let s of i.alias){let a=n.indexOf(s);if(a>-1&&(s.length>2||!/\w/.test(n[a-1])&&!/\w/.test(n[a+s.length])))return i}return null}}const jJe=Ut.define(),T1=Ut.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(n=>n!=t[0]))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function _g(e){let t=e.facet(T1);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function vx(e,t){let n="",r=e.tabSize,i=e.facet(T1)[0];if(i==" "){for(;t>=r;)n+=" ",t-=r;i=" "}for(let s=0;s<t;s++)n+=i;return n}function u9(e,t){e instanceof dr&&(e=new kQ(e));for(let r of e.state.facet(jJe)){let i=r(e,t);if(i!==void 0)return i}let n=kr(e.state);return n.length>=t?GJe(e,n,t):null}class kQ{constructor(t,n={}){this.state=t,this.options=n,this.unit=_g(t)}lineAt(t,n=1){let r=this.state.doc.lineAt(t),{simulateBreak:i,simulateDoubleBreak:s}=this.options;return i!=null&&i>=r.from&&i<=r.to?s&&i==t?{text:"",from:t}:(n<0?i<t:i<=t)?{text:r.text.slice(i-r.from),from:i}:{text:r.text.slice(0,i-r.from),from:r.from}:r}textAfterPos(t,n=1){if(this.options.simulateDoubleBreak&&t==this.options.simulateBreak)return"";let{text:r,from:i}=this.lineAt(t,n);return r.slice(t-i,Math.min(r.length,t+100-i))}column(t,n=1){let{text:r,from:i}=this.lineAt(t,n),s=this.countColumn(r,t-i),a=this.options.overrideIndentation?this.options.overrideIndentation(i):-1;return a>-1&&(s+=a-this.countColumn(r,r.search(/\S|$/))),s}countColumn(t,n=t.length){return su(t,this.state.tabSize,n)}lineIndent(t,n=1){let{text:r,from:i}=this.lineAt(t,n),s=this.options.overrideIndentation;if(s){let a=s(i);if(a>-1)return a}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const ji=new En;function GJe(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let s=[];for(let a=i;a&&!(a.from<r.node.from||a.to>r.node.to||a.from==r.node.from&&a.type==r.node.type);a=a.parent)s.push(a);for(let a=s.length-1;a>=0;a--)r={node:s[a],next:r}}return LOe(r,e,n)}function LOe(e,t,n){for(let r=e;r;r=r.next){let i=YJe(r.node);if(i)return i(d9.create(t,n,r))}return 0}function VJe(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function YJe(e){let t=e.type.prop(ji);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(En.closedBy))){let i=e.lastChild,s=i&&r.indexOf(i.name)>-1;return a=>qOe(a,!0,1,void 0,s&&!VJe(a)?i.from:void 0)}return e.parent==null?BJe:null}function BJe(){return 0}class d9 extends kQ{constructor(t,n,r){super(t.state,t.options),this.base=t,this.pos=n,this.context=r}get node(){return this.context.node}static create(t,n,r){return new d9(t,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(t){let n=this.state.doc.lineAt(t.from);for(;;){let r=t.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(ZJe(r,t))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){return LOe(this.context.next,this.base,this.pos)}}function ZJe(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function HJe(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,s=e.state.doc.lineAt(n.from),a=i==null||i<=s.from?s.to:Math.min(s.to,i);for(let o=n.to;;){let l=t.childAfter(o);if(!l||l==r)return null;if(!l.type.isSkipped){if(l.from>=a)return null;let c=/^ */.exec(s.text.slice(n.to-s.from))[0].length;return{from:n.from,to:n.to+c}}o=l.to}}function fc({closing:e,align:t=!0,units:n=1}){return r=>qOe(r,t,n,e)}function qOe(e,t,n,r,i){let s=e.textAfter,a=s.match(/^\s*/)[0].length,o=r&&s.slice(a,a+r.length)==r||i==e.pos+a,l=t?HJe(e):null;return l?o?e.column(l.from):e.column(l.to):e.baseIndent+(o?0:e.unit*n)}const h9=e=>e.baseIndent;function Ki({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}const KJe=200;function JJe(){return dr.transactionFilter.of(e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:r}=e.newSelection.main,i=n.lineAt(r);if(r>i.from+KJe)return e;let s=n.sliceString(i.from,r);if(!t.some(c=>c.test(s)))return e;let{state:a}=e,o=-1,l=[];for(let{head:c}of a.selection.ranges){let u=a.doc.lineAt(c);if(u.from==o)continue;o=u.from;let d=u9(a,u.from);if(d==null)continue;let h=/^\s*/.exec(u.text)[0],f=vx(a,d);h!=f&&l.push({from:u.from,to:u.from+h.length,insert:f})}return l.length?[e,{changes:l,sequential:!0}]:e})}const UOe=Ut.define(),Ai=new En;function ja(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}function eet(e,t,n){let r=kr(e);if(r.length<n)return null;let i=r.resolveStack(n,1),s=null;for(let a=i;a;a=a.next){let o=a.node;if(o.to<=n||o.from>n)continue;if(s&&o.from<t)break;let l=o.type.prop(Ai);if(l&&(o.to<r.length-50||r.length==e.doc.length||!tet(o))){let c=l(o,e);c&&c.from<=n&&c.from>=t&&c.to>n&&(s=c)}}return s}function tet(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function YP(e,t,n){for(let r of e.facet(UOe)){let i=r(e,t,n);if(i)return i}return eet(e,t,n)}function WOe(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}const TQ=Xn.define({map:WOe}),XS=Xn.define({map:WOe});function jOe(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(r=>r.from<=n&&r.to>=n)||t.push(e.lineBlockAt(n));return t}const Cg=na.define({create(){return qt.none},update(e,t){e=e.map(t.changes);for(let n of t.effects)if(n.is(TQ)&&!net(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(YOe),i=r?qt.replace({widget:new uet(r(t.state,n.value))}):DY;e=e.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(XS)&&(e=e.update({filter:(r,i)=>n.value.from!=r||n.value.to!=i,filterFrom:n.value.from,filterTo:n.value.to}));if(t.selection){let n=!1,{head:r}=t.selection.main;e.between(r,r,(i,s)=>{i<r&&s>r&&(n=!0)}),n&&(e=e.update({filterFrom:r,filterTo:r,filter:(i,s)=>s<=r||i>=r}))}return e},provide:e=>St.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(r,i)=>{n.push(r,i)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid JSON for fold state");t.push(DY.range(r,i))}return qt.set(t,!0)}});function BP(e,t,n){var r;let i=null;return(r=e.field(Cg,!1))===null||r===void 0||r.between(t,n,(s,a)=>{(!i||i.from>s)&&(i={from:s,to:a})}),i}function net(e,t,n){let r=!1;return e.between(t,t,(i,s)=>{i==t&&s==n&&(r=!0)}),r}function GOe(e,t){return e.field(Cg,!1)?t:t.concat(Xn.appendConfig.of(BOe()))}const ret=e=>{for(let t of jOe(e)){let n=YP(e.state,t.from,t.to);if(n)return e.dispatch({effects:GOe(e.state,[TQ.of(n),VOe(e,n)])}),!0}return!1},iet=e=>{if(!e.state.field(Cg,!1))return!1;let t=[];for(let n of jOe(e)){let r=BP(e.state,n.from,n.to);r&&t.push(XS.of(r),VOe(e,r,!1))}return t.length&&e.dispatch({effects:t}),t.length>0};function VOe(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return St.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${r} ${e.state.phrase("to")} ${i}.`)}const set=e=>{let{state:t}=e,n=[];for(let r=0;r<t.doc.length;){let i=e.lineBlockAt(r),s=YP(t,i.from,i.to);s&&n.push(TQ.of(s)),r=(s?e.lineBlockAt(s.to):i).to+1}return n.length&&e.dispatch({effects:GOe(e.state,n)}),!!n.length},aet=e=>{let t=e.state.field(Cg,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,(r,i)=>{n.push(XS.of({from:r,to:i}))}),e.dispatch({effects:n}),!0},oet=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:ret},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:iet},{key:"Ctrl-Alt-[",run:set},{key:"Ctrl-Alt-]",run:aet}],cet={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},YOe=Ut.define({combine(e){return Cd(e,cet)}});function BOe(e){return[Cg,fet]}function ZOe(e,t){let{state:n}=e,r=n.facet(YOe),i=a=>{let o=e.lineBlockAt(e.posAtDOM(a.target)),l=BP(e.state,o.from,o.to);l&&e.dispatch({effects:XS.of(l)}),a.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let s=document.createElement("span");return s.textContent=r.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=i,s}const DY=qt.replace({widget:new class extends hu{toDOM(e){return ZOe(e,null)}}});class uet extends hu{constructor(t){super(),this.value=t}eq(t){return this.value==t.value}toDOM(t){return ZOe(t,this.value)}}const det={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class IR extends zh{constructor(t,n){super(),this.config=t,this.open=n}eq(t){return this.config==t.config&&this.open==t.open}toDOM(t){if(this.config.markerDOM)return this.config.markerDOM(this.open);let n=document.createElement("span");return n.textContent=this.open?this.config.openText:this.config.closedText,n.title=t.state.phrase(this.open?"Fold line":"Unfold line"),n}}function het(e={}){let t={...det,...e},n=new IR(t,!0),r=new IR(t,!1),i=Ui.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(TO)!=a.state.facet(TO)||a.startState.field(Cg,!1)!=a.state.field(Cg,!1)||kr(a.startState)!=kr(a.state)||t.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let o=new Fh;for(let l of a.viewportLineBlocks){let c=BP(a.state,l.from,l.to)?r:YP(a.state,l.from,l.to)?n:null;c&&o.add(l.from,l.from,c)}return o.finish()}}),{domEventHandlers:s}=t;return[i,$Je({class:"cm-foldGutter",markers(a){var o;return((o=a.plugin(i))===null||o===void 0?void 0:o.markers)||wr.empty},initialSpacer(){return new IR(t,!1)},domEventHandlers:{...s,click:(a,o,l)=>{if(s.click&&s.click(a,o,l))return!0;let c=BP(a.state,o.from,o.to);if(c)return a.dispatch({effects:XS.of(c)}),!0;let u=YP(a.state,o.from,o.to);return u?(a.dispatch({effects:TQ.of(u)}),!0):!1}}}),BOe()]}const fet=St.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class P1{constructor(t,n){this.specs=t;let r;function i(o){let l=SO.newName();return(r||(r=Object.create(null)))["."+l]=o,l}const s=typeof n.all=="string"?n.all:n.all?i(n.all):void 0,a=n.scope;this.scope=a instanceof wl?o=>o.prop(Hf)==a.data:a?o=>o==a:void 0,this.style=MOe(t.map(o=>({tag:o.tag,class:o.class||i(Object.assign({},o,{tag:null}))})),{all:s}).style,this.module=r?new SO(r):null,this.themeType=n.themeType}static define(t,n){return new P1(t,n||{})}}const aI=Ut.define(),HOe=Ut.define({combine(e){return e.length?[e[0]]:null}});function NR(e){let t=e.facet(aI);return t.length?t:e.facet(HOe)}function ZP(e,t){let n=[pet],r;return e instanceof P1&&(e.module&&n.push(St.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(HOe.of(e)):r?n.push(aI.computeN([St.darkTheme],i=>i.facet(St.darkTheme)==(r=="dark")?[e]:[])):n.push(aI.of(e)),n}class Oet{constructor(t){this.markCache=Object.create(null),this.tree=kr(t.state),this.decorations=this.buildDeco(t,NR(t.state)),this.decoratedTo=t.viewport.to}update(t){let n=kr(t.state),r=NR(t.state),i=r!=NR(t.startState),{viewport:s}=t.view,a=t.changes.mapPos(this.decoratedTo,1);n.length<s.to&&!i&&n.type==this.tree.type&&a>=s.to?(this.decorations=this.decorations.map(t.changes),this.decoratedTo=a):(n!=this.tree||t.viewportChanged||i)&&(this.tree=n,this.decorations=this.buildDeco(t.view,r),this.decoratedTo=s.to)}buildDeco(t,n){if(!n||!this.tree.length)return qt.none;let r=new Fh;for(let{from:i,to:s}of t.visibleRanges)zJe(this.tree,n,(a,o,l)=>{r.add(a,o,this.markCache[l]||(this.markCache[l]=qt.mark({class:l})))},i,s);return r.finish()}}const pet=Kh.high(Ui.fromClass(Oet,{decorations:e=>e.decorations})),get=P1.define([{tag:P.meta,color:"#404740"},{tag:P.link,textDecoration:"underline"},{tag:P.heading,textDecoration:"underline",fontWeight:"bold"},{tag:P.emphasis,fontStyle:"italic"},{tag:P.strong,fontWeight:"bold"},{tag:P.strikethrough,textDecoration:"line-through"},{tag:P.keyword,color:"#708"},{tag:[P.atom,P.bool,P.url,P.contentSeparator,P.labelName],color:"#219"},{tag:[P.literal,P.inserted],color:"#164"},{tag:[P.string,P.deleted],color:"#a11"},{tag:[P.regexp,P.escape,P.special(P.string)],color:"#e40"},{tag:P.definition(P.variableName),color:"#00f"},{tag:P.local(P.variableName),color:"#30a"},{tag:[P.typeName,P.namespace],color:"#085"},{tag:P.className,color:"#167"},{tag:[P.special(P.variableName),P.macroName],color:"#256"},{tag:P.definition(P.propertyName),color:"#00c"},{tag:P.comment,color:"#940"},{tag:P.invalid,color:"#f00"}]),met=St.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),KOe=1e4,JOe="()[]{}",epe=Ut.define({combine(e){return Cd(e,{afterCursor:!0,brackets:JOe,maxScanDistance:KOe,renderMatch:wet})}}),vet=qt.mark({class:"cm-matchingBracket"}),bet=qt.mark({class:"cm-nonmatchingBracket"});function wet(e){let t=[],n=e.matched?vet:bet;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const yet=na.define({create(){return qt.none},update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],r=t.state.facet(epe);for(let i of t.state.selection.ranges){if(!i.empty)continue;let s=Ju(t.state,i.head,-1,r)||i.head>0&&Ju(t.state,i.head-1,1,r)||r.afterCursor&&(Ju(t.state,i.head,1,r)||i.head<t.state.doc.length&&Ju(t.state,i.head+1,-1,r));s&&(n=n.concat(r.renderMatch(s,t.state)))}return qt.set(n,!0)},provide:e=>St.decorations.from(e)}),xet=[yet,met];function $et(e={}){return[epe.of(e),xet]}const f9=new En;function oI(e,t,n){let r=e.prop(t<0?En.openedBy:En.closedBy);if(r)return r;if(e.name.length==1){let i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function lI(e){let t=e.type.prop(f9);return t?t(e.node):e}function Ju(e,t,n,r={}){let i=r.maxScanDistance||KOe,s=r.brackets||JOe,a=kr(e),o=a.resolveInner(t,n);for(let l=o;l;l=l.parent){let c=oI(l.type,n,s);if(c&&l.from<l.to){let u=lI(l);if(u&&(n>0?t>=u.from&&t<u.to:t>u.from&&t<=u.to))return ket(e,t,n,l,u,c,s)}}return Tet(e,t,n,a,o.type,i,s)}function ket(e,t,n,r,i,s,a){let o=r.parent,l={from:i.from,to:i.to},c=0,u=o?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(c==0&&s.indexOf(u.type.name)>-1&&u.from<u.to){let d=lI(u);return{start:l,end:d?{from:d.from,to:d.to}:void 0,matched:!0}}else if(oI(u.type,n,a))c++;else if(oI(u.type,-n,a)){if(c==0){let d=lI(u);return{start:l,end:d&&d.from<d.to?{from:d.from,to:d.to}:void 0,matched:!1}}c--}}while(n<0?u.prevSibling():u.nextSibling());return{start:l,matched:!1}}function Tet(e,t,n,r,i,s,a){let o=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=a.indexOf(o);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let h=0;!u.next().done&&h<=s;){let f=u.value;n<0&&(h+=f.length);let p=t+h*n;for(let g=n>0?0:f.length-1,m=n>0?f.length:-1;g!=m;g+=n){let v=a.indexOf(f[g]);if(!(v<0||r.resolveInner(p+g,1).type!=i))if(v%2==0==n>0)d++;else{if(d==1)return{start:c,end:{from:p+g,to:p+g+1},matched:v>>1==l>>1};d--}}n>0&&(h+=f.length)}return u.done?{start:c,matched:!1}:null}function IY(e,t,n,r=0,i=0){t==null&&(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let s=i;for(let a=r;a<t;a++)e.charCodeAt(a)==9?s+=n-s%n:s++;return s}class tpe{constructor(t,n,r,i){this.string=t,this.tabSize=n,this.indentUnit=r,this.overrideIndent=i,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(t){let n=this.string.charAt(this.pos),r;if(typeof t=="string"?r=n==t:r=n&&(t instanceof RegExp?t.test(n):t(n)),r)return++this.pos,n}eatWhile(t){let n=this.pos;for(;this.eat(t););return this.pos>n}eatSpace(){let t=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>t}skipToEnd(){this.pos=this.string.length}skipTo(t){let n=this.string.indexOf(t,this.pos);if(n>-1)return this.pos=n,!0}backUp(t){this.pos-=t}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=IY(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){var t;return(t=this.overrideIndent)!==null&&t!==void 0?t:IY(this.string,null,this.tabSize)}match(t,n,r){if(typeof t=="string"){let i=a=>r?a.toLowerCase():a,s=this.string.substr(this.pos,t.length);return i(s)==i(t)?(n!==!1&&(this.pos+=t.length),!0):null}else{let i=this.string.slice(this.pos).match(t);return i&&i.index>0?null:(i&&n!==!1&&(this.pos+=i[0].length),i)}}current(){return this.string.slice(this.start,this.pos)}}function Pet(e){return{name:e.name||"",token:e.token,blankLine:e.blankLine||(()=>{}),startState:e.startState||(()=>!0),copyState:e.copyState||_et,indent:e.indent||(()=>null),languageData:e.languageData||{},tokenTable:e.tokenTable||p9,mergeTokens:e.mergeTokens!==!1}}function _et(e){if(typeof e!="object")return e;let t={};for(let n in e){let r=e[n];t[n]=r instanceof Array?r.slice():r}return t}const NY=new WeakMap;class ct extends wl{constructor(t){let n=$Q(t.languageData),r=Pet(t),i,s=new class extends bQ{createParse(a,o,l){return new Qet(i,a,o,l)}};super(n,s,[],t.name),this.topNode=Aet(n,this),i=this,this.streamParser=r,this.stateAfter=new En({perNode:!0}),this.tokenTable=t.tokenTable?new spe(r.tokenTable):Ret}static define(t){return new ct(t)}getIndent(t){let n,{overrideIndentation:r}=t.options;r&&(n=NY.get(t.state),n!=null&&n<t.pos-1e4&&(n=void 0));let i=O9(this,t.node.tree,t.node.from,t.node.from,n??t.pos),s,a;if(i?(a=i.state,s=i.pos+1):(a=this.streamParser.startState(t.unit),s=t.node.from),t.pos-s>1e4)return null;for(;s<t.pos;){let l=t.state.doc.lineAt(s),c=Math.min(t.pos,l.to);if(l.length){let u=r?r(l.from):-1,d=new tpe(l.text,t.state.tabSize,t.unit,u<0?void 0:u);for(;d.pos<c-l.from;)rpe(this.streamParser.token,d,a)}else this.streamParser.blankLine(a,t.unit);if(c==t.pos)break;s=l.to+1}let o=t.lineAt(t.pos);return r&&n==null&&NY.set(t.state,o.from),this.streamParser.indent(a,/^\s*(.*)/.exec(o.text)[1],t)}get allowsNesting(){return!1}}function O9(e,t,n,r,i){let s=n>=r&&n+t.length<=i&&t.prop(e.stateAfter);if(s)return{state:e.streamParser.copyState(s),pos:n+t.length};for(let a=t.children.length-1;a>=0;a--){let o=t.children[a],l=n+t.positions[a],c=o instanceof ur&&l<i&&O9(e,o,l,r,i);if(c)return c}return null}function npe(e,t,n,r,i){if(i&&n<=0&&r>=t.length)return t;!i&&n==0&&t.type==e.topNode&&(i=!0);for(let s=t.children.length-1;s>=0;s--){let a=t.positions[s],o=t.children[s],l;if(a<r&&o instanceof ur){if(!(l=npe(e,o,n-a,r-a,i)))break;return i?new ur(t.type,t.children.slice(0,s).concat(l),t.positions.slice(0,s+1),a+l.length):l}}return null}function Cet(e,t,n,r,i){for(let s of t){let a=s.from+(s.openStart?25:0),o=s.to-(s.openEnd?25:0),l=a<=n&&o>n&&O9(e,s.tree,0-s.offset,n,o),c;if(l&&l.pos<=r&&(c=npe(e,s.tree,n+s.offset,l.pos+s.offset,!1)))return{state:l.state,tree:c}}return{state:e.streamParser.startState(i?_g(i):4),tree:ur.empty}}let Qet=class{constructor(t,n,r,i){this.lang=t,this.input=n,this.fragments=r,this.ranges=i,this.stoppedAt=null,this.chunks=[],this.chunkPos=[],this.chunk=[],this.chunkReused=void 0,this.rangeIndex=0,this.to=i[i.length-1].to;let s=Pg.get(),a=i[0].from,{state:o,tree:l}=Cet(t,r,a,this.to,s?.state);this.state=o,this.parsedPos=this.chunkStart=a+l.length;for(let c=0;c<l.children.length;c++)this.chunks.push(l.children[c]),this.chunkPos.push(l.positions[c]);s&&this.parsedPos<s.viewport.from-1e5&&i.some(c=>c.from<=s.viewport.from&&c.to>=s.viewport.from)&&(this.state=this.lang.streamParser.startState(_g(s.state)),s.skipUntilInView(this.parsedPos,s.viewport.from),this.parsedPos=s.viewport.from),this.moveRangeIndex()}advance(){let t=Pg.get(),n=this.stoppedAt==null?this.to:Math.min(this.to,this.stoppedAt),r=Math.min(n,this.chunkStart+2048);for(t&&(r=Math.min(r,t.viewport.to));this.parsedPos<r;)this.parseLine(t);return this.chunkStart<this.parsedPos&&this.finishChunk(),this.parsedPos>=n?this.finish():t&&this.parsedPos>=t.viewport.to?(t.skipUntilInView(this.parsedPos,n),this.finish()):null}stopAt(t){this.stoppedAt=t}lineAfter(t){let n=this.input.chunk(t);if(this.input.lineChunks)n==`
|
|
1086
1086
|
`&&(n="");else{let r=n.indexOf(`
|
|
1087
|
-
`);r>-1&&(n=n.slice(0,r))}return t+n.length<=this.to?n:n.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,n=this.lineAfter(t),r=t+n.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=r||(n=n.slice(0,s-(r-n.length)),i++,i==this.ranges.length))break;let a=this.ranges[i].from,o=this.lineAfter(a);n+=o,r=a+o.length}return{line:n,end:r}}skipGapsTo(t,n,r){for(;;){let i=this.ranges[this.rangeIndex].to,s=t+n;if(r>0?i>s:i>=s)break;let a=this.ranges[++this.rangeIndex].from;n+=a-i}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(t,n,r,i){let s=4;if(this.ranges.length>1){i=this.skipGapsTo(n,i,1),n+=i;let o=this.chunk.length;i=this.skipGapsTo(r,i,-1),r+=i,s+=this.chunk.length-o}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&a>=0&&this.chunk[a]==t&&this.chunk[a+2]==n?this.chunk[a+2]=r:this.chunk.push(t,n,r,s),i}parseLine(t){let{line:n,end:r}=this.nextLine(),i=0,{streamParser:s}=this.lang,a=new tpe(n,t?t.state.tabSize:4,t?_g(t.state):2);if(a.eol())s.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let o=rpe(s.token,a,this.state);if(o&&(i=this.emitToken(this.lang.tokenTable.resolve(o),this.parsedPos+a.start,this.parsedPos+a.pos,i)),a.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let t=ur.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Eet,topID:0,maxBufferLength:2048,reused:this.chunkReused});t=new ur(t.type,t.children,t.positions,t.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(t),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new ur(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function rpe(e,t,n){t.start=t.pos;for(let r=0;r<10;r++){let i=e(t,n);if(t.pos>t.start)return i}throw new Error("Stream parser failed to advance stream.")}const p9=Object.create(null),bx=[_s.none],Eet=new k1(bx),FY=[],MY=Object.create(null),ipe=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])ipe[e]=ape(p9,t);class spe{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),ipe)}resolve(t){return t?this.table[t]||(this.table[t]=ape(this.extra,t)):0}}const Ret=new spe(p9);function FR(e,t){FY.indexOf(e)>-1||(FY.push(e),console.warn(t))}function ape(e,t){let n=[];for(let o of t.split(" ")){let l=[];for(let c of o.split(".")){let u=e[c]||P[c];u?typeof u=="function"?l.length?l=l.map(u):FR(c,`Modifier ${c} used at start of tag`):l.length?FR(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:FR(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),i=r+" "+n.map(o=>o.id),s=MY[i];if(s)return s.id;let a=MY[i]=_s.define({id:bx.length,name:r,props:[Qr({[r]:n})]});return bx.push(a),a.id}function Aet(e,t){let n=_s.define({id:bx.length,name:"Document",props:[Hf.add(()=>e),ji.add(()=>r=>t.getIndent(r))],top:!0});return bx.push(n),n}wi.RTL,wi.LTR;function tt(e){return new gr(ct.define(e))}function yf(e){return Xe(()=>Promise.resolve().then(()=>sut),void 0,import.meta.url).then(t=>t.sql({dialect:t[e]}))}const Xet=[Ce.of({name:"C",extensions:["c","h","ino"],load(){return Xe(()=>Promise.resolve().then(()=>QZ),void 0,import.meta.url).then(e=>e.cpp())}}),Ce.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return Xe(()=>Promise.resolve().then(()=>QZ),void 0,import.meta.url).then(e=>e.cpp())}}),Ce.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return yf("Cassandra")}}),Ce.of({name:"CSS",extensions:["css"],load(){return Xe(()=>Promise.resolve().then(()=>wrt),void 0,import.meta.url).then(e=>e.css())}}),Ce.of({name:"Go",extensions:["go"],load(){return Xe(()=>import("./index-IUMywSkL.js"),__vite__mapDeps([5,1,2]),import.meta.url).then(e=>e.go())}}),Ce.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return Xe(()=>Promise.resolve().then(()=>dit),void 0,import.meta.url).then(e=>e.html())}}),Ce.of({name:"Java",extensions:["java"],load(){return Xe(()=>Promise.resolve().then(()=>cut),void 0,import.meta.url).then(e=>e.java())}}),Ce.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return Xe(()=>Promise.resolve().then(()=>gk),void 0,import.meta.url).then(e=>e.javascript())}}),Ce.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return Xe(()=>Promise.resolve().then(()=>gst),void 0,import.meta.url).then(e=>e.json())}}),Ce.of({name:"JSX",extensions:["jsx"],load(){return Xe(()=>Promise.resolve().then(()=>gk),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Ce.of({name:"LESS",extensions:["less"],load(){return Xe(()=>Promise.resolve().then(()=>Rit),void 0,import.meta.url).then(e=>e.less())}}),Ce.of({name:"Liquid",extensions:["liquid"],load(){return Xe(()=>Promise.resolve().then(()=>Yht),void 0,import.meta.url).then(e=>e.liquid())}}),Ce.of({name:"MariaDB SQL",load(){return yf("MariaSQL")}}),Ce.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return Xe(()=>Promise.resolve().then(()=>yit),void 0,import.meta.url).then(e=>e.markdown())}}),Ce.of({name:"MS SQL",load(){return yf("MSSQL")}}),Ce.of({name:"MySQL",load(){return yf("MySQL")}}),Ce.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return Xe(()=>Promise.resolve().then(()=>kht),void 0,import.meta.url).then(e=>e.php())}}),Ce.of({name:"PLSQL",extensions:["pls"],load(){return yf("PLSQL")}}),Ce.of({name:"PostgreSQL",load(){return yf("PostgreSQL")}}),Ce.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return Xe(()=>Promise.resolve().then(()=>Ylt),void 0,import.meta.url).then(e=>e.python())}}),Ce.of({name:"Rust",extensions:["rs"],load(){return Xe(()=>Promise.resolve().then(()=>Cut),void 0,import.meta.url).then(e=>e.rust())}}),Ce.of({name:"Sass",extensions:["sass"],load(){return Xe(()=>Promise.resolve().then(()=>jB),void 0,import.meta.url).then(e=>e.sass({indented:!0}))}}),Ce.of({name:"SCSS",extensions:["scss"],load(){return Xe(()=>Promise.resolve().then(()=>jB),void 0,import.meta.url).then(e=>e.sass())}}),Ce.of({name:"SQL",extensions:["sql"],load(){return yf("StandardSQL")}}),Ce.of({name:"SQLite",load(){return yf("SQLite")}}),Ce.of({name:"TSX",extensions:["tsx"],load(){return Xe(()=>Promise.resolve().then(()=>gk),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),Ce.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return Xe(()=>Promise.resolve().then(()=>gk),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Ce.of({name:"WebAssembly",extensions:["wat","wast"],load(){return Xe(()=>Promise.resolve().then(()=>Hht),void 0,import.meta.url).then(e=>e.wast())}}),Ce.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return Xe(()=>Promise.resolve().then(()=>gct),void 0,import.meta.url).then(e=>e.xml())}}),Ce.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return Xe(()=>import("./index-NgXBxtHb.js"),__vite__mapDeps([6,1,2]),import.meta.url).then(e=>e.yaml())}}),Ce.of({name:"APL",extensions:["dyalog","apl"],load(){return Xe(()=>Promise.resolve().then(()=>Tpt),void 0,import.meta.url).then(e=>tt(e.apl))}}),Ce.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return Xe(()=>Promise.resolve().then(()=>Ppt),void 0,import.meta.url).then(e=>tt(e.asciiArmor))}}),Ce.of({name:"ASN.1",extensions:["asn","asn1"],load(){return Xe(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>tt(e.asn1({})))}}),Ce.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return Xe(()=>Promise.resolve().then(()=>Rpt),void 0,import.meta.url).then(e=>tt(e.asterisk))}}),Ce.of({name:"Brainfuck",extensions:["b","bf"],load(){return Xe(()=>Promise.resolve().then(()=>Xpt),void 0,import.meta.url).then(e=>tt(e.brainfuck))}}),Ce.of({name:"Cobol",extensions:["cob","cpy"],load(){return Xe(()=>Promise.resolve().then(()=>lgt),void 0,import.meta.url).then(e=>tt(e.cobol))}}),Ce.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return Xe(()=>Promise.resolve().then(()=>mp),void 0,import.meta.url).then(e=>tt(e.csharp))}}),Ce.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return Xe(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>tt(e.clojure))}}),Ce.of({name:"ClojureScript",extensions:["cljs"],load(){return Xe(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>tt(e.clojure))}}),Ce.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return Xe(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>tt(e.gss))}}),Ce.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return Xe(()=>Promise.resolve().then(()=>Jpt),void 0,import.meta.url).then(e=>tt(e.cmake))}}),Ce.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return Xe(()=>Promise.resolve().then(()=>ygt),void 0,import.meta.url).then(e=>tt(e.coffeeScript))}}),Ce.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return Xe(()=>Promise.resolve().then(()=>Pgt),void 0,import.meta.url).then(e=>tt(e.commonLisp))}}),Ce.of({name:"Cypher",extensions:["cyp","cypher"],load(){return Xe(()=>Promise.resolve().then(()=>jgt),void 0,import.meta.url).then(e=>tt(e.cypher))}}),Ce.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return Xe(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>tt(e.cython))}}),Ce.of({name:"Crystal",extensions:["cr"],load(){return Xe(()=>Promise.resolve().then(()=>Mgt),void 0,import.meta.url).then(e=>tt(e.crystal))}}),Ce.of({name:"D",extensions:["d"],load(){return Xe(()=>Promise.resolve().then(()=>Kgt),void 0,import.meta.url).then(e=>tt(e.d))}}),Ce.of({name:"Dart",extensions:["dart"],load(){return Xe(()=>Promise.resolve().then(()=>mp),void 0,import.meta.url).then(e=>tt(e.dart))}}),Ce.of({name:"diff",extensions:["diff","patch"],load(){return Xe(()=>Promise.resolve().then(()=>Jgt),void 0,import.meta.url).then(e=>tt(e.diff))}}),Ce.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return Xe(()=>Promise.resolve().then(()=>hmt),void 0,import.meta.url).then(e=>tt(e.dockerFile))}}),Ce.of({name:"DTD",extensions:["dtd"],load(){return Xe(()=>Promise.resolve().then(()=>pmt),void 0,import.meta.url).then(e=>tt(e.dtd))}}),Ce.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return Xe(()=>Promise.resolve().then(()=>wmt),void 0,import.meta.url).then(e=>tt(e.dylan))}}),Ce.of({name:"EBNF",load(){return Xe(()=>Promise.resolve().then(()=>ymt),void 0,import.meta.url).then(e=>tt(e.ebnf))}}),Ce.of({name:"ECL",extensions:["ecl"],load(){return Xe(()=>Promise.resolve().then(()=>Cmt),void 0,import.meta.url).then(e=>tt(e.ecl))}}),Ce.of({name:"edn",extensions:["edn"],load(){return Xe(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>tt(e.clojure))}}),Ce.of({name:"Eiffel",extensions:["e"],load(){return Xe(()=>Promise.resolve().then(()=>Dmt),void 0,import.meta.url).then(e=>tt(e.eiffel))}}),Ce.of({name:"Elm",extensions:["elm"],load(){return Xe(()=>Promise.resolve().then(()=>Gmt),void 0,import.meta.url).then(e=>tt(e.elm))}}),Ce.of({name:"Erlang",extensions:["erl"],load(){return Xe(()=>Promise.resolve().then(()=>g0t),void 0,import.meta.url).then(e=>tt(e.erlang))}}),Ce.of({name:"Esper",load(){return Xe(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>tt(e.esper))}}),Ce.of({name:"Factor",extensions:["factor"],load(){return Xe(()=>Promise.resolve().then(()=>m0t),void 0,import.meta.url).then(e=>tt(e.factor))}}),Ce.of({name:"FCL",load(){return Xe(()=>Promise.resolve().then(()=>x0t),void 0,import.meta.url).then(e=>tt(e.fcl))}}),Ce.of({name:"Forth",extensions:["forth","fth","4th"],load(){return Xe(()=>Promise.resolve().then(()=>k0t),void 0,import.meta.url).then(e=>tt(e.forth))}}),Ce.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return Xe(()=>Promise.resolve().then(()=>R0t),void 0,import.meta.url).then(e=>tt(e.fortran))}}),Ce.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return Xe(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(e=>tt(e.fSharp))}}),Ce.of({name:"Gas",extensions:["s"],load(){return Xe(()=>Promise.resolve().then(()=>X0t),void 0,import.meta.url).then(e=>tt(e.gas))}}),Ce.of({name:"Gherkin",extensions:["feature"],load(){return Xe(()=>Promise.resolve().then(()=>D0t),void 0,import.meta.url).then(e=>tt(e.gherkin))}}),Ce.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return Xe(()=>Promise.resolve().then(()=>G0t),void 0,import.meta.url).then(e=>tt(e.groovy))}}),Ce.of({name:"Haskell",extensions:["hs"],load(){return Xe(()=>Promise.resolve().then(()=>J0t),void 0,import.meta.url).then(e=>tt(e.haskell))}}),Ce.of({name:"Haxe",extensions:["hx"],load(){return Xe(()=>Promise.resolve().then(()=>JH),void 0,import.meta.url).then(e=>tt(e.haxe))}}),Ce.of({name:"HXML",extensions:["hxml"],load(){return Xe(()=>Promise.resolve().then(()=>JH),void 0,import.meta.url).then(e=>tt(e.hxml))}}),Ce.of({name:"HTTP",load(){return Xe(()=>Promise.resolve().then(()=>xvt),void 0,import.meta.url).then(e=>tt(e.http))}}),Ce.of({name:"IDL",extensions:["pro"],load(){return Xe(()=>Promise.resolve().then(()=>Cvt),void 0,import.meta.url).then(e=>tt(e.idl))}}),Ce.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return Xe(()=>import("./javascript-qCveANmP.js"),[],import.meta.url).then(e=>tt(e.jsonld))}}),Ce.of({name:"Jinja2",extensions:["j2","jinja","jinja2"],load(){return Xe(()=>Promise.resolve().then(()=>Avt),void 0,import.meta.url).then(e=>tt(e.jinja2))}}),Ce.of({name:"Julia",extensions:["jl"],load(){return Xe(()=>Promise.resolve().then(()=>i1t),void 0,import.meta.url).then(e=>tt(e.julia))}}),Ce.of({name:"Kotlin",extensions:["kt","kts"],load(){return Xe(()=>Promise.resolve().then(()=>mp),void 0,import.meta.url).then(e=>tt(e.kotlin))}}),Ce.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return Xe(()=>Promise.resolve().then(()=>l1t),void 0,import.meta.url).then(e=>tt(e.liveScript))}}),Ce.of({name:"Lua",extensions:["lua"],load(){return Xe(()=>Promise.resolve().then(()=>g1t),void 0,import.meta.url).then(e=>tt(e.lua))}}),Ce.of({name:"mIRC",extensions:["mrc"],load(){return Xe(()=>Promise.resolve().then(()=>M1t),void 0,import.meta.url).then(e=>tt(e.mirc))}}),Ce.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return Xe(()=>Promise.resolve().then(()=>$1t),void 0,import.meta.url).then(e=>tt(e.mathematica))}}),Ce.of({name:"Modelica",extensions:["mo"],load(){return Xe(()=>Promise.resolve().then(()=>B1t),void 0,import.meta.url).then(e=>tt(e.modelica))}}),Ce.of({name:"MUMPS",extensions:["mps"],load(){return Xe(()=>Promise.resolve().then(()=>dbt),void 0,import.meta.url).then(e=>tt(e.mumps))}}),Ce.of({name:"Mbox",extensions:["mbox"],load(){return Xe(()=>Promise.resolve().then(()=>I1t),void 0,import.meta.url).then(e=>tt(e.mbox))}}),Ce.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return Xe(()=>Promise.resolve().then(()=>gbt),void 0,import.meta.url).then(e=>tt(e.nginx))}}),Ce.of({name:"NSIS",extensions:["nsh","nsi"],load(){return Xe(()=>Promise.resolve().then(()=>mbt),void 0,import.meta.url).then(e=>tt(e.nsis))}}),Ce.of({name:"NTriples",extensions:["nt","nq"],load(){return Xe(()=>Promise.resolve().then(()=>vbt),void 0,import.meta.url).then(e=>tt(e.ntriples))}}),Ce.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return Xe(()=>Promise.resolve().then(()=>mp),void 0,import.meta.url).then(e=>tt(e.objectiveC))}}),Ce.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return Xe(()=>Promise.resolve().then(()=>mp),void 0,import.meta.url).then(e=>tt(e.objectiveCpp))}}),Ce.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return Xe(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(e=>tt(e.oCaml))}}),Ce.of({name:"Octave",extensions:["m"],load(){return Xe(()=>Promise.resolve().then(()=>Cbt),void 0,import.meta.url).then(e=>tt(e.octave))}}),Ce.of({name:"Oz",extensions:["oz"],load(){return Xe(()=>Promise.resolve().then(()=>Lbt),void 0,import.meta.url).then(e=>tt(e.oz))}}),Ce.of({name:"Pascal",extensions:["p","pas"],load(){return Xe(()=>Promise.resolve().then(()=>Vbt),void 0,import.meta.url).then(e=>tt(e.pascal))}}),Ce.of({name:"Perl",extensions:["pl","pm"],load(){return Xe(()=>Promise.resolve().then(()=>Ybt),void 0,import.meta.url).then(e=>tt(e.perl))}}),Ce.of({name:"Pig",extensions:["pig"],load(){return Xe(()=>Promise.resolve().then(()=>Hbt),void 0,import.meta.url).then(e=>tt(e.pig))}}),Ce.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return Xe(()=>Promise.resolve().then(()=>fwt),void 0,import.meta.url).then(e=>tt(e.powerShell))}}),Ce.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return Xe(()=>Promise.resolve().then(()=>Owt),void 0,import.meta.url).then(e=>tt(e.properties))}}),Ce.of({name:"ProtoBuf",extensions:["proto"],load(){return Xe(()=>Promise.resolve().then(()=>bwt),void 0,import.meta.url).then(e=>tt(e.protobuf))}}),Ce.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return Xe(()=>import("./pug-DukmZTjD.js"),__vite__mapDeps([7,8]),import.meta.url).then(e=>tt(e.pug))}}),Ce.of({name:"Puppet",extensions:["pp"],load(){return Xe(()=>Promise.resolve().then(()=>xwt),void 0,import.meta.url).then(e=>tt(e.puppet))}}),Ce.of({name:"Q",extensions:["q"],load(){return Xe(()=>Promise.resolve().then(()=>Qwt),void 0,import.meta.url).then(e=>tt(e.q))}}),Ce.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return Xe(()=>Promise.resolve().then(()=>Nwt),void 0,import.meta.url).then(e=>tt(e.r))}}),Ce.of({name:"RPM Changes",load(){return Xe(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>tt(e.rpmChanges))}}),Ce.of({name:"RPM Spec",extensions:["spec"],load(){return Xe(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>tt(e.rpmSpec))}}),Ce.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return Xe(()=>Promise.resolve().then(()=>Gwt),void 0,import.meta.url).then(e=>tt(e.ruby))}}),Ce.of({name:"SAS",extensions:["sas"],load(){return Xe(()=>Promise.resolve().then(()=>Zwt),void 0,import.meta.url).then(e=>tt(e.sas))}}),Ce.of({name:"Scala",extensions:["scala"],load(){return Xe(()=>Promise.resolve().then(()=>mp),void 0,import.meta.url).then(e=>tt(e.scala))}}),Ce.of({name:"Scheme",extensions:["scm","ss"],load(){return Xe(()=>Promise.resolve().then(()=>cyt),void 0,import.meta.url).then(e=>tt(e.scheme))}}),Ce.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return Xe(()=>Promise.resolve().then(()=>fyt),void 0,import.meta.url).then(e=>tt(e.shell))}}),Ce.of({name:"Sieve",extensions:["siv","sieve"],load(){return Xe(()=>Promise.resolve().then(()=>vyt),void 0,import.meta.url).then(e=>tt(e.sieve))}}),Ce.of({name:"Smalltalk",extensions:["st"],load(){return Xe(()=>Promise.resolve().then(()=>yyt),void 0,import.meta.url).then(e=>tt(e.smalltalk))}}),Ce.of({name:"Solr",load(){return Xe(()=>Promise.resolve().then(()=>_yt),void 0,import.meta.url).then(e=>tt(e.solr))}}),Ce.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return Xe(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(e=>tt(e.sml))}}),Ce.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return Xe(()=>Promise.resolve().then(()=>Dyt),void 0,import.meta.url).then(e=>tt(e.sparql))}}),Ce.of({name:"Spreadsheet",alias:["excel","formula"],load(){return Xe(()=>Promise.resolve().then(()=>Iyt),void 0,import.meta.url).then(e=>tt(e.spreadsheet))}}),Ce.of({name:"Squirrel",extensions:["nut"],load(){return Xe(()=>Promise.resolve().then(()=>mp),void 0,import.meta.url).then(e=>tt(e.squirrel))}}),Ce.of({name:"Stylus",extensions:["styl"],load(){return Xe(()=>Promise.resolve().then(()=>ixt),void 0,import.meta.url).then(e=>tt(e.stylus))}}),Ce.of({name:"Swift",extensions:["swift"],load(){return Xe(()=>Promise.resolve().then(()=>$xt),void 0,import.meta.url).then(e=>tt(e.swift))}}),Ce.of({name:"sTeX",load(){return Xe(()=>Promise.resolve().then(()=>WK),void 0,import.meta.url).then(e=>tt(e.stex))}}),Ce.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return Xe(()=>Promise.resolve().then(()=>WK),void 0,import.meta.url).then(e=>tt(e.stex))}}),Ce.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return Xe(()=>Promise.resolve().then(()=>uJ),void 0,import.meta.url).then(e=>tt(e.verilog))}}),Ce.of({name:"Tcl",extensions:["tcl"],load(){return Xe(()=>Promise.resolve().then(()=>_xt),void 0,import.meta.url).then(e=>tt(e.tcl))}}),Ce.of({name:"Textile",extensions:["textile"],load(){return Xe(()=>Promise.resolve().then(()=>Rxt),void 0,import.meta.url).then(e=>tt(e.textile))}}),Ce.of({name:"TiddlyWiki",load(){return Xe(()=>Promise.resolve().then(()=>Jxt),void 0,import.meta.url).then(e=>tt(e.tiddlyWiki))}}),Ce.of({name:"Tiki wiki",load(){return Xe(()=>Promise.resolve().then(()=>aSt),void 0,import.meta.url).then(e=>tt(e.tiki))}}),Ce.of({name:"TOML",extensions:["toml"],load(){return Xe(()=>Promise.resolve().then(()=>oSt),void 0,import.meta.url).then(e=>tt(e.toml))}}),Ce.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return Xe(()=>Promise.resolve().then(()=>uSt),void 0,import.meta.url).then(e=>tt(e.troff))}}),Ce.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return Xe(()=>Promise.resolve().then(()=>_St),void 0,import.meta.url).then(e=>tt(e.ttcn))}}),Ce.of({name:"TTCN_CFG",extensions:["cfg"],load(){return Xe(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>tt(e.ttcnCfg))}}),Ce.of({name:"Turtle",extensions:["ttl"],load(){return Xe(()=>Promise.resolve().then(()=>ESt),void 0,import.meta.url).then(e=>tt(e.turtle))}}),Ce.of({name:"Web IDL",extensions:["webidl"],load(){return Xe(()=>Promise.resolve().then(()=>$$t),void 0,import.meta.url).then(e=>tt(e.webIDL))}}),Ce.of({name:"VB.NET",extensions:["vb"],load(){return Xe(()=>Promise.resolve().then(()=>GSt),void 0,import.meta.url).then(e=>tt(e.vb))}}),Ce.of({name:"VBScript",extensions:["vbs"],load(){return Xe(()=>Promise.resolve().then(()=>YSt),void 0,import.meta.url).then(e=>tt(e.vbScript))}}),Ce.of({name:"Velocity",extensions:["vtl"],load(){return Xe(()=>Promise.resolve().then(()=>HSt),void 0,import.meta.url).then(e=>tt(e.velocity))}}),Ce.of({name:"Verilog",extensions:["v"],load(){return Xe(()=>Promise.resolve().then(()=>uJ),void 0,import.meta.url).then(e=>tt(e.verilog))}}),Ce.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return Xe(()=>Promise.resolve().then(()=>a$t),void 0,import.meta.url).then(e=>tt(e.vhdl))}}),Ce.of({name:"XQuery",extensions:["xy","xquery"],load(){return Xe(()=>Promise.resolve().then(()=>X$t),void 0,import.meta.url).then(e=>tt(e.xQuery))}}),Ce.of({name:"Yacas",extensions:["ys"],load(){return Xe(()=>Promise.resolve().then(()=>W$t),void 0,import.meta.url).then(e=>tt(e.yacas))}}),Ce.of({name:"Z80",extensions:["z80"],load(){return Xe(()=>Promise.resolve().then(()=>B$t),void 0,import.meta.url).then(e=>tt(e.z80))}}),Ce.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return Xe(()=>Promise.resolve().then(()=>W4),void 0,import.meta.url).then(e=>tt(e.mscgen))}}),Ce.of({name:"Xù",extensions:["xu"],load(){return Xe(()=>Promise.resolve().then(()=>W4),void 0,import.meta.url).then(e=>tt(e.xu))}}),Ce.of({name:"MsGenny",extensions:["msgenny"],load(){return Xe(()=>Promise.resolve().then(()=>W4),void 0,import.meta.url).then(e=>tt(e.msgenny))}}),Ce.of({name:"Vue",extensions:["vue"],load(){return Xe(()=>Promise.resolve().then(()=>sft),void 0,import.meta.url).then(e=>e.vue())}}),Ce.of({name:"Angular Template",load(){return Xe(()=>Promise.resolve().then(()=>$ft),void 0,import.meta.url).then(e=>e.angular())}})];class g9{constructor(t,n,r,i){this.state=t,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let n=kr(this.state).resolveInner(this.pos,-1);for(;n&&t.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(t){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),s=i.search(ope(t,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(t,n,r){t=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function zY(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function Det(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let s=1;s<i.length;s++)n[i[s]]=!0}let r=zY(t)+zY(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function DS(e){let t=e.map(i=>typeof i=="string"?{label:i}:i),[n,r]=t.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Det(t);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:t,validFor:n}:null}}function PQ(e,t){return n=>{for(let r=kr(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(e.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return t(n)}}class LY{constructor(t,n,r,i){this.completion=t,this.source=n,this.match=r,this.score=i}}function Gp(e){return e.selection.main.from}function ope(e,t){var n;let{source:r}=e,i=t&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?e:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}const m9=_d.define();function Iet(e,t,n,r){let{main:i}=e.selection,s=n-i.from,a=r-i.from;return Object.assign(Object.assign({},e.changeByRange(o=>{if(o!=i&&n!=r&&e.sliceDoc(o.from+s,o.from+a)!=e.sliceDoc(n,r))return{range:o};let l=e.toText(t);return{changes:{from:o.from+s,to:r==i.from?o.to:o.from+a,insert:l},range:Ve.cursor(o.from+s+l.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}const qY=new WeakMap;function Net(e){if(!Array.isArray(e))return e;let t=qY.get(e);return t||qY.set(e,t=DS(e)),t}const HP=Xn.define(),wx=Xn.define();class Fet{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<t.length;){let r=Xo(t,n),i=ju(r);this.chars.push(r);let s=t.slice(n,n+i),a=s.toUpperCase();this.folded.push(Xo(a==s?s.toLowerCase():a,0)),n+=i}this.astral=t.length!=this.chars.length}ret(t,n){return this.score=t,this.matched=n,this}match(t){if(this.pattern.length==0)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:s,byWord:a}=this;if(n.length==1){let b=Xo(t,0),y=ju(b),T=y==t.length?0:-100;if(b!=n[0])if(b==r[0])T+=-200;else return null;return this.ret(T,[0,y])}let o=t.indexOf(this.pattern);if(o==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(o<0){for(let b=0,y=Math.min(t.length,200);b<y&&c<l;){let T=Xo(t,b);(T==n[c]||T==r[c])&&(i[c++]=b),b+=ju(T)}if(c<l)return null}let u=0,d=0,h=!1,f=0,p=-1,g=-1,m=/[a-z]/.test(t),v=!0;for(let b=0,y=Math.min(t.length,200),T=0;b<y&&d<l;){let x=Xo(t,b);o<0&&(u<l&&x==n[u]&&(s[u++]=b),f<l&&(x==n[f]||x==r[f]?(f==0&&(p=b),g=b+1,f++):f=0));let S,k=x<255?x>=48&&x<=57||x>=97&&x<=122?2:x>=65&&x<=90?1:0:(S=V7(x))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(!b||k==1&&m||T==0&&k!=0)&&(n[d]==x||r[d]==x&&(h=!0)?a[d++]=b:a.length&&(v=!1)),T=k,b+=ju(x)}return d==l&&a[0]==0&&v?this.result(-100+(h?-200:0),a,t):f==l&&p==0?this.ret(-200-t.length+(g==t.length?0:-100),[0,g]):o>-1?this.ret(-700-t.length,[o,o+this.pattern.length]):f==l?this.ret(-900-t.length,[p,g]):d==l?this.result(-100+(h?-200:0)+-700+(v?0:-1100),a,t):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,t)}result(t,n,r){let i=[],s=0;for(let a of n){let o=a+(this.astral?ju(Xo(r,a)):1);s&&i[s-1]==a?i[s-1]=o:(i[s++]=a,i[s++]=o)}return this.ret(t-r.length,i)}}class Met{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length<this.pattern.length)return null;let n=t.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(t.length==this.pattern.length?0:-100),this)}}const Zs=Ut.define({combine(e){return Cd(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:zet,filterStrict:!1,compareCompletions:(t,n)=>t.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,n)=>t&&n,closeOnBlur:(t,n)=>t&&n,icons:(t,n)=>t&&n,tooltipClass:(t,n)=>r=>UY(t(r),n(r)),optionClass:(t,n)=>r=>UY(t(r),n(r)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function UY(e,t){return e?t?e+" "+t:e:t}function zet(e,t,n,r,i,s){let a=e.textDirection==wi.RTL,o=a,l=!1,c="top",u,d,h=t.left-i.left,f=i.right-t.right,p=r.right-r.left,g=r.bottom-r.top;if(o&&h<Math.min(p,f)?o=!1:!o&&f<Math.min(p,h)&&(o=!0),p<=(o?h:f))u=Math.max(i.top,Math.min(n.top,i.bottom-g))-t.top,d=Math.min(400,o?h:f);else{l=!0,d=Math.min(400,(a?t.right:i.right-t.left)-30);let b=i.bottom-t.bottom;b>=g||b>t.top?u=n.bottom-t.top:(c="bottom",u=t.bottom-n.top)}let m=(t.bottom-t.top)/s.offsetHeight,v=(t.right-t.left)/s.offsetWidth;return{style:`${c}: ${u/m}px; max-width: ${d/v}px`,class:"cm-completionInfo-"+(l?a?"left-narrow":"right-narrow":o?"left":"right")}}function Let(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),t.push({render(n,r,i,s){let a=document.createElement("span");a.className="cm-completionLabel";let o=n.displayLabel||n.label,l=0;for(let c=0;c<s.length;){let u=s[c++],d=s[c++];u>l&&a.appendChild(document.createTextNode(o.slice(l,u)));let h=a.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(o.slice(u,d))),h.className="cm-completionMatchedText",l=d}return l<o.length&&a.appendChild(document.createTextNode(o.slice(l))),a},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),t.sort((n,r)=>n.position-r.position).map(n=>n.render)}function MR(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let i=Math.floor(t/n);return{from:i*n,to:(i+1)*n}}let r=Math.floor((e-t)/n);return{from:e-(r+1)*n,to:e-r*n}}class qet{constructor(t,n,r){this.view=t,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=t.state.field(n),{options:s,selected:a}=i.open,o=t.state.facet(Zs);this.optionContent=Let(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=MR(s.length,a,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=t.state.field(n).open;for(let u=l.target,d;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(d=/-(\d+)$/.exec(u.id))&&+d[1]<c.length){this.applyCompletion(t,c[+d[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=t.state.field(this.stateField,!1);c&&c.tooltip&&t.state.facet(Zs).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:wx.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(t,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var n;let r=t.state.field(this.stateField),i=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),r!=i){let{options:s,selected:a,disabled:o}=r.open;(!i.open||i.open.options!=s)&&(this.range=MR(s.length,a,t.state.facet(Zs).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),o!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(t){let n=this.tooltipClass(t);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),n=t.open;if((n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=MR(n.options.length,n.selected,this.view.state.facet(Zs).maxRenderedOptions),this.showOptions(n.options,t.id)),this.updateSelectedOption(n.selected)){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let s=typeof i=="string"?document.createTextNode(i):i(r);if(!s)return;"then"in s?s.then(a=>{a&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(a,r)}).catch(a=>Lo(this.view.state,a,"completion info")):this.addInfoPane(s,r)}}addInfoPane(t,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",t.nodeType!=null)r.appendChild(t),this.infoDestroy=null;else{let{dom:i,destroy:s}=t;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==t?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return n&&Wet(this.list,n),n}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=t.getBoundingClientRect(),s=this.space;if(!s){let a=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return i.top>Math.min(s.bottom,n.bottom)-10||i.bottom<Math.max(s.top,n.top)+10?null:this.view.state.facet(Zs).positionInfo(this.view,n,i,r,s,this.dom)}placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(t,n,r){const i=document.createElement("ul");i.id=n,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",a=>{a.target==i&&a.preventDefault()});let s=null;for(let a=r.from;a<r.to;a++){let{completion:o,match:l}=t[a],{section:c}=o;if(c){let h=typeof c=="string"?c:c.name;if(h!=s&&(a>r.from||r.from==0))if(s=h,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let f=i.appendChild(document.createElement("completion-section"));f.textContent=h}}const u=i.appendChild(document.createElement("li"));u.id=n+"-"+a,u.setAttribute("role","option");let d=this.optionClass(o);d&&(u.className=d);for(let h of this.optionContent){let f=h(o,this.view.state,this.view,l);f&&u.appendChild(f)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<t.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function Uet(e,t){return n=>new qet(n,e,t)}function Wet(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function WY(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function jet(e,t){let n=[],r=null,i=c=>{n.push(c);let{section:u}=c.completion;if(u){r||(r=[]);let d=typeof u=="string"?u:u.name;r.some(h=>h.name==d)||r.push(typeof u=="string"?{name:d}:u)}},s=t.facet(Zs);for(let c of e)if(c.hasResult()){let u=c.result.getMatch;if(c.result.filter===!1)for(let d of c.result.options)i(new LY(d,c.source,u?u(d):[],1e9-n.length));else{let d=t.sliceDoc(c.from,c.to),h,f=s.filterStrict?new Met(d):new Fet(d);for(let p of c.result.options)if(h=f.match(p.label)){let g=p.displayLabel?u?u(p,h.matched):[]:h.matched;i(new LY(p,c.source,g,h.score+(p.boost||0)))}}}if(r){let c=Object.create(null),u=0,d=(h,f)=>{var p,g;return((p=h.rank)!==null&&p!==void 0?p:1e9)-((g=f.rank)!==null&&g!==void 0?g:1e9)||(h.name<f.name?-1:1)};for(let h of r.sort(d))u-=1e5,c[h.name]=u;for(let h of n){let{section:f}=h.completion;f&&(h.score+=c[typeof f=="string"?f:f.name])}}let a=[],o=null,l=s.compareCompletions;for(let c of n.sort((u,d)=>d.score-u.score||l(u.completion,d.completion))){let u=c.completion;!o||o.label!=u.label||o.detail!=u.detail||o.type!=null&&u.type!=null&&o.type!=u.type||o.apply!=u.apply||o.boost!=u.boost?a.push(c):WY(c.completion)>WY(o)&&(a[a.length-1]=c),o=c.completion}return a}class T0{constructor(t,n,r,i,s,a){this.options=t,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new T0(this.options,jY(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,s,a){if(i&&!a&&t.some(c=>c.isPending))return i.setDisabled();let o=jet(t,n);if(!o.length)return i&&t.some(c=>c.isPending)?i.setDisabled():null;let l=n.facet(Zs).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let c=i.options[i.selected].completion;for(let u=0;u<o.length;u++)if(o[u].completion==c){l=u;break}}return new T0(o,jY(r,l),{pos:t.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:Het,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(t){return new T0(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new T0(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class KP{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new KP(Bet,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(Zs),s=(r.override||n.languageDataAt("autocomplete",Gp(n)).map(Net)).map(l=>(this.active.find(u=>u.source==l)||new sc(l,this.active.some(u=>u.state!=0)?1:0)).update(t,r));s.length==this.active.length&&s.every((l,c)=>l==this.active[c])&&(s=this.active);let a=this.open,o=t.effects.some(l=>l.is(v9));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||s.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!Get(s,this.active)||o?a=T0.build(s,n,this.id,a,r,o):a&&a.disabled&&!s.some(l=>l.isPending)&&(a=null),!a&&s.every(l=>!l.isPending)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new sc(l.source,0):l));for(let l of t.effects)l.is(cpe)&&(a=a&&a.setSelected(l.value,this.id));return s==this.active&&a==this.open?this:new KP(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Vet:Yet}}function Get(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,s=r==t.length;if(i||s)return i==s;if(e[n++].result!=t[r++].result)return!1}}const Vet={"aria-autocomplete":"list"},Yet={};function jY(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const Bet=[];function lpe(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(m9);if(r&&t.activateOnCompletion(r))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class sc{constructor(t,n,r=!1){this.source=t,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=lpe(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new sc(i.source,0)),r&4&&i.state==0&&(i=new sc(this.source,1)),i=i.updateFor(t,r);for(let s of t.effects)if(s.is(HP))i=new sc(i.source,1,s.value);else if(s.is(wx))i=new sc(i.source,0);else if(s.is(v9))for(let a of s.value)a.source==i.source&&(i=a);return i}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(Gp(t.state))}}class V0 extends sc{constructor(t,n,r,i,s,a){super(t,3,n),this.limit=r,this.result=i,this.from=s,this.to=a}hasResult(){return!0}updateFor(t,n){var r;if(!(n&3))return this.map(t.changes);let i=this.result;i.map&&!t.changes.empty&&(i=i.map(i,t.changes));let s=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=Gp(t.state);if(o>a||!i||n&2&&(Gp(t.startState)==this.from||o<this.limit))return new sc(this.source,n&4?1:0);let l=t.changes.mapPos(this.limit);return Zet(i.validFor,t.state,s,a)?new V0(this.source,this.explicit,l,i,s,a):i.update&&(i=i.update(i,s,a,new g9(t.state,o,!1)))?new V0(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:Gp(t.state)):new sc(this.source,1,this.explicit)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new V0(this.source,this.explicit,t.mapPos(this.limit),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new sc(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function Zet(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e=="function"?e(i,n,r,t):ope(e,!0).test(i)}const v9=Xn.define({map(e,t){return e.map(n=>n.map(t))}}),cpe=Xn.define(),Io=na.define({create(){return KP.start()},update(e,t){return e.update(t)},provide:e=>[l9.from(e,t=>t.tooltip),St.contentAttributes.from(e,t=>t.attrs)]});function b9(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(Io).active.find(i=>i.source==t.source);return r instanceof V0?(typeof n=="string"?e.dispatch(Object.assign(Object.assign({},Iet(e.state,n,r.from,r.to)),{annotations:m9.of(t.completion)})):n(e,t.completion,r.from,r.to),!0):!1}const Het=Uet(Io,b9);function fk(e,t="option"){return n=>{let r=n.state.field(Io,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Zs).interactionDelay)return!1;let i=1,s;t=="page"&&(s=XOe(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:a}=r.open.options,o=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:a-1;return o<0?o=t=="page"?0:a-1:o>=a&&(o=t=="page"?a-1:0),n.dispatch({effects:cpe.of(o)}),!0}}const Ket=e=>{let t=e.state.field(Io,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Zs).interactionDelay?!1:b9(e,t.open.options[t.open.selected])},GY=e=>e.state.field(Io,!1)?(e.dispatch({effects:HP.of(!0)}),!0):!1,Jet=e=>{let t=e.state.field(Io,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:wx.of(null)}),!0)};class ett{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const ttt=50,ntt=1e3,rtt=Ui.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(Io).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Io),n=e.state.facet(Zs);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Io)==t)return;let r=e.transactions.some(s=>{let a=lpe(s,n);return a&8||(s.selection||s.docChanged)&&!(a&3)});for(let s=0;s<this.running.length;s++){let a=this.running[s];if(r||a.context.abortOnDocChange&&e.docChanged||a.updates.length+e.transactions.length>ttt&&Date.now()-a.time>ntt){for(let o of a.context.abortListeners)try{o()}catch(l){Lo(this.view.state,l)}a.context.abortListeners=null,this.running.splice(s--,1)}else a.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(s=>s.effects.some(a=>a.is(HP)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(s=>s.isPending&&!this.running.some(a=>a.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of e.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Io);for(let n of t.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Zs).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Gp(t),r=new g9(t,n,e.explicit,this.view),i=new ett(e,r);this.running.push(i),Promise.resolve(e.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:wx.of(null)}),Lo(this.view.state,s)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Zs).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Zs),r=this.view.state.field(Io);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(s.done===void 0)continue;if(this.running.splice(i--,1),s.done){let o=Gp(s.updates.length?s.updates[0].startState:this.view.state),l=Math.min(o,s.done.from+(s.active.explicit?0:1)),c=new V0(s.active.source,s.active.explicit,l,s.done,s.done.from,(e=s.done.to)!==null&&e!==void 0?e:o);for(let u of s.updates)c=c.update(u,n);if(c.hasResult()){t.push(c);continue}}let a=r.active.find(o=>o.source==s.active.source);if(a&&a.isPending)if(s.done==null){let o=new sc(s.active.source,0);for(let l of s.updates)o=o.update(l,n);o.isPending||t.push(o)}else this.startQuery(a)}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:v9.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Io,!1);if(t&&t.tooltip&&this.view.state.facet(Zs).closeOnBlur){let n=t.open&&XOe(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:wx.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:HP.of(!1)}),20),this.composing=0}}}),itt=typeof navigator=="object"&&/Win/.test(navigator.platform),stt=Kh.highest(St.domEventHandlers({keydown(e,t){let n=t.state.field(Io,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(itt&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(a=>a.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&b9(t,r),!1}})),upe=St.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class att{constructor(t,n,r,i){this.field=t,this.line=n,this.from=r,this.to=i}}class w9{constructor(t,n,r){this.field=t,this.from=n,this.to=r}map(t){let n=t.mapPos(this.from,-1,Oa.TrackDel),r=t.mapPos(this.to,1,Oa.TrackDel);return n==null||r==null?null:new w9(this.field,n,r)}}class y9{constructor(t,n){this.lines=t,this.fieldPositions=n}instantiate(t,n){let r=[],i=[n],s=t.doc.lineAt(n),a=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(r.length){let c=a,u=/^\t*/.exec(l)[0].length;for(let d=0;d<u;d++)c+=t.facet(T1);i.push(n+c.length-u),l=c+l.slice(u)}r.push(l),n+=l.length+1}let o=this.fieldPositions.map(l=>new w9(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:r,ranges:o}}static parse(t){let n=[],r=[],i=[],s;for(let a of t.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(a);){let o=s[1]?+s[1]:null,l=s[2]||s[3]||"",c=-1,u=l.replace(/\\[{}]/g,d=>d[1]);for(let d=0;d<n.length;d++)(o!=null?n[d].seq==o:u&&n[d].name==u)&&(c=d);if(c<0){let d=0;for(;d<n.length&&(o==null||n[d].seq!=null&&n[d].seq<o);)d++;n.splice(d,0,{seq:o,name:u}),c=d;for(let h of i)h.field>=c&&h.field++}i.push(new att(c,r.length,s.index,s.index+u.length)),a=a.slice(0,s.index)+l+a.slice(s.index+s[0].length)}a=a.replace(/\\([{}])/g,(o,l,c)=>{for(let u of i)u.line==r.length&&u.from>c&&(u.from--,u.to--);return l}),r.push(a)}return new y9(r,i)}}let ott=qt.widget({widget:new class extends hu{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),ltt=qt.mark({class:"cm-snippetField"});class _1{constructor(t,n){this.ranges=t,this.active=n,this.deco=qt.set(t.map(r=>(r.from==r.to?ott:ltt).range(r.from,r.to)))}map(t){let n=[];for(let r of this.ranges){let i=r.map(t);if(!i)return null;n.push(i)}return new _1(n,this.active)}selectionInsideField(t){return t.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const IS=Xn.define({map(e,t){return e&&e.map(t)}}),ctt=Xn.define(),yx=na.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(IS))return n.value;if(n.is(ctt)&&e)return new _1(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>St.decorations.from(e,t=>t?t.deco:qt.none)});function x9(e,t){return Ve.create(e.filter(n=>n.field==t).map(n=>Ve.range(n.from,n.to)))}function utt(e){let t=y9.parse(e);return(n,r,i,s)=>{let{text:a,ranges:o}=t.instantiate(n.state,i),{main:l}=n.state.selection,c={changes:{from:i,to:s==l.from?l.to:s,insert:Cr.of(a)},scrollIntoView:!0,annotations:r?[m9.of(r),Ps.userEvent.of("input.complete")]:void 0};if(o.length&&(c.selection=x9(o,0)),o.some(u=>u.field>0)){let u=new _1(o,0),d=c.effects=[IS.of(u)];n.state.field(yx,!1)===void 0&&d.push(Xn.appendConfig.of([yx,ptt,gtt,upe]))}n.dispatch(n.state.update(c))}}function dpe(e){return({state:t,dispatch:n})=>{let r=t.field(yx,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,s=e>0&&!r.ranges.some(a=>a.field==i+e);return n(t.update({selection:x9(r.ranges,i),effects:IS.of(s?null:new _1(r.ranges,i)),scrollIntoView:!0})),!0}}const dtt=({state:e,dispatch:t})=>e.field(yx,!1)?(t(e.update({effects:IS.of(null)})),!0):!1,htt=dpe(1),ftt=dpe(-1),Ott=[{key:"Tab",run:htt,shift:ftt},{key:"Escape",run:dtt}],VY=Ut.define({combine(e){return e.length?e[0]:Ott}}),ptt=Kh.highest(im.compute([VY],e=>e.facet(VY)));function gi(e,t){return Object.assign(Object.assign({},t),{apply:utt(e)})}const gtt=St.domEventHandlers({mousedown(e,t){let n=t.state.field(yx,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(s=>s.from<=r&&s.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:x9(n.ranges,i.field),effects:IS.of(n.ranges.some(s=>s.field>i.field)?new _1(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),xx={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Fp=Xn.define({map(e,t){let n=t.mapPos(e,-1,Oa.TrackAfter);return n??void 0}}),S9=new class extends Sg{};S9.startSide=1;S9.endSide=-1;const hpe=na.define({create(){return wr.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of t.effects)n.is(Fp)&&(e=e.update({add:[S9.range(n.value,n.value+1)]}));return e}});function mtt(){return[btt,hpe]}const zR="()[]{}<>«»»«[]{}";function fpe(e){for(let t=0;t<zR.length;t+=2)if(zR.charCodeAt(t)==e)return zR.charAt(t+1);return V7(e<128?e:e+1)}function Ope(e,t){return e.languageDataAt("closeBrackets",t)[0]||xx}const vtt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),btt=St.inputHandler.of((e,t,n,r)=>{if((vtt?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&ju(Xo(r,0))==1||t!=i.from||n!=i.to)return!1;let s=xtt(e.state,r);return s?(e.dispatch(s),!0):!1}),wtt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Ope(e,e.selection.main.head).brackets||xx.brackets,i=null,s=e.changeByRange(a=>{if(a.empty){let o=Stt(e.doc,a.head);for(let l of r)if(l==o&&_Q(e.doc,a.head)==fpe(Xo(l,0)))return{changes:{from:a.head-l.length,to:a.head+l.length},range:Ve.cursor(a.head-l.length)}}return{range:i=a}});return i||t(e.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},ytt=[{key:"Backspace",run:wtt}];function xtt(e,t){let n=Ope(e,e.selection.main.head),r=n.brackets||xx.brackets;for(let i of r){let s=fpe(Xo(i,0));if(t==i)return s==i?Ttt(e,i,r.indexOf(i+i+i)>-1,n):$tt(e,i,s,n.before||xx.before);if(t==s&&ppe(e,e.selection.main.from))return ktt(e,i,s)}return null}function ppe(e,t){let n=!1;return e.field(hpe).between(0,e.doc.length,r=>{r==t&&(n=!0)}),n}function _Q(e,t){let n=e.sliceString(t,t+2);return n.slice(0,ju(Xo(n,0)))}function Stt(e,t){let n=e.sliceString(t-2,t);return ju(Xo(n,0))==n.length?n:n.slice(1)}function $tt(e,t,n,r){let i=null,s=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:Fp.of(a.to+t.length),range:Ve.range(a.anchor+t.length,a.head+t.length)};let o=_Q(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:Fp.of(a.head+t.length),range:Ve.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function ktt(e,t,n){let r=null,i=e.changeByRange(s=>s.empty&&_Q(e.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:Ve.cursor(s.head+n.length)}:r={range:s});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Ttt(e,t,n,r){let i=r.stringPrefixes||xx.stringPrefixes,s=null,a=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:t,from:o.to}],effects:Fp.of(o.to+t.length),range:Ve.range(o.anchor+t.length,o.head+t.length)};let l=o.head,c=_Q(e.doc,l),u;if(c==t){if(YY(e,l))return{changes:{insert:t+t,from:l},effects:Fp.of(l+t.length),range:Ve.cursor(l+t.length)};if(ppe(e,l)){let h=n&&e.sliceDoc(l,l+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:l,to:l+h.length,insert:h},range:Ve.cursor(l+h.length)}}}else{if(n&&e.sliceDoc(l-2*t.length,l)==t+t&&(u=BY(e,l-2*t.length,i))>-1&&YY(e,u))return{changes:{insert:t+t+t+t,from:l},effects:Fp.of(l+t.length),range:Ve.cursor(l+t.length)};if(e.charCategorizer(l)(c)!=Qi.Word&&BY(e,l,i)>-1&&!Ptt(e,l,t,i))return{changes:{insert:t+t,from:l},effects:Fp.of(l+t.length),range:Ve.cursor(l+t.length)}}return{range:s=o}});return s?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function YY(e,t){let n=kr(e).resolveInner(t+1);return n.parent&&n.from==t}function Ptt(e,t,n,r){let i=kr(e).resolveInner(t,-1),s=r.reduce((a,o)=>Math.max(a,o.length),0);for(let a=0;a<5;a++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),l=o.indexOf(n);if(!l||l>-1&&r.indexOf(o.slice(0,l))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>n.length+l;){if(e.sliceDoc(u.to-n.length,u.to)==n)return!1;u=u.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function BY(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=Qi.Word)return t;for(let i of n){let s=t-i.length;if(e.sliceDoc(s,t)==i&&r(e.sliceDoc(s-1,s))!=Qi.Word)return s}return-1}function _tt(e={}){return[stt,Io,Zs.of(e),rtt,Ctt,upe]}const gpe=[{key:"Ctrl-Space",run:GY},{mac:"Alt-`",run:GY},{key:"Escape",run:Jet},{key:"ArrowDown",run:fk(!0)},{key:"ArrowUp",run:fk(!1)},{key:"PageDown",run:fk(!0,"page")},{key:"PageUp",run:fk(!1,"page")},{key:"Enter",run:Ket}],Ctt=Kh.highest(im.computeN([Zs],e=>e.facet(Zs).defaultKeymap?[gpe]:[]));class JP{static create(t,n,r,i,s){let a=i+(i<<8)+t+(n<<4)|0;return new JP(t,n,r,a,s,[],[])}constructor(t,n,r,i,s,a,o){this.type=t,this.value=n,this.from=r,this.hash=i,this.end=s,this.children=a,this.positions=o,this.hashProp=[[En.contextHash,i]]}addChild(t,n){t.prop(En.contextHash)!=this.hash&&(t=new ur(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(n)}toTree(t,n=this.end){let r=this.children.length-1;return r>=0&&(n=Math.max(n,this.positions[r]+this.children[r].length+this.from)),new ur(t.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:(i,s,a)=>new ur(_s.none,i,s,a,this.hashProp)})}}var wt;(function(e){e[e.Document=1]="Document",e[e.CodeBlock=2]="CodeBlock",e[e.FencedCode=3]="FencedCode",e[e.Blockquote=4]="Blockquote",e[e.HorizontalRule=5]="HorizontalRule",e[e.BulletList=6]="BulletList",e[e.OrderedList=7]="OrderedList",e[e.ListItem=8]="ListItem",e[e.ATXHeading1=9]="ATXHeading1",e[e.ATXHeading2=10]="ATXHeading2",e[e.ATXHeading3=11]="ATXHeading3",e[e.ATXHeading4=12]="ATXHeading4",e[e.ATXHeading5=13]="ATXHeading5",e[e.ATXHeading6=14]="ATXHeading6",e[e.SetextHeading1=15]="SetextHeading1",e[e.SetextHeading2=16]="SetextHeading2",e[e.HTMLBlock=17]="HTMLBlock",e[e.LinkReference=18]="LinkReference",e[e.Paragraph=19]="Paragraph",e[e.CommentBlock=20]="CommentBlock",e[e.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",e[e.Escape=22]="Escape",e[e.Entity=23]="Entity",e[e.HardBreak=24]="HardBreak",e[e.Emphasis=25]="Emphasis",e[e.StrongEmphasis=26]="StrongEmphasis",e[e.Link=27]="Link",e[e.Image=28]="Image",e[e.InlineCode=29]="InlineCode",e[e.HTMLTag=30]="HTMLTag",e[e.Comment=31]="Comment",e[e.ProcessingInstruction=32]="ProcessingInstruction",e[e.Autolink=33]="Autolink",e[e.HeaderMark=34]="HeaderMark",e[e.QuoteMark=35]="QuoteMark",e[e.ListMark=36]="ListMark",e[e.LinkMark=37]="LinkMark",e[e.EmphasisMark=38]="EmphasisMark",e[e.CodeMark=39]="CodeMark",e[e.CodeText=40]="CodeText",e[e.CodeInfo=41]="CodeInfo",e[e.LinkTitle=42]="LinkTitle",e[e.LinkLabel=43]="LinkLabel",e[e.URL=44]="URL"})(wt||(wt={}));class Qtt{constructor(t,n){this.start=t,this.content=n,this.marks=[],this.parsers=[]}}class Ett{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return Fw(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,n=0,r=0){for(let i=n;i<t;i++)r+=this.text.charCodeAt(i)==9?4-r%4:1;return r}findColumn(t){let n=0;for(let r=0;n<this.text.length&&r<t;n++)r+=this.text.charCodeAt(n)==9?4-r%4:1;return n}scrub(){if(!this.baseIndent)return this.text;let t="";for(let n=0;n<this.basePos;n++)t+=" ";return t+this.text.slice(this.basePos)}}function ZY(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==wt.OrderedList?T9:k9)(n,t,!1);return r>0&&(e.type!=wt.BulletList||$9(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}const mpe={[wt.Blockquote](e,t,n){return n.next!=62?!1:(n.markers.push(fr(wt.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(kc(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0)},[wt.ListItem](e,t,n){return n.indent<n.baseIndent+e.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[wt.OrderedList]:ZY,[wt.BulletList]:ZY,[wt.Document](){return!0}};function kc(e){return e==32||e==9||e==10||e==13}function Fw(e,t=0){for(;t<e.length&&kc(e.charCodeAt(t));)t++;return t}function HY(e,t,n){for(;t>n&&kc(e.charCodeAt(t-1));)t--;return t}function vpe(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(e.next==96){for(let n=t;n<e.text.length;n++)if(e.text.charCodeAt(n)==96)return-1}return t}function bpe(e){return e.next!=62?-1:e.text.charCodeAt(e.pos+1)==32?2:1}function $9(e,t,n){if(e.next!=42&&e.next!=45&&e.next!=95)return-1;let r=1;for(let i=e.pos+1;i<e.text.length;i++){let s=e.text.charCodeAt(i);if(s==e.next)r++;else if(!kc(s))return-1}return n&&e.next==45&&xpe(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(Tpe.SetextHeading)>-1||r<3?-1:1}function wpe(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function k9(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||kc(e.text.charCodeAt(e.pos+1)))&&(!n||wpe(t,wt.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function T9(e,t,n){let r=e.pos,i=e.next;for(;i>=48&&i<=57;){r++;if(r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||r<e.text.length-1&&!kc(e.text.charCodeAt(r+1))||n&&!wpe(t,wt.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function ype(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==35;)t++;if(t<e.text.length&&e.text.charCodeAt(t)!=32)return-1;let n=t-e.pos;return n>6?-1:n}function xpe(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&kc(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}const cI=/^[ \t]*$/,Spe=/-->/,$pe=/\?>/,uI=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,Spe],[/^\s*<\?/,$pe],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?: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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,cI],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,cI]];function kpe(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let i=0,s=uI.length-(n?1:0);i<s;i++)if(uI[i][0].test(r))return i;return-1}function KY(e,t){let n=e.countIndent(t,e.pos,e.indent),r=e.countIndent(e.skipSpace(t),t,n);return r>=n+5?n+1:r}function Op(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==wt.CodeText?e[r].to=n:e.push(fr(wt.CodeText,t,n))}const Ok={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let r=t.findColumn(n),i=e.lineStart+r,s=e.lineStart+t.text.length,a=[],o=[];for(Op(a,i,s);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){Op(o,e.lineStart-1,e.lineStart);for(let l of t.markers)o.push(l)}else{if(t.indent<n)break;{if(o.length){for(let c of o)c.type==wt.CodeText?Op(a,c.from,c.to):a.push(c);o=[]}Op(a,e.lineStart-1,e.lineStart);for(let c of t.markers)a.push(c);s=e.lineStart+t.text.length;let l=e.lineStart+t.findColumn(t.baseIndent+4);l<s&&Op(a,l,s)}}return o.length&&(o=o.filter(l=>l.type!=wt.CodeText),o.length&&(t.markers=o.concat(t.markers))),e.addNode(e.buffer.writeElements(a,-i).finish(wt.CodeBlock,s-i),i),!0},FencedCode(e,t){let n=vpe(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,s=n-t.pos,a=t.skipSpace(n),o=HY(t.text,t.text.length,a),l=[fr(wt.CodeMark,r,r+s)];a<o&&l.push(fr(wt.CodeInfo,e.lineStart+a,e.lineStart+o));for(let c=!0;e.nextLine()&&t.depth>=e.stack.length;c=!1){let u=t.pos;if(t.indent-t.baseIndent<4)for(;u<t.text.length&&t.text.charCodeAt(u)==i;)u++;if(u-t.pos>=s&&t.skipSpace(u)==t.text.length){for(let d of t.markers)l.push(d);l.push(fr(wt.CodeMark,e.lineStart+t.pos,e.lineStart+u)),e.nextLine();break}else{c||Op(l,e.lineStart-1,e.lineStart);for(let f of t.markers)l.push(f);let d=e.lineStart+t.basePos,h=e.lineStart+t.text.length;d<h&&Op(l,d,h)}}return e.addNode(e.buffer.writeElements(l,-r).finish(wt.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=bpe(t);return n<0?!1:(e.startContext(wt.Blockquote,t.pos),e.addNode(wt.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if($9(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(wt.HorizontalRule,n),!0},BulletList(e,t){let n=k9(t,e,!1);if(n<0)return!1;e.block.type!=wt.BulletList&&e.startContext(wt.BulletList,t.basePos,t.next);let r=KY(t,t.pos+1);return e.startContext(wt.ListItem,t.basePos,r-t.baseIndent),e.addNode(wt.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},OrderedList(e,t){let n=T9(t,e,!1);if(n<0)return!1;e.block.type!=wt.OrderedList&&e.startContext(wt.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=KY(t,t.pos+n);return e.startContext(wt.ListItem,t.basePos,r-t.baseIndent),e.addNode(wt.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},ATXHeading(e,t){let n=ype(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,s=HY(t.text,t.text.length,r),a=s;for(;a>r&&t.text.charCodeAt(a-1)==t.next;)a--;(a==s||a==r||!kc(t.text.charCodeAt(a-1)))&&(a=t.text.length);let o=e.buffer.write(wt.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,a),i+n+1),-i);a<t.text.length&&o.write(wt.HeaderMark,a-r,s-r);let l=o.finish(wt.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(l,i),!0},HTMLBlock(e,t){let n=kpe(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=uI[n][1],s=[],a=i!=cI;for(;!i.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){a=!1;break}for(let c of t.markers)s.push(c)}a&&e.nextLine();let o=i==Spe?wt.CommentBlock:i==$pe?wt.ProcessingInstructionBlock:wt.HTMLBlock,l=e.prevLineEnd();return e.addNode(e.buffer.writeElements(s,-r).finish(o,l-r),r),!0},SetextHeading:void 0};class Rtt{constructor(t){this.stage=0,this.elts=[],this.pos=0,this.start=t.start,this.advance(t.content)}nextLine(t,n,r){if(this.stage==-1)return!1;let i=r.content+`
|
|
1087
|
+
`);r>-1&&(n=n.slice(0,r))}return t+n.length<=this.to?n:n.slice(0,this.to-t)}nextLine(){let t=this.parsedPos,n=this.lineAfter(t),r=t+n.length;for(let i=this.rangeIndex;;){let s=this.ranges[i].to;if(s>=r||(n=n.slice(0,s-(r-n.length)),i++,i==this.ranges.length))break;let a=this.ranges[i].from,o=this.lineAfter(a);n+=o,r=a+o.length}return{line:n,end:r}}skipGapsTo(t,n,r){for(;;){let i=this.ranges[this.rangeIndex].to,s=t+n;if(r>0?i>s:i>=s)break;let a=this.ranges[++this.rangeIndex].from;n+=a-i}return n}moveRangeIndex(){for(;this.ranges[this.rangeIndex].to<this.parsedPos;)this.rangeIndex++}emitToken(t,n,r,i){let s=4;if(this.ranges.length>1){i=this.skipGapsTo(n,i,1),n+=i;let o=this.chunk.length;i=this.skipGapsTo(r,i,-1),r+=i,s+=this.chunk.length-o}let a=this.chunk.length-4;return this.lang.streamParser.mergeTokens&&s==4&&a>=0&&this.chunk[a]==t&&this.chunk[a+2]==n?this.chunk[a+2]=r:this.chunk.push(t,n,r,s),i}parseLine(t){let{line:n,end:r}=this.nextLine(),i=0,{streamParser:s}=this.lang,a=new tpe(n,t?t.state.tabSize:4,t?_g(t.state):2);if(a.eol())s.blankLine(this.state,a.indentUnit);else for(;!a.eol();){let o=rpe(s.token,a,this.state);if(o&&(i=this.emitToken(this.lang.tokenTable.resolve(o),this.parsedPos+a.start,this.parsedPos+a.pos,i)),a.start>1e4)break}this.parsedPos=r,this.moveRangeIndex(),this.parsedPos<this.to&&this.parsedPos++}finishChunk(){let t=ur.build({buffer:this.chunk,start:this.chunkStart,length:this.parsedPos-this.chunkStart,nodeSet:Eet,topID:0,maxBufferLength:2048,reused:this.chunkReused});t=new ur(t.type,t.children,t.positions,t.length,[[this.lang.stateAfter,this.lang.streamParser.copyState(this.state)]]),this.chunks.push(t),this.chunkPos.push(this.chunkStart-this.ranges[0].from),this.chunk=[],this.chunkReused=void 0,this.chunkStart=this.parsedPos}finish(){return new ur(this.lang.topNode,this.chunks,this.chunkPos,this.parsedPos-this.ranges[0].from).balance()}};function rpe(e,t,n){t.start=t.pos;for(let r=0;r<10;r++){let i=e(t,n);if(t.pos>t.start)return i}throw new Error("Stream parser failed to advance stream.")}const p9=Object.create(null),bx=[_s.none],Eet=new k1(bx),FY=[],MY=Object.create(null),ipe=Object.create(null);for(let[e,t]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])ipe[e]=ape(p9,t);class spe{constructor(t){this.extra=t,this.table=Object.assign(Object.create(null),ipe)}resolve(t){return t?this.table[t]||(this.table[t]=ape(this.extra,t)):0}}const Ret=new spe(p9);function FR(e,t){FY.indexOf(e)>-1||(FY.push(e),console.warn(t))}function ape(e,t){let n=[];for(let o of t.split(" ")){let l=[];for(let c of o.split(".")){let u=e[c]||P[c];u?typeof u=="function"?l.length?l=l.map(u):FR(c,`Modifier ${c} used at start of tag`):l.length?FR(c,`Tag ${c} used as modifier`):l=Array.isArray(u)?u:[u]:FR(c,`Unknown highlighting tag ${c}`)}for(let c of l)n.push(c)}if(!n.length)return 0;let r=t.replace(/ /g,"_"),i=r+" "+n.map(o=>o.id),s=MY[i];if(s)return s.id;let a=MY[i]=_s.define({id:bx.length,name:r,props:[Qr({[r]:n})]});return bx.push(a),a.id}function Aet(e,t){let n=_s.define({id:bx.length,name:"Document",props:[Hf.add(()=>e),ji.add(()=>r=>t.getIndent(r))],top:!0});return bx.push(n),n}wi.RTL,wi.LTR;function tt(e){return new gr(ct.define(e))}function yf(e){return Xe(()=>Promise.resolve().then(()=>sut),void 0,import.meta.url).then(t=>t.sql({dialect:t[e]}))}const Xet=[Ce.of({name:"C",extensions:["c","h","ino"],load(){return Xe(()=>Promise.resolve().then(()=>QZ),void 0,import.meta.url).then(e=>e.cpp())}}),Ce.of({name:"C++",alias:["cpp"],extensions:["cpp","c++","cc","cxx","hpp","h++","hh","hxx"],load(){return Xe(()=>Promise.resolve().then(()=>QZ),void 0,import.meta.url).then(e=>e.cpp())}}),Ce.of({name:"CQL",alias:["cassandra"],extensions:["cql"],load(){return yf("Cassandra")}}),Ce.of({name:"CSS",extensions:["css"],load(){return Xe(()=>Promise.resolve().then(()=>wrt),void 0,import.meta.url).then(e=>e.css())}}),Ce.of({name:"Go",extensions:["go"],load(){return Xe(()=>import("./index-B-nr8aEh.js"),__vite__mapDeps([5,1,2]),import.meta.url).then(e=>e.go())}}),Ce.of({name:"HTML",alias:["xhtml"],extensions:["html","htm","handlebars","hbs"],load(){return Xe(()=>Promise.resolve().then(()=>dit),void 0,import.meta.url).then(e=>e.html())}}),Ce.of({name:"Java",extensions:["java"],load(){return Xe(()=>Promise.resolve().then(()=>cut),void 0,import.meta.url).then(e=>e.java())}}),Ce.of({name:"JavaScript",alias:["ecmascript","js","node"],extensions:["js","mjs","cjs"],load(){return Xe(()=>Promise.resolve().then(()=>gk),void 0,import.meta.url).then(e=>e.javascript())}}),Ce.of({name:"JSON",alias:["json5"],extensions:["json","map"],load(){return Xe(()=>Promise.resolve().then(()=>gst),void 0,import.meta.url).then(e=>e.json())}}),Ce.of({name:"JSX",extensions:["jsx"],load(){return Xe(()=>Promise.resolve().then(()=>gk),void 0,import.meta.url).then(e=>e.javascript({jsx:!0}))}}),Ce.of({name:"LESS",extensions:["less"],load(){return Xe(()=>Promise.resolve().then(()=>Rit),void 0,import.meta.url).then(e=>e.less())}}),Ce.of({name:"Liquid",extensions:["liquid"],load(){return Xe(()=>Promise.resolve().then(()=>Yht),void 0,import.meta.url).then(e=>e.liquid())}}),Ce.of({name:"MariaDB SQL",load(){return yf("MariaSQL")}}),Ce.of({name:"Markdown",extensions:["md","markdown","mkd"],load(){return Xe(()=>Promise.resolve().then(()=>yit),void 0,import.meta.url).then(e=>e.markdown())}}),Ce.of({name:"MS SQL",load(){return yf("MSSQL")}}),Ce.of({name:"MySQL",load(){return yf("MySQL")}}),Ce.of({name:"PHP",extensions:["php","php3","php4","php5","php7","phtml"],load(){return Xe(()=>Promise.resolve().then(()=>kht),void 0,import.meta.url).then(e=>e.php())}}),Ce.of({name:"PLSQL",extensions:["pls"],load(){return yf("PLSQL")}}),Ce.of({name:"PostgreSQL",load(){return yf("PostgreSQL")}}),Ce.of({name:"Python",extensions:["BUILD","bzl","py","pyw"],filename:/^(BUCK|BUILD)$/,load(){return Xe(()=>Promise.resolve().then(()=>Ylt),void 0,import.meta.url).then(e=>e.python())}}),Ce.of({name:"Rust",extensions:["rs"],load(){return Xe(()=>Promise.resolve().then(()=>Cut),void 0,import.meta.url).then(e=>e.rust())}}),Ce.of({name:"Sass",extensions:["sass"],load(){return Xe(()=>Promise.resolve().then(()=>jB),void 0,import.meta.url).then(e=>e.sass({indented:!0}))}}),Ce.of({name:"SCSS",extensions:["scss"],load(){return Xe(()=>Promise.resolve().then(()=>jB),void 0,import.meta.url).then(e=>e.sass())}}),Ce.of({name:"SQL",extensions:["sql"],load(){return yf("StandardSQL")}}),Ce.of({name:"SQLite",load(){return yf("SQLite")}}),Ce.of({name:"TSX",extensions:["tsx"],load(){return Xe(()=>Promise.resolve().then(()=>gk),void 0,import.meta.url).then(e=>e.javascript({jsx:!0,typescript:!0}))}}),Ce.of({name:"TypeScript",alias:["ts"],extensions:["ts","mts","cts"],load(){return Xe(()=>Promise.resolve().then(()=>gk),void 0,import.meta.url).then(e=>e.javascript({typescript:!0}))}}),Ce.of({name:"WebAssembly",extensions:["wat","wast"],load(){return Xe(()=>Promise.resolve().then(()=>Hht),void 0,import.meta.url).then(e=>e.wast())}}),Ce.of({name:"XML",alias:["rss","wsdl","xsd"],extensions:["xml","xsl","xsd","svg"],load(){return Xe(()=>Promise.resolve().then(()=>gct),void 0,import.meta.url).then(e=>e.xml())}}),Ce.of({name:"YAML",alias:["yml"],extensions:["yaml","yml"],load(){return Xe(()=>import("./index-CD9V9hPM.js"),__vite__mapDeps([6,1,2]),import.meta.url).then(e=>e.yaml())}}),Ce.of({name:"APL",extensions:["dyalog","apl"],load(){return Xe(()=>Promise.resolve().then(()=>Tpt),void 0,import.meta.url).then(e=>tt(e.apl))}}),Ce.of({name:"PGP",alias:["asciiarmor"],extensions:["asc","pgp","sig"],load(){return Xe(()=>Promise.resolve().then(()=>Ppt),void 0,import.meta.url).then(e=>tt(e.asciiArmor))}}),Ce.of({name:"ASN.1",extensions:["asn","asn1"],load(){return Xe(()=>import("./asn1-EdZsLKOL.js"),[],import.meta.url).then(e=>tt(e.asn1({})))}}),Ce.of({name:"Asterisk",filename:/^extensions\.conf$/i,load(){return Xe(()=>Promise.resolve().then(()=>Rpt),void 0,import.meta.url).then(e=>tt(e.asterisk))}}),Ce.of({name:"Brainfuck",extensions:["b","bf"],load(){return Xe(()=>Promise.resolve().then(()=>Xpt),void 0,import.meta.url).then(e=>tt(e.brainfuck))}}),Ce.of({name:"Cobol",extensions:["cob","cpy"],load(){return Xe(()=>Promise.resolve().then(()=>lgt),void 0,import.meta.url).then(e=>tt(e.cobol))}}),Ce.of({name:"C#",alias:["csharp","cs"],extensions:["cs"],load(){return Xe(()=>Promise.resolve().then(()=>mp),void 0,import.meta.url).then(e=>tt(e.csharp))}}),Ce.of({name:"Clojure",extensions:["clj","cljc","cljx"],load(){return Xe(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>tt(e.clojure))}}),Ce.of({name:"ClojureScript",extensions:["cljs"],load(){return Xe(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>tt(e.clojure))}}),Ce.of({name:"Closure Stylesheets (GSS)",extensions:["gss"],load(){return Xe(()=>import("./css-BnMrqG3P.js"),[],import.meta.url).then(e=>tt(e.gss))}}),Ce.of({name:"CMake",extensions:["cmake","cmake.in"],filename:/^CMakeLists\.txt$/,load(){return Xe(()=>Promise.resolve().then(()=>Jpt),void 0,import.meta.url).then(e=>tt(e.cmake))}}),Ce.of({name:"CoffeeScript",alias:["coffee","coffee-script"],extensions:["coffee"],load(){return Xe(()=>Promise.resolve().then(()=>ygt),void 0,import.meta.url).then(e=>tt(e.coffeeScript))}}),Ce.of({name:"Common Lisp",alias:["lisp"],extensions:["cl","lisp","el"],load(){return Xe(()=>Promise.resolve().then(()=>Pgt),void 0,import.meta.url).then(e=>tt(e.commonLisp))}}),Ce.of({name:"Cypher",extensions:["cyp","cypher"],load(){return Xe(()=>Promise.resolve().then(()=>jgt),void 0,import.meta.url).then(e=>tt(e.cypher))}}),Ce.of({name:"Cython",extensions:["pyx","pxd","pxi"],load(){return Xe(()=>import("./python-BuPzkPfP.js"),[],import.meta.url).then(e=>tt(e.cython))}}),Ce.of({name:"Crystal",extensions:["cr"],load(){return Xe(()=>Promise.resolve().then(()=>Mgt),void 0,import.meta.url).then(e=>tt(e.crystal))}}),Ce.of({name:"D",extensions:["d"],load(){return Xe(()=>Promise.resolve().then(()=>Kgt),void 0,import.meta.url).then(e=>tt(e.d))}}),Ce.of({name:"Dart",extensions:["dart"],load(){return Xe(()=>Promise.resolve().then(()=>mp),void 0,import.meta.url).then(e=>tt(e.dart))}}),Ce.of({name:"diff",extensions:["diff","patch"],load(){return Xe(()=>Promise.resolve().then(()=>Jgt),void 0,import.meta.url).then(e=>tt(e.diff))}}),Ce.of({name:"Dockerfile",filename:/^Dockerfile$/,load(){return Xe(()=>Promise.resolve().then(()=>hmt),void 0,import.meta.url).then(e=>tt(e.dockerFile))}}),Ce.of({name:"DTD",extensions:["dtd"],load(){return Xe(()=>Promise.resolve().then(()=>pmt),void 0,import.meta.url).then(e=>tt(e.dtd))}}),Ce.of({name:"Dylan",extensions:["dylan","dyl","intr"],load(){return Xe(()=>Promise.resolve().then(()=>wmt),void 0,import.meta.url).then(e=>tt(e.dylan))}}),Ce.of({name:"EBNF",load(){return Xe(()=>Promise.resolve().then(()=>ymt),void 0,import.meta.url).then(e=>tt(e.ebnf))}}),Ce.of({name:"ECL",extensions:["ecl"],load(){return Xe(()=>Promise.resolve().then(()=>Cmt),void 0,import.meta.url).then(e=>tt(e.ecl))}}),Ce.of({name:"edn",extensions:["edn"],load(){return Xe(()=>import("./clojure-BMjYHr_A.js"),[],import.meta.url).then(e=>tt(e.clojure))}}),Ce.of({name:"Eiffel",extensions:["e"],load(){return Xe(()=>Promise.resolve().then(()=>Dmt),void 0,import.meta.url).then(e=>tt(e.eiffel))}}),Ce.of({name:"Elm",extensions:["elm"],load(){return Xe(()=>Promise.resolve().then(()=>Gmt),void 0,import.meta.url).then(e=>tt(e.elm))}}),Ce.of({name:"Erlang",extensions:["erl"],load(){return Xe(()=>Promise.resolve().then(()=>g0t),void 0,import.meta.url).then(e=>tt(e.erlang))}}),Ce.of({name:"Esper",load(){return Xe(()=>import("./sql-D0XecflT.js"),[],import.meta.url).then(e=>tt(e.esper))}}),Ce.of({name:"Factor",extensions:["factor"],load(){return Xe(()=>Promise.resolve().then(()=>m0t),void 0,import.meta.url).then(e=>tt(e.factor))}}),Ce.of({name:"FCL",load(){return Xe(()=>Promise.resolve().then(()=>x0t),void 0,import.meta.url).then(e=>tt(e.fcl))}}),Ce.of({name:"Forth",extensions:["forth","fth","4th"],load(){return Xe(()=>Promise.resolve().then(()=>k0t),void 0,import.meta.url).then(e=>tt(e.forth))}}),Ce.of({name:"Fortran",extensions:["f","for","f77","f90","f95"],load(){return Xe(()=>Promise.resolve().then(()=>R0t),void 0,import.meta.url).then(e=>tt(e.fortran))}}),Ce.of({name:"F#",alias:["fsharp"],extensions:["fs"],load(){return Xe(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(e=>tt(e.fSharp))}}),Ce.of({name:"Gas",extensions:["s"],load(){return Xe(()=>Promise.resolve().then(()=>X0t),void 0,import.meta.url).then(e=>tt(e.gas))}}),Ce.of({name:"Gherkin",extensions:["feature"],load(){return Xe(()=>Promise.resolve().then(()=>D0t),void 0,import.meta.url).then(e=>tt(e.gherkin))}}),Ce.of({name:"Groovy",extensions:["groovy","gradle"],filename:/^Jenkinsfile$/,load(){return Xe(()=>Promise.resolve().then(()=>G0t),void 0,import.meta.url).then(e=>tt(e.groovy))}}),Ce.of({name:"Haskell",extensions:["hs"],load(){return Xe(()=>Promise.resolve().then(()=>J0t),void 0,import.meta.url).then(e=>tt(e.haskell))}}),Ce.of({name:"Haxe",extensions:["hx"],load(){return Xe(()=>Promise.resolve().then(()=>JH),void 0,import.meta.url).then(e=>tt(e.haxe))}}),Ce.of({name:"HXML",extensions:["hxml"],load(){return Xe(()=>Promise.resolve().then(()=>JH),void 0,import.meta.url).then(e=>tt(e.hxml))}}),Ce.of({name:"HTTP",load(){return Xe(()=>Promise.resolve().then(()=>xvt),void 0,import.meta.url).then(e=>tt(e.http))}}),Ce.of({name:"IDL",extensions:["pro"],load(){return Xe(()=>Promise.resolve().then(()=>Cvt),void 0,import.meta.url).then(e=>tt(e.idl))}}),Ce.of({name:"JSON-LD",alias:["jsonld"],extensions:["jsonld"],load(){return Xe(()=>import("./javascript-qCveANmP.js"),[],import.meta.url).then(e=>tt(e.jsonld))}}),Ce.of({name:"Jinja2",extensions:["j2","jinja","jinja2"],load(){return Xe(()=>Promise.resolve().then(()=>Avt),void 0,import.meta.url).then(e=>tt(e.jinja2))}}),Ce.of({name:"Julia",extensions:["jl"],load(){return Xe(()=>Promise.resolve().then(()=>i1t),void 0,import.meta.url).then(e=>tt(e.julia))}}),Ce.of({name:"Kotlin",extensions:["kt","kts"],load(){return Xe(()=>Promise.resolve().then(()=>mp),void 0,import.meta.url).then(e=>tt(e.kotlin))}}),Ce.of({name:"LiveScript",alias:["ls"],extensions:["ls"],load(){return Xe(()=>Promise.resolve().then(()=>l1t),void 0,import.meta.url).then(e=>tt(e.liveScript))}}),Ce.of({name:"Lua",extensions:["lua"],load(){return Xe(()=>Promise.resolve().then(()=>g1t),void 0,import.meta.url).then(e=>tt(e.lua))}}),Ce.of({name:"mIRC",extensions:["mrc"],load(){return Xe(()=>Promise.resolve().then(()=>M1t),void 0,import.meta.url).then(e=>tt(e.mirc))}}),Ce.of({name:"Mathematica",extensions:["m","nb","wl","wls"],load(){return Xe(()=>Promise.resolve().then(()=>$1t),void 0,import.meta.url).then(e=>tt(e.mathematica))}}),Ce.of({name:"Modelica",extensions:["mo"],load(){return Xe(()=>Promise.resolve().then(()=>B1t),void 0,import.meta.url).then(e=>tt(e.modelica))}}),Ce.of({name:"MUMPS",extensions:["mps"],load(){return Xe(()=>Promise.resolve().then(()=>dbt),void 0,import.meta.url).then(e=>tt(e.mumps))}}),Ce.of({name:"Mbox",extensions:["mbox"],load(){return Xe(()=>Promise.resolve().then(()=>I1t),void 0,import.meta.url).then(e=>tt(e.mbox))}}),Ce.of({name:"Nginx",filename:/nginx.*\.conf$/i,load(){return Xe(()=>Promise.resolve().then(()=>gbt),void 0,import.meta.url).then(e=>tt(e.nginx))}}),Ce.of({name:"NSIS",extensions:["nsh","nsi"],load(){return Xe(()=>Promise.resolve().then(()=>mbt),void 0,import.meta.url).then(e=>tt(e.nsis))}}),Ce.of({name:"NTriples",extensions:["nt","nq"],load(){return Xe(()=>Promise.resolve().then(()=>vbt),void 0,import.meta.url).then(e=>tt(e.ntriples))}}),Ce.of({name:"Objective-C",alias:["objective-c","objc"],extensions:["m"],load(){return Xe(()=>Promise.resolve().then(()=>mp),void 0,import.meta.url).then(e=>tt(e.objectiveC))}}),Ce.of({name:"Objective-C++",alias:["objective-c++","objc++"],extensions:["mm"],load(){return Xe(()=>Promise.resolve().then(()=>mp),void 0,import.meta.url).then(e=>tt(e.objectiveCpp))}}),Ce.of({name:"OCaml",extensions:["ml","mli","mll","mly"],load(){return Xe(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(e=>tt(e.oCaml))}}),Ce.of({name:"Octave",extensions:["m"],load(){return Xe(()=>Promise.resolve().then(()=>Cbt),void 0,import.meta.url).then(e=>tt(e.octave))}}),Ce.of({name:"Oz",extensions:["oz"],load(){return Xe(()=>Promise.resolve().then(()=>Lbt),void 0,import.meta.url).then(e=>tt(e.oz))}}),Ce.of({name:"Pascal",extensions:["p","pas"],load(){return Xe(()=>Promise.resolve().then(()=>Vbt),void 0,import.meta.url).then(e=>tt(e.pascal))}}),Ce.of({name:"Perl",extensions:["pl","pm"],load(){return Xe(()=>Promise.resolve().then(()=>Ybt),void 0,import.meta.url).then(e=>tt(e.perl))}}),Ce.of({name:"Pig",extensions:["pig"],load(){return Xe(()=>Promise.resolve().then(()=>Hbt),void 0,import.meta.url).then(e=>tt(e.pig))}}),Ce.of({name:"PowerShell",extensions:["ps1","psd1","psm1"],load(){return Xe(()=>Promise.resolve().then(()=>fwt),void 0,import.meta.url).then(e=>tt(e.powerShell))}}),Ce.of({name:"Properties files",alias:["ini","properties"],extensions:["properties","ini","in"],load(){return Xe(()=>Promise.resolve().then(()=>Owt),void 0,import.meta.url).then(e=>tt(e.properties))}}),Ce.of({name:"ProtoBuf",extensions:["proto"],load(){return Xe(()=>Promise.resolve().then(()=>bwt),void 0,import.meta.url).then(e=>tt(e.protobuf))}}),Ce.of({name:"Pug",alias:["jade"],extensions:["pug","jade"],load(){return Xe(()=>import("./pug-DukmZTjD.js"),__vite__mapDeps([7,8]),import.meta.url).then(e=>tt(e.pug))}}),Ce.of({name:"Puppet",extensions:["pp"],load(){return Xe(()=>Promise.resolve().then(()=>xwt),void 0,import.meta.url).then(e=>tt(e.puppet))}}),Ce.of({name:"Q",extensions:["q"],load(){return Xe(()=>Promise.resolve().then(()=>Qwt),void 0,import.meta.url).then(e=>tt(e.q))}}),Ce.of({name:"R",alias:["rscript"],extensions:["r","R"],load(){return Xe(()=>Promise.resolve().then(()=>Nwt),void 0,import.meta.url).then(e=>tt(e.r))}}),Ce.of({name:"RPM Changes",load(){return Xe(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>tt(e.rpmChanges))}}),Ce.of({name:"RPM Spec",extensions:["spec"],load(){return Xe(()=>import("./rpm-CTu-6PCP.js"),[],import.meta.url).then(e=>tt(e.rpmSpec))}}),Ce.of({name:"Ruby",alias:["jruby","macruby","rake","rb","rbx"],extensions:["rb"],filename:/^(Gemfile|Rakefile)$/,load(){return Xe(()=>Promise.resolve().then(()=>Gwt),void 0,import.meta.url).then(e=>tt(e.ruby))}}),Ce.of({name:"SAS",extensions:["sas"],load(){return Xe(()=>Promise.resolve().then(()=>Zwt),void 0,import.meta.url).then(e=>tt(e.sas))}}),Ce.of({name:"Scala",extensions:["scala"],load(){return Xe(()=>Promise.resolve().then(()=>mp),void 0,import.meta.url).then(e=>tt(e.scala))}}),Ce.of({name:"Scheme",extensions:["scm","ss"],load(){return Xe(()=>Promise.resolve().then(()=>cyt),void 0,import.meta.url).then(e=>tt(e.scheme))}}),Ce.of({name:"Shell",alias:["bash","sh","zsh"],extensions:["sh","ksh","bash"],filename:/^PKGBUILD$/,load(){return Xe(()=>Promise.resolve().then(()=>fyt),void 0,import.meta.url).then(e=>tt(e.shell))}}),Ce.of({name:"Sieve",extensions:["siv","sieve"],load(){return Xe(()=>Promise.resolve().then(()=>vyt),void 0,import.meta.url).then(e=>tt(e.sieve))}}),Ce.of({name:"Smalltalk",extensions:["st"],load(){return Xe(()=>Promise.resolve().then(()=>yyt),void 0,import.meta.url).then(e=>tt(e.smalltalk))}}),Ce.of({name:"Solr",load(){return Xe(()=>Promise.resolve().then(()=>_yt),void 0,import.meta.url).then(e=>tt(e.solr))}}),Ce.of({name:"SML",extensions:["sml","sig","fun","smackspec"],load(){return Xe(()=>import("./mllike-CXdrOF99.js"),[],import.meta.url).then(e=>tt(e.sml))}}),Ce.of({name:"SPARQL",alias:["sparul"],extensions:["rq","sparql"],load(){return Xe(()=>Promise.resolve().then(()=>Dyt),void 0,import.meta.url).then(e=>tt(e.sparql))}}),Ce.of({name:"Spreadsheet",alias:["excel","formula"],load(){return Xe(()=>Promise.resolve().then(()=>Iyt),void 0,import.meta.url).then(e=>tt(e.spreadsheet))}}),Ce.of({name:"Squirrel",extensions:["nut"],load(){return Xe(()=>Promise.resolve().then(()=>mp),void 0,import.meta.url).then(e=>tt(e.squirrel))}}),Ce.of({name:"Stylus",extensions:["styl"],load(){return Xe(()=>Promise.resolve().then(()=>ixt),void 0,import.meta.url).then(e=>tt(e.stylus))}}),Ce.of({name:"Swift",extensions:["swift"],load(){return Xe(()=>Promise.resolve().then(()=>$xt),void 0,import.meta.url).then(e=>tt(e.swift))}}),Ce.of({name:"sTeX",load(){return Xe(()=>Promise.resolve().then(()=>WK),void 0,import.meta.url).then(e=>tt(e.stex))}}),Ce.of({name:"LaTeX",alias:["tex"],extensions:["text","ltx","tex"],load(){return Xe(()=>Promise.resolve().then(()=>WK),void 0,import.meta.url).then(e=>tt(e.stex))}}),Ce.of({name:"SystemVerilog",extensions:["v","sv","svh"],load(){return Xe(()=>Promise.resolve().then(()=>uJ),void 0,import.meta.url).then(e=>tt(e.verilog))}}),Ce.of({name:"Tcl",extensions:["tcl"],load(){return Xe(()=>Promise.resolve().then(()=>_xt),void 0,import.meta.url).then(e=>tt(e.tcl))}}),Ce.of({name:"Textile",extensions:["textile"],load(){return Xe(()=>Promise.resolve().then(()=>Rxt),void 0,import.meta.url).then(e=>tt(e.textile))}}),Ce.of({name:"TiddlyWiki",load(){return Xe(()=>Promise.resolve().then(()=>Jxt),void 0,import.meta.url).then(e=>tt(e.tiddlyWiki))}}),Ce.of({name:"Tiki wiki",load(){return Xe(()=>Promise.resolve().then(()=>aSt),void 0,import.meta.url).then(e=>tt(e.tiki))}}),Ce.of({name:"TOML",extensions:["toml"],load(){return Xe(()=>Promise.resolve().then(()=>oSt),void 0,import.meta.url).then(e=>tt(e.toml))}}),Ce.of({name:"Troff",extensions:["1","2","3","4","5","6","7","8","9"],load(){return Xe(()=>Promise.resolve().then(()=>uSt),void 0,import.meta.url).then(e=>tt(e.troff))}}),Ce.of({name:"TTCN",extensions:["ttcn","ttcn3","ttcnpp"],load(){return Xe(()=>Promise.resolve().then(()=>_St),void 0,import.meta.url).then(e=>tt(e.ttcn))}}),Ce.of({name:"TTCN_CFG",extensions:["cfg"],load(){return Xe(()=>import("./ttcn-cfg-B9xdYoR4.js"),[],import.meta.url).then(e=>tt(e.ttcnCfg))}}),Ce.of({name:"Turtle",extensions:["ttl"],load(){return Xe(()=>Promise.resolve().then(()=>ESt),void 0,import.meta.url).then(e=>tt(e.turtle))}}),Ce.of({name:"Web IDL",extensions:["webidl"],load(){return Xe(()=>Promise.resolve().then(()=>$$t),void 0,import.meta.url).then(e=>tt(e.webIDL))}}),Ce.of({name:"VB.NET",extensions:["vb"],load(){return Xe(()=>Promise.resolve().then(()=>GSt),void 0,import.meta.url).then(e=>tt(e.vb))}}),Ce.of({name:"VBScript",extensions:["vbs"],load(){return Xe(()=>Promise.resolve().then(()=>YSt),void 0,import.meta.url).then(e=>tt(e.vbScript))}}),Ce.of({name:"Velocity",extensions:["vtl"],load(){return Xe(()=>Promise.resolve().then(()=>HSt),void 0,import.meta.url).then(e=>tt(e.velocity))}}),Ce.of({name:"Verilog",extensions:["v"],load(){return Xe(()=>Promise.resolve().then(()=>uJ),void 0,import.meta.url).then(e=>tt(e.verilog))}}),Ce.of({name:"VHDL",extensions:["vhd","vhdl"],load(){return Xe(()=>Promise.resolve().then(()=>a$t),void 0,import.meta.url).then(e=>tt(e.vhdl))}}),Ce.of({name:"XQuery",extensions:["xy","xquery"],load(){return Xe(()=>Promise.resolve().then(()=>X$t),void 0,import.meta.url).then(e=>tt(e.xQuery))}}),Ce.of({name:"Yacas",extensions:["ys"],load(){return Xe(()=>Promise.resolve().then(()=>W$t),void 0,import.meta.url).then(e=>tt(e.yacas))}}),Ce.of({name:"Z80",extensions:["z80"],load(){return Xe(()=>Promise.resolve().then(()=>B$t),void 0,import.meta.url).then(e=>tt(e.z80))}}),Ce.of({name:"MscGen",extensions:["mscgen","mscin","msc"],load(){return Xe(()=>Promise.resolve().then(()=>W4),void 0,import.meta.url).then(e=>tt(e.mscgen))}}),Ce.of({name:"Xù",extensions:["xu"],load(){return Xe(()=>Promise.resolve().then(()=>W4),void 0,import.meta.url).then(e=>tt(e.xu))}}),Ce.of({name:"MsGenny",extensions:["msgenny"],load(){return Xe(()=>Promise.resolve().then(()=>W4),void 0,import.meta.url).then(e=>tt(e.msgenny))}}),Ce.of({name:"Vue",extensions:["vue"],load(){return Xe(()=>Promise.resolve().then(()=>sft),void 0,import.meta.url).then(e=>e.vue())}}),Ce.of({name:"Angular Template",load(){return Xe(()=>Promise.resolve().then(()=>$ft),void 0,import.meta.url).then(e=>e.angular())}})];class g9{constructor(t,n,r,i){this.state=t,this.pos=n,this.explicit=r,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(t){let n=kr(this.state).resolveInner(this.pos,-1);for(;n&&t.indexOf(n.name)<0;)n=n.parent;return n?{from:n.from,to:this.pos,text:this.state.sliceDoc(n.from,this.pos),type:n.type}:null}matchBefore(t){let n=this.state.doc.lineAt(this.pos),r=Math.max(n.from,this.pos-250),i=n.text.slice(r-n.from,this.pos-n.from),s=i.search(ope(t,!1));return s<0?null:{from:r+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(t,n,r){t=="abort"&&this.abortListeners&&(this.abortListeners.push(n),r&&r.onDocChange&&(this.abortOnDocChange=!0))}}function zY(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function Det(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let s=1;s<i.length;s++)n[i[s]]=!0}let r=zY(t)+zY(n)+"*$";return[new RegExp("^"+r),new RegExp(r)]}function DS(e){let t=e.map(i=>typeof i=="string"?{label:i}:i),[n,r]=t.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Det(t);return i=>{let s=i.matchBefore(r);return s||i.explicit?{from:s?s.from:i.pos,options:t,validFor:n}:null}}function PQ(e,t){return n=>{for(let r=kr(n.state).resolveInner(n.pos,-1);r;r=r.parent){if(e.indexOf(r.name)>-1)return null;if(r.type.isTop)break}return t(n)}}class LY{constructor(t,n,r,i){this.completion=t,this.source=n,this.match=r,this.score=i}}function Gp(e){return e.selection.main.from}function ope(e,t){var n;let{source:r}=e,i=t&&r[0]!="^",s=r[r.length-1]!="$";return!i&&!s?e:new RegExp(`${i?"^":""}(?:${r})${s?"$":""}`,(n=e.flags)!==null&&n!==void 0?n:e.ignoreCase?"i":"")}const m9=_d.define();function Iet(e,t,n,r){let{main:i}=e.selection,s=n-i.from,a=r-i.from;return Object.assign(Object.assign({},e.changeByRange(o=>{if(o!=i&&n!=r&&e.sliceDoc(o.from+s,o.from+a)!=e.sliceDoc(n,r))return{range:o};let l=e.toText(t);return{changes:{from:o.from+s,to:r==i.from?o.to:o.from+a,insert:l},range:Ve.cursor(o.from+s+l.length)}})),{scrollIntoView:!0,userEvent:"input.complete"})}const qY=new WeakMap;function Net(e){if(!Array.isArray(e))return e;let t=qY.get(e);return t||qY.set(e,t=DS(e)),t}const HP=Xn.define(),wx=Xn.define();class Fet{constructor(t){this.pattern=t,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<t.length;){let r=Xo(t,n),i=ju(r);this.chars.push(r);let s=t.slice(n,n+i),a=s.toUpperCase();this.folded.push(Xo(a==s?s.toLowerCase():a,0)),n+=i}this.astral=t.length!=this.chars.length}ret(t,n){return this.score=t,this.matched=n,this}match(t){if(this.pattern.length==0)return this.ret(-100,[]);if(t.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:s,byWord:a}=this;if(n.length==1){let b=Xo(t,0),y=ju(b),T=y==t.length?0:-100;if(b!=n[0])if(b==r[0])T+=-200;else return null;return this.ret(T,[0,y])}let o=t.indexOf(this.pattern);if(o==0)return this.ret(t.length==this.pattern.length?0:-100,[0,this.pattern.length]);let l=n.length,c=0;if(o<0){for(let b=0,y=Math.min(t.length,200);b<y&&c<l;){let T=Xo(t,b);(T==n[c]||T==r[c])&&(i[c++]=b),b+=ju(T)}if(c<l)return null}let u=0,d=0,h=!1,f=0,p=-1,g=-1,m=/[a-z]/.test(t),v=!0;for(let b=0,y=Math.min(t.length,200),T=0;b<y&&d<l;){let x=Xo(t,b);o<0&&(u<l&&x==n[u]&&(s[u++]=b),f<l&&(x==n[f]||x==r[f]?(f==0&&(p=b),g=b+1,f++):f=0));let S,k=x<255?x>=48&&x<=57||x>=97&&x<=122?2:x>=65&&x<=90?1:0:(S=V7(x))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(!b||k==1&&m||T==0&&k!=0)&&(n[d]==x||r[d]==x&&(h=!0)?a[d++]=b:a.length&&(v=!1)),T=k,b+=ju(x)}return d==l&&a[0]==0&&v?this.result(-100+(h?-200:0),a,t):f==l&&p==0?this.ret(-200-t.length+(g==t.length?0:-100),[0,g]):o>-1?this.ret(-700-t.length,[o,o+this.pattern.length]):f==l?this.ret(-900-t.length,[p,g]):d==l?this.result(-100+(h?-200:0)+-700+(v?0:-1100),a,t):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,t)}result(t,n,r){let i=[],s=0;for(let a of n){let o=a+(this.astral?ju(Xo(r,a)):1);s&&i[s-1]==a?i[s-1]=o:(i[s++]=a,i[s++]=o)}return this.ret(t-r.length,i)}}class Met{constructor(t){this.pattern=t,this.matched=[],this.score=0,this.folded=t.toLowerCase()}match(t){if(t.length<this.pattern.length)return null;let n=t.slice(0,this.pattern.length),r=n==this.pattern?0:n.toLowerCase()==this.folded?-200:null;return r==null?null:(this.matched=[0,n.length],this.score=r+(t.length==this.pattern.length?0:-100),this)}}const Zs=Ut.define({combine(e){return Cd(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:zet,filterStrict:!1,compareCompletions:(t,n)=>t.label.localeCompare(n.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(t,n)=>t&&n,closeOnBlur:(t,n)=>t&&n,icons:(t,n)=>t&&n,tooltipClass:(t,n)=>r=>UY(t(r),n(r)),optionClass:(t,n)=>r=>UY(t(r),n(r)),addToOptions:(t,n)=>t.concat(n),filterStrict:(t,n)=>t||n})}});function UY(e,t){return e?t?e+" "+t:e:t}function zet(e,t,n,r,i,s){let a=e.textDirection==wi.RTL,o=a,l=!1,c="top",u,d,h=t.left-i.left,f=i.right-t.right,p=r.right-r.left,g=r.bottom-r.top;if(o&&h<Math.min(p,f)?o=!1:!o&&f<Math.min(p,h)&&(o=!0),p<=(o?h:f))u=Math.max(i.top,Math.min(n.top,i.bottom-g))-t.top,d=Math.min(400,o?h:f);else{l=!0,d=Math.min(400,(a?t.right:i.right-t.left)-30);let b=i.bottom-t.bottom;b>=g||b>t.top?u=n.bottom-t.top:(c="bottom",u=t.bottom-n.top)}let m=(t.bottom-t.top)/s.offsetHeight,v=(t.right-t.left)/s.offsetWidth;return{style:`${c}: ${u/m}px; max-width: ${d/v}px`,class:"cm-completionInfo-"+(l?a?"left-narrow":"right-narrow":o?"left":"right")}}function Let(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(n){let r=document.createElement("div");return r.classList.add("cm-completionIcon"),n.type&&r.classList.add(...n.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),r.setAttribute("aria-hidden","true"),r},position:20}),t.push({render(n,r,i,s){let a=document.createElement("span");a.className="cm-completionLabel";let o=n.displayLabel||n.label,l=0;for(let c=0;c<s.length;){let u=s[c++],d=s[c++];u>l&&a.appendChild(document.createTextNode(o.slice(l,u)));let h=a.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(o.slice(u,d))),h.className="cm-completionMatchedText",l=d}return l<o.length&&a.appendChild(document.createTextNode(o.slice(l))),a},position:50},{render(n){if(!n.detail)return null;let r=document.createElement("span");return r.className="cm-completionDetail",r.textContent=n.detail,r},position:80}),t.sort((n,r)=>n.position-r.position).map(n=>n.render)}function MR(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let i=Math.floor(t/n);return{from:i*n,to:(i+1)*n}}let r=Math.floor((e-t)/n);return{from:e-(r+1)*n,to:e-r*n}}class qet{constructor(t,n,r){this.view=t,this.stateField=n,this.applyCompletion=r,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=t.state.field(n),{options:s,selected:a}=i.open,o=t.state.facet(Zs);this.optionContent=Let(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=MR(s.length,a,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(t.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=t.state.field(n).open;for(let u=l.target,d;u&&u!=this.dom;u=u.parentNode)if(u.nodeName=="LI"&&(d=/-(\d+)$/.exec(u.id))&&+d[1]<c.length){this.applyCompletion(t,c[+d[1]]),l.preventDefault();return}}),this.dom.addEventListener("focusout",l=>{let c=t.state.field(this.stateField,!1);c&&c.tooltip&&t.state.facet(Zs).closeOnBlur&&l.relatedTarget!=t.contentDOM&&t.dispatch({effects:wx.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(t,n){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t,n,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(t){var n;let r=t.state.field(this.stateField),i=t.startState.field(this.stateField);if(this.updateTooltipClass(t.state),r!=i){let{options:s,selected:a,disabled:o}=r.open;(!i.open||i.open.options!=s)&&(this.range=MR(s.length,a,t.state.facet(Zs).maxRenderedOptions),this.showOptions(s,r.id)),this.updateSel(),o!=((n=i.open)===null||n===void 0?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(t){let n=this.tooltipClass(t);if(n!=this.currentClass){for(let r of this.currentClass.split(" "))r&&this.dom.classList.remove(r);for(let r of n.split(" "))r&&this.dom.classList.add(r);this.currentClass=n}}positioned(t){this.space=t,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let t=this.view.state.field(this.stateField),n=t.open;if((n.selected>-1&&n.selected<this.range.from||n.selected>=this.range.to)&&(this.range=MR(n.options.length,n.selected,this.view.state.facet(Zs).maxRenderedOptions),this.showOptions(n.options,t.id)),this.updateSelectedOption(n.selected)){this.destroyInfo();let{completion:r}=n.options[n.selected],{info:i}=r;if(!i)return;let s=typeof i=="string"?document.createTextNode(i):i(r);if(!s)return;"then"in s?s.then(a=>{a&&this.view.state.field(this.stateField,!1)==t&&this.addInfoPane(a,r)}).catch(a=>Lo(this.view.state,a,"completion info")):this.addInfoPane(s,r)}}addInfoPane(t,n){this.destroyInfo();let r=this.info=document.createElement("div");if(r.className="cm-tooltip cm-completionInfo",t.nodeType!=null)r.appendChild(t),this.infoDestroy=null;else{let{dom:i,destroy:s}=t;r.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(r),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(t){let n=null;for(let r=this.list.firstChild,i=this.range.from;r;r=r.nextSibling,i++)r.nodeName!="LI"||!r.id?i--:i==t?r.hasAttribute("aria-selected")||(r.setAttribute("aria-selected","true"),n=r):r.hasAttribute("aria-selected")&&r.removeAttribute("aria-selected");return n&&Wet(this.list,n),n}measureInfo(){let t=this.dom.querySelector("[aria-selected]");if(!t||!this.info)return null;let n=this.dom.getBoundingClientRect(),r=this.info.getBoundingClientRect(),i=t.getBoundingClientRect(),s=this.space;if(!s){let a=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return i.top>Math.min(s.bottom,n.bottom)-10||i.bottom<Math.max(s.top,n.top)+10?null:this.view.state.facet(Zs).positionInfo(this.view,n,i,r,s,this.dom)}placeInfo(t){this.info&&(t?(t.style&&(this.info.style.cssText=t.style),this.info.className="cm-tooltip cm-completionInfo "+(t.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(t,n,r){const i=document.createElement("ul");i.id=n,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions")),i.addEventListener("mousedown",a=>{a.target==i&&a.preventDefault()});let s=null;for(let a=r.from;a<r.to;a++){let{completion:o,match:l}=t[a],{section:c}=o;if(c){let h=typeof c=="string"?c:c.name;if(h!=s&&(a>r.from||r.from==0))if(s=h,typeof c!="string"&&c.header)i.appendChild(c.header(c));else{let f=i.appendChild(document.createElement("completion-section"));f.textContent=h}}const u=i.appendChild(document.createElement("li"));u.id=n+"-"+a,u.setAttribute("role","option");let d=this.optionClass(o);d&&(u.className=d);for(let h of this.optionContent){let f=h(o,this.view.state,this.view,l);f&&u.appendChild(f)}}return r.from&&i.classList.add("cm-completionListIncompleteTop"),r.to<t.length&&i.classList.add("cm-completionListIncompleteBottom"),i}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function Uet(e,t){return n=>new qet(n,e,t)}function Wet(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function WY(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function jet(e,t){let n=[],r=null,i=c=>{n.push(c);let{section:u}=c.completion;if(u){r||(r=[]);let d=typeof u=="string"?u:u.name;r.some(h=>h.name==d)||r.push(typeof u=="string"?{name:d}:u)}},s=t.facet(Zs);for(let c of e)if(c.hasResult()){let u=c.result.getMatch;if(c.result.filter===!1)for(let d of c.result.options)i(new LY(d,c.source,u?u(d):[],1e9-n.length));else{let d=t.sliceDoc(c.from,c.to),h,f=s.filterStrict?new Met(d):new Fet(d);for(let p of c.result.options)if(h=f.match(p.label)){let g=p.displayLabel?u?u(p,h.matched):[]:h.matched;i(new LY(p,c.source,g,h.score+(p.boost||0)))}}}if(r){let c=Object.create(null),u=0,d=(h,f)=>{var p,g;return((p=h.rank)!==null&&p!==void 0?p:1e9)-((g=f.rank)!==null&&g!==void 0?g:1e9)||(h.name<f.name?-1:1)};for(let h of r.sort(d))u-=1e5,c[h.name]=u;for(let h of n){let{section:f}=h.completion;f&&(h.score+=c[typeof f=="string"?f:f.name])}}let a=[],o=null,l=s.compareCompletions;for(let c of n.sort((u,d)=>d.score-u.score||l(u.completion,d.completion))){let u=c.completion;!o||o.label!=u.label||o.detail!=u.detail||o.type!=null&&u.type!=null&&o.type!=u.type||o.apply!=u.apply||o.boost!=u.boost?a.push(c):WY(c.completion)>WY(o)&&(a[a.length-1]=c),o=c.completion}return a}class T0{constructor(t,n,r,i,s,a){this.options=t,this.attrs=n,this.tooltip=r,this.timestamp=i,this.selected=s,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new T0(this.options,jY(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,s,a){if(i&&!a&&t.some(c=>c.isPending))return i.setDisabled();let o=jet(t,n);if(!o.length)return i&&t.some(c=>c.isPending)?i.setDisabled():null;let l=n.facet(Zs).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let c=i.options[i.selected].completion;for(let u=0;u<o.length;u++)if(o[u].completion==c){l=u;break}}return new T0(o,jY(r,l),{pos:t.reduce((c,u)=>u.hasResult()?Math.min(c,u.from):c,1e8),create:Het,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(t){return new T0(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:t.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}setDisabled(){return new T0(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class KP{constructor(t,n,r){this.active=t,this.id=n,this.open=r}static start(){return new KP(Bet,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(Zs),s=(r.override||n.languageDataAt("autocomplete",Gp(n)).map(Net)).map(l=>(this.active.find(u=>u.source==l)||new sc(l,this.active.some(u=>u.state!=0)?1:0)).update(t,r));s.length==this.active.length&&s.every((l,c)=>l==this.active[c])&&(s=this.active);let a=this.open,o=t.effects.some(l=>l.is(v9));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||s.some(l=>l.hasResult()&&t.changes.touchesRange(l.from,l.to))||!Get(s,this.active)||o?a=T0.build(s,n,this.id,a,r,o):a&&a.disabled&&!s.some(l=>l.isPending)&&(a=null),!a&&s.every(l=>!l.isPending)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new sc(l.source,0):l));for(let l of t.effects)l.is(cpe)&&(a=a&&a.setSelected(l.value,this.id));return s==this.active&&a==this.open?this:new KP(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Vet:Yet}}function Get(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,s=r==t.length;if(i||s)return i==s;if(e[n++].result!=t[r++].result)return!1}}const Vet={"aria-autocomplete":"list"},Yet={};function jY(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const Bet=[];function lpe(e,t){if(e.isUserEvent("input.complete")){let r=e.annotation(m9);if(r&&t.activateOnCompletion(r))return 12}let n=e.isUserEvent("input.type");return n&&t.activateOnTyping?5:n?1:e.isUserEvent("delete.backward")?2:e.selection?8:e.docChanged?16:0}class sc{constructor(t,n,r=!1){this.source=t,this.state=n,this.explicit=r}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=lpe(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new sc(i.source,0)),r&4&&i.state==0&&(i=new sc(this.source,1)),i=i.updateFor(t,r);for(let s of t.effects)if(s.is(HP))i=new sc(i.source,1,s.value);else if(s.is(wx))i=new sc(i.source,0);else if(s.is(v9))for(let a of s.value)a.source==i.source&&(i=a);return i}updateFor(t,n){return this.map(t.changes)}map(t){return this}touches(t){return t.changes.touchesRange(Gp(t.state))}}class V0 extends sc{constructor(t,n,r,i,s,a){super(t,3,n),this.limit=r,this.result=i,this.from=s,this.to=a}hasResult(){return!0}updateFor(t,n){var r;if(!(n&3))return this.map(t.changes);let i=this.result;i.map&&!t.changes.empty&&(i=i.map(i,t.changes));let s=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=Gp(t.state);if(o>a||!i||n&2&&(Gp(t.startState)==this.from||o<this.limit))return new sc(this.source,n&4?1:0);let l=t.changes.mapPos(this.limit);return Zet(i.validFor,t.state,s,a)?new V0(this.source,this.explicit,l,i,s,a):i.update&&(i=i.update(i,s,a,new g9(t.state,o,!1)))?new V0(this.source,this.explicit,l,i,i.from,(r=i.to)!==null&&r!==void 0?r:Gp(t.state)):new sc(this.source,1,this.explicit)}map(t){return t.empty?this:(this.result.map?this.result.map(this.result,t):this.result)?new V0(this.source,this.explicit,t.mapPos(this.limit),this.result,t.mapPos(this.from),t.mapPos(this.to,1)):new sc(this.source,0)}touches(t){return t.changes.touchesRange(this.from,this.to)}}function Zet(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e=="function"?e(i,n,r,t):ope(e,!0).test(i)}const v9=Xn.define({map(e,t){return e.map(n=>n.map(t))}}),cpe=Xn.define(),Io=na.define({create(){return KP.start()},update(e,t){return e.update(t)},provide:e=>[l9.from(e,t=>t.tooltip),St.contentAttributes.from(e,t=>t.attrs)]});function b9(e,t){const n=t.completion.apply||t.completion.label;let r=e.state.field(Io).active.find(i=>i.source==t.source);return r instanceof V0?(typeof n=="string"?e.dispatch(Object.assign(Object.assign({},Iet(e.state,n,r.from,r.to)),{annotations:m9.of(t.completion)})):n(e,t.completion,r.from,r.to),!0):!1}const Het=Uet(Io,b9);function fk(e,t="option"){return n=>{let r=n.state.field(Io,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(Zs).interactionDelay)return!1;let i=1,s;t=="page"&&(s=XOe(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(s.dom.offsetHeight/s.dom.querySelector("li").offsetHeight)-1));let{length:a}=r.open.options,o=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:a-1;return o<0?o=t=="page"?0:a-1:o>=a&&(o=t=="page"?a-1:0),n.dispatch({effects:cpe.of(o)}),!0}}const Ket=e=>{let t=e.state.field(Io,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(Zs).interactionDelay?!1:b9(e,t.open.options[t.open.selected])},GY=e=>e.state.field(Io,!1)?(e.dispatch({effects:HP.of(!0)}),!0):!1,Jet=e=>{let t=e.state.field(Io,!1);return!t||!t.active.some(n=>n.state!=0)?!1:(e.dispatch({effects:wx.of(null)}),!0)};class ett{constructor(t,n){this.active=t,this.context=n,this.time=Date.now(),this.updates=[],this.done=void 0}}const ttt=50,ntt=1e3,rtt=Ui.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(Io).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Io),n=e.state.facet(Zs);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Io)==t)return;let r=e.transactions.some(s=>{let a=lpe(s,n);return a&8||(s.selection||s.docChanged)&&!(a&3)});for(let s=0;s<this.running.length;s++){let a=this.running[s];if(r||a.context.abortOnDocChange&&e.docChanged||a.updates.length+e.transactions.length>ttt&&Date.now()-a.time>ntt){for(let o of a.context.abortListeners)try{o()}catch(l){Lo(this.view.state,l)}a.context.abortListeners=null,this.running.splice(s--,1)}else a.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(s=>s.effects.some(a=>a.is(HP)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(s=>s.isPending&&!this.running.some(a=>a.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of e.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Io);for(let n of t.active)n.isPending&&!this.running.some(r=>r.active.source==n.source)&&this.startQuery(n);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Zs).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=Gp(t),r=new g9(t,n,e.explicit,this.view),i=new ett(e,r);this.running.push(i),Promise.resolve(e.source(r)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:wx.of(null)}),Lo(this.view.state,s)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Zs).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Zs),r=this.view.state.field(Io);for(let i=0;i<this.running.length;i++){let s=this.running[i];if(s.done===void 0)continue;if(this.running.splice(i--,1),s.done){let o=Gp(s.updates.length?s.updates[0].startState:this.view.state),l=Math.min(o,s.done.from+(s.active.explicit?0:1)),c=new V0(s.active.source,s.active.explicit,l,s.done,s.done.from,(e=s.done.to)!==null&&e!==void 0?e:o);for(let u of s.updates)c=c.update(u,n);if(c.hasResult()){t.push(c);continue}}let a=r.active.find(o=>o.source==s.active.source);if(a&&a.isPending)if(s.done==null){let o=new sc(s.active.source,0);for(let l of s.updates)o=o.update(l,n);o.isPending||t.push(o)}else this.startQuery(a)}(t.length||r.open&&r.open.disabled)&&this.view.dispatch({effects:v9.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Io,!1);if(t&&t.tooltip&&this.view.state.facet(Zs).closeOnBlur){let n=t.open&&XOe(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:wx.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:HP.of(!1)}),20),this.composing=0}}}),itt=typeof navigator=="object"&&/Win/.test(navigator.platform),stt=Kh.highest(St.domEventHandlers({keydown(e,t){let n=t.state.field(Io,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(itt&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(a=>a.source==r.source),s=r.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(e.key)>-1&&b9(t,r),!1}})),upe=St.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class att{constructor(t,n,r,i){this.field=t,this.line=n,this.from=r,this.to=i}}class w9{constructor(t,n,r){this.field=t,this.from=n,this.to=r}map(t){let n=t.mapPos(this.from,-1,Oa.TrackDel),r=t.mapPos(this.to,1,Oa.TrackDel);return n==null||r==null?null:new w9(this.field,n,r)}}class y9{constructor(t,n){this.lines=t,this.fieldPositions=n}instantiate(t,n){let r=[],i=[n],s=t.doc.lineAt(n),a=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(r.length){let c=a,u=/^\t*/.exec(l)[0].length;for(let d=0;d<u;d++)c+=t.facet(T1);i.push(n+c.length-u),l=c+l.slice(u)}r.push(l),n+=l.length+1}let o=this.fieldPositions.map(l=>new w9(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:r,ranges:o}}static parse(t){let n=[],r=[],i=[],s;for(let a of t.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^}]*))?|((?:\\[{}]|[^}])*))\}/.exec(a);){let o=s[1]?+s[1]:null,l=s[2]||s[3]||"",c=-1,u=l.replace(/\\[{}]/g,d=>d[1]);for(let d=0;d<n.length;d++)(o!=null?n[d].seq==o:u&&n[d].name==u)&&(c=d);if(c<0){let d=0;for(;d<n.length&&(o==null||n[d].seq!=null&&n[d].seq<o);)d++;n.splice(d,0,{seq:o,name:u}),c=d;for(let h of i)h.field>=c&&h.field++}i.push(new att(c,r.length,s.index,s.index+u.length)),a=a.slice(0,s.index)+l+a.slice(s.index+s[0].length)}a=a.replace(/\\([{}])/g,(o,l,c)=>{for(let u of i)u.line==r.length&&u.from>c&&(u.from--,u.to--);return l}),r.push(a)}return new y9(r,i)}}let ott=qt.widget({widget:new class extends hu{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),ltt=qt.mark({class:"cm-snippetField"});class _1{constructor(t,n){this.ranges=t,this.active=n,this.deco=qt.set(t.map(r=>(r.from==r.to?ott:ltt).range(r.from,r.to)))}map(t){let n=[];for(let r of this.ranges){let i=r.map(t);if(!i)return null;n.push(i)}return new _1(n,this.active)}selectionInsideField(t){return t.ranges.every(n=>this.ranges.some(r=>r.field==this.active&&r.from<=n.from&&r.to>=n.to))}}const IS=Xn.define({map(e,t){return e&&e.map(t)}}),ctt=Xn.define(),yx=na.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(IS))return n.value;if(n.is(ctt)&&e)return new _1(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>St.decorations.from(e,t=>t?t.deco:qt.none)});function x9(e,t){return Ve.create(e.filter(n=>n.field==t).map(n=>Ve.range(n.from,n.to)))}function utt(e){let t=y9.parse(e);return(n,r,i,s)=>{let{text:a,ranges:o}=t.instantiate(n.state,i),{main:l}=n.state.selection,c={changes:{from:i,to:s==l.from?l.to:s,insert:Cr.of(a)},scrollIntoView:!0,annotations:r?[m9.of(r),Ps.userEvent.of("input.complete")]:void 0};if(o.length&&(c.selection=x9(o,0)),o.some(u=>u.field>0)){let u=new _1(o,0),d=c.effects=[IS.of(u)];n.state.field(yx,!1)===void 0&&d.push(Xn.appendConfig.of([yx,ptt,gtt,upe]))}n.dispatch(n.state.update(c))}}function dpe(e){return({state:t,dispatch:n})=>{let r=t.field(yx,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,s=e>0&&!r.ranges.some(a=>a.field==i+e);return n(t.update({selection:x9(r.ranges,i),effects:IS.of(s?null:new _1(r.ranges,i)),scrollIntoView:!0})),!0}}const dtt=({state:e,dispatch:t})=>e.field(yx,!1)?(t(e.update({effects:IS.of(null)})),!0):!1,htt=dpe(1),ftt=dpe(-1),Ott=[{key:"Tab",run:htt,shift:ftt},{key:"Escape",run:dtt}],VY=Ut.define({combine(e){return e.length?e[0]:Ott}}),ptt=Kh.highest(im.compute([VY],e=>e.facet(VY)));function gi(e,t){return Object.assign(Object.assign({},t),{apply:utt(e)})}const gtt=St.domEventHandlers({mousedown(e,t){let n=t.state.field(yx,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(s=>s.from<=r&&s.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:x9(n.ranges,i.field),effects:IS.of(n.ranges.some(s=>s.field>i.field)?new _1(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),xx={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Fp=Xn.define({map(e,t){let n=t.mapPos(e,-1,Oa.TrackAfter);return n??void 0}}),S9=new class extends Sg{};S9.startSide=1;S9.endSide=-1;const hpe=na.define({create(){return wr.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:r=>r>=n.from&&r<=n.to})}for(let n of t.effects)n.is(Fp)&&(e=e.update({add:[S9.range(n.value,n.value+1)]}));return e}});function mtt(){return[btt,hpe]}const zR="()[]{}<>«»»«[]{}";function fpe(e){for(let t=0;t<zR.length;t+=2)if(zR.charCodeAt(t)==e)return zR.charAt(t+1);return V7(e<128?e:e+1)}function Ope(e,t){return e.languageDataAt("closeBrackets",t)[0]||xx}const vtt=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),btt=St.inputHandler.of((e,t,n,r)=>{if((vtt?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let i=e.state.selection.main;if(r.length>2||r.length==2&&ju(Xo(r,0))==1||t!=i.from||n!=i.to)return!1;let s=xtt(e.state,r);return s?(e.dispatch(s),!0):!1}),wtt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let r=Ope(e,e.selection.main.head).brackets||xx.brackets,i=null,s=e.changeByRange(a=>{if(a.empty){let o=Stt(e.doc,a.head);for(let l of r)if(l==o&&_Q(e.doc,a.head)==fpe(Xo(l,0)))return{changes:{from:a.head-l.length,to:a.head+l.length},range:Ve.cursor(a.head-l.length)}}return{range:i=a}});return i||t(e.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},ytt=[{key:"Backspace",run:wtt}];function xtt(e,t){let n=Ope(e,e.selection.main.head),r=n.brackets||xx.brackets;for(let i of r){let s=fpe(Xo(i,0));if(t==i)return s==i?Ttt(e,i,r.indexOf(i+i+i)>-1,n):$tt(e,i,s,n.before||xx.before);if(t==s&&ppe(e,e.selection.main.from))return ktt(e,i,s)}return null}function ppe(e,t){let n=!1;return e.field(hpe).between(0,e.doc.length,r=>{r==t&&(n=!0)}),n}function _Q(e,t){let n=e.sliceString(t,t+2);return n.slice(0,ju(Xo(n,0)))}function Stt(e,t){let n=e.sliceString(t-2,t);return ju(Xo(n,0))==n.length?n:n.slice(1)}function $tt(e,t,n,r){let i=null,s=e.changeByRange(a=>{if(!a.empty)return{changes:[{insert:t,from:a.from},{insert:n,from:a.to}],effects:Fp.of(a.to+t.length),range:Ve.range(a.anchor+t.length,a.head+t.length)};let o=_Q(e.doc,a.head);return!o||/\s/.test(o)||r.indexOf(o)>-1?{changes:{insert:t+n,from:a.head},effects:Fp.of(a.head+t.length),range:Ve.cursor(a.head+t.length)}:{range:i=a}});return i?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function ktt(e,t,n){let r=null,i=e.changeByRange(s=>s.empty&&_Q(e.doc,s.head)==n?{changes:{from:s.head,to:s.head+n.length,insert:n},range:Ve.cursor(s.head+n.length)}:r={range:s});return r?null:e.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Ttt(e,t,n,r){let i=r.stringPrefixes||xx.stringPrefixes,s=null,a=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:t,from:o.to}],effects:Fp.of(o.to+t.length),range:Ve.range(o.anchor+t.length,o.head+t.length)};let l=o.head,c=_Q(e.doc,l),u;if(c==t){if(YY(e,l))return{changes:{insert:t+t,from:l},effects:Fp.of(l+t.length),range:Ve.cursor(l+t.length)};if(ppe(e,l)){let h=n&&e.sliceDoc(l,l+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:l,to:l+h.length,insert:h},range:Ve.cursor(l+h.length)}}}else{if(n&&e.sliceDoc(l-2*t.length,l)==t+t&&(u=BY(e,l-2*t.length,i))>-1&&YY(e,u))return{changes:{insert:t+t+t+t,from:l},effects:Fp.of(l+t.length),range:Ve.cursor(l+t.length)};if(e.charCategorizer(l)(c)!=Qi.Word&&BY(e,l,i)>-1&&!Ptt(e,l,t,i))return{changes:{insert:t+t,from:l},effects:Fp.of(l+t.length),range:Ve.cursor(l+t.length)}}return{range:s=o}});return s?null:e.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function YY(e,t){let n=kr(e).resolveInner(t+1);return n.parent&&n.from==t}function Ptt(e,t,n,r){let i=kr(e).resolveInner(t,-1),s=r.reduce((a,o)=>Math.max(a,o.length),0);for(let a=0;a<5;a++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+s)),l=o.indexOf(n);if(!l||l>-1&&r.indexOf(o.slice(0,l))>-1){let u=i.firstChild;for(;u&&u.from==i.from&&u.to-u.from>n.length+l;){if(e.sliceDoc(u.to-n.length,u.to)==n)return!1;u=u.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function BY(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=Qi.Word)return t;for(let i of n){let s=t-i.length;if(e.sliceDoc(s,t)==i&&r(e.sliceDoc(s-1,s))!=Qi.Word)return s}return-1}function _tt(e={}){return[stt,Io,Zs.of(e),rtt,Ctt,upe]}const gpe=[{key:"Ctrl-Space",run:GY},{mac:"Alt-`",run:GY},{key:"Escape",run:Jet},{key:"ArrowDown",run:fk(!0)},{key:"ArrowUp",run:fk(!1)},{key:"PageDown",run:fk(!0,"page")},{key:"PageUp",run:fk(!1,"page")},{key:"Enter",run:Ket}],Ctt=Kh.highest(im.computeN([Zs],e=>e.facet(Zs).defaultKeymap?[gpe]:[]));class JP{static create(t,n,r,i,s){let a=i+(i<<8)+t+(n<<4)|0;return new JP(t,n,r,a,s,[],[])}constructor(t,n,r,i,s,a,o){this.type=t,this.value=n,this.from=r,this.hash=i,this.end=s,this.children=a,this.positions=o,this.hashProp=[[En.contextHash,i]]}addChild(t,n){t.prop(En.contextHash)!=this.hash&&(t=new ur(t.type,t.children,t.positions,t.length,this.hashProp)),this.children.push(t),this.positions.push(n)}toTree(t,n=this.end){let r=this.children.length-1;return r>=0&&(n=Math.max(n,this.positions[r]+this.children[r].length+this.from)),new ur(t.types[this.type],this.children,this.positions,n-this.from).balance({makeTree:(i,s,a)=>new ur(_s.none,i,s,a,this.hashProp)})}}var wt;(function(e){e[e.Document=1]="Document",e[e.CodeBlock=2]="CodeBlock",e[e.FencedCode=3]="FencedCode",e[e.Blockquote=4]="Blockquote",e[e.HorizontalRule=5]="HorizontalRule",e[e.BulletList=6]="BulletList",e[e.OrderedList=7]="OrderedList",e[e.ListItem=8]="ListItem",e[e.ATXHeading1=9]="ATXHeading1",e[e.ATXHeading2=10]="ATXHeading2",e[e.ATXHeading3=11]="ATXHeading3",e[e.ATXHeading4=12]="ATXHeading4",e[e.ATXHeading5=13]="ATXHeading5",e[e.ATXHeading6=14]="ATXHeading6",e[e.SetextHeading1=15]="SetextHeading1",e[e.SetextHeading2=16]="SetextHeading2",e[e.HTMLBlock=17]="HTMLBlock",e[e.LinkReference=18]="LinkReference",e[e.Paragraph=19]="Paragraph",e[e.CommentBlock=20]="CommentBlock",e[e.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",e[e.Escape=22]="Escape",e[e.Entity=23]="Entity",e[e.HardBreak=24]="HardBreak",e[e.Emphasis=25]="Emphasis",e[e.StrongEmphasis=26]="StrongEmphasis",e[e.Link=27]="Link",e[e.Image=28]="Image",e[e.InlineCode=29]="InlineCode",e[e.HTMLTag=30]="HTMLTag",e[e.Comment=31]="Comment",e[e.ProcessingInstruction=32]="ProcessingInstruction",e[e.Autolink=33]="Autolink",e[e.HeaderMark=34]="HeaderMark",e[e.QuoteMark=35]="QuoteMark",e[e.ListMark=36]="ListMark",e[e.LinkMark=37]="LinkMark",e[e.EmphasisMark=38]="EmphasisMark",e[e.CodeMark=39]="CodeMark",e[e.CodeText=40]="CodeText",e[e.CodeInfo=41]="CodeInfo",e[e.LinkTitle=42]="LinkTitle",e[e.LinkLabel=43]="LinkLabel",e[e.URL=44]="URL"})(wt||(wt={}));class Qtt{constructor(t,n){this.start=t,this.content=n,this.marks=[],this.parsers=[]}}class Ett{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let t=this.skipSpace(this.basePos);this.indent=this.countIndent(t,this.pos,this.indent),this.pos=t,this.next=t==this.text.length?-1:this.text.charCodeAt(t)}skipSpace(t){return Fw(this.text,t)}reset(t){for(this.text=t,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(t){this.basePos=t,this.baseIndent=this.countIndent(t,this.pos,this.indent)}moveBaseColumn(t){this.baseIndent=t,this.basePos=this.findColumn(t)}addMarker(t){this.markers.push(t)}countIndent(t,n=0,r=0){for(let i=n;i<t;i++)r+=this.text.charCodeAt(i)==9?4-r%4:1;return r}findColumn(t){let n=0;for(let r=0;n<this.text.length&&r<t;n++)r+=this.text.charCodeAt(n)==9?4-r%4:1;return n}scrub(){if(!this.baseIndent)return this.text;let t="";for(let n=0;n<this.basePos;n++)t+=" ";return t+this.text.slice(this.basePos)}}function ZY(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==wt.OrderedList?T9:k9)(n,t,!1);return r>0&&(e.type!=wt.BulletList||$9(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}const mpe={[wt.Blockquote](e,t,n){return n.next!=62?!1:(n.markers.push(fr(wt.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(kc(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0)},[wt.ListItem](e,t,n){return n.indent<n.baseIndent+e.value&&n.next>-1?!1:(n.moveBaseColumn(n.baseIndent+e.value),!0)},[wt.OrderedList]:ZY,[wt.BulletList]:ZY,[wt.Document](){return!0}};function kc(e){return e==32||e==9||e==10||e==13}function Fw(e,t=0){for(;t<e.length&&kc(e.charCodeAt(t));)t++;return t}function HY(e,t,n){for(;t>n&&kc(e.charCodeAt(t-1));)t--;return t}function vpe(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(e.next==96){for(let n=t;n<e.text.length;n++)if(e.text.charCodeAt(n)==96)return-1}return t}function bpe(e){return e.next!=62?-1:e.text.charCodeAt(e.pos+1)==32?2:1}function $9(e,t,n){if(e.next!=42&&e.next!=45&&e.next!=95)return-1;let r=1;for(let i=e.pos+1;i<e.text.length;i++){let s=e.text.charCodeAt(i);if(s==e.next)r++;else if(!kc(s))return-1}return n&&e.next==45&&xpe(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(Tpe.SetextHeading)>-1||r<3?-1:1}function wpe(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function k9(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||kc(e.text.charCodeAt(e.pos+1)))&&(!n||wpe(t,wt.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function T9(e,t,n){let r=e.pos,i=e.next;for(;i>=48&&i<=57;){r++;if(r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||r<e.text.length-1&&!kc(e.text.charCodeAt(r+1))||n&&!wpe(t,wt.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function ype(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==35;)t++;if(t<e.text.length&&e.text.charCodeAt(t)!=32)return-1;let n=t-e.pos;return n>6?-1:n}function xpe(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&kc(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}const cI=/^[ \t]*$/,Spe=/-->/,$pe=/\?>/,uI=[[/^<(?:script|pre|style)(?:\s|>|$)/i,/<\/(?:script|pre|style)>/i],[/^\s*<!--/,Spe],[/^\s*<\?/,$pe],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?: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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,cI],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,cI]];function kpe(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let i=0,s=uI.length-(n?1:0);i<s;i++)if(uI[i][0].test(r))return i;return-1}function KY(e,t){let n=e.countIndent(t,e.pos,e.indent),r=e.countIndent(e.skipSpace(t),t,n);return r>=n+5?n+1:r}function Op(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==wt.CodeText?e[r].to=n:e.push(fr(wt.CodeText,t,n))}const Ok={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let r=t.findColumn(n),i=e.lineStart+r,s=e.lineStart+t.text.length,a=[],o=[];for(Op(a,i,s);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){Op(o,e.lineStart-1,e.lineStart);for(let l of t.markers)o.push(l)}else{if(t.indent<n)break;{if(o.length){for(let c of o)c.type==wt.CodeText?Op(a,c.from,c.to):a.push(c);o=[]}Op(a,e.lineStart-1,e.lineStart);for(let c of t.markers)a.push(c);s=e.lineStart+t.text.length;let l=e.lineStart+t.findColumn(t.baseIndent+4);l<s&&Op(a,l,s)}}return o.length&&(o=o.filter(l=>l.type!=wt.CodeText),o.length&&(t.markers=o.concat(t.markers))),e.addNode(e.buffer.writeElements(a,-i).finish(wt.CodeBlock,s-i),i),!0},FencedCode(e,t){let n=vpe(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,s=n-t.pos,a=t.skipSpace(n),o=HY(t.text,t.text.length,a),l=[fr(wt.CodeMark,r,r+s)];a<o&&l.push(fr(wt.CodeInfo,e.lineStart+a,e.lineStart+o));for(let c=!0;e.nextLine()&&t.depth>=e.stack.length;c=!1){let u=t.pos;if(t.indent-t.baseIndent<4)for(;u<t.text.length&&t.text.charCodeAt(u)==i;)u++;if(u-t.pos>=s&&t.skipSpace(u)==t.text.length){for(let d of t.markers)l.push(d);l.push(fr(wt.CodeMark,e.lineStart+t.pos,e.lineStart+u)),e.nextLine();break}else{c||Op(l,e.lineStart-1,e.lineStart);for(let f of t.markers)l.push(f);let d=e.lineStart+t.basePos,h=e.lineStart+t.text.length;d<h&&Op(l,d,h)}}return e.addNode(e.buffer.writeElements(l,-r).finish(wt.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=bpe(t);return n<0?!1:(e.startContext(wt.Blockquote,t.pos),e.addNode(wt.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if($9(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(wt.HorizontalRule,n),!0},BulletList(e,t){let n=k9(t,e,!1);if(n<0)return!1;e.block.type!=wt.BulletList&&e.startContext(wt.BulletList,t.basePos,t.next);let r=KY(t,t.pos+1);return e.startContext(wt.ListItem,t.basePos,r-t.baseIndent),e.addNode(wt.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},OrderedList(e,t){let n=T9(t,e,!1);if(n<0)return!1;e.block.type!=wt.OrderedList&&e.startContext(wt.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=KY(t,t.pos+n);return e.startContext(wt.ListItem,t.basePos,r-t.baseIndent),e.addNode(wt.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),null},ATXHeading(e,t){let n=ype(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,s=HY(t.text,t.text.length,r),a=s;for(;a>r&&t.text.charCodeAt(a-1)==t.next;)a--;(a==s||a==r||!kc(t.text.charCodeAt(a-1)))&&(a=t.text.length);let o=e.buffer.write(wt.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,a),i+n+1),-i);a<t.text.length&&o.write(wt.HeaderMark,a-r,s-r);let l=o.finish(wt.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(l,i),!0},HTMLBlock(e,t){let n=kpe(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=uI[n][1],s=[],a=i!=cI;for(;!i.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){a=!1;break}for(let c of t.markers)s.push(c)}a&&e.nextLine();let o=i==Spe?wt.CommentBlock:i==$pe?wt.ProcessingInstructionBlock:wt.HTMLBlock,l=e.prevLineEnd();return e.addNode(e.buffer.writeElements(s,-r).finish(o,l-r),r),!0},SetextHeading:void 0};class Rtt{constructor(t){this.stage=0,this.elts=[],this.pos=0,this.start=t.start,this.advance(t.content)}nextLine(t,n,r){if(this.stage==-1)return!1;let i=r.content+`
|
|
1088
1088
|
`+n.scrub(),s=this.advance(i);return s>-1&&s<i.length?this.complete(t,r,s):!1}finish(t,n){return(this.stage==2||this.stage==3)&&Fw(n.content,this.pos)==n.content.length?this.complete(t,n,n.content.length):!1}complete(t,n,r){return t.addLeafElement(n,fr(wt.LinkReference,this.start,this.start+r,this.elts)),!0}nextStage(t){return t?(this.pos=t.to-this.start,this.elts.push(t),this.stage++,!0):(t===!1&&(this.stage=-1),!1)}advance(t){for(;;){if(this.stage==-1)return-1;if(this.stage==0){if(!this.nextStage(Dpe(t,this.pos,this.start,!0)))return-1;if(t.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(fr(wt.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(Ape(t,Fw(t,this.pos),this.start)))return-1}else if(this.stage==2){let n=Fw(t,this.pos),r=0;if(n>this.pos){let i=Xpe(t,n,this.start);if(i){let s=LR(t,i.to-this.start);s>0&&(this.nextStage(i),r=s)}}return r||(r=LR(t,this.pos)),r>0&&r<t.length?r:-1}else return LR(t,this.pos)}}}function LR(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(n==10)break;if(!kc(n))return-1}return t}class Att{nextLine(t,n,r){let i=n.depth<t.stack.length?-1:xpe(n),s=n.next;if(i<0)return!1;let a=fr(wt.HeaderMark,t.lineStart+n.pos,t.lineStart+i);return t.nextLine(),t.addLeafElement(r,fr(s==61?wt.SetextHeading1:wt.SetextHeading2,r.start,t.prevLineEnd(),[...t.parser.parseInline(r.content,r.start),a])),!0}finish(){return!1}}const Tpe={LinkReference(e,t){return t.content.charCodeAt(0)==91?new Rtt(t):null},SetextHeading(){return new Att}},Xtt=[(e,t)=>ype(t)>=0,(e,t)=>vpe(t)>=0,(e,t)=>bpe(t)>=0,(e,t)=>k9(t,e,!0)>=0,(e,t)=>T9(t,e,!0)>=0,(e,t)=>$9(t,e,!0)>=0,(e,t)=>kpe(t,e,!0)>=0],Dtt={text:"",end:0};class Itt{constructor(t,n,r,i){this.parser=t,this.input=n,this.ranges=i,this.line=new Ett,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=i[i.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=i[0].from,this.block=JP.create(wt.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=r.length?new ztt(r,n):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:t}=this;for(;;){for(let r=0;;){let i=t.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;r<t.markers.length&&(!i||t.markers[r].from<i.end);){let s=t.markers[r++];this.addNode(s.type,s.from,s.to)}if(!i)break;this.finishContext()}if(t.pos<t.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(t.basePos))return null;e:for(;;){for(let r of this.parser.blockParsers)if(r){let i=r(this,t);if(i!=!1){if(i==!0)return null;t.forward();continue e}}break}let n=new Qtt(this.lineStart+t.pos,t.text.slice(t.pos));for(let r of this.parser.leafBlockParsers)if(r){let i=r(this,n);i&&n.parsers.push(i)}e:for(;this.nextLine()&&t.pos!=t.text.length;){if(t.indent<t.baseIndent+4){for(let r of this.parser.endLeafBlock)if(r(this,t,n))break e}for(let r of n.parsers)if(r.nextLine(this,t,n))return null;n.content+=`
|
|
1089
1089
|
`+t.scrub();for(let r of t.markers)n.marks.push(r)}return this.finishLeaf(n),null}stopAt(t){if(this.stoppedAt!=null&&this.stoppedAt<t)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=t}reuseFragment(t){if(!this.fragments.moveTo(this.absoluteLineStart+t,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let n=this.fragments.takeNodes(this);return n?(this.absoluteLineStart+=n,this.lineStart=Ipe(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(t=this.depth-1){return this.parser.nodeSet.types[this.stack[t].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(t){let n=Dtt;if(n.end=t,t>=this.to)n.text="";else if(n.text=this.lineChunkAt(t),n.end+=n.text.length,this.ranges.length>1){let r=this.absoluteLineStart,i=this.rangeI;for(;this.ranges[i].to<n.end;){i++;let s=this.ranges[i].from,a=this.lineChunkAt(s);n.end=s+a.length,n.text=n.text.slice(0,this.ranges[i-1].to-r)+a,r=n.end-n.text.length}}return n}readLine(){let{line:t}=this,{text:n,end:r}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=r,t.reset(n);t.depth<this.stack.length;t.depth++){let i=this.stack[t.depth],s=this.parser.skipContextMarkup[i.type];if(!s)throw new Error("Unhandled block context "+wt[i.type]);if(!s(i,this,t))break;t.forward()}}lineChunkAt(t){let n=this.input.chunk(t),r;if(this.input.lineChunks)r=n==`
|
|
1090
1090
|
`?"":n;else{let i=n.indexOf(`
|
|
@@ -1335,7 +1335,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),np=lt,Br=Ht);const wu=
|
|
|
1335
1335
|
* LICENSE file in the root directory of this source tree.
|
|
1336
1336
|
*/var ise;function Ocn(){if(ise)return jb;ise=1;var e=me,t=Symbol.for("react.element"),n=Symbol.for("react.fragment"),r=Object.prototype.hasOwnProperty,i=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function a(o,l,c){var u,d={},h=null,f=null;c!==void 0&&(h=""+c),l.key!==void 0&&(h=""+l.key),l.ref!==void 0&&(f=l.ref);for(u in l)r.call(l,u)&&!s.hasOwnProperty(u)&&(d[u]=l[u]);if(o&&o.defaultProps)for(u in l=o.defaultProps,l)d[u]===void 0&&(d[u]=l[u]);return{$$typeof:t,type:o,key:h,ref:f,props:d,_owner:i.current}}return jb.Fragment=n,jb.jsx=a,jb.jsxs=a,jb}var sse;function pcn(){return sse||(sse=1,rse.exports=Ocn()),rse.exports}var gcn=pcn();/*! shepherd.js 14.5.0 */function mcn(e){return e instanceof Element}function s1(e){return e instanceof HTMLElement}function AO(e){return typeof e=="function"}function hS(e){return typeof e=="string"}function Ia(e){return e===void 0}class PL{on(t,n,r,i=!1){var s;return Ia(this.bindings)&&(this.bindings={}),Ia(this.bindings[t])&&(this.bindings[t]=[]),(s=this.bindings[t])==null||s.push({handler:n,ctx:r,once:i}),this}once(t,n,r){return this.on(t,n,r,!0)}off(t,n){if(Ia(this.bindings)||Ia(this.bindings[t]))return this;if(Ia(n))delete this.bindings[t];else{var r;(r=this.bindings[t])==null||r.forEach((i,s)=>{if(i.handler===n){var a;(a=this.bindings[t])==null||a.splice(s,1)}})}return this}trigger(t,...n){if(!Ia(this.bindings)&&this.bindings[t]){var r;(r=this.bindings[t])==null||r.forEach((i,s)=>{const{ctx:a,handler:o,once:l}=i,c=a||this;if(o.apply(c,n),l){var u;(u=this.bindings[t])==null||u.splice(s,1)}})}return this}}function Go(){return Go=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},Go.apply(null,arguments)}function _L(e,t){if(e==null)return{};var n={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(t.includes(r))continue;n[r]=e[r]}return n}const KO={defaultMerge:Symbol("deepmerge-ts: default merge"),skip:Symbol("deepmerge-ts: skip")};KO.defaultMerge;function vcn(e,t){return t}function bcn(e,t){return e.filter(n=>n!==void 0)}var ase;(function(e){e[e.NOT=0]="NOT",e[e.RECORD=1]="RECORD",e[e.ARRAY=2]="ARRAY",e[e.SET=3]="SET",e[e.MAP=4]="MAP",e[e.OTHER=5]="OTHER"})(ase||(ase={}));function ose(e){return typeof e!="object"||e===null?0:Array.isArray(e)?2:xcn(e)?1:e instanceof Set?3:e instanceof Map?4:5}function wcn(e){const t=new Set;for(const n of e)for(const r of[...Object.keys(n),...Object.getOwnPropertySymbols(n)])t.add(r);return t}function ycn(e,t){return typeof e=="object"&&Object.prototype.propertyIsEnumerable.call(e,t)}function JPe(e){return{*[Symbol.iterator](){for(const t of e)for(const n of t)yield n}}}const lse=new Set(["[object Object]","[object Module]"]);function xcn(e){if(!lse.has(Object.prototype.toString.call(e)))return!1;const{constructor:t}=e;if(t===void 0)return!0;const n=t.prototype;return!(n===null||typeof n!="object"||!lse.has(Object.prototype.toString.call(n))||!n.hasOwnProperty("isPrototypeOf"))}function Scn(e,t,n){const r={};for(const i of wcn(e)){const s=[];for(const l of e)ycn(l,i)&&s.push(l[i]);if(s.length===0)continue;const a=t.metaDataUpdater(n,{key:i,parents:e}),o=e_e(s,t,a);o!==KO.skip&&(i==="__proto__"?Object.defineProperty(r,i,{value:o,configurable:!0,enumerable:!0,writable:!0}):r[i]=o)}return r}function $cn(e){return e.flat()}function kcn(e){return new Set(JPe(e))}function Tcn(e){return new Map(JPe(e))}function Pcn(e){return e.at(-1)}const _T={mergeRecords:Scn,mergeArrays:$cn,mergeSets:kcn,mergeMaps:Tcn,mergeOthers:Pcn};function CL(...e){return _cn({})(...e)}function _cn(e,t){const n=Ccn(e,r);function r(...i){return e_e(i,n,t)}return r}function Ccn(e,t){var n,r,i;return{defaultMergeFunctions:_T,mergeFunctions:Go({},_T,Object.fromEntries(Object.entries(e).filter(([s,a])=>Object.hasOwn(_T,s)).map(([s,a])=>a===!1?[s,_T.mergeOthers]:[s,a]))),metaDataUpdater:(n=e.metaDataUpdater)!=null?n:vcn,deepmerge:t,useImplicitDefaultMerging:(r=e.enableImplicitDefaultMerging)!=null?r:!1,filterValues:e.filterValues===!1?void 0:(i=e.filterValues)!=null?i:bcn,actions:KO}}function e_e(e,t,n){var r;const i=(r=t.filterValues==null?void 0:t.filterValues(e,n))!=null?r:e;if(i.length===0)return;if(i.length===1)return SX(i,t,n);const s=ose(i[0]);if(s!==0&&s!==5){for(let a=1;a<i.length;a++)if(ose(i[a])!==s)return SX(i,t,n)}switch(s){case 1:return Qcn(i,t,n);case 2:return Ecn(i,t,n);case 3:return Rcn(i,t,n);case 4:return Acn(i,t,n);default:return SX(i,t,n)}}function Qcn(e,t,n){const r=t.mergeFunctions.mergeRecords(e,t,n);return r===KO.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeRecords!==t.defaultMergeFunctions.mergeRecords?t.defaultMergeFunctions.mergeRecords(e,t,n):r}function Ecn(e,t,n){const r=t.mergeFunctions.mergeArrays(e,t,n);return r===KO.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeArrays!==t.defaultMergeFunctions.mergeArrays?t.defaultMergeFunctions.mergeArrays(e):r}function Rcn(e,t,n){const r=t.mergeFunctions.mergeSets(e,t,n);return r===KO.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeSets!==t.defaultMergeFunctions.mergeSets?t.defaultMergeFunctions.mergeSets(e):r}function Acn(e,t,n){const r=t.mergeFunctions.mergeMaps(e,t,n);return r===KO.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeMaps!==t.defaultMergeFunctions.mergeMaps?t.defaultMergeFunctions.mergeMaps(e):r}function SX(e,t,n){const r=t.mergeFunctions.mergeOthers(e,t,n);return r===KO.defaultMerge||t.useImplicitDefaultMerging&&r===void 0&&t.mergeFunctions.mergeOthers!==t.defaultMergeFunctions.mergeOthers?t.defaultMergeFunctions.mergeOthers(e):r}function QL(e){const t=Object.getOwnPropertyNames(e.constructor.prototype);for(let n=0;n<t.length;n++){const r=t[n],i=e[r];r!=="constructor"&&typeof i=="function"&&(e[r]=i.bind(e))}return e}function Xcn(e,t){return n=>{if(e.isOpen()){const r=e.el&&n.currentTarget===e.el;(!Ia(t)&&n.currentTarget.matches(t)||r)&&e.tour.next()}}}function Dcn(e){const{event:t,selector:n}=e.options.advanceOn||{};if(t){const r=Xcn(e,n);let i=null;if(!Ia(n)&&(i=document.querySelector(n),!i))return console.error(`No element was found for the selector supplied to advanceOn: ${n}`);i?(i.addEventListener(t,r),e.on("destroy",()=>i.removeEventListener(t,r))):(document.body.addEventListener(t,r,!0),e.on("destroy",()=>document.body.removeEventListener(t,r,!0)))}else return console.error("advanceOn was defined, but no event name was passed.")}class Icn{constructor(t){}}class Ncn{constructor(t,n){}}function t_e(e){return!hS(e)||e===""?"":e.charAt(e.length-1)!=="-"?`${e}-`:e}function Fcn(e){const t=e.options.attachTo||{},n=Object.assign({},t);if(AO(n.element)&&(n.element=n.element.call(e)),hS(n.element)){try{n.element=document.querySelector(n.element)}catch{}n.element||console.error(`The element for this Shepherd step was not found ${t.element}`)}return n}function Mcn(e){return e.options.extraHighlights?e.options.extraHighlights.flatMap(t=>Array.from(document.querySelectorAll(t))):[]}function n_e(e){return e==null?!0:!e.element||!e.on}function r_e(){let e=Date.now();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const n=(e+Math.random()*16)%16|0;return e=Math.floor(e/16),(t=="x"?n:n&3|8).toString(16)})}const zcn=["top","right","bottom","left"],cse=["start","end"],use=zcn.reduce((e,t)=>e.concat(t,t+"-"+cse[0],t+"-"+cse[1]),[]),a1=Math.min,lg=Math.max,kC=Math.round,CT=Math.floor,dd=e=>({x:e,y:e}),Lcn={left:"right",right:"left",bottom:"top",top:"bottom"},qcn={start:"end",end:"start"};function QF(e,t,n){return lg(e,a1(t,n))}function Bg(e,t){return typeof e=="function"?e(t):e}function Yh(e){return e.split("-")[0]}function Qh(e){return e.split("-")[1]}function EL(e){return e==="x"?"y":"x"}function RL(e){return e==="y"?"height":"width"}function o1(e){return["top","bottom"].includes(Yh(e))?"y":"x"}function AL(e){return EL(o1(e))}function i_e(e,t,n){n===void 0&&(n=!1);const r=Qh(e),i=AL(e),s=RL(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(a=PC(a)),[a,PC(a)]}function Ucn(e){const t=PC(e);return[TC(e),t,TC(t)]}function TC(e){return e.replace(/start|end/g,t=>qcn[t])}function Wcn(e,t,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],a=["bottom","top"];switch(e){case"top":case"bottom":return n?t?i:r:t?r:i;case"left":case"right":return t?s:a;default:return[]}}function jcn(e,t,n,r){const i=Qh(e);let s=Wcn(Yh(e),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),t&&(s=s.concat(s.map(TC)))),s}function PC(e){return e.replace(/left|right|bottom|top/g,t=>Lcn[t])}function Gcn(e){return Go({top:0,right:0,bottom:0,left:0},e)}function s_e(e){return typeof e!="number"?Gcn(e):{top:e,right:e,bottom:e,left:e}}function _C(e){const{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}const Vcn=["crossAxis","alignment","allowedPlacements","autoAlignment"],Ycn=["mainAxis","crossAxis","fallbackPlacements","fallbackStrategy","fallbackAxisSideDirection","flipAlignment"],Bcn=["mainAxis","crossAxis","limiter"];function dse(e,t,n){let{reference:r,floating:i}=e;const s=o1(t),a=AL(t),o=RL(a),l=Yh(t),c=s==="y",u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,h=r[o]/2-i[o]/2;let f;switch(l){case"top":f={x:u,y:r.y-i.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-i.width,y:d};break;default:f={x:r.x,y:r.y}}switch(Qh(t)){case"start":f[a]-=h*(n&&c?-1:1);break;case"end":f[a]+=h*(n&&c?-1:1);break}return f}const Zcn=async(e,t,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,o=s.filter(Boolean),l=await(a.isRTL==null?void 0:a.isRTL(t));let c=await a.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=dse(c,r,l),h=r,f={},p=0;for(let g=0;g<o.length;g++){const{name:m,fn:v}=o[g],{x:b,y,data:T,reset:x}=await v({x:u,y:d,initialPlacement:r,placement:h,strategy:i,middlewareData:f,rects:c,platform:a,elements:{reference:e,floating:t}});u=b??u,d=y??d,f=Go({},f,{[m]:Go({},f[m],T)}),x&&p<=50&&(p++,typeof x=="object"&&(x.placement&&(h=x.placement),x.rects&&(c=x.rects===!0?await a.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=dse(c,h,l)),g=-1)}return{x:u,y:d,placement:h,strategy:i,middlewareData:f}};async function XL(e,t){var n;t===void 0&&(t={});const{x:r,y:i,platform:s,rects:a,elements:o,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:h=!1,padding:f=0}=Bg(t,e),p=s_e(f),g=o[h?d==="floating"?"reference":"floating":d],m=_C(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(g)))==null||n?g:g.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(o.floating)),boundary:c,rootBoundary:u,strategy:l})),v=d==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,b=await(s.getOffsetParent==null?void 0:s.getOffsetParent(o.floating)),y=await(s.isElement==null?void 0:s.isElement(b))?await(s.getScale==null?void 0:s.getScale(b))||{x:1,y:1}:{x:1,y:1},T=_C(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:v,offsetParent:b,strategy:l}):v);return{top:(m.top-T.top+p.top)/y.y,bottom:(T.bottom-m.bottom+p.bottom)/y.y,left:(m.left-T.left+p.left)/y.x,right:(T.right-m.right+p.right)/y.x}}const Hcn=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:i,rects:s,platform:a,elements:o,middlewareData:l}=t,{element:c,padding:u=0}=Bg(e,t)||{};if(c==null)return{};const d=s_e(u),h={x:n,y:r},f=AL(i),p=RL(f),g=await a.getDimensions(c),m=f==="y",v=m?"top":"left",b=m?"bottom":"right",y=m?"clientHeight":"clientWidth",T=s.reference[p]+s.reference[f]-h[f]-s.floating[p],x=h[f]-s.reference[f],S=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let k=S?S[y]:0;(!k||!await(a.isElement==null?void 0:a.isElement(S)))&&(k=o.floating[y]||s.floating[p]);const Q=T/2-x/2,C=k/2-g[p]/2-1,_=a1(d[v],C),R=a1(d[b],C),A=_,I=k-g[p]-R,W=k/2-g[p]/2+Q,G=QF(A,W,I),U=!l.arrow&&Qh(i)!=null&&W!==G&&s.reference[p]/2-(W<A?_:R)-g[p]/2<0,q=U?W<A?W-A:W-I:0;return{[f]:h[f]+q,data:Go({[f]:G,centerOffset:W-G-q},U&&{alignmentOffset:q}),reset:U}}});function Kcn(e,t,n){return(e?[...n.filter(r=>Qh(r)===e),...n.filter(r=>Qh(r)!==e)]:n.filter(r=>Yh(r)===r)).filter(r=>e?Qh(r)===e||(t?TC(r)!==r:!1):!0)}const Jcn=function(e){return e===void 0&&(e={}),{name:"autoPlacement",options:e,async fn(t){var n,r,i;const{rects:s,middlewareData:a,placement:o,platform:l,elements:c}=t,u=Bg(e,t),{crossAxis:d=!1,alignment:h,allowedPlacements:f=use,autoAlignment:p=!0}=u,g=_L(u,Vcn),m=h!==void 0||f===use?Kcn(h||null,p,f):f,v=await XL(t,g),b=((n=a.autoPlacement)==null?void 0:n.index)||0,y=m[b];if(y==null)return{};const T=i_e(y,s,await(l.isRTL==null?void 0:l.isRTL(c.floating)));if(o!==y)return{reset:{placement:m[0]}};const x=[v[Yh(y)],v[T[0]],v[T[1]]],S=[...((r=a.autoPlacement)==null?void 0:r.overflows)||[],{placement:y,overflows:x}],k=m[b+1];if(k)return{data:{index:b+1,overflows:S},reset:{placement:k}};const Q=S.map(_=>{const R=Qh(_.placement);return[_.placement,R&&d?_.overflows.slice(0,2).reduce((A,I)=>A+I,0):_.overflows[0],_.overflows]}).sort((_,R)=>_[1]-R[1]),C=((i=Q.filter(_=>_[2].slice(0,Qh(_[0])?2:3).every(R=>R<=0))[0])==null?void 0:i[0])||Q[0][0];return C!==o?{data:{index:b+1,overflows:S},reset:{placement:C}}:{}}}},eun=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:i,middlewareData:s,rects:a,initialPlacement:o,platform:l,elements:c}=t,u=Bg(e,t),{mainAxis:d=!0,crossAxis:h=!0,fallbackPlacements:f,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:m=!0}=u,v=_L(u,Ycn);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const b=Yh(i),y=o1(o),T=Yh(o)===o,x=await(l.isRTL==null?void 0:l.isRTL(c.floating)),S=f||(T||!m?[PC(o)]:Ucn(o)),k=g!=="none";!f&&k&&S.push(...jcn(o,m,g,x));const Q=[o,...S],C=await XL(t,v),_=[];let R=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&_.push(C[b]),h){const G=i_e(i,a,x);_.push(C[G[0]],C[G[1]])}if(R=[...R,{placement:i,overflows:_}],!_.every(G=>G<=0)){var A,I;const G=(((A=s.flip)==null?void 0:A.index)||0)+1,U=Q[G];if(U)return{data:{index:G,overflows:R},reset:{placement:U}};let q=(I=R.filter(B=>B.overflows[0]<=0).sort((B,j)=>B.overflows[1]-j.overflows[1])[0])==null?void 0:I.placement;if(!q)switch(p){case"bestFit":{var W;const B=(W=R.filter(j=>{if(k){const M=o1(j.placement);return M===y||M==="y"}return!0}).map(j=>[j.placement,j.overflows.filter(M=>M>0).reduce((M,K)=>M+K,0)]).sort((j,M)=>j[1]-M[1])[0])==null?void 0:W[0];B&&(q=B);break}case"initialPlacement":q=o;break}if(i!==q)return{reset:{placement:q}}}return{}}}},tun=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:i}=t,s=Bg(e,t),{mainAxis:a=!0,crossAxis:o=!1,limiter:l={fn:v=>{let{x:b,y}=v;return{x:b,y}}}}=s,c=_L(s,Bcn),u={x:n,y:r},d=await XL(t,c),h=o1(Yh(i)),f=EL(h);let p=u[f],g=u[h];if(a){const v=f==="y"?"top":"left",b=f==="y"?"bottom":"right",y=p+d[v],T=p-d[b];p=QF(y,p,T)}if(o){const v=h==="y"?"top":"left",b=h==="y"?"bottom":"right",y=g+d[v],T=g-d[b];g=QF(y,g,T)}const m=l.fn(Go({},t,{[f]:p,[h]:g}));return Go({},m,{data:{x:m.x-n,y:m.y-r}})}}},nun=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:i,rects:s,middlewareData:a}=t,{offset:o=0,mainAxis:l=!0,crossAxis:c=!0}=Bg(e,t),u={x:n,y:r},d=o1(i),h=EL(d);let f=u[h],p=u[d];const g=Bg(o,t),m=typeof g=="number"?{mainAxis:g,crossAxis:0}:Go({mainAxis:0,crossAxis:0},g);if(l){const y=h==="y"?"height":"width",T=s.reference[h]-s.floating[y]+m.mainAxis,x=s.reference[h]+s.reference[y]-m.mainAxis;f<T?f=T:f>x&&(f=x)}if(c){var v,b;const y=h==="y"?"width":"height",T=["top","left"].includes(Yh(i)),x=s.reference[d]-s.floating[y]+(T&&((v=a.offset)==null?void 0:v[d])||0)+(T?0:m.crossAxis),S=s.reference[d]+s.reference[y]+(T?0:((b=a.offset)==null?void 0:b[d])||0)-(T?m.crossAxis:0);p<x?p=x:p>S&&(p=S)}return{[h]:f,[d]:p}}}};function FE(){return typeof window<"u"}function W1(e){return a_e(e)?(e.nodeName||"").toLowerCase():"#document"}function kl(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Xd(e){var t;return(t=(a_e(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function a_e(e){return FE()?e instanceof Node||e instanceof kl(e).Node:!1}function lu(e){return FE()?e instanceof Element||e instanceof kl(e).Element:!1}function xd(e){return FE()?e instanceof HTMLElement||e instanceof kl(e).HTMLElement:!1}function hse(e){return!FE()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof kl(e).ShadowRoot}function u$(e){const{overflow:t,overflowX:n,overflowY:r,display:i}=cu(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(i)}function run(e){return["table","td","th"].includes(W1(e))}function ME(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function DL(e){const t=IL(),n=lu(e)?cu(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function iun(e){let t=XO(e);for(;xd(t)&&!l1(t);){if(DL(t))return t;if(ME(t))return null;t=XO(t)}return null}function IL(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function l1(e){return["html","body","#document"].includes(W1(e))}function cu(e){return kl(e).getComputedStyle(e)}function zE(e){return lu(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function XO(e){if(W1(e)==="html")return e;const t=e.assignedSlot||e.parentNode||hse(e)&&e.host||Xd(e);return hse(t)?t.host:t}function o_e(e){const t=XO(e);return l1(t)?e.ownerDocument?e.ownerDocument.body:e.body:xd(t)&&u$(t)?t:o_e(t)}function fS(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const i=o_e(e),s=i===((r=e.ownerDocument)==null?void 0:r.body),a=kl(i);if(s){const o=EF(a);return t.concat(a,a.visualViewport||[],u$(i)?i:[],o&&n?fS(o):[])}return t.concat(i,fS(i,[],n))}function EF(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function l_e(e){const t=cu(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const i=xd(e),s=i?e.offsetWidth:n,a=i?e.offsetHeight:r,o=kC(n)!==s||kC(r)!==a;return o&&(n=s,r=a),{width:n,height:r,$:o}}function NL(e){return lu(e)?e:e.contextElement}function hv(e){const t=NL(e);if(!xd(t))return dd(1);const n=t.getBoundingClientRect(),{width:r,height:i,$:s}=l_e(t);let a=(s?kC(n.width):n.width)/r,o=(s?kC(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!o||!Number.isFinite(o))&&(o=1),{x:a,y:o}}const sun=dd(0);function c_e(e){const t=kl(e);return!IL()||!t.visualViewport?sun:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function aun(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==kl(e)?!1:t}function Zg(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const i=e.getBoundingClientRect(),s=NL(e);let a=dd(1);t&&(r?lu(r)&&(a=hv(r)):a=hv(e));const o=aun(s,n,r)?c_e(s):dd(0);let l=(i.left+o.x)/a.x,c=(i.top+o.y)/a.y,u=i.width/a.x,d=i.height/a.y;if(s){const h=kl(s),f=r&&lu(r)?kl(r):r;let p=h,g=EF(p);for(;g&&r&&f!==p;){const m=hv(g),v=g.getBoundingClientRect(),b=cu(g),y=v.left+(g.clientLeft+parseFloat(b.paddingLeft))*m.x,T=v.top+(g.clientTop+parseFloat(b.paddingTop))*m.y;l*=m.x,c*=m.y,u*=m.x,d*=m.y,l+=y,c+=T,p=kl(g),g=EF(p)}}return _C({width:u,height:d,x:l,y:c})}function FL(e,t){const n=zE(e).scrollLeft;return t?t.left+n:Zg(Xd(e)).left+n}function u_e(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-(n?0:FL(e,r)),s=r.top+t.scrollTop;return{x:i,y:s}}function oun(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e;const s=i==="fixed",a=Xd(r),o=t?ME(t.floating):!1;if(r===a||o&&s)return n;let l={scrollLeft:0,scrollTop:0},c=dd(1);const u=dd(0),d=xd(r);if((d||!d&&!s)&&((W1(r)!=="body"||u$(a))&&(l=zE(r)),xd(r))){const f=Zg(r);c=hv(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const h=a&&!d&&!s?u_e(a,l,!0):dd(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+u.x+h.x,y:n.y*c.y-l.scrollTop*c.y+u.y+h.y}}function lun(e){return Array.from(e.getClientRects())}function cun(e){const t=Xd(e),n=zE(e),r=e.ownerDocument.body,i=lg(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=lg(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+FL(e);const o=-n.scrollTop;return cu(r).direction==="rtl"&&(a+=lg(t.clientWidth,r.clientWidth)-i),{width:i,height:s,x:a,y:o}}function uun(e,t){const n=kl(e),r=Xd(e),i=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,o=0,l=0;if(i){s=i.width,a=i.height;const c=IL();(!c||c&&t==="fixed")&&(o=i.offsetLeft,l=i.offsetTop)}return{width:s,height:a,x:o,y:l}}function dun(e,t){const n=Zg(e,!0,t==="fixed"),r=n.top+e.clientTop,i=n.left+e.clientLeft,s=xd(e)?hv(e):dd(1),a=e.clientWidth*s.x,o=e.clientHeight*s.y,l=i*s.x,c=r*s.y;return{width:a,height:o,x:l,y:c}}function fse(e,t,n){let r;if(t==="viewport")r=uun(e,n);else if(t==="document")r=cun(Xd(e));else if(lu(t))r=dun(t,n);else{const i=c_e(e);r={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return _C(r)}function d_e(e,t){const n=XO(e);return n===t||!lu(n)||l1(n)?!1:cu(n).position==="fixed"||d_e(n,t)}function hun(e,t){const n=t.get(e);if(n)return n;let r=fS(e,[],!1).filter(o=>lu(o)&&W1(o)!=="body"),i=null;const s=cu(e).position==="fixed";let a=s?XO(e):e;for(;lu(a)&&!l1(a);){const o=cu(a),l=DL(a);!l&&o.position==="fixed"&&(i=null),(s?!l&&!i:!l&&o.position==="static"&&i&&["absolute","fixed"].includes(i.position)||u$(a)&&!l&&d_e(e,a))?r=r.filter(c=>c!==a):i=o,a=XO(a)}return t.set(e,r),r}function fun(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e;const s=[...n==="clippingAncestors"?ME(t)?[]:hun(t,this._c):[].concat(n),r],a=s[0],o=s.reduce((l,c)=>{const u=fse(t,c,i);return l.top=lg(u.top,l.top),l.right=a1(u.right,l.right),l.bottom=a1(u.bottom,l.bottom),l.left=lg(u.left,l.left),l},fse(t,a,i));return{width:o.right-o.left,height:o.bottom-o.top,x:o.left,y:o.top}}function Oun(e){const{width:t,height:n}=l_e(e);return{width:t,height:n}}function pun(e,t,n){const r=xd(t),i=Xd(t),s=n==="fixed",a=Zg(e,!0,s,t);let o={scrollLeft:0,scrollTop:0};const l=dd(0);if(r||!r&&!s)if((W1(t)!=="body"||u$(i))&&(o=zE(t)),r){const h=Zg(t,!0,s,t);l.x=h.x+t.clientLeft,l.y=h.y+t.clientTop}else i&&(l.x=FL(i));const c=i&&!r&&!s?u_e(i,o):dd(0),u=a.left+o.scrollLeft-l.x-c.x,d=a.top+o.scrollTop-l.y-c.y;return{x:u,y:d,width:a.width,height:a.height}}function $X(e){return cu(e).position==="static"}function Ose(e,t){if(!xd(e)||cu(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Xd(e)===n&&(n=n.ownerDocument.body),n}function h_e(e,t){const n=kl(e);if(ME(e))return n;if(!xd(e)){let i=XO(e);for(;i&&!l1(i);){if(lu(i)&&!$X(i))return i;i=XO(i)}return n}let r=Ose(e,t);for(;r&&run(r)&&$X(r);)r=Ose(r,t);return r&&l1(r)&&$X(r)&&!DL(r)?n:r||iun(e)||n}const gun=async function(e){const t=this.getOffsetParent||h_e,n=this.getDimensions,r=await n(e.floating);return{reference:pun(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function mun(e){return cu(e).direction==="rtl"}const vun={convertOffsetParentRelativeRectToViewportRelativeRect:oun,getDocumentElement:Xd,getClippingRect:fun,getOffsetParent:h_e,getElementRects:gun,getClientRects:lun,getDimensions:Oun,getScale:hv,isElement:lu,isRTL:mun};function bun(e,t){let n=null,r;const i=Xd(e);function s(){var o;clearTimeout(r),(o=n)==null||o.disconnect(),n=null}function a(o,l){o===void 0&&(o=!1),l===void 0&&(l=1),s();const{left:c,top:u,width:d,height:h}=e.getBoundingClientRect();if(o||t(),!d||!h)return;const f=CT(u),p=CT(i.clientWidth-(c+d)),g=CT(i.clientHeight-(u+h)),m=CT(c),v={rootMargin:-f+"px "+-p+"px "+-g+"px "+-m+"px",threshold:lg(0,a1(1,l))||1};let b=!0;function y(T){const x=T[0].intersectionRatio;if(x!==l){if(!b)return a();x?a(!1,x):r=setTimeout(()=>{a(!1,1e-7)},1e3)}b=!1}try{n=new IntersectionObserver(y,Go({},v,{root:i.ownerDocument}))}catch{n=new IntersectionObserver(y,v)}n.observe(e)}return a(!0),s}function wun(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:o=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=NL(e),u=i||s?[...c?fS(c):[],...fS(t)]:[];u.forEach(v=>{i&&v.addEventListener("scroll",n,{passive:!0}),s&&v.addEventListener("resize",n)});const d=c&&o?bun(c,n):null;let h=-1,f=null;a&&(f=new ResizeObserver(v=>{let[b]=v;b&&b.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var y;(y=f)==null||y.observe(t)})),n()}),c&&!l&&f.observe(c),f.observe(t));let p,g=l?Zg(e):null;l&&m();function m(){const v=Zg(e);g&&(v.x!==g.x||v.y!==g.y||v.width!==g.width||v.height!==g.height)&&n(),g=v,p=requestAnimationFrame(m)}return n(),()=>{var v;u.forEach(b=>{i&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),d?.(),(v=f)==null||v.disconnect(),f=null,l&&cancelAnimationFrame(p)}}const yun=Jcn,xun=tun,Sun=eun,$un=Hcn,kun=nun,Tun=(e,t,n)=>{const r=new Map,i=Go({platform:vun},n),s=Go({},i.platform,{_c:r});return Zcn(e,t,Go({},i,{platform:s}))};function Pun(e){e.cleanup&&e.cleanup();const t=e._getResolvedAttachToOptions();let n=t.element;const r=Aun(t,e),i=n_e(t);return i&&(n=document.body,e.shepherdElementComponent.getElement().classList.add("shepherd-centered")),e.cleanup=wun(n,e.el,()=>{if(!e.el){e.cleanup==null||e.cleanup();return}Qun(n,e,r,i)}),e.target=t.element,r}function _un(e,t){return{floatingUIOptions:CL(e.floatingUIOptions||{},t.floatingUIOptions||{})}}function Cun(e){e.cleanup&&e.cleanup(),e.cleanup=null}function Qun(e,t,n,r){return Tun(e,t.el,n).then(Eun(t,r)).then(i=>new Promise(s=>{setTimeout(()=>s(i),300)})).then(i=>{i!=null&&i.el&&i.el.focus({preventScroll:!0})})}function Eun(e,t){return({x:n,y:r,placement:i,middlewareData:s})=>(e.el&&(t?Object.assign(e.el.style,{position:"fixed",left:"50%",top:"50%",transform:"translate(-50%, -50%)"}):Object.assign(e.el.style,{position:"absolute",left:`${n}px`,top:`${r}px`}),e.el.dataset.popperPlacement=i,Run(e.el,s)),e)}function Run(e,t){const n=e.querySelector(".shepherd-arrow");if(s1(n)&&t.arrow){const{x:r,y:i}=t.arrow;Object.assign(n.style,{left:r!=null?`${r}px`:"",top:i!=null?`${i}px`:""})}}function Aun(e,t){var n,r,i;const s={strategy:"absolute"};s.middleware=[];const a=Xun(t),o=n_e(e),l=(n=e.on)==null?void 0:n.includes("auto"),c=(e==null||(r=e.on)==null?void 0:r.includes("-start"))||(e==null||(i=e.on)==null?void 0:i.includes("-end"));if(!o){if(l){var u;s.middleware.push(yun({crossAxis:!0,alignment:c?e==null||(u=e.on)==null?void 0:u.split("-").pop():null}))}else s.middleware.push(Sun());if(s.middleware.push(xun({limiter:kun(),crossAxis:!0})),a){const d=typeof t.options.arrow=="object"?t.options.arrow:{padding:4};s.middleware.push($un({element:a,padding:c?d.padding:0}))}l||(s.placement=e.on)}return CL(s,t.options.floatingUIOptions||{})}function Xun(e){return e.options.arrow&&e.el?e.el.querySelector(".shepherd-arrow"):!1}function El(){}function Dun(e,t){for(const n in t)e[n]=t[n];return e}function f_e(e){return e()}function pse(){return Object.create(null)}function d$(e){e.forEach(f_e)}function ML(e){return typeof e=="function"}function af(e,t){return e!=e?t==t:e!==t||e&&typeof e=="object"||typeof e=="function"}function Iun(e){return Object.keys(e).length===0}function c1(e,t){e.appendChild(t)}function bu(e,t,n){e.insertBefore(t,n||null)}function _c(e){e.parentNode&&e.parentNode.removeChild(e)}function Nun(e,t){for(let n=0;n<e.length;n+=1)e[n]&&e[n].d(t)}function Sd(e){return document.createElement(e)}function gse(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}function O_e(e){return document.createTextNode(e)}function CC(){return O_e(" ")}function Fun(){return O_e("")}function LE(e,t,n,r){return e.addEventListener(t,n,r),()=>e.removeEventListener(t,n,r)}function ii(e,t,n){n==null?e.removeAttribute(t):e.getAttribute(t)!==n&&e.setAttribute(t,n)}const Mun=["width","height"];function mse(e,t){const n=Object.getOwnPropertyDescriptors(e.__proto__);for(const r in t)t[r]==null?e.removeAttribute(r):r==="style"?e.style.cssText=t[r]:r==="__value"?e.value=e[r]=t[r]:n[r]&&n[r].set&&Mun.indexOf(r)===-1?e[r]=t[r]:ii(e,r,t[r])}function zun(e){return Array.from(e.childNodes)}function s0(e,t,n){e.classList.toggle(t,!!n)}let OS;function by(e){OS=e}function p_e(){if(!OS)throw new Error("Function called outside component initialization");return OS}function Lun(e){p_e().$$.on_mount.push(e)}function zL(e){p_e().$$.after_update.push(e)}const b0=[],u1=[];let fv=[];const vse=[],qun=Promise.resolve();let RF=!1;function Uun(){RF||(RF=!0,qun.then(g_e))}function AF(e){fv.push(e)}const kX=new Set;let a0=0;function g_e(){if(a0!==0)return;const e=OS;do{try{for(;a0<b0.length;){const t=b0[a0];a0++,by(t),Wun(t.$$)}}catch(t){throw b0.length=0,a0=0,t}for(by(null),b0.length=0,a0=0;u1.length;)u1.pop()();for(let t=0;t<fv.length;t+=1){const n=fv[t];kX.has(n)||(kX.add(n),n())}fv.length=0}while(b0.length);for(;vse.length;)vse.pop()();RF=!1,kX.clear(),by(e)}function Wun(e){if(e.fragment!==null){e.update(),d$(e.before_update);const t=e.dirty;e.dirty=[-1],e.fragment&&e.fragment.p(e.ctx,t),e.after_update.forEach(AF)}}function jun(e){const t=[],n=[];fv.forEach(r=>e.indexOf(r)===-1?t.push(r):n.push(r)),n.forEach(r=>r()),fv=t}const L2=new Set;let Up;function cg(){Up={r:0,c:[],p:Up}}function ug(){Up.r||d$(Up.c),Up=Up.p}function Wr(e,t){e&&e.i&&(L2.delete(e),e.i(t))}function as(e,t,n,r){if(e&&e.o){if(L2.has(e))return;L2.add(e),Up.c.push(()=>{L2.delete(e),r&&(n&&e.d(1),r())}),e.o(t)}else r&&r()}function bse(e){return e?.length!==void 0?e:Array.from(e)}function Gun(e,t){const n={},r={},i={$$scope:1};let s=e.length;for(;s--;){const a=e[s],o=t[s];if(o){for(const l in a)l in o||(r[l]=1);for(const l in o)i[l]||(n[l]=o[l],i[l]=1);e[s]=o}else for(const l in a)i[l]=1}for(const a in r)a in n||(n[a]=void 0);return n}function _m(e){e&&e.c()}function JO(e,t,n){const{fragment:r,after_update:i}=e.$$;r&&r.m(t,n),AF(()=>{const s=e.$$.on_mount.map(f_e).filter(ML);e.$$.on_destroy?e.$$.on_destroy.push(...s):d$(s),e.$$.on_mount=[]}),i.forEach(AF)}function ep(e,t){const n=e.$$;n.fragment!==null&&(jun(n.after_update),d$(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}function Vun(e,t){e.$$.dirty[0]===-1&&(b0.push(e),Uun(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<<t%31}function of(e,t,n,r,i,s,a=null,o=[-1]){const l=OS;by(e);const c=e.$$={fragment:null,ctx:[],props:s,update:El,not_equal:i,bound:pse(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(t.context||(l?l.$$.context:[])),callbacks:pse(),dirty:o,skip_bound:!1,root:t.target||l.$$.root};a&&a(c.root);let u=!1;if(c.ctx=n?n(e,t.props||{},(d,h,...f)=>{const p=f.length?f[0]:h;return c.ctx&&i(c.ctx[d],c.ctx[d]=p)&&(!c.skip_bound&&c.bound[d]&&c.bound[d](p),u&&Vun(e,d)),h}):[],c.update(),u=!0,d$(c.before_update),c.fragment=r?r(c.ctx):!1,t.target){if(t.hydrate){const d=zun(t.target);c.fragment&&c.fragment.l(d),d.forEach(_c)}else c.fragment&&c.fragment.c();t.intro&&Wr(e.$$.fragment),JO(e,t.target,t.anchor),g_e()}by(l)}class lf{constructor(){this.$$=void 0,this.$$set=void 0}$destroy(){ep(this,1),this.$destroy=El}$on(t,n){if(!ML(n))return El;const r=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return r.push(n),()=>{const i=r.indexOf(n);i!==-1&&r.splice(i,1)}}$set(t){this.$$set&&!Iun(t)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}const Yun="4";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(Yun);function Bun(e){let t,n,r,i,s;return{c(){t=Sd("button"),ii(t,"aria-label",n=e[3]?e[3]:null),ii(t,"class",r=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`),t.disabled=e[2],ii(t,"tabindex","0"),ii(t,"type","button")},m(a,o){bu(a,t,o),t.innerHTML=e[5],i||(s=LE(t,"click",function(){ML(e[0])&&e[0].apply(this,arguments)}),i=!0)},p(a,[o]){e=a,o&32&&(t.innerHTML=e[5]),o&8&&n!==(n=e[3]?e[3]:null)&&ii(t,"aria-label",n),o&18&&r!==(r=`${e[1]||""} shepherd-button ${e[4]?"shepherd-button-secondary":""}`)&&ii(t,"class",r),o&4&&(t.disabled=e[2])},i:El,o:El,d(a){a&&_c(t),i=!1,s()}}}function Zun(e,t,n){let{config:r,step:i}=t,s,a,o,l,c,u;function d(h){return AO(h)?h=h.call(i):h}return e.$$set=h=>{"config"in h&&n(6,r=h.config),"step"in h&&n(7,i=h.step)},e.$$.update=()=>{e.$$.dirty&192&&(n(0,s=r.action?r.action.bind(i.tour):null),n(1,a=r.classes),n(2,o=r.disabled?d(r.disabled):!1),n(3,l=r.label?d(r.label):null),n(4,c=r.secondary),n(5,u=r.text?d(r.text):null))},[s,a,o,l,c,u,r,i]}class Hun extends lf{constructor(t){super(),of(this,t,Zun,Bun,af,{config:6,step:7})}}function wse(e,t,n){const r=e.slice();return r[2]=t[n],r}function yse(e){let t,n,r=bse(e[1]),i=[];for(let a=0;a<r.length;a+=1)i[a]=xse(wse(e,r,a));const s=a=>as(i[a],1,1,()=>{i[a]=null});return{c(){for(let a=0;a<i.length;a+=1)i[a].c();t=Fun()},m(a,o){for(let l=0;l<i.length;l+=1)i[l]&&i[l].m(a,o);bu(a,t,o),n=!0},p(a,o){if(o&3){r=bse(a[1]);let l;for(l=0;l<r.length;l+=1){const c=wse(a,r,l);i[l]?(i[l].p(c,o),Wr(i[l],1)):(i[l]=xse(c),i[l].c(),Wr(i[l],1),i[l].m(t.parentNode,t))}for(cg(),l=r.length;l<i.length;l+=1)s(l);ug()}},i(a){if(!n){for(let o=0;o<r.length;o+=1)Wr(i[o]);n=!0}},o(a){i=i.filter(Boolean);for(let o=0;o<i.length;o+=1)as(i[o]);n=!1},d(a){a&&_c(t),Nun(i,a)}}}function xse(e){let t,n;return t=new Hun({props:{config:e[2],step:e[0]}}),{c(){_m(t.$$.fragment)},m(r,i){JO(t,r,i),n=!0},p(r,i){const s={};i&2&&(s.config=r[2]),i&1&&(s.step=r[0]),t.$set(s)},i(r){n||(Wr(t.$$.fragment,r),n=!0)},o(r){as(t.$$.fragment,r),n=!1},d(r){ep(t,r)}}}function Kun(e){let t,n,r=e[1]&&yse(e);return{c(){t=Sd("footer"),r&&r.c(),ii(t,"class","shepherd-footer")},m(i,s){bu(i,t,s),r&&r.m(t,null),n=!0},p(i,[s]){i[1]?r?(r.p(i,s),s&2&&Wr(r,1)):(r=yse(i),r.c(),Wr(r,1),r.m(t,null)):r&&(cg(),as(r,1,1,()=>{r=null}),ug())},i(i){n||(Wr(r),n=!0)},o(i){as(r),n=!1},d(i){i&&_c(t),r&&r.d()}}}function Jun(e,t,n){let r,{step:i}=t;return e.$$set=s=>{"step"in s&&n(0,i=s.step)},e.$$.update=()=>{e.$$.dirty&1&&n(1,r=i.options.buttons)},[i,r]}class edn extends lf{constructor(t){super(),of(this,t,Jun,Kun,af,{step:0})}}function tdn(e){let t,n,r,i,s;return{c(){t=Sd("button"),n=Sd("span"),n.textContent="×",ii(n,"aria-hidden","true"),ii(t,"aria-label",r=e[0].label?e[0].label:"Close Tour"),ii(t,"class","shepherd-cancel-icon"),ii(t,"type","button")},m(a,o){bu(a,t,o),c1(t,n),i||(s=LE(t,"click",e[1]),i=!0)},p(a,[o]){o&1&&r!==(r=a[0].label?a[0].label:"Close Tour")&&ii(t,"aria-label",r)},i:El,o:El,d(a){a&&_c(t),i=!1,s()}}}function ndn(e,t,n){let{cancelIcon:r,step:i}=t;const s=a=>{a.preventDefault(),i.cancel()};return e.$$set=a=>{"cancelIcon"in a&&n(0,r=a.cancelIcon),"step"in a&&n(2,i=a.step)},[r,s,i]}class rdn extends lf{constructor(t){super(),of(this,t,ndn,tdn,af,{cancelIcon:0,step:2})}}function idn(e){let t;return{c(){t=Sd("h3"),ii(t,"id",e[1]),ii(t,"class","shepherd-title")},m(n,r){bu(n,t,r),e[3](t)},p(n,[r]){r&2&&ii(t,"id",n[1])},i:El,o:El,d(n){n&&_c(t),e[3](null)}}}function sdn(e,t,n){let{labelId:r,element:i,title:s}=t;zL(()=>{AO(s)&&n(2,s=s()),n(0,i.innerHTML=s,i)});function a(o){u1[o?"unshift":"push"](()=>{i=o,n(0,i)})}return e.$$set=o=>{"labelId"in o&&n(1,r=o.labelId),"element"in o&&n(0,i=o.element),"title"in o&&n(2,s=o.title)},[i,r,s,a]}class adn extends lf{constructor(t){super(),of(this,t,sdn,idn,af,{labelId:1,element:0,title:2})}}function Sse(e){let t,n;return t=new adn({props:{labelId:e[0],title:e[2]}}),{c(){_m(t.$$.fragment)},m(r,i){JO(t,r,i),n=!0},p(r,i){const s={};i&1&&(s.labelId=r[0]),i&4&&(s.title=r[2]),t.$set(s)},i(r){n||(Wr(t.$$.fragment,r),n=!0)},o(r){as(t.$$.fragment,r),n=!1},d(r){ep(t,r)}}}function $se(e){let t,n;return t=new rdn({props:{cancelIcon:e[3],step:e[1]}}),{c(){_m(t.$$.fragment)},m(r,i){JO(t,r,i),n=!0},p(r,i){const s={};i&8&&(s.cancelIcon=r[3]),i&2&&(s.step=r[1]),t.$set(s)},i(r){n||(Wr(t.$$.fragment,r),n=!0)},o(r){as(t.$$.fragment,r),n=!1},d(r){ep(t,r)}}}function odn(e){let t,n,r,i=e[2]&&Sse(e),s=e[3]&&e[3].enabled&&$se(e);return{c(){t=Sd("header"),i&&i.c(),n=CC(),s&&s.c(),ii(t,"class","shepherd-header")},m(a,o){bu(a,t,o),i&&i.m(t,null),c1(t,n),s&&s.m(t,null),r=!0},p(a,[o]){a[2]?i?(i.p(a,o),o&4&&Wr(i,1)):(i=Sse(a),i.c(),Wr(i,1),i.m(t,n)):i&&(cg(),as(i,1,1,()=>{i=null}),ug()),a[3]&&a[3].enabled?s?(s.p(a,o),o&8&&Wr(s,1)):(s=$se(a),s.c(),Wr(s,1),s.m(t,null)):s&&(cg(),as(s,1,1,()=>{s=null}),ug())},i(a){r||(Wr(i),Wr(s),r=!0)},o(a){as(i),as(s),r=!1},d(a){a&&_c(t),i&&i.d(),s&&s.d()}}}function ldn(e,t,n){let{labelId:r,step:i}=t,s,a;return e.$$set=o=>{"labelId"in o&&n(0,r=o.labelId),"step"in o&&n(1,i=o.step)},e.$$.update=()=>{e.$$.dirty&2&&(n(2,s=i.options.title),n(3,a=i.options.cancelIcon))},[r,i,s,a]}class cdn extends lf{constructor(t){super(),of(this,t,ldn,odn,af,{labelId:0,step:1})}}function udn(e){let t;return{c(){t=Sd("div"),ii(t,"class","shepherd-text"),ii(t,"id",e[1])},m(n,r){bu(n,t,r),e[3](t)},p(n,[r]){r&2&&ii(t,"id",n[1])},i:El,o:El,d(n){n&&_c(t),e[3](null)}}}function ddn(e,t,n){let{descriptionId:r,element:i,step:s}=t;zL(()=>{let{text:o}=s.options;AO(o)&&(o=o.call(s)),s1(o)?i.appendChild(o):n(0,i.innerHTML=o,i)});function a(o){u1[o?"unshift":"push"](()=>{i=o,n(0,i)})}return e.$$set=o=>{"descriptionId"in o&&n(1,r=o.descriptionId),"element"in o&&n(0,i=o.element),"step"in o&&n(2,s=o.step)},[i,r,s,a]}class hdn extends lf{constructor(t){super(),of(this,t,ddn,udn,af,{descriptionId:1,element:0,step:2})}}function kse(e){let t,n;return t=new cdn({props:{labelId:e[1],step:e[2]}}),{c(){_m(t.$$.fragment)},m(r,i){JO(t,r,i),n=!0},p(r,i){const s={};i&2&&(s.labelId=r[1]),i&4&&(s.step=r[2]),t.$set(s)},i(r){n||(Wr(t.$$.fragment,r),n=!0)},o(r){as(t.$$.fragment,r),n=!1},d(r){ep(t,r)}}}function Tse(e){let t,n;return t=new hdn({props:{descriptionId:e[0],step:e[2]}}),{c(){_m(t.$$.fragment)},m(r,i){JO(t,r,i),n=!0},p(r,i){const s={};i&1&&(s.descriptionId=r[0]),i&4&&(s.step=r[2]),t.$set(s)},i(r){n||(Wr(t.$$.fragment,r),n=!0)},o(r){as(t.$$.fragment,r),n=!1},d(r){ep(t,r)}}}function Pse(e){let t,n;return t=new edn({props:{step:e[2]}}),{c(){_m(t.$$.fragment)},m(r,i){JO(t,r,i),n=!0},p(r,i){const s={};i&4&&(s.step=r[2]),t.$set(s)},i(r){n||(Wr(t.$$.fragment,r),n=!0)},o(r){as(t.$$.fragment,r),n=!1},d(r){ep(t,r)}}}function fdn(e){let t,n=!Ia(e[2].options.title)||e[2].options.cancelIcon&&e[2].options.cancelIcon.enabled,r,i=!Ia(e[2].options.text),s,a=Array.isArray(e[2].options.buttons)&&e[2].options.buttons.length,o,l=n&&kse(e),c=i&&Tse(e),u=a&&Pse(e);return{c(){t=Sd("div"),l&&l.c(),r=CC(),c&&c.c(),s=CC(),u&&u.c(),ii(t,"class","shepherd-content")},m(d,h){bu(d,t,h),l&&l.m(t,null),c1(t,r),c&&c.m(t,null),c1(t,s),u&&u.m(t,null),o=!0},p(d,[h]){h&4&&(n=!Ia(d[2].options.title)||d[2].options.cancelIcon&&d[2].options.cancelIcon.enabled),n?l?(l.p(d,h),h&4&&Wr(l,1)):(l=kse(d),l.c(),Wr(l,1),l.m(t,r)):l&&(cg(),as(l,1,1,()=>{l=null}),ug()),h&4&&(i=!Ia(d[2].options.text)),i?c?(c.p(d,h),h&4&&Wr(c,1)):(c=Tse(d),c.c(),Wr(c,1),c.m(t,s)):c&&(cg(),as(c,1,1,()=>{c=null}),ug()),h&4&&(a=Array.isArray(d[2].options.buttons)&&d[2].options.buttons.length),a?u?(u.p(d,h),h&4&&Wr(u,1)):(u=Pse(d),u.c(),Wr(u,1),u.m(t,null)):u&&(cg(),as(u,1,1,()=>{u=null}),ug())},i(d){o||(Wr(l),Wr(c),Wr(u),o=!0)},o(d){as(l),as(c),as(u),o=!1},d(d){d&&_c(t),l&&l.d(),c&&c.d(),u&&u.d()}}}function Odn(e,t,n){let{descriptionId:r,labelId:i,step:s}=t;return e.$$set=a=>{"descriptionId"in a&&n(0,r=a.descriptionId),"labelId"in a&&n(1,i=a.labelId),"step"in a&&n(2,s=a.step)},[r,i,s]}class pdn extends lf{constructor(t){super(),of(this,t,Odn,fdn,af,{descriptionId:0,labelId:1,step:2})}}function _se(e){let t;return{c(){t=Sd("div"),ii(t,"class","shepherd-arrow"),ii(t,"data-popper-arrow","")},m(n,r){bu(n,t,r)},d(n){n&&_c(t)}}}function gdn(e){let t,n,r,i,s,a,o,l,c=e[4].options.arrow&&e[4].options.attachTo&&e[4].options.attachTo.element&&e[4].options.attachTo.on&&_se();r=new pdn({props:{descriptionId:e[2],labelId:e[3],step:e[4]}});let u=[{"aria-describedby":i=Ia(e[4].options.text)?null:e[2]},{"aria-labelledby":s=e[4].options.title?e[3]:null},e[1],{open:"true"}],d={};for(let h=0;h<u.length;h+=1)d=Dun(d,u[h]);return{c(){t=Sd("dialog"),c&&c.c(),n=CC(),_m(r.$$.fragment),mse(t,d),s0(t,"shepherd-has-cancel-icon",e[5]),s0(t,"shepherd-has-title",e[6]),s0(t,"shepherd-element",!0)},m(h,f){bu(h,t,f),c&&c.m(t,null),c1(t,n),JO(r,t,null),e[13](t),a=!0,o||(l=LE(t,"keydown",e[7]),o=!0)},p(h,[f]){h[4].options.arrow&&h[4].options.attachTo&&h[4].options.attachTo.element&&h[4].options.attachTo.on?c||(c=_se(),c.c(),c.m(t,n)):c&&(c.d(1),c=null);const p={};f&4&&(p.descriptionId=h[2]),f&8&&(p.labelId=h[3]),f&16&&(p.step=h[4]),r.$set(p),mse(t,d=Gun(u,[(!a||f&20&&i!==(i=Ia(h[4].options.text)?null:h[2]))&&{"aria-describedby":i},(!a||f&24&&s!==(s=h[4].options.title?h[3]:null))&&{"aria-labelledby":s},f&2&&h[1],{open:"true"}])),s0(t,"shepherd-has-cancel-icon",h[5]),s0(t,"shepherd-has-title",h[6]),s0(t,"shepherd-element",!0)},i(h){a||(Wr(r.$$.fragment,h),a=!0)},o(h){as(r.$$.fragment,h),a=!1},d(h){h&&_c(t),c&&c.d(),ep(r),e[13](null),o=!1,l()}}}const mdn=9,vdn=27,bdn=37,wdn=39;function Cse(e){return e.split(" ").filter(t=>!!t.length)}function ydn(e,t,n){let{classPrefix:r,element:i,descriptionId:s,firstFocusableElement:a,focusableElements:o,labelId:l,lastFocusableElement:c,step:u,dataStepId:d}=t,h,f,p;const g=()=>i;Lun(()=>{n(1,d={[`data-${r}shepherd-step-id`]:u.id}),n(9,o=i.querySelectorAll('a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex="0"]')),n(8,a=o[0]),n(10,c=o[o.length-1])}),zL(()=>{p!==u.options.classes&&m()});function m(){v(p),p=u.options.classes,b(p)}function v(x){if(hS(x)){const S=Cse(x);S.length&&i.classList.remove(...S)}}function b(x){if(hS(x)){const S=Cse(x);S.length&&i.classList.add(...S)}}const y=x=>{const{tour:S}=u;switch(x.keyCode){case mdn:if(o.length===0){x.preventDefault();break}x.shiftKey?(document.activeElement===a||document.activeElement.classList.contains("shepherd-element"))&&(x.preventDefault(),c.focus()):document.activeElement===c&&(x.preventDefault(),a.focus());break;case vdn:S.options.exitOnEsc&&(x.preventDefault(),x.stopPropagation(),u.cancel());break;case bdn:S.options.keyboardNavigation&&(x.preventDefault(),x.stopPropagation(),S.back());break;case wdn:S.options.keyboardNavigation&&(x.preventDefault(),x.stopPropagation(),S.next());break}};function T(x){u1[x?"unshift":"push"](()=>{i=x,n(0,i)})}return e.$$set=x=>{"classPrefix"in x&&n(11,r=x.classPrefix),"element"in x&&n(0,i=x.element),"descriptionId"in x&&n(2,s=x.descriptionId),"firstFocusableElement"in x&&n(8,a=x.firstFocusableElement),"focusableElements"in x&&n(9,o=x.focusableElements),"labelId"in x&&n(3,l=x.labelId),"lastFocusableElement"in x&&n(10,c=x.lastFocusableElement),"step"in x&&n(4,u=x.step),"dataStepId"in x&&n(1,d=x.dataStepId)},e.$$.update=()=>{e.$$.dirty&16&&(n(5,h=u.options&&u.options.cancelIcon&&u.options.cancelIcon.enabled),n(6,f=u.options&&u.options.title))},[i,d,s,l,u,h,f,y,a,o,c,r,g,T]}class xdn extends lf{constructor(t){super(),of(this,t,ydn,gdn,af,{classPrefix:11,element:0,descriptionId:2,firstFocusableElement:8,focusableElements:9,labelId:3,lastFocusableElement:10,step:4,dataStepId:1,getElement:12})}get getElement(){return this.$$.ctx[12]}}class XF extends PL{constructor(t,n={}){return super(),this._resolvedAttachTo=void 0,this._resolvedExtraHighlightElements=void 0,this.classPrefix=void 0,this.el=void 0,this.target=void 0,this.tour=void 0,this.tour=t,this.classPrefix=this.tour.options?t_e(this.tour.options.classPrefix):"",this.styles=t.styles,this._resolvedAttachTo=null,QL(this),this._setOptions(n),this}cancel(){this.tour.cancel(),this.trigger("cancel")}complete(){this.tour.complete(),this.trigger("complete")}destroy(){Cun(this),s1(this.el)&&(this.el.remove(),this.el=null),this._updateStepTargetOnHide(),this.trigger("destroy")}getTour(){return this.tour}hide(){var t;(t=this.tour.modal)==null||t.hide(),this.trigger("before-hide"),this.el&&(this.el.hidden=!0),this._updateStepTargetOnHide(),this.trigger("hide")}_resolveExtraHiglightElements(){return this._resolvedExtraHighlightElements=Mcn(this),this._resolvedExtraHighlightElements}_resolveAttachToOptions(){return this._resolvedAttachTo=Fcn(this),this._resolvedAttachTo}_getResolvedAttachToOptions(){return this._resolvedAttachTo===null?this._resolveAttachToOptions():this._resolvedAttachTo}isOpen(){return!!(this.el&&!this.el.hidden)}show(){return AO(this.options.beforeShowPromise)?Promise.resolve(this.options.beforeShowPromise()).then(()=>this._show()):Promise.resolve(this._show())}updateStepOptions(t){Object.assign(this.options,t),this.shepherdElementComponent&&this.shepherdElementComponent.$set({step:this})}getElement(){return this.el}getTarget(){return this.target}_createTooltipContent(){const t=`${this.id}-description`,n=`${this.id}-label`;return this.shepherdElementComponent=new xdn({target:this.tour.options.stepsContainer||document.body,props:{classPrefix:this.classPrefix,descriptionId:t,labelId:n,step:this,styles:this.styles}}),this.shepherdElementComponent.getElement()}_scrollTo(t){const{element:n}=this._getResolvedAttachToOptions();AO(this.options.scrollToHandler)?this.options.scrollToHandler(n):mcn(n)&&typeof n.scrollIntoView=="function"&&n.scrollIntoView(t)}_getClassOptions(t){const n=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions,r=t.classes?t.classes:"",i=n&&n.classes?n.classes:"",s=[...r.split(" "),...i.split(" ")],a=new Set(s);return Array.from(a).join(" ").trim()}_setOptions(t={}){let n=this.tour&&this.tour.options&&this.tour.options.defaultStepOptions;n=CL({},n||{}),this.options=Object.assign({arrow:!0},n,t,_un(n,t));const{when:r}=this.options;this.options.classes=this._getClassOptions(t),this.destroy(),this.id=this.options.id||`step-${r_e()}`,r&&Object.keys(r).forEach(i=>{this.on(i,r[i],this)})}_setupElements(){Ia(this.el)||this.destroy(),this.el=this._createTooltipContent(),this.options.advanceOn&&Dcn(this),Pun(this)}_show(){var t;this.trigger("before-show"),this._resolveAttachToOptions(),this._resolveExtraHiglightElements(),this._setupElements(),this.tour.modal||this.tour.setupModal(),(t=this.tour.modal)==null||t.setupForStep(this),this._styleTargetElementForStep(this),this.el&&(this.el.hidden=!1),this.options.scrollTo&&setTimeout(()=>{this._scrollTo(this.options.scrollTo)}),this.el&&(this.el.hidden=!1);const n=this.shepherdElementComponent.getElement(),r=this.target||document.body,i=this._resolvedExtraHighlightElements;r.classList.add(`${this.classPrefix}shepherd-enabled`),r.classList.add(`${this.classPrefix}shepherd-target`),n.classList.add("shepherd-enabled"),i?.forEach(s=>{s.classList.add(`${this.classPrefix}shepherd-enabled`),s.classList.add(`${this.classPrefix}shepherd-target`)}),this.trigger("show")}_styleTargetElementForStep(t){const n=t.target,r=t._resolvedExtraHighlightElements;if(!n)return;const i=t.options.highlightClass;i&&(n.classList.add(i),r?.forEach(s=>s.classList.add(i))),n.classList.remove("shepherd-target-click-disabled"),r?.forEach(s=>s.classList.remove("shepherd-target-click-disabled")),t.options.canClickTarget===!1&&(n.classList.add("shepherd-target-click-disabled"),r?.forEach(s=>s.classList.add("shepherd-target-click-disabled")))}_updateStepTargetOnHide(){const t=this.target||document.body,n=this._resolvedExtraHighlightElements,r=this.options.highlightClass;r&&(t.classList.remove(r),n?.forEach(i=>i.classList.remove(r))),t.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`),n?.forEach(i=>{i.classList.remove("shepherd-target-click-disabled",`${this.classPrefix}shepherd-enabled`,`${this.classPrefix}shepherd-target`)})}}function Sdn(e){if(e){const{steps:t}=e;t.forEach(n=>{n.options&&n.options.canClickTarget===!1&&n.options.attachTo&&(s1(n.target)&&n.target.classList.remove("shepherd-target-click-disabled"),n._resolvedExtraHighlightElements&&n._resolvedExtraHighlightElements.forEach(r=>{s1(r)&&r.classList.remove("shepherd-target-click-disabled")}))})}}function $dn(e){let t="";const{innerWidth:n,innerHeight:r}=window;return e.forEach(i=>{const{width:s,height:a,x:o=0,y:l=0,r:c=0}=i,{topLeft:u=0,topRight:d=0,bottomRight:h=0,bottomLeft:f=0}=typeof c=="number"?{topLeft:c,topRight:c,bottomRight:c,bottomLeft:c}:c;t+=`M${o+u},${l} a${u},${u},0,0,0-${u},${u} V${a+l-f} a${f},${f},0,0,0,${f},${f} H${s+o-h} a${h},${h},0,0,0,${h}-${h} V${l+d} a${d},${d},0,0,0-${d}-${d} Z`}),`M${n},${r} H0 V0 H${n} V${r} Z ${t}`.replace(/\s/g,"")}function kdn(e){let t,n,r,i,s;return{c(){t=gse("svg"),n=gse("path"),ii(n,"d",e[2]),ii(t,"class",r=`${e[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)},m(a,o){bu(a,t,o),c1(t,n),e[11](t),i||(s=LE(t,"touchmove",e[3]),i=!0)},p(a,[o]){o&4&&ii(n,"d",a[2]),o&2&&r!==(r=`${a[1]?"shepherd-modal-is-visible":""} shepherd-modal-overlay-container`)&&ii(t,"class",r)},i:El,o:El,d(a){a&&_c(t),e[11](null),i=!1,s()}}}function m_e(e){if(!e)return null;const t=e instanceof HTMLElement&&window.getComputedStyle(e).overflowY;return t!=="hidden"&&t!=="visible"&&e.scrollHeight>=e.clientHeight?e:m_e(e.parentElement)}function Tdn(e){let t={top:0,left:0};if(!e)return t;let n=e.ownerDocument.defaultView;for(;n!==window.top;){var r;const a=(r=n)==null?void 0:r.frameElement;if(a){var i,s;const o=a.getBoundingClientRect();t.top+=o.top+((i=o.scrollTop)!=null?i:0),t.left+=o.left+((s=o.scrollLeft)!=null?s:0)}n=n.parent}return t}function Pdn(e,t){const n=e.getBoundingClientRect();let r=n.y||n.top,i=n.bottom||r+n.height;if(t){const a=t.getBoundingClientRect(),o=a.y||a.top,l=a.bottom||o+a.height;r=Math.max(r,o),i=Math.min(i,l)}const s=Math.max(i-r,0);return{y:r,height:s}}function _dn(e,t,n){let{element:r,openingProperties:i}=t,s=!1,a,o;c();const l=()=>r;function c(){n(4,i=[{width:0,height:0,x:0,y:0,r:0}])}function u(){n(1,s=!1),v()}function d(T=0,x=0,S=0,k=0,Q,C,_){if(C){const R=[C,..._||[]];n(4,i=[]);for(const A of R){if(!A||R.indexOf(A)!==R.lastIndexOf(A))continue;const{y:I,height:W}=Pdn(A,Q),{x:G,width:U,left:q}=A.getBoundingClientRect();R.some(B=>{if(B===A)return!1;const j=B.getBoundingClientRect();return G>=j.left&&G+U<=j.right&&I>=j.top&&I+W<=j.bottom})||i.push({width:U+T*2,height:W+T*2,x:(G||q)+S-T,y:I+k-T,r:x})}}else c()}function h(T){v(),T.tour.options.useModalOverlay?(b(T),f()):u()}function f(){n(1,s=!0)}const p=T=>{T.preventDefault()},g=T=>{T.stopPropagation()};function m(){window.addEventListener("touchmove",p,{passive:!1})}function v(){a&&(cancelAnimationFrame(a),a=void 0),window.removeEventListener("touchmove",p,{passive:!1})}function b(T){const{modalOverlayOpeningPadding:x,modalOverlayOpeningRadius:S,modalOverlayOpeningXOffset:k=0,modalOverlayOpeningYOffset:Q=0}=T.options,C=Tdn(T.target),_=m_e(T.target),R=()=>{a=void 0,d(x,S,k+C.left,Q+C.top,_,T.target,T._resolvedExtraHighlightElements),a=requestAnimationFrame(R)};R(),m()}function y(T){u1[T?"unshift":"push"](()=>{r=T,n(0,r)})}return e.$$set=T=>{"element"in T&&n(0,r=T.element),"openingProperties"in T&&n(4,i=T.openingProperties)},e.$$.update=()=>{e.$$.dirty&16&&n(2,o=$dn(i))},[r,s,o,g,i,l,c,u,d,h,f,y]}class Cdn extends lf{constructor(t){super(),of(this,t,_dn,kdn,af,{element:0,openingProperties:4,getElement:5,closeModalOpening:6,hide:7,positionModal:8,setupForStep:9,show:10})}get getElement(){return this.$$.ctx[5]}get closeModalOpening(){return this.$$.ctx[6]}get hide(){return this.$$.ctx[7]}get positionModal(){return this.$$.ctx[8]}get setupForStep(){return this.$$.ctx[9]}get show(){return this.$$.ctx[10]}}class Qdn extends PL{constructor(){super(),this.activeTour=void 0,QL(this)}}class Edn extends PL{constructor(t={}){super(),this.trackedEvents=["active","cancel","complete","show"],this.classPrefix=void 0,this.currentStep=void 0,this.focusedElBeforeOpen=void 0,this.id=void 0,this.modal=void 0,this.options=void 0,this.steps=void 0,QL(this);const n={exitOnEsc:!0,keyboardNavigation:!0};return this.options=Object.assign({},n,t),this.classPrefix=t_e(this.options.classPrefix),this.steps=[],this.addSteps(this.options.steps),["active","cancel","complete","inactive","show","start"].map(r=>{(i=>{this.on(i,s=>{s=s||{},s.tour=this,Wp.trigger(i,s)})})(r)}),this._setTourID(t.id),this}addStep(t,n){let r=t;return r instanceof XF?r.tour=this:r=new XF(this,r),Ia(n)?this.steps.push(r):this.steps.splice(n,0,r),r}addSteps(t){return Array.isArray(t)&&t.forEach(n=>{this.addStep(n)}),this}back(){const t=this.steps.indexOf(this.currentStep);this.show(t-1,!1)}async cancel(){if(this.options.confirmCancel){const t=this.options.confirmCancelMessage||"Are you sure you want to stop the tour?";let n;AO(this.options.confirmCancel)?n=await this.options.confirmCancel():n=window.confirm(t),n&&this._done("cancel")}else this._done("cancel")}complete(){this._done("complete")}getById(t){return this.steps.find(n=>n.id===t)}getCurrentStep(){return this.currentStep}hide(){const t=this.getCurrentStep();if(t)return t.hide()}isActive(){return Wp.activeTour===this}next(){const t=this.steps.indexOf(this.currentStep);t===this.steps.length-1?this.complete():this.show(t+1,!0)}removeStep(t){const n=this.getCurrentStep();this.steps.some((r,i)=>{if(r.id===t)return r.isOpen()&&r.hide(),r.destroy(),this.steps.splice(i,1),!0}),n&&n.id===t&&(this.currentStep=void 0,this.steps.length?this.show(0):this.cancel())}show(t=0,n=!0){const r=hS(t)?this.getById(t):this.steps[t];r&&(this._updateStateBeforeShow(),AO(r.options.showOn)&&!r.options.showOn()?this._skipStep(r,n):(this.currentStep=r,this.trigger("show",{step:r,previous:this.currentStep}),r.show()))}async start(){this.trigger("start"),this.focusedElBeforeOpen=document.activeElement,this.currentStep=null,this.setupModal(),this._setupActiveTour(),this.next()}_done(t){const n=this.steps.indexOf(this.currentStep);if(Array.isArray(this.steps)&&this.steps.forEach(r=>r.destroy()),Sdn(this),this.trigger(t,{index:n}),Wp.activeTour=null,this.trigger("inactive",{tour:this}),this.modal&&this.modal.hide(),(t==="cancel"||t==="complete")&&this.modal){const r=document.querySelector(".shepherd-modal-overlay-container");r&&(r.remove(),this.modal=null)}s1(this.focusedElBeforeOpen)&&this.focusedElBeforeOpen.focus()}_setupActiveTour(){this.trigger("active",{tour:this}),Wp.activeTour=this}setupModal(){this.modal=new Cdn({target:this.options.modalContainer||document.body,props:{styles:this.styles}})}_skipStep(t,n){const r=this.steps.indexOf(t);if(r===this.steps.length-1)this.complete();else{const i=n?r+1:r-1;this.show(i,n)}}_updateStateBeforeShow(){this.currentStep&&this.currentStep.hide(),this.isActive()||this._setupActiveTour()}_setTourID(t){const n=this.options.tourName||"tour",r=t||r_e();this.id=`${n}--${r}`}}const Wp=new Qdn,v_e=typeof window>"u";Wp.Step=v_e?Icn:XF;Wp.Tour=v_e?Ncn:Edn;const qE=w.createContext(void 0);qE.Consumer;const Rdn=({children:e})=>gcn.jsx(qE.Provider,{value:{Shepherd:Wp},children:e}),Adn=""+new URL("agentic-sequence-CExfswgi.png",import.meta.url).href,Xdn=""+new URL("canvas-code-inline-edit-DLji9b0m.png",import.meta.url).href,Ddn=""+new URL("canvas-overview-CruGEIRC.png",import.meta.url).href,Idn=""+new URL("canvas-variables-view-DrA20zqs.png",import.meta.url).href,Ndn=""+new URL("chat-attachments-_3cRrONU.png",import.meta.url).href,Fdn=""+new URL("chat-full-view-e-eJPzrw.png",import.meta.url).href,Mdn=""+new URL("chat-input-CU-CA7Se.png",import.meta.url).href,zdn=""+new URL("inline-edit-canvas-O9conTkE.png",import.meta.url).href,Ldn=e=>{const t=Array.from(document.querySelectorAll(`[data-tour-tag="${e}"]`));return t.find(n=>n.offsetParent!==null)??t[0]??null},Qse=e=>{document.querySelector(`[data-tour-action="${e}"]`)?.click()},Ese=[{id:"welcome",title:"Welcome to Local Operator",text:`Local Operator is an AI agents platform that allows you to create a team of proactive AI agents that support you and help to reduce your daily workload.<br/><img src="${Fdn}" alt="Chat full view" style="width: 100%; height: 350px; object-fit: contain; border-radius: 8px;"/><br />These agents are different from simple chatbots because they can actually do things for you on your computer like create files, run code and analytics, edit images, videos, and PDFs, organize your system, and much more.<br/><br/>In this walkthrough we'll cover:<ul><li>Creating agents</li><li>Making agents do things</li><li>The canvas workspace</li><li>Customizing agents</li><li>Agent hub for sharing and collaborating</li><li>Schedules for proactive agents</li><li>Settings for customization</li></ul>Let's explore how it works.`,buttons:[{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"agent-list",attachTo:{element:'[data-tour-tag="agent-list-panel"]',on:"right"},title:"Your agents",text:"On the left, you'll see a list of your available AI agents. You can select an agent to start a conversation or manage its settings. Think of this as your messenger contacts list, but for AI agents. There are no limits to how many agents you can have, so create as many as you need to handle all your daily tasks.<br/><br/>Use the create agents button at the top of the toolbar to create a new agent at any time. You can also import agents from the Agent hub, which we will cover later in this tour.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-agent",attachTo:{element:'[data-tour-tag="agent-list-item-button-0"]',on:"right"},title:"Select an agent",text:"Click on an agent to open the chat window to pull up your conversation with it. This will show the messages that you have sent them and the responses and actions that they have taken.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="agent-list-item-button-0"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"chat-input",attachTo:{element:'[data-tour-tag="chat-input-textarea"]',on:"top"},title:"Ask your agent anything",text:`Type your request here. Agents can answer questions, perform tasks, search the web, and much more. When you create a new agent, you'll see suggested prompts for ideas.<br /><br />Some powerful requests that you can try:<br /><br /><ul><li>"Create a spreadsheet in my Documents folder with all the major cities in Canada."</li><li>"Search the web for the latest news on AI and make a thorough report."</li><li>Select an attachment and then "translate this document to French."</li></ul><br /><img src="${Mdn}" alt="Chat input" style="width: 100%; height: 200px; object-fit: contain; border-radius: 8px;"/><br />You can also attach files to your message by clicking the paperclip button, which we will cover in the next step.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"attachments",attachTo:{element:'button[data-tour-tag="chat-input-attach-file-button"]',on:"top"},title:"Attach files to your message",text:`You can attach any files, images, or documents to your message by clicking this paperclip button, there are no limitations on the file types. Your agent can process, analyze, or translate these attachments as part of your request.<br /><br />Try attaching a PDF, image, or text file and then ask your agent to summarize, translate, or extract information from it.<br /><img src="${Ndn}" alt="Chat attachments" style="width: 100%; height: 200px; object-fit: contain; border-radius: 8px;"/><br />Images like PNGs, JPGs, and PDFs are natively streamed into the model context window, so they can understand them directly without needing to run any code. Other files like Excel, Word, and CSV files are included as file paths on your device to direct the model's attention to work with them using code. You can attach massive files like million line CSVs and have the agent work with them using code.<br /><br />You can also paste images into the chat input, and attach multiple files at once to achieve more complex tasks. Try taking a screenshot of a website and then asking your agent to try to code it.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"agent-capabilities",attachTo:{element:'[data-tour-tag="chat-header"]',on:"top"},title:"More than just chat",text:`Local Operator agents are different from simple chatbots. They can perform actions on your computer, like creating files, running code, or browsing the web, based on your instructions. You'll see them use "tools" like reading, writing, and executing code to get things done. Agents have memory of the conversation, previous steps, learnings, and even store the execution variables of previous steps in code to be able to use them later in the conversation.<br /><img src="${Adn}" alt="Agentic sequence" style="width: 100%; height: 350px; object-fit: contain; border-radius: 8px;"/><br />Local Operator agents are extremely flexible, so they can bounce back and forth with you for simple chatting, and know when they need to embark on a work journey to get things done in multiple steps with tool use.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const{openCommandPalette:e}=Zn.getState();e(),setTimeout(()=>{this.next()},500)}}]},{id:"pre-command-palette-open-canvas",title:"Command palette",attachTo:{element:'[data-tour-tag="command-palette-dialog"]',on:"right"},text:"Let's quickly look at another powerful feature: the Command Palette. You can open it anywhere in the app by pressing <code>Cmd+P</code> on Mac and <code>Ctrl+P</code> on Windows or Linux. This is a helpful window that you can open from anywhere in the app to be able to access agents, settings, pages, and much more using your keyboard. It can often be faster to access sections in the app this way instead of clicking through menus. You can type an agent's name to find the chat for that agent, and then hit Enter to open it.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const{closeCommandPalette:e}=Zn.getState();e(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const{closeCommandPalette:e}=Zn.getState();e(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-open-button",attachTo:{element:'button[data-tour-tag="open-canvas-button"]',on:"left"},title:"Open the canvas",text:"Click here to open the Canvas, a workspace for files and dynamic visualizations where you can organize, plan, and interact with your agents in a more flexible way.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const{openCommandPalette:e}=Zn.getState();e(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="open-canvas-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-feature",attachTo:{element:'[data-tour-tag="canvas-container"]',on:"left"},title:"The canvas: your visual workspace",text:`This is the Canvas, your workspace for files and dynamic visualizations where you can organize, plan, and interact with your agents in a more flexible way. Any files that your agents create on your device can be opened here by clicking on the file icons that you see as they work.<br/><br/>Agents can make dynamic visualizations like games, charts, maps, and more in HTML files. Any HTML files you open will be rendered dynamically in an iframe. Any markdown files that you open will be rendered in full markdown viewer with support for code blocks, tables, mermaid diagrams, and more.<br/><img src="${Ddn}" alt="Canvas overview" style="width: 100%; height: 300px; object-fit: contain; border-radius: 8px;"/>`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="close-canvas-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-documents-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-documents-view",attachTo:{element:'button[data-tour-tag="canvas-documents-view-button"]',on:"top"},title:"Documents view",text:`The Documents view shows all your open notes, blog articles, code, and visualizations as tabs. You can switch between documents to edit them and see dynamic visualizations in HTML created by your agents. Use this view to work with your notes, reports, and agent-generated content.<br /><br />This is where you can get more precise around your agents' work.<br/><img src="${zdn}" alt="Inline edit canvas" style="width: 100%; height: 200px; object-fit: contain; border-radius: 8px;"/><br />In your documents, highlight any text that you want your agent to improve and press Cmd/Ctrl+K to bring up the inline AI editor.
|
|
1337
1337
|
<br /><img src="${Xdn}" alt="Canvas code inline edit" style="width: 100%; height: 200px; object-fit: cover; object-position: top; border-radius: 8px;"/><br />You can be as precise as you want and the agent will edit the document for you in place, using its memories and context so you don't have to re-explain things.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-files-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-files-view",attachTo:{element:'button[data-tour-tag="canvas-files-view-button"]',on:"top"},title:"Files view",text:"The Files view lets you browse and open files that your agents have created or that are relevant to your current conversation. Use this to quickly access, preview, and open files in the Canvas workspace.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-documents-view-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-variables-view-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"canvas-variables-view",attachTo:{element:'button[data-tour-tag="canvas-variables-view-button"]',on:"top"},title:"Variables view",text:`The Variables view displays the "code memory" that agents have stored during their work. These are technical variables that include results, intermediate values, and other data that agents use to perform tasks. You can inspect and manage these variables here.<br /><br />This section will be most helpful for more technical users who want to understand how agents are working and what they are doing.<br/><img src="${Idn}" alt="Canvas variables" style="width: 100%; height: 350px; object-fit: contain; border-radius: 8px;"/>`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="canvas-files-view-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="close-canvas-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"agent-options",attachTo:{element:'button[data-tour-tag="agent-options-button"]',on:"right"},title:"Agent options",text:"Click here to see options for the currently selected agent, like viewing its settings, exporting it, or deleting it.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="open-canvas-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="agent-options-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"click-view-settings-from-chat",attachTo:{element:'[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]',on:"right"},title:"View configuration",text:'Click "View agent settings" to see and change how this agent works and change things like its name, description, hosting provider, and AI model.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"view-agent-settings",attachTo:{element:'div[data-tour-tag="agent-settings-details-paper"]',on:"left"},title:"Agent configuration",text:"This is where you can customize and configure your agent. You can change its name, description, the AI model it uses, its temperature for creativity, and other chat settings.<br /><br />The agents will already have default settings that work well for most use cases, but if you want to roll up your sleeves and customize, you can do so here.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-chat"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="agent-options-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-provider",attachTo:{element:'[data-tour-tag="agent-settings-hosting-select"]',on:"left"},title:"Select hosting provider",text:`Choose an AI provider for your agent. If you don't pick one here, then the default provider from the settings page will be used. Providers offer different AI models and pricing. Radient is recommended for Local Operator as its "Automatic" mode is optimized for the lowest cost and best performance.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"select-model",attachTo:{element:'[data-tour-tag="agent-settings-model-select"]',on:"left"},title:"Select AI model",text:"After selecting a provider, choose an AI model. Models marked as 'Recommended' are known to work well with Local Operator. Other models might have inconsistent performance. If a model you expect to be recommended isn't listed, please let us know if it works well for you in Local Operator via GitHub Issues or email.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"modify-security-prompt",attachTo:{element:'[data-tour-tag="agent-settings-security"]',on:"left"},title:"Customize security behaviors",text:"This prompt provides separate instructions to the security agent that reviews this agent's work. You can explicitly allow certain actions that would normally be blocked. If you encounter frequent security interventions, consider adding a note here for the security agent.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"modify-agent-prompt",attachTo:{element:'[data-tour-tag="agent-settings-system-prompt"]',on:"left"},title:"Customize the agent's behavior",text:"This prompt allows you to customize the baseline behavior of the agent. While most customization can happen by talking to the agent (it records learnings in its notebook), you can provide specific workflow instructions here that will be followed separately.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-new-agent",attachTo:{element:'button[data-tour-tag="create-new-agent-button"]',on:"bottom"},title:"Create a new agent",text:'Click the "+" button to create a brand new agent from scratch. You can then customize its behavior and capabilities.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="agent-list-item-button-0"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="agent-options-button"]');t&&t.click()},500),setTimeout(()=>{const t=document.querySelector('[role="menuitem"][data-tour-tag="view-agent-settings-menu-item"]');t&&t.click()},1e3),setTimeout(()=>{this.back()},1500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-new-agent-button"]');e&&e.click(),setTimeout(()=>{this.next()},1e3)}}]},{id:"agent-naming-guidelines",attachTo:{element:'[data-tour-tag="create-agent-dialog"]',on:"right"},title:"Naming and describing your agent",text:`Give your agent a clear, descriptive name that reflects its purpose (e.g., "File Organizer" or "Web Researcher").
|
|
1338
|
-
A good description helps you and others understand what the agent does and any special instructions. The descriptions are also used by other agents to help them understand how to tag each other in for certain tasks.<br /><br />If you want this agent to be part of the agent-to-agent communication network, it will need to have a description that captures its purpose and capabilities. Be concise and specific.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-agent-hub",attachTo:{element:'[data-tour-tag="nav-item-agent-hub"]',on:"right"},title:"Discover more agents",text:`Let's visit the Agent hub to find community-created agents. Click on the "Agent hub" icon in the navigation bar.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('[data-tour-tag="create-new-agent-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"agent-hub-view",attachTo:{element:'[data-tour-tag="agent-hub-sidebar-container"]',on:"right"},title:"The Agent hub",text:"Here you can browse agents by category or search for specific ones. These agents are shared by the community and can perform various specialized tasks.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"download-agent",attachTo:{element:'button[data-tour-tag="agent-hub-download-button"]',on:"bottom"},title:"Download an agent",text:'Find an agent that interests you and click the "Get" button to add it to your local agent list.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{this.next()},1e3)}}]},{id:"upload-agent-hub",attachTo:{element:()=>Ldn("upload-to-hub-header-button"),on:"bottom"},title:"Share your agents",text:"If you create a useful agent, you can also share it with the community by uploading it to the Agent hub from the agent options menu.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){Qse("open-upload-dialog"),setTimeout(()=>{this.next()},500)}}]},{id:"upload-agent-hub-dialog",attachTo:{element:'[data-tour-tag="upload-agent-dialog"]',on:"right"},title:"Upload agent to hub",text:"This dialog allows you to share your agent with the community. You need to have a Radient account to upload an agent, which is free to create and doesn't cost anything per upload. You can review the agent details and confirm the upload. Make sure your agent meets the required criteria before submitting. Also be aware that any conversation history and learnings for this agent will be part of its training and will be visible to the public. So don't share agents publicly that know sensitive information.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-schedules",attachTo:{element:'[data-tour-tag="nav-item-schedules"]',on:"right"},title:"Automate tasks with schedules",text:"Local Operator can run tasks for you on a regular basis. Let's check out the Schedules section.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{Qse("open-upload-dialog")},500),setTimeout(()=>{this.back()},1e3)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"schedules-overview",title:"Proactive agents with schedules",text:"A powerful feature of Local Operator is the ability to ask agents to perform tasks on their own on a recurring basis. This turns them from reactive agent bots to proactive agents that work on their own in the background to support you without you needing to continually ask them to do things.<br /><br />You can simply ask any agent to do something at some point in the future, or to handle some daily task at a certain time, and it will create a prompt for itself that will be executed at the specified times.<br /><br />Here, you can view, create, and manage all your scheduled tasks in one place to streamline your workflow and ensure important actions happen automatically.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-schedule",attachTo:{element:'button[data-tour-tag="create-schedule-button"]',on:"bottom"},title:"Set up a recurring task",text:'Click "Create schedule" to ask an agent to perform a task for you regularly, like sending a daily report or checking for news updates.<br /><br />You can also create one-off tasks that only run once at some point in the future.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="create-schedule-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"create-schedule-dialog",attachTo:{element:'[data-tour-tag="create-schedule-dialog"]',on:"right"},title:"Configure your schedule",text:"While it is often much easier to simply ask the agent to do a task on a recurring basis for you, you can also manually set up a schedule for a task here or update existing tasks.<br /><br />The prompt is the message that will be sent to the agent at the predefined schedule. You can update the time of day in your local timezone, the frequency of the task, and even specify a specific date or time that the task should stop running at.<br /><br />You can also schedule one-off tasks that only run once at some point in the future.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-settings",attachTo:{element:'[data-tour-tag="nav-item-settings"]',on:"right"},title:"Personalize your experience",text:"Now, let's explore the Settings menu to customize Local Operator to your liking.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="create-schedule-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-settings"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"general-settings",attachTo:{element:'div[data-tour-tag="settings-general-section"]',on:"right"},title:"General settings",text:"Here you can update your user profile, configure model settings (like default hosting provider and model), and adjust history settings for conversations and learnings.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"appearance-settings",attachTo:{element:'[data-tour-tag="settings-appearance-section"]',on:"right"},title:"Customize appearance",text:"Choose from various themes to change the look and feel of Local Operator. Find one that suits your style.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"radient-account-settings",attachTo:{element:'[data-tour-tag="settings-radient-account-section"]',on:"right"},title:"Radient account",text:"Connect your Radient account to access your Radient Pass details, credits, and unlock unified access to models and tools. Radient is the best way to use Local Operator since it powers the AI models, web search, image generation, and much more with a single integration. You get free credits when you sign up to try it out and bonus credits when you top up.<br /><br />When you sign in for the first time, it will automatically create a Radient Pass for you and save it securely to your computer. This will power your Local Operator agents with Radient Automatic, which mixes and matches AI models to get you the best balance of speed, accuracy, and cost in every step of your agents' workflows.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"integrations-settings",attachTo:{element:'[data-tour-tag="settings-integrations-section"]',on:"right"},title:"Connect your services",text:"Enhance your agents' capabilities by connecting your Google services like Gmail, Calendar, and Drive. This allows agents to access and manage your information with your permission.<br /><br />You need to be logged in to a Radient account to use this feature, however it is free to use and doesn't cost any additional Radient credits per action.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"api-credentials-settings",attachTo:{element:'[data-tour-tag="settings-api-credentials-section"]',on:"right"},title:"Manage API keys",text:"Configure API keys for various services and AI models here. This allows your agents to access external tools and capabilities.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"application-updates-settings",attachTo:{element:'[data-tour-tag="settings-app-updates-section"]',on:"right"},title:"Stay up to date",text:"Check for updates to Local Operator here to ensure you have the latest features and improvements. You can see your current version information below.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"tour-complete",title:"Tour complete",text:"You've now seen the main features of Local Operator. Feel free to explore further and discover all the ways your AI agents can assist you. Happy automating.",buttons:[{text:"Finish",classes:"shepherd-button-primary",action:function(){this.complete()}}]}],qdn=()=>{const e=ta(),{completeTourOnboarding:t}=ex(),n=w.useContext(qE),r={cancelIcon:{enabled:!0},scrollTo:{behavior:"smooth",block:"center"}},i=!0;return{startTour:a=>{if(n?.tour?.isActive()&&!a?.forceModalCompleted){console.log("Onboarding tour is already active (from context.tour). Not starting another.");return}const o=ex.getState();if(!a?.forceModalCompleted&&!o.isModalComplete){console.log("Onboarding modal not completed (checked via store). Tour will not start.");return}if(o.isTourComplete&&!a?.forceModalCompleted){console.log("Onboarding tour already completed in store and not forced. Not starting again.");return}let l=n?.tour;const c=n?.Shepherd;if(!l&&c&&(l=c.activeTour,!l&&c.Tour&&(console.log("No active Shepherd tour found from context or global. Creating a new one."),l=new c.Tour({useModalOverlay:i,defaultStepOptions:r}))),!l){console.warn("Failed to get or create a Shepherd tour instance.",n);return}if(l.isActive()){console.log("Tour is already active. Not starting again.");return}if(l.options.defaultStepOptions={...l.options.defaultStepOptions||{},...r},l.options.useModalOverlay=i,a?.firstAgentId&&(l.options.firstAgentId=a.firstAgentId),l.off("complete",t),l.on("complete",t),l.off("cancel",t),l.on("cancel",t),a?.forceModalCompleted||!l.isActive()){const u=[...l.steps];for(const d of u)d.id&&l.removeStep(d.id);l.addSteps(Ese)}else l.steps.length===0&&l.addSteps(Ese);typeof l.start=="function"?(e("/"),l.start()):console.warn("Shepherd tour instance does not have a start method.",l)}}},Udn=()=>{const{isModalComplete:e,isTourComplete:t}=ex(),{startTour:n}=qdn(),r=me.useContext(qE),{data:i}=$8(1,1);return w.useEffect(()=>{if(e&&!t&&r){const s=setTimeout(()=>{const a=i?.agents?.[0]?.id;n({firstAgentId:a})},500);return()=>clearTimeout(s)}},[e,t,r,n,i]),null},Wdn=({children:e})=>O.jsxs(Rdn,{children:[e,O.jsx(Udn,{})]}),Rse=["auth","settings","commands","catalogues","lifecycle","mcp","radient"],jdn=()=>{const e=mc(),t=Wi(),[n,r]=w.useState(!1),[i,s]=w.useState(null),a=w.useCallback(()=>{t.invalidateQueries({queryKey:Hc.capabilities})},[t]),o=w.useCallback(async()=>{r(!0),s(null);try{await window.api.updater.updateBackend(),a()}catch(m){s(m instanceof Error?m.message:"The backend update could not start.")}finally{r(!1)}},[a]);if(e.isLoading)return null;const l=e.data,c=l?Rse.filter(m=>(l.features?.[m]??0)<1):[...Rse],u=!!l&&!l?.desktop_available;if(l?.desktop_available&&c.length===0)return null;const d=lle(e.error),h=!!l,f=!!window.api?.updater?.updateBackend,p=j6e({kind:d,unpaired:u,missing:c,answered:h}),g=f&&W6e({kind:d,unpaired:u,answered:h});return O.jsx("div",{className:"fixed inset-x-0 top-0 z-2100 w-full",children:O.jsx(po,{variant:"warning",className:"items-center rounded-none border-x-0 border-t-0",children:O.jsxs("div",{className:"flex w-full items-center justify-between gap-4",children:[O.jsxs(RC,{children:[p,i?` ${i}`:null]}),O.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[g&&O.jsx(we,{variant:"primary",size:"sm",onClick:()=>void o(),disabled:n,children:n?"Updating":"Update backend"}),O.jsx(we,{variant:"secondary",size:"sm",onClick:a,children:"Retry"})]})]})})})},Gdn=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,b_e={all:["radient-prices"],prices:()=>[...b_e.all,"prices"]},Vdn=()=>{const e=hr({queryKey:b_e.prices(),queryFn:()=>M8({operation:"prices"}),staleTime:36e5,refetchOnWindowFocus:!1,refetchOnMount:!0,refetchInterval:!1,retry:3});return{prices:e.data,isLoading:e.isLoading,isFetching:e.isFetching,error:e.error,pricesQuery:e}},w_e=Ya()(uu(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),Ydn=({open:e,onClose:t,onGoToConsole:n})=>{const{setHasBeenNotified:r}=w_e(),{prices:i,isLoading:s,error:a}=Vdn(),o=u=>typeof u!="number"?"$...":`$${u.toFixed(2)} USD`,l=()=>{r(!0),t()},c=()=>{r(!0),n()};return O.jsx(FO,{open:e,onClose:l,title:O.jsxs(O.Fragment,{children:[O.jsx("img",{src:Gdn,alt:"Radient icon",className:"size-7"}),"Running low on Radient credits?"]}),maxWidth:"sm",fullWidth:!1,actions:O.jsxs(O.Fragment,{children:[O.jsx(g1,{onClick:l,children:"Maybe later"}),O.jsx(p1,{onClick:c,startIcon:O.jsx(LC,{size:18}),className:"min-w-55",children:"Get more credits"})]}),children:O.jsxs("div",{className:"flex flex-col items-center gap-4 py-2 text-center",children:[O.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Unlock the full power of Local Operator with"," ",O.jsx("span",{className:"font-bold text-accent",children:"Radient Pass"}),"."]}),O.jsx("p",{className:"text-body-sm text-ink-muted",children:"Radient Automatic is often cheaper than bringing your own key: its smart model routing picks the most cost-effective model for each step of your agentic workflows."}),O.jsx("p",{className:"text-body-sm text-ink-muted",children:"It's pay-as-you-go with no commitments. Load up what you need, starting small for maximum flexibility."}),O.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Plus, get"," ",O.jsx("span",{className:"font-medium text-ink",children:s?O.jsx(pr,{size:"sm",className:"mr-0.5 align-middle"}):o(i?.default_registration_credits)})," ","in bonus credits with your first purchase.",a&&O.jsx("span",{className:"mt-1 block text-meta text-danger",children:"Could not load bonus credit information."})]}),O.jsx("p",{className:"text-meta text-ink-dim",children:"You can also reach the Radient Console from Settings at any time."})]})})},Ase=({expanded:e})=>O.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[O.jsx("img",{src:W_e,alt:e?"":"Local Operator",loading:"eager",className:"size-6 shrink-0"}),e&&O.jsx("span",{className:"truncate font-semibold text-body text-ink",children:"Local Operator"})]}),y_e=me.memo(({expanded:e,useAuth:t=!1})=>{const n=ta(),{user:r,isAuthenticated:i,signOut:s}=z8(),a=r?.name??"User",o=r?.email??"",l=w.useCallback(async()=>{i&&(await s(),window.location.reload())},[i,s]),c=w.useMemo(()=>a?a.split(" ").map(h=>h.charAt(0)).join("").toUpperCase().substring(0,2):null,[a]),u=O.jsxs("button",{type:"button",onClick:t?void 0:()=>n("/settings"),"aria-label":e?void 0:"Account settings",className:N("flex w-full items-center gap-2 rounded-sm transition-colors duration-fast ease-out-quart hover:bg-elevated",e?"px-3 py-1.5":"justify-center py-1.5"),children:[O.jsx(Wse,{className:"size-7 shrink-0",children:O.jsx(jse,{className:"bg-elevated text-ink",children:c??O.jsx(Uoe,{size:14,"aria-hidden":"true"})})}),e&&a&&O.jsxs("span",{className:"min-w-0 text-left",children:[O.jsx("span",{className:"block truncate text-body-sm text-ink",children:a}),o&&O.jsx("span",{className:"block truncate text-meta text-ink-dim",children:o})]})]}),d=e?u:O.jsx(pt,{content:"Account settings",side:"right",children:u});return t?O.jsxs(pS,{children:[e?O.jsx(Ov,{asChild:!0,children:u}):O.jsx(pt,{content:"Account settings",side:"right",children:O.jsx(Ov,{asChild:!0,children:u})}),O.jsxs(gS,{align:"end",side:"top",className:"min-w-50",children:[O.jsxs(is,{onSelect:()=>n("/settings"),children:[O.jsx(Oh,{size:16,"aria-hidden":"true"}),"Settings"]}),O.jsxs(is,{children:[O.jsx(Moe,{size:16,"aria-hidden":"true"}),"Privacy and security"]}),O.jsx(A0,{}),O.jsxs(is,{onSelect:l,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[O.jsx(R4e,{size:16,"aria-hidden":"true"}),"Sign out"]})]})]}):d});y_e.displayName="UserProfileSidebar";const Xse={expanded:"w-55",collapsed:"w-12"},Bdn=()=>{const e=ta(),t=KIe(),{isSidebarCollapsed:n,toggleSidebar:r}=Zn(),i=!n,s=[{icon:qC,label:"Chat",path:"/chat",isActive:t==="chat",tourTag:"nav-item-chat"},{icon:f1,label:"My agents",path:"/agents",isActive:t==="agents",tourTag:"nav-item-agents"},{icon:qoe,label:"Agent hub",path:"/agent-hub",isActive:t==="agent-hub",tourTag:"nav-item-agent-hub"},{icon:koe,label:"Schedules",path:"/schedules",isActive:t==="schedules",tourTag:"nav-item-schedules"},{icon:Oh,label:"Settings",path:"/settings",isActive:t==="settings",tourTag:"nav-item-settings"}],a=c=>{const u=O.jsxs("button",{type:"button",onClick:()=>e(c.path),"data-tour-tag":c.tourTag,"aria-current":c.isActive?"page":void 0,"aria-label":i?void 0:c.label,className:N("flex h-8 w-full items-center rounded-sm text-body-sm transition-colors duration-fast ease-out-quart",i?"justify-start gap-2 px-3":"justify-center",c.isActive?"bg-accent-wash font-medium text-ink":"text-ink-muted hover:bg-elevated hover:text-ink"),children:[O.jsx(c.icon,{size:16,"aria-hidden":"true",className:N("shrink-0",c.isActive&&"text-accent")}),i&&O.jsx("span",{className:"truncate",children:c.label})]});return i?O.jsx("li",{children:u},c.path):O.jsx("li",{children:O.jsx(pt,{content:c.label,side:"right",children:u})},c.path)},o=i?"Collapse sidebar":"Expand sidebar",l=O.jsx("div",{className:N("pointer-events-none opacity-0 transition-opacity duration-fast ease-out-quart","group-hover:pointer-events-auto group-hover:opacity-100","group-focus-within:pointer-events-auto group-focus-within:opacity-100"),children:O.jsx(pt,{content:o,side:"right",children:O.jsx(we,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":o,"aria-expanded":i,children:i?O.jsx(wv,{"aria-hidden":"true"}):O.jsx(Eh,{"aria-hidden":"true"})})})});return O.jsxs("nav",{className:N("group flex shrink-0 flex-col overflow-x-hidden bg-sunken transition-[width] duration-base ease-out-quart",i?Xse.expanded:Xse.collapsed),children:[O.jsx("div",{className:N("flex h-12 shrink-0 items-center",i?"justify-between pr-2 pl-5":"justify-center"),children:i?O.jsxs(O.Fragment,{children:[O.jsx(Ase,{expanded:!0}),l]}):O.jsxs("div",{className:"relative flex size-8 items-center justify-center",children:[O.jsx("div",{className:"transition-opacity duration-fast ease-out-quart group-hover:opacity-0 group-focus-within:opacity-0",children:O.jsx(Ase,{expanded:!1})}),O.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:l})]})}),O.jsx("ul",{className:"flex flex-col gap-1 p-2",children:s.map(a)}),O.jsx("div",{className:"mt-auto p-2",children:O.jsx(y_e,{expanded:i})})]})},Zdn=1,Hdn=()=>{const{isAuthenticated:e,user:t}=z8(),{hasBeenNotified:n,setHasBeenNotified:r}=w_e(),[i,s]=w.useState(!1),[a,o]=w.useState(null),l=w.useCallback(async()=>{if(!(!e||!t?.radientUser?.account?.tenant_id))try{const h=await M8({operation:"credits",tenantId:t.radientUser.account.tenant_id});if(!h||typeof h.balance!="number")throw new Error("Invalid credit balance response format");o(h.balance)}catch(h){console.error("Failed to fetch Radient credits:",h),o(null)}},[e,t?.radientUser?.account?.tenant_id]);return w.useEffect(()=>{e&&l()},[e,l]),w.useEffect(()=>{e&&a!==null?a<Zdn?n||s(!0):(s(!1),n&&r(!1)):s(!1)},[e,n,a,r]),{isLowCreditsDialogOpen:i,openRadientConsole:()=>{window.api?.openExternal?window.api.openExternal("https://console.radienthq.com"):window.open("https://console.radienthq.com","_blank"),r(!0),s(!1)},closeLowCreditsDialog:()=>{s(!1)},onLowCreditsDialogClose:()=>{r(!0),s(!1)},currentCredits:a}},Kdn=w.lazy(()=>Xe(()=>import("./agent-details-page-KYNvYgtg.js"),__vite__mapDeps([9,1,2,10,11]),import.meta.url).then(e=>({default:e.AgentDetailsPage}))),Jdn=w.lazy(()=>Xe(()=>import("./agent-hub-page-IeRJGTiW.js"),__vite__mapDeps([12,1,2,13,14,11]),import.meta.url).then(e=>({default:e.AgentHubPage}))),Dse=w.lazy(()=>Xe(()=>import("./agents-page-xpFBrylt.js"),__vite__mapDeps([15,1,2]),import.meta.url).then(e=>({default:e.AgentsPage}))),ehn=w.lazy(()=>Xe(()=>import("./schedules-page-DH6hSFoy.js"),__vite__mapDeps([16,1,2,14,17,10]),import.meta.url).then(e=>({default:e.SchedulesPage}))),thn=w.lazy(()=>Xe(()=>import("./settings-page-CDKRmauZ.js"),__vite__mapDeps([18,1,2,14,10,19,17,3,20,21,22,23,24]),import.meta.url).then(e=>({default:e.SettingsPage}))),nhn=()=>{const{isOnboardingActive:e}=MIe(),{isLowCreditsDialogOpen:t,openRadientConsole:n,onLowCreditsDialogClose:r}=Hdn(),{toggleCommandPalette:i,isCommandPaletteOpen:s,isCreateAgentDialogOpen:a,closeCreateAgentDialog:o}=Zn(),l=ta(),c=d=>{l(`/chat/${d}`),o()};w.useEffect(()=>{const d=()=>{i()},h=window.electron.ipcRenderer.on("toggle-command-palette",d);return()=>{h&&h()}},[i]);const u=tr(d=>d.setActiveSession);return w.useEffect(()=>{const d=window.api?.desktop?.onOpenConversation?.(h=>{u(h),l("/chat")});return()=>d?.()},[l,u]),O.jsx(Wdn,{children:O.jsxs("div",{className:"relative flex h-screen overflow-hidden",children:[s&&O.jsx(Lln,{}),O.jsx(Mle,{}),O.jsx(fcn,{open:e}),O.jsx(CIe,{}),O.jsx(jdn,{}),O.jsx(MNe,{}),O.jsx(Ydn,{open:t,onClose:r,onGoToConsole:n}),O.jsx(Fle,{open:a,onClose:o,onAgentCreated:c}),O.jsx(Bdn,{}),O.jsx("main",{className:"flex grow flex-col overflow-hidden",children:O.jsx(w.Suspense,{fallback:O.jsx("div",{className:"flex grow items-center justify-center",children:O.jsx(pr,{size:"lg",label:"Loading page"})}),children:O.jsxs(Q5e,{children:[O.jsx(Ac,{path:"/",element:O.jsx(yU,{to:"/chat",replace:!0})}),O.jsx(Ac,{path:"/chat",element:O.jsx(Nie,{})}),O.jsx(Ac,{path:"/chat/:agentId",element:O.jsx(Nie,{})}),O.jsx(Ac,{path:"/agents",element:O.jsx(Dse,{})}),O.jsx(Ac,{path:"/agents/:agentId",element:O.jsx(Dse,{})}),O.jsx(Ac,{path:"/settings",element:O.jsx(thn,{})}),O.jsx(Ac,{path:"/agent-hub",element:O.jsx(Jdn,{})}),O.jsx(Ac,{path:"/agent-hub/:agentId",element:O.jsx(Kdn,{})}),O.jsx(Ac,{path:"/schedules",element:O.jsx(ehn,{})}),O.jsx(Ac,{path:"*",element:O.jsx(yU,{to:"/chat",replace:!0})})]})})})]})})},rhn={queries:{staleTime:5*60*1e3,gcTime:10*60*1e3,retry:1,refetchOnWindowFocus:!0,refetchOnMount:!0,refetchOnReconnect:!1,networkMode:"always"},mutations:{retry:1,networkMode:"always"}},x_e=new lCe({defaultOptions:rhn}),ihn=`
|
|
1338
|
+
A good description helps you and others understand what the agent does and any special instructions. The descriptions are also used by other agents to help them understand how to tag each other in for certain tasks.<br /><br />If you want this agent to be part of the agent-to-agent communication network, it will need to have a description that captures its purpose and capabilities. Be concise and specific.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-agent-hub",attachTo:{element:'[data-tour-tag="nav-item-agent-hub"]',on:"right"},title:"Discover more agents",text:`Let's visit the Agent hub to find community-created agents. Click on the "Agent hub" icon in the navigation bar.`,buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('[data-tour-tag="create-new-agent-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"agent-hub-view",attachTo:{element:'[data-tour-tag="agent-hub-sidebar-container"]',on:"right"},title:"The Agent hub",text:"Here you can browse agents by category or search for specific ones. These agents are shared by the community and can perform various specialized tasks.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"download-agent",attachTo:{element:'button[data-tour-tag="agent-hub-download-button"]',on:"bottom"},title:"Download an agent",text:'Find an agent that interests you and click the "Get" button to add it to your local agent list.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{this.next()},1e3)}}]},{id:"upload-agent-hub",attachTo:{element:()=>Ldn("upload-to-hub-header-button"),on:"bottom"},title:"Share your agents",text:"If you create a useful agent, you can also share it with the community by uploading it to the Agent hub from the agent options menu.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agent-hub"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){Qse("open-upload-dialog"),setTimeout(()=>{this.next()},500)}}]},{id:"upload-agent-hub-dialog",attachTo:{element:'[data-tour-tag="upload-agent-dialog"]',on:"right"},title:"Upload agent to hub",text:"This dialog allows you to share your agent with the community. You need to have a Radient account to upload an agent, which is free to create and doesn't cost anything per upload. You can review the agent details and confirm the upload. Make sure your agent meets the required criteria before submitting. Also be aware that any conversation history and learnings for this agent will be part of its training and will be visible to the public. So don't share agents publicly that know sensitive information.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="upload-agent-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-schedules",attachTo:{element:'[data-tour-tag="nav-item-schedules"]',on:"right"},title:"Automate tasks with schedules",text:"Local Operator can run tasks for you on a regular basis. Let's check out the Schedules section.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-agents"]');e&&e.click(),setTimeout(()=>{Qse("open-upload-dialog")},500),setTimeout(()=>{this.back()},1e3)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"schedules-overview",title:"Proactive agents with schedules",text:"A powerful feature of Local Operator is the ability to ask agents to perform tasks on their own on a recurring basis. This turns them from reactive agent bots to proactive agents that work on their own in the background to support you without you needing to continually ask them to do things.<br /><br />You can simply ask any agent to do something at some point in the future, or to handle some daily task at a certain time, and it will create a prompt for itself that will be executed at the specified times.<br /><br />Here, you can view, create, and manage all your scheduled tasks in one place to streamline your workflow and ensure important actions happen automatically.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"create-schedule",attachTo:{element:'button[data-tour-tag="create-schedule-button"]',on:"bottom"},title:"Set up a recurring task",text:'Click "Create schedule" to ask an agent to perform a task for you regularly, like sending a daily report or checking for news updates.<br /><br />You can also create one-off tasks that only run once at some point in the future.',buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('button[data-tour-tag="create-schedule-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"create-schedule-dialog",attachTo:{element:'[data-tour-tag="create-schedule-dialog"]',on:"right"},title:"Configure your schedule",text:"While it is often much easier to simply ask the agent to do a task on a recurring basis for you, you can also manually set up a schedule for a task here or update existing tasks.<br /><br />The prompt is the message that will be sent to the agent at the predefined schedule. You can update the time of day in your local timezone, the frequency of the task, and even specify a specific date or time that the task should stop running at.<br /><br />You can also schedule one-off tasks that only run once at some point in the future.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.back()},500)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="create-schedule-dialog-cancel-button"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"navigate-settings",attachTo:{element:'[data-tour-tag="nav-item-settings"]',on:"right"},title:"Personalize your experience",text:"Now, let's explore the Settings menu to customize Local Operator to your liking.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-schedules"]');e&&e.click(),setTimeout(()=>{const t=document.querySelector('button[data-tour-tag="create-schedule-button"]');t&&t.click()},500),setTimeout(()=>{this.back()},1e3)}},{text:"Next",classes:"shepherd-button-primary",action:function(){const e=document.querySelector('[data-tour-tag="nav-item-settings"]');e&&e.click(),setTimeout(()=>{this.next()},500)}}]},{id:"general-settings",attachTo:{element:'div[data-tour-tag="settings-general-section"]',on:"right"},title:"General settings",text:"Here you can update your user profile, configure model settings (like default hosting provider and model), and adjust history settings for conversations and learnings.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"appearance-settings",attachTo:{element:'[data-tour-tag="settings-appearance-section"]',on:"right"},title:"Customize appearance",text:"Choose from various themes to change the look and feel of Local Operator. Find one that suits your style.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"radient-account-settings",attachTo:{element:'[data-tour-tag="settings-radient-account-section"]',on:"right"},title:"Radient account",text:"Connect your Radient account to access your Radient Pass details, credits, and unlock unified access to models and tools. Radient is the best way to use Local Operator since it powers the AI models, web search, image generation, and much more with a single integration. You get free credits when you sign up to try it out and bonus credits when you top up.<br /><br />When you sign in for the first time, it will automatically create a Radient Pass for you and save it securely to your computer. This will power your Local Operator agents with Radient Automatic, which mixes and matches AI models to get you the best balance of speed, accuracy, and cost in every step of your agents' workflows.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"integrations-settings",attachTo:{element:'[data-tour-tag="settings-integrations-section"]',on:"right"},title:"Connect your services",text:"Enhance your agents' capabilities by connecting your Google services like Gmail, Calendar, and Drive. This allows agents to access and manage your information with your permission.<br /><br />You need to be logged in to a Radient account to use this feature, however it is free to use and doesn't cost any additional Radient credits per action.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"api-credentials-settings",attachTo:{element:'[data-tour-tag="settings-api-credentials-section"]',on:"right"},title:"Manage API keys",text:"Configure API keys for various services and AI models here. This allows your agents to access external tools and capabilities.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"application-updates-settings",attachTo:{element:'[data-tour-tag="settings-app-updates-section"]',on:"right"},title:"Stay up to date",text:"Check for updates to Local Operator here to ensure you have the latest features and improvements. You can see your current version information below.",buttons:[{text:"Back",classes:"shepherd-button-secondary",action:function(){this.back()}},{text:"Next",classes:"shepherd-button-primary",action:function(){this.next()}}]},{id:"tour-complete",title:"Tour complete",text:"You've now seen the main features of Local Operator. Feel free to explore further and discover all the ways your AI agents can assist you. Happy automating.",buttons:[{text:"Finish",classes:"shepherd-button-primary",action:function(){this.complete()}}]}],qdn=()=>{const e=ta(),{completeTourOnboarding:t}=ex(),n=w.useContext(qE),r={cancelIcon:{enabled:!0},scrollTo:{behavior:"smooth",block:"center"}},i=!0;return{startTour:a=>{if(n?.tour?.isActive()&&!a?.forceModalCompleted){console.log("Onboarding tour is already active (from context.tour). Not starting another.");return}const o=ex.getState();if(!a?.forceModalCompleted&&!o.isModalComplete){console.log("Onboarding modal not completed (checked via store). Tour will not start.");return}if(o.isTourComplete&&!a?.forceModalCompleted){console.log("Onboarding tour already completed in store and not forced. Not starting again.");return}let l=n?.tour;const c=n?.Shepherd;if(!l&&c&&(l=c.activeTour,!l&&c.Tour&&(console.log("No active Shepherd tour found from context or global. Creating a new one."),l=new c.Tour({useModalOverlay:i,defaultStepOptions:r}))),!l){console.warn("Failed to get or create a Shepherd tour instance.",n);return}if(l.isActive()){console.log("Tour is already active. Not starting again.");return}if(l.options.defaultStepOptions={...l.options.defaultStepOptions||{},...r},l.options.useModalOverlay=i,a?.firstAgentId&&(l.options.firstAgentId=a.firstAgentId),l.off("complete",t),l.on("complete",t),l.off("cancel",t),l.on("cancel",t),a?.forceModalCompleted||!l.isActive()){const u=[...l.steps];for(const d of u)d.id&&l.removeStep(d.id);l.addSteps(Ese)}else l.steps.length===0&&l.addSteps(Ese);typeof l.start=="function"?(e("/"),l.start()):console.warn("Shepherd tour instance does not have a start method.",l)}}},Udn=()=>{const{isModalComplete:e,isTourComplete:t}=ex(),{startTour:n}=qdn(),r=me.useContext(qE),{data:i}=$8(1,1);return w.useEffect(()=>{if(e&&!t&&r){const s=setTimeout(()=>{const a=i?.agents?.[0]?.id;n({firstAgentId:a})},500);return()=>clearTimeout(s)}},[e,t,r,n,i]),null},Wdn=({children:e})=>O.jsxs(Rdn,{children:[e,O.jsx(Udn,{})]}),Rse=["auth","settings","commands","catalogues","lifecycle","mcp","radient"],jdn=()=>{const e=mc(),t=Wi(),[n,r]=w.useState(!1),[i,s]=w.useState(null),a=w.useCallback(()=>{t.invalidateQueries({queryKey:Hc.capabilities})},[t]),o=w.useCallback(async()=>{r(!0),s(null);try{await window.api.updater.updateBackend(),a()}catch(m){s(m instanceof Error?m.message:"The backend update could not start.")}finally{r(!1)}},[a]);if(e.isLoading)return null;const l=e.data,c=l?Rse.filter(m=>(l.features?.[m]??0)<1):[...Rse],u=!!l&&!l?.desktop_available;if(l?.desktop_available&&c.length===0)return null;const d=lle(e.error),h=!!l,f=!!window.api?.updater?.updateBackend,p=j6e({kind:d,unpaired:u,missing:c,answered:h}),g=f&&W6e({kind:d,unpaired:u,answered:h});return O.jsx("div",{className:"fixed inset-x-0 top-0 z-2100 w-full",children:O.jsx(po,{variant:"warning",className:"items-center rounded-none border-x-0 border-t-0",children:O.jsxs("div",{className:"flex w-full items-center justify-between gap-4",children:[O.jsxs(RC,{children:[p,i?` ${i}`:null]}),O.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[g&&O.jsx(we,{variant:"primary",size:"sm",onClick:()=>void o(),disabled:n,children:n?"Updating":"Update backend"}),O.jsx(we,{variant:"secondary",size:"sm",onClick:a,children:"Retry"})]})]})})})},Gdn=""+new URL("radient-icon-1024x1024-D_JJedvo.png",import.meta.url).href,b_e={all:["radient-prices"],prices:()=>[...b_e.all,"prices"]},Vdn=()=>{const e=hr({queryKey:b_e.prices(),queryFn:()=>M8({operation:"prices"}),staleTime:36e5,refetchOnWindowFocus:!1,refetchOnMount:!0,refetchInterval:!1,retry:3});return{prices:e.data,isLoading:e.isLoading,isFetching:e.isFetching,error:e.error,pricesQuery:e}},w_e=Ya()(uu(e=>({hasBeenNotified:!1,setHasBeenNotified:t=>{e({hasBeenNotified:t})}}),{name:"low-credits-storage"})),Ydn=({open:e,onClose:t,onGoToConsole:n})=>{const{setHasBeenNotified:r}=w_e(),{prices:i,isLoading:s,error:a}=Vdn(),o=u=>typeof u!="number"?"$...":`$${u.toFixed(2)} USD`,l=()=>{r(!0),t()},c=()=>{r(!0),n()};return O.jsx(FO,{open:e,onClose:l,title:O.jsxs(O.Fragment,{children:[O.jsx("img",{src:Gdn,alt:"Radient icon",className:"size-7"}),"Running low on Radient credits?"]}),maxWidth:"sm",fullWidth:!1,actions:O.jsxs(O.Fragment,{children:[O.jsx(g1,{onClick:l,children:"Maybe later"}),O.jsx(p1,{onClick:c,startIcon:O.jsx(LC,{size:18}),className:"min-w-55",children:"Get more credits"})]}),children:O.jsxs("div",{className:"flex flex-col items-center gap-4 py-2 text-center",children:[O.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Unlock the full power of Local Operator with"," ",O.jsx("span",{className:"font-bold text-accent",children:"Radient Pass"}),"."]}),O.jsx("p",{className:"text-body-sm text-ink-muted",children:"Radient Automatic is often cheaper than bringing your own key: its smart model routing picks the most cost-effective model for each step of your agentic workflows."}),O.jsx("p",{className:"text-body-sm text-ink-muted",children:"It's pay-as-you-go with no commitments. Load up what you need, starting small for maximum flexibility."}),O.jsxs("p",{className:"text-body-sm text-ink-muted",children:["Plus, get"," ",O.jsx("span",{className:"font-medium text-ink",children:s?O.jsx(pr,{size:"sm",className:"mr-0.5 align-middle"}):o(i?.default_registration_credits)})," ","in bonus credits with your first purchase.",a&&O.jsx("span",{className:"mt-1 block text-meta text-danger",children:"Could not load bonus credit information."})]}),O.jsx("p",{className:"text-meta text-ink-dim",children:"You can also reach the Radient Console from Settings at any time."})]})})},Ase=({expanded:e})=>O.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[O.jsx("img",{src:W_e,alt:e?"":"Local Operator",loading:"eager",className:"size-6 shrink-0"}),e&&O.jsx("span",{className:"truncate font-semibold text-body text-ink",children:"Local Operator"})]}),y_e=me.memo(({expanded:e,useAuth:t=!1})=>{const n=ta(),{user:r,isAuthenticated:i,signOut:s}=z8(),a=r?.name??"User",o=r?.email??"",l=w.useCallback(async()=>{i&&(await s(),window.location.reload())},[i,s]),c=w.useMemo(()=>a?a.split(" ").map(h=>h.charAt(0)).join("").toUpperCase().substring(0,2):null,[a]),u=O.jsxs("button",{type:"button",onClick:t?void 0:()=>n("/settings"),"aria-label":e?void 0:"Account settings",className:N("flex w-full items-center gap-2 rounded-sm transition-colors duration-fast ease-out-quart hover:bg-elevated",e?"px-3 py-1.5":"justify-center py-1.5"),children:[O.jsx(Wse,{className:"size-7 shrink-0",children:O.jsx(jse,{className:"bg-elevated text-ink",children:c??O.jsx(Uoe,{size:14,"aria-hidden":"true"})})}),e&&a&&O.jsxs("span",{className:"min-w-0 text-left",children:[O.jsx("span",{className:"block truncate text-body-sm text-ink",children:a}),o&&O.jsx("span",{className:"block truncate text-meta text-ink-dim",children:o})]})]}),d=e?u:O.jsx(pt,{content:"Account settings",side:"right",children:u});return t?O.jsxs(pS,{children:[e?O.jsx(Ov,{asChild:!0,children:u}):O.jsx(pt,{content:"Account settings",side:"right",children:O.jsx(Ov,{asChild:!0,children:u})}),O.jsxs(gS,{align:"end",side:"top",className:"min-w-50",children:[O.jsxs(is,{onSelect:()=>n("/settings"),children:[O.jsx(Oh,{size:16,"aria-hidden":"true"}),"Settings"]}),O.jsxs(is,{children:[O.jsx(Moe,{size:16,"aria-hidden":"true"}),"Privacy and security"]}),O.jsx(A0,{}),O.jsxs(is,{onSelect:l,className:"text-danger focus:bg-danger-wash focus:text-danger",children:[O.jsx(R4e,{size:16,"aria-hidden":"true"}),"Sign out"]})]})]}):d});y_e.displayName="UserProfileSidebar";const Xse={expanded:"w-55",collapsed:"w-12"},Bdn=()=>{const e=ta(),t=KIe(),{isSidebarCollapsed:n,toggleSidebar:r}=Zn(),i=!n,s=[{icon:qC,label:"Chat",path:"/chat",isActive:t==="chat",tourTag:"nav-item-chat"},{icon:f1,label:"My agents",path:"/agents",isActive:t==="agents",tourTag:"nav-item-agents"},{icon:qoe,label:"Agent hub",path:"/agent-hub",isActive:t==="agent-hub",tourTag:"nav-item-agent-hub"},{icon:koe,label:"Schedules",path:"/schedules",isActive:t==="schedules",tourTag:"nav-item-schedules"},{icon:Oh,label:"Settings",path:"/settings",isActive:t==="settings",tourTag:"nav-item-settings"}],a=c=>{const u=O.jsxs("button",{type:"button",onClick:()=>e(c.path),"data-tour-tag":c.tourTag,"aria-current":c.isActive?"page":void 0,"aria-label":i?void 0:c.label,className:N("flex h-8 w-full items-center rounded-sm text-body-sm transition-colors duration-fast ease-out-quart",i?"justify-start gap-2 px-3":"justify-center",c.isActive?"bg-accent-wash font-medium text-ink":"text-ink-muted hover:bg-elevated hover:text-ink"),children:[O.jsx(c.icon,{size:16,"aria-hidden":"true",className:N("shrink-0",c.isActive&&"text-accent")}),i&&O.jsx("span",{className:"truncate",children:c.label})]});return i?O.jsx("li",{children:u},c.path):O.jsx("li",{children:O.jsx(pt,{content:c.label,side:"right",children:u})},c.path)},o=i?"Collapse sidebar":"Expand sidebar",l=O.jsx("div",{className:N("pointer-events-none opacity-0 transition-opacity duration-fast ease-out-quart","group-hover:pointer-events-auto group-hover:opacity-100","group-focus-within:pointer-events-auto group-focus-within:opacity-100"),children:O.jsx(pt,{content:o,side:"right",children:O.jsx(we,{variant:"ghost",size:"icon-sm",onClick:r,"aria-label":o,"aria-expanded":i,children:i?O.jsx(wv,{"aria-hidden":"true"}):O.jsx(Eh,{"aria-hidden":"true"})})})});return O.jsxs("nav",{className:N("group flex shrink-0 flex-col overflow-x-hidden bg-sunken transition-[width] duration-base ease-out-quart",i?Xse.expanded:Xse.collapsed),children:[O.jsx("div",{className:N("flex h-12 shrink-0 items-center",i?"justify-between pr-2 pl-5":"justify-center"),children:i?O.jsxs(O.Fragment,{children:[O.jsx(Ase,{expanded:!0}),l]}):O.jsxs("div",{className:"relative flex size-8 items-center justify-center",children:[O.jsx("div",{className:"transition-opacity duration-fast ease-out-quart group-hover:opacity-0 group-focus-within:opacity-0",children:O.jsx(Ase,{expanded:!1})}),O.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:l})]})}),O.jsx("ul",{className:"flex flex-col gap-1 p-2",children:s.map(a)}),O.jsx("div",{className:"mt-auto p-2",children:O.jsx(y_e,{expanded:i})})]})},Zdn=1,Hdn=()=>{const{isAuthenticated:e,user:t}=z8(),{hasBeenNotified:n,setHasBeenNotified:r}=w_e(),[i,s]=w.useState(!1),[a,o]=w.useState(null),l=w.useCallback(async()=>{if(!(!e||!t?.radientUser?.account?.tenant_id))try{const h=await M8({operation:"credits",tenantId:t.radientUser.account.tenant_id});if(!h||typeof h.balance!="number")throw new Error("Invalid credit balance response format");o(h.balance)}catch(h){console.error("Failed to fetch Radient credits:",h),o(null)}},[e,t?.radientUser?.account?.tenant_id]);return w.useEffect(()=>{e&&l()},[e,l]),w.useEffect(()=>{e&&a!==null?a<Zdn?n||s(!0):(s(!1),n&&r(!1)):s(!1)},[e,n,a,r]),{isLowCreditsDialogOpen:i,openRadientConsole:()=>{window.api?.openExternal?window.api.openExternal("https://console.radienthq.com"):window.open("https://console.radienthq.com","_blank"),r(!0),s(!1)},closeLowCreditsDialog:()=>{s(!1)},onLowCreditsDialogClose:()=>{r(!0),s(!1)},currentCredits:a}},Kdn=w.lazy(()=>Xe(()=>import("./agent-details-page-o4gHsKUa.js"),__vite__mapDeps([9,1,2,10,11]),import.meta.url).then(e=>({default:e.AgentDetailsPage}))),Jdn=w.lazy(()=>Xe(()=>import("./agent-hub-page-BzDj9IWf.js"),__vite__mapDeps([12,1,2,13,14,11]),import.meta.url).then(e=>({default:e.AgentHubPage}))),Dse=w.lazy(()=>Xe(()=>import("./agents-page-fMYF44vi.js"),__vite__mapDeps([15,1,2]),import.meta.url).then(e=>({default:e.AgentsPage}))),ehn=w.lazy(()=>Xe(()=>import("./schedules-page-DI3d_Jms.js"),__vite__mapDeps([16,1,2,14,17,10]),import.meta.url).then(e=>({default:e.SchedulesPage}))),thn=w.lazy(()=>Xe(()=>import("./settings-page-CvFjZpKU.js"),__vite__mapDeps([18,1,2,14,10,19,17,3,20,21,22,23,24]),import.meta.url).then(e=>({default:e.SettingsPage}))),nhn=()=>{const{isOnboardingActive:e}=MIe(),{isLowCreditsDialogOpen:t,openRadientConsole:n,onLowCreditsDialogClose:r}=Hdn(),{toggleCommandPalette:i,isCommandPaletteOpen:s,isCreateAgentDialogOpen:a,closeCreateAgentDialog:o}=Zn(),l=ta(),c=d=>{l(`/chat/${d}`),o()};w.useEffect(()=>{const d=()=>{i()},h=window.electron.ipcRenderer.on("toggle-command-palette",d);return()=>{h&&h()}},[i]);const u=tr(d=>d.setActiveSession);return w.useEffect(()=>{const d=window.api?.desktop?.onOpenConversation?.(h=>{u(h),l("/chat")});return()=>d?.()},[l,u]),O.jsx(Wdn,{children:O.jsxs("div",{className:"relative flex h-screen overflow-hidden",children:[s&&O.jsx(Lln,{}),O.jsx(Mle,{}),O.jsx(fcn,{open:e}),O.jsx(CIe,{}),O.jsx(jdn,{}),O.jsx(MNe,{}),O.jsx(Ydn,{open:t,onClose:r,onGoToConsole:n}),O.jsx(Fle,{open:a,onClose:o,onAgentCreated:c}),O.jsx(Bdn,{}),O.jsx("main",{className:"flex grow flex-col overflow-hidden",children:O.jsx(w.Suspense,{fallback:O.jsx("div",{className:"flex grow items-center justify-center",children:O.jsx(pr,{size:"lg",label:"Loading page"})}),children:O.jsxs(Q5e,{children:[O.jsx(Ac,{path:"/",element:O.jsx(yU,{to:"/chat",replace:!0})}),O.jsx(Ac,{path:"/chat",element:O.jsx(Nie,{})}),O.jsx(Ac,{path:"/chat/:agentId",element:O.jsx(Nie,{})}),O.jsx(Ac,{path:"/agents",element:O.jsx(Dse,{})}),O.jsx(Ac,{path:"/agents/:agentId",element:O.jsx(Dse,{})}),O.jsx(Ac,{path:"/settings",element:O.jsx(thn,{})}),O.jsx(Ac,{path:"/agent-hub",element:O.jsx(Jdn,{})}),O.jsx(Ac,{path:"/agent-hub/:agentId",element:O.jsx(Kdn,{})}),O.jsx(Ac,{path:"/schedules",element:O.jsx(ehn,{})}),O.jsx(Ac,{path:"*",element:O.jsx(yU,{to:"/chat",replace:!0})})]})})})]})})},rhn={queries:{staleTime:5*60*1e3,gcTime:10*60*1e3,retry:1,refetchOnWindowFocus:!0,refetchOnMount:!0,refetchOnReconnect:!1,networkMode:"always"},mutations:{retry:1,networkMode:"always"}},x_e=new lCe({defaultOptions:rhn}),ihn=`
|
|
1339
1339
|
*::-webkit-scrollbar {
|
|
1340
1340
|
width: 8px;
|
|
1341
1341
|
height: 8px;
|